@ulb-darmstadt/shacl-form 3.7.1 → 3.7.3

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.
@@ -13,17 +13,17 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
13
13
  `)+this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)}`,e=r.predicate);return new xe(`${t}\n]`)}}list(e){let t=e&&e.length||0,n=Array(t);for(let r=0;r<t;r++)n[r]=this._encodeObject(e[r]);return new xe(`(${n.join(` `)})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
14
14
  `:`
15
15
  }
16
- `),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,r)=>{t=null,e(n,r)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}};function Ce(e){let t=be[e];return t===void 0&&(e.length===1?(t=e.charCodeAt(0).toString(16),t=`\\u0000`.substr(0,6-t.length)+t):(t=((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)+9216).toString(16),t=`\\U00000000`.substr(0,10-t.length)+t)),t}var W=o(((e,t)=>{t.exports={AggregateError:class extends Error{constructor(e){if(!Array.isArray(e))throw TypeError(`Expected input to be an Array, got ${typeof e}`);let t=``;for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name=`AggregateError`,this.errors=e}},ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:2**53-1,NumberMIN_SAFE_INTEGER:-(2**53-1),NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,n){return Object.defineProperty(e,t,n)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,n){return e.then(t,n)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,n){return e.slice(t,n)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol(`Symbol.dispose`),SymbolAsyncDispose:Symbol.asyncDispose||Symbol(`Symbol.asyncDispose`),TypedArrayPrototypeSet(e,t,n){return e.set(t,n)},Boolean,Uint8Array}})),we=o(((e,t)=>{t.exports={format(e,...t){return e.replace(/%([sdifj])/g,function(...[e,n]){let r=t.shift();return n===`f`?r.toFixed(6):n===`j`?JSON.stringify(r):n===`s`&&typeof r==`object`?`${r.constructor===Object?``:r.constructor.name} {}`.trim():r.toString()})},inspect(e){switch(typeof e){case`string`:if(e.includes(`'`)){if(!e.includes(`"`))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case`number`:return isNaN(e)?`NaN`:Object.is(e,-0)?String(e):e;case`bigint`:return`${String(e)}n`;case`boolean`:case`undefined`:return String(e);case`object`:return`{}`}}}})),Te=o(((e,t)=>{var{format:n,inspect:r}=we(),{AggregateError:i}=W(),a=globalThis.AggregateError||i,o=Symbol(`kIsNodeError`),s=[`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`],c=/^([A-Z][a-z0-9]*)+$/,l=`__node_internal_`,u={};function d(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function f(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function p(e,t,r){if(typeof t==`function`)return d(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);let i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?t:n(t,...r)}function m(e,t,n){n||=Error;class r extends n{constructor(...n){super(p(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[o]=!0,u[e]=r}function h(e){let t=l+e.name;return Object.defineProperty(e,"name",{value:t}),e}function g(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;let n=new a([t,e],t.message);return n.code=t.code,n}return e||t}var _=class extends Error{constructor(e=`The operation was aborted`,t=void 0){if(t!==void 0&&typeof t!=`object`)throw new u.ERR_INVALID_ARG_TYPE(`options`,`Object`,t);super(e,t),this.code=`ABORT_ERR`,this.name=`AbortError`}};m(`ERR_ASSERTION`,`%s`,Error),m(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{d(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let i=`The `;e.endsWith(` argument`)?i+=`${e} `:i+=`"${e}" ${e.includes(`.`)?`property`:`argument`} `,i+=`must be `;let a=[],o=[],l=[];for(let e of t)d(typeof e==`string`,`All expected entries have to be of type string`),s.includes(e)?a.push(e.toLowerCase()):c.test(e)?o.push(e):(d(e!==`object`,`The value "object" should be written as "Object"`),l.push(e));if(o.length>0){let e=a.indexOf(`object`);e!==-1&&(a.splice(a,e,1),o.push(`Object`))}if(a.length>0){switch(a.length){case 1:i+=`of type ${a[0]}`;break;case 2:i+=`one of type ${a[0]} or ${a[1]}`;break;default:{let e=a.pop();i+=`one of type ${a.join(`, `)}, or ${e}`}}(o.length>0||l.length>0)&&(i+=` or `)}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let e=o.pop();i+=`an instance of ${o.join(`, `)}, or ${e}`}}l.length>0&&(i+=` or `)}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(i+=`an `),i+=`${l[0]}`;break;case 2:i+=`one of ${l[0]} or ${l[1]}`;break;default:{let e=l.pop();i+=`one of ${l.join(`, `)}, or ${e}`}}if(n==null)i+=`. Received ${n}`;else if(typeof n==`function`&&n.name)i+=`. Received function ${n.name}`;else if(typeof n==`object`){var u;if((u=n.constructor)!=null&&u.name)i+=`. Received an instance of ${n.constructor.name}`;else{let e=r(n,{depth:-1});i+=`. Received ${e}`}}else{let e=r(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),i+=`. Received type ${typeof n} (${e})`}return i},TypeError),m(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let i=r(t);return i.length>128&&(i=i.slice(0,128)+`...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${i}`},TypeError),m(`ERR_INVALID_RETURN_VALUE`,(e,t,n)=>{var r;return`Expected ${e} to be returned from the "${t}" function but got ${n!=null&&(r=n.constructor)!=null&&r.name?`instance of ${n.constructor.name}`:`type ${typeof n}`}.`},TypeError),m(`ERR_MISSING_ARGS`,(...e)=>{d(e.length>0,`At least one arg needs to be specified`);let t,n=e.length;switch(e=(Array.isArray(e)?e:[e]).map(e=>`"${e}"`).join(` or `),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{let n=e.pop();t+=`The ${e.join(`, `)}, and ${n} arguments`}break}return`${t} must be specified`},TypeError),m(`ERR_OUT_OF_RANGE`,(e,t,n)=>{d(t,`Missing "range" argument`);let i;if(Number.isInteger(n)&&Math.abs(n)>2**32)i=f(String(n));else if(typeof n==`bigint`){i=String(n);let e=BigInt(2)**BigInt(32);(n>e||n<-e)&&(i=f(i)),i+=`n`}else i=r(n);return`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError),m(`ERR_MULTIPLE_CALLBACK`,`Callback called multiple times`,Error),m(`ERR_METHOD_NOT_IMPLEMENTED`,`The %s method is not implemented`,Error),m(`ERR_STREAM_ALREADY_FINISHED`,`Cannot call %s after a stream was finished`,Error),m(`ERR_STREAM_CANNOT_PIPE`,`Cannot pipe, not readable`,Error),m(`ERR_STREAM_DESTROYED`,`Cannot call %s after a stream was destroyed`,Error),m(`ERR_STREAM_NULL_VALUES`,`May not write null values to stream`,TypeError),m(`ERR_STREAM_PREMATURE_CLOSE`,`Premature close`,Error),m(`ERR_STREAM_PUSH_AFTER_EOF`,`stream.push() after EOF`,Error),m(`ERR_STREAM_UNSHIFT_AFTER_END_EVENT`,`stream.unshift() after end event`,Error),m(`ERR_STREAM_WRITE_AFTER_END`,`write after end`,Error),m(`ERR_UNKNOWN_ENCODING`,`Unknown encoding: %s`,TypeError),t.exports={AbortError:_,aggregateTwoErrors:h(g),hideStackFrames:h,codes:u}})),Ee=o(((e,t)=>{var{AbortController:n,AbortSignal:r}=typeof self<`u`?self:typeof window<`u`?window:void 0;t.exports=n,t.exports.AbortSignal=r,t.exports.default=n})),De=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),Oe=o(((e,t)=>{var n=f(),{format:r,inspect:i}=we(),{codes:{ERR_INVALID_ARG_TYPE:a}}=Te(),{kResistStopPropagation:o,AggregateError:s,SymbolDispose:c}=W(),l=globalThis.AbortSignal||Ee().AbortSignal,u=globalThis.AbortController||Ee().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||n.Blob,m=p===void 0?function(e){return!1}:function(e){return e instanceof p},h=(e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new a(t,`AbortSignal`,e)},g=(e,t)=>{if(typeof e!=`function`)throw new a(t,`Function`,e)};t.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},promisify(e){return new Promise((t,n)=>{e((e,...r)=>e?n(e):t(...r))})},debuglog(){return function(){}},format:r,inspect:i,types:{isAsyncFunction(e){return e instanceof d},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:m,deprecate(e,t){return e},addAbortListener:De().addAbortListener||function(e,t){if(e===void 0)throw new a(`signal`,`AbortSignal`,e);h(e,`signal`),g(t,`listener`);let n;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener(`abort`,t,{__proto__:null,once:!0,[o]:!0}),n=()=>{e.removeEventListener(`abort`,t)}),{__proto__:null,[c](){var e;(e=n)==null||e()}}},AbortSignalAny:l.any||function(e){if(e.length===1)return e[0];let t=new u,n=()=>t.abort();return e.forEach(e=>{h(e,`signals`),e.addEventListener(`abort`,n,{once:!0})}),t.signal.addEventListener(`abort`,()=>{e.forEach(e=>e.removeEventListener(`abort`,n))},{once:!0}),t.signal}},t.exports.promisify.custom=Symbol.for(`nodejs.util.promisify.custom`)})),ke=o(((e,t)=>{var{ArrayIsArray:n,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:i,ArrayPrototypeMap:a,NumberIsInteger:o,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:l,NumberParseInt:u,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:h}=W(),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:y,ERR_OUT_OF_RANGE:b,ERR_UNKNOWN_SIGNAL:x}}=Te(),{normalizeEncoding:S}=Oe(),{isAsyncFunction:C,isArrayBufferView:w}=Oe().types,T={};function E(e){return e===(e|0)}function D(e){return e===e>>>0}var O=/^[0-7]+$/,k=`must be a 32-bit unsigned integer or an octal string`;function A(e,t,n){if(e===void 0&&(e=n),typeof e==`string`){if(f(O,e)===null)throw new y(t,e,k);e=u(e,8)}return N(e,t),e}var j=g((e,t,n=l,r=c)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),M=g((e,t,n=-2147483648,r=2147483647)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),N=g((e,t,n=!1)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);let r=+!!n,i=4294967295;if(e<r||e>i)throw new b(t,`>= ${r} && <= ${i}`,e)});function P(e,t){if(typeof e!=`string`)throw new v(t,`string`,e)}function F(e,t,n=void 0,r){if(typeof e!=`number`)throw new v(t,`number`,e);if(n!=null&&e<n||r!=null&&e>r||(n!=null||r!=null)&&s(e))throw new b(t,`${n==null?``:`>= ${n}`}${n!=null&&r!=null?` && `:``}${r==null?``:`<= ${r}`}`,e)}var I=g((e,t,n)=>{if(!r(n,e))throw new y(t,e,`must be one of: `+i(a(n,e=>typeof e==`string`?`'${e}'`:p(e)),`, `))});function L(e,t){if(typeof e!=`boolean`)throw new v(t,`boolean`,e)}function R(e,t,n){return e==null||!d(e,t)?n:e[t]}var z=g((e,t,r=null)=>{let i=R(r,`allowArray`,!1),a=R(r,`allowFunction`,!1);if(!R(r,`nullable`,!1)&&e===null||!i&&n(e)||typeof e!=`object`&&(!a||typeof e!=`function`))throw new v(t,`Object`,e)}),B=g((e,t)=>{if(e!=null&&typeof e!=`object`&&typeof e!=`function`)throw new v(t,`a dictionary`,e)}),ee=g((e,t,r=0)=>{if(!n(e))throw new v(t,`Array`,e);if(e.length<r)throw new y(t,e,`must be longer than ${r}`)});function te(e,t){ee(e,t);for(let n=0;n<e.length;n++)P(e[n],`${t}[${n}]`)}function ne(e,t){ee(e,t);for(let n=0;n<e.length;n++)L(e[n],`${t}[${n}]`)}function V(e,t){ee(e,t);for(let n=0;n<e.length;n++){let r=e[n],i=`${t}[${n}]`;if(r==null)throw new v(i,`AbortSignal`,r);se(r,i)}}function re(e,t=`signal`){if(P(e,t),T[e]===void 0)throw T[m(e)]===void 0?new x(e):new x(e+` (signals must use all capital letters)`)}var ie=g((e,t=`buffer`)=>{if(!w(e))throw new v(t,[`Buffer`,`TypedArray`,`DataView`],e)});function ae(e,t){let n=S(t),r=e.length;if(n===`hex`&&r%2!=0)throw new y(`encoding`,t,`is invalid for data of length ${r}`)}function oe(e,t=`Port`,n=!0){if(typeof e!=`number`&&typeof e!=`string`||typeof e==`string`&&h(e).length===0||+e!=e>>>0||e>65535||e===0&&!n)throw new _(t,e,n);return e|0}var se=g((e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new v(t,`AbortSignal`,e)}),ce=g((e,t)=>{if(typeof e!=`function`)throw new v(t,`Function`,e)}),le=g((e,t)=>{if(typeof e!=`function`||C(e))throw new v(t,`Function`,e)}),ue=g((e,t)=>{if(e!==void 0)throw new v(t,`undefined`,e)});function de(e,t,n){if(!r(n,e))throw new v(t,`('${i(n,`|`)}')`,e)}var fe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(e,t){if(e===void 0||!f(fe,e))throw new y(t,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}function me(e){if(typeof e==`string`)return pe(e,`hints`),e;if(n(e)){let t=e.length,n=``;if(t===0)return n;for(let r=0;r<t;r++){let i=e[r];pe(i,`hints`),n+=i,r!==t-1&&(n+=`, `)}return n}throw new y(`hints`,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}t.exports={isInt32:E,isUint32:D,parseFileMode:A,validateArray:ee,validateStringArray:te,validateBooleanArray:ne,validateAbortSignalArray:V,validateBoolean:L,validateBuffer:ie,validateDictionary:B,validateEncoding:ae,validateFunction:ce,validateInt32:M,validateInteger:j,validateNumber:F,validateObject:z,validateOneOf:I,validatePlainFunction:le,validatePort:oe,validateSignalName:re,validateString:P,validateUint32:N,validateUndefined:ue,validateUnion:de,validateAbortSignal:se,validateLinkHeaderValue:me}})),Ae=o(((e,t)=>{var n=t.exports={},r,i;function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}(function(){try{r=typeof setTimeout==`function`?setTimeout:a}catch{r=a}try{i=typeof clearTimeout==`function`?clearTimeout:o}catch{i=o}})();function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch{try{return r.call(null,e,0)}catch{return r.call(this,e,0)}}}function c(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch{try{return i.call(null,e)}catch{return i.call(this,e)}}}var l=[],u=!1,d,f=-1;function p(){!u||!d||(u=!1,d.length?l=d.concat(l):f=-1,l.length&&m())}function m(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(d=l,l=[];++f<t;)d&&d[f].run();f=-1,t=l.length}d=null,u=!1,c(e)}}n.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),l.length===1&&!u&&s(m)};function h(e,t){this.fun=e,this.array=t}h.prototype.run=function(){this.fun.apply(null,this.array)},n.title=`browser`,n.browser=!0,n.env={},n.argv=[],n.version=``,n.versions={};function g(){}n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw Error(`process.binding is not supported`)},n.cwd=function(){return`/`},n.chdir=function(e){throw Error(`process.chdir is not supported`)},n.umask=function(){return 0}})),G=o(((e,t)=>{var{SymbolAsyncIterator:n,SymbolIterator:r,SymbolFor:i}=W(),a=i(`nodejs.stream.destroyed`),o=i(`nodejs.stream.errored`),s=i(`nodejs.stream.readable`),c=i(`nodejs.stream.writable`),l=i(`nodejs.stream.disturbed`),u=i(`nodejs.webstream.isClosedPromise`),d=i(`nodejs.webstream.controllerErrorFunction`);function f(e,t=!1){return!!(e&&typeof e.pipe==`function`&&typeof e.on==`function`&&(!t||typeof e.pause==`function`&&typeof e.resume==`function`)&&(!e._writableState||e._readableState?.readable!==!1)&&(!e._writableState||e._readableState))}function p(e){return!!(e&&typeof e.write==`function`&&typeof e.on==`function`&&(!e._readableState||e._writableState?.writable!==!1))}function m(e){return!!(e&&typeof e.pipe==`function`&&e._readableState&&typeof e.on==`function`&&typeof e.write==`function`)}function h(e){return e&&(e._readableState||e._writableState||typeof e.write==`function`&&typeof e.on==`function`||typeof e.pipe==`function`&&typeof e.on==`function`)}function g(e){return!!(e&&!h(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`&&typeof e.cancel==`function`)}function _(e){return!!(e&&!h(e)&&typeof e.getWriter==`function`&&typeof e.abort==`function`)}function v(e){return!!(e&&!h(e)&&typeof e.readable==`object`&&typeof e.writable==`object`)}function y(e){return g(e)||_(e)||v(e)}function b(e,t){return e==null?!1:t===!0?typeof e[n]==`function`:t===!1?typeof e[r]==`function`:typeof e[n]==`function`||typeof e[r]==`function`}function x(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[a]||r!=null&&r.destroyed)}function S(e){if(!p(e))return null;if(e.writableEnded===!0)return!0;let t=e._writableState;return t!=null&&t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function C(e,t){if(!p(e))return null;if(e.writableFinished===!0)return!0;let n=e._writableState;return n!=null&&n.errored?!1:typeof n?.finished==`boolean`?!!(n.finished||t===!1&&n.ended===!0&&n.length===0):null}function w(e){if(!f(e))return null;if(e.readableEnded===!0)return!0;let t=e._readableState;return!t||t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function T(e,t){if(!f(e))return null;let n=e._readableState;return n!=null&&n.errored?!1:typeof n?.endEmitted==`boolean`?!!(n.endEmitted||t===!1&&n.ended===!0&&n.length===0):null}function E(e){return e&&e[s]!=null?e[s]:typeof e?.readable==`boolean`?!x(e)&&f(e)&&e.readable&&!T(e):null}function D(e){return e&&e[c]!=null?e[c]:typeof e?.writable==`boolean`?!x(e)&&p(e)&&e.writable&&!S(e):null}function O(e,t){return h(e)?x(e)?!0:!(t?.readable!==!1&&E(e)||t?.writable!==!1&&D(e)):null}function k(e){return h(e)?e.writableErrored?e.writableErrored:e._writableState?.errored??null:null}function A(e){return h(e)?e.readableErrored?e.readableErrored:e._readableState?.errored??null:null}function j(e){if(!h(e))return null;if(typeof e.closed==`boolean`)return e.closed;let t=e._writableState,n=e._readableState;return typeof t?.closed==`boolean`||typeof n?.closed==`boolean`?t?.closed||n?.closed:typeof e._closed==`boolean`&&M(e)?e._closed:null}function M(e){return typeof e._closed==`boolean`&&typeof e._defaultKeepAlive==`boolean`&&typeof e._removedConnection==`boolean`&&typeof e._removedContLen==`boolean`}function N(e){return typeof e._sent100==`boolean`&&M(e)}function P(e){return typeof e._consuming==`boolean`&&typeof e._dumped==`boolean`&&e.req?.upgradeOrConnect===void 0}function F(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!r&&N(e)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function I(e){return!!(e&&(e[l]??(e.readableDidRead||e.readableAborted)))}function L(e){return!!(e&&(e[o]??e.readableErrored??e.writableErrored??e._readableState?.errorEmitted??e._writableState?.errorEmitted??e._readableState?.errored??e._writableState?.errored))}t.exports={isDestroyed:x,kIsDestroyed:a,isDisturbed:I,kIsDisturbed:l,isErrored:L,kIsErrored:o,isReadable:E,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:d,kIsWritable:c,isClosed:j,isDuplexNodeStream:m,isFinished:O,isIterable:b,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:w,isReadableFinished:T,isReadableErrored:A,isNodeStream:h,isWebStream:y,isWritable:D,isWritableNodeStream:p,isWritableStream:_,isWritableEnded:S,isWritableFinished:C,isWritableErrored:k,isServerRequest:P,isServerResponse:N,willEmitClose:F,isTransformStream:v}})),je=o(((e,t)=>{var n=Ae(),{AbortError:r,codes:i}=Te(),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:o}=i,{kEmptyObject:s,once:c}=Oe(),{validateAbortSignal:l,validateFunction:u,validateObject:d,validateBoolean:f}=ke(),{Promise:p,PromisePrototypeThen:m,SymbolDispose:h}=W(),{isClosed:g,isReadable:_,isReadableNodeStream:v,isReadableStream:y,isReadableFinished:b,isReadableErrored:x,isWritable:S,isWritableNodeStream:C,isWritableStream:w,isWritableFinished:T,isWritableErrored:E,isNodeStream:D,willEmitClose:O,kIsClosedPromise:k}=G(),A;function j(e){return e.setHeader&&typeof e.abort==`function`}var M=()=>{};function N(e,t,i){if(arguments.length===2?(i=t,t=s):t==null?t=s:d(t,`options`),u(i,`callback`),l(t.signal,`options.signal`),i=c(i),y(e)||w(e))return P(e,t,i);if(!D(e))throw new a(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],e);let f=t.readable??v(e),p=t.writable??C(e),m=e._writableState,k=e._readableState,N=()=>{e.writable||L()},F=O(e)&&v(e)===f&&C(e)===p,I=T(e,!1),L=()=>{I=!0,e.destroyed&&(F=!1),!(F&&(!e.readable||f))&&(!f||R)&&i.call(e)},R=b(e,!1),z=()=>{R=!0,e.destroyed&&(F=!1),!(F&&(!e.writable||p))&&(!p||I)&&i.call(e)},B=t=>{i.call(e,t)},ee=g(e),te=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);if(f&&!R&&v(e,!0)&&!b(e,!1)||p&&!I&&!T(e,!1))return i.call(e,new o);i.call(e)},ne=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);i.call(e)},V=()=>{e.req.on(`finish`,L)};j(e)?(e.on(`complete`,L),F||e.on(`abort`,te),e.req?V():e.on(`request`,V)):p&&!m&&(e.on(`end`,N),e.on(`close`,N)),!F&&typeof e.aborted==`boolean`&&e.on(`aborted`,te),e.on(`end`,z),e.on(`finish`,L),t.error!==!1&&e.on(`error`,B),e.on(`close`,te),ee?n.nextTick(te):m!=null&&m.errorEmitted||k!=null&&k.errorEmitted?F||n.nextTick(ne):(!f&&(!F||_(e))&&(I||S(e)===!1)||!p&&(!F||S(e))&&(R||_(e)===!1)||k&&e.req&&e.aborted)&&n.nextTick(ne);let re=()=>{i=M,e.removeListener(`aborted`,te),e.removeListener(`complete`,L),e.removeListener(`abort`,te),e.removeListener(`request`,V),e.req&&e.req.removeListener(`finish`,L),e.removeListener(`end`,N),e.removeListener(`close`,N),e.removeListener(`finish`,L),e.removeListener(`end`,z),e.removeListener(`error`,B),e.removeListener(`close`,te)};if(t.signal&&!ee){let a=()=>{let n=i;re(),n.call(e,new r(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(a);else{A||=Oe().addAbortListener;let n=A(t.signal,a),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}}return re}function P(e,t,i){let a=!1,o=M;if(t.signal)if(o=()=>{a=!0,i.call(e,new r(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(o);else{A||=Oe().addAbortListener;let n=A(t.signal,o),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}let s=(...t)=>{a||n.nextTick(()=>i.apply(e,t))};return m(e[k].promise,s,s),M}function F(e,t){var n;let r=!1;return t===null&&(t=s),(n=t)!=null&&n.cleanup&&(f(t.cleanup,`cleanup`),r=t.cleanup),new p((n,i)=>{let a=N(e,t,e=>{r&&a(),e?i(e):n()})})}t.exports=N,t.exports.finished=F})),K=o(((e,t)=>{var n=Ae(),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:i},AbortError:a}=Te(),{Symbol:o}=W(),{kIsDestroyed:s,isDestroyed:c,isFinished:l,isServerRequest:u}=G(),d=o(`kDestroy`),f=o(`kConstruct`);function p(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function m(e,t){let n=this._readableState,i=this._writableState,a=i||n;return i!=null&&i.destroyed||n!=null&&n.destroyed?(typeof t==`function`&&t(),this):(p(e,i,n),i&&(i.destroyed=!0),n&&(n.destroyed=!0),a.constructed?h(this,e,t):this.once(d,function(n){h(this,r(n,e),t)}),this)}function h(e,t,r){let i=!1;function a(t){if(i)return;i=!0;let a=e._readableState,o=e._writableState;p(t,o,a),o&&(o.closed=!0),a&&(a.closed=!0),typeof r==`function`&&r(t),t?n.nextTick(g,e,t):n.nextTick(_,e)}try{e._destroy(t||null,a)}catch(e){a(e)}}function g(e,t){v(e,t),_(e)}function _(e){let t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&e.emit(`close`)}function v(e,t){let n=e._readableState,r=e._writableState;r!=null&&r.errorEmitted||n!=null&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit(`error`,t))}function y(){let e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function b(e,t,r){let i=e._readableState,a=e._writableState;if(a!=null&&a.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||a!=null&&a.autoDestroy?e.destroy(t):t&&(t.stack,a&&!a.errored&&(a.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(v,e,t):v(e,t))}function x(e,t){if(typeof e._construct!=`function`)return;let r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),!(e.listenerCount(f)>1)&&n.nextTick(S,e)}function S(e){let t=!1;function r(r){if(t){b(e,r??new i);return}t=!0;let a=e._readableState,o=e._writableState,s=o||a;a&&(a.constructed=!0),o&&(o.constructed=!0),s.destroyed?e.emit(d,r):r?b(e,r,!0):n.nextTick(C,e)}try{e._construct(e=>{n.nextTick(r,e)})}catch(e){n.nextTick(r,e)}}function C(e){e.emit(f)}function w(e){return e?.setHeader&&typeof e.abort==`function`}function T(e){e.emit(`close`)}function E(e,t){e.emit(`error`,t),n.nextTick(T,e)}function D(e,t){!e||c(e)||(!t&&!l(e)&&(t=new a),u(e)?(e.socket=null,e.destroy(t)):w(e)?e.abort():w(e.req)?e.req.abort():typeof e.destroy==`function`?e.destroy(t):typeof e.close==`function`?e.close():t?n.nextTick(E,e,t):n.nextTick(T,e),e.destroyed||(e[s]=!0))}t.exports={construct:x,destroyer:D,destroy:m,undestroy:y,errorOrDestroy:b}})),q=o(((e,t)=>{var{ArrayIsArray:n,ObjectSetPrototypeOf:r}=W(),{EventEmitter:i}=De();function a(e){i.call(this,e)}r(a.prototype,i.prototype),r(a,i),a.prototype.pipe=function(e,t){let n=this;function r(t){e.writable&&e.write(t)===!1&&n.pause&&n.pause()}n.on(`data`,r);function a(){n.readable&&n.resume&&n.resume()}e.on(`drain`,a),!e._isStdio&&(!t||t.end!==!1)&&(n.on(`end`,c),n.on(`close`,l));let s=!1;function c(){s||(s=!0,e.end())}function l(){s||(s=!0,typeof e.destroy==`function`&&e.destroy())}function u(e){d(),i.listenerCount(this,`error`)===0&&this.emit(`error`,e)}o(n,`error`,u),o(e,`error`,u);function d(){n.removeListener(`data`,r),e.removeListener(`drain`,a),n.removeListener(`end`,c),n.removeListener(`close`,l),n.removeListener(`error`,u),e.removeListener(`error`,u),n.removeListener(`end`,d),n.removeListener(`close`,d),e.removeListener(`close`,d)}return n.on(`end`,d),n.on(`close`,d),e.on(`close`,d),e.emit(`pipe`,n),e};function o(e,t,r){if(typeof e.prependListener==`function`)return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}t.exports={Stream:a,prependListener:o}})),Me=o(((e,t)=>{var{SymbolDispose:n}=W(),{AbortError:r,codes:i}=Te(),{isNodeStream:a,isWebStream:o,kControllerErrorFunction:s}=G(),c=je(),{ERR_INVALID_ARG_TYPE:l}=i,u,d=(e,t)=>{if(typeof e!=`object`||!(`aborted`in e))throw new l(t,`AbortSignal`,e)};t.exports.addAbortSignal=function(e,n){if(d(e,`signal`),!a(n)&&!o(n))throw new l(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],n);return t.exports.addAbortSignalNoValidate(e,n)},t.exports.addAbortSignalNoValidate=function(e,t){if(typeof e!=`object`||!(`aborted`in e))return t;let i=a(t)?()=>{t.destroy(new r(void 0,{cause:e.reason}))}:()=>{t[s](new r(void 0,{cause:e.reason}))};return e.aborted?i():(u||=Oe().addAbortListener,c(t,u(e,i)[n])),t}})),Ne=o(((e,t)=>{var{StringPrototypeSlice:n,SymbolIterator:r,TypedArrayPrototypeSet:i,Uint8Array:a}=W(),{Buffer:o}=f(),{inspect:s}=Oe();t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){let t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return``;let t=this.head,n=``+t.data;for(;(t=t.next)!==null;)n+=e+t.data;return n}concat(e){if(this.length===0)return o.alloc(0);let t=o.allocUnsafe(e>>>0),n=this.head,r=0;for(;n;)i(t,n.data,r),r+=n.data.length,n=n.next;return t}consume(e,t){let n=this.head.data;if(e<n.length){let t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[r](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t=``,r=this.head,i=0;do{let a=r.data;if(e>a.length)t+=a,e-=a.length;else{e===a.length?(t+=a,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(a,0,e),this.head=r,r.data=n(a,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){let t=o.allocUnsafe(e),n=e,r=this.head,s=0;do{let o=r.data;if(e>o.length)i(t,o,n-e),e-=o.length;else{e===o.length?(i(t,o,n-e),++s,r.next?this.head=r.next:this.head=this.tail=null):(i(t,new a(o.buffer,o.byteOffset,e),n-e),this.head=r,r.data=o.slice(e));break}++s}while((r=r.next)!==null);return this.length-=s,t}[Symbol.for(`nodejs.util.inspect.custom`)](e,t){return s(this,{...t,depth:0,customInspect:!1})}}})),Pe=o(((e,t)=>{var{MathFloor:n,NumberIsInteger:r}=W(),{validateInteger:i}=ke(),{ERR_INVALID_ARG_VALUE:a}=Te().codes,o=16*1024,s=16;function c(e,t,n){return e.highWaterMark==null?t?e[n]:null:e.highWaterMark}function l(e){return e?s:o}function u(e,t){i(t,`value`,0),e?s=t:o=t}function d(e,t,i,o){let s=c(t,o,i);if(s!=null){if(!r(s)||s<0)throw new a(o?`options.${i}`:`options.highWaterMark`,s);return n(s)}return l(e.objectMode)}t.exports={getHighWaterMark:d,getDefaultHighWaterMark:l,setDefaultHighWaterMark:u}})),Fe=o(((e,t)=>{var n=f(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),Ie=o((e=>{var t=Fe().Buffer,n=t.isEncoding||function(e){switch(e=``+e,e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function r(e){if(!e)return`utf8`;for(var t;;)switch(e){case`utf8`:case`utf-8`:return`utf8`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;case`latin1`:case`binary`:return`latin1`;case`base64`:case`ascii`:case`hex`:return e;default:if(t)return;e=(``+e).toLowerCase(),t=!0}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString(`base64`,t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+this.lastChar.toString(`base64`,0,3-this.lastNeed):t}function g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),Le=o(((e,t)=>{var n=Ae(),{PromisePrototypeThen:r,SymbolAsyncIterator:i,SymbolIterator:a}=W(),{Buffer:o}=f(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:c}=Te().codes;function l(e,t,l){let u;if(typeof t==`string`||t instanceof o)return new e({objectMode:!0,...l,read(){this.push(t),this.push(null)}});let d;if(t&&t[i])d=!0,u=t[i]();else if(t&&t[a])d=!1,u=t[a]();else throw new s(`iterable`,[`Iterable`],t);let f=new e({objectMode:!0,highWaterMark:1,...l}),p=!1;f._read=function(){p||(p=!0,h())},f._destroy=function(e,t){r(m(e),()=>n.nextTick(t,e),r=>n.nextTick(t,r||e))};async function m(e){let t=e!=null,n=typeof u.throw==`function`;if(t&&n){let{value:t,done:n}=await u.throw(e);if(await t,n)return}if(typeof u.return==`function`){let{value:e}=await u.return();await e}}async function h(){for(;;){try{let{value:e,done:t}=d?await u.next():u.next();if(t)f.push(null);else{let t=e&&typeof e.then==`function`?await e:e;if(t===null)throw p=!1,new c;if(f.push(t))continue;p=!1}}catch(e){f.destroy(e)}break}}return f}t.exports=l})),Re=o(((e,t)=>{var n=Ae(),{ArrayPrototypeIndexOf:r,NumberIsInteger:i,NumberIsNaN:a,NumberParseInt:o,ObjectDefineProperties:s,ObjectKeys:c,ObjectSetPrototypeOf:l,Promise:u,SafeSet:d,SymbolAsyncDispose:p,SymbolAsyncIterator:m,Symbol:h}=W();t.exports=U,U.ReadableState=_e;var{EventEmitter:g}=De(),{Stream:_,prependListener:v}=q(),{Buffer:y}=f(),{addAbortSignal:b}=Me(),x=je(),S=Oe().debuglog(`stream`,e=>{S=e}),C=Ne(),w=K(),{getHighWaterMark:T,getDefaultHighWaterMark:E}=Pe(),{aggregateTwoErrors:D,codes:{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:A,ERR_STREAM_PUSH_AFTER_EOF:j,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:M},AbortError:N}=Te(),{validateObject:P}=ke(),F=h(`kPaused`),{StringDecoder:I}=Ie(),L=Le();l(U.prototype,_.prototype),l(U,_);var R=()=>{},{errorOrDestroy:z}=w,B=1,ee=2,te=4,ne=8,V=16,re=32,ie=64,ae=128,oe=256,se=512,ce=1024,le=2048,ue=4096,de=8192,fe=16384,pe=32768,me=65536,he=1<<17,ge=1<<18;function H(e){return{enumerable:!1,get(){return(this.state&e)!==0},set(t){t?this.state|=e:this.state&=~e}}}s(_e.prototype,{objectMode:H(B),ended:H(ee),endEmitted:H(te),reading:H(ne),constructed:H(V),sync:H(re),needReadable:H(ie),emittedReadable:H(ae),readableListening:H(oe),resumeScheduled:H(se),errorEmitted:H(ce),emitClose:H(le),autoDestroy:H(ue),destroyed:H(de),closed:H(fe),closeEmitted:H(pe),multiAwaitDrain:H(me),readingMore:H(he),dataEmitted:H(ge)});function _e(e,t,n){typeof n!=`boolean`&&(n=t instanceof Ve()),this.state=6192,e&&e.objectMode&&(this.state|=B),n&&e&&e.readableObjectMode&&(this.state|=B),this.highWaterMark=e?T(this,e,`readableHighWaterMark`,n):E(!1),this.buffer=new C,this.length=0,this.pipes=[],this.flowing=null,this[F]=null,e&&e.emitClose===!1&&(this.state&=-2049),e&&e.autoDestroy===!1&&(this.state&=-4097),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new I(e.encoding),this.encoding=e.encoding)}function U(e){if(!(this instanceof U))return new U(e);let t=this instanceof Ve();this._readableState=new _e(e,this,t),e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&!t&&b(e.signal,this)),_.call(this,e),w.construct(this,()=>{this._readableState.needReadable&&G(this,this._readableState)})}U.prototype.destroy=w.destroy,U.prototype._undestroy=w.undestroy,U.prototype._destroy=function(e,t){t(e)},U.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},U.prototype[p]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new N,this.destroy(e)),new u((t,n)=>x(this,r=>r&&r!==e?n(r):t(null)))},U.prototype.push=function(e,t){return ve(this,e,t,!1)},U.prototype.unshift=function(e,t){return ve(this,e,t,!0)};function ve(e,t,n,r){S(`readableAddChunk`,t);let i=e._readableState,a;if((i.state&B)===0&&(typeof t==`string`?(n||=i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?t=y.from(t,n).toString(i.encoding):(t=y.from(t,n),n=``))):t instanceof y?n=``:_._isUint8Array(t)?(t=_._uint8ArrayToBuffer(t),n=``):t!=null&&(a=new O(`chunk`,[`string`,`Buffer`,`Uint8Array`],t))),a)z(e,a);else if(t===null)i.state&=-9,Ce(e,i);else if((i.state&B)!==0||t&&t.length>0)if(r)if((i.state&te)!==0)z(e,new M);else if(i.destroyed||i.errored)return!1;else ye(e,i,t,!0);else if(i.ended)z(e,new j);else if(i.destroyed||i.errored)return!1;else i.state&=-9,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||t.length!==0?ye(e,i,t,!1):G(e,i)):ye(e,i,t,!1);else r||(i.state&=-9,G(e,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function ye(e,t,n,r){t.flowing&&t.length===0&&!t.sync&&e.listenerCount(`data`)>0?((t.state&me)===0?t.awaitDrainWriters=null:t.awaitDrainWriters.clear(),t.dataEmitted=!0,e.emit(`data`,n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),(t.state&ie)!==0&&we(e)),G(e,t)}U.prototype.isPaused=function(){let e=this._readableState;return e[F]===!0||e.flowing===!1},U.prototype.setEncoding=function(e){let t=new I(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;let n=this._readableState.buffer,r=``;for(let e of n)r+=t.write(e);return n.clear(),r!==``&&n.push(r),this._readableState.length=r.length,this};var be=1073741824;function xe(e){if(e>be)throw new A(`size`,`<= 1GiB`,e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++,e}function Se(e,t){return e<=0||t.length===0&&t.ended?0:(t.state&B)===0?a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0:1}U.prototype.read=function(e){S(`read`,e),e===void 0?e=NaN:i(e)||(e=o(e,10));let t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=xe(e)),e!==0&&(t.state&=-129),e===0&&t.needReadable&&((t.highWaterMark===0?t.length>0:t.length>=t.highWaterMark)||t.ended))return S(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?Je(this):we(this),null;if(e=Se(e,t),e===0&&t.ended)return t.length===0&&Je(this),null;let r=(t.state&ie)!==0;if(S(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,S(`length less than watermark`,r)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)r=!1,S(`reading, ended or constructing`,r);else if(r){S(`do read`),t.state|=40,t.length===0&&(t.state|=ie);try{this._read(t.highWaterMark)}catch(e){z(this,e)}t.state&=-33,t.reading||(e=Se(n,t))}let a;return a=e>0?qe(e,t):null,a===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Je(this)),a!==null&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit(`data`,a)),a};function Ce(e,t){if(S(`onEofChunk`),!t.ended){if(t.decoder){let e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?we(e):(t.needReadable=!1,t.emittedReadable=!0,Ee(e))}}function we(e){let t=e._readableState;S(`emitReadable`,t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(S(`emitReadable`,t.flowing),t.emittedReadable=!0,n.nextTick(Ee,e))}function Ee(e){let t=e._readableState;S(`emitReadable_`,t.destroyed,t.length,t.ended),!t.destroyed&&!t.errored&&(t.length||t.ended)&&(e.emit(`readable`),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,We(e)}function G(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(Fe,e,t))}function Fe(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){let n=t.length;if(S(`maybeReadMore read 0`),e.read(0),n===t.length)break}t.readingMore=!1}U.prototype._read=function(e){throw new k(`_read()`)},U.prototype.pipe=function(e,t){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new d(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),S(`pipe count=%d opts=%j`,i.pipes.length,t);let a=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr?s:_;i.endEmitted?n.nextTick(a):r.once(`end`,a),e.on(`unpipe`,o);function o(e,t){S(`onunpipe`),e===r&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,u())}function s(){S(`onend`),e.end()}let c,l=!1;function u(){S(`cleanup`),e.removeListener(`close`,h),e.removeListener(`finish`,g),c&&e.removeListener(`drain`,c),e.removeListener(`error`,m),e.removeListener(`unpipe`,o),r.removeListener(`end`,s),r.removeListener(`end`,_),r.removeListener(`data`,p),l=!0,c&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&c()}function f(){l||(i.pipes.length===1&&i.pipes[0]===e?(S(`false write response, pause`,0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(S(`false write response, pause`,i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),c||(c=Re(r,e),e.on(`drain`,c))}r.on(`data`,p);function p(t){S(`ondata`);let n=e.write(t);S(`dest.write`,n),n===!1&&f()}function m(t){if(S(`onerror`,t),_(),e.removeListener(`error`,m),e.listenerCount(`error`)===0){let n=e._writableState||e._readableState;n&&!n.errorEmitted?z(e,t):e.emit(`error`,t)}}v(e,`error`,m);function h(){e.removeListener(`finish`,g),_()}e.once(`close`,h);function g(){S(`onfinish`),e.removeListener(`close`,h),_()}e.once(`finish`,g);function _(){S(`unpipe`),r.unpipe(e)}return e.emit(`pipe`,r),e.writableNeedDrain===!0?f():i.flowing||(S(`pipe resume`),r.resume()),e};function Re(e,t){return function(){let n=e._readableState;n.awaitDrainWriters===t?(S(`pipeOnDrain`,1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(S(`pipeOnDrain`,n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&e.listenerCount(`data`)&&e.resume()}}U.prototype.unpipe=function(e){let t=this._readableState,n={hasUnpiped:!1};if(t.pipes.length===0)return this;if(!e){let e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit(`unpipe`,this,{hasUnpiped:!1});return this}let i=r(t.pipes,e);return i===-1?this:(t.pipes.splice(i,1),t.pipes.length===0&&this.pause(),e.emit(`unpipe`,this,n),this)},U.prototype.on=function(e,t){let r=_.prototype.on.call(this,e,t),i=this._readableState;return e===`data`?(i.readableListening=this.listenerCount(`readable`)>0,i.flowing!==!1&&this.resume()):e===`readable`&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S(`on readable`,i.length,i.reading),i.length?we(this):i.reading||n.nextTick(Be,this)),r},U.prototype.addListener=U.prototype.on,U.prototype.removeListener=function(e,t){let r=_.prototype.removeListener.call(this,e,t);return e===`readable`&&n.nextTick(ze,this),r},U.prototype.off=U.prototype.removeListener,U.prototype.removeAllListeners=function(e){let t=_.prototype.removeAllListeners.apply(this,arguments);return(e===`readable`||e===void 0)&&n.nextTick(ze,this),t};function ze(e){let t=e._readableState;t.readableListening=e.listenerCount(`readable`)>0,t.resumeScheduled&&t[F]===!1?t.flowing=!0:e.listenerCount(`data`)>0?e.resume():t.readableListening||(t.flowing=null)}function Be(e){S(`readable nexttick read 0`),e.read(0)}U.prototype.resume=function(){let e=this._readableState;return e.flowing||(S(`resume`),e.flowing=!e.readableListening,He(this,e)),e[F]=!1,this};function He(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(Ue,e,t))}function Ue(e,t){S(`resume`,t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit(`resume`),We(e),t.flowing&&!t.reading&&e.read(0)}U.prototype.pause=function(){return S(`call pause flowing=%j`,this._readableState.flowing),this._readableState.flowing!==!1&&(S(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this._readableState[F]=!0,this};function We(e){let t=e._readableState;for(S(`flow`,t.flowing);t.flowing&&e.read()!==null;);}U.prototype.wrap=function(e){let t=!1;e.on(`data`,n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())}),e.on(`end`,()=>{this.push(null)}),e.on(`error`,e=>{z(this,e)}),e.on(`close`,()=>{this.destroy()}),e.on(`destroy`,()=>{this.destroy()}),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};let n=c(e);for(let t=1;t<n.length;t++){let r=n[t];this[r]===void 0&&typeof e[r]==`function`&&(this[r]=e[r].bind(e))}return this},U.prototype[m]=function(){return Ge(this)},U.prototype.iterator=function(e){return e!==void 0&&P(e,`options`),Ge(this,e)};function Ge(e,t){typeof e.read!=`function`&&(e=U.wrap(e,{objectMode:!0}));let n=Ke(e,t);return n.stream=e,n}async function*Ke(e,t){let n=R;function r(t){this===e?(n(),n=R):n=t}e.on(`readable`,r);let i,a=x(e,{writable:!1},e=>{i=e?D(i,e):null,n(),n=R});try{for(;;){let t=e.destroyed?null:e.read();if(t!==null)yield t;else if(i)throw i;else if(i===null)return;else await new u(r)}}catch(e){throw i=D(i,e),i}finally{(i||t?.destroyOnReturn!==!1)&&(i===void 0||e._readableState.autoDestroy)?w.destroyer(e,null):(e.off(`readable`,r),a())}}s(U.prototype,{readable:{__proto__:null,get(){let e=this._readableState;return!!e&&e.readable!==!1&&!e.destroyed&&!e.errorEmitted&&!e.endEmitted},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(_e.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[F]!==!1},set(e){this[F]=!!e}}}),U._fromList=qe;function qe(e,t){if(t.length===0)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function Je(e){let t=e._readableState;S(`endReadable`,t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(Ye,t,e))}function Ye(e,t){if(S(`endReadableNT`,e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.emit(`end`),t.writable&&t.allowHalfOpen===!1)n.nextTick(Xe,t);else if(e.autoDestroy){let e=t._writableState;(!e||e.autoDestroy&&(e.finished||e.writable===!1))&&t.destroy()}}}function Xe(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}U.from=function(e,t){return L(U,e,t)};var Ze;function Qe(){return Ze===void 0&&(Ze={}),Ze}U.fromWeb=function(e,t){return Qe().newStreamReadableFromReadableStream(e,t)},U.toWeb=function(e,t){return Qe().newReadableStreamFromStreamReadable(e,t)},U.wrap=function(e,t){return new U({objectMode:e.readableObjectMode??e.objectMode??!0,...t,destroy(t,n){w.destroyer(e,t),n(t)}}).wrap(e)}})),ze=o(((e,t)=>{var n=Ae(),{ArrayPrototypeSlice:r,Error:i,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:o,ObjectDefineProperties:s,ObjectSetPrototypeOf:c,StringPrototypeToLowerCase:l,Symbol:u,SymbolHasInstance:d}=W();t.exports=P,P.WritableState=M;var{EventEmitter:p}=De(),m=q().Stream,{Buffer:h}=f(),g=K(),{addAbortSignal:_}=Me(),{getHighWaterMark:v,getDefaultHighWaterMark:y}=Pe(),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:x,ERR_MULTIPLE_CALLBACK:S,ERR_STREAM_CANNOT_PIPE:C,ERR_STREAM_DESTROYED:w,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:E,ERR_STREAM_WRITE_AFTER_END:D,ERR_UNKNOWN_ENCODING:O}=Te().codes,{errorOrDestroy:k}=g;c(P.prototype,m.prototype),c(P,m);function A(){}var j=u(`kOnFinished`);function M(e,t,n){typeof n!=`boolean`&&(n=t instanceof Ve()),this.objectMode=!!(e&&e.objectMode),n&&(this.objectMode=this.objectMode||!!(e&&e.writableObjectMode)),this.highWaterMark=e?v(this,e,`writableHighWaterMark`,n):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(e&&e.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=z.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,N(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||e.emitClose!==!1,this.autoDestroy=!e||e.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[j]=[]}function N(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}M.prototype.getBuffer=function(){return r(this.buffered,this.bufferedIndex)},o(M.prototype,`bufferedRequestCount`,{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function P(e){let t=this instanceof Ve();if(!t&&!a(P,this))return new P(e);this._writableState=new M(e,this,t),e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&_(e.signal,this)),m.call(this,e),g.construct(this,()=>{let e=this._writableState;e.writing||ne(this,e),ae(this,e)})}o(P,d,{__proto__:null,value:function(e){return a(this,e)?!0:this===P&&e&&e._writableState instanceof M}}),P.prototype.pipe=function(){k(this,new C)};function F(e,t,r,i){let a=e._writableState;if(typeof r==`function`)i=r,r=a.defaultEncoding;else{if(!r)r=a.defaultEncoding;else if(r!==`buffer`&&!h.isEncoding(r))throw new O(r);typeof i!=`function`&&(i=A)}if(t===null)throw new E;if(!a.objectMode)if(typeof t==`string`)a.decodeStrings!==!1&&(t=h.from(t,r),r=`buffer`);else if(t instanceof h)r=`buffer`;else if(m._isUint8Array(t))t=m._uint8ArrayToBuffer(t),r=`buffer`;else throw new b(`chunk`,[`string`,`Buffer`,`Uint8Array`],t);let o;return a.ending?o=new D:a.destroyed&&(o=new w(`write`)),o?(n.nextTick(i,o),k(e,o,!0),o):(a.pendingcb++,I(e,a,t,r,i))}P.prototype.write=function(e,t,n){return F(this,e,t,n)===!0},P.prototype.cork=function(){this._writableState.corked++},P.prototype.uncork=function(){let e=this._writableState;e.corked&&(e.corked--,e.writing||ne(this,e))},P.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=l(e)),!h.isEncoding(e))throw new O(e);return this._writableState.defaultEncoding=e,this};function I(e,t,n,r,i){let a=t.objectMode?1:n.length;t.length+=a;let o=t.length<t.highWaterMark;return o||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:r,callback:i}),t.allBuffers&&r!==`buffer`&&(t.allBuffers=!1),t.allNoop&&i!==A&&(t.allNoop=!1)):(t.writelen=a,t.writecb=i,t.writing=!0,t.sync=!0,e._write(n,r,t.onwrite),t.sync=!1),o&&!t.errored&&!t.destroyed}function L(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w(`write`)):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function R(e,t,n,r){--t.pendingcb,r(n),te(t),k(e,n)}function z(e,t){let r=e._writableState,i=r.sync,a=r.writecb;if(typeof a!=`function`){k(e,new S);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(t.stack,r.errored||=t,e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(R,e,r,t,a):R(e,r,t,a)):(r.buffered.length>r.bufferedIndex&&ne(e,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===a?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:a,stream:e,state:r},n.nextTick(B,r.afterWriteTickInfo)):ee(e,r,1,a))}function B({stream:e,state:t,count:n,cb:r}){return t.afterWriteTickInfo=null,ee(e,t,n,r)}function ee(e,t,n,r){for(!t.ending&&!e.destroyed&&t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`));n-->0;)t.pendingcb--,r();t.destroyed&&te(t),ae(e,t)}function te(e){if(e.writing)return;for(let t=e.bufferedIndex;t<e.buffered.length;++t){let{chunk:n,callback:r}=e.buffered[t],i=e.objectMode?1:n.length;e.length-=i,r(e.errored??new w(`write`))}let t=e[j].splice(0);for(let n=0;n<t.length;n++)t[n](e.errored??new w(`end`));N(e)}function ne(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;let{buffered:n,bufferedIndex:i,objectMode:a}=t,o=n.length-i;if(!o)return;let s=i;if(t.bufferProcessing=!0,o>1&&e._writev){t.pendingcb-=o-1;let i=t.allNoop?A:e=>{for(let t=s;t<n.length;++t)n[t].callback(e)},a=t.allNoop&&s===0?n:r(n,s);a.allBuffers=t.allBuffers,L(e,t,!0,t.length,a,``,i),N(t)}else{do{let{chunk:r,encoding:i,callback:o}=n[s];n[s++]=null,L(e,t,!1,a?1:r.length,r,i,o)}while(s<n.length&&!t.writing);s===n.length?N(t):s>256?(n.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}P.prototype._write=function(e,t,n){if(this._writev)this._writev([{chunk:e,encoding:t}],n);else throw new x(`_write()`)},P.prototype._writev=null,P.prototype.end=function(e,t,r){let a=this._writableState;typeof e==`function`?(r=e,e=null,t=null):typeof t==`function`&&(r=t,t=null);let o;if(e!=null){let n=F(this,e,t);n instanceof i&&(o=n)}return a.corked&&(a.corked=1,this.uncork()),o||(!a.errored&&!a.ending?(a.ending=!0,ae(this,a,!0),a.ended=!0):a.finished?o=new T(`end`):a.destroyed&&(o=new w(`end`))),typeof r==`function`&&(o||a.finished?n.nextTick(r,o):a[j].push(r)),this};function V(e){return e.ending&&!e.destroyed&&e.constructed&&e.length===0&&!e.errored&&e.buffered.length===0&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function re(e,t){let r=!1;function i(i){if(r){k(e,i??S());return}if(r=!0,t.pendingcb--,i){let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e](i);k(e,i,t.sync)}else V(t)&&(t.prefinished=!0,e.emit(`prefinish`),t.pendingcb++,n.nextTick(oe,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}function ie(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`&&!t.destroyed?(t.finalCalled=!0,re(e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function ae(e,t,r){V(t)&&(ie(e,t),t.pendingcb===0&&(r?(t.pendingcb++,n.nextTick((e,t)=>{V(t)?oe(e,t):t.pendingcb--},e,t)):V(t)&&(t.pendingcb++,oe(e,t))))}function oe(e,t){t.pendingcb--,t.finished=!0;let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit(`finish`),t.autoDestroy){let t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))&&e.destroy()}}s(P.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){let e=this._writableState;return!!e&&e.writable!==!1&&!e.destroyed&&!e.errored&&!e.ending&&!e.ended},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let e=this._writableState;return e?!e.destroyed&&!e.ending&&e.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var se=g.destroy;P.prototype.destroy=function(e,t){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[j].length)&&n.nextTick(te,r),se.call(this,e,t),this},P.prototype._undestroy=g.undestroy,P.prototype._destroy=function(e,t){t(e)},P.prototype[p.captureRejectionSymbol]=function(e){this.destroy(e)};var ce;function le(){return ce===void 0&&(ce={}),ce}P.fromWeb=function(e,t){return le().newStreamWritableFromWritableStream(e,t)},P.toWeb=function(e){return le().newWritableStreamFromStreamWritable(e)}})),Be=o(((e,t)=>{var n=Ae(),r=f(),{isReadable:i,isWritable:a,isIterable:o,isNodeStream:s,isReadableNodeStream:c,isWritableNodeStream:l,isDuplexNodeStream:u,isReadableStream:d,isWritableStream:p}=G(),m=je(),{AbortError:h,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:_}}=Te(),{destroyer:v}=K(),y=Ve(),b=Re(),x=ze(),{createDeferredPromise:S}=Oe(),C=Le(),w=globalThis.Blob||r.Blob,T=w===void 0?function(e){return!1}:function(e){return e instanceof w},E=globalThis.AbortController||Ee().AbortController,{FunctionPrototypeCall:D}=W(),O=class extends y{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};t.exports=function e(t,r){if(u(t))return t;if(c(t))return A({readable:t});if(l(t))return A({writable:t});if(s(t))return A({writable:!1,readable:!1});if(d(t))return A({readable:b.fromWeb(t)});if(p(t))return A({writable:x.fromWeb(t)});if(typeof t==`function`){let{value:e,write:i,final:a,destroy:s}=k(t);if(o(e))return C(O,e,{objectMode:!0,write:i,final:a,destroy:s});let c=e?.then;if(typeof c==`function`){let t,r=D(c,e,e=>{if(e!=null)throw new _(`nully`,`body`,e)},e=>{v(t,e)});return t=new O({objectMode:!0,readable:!1,write:i,final(e){a(async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}})},destroy:s})}throw new _(`Iterable, AsyncIterable or AsyncFunction`,r,e)}if(T(t))return e(t.arrayBuffer());if(o(t))return C(O,t,{objectMode:!0,writable:!1});if(d(t?.readable)&&p(t?.writable))return O.fromWeb(t);if(typeof t?.writable==`object`||typeof t?.readable==`object`)return A({readable:t!=null&&t.readable?c(t?.readable)?t?.readable:e(t.readable):void 0,writable:t!=null&&t.writable?l(t?.writable)?t?.writable:e(t.writable):void 0});let i=t?.then;if(typeof i==`function`){let e;return D(i,t,t=>{t!=null&&e.push(t),e.push(null)},t=>{v(e,t)}),e=new O({objectMode:!0,writable:!1,read(){}})}throw new g(r,[`Blob`,`ReadableStream`,`WritableStream`,`Stream`,`Iterable`,`AsyncIterable`,`Function`,`{ readable, writable } pair`,`Promise`],t)};function k(e){let{promise:t,resolve:r}=S(),i=new E,a=i.signal;return{value:e((async function*(){for(;;){let e=t;t=null;let{chunk:i,done:o,cb:s}=await e;if(n.nextTick(s),o)return;if(a.aborted)throw new h(void 0,{cause:a.reason});({promise:t,resolve:r}=S()),yield i}})(),{signal:a}),write(e,t,n){let i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){let t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}function A(e){let t=e.readable&&typeof e.readable.read!=`function`?b.wrap(e.readable):e.readable,n=e.writable,r=!!i(t),o=!!a(n),s,c,l,u,d;function f(e){let t=u;u=null,t?t(e):e&&d.destroy(e)}return d=new O({readableObjectMode:!!(t!=null&&t.readableObjectMode),writableObjectMode:!!(n!=null&&n.writableObjectMode),readable:r,writable:o}),o&&(m(n,e=>{o=!1,e&&v(t,e),f(e)}),d._write=function(e,t,r){n.write(e,t)?r():s=r},d._final=function(e){n.end(),c=e},n.on(`drain`,function(){if(s){let e=s;s=null,e()}}),n.on(`finish`,function(){if(c){let e=c;c=null,e()}})),r&&(m(t,e=>{r=!1,e&&v(t,e),f(e)}),t.on(`readable`,function(){if(l){let e=l;l=null,e()}}),t.on(`end`,function(){d.push(null)}),d._read=function(){for(;;){let e=t.read();if(e===null){l=d._read;return}if(!d.push(e))return}}),d._destroy=function(e,r){!e&&u!==null&&(e=new h),l=null,s=null,c=null,u===null?r(e):(u=r,v(n,e),v(t,e))},d}})),Ve=o(((e,t)=>{var{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:i,ObjectSetPrototypeOf:a}=W();t.exports=c;var o=Re(),s=ze();a(c.prototype,o.prototype),a(c,o);{let e=i(s.prototype);for(let t=0;t<e.length;t++){let n=e[t];c.prototype[n]||(c.prototype[n]=s.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),s.call(this,e),e?(this.allowHalfOpen=e.allowHalfOpen!==!1,e.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(c.prototype,{writable:{__proto__:null,...r(s.prototype,`writable`)},writableHighWaterMark:{__proto__:null,...r(s.prototype,`writableHighWaterMark`)},writableObjectMode:{__proto__:null,...r(s.prototype,`writableObjectMode`)},writableBuffer:{__proto__:null,...r(s.prototype,`writableBuffer`)},writableLength:{__proto__:null,...r(s.prototype,`writableLength`)},writableFinished:{__proto__:null,...r(s.prototype,`writableFinished`)},writableCorked:{__proto__:null,...r(s.prototype,`writableCorked`)},writableEnded:{__proto__:null,...r(s.prototype,`writableEnded`)},writableNeedDrain:{__proto__:null,...r(s.prototype,`writableNeedDrain`)},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}});var l;function u(){return l===void 0&&(l={}),l}c.fromWeb=function(e,t){return u().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return u().newReadableWritablePairFromDuplex(e)};var d;c.from=function(e){return d||=Be(),d(e,`body`)}})),He=o(((e,t)=>{var{ObjectSetPrototypeOf:n,Symbol:r}=W();t.exports=c;var{ERR_METHOD_NOT_IMPLEMENTED:i}=Te().codes,a=Ve(),{getHighWaterMark:o}=Pe();n(c.prototype,a.prototype),n(c,a);var s=r(`kCallback`);function c(e){if(!(this instanceof c))return new c(e);let t=e?o(this,e,`readableHighWaterMark`,!0):null;t===0&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[s]=null,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,u)}function l(e){typeof this._flush==`function`&&!this.destroyed?this._flush((t,n)=>{if(t){e?e(t):this.destroy(t);return}n!=null&&this.push(n),this.push(null),e&&e()}):(this.push(null),e&&e())}function u(){this._final!==l&&l.call(this)}c.prototype._final=l,c.prototype._transform=function(e,t,n){throw new i(`_transform()`)},c.prototype._write=function(e,t,n){let r=this._readableState,i=this._writableState,a=r.length;this._transform(e,t,(e,t)=>{if(e){n(e);return}t!=null&&this.push(t),i.ended||a===r.length||r.length<r.highWaterMark?n():this[s]=n})},c.prototype._read=function(){if(this[s]){let e=this[s];this[s]=null,e()}}})),Ue=o(((e,t)=>{var{ObjectSetPrototypeOf:n}=W();t.exports=i;var r=He();n(i.prototype,r.prototype),n(i,r);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),We=o(((e,t)=>{var n=Ae(),{ArrayIsArray:r,Promise:i,SymbolAsyncIterator:a,SymbolDispose:o}=W(),s=je(),{once:c}=Oe(),l=K(),u=Ve(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:h,ERR_STREAM_PREMATURE_CLOSE:g},AbortError:_}=Te(),{validateFunction:v,validateAbortSignal:y}=ke(),{isIterable:b,isReadable:x,isReadableNodeStream:S,isNodeStream:C,isTransformStream:w,isWebStream:T,isReadableStream:E,isReadableFinished:D}=G(),O=globalThis.AbortController||Ee().AbortController,k,A,j;function M(e,t,n){let r=!1;return e.on(`close`,()=>{r=!0}),{destroy:t=>{r||(r=!0,l.destroyer(e,t||new h(`pipe`)))},cleanup:s(e,{readable:t,writable:n},e=>{r=!e})}}function N(e){return v(e[e.length-1],`streams[stream.length - 1]`),e.pop()}function P(e){if(b(e))return e;if(S(e))return F(e);throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`],e)}async function*F(e){A||=Re(),yield*A.prototype[a].call(e)}async function I(e,t,n,{end:r}){let a,o=null,c=e=>{if(e&&(a=e),o){let e=o;o=null,e()}},l=()=>new i((e,t)=>{a?t(a):o=()=>{a?t(a):e()}});t.on(`drain`,c);let u=s(t,{readable:!1},c);try{t.writableNeedDrain&&await l();for await(let n of e)t.write(n)||await l();r&&(t.end(),await l()),n()}catch(e){n(a===e?e:d(a,e))}finally{u(),t.off(`drain`,c)}}async function L(e,t,n,{end:r}){w(t)&&(t=t.writable);let i=t.getWriter();try{for await(let t of e)await i.ready,i.write(t).catch(()=>{});await i.ready,r&&await i.close(),n()}catch(e){try{await i.abort(e),n(e)}catch(e){n(e)}}}function R(...e){return z(e,c(N(e)))}function z(e,t,i){if(e.length===1&&r(e[0])&&(e=e[0]),e.length<2)throw new m(`streams`);let a=new O,s=a.signal,c=i?.signal,l=[];y(c,`options.signal`);function d(){F(new _)}j||=Oe().addAbortListener;let h;c&&(h=j(c,d));let g,v,D=[],A=0;function N(e){F(e,--A===0)}function F(e,r){var i;if(e&&(!g||g.code===`ERR_STREAM_PREMATURE_CLOSE`)&&(g=e),!(!g&&!r)){for(;D.length;)D.shift()(g);(i=h)==null||i[o](),a.abort(),r&&(g||l.forEach(e=>e()),n.nextTick(t,g,v))}}let R;for(let t=0;t<e.length;t++){let r=e[t],a=t<e.length-1,o=t>0,c=a||i?.end!==!1,d=t===e.length-1;if(C(r)){if(c){let{destroy:e,cleanup:t}=M(r,a,o);D.push(e),x(r)&&d&&l.push(t)}function e(e){e&&e.name!==`AbortError`&&e.code!==`ERR_STREAM_PREMATURE_CLOSE`&&N(e)}r.on(`error`,e),x(r)&&d&&l.push(()=>{r.removeListener(`error`,e)})}if(t===0)if(typeof r==`function`){if(R=r({signal:s}),!b(R))throw new p(`Iterable, AsyncIterable or Stream`,`source`,R)}else R=b(r)||S(r)||w(r)?r:u.from(r);else if(typeof r==`function`)if(R=w(R)?P(R?.readable):P(R),R=r(R,{signal:s}),a){if(!b(R,!0))throw new p(`AsyncIterable`,`transform[${t-1}]`,R)}else{k||=Ue();let e=new k({objectMode:!0}),t=R?.then;if(typeof t==`function`)A++,t.call(R,t=>{v=t,t!=null&&e.write(t),c&&e.end(),n.nextTick(N)},t=>{e.destroy(t),n.nextTick(N,t)});else if(b(R,!0))A++,I(R,e,N,{end:c});else if(E(R)||w(R)){let t=R.readable||R;A++,I(t,e,N,{end:c})}else throw new p(`AsyncIterable or Promise`,`destination`,R);R=e;let{destroy:r,cleanup:i}=M(R,!1,!0);D.push(r),d&&l.push(i)}else if(C(r)){if(S(R)){A+=2;let e=B(R,r,N,{end:c});x(r)&&d&&l.push(e)}else if(w(R)||E(R)){let e=R.readable||R;A++,I(e,r,N,{end:c})}else if(b(R))A++,I(R,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],R);R=r}else if(T(r)){if(S(R))A++,L(P(R),r,N,{end:c});else if(E(R)||b(R))A++,L(R,r,N,{end:c});else if(w(R))A++,L(R.readable,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],R);R=r}else R=u.from(r)}return(s!=null&&s.aborted||c!=null&&c.aborted)&&n.nextTick(d),R}function B(e,t,r,{end:i}){let a=!1;if(t.on(`close`,()=>{a||r(new g)}),e.pipe(t,{end:!1}),i){function r(){a=!0,t.end()}D(e)?n.nextTick(r):e.once(`end`,r)}else r();return s(e,{readable:!0,writable:!1},t=>{let n=e._readableState;t&&t.code===`ERR_STREAM_PREMATURE_CLOSE`&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once(`end`,r).once(`error`,r):r(t)}),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:z,pipeline:R}})),Ge=o(((e,t)=>{var{pipeline:n}=We(),r=Ve(),{destroyer:i}=K(),{isNodeStream:a,isReadable:o,isWritable:s,isWebStream:c,isTransformStream:l,isWritableStream:u,isReadableStream:d}=G(),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=Te(),h=je();t.exports=function(...e){if(e.length===0)throw new m(`streams`);if(e.length===1)return r.from(e[0]);let t=[...e];if(typeof e[0]==`function`&&(e[0]=r.from(e[0])),typeof e[e.length-1]==`function`){let t=e.length-1;e[t]=r.from(e[t])}for(let n=0;n<e.length;++n)if(!(!a(e[n])&&!c(e[n]))){if(n<e.length-1&&!(o(e[n])||d(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be readable`);if(n>0&&!(s(e[n])||u(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be writable`)}let g,_,v,y,b;function x(e){let t=y;y=null,t?t(e):e?b.destroy(e):!T&&!w&&b.destroy()}let S=e[0],C=n(e,x),w=!!(s(S)||u(S)||l(S)),T=!!(o(C)||d(C)||l(C));if(b=new r({writableObjectMode:!!(S!=null&&S.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:w,readable:T}),w){if(a(S))b._write=function(e,t,n){S.write(e,t)?n():g=n},b._final=function(e){S.end(),_=e},S.on(`drain`,function(){if(g){let e=g;g=null,e()}});else if(c(S)){let e=(l(S)?S.writable:S).getWriter();b._write=async function(t,n,r){try{await e.ready,e.write(t).catch(()=>{}),r()}catch(e){r(e)}},b._final=async function(t){try{await e.ready,e.close().catch(()=>{}),_=t}catch(e){t(e)}}}h(l(C)?C.readable:C,()=>{if(_){let e=_;_=null,e()}})}if(T){if(a(C))C.on(`readable`,function(){if(v){let e=v;v=null,e()}}),C.on(`end`,function(){b.push(null)}),b._read=function(){for(;;){let e=C.read();if(e===null){v=b._read;return}if(!b.push(e))return}};else if(c(C)){let e=(l(C)?C.readable:C).getReader();b._read=async function(){for(;;)try{let{value:t,done:n}=await e.read();if(!b.push(t))return;if(n){b.push(null);return}}catch{return}}}}return b._destroy=function(e,t){!e&&y!==null&&(e=new f),v=null,g=null,_=null,y===null?t(e):(y=t,a(C)&&i(C,e))},b}})),Ke=o(((e,t)=>{var n=globalThis.AbortController||Ee().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:i,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:o},AbortError:s}=Te(),{validateAbortSignal:c,validateInteger:l,validateObject:u}=ke(),d=W().Symbol(`kWeak`),f=W().Symbol(`kResistStopPropagation`),{finished:p}=je(),m=Ge(),{addAbortSignalNoValidate:h}=Me(),{isWritable:g,isNodeStream:_}=G(),{deprecate:v}=Oe(),{ArrayPrototypePush:y,Boolean:b,MathFloor:x,Number:S,NumberIsNaN:C,Promise:w,PromiseReject:T,PromiseResolve:E,PromisePrototypeThen:D,Symbol:O}=W(),k=O(`kEmpty`),A=O(`kEof`);function j(e,t){if(t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),_(e)&&!g(e))throw new r(`stream`,e,`must be writable`);let n=m(this,e);return t!=null&&t.signal&&h(t.signal,n),n}function M(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`);let n=1;t?.concurrency!=null&&(n=x(t.concurrency));let r=n-1;return t?.highWaterMark!=null&&(r=x(t.highWaterMark)),l(n,`options.concurrency`,1),l(r,`options.highWaterMark`,0),r+=n,async function*(){let i=Oe().AbortSignalAny([t?.signal].filter(b)),a=this,o=[],c={signal:i},l,u,d=!1,f=0;function p(){d=!0,m()}function m(){--f,h()}function h(){u&&!d&&f<n&&o.length<r&&(u(),u=null)}async function g(){try{for await(let t of a){if(d)return;if(i.aborted)throw new s;try{if(t=e(t,c),t===k)continue;t=E(t)}catch(e){t=T(e)}f+=1,D(t,m,p),o.push(t),l&&=(l(),null),!d&&(o.length>=r||f>=n)&&await new w(e=>{u=e})}o.push(A)}catch(e){let t=T(e);D(t,m,p),o.push(t)}finally{d=!0,l&&=(l(),null)}}g();try{for(;;){for(;o.length>0;){let e=await o[0];if(e===A)return;if(i.aborted)throw new s;e!==k&&(yield e),o.shift(),h()}await new w(e=>{l=e})}}finally{d=!0,u&&=(u(),null)}}.call(this)}function N(e=void 0){return e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`),async function*(){let t=0;for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s({cause:e.signal.reason});yield[t++,r]}}.call(this)}async function P(e,t=void 0){for await(let n of R.call(this,e,t))return!0;return!1}async function F(e,t=void 0){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);return!await P.call(this,async(...t)=>!await e(...t),t)}async function I(e,t){for await(let n of R.call(this,e,t))return n}async function L(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n),k}for await(let e of M.call(this,n,t));}function R(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n)?t:k}return M.call(this,n,t)}var z=class extends a{constructor(){super(`reduce`),this.message=`Reduce of an empty stream requires an initial value`}};async function B(e,t,r){var a;if(typeof e!=`function`)throw new i(`reducer`,[`Function`,`AsyncFunction`],e);r!=null&&u(r,`options`),r?.signal!=null&&c(r.signal,`options.signal`);let o=arguments.length>1;if(r!=null&&(a=r.signal)!=null&&a.aborted){let e=new s(void 0,{cause:r.signal.reason});throw this.once(`error`,()=>{}),await p(this.destroy(e)),e}let l=new n,m=l.signal;if(r!=null&&r.signal){let e={once:!0,[d]:this,[f]:!0};r.signal.addEventListener(`abort`,()=>l.abort(),e)}let h=!1;try{for await(let n of this){var g;if(h=!0,r!=null&&(g=r.signal)!=null&&g.aborted)throw new s;o?t=await e(t,n,{signal:m}):(t=n,o=!0)}if(!h&&!o)throw new z}finally{l.abort()}return t}async function ee(e){e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`);let t=[];for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s(void 0,{cause:e.signal.reason});y(t,r)}return t}function te(e,t){let n=M.call(this,e,t);return async function*(){for await(let e of n)yield*e}.call(this)}function ne(e){if(e=S(e),C(e))return 0;if(e<0)throw new o(`number`,`>= 0`,e);return e}function V(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;e--<=0&&(yield n)}}.call(this)}function re(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;if(e-->0&&(yield n),e<=0)return}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:v(N,`readable.asIndexedPairs will be removed in a future version.`),drop:V,filter:R,flatMap:te,map:M,take:re,compose:j},t.exports.promiseReturningOperators={every:F,forEach:L,reduce:B,toArray:ee,some:P,find:I}})),qe=o(((e,t)=>{var{ArrayPrototypePop:n,Promise:r}=W(),{isIterable:i,isNodeStream:a,isWebStream:o}=G(),{pipelineImpl:s}=We(),{finished:c}=je();Je();function l(...e){return new r((t,r)=>{let c,l,u=e[e.length-1];if(u&&typeof u==`object`&&!a(u)&&!i(u)&&!o(u)){let t=n(e);c=t.signal,l=t.end}s(e,(e,n)=>{e?r(e):t(n)},{signal:c,end:l})})}t.exports={finished:c,pipeline:l}})),Je=o(((e,t)=>{var{Buffer:n}=f(),{ObjectDefineProperty:r,ObjectKeys:i,ReflectApply:a}=W(),{promisify:{custom:o}}=Oe(),{streamReturningOperators:s,promiseReturningOperators:c}=Ke(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:l}}=Te(),u=Ge(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:p}=Pe(),{pipeline:m}=We(),{destroyer:h}=K(),g=je(),_=qe(),v=G(),y=t.exports=q().Stream;y.isDestroyed=v.isDestroyed,y.isDisturbed=v.isDisturbed,y.isErrored=v.isErrored,y.isReadable=v.isReadable,y.isWritable=v.isWritable,y.Readable=Re();for(let e of i(s)){let t=s[e];function n(...e){if(new.target)throw l();return y.Readable.from(a(t,this,e))}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}for(let e of i(c)){let t=c[e];function n(...e){if(new.target)throw l();return a(t,this,e)}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}y.Writable=ze(),y.Duplex=Ve(),y.Transform=He(),y.PassThrough=Ue(),y.pipeline=m;var{addAbortSignal:b}=Me();y.addAbortSignal=b,y.finished=g,y.destroy=h,y.compose=u,y.setDefaultHighWaterMark=d,y.getDefaultHighWaterMark=p,r(y,`promises`,{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),r(m,o,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),r(g,o,{__proto__:null,enumerable:!0,get(){return _.finished}}),y.Stream=y,y._isUint8Array=function(e){return e instanceof Uint8Array},y._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}})),Ye=o(((e,t)=>{var n=Je(),r=qe(),i=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=i,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get(){return r}}),t.exports.Stream=n.Stream,t.exports.default=t.exports})),Xe=Ye(),Ze=Symbol(`iter`);function Qe(e,t,n=4){if(n===0)return Object.assign(e,t);for(let r in t)e[r]=Qe(e[r]||Object.create(null),t[r],n-1);return e}function $e(e,t,n=4){let r=!1;for(let i in e)if(i in t){let a=n===0?null:$e(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}function et(e,t,n=4){let r=!1;for(let i in e)if(!(i in t))r||=Object.create(null),r[i]=n===0?null:Qe({},e[i],n-1);else if(n!==0){let a=et(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}var tt=class{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[``]=1,this._entities=Object.create(null),this._entities[1]=``,this._blankNodeIndex=0,this._factory=e.factory||k}_termFromId(e){if(e[0]===`.`){let t=this._entities,n=e.split(`.`);return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return F(e,this._factory)}_termToNumericId(e){if(e.termType===`Quad`){let t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),r=this._termToNumericId(e.object),i;return t&&n&&r&&(ce(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${n}.${r}.${i}`:`.${t}.${n}.${r}`]}return this._ids[I(e)]}_termToNewNumericId(e){let t=e&&e.termType===`Quad`?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ce(e.graph)?``:`.${this._termToNewNumericId(e.graph)}`}`:I(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+n++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}},nt=class e{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!=`function`&&(t=e,e=null),t||={},this._factory=t.factory||k,this._entityIndex=t.entityIndex||new tt({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;let t=this._graphs,n,r;for(let i in t)for(let a in n=t[i].subjects)for(let t in r=n[a])e+=Object.keys(r[t]).length;return this._size=e}_addToIndex(e,t,n,r){let i=e[t]||(e[t]={}),a=i[n]||(i[n]={}),o=r in a;return o||(a[r]=null),!o}_removeFromIndex(e,t,n,r){let i=e[t],a=i[n];delete a[r];for(let e in a)return;delete i[n];for(let e in i)return;delete e[t]}*_findInIndex(e,t,n,r,i,a,o,s){let c,l,u,d=this._entities,f=this._termFromId(d[s]),p={subject:null,predicate:null,object:null};t&&((c=e,e={})[t]=c[t]);for(let t in e)if(l=e[t]){p[i]=this._termFromId(d[t]),n&&((c=l,l={})[n]=c[n]);for(let e in l)if(u=l[e]){p[a]=this._termFromId(d[e]);let t=r?r in u?[r]:[]:Object.keys(u);for(let e=0;e<t.length;e++)p[o]=this._termFromId(d[t[e]]),yield this._factory.quad(p.subject,p.predicate,p.object,f)}}}_loop(e,t){for(let n in e)t(n)}_loopByKey0(e,t,n){let r,i;if(r=e[t])for(i in r)n(i)}_loopByKey1(e,t,n){let r,i;for(r in e)i=e[r],i[t]&&n(r)}_loopBy2Keys(e,t,n,r){let i,a,o;if((i=e[t])&&(a=i[n]))for(o in a)r(o)}_countInIndex(e,t,n,r){let i=0,a,o,s;t&&((a=e,e={})[t]=a[t]);for(let t in e)if(o=e[t]){n&&((a=o,o={})[n]=a[n]);for(let e in o)(s=o[e])&&(r?r in s&&i++:i+=Object.keys(s).length)}return i}_getGraphs(e){return e=e===``?1:e&&(this._termToNumericId(e)||-1),typeof e==`number`?{[e]:this._graphs[e]}:this._graphs}_uniqueEntities(e){let t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,r){t||(r=e.graph,n=e.object,t=e.predicate,e=e.subject),r=r?this._termToNewNumericId(r):1;let i=this._graphs[r];return i||(i=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(i)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(i.subjects,e,t,n)?(this._addToIndex(i.predicates,t,n,e),this._addToIndex(i.objects,n,e,t),this._size=null,!0):!1}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,n,r){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:r}=e),!this.readQuads(e,t,n,r).next().done}import(e){return e.on(`data`,e=>{this.addQuad(e)}),e}removeQuad(e,t,n,r){t||({subject:e,predicate:t,object:n,graph:r}=e),r=r?this._termToNumericId(r):1;let i=this._graphs,a,o,s;if(!(e&&=this._termToNumericId(e))||!(t&&=this._termToNumericId(t))||!(n&&=this._termToNumericId(n))||!(a=i[r])||!(o=a.subjects[e])||!(s=o[t])||!(n in s))return!1;for(e in this._removeFromIndex(a.subjects,e,t,n),this._removeFromIndex(a.predicates,t,n,e),this._removeFromIndex(a.objects,n,e,t),this._size!==null&&this._size--,a.subjects)return!0;return delete i[r],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on(`data`,e=>{this.removeQuad(e)}),e}removeMatches(e,t,n,r){let i=new Xe.Readable({objectMode:!0}),a=this.readQuads(e,t,n,r);return i._read=e=>{for(;--e>=0;){let{done:e,value:t}=a.next();if(e){i.push(null);return}i.push(t)}},this.remove(i)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,r){return[...this.readQuads(e,t,n,r)]}*readQuads(e,t,n,r){let i=this._getGraphs(r),a,o,s,c;if(!(e&&!(o=this._termToNumericId(e))||t&&!(s=this._termToNumericId(t))||n&&!(c=this._termToNumericId(n))))for(let e in i)(a=i[e])&&(o?c?yield*this._findInIndex(a.objects,c,o,s,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,o,s,null,`subject`,`predicate`,`object`,e):s?yield*this._findInIndex(a.predicates,s,c,null,`predicate`,`object`,`subject`,e):c?yield*this._findInIndex(a.objects,c,null,null,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,null,null,null,`subject`,`predicate`,`object`,e))}match(e,t,n,r){return new it(this,e,t,n,r,{entityIndex:this._entityIndex})}countQuads(e,t,n,r){let i=this._getGraphs(r),a=0,o,s,c,l;if(e&&!(s=this._termToNumericId(e))||t&&!(c=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n)))return 0;for(let r in i)(o=i[r])&&(e?n?a+=this._countInIndex(o.objects,l,s,c):a+=this._countInIndex(o.subjects,s,c,l):t?a+=this._countInIndex(o.predicates,c,l,s):a+=this._countInIndex(o.objects,l,s,c));return a}forEach(e,t,n,r,i){this.some(t=>(e(t,this),!1),t,n,r,i)}every(e,t,n,r,i){return!this.some(t=>!e(t,this),t,n,r,i)}some(e,t,n,r,i){for(let a of this.readQuads(t,n,r,i))if(e(a,this))return!0;return!1}getSubjects(e,t,n){let r=[];return this.forSubjects(e=>{r.push(e)},e,t,n),r}forSubjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.predicates,o,s,e):this._loopByKey1(a.subjects,o,e):s?this._loopByKey0(a.objects,s,e):this._loop(a.subjects,e))}getPredicates(e,t,n){let r=[];return this.forPredicates(e=>{r.push(e)},e,t,n),r}forPredicates(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.objects,s,o,e):this._loopByKey0(a.subjects,o,e):s?this._loopByKey1(a.predicates,s,e):this._loop(a.predicates,e))}getObjects(e,t,n){let r=[];return this.forObjects(e=>{r.push(e)},e,t,n),r}forObjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.subjects,o,s,e):this._loopByKey1(a.objects,o,e):s?this._loopByKey0(a.predicates,s,e):this._loop(a.objects,e))}getGraphs(e,t,n){let r=[];return this.forGraphs(e=>{r.push(e)},e,t,n),r}forGraphs(e,t,n,r){for(let i in this._graphs)this.some(t=>(e(t.graph),!0),t,n,r,this._termFromId(this._entities[i]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){let n={},r=t?(()=>!0):((e,t)=>{throw Error(`${e.value} ${t}`)}),i=this.getQuads(null,g.rdf.rest,g.rdf.nil,null),a=e?[...i]:[];return i.forEach(t=>{let i=[],o=!1,s,c,l=t.graph,u=t.subject;for(;u&&!o;){let e=this.getQuads(null,null,u,null),t=this.getQuads(u,null,null,null),n,d=null,f=null,p=null;for(let i=0;i<t.length&&!o;i++)n=t[i],n.graph.equals(l)?s?o=r(u,`has non-list arcs out`):n.predicate.value===g.rdf.first?d?o=r(u,`has multiple rdf:first arcs`):a.push(d=n):n.predicate.value===g.rdf.rest?f?o=r(u,`has multiple rdf:rest arcs`):a.push(f=n):e.length?o=r(u,`can't be subject and object`):(s=n,c=`subject`):o=r(u,`not confined to single graph`);for(let t=0;t<e.length&&!o;++t)n=e[t],s?o=r(u,`can't have coreferences`):n.predicate.value===g.rdf.rest?p?o=r(u,`has incoming rdf:rest arcs`):p=n:(s=n,c=`object`);d?i.unshift(d.object):o=r(u,`has no list head`),u=p&&p.subject}o?e=!1:s&&(n[s[c].value]=i)}),e&&this.removeQuads(a),n}addAll(t){if(t instanceof it&&(t=t.filtered),Array.isArray(t))this.addQuads(t);else if(t instanceof e&&t._entityIndex===this._entityIndex)t._size!==0&&(this._graphs=Qe(this._graphs,t._graphs),this._size=null);else for(let e of t)this.add(e);return this}contains(t){if(t instanceof it&&(t=t.filtered),t===this)return!0;if(!(t instanceof e)||this._entityIndex!==t._entityIndex)return t.every(e=>this.has(e));let n=this._graphs,r=t._graphs,i,a,o,s,c;for(let e in r){if(!(i=n[e]))return!1;i=i.subjects;for(let t in a=r[e].subjects){if(!(o=i[t]))return!1;for(let e in s=a[t]){if(!(c=o[e]))return!1;for(let t in s[e])if(!(t in c))return!1}}}return!0}deleteMatches(e,t,n,r){for(let i of this.match(e,t,n,r))this.removeQuad(i);return this}difference(t){if(t&&t instanceof it&&(t=t.filtered),t===this)return new e({entityIndex:this._entityIndex});if(t instanceof e&&t._entityIndex===this._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=et(this._graphs,t._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>!t.has(e))}equals(e){return e instanceof it&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)t(e,this)&&n.add(e);return n}intersection(t){if(t instanceof it&&(t=t.filtered),t===this){let t=new e({entityIndex:this._entityIndex});return t._graphs=Qe(Object.create(null),this._graphs),t._size=this._size,t}else if(t instanceof e&&this._entityIndex===t._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=$e(t._graphs,this._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>t.has(e))}map(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)n.add(t(e,this));return n}reduce(e,t){let n=this.readQuads(),r=t===void 0?n.next().value:t;for(let t of n)r=e(r,t,this);return r}toArray(){return this.getQuads()}toCanonical(){throw Error(`not implemented`)}toStream(){return this.match()}toString(){return new Se().quadsToString(this)}union(t){let n=new e({entityIndex:this._entityIndex});return n._graphs=Qe(Object.create(null),this._graphs),n._size=this._size,n.addAll(t),n}*[Symbol.iterator](){yield*this.readQuads()}};function rt(e,t,n=0){let r=t[n];if(r&&!(r in e))return!1;let i=!1;for(let a in r?{[r]:e[r]}:e){let r=n===2?null:rt(e[a],t,n+1);r!==!1&&(i||=Object.create(null),i[a]=r)}return i}var it=class e extends Xe.Readable{constructor(e,t,n,r,i,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:r,graph:i,options:a})}get filtered(){if(!this._filtered){let{n3Store:e,graph:t,object:n,predicate:r,subject:i}=this,a=this._filtered=new nt({factory:e._factory,entityIndex:this.options.entityIndex}),o,s,c;if(i&&!(o=a._termToNumericId(i))||r&&!(s=a._termToNumericId(r))||n&&!(c=a._termToNumericId(n)))return a;let l=e._getGraphs(t);for(let e in l){let t,n,r,i;(i=l[e])&&(!o&&s?(n=rt(i.predicates,[s,c,o]))&&(t=rt(i.subjects,[o,s,c]),r=rt(i.objects,[c,o,s])):c?(r=rt(i.objects,[c,o,s]))&&(t=rt(i.subjects,[o,s,c]),n=rt(i.predicates,[s,c,o])):(t=rt(i.subjects,[o,s,c]))&&(n=rt(i.predicates,[s,c,o]),r=rt(i.objects,[c,o,s])),t&&(a._graphs[e]={subjects:t,predicates:n,objects:r}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Ze]&&(this[Ze]=this[Symbol.iterator]());let t=this[Ze];for(;--e>=0;){let{done:e,value:n}=t.next();if(e){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,r){return this.filtered.deleteMatches(e,t,n,r)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,r,i){return this.filtered.every(e,t,n,r,i)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,r,i){return this.filtered.forEach(e,t,n,r,i)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,n,r,i){return this.filtered.some(e,t,n,r,i)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,t){return this.filtered.reduce(e,t)}toString(){return new Se().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(t,n,r,i){return new e(this.filtered,t,n,r,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}},at=class extends Xe.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let t=new ae(e),n,r,i={onQuad:(e,t)=>{e&&this.emit(`error`,e)||t&&this.push(t)},onPrefix:(e,t)=>{this.emit(`prefix`,e,t)}};e&&e.comments&&(i.onComment=e=>{this.emit(`comment`,e)}),t.parse({on:(e,t)=>{switch(e){case`data`:n=t;break;case`end`:r=t;break}}},i),this._transform=(e,t,r)=>{n(e),r()},this._flush=e=>{r(),e()}}import(e){return e.on(`data`,e=>{this.write(e)}),e.on(`end`,()=>{this.end()}),e.on(`error`,e=>{this.emit(`error`,e)}),this}},J=`http://www.w3.org/ns/shacl#`,ot=`http://datashapes.org/dash#`,st=`http://www.w3.org/2001/XMLSchema#`,ct=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,lt=`http://www.w3.org/2000/01/rdf-schema#`,ut=`http://www.w3.org/ns/oa#`,dt=`http://purl.org/dc/terms/`,ft=k.namedNode(`loaded-shapes`),pt=k.namedNode(`loaded-data`),mt=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`),ht=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`),gt=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`),_t=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#nil`),vt=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),yt=k.namedNode(`http://purl.org/dc/terms/conformsTo`),bt=k.namedNode(`http://www.w3.org/2000/01/rdf-schema#subClassOf`),xt=k.namedNode(`http://www.w3.org/2002/07/owl#imports`),St=k.namedNode(`http://www.w3.org/2004/02/skos/core#broader`),Ct=k.namedNode(`http://www.w3.org/2004/02/skos/core#narrower`),wt=k.namedNode(`http://www.w3.org/ns/shacl#NodeShape`),Tt=k.namedNode(`http://www.w3.org/ns/shacl#IRI`),Et=k.namedNode(`http://www.w3.org/ns/shacl#property`),Dt=k.namedNode(`http://www.w3.org/ns/shacl#class`),Ot=k.namedNode(`http://www.w3.org/ns/shacl#node`),kt=k.namedNode(`http://www.w3.org/ns/shacl#message`),At=k.namedNode(`http://www.w3.org/ns/shacl#targetClass`),jt=k.namedNode(`http://www.w3.org/ns/shacl#nodeKind`),Mt=k.namedNode(`http://www.w3.org/2001/XMLSchema#string`),Nt=k.namedNode(`http://www.w3.org/2001/XMLSchema#boolean`),Pt=new Set([`http://www.w3.org/2001/XMLSchema#integer`,`http://www.w3.org/2001/XMLSchema#int`,`http://www.w3.org/2001/XMLSchema#short`,`http://www.w3.org/2001/XMLSchema#byte`,`http://www.w3.org/2001/XMLSchema#unsignedInt`,`http://www.w3.org/2001/XMLSchema#unsignedShort`,`http://www.w3.org/2001/XMLSchema#unsignedByte`,`http://www.w3.org/2001/XMLSchema#long`,`http://www.w3.org/2001/XMLSchema#unsignedLong`,`http://www.w3.org/2001/XMLSchema#float`,`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`,`http://www.w3.org/2001/XMLSchema#date`,`http://www.w3.org/2001/XMLSchema#dateTime`]),Ft=new Set([`http://www.w3.org/2001/XMLSchema#integer`,`http://www.w3.org/2001/XMLSchema#int`,`http://www.w3.org/2001/XMLSchema#short`,`http://www.w3.org/2001/XMLSchema#byte`,`http://www.w3.org/2001/XMLSchema#unsignedInt`,`http://www.w3.org/2001/XMLSchema#unsignedShort`,`http://www.w3.org/2001/XMLSchema#unsignedByte`,`http://www.w3.org/2001/XMLSchema#long`,`http://www.w3.org/2001/XMLSchema#unsignedLong`,`http://www.w3.org/2001/XMLSchema#float`,`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`]),It=new Set([`http://www.w3.org/2001/XMLSchema#float`,`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`]);function Lt(e,t,n=J,r){let i=``,a=Rt(e,t,n,r);return a&&(i=a.value),i}function Rt(e,t,n=J,r){let i,a=n+t;if(r?.length){for(let t of r)for(let n of e)if(n.predicate.value===a){if(n.object.id.endsWith(`@${t}`))return n.object;n.object.id.indexOf(`@`)<0?i=n.object:i||=n.object}}else for(let t of e)if(t.predicate.value===a)return t.object;return i}function zt(e){e.querySelector(`.editor`)?.focus()}function Bt(e,t){return Lt(e,`prefLabel`,`http://www.w3.org/2004/02/skos/core#`,t)||Lt(e,`label`,`http://www.w3.org/2000/01/rdf-schema#`,t)||Lt(e,`title`,`http://purl.org/dc/terms/`,t)||Lt(e,`name`,`http://xmlns.com/foaf/0.1/`,t)}function Vt(e,t,n){let r=[];for(let i of e)r.push({value:i,label:Bt(t.getQuads(i,null,null,null),n),children:[]});return r}function Ht(e,t){for(let n in t){let r=t[n];e.startsWith(r)&&(e=e.slice(r.length))}return e}function Ut(e,t,n=new Map){n.set(ft.id,ft),n.set(pt.id,pt);let r=e.config.valuesGraphId??k.defaultGraph();n.set(r.id,r);for(let r of e.owlImports)Wt(r,t,n);return e.parent&&Ut(e.parent,t,n),[...n.values()]}function Wt(e,t,n){if(!n.has(e.id)){n.set(e.id,e);for(let r of t.getObjects(null,xt,e))r.termType===`NamedNode`&&Wt(r,t,n)}}function Gt(e,t,n,r){return r.flatMap(r=>e.getSubjects(t,n,r))}function Kt(e,t,n,r){return r.flatMap(r=>e.getObjects(t,n,r))}function qt(e,t){if(t.in){let e=t.config.lists[t.in];return Vt(e?.length?e:[],t.config.store,t.config.languages)}else{let n=Ut(t,t.config.store),r=Gt(t.config.store,mt,e,n),i=new Map,a=new Map;for(let e of r)i.set(e.id,{value:e,label:Bt(t.config.store.getQuads(e,null,null,null),t.config.languages),children:[]});for(let e of r){for(let r of Kt(t.config.store,e,St,n))i.has(r.id)&&a.set(e.id,r.id);for(let r of Kt(t.config.store,e,Ct,n))i.has(r.id)&&a.set(r.id,e.id);for(let r of Kt(t.config.store,e,bt,n))i.has(r.id)&&a.set(e.id,r.id)}for(let[e,t]of a.entries())i.get(t)?.children?.push(i.get(e));let o=[];for(let[e,t]of i.entries())a.has(e)||o.push(t);for(let r of Gt(t.config.store,bt,e,n))o.push(...qt(r,t));return o}}function Jt(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`}function Yt(e,t,n){if(t===void 0)return n;if(n===void 0)return t;let r=e.indexOf(t.language);if(r<0)return n;let i=e.indexOf(n.language);return i<0||i>r?t:n}function Xt(e,t){let n;for(let r of t)n=Yt(e,n,r);return n?n.value:``}var Zt=/^(-?\d{4,}-\d{2}-\d{2})(Z|[+-]\d{2}:\d{2})?$/,Qt=/^(-?\d{4,}-\d{2}-\d{2})T(\d{2}:\d{2})(?::(\d{2})(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/,$t=/^(-?\d{4,}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2})(\.\d+)?)?$/;function en(e){let t=e.match(Zt);if(!t){let t=e.match(Qt);return t?{value:t[1],suffix:t[5]||``}:void 0}return{value:t[1],suffix:t[2]||``}}function tn(e){let t=e.match(Qt);if(!t){let t=e.match(Zt);return t?{value:`${t[1]}T00:00:00`,suffix:t[2]||``}:void 0}return{value:`${t[1]}T${t[2]}:${t[3]||`00`}`,suffix:t[5]||``}}function nn(e,t=``){let n=e.match(Zt);return n?`${n[1]}${t}`:e}function rn(e,t=``){let n=e.match($t);return n?`${n[1]}:${n[2]||`00`}${n[3]||``}${t}`:e}function an(e){let t=new Set;for(let n of e.getObjects(null,Dt,ft))t.add(n.value);for(let n of e.getObjects(null,At,ft))t.add(n.value);return t}function on(e,t){return e instanceof Set?[...t].filter(t=>!e.has(t)):[...t].filter(t=>!e.includes(t))}function sn(e,{remove:t=!1,ignoreErrors:n=!1}={}){let r={},i=n?()=>!0:(e,t)=>{throw Error(`${e.value} ${t}`)},a=e.getQuads(null,ct+`rest`,ct+`nil`,null),o=t?[...a]:[];return a.forEach(n=>{let a=[],s=!1,c,l,u=n.graph,d=n.subject;for(;d&&!s;){let t=e.getQuads(null,null,d,null),n=e.getQuads(d,null,null,null).filter(e=>!e.predicate.equals(mt)),r,f=null,p=null,m=null;for(let e=0;e<n.length&&!s;e++)r=n[e],r.graph.equals(u)?c?s=i(d,`has non-list arcs out`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`?f?s=i(d,`has multiple rdf:first arcs`):o.push(f=r):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?p?s=i(d,`has multiple rdf:rest arcs`):o.push(p=r):t.length?s=i(d,`can't be subject and object`):(c=r,l=`subject`):s=i(d,`not confined to single graph`);for(let e=0;e<t.length&&!s;++e)r=t[e],c?s=i(d,`can't have coreferences`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?m?s=i(d,`has incoming rdf:rest arcs`):m=r:(c=r,l=`object`);f?a.unshift(f.object):s=i(d,`has no list head`),d=m&&m.subject}s?t=!1:c&&(r[c[l].value]=a)}),t&&e.removeQuads(o),r}var cn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.removeDotSegmentsOfPath=e.removeDotSegments=e.resolve=void 0;function t(e,t){t||=``;let i=t.indexOf(`#`);if(i>0&&(t=t.substr(0,i)),!e.length){if(t.indexOf(`:`)<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);return t}if(e.startsWith(`?`)){let n=t.indexOf(`?`);return n>0&&(t=t.substr(0,n)),t+e}if(e.startsWith(`#`))return t+e;if(!t.length){let t=e.indexOf(`:`);if(t<0)throw Error(`Found invalid relative IRI '${e}' for a missing baseIRI`);return r(e,t)}let a=e.indexOf(`:`);if(a>=0)return r(e,a);let o=t.indexOf(`:`);if(o<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);let s=t.substr(0,o+1);if(e.indexOf(`//`)===0)return s+r(e,a);let c;if(t.indexOf(`//`,o)===o+1){if(c=t.indexOf(`/`,o+3),c<0)return t.length>o+3?t+`/`+r(e,a):s+r(e,a)}else if(c=t.indexOf(`/`,o+1),c<0)return s+r(e,a);if(e.indexOf(`/`)===0)return t.substr(0,c)+n(e);let l=t.substr(c),u=l.lastIndexOf(`/`);return u>=0&&u<l.length-1&&(l=l.substr(0,u+1),e[0]===`.`&&e[1]!==`.`&&e[1]!==`/`&&e[2]&&(e=e.substr(1))),e=l+e,e=n(e),t.substr(0,c)+e}e.resolve=t;function n(e){let t=[],n=0;for(;n<e.length;)switch(e[n]){case`/`:if(e[n+1]===`.`)if(e[n+2]===`.`){if(!i(e[n+3])){t.push([]),n++;break}t.pop(),e[n+3]||t.push([]),n+=3}else{if(!i(e[n+2])){t.push([]),n++;break}e[n+2]||t.push([]),n+=2}else t.push([]),n++;break;case`#`:case`?`:t.length||t.push([]),t[t.length-1].push(e.substr(n)),n=e.length;break;default:t.length||t.push([]),t[t.length-1].push(e[n]),n++;break}return`/`+t.map(e=>e.join(``)).join(`/`)}e.removeDotSegments=n;function r(e,t){let r=t+1;t>=0?e[t+1]===`/`&&e[t+2]===`/`&&(r=t+3):e[0]===`/`&&e[1]===`/`&&(r=2);let i=e.indexOf(`/`,r);return i<0?e:e.substr(0,i)+n(e.substr(i))}e.removeDotSegmentsOfPath=r;function i(e){return!e||e===`#`||e===`?`||e===`/`}})),ln=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(cn(),e)})),un=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CHAR=`
16
+ `),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,r)=>{t=null,e(n,r)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}};function Ce(e){let t=be[e];return t===void 0&&(e.length===1?(t=e.charCodeAt(0).toString(16),t=`\\u0000`.substr(0,6-t.length)+t):(t=((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)+9216).toString(16),t=`\\U00000000`.substr(0,10-t.length)+t)),t}var W=o(((e,t)=>{t.exports={AggregateError:class extends Error{constructor(e){if(!Array.isArray(e))throw TypeError(`Expected input to be an Array, got ${typeof e}`);let t=``;for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name=`AggregateError`,this.errors=e}},ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:2**53-1,NumberMIN_SAFE_INTEGER:-(2**53-1),NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,n){return Object.defineProperty(e,t,n)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,n){return e.then(t,n)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,n){return e.slice(t,n)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol(`Symbol.dispose`),SymbolAsyncDispose:Symbol.asyncDispose||Symbol(`Symbol.asyncDispose`),TypedArrayPrototypeSet(e,t,n){return e.set(t,n)},Boolean,Uint8Array}})),we=o(((e,t)=>{t.exports={format(e,...t){return e.replace(/%([sdifj])/g,function(...[e,n]){let r=t.shift();return n===`f`?r.toFixed(6):n===`j`?JSON.stringify(r):n===`s`&&typeof r==`object`?`${r.constructor===Object?``:r.constructor.name} {}`.trim():r.toString()})},inspect(e){switch(typeof e){case`string`:if(e.includes(`'`)){if(!e.includes(`"`))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case`number`:return isNaN(e)?`NaN`:Object.is(e,-0)?String(e):e;case`bigint`:return`${String(e)}n`;case`boolean`:case`undefined`:return String(e);case`object`:return`{}`}}}})),Te=o(((e,t)=>{var{format:n,inspect:r}=we(),{AggregateError:i}=W(),a=globalThis.AggregateError||i,o=Symbol(`kIsNodeError`),s=[`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`],c=/^([A-Z][a-z0-9]*)+$/,l=`__node_internal_`,u={};function d(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function f(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function p(e,t,r){if(typeof t==`function`)return d(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);let i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?t:n(t,...r)}function m(e,t,n){n||=Error;class r extends n{constructor(...n){super(p(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[o]=!0,u[e]=r}function h(e){let t=l+e.name;return Object.defineProperty(e,"name",{value:t}),e}function g(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;let n=new a([t,e],t.message);return n.code=t.code,n}return e||t}var _=class extends Error{constructor(e=`The operation was aborted`,t=void 0){if(t!==void 0&&typeof t!=`object`)throw new u.ERR_INVALID_ARG_TYPE(`options`,`Object`,t);super(e,t),this.code=`ABORT_ERR`,this.name=`AbortError`}};m(`ERR_ASSERTION`,`%s`,Error),m(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{d(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let i=`The `;e.endsWith(` argument`)?i+=`${e} `:i+=`"${e}" ${e.includes(`.`)?`property`:`argument`} `,i+=`must be `;let a=[],o=[],l=[];for(let e of t)d(typeof e==`string`,`All expected entries have to be of type string`),s.includes(e)?a.push(e.toLowerCase()):c.test(e)?o.push(e):(d(e!==`object`,`The value "object" should be written as "Object"`),l.push(e));if(o.length>0){let e=a.indexOf(`object`);e!==-1&&(a.splice(a,e,1),o.push(`Object`))}if(a.length>0){switch(a.length){case 1:i+=`of type ${a[0]}`;break;case 2:i+=`one of type ${a[0]} or ${a[1]}`;break;default:{let e=a.pop();i+=`one of type ${a.join(`, `)}, or ${e}`}}(o.length>0||l.length>0)&&(i+=` or `)}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let e=o.pop();i+=`an instance of ${o.join(`, `)}, or ${e}`}}l.length>0&&(i+=` or `)}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(i+=`an `),i+=`${l[0]}`;break;case 2:i+=`one of ${l[0]} or ${l[1]}`;break;default:{let e=l.pop();i+=`one of ${l.join(`, `)}, or ${e}`}}if(n==null)i+=`. Received ${n}`;else if(typeof n==`function`&&n.name)i+=`. Received function ${n.name}`;else if(typeof n==`object`){var u;if((u=n.constructor)!=null&&u.name)i+=`. Received an instance of ${n.constructor.name}`;else{let e=r(n,{depth:-1});i+=`. Received ${e}`}}else{let e=r(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),i+=`. Received type ${typeof n} (${e})`}return i},TypeError),m(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let i=r(t);return i.length>128&&(i=i.slice(0,128)+`...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${i}`},TypeError),m(`ERR_INVALID_RETURN_VALUE`,(e,t,n)=>{var r;return`Expected ${e} to be returned from the "${t}" function but got ${n!=null&&(r=n.constructor)!=null&&r.name?`instance of ${n.constructor.name}`:`type ${typeof n}`}.`},TypeError),m(`ERR_MISSING_ARGS`,(...e)=>{d(e.length>0,`At least one arg needs to be specified`);let t,n=e.length;switch(e=(Array.isArray(e)?e:[e]).map(e=>`"${e}"`).join(` or `),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{let n=e.pop();t+=`The ${e.join(`, `)}, and ${n} arguments`}break}return`${t} must be specified`},TypeError),m(`ERR_OUT_OF_RANGE`,(e,t,n)=>{d(t,`Missing "range" argument`);let i;if(Number.isInteger(n)&&Math.abs(n)>2**32)i=f(String(n));else if(typeof n==`bigint`){i=String(n);let e=BigInt(2)**BigInt(32);(n>e||n<-e)&&(i=f(i)),i+=`n`}else i=r(n);return`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError),m(`ERR_MULTIPLE_CALLBACK`,`Callback called multiple times`,Error),m(`ERR_METHOD_NOT_IMPLEMENTED`,`The %s method is not implemented`,Error),m(`ERR_STREAM_ALREADY_FINISHED`,`Cannot call %s after a stream was finished`,Error),m(`ERR_STREAM_CANNOT_PIPE`,`Cannot pipe, not readable`,Error),m(`ERR_STREAM_DESTROYED`,`Cannot call %s after a stream was destroyed`,Error),m(`ERR_STREAM_NULL_VALUES`,`May not write null values to stream`,TypeError),m(`ERR_STREAM_PREMATURE_CLOSE`,`Premature close`,Error),m(`ERR_STREAM_PUSH_AFTER_EOF`,`stream.push() after EOF`,Error),m(`ERR_STREAM_UNSHIFT_AFTER_END_EVENT`,`stream.unshift() after end event`,Error),m(`ERR_STREAM_WRITE_AFTER_END`,`write after end`,Error),m(`ERR_UNKNOWN_ENCODING`,`Unknown encoding: %s`,TypeError),t.exports={AbortError:_,aggregateTwoErrors:h(g),hideStackFrames:h,codes:u}})),Ee=o(((e,t)=>{var{AbortController:n,AbortSignal:r}=typeof self<`u`?self:typeof window<`u`?window:void 0;t.exports=n,t.exports.AbortSignal=r,t.exports.default=n})),De=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),Oe=o(((e,t)=>{var n=f(),{format:r,inspect:i}=we(),{codes:{ERR_INVALID_ARG_TYPE:a}}=Te(),{kResistStopPropagation:o,AggregateError:s,SymbolDispose:c}=W(),l=globalThis.AbortSignal||Ee().AbortSignal,u=globalThis.AbortController||Ee().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||n.Blob,m=p===void 0?function(e){return!1}:function(e){return e instanceof p},h=(e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new a(t,`AbortSignal`,e)},g=(e,t)=>{if(typeof e!=`function`)throw new a(t,`Function`,e)};t.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},promisify(e){return new Promise((t,n)=>{e((e,...r)=>e?n(e):t(...r))})},debuglog(){return function(){}},format:r,inspect:i,types:{isAsyncFunction(e){return e instanceof d},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:m,deprecate(e,t){return e},addAbortListener:De().addAbortListener||function(e,t){if(e===void 0)throw new a(`signal`,`AbortSignal`,e);h(e,`signal`),g(t,`listener`);let n;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener(`abort`,t,{__proto__:null,once:!0,[o]:!0}),n=()=>{e.removeEventListener(`abort`,t)}),{__proto__:null,[c](){var e;(e=n)==null||e()}}},AbortSignalAny:l.any||function(e){if(e.length===1)return e[0];let t=new u,n=()=>t.abort();return e.forEach(e=>{h(e,`signals`),e.addEventListener(`abort`,n,{once:!0})}),t.signal.addEventListener(`abort`,()=>{e.forEach(e=>e.removeEventListener(`abort`,n))},{once:!0}),t.signal}},t.exports.promisify.custom=Symbol.for(`nodejs.util.promisify.custom`)})),ke=o(((e,t)=>{var{ArrayIsArray:n,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:i,ArrayPrototypeMap:a,NumberIsInteger:o,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:l,NumberParseInt:u,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:h}=W(),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:y,ERR_OUT_OF_RANGE:b,ERR_UNKNOWN_SIGNAL:x}}=Te(),{normalizeEncoding:S}=Oe(),{isAsyncFunction:C,isArrayBufferView:w}=Oe().types,T={};function E(e){return e===(e|0)}function D(e){return e===e>>>0}var O=/^[0-7]+$/,k=`must be a 32-bit unsigned integer or an octal string`;function A(e,t,n){if(e===void 0&&(e=n),typeof e==`string`){if(f(O,e)===null)throw new y(t,e,k);e=u(e,8)}return N(e,t),e}var j=g((e,t,n=l,r=c)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),M=g((e,t,n=-2147483648,r=2147483647)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),N=g((e,t,n=!1)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);let r=+!!n,i=4294967295;if(e<r||e>i)throw new b(t,`>= ${r} && <= ${i}`,e)});function P(e,t){if(typeof e!=`string`)throw new v(t,`string`,e)}function F(e,t,n=void 0,r){if(typeof e!=`number`)throw new v(t,`number`,e);if(n!=null&&e<n||r!=null&&e>r||(n!=null||r!=null)&&s(e))throw new b(t,`${n==null?``:`>= ${n}`}${n!=null&&r!=null?` && `:``}${r==null?``:`<= ${r}`}`,e)}var I=g((e,t,n)=>{if(!r(n,e))throw new y(t,e,`must be one of: `+i(a(n,e=>typeof e==`string`?`'${e}'`:p(e)),`, `))});function L(e,t){if(typeof e!=`boolean`)throw new v(t,`boolean`,e)}function R(e,t,n){return e==null||!d(e,t)?n:e[t]}var z=g((e,t,r=null)=>{let i=R(r,`allowArray`,!1),a=R(r,`allowFunction`,!1);if(!R(r,`nullable`,!1)&&e===null||!i&&n(e)||typeof e!=`object`&&(!a||typeof e!=`function`))throw new v(t,`Object`,e)}),B=g((e,t)=>{if(e!=null&&typeof e!=`object`&&typeof e!=`function`)throw new v(t,`a dictionary`,e)}),ee=g((e,t,r=0)=>{if(!n(e))throw new v(t,`Array`,e);if(e.length<r)throw new y(t,e,`must be longer than ${r}`)});function te(e,t){ee(e,t);for(let n=0;n<e.length;n++)P(e[n],`${t}[${n}]`)}function ne(e,t){ee(e,t);for(let n=0;n<e.length;n++)L(e[n],`${t}[${n}]`)}function V(e,t){ee(e,t);for(let n=0;n<e.length;n++){let r=e[n],i=`${t}[${n}]`;if(r==null)throw new v(i,`AbortSignal`,r);se(r,i)}}function re(e,t=`signal`){if(P(e,t),T[e]===void 0)throw T[m(e)]===void 0?new x(e):new x(e+` (signals must use all capital letters)`)}var ie=g((e,t=`buffer`)=>{if(!w(e))throw new v(t,[`Buffer`,`TypedArray`,`DataView`],e)});function ae(e,t){let n=S(t),r=e.length;if(n===`hex`&&r%2!=0)throw new y(`encoding`,t,`is invalid for data of length ${r}`)}function oe(e,t=`Port`,n=!0){if(typeof e!=`number`&&typeof e!=`string`||typeof e==`string`&&h(e).length===0||+e!=e>>>0||e>65535||e===0&&!n)throw new _(t,e,n);return e|0}var se=g((e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new v(t,`AbortSignal`,e)}),ce=g((e,t)=>{if(typeof e!=`function`)throw new v(t,`Function`,e)}),le=g((e,t)=>{if(typeof e!=`function`||C(e))throw new v(t,`Function`,e)}),ue=g((e,t)=>{if(e!==void 0)throw new v(t,`undefined`,e)});function de(e,t,n){if(!r(n,e))throw new v(t,`('${i(n,`|`)}')`,e)}var fe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(e,t){if(e===void 0||!f(fe,e))throw new y(t,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}function me(e){if(typeof e==`string`)return pe(e,`hints`),e;if(n(e)){let t=e.length,n=``;if(t===0)return n;for(let r=0;r<t;r++){let i=e[r];pe(i,`hints`),n+=i,r!==t-1&&(n+=`, `)}return n}throw new y(`hints`,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}t.exports={isInt32:E,isUint32:D,parseFileMode:A,validateArray:ee,validateStringArray:te,validateBooleanArray:ne,validateAbortSignalArray:V,validateBoolean:L,validateBuffer:ie,validateDictionary:B,validateEncoding:ae,validateFunction:ce,validateInt32:M,validateInteger:j,validateNumber:F,validateObject:z,validateOneOf:I,validatePlainFunction:le,validatePort:oe,validateSignalName:re,validateString:P,validateUint32:N,validateUndefined:ue,validateUnion:de,validateAbortSignal:se,validateLinkHeaderValue:me}})),Ae=o(((e,t)=>{var n=t.exports={},r,i;function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}(function(){try{r=typeof setTimeout==`function`?setTimeout:a}catch{r=a}try{i=typeof clearTimeout==`function`?clearTimeout:o}catch{i=o}})();function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch{try{return r.call(null,e,0)}catch{return r.call(this,e,0)}}}function c(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch{try{return i.call(null,e)}catch{return i.call(this,e)}}}var l=[],u=!1,d,f=-1;function p(){!u||!d||(u=!1,d.length?l=d.concat(l):f=-1,l.length&&m())}function m(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(d=l,l=[];++f<t;)d&&d[f].run();f=-1,t=l.length}d=null,u=!1,c(e)}}n.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),l.length===1&&!u&&s(m)};function h(e,t){this.fun=e,this.array=t}h.prototype.run=function(){this.fun.apply(null,this.array)},n.title=`browser`,n.browser=!0,n.env={},n.argv=[],n.version=``,n.versions={};function g(){}n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw Error(`process.binding is not supported`)},n.cwd=function(){return`/`},n.chdir=function(e){throw Error(`process.chdir is not supported`)},n.umask=function(){return 0}})),G=o(((e,t)=>{var{SymbolAsyncIterator:n,SymbolIterator:r,SymbolFor:i}=W(),a=i(`nodejs.stream.destroyed`),o=i(`nodejs.stream.errored`),s=i(`nodejs.stream.readable`),c=i(`nodejs.stream.writable`),l=i(`nodejs.stream.disturbed`),u=i(`nodejs.webstream.isClosedPromise`),d=i(`nodejs.webstream.controllerErrorFunction`);function f(e,t=!1){return!!(e&&typeof e.pipe==`function`&&typeof e.on==`function`&&(!t||typeof e.pause==`function`&&typeof e.resume==`function`)&&(!e._writableState||e._readableState?.readable!==!1)&&(!e._writableState||e._readableState))}function p(e){return!!(e&&typeof e.write==`function`&&typeof e.on==`function`&&(!e._readableState||e._writableState?.writable!==!1))}function m(e){return!!(e&&typeof e.pipe==`function`&&e._readableState&&typeof e.on==`function`&&typeof e.write==`function`)}function h(e){return e&&(e._readableState||e._writableState||typeof e.write==`function`&&typeof e.on==`function`||typeof e.pipe==`function`&&typeof e.on==`function`)}function g(e){return!!(e&&!h(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`&&typeof e.cancel==`function`)}function _(e){return!!(e&&!h(e)&&typeof e.getWriter==`function`&&typeof e.abort==`function`)}function v(e){return!!(e&&!h(e)&&typeof e.readable==`object`&&typeof e.writable==`object`)}function y(e){return g(e)||_(e)||v(e)}function b(e,t){return e==null?!1:t===!0?typeof e[n]==`function`:t===!1?typeof e[r]==`function`:typeof e[n]==`function`||typeof e[r]==`function`}function x(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[a]||r!=null&&r.destroyed)}function S(e){if(!p(e))return null;if(e.writableEnded===!0)return!0;let t=e._writableState;return t!=null&&t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function C(e,t){if(!p(e))return null;if(e.writableFinished===!0)return!0;let n=e._writableState;return n!=null&&n.errored?!1:typeof n?.finished==`boolean`?!!(n.finished||t===!1&&n.ended===!0&&n.length===0):null}function w(e){if(!f(e))return null;if(e.readableEnded===!0)return!0;let t=e._readableState;return!t||t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function T(e,t){if(!f(e))return null;let n=e._readableState;return n!=null&&n.errored?!1:typeof n?.endEmitted==`boolean`?!!(n.endEmitted||t===!1&&n.ended===!0&&n.length===0):null}function E(e){return e&&e[s]!=null?e[s]:typeof e?.readable==`boolean`?!x(e)&&f(e)&&e.readable&&!T(e):null}function D(e){return e&&e[c]!=null?e[c]:typeof e?.writable==`boolean`?!x(e)&&p(e)&&e.writable&&!S(e):null}function O(e,t){return h(e)?x(e)?!0:!(t?.readable!==!1&&E(e)||t?.writable!==!1&&D(e)):null}function k(e){return h(e)?e.writableErrored?e.writableErrored:e._writableState?.errored??null:null}function A(e){return h(e)?e.readableErrored?e.readableErrored:e._readableState?.errored??null:null}function j(e){if(!h(e))return null;if(typeof e.closed==`boolean`)return e.closed;let t=e._writableState,n=e._readableState;return typeof t?.closed==`boolean`||typeof n?.closed==`boolean`?t?.closed||n?.closed:typeof e._closed==`boolean`&&M(e)?e._closed:null}function M(e){return typeof e._closed==`boolean`&&typeof e._defaultKeepAlive==`boolean`&&typeof e._removedConnection==`boolean`&&typeof e._removedContLen==`boolean`}function N(e){return typeof e._sent100==`boolean`&&M(e)}function P(e){return typeof e._consuming==`boolean`&&typeof e._dumped==`boolean`&&e.req?.upgradeOrConnect===void 0}function F(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!r&&N(e)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function I(e){return!!(e&&(e[l]??(e.readableDidRead||e.readableAborted)))}function L(e){return!!(e&&(e[o]??e.readableErrored??e.writableErrored??e._readableState?.errorEmitted??e._writableState?.errorEmitted??e._readableState?.errored??e._writableState?.errored))}t.exports={isDestroyed:x,kIsDestroyed:a,isDisturbed:I,kIsDisturbed:l,isErrored:L,kIsErrored:o,isReadable:E,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:d,kIsWritable:c,isClosed:j,isDuplexNodeStream:m,isFinished:O,isIterable:b,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:w,isReadableFinished:T,isReadableErrored:A,isNodeStream:h,isWebStream:y,isWritable:D,isWritableNodeStream:p,isWritableStream:_,isWritableEnded:S,isWritableFinished:C,isWritableErrored:k,isServerRequest:P,isServerResponse:N,willEmitClose:F,isTransformStream:v}})),je=o(((e,t)=>{var n=Ae(),{AbortError:r,codes:i}=Te(),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:o}=i,{kEmptyObject:s,once:c}=Oe(),{validateAbortSignal:l,validateFunction:u,validateObject:d,validateBoolean:f}=ke(),{Promise:p,PromisePrototypeThen:m,SymbolDispose:h}=W(),{isClosed:g,isReadable:_,isReadableNodeStream:v,isReadableStream:y,isReadableFinished:b,isReadableErrored:x,isWritable:S,isWritableNodeStream:C,isWritableStream:w,isWritableFinished:T,isWritableErrored:E,isNodeStream:D,willEmitClose:O,kIsClosedPromise:k}=G(),A;function j(e){return e.setHeader&&typeof e.abort==`function`}var M=()=>{};function N(e,t,i){if(arguments.length===2?(i=t,t=s):t==null?t=s:d(t,`options`),u(i,`callback`),l(t.signal,`options.signal`),i=c(i),y(e)||w(e))return P(e,t,i);if(!D(e))throw new a(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],e);let f=t.readable??v(e),p=t.writable??C(e),m=e._writableState,k=e._readableState,N=()=>{e.writable||L()},F=O(e)&&v(e)===f&&C(e)===p,I=T(e,!1),L=()=>{I=!0,e.destroyed&&(F=!1),!(F&&(!e.readable||f))&&(!f||R)&&i.call(e)},R=b(e,!1),z=()=>{R=!0,e.destroyed&&(F=!1),!(F&&(!e.writable||p))&&(!p||I)&&i.call(e)},B=t=>{i.call(e,t)},ee=g(e),te=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);if(f&&!R&&v(e,!0)&&!b(e,!1)||p&&!I&&!T(e,!1))return i.call(e,new o);i.call(e)},ne=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);i.call(e)},V=()=>{e.req.on(`finish`,L)};j(e)?(e.on(`complete`,L),F||e.on(`abort`,te),e.req?V():e.on(`request`,V)):p&&!m&&(e.on(`end`,N),e.on(`close`,N)),!F&&typeof e.aborted==`boolean`&&e.on(`aborted`,te),e.on(`end`,z),e.on(`finish`,L),t.error!==!1&&e.on(`error`,B),e.on(`close`,te),ee?n.nextTick(te):m!=null&&m.errorEmitted||k!=null&&k.errorEmitted?F||n.nextTick(ne):(!f&&(!F||_(e))&&(I||S(e)===!1)||!p&&(!F||S(e))&&(R||_(e)===!1)||k&&e.req&&e.aborted)&&n.nextTick(ne);let re=()=>{i=M,e.removeListener(`aborted`,te),e.removeListener(`complete`,L),e.removeListener(`abort`,te),e.removeListener(`request`,V),e.req&&e.req.removeListener(`finish`,L),e.removeListener(`end`,N),e.removeListener(`close`,N),e.removeListener(`finish`,L),e.removeListener(`end`,z),e.removeListener(`error`,B),e.removeListener(`close`,te)};if(t.signal&&!ee){let a=()=>{let n=i;re(),n.call(e,new r(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(a);else{A||=Oe().addAbortListener;let n=A(t.signal,a),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}}return re}function P(e,t,i){let a=!1,o=M;if(t.signal)if(o=()=>{a=!0,i.call(e,new r(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(o);else{A||=Oe().addAbortListener;let n=A(t.signal,o),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}let s=(...t)=>{a||n.nextTick(()=>i.apply(e,t))};return m(e[k].promise,s,s),M}function F(e,t){var n;let r=!1;return t===null&&(t=s),(n=t)!=null&&n.cleanup&&(f(t.cleanup,`cleanup`),r=t.cleanup),new p((n,i)=>{let a=N(e,t,e=>{r&&a(),e?i(e):n()})})}t.exports=N,t.exports.finished=F})),K=o(((e,t)=>{var n=Ae(),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:i},AbortError:a}=Te(),{Symbol:o}=W(),{kIsDestroyed:s,isDestroyed:c,isFinished:l,isServerRequest:u}=G(),d=o(`kDestroy`),f=o(`kConstruct`);function p(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function m(e,t){let n=this._readableState,i=this._writableState,a=i||n;return i!=null&&i.destroyed||n!=null&&n.destroyed?(typeof t==`function`&&t(),this):(p(e,i,n),i&&(i.destroyed=!0),n&&(n.destroyed=!0),a.constructed?h(this,e,t):this.once(d,function(n){h(this,r(n,e),t)}),this)}function h(e,t,r){let i=!1;function a(t){if(i)return;i=!0;let a=e._readableState,o=e._writableState;p(t,o,a),o&&(o.closed=!0),a&&(a.closed=!0),typeof r==`function`&&r(t),t?n.nextTick(g,e,t):n.nextTick(_,e)}try{e._destroy(t||null,a)}catch(e){a(e)}}function g(e,t){v(e,t),_(e)}function _(e){let t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&e.emit(`close`)}function v(e,t){let n=e._readableState,r=e._writableState;r!=null&&r.errorEmitted||n!=null&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit(`error`,t))}function y(){let e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function b(e,t,r){let i=e._readableState,a=e._writableState;if(a!=null&&a.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||a!=null&&a.autoDestroy?e.destroy(t):t&&(t.stack,a&&!a.errored&&(a.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(v,e,t):v(e,t))}function x(e,t){if(typeof e._construct!=`function`)return;let r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),!(e.listenerCount(f)>1)&&n.nextTick(S,e)}function S(e){let t=!1;function r(r){if(t){b(e,r??new i);return}t=!0;let a=e._readableState,o=e._writableState,s=o||a;a&&(a.constructed=!0),o&&(o.constructed=!0),s.destroyed?e.emit(d,r):r?b(e,r,!0):n.nextTick(C,e)}try{e._construct(e=>{n.nextTick(r,e)})}catch(e){n.nextTick(r,e)}}function C(e){e.emit(f)}function w(e){return e?.setHeader&&typeof e.abort==`function`}function T(e){e.emit(`close`)}function E(e,t){e.emit(`error`,t),n.nextTick(T,e)}function D(e,t){!e||c(e)||(!t&&!l(e)&&(t=new a),u(e)?(e.socket=null,e.destroy(t)):w(e)?e.abort():w(e.req)?e.req.abort():typeof e.destroy==`function`?e.destroy(t):typeof e.close==`function`?e.close():t?n.nextTick(E,e,t):n.nextTick(T,e),e.destroyed||(e[s]=!0))}t.exports={construct:x,destroyer:D,destroy:m,undestroy:y,errorOrDestroy:b}})),q=o(((e,t)=>{var{ArrayIsArray:n,ObjectSetPrototypeOf:r}=W(),{EventEmitter:i}=De();function a(e){i.call(this,e)}r(a.prototype,i.prototype),r(a,i),a.prototype.pipe=function(e,t){let n=this;function r(t){e.writable&&e.write(t)===!1&&n.pause&&n.pause()}n.on(`data`,r);function a(){n.readable&&n.resume&&n.resume()}e.on(`drain`,a),!e._isStdio&&(!t||t.end!==!1)&&(n.on(`end`,c),n.on(`close`,l));let s=!1;function c(){s||(s=!0,e.end())}function l(){s||(s=!0,typeof e.destroy==`function`&&e.destroy())}function u(e){d(),i.listenerCount(this,`error`)===0&&this.emit(`error`,e)}o(n,`error`,u),o(e,`error`,u);function d(){n.removeListener(`data`,r),e.removeListener(`drain`,a),n.removeListener(`end`,c),n.removeListener(`close`,l),n.removeListener(`error`,u),e.removeListener(`error`,u),n.removeListener(`end`,d),n.removeListener(`close`,d),e.removeListener(`close`,d)}return n.on(`end`,d),n.on(`close`,d),e.on(`close`,d),e.emit(`pipe`,n),e};function o(e,t,r){if(typeof e.prependListener==`function`)return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}t.exports={Stream:a,prependListener:o}})),Me=o(((e,t)=>{var{SymbolDispose:n}=W(),{AbortError:r,codes:i}=Te(),{isNodeStream:a,isWebStream:o,kControllerErrorFunction:s}=G(),c=je(),{ERR_INVALID_ARG_TYPE:l}=i,u,d=(e,t)=>{if(typeof e!=`object`||!(`aborted`in e))throw new l(t,`AbortSignal`,e)};t.exports.addAbortSignal=function(e,n){if(d(e,`signal`),!a(n)&&!o(n))throw new l(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],n);return t.exports.addAbortSignalNoValidate(e,n)},t.exports.addAbortSignalNoValidate=function(e,t){if(typeof e!=`object`||!(`aborted`in e))return t;let i=a(t)?()=>{t.destroy(new r(void 0,{cause:e.reason}))}:()=>{t[s](new r(void 0,{cause:e.reason}))};return e.aborted?i():(u||=Oe().addAbortListener,c(t,u(e,i)[n])),t}})),Ne=o(((e,t)=>{var{StringPrototypeSlice:n,SymbolIterator:r,TypedArrayPrototypeSet:i,Uint8Array:a}=W(),{Buffer:o}=f(),{inspect:s}=Oe();t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){let t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return``;let t=this.head,n=``+t.data;for(;(t=t.next)!==null;)n+=e+t.data;return n}concat(e){if(this.length===0)return o.alloc(0);let t=o.allocUnsafe(e>>>0),n=this.head,r=0;for(;n;)i(t,n.data,r),r+=n.data.length,n=n.next;return t}consume(e,t){let n=this.head.data;if(e<n.length){let t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[r](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t=``,r=this.head,i=0;do{let a=r.data;if(e>a.length)t+=a,e-=a.length;else{e===a.length?(t+=a,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(a,0,e),this.head=r,r.data=n(a,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){let t=o.allocUnsafe(e),n=e,r=this.head,s=0;do{let o=r.data;if(e>o.length)i(t,o,n-e),e-=o.length;else{e===o.length?(i(t,o,n-e),++s,r.next?this.head=r.next:this.head=this.tail=null):(i(t,new a(o.buffer,o.byteOffset,e),n-e),this.head=r,r.data=o.slice(e));break}++s}while((r=r.next)!==null);return this.length-=s,t}[Symbol.for(`nodejs.util.inspect.custom`)](e,t){return s(this,{...t,depth:0,customInspect:!1})}}})),Pe=o(((e,t)=>{var{MathFloor:n,NumberIsInteger:r}=W(),{validateInteger:i}=ke(),{ERR_INVALID_ARG_VALUE:a}=Te().codes,o=16*1024,s=16;function c(e,t,n){return e.highWaterMark==null?t?e[n]:null:e.highWaterMark}function l(e){return e?s:o}function u(e,t){i(t,`value`,0),e?s=t:o=t}function d(e,t,i,o){let s=c(t,o,i);if(s!=null){if(!r(s)||s<0)throw new a(o?`options.${i}`:`options.highWaterMark`,s);return n(s)}return l(e.objectMode)}t.exports={getHighWaterMark:d,getDefaultHighWaterMark:l,setDefaultHighWaterMark:u}})),Fe=o(((e,t)=>{var n=f(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),Ie=o((e=>{var t=Fe().Buffer,n=t.isEncoding||function(e){switch(e=``+e,e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function r(e){if(!e)return`utf8`;for(var t;;)switch(e){case`utf8`:case`utf-8`:return`utf8`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;case`latin1`:case`binary`:return`latin1`;case`base64`:case`ascii`:case`hex`:return e;default:if(t)return;e=(``+e).toLowerCase(),t=!0}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString(`base64`,t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+this.lastChar.toString(`base64`,0,3-this.lastNeed):t}function g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),Le=o(((e,t)=>{var n=Ae(),{PromisePrototypeThen:r,SymbolAsyncIterator:i,SymbolIterator:a}=W(),{Buffer:o}=f(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:c}=Te().codes;function l(e,t,l){let u;if(typeof t==`string`||t instanceof o)return new e({objectMode:!0,...l,read(){this.push(t),this.push(null)}});let d;if(t&&t[i])d=!0,u=t[i]();else if(t&&t[a])d=!1,u=t[a]();else throw new s(`iterable`,[`Iterable`],t);let f=new e({objectMode:!0,highWaterMark:1,...l}),p=!1;f._read=function(){p||(p=!0,h())},f._destroy=function(e,t){r(m(e),()=>n.nextTick(t,e),r=>n.nextTick(t,r||e))};async function m(e){let t=e!=null,n=typeof u.throw==`function`;if(t&&n){let{value:t,done:n}=await u.throw(e);if(await t,n)return}if(typeof u.return==`function`){let{value:e}=await u.return();await e}}async function h(){for(;;){try{let{value:e,done:t}=d?await u.next():u.next();if(t)f.push(null);else{let t=e&&typeof e.then==`function`?await e:e;if(t===null)throw p=!1,new c;if(f.push(t))continue;p=!1}}catch(e){f.destroy(e)}break}}return f}t.exports=l})),Re=o(((e,t)=>{var n=Ae(),{ArrayPrototypeIndexOf:r,NumberIsInteger:i,NumberIsNaN:a,NumberParseInt:o,ObjectDefineProperties:s,ObjectKeys:c,ObjectSetPrototypeOf:l,Promise:u,SafeSet:d,SymbolAsyncDispose:p,SymbolAsyncIterator:m,Symbol:h}=W();t.exports=U,U.ReadableState=_e;var{EventEmitter:g}=De(),{Stream:_,prependListener:v}=q(),{Buffer:y}=f(),{addAbortSignal:b}=Me(),x=je(),S=Oe().debuglog(`stream`,e=>{S=e}),C=Ne(),w=K(),{getHighWaterMark:T,getDefaultHighWaterMark:E}=Pe(),{aggregateTwoErrors:D,codes:{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:A,ERR_STREAM_PUSH_AFTER_EOF:j,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:M},AbortError:N}=Te(),{validateObject:P}=ke(),F=h(`kPaused`),{StringDecoder:I}=Ie(),L=Le();l(U.prototype,_.prototype),l(U,_);var R=()=>{},{errorOrDestroy:z}=w,B=1,ee=2,te=4,ne=8,V=16,re=32,ie=64,ae=128,oe=256,se=512,ce=1024,le=2048,ue=4096,de=8192,fe=16384,pe=32768,me=65536,he=1<<17,ge=1<<18;function H(e){return{enumerable:!1,get(){return(this.state&e)!==0},set(t){t?this.state|=e:this.state&=~e}}}s(_e.prototype,{objectMode:H(B),ended:H(ee),endEmitted:H(te),reading:H(ne),constructed:H(V),sync:H(re),needReadable:H(ie),emittedReadable:H(ae),readableListening:H(oe),resumeScheduled:H(se),errorEmitted:H(ce),emitClose:H(le),autoDestroy:H(ue),destroyed:H(de),closed:H(fe),closeEmitted:H(pe),multiAwaitDrain:H(me),readingMore:H(he),dataEmitted:H(ge)});function _e(e,t,n){typeof n!=`boolean`&&(n=t instanceof Ve()),this.state=6192,e&&e.objectMode&&(this.state|=B),n&&e&&e.readableObjectMode&&(this.state|=B),this.highWaterMark=e?T(this,e,`readableHighWaterMark`,n):E(!1),this.buffer=new C,this.length=0,this.pipes=[],this.flowing=null,this[F]=null,e&&e.emitClose===!1&&(this.state&=-2049),e&&e.autoDestroy===!1&&(this.state&=-4097),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new I(e.encoding),this.encoding=e.encoding)}function U(e){if(!(this instanceof U))return new U(e);let t=this instanceof Ve();this._readableState=new _e(e,this,t),e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&!t&&b(e.signal,this)),_.call(this,e),w.construct(this,()=>{this._readableState.needReadable&&G(this,this._readableState)})}U.prototype.destroy=w.destroy,U.prototype._undestroy=w.undestroy,U.prototype._destroy=function(e,t){t(e)},U.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},U.prototype[p]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new N,this.destroy(e)),new u((t,n)=>x(this,r=>r&&r!==e?n(r):t(null)))},U.prototype.push=function(e,t){return ve(this,e,t,!1)},U.prototype.unshift=function(e,t){return ve(this,e,t,!0)};function ve(e,t,n,r){S(`readableAddChunk`,t);let i=e._readableState,a;if((i.state&B)===0&&(typeof t==`string`?(n||=i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?t=y.from(t,n).toString(i.encoding):(t=y.from(t,n),n=``))):t instanceof y?n=``:_._isUint8Array(t)?(t=_._uint8ArrayToBuffer(t),n=``):t!=null&&(a=new O(`chunk`,[`string`,`Buffer`,`Uint8Array`],t))),a)z(e,a);else if(t===null)i.state&=-9,Ce(e,i);else if((i.state&B)!==0||t&&t.length>0)if(r)if((i.state&te)!==0)z(e,new M);else if(i.destroyed||i.errored)return!1;else ye(e,i,t,!0);else if(i.ended)z(e,new j);else if(i.destroyed||i.errored)return!1;else i.state&=-9,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||t.length!==0?ye(e,i,t,!1):G(e,i)):ye(e,i,t,!1);else r||(i.state&=-9,G(e,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function ye(e,t,n,r){t.flowing&&t.length===0&&!t.sync&&e.listenerCount(`data`)>0?((t.state&me)===0?t.awaitDrainWriters=null:t.awaitDrainWriters.clear(),t.dataEmitted=!0,e.emit(`data`,n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),(t.state&ie)!==0&&we(e)),G(e,t)}U.prototype.isPaused=function(){let e=this._readableState;return e[F]===!0||e.flowing===!1},U.prototype.setEncoding=function(e){let t=new I(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;let n=this._readableState.buffer,r=``;for(let e of n)r+=t.write(e);return n.clear(),r!==``&&n.push(r),this._readableState.length=r.length,this};var be=1073741824;function xe(e){if(e>be)throw new A(`size`,`<= 1GiB`,e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++,e}function Se(e,t){return e<=0||t.length===0&&t.ended?0:(t.state&B)===0?a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0:1}U.prototype.read=function(e){S(`read`,e),e===void 0?e=NaN:i(e)||(e=o(e,10));let t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=xe(e)),e!==0&&(t.state&=-129),e===0&&t.needReadable&&((t.highWaterMark===0?t.length>0:t.length>=t.highWaterMark)||t.ended))return S(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?Je(this):we(this),null;if(e=Se(e,t),e===0&&t.ended)return t.length===0&&Je(this),null;let r=(t.state&ie)!==0;if(S(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,S(`length less than watermark`,r)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)r=!1,S(`reading, ended or constructing`,r);else if(r){S(`do read`),t.state|=40,t.length===0&&(t.state|=ie);try{this._read(t.highWaterMark)}catch(e){z(this,e)}t.state&=-33,t.reading||(e=Se(n,t))}let a;return a=e>0?qe(e,t):null,a===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Je(this)),a!==null&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit(`data`,a)),a};function Ce(e,t){if(S(`onEofChunk`),!t.ended){if(t.decoder){let e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?we(e):(t.needReadable=!1,t.emittedReadable=!0,Ee(e))}}function we(e){let t=e._readableState;S(`emitReadable`,t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(S(`emitReadable`,t.flowing),t.emittedReadable=!0,n.nextTick(Ee,e))}function Ee(e){let t=e._readableState;S(`emitReadable_`,t.destroyed,t.length,t.ended),!t.destroyed&&!t.errored&&(t.length||t.ended)&&(e.emit(`readable`),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,We(e)}function G(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(Fe,e,t))}function Fe(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){let n=t.length;if(S(`maybeReadMore read 0`),e.read(0),n===t.length)break}t.readingMore=!1}U.prototype._read=function(e){throw new k(`_read()`)},U.prototype.pipe=function(e,t){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new d(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),S(`pipe count=%d opts=%j`,i.pipes.length,t);let a=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr?s:_;i.endEmitted?n.nextTick(a):r.once(`end`,a),e.on(`unpipe`,o);function o(e,t){S(`onunpipe`),e===r&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,u())}function s(){S(`onend`),e.end()}let c,l=!1;function u(){S(`cleanup`),e.removeListener(`close`,h),e.removeListener(`finish`,g),c&&e.removeListener(`drain`,c),e.removeListener(`error`,m),e.removeListener(`unpipe`,o),r.removeListener(`end`,s),r.removeListener(`end`,_),r.removeListener(`data`,p),l=!0,c&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&c()}function f(){l||(i.pipes.length===1&&i.pipes[0]===e?(S(`false write response, pause`,0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(S(`false write response, pause`,i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),c||(c=Re(r,e),e.on(`drain`,c))}r.on(`data`,p);function p(t){S(`ondata`);let n=e.write(t);S(`dest.write`,n),n===!1&&f()}function m(t){if(S(`onerror`,t),_(),e.removeListener(`error`,m),e.listenerCount(`error`)===0){let n=e._writableState||e._readableState;n&&!n.errorEmitted?z(e,t):e.emit(`error`,t)}}v(e,`error`,m);function h(){e.removeListener(`finish`,g),_()}e.once(`close`,h);function g(){S(`onfinish`),e.removeListener(`close`,h),_()}e.once(`finish`,g);function _(){S(`unpipe`),r.unpipe(e)}return e.emit(`pipe`,r),e.writableNeedDrain===!0?f():i.flowing||(S(`pipe resume`),r.resume()),e};function Re(e,t){return function(){let n=e._readableState;n.awaitDrainWriters===t?(S(`pipeOnDrain`,1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(S(`pipeOnDrain`,n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&e.listenerCount(`data`)&&e.resume()}}U.prototype.unpipe=function(e){let t=this._readableState,n={hasUnpiped:!1};if(t.pipes.length===0)return this;if(!e){let e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit(`unpipe`,this,{hasUnpiped:!1});return this}let i=r(t.pipes,e);return i===-1?this:(t.pipes.splice(i,1),t.pipes.length===0&&this.pause(),e.emit(`unpipe`,this,n),this)},U.prototype.on=function(e,t){let r=_.prototype.on.call(this,e,t),i=this._readableState;return e===`data`?(i.readableListening=this.listenerCount(`readable`)>0,i.flowing!==!1&&this.resume()):e===`readable`&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S(`on readable`,i.length,i.reading),i.length?we(this):i.reading||n.nextTick(Be,this)),r},U.prototype.addListener=U.prototype.on,U.prototype.removeListener=function(e,t){let r=_.prototype.removeListener.call(this,e,t);return e===`readable`&&n.nextTick(ze,this),r},U.prototype.off=U.prototype.removeListener,U.prototype.removeAllListeners=function(e){let t=_.prototype.removeAllListeners.apply(this,arguments);return(e===`readable`||e===void 0)&&n.nextTick(ze,this),t};function ze(e){let t=e._readableState;t.readableListening=e.listenerCount(`readable`)>0,t.resumeScheduled&&t[F]===!1?t.flowing=!0:e.listenerCount(`data`)>0?e.resume():t.readableListening||(t.flowing=null)}function Be(e){S(`readable nexttick read 0`),e.read(0)}U.prototype.resume=function(){let e=this._readableState;return e.flowing||(S(`resume`),e.flowing=!e.readableListening,He(this,e)),e[F]=!1,this};function He(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(Ue,e,t))}function Ue(e,t){S(`resume`,t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit(`resume`),We(e),t.flowing&&!t.reading&&e.read(0)}U.prototype.pause=function(){return S(`call pause flowing=%j`,this._readableState.flowing),this._readableState.flowing!==!1&&(S(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this._readableState[F]=!0,this};function We(e){let t=e._readableState;for(S(`flow`,t.flowing);t.flowing&&e.read()!==null;);}U.prototype.wrap=function(e){let t=!1;e.on(`data`,n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())}),e.on(`end`,()=>{this.push(null)}),e.on(`error`,e=>{z(this,e)}),e.on(`close`,()=>{this.destroy()}),e.on(`destroy`,()=>{this.destroy()}),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};let n=c(e);for(let t=1;t<n.length;t++){let r=n[t];this[r]===void 0&&typeof e[r]==`function`&&(this[r]=e[r].bind(e))}return this},U.prototype[m]=function(){return Ge(this)},U.prototype.iterator=function(e){return e!==void 0&&P(e,`options`),Ge(this,e)};function Ge(e,t){typeof e.read!=`function`&&(e=U.wrap(e,{objectMode:!0}));let n=Ke(e,t);return n.stream=e,n}async function*Ke(e,t){let n=R;function r(t){this===e?(n(),n=R):n=t}e.on(`readable`,r);let i,a=x(e,{writable:!1},e=>{i=e?D(i,e):null,n(),n=R});try{for(;;){let t=e.destroyed?null:e.read();if(t!==null)yield t;else if(i)throw i;else if(i===null)return;else await new u(r)}}catch(e){throw i=D(i,e),i}finally{(i||t?.destroyOnReturn!==!1)&&(i===void 0||e._readableState.autoDestroy)?w.destroyer(e,null):(e.off(`readable`,r),a())}}s(U.prototype,{readable:{__proto__:null,get(){let e=this._readableState;return!!e&&e.readable!==!1&&!e.destroyed&&!e.errorEmitted&&!e.endEmitted},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(_e.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[F]!==!1},set(e){this[F]=!!e}}}),U._fromList=qe;function qe(e,t){if(t.length===0)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function Je(e){let t=e._readableState;S(`endReadable`,t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(Ye,t,e))}function Ye(e,t){if(S(`endReadableNT`,e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.emit(`end`),t.writable&&t.allowHalfOpen===!1)n.nextTick(Xe,t);else if(e.autoDestroy){let e=t._writableState;(!e||e.autoDestroy&&(e.finished||e.writable===!1))&&t.destroy()}}}function Xe(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}U.from=function(e,t){return L(U,e,t)};var Ze;function Qe(){return Ze===void 0&&(Ze={}),Ze}U.fromWeb=function(e,t){return Qe().newStreamReadableFromReadableStream(e,t)},U.toWeb=function(e,t){return Qe().newReadableStreamFromStreamReadable(e,t)},U.wrap=function(e,t){return new U({objectMode:e.readableObjectMode??e.objectMode??!0,...t,destroy(t,n){w.destroyer(e,t),n(t)}}).wrap(e)}})),ze=o(((e,t)=>{var n=Ae(),{ArrayPrototypeSlice:r,Error:i,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:o,ObjectDefineProperties:s,ObjectSetPrototypeOf:c,StringPrototypeToLowerCase:l,Symbol:u,SymbolHasInstance:d}=W();t.exports=P,P.WritableState=M;var{EventEmitter:p}=De(),m=q().Stream,{Buffer:h}=f(),g=K(),{addAbortSignal:_}=Me(),{getHighWaterMark:v,getDefaultHighWaterMark:y}=Pe(),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:x,ERR_MULTIPLE_CALLBACK:S,ERR_STREAM_CANNOT_PIPE:C,ERR_STREAM_DESTROYED:w,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:E,ERR_STREAM_WRITE_AFTER_END:D,ERR_UNKNOWN_ENCODING:O}=Te().codes,{errorOrDestroy:k}=g;c(P.prototype,m.prototype),c(P,m);function A(){}var j=u(`kOnFinished`);function M(e,t,n){typeof n!=`boolean`&&(n=t instanceof Ve()),this.objectMode=!!(e&&e.objectMode),n&&(this.objectMode=this.objectMode||!!(e&&e.writableObjectMode)),this.highWaterMark=e?v(this,e,`writableHighWaterMark`,n):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(e&&e.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=z.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,N(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||e.emitClose!==!1,this.autoDestroy=!e||e.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[j]=[]}function N(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}M.prototype.getBuffer=function(){return r(this.buffered,this.bufferedIndex)},o(M.prototype,`bufferedRequestCount`,{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function P(e){let t=this instanceof Ve();if(!t&&!a(P,this))return new P(e);this._writableState=new M(e,this,t),e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&_(e.signal,this)),m.call(this,e),g.construct(this,()=>{let e=this._writableState;e.writing||ne(this,e),ae(this,e)})}o(P,d,{__proto__:null,value:function(e){return a(this,e)?!0:this===P&&e&&e._writableState instanceof M}}),P.prototype.pipe=function(){k(this,new C)};function F(e,t,r,i){let a=e._writableState;if(typeof r==`function`)i=r,r=a.defaultEncoding;else{if(!r)r=a.defaultEncoding;else if(r!==`buffer`&&!h.isEncoding(r))throw new O(r);typeof i!=`function`&&(i=A)}if(t===null)throw new E;if(!a.objectMode)if(typeof t==`string`)a.decodeStrings!==!1&&(t=h.from(t,r),r=`buffer`);else if(t instanceof h)r=`buffer`;else if(m._isUint8Array(t))t=m._uint8ArrayToBuffer(t),r=`buffer`;else throw new b(`chunk`,[`string`,`Buffer`,`Uint8Array`],t);let o;return a.ending?o=new D:a.destroyed&&(o=new w(`write`)),o?(n.nextTick(i,o),k(e,o,!0),o):(a.pendingcb++,I(e,a,t,r,i))}P.prototype.write=function(e,t,n){return F(this,e,t,n)===!0},P.prototype.cork=function(){this._writableState.corked++},P.prototype.uncork=function(){let e=this._writableState;e.corked&&(e.corked--,e.writing||ne(this,e))},P.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=l(e)),!h.isEncoding(e))throw new O(e);return this._writableState.defaultEncoding=e,this};function I(e,t,n,r,i){let a=t.objectMode?1:n.length;t.length+=a;let o=t.length<t.highWaterMark;return o||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:r,callback:i}),t.allBuffers&&r!==`buffer`&&(t.allBuffers=!1),t.allNoop&&i!==A&&(t.allNoop=!1)):(t.writelen=a,t.writecb=i,t.writing=!0,t.sync=!0,e._write(n,r,t.onwrite),t.sync=!1),o&&!t.errored&&!t.destroyed}function L(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w(`write`)):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function R(e,t,n,r){--t.pendingcb,r(n),te(t),k(e,n)}function z(e,t){let r=e._writableState,i=r.sync,a=r.writecb;if(typeof a!=`function`){k(e,new S);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(t.stack,r.errored||=t,e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(R,e,r,t,a):R(e,r,t,a)):(r.buffered.length>r.bufferedIndex&&ne(e,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===a?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:a,stream:e,state:r},n.nextTick(B,r.afterWriteTickInfo)):ee(e,r,1,a))}function B({stream:e,state:t,count:n,cb:r}){return t.afterWriteTickInfo=null,ee(e,t,n,r)}function ee(e,t,n,r){for(!t.ending&&!e.destroyed&&t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`));n-->0;)t.pendingcb--,r();t.destroyed&&te(t),ae(e,t)}function te(e){if(e.writing)return;for(let t=e.bufferedIndex;t<e.buffered.length;++t){let{chunk:n,callback:r}=e.buffered[t],i=e.objectMode?1:n.length;e.length-=i,r(e.errored??new w(`write`))}let t=e[j].splice(0);for(let n=0;n<t.length;n++)t[n](e.errored??new w(`end`));N(e)}function ne(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;let{buffered:n,bufferedIndex:i,objectMode:a}=t,o=n.length-i;if(!o)return;let s=i;if(t.bufferProcessing=!0,o>1&&e._writev){t.pendingcb-=o-1;let i=t.allNoop?A:e=>{for(let t=s;t<n.length;++t)n[t].callback(e)},a=t.allNoop&&s===0?n:r(n,s);a.allBuffers=t.allBuffers,L(e,t,!0,t.length,a,``,i),N(t)}else{do{let{chunk:r,encoding:i,callback:o}=n[s];n[s++]=null,L(e,t,!1,a?1:r.length,r,i,o)}while(s<n.length&&!t.writing);s===n.length?N(t):s>256?(n.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}P.prototype._write=function(e,t,n){if(this._writev)this._writev([{chunk:e,encoding:t}],n);else throw new x(`_write()`)},P.prototype._writev=null,P.prototype.end=function(e,t,r){let a=this._writableState;typeof e==`function`?(r=e,e=null,t=null):typeof t==`function`&&(r=t,t=null);let o;if(e!=null){let n=F(this,e,t);n instanceof i&&(o=n)}return a.corked&&(a.corked=1,this.uncork()),o||(!a.errored&&!a.ending?(a.ending=!0,ae(this,a,!0),a.ended=!0):a.finished?o=new T(`end`):a.destroyed&&(o=new w(`end`))),typeof r==`function`&&(o||a.finished?n.nextTick(r,o):a[j].push(r)),this};function V(e){return e.ending&&!e.destroyed&&e.constructed&&e.length===0&&!e.errored&&e.buffered.length===0&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function re(e,t){let r=!1;function i(i){if(r){k(e,i??S());return}if(r=!0,t.pendingcb--,i){let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e](i);k(e,i,t.sync)}else V(t)&&(t.prefinished=!0,e.emit(`prefinish`),t.pendingcb++,n.nextTick(oe,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}function ie(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`&&!t.destroyed?(t.finalCalled=!0,re(e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function ae(e,t,r){V(t)&&(ie(e,t),t.pendingcb===0&&(r?(t.pendingcb++,n.nextTick((e,t)=>{V(t)?oe(e,t):t.pendingcb--},e,t)):V(t)&&(t.pendingcb++,oe(e,t))))}function oe(e,t){t.pendingcb--,t.finished=!0;let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit(`finish`),t.autoDestroy){let t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))&&e.destroy()}}s(P.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){let e=this._writableState;return!!e&&e.writable!==!1&&!e.destroyed&&!e.errored&&!e.ending&&!e.ended},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let e=this._writableState;return e?!e.destroyed&&!e.ending&&e.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var se=g.destroy;P.prototype.destroy=function(e,t){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[j].length)&&n.nextTick(te,r),se.call(this,e,t),this},P.prototype._undestroy=g.undestroy,P.prototype._destroy=function(e,t){t(e)},P.prototype[p.captureRejectionSymbol]=function(e){this.destroy(e)};var ce;function le(){return ce===void 0&&(ce={}),ce}P.fromWeb=function(e,t){return le().newStreamWritableFromWritableStream(e,t)},P.toWeb=function(e){return le().newWritableStreamFromStreamWritable(e)}})),Be=o(((e,t)=>{var n=Ae(),r=f(),{isReadable:i,isWritable:a,isIterable:o,isNodeStream:s,isReadableNodeStream:c,isWritableNodeStream:l,isDuplexNodeStream:u,isReadableStream:d,isWritableStream:p}=G(),m=je(),{AbortError:h,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:_}}=Te(),{destroyer:v}=K(),y=Ve(),b=Re(),x=ze(),{createDeferredPromise:S}=Oe(),C=Le(),w=globalThis.Blob||r.Blob,T=w===void 0?function(e){return!1}:function(e){return e instanceof w},E=globalThis.AbortController||Ee().AbortController,{FunctionPrototypeCall:D}=W(),O=class extends y{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};t.exports=function e(t,r){if(u(t))return t;if(c(t))return A({readable:t});if(l(t))return A({writable:t});if(s(t))return A({writable:!1,readable:!1});if(d(t))return A({readable:b.fromWeb(t)});if(p(t))return A({writable:x.fromWeb(t)});if(typeof t==`function`){let{value:e,write:i,final:a,destroy:s}=k(t);if(o(e))return C(O,e,{objectMode:!0,write:i,final:a,destroy:s});let c=e?.then;if(typeof c==`function`){let t,r=D(c,e,e=>{if(e!=null)throw new _(`nully`,`body`,e)},e=>{v(t,e)});return t=new O({objectMode:!0,readable:!1,write:i,final(e){a(async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}})},destroy:s})}throw new _(`Iterable, AsyncIterable or AsyncFunction`,r,e)}if(T(t))return e(t.arrayBuffer());if(o(t))return C(O,t,{objectMode:!0,writable:!1});if(d(t?.readable)&&p(t?.writable))return O.fromWeb(t);if(typeof t?.writable==`object`||typeof t?.readable==`object`)return A({readable:t!=null&&t.readable?c(t?.readable)?t?.readable:e(t.readable):void 0,writable:t!=null&&t.writable?l(t?.writable)?t?.writable:e(t.writable):void 0});let i=t?.then;if(typeof i==`function`){let e;return D(i,t,t=>{t!=null&&e.push(t),e.push(null)},t=>{v(e,t)}),e=new O({objectMode:!0,writable:!1,read(){}})}throw new g(r,[`Blob`,`ReadableStream`,`WritableStream`,`Stream`,`Iterable`,`AsyncIterable`,`Function`,`{ readable, writable } pair`,`Promise`],t)};function k(e){let{promise:t,resolve:r}=S(),i=new E,a=i.signal;return{value:e((async function*(){for(;;){let e=t;t=null;let{chunk:i,done:o,cb:s}=await e;if(n.nextTick(s),o)return;if(a.aborted)throw new h(void 0,{cause:a.reason});({promise:t,resolve:r}=S()),yield i}})(),{signal:a}),write(e,t,n){let i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){let t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}function A(e){let t=e.readable&&typeof e.readable.read!=`function`?b.wrap(e.readable):e.readable,n=e.writable,r=!!i(t),o=!!a(n),s,c,l,u,d;function f(e){let t=u;u=null,t?t(e):e&&d.destroy(e)}return d=new O({readableObjectMode:!!(t!=null&&t.readableObjectMode),writableObjectMode:!!(n!=null&&n.writableObjectMode),readable:r,writable:o}),o&&(m(n,e=>{o=!1,e&&v(t,e),f(e)}),d._write=function(e,t,r){n.write(e,t)?r():s=r},d._final=function(e){n.end(),c=e},n.on(`drain`,function(){if(s){let e=s;s=null,e()}}),n.on(`finish`,function(){if(c){let e=c;c=null,e()}})),r&&(m(t,e=>{r=!1,e&&v(t,e),f(e)}),t.on(`readable`,function(){if(l){let e=l;l=null,e()}}),t.on(`end`,function(){d.push(null)}),d._read=function(){for(;;){let e=t.read();if(e===null){l=d._read;return}if(!d.push(e))return}}),d._destroy=function(e,r){!e&&u!==null&&(e=new h),l=null,s=null,c=null,u===null?r(e):(u=r,v(n,e),v(t,e))},d}})),Ve=o(((e,t)=>{var{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:i,ObjectSetPrototypeOf:a}=W();t.exports=c;var o=Re(),s=ze();a(c.prototype,o.prototype),a(c,o);{let e=i(s.prototype);for(let t=0;t<e.length;t++){let n=e[t];c.prototype[n]||(c.prototype[n]=s.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),s.call(this,e),e?(this.allowHalfOpen=e.allowHalfOpen!==!1,e.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(c.prototype,{writable:{__proto__:null,...r(s.prototype,`writable`)},writableHighWaterMark:{__proto__:null,...r(s.prototype,`writableHighWaterMark`)},writableObjectMode:{__proto__:null,...r(s.prototype,`writableObjectMode`)},writableBuffer:{__proto__:null,...r(s.prototype,`writableBuffer`)},writableLength:{__proto__:null,...r(s.prototype,`writableLength`)},writableFinished:{__proto__:null,...r(s.prototype,`writableFinished`)},writableCorked:{__proto__:null,...r(s.prototype,`writableCorked`)},writableEnded:{__proto__:null,...r(s.prototype,`writableEnded`)},writableNeedDrain:{__proto__:null,...r(s.prototype,`writableNeedDrain`)},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}});var l;function u(){return l===void 0&&(l={}),l}c.fromWeb=function(e,t){return u().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return u().newReadableWritablePairFromDuplex(e)};var d;c.from=function(e){return d||=Be(),d(e,`body`)}})),He=o(((e,t)=>{var{ObjectSetPrototypeOf:n,Symbol:r}=W();t.exports=c;var{ERR_METHOD_NOT_IMPLEMENTED:i}=Te().codes,a=Ve(),{getHighWaterMark:o}=Pe();n(c.prototype,a.prototype),n(c,a);var s=r(`kCallback`);function c(e){if(!(this instanceof c))return new c(e);let t=e?o(this,e,`readableHighWaterMark`,!0):null;t===0&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[s]=null,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,u)}function l(e){typeof this._flush==`function`&&!this.destroyed?this._flush((t,n)=>{if(t){e?e(t):this.destroy(t);return}n!=null&&this.push(n),this.push(null),e&&e()}):(this.push(null),e&&e())}function u(){this._final!==l&&l.call(this)}c.prototype._final=l,c.prototype._transform=function(e,t,n){throw new i(`_transform()`)},c.prototype._write=function(e,t,n){let r=this._readableState,i=this._writableState,a=r.length;this._transform(e,t,(e,t)=>{if(e){n(e);return}t!=null&&this.push(t),i.ended||a===r.length||r.length<r.highWaterMark?n():this[s]=n})},c.prototype._read=function(){if(this[s]){let e=this[s];this[s]=null,e()}}})),Ue=o(((e,t)=>{var{ObjectSetPrototypeOf:n}=W();t.exports=i;var r=He();n(i.prototype,r.prototype),n(i,r);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),We=o(((e,t)=>{var n=Ae(),{ArrayIsArray:r,Promise:i,SymbolAsyncIterator:a,SymbolDispose:o}=W(),s=je(),{once:c}=Oe(),l=K(),u=Ve(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:h,ERR_STREAM_PREMATURE_CLOSE:g},AbortError:_}=Te(),{validateFunction:v,validateAbortSignal:y}=ke(),{isIterable:b,isReadable:x,isReadableNodeStream:S,isNodeStream:C,isTransformStream:w,isWebStream:T,isReadableStream:E,isReadableFinished:D}=G(),O=globalThis.AbortController||Ee().AbortController,k,A,j;function M(e,t,n){let r=!1;return e.on(`close`,()=>{r=!0}),{destroy:t=>{r||(r=!0,l.destroyer(e,t||new h(`pipe`)))},cleanup:s(e,{readable:t,writable:n},e=>{r=!e})}}function N(e){return v(e[e.length-1],`streams[stream.length - 1]`),e.pop()}function P(e){if(b(e))return e;if(S(e))return F(e);throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`],e)}async function*F(e){A||=Re(),yield*A.prototype[a].call(e)}async function I(e,t,n,{end:r}){let a,o=null,c=e=>{if(e&&(a=e),o){let e=o;o=null,e()}},l=()=>new i((e,t)=>{a?t(a):o=()=>{a?t(a):e()}});t.on(`drain`,c);let u=s(t,{readable:!1},c);try{t.writableNeedDrain&&await l();for await(let n of e)t.write(n)||await l();r&&(t.end(),await l()),n()}catch(e){n(a===e?e:d(a,e))}finally{u(),t.off(`drain`,c)}}async function L(e,t,n,{end:r}){w(t)&&(t=t.writable);let i=t.getWriter();try{for await(let t of e)await i.ready,i.write(t).catch(()=>{});await i.ready,r&&await i.close(),n()}catch(e){try{await i.abort(e),n(e)}catch(e){n(e)}}}function R(...e){return z(e,c(N(e)))}function z(e,t,i){if(e.length===1&&r(e[0])&&(e=e[0]),e.length<2)throw new m(`streams`);let a=new O,s=a.signal,c=i?.signal,l=[];y(c,`options.signal`);function d(){F(new _)}j||=Oe().addAbortListener;let h;c&&(h=j(c,d));let g,v,D=[],A=0;function N(e){F(e,--A===0)}function F(e,r){var i;if(e&&(!g||g.code===`ERR_STREAM_PREMATURE_CLOSE`)&&(g=e),!(!g&&!r)){for(;D.length;)D.shift()(g);(i=h)==null||i[o](),a.abort(),r&&(g||l.forEach(e=>e()),n.nextTick(t,g,v))}}let R;for(let t=0;t<e.length;t++){let r=e[t],a=t<e.length-1,o=t>0,c=a||i?.end!==!1,d=t===e.length-1;if(C(r)){if(c){let{destroy:e,cleanup:t}=M(r,a,o);D.push(e),x(r)&&d&&l.push(t)}function e(e){e&&e.name!==`AbortError`&&e.code!==`ERR_STREAM_PREMATURE_CLOSE`&&N(e)}r.on(`error`,e),x(r)&&d&&l.push(()=>{r.removeListener(`error`,e)})}if(t===0)if(typeof r==`function`){if(R=r({signal:s}),!b(R))throw new p(`Iterable, AsyncIterable or Stream`,`source`,R)}else R=b(r)||S(r)||w(r)?r:u.from(r);else if(typeof r==`function`)if(R=w(R)?P(R?.readable):P(R),R=r(R,{signal:s}),a){if(!b(R,!0))throw new p(`AsyncIterable`,`transform[${t-1}]`,R)}else{k||=Ue();let e=new k({objectMode:!0}),t=R?.then;if(typeof t==`function`)A++,t.call(R,t=>{v=t,t!=null&&e.write(t),c&&e.end(),n.nextTick(N)},t=>{e.destroy(t),n.nextTick(N,t)});else if(b(R,!0))A++,I(R,e,N,{end:c});else if(E(R)||w(R)){let t=R.readable||R;A++,I(t,e,N,{end:c})}else throw new p(`AsyncIterable or Promise`,`destination`,R);R=e;let{destroy:r,cleanup:i}=M(R,!1,!0);D.push(r),d&&l.push(i)}else if(C(r)){if(S(R)){A+=2;let e=B(R,r,N,{end:c});x(r)&&d&&l.push(e)}else if(w(R)||E(R)){let e=R.readable||R;A++,I(e,r,N,{end:c})}else if(b(R))A++,I(R,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],R);R=r}else if(T(r)){if(S(R))A++,L(P(R),r,N,{end:c});else if(E(R)||b(R))A++,L(R,r,N,{end:c});else if(w(R))A++,L(R.readable,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],R);R=r}else R=u.from(r)}return(s!=null&&s.aborted||c!=null&&c.aborted)&&n.nextTick(d),R}function B(e,t,r,{end:i}){let a=!1;if(t.on(`close`,()=>{a||r(new g)}),e.pipe(t,{end:!1}),i){function r(){a=!0,t.end()}D(e)?n.nextTick(r):e.once(`end`,r)}else r();return s(e,{readable:!0,writable:!1},t=>{let n=e._readableState;t&&t.code===`ERR_STREAM_PREMATURE_CLOSE`&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once(`end`,r).once(`error`,r):r(t)}),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:z,pipeline:R}})),Ge=o(((e,t)=>{var{pipeline:n}=We(),r=Ve(),{destroyer:i}=K(),{isNodeStream:a,isReadable:o,isWritable:s,isWebStream:c,isTransformStream:l,isWritableStream:u,isReadableStream:d}=G(),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=Te(),h=je();t.exports=function(...e){if(e.length===0)throw new m(`streams`);if(e.length===1)return r.from(e[0]);let t=[...e];if(typeof e[0]==`function`&&(e[0]=r.from(e[0])),typeof e[e.length-1]==`function`){let t=e.length-1;e[t]=r.from(e[t])}for(let n=0;n<e.length;++n)if(!(!a(e[n])&&!c(e[n]))){if(n<e.length-1&&!(o(e[n])||d(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be readable`);if(n>0&&!(s(e[n])||u(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be writable`)}let g,_,v,y,b;function x(e){let t=y;y=null,t?t(e):e?b.destroy(e):!T&&!w&&b.destroy()}let S=e[0],C=n(e,x),w=!!(s(S)||u(S)||l(S)),T=!!(o(C)||d(C)||l(C));if(b=new r({writableObjectMode:!!(S!=null&&S.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:w,readable:T}),w){if(a(S))b._write=function(e,t,n){S.write(e,t)?n():g=n},b._final=function(e){S.end(),_=e},S.on(`drain`,function(){if(g){let e=g;g=null,e()}});else if(c(S)){let e=(l(S)?S.writable:S).getWriter();b._write=async function(t,n,r){try{await e.ready,e.write(t).catch(()=>{}),r()}catch(e){r(e)}},b._final=async function(t){try{await e.ready,e.close().catch(()=>{}),_=t}catch(e){t(e)}}}h(l(C)?C.readable:C,()=>{if(_){let e=_;_=null,e()}})}if(T){if(a(C))C.on(`readable`,function(){if(v){let e=v;v=null,e()}}),C.on(`end`,function(){b.push(null)}),b._read=function(){for(;;){let e=C.read();if(e===null){v=b._read;return}if(!b.push(e))return}};else if(c(C)){let e=(l(C)?C.readable:C).getReader();b._read=async function(){for(;;)try{let{value:t,done:n}=await e.read();if(!b.push(t))return;if(n){b.push(null);return}}catch{return}}}}return b._destroy=function(e,t){!e&&y!==null&&(e=new f),v=null,g=null,_=null,y===null?t(e):(y=t,a(C)&&i(C,e))},b}})),Ke=o(((e,t)=>{var n=globalThis.AbortController||Ee().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:i,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:o},AbortError:s}=Te(),{validateAbortSignal:c,validateInteger:l,validateObject:u}=ke(),d=W().Symbol(`kWeak`),f=W().Symbol(`kResistStopPropagation`),{finished:p}=je(),m=Ge(),{addAbortSignalNoValidate:h}=Me(),{isWritable:g,isNodeStream:_}=G(),{deprecate:v}=Oe(),{ArrayPrototypePush:y,Boolean:b,MathFloor:x,Number:S,NumberIsNaN:C,Promise:w,PromiseReject:T,PromiseResolve:E,PromisePrototypeThen:D,Symbol:O}=W(),k=O(`kEmpty`),A=O(`kEof`);function j(e,t){if(t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),_(e)&&!g(e))throw new r(`stream`,e,`must be writable`);let n=m(this,e);return t!=null&&t.signal&&h(t.signal,n),n}function M(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`);let n=1;t?.concurrency!=null&&(n=x(t.concurrency));let r=n-1;return t?.highWaterMark!=null&&(r=x(t.highWaterMark)),l(n,`options.concurrency`,1),l(r,`options.highWaterMark`,0),r+=n,async function*(){let i=Oe().AbortSignalAny([t?.signal].filter(b)),a=this,o=[],c={signal:i},l,u,d=!1,f=0;function p(){d=!0,m()}function m(){--f,h()}function h(){u&&!d&&f<n&&o.length<r&&(u(),u=null)}async function g(){try{for await(let t of a){if(d)return;if(i.aborted)throw new s;try{if(t=e(t,c),t===k)continue;t=E(t)}catch(e){t=T(e)}f+=1,D(t,m,p),o.push(t),l&&=(l(),null),!d&&(o.length>=r||f>=n)&&await new w(e=>{u=e})}o.push(A)}catch(e){let t=T(e);D(t,m,p),o.push(t)}finally{d=!0,l&&=(l(),null)}}g();try{for(;;){for(;o.length>0;){let e=await o[0];if(e===A)return;if(i.aborted)throw new s;e!==k&&(yield e),o.shift(),h()}await new w(e=>{l=e})}}finally{d=!0,u&&=(u(),null)}}.call(this)}function N(e=void 0){return e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`),async function*(){let t=0;for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s({cause:e.signal.reason});yield[t++,r]}}.call(this)}async function P(e,t=void 0){for await(let n of R.call(this,e,t))return!0;return!1}async function F(e,t=void 0){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);return!await P.call(this,async(...t)=>!await e(...t),t)}async function I(e,t){for await(let n of R.call(this,e,t))return n}async function L(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n),k}for await(let e of M.call(this,n,t));}function R(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n)?t:k}return M.call(this,n,t)}var z=class extends a{constructor(){super(`reduce`),this.message=`Reduce of an empty stream requires an initial value`}};async function B(e,t,r){var a;if(typeof e!=`function`)throw new i(`reducer`,[`Function`,`AsyncFunction`],e);r!=null&&u(r,`options`),r?.signal!=null&&c(r.signal,`options.signal`);let o=arguments.length>1;if(r!=null&&(a=r.signal)!=null&&a.aborted){let e=new s(void 0,{cause:r.signal.reason});throw this.once(`error`,()=>{}),await p(this.destroy(e)),e}let l=new n,m=l.signal;if(r!=null&&r.signal){let e={once:!0,[d]:this,[f]:!0};r.signal.addEventListener(`abort`,()=>l.abort(),e)}let h=!1;try{for await(let n of this){var g;if(h=!0,r!=null&&(g=r.signal)!=null&&g.aborted)throw new s;o?t=await e(t,n,{signal:m}):(t=n,o=!0)}if(!h&&!o)throw new z}finally{l.abort()}return t}async function ee(e){e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`);let t=[];for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s(void 0,{cause:e.signal.reason});y(t,r)}return t}function te(e,t){let n=M.call(this,e,t);return async function*(){for await(let e of n)yield*e}.call(this)}function ne(e){if(e=S(e),C(e))return 0;if(e<0)throw new o(`number`,`>= 0`,e);return e}function V(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;e--<=0&&(yield n)}}.call(this)}function re(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;if(e-->0&&(yield n),e<=0)return}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:v(N,`readable.asIndexedPairs will be removed in a future version.`),drop:V,filter:R,flatMap:te,map:M,take:re,compose:j},t.exports.promiseReturningOperators={every:F,forEach:L,reduce:B,toArray:ee,some:P,find:I}})),qe=o(((e,t)=>{var{ArrayPrototypePop:n,Promise:r}=W(),{isIterable:i,isNodeStream:a,isWebStream:o}=G(),{pipelineImpl:s}=We(),{finished:c}=je();Je();function l(...e){return new r((t,r)=>{let c,l,u=e[e.length-1];if(u&&typeof u==`object`&&!a(u)&&!i(u)&&!o(u)){let t=n(e);c=t.signal,l=t.end}s(e,(e,n)=>{e?r(e):t(n)},{signal:c,end:l})})}t.exports={finished:c,pipeline:l}})),Je=o(((e,t)=>{var{Buffer:n}=f(),{ObjectDefineProperty:r,ObjectKeys:i,ReflectApply:a}=W(),{promisify:{custom:o}}=Oe(),{streamReturningOperators:s,promiseReturningOperators:c}=Ke(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:l}}=Te(),u=Ge(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:p}=Pe(),{pipeline:m}=We(),{destroyer:h}=K(),g=je(),_=qe(),v=G(),y=t.exports=q().Stream;y.isDestroyed=v.isDestroyed,y.isDisturbed=v.isDisturbed,y.isErrored=v.isErrored,y.isReadable=v.isReadable,y.isWritable=v.isWritable,y.Readable=Re();for(let e of i(s)){let t=s[e];function n(...e){if(new.target)throw l();return y.Readable.from(a(t,this,e))}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}for(let e of i(c)){let t=c[e];function n(...e){if(new.target)throw l();return a(t,this,e)}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}y.Writable=ze(),y.Duplex=Ve(),y.Transform=He(),y.PassThrough=Ue(),y.pipeline=m;var{addAbortSignal:b}=Me();y.addAbortSignal=b,y.finished=g,y.destroy=h,y.compose=u,y.setDefaultHighWaterMark=d,y.getDefaultHighWaterMark=p,r(y,`promises`,{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),r(m,o,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),r(g,o,{__proto__:null,enumerable:!0,get(){return _.finished}}),y.Stream=y,y._isUint8Array=function(e){return e instanceof Uint8Array},y._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}})),Ye=o(((e,t)=>{var n=Je(),r=qe(),i=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=i,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get(){return r}}),t.exports.Stream=n.Stream,t.exports.default=t.exports})),Xe=Ye(),Ze=Symbol(`iter`);function Qe(e,t,n=4){if(n===0)return Object.assign(e,t);for(let r in t)e[r]=Qe(e[r]||Object.create(null),t[r],n-1);return e}function $e(e,t,n=4){let r=!1;for(let i in e)if(i in t){let a=n===0?null:$e(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}function et(e,t,n=4){let r=!1;for(let i in e)if(!(i in t))r||=Object.create(null),r[i]=n===0?null:Qe({},e[i],n-1);else if(n!==0){let a=et(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}var tt=class{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[``]=1,this._entities=Object.create(null),this._entities[1]=``,this._blankNodeIndex=0,this._factory=e.factory||k}_termFromId(e){if(e[0]===`.`){let t=this._entities,n=e.split(`.`);return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return F(e,this._factory)}_termToNumericId(e){if(e.termType===`Quad`){let t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),r=this._termToNumericId(e.object),i;return t&&n&&r&&(ce(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${n}.${r}.${i}`:`.${t}.${n}.${r}`]}return this._ids[I(e)]}_termToNewNumericId(e){let t=e&&e.termType===`Quad`?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ce(e.graph)?``:`.${this._termToNewNumericId(e.graph)}`}`:I(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+n++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}},nt=class e{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!=`function`&&(t=e,e=null),t||={},this._factory=t.factory||k,this._entityIndex=t.entityIndex||new tt({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;let t=this._graphs,n,r;for(let i in t)for(let a in n=t[i].subjects)for(let t in r=n[a])e+=Object.keys(r[t]).length;return this._size=e}_addToIndex(e,t,n,r){let i=e[t]||(e[t]={}),a=i[n]||(i[n]={}),o=r in a;return o||(a[r]=null),!o}_removeFromIndex(e,t,n,r){let i=e[t],a=i[n];delete a[r];for(let e in a)return;delete i[n];for(let e in i)return;delete e[t]}*_findInIndex(e,t,n,r,i,a,o,s){let c,l,u,d=this._entities,f=this._termFromId(d[s]),p={subject:null,predicate:null,object:null};t&&((c=e,e={})[t]=c[t]);for(let t in e)if(l=e[t]){p[i]=this._termFromId(d[t]),n&&((c=l,l={})[n]=c[n]);for(let e in l)if(u=l[e]){p[a]=this._termFromId(d[e]);let t=r?r in u?[r]:[]:Object.keys(u);for(let e=0;e<t.length;e++)p[o]=this._termFromId(d[t[e]]),yield this._factory.quad(p.subject,p.predicate,p.object,f)}}}_loop(e,t){for(let n in e)t(n)}_loopByKey0(e,t,n){let r,i;if(r=e[t])for(i in r)n(i)}_loopByKey1(e,t,n){let r,i;for(r in e)i=e[r],i[t]&&n(r)}_loopBy2Keys(e,t,n,r){let i,a,o;if((i=e[t])&&(a=i[n]))for(o in a)r(o)}_countInIndex(e,t,n,r){let i=0,a,o,s;t&&((a=e,e={})[t]=a[t]);for(let t in e)if(o=e[t]){n&&((a=o,o={})[n]=a[n]);for(let e in o)(s=o[e])&&(r?r in s&&i++:i+=Object.keys(s).length)}return i}_getGraphs(e){return e=e===``?1:e&&(this._termToNumericId(e)||-1),typeof e==`number`?{[e]:this._graphs[e]}:this._graphs}_uniqueEntities(e){let t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,r){t||(r=e.graph,n=e.object,t=e.predicate,e=e.subject),r=r?this._termToNewNumericId(r):1;let i=this._graphs[r];return i||(i=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(i)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(i.subjects,e,t,n)?(this._addToIndex(i.predicates,t,n,e),this._addToIndex(i.objects,n,e,t),this._size=null,!0):!1}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,n,r){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:r}=e),!this.readQuads(e,t,n,r).next().done}import(e){return e.on(`data`,e=>{this.addQuad(e)}),e}removeQuad(e,t,n,r){t||({subject:e,predicate:t,object:n,graph:r}=e),r=r?this._termToNumericId(r):1;let i=this._graphs,a,o,s;if(!(e&&=this._termToNumericId(e))||!(t&&=this._termToNumericId(t))||!(n&&=this._termToNumericId(n))||!(a=i[r])||!(o=a.subjects[e])||!(s=o[t])||!(n in s))return!1;for(e in this._removeFromIndex(a.subjects,e,t,n),this._removeFromIndex(a.predicates,t,n,e),this._removeFromIndex(a.objects,n,e,t),this._size!==null&&this._size--,a.subjects)return!0;return delete i[r],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on(`data`,e=>{this.removeQuad(e)}),e}removeMatches(e,t,n,r){let i=new Xe.Readable({objectMode:!0}),a=this.readQuads(e,t,n,r);return i._read=e=>{for(;--e>=0;){let{done:e,value:t}=a.next();if(e){i.push(null);return}i.push(t)}},this.remove(i)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,r){return[...this.readQuads(e,t,n,r)]}*readQuads(e,t,n,r){let i=this._getGraphs(r),a,o,s,c;if(!(e&&!(o=this._termToNumericId(e))||t&&!(s=this._termToNumericId(t))||n&&!(c=this._termToNumericId(n))))for(let e in i)(a=i[e])&&(o?c?yield*this._findInIndex(a.objects,c,o,s,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,o,s,null,`subject`,`predicate`,`object`,e):s?yield*this._findInIndex(a.predicates,s,c,null,`predicate`,`object`,`subject`,e):c?yield*this._findInIndex(a.objects,c,null,null,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,null,null,null,`subject`,`predicate`,`object`,e))}match(e,t,n,r){return new it(this,e,t,n,r,{entityIndex:this._entityIndex})}countQuads(e,t,n,r){let i=this._getGraphs(r),a=0,o,s,c,l;if(e&&!(s=this._termToNumericId(e))||t&&!(c=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n)))return 0;for(let r in i)(o=i[r])&&(e?n?a+=this._countInIndex(o.objects,l,s,c):a+=this._countInIndex(o.subjects,s,c,l):t?a+=this._countInIndex(o.predicates,c,l,s):a+=this._countInIndex(o.objects,l,s,c));return a}forEach(e,t,n,r,i){this.some(t=>(e(t,this),!1),t,n,r,i)}every(e,t,n,r,i){return!this.some(t=>!e(t,this),t,n,r,i)}some(e,t,n,r,i){for(let a of this.readQuads(t,n,r,i))if(e(a,this))return!0;return!1}getSubjects(e,t,n){let r=[];return this.forSubjects(e=>{r.push(e)},e,t,n),r}forSubjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.predicates,o,s,e):this._loopByKey1(a.subjects,o,e):s?this._loopByKey0(a.objects,s,e):this._loop(a.subjects,e))}getPredicates(e,t,n){let r=[];return this.forPredicates(e=>{r.push(e)},e,t,n),r}forPredicates(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.objects,s,o,e):this._loopByKey0(a.subjects,o,e):s?this._loopByKey1(a.predicates,s,e):this._loop(a.predicates,e))}getObjects(e,t,n){let r=[];return this.forObjects(e=>{r.push(e)},e,t,n),r}forObjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.subjects,o,s,e):this._loopByKey1(a.objects,o,e):s?this._loopByKey0(a.predicates,s,e):this._loop(a.objects,e))}getGraphs(e,t,n){let r=[];return this.forGraphs(e=>{r.push(e)},e,t,n),r}forGraphs(e,t,n,r){for(let i in this._graphs)this.some(t=>(e(t.graph),!0),t,n,r,this._termFromId(this._entities[i]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){let n={},r=t?(()=>!0):((e,t)=>{throw Error(`${e.value} ${t}`)}),i=this.getQuads(null,g.rdf.rest,g.rdf.nil,null),a=e?[...i]:[];return i.forEach(t=>{let i=[],o=!1,s,c,l=t.graph,u=t.subject;for(;u&&!o;){let e=this.getQuads(null,null,u,null),t=this.getQuads(u,null,null,null),n,d=null,f=null,p=null;for(let i=0;i<t.length&&!o;i++)n=t[i],n.graph.equals(l)?s?o=r(u,`has non-list arcs out`):n.predicate.value===g.rdf.first?d?o=r(u,`has multiple rdf:first arcs`):a.push(d=n):n.predicate.value===g.rdf.rest?f?o=r(u,`has multiple rdf:rest arcs`):a.push(f=n):e.length?o=r(u,`can't be subject and object`):(s=n,c=`subject`):o=r(u,`not confined to single graph`);for(let t=0;t<e.length&&!o;++t)n=e[t],s?o=r(u,`can't have coreferences`):n.predicate.value===g.rdf.rest?p?o=r(u,`has incoming rdf:rest arcs`):p=n:(s=n,c=`object`);d?i.unshift(d.object):o=r(u,`has no list head`),u=p&&p.subject}o?e=!1:s&&(n[s[c].value]=i)}),e&&this.removeQuads(a),n}addAll(t){if(t instanceof it&&(t=t.filtered),Array.isArray(t))this.addQuads(t);else if(t instanceof e&&t._entityIndex===this._entityIndex)t._size!==0&&(this._graphs=Qe(this._graphs,t._graphs),this._size=null);else for(let e of t)this.add(e);return this}contains(t){if(t instanceof it&&(t=t.filtered),t===this)return!0;if(!(t instanceof e)||this._entityIndex!==t._entityIndex)return t.every(e=>this.has(e));let n=this._graphs,r=t._graphs,i,a,o,s,c;for(let e in r){if(!(i=n[e]))return!1;i=i.subjects;for(let t in a=r[e].subjects){if(!(o=i[t]))return!1;for(let e in s=a[t]){if(!(c=o[e]))return!1;for(let t in s[e])if(!(t in c))return!1}}}return!0}deleteMatches(e,t,n,r){for(let i of this.match(e,t,n,r))this.removeQuad(i);return this}difference(t){if(t&&t instanceof it&&(t=t.filtered),t===this)return new e({entityIndex:this._entityIndex});if(t instanceof e&&t._entityIndex===this._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=et(this._graphs,t._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>!t.has(e))}equals(e){return e instanceof it&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)t(e,this)&&n.add(e);return n}intersection(t){if(t instanceof it&&(t=t.filtered),t===this){let t=new e({entityIndex:this._entityIndex});return t._graphs=Qe(Object.create(null),this._graphs),t._size=this._size,t}else if(t instanceof e&&this._entityIndex===t._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=$e(t._graphs,this._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>t.has(e))}map(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)n.add(t(e,this));return n}reduce(e,t){let n=this.readQuads(),r=t===void 0?n.next().value:t;for(let t of n)r=e(r,t,this);return r}toArray(){return this.getQuads()}toCanonical(){throw Error(`not implemented`)}toStream(){return this.match()}toString(){return new Se().quadsToString(this)}union(t){let n=new e({entityIndex:this._entityIndex});return n._graphs=Qe(Object.create(null),this._graphs),n._size=this._size,n.addAll(t),n}*[Symbol.iterator](){yield*this.readQuads()}};function rt(e,t,n=0){let r=t[n];if(r&&!(r in e))return!1;let i=!1;for(let a in r?{[r]:e[r]}:e){let r=n===2?null:rt(e[a],t,n+1);r!==!1&&(i||=Object.create(null),i[a]=r)}return i}var it=class e extends Xe.Readable{constructor(e,t,n,r,i,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:r,graph:i,options:a})}get filtered(){if(!this._filtered){let{n3Store:e,graph:t,object:n,predicate:r,subject:i}=this,a=this._filtered=new nt({factory:e._factory,entityIndex:this.options.entityIndex}),o,s,c;if(i&&!(o=a._termToNumericId(i))||r&&!(s=a._termToNumericId(r))||n&&!(c=a._termToNumericId(n)))return a;let l=e._getGraphs(t);for(let e in l){let t,n,r,i;(i=l[e])&&(!o&&s?(n=rt(i.predicates,[s,c,o]))&&(t=rt(i.subjects,[o,s,c]),r=rt(i.objects,[c,o,s])):c?(r=rt(i.objects,[c,o,s]))&&(t=rt(i.subjects,[o,s,c]),n=rt(i.predicates,[s,c,o])):(t=rt(i.subjects,[o,s,c]))&&(n=rt(i.predicates,[s,c,o]),r=rt(i.objects,[c,o,s])),t&&(a._graphs[e]={subjects:t,predicates:n,objects:r}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Ze]&&(this[Ze]=this[Symbol.iterator]());let t=this[Ze];for(;--e>=0;){let{done:e,value:n}=t.next();if(e){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,r){return this.filtered.deleteMatches(e,t,n,r)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,r,i){return this.filtered.every(e,t,n,r,i)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,r,i){return this.filtered.forEach(e,t,n,r,i)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,n,r,i){return this.filtered.some(e,t,n,r,i)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,t){return this.filtered.reduce(e,t)}toString(){return new Se().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(t,n,r,i){return new e(this.filtered,t,n,r,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}},at=class extends Xe.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let t=new ae(e),n,r,i={onQuad:(e,t)=>{e&&this.emit(`error`,e)||t&&this.push(t)},onPrefix:(e,t)=>{this.emit(`prefix`,e,t)}};e&&e.comments&&(i.onComment=e=>{this.emit(`comment`,e)}),t.parse({on:(e,t)=>{switch(e){case`data`:n=t;break;case`end`:r=t;break}}},i),this._transform=(e,t,r)=>{n(e),r()},this._flush=e=>{r(),e()}}import(e){return e.on(`data`,e=>{this.write(e)}),e.on(`end`,()=>{this.end()}),e.on(`error`,e=>{this.emit(`error`,e)}),this}},J=`http://www.w3.org/ns/shacl#`,ot=`http://datashapes.org/dash#`,st=`http://www.w3.org/2001/XMLSchema#`,ct=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,lt=`http://www.w3.org/2000/01/rdf-schema#`,ut=`http://www.w3.org/ns/oa#`,dt=`http://purl.org/dc/terms/`,ft=k.namedNode(`loaded-shapes`),pt=k.namedNode(`loaded-data`),mt=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`),ht=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`),gt=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`),_t=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#nil`),vt=k.namedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),yt=k.namedNode(`http://purl.org/dc/terms/conformsTo`),bt=k.namedNode(`http://www.w3.org/2000/01/rdf-schema#subClassOf`),xt=k.namedNode(`http://www.w3.org/2002/07/owl#imports`),St=k.namedNode(`http://www.w3.org/2004/02/skos/core#broader`),Ct=k.namedNode(`http://www.w3.org/2004/02/skos/core#narrower`),wt=k.namedNode(`http://www.w3.org/ns/shacl#NodeShape`),Tt=k.namedNode(`http://www.w3.org/ns/shacl#IRI`),Et=k.namedNode(`http://www.w3.org/ns/shacl#property`),Dt=k.namedNode(`http://www.w3.org/ns/shacl#class`),Ot=k.namedNode(`http://www.w3.org/ns/shacl#node`),kt=k.namedNode(`http://www.w3.org/ns/shacl#message`),At=k.namedNode(`http://www.w3.org/ns/shacl#targetClass`),jt=k.namedNode(`http://www.w3.org/ns/shacl#nodeKind`),Mt=k.namedNode(`http://www.w3.org/2001/XMLSchema#string`),Nt=k.namedNode(`http://www.w3.org/2001/XMLSchema#boolean`),Pt=new Set([`http://www.w3.org/2001/XMLSchema#integer`,`http://www.w3.org/2001/XMLSchema#int`,`http://www.w3.org/2001/XMLSchema#short`,`http://www.w3.org/2001/XMLSchema#byte`,`http://www.w3.org/2001/XMLSchema#unsignedInt`,`http://www.w3.org/2001/XMLSchema#unsignedShort`,`http://www.w3.org/2001/XMLSchema#unsignedByte`,`http://www.w3.org/2001/XMLSchema#long`,`http://www.w3.org/2001/XMLSchema#unsignedLong`,`http://www.w3.org/2001/XMLSchema#float`,`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`,`http://www.w3.org/2001/XMLSchema#date`,`http://www.w3.org/2001/XMLSchema#dateTime`]),Ft=new Set([`http://www.w3.org/2001/XMLSchema#integer`,`http://www.w3.org/2001/XMLSchema#int`,`http://www.w3.org/2001/XMLSchema#short`,`http://www.w3.org/2001/XMLSchema#byte`,`http://www.w3.org/2001/XMLSchema#unsignedInt`,`http://www.w3.org/2001/XMLSchema#unsignedShort`,`http://www.w3.org/2001/XMLSchema#unsignedByte`,`http://www.w3.org/2001/XMLSchema#long`,`http://www.w3.org/2001/XMLSchema#unsignedLong`,`http://www.w3.org/2001/XMLSchema#float`,`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`]),It=new Set([`http://www.w3.org/2001/XMLSchema#float`,`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`]);function Lt(e,t,n=J,r){let i=``,a=Rt(e,t,n,r);return a&&(i=a.value),i}function Rt(e,t,n=J,r){let i,a=n+t;if(r?.length){for(let t of r)for(let n of e)if(n.predicate.value===a){if(n.object.id.endsWith(`@${t}`))return n.object;n.object.id.indexOf(`@`)<0?i=n.object:i||=n.object}}else for(let t of e)if(t.predicate.value===a)return t.object;return i}function zt(e){e.querySelector(`.editor`)?.focus()}function Bt(e,t){return Lt(e,`prefLabel`,`http://www.w3.org/2004/02/skos/core#`,t)||Lt(e,`label`,`http://www.w3.org/2000/01/rdf-schema#`,t)||Lt(e,`title`,`http://purl.org/dc/terms/`,t)||Lt(e,`name`,`http://xmlns.com/foaf/0.1/`,t)}function Vt(e,t,n){let r=[];for(let i of e)r.push({value:i,label:Bt(t.getQuads(i,null,null,null),n),children:[]});return r}function Ht(e,t){for(let n in t){let r=t[n];e.startsWith(r)&&(e=e.slice(r.length))}return e}function Ut(e,t,n=new Map){n.set(ft.id,ft),n.set(pt.id,pt);let r=e.config.valuesGraphId??k.defaultGraph();n.set(r.id,r);for(let r of e.owlImports)Wt(r,t,n);return e.parent&&Ut(e.parent,t,n),[...n.values()]}function Wt(e,t,n){if(!n.has(e.id)){n.set(e.id,e);for(let r of t.getObjects(null,xt,e))r.termType===`NamedNode`&&Wt(r,t,n)}}function Gt(e,t,n,r){return r.flatMap(r=>e.getSubjects(t,n,r))}function Kt(e,t,n,r){return r.flatMap(r=>e.getObjects(t,n,r))}function qt(e,t){if(t.in){let e=t.config.lists[t.in];return Vt(e?.length?e:[],t.config.store,t.config.languages)}else{let n=Ut(t,t.config.store),r=Gt(t.config.store,mt,e,n),i=new Map,a=new Map;for(let e of r)i.set(e.id,{value:e,label:Bt(t.config.store.getQuads(e,null,null,null),t.config.languages),children:[]});for(let e of r){for(let r of Kt(t.config.store,e,St,n))i.has(r.id)&&a.set(e.id,r.id);for(let r of Kt(t.config.store,e,Ct,n))i.has(r.id)&&a.set(r.id,e.id);for(let r of Kt(t.config.store,e,bt,n))i.has(r.id)&&a.set(e.id,r.id)}for(let[e,t]of a.entries())i.get(t)?.children?.push(i.get(e));let o=[];for(let[e,t]of i.entries())a.has(e)||o.push(t);for(let r of Gt(t.config.store,bt,e,n))o.push(...qt(r,t));return o}}function Jt(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`}function Yt(e){let t=new Uint8Array(e),n=32768,r=``;for(let e=0;e<t.length;e+=n)r+=String.fromCharCode(...t.subarray(e,e+n));return btoa(r)}function Xt(e,t,n){if(t===void 0)return n;if(n===void 0)return t;let r=e.indexOf(t.language);if(r<0)return n;let i=e.indexOf(n.language);return i<0||i>r?t:n}function Zt(e,t){let n;for(let r of t)n=Xt(e,n,r);return n?n.value:``}var Qt=/^(-?\d{4,}-\d{2}-\d{2})(Z|[+-]\d{2}:\d{2})?$/,$t=/^(-?\d{4,}-\d{2}-\d{2})T(\d{2}:\d{2})(?::(\d{2})(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/,en=/^(-?\d{4,}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2})(\.\d+)?)?$/;function tn(e){let t=e.match(Qt);if(!t){let t=e.match($t);return t?{value:t[1],suffix:t[5]||``}:void 0}return{value:t[1],suffix:t[2]||``}}function nn(e){let t=e.match($t);if(!t){let t=e.match(Qt);return t?{value:`${t[1]}T00:00:00`,suffix:t[2]||``}:void 0}return{value:`${t[1]}T${t[2]}:${t[3]||`00`}`,suffix:t[5]||``}}function rn(e,t=``){let n=e.match(Qt);return n?`${n[1]}${t}`:e}function an(e,t=``){let n=e.match(en);return n?`${n[1]}:${n[2]||`00`}${n[3]||``}${t}`:e}function on(e){let t=new Set;for(let n of e.getObjects(null,Dt,ft))t.add(n.value);for(let n of e.getObjects(null,At,ft))t.add(n.value);return t}function sn(e,t){return e instanceof Set?[...t].filter(t=>!e.has(t)):[...t].filter(t=>!e.includes(t))}function cn(e,{remove:t=!1,ignoreErrors:n=!1}={}){let r={},i=n?()=>!0:(e,t)=>{throw Error(`${e.value} ${t}`)},a=e.getQuads(null,ct+`rest`,ct+`nil`,null),o=t?[...a]:[];return a.forEach(n=>{let a=[],s=!1,c,l,u=n.graph,d=n.subject;for(;d&&!s;){let t=e.getQuads(null,null,d,null),n=e.getQuads(d,null,null,null).filter(e=>!e.predicate.equals(mt)),r,f=null,p=null,m=null;for(let e=0;e<n.length&&!s;e++)r=n[e],r.graph.equals(u)?c?s=i(d,`has non-list arcs out`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`?f?s=i(d,`has multiple rdf:first arcs`):o.push(f=r):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?p?s=i(d,`has multiple rdf:rest arcs`):o.push(p=r):t.length?s=i(d,`can't be subject and object`):(c=r,l=`subject`):s=i(d,`not confined to single graph`);for(let e=0;e<t.length&&!s;++e)r=t[e],c?s=i(d,`can't have coreferences`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?m?s=i(d,`has incoming rdf:rest arcs`):m=r:(c=r,l=`object`);f?a.unshift(f.object):s=i(d,`has no list head`),d=m&&m.subject}s?t=!1:c&&(r[c[l].value]=a)}),t&&e.removeQuads(o),r}var ln=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.removeDotSegmentsOfPath=e.removeDotSegments=e.resolve=void 0;function t(e,t){t||=``;let i=t.indexOf(`#`);if(i>0&&(t=t.substr(0,i)),!e.length){if(t.indexOf(`:`)<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);return t}if(e.startsWith(`?`)){let n=t.indexOf(`?`);return n>0&&(t=t.substr(0,n)),t+e}if(e.startsWith(`#`))return t+e;if(!t.length){let t=e.indexOf(`:`);if(t<0)throw Error(`Found invalid relative IRI '${e}' for a missing baseIRI`);return r(e,t)}let a=e.indexOf(`:`);if(a>=0)return r(e,a);let o=t.indexOf(`:`);if(o<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);let s=t.substr(0,o+1);if(e.indexOf(`//`)===0)return s+r(e,a);let c;if(t.indexOf(`//`,o)===o+1){if(c=t.indexOf(`/`,o+3),c<0)return t.length>o+3?t+`/`+r(e,a):s+r(e,a)}else if(c=t.indexOf(`/`,o+1),c<0)return s+r(e,a);if(e.indexOf(`/`)===0)return t.substr(0,c)+n(e);let l=t.substr(c),u=l.lastIndexOf(`/`);return u>=0&&u<l.length-1&&(l=l.substr(0,u+1),e[0]===`.`&&e[1]!==`.`&&e[1]!==`/`&&e[2]&&(e=e.substr(1))),e=l+e,e=n(e),t.substr(0,c)+e}e.resolve=t;function n(e){let t=[],n=0;for(;n<e.length;)switch(e[n]){case`/`:if(e[n+1]===`.`)if(e[n+2]===`.`){if(!i(e[n+3])){t.push([]),n++;break}t.pop(),e[n+3]||t.push([]),n+=3}else{if(!i(e[n+2])){t.push([]),n++;break}e[n+2]||t.push([]),n+=2}else t.push([]),n++;break;case`#`:case`?`:t.length||t.push([]),t[t.length-1].push(e.substr(n)),n=e.length;break;default:t.length||t.push([]),t[t.length-1].push(e[n]),n++;break}return`/`+t.map(e=>e.join(``)).join(`/`)}e.removeDotSegments=n;function r(e,t){let r=t+1;t>=0?e[t+1]===`/`&&e[t+2]===`/`&&(r=t+3):e[0]===`/`&&e[1]===`/`&&(r=2);let i=e.indexOf(`/`,r);return i<0?e:e.substr(0,i)+n(e.substr(i))}e.removeDotSegmentsOfPath=r;function i(e){return!e||e===`#`||e===`?`||e===`/`}})),un=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(ln(),e)})),dn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CHAR=`
17
17
  \r -퟿-�𐀀-􏿿`,e.S=` \r
18
- `,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=i&&e<=55295||e===n||e===r||e===t||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e===i||e===n||e===r||e===t}e.isS=o;function s(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=s;function c(e){return s(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=c})),dn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CHAR=`-퟿-�𐀀-􏿿`,e.RESTRICTED_CHAR=`-\b\v\f--„†-Ÿ`,e.S=` \r
19
- `,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.RESTRICTED_CHAR_RE=RegExp(`^[`+e.RESTRICTED_CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}e.isRestrictedChar=o;function s(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isCharAndNotRestricted=s;function c(e){return e===i||e===n||e===r||e===t}e.isS=c;function l(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=l;function u(e){return l(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=u})),fn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NC_NAME_START_CHAR=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NC_NAME_CHAR=`-`+e.NC_NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.NC_NAME_START_CHAR_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`]$`,`u`),e.NC_NAME_CHAR_RE=RegExp(`^[`+e.NC_NAME_CHAR+`]$`,`u`),e.NC_NAME_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`][`+e.NC_NAME_CHAR+`]*$`,`u`);function t(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNCNameStartChar=t;function n(e){return t(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNCNameChar=n})),pn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SaxesParser=e.EVENTS=void 0;var t=un(),n=dn(),r=fn(),i=t.isS,a=t.isChar,o=t.isNameStartChar,s=t.isNameChar,c=t.S_LIST,l=t.NAME_RE,u=n.isChar,d=r.isNCNameStartChar,f=r.isNCNameChar,p=r.NC_NAME_RE,m=`http://www.w3.org/XML/1998/namespace`,h=`http://www.w3.org/2000/xmlns/`,g={__proto__:null,xml:m,xmlns:h},_={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},v=-1,y=-2,b=0,x=1,S=2,C=3,w=4,T=5,E=6,D=7,O=8,k=9,A=10,j=11,M=12,N=13,P=14,F=15,I=16,L=17,R=18,z=19,B=20,ee=21,te=22,ne=23,V=24,re=25,ie=26,ae=27,oe=28,se=29,ce=30,le=31,ue=32,de=33,fe=34,pe=35,me=36,he=37,ge=38,H=39,_e=40,U=41,ve=42,ye=43,be=44,xe=9,Se=10,Ce=13,W=32,we=33,Te=34,Ee=38,De=39,Oe=45,ke=47,Ae=59,G=60,je=61,K=62,q=63,Me=91,Ne=93,Pe=133,Fe=8232,Ie=e=>e===Te||e===De,Le=[Te,De],Re=[...Le,Me,K],ze=[...Le,G,Ne],Be=[je,q,...c],Ve=[...c,K,Ee,G];function He(e,t,n){switch(t){case`xml`:n!==m&&e.fail(`xml prefix must be bound to ${m}.`);break;case`xmlns`:n!==h&&e.fail(`xmlns prefix must be bound to ${h}.`);break;default:}switch(n){case h:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI \
20
- ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}break;default:}}function Ue(e,t){for(let n of Object.keys(t))He(e,n,t[n])}var We=e=>p.test(e),Ge=e=>l.test(e),Ke=0,qe=1,Je=2;e.EVENTS=[`xmldecl`,`text`,`processinginstruction`,`doctype`,`comment`,`opentagstart`,`attribute`,`opentag`,`closetag`,`cdata`,`error`,`end`,`ready`];var Ye={xmldecl:`xmldeclHandler`,text:`textHandler`,processinginstruction:`piHandler`,doctype:`doctypeHandler`,comment:`commentHandler`,opentagstart:`openTagStartHandler`,attribute:`attributeHandler`,opentag:`openTagHandler`,closetag:`closeTagHandler`,cdata:`cdataHandler`,error:`errorHandler`,end:`endHandler`,ready:`readyHandler`};e.SaxesParser=class{get closed(){return this._closed}constructor(e){this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,t){this.nameStartCheck=d,this.nameCheck=f,this.isName=We,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},g);let e=this.opt.additionalNamespaces;e!=null&&(Ue(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=o,this.nameCheck=s,this.isName=Ge,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var e;this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=Ke,this.attribList=[];let{fragmentOpt:t}=this;this.state=t?N:b,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=t,this.xmlDeclPossible=!t,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);n=`1.0`}this.setXMLVersion(n),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(_),(e=this.readyHandler)==null||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[Ye[e]]=t}off(e){this[Ye[e]]=void 0}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close; assign an onready handler.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===Ce||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>=W||n===xe)return n;switch(n){case Se:return this.line++,this.column=0,this.positionAtNewLine=this.position,Se;case Ce:return e.charCodeAt(t+1)===Se&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==Fe||n===xe)return n;switch(n){case Se:return this.line++,this.column=0,this.positionAtNewLine=this.position,Se;case Ce:{let n=e.charCodeAt(t+1);(n===Se||n===Pe)&&(this.i=t+2)}case Pe:case Fe:return this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===y?Se:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===y,a=i?Se:r;if(a===v||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case y:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=Se;break;case v:return this.text+=n.slice(t),!1;default:}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===v)return this.name+=e.slice(t),v;if(!s(n))return this.name+=e.slice(t,this.prevI),n===y?Se:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===v||!i(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=a,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=x}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case G:if(this.state=F,this.text.length!==0)throw Error(`no-empty text at start`);break;case v:break;default:this.unget(),this.state=N,this.xmlDeclPossible=!1}}sDoctype(){var e;let t=this.captureTo(Re);switch(t){case K:(e=this.doctypeHandler)==null||e.call(this,this.text),this.text=``,this.state=N,this.doctype=!0;break;case v:break;default:this.text+=String.fromCodePoint(t),t===Me?this.state=w:Ie(t)&&(this.state=C,this.q=t)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=S)}sDTD(){let e=this.captureTo(ze);e!==v&&(this.text+=String.fromCodePoint(e),e===Ne?this.state=S:e===G?this.state=E:Ie(e)&&(this.state=T,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=w,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case we:this.state=D,this.openWakaBang=``;break;case q:this.state=j;break;default:this.state=w}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?O:w,this.openWakaBang=``)}sDTDComment(){this.captureToChar(Oe)&&(this.text+=`-`,this.state=k)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===Oe?A:O}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===K?this.state=w:(this.fail(`malformed comment.`),this.state=O)}sDTDPI(){this.captureToChar(q)&&(this.text+=`?`,this.state=M)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===K&&(this.state=w)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;loop:for(;;)switch(this.getCode()){case y:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case Ae:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI);this.state=n;let i;r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),(n!==N||this.textHandler!==void 0)&&(this.text+=i);break loop}case v:this.entity+=t.slice(e);break loop;default:}}sOpenWaka(){let e=this.getCode();if(o(e))this.state=fe,this.unget(),this.xmlDeclPossible=!1;else switch(e){case ke:this.state=ye,this.xmlDeclPossible=!1;break;case we:this.state=I,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case q:this.state=ne;break;default:this.fail(`disallowed character in tag name`),this.state=N,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case`[CDATA[`:!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0),this.state=B,this.openWakaBang=``;break;case`--`:this.state=L,this.openWakaBang=``;break;case`DOCTYPE`:this.state=S,(this.doctype||this.sawRoot)&&this.fail(`inappropriately located doctype declaration.`),this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&this.fail(`incorrect syntax.`)}}sComment(){this.captureToChar(Oe)&&(this.state=R)}sCommentEnding(){var e;let t=this.getCodeNorm();t===Oe?(this.state=z,(e=this.commentHandler)==null||e.call(this,this.text),this.text=``):(this.text+=`-${String.fromCodePoint(t)}`,this.state=L)}sCommentEnded(){let e=this.getCodeNorm();e===K?this.state=N:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=L)}sCData(){this.captureToChar(Ne)&&(this.state=ee)}sCDataEnding(){let e=this.getCodeNorm();e===Ne?this.state=te:(this.text+=`]${String.fromCodePoint(e)}`,this.state=B)}sCDataEnding2(){var e;let t=this.getCodeNorm();switch(t){case K:(e=this.cdataHandler)==null||e.call(this,this.text),this.text=``,this.state=N;break;case Ne:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(t)}`,this.state=B}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=V):e===q||i(e)?(this.fail(`processing instruction without a target.`),this.state=e===q?ie:re):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=V)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===v){this.piTarget+=e.slice(t);return}if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===q;r||i(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?de:ae):this.state=r?ie:re:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===q?this.state=ie:i(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(q)&&(this.state=ie)}sPIEnding(){var e;let t=this.getCodeNorm();if(t===K){let{piTarget:t}=this;t.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),(e=this.piHandler)==null||e.call(this,{target:t,body:this.text}),this.piTarget=this.text=``,this.state=N}else t===q?this.text+=`?`:(this.text+=`?${String.fromCodePoint(t)}`,this.state=re);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();if(e===q){this.state=de;return}e!==v&&(this.state=oe,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(Be);if(e===q){this.state=de,this.name+=this.text,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(i(e)||e===je){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===je?ce:se}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===q){this.state=de,this.fail(`XML declaration is incomplete.`);return}i(e)||(e!==je&&this.fail(`value required.`),this.state=ce)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===q){this.state=de,this.fail(`XML declaration is incomplete.`);return}i(e)||(Ie(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=W),this.state=le)}sXMLDeclValue(){let e=this.captureTo([this.q,q]);if(e===q){this.state=de,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(e===v)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t;break;default:}this.name=``,this.state=ue}sXMLDeclSeparator(){let e=this.getCodeNorm();if(e===q){this.state=de;return}i(e)||(this.fail(`whitespace required.`),this.unget()),this.state=ae}sXMLDeclEnding(){var e;this.getCodeNorm()===K?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),(e=this.xmldeclHandler)==null||e.call(this,this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=N):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){var e;let t=this.captureNameChars();if(t===v)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(e=this.openTagStartHandler)==null||e.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),t){case K:this.openTag();break;case ke:this.state=pe;break;default:i(t)||this.fail(`disallowed character in tag name.`),this.state=me}}sOpenTagSlash(){this.getCode()===K?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=me)}sAttrib(){let e=this.skipSpaces();e!==v&&(o(e)?(this.unget(),this.state=he):e===K?this.openTag():e===ke?this.state=pe:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===je?this.state=H:i(e)?this.state=ge:e===K?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==v&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case v:return;case je:this.state=H;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===K?this.openTag():o(e)?(this.unget(),this.state=he):(this.fail(`disallowed character in attribute name.`),this.state=me)}}sAttribValue(){let e=this.getCodeNorm();Ie(e)?(this.q=e,this.state=_e):i(e)||(this.fail(`unquoted attribute value.`),this.state=ve,this.unget())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=U;return;case Ee:this.text+=t.slice(n,this.prevI),this.state=P,this.entityReturnState=_e;return;case Se:case y:case xe:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case G:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case v:this.text+=t.slice(n);return;default:}}sAttribValueClosed(){let e=this.getCodeNorm();i(e)?this.state=me:e===K?this.openTag():e===ke?this.state=pe:o(e)?(this.fail(`no whitespace between attributes.`),this.unget(),this.state=he):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(Ve);switch(e){case Ee:this.state=P,this.entityReturnState=ve;break;case G:this.fail(`disallowed character.`);break;case v:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===K?this.openTag():this.state=me}}sCloseTag(){let e=this.captureNameChars();e===K?this.closeTag():i(e)?this.state=be:e!==v&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case K:this.closeTag();break;case v:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;scanLoop:for(;;)switch(this.getCode()){case G:if(this.state=F,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=Ke;break scanLoop;case Ee:this.state=P,this.entityReturnState=N,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=Ke;break scanLoop;case Ne:switch(t){case Ke:t=qe;break;case qe:t=Je;break;case Je:break;default:throw Error(`impossible state`)}break;case K:t===Je&&this.fail(`the string "]]>" is disallowed in char data.`),t=Ke;break;case y:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=Ke;break;case v:r!==void 0&&(this.text+=n.slice(e));break scanLoop;default:t=Ke}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;outRootLoop:for(;;){let a=this.getCode();switch(a){case G:if(this.state=F,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break outRootLoop;case Ee:this.state=P,this.entityReturnState=N,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break outRootLoop;case y:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case v:n!==void 0&&(this.text+=t.slice(e));break outRootLoop;default:i(a)||(r=!0)}}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}pushAttribNS(e,t){var n;let{prefix:r,local:i}=this.qname(e),a={name:e,prefix:r,local:i,value:t};if(this.attribList.push(a),(n=this.attributeHandler)==null||n.call(this,a),r===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[i]=e,He(this,i,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,He(this,``,e)}}pushAttribPlain(e,t){var n;let r={name:e,value:t};this.attribList.push(r),(n=this.attributeHandler)==null||n.call(this,r)}end(){var e,t;this.sawRoot||this.fail(`document must contain a root element.`);let{tags:n}=this;for(;n.length>0;){let e=n.pop();this.fail(`unclosed tag: ${e.name}`)}this.state!==b&&this.state!==N&&this.fail(`unexpected end.`);let{text:r}=this;return r.length!==0&&((e=this.textHandler)==null||e.call(this,r),this.text=``),this._closed=!0,(t=this.endHandler)==null||t.call(this),this._init(),this}resolve(e){var t;let n=this.topNS[e];if(n!==void 0)return n;let{tags:r}=this;for(let t=r.length-1;t>=0;t--)if(n=r[t].ns[e],n!==void 0)return n;return n=this.ns[e],n===void 0?(t=this.opt).resolvePrefix?.call(t,e):n}qname(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qname(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?h:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){var e;this.processAttribs();let{tags:t}=this,n=this.tag;n.isSelfClosing=!1,(e=this.openTagHandler)==null||e.call(this,n),t.push(n),this.state=N,this.name=``}openSelfClosingTag(){var e,t;this.processAttribs();let{tags:n}=this,r=this.tag;r.isSelfClosing=!0,(e=this.openTagHandler)==null||e.call(this,r),(t=this.closeTagHandler)==null||t.call(this,r),(this.tag=n[n.length-1]??null)===null&&(this.closedRoot=!0),this.state=N,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=N,this.name=``,t===``){this.fail(`weird empty close tag.`),this.text+=`</>`;return}let n=this.closeTagHandler,r=e.length;for(;r-->0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}}})),mn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ParseError=void 0,e.ParseError=class extends Error{constructor(e,t){let n=e.saxParser;super(e.trackPosition?`Line ${n.line} column ${n.column+1}: ${t}`:t)}}})),hn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BlankNode=void 0,e.BlankNode=class{constructor(e){this.termType=`BlankNode`,this.value=e}equals(e){return!!e&&e.termType===`BlankNode`&&e.value===this.value}}})),gn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultGraph=void 0;var t=class{constructor(){this.termType=`DefaultGraph`,this.value=``}equals(e){return!!e&&e.termType===`DefaultGraph`}};e.DefaultGraph=t,t.INSTANCE=new t})),_n=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NamedNode=void 0,e.NamedNode=class{constructor(e){this.termType=`NamedNode`,this.value=e}equals(e){return!!e&&e.termType===`NamedNode`&&e.value===this.value}}})),vn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Literal=void 0;var t=_n(),n=class e{constructor(t,n){this.termType=`Literal`,this.value=t,typeof n==`string`?(this.language=n,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=``):n?`termType`in n?(this.language=``,this.datatype=n,this.direction=``):(this.language=n.language,this.datatype=n.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=n.direction||``):(this.language=``,this.datatype=e.XSD_STRING,this.direction=``)}equals(e){return!!e&&e.termType===`Literal`&&e.value===this.value&&e.language===this.language&&(e.direction===this.direction||!e.direction&&this.direction===``)&&this.datatype.equals(e.datatype)}};e.Literal=n,n.RDF_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),n.RDF_DIRECTIONAL_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`),n.XSD_STRING=new t.NamedNode(`http://www.w3.org/2001/XMLSchema#string`)})),yn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Quad=void 0,e.Quad=class{constructor(e,t,n,r){this.termType=`Quad`,this.value=``,this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&(e.termType===`Quad`||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}}})),bn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Variable=void 0,e.Variable=class{constructor(e){this.termType=`Variable`,this.value=e}equals(e){return!!e&&e.termType===`Variable`&&e.value===this.value}}})),xn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataFactory=void 0;var t=hn(),n=gn(),r=vn(),i=_n(),a=yn(),o=bn(),s=0;e.DataFactory=class{constructor(e){this.blankNodeCounter=0,e||={},this.blankNodePrefix=e.blankNodePrefix||`df_${s++}_`}namedNode(e){return new i.NamedNode(e)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new r.Literal(e,t)}variable(e){return new o.Variable(e)}defaultGraph(){return n.DefaultGraph.INSTANCE}quad(e,t,n,r){return new a.Quad(e,t,n,r||this.defaultGraph())}fromTerm(e){switch(e.termType){case`NamedNode`:return this.namedNode(e.value);case`BlankNode`:return this.blankNode(e.value);case`Literal`:return e.language?this.literal(e.value,e.language):e.datatype.equals(r.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case`Variable`:return this.variable(e.value);case`DefaultGraph`:return this.defaultGraph();case`Quad`:return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}}})),Sn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(hn(),e),n(xn(),e),n(gn(),e),n(vn(),e),n(_n(),e),n(yn(),e),n(bn(),e)})),Cn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateIri=e.IriValidationStrategy=void 0;function t(){let e=`[!$&'()*+,;=]`,t=`%[a-fA-F0-9]{2}`,n=`([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,r=`${n}\\.${n}\\.${n}\\.${n}`,i=`[a-fA-F0-9]{1,4}`,a=`(${i}:${i}|${r})`,o=`\\[(${`((${i}:){6}${a}|::(${i}:){5}${a}|(${i})?::(${i}:){4}${a}|((${i}:){0,1}${i})?::(${i}:){3}${a}|((${i}:){0,2}${i})?::(${i}:){2}${a}|((${i}:){0,3}${i})?::${i}:${a}|((${i}:){0,4}${i})?::${a}|((${i}:){0,5}${i})?::${i}|((${i}:){0,6}${i})?::)`}|${`v[a-fA-F0-9]+\\.(${e}|${e}|":)+`})\\]`,s=`[a-zA-Z0-9\\-._~\xA0-퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽]`,c=`(${s}|${t}|${e}|[:@])*`,l=`(${c}|[\\/?])*`,u=`(${c}|[-󰀀-󿿽􀀀-􏿽]|[\\/?])*`,d=`(${c})+`,f=`(${c})*`,p=`${d}(\\/${f})*`,m=`\\/(${d}(\\/${f})*)?`,h=`(\\/${f})*`,g=`(${o}|${r}|${`(${s}|${t}|${e})*`})`,_=`^[a-zA-Z][a-zA-Z0-9+\\-.]*:${`(\\/\\/${`(${`(${s}|${t}|${e}|:)*`}@)?${g}(:[0-9]*)?`}${h}|${m}|${p}|)`}(\\?${u})?(#${l})?$`;return new RegExp(_,`u`)}var n=t(),r=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u,i;(function(e){e.Strict=`strict`,e.Pragmatic=`pragmatic`,e.None=`none`})(i=e.IriValidationStrategy||={});function a(e,t=i.Strict){switch(t){case i.Strict:return n.test(e)?void 0:Error(`Invalid IRI according to RFC 3987: '${e}'`);case i.Pragmatic:return r.test(e)?void 0:Error(`Invalid IRI according to RDF Turtle: '${e}'`);case i.None:return;default:return Error(`Not supported validation strategy "${t}"`)}}e.validateIri=a})),wn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(Cn(),e)})),Tn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ParseType=e.RdfXmlParser=void 0;var t=ln(),n=pn(),r=Ye(),i=mn(),a=Sn(),o=wn(),s=class e extends r.Transform{constructor(e){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},e&&(Object.assign(this,e),this.options=e),this.dataFactory||=new a.DataFactory,this.baseIRI||=``,this.defaultGraph||=this.dataFactory.defaultGraph(),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||=this.validateUri?o.IriValidationStrategy.Pragmatic:o.IriValidationStrategy.None,this.parseUnsupportedVersions=!!e?.parseUnsupportedVersions,this.version=e?.version,this.saxParser=new n.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){let n=new r.PassThrough({readableObjectMode:!0});t.on(`error`,e=>i.emit(`error`,e)),t.on(`data`,e=>n.push(e)),t.on(`end`,()=>n.push(null));let i=n.pipe(new e(this.options));return i}_transform(e,t,n){if(this.version){let e=this.version;if(this.version=void 0,!this.isValidVersion(e))return n(this.newParseError(`Detected unsupported version as media type parameter: ${e}`))}try{this.saxParser.write(e)}catch(e){return n(e)}n()}newParseError(e){return new i.ParseError(this,e)}valueToUri(e,n){return this.uriToNamedNode((0,t.resolve)(e,n.baseIRI))}uriToNamedNode(e){let t=(0,o.validateIri)(e,this.iriValidationStrategy);if(t instanceof Error)throw this.newParseError(t.message);return this.dataFactory.namedNode(e)}validateNcname(t){if(!e.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}createLiteral(e,t){return this.dataFactory.literal(e,t.datatype?t.datatype:t.language?{language:t.language,direction:t.rdfVersion?t.direction:void 0}:void 0)}isValidVersion(t){return this.parseUnsupportedVersions||e.SUPPORTED_VERSIONS.includes(t)}attachSaxListeners(){this.saxParser.on(`error`,e=>this.emit(`error`,e)),this.saxParser.on(`opentag`,this.onTag.bind(this)),this.saxParser.on(`text`,this.onText.bind(this)),this.saxParser.on(`cdata`,this.onText.bind(this)),this.saxParser.on(`closetag`,this.onCloseTag.bind(this)),this.saxParser.on(`doctype`,this.onDoctype.bind(this))}onTag(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null,n=c.RESOURCE;if(t&&(t.hadChildren=!0,n=t.childrenParseType),t&&t.childrenStringTags){let n=e.name,r=``;for(let{key:e,value:n}of t.namespaces||[])r+=` ${e}="${n}"`;for(let t in e.attributes)r+=` ${t}="${e.attributes[t].value}"`;let i=`<${`${n}${r}`}>`;t.childrenStringTags.push(i);let a={childrenStringTags:t.childrenStringTags};a.childrenStringEmitClosingTag=`</${n}>`,this.activeTagStack.push(a);return}let r={};t?(r.language=t.language,r.direction=t.direction,r.baseIRI=t.baseIRI,r.childrenTripleTerms=t.childrenTripleTerms,r.rdfVersion=t.rdfVersion):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),n===c.RESOURCE?this.onTagResource(e,r,t,!t):this.onTagProperty(e,r,t);for(let t in e.attributes){let n=e.attributes[t];n.prefix===`xmlns`&&(r.namespaces||=[],r.namespaces.push({key:`${n.prefix}:${n.local}`,value:n.value}))}t&&t.namespaces&&(r.namespaces=[...r.namespaces||[],...t.namespaces])}onTagResource(n,r,i,a){r.childrenParseType=c.PROPERTY;let o=!0;if(n.uri===e.RDF){if(!a&&e.FORBIDDEN_NODE_ELEMENTS.indexOf(n.local)>=0)throw this.newParseError(`Illegal node element name: ${n.local}`);switch(n.local){case`RDF`:r.childrenParseType=c.RESOURCE;case`Description`:o=!1}}let s=[],l=[],u=null,d=!1,f=!1,p=null;for(let a in n.attributes){let o=n.attributes[a];if(o.uri===e.RDF&&o.local===`version`){this.setVersion(r,o.value);continue}else if(i&&o.uri===e.RDF)switch(o.local){case`about`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
18
+ `,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=i&&e<=55295||e===n||e===r||e===t||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e===i||e===n||e===r||e===t}e.isS=o;function s(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=s;function c(e){return s(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=c})),fn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CHAR=`-퟿-�𐀀-􏿿`,e.RESTRICTED_CHAR=`-\b\v\f--„†-Ÿ`,e.S=` \r
19
+ `,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.RESTRICTED_CHAR_RE=RegExp(`^[`+e.RESTRICTED_CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}e.isRestrictedChar=o;function s(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isCharAndNotRestricted=s;function c(e){return e===i||e===n||e===r||e===t}e.isS=c;function l(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=l;function u(e){return l(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=u})),pn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NC_NAME_START_CHAR=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NC_NAME_CHAR=`-`+e.NC_NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.NC_NAME_START_CHAR_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`]$`,`u`),e.NC_NAME_CHAR_RE=RegExp(`^[`+e.NC_NAME_CHAR+`]$`,`u`),e.NC_NAME_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`][`+e.NC_NAME_CHAR+`]*$`,`u`);function t(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNCNameStartChar=t;function n(e){return t(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNCNameChar=n})),mn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SaxesParser=e.EVENTS=void 0;var t=dn(),n=fn(),r=pn(),i=t.isS,a=t.isChar,o=t.isNameStartChar,s=t.isNameChar,c=t.S_LIST,l=t.NAME_RE,u=n.isChar,d=r.isNCNameStartChar,f=r.isNCNameChar,p=r.NC_NAME_RE,m=`http://www.w3.org/XML/1998/namespace`,h=`http://www.w3.org/2000/xmlns/`,g={__proto__:null,xml:m,xmlns:h},_={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},v=-1,y=-2,b=0,x=1,S=2,C=3,w=4,T=5,E=6,D=7,O=8,k=9,A=10,j=11,M=12,N=13,P=14,F=15,I=16,L=17,R=18,z=19,B=20,ee=21,te=22,ne=23,V=24,re=25,ie=26,ae=27,oe=28,se=29,ce=30,le=31,ue=32,de=33,fe=34,pe=35,me=36,he=37,ge=38,H=39,_e=40,U=41,ve=42,ye=43,be=44,xe=9,Se=10,Ce=13,W=32,we=33,Te=34,Ee=38,De=39,Oe=45,ke=47,Ae=59,G=60,je=61,K=62,q=63,Me=91,Ne=93,Pe=133,Fe=8232,Ie=e=>e===Te||e===De,Le=[Te,De],Re=[...Le,Me,K],ze=[...Le,G,Ne],Be=[je,q,...c],Ve=[...c,K,Ee,G];function He(e,t,n){switch(t){case`xml`:n!==m&&e.fail(`xml prefix must be bound to ${m}.`);break;case`xmlns`:n!==h&&e.fail(`xmlns prefix must be bound to ${h}.`);break;default:}switch(n){case h:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI \
20
+ ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}break;default:}}function Ue(e,t){for(let n of Object.keys(t))He(e,n,t[n])}var We=e=>p.test(e),Ge=e=>l.test(e),Ke=0,qe=1,Je=2;e.EVENTS=[`xmldecl`,`text`,`processinginstruction`,`doctype`,`comment`,`opentagstart`,`attribute`,`opentag`,`closetag`,`cdata`,`error`,`end`,`ready`];var Ye={xmldecl:`xmldeclHandler`,text:`textHandler`,processinginstruction:`piHandler`,doctype:`doctypeHandler`,comment:`commentHandler`,opentagstart:`openTagStartHandler`,attribute:`attributeHandler`,opentag:`openTagHandler`,closetag:`closeTagHandler`,cdata:`cdataHandler`,error:`errorHandler`,end:`endHandler`,ready:`readyHandler`};e.SaxesParser=class{get closed(){return this._closed}constructor(e){this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,t){this.nameStartCheck=d,this.nameCheck=f,this.isName=We,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},g);let e=this.opt.additionalNamespaces;e!=null&&(Ue(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=o,this.nameCheck=s,this.isName=Ge,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var e;this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=Ke,this.attribList=[];let{fragmentOpt:t}=this;this.state=t?N:b,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=t,this.xmlDeclPossible=!t,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);n=`1.0`}this.setXMLVersion(n),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(_),(e=this.readyHandler)==null||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[Ye[e]]=t}off(e){this[Ye[e]]=void 0}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close; assign an onready handler.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===Ce||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>=W||n===xe)return n;switch(n){case Se:return this.line++,this.column=0,this.positionAtNewLine=this.position,Se;case Ce:return e.charCodeAt(t+1)===Se&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==Fe||n===xe)return n;switch(n){case Se:return this.line++,this.column=0,this.positionAtNewLine=this.position,Se;case Ce:{let n=e.charCodeAt(t+1);(n===Se||n===Pe)&&(this.i=t+2)}case Pe:case Fe:return this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===y?Se:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===y,a=i?Se:r;if(a===v||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case y:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=Se;break;case v:return this.text+=n.slice(t),!1;default:}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===v)return this.name+=e.slice(t),v;if(!s(n))return this.name+=e.slice(t,this.prevI),n===y?Se:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===v||!i(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=a,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=x}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case G:if(this.state=F,this.text.length!==0)throw Error(`no-empty text at start`);break;case v:break;default:this.unget(),this.state=N,this.xmlDeclPossible=!1}}sDoctype(){var e;let t=this.captureTo(Re);switch(t){case K:(e=this.doctypeHandler)==null||e.call(this,this.text),this.text=``,this.state=N,this.doctype=!0;break;case v:break;default:this.text+=String.fromCodePoint(t),t===Me?this.state=w:Ie(t)&&(this.state=C,this.q=t)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=S)}sDTD(){let e=this.captureTo(ze);e!==v&&(this.text+=String.fromCodePoint(e),e===Ne?this.state=S:e===G?this.state=E:Ie(e)&&(this.state=T,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=w,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case we:this.state=D,this.openWakaBang=``;break;case q:this.state=j;break;default:this.state=w}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?O:w,this.openWakaBang=``)}sDTDComment(){this.captureToChar(Oe)&&(this.text+=`-`,this.state=k)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===Oe?A:O}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===K?this.state=w:(this.fail(`malformed comment.`),this.state=O)}sDTDPI(){this.captureToChar(q)&&(this.text+=`?`,this.state=M)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===K&&(this.state=w)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;loop:for(;;)switch(this.getCode()){case y:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case Ae:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI);this.state=n;let i;r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),(n!==N||this.textHandler!==void 0)&&(this.text+=i);break loop}case v:this.entity+=t.slice(e);break loop;default:}}sOpenWaka(){let e=this.getCode();if(o(e))this.state=fe,this.unget(),this.xmlDeclPossible=!1;else switch(e){case ke:this.state=ye,this.xmlDeclPossible=!1;break;case we:this.state=I,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case q:this.state=ne;break;default:this.fail(`disallowed character in tag name`),this.state=N,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case`[CDATA[`:!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0),this.state=B,this.openWakaBang=``;break;case`--`:this.state=L,this.openWakaBang=``;break;case`DOCTYPE`:this.state=S,(this.doctype||this.sawRoot)&&this.fail(`inappropriately located doctype declaration.`),this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&this.fail(`incorrect syntax.`)}}sComment(){this.captureToChar(Oe)&&(this.state=R)}sCommentEnding(){var e;let t=this.getCodeNorm();t===Oe?(this.state=z,(e=this.commentHandler)==null||e.call(this,this.text),this.text=``):(this.text+=`-${String.fromCodePoint(t)}`,this.state=L)}sCommentEnded(){let e=this.getCodeNorm();e===K?this.state=N:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=L)}sCData(){this.captureToChar(Ne)&&(this.state=ee)}sCDataEnding(){let e=this.getCodeNorm();e===Ne?this.state=te:(this.text+=`]${String.fromCodePoint(e)}`,this.state=B)}sCDataEnding2(){var e;let t=this.getCodeNorm();switch(t){case K:(e=this.cdataHandler)==null||e.call(this,this.text),this.text=``,this.state=N;break;case Ne:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(t)}`,this.state=B}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=V):e===q||i(e)?(this.fail(`processing instruction without a target.`),this.state=e===q?ie:re):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=V)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===v){this.piTarget+=e.slice(t);return}if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===q;r||i(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?de:ae):this.state=r?ie:re:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===q?this.state=ie:i(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(q)&&(this.state=ie)}sPIEnding(){var e;let t=this.getCodeNorm();if(t===K){let{piTarget:t}=this;t.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),(e=this.piHandler)==null||e.call(this,{target:t,body:this.text}),this.piTarget=this.text=``,this.state=N}else t===q?this.text+=`?`:(this.text+=`?${String.fromCodePoint(t)}`,this.state=re);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();if(e===q){this.state=de;return}e!==v&&(this.state=oe,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(Be);if(e===q){this.state=de,this.name+=this.text,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(i(e)||e===je){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===je?ce:se}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===q){this.state=de,this.fail(`XML declaration is incomplete.`);return}i(e)||(e!==je&&this.fail(`value required.`),this.state=ce)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===q){this.state=de,this.fail(`XML declaration is incomplete.`);return}i(e)||(Ie(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=W),this.state=le)}sXMLDeclValue(){let e=this.captureTo([this.q,q]);if(e===q){this.state=de,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(e===v)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t;break;default:}this.name=``,this.state=ue}sXMLDeclSeparator(){let e=this.getCodeNorm();if(e===q){this.state=de;return}i(e)||(this.fail(`whitespace required.`),this.unget()),this.state=ae}sXMLDeclEnding(){var e;this.getCodeNorm()===K?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),(e=this.xmldeclHandler)==null||e.call(this,this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=N):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){var e;let t=this.captureNameChars();if(t===v)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(e=this.openTagStartHandler)==null||e.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),t){case K:this.openTag();break;case ke:this.state=pe;break;default:i(t)||this.fail(`disallowed character in tag name.`),this.state=me}}sOpenTagSlash(){this.getCode()===K?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=me)}sAttrib(){let e=this.skipSpaces();e!==v&&(o(e)?(this.unget(),this.state=he):e===K?this.openTag():e===ke?this.state=pe:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===je?this.state=H:i(e)?this.state=ge:e===K?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==v&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case v:return;case je:this.state=H;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===K?this.openTag():o(e)?(this.unget(),this.state=he):(this.fail(`disallowed character in attribute name.`),this.state=me)}}sAttribValue(){let e=this.getCodeNorm();Ie(e)?(this.q=e,this.state=_e):i(e)||(this.fail(`unquoted attribute value.`),this.state=ve,this.unget())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=U;return;case Ee:this.text+=t.slice(n,this.prevI),this.state=P,this.entityReturnState=_e;return;case Se:case y:case xe:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case G:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case v:this.text+=t.slice(n);return;default:}}sAttribValueClosed(){let e=this.getCodeNorm();i(e)?this.state=me:e===K?this.openTag():e===ke?this.state=pe:o(e)?(this.fail(`no whitespace between attributes.`),this.unget(),this.state=he):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(Ve);switch(e){case Ee:this.state=P,this.entityReturnState=ve;break;case G:this.fail(`disallowed character.`);break;case v:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===K?this.openTag():this.state=me}}sCloseTag(){let e=this.captureNameChars();e===K?this.closeTag():i(e)?this.state=be:e!==v&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case K:this.closeTag();break;case v:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;scanLoop:for(;;)switch(this.getCode()){case G:if(this.state=F,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=Ke;break scanLoop;case Ee:this.state=P,this.entityReturnState=N,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=Ke;break scanLoop;case Ne:switch(t){case Ke:t=qe;break;case qe:t=Je;break;case Je:break;default:throw Error(`impossible state`)}break;case K:t===Je&&this.fail(`the string "]]>" is disallowed in char data.`),t=Ke;break;case y:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=Ke;break;case v:r!==void 0&&(this.text+=n.slice(e));break scanLoop;default:t=Ke}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;outRootLoop:for(;;){let a=this.getCode();switch(a){case G:if(this.state=F,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break outRootLoop;case Ee:this.state=P,this.entityReturnState=N,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break outRootLoop;case y:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case v:n!==void 0&&(this.text+=t.slice(e));break outRootLoop;default:i(a)||(r=!0)}}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}pushAttribNS(e,t){var n;let{prefix:r,local:i}=this.qname(e),a={name:e,prefix:r,local:i,value:t};if(this.attribList.push(a),(n=this.attributeHandler)==null||n.call(this,a),r===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[i]=e,He(this,i,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,He(this,``,e)}}pushAttribPlain(e,t){var n;let r={name:e,value:t};this.attribList.push(r),(n=this.attributeHandler)==null||n.call(this,r)}end(){var e,t;this.sawRoot||this.fail(`document must contain a root element.`);let{tags:n}=this;for(;n.length>0;){let e=n.pop();this.fail(`unclosed tag: ${e.name}`)}this.state!==b&&this.state!==N&&this.fail(`unexpected end.`);let{text:r}=this;return r.length!==0&&((e=this.textHandler)==null||e.call(this,r),this.text=``),this._closed=!0,(t=this.endHandler)==null||t.call(this),this._init(),this}resolve(e){var t;let n=this.topNS[e];if(n!==void 0)return n;let{tags:r}=this;for(let t=r.length-1;t>=0;t--)if(n=r[t].ns[e],n!==void 0)return n;return n=this.ns[e],n===void 0?(t=this.opt).resolvePrefix?.call(t,e):n}qname(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qname(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?h:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){var e;this.processAttribs();let{tags:t}=this,n=this.tag;n.isSelfClosing=!1,(e=this.openTagHandler)==null||e.call(this,n),t.push(n),this.state=N,this.name=``}openSelfClosingTag(){var e,t;this.processAttribs();let{tags:n}=this,r=this.tag;r.isSelfClosing=!0,(e=this.openTagHandler)==null||e.call(this,r),(t=this.closeTagHandler)==null||t.call(this,r),(this.tag=n[n.length-1]??null)===null&&(this.closedRoot=!0),this.state=N,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=N,this.name=``,t===``){this.fail(`weird empty close tag.`),this.text+=`</>`;return}let n=this.closeTagHandler,r=e.length;for(;r-->0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}}})),hn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ParseError=void 0,e.ParseError=class extends Error{constructor(e,t){let n=e.saxParser;super(e.trackPosition?`Line ${n.line} column ${n.column+1}: ${t}`:t)}}})),gn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BlankNode=void 0,e.BlankNode=class{constructor(e){this.termType=`BlankNode`,this.value=e}equals(e){return!!e&&e.termType===`BlankNode`&&e.value===this.value}}})),_n=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultGraph=void 0;var t=class{constructor(){this.termType=`DefaultGraph`,this.value=``}equals(e){return!!e&&e.termType===`DefaultGraph`}};e.DefaultGraph=t,t.INSTANCE=new t})),vn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NamedNode=void 0,e.NamedNode=class{constructor(e){this.termType=`NamedNode`,this.value=e}equals(e){return!!e&&e.termType===`NamedNode`&&e.value===this.value}}})),yn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Literal=void 0;var t=vn(),n=class e{constructor(t,n){this.termType=`Literal`,this.value=t,typeof n==`string`?(this.language=n,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=``):n?`termType`in n?(this.language=``,this.datatype=n,this.direction=``):(this.language=n.language,this.datatype=n.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=n.direction||``):(this.language=``,this.datatype=e.XSD_STRING,this.direction=``)}equals(e){return!!e&&e.termType===`Literal`&&e.value===this.value&&e.language===this.language&&(e.direction===this.direction||!e.direction&&this.direction===``)&&this.datatype.equals(e.datatype)}};e.Literal=n,n.RDF_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),n.RDF_DIRECTIONAL_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`),n.XSD_STRING=new t.NamedNode(`http://www.w3.org/2001/XMLSchema#string`)})),bn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Quad=void 0,e.Quad=class{constructor(e,t,n,r){this.termType=`Quad`,this.value=``,this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&(e.termType===`Quad`||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}}})),xn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Variable=void 0,e.Variable=class{constructor(e){this.termType=`Variable`,this.value=e}equals(e){return!!e&&e.termType===`Variable`&&e.value===this.value}}})),Sn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataFactory=void 0;var t=gn(),n=_n(),r=yn(),i=vn(),a=bn(),o=xn(),s=0;e.DataFactory=class{constructor(e){this.blankNodeCounter=0,e||={},this.blankNodePrefix=e.blankNodePrefix||`df_${s++}_`}namedNode(e){return new i.NamedNode(e)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new r.Literal(e,t)}variable(e){return new o.Variable(e)}defaultGraph(){return n.DefaultGraph.INSTANCE}quad(e,t,n,r){return new a.Quad(e,t,n,r||this.defaultGraph())}fromTerm(e){switch(e.termType){case`NamedNode`:return this.namedNode(e.value);case`BlankNode`:return this.blankNode(e.value);case`Literal`:return e.language?this.literal(e.value,e.language):e.datatype.equals(r.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case`Variable`:return this.variable(e.value);case`DefaultGraph`:return this.defaultGraph();case`Quad`:return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}}})),Cn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(gn(),e),n(Sn(),e),n(_n(),e),n(yn(),e),n(vn(),e),n(bn(),e),n(xn(),e)})),wn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateIri=e.IriValidationStrategy=void 0;function t(){let e=`[!$&'()*+,;=]`,t=`%[a-fA-F0-9]{2}`,n=`([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,r=`${n}\\.${n}\\.${n}\\.${n}`,i=`[a-fA-F0-9]{1,4}`,a=`(${i}:${i}|${r})`,o=`\\[(${`((${i}:){6}${a}|::(${i}:){5}${a}|(${i})?::(${i}:){4}${a}|((${i}:){0,1}${i})?::(${i}:){3}${a}|((${i}:){0,2}${i})?::(${i}:){2}${a}|((${i}:){0,3}${i})?::${i}:${a}|((${i}:){0,4}${i})?::${a}|((${i}:){0,5}${i})?::${i}|((${i}:){0,6}${i})?::)`}|${`v[a-fA-F0-9]+\\.(${e}|${e}|":)+`})\\]`,s=`[a-zA-Z0-9\\-._~\xA0-퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽]`,c=`(${s}|${t}|${e}|[:@])*`,l=`(${c}|[\\/?])*`,u=`(${c}|[-󰀀-󿿽􀀀-􏿽]|[\\/?])*`,d=`(${c})+`,f=`(${c})*`,p=`${d}(\\/${f})*`,m=`\\/(${d}(\\/${f})*)?`,h=`(\\/${f})*`,g=`(${o}|${r}|${`(${s}|${t}|${e})*`})`,_=`^[a-zA-Z][a-zA-Z0-9+\\-.]*:${`(\\/\\/${`(${`(${s}|${t}|${e}|:)*`}@)?${g}(:[0-9]*)?`}${h}|${m}|${p}|)`}(\\?${u})?(#${l})?$`;return new RegExp(_,`u`)}var n=t(),r=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u,i;(function(e){e.Strict=`strict`,e.Pragmatic=`pragmatic`,e.None=`none`})(i=e.IriValidationStrategy||={});function a(e,t=i.Strict){switch(t){case i.Strict:return n.test(e)?void 0:Error(`Invalid IRI according to RFC 3987: '${e}'`);case i.Pragmatic:return r.test(e)?void 0:Error(`Invalid IRI according to RDF Turtle: '${e}'`);case i.None:return;default:return Error(`Not supported validation strategy "${t}"`)}}e.validateIri=a})),Tn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(wn(),e)})),En=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ParseType=e.RdfXmlParser=void 0;var t=un(),n=mn(),r=Ye(),i=hn(),a=Cn(),o=Tn(),s=class e extends r.Transform{constructor(e){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},e&&(Object.assign(this,e),this.options=e),this.dataFactory||=new a.DataFactory,this.baseIRI||=``,this.defaultGraph||=this.dataFactory.defaultGraph(),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||=this.validateUri?o.IriValidationStrategy.Pragmatic:o.IriValidationStrategy.None,this.parseUnsupportedVersions=!!e?.parseUnsupportedVersions,this.version=e?.version,this.saxParser=new n.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){let n=new r.PassThrough({readableObjectMode:!0});t.on(`error`,e=>i.emit(`error`,e)),t.on(`data`,e=>n.push(e)),t.on(`end`,()=>n.push(null));let i=n.pipe(new e(this.options));return i}_transform(e,t,n){if(this.version){let e=this.version;if(this.version=void 0,!this.isValidVersion(e))return n(this.newParseError(`Detected unsupported version as media type parameter: ${e}`))}try{this.saxParser.write(e)}catch(e){return n(e)}n()}newParseError(e){return new i.ParseError(this,e)}valueToUri(e,n){return this.uriToNamedNode((0,t.resolve)(e,n.baseIRI))}uriToNamedNode(e){let t=(0,o.validateIri)(e,this.iriValidationStrategy);if(t instanceof Error)throw this.newParseError(t.message);return this.dataFactory.namedNode(e)}validateNcname(t){if(!e.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}createLiteral(e,t){return this.dataFactory.literal(e,t.datatype?t.datatype:t.language?{language:t.language,direction:t.rdfVersion?t.direction:void 0}:void 0)}isValidVersion(t){return this.parseUnsupportedVersions||e.SUPPORTED_VERSIONS.includes(t)}attachSaxListeners(){this.saxParser.on(`error`,e=>this.emit(`error`,e)),this.saxParser.on(`opentag`,this.onTag.bind(this)),this.saxParser.on(`text`,this.onText.bind(this)),this.saxParser.on(`cdata`,this.onText.bind(this)),this.saxParser.on(`closetag`,this.onCloseTag.bind(this)),this.saxParser.on(`doctype`,this.onDoctype.bind(this))}onTag(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null,n=c.RESOURCE;if(t&&(t.hadChildren=!0,n=t.childrenParseType),t&&t.childrenStringTags){let n=e.name,r=``;for(let{key:e,value:n}of t.namespaces||[])r+=` ${e}="${n}"`;for(let t in e.attributes)r+=` ${t}="${e.attributes[t].value}"`;let i=`<${`${n}${r}`}>`;t.childrenStringTags.push(i);let a={childrenStringTags:t.childrenStringTags};a.childrenStringEmitClosingTag=`</${n}>`,this.activeTagStack.push(a);return}let r={};t?(r.language=t.language,r.direction=t.direction,r.baseIRI=t.baseIRI,r.childrenTripleTerms=t.childrenTripleTerms,r.rdfVersion=t.rdfVersion):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),n===c.RESOURCE?this.onTagResource(e,r,t,!t):this.onTagProperty(e,r,t);for(let t in e.attributes){let n=e.attributes[t];n.prefix===`xmlns`&&(r.namespaces||=[],r.namespaces.push({key:`${n.prefix}:${n.local}`,value:n.value}))}t&&t.namespaces&&(r.namespaces=[...r.namespaces||[],...t.namespaces])}onTagResource(n,r,i,a){r.childrenParseType=c.PROPERTY;let o=!0;if(n.uri===e.RDF){if(!a&&e.FORBIDDEN_NODE_ELEMENTS.indexOf(n.local)>=0)throw this.newParseError(`Illegal node element name: ${n.local}`);switch(n.local){case`RDF`:r.childrenParseType=c.RESOURCE;case`Description`:o=!1}}let s=[],l=[],u=null,d=!1,f=!1,p=null;for(let a in n.attributes){let o=n.attributes[a];if(o.uri===e.RDF&&o.local===`version`){this.setVersion(r,o.value);continue}else if(i&&o.uri===e.RDF)switch(o.local){case`about`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
21
21
  while ${o.value} and ${u} where found.`);u=o.value;continue;case`ID`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
22
22
  while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=`#`+o.value,d=!0;continue;case`nodeID`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
23
- while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=o.value,f=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`type`:p=o.value;continue;case`aboutEach`:throw this.newParseError(`rdf:aboutEach is not supported.`);case`aboutEachPrefix`:throw this.newParseError(`rdf:aboutEachPrefix is not supported.`);case`li`:throw this.newParseError(`rdf:li on node elements are not supported.`)}else if(o.uri===e.XML){if(o.local===`lang`){r.language=o.value===``?null:o.value.toLowerCase();continue}else if(o.local===`base`){r.baseIRI=(0,t.resolve)(o.value,r.baseIRI);continue}}else if(o.uri===e.ITS&&o.local===`dir`){this.setDirection(r,o.value);continue}o.prefix!==`xml`&&o.prefix!==`xmlns`&&(o.prefix!==``||o.local!==`xmlns`)&&o.uri&&(s.push(this.uriToNamedNode(o.uri+o.local)),l.push(o.value))}if(u!==null&&(r.subject=f?this.dataFactory.blankNode(u):this.valueToUri(u,r),d&&this.claimNodeId(r.subject)),r.subject||=this.dataFactory.blankNode(),o){let t=this.uriToNamedNode(n.uri+n.local);this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),t,i?i.reifiedStatementId:null,r.childrenTripleTerms,r.reifier)}if(i){if(i.predicate)if(i.childrenCollectionSubject){let t=this.dataFactory.blankNode(),n=this.dataFactory.namedNode(e.RDF+`rest`),a=i.childrenCollectionPredicate.equals(n);this.emitTriple(i.childrenCollectionSubject,i.childrenCollectionPredicate,t,a?null:i.reifiedStatementId,i.childrenTripleTerms,a?null:i.reifier),this.emitTriple(t,this.dataFactory.namedNode(e.RDF+`first`),r.subject,null,r.childrenTripleTerms),i.childrenCollectionSubject=t,i.childrenCollectionPredicate=n}else{i.childrenTagsToTripleTerms||(this.emitTriple(i.subject,i.predicate,r.subject,i.reifiedStatementId,i.childrenTripleTerms,i.reifier),i.predicateEmitted=!0);for(let e=0;e<i.predicateSubPredicates.length;e++)this.emitTriple(r.subject,i.predicateSubPredicates[e],i.predicateSubObjects[e],null,i.childrenTripleTerms,i.reifier);i.predicateSubPredicates=[],i.predicateSubObjects=[]}for(let e=0;e<s.length;e++){let t=this.createLiteral(l[e],r);this.emitTriple(r.subject,s[e],t,i.reifiedStatementId,i.childrenTripleTerms,i.reifier)}p&&this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),this.uriToNamedNode(p),null,r.childrenTripleTerms,r.reifier)}}onTagProperty(t,n,r){if(n.childrenParseType=c.RESOURCE,n.subject=r.subject,t.uri===e.RDF&&t.local===`li`?(r.listItemCounter||=1,n.predicate=this.uriToNamedNode(t.uri+`_`+r.listItemCounter++)):n.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===e.RDF&&e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);n.predicateSubPredicates=[],n.predicateSubObjects=[];let i=!1,a=!1,o=null,s=!0,l=[],u=[];for(let r in t.attributes){let d=t.attributes[r];if(d.uri===e.RDF&&d.local===`version`){this.setVersion(n,d.value);continue}else if(d.uri===e.RDF)switch(d.local){case`resource`:if(o)throw this.newParseError(`Found both rdf:resource (${d.value}) and rdf:nodeID (${o}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${d.value})`);n.hadChildren=!0,o=d.value,s=!1;continue;case`datatype`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${d.value})`);n.datatype=this.valueToUri(d.value,n);continue;case`nodeID`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${d.value}).`);if(n.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${d.value})`);this.validateNcname(d.value),n.hadChildren=!0,o=d.value,s=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`parseType`:if(a)throw this.newParseError(`rdf:parseType is not allowed when non-rdf:* property attributes are present`);if(n.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${n.datatype.value})`);if(o)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${o})`);if(d.value===`Resource`){i=!0,n.childrenParseType=c.PROPERTY;let e=this.dataFactory.blankNode();this.emitTriple(n.subject,n.predicate,e,n.reifiedStatementId,n.childrenTripleTerms,n.reifier),n.subject=e,n.predicate=null}else d.value===`Collection`?(i=!0,n.hadChildren=!0,n.childrenCollectionSubject=n.subject,n.childrenCollectionPredicate=n.predicate,s=!1):d.value===`Literal`?(i=!0,n.childrenTagsToString=!0,n.childrenStringTags=[]):d.value===`Triple`&&(i=!0,n.childrenTagsToTripleTerms=!0,n.childrenTripleTerms=[]);continue;case`ID`:this.validateNcname(d.value),n.reifiedStatementId=this.valueToUri(`#`+d.value,n),this.claimNodeId(n.reifiedStatementId);continue;case`annotation`:n.reifier=this.dataFactory.namedNode(d.value);continue;case`annotationNodeID`:n.reifier=this.dataFactory.blankNode(d.value);continue}else if(d.uri===e.XML&&d.local===`lang`){n.language=d.value===``?null:d.value.toLowerCase();continue}else if(d.uri===e.ITS&&d.local===`dir`){this.setDirection(n,d.value);continue}else if(d.uri===e.ITS&&d.local===`version`)continue;if(d.prefix!==`xml`&&d.prefix!==`xmlns`&&(d.prefix!==``||d.local!==`xmlns`)&&d.uri){if(i||n.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${d.value}`);n.hadChildren=!0,a=!0,l.push(this.uriToNamedNode(d.uri+d.local)),u.push(this.createLiteral(d.value,n))}}if(o!==null){let e=n.subject;n.subject=s?this.dataFactory.blankNode(o):this.valueToUri(o,n),this.emitTriple(e,n.predicate,n.subject,n.reifiedStatementId,n.childrenTripleTerms,n.reifier);for(let e=0;e<l.length;e++)this.emitTriple(n.subject,l[e],u[e],null,n.childrenTripleTerms,n.reifier);n.predicateEmitted=!0}else s&&(n.predicateSubPredicates=l,n.predicateSubObjects=u,n.predicateEmitted=!1)}emitTriple(t,n,r,i,a,o){let s=this.dataFactory.quad(t,n,r,this.defaultGraph);a?a.push(s):this.push(s),o&&this.push(this.dataFactory.quad(o,this.dataFactory.namedNode(e.RDF+`reifies`),s)),i&&(this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`type`),this.dataFactory.namedNode(e.RDF+`Statement`),this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`subject`),t,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`predicate`),n,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`object`),r,this.defaultGraph)))}claimNodeId(e){if(!this.allowDuplicateRdfIds){if(this.nodeIds[e.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${e.value}'.`);this.nodeIds[e.value]=!0}}onText(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;t&&(t.childrenStringTags?t.childrenStringTags.push(e):t.predicate&&(t.text=e))}onCloseTag(){let t=this.activeTagStack.pop(),n=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(e.RDF+`XMLLiteral`),t.text=t.childrenStringTags.join(``),t.hadChildren=!1),t.childrenTagsToTripleTerms&&t.predicate&&t.rdfVersion){if(t.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${t.childrenTripleTerms.length}`);for(let e of t.childrenTripleTerms)this.emitTriple(t.subject,t.predicate,e,null,n.childrenTripleTerms,n.reifier);t.predicateEmitted=!0}if(t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(e.RDF+`nil`),null,t.childrenTripleTerms);else if(t.predicate){if(!t.hadChildren&&t.childrenParseType!==c.PROPERTY)this.emitTriple(t.subject,t.predicate,this.createLiteral(t.text||``,t),t.reifiedStatementId,t.childrenTripleTerms,t.reifier);else if(!t.predicateEmitted){let e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId,t.childrenTripleTerms,t.reifier);for(let n=0;n<t.predicateSubPredicates.length;n++)this.emitTriple(e,t.predicateSubPredicates[n],t.predicateSubObjects[n],null,t.childrenTripleTerms)}}}onDoctype(e){e.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(e,t,n)=>(this.saxParser.ENTITIES[t]=n,``))}setDirection(e,t){if(t){if(t!==`ltr`&&t!==`rtl`)throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${t}' was found.`);e.direction=t}else delete e.direction}setVersion(e,t){if(e.rdfVersion=t,this.emit(`version`,t),!this.isValidVersion(t))throw this.newParseError(`Detected unsupported version: ${t}`)}};e.RdfXmlParser=s,s.MIME_TYPE=`application/rdf+xml`,s.RDF=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,s.XML=`http://www.w3.org/XML/1998/namespace`,s.ITS=`http://www.w3.org/2005/11/its`,s.FORBIDDEN_NODE_ELEMENTS=[`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`li`,`aboutEach`,`aboutEachPrefix`],s.FORBIDDEN_PROPERTY_ELEMENTS=[`Description`,`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`aboutEach`,`aboutEachPrefix`],s.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,s.SUPPORTED_VERSIONS=[`1.2`,`1.2-basic`,`1.1`];var c;(function(e){e[e.RESOURCE=0]=`RESOURCE`,e[e.PROPERTY=1]=`PROPERTY`})(c||(e.ParseType=c={}))})),En=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(Tn(),e)})),Dn=o(((e,t)=>{t.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){let{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){let t=e&&this._existing.get(e);if(t)return t;let n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}})),On=o((()=>{(function(e,t){if(e.setImmediate)return;var n=1,r={},i=!1,a=e.document,o;function s(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];return r[n]={callback:e,args:t},o(n),n++}function c(e){delete r[e]}function l(e){var n=e.callback,r=e.args;switch(r.length){case 0:n();break;case 1:n(r[0]);break;case 2:n(r[0],r[1]);break;case 3:n(r[0],r[1],r[2]);break;default:n.apply(t,r);break}}function u(e){if(i)setTimeout(u,0,e);else{var t=r[e];if(t){i=!0;try{l(t)}finally{c(e),i=!1}}}}function d(){o=function(e){process.nextTick(function(){u(e)})}}function f(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}function p(){var t=`setImmediate$`+Math.random()+`$`,n=function(n){n.source===e&&typeof n.data==`string`&&n.data.indexOf(t)===0&&u(+n.data.slice(t.length))};e.addEventListener?e.addEventListener(`message`,n,!1):e.attachEvent(`onmessage`,n),o=function(n){e.postMessage(t+n,`*`)}}function m(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;u(t)},o=function(t){e.port2.postMessage(t)}}function h(){var e=a.documentElement;o=function(t){var n=a.createElement(`script`);n.onreadystatechange=function(){u(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}function g(){o=function(e){setTimeout(u,0,e)}}var _=Object.getPrototypeOf&&Object.getPrototypeOf(e);_=_&&_.setTimeout?_:e,{}.toString.call(e.process)===`[object process]`?d():f()?p():e.MessageChannel?m():a&&`onreadystatechange`in a.createElement(`script`)?h():g(),_.setImmediate=s,_.clearImmediate=c})(typeof self>`u`?typeof global>`u`?void 0:global:self)})),kn=o((e=>{On(),e.setImmediate=setImmediate,e.crypto=globalThis.crypto;var t=[];for(let e=0;e<=255;++e)t.push(e.toString(16).padStart(2,`0`));e.bufferToHex=function(e){let n=``,r=new Uint8Array(e);for(let e=0;e<r.length;++e)n+=t[r[e]];return n}})),An=o(((e,t)=>{var{bufferToHex:n,crypto:r}=kn(),i=new Map([[`sha256`,`SHA-256`],[`SHA256`,`SHA-256`],[`SHA-256`,`SHA-256`],[`sha384`,`SHA-384`],[`SHA384`,`SHA-384`],[`SHA-384`,`SHA-384`],[`sha512`,`SHA-512`],[`SHA512`,`SHA-512`],[`SHA-512`,`SHA-512`]]);t.exports=class{constructor(e){if(!(r&&r.subtle))throw Error(`crypto.subtle not found.`);if(!i.has(e))throw Error(`Unsupported algorithm "${e}".`);this.algorithm=i.get(e),this._content=``}update(e){this._content+=e}async digest(){let e=new TextEncoder().encode(this._content);return n(await r.subtle.digest(this.algorithm,e))}}})),jn=o(((e,t)=>{t.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){let{current:e,dir:t}=this,n=e.slice(),r=null,i=0,a=e.length;for(let n=0;n<a;++n){let o=e[n],s=t.get(o);(r===null||o>r)&&(s&&n>0&&o>e[n-1]||!s&&n<a-1&&o>e[n+1])&&(r=o,i=n)}if(r===null)this.done=!0;else{let n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(let n of e)n>r&&t.set(n,!t.get(n))}return n}}})),Mn=o(((e,t)=>{var n=`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,r=`http://www.w3.org/2001/XMLSchema#string`,i=`NamedNode`,a=`BlankNode`,o=`Literal`,s={};s.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,s.empty=RegExp(`^[ \\t]*$`),s.quad=RegExp('^[ \\t]*(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)[ \\t]+(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$'),t.exports=class e{static parse(e){let t=[],l={},u=e.split(s.eoln),d=0;for(let e of u){if(d++,s.empty.test(e))continue;let u=e.match(s.quad);if(u===null)throw Error(`N-Quads parse error on line `+d+`.`);let f={subject:null,predicate:null,object:null,graph:null};if(u[1]===void 0?f.subject={termType:a,value:u[2]}:f.subject={termType:i,value:v(u[1])},f.predicate={termType:i,value:v(u[3])},u[4]===void 0?u[5]===void 0?(f.object={termType:o,value:void 0,datatype:{termType:i}},u[7]===void 0?u[8]===void 0?f.object.datatype.value=r:(f.object.datatype.value=n,f.object.language=u[8]):f.object.datatype.value=v(u[7]),f.object.value=p(u[6])):f.object={termType:a,value:u[5]}:f.object={termType:i,value:v(u[4])},u[9]===void 0?u[10]===void 0?f.graph={termType:`DefaultGraph`,value:``}:f.graph={termType:a,value:u[10]}:f.graph={termType:i,value:v(u[9])},!(f.graph.value in l))l[f.graph.value]=[f],t.push(f);else{let e=!0,n=l[f.graph.value];for(let t of n)if(c(t,f)){e=!1;break}e&&(n.push(f),t.push(f))}}return t}static serialize(t){let n=[];for(let r of t)n.push(e.serializeQuad(r));return n.sort().join(``)}static serializeQuadComponents(e,t,o,s){let c=``;return e.termType===i?c+=`<${g(e.value)}>`:c+=`_:${e.value}`,t.termType===i?c+=` <${g(t.value)}> `:c+=` _:${t.value} `,o.termType===i?c+=`<${g(o.value)}>`:o.termType===a?c+=`_:${o.value}`:(c+=`"${d(o.value)}"`,o.datatype.value===n?o.language&&(c+=`@${o.language}`):o.datatype.value!==r&&(c+=`^^<${g(o.datatype.value)}>`)),s.termType===i?c+=` <${g(s.value)}>`:s.termType===a&&(c+=` _:${s.value}`),c+=` .
23
+ while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=o.value,f=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`type`:p=o.value;continue;case`aboutEach`:throw this.newParseError(`rdf:aboutEach is not supported.`);case`aboutEachPrefix`:throw this.newParseError(`rdf:aboutEachPrefix is not supported.`);case`li`:throw this.newParseError(`rdf:li on node elements are not supported.`)}else if(o.uri===e.XML){if(o.local===`lang`){r.language=o.value===``?null:o.value.toLowerCase();continue}else if(o.local===`base`){r.baseIRI=(0,t.resolve)(o.value,r.baseIRI);continue}}else if(o.uri===e.ITS&&o.local===`dir`){this.setDirection(r,o.value);continue}o.prefix!==`xml`&&o.prefix!==`xmlns`&&(o.prefix!==``||o.local!==`xmlns`)&&o.uri&&(s.push(this.uriToNamedNode(o.uri+o.local)),l.push(o.value))}if(u!==null&&(r.subject=f?this.dataFactory.blankNode(u):this.valueToUri(u,r),d&&this.claimNodeId(r.subject)),r.subject||=this.dataFactory.blankNode(),o){let t=this.uriToNamedNode(n.uri+n.local);this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),t,i?i.reifiedStatementId:null,r.childrenTripleTerms,r.reifier)}if(i){if(i.predicate)if(i.childrenCollectionSubject){let t=this.dataFactory.blankNode(),n=this.dataFactory.namedNode(e.RDF+`rest`),a=i.childrenCollectionPredicate.equals(n);this.emitTriple(i.childrenCollectionSubject,i.childrenCollectionPredicate,t,a?null:i.reifiedStatementId,i.childrenTripleTerms,a?null:i.reifier),this.emitTriple(t,this.dataFactory.namedNode(e.RDF+`first`),r.subject,null,r.childrenTripleTerms),i.childrenCollectionSubject=t,i.childrenCollectionPredicate=n}else{i.childrenTagsToTripleTerms||(this.emitTriple(i.subject,i.predicate,r.subject,i.reifiedStatementId,i.childrenTripleTerms,i.reifier),i.predicateEmitted=!0);for(let e=0;e<i.predicateSubPredicates.length;e++)this.emitTriple(r.subject,i.predicateSubPredicates[e],i.predicateSubObjects[e],null,i.childrenTripleTerms,i.reifier);i.predicateSubPredicates=[],i.predicateSubObjects=[]}for(let e=0;e<s.length;e++){let t=this.createLiteral(l[e],r);this.emitTriple(r.subject,s[e],t,i.reifiedStatementId,i.childrenTripleTerms,i.reifier)}p&&this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),this.uriToNamedNode(p),null,r.childrenTripleTerms,r.reifier)}}onTagProperty(t,n,r){if(n.childrenParseType=c.RESOURCE,n.subject=r.subject,t.uri===e.RDF&&t.local===`li`?(r.listItemCounter||=1,n.predicate=this.uriToNamedNode(t.uri+`_`+r.listItemCounter++)):n.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===e.RDF&&e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);n.predicateSubPredicates=[],n.predicateSubObjects=[];let i=!1,a=!1,o=null,s=!0,l=[],u=[];for(let r in t.attributes){let d=t.attributes[r];if(d.uri===e.RDF&&d.local===`version`){this.setVersion(n,d.value);continue}else if(d.uri===e.RDF)switch(d.local){case`resource`:if(o)throw this.newParseError(`Found both rdf:resource (${d.value}) and rdf:nodeID (${o}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${d.value})`);n.hadChildren=!0,o=d.value,s=!1;continue;case`datatype`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${d.value})`);n.datatype=this.valueToUri(d.value,n);continue;case`nodeID`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${d.value}).`);if(n.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${d.value})`);this.validateNcname(d.value),n.hadChildren=!0,o=d.value,s=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`parseType`:if(a)throw this.newParseError(`rdf:parseType is not allowed when non-rdf:* property attributes are present`);if(n.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${n.datatype.value})`);if(o)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${o})`);if(d.value===`Resource`){i=!0,n.childrenParseType=c.PROPERTY;let e=this.dataFactory.blankNode();this.emitTriple(n.subject,n.predicate,e,n.reifiedStatementId,n.childrenTripleTerms,n.reifier),n.subject=e,n.predicate=null}else d.value===`Collection`?(i=!0,n.hadChildren=!0,n.childrenCollectionSubject=n.subject,n.childrenCollectionPredicate=n.predicate,s=!1):d.value===`Literal`?(i=!0,n.childrenTagsToString=!0,n.childrenStringTags=[]):d.value===`Triple`&&(i=!0,n.childrenTagsToTripleTerms=!0,n.childrenTripleTerms=[]);continue;case`ID`:this.validateNcname(d.value),n.reifiedStatementId=this.valueToUri(`#`+d.value,n),this.claimNodeId(n.reifiedStatementId);continue;case`annotation`:n.reifier=this.dataFactory.namedNode(d.value);continue;case`annotationNodeID`:n.reifier=this.dataFactory.blankNode(d.value);continue}else if(d.uri===e.XML&&d.local===`lang`){n.language=d.value===``?null:d.value.toLowerCase();continue}else if(d.uri===e.ITS&&d.local===`dir`){this.setDirection(n,d.value);continue}else if(d.uri===e.ITS&&d.local===`version`)continue;if(d.prefix!==`xml`&&d.prefix!==`xmlns`&&(d.prefix!==``||d.local!==`xmlns`)&&d.uri){if(i||n.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${d.value}`);n.hadChildren=!0,a=!0,l.push(this.uriToNamedNode(d.uri+d.local)),u.push(this.createLiteral(d.value,n))}}if(o!==null){let e=n.subject;n.subject=s?this.dataFactory.blankNode(o):this.valueToUri(o,n),this.emitTriple(e,n.predicate,n.subject,n.reifiedStatementId,n.childrenTripleTerms,n.reifier);for(let e=0;e<l.length;e++)this.emitTriple(n.subject,l[e],u[e],null,n.childrenTripleTerms,n.reifier);n.predicateEmitted=!0}else s&&(n.predicateSubPredicates=l,n.predicateSubObjects=u,n.predicateEmitted=!1)}emitTriple(t,n,r,i,a,o){let s=this.dataFactory.quad(t,n,r,this.defaultGraph);a?a.push(s):this.push(s),o&&this.push(this.dataFactory.quad(o,this.dataFactory.namedNode(e.RDF+`reifies`),s)),i&&(this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`type`),this.dataFactory.namedNode(e.RDF+`Statement`),this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`subject`),t,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`predicate`),n,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`object`),r,this.defaultGraph)))}claimNodeId(e){if(!this.allowDuplicateRdfIds){if(this.nodeIds[e.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${e.value}'.`);this.nodeIds[e.value]=!0}}onText(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;t&&(t.childrenStringTags?t.childrenStringTags.push(e):t.predicate&&(t.text=e))}onCloseTag(){let t=this.activeTagStack.pop(),n=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(e.RDF+`XMLLiteral`),t.text=t.childrenStringTags.join(``),t.hadChildren=!1),t.childrenTagsToTripleTerms&&t.predicate&&t.rdfVersion){if(t.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${t.childrenTripleTerms.length}`);for(let e of t.childrenTripleTerms)this.emitTriple(t.subject,t.predicate,e,null,n.childrenTripleTerms,n.reifier);t.predicateEmitted=!0}if(t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(e.RDF+`nil`),null,t.childrenTripleTerms);else if(t.predicate){if(!t.hadChildren&&t.childrenParseType!==c.PROPERTY)this.emitTriple(t.subject,t.predicate,this.createLiteral(t.text||``,t),t.reifiedStatementId,t.childrenTripleTerms,t.reifier);else if(!t.predicateEmitted){let e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId,t.childrenTripleTerms,t.reifier);for(let n=0;n<t.predicateSubPredicates.length;n++)this.emitTriple(e,t.predicateSubPredicates[n],t.predicateSubObjects[n],null,t.childrenTripleTerms)}}}onDoctype(e){e.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(e,t,n)=>(this.saxParser.ENTITIES[t]=n,``))}setDirection(e,t){if(t){if(t!==`ltr`&&t!==`rtl`)throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${t}' was found.`);e.direction=t}else delete e.direction}setVersion(e,t){if(e.rdfVersion=t,this.emit(`version`,t),!this.isValidVersion(t))throw this.newParseError(`Detected unsupported version: ${t}`)}};e.RdfXmlParser=s,s.MIME_TYPE=`application/rdf+xml`,s.RDF=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,s.XML=`http://www.w3.org/XML/1998/namespace`,s.ITS=`http://www.w3.org/2005/11/its`,s.FORBIDDEN_NODE_ELEMENTS=[`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`li`,`aboutEach`,`aboutEachPrefix`],s.FORBIDDEN_PROPERTY_ELEMENTS=[`Description`,`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`aboutEach`,`aboutEachPrefix`],s.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,s.SUPPORTED_VERSIONS=[`1.2`,`1.2-basic`,`1.1`];var c;(function(e){e[e.RESOURCE=0]=`RESOURCE`,e[e.PROPERTY=1]=`PROPERTY`})(c||(e.ParseType=c={}))})),Dn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(En(),e)})),On=o(((e,t)=>{t.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){let{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){let t=e&&this._existing.get(e);if(t)return t;let n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}})),kn=o((()=>{(function(e,t){if(e.setImmediate)return;var n=1,r={},i=!1,a=e.document,o;function s(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];return r[n]={callback:e,args:t},o(n),n++}function c(e){delete r[e]}function l(e){var n=e.callback,r=e.args;switch(r.length){case 0:n();break;case 1:n(r[0]);break;case 2:n(r[0],r[1]);break;case 3:n(r[0],r[1],r[2]);break;default:n.apply(t,r);break}}function u(e){if(i)setTimeout(u,0,e);else{var t=r[e];if(t){i=!0;try{l(t)}finally{c(e),i=!1}}}}function d(){o=function(e){process.nextTick(function(){u(e)})}}function f(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}function p(){var t=`setImmediate$`+Math.random()+`$`,n=function(n){n.source===e&&typeof n.data==`string`&&n.data.indexOf(t)===0&&u(+n.data.slice(t.length))};e.addEventListener?e.addEventListener(`message`,n,!1):e.attachEvent(`onmessage`,n),o=function(n){e.postMessage(t+n,`*`)}}function m(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;u(t)},o=function(t){e.port2.postMessage(t)}}function h(){var e=a.documentElement;o=function(t){var n=a.createElement(`script`);n.onreadystatechange=function(){u(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}function g(){o=function(e){setTimeout(u,0,e)}}var _=Object.getPrototypeOf&&Object.getPrototypeOf(e);_=_&&_.setTimeout?_:e,{}.toString.call(e.process)===`[object process]`?d():f()?p():e.MessageChannel?m():a&&`onreadystatechange`in a.createElement(`script`)?h():g(),_.setImmediate=s,_.clearImmediate=c})(typeof self>`u`?typeof global>`u`?void 0:global:self)})),An=o((e=>{kn(),e.setImmediate=setImmediate,e.crypto=globalThis.crypto;var t=[];for(let e=0;e<=255;++e)t.push(e.toString(16).padStart(2,`0`));e.bufferToHex=function(e){let n=``,r=new Uint8Array(e);for(let e=0;e<r.length;++e)n+=t[r[e]];return n}})),jn=o(((e,t)=>{var{bufferToHex:n,crypto:r}=An(),i=new Map([[`sha256`,`SHA-256`],[`SHA256`,`SHA-256`],[`SHA-256`,`SHA-256`],[`sha384`,`SHA-384`],[`SHA384`,`SHA-384`],[`SHA-384`,`SHA-384`],[`sha512`,`SHA-512`],[`SHA512`,`SHA-512`],[`SHA-512`,`SHA-512`]]);t.exports=class{constructor(e){if(!(r&&r.subtle))throw Error(`crypto.subtle not found.`);if(!i.has(e))throw Error(`Unsupported algorithm "${e}".`);this.algorithm=i.get(e),this._content=``}update(e){this._content+=e}async digest(){let e=new TextEncoder().encode(this._content);return n(await r.subtle.digest(this.algorithm,e))}}})),Mn=o(((e,t)=>{t.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){let{current:e,dir:t}=this,n=e.slice(),r=null,i=0,a=e.length;for(let n=0;n<a;++n){let o=e[n],s=t.get(o);(r===null||o>r)&&(s&&n>0&&o>e[n-1]||!s&&n<a-1&&o>e[n+1])&&(r=o,i=n)}if(r===null)this.done=!0;else{let n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(let n of e)n>r&&t.set(n,!t.get(n))}return n}}})),Nn=o(((e,t)=>{var n=`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,r=`http://www.w3.org/2001/XMLSchema#string`,i=`NamedNode`,a=`BlankNode`,o=`Literal`,s={};s.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,s.empty=RegExp(`^[ \\t]*$`),s.quad=RegExp('^[ \\t]*(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)[ \\t]+(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$'),t.exports=class e{static parse(e){let t=[],l={},u=e.split(s.eoln),d=0;for(let e of u){if(d++,s.empty.test(e))continue;let u=e.match(s.quad);if(u===null)throw Error(`N-Quads parse error on line `+d+`.`);let f={subject:null,predicate:null,object:null,graph:null};if(u[1]===void 0?f.subject={termType:a,value:u[2]}:f.subject={termType:i,value:v(u[1])},f.predicate={termType:i,value:v(u[3])},u[4]===void 0?u[5]===void 0?(f.object={termType:o,value:void 0,datatype:{termType:i}},u[7]===void 0?u[8]===void 0?f.object.datatype.value=r:(f.object.datatype.value=n,f.object.language=u[8]):f.object.datatype.value=v(u[7]),f.object.value=p(u[6])):f.object={termType:a,value:u[5]}:f.object={termType:i,value:v(u[4])},u[9]===void 0?u[10]===void 0?f.graph={termType:`DefaultGraph`,value:``}:f.graph={termType:a,value:u[10]}:f.graph={termType:i,value:v(u[9])},!(f.graph.value in l))l[f.graph.value]=[f],t.push(f);else{let e=!0,n=l[f.graph.value];for(let t of n)if(c(t,f)){e=!1;break}e&&(n.push(f),t.push(f))}}return t}static serialize(t){let n=[];for(let r of t)n.push(e.serializeQuad(r));return n.sort().join(``)}static serializeQuadComponents(e,t,o,s){let c=``;return e.termType===i?c+=`<${g(e.value)}>`:c+=`_:${e.value}`,t.termType===i?c+=` <${g(t.value)}> `:c+=` _:${t.value} `,o.termType===i?c+=`<${g(o.value)}>`:o.termType===a?c+=`_:${o.value}`:(c+=`"${d(o.value)}"`,o.datatype.value===n?o.language&&(c+=`@${o.language}`):o.datatype.value!==r&&(c+=`^^<${g(o.datatype.value)}>`)),s.termType===i?c+=` <${g(s.value)}>`:s.termType===a&&(c+=` _:${s.value}`),c+=` .
24
24
  `,c}static serializeQuad(t){return e.serializeQuadComponents(t.subject,t.predicate,t.object,t.graph)}};function c(e,t){return!(e.subject.termType===t.subject.termType&&e.object.termType===t.object.termType)||!(e.subject.value===t.subject.value&&e.predicate.value===t.predicate.value&&e.object.value===t.object.value)?!1:e.object.termType!==o||e.object.datatype.termType===t.object.datatype.termType&&e.object.language===t.object.language&&e.object.datatype.value===t.object.datatype.value}var l=/[\u0000-\u001F\u007F"\\]/g,u=[];for(let e=0;e<=127;++e)l.test(String.fromCharCode(e))&&(u[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),l.lastIndex=0);u[`\b`.codePointAt(0)]=`\\b`,u[` `.codePointAt(0)]=`\\t`,u[`
25
25
  `.codePointAt(0)]=`\\n`,u[`\f`.codePointAt(0)]=`\\f`,u[`\r`.codePointAt(0)]=`\\r`,u[`"`.codePointAt(0)]=`\\"`,u[`\\`.codePointAt(0)]=`\\\\`;function d(e){return l.test(e)?e.replace(l,function(e){return u[e.codePointAt(0)]}):e}var f=/(?:\\([btnfr"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function p(e){return f.test(e)?e.replace(f,function(e,t,n,r){if(t)switch(t){case`b`:return`\b`;case`t`:return` `;case`n`:return`
26
- `;case`f`:return`\f`;case`r`:return`\r`;case`"`:return`"`;case`'`:return`'`;case`\\`:return`\\`}if(n)return String.fromCharCode(parseInt(n,16));if(r)return String.fromCodePoint(parseInt(r,16))}):e}var m=/[\u0000-\u0020<>"{}|^`\\]/g,h=[];for(let e=0;e<=127;++e)m.test(String.fromCharCode(e))&&(h[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),m.lastIndex=0);function g(e){return m.test(e)?e.replace(m,function(e){return h[e.codePointAt(0)]}):e}var _=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function v(e){return _.test(e)?e.replace(_,function(e,t,n){if(t)return String.fromCharCode(parseInt(t,16));if(n)return String.fromCodePoint(parseInt(n,16))}):e}})),Nn=o(((e,t)=>{var n=Dn(),r=An(),i=jn(),a=Mn(),{setImmediate:o}=kn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,signal:s=null}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.signal=s,this.quads=null}async main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()],i=0;for(let e of r)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let o=[...t.keys()].sort(),c=[];for(let e of o){let n=t.get(e);if(n.length>1){c.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=c.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of c){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=await this.hashNDegreeQuads(r,e);t.push(i)}t.sort(s);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let l=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));l.push(t)}return l.sort(),l.join(``)}async hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}async hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=await this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0){if(this.signal&&this.signal.aborted)throw Error(`Abort signal received: "${this.signal.reason}".`);await this._yield()}let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=await this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:await n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads,i=0;for(let a of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:a,component:a.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.graph,position:`g`,id:e,issuer:t,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=await this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}async _yield(){return new Promise(e=>o(e))}};function s(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),Pn=o(((e,t)=>{var n=Dn(),r=An(),i=jn(),a=Mn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,timeout:s=0}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.timeout=s,s>0&&(this.startTime=Date.now()),this.quads=null}main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()];for(let e of r)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let i=[...t.keys()].sort(),s=[];for(let e of i){let n=t.get(e);if(n.length>1){s.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=s.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of s){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=this.hashNDegreeQuads(r,e);t.push(i)}t.sort(o);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let c=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join(``)}hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0&&this.timeout>0&&Date.now()-this.startTime>this.timeout)throw Error(`Canonize timeout.`);let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads;for(let i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:`g`,id:e,issuer:t,hashToRelated:n});return n}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}};function o(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),Fn=o((e=>{var t=Nn(),n=Pn();function r(t,n){if(n.inputFormat){if(n.inputFormat===`application/n-quads`){if(typeof t!=`string`)throw Error(`N-Quads input must be a string.`);return e.NQuads.parse(t)}throw Error(`Unknown canonicalization input format: "${n.inputFormat}".`)}return t}function i(e){if(e.format&&e.format!==`application/n-quads`)throw Error(`Unknown canonicalization output format: "${e.format}".`)}function a(){globalThis.RDF_CANONIZE_TRACE_URDNA2015&&console.trace(`[rdf-canonize] URDNA2015 is deprecated, use RDFC-1.0`)}e.NQuads=Mn(),e.IdentifierIssuer=Dn(),e.canonize=async function(e,n={}){let o=r(e,n);if(i(n),!(`algorithm`in n))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(n.algorithm===`RDFC-1.0`)return new t(n).main(o);if(n.algorithm===`URDNA2015`&&!n.rejectURDNA2015)return a(),new t(n).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+n.algorithm)},e._canonizeSync=function(e,t={}){let o=r(e,t);if(i(t),!(`algorithm`in t))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(t.algorithm===`RDFC-1.0`)return new n(t).main(o);if(t.algorithm===`URDNA2015`&&!t.rejectURDNA2015)return a(),new n(t).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+t.algorithm)}})),In=o(((e,t)=>{t.exports=Fn()})),Ln=o(((e,t)=>{var n={};t.exports=n,n.isArray=Array.isArray,n.isBoolean=e=>typeof e==`boolean`||Object.prototype.toString.call(e)===`[object Boolean]`,n.isDouble=e=>n.isNumber(e)&&(String(e).indexOf(`.`)!==-1||Math.abs(e)>=1e21),n.isEmptyObject=e=>n.isObject(e)&&Object.keys(e).length===0,n.isNumber=e=>typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`,n.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),n.isObject=e=>Object.prototype.toString.call(e)===`[object Object]`,n.isString=e=>typeof e==`string`||Object.prototype.toString.call(e)===`[object String]`,n.isUndefined=e=>e===void 0})),Rn=o(((e,t)=>{var n=Ln(),r={};t.exports=r,r.isSubject=e=>n.isObject(e)&&!(`@value`in e||`@set`in e||`@list`in e)?Object.keys(e).length>1||!(`@id`in e):!1,r.isSubjectReference=e=>n.isObject(e)&&Object.keys(e).length===1&&`@id`in e,r.isValue=e=>n.isObject(e)&&`@value`in e,r.isList=e=>n.isObject(e)&&`@list`in e,r.isGraph=e=>n.isObject(e)&&`@graph`in e&&Object.keys(e).filter(e=>e!==`@id`&&e!==`@index`).length===1,r.isSimpleGraph=e=>r.isGraph(e)&&!(`@id`in e),r.isBlankNode=e=>{if(n.isObject(e)){if(`@id`in e){let t=e[`@id`];return!n.isString(t)||t.indexOf(`_:`)===0}return Object.keys(e).length===0||!(`@value`in e||`@set`in e||`@list`in e)}return!1}})),zn=o(((e,t)=>{t.exports=class extends Error{constructor(e=`An unspecified JSON-LD error occurred.`,t=`jsonld.Error`,n={}){super(e),this.name=t,this.message=e,this.details=n}}})),Bn=o(((e,t)=>{var n=Rn(),r=Ln(),i=In().IdentifierIssuer,a=zn(),o=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,c=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,l=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,d={headers:{accept:`application/ld+json, application/json`}},f={};t.exports=f,f.IdentifierIssuer=i,f.REGEX_BCP47=o,f.REGEX_KEYWORD=u,f.clone=function(e){if(e&&typeof e==`object`){let t;if(r.isArray(e)){t=[];for(let n=0;n<e.length;++n)t[n]=f.clone(e[n])}else if(e instanceof Map){t=new Map;for(let[n,r]of e)t.set(n,f.clone(r))}else if(e instanceof Set){t=new Set;for(let n of e)t.add(f.clone(n))}else if(r.isObject(e)){t={};for(let n in e)t[n]=f.clone(e[n])}else t=e.toString();return t}return e},f.asArray=function(e){return Array.isArray(e)?e:[e]},f.buildHeaders=(e={})=>{if(Object.keys(e).some(e=>e.toLowerCase()===`accept`))throw RangeError(`Accept header may not be specified; only "`+d.headers.accept+`" is supported.`);return Object.assign({Accept:d.headers.accept},e)},f.parseLinkHeader=e=>{let t={},n=e.match(s);for(let e=0;e<n.length;++e){let r=n[e].match(c);if(!r)continue;let i={target:r[1]},a=r[2];for(;r=l.exec(a);)i[r[1]]=r[2]===void 0?r[3]:r[2];let o=i.rel||``;Array.isArray(t[o])?t[o].push(i):t.hasOwnProperty(o)?t[o]=[t[o],i]:t[o]=i}return t},f.validateTypeValue=(e,t)=>{if(!r.isString(e)&&!(r.isArray(e)&&e.every(e=>r.isString(e)))){if(t&&r.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if(`@default`in e&&f.asArray(e[`@default`]).every(e=>r.isString(e)))return}throw new a(`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:e})}},f.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){let n=e[t];return!r.isArray(n)||n.length>0}return!1},f.hasValue=(e,t,i)=>{if(f.hasProperty(e,t)){let a=e[t],o=n.isList(a);if(r.isArray(a)||o){o&&(a=a[`@list`]);for(let e=0;e<a.length;++e)if(f.compareValues(i,a[e]))return!0}else if(!r.isArray(i))return f.compareValues(i,a)}return!1},f.addValue=(e,t,n,i)=>{if(i||={},`propertyIsArray`in i||(i.propertyIsArray=!1),`valueIsArray`in i||(i.valueIsArray=!1),`allowDuplicate`in i||(i.allowDuplicate=!0),`prependValue`in i||(i.prependValue=!1),i.valueIsArray)e[t]=n;else if(r.isArray(n)){n.length===0&&i.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),i.prependValue&&(n=n.concat(e[t]),e[t]=[]);for(let r=0;r<n.length;++r)f.addValue(e,t,n[r],i)}else if(e.hasOwnProperty(t)){let a=!i.allowDuplicate&&f.hasValue(e,t,n);!r.isArray(e[t])&&(!a||i.propertyIsArray)&&(e[t]=[e[t]]),a||(i.prependValue?e[t].unshift(n):e[t].push(n))}else e[t]=i.propertyIsArray?[n]:n},f.getValues=(e,t)=>[].concat(e[t]||[]),f.removeProperty=(e,t)=>{delete e[t]},f.removeValue=(e,t,n,r)=>{r||={},`propertyIsArray`in r||(r.propertyIsArray=!1);let i=f.getValues(e,t).filter(e=>!f.compareValues(e,n));i.length===0?f.removeProperty(e,t):i.length===1&&!r.propertyIsArray?e[t]=i[0]:e[t]=i},f.relabelBlankNodes=(e,t)=>(t||={},p(t.issuer||new i(`_:b`),e)),f.compareValues=(e,t)=>e===t||n.isValue(e)&&n.isValue(t)&&e[`@value`]===t[`@value`]&&e[`@type`]===t[`@type`]&&e[`@language`]===t[`@language`]&&e[`@index`]===t[`@index`]?!0:r.isObject(e)&&`@id`in e&&r.isObject(t)&&`@id`in t?e[`@id`]===t[`@id`]:!1,f.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1;function p(e,t){if(r.isArray(t))for(let n=0;n<t.length;++n)t[n]=p(e,t[n]);else if(n.isList(t))t[`@list`]=p(e,t[`@list`]);else if(r.isObject(t)){n.isBlankNode(t)&&(t[`@id`]=e.getId(t[`@id`]));let r=Object.keys(t).sort();for(let n=0;n<r.length;++n){let i=r[n];i!==`@id`&&(t[i]=p(e,t[i]))}}return t}})),Vn=o(((e,t)=>{t.exports={LINK_HEADER_REL:`http://www.w3.org/ns/json-ld#context`,LINK_HEADER_CONTEXT:`http://www.w3.org/ns/json-ld#context`,RDF:`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,RDF_LIST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#List`,RDF_FIRST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`,RDF_REST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`,RDF_NIL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#nil`,RDF_TYPE:`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`,RDF_PLAIN_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral`,RDF_XML_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral`,RDF_JSON_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON`,RDF_OBJECT:`http://www.w3.org/1999/02/22-rdf-syntax-ns#object`,RDF_LANGSTRING:`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,XSD:`http://www.w3.org/2001/XMLSchema#`,XSD_BOOLEAN:`http://www.w3.org/2001/XMLSchema#boolean`,XSD_DOUBLE:`http://www.w3.org/2001/XMLSchema#double`,XSD_INTEGER:`http://www.w3.org/2001/XMLSchema#integer`,XSD_STRING:`http://www.w3.org/2001/XMLSchema#string`}})),Hn=o(((e,t)=>{t.exports=class{constructor(){this._requests={}}wrapLoader(e){let t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}})),Un=o(((e,t)=>{var n=Ln(),r={};t.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:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(e,t)=>{let n={},i=r.parsers[t||`full`],a=i.regex.exec(e),o=i.keys.length;for(;o--;)n[i.keys[o]]=a[o]===void 0?null:a[o];return(n.scheme===`https`&&n.port===`443`||n.scheme===`http`&&n.port===`80`)&&(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=(e,t)=>{if(e===null||r.isAbsolute(t))return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=r.parse(t),a={protocol:e.protocol||``};if(i.authority!==null)a.authority=i.authority,a.path=i.path,a.query=i.query;else if(a.authority=e.authority,i.path===``)a.path=e.path,i.query===null?a.query=e.query:a.query=i.query;else{if(i.path.indexOf(`/`)===0)a.path=i.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf(`/`)+1),(t.length>0||e.authority)&&t.substr(-1)!==`/`&&(t+=`/`),t+=i.path,a.path=t}a.query=i.query}i.path!==``&&(a.path=r.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+=`//`+a.authority),o+=a.path,a.query!==null&&(o+=`?`+a.query),i.fragment!==null&&(o+=`#`+i.fragment),o===``&&(o=`./`),o},r.removeBase=(e,t)=>{if(e===null)return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=``;if(e.href===``?t.indexOf(`//`)&&(i+=`//`):i+=(e.protocol||``)+`//`+(e.authority||``),t.indexOf(i)!==0)return t;let a=r.parse(t.substr(i.length)),o=e.normalizedPath.split(`/`),s=a.normalizedPath.split(`/`),c=a.fragment||a.query?0:1;for(;o.length>0&&s.length>c&&o[0]===s[0];)o.shift(),s.shift();let l=``;if(o.length>0){o.pop();for(let e=0;e<o.length;++e)l+=`../`}return l+=s.join(`/`),a.query!==null&&(l+=`?`+a.query),a.fragment!==null&&(l+=`#`+a.fragment),l===``&&(l=`./`),l},r.removeDotSegments=e=>{if(e.length===0)return``;let t=e.split(`/`),n=[];for(;t.length>0;){let e=t.shift(),r=t.length===0;if(e===`.`){r&&n.push(``);continue}if(e===`..`){n.pop(),r&&n.push(``);continue}n.push(e)}return e[0]===`/`&&n.length>0&&n[0]!==``&&n.unshift(``),n.length===1&&n[0]===``?`/`:n.join(`/`)};var i=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;r.isAbsolute=e=>n.isString(e)&&i.test(e),r.isRelative=e=>n.isString(e)})),Wn=o(((e,t)=>{var{parseLinkHeader:n,buildHeaders:r}=Bn(),{LINK_HEADER_CONTEXT:i}=Vn(),a=zn(),o=Hn(),{prependBase:s}=Un(),c=/(^|(\r\n))link:/i;t.exports=({secure:e,headers:t={},xhr:u}={headers:{}})=>{return t=r(t),new o().wrapLoader(d);async function d(r){if(r.indexOf(`http:`)!==0&&r.indexOf(`https:`)!==0)throw new a(`URL could not be dereferenced; only "http" and "https" URLs are supported.`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});if(e&&r.indexOf(`https`)!==0)throw new a(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});let o;try{o=await l(u,r,t)}catch(e){throw new a(`URL could not be dereferenced, an error occurred.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,cause:e})}if(o.status>=400)throw new a(`URL could not be dereferenced: `+o.statusText,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,httpStatusCode:o.status});let f={contextUrl:null,documentUrl:r,document:o.response},p=null,m=o.getResponseHeader(`Content-Type`),h;if(c.test(o.getAllResponseHeaders())&&(h=o.getResponseHeader(`Link`)),h&&m!==`application/ld+json`){let e=n(h),t=e[i];if(Array.isArray(t))throw new a(`URL could not be dereferenced, it has more than one associated HTTP Link Header.`,`jsonld.InvalidUrl`,{code:`multiple context link headers`,url:r});t&&(f.contextUrl=t.target),p=e.alternate,p&&p.type==`application/ld+json`&&!(m||``).match(/^application\/(\w*\+)?json$/)&&(f=await d(s(r,p.target)))}return f}};function l(e,t,n){e||=XMLHttpRequest;let r=new e;return new Promise((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open(`GET`,t,!0);for(let e in n)r.setRequestHeader(e,n[e]);r.send()})}})),Gn=o(((e,t)=>{var n=Wn(),r={};t.exports=r,r.setupDocumentLoaders=function(e){typeof XMLHttpRequest<`u`&&(e.documentLoaders.xhr=n,e.useDocumentLoader(`xhr`))},r.setupGlobals=function(e){globalThis.JsonLdProcessor===void 0&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}})),Kn=o(((e,t)=>{t.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}})),qn=o(((e,t)=>{t.exports=n,n.Node=o,n.create=n;function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach==`function`)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}n.prototype.removeNode=function(e){if(e.list!==this)throw Error(`removing node which does not belong to this list`);var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||=e,this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||=e,this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t||=this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t||=this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value},n.prototype.map=function(e,t){t||=this;for(var r=new n,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t||=this;for(var r=new n,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=0;r!==null;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=this.length-1;r!==null;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(;a!==null&&i<t;i++,a=a.next)r.push(a.value);return r},n.prototype.sliceReverse=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,a=this.tail;a!==null&&i>t;i--)a=a.prev;for(;a!==null&&i>e;i--,a=a.prev)r.push(a.value);return r},n.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(var o=[],i=0;a&&i<t;i++)o.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var i=0;i<n.length;i++)a=r(this,a,n[i]);return o},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function r(e,t,n){var r=t===e.head?new o(n,null,t,e):new o(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function i(e,t){e.tail=new o(t,e.tail,null,e),e.head||=e.tail,e.length++}function a(e,t){e.head=new o(t,null,e.head,e),e.tail||=e.head,e.length++}function o(e,t,n,r){if(!(this instanceof o))return new o(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{Kn()(n)}catch{}})),Jn=o(((e,t)=>{var n=qn(),r=Symbol(`max`),i=Symbol(`length`),a=Symbol(`lengthCalculator`),o=Symbol(`allowStale`),s=Symbol(`maxAge`),c=Symbol(`dispose`),l=Symbol(`noDisposeOnSet`),u=Symbol(`lruList`),d=Symbol(`cache`),f=Symbol(`updateAgeOnGet`),p=()=>1,m=class{constructor(e){if(typeof e==`number`&&(e={max:e}),e||={},e.max&&(typeof e.max!=`number`||e.max<0))throw TypeError(`max must be a non-negative number`);this[r]=e.max||1/0;let t=e.length||p;if(this[a]=typeof t==`function`?t:p,this[o]=e.stale||!1,e.maxAge&&typeof e.maxAge!=`number`)throw TypeError(`maxAge must be a number`);this[s]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!=`number`||e<0)throw TypeError(`max must be a non-negative number`);this[r]=e||1/0,_(this)}get max(){return this[r]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=`number`)throw TypeError(`maxAge must be a non-negative number`);this[s]=e,_(this)}get maxAge(){return this[s]}set lengthCalculator(e){typeof e!=`function`&&(e=p),e!==this[a]&&(this[a]=e,this[i]=0,this[u].forEach(e=>{e.length=this[a](e.value,e.key),this[i]+=e.length})),_(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t||=this;for(let n=this[u].tail;n!==null;){let r=n.prev;b(this,e,n,t),n=r}}forEach(e,t){t||=this;for(let n=this[u].head;n!==null;){let r=n.next;b(this,e,n,t),n=r}}keys(){return this[u].toArray().map(e=>e.key)}values(){return this[u].toArray().map(e=>e.value)}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[u]=new n,this[i]=0}dump(){return this[u].map(e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[u]}set(e,t,n){if(n||=this[s],n&&typeof n!=`number`)throw TypeError(`maxAge must be a number`);let o=n?Date.now():0,f=this[a](t,e);if(this[d].has(e)){if(f>this[r])return v(this,this[d].get(e)),!1;let a=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,a.value)),a.now=o,a.maxAge=n,a.value=t,this[i]+=f-a.length,a.length=f,this.get(e),_(this),!0}let p=new y(e,t,f,o,n);return p.length>this[r]?(this[c]&&this[c](e,t),!1):(this[i]+=p.length,this[u].unshift(p),this[d].set(e,this[u].head),_(this),!0)}has(e){if(!this[d].has(e))return!1;let t=this[d].get(e).value;return!g(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){let e=this[u].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[d].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(i===0)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>h(this,t,!1))}},h=(e,t,n)=>{let r=e[d].get(t);if(r){let t=r.value;if(g(e,t)){if(v(e,r),!e[o])return}else n&&(e[f]&&(r.value.now=Date.now()),e[u].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[s]&&n>e[s]},_=e=>{if(e[i]>e[r])for(let t=e[u].tail;e[i]>e[r]&&t!==null;){let n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){let n=t.value;e[c]&&e[c](n.key,n.value),e[i]-=n.length,e[d].delete(n.key),e[u].removeNode(t)}},y=class{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}},b=(e,t,n,r)=>{let i=n.value;g(e,i)&&(v(e,n),e[o]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};t.exports=m})),Yn=o(((e,t)=>{var n=Jn(),r=10;t.exports=class{constructor({document:e}){this.document=e,this.cache=new n({max:r})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}})),Xn=o(((e,t)=>{var{isArray:n,isObject:r,isString:i}=Ln(),{asArray:a}=Bn(),{prependBase:o}=Un(),s=zn(),c=Yn(),l=10;t.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:o,base:s,cycles:l=new Set}){t&&r(t)&&t[`@context`]&&(t=t[`@context`]),t=a(t);let d=[];for(let a of t){if(i(a)){let t=this._get(a);t||=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:o,base:s,cycles:l}),n(t)?d.push(...t):d.push(t);continue}if(a===null){d.push(new c({document:null}));continue}r(a)||u(t);let f=JSON.stringify(a),p=this._get(f);p||(p=new c({document:a}),this._cacheResolvedContext({key:f,resolved:p,tag:`static`})),d.push(p)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){let n=this.sharedCache.get(e);n&&(t=n.get(`static`),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),n!==void 0){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:i}){t=o(r,t);let{context:a,remoteDoc:s}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:i});r=s.documentUrl||t,d({context:a,base:r});let c=await this.resolve({activeCtx:e,context:a,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:t,resolved:c,tag:s.tag}),c}async _fetchContext({activeCtx:e,url:t,documentLoader:a,cycles:o}){if(o.size>l)throw new s(`Maximum number of @context URLs exceeded.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`loading remote context failed`:`context overflow`,max:l});if(o.has(t))throw new s(`Cyclical @context URLs detected.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`recursive context inclusion`:`context overflow`,url:t});o.add(t);let c,u;try{u=await a(t),c=u.document||null,i(c)&&(c=JSON.parse(c))}catch(e){throw new s(`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. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`loading remote context failed`,url:t,cause:e})}if(!r(c))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`invalid remote context`,url:t});return c=`@context`in c?{"@context":c[`@context`]}:{"@context":{}},u.contextUrl&&(n(c[`@context`])||(c[`@context`]=[c[`@context`]]),c[`@context`].push(u.contextUrl)),{context:c,remoteDoc:u}}};function u(e){throw new s(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:e})}function d({context:e,base:t}){if(!e)return;let a=e[`@context`];if(i(a)){e[`@context`]=o(t,a);return}if(n(a)){for(let e=0;e<a.length;++e){let n=a[e];if(i(n)){a[e]=o(t,n);continue}r(n)&&d({context:{"@context":n},base:t})}return}if(r(a))for(let e in a)d({context:a[e],base:t})}})),Zn=o(((e,t)=>{t.exports=In().NQuads})),Qn=o(((e,t)=>{var n=zn(),{isArray:r}=Ln(),{asArray:i}=Bn(),a={};t.exports=a,a.defaultEventHandler=null,a.setupEventHandler=({options:e={}})=>{let t=[].concat(e.safe?a.safeEventHandler:[],e.eventHandler?i(e.eventHandler):[],a.defaultEventHandler?a.defaultEventHandler:[]);return t.length===0?null:t},a.handleEvent=({event:e,options:t})=>{o({event:e,handlers:t.eventHandler})};function o({event:e,handlers:t}){let i=!0;for(let a=0;i&&a<t.length;++a){i=!1;let s=t[a];if(r(s))i=o({event:e,handlers:s});else if(typeof s==`function`)s({event:e,next:()=>{i=!0}});else if(typeof s==`object`)e.code in s?s[e.code]({event:e,next:()=>{i=!0}}):i=!0;else throw new n(`Invalid event handler.`,`jsonld.InvalidEventHandler`,{event:e})}return i}var s=new Set([`empty object`,`free-floating scalar`,`invalid @language value`,`invalid property`,`null @id value`,`null @value value`,`object with only @id`,`object with only @language`,`object with only @list`,`object with only @value`,`relative @id reference`,`relative @type reference`,`relative @vocab reference`,`reserved @id value`,`reserved @reverse value`,`reserved term`,`blank node predicate`,`relative graph reference`,`relative object reference`,`relative predicate reference`,`relative subject reference`,`rdfDirection not set`]);a.safeEventHandler=function({event:e,next:t}){if(e.level===`warning`&&s.has(e.code))throw new n(`Safe mode validation error.`,`jsonld.ValidationError`,{event:e});t()},a.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},a.logWarningEventHandler=function({event:e,next:t}){e.level===`warning`&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},a.unhandledEventHandler=function({event:e}){throw new n(`No handler for event.`,`jsonld.UnhandledEvent`,{event:e})},a.setDefaultEventHandler=function({eventHandler:e}={}){a.defaultEventHandler=e?i(e):null}})),$n=o(((e,t)=>{var n=Bn(),r=zn(),{isArray:i,isObject:a,isString:o,isUndefined:s}=Ln(),{isAbsolute:c,isRelative:l,prependBase:u}=Un(),{handleEvent:d}=Qn(),{REGEX_BCP47:f,REGEX_KEYWORD:p,asArray:m,compareShortestLeast:h}=Bn(),g=new Map,_=1e4,v={};t.exports=v,v.process=async({activeCtx:e,localCtx:t,options:n,propagate:s=!0,overrideProtected:p=!1,cycles:h=new Set})=>{if(a(t)&&`@context`in t&&i(t[`@context`])&&(t=t[`@context`]),m(t).length===0)return e;let g=[],_=[({event:e,next:t})=>{g.push(e),t()}];n.eventHandler&&_.push(n.eventHandler);let b=n;n={...n,eventHandler:_};let x=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(x[0].document)&&typeof x[0].document[`@propagate`]==`boolean`&&(s=x[0].document[`@propagate`]);let S=e;!s&&!S.previousContext&&(S=S.clone(),S.previousContext=e);for(let i of x){let{document:s}=i;if(e=S,s===null){if(!p&&Object.keys(e.protected).length!==0)throw new r(`Tried to nullify a context with protected terms outside of a term definition.`,`jsonld.SyntaxError`,{code:`invalid context nullification`});S=e=v.getInitialContext(n).clone();continue}let m=i.getProcessed(e);if(m){if(b.eventHandler)for(let e of m.events)d({event:e,options:b});S=e=m.context;continue}if(a(s)&&`@context`in s&&(s=s[`@context`]),!a(s))throw new r(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:s});S=S.clone();let _=new Map;if(`@version`in s){if(s[`@version`]!==1.1)throw new r(`Unsupported JSON-LD version: `+s[`@version`],`jsonld.UnsupportedVersion`,{code:`invalid @version value`,context:s});if(e.processingMode&&e.processingMode===`json-ld-1.0`)throw new r(`@version: `+s[`@version`]+` not compatible with `+e.processingMode,`jsonld.ProcessingModeConflict`,{code:`processing mode conflict`,context:s});S.processingMode=`json-ld-1.1`,S[`@version`]=s[`@version`],_.set(`@version`,!0)}if(S.processingMode=S.processingMode||e.processingMode,`@base`in s){let e=s[`@base`];if(!(e===null||c(e)))if(l(e))e=u(S[`@base`],e);else 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:s});S[`@base`]=e,_.set(`@base`,!0)}if(`@vocab`in s){let e=s[`@vocab`];if(e===null)delete S[`@vocab`];else if(!o(e))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:s});else if(!c(e)&&v.processingMode(S,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:s});else{let t=y(S,e,{vocab:!0,base:!0},void 0,void 0,n);c(t)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`relative @vocab reference`,level:`warning`,message:`Relative @vocab reference found.`,details:{vocab:t}},options:n}),S[`@vocab`]=t}_.set(`@vocab`,!0)}if(`@language`in s){let e=s[`@language`];if(e===null)delete S[`@language`];else if(o(e))e.match(f)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:n}),S[`@language`]=e.toLowerCase();else 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:s});_.set(`@language`,!0)}if(`@direction`in s){let t=s[`@direction`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @direction not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context member`,context:s});if(t===null)delete S[`@direction`];else if(t!==`ltr`&&t!==`rtl`)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:s});else S[`@direction`]=t;_.set(`@direction`,!0)}if(`@propagate`in s){let n=s[`@propagate`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @propagate not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(typeof n!=`boolean`)throw new r(`Invalid JSON-LD syntax; @propagate value must be a boolean.`,`jsonld.SyntaxError`,{code:`invalid @propagate value`,context:t});_.set(`@propagate`,!0)}if(`@import`in s){let i=s[`@import`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @import not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(!o(i))throw new r(`Invalid JSON-LD syntax; @import must be a string.`,`jsonld.SyntaxError`,{code:`invalid @import value`,context:t});let a=await n.contextResolver.resolve({activeCtx:e,context:i,documentLoader:n.documentLoader,base:n.base});if(a.length!==1)throw new r(`Invalid JSON-LD syntax; @import must reference a single context.`,`jsonld.SyntaxError`,{code:`invalid remote context`,context:t});let c=a[0].getProcessed(e);if(c)s=c;else{let n=a[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:t});for(let e in n)s.hasOwnProperty(e)||(s[e]=n[e]);a[0].setProcessed(e,s)}_.set(`@import`,!0)}_.set(`@protected`,s[`@protected`]||!1);for(let e in s)if(v.createTermDefinition({activeCtx:S,localCtx:s,term:e,defined:_,options:n,overrideProtected:p}),a(s[e])&&`@context`in s[e]){let t=s[e][`@context`],i=!0;if(o(t)){let e=u(n.base,t);h.has(e)?i=!1:h.add(e)}if(i)try{await v.process({activeCtx:S.clone(),localCtx:s[e][`@context`],overrideProtected:!0,options:n,cycles:h})}catch{throw new r(`Invalid JSON-LD syntax; invalid scoped context.`,`jsonld.SyntaxError`,{code:`invalid scoped context`,context:s[e][`@context`],term:e})}}i.setProcessed(e,{context:S,events:g})}return S},v.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:s,options:l,overrideProtected:u=!1})=>{if(s.has(n)){if(s.get(n))return;throw new r(`Cyclical context definition detected.`,`jsonld.CyclicalContext`,{code:`cyclic IRI mapping`,context:t,term:n})}s.set(n,!1);let f;if(t.hasOwnProperty(n)&&(f=t[n]),n===`@type`&&a(f)&&(f[`@container`]||`@set`)===`@set`&&v.processingMode(e,1.1)){let e=[`@container`,`@id`,`@protected`],i=Object.keys(f);if(i.length===0||i.some(t=>!e.includes(t)))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n})}else if(v.isKeyword(n))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n});else if(n.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved term`,level:`warning`,message:`Terms beginning with "@" are reserved for future use and dropped.`,details:{term:n}},options:l});return}else if(n===``)throw new r(`Invalid JSON-LD syntax; a term cannot be an empty string.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let m=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let h=!1;if((o(f)||f===null)&&(h=!0,f={"@id":f}),!a(f))throw new r(`Invalid JSON-LD syntax; @context term values must be strings or objects.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let g={};e.mappings.set(n,g),g.reverse=!1;let _=[`@container`,`@id`,`@language`,`@reverse`,`@type`];v.processingMode(e,1.1)&&_.push(`@context`,`@direction`,`@index`,`@nest`,`@prefix`,`@protected`);for(let e in f)if(!_.includes(e))throw new r(`Invalid JSON-LD syntax; a term definition must not contain `+e,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let x=n.indexOf(`:`);if(g._termHasColon=x>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:t});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:t});let i=f[`@reverse`];if(!o(i))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @reverse value`,level:`warning`,message:`@reverse values beginning with "@" are reserved for future use and dropped.`,details:{reverse:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}let a=y(e,i,{vocab:!0,base:!1},t,s,l);if(!c(a))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:t});g[`@id`]=a,g.reverse=!0}else if(`@id`in f){let i=f[`@id`];if(i&&!o(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:t});if(i===null)g[`@id`]=null;else if(!v.isKeyword(i)&&i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`@id values beginning with "@" are reserved for future use and dropped.`,details:{id:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}else if(i!==n){if(i=y(e,i,{vocab:!0,base:!1},t,s,l),!c(i)&&!v.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:t});if(n.match(/(?::[^:])|\//)&&y(e,n,{vocab:!0,base:!1},t,new Map(s).set(n,!0),l)!==i)throw new r(`Invalid JSON-LD syntax; term in form of IRI must expand to definition.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=i,g._prefix=h&&!g._termHasColon&&i.match(/[:\/\?#\[\]@]$/)!==null}}if(!(`@id`in g))if(g._termHasColon){let r=n.substr(0,x);if(t.hasOwnProperty(r)&&v.createTermDefinition({activeCtx:e,localCtx:t,term:r,defined:s,options:l}),e.mappings.has(r)){let t=n.substr(x+1);g[`@id`]=e.mappings.get(r)[`@id`]+t}else g[`@id`]=n}else if(n===`@type`)g[`@id`]=n;else{if(!(`@vocab`in e))throw new r(`Invalid JSON-LD syntax; @context terms must define an @id.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t,term:n});g[`@id`]=e[`@vocab`]+n}if((f[`@protected`]===!0||s.get(`@protected`)===!0&&f[`@protected`]!==!1)&&(e.protected[n]=!0,g.protected=!0),s.set(n,!0),`@type`in f){let n=f[`@type`];if(!o(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be a string.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n===`@json`||n===`@none`){if(v.processingMode(e,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:t})}else if(n!==`@id`&&n!==`@vocab`){if(n=y(e,n,{vocab:!0,base:!1},t,s,l),!c(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n.indexOf(`_:`)===0)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:t})}g[`@type`]=n}if(`@container`in f){let n=o(f[`@container`])?[f[`@container`]]:f[`@container`]||[],a=[`@list`,`@set`,`@index`,`@language`],s=!0,c=n.includes(`@set`);if(v.processingMode(e,1.1)){if(a.push(`@graph`,`@id`,`@type`),n.includes(`@list`)){if(n.length!==1)throw new r(`Invalid JSON-LD syntax; @context @container with @list must have no other values`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else if(n.includes(`@graph`)){if(n.some(e=>e!==`@graph`&&e!==`@id`&&e!==`@index`&&e!==`@set`))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:t})}else s&=n.length<=(c?2:1);if(n.includes(`@type`)&&(g[`@type`]=g[`@type`]||`@id`,![`@id`,`@vocab`].includes(g[`@type`])))throw new r(`Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else s&=!i(f[`@container`]),s&=n.length<=1;if(s&=n.every(e=>a.includes(e)),s&=!(c&&n.includes(`@list`)),!s)throw new r(`Invalid JSON-LD syntax; @context @container value must be one of the following: `+a.join(`, `),`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t});if(g.reverse&&!n.every(e=>[`@index`,`@set`].includes(e)))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:t});g[`@container`]=n}if(`@index`in f){if(!(`@container`in f)||!g[`@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:t});if(!o(f[`@index`])||f[`@index`].indexOf(`@`)===0)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:t});g[`@index`]=f[`@index`]}if(`@context`in f&&(g[`@context`]=f[`@context`]),`@language`in f&&!(`@type`in f)){let e=f[`@language`];if(e!==null&&!o(e))throw new r(`Invalid JSON-LD syntax; @context @language value must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid language mapping`,context:t});e!==null&&(e=e.toLowerCase()),g[`@language`]=e}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:t});if(v.isKeyword(g[`@id`]))throw new r(`Invalid JSON-LD syntax; keywords may not be used as prefixes`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(typeof f[`@prefix`]==`boolean`)g._prefix=f[`@prefix`]===!0;else throw new r(`Invalid JSON-LD syntax; @context value for @prefix must be boolean`,`jsonld.SyntaxError`,{code:`invalid @prefix value`,context:t})}if(`@direction`in f){let e=f[`@direction`];if(e!==null&&e!==`ltr`&&e!==`rtl`)throw new r(`Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:t});g[`@direction`]=e}if(`@nest`in f){let e=f[`@nest`];if(!o(e)||e!==`@nest`&&e.indexOf(`@`)===0)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:t});g[`@nest`]=e}let S=g[`@id`];if(S===`@context`||S===`@preserve`)throw new r(`Invalid JSON-LD syntax; @context and @preserve cannot be aliased.`,`jsonld.SyntaxError`,{code:`invalid keyword alias`,context:t});if(m&&m.protected&&!u&&(e.protected[n]=!0,g.protected=!0,!b(m,g)))throw new r(`Invalid JSON-LD syntax; tried to redefine a protected term.`,`jsonld.SyntaxError`,{code:`protected term redefinition`,context:t,term:n})},v.expandIri=(e,t,n,r)=>y(e,t,n,void 0,void 0,r);function y(e,t,n,r,i,s){if(t===null||!o(t)||v.isKeyword(t))return t;if(t.match(p))return null;if(r&&r.hasOwnProperty(t)&&i.get(t)!==!0&&v.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:i,options:s}),n||={},n.vocab){let n=e.mappings.get(t);if(n===null)return null;if(a(n)&&`@id`in n)return n[`@id`]}let l=t.indexOf(`:`);if(l>0){let n=t.substr(0,l),a=t.substr(l+1);if(n===`_`||a.indexOf(`//`)===0)return t;r&&r.hasOwnProperty(n)&&v.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:i,options:s});let o=e.mappings.get(n);if(o&&o._prefix)return o[`@id`]+a;if(c(t))return t}if(n.vocab&&`@vocab`in e)t=e[`@vocab`]+t;else if(n.base){let n,r;`@base`in e?e[`@base`]?(r=u(s.base,e[`@base`]),n=u(r,t)):(r=e[`@base`],n=t):(r=s.base,n=u(s.base,t)),t=n}return t}v.getInitialContext=e=>{let t=JSON.stringify({processingMode:e.processingMode}),r=g.get(t);if(r)return r;let i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:a,clone:c,revertToPreviousContext:l,protected:{}};return g.size===_&&g.clear(),g.set(t,i),i;function a(){let e=this;if(e.inverse)return e.inverse;let t=e.inverse={},n=e.fastCurieMap={},r={},i=(e[`@language`]||`@none`).toLowerCase(),a=e[`@direction`],c=e.mappings,l=[...c.keys()].sort(h);for(let e of l){let o=c.get(e);if(o===null)continue;let l=o[`@container`]||`@none`;if(l=[].concat(l).sort().join(``),o[`@id`]===null)continue;let u=m(o[`@id`]);for(let c of u){let u=t[c],d=v.isKeyword(c);if(u)!d&&!o._termHasColon&&r[c].push(e);else if(t[c]=u={},!d&&!o._termHasColon){r[c]=[e];let t={iri:c,terms:r[c]};c[0]in n?n[c[0]].push(t):n[c[0]]=[t]}if(u[l]||(u[l]={"@language":{},"@type":{},"@any":{}}),u=u[l],s(e,u[`@any`],`@none`),o.reverse)s(e,u[`@type`],`@reverse`);else if(o[`@type`]===`@none`)s(e,u[`@any`],`@none`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`);else if(`@type`in o)s(e,u[`@type`],o[`@type`]);else if(`@language`in o&&`@direction`in o){let t=o[`@language`],n=o[`@direction`];t&&n?s(e,u[`@language`],`${t}_${n}`.toLowerCase()):t?s(e,u[`@language`],t.toLowerCase()):n?s(e,u[`@language`],`_${n}`):s(e,u[`@language`],`@null`)}else`@language`in o?s(e,u[`@language`],(o[`@language`]||`@null`).toLowerCase()):`@direction`in o?o[`@direction`]?s(e,u[`@language`],`_${o[`@direction`]}`):s(e,u[`@language`],`@none`):a?(s(e,u[`@language`],`_${a}`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`)):(s(e,u[`@language`],i),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`))}}for(let e in n)o(n,e,1);return t}function o(e,t,n){let r=e[t],i=e[t]={},a,s;for(let e of r)a=e.iri,s=n>=a.length?``:a[n],s in i?i[s].push(e):i[s]=[e];for(let e in i)e!==``&&o(i,e,n+1)}function s(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}function c(){let e={};return e.mappings=n.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=n.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,`@base`in this&&(e[`@base`]=this[`@base`]),`@language`in this&&(e[`@language`]=this[`@language`]),`@vocab`in this&&(e[`@vocab`]=this[`@vocab`]),e}function l(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(e,t,n)=>{if(t===null)return n===`@context`?void 0:null;if(e.mappings.has(t)){let r=e.mappings.get(t);if(s(n))return r;if(r.hasOwnProperty(n))return r[n]}if(n===`@language`&&n in e||n===`@direction`&&n in e)return e[n];if(n!==`@context`)return null},v.processingMode=(e,t)=>t.toString()>=`1.1`?!e.processingMode||e.processingMode>=`json-ld-`+t.toString():e.processingMode===`json-ld-1.0`,v.isKeyword=e=>{if(!o(e)||e[0]!==`@`)return!1;switch(e){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};function b(e,t){if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return e===t;let n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!b(e[n],t[n]))return!1;return!0}let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let n in e){let r=e[n],i=t[n];if(n===`@container`&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!b(r,i))return!1}return!0}})),er=o(((e,t)=>{var n=zn(),{isArray:r,isObject:i,isEmptyObject:a,isString:o,isUndefined:s}=Ln(),{isList:c,isValue:l,isGraph:u,isSubject:d}=Rn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=$n(),{isAbsolute:_}=Un(),{REGEX_BCP47:v,REGEX_KEYWORD:y,addValue:b,asArray:x,getValues:S,validateTypeValue:C}=Bn(),{handleEvent:w}=Qn(),T={};t.exports=T,T.expand=async({activeCtx:e,activeProperty:t=null,element:c,options:l={},insideList:u=!1,insideIndex:d=!1,typeScopedContext:m=null})=>{if(c==null)return null;if(t===`@default`&&(l=Object.assign({},l,{isFrame:!1})),!r(c)&&!i(c))return!u&&(t===null||f(e,t,{vocab:!0},l)===`@graph`)?(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`free-floating scalar`,level:`warning`,message:`Dropping free-floating scalar not in a list.`,details:{value:c}},options:l}),null):O({activeCtx:e,activeProperty:t,value:c,options:l});if(r(c)){let n=[],i=p(e,t,`@container`)||[];u||=i.includes(`@list`);for(let i=0;i<c.length;++i){let a=await T.expand({activeCtx:e,activeProperty:t,element:c[i],options:l,insideIndex:d,typeScopedContext:m});u&&r(a)&&(a={"@list":a}),a!==null&&(r(a)?n=n.concat(a):n.push(a))}return n}let v=f(e,t,{vocab:!0},l),y=p(e,t,`@context`);m||=e.previousContext?e:null;let b=Object.keys(c).sort(),C=!d;if(C&&m&&b.length<=2&&!b.includes(`@context`))for(let t of b){let n=f(m,t,{vocab:!0},l);if(n===`@value`){C=!1,e=m;break}if(n===`@id`&&b.length===1){C=!1;break}}C&&(e=e.revertToPreviousContext()),s(y)||(e=await h({activeCtx:e,localCtx:y,propagate:!0,overrideProtected:!0,options:l})),`@context`in c&&(e=await h({activeCtx:e,localCtx:c[`@context`],options:l})),m=e;let k=null;for(let t of b)if(f(e,t,{vocab:!0},l)===`@type`){k||=t;let n=c[t],r=Array.isArray(n)?n.length>1?n.slice().sort():n:[n];for(let t of r){let n=p(m,t,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,options:l,propagate:!1}))}}let A={};await D({activeCtx:e,activeProperty:t,expandedActiveProperty:v,element:c,expandedParent:A,options:l,insideList:u,typeKey:k,typeScopedContext:m}),b=Object.keys(A);let j=b.length;if(`@value`in A){if(`@type`in A&&(`@language`in A||`@direction`in A))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:A});let t=j-1;if(`@type`in A&&--t,`@index`in A&&--t,`@language`in A&&--t,`@direction`in A&&--t,t!==0)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:A});let r=A[`@value`]===null?[]:x(A[`@value`]),i=S(A,`@type`);if(!(g(e,1.1)&&i.includes(`@json`)&&i.length===1)){if(r.length===0)l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`null @value value`,level:`warning`,message:`Dropping null @value value.`,details:{value:A}},options:l}),A=null;else if(!r.every(e=>o(e)||a(e))&&`@language`in A)throw new n(`Invalid JSON-LD syntax; only strings may be language-tagged.`,`jsonld.SyntaxError`,{code:`invalid language-tagged value`,element:A});else if(!i.every(e=>_(e)&&!(o(e)&&e.indexOf(`_:`)===0)||a(e)))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:A})}}else if(`@type`in A&&!r(A[`@type`]))A[`@type`]=[A[`@type`]];else if(`@set`in A||`@list`in A){if(j>1&&!(j===2&&`@index`in A))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:A});`@set`in A&&(A=A[`@set`],b=Object.keys(A),j=b.length)}else j===1&&`@language`in A&&(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`object with only @language`,level:`warning`,message:`Dropping object with only @language.`,details:{value:A}},options:l}),A=null);return i(A)&&!l.keepFreeFloatingNodes&&!u&&(t===null||v===`@graph`||(p(e,t,`@container`)||[]).includes(`@graph`))&&(A=E({value:A,count:j,options:l})),A};function E({value:e,count:t,options:n}){if(t===0||`@value`in e||`@list`in e||t===1&&`@id`in e){if(n.eventHandler){let r,i;t===0?(r=`empty object`,i=`Dropping empty object.`):`@value`in e?(r=`object with only @value`,i=`Dropping object with only @value.`):`@list`in e?(r=`object with only @list`,i=`Dropping object with only @list.`):t===1&&`@id`in e&&(r=`object with only @id`,i=`Dropping object with only @id.`),w({event:{type:[`JsonLdEvent`],code:r,level:`warning`,message:i,details:{value:e}},options:n})}return null}return e}async function D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:y,expandedParent:S,options:O={},insideList:j,typeKey:M,typeScopedContext:N}){let P=Object.keys(y).sort(),F=[],I,L=y[M]&&f(e,r(y[M])?y[M][0]:y[M],{vocab:!0},{...O,typeExpansion:!0})===`@json`;for(let D of P){let j=y[D],M;if(D===`@context`)continue;let P=f(e,D,{vocab:!0},O);if(P===null||!(_(P)||m(P))){O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid property`,level:`warning`,message:`Dropping property that did not expand into an absolute IRI or keyword.`,details:{property:D,expandedProperty:P}},options:O});continue}if(m(P)){if(u===`@reverse`)throw new n(`Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.`,`jsonld.SyntaxError`,{code:`invalid reverse property map`,value:j});if(P in S&&P!==`@included`&&P!==`@type`)throw new n(`Invalid JSON-LD syntax; colliding keywords detected.`,`jsonld.SyntaxError`,{code:`colliding keywords`,keyword:P})}if(P===`@id`){if(!o(j)){if(!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@id" value must a string.`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j});if(i(j)){if(!a(j))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:j})}else if(r(j)){if(!j.every(e=>o(e)))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:j})}else 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:j})}b(S,`@id`,x(j).map(t=>{if(o(t)){let n=f(e,t,{base:!0},O);return O.eventHandler&&(n===null?w(t===null?{event:{type:[`JsonLdEvent`],code:`null @id value`,level:`warning`,message:`Null @id found.`,details:{id:t}},options:O}:{event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:O}):_(n)||w({event:{type:[`JsonLdEvent`],code:`relative @id reference`,level:`warning`,message:`Relative @id reference found.`,details:{id:t,expandedId:n}},options:O})),n}return t}),{propertyIsArray:O.isFrame});continue}if(P===`@type`){i(j)&&(j=Object.fromEntries(Object.entries(j).map(([e,t])=>[f(N,e,{vocab:!0}),x(t).map(e=>f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0}))]))),C(j,O.isFrame),b(S,`@type`,x(j).map(e=>{if(o(e)){let t=f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0});return t!==`@json`&&!_(t)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`relative @type reference`,level:`warning`,message:`Relative @type reference found.`,details:{type:e}},options:O}),t}return e}),{propertyIsArray:!!O.isFrame});continue}if(P===`@included`&&g(e,1.1)){let r=x(await T.expand({activeCtx:e,activeProperty:t,element:j,options:O}));if(!r.every(e=>d(e)))throw new n(`Invalid JSON-LD syntax; values of @included must expand to node objects.`,`jsonld.SyntaxError`,{code:`invalid @included value`,value:j});b(S,`@included`,r,{propertyIsArray:!0});continue}if(P===`@graph`&&!(i(j)||r(j)))throw new n(`Invalid JSON-LD syntax; "@graph" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid @graph value`,value:j});if(P===`@value`){I=j,L&&g(e,1.1)?S[`@value`]=j:b(S,`@value`,j,{propertyIsArray:O.isFrame});continue}if(P===`@language`){if(j===null)continue;if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@language" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid language-tagged string`,value:j});j=x(j).map(e=>o(e)?e.toLowerCase():e);for(let e of j)o(e)&&!e.match(v)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:O});b(S,`@language`,j,{propertyIsArray:O.isFrame});continue}if(P===`@direction`){if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@direction" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});j=x(j);for(let e of j)if(o(e)&&e!==`ltr`&&e!==`rtl`)throw new n(`Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});b(S,`@direction`,j,{propertyIsArray:O.isFrame});continue}if(P===`@index`){if(!o(j))throw new n(`Invalid JSON-LD syntax; "@index" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid @index value`,value:j});b(S,`@index`,j);continue}if(P===`@reverse`){if(!i(j))throw new n(`Invalid JSON-LD syntax; "@reverse" value must be an object.`,`jsonld.SyntaxError`,{code:`invalid @reverse value`,value:j});if(M=await T.expand({activeCtx:e,activeProperty:`@reverse`,element:j,options:O}),`@reverse`in M)for(let e in M[`@reverse`])b(S,e,M[`@reverse`][e],{propertyIsArray:!0});let t=S[`@reverse`]||null;for(let e in M){if(e===`@reverse`)continue;t===null&&(t=S[`@reverse`]={}),b(t,e,[],{propertyIsArray:!0});let r=M[e];for(let i=0;i<r.length;++i){let a=r[i];if(l(a)||c(a))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:M});b(t,e,a,{propertyIsArray:!0})}}continue}if(P===`@nest`){F.push(D);continue}let R=e,z=p(e,D,`@context`);s(z)||(R=await h({activeCtx:e,localCtx:z,propagate:!0,overrideProtected:!0,options:O}));let B=p(e,D,`@container`)||[];if(B.includes(`@language`)&&i(j)){let e=p(R,D,`@direction`);M=k(R,j,e,O)}else if(B.includes(`@index`)&&i(j)){let t=B.includes(`@graph`),n=p(R,D,`@index`)||`@index`,r=n!==`@index`&&f(e,n,{vocab:!0},O);M=await A({activeCtx:R,options:O,activeProperty:D,value:j,asGraph:t,indexKey:n,propertyIndex:r})}else if(B.includes(`@id`)&&i(j)){let e=B.includes(`@graph`);M=await A({activeCtx:R,options:O,activeProperty:D,value:j,asGraph:e,indexKey:`@id`})}else if(B.includes(`@type`)&&i(j))M=await A({activeCtx:R.revertToPreviousContext(),options:O,activeProperty:D,value:j,asGraph:!1,indexKey:`@type`});else{let n=P===`@list`;if(n||P===`@set`){let e=t;n&&u===`@graph`&&(e=null),M=await T.expand({activeCtx:R,activeProperty:e,element:j,options:O,insideList:n})}else M=p(e,D,`@type`)===`@json`?{"@type":`@json`,"@value":j}:await T.expand({activeCtx:R,activeProperty:D,element:j,options:O,insideList:!1})}if(!(M===null&&P!==`@value`)){if(P!==`@list`&&!c(M)&&B.includes(`@list`)&&(M={"@list":x(M)}),B.includes(`@graph`)&&!B.some(e=>e===`@id`||e===`@index`)){if(M=x(M),O.isFrame||(M=M.filter(e=>{let t=Object.keys(e).length;return E({value:e,count:t,options:O})!==null})),M.length===0)continue;M=M.map(e=>({"@graph":x(e)}))}if(R.mappings.has(D)&&R.mappings.get(D).reverse){let e=S[`@reverse`]=S[`@reverse`]||{};M=x(M);for(let t=0;t<M.length;++t){let r=M[t];if(l(r)||c(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:M});b(e,P,r,{propertyIsArray:!0})}continue}b(S,P,M,{propertyIsArray:!0})}}if(`@value`in S&&!(S[`@type`]===`@json`&&g(e,1.1))&&(i(I)||r(I))&&!O.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:I});for(let a of F){let o=r(y[a])?y[a]:[y[a]];for(let r of o){if(!i(r)||Object.keys(r).some(t=>f(e,t,{vocab:!0},O)===`@value`))throw new n(`Invalid JSON-LD syntax; nested value must be a node object.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,value:r});await D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:r,expandedParent:S,options:O,insideList:j,typeScopedContext:N,typeKey:M})}}}function O({activeCtx:e,activeProperty:t,value:n,options:r}){if(n==null)return null;let i=f(e,t,{vocab:!0},r);if(i===`@id`)return f(e,n,{base:!0},r);if(i===`@type`)return f(e,n,{vocab:!0,base:!0},{...r,typeExpansion:!0});let a=p(e,t,`@type`);if((a===`@id`||i===`@graph`)&&o(n)){let i=f(e,n,{base:!0},r);return i===null&&n.match(y)&&r.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:r}),{"@id":i}}if(a===`@vocab`&&o(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(m(i))return n;let s={};if(a&&![`@id`,`@vocab`,`@none`].includes(a))s[`@type`]=a;else if(o(n)){let n=p(e,t,`@language`);n!==null&&(s[`@language`]=n);let r=p(e,t,`@direction`);r!==null&&(s[`@direction`]=r)}return[`boolean`,`number`,`string`].includes(typeof n)||(n=n.toString()),s[`@value`]=n,s}function k(e,t,i,a){let s=[],c=Object.keys(t).sort();for(let l of c){let c=f(e,l,{vocab:!0},a),u=t[l];r(u)||(u=[u]);for(let e of u){if(e===null)continue;if(!o(e))throw new n(`Invalid JSON-LD syntax; language map values must be strings.`,`jsonld.SyntaxError`,{code:`invalid language map value`,languageMap:t});let r={"@value":e};c!==`@none`&&(l.match(v)||a.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:l}},options:a}),r[`@language`]=l.toLowerCase()),i&&(r[`@direction`]=i),s.push(r)}}return s}async function A({activeCtx:e,options:t,activeProperty:i,value:a,asGraph:o,indexKey:c,propertyIndex:d}){let m=[],g=Object.keys(a).sort(),_=c===`@type`;for(let v of g){if(_){let n=p(e,v,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g=a[v];r(g)||(g=[g]),g=await T.expand({activeCtx:e,activeProperty:i,element:g,options:t,insideList:!1,insideIndex:!0});let y;y=d?v===`@none`?`@none`:O({activeCtx:e,activeProperty:c,value:v,options:t}):f(e,v,{vocab:!0},t),c===`@id`?v=f(e,v,{base:!0},t):_&&(v=y);for(let e of g){if(o&&!u(e)&&(e={"@graph":[e]}),c===`@type`)y===`@none`||(e[`@type`]?e[`@type`]=[v].concat(e[`@type`]):e[`@type`]=[v]);else if(l(e)&&![`@language`,`@type`,`@index`].includes(c))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${c}".`,`jsonld.SyntaxError`,{code:`invalid value object`,value:e});else d?y!==`@none`&&b(e,d,y,{propertyIsArray:!0,prependValue:!0}):y!==`@none`&&!(c in e)&&(e[c]=v);m.push(e)}}return m}})),tr=o(((e,t)=>{var{isKeyword:n}=$n(),r=Rn(),i=Ln(),a=Bn(),o=zn(),s={};t.exports=s,s.createMergedNodeMap=(e,t)=>{t||={};let n=t.issuer||new a.IdentifierIssuer(`_:b`),r={"@default":{}};return s.createNodeMap(e,r,`@default`,n),s.mergeNodeMaps(r)},s.createNodeMap=(e,t,c,l,u,d)=>{if(i.isArray(e)){for(let n of e)s.createNodeMap(n,t,c,l,void 0,d);return}if(!i.isObject(e)){d&&d.push(e);return}if(r.isValue(e)){if(`@type`in e){let t=e[`@type`];t.indexOf(`_:`)===0&&(e[`@type`]=t=l.getId(t))}d&&d.push(e);return}else if(d&&r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),d.push({"@list":n});return}if(`@type`in e){let t=e[`@type`];for(let e of t)e.indexOf(`_:`)===0&&l.getId(e)}i.isUndefined(u)&&(u=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`]),d&&d.push({"@id":u});let f=t[c],p=f[u]=f[u]||{};p[`@id`]=u;let m=Object.keys(e).sort();for(let i of m){if(i===`@id`)continue;if(i===`@reverse`){let n={"@id":u},i=e[`@reverse`];for(let e in i){let o=i[e];for(let i of o){let o=i[`@id`];r.isBlankNode(i)&&(o=l.getId(o)),s.createNodeMap(i,t,c,l,o),a.addValue(f[o],e,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(i===`@graph`){u in t||(t[u]={}),s.createNodeMap(e[i],t,u,l);continue}if(i===`@included`){s.createNodeMap(e[i],t,c,l);continue}if(i!==`@type`&&n(i)){if(i===`@index`&&i in p&&(e[i]!==p[i]||e[i][`@id`]!==p[i][`@id`]))throw new o(`Invalid JSON-LD syntax; conflicting @index property detected.`,`jsonld.SyntaxError`,{code:`conflicting indexes`,subject:p});p[i]=e[i];continue}let d=e[i];if(i.indexOf(`_:`)===0&&(i=l.getId(i)),d.length===0){a.addValue(p,i,[],{propertyIsArray:!0});continue}for(let e of d)if(i===`@type`&&(e=e.indexOf(`_:`)===0?l.getId(e):e),r.isSubject(e)||r.isSubjectReference(e)){if(`@id`in e&&!e[`@id`])continue;let n=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`];a.addValue(p,i,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(e,t,c,l,n)}else if(r.isValue(e))a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1});else if(r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),e={"@list":n},a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(e,t,c,l,u),a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=e=>{let t={};for(let r of Object.keys(e).sort())for(let i of Object.keys(e[r]).sort()){let o=e[r][i];i in t||(t[i]={"@id":i});let s=t[i];for(let e of Object.keys(o).sort())if(n(e)&&e!==`@type`)s[e]=a.clone(o[e]);else for(let t of o[e])a.addValue(s,e,a.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},s.mergeNodeMaps=e=>{let t=e[`@default`],n=Object.keys(e).sort();for(let i of n){if(i===`@default`)continue;let n=e[i],a=t[i];a?`@graph`in a||(a[`@graph`]=[]):t[i]=a={"@id":i,"@graph":[]};let o=a[`@graph`];for(let e of Object.keys(n).sort()){let t=n[e];r.isSubjectReference(t)||o.push(t)}}return t}})),nr=o(((e,t)=>{var{isSubjectReference:n}=Rn(),{createMergedNodeMap:r}=tr(),i={};t.exports=i,i.flatten=e=>{let t=r(e),i=[],a=Object.keys(t).sort();for(let e=0;e<a.length;++e){let r=t[a[e]];n(r)||i.push(r)}return i}})),rr=o(((e,t)=>{var n=zn(),r=Rn(),i=Ln(),{REGEX_BCP47:a,addValue:o}=Bn(),{handleEvent:s}=Qn(),{RDF_LIST:c,RDF_FIRST:l,RDF_REST:u,RDF_NIL:d,RDF_TYPE:f,RDF_JSON_LITERAL:p,XSD_BOOLEAN:m,XSD_DOUBLE:h,XSD_INTEGER:g,XSD_STRING:_}=Vn(),v={};t.exports=v,v.fromRDF=async(e,t)=>{let{useRdfType:a=!1,useNativeTypes:s=!1,rdfDirection:p=null}=t,m={},h={"@default":m},g={};if(p){if(p===`compound-literal`)throw new n(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p});if(p!==`i18n-datatype`)throw new n(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p})}for(let n of e){let e=n.graph.termType===`DefaultGraph`?`@default`:n.graph.value;e in h||(h[e]={}),e!==`@default`&&!(e in m)&&(m[e]={"@id":e});let r=h[e],i=b(n.subject),c=n.predicate.value,l=n.object;i in r||(r[i]={"@id":i});let u=r[i],_=b(l),v=!!_;if(v&&!(_ in r)&&(r[_]={"@id":_}),c===f&&!a&&v){o(u,`@type`,_,{propertyIsArray:!0});continue}let x=y(l,s,p,t);if(o(u,c,x,{propertyIsArray:!0}),v)if(_===d){let e=r[_];`usages`in e||(e.usages=[]),e.usages.push({node:u,property:c,value:x})}else _ in g?g[_]=!1:g[_]={node:u,property:c,value:x}}for(let e in h){let t=h[e];if(!(d in t))continue;let n=t[d];if(n.usages){for(let e of n.usages){let n=e.node,a=e.property,o=e.value,s=[],d=[],f=Object.keys(n).length;for(;a===u&&i.isObject(g[n[`@id`]])&&i.isArray(n[l])&&n[l].length===1&&i.isArray(n[u])&&n[u].length===1&&(f===3||f===4&&i.isArray(n[`@type`])&&n[`@type`].length===1&&n[`@type`][0]===c)&&(s.push(n[l][0]),d.push(n[`@id`]),e=g[n[`@id`]],n=e.node,a=e.property,o=e.value,f=Object.keys(n).length,r.isBlankNode(n)););delete o[`@id`],o[`@list`]=s.reverse();for(let e of d)delete t[e]}delete n.usages}}let _=[],v=Object.keys(m).sort();for(let e of v){let t=m[e];if(e in h){let n=t[`@graph`]=[],i=h[e],a=Object.keys(i).sort();for(let e of a){let t=i[e];r.isSubjectReference(t)||n.push(t)}}r.isSubjectReference(t)||_.push(t)}return _};function y(e,t,r,o){let c=b(e);if(c)return{"@id":c};let l={"@value":e.value};if(e.language)e.language.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e.language}},options:o}),l[`@language`]=e.language;else{let c=e.datatype.value;if(c||=_,c===p){c=`@json`;try{l[`@value`]=JSON.parse(l[`@value`])}catch(e){throw new n(`JSON literal could not be parsed.`,`jsonld.InvalidJsonLiteral`,{code:`invalid JSON literal`,value:l[`@value`],cause:e})}}if(t)if(c===m)l[`@value`]===`true`||l[`@value`]===`1`?l[`@value`]=!0:l[`@value`]===`false`||l[`@value`]===`0`?l[`@value`]=!1:l[`@type`]=c;else if(c===g)if(i.isNumeric(l[`@value`])){let e=parseInt(l[`@value`],10);e.toFixed(0)===l[`@value`]&&(l[`@value`]=e)}else l[`@type`]=c;else c===h&&i.isNumeric(l[`@value`])?l[`@value`]=parseFloat(l[`@value`]):l[`@type`]=c;else if(r===`i18n-datatype`&&c.startsWith(`https://www.w3.org/ns/i18n#`)){let[,e,t]=c.split(/[#_]/);e.length>0&&(l[`@language`]=e,e.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:o})),l[`@direction`]=t}else c!==_&&(l[`@type`]=c)}return l}function b(e){return e.termType===`NamedNode`?e.value:e.termType===`BlankNode`?`_:`+e.value:null}})),ir=o(((e,t)=>{t.exports=function e(t){if(typeof t==`number`&&isNaN(t))throw Error(`NaN is not allowed`);if(typeof t==`number`&&!isFinite(t))throw Error(`Infinity is not allowed`);return typeof t!=`object`||!t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce((t,n,r)=>`${t}${r===0?``:`,`}${e(n===void 0||typeof n==`symbol`?null:n)}`,``)}]`:`{${Object.keys(t).sort().reduce((n,r)=>t[r]===void 0||typeof t[r]==`symbol`?n:`${n}${n.length===0?``:`,`}${e(r)}:${e(t[r])}`,``)}}`}})),ar=o(((e,t)=>{var{createNodeMap:n}=tr(),{isKeyword:r}=$n(),i=Rn(),a=ir(),o=zn(),s=Ln(),c=Bn(),{handleEvent:l}=Qn(),{RDF_FIRST:u,RDF_REST:d,RDF_NIL:f,RDF_TYPE:p,RDF_JSON_LITERAL:m,RDF_LANGSTRING:h,XSD_BOOLEAN:g,XSD_DOUBLE:_,XSD_INTEGER:v,XSD_STRING:y}=Vn(),{isAbsolute:b}=Un(),x={};t.exports=x,x.toRDF=(e,t)=>{let r=new c.IdentifierIssuer(`_:b`),i={"@default":{}};n(e,i,`@default`,r);let a=[],o=Object.keys(i).sort();for(let e of o){let n;if(e===`@default`)n={termType:`DefaultGraph`,value:``};else if(b(e))n=T(e);else{t.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative graph reference`,level:`warning`,message:`Relative graph reference found.`,details:{graph:e}},options:t});continue}S(a,i[e],n,r,t)}return a};function S(e,t,n,i,a){let o=Object.keys(t).sort();for(let s of o){let o=t[s],c=Object.keys(o).sort();for(let t of c){let c=o[t];if(t===`@type`)t=p;else if(r(t))continue;for(let r of c){let o=T(s);if(!b(s)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative subject reference`,level:`warning`,message:`Relative subject reference found.`,details:{subject:s}},options:a});continue}let c=T(t);if(!b(t)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative predicate reference`,level:`warning`,message:`Relative predicate reference found.`,details:{predicate:t}},options:a});continue}if(c.termType===`BlankNode`&&!a.produceGeneralizedRdf){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`blank node predicate`,level:`warning`,message:`Dropping blank node predicate.`,details:{property:i.getOldIds().find(e=>i.getId(e)===t)}},options:a});continue}let u=w(r,i,e,n,a.rdfDirection,a);u&&e.push({subject:o,predicate:c,object:u,graph:n})}}}}function C(e,t,n,r,i,a){let o={termType:`NamedNode`,value:u},s={termType:`NamedNode`,value:d},c={termType:`NamedNode`,value:f},l=e.pop(),p=l?{termType:`BlankNode`,value:t.getId().slice(2)}:c,m=p;for(let c of e){let e=w(c,t,n,r,i,a),l={termType:`BlankNode`,value:t.getId().slice(2)};n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:l,graph:r}),m=l}if(l){let e=w(l,t,n,r,i,a);n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:c,graph:r})}return p}function w(e,t,n,r,c,u){let d;if(i.isValue(e)){d={termType:`Literal`,value:void 0,datatype:{termType:`NamedNode`}};let t=e[`@value`],n=e[`@type`]||null;if(n===`@json`)d.value=a(t),d.datatype.value=m;else if(s.isBoolean(t))d.value=t.toString(),d.datatype.value=n||g;else if(s.isDouble(t)||n===_)s.isDouble(t)||(t=parseFloat(t)),d.value=t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),d.datatype.value=n||_;else if(s.isNumber(t))d.value=t.toFixed(0),d.datatype.value=n||v;else if(`@direction`in e&&c===`i18n-datatype`){let n=`https://www.w3.org/ns/i18n#${(e[`@language`]||``).toLowerCase()}_${e[`@direction`]}`;d.datatype.value=n,d.value=t}else if(`@direction`in e&&c===`compound-literal`)throw new o(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else if(`@direction`in e&&c)throw new o(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else`@language`in e?(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||h,d.language=e[`@language`]):(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||y)}else if(i.isList(e)){let i=C(e[`@list`],t,n,r,c,u);d={termType:i.termType,value:i.value}}else d=T(s.isObject(e)?e[`@id`]:e);return d.termType===`NamedNode`&&!b(d.value)?(u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative object reference`,level:`warning`,message:`Relative object reference found.`,details:{object:d.value}},options:u}),null):d}function T(e){return e.startsWith(`_:`)?{termType:`BlankNode`,value:e.slice(2)}:{termType:`NamedNode`,value:e}}})),or=o(((e,t)=>{var{isKeyword:n}=$n(),r=Rn(),i=Ln(),a=Bn(),o=Un(),s=zn(),{createNodeMap:c,mergeNodeMapGraphs:l}=tr(),u={};t.exports=u,u.frameMergedOrDefault=(e,t,n)=>{let r={options:n,embedded:!1,graph:`@default`,graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new a.IdentifierIssuer(`_:b`);c(e,r.graphMap,`@default`,i),n.merged&&(r.graphMap[`@merged`]=l(r.graphMap),r.graph=`@merged`),r.subjects=r.graphMap[r.graph];let o=[];return u.frame(r,Object.keys(r.subjects).sort(),t,o),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter(e=>r.bnodeMap[e].length===1)),n.link={},v(o,n)},u.frame=(e,t,o,c,l=null)=>{m(o),o=o[0];let g=e.options,v={embed:p(o,g,`embed`),explicit:p(o,g,`explicit`),requireAll:p(o,g,`requireAll`)};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});let b=e.link[e.graph],S=h(e,t,o,v),C=Object.keys(S).sort();for(let m of C){let h=S[m];if(l===null?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},v.embed===`@link`&&m in b){y(c,l,b[m]);continue}let C={"@id":m};if(m.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,m,C,{propertyIsArray:!0}),b[m]=C,(v.embed===`@first`||v.embed===`@last`)&&e.is11)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:o});if(!(!e.embedded&&e.uniqueEmbeds[e.graph].hasOwnProperty(m))){if(e.embedded&&(v.embed===`@never`||f(h,e.graph,e.subjectStack))){y(c,l,C);continue}if(e.embedded&&(v.embed==`@first`||v.embed==`@once`)&&e.uniqueEmbeds[e.graph].hasOwnProperty(m)){y(c,l,C);continue}if(v.embed===`@last`&&m in e.uniqueEmbeds[e.graph]&&_(e,m),e.uniqueEmbeds[e.graph][m]={parent:c,property:l},e.subjectStack.push({subject:h,graph:e.graph}),m in e.graphMap){let t=!1,n=null;`@graph`in o?(n=o[`@graph`][0],t=!(m===`@merged`||m===`@default`),i.isObject(n)||(n={})):(t=e.graph!==`@merged`,n={}),t&&u.frame({...e,graph:m,embedded:!1},Object.keys(e.graphMap[m]).sort(),[n],C,`@graph`)}`@included`in o&&u.frame({...e,embedded:!1},t,o[`@included`],C,`@included`);for(let t of Object.keys(h).sort()){if(n(t)){if(C[t]=a.clone(h[t]),t===`@type`)for(let t of h[`@type`])t.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,t,C,{propertyIsArray:!0});continue}if(!(v.explicit&&!(t in o)))for(let n of h[t]){let i=t in o?o[t]:d(v);if(r.isList(n)){let i=o[t]&&o[t][0]&&o[t][0][`@list`]?o[t][0][`@list`]:d(v),s={"@list":[]};y(C,t,s);let c=n[`@list`];for(let t of c)r.isSubjectReference(t)?u.frame({...e,embedded:!0},[t[`@id`]],i,s,`@list`):y(s,`@list`,a.clone(t))}else r.isSubjectReference(n)?u.frame({...e,embedded:!0},[n[`@id`]],i,C,t):x(i[0],n)&&y(C,t,a.clone(n))}}for(let e of Object.keys(o).sort()){if(e===`@type`){if(!i.isObject(o[e][0])||!(`@default`in o[e][0]))continue}else if(n(e))continue;let t=o[e][0]||{};if(!p(t,g,`omitDefault`)&&!(e in C)){let n=`@null`;`@default`in t&&(n=a.clone(t[`@default`])),i.isArray(n)||(n=[n]),C[e]=[{"@preserve":n}]}}for(let t of Object.keys(o[`@reverse`]||{}).sort()){let n=o[`@reverse`][t];for(let r of Object.keys(e.subjects))a.getValues(e.subjects[r],t).some(e=>e[`@id`]===m)&&(C[`@reverse`]=C[`@reverse`]||{},a.addValue(C[`@reverse`],t,[],{propertyIsArray:!0}),u.frame({...e,embedded:!0},[r],n,C[`@reverse`][t],l))}y(c,l,C),e.subjectStack.pop()}}},u.cleanupNull=(e,t)=>{if(i.isArray(e))return e.map(e=>u.cleanupNull(e,t)).filter(e=>e);if(e===`@null`)return null;if(i.isObject(e)){if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e)e[n]=u.cleanupNull(e[n],t)}return e};function d(e){let t={};for(let n in e)e[n]!==void 0&&(t[`@`+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){let i=n[r];if(i.graph===t&&i.subject[`@id`]===e[`@id`])return!0}return!1}function p(e,t,n){let r=`@`+n,i=r in e?e[r][0]:t[n];if(n===`embed`){if(i===!0)i=`@once`;else if(i===!1)i=`@never`;else if(i!==`@always`&&i!==`@never`&&i!==`@link`&&i!==`@first`&&i!==`@last`&&i!==`@once`)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:e})}return i}function m(e){if(!i.isArray(e)||e.length!==1||!i.isObject(e[0]))throw new s(`Invalid JSON-LD syntax; a JSON-LD frame must be a single object.`,`jsonld.SyntaxError`,{frame:e});if(`@id`in e[0]){for(let t of a.asArray(e[0][`@id`]))if(!(i.isObject(t)||o.isAbsolute(t))||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @id in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}if(`@type`in e[0]){for(let t of a.asArray(e[0][`@type`]))if(!(i.isObject(t)||o.isAbsolute(t)||t===`@json`)||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @type in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}}function h(e,t,n,r){let i={};for(let a of t){let t=e.graphMap[e.graph][a];g(e,t,n,r)&&(i[a]=t)}return i}function g(e,t,o,s){let c=!0,l=!1;for(let u in o){let d=!1,f=a.getValues(t,u),p=a.getValues(o,u).length===0;if(u===`@id`){if(i.isEmptyObject(o[`@id`][0]||{})?d=!0:o[`@id`].length>=0&&(d=o[`@id`].includes(f[0])),!s.requireAll)return d}else if(u===`@type`){if(c=!1,p){if(f.length>0)return!1;d=!0}else if(o[`@type`].length===1&&i.isEmptyObject(o[`@type`][0]))d=f.length>0;else for(let e of o[`@type`])i.isObject(e)&&`@default`in e?d=!0:d||=f.some(t=>t===e);if(!s.requireAll)return d}else if(n(u))continue;else{let t=a.getValues(o,u)[0],n=!1;if(t&&(m([t]),n=`@default`in t),c=!1,f.length===0&&n)continue;if(f.length>0&&p)return!1;if(t===void 0){if(f.length>0)return!1;d=!0}else if(r.isList(t)){let n=t[`@list`][0];if(r.isList(f[0])){let t=f[0][`@list`];r.isValue(n)?d=t.some(e=>x(n,e)):(r.isSubject(n)||r.isSubjectReference(n))&&(d=t.some(t=>b(e,n,t,s)))}}else d=r.isValue(t)?f.some(e=>x(t,e)):r.isSubjectReference(t)?f.some(n=>b(e,t,n,s)):i.isObject(t)?f.length>0:!1}if(!d&&s.requireAll)return!1;l||=d}return c||l}function _(e,t){let n=e.uniqueEmbeds[e.graph],r=n[t],o=r.parent,s=r.property,c={"@id":t};if(i.isArray(o)){for(let e=0;e<o.length;++e)if(a.compareValues(o[e],c)){o[e]=c;break}}else{let e=i.isArray(o[s]);a.removeValue(o,s,c,{propertyIsArray:e}),a.addValue(o,s,c,{propertyIsArray:e})}let l=e=>{let t=Object.keys(n);for(let r of t)r in n&&i.isObject(n[r].parent)&&n[r].parent[`@id`]===e&&(delete n[r],l(r))};l(t)}function v(e,t){if(i.isArray(e))return e.map(e=>v(e,t));if(i.isObject(e)){if(`@preserve`in e)return e[`@preserve`][0];if(r.isValue(e))return e;if(r.isList(e))return e[`@list`]=v(e[`@list`],t),e;if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e){if(n===`@id`&&t.bnodesToClear.includes(e[n])){delete e[`@id`];continue}e[n]=v(e[n],t)}}return e}function y(e,t,n){i.isObject(e)?a.addValue(e,t,n,{propertyIsArray:!0}):e.push(n)}function b(e,t,n,r){if(!(`@id`in n))return!1;let i=e.subjects[n[`@id`]];return i&&g(e,i,t,r)}function x(e,t){let n=t[`@value`],r=t[`@type`],a=t[`@language`],o=e[`@value`]?i.isArray(e[`@value`])?e[`@value`]:[e[`@value`]]:[],s=e[`@type`]?i.isArray(e[`@type`])?e[`@type`]:[e[`@type`]]:[],c=e[`@language`]?i.isArray(e[`@language`])?e[`@language`]:[e[`@language`]]:[];return o.length===0&&s.length===0&&c.length===0||!(!(o.includes(n)||i.isEmptyObject(o[0]))||!(!r&&s.length===0||s.includes(r)||r&&i.isEmptyObject(s[0]))||!(!a&&c.length===0||c.includes(a)||a&&i.isEmptyObject(c[0])))}})),sr=o(((e,t)=>{var n=zn(),{isArray:r,isObject:i,isString:a,isUndefined:o}=Ln(),{isList:s,isValue:c,isGraph:l,isSimpleGraph:u,isSubjectReference:d}=Rn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=$n(),{removeBase:_,prependBase:v}=Un(),{REGEX_KEYWORD:y,addValue:b,asArray:x,compareShortestLeast:S}=Bn(),C={};t.exports=C,C.compact=async({activeCtx:e,activeProperty:t=null,element:f,options:_={}})=>{if(r(f)){let n=[];for(let r=0;r<f.length;++r){let i=await C.compact({activeCtx:e,activeProperty:t,element:f[r],options:_});i!==null&&n.push(i)}return _.compactArrays&&n.length===1&&(p(e,t,`@container`)||[]).length===0&&(n=n[0]),n}let v=p(e,t,`@context`);if(o(v)||(e=await h({activeCtx:e,localCtx:v,propagate:!0,overrideProtected:!0,options:_})),i(f)){if(_.link&&`@id`in f&&_.link.hasOwnProperty(f[`@id`])){let e=_.link[f[`@id`]];for(let t=0;t<e.length;++t)if(e[t].expanded===f)return e[t].compacted}if(c(f)||d(f)){let n=C.compactValue({activeCtx:e,activeProperty:t,value:f,options:_});return _.link&&d(f)&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:n})),n}if(s(f)&&(p(e,t,`@container`)||[]).includes(`@list`))return C.compact({activeCtx:e,activeProperty:t,element:f[`@list`],options:_});let v=t===`@reverse`,y={},S=e;!c(f)&&!d(f)&&(e=e.revertToPreviousContext());let w=p(S,t,`@context`);o(w)||(e=await h({activeCtx:e,localCtx:w,propagate:!0,overrideProtected:!0,options:_})),_.link&&`@id`in f&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:y}));let E=f[`@type`]||[];E.length>1&&(E=Array.from(E).sort());let D=e;for(let t of E){let n=p(S,C.compactIri({activeCtx:D,iri:t,relativeTo:{vocab:!0}}),`@context`);o(n)||(e=await h({activeCtx:e,localCtx:n,options:_,propagate:!1}))}let O=Object.keys(f).sort();for(let o of O){let d=f[o];if(o===`@id`){let t=x(d).map(t=>C.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:_.base}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});y[n]=t;continue}if(o===`@type`){let t=x(d).map(e=>C.compactIri({activeCtx:S,iri:e,relativeTo:{vocab:!0}}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),i=(p(e,n,`@container`)||[]).includes(`@set`)&&g(e,1.1)||r(t)&&d.length===0;b(y,n,t,{propertyIsArray:i});continue}if(o===`@reverse`){let t=await C.compact({activeCtx:e,activeProperty:`@reverse`,element:d,options:_});for(let n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){let r=t[n];b(y,n,r,{propertyIsArray:(p(e,n,`@container`)||[]).includes(`@set`)||!_.compactArrays}),delete t[n]}Object.keys(t).length>0&&b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),t);continue}if(o===`@preserve`){let n=await C.compact({activeCtx:e,activeProperty:t,element:d,options:_});r(n)&&n.length===0||b(y,o,n);continue}if(o===`@index`){if((p(e,t,`@container`)||[]).includes(`@index`))continue;b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(o!==`@graph`&&o!==`@list`&&o!==`@included`&&m(o)){b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(!r(d))throw new n(`JSON-LD expansion error; expanded value must be an array.`,`jsonld.SyntaxError`);if(d.length===0){let t=C.compactIri({activeCtx:e,iri:o,value:d,relativeTo:{vocab:!0},reverse:v}),n=e.mappings.has(t)?e.mappings.get(t)[`@nest`]:null,r=y;n&&(T(e,n,_),i(y[n])||(y[n]={}),r=y[n]),b(r,t,d,{propertyIsArray:!0})}for(let t of d){let n=C.compactIri({activeCtx:e,iri:o,value:t,relativeTo:{vocab:!0},reverse:v}),d=e.mappings.has(n)?e.mappings.get(n)[`@nest`]:null,f=y;d&&(T(e,d,_),i(y[d])||(y[d]={}),f=y[d]);let m=p(e,n,`@container`)||[],h=l(t),g=s(t),S;g?S=t[`@list`]:h&&(S=t[`@graph`]);let w=await C.compact({activeCtx:e,activeProperty:n,element:g||h?S:t,options:_});if(g)if(r(w)||(w=[w]),!m.includes(`@list`))w={[C.compactIri({activeCtx:e,iri:`@list`,relativeTo:{vocab:!0}})]:w},`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]);else{b(f,n,w,{valueIsArray:!0,allowDuplicate:!0});continue}if(h)if(m.includes(`@graph`)&&(m.includes(`@id`)||m.includes(`@index`)&&u(t))){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i=(m.includes(`@id`)?t[`@id`]:t[`@index`])||C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}});b(r,i,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})}else m.includes(`@graph`)&&u(t)?(r(w)&&w.length>1&&(w={"@included":w}),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})):(r(w)&&w.length===1&&_.compactArrays&&(w=w[0]),w={[C.compactIri({activeCtx:e,iri:`@graph`,relativeTo:{vocab:!0}})]:w},`@id`in t&&(w[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]=t[`@id`]),`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)}));else if(m.includes(`@language`)||m.includes(`@index`)||m.includes(`@id`)||m.includes(`@type`)){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i;if(m.includes(`@language`))c(w)&&(w=w[`@value`]),i=t[`@language`];else if(m.includes(`@index`)){let r=p(e,n,`@index`)||`@index`,o=C.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if(r===`@index`)i=t[`@index`],delete w[o];else{let e;if([i,...e]=x(w[r]||[]),!a(i))i=null;else switch(e.length){case 0:delete w[r];break;case 1:w[r]=e[0];break;default:w[r]=e;break}}}else if(m.includes(`@id`)){let t=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});i=w[t],delete w[t]}else if(m.includes(`@type`)){let r=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),a;switch([i,...a]=x(w[r]||[]),a.length){case 0:delete w[r];break;case 1:w[r]=a[0];break;default:w[r]=a;break}Object.keys(w).length===1&&`@id`in t&&(w=await C.compact({activeCtx:e,activeProperty:n,element:{"@id":t[`@id`]},options:_}))}i||=C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}}),b(r,i,w,{propertyIsArray:m.includes(`@set`)})}else{let e=!_.compactArrays||m.includes(`@set`)||m.includes(`@list`)||r(w)&&w.length===0||o===`@list`||o===`@graph`;b(f,n,w,{propertyIsArray:e})}}}return y}return f},C.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:a={vocab:!1},reverse:o=!1,base:u=null})=>{if(t===null)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);let d=e.getInverse();if(m(t)&&t in d&&`@none`in d[t]&&`@type`in d[t][`@none`]&&`@none`in d[t][`@none`][`@type`])return d[t][`@none`][`@type`][`@none`];if(a.vocab&&t in d){let n=e[`@language`]||`@none`,a=[];i(r)&&`@index`in r&&!(`@graph`in r)&&a.push(`@index`,`@index@set`),i(r)&&`@preserve`in r&&(r=r[`@preserve`][0]),l(r)?(`@index`in r&&a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r&&a.push(`@graph@id`,`@graph@id@set`),a.push(`@graph`,`@graph@set`,`@set`),`@index`in r||a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r||a.push(`@graph@id`,`@graph@id@set`)):i(r)&&!c(r)&&a.push(`@id`,`@id@set`,`@type`,`@set@type`);let u=`@language`,d=`@null`;if(o)u=`@type`,d=`@reverse`,a.push(`@set`);else if(s(r)){`@index`in r||a.push(`@list`);let e=r[`@list`];if(e.length===0)u=`@any`,d=`@none`;else{let t=e.length===0?n:null,r=null;for(let n=0;n<e.length;++n){let i=e[n],a=`@none`,o=`@none`;if(c(i)?`@direction`in i?a=`${(i[`@language`]||``).toLowerCase()}_${i[`@direction`]}`:`@language`in i?a=i[`@language`].toLowerCase():`@type`in i?o=i[`@type`]:a=`@null`:o=`@id`,t===null?t=a:a!==t&&c(i)&&(t=`@none`),r===null?r=o:o!==r&&(r=`@none`),t===`@none`&&r===`@none`)break}t||=`@none`,r||=`@none`,r===`@none`?d=t:(u=`@type`,d=r)}}else{if(c(r))if(`@language`in r&&!(`@index`in r)){a.push(`@language`,`@language@set`),d=r[`@language`];let e=r[`@direction`];e&&(d=`${d}_${e}`)}else`@direction`in r&&!(`@index`in r)?d=`_${r[`@direction`]}`:`@type`in r&&(u=`@type`,d=r[`@type`]);else u=`@type`,d=`@id`;a.push(`@set`)}a.push(`@none`),i(r)&&!(`@index`in r)&&a.push(`@index`,`@index@set`),c(r)&&Object.keys(r).length===1&&a.push(`@language`,`@language@set`);let f=w(e,t,r,a,u,d);if(f!==null)return f}if(a.vocab&&`@vocab`in e){let n=e[`@vocab`];if(t.indexOf(n)===0&&t!==n){let r=t.substr(n.length);if(!e.mappings.has(r))return r}}let f=null,p=[],h=e.fastCurieMap,g=t.length-1;for(let e=0;e<g&&t[e]in h;++e)h=h[t[e]],``in h&&p.push(h[``][0]);for(let n=p.length-1;n>=0;--n){let i=p[n],a=i.terms;for(let n of a){let a=n+`:`+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(a)||r===null&&e.mappings.get(a)[`@id`]===t)&&(f===null||S(a,f)<0)&&(f=a)}}if(f!==null)return f;for(let[r,i]of e.mappings)if(i&&i._prefix&&t.startsWith(r+`:`))throw new n(`Absolute IRI "${t}" confused with prefix "${r}".`,`jsonld.SyntaxError`,{code:`IRI confused with prefix`,context:e});if(!a.vocab)if(`@base`in e)if(e[`@base`]){let n=_(v(u,e[`@base`]),t);return y.test(n)?`./${n}`:n}else return t;else return _(u,t);return t},C.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(c(n)){let r=p(e,t,`@type`),i=p(e,t,`@language`),o=p(e,t,`@direction`),s=p(e,t,`@container`)||[],c=`@index`in n&&!s.includes(`@index`);if(!c&&r!==`@none`&&(n[`@type`]===r||`@language`in n&&n[`@language`]===i&&`@direction`in n&&n[`@direction`]===o||`@language`in n&&n[`@language`]===i||`@direction`in n&&n[`@direction`]===o))return n[`@value`];let l=Object.keys(n).length,u=l===1||l===2&&`@index`in n&&!c,d=`@language`in e,f=a(n[`@value`]),m=e.mappings.has(t)&&e.mappings.get(t)[`@language`]===null;if(u&&r!==`@none`&&(!d||!f||m))return n[`@value`];let h={};return c&&(h[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=n[`@index`]),`@type`in n?h[C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}})]=C.compactIri({activeCtx:e,iri:n[`@type`],relativeTo:{vocab:!0}}):`@language`in n&&(h[C.compactIri({activeCtx:e,iri:`@language`,relativeTo:{vocab:!0}})]=n[`@language`]),`@direction`in n&&(h[C.compactIri({activeCtx:e,iri:`@direction`,relativeTo:{vocab:!0}})]=n[`@direction`]),h[C.compactIri({activeCtx:e,iri:`@value`,relativeTo:{vocab:!0}})]=n[`@value`],h}let i=f(e,t,{vocab:!0},r),o=p(e,t,`@type`),s=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:o===`@vocab`},base:r.base});return o===`@id`||o===`@vocab`||i===`@graph`?s:{[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]:s}};function w(e,t,n,r,a,o){o===null&&(o=`@null`);let s=[];if((o===`@id`||o===`@reverse`)&&i(n)&&`@id`in n){o===`@reverse`&&s.push(`@reverse`);let t=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)[`@id`]===n[`@id`]?s.push.apply(s,[`@vocab`,`@id`]):s.push.apply(s,[`@id`,`@vocab`])}else{s.push(o);let e=s.find(e=>e.includes(`_`));e&&s.push(e.replace(/^[^_]+_/,`_`))}s.push(`@none`);let c=e.inverse[t];for(let e of r){if(!(e in c))continue;let t=c[e][a];for(let e of s)if(e in t)return t[e]}return null}function T(e,t,r){if(f(e,t,{vocab:!0},r)!==`@nest`)throw new n(`JSON-LD compact error; nested property must have an @nest value resolving to @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`})}})),cr=o(((e,t)=>{t.exports=e=>{class t{toString(){return`[object JsonLdProcessor]`}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,n){return arguments.length<2?Promise.reject(TypeError(`Could not compact, too few arguments.`)):e.compact(t,n)},t.expand=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not expand, too few arguments.`)):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not flatten, too few arguments.`)):e.flatten(t)},t}})),lr=o(((e,t)=>{var n=In(),r=Gn(),i=Bn(),a=Xn(),o=i.IdentifierIssuer,s=zn(),c=Jn(),l=Zn(),{expand:u}=er(),{flatten:d}=nr(),{fromRDF:f}=rr(),{toRDF:p}=ar(),{frameMergedOrDefault:m,cleanupNull:h}=or(),{isArray:g,isObject:_,isString:v}=Ln(),{isSubjectReference:y}=Rn(),{expandIri:b,getInitialContext:x,process:S,processingMode:C}=$n(),{compact:w,compactIri:T}=sr(),{createNodeMap:E,createMergedNodeMap:D,mergeNodeMaps:O}=tr(),{logEventHandler:k,logWarningEventHandler:A,safeEventHandler:j,setDefaultEventHandler:M,setupEventHandler:N,strictEventHandler:P,unhandledEventHandler:F}=Qn(),I=function(e){let t={},I=new c({max:100});e.compact=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not compact, too few arguments.`);if(n===null)throw new s(`The compaction context must not be null.`,`jsonld.CompactError`,{code:`invalid local context`});if(t===null)return null;r=L(r,{base:v(t)?t:``,compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new o(`_:b`),contextResolver:new a({sharedCache:I})}),r.link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base;let c;c=r.skipExpansion?t:await e.expand(t,r);let l=await e.processContext(x(r),n,r),u=await w({activeCtx:l,element:c,options:r});r.compactArrays&&!r.graph&&g(u)?u.length===1?u=u[0]:u.length===0&&(u={}):r.graph&&_(u)&&(u=[u]),_(n)&&`@context`in n&&(n=n[`@context`]),n=i.clone(n),g(n)||(n=[n]);let d=n;n=[];for(let e=0;e<d.length;++e)(!_(d[e])||Object.keys(d[e]).length>0)&&n.push(d[e]);let f=n.length>0;if(n.length===1&&(n=n[0]),g(u)){let e=T({activeCtx:l,iri:`@graph`,relativeTo:{vocab:!0}}),t=u;u={},f&&(u[`@context`]=n),u[e]=t}else if(_(u)&&f){let e=u;u={"@context":n};for(let t in e)u[t]=e[t]}return u},e.expand=async function(t,n){if(arguments.length<1)throw TypeError(`Could not expand, too few arguments.`);n=L(n,{keepFreeFloatingNodes:!1,contextResolver:new a({sharedCache:I})});let r={},o=[];if(`expandContext`in n){let e=i.clone(n.expandContext);_(e)&&`@context`in e?r.expandContext=e:r.expandContext={"@context":e},o.push(r.expandContext)}let s;if(!v(t))r.input=i.clone(t);else{let i=await e.get(t,n);s=i.documentUrl,r.input=i.document,i.contextUrl&&(r.remoteContext={"@context":i.contextUrl},o.push(r.remoteContext))}`base`in n||(n.base=s||``);let c=x(n);for(let e of o)c=await S({activeCtx:c,localCtx:e,options:n});let l=await u({activeCtx:c,element:r.input,options:n});return _(l)&&`@graph`in l&&Object.keys(l).length===1?l=l[`@graph`]:l===null&&(l=[]),g(l)||(l=[l]),l},e.flatten=async function(t,n,r){if(arguments.length<1)return TypeError(`Could not flatten, too few arguments.`);typeof n==`function`?n=null:n||=null,r=L(r,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})});let i=d(await e.expand(t,r));return n===null?i:(r.graph=!0,r.skipExpansion=!0,await e.compact(i,n,r))},e.frame=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not frame, too few arguments.`);if(r=L(r,{base:v(t)?t:``,embed:`@once`,explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new a({sharedCache:I})}),v(n)){let t=await e.get(n,r);if(n=t.document,t.contextUrl){let e=n[`@context`];e?g(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n[`@context`]=e}}let i=n&&n[`@context`]||{},o=await e.processContext(x(r),i,r);r.hasOwnProperty(`omitGraph`)||(r.omitGraph=C(o,1.1)),r.hasOwnProperty(`pruneBlankNodeIdentifiers`)||(r.pruneBlankNodeIdentifiers=C(o,1.1));let s=await e.expand(t,r),c={...r};c.isFrame=!0,c.keepFreeFloatingNodes=!0;let l=await e.expand(n,c);c.merged=!Object.keys(n).map(e=>b(o,e,{vocab:!0})).includes(`@graph`),c.is11=C(o,1.1);let u=m(s,l,c);c.graph=!r.omitGraph,c.skipExpansion=!0,c.link={},c.framing=!0;let d=await e.compact(u,i,c);return c.link={},d=h(d,c),d},e.link=async function(t,n,r){let i={};return n&&(i[`@context`]=n),i[`@embed`]=`@link`,e.frame(t,i,r)},e.normalize=e.canonize=async function(t,r){if(arguments.length<1)throw TypeError(`Could not canonize, too few arguments.`);r=L(r,{skipExpansion:!1,safe:!0,contextResolver:new a({sharedCache:I})});let i=Object.assign({},{algorithm:`RDFC-1.0`},r.canonizeOptions||null);if(`inputFormat`in r){if(r.inputFormat!==`application/n-quads`)throw new s(`Unknown canonicalization input format.`,`jsonld.CanonizeError`);let e=l.parse(t);return n.canonize(e,i)}let o={...r};delete o.format,delete o.canonizeOptions,o.produceGeneralizedRdf=!1;let c=await e.toRDF(t,o);return n.canonize(c,i)},e.fromRDF=async function(e,n){if(arguments.length<1)throw TypeError(`Could not convert from RDF, too few arguments.`);n=L(n,{format:v(e)?`application/n-quads`:void 0});let{format:r}=n,{rdfParser:i}=n;if(r){if(i||=t[r],!i)throw new s(`Unknown input format.`,`jsonld.UnknownFormat`,{format:r})}else i=()=>e;return f(await i(e),n)},e.toRDF=async function(t,n){if(arguments.length<1)throw TypeError(`Could not convert to RDF, too few arguments.`);n=L(n,{skipExpansion:!1,contextResolver:new a({sharedCache:I})});let r;r=n.skipExpansion?t:await e.expand(t,n);let i=p(r,n);if(n.format){if(n.format===`application/n-quads`)return l.serialize(i);throw new s(`Unknown output format.`,`jsonld.UnknownFormat`,{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw TypeError(`Could not create node map, too few arguments.`);return n=L(n,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})}),D(await e.expand(t,n),n)},e.merge=async function(t,n,r){if(arguments.length<1)throw TypeError(`Could not merge, too few arguments.`);if(!g(t))throw TypeError(`Could not merge, "docs" must be an array.`);typeof n==`function`?n=null:n||=null,r=L(r,{contextResolver:new a({sharedCache:I})});let s=await Promise.all(t.map(t=>{let n={...r};return e.expand(t,n)})),c=!0;`mergeNodes`in r&&(c=r.mergeNodes);let l=r.issuer||new o(`_:b`),u={"@default":{}};for(let e=0;e<s.length;++e){let t=i.relabelBlankNodes(s[e],{issuer:new o(`_:b`+e+`-`)}),n=c||e===0?u:{"@default":{}};if(E(t,n,`@default`,l),n!==u)for(let e in n){let t=n[e];if(!(e in u)){u[e]=t;continue}let r=u[e];for(let e in t)e in r||(r[e]=t[e])}}let d=O(u),f=[],p=Object.keys(d).sort();for(let e=0;e<p.length;++e){let t=d[p[e]];y(t)||f.push(t)}return n===null?f:(r.graph=!0,r.skipExpansion=!0,await e.compact(f,n,r))},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new s(`Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:e})},e.get=async function(t,n){let r;r=typeof n.documentLoader==`function`?n.documentLoader:e.documentLoader;let i=await r(t);try{if(!i.document)throw new s(`No remote document found at the given URL.`,`jsonld.NullRemoteDocument`);v(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new s(`Could not retrieve a JSON-LD document from the URL.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,n){return n=L(n,{base:``,contextResolver:new a({sharedCache:I})}),t===null?x(n):(t=i.clone(t),_(t)&&`@context`in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=$n().getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new s(`Unknown document loader type: "`+t+`"`,`jsonld.UnknownDocumentLoader`,{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,n){t[e]=n},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser(`application/n-quads`,l.parse),e.url=Un(),e.logEventHandler=k,e.logWarningEventHandler=A,e.safeEventHandler=j,e.setDefaultEventHandler=M,e.strictEventHandler=P,e.unhandledEventHandler=F,e.util=i,Object.assign(e,i),e.promises=e,e.RequestQueue=Hn(),e.JsonLdProcessor=cr()(e),r.setupGlobals(e),r.setupDocumentLoaders(e);function L(t,{documentLoader:n=e.documentLoader,...r}){if(t&&`compactionMap`in t)throw new s(`"compactionMap" not supported.`,`jsonld.OptionsError`);if(t&&`expansionMap`in t)throw new s(`"expansionMap" not supported.`,`jsonld.OptionsError`);return Object.assign({},{documentLoader:n},r,t,{eventHandler:N({options:t})})}return e},L=function(){return I(function(){return L()})};I(L),t.exports=L})),ur=En(),dr=l(lr(),1),fr={},pr={};async function mr(e){return`rdf`in e?gr(e.rdf):e.rdfUrlResolver?gr(await e.rdfUrlResolver(e.url)):hr(e.url,e.proxy)}async function hr(e,t){return e in fr||(fr[e]=(async()=>{let n=e;t&&(n=t+encodeURIComponent(e));let r=await fetch(n,{headers:{Accept:`text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json`}});return r.ok?gr(await r.text()):(console.warn(`failed fetching RDF from`,e),[])})()),fr[e]}async function gr(e){if(!e.trim())return[];let t=_r(e);if(t===`json`)try{e=await dr.default.toRDF(JSON.parse(e),{format:`application/n-quads`})}catch(e){console.error(e)}let n=[];return await new Promise((r,i)=>{let a=t===`xml`?new ur.RdfXmlParser:new at;a.on(`data`,e=>{n.push(k.quad(e.subject,e.predicate,e.object,e.graph))}).on(`error`,e=>{i(e)}).on(`prefix`,(e,t)=>{e&&(pr[e]=t)}).on(`end`,()=>{r(null)}),a.write(e),a.end()}),n}function _r(e){return/^\s*[\\[{]/.test(e)?`json`:/^\s*<\?xml/.test(e)?`xml`:`ttl`}var vr={[`${J}name`]:(e,t)=>{let n=t;e.name=Yt(e.config.languages,e.name,n)},[`${J}description`]:(e,t)=>{let n=t;e.description=Yt(e.config.languages,e.description,n)},[`${J}path`]:(e,t)=>{if(t.termType===`NamedNode`){e.path=t.value;return}let n=e.config.store.getQuads(t,null,null,null),r=n.filter(e=>e.predicate.value===`${J}alternativePath`);if(n.length!==1||r.length!==1){console.warn(`ignoring unsupported or malformed SHACL property path`,t.value);return}let i=e.config.lists[r[0].object.value];if(!i||i.length<2||i.some(e=>e.termType!==`NamedNode`)){console.warn(`ignoring sh:alternativePath without at least two predicate IRI members`,t.value);return}e.pathAlternatives=i.map(e=>e.value),e.path=e.pathAlternatives[0]},[`${J}group`]:(e,t)=>{e.group=t.id},[`${J}datatype`]:(e,t)=>{e.datatype=t},[`${J}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${J}minCount`]:(e,t)=>{e.minCount=parseInt(t.value)},[`${J}maxCount`]:(e,t)=>{e.maxCount=parseInt(t.value)},[`${J}minLength`]:(e,t)=>{e.minLength=parseInt(t.value)},[`${J}maxLength`]:(e,t)=>{e.maxLength=parseInt(t.value)},[`${J}minInclusive`]:(e,t)=>{e.minInclusive=parseInt(t.value)},[`${J}maxInclusive`]:(e,t)=>{e.maxInclusive=parseInt(t.value)},[`${J}minExclusive`]:(e,t)=>{e.minExclusive=parseInt(t.value)},[`${J}maxExclusive`]:(e,t)=>{e.maxExclusive=parseInt(t.value)},[`${J}pattern`]:(e,t)=>{e.pattern=t.value},[`${J}order`]:(e,t)=>{e.order=parseInt(t.value)},[`${ot}singleLine`]:(e,t)=>{e.singleLine=t.value===`true`},[`${ot}readonly`]:(e,t)=>{e.readonly=t.value===`true`},[`${ot}facet`]:(e,t)=>{e.facet=t.value===`true`||t.value===`1`},[`${ut}styleClass`]:(e,t)=>{e.cssClass=t.value},[`${J}in`]:(e,t)=>{e.in=t.value},[`${J}languageIn`]:(e,t)=>{e.languageIn=e.config.lists[t.value],e.datatype=vt},[`${J}defaultValue`]:(e,t)=>{e.defaultValue=t},[`${J}hasValue`]:(e,t)=>{e.hasValue=t},[`${J}node`]:(e,t)=>{e.node=t,e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${J}and`]:(e,t)=>{e.and=t.value;let n=e.config.lists[e.and];if(n?.length)for(let t of n)e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${J}qualifiedValueShape`]:(e,t)=>{let n=e.config.getNodeTemplate(t,e);e.qualifiedValueShape=n,e.nodeShapes.add(n)},[`${J}qualifiedMinCount`]:(e,t)=>{e.qualifiedMinCount=parseInt(t.value)},[`${J}qualifiedMaxCount`]:(e,t)=>{e.qualifiedMaxCount=parseInt(t.value)},[xt.id]:(e,t)=>{e.owlImports.add(t)},[Dt.id]:(e,t)=>{e.class=t;let n=e.config.store.getSubjects(At,t,null);n.length>0&&(e.node=n[0])},[`${J}or`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.or=n:console.error(`list for sh:or not found:`,t.value,`existing lists:`,e.config.lists)},[`${J}xone`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.xone=n:console.error(`list for sh:xone not found:`,t.value,`existing lists:`,e.config.lists)}},yr=class{constructor(e,t){this.label=``,this.nodeShapes=new Set,this.owlImports=new Set,this.id=e,this.parent=t,this.config=t.config,this.config.registerPropertyTemplate(this),Cr(this,this.config.store.getQuads(e,null,null,null))}};function br(e){return Math.max(e.minCount??0,e.qualifiedMinCount??0)}function xr(e){return Math.min(e.maxCount??2**53-1,e.qualifiedMaxCount??2**53-1)}function Sr(e){let t=Object.assign({},e);return t.nodeShapes=new Set(e.nodeShapes),t.owlImports=new Set(e.owlImports),e.languageIn&&(t.languageIn=[...e.languageIn]),e.pathAlternatives&&(t.pathAlternatives=[...e.pathAlternatives]),e.pathAlternativeBranches&&(t.pathAlternativeBranches={...e.pathAlternativeBranches}),e.or&&(t.or=[...e.or]),e.xone&&(t.xone=[...e.xone]),t}function Cr(e,t){for(let n of t)vr[n.predicate.id]?.call(e,e,n.object);return e.label=e.name?.value||Bt(t,e.config.languages),e.label||=e.pathAlternatives?e.pathAlternatives.map(e=>Ht(e,pr)).join(` / `):e.path?Ht(e.path,pr):`unknown`,e}function wr(e,t,n=!1){let r=t,i=e,a=Dr(e),o=Dr(t),s=a&&Or(t),c=o&&Or(e);s&&(e.nodeShapes.clear(),e.node=void 0);for(let a in t)if(a!==`parent`&&a!==`config`&&a!==`id`){let o=r[a];if(o!==void 0&&o!==``){if(a===`label`)continue;if(a===`name`||a===`description`||a===`group`||a===`order`)(n||i[a]===void 0||i[a]===``)&&(i[a]=o);else if(a===`minCount`)e.minCount=Math.max(e.minCount??0,t.minCount);else if(a===`maxCount`)e.maxCount=Math.min(e.maxCount??2**53-1,t.maxCount);else if(a===`qualifiedMinCount`)e.qualifiedMinCount=Math.max(e.qualifiedMinCount??0,t.qualifiedMinCount);else if(a===`qualifiedMaxCount`)e.qualifiedMaxCount=Math.min(e.qualifiedMaxCount??2**53-1,t.qualifiedMaxCount);else if(a===`nodeShapes`&&c)continue;else if(a===`node`&&c)continue;else if(a===`pathAlternatives`)continue;else if(Array.isArray(o)){let e=i[a];Array.isArray(e)?e.push(...o):i[a]=[...o]}else if(o instanceof Set&&o.size){let e=i[a];i[a]=new Set([...e instanceof Set?e:[],...o])}else i[a]=o}}e.name&&(e.label=e.name.value)}function Tr(e){return e.pathAlternatives?`alternative:${JSON.stringify(e.pathAlternatives)}`:e.path}function Er(e){return e.pathAlternatives?[...e.pathAlternatives]:e.path}function Dr(e){return e.nodeShapes.size>0&&e.qualifiedValueShape===void 0&&e.name===void 0&&e.description===void 0&&!Or(e)}function Or(e){return e.in!==void 0||e.datatype!==void 0||e.languageIn!==void 0||e.class!==void 0||e.hasValue!==void 0||e.defaultValue!==void 0}var kr=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),Ar=function(e){return`/`+e},jr={},Mr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Ar(t,n),t=s(t),t in jr)return;jr[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:kr,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Nr(e,t,n,r,i){let a=document.createElement(`div`);a.classList.add(`shacl-or-constraint`),a.setAttribute(`part`,`constraint`);let o=[];if(t instanceof Fo){let r=[],i=!1;e.length&&(i=n.store.countQuads(e[0],Et,null,null)>0);for(let a=0;a<e.length;a++)if(i){let i=n.store.getObjects(e[a],Et,null),s=[],c=``;for(let e of i){let r=new co(n.getPropertyTemplate(e,t.template),t);s.push(r),c+=(c.length>0?` / `:``)+r.template.label}r.push(s),o.push({label:c,value:a.toString()})}else{let i=e[a],s=new co(n.getPropertyTemplate(i,t.template),t);r.push([s]),o.push({label:s.template.label,value:a.toString()})}let s=n.theme.createListEditor(`Please choose`,null,!1,o);s.setAttribute(`part`,`constraint-editor`);let c=s.querySelector(`.editor`);c.onchange=async()=>{if(c.value){let e=r[parseInt(c.value)];if(n.queryMode){let{activateNodeConstraintOption:t}=await Mr(async()=>{let{activateNodeConstraintOption:e}=await import(`./mode-bo0QsQ7I.js`);return{activateNodeConstraintOption:e}},[]);await t(e,a);return}let i;if(e.length){for(let n of e)await n.bindValues(t.nodeId,!1);i=e[0],a.replaceWith(e[0]),i.updateControls()}for(let t=1;t<e.length;t++)i.after(e[t]),i=e[t],i.updateControls()}},a.appendChild(s)}else{let s=[];for(let t=0;t<e.length;t++){let r=n.store.getQuads(e[t],null,null,null);if(r.length){s.push(r);let e=Bt(r,n.languages);for(let t of r)t.predicate.equals(Ot)&&(e||=Bt(n.store.getQuads(t.object,null,null,null),n.languages));o.push({label:e||Ht(r[0].predicate.value,pr)+` = `+Ht(r[0].object.value,pr),value:(s.length-1).toString()})}}let c=n.theme.createListEditor(t.template.label+`?`,null,!1,o,t.template);c.setAttribute(`part`,`constraint-editor`);let l=c.querySelector(`.editor`);l.onchange=async()=>{if(l.value){let e=Cr(Sr(i??t.template),s[parseInt(l.value)]);if(e.or=void 0,e.xone=void 0,n.queryMode){let{activatePropertyConstraintOption:n}=await Mr(async()=>{let{activatePropertyConstraintOption:e}=await import(`./mode-bo0QsQ7I.js`);return{activatePropertyConstraintOption:e}},[]);await n(e,t,a);return}if(r||xr(t.template)>1){let n=await yo(e,void 0,!0,!1,t.parent);n.dataset.path=t.template.path,r&&(n.dataset.predicate=r),a.replaceWith(n),n.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0}));return}e.pathAlternatives=void 0;let o=new co(e,t.parent);t.replaceWith(o),await o.updateControls()}},a.appendChild(c)}return a}function Pr(e,t,n,r=!1){let i=document.createElement(`div`);i.classList.add(`alternative-path-constraint`),i.setAttribute(`part`,`constraint`),i.dataset.path=e.template.path;let a=e.template.pathAlternatives.map((e,t)=>({label:Ht(e,pr),value:t.toString()})),o=e.template.config.theme.createListEditor(`${e.template.label}: path`,null,!1,a,e.template);o.setAttribute(`part`,`constraint-editor`);let s=o.querySelector(`.editor`);return s.onchange=async()=>{if(s.value===``)return;let r=e.template.pathAlternatives[parseInt(s.value)],a=await e.addPropertyInstance(t,n,!0,r,!1);a&&(i.replaceWith(a),a.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0})))},i.appendChild(o),bo(i,e.template.label,e.template.config.theme.dense,e.template.config.hierarchyColorsStyleSheet!==void 0,r),i}function Fr(e,t,n){if(t.termType===`Literal`){let r=t.datatype;for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(t.predicate.value===`http://www.w3.org/ns/shacl#datatype`&&t.object.equals(r))return e}}else{let r=n.store.getObjects(t,mt,null);for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(r.length>0){if(t.predicate.value===`http://www.w3.org/ns/shacl#node`){for(let i of r)if(n.store.getQuads(t.object,At,i,null).length>0)return e}if(t.predicate.equals(Dt)){for(let n of r)if(t.object.equals(n))return e}}else if(t.predicate.equals(jt)&&t.object.equals(Tt))return e}}return console.error(`couldn't resolve sh:or/sh:xone on property for value`,t),[]}function Ir(e,t,n){for(let r of e){let e=!1,i=n.store.getObjects(r,Et,null);for(let r of i){let i=n.store.getObjects(r,`${J}path`,null);for(let r of i)if(e=n.store.countQuads(t,r,null,null)>0,e)break}if(e)return i}return console.error(`couldn't resolve sh:or/sh:xone on node for value`,t),[]}var Lr=`:host {
26
+ `;case`f`:return`\f`;case`r`:return`\r`;case`"`:return`"`;case`'`:return`'`;case`\\`:return`\\`}if(n)return String.fromCharCode(parseInt(n,16));if(r)return String.fromCodePoint(parseInt(r,16))}):e}var m=/[\u0000-\u0020<>"{}|^`\\]/g,h=[];for(let e=0;e<=127;++e)m.test(String.fromCharCode(e))&&(h[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),m.lastIndex=0);function g(e){return m.test(e)?e.replace(m,function(e){return h[e.codePointAt(0)]}):e}var _=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function v(e){return _.test(e)?e.replace(_,function(e,t,n){if(t)return String.fromCharCode(parseInt(t,16));if(n)return String.fromCodePoint(parseInt(n,16))}):e}})),Pn=o(((e,t)=>{var n=On(),r=jn(),i=Mn(),a=Nn(),{setImmediate:o}=An();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,signal:s=null}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.signal=s,this.quads=null}async main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()],i=0;for(let e of r)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let o=[...t.keys()].sort(),c=[];for(let e of o){let n=t.get(e);if(n.length>1){c.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=c.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of c){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=await this.hashNDegreeQuads(r,e);t.push(i)}t.sort(s);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let l=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));l.push(t)}return l.sort(),l.join(``)}async hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}async hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=await this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0){if(this.signal&&this.signal.aborted)throw Error(`Abort signal received: "${this.signal.reason}".`);await this._yield()}let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=await this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:await n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads,i=0;for(let a of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:a,component:a.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.graph,position:`g`,id:e,issuer:t,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=await this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}async _yield(){return new Promise(e=>o(e))}};function s(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),Fn=o(((e,t)=>{var n=On(),r=jn(),i=Mn(),a=Nn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,timeout:s=0}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.timeout=s,s>0&&(this.startTime=Date.now()),this.quads=null}main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()];for(let e of r)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let i=[...t.keys()].sort(),s=[];for(let e of i){let n=t.get(e);if(n.length>1){s.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=s.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of s){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=this.hashNDegreeQuads(r,e);t.push(i)}t.sort(o);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let c=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join(``)}hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0&&this.timeout>0&&Date.now()-this.startTime>this.timeout)throw Error(`Canonize timeout.`);let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads;for(let i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:`g`,id:e,issuer:t,hashToRelated:n});return n}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}};function o(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),In=o((e=>{var t=Pn(),n=Fn();function r(t,n){if(n.inputFormat){if(n.inputFormat===`application/n-quads`){if(typeof t!=`string`)throw Error(`N-Quads input must be a string.`);return e.NQuads.parse(t)}throw Error(`Unknown canonicalization input format: "${n.inputFormat}".`)}return t}function i(e){if(e.format&&e.format!==`application/n-quads`)throw Error(`Unknown canonicalization output format: "${e.format}".`)}function a(){globalThis.RDF_CANONIZE_TRACE_URDNA2015&&console.trace(`[rdf-canonize] URDNA2015 is deprecated, use RDFC-1.0`)}e.NQuads=Nn(),e.IdentifierIssuer=On(),e.canonize=async function(e,n={}){let o=r(e,n);if(i(n),!(`algorithm`in n))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(n.algorithm===`RDFC-1.0`)return new t(n).main(o);if(n.algorithm===`URDNA2015`&&!n.rejectURDNA2015)return a(),new t(n).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+n.algorithm)},e._canonizeSync=function(e,t={}){let o=r(e,t);if(i(t),!(`algorithm`in t))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(t.algorithm===`RDFC-1.0`)return new n(t).main(o);if(t.algorithm===`URDNA2015`&&!t.rejectURDNA2015)return a(),new n(t).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+t.algorithm)}})),Ln=o(((e,t)=>{t.exports=In()})),Rn=o(((e,t)=>{var n={};t.exports=n,n.isArray=Array.isArray,n.isBoolean=e=>typeof e==`boolean`||Object.prototype.toString.call(e)===`[object Boolean]`,n.isDouble=e=>n.isNumber(e)&&(String(e).indexOf(`.`)!==-1||Math.abs(e)>=1e21),n.isEmptyObject=e=>n.isObject(e)&&Object.keys(e).length===0,n.isNumber=e=>typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`,n.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),n.isObject=e=>Object.prototype.toString.call(e)===`[object Object]`,n.isString=e=>typeof e==`string`||Object.prototype.toString.call(e)===`[object String]`,n.isUndefined=e=>e===void 0})),zn=o(((e,t)=>{var n=Rn(),r={};t.exports=r,r.isSubject=e=>n.isObject(e)&&!(`@value`in e||`@set`in e||`@list`in e)?Object.keys(e).length>1||!(`@id`in e):!1,r.isSubjectReference=e=>n.isObject(e)&&Object.keys(e).length===1&&`@id`in e,r.isValue=e=>n.isObject(e)&&`@value`in e,r.isList=e=>n.isObject(e)&&`@list`in e,r.isGraph=e=>n.isObject(e)&&`@graph`in e&&Object.keys(e).filter(e=>e!==`@id`&&e!==`@index`).length===1,r.isSimpleGraph=e=>r.isGraph(e)&&!(`@id`in e),r.isBlankNode=e=>{if(n.isObject(e)){if(`@id`in e){let t=e[`@id`];return!n.isString(t)||t.indexOf(`_:`)===0}return Object.keys(e).length===0||!(`@value`in e||`@set`in e||`@list`in e)}return!1}})),Bn=o(((e,t)=>{t.exports=class extends Error{constructor(e=`An unspecified JSON-LD error occurred.`,t=`jsonld.Error`,n={}){super(e),this.name=t,this.message=e,this.details=n}}})),Vn=o(((e,t)=>{var n=zn(),r=Rn(),i=Ln().IdentifierIssuer,a=Bn(),o=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,c=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,l=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,d={headers:{accept:`application/ld+json, application/json`}},f={};t.exports=f,f.IdentifierIssuer=i,f.REGEX_BCP47=o,f.REGEX_KEYWORD=u,f.clone=function(e){if(e&&typeof e==`object`){let t;if(r.isArray(e)){t=[];for(let n=0;n<e.length;++n)t[n]=f.clone(e[n])}else if(e instanceof Map){t=new Map;for(let[n,r]of e)t.set(n,f.clone(r))}else if(e instanceof Set){t=new Set;for(let n of e)t.add(f.clone(n))}else if(r.isObject(e)){t={};for(let n in e)t[n]=f.clone(e[n])}else t=e.toString();return t}return e},f.asArray=function(e){return Array.isArray(e)?e:[e]},f.buildHeaders=(e={})=>{if(Object.keys(e).some(e=>e.toLowerCase()===`accept`))throw RangeError(`Accept header may not be specified; only "`+d.headers.accept+`" is supported.`);return Object.assign({Accept:d.headers.accept},e)},f.parseLinkHeader=e=>{let t={},n=e.match(s);for(let e=0;e<n.length;++e){let r=n[e].match(c);if(!r)continue;let i={target:r[1]},a=r[2];for(;r=l.exec(a);)i[r[1]]=r[2]===void 0?r[3]:r[2];let o=i.rel||``;Array.isArray(t[o])?t[o].push(i):t.hasOwnProperty(o)?t[o]=[t[o],i]:t[o]=i}return t},f.validateTypeValue=(e,t)=>{if(!r.isString(e)&&!(r.isArray(e)&&e.every(e=>r.isString(e)))){if(t&&r.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if(`@default`in e&&f.asArray(e[`@default`]).every(e=>r.isString(e)))return}throw new a(`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:e})}},f.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){let n=e[t];return!r.isArray(n)||n.length>0}return!1},f.hasValue=(e,t,i)=>{if(f.hasProperty(e,t)){let a=e[t],o=n.isList(a);if(r.isArray(a)||o){o&&(a=a[`@list`]);for(let e=0;e<a.length;++e)if(f.compareValues(i,a[e]))return!0}else if(!r.isArray(i))return f.compareValues(i,a)}return!1},f.addValue=(e,t,n,i)=>{if(i||={},`propertyIsArray`in i||(i.propertyIsArray=!1),`valueIsArray`in i||(i.valueIsArray=!1),`allowDuplicate`in i||(i.allowDuplicate=!0),`prependValue`in i||(i.prependValue=!1),i.valueIsArray)e[t]=n;else if(r.isArray(n)){n.length===0&&i.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),i.prependValue&&(n=n.concat(e[t]),e[t]=[]);for(let r=0;r<n.length;++r)f.addValue(e,t,n[r],i)}else if(e.hasOwnProperty(t)){let a=!i.allowDuplicate&&f.hasValue(e,t,n);!r.isArray(e[t])&&(!a||i.propertyIsArray)&&(e[t]=[e[t]]),a||(i.prependValue?e[t].unshift(n):e[t].push(n))}else e[t]=i.propertyIsArray?[n]:n},f.getValues=(e,t)=>[].concat(e[t]||[]),f.removeProperty=(e,t)=>{delete e[t]},f.removeValue=(e,t,n,r)=>{r||={},`propertyIsArray`in r||(r.propertyIsArray=!1);let i=f.getValues(e,t).filter(e=>!f.compareValues(e,n));i.length===0?f.removeProperty(e,t):i.length===1&&!r.propertyIsArray?e[t]=i[0]:e[t]=i},f.relabelBlankNodes=(e,t)=>(t||={},p(t.issuer||new i(`_:b`),e)),f.compareValues=(e,t)=>e===t||n.isValue(e)&&n.isValue(t)&&e[`@value`]===t[`@value`]&&e[`@type`]===t[`@type`]&&e[`@language`]===t[`@language`]&&e[`@index`]===t[`@index`]?!0:r.isObject(e)&&`@id`in e&&r.isObject(t)&&`@id`in t?e[`@id`]===t[`@id`]:!1,f.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1;function p(e,t){if(r.isArray(t))for(let n=0;n<t.length;++n)t[n]=p(e,t[n]);else if(n.isList(t))t[`@list`]=p(e,t[`@list`]);else if(r.isObject(t)){n.isBlankNode(t)&&(t[`@id`]=e.getId(t[`@id`]));let r=Object.keys(t).sort();for(let n=0;n<r.length;++n){let i=r[n];i!==`@id`&&(t[i]=p(e,t[i]))}}return t}})),Hn=o(((e,t)=>{t.exports={LINK_HEADER_REL:`http://www.w3.org/ns/json-ld#context`,LINK_HEADER_CONTEXT:`http://www.w3.org/ns/json-ld#context`,RDF:`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,RDF_LIST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#List`,RDF_FIRST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`,RDF_REST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`,RDF_NIL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#nil`,RDF_TYPE:`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`,RDF_PLAIN_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral`,RDF_XML_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral`,RDF_JSON_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON`,RDF_OBJECT:`http://www.w3.org/1999/02/22-rdf-syntax-ns#object`,RDF_LANGSTRING:`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,XSD:`http://www.w3.org/2001/XMLSchema#`,XSD_BOOLEAN:`http://www.w3.org/2001/XMLSchema#boolean`,XSD_DOUBLE:`http://www.w3.org/2001/XMLSchema#double`,XSD_INTEGER:`http://www.w3.org/2001/XMLSchema#integer`,XSD_STRING:`http://www.w3.org/2001/XMLSchema#string`}})),Un=o(((e,t)=>{t.exports=class{constructor(){this._requests={}}wrapLoader(e){let t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}})),Wn=o(((e,t)=>{var n=Rn(),r={};t.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:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(e,t)=>{let n={},i=r.parsers[t||`full`],a=i.regex.exec(e),o=i.keys.length;for(;o--;)n[i.keys[o]]=a[o]===void 0?null:a[o];return(n.scheme===`https`&&n.port===`443`||n.scheme===`http`&&n.port===`80`)&&(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=(e,t)=>{if(e===null||r.isAbsolute(t))return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=r.parse(t),a={protocol:e.protocol||``};if(i.authority!==null)a.authority=i.authority,a.path=i.path,a.query=i.query;else if(a.authority=e.authority,i.path===``)a.path=e.path,i.query===null?a.query=e.query:a.query=i.query;else{if(i.path.indexOf(`/`)===0)a.path=i.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf(`/`)+1),(t.length>0||e.authority)&&t.substr(-1)!==`/`&&(t+=`/`),t+=i.path,a.path=t}a.query=i.query}i.path!==``&&(a.path=r.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+=`//`+a.authority),o+=a.path,a.query!==null&&(o+=`?`+a.query),i.fragment!==null&&(o+=`#`+i.fragment),o===``&&(o=`./`),o},r.removeBase=(e,t)=>{if(e===null)return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=``;if(e.href===``?t.indexOf(`//`)&&(i+=`//`):i+=(e.protocol||``)+`//`+(e.authority||``),t.indexOf(i)!==0)return t;let a=r.parse(t.substr(i.length)),o=e.normalizedPath.split(`/`),s=a.normalizedPath.split(`/`),c=a.fragment||a.query?0:1;for(;o.length>0&&s.length>c&&o[0]===s[0];)o.shift(),s.shift();let l=``;if(o.length>0){o.pop();for(let e=0;e<o.length;++e)l+=`../`}return l+=s.join(`/`),a.query!==null&&(l+=`?`+a.query),a.fragment!==null&&(l+=`#`+a.fragment),l===``&&(l=`./`),l},r.removeDotSegments=e=>{if(e.length===0)return``;let t=e.split(`/`),n=[];for(;t.length>0;){let e=t.shift(),r=t.length===0;if(e===`.`){r&&n.push(``);continue}if(e===`..`){n.pop(),r&&n.push(``);continue}n.push(e)}return e[0]===`/`&&n.length>0&&n[0]!==``&&n.unshift(``),n.length===1&&n[0]===``?`/`:n.join(`/`)};var i=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;r.isAbsolute=e=>n.isString(e)&&i.test(e),r.isRelative=e=>n.isString(e)})),Gn=o(((e,t)=>{var{parseLinkHeader:n,buildHeaders:r}=Vn(),{LINK_HEADER_CONTEXT:i}=Hn(),a=Bn(),o=Un(),{prependBase:s}=Wn(),c=/(^|(\r\n))link:/i;t.exports=({secure:e,headers:t={},xhr:u}={headers:{}})=>{return t=r(t),new o().wrapLoader(d);async function d(r){if(r.indexOf(`http:`)!==0&&r.indexOf(`https:`)!==0)throw new a(`URL could not be dereferenced; only "http" and "https" URLs are supported.`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});if(e&&r.indexOf(`https`)!==0)throw new a(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});let o;try{o=await l(u,r,t)}catch(e){throw new a(`URL could not be dereferenced, an error occurred.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,cause:e})}if(o.status>=400)throw new a(`URL could not be dereferenced: `+o.statusText,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,httpStatusCode:o.status});let f={contextUrl:null,documentUrl:r,document:o.response},p=null,m=o.getResponseHeader(`Content-Type`),h;if(c.test(o.getAllResponseHeaders())&&(h=o.getResponseHeader(`Link`)),h&&m!==`application/ld+json`){let e=n(h),t=e[i];if(Array.isArray(t))throw new a(`URL could not be dereferenced, it has more than one associated HTTP Link Header.`,`jsonld.InvalidUrl`,{code:`multiple context link headers`,url:r});t&&(f.contextUrl=t.target),p=e.alternate,p&&p.type==`application/ld+json`&&!(m||``).match(/^application\/(\w*\+)?json$/)&&(f=await d(s(r,p.target)))}return f}};function l(e,t,n){e||=XMLHttpRequest;let r=new e;return new Promise((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open(`GET`,t,!0);for(let e in n)r.setRequestHeader(e,n[e]);r.send()})}})),Kn=o(((e,t)=>{var n=Gn(),r={};t.exports=r,r.setupDocumentLoaders=function(e){typeof XMLHttpRequest<`u`&&(e.documentLoaders.xhr=n,e.useDocumentLoader(`xhr`))},r.setupGlobals=function(e){globalThis.JsonLdProcessor===void 0&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}})),qn=o(((e,t)=>{t.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}})),Jn=o(((e,t)=>{t.exports=n,n.Node=o,n.create=n;function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach==`function`)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}n.prototype.removeNode=function(e){if(e.list!==this)throw Error(`removing node which does not belong to this list`);var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||=e,this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||=e,this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t||=this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t||=this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value},n.prototype.map=function(e,t){t||=this;for(var r=new n,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t||=this;for(var r=new n,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=0;r!==null;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=this.length-1;r!==null;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(;a!==null&&i<t;i++,a=a.next)r.push(a.value);return r},n.prototype.sliceReverse=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,a=this.tail;a!==null&&i>t;i--)a=a.prev;for(;a!==null&&i>e;i--,a=a.prev)r.push(a.value);return r},n.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(var o=[],i=0;a&&i<t;i++)o.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var i=0;i<n.length;i++)a=r(this,a,n[i]);return o},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function r(e,t,n){var r=t===e.head?new o(n,null,t,e):new o(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function i(e,t){e.tail=new o(t,e.tail,null,e),e.head||=e.tail,e.length++}function a(e,t){e.head=new o(t,null,e.head,e),e.tail||=e.head,e.length++}function o(e,t,n,r){if(!(this instanceof o))return new o(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{qn()(n)}catch{}})),Yn=o(((e,t)=>{var n=Jn(),r=Symbol(`max`),i=Symbol(`length`),a=Symbol(`lengthCalculator`),o=Symbol(`allowStale`),s=Symbol(`maxAge`),c=Symbol(`dispose`),l=Symbol(`noDisposeOnSet`),u=Symbol(`lruList`),d=Symbol(`cache`),f=Symbol(`updateAgeOnGet`),p=()=>1,m=class{constructor(e){if(typeof e==`number`&&(e={max:e}),e||={},e.max&&(typeof e.max!=`number`||e.max<0))throw TypeError(`max must be a non-negative number`);this[r]=e.max||1/0;let t=e.length||p;if(this[a]=typeof t==`function`?t:p,this[o]=e.stale||!1,e.maxAge&&typeof e.maxAge!=`number`)throw TypeError(`maxAge must be a number`);this[s]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!=`number`||e<0)throw TypeError(`max must be a non-negative number`);this[r]=e||1/0,_(this)}get max(){return this[r]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=`number`)throw TypeError(`maxAge must be a non-negative number`);this[s]=e,_(this)}get maxAge(){return this[s]}set lengthCalculator(e){typeof e!=`function`&&(e=p),e!==this[a]&&(this[a]=e,this[i]=0,this[u].forEach(e=>{e.length=this[a](e.value,e.key),this[i]+=e.length})),_(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t||=this;for(let n=this[u].tail;n!==null;){let r=n.prev;b(this,e,n,t),n=r}}forEach(e,t){t||=this;for(let n=this[u].head;n!==null;){let r=n.next;b(this,e,n,t),n=r}}keys(){return this[u].toArray().map(e=>e.key)}values(){return this[u].toArray().map(e=>e.value)}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[u]=new n,this[i]=0}dump(){return this[u].map(e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[u]}set(e,t,n){if(n||=this[s],n&&typeof n!=`number`)throw TypeError(`maxAge must be a number`);let o=n?Date.now():0,f=this[a](t,e);if(this[d].has(e)){if(f>this[r])return v(this,this[d].get(e)),!1;let a=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,a.value)),a.now=o,a.maxAge=n,a.value=t,this[i]+=f-a.length,a.length=f,this.get(e),_(this),!0}let p=new y(e,t,f,o,n);return p.length>this[r]?(this[c]&&this[c](e,t),!1):(this[i]+=p.length,this[u].unshift(p),this[d].set(e,this[u].head),_(this),!0)}has(e){if(!this[d].has(e))return!1;let t=this[d].get(e).value;return!g(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){let e=this[u].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[d].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(i===0)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>h(this,t,!1))}},h=(e,t,n)=>{let r=e[d].get(t);if(r){let t=r.value;if(g(e,t)){if(v(e,r),!e[o])return}else n&&(e[f]&&(r.value.now=Date.now()),e[u].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[s]&&n>e[s]},_=e=>{if(e[i]>e[r])for(let t=e[u].tail;e[i]>e[r]&&t!==null;){let n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){let n=t.value;e[c]&&e[c](n.key,n.value),e[i]-=n.length,e[d].delete(n.key),e[u].removeNode(t)}},y=class{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}},b=(e,t,n,r)=>{let i=n.value;g(e,i)&&(v(e,n),e[o]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};t.exports=m})),Xn=o(((e,t)=>{var n=Yn(),r=10;t.exports=class{constructor({document:e}){this.document=e,this.cache=new n({max:r})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}})),Zn=o(((e,t)=>{var{isArray:n,isObject:r,isString:i}=Rn(),{asArray:a}=Vn(),{prependBase:o}=Wn(),s=Bn(),c=Xn(),l=10;t.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:o,base:s,cycles:l=new Set}){t&&r(t)&&t[`@context`]&&(t=t[`@context`]),t=a(t);let d=[];for(let a of t){if(i(a)){let t=this._get(a);t||=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:o,base:s,cycles:l}),n(t)?d.push(...t):d.push(t);continue}if(a===null){d.push(new c({document:null}));continue}r(a)||u(t);let f=JSON.stringify(a),p=this._get(f);p||(p=new c({document:a}),this._cacheResolvedContext({key:f,resolved:p,tag:`static`})),d.push(p)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){let n=this.sharedCache.get(e);n&&(t=n.get(`static`),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),n!==void 0){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:i}){t=o(r,t);let{context:a,remoteDoc:s}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:i});r=s.documentUrl||t,d({context:a,base:r});let c=await this.resolve({activeCtx:e,context:a,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:t,resolved:c,tag:s.tag}),c}async _fetchContext({activeCtx:e,url:t,documentLoader:a,cycles:o}){if(o.size>l)throw new s(`Maximum number of @context URLs exceeded.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`loading remote context failed`:`context overflow`,max:l});if(o.has(t))throw new s(`Cyclical @context URLs detected.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`recursive context inclusion`:`context overflow`,url:t});o.add(t);let c,u;try{u=await a(t),c=u.document||null,i(c)&&(c=JSON.parse(c))}catch(e){throw new s(`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. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`loading remote context failed`,url:t,cause:e})}if(!r(c))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`invalid remote context`,url:t});return c=`@context`in c?{"@context":c[`@context`]}:{"@context":{}},u.contextUrl&&(n(c[`@context`])||(c[`@context`]=[c[`@context`]]),c[`@context`].push(u.contextUrl)),{context:c,remoteDoc:u}}};function u(e){throw new s(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:e})}function d({context:e,base:t}){if(!e)return;let a=e[`@context`];if(i(a)){e[`@context`]=o(t,a);return}if(n(a)){for(let e=0;e<a.length;++e){let n=a[e];if(i(n)){a[e]=o(t,n);continue}r(n)&&d({context:{"@context":n},base:t})}return}if(r(a))for(let e in a)d({context:a[e],base:t})}})),Qn=o(((e,t)=>{t.exports=Ln().NQuads})),$n=o(((e,t)=>{var n=Bn(),{isArray:r}=Rn(),{asArray:i}=Vn(),a={};t.exports=a,a.defaultEventHandler=null,a.setupEventHandler=({options:e={}})=>{let t=[].concat(e.safe?a.safeEventHandler:[],e.eventHandler?i(e.eventHandler):[],a.defaultEventHandler?a.defaultEventHandler:[]);return t.length===0?null:t},a.handleEvent=({event:e,options:t})=>{o({event:e,handlers:t.eventHandler})};function o({event:e,handlers:t}){let i=!0;for(let a=0;i&&a<t.length;++a){i=!1;let s=t[a];if(r(s))i=o({event:e,handlers:s});else if(typeof s==`function`)s({event:e,next:()=>{i=!0}});else if(typeof s==`object`)e.code in s?s[e.code]({event:e,next:()=>{i=!0}}):i=!0;else throw new n(`Invalid event handler.`,`jsonld.InvalidEventHandler`,{event:e})}return i}var s=new Set([`empty object`,`free-floating scalar`,`invalid @language value`,`invalid property`,`null @id value`,`null @value value`,`object with only @id`,`object with only @language`,`object with only @list`,`object with only @value`,`relative @id reference`,`relative @type reference`,`relative @vocab reference`,`reserved @id value`,`reserved @reverse value`,`reserved term`,`blank node predicate`,`relative graph reference`,`relative object reference`,`relative predicate reference`,`relative subject reference`,`rdfDirection not set`]);a.safeEventHandler=function({event:e,next:t}){if(e.level===`warning`&&s.has(e.code))throw new n(`Safe mode validation error.`,`jsonld.ValidationError`,{event:e});t()},a.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},a.logWarningEventHandler=function({event:e,next:t}){e.level===`warning`&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},a.unhandledEventHandler=function({event:e}){throw new n(`No handler for event.`,`jsonld.UnhandledEvent`,{event:e})},a.setDefaultEventHandler=function({eventHandler:e}={}){a.defaultEventHandler=e?i(e):null}})),er=o(((e,t)=>{var n=Vn(),r=Bn(),{isArray:i,isObject:a,isString:o,isUndefined:s}=Rn(),{isAbsolute:c,isRelative:l,prependBase:u}=Wn(),{handleEvent:d}=$n(),{REGEX_BCP47:f,REGEX_KEYWORD:p,asArray:m,compareShortestLeast:h}=Vn(),g=new Map,_=1e4,v={};t.exports=v,v.process=async({activeCtx:e,localCtx:t,options:n,propagate:s=!0,overrideProtected:p=!1,cycles:h=new Set})=>{if(a(t)&&`@context`in t&&i(t[`@context`])&&(t=t[`@context`]),m(t).length===0)return e;let g=[],_=[({event:e,next:t})=>{g.push(e),t()}];n.eventHandler&&_.push(n.eventHandler);let b=n;n={...n,eventHandler:_};let x=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(x[0].document)&&typeof x[0].document[`@propagate`]==`boolean`&&(s=x[0].document[`@propagate`]);let S=e;!s&&!S.previousContext&&(S=S.clone(),S.previousContext=e);for(let i of x){let{document:s}=i;if(e=S,s===null){if(!p&&Object.keys(e.protected).length!==0)throw new r(`Tried to nullify a context with protected terms outside of a term definition.`,`jsonld.SyntaxError`,{code:`invalid context nullification`});S=e=v.getInitialContext(n).clone();continue}let m=i.getProcessed(e);if(m){if(b.eventHandler)for(let e of m.events)d({event:e,options:b});S=e=m.context;continue}if(a(s)&&`@context`in s&&(s=s[`@context`]),!a(s))throw new r(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:s});S=S.clone();let _=new Map;if(`@version`in s){if(s[`@version`]!==1.1)throw new r(`Unsupported JSON-LD version: `+s[`@version`],`jsonld.UnsupportedVersion`,{code:`invalid @version value`,context:s});if(e.processingMode&&e.processingMode===`json-ld-1.0`)throw new r(`@version: `+s[`@version`]+` not compatible with `+e.processingMode,`jsonld.ProcessingModeConflict`,{code:`processing mode conflict`,context:s});S.processingMode=`json-ld-1.1`,S[`@version`]=s[`@version`],_.set(`@version`,!0)}if(S.processingMode=S.processingMode||e.processingMode,`@base`in s){let e=s[`@base`];if(!(e===null||c(e)))if(l(e))e=u(S[`@base`],e);else 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:s});S[`@base`]=e,_.set(`@base`,!0)}if(`@vocab`in s){let e=s[`@vocab`];if(e===null)delete S[`@vocab`];else if(!o(e))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:s});else if(!c(e)&&v.processingMode(S,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:s});else{let t=y(S,e,{vocab:!0,base:!0},void 0,void 0,n);c(t)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`relative @vocab reference`,level:`warning`,message:`Relative @vocab reference found.`,details:{vocab:t}},options:n}),S[`@vocab`]=t}_.set(`@vocab`,!0)}if(`@language`in s){let e=s[`@language`];if(e===null)delete S[`@language`];else if(o(e))e.match(f)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:n}),S[`@language`]=e.toLowerCase();else 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:s});_.set(`@language`,!0)}if(`@direction`in s){let t=s[`@direction`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @direction not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context member`,context:s});if(t===null)delete S[`@direction`];else if(t!==`ltr`&&t!==`rtl`)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:s});else S[`@direction`]=t;_.set(`@direction`,!0)}if(`@propagate`in s){let n=s[`@propagate`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @propagate not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(typeof n!=`boolean`)throw new r(`Invalid JSON-LD syntax; @propagate value must be a boolean.`,`jsonld.SyntaxError`,{code:`invalid @propagate value`,context:t});_.set(`@propagate`,!0)}if(`@import`in s){let i=s[`@import`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @import not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(!o(i))throw new r(`Invalid JSON-LD syntax; @import must be a string.`,`jsonld.SyntaxError`,{code:`invalid @import value`,context:t});let a=await n.contextResolver.resolve({activeCtx:e,context:i,documentLoader:n.documentLoader,base:n.base});if(a.length!==1)throw new r(`Invalid JSON-LD syntax; @import must reference a single context.`,`jsonld.SyntaxError`,{code:`invalid remote context`,context:t});let c=a[0].getProcessed(e);if(c)s=c;else{let n=a[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:t});for(let e in n)s.hasOwnProperty(e)||(s[e]=n[e]);a[0].setProcessed(e,s)}_.set(`@import`,!0)}_.set(`@protected`,s[`@protected`]||!1);for(let e in s)if(v.createTermDefinition({activeCtx:S,localCtx:s,term:e,defined:_,options:n,overrideProtected:p}),a(s[e])&&`@context`in s[e]){let t=s[e][`@context`],i=!0;if(o(t)){let e=u(n.base,t);h.has(e)?i=!1:h.add(e)}if(i)try{await v.process({activeCtx:S.clone(),localCtx:s[e][`@context`],overrideProtected:!0,options:n,cycles:h})}catch{throw new r(`Invalid JSON-LD syntax; invalid scoped context.`,`jsonld.SyntaxError`,{code:`invalid scoped context`,context:s[e][`@context`],term:e})}}i.setProcessed(e,{context:S,events:g})}return S},v.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:s,options:l,overrideProtected:u=!1})=>{if(s.has(n)){if(s.get(n))return;throw new r(`Cyclical context definition detected.`,`jsonld.CyclicalContext`,{code:`cyclic IRI mapping`,context:t,term:n})}s.set(n,!1);let f;if(t.hasOwnProperty(n)&&(f=t[n]),n===`@type`&&a(f)&&(f[`@container`]||`@set`)===`@set`&&v.processingMode(e,1.1)){let e=[`@container`,`@id`,`@protected`],i=Object.keys(f);if(i.length===0||i.some(t=>!e.includes(t)))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n})}else if(v.isKeyword(n))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n});else if(n.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved term`,level:`warning`,message:`Terms beginning with "@" are reserved for future use and dropped.`,details:{term:n}},options:l});return}else if(n===``)throw new r(`Invalid JSON-LD syntax; a term cannot be an empty string.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let m=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let h=!1;if((o(f)||f===null)&&(h=!0,f={"@id":f}),!a(f))throw new r(`Invalid JSON-LD syntax; @context term values must be strings or objects.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let g={};e.mappings.set(n,g),g.reverse=!1;let _=[`@container`,`@id`,`@language`,`@reverse`,`@type`];v.processingMode(e,1.1)&&_.push(`@context`,`@direction`,`@index`,`@nest`,`@prefix`,`@protected`);for(let e in f)if(!_.includes(e))throw new r(`Invalid JSON-LD syntax; a term definition must not contain `+e,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let x=n.indexOf(`:`);if(g._termHasColon=x>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:t});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:t});let i=f[`@reverse`];if(!o(i))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @reverse value`,level:`warning`,message:`@reverse values beginning with "@" are reserved for future use and dropped.`,details:{reverse:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}let a=y(e,i,{vocab:!0,base:!1},t,s,l);if(!c(a))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:t});g[`@id`]=a,g.reverse=!0}else if(`@id`in f){let i=f[`@id`];if(i&&!o(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:t});if(i===null)g[`@id`]=null;else if(!v.isKeyword(i)&&i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`@id values beginning with "@" are reserved for future use and dropped.`,details:{id:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}else if(i!==n){if(i=y(e,i,{vocab:!0,base:!1},t,s,l),!c(i)&&!v.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:t});if(n.match(/(?::[^:])|\//)&&y(e,n,{vocab:!0,base:!1},t,new Map(s).set(n,!0),l)!==i)throw new r(`Invalid JSON-LD syntax; term in form of IRI must expand to definition.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=i,g._prefix=h&&!g._termHasColon&&i.match(/[:\/\?#\[\]@]$/)!==null}}if(!(`@id`in g))if(g._termHasColon){let r=n.substr(0,x);if(t.hasOwnProperty(r)&&v.createTermDefinition({activeCtx:e,localCtx:t,term:r,defined:s,options:l}),e.mappings.has(r)){let t=n.substr(x+1);g[`@id`]=e.mappings.get(r)[`@id`]+t}else g[`@id`]=n}else if(n===`@type`)g[`@id`]=n;else{if(!(`@vocab`in e))throw new r(`Invalid JSON-LD syntax; @context terms must define an @id.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t,term:n});g[`@id`]=e[`@vocab`]+n}if((f[`@protected`]===!0||s.get(`@protected`)===!0&&f[`@protected`]!==!1)&&(e.protected[n]=!0,g.protected=!0),s.set(n,!0),`@type`in f){let n=f[`@type`];if(!o(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be a string.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n===`@json`||n===`@none`){if(v.processingMode(e,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:t})}else if(n!==`@id`&&n!==`@vocab`){if(n=y(e,n,{vocab:!0,base:!1},t,s,l),!c(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n.indexOf(`_:`)===0)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:t})}g[`@type`]=n}if(`@container`in f){let n=o(f[`@container`])?[f[`@container`]]:f[`@container`]||[],a=[`@list`,`@set`,`@index`,`@language`],s=!0,c=n.includes(`@set`);if(v.processingMode(e,1.1)){if(a.push(`@graph`,`@id`,`@type`),n.includes(`@list`)){if(n.length!==1)throw new r(`Invalid JSON-LD syntax; @context @container with @list must have no other values`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else if(n.includes(`@graph`)){if(n.some(e=>e!==`@graph`&&e!==`@id`&&e!==`@index`&&e!==`@set`))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:t})}else s&=n.length<=(c?2:1);if(n.includes(`@type`)&&(g[`@type`]=g[`@type`]||`@id`,![`@id`,`@vocab`].includes(g[`@type`])))throw new r(`Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else s&=!i(f[`@container`]),s&=n.length<=1;if(s&=n.every(e=>a.includes(e)),s&=!(c&&n.includes(`@list`)),!s)throw new r(`Invalid JSON-LD syntax; @context @container value must be one of the following: `+a.join(`, `),`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t});if(g.reverse&&!n.every(e=>[`@index`,`@set`].includes(e)))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:t});g[`@container`]=n}if(`@index`in f){if(!(`@container`in f)||!g[`@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:t});if(!o(f[`@index`])||f[`@index`].indexOf(`@`)===0)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:t});g[`@index`]=f[`@index`]}if(`@context`in f&&(g[`@context`]=f[`@context`]),`@language`in f&&!(`@type`in f)){let e=f[`@language`];if(e!==null&&!o(e))throw new r(`Invalid JSON-LD syntax; @context @language value must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid language mapping`,context:t});e!==null&&(e=e.toLowerCase()),g[`@language`]=e}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:t});if(v.isKeyword(g[`@id`]))throw new r(`Invalid JSON-LD syntax; keywords may not be used as prefixes`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(typeof f[`@prefix`]==`boolean`)g._prefix=f[`@prefix`]===!0;else throw new r(`Invalid JSON-LD syntax; @context value for @prefix must be boolean`,`jsonld.SyntaxError`,{code:`invalid @prefix value`,context:t})}if(`@direction`in f){let e=f[`@direction`];if(e!==null&&e!==`ltr`&&e!==`rtl`)throw new r(`Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:t});g[`@direction`]=e}if(`@nest`in f){let e=f[`@nest`];if(!o(e)||e!==`@nest`&&e.indexOf(`@`)===0)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:t});g[`@nest`]=e}let S=g[`@id`];if(S===`@context`||S===`@preserve`)throw new r(`Invalid JSON-LD syntax; @context and @preserve cannot be aliased.`,`jsonld.SyntaxError`,{code:`invalid keyword alias`,context:t});if(m&&m.protected&&!u&&(e.protected[n]=!0,g.protected=!0,!b(m,g)))throw new r(`Invalid JSON-LD syntax; tried to redefine a protected term.`,`jsonld.SyntaxError`,{code:`protected term redefinition`,context:t,term:n})},v.expandIri=(e,t,n,r)=>y(e,t,n,void 0,void 0,r);function y(e,t,n,r,i,s){if(t===null||!o(t)||v.isKeyword(t))return t;if(t.match(p))return null;if(r&&r.hasOwnProperty(t)&&i.get(t)!==!0&&v.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:i,options:s}),n||={},n.vocab){let n=e.mappings.get(t);if(n===null)return null;if(a(n)&&`@id`in n)return n[`@id`]}let l=t.indexOf(`:`);if(l>0){let n=t.substr(0,l),a=t.substr(l+1);if(n===`_`||a.indexOf(`//`)===0)return t;r&&r.hasOwnProperty(n)&&v.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:i,options:s});let o=e.mappings.get(n);if(o&&o._prefix)return o[`@id`]+a;if(c(t))return t}if(n.vocab&&`@vocab`in e)t=e[`@vocab`]+t;else if(n.base){let n,r;`@base`in e?e[`@base`]?(r=u(s.base,e[`@base`]),n=u(r,t)):(r=e[`@base`],n=t):(r=s.base,n=u(s.base,t)),t=n}return t}v.getInitialContext=e=>{let t=JSON.stringify({processingMode:e.processingMode}),r=g.get(t);if(r)return r;let i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:a,clone:c,revertToPreviousContext:l,protected:{}};return g.size===_&&g.clear(),g.set(t,i),i;function a(){let e=this;if(e.inverse)return e.inverse;let t=e.inverse={},n=e.fastCurieMap={},r={},i=(e[`@language`]||`@none`).toLowerCase(),a=e[`@direction`],c=e.mappings,l=[...c.keys()].sort(h);for(let e of l){let o=c.get(e);if(o===null)continue;let l=o[`@container`]||`@none`;if(l=[].concat(l).sort().join(``),o[`@id`]===null)continue;let u=m(o[`@id`]);for(let c of u){let u=t[c],d=v.isKeyword(c);if(u)!d&&!o._termHasColon&&r[c].push(e);else if(t[c]=u={},!d&&!o._termHasColon){r[c]=[e];let t={iri:c,terms:r[c]};c[0]in n?n[c[0]].push(t):n[c[0]]=[t]}if(u[l]||(u[l]={"@language":{},"@type":{},"@any":{}}),u=u[l],s(e,u[`@any`],`@none`),o.reverse)s(e,u[`@type`],`@reverse`);else if(o[`@type`]===`@none`)s(e,u[`@any`],`@none`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`);else if(`@type`in o)s(e,u[`@type`],o[`@type`]);else if(`@language`in o&&`@direction`in o){let t=o[`@language`],n=o[`@direction`];t&&n?s(e,u[`@language`],`${t}_${n}`.toLowerCase()):t?s(e,u[`@language`],t.toLowerCase()):n?s(e,u[`@language`],`_${n}`):s(e,u[`@language`],`@null`)}else`@language`in o?s(e,u[`@language`],(o[`@language`]||`@null`).toLowerCase()):`@direction`in o?o[`@direction`]?s(e,u[`@language`],`_${o[`@direction`]}`):s(e,u[`@language`],`@none`):a?(s(e,u[`@language`],`_${a}`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`)):(s(e,u[`@language`],i),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`))}}for(let e in n)o(n,e,1);return t}function o(e,t,n){let r=e[t],i=e[t]={},a,s;for(let e of r)a=e.iri,s=n>=a.length?``:a[n],s in i?i[s].push(e):i[s]=[e];for(let e in i)e!==``&&o(i,e,n+1)}function s(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}function c(){let e={};return e.mappings=n.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=n.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,`@base`in this&&(e[`@base`]=this[`@base`]),`@language`in this&&(e[`@language`]=this[`@language`]),`@vocab`in this&&(e[`@vocab`]=this[`@vocab`]),e}function l(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(e,t,n)=>{if(t===null)return n===`@context`?void 0:null;if(e.mappings.has(t)){let r=e.mappings.get(t);if(s(n))return r;if(r.hasOwnProperty(n))return r[n]}if(n===`@language`&&n in e||n===`@direction`&&n in e)return e[n];if(n!==`@context`)return null},v.processingMode=(e,t)=>t.toString()>=`1.1`?!e.processingMode||e.processingMode>=`json-ld-`+t.toString():e.processingMode===`json-ld-1.0`,v.isKeyword=e=>{if(!o(e)||e[0]!==`@`)return!1;switch(e){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};function b(e,t){if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return e===t;let n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!b(e[n],t[n]))return!1;return!0}let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let n in e){let r=e[n],i=t[n];if(n===`@container`&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!b(r,i))return!1}return!0}})),tr=o(((e,t)=>{var n=Bn(),{isArray:r,isObject:i,isEmptyObject:a,isString:o,isUndefined:s}=Rn(),{isList:c,isValue:l,isGraph:u,isSubject:d}=zn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=er(),{isAbsolute:_}=Wn(),{REGEX_BCP47:v,REGEX_KEYWORD:y,addValue:b,asArray:x,getValues:S,validateTypeValue:C}=Vn(),{handleEvent:w}=$n(),T={};t.exports=T,T.expand=async({activeCtx:e,activeProperty:t=null,element:c,options:l={},insideList:u=!1,insideIndex:d=!1,typeScopedContext:m=null})=>{if(c==null)return null;if(t===`@default`&&(l=Object.assign({},l,{isFrame:!1})),!r(c)&&!i(c))return!u&&(t===null||f(e,t,{vocab:!0},l)===`@graph`)?(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`free-floating scalar`,level:`warning`,message:`Dropping free-floating scalar not in a list.`,details:{value:c}},options:l}),null):O({activeCtx:e,activeProperty:t,value:c,options:l});if(r(c)){let n=[],i=p(e,t,`@container`)||[];u||=i.includes(`@list`);for(let i=0;i<c.length;++i){let a=await T.expand({activeCtx:e,activeProperty:t,element:c[i],options:l,insideIndex:d,typeScopedContext:m});u&&r(a)&&(a={"@list":a}),a!==null&&(r(a)?n=n.concat(a):n.push(a))}return n}let v=f(e,t,{vocab:!0},l),y=p(e,t,`@context`);m||=e.previousContext?e:null;let b=Object.keys(c).sort(),C=!d;if(C&&m&&b.length<=2&&!b.includes(`@context`))for(let t of b){let n=f(m,t,{vocab:!0},l);if(n===`@value`){C=!1,e=m;break}if(n===`@id`&&b.length===1){C=!1;break}}C&&(e=e.revertToPreviousContext()),s(y)||(e=await h({activeCtx:e,localCtx:y,propagate:!0,overrideProtected:!0,options:l})),`@context`in c&&(e=await h({activeCtx:e,localCtx:c[`@context`],options:l})),m=e;let k=null;for(let t of b)if(f(e,t,{vocab:!0},l)===`@type`){k||=t;let n=c[t],r=Array.isArray(n)?n.length>1?n.slice().sort():n:[n];for(let t of r){let n=p(m,t,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,options:l,propagate:!1}))}}let A={};await D({activeCtx:e,activeProperty:t,expandedActiveProperty:v,element:c,expandedParent:A,options:l,insideList:u,typeKey:k,typeScopedContext:m}),b=Object.keys(A);let j=b.length;if(`@value`in A){if(`@type`in A&&(`@language`in A||`@direction`in A))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:A});let t=j-1;if(`@type`in A&&--t,`@index`in A&&--t,`@language`in A&&--t,`@direction`in A&&--t,t!==0)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:A});let r=A[`@value`]===null?[]:x(A[`@value`]),i=S(A,`@type`);if(!(g(e,1.1)&&i.includes(`@json`)&&i.length===1)){if(r.length===0)l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`null @value value`,level:`warning`,message:`Dropping null @value value.`,details:{value:A}},options:l}),A=null;else if(!r.every(e=>o(e)||a(e))&&`@language`in A)throw new n(`Invalid JSON-LD syntax; only strings may be language-tagged.`,`jsonld.SyntaxError`,{code:`invalid language-tagged value`,element:A});else if(!i.every(e=>_(e)&&!(o(e)&&e.indexOf(`_:`)===0)||a(e)))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:A})}}else if(`@type`in A&&!r(A[`@type`]))A[`@type`]=[A[`@type`]];else if(`@set`in A||`@list`in A){if(j>1&&!(j===2&&`@index`in A))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:A});`@set`in A&&(A=A[`@set`],b=Object.keys(A),j=b.length)}else j===1&&`@language`in A&&(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`object with only @language`,level:`warning`,message:`Dropping object with only @language.`,details:{value:A}},options:l}),A=null);return i(A)&&!l.keepFreeFloatingNodes&&!u&&(t===null||v===`@graph`||(p(e,t,`@container`)||[]).includes(`@graph`))&&(A=E({value:A,count:j,options:l})),A};function E({value:e,count:t,options:n}){if(t===0||`@value`in e||`@list`in e||t===1&&`@id`in e){if(n.eventHandler){let r,i;t===0?(r=`empty object`,i=`Dropping empty object.`):`@value`in e?(r=`object with only @value`,i=`Dropping object with only @value.`):`@list`in e?(r=`object with only @list`,i=`Dropping object with only @list.`):t===1&&`@id`in e&&(r=`object with only @id`,i=`Dropping object with only @id.`),w({event:{type:[`JsonLdEvent`],code:r,level:`warning`,message:i,details:{value:e}},options:n})}return null}return e}async function D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:y,expandedParent:S,options:O={},insideList:j,typeKey:M,typeScopedContext:N}){let P=Object.keys(y).sort(),F=[],I,L=y[M]&&f(e,r(y[M])?y[M][0]:y[M],{vocab:!0},{...O,typeExpansion:!0})===`@json`;for(let D of P){let j=y[D],M;if(D===`@context`)continue;let P=f(e,D,{vocab:!0},O);if(P===null||!(_(P)||m(P))){O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid property`,level:`warning`,message:`Dropping property that did not expand into an absolute IRI or keyword.`,details:{property:D,expandedProperty:P}},options:O});continue}if(m(P)){if(u===`@reverse`)throw new n(`Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.`,`jsonld.SyntaxError`,{code:`invalid reverse property map`,value:j});if(P in S&&P!==`@included`&&P!==`@type`)throw new n(`Invalid JSON-LD syntax; colliding keywords detected.`,`jsonld.SyntaxError`,{code:`colliding keywords`,keyword:P})}if(P===`@id`){if(!o(j)){if(!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@id" value must a string.`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j});if(i(j)){if(!a(j))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:j})}else if(r(j)){if(!j.every(e=>o(e)))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:j})}else 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:j})}b(S,`@id`,x(j).map(t=>{if(o(t)){let n=f(e,t,{base:!0},O);return O.eventHandler&&(n===null?w(t===null?{event:{type:[`JsonLdEvent`],code:`null @id value`,level:`warning`,message:`Null @id found.`,details:{id:t}},options:O}:{event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:O}):_(n)||w({event:{type:[`JsonLdEvent`],code:`relative @id reference`,level:`warning`,message:`Relative @id reference found.`,details:{id:t,expandedId:n}},options:O})),n}return t}),{propertyIsArray:O.isFrame});continue}if(P===`@type`){i(j)&&(j=Object.fromEntries(Object.entries(j).map(([e,t])=>[f(N,e,{vocab:!0}),x(t).map(e=>f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0}))]))),C(j,O.isFrame),b(S,`@type`,x(j).map(e=>{if(o(e)){let t=f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0});return t!==`@json`&&!_(t)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`relative @type reference`,level:`warning`,message:`Relative @type reference found.`,details:{type:e}},options:O}),t}return e}),{propertyIsArray:!!O.isFrame});continue}if(P===`@included`&&g(e,1.1)){let r=x(await T.expand({activeCtx:e,activeProperty:t,element:j,options:O}));if(!r.every(e=>d(e)))throw new n(`Invalid JSON-LD syntax; values of @included must expand to node objects.`,`jsonld.SyntaxError`,{code:`invalid @included value`,value:j});b(S,`@included`,r,{propertyIsArray:!0});continue}if(P===`@graph`&&!(i(j)||r(j)))throw new n(`Invalid JSON-LD syntax; "@graph" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid @graph value`,value:j});if(P===`@value`){I=j,L&&g(e,1.1)?S[`@value`]=j:b(S,`@value`,j,{propertyIsArray:O.isFrame});continue}if(P===`@language`){if(j===null)continue;if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@language" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid language-tagged string`,value:j});j=x(j).map(e=>o(e)?e.toLowerCase():e);for(let e of j)o(e)&&!e.match(v)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:O});b(S,`@language`,j,{propertyIsArray:O.isFrame});continue}if(P===`@direction`){if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@direction" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});j=x(j);for(let e of j)if(o(e)&&e!==`ltr`&&e!==`rtl`)throw new n(`Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});b(S,`@direction`,j,{propertyIsArray:O.isFrame});continue}if(P===`@index`){if(!o(j))throw new n(`Invalid JSON-LD syntax; "@index" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid @index value`,value:j});b(S,`@index`,j);continue}if(P===`@reverse`){if(!i(j))throw new n(`Invalid JSON-LD syntax; "@reverse" value must be an object.`,`jsonld.SyntaxError`,{code:`invalid @reverse value`,value:j});if(M=await T.expand({activeCtx:e,activeProperty:`@reverse`,element:j,options:O}),`@reverse`in M)for(let e in M[`@reverse`])b(S,e,M[`@reverse`][e],{propertyIsArray:!0});let t=S[`@reverse`]||null;for(let e in M){if(e===`@reverse`)continue;t===null&&(t=S[`@reverse`]={}),b(t,e,[],{propertyIsArray:!0});let r=M[e];for(let i=0;i<r.length;++i){let a=r[i];if(l(a)||c(a))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:M});b(t,e,a,{propertyIsArray:!0})}}continue}if(P===`@nest`){F.push(D);continue}let R=e,z=p(e,D,`@context`);s(z)||(R=await h({activeCtx:e,localCtx:z,propagate:!0,overrideProtected:!0,options:O}));let B=p(e,D,`@container`)||[];if(B.includes(`@language`)&&i(j)){let e=p(R,D,`@direction`);M=k(R,j,e,O)}else if(B.includes(`@index`)&&i(j)){let t=B.includes(`@graph`),n=p(R,D,`@index`)||`@index`,r=n!==`@index`&&f(e,n,{vocab:!0},O);M=await A({activeCtx:R,options:O,activeProperty:D,value:j,asGraph:t,indexKey:n,propertyIndex:r})}else if(B.includes(`@id`)&&i(j)){let e=B.includes(`@graph`);M=await A({activeCtx:R,options:O,activeProperty:D,value:j,asGraph:e,indexKey:`@id`})}else if(B.includes(`@type`)&&i(j))M=await A({activeCtx:R.revertToPreviousContext(),options:O,activeProperty:D,value:j,asGraph:!1,indexKey:`@type`});else{let n=P===`@list`;if(n||P===`@set`){let e=t;n&&u===`@graph`&&(e=null),M=await T.expand({activeCtx:R,activeProperty:e,element:j,options:O,insideList:n})}else M=p(e,D,`@type`)===`@json`?{"@type":`@json`,"@value":j}:await T.expand({activeCtx:R,activeProperty:D,element:j,options:O,insideList:!1})}if(!(M===null&&P!==`@value`)){if(P!==`@list`&&!c(M)&&B.includes(`@list`)&&(M={"@list":x(M)}),B.includes(`@graph`)&&!B.some(e=>e===`@id`||e===`@index`)){if(M=x(M),O.isFrame||(M=M.filter(e=>{let t=Object.keys(e).length;return E({value:e,count:t,options:O})!==null})),M.length===0)continue;M=M.map(e=>({"@graph":x(e)}))}if(R.mappings.has(D)&&R.mappings.get(D).reverse){let e=S[`@reverse`]=S[`@reverse`]||{};M=x(M);for(let t=0;t<M.length;++t){let r=M[t];if(l(r)||c(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:M});b(e,P,r,{propertyIsArray:!0})}continue}b(S,P,M,{propertyIsArray:!0})}}if(`@value`in S&&!(S[`@type`]===`@json`&&g(e,1.1))&&(i(I)||r(I))&&!O.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:I});for(let a of F){let o=r(y[a])?y[a]:[y[a]];for(let r of o){if(!i(r)||Object.keys(r).some(t=>f(e,t,{vocab:!0},O)===`@value`))throw new n(`Invalid JSON-LD syntax; nested value must be a node object.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,value:r});await D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:r,expandedParent:S,options:O,insideList:j,typeScopedContext:N,typeKey:M})}}}function O({activeCtx:e,activeProperty:t,value:n,options:r}){if(n==null)return null;let i=f(e,t,{vocab:!0},r);if(i===`@id`)return f(e,n,{base:!0},r);if(i===`@type`)return f(e,n,{vocab:!0,base:!0},{...r,typeExpansion:!0});let a=p(e,t,`@type`);if((a===`@id`||i===`@graph`)&&o(n)){let i=f(e,n,{base:!0},r);return i===null&&n.match(y)&&r.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:r}),{"@id":i}}if(a===`@vocab`&&o(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(m(i))return n;let s={};if(a&&![`@id`,`@vocab`,`@none`].includes(a))s[`@type`]=a;else if(o(n)){let n=p(e,t,`@language`);n!==null&&(s[`@language`]=n);let r=p(e,t,`@direction`);r!==null&&(s[`@direction`]=r)}return[`boolean`,`number`,`string`].includes(typeof n)||(n=n.toString()),s[`@value`]=n,s}function k(e,t,i,a){let s=[],c=Object.keys(t).sort();for(let l of c){let c=f(e,l,{vocab:!0},a),u=t[l];r(u)||(u=[u]);for(let e of u){if(e===null)continue;if(!o(e))throw new n(`Invalid JSON-LD syntax; language map values must be strings.`,`jsonld.SyntaxError`,{code:`invalid language map value`,languageMap:t});let r={"@value":e};c!==`@none`&&(l.match(v)||a.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:l}},options:a}),r[`@language`]=l.toLowerCase()),i&&(r[`@direction`]=i),s.push(r)}}return s}async function A({activeCtx:e,options:t,activeProperty:i,value:a,asGraph:o,indexKey:c,propertyIndex:d}){let m=[],g=Object.keys(a).sort(),_=c===`@type`;for(let v of g){if(_){let n=p(e,v,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g=a[v];r(g)||(g=[g]),g=await T.expand({activeCtx:e,activeProperty:i,element:g,options:t,insideList:!1,insideIndex:!0});let y;y=d?v===`@none`?`@none`:O({activeCtx:e,activeProperty:c,value:v,options:t}):f(e,v,{vocab:!0},t),c===`@id`?v=f(e,v,{base:!0},t):_&&(v=y);for(let e of g){if(o&&!u(e)&&(e={"@graph":[e]}),c===`@type`)y===`@none`||(e[`@type`]?e[`@type`]=[v].concat(e[`@type`]):e[`@type`]=[v]);else if(l(e)&&![`@language`,`@type`,`@index`].includes(c))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${c}".`,`jsonld.SyntaxError`,{code:`invalid value object`,value:e});else d?y!==`@none`&&b(e,d,y,{propertyIsArray:!0,prependValue:!0}):y!==`@none`&&!(c in e)&&(e[c]=v);m.push(e)}}return m}})),nr=o(((e,t)=>{var{isKeyword:n}=er(),r=zn(),i=Rn(),a=Vn(),o=Bn(),s={};t.exports=s,s.createMergedNodeMap=(e,t)=>{t||={};let n=t.issuer||new a.IdentifierIssuer(`_:b`),r={"@default":{}};return s.createNodeMap(e,r,`@default`,n),s.mergeNodeMaps(r)},s.createNodeMap=(e,t,c,l,u,d)=>{if(i.isArray(e)){for(let n of e)s.createNodeMap(n,t,c,l,void 0,d);return}if(!i.isObject(e)){d&&d.push(e);return}if(r.isValue(e)){if(`@type`in e){let t=e[`@type`];t.indexOf(`_:`)===0&&(e[`@type`]=t=l.getId(t))}d&&d.push(e);return}else if(d&&r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),d.push({"@list":n});return}if(`@type`in e){let t=e[`@type`];for(let e of t)e.indexOf(`_:`)===0&&l.getId(e)}i.isUndefined(u)&&(u=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`]),d&&d.push({"@id":u});let f=t[c],p=f[u]=f[u]||{};p[`@id`]=u;let m=Object.keys(e).sort();for(let i of m){if(i===`@id`)continue;if(i===`@reverse`){let n={"@id":u},i=e[`@reverse`];for(let e in i){let o=i[e];for(let i of o){let o=i[`@id`];r.isBlankNode(i)&&(o=l.getId(o)),s.createNodeMap(i,t,c,l,o),a.addValue(f[o],e,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(i===`@graph`){u in t||(t[u]={}),s.createNodeMap(e[i],t,u,l);continue}if(i===`@included`){s.createNodeMap(e[i],t,c,l);continue}if(i!==`@type`&&n(i)){if(i===`@index`&&i in p&&(e[i]!==p[i]||e[i][`@id`]!==p[i][`@id`]))throw new o(`Invalid JSON-LD syntax; conflicting @index property detected.`,`jsonld.SyntaxError`,{code:`conflicting indexes`,subject:p});p[i]=e[i];continue}let d=e[i];if(i.indexOf(`_:`)===0&&(i=l.getId(i)),d.length===0){a.addValue(p,i,[],{propertyIsArray:!0});continue}for(let e of d)if(i===`@type`&&(e=e.indexOf(`_:`)===0?l.getId(e):e),r.isSubject(e)||r.isSubjectReference(e)){if(`@id`in e&&!e[`@id`])continue;let n=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`];a.addValue(p,i,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(e,t,c,l,n)}else if(r.isValue(e))a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1});else if(r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),e={"@list":n},a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(e,t,c,l,u),a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=e=>{let t={};for(let r of Object.keys(e).sort())for(let i of Object.keys(e[r]).sort()){let o=e[r][i];i in t||(t[i]={"@id":i});let s=t[i];for(let e of Object.keys(o).sort())if(n(e)&&e!==`@type`)s[e]=a.clone(o[e]);else for(let t of o[e])a.addValue(s,e,a.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},s.mergeNodeMaps=e=>{let t=e[`@default`],n=Object.keys(e).sort();for(let i of n){if(i===`@default`)continue;let n=e[i],a=t[i];a?`@graph`in a||(a[`@graph`]=[]):t[i]=a={"@id":i,"@graph":[]};let o=a[`@graph`];for(let e of Object.keys(n).sort()){let t=n[e];r.isSubjectReference(t)||o.push(t)}}return t}})),rr=o(((e,t)=>{var{isSubjectReference:n}=zn(),{createMergedNodeMap:r}=nr(),i={};t.exports=i,i.flatten=e=>{let t=r(e),i=[],a=Object.keys(t).sort();for(let e=0;e<a.length;++e){let r=t[a[e]];n(r)||i.push(r)}return i}})),ir=o(((e,t)=>{var n=Bn(),r=zn(),i=Rn(),{REGEX_BCP47:a,addValue:o}=Vn(),{handleEvent:s}=$n(),{RDF_LIST:c,RDF_FIRST:l,RDF_REST:u,RDF_NIL:d,RDF_TYPE:f,RDF_JSON_LITERAL:p,XSD_BOOLEAN:m,XSD_DOUBLE:h,XSD_INTEGER:g,XSD_STRING:_}=Hn(),v={};t.exports=v,v.fromRDF=async(e,t)=>{let{useRdfType:a=!1,useNativeTypes:s=!1,rdfDirection:p=null}=t,m={},h={"@default":m},g={};if(p){if(p===`compound-literal`)throw new n(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p});if(p!==`i18n-datatype`)throw new n(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p})}for(let n of e){let e=n.graph.termType===`DefaultGraph`?`@default`:n.graph.value;e in h||(h[e]={}),e!==`@default`&&!(e in m)&&(m[e]={"@id":e});let r=h[e],i=b(n.subject),c=n.predicate.value,l=n.object;i in r||(r[i]={"@id":i});let u=r[i],_=b(l),v=!!_;if(v&&!(_ in r)&&(r[_]={"@id":_}),c===f&&!a&&v){o(u,`@type`,_,{propertyIsArray:!0});continue}let x=y(l,s,p,t);if(o(u,c,x,{propertyIsArray:!0}),v)if(_===d){let e=r[_];`usages`in e||(e.usages=[]),e.usages.push({node:u,property:c,value:x})}else _ in g?g[_]=!1:g[_]={node:u,property:c,value:x}}for(let e in h){let t=h[e];if(!(d in t))continue;let n=t[d];if(n.usages){for(let e of n.usages){let n=e.node,a=e.property,o=e.value,s=[],d=[],f=Object.keys(n).length;for(;a===u&&i.isObject(g[n[`@id`]])&&i.isArray(n[l])&&n[l].length===1&&i.isArray(n[u])&&n[u].length===1&&(f===3||f===4&&i.isArray(n[`@type`])&&n[`@type`].length===1&&n[`@type`][0]===c)&&(s.push(n[l][0]),d.push(n[`@id`]),e=g[n[`@id`]],n=e.node,a=e.property,o=e.value,f=Object.keys(n).length,r.isBlankNode(n)););delete o[`@id`],o[`@list`]=s.reverse();for(let e of d)delete t[e]}delete n.usages}}let _=[],v=Object.keys(m).sort();for(let e of v){let t=m[e];if(e in h){let n=t[`@graph`]=[],i=h[e],a=Object.keys(i).sort();for(let e of a){let t=i[e];r.isSubjectReference(t)||n.push(t)}}r.isSubjectReference(t)||_.push(t)}return _};function y(e,t,r,o){let c=b(e);if(c)return{"@id":c};let l={"@value":e.value};if(e.language)e.language.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e.language}},options:o}),l[`@language`]=e.language;else{let c=e.datatype.value;if(c||=_,c===p){c=`@json`;try{l[`@value`]=JSON.parse(l[`@value`])}catch(e){throw new n(`JSON literal could not be parsed.`,`jsonld.InvalidJsonLiteral`,{code:`invalid JSON literal`,value:l[`@value`],cause:e})}}if(t)if(c===m)l[`@value`]===`true`||l[`@value`]===`1`?l[`@value`]=!0:l[`@value`]===`false`||l[`@value`]===`0`?l[`@value`]=!1:l[`@type`]=c;else if(c===g)if(i.isNumeric(l[`@value`])){let e=parseInt(l[`@value`],10);e.toFixed(0)===l[`@value`]&&(l[`@value`]=e)}else l[`@type`]=c;else c===h&&i.isNumeric(l[`@value`])?l[`@value`]=parseFloat(l[`@value`]):l[`@type`]=c;else if(r===`i18n-datatype`&&c.startsWith(`https://www.w3.org/ns/i18n#`)){let[,e,t]=c.split(/[#_]/);e.length>0&&(l[`@language`]=e,e.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:o})),l[`@direction`]=t}else c!==_&&(l[`@type`]=c)}return l}function b(e){return e.termType===`NamedNode`?e.value:e.termType===`BlankNode`?`_:`+e.value:null}})),ar=o(((e,t)=>{t.exports=function e(t){if(typeof t==`number`&&isNaN(t))throw Error(`NaN is not allowed`);if(typeof t==`number`&&!isFinite(t))throw Error(`Infinity is not allowed`);return typeof t!=`object`||!t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce((t,n,r)=>`${t}${r===0?``:`,`}${e(n===void 0||typeof n==`symbol`?null:n)}`,``)}]`:`{${Object.keys(t).sort().reduce((n,r)=>t[r]===void 0||typeof t[r]==`symbol`?n:`${n}${n.length===0?``:`,`}${e(r)}:${e(t[r])}`,``)}}`}})),or=o(((e,t)=>{var{createNodeMap:n}=nr(),{isKeyword:r}=er(),i=zn(),a=ar(),o=Bn(),s=Rn(),c=Vn(),{handleEvent:l}=$n(),{RDF_FIRST:u,RDF_REST:d,RDF_NIL:f,RDF_TYPE:p,RDF_JSON_LITERAL:m,RDF_LANGSTRING:h,XSD_BOOLEAN:g,XSD_DOUBLE:_,XSD_INTEGER:v,XSD_STRING:y}=Hn(),{isAbsolute:b}=Wn(),x={};t.exports=x,x.toRDF=(e,t)=>{let r=new c.IdentifierIssuer(`_:b`),i={"@default":{}};n(e,i,`@default`,r);let a=[],o=Object.keys(i).sort();for(let e of o){let n;if(e===`@default`)n={termType:`DefaultGraph`,value:``};else if(b(e))n=T(e);else{t.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative graph reference`,level:`warning`,message:`Relative graph reference found.`,details:{graph:e}},options:t});continue}S(a,i[e],n,r,t)}return a};function S(e,t,n,i,a){let o=Object.keys(t).sort();for(let s of o){let o=t[s],c=Object.keys(o).sort();for(let t of c){let c=o[t];if(t===`@type`)t=p;else if(r(t))continue;for(let r of c){let o=T(s);if(!b(s)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative subject reference`,level:`warning`,message:`Relative subject reference found.`,details:{subject:s}},options:a});continue}let c=T(t);if(!b(t)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative predicate reference`,level:`warning`,message:`Relative predicate reference found.`,details:{predicate:t}},options:a});continue}if(c.termType===`BlankNode`&&!a.produceGeneralizedRdf){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`blank node predicate`,level:`warning`,message:`Dropping blank node predicate.`,details:{property:i.getOldIds().find(e=>i.getId(e)===t)}},options:a});continue}let u=w(r,i,e,n,a.rdfDirection,a);u&&e.push({subject:o,predicate:c,object:u,graph:n})}}}}function C(e,t,n,r,i,a){let o={termType:`NamedNode`,value:u},s={termType:`NamedNode`,value:d},c={termType:`NamedNode`,value:f},l=e.pop(),p=l?{termType:`BlankNode`,value:t.getId().slice(2)}:c,m=p;for(let c of e){let e=w(c,t,n,r,i,a),l={termType:`BlankNode`,value:t.getId().slice(2)};n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:l,graph:r}),m=l}if(l){let e=w(l,t,n,r,i,a);n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:c,graph:r})}return p}function w(e,t,n,r,c,u){let d;if(i.isValue(e)){d={termType:`Literal`,value:void 0,datatype:{termType:`NamedNode`}};let t=e[`@value`],n=e[`@type`]||null;if(n===`@json`)d.value=a(t),d.datatype.value=m;else if(s.isBoolean(t))d.value=t.toString(),d.datatype.value=n||g;else if(s.isDouble(t)||n===_)s.isDouble(t)||(t=parseFloat(t)),d.value=t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),d.datatype.value=n||_;else if(s.isNumber(t))d.value=t.toFixed(0),d.datatype.value=n||v;else if(`@direction`in e&&c===`i18n-datatype`){let n=`https://www.w3.org/ns/i18n#${(e[`@language`]||``).toLowerCase()}_${e[`@direction`]}`;d.datatype.value=n,d.value=t}else if(`@direction`in e&&c===`compound-literal`)throw new o(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else if(`@direction`in e&&c)throw new o(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else`@language`in e?(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||h,d.language=e[`@language`]):(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||y)}else if(i.isList(e)){let i=C(e[`@list`],t,n,r,c,u);d={termType:i.termType,value:i.value}}else d=T(s.isObject(e)?e[`@id`]:e);return d.termType===`NamedNode`&&!b(d.value)?(u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative object reference`,level:`warning`,message:`Relative object reference found.`,details:{object:d.value}},options:u}),null):d}function T(e){return e.startsWith(`_:`)?{termType:`BlankNode`,value:e.slice(2)}:{termType:`NamedNode`,value:e}}})),sr=o(((e,t)=>{var{isKeyword:n}=er(),r=zn(),i=Rn(),a=Vn(),o=Wn(),s=Bn(),{createNodeMap:c,mergeNodeMapGraphs:l}=nr(),u={};t.exports=u,u.frameMergedOrDefault=(e,t,n)=>{let r={options:n,embedded:!1,graph:`@default`,graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new a.IdentifierIssuer(`_:b`);c(e,r.graphMap,`@default`,i),n.merged&&(r.graphMap[`@merged`]=l(r.graphMap),r.graph=`@merged`),r.subjects=r.graphMap[r.graph];let o=[];return u.frame(r,Object.keys(r.subjects).sort(),t,o),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter(e=>r.bnodeMap[e].length===1)),n.link={},v(o,n)},u.frame=(e,t,o,c,l=null)=>{m(o),o=o[0];let g=e.options,v={embed:p(o,g,`embed`),explicit:p(o,g,`explicit`),requireAll:p(o,g,`requireAll`)};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});let b=e.link[e.graph],S=h(e,t,o,v),C=Object.keys(S).sort();for(let m of C){let h=S[m];if(l===null?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},v.embed===`@link`&&m in b){y(c,l,b[m]);continue}let C={"@id":m};if(m.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,m,C,{propertyIsArray:!0}),b[m]=C,(v.embed===`@first`||v.embed===`@last`)&&e.is11)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:o});if(!(!e.embedded&&e.uniqueEmbeds[e.graph].hasOwnProperty(m))){if(e.embedded&&(v.embed===`@never`||f(h,e.graph,e.subjectStack))){y(c,l,C);continue}if(e.embedded&&(v.embed==`@first`||v.embed==`@once`)&&e.uniqueEmbeds[e.graph].hasOwnProperty(m)){y(c,l,C);continue}if(v.embed===`@last`&&m in e.uniqueEmbeds[e.graph]&&_(e,m),e.uniqueEmbeds[e.graph][m]={parent:c,property:l},e.subjectStack.push({subject:h,graph:e.graph}),m in e.graphMap){let t=!1,n=null;`@graph`in o?(n=o[`@graph`][0],t=!(m===`@merged`||m===`@default`),i.isObject(n)||(n={})):(t=e.graph!==`@merged`,n={}),t&&u.frame({...e,graph:m,embedded:!1},Object.keys(e.graphMap[m]).sort(),[n],C,`@graph`)}`@included`in o&&u.frame({...e,embedded:!1},t,o[`@included`],C,`@included`);for(let t of Object.keys(h).sort()){if(n(t)){if(C[t]=a.clone(h[t]),t===`@type`)for(let t of h[`@type`])t.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,t,C,{propertyIsArray:!0});continue}if(!(v.explicit&&!(t in o)))for(let n of h[t]){let i=t in o?o[t]:d(v);if(r.isList(n)){let i=o[t]&&o[t][0]&&o[t][0][`@list`]?o[t][0][`@list`]:d(v),s={"@list":[]};y(C,t,s);let c=n[`@list`];for(let t of c)r.isSubjectReference(t)?u.frame({...e,embedded:!0},[t[`@id`]],i,s,`@list`):y(s,`@list`,a.clone(t))}else r.isSubjectReference(n)?u.frame({...e,embedded:!0},[n[`@id`]],i,C,t):x(i[0],n)&&y(C,t,a.clone(n))}}for(let e of Object.keys(o).sort()){if(e===`@type`){if(!i.isObject(o[e][0])||!(`@default`in o[e][0]))continue}else if(n(e))continue;let t=o[e][0]||{};if(!p(t,g,`omitDefault`)&&!(e in C)){let n=`@null`;`@default`in t&&(n=a.clone(t[`@default`])),i.isArray(n)||(n=[n]),C[e]=[{"@preserve":n}]}}for(let t of Object.keys(o[`@reverse`]||{}).sort()){let n=o[`@reverse`][t];for(let r of Object.keys(e.subjects))a.getValues(e.subjects[r],t).some(e=>e[`@id`]===m)&&(C[`@reverse`]=C[`@reverse`]||{},a.addValue(C[`@reverse`],t,[],{propertyIsArray:!0}),u.frame({...e,embedded:!0},[r],n,C[`@reverse`][t],l))}y(c,l,C),e.subjectStack.pop()}}},u.cleanupNull=(e,t)=>{if(i.isArray(e))return e.map(e=>u.cleanupNull(e,t)).filter(e=>e);if(e===`@null`)return null;if(i.isObject(e)){if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e)e[n]=u.cleanupNull(e[n],t)}return e};function d(e){let t={};for(let n in e)e[n]!==void 0&&(t[`@`+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){let i=n[r];if(i.graph===t&&i.subject[`@id`]===e[`@id`])return!0}return!1}function p(e,t,n){let r=`@`+n,i=r in e?e[r][0]:t[n];if(n===`embed`){if(i===!0)i=`@once`;else if(i===!1)i=`@never`;else if(i!==`@always`&&i!==`@never`&&i!==`@link`&&i!==`@first`&&i!==`@last`&&i!==`@once`)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:e})}return i}function m(e){if(!i.isArray(e)||e.length!==1||!i.isObject(e[0]))throw new s(`Invalid JSON-LD syntax; a JSON-LD frame must be a single object.`,`jsonld.SyntaxError`,{frame:e});if(`@id`in e[0]){for(let t of a.asArray(e[0][`@id`]))if(!(i.isObject(t)||o.isAbsolute(t))||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @id in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}if(`@type`in e[0]){for(let t of a.asArray(e[0][`@type`]))if(!(i.isObject(t)||o.isAbsolute(t)||t===`@json`)||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @type in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}}function h(e,t,n,r){let i={};for(let a of t){let t=e.graphMap[e.graph][a];g(e,t,n,r)&&(i[a]=t)}return i}function g(e,t,o,s){let c=!0,l=!1;for(let u in o){let d=!1,f=a.getValues(t,u),p=a.getValues(o,u).length===0;if(u===`@id`){if(i.isEmptyObject(o[`@id`][0]||{})?d=!0:o[`@id`].length>=0&&(d=o[`@id`].includes(f[0])),!s.requireAll)return d}else if(u===`@type`){if(c=!1,p){if(f.length>0)return!1;d=!0}else if(o[`@type`].length===1&&i.isEmptyObject(o[`@type`][0]))d=f.length>0;else for(let e of o[`@type`])i.isObject(e)&&`@default`in e?d=!0:d||=f.some(t=>t===e);if(!s.requireAll)return d}else if(n(u))continue;else{let t=a.getValues(o,u)[0],n=!1;if(t&&(m([t]),n=`@default`in t),c=!1,f.length===0&&n)continue;if(f.length>0&&p)return!1;if(t===void 0){if(f.length>0)return!1;d=!0}else if(r.isList(t)){let n=t[`@list`][0];if(r.isList(f[0])){let t=f[0][`@list`];r.isValue(n)?d=t.some(e=>x(n,e)):(r.isSubject(n)||r.isSubjectReference(n))&&(d=t.some(t=>b(e,n,t,s)))}}else d=r.isValue(t)?f.some(e=>x(t,e)):r.isSubjectReference(t)?f.some(n=>b(e,t,n,s)):i.isObject(t)?f.length>0:!1}if(!d&&s.requireAll)return!1;l||=d}return c||l}function _(e,t){let n=e.uniqueEmbeds[e.graph],r=n[t],o=r.parent,s=r.property,c={"@id":t};if(i.isArray(o)){for(let e=0;e<o.length;++e)if(a.compareValues(o[e],c)){o[e]=c;break}}else{let e=i.isArray(o[s]);a.removeValue(o,s,c,{propertyIsArray:e}),a.addValue(o,s,c,{propertyIsArray:e})}let l=e=>{let t=Object.keys(n);for(let r of t)r in n&&i.isObject(n[r].parent)&&n[r].parent[`@id`]===e&&(delete n[r],l(r))};l(t)}function v(e,t){if(i.isArray(e))return e.map(e=>v(e,t));if(i.isObject(e)){if(`@preserve`in e)return e[`@preserve`][0];if(r.isValue(e))return e;if(r.isList(e))return e[`@list`]=v(e[`@list`],t),e;if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e){if(n===`@id`&&t.bnodesToClear.includes(e[n])){delete e[`@id`];continue}e[n]=v(e[n],t)}}return e}function y(e,t,n){i.isObject(e)?a.addValue(e,t,n,{propertyIsArray:!0}):e.push(n)}function b(e,t,n,r){if(!(`@id`in n))return!1;let i=e.subjects[n[`@id`]];return i&&g(e,i,t,r)}function x(e,t){let n=t[`@value`],r=t[`@type`],a=t[`@language`],o=e[`@value`]?i.isArray(e[`@value`])?e[`@value`]:[e[`@value`]]:[],s=e[`@type`]?i.isArray(e[`@type`])?e[`@type`]:[e[`@type`]]:[],c=e[`@language`]?i.isArray(e[`@language`])?e[`@language`]:[e[`@language`]]:[];return o.length===0&&s.length===0&&c.length===0||!(!(o.includes(n)||i.isEmptyObject(o[0]))||!(!r&&s.length===0||s.includes(r)||r&&i.isEmptyObject(s[0]))||!(!a&&c.length===0||c.includes(a)||a&&i.isEmptyObject(c[0])))}})),cr=o(((e,t)=>{var n=Bn(),{isArray:r,isObject:i,isString:a,isUndefined:o}=Rn(),{isList:s,isValue:c,isGraph:l,isSimpleGraph:u,isSubjectReference:d}=zn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=er(),{removeBase:_,prependBase:v}=Wn(),{REGEX_KEYWORD:y,addValue:b,asArray:x,compareShortestLeast:S}=Vn(),C={};t.exports=C,C.compact=async({activeCtx:e,activeProperty:t=null,element:f,options:_={}})=>{if(r(f)){let n=[];for(let r=0;r<f.length;++r){let i=await C.compact({activeCtx:e,activeProperty:t,element:f[r],options:_});i!==null&&n.push(i)}return _.compactArrays&&n.length===1&&(p(e,t,`@container`)||[]).length===0&&(n=n[0]),n}let v=p(e,t,`@context`);if(o(v)||(e=await h({activeCtx:e,localCtx:v,propagate:!0,overrideProtected:!0,options:_})),i(f)){if(_.link&&`@id`in f&&_.link.hasOwnProperty(f[`@id`])){let e=_.link[f[`@id`]];for(let t=0;t<e.length;++t)if(e[t].expanded===f)return e[t].compacted}if(c(f)||d(f)){let n=C.compactValue({activeCtx:e,activeProperty:t,value:f,options:_});return _.link&&d(f)&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:n})),n}if(s(f)&&(p(e,t,`@container`)||[]).includes(`@list`))return C.compact({activeCtx:e,activeProperty:t,element:f[`@list`],options:_});let v=t===`@reverse`,y={},S=e;!c(f)&&!d(f)&&(e=e.revertToPreviousContext());let w=p(S,t,`@context`);o(w)||(e=await h({activeCtx:e,localCtx:w,propagate:!0,overrideProtected:!0,options:_})),_.link&&`@id`in f&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:y}));let E=f[`@type`]||[];E.length>1&&(E=Array.from(E).sort());let D=e;for(let t of E){let n=p(S,C.compactIri({activeCtx:D,iri:t,relativeTo:{vocab:!0}}),`@context`);o(n)||(e=await h({activeCtx:e,localCtx:n,options:_,propagate:!1}))}let O=Object.keys(f).sort();for(let o of O){let d=f[o];if(o===`@id`){let t=x(d).map(t=>C.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:_.base}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});y[n]=t;continue}if(o===`@type`){let t=x(d).map(e=>C.compactIri({activeCtx:S,iri:e,relativeTo:{vocab:!0}}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),i=(p(e,n,`@container`)||[]).includes(`@set`)&&g(e,1.1)||r(t)&&d.length===0;b(y,n,t,{propertyIsArray:i});continue}if(o===`@reverse`){let t=await C.compact({activeCtx:e,activeProperty:`@reverse`,element:d,options:_});for(let n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){let r=t[n];b(y,n,r,{propertyIsArray:(p(e,n,`@container`)||[]).includes(`@set`)||!_.compactArrays}),delete t[n]}Object.keys(t).length>0&&b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),t);continue}if(o===`@preserve`){let n=await C.compact({activeCtx:e,activeProperty:t,element:d,options:_});r(n)&&n.length===0||b(y,o,n);continue}if(o===`@index`){if((p(e,t,`@container`)||[]).includes(`@index`))continue;b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(o!==`@graph`&&o!==`@list`&&o!==`@included`&&m(o)){b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(!r(d))throw new n(`JSON-LD expansion error; expanded value must be an array.`,`jsonld.SyntaxError`);if(d.length===0){let t=C.compactIri({activeCtx:e,iri:o,value:d,relativeTo:{vocab:!0},reverse:v}),n=e.mappings.has(t)?e.mappings.get(t)[`@nest`]:null,r=y;n&&(T(e,n,_),i(y[n])||(y[n]={}),r=y[n]),b(r,t,d,{propertyIsArray:!0})}for(let t of d){let n=C.compactIri({activeCtx:e,iri:o,value:t,relativeTo:{vocab:!0},reverse:v}),d=e.mappings.has(n)?e.mappings.get(n)[`@nest`]:null,f=y;d&&(T(e,d,_),i(y[d])||(y[d]={}),f=y[d]);let m=p(e,n,`@container`)||[],h=l(t),g=s(t),S;g?S=t[`@list`]:h&&(S=t[`@graph`]);let w=await C.compact({activeCtx:e,activeProperty:n,element:g||h?S:t,options:_});if(g)if(r(w)||(w=[w]),!m.includes(`@list`))w={[C.compactIri({activeCtx:e,iri:`@list`,relativeTo:{vocab:!0}})]:w},`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]);else{b(f,n,w,{valueIsArray:!0,allowDuplicate:!0});continue}if(h)if(m.includes(`@graph`)&&(m.includes(`@id`)||m.includes(`@index`)&&u(t))){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i=(m.includes(`@id`)?t[`@id`]:t[`@index`])||C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}});b(r,i,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})}else m.includes(`@graph`)&&u(t)?(r(w)&&w.length>1&&(w={"@included":w}),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})):(r(w)&&w.length===1&&_.compactArrays&&(w=w[0]),w={[C.compactIri({activeCtx:e,iri:`@graph`,relativeTo:{vocab:!0}})]:w},`@id`in t&&(w[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]=t[`@id`]),`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)}));else if(m.includes(`@language`)||m.includes(`@index`)||m.includes(`@id`)||m.includes(`@type`)){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i;if(m.includes(`@language`))c(w)&&(w=w[`@value`]),i=t[`@language`];else if(m.includes(`@index`)){let r=p(e,n,`@index`)||`@index`,o=C.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if(r===`@index`)i=t[`@index`],delete w[o];else{let e;if([i,...e]=x(w[r]||[]),!a(i))i=null;else switch(e.length){case 0:delete w[r];break;case 1:w[r]=e[0];break;default:w[r]=e;break}}}else if(m.includes(`@id`)){let t=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});i=w[t],delete w[t]}else if(m.includes(`@type`)){let r=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),a;switch([i,...a]=x(w[r]||[]),a.length){case 0:delete w[r];break;case 1:w[r]=a[0];break;default:w[r]=a;break}Object.keys(w).length===1&&`@id`in t&&(w=await C.compact({activeCtx:e,activeProperty:n,element:{"@id":t[`@id`]},options:_}))}i||=C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}}),b(r,i,w,{propertyIsArray:m.includes(`@set`)})}else{let e=!_.compactArrays||m.includes(`@set`)||m.includes(`@list`)||r(w)&&w.length===0||o===`@list`||o===`@graph`;b(f,n,w,{propertyIsArray:e})}}}return y}return f},C.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:a={vocab:!1},reverse:o=!1,base:u=null})=>{if(t===null)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);let d=e.getInverse();if(m(t)&&t in d&&`@none`in d[t]&&`@type`in d[t][`@none`]&&`@none`in d[t][`@none`][`@type`])return d[t][`@none`][`@type`][`@none`];if(a.vocab&&t in d){let n=e[`@language`]||`@none`,a=[];i(r)&&`@index`in r&&!(`@graph`in r)&&a.push(`@index`,`@index@set`),i(r)&&`@preserve`in r&&(r=r[`@preserve`][0]),l(r)?(`@index`in r&&a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r&&a.push(`@graph@id`,`@graph@id@set`),a.push(`@graph`,`@graph@set`,`@set`),`@index`in r||a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r||a.push(`@graph@id`,`@graph@id@set`)):i(r)&&!c(r)&&a.push(`@id`,`@id@set`,`@type`,`@set@type`);let u=`@language`,d=`@null`;if(o)u=`@type`,d=`@reverse`,a.push(`@set`);else if(s(r)){`@index`in r||a.push(`@list`);let e=r[`@list`];if(e.length===0)u=`@any`,d=`@none`;else{let t=e.length===0?n:null,r=null;for(let n=0;n<e.length;++n){let i=e[n],a=`@none`,o=`@none`;if(c(i)?`@direction`in i?a=`${(i[`@language`]||``).toLowerCase()}_${i[`@direction`]}`:`@language`in i?a=i[`@language`].toLowerCase():`@type`in i?o=i[`@type`]:a=`@null`:o=`@id`,t===null?t=a:a!==t&&c(i)&&(t=`@none`),r===null?r=o:o!==r&&(r=`@none`),t===`@none`&&r===`@none`)break}t||=`@none`,r||=`@none`,r===`@none`?d=t:(u=`@type`,d=r)}}else{if(c(r))if(`@language`in r&&!(`@index`in r)){a.push(`@language`,`@language@set`),d=r[`@language`];let e=r[`@direction`];e&&(d=`${d}_${e}`)}else`@direction`in r&&!(`@index`in r)?d=`_${r[`@direction`]}`:`@type`in r&&(u=`@type`,d=r[`@type`]);else u=`@type`,d=`@id`;a.push(`@set`)}a.push(`@none`),i(r)&&!(`@index`in r)&&a.push(`@index`,`@index@set`),c(r)&&Object.keys(r).length===1&&a.push(`@language`,`@language@set`);let f=w(e,t,r,a,u,d);if(f!==null)return f}if(a.vocab&&`@vocab`in e){let n=e[`@vocab`];if(t.indexOf(n)===0&&t!==n){let r=t.substr(n.length);if(!e.mappings.has(r))return r}}let f=null,p=[],h=e.fastCurieMap,g=t.length-1;for(let e=0;e<g&&t[e]in h;++e)h=h[t[e]],``in h&&p.push(h[``][0]);for(let n=p.length-1;n>=0;--n){let i=p[n],a=i.terms;for(let n of a){let a=n+`:`+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(a)||r===null&&e.mappings.get(a)[`@id`]===t)&&(f===null||S(a,f)<0)&&(f=a)}}if(f!==null)return f;for(let[r,i]of e.mappings)if(i&&i._prefix&&t.startsWith(r+`:`))throw new n(`Absolute IRI "${t}" confused with prefix "${r}".`,`jsonld.SyntaxError`,{code:`IRI confused with prefix`,context:e});if(!a.vocab)if(`@base`in e)if(e[`@base`]){let n=_(v(u,e[`@base`]),t);return y.test(n)?`./${n}`:n}else return t;else return _(u,t);return t},C.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(c(n)){let r=p(e,t,`@type`),i=p(e,t,`@language`),o=p(e,t,`@direction`),s=p(e,t,`@container`)||[],c=`@index`in n&&!s.includes(`@index`);if(!c&&r!==`@none`&&(n[`@type`]===r||`@language`in n&&n[`@language`]===i&&`@direction`in n&&n[`@direction`]===o||`@language`in n&&n[`@language`]===i||`@direction`in n&&n[`@direction`]===o))return n[`@value`];let l=Object.keys(n).length,u=l===1||l===2&&`@index`in n&&!c,d=`@language`in e,f=a(n[`@value`]),m=e.mappings.has(t)&&e.mappings.get(t)[`@language`]===null;if(u&&r!==`@none`&&(!d||!f||m))return n[`@value`];let h={};return c&&(h[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=n[`@index`]),`@type`in n?h[C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}})]=C.compactIri({activeCtx:e,iri:n[`@type`],relativeTo:{vocab:!0}}):`@language`in n&&(h[C.compactIri({activeCtx:e,iri:`@language`,relativeTo:{vocab:!0}})]=n[`@language`]),`@direction`in n&&(h[C.compactIri({activeCtx:e,iri:`@direction`,relativeTo:{vocab:!0}})]=n[`@direction`]),h[C.compactIri({activeCtx:e,iri:`@value`,relativeTo:{vocab:!0}})]=n[`@value`],h}let i=f(e,t,{vocab:!0},r),o=p(e,t,`@type`),s=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:o===`@vocab`},base:r.base});return o===`@id`||o===`@vocab`||i===`@graph`?s:{[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]:s}};function w(e,t,n,r,a,o){o===null&&(o=`@null`);let s=[];if((o===`@id`||o===`@reverse`)&&i(n)&&`@id`in n){o===`@reverse`&&s.push(`@reverse`);let t=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)[`@id`]===n[`@id`]?s.push.apply(s,[`@vocab`,`@id`]):s.push.apply(s,[`@id`,`@vocab`])}else{s.push(o);let e=s.find(e=>e.includes(`_`));e&&s.push(e.replace(/^[^_]+_/,`_`))}s.push(`@none`);let c=e.inverse[t];for(let e of r){if(!(e in c))continue;let t=c[e][a];for(let e of s)if(e in t)return t[e]}return null}function T(e,t,r){if(f(e,t,{vocab:!0},r)!==`@nest`)throw new n(`JSON-LD compact error; nested property must have an @nest value resolving to @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`})}})),lr=o(((e,t)=>{t.exports=e=>{class t{toString(){return`[object JsonLdProcessor]`}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,n){return arguments.length<2?Promise.reject(TypeError(`Could not compact, too few arguments.`)):e.compact(t,n)},t.expand=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not expand, too few arguments.`)):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not flatten, too few arguments.`)):e.flatten(t)},t}})),ur=o(((e,t)=>{var n=Ln(),r=Kn(),i=Vn(),a=Zn(),o=i.IdentifierIssuer,s=Bn(),c=Yn(),l=Qn(),{expand:u}=tr(),{flatten:d}=rr(),{fromRDF:f}=ir(),{toRDF:p}=or(),{frameMergedOrDefault:m,cleanupNull:h}=sr(),{isArray:g,isObject:_,isString:v}=Rn(),{isSubjectReference:y}=zn(),{expandIri:b,getInitialContext:x,process:S,processingMode:C}=er(),{compact:w,compactIri:T}=cr(),{createNodeMap:E,createMergedNodeMap:D,mergeNodeMaps:O}=nr(),{logEventHandler:k,logWarningEventHandler:A,safeEventHandler:j,setDefaultEventHandler:M,setupEventHandler:N,strictEventHandler:P,unhandledEventHandler:F}=$n(),I=function(e){let t={},I=new c({max:100});e.compact=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not compact, too few arguments.`);if(n===null)throw new s(`The compaction context must not be null.`,`jsonld.CompactError`,{code:`invalid local context`});if(t===null)return null;r=L(r,{base:v(t)?t:``,compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new o(`_:b`),contextResolver:new a({sharedCache:I})}),r.link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base;let c;c=r.skipExpansion?t:await e.expand(t,r);let l=await e.processContext(x(r),n,r),u=await w({activeCtx:l,element:c,options:r});r.compactArrays&&!r.graph&&g(u)?u.length===1?u=u[0]:u.length===0&&(u={}):r.graph&&_(u)&&(u=[u]),_(n)&&`@context`in n&&(n=n[`@context`]),n=i.clone(n),g(n)||(n=[n]);let d=n;n=[];for(let e=0;e<d.length;++e)(!_(d[e])||Object.keys(d[e]).length>0)&&n.push(d[e]);let f=n.length>0;if(n.length===1&&(n=n[0]),g(u)){let e=T({activeCtx:l,iri:`@graph`,relativeTo:{vocab:!0}}),t=u;u={},f&&(u[`@context`]=n),u[e]=t}else if(_(u)&&f){let e=u;u={"@context":n};for(let t in e)u[t]=e[t]}return u},e.expand=async function(t,n){if(arguments.length<1)throw TypeError(`Could not expand, too few arguments.`);n=L(n,{keepFreeFloatingNodes:!1,contextResolver:new a({sharedCache:I})});let r={},o=[];if(`expandContext`in n){let e=i.clone(n.expandContext);_(e)&&`@context`in e?r.expandContext=e:r.expandContext={"@context":e},o.push(r.expandContext)}let s;if(!v(t))r.input=i.clone(t);else{let i=await e.get(t,n);s=i.documentUrl,r.input=i.document,i.contextUrl&&(r.remoteContext={"@context":i.contextUrl},o.push(r.remoteContext))}`base`in n||(n.base=s||``);let c=x(n);for(let e of o)c=await S({activeCtx:c,localCtx:e,options:n});let l=await u({activeCtx:c,element:r.input,options:n});return _(l)&&`@graph`in l&&Object.keys(l).length===1?l=l[`@graph`]:l===null&&(l=[]),g(l)||(l=[l]),l},e.flatten=async function(t,n,r){if(arguments.length<1)return TypeError(`Could not flatten, too few arguments.`);typeof n==`function`?n=null:n||=null,r=L(r,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})});let i=d(await e.expand(t,r));return n===null?i:(r.graph=!0,r.skipExpansion=!0,await e.compact(i,n,r))},e.frame=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not frame, too few arguments.`);if(r=L(r,{base:v(t)?t:``,embed:`@once`,explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new a({sharedCache:I})}),v(n)){let t=await e.get(n,r);if(n=t.document,t.contextUrl){let e=n[`@context`];e?g(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n[`@context`]=e}}let i=n&&n[`@context`]||{},o=await e.processContext(x(r),i,r);r.hasOwnProperty(`omitGraph`)||(r.omitGraph=C(o,1.1)),r.hasOwnProperty(`pruneBlankNodeIdentifiers`)||(r.pruneBlankNodeIdentifiers=C(o,1.1));let s=await e.expand(t,r),c={...r};c.isFrame=!0,c.keepFreeFloatingNodes=!0;let l=await e.expand(n,c);c.merged=!Object.keys(n).map(e=>b(o,e,{vocab:!0})).includes(`@graph`),c.is11=C(o,1.1);let u=m(s,l,c);c.graph=!r.omitGraph,c.skipExpansion=!0,c.link={},c.framing=!0;let d=await e.compact(u,i,c);return c.link={},d=h(d,c),d},e.link=async function(t,n,r){let i={};return n&&(i[`@context`]=n),i[`@embed`]=`@link`,e.frame(t,i,r)},e.normalize=e.canonize=async function(t,r){if(arguments.length<1)throw TypeError(`Could not canonize, too few arguments.`);r=L(r,{skipExpansion:!1,safe:!0,contextResolver:new a({sharedCache:I})});let i=Object.assign({},{algorithm:`RDFC-1.0`},r.canonizeOptions||null);if(`inputFormat`in r){if(r.inputFormat!==`application/n-quads`)throw new s(`Unknown canonicalization input format.`,`jsonld.CanonizeError`);let e=l.parse(t);return n.canonize(e,i)}let o={...r};delete o.format,delete o.canonizeOptions,o.produceGeneralizedRdf=!1;let c=await e.toRDF(t,o);return n.canonize(c,i)},e.fromRDF=async function(e,n){if(arguments.length<1)throw TypeError(`Could not convert from RDF, too few arguments.`);n=L(n,{format:v(e)?`application/n-quads`:void 0});let{format:r}=n,{rdfParser:i}=n;if(r){if(i||=t[r],!i)throw new s(`Unknown input format.`,`jsonld.UnknownFormat`,{format:r})}else i=()=>e;return f(await i(e),n)},e.toRDF=async function(t,n){if(arguments.length<1)throw TypeError(`Could not convert to RDF, too few arguments.`);n=L(n,{skipExpansion:!1,contextResolver:new a({sharedCache:I})});let r;r=n.skipExpansion?t:await e.expand(t,n);let i=p(r,n);if(n.format){if(n.format===`application/n-quads`)return l.serialize(i);throw new s(`Unknown output format.`,`jsonld.UnknownFormat`,{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw TypeError(`Could not create node map, too few arguments.`);return n=L(n,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})}),D(await e.expand(t,n),n)},e.merge=async function(t,n,r){if(arguments.length<1)throw TypeError(`Could not merge, too few arguments.`);if(!g(t))throw TypeError(`Could not merge, "docs" must be an array.`);typeof n==`function`?n=null:n||=null,r=L(r,{contextResolver:new a({sharedCache:I})});let s=await Promise.all(t.map(t=>{let n={...r};return e.expand(t,n)})),c=!0;`mergeNodes`in r&&(c=r.mergeNodes);let l=r.issuer||new o(`_:b`),u={"@default":{}};for(let e=0;e<s.length;++e){let t=i.relabelBlankNodes(s[e],{issuer:new o(`_:b`+e+`-`)}),n=c||e===0?u:{"@default":{}};if(E(t,n,`@default`,l),n!==u)for(let e in n){let t=n[e];if(!(e in u)){u[e]=t;continue}let r=u[e];for(let e in t)e in r||(r[e]=t[e])}}let d=O(u),f=[],p=Object.keys(d).sort();for(let e=0;e<p.length;++e){let t=d[p[e]];y(t)||f.push(t)}return n===null?f:(r.graph=!0,r.skipExpansion=!0,await e.compact(f,n,r))},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new s(`Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:e})},e.get=async function(t,n){let r;r=typeof n.documentLoader==`function`?n.documentLoader:e.documentLoader;let i=await r(t);try{if(!i.document)throw new s(`No remote document found at the given URL.`,`jsonld.NullRemoteDocument`);v(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new s(`Could not retrieve a JSON-LD document from the URL.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,n){return n=L(n,{base:``,contextResolver:new a({sharedCache:I})}),t===null?x(n):(t=i.clone(t),_(t)&&`@context`in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=er().getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new s(`Unknown document loader type: "`+t+`"`,`jsonld.UnknownDocumentLoader`,{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,n){t[e]=n},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser(`application/n-quads`,l.parse),e.url=Wn(),e.logEventHandler=k,e.logWarningEventHandler=A,e.safeEventHandler=j,e.setDefaultEventHandler=M,e.strictEventHandler=P,e.unhandledEventHandler=F,e.util=i,Object.assign(e,i),e.promises=e,e.RequestQueue=Un(),e.JsonLdProcessor=lr()(e),r.setupGlobals(e),r.setupDocumentLoaders(e);function L(t,{documentLoader:n=e.documentLoader,...r}){if(t&&`compactionMap`in t)throw new s(`"compactionMap" not supported.`,`jsonld.OptionsError`);if(t&&`expansionMap`in t)throw new s(`"expansionMap" not supported.`,`jsonld.OptionsError`);return Object.assign({},{documentLoader:n},r,t,{eventHandler:N({options:t})})}return e},L=function(){return I(function(){return L()})};I(L),t.exports=L})),dr=Dn(),fr=l(ur(),1),pr={},mr={};async function hr(e){return`rdf`in e?_r(e.rdf):e.rdfUrlResolver?_r(await e.rdfUrlResolver(e.url)):gr(e.url,e.proxy)}async function gr(e,t){return e in pr||(pr[e]=(async()=>{let n=e;t&&(n=t+encodeURIComponent(e));let r=await fetch(n,{headers:{Accept:`text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json`}});return r.ok?_r(await r.text()):(console.warn(`failed fetching RDF from`,e),[])})()),pr[e]}async function _r(e){if(!e.trim())return[];let t=vr(e);if(t===`json`)try{e=await fr.default.toRDF(JSON.parse(e),{format:`application/n-quads`})}catch(e){console.error(e)}let n=[];return await new Promise((r,i)=>{let a=t===`xml`?new dr.RdfXmlParser:new at;a.on(`data`,e=>{n.push(k.quad(e.subject,e.predicate,e.object,e.graph))}).on(`error`,e=>{i(e)}).on(`prefix`,(e,t)=>{e&&(mr[e]=t)}).on(`end`,()=>{r(null)}),a.write(e),a.end()}),n}function vr(e){return/^\s*[\\[{]/.test(e)?`json`:/^\s*<\?xml/.test(e)?`xml`:`ttl`}var yr={[`${J}name`]:(e,t)=>{let n=t;e.name=Xt(e.config.languages,e.name,n)},[`${J}description`]:(e,t)=>{let n=t;e.description=Xt(e.config.languages,e.description,n)},[`${J}path`]:(e,t)=>{if(t.termType===`NamedNode`){e.path=t.value;return}let n=e.config.store.getQuads(t,null,null,null),r=n.filter(e=>e.predicate.value===`${J}alternativePath`);if(n.length!==1||r.length!==1){console.warn(`ignoring unsupported or malformed SHACL property path`,t.value);return}let i=e.config.lists[r[0].object.value];if(!i||i.length<2||i.some(e=>e.termType!==`NamedNode`)){console.warn(`ignoring sh:alternativePath without at least two predicate IRI members`,t.value);return}e.pathAlternatives=i.map(e=>e.value),e.path=e.pathAlternatives[0]},[`${J}group`]:(e,t)=>{e.group=t.id},[`${J}datatype`]:(e,t)=>{e.datatype=t},[`${J}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${J}minCount`]:(e,t)=>{e.minCount=parseInt(t.value)},[`${J}maxCount`]:(e,t)=>{e.maxCount=parseInt(t.value)},[`${J}minLength`]:(e,t)=>{e.minLength=parseInt(t.value)},[`${J}maxLength`]:(e,t)=>{e.maxLength=parseInt(t.value)},[`${J}minInclusive`]:(e,t)=>{e.minInclusive=parseInt(t.value)},[`${J}maxInclusive`]:(e,t)=>{e.maxInclusive=parseInt(t.value)},[`${J}minExclusive`]:(e,t)=>{e.minExclusive=parseInt(t.value)},[`${J}maxExclusive`]:(e,t)=>{e.maxExclusive=parseInt(t.value)},[`${J}pattern`]:(e,t)=>{e.pattern=t.value},[`${J}order`]:(e,t)=>{e.order=parseInt(t.value)},[`${ot}singleLine`]:(e,t)=>{e.singleLine=t.value===`true`},[`${ot}readonly`]:(e,t)=>{e.readonly=t.value===`true`},[`${ot}facet`]:(e,t)=>{e.facet=t.value===`true`||t.value===`1`},[`${ut}styleClass`]:(e,t)=>{e.cssClass=t.value},[`${J}in`]:(e,t)=>{e.in=t.value},[`${J}languageIn`]:(e,t)=>{e.languageIn=e.config.lists[t.value],e.datatype=vt},[`${J}defaultValue`]:(e,t)=>{e.defaultValue=t},[`${J}hasValue`]:(e,t)=>{e.hasValue=t},[`${J}node`]:(e,t)=>{e.node=t,e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${J}and`]:(e,t)=>{e.and=t.value;let n=e.config.lists[e.and];if(n?.length)for(let t of n)e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${J}qualifiedValueShape`]:(e,t)=>{let n=e.config.getNodeTemplate(t,e);e.qualifiedValueShape=n,e.nodeShapes.add(n)},[`${J}qualifiedMinCount`]:(e,t)=>{e.qualifiedMinCount=parseInt(t.value)},[`${J}qualifiedMaxCount`]:(e,t)=>{e.qualifiedMaxCount=parseInt(t.value)},[xt.id]:(e,t)=>{e.owlImports.add(t)},[Dt.id]:(e,t)=>{e.class=t;let n=e.config.store.getSubjects(At,t,null);n.length>0&&(e.node=n[0])},[`${J}or`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.or=n:console.error(`list for sh:or not found:`,t.value,`existing lists:`,e.config.lists)},[`${J}xone`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.xone=n:console.error(`list for sh:xone not found:`,t.value,`existing lists:`,e.config.lists)}},br=class{constructor(e,t){this.label=``,this.nodeShapes=new Set,this.owlImports=new Set,this.id=e,this.parent=t,this.config=t.config,this.config.registerPropertyTemplate(this),wr(this,this.config.store.getQuads(e,null,null,null))}};function xr(e){return Math.max(e.minCount??0,e.qualifiedMinCount??0)}function Sr(e){return Math.min(e.maxCount??2**53-1,e.qualifiedMaxCount??2**53-1)}function Cr(e){let t=Object.assign({},e);return t.nodeShapes=new Set(e.nodeShapes),t.owlImports=new Set(e.owlImports),e.languageIn&&(t.languageIn=[...e.languageIn]),e.pathAlternatives&&(t.pathAlternatives=[...e.pathAlternatives]),e.pathAlternativeBranches&&(t.pathAlternativeBranches={...e.pathAlternativeBranches}),e.or&&(t.or=[...e.or]),e.xone&&(t.xone=[...e.xone]),t}function wr(e,t){for(let n of t)yr[n.predicate.id]?.call(e,e,n.object);return e.label=e.name?.value||Bt(t,e.config.languages),e.label||=e.pathAlternatives?e.pathAlternatives.map(e=>Ht(e,mr)).join(` / `):e.path?Ht(e.path,mr):`unknown`,e}function Tr(e,t,n=!1){let r=t,i=e,a=Or(e),o=Or(t),s=a&&kr(t),c=o&&kr(e);s&&(e.nodeShapes.clear(),e.node=void 0);for(let a in t)if(a!==`parent`&&a!==`config`&&a!==`id`){let o=r[a];if(o!==void 0&&o!==``){if(a===`label`)continue;if(a===`name`||a===`description`||a===`group`||a===`order`)(n||i[a]===void 0||i[a]===``)&&(i[a]=o);else if(a===`minCount`)e.minCount=Math.max(e.minCount??0,t.minCount);else if(a===`maxCount`)e.maxCount=Math.min(e.maxCount??2**53-1,t.maxCount);else if(a===`qualifiedMinCount`)e.qualifiedMinCount=Math.max(e.qualifiedMinCount??0,t.qualifiedMinCount);else if(a===`qualifiedMaxCount`)e.qualifiedMaxCount=Math.min(e.qualifiedMaxCount??2**53-1,t.qualifiedMaxCount);else if(a===`nodeShapes`&&c)continue;else if(a===`node`&&c)continue;else if(a===`pathAlternatives`)continue;else if(Array.isArray(o)){let e=i[a];Array.isArray(e)?e.push(...o):i[a]=[...o]}else if(o instanceof Set&&o.size){let e=i[a];i[a]=new Set([...e instanceof Set?e:[],...o])}else i[a]=o}}e.name&&(e.label=e.name.value)}function Er(e){return e.pathAlternatives?`alternative:${JSON.stringify(e.pathAlternatives)}`:e.path}function Dr(e){return e.pathAlternatives?[...e.pathAlternatives]:e.path}function Or(e){return e.nodeShapes.size>0&&e.qualifiedValueShape===void 0&&e.name===void 0&&e.description===void 0&&!kr(e)}function kr(e){return e.in!==void 0||e.datatype!==void 0||e.languageIn!==void 0||e.class!==void 0||e.hasValue!==void 0||e.defaultValue!==void 0}var Ar=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),jr=function(e){return`/`+e},Mr={},Nr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=jr(t,n),t=s(t),t in Mr)return;Mr[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Ar,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Pr(e,t,n,r,i){let a=document.createElement(`div`);a.classList.add(`shacl-or-constraint`),a.setAttribute(`part`,`constraint`);let o=[];if(t instanceof Io){let r=[],i=!1;e.length&&(i=n.store.countQuads(e[0],Et,null,null)>0);for(let a=0;a<e.length;a++)if(i){let i=n.store.getObjects(e[a],Et,null),s=[],c=``;for(let e of i){let r=new lo(n.getPropertyTemplate(e,t.template),t);s.push(r),c+=(c.length>0?` / `:``)+r.template.label}r.push(s),o.push({label:c,value:a.toString()})}else{let i=e[a],s=new lo(n.getPropertyTemplate(i,t.template),t);r.push([s]),o.push({label:s.template.label,value:a.toString()})}let s=n.theme.createListEditor(`Please choose`,null,!1,o);s.setAttribute(`part`,`constraint-editor`);let c=s.querySelector(`.editor`);c.onchange=async()=>{if(c.value){let e=r[parseInt(c.value)];if(n.queryMode){let{activateNodeConstraintOption:t}=await Nr(async()=>{let{activateNodeConstraintOption:e}=await import(`./mode-DQMbYnAU.js`);return{activateNodeConstraintOption:e}},[]);await t(e,a);return}let i;if(e.length){for(let n of e)await n.bindValues(t.nodeId,!1);i=e[0],a.replaceWith(e[0]),i.updateControls()}for(let t=1;t<e.length;t++)i.after(e[t]),i=e[t],i.updateControls()}},a.appendChild(s)}else{let s=[];for(let t=0;t<e.length;t++){let r=n.store.getQuads(e[t],null,null,null);if(r.length){s.push(r);let e=Bt(r,n.languages);for(let t of r)t.predicate.equals(Ot)&&(e||=Bt(n.store.getQuads(t.object,null,null,null),n.languages));o.push({label:e||Ht(r[0].predicate.value,mr)+` = `+Ht(r[0].object.value,mr),value:(s.length-1).toString()})}}let c=n.theme.createListEditor(t.template.label+`?`,null,!1,o,t.template);c.setAttribute(`part`,`constraint-editor`);let l=c.querySelector(`.editor`);l.onchange=async()=>{if(l.value){let e=wr(Cr(i??t.template),s[parseInt(l.value)]);if(e.or=void 0,e.xone=void 0,n.queryMode){let{activatePropertyConstraintOption:n}=await Nr(async()=>{let{activatePropertyConstraintOption:e}=await import(`./mode-DQMbYnAU.js`);return{activatePropertyConstraintOption:e}},[]);await n(e,t,a);return}if(r||Sr(t.template)>1){let n=await bo(e,void 0,!0,!1,t.parent);n.dataset.path=t.template.path,r&&(n.dataset.predicate=r),a.replaceWith(n),n.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0}));return}e.pathAlternatives=void 0;let o=new lo(e,t.parent);t.replaceWith(o),await o.updateControls()}},a.appendChild(c)}return a}function Fr(e,t,n,r=!1){let i=document.createElement(`div`);i.classList.add(`alternative-path-constraint`),i.setAttribute(`part`,`constraint`),i.dataset.path=e.template.path;let a=e.template.pathAlternatives.map((e,t)=>({label:Ht(e,mr),value:t.toString()})),o=e.template.config.theme.createListEditor(`${e.template.label}: path`,null,!1,a,e.template);o.setAttribute(`part`,`constraint-editor`);let s=o.querySelector(`.editor`);return s.onchange=async()=>{if(s.value===``)return;let r=e.template.pathAlternatives[parseInt(s.value)],a=await e.addPropertyInstance(t,n,!0,r,!1);a&&(i.replaceWith(a),a.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0})))},i.appendChild(o),xo(i,e.template.label,e.template.config.theme.dense,e.template.config.hierarchyColorsStyleSheet!==void 0,r),i}function Ir(e,t,n){if(t.termType===`Literal`){let r=t.datatype;for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(t.predicate.value===`http://www.w3.org/ns/shacl#datatype`&&t.object.equals(r))return e}}else{let r=n.store.getObjects(t,mt,null);for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(r.length>0){if(t.predicate.value===`http://www.w3.org/ns/shacl#node`){for(let i of r)if(n.store.getQuads(t.object,At,i,null).length>0)return e}if(t.predicate.equals(Dt)){for(let n of r)if(t.object.equals(n))return e}}else if(t.predicate.equals(jt)&&t.object.equals(Tt))return e}}return console.error(`couldn't resolve sh:or/sh:xone on property for value`,t),[]}function Lr(e,t,n){for(let r of e){let e=!1,i=n.store.getObjects(r,Et,null);for(let r of i){let i=n.store.getObjects(r,`${J}path`,null);for(let r of i)if(e=n.store.countQuads(t,r,null,null)>0,e)break}if(e)return i}return console.error(`couldn't resolve sh:or/sh:xone on node for value`,t),[]}var Rr=`:host {
27
27
  --shacl-font-family: inherit;
28
28
  --shacl-font-size: 14px;
29
29
  --shacl-text-color: #333;
@@ -113,9 +113,9 @@ h3 { margin-top: 0; }
113
113
  rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: min(90vw, 600px); }
114
114
  rokit-select::part(facet-count) { color: var(--shacl-muted-color); }
115
115
  rokit-select::part(facet-count)::after { content: attr(data-count); color: inherit; display: inline-block; font-family: monospace; margin-left: 7px; font-size: 12px; }
116
- `,Rr=class{constructor(e){this.dense=!0;let t=Lr;e&&(t+=`
117
- `+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}setDense(e){this.dense=e}createViewer(e,t,n){let r=document.createElement(`div`),i=document.createElement(`label`);i.textContent=`${e}:`,n.description&&i.setAttribute(`title`,n.description.value),r.appendChild(i);let a=t.value,o=null;if(t instanceof j){let e=n.config.store.getQuads(a,null,null,null);if(e.length){let t=Bt(e,n.config.languages);t&&(a=t)}}else t instanceof M&&(t.language?(o=document.createElement(`span`),o.classList.add(`lang`),o.innerText=`@${t.language}`):t.datatype.value===`http://www.w3.org/2001/XMLSchema#date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`http://www.w3.org/2001/XMLSchema#dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let s;return Jt(t.value)?(s=document.createElement(`a`),s.setAttribute(`href`,t.value)):s=document.createElement(`div`),s.classList.add(`d-flex`),s.innerText=a,o&&s.appendChild(o),r.appendChild(s),r}};function zr(e,t,n){if(n){let n=br(e)>0;if(e.class&&!e.hasValue)return e.config.theme.createListEditor(e.label,t,n,qt(e.class,e),e);if(e.in){let r=e.config.lists[e.in];if(r?.length){let i=Vt(r,e.config.store,e.config.languages);return e.config.theme.createListEditor(e.label,t,n,i,e)}else console.error(`list not found:`,e.in,`existing lists:`,e.config.lists)}if(e.datatype?.equals(vt)||e.languageIn?.length||e.datatype===void 0&&t instanceof M&&t.language)return e.config.theme.createLangStringEditor(e.label,t,n,e);switch(e.datatype?.value.replace(st,``)){case`integer`:case`float`:case`double`:case`decimal`:return e.config.theme.createNumberEditor(e.label,t,n,e);case`date`:case`dateTime`:return e.config.theme.createDateEditor(e.label,t,n,e);case`boolean`:return e.config.theme.createBooleanEditor(e.label,t,n,e);case`base64Binary`:return e.config.theme.createFileEditor(e.label,t,n,e)}return e.config.theme.createTextEditor(e.label,t,n,e)}else return t?e.config.theme.createViewer(e.label,t,e):document.createElement(`div`)}function Br(e,t){e.rdfTerm=t??void 0,e.rdfTermState=t?qr(e):void 0}function Vr(e,t){e.rdfTerms=new Map;for(let n of t)e.rdfTerms.set(Hr(n),n)}function Hr(e){return I(e)}function Ur(e){let t=e.rdfTerms?.get(e.value);if(t)return t;if(!(!e.rdfTerm||!Jr(e.rdfTermState,qr(e))))return e.rdfTerm}function Wr(e){let t=Ur(e);if(t)return t;let n=e.shaclDatatype,r=e.dataset.value||e.value;if((e.type===`file`||e.getAttribute(`type`)===`file`)&&e.binaryData)r=e.binaryData;else if(e.type===`checkbox`||e.getAttribute(`type`)===`checkbox`)return e.checked||parseInt(e.dataset.minCount||`0`)>0?k.literal(e.checked?`true`:`false`,n):void 0;if(!r)return;let i=e.dataset.nodeKind,a=Gr(r);if(e.dataset.link)return k.fromTerm(JSON.parse(e.dataset.link));if(e.dataset.class)return a instanceof j||a instanceof N?a:k.namedNode(r);if(i===`http://www.w3.org/ns/shacl#IRI`)return a instanceof j?a:k.namedNode(r);if(i===`http://www.w3.org/ns/shacl#BlankNode`)return a instanceof N?a:k.blankNode(r);if(i===`http://www.w3.org/ns/shacl#BlankNodeOrIRI`)return a instanceof j||a instanceof N?a:k.namedNode(r);if(a instanceof j||a instanceof N||a instanceof M&&!e.dataset.lang&&(!n||n instanceof j&&Mt.equals(n)))return a;if(e.dataset.lang)n=e.dataset.lang;else if(n instanceof j&&It.has(n.value)){let e=Kr(r,n.value);if(e===void 0)return;r=e}else e.type===`number`?r=parseFloat(r):e.type===`datetime-local`?r=rn(r,e.dataset.xsdTemporalSuffix):e.type===`date`&&n instanceof j&&n.value===`http://www.w3.org/2001/XMLSchema#date`&&(r=nn(r,e.dataset.xsdTemporalSuffix));return k.literal(r,n)}function Gr(e){let t=e;if(e.startsWith(`<`)&&e.endsWith(`>`))t=e.slice(1,-1);else if(!e.startsWith(`_:`)&&!e.startsWith(`"`))return;let n=F(t,k);return n instanceof j||n instanceof N||n instanceof M?n:void 0}function Kr(e,t){let n=e.replace(`,`,`.`);return(t===`http://www.w3.org/2001/XMLSchema#decimal`?/^[-+]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)$/:/^[-+]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][-+]?[0-9]+)?$/).test(n)?n:void 0}function qr(e){return{value:e.value,language:e.dataset.lang,checked:e.checked,binaryData:e.binaryData}}function Jr(e,t){return e?.value===t.value&&e.language===t.language&&e.checked===t.checked&&e.binaryData===t.binaryData}function Yr(e,t,n){if(t===`application/ld+json`)return Xr(e);{let r=new Se({format:t,prefixes:n});r.addQuads(e);let i=``;return r.end((e,t)=>{e&&console.error(e),i=t}),i}}function Xr(e){let t=[];for(let n of e){let e={"@id":n.subject.id};if(n.predicate.equals(mt))e[`@type`]=n.object.id;else{let t=n.object.value;n.object instanceof M?n.object.language?t={"@language":n.object.language,"@value":n.object.value}:n.object.datatype&&n.object.datatype.value!==`http://www.w3.org/2001/XMLSchema##string`&&(t={"@type":n.object.datatype.value,"@value":n.object.value}):t={"@id":n.object.id},e[n.predicate.value]=t}t.push(e)}return JSON.stringify(t)}var Zr={};function Qr(e){e.predicate===void 0&&e.datatype===void 0?console.warn(`not registering plugin because it does neither define "predicate" nor "datatype"`,e):Zr[`${e.predicate}^${e.datatype}`]=e}function $r(){return Object.entries(Zr).map(e=>e[1])}function ei(e,t){let n=Zr[`${e}^${t}`];return n||(n=Zr[`${e}^undefined`],n)?n:Zr[`undefined^${t}`]}var ti=class{constructor(e,t){this.predicate=e.predicate,this.datatype=e.datatype,t&&(this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t))}createViewer(e,t){return e.config.theme.createViewer(e.label,t,e)}},ni=globalThis,ri=ni.ShadowRoot&&(ni.ShadyCSS===void 0||ni.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,ii=Symbol(),ai=new WeakMap,oi=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ii)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ri&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=ai.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ai.set(t,e))}return e}toString(){return this.cssText}},si=e=>new oi(typeof e==`string`?e:e+``,void 0,ii),ci=(e,...t)=>new oi(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,ii),li=(e,t)=>{if(ri)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=ni.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},ui=ri?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return si(t)})(e):e,{is:di,defineProperty:fi,getOwnPropertyDescriptor:pi,getOwnPropertyNames:mi,getOwnPropertySymbols:hi,getPrototypeOf:gi}=Object,_i=globalThis,vi=_i.trustedTypes,yi=vi?vi.emptyScript:``,bi=_i.reactiveElementPolyfillSupport,xi=(e,t)=>e,Si={toAttribute(e,t){switch(t){case Boolean:e=e?yi:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Ci=(e,t)=>!di(e,t),wi={attribute:!0,type:String,converter:Si,reflect:!1,useDefault:!1,hasChanged:Ci};Symbol.metadata??=Symbol(`metadata`),_i.litPropertyMetadata??=new WeakMap;var Ti=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=wi){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&fi(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=pi(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??wi}static _$Ei(){if(this.hasOwnProperty(xi(`elementProperties`)))return;let e=gi(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(xi(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(xi(`properties`))){let e=this.properties,t=[...mi(e),...hi(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(ui(e))}else e!==void 0&&t.push(ui(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return li(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?Si:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?Si:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??Ci)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};Ti.elementStyles=[],Ti.shadowRootOptions={mode:`open`},Ti[xi(`elementProperties`)]=new Map,Ti[xi(`finalized`)]=new Map,bi?.({ReactiveElement:Ti}),(_i.reactiveElementVersions??=[]).push(`2.1.2`);var Ei=globalThis,Di=e=>e,Oi=Ei.trustedTypes,ki=Oi?Oi.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,Ai=`$lit$`,ji=`lit$${Math.random().toFixed(9).slice(2)}$`,Mi=`?`+ji,Ni=`<${Mi}>`,Pi=document,Fi=()=>Pi.createComment(``),Ii=e=>e===null||typeof e!=`object`&&typeof e!=`function`,Li=Array.isArray,Ri=e=>Li(e)||typeof e?.[Symbol.iterator]==`function`,zi=`[
118
- \f\r]`,Bi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Vi=/-->/g,Hi=/>/g,Ui=RegExp(`>|${zi}(?:([^\\s"'>=/]+)(${zi}*=${zi}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),Wi=/'/g,Gi=/"/g,Ki=/^(?:script|style|textarea|title)$/i,Y=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),qi=Symbol.for(`lit-noChange`),X=Symbol.for(`lit-nothing`),Ji=new WeakMap,Yi=Pi.createTreeWalker(Pi,129);function Xi(e,t){if(!Li(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return ki===void 0?t:ki.createHTML(t)}var Zi=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=Bi;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===Bi?c[1]===`!--`?o=Vi:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=Ui):(Ki.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=Ui):o=Hi:o===Ui?c[0]===`>`?(o=i??Bi,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?Ui:c[3]===`"`?Gi:Wi):o===Gi||o===Wi?o=Ui:o===Vi||o===Hi?o=Bi:(o=Ui,i=void 0);let d=o===Ui&&e[t+1].startsWith(`/>`)?` `:``;a+=o===Bi?n+Ni:l>=0?(r.push(s),n.slice(0,l)+Ai+n.slice(l)+ji+d):n+ji+(l===-2?t:d)}return[Xi(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},Qi=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=Zi(t,n);if(this.el=e.createElement(l,r),Yi.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=Yi.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(Ai)){let t=u[o++],n=i.getAttribute(e).split(ji),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?ra:r[1]===`?`?ia:r[1]===`@`?aa:na}),i.removeAttribute(e)}else e.startsWith(ji)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Ki.test(i.tagName)){let e=i.textContent.split(ji),t=e.length-1;if(t>0){i.textContent=Oi?Oi.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],Fi()),Yi.nextNode(),c.push({type:2,index:++a});i.append(e[t],Fi())}}}else if(i.nodeType===8)if(i.data===Mi)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(ji,e+1))!==-1;)c.push({type:7,index:a}),e+=ji.length-1}a++}}static createElement(e,t){let n=Pi.createElement(`template`);return n.innerHTML=e,n}};function $i(e,t,n=e,r){if(t===qi)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=Ii(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=$i(e,i._$AS(e,t.values),i,r)),t}var ea=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??Pi).importNode(t,!0);Yi.currentNode=r;let i=Yi.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new ta(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new oa(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=Yi.nextNode(),a++)}return Yi.currentNode=Pi,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},ta=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=$i(this,e,t),Ii(e)?e===X||e==null||e===``?(this._$AH!==X&&this._$AR(),this._$AH=X):e!==this._$AH&&e!==qi&&this._(e):e._$litType$===void 0?e.nodeType===void 0?Ri(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==X&&Ii(this._$AH)?this._$AA.nextSibling.data=e:this.T(Pi.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Qi.createElement(Xi(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new ea(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Ji.get(e.strings);return t===void 0&&Ji.set(e.strings,t=new Qi(e)),t}k(t){Li(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(Fi()),this.O(Fi()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=Di(e).nextSibling;Di(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},na=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=X,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=X}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=$i(this,e,t,0),a=!Ii(e)||e!==this._$AH&&e!==qi,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=$i(this,r[n+o],t,o),s===qi&&(s=this._$AH[o]),a||=!Ii(s)||s!==this._$AH[o],s===X?e=X:e!==X&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},ra=class extends na{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===X?void 0:e}},ia=class extends na{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==X)}},aa=class extends na{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=$i(this,e,t,0)??X)===qi)return;let n=this._$AH,r=e===X&&n!==X||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==X&&(n===X||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},oa=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){$i(this,e)}},sa=Ei.litHtmlPolyfillSupport;sa?.(Qi,ta),(Ei.litHtmlVersions??=[]).push(`3.3.2`);var ca=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new ta(t.insertBefore(Fi(),e),e,void 0,n??{})}return i._$AI(e),i},la=globalThis,ua=class extends Ti{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ca(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return qi}};ua._$litElement$=!0,ua.finalized=!0,la.litElementHydrateSupport?.({LitElement:ua});var da=la.litElementPolyfillSupport;da?.({LitElement:ua}),(la.litElementVersions??=[]).push(`4.2.2`);var fa=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},pa={attribute:!0,type:String,converter:Si,reflect:!1,hasChanged:Ci},ma=(e=pa,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function Z(e){return(t,n)=>typeof n==`object`?ma(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function ha(e){return Z({...e,state:!0,attribute:!1})}var ga=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`object`&&Object.defineProperty(e,t,n),n);function _a(e,t){return(n,r,i)=>{let a=t=>t.renderRoot?.querySelector(e)??null;if(t){let{get:e,set:t}=typeof r==`object`?n:i??(()=>{let e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return ga(n,r,{get(){let n=e.call(this);return n===void 0&&(n=a(this),(n!==null||this.hasUpdated)&&t.call(this,n)),n}})}return ga(n,r,{get(){return a(this)}})}}function Q(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var va=class extends ua{constructor(...e){super(...e),this.dense=!1}static{this.shadowRootOptions={...ua.shadowRootOptions,delegatesFocus:!0}}static{this.styles=[ci`
116
+ `,zr=class{constructor(e){this.dense=!0;let t=Rr;e&&(t+=`
117
+ `+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}setDense(e){this.dense=e}createViewer(e,t,n){let r=document.createElement(`div`),i=document.createElement(`label`);i.textContent=`${e}:`,n.description&&i.setAttribute(`title`,n.description.value),r.appendChild(i);let a=t.value,o=null;if(t instanceof j){let e=n.config.store.getQuads(a,null,null,null);if(e.length){let t=Bt(e,n.config.languages);t&&(a=t)}}else t instanceof M&&(t.language?(o=document.createElement(`span`),o.classList.add(`lang`),o.innerText=`@${t.language}`):t.datatype.value===`http://www.w3.org/2001/XMLSchema#date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`http://www.w3.org/2001/XMLSchema#dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let s;return Jt(t.value)?(s=document.createElement(`a`),s.setAttribute(`href`,t.value)):s=document.createElement(`div`),s.classList.add(`d-flex`),s.innerText=a,o&&s.appendChild(o),r.appendChild(s),r}};function Br(e,t,n){if(n){let n=xr(e)>0;if(e.class&&!e.hasValue)return e.config.theme.createListEditor(e.label,t,n,qt(e.class,e),e);if(e.in){let r=e.config.lists[e.in];if(r?.length){let i=Vt(r,e.config.store,e.config.languages);return e.config.theme.createListEditor(e.label,t,n,i,e)}else console.error(`list not found:`,e.in,`existing lists:`,e.config.lists)}if(e.datatype?.equals(vt)||e.languageIn?.length||e.datatype===void 0&&t instanceof M&&t.language)return e.config.theme.createLangStringEditor(e.label,t,n,e);switch(e.datatype?.value.replace(st,``)){case`integer`:case`float`:case`double`:case`decimal`:return e.config.theme.createNumberEditor(e.label,t,n,e);case`date`:case`dateTime`:return e.config.theme.createDateEditor(e.label,t,n,e);case`boolean`:return e.config.theme.createBooleanEditor(e.label,t,n,e);case`base64Binary`:return e.config.theme.createFileEditor(e.label,t,n,e)}return e.config.theme.createTextEditor(e.label,t,n,e)}else return t?e.config.theme.createViewer(e.label,t,e):document.createElement(`div`)}function Vr(e,t){e.rdfTerm=t??void 0,e.rdfTermState=t?Jr(e):void 0}function Hr(e,t){e.rdfTerms=new Map;for(let n of t)e.rdfTerms.set(Ur(n),n)}function Ur(e){return I(e)}function Wr(e){let t=e.rdfTerms?.get(e.value);if(t)return t;if(!(!e.rdfTerm||!Yr(e.rdfTermState,Jr(e))))return e.rdfTerm}function Gr(e){let t=Wr(e);if(t)return t;let n=e.shaclDatatype,r=e.dataset.value||e.value;if((e.type===`file`||e.getAttribute(`type`)===`file`)&&e.binaryData)r=e.binaryData;else if(e.type===`checkbox`||e.getAttribute(`type`)===`checkbox`)return e.checked||parseInt(e.dataset.minCount||`0`)>0?k.literal(e.checked?`true`:`false`,n):void 0;if(!r)return;let i=e.dataset.nodeKind,a=Kr(r);if(e.dataset.link)return k.fromTerm(JSON.parse(e.dataset.link));if(e.dataset.class)return a instanceof j||a instanceof N?a:k.namedNode(r);if(i===`http://www.w3.org/ns/shacl#IRI`)return a instanceof j?a:k.namedNode(r);if(i===`http://www.w3.org/ns/shacl#BlankNode`)return a instanceof N?a:k.blankNode(r);if(i===`http://www.w3.org/ns/shacl#BlankNodeOrIRI`)return a instanceof j||a instanceof N?a:k.namedNode(r);if(a instanceof j||a instanceof N||a instanceof M&&!e.dataset.lang&&(!n||n instanceof j&&Mt.equals(n)))return a;if(e.dataset.lang)n=e.dataset.lang;else if(n instanceof j&&It.has(n.value)){let e=qr(r,n.value);if(e===void 0)return;r=e}else e.type===`number`?r=parseFloat(r):e.type===`datetime-local`?r=an(r,e.dataset.xsdTemporalSuffix):e.type===`date`&&n instanceof j&&n.value===`http://www.w3.org/2001/XMLSchema#date`&&(r=rn(r,e.dataset.xsdTemporalSuffix));return k.literal(r,n)}function Kr(e){let t=e;if(e.startsWith(`<`)&&e.endsWith(`>`))t=e.slice(1,-1);else if(!e.startsWith(`_:`)&&!e.startsWith(`"`))return;let n=F(t,k);return n instanceof j||n instanceof N||n instanceof M?n:void 0}function qr(e,t){let n=e.replace(`,`,`.`);return(t===`http://www.w3.org/2001/XMLSchema#decimal`?/^[-+]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)$/:/^[-+]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][-+]?[0-9]+)?$/).test(n)?n:void 0}function Jr(e){return{value:e.value,language:e.dataset.lang,checked:e.checked,binaryData:e.binaryData}}function Yr(e,t){return e?.value===t.value&&e.language===t.language&&e.checked===t.checked&&e.binaryData===t.binaryData}function Xr(e,t,n){if(t===`application/ld+json`)return Zr(e);{let r=new Se({format:t,prefixes:n});r.addQuads(e);let i=``;return r.end((e,t)=>{e&&console.error(e),i=t}),i}}function Zr(e){let t=[];for(let n of e){let e={"@id":n.subject.id};if(n.predicate.equals(mt))e[`@type`]=n.object.id;else{let t=n.object.value;n.object instanceof M?n.object.language?t={"@language":n.object.language,"@value":n.object.value}:n.object.datatype&&n.object.datatype.value!==`http://www.w3.org/2001/XMLSchema##string`&&(t={"@type":n.object.datatype.value,"@value":n.object.value}):t={"@id":n.object.id},e[n.predicate.value]=t}t.push(e)}return JSON.stringify(t)}var Qr={};function $r(e){e.predicate===void 0&&e.datatype===void 0?console.warn(`not registering plugin because it does neither define "predicate" nor "datatype"`,e):Qr[`${e.predicate}^${e.datatype}`]=e}function ei(){return Object.entries(Qr).map(e=>e[1])}function ti(e,t){let n=Qr[`${e}^${t}`];return n||(n=Qr[`${e}^undefined`],n)?n:Qr[`undefined^${t}`]}var ni=class{constructor(e,t){this.predicate=e.predicate,this.datatype=e.datatype,t&&(this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t))}createViewer(e,t){return e.config.theme.createViewer(e.label,t,e)}},ri=globalThis,ii=ri.ShadowRoot&&(ri.ShadyCSS===void 0||ri.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,ai=Symbol(),oi=new WeakMap,si=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ai)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ii&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=oi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&oi.set(t,e))}return e}toString(){return this.cssText}},ci=e=>new si(typeof e==`string`?e:e+``,void 0,ai),li=(e,...t)=>new si(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,ai),ui=(e,t)=>{if(ii)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=ri.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},di=ii?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return ci(t)})(e):e,{is:fi,defineProperty:pi,getOwnPropertyDescriptor:mi,getOwnPropertyNames:hi,getOwnPropertySymbols:gi,getPrototypeOf:_i}=Object,vi=globalThis,yi=vi.trustedTypes,bi=yi?yi.emptyScript:``,xi=vi.reactiveElementPolyfillSupport,Si=(e,t)=>e,Ci={toAttribute(e,t){switch(t){case Boolean:e=e?bi:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},wi=(e,t)=>!fi(e,t),Ti={attribute:!0,type:String,converter:Ci,reflect:!1,useDefault:!1,hasChanged:wi};Symbol.metadata??=Symbol(`metadata`),vi.litPropertyMetadata??=new WeakMap;var Ei=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ti){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&pi(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=mi(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ti}static _$Ei(){if(this.hasOwnProperty(Si(`elementProperties`)))return;let e=_i(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Si(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Si(`properties`))){let e=this.properties,t=[...hi(e),...gi(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(di(e))}else e!==void 0&&t.push(di(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ui(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?Ci:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?Ci:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??wi)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};Ei.elementStyles=[],Ei.shadowRootOptions={mode:`open`},Ei[Si(`elementProperties`)]=new Map,Ei[Si(`finalized`)]=new Map,xi?.({ReactiveElement:Ei}),(vi.reactiveElementVersions??=[]).push(`2.1.2`);var Di=globalThis,Oi=e=>e,ki=Di.trustedTypes,Ai=ki?ki.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,ji=`$lit$`,Mi=`lit$${Math.random().toFixed(9).slice(2)}$`,Ni=`?`+Mi,Pi=`<${Ni}>`,Fi=document,Ii=()=>Fi.createComment(``),Li=e=>e===null||typeof e!=`object`&&typeof e!=`function`,Ri=Array.isArray,zi=e=>Ri(e)||typeof e?.[Symbol.iterator]==`function`,Bi=`[
118
+ \f\r]`,Vi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hi=/-->/g,Ui=/>/g,Wi=RegExp(`>|${Bi}(?:([^\\s"'>=/]+)(${Bi}*=${Bi}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),Gi=/'/g,Ki=/"/g,qi=/^(?:script|style|textarea|title)$/i,Y=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),Ji=Symbol.for(`lit-noChange`),X=Symbol.for(`lit-nothing`),Yi=new WeakMap,Xi=Fi.createTreeWalker(Fi,129);function Zi(e,t){if(!Ri(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return Ai===void 0?t:Ai.createHTML(t)}var Qi=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=Vi;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===Vi?c[1]===`!--`?o=Hi:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=Wi):(qi.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=Wi):o=Ui:o===Wi?c[0]===`>`?(o=i??Vi,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?Wi:c[3]===`"`?Ki:Gi):o===Ki||o===Gi?o=Wi:o===Hi||o===Ui?o=Vi:(o=Wi,i=void 0);let d=o===Wi&&e[t+1].startsWith(`/>`)?` `:``;a+=o===Vi?n+Pi:l>=0?(r.push(s),n.slice(0,l)+ji+n.slice(l)+Mi+d):n+Mi+(l===-2?t:d)}return[Zi(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},$i=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=Qi(t,n);if(this.el=e.createElement(l,r),Xi.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=Xi.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(ji)){let t=u[o++],n=i.getAttribute(e).split(Mi),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?ia:r[1]===`?`?aa:r[1]===`@`?oa:ra}),i.removeAttribute(e)}else e.startsWith(Mi)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(qi.test(i.tagName)){let e=i.textContent.split(Mi),t=e.length-1;if(t>0){i.textContent=ki?ki.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],Ii()),Xi.nextNode(),c.push({type:2,index:++a});i.append(e[t],Ii())}}}else if(i.nodeType===8)if(i.data===Ni)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(Mi,e+1))!==-1;)c.push({type:7,index:a}),e+=Mi.length-1}a++}}static createElement(e,t){let n=Fi.createElement(`template`);return n.innerHTML=e,n}};function ea(e,t,n=e,r){if(t===Ji)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=Li(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=ea(e,i._$AS(e,t.values),i,r)),t}var ta=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??Fi).importNode(t,!0);Xi.currentNode=r;let i=Xi.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new na(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new sa(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=Xi.nextNode(),a++)}return Xi.currentNode=Fi,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},na=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=ea(this,e,t),Li(e)?e===X||e==null||e===``?(this._$AH!==X&&this._$AR(),this._$AH=X):e!==this._$AH&&e!==Ji&&this._(e):e._$litType$===void 0?e.nodeType===void 0?zi(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==X&&Li(this._$AH)?this._$AA.nextSibling.data=e:this.T(Fi.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=$i.createElement(Zi(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new ta(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Yi.get(e.strings);return t===void 0&&Yi.set(e.strings,t=new $i(e)),t}k(t){Ri(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(Ii()),this.O(Ii()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=Oi(e).nextSibling;Oi(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ra=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=X,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=X}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=ea(this,e,t,0),a=!Li(e)||e!==this._$AH&&e!==Ji,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=ea(this,r[n+o],t,o),s===Ji&&(s=this._$AH[o]),a||=!Li(s)||s!==this._$AH[o],s===X?e=X:e!==X&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},ia=class extends ra{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===X?void 0:e}},aa=class extends ra{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==X)}},oa=class extends ra{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=ea(this,e,t,0)??X)===Ji)return;let n=this._$AH,r=e===X&&n!==X||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==X&&(n===X||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},sa=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){ea(this,e)}},ca=Di.litHtmlPolyfillSupport;ca?.($i,na),(Di.litHtmlVersions??=[]).push(`3.3.2`);var la=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new na(t.insertBefore(Ii(),e),e,void 0,n??{})}return i._$AI(e),i},ua=globalThis,da=class extends Ei{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=la(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ji}};da._$litElement$=!0,da.finalized=!0,ua.litElementHydrateSupport?.({LitElement:da});var fa=ua.litElementPolyfillSupport;fa?.({LitElement:da}),(ua.litElementVersions??=[]).push(`4.2.2`);var pa=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},ma={attribute:!0,type:String,converter:Ci,reflect:!1,hasChanged:wi},ha=(e=ma,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function Z(e){return(t,n)=>typeof n==`object`?ha(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function ga(e){return Z({...e,state:!0,attribute:!1})}var _a=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`object`&&Object.defineProperty(e,t,n),n);function va(e,t){return(n,r,i)=>{let a=t=>t.renderRoot?.querySelector(e)??null;if(t){let{get:e,set:t}=typeof r==`object`?n:i??(()=>{let e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return _a(n,r,{get(){let n=e.call(this);return n===void 0&&(n=a(this),(n!==null||this.hasUpdated)&&t.call(this,n)),n}})}return _a(n,r,{get(){return a(this)}})}}function Q(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var ya=class extends da{constructor(...e){super(...e),this.dense=!1}static{this.shadowRootOptions={...da.shadowRootOptions,delegatesFocus:!0}}static{this.styles=[li`
119
119
  :host {
120
120
  --rokit-primary-color-inner: var(--rokit-primary-color, #008877);
121
121
  --rokit-primary-color-transparent-inner: color-mix(in srgb, var(--rokit-primary-color-inner) 40%, transparent);
@@ -146,11 +146,11 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
146
146
  0% { transform: rotate(0deg); }
147
147
  100% { transform: rotate(360deg); }
148
148
  }
149
- `]}};Q([Z({type:Boolean,reflect:!0})],va.prototype,`dense`,void 0);var ya=class extends va{static{this.formAssociated=!0}static{this.styles=[...va.styles,ci`
149
+ `]}};Q([Z({type:Boolean,reflect:!0})],ya.prototype,`dense`,void 0);var ba=class extends ya{static{this.formAssociated=!0}static{this.styles=[...ya.styles,li`
150
150
  :host { align-items: center; padding: 6px 8px; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); box-sizing: border-box; }
151
151
  :host(:focus) { border-color: var(--rokit-primary-color-inner); }
152
152
  :host(.invalid) { border-color: var(--rokit-error-color-inner); }
153
- `]}#e;#t;#n;#r;#i;#a;constructor(){super(),this.value=``,this.clearable=!1,this.required=!1,this.disabled=!1,this.#r={},this.#e=this.attachInternals()}checkValidity(){return this.#e.checkValidity()}reportValidity(){let e=this.#e.reportValidity();return this.classList.toggle(`invalid`,!e),e}get validity(){return this.#e.validity}get validationMessage(){return this.#e.validationMessage}setCustomValidity(e,t){this.#t=e||void 0,this.#n=e?t:void 0,this.#o()}updateValidity(e,t,n){this.#r=e?{badInput:e.badInput,customError:e.customError,patternMismatch:e.patternMismatch,rangeOverflow:e.rangeOverflow,rangeUnderflow:e.rangeUnderflow,stepMismatch:e.stepMismatch,tooLong:e.tooLong,tooShort:e.tooShort,typeMismatch:e.typeMismatch,valueMissing:e.valueMissing}:{},this.#i=t,this.#a=n,this.#o()}#o(){let e=this.#t!==void 0;this.#e.setValidity(e?{...this.#r,customError:!0}:this.#r,e?this.#t:this.#i,e?this.#n??this.#a:this.#a),this.classList.toggle(`invalid`,!this.#e.validity.valid)}setFormValue(e,t){this.#e.setFormValue(e,t)}};Q([Z()],ya.prototype,`name`,void 0),Q([Z()],ya.prototype,`value`,void 0),Q([Z({type:Boolean})],ya.prototype,`clearable`,void 0),Q([Z({type:Boolean,reflect:!0})],ya.prototype,`required`,void 0),Q([Z({type:Boolean,reflect:!0})],ya.prototype,`disabled`,void 0),Q([Z()],ya.prototype,`label`,void 0),Q([Z()],ya.prototype,`placeholder`,void 0);function ba(e){let t=e.trim();if(t.endsWith(`ms`)){let e=Number(t.slice(0,-2));return Number.isFinite(e)?e:0}if(t.endsWith(`s`)){let e=Number(t.slice(0,-1));return Number.isFinite(e)?e*1e3:0}return 0}var xa=class extends va{static{this.styles=[...va.styles,ci`
153
+ `]}#e;#t;#n;#r;#i;#a;constructor(){super(),this.value=``,this.clearable=!1,this.required=!1,this.disabled=!1,this.#r={},this.#e=this.attachInternals()}checkValidity(){return this.#e.checkValidity()}reportValidity(){let e=this.#e.reportValidity();return this.classList.toggle(`invalid`,!e),e}get validity(){return this.#e.validity}get validationMessage(){return this.#e.validationMessage}setCustomValidity(e,t){this.#t=e||void 0,this.#n=e?t:void 0,this.#o()}updateValidity(e,t,n){this.#r=e?{badInput:e.badInput,customError:e.customError,patternMismatch:e.patternMismatch,rangeOverflow:e.rangeOverflow,rangeUnderflow:e.rangeUnderflow,stepMismatch:e.stepMismatch,tooLong:e.tooLong,tooShort:e.tooShort,typeMismatch:e.typeMismatch,valueMissing:e.valueMissing}:{},this.#i=t,this.#a=n,this.#o()}#o(){let e=this.#t!==void 0;this.#e.setValidity(e?{...this.#r,customError:!0}:this.#r,e?this.#t:this.#i,e?this.#n??this.#a:this.#a),this.classList.toggle(`invalid`,!this.#e.validity.valid)}setFormValue(e,t){this.#e.setFormValue(e,t)}};Q([Z()],ba.prototype,`name`,void 0),Q([Z()],ba.prototype,`value`,void 0),Q([Z({type:Boolean})],ba.prototype,`clearable`,void 0),Q([Z({type:Boolean,reflect:!0})],ba.prototype,`required`,void 0),Q([Z({type:Boolean,reflect:!0})],ba.prototype,`disabled`,void 0),Q([Z()],ba.prototype,`label`,void 0),Q([Z()],ba.prototype,`placeholder`,void 0);function xa(e){let t=e.trim();if(t.endsWith(`ms`)){let e=Number(t.slice(0,-2));return Number.isFinite(e)?e:0}if(t.endsWith(`s`)){let e=Number(t.slice(0,-1));return Number.isFinite(e)?e*1e3:0}return 0}var Sa=class extends ya{static{this.styles=[...ya.styles,li`
154
154
  :host { display: inline-flex; align-items: center; }
155
155
  :host([disabled]) { pointer-events: none; opacity: 0.5; }
156
156
  :host([rounded]) .button { border-radius: 200px; }
@@ -243,7 +243,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
243
243
  aria-disabled="${this.disabled?`true`:`false`}"
244
244
  tabindex="${this.disabled?`-1`:`0`}"
245
245
  @click="${e=>{this.disabled&&(e.preventDefault(),e.stopPropagation())}}"
246
- >${this.renderContent()}</a>`:Y`<button part="button loader" class="button" type="button" ?disabled="${this.disabled}" @click="${e=>{this.disabled&&(e.preventDefault(),e.stopPropagation())}}">${this.renderContent()}</button>`}};Q([Z({type:Boolean,reflect:!0})],xa.prototype,`icon`,void 0),Q([Z({type:Boolean,reflect:!0})],xa.prototype,`disabled`,void 0),Q([Z()],xa.prototype,`href`,void 0),xa=Q([fa(`rokit-button`)],xa);var Sa=class extends va{constructor(...e){super(...e),this.open=!1,this.disabled=!1,this.headerInactive=!1,this.transitioning=!1,this.closedBeforeTransition=!1,this.#t=new MutationObserver(()=>this.updateContentHeight()),this.#n=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.updateContentHeight()}),this.onMouseDown=(()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}).bind(this),this.onClickToggles=(()=>{this.toggle(this.closedBeforeTransition,!0)}).bind(this),this.onClickOpens=(()=>{this.toggle(!0,!0)}).bind(this),this.onHeaderKeyDown=(e=>{if(!this.disabled&&(e.key===` `||e.key===`Enter`)){if(e.composedPath().some(e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return;e.preventDefault(),this.headerInactive?this.toggle(!0,!0):this.toggle(!this.open,!0)}}).bind(this),this.onToggleClick=(e=>{e.stopPropagation(),this.toggle(!this.open,!0)}).bind(this)}static{this.styles=[...va.styles,ci`
246
+ >${this.renderContent()}</a>`:Y`<button part="button loader" class="button" type="button" ?disabled="${this.disabled}" @click="${e=>{this.disabled&&(e.preventDefault(),e.stopPropagation())}}">${this.renderContent()}</button>`}};Q([Z({type:Boolean,reflect:!0})],Sa.prototype,`icon`,void 0),Q([Z({type:Boolean,reflect:!0})],Sa.prototype,`disabled`,void 0),Q([Z()],Sa.prototype,`href`,void 0),Sa=Q([pa(`rokit-button`)],Sa);var Ca=class extends ya{constructor(...e){super(...e),this.open=!1,this.disabled=!1,this.headerInactive=!1,this.transitioning=!1,this.closedBeforeTransition=!1,this.#t=new MutationObserver(()=>this.updateContentHeight()),this.#n=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.updateContentHeight()}),this.onMouseDown=(()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}).bind(this),this.onClickToggles=(()=>{this.toggle(this.closedBeforeTransition,!0)}).bind(this),this.onClickOpens=(()=>{this.toggle(!0,!0)}).bind(this),this.onHeaderKeyDown=(e=>{if(!this.disabled&&(e.key===` `||e.key===`Enter`)){if(e.composedPath().some(e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return;e.preventDefault(),this.headerInactive?this.toggle(!0,!0):this.toggle(!this.open,!0)}}).bind(this),this.onToggleClick=(e=>{e.stopPropagation(),this.toggle(!this.open,!0)}).bind(this)}static{this.styles=[...ya.styles,li`
247
247
  :host { display: flex; flex-direction: column; align-items: stretch; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); }
248
248
  :host header { cursor: pointer; }
249
249
  :host([dense]) header { padding: 2px 4px; }
@@ -255,7 +255,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
255
255
  .label { flex-grow: 1; overflow: hidden; }
256
256
  #content { display: flex; transition: max-height var(--rokit-transition-duration-inner) ease-in-out; position: relative; scrollbar-width: thin; }
257
257
  #toggle { margin-left: 3px; }
258
- `]}#e;#t;#n;firstUpdated(){this.transitionDuration=ba(getComputedStyle(this).getPropertyValue(`--rokit-transition-duration-inner`)),this.#n.observe(this),this.#i(),this.#a()}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.#n.disconnect(),this.#r(),this.#e!==void 0&&clearTimeout(this.#e)}updated(e){e.has(`transitioning`)&&this.classList.toggle(`transitioning`,this.transitioning),(e.has(`disabled`)||e.has(`headerInactive`))&&(this.toggleButton.disabled=this.disabled,this.#i()),(e.has(`disabled`)||e.has(`headerInactive`)||e.has(`open`))&&this.#a(),e.has(`open`)&&!this.transitioning&&!this.disabled&&this.toggle(this.open)}#r(){this.header.removeEventListener(`mousedown`,this.onMouseDown),this.header.removeEventListener(`click`,this.onClickToggles),this.header.removeEventListener(`click`,this.onClickOpens),this.header.removeEventListener(`keydown`,this.onHeaderKeyDown),this.toggleButton.removeEventListener(`mousedown`,this.onMouseDown),this.toggleButton.removeEventListener(`click`,this.onToggleClick)}#i(){this.#r(),!this.disabled&&(this.toggleButton.addEventListener(`mousedown`,this.onMouseDown),this.toggleButton.addEventListener(`click`,this.onToggleClick),this.headerInactive?(this.header.addEventListener(`click`,this.onClickOpens),this.header.addEventListener(`keydown`,this.onHeaderKeyDown)):(this.header.addEventListener(`mousedown`,this.onMouseDown),this.header.addEventListener(`click`,this.onClickToggles),this.header.addEventListener(`keydown`,this.onHeaderKeyDown)))}#a(){this.header.tabIndex=this.disabled?-1:0,this.header.setAttribute(`role`,(this.headerInactive,`button`)),this.header.setAttribute(`aria-disabled`,String(this.disabled)),this.header.setAttribute(`aria-expanded`,String(this.open)),this.header.setAttribute(`aria-controls`,`content`)}updateContentHeight(){setTimeout(()=>{this.content.style.maxHeight=(this.maxHeight===void 0?this.content.scrollHeight:Math.min(this.maxHeight,this.content.scrollHeight))+`px`,this.classList.toggle(`has-content`,this.content.style.maxHeight!==`0px`)})}onSlotChange(){let e=this.shadowRoot.querySelector(`#content > slot`).assignedElements({flatten:!0});this.#t.disconnect();for(let t of e)this.#t.observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0});this.updateContentHeight()}toggle(e=!this.open,t=!1){this.disabled||(this.transitioning=this.open!==e,this.open=e,this.toggleButton.classList.toggle(`down`,e),this.#e!==void 0&&clearTimeout(this.#e),this.#e=window.setTimeout(()=>{this.transitioning=!1,this.open&&t&&this.content.scrollIntoView({block:`nearest`})},this.transitionDuration))}render(){return Y`
258
+ `]}#e;#t;#n;firstUpdated(){this.transitionDuration=xa(getComputedStyle(this).getPropertyValue(`--rokit-transition-duration-inner`)),this.#n.observe(this),this.#i(),this.#a()}disconnectedCallback(){super.disconnectedCallback(),this.#t.disconnect(),this.#n.disconnect(),this.#r(),this.#e!==void 0&&clearTimeout(this.#e)}updated(e){e.has(`transitioning`)&&this.classList.toggle(`transitioning`,this.transitioning),(e.has(`disabled`)||e.has(`headerInactive`))&&(this.toggleButton.disabled=this.disabled,this.#i()),(e.has(`disabled`)||e.has(`headerInactive`)||e.has(`open`))&&this.#a(),e.has(`open`)&&!this.transitioning&&!this.disabled&&this.toggle(this.open)}#r(){this.header.removeEventListener(`mousedown`,this.onMouseDown),this.header.removeEventListener(`click`,this.onClickToggles),this.header.removeEventListener(`click`,this.onClickOpens),this.header.removeEventListener(`keydown`,this.onHeaderKeyDown),this.toggleButton.removeEventListener(`mousedown`,this.onMouseDown),this.toggleButton.removeEventListener(`click`,this.onToggleClick)}#i(){this.#r(),!this.disabled&&(this.toggleButton.addEventListener(`mousedown`,this.onMouseDown),this.toggleButton.addEventListener(`click`,this.onToggleClick),this.headerInactive?(this.header.addEventListener(`click`,this.onClickOpens),this.header.addEventListener(`keydown`,this.onHeaderKeyDown)):(this.header.addEventListener(`mousedown`,this.onMouseDown),this.header.addEventListener(`click`,this.onClickToggles),this.header.addEventListener(`keydown`,this.onHeaderKeyDown)))}#a(){this.header.tabIndex=this.disabled?-1:0,this.header.setAttribute(`role`,(this.headerInactive,`button`)),this.header.setAttribute(`aria-disabled`,String(this.disabled)),this.header.setAttribute(`aria-expanded`,String(this.open)),this.header.setAttribute(`aria-controls`,`content`)}updateContentHeight(){setTimeout(()=>{this.content.style.maxHeight=(this.maxHeight===void 0?this.content.scrollHeight:Math.min(this.maxHeight,this.content.scrollHeight))+`px`,this.classList.toggle(`has-content`,this.content.style.maxHeight!==`0px`)})}onSlotChange(){let e=this.shadowRoot.querySelector(`#content > slot`).assignedElements({flatten:!0});this.#t.disconnect();for(let t of e)this.#t.observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0});this.updateContentHeight()}toggle(e=!this.open,t=!1){this.disabled||(this.transitioning=this.open!==e,this.open=e,this.toggleButton.classList.toggle(`down`,e),this.#e!==void 0&&clearTimeout(this.#e),this.#e=window.setTimeout(()=>{this.transitioning=!1,this.open&&t&&this.content.scrollIntoView({block:`nearest`})},this.transitionDuration))}render(){return Y`
259
259
  <header part="header">
260
260
  <slot name="prefix" part="prefix"></slot>
261
261
  <span class="label"><slot name="label" part="label">${this.label}</slot></span>
@@ -266,7 +266,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
266
266
  <div id="content" part="content" ?hidden="${!this.open&&!this.transitioning}">
267
267
  <slot @slotchange=${this.onSlotChange}></slot>
268
268
  </div>
269
- `}};Q([Z({type:Boolean,reflect:!0})],Sa.prototype,`open`,void 0),Q([Z()],Sa.prototype,`label`,void 0),Q([Z({reflect:!0})],Sa.prototype,`maxHeight`,void 0),Q([Z({type:Boolean})],Sa.prototype,`disabled`,void 0),Q([Z({type:Boolean})],Sa.prototype,`headerInactive`,void 0),Q([_a(`#content`)],Sa.prototype,`content`,void 0),Q([_a(`#toggle`)],Sa.prototype,`toggleButton`,void 0),Q([_a(`header`)],Sa.prototype,`header`,void 0),Q([ha()],Sa.prototype,`transitioning`,void 0),Sa=Q([fa(`rokit-collapsible`)],Sa);var $=class extends ya{static{this.styles=[...ya.styles,ci`
269
+ `}};Q([Z({type:Boolean,reflect:!0})],Ca.prototype,`open`,void 0),Q([Z()],Ca.prototype,`label`,void 0),Q([Z({reflect:!0})],Ca.prototype,`maxHeight`,void 0),Q([Z({type:Boolean})],Ca.prototype,`disabled`,void 0),Q([Z({type:Boolean})],Ca.prototype,`headerInactive`,void 0),Q([va(`#content`)],Ca.prototype,`content`,void 0),Q([va(`#toggle`)],Ca.prototype,`toggleButton`,void 0),Q([va(`header`)],Ca.prototype,`header`,void 0),Q([ga()],Ca.prototype,`transitioning`,void 0),Ca=Q([pa(`rokit-collapsible`)],Ca);var $=class extends ba{static{this.styles=[...ba.styles,li`
270
270
  :host { background-color: var(--rokit-light-background-color-inner); user-select: none; flex-wrap: wrap; }
271
271
  :host([dense]) { padding: 2px 4px; }
272
272
  :host(.has-focus:not([readonly])) label, :host(.has-value) label, :host([sticky]) label { font-size: 0.75em; top: 0.5em; font-weight: 600; }
@@ -294,7 +294,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
294
294
  <div class="supporting-text" part="supportingText">
295
295
  <slot name="supportingText">${this.supportingText}</slot>
296
296
  </div>
297
- `}};Q([Z()],$.prototype,`type`,void 0),Q([Z({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),Q([Z({type:Boolean,reflect:!0})],$.prototype,`sticky`,void 0),Q([Z()],$.prototype,`pattern`,void 0),Q([Z()],$.prototype,`minLength`,void 0),Q([Z()],$.prototype,`maxLength`,void 0),Q([Z()],$.prototype,`min`,void 0),Q([Z()],$.prototype,`max`,void 0),Q([Z()],$.prototype,`step`,void 0),Q([Z()],$.prototype,`minWidth`,void 0),Q([Z({type:Boolean})],$.prototype,`autoGrowLabelWidth`,void 0),Q([Z()],$.prototype,`supportingText`,void 0),Q([_a(`#input`)],$.prototype,`inputElement`,void 0),$=Q([fa(`rokit-input`)],$);var Ca=class extends ya{static{this.styles=[...ya.styles,ci`
297
+ `}};Q([Z()],$.prototype,`type`,void 0),Q([Z({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),Q([Z({type:Boolean,reflect:!0})],$.prototype,`sticky`,void 0),Q([Z()],$.prototype,`pattern`,void 0),Q([Z()],$.prototype,`minLength`,void 0),Q([Z()],$.prototype,`maxLength`,void 0),Q([Z()],$.prototype,`min`,void 0),Q([Z()],$.prototype,`max`,void 0),Q([Z()],$.prototype,`step`,void 0),Q([Z()],$.prototype,`minWidth`,void 0),Q([Z({type:Boolean})],$.prototype,`autoGrowLabelWidth`,void 0),Q([Z()],$.prototype,`supportingText`,void 0),Q([va(`#input`)],$.prototype,`inputElement`,void 0),$=Q([pa(`rokit-input`)],$);var wa=class extends ba{static{this.styles=[...ba.styles,li`
298
298
  :host {
299
299
  background-color: var(--rokit-light-background-color-inner);
300
300
  user-select: none;
@@ -347,7 +347,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
347
347
  :host([collapse]) li > div > div { padding-left: 1.8em; }
348
348
  :host([collapse]) ul:not(.open) { display: none; }
349
349
  :host([collapse]) li:not(.open) > div > .toggle-node::part(caret-icon) { transform: translate(0, 0) rotate(-45deg); }
350
- `]}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f(e){return this.clearable&&e.composedPath().some(e=>e instanceof xa&&e.classList.contains(`clear`))}#p;#m;#h;#g;#_;#v;#y(){let e=this.collapsible?.content;if(e){if(this.fixedOpen)this.collapsible.maxHeight=void 0,e.style.removeProperty(`width`),e.style.removeProperty(`left`),e.style.removeProperty(`right`);else{let t=this.collapsibleMaxHeight??getComputedStyle(this).getPropertyValue(`--rokit-list-max-height-inner`),n=parseInt(t);this.collapsible.maxHeight=Number.isNaN(n)?void 0:n,e.style.width=this.collapsibleWidth,e.style.left=this.collapsibleOrientationLeft,e.style.right=this.collapsibleOrientationRight}this.collapsible.updateContentHeight()}}constructor(){super(),this.emptyMessage=`Nothing to select`,this.collapsibleOrientationLeft=`0`,this.collapsibleOrientationRight=`0`,this.collapsibleWidth=``,this.autoGrowLabelWidth=!1,this.fixedOpen=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,this.selectedItem=null,this.#e=``,this.#t=``,this.#n=0,this.#r=!1,this.#i=!1,this.#o=()=>{let e=this.collapsible?.content;if(!e?.matches(`:popover-open`))return;let t=this.getBoundingClientRect(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight,i=this.collapsibleWidth||`${t.width}px`;this.style.setProperty(`--rokit-select-overlay-width`,i);let a=e.getBoundingClientRect().width,o=e.offsetWidth-e.clientWidth,s=Math.max(a,this.listContainer.scrollWidth+o),c=n-t.left-14,l=t.right-14,u=s>c&&l>c,d=Math.min(u?l:c,s);this.style.setProperty(`--rokit-select-overlay-width`,`${d}px`);let f=u?t.right-d:t.left;this.style.setProperty(`--rokit-select-overlay-left`,`${f}px`),this.style.setProperty(`--rokit-select-overlay-right`,`auto`);let p=Math.max(0,Math.min(d,t.left-f)),m=Math.max(p,Math.min(d,t.right-f)),h=`polygon(-14px -14px, ${p}px -14px, ${p}px 0, ${m}px 0, ${m}px -14px, calc(100% + 14px) -14px, calc(100% + 14px) calc(100% + 14px), -14px calc(100% + 14px))`,g=`polygon(-14px -14px, calc(100% + 14px) -14px, calc(100% + 14px) calc(100% + 14px), ${m}px calc(100% + 14px), ${m}px 100%, ${p}px 100%, ${p}px calc(100% + 14px), -14px calc(100% + 14px))`,_=this.collapsible.maxHeight??e.scrollHeight,v=Math.min(_,e.scrollHeight),y=Math.max(0,r-t.bottom-1-14),b=Math.max(0,t.top-1-14);y<v&&b>y?(this.style.setProperty(`--rokit-select-overlay-shadow`,`var(--rokit-select-overlay-shadow-above)`),this.style.setProperty(`--rokit-select-overlay-shadow-clip`,g),this.style.setProperty(`--rokit-select-overlay-top`,`auto`),this.style.setProperty(`--rokit-select-overlay-bottom`,`${r-t.top+1}px`),this.style.setProperty(`--rokit-select-overlay-max-height`,`${Math.min(_,b)}px`)):(this.style.setProperty(`--rokit-select-overlay-shadow`,`var(--rokit-select-overlay-shadow-below)`),this.style.setProperty(`--rokit-select-overlay-shadow-clip`,h),this.style.setProperty(`--rokit-select-overlay-top`,`${t.bottom+1}px`),this.style.setProperty(`--rokit-select-overlay-bottom`,`auto`),this.style.setProperty(`--rokit-select-overlay-max-height`,`${Math.min(_,y)}px`))},this.#s=new MutationObserver(()=>this.onSlotChange()),this.#c=()=>{this.#r||this.openList()},this.#l=e=>{let t=e.relatedTarget;t&&(this.contains(t)||this.shadowRoot?.contains(t))||(this.checkInputValue(),this.closeList(!1,!0))},this.#u=()=>{this.#r||this.openList(!1)},this.#d=()=>{queueMicrotask(()=>{let e=this.input?.inputElement,t=e&&this.input.shadowRoot?.activeElement!==e;!this.validity.valid&&this.matches(`:focus-within`)&&t&&(this.input.inputElement.focus(),this.input.reportValidity())})},this.#p=e=>{this.#f(e)&&(this.#r=!0)},this.#m=()=>{this.#r=!0},this.#h=e=>{e.stopPropagation(),this.collapsible.open?this.closeList(!1):this.openList(!1)},this.#g=e=>{if(this.#f(e)){this.input.inputElement.focus(),this.selectItem(null),this.closeList(!1),window.setTimeout(()=>{this.#r=!1});return}!this.collapsible.open&&!this.fixedOpen&&this.openList(!1)},this.#_=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.openList(),this.highlightNextItem();break;case`ArrowUp`:e.preventDefault(),this.openList(),this.highlightPreviousItem(!0);break;case`Enter`:{let t=this.activeItem();if(t){e.preventDefault(),this.selectItem(t,!0,!0);break}let n=this.findItem(this.input.value);n?(e.preventDefault(),this.selectItem(n,!0,!0)):this.checkInputValue();break}case`Escape`:this.collapsible.open&&(e.preventDefault(),this.restoreSelection(),this.closeList(!1));break;case`Tab`:this.checkInputValue(),this.closeList(!1);break}},this.#v=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.highlightNextItem();break;case`ArrowUp`:e.preventDefault(),this.highlightPreviousItem();break;case`Home`:e.preventDefault(),this.highlightFirstItem();break;case`End`:e.preventDefault(),this.highlightLastItem();break;case`Enter`:{e.preventDefault();let t=this.activeItem();t&&this.selectItem(t,!0,!0);break}case`ArrowRight`:if(this.collapse){let t=this.activeItem();t&&(e.preventDefault(),this.toggleNestedList(t,!0))}break;case`ArrowLeft`:if(this.collapse){let t=this.activeItem();t&&(e.preventDefault(),this.toggleNestedList(t,!1))}break;case`Escape`:e.preventDefault(),this.restoreSelection(),this.closeList(!1),this.input.inputElement.focus();break;case`Tab`:this.checkInputValue(),this.closeList(!1);break}},this.addEventListener(`focusin`,this.#c),this.addEventListener(`focusout`,this.#l),this.addEventListener(`input`,this.#u),this.addEventListener(`invalid`,this.#d)}disconnectedCallback(){this.#S(),this.#s.disconnect(),this.input?.removeEventListener(`mousedown`,this.#p,!0),this.input?.removeEventListener(`click`,this.#g,!0),this.collapsible?.toggleButton?.removeEventListener(`mousedown`,this.#m,!0),this.collapsible?.toggleButton?.removeEventListener(`click`,this.#h,!0),this.collapsible?.content?.removeEventListener(`keydown`,this.#v),this.removeEventListener(`focusin`,this.#c),this.removeEventListener(`focusout`,this.#l),this.removeEventListener(`input`,this.#u),this.removeEventListener(`invalid`,this.#d),super.disconnectedCallback()}#b(){let e=this.collapsible?.content;e&&(this.fixedOpen?(this.#S(),e.removeAttribute(`popover`),this.listContainer.hidden=!1):(e.setAttribute(`popover`,`manual`),e.matches(`:popover-open`)||(this.listContainer.hidden=!0)))}#x(){let e=this.collapsible.content;this.fixedOpen||!this.isConnected||!e.hasAttribute(`popover`)||(this.#a!==void 0&&(window.clearTimeout(this.#a),this.#a=void 0),this.listContainer.hidden=!1,this.style.setProperty(`--rokit-select-overlay-visibility`,`visible`),e.matches(`:popover-open`)||e.showPopover(),this.#o(),this.#i||=(window.addEventListener(`resize`,this.#o),window.addEventListener(`scroll`,this.#o,!0),!0))}#S(){this.#a!==void 0&&(window.clearTimeout(this.#a),this.#a=void 0);let e=this.collapsible?.content;this.listContainer&&(this.listContainer.hidden=!0),this.style.setProperty(`--rokit-select-overlay-visibility`,`hidden`),e?.matches(`:popover-open`)&&e.hidePopover();for(let e of[`--rokit-select-overlay-top`,`--rokit-select-overlay-right`,`--rokit-select-overlay-bottom`,`--rokit-select-overlay-left`,`--rokit-select-overlay-width`,`--rokit-select-overlay-max-height`,`--rokit-select-overlay-shadow`,`--rokit-select-overlay-shadow-clip`])this.style.removeProperty(e);this.#i&&=(window.removeEventListener(`resize`,this.#o),window.removeEventListener(`scroll`,this.#o,!0),!1)}firstUpdated(){this.#e=this.value,this.#t=getComputedStyle(this).getPropertyValue(`--rokit-list-indent-inner`),this.input.addEventListener(`mousedown`,this.#p,!0),this.input.addEventListener(`click`,this.#g,!0),this.collapsible.updateComplete.then(()=>{this.collapsible.toggleButton.addEventListener(`mousedown`,this.#m,!0),this.collapsible.toggleButton.addEventListener(`click`,this.#h,!0),this.collapsible.content.addEventListener(`keydown`,this.#v),this.#b()}),this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>this.#y()),this.syncInputAccessibilityState()}updated(e){e.has(`value`)&&this.value!==(this.selectedItem?this.itemValue(this.selectedItem):``)&&(this.selectedItem=this.findItem(this.value),this.syncSelectionState(String(e.get(`value`)??``),!1),this.filter(``)),e.has(`disabled`)&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled||this.fixedOpen),(e.has(`required`)||e.has(`disabled`))&&this.syncSelectionState(this.value,!1),e.has(`supportingText`)&&(this.input.supportingText=this.supportingText),e.has(`filterableThreshold`)&&this.applyFilterability(),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?`none`:``),e.has(`fixedOpen`)&&(this.collapsible.open=this.fixedOpen,this.collapsible.disabled=this.fixedOpen,this.#b()),(e.has(`fixedOpen`)||e.has(`collapsibleMaxHeight`)||e.has(`collapsibleWidth`)||e.has(`collapsibleOrientationLeft`)||e.has(`collapsibleOrientationRight`))&&this.#y(),e.has(`label`)&&(this.input.label=this.label),e.has(`placeholder`)&&(this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder),this.syncInputAccessibilityState()}checkInputValue(e=!0){let t=this.input.value.trim();if(t){if(this.selectedItem&&(this.itemText(this.selectedItem)===t||this.itemValue(this.selectedItem)===t))return;let e=this.findItem(t);if(e){this.selectItem(e);return}}e&&(t===``?(this.#e=``,this.selectItem(null,!1)):this.restoreSelection())}filter(e){e=e.toLowerCase();let t=!1,n=[];for(let r of this.listContainer.querySelectorAll(`li`))if(r.id!==`noresult`){let i=e!==``&&this.itemText(r).toLowerCase().indexOf(e)===-1&&(!r.dataset.value||r.dataset.value.toLowerCase().indexOf(e)===-1);if(r.classList.toggle(`hidden`,i),this.collapse){let t=r.querySelector(`:scope > ul`),n=this.fixedOpen&&e===``&&t!==null;r.classList.toggle(`open`,n),t?.classList.toggle(`open`,n)}i||(t=!0,n.push(r))}for(let r of n)for(let n=r.parentElement?.closest(`li`);n;n=n.parentElement?.closest(`li`))n.classList.remove(`hidden`),t=!0,e&&this.collapse&&(n.classList.add(`open`),n.querySelector(`:scope > ul`)?.classList.add(`open`));this.listContainer.querySelector(`#noresult`)?.classList.toggle(`hidden`,t),this.highlightItem(e?n.find(e=>this.isSelectableItem(e))??null:this.selectedItem??null,!1)}selectItem(e,t=!0,n=!1){this.isSelectableItem(e)||(e=null);let r=this.value;this.selectedItem=e,this.value=e?this.itemValue(e):``,this.syncSelectionState(r),this.filter(``),this.highlightItem(e,!1),t&&(this.#e=this.value),n&&(this.#r=!0,this.closeList(!1),window.setTimeout(()=>{this.fixedOpen||(this.collapsible?.toggle(!1),this.syncInputAccessibilityState()),this.#r=!1}))}findItem(e){let t=null;if(e){for(let n of this.listContainer.querySelectorAll(`li`))if(this.isSelectableItem(n)){if(n.dataset.value===e)return n;this.itemText(n)===e&&(t=n)}}return t}highlightItem(e,t=!0){if(this.listContainer.querySelector(`li.active`)?.classList.remove(`active`),e&&this.isSelectableItem(e)&&!e.classList.contains(`hidden`)){if(t&&this.listContainer.focus(),e.classList.add(`active`),this.listContainer.setAttribute(`aria-activedescendant`,e.id),this.collapse)for(let t=e.closest(`ul`);t;t=t.parentElement.closest(`ul`))t.classList.add(`open`),t.closest(`li`)?.classList.add(`open`);this.collapsible.open&&e.scrollIntoView({block:`nearest`});return}this.listContainer.removeAttribute(`aria-activedescendant`)}highlightNextItem(){let e=this.visibleItems(),t=this.activeItem();if(!e.length){this.highlightItem(null);return}if(!t){this.highlightItem(e[0]);return}let n=e.indexOf(t);this.highlightItem(e[Math.min(e.length-1,n+1)]||e[0])}highlightPreviousItem(e=!1){let t=this.visibleItems(),n=this.activeItem();if(!t.length){this.highlightItem(null);return}if(!n){this.highlightItem(e?t[t.length-1]:t[0]);return}let r=t.indexOf(n);this.highlightItem(t[Math.max(0,r-1)]||t[0])}highlightFirstItem(){this.highlightItem(this.visibleItems()[0]||null)}highlightLastItem(){let e=this.visibleItems();this.highlightItem(e[e.length-1]??null)}itemValue(e){return e.dataset.value||this.itemText(e)||``}itemText(e){return e.querySelector(`div > div`)?.textContent?.trim()||``}elementText(e){let t=``;for(let n of e.childNodes)n.nodeType==3&&(t+=n.nodeValue?.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0,this.#n=0;let e=null,t=this.shadowRoot.querySelector(`#list-container-slot`).assignedElements();if(t?.length===1&&(e=Array.prototype.slice.call(t[0].querySelectorAll(`:scope > li`)),this.copyItems(e,this.listContainer),this.#s.disconnect(),this.#s.observe(t[0],{subtree:!0,childList:!0,characterData:!0,attributes:!0})),this.emptyMessage){let t=document.createElement(`li`);t.id=`noresult`,t.setAttribute(`disabled`,``),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),e&&e.length>0&&t.classList.add(`hidden`)}this.value=this.value||this.#e,this.selectItem(this.findItem(this.value)),this.applyFilterability()}copyItems(e,t,n=0){if(this.sort!==void 0){let t=this.sort||`asc`;e=e.sort((e,n)=>t===`desc`?(this.elementText(n)||this.itemValue(n)).localeCompare(this.elementText(e)||this.itemValue(e)):(this.elementText(e)||this.itemValue(e)).localeCompare(this.elementText(n)||this.itemValue(n)))}let r=``;n>0&&(r=`calc(0.3em + ${n}*${this.#t})`);for(let i of e){let e=i.cloneNode();e.replaceChildren(),e.id=i.id||`${this.id||`rokit-select`}-option-${this.#n++}`;let a=document.createElement(`div`);r&&(a.style.paddingLeft=r);let o=document.createElement(`div`);a.appendChild(o);for(let e of i.childNodes)if(e.nodeName!==`UL`){let t=e.cloneNode(!0);t.nodeType===3&&t.nodeValue&&(t.nodeValue=t.nodeValue.trim()),o.appendChild(t)}e.appendChild(a),e.title=e.title||this.itemText(e),e.setAttribute(`role`,i.classList.contains(`divider`)||i.classList.contains(`header`)?`presentation`:`option`),e.setAttribute(`aria-disabled`,String(i.getAttribute(`disabled`)!==null));let s=i.querySelector(`ul`);if(s?.childElementCount){let t=document.createElement(`ul`);if(t.setAttribute(`role`,`group`),e.appendChild(t),this.copyItems(Array.prototype.slice.call(s.children),t,n+1),this.collapse){let t=new xa;t.dense=!0,t.icon=!0,t.classList.add(`toggle-node`,`caret`),t.title=`Toggle nested options`,t.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),t.addEventListener(`click`,t=>{t.stopPropagation(),this.toggleNestedList(e)}),a.prepend(t)}else t.classList.add(`open`)}t.appendChild(e),this.itemCount++}}activeItem(){return this.listContainer.querySelector(`li.active`)}visibleItems(){return Array.from(this.listContainer.querySelectorAll(`ul.open > li:not(.hidden)`)).filter(e=>this.isSelectableItem(e))}isSelectableItem(e){return!!e&&e.id!==`noresult`&&e.getAttribute(`disabled`)===null&&!e.classList.contains(`divider`)&&!e.classList.contains(`header`)}restoreSelection(){let e=this.selectedItem||this.findItem(this.#e);this.selectItem(e,!1)}openList(e=!this.input?.value){this.disabled||this.fixedOpen||(this.collapsible?.toggle(!0),this.collapsible.updateComplete.then(()=>{this.collapsible.open&&this.#x()}),e&&this.highlightItem(this.selectedItem??null,!1),this.syncInputAccessibilityState())}closeList(e=!0,t=!1){this.fixedOpen||(e&&this.checkInputValue(),this.filter(``),t&&this.collapsible.content.matches(`:popover-open`)?(this.collapsible.toggle(!1),this.#a=window.setTimeout(()=>{this.#a=void 0,this.#S()},this.collapsible.transitionDuration)):(this.#S(),this.collapsible?.toggle(!1)),this.syncInputAccessibilityState())}inputShouldBeReadonly(){return this.filterableThreshold<0||this.itemCount<this.filterableThreshold}applyFilterability(){let e=this.inputShouldBeReadonly();this.input.readonly=e,this.collapsible.headerInactive=!e}toggleNestedList(e,t=!e.classList.contains(`open`)){e.classList.toggle(`open`,t),e.querySelector(`:scope > ul`)?.classList.toggle(`open`,t),this.collapsible.updateContentHeight(),this.highlightItem(e,!1)}syncInputAccessibilityState(){this.input?.inputElement&&(this.input.inputElement.setAttribute(`role`,`combobox`),this.input.inputElement.setAttribute(`aria-expanded`,String(this.fixedOpen||this.collapsible?.open)),this.input.inputElement.setAttribute(`aria-controls`,`list-container`),this.input.inputElement.setAttribute(`aria-autocomplete`,this.input.readonly?`none`:`list`),this.listContainer?.setAttribute(`role`,`listbox`))}syncSelectionAccessibilityState(){for(let e of this.listContainer.querySelectorAll(`li[role="option"]`))e.setAttribute(`aria-selected`,String(e===this.selectedItem))}syncSelectionState(e,t=e!==this.value){this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.title||(this.input.title=this.input.value),this.classList.toggle(`has-value`,this.value!==``),this.setFormValue(this.value);let n=!this.disabled&&this.required&&this.value===``,r=n?`Please select a value`:void 0;this.input.setCustomValidity(r),this.input.updateComplete.then(()=>{let e=!this.disabled&&this.required&&this.value===``;this.input.inputElement.setAttribute(`aria-invalid`,String(e)),this.input.setCustomValidity(e?`Please select a value`:void 0,this.input.inputElement)}),n?this.updateValidity({valueMissing:!0},r,this.listContainer):this.updateValidity(),t&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0})),this.syncSelectionAccessibilityState()}render(){return Y`
350
+ `]}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f(e){return this.clearable&&e.composedPath().some(e=>e instanceof Sa&&e.classList.contains(`clear`))}#p;#m;#h;#g;#_;#v;#y(){let e=this.collapsible?.content;if(e){if(this.fixedOpen)this.collapsible.maxHeight=void 0,e.style.removeProperty(`width`),e.style.removeProperty(`left`),e.style.removeProperty(`right`);else{let t=this.collapsibleMaxHeight??getComputedStyle(this).getPropertyValue(`--rokit-list-max-height-inner`),n=parseInt(t);this.collapsible.maxHeight=Number.isNaN(n)?void 0:n,e.style.width=this.collapsibleWidth,e.style.left=this.collapsibleOrientationLeft,e.style.right=this.collapsibleOrientationRight}this.collapsible.updateContentHeight()}}constructor(){super(),this.emptyMessage=`Nothing to select`,this.collapsibleOrientationLeft=`0`,this.collapsibleOrientationRight=`0`,this.collapsibleWidth=``,this.autoGrowLabelWidth=!1,this.fixedOpen=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,this.selectedItem=null,this.#e=``,this.#t=``,this.#n=0,this.#r=!1,this.#i=!1,this.#o=()=>{let e=this.collapsible?.content;if(!e?.matches(`:popover-open`))return;let t=this.getBoundingClientRect(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight,i=this.collapsibleWidth||`${t.width}px`;this.style.setProperty(`--rokit-select-overlay-width`,i);let a=e.getBoundingClientRect().width,o=e.offsetWidth-e.clientWidth,s=Math.max(a,this.listContainer.scrollWidth+o),c=n-t.left-14,l=t.right-14,u=s>c&&l>c,d=Math.min(u?l:c,s);this.style.setProperty(`--rokit-select-overlay-width`,`${d}px`);let f=u?t.right-d:t.left;this.style.setProperty(`--rokit-select-overlay-left`,`${f}px`),this.style.setProperty(`--rokit-select-overlay-right`,`auto`);let p=Math.max(0,Math.min(d,t.left-f)),m=Math.max(p,Math.min(d,t.right-f)),h=`polygon(-14px -14px, ${p}px -14px, ${p}px 0, ${m}px 0, ${m}px -14px, calc(100% + 14px) -14px, calc(100% + 14px) calc(100% + 14px), -14px calc(100% + 14px))`,g=`polygon(-14px -14px, calc(100% + 14px) -14px, calc(100% + 14px) calc(100% + 14px), ${m}px calc(100% + 14px), ${m}px 100%, ${p}px 100%, ${p}px calc(100% + 14px), -14px calc(100% + 14px))`,_=this.collapsible.maxHeight??e.scrollHeight,v=Math.min(_,e.scrollHeight),y=Math.max(0,r-t.bottom-1-14),b=Math.max(0,t.top-1-14);y<v&&b>y?(this.style.setProperty(`--rokit-select-overlay-shadow`,`var(--rokit-select-overlay-shadow-above)`),this.style.setProperty(`--rokit-select-overlay-shadow-clip`,g),this.style.setProperty(`--rokit-select-overlay-top`,`auto`),this.style.setProperty(`--rokit-select-overlay-bottom`,`${r-t.top+1}px`),this.style.setProperty(`--rokit-select-overlay-max-height`,`${Math.min(_,b)}px`)):(this.style.setProperty(`--rokit-select-overlay-shadow`,`var(--rokit-select-overlay-shadow-below)`),this.style.setProperty(`--rokit-select-overlay-shadow-clip`,h),this.style.setProperty(`--rokit-select-overlay-top`,`${t.bottom+1}px`),this.style.setProperty(`--rokit-select-overlay-bottom`,`auto`),this.style.setProperty(`--rokit-select-overlay-max-height`,`${Math.min(_,y)}px`))},this.#s=new MutationObserver(()=>this.onSlotChange()),this.#c=()=>{this.#r||this.openList()},this.#l=e=>{let t=e.relatedTarget;t&&(this.contains(t)||this.shadowRoot?.contains(t))||(this.checkInputValue(),this.closeList(!1,!0))},this.#u=()=>{this.#r||this.openList(!1)},this.#d=()=>{queueMicrotask(()=>{let e=this.input?.inputElement,t=e&&this.input.shadowRoot?.activeElement!==e;!this.validity.valid&&this.matches(`:focus-within`)&&t&&(this.input.inputElement.focus(),this.input.reportValidity())})},this.#p=e=>{this.#f(e)&&(this.#r=!0)},this.#m=()=>{this.#r=!0},this.#h=e=>{e.stopPropagation(),this.collapsible.open?this.closeList(!1):this.openList(!1)},this.#g=e=>{if(this.#f(e)){this.input.inputElement.focus(),this.selectItem(null),this.closeList(!1),window.setTimeout(()=>{this.#r=!1});return}!this.collapsible.open&&!this.fixedOpen&&this.openList(!1)},this.#_=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.openList(),this.highlightNextItem();break;case`ArrowUp`:e.preventDefault(),this.openList(),this.highlightPreviousItem(!0);break;case`Enter`:{let t=this.activeItem();if(t){e.preventDefault(),this.selectItem(t,!0,!0);break}let n=this.findItem(this.input.value);n?(e.preventDefault(),this.selectItem(n,!0,!0)):this.checkInputValue();break}case`Escape`:this.collapsible.open&&(e.preventDefault(),this.restoreSelection(),this.closeList(!1));break;case`Tab`:this.checkInputValue(),this.closeList(!1);break}},this.#v=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.highlightNextItem();break;case`ArrowUp`:e.preventDefault(),this.highlightPreviousItem();break;case`Home`:e.preventDefault(),this.highlightFirstItem();break;case`End`:e.preventDefault(),this.highlightLastItem();break;case`Enter`:{e.preventDefault();let t=this.activeItem();t&&this.selectItem(t,!0,!0);break}case`ArrowRight`:if(this.collapse){let t=this.activeItem();t&&(e.preventDefault(),this.toggleNestedList(t,!0))}break;case`ArrowLeft`:if(this.collapse){let t=this.activeItem();t&&(e.preventDefault(),this.toggleNestedList(t,!1))}break;case`Escape`:e.preventDefault(),this.restoreSelection(),this.closeList(!1),this.input.inputElement.focus();break;case`Tab`:this.checkInputValue(),this.closeList(!1);break}},this.addEventListener(`focusin`,this.#c),this.addEventListener(`focusout`,this.#l),this.addEventListener(`input`,this.#u),this.addEventListener(`invalid`,this.#d)}disconnectedCallback(){this.#S(),this.#s.disconnect(),this.input?.removeEventListener(`mousedown`,this.#p,!0),this.input?.removeEventListener(`click`,this.#g,!0),this.collapsible?.toggleButton?.removeEventListener(`mousedown`,this.#m,!0),this.collapsible?.toggleButton?.removeEventListener(`click`,this.#h,!0),this.collapsible?.content?.removeEventListener(`keydown`,this.#v),this.removeEventListener(`focusin`,this.#c),this.removeEventListener(`focusout`,this.#l),this.removeEventListener(`input`,this.#u),this.removeEventListener(`invalid`,this.#d),super.disconnectedCallback()}#b(){let e=this.collapsible?.content;e&&(this.fixedOpen?(this.#S(),e.removeAttribute(`popover`),this.listContainer.hidden=!1):(e.setAttribute(`popover`,`manual`),e.matches(`:popover-open`)||(this.listContainer.hidden=!0)))}#x(){let e=this.collapsible.content;this.fixedOpen||!this.isConnected||!e.hasAttribute(`popover`)||(this.#a!==void 0&&(window.clearTimeout(this.#a),this.#a=void 0),this.listContainer.hidden=!1,this.style.setProperty(`--rokit-select-overlay-visibility`,`visible`),e.matches(`:popover-open`)||e.showPopover(),this.#o(),this.#i||=(window.addEventListener(`resize`,this.#o),window.addEventListener(`scroll`,this.#o,!0),!0))}#S(){this.#a!==void 0&&(window.clearTimeout(this.#a),this.#a=void 0);let e=this.collapsible?.content;this.listContainer&&(this.listContainer.hidden=!0),this.style.setProperty(`--rokit-select-overlay-visibility`,`hidden`),e?.matches(`:popover-open`)&&e.hidePopover();for(let e of[`--rokit-select-overlay-top`,`--rokit-select-overlay-right`,`--rokit-select-overlay-bottom`,`--rokit-select-overlay-left`,`--rokit-select-overlay-width`,`--rokit-select-overlay-max-height`,`--rokit-select-overlay-shadow`,`--rokit-select-overlay-shadow-clip`])this.style.removeProperty(e);this.#i&&=(window.removeEventListener(`resize`,this.#o),window.removeEventListener(`scroll`,this.#o,!0),!1)}firstUpdated(){this.#e=this.value,this.#t=getComputedStyle(this).getPropertyValue(`--rokit-list-indent-inner`),this.input.addEventListener(`mousedown`,this.#p,!0),this.input.addEventListener(`click`,this.#g,!0),this.collapsible.updateComplete.then(()=>{this.collapsible.toggleButton.addEventListener(`mousedown`,this.#m,!0),this.collapsible.toggleButton.addEventListener(`click`,this.#h,!0),this.collapsible.content.addEventListener(`keydown`,this.#v),this.#b()}),this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>this.#y()),this.syncInputAccessibilityState()}updated(e){e.has(`value`)&&this.value!==(this.selectedItem?this.itemValue(this.selectedItem):``)&&(this.selectedItem=this.findItem(this.value),this.syncSelectionState(String(e.get(`value`)??``),!1),this.filter(``)),e.has(`disabled`)&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled||this.fixedOpen),(e.has(`required`)||e.has(`disabled`))&&this.syncSelectionState(this.value,!1),e.has(`supportingText`)&&(this.input.supportingText=this.supportingText),e.has(`filterableThreshold`)&&this.applyFilterability(),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?`none`:``),e.has(`fixedOpen`)&&(this.collapsible.open=this.fixedOpen,this.collapsible.disabled=this.fixedOpen,this.#b()),(e.has(`fixedOpen`)||e.has(`collapsibleMaxHeight`)||e.has(`collapsibleWidth`)||e.has(`collapsibleOrientationLeft`)||e.has(`collapsibleOrientationRight`))&&this.#y(),e.has(`label`)&&(this.input.label=this.label),e.has(`placeholder`)&&(this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder),this.syncInputAccessibilityState()}checkInputValue(e=!0){let t=this.input.value.trim();if(t){if(this.selectedItem&&(this.itemText(this.selectedItem)===t||this.itemValue(this.selectedItem)===t))return;let e=this.findItem(t);if(e){this.selectItem(e);return}}e&&(t===``?(this.#e=``,this.selectItem(null,!1)):this.restoreSelection())}filter(e){e=e.toLowerCase();let t=!1,n=[];for(let r of this.listContainer.querySelectorAll(`li`))if(r.id!==`noresult`){let i=e!==``&&this.itemText(r).toLowerCase().indexOf(e)===-1&&(!r.dataset.value||r.dataset.value.toLowerCase().indexOf(e)===-1);if(r.classList.toggle(`hidden`,i),this.collapse){let t=r.querySelector(`:scope > ul`),n=this.fixedOpen&&e===``&&t!==null;r.classList.toggle(`open`,n),t?.classList.toggle(`open`,n)}i||(t=!0,n.push(r))}for(let r of n)for(let n=r.parentElement?.closest(`li`);n;n=n.parentElement?.closest(`li`))n.classList.remove(`hidden`),t=!0,e&&this.collapse&&(n.classList.add(`open`),n.querySelector(`:scope > ul`)?.classList.add(`open`));this.listContainer.querySelector(`#noresult`)?.classList.toggle(`hidden`,t),this.highlightItem(e?n.find(e=>this.isSelectableItem(e))??null:this.selectedItem??null,!1)}selectItem(e,t=!0,n=!1){this.isSelectableItem(e)||(e=null);let r=this.value;this.selectedItem=e,this.value=e?this.itemValue(e):``,this.syncSelectionState(r),this.filter(``),this.highlightItem(e,!1),t&&(this.#e=this.value),n&&(this.#r=!0,this.closeList(!1),window.setTimeout(()=>{this.fixedOpen||(this.collapsible?.toggle(!1),this.syncInputAccessibilityState()),this.#r=!1}))}findItem(e){let t=null;if(e){for(let n of this.listContainer.querySelectorAll(`li`))if(this.isSelectableItem(n)){if(n.dataset.value===e)return n;this.itemText(n)===e&&(t=n)}}return t}highlightItem(e,t=!0){if(this.listContainer.querySelector(`li.active`)?.classList.remove(`active`),e&&this.isSelectableItem(e)&&!e.classList.contains(`hidden`)){if(t&&this.listContainer.focus(),e.classList.add(`active`),this.listContainer.setAttribute(`aria-activedescendant`,e.id),this.collapse)for(let t=e.closest(`ul`);t;t=t.parentElement.closest(`ul`))t.classList.add(`open`),t.closest(`li`)?.classList.add(`open`);this.collapsible.open&&e.scrollIntoView({block:`nearest`});return}this.listContainer.removeAttribute(`aria-activedescendant`)}highlightNextItem(){let e=this.visibleItems(),t=this.activeItem();if(!e.length){this.highlightItem(null);return}if(!t){this.highlightItem(e[0]);return}let n=e.indexOf(t);this.highlightItem(e[Math.min(e.length-1,n+1)]||e[0])}highlightPreviousItem(e=!1){let t=this.visibleItems(),n=this.activeItem();if(!t.length){this.highlightItem(null);return}if(!n){this.highlightItem(e?t[t.length-1]:t[0]);return}let r=t.indexOf(n);this.highlightItem(t[Math.max(0,r-1)]||t[0])}highlightFirstItem(){this.highlightItem(this.visibleItems()[0]||null)}highlightLastItem(){let e=this.visibleItems();this.highlightItem(e[e.length-1]??null)}itemValue(e){return e.dataset.value||this.itemText(e)||``}itemText(e){return e.querySelector(`div > div`)?.textContent?.trim()||``}elementText(e){let t=``;for(let n of e.childNodes)n.nodeType==3&&(t+=n.nodeValue?.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0,this.#n=0;let e=null,t=this.shadowRoot.querySelector(`#list-container-slot`).assignedElements();if(t?.length===1&&(e=Array.prototype.slice.call(t[0].querySelectorAll(`:scope > li`)),this.copyItems(e,this.listContainer),this.#s.disconnect(),this.#s.observe(t[0],{subtree:!0,childList:!0,characterData:!0,attributes:!0})),this.emptyMessage){let t=document.createElement(`li`);t.id=`noresult`,t.setAttribute(`disabled`,``),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),e&&e.length>0&&t.classList.add(`hidden`)}this.value=this.value||this.#e;let n=this.findItem(this.value);n?this.selectItem(n):this.value?(this.selectedItem=null,this.#e=this.value,this.syncSelectionState(this.value,!1)):this.selectItem(null),this.applyFilterability()}copyItems(e,t,n=0){if(this.sort!==void 0){let t=this.sort||`asc`;e=e.sort((e,n)=>t===`desc`?(this.elementText(n)||this.itemValue(n)).localeCompare(this.elementText(e)||this.itemValue(e)):(this.elementText(e)||this.itemValue(e)).localeCompare(this.elementText(n)||this.itemValue(n)))}let r=``;n>0&&(r=`calc(0.3em + ${n}*${this.#t})`);for(let i of e){let e=i.cloneNode();e.replaceChildren(),e.id=i.id||`${this.id||`rokit-select`}-option-${this.#n++}`;let a=document.createElement(`div`);r&&(a.style.paddingLeft=r);let o=document.createElement(`div`);a.appendChild(o);for(let e of i.childNodes)if(e.nodeName!==`UL`){let t=e.cloneNode(!0);t.nodeType===3&&t.nodeValue&&(t.nodeValue=t.nodeValue.trim()),o.appendChild(t)}e.appendChild(a),e.title=e.title||this.itemText(e),e.setAttribute(`role`,i.classList.contains(`divider`)||i.classList.contains(`header`)?`presentation`:`option`),e.setAttribute(`aria-disabled`,String(i.getAttribute(`disabled`)!==null));let s=i.querySelector(`ul`);if(s?.childElementCount){let t=document.createElement(`ul`);if(t.setAttribute(`role`,`group`),e.appendChild(t),this.copyItems(Array.prototype.slice.call(s.children),t,n+1),this.collapse){let t=new Sa;t.dense=!0,t.icon=!0,t.classList.add(`toggle-node`,`caret`),t.title=`Toggle nested options`,t.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),t.addEventListener(`click`,t=>{t.stopPropagation(),this.toggleNestedList(e)}),a.prepend(t)}else t.classList.add(`open`)}t.appendChild(e),this.itemCount++}}activeItem(){return this.listContainer.querySelector(`li.active`)}visibleItems(){return Array.from(this.listContainer.querySelectorAll(`ul.open > li:not(.hidden)`)).filter(e=>this.isSelectableItem(e))}isSelectableItem(e){return!!e&&e.id!==`noresult`&&e.getAttribute(`disabled`)===null&&!e.classList.contains(`divider`)&&!e.classList.contains(`header`)}restoreSelection(){let e=this.selectedItem||this.findItem(this.#e);this.selectItem(e,!1)}openList(e=!this.input?.value){this.disabled||this.fixedOpen||(this.collapsible?.toggle(!0),this.collapsible.updateComplete.then(()=>{this.collapsible.open&&this.#x()}),e&&this.highlightItem(this.selectedItem??null,!1),this.syncInputAccessibilityState())}closeList(e=!0,t=!1){this.fixedOpen||(e&&this.checkInputValue(),this.filter(``),t&&this.collapsible.content.matches(`:popover-open`)?(this.collapsible.toggle(!1),this.#a=window.setTimeout(()=>{this.#a=void 0,this.#S()},this.collapsible.transitionDuration)):(this.#S(),this.collapsible?.toggle(!1)),this.syncInputAccessibilityState())}inputShouldBeReadonly(){return this.filterableThreshold<0||this.itemCount<this.filterableThreshold}applyFilterability(){let e=this.inputShouldBeReadonly();this.input.readonly=e,this.collapsible.headerInactive=!e}toggleNestedList(e,t=!e.classList.contains(`open`)){e.classList.toggle(`open`,t),e.querySelector(`:scope > ul`)?.classList.toggle(`open`,t),this.collapsible.updateContentHeight(),this.highlightItem(e,!1)}syncInputAccessibilityState(){this.input?.inputElement&&(this.input.inputElement.setAttribute(`role`,`combobox`),this.input.inputElement.setAttribute(`aria-expanded`,String(this.fixedOpen||this.collapsible?.open)),this.input.inputElement.setAttribute(`aria-controls`,`list-container`),this.input.inputElement.setAttribute(`aria-autocomplete`,this.input.readonly?`none`:`list`),this.listContainer?.setAttribute(`role`,`listbox`))}syncSelectionAccessibilityState(){for(let e of this.listContainer.querySelectorAll(`li[role="option"]`))e.setAttribute(`aria-selected`,String(e===this.selectedItem))}syncSelectionState(e,t=e!==this.value){this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.title||(this.input.title=this.input.value),this.classList.toggle(`has-value`,this.value!==``),this.setFormValue(this.value);let n=!this.disabled&&this.required&&this.value===``,r=n?`Please select a value`:void 0;this.input.setCustomValidity(r),this.input.updateComplete.then(()=>{let e=!this.disabled&&this.required&&this.value===``;this.input.inputElement.setAttribute(`aria-invalid`,String(e)),this.input.setCustomValidity(e?`Please select a value`:void 0,this.input.inputElement)}),n?this.updateValidity({valueMissing:!0},r,this.listContainer):this.updateValidity(),t&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0})),this.syncSelectionAccessibilityState()}render(){return Y`
351
351
  <rokit-collapsible ?dense="${this.dense}" part="collapsible" exportparts="header:collapsible-header" ?headerInactive="${!this.inputShouldBeReadonly()}">
352
352
  <slot name="prefix" part="prefix" slot="prefix"></slot>
353
353
  <slot name="suffix" part="suffix loader" slot="suffix"></slot>
@@ -365,7 +365,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
365
365
  </ul>
366
366
  <slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
367
367
  </rokit-collapsible>
368
- `}};Q([Z()],Ca.prototype,`emptyMessage`,void 0),Q([Z()],Ca.prototype,`sort`,void 0),Q([Z()],Ca.prototype,`collapsibleMaxHeight`,void 0),Q([Z()],Ca.prototype,`collapsibleOrientationLeft`,void 0),Q([Z()],Ca.prototype,`collapsibleOrientationRight`,void 0),Q([Z()],Ca.prototype,`collapsibleWidth`,void 0),Q([Z({type:Boolean})],Ca.prototype,`autoGrowLabelWidth`,void 0),Q([Z({type:Boolean,reflect:!0})],Ca.prototype,`fixedOpen`,void 0),Q([Z()],Ca.prototype,`inputMinWidth`,void 0),Q([Z({type:Boolean,reflect:!0})],Ca.prototype,`collapse`,void 0),Q([Z()],Ca.prototype,`filterableThreshold`,void 0),Q([Z()],Ca.prototype,`supportingText`,void 0),Q([_a(`rokit-collapsible`)],Ca.prototype,`collapsible`,void 0),Q([_a(`#input`)],Ca.prototype,`input`,void 0),Q([_a(`#list-container`)],Ca.prototype,`listContainer`,void 0),Ca=Q([fa(`rokit-select`)],Ca);var wa=class extends ${constructor(...e){super(...e),this.resize=`none`,this.rows=3,this.#t=()=>this.autoResize()}static{this.styles=[...$.styles,ci`
368
+ `}};Q([Z()],wa.prototype,`emptyMessage`,void 0),Q([Z()],wa.prototype,`sort`,void 0),Q([Z()],wa.prototype,`collapsibleMaxHeight`,void 0),Q([Z()],wa.prototype,`collapsibleOrientationLeft`,void 0),Q([Z()],wa.prototype,`collapsibleOrientationRight`,void 0),Q([Z()],wa.prototype,`collapsibleWidth`,void 0),Q([Z({type:Boolean})],wa.prototype,`autoGrowLabelWidth`,void 0),Q([Z({type:Boolean,reflect:!0})],wa.prototype,`fixedOpen`,void 0),Q([Z()],wa.prototype,`inputMinWidth`,void 0),Q([Z({type:Boolean,reflect:!0})],wa.prototype,`collapse`,void 0),Q([Z()],wa.prototype,`filterableThreshold`,void 0),Q([Z()],wa.prototype,`supportingText`,void 0),Q([va(`rokit-collapsible`)],wa.prototype,`collapsible`,void 0),Q([va(`#input`)],wa.prototype,`input`,void 0),Q([va(`#list-container`)],wa.prototype,`listContainer`,void 0),wa=Q([pa(`rokit-select`)],wa);var Ta=class extends ${constructor(...e){super(...e),this.resize=`none`,this.rows=3,this.#t=()=>this.autoResize()}static{this.styles=[...$.styles,li`
369
369
  :host, .wrapper { align-items: flex-start; }
370
370
  :host([resize='auto']) { height: fit-content; min-height: 0; }
371
371
  #input { height: initial; }
@@ -373,12 +373,12 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
373
373
  `]}#e;#t;firstUpdated(){super.firstUpdated(),this.applyDimensions(),this.applyResizeBehavior()}updated(e){super.updated(e),(e.has(`rows`)||e.has(`cols`))&&this.applyDimensions(),e.has(`resize`)&&this.applyResizeBehavior(),this.resize===`auto`&&(e.has(`value`)||e.has(`disabled`))&&this.autoResize()}disconnectedCallback(){this.textareaElement?.removeEventListener(`input`,this.#t),this.#e?.disconnect(),this.#e=void 0,super.disconnectedCallback()}applyDimensions(){this.textareaElement.rows=this.rows,this.textareaElement.cols=this.cols===void 0?20:this.cols}applyResizeBehavior(){if(this.textareaElement.removeEventListener(`input`,this.#t),this.#e?.disconnect(),this.#e=void 0,this.resize===`auto`){this.textareaElement.style.resize=`none`,this.textareaElement.addEventListener(`input`,this.#t),this.#e=new ResizeObserver(this.#t),this.#e.observe(this.textareaElement),this.autoResize();return}this.textareaElement.style.resize=this.resize,this.textareaElement.style.height=``}autoResize(){this.textareaElement.style.height=this.disabled?`0`:``,this.textareaElement.style.height=this.textareaElement.scrollHeight+`px`}onSlotChange(){let e=this.shadowRoot.querySelector(`#content`).assignedNodes().map(e=>e.textContent).join(``);e.trim()!==``&&(this.value=e)}renderInput(){return Y`
374
374
  <textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
375
375
  <slot id="content" @slotchange=${this.onSlotChange}></slot>
376
- `}};Q([Z({reflect:!0})],wa.prototype,`resize`,void 0),Q([Z({type:Number})],wa.prototype,`rows`,void 0),Q([Z({type:Number})],wa.prototype,`cols`,void 0),Q([_a(`#input`)],wa.prototype,`textareaElement`,void 0),wa=Q([fa(`rokit-textarea`)],wa);var Ta=18,Ea=class extends ${constructor(...e){super(...e),this.labelFormatter=e=>String(Math.round(e*1e3)/1e3),this.#e=[0,1],this.#t=[this.#e[0],this.#e[1]],this.#r=`start`,this.#i=null,this.#a=``,this.onPointerDown=e=>{if(this.disabled||!e.isPrimary&&e.pointerType!==`touch`||e.pointerType!==`touch`&&e.button!==0)return;e.preventDefault(),this.#a=this.value,this.sliderElement.focus(),this.sliderElement.setPointerCapture(e.pointerId),this.#i=e.pointerId;let t=e.target instanceof Oa,n=t?e.target:this.chooseKnob(e.clientX-this.track.getBoundingClientRect().left);this.#o=n,this.setActiveKnob(n),n.classList.add(`focus`),t||this.updateFromClientX(e.clientX)},this.onPointerMove=e=>{this.#i===e.pointerId&&this.updateFromClientX(e.clientX)},this.onPointerEnd=e=>{if(this.#i!==e.pointerId)return;let t=this.#o;this.#i=null,this.#o=void 0,this.sliderElement.hasPointerCapture(e.pointerId)&&this.sliderElement.releasePointerCapture(e.pointerId),t?.classList.remove(`focus`),this.value!==this.#a&&this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))},this.onSliderKeyDown=e=>{if(this.disabled)return;let t=this.currentKnob(),n=this.currentStep(),r;switch(e.key){case`ArrowLeft`:case`ArrowDown`:e.preventDefault(),r=t.value-n;break;case`ArrowRight`:case`ArrowUp`:e.preventDefault(),r=t.value+n;break;case`Home`:e.preventDefault(),r=this.#e[0];break;case`End`:e.preventDefault(),r=this.#e[1];break}r!==void 0&&this.updateKnobValue(t,r,!0)}}static{this.styles=[...$.styles,ci`
376
+ `}};Q([Z({reflect:!0})],Ta.prototype,`resize`,void 0),Q([Z({type:Number})],Ta.prototype,`rows`,void 0),Q([Z({type:Number})],Ta.prototype,`cols`,void 0),Q([va(`#input`)],Ta.prototype,`textareaElement`,void 0),Ta=Q([pa(`rokit-textarea`)],Ta);var Ea=18,Da=class extends ${constructor(...e){super(...e),this.labelFormatter=e=>String(Math.round(e*1e3)/1e3),this.#e=[0,1],this.#t=[this.#e[0],this.#e[1]],this.#r=`start`,this.#i=null,this.#a=``,this.onPointerDown=e=>{if(this.disabled||!e.isPrimary&&e.pointerType!==`touch`||e.pointerType!==`touch`&&e.button!==0)return;e.preventDefault(),this.#a=this.value,this.sliderElement.focus(),this.sliderElement.setPointerCapture(e.pointerId),this.#i=e.pointerId;let t=e.target instanceof ka,n=t?e.target:this.chooseKnob(e.clientX-this.track.getBoundingClientRect().left);this.#o=n,this.setActiveKnob(n),n.classList.add(`focus`),t||this.updateFromClientX(e.clientX)},this.onPointerMove=e=>{this.#i===e.pointerId&&this.updateFromClientX(e.clientX)},this.onPointerEnd=e=>{if(this.#i!==e.pointerId)return;let t=this.#o;this.#i=null,this.#o=void 0,this.sliderElement.hasPointerCapture(e.pointerId)&&this.sliderElement.releasePointerCapture(e.pointerId),t?.classList.remove(`focus`),this.value!==this.#a&&this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))},this.onSliderKeyDown=e=>{if(this.disabled)return;let t=this.currentKnob(),n=this.currentStep(),r;switch(e.key){case`ArrowLeft`:case`ArrowDown`:e.preventDefault(),r=t.value-n;break;case`ArrowRight`:case`ArrowUp`:e.preventDefault(),r=t.value+n;break;case`Home`:e.preventDefault(),r=this.#e[0];break;case`End`:e.preventDefault(),r=this.#e[1];break}r!==void 0&&this.updateKnobValue(t,r,!0)}}static{this.styles=[...$.styles,li`
377
377
  :host(.has-label:not(:focus):not(.has-value):not([sticky])) #slider > * { visibility: hidden; }
378
378
  :host(.has-label) .wrapper { padding-top: 1em; }
379
379
  :host([sticky]) #slider { margin-top: ${26.5}px; }
380
380
  #input { display: none; }
381
- #slider { display: flex; position: relative; align-items: center; width: 100%; height: ${Ta}px; padding: 0 ${Ta/2}px; outline: 0; }
381
+ #slider { display: flex; position: relative; align-items: center; width: 100%; height: ${Ea}px; padding: 0 ${Ea/2}px; outline: 0; }
382
382
  :host(:not([sticky])) #slider:not(:focus):not(:hover) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
383
383
  #track { height: 2px; flex-grow: 1; background-color: #CCC; }
384
384
  #slider[range] #track { background-color: color-mix(in srgb, var(--rokit-primary-color-inner) 60%, transparent); border-width: 0; border-color: #CCC; border-style: solid; }
@@ -401,12 +401,12 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
401
401
  <rokit-slider-knob id="end"></rokit-slider-knob>
402
402
  `}
403
403
  </div>
404
- `}};Q([Z()],Ea.prototype,`range`,void 0),Q([Z()],Ea.prototype,`labelFormatter`,void 0),Q([_a(`#slider`)],Ea.prototype,`sliderElement`,void 0),Q([_a(`#track`)],Ea.prototype,`track`,void 0),Q([_a(`#start`)],Ea.prototype,`startKnob`,void 0),Q([_a(`#end`)],Ea.prototype,`endKnob`,void 0),Ea=Q([fa(`rokit-slider`)],Ea);function Da(e,t){let n=new Date(0);n.setUTCSeconds(e);let r=n.toISOString();return t&&(r=r.slice(0,10)),r}var Oa=class extends ua{constructor(...e){super(...e),this.offset=0,this.label=``,this.value=0}static{this.styles=[ci`
405
- :host { position: absolute; width: ${Ta}px; height: ${Ta}px; border-radius: ${Ta}px; background-color: var(--rokit-primary-color-inner); }
406
- :host(.focus), :host(:hover) { box-shadow: 0 0 0 ${Ta/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
404
+ `}};Q([Z()],Da.prototype,`range`,void 0),Q([Z()],Da.prototype,`labelFormatter`,void 0),Q([va(`#slider`)],Da.prototype,`sliderElement`,void 0),Q([va(`#track`)],Da.prototype,`track`,void 0),Q([va(`#start`)],Da.prototype,`startKnob`,void 0),Q([va(`#end`)],Da.prototype,`endKnob`,void 0),Da=Q([pa(`rokit-slider`)],Da);function Oa(e,t){let n=new Date(0);n.setUTCSeconds(e);let r=n.toISOString();return t&&(r=r.slice(0,10)),r}var ka=class extends da{constructor(...e){super(...e),this.offset=0,this.label=``,this.value=0}static{this.styles=[li`
405
+ :host { position: absolute; width: ${Ea}px; height: ${Ea}px; border-radius: ${Ea}px; background-color: var(--rokit-primary-color-inner); }
406
+ :host(.focus), :host(:hover) { box-shadow: 0 0 0 ${Ea/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
407
407
  label {
408
408
  position: absolute;
409
- top: calc(-2em - ${Ta/4}px);
409
+ top: calc(-2em - ${Ea/4}px);
410
410
  left: 50%;
411
411
  transform: translate(-50%, 0);
412
412
  white-space: nowrap;
@@ -431,7 +431,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
431
431
  background-color: inherit;
432
432
  clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
433
433
  }
434
- `]}configureAccessibility(e,t,n,r,i){this.setAttribute(`role`,`slider`),this.setAttribute(`aria-label`,e),this.setAttribute(`aria-valuemin`,String(t)),this.setAttribute(`aria-valuemax`,String(n)),this.setAttribute(`aria-valuenow`,String(r)),this.setAttribute(`aria-valuetext`,i)}updated(e){e.has(`offset`)&&(this.style.left=this.offset+`px`)}render(){return Y`<label part="label">${this.label}</label>`}};Q([Z()],Oa.prototype,`offset`,void 0),Q([Z()],Oa.prototype,`label`,void 0),Oa=Q([fa(`rokit-slider-knob`)],Oa);var ka=class extends va{constructor(...e){super(...e),this.open=!1,this.closable=!1,this.loading=!1,this.confirmation=!1,this.title=``,this.confirmLabel=`Confirm`,this.cancelLabel=`Cancel`,this.previousBodyOverflow=``,this.layoutLocked=!1,this.onDialogCancel=e=>{if(!this.closable&&!this.confirmation){e.preventDefault();return}this.open=!1},this.onDialogClose=()=>{this.unlockLayout(),this.open=!1,this.resolveConfirmation(this.dialogElement.returnValue===`confirm`),this.dispatchEvent(new Event(`close`))}}static{this.styles=[...va.styles,ci`
434
+ `]}configureAccessibility(e,t,n,r,i){this.setAttribute(`role`,`slider`),this.setAttribute(`aria-label`,e),this.setAttribute(`aria-valuemin`,String(t)),this.setAttribute(`aria-valuemax`,String(n)),this.setAttribute(`aria-valuenow`,String(r)),this.setAttribute(`aria-valuetext`,i)}updated(e){e.has(`offset`)&&(this.style.left=this.offset+`px`)}render(){return Y`<label part="label">${this.label}</label>`}};Q([Z()],ka.prototype,`offset`,void 0),Q([Z()],ka.prototype,`label`,void 0),ka=Q([pa(`rokit-slider-knob`)],ka);var Aa=class extends ya{constructor(...e){super(...e),this.open=!1,this.closable=!1,this.loading=!1,this.confirmation=!1,this.title=``,this.confirmLabel=`Confirm`,this.cancelLabel=`Cancel`,this.previousBodyOverflow=``,this.layoutLocked=!1,this.onDialogCancel=e=>{if(!this.closable&&!this.confirmation){e.preventDefault();return}this.open=!1},this.onDialogClose=()=>{this.unlockLayout(),this.open=!1,this.resolveConfirmation(this.dialogElement.returnValue===`confirm`),this.dispatchEvent(new Event(`close`))}}static{this.styles=[...ya.styles,li`
435
435
  :host(:not([open])) { display: none; }
436
436
  dialog[open] { display: flex; flex-direction: column; width: 100%; max-width: 90vw; max-height: 90vh; margin: auto; outline: 0; border: 0; border-radius: 1em; padding: 0; }
437
437
  dialog::backdrop { background-color: #0007; }
@@ -465,7 +465,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
465
465
  </footer>
466
466
  `:X}
467
467
  </dialog>
468
- `}};Q([Z({type:Boolean,reflect:!0})],ka.prototype,`open`,void 0),Q([Z({type:Boolean})],ka.prototype,`closable`,void 0),Q([Z({type:Boolean})],ka.prototype,`loading`,void 0),Q([Z({type:Boolean,reflect:!0})],ka.prototype,`confirmation`,void 0),Q([Z()],ka.prototype,`title`,void 0),Q([Z({attribute:`confirm-label`})],ka.prototype,`confirmLabel`,void 0),Q([Z({attribute:`cancel-label`})],ka.prototype,`cancelLabel`,void 0),Q([_a(`#dialog`)],ka.prototype,`dialogElement`,void 0),ka=Q([fa(`rokit-dialog`)],ka);var Aa=class extends va{constructor(...e){super(...e),this.visible=!1,this.resizeObserver=new ResizeObserver(e=>{let{width:t,height:n}=e[0].contentRect,r=t>0&&n>0;r&&!this.visible&&!Number.isFinite(Number(this.percent))&&(this.bar.classList.remove(`indeterminate`),this.bar.offsetWidth,this.bar.classList.add(`indeterminate`)),this.visible=r})}static{this.styles=[...va.styles,ci`
468
+ `}};Q([Z({type:Boolean,reflect:!0})],Aa.prototype,`open`,void 0),Q([Z({type:Boolean})],Aa.prototype,`closable`,void 0),Q([Z({type:Boolean})],Aa.prototype,`loading`,void 0),Q([Z({type:Boolean,reflect:!0})],Aa.prototype,`confirmation`,void 0),Q([Z()],Aa.prototype,`title`,void 0),Q([Z({attribute:`confirm-label`})],Aa.prototype,`confirmLabel`,void 0),Q([Z({attribute:`cancel-label`})],Aa.prototype,`cancelLabel`,void 0),Q([va(`#dialog`)],Aa.prototype,`dialogElement`,void 0),Aa=Q([pa(`rokit-dialog`)],Aa);var ja=class extends ya{constructor(...e){super(...e),this.visible=!1,this.resizeObserver=new ResizeObserver(e=>{let{width:t,height:n}=e[0].contentRect,r=t>0&&n>0;r&&!this.visible&&!Number.isFinite(Number(this.percent))&&(this.bar.classList.remove(`indeterminate`),this.bar.offsetWidth,this.bar.classList.add(`indeterminate`)),this.visible=r})}static{this.styles=[...ya.styles,li`
469
469
  :host { display: flex; height: 3px; overflow: hidden; background-color: var(--rokit-primary-color-transparent-inner); color: var(--rokit-primary-color-inner); }
470
470
  .bar { height: 100%; background-color: var(--rokit-primary-color-inner); }
471
471
  .bar.indeterminate { position: relative; width: 100%; background: none; }
@@ -492,7 +492,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
492
492
  aria-valuemax="${e?`100`:X}"
493
493
  aria-valuenow="${e?String(Math.min(100,Math.max(0,Number(this.percent)))):X}"
494
494
  ></div>
495
- `}};Q([Z({type:Number})],Aa.prototype,`percent`,void 0),Q([_a(`.bar`)],Aa.prototype,`bar`,void 0),Aa=Q([fa(`rokit-progressbar`)],Aa);var ja=`RokitSnackbarEvent`,Ma=`0.2s`,Na=ba(Ma),Pa=3e3,Fa=class extends ua{static{this.styles=ci`
495
+ `}};Q([Z({type:Number})],ja.prototype,`percent`,void 0),Q([va(`.bar`)],ja.prototype,`bar`,void 0),ja=Q([pa(`rokit-progressbar`)],ja);var Ma=`RokitSnackbarEvent`,Na=`0.2s`,Pa=xa(Na),Fa=3e3,Ia=class extends da{static{this.styles=li`
496
496
  :host { display: flex; justify-content: center; width: 100%; position: fixed; bottom: 10px; pointer-events: none; }
497
497
  :host(.left) { right: auto; left: 10px; width: auto; }
498
498
  :host(.right) { right: 10px; left: auto; width: auto; }
@@ -500,7 +500,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
500
500
  :host(.top) { top: 10px; bottom: auto; }
501
501
  :host(.top) .snackbar { flex-direction: column-reverse; }
502
502
  .snackbar { display: flex; flex-direction: column; width: 300px; }
503
- .message { max-height: 0; margin-bottom: 0; overflow: hidden; background-color: #333; color: #FFF; border-radius: 4px; transition: all ${si(Ma)} ease-in-out; font-weight: 500; pointer-events: auto; position: relative; }
503
+ .message { max-height: 0; margin-bottom: 0; overflow: hidden; background-color: #333; color: #FFF; border-radius: 4px; transition: all ${ci(Na)} ease-in-out; font-weight: 500; pointer-events: auto; position: relative; }
504
504
  .message.error { background-color: #C22; }
505
505
  .message.success { background-color: #0a8f0a; }
506
506
  .message:not(.closable) .text { text-align: center; }
@@ -509,7 +509,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
509
509
  .inner { display: flex; padding: 10px; }
510
510
  .text { flex-grow: 1; word-break: break-all; }
511
511
  .text a { color: inherit; }
512
- `}constructor(){super(),this.listener=e=>{e.stopImmediatePropagation(),Ia(e.detail,this)},this.container=document.createElement(`div`),this.container.classList.add(`snackbar`),this.container.setAttribute(`part`,`snackbar`),this.container.setAttribute(`aria-live`,`polite`),this.container.setAttribute(`aria-atomic`,`true`)}connectedCallback(){super.connectedCallback(),this.shadowRoot.appendChild(this.container),document.addEventListener(ja,this.listener)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(ja,this.listener)}};Fa=Q([fa(`rokit-snackbar`)],Fa);function Ia(e,t){t||(t=document.querySelector(`rokit-snackbar`)||void 0,t||(t=new Fa,document.body.appendChild(t)));let n=document.createElement(`div`);n.classList.add(`message`),n.setAttribute(`role`,`status`);let r=document.createElement(`div`);r.classList.add(`inner`);let i=document.createElement(`div`);if(i.classList.add(`text`),i.innerHTML=e.message,r.appendChild(i),n.appendChild(r),e.closable===void 0?e.ttl===0:e.closable){n.classList.add(`closable`);let e=new xa;e.setAttribute(`icon`,``),e.setAttribute(`dense`,``),e.classList.add(`clear`),e.title=`Dismiss`,e.addEventListener(`click`,()=>{o(n)}),r.append(e)}e.cssStyle&&(n.style.cssText=e.cssStyle),e.cssClass&&n.classList.add(e.cssClass),t.container.appendChild(n);let a;if(e.ttl!==0&&(a=document.createElement(`div`),a.classList.add(`progress`),a.style.animationDuration=(e.ttl||Pa)+`ms`,a.style.animationPlayState=`paused`,n.appendChild(a)),setTimeout(()=>{n.style.maxHeight=n.scrollHeight+`px`,n.style.marginBottom=`10px`}),e.ttl!==0){let t=e.ttl||Pa,r,i=Date.now(),s=t,c=!1,l=()=>{c||(c=!0,u())},u=()=>{i=Date.now(),a.style.animationPlayState=`running`,r=setTimeout(()=>{r=void 0,o(n)},s)};n.addEventListener(`mouseenter`,()=>{r!==void 0&&(clearTimeout(r),r=void 0,s-=Date.now()-i,a.style.animationPlayState=`paused`)}),n.addEventListener(`mouseleave`,()=>{c&&u()});let d=e=>{e.propertyName===`max-height`&&(n.removeEventListener(`transitionend`,d),clearTimeout(f),l())};n.addEventListener(`transitionend`,d);let f=setTimeout(l,Na)}let o=e=>{e.style.maxHeight=``,e.style.marginBottom=``,setTimeout(()=>{e.remove()},Na)}}var La=class extends va{constructor(...e){super(...e),this.pos=`50%`,this.minPos=10,this.maxPos=90,this.dir=`horizontal`,this.sep=`2px`,this.dragging=!1,this.hideIndicators=!1,this.storageKey=``,this._restoredKey=``,this._positionAdjusted=!1,this._boundsAdjusted=!1,this._activePointerId=null,this.posFromPointer=e=>{let t=this.getBoundingClientRect(),n=this.dir===`horizontal`?e.clientX-t.left:e.clientY-t.top,r=this.dir===`horizontal`?t.width:t.height,i=r>0?n/r*100:50;return`${Math.min(this.maxPos,Math.max(this.minPos,i))}%`},this.startDrag=e=>{e.button==0&&(this.dragging=!0,this._activePointerId=e.pointerId,e.currentTarget.setPointerCapture(e.pointerId),this.pos=this.posFromPointer(e))},this.drag=e=>{this.dragging&&this._activePointerId==e.pointerId&&(this.pos=this.posFromPointer(e))},this.endDrag=e=>{this._activePointerId==e.pointerId&&(this.dragging=!1,this._activePointerId=null)},this.onKeyDown=e=>{let t=e.shiftKey?10:1;switch(e.key){case`ArrowLeft`:this.dir===`horizontal`&&(e.preventDefault(),this.updatePosFromNumber(this.currentPos()-t));break;case`ArrowRight`:this.dir===`horizontal`&&(e.preventDefault(),this.updatePosFromNumber(this.currentPos()+t));break;case`ArrowUp`:this.dir===`vertical`&&(e.preventDefault(),this.updatePosFromNumber(this.currentPos()-t));break;case`ArrowDown`:this.dir===`vertical`&&(e.preventDefault(),this.updatePosFromNumber(this.currentPos()+t));break;case`Home`:e.preventDefault(),this.updatePosFromNumber(this.minPos);break;case`End`:e.preventDefault(),this.updatePosFromNumber(this.maxPos);break}}}static{this.styles=[...va.styles,ci`
512
+ `}constructor(){super(),this.listener=e=>{e.stopImmediatePropagation(),La(e.detail,this)},this.container=document.createElement(`div`),this.container.classList.add(`snackbar`),this.container.setAttribute(`part`,`snackbar`),this.container.setAttribute(`aria-live`,`polite`),this.container.setAttribute(`aria-atomic`,`true`)}connectedCallback(){super.connectedCallback(),this.shadowRoot.appendChild(this.container),document.addEventListener(Ma,this.listener)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(Ma,this.listener)}};Ia=Q([pa(`rokit-snackbar`)],Ia);function La(e,t){t||(t=document.querySelector(`rokit-snackbar`)||void 0,t||(t=new Ia,document.body.appendChild(t)));let n=document.createElement(`div`);n.classList.add(`message`),n.setAttribute(`role`,`status`);let r=document.createElement(`div`);r.classList.add(`inner`);let i=document.createElement(`div`);if(i.classList.add(`text`),i.innerHTML=e.message,r.appendChild(i),n.appendChild(r),e.closable===void 0?e.ttl===0:e.closable){n.classList.add(`closable`);let e=new Sa;e.setAttribute(`icon`,``),e.setAttribute(`dense`,``),e.classList.add(`clear`),e.title=`Dismiss`,e.addEventListener(`click`,()=>{o(n)}),r.append(e)}e.cssStyle&&(n.style.cssText=e.cssStyle),e.cssClass&&n.classList.add(e.cssClass),t.container.appendChild(n);let a;if(e.ttl!==0&&(a=document.createElement(`div`),a.classList.add(`progress`),a.style.animationDuration=(e.ttl||Fa)+`ms`,a.style.animationPlayState=`paused`,n.appendChild(a)),setTimeout(()=>{n.style.maxHeight=n.scrollHeight+`px`,n.style.marginBottom=`10px`}),e.ttl!==0){let t=e.ttl||Fa,r,i=Date.now(),s=t,c=!1,l=()=>{c||(c=!0,u())},u=()=>{i=Date.now(),a.style.animationPlayState=`running`,r=setTimeout(()=>{r=void 0,o(n)},s)};n.addEventListener(`mouseenter`,()=>{r!==void 0&&(clearTimeout(r),r=void 0,s-=Date.now()-i,a.style.animationPlayState=`paused`)}),n.addEventListener(`mouseleave`,()=>{c&&u()});let d=e=>{e.propertyName===`max-height`&&(n.removeEventListener(`transitionend`,d),clearTimeout(f),l())};n.addEventListener(`transitionend`,d);let f=setTimeout(l,Pa)}let o=e=>{e.style.maxHeight=``,e.style.marginBottom=``,setTimeout(()=>{e.remove()},Pa)}}var Ra=class extends ya{constructor(...e){super(...e),this.pos=`50%`,this.minPos=10,this.maxPos=90,this.dir=`horizontal`,this.sep=`2px`,this.dragging=!1,this.hideIndicators=!1,this.storageKey=``,this._restoredKey=``,this._positionAdjusted=!1,this._boundsAdjusted=!1,this._activePointerId=null,this.posFromPointer=e=>{let t=this.getBoundingClientRect(),n=this.dir===`horizontal`?e.clientX-t.left:e.clientY-t.top,r=this.dir===`horizontal`?t.width:t.height,i=r>0?n/r*100:50;return`${Math.min(this.maxPos,Math.max(this.minPos,i))}%`},this.startDrag=e=>{e.button==0&&(this.dragging=!0,this._activePointerId=e.pointerId,e.currentTarget.setPointerCapture(e.pointerId),this.pos=this.posFromPointer(e))},this.drag=e=>{this.dragging&&this._activePointerId==e.pointerId&&(this.pos=this.posFromPointer(e))},this.endDrag=e=>{this._activePointerId==e.pointerId&&(this.dragging=!1,this._activePointerId=null)},this.onKeyDown=e=>{let t=e.shiftKey?10:1;switch(e.key){case`ArrowLeft`:this.dir===`horizontal`&&(e.preventDefault(),this.updatePosFromNumber(this.currentPos()-t));break;case`ArrowRight`:this.dir===`horizontal`&&(e.preventDefault(),this.updatePosFromNumber(this.currentPos()+t));break;case`ArrowUp`:this.dir===`vertical`&&(e.preventDefault(),this.updatePosFromNumber(this.currentPos()-t));break;case`ArrowDown`:this.dir===`vertical`&&(e.preventDefault(),this.updatePosFromNumber(this.currentPos()+t));break;case`Home`:e.preventDefault(),this.updatePosFromNumber(this.minPos);break;case`End`:e.preventDefault(),this.updatePosFromNumber(this.maxPos);break}}}static{this.styles=[...ya.styles,li`
513
513
  :host { display: grid; min-width: 0; min-height: 0; }
514
514
  .pane { min-width: 0; min-height: 0; overflow: auto; }
515
515
  :host([dragging]) { user-select: none; }
@@ -595,4 +595,4 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: inher
595
595
  </span>
596
596
  </div>
597
597
  <div class="pane"><slot name="pane2"></slot></div>
598
- `}};Q([Z()],La.prototype,`pos`,void 0),Q([Z()],La.prototype,`minPos`,void 0),Q([Z()],La.prototype,`maxPos`,void 0),Q([Z({reflect:!0})],La.prototype,`dir`,void 0),Q([Z()],La.prototype,`sep`,void 0),Q([Z({reflect:!0,type:Boolean})],La.prototype,`dragging`,void 0),Q([Z({reflect:!0,type:Boolean})],La.prototype,`hideIndicators`,void 0),Q([Z()],La.prototype,`storageKey`,void 0),Q([_a(`#separator`)],La.prototype,`separator`,void 0),La=Q([fa(`rokit-splitpane`)],La);function Ra(e){let t=new Set;for(let n of e.getQuads(null,yt,null,pt))n.subject.termType===`NamedNode`&&t.add(n.subject.value);if(t.size===1)return t.values().next().value}function za(e,t){let n=k.namedNode(t);for(let t of e.getObjects(n,yt,pt))if(t.termType===`NamedNode`&&e.getQuads(t,mt,wt,null).length>0)return t}async function Ba(e,t){let n={store:new nt,importedUrls:[],atts:e},r=[];if(e.shapes?r.push(Va(mr({rdf:e.shapes}),n,ft)):e.shapesUrl&&r.push(Va(mr({url:e.shapesUrl,proxy:n.atts.proxy,rdfUrlResolver:n.atts.rdfUrlResolver}),n,ft)),e.values?r.push(Va(mr({rdf:e.values}),n,pt,t)):e.valuesUrl&&r.push(Va(mr({url:e.valuesUrl,proxy:n.atts.proxy,rdfUrlResolver:n.atts.rdfUrlResolver}),n,pt,t)),await Promise.all(r),e.classInstanceProvider)try{let t=an(n.store),r=await e.classInstanceProvider(t);r&&await Va(mr({rdf:r}),n,ft)}catch(e){console.error(`failed loading class instances`,e)}if(e.valuesSubject||=Ra(n.store)||null,e.valuesSubject&&n.store.countQuads(null,null,null,ft)===0){let t=[...n.store.getObjects(e.valuesSubject,mt,pt),...n.store.getObjects(e.valuesSubject,yt,pt)],r=[];for(let e of t){let t=Ha(e.value);!t&&e.value.startsWith(`urn:`)&&n.atts.proxy&&(t=e.value),t&&n.importedUrls.indexOf(t)<0&&(n.importedUrls.push(t),r.push(Va(mr({url:t,proxy:n.atts.proxy,rdfUrlResolver:n.atts.rdfUrlResolver}),n,ft)))}try{await Promise.allSettled(r)}catch(e){console.warn(e)}}return n.store}async function Va(e,t,n,r){let i=await e,a=[];for(let e of i){r?.add(e);let i=n;if(t.atts.valuesSubject&&pt.equals(n)&&e.graph.id&&e.graph.id!==t.atts.valuesSubject&&(i=e.graph),t.store.add(k.quad(e.subject,e.predicate,e.object,i)),t.atts.loadOwlImports&&xt.equals(e.predicate)){let n=Ha(e.object.value);n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),a.push(Va(mr({url:n,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,k.namedNode(n))))}}await Promise.allSettled(a)}function Ha(e){if(Jt(e))return e;let t=e.split(`:`);if(t.length===2){let n=pr[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),Jt(e)))return e}return null}async function Ua(e){if(e.template.nodeShapes.size===0)return;let t=e.template.config.resourceLinkProvider;if((!t||t&&!t.lazyLoad)&&(await Ja(e.template),Ga(e).length===0))return;let n=e.template.config.theme.createButton(e.template.label,!1);n.title=`Link existing `+e.template.label,n.classList.add(`link-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}link-button`),n.addEventListener(`click`,async()=>{t?.lazyLoad&&(n.classList.add(`loading`),await Ja(e.template),n.classList.remove(`loading`));let r=Ga(e);if(r.length===0)n.innerText=`No linkable resources found`,n.setAttribute(`disabled`,``),setTimeout(()=>n.remove(),2e3);else{let t=e.template.config.form.querySelector(`#dialog`);t||(t=new ka,t.classList.add(`link-chooser`),t.closable=!0,e.template.config.form.appendChild(t)),t.title=`Link existing `+e.template.label,Wa(t,e,r),t.open=!0}}),n}function Wa(e,t,n){let r=document.createElement(`div`);for(let i of n){let n=document.createElement(`div`);n.classList.add(`link-option`),n.title=`Link this resource`,n.innerText=i.label||i.value.value,n.addEventListener(`click`,async()=>{await Ka(i,t),e.open=!1}),r.appendChild(n)}e.replaceChildren(r)}function Ga(e){let t=e.template.config,n=qa(e.template),r=new Set(Array.from(e.querySelectorAll(`:scope > .property-instance > shacl-node, :scope > .collapsible > .property-instance > shacl-node`)).map(e=>e.nodeId.id)),i=new Map;for(let a of t.form.querySelectorAll(`shacl-node:not([part~="linked-node"])`)){if(!n.has(a.template.id.value)||r.has(a.nodeId.id))continue;let o=new nt;a.toRDF(o),i.set(a.nodeId.id,{value:a.nodeId,label:Bt([...o.getQuads(a.nodeId,null,null,null),...t.store.getQuads(a.nodeId,null,null,null)],t.languages)||t.providedResourceLabels[a.nodeId.value],template:e.template})}if(t.resourceLinkProvider)for(let a of n)for(let n of t.providedConformingResourceIds[a]??[]){let a=k.namedNode(n);!r.has(a.id)&&!i.has(a.id)&&i.set(a.id,{value:a,label:t.providedResourceLabels[n]||Bt(t.store.getQuads(a,null,null,null),t.languages),template:e.template})}return[...i.values()]}async function Ka(e,t){let n=e.value.value;if(e.value.termType===`NamedNode`&&e.template.config.providedResources[n]?.length>0){let t={store:e.template.config.store,importedUrls:[],atts:{loadOwlImports:!1}};await Va(mr({rdf:e.template.config.providedResources[n]}),t,ft),e.template.config.providedResources[n]=``}let r=await yo(e.template,e.value,!0,!0);t.container.insertBefore(r,t.querySelector(`:scope > .add-button-wrapper`)),await t.updateControls()}function qa(e){return new Set(Array.from(e.nodeShapes,e=>e.id.value))}async function Ja(e){let t=e.config.resourceLinkProvider;if(!t)return;let n=qa(e);if(n.size===0)return;let r=on(Object.keys(e.config.providedConformingResourceIds),n);if(r.length!==0)try{let n=await t.listConformingResources(r,e);if(n){for(let t of Object.keys(n)){let r=new Set(n[t]);e.config.providedConformingResourceIds[t]=r,await Ya(r,!1,e.config)}for(let t of r)e.config.providedConformingResourceIds[t]||(e.config.providedConformingResourceIds[t]=new Set)}}catch(e){console.error(`failed loading conforming resources`,e)}}async function Ya(e,t,n){if(n.resourceLinkProvider&&e.size>0){let r=[];for(let t of e)n.providedResources[t]||r.push(t);if(r.length===0)return[];try{let e=await n.resourceLinkProvider.loadResources(r);if(e){let r={store:n.store,importedUrls:[],atts:{loadOwlImports:!1}};for(let i of e){n.providedResources[i.resourceId]=i.resourceRDF;let e=await mr({rdf:i.resourceRDF});n.providedResourceLabels[i.resourceId]=Bt(e.filter(e=>e.subject.value===i.resourceId),n.languages),t&&await Va(Promise.resolve(e),r,ft)}return e}for(let e of r)n.providedResources[e]||(n.providedResources[e]=``)}catch(e){console.error(`failed loading resources`,e)}}return[]}async function Xa(e){let t=new Set;for(let n of e.store.getQuads(null,null,null,pt))Za(n.object,e.store)&&t.add(n.object.value);await Ya(t,!0,e)}function Za(e,t){return e.termType===`NamedNode`&&t.countQuads(e,null,null,null)===0}var Qa=[];for(let e=0;e<256;++e)Qa.push((e+256).toString(16).slice(1));function $a(e,t=0){return(Qa[e[t+0]]+Qa[e[t+1]]+Qa[e[t+2]]+Qa[e[t+3]]+`-`+Qa[e[t+4]]+Qa[e[t+5]]+`-`+Qa[e[t+6]]+Qa[e[t+7]]+`-`+Qa[e[t+8]]+Qa[e[t+9]]+`-`+Qa[e[t+10]]+Qa[e[t+11]]+Qa[e[t+12]]+Qa[e[t+13]]+Qa[e[t+14]]+Qa[e[t+15]]).toLowerCase()}var eo,to=new Uint8Array(16);function no(){if(!eo){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);eo=crypto.getRandomValues.bind(crypto)}return eo(to)}var ro={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function io(e,t,n){e||={};let r=e.random??e.rng?.()??no();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return $a(r)}function ao(e,t,n){return ro.randomUUID&&!t&&!e?ro.randomUUID():io(e,t,n)}var oo=`:scope > .add-button-wrapper, :scope > .collapsible > .add-button-wrapper`,so=`:scope > .property-instance, :scope > .shacl-or-constraint, :scope > .alternative-path-constraint, :scope > shacl-node, :scope > .collapsible > .property-instance, :scope > .collapsible > .alternative-path-constraint`,co=class extends HTMLElement{constructor(e,t){if(super(),this.rdfListNodes=new WeakMap,this.rdfListGroups=new WeakMap,this.template=e,this.parent=t,this.rdfListItemTemplate=po(e),this.container=this,this.setAttribute(`part`,`property`),this.template.nodeShapes.size&&this.template.config.attributes.collapse!==null&&(this.template.maxCount===void 0||this.template.maxCount>1)){let t=new Sa;t.classList.add(`collapsible`,`shacl-group`),t.open=e.config.attributes.collapse===`open`,t.label=this.template.label,t.setAttribute(`part`,`collapsible`),this.container=t,this.appendChild(this.container)}this.template.cssClass&&this.classList.add(this.template.cssClass),e.config.editMode&&!t.linked&&this.addEventListener(`change`,async()=>{await this.updateControls()})}async bindValues(e,t){if(this.template.path){let n=!1;if(e){let r=(this.template.pathAlternatives??[this.template.path]).flatMap(t=>this.template.config.store.getQuads(e,t,null,this.parent.linked?null:pt));t&&(r=await this.filterValidValues(r,e)),r=r.filter(e=>this.parent.shouldBindPropertyValue(e));for(let e of r){this.parent.linked||this.template.config.store.delete(e);let t=!pt.equals(e.graph)||this.template.config.providedResources[e.object.value]!==void 0;(this.rdfListItemTemplate?await this.bindRdfList(e.object,t):await this.addPropertyInstance(e.object,t,this.template.config.providedResources[e.object.value]!==void 0,e.predicate.value))&&this.parent.recordBoundPropertyValue(e),this.template.hasValue&&e.object.equals(this.template.hasValue)&&(n=!0)}}this.template.config.editMode&&this.template.hasValue&&!n&&!this.parent.linked&&await this.addPropertyInstance(this.template.hasValue)}}async initializeQuery(){let{initializeQueryProperty:e}=await Mr(async()=>{let{initializeQueryProperty:e}=await import(`./mode-bo0QsQ7I.js`);return{initializeQueryProperty:e}},[]);await e(this)}async addPropertyInstance(e,t,n=!1,r,i=!0){if(this.rdfListItemTemplate)return this.addRdfListItem(e,t,n,i);let a;if(this.template.pathAlternatives&&!r)this.template.config.editMode&&(a=Pr(this,e,t,n));else{let i=r?this.template.pathAlternativeBranches?.[r]:void 0,o=r&&(r!==this.template.path||i)?Sr(this.template):this.template;if(r&&(o.path=r),i&&(wr(o,i,!0),o.label=i.name?.value||i.label||o.label),o.or?.length||o.xone?.length){let t=o.or?.length?o.or:o.xone,i=!1;if(e){let n=Fr(t,e,o.config);n.length&&(a=await yo(Cr(Sr(o),n),e,!this.parent.linked,this.parent.linked,this.parent),i=!0)}!i&&o.config.editMode&&(a=Nr(t,this,o.config,r,o),bo(a,``,o.config.theme.dense,o.config.hierarchyColorsStyleSheet!==void 0,n))}else a=await yo(o,e,n,t||this.parent.linked,this.parent)}return a&&(a.dataset.path=this.template.path,r&&(a.dataset.predicate=r),i&&this.container.insertBefore(a,this.querySelector(oo))),a}async updateControls(){this.template.config.editMode&&!this.parent.linked&&!this.querySelector(oo)&&this.container.appendChild(await this.createAddControls());let e=this.rdfListItemTemplate?+(br(this.template)>0):br(this.template),t=this.rdfListItemTemplate?this.rdfListItemTemplate.nodeShapes.size===0:this.template.nodeShapes.size===0,n=this.querySelector(`:scope > .add-button-wrapper > .link-button, :scope > .collapsible > .add-button-wrapper > .link-button`)===null,r=t||!this.hasRecursiveNodeShape(),i=this.instanceCount();i===0&&r&&(t||n&&e>0)&&(await this.addPropertyInstance(),i=1),t||this.querySelector(oo)?.classList.toggle(`required`,i<e);let a;a=e>0?i>e:!t||i>1;let o=this.rdfListItemTemplate!==void 0&&this.querySelector(`:scope > .property-instance.linked, :scope > .collapsible > .property-instance.linked`)!==null,s=new Set(lo(this).map(e=>this.rdfListGroups.get(e))).size,c=this.rdfListItemTemplate!==void 0&&!o&&s<=1||i<xr(this.template);this.classList.toggle(`may-remove`,a),this.classList.toggle(`may-add`,c)}instanceCount(){return this.querySelectorAll(so).length}refreshClassInstances(){if(!(!this.template.class||this.template.hasValue||!this.template.config.editMode))for(let e of this.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`)){let t=e.querySelector(`:scope > .editor`);if(!t||t.dataset.class!==this.template.class.value)continue;let n=Wr(t),r=qt(this.template.class,this.template);n&&!_o(r,n)&&r.push({value:n,children:[]});let i=vo(r);if(t.dataset.classInstances===i)continue;let a=this.template.config.theme.createListEditor(this.template.label,n??null,br(this.template)>0,r,this.template).querySelector(`.editor`);a.dataset.classInstances=i,t.replaceWith(a)}}hasRecursiveNodeShape(){let e=new Set;this.parent.ancestorShapeIds.forEach(t=>e.add(t)),e.add(this.parent.template.id.value);for(let t of this.template.nodeShapes)if(e.has(t.id.value))return!0;return!1}toRDF(e,t){if(this.rdfListItemTemplate){this.rdfListToRDF(e,t);return}for(let n of this.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`)){let r=k.namedNode(n.dataset.predicate??this.template.path);if(n.firstChild instanceof Fo){let i=n.firstChild.toRDF(e);e.addQuad(t,r,i,this.template.config.valuesGraphId)}else if(this.template.config.editMode)for(let i of n.querySelectorAll(`:scope > .editor`)){let n=Wr(i);n&&e.addQuad(t,r,n,this.template.config.valuesGraphId)}else{let i=Wr(n);i&&e.addQuad(t,r,i,this.template.config.valuesGraphId)}}}async filterValidValues(e,t){let n=this.template.id,r=[t];if(this.template.qualifiedValueShape){n=this.template.qualifiedValueShape.id,r=[];for(let t of e)r.push(t.object)}let i=await this.template.config.validator.validate({dataset:this.template.config.store,terms:r},[{terms:[n]}]),a=new Set;for(let e of i.results){let t=this.template.qualifiedValueShape?e.focusNode:e.value;t?.ptrs?.length&&a.add(t.ptrs[0]._term.id)}return e.filter(e=>!a.has(e.object.id))}async createAddControls(){let e=document.createElement(`div`);e.classList.add(`add-button-wrapper`),e.setAttribute(`part`,`add-controls`);let t=this.rdfListItemTemplate?void 0:await Ua(this);t&&e.appendChild(t);let n=this.template.config.theme.createButton(this.template.label,!1);n.title=`Add `+this.template.label,n.classList.add(`add-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}add-button`),n.addEventListener(`click`,async()=>{let e=await this.addPropertyInstance();e&&(e.classList.add(`fadeIn`),await this.updateControls(),this.template.nodeShapes.size&&this.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0})),setTimeout(()=>{zt(e),e.classList.remove(`fadeIn`)},200))}),e.appendChild(n),e}async bindRdfList(e,t){if(e.termType!==`NamedNode`&&e.termType!==`BlankNode`)return;let n=e,r=new Set,i;for(;!n.equals(_t)&&!r.has(n.id);){r.add(n.id);let a=t?null:pt,o=this.template.config.store.getQuads(n,ht,null,a)[0];if(!o)break;let s=this.template.config.store.getQuads(n,gt,null,a)[0];t||(this.template.config.store.delete(o),s&&this.template.config.store.delete(s));let c=await this.addRdfListItem(o.object,t,!1,!0,n,uo(e));if(i||=c,!s||s.object.termType!==`NamedNode`&&s.object.termType!==`BlankNode`)break;n=s.object}return i}async addRdfListItem(e,t=!1,n=!1,r=!0,i,a){let o=Sr(this.rdfListItemTemplate);o.label=this.template.label;let s=await yo(o,e,n,t||this.parent.linked,this.parent);s.dataset.path=this.template.path;let c=lo(this).map(e=>this.rdfListGroups.get(e)).find(e=>e!==void 0),l=i??this.createRdfListNode(c===void 0);return this.rdfListNodes.set(s,l),this.rdfListGroups.set(s,a??c??uo(l)),r&&this.container.insertBefore(s,this.querySelector(oo)),s}createRdfListNode(e){return e&&this.template.nodeKind?.value===`http://www.w3.org/ns/shacl#IRI`?k.namedNode(this.template.config.attributes.valuesNamespace+ao()):k.blankNode()}rdfListToRDF(e,t){let n=new Map;for(let t of lo(this)){let r=this.rdfListNodes.get(t)??k.blankNode(),i=this.rdfListGroups.get(t)??uo(r),a=t.classList.contains(`linked`),o;if(!a&&t.firstChild instanceof Fo)o=t.firstChild.toRDF(e);else if(!a&&this.template.config.editMode){let e=t.querySelector(`:scope > .editor`);o=e?Wr(e):void 0}else a||(o=Wr(t));if(a||o){let e=n.get(i)??[];e.push({instance:t,node:r,value:o,linked:a}),n.set(i,e)}}let r=new Set([...n.values()].flatMap(e=>e.map(e=>uo(e.node)))),i=new Map([...n.values()].flatMap(e=>e.filter(e=>!e.linked&&e.value).map(e=>[uo(e.node),uo(e.value)]))),a=new Set([...n.values()].filter(e=>e[0]?.linked).map(e=>uo(e[0].node)));this.removePreservedRdfList(e,t,r,i,a);for(let r of n.values())e.addQuad(t,k.namedNode(this.template.path),r[0].node,this.template.config.valuesGraphId),!r[0].linked&&(this.template.class&&e.addQuad(r[0].node,mt,this.template.class,this.template.config.valuesGraphId),r.forEach(({node:t,value:n},i)=>{e.addQuad(t,ht,n,this.template.config.valuesGraphId),e.addQuad(t,gt,r[i+1]?.node??_t,this.template.config.valuesGraphId)}))}removePreservedRdfList(e,t,n,r,i){if(this.template.config.attributes.preserveUnmappedValues===null)return;let a=this.template.config.originalValues,o=a.getObjects(t,k.namedNode(this.template.path),null),s=new Map,c=[];for(let t of o){if(t.termType!==`NamedNode`&&t.termType!==`BlankNode`||i.has(uo(t)))continue;let n=t,o=new Set;for(;!n.equals(_t)&&!o.has(n.id);){o.add(n.id),s.set(uo(n),n);let t=a.getQuads(n,gt,null,null)[0];for(let t of e.getQuads(n,ht,null,null)){e.delete(t);let i=r.get(uo(n));t.object.termType===`BlankNode`&&uo(t.object)!==i&&c.push(t.object)}for(let t of e.getQuads(n,gt,null,null))e.delete(t);if(!t||t.object.termType!==`NamedNode`&&t.object.termType!==`BlankNode`)break;n=t.object}}for(let t of s.values())if(t.termType===`BlankNode`&&!n.has(uo(t))&&e.countQuads(null,null,t,null)===0)for(let n of e.getQuads(t,null,null,null))e.delete(n),n.object.termType===`BlankNode`&&c.push(n.object);fo(e,c)}};function lo(e){return Array.from(e.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`))}function uo(e){return`${e.termType}:${e.value}`}function fo(e,t){let n=new Set;for(;t.length;){let r=t.pop();if(!(n.has(r.id)||e.countQuads(null,null,r,null)>0)){n.add(r.id);for(let n of e.getQuads(r,null,null,null))e.delete(n),n.object.termType===`BlankNode`&&t.push(n.object)}}}function po(e){if(e.maxCount!==1||e.nodeShapes.size!==1||!mo(e.nodeKind)||!go(e.config.store,e.id,[`path`,`minCount`,`maxCount`,`node`,`nodeKind`,`class`]))return;let t=[...e.nodeShapes][0],n=e.config.store.countQuads(t.id,`${J}property`,null,null),r=e.config.store.getObjects(e.id,`${J}node`,null);if(r.length!==1||!r[0].equals(t.id)||n!==2||Object.keys(t.properties).length!==2||t.extendedShapes.size||t.or?.length||t.xone?.length||t.nodeKind||t.targetClass||!go(e.config.store,t.id,[`property`]))return;let i=t.properties[ht.value],a=t.properties[gt.value];if(i?.length!==1||a?.length!==1||i[0].minCount!==1||i[0].maxCount!==1||a[0].minCount!==1||a[0].maxCount!==1||i[0].or?.length||i[0].xone?.length||i[0].hasValue||!go(e.config.store,a[0].id,[`path`,`minCount`,`maxCount`,`or`]))return;let o=a[0].or;if(o?.length!==2)return;let s=!1,c=!1;for(let n of o){let r=e.config.store.getQuads(n,null,null,null).filter(e=>e.predicate.value.startsWith(`http://www.w3.org/ns/shacl#`)&&!ho.has(e.predicate.value));s||=r.length===1&&r[0].predicate.value===`http://www.w3.org/ns/shacl#hasValue`&&r[0].object.equals(_t),c||=r.length===1&&r[0].predicate.value===`http://www.w3.org/ns/shacl#node`&&r[0].object.equals(t.id)}return s&&c?i[0]:void 0}function mo(e){return e===void 0||[`http://www.w3.org/ns/shacl#IRI`,`http://www.w3.org/ns/shacl#BlankNode`,`http://www.w3.org/ns/shacl#BlankNodeOrIRI`].includes(e.value)}var ho=new Set([`${J}name`,`${J}description`,`${J}order`,`${J}group`,`${J}message`,`${J}severity`]);function go(e,t,n){let r=new Set(n.map(e=>J+e));return e.getQuads(t,null,null,null).every(e=>!e.predicate.value.startsWith(`http://www.w3.org/ns/shacl#`)||r.has(e.predicate.value)||ho.has(e.predicate.value))}function _o(e,t){return e.some(e=>typeof e.value!=`string`&&e.value.equals(t)||_o(e.children??[],t))}function vo(e){return JSON.stringify(e.map(e=>[typeof e.value==`string`?e.value:`${e.value.termType}:${e.value.value}`,e.label,vo(e.children??[])]))}async function yo(e,t,n=!1,r=!1,i){let a;if(e.nodeShapes.size){a=document.createElement(`div`),a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`);let n=new Set(i?.ancestorShapeIds??[]);i&&n.add(i.template.id.value);for(let i of e.nodeShapes){let o=new Fo(i,t,e.nodeKind,e.label,r,n);a.appendChild(o),await o.ready}}else{let n=ei(e.path,e.datatype?.value);a=n?e.config.editMode&&!r?n.createEditor(e,t):n.createViewer(e,t):zr(e,t||null,e.config.editMode&&!r),a.childNodes.length>0&&(a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`)),r&&a.classList.add(`linked`)}return e.config.editMode&&(!r||n)?bo(a,e.label,e.config.theme.dense,e.config.hierarchyColorsStyleSheet!==void 0,n):e.config.hierarchyColorsStyleSheet!==void 0&&a.appendChild(xo(!0)),t&&!e.config.editMode&&Br(a,t),a.dataset.path=e.path,a}function bo(e,t,n,r,i=!1){let a=xo(r),o=new xa;o.classList.add(`remove-button`,`clear`),o.title=`Remove `+t,o.dense=n,o.icon=!0;let s=o.getAttribute(`part`);o.setAttribute(`part`,`${s?s+` `:``}remove-button`),o.addEventListener(`click`,()=>{e.classList.remove(`fadeIn`),e.classList.add(`fadeOut`),setTimeout(()=>{let t=e.parentElement;e.remove(),t?.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0}))},200)}),i&&o.classList.add(`persistent`),a.appendChild(o),e.appendChild(a)}function xo(e){let t=document.createElement(`div`);return t.className=`remove-button-wrapper`,t.setAttribute(`part`,`remove-controls`),e&&t.classList.add(`colorize`),t}window.customElements.define(`shacl-property`,co);function So(e,t){let n=e,r=t.store.getQuads(e,null,null,null),i=Lt(r,`label`,lt,t.languages);i&&(n=i);let a;if(t.attributes.collapse!==null)a=new Sa,a.classList.add(`collapsible`),a.open=t.attributes.collapse===`open`,a.label=n,a.setAttribute(`part`,`group collapsible`);else{a=document.createElement(`div`);let e=document.createElement(`h1`);e.innerText=n,e.setAttribute(`part`,`group-title`),a.appendChild(e),a.setAttribute(`part`,`group`)}a.dataset.subject=e,a.classList.add(`shacl-group`);let o=parseInt(Lt(r,`order`)??``)||0;return{element:a,order:o}}var Co={[`${J}node`]:(e,t)=>{e.extendedShapes.add(new wo(t,e.config,e))},[`${J}and`]:(e,t)=>{for(let n of e.config.lists[t.value])e.extendedShapes.add(new wo(n,e.config,e))},[`${J}property`]:(e,t)=>{let n=e.config.getPropertyTemplate(t,e),r=Tr(n);if(r){let t=e.properties[r];if(t||(t=[],e.properties[r]=t),n.qualifiedValueShape)t.push(n);else{let i;for(let t=0;t<e.properties[r].length&&!i;t++)e.properties[r][t].qualifiedValueShape||(i=e.properties[r][t]);i?wr(i,n):t.push(n)}}},[`${J}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${J}targetClass`]:(e,t)=>{e.targetClass=t},[`${ot}facet`]:(e,t)=>{e.facet=t.value===`true`||t.value===`1`},[`${J}or`]:(e,t)=>{e.or=e.config.lists[t.value]},[`${J}xone`]:(e,t)=>{e.xone=e.config.lists[t.value]},[xt.id]:(e,t)=>{e.owlImports.add(t)},[`${dt}title`]:(e,t)=>{let n=t;e.label=Yt(e.config.languages,e.label,n)},[`${lt}label`]:(e,t)=>{let n=t;e.label=Yt(e.config.languages,e.label,n)}},wo=class{constructor(e,t,n){this.extendedShapes=new Set,this.properties={},this.owlImports=new Set,this.merged=!1,this.id=e,this.config=t,this.parent=n,t.registerNodeTemplate(this),To(this,this.config.store.getQuads(e,null,null,null))}};function To(e,t){for(let n of t)Co[n.predicate.id]?.call(e,e,n.object);return Eo(e),e}function Eo(e){let t=Object.values(e.properties).flat().filter(e=>e.pathAlternatives?.length),n=new Set;for(let r of t){let t={};r.pathAlternatives.every(n=>{let r=e.properties[n];return r?.length!==1||Do(r[0])?!1:(t[n]=r[0],!0)})&&(r.pathAlternativeBranches=t,r.pathAlternatives.forEach(e=>n.add(e)))}for(let t of n)delete e.properties[t]}function Do(e){return e.minCount!==void 0||e.maxCount!==void 0||e.qualifiedMinCount!==void 0||e.qualifiedMaxCount!==void 0||e.qualifiedValueShape!==void 0}function Oo(e){if(!e.merged){e.merged=!0;for(let t of Object.values(e.properties))for(let n of t){let[t,r]=Po(e,Tr(n)),i=t.some(e=>e.qualifiedValueShape!==void 0),a=ko(t),o=i?a:r;if(t.length>1&&o){let e=t[t.length-1];a&&(e.queryShapePathId=t[0].id.value);for(let n=t.length-2;n>=0;n--){let r=t[n],i=a?e.qualifiedValueShape:void 0;delete r.parent.properties[Tr(r)],wr(e,r,!0),i&&e.nodeShapes.delete(i)}jo(e)}}}}function ko(e){if(e.length<2)return!1;for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(!n.qualifiedValueShape||!r.qualifiedValueShape||!Ao(n.parent,r.parent)||!Ao(n.qualifiedValueShape,r.qualifiedValueShape))return!1}return!0}function Ao(e,t){let n=[...e.extendedShapes],r=new Set;for(;n.length;){let e=n.pop();if(e.id.equals(t.id))return!0;r.has(e)||(r.add(e),n.push(...e.extendedShapes))}return!1}function jo(e){for(let t of[`xone`,`or`]){let n=e[t];if(!n?.length)continue;let r=n.filter(t=>Mo(t,e));r.length>0&&r.length<n.length&&(r.length===1?(e[t]=void 0,Cr(e,e.config.store.getQuads(r[0],null,null,null))):e[t]=r)}}function Mo(e,t){let n=t.config.store.getQuads(e,null,null,null);return No(n,`http://www.w3.org/ns/shacl#datatype`,t.datatype)&&No(n,Dt.id,t.class)&&No(n,`http://www.w3.org/ns/shacl#nodeKind`,t.nodeKind)}function No(e,t,n){if(!n)return!0;let r=!1;for(let i of e)if(i.predicate.value===t&&(r=!0,i.object.equals(n)))return!0;return!r}function Po(e,t,n=new Set,r=[],i=!1){if(!n.has(e.id.value)){n.add(e.id.value);let a=e.properties[t];if(a?.length===1){r.push(a[0]),i||=a[0].maxCount===1;for(let e of a[0].nodeShapes){let[a,o]=Po(e,t,n,r,i);i||=o}}for(let a of e.extendedShapes){let[e,o]=Po(a,t,n,r,i);i||=o}}return[r,i]}var Fo=class e extends HTMLElement{constructor(t,n,r,i,a,o=new Set,s,c=Io.create()){super(),this.template=t,this.linked=a??!1,this.ancestorShapeIds=o,this.queryContext=s,this.bindingContext=c,this.setAttribute(`part`,`node`);let l=n;l||=(!r&&t.nodeKind&&(r=t.nodeKind),r===void 0&&t.config.attributes.valuesNamespace||r?.value===`http://www.w3.org/ns/shacl#IRI`?k.namedNode(t.config.attributes.valuesNamespace+ao()):k.blankNode(ao())),this.nodeId=l;let u=JSON.stringify([t.id,this.nodeId]);if(n&&t.config.renderedNodes.has(u)){i||=`Link`;let e=document.createElement(`label`);e.innerText=i,e.classList.add(`linked`),this.appendChild(e);let t=this.getAttribute(`part`);this.setAttribute(`part`,`${t?t+` `:``}linked-node`),this.dataset.nodeId=this.nodeId.id;let r=document.createElement(`a`),a=n.termType===`BlankNode`?`_:`+n.value:n.value,o=Array.from(this.template.config.form.querySelectorAll(`shacl-node:not([part~="linked-node"])`)).find(e=>e.nodeId.equals(n)),s=new nt;o?.toRDF(s),r.innerText=Bt([...s.getQuads(n,null,null,null),...this.template.config.store.getQuads(n,null,null,null)],this.template.config.languages)||a,r.classList.add(`ref-link`),r.onclick=()=>{this.template.config.form.querySelector(`shacl-node[data-node-id='${a}']:not([part~='linked-node'])`)?.scrollIntoView()},this.appendChild(r),this.style.flexDirection=`row`,this.ready=Promise.resolve()}else{t.config.renderedNodes.add(u);let r=this.ancestorShapeIds,o=this.template.id.value,s=this.queryContext,c=this.bindingContext;if(this.dataset.nodeId=this.nodeId.id,this.template.config.attributes.showNodeIds!==null){let e=document.createElement(`div`);e.innerText=`id: ${this.nodeId.id}`,e.classList.add(`node-id-display`),this.appendChild(e)}Oo(t),this.ready=(async()=>{let l=new Set(r);l.add(o);for(let e of Object.values(t.properties))for(let t of e)await this.addPropertyInstance(t,n,e.length>1);for(let r of t.extendedShapes){let t=new e(r,n,void 0,void 0,a,l,s,c.forInheritedShape());this.prepend(t),await t.ready}if(t.or?.length&&await this.tryResolve(t.or,n,t.config),t.xone?.length&&await this.tryResolve(t.xone,n,t.config),i){let e=document.createElement(`h1`);e.innerText=i,e.setAttribute(`part`,`node-title`),this.prepend(e)}})()}}shouldBindPropertyValue(e){return!this.linked||!this.bindingContext.wasBoundByDescendant(e)}recordBoundPropertyValue(e){this.linked&&this.bindingContext.record(e)}toRDF(e,t,n=``){if(t||=this.nodeId,!this.linked){for(let n of this.querySelectorAll(`:scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property`))n.toRDF(e,t);this.template.targetClass&&e.addQuad(t,mt,this.template.targetClass,this.template.config.valuesGraphId),n&&e.addQuad(t,k.namedNode(n),this.template.id,this.template.config.valuesGraphId)}return t}async addPropertyInstance(e,t,n){let r=null;if(e.group)if(e.config.groups.indexOf(e.group)>-1){let t=this.querySelector(`:scope > .shacl-group[data-subject='${e.group}']`);if(!t){let n=So(e.group,e.config);t=n.element,Ro(this,t,n.order)}r=t}else console.warn(`ignoring unknown group reference`,e.group,`existing groups:`,e.config.groups);let i=new co(e,this);e.config.queryMode?await i.initializeQuery():await i.bindValues(t,n),(e.config.editMode&&!this.linked||e.config.queryMode||i.instanceCount()>0)&&(Ro(r||this,i,e.order),!e.config.queryMode&&!this.linked&&await i.updateControls())}async tryResolve(e,t,n){let r=!1;if(t){let i=Ir(e,t,n);if(i.length){for(let e of i)await this.addPropertyInstance(n.getPropertyTemplate(e,this.template),t);r=!0}}r||this.appendChild(Nr(e,this,n))}},Io=class e{constructor(e){this.boundValues=new Set,this.inheritedValues=new Set(e)}static create(){return new e([])}wasBoundByDescendant(e){return this.inheritedValues.has(this.key(e))}record(e){this.boundValues.add(this.key(e))}forInheritedShape(){return new e([...this.inheritedValues,...this.boundValues])}key(e){return`${e.predicate.id}\0${e.object.id}`}},Lo=new WeakMap;function Ro(e,t,n=0){Lo.set(t,n);let r=Array.from(e.children).find(e=>e!==t&&(Lo.get(e)??0)>n);e.insertBefore(t,r??null)}window.customElements.define(`shacl-node`,Fo);function zo(e){return e.discrete!==!0&&e.datatype!==void 0&&Pt.has(e.datatype)}export{It as $,Nr as A,gr as B,Qr as C,Hr as D,Vr as E,vr as F,sn as G,fr as H,Cr as I,Bt as J,Xt as K,Er as L,yr as M,br as N,Rr as O,Sr as P,yt as Q,hr as R,$r as S,Br as T,Sn as U,pr as V,Vt as W,en as X,tn as Y,pt as Z,Sa as _,s as _t,co as a,Tt as at,ti as b,Xa as c,At as ct,Va as d,nt as dt,Ft as et,Ba as f,N as ft,$ as g,o as gt,Ca as h,j as ht,Oo as i,mt as it,Mr as j,zr as k,za as l,ft as lt,Da as m,M as mt,Fo as n,st as nt,xo as o,wt as ot,wa as p,k as pt,qt as q,wo as r,vt as rt,po as s,kt as st,zo as t,J as tt,Ra as u,Nt as ut,xa as v,l as vt,Yr as w,ei as x,Ea as y,mr as z};
598
+ `}};Q([Z()],Ra.prototype,`pos`,void 0),Q([Z()],Ra.prototype,`minPos`,void 0),Q([Z()],Ra.prototype,`maxPos`,void 0),Q([Z({reflect:!0})],Ra.prototype,`dir`,void 0),Q([Z()],Ra.prototype,`sep`,void 0),Q([Z({reflect:!0,type:Boolean})],Ra.prototype,`dragging`,void 0),Q([Z({reflect:!0,type:Boolean})],Ra.prototype,`hideIndicators`,void 0),Q([Z()],Ra.prototype,`storageKey`,void 0),Q([va(`#separator`)],Ra.prototype,`separator`,void 0),Ra=Q([pa(`rokit-splitpane`)],Ra);function za(e){let t=new Set;for(let n of e.getQuads(null,yt,null,pt))n.subject.termType===`NamedNode`&&t.add(n.subject.value);if(t.size===1)return t.values().next().value}function Ba(e,t){let n=k.namedNode(t);for(let t of e.getObjects(n,yt,pt))if(t.termType===`NamedNode`&&e.getQuads(t,mt,wt,null).length>0)return t}async function Va(e,t){let n={store:new nt,importedUrls:[],atts:e},r=[];if(e.shapes?r.push(Ha(hr({rdf:e.shapes}),n,ft)):e.shapesUrl&&r.push(Ha(hr({url:e.shapesUrl,proxy:n.atts.proxy,rdfUrlResolver:n.atts.rdfUrlResolver}),n,ft)),e.values?r.push(Ha(hr({rdf:e.values}),n,pt,t)):e.valuesUrl&&r.push(Ha(hr({url:e.valuesUrl,proxy:n.atts.proxy,rdfUrlResolver:n.atts.rdfUrlResolver}),n,pt,t)),await Promise.all(r),e.classInstanceProvider)try{let t=on(n.store),r=await e.classInstanceProvider(t);r&&await Ha(hr({rdf:r}),n,ft)}catch(e){console.error(`failed loading class instances`,e)}if(e.valuesSubject||=za(n.store)||null,e.valuesSubject&&n.store.countQuads(null,null,null,ft)===0){let t=[...n.store.getObjects(e.valuesSubject,mt,pt),...n.store.getObjects(e.valuesSubject,yt,pt)],r=[];for(let e of t){let t=Ua(e.value);!t&&e.value.startsWith(`urn:`)&&n.atts.proxy&&(t=e.value),t&&n.importedUrls.indexOf(t)<0&&(n.importedUrls.push(t),r.push(Ha(hr({url:t,proxy:n.atts.proxy,rdfUrlResolver:n.atts.rdfUrlResolver}),n,ft)))}try{await Promise.allSettled(r)}catch(e){console.warn(e)}}return n.store}async function Ha(e,t,n,r){let i=await e,a=[];for(let e of i){r?.add(e);let i=n;if(t.atts.valuesSubject&&pt.equals(n)&&e.graph.id&&e.graph.id!==t.atts.valuesSubject&&(i=e.graph),t.store.add(k.quad(e.subject,e.predicate,e.object,i)),t.atts.loadOwlImports&&xt.equals(e.predicate)){let n=Ua(e.object.value);n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),a.push(Ha(hr({url:n,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,k.namedNode(n))))}}await Promise.allSettled(a)}function Ua(e){if(Jt(e))return e;let t=e.split(`:`);if(t.length===2){let n=mr[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),Jt(e)))return e}return null}async function Wa(e){if(e.template.nodeShapes.size===0)return;let t=e.template.config.resourceLinkProvider;if((!t||t&&!t.lazyLoad)&&(await Ya(e.template),Ka(e).length===0))return;let n=e.template.config.theme.createButton(e.template.label,!1);n.title=`Link existing `+e.template.label,n.classList.add(`link-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}link-button`),n.addEventListener(`click`,async()=>{t?.lazyLoad&&(n.classList.add(`loading`),await Ya(e.template),n.classList.remove(`loading`));let r=Ka(e);if(r.length===0)n.innerText=`No linkable resources found`,n.setAttribute(`disabled`,``),setTimeout(()=>n.remove(),2e3);else{let t=e.template.config.form.querySelector(`#dialog`);t||(t=new Aa,t.classList.add(`link-chooser`),t.closable=!0,e.template.config.form.appendChild(t)),t.title=`Link existing `+e.template.label,Ga(t,e,r),t.open=!0}}),n}function Ga(e,t,n){let r=document.createElement(`div`);for(let i of n){let n=document.createElement(`div`);n.classList.add(`link-option`),n.title=`Link this resource`,n.innerText=i.label||i.value.value,n.addEventListener(`click`,async()=>{await qa(i,t),e.open=!1}),r.appendChild(n)}e.replaceChildren(r)}function Ka(e){let t=e.template.config,n=Ja(e.template),r=new Set(Array.from(e.querySelectorAll(`:scope > .property-instance > shacl-node, :scope > .collapsible > .property-instance > shacl-node`)).map(e=>e.nodeId.id)),i=new Map;for(let a of t.form.querySelectorAll(`shacl-node:not([part~="linked-node"])`)){if(!n.has(a.template.id.value)||r.has(a.nodeId.id))continue;let o=new nt;a.toRDF(o),i.set(a.nodeId.id,{value:a.nodeId,label:Bt([...o.getQuads(a.nodeId,null,null,null),...t.store.getQuads(a.nodeId,null,null,null)],t.languages)||t.providedResourceLabels[a.nodeId.value],template:e.template})}if(t.resourceLinkProvider)for(let a of n)for(let n of t.providedConformingResourceIds[a]??[]){let a=k.namedNode(n);!r.has(a.id)&&!i.has(a.id)&&i.set(a.id,{value:a,label:t.providedResourceLabels[n]||Bt(t.store.getQuads(a,null,null,null),t.languages),template:e.template})}return[...i.values()]}async function qa(e,t){let n=e.value.value;if(e.value.termType===`NamedNode`&&e.template.config.providedResources[n]?.length>0){let t={store:e.template.config.store,importedUrls:[],atts:{loadOwlImports:!1}};await Ha(hr({rdf:e.template.config.providedResources[n]}),t,ft),e.template.config.providedResources[n]=``}let r=await bo(e.template,e.value,!0,!0);t.container.insertBefore(r,t.querySelector(`:scope > .add-button-wrapper`)),await t.updateControls()}function Ja(e){return new Set(Array.from(e.nodeShapes,e=>e.id.value))}async function Ya(e){let t=e.config.resourceLinkProvider;if(!t)return;let n=Ja(e);if(n.size===0)return;let r=sn(Object.keys(e.config.providedConformingResourceIds),n);if(r.length!==0)try{let n=await t.listConformingResources(r,e);if(n){for(let t of Object.keys(n)){let r=new Set(n[t]);e.config.providedConformingResourceIds[t]=r,await Xa(r,!1,e.config)}for(let t of r)e.config.providedConformingResourceIds[t]||(e.config.providedConformingResourceIds[t]=new Set)}}catch(e){console.error(`failed loading conforming resources`,e)}}async function Xa(e,t,n){if(n.resourceLinkProvider&&e.size>0){let r=[];for(let t of e)n.providedResources[t]||r.push(t);if(r.length===0)return[];try{let e=await n.resourceLinkProvider.loadResources(r);if(e){let r={store:n.store,importedUrls:[],atts:{loadOwlImports:!1}};for(let i of e){n.providedResources[i.resourceId]=i.resourceRDF;let e=await hr({rdf:i.resourceRDF});n.providedResourceLabels[i.resourceId]=Bt(e.filter(e=>e.subject.value===i.resourceId),n.languages),t&&await Ha(Promise.resolve(e),r,ft)}return e}for(let e of r)n.providedResources[e]||(n.providedResources[e]=``)}catch(e){console.error(`failed loading resources`,e)}}return[]}async function Za(e){let t=new Set;for(let n of e.store.getQuads(null,null,null,pt))Qa(n.object,e.store)&&t.add(n.object.value);await Xa(t,!0,e)}function Qa(e,t){return e.termType===`NamedNode`&&t.countQuads(e,null,null,null)===0}var $a=[];for(let e=0;e<256;++e)$a.push((e+256).toString(16).slice(1));function eo(e,t=0){return($a[e[t+0]]+$a[e[t+1]]+$a[e[t+2]]+$a[e[t+3]]+`-`+$a[e[t+4]]+$a[e[t+5]]+`-`+$a[e[t+6]]+$a[e[t+7]]+`-`+$a[e[t+8]]+$a[e[t+9]]+`-`+$a[e[t+10]]+$a[e[t+11]]+$a[e[t+12]]+$a[e[t+13]]+$a[e[t+14]]+$a[e[t+15]]).toLowerCase()}var to,no=new Uint8Array(16);function ro(){if(!to){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);to=crypto.getRandomValues.bind(crypto)}return to(no)}var io={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ao(e,t,n){e||={};let r=e.random??e.rng?.()??ro();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return eo(r)}function oo(e,t,n){return io.randomUUID&&!t&&!e?io.randomUUID():ao(e,t,n)}var so=`:scope > .add-button-wrapper, :scope > .collapsible > .add-button-wrapper`,co=`:scope > .property-instance, :scope > .shacl-or-constraint, :scope > .alternative-path-constraint, :scope > shacl-node, :scope > .collapsible > .property-instance, :scope > .collapsible > .alternative-path-constraint`,lo=class extends HTMLElement{constructor(e,t){if(super(),this.rdfListNodes=new WeakMap,this.rdfListGroups=new WeakMap,this.template=e,this.parent=t,this.rdfListItemTemplate=mo(e),this.container=this,this.setAttribute(`part`,`property`),this.template.nodeShapes.size&&this.template.config.attributes.collapse!==null&&(this.template.maxCount===void 0||this.template.maxCount>1)){let t=new Ca;t.classList.add(`collapsible`,`shacl-group`),t.open=e.config.attributes.collapse===`open`,t.label=this.template.label,t.setAttribute(`part`,`collapsible`),this.container=t,this.appendChild(this.container)}this.template.cssClass&&this.classList.add(this.template.cssClass),e.config.editMode&&!t.linked&&this.addEventListener(`change`,async()=>{await this.updateControls()})}async bindValues(e,t){if(this.template.path){let n=!1;if(e){let r=(this.template.pathAlternatives??[this.template.path]).flatMap(t=>this.template.config.store.getQuads(e,t,null,this.parent.linked?null:pt));t&&(r=await this.filterValidValues(r,e)),r=r.filter(e=>this.parent.shouldBindPropertyValue(e));for(let e of r){this.parent.linked||this.template.config.store.delete(e);let t=!pt.equals(e.graph)||this.template.config.providedResources[e.object.value]!==void 0;(this.rdfListItemTemplate?await this.bindRdfList(e.object,t):await this.addPropertyInstance(e.object,t,this.template.config.providedResources[e.object.value]!==void 0,e.predicate.value))&&this.parent.recordBoundPropertyValue(e),this.template.hasValue&&e.object.equals(this.template.hasValue)&&(n=!0)}}this.template.config.editMode&&this.template.hasValue&&!n&&!this.parent.linked&&await this.addPropertyInstance(this.template.hasValue)}}async initializeQuery(){let{initializeQueryProperty:e}=await Nr(async()=>{let{initializeQueryProperty:e}=await import(`./mode-DQMbYnAU.js`);return{initializeQueryProperty:e}},[]);await e(this)}async addPropertyInstance(e,t,n=!1,r,i=!0){if(this.rdfListItemTemplate)return this.addRdfListItem(e,t,n,i);let a;if(this.template.pathAlternatives&&!r)this.template.config.editMode&&(a=Fr(this,e,t,n));else{let i=r?this.template.pathAlternativeBranches?.[r]:void 0,o=r&&(r!==this.template.path||i)?Cr(this.template):this.template;if(r&&(o.path=r),i&&(Tr(o,i,!0),o.label=i.name?.value||i.label||o.label),o.or?.length||o.xone?.length){let t=o.or?.length?o.or:o.xone,i=!1;if(e){let n=Ir(t,e,o.config);n.length&&(a=await bo(wr(Cr(o),n),e,!this.parent.linked,this.parent.linked,this.parent),i=!0)}!i&&o.config.editMode&&(a=Pr(t,this,o.config,r,o),xo(a,``,o.config.theme.dense,o.config.hierarchyColorsStyleSheet!==void 0,n))}else a=await bo(o,e,n,t||this.parent.linked,this.parent)}return a&&(a.dataset.path=this.template.path,r&&(a.dataset.predicate=r),i&&this.container.insertBefore(a,this.querySelector(so))),a}async updateControls(){this.template.config.editMode&&!this.parent.linked&&!this.querySelector(so)&&this.container.appendChild(await this.createAddControls());let e=this.rdfListItemTemplate?+(xr(this.template)>0):xr(this.template),t=this.rdfListItemTemplate?this.rdfListItemTemplate.nodeShapes.size===0:this.template.nodeShapes.size===0,n=this.querySelector(`:scope > .add-button-wrapper > .link-button, :scope > .collapsible > .add-button-wrapper > .link-button`)===null,r=t||!this.hasRecursiveNodeShape(),i=this.instanceCount();i===0&&r&&(t||n&&e>0)&&(await this.addPropertyInstance(),i=1),t||this.querySelector(so)?.classList.toggle(`required`,i<e);let a;a=e>0?i>e:!t||i>1;let o=this.rdfListItemTemplate!==void 0&&this.querySelector(`:scope > .property-instance.linked, :scope > .collapsible > .property-instance.linked`)!==null,s=new Set(uo(this).map(e=>this.rdfListGroups.get(e))).size,c=this.rdfListItemTemplate!==void 0&&!o&&s<=1||i<Sr(this.template);this.classList.toggle(`may-remove`,a),this.classList.toggle(`may-add`,c)}instanceCount(){return this.querySelectorAll(co).length}refreshClassInstances(){if(!(!this.template.class||this.template.hasValue||!this.template.config.editMode))for(let e of this.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`)){let t=e.querySelector(`:scope > .editor`);if(!t||t.dataset.class!==this.template.class.value)continue;let n=Gr(t),r=qt(this.template.class,this.template);n&&!vo(r,n)&&r.push({value:n,children:[]});let i=yo(r);if(t.dataset.classInstances===i)continue;let a=this.template.config.theme.createListEditor(this.template.label,n??null,xr(this.template)>0,r,this.template).querySelector(`.editor`);a.dataset.classInstances=i,t.replaceWith(a)}}hasRecursiveNodeShape(){let e=new Set;this.parent.ancestorShapeIds.forEach(t=>e.add(t)),e.add(this.parent.template.id.value);for(let t of this.template.nodeShapes)if(e.has(t.id.value))return!0;return!1}toRDF(e,t){if(this.rdfListItemTemplate){this.rdfListToRDF(e,t);return}for(let n of this.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`)){let r=k.namedNode(n.dataset.predicate??this.template.path);if(n.firstChild instanceof Io){let i=n.firstChild.toRDF(e);e.addQuad(t,r,i,this.template.config.valuesGraphId)}else if(this.template.config.editMode)for(let i of n.querySelectorAll(`:scope > .editor`)){let n=Gr(i);n&&e.addQuad(t,r,n,this.template.config.valuesGraphId)}else{let i=Gr(n);i&&e.addQuad(t,r,i,this.template.config.valuesGraphId)}}}async filterValidValues(e,t){let n=this.template.id,r=[t];if(this.template.qualifiedValueShape){n=this.template.qualifiedValueShape.id,r=[];for(let t of e)r.push(t.object)}let i=await this.template.config.validator.validate({dataset:this.template.config.store,terms:r},[{terms:[n]}]),a=new Set;for(let e of i.results){let t=this.template.qualifiedValueShape?e.focusNode:e.value;t?.ptrs?.length&&a.add(t.ptrs[0]._term.id)}return e.filter(e=>!a.has(e.object.id))}async createAddControls(){let e=document.createElement(`div`);e.classList.add(`add-button-wrapper`),e.setAttribute(`part`,`add-controls`);let t=this.rdfListItemTemplate?void 0:await Wa(this);t&&e.appendChild(t);let n=this.template.config.theme.createButton(this.template.label,!1);n.title=`Add `+this.template.label,n.classList.add(`add-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}add-button`),n.addEventListener(`click`,async()=>{let e=await this.addPropertyInstance();e&&(e.classList.add(`fadeIn`),await this.updateControls(),this.template.nodeShapes.size&&this.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0})),setTimeout(()=>{zt(e),e.classList.remove(`fadeIn`)},200))}),e.appendChild(n),e}async bindRdfList(e,t){if(e.termType!==`NamedNode`&&e.termType!==`BlankNode`)return;let n=e,r=new Set,i;for(;!n.equals(_t)&&!r.has(n.id);){r.add(n.id);let a=t?null:pt,o=this.template.config.store.getQuads(n,ht,null,a)[0];if(!o)break;let s=this.template.config.store.getQuads(n,gt,null,a)[0];t||(this.template.config.store.delete(o),s&&this.template.config.store.delete(s));let c=await this.addRdfListItem(o.object,t,!1,!0,n,fo(e));if(i||=c,!s||s.object.termType!==`NamedNode`&&s.object.termType!==`BlankNode`)break;n=s.object}return i}async addRdfListItem(e,t=!1,n=!1,r=!0,i,a){let o=Cr(this.rdfListItemTemplate);o.label=this.template.label;let s=await bo(o,e,n,t||this.parent.linked,this.parent);s.dataset.path=this.template.path;let c=uo(this).map(e=>this.rdfListGroups.get(e)).find(e=>e!==void 0),l=i??this.createRdfListNode(c===void 0);return this.rdfListNodes.set(s,l),this.rdfListGroups.set(s,a??c??fo(l)),r&&this.container.insertBefore(s,this.querySelector(so)),s}createRdfListNode(e){return e&&this.template.nodeKind?.value===`http://www.w3.org/ns/shacl#IRI`?k.namedNode(this.template.config.attributes.valuesNamespace+oo()):k.blankNode()}rdfListToRDF(e,t){let n=new Map;for(let t of uo(this)){let r=this.rdfListNodes.get(t)??k.blankNode(),i=this.rdfListGroups.get(t)??fo(r),a=t.classList.contains(`linked`),o;if(!a&&t.firstChild instanceof Io)o=t.firstChild.toRDF(e);else if(!a&&this.template.config.editMode){let e=t.querySelector(`:scope > .editor`);o=e?Gr(e):void 0}else a||(o=Gr(t));if(a||o){let e=n.get(i)??[];e.push({instance:t,node:r,value:o,linked:a}),n.set(i,e)}}let r=new Set([...n.values()].flatMap(e=>e.map(e=>fo(e.node)))),i=new Map([...n.values()].flatMap(e=>e.filter(e=>!e.linked&&e.value).map(e=>[fo(e.node),fo(e.value)]))),a=new Set([...n.values()].filter(e=>e[0]?.linked).map(e=>fo(e[0].node)));this.removePreservedRdfList(e,t,r,i,a);for(let r of n.values())e.addQuad(t,k.namedNode(this.template.path),r[0].node,this.template.config.valuesGraphId),!r[0].linked&&(this.template.class&&e.addQuad(r[0].node,mt,this.template.class,this.template.config.valuesGraphId),r.forEach(({node:t,value:n},i)=>{e.addQuad(t,ht,n,this.template.config.valuesGraphId),e.addQuad(t,gt,r[i+1]?.node??_t,this.template.config.valuesGraphId)}))}removePreservedRdfList(e,t,n,r,i){if(this.template.config.attributes.preserveUnmappedValues===null)return;let a=this.template.config.originalValues,o=a.getObjects(t,k.namedNode(this.template.path),null),s=new Map,c=[];for(let t of o){if(t.termType!==`NamedNode`&&t.termType!==`BlankNode`||i.has(fo(t)))continue;let n=t,o=new Set;for(;!n.equals(_t)&&!o.has(n.id);){o.add(n.id),s.set(fo(n),n);let t=a.getQuads(n,gt,null,null)[0];for(let t of e.getQuads(n,ht,null,null)){e.delete(t);let i=r.get(fo(n));t.object.termType===`BlankNode`&&fo(t.object)!==i&&c.push(t.object)}for(let t of e.getQuads(n,gt,null,null))e.delete(t);if(!t||t.object.termType!==`NamedNode`&&t.object.termType!==`BlankNode`)break;n=t.object}}for(let t of s.values())if(t.termType===`BlankNode`&&!n.has(fo(t))&&e.countQuads(null,null,t,null)===0)for(let n of e.getQuads(t,null,null,null))e.delete(n),n.object.termType===`BlankNode`&&c.push(n.object);po(e,c)}};function uo(e){return Array.from(e.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`))}function fo(e){return`${e.termType}:${e.value}`}function po(e,t){let n=new Set;for(;t.length;){let r=t.pop();if(!(n.has(r.id)||e.countQuads(null,null,r,null)>0)){n.add(r.id);for(let n of e.getQuads(r,null,null,null))e.delete(n),n.object.termType===`BlankNode`&&t.push(n.object)}}}function mo(e){if(e.maxCount!==1||e.nodeShapes.size!==1||!ho(e.nodeKind)||!_o(e.config.store,e.id,[`path`,`minCount`,`maxCount`,`node`,`nodeKind`,`class`]))return;let t=[...e.nodeShapes][0],n=e.config.store.countQuads(t.id,`${J}property`,null,null),r=e.config.store.getObjects(e.id,`${J}node`,null);if(r.length!==1||!r[0].equals(t.id)||n!==2||Object.keys(t.properties).length!==2||t.extendedShapes.size||t.or?.length||t.xone?.length||t.nodeKind||t.targetClass||!_o(e.config.store,t.id,[`property`]))return;let i=t.properties[ht.value],a=t.properties[gt.value];if(i?.length!==1||a?.length!==1||i[0].minCount!==1||i[0].maxCount!==1||a[0].minCount!==1||a[0].maxCount!==1||i[0].or?.length||i[0].xone?.length||i[0].hasValue||!_o(e.config.store,a[0].id,[`path`,`minCount`,`maxCount`,`or`]))return;let o=a[0].or;if(o?.length!==2)return;let s=!1,c=!1;for(let n of o){let r=e.config.store.getQuads(n,null,null,null).filter(e=>e.predicate.value.startsWith(`http://www.w3.org/ns/shacl#`)&&!go.has(e.predicate.value));s||=r.length===1&&r[0].predicate.value===`http://www.w3.org/ns/shacl#hasValue`&&r[0].object.equals(_t),c||=r.length===1&&r[0].predicate.value===`http://www.w3.org/ns/shacl#node`&&r[0].object.equals(t.id)}return s&&c?i[0]:void 0}function ho(e){return e===void 0||[`http://www.w3.org/ns/shacl#IRI`,`http://www.w3.org/ns/shacl#BlankNode`,`http://www.w3.org/ns/shacl#BlankNodeOrIRI`].includes(e.value)}var go=new Set([`${J}name`,`${J}description`,`${J}order`,`${J}group`,`${J}message`,`${J}severity`]);function _o(e,t,n){let r=new Set(n.map(e=>J+e));return e.getQuads(t,null,null,null).every(e=>!e.predicate.value.startsWith(`http://www.w3.org/ns/shacl#`)||r.has(e.predicate.value)||go.has(e.predicate.value))}function vo(e,t){return e.some(e=>typeof e.value!=`string`&&e.value.equals(t)||vo(e.children??[],t))}function yo(e){return JSON.stringify(e.map(e=>[typeof e.value==`string`?e.value:`${e.value.termType}:${e.value.value}`,e.label,yo(e.children??[])]))}async function bo(e,t,n=!1,r=!1,i){let a;if(e.nodeShapes.size){a=document.createElement(`div`),a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`);let n=new Set(i?.ancestorShapeIds??[]);i&&n.add(i.template.id.value);for(let i of e.nodeShapes){let o=new Io(i,t,e.nodeKind,e.label,r,n);a.appendChild(o),await o.ready}}else{let n=ti(e.path,e.datatype?.value);a=n?e.config.editMode&&!r?n.createEditor(e,t):n.createViewer(e,t):Br(e,t||null,e.config.editMode&&!r),a.childNodes.length>0&&(a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`)),r&&a.classList.add(`linked`)}return e.config.editMode&&(!r||n)?xo(a,e.label,e.config.theme.dense,e.config.hierarchyColorsStyleSheet!==void 0,n):e.config.hierarchyColorsStyleSheet!==void 0&&a.appendChild(So(!0)),t&&!e.config.editMode&&Vr(a,t),a.dataset.path=e.path,a}function xo(e,t,n,r,i=!1){let a=So(r),o=new Sa;o.classList.add(`remove-button`,`clear`),o.title=`Remove `+t,o.dense=n,o.icon=!0;let s=o.getAttribute(`part`);o.setAttribute(`part`,`${s?s+` `:``}remove-button`),o.addEventListener(`click`,()=>{e.classList.remove(`fadeIn`),e.classList.add(`fadeOut`),setTimeout(()=>{let t=e.parentElement;e.remove(),t?.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0}))},200)}),i&&o.classList.add(`persistent`),a.appendChild(o),e.appendChild(a)}function So(e){let t=document.createElement(`div`);return t.className=`remove-button-wrapper`,t.setAttribute(`part`,`remove-controls`),e&&t.classList.add(`colorize`),t}window.customElements.define(`shacl-property`,lo);function Co(e,t){let n=e,r=t.store.getQuads(e,null,null,null),i=Lt(r,`label`,lt,t.languages);i&&(n=i);let a;if(t.attributes.collapse!==null)a=new Ca,a.classList.add(`collapsible`),a.open=t.attributes.collapse===`open`,a.label=n,a.setAttribute(`part`,`group collapsible`);else{a=document.createElement(`div`);let e=document.createElement(`h1`);e.innerText=n,e.setAttribute(`part`,`group-title`),a.appendChild(e),a.setAttribute(`part`,`group`)}a.dataset.subject=e,a.classList.add(`shacl-group`);let o=parseInt(Lt(r,`order`)??``)||0;return{element:a,order:o}}var wo={[`${J}node`]:(e,t)=>{e.extendedShapes.add(new To(t,e.config,e))},[`${J}and`]:(e,t)=>{for(let n of e.config.lists[t.value])e.extendedShapes.add(new To(n,e.config,e))},[`${J}property`]:(e,t)=>{let n=e.config.getPropertyTemplate(t,e),r=Er(n);if(r){let t=e.properties[r];if(t||(t=[],e.properties[r]=t),n.qualifiedValueShape)t.push(n);else{let i;for(let t=0;t<e.properties[r].length&&!i;t++)e.properties[r][t].qualifiedValueShape||(i=e.properties[r][t]);i?Tr(i,n):t.push(n)}}},[`${J}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${J}targetClass`]:(e,t)=>{e.targetClass=t},[`${ot}facet`]:(e,t)=>{e.facet=t.value===`true`||t.value===`1`},[`${J}or`]:(e,t)=>{e.or=e.config.lists[t.value]},[`${J}xone`]:(e,t)=>{e.xone=e.config.lists[t.value]},[xt.id]:(e,t)=>{e.owlImports.add(t)},[`${dt}title`]:(e,t)=>{let n=t;e.label=Xt(e.config.languages,e.label,n)},[`${lt}label`]:(e,t)=>{let n=t;e.label=Xt(e.config.languages,e.label,n)}},To=class{constructor(e,t,n){this.extendedShapes=new Set,this.properties={},this.owlImports=new Set,this.merged=!1,this.id=e,this.config=t,this.parent=n,t.registerNodeTemplate(this),Eo(this,this.config.store.getQuads(e,null,null,null))}};function Eo(e,t){for(let n of t)wo[n.predicate.id]?.call(e,e,n.object);return Do(e),e}function Do(e){let t=Object.values(e.properties).flat().filter(e=>e.pathAlternatives?.length),n=new Set;for(let r of t){let t={};r.pathAlternatives.every(n=>{let r=e.properties[n];return r?.length!==1||Oo(r[0])?!1:(t[n]=r[0],!0)})&&(r.pathAlternativeBranches=t,r.pathAlternatives.forEach(e=>n.add(e)))}for(let t of n)delete e.properties[t]}function Oo(e){return e.minCount!==void 0||e.maxCount!==void 0||e.qualifiedMinCount!==void 0||e.qualifiedMaxCount!==void 0||e.qualifiedValueShape!==void 0}function ko(e){if(!e.merged){e.merged=!0;for(let t of Object.values(e.properties))for(let n of t){let[t,r]=Fo(e,Er(n)),i=t.some(e=>e.qualifiedValueShape!==void 0),a=Ao(t),o=i?a:r;if(t.length>1&&o){let e=t[t.length-1];a&&(e.queryShapePathId=t[0].id.value);for(let n=t.length-2;n>=0;n--){let r=t[n],i=a?e.qualifiedValueShape:void 0;delete r.parent.properties[Er(r)],Tr(e,r,!0),i&&e.nodeShapes.delete(i)}Mo(e)}}}}function Ao(e){if(e.length<2)return!1;for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(!n.qualifiedValueShape||!r.qualifiedValueShape||!jo(n.parent,r.parent)||!jo(n.qualifiedValueShape,r.qualifiedValueShape))return!1}return!0}function jo(e,t){let n=[...e.extendedShapes],r=new Set;for(;n.length;){let e=n.pop();if(e.id.equals(t.id))return!0;r.has(e)||(r.add(e),n.push(...e.extendedShapes))}return!1}function Mo(e){for(let t of[`xone`,`or`]){let n=e[t];if(!n?.length)continue;let r=n.filter(t=>No(t,e));r.length>0&&r.length<n.length&&(r.length===1?(e[t]=void 0,wr(e,e.config.store.getQuads(r[0],null,null,null))):e[t]=r)}}function No(e,t){let n=t.config.store.getQuads(e,null,null,null);return Po(n,`http://www.w3.org/ns/shacl#datatype`,t.datatype)&&Po(n,Dt.id,t.class)&&Po(n,`http://www.w3.org/ns/shacl#nodeKind`,t.nodeKind)}function Po(e,t,n){if(!n)return!0;let r=!1;for(let i of e)if(i.predicate.value===t&&(r=!0,i.object.equals(n)))return!0;return!r}function Fo(e,t,n=new Set,r=[],i=!1){if(!n.has(e.id.value)){n.add(e.id.value);let a=e.properties[t];if(a?.length===1){r.push(a[0]),i||=a[0].maxCount===1;for(let o of a[0].nodeShapes)if(jo(o,e)){let[e,a]=Fo(o,t,n,r,i);i||=a}}for(let a of e.extendedShapes){let[e,o]=Fo(a,t,n,r,i);i||=o}}return[r,i]}var Io=class e extends HTMLElement{constructor(t,n,r,i,a,o=new Set,s,c=Lo.create()){super(),this.template=t,this.linked=a??!1,this.ancestorShapeIds=o,this.queryContext=s,this.bindingContext=c,this.setAttribute(`part`,`node`);let l=n;l||=(!r&&t.nodeKind&&(r=t.nodeKind),r===void 0&&t.config.attributes.valuesNamespace||r?.value===`http://www.w3.org/ns/shacl#IRI`?k.namedNode(t.config.attributes.valuesNamespace+oo()):k.blankNode(oo())),this.nodeId=l;let u=JSON.stringify([t.id,this.nodeId]);if(n&&t.config.renderedNodes.has(u)){i||=`Link`;let e=document.createElement(`label`);e.innerText=i,e.classList.add(`linked`),this.appendChild(e);let t=this.getAttribute(`part`);this.setAttribute(`part`,`${t?t+` `:``}linked-node`),this.dataset.nodeId=this.nodeId.id;let r=document.createElement(`a`),a=n.termType===`BlankNode`?`_:`+n.value:n.value,o=Array.from(this.template.config.form.querySelectorAll(`shacl-node:not([part~="linked-node"])`)).find(e=>e.nodeId.equals(n)),s=new nt;o?.toRDF(s),r.innerText=Bt([...s.getQuads(n,null,null,null),...this.template.config.store.getQuads(n,null,null,null)],this.template.config.languages)||a,r.classList.add(`ref-link`),r.onclick=()=>{this.template.config.form.querySelector(`shacl-node[data-node-id='${a}']:not([part~='linked-node'])`)?.scrollIntoView()},this.appendChild(r),this.style.flexDirection=`row`,this.ready=Promise.resolve()}else{t.config.renderedNodes.add(u);let r=this.ancestorShapeIds,o=this.template.id.value,s=this.queryContext,c=this.bindingContext;if(this.dataset.nodeId=this.nodeId.id,this.template.config.attributes.showNodeIds!==null){let e=document.createElement(`div`);e.innerText=`id: ${this.nodeId.id}`,e.classList.add(`node-id-display`),this.appendChild(e)}ko(t),this.ready=(async()=>{let l=new Set(r);l.add(o);for(let e of Object.values(t.properties))for(let t of e)await this.addPropertyInstance(t,n,e.length>1);for(let r of t.extendedShapes){let t=new e(r,n,void 0,void 0,a,l,s,c.forInheritedShape());this.prepend(t),await t.ready}if(t.or?.length&&await this.tryResolve(t.or,n,t.config),t.xone?.length&&await this.tryResolve(t.xone,n,t.config),i){let e=document.createElement(`h1`);e.innerText=i,e.setAttribute(`part`,`node-title`),this.prepend(e)}})()}}shouldBindPropertyValue(e){return!this.linked||!this.bindingContext.wasBoundByDescendant(e)}recordBoundPropertyValue(e){this.linked&&this.bindingContext.record(e)}toRDF(e,t,n=``){if(t||=this.nodeId,!this.linked){for(let n of this.querySelectorAll(`:scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property`))n.toRDF(e,t);this.template.targetClass&&e.addQuad(t,mt,this.template.targetClass,this.template.config.valuesGraphId),n&&e.addQuad(t,k.namedNode(n),this.template.id,this.template.config.valuesGraphId)}return t}async addPropertyInstance(e,t,n){let r=null;if(e.group)if(e.config.groups.indexOf(e.group)>-1){let t=this.querySelector(`:scope > .shacl-group[data-subject='${e.group}']`);if(!t){let n=Co(e.group,e.config);t=n.element,zo(this,t,n.order)}r=t}else console.warn(`ignoring unknown group reference`,e.group,`existing groups:`,e.config.groups);let i=new lo(e,this);e.config.queryMode?await i.initializeQuery():await i.bindValues(t,n),(e.config.editMode&&!this.linked||e.config.queryMode||i.instanceCount()>0)&&(zo(r||this,i,e.order),!e.config.queryMode&&!this.linked&&await i.updateControls())}async tryResolve(e,t,n){let r=!1;if(t){let i=Lr(e,t,n);if(i.length){for(let e of i)await this.addPropertyInstance(n.getPropertyTemplate(e,this.template),t);r=!0}}r||this.appendChild(Pr(e,this,n))}},Lo=class e{constructor(e){this.boundValues=new Set,this.inheritedValues=new Set(e)}static create(){return new e([])}wasBoundByDescendant(e){return this.inheritedValues.has(this.key(e))}record(e){this.boundValues.add(this.key(e))}forInheritedShape(){return new e([...this.inheritedValues,...this.boundValues])}key(e){return`${e.predicate.id}\0${e.object.id}`}},Ro=new WeakMap;function zo(e,t,n=0){Ro.set(t,n);let r=Array.from(e.children).find(e=>e!==t&&(Ro.get(e)??0)>n);e.insertBefore(t,r??null)}window.customElements.define(`shacl-node`,Io);function Bo(e){return e.discrete!==!0&&e.datatype!==void 0&&Pt.has(e.datatype)}export{yt as $,Pr as A,_r as B,$r as C,Ur as D,Hr as E,yr as F,Vt as G,pr as H,wr as I,qt as J,cn as K,Dr as L,br as M,xr as N,zr as O,Cr as P,pt as Q,gr as R,ei as S,Vr as T,Cn as U,mr as V,Yt as W,nn as X,Bt as Y,tn as Z,Ca as _,o as _t,lo as a,mt as at,ni as b,Za as c,kt as ct,Ha as d,Nt as dt,It as et,Va as f,nt as ft,$ as g,j as gt,wa as h,M as ht,ko as i,vt as it,Nr as j,Br as k,Ba as l,At as lt,Oa as m,k as mt,Io as n,J as nt,So as o,Tt as ot,Ta as p,N as pt,Zt as q,To as r,st as rt,mo as s,wt as st,Bo as t,Ft as tt,za as u,ft as ut,Sa as v,s as vt,Xr as w,ti as x,Da as y,l as yt,hr as z};