@ulb-darmstadt/shacl-form 1.10.1 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ var un=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"
24
24
  `:`
25
25
  }
26
26
  `),this._subject=null),this._write=this._blockedWrite;let t=e&&((r,n)=>{t=null,e(r,n)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function Fd(i){let e=Gm[i];return e===void 0&&(i.length===1?(e=i.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var aa={exports:{}},la={exports:{}},ca,jd;function ut(){if(jd)return ca;jd=1;class i extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let r="";for(let n=0;n<t.length;n++)r+=` ${t[n].stack}
27
- `;super(r),this.name="AggregateError",this.errors=t}}return ca={AggregateError:i,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,r){return e.slice(t,r)},Error,FunctionPrototypeCall(e,t,...r){return e.call(t,...r)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,r){return Object.defineProperty(e,t,r)},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,r){return e.then(t,r)},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,r){return e.slice(t,r)},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,r){return e.set(t,r)},Boolean,Uint8Array},ca}var da={exports:{}},ua,Bd;function Wf(){return Bd||(Bd=1,ua={format(i,...e){return i.replace(/%([sdifj])/g,function(...[t,r]){const n=e.shift();return r==="f"?n.toFixed(6):r==="j"?JSON.stringify(n):r==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(i){switch(typeof i){case"string":if(i.includes("'"))if(i.includes('"')){if(!i.includes("`")&&!i.includes("${"))return`\`${i}\``}else return`"${i}"`;return`'${i}'`;case"number":return isNaN(i)?"NaN":Object.is(i,-0)?String(i):i;case"bigint":return`${String(i)}n`;case"boolean":case"undefined":return String(i);case"object":return"{}"}}}),ua}var ha,qd;function Jt(){if(qd)return ha;qd=1;const{format:i,inspect:e}=Wf(),{AggregateError:t}=ut(),r=globalThis.AggregateError||t,n=Symbol("kIsNodeError"),s=["string","function","number","object","Function","Object","boolean","bigint","symbol"],o=/^([A-Z][a-z0-9]*)+$/,a="__node_internal_",c={};function l(E,x){if(!E)throw new c.ERR_INTERNAL_ASSERTION(x)}function d(E){let x="",k=E.length;const y=E[0]==="-"?1:0;for(;k>=y+4;k-=3)x=`_${E.slice(k-3,k)}${x}`;return`${E.slice(0,k)}${x}`}function u(E,x,k){if(typeof x=="function")return l(x.length<=k.length,`Code: ${E}; The provided arguments length (${k.length}) does not match the required ones (${x.length}).`),x(...k);const y=(x.match(/%[dfijoOs]/g)||[]).length;return l(y===k.length,`Code: ${E}; The provided arguments length (${k.length}) does not match the required ones (${y}).`),k.length===0?x:i(x,...k)}function m(E,x,k){k||(k=Error);class y extends k{constructor(...p){super(u(E,x,p))}toString(){return`${this.name} [${E}]: ${this.message}`}}Object.defineProperties(y.prototype,{name:{value:k.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${E}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),y.prototype.code=E,y.prototype[n]=!0,c[E]=y}function g(E){const x=a+E.name;return Object.defineProperty(E,"name",{value:x}),E}function v(E,x){if(E&&x&&E!==x){if(Array.isArray(x.errors))return x.errors.push(E),x;const k=new r([x,E],x.message);return k.code=x.code,k}return E||x}class _ extends Error{constructor(x="The operation was aborted",k=void 0){if(k!==void 0&&typeof k!="object")throw new c.ERR_INVALID_ARG_TYPE("options","Object",k);super(x,k),this.code="ABORT_ERR",this.name="AbortError"}}return m("ERR_ASSERTION","%s",Error),m("ERR_INVALID_ARG_TYPE",(E,x,k)=>{l(typeof E=="string","'name' must be a string"),Array.isArray(x)||(x=[x]);let y="The ";E.endsWith(" argument")?y+=`${E} `:y+=`"${E}" ${E.includes(".")?"property":"argument"} `,y+="must be ";const h=[],p=[],T=[];for(const C of x)l(typeof C=="string","All expected entries have to be of type string"),s.includes(C)?h.push(C.toLowerCase()):o.test(C)?p.push(C):(l(C!=="object",'The value "object" should be written as "Object"'),T.push(C));if(p.length>0){const C=h.indexOf("object");C!==-1&&(h.splice(h,C,1),p.push("Object"))}if(h.length>0){switch(h.length){case 1:y+=`of type ${h[0]}`;break;case 2:y+=`one of type ${h[0]} or ${h[1]}`;break;default:{const C=h.pop();y+=`one of type ${h.join(", ")}, or ${C}`}}(p.length>0||T.length>0)&&(y+=" or ")}if(p.length>0){switch(p.length){case 1:y+=`an instance of ${p[0]}`;break;case 2:y+=`an instance of ${p[0]} or ${p[1]}`;break;default:{const C=p.pop();y+=`an instance of ${p.join(", ")}, or ${C}`}}T.length>0&&(y+=" or ")}switch(T.length){case 0:break;case 1:T[0].toLowerCase()!==T[0]&&(y+="an "),y+=`${T[0]}`;break;case 2:y+=`one of ${T[0]} or ${T[1]}`;break;default:{const C=T.pop();y+=`one of ${T.join(", ")}, or ${C}`}}if(k==null)y+=`. Received ${k}`;else if(typeof k=="function"&&k.name)y+=`. Received function ${k.name}`;else if(typeof k=="object"){var N;if((N=k.constructor)!==null&&N!==void 0&&N.name)y+=`. Received an instance of ${k.constructor.name}`;else{const C=e(k,{depth:-1});y+=`. Received ${C}`}}else{let C=e(k,{colors:!1});C.length>25&&(C=`${C.slice(0,25)}...`),y+=`. Received type ${typeof k} (${C})`}return y},TypeError),m("ERR_INVALID_ARG_VALUE",(E,x,k="is invalid")=>{let y=e(x);return y.length>128&&(y=y.slice(0,128)+"..."),`The ${E.includes(".")?"property":"argument"} '${E}' ${k}. Received ${y}`},TypeError),m("ERR_INVALID_RETURN_VALUE",(E,x,k)=>{var y;const h=k!=null&&(y=k.constructor)!==null&&y!==void 0&&y.name?`instance of ${k.constructor.name}`:`type ${typeof k}`;return`Expected ${E} to be returned from the "${x}" function but got ${h}.`},TypeError),m("ERR_MISSING_ARGS",(...E)=>{l(E.length>0,"At least one arg needs to be specified");let x;const k=E.length;switch(E=(Array.isArray(E)?E:[E]).map(y=>`"${y}"`).join(" or "),k){case 1:x+=`The ${E[0]} argument`;break;case 2:x+=`The ${E[0]} and ${E[1]} arguments`;break;default:{const y=E.pop();x+=`The ${E.join(", ")}, and ${y} arguments`}break}return`${x} must be specified`},TypeError),m("ERR_OUT_OF_RANGE",(E,x,k)=>{l(x,'Missing "range" argument');let y;if(Number.isInteger(k)&&Math.abs(k)>2**32)y=d(String(k));else if(typeof k=="bigint"){y=String(k);const h=BigInt(2)**BigInt(32);(k>h||k<-h)&&(y=d(y)),y+="n"}else y=e(k);return`The value of "${E}" is out of range. It must be ${x}. Received ${y}`},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),ha={AbortError:_,aggregateTwoErrors:g(v),hideStackFrames:g,codes:c},ha}var Kn={exports:{}},Ud;function Cs(){if(Ud)return Kn.exports;Ud=1;const{AbortController:i,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Kn.exports=i,Kn.exports.AbortSignal=e,Kn.exports.default=i,Kn.exports}var ro={exports:{}},Vd;function Bo(){if(Vd)return ro.exports;Vd=1;var i=typeof Reflect=="object"?Reflect:null,e=i&&typeof i.apply=="function"?i.apply:function(p,T,N){return Function.prototype.apply.call(p,T,N)},t;i&&typeof i.ownKeys=="function"?t=i.ownKeys:Object.getOwnPropertySymbols?t=function(p){return Object.getOwnPropertyNames(p).concat(Object.getOwnPropertySymbols(p))}:t=function(p){return Object.getOwnPropertyNames(p)};function r(h){console&&console.warn&&console.warn(h)}var n=Number.isNaN||function(p){return p!==p};function s(){s.init.call(this)}ro.exports=s,ro.exports.once=x,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(h){if(typeof h!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof h)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(h){if(typeof h!="number"||h<0||n(h))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+h+".");o=h}}),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(p){if(typeof p!="number"||p<0||n(p))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+p+".");return this._maxListeners=p,this};function c(h){return h._maxListeners===void 0?s.defaultMaxListeners:h._maxListeners}s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(p){for(var T=[],N=1;N<arguments.length;N++)T.push(arguments[N]);var C=p==="error",F=this._events;if(F!==void 0)C=C&&F.error===void 0;else if(!C)return!1;if(C){var I;if(T.length>0&&(I=T[0]),I instanceof Error)throw I;var O=new Error("Unhandled error."+(I?" ("+I.message+")":""));throw O.context=I,O}var U=F[p];if(U===void 0)return!1;if(typeof U=="function")e(U,this,T);else for(var R=U.length,D=v(U,R),N=0;N<R;++N)e(D[N],this,T);return!0};function l(h,p,T,N){var C,F,I;if(a(T),F=h._events,F===void 0?(F=h._events=Object.create(null),h._eventsCount=0):(F.newListener!==void 0&&(h.emit("newListener",p,T.listener?T.listener:T),F=h._events),I=F[p]),I===void 0)I=F[p]=T,++h._eventsCount;else if(typeof I=="function"?I=F[p]=N?[T,I]:[I,T]:N?I.unshift(T):I.push(T),C=c(h),C>0&&I.length>C&&!I.warned){I.warned=!0;var O=new Error("Possible EventEmitter memory leak detected. "+I.length+" "+String(p)+" listeners added. Use emitter.setMaxListeners() to increase limit");O.name="MaxListenersExceededWarning",O.emitter=h,O.type=p,O.count=I.length,r(O)}return h}s.prototype.addListener=function(p,T){return l(this,p,T,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(p,T){return l(this,p,T,!0)};function d(){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 u(h,p,T){var N={fired:!1,wrapFn:void 0,target:h,type:p,listener:T},C=d.bind(N);return C.listener=T,N.wrapFn=C,C}s.prototype.once=function(p,T){return a(T),this.on(p,u(this,p,T)),this},s.prototype.prependOnceListener=function(p,T){return a(T),this.prependListener(p,u(this,p,T)),this},s.prototype.removeListener=function(p,T){var N,C,F,I,O;if(a(T),C=this._events,C===void 0)return this;if(N=C[p],N===void 0)return this;if(N===T||N.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete C[p],C.removeListener&&this.emit("removeListener",p,N.listener||T));else if(typeof N!="function"){for(F=-1,I=N.length-1;I>=0;I--)if(N[I]===T||N[I].listener===T){O=N[I].listener,F=I;break}if(F<0)return this;F===0?N.shift():_(N,F),N.length===1&&(C[p]=N[0]),C.removeListener!==void 0&&this.emit("removeListener",p,O||T)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(p){var T,N,C;if(N=this._events,N===void 0)return this;if(N.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):N[p]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete N[p]),this;if(arguments.length===0){var F=Object.keys(N),I;for(C=0;C<F.length;++C)I=F[C],I!=="removeListener"&&this.removeAllListeners(I);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=N[p],typeof T=="function")this.removeListener(p,T);else if(T!==void 0)for(C=T.length-1;C>=0;C--)this.removeListener(p,T[C]);return this};function m(h,p,T){var N=h._events;if(N===void 0)return[];var C=N[p];return C===void 0?[]:typeof C=="function"?T?[C.listener||C]:[C]:T?E(C):v(C,C.length)}s.prototype.listeners=function(p){return m(this,p,!0)},s.prototype.rawListeners=function(p){return m(this,p,!1)},s.listenerCount=function(h,p){return typeof h.listenerCount=="function"?h.listenerCount(p):g.call(h,p)},s.prototype.listenerCount=g;function g(h){var p=this._events;if(p!==void 0){var T=p[h];if(typeof T=="function")return 1;if(T!==void 0)return T.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function v(h,p){for(var T=new Array(p),N=0;N<p;++N)T[N]=h[N];return T}function _(h,p){for(;p+1<h.length;p++)h[p]=h[p+1];h.pop()}function E(h){for(var p=new Array(h.length),T=0;T<p.length;++T)p[T]=h[T].listener||h[T];return p}function x(h,p){return new Promise(function(T,N){function C(I){h.removeListener(p,F),N(I)}function F(){typeof h.removeListener=="function"&&h.removeListener("error",C),T([].slice.call(arguments))}y(h,p,F,{once:!0}),p!=="error"&&k(h,C,{once:!0})})}function k(h,p,T){typeof h.on=="function"&&y(h,"error",p,T)}function y(h,p,T,N){if(typeof h.on=="function")N.once?h.once(p,T):h.on(p,T);else if(typeof h.addEventListener=="function")h.addEventListener(p,function C(F){N.once&&h.removeEventListener(p,C),T(F)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof h)}return ro.exports}var zd;function ti(){return zd||(zd=1,function(i){const e=sr(),{format:t,inspect:r}=Wf(),{codes:{ERR_INVALID_ARG_TYPE:n}}=Jt(),{kResistStopPropagation:s,AggregateError:o,SymbolDispose:a}=ut(),c=globalThis.AbortSignal||Cs().AbortSignal,l=globalThis.AbortController||Cs().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,u=globalThis.Blob||e.Blob,m=typeof u<"u"?function(E){return E instanceof u}:function(E){return!1},g=(_,E)=>{if(_!==void 0&&(_===null||typeof _!="object"||!("aborted"in _)))throw new n(E,"AbortSignal",_)},v=(_,E)=>{if(typeof _!="function")throw new n(E,"Function",_)};i.exports={AggregateError:o,kEmptyObject:Object.freeze({}),once(_){let E=!1;return function(...x){E||(E=!0,_.apply(this,x))}},createDeferredPromise:function(){let _,E;return{promise:new Promise((k,y)=>{_=k,E=y}),resolve:_,reject:E}},promisify(_){return new Promise((E,x)=>{_((k,...y)=>k?x(k):E(...y))})},debuglog(){return function(){}},format:t,inspect:r,types:{isAsyncFunction(_){return _ instanceof d},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:m,deprecate(_,E){return _},addAbortListener:Bo().addAbortListener||function(E,x){if(E===void 0)throw new n("signal","AbortSignal",E);g(E,"signal"),v(x,"listener");let k;return E.aborted?queueMicrotask(()=>x()):(E.addEventListener("abort",x,{__proto__:null,once:!0,[s]:!0}),k=()=>{E.removeEventListener("abort",x)}),{__proto__:null,[a](){var y;(y=k)===null||y===void 0||y()}}},AbortSignalAny:c.any||function(E){if(E.length===1)return E[0];const x=new l,k=()=>x.abort();return E.forEach(y=>{g(y,"signals"),y.addEventListener("abort",k,{once:!0})}),x.signal.addEventListener("abort",()=>{E.forEach(y=>y.removeEventListener("abort",k))},{once:!0}),x.signal}},i.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(da)),da.exports}var no={},fa,Hd;function Bs(){if(Hd)return fa;Hd=1;const{ArrayIsArray:i,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:r,NumberIsInteger:n,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:o,NumberMIN_SAFE_INTEGER:a,NumberParseInt:c,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:d,String:u,StringPrototypeToUpperCase:m,StringPrototypeTrim:g}=ut(),{hideStackFrames:v,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:E,ERR_INVALID_ARG_VALUE:x,ERR_OUT_OF_RANGE:k,ERR_UNKNOWN_SIGNAL:y}}=Jt(),{normalizeEncoding:h}=ti(),{isAsyncFunction:p,isArrayBufferView:T}=ti().types,N={};function C(ie){return ie===(ie|0)}function F(ie){return ie===ie>>>0}const I=/^[0-7]+$/,O="must be a 32-bit unsigned integer or an octal string";function U(ie,me,Ee){if(typeof ie>"u"&&(ie=Ee),typeof ie=="string"){if(d(I,ie)===null)throw new x(me,ie,O);ie=c(ie,8)}return J(ie,me),ie}const R=v((ie,me,Ee=a,fe=o)=>{if(typeof ie!="number")throw new E(me,"number",ie);if(!n(ie))throw new k(me,"an integer",ie);if(ie<Ee||ie>fe)throw new k(me,`>= ${Ee} && <= ${fe}`,ie)}),D=v((ie,me,Ee=-2147483648,fe=2147483647)=>{if(typeof ie!="number")throw new E(me,"number",ie);if(!n(ie))throw new k(me,"an integer",ie);if(ie<Ee||ie>fe)throw new k(me,`>= ${Ee} && <= ${fe}`,ie)}),J=v((ie,me,Ee=!1)=>{if(typeof ie!="number")throw new E(me,"number",ie);if(!n(ie))throw new k(me,"an integer",ie);const fe=Ee?1:0,He=4294967295;if(ie<fe||ie>He)throw new k(me,`>= ${fe} && <= ${He}`,ie)});function $(ie,me){if(typeof ie!="string")throw new E(me,"string",ie)}function Z(ie,me,Ee=void 0,fe){if(typeof ie!="number")throw new E(me,"number",ie);if(Ee!=null&&ie<Ee||fe!=null&&ie>fe||(Ee!=null||fe!=null)&&s(ie))throw new k(me,`${Ee!=null?`>= ${Ee}`:""}${Ee!=null&&fe!=null?" && ":""}${fe!=null?`<= ${fe}`:""}`,ie)}const B=v((ie,me,Ee)=>{if(!e(Ee,ie)){const He="must be one of: "+t(r(Ee,kt=>typeof kt=="string"?`'${kt}'`:u(kt)),", ");throw new x(me,ie,He)}});function re(ie,me){if(typeof ie!="boolean")throw new E(me,"boolean",ie)}function S(ie,me,Ee){return ie==null||!l(ie,me)?Ee:ie[me]}const H=v((ie,me,Ee=null)=>{const fe=S(Ee,"allowArray",!1),He=S(Ee,"allowFunction",!1);if(!S(Ee,"nullable",!1)&&ie===null||!fe&&i(ie)||typeof ie!="object"&&(!He||typeof ie!="function"))throw new E(me,"Object",ie)}),ee=v((ie,me)=>{if(ie!=null&&typeof ie!="object"&&typeof ie!="function")throw new E(me,"a dictionary",ie)}),Q=v((ie,me,Ee=0)=>{if(!i(ie))throw new E(me,"Array",ie);if(ie.length<Ee){const fe=`must be longer than ${Ee}`;throw new x(me,ie,fe)}});function he(ie,me){Q(ie,me);for(let Ee=0;Ee<ie.length;Ee++)$(ie[Ee],`${me}[${Ee}]`)}function W(ie,me){Q(ie,me);for(let Ee=0;Ee<ie.length;Ee++)re(ie[Ee],`${me}[${Ee}]`)}function G(ie,me){Q(ie,me);for(let Ee=0;Ee<ie.length;Ee++){const fe=ie[Ee],He=`${me}[${Ee}]`;if(fe==null)throw new E(He,"AbortSignal",fe);ye(fe,He)}}function X(ie,me="signal"){if($(ie,me),N[ie]===void 0)throw N[m(ie)]!==void 0?new y(ie+" (signals must use all capital letters)"):new y(ie)}const z=v((ie,me="buffer")=>{if(!T(ie))throw new E(me,["Buffer","TypedArray","DataView"],ie)});function ne(ie,me){const Ee=h(me),fe=ie.length;if(Ee==="hex"&&fe%2!==0)throw new x("encoding",me,`is invalid for data of length ${fe}`)}function se(ie,me="Port",Ee=!0){if(typeof ie!="number"&&typeof ie!="string"||typeof ie=="string"&&g(ie).length===0||+ie!==+ie>>>0||ie>65535||ie===0&&!Ee)throw new _(me,ie,Ee);return ie|0}const ye=v((ie,me)=>{if(ie!==void 0&&(ie===null||typeof ie!="object"||!("aborted"in ie)))throw new E(me,"AbortSignal",ie)}),_e=v((ie,me)=>{if(typeof ie!="function")throw new E(me,"Function",ie)}),M=v((ie,me)=>{if(typeof ie!="function"||p(ie))throw new E(me,"Function",ie)}),K=v((ie,me)=>{if(ie!==void 0)throw new E(me,"undefined",ie)});function ce(ie,me,Ee){if(!e(Ee,ie))throw new E(me,`('${t(Ee,"|")}')`,ie)}const be=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ve(ie,me){if(typeof ie>"u"||!d(be,ie))throw new x(me,ie,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function xe(ie){if(typeof ie=="string")return ve(ie,"hints"),ie;if(i(ie)){const me=ie.length;let Ee="";if(me===0)return Ee;for(let fe=0;fe<me;fe++){const He=ie[fe];ve(He,"hints"),Ee+=He,fe!==me-1&&(Ee+=", ")}return Ee}throw new x("hints",ie,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return fa={isInt32:C,isUint32:F,parseFileMode:U,validateArray:Q,validateStringArray:he,validateBooleanArray:W,validateAbortSignalArray:G,validateBoolean:re,validateBuffer:z,validateDictionary:ee,validateEncoding:ne,validateFunction:_e,validateInt32:D,validateInteger:R,validateNumber:Z,validateObject:H,validateOneOf:B,validatePlainFunction:M,validatePort:se,validateSignalName:X,validateString:$,validateUint32:J,validateUndefined:K,validateUnion:ce,validateAbortSignal:ye,validateLinkHeaderValue:xe},fa}var so={exports:{}},pa={exports:{}},Wd;function Zr(){if(Wd)return pa.exports;Wd=1;var i=pa.exports={},e,t;function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?t=clearTimeout:t=n}catch{t=n}})();function s(_){if(e===setTimeout)return setTimeout(_,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(_,0);try{return e(_,0)}catch{try{return e.call(null,_,0)}catch{return e.call(this,_,0)}}}function o(_){if(t===clearTimeout)return clearTimeout(_);if((t===n||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(_);try{return t(_)}catch{try{return t.call(null,_)}catch{return t.call(this,_)}}}var a=[],c=!1,l,d=-1;function u(){!c||!l||(c=!1,l.length?a=l.concat(a):d=-1,a.length&&m())}function m(){if(!c){var _=s(u);c=!0;for(var E=a.length;E;){for(l=a,a=[];++d<E;)l&&l[d].run();d=-1,E=a.length}l=null,c=!1,o(_)}}i.nextTick=function(_){var E=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)E[x-1]=arguments[x];a.push(new g(_,E)),a.length===1&&!c&&s(m)};function g(_,E){this.fun=_,this.array=E}g.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={};function v(){}return i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(_){return[]},i.binding=function(_){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(_){throw new Error("process.chdir is not supported")},i.umask=function(){return 0},pa.exports}var ma,Gd;function or(){if(Gd)return ma;Gd=1;const{SymbolAsyncIterator:i,SymbolIterator:e,SymbolFor:t}=ut(),r=t("nodejs.stream.destroyed"),n=t("nodejs.stream.errored"),s=t("nodejs.stream.readable"),o=t("nodejs.stream.writable"),a=t("nodejs.stream.disturbed"),c=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function d(S,H=!1){var ee;return!!(S&&typeof S.pipe=="function"&&typeof S.on=="function"&&(!H||typeof S.pause=="function"&&typeof S.resume=="function")&&(!S._writableState||((ee=S._readableState)===null||ee===void 0?void 0:ee.readable)!==!1)&&(!S._writableState||S._readableState))}function u(S){var H;return!!(S&&typeof S.write=="function"&&typeof S.on=="function"&&(!S._readableState||((H=S._writableState)===null||H===void 0?void 0:H.writable)!==!1))}function m(S){return!!(S&&typeof S.pipe=="function"&&S._readableState&&typeof S.on=="function"&&typeof S.write=="function")}function g(S){return S&&(S._readableState||S._writableState||typeof S.write=="function"&&typeof S.on=="function"||typeof S.pipe=="function"&&typeof S.on=="function")}function v(S){return!!(S&&!g(S)&&typeof S.pipeThrough=="function"&&typeof S.getReader=="function"&&typeof S.cancel=="function")}function _(S){return!!(S&&!g(S)&&typeof S.getWriter=="function"&&typeof S.abort=="function")}function E(S){return!!(S&&!g(S)&&typeof S.readable=="object"&&typeof S.writable=="object")}function x(S){return v(S)||_(S)||E(S)}function k(S,H){return S==null?!1:H===!0?typeof S[i]=="function":H===!1?typeof S[e]=="function":typeof S[i]=="function"||typeof S[e]=="function"}function y(S){if(!g(S))return null;const H=S._writableState,ee=S._readableState,Q=H||ee;return!!(S.destroyed||S[r]||Q!=null&&Q.destroyed)}function h(S){if(!u(S))return null;if(S.writableEnded===!0)return!0;const H=S._writableState;return H!=null&&H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function p(S,H){if(!u(S))return null;if(S.writableFinished===!0)return!0;const ee=S._writableState;return ee!=null&&ee.errored?!1:typeof ee?.finished!="boolean"?null:!!(ee.finished||H===!1&&ee.ended===!0&&ee.length===0)}function T(S){if(!d(S))return null;if(S.readableEnded===!0)return!0;const H=S._readableState;return!H||H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function N(S,H){if(!d(S))return null;const ee=S._readableState;return ee!=null&&ee.errored?!1:typeof ee?.endEmitted!="boolean"?null:!!(ee.endEmitted||H===!1&&ee.ended===!0&&ee.length===0)}function C(S){return S&&S[s]!=null?S[s]:typeof S?.readable!="boolean"?null:y(S)?!1:d(S)&&S.readable&&!N(S)}function F(S){return S&&S[o]!=null?S[o]:typeof S?.writable!="boolean"?null:y(S)?!1:u(S)&&S.writable&&!h(S)}function I(S,H){return g(S)?y(S)?!0:!(H?.readable!==!1&&C(S)||H?.writable!==!1&&F(S)):null}function O(S){var H,ee;return g(S)?S.writableErrored?S.writableErrored:(H=(ee=S._writableState)===null||ee===void 0?void 0:ee.errored)!==null&&H!==void 0?H:null:null}function U(S){var H,ee;return g(S)?S.readableErrored?S.readableErrored:(H=(ee=S._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&H!==void 0?H:null:null}function R(S){if(!g(S))return null;if(typeof S.closed=="boolean")return S.closed;const H=S._writableState,ee=S._readableState;return typeof H?.closed=="boolean"||typeof ee?.closed=="boolean"?H?.closed||ee?.closed:typeof S._closed=="boolean"&&D(S)?S._closed:null}function D(S){return typeof S._closed=="boolean"&&typeof S._defaultKeepAlive=="boolean"&&typeof S._removedConnection=="boolean"&&typeof S._removedContLen=="boolean"}function J(S){return typeof S._sent100=="boolean"&&D(S)}function $(S){var H;return typeof S._consuming=="boolean"&&typeof S._dumped=="boolean"&&((H=S.req)===null||H===void 0?void 0:H.upgradeOrConnect)===void 0}function Z(S){if(!g(S))return null;const H=S._writableState,ee=S._readableState,Q=H||ee;return!Q&&J(S)||!!(Q&&Q.autoDestroy&&Q.emitClose&&Q.closed===!1)}function B(S){var H;return!!(S&&((H=S[a])!==null&&H!==void 0?H:S.readableDidRead||S.readableAborted))}function re(S){var H,ee,Q,he,W,G,X,z,ne,se;return!!(S&&((H=(ee=(Q=(he=(W=(G=S[n])!==null&&G!==void 0?G:S.readableErrored)!==null&&W!==void 0?W:S.writableErrored)!==null&&he!==void 0?he:(X=S._readableState)===null||X===void 0?void 0:X.errorEmitted)!==null&&Q!==void 0?Q:(z=S._writableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&ee!==void 0?ee:(ne=S._readableState)===null||ne===void 0?void 0:ne.errored)!==null&&H!==void 0?H:!((se=S._writableState)===null||se===void 0)&&se.errored))}return ma={isDestroyed:y,kIsDestroyed:r,isDisturbed:B,kIsDisturbed:a,isErrored:re,kIsErrored:n,isReadable:C,kIsReadable:s,kIsClosedPromise:c,kControllerErrorFunction:l,kIsWritable:o,isClosed:R,isDuplexNodeStream:m,isFinished:I,isIterable:k,isReadableNodeStream:d,isReadableStream:v,isReadableEnded:T,isReadableFinished:N,isReadableErrored:U,isNodeStream:g,isWebStream:x,isWritable:F,isWritableNodeStream:u,isWritableStream:_,isWritableEnded:h,isWritableFinished:p,isWritableErrored:O,isServerRequest:$,isServerResponse:J,willEmitClose:Z,isTransformStream:E},ma}var Kd;function Sr(){if(Kd)return so.exports;Kd=1;const i=Zr(),{AbortError:e,codes:t}=Jt(),{ERR_INVALID_ARG_TYPE:r,ERR_STREAM_PREMATURE_CLOSE:n}=t,{kEmptyObject:s,once:o}=ti(),{validateAbortSignal:a,validateFunction:c,validateObject:l,validateBoolean:d}=Bs(),{Promise:u,PromisePrototypeThen:m,SymbolDispose:g}=ut(),{isClosed:v,isReadable:_,isReadableNodeStream:E,isReadableStream:x,isReadableFinished:k,isReadableErrored:y,isWritable:h,isWritableNodeStream:p,isWritableStream:T,isWritableFinished:N,isWritableErrored:C,isNodeStream:F,willEmitClose:I,kIsClosedPromise:O}=or();let U;function R(B){return B.setHeader&&typeof B.abort=="function"}const D=()=>{};function J(B,re,S){var H,ee;if(arguments.length===2?(S=re,re=s):re==null?re=s:l(re,"options"),c(S,"callback"),a(re.signal,"options.signal"),S=o(S),x(B)||T(B))return $(B,re,S);if(!F(B))throw new r("stream",["ReadableStream","WritableStream","Stream"],B);const Q=(H=re.readable)!==null&&H!==void 0?H:E(B),he=(ee=re.writable)!==null&&ee!==void 0?ee:p(B),W=B._writableState,G=B._readableState,X=()=>{B.writable||se()};let z=I(B)&&E(B)===Q&&p(B)===he,ne=N(B,!1);const se=()=>{ne=!0,B.destroyed&&(z=!1),!(z&&(!B.readable||Q))&&(!Q||ye)&&S.call(B)};let ye=k(B,!1);const _e=()=>{ye=!0,B.destroyed&&(z=!1),!(z&&(!B.writable||he))&&(!he||ne)&&S.call(B)},M=ie=>{S.call(B,ie)};let K=v(B);const ce=()=>{K=!0;const ie=C(B)||y(B);if(ie&&typeof ie!="boolean")return S.call(B,ie);if(Q&&!ye&&E(B,!0)&&!k(B,!1))return S.call(B,new n);if(he&&!ne&&!N(B,!1))return S.call(B,new n);S.call(B)},be=()=>{K=!0;const ie=C(B)||y(B);if(ie&&typeof ie!="boolean")return S.call(B,ie);S.call(B)},ve=()=>{B.req.on("finish",se)};R(B)?(B.on("complete",se),z||B.on("abort",ce),B.req?ve():B.on("request",ve)):he&&!W&&(B.on("end",X),B.on("close",X)),!z&&typeof B.aborted=="boolean"&&B.on("aborted",ce),B.on("end",_e),B.on("finish",se),re.error!==!1&&B.on("error",M),B.on("close",ce),K?i.nextTick(ce):W!=null&&W.errorEmitted||G!=null&&G.errorEmitted?z||i.nextTick(be):(!Q&&(!z||_(B))&&(ne||h(B)===!1)||!he&&(!z||h(B))&&(ye||_(B)===!1)||G&&B.req&&B.aborted)&&i.nextTick(be);const xe=()=>{S=D,B.removeListener("aborted",ce),B.removeListener("complete",se),B.removeListener("abort",ce),B.removeListener("request",ve),B.req&&B.req.removeListener("finish",se),B.removeListener("end",X),B.removeListener("close",X),B.removeListener("finish",se),B.removeListener("end",_e),B.removeListener("error",M),B.removeListener("close",ce)};if(re.signal&&!K){const ie=()=>{const me=S;xe(),me.call(B,new e(void 0,{cause:re.signal.reason}))};if(re.signal.aborted)i.nextTick(ie);else{U=U||ti().addAbortListener;const me=U(re.signal,ie),Ee=S;S=o((...fe)=>{me[g](),Ee.apply(B,fe)})}}return xe}function $(B,re,S){let H=!1,ee=D;if(re.signal)if(ee=()=>{H=!0,S.call(B,new e(void 0,{cause:re.signal.reason}))},re.signal.aborted)i.nextTick(ee);else{U=U||ti().addAbortListener;const he=U(re.signal,ee),W=S;S=o((...G)=>{he[g](),W.apply(B,G)})}const Q=(...he)=>{H||i.nextTick(()=>S.apply(B,he))};return m(B[O].promise,Q,Q),D}function Z(B,re){var S;let H=!1;return re===null&&(re=s),(S=re)!==null&&S!==void 0&&S.cleanup&&(d(re.cleanup,"cleanup"),H=re.cleanup),new u((ee,Q)=>{const he=J(B,re,W=>{H&&he(),W?Q(W):ee()})})}return so.exports=J,so.exports.finished=Z,so.exports}var ga,Xd;function Nn(){if(Xd)return ga;Xd=1;const i=Zr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:r}=Jt(),{Symbol:n}=ut(),{kIsDestroyed:s,isDestroyed:o,isFinished:a,isServerRequest:c}=or(),l=n("kDestroy"),d=n("kConstruct");function u(I,O,U){I&&(I.stack,O&&!O.errored&&(O.errored=I),U&&!U.errored&&(U.errored=I))}function m(I,O){const U=this._readableState,R=this._writableState,D=R||U;return R!=null&&R.destroyed||U!=null&&U.destroyed?(typeof O=="function"&&O(),this):(u(I,R,U),R&&(R.destroyed=!0),U&&(U.destroyed=!0),D.constructed?g(this,I,O):this.once(l,function(J){g(this,e(J,I),O)}),this)}function g(I,O,U){let R=!1;function D(J){if(R)return;R=!0;const $=I._readableState,Z=I._writableState;u(J,Z,$),Z&&(Z.closed=!0),$&&($.closed=!0),typeof U=="function"&&U(J),J?i.nextTick(v,I,J):i.nextTick(_,I)}try{I._destroy(O||null,D)}catch(J){D(J)}}function v(I,O){E(I,O),_(I)}function _(I){const O=I._readableState,U=I._writableState;U&&(U.closeEmitted=!0),O&&(O.closeEmitted=!0),(U!=null&&U.emitClose||O!=null&&O.emitClose)&&I.emit("close")}function E(I,O){const U=I._readableState,R=I._writableState;R!=null&&R.errorEmitted||U!=null&&U.errorEmitted||(R&&(R.errorEmitted=!0),U&&(U.errorEmitted=!0),I.emit("error",O))}function x(){const I=this._readableState,O=this._writableState;I&&(I.constructed=!0,I.closed=!1,I.closeEmitted=!1,I.destroyed=!1,I.errored=null,I.errorEmitted=!1,I.reading=!1,I.ended=I.readable===!1,I.endEmitted=I.readable===!1),O&&(O.constructed=!0,O.destroyed=!1,O.closed=!1,O.closeEmitted=!1,O.errored=null,O.errorEmitted=!1,O.finalCalled=!1,O.prefinished=!1,O.ended=O.writable===!1,O.ending=O.writable===!1,O.finished=O.writable===!1)}function k(I,O,U){const R=I._readableState,D=I._writableState;if(D!=null&&D.destroyed||R!=null&&R.destroyed)return this;R!=null&&R.autoDestroy||D!=null&&D.autoDestroy?I.destroy(O):O&&(O.stack,D&&!D.errored&&(D.errored=O),R&&!R.errored&&(R.errored=O),U?i.nextTick(E,I,O):E(I,O))}function y(I,O){if(typeof I._construct!="function")return;const U=I._readableState,R=I._writableState;U&&(U.constructed=!1),R&&(R.constructed=!1),I.once(d,O),!(I.listenerCount(d)>1)&&i.nextTick(h,I)}function h(I){let O=!1;function U(R){if(O){k(I,R??new t);return}O=!0;const D=I._readableState,J=I._writableState,$=J||D;D&&(D.constructed=!0),J&&(J.constructed=!0),$.destroyed?I.emit(l,R):R?k(I,R,!0):i.nextTick(p,I)}try{I._construct(R=>{i.nextTick(U,R)})}catch(R){i.nextTick(U,R)}}function p(I){I.emit(d)}function T(I){return I?.setHeader&&typeof I.abort=="function"}function N(I){I.emit("close")}function C(I,O){I.emit("error",O),i.nextTick(N,I)}function F(I,O){!I||o(I)||(!O&&!a(I)&&(O=new r),c(I)?(I.socket=null,I.destroy(O)):T(I)?I.abort():T(I.req)?I.req.abort():typeof I.destroy=="function"?I.destroy(O):typeof I.close=="function"?I.close():O?i.nextTick(C,I,O):i.nextTick(N,I),I.destroyed||(I[s]=!0))}return ga={construct:y,destroyer:F,destroy:m,undestroy:x,errorOrDestroy:k},ga}var ba,Qd;function Lc(){if(Qd)return ba;Qd=1;const{ArrayIsArray:i,ObjectSetPrototypeOf:e}=ut(),{EventEmitter:t}=Bo();function r(s){t.call(this,s)}e(r.prototype,t.prototype),e(r,t),r.prototype.pipe=function(s,o){const a=this;function c(_){s.writable&&s.write(_)===!1&&a.pause&&a.pause()}a.on("data",c);function l(){a.readable&&a.resume&&a.resume()}s.on("drain",l),!s._isStdio&&(!o||o.end!==!1)&&(a.on("end",u),a.on("close",m));let d=!1;function u(){d||(d=!0,s.end())}function m(){d||(d=!0,typeof s.destroy=="function"&&s.destroy())}function g(_){v(),t.listenerCount(this,"error")===0&&this.emit("error",_)}n(a,"error",g),n(s,"error",g);function v(){a.removeListener("data",c),s.removeListener("drain",l),a.removeListener("end",u),a.removeListener("close",m),a.removeListener("error",g),s.removeListener("error",g),a.removeListener("end",v),a.removeListener("close",v),s.removeListener("close",v)}return a.on("end",v),a.on("close",v),s.on("close",v),s.emit("pipe",a),s};function n(s,o,a){if(typeof s.prependListener=="function")return s.prependListener(o,a);!s._events||!s._events[o]?s.on(o,a):i(s._events[o])?s._events[o].unshift(a):s._events[o]=[a,s._events[o]]}return ba={Stream:r,prependListener:n},ba}var ya={exports:{}},Jd;function qo(){return Jd||(Jd=1,function(i){const{SymbolDispose:e}=ut(),{AbortError:t,codes:r}=Jt(),{isNodeStream:n,isWebStream:s,kControllerErrorFunction:o}=or(),a=Sr(),{ERR_INVALID_ARG_TYPE:c}=r;let l;const d=(u,m)=>{if(typeof u!="object"||!("aborted"in u))throw new c(m,"AbortSignal",u)};i.exports.addAbortSignal=function(m,g){if(d(m,"signal"),!n(g)&&!s(g))throw new c("stream",["ReadableStream","WritableStream","Stream"],g);return i.exports.addAbortSignalNoValidate(m,g)},i.exports.addAbortSignalNoValidate=function(u,m){if(typeof u!="object"||!("aborted"in u))return m;const g=n(m)?()=>{m.destroy(new t(void 0,{cause:u.reason}))}:()=>{m[o](new t(void 0,{cause:u.reason}))};if(u.aborted)g();else{l=l||ti().addAbortListener;const v=l(u,g);a(m,v[e])}return m}}(ya)),ya.exports}var va,Yd;function Km(){if(Yd)return va;Yd=1;const{StringPrototypeSlice:i,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:r}=ut(),{Buffer:n}=sr(),{inspect:s}=ti();return va=class{constructor(){this.head=null,this.tail=null,this.length=0}push(a){const c={data:a,next:null};this.length>0?this.tail.next=c:this.head=c,this.tail=c,++this.length}unshift(a){const c={data:a,next:this.head};this.length===0&&(this.tail=c),this.head=c,++this.length}shift(){if(this.length===0)return;const a=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,a}clear(){this.head=this.tail=null,this.length=0}join(a){if(this.length===0)return"";let c=this.head,l=""+c.data;for(;(c=c.next)!==null;)l+=a+c.data;return l}concat(a){if(this.length===0)return n.alloc(0);const c=n.allocUnsafe(a>>>0);let l=this.head,d=0;for(;l;)t(c,l.data,d),d+=l.data.length,l=l.next;return c}consume(a,c){const l=this.head.data;if(a<l.length){const d=l.slice(0,a);return this.head.data=l.slice(a),d}return a===l.length?this.shift():c?this._getString(a):this._getBuffer(a)}first(){return this.head.data}*[e](){for(let a=this.head;a;a=a.next)yield a.data}_getString(a){let c="",l=this.head,d=0;do{const u=l.data;if(a>u.length)c+=u,a-=u.length;else{a===u.length?(c+=u,++d,l.next?this.head=l.next:this.head=this.tail=null):(c+=i(u,0,a),this.head=l,l.data=i(u,a));break}++d}while((l=l.next)!==null);return this.length-=d,c}_getBuffer(a){const c=n.allocUnsafe(a),l=a;let d=this.head,u=0;do{const m=d.data;if(a>m.length)t(c,m,l-a),a-=m.length;else{a===m.length?(t(c,m,l-a),++u,d.next?this.head=d.next:this.head=this.tail=null):(t(c,new r(m.buffer,m.byteOffset,a),l-a),this.head=d,d.data=m.slice(a));break}++u}while((d=d.next)!==null);return this.length-=u,c}[Symbol.for("nodejs.util.inspect.custom")](a,c){return s(this,{...c,depth:0,customInspect:!1})}},va}var wa,Zd;function Uo(){if(Zd)return wa;Zd=1;const{MathFloor:i,NumberIsInteger:e}=ut(),{validateInteger:t}=Bs(),{ERR_INVALID_ARG_VALUE:r}=Jt().codes;let n=16*1024,s=16;function o(d,u,m){return d.highWaterMark!=null?d.highWaterMark:u?d[m]:null}function a(d){return d?s:n}function c(d,u){t(u,"value",0),d?s=u:n=u}function l(d,u,m,g){const v=o(u,g,m);if(v!=null){if(!e(v)||v<0){const _=g?`options.${m}`:"options.highWaterMark";throw new r(_,v)}return i(v)}return a(d.objectMode)}return wa={getHighWaterMark:l,getDefaultHighWaterMark:a,setDefaultHighWaterMark:c},wa}var _a={},oo={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var eu;function Xm(){return eu||(eu=1,function(i,e){var t=sr(),r=t.Buffer;function n(o,a){for(var c in o)a[c]=o[c]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?i.exports=t:(n(t,e),e.Buffer=s);function s(o,a,c){return r(o,a,c)}s.prototype=Object.create(r.prototype),n(r,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return r(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var l=r(o);return a!==void 0?typeof c=="string"?l.fill(a,c):l.fill(a):l.fill(0),l},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(o)}}(oo,oo.exports)),oo.exports}var tu;function Qm(){if(tu)return _a;tu=1;var i=Xm().Buffer,e=i.isEncoding||function(x){switch(x=""+x,x&&x.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 t(x){if(!x)return"utf8";for(var k;;)switch(x){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 x;default:if(k)return;x=(""+x).toLowerCase(),k=!0}}function r(x){var k=t(x);if(typeof k!="string"&&(i.isEncoding===e||!e(x)))throw new Error("Unknown encoding: "+x);return k||x}_a.StringDecoder=n;function n(x){this.encoding=r(x);var k;switch(this.encoding){case"utf16le":this.text=u,this.end=m,k=4;break;case"utf8":this.fillLast=c,k=4;break;case"base64":this.text=g,this.end=v,k=3;break;default:this.write=_,this.end=E;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(k)}n.prototype.write=function(x){if(x.length===0)return"";var k,y;if(this.lastNeed){if(k=this.fillLast(x),k===void 0)return"";y=this.lastNeed,this.lastNeed=0}else y=0;return y<x.length?k?k+this.text(x,y):this.text(x,y):k||""},n.prototype.end=d,n.prototype.text=l,n.prototype.fillLast=function(x){if(this.lastNeed<=x.length)return x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,x.length),this.lastNeed-=x.length};function s(x){return x<=127?0:x>>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function o(x,k,y){var h=k.length-1;if(h<y)return 0;var p=s(k[h]);return p>=0?(p>0&&(x.lastNeed=p-1),p):--h<y||p===-2?0:(p=s(k[h]),p>=0?(p>0&&(x.lastNeed=p-2),p):--h<y||p===-2?0:(p=s(k[h]),p>=0?(p>0&&(p===2?p=0:x.lastNeed=p-3),p):0))}function a(x,k,y){if((k[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&k.length>1){if((k[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&k.length>2&&(k[2]&192)!==128)return x.lastNeed=2,"�"}}function c(x){var k=this.lastTotal-this.lastNeed,y=a(this,x);if(y!==void 0)return y;if(this.lastNeed<=x.length)return x.copy(this.lastChar,k,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,k,0,x.length),this.lastNeed-=x.length}function l(x,k){var y=o(this,x,k);if(!this.lastNeed)return x.toString("utf8",k);this.lastTotal=y;var h=x.length-(y-this.lastNeed);return x.copy(this.lastChar,0,h),x.toString("utf8",k,h)}function d(x){var k=x&&x.length?this.write(x):"";return this.lastNeed?k+"�":k}function u(x,k){if((x.length-k)%2===0){var y=x.toString("utf16le",k);if(y){var h=y.charCodeAt(y.length-1);if(h>=55296&&h<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],y.slice(0,-1)}return y}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",k,x.length-1)}function m(x){var k=x&&x.length?this.write(x):"";if(this.lastNeed){var y=this.lastTotal-this.lastNeed;return k+this.lastChar.toString("utf16le",0,y)}return k}function g(x,k){var y=(x.length-k)%3;return y===0?x.toString("base64",k):(this.lastNeed=3-y,this.lastTotal=3,y===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",k,x.length-y))}function v(x){var k=x&&x.length?this.write(x):"";return this.lastNeed?k+this.lastChar.toString("base64",0,3-this.lastNeed):k}function _(x){return x.toString(this.encoding)}function E(x){return x&&x.length?this.write(x):""}return _a}var xa,iu;function Gf(){if(iu)return xa;iu=1;const i=Zr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:r}=ut(),{Buffer:n}=sr(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:o}=Jt().codes;function a(c,l,d){let u;if(typeof l=="string"||l instanceof n)return new c({objectMode:!0,...d,read(){this.push(l),this.push(null)}});let m;if(l&&l[t])m=!0,u=l[t]();else if(l&&l[r])m=!1,u=l[r]();else throw new s("iterable",["Iterable"],l);const g=new c({objectMode:!0,highWaterMark:1,...d});let v=!1;g._read=function(){v||(v=!0,E())},g._destroy=function(x,k){e(_(x),()=>i.nextTick(k,x),y=>i.nextTick(k,y||x))};async function _(x){const k=x!=null,y=typeof u.throw=="function";if(k&&y){const{value:h,done:p}=await u.throw(x);if(await h,p)return}if(typeof u.return=="function"){const{value:h}=await u.return();await h}}async function E(){for(;;){try{const{value:x,done:k}=m?await u.next():u.next();if(k)g.push(null);else{const y=x&&typeof x.then=="function"?await x:x;if(y===null)throw v=!1,new o;if(g.push(y))continue;v=!1}}catch(x){g.destroy(x)}break}}return g}return xa=a,xa}var Ea,ru;function Vo(){if(ru)return Ea;ru=1;const i=Zr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:r,NumberParseInt:n,ObjectDefineProperties:s,ObjectKeys:o,ObjectSetPrototypeOf:a,Promise:c,SafeSet:l,SymbolAsyncDispose:d,SymbolAsyncIterator:u,Symbol:m}=ut();Ea=fe,fe.ReadableState=Ee;const{EventEmitter:g}=Bo(),{Stream:v,prependListener:_}=Lc(),{Buffer:E}=sr(),{addAbortSignal:x}=qo(),k=Sr();let y=ti().debuglog("stream",P=>{y=P});const h=Km(),p=Nn(),{getHighWaterMark:T,getDefaultHighWaterMark:N}=Uo(),{aggregateTwoErrors:C,codes:{ERR_INVALID_ARG_TYPE:F,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_OUT_OF_RANGE:O,ERR_STREAM_PUSH_AFTER_EOF:U,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:R},AbortError:D}=Jt(),{validateObject:J}=Bs(),$=m("kPaused"),{StringDecoder:Z}=Qm(),B=Gf();a(fe.prototype,v.prototype),a(fe,v);const re=()=>{},{errorOrDestroy:S}=p,H=1,ee=2,Q=4,he=8,W=16,G=32,X=64,z=128,ne=256,se=512,ye=1024,_e=2048,M=4096,K=8192,ce=16384,be=32768,ve=65536,xe=1<<17,ie=1<<18;function me(P){return{enumerable:!1,get(){return(this.state&P)!==0},set(V){V?this.state|=P:this.state&=~P}}}s(Ee.prototype,{objectMode:me(H),ended:me(ee),endEmitted:me(Q),reading:me(he),constructed:me(W),sync:me(G),needReadable:me(X),emittedReadable:me(z),readableListening:me(ne),resumeScheduled:me(se),errorEmitted:me(ye),emitClose:me(_e),autoDestroy:me(M),destroyed:me(K),closed:me(ce),closeEmitted:me(be),multiAwaitDrain:me(ve),readingMore:me(xe),dataEmitted:me(ie)});function Ee(P,V,Se){typeof Se!="boolean"&&(Se=V instanceof Zi()),this.state=_e|M|W|G,P&&P.objectMode&&(this.state|=H),Se&&P&&P.readableObjectMode&&(this.state|=H),this.highWaterMark=P?T(this,P,"readableHighWaterMark",Se):N(!1),this.buffer=new h,this.length=0,this.pipes=[],this.flowing=null,this[$]=null,P&&P.emitClose===!1&&(this.state&=~_e),P&&P.autoDestroy===!1&&(this.state&=~M),this.errored=null,this.defaultEncoding=P&&P.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,P&&P.encoding&&(this.decoder=new Z(P.encoding),this.encoding=P.encoding)}function fe(P){if(!(this instanceof fe))return new fe(P);const V=this instanceof Zi();this._readableState=new Ee(P,this,V),P&&(typeof P.read=="function"&&(this._read=P.read),typeof P.destroy=="function"&&(this._destroy=P.destroy),typeof P.construct=="function"&&(this._construct=P.construct),P.signal&&!V&&x(P.signal,this)),v.call(this,P),p.construct(this,()=>{this._readableState.needReadable&&te(this,this._readableState)})}fe.prototype.destroy=p.destroy,fe.prototype._undestroy=p.undestroy,fe.prototype._destroy=function(P,V){V(P)},fe.prototype[g.captureRejectionSymbol]=function(P){this.destroy(P)},fe.prototype[d]=function(){let P;return this.destroyed||(P=this.readableEnded?null:new D,this.destroy(P)),new c((V,Se)=>k(this,ke=>ke&&ke!==P?Se(ke):V(null)))},fe.prototype.push=function(P,V){return He(this,P,V,!1)},fe.prototype.unshift=function(P,V){return He(this,P,V,!0)};function He(P,V,Se,ke){y("readableAddChunk",V);const Ce=P._readableState;let Rt;if((Ce.state&H)===0&&(typeof V=="string"?(Se=Se||Ce.defaultEncoding,Ce.encoding!==Se&&(ke&&Ce.encoding?V=E.from(V,Se).toString(Ce.encoding):(V=E.from(V,Se),Se=""))):V instanceof E?Se="":v._isUint8Array(V)?(V=v._uint8ArrayToBuffer(V),Se=""):V!=null&&(Rt=new F("chunk",["string","Buffer","Uint8Array"],V))),Rt)S(P,Rt);else if(V===null)Ce.state&=~he,f(P,Ce);else if((Ce.state&H)!==0||V&&V.length>0)if(ke)if((Ce.state&Q)!==0)S(P,new R);else{if(Ce.destroyed||Ce.errored)return!1;kt(P,Ce,V,!0)}else if(Ce.ended)S(P,new U);else{if(Ce.destroyed||Ce.errored)return!1;Ce.state&=~he,Ce.decoder&&!Se?(V=Ce.decoder.write(V),Ce.objectMode||V.length!==0?kt(P,Ce,V,!1):te(P,Ce)):kt(P,Ce,V,!1)}else ke||(Ce.state&=~he,te(P,Ce));return!Ce.ended&&(Ce.length<Ce.highWaterMark||Ce.length===0)}function kt(P,V,Se,ke){V.flowing&&V.length===0&&!V.sync&&P.listenerCount("data")>0?((V.state&ve)!==0?V.awaitDrainWriters.clear():V.awaitDrainWriters=null,V.dataEmitted=!0,P.emit("data",Se)):(V.length+=V.objectMode?1:Se.length,ke?V.buffer.unshift(Se):V.buffer.push(Se),(V.state&X)!==0&&b(P)),te(P,V)}fe.prototype.isPaused=function(){const P=this._readableState;return P[$]===!0||P.flowing===!1},fe.prototype.setEncoding=function(P){const V=new Z(P);this._readableState.decoder=V,this._readableState.encoding=this._readableState.decoder.encoding;const Se=this._readableState.buffer;let ke="";for(const Ce of Se)ke+=V.write(Ce);return Se.clear(),ke!==""&&Se.push(ke),this._readableState.length=ke.length,this};const Ve=1073741824;function Nt(P){if(P>Ve)throw new O("size","<= 1GiB",P);return P--,P|=P>>>1,P|=P>>>2,P|=P>>>4,P|=P>>>8,P|=P>>>16,P++,P}function A(P,V){return P<=0||V.length===0&&V.ended?0:(V.state&H)!==0?1:r(P)?V.flowing&&V.length?V.buffer.first().length:V.length:P<=V.length?P:V.ended?V.length:0}fe.prototype.read=function(P){y("read",P),P===void 0?P=NaN:t(P)||(P=n(P,10));const V=this._readableState,Se=P;if(P>V.highWaterMark&&(V.highWaterMark=Nt(P)),P!==0&&(V.state&=~z),P===0&&V.needReadable&&((V.highWaterMark!==0?V.length>=V.highWaterMark:V.length>0)||V.ended))return y("read: emitReadable",V.length,V.ended),V.length===0&&V.ended?mt(this):b(this),null;if(P=A(P,V),P===0&&V.ended)return V.length===0&&mt(this),null;let ke=(V.state&X)!==0;if(y("need readable",ke),(V.length===0||V.length-P<V.highWaterMark)&&(ke=!0,y("length less than watermark",ke)),V.ended||V.reading||V.destroyed||V.errored||!V.constructed)ke=!1,y("reading, ended or constructing",ke);else if(ke){y("do read"),V.state|=he|G,V.length===0&&(V.state|=X);try{this._read(V.highWaterMark)}catch(Rt){S(this,Rt)}V.state&=~G,V.reading||(P=A(Se,V))}let Ce;return P>0?Ce=ft(P,V):Ce=null,Ce===null?(V.needReadable=V.length<=V.highWaterMark,P=0):(V.length-=P,V.multiAwaitDrain?V.awaitDrainWriters.clear():V.awaitDrainWriters=null),V.length===0&&(V.ended||(V.needReadable=!0),Se!==P&&V.ended&&mt(this)),Ce!==null&&!V.errorEmitted&&!V.closeEmitted&&(V.dataEmitted=!0,this.emit("data",Ce)),Ce};function f(P,V){if(y("onEofChunk"),!V.ended){if(V.decoder){const Se=V.decoder.end();Se&&Se.length&&(V.buffer.push(Se),V.length+=V.objectMode?1:Se.length)}V.ended=!0,V.sync?b(P):(V.needReadable=!1,V.emittedReadable=!0,j(P))}}function b(P){const V=P._readableState;y("emitReadable",V.needReadable,V.emittedReadable),V.needReadable=!1,V.emittedReadable||(y("emitReadable",V.flowing),V.emittedReadable=!0,i.nextTick(j,P))}function j(P){const V=P._readableState;y("emitReadable_",V.destroyed,V.length,V.ended),!V.destroyed&&!V.errored&&(V.length||V.ended)&&(P.emit("readable"),V.emittedReadable=!1),V.needReadable=!V.flowing&&!V.ended&&V.length<=V.highWaterMark,Xe(P)}function te(P,V){!V.readingMore&&V.constructed&&(V.readingMore=!0,i.nextTick(ue,P,V))}function ue(P,V){for(;!V.reading&&!V.ended&&(V.length<V.highWaterMark||V.flowing&&V.length===0);){const Se=V.length;if(y("maybeReadMore read 0"),P.read(0),Se===V.length)break}V.readingMore=!1}fe.prototype._read=function(P){throw new I("_read()")},fe.prototype.pipe=function(P,V){const Se=this,ke=this._readableState;ke.pipes.length===1&&(ke.multiAwaitDrain||(ke.multiAwaitDrain=!0,ke.awaitDrainWriters=new l(ke.awaitDrainWriters?[ke.awaitDrainWriters]:[]))),ke.pipes.push(P),y("pipe count=%d opts=%j",ke.pipes.length,V);const Rt=(!V||V.end!==!1)&&P!==i.stdout&&P!==i.stderr?Js:q;ke.endEmitted?i.nextTick(Rt):Se.once("end",Rt),P.on("unpipe",Mt);function Mt(ae,le){y("onunpipe"),ae===Se&&le&&le.hasUnpiped===!1&&(le.hasUnpiped=!0,Ki())}function Js(){y("onend"),P.end()}let Gi,Ys=!1;function Ki(){y("cleanup"),P.removeListener("close",qn),P.removeListener("finish",xt),Gi&&P.removeListener("drain",Gi),P.removeListener("error",rn),P.removeListener("unpipe",Mt),Se.removeListener("end",Js),Se.removeListener("end",q),Se.removeListener("data",tn),Ys=!0,Gi&&ke.awaitDrainWriters&&(!P._writableState||P._writableState.needDrain)&&Gi()}function Bn(){Ys||(ke.pipes.length===1&&ke.pipes[0]===P?(y("false write response, pause",0),ke.awaitDrainWriters=P,ke.multiAwaitDrain=!1):ke.pipes.length>1&&ke.pipes.includes(P)&&(y("false write response, pause",ke.awaitDrainWriters.size),ke.awaitDrainWriters.add(P)),Se.pause()),Gi||(Gi=ge(Se,P),P.on("drain",Gi))}Se.on("data",tn);function tn(ae){y("ondata");const le=P.write(ae);y("dest.write",le),le===!1&&Bn()}function rn(ae){if(y("onerror",ae),q(),P.removeListener("error",rn),P.listenerCount("error")===0){const le=P._writableState||P._readableState;le&&!le.errorEmitted?S(P,ae):P.emit("error",ae)}}_(P,"error",rn);function qn(){P.removeListener("finish",xt),q()}P.once("close",qn);function xt(){y("onfinish"),P.removeListener("close",qn),q()}P.once("finish",xt);function q(){y("unpipe"),Se.unpipe(P)}return P.emit("pipe",Se),P.writableNeedDrain===!0?Bn():ke.flowing||(y("pipe resume"),Se.resume()),P};function ge(P,V){return function(){const ke=P._readableState;ke.awaitDrainWriters===V?(y("pipeOnDrain",1),ke.awaitDrainWriters=null):ke.multiAwaitDrain&&(y("pipeOnDrain",ke.awaitDrainWriters.size),ke.awaitDrainWriters.delete(V)),(!ke.awaitDrainWriters||ke.awaitDrainWriters.size===0)&&P.listenerCount("data")&&P.resume()}}fe.prototype.unpipe=function(P){const V=this._readableState,Se={hasUnpiped:!1};if(V.pipes.length===0)return this;if(!P){const Ce=V.pipes;V.pipes=[],this.pause();for(let Rt=0;Rt<Ce.length;Rt++)Ce[Rt].emit("unpipe",this,{hasUnpiped:!1});return this}const ke=e(V.pipes,P);return ke===-1?this:(V.pipes.splice(ke,1),V.pipes.length===0&&this.pause(),P.emit("unpipe",this,Se),this)},fe.prototype.on=function(P,V){const Se=v.prototype.on.call(this,P,V),ke=this._readableState;return P==="data"?(ke.readableListening=this.listenerCount("readable")>0,ke.flowing!==!1&&this.resume()):P==="readable"&&!ke.endEmitted&&!ke.readableListening&&(ke.readableListening=ke.needReadable=!0,ke.flowing=!1,ke.emittedReadable=!1,y("on readable",ke.length,ke.reading),ke.length?b(this):ke.reading||i.nextTick(nt,this)),Se},fe.prototype.addListener=fe.prototype.on,fe.prototype.removeListener=function(P,V){const Se=v.prototype.removeListener.call(this,P,V);return P==="readable"&&i.nextTick(Pe,this),Se},fe.prototype.off=fe.prototype.removeListener,fe.prototype.removeAllListeners=function(P){const V=v.prototype.removeAllListeners.apply(this,arguments);return(P==="readable"||P===void 0)&&i.nextTick(Pe,this),V};function Pe(P){const V=P._readableState;V.readableListening=P.listenerCount("readable")>0,V.resumeScheduled&&V[$]===!1?V.flowing=!0:P.listenerCount("data")>0?P.resume():V.readableListening||(V.flowing=null)}function nt(P){y("readable nexttick read 0"),P.read(0)}fe.prototype.resume=function(){const P=this._readableState;return P.flowing||(y("resume"),P.flowing=!P.readableListening,Qe(this,P)),P[$]=!1,this};function Qe(P,V){V.resumeScheduled||(V.resumeScheduled=!0,i.nextTick(Ze,P,V))}function Ze(P,V){y("resume",V.reading),V.reading||P.read(0),V.resumeScheduled=!1,P.emit("resume"),Xe(P),V.flowing&&!V.reading&&P.read(0)}fe.prototype.pause=function(){return y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(y("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[$]=!0,this};function Xe(P){const V=P._readableState;for(y("flow",V.flowing);V.flowing&&P.read()!==null;);}fe.prototype.wrap=function(P){let V=!1;P.on("data",ke=>{!this.push(ke)&&P.pause&&(V=!0,P.pause())}),P.on("end",()=>{this.push(null)}),P.on("error",ke=>{S(this,ke)}),P.on("close",()=>{this.destroy()}),P.on("destroy",()=>{this.destroy()}),this._read=()=>{V&&P.resume&&(V=!1,P.resume())};const Se=o(P);for(let ke=1;ke<Se.length;ke++){const Ce=Se[ke];this[Ce]===void 0&&typeof P[Ce]=="function"&&(this[Ce]=P[Ce].bind(P))}return this},fe.prototype[u]=function(){return Ti(this)},fe.prototype.iterator=function(P){return P!==void 0&&J(P,"options"),Ti(this,P)};function Ti(P,V){typeof P.read!="function"&&(P=fe.wrap(P,{objectMode:!0}));const Se=ur(P,V);return Se.stream=P,Se}async function*ur(P,V){let Se=re;function ke(Mt){this===P?(Se(),Se=re):Se=Mt}P.on("readable",ke);let Ce;const Rt=k(P,{writable:!1},Mt=>{Ce=Mt?C(Ce,Mt):null,Se(),Se=re});try{for(;;){const Mt=P.destroyed?null:P.read();if(Mt!==null)yield Mt;else{if(Ce)throw Ce;if(Ce===null)return;await new c(ke)}}}catch(Mt){throw Ce=C(Ce,Mt),Ce}finally{(Ce||V?.destroyOnReturn!==!1)&&(Ce===void 0||P._readableState.autoDestroy)?p.destroyer(P,null):(P.off("readable",ke),Rt())}}s(fe.prototype,{readable:{__proto__:null,get(){const P=this._readableState;return!!P&&P.readable!==!1&&!P.destroyed&&!P.errorEmitted&&!P.endEmitted},set(P){this._readableState&&(this._readableState.readable=!!P)}},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(P){this._readableState&&(this._readableState.flowing=P)}},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(P){this._readableState&&(this._readableState.destroyed=P)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(Ee.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[$]!==!1},set(P){this[$]=!!P}}}),fe._fromList=ft;function ft(P,V){if(V.length===0)return null;let Se;return V.objectMode?Se=V.buffer.shift():!P||P>=V.length?(V.decoder?Se=V.buffer.join(""):V.buffer.length===1?Se=V.buffer.first():Se=V.buffer.concat(V.length),V.buffer.clear()):Se=V.buffer.consume(P,V.decoder),Se}function mt(P){const V=P._readableState;y("endReadable",V.endEmitted),V.endEmitted||(V.ended=!0,i.nextTick(Qs,V,P))}function Qs(P,V){if(y("endReadableNT",P.endEmitted,P.length),!P.errored&&!P.closeEmitted&&!P.endEmitted&&P.length===0){if(P.endEmitted=!0,V.emit("end"),V.writable&&V.allowHalfOpen===!1)i.nextTick(hr,V);else if(P.autoDestroy){const Se=V._writableState;(!Se||Se.autoDestroy&&(Se.finished||Se.writable===!1))&&V.destroy()}}}function hr(P){P.writable&&!P.writableEnded&&!P.destroyed&&P.end()}fe.from=function(P,V){return B(fe,P,V)};let en;function jn(){return en===void 0&&(en={}),en}return fe.fromWeb=function(P,V){return jn().newStreamReadableFromReadableStream(P,V)},fe.toWeb=function(P,V){return jn().newReadableStreamFromStreamReadable(P,V)},fe.wrap=function(P,V){var Se,ke;return new fe({objectMode:(Se=(ke=P.readableObjectMode)!==null&&ke!==void 0?ke:P.objectMode)!==null&&Se!==void 0?Se:!0,...V,destroy(Ce,Rt){p.destroyer(P,Ce),Rt(Ce)}}).wrap(P)},Ea}var Sa,nu;function Oc(){if(nu)return Sa;nu=1;const i=Zr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:n,ObjectDefineProperties:s,ObjectSetPrototypeOf:o,StringPrototypeToLowerCase:a,Symbol:c,SymbolHasInstance:l}=ut();Sa=J,J.WritableState=R;const{EventEmitter:d}=Bo(),u=Lc().Stream,{Buffer:m}=sr(),g=Nn(),{addAbortSignal:v}=qo(),{getHighWaterMark:_,getDefaultHighWaterMark:E}=Uo(),{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_MULTIPLE_CALLBACK:y,ERR_STREAM_CANNOT_PIPE:h,ERR_STREAM_DESTROYED:p,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:N,ERR_STREAM_WRITE_AFTER_END:C,ERR_UNKNOWN_ENCODING:F}=Jt().codes,{errorOrDestroy:I}=g;o(J.prototype,u.prototype),o(J,u);function O(){}const U=c("kOnFinished");function R(M,K,ce){typeof ce!="boolean"&&(ce=K instanceof Zi()),this.objectMode=!!(M&&M.objectMode),ce&&(this.objectMode=this.objectMode||!!(M&&M.writableObjectMode)),this.highWaterMark=M?_(this,M,"writableHighWaterMark",ce):E(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const be=!!(M&&M.decodeStrings===!1);this.decodeStrings=!be,this.defaultEncoding=M&&M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=S.bind(void 0,K),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,D(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!M||M.emitClose!==!1,this.autoDestroy=!M||M.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[U]=[]}function D(M){M.buffered=[],M.bufferedIndex=0,M.allBuffers=!0,M.allNoop=!0}R.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},n(R.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function J(M){const K=this instanceof Zi();if(!K&&!r(J,this))return new J(M);this._writableState=new R(M,this,K),M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final),typeof M.construct=="function"&&(this._construct=M.construct),M.signal&&v(M.signal,this)),u.call(this,M),g.construct(this,()=>{const ce=this._writableState;ce.writing||he(this,ce),z(this,ce)})}n(J,l,{__proto__:null,value:function(M){return r(this,M)?!0:this!==J?!1:M&&M._writableState instanceof R}}),J.prototype.pipe=function(){I(this,new h)};function $(M,K,ce,be){const ve=M._writableState;if(typeof ce=="function")be=ce,ce=ve.defaultEncoding;else{if(!ce)ce=ve.defaultEncoding;else if(ce!=="buffer"&&!m.isEncoding(ce))throw new F(ce);typeof be!="function"&&(be=O)}if(K===null)throw new N;if(!ve.objectMode)if(typeof K=="string")ve.decodeStrings!==!1&&(K=m.from(K,ce),ce="buffer");else if(K instanceof m)ce="buffer";else if(u._isUint8Array(K))K=u._uint8ArrayToBuffer(K),ce="buffer";else throw new x("chunk",["string","Buffer","Uint8Array"],K);let xe;return ve.ending?xe=new C:ve.destroyed&&(xe=new p("write")),xe?(i.nextTick(be,xe),I(M,xe,!0),xe):(ve.pendingcb++,Z(M,ve,K,ce,be))}J.prototype.write=function(M,K,ce){return $(this,M,K,ce)===!0},J.prototype.cork=function(){this._writableState.corked++},J.prototype.uncork=function(){const M=this._writableState;M.corked&&(M.corked--,M.writing||he(this,M))},J.prototype.setDefaultEncoding=function(K){if(typeof K=="string"&&(K=a(K)),!m.isEncoding(K))throw new F(K);return this._writableState.defaultEncoding=K,this};function Z(M,K,ce,be,ve){const xe=K.objectMode?1:ce.length;K.length+=xe;const ie=K.length<K.highWaterMark;return ie||(K.needDrain=!0),K.writing||K.corked||K.errored||!K.constructed?(K.buffered.push({chunk:ce,encoding:be,callback:ve}),K.allBuffers&&be!=="buffer"&&(K.allBuffers=!1),K.allNoop&&ve!==O&&(K.allNoop=!1)):(K.writelen=xe,K.writecb=ve,K.writing=!0,K.sync=!0,M._write(ce,be,K.onwrite),K.sync=!1),ie&&!K.errored&&!K.destroyed}function B(M,K,ce,be,ve,xe,ie){K.writelen=be,K.writecb=ie,K.writing=!0,K.sync=!0,K.destroyed?K.onwrite(new p("write")):ce?M._writev(ve,K.onwrite):M._write(ve,xe,K.onwrite),K.sync=!1}function re(M,K,ce,be){--K.pendingcb,be(ce),Q(K),I(M,ce)}function S(M,K){const ce=M._writableState,be=ce.sync,ve=ce.writecb;if(typeof ve!="function"){I(M,new y);return}ce.writing=!1,ce.writecb=null,ce.length-=ce.writelen,ce.writelen=0,K?(K.stack,ce.errored||(ce.errored=K),M._readableState&&!M._readableState.errored&&(M._readableState.errored=K),be?i.nextTick(re,M,ce,K,ve):re(M,ce,K,ve)):(ce.buffered.length>ce.bufferedIndex&&he(M,ce),be?ce.afterWriteTickInfo!==null&&ce.afterWriteTickInfo.cb===ve?ce.afterWriteTickInfo.count++:(ce.afterWriteTickInfo={count:1,cb:ve,stream:M,state:ce},i.nextTick(H,ce.afterWriteTickInfo)):ee(M,ce,1,ve))}function H({stream:M,state:K,count:ce,cb:be}){return K.afterWriteTickInfo=null,ee(M,K,ce,be)}function ee(M,K,ce,be){for(!K.ending&&!M.destroyed&&K.length===0&&K.needDrain&&(K.needDrain=!1,M.emit("drain"));ce-- >0;)K.pendingcb--,be();K.destroyed&&Q(K),z(M,K)}function Q(M){if(M.writing)return;for(let ve=M.bufferedIndex;ve<M.buffered.length;++ve){var K;const{chunk:xe,callback:ie}=M.buffered[ve],me=M.objectMode?1:xe.length;M.length-=me,ie((K=M.errored)!==null&&K!==void 0?K:new p("write"))}const ce=M[U].splice(0);for(let ve=0;ve<ce.length;ve++){var be;ce[ve]((be=M.errored)!==null&&be!==void 0?be:new p("end"))}D(M)}function he(M,K){if(K.corked||K.bufferProcessing||K.destroyed||!K.constructed)return;const{buffered:ce,bufferedIndex:be,objectMode:ve}=K,xe=ce.length-be;if(!xe)return;let ie=be;if(K.bufferProcessing=!0,xe>1&&M._writev){K.pendingcb-=xe-1;const me=K.allNoop?O:fe=>{for(let He=ie;He<ce.length;++He)ce[He].callback(fe)},Ee=K.allNoop&&ie===0?ce:e(ce,ie);Ee.allBuffers=K.allBuffers,B(M,K,!0,K.length,Ee,"",me),D(K)}else{do{const{chunk:me,encoding:Ee,callback:fe}=ce[ie];ce[ie++]=null;const He=ve?1:me.length;B(M,K,!1,He,me,Ee,fe)}while(ie<ce.length&&!K.writing);ie===ce.length?D(K):ie>256?(ce.splice(0,ie),K.bufferedIndex=0):K.bufferedIndex=ie}K.bufferProcessing=!1}J.prototype._write=function(M,K,ce){if(this._writev)this._writev([{chunk:M,encoding:K}],ce);else throw new k("_write()")},J.prototype._writev=null,J.prototype.end=function(M,K,ce){const be=this._writableState;typeof M=="function"?(ce=M,M=null,K=null):typeof K=="function"&&(ce=K,K=null);let ve;if(M!=null){const xe=$(this,M,K);xe instanceof t&&(ve=xe)}return be.corked&&(be.corked=1,this.uncork()),ve||(!be.errored&&!be.ending?(be.ending=!0,z(this,be,!0),be.ended=!0):be.finished?ve=new T("end"):be.destroyed&&(ve=new p("end"))),typeof ce=="function"&&(ve||be.finished?i.nextTick(ce,ve):be[U].push(ce)),this};function W(M){return M.ending&&!M.destroyed&&M.constructed&&M.length===0&&!M.errored&&M.buffered.length===0&&!M.finished&&!M.writing&&!M.errorEmitted&&!M.closeEmitted}function G(M,K){let ce=!1;function be(ve){if(ce){I(M,ve??y());return}if(ce=!0,K.pendingcb--,ve){const xe=K[U].splice(0);for(let ie=0;ie<xe.length;ie++)xe[ie](ve);I(M,ve,K.sync)}else W(K)&&(K.prefinished=!0,M.emit("prefinish"),K.pendingcb++,i.nextTick(ne,M,K))}K.sync=!0,K.pendingcb++;try{M._final(be)}catch(ve){be(ve)}K.sync=!1}function X(M,K){!K.prefinished&&!K.finalCalled&&(typeof M._final=="function"&&!K.destroyed?(K.finalCalled=!0,G(M,K)):(K.prefinished=!0,M.emit("prefinish")))}function z(M,K,ce){W(K)&&(X(M,K),K.pendingcb===0&&(ce?(K.pendingcb++,i.nextTick((be,ve)=>{W(ve)?ne(be,ve):ve.pendingcb--},M,K)):W(K)&&(K.pendingcb++,ne(M,K))))}function ne(M,K){K.pendingcb--,K.finished=!0;const ce=K[U].splice(0);for(let be=0;be<ce.length;be++)ce[be]();if(M.emit("finish"),K.autoDestroy){const be=M._readableState;(!be||be.autoDestroy&&(be.endEmitted||be.readable===!1))&&M.destroy()}}s(J.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(M){this._writableState&&(this._writableState.destroyed=M)}},writable:{__proto__:null,get(){const M=this._writableState;return!!M&&M.writable!==!1&&!M.destroyed&&!M.errored&&!M.ending&&!M.ended},set(M){this._writableState&&(this._writableState.writable=!!M)}},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(){const M=this._writableState;return M?!M.destroyed&&!M.ending&&M.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)}}});const se=g.destroy;J.prototype.destroy=function(M,K){const ce=this._writableState;return!ce.destroyed&&(ce.bufferedIndex<ce.buffered.length||ce[U].length)&&i.nextTick(Q,ce),se.call(this,M,K),this},J.prototype._undestroy=g.undestroy,J.prototype._destroy=function(M,K){K(M)},J.prototype[d.captureRejectionSymbol]=function(M){this.destroy(M)};let ye;function _e(){return ye===void 0&&(ye={}),ye}return J.fromWeb=function(M,K){return _e().newStreamWritableFromWritableStream(M,K)},J.toWeb=function(M){return _e().newWritableStreamFromStreamWritable(M)},Sa}var ka,su;function Jm(){if(su)return ka;su=1;const i=Zr(),e=sr(),{isReadable:t,isWritable:r,isIterable:n,isNodeStream:s,isReadableNodeStream:o,isWritableNodeStream:a,isDuplexNodeStream:c,isReadableStream:l,isWritableStream:d}=or(),u=Sr(),{AbortError:m,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:v}}=Jt(),{destroyer:_}=Nn(),E=Zi(),x=Vo(),k=Oc(),{createDeferredPromise:y}=ti(),h=Gf(),p=globalThis.Blob||e.Blob,T=typeof p<"u"?function(R){return R instanceof p}:function(R){return!1},N=globalThis.AbortController||Cs().AbortController,{FunctionPrototypeCall:C}=ut();class F extends E{constructor(R){super(R),R?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),R?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}ka=function U(R,D){if(c(R))return R;if(o(R))return O({readable:R});if(a(R))return O({writable:R});if(s(R))return O({writable:!1,readable:!1});if(l(R))return O({readable:x.fromWeb(R)});if(d(R))return O({writable:k.fromWeb(R)});if(typeof R=="function"){const{value:$,write:Z,final:B,destroy:re}=I(R);if(n($))return h(F,$,{objectMode:!0,write:Z,final:B,destroy:re});const S=$?.then;if(typeof S=="function"){let H;const ee=C(S,$,Q=>{if(Q!=null)throw new v("nully","body",Q)},Q=>{_(H,Q)});return H=new F({objectMode:!0,readable:!1,write:Z,final(Q){B(async()=>{try{await ee,i.nextTick(Q,null)}catch(he){i.nextTick(Q,he)}})},destroy:re})}throw new v("Iterable, AsyncIterable or AsyncFunction",D,$)}if(T(R))return U(R.arrayBuffer());if(n(R))return h(F,R,{objectMode:!0,writable:!1});if(l(R?.readable)&&d(R?.writable))return F.fromWeb(R);if(typeof R?.writable=="object"||typeof R?.readable=="object"){const $=R!=null&&R.readable?o(R?.readable)?R?.readable:U(R.readable):void 0,Z=R!=null&&R.writable?a(R?.writable)?R?.writable:U(R.writable):void 0;return O({readable:$,writable:Z})}const J=R?.then;if(typeof J=="function"){let $;return C(J,R,Z=>{Z!=null&&$.push(Z),$.push(null)},Z=>{_($,Z)}),$=new F({objectMode:!0,writable:!1,read(){}})}throw new g(D,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],R)};function I(U){let{promise:R,resolve:D}=y();const J=new N,$=J.signal;return{value:U(async function*(){for(;;){const B=R;R=null;const{chunk:re,done:S,cb:H}=await B;if(i.nextTick(H),S)return;if($.aborted)throw new m(void 0,{cause:$.reason});({promise:R,resolve:D}=y()),yield re}}(),{signal:$}),write(B,re,S){const H=D;D=null,H({chunk:B,done:!1,cb:S})},final(B){const re=D;D=null,re({done:!0,cb:B})},destroy(B,re){J.abort(),re(B)}}}function O(U){const R=U.readable&&typeof U.readable.read!="function"?x.wrap(U.readable):U.readable,D=U.writable;let J=!!t(R),$=!!r(D),Z,B,re,S,H;function ee(Q){const he=S;S=null,he?he(Q):Q&&H.destroy(Q)}return H=new F({readableObjectMode:!!(R!=null&&R.readableObjectMode),writableObjectMode:!!(D!=null&&D.writableObjectMode),readable:J,writable:$}),$&&(u(D,Q=>{$=!1,Q&&_(R,Q),ee(Q)}),H._write=function(Q,he,W){D.write(Q,he)?W():Z=W},H._final=function(Q){D.end(),B=Q},D.on("drain",function(){if(Z){const Q=Z;Z=null,Q()}}),D.on("finish",function(){if(B){const Q=B;B=null,Q()}})),J&&(u(R,Q=>{J=!1,Q&&_(R,Q),ee(Q)}),R.on("readable",function(){if(re){const Q=re;re=null,Q()}}),R.on("end",function(){H.push(null)}),H._read=function(){for(;;){const Q=R.read();if(Q===null){re=H._read;return}if(!H.push(Q))return}}),H._destroy=function(Q,he){!Q&&S!==null&&(Q=new m),re=null,Z=null,B=null,S===null?he(Q):(S=he,_(D,Q),_(R,Q))},H}return ka}var Ra,ou;function Zi(){if(ou)return Ra;ou=1;const{ObjectDefineProperties:i,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=ut();Ra=o;const n=Vo(),s=Oc();r(o.prototype,n.prototype),r(o,n);{const d=t(s.prototype);for(let u=0;u<d.length;u++){const m=d[u];o.prototype[m]||(o.prototype[m]=s.prototype[m])}}function o(d){if(!(this instanceof o))return new o(d);n.call(this,d),s.call(this,d),d?(this.allowHalfOpen=d.allowHalfOpen!==!1,d.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),d.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}i(o.prototype,{writable:{__proto__:null,...e(s.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(s.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(s.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(s.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(s.prototype,"writableLength")},writableFinished:{__proto__:null,...e(s.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(s.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(s.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(s.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(d){this._readableState&&this._writableState&&(this._readableState.destroyed=d,this._writableState.destroyed=d)}}});let a;function c(){return a===void 0&&(a={}),a}o.fromWeb=function(d,u){return c().newStreamDuplexFromReadableWritablePair(d,u)},o.toWeb=function(d){return c().newReadableWritablePairFromDuplex(d)};let l;return o.from=function(d){return l||(l=Jm()),l(d,"body")},Ra}var Ia,au;function Kf(){if(au)return Ia;au=1;const{ObjectSetPrototypeOf:i,Symbol:e}=ut();Ia=o;const{ERR_METHOD_NOT_IMPLEMENTED:t}=Jt().codes,r=Zi(),{getHighWaterMark:n}=Uo();i(o.prototype,r.prototype),i(o,r);const s=e("kCallback");function o(l){if(!(this instanceof o))return new o(l);const d=l?n(this,l,"readableHighWaterMark",!0):null;d===0&&(l={...l,highWaterMark:null,readableHighWaterMark:d,writableHighWaterMark:l.writableHighWaterMark||0}),r.call(this,l),this._readableState.sync=!1,this[s]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",c)}function a(l){typeof this._flush=="function"&&!this.destroyed?this._flush((d,u)=>{if(d){l?l(d):this.destroy(d);return}u!=null&&this.push(u),this.push(null),l&&l()}):(this.push(null),l&&l())}function c(){this._final!==a&&a.call(this)}return o.prototype._final=a,o.prototype._transform=function(l,d,u){throw new t("_transform()")},o.prototype._write=function(l,d,u){const m=this._readableState,g=this._writableState,v=m.length;this._transform(l,d,(_,E)=>{if(_){u(_);return}E!=null&&this.push(E),g.ended||v===m.length||m.length<m.highWaterMark?u():this[s]=u})},o.prototype._read=function(){if(this[s]){const l=this[s];this[s]=null,l()}},Ia}var Ta,lu;function Xf(){if(lu)return Ta;lu=1;const{ObjectSetPrototypeOf:i}=ut();Ta=t;const e=Kf();i(t.prototype,e.prototype),i(t,e);function t(r){if(!(this instanceof t))return new t(r);e.call(this,r)}return t.prototype._transform=function(r,n,s){s(null,r)},Ta}var Ca,cu;function Pc(){if(cu)return Ca;cu=1;const i=Zr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:r,SymbolDispose:n}=ut(),s=Sr(),{once:o}=ti(),a=Nn(),c=Zi(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:d,ERR_INVALID_RETURN_VALUE:u,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:v},AbortError:_}=Jt(),{validateFunction:E,validateAbortSignal:x}=Bs(),{isIterable:k,isReadable:y,isReadableNodeStream:h,isNodeStream:p,isTransformStream:T,isWebStream:N,isReadableStream:C,isReadableFinished:F}=or(),I=globalThis.AbortController||Cs().AbortController;let O,U,R;function D(Q,he,W){let G=!1;Q.on("close",()=>{G=!0});const X=s(Q,{readable:he,writable:W},z=>{G=!z});return{destroy:z=>{G||(G=!0,a.destroyer(Q,z||new g("pipe")))},cleanup:X}}function J(Q){return E(Q[Q.length-1],"streams[stream.length - 1]"),Q.pop()}function $(Q){if(k(Q))return Q;if(h(Q))return Z(Q);throw new d("val",["Readable","Iterable","AsyncIterable"],Q)}async function*Z(Q){U||(U=Vo()),yield*U.prototype[r].call(Q)}async function B(Q,he,W,{end:G}){let X,z=null;const ne=_e=>{if(_e&&(X=_e),z){const M=z;z=null,M()}},se=()=>new t((_e,M)=>{X?M(X):z=()=>{X?M(X):_e()}});he.on("drain",ne);const ye=s(he,{readable:!1},ne);try{he.writableNeedDrain&&await se();for await(const _e of Q)he.write(_e)||await se();G&&(he.end(),await se()),W()}catch(_e){W(X!==_e?l(X,_e):_e)}finally{ye(),he.off("drain",ne)}}async function re(Q,he,W,{end:G}){T(he)&&(he=he.writable);const X=he.getWriter();try{for await(const z of Q)await X.ready,X.write(z).catch(()=>{});await X.ready,G&&await X.close(),W()}catch(z){try{await X.abort(z),W(z)}catch(ne){W(ne)}}}function S(...Q){return H(Q,o(J(Q)))}function H(Q,he,W){if(Q.length===1&&e(Q[0])&&(Q=Q[0]),Q.length<2)throw new m("streams");const G=new I,X=G.signal,z=W?.signal,ne=[];x(z,"options.signal");function se(){ve(new _)}R=R||ti().addAbortListener;let ye;z&&(ye=R(z,se));let _e,M;const K=[];let ce=0;function be(Ee){ve(Ee,--ce===0)}function ve(Ee,fe){var He;if(Ee&&(!_e||_e.code==="ERR_STREAM_PREMATURE_CLOSE")&&(_e=Ee),!(!_e&&!fe)){for(;K.length;)K.shift()(_e);(He=ye)===null||He===void 0||He[n](),G.abort(),fe&&(_e||ne.forEach(kt=>kt()),i.nextTick(he,_e,M))}}let xe;for(let Ee=0;Ee<Q.length;Ee++){const fe=Q[Ee],He=Ee<Q.length-1,kt=Ee>0,Ve=He||W?.end!==!1,Nt=Ee===Q.length-1;if(p(fe)){let A=function(f){f&&f.name!=="AbortError"&&f.code!=="ERR_STREAM_PREMATURE_CLOSE"&&be(f)};if(Ve){const{destroy:f,cleanup:b}=D(fe,He,kt);K.push(f),y(fe)&&Nt&&ne.push(b)}fe.on("error",A),y(fe)&&Nt&&ne.push(()=>{fe.removeListener("error",A)})}if(Ee===0)if(typeof fe=="function"){if(xe=fe({signal:X}),!k(xe))throw new u("Iterable, AsyncIterable or Stream","source",xe)}else k(fe)||h(fe)||T(fe)?xe=fe:xe=c.from(fe);else if(typeof fe=="function"){if(T(xe)){var ie;xe=$((ie=xe)===null||ie===void 0?void 0:ie.readable)}else xe=$(xe);if(xe=fe(xe,{signal:X}),He){if(!k(xe,!0))throw new u("AsyncIterable",`transform[${Ee-1}]`,xe)}else{var me;O||(O=Xf());const A=new O({objectMode:!0}),f=(me=xe)===null||me===void 0?void 0:me.then;if(typeof f=="function")ce++,f.call(xe,te=>{M=te,te!=null&&A.write(te),Ve&&A.end(),i.nextTick(be)},te=>{A.destroy(te),i.nextTick(be,te)});else if(k(xe,!0))ce++,B(xe,A,be,{end:Ve});else if(C(xe)||T(xe)){const te=xe.readable||xe;ce++,B(te,A,be,{end:Ve})}else throw new u("AsyncIterable or Promise","destination",xe);xe=A;const{destroy:b,cleanup:j}=D(xe,!1,!0);K.push(b),Nt&&ne.push(j)}}else if(p(fe)){if(h(xe)){ce+=2;const A=ee(xe,fe,be,{end:Ve});y(fe)&&Nt&&ne.push(A)}else if(T(xe)||C(xe)){const A=xe.readable||xe;ce++,B(A,fe,be,{end:Ve})}else if(k(xe))ce++,B(xe,fe,be,{end:Ve});else throw new d("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],xe);xe=fe}else if(N(fe)){if(h(xe))ce++,re($(xe),fe,be,{end:Ve});else if(C(xe)||k(xe))ce++,re(xe,fe,be,{end:Ve});else if(T(xe))ce++,re(xe.readable,fe,be,{end:Ve});else throw new d("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],xe);xe=fe}else xe=c.from(fe)}return(X!=null&&X.aborted||z!=null&&z.aborted)&&i.nextTick(se),xe}function ee(Q,he,W,{end:G}){let X=!1;if(he.on("close",()=>{X||W(new v)}),Q.pipe(he,{end:!1}),G){let z=function(){X=!0,he.end()};F(Q)?i.nextTick(z):Q.once("end",z)}else W();return s(Q,{readable:!0,writable:!1},z=>{const ne=Q._readableState;z&&z.code==="ERR_STREAM_PREMATURE_CLOSE"&&ne&&ne.ended&&!ne.errored&&!ne.errorEmitted?Q.once("end",W).once("error",W):W(z)}),s(he,{readable:!1,writable:!0},W)}return Ca={pipelineImpl:H,pipeline:S},Ca}var $a,du;function Qf(){if(du)return $a;du=1;const{pipeline:i}=Pc(),e=Zi(),{destroyer:t}=Nn(),{isNodeStream:r,isReadable:n,isWritable:s,isWebStream:o,isTransformStream:a,isWritableStream:c,isReadableStream:l}=or(),{AbortError:d,codes:{ERR_INVALID_ARG_VALUE:u,ERR_MISSING_ARGS:m}}=Jt(),g=Sr();return $a=function(..._){if(_.length===0)throw new m("streams");if(_.length===1)return e.from(_[0]);const E=[..._];if(typeof _[0]=="function"&&(_[0]=e.from(_[0])),typeof _[_.length-1]=="function"){const O=_.length-1;_[O]=e.from(_[O])}for(let O=0;O<_.length;++O)if(!(!r(_[O])&&!o(_[O]))){if(O<_.length-1&&!(n(_[O])||l(_[O])||a(_[O])))throw new u(`streams[${O}]`,E[O],"must be readable");if(O>0&&!(s(_[O])||c(_[O])||a(_[O])))throw new u(`streams[${O}]`,E[O],"must be writable")}let x,k,y,h,p;function T(O){const U=h;h=null,U?U(O):O?p.destroy(O):!I&&!F&&p.destroy()}const N=_[0],C=i(_,T),F=!!(s(N)||c(N)||a(N)),I=!!(n(C)||l(C)||a(C));if(p=new e({writableObjectMode:!!(N!=null&&N.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:F,readable:I}),F){if(r(N))p._write=function(U,R,D){N.write(U,R)?D():x=D},p._final=function(U){N.end(),k=U},N.on("drain",function(){if(x){const U=x;x=null,U()}});else if(o(N)){const R=(a(N)?N.writable:N).getWriter();p._write=async function(D,J,$){try{await R.ready,R.write(D).catch(()=>{}),$()}catch(Z){$(Z)}},p._final=async function(D){try{await R.ready,R.close().catch(()=>{}),k=D}catch(J){D(J)}}}const O=a(C)?C.readable:C;g(O,()=>{if(k){const U=k;k=null,U()}})}if(I){if(r(C))C.on("readable",function(){if(y){const O=y;y=null,O()}}),C.on("end",function(){p.push(null)}),p._read=function(){for(;;){const O=C.read();if(O===null){y=p._read;return}if(!p.push(O))return}};else if(o(C)){const U=(a(C)?C.readable:C).getReader();p._read=async function(){for(;;)try{const{value:R,done:D}=await U.read();if(!p.push(R))return;if(D){p.push(null);return}}catch{return}}}}return p._destroy=function(O,U){!O&&h!==null&&(O=new d),y=null,x=null,k=null,h===null?U(O):(h=U,r(C)&&t(C,O))},p},$a}var uu;function Ym(){if(uu)return no;uu=1;const i=globalThis.AbortController||Cs().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:r,ERR_OUT_OF_RANGE:n},AbortError:s}=Jt(),{validateAbortSignal:o,validateInteger:a,validateObject:c}=Bs(),l=ut().Symbol("kWeak"),d=ut().Symbol("kResistStopPropagation"),{finished:u}=Sr(),m=Qf(),{addAbortSignalNoValidate:g}=qo(),{isWritable:v,isNodeStream:_}=or(),{deprecate:E}=ti(),{ArrayPrototypePush:x,Boolean:k,MathFloor:y,Number:h,NumberIsNaN:p,Promise:T,PromiseReject:N,PromiseResolve:C,PromisePrototypeThen:F,Symbol:I}=ut(),O=I("kEmpty"),U=I("kEof");function R(z,ne){if(ne!=null&&c(ne,"options"),ne?.signal!=null&&o(ne.signal,"options.signal"),_(z)&&!v(z))throw new e("stream",z,"must be writable");const se=m(this,z);return ne!=null&&ne.signal&&g(ne.signal,se),se}function D(z,ne){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);ne!=null&&c(ne,"options"),ne?.signal!=null&&o(ne.signal,"options.signal");let se=1;ne?.concurrency!=null&&(se=y(ne.concurrency));let ye=se-1;return ne?.highWaterMark!=null&&(ye=y(ne.highWaterMark)),a(se,"options.concurrency",1),a(ye,"options.highWaterMark",0),ye+=se,(async function*(){const M=ti().AbortSignalAny([ne?.signal].filter(k)),K=this,ce=[],be={signal:M};let ve,xe,ie=!1,me=0;function Ee(){ie=!0,fe()}function fe(){me-=1,He()}function He(){xe&&!ie&&me<se&&ce.length<ye&&(xe(),xe=null)}async function kt(){try{for await(let Ve of K){if(ie)return;if(M.aborted)throw new s;try{if(Ve=z(Ve,be),Ve===O)continue;Ve=C(Ve)}catch(Nt){Ve=N(Nt)}me+=1,F(Ve,fe,Ee),ce.push(Ve),ve&&(ve(),ve=null),!ie&&(ce.length>=ye||me>=se)&&await new T(Nt=>{xe=Nt})}ce.push(U)}catch(Ve){const Nt=N(Ve);F(Nt,fe,Ee),ce.push(Nt)}finally{ie=!0,ve&&(ve(),ve=null)}}kt();try{for(;;){for(;ce.length>0;){const Ve=await ce[0];if(Ve===U)return;if(M.aborted)throw new s;Ve!==O&&(yield Ve),ce.shift(),He()}await new T(Ve=>{ve=Ve})}}finally{ie=!0,xe&&(xe(),xe=null)}}).call(this)}function J(z=void 0){return z!=null&&c(z,"options"),z?.signal!=null&&o(z.signal,"options.signal"),(async function*(){let se=0;for await(const _e of this){var ye;if(z!=null&&(ye=z.signal)!==null&&ye!==void 0&&ye.aborted)throw new s({cause:z.signal.reason});yield[se++,_e]}}).call(this)}async function $(z,ne=void 0){for await(const se of S.call(this,z,ne))return!0;return!1}async function Z(z,ne=void 0){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);return!await $.call(this,async(...se)=>!await z(...se),ne)}async function B(z,ne){for await(const se of S.call(this,z,ne))return se}async function re(z,ne){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function se(ye,_e){return await z(ye,_e),O}for await(const ye of D.call(this,se,ne));}function S(z,ne){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function se(ye,_e){return await z(ye,_e)?ye:O}return D.call(this,se,ne)}class H extends r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function ee(z,ne,se){var ye;if(typeof z!="function")throw new t("reducer",["Function","AsyncFunction"],z);se!=null&&c(se,"options"),se?.signal!=null&&o(se.signal,"options.signal");let _e=arguments.length>1;if(se!=null&&(ye=se.signal)!==null&&ye!==void 0&&ye.aborted){const ve=new s(void 0,{cause:se.signal.reason});throw this.once("error",()=>{}),await u(this.destroy(ve)),ve}const M=new i,K=M.signal;if(se!=null&&se.signal){const ve={once:!0,[l]:this,[d]:!0};se.signal.addEventListener("abort",()=>M.abort(),ve)}let ce=!1;try{for await(const ve of this){var be;if(ce=!0,se!=null&&(be=se.signal)!==null&&be!==void 0&&be.aborted)throw new s;_e?ne=await z(ne,ve,{signal:K}):(ne=ve,_e=!0)}if(!ce&&!_e)throw new H}finally{M.abort()}return ne}async function Q(z){z!=null&&c(z,"options"),z?.signal!=null&&o(z.signal,"options.signal");const ne=[];for await(const ye of this){var se;if(z!=null&&(se=z.signal)!==null&&se!==void 0&&se.aborted)throw new s(void 0,{cause:z.signal.reason});x(ne,ye)}return ne}function he(z,ne){const se=D.call(this,z,ne);return(async function*(){for await(const _e of se)yield*_e}).call(this)}function W(z){if(z=h(z),p(z))return 0;if(z<0)throw new n("number",">= 0",z);return z}function G(z,ne=void 0){return ne!=null&&c(ne,"options"),ne?.signal!=null&&o(ne.signal,"options.signal"),z=W(z),(async function*(){var ye;if(ne!=null&&(ye=ne.signal)!==null&&ye!==void 0&&ye.aborted)throw new s;for await(const M of this){var _e;if(ne!=null&&(_e=ne.signal)!==null&&_e!==void 0&&_e.aborted)throw new s;z--<=0&&(yield M)}}).call(this)}function X(z,ne=void 0){return ne!=null&&c(ne,"options"),ne?.signal!=null&&o(ne.signal,"options.signal"),z=W(z),(async function*(){var ye;if(ne!=null&&(ye=ne.signal)!==null&&ye!==void 0&&ye.aborted)throw new s;for await(const M of this){var _e;if(ne!=null&&(_e=ne.signal)!==null&&_e!==void 0&&_e.aborted)throw new s;if(z-- >0&&(yield M),z<=0)return}}).call(this)}return no.streamReturningOperators={asIndexedPairs:E(J,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:S,flatMap:he,map:D,take:X,compose:R},no.promiseReturningOperators={every:Z,forEach:re,reduce:ee,toArray:Q,some:$,find:B},no}var Aa,hu;function Jf(){if(hu)return Aa;hu=1;const{ArrayPrototypePop:i,Promise:e}=ut(),{isIterable:t,isNodeStream:r,isWebStream:n}=or(),{pipelineImpl:s}=Pc(),{finished:o}=Sr();Yf();function a(...c){return new e((l,d)=>{let u,m;const g=c[c.length-1];if(g&&typeof g=="object"&&!r(g)&&!t(g)&&!n(g)){const v=i(c);u=v.signal,m=v.end}s(c,(v,_)=>{v?d(v):l(_)},{signal:u,end:m})})}return Aa={finished:o,pipeline:a},Aa}var fu;function Yf(){if(fu)return la.exports;fu=1;const{Buffer:i}=sr(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=ut(),{promisify:{custom:n}}=ti(),{streamReturningOperators:s,promiseReturningOperators:o}=Ym(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:a}}=Jt(),c=Qf(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:d}=Uo(),{pipeline:u}=Pc(),{destroyer:m}=Nn(),g=Sr(),v=Jf(),_=or(),E=la.exports=Lc().Stream;E.isDestroyed=_.isDestroyed,E.isDisturbed=_.isDisturbed,E.isErrored=_.isErrored,E.isReadable=_.isReadable,E.isWritable=_.isWritable,E.Readable=Vo();for(const k of t(s)){let h=function(...p){if(new.target)throw a();return E.Readable.from(r(y,this,p))};const y=s[k];e(h,"name",{__proto__:null,value:y.name}),e(h,"length",{__proto__:null,value:y.length}),e(E.Readable.prototype,k,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}for(const k of t(o)){let h=function(...p){if(new.target)throw a();return r(y,this,p)};const y=o[k];e(h,"name",{__proto__:null,value:y.name}),e(h,"length",{__proto__:null,value:y.length}),e(E.Readable.prototype,k,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}E.Writable=Oc(),E.Duplex=Zi(),E.Transform=Kf(),E.PassThrough=Xf(),E.pipeline=u;const{addAbortSignal:x}=qo();return E.addAbortSignal=x,E.finished=g,E.destroy=m,E.compose=c,E.setDefaultHighWaterMark=l,E.getDefaultHighWaterMark=d,e(E,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return v}}),e(u,n,{__proto__:null,enumerable:!0,get(){return v.pipeline}}),e(g,n,{__proto__:null,enumerable:!0,get(){return v.finished}}),E.Stream=E,E._isUint8Array=function(y){return y instanceof Uint8Array},E._uint8ArrayToBuffer=function(y){return i.from(y.buffer,y.byteOffset,y.byteLength)},la.exports}var pu;function Zf(){return pu||(pu=1,function(i){const e=Yf(),t=Jf(),r=e.Readable.destroy;i.exports=e.Readable,i.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,i.exports._isUint8Array=e._isUint8Array,i.exports.isDisturbed=e.isDisturbed,i.exports.isErrored=e.isErrored,i.exports.isReadable=e.isReadable,i.exports.Readable=e.Readable,i.exports.Writable=e.Writable,i.exports.Duplex=e.Duplex,i.exports.Transform=e.Transform,i.exports.PassThrough=e.PassThrough,i.exports.addAbortSignal=e.addAbortSignal,i.exports.finished=e.finished,i.exports.destroy=e.destroy,i.exports.destroy=r,i.exports.pipeline=e.pipeline,i.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),i.exports.Stream=e.Stream,i.exports.default=i.exports}(aa)),aa.exports}var Mc=Zf();const Na=Symbol("iter");function bs(i,e,t=4){if(t===0)return Object.assign(i,e);for(const r in e)i[r]=bs(i[r]||Object.create(null),e[r],t-1);return i}function ep(i,e,t=4){let r=!1;for(const n in i)if(n in e){const s=t===0?null:ep(i[n],e[n],t-1);if(s!==!1)r=r||Object.create(null),r[n]=s;else if(t===3)return!1}return r}function tp(i,e,t=4){let r=!1;for(const n in i)if(!(n in e))r=r||Object.create(null),r[n]=t===0?null:bs({},i[n],t-1);else if(t!==0){const s=tp(i[n],e[n],t-1);if(s!==!1)r=r||Object.create(null),r[n]=s;else if(t===3)return!1}return r}class Zm{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||ze}_termFromId(e){if(e[0]==="."){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return fs(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let s;return t&&r&&n&&(Zl(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${r}.${n}.${s}`:`.${t}.${r}.${n}`]}return this._ids[hn(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${Zl(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:hn(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;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))}}class jt{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||ze,this._entityIndex=t.entityIndex||new Zm({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;const t=this._graphs;let r,n;for(const s in t)for(const o in r=t[s].subjects)for(const a in n=r[o])e+=Object.keys(n[a]).length;return this._size=e}_addToIndex(e,t,r,n){const s=e[t]||(e[t]={}),o=s[r]||(s[r]={}),a=n in o;return a||(o[n]=null),!a}_removeFromIndex(e,t,r,n){const s=e[t],o=s[r];delete o[n];for(const a in o)return;delete s[r];for(const a in s)return;delete e[t]}*_findInIndex(e,t,r,n,s,o,a,c){let l,d,u;const m=this._entities,g=this._termFromId(m[c]),v={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const _ in e)if(d=e[_]){v[s]=this._termFromId(m[_]),r&&((l=d,d={})[r]=l[r]);for(const E in d)if(u=d[E]){v[o]=this._termFromId(m[E]);const x=n?n in u?[n]:[]:Object.keys(u);for(let k=0;k<x.length;k++)v[a]=this._termFromId(m[x[k]]),yield this._factory.quad(v.subject,v.predicate,v.object,g)}}}_loop(e,t){for(const r in e)t(r)}_loopByKey0(e,t,r){let n,s;if(n=e[t])for(s in n)r(s)}_loopByKey1(e,t,r){let n,s;for(n in e)s=e[n],s[t]&&r(n)}_loopBy2Keys(e,t,r,n){let s,o,a;if((s=e[t])&&(o=s[r]))for(a in o)n(a)}_countInIndex(e,t,r,n){let s=0,o,a,c;t&&((o=e,e={})[t]=o[t]);for(const l in e)if(a=e[l]){r&&((o=a,a={})[r]=o[r]);for(const d in a)(c=a[d])&&(n?n in c&&s++:s+=Object.keys(c).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return r=>{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1;let s=this._graphs[n];return s||(s=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),r=this._termToNewNumericId(r),this._addToIndex(s.subjects,e,t,r)?(this._addToIndex(s.predicates,t,r,e),this._addToIndex(s.objects,r,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,r,n){return e&&e.subject&&({subject:e,predicate:t,object:r,graph:n}=e),!this.readQuads(e,t,r,n).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,r,n){t||({subject:e,predicate:t,object:r,graph:n}=e),n=n?this._termToNumericId(n):1;const s=this._graphs;let o,a,c;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(r=r&&this._termToNumericId(r))||!(o=s[n])||!(a=o.subjects[e])||!(c=a[t])||!(r in c))return!1;this._removeFromIndex(o.subjects,e,t,r),this._removeFromIndex(o.predicates,t,r,e),this._removeFromIndex(o.objects,r,e,t),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,r,n){const s=new Mc.Readable({objectMode:!0}),o=this.readQuads(e,t,r,n);return s._read=a=>{for(;--a>=0;){const{done:c,value:l}=o.next();if(c){s.push(null);return}s.push(l)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,n){return[...this.readQuads(e,t,r,n)]}*readQuads(e,t,r,n){const s=this._getGraphs(n);let o,a,c,l;if(!(e&&!(a=this._termToNumericId(e))||t&&!(c=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(const d in s)(o=s[d])&&(a?l?yield*this._findInIndex(o.objects,l,a,c,"object","subject","predicate",d):yield*this._findInIndex(o.subjects,a,c,null,"subject","predicate","object",d):c?yield*this._findInIndex(o.predicates,c,l,null,"predicate","object","subject",d):l?yield*this._findInIndex(o.objects,l,null,null,"object","subject","predicate",d):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",d))}match(e,t,r,n){return new mr(this,e,t,r,n,{entityIndex:this._entityIndex})}countQuads(e,t,r,n){const s=this._getGraphs(n);let o=0,a,c,l,d;if(e&&!(c=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(d=this._termToNumericId(r)))return 0;for(const u in s)(a=s[u])&&(e?r?o+=this._countInIndex(a.objects,d,c,l):o+=this._countInIndex(a.subjects,c,l,d):t?o+=this._countInIndex(a.predicates,l,d,c):o+=this._countInIndex(a.objects,d,c,l));return o}forEach(e,t,r,n,s){this.some(o=>(e(o,this),!1),t,r,n,s)}every(e,t,r,n,s){return!this.some(o=>!e(o,this),t,r,n,s)}some(e,t,r,n,s){for(const o of this.readQuads(t,r,n,s))if(e(o,this))return!0;return!1}getSubjects(e,t,r){const n=[];return this.forSubjects(s=>{n.push(s)},e,t,r),n}forSubjects(e,t,r,n){const s=this._getGraphs(n);let o,a,c;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r))))for(n in s)(o=s[n])&&(a?c?this._loopBy2Keys(o.predicates,a,c,e):this._loopByKey1(o.subjects,a,e):c?this._loopByKey0(o.objects,c,e):this._loop(o.subjects,e))}getPredicates(e,t,r){const n=[];return this.forPredicates(s=>{n.push(s)},e,t,r),n}forPredicates(e,t,r,n){const s=this._getGraphs(n);let o,a,c;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r))))for(n in s)(o=s[n])&&(a?c?this._loopBy2Keys(o.objects,c,a,e):this._loopByKey0(o.subjects,a,e):c?this._loopByKey1(o.predicates,c,e):this._loop(o.predicates,e))}getObjects(e,t,r){const n=[];return this.forObjects(s=>{n.push(s)},e,t,r),n}forObjects(e,t,r,n){const s=this._getGraphs(n);let o,a,c;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r))))for(n in s)(o=s[n])&&(a?c?this._loopBy2Keys(o.subjects,a,c,e):this._loopByKey1(o.objects,a,e):c?this._loopByKey0(o.predicates,c,e):this._loop(o.objects,e))}getGraphs(e,t,r){const n=[];return this.forGraphs(s=>{n.push(s)},e,t,r),n}forGraphs(e,t,r,n){for(const s in this._graphs)this.some(o=>(e(o.graph),!0),t,r,n,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(a,c)=>{throw new Error(`${a.value} ${c}`)},s=this.getQuads(null,Lt.rdf.rest,Lt.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{const c=[];let l=!1,d,u;const m=a.graph;let g=a.subject;for(;g&&!l;){const v=this.getQuads(null,null,g,null),_=this.getQuads(g,null,null,null);let E,x=null,k=null,y=null;for(let h=0;h<_.length&&!l;h++)E=_[h],E.graph.equals(m)?d?l=n(g,"has non-list arcs out"):E.predicate.value===Lt.rdf.first?x?l=n(g,"has multiple rdf:first arcs"):o.push(x=E):E.predicate.value===Lt.rdf.rest?k?l=n(g,"has multiple rdf:rest arcs"):o.push(k=E):v.length?l=n(g,"can't be subject and object"):(d=E,u="subject"):l=n(g,"not confined to single graph");for(let h=0;h<v.length&&!l;++h)E=v[h],d?l=n(g,"can't have coreferences"):E.predicate.value===Lt.rdf.rest?y?l=n(g,"has incoming rdf:rest arcs"):y=E:(d=E,u="object");x?c.unshift(x.object):l=n(g,"has no list head"),g=y&&y.subject}l?e=!1:d&&(r[d[u].value]=c)}),e&&this.removeQuads(o),r}addAll(e){if(e instanceof mr&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof jt&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=bs(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof mr&&(e=e.filtered),e===this)return!0;if(!(e instanceof jt)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,r=e._graphs;let n,s,o,a,c;for(const l in r){if(!(n=t[l]))return!1;n=n.subjects;for(const d in s=r[l].subjects){if(!(o=n[d]))return!1;for(const u in a=s[d]){if(!(c=o[u]))return!1;for(const m in a[u])if(!(m in c))return!1}}}return!0}deleteMatches(e,t,r,n){for(const s of this.match(e,t,r,n))this.removeQuad(s);return this}difference(e){if(e&&e instanceof mr&&(e=e.filtered),e===this)return new jt({entityIndex:this._entityIndex});if(e instanceof jt&&e._entityIndex===this._entityIndex){const t=new jt({entityIndex:this._entityIndex}),r=tp(this._graphs,e._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof mr&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new jt({entityIndex:this._entityIndex});for(const r of this)e(r,this)&&t.add(r);return t}intersection(e){if(e instanceof mr&&(e=e.filtered),e===this){const t=new jt({entityIndex:this._entityIndex});return t._graphs=bs(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof jt&&this._entityIndex===e._entityIndex){const t=new jt({entityIndex:this._entityIndex}),r=ep(e._graphs,this._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new jt({entityIndex:this._entityIndex});for(const r of this)t.add(e(r,this));return t}reduce(e,t){const r=this.readQuads();let n=t===void 0?r.next().value:t;for(const s of r)n=e(n,s,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new Dc().quadsToString(this)}union(e){const t=new jt({entityIndex:this._entityIndex});return t._graphs=bs(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function Fi(i,e,t=0){const r=e[t];if(r&&!(r in i))return!1;let n=!1;for(const s in r?{[r]:i[r]}:i){const o=t===2?null:Fi(i[s],e,t+1);o!==!1&&(n=n||Object.create(null),n[s]=o)}return n}class mr extends Mc.Readable{constructor(e,t,r,n,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:r,object:n,graph:s,options:o})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:r,predicate:n,subject:s}=this,o=this._filtered=new jt({factory:e._factory,entityIndex:this.options.entityIndex});let a,c,l;if(s&&!(a=o._termToNumericId(s))||n&&!(c=o._termToNumericId(n))||r&&!(l=o._termToNumericId(r)))return o;const d=e._getGraphs(t);for(const u in d){let m,g,v,_;(_=d[u])&&(!a&&c?(g=Fi(_.predicates,[c,l,a]))&&(m=Fi(_.subjects,[a,c,l]),v=Fi(_.objects,[l,a,c])):l?(v=Fi(_.objects,[l,a,c]))&&(m=Fi(_.subjects,[a,c,l]),g=Fi(_.predicates,[c,l,a])):(m=Fi(_.subjects,[a,c,l]))&&(g=Fi(_.predicates,[c,l,a]),v=Fi(_.objects,[l,a,c])),m&&(o._graphs[u]={subjects:m,predicates:g,objects:v}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Na]&&(this[Na]=this[Symbol.iterator]());const t=this[Na];for(;--e>=0;){const{done:r,value:n}=t.next();if(r){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,r,n){return this.filtered.deleteMatches(e,t,r,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,r,n,s){return this.filtered.every(e,t,r,n,s)}filter(e){return this.filtered.filter(e)}forEach(e,t,r,n,s){return this.filtered.forEach(e,t,r,n,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,r,n,s){return this.filtered.some(e,t,r,n,s)}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 Dc().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,r,n){return new mr(this.filtered,e,t,r,n,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class eg extends Mc.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new zf(e);let r,n;const s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),t.parse({on:(o,a)=>{switch(o){case"data":r=a;break;case"end":n=a;break}}},s),this._transform=(o,a,c)=>{r(o),c()},this._flush=o=>{n(),o()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const Oe="http://www.w3.org/ns/shacl#",mu="http://datashapes.org/dash#",wr="http://www.w3.org/2001/XMLSchema#",gr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Fc="http://www.w3.org/2000/01/rdf-schema#",jc="http://www.w3.org/2004/02/skos/core#",tg="http://www.w3.org/2002/07/owl#",ig="http://www.w3.org/ns/oa#",rg="http://purl.org/dc/terms/",ng="http://xmlns.com/foaf/0.1/",ys=ze.namedNode("loaded-shapes"),Ji=ze.namedNode("loaded-data"),qt=ze.namedNode(gr+"type"),ec=ze.namedNode(rg+"conformsTo"),gu=ze.namedNode(Fc+"subClassOf"),Bc=ze.namedNode(tg+"imports"),sg=ze.namedNode(jc+"broader"),og=ze.namedNode(jc+"narrower"),ao=ze.namedNode(Oe+"NodeShape"),ag=ze.namedNode(Oe+"IRI"),So=ze.namedNode(Oe+"property"),qc=ze.namedNode(Oe+"class"),lg=ze.namedNode(Oe+"node"),gn=ze.namedNode(Oe+"targetClass"),cg=ze.namedNode(Oe+"nodeKind"),dg=ze.namedNode(wr+"string");function vs(i,e,t=Oe,r){let n="";const s=ug(i,e,t,r);return s&&(n=s.value),n}function ug(i,e,t=Oe,r){let n;const s=t+e;if(r?.length){for(const o of r)for(const a of i)if(a.predicate.value===s){if(a.object.id.endsWith(`@${o}`))return a.object;a.object.id.indexOf("@")<0?n=a.object:n||(n=a.object)}}else for(const o of i)if(o.predicate.value===s)return o.object;return n}function hg(i){i.querySelector(".editor")?.focus()}function qs(i,e){return vs(i,"prefLabel",jc,e)||vs(i,"label",Fc,e)||vs(i,"name",ng,e)}function ip(i,e,t){const r=[];for(const n of i)r.push({value:n,label:qs(e.getQuads(n,null,null,null),t),children:[]});return r}function tc(i,e){for(const t in e)i=i.replace(e[t],"");return i}function rp(i,e,t,r,n=new Set){for(const s of e.owlImports)n.has(s.id)||(n.add(s.id),r.push(...t.getSubjects(qt,i,s)));e.parent&&rp(i,e.parent,t,r,n)}function Uc(i,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return ip(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(qt,i,ys);t.push(...e.config.store.getSubjects(qt,i,Ji)),rp(i,e,e.config.store,t);const r=new Map,n=new Map;for(const o of t)r.set(o.id,{value:o,label:qs(e.config.store.getQuads(o,null,null,null),e.config.languages),children:[]});for(const o of t){for(const a of e.config.store.getObjects(o,sg,null))r.has(a.id)&&n.set(o.id,a.id);for(const a of e.config.store.getObjects(o,og,null))r.has(a.id)&&n.set(a.id,o.id);for(const a of e.config.store.getObjects(o,gu,null))r.has(a.id)&&n.set(o.id,a.id)}for(const[o,a]of n.entries())r.get(a)?.children?.push(r.get(o));const s=[];for(const[o,a]of r.entries())n.has(o)||s.push(a);for(const o of e.config.store.getSubjects(gu,i,null))s.push(...Uc(o,e));return s}}function ic(i){let e;try{e=new URL(i)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function bu(i,e,t){if(e===void 0)return t;if(t===void 0)return e;const r=i.indexOf(e.language);if(r<0)return t;const n=i.indexOf(t.language);return n<0||n>r?e:t}function fg(i,{remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(a,c)=>{throw new Error(`${a.value} ${c}`)},s=i.getQuads(null,gr+"rest",gr+"nil",null),o=e?[...s]:[];return s.forEach(a=>{const c=[];let l=!1,d,u;const m=a.graph;let g=a.subject;for(;g&&!l;){const v=i.getQuads(null,null,g,null),_=i.getQuads(g,null,null,null).filter(h=>!h.predicate.equals(qt));let E,x=null,k=null,y=null;for(let h=0;h<_.length&&!l;h++)E=_[h],E.graph.equals(m)?d?l=n(g,"has non-list arcs out"):E.predicate.value===gr+"first"?x?l=n(g,"has multiple rdf:first arcs"):o.push(x=E):E.predicate.value===gr+"rest"?k?l=n(g,"has multiple rdf:rest arcs"):o.push(k=E):v.length?l=n(g,"can't be subject and object"):(d=E,u="subject"):l=n(g,"not confined to single graph");for(let h=0;h<v.length&&!l;++h)E=v[h],d?l=n(g,"can't have coreferences"):E.predicate.value===gr+"rest"?y?l=n(g,"has incoming rdf:rest arcs"):y=E:(d=E,u="object");x?c.unshift(x.object):l=n(g,"has no list head"),g=y&&y.subject}l?e=!1:d&&(r[d[u].value]=c)}),e&&i.removeQuads(o),r}function np(i,e,t){const r=document.createElement("div");r.classList.add("shacl-or-constraint");const n=[];if(e instanceof _r){const s=[];let o=!1;i.length&&(o=t.store.countQuads(i[0],So,null,null)>0);for(let l=0;l<i.length;l++)if(o){const d=t.store.getObjects(i[l],So,null),u=[];let m="";for(const g of d){const v=new Io(g,e,t);u.push(v),m+=(m.length>1?" / ":"")+v.template.label}s.push(u),n.push({label:m,value:l.toString()})}else{const d=new Io(i[l],e,t);s.push([d]),n.push({label:d.template.label,value:l.toString()})}const a=t.theme.createListEditor("Please choose",null,!1,n),c=a.querySelector(".editor");c.onchange=()=>{if(c.value){const l=s[parseInt(c.value)];let d;l.length&&(d=l[0],r.replaceWith(l[0]));for(let u=1;u<l.length;u++)d.after(l[u]),d=l[u]}},r.appendChild(a)}else{const s=[];for(let c=0;c<i.length;c++){const l=t.store.getQuads(i[c],null,null,null);l.length&&(s.push(l),n.push({label:qs(l,t.languages)||tc(l[0].predicate.value,t.prefixes)+" = "+tc(l[0].object.value,t.prefixes),value:c.toString()}))}const o=t.theme.createListEditor(e.template.label+"?",null,!1,n,e.template),a=o.querySelector(".editor");a.onchange=()=>{a.value&&r.replaceWith(yo(e.template.clone().merge(s[parseInt(a.value)]),void 0,!0))},r.appendChild(o)}return r}function pg(i,e,t){if(e instanceof yi){const r=e.datatype;for(const n of i){const s=t.store.getQuads(n,null,null,null);for(const o of s)if(o.predicate.value===`${Oe}datatype`&&o.object.equals(r))return s}}else{const r=t.store.getObjects(e,qt,null);for(const n of i){const s=t.store.getQuads(n,null,null,null);for(const o of s)if(r.length>0){if(o.predicate.value===`${Oe}node`){for(const a of r)if(t.store.getQuads(o.object,gn,a,null).length>0)return s}if(o.predicate.equals(qc)){for(const a of r)if(o.object.equals(a))return s}}else if(o.predicate.equals(cg)&&o.object.equals(ag))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function mg(i,e,t){for(const r of i){let n=!1;const s=t.store.getObjects(r,So,null);for(const o of s){const a=t.store.getObjects(o,`${Oe}path`,null);for(const c of a)if(n=t.store.countQuads(e,c,null,null)>0,n)break}if(n)return s}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const gg={[`${Oe}name`]:(i,e)=>{const t=e;i.name=bu(i.config.languages,i.name,t)},[`${Oe}description`]:(i,e)=>{const t=e;i.description=bu(i.config.languages,i.description,t)},[`${Oe}path`]:(i,e)=>{i.path=e.value},[`${Oe}node`]:(i,e)=>{i.node=e},[`${Oe}datatype`]:(i,e)=>{i.datatype=e},[`${Oe}nodeKind`]:(i,e)=>{i.nodeKind=e},[`${Oe}minCount`]:(i,e)=>{i.minCount=parseInt(e.value)},[`${Oe}maxCount`]:(i,e)=>{i.maxCount=parseInt(e.value)},[`${Oe}minLength`]:(i,e)=>{i.minLength=parseInt(e.value)},[`${Oe}maxLength`]:(i,e)=>{i.maxLength=parseInt(e.value)},[`${Oe}minInclusive`]:(i,e)=>{i.minInclusive=parseInt(e.value)},[`${Oe}maxInclusive`]:(i,e)=>{i.maxInclusive=parseInt(e.value)},[`${Oe}minExclusive`]:(i,e)=>{i.minExclusive=parseInt(e.value)},[`${Oe}maxExclusive`]:(i,e)=>{i.maxExclusive=parseInt(e.value)},[`${Oe}pattern`]:(i,e)=>{i.pattern=e.value},[`${Oe}order`]:(i,e)=>{i.order=parseInt(e.value)},[`${mu}singleLine`]:(i,e)=>{i.singleLine=e.value==="true"},[`${mu}readonly`]:(i,e)=>{i.readonly=e.value==="true"},[`${ig}styleClass`]:(i,e)=>{i.cssClass=e.value},[`${Oe}and`]:(i,e)=>{i.shaclAnd=e.value},[`${Oe}in`]:(i,e)=>{i.shaclIn=e.value},[`${Oe}languageIn`]:(i,e)=>{i.languageIn=i.config.lists[e.value],i.datatype=ze.namedNode(gr+"langString")},[`${Oe}defaultValue`]:(i,e)=>{i.defaultValue=e},[`${Oe}hasValue`]:(i,e)=>{i.hasValue=e},[`${Oe}qualifiedValueShape`]:(i,e)=>{i.qualifiedValueShape=e},[`${Oe}qualifiedMinCount`]:(i,e)=>{i.minCount=parseInt(e.value)},[`${Oe}qualifiedMaxCount`]:(i,e)=>{i.maxCount=parseInt(e.value)},[Bc.id]:(i,e)=>{i.owlImports.push(e)},[qc.id]:(i,e)=>{i.class=e;const t=i.config.store.getSubjects(gn,e,null);t.length>0&&(i.node=t[0])},[`${Oe}or`]:(i,e)=>{const t=i.config.lists[e.value];t?.length?i.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",i.config.lists)},[`${Oe}xone`]:(i,e)=>{const t=i.config.lists[e.value];t?.length?i.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",i.config.lists)}};class bg{constructor(e,t,r){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=r,this.merge(e),this.qualifiedValueShape&&this.merge(r.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)gg[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||qs(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?tc(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(this.node&&this.extendedShapes.push(this.node),this.shaclAnd)){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const r of t)this.extendedShapes.push(r)}return this}clone(){const e=Object.assign({},this);return e.extendedShapes=[...this.extendedShapes],e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),this.shaclXone&&(e.shaclXone=[...this.shaclXone]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}const yg=`form { display:block; --label-width: 8em; --caret-size: 10px; }
27
+ `;super(r),this.name="AggregateError",this.errors=t}}return ca={AggregateError:i,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,r){return e.slice(t,r)},Error,FunctionPrototypeCall(e,t,...r){return e.call(t,...r)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,r){return Object.defineProperty(e,t,r)},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,r){return e.then(t,r)},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,r){return e.slice(t,r)},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,r){return e.set(t,r)},Boolean,Uint8Array},ca}var da={exports:{}},ua,Bd;function Wf(){return Bd||(Bd=1,ua={format(i,...e){return i.replace(/%([sdifj])/g,function(...[t,r]){const n=e.shift();return r==="f"?n.toFixed(6):r==="j"?JSON.stringify(n):r==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(i){switch(typeof i){case"string":if(i.includes("'"))if(i.includes('"')){if(!i.includes("`")&&!i.includes("${"))return`\`${i}\``}else return`"${i}"`;return`'${i}'`;case"number":return isNaN(i)?"NaN":Object.is(i,-0)?String(i):i;case"bigint":return`${String(i)}n`;case"boolean":case"undefined":return String(i);case"object":return"{}"}}}),ua}var ha,qd;function Jt(){if(qd)return ha;qd=1;const{format:i,inspect:e}=Wf(),{AggregateError:t}=ut(),r=globalThis.AggregateError||t,n=Symbol("kIsNodeError"),s=["string","function","number","object","Function","Object","boolean","bigint","symbol"],o=/^([A-Z][a-z0-9]*)+$/,a="__node_internal_",c={};function l(E,x){if(!E)throw new c.ERR_INTERNAL_ASSERTION(x)}function d(E){let x="",k=E.length;const y=E[0]==="-"?1:0;for(;k>=y+4;k-=3)x=`_${E.slice(k-3,k)}${x}`;return`${E.slice(0,k)}${x}`}function u(E,x,k){if(typeof x=="function")return l(x.length<=k.length,`Code: ${E}; The provided arguments length (${k.length}) does not match the required ones (${x.length}).`),x(...k);const y=(x.match(/%[dfijoOs]/g)||[]).length;return l(y===k.length,`Code: ${E}; The provided arguments length (${k.length}) does not match the required ones (${y}).`),k.length===0?x:i(x,...k)}function m(E,x,k){k||(k=Error);class y extends k{constructor(...p){super(u(E,x,p))}toString(){return`${this.name} [${E}]: ${this.message}`}}Object.defineProperties(y.prototype,{name:{value:k.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${E}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),y.prototype.code=E,y.prototype[n]=!0,c[E]=y}function g(E){const x=a+E.name;return Object.defineProperty(E,"name",{value:x}),E}function v(E,x){if(E&&x&&E!==x){if(Array.isArray(x.errors))return x.errors.push(E),x;const k=new r([x,E],x.message);return k.code=x.code,k}return E||x}class _ extends Error{constructor(x="The operation was aborted",k=void 0){if(k!==void 0&&typeof k!="object")throw new c.ERR_INVALID_ARG_TYPE("options","Object",k);super(x,k),this.code="ABORT_ERR",this.name="AbortError"}}return m("ERR_ASSERTION","%s",Error),m("ERR_INVALID_ARG_TYPE",(E,x,k)=>{l(typeof E=="string","'name' must be a string"),Array.isArray(x)||(x=[x]);let y="The ";E.endsWith(" argument")?y+=`${E} `:y+=`"${E}" ${E.includes(".")?"property":"argument"} `,y+="must be ";const h=[],p=[],T=[];for(const C of x)l(typeof C=="string","All expected entries have to be of type string"),s.includes(C)?h.push(C.toLowerCase()):o.test(C)?p.push(C):(l(C!=="object",'The value "object" should be written as "Object"'),T.push(C));if(p.length>0){const C=h.indexOf("object");C!==-1&&(h.splice(h,C,1),p.push("Object"))}if(h.length>0){switch(h.length){case 1:y+=`of type ${h[0]}`;break;case 2:y+=`one of type ${h[0]} or ${h[1]}`;break;default:{const C=h.pop();y+=`one of type ${h.join(", ")}, or ${C}`}}(p.length>0||T.length>0)&&(y+=" or ")}if(p.length>0){switch(p.length){case 1:y+=`an instance of ${p[0]}`;break;case 2:y+=`an instance of ${p[0]} or ${p[1]}`;break;default:{const C=p.pop();y+=`an instance of ${p.join(", ")}, or ${C}`}}T.length>0&&(y+=" or ")}switch(T.length){case 0:break;case 1:T[0].toLowerCase()!==T[0]&&(y+="an "),y+=`${T[0]}`;break;case 2:y+=`one of ${T[0]} or ${T[1]}`;break;default:{const C=T.pop();y+=`one of ${T.join(", ")}, or ${C}`}}if(k==null)y+=`. Received ${k}`;else if(typeof k=="function"&&k.name)y+=`. Received function ${k.name}`;else if(typeof k=="object"){var N;if((N=k.constructor)!==null&&N!==void 0&&N.name)y+=`. Received an instance of ${k.constructor.name}`;else{const C=e(k,{depth:-1});y+=`. Received ${C}`}}else{let C=e(k,{colors:!1});C.length>25&&(C=`${C.slice(0,25)}...`),y+=`. Received type ${typeof k} (${C})`}return y},TypeError),m("ERR_INVALID_ARG_VALUE",(E,x,k="is invalid")=>{let y=e(x);return y.length>128&&(y=y.slice(0,128)+"..."),`The ${E.includes(".")?"property":"argument"} '${E}' ${k}. Received ${y}`},TypeError),m("ERR_INVALID_RETURN_VALUE",(E,x,k)=>{var y;const h=k!=null&&(y=k.constructor)!==null&&y!==void 0&&y.name?`instance of ${k.constructor.name}`:`type ${typeof k}`;return`Expected ${E} to be returned from the "${x}" function but got ${h}.`},TypeError),m("ERR_MISSING_ARGS",(...E)=>{l(E.length>0,"At least one arg needs to be specified");let x;const k=E.length;switch(E=(Array.isArray(E)?E:[E]).map(y=>`"${y}"`).join(" or "),k){case 1:x+=`The ${E[0]} argument`;break;case 2:x+=`The ${E[0]} and ${E[1]} arguments`;break;default:{const y=E.pop();x+=`The ${E.join(", ")}, and ${y} arguments`}break}return`${x} must be specified`},TypeError),m("ERR_OUT_OF_RANGE",(E,x,k)=>{l(x,'Missing "range" argument');let y;if(Number.isInteger(k)&&Math.abs(k)>2**32)y=d(String(k));else if(typeof k=="bigint"){y=String(k);const h=BigInt(2)**BigInt(32);(k>h||k<-h)&&(y=d(y)),y+="n"}else y=e(k);return`The value of "${E}" is out of range. It must be ${x}. Received ${y}`},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),ha={AbortError:_,aggregateTwoErrors:g(v),hideStackFrames:g,codes:c},ha}var Kn={exports:{}},Ud;function Cs(){if(Ud)return Kn.exports;Ud=1;const{AbortController:i,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Kn.exports=i,Kn.exports.AbortSignal=e,Kn.exports.default=i,Kn.exports}var ro={exports:{}},Vd;function Bo(){if(Vd)return ro.exports;Vd=1;var i=typeof Reflect=="object"?Reflect:null,e=i&&typeof i.apply=="function"?i.apply:function(p,T,N){return Function.prototype.apply.call(p,T,N)},t;i&&typeof i.ownKeys=="function"?t=i.ownKeys:Object.getOwnPropertySymbols?t=function(p){return Object.getOwnPropertyNames(p).concat(Object.getOwnPropertySymbols(p))}:t=function(p){return Object.getOwnPropertyNames(p)};function r(h){console&&console.warn&&console.warn(h)}var n=Number.isNaN||function(p){return p!==p};function s(){s.init.call(this)}ro.exports=s,ro.exports.once=x,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(h){if(typeof h!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof h)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(h){if(typeof h!="number"||h<0||n(h))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+h+".");o=h}}),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(p){if(typeof p!="number"||p<0||n(p))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+p+".");return this._maxListeners=p,this};function c(h){return h._maxListeners===void 0?s.defaultMaxListeners:h._maxListeners}s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(p){for(var T=[],N=1;N<arguments.length;N++)T.push(arguments[N]);var C=p==="error",F=this._events;if(F!==void 0)C=C&&F.error===void 0;else if(!C)return!1;if(C){var I;if(T.length>0&&(I=T[0]),I instanceof Error)throw I;var O=new Error("Unhandled error."+(I?" ("+I.message+")":""));throw O.context=I,O}var U=F[p];if(U===void 0)return!1;if(typeof U=="function")e(U,this,T);else for(var R=U.length,D=v(U,R),N=0;N<R;++N)e(D[N],this,T);return!0};function l(h,p,T,N){var C,F,I;if(a(T),F=h._events,F===void 0?(F=h._events=Object.create(null),h._eventsCount=0):(F.newListener!==void 0&&(h.emit("newListener",p,T.listener?T.listener:T),F=h._events),I=F[p]),I===void 0)I=F[p]=T,++h._eventsCount;else if(typeof I=="function"?I=F[p]=N?[T,I]:[I,T]:N?I.unshift(T):I.push(T),C=c(h),C>0&&I.length>C&&!I.warned){I.warned=!0;var O=new Error("Possible EventEmitter memory leak detected. "+I.length+" "+String(p)+" listeners added. Use emitter.setMaxListeners() to increase limit");O.name="MaxListenersExceededWarning",O.emitter=h,O.type=p,O.count=I.length,r(O)}return h}s.prototype.addListener=function(p,T){return l(this,p,T,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(p,T){return l(this,p,T,!0)};function d(){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 u(h,p,T){var N={fired:!1,wrapFn:void 0,target:h,type:p,listener:T},C=d.bind(N);return C.listener=T,N.wrapFn=C,C}s.prototype.once=function(p,T){return a(T),this.on(p,u(this,p,T)),this},s.prototype.prependOnceListener=function(p,T){return a(T),this.prependListener(p,u(this,p,T)),this},s.prototype.removeListener=function(p,T){var N,C,F,I,O;if(a(T),C=this._events,C===void 0)return this;if(N=C[p],N===void 0)return this;if(N===T||N.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete C[p],C.removeListener&&this.emit("removeListener",p,N.listener||T));else if(typeof N!="function"){for(F=-1,I=N.length-1;I>=0;I--)if(N[I]===T||N[I].listener===T){O=N[I].listener,F=I;break}if(F<0)return this;F===0?N.shift():_(N,F),N.length===1&&(C[p]=N[0]),C.removeListener!==void 0&&this.emit("removeListener",p,O||T)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(p){var T,N,C;if(N=this._events,N===void 0)return this;if(N.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):N[p]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete N[p]),this;if(arguments.length===0){var F=Object.keys(N),I;for(C=0;C<F.length;++C)I=F[C],I!=="removeListener"&&this.removeAllListeners(I);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=N[p],typeof T=="function")this.removeListener(p,T);else if(T!==void 0)for(C=T.length-1;C>=0;C--)this.removeListener(p,T[C]);return this};function m(h,p,T){var N=h._events;if(N===void 0)return[];var C=N[p];return C===void 0?[]:typeof C=="function"?T?[C.listener||C]:[C]:T?E(C):v(C,C.length)}s.prototype.listeners=function(p){return m(this,p,!0)},s.prototype.rawListeners=function(p){return m(this,p,!1)},s.listenerCount=function(h,p){return typeof h.listenerCount=="function"?h.listenerCount(p):g.call(h,p)},s.prototype.listenerCount=g;function g(h){var p=this._events;if(p!==void 0){var T=p[h];if(typeof T=="function")return 1;if(T!==void 0)return T.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function v(h,p){for(var T=new Array(p),N=0;N<p;++N)T[N]=h[N];return T}function _(h,p){for(;p+1<h.length;p++)h[p]=h[p+1];h.pop()}function E(h){for(var p=new Array(h.length),T=0;T<p.length;++T)p[T]=h[T].listener||h[T];return p}function x(h,p){return new Promise(function(T,N){function C(I){h.removeListener(p,F),N(I)}function F(){typeof h.removeListener=="function"&&h.removeListener("error",C),T([].slice.call(arguments))}y(h,p,F,{once:!0}),p!=="error"&&k(h,C,{once:!0})})}function k(h,p,T){typeof h.on=="function"&&y(h,"error",p,T)}function y(h,p,T,N){if(typeof h.on=="function")N.once?h.once(p,T):h.on(p,T);else if(typeof h.addEventListener=="function")h.addEventListener(p,function C(F){N.once&&h.removeEventListener(p,C),T(F)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof h)}return ro.exports}var zd;function ti(){return zd||(zd=1,function(i){const e=sr(),{format:t,inspect:r}=Wf(),{codes:{ERR_INVALID_ARG_TYPE:n}}=Jt(),{kResistStopPropagation:s,AggregateError:o,SymbolDispose:a}=ut(),c=globalThis.AbortSignal||Cs().AbortSignal,l=globalThis.AbortController||Cs().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,u=globalThis.Blob||e.Blob,m=typeof u<"u"?function(E){return E instanceof u}:function(E){return!1},g=(_,E)=>{if(_!==void 0&&(_===null||typeof _!="object"||!("aborted"in _)))throw new n(E,"AbortSignal",_)},v=(_,E)=>{if(typeof _!="function")throw new n(E,"Function",_)};i.exports={AggregateError:o,kEmptyObject:Object.freeze({}),once(_){let E=!1;return function(...x){E||(E=!0,_.apply(this,x))}},createDeferredPromise:function(){let _,E;return{promise:new Promise((k,y)=>{_=k,E=y}),resolve:_,reject:E}},promisify(_){return new Promise((E,x)=>{_((k,...y)=>k?x(k):E(...y))})},debuglog(){return function(){}},format:t,inspect:r,types:{isAsyncFunction(_){return _ instanceof d},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:m,deprecate(_,E){return _},addAbortListener:Bo().addAbortListener||function(E,x){if(E===void 0)throw new n("signal","AbortSignal",E);g(E,"signal"),v(x,"listener");let k;return E.aborted?queueMicrotask(()=>x()):(E.addEventListener("abort",x,{__proto__:null,once:!0,[s]:!0}),k=()=>{E.removeEventListener("abort",x)}),{__proto__:null,[a](){var y;(y=k)===null||y===void 0||y()}}},AbortSignalAny:c.any||function(E){if(E.length===1)return E[0];const x=new l,k=()=>x.abort();return E.forEach(y=>{g(y,"signals"),y.addEventListener("abort",k,{once:!0})}),x.signal.addEventListener("abort",()=>{E.forEach(y=>y.removeEventListener("abort",k))},{once:!0}),x.signal}},i.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(da)),da.exports}var no={},fa,Hd;function Bs(){if(Hd)return fa;Hd=1;const{ArrayIsArray:i,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:r,NumberIsInteger:n,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:o,NumberMIN_SAFE_INTEGER:a,NumberParseInt:c,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:d,String:u,StringPrototypeToUpperCase:m,StringPrototypeTrim:g}=ut(),{hideStackFrames:v,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:E,ERR_INVALID_ARG_VALUE:x,ERR_OUT_OF_RANGE:k,ERR_UNKNOWN_SIGNAL:y}}=Jt(),{normalizeEncoding:h}=ti(),{isAsyncFunction:p,isArrayBufferView:T}=ti().types,N={};function C(ie){return ie===(ie|0)}function F(ie){return ie===ie>>>0}const I=/^[0-7]+$/,O="must be a 32-bit unsigned integer or an octal string";function U(ie,me,Ee){if(typeof ie>"u"&&(ie=Ee),typeof ie=="string"){if(d(I,ie)===null)throw new x(me,ie,O);ie=c(ie,8)}return J(ie,me),ie}const R=v((ie,me,Ee=a,fe=o)=>{if(typeof ie!="number")throw new E(me,"number",ie);if(!n(ie))throw new k(me,"an integer",ie);if(ie<Ee||ie>fe)throw new k(me,`>= ${Ee} && <= ${fe}`,ie)}),D=v((ie,me,Ee=-2147483648,fe=2147483647)=>{if(typeof ie!="number")throw new E(me,"number",ie);if(!n(ie))throw new k(me,"an integer",ie);if(ie<Ee||ie>fe)throw new k(me,`>= ${Ee} && <= ${fe}`,ie)}),J=v((ie,me,Ee=!1)=>{if(typeof ie!="number")throw new E(me,"number",ie);if(!n(ie))throw new k(me,"an integer",ie);const fe=Ee?1:0,He=4294967295;if(ie<fe||ie>He)throw new k(me,`>= ${fe} && <= ${He}`,ie)});function $(ie,me){if(typeof ie!="string")throw new E(me,"string",ie)}function Z(ie,me,Ee=void 0,fe){if(typeof ie!="number")throw new E(me,"number",ie);if(Ee!=null&&ie<Ee||fe!=null&&ie>fe||(Ee!=null||fe!=null)&&s(ie))throw new k(me,`${Ee!=null?`>= ${Ee}`:""}${Ee!=null&&fe!=null?" && ":""}${fe!=null?`<= ${fe}`:""}`,ie)}const B=v((ie,me,Ee)=>{if(!e(Ee,ie)){const He="must be one of: "+t(r(Ee,kt=>typeof kt=="string"?`'${kt}'`:u(kt)),", ");throw new x(me,ie,He)}});function re(ie,me){if(typeof ie!="boolean")throw new E(me,"boolean",ie)}function S(ie,me,Ee){return ie==null||!l(ie,me)?Ee:ie[me]}const H=v((ie,me,Ee=null)=>{const fe=S(Ee,"allowArray",!1),He=S(Ee,"allowFunction",!1);if(!S(Ee,"nullable",!1)&&ie===null||!fe&&i(ie)||typeof ie!="object"&&(!He||typeof ie!="function"))throw new E(me,"Object",ie)}),ee=v((ie,me)=>{if(ie!=null&&typeof ie!="object"&&typeof ie!="function")throw new E(me,"a dictionary",ie)}),Q=v((ie,me,Ee=0)=>{if(!i(ie))throw new E(me,"Array",ie);if(ie.length<Ee){const fe=`must be longer than ${Ee}`;throw new x(me,ie,fe)}});function he(ie,me){Q(ie,me);for(let Ee=0;Ee<ie.length;Ee++)$(ie[Ee],`${me}[${Ee}]`)}function W(ie,me){Q(ie,me);for(let Ee=0;Ee<ie.length;Ee++)re(ie[Ee],`${me}[${Ee}]`)}function G(ie,me){Q(ie,me);for(let Ee=0;Ee<ie.length;Ee++){const fe=ie[Ee],He=`${me}[${Ee}]`;if(fe==null)throw new E(He,"AbortSignal",fe);ye(fe,He)}}function X(ie,me="signal"){if($(ie,me),N[ie]===void 0)throw N[m(ie)]!==void 0?new y(ie+" (signals must use all capital letters)"):new y(ie)}const z=v((ie,me="buffer")=>{if(!T(ie))throw new E(me,["Buffer","TypedArray","DataView"],ie)});function ne(ie,me){const Ee=h(me),fe=ie.length;if(Ee==="hex"&&fe%2!==0)throw new x("encoding",me,`is invalid for data of length ${fe}`)}function se(ie,me="Port",Ee=!0){if(typeof ie!="number"&&typeof ie!="string"||typeof ie=="string"&&g(ie).length===0||+ie!==+ie>>>0||ie>65535||ie===0&&!Ee)throw new _(me,ie,Ee);return ie|0}const ye=v((ie,me)=>{if(ie!==void 0&&(ie===null||typeof ie!="object"||!("aborted"in ie)))throw new E(me,"AbortSignal",ie)}),_e=v((ie,me)=>{if(typeof ie!="function")throw new E(me,"Function",ie)}),M=v((ie,me)=>{if(typeof ie!="function"||p(ie))throw new E(me,"Function",ie)}),K=v((ie,me)=>{if(ie!==void 0)throw new E(me,"undefined",ie)});function ce(ie,me,Ee){if(!e(Ee,ie))throw new E(me,`('${t(Ee,"|")}')`,ie)}const be=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ve(ie,me){if(typeof ie>"u"||!d(be,ie))throw new x(me,ie,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function xe(ie){if(typeof ie=="string")return ve(ie,"hints"),ie;if(i(ie)){const me=ie.length;let Ee="";if(me===0)return Ee;for(let fe=0;fe<me;fe++){const He=ie[fe];ve(He,"hints"),Ee+=He,fe!==me-1&&(Ee+=", ")}return Ee}throw new x("hints",ie,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return fa={isInt32:C,isUint32:F,parseFileMode:U,validateArray:Q,validateStringArray:he,validateBooleanArray:W,validateAbortSignalArray:G,validateBoolean:re,validateBuffer:z,validateDictionary:ee,validateEncoding:ne,validateFunction:_e,validateInt32:D,validateInteger:R,validateNumber:Z,validateObject:H,validateOneOf:B,validatePlainFunction:M,validatePort:se,validateSignalName:X,validateString:$,validateUint32:J,validateUndefined:K,validateUnion:ce,validateAbortSignal:ye,validateLinkHeaderValue:xe},fa}var so={exports:{}},pa={exports:{}},Wd;function Zr(){if(Wd)return pa.exports;Wd=1;var i=pa.exports={},e,t;function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?t=clearTimeout:t=n}catch{t=n}})();function s(_){if(e===setTimeout)return setTimeout(_,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(_,0);try{return e(_,0)}catch{try{return e.call(null,_,0)}catch{return e.call(this,_,0)}}}function o(_){if(t===clearTimeout)return clearTimeout(_);if((t===n||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(_);try{return t(_)}catch{try{return t.call(null,_)}catch{return t.call(this,_)}}}var a=[],c=!1,l,d=-1;function u(){!c||!l||(c=!1,l.length?a=l.concat(a):d=-1,a.length&&m())}function m(){if(!c){var _=s(u);c=!0;for(var E=a.length;E;){for(l=a,a=[];++d<E;)l&&l[d].run();d=-1,E=a.length}l=null,c=!1,o(_)}}i.nextTick=function(_){var E=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)E[x-1]=arguments[x];a.push(new g(_,E)),a.length===1&&!c&&s(m)};function g(_,E){this.fun=_,this.array=E}g.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={};function v(){}return i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(_){return[]},i.binding=function(_){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(_){throw new Error("process.chdir is not supported")},i.umask=function(){return 0},pa.exports}var ma,Gd;function or(){if(Gd)return ma;Gd=1;const{SymbolAsyncIterator:i,SymbolIterator:e,SymbolFor:t}=ut(),r=t("nodejs.stream.destroyed"),n=t("nodejs.stream.errored"),s=t("nodejs.stream.readable"),o=t("nodejs.stream.writable"),a=t("nodejs.stream.disturbed"),c=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function d(S,H=!1){var ee;return!!(S&&typeof S.pipe=="function"&&typeof S.on=="function"&&(!H||typeof S.pause=="function"&&typeof S.resume=="function")&&(!S._writableState||((ee=S._readableState)===null||ee===void 0?void 0:ee.readable)!==!1)&&(!S._writableState||S._readableState))}function u(S){var H;return!!(S&&typeof S.write=="function"&&typeof S.on=="function"&&(!S._readableState||((H=S._writableState)===null||H===void 0?void 0:H.writable)!==!1))}function m(S){return!!(S&&typeof S.pipe=="function"&&S._readableState&&typeof S.on=="function"&&typeof S.write=="function")}function g(S){return S&&(S._readableState||S._writableState||typeof S.write=="function"&&typeof S.on=="function"||typeof S.pipe=="function"&&typeof S.on=="function")}function v(S){return!!(S&&!g(S)&&typeof S.pipeThrough=="function"&&typeof S.getReader=="function"&&typeof S.cancel=="function")}function _(S){return!!(S&&!g(S)&&typeof S.getWriter=="function"&&typeof S.abort=="function")}function E(S){return!!(S&&!g(S)&&typeof S.readable=="object"&&typeof S.writable=="object")}function x(S){return v(S)||_(S)||E(S)}function k(S,H){return S==null?!1:H===!0?typeof S[i]=="function":H===!1?typeof S[e]=="function":typeof S[i]=="function"||typeof S[e]=="function"}function y(S){if(!g(S))return null;const H=S._writableState,ee=S._readableState,Q=H||ee;return!!(S.destroyed||S[r]||Q!=null&&Q.destroyed)}function h(S){if(!u(S))return null;if(S.writableEnded===!0)return!0;const H=S._writableState;return H!=null&&H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function p(S,H){if(!u(S))return null;if(S.writableFinished===!0)return!0;const ee=S._writableState;return ee!=null&&ee.errored?!1:typeof ee?.finished!="boolean"?null:!!(ee.finished||H===!1&&ee.ended===!0&&ee.length===0)}function T(S){if(!d(S))return null;if(S.readableEnded===!0)return!0;const H=S._readableState;return!H||H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function N(S,H){if(!d(S))return null;const ee=S._readableState;return ee!=null&&ee.errored?!1:typeof ee?.endEmitted!="boolean"?null:!!(ee.endEmitted||H===!1&&ee.ended===!0&&ee.length===0)}function C(S){return S&&S[s]!=null?S[s]:typeof S?.readable!="boolean"?null:y(S)?!1:d(S)&&S.readable&&!N(S)}function F(S){return S&&S[o]!=null?S[o]:typeof S?.writable!="boolean"?null:y(S)?!1:u(S)&&S.writable&&!h(S)}function I(S,H){return g(S)?y(S)?!0:!(H?.readable!==!1&&C(S)||H?.writable!==!1&&F(S)):null}function O(S){var H,ee;return g(S)?S.writableErrored?S.writableErrored:(H=(ee=S._writableState)===null||ee===void 0?void 0:ee.errored)!==null&&H!==void 0?H:null:null}function U(S){var H,ee;return g(S)?S.readableErrored?S.readableErrored:(H=(ee=S._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&H!==void 0?H:null:null}function R(S){if(!g(S))return null;if(typeof S.closed=="boolean")return S.closed;const H=S._writableState,ee=S._readableState;return typeof H?.closed=="boolean"||typeof ee?.closed=="boolean"?H?.closed||ee?.closed:typeof S._closed=="boolean"&&D(S)?S._closed:null}function D(S){return typeof S._closed=="boolean"&&typeof S._defaultKeepAlive=="boolean"&&typeof S._removedConnection=="boolean"&&typeof S._removedContLen=="boolean"}function J(S){return typeof S._sent100=="boolean"&&D(S)}function $(S){var H;return typeof S._consuming=="boolean"&&typeof S._dumped=="boolean"&&((H=S.req)===null||H===void 0?void 0:H.upgradeOrConnect)===void 0}function Z(S){if(!g(S))return null;const H=S._writableState,ee=S._readableState,Q=H||ee;return!Q&&J(S)||!!(Q&&Q.autoDestroy&&Q.emitClose&&Q.closed===!1)}function B(S){var H;return!!(S&&((H=S[a])!==null&&H!==void 0?H:S.readableDidRead||S.readableAborted))}function re(S){var H,ee,Q,he,W,G,X,z,ne,se;return!!(S&&((H=(ee=(Q=(he=(W=(G=S[n])!==null&&G!==void 0?G:S.readableErrored)!==null&&W!==void 0?W:S.writableErrored)!==null&&he!==void 0?he:(X=S._readableState)===null||X===void 0?void 0:X.errorEmitted)!==null&&Q!==void 0?Q:(z=S._writableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&ee!==void 0?ee:(ne=S._readableState)===null||ne===void 0?void 0:ne.errored)!==null&&H!==void 0?H:!((se=S._writableState)===null||se===void 0)&&se.errored))}return ma={isDestroyed:y,kIsDestroyed:r,isDisturbed:B,kIsDisturbed:a,isErrored:re,kIsErrored:n,isReadable:C,kIsReadable:s,kIsClosedPromise:c,kControllerErrorFunction:l,kIsWritable:o,isClosed:R,isDuplexNodeStream:m,isFinished:I,isIterable:k,isReadableNodeStream:d,isReadableStream:v,isReadableEnded:T,isReadableFinished:N,isReadableErrored:U,isNodeStream:g,isWebStream:x,isWritable:F,isWritableNodeStream:u,isWritableStream:_,isWritableEnded:h,isWritableFinished:p,isWritableErrored:O,isServerRequest:$,isServerResponse:J,willEmitClose:Z,isTransformStream:E},ma}var Kd;function Sr(){if(Kd)return so.exports;Kd=1;const i=Zr(),{AbortError:e,codes:t}=Jt(),{ERR_INVALID_ARG_TYPE:r,ERR_STREAM_PREMATURE_CLOSE:n}=t,{kEmptyObject:s,once:o}=ti(),{validateAbortSignal:a,validateFunction:c,validateObject:l,validateBoolean:d}=Bs(),{Promise:u,PromisePrototypeThen:m,SymbolDispose:g}=ut(),{isClosed:v,isReadable:_,isReadableNodeStream:E,isReadableStream:x,isReadableFinished:k,isReadableErrored:y,isWritable:h,isWritableNodeStream:p,isWritableStream:T,isWritableFinished:N,isWritableErrored:C,isNodeStream:F,willEmitClose:I,kIsClosedPromise:O}=or();let U;function R(B){return B.setHeader&&typeof B.abort=="function"}const D=()=>{};function J(B,re,S){var H,ee;if(arguments.length===2?(S=re,re=s):re==null?re=s:l(re,"options"),c(S,"callback"),a(re.signal,"options.signal"),S=o(S),x(B)||T(B))return $(B,re,S);if(!F(B))throw new r("stream",["ReadableStream","WritableStream","Stream"],B);const Q=(H=re.readable)!==null&&H!==void 0?H:E(B),he=(ee=re.writable)!==null&&ee!==void 0?ee:p(B),W=B._writableState,G=B._readableState,X=()=>{B.writable||se()};let z=I(B)&&E(B)===Q&&p(B)===he,ne=N(B,!1);const se=()=>{ne=!0,B.destroyed&&(z=!1),!(z&&(!B.readable||Q))&&(!Q||ye)&&S.call(B)};let ye=k(B,!1);const _e=()=>{ye=!0,B.destroyed&&(z=!1),!(z&&(!B.writable||he))&&(!he||ne)&&S.call(B)},M=ie=>{S.call(B,ie)};let K=v(B);const ce=()=>{K=!0;const ie=C(B)||y(B);if(ie&&typeof ie!="boolean")return S.call(B,ie);if(Q&&!ye&&E(B,!0)&&!k(B,!1))return S.call(B,new n);if(he&&!ne&&!N(B,!1))return S.call(B,new n);S.call(B)},be=()=>{K=!0;const ie=C(B)||y(B);if(ie&&typeof ie!="boolean")return S.call(B,ie);S.call(B)},ve=()=>{B.req.on("finish",se)};R(B)?(B.on("complete",se),z||B.on("abort",ce),B.req?ve():B.on("request",ve)):he&&!W&&(B.on("end",X),B.on("close",X)),!z&&typeof B.aborted=="boolean"&&B.on("aborted",ce),B.on("end",_e),B.on("finish",se),re.error!==!1&&B.on("error",M),B.on("close",ce),K?i.nextTick(ce):W!=null&&W.errorEmitted||G!=null&&G.errorEmitted?z||i.nextTick(be):(!Q&&(!z||_(B))&&(ne||h(B)===!1)||!he&&(!z||h(B))&&(ye||_(B)===!1)||G&&B.req&&B.aborted)&&i.nextTick(be);const xe=()=>{S=D,B.removeListener("aborted",ce),B.removeListener("complete",se),B.removeListener("abort",ce),B.removeListener("request",ve),B.req&&B.req.removeListener("finish",se),B.removeListener("end",X),B.removeListener("close",X),B.removeListener("finish",se),B.removeListener("end",_e),B.removeListener("error",M),B.removeListener("close",ce)};if(re.signal&&!K){const ie=()=>{const me=S;xe(),me.call(B,new e(void 0,{cause:re.signal.reason}))};if(re.signal.aborted)i.nextTick(ie);else{U=U||ti().addAbortListener;const me=U(re.signal,ie),Ee=S;S=o((...fe)=>{me[g](),Ee.apply(B,fe)})}}return xe}function $(B,re,S){let H=!1,ee=D;if(re.signal)if(ee=()=>{H=!0,S.call(B,new e(void 0,{cause:re.signal.reason}))},re.signal.aborted)i.nextTick(ee);else{U=U||ti().addAbortListener;const he=U(re.signal,ee),W=S;S=o((...G)=>{he[g](),W.apply(B,G)})}const Q=(...he)=>{H||i.nextTick(()=>S.apply(B,he))};return m(B[O].promise,Q,Q),D}function Z(B,re){var S;let H=!1;return re===null&&(re=s),(S=re)!==null&&S!==void 0&&S.cleanup&&(d(re.cleanup,"cleanup"),H=re.cleanup),new u((ee,Q)=>{const he=J(B,re,W=>{H&&he(),W?Q(W):ee()})})}return so.exports=J,so.exports.finished=Z,so.exports}var ga,Xd;function Nn(){if(Xd)return ga;Xd=1;const i=Zr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:r}=Jt(),{Symbol:n}=ut(),{kIsDestroyed:s,isDestroyed:o,isFinished:a,isServerRequest:c}=or(),l=n("kDestroy"),d=n("kConstruct");function u(I,O,U){I&&(I.stack,O&&!O.errored&&(O.errored=I),U&&!U.errored&&(U.errored=I))}function m(I,O){const U=this._readableState,R=this._writableState,D=R||U;return R!=null&&R.destroyed||U!=null&&U.destroyed?(typeof O=="function"&&O(),this):(u(I,R,U),R&&(R.destroyed=!0),U&&(U.destroyed=!0),D.constructed?g(this,I,O):this.once(l,function(J){g(this,e(J,I),O)}),this)}function g(I,O,U){let R=!1;function D(J){if(R)return;R=!0;const $=I._readableState,Z=I._writableState;u(J,Z,$),Z&&(Z.closed=!0),$&&($.closed=!0),typeof U=="function"&&U(J),J?i.nextTick(v,I,J):i.nextTick(_,I)}try{I._destroy(O||null,D)}catch(J){D(J)}}function v(I,O){E(I,O),_(I)}function _(I){const O=I._readableState,U=I._writableState;U&&(U.closeEmitted=!0),O&&(O.closeEmitted=!0),(U!=null&&U.emitClose||O!=null&&O.emitClose)&&I.emit("close")}function E(I,O){const U=I._readableState,R=I._writableState;R!=null&&R.errorEmitted||U!=null&&U.errorEmitted||(R&&(R.errorEmitted=!0),U&&(U.errorEmitted=!0),I.emit("error",O))}function x(){const I=this._readableState,O=this._writableState;I&&(I.constructed=!0,I.closed=!1,I.closeEmitted=!1,I.destroyed=!1,I.errored=null,I.errorEmitted=!1,I.reading=!1,I.ended=I.readable===!1,I.endEmitted=I.readable===!1),O&&(O.constructed=!0,O.destroyed=!1,O.closed=!1,O.closeEmitted=!1,O.errored=null,O.errorEmitted=!1,O.finalCalled=!1,O.prefinished=!1,O.ended=O.writable===!1,O.ending=O.writable===!1,O.finished=O.writable===!1)}function k(I,O,U){const R=I._readableState,D=I._writableState;if(D!=null&&D.destroyed||R!=null&&R.destroyed)return this;R!=null&&R.autoDestroy||D!=null&&D.autoDestroy?I.destroy(O):O&&(O.stack,D&&!D.errored&&(D.errored=O),R&&!R.errored&&(R.errored=O),U?i.nextTick(E,I,O):E(I,O))}function y(I,O){if(typeof I._construct!="function")return;const U=I._readableState,R=I._writableState;U&&(U.constructed=!1),R&&(R.constructed=!1),I.once(d,O),!(I.listenerCount(d)>1)&&i.nextTick(h,I)}function h(I){let O=!1;function U(R){if(O){k(I,R??new t);return}O=!0;const D=I._readableState,J=I._writableState,$=J||D;D&&(D.constructed=!0),J&&(J.constructed=!0),$.destroyed?I.emit(l,R):R?k(I,R,!0):i.nextTick(p,I)}try{I._construct(R=>{i.nextTick(U,R)})}catch(R){i.nextTick(U,R)}}function p(I){I.emit(d)}function T(I){return I?.setHeader&&typeof I.abort=="function"}function N(I){I.emit("close")}function C(I,O){I.emit("error",O),i.nextTick(N,I)}function F(I,O){!I||o(I)||(!O&&!a(I)&&(O=new r),c(I)?(I.socket=null,I.destroy(O)):T(I)?I.abort():T(I.req)?I.req.abort():typeof I.destroy=="function"?I.destroy(O):typeof I.close=="function"?I.close():O?i.nextTick(C,I,O):i.nextTick(N,I),I.destroyed||(I[s]=!0))}return ga={construct:y,destroyer:F,destroy:m,undestroy:x,errorOrDestroy:k},ga}var ba,Qd;function Lc(){if(Qd)return ba;Qd=1;const{ArrayIsArray:i,ObjectSetPrototypeOf:e}=ut(),{EventEmitter:t}=Bo();function r(s){t.call(this,s)}e(r.prototype,t.prototype),e(r,t),r.prototype.pipe=function(s,o){const a=this;function c(_){s.writable&&s.write(_)===!1&&a.pause&&a.pause()}a.on("data",c);function l(){a.readable&&a.resume&&a.resume()}s.on("drain",l),!s._isStdio&&(!o||o.end!==!1)&&(a.on("end",u),a.on("close",m));let d=!1;function u(){d||(d=!0,s.end())}function m(){d||(d=!0,typeof s.destroy=="function"&&s.destroy())}function g(_){v(),t.listenerCount(this,"error")===0&&this.emit("error",_)}n(a,"error",g),n(s,"error",g);function v(){a.removeListener("data",c),s.removeListener("drain",l),a.removeListener("end",u),a.removeListener("close",m),a.removeListener("error",g),s.removeListener("error",g),a.removeListener("end",v),a.removeListener("close",v),s.removeListener("close",v)}return a.on("end",v),a.on("close",v),s.on("close",v),s.emit("pipe",a),s};function n(s,o,a){if(typeof s.prependListener=="function")return s.prependListener(o,a);!s._events||!s._events[o]?s.on(o,a):i(s._events[o])?s._events[o].unshift(a):s._events[o]=[a,s._events[o]]}return ba={Stream:r,prependListener:n},ba}var ya={exports:{}},Jd;function qo(){return Jd||(Jd=1,function(i){const{SymbolDispose:e}=ut(),{AbortError:t,codes:r}=Jt(),{isNodeStream:n,isWebStream:s,kControllerErrorFunction:o}=or(),a=Sr(),{ERR_INVALID_ARG_TYPE:c}=r;let l;const d=(u,m)=>{if(typeof u!="object"||!("aborted"in u))throw new c(m,"AbortSignal",u)};i.exports.addAbortSignal=function(m,g){if(d(m,"signal"),!n(g)&&!s(g))throw new c("stream",["ReadableStream","WritableStream","Stream"],g);return i.exports.addAbortSignalNoValidate(m,g)},i.exports.addAbortSignalNoValidate=function(u,m){if(typeof u!="object"||!("aborted"in u))return m;const g=n(m)?()=>{m.destroy(new t(void 0,{cause:u.reason}))}:()=>{m[o](new t(void 0,{cause:u.reason}))};if(u.aborted)g();else{l=l||ti().addAbortListener;const v=l(u,g);a(m,v[e])}return m}}(ya)),ya.exports}var va,Yd;function Km(){if(Yd)return va;Yd=1;const{StringPrototypeSlice:i,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:r}=ut(),{Buffer:n}=sr(),{inspect:s}=ti();return va=class{constructor(){this.head=null,this.tail=null,this.length=0}push(a){const c={data:a,next:null};this.length>0?this.tail.next=c:this.head=c,this.tail=c,++this.length}unshift(a){const c={data:a,next:this.head};this.length===0&&(this.tail=c),this.head=c,++this.length}shift(){if(this.length===0)return;const a=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,a}clear(){this.head=this.tail=null,this.length=0}join(a){if(this.length===0)return"";let c=this.head,l=""+c.data;for(;(c=c.next)!==null;)l+=a+c.data;return l}concat(a){if(this.length===0)return n.alloc(0);const c=n.allocUnsafe(a>>>0);let l=this.head,d=0;for(;l;)t(c,l.data,d),d+=l.data.length,l=l.next;return c}consume(a,c){const l=this.head.data;if(a<l.length){const d=l.slice(0,a);return this.head.data=l.slice(a),d}return a===l.length?this.shift():c?this._getString(a):this._getBuffer(a)}first(){return this.head.data}*[e](){for(let a=this.head;a;a=a.next)yield a.data}_getString(a){let c="",l=this.head,d=0;do{const u=l.data;if(a>u.length)c+=u,a-=u.length;else{a===u.length?(c+=u,++d,l.next?this.head=l.next:this.head=this.tail=null):(c+=i(u,0,a),this.head=l,l.data=i(u,a));break}++d}while((l=l.next)!==null);return this.length-=d,c}_getBuffer(a){const c=n.allocUnsafe(a),l=a;let d=this.head,u=0;do{const m=d.data;if(a>m.length)t(c,m,l-a),a-=m.length;else{a===m.length?(t(c,m,l-a),++u,d.next?this.head=d.next:this.head=this.tail=null):(t(c,new r(m.buffer,m.byteOffset,a),l-a),this.head=d,d.data=m.slice(a));break}++u}while((d=d.next)!==null);return this.length-=u,c}[Symbol.for("nodejs.util.inspect.custom")](a,c){return s(this,{...c,depth:0,customInspect:!1})}},va}var wa,Zd;function Uo(){if(Zd)return wa;Zd=1;const{MathFloor:i,NumberIsInteger:e}=ut(),{validateInteger:t}=Bs(),{ERR_INVALID_ARG_VALUE:r}=Jt().codes;let n=16*1024,s=16;function o(d,u,m){return d.highWaterMark!=null?d.highWaterMark:u?d[m]:null}function a(d){return d?s:n}function c(d,u){t(u,"value",0),d?s=u:n=u}function l(d,u,m,g){const v=o(u,g,m);if(v!=null){if(!e(v)||v<0){const _=g?`options.${m}`:"options.highWaterMark";throw new r(_,v)}return i(v)}return a(d.objectMode)}return wa={getHighWaterMark:l,getDefaultHighWaterMark:a,setDefaultHighWaterMark:c},wa}var _a={},oo={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var eu;function Xm(){return eu||(eu=1,function(i,e){var t=sr(),r=t.Buffer;function n(o,a){for(var c in o)a[c]=o[c]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?i.exports=t:(n(t,e),e.Buffer=s);function s(o,a,c){return r(o,a,c)}s.prototype=Object.create(r.prototype),n(r,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return r(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var l=r(o);return a!==void 0?typeof c=="string"?l.fill(a,c):l.fill(a):l.fill(0),l},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(o)}}(oo,oo.exports)),oo.exports}var tu;function Qm(){if(tu)return _a;tu=1;var i=Xm().Buffer,e=i.isEncoding||function(x){switch(x=""+x,x&&x.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 t(x){if(!x)return"utf8";for(var k;;)switch(x){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 x;default:if(k)return;x=(""+x).toLowerCase(),k=!0}}function r(x){var k=t(x);if(typeof k!="string"&&(i.isEncoding===e||!e(x)))throw new Error("Unknown encoding: "+x);return k||x}_a.StringDecoder=n;function n(x){this.encoding=r(x);var k;switch(this.encoding){case"utf16le":this.text=u,this.end=m,k=4;break;case"utf8":this.fillLast=c,k=4;break;case"base64":this.text=g,this.end=v,k=3;break;default:this.write=_,this.end=E;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(k)}n.prototype.write=function(x){if(x.length===0)return"";var k,y;if(this.lastNeed){if(k=this.fillLast(x),k===void 0)return"";y=this.lastNeed,this.lastNeed=0}else y=0;return y<x.length?k?k+this.text(x,y):this.text(x,y):k||""},n.prototype.end=d,n.prototype.text=l,n.prototype.fillLast=function(x){if(this.lastNeed<=x.length)return x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,x.length),this.lastNeed-=x.length};function s(x){return x<=127?0:x>>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function o(x,k,y){var h=k.length-1;if(h<y)return 0;var p=s(k[h]);return p>=0?(p>0&&(x.lastNeed=p-1),p):--h<y||p===-2?0:(p=s(k[h]),p>=0?(p>0&&(x.lastNeed=p-2),p):--h<y||p===-2?0:(p=s(k[h]),p>=0?(p>0&&(p===2?p=0:x.lastNeed=p-3),p):0))}function a(x,k,y){if((k[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&k.length>1){if((k[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&k.length>2&&(k[2]&192)!==128)return x.lastNeed=2,"�"}}function c(x){var k=this.lastTotal-this.lastNeed,y=a(this,x);if(y!==void 0)return y;if(this.lastNeed<=x.length)return x.copy(this.lastChar,k,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,k,0,x.length),this.lastNeed-=x.length}function l(x,k){var y=o(this,x,k);if(!this.lastNeed)return x.toString("utf8",k);this.lastTotal=y;var h=x.length-(y-this.lastNeed);return x.copy(this.lastChar,0,h),x.toString("utf8",k,h)}function d(x){var k=x&&x.length?this.write(x):"";return this.lastNeed?k+"�":k}function u(x,k){if((x.length-k)%2===0){var y=x.toString("utf16le",k);if(y){var h=y.charCodeAt(y.length-1);if(h>=55296&&h<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],y.slice(0,-1)}return y}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",k,x.length-1)}function m(x){var k=x&&x.length?this.write(x):"";if(this.lastNeed){var y=this.lastTotal-this.lastNeed;return k+this.lastChar.toString("utf16le",0,y)}return k}function g(x,k){var y=(x.length-k)%3;return y===0?x.toString("base64",k):(this.lastNeed=3-y,this.lastTotal=3,y===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",k,x.length-y))}function v(x){var k=x&&x.length?this.write(x):"";return this.lastNeed?k+this.lastChar.toString("base64",0,3-this.lastNeed):k}function _(x){return x.toString(this.encoding)}function E(x){return x&&x.length?this.write(x):""}return _a}var xa,iu;function Gf(){if(iu)return xa;iu=1;const i=Zr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:r}=ut(),{Buffer:n}=sr(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:o}=Jt().codes;function a(c,l,d){let u;if(typeof l=="string"||l instanceof n)return new c({objectMode:!0,...d,read(){this.push(l),this.push(null)}});let m;if(l&&l[t])m=!0,u=l[t]();else if(l&&l[r])m=!1,u=l[r]();else throw new s("iterable",["Iterable"],l);const g=new c({objectMode:!0,highWaterMark:1,...d});let v=!1;g._read=function(){v||(v=!0,E())},g._destroy=function(x,k){e(_(x),()=>i.nextTick(k,x),y=>i.nextTick(k,y||x))};async function _(x){const k=x!=null,y=typeof u.throw=="function";if(k&&y){const{value:h,done:p}=await u.throw(x);if(await h,p)return}if(typeof u.return=="function"){const{value:h}=await u.return();await h}}async function E(){for(;;){try{const{value:x,done:k}=m?await u.next():u.next();if(k)g.push(null);else{const y=x&&typeof x.then=="function"?await x:x;if(y===null)throw v=!1,new o;if(g.push(y))continue;v=!1}}catch(x){g.destroy(x)}break}}return g}return xa=a,xa}var Ea,ru;function Vo(){if(ru)return Ea;ru=1;const i=Zr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:r,NumberParseInt:n,ObjectDefineProperties:s,ObjectKeys:o,ObjectSetPrototypeOf:a,Promise:c,SafeSet:l,SymbolAsyncDispose:d,SymbolAsyncIterator:u,Symbol:m}=ut();Ea=fe,fe.ReadableState=Ee;const{EventEmitter:g}=Bo(),{Stream:v,prependListener:_}=Lc(),{Buffer:E}=sr(),{addAbortSignal:x}=qo(),k=Sr();let y=ti().debuglog("stream",P=>{y=P});const h=Km(),p=Nn(),{getHighWaterMark:T,getDefaultHighWaterMark:N}=Uo(),{aggregateTwoErrors:C,codes:{ERR_INVALID_ARG_TYPE:F,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_OUT_OF_RANGE:O,ERR_STREAM_PUSH_AFTER_EOF:U,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:R},AbortError:D}=Jt(),{validateObject:J}=Bs(),$=m("kPaused"),{StringDecoder:Z}=Qm(),B=Gf();a(fe.prototype,v.prototype),a(fe,v);const re=()=>{},{errorOrDestroy:S}=p,H=1,ee=2,Q=4,he=8,W=16,G=32,X=64,z=128,ne=256,se=512,ye=1024,_e=2048,M=4096,K=8192,ce=16384,be=32768,ve=65536,xe=1<<17,ie=1<<18;function me(P){return{enumerable:!1,get(){return(this.state&P)!==0},set(V){V?this.state|=P:this.state&=~P}}}s(Ee.prototype,{objectMode:me(H),ended:me(ee),endEmitted:me(Q),reading:me(he),constructed:me(W),sync:me(G),needReadable:me(X),emittedReadable:me(z),readableListening:me(ne),resumeScheduled:me(se),errorEmitted:me(ye),emitClose:me(_e),autoDestroy:me(M),destroyed:me(K),closed:me(ce),closeEmitted:me(be),multiAwaitDrain:me(ve),readingMore:me(xe),dataEmitted:me(ie)});function Ee(P,V,Se){typeof Se!="boolean"&&(Se=V instanceof Zi()),this.state=_e|M|W|G,P&&P.objectMode&&(this.state|=H),Se&&P&&P.readableObjectMode&&(this.state|=H),this.highWaterMark=P?T(this,P,"readableHighWaterMark",Se):N(!1),this.buffer=new h,this.length=0,this.pipes=[],this.flowing=null,this[$]=null,P&&P.emitClose===!1&&(this.state&=~_e),P&&P.autoDestroy===!1&&(this.state&=~M),this.errored=null,this.defaultEncoding=P&&P.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,P&&P.encoding&&(this.decoder=new Z(P.encoding),this.encoding=P.encoding)}function fe(P){if(!(this instanceof fe))return new fe(P);const V=this instanceof Zi();this._readableState=new Ee(P,this,V),P&&(typeof P.read=="function"&&(this._read=P.read),typeof P.destroy=="function"&&(this._destroy=P.destroy),typeof P.construct=="function"&&(this._construct=P.construct),P.signal&&!V&&x(P.signal,this)),v.call(this,P),p.construct(this,()=>{this._readableState.needReadable&&te(this,this._readableState)})}fe.prototype.destroy=p.destroy,fe.prototype._undestroy=p.undestroy,fe.prototype._destroy=function(P,V){V(P)},fe.prototype[g.captureRejectionSymbol]=function(P){this.destroy(P)},fe.prototype[d]=function(){let P;return this.destroyed||(P=this.readableEnded?null:new D,this.destroy(P)),new c((V,Se)=>k(this,ke=>ke&&ke!==P?Se(ke):V(null)))},fe.prototype.push=function(P,V){return He(this,P,V,!1)},fe.prototype.unshift=function(P,V){return He(this,P,V,!0)};function He(P,V,Se,ke){y("readableAddChunk",V);const Ce=P._readableState;let Rt;if((Ce.state&H)===0&&(typeof V=="string"?(Se=Se||Ce.defaultEncoding,Ce.encoding!==Se&&(ke&&Ce.encoding?V=E.from(V,Se).toString(Ce.encoding):(V=E.from(V,Se),Se=""))):V instanceof E?Se="":v._isUint8Array(V)?(V=v._uint8ArrayToBuffer(V),Se=""):V!=null&&(Rt=new F("chunk",["string","Buffer","Uint8Array"],V))),Rt)S(P,Rt);else if(V===null)Ce.state&=~he,f(P,Ce);else if((Ce.state&H)!==0||V&&V.length>0)if(ke)if((Ce.state&Q)!==0)S(P,new R);else{if(Ce.destroyed||Ce.errored)return!1;kt(P,Ce,V,!0)}else if(Ce.ended)S(P,new U);else{if(Ce.destroyed||Ce.errored)return!1;Ce.state&=~he,Ce.decoder&&!Se?(V=Ce.decoder.write(V),Ce.objectMode||V.length!==0?kt(P,Ce,V,!1):te(P,Ce)):kt(P,Ce,V,!1)}else ke||(Ce.state&=~he,te(P,Ce));return!Ce.ended&&(Ce.length<Ce.highWaterMark||Ce.length===0)}function kt(P,V,Se,ke){V.flowing&&V.length===0&&!V.sync&&P.listenerCount("data")>0?((V.state&ve)!==0?V.awaitDrainWriters.clear():V.awaitDrainWriters=null,V.dataEmitted=!0,P.emit("data",Se)):(V.length+=V.objectMode?1:Se.length,ke?V.buffer.unshift(Se):V.buffer.push(Se),(V.state&X)!==0&&b(P)),te(P,V)}fe.prototype.isPaused=function(){const P=this._readableState;return P[$]===!0||P.flowing===!1},fe.prototype.setEncoding=function(P){const V=new Z(P);this._readableState.decoder=V,this._readableState.encoding=this._readableState.decoder.encoding;const Se=this._readableState.buffer;let ke="";for(const Ce of Se)ke+=V.write(Ce);return Se.clear(),ke!==""&&Se.push(ke),this._readableState.length=ke.length,this};const Ve=1073741824;function Nt(P){if(P>Ve)throw new O("size","<= 1GiB",P);return P--,P|=P>>>1,P|=P>>>2,P|=P>>>4,P|=P>>>8,P|=P>>>16,P++,P}function A(P,V){return P<=0||V.length===0&&V.ended?0:(V.state&H)!==0?1:r(P)?V.flowing&&V.length?V.buffer.first().length:V.length:P<=V.length?P:V.ended?V.length:0}fe.prototype.read=function(P){y("read",P),P===void 0?P=NaN:t(P)||(P=n(P,10));const V=this._readableState,Se=P;if(P>V.highWaterMark&&(V.highWaterMark=Nt(P)),P!==0&&(V.state&=~z),P===0&&V.needReadable&&((V.highWaterMark!==0?V.length>=V.highWaterMark:V.length>0)||V.ended))return y("read: emitReadable",V.length,V.ended),V.length===0&&V.ended?mt(this):b(this),null;if(P=A(P,V),P===0&&V.ended)return V.length===0&&mt(this),null;let ke=(V.state&X)!==0;if(y("need readable",ke),(V.length===0||V.length-P<V.highWaterMark)&&(ke=!0,y("length less than watermark",ke)),V.ended||V.reading||V.destroyed||V.errored||!V.constructed)ke=!1,y("reading, ended or constructing",ke);else if(ke){y("do read"),V.state|=he|G,V.length===0&&(V.state|=X);try{this._read(V.highWaterMark)}catch(Rt){S(this,Rt)}V.state&=~G,V.reading||(P=A(Se,V))}let Ce;return P>0?Ce=ft(P,V):Ce=null,Ce===null?(V.needReadable=V.length<=V.highWaterMark,P=0):(V.length-=P,V.multiAwaitDrain?V.awaitDrainWriters.clear():V.awaitDrainWriters=null),V.length===0&&(V.ended||(V.needReadable=!0),Se!==P&&V.ended&&mt(this)),Ce!==null&&!V.errorEmitted&&!V.closeEmitted&&(V.dataEmitted=!0,this.emit("data",Ce)),Ce};function f(P,V){if(y("onEofChunk"),!V.ended){if(V.decoder){const Se=V.decoder.end();Se&&Se.length&&(V.buffer.push(Se),V.length+=V.objectMode?1:Se.length)}V.ended=!0,V.sync?b(P):(V.needReadable=!1,V.emittedReadable=!0,j(P))}}function b(P){const V=P._readableState;y("emitReadable",V.needReadable,V.emittedReadable),V.needReadable=!1,V.emittedReadable||(y("emitReadable",V.flowing),V.emittedReadable=!0,i.nextTick(j,P))}function j(P){const V=P._readableState;y("emitReadable_",V.destroyed,V.length,V.ended),!V.destroyed&&!V.errored&&(V.length||V.ended)&&(P.emit("readable"),V.emittedReadable=!1),V.needReadable=!V.flowing&&!V.ended&&V.length<=V.highWaterMark,Xe(P)}function te(P,V){!V.readingMore&&V.constructed&&(V.readingMore=!0,i.nextTick(ue,P,V))}function ue(P,V){for(;!V.reading&&!V.ended&&(V.length<V.highWaterMark||V.flowing&&V.length===0);){const Se=V.length;if(y("maybeReadMore read 0"),P.read(0),Se===V.length)break}V.readingMore=!1}fe.prototype._read=function(P){throw new I("_read()")},fe.prototype.pipe=function(P,V){const Se=this,ke=this._readableState;ke.pipes.length===1&&(ke.multiAwaitDrain||(ke.multiAwaitDrain=!0,ke.awaitDrainWriters=new l(ke.awaitDrainWriters?[ke.awaitDrainWriters]:[]))),ke.pipes.push(P),y("pipe count=%d opts=%j",ke.pipes.length,V);const Rt=(!V||V.end!==!1)&&P!==i.stdout&&P!==i.stderr?Js:q;ke.endEmitted?i.nextTick(Rt):Se.once("end",Rt),P.on("unpipe",Mt);function Mt(ae,le){y("onunpipe"),ae===Se&&le&&le.hasUnpiped===!1&&(le.hasUnpiped=!0,Ki())}function Js(){y("onend"),P.end()}let Gi,Ys=!1;function Ki(){y("cleanup"),P.removeListener("close",qn),P.removeListener("finish",xt),Gi&&P.removeListener("drain",Gi),P.removeListener("error",rn),P.removeListener("unpipe",Mt),Se.removeListener("end",Js),Se.removeListener("end",q),Se.removeListener("data",tn),Ys=!0,Gi&&ke.awaitDrainWriters&&(!P._writableState||P._writableState.needDrain)&&Gi()}function Bn(){Ys||(ke.pipes.length===1&&ke.pipes[0]===P?(y("false write response, pause",0),ke.awaitDrainWriters=P,ke.multiAwaitDrain=!1):ke.pipes.length>1&&ke.pipes.includes(P)&&(y("false write response, pause",ke.awaitDrainWriters.size),ke.awaitDrainWriters.add(P)),Se.pause()),Gi||(Gi=ge(Se,P),P.on("drain",Gi))}Se.on("data",tn);function tn(ae){y("ondata");const le=P.write(ae);y("dest.write",le),le===!1&&Bn()}function rn(ae){if(y("onerror",ae),q(),P.removeListener("error",rn),P.listenerCount("error")===0){const le=P._writableState||P._readableState;le&&!le.errorEmitted?S(P,ae):P.emit("error",ae)}}_(P,"error",rn);function qn(){P.removeListener("finish",xt),q()}P.once("close",qn);function xt(){y("onfinish"),P.removeListener("close",qn),q()}P.once("finish",xt);function q(){y("unpipe"),Se.unpipe(P)}return P.emit("pipe",Se),P.writableNeedDrain===!0?Bn():ke.flowing||(y("pipe resume"),Se.resume()),P};function ge(P,V){return function(){const ke=P._readableState;ke.awaitDrainWriters===V?(y("pipeOnDrain",1),ke.awaitDrainWriters=null):ke.multiAwaitDrain&&(y("pipeOnDrain",ke.awaitDrainWriters.size),ke.awaitDrainWriters.delete(V)),(!ke.awaitDrainWriters||ke.awaitDrainWriters.size===0)&&P.listenerCount("data")&&P.resume()}}fe.prototype.unpipe=function(P){const V=this._readableState,Se={hasUnpiped:!1};if(V.pipes.length===0)return this;if(!P){const Ce=V.pipes;V.pipes=[],this.pause();for(let Rt=0;Rt<Ce.length;Rt++)Ce[Rt].emit("unpipe",this,{hasUnpiped:!1});return this}const ke=e(V.pipes,P);return ke===-1?this:(V.pipes.splice(ke,1),V.pipes.length===0&&this.pause(),P.emit("unpipe",this,Se),this)},fe.prototype.on=function(P,V){const Se=v.prototype.on.call(this,P,V),ke=this._readableState;return P==="data"?(ke.readableListening=this.listenerCount("readable")>0,ke.flowing!==!1&&this.resume()):P==="readable"&&!ke.endEmitted&&!ke.readableListening&&(ke.readableListening=ke.needReadable=!0,ke.flowing=!1,ke.emittedReadable=!1,y("on readable",ke.length,ke.reading),ke.length?b(this):ke.reading||i.nextTick(nt,this)),Se},fe.prototype.addListener=fe.prototype.on,fe.prototype.removeListener=function(P,V){const Se=v.prototype.removeListener.call(this,P,V);return P==="readable"&&i.nextTick(Pe,this),Se},fe.prototype.off=fe.prototype.removeListener,fe.prototype.removeAllListeners=function(P){const V=v.prototype.removeAllListeners.apply(this,arguments);return(P==="readable"||P===void 0)&&i.nextTick(Pe,this),V};function Pe(P){const V=P._readableState;V.readableListening=P.listenerCount("readable")>0,V.resumeScheduled&&V[$]===!1?V.flowing=!0:P.listenerCount("data")>0?P.resume():V.readableListening||(V.flowing=null)}function nt(P){y("readable nexttick read 0"),P.read(0)}fe.prototype.resume=function(){const P=this._readableState;return P.flowing||(y("resume"),P.flowing=!P.readableListening,Qe(this,P)),P[$]=!1,this};function Qe(P,V){V.resumeScheduled||(V.resumeScheduled=!0,i.nextTick(Ze,P,V))}function Ze(P,V){y("resume",V.reading),V.reading||P.read(0),V.resumeScheduled=!1,P.emit("resume"),Xe(P),V.flowing&&!V.reading&&P.read(0)}fe.prototype.pause=function(){return y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(y("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[$]=!0,this};function Xe(P){const V=P._readableState;for(y("flow",V.flowing);V.flowing&&P.read()!==null;);}fe.prototype.wrap=function(P){let V=!1;P.on("data",ke=>{!this.push(ke)&&P.pause&&(V=!0,P.pause())}),P.on("end",()=>{this.push(null)}),P.on("error",ke=>{S(this,ke)}),P.on("close",()=>{this.destroy()}),P.on("destroy",()=>{this.destroy()}),this._read=()=>{V&&P.resume&&(V=!1,P.resume())};const Se=o(P);for(let ke=1;ke<Se.length;ke++){const Ce=Se[ke];this[Ce]===void 0&&typeof P[Ce]=="function"&&(this[Ce]=P[Ce].bind(P))}return this},fe.prototype[u]=function(){return Ti(this)},fe.prototype.iterator=function(P){return P!==void 0&&J(P,"options"),Ti(this,P)};function Ti(P,V){typeof P.read!="function"&&(P=fe.wrap(P,{objectMode:!0}));const Se=ur(P,V);return Se.stream=P,Se}async function*ur(P,V){let Se=re;function ke(Mt){this===P?(Se(),Se=re):Se=Mt}P.on("readable",ke);let Ce;const Rt=k(P,{writable:!1},Mt=>{Ce=Mt?C(Ce,Mt):null,Se(),Se=re});try{for(;;){const Mt=P.destroyed?null:P.read();if(Mt!==null)yield Mt;else{if(Ce)throw Ce;if(Ce===null)return;await new c(ke)}}}catch(Mt){throw Ce=C(Ce,Mt),Ce}finally{(Ce||V?.destroyOnReturn!==!1)&&(Ce===void 0||P._readableState.autoDestroy)?p.destroyer(P,null):(P.off("readable",ke),Rt())}}s(fe.prototype,{readable:{__proto__:null,get(){const P=this._readableState;return!!P&&P.readable!==!1&&!P.destroyed&&!P.errorEmitted&&!P.endEmitted},set(P){this._readableState&&(this._readableState.readable=!!P)}},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(P){this._readableState&&(this._readableState.flowing=P)}},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(P){this._readableState&&(this._readableState.destroyed=P)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(Ee.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[$]!==!1},set(P){this[$]=!!P}}}),fe._fromList=ft;function ft(P,V){if(V.length===0)return null;let Se;return V.objectMode?Se=V.buffer.shift():!P||P>=V.length?(V.decoder?Se=V.buffer.join(""):V.buffer.length===1?Se=V.buffer.first():Se=V.buffer.concat(V.length),V.buffer.clear()):Se=V.buffer.consume(P,V.decoder),Se}function mt(P){const V=P._readableState;y("endReadable",V.endEmitted),V.endEmitted||(V.ended=!0,i.nextTick(Qs,V,P))}function Qs(P,V){if(y("endReadableNT",P.endEmitted,P.length),!P.errored&&!P.closeEmitted&&!P.endEmitted&&P.length===0){if(P.endEmitted=!0,V.emit("end"),V.writable&&V.allowHalfOpen===!1)i.nextTick(hr,V);else if(P.autoDestroy){const Se=V._writableState;(!Se||Se.autoDestroy&&(Se.finished||Se.writable===!1))&&V.destroy()}}}function hr(P){P.writable&&!P.writableEnded&&!P.destroyed&&P.end()}fe.from=function(P,V){return B(fe,P,V)};let en;function jn(){return en===void 0&&(en={}),en}return fe.fromWeb=function(P,V){return jn().newStreamReadableFromReadableStream(P,V)},fe.toWeb=function(P,V){return jn().newReadableStreamFromStreamReadable(P,V)},fe.wrap=function(P,V){var Se,ke;return new fe({objectMode:(Se=(ke=P.readableObjectMode)!==null&&ke!==void 0?ke:P.objectMode)!==null&&Se!==void 0?Se:!0,...V,destroy(Ce,Rt){p.destroyer(P,Ce),Rt(Ce)}}).wrap(P)},Ea}var Sa,nu;function Oc(){if(nu)return Sa;nu=1;const i=Zr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:n,ObjectDefineProperties:s,ObjectSetPrototypeOf:o,StringPrototypeToLowerCase:a,Symbol:c,SymbolHasInstance:l}=ut();Sa=J,J.WritableState=R;const{EventEmitter:d}=Bo(),u=Lc().Stream,{Buffer:m}=sr(),g=Nn(),{addAbortSignal:v}=qo(),{getHighWaterMark:_,getDefaultHighWaterMark:E}=Uo(),{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_MULTIPLE_CALLBACK:y,ERR_STREAM_CANNOT_PIPE:h,ERR_STREAM_DESTROYED:p,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:N,ERR_STREAM_WRITE_AFTER_END:C,ERR_UNKNOWN_ENCODING:F}=Jt().codes,{errorOrDestroy:I}=g;o(J.prototype,u.prototype),o(J,u);function O(){}const U=c("kOnFinished");function R(M,K,ce){typeof ce!="boolean"&&(ce=K instanceof Zi()),this.objectMode=!!(M&&M.objectMode),ce&&(this.objectMode=this.objectMode||!!(M&&M.writableObjectMode)),this.highWaterMark=M?_(this,M,"writableHighWaterMark",ce):E(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const be=!!(M&&M.decodeStrings===!1);this.decodeStrings=!be,this.defaultEncoding=M&&M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=S.bind(void 0,K),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,D(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!M||M.emitClose!==!1,this.autoDestroy=!M||M.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[U]=[]}function D(M){M.buffered=[],M.bufferedIndex=0,M.allBuffers=!0,M.allNoop=!0}R.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},n(R.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function J(M){const K=this instanceof Zi();if(!K&&!r(J,this))return new J(M);this._writableState=new R(M,this,K),M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final),typeof M.construct=="function"&&(this._construct=M.construct),M.signal&&v(M.signal,this)),u.call(this,M),g.construct(this,()=>{const ce=this._writableState;ce.writing||he(this,ce),z(this,ce)})}n(J,l,{__proto__:null,value:function(M){return r(this,M)?!0:this!==J?!1:M&&M._writableState instanceof R}}),J.prototype.pipe=function(){I(this,new h)};function $(M,K,ce,be){const ve=M._writableState;if(typeof ce=="function")be=ce,ce=ve.defaultEncoding;else{if(!ce)ce=ve.defaultEncoding;else if(ce!=="buffer"&&!m.isEncoding(ce))throw new F(ce);typeof be!="function"&&(be=O)}if(K===null)throw new N;if(!ve.objectMode)if(typeof K=="string")ve.decodeStrings!==!1&&(K=m.from(K,ce),ce="buffer");else if(K instanceof m)ce="buffer";else if(u._isUint8Array(K))K=u._uint8ArrayToBuffer(K),ce="buffer";else throw new x("chunk",["string","Buffer","Uint8Array"],K);let xe;return ve.ending?xe=new C:ve.destroyed&&(xe=new p("write")),xe?(i.nextTick(be,xe),I(M,xe,!0),xe):(ve.pendingcb++,Z(M,ve,K,ce,be))}J.prototype.write=function(M,K,ce){return $(this,M,K,ce)===!0},J.prototype.cork=function(){this._writableState.corked++},J.prototype.uncork=function(){const M=this._writableState;M.corked&&(M.corked--,M.writing||he(this,M))},J.prototype.setDefaultEncoding=function(K){if(typeof K=="string"&&(K=a(K)),!m.isEncoding(K))throw new F(K);return this._writableState.defaultEncoding=K,this};function Z(M,K,ce,be,ve){const xe=K.objectMode?1:ce.length;K.length+=xe;const ie=K.length<K.highWaterMark;return ie||(K.needDrain=!0),K.writing||K.corked||K.errored||!K.constructed?(K.buffered.push({chunk:ce,encoding:be,callback:ve}),K.allBuffers&&be!=="buffer"&&(K.allBuffers=!1),K.allNoop&&ve!==O&&(K.allNoop=!1)):(K.writelen=xe,K.writecb=ve,K.writing=!0,K.sync=!0,M._write(ce,be,K.onwrite),K.sync=!1),ie&&!K.errored&&!K.destroyed}function B(M,K,ce,be,ve,xe,ie){K.writelen=be,K.writecb=ie,K.writing=!0,K.sync=!0,K.destroyed?K.onwrite(new p("write")):ce?M._writev(ve,K.onwrite):M._write(ve,xe,K.onwrite),K.sync=!1}function re(M,K,ce,be){--K.pendingcb,be(ce),Q(K),I(M,ce)}function S(M,K){const ce=M._writableState,be=ce.sync,ve=ce.writecb;if(typeof ve!="function"){I(M,new y);return}ce.writing=!1,ce.writecb=null,ce.length-=ce.writelen,ce.writelen=0,K?(K.stack,ce.errored||(ce.errored=K),M._readableState&&!M._readableState.errored&&(M._readableState.errored=K),be?i.nextTick(re,M,ce,K,ve):re(M,ce,K,ve)):(ce.buffered.length>ce.bufferedIndex&&he(M,ce),be?ce.afterWriteTickInfo!==null&&ce.afterWriteTickInfo.cb===ve?ce.afterWriteTickInfo.count++:(ce.afterWriteTickInfo={count:1,cb:ve,stream:M,state:ce},i.nextTick(H,ce.afterWriteTickInfo)):ee(M,ce,1,ve))}function H({stream:M,state:K,count:ce,cb:be}){return K.afterWriteTickInfo=null,ee(M,K,ce,be)}function ee(M,K,ce,be){for(!K.ending&&!M.destroyed&&K.length===0&&K.needDrain&&(K.needDrain=!1,M.emit("drain"));ce-- >0;)K.pendingcb--,be();K.destroyed&&Q(K),z(M,K)}function Q(M){if(M.writing)return;for(let ve=M.bufferedIndex;ve<M.buffered.length;++ve){var K;const{chunk:xe,callback:ie}=M.buffered[ve],me=M.objectMode?1:xe.length;M.length-=me,ie((K=M.errored)!==null&&K!==void 0?K:new p("write"))}const ce=M[U].splice(0);for(let ve=0;ve<ce.length;ve++){var be;ce[ve]((be=M.errored)!==null&&be!==void 0?be:new p("end"))}D(M)}function he(M,K){if(K.corked||K.bufferProcessing||K.destroyed||!K.constructed)return;const{buffered:ce,bufferedIndex:be,objectMode:ve}=K,xe=ce.length-be;if(!xe)return;let ie=be;if(K.bufferProcessing=!0,xe>1&&M._writev){K.pendingcb-=xe-1;const me=K.allNoop?O:fe=>{for(let He=ie;He<ce.length;++He)ce[He].callback(fe)},Ee=K.allNoop&&ie===0?ce:e(ce,ie);Ee.allBuffers=K.allBuffers,B(M,K,!0,K.length,Ee,"",me),D(K)}else{do{const{chunk:me,encoding:Ee,callback:fe}=ce[ie];ce[ie++]=null;const He=ve?1:me.length;B(M,K,!1,He,me,Ee,fe)}while(ie<ce.length&&!K.writing);ie===ce.length?D(K):ie>256?(ce.splice(0,ie),K.bufferedIndex=0):K.bufferedIndex=ie}K.bufferProcessing=!1}J.prototype._write=function(M,K,ce){if(this._writev)this._writev([{chunk:M,encoding:K}],ce);else throw new k("_write()")},J.prototype._writev=null,J.prototype.end=function(M,K,ce){const be=this._writableState;typeof M=="function"?(ce=M,M=null,K=null):typeof K=="function"&&(ce=K,K=null);let ve;if(M!=null){const xe=$(this,M,K);xe instanceof t&&(ve=xe)}return be.corked&&(be.corked=1,this.uncork()),ve||(!be.errored&&!be.ending?(be.ending=!0,z(this,be,!0),be.ended=!0):be.finished?ve=new T("end"):be.destroyed&&(ve=new p("end"))),typeof ce=="function"&&(ve||be.finished?i.nextTick(ce,ve):be[U].push(ce)),this};function W(M){return M.ending&&!M.destroyed&&M.constructed&&M.length===0&&!M.errored&&M.buffered.length===0&&!M.finished&&!M.writing&&!M.errorEmitted&&!M.closeEmitted}function G(M,K){let ce=!1;function be(ve){if(ce){I(M,ve??y());return}if(ce=!0,K.pendingcb--,ve){const xe=K[U].splice(0);for(let ie=0;ie<xe.length;ie++)xe[ie](ve);I(M,ve,K.sync)}else W(K)&&(K.prefinished=!0,M.emit("prefinish"),K.pendingcb++,i.nextTick(ne,M,K))}K.sync=!0,K.pendingcb++;try{M._final(be)}catch(ve){be(ve)}K.sync=!1}function X(M,K){!K.prefinished&&!K.finalCalled&&(typeof M._final=="function"&&!K.destroyed?(K.finalCalled=!0,G(M,K)):(K.prefinished=!0,M.emit("prefinish")))}function z(M,K,ce){W(K)&&(X(M,K),K.pendingcb===0&&(ce?(K.pendingcb++,i.nextTick((be,ve)=>{W(ve)?ne(be,ve):ve.pendingcb--},M,K)):W(K)&&(K.pendingcb++,ne(M,K))))}function ne(M,K){K.pendingcb--,K.finished=!0;const ce=K[U].splice(0);for(let be=0;be<ce.length;be++)ce[be]();if(M.emit("finish"),K.autoDestroy){const be=M._readableState;(!be||be.autoDestroy&&(be.endEmitted||be.readable===!1))&&M.destroy()}}s(J.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(M){this._writableState&&(this._writableState.destroyed=M)}},writable:{__proto__:null,get(){const M=this._writableState;return!!M&&M.writable!==!1&&!M.destroyed&&!M.errored&&!M.ending&&!M.ended},set(M){this._writableState&&(this._writableState.writable=!!M)}},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(){const M=this._writableState;return M?!M.destroyed&&!M.ending&&M.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)}}});const se=g.destroy;J.prototype.destroy=function(M,K){const ce=this._writableState;return!ce.destroyed&&(ce.bufferedIndex<ce.buffered.length||ce[U].length)&&i.nextTick(Q,ce),se.call(this,M,K),this},J.prototype._undestroy=g.undestroy,J.prototype._destroy=function(M,K){K(M)},J.prototype[d.captureRejectionSymbol]=function(M){this.destroy(M)};let ye;function _e(){return ye===void 0&&(ye={}),ye}return J.fromWeb=function(M,K){return _e().newStreamWritableFromWritableStream(M,K)},J.toWeb=function(M){return _e().newWritableStreamFromStreamWritable(M)},Sa}var ka,su;function Jm(){if(su)return ka;su=1;const i=Zr(),e=sr(),{isReadable:t,isWritable:r,isIterable:n,isNodeStream:s,isReadableNodeStream:o,isWritableNodeStream:a,isDuplexNodeStream:c,isReadableStream:l,isWritableStream:d}=or(),u=Sr(),{AbortError:m,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:v}}=Jt(),{destroyer:_}=Nn(),E=Zi(),x=Vo(),k=Oc(),{createDeferredPromise:y}=ti(),h=Gf(),p=globalThis.Blob||e.Blob,T=typeof p<"u"?function(R){return R instanceof p}:function(R){return!1},N=globalThis.AbortController||Cs().AbortController,{FunctionPrototypeCall:C}=ut();class F extends E{constructor(R){super(R),R?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),R?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}ka=function U(R,D){if(c(R))return R;if(o(R))return O({readable:R});if(a(R))return O({writable:R});if(s(R))return O({writable:!1,readable:!1});if(l(R))return O({readable:x.fromWeb(R)});if(d(R))return O({writable:k.fromWeb(R)});if(typeof R=="function"){const{value:$,write:Z,final:B,destroy:re}=I(R);if(n($))return h(F,$,{objectMode:!0,write:Z,final:B,destroy:re});const S=$?.then;if(typeof S=="function"){let H;const ee=C(S,$,Q=>{if(Q!=null)throw new v("nully","body",Q)},Q=>{_(H,Q)});return H=new F({objectMode:!0,readable:!1,write:Z,final(Q){B(async()=>{try{await ee,i.nextTick(Q,null)}catch(he){i.nextTick(Q,he)}})},destroy:re})}throw new v("Iterable, AsyncIterable or AsyncFunction",D,$)}if(T(R))return U(R.arrayBuffer());if(n(R))return h(F,R,{objectMode:!0,writable:!1});if(l(R?.readable)&&d(R?.writable))return F.fromWeb(R);if(typeof R?.writable=="object"||typeof R?.readable=="object"){const $=R!=null&&R.readable?o(R?.readable)?R?.readable:U(R.readable):void 0,Z=R!=null&&R.writable?a(R?.writable)?R?.writable:U(R.writable):void 0;return O({readable:$,writable:Z})}const J=R?.then;if(typeof J=="function"){let $;return C(J,R,Z=>{Z!=null&&$.push(Z),$.push(null)},Z=>{_($,Z)}),$=new F({objectMode:!0,writable:!1,read(){}})}throw new g(D,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],R)};function I(U){let{promise:R,resolve:D}=y();const J=new N,$=J.signal;return{value:U(async function*(){for(;;){const B=R;R=null;const{chunk:re,done:S,cb:H}=await B;if(i.nextTick(H),S)return;if($.aborted)throw new m(void 0,{cause:$.reason});({promise:R,resolve:D}=y()),yield re}}(),{signal:$}),write(B,re,S){const H=D;D=null,H({chunk:B,done:!1,cb:S})},final(B){const re=D;D=null,re({done:!0,cb:B})},destroy(B,re){J.abort(),re(B)}}}function O(U){const R=U.readable&&typeof U.readable.read!="function"?x.wrap(U.readable):U.readable,D=U.writable;let J=!!t(R),$=!!r(D),Z,B,re,S,H;function ee(Q){const he=S;S=null,he?he(Q):Q&&H.destroy(Q)}return H=new F({readableObjectMode:!!(R!=null&&R.readableObjectMode),writableObjectMode:!!(D!=null&&D.writableObjectMode),readable:J,writable:$}),$&&(u(D,Q=>{$=!1,Q&&_(R,Q),ee(Q)}),H._write=function(Q,he,W){D.write(Q,he)?W():Z=W},H._final=function(Q){D.end(),B=Q},D.on("drain",function(){if(Z){const Q=Z;Z=null,Q()}}),D.on("finish",function(){if(B){const Q=B;B=null,Q()}})),J&&(u(R,Q=>{J=!1,Q&&_(R,Q),ee(Q)}),R.on("readable",function(){if(re){const Q=re;re=null,Q()}}),R.on("end",function(){H.push(null)}),H._read=function(){for(;;){const Q=R.read();if(Q===null){re=H._read;return}if(!H.push(Q))return}}),H._destroy=function(Q,he){!Q&&S!==null&&(Q=new m),re=null,Z=null,B=null,S===null?he(Q):(S=he,_(D,Q),_(R,Q))},H}return ka}var Ra,ou;function Zi(){if(ou)return Ra;ou=1;const{ObjectDefineProperties:i,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=ut();Ra=o;const n=Vo(),s=Oc();r(o.prototype,n.prototype),r(o,n);{const d=t(s.prototype);for(let u=0;u<d.length;u++){const m=d[u];o.prototype[m]||(o.prototype[m]=s.prototype[m])}}function o(d){if(!(this instanceof o))return new o(d);n.call(this,d),s.call(this,d),d?(this.allowHalfOpen=d.allowHalfOpen!==!1,d.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),d.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}i(o.prototype,{writable:{__proto__:null,...e(s.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(s.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(s.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(s.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(s.prototype,"writableLength")},writableFinished:{__proto__:null,...e(s.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(s.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(s.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(s.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(d){this._readableState&&this._writableState&&(this._readableState.destroyed=d,this._writableState.destroyed=d)}}});let a;function c(){return a===void 0&&(a={}),a}o.fromWeb=function(d,u){return c().newStreamDuplexFromReadableWritablePair(d,u)},o.toWeb=function(d){return c().newReadableWritablePairFromDuplex(d)};let l;return o.from=function(d){return l||(l=Jm()),l(d,"body")},Ra}var Ia,au;function Kf(){if(au)return Ia;au=1;const{ObjectSetPrototypeOf:i,Symbol:e}=ut();Ia=o;const{ERR_METHOD_NOT_IMPLEMENTED:t}=Jt().codes,r=Zi(),{getHighWaterMark:n}=Uo();i(o.prototype,r.prototype),i(o,r);const s=e("kCallback");function o(l){if(!(this instanceof o))return new o(l);const d=l?n(this,l,"readableHighWaterMark",!0):null;d===0&&(l={...l,highWaterMark:null,readableHighWaterMark:d,writableHighWaterMark:l.writableHighWaterMark||0}),r.call(this,l),this._readableState.sync=!1,this[s]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",c)}function a(l){typeof this._flush=="function"&&!this.destroyed?this._flush((d,u)=>{if(d){l?l(d):this.destroy(d);return}u!=null&&this.push(u),this.push(null),l&&l()}):(this.push(null),l&&l())}function c(){this._final!==a&&a.call(this)}return o.prototype._final=a,o.prototype._transform=function(l,d,u){throw new t("_transform()")},o.prototype._write=function(l,d,u){const m=this._readableState,g=this._writableState,v=m.length;this._transform(l,d,(_,E)=>{if(_){u(_);return}E!=null&&this.push(E),g.ended||v===m.length||m.length<m.highWaterMark?u():this[s]=u})},o.prototype._read=function(){if(this[s]){const l=this[s];this[s]=null,l()}},Ia}var Ta,lu;function Xf(){if(lu)return Ta;lu=1;const{ObjectSetPrototypeOf:i}=ut();Ta=t;const e=Kf();i(t.prototype,e.prototype),i(t,e);function t(r){if(!(this instanceof t))return new t(r);e.call(this,r)}return t.prototype._transform=function(r,n,s){s(null,r)},Ta}var Ca,cu;function Pc(){if(cu)return Ca;cu=1;const i=Zr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:r,SymbolDispose:n}=ut(),s=Sr(),{once:o}=ti(),a=Nn(),c=Zi(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:d,ERR_INVALID_RETURN_VALUE:u,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:v},AbortError:_}=Jt(),{validateFunction:E,validateAbortSignal:x}=Bs(),{isIterable:k,isReadable:y,isReadableNodeStream:h,isNodeStream:p,isTransformStream:T,isWebStream:N,isReadableStream:C,isReadableFinished:F}=or(),I=globalThis.AbortController||Cs().AbortController;let O,U,R;function D(Q,he,W){let G=!1;Q.on("close",()=>{G=!0});const X=s(Q,{readable:he,writable:W},z=>{G=!z});return{destroy:z=>{G||(G=!0,a.destroyer(Q,z||new g("pipe")))},cleanup:X}}function J(Q){return E(Q[Q.length-1],"streams[stream.length - 1]"),Q.pop()}function $(Q){if(k(Q))return Q;if(h(Q))return Z(Q);throw new d("val",["Readable","Iterable","AsyncIterable"],Q)}async function*Z(Q){U||(U=Vo()),yield*U.prototype[r].call(Q)}async function B(Q,he,W,{end:G}){let X,z=null;const ne=_e=>{if(_e&&(X=_e),z){const M=z;z=null,M()}},se=()=>new t((_e,M)=>{X?M(X):z=()=>{X?M(X):_e()}});he.on("drain",ne);const ye=s(he,{readable:!1},ne);try{he.writableNeedDrain&&await se();for await(const _e of Q)he.write(_e)||await se();G&&(he.end(),await se()),W()}catch(_e){W(X!==_e?l(X,_e):_e)}finally{ye(),he.off("drain",ne)}}async function re(Q,he,W,{end:G}){T(he)&&(he=he.writable);const X=he.getWriter();try{for await(const z of Q)await X.ready,X.write(z).catch(()=>{});await X.ready,G&&await X.close(),W()}catch(z){try{await X.abort(z),W(z)}catch(ne){W(ne)}}}function S(...Q){return H(Q,o(J(Q)))}function H(Q,he,W){if(Q.length===1&&e(Q[0])&&(Q=Q[0]),Q.length<2)throw new m("streams");const G=new I,X=G.signal,z=W?.signal,ne=[];x(z,"options.signal");function se(){ve(new _)}R=R||ti().addAbortListener;let ye;z&&(ye=R(z,se));let _e,M;const K=[];let ce=0;function be(Ee){ve(Ee,--ce===0)}function ve(Ee,fe){var He;if(Ee&&(!_e||_e.code==="ERR_STREAM_PREMATURE_CLOSE")&&(_e=Ee),!(!_e&&!fe)){for(;K.length;)K.shift()(_e);(He=ye)===null||He===void 0||He[n](),G.abort(),fe&&(_e||ne.forEach(kt=>kt()),i.nextTick(he,_e,M))}}let xe;for(let Ee=0;Ee<Q.length;Ee++){const fe=Q[Ee],He=Ee<Q.length-1,kt=Ee>0,Ve=He||W?.end!==!1,Nt=Ee===Q.length-1;if(p(fe)){let A=function(f){f&&f.name!=="AbortError"&&f.code!=="ERR_STREAM_PREMATURE_CLOSE"&&be(f)};if(Ve){const{destroy:f,cleanup:b}=D(fe,He,kt);K.push(f),y(fe)&&Nt&&ne.push(b)}fe.on("error",A),y(fe)&&Nt&&ne.push(()=>{fe.removeListener("error",A)})}if(Ee===0)if(typeof fe=="function"){if(xe=fe({signal:X}),!k(xe))throw new u("Iterable, AsyncIterable or Stream","source",xe)}else k(fe)||h(fe)||T(fe)?xe=fe:xe=c.from(fe);else if(typeof fe=="function"){if(T(xe)){var ie;xe=$((ie=xe)===null||ie===void 0?void 0:ie.readable)}else xe=$(xe);if(xe=fe(xe,{signal:X}),He){if(!k(xe,!0))throw new u("AsyncIterable",`transform[${Ee-1}]`,xe)}else{var me;O||(O=Xf());const A=new O({objectMode:!0}),f=(me=xe)===null||me===void 0?void 0:me.then;if(typeof f=="function")ce++,f.call(xe,te=>{M=te,te!=null&&A.write(te),Ve&&A.end(),i.nextTick(be)},te=>{A.destroy(te),i.nextTick(be,te)});else if(k(xe,!0))ce++,B(xe,A,be,{end:Ve});else if(C(xe)||T(xe)){const te=xe.readable||xe;ce++,B(te,A,be,{end:Ve})}else throw new u("AsyncIterable or Promise","destination",xe);xe=A;const{destroy:b,cleanup:j}=D(xe,!1,!0);K.push(b),Nt&&ne.push(j)}}else if(p(fe)){if(h(xe)){ce+=2;const A=ee(xe,fe,be,{end:Ve});y(fe)&&Nt&&ne.push(A)}else if(T(xe)||C(xe)){const A=xe.readable||xe;ce++,B(A,fe,be,{end:Ve})}else if(k(xe))ce++,B(xe,fe,be,{end:Ve});else throw new d("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],xe);xe=fe}else if(N(fe)){if(h(xe))ce++,re($(xe),fe,be,{end:Ve});else if(C(xe)||k(xe))ce++,re(xe,fe,be,{end:Ve});else if(T(xe))ce++,re(xe.readable,fe,be,{end:Ve});else throw new d("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],xe);xe=fe}else xe=c.from(fe)}return(X!=null&&X.aborted||z!=null&&z.aborted)&&i.nextTick(se),xe}function ee(Q,he,W,{end:G}){let X=!1;if(he.on("close",()=>{X||W(new v)}),Q.pipe(he,{end:!1}),G){let z=function(){X=!0,he.end()};F(Q)?i.nextTick(z):Q.once("end",z)}else W();return s(Q,{readable:!0,writable:!1},z=>{const ne=Q._readableState;z&&z.code==="ERR_STREAM_PREMATURE_CLOSE"&&ne&&ne.ended&&!ne.errored&&!ne.errorEmitted?Q.once("end",W).once("error",W):W(z)}),s(he,{readable:!1,writable:!0},W)}return Ca={pipelineImpl:H,pipeline:S},Ca}var $a,du;function Qf(){if(du)return $a;du=1;const{pipeline:i}=Pc(),e=Zi(),{destroyer:t}=Nn(),{isNodeStream:r,isReadable:n,isWritable:s,isWebStream:o,isTransformStream:a,isWritableStream:c,isReadableStream:l}=or(),{AbortError:d,codes:{ERR_INVALID_ARG_VALUE:u,ERR_MISSING_ARGS:m}}=Jt(),g=Sr();return $a=function(..._){if(_.length===0)throw new m("streams");if(_.length===1)return e.from(_[0]);const E=[..._];if(typeof _[0]=="function"&&(_[0]=e.from(_[0])),typeof _[_.length-1]=="function"){const O=_.length-1;_[O]=e.from(_[O])}for(let O=0;O<_.length;++O)if(!(!r(_[O])&&!o(_[O]))){if(O<_.length-1&&!(n(_[O])||l(_[O])||a(_[O])))throw new u(`streams[${O}]`,E[O],"must be readable");if(O>0&&!(s(_[O])||c(_[O])||a(_[O])))throw new u(`streams[${O}]`,E[O],"must be writable")}let x,k,y,h,p;function T(O){const U=h;h=null,U?U(O):O?p.destroy(O):!I&&!F&&p.destroy()}const N=_[0],C=i(_,T),F=!!(s(N)||c(N)||a(N)),I=!!(n(C)||l(C)||a(C));if(p=new e({writableObjectMode:!!(N!=null&&N.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:F,readable:I}),F){if(r(N))p._write=function(U,R,D){N.write(U,R)?D():x=D},p._final=function(U){N.end(),k=U},N.on("drain",function(){if(x){const U=x;x=null,U()}});else if(o(N)){const R=(a(N)?N.writable:N).getWriter();p._write=async function(D,J,$){try{await R.ready,R.write(D).catch(()=>{}),$()}catch(Z){$(Z)}},p._final=async function(D){try{await R.ready,R.close().catch(()=>{}),k=D}catch(J){D(J)}}}const O=a(C)?C.readable:C;g(O,()=>{if(k){const U=k;k=null,U()}})}if(I){if(r(C))C.on("readable",function(){if(y){const O=y;y=null,O()}}),C.on("end",function(){p.push(null)}),p._read=function(){for(;;){const O=C.read();if(O===null){y=p._read;return}if(!p.push(O))return}};else if(o(C)){const U=(a(C)?C.readable:C).getReader();p._read=async function(){for(;;)try{const{value:R,done:D}=await U.read();if(!p.push(R))return;if(D){p.push(null);return}}catch{return}}}}return p._destroy=function(O,U){!O&&h!==null&&(O=new d),y=null,x=null,k=null,h===null?U(O):(h=U,r(C)&&t(C,O))},p},$a}var uu;function Ym(){if(uu)return no;uu=1;const i=globalThis.AbortController||Cs().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:r,ERR_OUT_OF_RANGE:n},AbortError:s}=Jt(),{validateAbortSignal:o,validateInteger:a,validateObject:c}=Bs(),l=ut().Symbol("kWeak"),d=ut().Symbol("kResistStopPropagation"),{finished:u}=Sr(),m=Qf(),{addAbortSignalNoValidate:g}=qo(),{isWritable:v,isNodeStream:_}=or(),{deprecate:E}=ti(),{ArrayPrototypePush:x,Boolean:k,MathFloor:y,Number:h,NumberIsNaN:p,Promise:T,PromiseReject:N,PromiseResolve:C,PromisePrototypeThen:F,Symbol:I}=ut(),O=I("kEmpty"),U=I("kEof");function R(z,ne){if(ne!=null&&c(ne,"options"),ne?.signal!=null&&o(ne.signal,"options.signal"),_(z)&&!v(z))throw new e("stream",z,"must be writable");const se=m(this,z);return ne!=null&&ne.signal&&g(ne.signal,se),se}function D(z,ne){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);ne!=null&&c(ne,"options"),ne?.signal!=null&&o(ne.signal,"options.signal");let se=1;ne?.concurrency!=null&&(se=y(ne.concurrency));let ye=se-1;return ne?.highWaterMark!=null&&(ye=y(ne.highWaterMark)),a(se,"options.concurrency",1),a(ye,"options.highWaterMark",0),ye+=se,(async function*(){const M=ti().AbortSignalAny([ne?.signal].filter(k)),K=this,ce=[],be={signal:M};let ve,xe,ie=!1,me=0;function Ee(){ie=!0,fe()}function fe(){me-=1,He()}function He(){xe&&!ie&&me<se&&ce.length<ye&&(xe(),xe=null)}async function kt(){try{for await(let Ve of K){if(ie)return;if(M.aborted)throw new s;try{if(Ve=z(Ve,be),Ve===O)continue;Ve=C(Ve)}catch(Nt){Ve=N(Nt)}me+=1,F(Ve,fe,Ee),ce.push(Ve),ve&&(ve(),ve=null),!ie&&(ce.length>=ye||me>=se)&&await new T(Nt=>{xe=Nt})}ce.push(U)}catch(Ve){const Nt=N(Ve);F(Nt,fe,Ee),ce.push(Nt)}finally{ie=!0,ve&&(ve(),ve=null)}}kt();try{for(;;){for(;ce.length>0;){const Ve=await ce[0];if(Ve===U)return;if(M.aborted)throw new s;Ve!==O&&(yield Ve),ce.shift(),He()}await new T(Ve=>{ve=Ve})}}finally{ie=!0,xe&&(xe(),xe=null)}}).call(this)}function J(z=void 0){return z!=null&&c(z,"options"),z?.signal!=null&&o(z.signal,"options.signal"),(async function*(){let se=0;for await(const _e of this){var ye;if(z!=null&&(ye=z.signal)!==null&&ye!==void 0&&ye.aborted)throw new s({cause:z.signal.reason});yield[se++,_e]}}).call(this)}async function $(z,ne=void 0){for await(const se of S.call(this,z,ne))return!0;return!1}async function Z(z,ne=void 0){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);return!await $.call(this,async(...se)=>!await z(...se),ne)}async function B(z,ne){for await(const se of S.call(this,z,ne))return se}async function re(z,ne){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function se(ye,_e){return await z(ye,_e),O}for await(const ye of D.call(this,se,ne));}function S(z,ne){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function se(ye,_e){return await z(ye,_e)?ye:O}return D.call(this,se,ne)}class H extends r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function ee(z,ne,se){var ye;if(typeof z!="function")throw new t("reducer",["Function","AsyncFunction"],z);se!=null&&c(se,"options"),se?.signal!=null&&o(se.signal,"options.signal");let _e=arguments.length>1;if(se!=null&&(ye=se.signal)!==null&&ye!==void 0&&ye.aborted){const ve=new s(void 0,{cause:se.signal.reason});throw this.once("error",()=>{}),await u(this.destroy(ve)),ve}const M=new i,K=M.signal;if(se!=null&&se.signal){const ve={once:!0,[l]:this,[d]:!0};se.signal.addEventListener("abort",()=>M.abort(),ve)}let ce=!1;try{for await(const ve of this){var be;if(ce=!0,se!=null&&(be=se.signal)!==null&&be!==void 0&&be.aborted)throw new s;_e?ne=await z(ne,ve,{signal:K}):(ne=ve,_e=!0)}if(!ce&&!_e)throw new H}finally{M.abort()}return ne}async function Q(z){z!=null&&c(z,"options"),z?.signal!=null&&o(z.signal,"options.signal");const ne=[];for await(const ye of this){var se;if(z!=null&&(se=z.signal)!==null&&se!==void 0&&se.aborted)throw new s(void 0,{cause:z.signal.reason});x(ne,ye)}return ne}function he(z,ne){const se=D.call(this,z,ne);return(async function*(){for await(const _e of se)yield*_e}).call(this)}function W(z){if(z=h(z),p(z))return 0;if(z<0)throw new n("number",">= 0",z);return z}function G(z,ne=void 0){return ne!=null&&c(ne,"options"),ne?.signal!=null&&o(ne.signal,"options.signal"),z=W(z),(async function*(){var ye;if(ne!=null&&(ye=ne.signal)!==null&&ye!==void 0&&ye.aborted)throw new s;for await(const M of this){var _e;if(ne!=null&&(_e=ne.signal)!==null&&_e!==void 0&&_e.aborted)throw new s;z--<=0&&(yield M)}}).call(this)}function X(z,ne=void 0){return ne!=null&&c(ne,"options"),ne?.signal!=null&&o(ne.signal,"options.signal"),z=W(z),(async function*(){var ye;if(ne!=null&&(ye=ne.signal)!==null&&ye!==void 0&&ye.aborted)throw new s;for await(const M of this){var _e;if(ne!=null&&(_e=ne.signal)!==null&&_e!==void 0&&_e.aborted)throw new s;if(z-- >0&&(yield M),z<=0)return}}).call(this)}return no.streamReturningOperators={asIndexedPairs:E(J,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:S,flatMap:he,map:D,take:X,compose:R},no.promiseReturningOperators={every:Z,forEach:re,reduce:ee,toArray:Q,some:$,find:B},no}var Aa,hu;function Jf(){if(hu)return Aa;hu=1;const{ArrayPrototypePop:i,Promise:e}=ut(),{isIterable:t,isNodeStream:r,isWebStream:n}=or(),{pipelineImpl:s}=Pc(),{finished:o}=Sr();Yf();function a(...c){return new e((l,d)=>{let u,m;const g=c[c.length-1];if(g&&typeof g=="object"&&!r(g)&&!t(g)&&!n(g)){const v=i(c);u=v.signal,m=v.end}s(c,(v,_)=>{v?d(v):l(_)},{signal:u,end:m})})}return Aa={finished:o,pipeline:a},Aa}var fu;function Yf(){if(fu)return la.exports;fu=1;const{Buffer:i}=sr(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=ut(),{promisify:{custom:n}}=ti(),{streamReturningOperators:s,promiseReturningOperators:o}=Ym(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:a}}=Jt(),c=Qf(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:d}=Uo(),{pipeline:u}=Pc(),{destroyer:m}=Nn(),g=Sr(),v=Jf(),_=or(),E=la.exports=Lc().Stream;E.isDestroyed=_.isDestroyed,E.isDisturbed=_.isDisturbed,E.isErrored=_.isErrored,E.isReadable=_.isReadable,E.isWritable=_.isWritable,E.Readable=Vo();for(const k of t(s)){let h=function(...p){if(new.target)throw a();return E.Readable.from(r(y,this,p))};const y=s[k];e(h,"name",{__proto__:null,value:y.name}),e(h,"length",{__proto__:null,value:y.length}),e(E.Readable.prototype,k,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}for(const k of t(o)){let h=function(...p){if(new.target)throw a();return r(y,this,p)};const y=o[k];e(h,"name",{__proto__:null,value:y.name}),e(h,"length",{__proto__:null,value:y.length}),e(E.Readable.prototype,k,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}E.Writable=Oc(),E.Duplex=Zi(),E.Transform=Kf(),E.PassThrough=Xf(),E.pipeline=u;const{addAbortSignal:x}=qo();return E.addAbortSignal=x,E.finished=g,E.destroy=m,E.compose=c,E.setDefaultHighWaterMark=l,E.getDefaultHighWaterMark=d,e(E,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return v}}),e(u,n,{__proto__:null,enumerable:!0,get(){return v.pipeline}}),e(g,n,{__proto__:null,enumerable:!0,get(){return v.finished}}),E.Stream=E,E._isUint8Array=function(y){return y instanceof Uint8Array},E._uint8ArrayToBuffer=function(y){return i.from(y.buffer,y.byteOffset,y.byteLength)},la.exports}var pu;function Zf(){return pu||(pu=1,function(i){const e=Yf(),t=Jf(),r=e.Readable.destroy;i.exports=e.Readable,i.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,i.exports._isUint8Array=e._isUint8Array,i.exports.isDisturbed=e.isDisturbed,i.exports.isErrored=e.isErrored,i.exports.isReadable=e.isReadable,i.exports.Readable=e.Readable,i.exports.Writable=e.Writable,i.exports.Duplex=e.Duplex,i.exports.Transform=e.Transform,i.exports.PassThrough=e.PassThrough,i.exports.addAbortSignal=e.addAbortSignal,i.exports.finished=e.finished,i.exports.destroy=e.destroy,i.exports.destroy=r,i.exports.pipeline=e.pipeline,i.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),i.exports.Stream=e.Stream,i.exports.default=i.exports}(aa)),aa.exports}var Mc=Zf();const Na=Symbol("iter");function bs(i,e,t=4){if(t===0)return Object.assign(i,e);for(const r in e)i[r]=bs(i[r]||Object.create(null),e[r],t-1);return i}function ep(i,e,t=4){let r=!1;for(const n in i)if(n in e){const s=t===0?null:ep(i[n],e[n],t-1);if(s!==!1)r=r||Object.create(null),r[n]=s;else if(t===3)return!1}return r}function tp(i,e,t=4){let r=!1;for(const n in i)if(!(n in e))r=r||Object.create(null),r[n]=t===0?null:bs({},i[n],t-1);else if(t!==0){const s=tp(i[n],e[n],t-1);if(s!==!1)r=r||Object.create(null),r[n]=s;else if(t===3)return!1}return r}class Zm{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||ze}_termFromId(e){if(e[0]==="."){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return fs(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let s;return t&&r&&n&&(Zl(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${r}.${n}.${s}`:`.${t}.${r}.${n}`]}return this._ids[hn(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${Zl(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:hn(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;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))}}class jt{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||ze,this._entityIndex=t.entityIndex||new Zm({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;const t=this._graphs;let r,n;for(const s in t)for(const o in r=t[s].subjects)for(const a in n=r[o])e+=Object.keys(n[a]).length;return this._size=e}_addToIndex(e,t,r,n){const s=e[t]||(e[t]={}),o=s[r]||(s[r]={}),a=n in o;return a||(o[n]=null),!a}_removeFromIndex(e,t,r,n){const s=e[t],o=s[r];delete o[n];for(const a in o)return;delete s[r];for(const a in s)return;delete e[t]}*_findInIndex(e,t,r,n,s,o,a,c){let l,d,u;const m=this._entities,g=this._termFromId(m[c]),v={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const _ in e)if(d=e[_]){v[s]=this._termFromId(m[_]),r&&((l=d,d={})[r]=l[r]);for(const E in d)if(u=d[E]){v[o]=this._termFromId(m[E]);const x=n?n in u?[n]:[]:Object.keys(u);for(let k=0;k<x.length;k++)v[a]=this._termFromId(m[x[k]]),yield this._factory.quad(v.subject,v.predicate,v.object,g)}}}_loop(e,t){for(const r in e)t(r)}_loopByKey0(e,t,r){let n,s;if(n=e[t])for(s in n)r(s)}_loopByKey1(e,t,r){let n,s;for(n in e)s=e[n],s[t]&&r(n)}_loopBy2Keys(e,t,r,n){let s,o,a;if((s=e[t])&&(o=s[r]))for(a in o)n(a)}_countInIndex(e,t,r,n){let s=0,o,a,c;t&&((o=e,e={})[t]=o[t]);for(const l in e)if(a=e[l]){r&&((o=a,a={})[r]=o[r]);for(const d in a)(c=a[d])&&(n?n in c&&s++:s+=Object.keys(c).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return r=>{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1;let s=this._graphs[n];return s||(s=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),r=this._termToNewNumericId(r),this._addToIndex(s.subjects,e,t,r)?(this._addToIndex(s.predicates,t,r,e),this._addToIndex(s.objects,r,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,r,n){return e&&e.subject&&({subject:e,predicate:t,object:r,graph:n}=e),!this.readQuads(e,t,r,n).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,r,n){t||({subject:e,predicate:t,object:r,graph:n}=e),n=n?this._termToNumericId(n):1;const s=this._graphs;let o,a,c;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(r=r&&this._termToNumericId(r))||!(o=s[n])||!(a=o.subjects[e])||!(c=a[t])||!(r in c))return!1;this._removeFromIndex(o.subjects,e,t,r),this._removeFromIndex(o.predicates,t,r,e),this._removeFromIndex(o.objects,r,e,t),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,r,n){const s=new Mc.Readable({objectMode:!0}),o=this.readQuads(e,t,r,n);return s._read=a=>{for(;--a>=0;){const{done:c,value:l}=o.next();if(c){s.push(null);return}s.push(l)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,n){return[...this.readQuads(e,t,r,n)]}*readQuads(e,t,r,n){const s=this._getGraphs(n);let o,a,c,l;if(!(e&&!(a=this._termToNumericId(e))||t&&!(c=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(const d in s)(o=s[d])&&(a?l?yield*this._findInIndex(o.objects,l,a,c,"object","subject","predicate",d):yield*this._findInIndex(o.subjects,a,c,null,"subject","predicate","object",d):c?yield*this._findInIndex(o.predicates,c,l,null,"predicate","object","subject",d):l?yield*this._findInIndex(o.objects,l,null,null,"object","subject","predicate",d):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",d))}match(e,t,r,n){return new mr(this,e,t,r,n,{entityIndex:this._entityIndex})}countQuads(e,t,r,n){const s=this._getGraphs(n);let o=0,a,c,l,d;if(e&&!(c=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(d=this._termToNumericId(r)))return 0;for(const u in s)(a=s[u])&&(e?r?o+=this._countInIndex(a.objects,d,c,l):o+=this._countInIndex(a.subjects,c,l,d):t?o+=this._countInIndex(a.predicates,l,d,c):o+=this._countInIndex(a.objects,d,c,l));return o}forEach(e,t,r,n,s){this.some(o=>(e(o,this),!1),t,r,n,s)}every(e,t,r,n,s){return!this.some(o=>!e(o,this),t,r,n,s)}some(e,t,r,n,s){for(const o of this.readQuads(t,r,n,s))if(e(o,this))return!0;return!1}getSubjects(e,t,r){const n=[];return this.forSubjects(s=>{n.push(s)},e,t,r),n}forSubjects(e,t,r,n){const s=this._getGraphs(n);let o,a,c;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r))))for(n in s)(o=s[n])&&(a?c?this._loopBy2Keys(o.predicates,a,c,e):this._loopByKey1(o.subjects,a,e):c?this._loopByKey0(o.objects,c,e):this._loop(o.subjects,e))}getPredicates(e,t,r){const n=[];return this.forPredicates(s=>{n.push(s)},e,t,r),n}forPredicates(e,t,r,n){const s=this._getGraphs(n);let o,a,c;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r))))for(n in s)(o=s[n])&&(a?c?this._loopBy2Keys(o.objects,c,a,e):this._loopByKey0(o.subjects,a,e):c?this._loopByKey1(o.predicates,c,e):this._loop(o.predicates,e))}getObjects(e,t,r){const n=[];return this.forObjects(s=>{n.push(s)},e,t,r),n}forObjects(e,t,r,n){const s=this._getGraphs(n);let o,a,c;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r))))for(n in s)(o=s[n])&&(a?c?this._loopBy2Keys(o.subjects,a,c,e):this._loopByKey1(o.objects,a,e):c?this._loopByKey0(o.predicates,c,e):this._loop(o.objects,e))}getGraphs(e,t,r){const n=[];return this.forGraphs(s=>{n.push(s)},e,t,r),n}forGraphs(e,t,r,n){for(const s in this._graphs)this.some(o=>(e(o.graph),!0),t,r,n,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(a,c)=>{throw new Error(`${a.value} ${c}`)},s=this.getQuads(null,Lt.rdf.rest,Lt.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{const c=[];let l=!1,d,u;const m=a.graph;let g=a.subject;for(;g&&!l;){const v=this.getQuads(null,null,g,null),_=this.getQuads(g,null,null,null);let E,x=null,k=null,y=null;for(let h=0;h<_.length&&!l;h++)E=_[h],E.graph.equals(m)?d?l=n(g,"has non-list arcs out"):E.predicate.value===Lt.rdf.first?x?l=n(g,"has multiple rdf:first arcs"):o.push(x=E):E.predicate.value===Lt.rdf.rest?k?l=n(g,"has multiple rdf:rest arcs"):o.push(k=E):v.length?l=n(g,"can't be subject and object"):(d=E,u="subject"):l=n(g,"not confined to single graph");for(let h=0;h<v.length&&!l;++h)E=v[h],d?l=n(g,"can't have coreferences"):E.predicate.value===Lt.rdf.rest?y?l=n(g,"has incoming rdf:rest arcs"):y=E:(d=E,u="object");x?c.unshift(x.object):l=n(g,"has no list head"),g=y&&y.subject}l?e=!1:d&&(r[d[u].value]=c)}),e&&this.removeQuads(o),r}addAll(e){if(e instanceof mr&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof jt&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=bs(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof mr&&(e=e.filtered),e===this)return!0;if(!(e instanceof jt)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,r=e._graphs;let n,s,o,a,c;for(const l in r){if(!(n=t[l]))return!1;n=n.subjects;for(const d in s=r[l].subjects){if(!(o=n[d]))return!1;for(const u in a=s[d]){if(!(c=o[u]))return!1;for(const m in a[u])if(!(m in c))return!1}}}return!0}deleteMatches(e,t,r,n){for(const s of this.match(e,t,r,n))this.removeQuad(s);return this}difference(e){if(e&&e instanceof mr&&(e=e.filtered),e===this)return new jt({entityIndex:this._entityIndex});if(e instanceof jt&&e._entityIndex===this._entityIndex){const t=new jt({entityIndex:this._entityIndex}),r=tp(this._graphs,e._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof mr&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new jt({entityIndex:this._entityIndex});for(const r of this)e(r,this)&&t.add(r);return t}intersection(e){if(e instanceof mr&&(e=e.filtered),e===this){const t=new jt({entityIndex:this._entityIndex});return t._graphs=bs(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof jt&&this._entityIndex===e._entityIndex){const t=new jt({entityIndex:this._entityIndex}),r=ep(e._graphs,this._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new jt({entityIndex:this._entityIndex});for(const r of this)t.add(e(r,this));return t}reduce(e,t){const r=this.readQuads();let n=t===void 0?r.next().value:t;for(const s of r)n=e(n,s,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new Dc().quadsToString(this)}union(e){const t=new jt({entityIndex:this._entityIndex});return t._graphs=bs(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function Fi(i,e,t=0){const r=e[t];if(r&&!(r in i))return!1;let n=!1;for(const s in r?{[r]:i[r]}:i){const o=t===2?null:Fi(i[s],e,t+1);o!==!1&&(n=n||Object.create(null),n[s]=o)}return n}class mr extends Mc.Readable{constructor(e,t,r,n,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:r,object:n,graph:s,options:o})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:r,predicate:n,subject:s}=this,o=this._filtered=new jt({factory:e._factory,entityIndex:this.options.entityIndex});let a,c,l;if(s&&!(a=o._termToNumericId(s))||n&&!(c=o._termToNumericId(n))||r&&!(l=o._termToNumericId(r)))return o;const d=e._getGraphs(t);for(const u in d){let m,g,v,_;(_=d[u])&&(!a&&c?(g=Fi(_.predicates,[c,l,a]))&&(m=Fi(_.subjects,[a,c,l]),v=Fi(_.objects,[l,a,c])):l?(v=Fi(_.objects,[l,a,c]))&&(m=Fi(_.subjects,[a,c,l]),g=Fi(_.predicates,[c,l,a])):(m=Fi(_.subjects,[a,c,l]))&&(g=Fi(_.predicates,[c,l,a]),v=Fi(_.objects,[l,a,c])),m&&(o._graphs[u]={subjects:m,predicates:g,objects:v}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Na]&&(this[Na]=this[Symbol.iterator]());const t=this[Na];for(;--e>=0;){const{done:r,value:n}=t.next();if(r){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,r,n){return this.filtered.deleteMatches(e,t,r,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,r,n,s){return this.filtered.every(e,t,r,n,s)}filter(e){return this.filtered.filter(e)}forEach(e,t,r,n,s){return this.filtered.forEach(e,t,r,n,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,r,n,s){return this.filtered.some(e,t,r,n,s)}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 Dc().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,r,n){return new mr(this.filtered,e,t,r,n,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class eg extends Mc.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new zf(e);let r,n;const s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),t.parse({on:(o,a)=>{switch(o){case"data":r=a;break;case"end":n=a;break}}},s),this._transform=(o,a,c)=>{r(o),c()},this._flush=o=>{n(),o()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const Oe="http://www.w3.org/ns/shacl#",mu="http://datashapes.org/dash#",wr="http://www.w3.org/2001/XMLSchema#",gr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Fc="http://www.w3.org/2000/01/rdf-schema#",jc="http://www.w3.org/2004/02/skos/core#",tg="http://www.w3.org/2002/07/owl#",ig="http://www.w3.org/ns/oa#",rg="http://purl.org/dc/terms/",ng="http://xmlns.com/foaf/0.1/",ys=ze.namedNode("loaded-shapes"),Ji=ze.namedNode("loaded-data"),qt=ze.namedNode(gr+"type"),ec=ze.namedNode(rg+"conformsTo"),gu=ze.namedNode(Fc+"subClassOf"),Bc=ze.namedNode(tg+"imports"),sg=ze.namedNode(jc+"broader"),og=ze.namedNode(jc+"narrower"),ao=ze.namedNode(Oe+"NodeShape"),ag=ze.namedNode(Oe+"IRI"),So=ze.namedNode(Oe+"property"),qc=ze.namedNode(Oe+"class"),lg=ze.namedNode(Oe+"node"),gn=ze.namedNode(Oe+"targetClass"),cg=ze.namedNode(Oe+"nodeKind"),dg=ze.namedNode(wr+"string");function vs(i,e,t=Oe,r){let n="";const s=ug(i,e,t,r);return s&&(n=s.value),n}function ug(i,e,t=Oe,r){let n;const s=t+e;if(r?.length){for(const o of r)for(const a of i)if(a.predicate.value===s){if(a.object.id.endsWith(`@${o}`))return a.object;a.object.id.indexOf("@")<0?n=a.object:n||(n=a.object)}}else for(const o of i)if(o.predicate.value===s)return o.object;return n}function hg(i){i.querySelector(".editor")?.focus()}function qs(i,e){return vs(i,"prefLabel",jc,e)||vs(i,"label",Fc,e)||vs(i,"name",ng,e)}function ip(i,e,t){const r=[];for(const n of i)r.push({value:n,label:qs(e.getQuads(n,null,null,null),t),children:[]});return r}function tc(i,e){for(const t in e)i=i.replace(e[t],"");return i}function rp(i,e,t,r,n=new Set){for(const s of e.owlImports)n.has(s.id)||(n.add(s.id),r.push(...t.getSubjects(qt,i,s)));e.parent&&rp(i,e.parent,t,r,n)}function Uc(i,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return ip(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(qt,i,ys);t.push(...e.config.store.getSubjects(qt,i,Ji)),rp(i,e,e.config.store,t);const r=new Map,n=new Map;for(const o of t)r.set(o.id,{value:o,label:qs(e.config.store.getQuads(o,null,null,null),e.config.languages),children:[]});for(const o of t){for(const a of e.config.store.getObjects(o,sg,null))r.has(a.id)&&n.set(o.id,a.id);for(const a of e.config.store.getObjects(o,og,null))r.has(a.id)&&n.set(a.id,o.id);for(const a of e.config.store.getObjects(o,gu,null))r.has(a.id)&&n.set(o.id,a.id)}for(const[o,a]of n.entries())r.get(a)?.children?.push(r.get(o));const s=[];for(const[o,a]of r.entries())n.has(o)||s.push(a);for(const o of e.config.store.getSubjects(gu,i,null))s.push(...Uc(o,e));return s}}function ic(i){let e;try{e=new URL(i)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function bu(i,e,t){if(e===void 0)return t;if(t===void 0)return e;const r=i.indexOf(e.language);if(r<0)return t;const n=i.indexOf(t.language);return n<0||n>r?e:t}function fg(i,{remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(a,c)=>{throw new Error(`${a.value} ${c}`)},s=i.getQuads(null,gr+"rest",gr+"nil",null),o=e?[...s]:[];return s.forEach(a=>{const c=[];let l=!1,d,u;const m=a.graph;let g=a.subject;for(;g&&!l;){const v=i.getQuads(null,null,g,null),_=i.getQuads(g,null,null,null).filter(h=>!h.predicate.equals(qt));let E,x=null,k=null,y=null;for(let h=0;h<_.length&&!l;h++)E=_[h],E.graph.equals(m)?d?l=n(g,"has non-list arcs out"):E.predicate.value===gr+"first"?x?l=n(g,"has multiple rdf:first arcs"):o.push(x=E):E.predicate.value===gr+"rest"?k?l=n(g,"has multiple rdf:rest arcs"):o.push(k=E):v.length?l=n(g,"can't be subject and object"):(d=E,u="subject"):l=n(g,"not confined to single graph");for(let h=0;h<v.length&&!l;++h)E=v[h],d?l=n(g,"can't have coreferences"):E.predicate.value===gr+"rest"?y?l=n(g,"has incoming rdf:rest arcs"):y=E:(d=E,u="object");x?c.unshift(x.object):l=n(g,"has no list head"),g=y&&y.subject}l?e=!1:d&&(r[d[u].value]=c)}),e&&i.removeQuads(o),r}function np(i,e,t){const r=document.createElement("div");r.classList.add("shacl-or-constraint");const n=[];if(e instanceof _r){const s=[];let o=!1;i.length&&(o=t.store.countQuads(i[0],So,null,null)>0);for(let l=0;l<i.length;l++)if(o){const d=t.store.getObjects(i[l],So,null),u=[];let m="";for(const g of d){const v=new Io(g,e,t);u.push(v),m+=(m.length>1?" / ":"")+v.template.label}s.push(u),n.push({label:m,value:l.toString()})}else{const d=new Io(i[l],e,t);s.push([d]),n.push({label:d.template.label,value:l.toString()})}const a=t.theme.createListEditor("Please choose",null,!1,n),c=a.querySelector(".editor");c.onchange=()=>{if(c.value){const l=s[parseInt(c.value)];let d;l.length&&(d=l[0],r.replaceWith(l[0]));for(let u=1;u<l.length;u++)d.after(l[u]),d=l[u]}},r.appendChild(a)}else{const s=[];for(let c=0;c<i.length;c++){const l=t.store.getQuads(i[c],null,null,null);l.length&&(s.push(l),n.push({label:qs(l,t.languages)||tc(l[0].predicate.value,t.prefixes)+" = "+tc(l[0].object.value,t.prefixes),value:c.toString()}))}const o=t.theme.createListEditor(e.template.label+"?",null,!1,n,e.template),a=o.querySelector(".editor");a.onchange=()=>{a.value&&r.replaceWith(yo(e.template.clone().merge(s[parseInt(a.value)]),void 0,!0))},r.appendChild(o)}return r}function pg(i,e,t){if(e instanceof yi){const r=e.datatype;for(const n of i){const s=t.store.getQuads(n,null,null,null);for(const o of s)if(o.predicate.value===`${Oe}datatype`&&o.object.equals(r))return s}}else{const r=t.store.getObjects(e,qt,null);for(const n of i){const s=t.store.getQuads(n,null,null,null);for(const o of s)if(r.length>0){if(o.predicate.value===`${Oe}node`){for(const a of r)if(t.store.getQuads(o.object,gn,a,null).length>0)return s}if(o.predicate.equals(qc)){for(const a of r)if(o.object.equals(a))return s}}else if(o.predicate.equals(cg)&&o.object.equals(ag))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function mg(i,e,t){for(const r of i){let n=!1;const s=t.store.getObjects(r,So,null);for(const o of s){const a=t.store.getObjects(o,`${Oe}path`,null);for(const c of a)if(n=t.store.countQuads(e,c,null,null)>0,n)break}if(n)return s}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const gg={[`${Oe}name`]:(i,e)=>{const t=e;i.name=bu(i.config.languages,i.name,t)},[`${Oe}description`]:(i,e)=>{const t=e;i.description=bu(i.config.languages,i.description,t)},[`${Oe}path`]:(i,e)=>{i.path=e.value},[`${Oe}node`]:(i,e)=>{i.node=e},[`${Oe}datatype`]:(i,e)=>{i.datatype=e},[`${Oe}nodeKind`]:(i,e)=>{i.nodeKind=e},[`${Oe}minCount`]:(i,e)=>{i.minCount=parseInt(e.value)},[`${Oe}maxCount`]:(i,e)=>{i.maxCount=parseInt(e.value)},[`${Oe}minLength`]:(i,e)=>{i.minLength=parseInt(e.value)},[`${Oe}maxLength`]:(i,e)=>{i.maxLength=parseInt(e.value)},[`${Oe}minInclusive`]:(i,e)=>{i.minInclusive=parseInt(e.value)},[`${Oe}maxInclusive`]:(i,e)=>{i.maxInclusive=parseInt(e.value)},[`${Oe}minExclusive`]:(i,e)=>{i.minExclusive=parseInt(e.value)},[`${Oe}maxExclusive`]:(i,e)=>{i.maxExclusive=parseInt(e.value)},[`${Oe}pattern`]:(i,e)=>{i.pattern=e.value},[`${Oe}order`]:(i,e)=>{i.order=parseInt(e.value)},[`${mu}singleLine`]:(i,e)=>{i.singleLine=e.value==="true"},[`${mu}readonly`]:(i,e)=>{i.readonly=e.value==="true"},[`${ig}styleClass`]:(i,e)=>{i.cssClass=e.value},[`${Oe}and`]:(i,e)=>{i.shaclAnd=e.value},[`${Oe}in`]:(i,e)=>{i.shaclIn=e.value},[`${Oe}languageIn`]:(i,e)=>{i.languageIn=i.config.lists[e.value],i.datatype=ze.namedNode(gr+"langString")},[`${Oe}defaultValue`]:(i,e)=>{i.defaultValue=e},[`${Oe}hasValue`]:(i,e)=>{i.hasValue=e},[`${Oe}qualifiedValueShape`]:(i,e)=>{i.qualifiedValueShape=e},[`${Oe}qualifiedMinCount`]:(i,e)=>{i.minCount=parseInt(e.value)},[`${Oe}qualifiedMaxCount`]:(i,e)=>{i.maxCount=parseInt(e.value)},[Bc.id]:(i,e)=>{i.owlImports.push(e)},[qc.id]:(i,e)=>{i.class=e;const t=i.config.store.getSubjects(gn,e,null);t.length>0&&(i.node=t[0])},[`${Oe}or`]:(i,e)=>{const t=i.config.lists[e.value];t?.length?i.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",i.config.lists)},[`${Oe}xone`]:(i,e)=>{const t=i.config.lists[e.value];t?.length?i.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",i.config.lists)}};class bg{constructor(e,t,r){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=r,this.merge(e),this.qualifiedValueShape&&this.merge(r.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)gg[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||qs(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?tc(this.path,this.config.prefixes):"unknown"),this.node&&this.extendedShapes.push(this.node),this.shaclAnd){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const r of t)this.extendedShapes.push(r)}return this}clone(){const e=Object.assign({},this);return e.extendedShapes=[...this.extendedShapes],e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),this.shaclXone&&(e.shaclXone=[...this.shaclXone]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}const yg=`form { display:block; --label-width: 8em; --caret-size: 10px; }
28
28
  form.mode-edit { padding-left: 1em; }
29
29
  form, form * { box-sizing: border-box; }
30
30
  shacl-node, .collapsible::part(content) { display: flex; flex-direction: column; width: 100%; position: relative; }
@@ -299,7 +299,7 @@ a, a:visited { color: inherit; }
299
299
  .title { font-weight: 600; flex-grow: 1; text-align: center; }
300
300
  .clear { justify-self: flex-end; }
301
301
  main { flex-grow: 1; overflow: auto; }
302
- `];Us([je({type:Boolean,reflect:!0})],Kr.prototype,"open",2);Us([je({type:Boolean})],Kr.prototype,"closable",2);Us([je()],Kr.prototype,"title",2);Us([Ei("#dialog")],Kr.prototype,"dialogElement",2);Kr=Us([kr("rokit-dialog")],Kr);class Io extends HTMLElement{constructor(e,t,r,n){if(super(),this.template=new bg(r.store.getQuads(e,null,null,null),t,r),this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const s=new Ht;s.classList.add("collapsible","shacl-group"),s.open=r.attributes.collapse==="open",s.label=this.template.label,this.container=s}else this.container=this;if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),r.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let s=[];n&&(t.linked?s=r.store.getQuads(n,this.template.path,null,null):s=r.store.getQuads(n,this.template.path,null,Ji));let o=!1;for(const a of s)this.isValueValid(a.object)&&(this.addPropertyInstance(a.object),this.template.hasValue&&a.object.equals(this.template.hasValue)&&(o=!0));r.editMode&&this.template.hasValue&&!o&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}r.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof Ht&&(r.editMode&&!t.linked||this.container.childElementCount>0)&&this.appendChild(this.container)}addPropertyInstance(e){let t;if(this.template.shaclOr?.length||this.template.shaclXone?.length){const r=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let n=!1;if(e){const s=pg(r,e,this.template.config);s.length&&(t=yo(this.template.clone().merge(s),e,!0),n=!0)}n||(t=np(r,this,this.template.config),xp(t,""))}else{let r=!1;if(e&&!(e instanceof yi)){const n=this.getRdfClassToLinkOrCreate();n&&this.template.config.store.countQuads(e,qt,n,Ji)===0&&(r=!0)}t=yo(this.template,e,void 0,r||this.template.parent.linked)}return this.addButton?this.container.insertBefore(t,this.addButton):this.container.appendChild(t),t}updateControls(){let e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;e===0&&(!this.template.extendedShapes.length||this.template.minCount!==void 0&&this.template.minCount>0)&&(this.addPropertyInstance(),e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length);let t;this.template.minCount!==void 0?t=e>this.template.minCount:t=this.template.extendedShapes.length>0||e>1;const r=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",r)}toRDF(e,t){for(const r of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const n=ze.namedNode(r.dataset.path);if(r.firstChild instanceof _r){const s=r.firstChild.toRDF(e);e.addQuad(t,n,s,this.template.config.valuesGraphId)}else for(const s of r.querySelectorAll(":scope > .editor")){const o=Eg(s);o&&e.addQuad(t,n,o,this.template.config.valuesGraphId)}}}getRdfClassToLinkOrCreate(){if(this.template.class&&this.template.node)return this.template.class;for(const e of this.template.extendedShapes){const t=this.template.config.store.getObjects(e,gn,null);if(t.length>0)return t[0]}}isValueValid(e){if(!this.template.extendedShapes.length)return!0;for(const t of this.template.extendedShapes){const r=this.template.config.store.getObjects(t,gn,null);for(const n of r)if(this.template.config.store.countQuads(e,qt,n,null)>0)return!0}return!1}createAddButton(){const e=new wt;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,e.classList.add("add-button");let t=[],r=this.getRdfClassToLinkOrCreate();if(r&&(t=Uc(r,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",n=>{e.blur();const s=this.addPropertyInstance();s.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{hg(s),s.classList.remove("fadeIn")},200)});else{const n=document.createElement("ul"),s=document.createElement("li");s.innerHTML="&#xFF0B; Create new "+this.template.label+"...",s.dataset.value="new",s.classList.add("large"),n.appendChild(s);const o=document.createElement("li");o.classList.add("divider"),n.appendChild(o);const a=document.createElement("li");a.classList.add("header"),a.innerText="Or link existing:",n.appendChild(a);for(const c of t){const l=document.createElement("li"),d=typeof c.value=="string"?c.value:c.value.value;l.innerText=c.label?c.label:d,l.dataset.value=JSON.stringify(c.value),n.appendChild(l)}e.appendChild(n),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const c=JSON.parse(e.value);this.container.insertBefore(yo(this.template,c,!0,!0),e)}e.value=""})}return e}}function yo(i,e,t=!1,r=!1){let n;if(i.extendedShapes.length){n=document.createElement("div"),n.classList.add("property-instance");for(const s of i.extendedShapes)n.appendChild(new _r(s,i.config,e,i.parent,i.nodeKind,i.label,r))}else{const s=Rg(i.path,i.datatype?.value);s?i.config.editMode&&!r?n=s.createEditor(i,e):n=s.createViewer(i,e):n=wg(i,e||null,i.config.editMode&&!r),n.classList.add("property-instance"),r&&n.classList.add("linked")}return i.config.editMode&&xp(n,i.label,t),n.dataset.path=i.path,n}function xp(i,e,t=!1){const r=new vn;r.classList.add("remove-button","clear"),r.title="Remove "+e,r.dense=!0,r.icon=!0,r.addEventListener("click",n=>{i.classList.remove("fadeIn"),i.classList.add("fadeOut"),setTimeout(()=>{const s=i.parentElement;i.remove(),s?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&r.classList.add("persistent"),i.appendChild(r)}window.customElements.define("shacl-property",Io);function Cb(i,e){let t=i;const r=e.store.getQuads(i,null,null,null),n=vs(r,"label",Fc,e.languages);n&&(t=n);let s;if(e.attributes.collapse!==null)s=new Ht,s.classList.add("collapsible"),s.open=e.attributes.collapse==="open",s.label=t;else{s=document.createElement("div");const a=document.createElement("h1");a.innerText=t,s.appendChild(a)}s.dataset.subject=i,s.classList.add("shacl-group");const o=vs(r,"order");return o&&(s.style.order=o),s}const Dt=[];for(let i=0;i<256;++i)Dt.push((i+256).toString(16).slice(1));function $b(i,e=0){return(Dt[i[e+0]]+Dt[i[e+1]]+Dt[i[e+2]]+Dt[i[e+3]]+"-"+Dt[i[e+4]]+Dt[i[e+5]]+"-"+Dt[i[e+6]]+Dt[i[e+7]]+"-"+Dt[i[e+8]]+Dt[i[e+9]]+"-"+Dt[i[e+10]]+Dt[i[e+11]]+Dt[i[e+12]]+Dt[i[e+13]]+Dt[i[e+14]]+Dt[i[e+15]]).toLowerCase()}let Oa;const Ab=new Uint8Array(16);function Nb(){if(!Oa){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Oa=crypto.getRandomValues.bind(crypto)}return Oa(Ab)}const Db=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ou={randomUUID:Db};function Pu(i,e,t){if(Ou.randomUUID&&!i)return Ou.randomUUID();i=i||{};const r=i.random??i.rng?.()??Nb();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,$b(r)}class _r extends HTMLElement{constructor(e,t,r,n,s,o,a){super(),this.owlImports=[],this.parent=n,this.config=t,this.shaclSubject=e,this.linked=a||!1;let c=r;if(!c){if(!s){const d=t.store.getObjects(e,`${Oe}nodeKind`,null);d.length&&(s=d[0])}s===void 0&&t.attributes.valuesNamespace||s?.value===`${Oe}IRI`?c=ze.namedNode(t.attributes.valuesNamespace+Pu()):c=ze.blankNode(Pu())}this.nodeId=c;const l=JSON.stringify([e,r]);if(r&&t.renderedNodes.has(l)){o=o||"Link";const d=document.createElement("label");d.innerText=o,d.classList.add("linked"),this.appendChild(d);const u=document.createElement("a");let m=r.termType==="BlankNode"?"_:"+r.value:r.value;u.innerText=m,u.classList.add("ref-link"),u.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${m}']`)?.scrollIntoView()},this.appendChild(u),this.style.flexDirection="row"}else{if(r&&t.renderedNodes.add(l),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const d=document.createElement("div");d.innerText=`id: ${this.nodeId.id}`,d.classList.add("node-id-display"),this.appendChild(d)}for(const d of t.store.getQuads(e,Bc,null,null))this.owlImports.push(d.object);for(const d of t.store.getQuads(e,null,null,null))switch(d.predicate.id){case So.id:this.addPropertyInstance(d.object,t,r);break;case`${Oe}and`:const u=t.lists[d.object.value];if(u?.length)for(const m of u)this.prepend(new _r(m,t,r,this));else console.error("list not found:",d.object.value,"existing lists:",t.lists);break;case lg.id:this.prepend(new _r(d.object,t,r,this));break;case`${Oe}targetClass`:this.targetClass=d.object;break;case`${Oe}or`:this.tryResolve(d.object,r,t);break;case`${Oe}xone`:this.tryResolve(d.object,r,t);break}if(o){const d=document.createElement("h1");d.innerText=o,this.prepend(d)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const r of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))r.toRDF(e,t);this.targetClass&&e.addQuad(t,qt,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,ze.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,r){let n=this;const s=t.store.getQuads(e,`${Oe}group`,null,null);if(s.length>0){const a=s[0].object.value;if(t.groups.indexOf(a)>-1){let c=this.querySelector(`:scope > .shacl-group[data-subject='${a}']`);c||(c=Cb(a,t),this.appendChild(c)),n=c}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const o=new Io(e,this,t,r);o.childElementCount>0&&n.appendChild(o)}tryResolve(e,t,r){const n=r.lists[e.value];if(n?.length){let s=!1;if(t){const o=mg(n,t,r);if(o.length){for(const a of o)this.addPropertyInstance(a,r,t);s=!0}}s||this.appendChild(np(n,this,r))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",r.lists)}}window.customElements.define("shacl-node",_r);var Lr={},Or={},Pr={},Xi={},Mu;function Lb(){if(Mu)return Xi;Mu=1,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.removeDotSegmentsOfPath=Xi.removeDotSegments=Xi.resolve=void 0;function i(n,s){s=s||"";const o=s.indexOf("#");if(o>0&&(s=s.substr(0,o)),!n.length){if(s.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${s}' for value '${n}'`);return s}if(n.startsWith("?")){const g=s.indexOf("?");return g>0&&(s=s.substr(0,g)),s+n}if(n.startsWith("#"))return s+n;if(!s.length){const g=n.indexOf(":");if(g<0)throw new Error(`Found invalid relative IRI '${n}' for a missing baseIRI`);return t(n,g)}const a=n.indexOf(":");if(a>=0)return t(n,a);const c=s.indexOf(":");if(c<0)throw new Error(`Found invalid baseIRI '${s}' for value '${n}'`);const l=s.substr(0,c+1);if(n.indexOf("//")===0)return l+t(n,a);let d;if(s.indexOf("//",c)===c+1){if(d=s.indexOf("/",c+3),d<0)return s.length>c+3?s+"/"+t(n,a):l+t(n,a)}else if(d=s.indexOf("/",c+1),d<0)return l+t(n,a);if(n.indexOf("/")===0)return s.substr(0,d)+e(n);let u=s.substr(d);const m=u.lastIndexOf("/");return m>=0&&m<u.length-1&&(u=u.substr(0,m+1),n[0]==="."&&n[1]!=="."&&n[1]!=="/"&&n[2]&&(n=n.substr(1))),n=u+n,n=e(n),s.substr(0,d)+n}Xi.resolve=i;function e(n){const s=[];let o=0;for(;o<n.length;)switch(n[o]){case"/":if(n[o+1]===".")if(n[o+2]==="."){if(!r(n[o+3])){s.push([]),o++;break}s.pop(),n[o+3]||s.push([]),o+=3}else{if(!r(n[o+2])){s.push([]),o++;break}n[o+2]||s.push([]),o+=2}else s.push([]),o++;break;case"#":case"?":s.length||s.push([]),s[s.length-1].push(n.substr(o)),o=n.length;break;default:s.length||s.push([]),s[s.length-1].push(n[o]),o++;break}return"/"+s.map(a=>a.join("")).join("/")}Xi.removeDotSegments=e;function t(n,s){let o=s+1;s>=0?n[s+1]==="/"&&n[s+2]==="/"&&(o=s+3):n[0]==="/"&&n[1]==="/"&&(o=2);const a=n.indexOf("/",o);if(a<0)return n;const c=n.substr(0,a),l=n.substr(a);return c+e(l)}Xi.removeDotSegmentsOfPath=t;function r(n){return!n||n==="#"||n==="?"||n==="/"}return Xi}var Fu;function Ob(){return Fu||(Fu=1,function(i){var e=Pr&&Pr.__createBinding||(Object.create?function(r,n,s,o){o===void 0&&(o=s),Object.defineProperty(r,o,{enumerable:!0,get:function(){return n[s]}})}:function(r,n,s,o){o===void 0&&(o=s),r[o]=n[s]}),t=Pr&&Pr.__exportStar||function(r,n){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(n,s)&&e(n,r,s)};Object.defineProperty(i,"__esModule",{value:!0}),t(Lb(),i)}(Pr)),Pr}var Mr={},Pa={},ju;function Pb(){return ju||(ju=1,function(i){/**
302
+ `];Us([je({type:Boolean,reflect:!0})],Kr.prototype,"open",2);Us([je({type:Boolean})],Kr.prototype,"closable",2);Us([je()],Kr.prototype,"title",2);Us([Ei("#dialog")],Kr.prototype,"dialogElement",2);Kr=Us([kr("rokit-dialog")],Kr);class Io extends HTMLElement{constructor(e,t,r,n){if(super(),this.template=new bg(r.store.getQuads(e,null,null,null),t,r),this.container=this,this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const s=new Ht;s.classList.add("collapsible","shacl-group"),s.open=r.attributes.collapse==="open",s.label=this.template.label,this.container=s}if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),r.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let s=[];n&&(t.linked?s=r.store.getQuads(n,this.template.path,null,null):s=r.store.getQuads(n,this.template.path,null,Ji));let o=!1;for(const a of s)this.isValueValid(a.object)&&(this.addPropertyInstance(a.object),this.template.hasValue&&a.object.equals(this.template.hasValue)&&(o=!0));r.editMode&&this.template.hasValue&&!o&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}r.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof Ht&&(r.editMode&&!t.linked||this.container.childElementCount>0)&&this.appendChild(this.container)}addPropertyInstance(e){let t;if(this.template.shaclOr?.length||this.template.shaclXone?.length){const r=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let n=!1;if(e){const s=pg(r,e,this.template.config);s.length&&(t=yo(this.template.clone().merge(s),e,!0),n=!0)}n||(t=np(r,this,this.template.config),xp(t,""))}else{let r=!1;if(e&&!(e instanceof yi)){const n=this.getRdfClassToLinkOrCreate();n&&this.template.config.store.countQuads(e,qt,n,Ji)===0&&(r=!0)}t=yo(this.template,e,void 0,r||this.template.parent.linked)}return this.addButton?this.container.insertBefore(t,this.addButton):this.container.appendChild(t),t}updateControls(){let e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;e===0&&(!this.template.extendedShapes.length||this.template.minCount!==void 0&&this.template.minCount>0)&&(this.addPropertyInstance(),e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length);let t;this.template.minCount!==void 0?t=e>this.template.minCount:t=this.template.extendedShapes.length>0||e>1;const r=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",r)}toRDF(e,t){for(const r of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const n=ze.namedNode(r.dataset.path);if(r.firstChild instanceof _r){const s=r.firstChild.toRDF(e);e.addQuad(t,n,s,this.template.config.valuesGraphId)}else for(const s of r.querySelectorAll(":scope > .editor")){const o=Eg(s);o&&e.addQuad(t,n,o,this.template.config.valuesGraphId)}}}getRdfClassToLinkOrCreate(){if(this.template.class&&this.template.node)return this.template.class;for(const e of this.template.extendedShapes){const t=this.template.config.store.getObjects(e,gn,null);if(t.length>0)return t[0]}}isValueValid(e){if(!this.template.extendedShapes.length)return!0;for(const t of this.template.extendedShapes){const r=this.template.config.store.getObjects(t,gn,null);for(const n of r)if(this.template.config.store.countQuads(e,qt,n,null)>0)return!0}return!1}createAddButton(){const e=new wt;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,e.classList.add("add-button");let t=[],r=this.getRdfClassToLinkOrCreate();if(r&&(t=Uc(r,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",n=>{e.blur();const s=this.addPropertyInstance();s.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{hg(s),s.classList.remove("fadeIn")},200)});else{const n=document.createElement("ul"),s=document.createElement("li");s.innerHTML="&#xFF0B; Create new "+this.template.label+"...",s.dataset.value="new",s.classList.add("large"),n.appendChild(s);const o=document.createElement("li");o.classList.add("divider"),n.appendChild(o);const a=document.createElement("li");a.classList.add("header"),a.innerText="Or link existing:",n.appendChild(a);for(const c of t){const l=document.createElement("li"),d=typeof c.value=="string"?c.value:c.value.value;l.innerText=c.label?c.label:d,l.dataset.value=JSON.stringify(c.value),n.appendChild(l)}e.appendChild(n),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const c=JSON.parse(e.value);this.container.insertBefore(yo(this.template,c,!0,!0),e)}e.value=""})}return e}}function yo(i,e,t=!1,r=!1){let n;if(i.extendedShapes.length){n=document.createElement("div"),n.classList.add("property-instance");for(const s of i.extendedShapes)n.appendChild(new _r(s,i.config,e,i.parent,i.nodeKind,i.label,r))}else{const s=Rg(i.path,i.datatype?.value);s?i.config.editMode&&!r?n=s.createEditor(i,e):n=s.createViewer(i,e):n=wg(i,e||null,i.config.editMode&&!r),n.classList.add("property-instance"),r&&n.classList.add("linked")}return i.config.editMode&&xp(n,i.label,t),n.dataset.path=i.path,n}function xp(i,e,t=!1){const r=new vn;r.classList.add("remove-button","clear"),r.title="Remove "+e,r.dense=!0,r.icon=!0,r.addEventListener("click",n=>{i.classList.remove("fadeIn"),i.classList.add("fadeOut"),setTimeout(()=>{const s=i.parentElement;i.remove(),s?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&r.classList.add("persistent"),i.appendChild(r)}window.customElements.define("shacl-property",Io);function Cb(i,e){let t=i;const r=e.store.getQuads(i,null,null,null),n=vs(r,"label",Fc,e.languages);n&&(t=n);let s;if(e.attributes.collapse!==null)s=new Ht,s.classList.add("collapsible"),s.open=e.attributes.collapse==="open",s.label=t;else{s=document.createElement("div");const a=document.createElement("h1");a.innerText=t,s.appendChild(a)}s.dataset.subject=i,s.classList.add("shacl-group");const o=vs(r,"order");return o&&(s.style.order=o),s}const Dt=[];for(let i=0;i<256;++i)Dt.push((i+256).toString(16).slice(1));function $b(i,e=0){return(Dt[i[e+0]]+Dt[i[e+1]]+Dt[i[e+2]]+Dt[i[e+3]]+"-"+Dt[i[e+4]]+Dt[i[e+5]]+"-"+Dt[i[e+6]]+Dt[i[e+7]]+"-"+Dt[i[e+8]]+Dt[i[e+9]]+"-"+Dt[i[e+10]]+Dt[i[e+11]]+Dt[i[e+12]]+Dt[i[e+13]]+Dt[i[e+14]]+Dt[i[e+15]]).toLowerCase()}let Oa;const Ab=new Uint8Array(16);function Nb(){if(!Oa){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Oa=crypto.getRandomValues.bind(crypto)}return Oa(Ab)}const Db=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ou={randomUUID:Db};function Pu(i,e,t){if(Ou.randomUUID&&!i)return Ou.randomUUID();i=i||{};const r=i.random??i.rng?.()??Nb();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,$b(r)}class _r extends HTMLElement{constructor(e,t,r,n,s,o,a){super(),this.owlImports=[],this.parent=n,this.config=t,this.shaclSubject=e,this.linked=a||!1;let c=r;if(!c){if(!s){const d=t.store.getObjects(e,`${Oe}nodeKind`,null);d.length&&(s=d[0])}s===void 0&&t.attributes.valuesNamespace||s?.value===`${Oe}IRI`?c=ze.namedNode(t.attributes.valuesNamespace+Pu()):c=ze.blankNode(Pu())}this.nodeId=c;const l=JSON.stringify([e,r]);if(r&&t.renderedNodes.has(l)){o=o||"Link";const d=document.createElement("label");d.innerText=o,d.classList.add("linked"),this.appendChild(d);const u=document.createElement("a");let m=r.termType==="BlankNode"?"_:"+r.value:r.value;u.innerText=m,u.classList.add("ref-link"),u.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${m}']`)?.scrollIntoView()},this.appendChild(u),this.style.flexDirection="row"}else{if(r&&t.renderedNodes.add(l),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const d=document.createElement("div");d.innerText=`id: ${this.nodeId.id}`,d.classList.add("node-id-display"),this.appendChild(d)}for(const d of t.store.getQuads(e,Bc,null,null))this.owlImports.push(d.object);for(const d of t.store.getQuads(e,null,null,null))switch(d.predicate.id){case So.id:this.addPropertyInstance(d.object,t,r);break;case`${Oe}and`:const u=t.lists[d.object.value];if(u?.length)for(const m of u)this.prepend(new _r(m,t,r,this));else console.error("list not found:",d.object.value,"existing lists:",t.lists);break;case lg.id:this.prepend(new _r(d.object,t,r,this));break;case`${Oe}targetClass`:this.targetClass=d.object;break;case`${Oe}or`:this.tryResolve(d.object,r,t);break;case`${Oe}xone`:this.tryResolve(d.object,r,t);break}if(o){const d=document.createElement("h1");d.innerText=o,this.prepend(d)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const r of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))r.toRDF(e,t);this.targetClass&&e.addQuad(t,qt,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,ze.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,r){let n=this;const s=t.store.getQuads(e,`${Oe}group`,null,null);if(s.length>0){const a=s[0].object.value;if(t.groups.indexOf(a)>-1){let c=this.querySelector(`:scope > .shacl-group[data-subject='${a}']`);c||(c=Cb(a,t),this.appendChild(c)),n=c}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const o=new Io(e,this,t,r);o.childElementCount>0&&n.appendChild(o)}tryResolve(e,t,r){const n=r.lists[e.value];if(n?.length){let s=!1;if(t){const o=mg(n,t,r);if(o.length){for(const a of o)this.addPropertyInstance(a,r,t);s=!0}}s||this.appendChild(np(n,this,r))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",r.lists)}}window.customElements.define("shacl-node",_r);var Lr={},Or={},Pr={},Xi={},Mu;function Lb(){if(Mu)return Xi;Mu=1,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.removeDotSegmentsOfPath=Xi.removeDotSegments=Xi.resolve=void 0;function i(n,s){s=s||"";const o=s.indexOf("#");if(o>0&&(s=s.substr(0,o)),!n.length){if(s.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${s}' for value '${n}'`);return s}if(n.startsWith("?")){const g=s.indexOf("?");return g>0&&(s=s.substr(0,g)),s+n}if(n.startsWith("#"))return s+n;if(!s.length){const g=n.indexOf(":");if(g<0)throw new Error(`Found invalid relative IRI '${n}' for a missing baseIRI`);return t(n,g)}const a=n.indexOf(":");if(a>=0)return t(n,a);const c=s.indexOf(":");if(c<0)throw new Error(`Found invalid baseIRI '${s}' for value '${n}'`);const l=s.substr(0,c+1);if(n.indexOf("//")===0)return l+t(n,a);let d;if(s.indexOf("//",c)===c+1){if(d=s.indexOf("/",c+3),d<0)return s.length>c+3?s+"/"+t(n,a):l+t(n,a)}else if(d=s.indexOf("/",c+1),d<0)return l+t(n,a);if(n.indexOf("/")===0)return s.substr(0,d)+e(n);let u=s.substr(d);const m=u.lastIndexOf("/");return m>=0&&m<u.length-1&&(u=u.substr(0,m+1),n[0]==="."&&n[1]!=="."&&n[1]!=="/"&&n[2]&&(n=n.substr(1))),n=u+n,n=e(n),s.substr(0,d)+n}Xi.resolve=i;function e(n){const s=[];let o=0;for(;o<n.length;)switch(n[o]){case"/":if(n[o+1]===".")if(n[o+2]==="."){if(!r(n[o+3])){s.push([]),o++;break}s.pop(),n[o+3]||s.push([]),o+=3}else{if(!r(n[o+2])){s.push([]),o++;break}n[o+2]||s.push([]),o+=2}else s.push([]),o++;break;case"#":case"?":s.length||s.push([]),s[s.length-1].push(n.substr(o)),o=n.length;break;default:s.length||s.push([]),s[s.length-1].push(n[o]),o++;break}return"/"+s.map(a=>a.join("")).join("/")}Xi.removeDotSegments=e;function t(n,s){let o=s+1;s>=0?n[s+1]==="/"&&n[s+2]==="/"&&(o=s+3):n[0]==="/"&&n[1]==="/"&&(o=2);const a=n.indexOf("/",o);if(a<0)return n;const c=n.substr(0,a),l=n.substr(a);return c+e(l)}Xi.removeDotSegmentsOfPath=t;function r(n){return!n||n==="#"||n==="?"||n==="/"}return Xi}var Fu;function Ob(){return Fu||(Fu=1,function(i){var e=Pr&&Pr.__createBinding||(Object.create?function(r,n,s,o){o===void 0&&(o=s),Object.defineProperty(r,o,{enumerable:!0,get:function(){return n[s]}})}:function(r,n,s,o){o===void 0&&(o=s),r[o]=n[s]}),t=Pr&&Pr.__exportStar||function(r,n){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(n,s)&&e(n,r,s)};Object.defineProperty(i,"__esModule",{value:!0}),t(Lb(),i)}(Pr)),Pr}var Mr={},Pa={},ju;function Pb(){return ju||(ju=1,function(i){/**
303
303
  * Character classes and associated utilities for the 5th edition of XML 1.0.
304
304
  *
305
305
  * @author Louis-Dominique Dubeau
@@ -388,7 +388,7 @@ if("@preserve"in h)return h["@preserve"][0];if(e.isValue(h))return h;if(e.isList
388
388
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
389
389
  */var El,jh;function my(){if(jh)return El;jh=1;const i=id(),e=ty(),t=vi(),r=sy(),n=t.IdentifierIssuer,s=Si(),o=Lp(),a=oy(),{expand:c}=ay(),{flatten:l}=ly(),{fromRDF:d}=cy(),{toRDF:u}=uy(),{frameMergedOrDefault:m,cleanupNull:g}=hy(),{isArray:v,isObject:_,isString:E}=mi(),{isSubjectReference:x}=cr(),{expandIri:k,getInitialContext:y,process:h,processingMode:p}=Xr(),{compact:T,compactIri:N}=fy(),{createNodeMap:C,createMergedNodeMap:F,mergeNodeMaps:I}=Xo(),{logEventHandler:O,logWarningEventHandler:U,safeEventHandler:R,setDefaultEventHandler:D,setupEventHandler:J,strictEventHandler:$,unhandledEventHandler:Z}=Vs(),B=function(S){const H={},Q=new o({max:100});S.compact=async function(W,G,X){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(W===null)return null;X=he(X,{base:E(W)?W:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new n("_:b"),contextResolver:new r({sharedCache:Q})}),X.link&&(X.skipExpansion=!0),X.compactToRelative||delete X.base;let z;X.skipExpansion?z=W:z=await S.expand(W,X);const ne=await S.processContext(y(X),G,X);let se=await T({activeCtx:ne,element:z,options:X});X.compactArrays&&!X.graph&&v(se)?se.length===1?se=se[0]:se.length===0&&(se={}):X.graph&&_(se)&&(se=[se]),_(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),v(G)||(G=[G]);const ye=G;G=[];for(let M=0;M<ye.length;++M)(!_(ye[M])||Object.keys(ye[M]).length>0)&&G.push(ye[M]);const _e=G.length>0;if(G.length===1&&(G=G[0]),v(se)){const M=N({activeCtx:ne,iri:"@graph",relativeTo:{vocab:!0}}),K=se;se={},_e&&(se["@context"]=G),se[M]=K}else if(_(se)&&_e){const M=se;se={"@context":G};for(const K in M)se[K]=M[K]}return se},S.expand=async function(W,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=he(G,{keepFreeFloatingNodes:!1,contextResolver:new r({sharedCache:Q})});const X={},z=[];if("expandContext"in G){const _e=t.clone(G.expandContext);_(_e)&&"@context"in _e?X.expandContext=_e:X.expandContext={"@context":_e},z.push(X.expandContext)}let ne;if(!E(W))X.input=t.clone(W);else{const _e=await S.get(W,G);ne=_e.documentUrl,X.input=_e.document,_e.contextUrl&&(X.remoteContext={"@context":_e.contextUrl},z.push(X.remoteContext))}"base"in G||(G.base=ne||"");let se=y(G);for(const _e of z)se=await h({activeCtx:se,localCtx:_e,options:G});let ye=await c({activeCtx:se,element:X.input,options:G});return _(ye)&&"@graph"in ye&&Object.keys(ye).length===1?ye=ye["@graph"]:ye===null&&(ye=[]),v(ye)||(ye=[ye]),ye},S.flatten=async function(W,G,X){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,X=he(X,{base:E(W)?W:"",contextResolver:new r({sharedCache:Q})});const z=await S.expand(W,X),ne=l(z);return G===null?ne:(X.graph=!0,X.skipExpansion=!0,await S.compact(ne,G,X))},S.frame=async function(W,G,X){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(X=he(X,{base:E(W)?W:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new r({sharedCache:Q})}),E(G)){const be=await S.get(G,X);if(G=be.document,be.contextUrl){let ve=G["@context"];ve?v(ve)?ve.push(be.contextUrl):ve=[ve,be.contextUrl]:ve=be.contextUrl,G["@context"]=ve}}const z=G?G["@context"]||{}:{},ne=await S.processContext(y(X),z,X);X.hasOwnProperty("omitGraph")||(X.omitGraph=p(ne,1.1)),X.hasOwnProperty("pruneBlankNodeIdentifiers")||(X.pruneBlankNodeIdentifiers=p(ne,1.1));const se=await S.expand(W,X),ye={...X};ye.isFrame=!0,ye.keepFreeFloatingNodes=!0;const _e=await S.expand(G,ye),M=Object.keys(G).map(be=>k(ne,be,{vocab:!0}));ye.merged=!M.includes("@graph"),ye.is11=p(ne,1.1);const K=m(se,_e,ye);ye.graph=!X.omitGraph,ye.skipExpansion=!0,ye.link={},ye.framing=!0;let ce=await S.compact(K,z,ye);return ye.link={},ce=g(ce,ye),ce},S.link=async function(W,G,X){const z={};return G&&(z["@context"]=G),z["@embed"]="@link",S.frame(W,z,X)},S.normalize=S.canonize=async function(W,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=he(G,{base:E(W)?W:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new r({sharedCache:Q})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const ne=a.parse(W);return i.canonize(ne,G)}const X={...G};delete X.format,X.produceGeneralizedRdf=!1;const z=await S.toRDF(W,X);return i.canonize(z,G)},S.fromRDF=async function(W,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=he(G,{format:E(W)?"application/n-quads":void 0});const{format:X}=G;let{rdfParser:z}=G;if(X){if(z=z||H[X],!z)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:X})}else z=()=>W;const ne=await z(W);return d(ne,G)},S.toRDF=async function(W,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=he(G,{base:E(W)?W:"",skipExpansion:!1,contextResolver:new r({sharedCache:Q})});let X;G.skipExpansion?X=W:X=await S.expand(W,G);const z=u(X,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return a.serialize(z);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return z},S.createNodeMap=async function(W,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=he(G,{base:E(W)?W:"",contextResolver:new r({sharedCache:Q})});const X=await S.expand(W,G);return F(X,G)},S.merge=async function(W,G,X){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!v(W))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,X=he(X,{contextResolver:new r({sharedCache:Q})});const z=await Promise.all(W.map(be=>{const ve={...X};return S.expand(be,ve)}));let ne=!0;"mergeNodes"in X&&(ne=X.mergeNodes);const se=X.issuer||new n("_:b"),ye={"@default":{}};for(let be=0;be<z.length;++be){const ve=t.relabelBlankNodes(z[be],{issuer:new n("_:b"+be+"-")}),xe=ne||be===0?ye:{"@default":{}};if(C(ve,xe,"@default",se),xe!==ye)for(const ie in xe){const me=xe[ie];if(!(ie in ye)){ye[ie]=me;continue}const Ee=ye[ie];for(const fe in me)fe in Ee||(Ee[fe]=me[fe])}}const _e=I(ye),M=[],K=Object.keys(_e).sort();for(let be=0;be<K.length;++be){const ve=_e[K[be]];x(ve)||M.push(ve)}return G===null?M:(X.graph=!0,X.skipExpansion=!0,await S.compact(M,G,X))},Object.defineProperty(S,"documentLoader",{get:()=>S._documentLoader,set:W=>S._documentLoader=W}),S.documentLoader=async W=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:W})},S.get=async function(W,G){let X;typeof G.documentLoader=="function"?X=G.documentLoader:X=S.documentLoader;const z=await X(W);try{if(!z.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");E(z.document)&&(z.document=JSON.parse(z.document))}catch(ne){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ne,remoteDoc:z})}return z},S.processContext=async function(W,G,X){return X=he(X,{base:"",contextResolver:new r({sharedCache:Q})}),G===null?y(X):(G=t.clone(G),_(G)&&"@context"in G||(G={"@context":G}),h({activeCtx:W,localCtx:G,options:X}))},S.getContextValue=Xr().getContextValue,S.documentLoaders={},S.useDocumentLoader=function(W){if(!(W in S.documentLoaders))throw new s('Unknown document loader type: "'+W+'"',"jsonld.UnknownDocumentLoader",{type:W});S.documentLoader=S.documentLoaders[W].apply(S,Array.prototype.slice.call(arguments,1))},S.registerRDFParser=function(W,G){H[W]=G},S.unregisterRDFParser=function(W){delete H[W]},S.registerRDFParser("application/n-quads",a.parse),S.registerRDFParser("application/nquads",a.parse),S.url=Ir(),S.logEventHandler=O,S.logWarningEventHandler=U,S.safeEventHandler=R,S.setDefaultEventHandler=D,S.strictEventHandler=$,S.unhandledEventHandler=Z,S.util=t,Object.assign(S,t),S.promises=S,S.RequestQueue=Dp(),S.JsonLdProcessor=py()(S),e.setupGlobals(S),e.setupDocumentLoaders(S);function he(W,{documentLoader:G=S.documentLoader,...X}){if(W&&"compactionMap"in W)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(W&&"expansionMap"in W)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},X,W,{eventHandler:J({options:W})})}return S},re=function(){return B(function(){return re()})};return B(re),El=re,El}var gy=my();const Sl={},kl={};class by{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[],this.config.prefixes={};const e=[],t=new jt;if(e.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",t,ys)),e.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,Ji)),await Promise.all(e),t.countQuads(null,null,null,ys)===0&&this.config.attributes.valuesSubject){const r=[...t.getObjects(this.config.attributes.valuesSubject,ec,Ji)],n=[];for(const s of r){const o=this.toURL(s.value);o&&this.loadedExternalUrls.indexOf(o)<0&&(this.loadedExternalUrls.push(o),n.push(this.importRDF(this.fetchRDF(o),t,ys)))}try{await Promise.allSettled(n)}catch(s){console.warn(s)}}this.config.store=t}async importRDF(e,t,r){const n=async s=>{const o=[];await new Promise((a,c)=>{const l=Bh(s)==="xml"?new Wb.RdfXmlParser:new eg;l.on("data",d=>{if(t.add(new jo(d.subject,d.predicate,d.object,r)),this.config.attributes.ignoreOwlImports===null&&Bc.equals(d.predicate)){const u=this.toURL(d.object.value);u&&this.loadedExternalUrls.indexOf(u)<0&&(this.loadedExternalUrls.push(u),o.push(this.importRDF(this.fetchRDF(u),t,ze.namedNode(u))))}if(this.config.classInstanceProvider&&(qc.equals(d.predicate)||gn.equals(d.predicate))){const u=d.object.value;if(this.loadedClasses.indexOf(u)<0){let m;u in kl?m=kl[u]:(m=this.config.classInstanceProvider(u),kl[u]=m),this.loadedClasses.push(u),o.push(this.importRDF(m,t,r))}}}).on("error",d=>{console.warn("failed parsing graph",r,d.message),c(d)}).on("prefix",(d,u)=>{d&&(this.config.prefixes[d]=u)}).on("end",()=>{a(null)}),l.write(s),l.end()});try{await Promise.allSettled(o)}catch(a){console.warn(a)}};if(e instanceof Promise&&(e=await e),e){if(Bh(e)==="json")try{e=await gy.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(s){console.error(s)}await n(e)}}toURL(e){if(ic(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const r=this.config.prefixes[t[0]];if(r&&(e=e.replace(`${t[0]}:`,r),ic(e)))return e}}return null}async fetchRDF(e){if(e in Sl)return Sl[e];let t=e;this.config.attributes.proxy&&(t=this.config.attributes.proxy+encodeURIComponent(e));const r=fetch(t,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(n=>n.text());return Sl[e]=r,r}}function Bh(i){return/^\s*\{/.test(i)?"json":/^\s*<\?xml/.test(i)?"xml":"ttl"}class Rl{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class qh{constructor(e,t){this.attributes=new Rl,this.loader=new by(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new jt,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(r=>r.length>2?[r.toLocaleLowerCase(),r.substring(0,2)]:r)),""]}updateAttributes(e){const t=new Rl;if(Object.keys(t).forEach(r=>{const n=e.dataset[r];n!==void 0&&(t[r]=n)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const r=this.languages.indexOf(t.language);r>-1&&this.languages.splice(r,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=ze.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Rl;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,r=>"-"+r.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=fg(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},qt,`${Oe}PropertyGroup`,null)}}function yy(i){return"_:"+i.value}function vy(i,e){return[...i].map(t=>e(t)).join(`
390
390
  `)+`
391
- `}function wy(){return""}function Op(i){return"<"+i.value+">"}const _y=/["\\\\\n\r]/,xy=/["\\\\\n\r]/g,Ey={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Sy(i){return Ey[i]}function ky(i){return _y.test(i)?i.replace(xy,Sy):i}function Ry(i){const e=ky(i.value);return i.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':i.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+i.language:'"'+e+'"^^'+Op(i.datatype)}function Iy(i,e){const t=e(i.subject),r=e(i.predicate),n=e(i.object),s=e(i.graph);return`${t} ${r} ${n} ${s?s+" ":""}.`}function Ty(i){return"?"+i.value}function di(i){if(!i)return null;if(i.termType==="BlankNode")return yy(i);if(i.termType==="DefaultGraph")return wy();if(i.termType==="Literal")return Ry(i);if(i.termType==="NamedNode")return Op(i);if(i.termType==="Quad"||i.subject&&i.predicate&&i.object&&i.graph)return Iy(i,di);if(i.termType==="Variable")return Ty(i);if(i[Symbol.iterator])return vy(i,di);throw new Error(`unknown termType ${i.termType}`)}class Dn{constructor(e){if(this.index=new Map,e)for(const[t,r]of e)this.set(t,r)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(di(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const r of this.entries())e.call(t,r[1],r[0],this)}get(e){const t=this.index.get(di(e));return t&&t.value}has(e){return this.index.has(di(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const r=di(e);return this.index.set(r,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class Uh{constructor({dataset:e,end:t,quad:r,start:n}){this.dataset=e,this.end=t,this.quad=r,this.start=n}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function Vh(i){try{return di(i)}catch{return null}}class wi{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=di(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(Vh(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(Vh(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Pp{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Pp.prototype.termType="BlankNode";class nd{equals(e){return!!e&&e.termType===this.termType}}nd.prototype.termType="DefaultGraph";nd.prototype.value="";function zh(i,e){if(!e)return null;if(e.termType==="BlankNode")return i.blankNode(e.value);if(e.termType==="DefaultGraph")return i.defaultGraph();if(e.termType==="Literal")return i.literal(e.value,e.language||i.namedNode(e.datatype.value));if(e.termType==="NamedNode")return i.namedNode(e.value);if(e.termType==="Quad"){const t=i.fromTerm(e.subject),r=i.fromTerm(e.predicate),n=i.fromTerm(e.object),s=i.fromTerm(e.graph);return i.quad(t,r,n,s)}if(e.termType==="Variable")return i.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class wo{constructor(e,t,r,n=""){this.value=e,this.language=t,this.datatype=r,this.direction=n}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)&&(e.direction||"")===this.direction}}wo.prototype.termType="Literal";class zs{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}zs.prototype.termType="NamedNode";class sd{constructor(e,t,r,n){this.subject=e,this.predicate=t,this.object=r,this.graph=n}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}sd.prototype.termType="Quad";sd.prototype.value="";class Mp{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Mp.prototype.termType="Variable";const Cy=new zs("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),Hh=new zs("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),$y=new zs("http://www.w3.org/2001/XMLSchema#string");class Fp{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new nd}}namedNode(e){return new zs(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Pp(e)}literal(e,t){return typeof t=="string"?new wo(e,t,Hh):typeof t?.language=="string"?new wo(e,t.language,t.direction?Cy:Hh,t.direction):new wo(e,"",t||$y)}variable(e){return new Mp(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,r,n=this.defaultGraph()){return new sd(e,t,r,n)}fromTerm(e){return zh(this,e)}fromQuad(e){return zh(this,e)}}Fp.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const od=new Fp,Ay={apply:(i,e,t)=>i(t[0]),get:(i,e)=>i(e)};function ki(i,{factory:e=od}={}){const t=(r="")=>e.namedNode(`${i}${r.raw||r}`);return typeof Proxy>"u"?t:new Proxy(t,Ay)}ki("http://www.w3.org/2001/XMLSchema#");const Pi=ki("http://www.w3.org/1999/02/22-rdf-syntax-ns#");ki("http://www.w3.org/2000/01/rdf-schema#");class rt{static add({ptr:e,start:t,end:r,subjects:n=[null],predicates:s=[null],objects:o=[null],graphs:a,callback:c}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};c&&(l=d=>{c(new Uh({dataset:e.dataset,start:t,end:r,quad:d}))});for(const d of n)for(const u of s)for(const m of o)for(const g of a){const v={subject:d,predicate:u,object:m,graph:g};v[t]=e.term;const _=e.factory.quad(v.subject,v.predicate,v.object,v.graph);e.dataset.add(_),l(_)}return e}static addList({ptr:e,predicates:t,items:r,graphs:n}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const s of t)for(const o of n){const a=r.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,a[0]||Pi.nil,o));for(let c=0;c<a.length;c++)e.dataset.add(e.factory.quad(a[c],Pi.first,r[c],o)),e.dataset.add(e.factory.quad(a[c],Pi.rest,a[c+1]||Pi.nil,o))}return e}static delete({ptr:e,start:t,subjects:r=[null],predicates:n=[null],objects:s=[null]}){for(const o of r)for(const a of n)for(const c of s){const l={subject:o,predicate:a,object:c};l[t]=e.term;const d=e.dataset.match(l.subject,l.predicate,l.object);for(const u of d)e.dataset.delete(u)}return e}static deleteList({ptr:e,predicates:t}){const r=[];for(const n of t)for(const s of e.dataset.match(e.term,n)){let o=s.object;for(r.push(s);!Pi.nil.equals(o);){o=r[r.length-1].object;const a=e.dataset.match(o);if(a.size===0)break;for(const c of a)r.push(c)}}for(const n of r)e.dataset.delete(n);return e}static execute({ptr:e,operation:t="traverse",quantifier:r,start:n,end:s,subjects:o,predicates:a,objects:c,graphs:l,items:d,callback:u}={}){if(t==="add")return rt.add({ptr:e,start:n,end:s,subjects:o,predicates:a,objects:c,graphs:l,callback:u});if(t==="addList")return rt.addList({ptr:e,predicates:a,items:d,graphs:l});if(t==="delete")return rt.delete({ptr:e,start:n,subjects:o,predicates:a,objects:c});if(t==="deleteList")return rt.deleteList({ptr:e,predicates:a});if(t==="isList")return rt.isList({ptr:e});if(t==="list")return rt.list({ptr:e});if(t==="traverse")return rt.traverse({ptr:e,quantifier:r,start:n,end:s,subjects:o,predicates:a,objects:c,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(Pi.nil.equals(e.term)||rt.traverse({ptr:e,predicates:[Pi.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(Pi.nil);){const t=e.out([Pi.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const r=e.out([Pi.rest]);if(r.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=r[0]}}}}static traverse({ptr:e,quantifier:t="one",start:r="subject",end:n="object",subjects:s=[null],predicates:o=[null],objects:a=[null],graphs:c=[null],callback:l}){if(t==="one")return rt.traverseOne({ptr:e,start:r,end:n,subjects:s,predicates:o,objects:a,graphs:c,callback:l});if(t==="oneOrMore"){const d=rt.traverse({ptr:e,end:n,start:r,subjects:s,predicates:o,objects:a,graphs:c,callback:l});return rt.traverseMore({ptrs:d,end:n,start:r,subjects:s,predicates:o,objects:a,graphs:c,callback:l})}if(t==="zeroOrMore")return rt.traverseMore({ptrs:[e],end:n,start:r,subjects:s,predicates:o,objects:a,graphs:c,callback:l});if(t==="zeroOrOne")return[e,...rt.traverse({ptr:e,end:n,start:r,subjects:s,predicates:o,objects:a,graphs:c,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:r,subjects:n,predicates:s,objects:o,graphs:a,callback:c}={}){let l=[...e],d,u;do{d=[];for(const m of e)d=[...d,...rt.traverseOne({ptr:m,end:t,start:r,subjects:n,predicates:s,objects:o,graphs:a,callback:c})];u&&(d=d.filter(m=>!u.has(m.term))),e=d,l=[...l,...d],u=new wi(l.map(m=>m.term))}while(d.length>0);return l}static traverseOne({ptr:e,start:t,end:r,subjects:n,predicates:s,objects:o,graphs:a,callback:c=(l,d)=>d.extend(l)}={}){const l=[];for(const d of n)for(const u of s)for(const m of o)for(const g of a){const v={subject:d,predicate:u,object:m,graph:g};v[t]=e.term;for(const _ of e.dataset.match(v.subject,v.predicate,v.object,v.graph))l.push(c(new Uh({dataset:e.dataset,end:r,quad:_,start:t}),e))}return l}}function Wh(i,e){return e?t=>e(i.extend(t)):()=>{}}class Gh{constructor({dataset:e,edges:t=[],factory:r,graph:n,term:s}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof s>"u")throw new Error("edges or term must be given");if(t.length>0&&s)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=r,this._graph=n,t.length===0&&(this._term=s)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,r){return rt.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:Wh(this,r)})}addList(e,t){return rt.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,r){return rt.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:Wh(this,r)})}deleteIn(e,t){return rt.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return rt.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return rt.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:r,end:n,subjects:s,predicates:o,objects:a,graphs:c,items:l,callback:d}){return rt.execute({ptr:this,operation:e,quantifier:t,start:r,end:n,subjects:s,predicates:o,objects:a,graphs:c,items:l,callback:d})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return rt.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return rt.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return rt.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return rt.isList({ptr:this})}list(){return rt.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,t){return rt.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function Kh(i,e){return i?i.equals(e):i===e}function Ny(i,e){return!(i.dataset!==e.dataset||!Kh(i.graph,e.graph)||!Kh(i.term,e.term))}function Xh(i,e){return e?t=>e(new i.constructor({factory:i.factory,ptrs:[t]})):()=>{}}class To{constructor({dataset:e,factory:t,ptrs:r,terms:n,graphs:s}){if(this.factory=t,r)this.ptrs=[...r];else{this.ptrs=[];for(const o of n||[null])for(const a of s||[null])this.ptrs.push(new Gh({dataset:e,factory:t,graph:a,term:o}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new wi(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,r){const n=Xh(this,r);for(const s of this.ptrs)s.addIn(e,t,n);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const r of this.ptrs)r.addList(e,t);return this}addOut(e,t,r){const n=Xh(this,r);for(const s of this.ptrs)s.addOut(e,t,n);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const r of this.ptrs)r.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const r of this.ptrs)r.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,r)=>(t.some(n=>Ny(n,r))||t.push(r.trim()),t),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(const r of e)t=t.execute(r);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length!==1?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const r of e)yield t.clone({ptrs:[r]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,r=[...e].map(n=>new Gh({dataset:t,factory:this.factory,term:n}));return this.clone({ptrs:r})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}ki("http://www.w3.org/2002/07/owl#");const Qr=ki("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),Dy=ki("http://www.w3.org/2000/01/rdf-schema#"),de=ki("http://www.w3.org/ns/shacl#"),oc=ki("https://schemas.link/shacl-next#"),ad=ki("http://www.w3.org/2001/XMLSchema#");function Ly(i){return i?`{${[...i.quads()].map(e=>di(e)).join(" ")}}`:"{}"}function Oy(i){return i?`{${i.map(e=>Ly(e)).join(" ")}}`:"{}"}var Il,Qh;function Py(){if(Qh)return Il;Qh=1;var i=/\s/;function e(t){for(var r=t.length;r--&&i.test(t.charAt(r)););return r}return Il=e,Il}var Tl,Jh;function My(){if(Jh)return Tl;Jh=1;var i=Py(),e=/^\s+/;function t(r){return r&&r.slice(0,i(r)+1).replace(e,"")}return Tl=t,Tl}var Cl,Yh;function Fy(){if(Yh)return Cl;Yh=1;function i(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Cl=i,Cl}var $l,Zh;function jy(){if(Zh)return $l;Zh=1;var i=typeof un=="object"&&un&&un.Object===Object&&un;return $l=i,$l}var Al,ef;function By(){if(ef)return Al;ef=1;var i=jy(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=i||e||Function("return this")();return Al=t,Al}var Nl,tf;function jp(){if(tf)return Nl;tf=1;var i=By(),e=i.Symbol;return Nl=e,Nl}var Dl,rf;function qy(){if(rf)return Dl;rf=1;var i=jp(),e=Object.prototype,t=e.hasOwnProperty,r=e.toString,n=i?i.toStringTag:void 0;function s(o){var a=t.call(o,n),c=o[n];try{o[n]=void 0;var l=!0}catch{}var d=r.call(o);return l&&(a?o[n]=c:delete o[n]),d}return Dl=s,Dl}var Ll,nf;function Uy(){if(nf)return Ll;nf=1;var i=Object.prototype,e=i.toString;function t(r){return e.call(r)}return Ll=t,Ll}var Ol,sf;function Vy(){if(sf)return Ol;sf=1;var i=jp(),e=qy(),t=Uy(),r="[object Null]",n="[object Undefined]",s=i?i.toStringTag:void 0;function o(a){return a==null?a===void 0?n:r:s&&s in Object(a)?e(a):t(a)}return Ol=o,Ol}var Pl,of;function zy(){if(of)return Pl;of=1;function i(e){return e!=null&&typeof e=="object"}return Pl=i,Pl}var Ml,af;function Hy(){if(af)return Ml;af=1;var i=Vy(),e=zy(),t="[object Symbol]";function r(n){return typeof n=="symbol"||e(n)&&i(n)==t}return Ml=r,Ml}var Fl,lf;function Wy(){if(lf)return Fl;lf=1;var i=My(),e=Fy(),t=Hy(),r=NaN,n=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function c(l){if(typeof l=="number")return l;if(t(l))return r;if(e(l)){var d=typeof l.valueOf=="function"?l.valueOf():l;l=e(d)?d+"":d}if(typeof l!="string")return l===0?l:+l;l=i(l);var u=s.test(l);return u||o.test(l)?a(l.slice(2),u?2:8):n.test(l)?r:+l}return Fl=c,Fl}var jl,cf;function Gy(){if(cf)return jl;cf=1;var i=Wy(),e=1/0,t=17976931348623157e292;function r(n){if(!n)return n===0?n:0;if(n=i(n),n===e||n===-e){var s=n<0?-1:1;return s*t}return n===n?n:0}return jl=r,jl}var Bl,df;function Ky(){if(df)return Bl;df=1;var i=Gy();function e(t){var r=i(t),n=r%1;return r===r?n?r-n:r:0}return Bl=e,Bl}var ql,uf;function Xy(){if(uf)return ql;uf=1;var i=Ky(),e="Expected a function";function t(r,n){var s;if(typeof n!="function")throw new TypeError(e);return r=i(r),function(){return--r>0&&(s=n.apply(this,arguments)),r<=1&&(n=void 0),s}}return ql=t,ql}var Ul,hf;function Qy(){if(hf)return Ul;hf=1;var i=Xy();function e(t){return i(2,t)}return Ul=e,Ul}var Jy=Qy();const $i=Im(Jy);let ff=class{constructor({details:e,factory:t,options:r,results:n=[]}={}){this.details=e,this.factory=t,this.options=r,this.results=n,this._conforms=$i(()=>!this.results.some(s=>s.severity.equals(de.Info)||s.severity.equals(de.Violation)||s.severity.equals(de.Warning))),this._ptr=$i(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new To({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Qr.type],[de.ValidationReport]).addOut([de.conforms],[this.factory.literal(this.conforms.toString(),ad.boolean)]);for(const t of this.results)e.addOut([de.result],[this.factory.blankNode()],r=>{t.build(r,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Yy(i,e){return Object.entries(e).reduce((t,[r,n])=>(n&&n.termType&&(n=di(n)),t.replace(`{$${r}}`,n).replace(`{?${r}}`,n)),i)}let Zy=class{constructor({args:e={},constraintComponent:t,factory:r,focusNode:n,message:s=[],path:o,results:a=[],severity:c,shape:l,source:d=[],value:u,valuePaths:m=[]}={}){this.args=e,this.constraintComponent=t,this.factory=r,this.focusNode=n,this.path=o||l.path,this.results=a,this.severity=c,this.shape=l,this.source=d,this.value=u,this.valuePaths=m,this._message=$i(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([de.message]).terms),s.map(g=>r.literal(Yy(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Qr.type],[de.ValidationResult]).addOut([de.focusNode],this.focusNode.terms).addOut([de.resultSeverity],[this.severity]).addOut([de.sourceConstraint],this.source).addOut([de.sourceConstraintComponent],[this.constraintComponent]).addOut([de.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([de.resultMessage],this.message);const r=n=>{if(n.quantifier==="one")return n.predicates.length>1?e.node([this.factory.blankNode()]).addList([de.alternativePath],n.predicates):n.start==="object"?e.node([this.factory.blankNode()]).addOut([de.inversePath],[n.predicates[0]]):e.node([n.predicates[0]]);if(n.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([de.oneOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([de.zeroOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([de.zeroOrOnePath],[n.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([de.resultPath],r(this.path[0]).terms):e.addList([de.resultPath],this.path.map(n=>r(n).term))),typeof this.value<"u"&&e.addOut([de.value],this.value.terms),t)for(const n of this.results)e.addOut([de.detail],[this.factory.blankNode()],s=>{n.build(s,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class ld{constructor({factory:e,focusNode:t,options:r={debug:!1,details:!1},processed:n=new Set,report:s=new ff({factory:e,options:r}),results:o=new Map,shape:a,value:c,valueOrNode:l,valuePaths:d,values:u}={}){this.factory=e,this.focusNode=t,this.options=r,this.processed=n,this.report=s,this.results=o,this.shape=a,this.value=c,this.valuePaths=d,this.valueOrNode=l,this.values=u}create({child:e,focusNode:t=this.focusNode,shape:r=this.shape,value:n=this.value,valueOrNode:s=this.valueOrNode,valuePaths:o=this.valuePaths,values:a=this.values}={}){return new ld({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new ff({factory:this.factory,options:this.options}):this.report,results:this.results,shape:r,value:n,valueOrNode:s,valuePaths:o,values:a})}id({shape:e=this.shape}={}){return`${di(e.ptr.term)} - ${di(this.focusNode.term)} - ${Oy(this.valuePaths)}`}result(e){const t=new Zy({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),r=this.id();this.results.has(r)?this.results.get(r).add(t):this.results.set(r,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:oc.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:oc.Trace,constraintComponent:e,...t})}test(e,t,r){e?this.debug(t,r):this.violation(t,r)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||de.Violation,...t})}}function e0(){return{generic:t0()}}function t0(){return i=>{i.trace(oc.TraversalConstraintComponent,{args:{},message:[i.factory.literal("Traversal")],value:i.valueOrNode})}}class i0{constructor(e){this.validations=new Dn(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let r=!1;const n=new Set;for(const s of e.ptr.execute({start:"subject",end:"predicate"})){const o=this.validations.get(s.term);o&&(n.add(o),s.term.equals(de.property)&&(r=!0))}return t&&e.isPropertyShape&&!r&&n.add(e0),[...n].map(s=>s(e)).filter(Boolean)}}var Br={},qr={},ss={},os={},pf;function xn(){if(pf)return os;pf=1,Object.defineProperty(os,"__esModule",{value:!0}),os.Translator=void 0;let i=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,r,n){for(const s of r)this.supportedRdfDatatypes.push(s),this.fromRdfHandlers[s.value]=t;for(const s of n){let o=this.toRdfHandlers[s];o||(this.toRdfHandlers[s]=o=[]),o.push(t)}}fromRdf(t,r){const n=this.fromRdfHandlers[t.datatype.value];return n?n.fromRdf(t,r):t.value}toRdf(t,r){const n=this.toRdfHandlers[typeof t];if(n)for(const s of n){const o=s.toRdf(t,r);if(o)return o}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return os.Translator=i,os}var mf;function r0(){if(mf)return ss;mf=1,Object.defineProperty(ss,"__esModule",{value:!0}),ss.TypeHandlerBoolean=void 0;const i=xn();let e=class Bp{fromRdf(r,n){switch(r.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return n&&i.Translator.incorrectRdfDataType(r),!1}toRdf(r,{datatype:n,dataFactory:s}){return s.literal(r?"true":"false",n||s.namedNode(Bp.TYPE))}};return ss.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",ss}var as={},gf;function n0(){if(gf)return as;gf=1,Object.defineProperty(as,"__esModule",{value:!0}),as.TypeHandlerDate=void 0;const i=xn();let e=class ac{fromRdf(r,n){switch(n&&!r.value.match(ac.VALIDATORS[r.datatype.value.substr(33,r.datatype.value.length)])&&i.Translator.incorrectRdfDataType(r),r.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(r.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const s=r.value.split("-");return new Date(0,parseInt(s[0],10)-1,parseInt(s[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(r.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(r.value+"-01");default:return new Date(r.value)}}toRdf(r,{datatype:n,dataFactory:s}){if(n=n||s.namedNode(ac.TYPES[0]),!(r instanceof Date))return null;const o=r;let a;switch(n.value){case"http://www.w3.org/2001/XMLSchema#gDay":a=String(o.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":a=o.getUTCMonth()+1+"-"+o.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":a=String(o.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":a=o.getUTCFullYear()+"-"+(o.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":a=o.toISOString().replace(/T.*$/,"");break;default:a=o.toISOString()}return s.literal(a,n)}};return as.TypeHandlerDate=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#dateTime","http://www.w3.org/2001/XMLSchema#date","http://www.w3.org/2001/XMLSchema#gDay","http://www.w3.org/2001/XMLSchema#gMonthDay","http://www.w3.org/2001/XMLSchema#gYear","http://www.w3.org/2001/XMLSchema#gYearMonth"],e.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/},as}var ls={},bf;function s0(){if(bf)return ls;bf=1,Object.defineProperty(ls,"__esModule",{value:!0}),ls.TypeHandlerNumberDouble=void 0;const i=xn();let e=class qp{fromRdf(r,n){const s=parseFloat(r.value);return n&&isNaN(s)&&i.Translator.incorrectRdfDataType(r),s}toRdf(r,{datatype:n,dataFactory:s}){return n=n||s.namedNode(qp.TYPES[0]),isNaN(r)?s.literal("NaN",n):isFinite(r)?r%1===0?null:s.literal(r.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),n):s.literal(r>0?"INF":"-INF",n)}};return ls.TypeHandlerNumberDouble=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],ls}var cs={},yf;function o0(){if(yf)return cs;yf=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.TypeHandlerNumberInteger=void 0;const i=xn();let e=class gs{fromRdf(r,n){const s=parseInt(r.value,10);return n&&(isNaN(s)||r.value.indexOf(".")>=0)&&i.Translator.incorrectRdfDataType(r),s}toRdf(r,{datatype:n,dataFactory:s}){return s.literal(String(r),n||(r<=gs.MAX_INT&&r>=gs.MIN_INT?s.namedNode(gs.TYPES[0]):s.namedNode(gs.TYPES[1])))}};return cs.TypeHandlerNumberInteger=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#positiveInteger","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedShort"],e.MAX_INT=2147483647,e.MIN_INT=-2147483648,cs}var ds={},vf;function a0(){if(vf)return ds;vf=1,Object.defineProperty(ds,"__esModule",{value:!0}),ds.TypeHandlerString=void 0;let i=class{fromRdf(t){return t.value}toRdf(t,{datatype:r,dataFactory:n}){return n.literal(t,r)}};return ds.TypeHandlerString=i,i.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],ds}var wf;function _f(){return wf||(wf=1,function(i){var e=qr&&qr.__createBinding||(Object.create?function(r,n,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(n,s);(!a||("get"in a?!n.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return n[s]}}),Object.defineProperty(r,o,a)}:function(r,n,s,o){o===void 0&&(o=s),r[o]=n[s]}),t=qr&&qr.__exportStar||function(r,n){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(n,s)&&e(n,r,s)};Object.defineProperty(i,"__esModule",{value:!0}),t(r0(),i),t(n0(),i),t(s0(),i),t(o0(),i),t(a0(),i)}(qr)),qr}var Vl={},xf;function l0(){return xf||(xf=1,Object.defineProperty(Vl,"__esModule",{value:!0})),Vl}var Ef;function c0(){return Ef||(Ef=1,function(i){var e=Br&&Br.__createBinding||(Object.create?function(g,v,_,E){E===void 0&&(E=_);var x=Object.getOwnPropertyDescriptor(v,_);(!x||("get"in x?!v.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return v[_]}}),Object.defineProperty(g,E,x)}:function(g,v,_,E){E===void 0&&(E=_),g[E]=v[_]}),t=Br&&Br.__exportStar||function(g,v){for(var _ in g)_!=="default"&&!Object.prototype.hasOwnProperty.call(v,_)&&e(v,g,_)};Object.defineProperty(i,"__esModule",{value:!0}),i.fromRdf=c,i.toRdf=l,i.getTermRaw=d,i.getSupportedRdfDatatypes=u,i.getSupportedJavaScriptPrimitives=m;const r=Tp(),n=_f(),s=xn();t(_f(),i),t(l0(),i),t(xn(),i);const o=new r.DataFactory,a=new s.Translator;a.registerHandler(new n.TypeHandlerString,n.TypeHandlerString.TYPES.map(g=>o.namedNode(g)),["string"]),a.registerHandler(new n.TypeHandlerBoolean,[n.TypeHandlerBoolean.TYPE].map(g=>o.namedNode(g)),["boolean"]),a.registerHandler(new n.TypeHandlerNumberDouble,n.TypeHandlerNumberDouble.TYPES.map(g=>o.namedNode(g)),["number"]),a.registerHandler(new n.TypeHandlerNumberInteger,n.TypeHandlerNumberInteger.TYPES.map(g=>o.namedNode(g)),["number"]),a.registerHandler(new n.TypeHandlerDate,n.TypeHandlerDate.TYPES.map(g=>o.namedNode(g)),["object"]);function c(g,v){return a.fromRdf(g,v)}function l(g,v){return v&&"namedNode"in v&&(v={dataFactory:v}),v=v||{},v&&!v.dataFactory&&(v.dataFactory=o),a.toRdf(g,v)}function d(g,v){return g.termType==="Literal"?c(g,v):g.value}function u(){return a.getSupportedRdfDatatypes()}function m(){return a.getSupportedJavaScriptPrimitives()}}(Br)),Br}var Ns=c0();function Sf(i){if(i.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[i.term]};const e=i.out([de.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(o=>o.term)};const t=i.out([de.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const r=i.out([de.oneOrMorePath]);if(r.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[r.term]};const n=i.out([de.zeroOrMorePath]);if(n.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[n.term]};const s=i.out([de.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function d0(i){return i.terms.length===0?null:i.ptrs[0].isList()?[...i.list()].map(e=>Sf(e)):[Sf(i)]}class u0{constructor(e){this.shape=e,this._compiled=$i(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const r of this.compiled)r.node&&await r.node(t),r.generic&&await r.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const r=t.node(new wi(t.terms)),n=[...t].reduce((o,a)=>{const c=a.term,l=t.node([c]);return o.has(c)||o.set(c,{value:l,valuePaths:[]}),o.get(c).valuePaths.push(a),o},new Dn).values(),s=e.create({shape:this.shape,values:r});for(const o of this.compiled)o.property&&await o.property(s);for(const{value:o,valuePaths:a}of n){const c=e.create({shape:this.shape,value:o,valueOrNode:o,valuePaths:a});for(const l of this.compiled)l.generic&&await l.generic(c)}}}function lc(i){const e=new wi,r=new To({dataset:i.dataset,terms:i.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[Dy.subClassOf]});for(const n of r.ptrs)for(const{term:s}of n.nodes())e.add(s);return e}class h0{constructor(e){this.targetClass=new wi([...lc(e.hasOut([Qr.type],[de.NodeShape])),...lc(e.out([de.targetClass]))]),this.targetNode=e.out([de.targetNode]).terms,this.targetObjectsOf=e.out([de.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([de.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),r=[...e.focusNode.hasOut([Qr.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...t.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs],n=e.focusNode.clone({ptrs:r});return n.node([...new wi(n.terms)])}}class f0{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=$i(()=>{const r=this.ptr.out([de.deactivated]).term;return r&&Ns.fromRdf(r)}),this._message=$i(()=>this.ptr.out([de.message]).terms),this._path=$i(()=>d0(this.ptr.out([de.path]))),this._severity=$i(()=>this.ptr.out([de.severity]).term),this._shapeValidator=$i(()=>new u0(this)),this._sparql=$i(()=>this.ptr.out([de.sparql])),this._targetResolver=$i(()=>new h0(this.ptr))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!this.path}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const r of e.results.get(t))e.report.results.push(r);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function p0(i){const e=parseInt(i.ptr.out([de.maxCount]).value);return{property:m0(e)}}function m0(i){return e=>{e.test(e.values.terms.length<=i,de.MaxCountConstraintComponent,{args:{maxCount:i},message:[e.factory.literal("More than {$maxCount} values")]})}}function g0(i){const e=parseInt(i.ptr.out([de.minCount]).value);return{property:b0(e)}}function b0(i){return e=>{e.test(e.values.terms.length>=i,de.MinCountConstraintComponent,{args:{minCount:i},message:[e.factory.literal("Less than {$minCount} values")]})}}async function y0(i,e){for(const t of i)if(!await e(t))return!1;return!0}async function v0(i,e){return(await Promise.all(i.map(t=>e(t)))).filter(Boolean)}async function Qo(i,e){return Promise.all(i.map(e))}async function w0(i,e){for(const t of i)if(await e(t))return!0;return!1}function _0(i){const e=[...i.ptr.out([de.and])].flatMap(t=>[...t.list()]).map(t=>i.validator.shape(t));return{generic:x0(e)}}function x0(i){return async e=>{const t=await Qo(i,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),r=t.every(n=>n.conforms);e.test(r,de.AndConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function E0(i){const e=i.validator.shape(i.ptr.out([de.not]));return{generic:S0(e)}}function S0(i){return async e=>{const t=(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,r=!t.conforms;e.test(r,de.NotConstraintComponent,{args:{not:i.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function k0(i){const e=[...i.ptr.out([de.or])].flatMap(t=>[...t.list()]).map(t=>i.validator.shape(t));return{generic:R0(e)}}function R0(i){return async e=>{let t=[],r;if(e.options.debug||e.options.details){const n=await Qo(i,async s=>(await s.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=n.flatMap(s=>s.results),r=n.some(s=>s.conforms)}else r=await w0(i,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(r,de.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function I0(i){const e=[...i.ptr.out([de.xone])].flatMap(t=>[...t.list()]).map(t=>i.validator.shape(t));return{generic:T0(e)}}function T0(i){return async e=>{const t=await Qo(i,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),r=t.filter(n=>n.conforms).length===1;e.test(r,de.XoneConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function C0(i){if(!Ns.fromRdf(i.ptr.out([de.closed]).term))return null;const t=i.ptr.out([de.property]).map(s=>i.validator.shape(s)),r=new wi(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),n=new wi([...i.ptr.out([de.ignoredProperties]).list()||[]].map(s=>s.term));return{node:$0(r,n)}}function $0(i,e){return t=>{const r=t.focusNode.execute({start:"subject",end:"predicate"}).filter(n=>e.has(n.term)?!1:!i.has(n.term));if(r.ptrs.length>0)for(const n of r)t.violation(de.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[n.term]}],value:t.focusNode.node([[...n.quads()][0].object])});else t.debug(de.ClosedConstraintComponent)}}function A0(i){const e=i.ptr.out([de.hasValue]).term;return{node:N0(e),property:D0(e)}}function N0(i){return e=>{e.test(i.equals(e.valueOrNode.term),de.HasValueConstraintComponent,{args:{hasValue:i},message:[e.factory.literal("Value must be {$hasValue}")]})}}function D0(i){return e=>{const t=[...e.values].some(r=>i.equals(r.term));e.test(t,de.HasValueConstraintComponent,{args:{hasValue:i},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function L0(i){const e=new wi([...i.ptr.out([de.in]).list()].map(t=>t.term));return{generic:O0(e)}}function O0(i){return e=>{e.test(i.has(e.valueOrNode.term),de.InConstraintComponent,{args:{in:[...i].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function Ln(i,e){if(!i||i.termType!=="Literal"||!e||e.termType!=="Literal"||kf(i)!==kf(e))return null;const t=Ns.fromRdf(i),r=Ns.fromRdf(e);return typeof t!=typeof r?null:typeof t=="string"?t.localeCompare(r):t-r}function kf(i){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return ad.dateTime.equals(i.datatype)&&e.test(i.value)}function P0(i){const e=i.ptr.out([de.disjoint]).term;return{generic:M0(e)}}function M0(i){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,i,e.valueOrNode.term);e.test(t.size===0,de.DisjointConstraintComponent,{args:{disjoint:i},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function F0(i){const e=i.ptr.out([de.equals]).term;return{node:j0(e),property:B0(e)}}function j0(i){return e=>{const t=e.focusNode.out([i]),r=t.filter(s=>!s.term.equals(e.focusNode.term)),n=t.terms.length!==0&&r.terms.length===0;e.test(n,de.EqualsConstraintComponent,{args:{equals:i},message:[e.factory.literal("Must have same values as {$equals}")],value:r.terms[0]&&e.focusNode.node([r.terms[0]])||e.focusNode})}}function B0(i){return e=>{const t=new wi(e.focusNode.out([i]).terms),r=new wi(e.values.terms),n=[...r].filter(a=>!t.has(a)),s=[...t].filter(a=>!r.has(a)),o=[...n,...s];for(const a of o)e.violation(de.EqualsConstraintComponent,{args:{equals:i},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([a])});o.length===0&&e.debug(de.EqualsConstraintComponent,{args:{equals:i},message:[e.factory.literal("Must have same values as {$equals}")]})}}function q0(i){const e=i.ptr.out([de.lessThan]).term;return{property:U0(e)}}function U0(i){return e=>{const t=e.focusNode.out([i]).terms;for(const r of e.values)for(const n of t){const s=Ln(r.term,n);s===null||s>=0?e.violation(de.LessThanConstraintComponent,{args:{lessThan:i},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r}):e.debug(de.LessThanConstraintComponent,{args:{lessThan:i},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r})}}}function V0(i){const e=i.ptr.out([de.lessThanOrEquals]).term;return{property:z0(e)}}function z0(i){return e=>{const t=e.focusNode.out([i]).terms;for(const r of e.values)for(const n of t){const s=Ln(r.term,n);s===null||s>0?e.violation(de.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:i},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r}):e.debug(de.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:i},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r})}}}function H0(i){const e=i.ptr.out([de.maxExclusive]).term;return{generic:W0(e)}}function W0(i){return e=>{const t=Ln(e.valueOrNode.term,i);e.test(t!==null&&t<0,de.MaxExclusiveConstraintComponent,{args:{maxExclusive:i},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function G0(i){const e=i.ptr.out([de.maxInclusive]).term;return{generic:K0(e)}}function K0(i){return e=>{const t=Ln(e.valueOrNode.term,i);e.test(t!==null&&t<=0,de.MaxInclusiveConstraintComponent,{args:{maxInclusive:i},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function X0(i){const e=i.ptr.out([de.minExclusive]).term;return{generic:Q0(e)}}function Q0(i){return e=>{const t=Ln(e.valueOrNode.term,i);e.test(t!==null&&t>0,de.MinExclusiveConstraintComponent,{args:{minExclusive:i},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function J0(i){const e=i.ptr.out([de.minInclusive]).term;return{generic:Y0(e)}}function Y0(i){return e=>{const t=Ln(e.valueOrNode.term,i);e.test(t!==null&&t>=0,de.MinInclusiveConstraintComponent,{args:{minInclusive:i},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Z0(i){const e=[...i.ptr.out([de.node])].map(t=>i.validator.shape(t));return{generic:ev(e)}}function ev(i){return async e=>{for(const t of i){const r=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(r.report.conforms,de.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:r.report.results,value:e.valueOrNode})}}}function tv(i){const e=[...i.ptr.out([de.property])].map(t=>i.validator.shape(t));return{generic:iv(e)}}function iv(i){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const r of i)await r.validate(t)}}function rv(i){const e=i.validator.shape(i.ptr.out([de.qualifiedValueShape])),t=i.ptr.out([de.qualifiedValueShapesDisjoint]).term,r=t?Ns.fromRdf(t):!1,n=i.ptr.out([de.qualifiedMaxCount]).term,s=n?parseInt(n.value):null,o=i.ptr.out([de.qualifiedMinCount]).term,a=o?parseInt(o.value):null;return{property:nv(e,r,s,a)}}function nv(i,e,t,r){return async n=>{const s=[];let o=[];e&&(o=new Set(n.shape.ptr.in([de.property]).out([de.property]).out([de.qualifiedValueShape]).filter(c=>!c.term.equals(i.ptr.term)).map(c=>n.shape.validator.shape(c))));const a=(await v0(n.values,async c=>{const l=(await i.validate(n.create({child:!0,focusNode:c}))).report;if(s.push(l.results),!l.conforms)return!1;if(o.length===0)return!0;if(n.options.debug||n.options.details){const d=await Qo([...o],async u=>(await u.validate(n.create({child:!0,focusNode:c}))).report);return s.push(d.flatMap(u=>u.results)),!d.every(u=>u.conforms)}else return!await y0([...o],async d=>(await d.validate(n.create({child:!0,focusNode:c}))).report.conforms)})).length;t!==null&&n.test(a<=t,de.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:i.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),r!==null&&n.test(a>=r,de.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:r,qualifiedValueShape:i.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function sv(i,e){return e?e.slice(0,i.length)===i:!1}function ov(i){const e=[...new Set([...i.ptr.out([de.languageIn]).list()].map(t=>t.value))];return{generic:av(e)}}function av(i){return e=>{const t=i.some(r=>sv(r,e.valueOrNode.term.language));e.test(t,de.LanguageInConstraintComponent,{args:{languageIn:i.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function lv(i){const e=parseInt(i.ptr.out([de.maxLength]).value);return{generic:cv(e)}}function cv(i){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=i;e.test(t,de.MaxLengthConstraintComponent,{args:{maxLength:i},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function dv(i){const e=parseInt(i.ptr.out([de.minLength]).value);return{generic:uv(e)}}function uv(i){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=i;e.test(t,de.MinLengthConstraintComponent,{args:{minLength:i},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function hv(i){const e=i.ptr.out([de.pattern]).value,t=i.ptr.out([de.flags]).value,r=new RegExp(e,t);return{generic:fv(e,t,r)}}function fv(i,e,t){return r=>{r.test(t.test(r.valueOrNode.term.value),de.PatternConstraintComponent,{args:{flags:e,pattern:i},message:[r.factory.literal('Value does not match pattern "{$pattern}"')],value:r.valueOrNode})}}function pv(i){const e=i.ptr.out([de.uniqueLang]).term;return e.value==="true"&&ad.boolean.equals(e.datatype)?{property:mv()}:null}function mv(){return i=>{const t=Object.entries(i.values.terms.reduce((r,n)=>(n.language&&(r[n.language]=(r[n.language]||0)+1),r),{})).filter(([,r])=>r>1);for(const[r]of t)i.violation(de.UniqueLangConstraintComponent,{args:{lang:r},message:[i.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&i.debug(de.UniqueLangConstraintComponent)}}const _o=ki("http://www.w3.org/ns/shacl#"),Up=ki("https://schemas.link/shacl-next#");class En{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(_o.Info)||e.severity.equals(_o.Violation)||e.severity.equals(_o.Warning))}}function gv(i,e){return Object.entries(e).reduce((t,[r,n])=>(n&&n.termType&&(n=di(n)),t.replace(`{$${r}}`,n).replace(`{?${r}}`,n)),i)}class Co{constructor({args:e={},factory:t,message:r=[],severity:n=_o.Violation}={}){this.severity=n,this.message=r.map(s=>t.literal(gv(s.value,e),s.language||null))}}class cd{constructor({factory:e=od}={}){this.factory=e}clone({factory:e}={}){return new cd({factory:e||this.factory})}validate(){return new En}validateSimple(){return!0}}class On extends cd{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const r of Array.isArray(e)?e:[e])r&&this.datatypes.push(this.factory.fromTerm(r))}clone({factory:e}={}){return new On({datatypes:this.datatypes,factory:e||this.factory})}}class bv{constructor({factory:e=od,validations:t}={}){if(this.factory=e,this.validations=new Dn,t)for(const r of Object.values(t)){const n=r.clone({factory:this.factory});for(const s of n.datatypes)this.validations.set(s,n)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new En}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class lt extends On{constructor(e,t,{factory:r}={}){super({datatypes:t,factory:r}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new lt(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(r=>{let n;r.test(e.value)&&(n=Up.Debug);const s={pattern:this.factory.literal(r.toString()),this:e};return new Co({args:s,factory:this.factory,message:this.message,severity:n})});return new En({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const yv=/^([-+]?[0-9]+)$/;class Yt extends lt{constructor(e=null,t=null,r,{factory:n}={}){super(yv,r,{factory:n}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new Yt(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Up.Debug.equals(t[0].severity))return new En({results:t});const r=BigInt(e.value);if(this.minInclusive!==null&&r<this.minInclusive){const n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,s=[this.factory.literal(n)];t.push(new Co({factory:this.factory,message:s}))}if(this.maxInclusive!==null&&r>this.maxInclusive){const n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,s=[this.factory.literal(n)];t.push(new Co({factory:this.factory,message:s}))}return new En({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class dd extends On{constructor(e,t,{factory:r}={}){super({datatypes:t,factory:r}),this.values=new Set(e)}clone({factory:e}={}){return new dd(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const r=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,n=[this.factory.literal(r)];t.push(new Co({factory:this.factory,message:n}))}return new En({results:t})}validateSimple(e){return this.values.has(e.value)}}const We={xsd:ki("http://www.w3.org/2001/XMLSchema#")},vv=new On({datatypes:We.xsd.anySimpleType}),wv=new On({datatypes:We.xsd.anyAtomicType}),Jo=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,_v=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Vp=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,ud=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,zp=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,xv=/^((([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Ev=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Sv=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,kv=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Rv=/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Iv=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Tv=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Cv=/^(([0-9a-fA-F]{2})*)$/,$v=/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,Av=new lt(Jo,We.xsd.string),Nv=new dd(["1","true","0","false"],We.xsd.boolean),Dv=new lt(_v,We.xsd.decimal),Lv=new lt(Vp,We.xsd.float),Ov=new lt(Vp,We.xsd.double),Pv=new lt(ud,We.xsd.duration),Mv=new lt(zp,We.xsd.dateTime),Fv=new lt(xv,We.xsd.time),jv=new lt(Ev,We.xsd.date),Bv=new lt(Sv,We.xsd.gYearMonth),qv=new lt(kv,We.xsd.gYear),Uv=new lt(Rv,We.xsd.gMonthDay),Vv=new lt(Iv,We.xsd.gDay),zv=new lt(Tv,We.xsd.gMonth),Hv=new lt(Cv,We.xsd.hexBinary),Wv=new lt($v,We.xsd.base64Binary),Gv=new lt(Jo,We.xsd.anyURI),Hp=/^([^\u000d\u000a\u0009]*)$/,Kv=/^([^ ]+( [^ ]+)*)*$/,Xv=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Qv=/^([^DT]*)$/,Jv=/^([^YM]*[DT].*)$/,Yv=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Zv=new lt([Jo,Hp],We.xsd.normalizedString),ew=new lt([Jo,Hp,Kv],We.xsd.token),tw=new lt(Xv,We.xsd.language),iw=new Yt(null,null,We.xsd.integer),rw=new Yt(null,"0",We.xsd.nonPositiveInteger),nw=new Yt(null,"-1",We.xsd.negativeInteger),sw=new Yt("-9223372036854775808","9223372036854775807",We.xsd.long),ow=new Yt("-2147483648","2147483647",We.xsd.int),aw=new Yt("-32768","32767",We.xsd.short),lw=new Yt("-128","127",We.xsd.byte),cw=new Yt("0",null,We.xsd.nonNegativeInteger),dw=new Yt("0","18446744073709551615",We.xsd.unsignedLong),uw=new Yt("0","4294967295",We.xsd.unsignedInt),hw=new Yt("0","65535",We.xsd.unsignedShort),fw=new Yt("0","255",We.xsd.unsignedByte),pw=new Yt("1",null,We.xsd.positiveInteger),mw=new lt([ud,Qv],We.xsd.yearMonthDuration),gw=new lt([ud,Jv],We.xsd.dayTimeDuration),bw=new lt([zp,Yv],We.xsd.dateTimeStamp),yw=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:wv,anySimpleType:vv,anyURI:Gv,base64Binary:Wv,boolean:Nv,byte:lw,date:jv,dateTime:Mv,dateTimeStamp:bw,dayTimeDuration:gw,decimal:Dv,double:Ov,duration:Pv,float:Lv,gDay:Vv,gMonth:zv,gMonthDay:Uv,gYear:qv,gYearMonth:Bv,hexBinary:Hv,int:ow,integer:iw,language:tw,long:sw,negativeInteger:nw,nonNegativeInteger:cw,nonPositiveInteger:rw,normalizedString:Zv,positiveInteger:pw,short:aw,string:Av,time:Fv,token:ew,unsignedByte:fw,unsignedInt:uw,unsignedLong:dw,unsignedShort:hw,yearMonthDuration:mw},Symbol.toStringTag,{value:"Module"}));class vw extends bv{constructor({factory:e}={}){super({factory:e,validations:{...yw}})}}const ww=new Dn([[de.BlankNode,new Set(["BlankNode"])],[de.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[de.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[de.IRI,new Set(["NamedNode"])],[de.IRIOrLiteral,new Set(["NamedNode","Literal"])],[de.Literal,new Set(["Literal"])]]);function _w(i){const e=i.ptr.out([de.class]).map(t=>lc(t));return{generic:xw(e)}}function xw(i){return e=>{const t=new wi(e.valueOrNode.out([Qr.type]).terms);for(const r of i){const n=[...t].some(s=>r.has(s));e.test(n,de.ClassConstraintComponent,{value:e.valueOrNode})}}}function Ew(i){const e=i.ptr.out([de.datatype]).term,t=new vw;return{generic:Sw(e,t)}}function Sw(i,e){return t=>{const r=i.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(r,de.DatatypeConstraintComponent,{args:{datatype:i},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function kw(i){const e=i.ptr.out([de.nodeKind]).term,t=ww.get(e);return{generic:Rw(e,t)}}function Rw(i,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),de.NodeKindConstraintComponent,{args:{nodeKind:i},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const Iw=new Dn([[de.maxCount,p0],[de.minCount,g0],[de.and,_0],[de.not,E0],[de.or,k0],[de.xone,I0],[de.closed,C0],[de.hasValue,A0],[de.in,L0],[de.disjoint,P0],[de.equals,F0],[de.lessThan,q0],[de.lessThanOrEquals,V0],[de.maxExclusive,H0],[de.maxInclusive,G0],[de.minExclusive,X0],[de.minInclusive,J0],[de.node,Z0],[de.property,tv],[de.qualifiedValueShape,rv],[de.languageIn,ov],[de.maxLength,lv],[de.minLength,dv],[de.pattern,hv],[de.uniqueLang,pv],[de.class,_w],[de.datatype,Ew],[de.nodeKind,kw]]);class Tw{constructor(e,{factory:t,...r}){if(this.factory=t,this.options=r,this.registry=new i0(Iw),this.shapesPtr=new To({dataset:e,factory:t}),this.shapes=new Dn,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[s,o]of this.options.validations)this.registry.validations.set(s,o);const n=[...this.shapesPtr.hasOut([de.targetClass]),...this.shapesPtr.hasOut([de.targetNode]),...this.shapesPtr.hasOut([de.targetObjectsOf]),...this.shapesPtr.hasOut([de.targetSubjectsOf]),...this.shapesPtr.hasOut([Qr.type],[de.NodeShape]),...this.shapesPtr.hasOut([Qr.type],[de.PropertyShape])];for(const s of n)this.shape(s)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new f0(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const r=new To({...e,factory:this.factory}),n=new ld({factory:this.factory,focusNode:r,options:this.options,validator:this});t?t=t.map(s=>this.shape(this.shapesPtr.node(s.terms))):t=this.shapes.values();for(const s of t){const o=n.create({shape:s});let a;r.isAny()?a=s.resolveTargets(o):a=r;for(const c of a)await s.validate(o.create({focusNode:c}))}return n.report}}let Cw=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new qh(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(r=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:r.conforms,report:r}}))}).catch(r=>{console.warn(r)})})}static get observedAttributes(){return qh.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(r=>{this.form.classList.remove(r)}),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const r of kg())r.stylesheet&&t.push(r.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new _r(e,this.config,this.config.attributes.valuesSubject?ze.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const r=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);r.addEventListener("click",n=>{n.preventDefault(),this.form.reportValidity()&&this.validate().then(s=>{if(s?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let o=this.form.querySelector(":scope .invalid > .editor");o?o.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(r)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(ze.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,ys)>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}},200)}serialize(e="text/turtle",t=this.toRDF()){const r=t.getQuads(null,null,null,null);return _g(r,e,this.config.prefixes)}toRDF(e=new jt){return this.shape?.toRDF(e),e}registerPlugin(e){Sg(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape&&(this.shape.toRDF(this.config.store),this.config.store.add(new jo(this.shape.shaclSubject,ze.namedNode(Oe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId)));try{const t=this.config.store,r=await new Tw(t,{details:!0,factory:ze}).validate({dataset:t});for(const n of r.results)if(n.focusNode?.ptrs?.length)for(const s of n.focusNode.ptrs){const o=s._term;if(n.path?.length){const a=n.path[0].predicates[0];let c=this.form.querySelectorAll(`
391
+ `}function wy(){return""}function Op(i){return"<"+i.value+">"}const _y=/["\\\\\n\r]/,xy=/["\\\\\n\r]/g,Ey={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Sy(i){return Ey[i]}function ky(i){return _y.test(i)?i.replace(xy,Sy):i}function Ry(i){const e=ky(i.value);return i.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':i.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+i.language:'"'+e+'"^^'+Op(i.datatype)}function Iy(i,e){const t=e(i.subject),r=e(i.predicate),n=e(i.object),s=e(i.graph);return`${t} ${r} ${n} ${s?s+" ":""}.`}function Ty(i){return"?"+i.value}function di(i){if(!i)return null;if(i.termType==="BlankNode")return yy(i);if(i.termType==="DefaultGraph")return wy();if(i.termType==="Literal")return Ry(i);if(i.termType==="NamedNode")return Op(i);if(i.termType==="Quad"||i.subject&&i.predicate&&i.object&&i.graph)return Iy(i,di);if(i.termType==="Variable")return Ty(i);if(i[Symbol.iterator])return vy(i,di);throw new Error(`unknown termType ${i.termType}`)}class Dn{constructor(e){if(this.index=new Map,e)for(const[t,r]of e)this.set(t,r)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(di(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const r of this.entries())e.call(t,r[1],r[0],this)}get(e){const t=this.index.get(di(e));return t&&t.value}has(e){return this.index.has(di(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const r=di(e);return this.index.set(r,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class Uh{constructor({dataset:e,end:t,quad:r,start:n}){this.dataset=e,this.end=t,this.quad=r,this.start=n}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function Vh(i){try{return di(i)}catch{return null}}class wi{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=di(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(Vh(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(Vh(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Pp{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Pp.prototype.termType="BlankNode";class nd{equals(e){return!!e&&e.termType===this.termType}}nd.prototype.termType="DefaultGraph";nd.prototype.value="";function zh(i,e){if(!e)return null;if(e.termType==="BlankNode")return i.blankNode(e.value);if(e.termType==="DefaultGraph")return i.defaultGraph();if(e.termType==="Literal")return i.literal(e.value,e.language||i.namedNode(e.datatype.value));if(e.termType==="NamedNode")return i.namedNode(e.value);if(e.termType==="Quad"){const t=i.fromTerm(e.subject),r=i.fromTerm(e.predicate),n=i.fromTerm(e.object),s=i.fromTerm(e.graph);return i.quad(t,r,n,s)}if(e.termType==="Variable")return i.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class wo{constructor(e,t,r,n=""){this.value=e,this.language=t,this.datatype=r,this.direction=n}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)&&(e.direction||"")===this.direction}}wo.prototype.termType="Literal";class zs{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}zs.prototype.termType="NamedNode";class sd{constructor(e,t,r,n){this.subject=e,this.predicate=t,this.object=r,this.graph=n}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}sd.prototype.termType="Quad";sd.prototype.value="";class Mp{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Mp.prototype.termType="Variable";const Cy=new zs("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),Hh=new zs("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),$y=new zs("http://www.w3.org/2001/XMLSchema#string");class Fp{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new nd}}namedNode(e){return new zs(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Pp(e)}literal(e,t){return typeof t=="string"?new wo(e,t,Hh):typeof t?.language=="string"?new wo(e,t.language,t.direction?Cy:Hh,t.direction):new wo(e,"",t||$y)}variable(e){return new Mp(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,r,n=this.defaultGraph()){return new sd(e,t,r,n)}fromTerm(e){return zh(this,e)}fromQuad(e){return zh(this,e)}}Fp.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const od=new Fp,Ay={apply:(i,e,t)=>i(t[0]),get:(i,e)=>i(e)};function ki(i,{factory:e=od}={}){const t=(r="")=>e.namedNode(`${i}${r.raw||r}`);return typeof Proxy>"u"?t:new Proxy(t,Ay)}ki("http://www.w3.org/2001/XMLSchema#");const Pi=ki("http://www.w3.org/1999/02/22-rdf-syntax-ns#");ki("http://www.w3.org/2000/01/rdf-schema#");class rt{static add({ptr:e,start:t,end:r,subjects:n=[null],predicates:s=[null],objects:o=[null],graphs:a,callback:c}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};c&&(l=d=>{c(new Uh({dataset:e.dataset,start:t,end:r,quad:d}))});for(const d of n)for(const u of s)for(const m of o)for(const g of a){const v={subject:d,predicate:u,object:m,graph:g};v[t]=e.term;const _=e.factory.quad(v.subject,v.predicate,v.object,v.graph);e.dataset.add(_),l(_)}return e}static addList({ptr:e,predicates:t,items:r,graphs:n}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const s of t)for(const o of n){const a=r.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,a[0]||Pi.nil,o));for(let c=0;c<a.length;c++)e.dataset.add(e.factory.quad(a[c],Pi.first,r[c],o)),e.dataset.add(e.factory.quad(a[c],Pi.rest,a[c+1]||Pi.nil,o))}return e}static delete({ptr:e,start:t,subjects:r=[null],predicates:n=[null],objects:s=[null]}){for(const o of r)for(const a of n)for(const c of s){const l={subject:o,predicate:a,object:c};l[t]=e.term;const d=e.dataset.match(l.subject,l.predicate,l.object);for(const u of d)e.dataset.delete(u)}return e}static deleteList({ptr:e,predicates:t}){const r=[];for(const n of t)for(const s of e.dataset.match(e.term,n)){let o=s.object;for(r.push(s);!Pi.nil.equals(o);){o=r[r.length-1].object;const a=e.dataset.match(o);if(a.size===0)break;for(const c of a)r.push(c)}}for(const n of r)e.dataset.delete(n);return e}static execute({ptr:e,operation:t="traverse",quantifier:r,start:n,end:s,subjects:o,predicates:a,objects:c,graphs:l,items:d,callback:u}={}){if(t==="add")return rt.add({ptr:e,start:n,end:s,subjects:o,predicates:a,objects:c,graphs:l,callback:u});if(t==="addList")return rt.addList({ptr:e,predicates:a,items:d,graphs:l});if(t==="delete")return rt.delete({ptr:e,start:n,subjects:o,predicates:a,objects:c});if(t==="deleteList")return rt.deleteList({ptr:e,predicates:a});if(t==="isList")return rt.isList({ptr:e});if(t==="list")return rt.list({ptr:e});if(t==="traverse")return rt.traverse({ptr:e,quantifier:r,start:n,end:s,subjects:o,predicates:a,objects:c,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(Pi.nil.equals(e.term)||rt.traverse({ptr:e,predicates:[Pi.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(Pi.nil);){const t=e.out([Pi.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const r=e.out([Pi.rest]);if(r.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=r[0]}}}}static traverse({ptr:e,quantifier:t="one",start:r="subject",end:n="object",subjects:s=[null],predicates:o=[null],objects:a=[null],graphs:c=[null],callback:l}){if(t==="one")return rt.traverseOne({ptr:e,start:r,end:n,subjects:s,predicates:o,objects:a,graphs:c,callback:l});if(t==="oneOrMore"){const d=rt.traverse({ptr:e,end:n,start:r,subjects:s,predicates:o,objects:a,graphs:c,callback:l});return rt.traverseMore({ptrs:d,end:n,start:r,subjects:s,predicates:o,objects:a,graphs:c,callback:l})}if(t==="zeroOrMore")return rt.traverseMore({ptrs:[e],end:n,start:r,subjects:s,predicates:o,objects:a,graphs:c,callback:l});if(t==="zeroOrOne")return[e,...rt.traverse({ptr:e,end:n,start:r,subjects:s,predicates:o,objects:a,graphs:c,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:r,subjects:n,predicates:s,objects:o,graphs:a,callback:c}={}){let l=[...e],d,u;do{d=[];for(const m of e)d=[...d,...rt.traverseOne({ptr:m,end:t,start:r,subjects:n,predicates:s,objects:o,graphs:a,callback:c})];u&&(d=d.filter(m=>!u.has(m.term))),e=d,l=[...l,...d],u=new wi(l.map(m=>m.term))}while(d.length>0);return l}static traverseOne({ptr:e,start:t,end:r,subjects:n,predicates:s,objects:o,graphs:a,callback:c=(l,d)=>d.extend(l)}={}){const l=[];for(const d of n)for(const u of s)for(const m of o)for(const g of a){const v={subject:d,predicate:u,object:m,graph:g};v[t]=e.term;for(const _ of e.dataset.match(v.subject,v.predicate,v.object,v.graph))l.push(c(new Uh({dataset:e.dataset,end:r,quad:_,start:t}),e))}return l}}function Wh(i,e){return e?t=>e(i.extend(t)):()=>{}}class Gh{constructor({dataset:e,edges:t=[],factory:r,graph:n,term:s}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof s>"u")throw new Error("edges or term must be given");if(t.length>0&&s)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=r,this._graph=n,t.length===0&&(this._term=s)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,r){return rt.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:Wh(this,r)})}addList(e,t){return rt.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,r){return rt.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:Wh(this,r)})}deleteIn(e,t){return rt.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return rt.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return rt.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:r,end:n,subjects:s,predicates:o,objects:a,graphs:c,items:l,callback:d}){return rt.execute({ptr:this,operation:e,quantifier:t,start:r,end:n,subjects:s,predicates:o,objects:a,graphs:c,items:l,callback:d})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return rt.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return rt.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return rt.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return rt.isList({ptr:this})}list(){return rt.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,t){return rt.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function Kh(i,e){return i?i.equals(e):i===e}function Ny(i,e){return!(i.dataset!==e.dataset||!Kh(i.graph,e.graph)||!Kh(i.term,e.term))}function Xh(i,e){return e?t=>e(new i.constructor({factory:i.factory,ptrs:[t]})):()=>{}}class To{constructor({dataset:e,factory:t,ptrs:r,terms:n,graphs:s}){if(this.factory=t,r)this.ptrs=[...r];else{this.ptrs=[];for(const o of n||[null])for(const a of s||[null])this.ptrs.push(new Gh({dataset:e,factory:t,graph:a,term:o}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new wi(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,r){const n=Xh(this,r);for(const s of this.ptrs)s.addIn(e,t,n);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const r of this.ptrs)r.addList(e,t);return this}addOut(e,t,r){const n=Xh(this,r);for(const s of this.ptrs)s.addOut(e,t,n);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const r of this.ptrs)r.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const r of this.ptrs)r.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,r)=>(t.some(n=>Ny(n,r))||t.push(r.trim()),t),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(const r of e)t=t.execute(r);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length!==1?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const r of e)yield t.clone({ptrs:[r]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,r=[...e].map(n=>new Gh({dataset:t,factory:this.factory,term:n}));return this.clone({ptrs:r})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}ki("http://www.w3.org/2002/07/owl#");const Qr=ki("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),Dy=ki("http://www.w3.org/2000/01/rdf-schema#"),de=ki("http://www.w3.org/ns/shacl#"),oc=ki("https://schemas.link/shacl-next#"),ad=ki("http://www.w3.org/2001/XMLSchema#");function Ly(i){return i?`{${[...i.quads()].map(e=>di(e)).join(" ")}}`:"{}"}function Oy(i){return i?`{${i.map(e=>Ly(e)).join(" ")}}`:"{}"}var Il,Qh;function Py(){if(Qh)return Il;Qh=1;var i=/\s/;function e(t){for(var r=t.length;r--&&i.test(t.charAt(r)););return r}return Il=e,Il}var Tl,Jh;function My(){if(Jh)return Tl;Jh=1;var i=Py(),e=/^\s+/;function t(r){return r&&r.slice(0,i(r)+1).replace(e,"")}return Tl=t,Tl}var Cl,Yh;function Fy(){if(Yh)return Cl;Yh=1;function i(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Cl=i,Cl}var $l,Zh;function jy(){if(Zh)return $l;Zh=1;var i=typeof un=="object"&&un&&un.Object===Object&&un;return $l=i,$l}var Al,ef;function By(){if(ef)return Al;ef=1;var i=jy(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=i||e||Function("return this")();return Al=t,Al}var Nl,tf;function jp(){if(tf)return Nl;tf=1;var i=By(),e=i.Symbol;return Nl=e,Nl}var Dl,rf;function qy(){if(rf)return Dl;rf=1;var i=jp(),e=Object.prototype,t=e.hasOwnProperty,r=e.toString,n=i?i.toStringTag:void 0;function s(o){var a=t.call(o,n),c=o[n];try{o[n]=void 0;var l=!0}catch{}var d=r.call(o);return l&&(a?o[n]=c:delete o[n]),d}return Dl=s,Dl}var Ll,nf;function Uy(){if(nf)return Ll;nf=1;var i=Object.prototype,e=i.toString;function t(r){return e.call(r)}return Ll=t,Ll}var Ol,sf;function Vy(){if(sf)return Ol;sf=1;var i=jp(),e=qy(),t=Uy(),r="[object Null]",n="[object Undefined]",s=i?i.toStringTag:void 0;function o(a){return a==null?a===void 0?n:r:s&&s in Object(a)?e(a):t(a)}return Ol=o,Ol}var Pl,of;function zy(){if(of)return Pl;of=1;function i(e){return e!=null&&typeof e=="object"}return Pl=i,Pl}var Ml,af;function Hy(){if(af)return Ml;af=1;var i=Vy(),e=zy(),t="[object Symbol]";function r(n){return typeof n=="symbol"||e(n)&&i(n)==t}return Ml=r,Ml}var Fl,lf;function Wy(){if(lf)return Fl;lf=1;var i=My(),e=Fy(),t=Hy(),r=NaN,n=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function c(l){if(typeof l=="number")return l;if(t(l))return r;if(e(l)){var d=typeof l.valueOf=="function"?l.valueOf():l;l=e(d)?d+"":d}if(typeof l!="string")return l===0?l:+l;l=i(l);var u=s.test(l);return u||o.test(l)?a(l.slice(2),u?2:8):n.test(l)?r:+l}return Fl=c,Fl}var jl,cf;function Gy(){if(cf)return jl;cf=1;var i=Wy(),e=1/0,t=17976931348623157e292;function r(n){if(!n)return n===0?n:0;if(n=i(n),n===e||n===-e){var s=n<0?-1:1;return s*t}return n===n?n:0}return jl=r,jl}var Bl,df;function Ky(){if(df)return Bl;df=1;var i=Gy();function e(t){var r=i(t),n=r%1;return r===r?n?r-n:r:0}return Bl=e,Bl}var ql,uf;function Xy(){if(uf)return ql;uf=1;var i=Ky(),e="Expected a function";function t(r,n){var s;if(typeof n!="function")throw new TypeError(e);return r=i(r),function(){return--r>0&&(s=n.apply(this,arguments)),r<=1&&(n=void 0),s}}return ql=t,ql}var Ul,hf;function Qy(){if(hf)return Ul;hf=1;var i=Xy();function e(t){return i(2,t)}return Ul=e,Ul}var Jy=Qy();const $i=Im(Jy);let ff=class{constructor({details:e,factory:t,options:r,results:n=[]}={}){this.details=e,this.factory=t,this.options=r,this.results=n,this._conforms=$i(()=>!this.results.some(s=>s.severity.equals(de.Info)||s.severity.equals(de.Violation)||s.severity.equals(de.Warning))),this._ptr=$i(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new To({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Qr.type],[de.ValidationReport]).addOut([de.conforms],[this.factory.literal(this.conforms.toString(),ad.boolean)]);for(const t of this.results)e.addOut([de.result],[this.factory.blankNode()],r=>{t.build(r,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Yy(i,e){return Object.entries(e).reduce((t,[r,n])=>(n&&n.termType&&(n=di(n)),t.replace(`{$${r}}`,n).replace(`{?${r}}`,n)),i)}let Zy=class{constructor({args:e={},constraintComponent:t,factory:r,focusNode:n,message:s=[],path:o,results:a=[],severity:c,shape:l,source:d=[],value:u,valuePaths:m=[]}={}){this.args=e,this.constraintComponent=t,this.factory=r,this.focusNode=n,this.path=o||l.path,this.results=a,this.severity=c,this.shape=l,this.source=d,this.value=u,this.valuePaths=m,this._message=$i(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([de.message]).terms),s.map(g=>r.literal(Yy(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Qr.type],[de.ValidationResult]).addOut([de.focusNode],this.focusNode.terms).addOut([de.resultSeverity],[this.severity]).addOut([de.sourceConstraint],this.source).addOut([de.sourceConstraintComponent],[this.constraintComponent]).addOut([de.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([de.resultMessage],this.message);const r=n=>{if(n.quantifier==="one")return n.predicates.length>1?e.node([this.factory.blankNode()]).addList([de.alternativePath],n.predicates):n.start==="object"?e.node([this.factory.blankNode()]).addOut([de.inversePath],[n.predicates[0]]):e.node([n.predicates[0]]);if(n.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([de.oneOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([de.zeroOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([de.zeroOrOnePath],[n.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([de.resultPath],r(this.path[0]).terms):e.addList([de.resultPath],this.path.map(n=>r(n).term))),typeof this.value<"u"&&e.addOut([de.value],this.value.terms),t)for(const n of this.results)e.addOut([de.detail],[this.factory.blankNode()],s=>{n.build(s,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class ld{constructor({factory:e,focusNode:t,options:r={debug:!1,details:!1},processed:n=new Set,report:s=new ff({factory:e,options:r}),results:o=new Map,shape:a,value:c,valueOrNode:l,valuePaths:d,values:u}={}){this.factory=e,this.focusNode=t,this.options=r,this.processed=n,this.report=s,this.results=o,this.shape=a,this.value=c,this.valuePaths=d,this.valueOrNode=l,this.values=u}create({child:e,focusNode:t=this.focusNode,shape:r=this.shape,value:n=this.value,valueOrNode:s=this.valueOrNode,valuePaths:o=this.valuePaths,values:a=this.values}={}){return new ld({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new ff({factory:this.factory,options:this.options}):this.report,results:this.results,shape:r,value:n,valueOrNode:s,valuePaths:o,values:a})}id({shape:e=this.shape}={}){return`${di(e.ptr.term)} - ${di(this.focusNode.term)} - ${Oy(this.valuePaths)}`}result(e){const t=new Zy({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),r=this.id();this.results.has(r)?this.results.get(r).add(t):this.results.set(r,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:oc.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:oc.Trace,constraintComponent:e,...t})}test(e,t,r){e?this.debug(t,r):this.violation(t,r)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||de.Violation,...t})}}function e0(){return{generic:t0()}}function t0(){return i=>{i.trace(oc.TraversalConstraintComponent,{args:{},message:[i.factory.literal("Traversal")],value:i.valueOrNode})}}class i0{constructor(e){this.validations=new Dn(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let r=!1;const n=new Set;for(const s of e.ptr.execute({start:"subject",end:"predicate"})){const o=this.validations.get(s.term);o&&(n.add(o),s.term.equals(de.property)&&(r=!0))}return t&&e.isPropertyShape&&!r&&n.add(e0),[...n].map(s=>s(e)).filter(Boolean)}}var Br={},qr={},ss={},os={},pf;function xn(){if(pf)return os;pf=1,Object.defineProperty(os,"__esModule",{value:!0}),os.Translator=void 0;let i=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,r,n){for(const s of r)this.supportedRdfDatatypes.push(s),this.fromRdfHandlers[s.value]=t;for(const s of n){let o=this.toRdfHandlers[s];o||(this.toRdfHandlers[s]=o=[]),o.push(t)}}fromRdf(t,r){const n=this.fromRdfHandlers[t.datatype.value];return n?n.fromRdf(t,r):t.value}toRdf(t,r){const n=this.toRdfHandlers[typeof t];if(n)for(const s of n){const o=s.toRdf(t,r);if(o)return o}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return os.Translator=i,os}var mf;function r0(){if(mf)return ss;mf=1,Object.defineProperty(ss,"__esModule",{value:!0}),ss.TypeHandlerBoolean=void 0;const i=xn();let e=class Bp{fromRdf(r,n){switch(r.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return n&&i.Translator.incorrectRdfDataType(r),!1}toRdf(r,{datatype:n,dataFactory:s}){return s.literal(r?"true":"false",n||s.namedNode(Bp.TYPE))}};return ss.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",ss}var as={},gf;function n0(){if(gf)return as;gf=1,Object.defineProperty(as,"__esModule",{value:!0}),as.TypeHandlerDate=void 0;const i=xn();let e=class ac{fromRdf(r,n){switch(n&&!r.value.match(ac.VALIDATORS[r.datatype.value.substr(33,r.datatype.value.length)])&&i.Translator.incorrectRdfDataType(r),r.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(r.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const s=r.value.split("-");return new Date(0,parseInt(s[0],10)-1,parseInt(s[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(r.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(r.value+"-01");default:return new Date(r.value)}}toRdf(r,{datatype:n,dataFactory:s}){if(n=n||s.namedNode(ac.TYPES[0]),!(r instanceof Date))return null;const o=r;let a;switch(n.value){case"http://www.w3.org/2001/XMLSchema#gDay":a=String(o.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":a=o.getUTCMonth()+1+"-"+o.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":a=String(o.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":a=o.getUTCFullYear()+"-"+(o.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":a=o.toISOString().replace(/T.*$/,"");break;default:a=o.toISOString()}return s.literal(a,n)}};return as.TypeHandlerDate=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#dateTime","http://www.w3.org/2001/XMLSchema#date","http://www.w3.org/2001/XMLSchema#gDay","http://www.w3.org/2001/XMLSchema#gMonthDay","http://www.w3.org/2001/XMLSchema#gYear","http://www.w3.org/2001/XMLSchema#gYearMonth"],e.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/},as}var ls={},bf;function s0(){if(bf)return ls;bf=1,Object.defineProperty(ls,"__esModule",{value:!0}),ls.TypeHandlerNumberDouble=void 0;const i=xn();let e=class qp{fromRdf(r,n){const s=parseFloat(r.value);return n&&isNaN(s)&&i.Translator.incorrectRdfDataType(r),s}toRdf(r,{datatype:n,dataFactory:s}){return n=n||s.namedNode(qp.TYPES[0]),isNaN(r)?s.literal("NaN",n):isFinite(r)?r%1===0?null:s.literal(r.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),n):s.literal(r>0?"INF":"-INF",n)}};return ls.TypeHandlerNumberDouble=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],ls}var cs={},yf;function o0(){if(yf)return cs;yf=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.TypeHandlerNumberInteger=void 0;const i=xn();let e=class gs{fromRdf(r,n){const s=parseInt(r.value,10);return n&&(isNaN(s)||r.value.indexOf(".")>=0)&&i.Translator.incorrectRdfDataType(r),s}toRdf(r,{datatype:n,dataFactory:s}){return s.literal(String(r),n||(r<=gs.MAX_INT&&r>=gs.MIN_INT?s.namedNode(gs.TYPES[0]):s.namedNode(gs.TYPES[1])))}};return cs.TypeHandlerNumberInteger=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#positiveInteger","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedShort"],e.MAX_INT=2147483647,e.MIN_INT=-2147483648,cs}var ds={},vf;function a0(){if(vf)return ds;vf=1,Object.defineProperty(ds,"__esModule",{value:!0}),ds.TypeHandlerString=void 0;let i=class{fromRdf(t){return t.value}toRdf(t,{datatype:r,dataFactory:n}){return n.literal(t,r)}};return ds.TypeHandlerString=i,i.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],ds}var wf;function _f(){return wf||(wf=1,function(i){var e=qr&&qr.__createBinding||(Object.create?function(r,n,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(n,s);(!a||("get"in a?!n.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return n[s]}}),Object.defineProperty(r,o,a)}:function(r,n,s,o){o===void 0&&(o=s),r[o]=n[s]}),t=qr&&qr.__exportStar||function(r,n){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(n,s)&&e(n,r,s)};Object.defineProperty(i,"__esModule",{value:!0}),t(r0(),i),t(n0(),i),t(s0(),i),t(o0(),i),t(a0(),i)}(qr)),qr}var Vl={},xf;function l0(){return xf||(xf=1,Object.defineProperty(Vl,"__esModule",{value:!0})),Vl}var Ef;function c0(){return Ef||(Ef=1,function(i){var e=Br&&Br.__createBinding||(Object.create?function(g,v,_,E){E===void 0&&(E=_);var x=Object.getOwnPropertyDescriptor(v,_);(!x||("get"in x?!v.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return v[_]}}),Object.defineProperty(g,E,x)}:function(g,v,_,E){E===void 0&&(E=_),g[E]=v[_]}),t=Br&&Br.__exportStar||function(g,v){for(var _ in g)_!=="default"&&!Object.prototype.hasOwnProperty.call(v,_)&&e(v,g,_)};Object.defineProperty(i,"__esModule",{value:!0}),i.fromRdf=c,i.toRdf=l,i.getTermRaw=d,i.getSupportedRdfDatatypes=u,i.getSupportedJavaScriptPrimitives=m;const r=Tp(),n=_f(),s=xn();t(_f(),i),t(l0(),i),t(xn(),i);const o=new r.DataFactory,a=new s.Translator;a.registerHandler(new n.TypeHandlerString,n.TypeHandlerString.TYPES.map(g=>o.namedNode(g)),["string"]),a.registerHandler(new n.TypeHandlerBoolean,[n.TypeHandlerBoolean.TYPE].map(g=>o.namedNode(g)),["boolean"]),a.registerHandler(new n.TypeHandlerNumberDouble,n.TypeHandlerNumberDouble.TYPES.map(g=>o.namedNode(g)),["number"]),a.registerHandler(new n.TypeHandlerNumberInteger,n.TypeHandlerNumberInteger.TYPES.map(g=>o.namedNode(g)),["number"]),a.registerHandler(new n.TypeHandlerDate,n.TypeHandlerDate.TYPES.map(g=>o.namedNode(g)),["object"]);function c(g,v){return a.fromRdf(g,v)}function l(g,v){return v&&"namedNode"in v&&(v={dataFactory:v}),v=v||{},v&&!v.dataFactory&&(v.dataFactory=o),a.toRdf(g,v)}function d(g,v){return g.termType==="Literal"?c(g,v):g.value}function u(){return a.getSupportedRdfDatatypes()}function m(){return a.getSupportedJavaScriptPrimitives()}}(Br)),Br}var Ns=c0();function Sf(i){if(i.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[i.term]};const e=i.out([de.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(o=>o.term)};const t=i.out([de.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const r=i.out([de.oneOrMorePath]);if(r.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[r.term]};const n=i.out([de.zeroOrMorePath]);if(n.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[n.term]};const s=i.out([de.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function d0(i){return i.terms.length===0?null:i.ptrs[0].isList()?[...i.list()].map(e=>Sf(e)):[Sf(i)]}class u0{constructor(e){this.shape=e,this._compiled=$i(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const r of this.compiled)r.node&&await r.node(t),r.generic&&await r.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const r=t.node(new wi(t.terms)),n=[...t].reduce((o,a)=>{const c=a.term,l=t.node([c]);return o.has(c)||o.set(c,{value:l,valuePaths:[]}),o.get(c).valuePaths.push(a),o},new Dn).values(),s=e.create({shape:this.shape,values:r});for(const o of this.compiled)o.property&&await o.property(s);for(const{value:o,valuePaths:a}of n){const c=e.create({shape:this.shape,value:o,valueOrNode:o,valuePaths:a});for(const l of this.compiled)l.generic&&await l.generic(c)}}}function lc(i){const e=new wi,r=new To({dataset:i.dataset,terms:i.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[Dy.subClassOf]});for(const n of r.ptrs)for(const{term:s}of n.nodes())e.add(s);return e}class h0{constructor(e){this.targetClass=new wi([...lc(e.hasOut([Qr.type],[de.NodeShape])),...lc(e.out([de.targetClass]))]),this.targetNode=e.out([de.targetNode]).terms,this.targetObjectsOf=e.out([de.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([de.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),r=[...e.focusNode.hasOut([Qr.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...t.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs],n=e.focusNode.clone({ptrs:r});return n.node([...new wi(n.terms)])}}class f0{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=$i(()=>{const r=this.ptr.out([de.deactivated]).term;return r&&Ns.fromRdf(r)}),this._message=$i(()=>this.ptr.out([de.message]).terms),this._path=$i(()=>d0(this.ptr.out([de.path]))),this._severity=$i(()=>this.ptr.out([de.severity]).term),this._shapeValidator=$i(()=>new u0(this)),this._sparql=$i(()=>this.ptr.out([de.sparql])),this._targetResolver=$i(()=>new h0(this.ptr))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!this.path}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const r of e.results.get(t))e.report.results.push(r);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function p0(i){const e=parseInt(i.ptr.out([de.maxCount]).value);return{property:m0(e)}}function m0(i){return e=>{e.test(e.values.terms.length<=i,de.MaxCountConstraintComponent,{args:{maxCount:i},message:[e.factory.literal("More than {$maxCount} values")]})}}function g0(i){const e=parseInt(i.ptr.out([de.minCount]).value);return{property:b0(e)}}function b0(i){return e=>{e.test(e.values.terms.length>=i,de.MinCountConstraintComponent,{args:{minCount:i},message:[e.factory.literal("Less than {$minCount} values")]})}}async function y0(i,e){for(const t of i)if(!await e(t))return!1;return!0}async function v0(i,e){return(await Promise.all(i.map(t=>e(t)))).filter(Boolean)}async function Qo(i,e){return Promise.all(i.map(e))}async function w0(i,e){for(const t of i)if(await e(t))return!0;return!1}function _0(i){const e=[...i.ptr.out([de.and])].flatMap(t=>[...t.list()]).map(t=>i.validator.shape(t));return{generic:x0(e)}}function x0(i){return async e=>{const t=await Qo(i,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),r=t.every(n=>n.conforms);e.test(r,de.AndConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function E0(i){const e=i.validator.shape(i.ptr.out([de.not]));return{generic:S0(e)}}function S0(i){return async e=>{const t=(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,r=!t.conforms;e.test(r,de.NotConstraintComponent,{args:{not:i.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function k0(i){const e=[...i.ptr.out([de.or])].flatMap(t=>[...t.list()]).map(t=>i.validator.shape(t));return{generic:R0(e)}}function R0(i){return async e=>{let t=[],r;if(e.options.debug||e.options.details){const n=await Qo(i,async s=>(await s.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=n.flatMap(s=>s.results),r=n.some(s=>s.conforms)}else r=await w0(i,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(r,de.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function I0(i){const e=[...i.ptr.out([de.xone])].flatMap(t=>[...t.list()]).map(t=>i.validator.shape(t));return{generic:T0(e)}}function T0(i){return async e=>{const t=await Qo(i,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),r=t.filter(n=>n.conforms).length===1;e.test(r,de.XoneConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function C0(i){if(!Ns.fromRdf(i.ptr.out([de.closed]).term))return null;const t=i.ptr.out([de.property]).map(s=>i.validator.shape(s)),r=new wi(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),n=new wi([...i.ptr.out([de.ignoredProperties]).list()||[]].map(s=>s.term));return{node:$0(r,n)}}function $0(i,e){return t=>{const r=t.focusNode.execute({start:"subject",end:"predicate"}).filter(n=>e.has(n.term)?!1:!i.has(n.term));if(r.ptrs.length>0)for(const n of r)t.violation(de.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[n.term]}],value:t.focusNode.node([[...n.quads()][0].object])});else t.debug(de.ClosedConstraintComponent)}}function A0(i){const e=i.ptr.out([de.hasValue]).term;return{node:N0(e),property:D0(e)}}function N0(i){return e=>{e.test(i.equals(e.valueOrNode.term),de.HasValueConstraintComponent,{args:{hasValue:i},message:[e.factory.literal("Value must be {$hasValue}")]})}}function D0(i){return e=>{const t=[...e.values].some(r=>i.equals(r.term));e.test(t,de.HasValueConstraintComponent,{args:{hasValue:i},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function L0(i){const e=new wi([...i.ptr.out([de.in]).list()].map(t=>t.term));return{generic:O0(e)}}function O0(i){return e=>{e.test(i.has(e.valueOrNode.term),de.InConstraintComponent,{args:{in:[...i].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function Ln(i,e){if(!i||i.termType!=="Literal"||!e||e.termType!=="Literal"||kf(i)!==kf(e))return null;const t=Ns.fromRdf(i),r=Ns.fromRdf(e);return typeof t!=typeof r?null:typeof t=="string"?t.localeCompare(r):t-r}function kf(i){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return ad.dateTime.equals(i.datatype)&&e.test(i.value)}function P0(i){const e=i.ptr.out([de.disjoint]).term;return{generic:M0(e)}}function M0(i){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,i,e.valueOrNode.term);e.test(t.size===0,de.DisjointConstraintComponent,{args:{disjoint:i},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function F0(i){const e=i.ptr.out([de.equals]).term;return{node:j0(e),property:B0(e)}}function j0(i){return e=>{const t=e.focusNode.out([i]),r=t.filter(s=>!s.term.equals(e.focusNode.term)),n=t.terms.length!==0&&r.terms.length===0;e.test(n,de.EqualsConstraintComponent,{args:{equals:i},message:[e.factory.literal("Must have same values as {$equals}")],value:r.terms[0]&&e.focusNode.node([r.terms[0]])||e.focusNode})}}function B0(i){return e=>{const t=new wi(e.focusNode.out([i]).terms),r=new wi(e.values.terms),n=[...r].filter(a=>!t.has(a)),s=[...t].filter(a=>!r.has(a)),o=[...n,...s];for(const a of o)e.violation(de.EqualsConstraintComponent,{args:{equals:i},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([a])});o.length===0&&e.debug(de.EqualsConstraintComponent,{args:{equals:i},message:[e.factory.literal("Must have same values as {$equals}")]})}}function q0(i){const e=i.ptr.out([de.lessThan]).term;return{property:U0(e)}}function U0(i){return e=>{const t=e.focusNode.out([i]).terms;for(const r of e.values)for(const n of t){const s=Ln(r.term,n);s===null||s>=0?e.violation(de.LessThanConstraintComponent,{args:{lessThan:i},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r}):e.debug(de.LessThanConstraintComponent,{args:{lessThan:i},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r})}}}function V0(i){const e=i.ptr.out([de.lessThanOrEquals]).term;return{property:z0(e)}}function z0(i){return e=>{const t=e.focusNode.out([i]).terms;for(const r of e.values)for(const n of t){const s=Ln(r.term,n);s===null||s>0?e.violation(de.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:i},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r}):e.debug(de.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:i},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r})}}}function H0(i){const e=i.ptr.out([de.maxExclusive]).term;return{generic:W0(e)}}function W0(i){return e=>{const t=Ln(e.valueOrNode.term,i);e.test(t!==null&&t<0,de.MaxExclusiveConstraintComponent,{args:{maxExclusive:i},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function G0(i){const e=i.ptr.out([de.maxInclusive]).term;return{generic:K0(e)}}function K0(i){return e=>{const t=Ln(e.valueOrNode.term,i);e.test(t!==null&&t<=0,de.MaxInclusiveConstraintComponent,{args:{maxInclusive:i},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function X0(i){const e=i.ptr.out([de.minExclusive]).term;return{generic:Q0(e)}}function Q0(i){return e=>{const t=Ln(e.valueOrNode.term,i);e.test(t!==null&&t>0,de.MinExclusiveConstraintComponent,{args:{minExclusive:i},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function J0(i){const e=i.ptr.out([de.minInclusive]).term;return{generic:Y0(e)}}function Y0(i){return e=>{const t=Ln(e.valueOrNode.term,i);e.test(t!==null&&t>=0,de.MinInclusiveConstraintComponent,{args:{minInclusive:i},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Z0(i){const e=[...i.ptr.out([de.node])].map(t=>i.validator.shape(t));return{generic:ev(e)}}function ev(i){return async e=>{for(const t of i){const r=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(r.report.conforms,de.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:r.report.results,value:e.valueOrNode})}}}function tv(i){const e=[...i.ptr.out([de.property])].map(t=>i.validator.shape(t));return{generic:iv(e)}}function iv(i){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const r of i)await r.validate(t)}}function rv(i){const e=i.validator.shape(i.ptr.out([de.qualifiedValueShape])),t=i.ptr.out([de.qualifiedValueShapesDisjoint]).term,r=t?Ns.fromRdf(t):!1,n=i.ptr.out([de.qualifiedMaxCount]).term,s=n?parseInt(n.value):null,o=i.ptr.out([de.qualifiedMinCount]).term,a=o?parseInt(o.value):null;return{property:nv(e,r,s,a)}}function nv(i,e,t,r){return async n=>{const s=[];let o=[];e&&(o=new Set(n.shape.ptr.in([de.property]).out([de.property]).out([de.qualifiedValueShape]).filter(c=>!c.term.equals(i.ptr.term)).map(c=>n.shape.validator.shape(c))));const a=(await v0(n.values,async c=>{const l=(await i.validate(n.create({child:!0,focusNode:c}))).report;if(s.push(l.results),!l.conforms)return!1;if(o.length===0)return!0;if(n.options.debug||n.options.details){const d=await Qo([...o],async u=>(await u.validate(n.create({child:!0,focusNode:c}))).report);return s.push(d.flatMap(u=>u.results)),!d.every(u=>u.conforms)}else return!await y0([...o],async d=>(await d.validate(n.create({child:!0,focusNode:c}))).report.conforms)})).length;t!==null&&n.test(a<=t,de.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:i.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),r!==null&&n.test(a>=r,de.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:r,qualifiedValueShape:i.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function sv(i,e){return e?e.slice(0,i.length)===i:!1}function ov(i){const e=[...new Set([...i.ptr.out([de.languageIn]).list()].map(t=>t.value))];return{generic:av(e)}}function av(i){return e=>{const t=i.some(r=>sv(r,e.valueOrNode.term.language));e.test(t,de.LanguageInConstraintComponent,{args:{languageIn:i.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function lv(i){const e=parseInt(i.ptr.out([de.maxLength]).value);return{generic:cv(e)}}function cv(i){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=i;e.test(t,de.MaxLengthConstraintComponent,{args:{maxLength:i},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function dv(i){const e=parseInt(i.ptr.out([de.minLength]).value);return{generic:uv(e)}}function uv(i){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=i;e.test(t,de.MinLengthConstraintComponent,{args:{minLength:i},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function hv(i){const e=i.ptr.out([de.pattern]).value,t=i.ptr.out([de.flags]).value,r=new RegExp(e,t);return{generic:fv(e,t,r)}}function fv(i,e,t){return r=>{r.test(t.test(r.valueOrNode.term.value),de.PatternConstraintComponent,{args:{flags:e,pattern:i},message:[r.factory.literal('Value does not match pattern "{$pattern}"')],value:r.valueOrNode})}}function pv(i){const e=i.ptr.out([de.uniqueLang]).term;return e.value==="true"&&ad.boolean.equals(e.datatype)?{property:mv()}:null}function mv(){return i=>{const t=Object.entries(i.values.terms.reduce((r,n)=>(n.language&&(r[n.language]=(r[n.language]||0)+1),r),{})).filter(([,r])=>r>1);for(const[r]of t)i.violation(de.UniqueLangConstraintComponent,{args:{lang:r},message:[i.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&i.debug(de.UniqueLangConstraintComponent)}}const _o=ki("http://www.w3.org/ns/shacl#"),Up=ki("https://schemas.link/shacl-next#");class En{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(_o.Info)||e.severity.equals(_o.Violation)||e.severity.equals(_o.Warning))}}function gv(i,e){return Object.entries(e).reduce((t,[r,n])=>(n&&n.termType&&(n=di(n)),t.replace(`{$${r}}`,n).replace(`{?${r}}`,n)),i)}class Co{constructor({args:e={},factory:t,message:r=[],severity:n=_o.Violation}={}){this.severity=n,this.message=r.map(s=>t.literal(gv(s.value,e),s.language||null))}}class cd{constructor({factory:e=od}={}){this.factory=e}clone({factory:e}={}){return new cd({factory:e||this.factory})}validate(){return new En}validateSimple(){return!0}}class On extends cd{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const r of Array.isArray(e)?e:[e])r&&this.datatypes.push(this.factory.fromTerm(r))}clone({factory:e}={}){return new On({datatypes:this.datatypes,factory:e||this.factory})}}class bv{constructor({factory:e=od,validations:t}={}){if(this.factory=e,this.validations=new Dn,t)for(const r of Object.values(t)){const n=r.clone({factory:this.factory});for(const s of n.datatypes)this.validations.set(s,n)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new En}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class lt extends On{constructor(e,t,{factory:r}={}){super({datatypes:t,factory:r}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new lt(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(r=>{let n;r.test(e.value)&&(n=Up.Debug);const s={pattern:this.factory.literal(r.toString()),this:e};return new Co({args:s,factory:this.factory,message:this.message,severity:n})});return new En({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const yv=/^([-+]?[0-9]+)$/;class Yt extends lt{constructor(e=null,t=null,r,{factory:n}={}){super(yv,r,{factory:n}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new Yt(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Up.Debug.equals(t[0].severity))return new En({results:t});const r=BigInt(e.value);if(this.minInclusive!==null&&r<this.minInclusive){const n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,s=[this.factory.literal(n)];t.push(new Co({factory:this.factory,message:s}))}if(this.maxInclusive!==null&&r>this.maxInclusive){const n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,s=[this.factory.literal(n)];t.push(new Co({factory:this.factory,message:s}))}return new En({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class dd extends On{constructor(e,t,{factory:r}={}){super({datatypes:t,factory:r}),this.values=new Set(e)}clone({factory:e}={}){return new dd(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const r=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,n=[this.factory.literal(r)];t.push(new Co({factory:this.factory,message:n}))}return new En({results:t})}validateSimple(e){return this.values.has(e.value)}}const We={xsd:ki("http://www.w3.org/2001/XMLSchema#")},vv=new On({datatypes:We.xsd.anySimpleType}),wv=new On({datatypes:We.xsd.anyAtomicType}),Jo=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,_v=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Vp=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,ud=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,zp=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,xv=/^((([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Ev=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Sv=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,kv=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Rv=/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Iv=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Tv=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Cv=/^(([0-9a-fA-F]{2})*)$/,$v=/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,Av=new lt(Jo,We.xsd.string),Nv=new dd(["1","true","0","false"],We.xsd.boolean),Dv=new lt(_v,We.xsd.decimal),Lv=new lt(Vp,We.xsd.float),Ov=new lt(Vp,We.xsd.double),Pv=new lt(ud,We.xsd.duration),Mv=new lt(zp,We.xsd.dateTime),Fv=new lt(xv,We.xsd.time),jv=new lt(Ev,We.xsd.date),Bv=new lt(Sv,We.xsd.gYearMonth),qv=new lt(kv,We.xsd.gYear),Uv=new lt(Rv,We.xsd.gMonthDay),Vv=new lt(Iv,We.xsd.gDay),zv=new lt(Tv,We.xsd.gMonth),Hv=new lt(Cv,We.xsd.hexBinary),Wv=new lt($v,We.xsd.base64Binary),Gv=new lt(Jo,We.xsd.anyURI),Hp=/^([^\u000d\u000a\u0009]*)$/,Kv=/^([^ ]+( [^ ]+)*)*$/,Xv=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Qv=/^([^DT]*)$/,Jv=/^([^YM]*[DT].*)$/,Yv=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Zv=new lt([Jo,Hp],We.xsd.normalizedString),ew=new lt([Jo,Hp,Kv],We.xsd.token),tw=new lt(Xv,We.xsd.language),iw=new Yt(null,null,We.xsd.integer),rw=new Yt(null,"0",We.xsd.nonPositiveInteger),nw=new Yt(null,"-1",We.xsd.negativeInteger),sw=new Yt("-9223372036854775808","9223372036854775807",We.xsd.long),ow=new Yt("-2147483648","2147483647",We.xsd.int),aw=new Yt("-32768","32767",We.xsd.short),lw=new Yt("-128","127",We.xsd.byte),cw=new Yt("0",null,We.xsd.nonNegativeInteger),dw=new Yt("0","18446744073709551615",We.xsd.unsignedLong),uw=new Yt("0","4294967295",We.xsd.unsignedInt),hw=new Yt("0","65535",We.xsd.unsignedShort),fw=new Yt("0","255",We.xsd.unsignedByte),pw=new Yt("1",null,We.xsd.positiveInteger),mw=new lt([ud,Qv],We.xsd.yearMonthDuration),gw=new lt([ud,Jv],We.xsd.dayTimeDuration),bw=new lt([zp,Yv],We.xsd.dateTimeStamp),yw=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:wv,anySimpleType:vv,anyURI:Gv,base64Binary:Wv,boolean:Nv,byte:lw,date:jv,dateTime:Mv,dateTimeStamp:bw,dayTimeDuration:gw,decimal:Dv,double:Ov,duration:Pv,float:Lv,gDay:Vv,gMonth:zv,gMonthDay:Uv,gYear:qv,gYearMonth:Bv,hexBinary:Hv,int:ow,integer:iw,language:tw,long:sw,negativeInteger:nw,nonNegativeInteger:cw,nonPositiveInteger:rw,normalizedString:Zv,positiveInteger:pw,short:aw,string:Av,time:Fv,token:ew,unsignedByte:fw,unsignedInt:uw,unsignedLong:dw,unsignedShort:hw,yearMonthDuration:mw},Symbol.toStringTag,{value:"Module"}));class vw extends bv{constructor({factory:e}={}){super({factory:e,validations:{...yw}})}}const ww=new Dn([[de.BlankNode,new Set(["BlankNode"])],[de.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[de.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[de.IRI,new Set(["NamedNode"])],[de.IRIOrLiteral,new Set(["NamedNode","Literal"])],[de.Literal,new Set(["Literal"])]]);function _w(i){const e=i.ptr.out([de.class]).map(t=>lc(t));return{generic:xw(e)}}function xw(i){return e=>{const t=new wi(e.valueOrNode.out([Qr.type]).terms);for(const r of i){const n=[...t].some(s=>r.has(s));e.test(n,de.ClassConstraintComponent,{value:e.valueOrNode})}}}function Ew(i){const e=i.ptr.out([de.datatype]).term,t=new vw;return{generic:Sw(e,t)}}function Sw(i,e){return t=>{const r=i.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(r,de.DatatypeConstraintComponent,{args:{datatype:i},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function kw(i){const e=i.ptr.out([de.nodeKind]).term,t=ww.get(e);return{generic:Rw(e,t)}}function Rw(i,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),de.NodeKindConstraintComponent,{args:{nodeKind:i},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const Iw=new Dn([[de.maxCount,p0],[de.minCount,g0],[de.and,_0],[de.not,E0],[de.or,k0],[de.xone,I0],[de.closed,C0],[de.hasValue,A0],[de.in,L0],[de.disjoint,P0],[de.equals,F0],[de.lessThan,q0],[de.lessThanOrEquals,V0],[de.maxExclusive,H0],[de.maxInclusive,G0],[de.minExclusive,X0],[de.minInclusive,J0],[de.node,Z0],[de.property,tv],[de.qualifiedValueShape,rv],[de.languageIn,ov],[de.maxLength,lv],[de.minLength,dv],[de.pattern,hv],[de.uniqueLang,pv],[de.class,_w],[de.datatype,Ew],[de.nodeKind,kw]]);class Tw{constructor(e,{factory:t,...r}){if(this.factory=t,this.options=r,this.registry=new i0(Iw),this.shapesPtr=new To({dataset:e,factory:t}),this.shapes=new Dn,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[s,o]of this.options.validations)this.registry.validations.set(s,o);const n=[...this.shapesPtr.hasOut([de.targetClass]),...this.shapesPtr.hasOut([de.targetNode]),...this.shapesPtr.hasOut([de.targetObjectsOf]),...this.shapesPtr.hasOut([de.targetSubjectsOf]),...this.shapesPtr.hasOut([Qr.type],[de.NodeShape]),...this.shapesPtr.hasOut([Qr.type],[de.PropertyShape])];for(const s of n)this.shape(s)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new f0(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const r=new To({...e,factory:this.factory}),n=new ld({factory:this.factory,focusNode:r,options:this.options,validator:this});t?t=t.map(s=>this.shape(this.shapesPtr.node(s.terms))):t=this.shapes.values();for(const s of t){const o=n.create({shape:s});let a;r.isAny()?a=s.resolveTargets(o):a=r;for(const c of a)await s.validate(o.create({focusNode:c}))}return n.report}}let Cw=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new qh(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(r=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:r.conforms,report:r}}))}).catch(r=>{console.warn(r)})})}static get observedAttributes(){return qh.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.setAttribute("loading",""),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(r=>{this.form.classList.remove(r)}),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const r of kg())r.stylesheet&&t.push(r.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new _r(e,this.config,this.config.attributes.valuesSubject?ze.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const r=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);r.addEventListener("click",n=>{n.preventDefault(),this.form.reportValidity()&&this.validate().then(s=>{if(s?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let o=this.form.querySelector(":scope .invalid > .editor");o?o.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(r)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(ze.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,ys)>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}this.removeAttribute("loading")},200)}serialize(e="text/turtle",t=this.toRDF()){const r=t.getQuads(null,null,null,null);return _g(r,e,this.config.prefixes)}toRDF(e=new jt){return this.shape?.toRDF(e),e}registerPlugin(e){Sg(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape&&(this.shape.toRDF(this.config.store),this.config.store.add(new jo(this.shape.shaclSubject,ze.namedNode(Oe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId)));try{const t=this.config.store,r=await new Tw(t,{details:!0,factory:ze}).validate({dataset:t});for(const n of r.results)if(n.focusNode?.ptrs?.length)for(const s of n.focusNode.ptrs){const o=s._term;if(n.path?.length){const a=n.path[0].predicates[0];let c=this.form.querySelectorAll(`
392
392
  :scope shacl-node[data-node-id='${o.id}'] > shacl-property > .property-instance[data-path='${a.id}'] > .editor,
393
393
  :scope shacl-node[data-node-id='${o.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${a.id}'] > .editor,
394
394
  :scope shacl-node[data-node-id='${o.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${a.id}'] > .editor,