@likec4/mcp 1.56.0 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import"../rolldown-runtime.mjs";import{t as e}from"./escape-string-regexp.mjs";const convert=(function(e){if(e==null)return ok;if(typeof e==`function`)return castFactory(e);if(typeof e==`object`)return Array.isArray(e)?anyFactory(e):propsFactory(e);if(typeof e==`string`)return typeFactory(e);throw Error(`Expected function, string, or object as test`)});function anyFactory(e){let t=[],n=-1;for(;++n<e.length;)t[n]=convert(e[n]);return castFactory(any);function any(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function propsFactory(e){let t=e;return castFactory(all);function all(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function typeFactory(e){return castFactory(type);function type(t){return t&&t.type===e}}function castFactory(e){return check;function check(t,n,r){return!!(looksLikeANode(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function ok(){return!0}function looksLikeANode(e){return typeof e==`object`&&!!e&&`type`in e}function color(e){return`\x1B[33m`+e+`\x1B[39m`}const t=[];function visitParents(e,n,r,i){let a;typeof n==`function`&&typeof r!=`function`?(i=r,r=n):a=n;let o=convert(a),s=i?-1:1;factory(e,void 0,[])();function factory(e,a,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(visit,`name`,{value:`node (`+color(e.type+(t?`<`+t+`>`:``))+`)`})}return visit;function visit(){let l=t,u,d,f;if((!n||o(e,a,c[c.length-1]||void 0))&&(l=toResult(r(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(i?t.children.length:-1)+s,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=factory(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+s}}return l}}}function toResult(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?t:[e]}function findAndReplace(e,t,n){let r=convert((n||{}).ignore||[]),i=toPairs(t),a=-1;for(;++a<i.length;)visitParents(e,`text`,visitor);function visitor(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return handler(e,t)}function handler(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function toPairs(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([toExpression(e[0]),toFunction(e[1])])}return t}function toExpression(t){return typeof t==`string`?new RegExp(e(t),`g`):t}function toFunction(e){return typeof e==`function`?e:function(){return e}}export{visitParents as n,convert as r,findAndReplace as t};
1
+ import"../rolldown-runtime.mjs";import{t as e}from"./escape-string-regexp.mjs";const convert=(function(e){if(e==null)return ok;if(typeof e==`function`)return castFactory(e);if(typeof e==`object`)return Array.isArray(e)?anyFactory(e):propsFactory(e);if(typeof e==`string`)return typeFactory(e);throw Error(`Expected function, string, or object as test`)});function anyFactory(e){let t=[],n=-1;for(;++n<e.length;)t[n]=convert(e[n]);return castFactory(any);function any(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function propsFactory(e){let t=e;return castFactory(all);function all(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function typeFactory(e){return castFactory(type);function type(t){return t&&t.type===e}}function castFactory(e){return check;function check(t,n,r){return!!(looksLikeANode(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function ok(){return!0}function looksLikeANode(e){return typeof e==`object`&&!!e&&`type`in e}function color(e){return`\x1B[33m`+e+`\x1B[39m`}const t=[];function visitParents(e,n,r,i){let a;typeof n==`function`&&typeof r!=`function`?(i=r,r=n):a=n;let o=convert(a),s=i?-1:1;factory(e,void 0,[])();function factory(e,a,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(visit,"name",{value:`node (`+color(e.type+(t?`<`+t+`>`:``))+`)`})}return visit;function visit(){let l=t,u,d,f;if((!n||o(e,a,c[c.length-1]||void 0))&&(l=toResult(r(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(i?t.children.length:-1)+s,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=factory(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+s}}return l}}}function toResult(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?t:[e]}function findAndReplace(e,t,n){let r=convert((n||{}).ignore||[]),i=toPairs(t),a=-1;for(;++a<i.length;)visitParents(e,`text`,visitor);function visitor(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return handler(e,t)}function handler(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function toPairs(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([toExpression(e[0]),toFunction(e[1])])}return t}function toExpression(t){return typeof t==`string`?new RegExp(e(t),`g`):t}function toFunction(e){return typeof e==`function`?e:function(){return e}}export{visitParents as n,convert as r,findAndReplace as t};
@@ -1,2 +1,2 @@
1
- import{i as e}from"../rolldown-runtime.mjs";import{t}from"./is-plain-obj.mjs";import{t as n}from"./is-error-instance.mjs";const normalizeDescriptors=e=>{r.forEach(t=>{i(e,t)})},r=[`name`,`message`,`stack`,`cause`,`errors`],i=e((e,t)=>{let n=getDescriptor(e,t);if(n!==void 0){if(isReadonlyGetter(n)){a(e,t,e[t]);return}isInvalidDescriptor(n)&&setErrorDescriptor(e,t,n)}},`normalizeDescriptor`),getDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?void 0:getDescriptor(r,t)},isReadonlyGetter=({get:e,set:t})=>e!==void 0&&t===void 0,isInvalidDescriptor=({enumerable:e,writable:t})=>e||!t,a=e((e,t,n)=>{setErrorDescriptor(e,t,{value:n})},`setErrorProperty`),setErrorDescriptor=(e,t,n)=>{Object.defineProperty(e,t,{...n,...`get`in n||`set`in n?{}:{writable:!0},enumerable:!1,configurable:!0})},normalizeAggregate=(e,t)=>{Array.isArray(e.errors)?a(e,`errors`,e.errors.filter(isDefined).map(t).filter(Boolean)):isAggregateError(e)?a(e,`errors`,[]):e.errors!==void 0&&deleteAggregateErrors(e)},isDefined=e=>e!==void 0,isAggregateError=e=>`AggregateError`in globalThis&&(e.name===`AggregateError`||e instanceof AggregateError),deleteAggregateErrors=e=>{delete e.errors,e.errors!==void 0&&a(e,`errors`,[])},normalizeCause=(e,t)=>{if(!(`cause`in e))return;let n=e.cause===void 0?e.cause:t(e.cause);n===void 0?delete e.cause:a(e,`cause`,n)},isNonModifiableError=e=>!Object.isExtensible(e)||r.some(t=>isNonConfigurableProp(e,t)||isThrowingProp(e,t)),isNonConfigurableProp=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&!n.configurable},isThrowingProp=(e,t)=>{try{return e[t],!1}catch{return!0}},setStack=e=>{a(e,`stack`,o(e.message,e.name))},o=e((e=``,t=`Error`)=>{let{stack:n}=new(getErrorClass(t))(e);return typeof n==`string`&&n!==``?n:`${t}: ${e}`},`getStack`),getErrorClass=e=>{let t={value:e,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},`name`,t);return Object.defineProperty(n.prototype,`name`,t),n},copyObject=e=>{let t={};for(let n of getPropsToCopy(e))try{let r=e[n],{enumerable:i,configurable:a,writable:o=!0}=getDescriptor(e,n);Object.defineProperty(t,n,{value:r,enumerable:i,configurable:a,writable:o})}catch{}return t},getPropsToCopy=e=>{let t=getOwnKeys(e);for(let n of r)isInheritedProp(e,n)&&t.push(n);return t},getOwnKeys=e=>{try{return Reflect.ownKeys(e)}catch{return[]}},isInheritedProp=(e,t)=>{try{return t in e&&!Object.hasOwn(e,t)}catch{return!1}},objectifyError=e=>{let{name:t,message:n,stack:r,cause:i,errors:a,...o}=copyObject(e),c=s(n,o),l=newError(t,c);return n===c&&assignObjectProps(l,o),Object.entries({name:t,stack:r,cause:i,errors:a}).forEach(([e,t])=>{setNewErrorProperty(l,e,t)}),r===void 0&&setStack(l),l},s=e((e,t)=>typeof e==`string`&&e!==``?e:truncateMessage(safeJsonStringify(t)),`getMessage`),safeJsonStringify=e=>{try{return JSON.stringify(e)}catch{return safeStringify(e)}},safeStringify=e=>{try{return String(e)}catch{return`Invalid error`}},truncateMessage=e=>e.length<c?e:`${e.slice(0,c)}...`,c=1e3,newError=(e,t)=>e===`AggregateError`&&`AggregateError`in globalThis?AggregateError([],t):e in l?new l[e](t):Error(t),l={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},assignObjectProps=(e,t)=>{for(let n in t)n in e||(e[n]=t[n])},setNewErrorProperty=(e,t,n)=>{n!==void 0&&a(e,t,n)},stringifyError=e=>{try{let t=Error(String(e));return setStack(t),t}catch(e){return e}},{toString:u}=Object.prototype,createError=e=>isErrorPlainObj(e)?objectifyError(e):n(e)?isInvalidError(e)?objectifyError(e):e:stringifyError(e),isErrorPlainObj=e=>{try{return t(e)}catch{return!1}},isInvalidError=e=>isProxy(e)||isNonModifiableError(e)||hasInvalidConstructor(e),isProxy=e=>{try{return u.call(e)===`[object Object]`}catch{return!0}},hasInvalidConstructor=e=>typeof e.constructor!=`function`||typeof e.constructor.name!=`string`||e.constructor.name===``||e.constructor.prototype!==Object.getPrototypeOf(e),normalizeException=(e,{shallow:t=!1}={})=>recurseException(e,[],t),recurseException=(e,t,n)=>{if(t.includes(e))return;let r=n?identity:r=>recurseException(r,[...t,e],n),i=createError(e);return normalizeProps(i,r),i},identity=e=>e,normalizeProps=(e,t)=>{normalizeName(e),normalizeMessage(e),normalizeStack(e),normalizeCause(e,t),normalizeAggregate(e,t),normalizeDescriptors(e)},normalizeName=e=>{if(d(e.name))return;let t=Object.getPrototypeOf(e).name;a(e,`name`,d(t)?t:e.constructor.name)},normalizeMessage=e=>{d(e.message)||a(e,`message`,``)},normalizeStack=e=>{d(e.stack)||setStack(e)},d=e(e=>typeof e==`string`&&e!==``,`isDefinedString`),f=e((e,t,n=e.name)=>{if(validateErrorClass(t),typeof n!=`string`)throw TypeError(`currentName must be a string: ${n}`);return n},`normalizeArgs`),validateErrorClass=e=>{if(!isClass(e))throw TypeError(`ErrorClass must be a class: ${e}`);if(!isErrorClass(e.prototype))throw TypeError(`ErrorClass must inherit from Error: ${e}`);if(!hasConstructor(e))throw TypeError(`ErrorClass must be have a valid constructor: ${e}`)},isClass=e=>typeof e==`function`&&typeof e.prototype==`object`&&e.prototype!==null,isErrorClass=e=>e!==null&&(e.name===`Error`||isErrorClass(Object.getPrototypeOf(e))),hasConstructor=e=>typeof e.prototype.constructor==`function`,p=e((e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},`setNonEnumProp`),updatePrototype=(e,t)=>{Object.getPrototypeOf(e)!==t.prototype&&(setPrototype(e,t),deleteOwnProperty(e,`constructor`),fixName(e,t))},setPrototype=(e,t)=>{Object.setPrototypeOf(e,t.prototype)},fixName=(e,t)=>{deleteOwnProperty(e,`name`);let n=getClassName(t.prototype);e.name!==n&&p(e,`name`,n)},getClassName=e=>getPrototypeName(e)??getConstructorName(e)??getClassName(Object.getPrototypeOf(e)),getPrototypeName=e=>Object.hasOwn(e,`name`)&&isDefinedString(e.name)?e.name:void 0,getConstructorName=e=>typeof e.constructor==`function`&&isDefinedString(e.constructor.name)?e.constructor.name:void 0,isDefinedString=e=>typeof e==`string`&&e!==``,deleteOwnProperty=(e,t)=>{Object.hasOwn(e,t)&&delete e[t]},m=e((e,t)=>{shouldUpdateStack(e,t)&&p(e,`stack`,g(e,t))},`updateStack`),shouldUpdateStack=(e,t)=>t!==e.name&&t!==``&&e.stack.includes(t)&&stackIncludesName(),stackIncludesName=()=>{class StackError extends Error{}let e={value:h,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(StackError,`name`,e),Object.defineProperty(StackError.prototype,`name`,e);let{stack:t}=new StackError(``);return typeof t==`string`&&t.includes(h)},h=`SetErrorClassError`,g=e(({name:e,stack:t},n)=>{if(t.startsWith(`${n}: `))return t.replace(n,e);let[r,i]=_(n,e).find(([e])=>t.includes(e));return t.replace(r,i)},`getStack`),_=e((e,t)=>[[`\n${e}: `,`\n${t}: `],[`${e}: `,`${t}: `],[`${e} `,`${t} `],[e,t]],`getReplacers`),setErrorClass=(e,t,n)=>{let r=normalizeException(e),i=f(r,t,n);return updatePrototype(r,t),m(r,i),r},mergeDescriptors=(e,t)=>t.configurable===!1?mergeNonConfig(e,t):mergeConfig(e,t),mergeNonConfig=(e,t)=>({...t,...getNonConfigWritable(e,t),...getNonConfigValue(e,t)}),getNonConfigWritable=(e,t)=>t.writable===!0&&e.writable===!1?{writable:!1}:{},getNonConfigValue=(e,t)=>e.hasValue&&`value`in t&&t.writable===!0?{value:e.value}:{},mergeConfig=(e,t)=>{let n=mergeDescriptor(e.enumerable,t.enumerable,!0),r=mergeDescriptor(e.writable,t.writable,!0),i=mergeDescriptor(e.configurable,t.configurable,!0);return{...mergeValue(e,t,r),enumerable:n,configurable:i}},mergeValue=(e,t,n)=>e.hasValue?{value:e.value,writable:n}:!hasGetSet(e)&&!hasGetSet(t)?{value:t.value,writable:n}:{get:mergeDescriptor(e.get,t.get),set:mergeDescriptor(e.set,t.set)},hasGetSet=({get:e,set:t})=>e!==void 0||t!==void 0,mergeDescriptor=(e,t,n)=>e??t??n,normalizeInput=(e,t,n)=>{if(!isAnyObj(e))throw TypeError(`Argument must be an object: ${e}`);if(!isValidKey(t))throw TypeError(`Property key must be a string, a symbol or an integer: ${t}`);return normalizeDescriptor(n)},isAnyObj=e=>typeof e==`object`&&!!e,isValidKey=e=>{let t=typeof e;return t===`string`||t===`symbol`||t===`number`},normalizeDescriptor=e=>{if(!t(e))throw TypeError(`Descriptor must be a plain object: ${e}`);let{enumerable:n,writable:r,configurable:i,value:a,get:o,set:s,...c}=e,l=`value`in e;return validateDescriptor({enumerable:n,writable:r,configurable:i,get:o,set:s,unknownProps:c,hasValue:l}),{enumerable:n,writable:r,configurable:i,value:a,get:o,set:s,hasValue:l}},validateDescriptor=({enumerable:e,writable:t,configurable:n,get:r,set:i,unknownProps:a,hasValue:o})=>{validateGetSet(o,r,`get`),validateGetSet(o,i,`set`),validateBoolean(e,`enumerable`),validateBoolean(t,`writable`),validateBoolean(n,`configurable`),validateUnknownProps(a)},validateGetSet=(e,t,n)=>{if(validateFunction(t,n),e&&t!==void 0)throw TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${t}`)},validateFunction=(e,t)=>{if(e!==void 0&&typeof e!=`function`)throw TypeError(`Descriptor property "${t}" must be a function: ${e}`)},validateBoolean=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`Descriptor property "${t}" must be a boolean: ${e}`)},validateUnknownProps=e=>{let[t]=Object.keys(e);if(t!==void 0)throw TypeError(`Unknown descriptor property "${t}": ${e[t]}`)},redefineProperty=(e,t,n)=>(setProperty(e,t,mergeDescriptors(normalizeInput(e,t,n),getCurrentDescriptor(e,t))),e),getCurrentDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?{}:getCurrentDescriptor(r,t)},setProperty=(e,t,n)=>{try{Object.defineProperty(e,t,n)}catch{}},assignProp=(e,t,n)=>{if(n!==void 0)return setProp(e,t,n);try{delete e[t]}catch{}if(e[t]!==void 0)return setProp(e,t)},setProp=(e,t,n)=>{redefineProperty(e,t,{value:n,...getNonEnum(t)})},getNonEnum=e=>typeof e==`string`&&e.startsWith(`_`)?{enumerable:!1}:{},normalizeOptions=(e,n,r={})=>{if(validateErrorOrObject(e,`First argument`),validateErrorOrObject(n,`Second argument`),!t(r))throw TypeError(`Options must be a plain object: ${r}`);let{soft:i=!1}=r;if(typeof i!=`boolean`)throw TypeError(`Option "soft" must be a boolean: ${i}`);return{soft:i}},validateErrorOrObject=(e,t)=>{if(e===void 0)throw TypeError(`${t} is required.`);if(!isErrorOrObject(e))throw TypeError(`${t} must be a plain object or an error: ${e}`)},isErrorOrObject=e=>t(e)||n(e),shouldSkipProp=({error:e,props:t,propName:n,soft:r})=>isIgnoredPropName(n)||!b.call(t,n)||r&&e[n]!==void 0,isIgnoredPropName=e=>e in v||y.has(e),v=Error(`check`),y=new Set([`prototype`,`errors`,`cause`]),{propertyIsEnumerable:b}=Object.prototype,setErrorProps=(e,t,n)=>{let{soft:r}=normalizeOptions(e,t,n);for(let n of Reflect.ownKeys(t))setErrorProp({error:e,props:t,propName:n,soft:r});return e},setErrorProp=({error:e,props:t,propName:n,soft:r})=>{shouldSkipProp({error:e,props:t,propName:n,soft:r})||assignProp(e,n,t[n])},setErrorProperty=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})},mergeAggregateCauses=(e,t)=>{e.errors!==void 0&&setErrorProperty(e,`errors`,e.errors.map(e=>t(e).error).filter(Boolean))},mergeAggregateErrors=({target:e,source:t,parent:n,child:r})=>{if(!hasErrors(e)){mergeSourceErrors(e,t);return}hasErrors(t)&&setErrorProperty(e,`errors`,[...r.errors,...n.errors])},mergeSourceErrors=(e,t)=>{t.errors!==void 0&&setErrorProperty(e,`errors`,t.errors)},hasErrors=e=>e.errors!==void 0&&e.errors.length!==0,normalizeArgs=(e,t,n=e.message)=>{if(typeof t!=`string`)throw TypeError(`newMessage must be a string: ${t}`);if(typeof n!=`string`)throw TypeError(`currentMessage must be a string: ${n}`);return n},x=e(({name:e,stack:t},n,r)=>r!==``&&t.includes(r)?replaceMessage({name:e,stack:t,newMessage:n,currentMessage:r}):insertMessage(e,t,n),`getStack`),replaceMessage=({name:e,stack:t,newMessage:n,currentMessage:r})=>{let[i,a]=getReplacers(e,n,r).find(([e])=>t.includes(e));return t.replace(i,a)},getReplacers=(e,t,n)=>[[`${e}: ${n}`,`${e}: ${t}`],[`: ${n}`,`: ${t}`],[`\n${n}`,`\n${t}`],[` ${n}`,` ${t}`],[n,t]],insertMessage=(e,t,n)=>{let r=`${e}: `,i=n.trimEnd();return t===e||t.startsWith(`${e}\n`)?t.replace(e,`${r}${i}`):t.startsWith(r)?t.replace(r,`${r}${i}\n`):`${r}${i}\n${t}`},setErrorMessage=(e,t,n)=>{let r=normalizeException(e),i=normalizeArgs(r,t,n);return setNonEnumProp(r,`message`,t),updateStack(r,t,i),r},updateStack=(e,t,n)=>{t===n||!stackIncludesMessage()||setNonEnumProp(e,`stack`,x(e,t,n))},stackIncludesMessage=()=>{let{stack:e}=Error(S);return typeof e==`string`&&e.includes(S)},S=`set-error-message test message`,setNonEnumProp=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},wrapErrorMessage=(e,t,n)=>{if(typeof t!=`string`)throw TypeError(`Second argument must be a message string: ${t}`);let r=normalizeException(e);return setErrorMessage(r,getMessage(t,r.message),n)},getMessage=(e,t)=>{let n=e.trim(),r=t.trim();return n===``?r:r===``?n:concatMessages(n,r,e)},concatMessages=(e,t,n)=>e.endsWith(C)?n.endsWith(w)?`${e}\n${t}`:`${e} ${t}`:`${t}\n${e}`,C=`:`,w=`
1
+ import{i as e}from"../rolldown-runtime.mjs";import{t}from"./is-plain-obj.mjs";import{t as n}from"./is-error-instance.mjs";const normalizeDescriptors=e=>{r.forEach(t=>{i(e,t)})},r=[`name`,`message`,`stack`,`cause`,`errors`],i=e((e,t)=>{let n=getDescriptor(e,t);if(n!==void 0){if(isReadonlyGetter(n)){a(e,t,e[t]);return}isInvalidDescriptor(n)&&setErrorDescriptor(e,t,n)}},`normalizeDescriptor`),getDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?void 0:getDescriptor(r,t)},isReadonlyGetter=({get:e,set:t})=>e!==void 0&&t===void 0,isInvalidDescriptor=({enumerable:e,writable:t})=>e||!t,a=e((e,t,n)=>{setErrorDescriptor(e,t,{value:n})},`setErrorProperty`),setErrorDescriptor=(e,t,n)=>{Object.defineProperty(e,t,{...n,...`get`in n||`set`in n?{}:{writable:!0},enumerable:!1,configurable:!0})},normalizeAggregate=(e,t)=>{Array.isArray(e.errors)?a(e,`errors`,e.errors.filter(isDefined).map(t).filter(Boolean)):isAggregateError(e)?a(e,`errors`,[]):e.errors!==void 0&&deleteAggregateErrors(e)},isDefined=e=>e!==void 0,isAggregateError=e=>`AggregateError`in globalThis&&(e.name===`AggregateError`||e instanceof AggregateError),deleteAggregateErrors=e=>{delete e.errors,e.errors!==void 0&&a(e,`errors`,[])},normalizeCause=(e,t)=>{if(!(`cause`in e))return;let n=e.cause===void 0?e.cause:t(e.cause);n===void 0?delete e.cause:a(e,`cause`,n)},isNonModifiableError=e=>!Object.isExtensible(e)||r.some(t=>isNonConfigurableProp(e,t)||isThrowingProp(e,t)),isNonConfigurableProp=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&!n.configurable},isThrowingProp=(e,t)=>{try{return e[t],!1}catch{return!0}},setStack=e=>{a(e,`stack`,o(e.message,e.name))},o=e((e=``,t=`Error`)=>{let{stack:n}=new(getErrorClass(t))(e);return typeof n==`string`&&n!==``?n:`${t}: ${e}`},`getStack`),getErrorClass=e=>{let t={value:e,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",t);return Object.defineProperty(n.prototype,"name",t),n},copyObject=e=>{let t={};for(let n of getPropsToCopy(e))try{let r=e[n],{enumerable:i,configurable:a,writable:o=!0}=getDescriptor(e,n);Object.defineProperty(t,n,{value:r,enumerable:i,configurable:a,writable:o})}catch{}return t},getPropsToCopy=e=>{let t=getOwnKeys(e);for(let n of r)isInheritedProp(e,n)&&t.push(n);return t},getOwnKeys=e=>{try{return Reflect.ownKeys(e)}catch{return[]}},isInheritedProp=(e,t)=>{try{return t in e&&!Object.hasOwn(e,t)}catch{return!1}},objectifyError=e=>{let{name:t,message:n,stack:r,cause:i,errors:a,...o}=copyObject(e),c=s(n,o),l=newError(t,c);return n===c&&assignObjectProps(l,o),Object.entries({name:t,stack:r,cause:i,errors:a}).forEach(([e,t])=>{setNewErrorProperty(l,e,t)}),r===void 0&&setStack(l),l},s=e((e,t)=>typeof e==`string`&&e!==``?e:truncateMessage(safeJsonStringify(t)),`getMessage`),safeJsonStringify=e=>{try{return JSON.stringify(e)}catch{return safeStringify(e)}},safeStringify=e=>{try{return String(e)}catch{return`Invalid error`}},truncateMessage=e=>e.length<c?e:`${e.slice(0,c)}...`,c=1e3,newError=(e,t)=>e===`AggregateError`&&`AggregateError`in globalThis?AggregateError([],t):e in l?new l[e](t):Error(t),l={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},assignObjectProps=(e,t)=>{for(let n in t)n in e||(e[n]=t[n])},setNewErrorProperty=(e,t,n)=>{n!==void 0&&a(e,t,n)},stringifyError=e=>{try{let t=Error(String(e));return setStack(t),t}catch(e){return e}},{toString:u}=Object.prototype,createError=e=>isErrorPlainObj(e)?objectifyError(e):n(e)?isInvalidError(e)?objectifyError(e):e:stringifyError(e),isErrorPlainObj=e=>{try{return t(e)}catch{return!1}},isInvalidError=e=>isProxy(e)||isNonModifiableError(e)||hasInvalidConstructor(e),isProxy=e=>{try{return u.call(e)===`[object Object]`}catch{return!0}},hasInvalidConstructor=e=>typeof e.constructor!=`function`||typeof e.constructor.name!=`string`||e.constructor.name===``||e.constructor.prototype!==Object.getPrototypeOf(e),normalizeException=(e,{shallow:t=!1}={})=>recurseException(e,[],t),recurseException=(e,t,n)=>{if(t.includes(e))return;let r=n?identity:r=>recurseException(r,[...t,e],n),i=createError(e);return normalizeProps(i,r),i},identity=e=>e,normalizeProps=(e,t)=>{normalizeName(e),normalizeMessage(e),normalizeStack(e),normalizeCause(e,t),normalizeAggregate(e,t),normalizeDescriptors(e)},normalizeName=e=>{if(d(e.name))return;let t=Object.getPrototypeOf(e).name;a(e,`name`,d(t)?t:e.constructor.name)},normalizeMessage=e=>{d(e.message)||a(e,`message`,``)},normalizeStack=e=>{d(e.stack)||setStack(e)},d=e(e=>typeof e==`string`&&e!==``,`isDefinedString`),f=e((e,t,n=e.name)=>{if(validateErrorClass(t),typeof n!=`string`)throw TypeError(`currentName must be a string: ${n}`);return n},`normalizeArgs`),validateErrorClass=e=>{if(!isClass(e))throw TypeError(`ErrorClass must be a class: ${e}`);if(!isErrorClass(e.prototype))throw TypeError(`ErrorClass must inherit from Error: ${e}`);if(!hasConstructor(e))throw TypeError(`ErrorClass must be have a valid constructor: ${e}`)},isClass=e=>typeof e==`function`&&typeof e.prototype==`object`&&e.prototype!==null,isErrorClass=e=>e!==null&&(e.name===`Error`||isErrorClass(Object.getPrototypeOf(e))),hasConstructor=e=>typeof e.prototype.constructor==`function`,p=e((e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},`setNonEnumProp`),updatePrototype=(e,t)=>{Object.getPrototypeOf(e)!==t.prototype&&(setPrototype(e,t),deleteOwnProperty(e,`constructor`),fixName(e,t))},setPrototype=(e,t)=>{Object.setPrototypeOf(e,t.prototype)},fixName=(e,t)=>{deleteOwnProperty(e,`name`);let n=getClassName(t.prototype);e.name!==n&&p(e,`name`,n)},getClassName=e=>getPrototypeName(e)??getConstructorName(e)??getClassName(Object.getPrototypeOf(e)),getPrototypeName=e=>Object.hasOwn(e,`name`)&&isDefinedString(e.name)?e.name:void 0,getConstructorName=e=>typeof e.constructor==`function`&&isDefinedString(e.constructor.name)?e.constructor.name:void 0,isDefinedString=e=>typeof e==`string`&&e!==``,deleteOwnProperty=(e,t)=>{Object.hasOwn(e,t)&&delete e[t]},m=e((e,t)=>{shouldUpdateStack(e,t)&&p(e,`stack`,g(e,t))},`updateStack`),shouldUpdateStack=(e,t)=>t!==e.name&&t!==``&&e.stack.includes(t)&&stackIncludesName(),stackIncludesName=()=>{class StackError extends Error{}let e={value:h,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(StackError,"name",e),Object.defineProperty(StackError.prototype,"name",e);let{stack:t}=new StackError(``);return typeof t==`string`&&t.includes(h)},h=`SetErrorClassError`,g=e(({name:e,stack:t},n)=>{if(t.startsWith(`${n}: `))return t.replace(n,e);let[r,i]=_(n,e).find(([e])=>t.includes(e));return t.replace(r,i)},`getStack`),_=e((e,t)=>[[`\n${e}: `,`\n${t}: `],[`${e}: `,`${t}: `],[`${e} `,`${t} `],[e,t]],`getReplacers`),setErrorClass=(e,t,n)=>{let r=normalizeException(e),i=f(r,t,n);return updatePrototype(r,t),m(r,i),r},mergeDescriptors=(e,t)=>t.configurable===!1?mergeNonConfig(e,t):mergeConfig(e,t),mergeNonConfig=(e,t)=>({...t,...getNonConfigWritable(e,t),...getNonConfigValue(e,t)}),getNonConfigWritable=(e,t)=>t.writable===!0&&e.writable===!1?{writable:!1}:{},getNonConfigValue=(e,t)=>e.hasValue&&`value`in t&&t.writable===!0?{value:e.value}:{},mergeConfig=(e,t)=>{let n=mergeDescriptor(e.enumerable,t.enumerable,!0),r=mergeDescriptor(e.writable,t.writable,!0),i=mergeDescriptor(e.configurable,t.configurable,!0);return{...mergeValue(e,t,r),enumerable:n,configurable:i}},mergeValue=(e,t,n)=>e.hasValue?{value:e.value,writable:n}:!hasGetSet(e)&&!hasGetSet(t)?{value:t.value,writable:n}:{get:mergeDescriptor(e.get,t.get),set:mergeDescriptor(e.set,t.set)},hasGetSet=({get:e,set:t})=>e!==void 0||t!==void 0,mergeDescriptor=(e,t,n)=>e??t??n,normalizeInput=(e,t,n)=>{if(!isAnyObj(e))throw TypeError(`Argument must be an object: ${e}`);if(!isValidKey(t))throw TypeError(`Property key must be a string, a symbol or an integer: ${t}`);return normalizeDescriptor(n)},isAnyObj=e=>typeof e==`object`&&!!e,isValidKey=e=>{let t=typeof e;return t===`string`||t===`symbol`||t===`number`},normalizeDescriptor=e=>{if(!t(e))throw TypeError(`Descriptor must be a plain object: ${e}`);let{enumerable:n,writable:r,configurable:i,value:a,get:o,set:s,...c}=e,l=`value`in e;return validateDescriptor({enumerable:n,writable:r,configurable:i,get:o,set:s,unknownProps:c,hasValue:l}),{enumerable:n,writable:r,configurable:i,value:a,get:o,set:s,hasValue:l}},validateDescriptor=({enumerable:e,writable:t,configurable:n,get:r,set:i,unknownProps:a,hasValue:o})=>{validateGetSet(o,r,`get`),validateGetSet(o,i,`set`),validateBoolean(e,`enumerable`),validateBoolean(t,`writable`),validateBoolean(n,`configurable`),validateUnknownProps(a)},validateGetSet=(e,t,n)=>{if(validateFunction(t,n),e&&t!==void 0)throw TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${t}`)},validateFunction=(e,t)=>{if(e!==void 0&&typeof e!=`function`)throw TypeError(`Descriptor property "${t}" must be a function: ${e}`)},validateBoolean=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`Descriptor property "${t}" must be a boolean: ${e}`)},validateUnknownProps=e=>{let[t]=Object.keys(e);if(t!==void 0)throw TypeError(`Unknown descriptor property "${t}": ${e[t]}`)},redefineProperty=(e,t,n)=>(setProperty(e,t,mergeDescriptors(normalizeInput(e,t,n),getCurrentDescriptor(e,t))),e),getCurrentDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?{}:getCurrentDescriptor(r,t)},setProperty=(e,t,n)=>{try{Object.defineProperty(e,t,n)}catch{}},assignProp=(e,t,n)=>{if(n!==void 0)return setProp(e,t,n);try{delete e[t]}catch{}if(e[t]!==void 0)return setProp(e,t)},setProp=(e,t,n)=>{redefineProperty(e,t,{value:n,...getNonEnum(t)})},getNonEnum=e=>typeof e==`string`&&e.startsWith(`_`)?{enumerable:!1}:{},normalizeOptions=(e,n,r={})=>{if(validateErrorOrObject(e,`First argument`),validateErrorOrObject(n,`Second argument`),!t(r))throw TypeError(`Options must be a plain object: ${r}`);let{soft:i=!1}=r;if(typeof i!=`boolean`)throw TypeError(`Option "soft" must be a boolean: ${i}`);return{soft:i}},validateErrorOrObject=(e,t)=>{if(e===void 0)throw TypeError(`${t} is required.`);if(!isErrorOrObject(e))throw TypeError(`${t} must be a plain object or an error: ${e}`)},isErrorOrObject=e=>t(e)||n(e),shouldSkipProp=({error:e,props:t,propName:n,soft:r})=>isIgnoredPropName(n)||!b.call(t,n)||r&&e[n]!==void 0,isIgnoredPropName=e=>e in v||y.has(e),v=Error(`check`),y=new Set([`prototype`,`errors`,`cause`]),{propertyIsEnumerable:b}=Object.prototype,setErrorProps=(e,t,n)=>{let{soft:r}=normalizeOptions(e,t,n);for(let n of Reflect.ownKeys(t))setErrorProp({error:e,props:t,propName:n,soft:r});return e},setErrorProp=({error:e,props:t,propName:n,soft:r})=>{shouldSkipProp({error:e,props:t,propName:n,soft:r})||assignProp(e,n,t[n])},setErrorProperty=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})},mergeAggregateCauses=(e,t)=>{e.errors!==void 0&&setErrorProperty(e,`errors`,e.errors.map(e=>t(e).error).filter(Boolean))},mergeAggregateErrors=({target:e,source:t,parent:n,child:r})=>{if(!hasErrors(e)){mergeSourceErrors(e,t);return}hasErrors(t)&&setErrorProperty(e,`errors`,[...r.errors,...n.errors])},mergeSourceErrors=(e,t)=>{t.errors!==void 0&&setErrorProperty(e,`errors`,t.errors)},hasErrors=e=>e.errors!==void 0&&e.errors.length!==0,normalizeArgs=(e,t,n=e.message)=>{if(typeof t!=`string`)throw TypeError(`newMessage must be a string: ${t}`);if(typeof n!=`string`)throw TypeError(`currentMessage must be a string: ${n}`);return n},x=e(({name:e,stack:t},n,r)=>r!==``&&t.includes(r)?replaceMessage({name:e,stack:t,newMessage:n,currentMessage:r}):insertMessage(e,t,n),`getStack`),replaceMessage=({name:e,stack:t,newMessage:n,currentMessage:r})=>{let[i,a]=getReplacers(e,n,r).find(([e])=>t.includes(e));return t.replace(i,a)},getReplacers=(e,t,n)=>[[`${e}: ${n}`,`${e}: ${t}`],[`: ${n}`,`: ${t}`],[`\n${n}`,`\n${t}`],[` ${n}`,` ${t}`],[n,t]],insertMessage=(e,t,n)=>{let r=`${e}: `,i=n.trimEnd();return t===e||t.startsWith(`${e}\n`)?t.replace(e,`${r}${i}`):t.startsWith(r)?t.replace(r,`${r}${i}\n`):`${r}${i}\n${t}`},setErrorMessage=(e,t,n)=>{let r=normalizeException(e),i=normalizeArgs(r,t,n);return setNonEnumProp(r,`message`,t),updateStack(r,t,i),r},updateStack=(e,t,n)=>{t===n||!stackIncludesMessage()||setNonEnumProp(e,`stack`,x(e,t,n))},stackIncludesMessage=()=>{let{stack:e}=Error(S);return typeof e==`string`&&e.includes(S)},S=`set-error-message test message`,setNonEnumProp=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},wrapErrorMessage=(e,t,n)=>{if(typeof t!=`string`)throw TypeError(`Second argument must be a message string: ${t}`);let r=normalizeException(e);return setErrorMessage(r,getMessage(t,r.message),n)},getMessage=(e,t)=>{let n=e.trim(),r=t.trim();return n===``?r:r===``?n:concatMessages(n,r,e)},concatMessages=(e,t,n)=>e.endsWith(C)?n.endsWith(w)?`${e}\n${t}`:`${e} ${t}`:`${t}\n${e}`,C=`:`,w=`
2
2
  `,mergeMessage=({parent:e,child:t,target:n,stackError:r})=>{let i=e.message,a=r.message;return n.message=t.message,wrapErrorMessage(n,i,a)},hasStack=(e,t)=>getStack(e)===t,getStack=e=>typeof e==`object`&&e?e.stack:void 0,mergeStack=({wrap:e,target:t,source:n,childHasStack:r})=>e===r?t:(setErrorProperty(t,`stack`,n.stack),n),getWrap=e=>{let{wrap:t,name:n}=e;return typeof t==`boolean`?(Object.hasOwn(e,`wrap`)&&delete e.wrap,t):n===`Error`},mergeErrorCause=e=>mergeError(e,[]).error,mergeError=(e,t)=>{if(t.includes(e))return{};let recurse=n=>mergeError(n,[...t,e]),n=getStack(e),r=normalizeException(e,{shallow:!0}),i=hasStack(r,n);mergeAggregateCauses(r,recurse);let{parent:a,childHasStack:o}=mergeCause(r,recurse);return{error:a,errorHasStack:i||o}},mergeCause=(e,t)=>{let n=getWrap(e);if(e.cause===void 0)return{parent:e,childHasStack:!1};let{error:r,errorHasStack:i}=t(e.cause);return delete e.cause,{parent:mergeChild({parent:e,child:r,childHasStack:i,wrap:n}),childHasStack:i}},mergeChild=({parent:e,child:t,childHasStack:n,wrap:r})=>{if(t===void 0)return e;let[i,a]=r?[t,e]:[e,t],o=mergeStack({wrap:r,target:i,source:a,childHasStack:n}),s=mergeMessage({parent:e,child:t,target:setErrorClass(i,i.constructor,o.name),stackError:o});return mergeAggregateErrors({target:s,source:a,parent:e,child:t}),setErrorProps(s,a,{soft:!r})};export{wrapErrorMessage as n,mergeErrorCause as t};
@@ -1 +1 @@
1
- import{c as e,t}from"../rolldown-runtime.mjs";import{a as n,i as r,o as i,r as a}from"./graphology-dag.mjs";var o=t(((e,t)=>{function DefaultMap(e){if(typeof e!=`function`)throw Error(`mnemonist/DefaultMap.constructor: expecting a function.`);this.items=new Map,this.factory=e,this.size=0}DefaultMap.prototype.clear=function(){this.items.clear(),this.size=0},DefaultMap.prototype.get=function(e){var t=this.items.get(e);return t===void 0&&(t=this.factory(e,this.size),this.items.set(e,t),this.size++),t},DefaultMap.prototype.peek=function(e){return this.items.get(e)},DefaultMap.prototype.set=function(e,t){return this.items.set(e,t),this.size=this.items.size,this},DefaultMap.prototype.has=function(e){return this.items.has(e)},DefaultMap.prototype.delete=function(e){var t=this.items.delete(e);return this.size=this.items.size,t},DefaultMap.prototype.forEach=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},DefaultMap.prototype.entries=function(){return this.items.entries()},DefaultMap.prototype.keys=function(){return this.items.keys()},DefaultMap.prototype.values=function(){return this.items.values()},typeof Symbol<`u`&&(DefaultMap.prototype[Symbol.iterator]=DefaultMap.prototype.entries),DefaultMap.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(DefaultMap.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=DefaultMap.prototype.inspect),DefaultMap.autoIncrement=function(){var e=0;return function(){return e++}},t.exports=DefaultMap})),s=t(((e,t)=>{function DefaultWeakMap(e){if(typeof e!=`function`)throw Error(`mnemonist/DefaultWeakMap.constructor: expecting a function.`);this.items=new WeakMap,this.factory=e}DefaultWeakMap.prototype.clear=function(){this.items=new WeakMap},DefaultWeakMap.prototype.get=function(e){var t=this.items.get(e);return t===void 0&&(t=this.factory(e),this.items.set(e,t)),t},DefaultWeakMap.prototype.peek=function(e){return this.items.get(e)},DefaultWeakMap.prototype.set=function(e,t){return this.items.set(e,t),this},DefaultWeakMap.prototype.has=function(e){return this.items.has(e)},DefaultWeakMap.prototype.delete=function(e){return this.items.delete(e)},DefaultWeakMap.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(DefaultWeakMap.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=DefaultWeakMap.prototype.inspect),t.exports=DefaultWeakMap})),c=t(((e,t)=>{var r=n(),a=i();function LinkedList(){this.clear()}LinkedList.prototype.clear=function(){this.head=null,this.tail=null,this.size=0},LinkedList.prototype.first=function(){return this.head?this.head.item:void 0},LinkedList.prototype.peek=LinkedList.prototype.first,LinkedList.prototype.last=function(){return this.tail?this.tail.item:void 0},LinkedList.prototype.push=function(e){var t={item:e,next:null};return this.head?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this.size++,this.size},LinkedList.prototype.unshift=function(e){var t={item:e,next:null};return this.head?(this.head.next||(this.tail=this.head),t.next=this.head,this.head=t):(this.head=t,this.tail=t),this.size++,this.size},LinkedList.prototype.shift=function(){if(this.size){var e=this.head;return this.head=e.next,this.size--,e.item}},LinkedList.prototype.forEach=function(e,t){if(this.size){t=arguments.length>1?t:this;for(var n=this.head,r=0;n;)e.call(t,n.item,r,this),n=n.next,r++}},LinkedList.prototype.toArray=function(){if(!this.size)return[];for(var e=Array(this.size),t=0,n=this.size,r=this.head;t<n;t++)e[t]=r.item,r=r.next;return e},LinkedList.prototype.values=function(){var e=this.head;return new r(function(){if(!e)return{done:!0};var t=e.item;return e=e.next,{value:t,done:!1}})},LinkedList.prototype.entries=function(){var e=this.head,t=0;return new r(function(){if(!e)return{done:!0};var n=e.item;return e=e.next,t++,{value:[t-1,n],done:!1}})},typeof Symbol<`u`&&(LinkedList.prototype[Symbol.iterator]=LinkedList.prototype.values),LinkedList.prototype.toString=function(){return this.toArray().join(`,`)},LinkedList.prototype.toJSON=function(){return this.toArray()},LinkedList.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,`constructor`,{value:LinkedList,enumerable:!1}),e},typeof Symbol<`u`&&(LinkedList.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=LinkedList.prototype.inspect),LinkedList.from=function(e){var t=new LinkedList;return a(e,function(e){t.push(e)}),t},t.exports=LinkedList})),l=t(((e,t)=>{var r=n(),a=i();function MultiMap(e){this.Container=e||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,`constructor`,{value:MultiMap,enumerable:!1})}MultiMap.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()},MultiMap.prototype.set=function(e,t){var n=this.items.get(e),r;return n||(this.dimension++,n=new this.Container,this.items.set(e,n)),this.Container===Set?(r=n.size,n.add(t),r<n.size&&this.size++):(n.push(t),this.size++),this},MultiMap.prototype.delete=function(e){var t=this.items.get(e);return t?(this.size-=this.Container===Set?t.size:t.length,this.dimension--,this.items.delete(e),!0):!1},MultiMap.prototype.remove=function(e,t){var n=this.items.get(e),r,i;return n?this.Container===Set?(r=n.delete(t),r&&this.size--,n.size===0&&(this.items.delete(e),this.dimension--),r):(i=n.indexOf(t),i===-1?!1:(this.size--,n.length===1?(this.items.delete(e),this.dimension--,!0):(n.splice(i,1),!0))):!1},MultiMap.prototype.has=function(e){return this.items.has(e)},MultiMap.prototype.get=function(e){return this.items.get(e)},MultiMap.prototype.multiplicity=function(e){var t=this.items.get(e);return t===void 0?0:this.Container===Set?t.size:t.length},MultiMap.prototype.count=MultiMap.prototype.multiplicity,MultiMap.prototype.forEach=function(e,t){t=arguments.length>1?t:this;var n;function inner(r){e.call(t,r,n)}this.items.forEach(function(e,t){n=t,e.forEach(inner)})},MultiMap.prototype.forEachAssociation=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},MultiMap.prototype.keys=function(){return this.items.keys()},MultiMap.prototype.values=function(){var e=this.items.values(),t=!1,n,i,a,o;return this.Container===Set?new r(function next(){if(!t){if(i=e.next(),i.done)return{done:!0};t=!0,n=i.value.values()}return i=n.next(),i.done?(t=!1,next()):{done:!1,value:i.value}}):new r(function next(){if(!t){if(i=e.next(),i.done)return{done:!0};t=!0,n=i.value,a=0,o=n.length}return a>=o?(t=!1,next()):{done:!1,value:n[a++]}})},MultiMap.prototype.entries=function(){var e=this.items.entries(),t=!1,n,i,a,o,s;return this.Container===Set?new r(function next(){if(!t){if(i=e.next(),i.done)return{done:!0};t=!0,a=i.value[0],n=i.value[1].values()}return i=n.next(),i.done?(t=!1,next()):{done:!1,value:[a,i.value]}}):new r(function next(){if(!t){if(i=e.next(),i.done)return{done:!0};t=!0,a=i.value[0],n=i.value[1],o=0,s=n.length}return o>=s?(t=!1,next()):{done:!1,value:[a,n[o++]]}})},MultiMap.prototype.containers=function(){return this.items.values()},MultiMap.prototype.associations=function(){return this.items.entries()},typeof Symbol<`u`&&(MultiMap.prototype[Symbol.iterator]=MultiMap.prototype.entries),MultiMap.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(MultiMap.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=MultiMap.prototype.inspect),MultiMap.prototype.toJSON=function(){return this.items},MultiMap.from=function(e,t){var n=new MultiMap(t);return a(e,function(e,t){n.set(t,e)}),n},t.exports=MultiMap})),u=t(((e,t)=>{var o=n(),s=i(),c=r(),l=a();function LRUCache(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!=`number`||this.capacity<=0)throw Error(`mnemonist/lru-cache: capacity should be positive number.`);if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw Error(`mnemonist/lru-cache: capacity should be a finite positive integer.`);var r=c.getPointerArray(n);this.forward=new r(n),this.backward=new r(n),this.K=typeof e==`function`?new e(n):Array(n),this.V=typeof t==`function`?new t(n):Array(n),this.size=0,this.head=0,this.tail=0,this.items={}}LRUCache.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},LRUCache.prototype.splayOnTop=function(e){var t=this.head;if(this.head===e)return this;var n=this.backward[e],r=this.forward[e];return this.tail===e?this.tail=n:this.backward[r]=n,this.forward[n]=r,this.backward[t]=e,this.head=e,this.forward[e]=t,this},LRUCache.prototype.set=function(e,t){var n=this.items[e];if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],delete this.items[this.K[n]]),this.items[e]=n,this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},LRUCache.prototype.setpop=function(e,t){var n=null,r=null,i=this.items[e];return i===void 0?(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],delete this.items[r]),this.items[e]=i,this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},LRUCache.prototype.has=function(e){return e in this.items},LRUCache.prototype.get=function(e){var t=this.items[e];if(t!==void 0)return this.splayOnTop(t),this.V[t]},LRUCache.prototype.peek=function(e){var t=this.items[e];if(t!==void 0)return this.V[t]},LRUCache.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.size,i=this.head,a=this.K,o=this.V,s=this.forward;n<r;)e.call(t,o[i],a[i],this),i=s[i],n++},LRUCache.prototype.keys=function(){var e=0,t=this.size,n=this.head,r=this.K,i=this.forward;return new o(function(){if(e>=t)return{done:!0};var a=r[n];return e++,e<t&&(n=i[n]),{done:!1,value:a}})},LRUCache.prototype.values=function(){var e=0,t=this.size,n=this.head,r=this.V,i=this.forward;return new o(function(){if(e>=t)return{done:!0};var a=r[n];return e++,e<t&&(n=i[n]),{done:!1,value:a}})},LRUCache.prototype.entries=function(){var e=0,t=this.size,n=this.head,r=this.K,i=this.V,a=this.forward;return new o(function(){if(e>=t)return{done:!0};var o=r[n],s=i[n];return e++,e<t&&(n=a[n]),{done:!1,value:[o,s]}})},typeof Symbol<`u`&&(LRUCache.prototype[Symbol.iterator]=LRUCache.prototype.entries),LRUCache.prototype.inspect=function(){for(var e=new Map,t=this.entries(),n;n=t.next(),!n.done;)e.set(n.value[0],n.value[1]);return Object.defineProperty(e,`constructor`,{value:LRUCache,enumerable:!1}),e},typeof Symbol<`u`&&(LRUCache.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=LRUCache.prototype.inspect),LRUCache.from=function(e,t,n,r){if(arguments.length<2){if(r=l.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var i=new LRUCache(t,n,r);return s(e,function(e,t){i.set(t,e)}),i},t.exports=LRUCache})),d=t(((e,t)=>{var n=u(),o=i(),s=r(),c=a();function LRUMap(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!=`number`||this.capacity<=0)throw Error(`mnemonist/lru-map: capacity should be positive number.`);if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw Error(`mnemonist/lru-map: capacity should be a finite positive integer.`);var r=s.getPointerArray(n);this.forward=new r(n),this.backward=new r(n),this.K=typeof e==`function`?new e(n):Array(n),this.V=typeof t==`function`?new t(n):Array(n),this.size=0,this.head=0,this.tail=0,this.items=new Map}LRUMap.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},LRUMap.prototype.set=function(e,t){var n=this.items.get(e);if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],this.items.delete(this.K[n])),this.items.set(e,n),this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},LRUMap.prototype.setpop=function(e,t){var n=null,r=null,i=this.items.get(e);return i===void 0?(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],this.items.delete(r)),this.items.set(e,i),this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},LRUMap.prototype.has=function(e){return this.items.has(e)},LRUMap.prototype.get=function(e){var t=this.items.get(e);if(t!==void 0)return this.splayOnTop(t),this.V[t]},LRUMap.prototype.peek=function(e){var t=this.items.get(e);if(t!==void 0)return this.V[t]},LRUMap.prototype.splayOnTop=n.prototype.splayOnTop,LRUMap.prototype.forEach=n.prototype.forEach,LRUMap.prototype.keys=n.prototype.keys,LRUMap.prototype.values=n.prototype.values,LRUMap.prototype.entries=n.prototype.entries,typeof Symbol<`u`&&(LRUMap.prototype[Symbol.iterator]=LRUMap.prototype.entries),LRUMap.prototype.inspect=n.prototype.inspect,LRUMap.from=function(e,t,n,r){if(arguments.length<2){if(r=c.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var i=new LRUMap(t,n,r);return o(e,function(e,t){i.set(t,e)}),i},t.exports=LRUMap})),f=t((e=>{e.intersection=function(){if(arguments.length<2)throw Error(`mnemonist/Set.intersection: needs at least two arguments.`);var e=new Set,t=1/0,n=null,r,i,a=arguments.length;for(i=0;i<a;i++){if(r=arguments[i],r.size===0)return e;r.size<t&&(t=r.size,n=r)}for(var o=n.values(),s,c,l,u;s=o.next(),!s.done;){for(c=s.value,l=!0,i=0;i<a;i++)if(u=arguments[i],u!==n&&!u.has(c)){l=!1;break}l&&e.add(c)}return e},e.union=function(){if(arguments.length<2)throw Error(`mnemonist/Set.union: needs at least two arguments.`);var e=new Set,t,n=arguments.length,r,i;for(t=0;t<n;t++)for(r=arguments[t].values();i=r.next(),!i.done;)e.add(i.value);return e},e.difference=function(e,t){if(!e.size)return new Set;if(!t.size)return new Set(e);for(var n=new Set,r=e.values(),i;i=r.next(),!i.done;)t.has(i.value)||n.add(i.value);return n},e.symmetricDifference=function(e,t){for(var n=new Set,r=e.values(),i;i=r.next(),!i.done;)t.has(i.value)||n.add(i.value);for(r=t.values();i=r.next(),!i.done;)e.has(i.value)||n.add(i.value);return n},e.isSubset=function(e,t){var n=e.values(),r;if(e===t)return!0;if(e.size>t.size)return!1;for(;r=n.next(),!r.done;)if(!t.has(r.value))return!1;return!0},e.isSuperset=function(t,n){return e.isSubset(n,t)},e.add=function(e,t){for(var n=t.values(),r;r=n.next(),!r.done;)e.add(r.value)},e.subtract=function(e,t){for(var n=t.values(),r;r=n.next(),!r.done;)e.delete(r.value)},e.intersect=function(e,t){for(var n=e.values(),r;r=n.next(),!r.done;)t.has(r.value)||e.delete(r.value)},e.disjunct=function(e,t){for(var n=e.values(),r,i=[];r=n.next(),!r.done;)t.has(r.value)&&i.push(r.value);for(n=t.values();r=n.next(),!r.done;)e.has(r.value)||e.add(r.value);for(var a=0,o=i.length;a<o;a++)e.delete(i[a])},e.intersectionSize=function(e,t){var n;if(e.size>t.size&&(n=e,e=t,t=n),e.size===0)return 0;if(e===t)return e.size;for(var r=e.values(),i,a=0;i=r.next(),!i.done;)t.has(i.value)&&a++;return a},e.unionSize=function(t,n){var r=e.intersectionSize(t,n);return t.size+n.size-r},e.jaccard=function(t,n){var r=e.intersectionSize(t,n);return r===0?0:r/(t.size+n.size-r)},e.overlap=function(t,n){var r=e.intersectionSize(t,n);return r===0?0:r/Math.min(t.size,n.size)}})),p=t(((e,t)=>{var r=n(),a=i();function Stack(){this.clear()}Stack.prototype.clear=function(){this.items=[],this.size=0},Stack.prototype.push=function(e){return this.items.push(e),++this.size},Stack.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()},Stack.prototype.peek=function(){return this.items[this.size-1]},Stack.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.items.length;n<r;n++)e.call(t,this.items[r-n-1],n,this)},Stack.prototype.toArray=function(){for(var e=Array(this.size),t=this.size-1,n=this.size;n--;)e[n]=this.items[t-n];return e},Stack.prototype.values=function(){var e=this.items,t=e.length,n=0;return new r(function(){if(n>=t)return{done:!0};var r=e[t-n-1];return n++,{value:r,done:!1}})},Stack.prototype.entries=function(){var e=this.items,t=e.length,n=0;return new r(function(){if(n>=t)return{done:!0};var r=e[t-n-1];return{value:[n++,r],done:!1}})},typeof Symbol<`u`&&(Stack.prototype[Symbol.iterator]=Stack.prototype.values),Stack.prototype.toString=function(){return this.toArray().join(`,`)},Stack.prototype.toJSON=function(){return this.toArray()},Stack.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,`constructor`,{value:Stack,enumerable:!1}),e},typeof Symbol<`u`&&(Stack.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=Stack.prototype.inspect),Stack.from=function(e){var t=new Stack;return a(e,function(e){t.push(e)}),t},Stack.of=function(){return Stack.from(arguments)},t.exports=Stack})),m=e(o(),1),h=e(s(),1),g=e(c(),1),_=e(l(),1),v=e(d(),1),y=f(),b=e(p(),1);export{_ as a,v as i,h as n,y as o,g as r,b as s,m as t};
1
+ import{c as e,t}from"../rolldown-runtime.mjs";import{i as n,r}from"./graphology-dag.mjs";var i=t((e=>{e.intersection=function(){if(arguments.length<2)throw Error(`mnemonist/Set.intersection: needs at least two arguments.`);var e=new Set,t=1/0,n=null,r,i,a=arguments.length;for(i=0;i<a;i++){if(r=arguments[i],r.size===0)return e;r.size<t&&(t=r.size,n=r)}for(var o=n.values(),s,c,l,u;s=o.next(),!s.done;){for(c=s.value,l=!0,i=0;i<a;i++)if(u=arguments[i],u!==n&&!u.has(c)){l=!1;break}l&&e.add(c)}return e},e.union=function(){if(arguments.length<2)throw Error(`mnemonist/Set.union: needs at least two arguments.`);var e=new Set,t,n=arguments.length,r,i;for(t=0;t<n;t++)for(r=arguments[t].values();i=r.next(),!i.done;)e.add(i.value);return e},e.difference=function(e,t){if(!e.size)return new Set;if(!t.size)return new Set(e);for(var n=new Set,r=e.values(),i;i=r.next(),!i.done;)t.has(i.value)||n.add(i.value);return n},e.symmetricDifference=function(e,t){for(var n=new Set,r=e.values(),i;i=r.next(),!i.done;)t.has(i.value)||n.add(i.value);for(r=t.values();i=r.next(),!i.done;)e.has(i.value)||n.add(i.value);return n},e.isSubset=function(e,t){var n=e.values(),r;if(e===t)return!0;if(e.size>t.size)return!1;for(;r=n.next(),!r.done;)if(!t.has(r.value))return!1;return!0},e.isSuperset=function(t,n){return e.isSubset(n,t)},e.add=function(e,t){for(var n=t.values(),r;r=n.next(),!r.done;)e.add(r.value)},e.subtract=function(e,t){for(var n=t.values(),r;r=n.next(),!r.done;)e.delete(r.value)},e.intersect=function(e,t){for(var n=e.values(),r;r=n.next(),!r.done;)t.has(r.value)||e.delete(r.value)},e.disjunct=function(e,t){for(var n=e.values(),r,i=[];r=n.next(),!r.done;)t.has(r.value)&&i.push(r.value);for(n=t.values();r=n.next(),!r.done;)e.has(r.value)||e.add(r.value);for(var a=0,o=i.length;a<o;a++)e.delete(i[a])},e.intersectionSize=function(e,t){var n;if(e.size>t.size&&(n=e,e=t,t=n),e.size===0)return 0;if(e===t)return e.size;for(var r=e.values(),i,a=0;i=r.next(),!i.done;)t.has(i.value)&&a++;return a},e.unionSize=function(t,n){var r=e.intersectionSize(t,n);return t.size+n.size-r},e.jaccard=function(t,n){var r=e.intersectionSize(t,n);return r===0?0:r/(t.size+n.size-r)},e.overlap=function(t,n){var r=e.intersectionSize(t,n);return r===0?0:r/Math.min(t.size,n.size)}})),a=t((e=>{var DEFAULT_COMPARATOR=function(e,t){return e<t?-1:+(e>t)},DEFAULT_REVERSE_COMPARATOR=function(e,t){return e<t?1:e>t?-1:0};function reverseComparator(e){return function(t,n){return e(n,t)}}function createTupleComparator(e){return e===2?function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:e[1]<t[1]?-1:+(e[1]>t[1])}:function(t,n){for(var r=0;r<e;){if(t[r]<n[r])return-1;if(t[r]>n[r])return 1;r++}return 0}}e.DEFAULT_COMPARATOR=DEFAULT_COMPARATOR,e.DEFAULT_REVERSE_COMPARATOR=DEFAULT_REVERSE_COMPARATOR,e.reverseComparator=reverseComparator,e.createTupleComparator=createTupleComparator})),o=t(((e,t)=>{var r=a(),i=n(),o=r.DEFAULT_COMPARATOR,s=r.reverseComparator;function FibonacciHeap(e){if(this.clear(),this.comparator=e||o,typeof this.comparator!=`function`)throw Error(`mnemonist/FibonacciHeap.constructor: given comparator should be a function.`)}FibonacciHeap.prototype.clear=function(){this.root=null,this.min=null,this.size=0};function createNode(e){return{item:e,degree:0}}function mergeWithRoot(e,t){e.root?(t.right=e.root.right,t.left=e.root,e.root.right.left=t,e.root.right=t):e.root=t}FibonacciHeap.prototype.push=function(e){var t=createNode(e);return t.left=t,t.right=t,mergeWithRoot(this,t),(!this.min||this.comparator(t.item,this.min.item)<=0)&&(this.min=t),++this.size},FibonacciHeap.prototype.peek=function(){return this.min?this.min.item:void 0};function consumeLinkedList(e){for(var t=[],n=e,r=!1;!(n===e&&r);)n===e&&(r=!0),t.push(n),n=n.right;return t}function removeFromRoot(e,t){e.root===t&&(e.root=t.right),t.left.right=t.right,t.right.left=t.left}function mergeWithChild(e,t){e.child?(t.right=e.child.right,t.left=e.child,e.child.right.left=t,e.child.right=t):e.child=t}function link(e,t,n){removeFromRoot(e,t),t.left=t,t.right=t,mergeWithChild(n,t),n.degree++,t.parent=n}function consolidate(e){var t=Array(e.size),n=consumeLinkedList(e.root),r,i,a,o,s,c;for(r=0,i=n.length;r<i;r++){for(a=n[r],s=a.degree;t[s];)o=t[s],e.comparator(a.item,o.item)>0&&(c=a,a=o,o=c),link(e,o,a),t[s]=null,s++;t[s]=a}for(r=0;r<e.size;r++)t[r]&&e.comparator(t[r].item,e.min.item)<=0&&(e.min=t[r])}FibonacciHeap.prototype.pop=function(){if(this.size){var e=this.min;if(e.child){var t=consumeLinkedList(e.child),n,r,i;for(r=0,i=t.length;r<i;r++)n=t[r],mergeWithRoot(this,n),delete n.parent}return removeFromRoot(this,e),e===e.right?(this.min=null,this.root=null):(this.min=e.right,consolidate(this)),this.size--,e.item}},FibonacciHeap.prototype.inspect=function(){var e={size:this.size};return this.min&&`item`in this.min&&(e.top=this.min.item),Object.defineProperty(e,"constructor",{value:FibonacciHeap,enumerable:!1}),e},typeof Symbol<`u`&&(FibonacciHeap.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=FibonacciHeap.prototype.inspect);function MaxFibonacciHeap(e){if(this.clear(),this.comparator=e||o,typeof this.comparator!=`function`)throw Error(`mnemonist/FibonacciHeap.constructor: given comparator should be a function.`);this.comparator=s(this.comparator)}MaxFibonacciHeap.prototype=FibonacciHeap.prototype,FibonacciHeap.from=function(e,t){var n=new FibonacciHeap(t);return i(e,function(e){n.push(e)}),n},MaxFibonacciHeap.from=function(e,t){var n=new MaxFibonacciHeap(t);return i(e,function(e){n.push(e)}),n},FibonacciHeap.MinFibonacciHeap=FibonacciHeap,FibonacciHeap.MaxFibonacciHeap=MaxFibonacciHeap,t.exports=FibonacciHeap})),s=t((e=>{var t=2**8-1,n=2**16-1,r=2**32-1,i=2**7-1,a=2**15-1,o=2**31-1;e.getPointerArray=function(e){var i=e-1;if(i<=t)return Uint8Array;if(i<=n)return Uint16Array;if(i<=r)return Uint32Array;throw Error(`mnemonist: Pointer Array of size > 4294967295 is not supported.`)},e.getSignedPointerArray=function(e){var t=e-1;return t<=i?Int8Array:t<=a?Int16Array:t<=o?Int32Array:Float64Array},e.getNumberType=function(e){return e===(e|0)?Math.sign(e)===-1?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var s={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};e.getMinimalRepresentation=function(t,n){var r=null,i=0,a,o,c,l,u;for(l=0,u=t.length;l<u;l++)c=n?n(t[l]):t[l],o=e.getNumberType(c),a=s[o.name],a>i&&(i=a,r=o);return r},e.isTypedArray=function(e){return typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e)},e.concat=function(){var e=0,t,n,r;for(t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var i=new arguments[0].constructor(e);for(t=0,n=0;t<r;t++)i.set(arguments[t],n),n+=arguments[t].length;return i},e.indices=function(t){for(var n=new(e.getPointerArray(t))(t),r=0;r<t;r++)n[r]=r;return n}})),c=t((e=>{var t=n(),r=s();function isArrayLike(e){return Array.isArray(e)||r.isTypedArray(e)}function guessLength(e){if(typeof e.length==`number`)return e.length;if(typeof e.size==`number`)return e.size}function toArray(e){var n=guessLength(e),r=typeof n==`number`?Array(n):[],i=0;return t(e,function(e){r[i++]=e}),r}function toArrayWithIndices(e){var n=guessLength(e),i=typeof n==`number`?r.getPointerArray(n):Array,a=typeof n==`number`?Array(n):[],o=typeof n==`number`?new i(n):[],s=0;return t(e,function(e){a[s]=e,o[s]=s++}),[a,o]}e.isArrayLike=isArrayLike,e.guessLength=guessLength,e.toArray=toArray,e.toArrayWithIndices=toArrayWithIndices})),l=t(((e,t)=>{var r=n(),i=a(),o=c(),s=i.DEFAULT_COMPARATOR,l=i.reverseComparator;function siftDown(e,t,n,r){for(var i=t[r],a,o;r>n;){if(a=r-1>>1,o=t[a],e(i,o)<0){t[r]=o,r=a;continue}break}t[r]=i}function siftUp(e,t,n){for(var r=t.length,i=n,a=t[n],o=2*n+1,s;o<r;)s=o+1,s<r&&e(t[o],t[s])>=0&&(o=s),t[n]=t[o],n=o,o=2*n+1;t[n]=a,siftDown(e,t,i,n)}function push(e,t,n){t.push(n),siftDown(e,t,0,t.length-1)}function pop(e,t){var n=t.pop();if(t.length!==0){var r=t[0];return t[0]=n,siftUp(e,t,0),r}return n}function replace(e,t,n){if(t.length===0)throw Error(`mnemonist/heap.replace: cannot pop an empty heap.`);var r=t[0];return t[0]=n,siftUp(e,t,0),r}function pushpop(e,t,n){var r;return t.length!==0&&e(t[0],n)<0&&(r=t[0],t[0]=n,n=r,siftUp(e,t,0)),n}function heapify(e,t){for(var n=t.length>>1;--n>=0;)siftUp(e,t,n)}function consume(e,t){for(var n=t.length,r=0,i=Array(n);r<n;)i[r++]=pop(e,t);return i}function nsmallest(e,t,n){arguments.length===2&&(n=t,t=e,e=s);var i=l(e),a,c,u,d=1/0,f;if(t===1){if(o.isArrayLike(n)){for(a=0,c=n.length;a<c;a++)u=n[a],(d===1/0||e(u,d)<0)&&(d=u);return f=new n.constructor(1),f[0]=d,f}return r(n,function(t){(d===1/0||e(t,d)<0)&&(d=t)}),[d]}if(o.isArrayLike(n)){if(t>=n.length)return n.slice().sort(e);for(f=n.slice(0,t),heapify(i,f),a=t,c=n.length;a<c;a++)i(n[a],f[0])>0&&replace(i,f,n[a]);return f.sort(e)}var p=o.guessLength(n);return p!==null&&p<t&&(t=p),f=Array(t),a=0,r(n,function(e){a<t?f[a]=e:(a===t&&heapify(i,f),i(e,f[0])>0&&replace(i,f,e)),a++}),f.length>a&&(f.length=a),f.sort(e)}function nlargest(e,t,n){arguments.length===2&&(n=t,t=e,e=s);var i=l(e),a,c,u,d=-1/0,f;if(t===1){if(o.isArrayLike(n)){for(a=0,c=n.length;a<c;a++)u=n[a],(d===-1/0||e(u,d)>0)&&(d=u);return f=new n.constructor(1),f[0]=d,f}return r(n,function(t){(d===-1/0||e(t,d)>0)&&(d=t)}),[d]}if(o.isArrayLike(n)){if(t>=n.length)return n.slice().sort(i);for(f=n.slice(0,t),heapify(e,f),a=t,c=n.length;a<c;a++)e(n[a],f[0])>0&&replace(e,f,n[a]);return f.sort(i)}var p=o.guessLength(n);return p!==null&&p<t&&(t=p),f=Array(t),a=0,r(n,function(n){a<t?f[a]=n:(a===t&&heapify(e,f),e(n,f[0])>0&&replace(e,f,n)),a++}),f.length>a&&(f.length=a),f.sort(i)}function Heap(e){if(this.clear(),this.comparator=e||s,typeof this.comparator!=`function`)throw Error(`mnemonist/Heap.constructor: given comparator should be a function.`)}Heap.prototype.clear=function(){this.items=[],this.size=0},Heap.prototype.push=function(e){return push(this.comparator,this.items,e),++this.size},Heap.prototype.peek=function(){return this.items[0]},Heap.prototype.pop=function(){return this.size!==0&&this.size--,pop(this.comparator,this.items)},Heap.prototype.replace=function(e){return replace(this.comparator,this.items,e)},Heap.prototype.pushpop=function(e){return pushpop(this.comparator,this.items,e)},Heap.prototype.consume=function(){return this.size=0,consume(this.comparator,this.items)},Heap.prototype.toArray=function(){return consume(this.comparator,this.items.slice())},Heap.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,"constructor",{value:Heap,enumerable:!1}),e},typeof Symbol<`u`&&(Heap.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=Heap.prototype.inspect);function MaxHeap(e){if(this.clear(),this.comparator=e||s,typeof this.comparator!=`function`)throw Error(`mnemonist/MaxHeap.constructor: given comparator should be a function.`);this.comparator=l(this.comparator)}MaxHeap.prototype=Heap.prototype,Heap.from=function(e,t){var n=new Heap(t),r=o.isArrayLike(e)?e.slice():o.toArray(e);return heapify(n.comparator,r),n.items=r,n.size=r.length,n},MaxHeap.from=function(e,t){var n=new MaxHeap(t),r=o.isArrayLike(e)?e.slice():o.toArray(e);return heapify(n.comparator,r),n.items=r,n.size=r.length,n},Heap.siftUp=siftUp,Heap.siftDown=siftDown,Heap.push=push,Heap.pop=pop,Heap.replace=replace,Heap.pushpop=pushpop,Heap.heapify=heapify,Heap.consume=consume,Heap.nsmallest=nsmallest,Heap.nlargest=nlargest,Heap.MinHeap=Heap,Heap.MaxHeap=MaxHeap,t.exports=Heap})),u=t(((e,t)=>{var n=``;function sort(e,t,n){for(var r=t.length,i=[],a=r,o=-1,s,c=0,l;a--;)o=Math.max(e[t[a]+n],o);for(l=o>>24&&32||o>>16&&24||o>>8&&16||8;c<l;c+=4){for(a=16;a--;)i[a]=[];for(a=r;a--;)i[e[t[a]+n]>>c&15].push(t[a]);for(s=0;s<16;s++)for(o=i[s].length;o--;)t[++a]=i[s][o]}}function compare(e,t,n,r){return e[n]-e[r]||(n%3==2?e[n+1]-e[r+1]||t[n+2]-t[r+2]:t[n+1]-t[r+1])}function build(e,t){var n=[],r=[],i=2*t/3|0,a=t-i,o=i+1>>1,s=i,c=0,l,u=[],d=[];if(t===1)return[0];for(;s--;)n[s]=(s*3>>1)+1;for(s=3;s--;)sort(e,n,s);for(c=r[(n[0]/3|0)+(n[0]%3==1?0:o)]=1,s=1;s<i;s++)(e[n[s]]!==e[n[s-1]]||e[n[s]+1]!==e[n[s-1]+1]||e[n[s]+2]!==e[n[s-1]+2])&&c++,r[(n[s]/3|0)+(n[s]%3==1?0:o)]=c;if(c<i)for(r=build(r,i),s=i;s--;)n[s]=r[s]<o?r[s]*3+1:(r[s]-o)*3+2;for(s=i;s--;)u[n[s]]=s;for(u[t]=-1,u[t+1]=-2,r=t%3==1?[t-1]:[],s=0;s<i;s++)n[s]%3==1&&r.push(n[s]-1);for(sort(e,r,0),s=0,c=0,l=0;s<i&&c<a;)d[l++]=compare(e,u,n[s],r[c])<0?n[s++]:r[c++];for(;s<i;)d[l++]=n[s++];for(;c<a;)d[l++]=r[c++];return d}function convert(e){var t=e.length,n=t%3,r=Array(t+n),i,a;if(typeof e!=`string`){var o=Object.create(null);for(a=0;a<t;a++)o[e[a]]||(o[e[a]]=!0);var s=Object.create(null),c=Object.keys(o).sort();for(a=0,i=c.length;a<i;a++)s[c[a]]=a+1;for(a=0;a<t;a++)r[a]=s[e[a]]}else for(a=0;a<t;a++)r[a]=e.charCodeAt(a);for(a=t;a<t+n;a++)r[a]=0;return r}function SuffixArray(e){this.hasArbitrarySequence=typeof e!=`string`,this.string=e,this.length=e.length,this.array=build(convert(e),this.length)}SuffixArray.prototype.toString=function(){return this.array.join(`,`)},SuffixArray.prototype.toJSON=function(){return this.array},SuffixArray.prototype.inspect=function(){for(var e=Array(this.length),t=0;t<this.length;t++)e[t]=this.string.slice(this.array[t]);return Object.defineProperty(e,"constructor",{value:SuffixArray,enumerable:!1}),e},typeof Symbol<`u`&&(SuffixArray.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=SuffixArray.prototype.inspect);function GeneralizedSuffixArray(e){if(this.hasArbitrarySequence=typeof e[0]!=`string`,this.size=e.length,this.hasArbitrarySequence){this.text=[];for(var t=0,r=this.size;t<r;t++)this.text.push.apply(this.text,e[t]),t<r-1&&this.text.push(n)}else this.text=e.join(n);this.firstLength=e[0].length,this.length=this.text.length,this.array=build(convert(this.text),this.length)}GeneralizedSuffixArray.prototype.longestCommonSubsequence=function(){var e=this.hasArbitrarySequence?[]:``,t,n,r,i,a;for(n=1;n<this.length;n++)if(i=this.array[n],a=this.array[n-1],!(i<this.firstLength&&a<this.firstLength)&&!(i>this.firstLength&&a>this.firstLength)){for(t=Math.min(this.length-i,this.length-a),r=0;r<t;r++)if(this.text[i+r]!==this.text[a+r]){t=r;break}t>e.length&&(e=this.text.slice(i,i+t))}return e},GeneralizedSuffixArray.prototype.toString=function(){return this.array.join(`,`)},GeneralizedSuffixArray.prototype.toJSON=function(){return this.array},GeneralizedSuffixArray.prototype.inspect=function(){for(var e=Array(this.length),t=0;t<this.length;t++)e[t]=this.text.slice(this.array[t]);return Object.defineProperty(e,"constructor",{value:GeneralizedSuffixArray,enumerable:!1}),e},typeof Symbol<`u`&&(GeneralizedSuffixArray.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=GeneralizedSuffixArray.prototype.inspect),SuffixArray.GeneralizedSuffixArray=GeneralizedSuffixArray,t.exports=SuffixArray})),d=t(((e,t)=>{var i=r(),a=n(),o=c(),l=s(),DEFAULT_GROWING_POLICY=function(e){return Math.max(1,Math.ceil(e*1.5))},pointerArrayFactory=function(e){return new(l.getPointerArray(e))(e)};function Vector(e,t){if(arguments.length<1)throw Error(`mnemonist/vector: expecting at least a byte array constructor.`);var n=t||0,r=DEFAULT_GROWING_POLICY,i=0,a=!1;typeof t==`object`&&(n=t.initialCapacity||0,i=t.initialLength||0,r=t.policy||r,a=t.factory===!0),this.factory=a?e:null,this.ArrayClass=e,this.length=i,this.capacity=Math.max(i,n),this.policy=r,this.array=new e(this.capacity)}Vector.prototype.set=function(e,t){if(this.length<e)throw Error(`Vector(`+this.ArrayClass.name+`).set: index out of bounds.`);return this.array[e]=t,this},Vector.prototype.get=function(e){if(!(this.length<e))return this.array[e]},Vector.prototype.applyPolicy=function(e){var t=this.policy(e||this.capacity);if(typeof t!=`number`||t<0)throw Error(`mnemonist/vector.applyPolicy: policy returned an invalid value (expecting a positive integer).`);if(t<=this.capacity)throw Error(`mnemonist/vector.applyPolicy: policy returned a less or equal capacity to allocate.`);return t},Vector.prototype.reallocate=function(e){if(e===this.capacity)return this;var t=this.array;if(e<this.length&&(this.length=e),e>this.capacity)if(this.factory===null?this.array=new this.ArrayClass(e):this.array=this.factory(e),l.isTypedArray(this.array))this.array.set(t,0);else for(var n=0,r=this.length;n<r;n++)this.array[n]=t[n];else this.array=t.slice(0,e);return this.capacity=e,this},Vector.prototype.grow=function(e){var t;if(typeof e==`number`){if(this.capacity>=e)return this;for(t=this.capacity;t<e;)t=this.applyPolicy(t);return this.reallocate(t),this}return t=this.applyPolicy(),this.reallocate(t),this},Vector.prototype.resize=function(e){return e===this.length?this:e<this.length?(this.length=e,this):(this.length=e,this.reallocate(e),this)},Vector.prototype.push=function(e){return this.capacity===this.length&&this.grow(),this.array[this.length++]=e,this.length},Vector.prototype.pop=function(){if(this.length!==0)return this.array[--this.length]},Vector.prototype.values=function(){var e=this.array,t=this.length,n=0;return new i(function(){if(n>=t)return{done:!0};var r=e[n];return n++,{value:r,done:!1}})},Vector.prototype.entries=function(){var e=this.array,t=this.length,n=0;return new i(function(){if(n>=t)return{done:!0};var r=e[n];return{value:[n++,r],done:!1}})},typeof Symbol<`u`&&(Vector.prototype[Symbol.iterator]=Vector.prototype.values),Vector.prototype.inspect=function(){var e=this.array.slice(0,this.length);return e.type=this.array.constructor.name,e.items=this.length,e.capacity=this.capacity,Object.defineProperty(e,"constructor",{value:Vector,enumerable:!1}),e},typeof Symbol<`u`&&(Vector.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=Vector.prototype.inspect),Vector.from=function(e,t,n){if(arguments.length<3&&(n=o.guessLength(e),typeof n!=`number`))throw Error(`mnemonist/vector.from: could not guess iterable length. Please provide desired capacity as last argument.`);var r=new Vector(t,n);return a(e,function(e){r.push(e)}),r};function subClass(e){var SubClass=function(t){Vector.call(this,e,t)};for(var t in Vector.prototype)Vector.prototype.hasOwnProperty(t)&&(SubClass.prototype[t]=Vector.prototype[t]);return SubClass.from=function(t,n){return Vector.from(t,e,n)},typeof Symbol<`u`&&(SubClass.prototype[Symbol.iterator]=SubClass.prototype.values),SubClass}Vector.Int8Vector=subClass(Int8Array),Vector.Uint8Vector=subClass(Uint8Array),Vector.Uint8ClampedVector=subClass(Uint8ClampedArray),Vector.Int16Vector=subClass(Int16Array),Vector.Uint16Vector=subClass(Uint16Array),Vector.Int32Vector=subClass(Int32Array),Vector.Uint32Vector=subClass(Uint32Array),Vector.Float32Vector=subClass(Float32Array),Vector.Float64Vector=subClass(Float64Array),Vector.PointerVector=subClass(pointerArrayFactory),t.exports=Vector})),f=t(((e,t)=>{function DefaultMap(e){if(typeof e!=`function`)throw Error(`mnemonist/DefaultMap.constructor: expecting a function.`);this.items=new Map,this.factory=e,this.size=0}DefaultMap.prototype.clear=function(){this.items.clear(),this.size=0},DefaultMap.prototype.get=function(e){var t=this.items.get(e);return t===void 0&&(t=this.factory(e,this.size),this.items.set(e,t),this.size++),t},DefaultMap.prototype.peek=function(e){return this.items.get(e)},DefaultMap.prototype.set=function(e,t){return this.items.set(e,t),this.size=this.items.size,this},DefaultMap.prototype.has=function(e){return this.items.has(e)},DefaultMap.prototype.delete=function(e){var t=this.items.delete(e);return this.size=this.items.size,t},DefaultMap.prototype.forEach=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},DefaultMap.prototype.entries=function(){return this.items.entries()},DefaultMap.prototype.keys=function(){return this.items.keys()},DefaultMap.prototype.values=function(){return this.items.values()},typeof Symbol<`u`&&(DefaultMap.prototype[Symbol.iterator]=DefaultMap.prototype.entries),DefaultMap.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(DefaultMap.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=DefaultMap.prototype.inspect),DefaultMap.autoIncrement=function(){var e=0;return function(){return e++}},t.exports=DefaultMap})),p=t(((e,t)=>{function DefaultWeakMap(e){if(typeof e!=`function`)throw Error(`mnemonist/DefaultWeakMap.constructor: expecting a function.`);this.items=new WeakMap,this.factory=e}DefaultWeakMap.prototype.clear=function(){this.items=new WeakMap},DefaultWeakMap.prototype.get=function(e){var t=this.items.get(e);return t===void 0&&(t=this.factory(e),this.items.set(e,t)),t},DefaultWeakMap.prototype.peek=function(e){return this.items.get(e)},DefaultWeakMap.prototype.set=function(e,t){return this.items.set(e,t),this},DefaultWeakMap.prototype.has=function(e){return this.items.has(e)},DefaultWeakMap.prototype.delete=function(e){return this.items.delete(e)},DefaultWeakMap.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(DefaultWeakMap.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=DefaultWeakMap.prototype.inspect),t.exports=DefaultWeakMap})),m=t(((e,t)=>{var i=r(),a=n();function MultiMap(e){this.Container=e||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,"constructor",{value:MultiMap,enumerable:!1})}MultiMap.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()},MultiMap.prototype.set=function(e,t){var n=this.items.get(e),r;return n||(this.dimension++,n=new this.Container,this.items.set(e,n)),this.Container===Set?(r=n.size,n.add(t),r<n.size&&this.size++):(n.push(t),this.size++),this},MultiMap.prototype.delete=function(e){var t=this.items.get(e);return t?(this.size-=this.Container===Set?t.size:t.length,this.dimension--,this.items.delete(e),!0):!1},MultiMap.prototype.remove=function(e,t){var n=this.items.get(e),r,i;return n?this.Container===Set?(r=n.delete(t),r&&this.size--,n.size===0&&(this.items.delete(e),this.dimension--),r):(i=n.indexOf(t),i===-1?!1:(this.size--,n.length===1?(this.items.delete(e),this.dimension--,!0):(n.splice(i,1),!0))):!1},MultiMap.prototype.has=function(e){return this.items.has(e)},MultiMap.prototype.get=function(e){return this.items.get(e)},MultiMap.prototype.multiplicity=function(e){var t=this.items.get(e);return t===void 0?0:this.Container===Set?t.size:t.length},MultiMap.prototype.count=MultiMap.prototype.multiplicity,MultiMap.prototype.forEach=function(e,t){t=arguments.length>1?t:this;var n;function inner(r){e.call(t,r,n)}this.items.forEach(function(e,t){n=t,e.forEach(inner)})},MultiMap.prototype.forEachAssociation=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},MultiMap.prototype.keys=function(){return this.items.keys()},MultiMap.prototype.values=function(){var e=this.items.values(),t=!1,n,r,a,o;return this.Container===Set?new i(function next(){if(!t){if(r=e.next(),r.done)return{done:!0};t=!0,n=r.value.values()}return r=n.next(),r.done?(t=!1,next()):{done:!1,value:r.value}}):new i(function next(){if(!t){if(r=e.next(),r.done)return{done:!0};t=!0,n=r.value,a=0,o=n.length}return a>=o?(t=!1,next()):{done:!1,value:n[a++]}})},MultiMap.prototype.entries=function(){var e=this.items.entries(),t=!1,n,r,a,o,s;return this.Container===Set?new i(function next(){if(!t){if(r=e.next(),r.done)return{done:!0};t=!0,a=r.value[0],n=r.value[1].values()}return r=n.next(),r.done?(t=!1,next()):{done:!1,value:[a,r.value]}}):new i(function next(){if(!t){if(r=e.next(),r.done)return{done:!0};t=!0,a=r.value[0],n=r.value[1],o=0,s=n.length}return o>=s?(t=!1,next()):{done:!1,value:[a,n[o++]]}})},MultiMap.prototype.containers=function(){return this.items.values()},MultiMap.prototype.associations=function(){return this.items.entries()},typeof Symbol<`u`&&(MultiMap.prototype[Symbol.iterator]=MultiMap.prototype.entries),MultiMap.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(MultiMap.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=MultiMap.prototype.inspect),MultiMap.prototype.toJSON=function(){return this.items},MultiMap.from=function(e,t){var n=new MultiMap(t);return a(e,function(e,t){n.set(t,e)}),n},t.exports=MultiMap})),h=t(((e,t)=>{var i=r(),a=n();function LinkedList(){this.clear()}LinkedList.prototype.clear=function(){this.head=null,this.tail=null,this.size=0},LinkedList.prototype.first=function(){return this.head?this.head.item:void 0},LinkedList.prototype.peek=LinkedList.prototype.first,LinkedList.prototype.last=function(){return this.tail?this.tail.item:void 0},LinkedList.prototype.push=function(e){var t={item:e,next:null};return this.head?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this.size++,this.size},LinkedList.prototype.unshift=function(e){var t={item:e,next:null};return this.head?(this.head.next||(this.tail=this.head),t.next=this.head,this.head=t):(this.head=t,this.tail=t),this.size++,this.size},LinkedList.prototype.shift=function(){if(this.size){var e=this.head;return this.head=e.next,this.size--,e.item}},LinkedList.prototype.forEach=function(e,t){if(this.size){t=arguments.length>1?t:this;for(var n=this.head,r=0;n;)e.call(t,n.item,r,this),n=n.next,r++}},LinkedList.prototype.toArray=function(){if(!this.size)return[];for(var e=Array(this.size),t=0,n=this.size,r=this.head;t<n;t++)e[t]=r.item,r=r.next;return e},LinkedList.prototype.values=function(){var e=this.head;return new i(function(){if(!e)return{done:!0};var t=e.item;return e=e.next,{value:t,done:!1}})},LinkedList.prototype.entries=function(){var e=this.head,t=0;return new i(function(){if(!e)return{done:!0};var n=e.item;return e=e.next,t++,{value:[t-1,n],done:!1}})},typeof Symbol<`u`&&(LinkedList.prototype[Symbol.iterator]=LinkedList.prototype.values),LinkedList.prototype.toString=function(){return this.toArray().join(`,`)},LinkedList.prototype.toJSON=function(){return this.toArray()},LinkedList.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,"constructor",{value:LinkedList,enumerable:!1}),e},typeof Symbol<`u`&&(LinkedList.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=LinkedList.prototype.inspect),LinkedList.from=function(e){var t=new LinkedList;return a(e,function(e){t.push(e)}),t},t.exports=LinkedList})),g=t(((e,t)=>{var i=r(),a=n(),o=s(),l=c();function LRUCache(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!=`number`||this.capacity<=0)throw Error(`mnemonist/lru-cache: capacity should be positive number.`);if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw Error(`mnemonist/lru-cache: capacity should be a finite positive integer.`);var r=o.getPointerArray(n);this.forward=new r(n),this.backward=new r(n),this.K=typeof e==`function`?new e(n):Array(n),this.V=typeof t==`function`?new t(n):Array(n),this.size=0,this.head=0,this.tail=0,this.items={}}LRUCache.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},LRUCache.prototype.splayOnTop=function(e){var t=this.head;if(this.head===e)return this;var n=this.backward[e],r=this.forward[e];return this.tail===e?this.tail=n:this.backward[r]=n,this.forward[n]=r,this.backward[t]=e,this.head=e,this.forward[e]=t,this},LRUCache.prototype.set=function(e,t){var n=this.items[e];if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],delete this.items[this.K[n]]),this.items[e]=n,this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},LRUCache.prototype.setpop=function(e,t){var n=null,r=null,i=this.items[e];return i===void 0?(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],delete this.items[r]),this.items[e]=i,this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},LRUCache.prototype.has=function(e){return e in this.items},LRUCache.prototype.get=function(e){var t=this.items[e];if(t!==void 0)return this.splayOnTop(t),this.V[t]},LRUCache.prototype.peek=function(e){var t=this.items[e];if(t!==void 0)return this.V[t]},LRUCache.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.size,i=this.head,a=this.K,o=this.V,s=this.forward;n<r;)e.call(t,o[i],a[i],this),i=s[i],n++},LRUCache.prototype.keys=function(){var e=0,t=this.size,n=this.head,r=this.K,a=this.forward;return new i(function(){if(e>=t)return{done:!0};var i=r[n];return e++,e<t&&(n=a[n]),{done:!1,value:i}})},LRUCache.prototype.values=function(){var e=0,t=this.size,n=this.head,r=this.V,a=this.forward;return new i(function(){if(e>=t)return{done:!0};var i=r[n];return e++,e<t&&(n=a[n]),{done:!1,value:i}})},LRUCache.prototype.entries=function(){var e=0,t=this.size,n=this.head,r=this.K,a=this.V,o=this.forward;return new i(function(){if(e>=t)return{done:!0};var i=r[n],s=a[n];return e++,e<t&&(n=o[n]),{done:!1,value:[i,s]}})},typeof Symbol<`u`&&(LRUCache.prototype[Symbol.iterator]=LRUCache.prototype.entries),LRUCache.prototype.inspect=function(){for(var e=new Map,t=this.entries(),n;n=t.next(),!n.done;)e.set(n.value[0],n.value[1]);return Object.defineProperty(e,"constructor",{value:LRUCache,enumerable:!1}),e},typeof Symbol<`u`&&(LRUCache.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=LRUCache.prototype.inspect),LRUCache.from=function(e,t,n,r){if(arguments.length<2){if(r=l.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var i=new LRUCache(t,n,r);return a(e,function(e,t){i.set(t,e)}),i},t.exports=LRUCache})),_=t(((e,t)=>{var r=g(),i=n(),a=s(),o=c();function LRUMap(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!=`number`||this.capacity<=0)throw Error(`mnemonist/lru-map: capacity should be positive number.`);if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw Error(`mnemonist/lru-map: capacity should be a finite positive integer.`);var r=a.getPointerArray(n);this.forward=new r(n),this.backward=new r(n),this.K=typeof e==`function`?new e(n):Array(n),this.V=typeof t==`function`?new t(n):Array(n),this.size=0,this.head=0,this.tail=0,this.items=new Map}LRUMap.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},LRUMap.prototype.set=function(e,t){var n=this.items.get(e);if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],this.items.delete(this.K[n])),this.items.set(e,n),this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},LRUMap.prototype.setpop=function(e,t){var n=null,r=null,i=this.items.get(e);return i===void 0?(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],this.items.delete(r)),this.items.set(e,i),this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},LRUMap.prototype.has=function(e){return this.items.has(e)},LRUMap.prototype.get=function(e){var t=this.items.get(e);if(t!==void 0)return this.splayOnTop(t),this.V[t]},LRUMap.prototype.peek=function(e){var t=this.items.get(e);if(t!==void 0)return this.V[t]},LRUMap.prototype.splayOnTop=r.prototype.splayOnTop,LRUMap.prototype.forEach=r.prototype.forEach,LRUMap.prototype.keys=r.prototype.keys,LRUMap.prototype.values=r.prototype.values,LRUMap.prototype.entries=r.prototype.entries,typeof Symbol<`u`&&(LRUMap.prototype[Symbol.iterator]=LRUMap.prototype.entries),LRUMap.prototype.inspect=r.prototype.inspect,LRUMap.from=function(e,t,n,r){if(arguments.length<2){if(r=o.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var a=new LRUMap(t,n,r);return i(e,function(e,t){a.set(t,e)}),a},t.exports=LRUMap})),v=t(((e,t)=>{var i=r(),a=n();function Stack(){this.clear()}Stack.prototype.clear=function(){this.items=[],this.size=0},Stack.prototype.push=function(e){return this.items.push(e),++this.size},Stack.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()},Stack.prototype.peek=function(){return this.items[this.size-1]},Stack.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.items.length;n<r;n++)e.call(t,this.items[r-n-1],n,this)},Stack.prototype.toArray=function(){for(var e=Array(this.size),t=this.size-1,n=this.size;n--;)e[n]=this.items[t-n];return e},Stack.prototype.values=function(){var e=this.items,t=e.length,n=0;return new i(function(){if(n>=t)return{done:!0};var r=e[t-n-1];return n++,{value:r,done:!1}})},Stack.prototype.entries=function(){var e=this.items,t=e.length,n=0;return new i(function(){if(n>=t)return{done:!0};var r=e[t-n-1];return{value:[n++,r],done:!1}})},typeof Symbol<`u`&&(Stack.prototype[Symbol.iterator]=Stack.prototype.values),Stack.prototype.toString=function(){return this.toArray().join(`,`)},Stack.prototype.toJSON=function(){return this.toArray()},Stack.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,"constructor",{value:Stack,enumerable:!1}),e},typeof Symbol<`u`&&(Stack.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=Stack.prototype.inspect),Stack.from=function(e){var t=new Stack;return a(e,function(e){t.push(e)}),t},Stack.of=function(){return Stack.from(arguments)},t.exports=Stack})),y=e(i(),1),b=e(o(),1),x=e(l(),1),S=e(u(),1),C=e(d(),1),w=e(f(),1),T=e(p(),1),E=e(h(),1),D=e(_(),1),O=e(m(),1),k=e(v(),1);b.default.MinFibonacciHeap,b.default.MaxFibonacciHeap,x.default.MinHeap,x.default.MaxHeap,S.default.GeneralizedSuffixArray,C.default.Uint8Vector,C.default.Uint8ClampedVector,C.default.Int8Vector,C.default.Uint16Vector,C.default.Int16Vector,C.default.Uint32Vector,C.default.Int32Vector,C.default.Float32Vector,C.default.Float64Vector,C.default.PointerVector;export{O as a,D as i,T as n,y as o,E as r,k as s,w as t};
@@ -1 +1 @@
1
- import{i as o}from"../rolldown-runtime.mjs";function e$24(o,s,c){let r=c=>o(c,...s);return c===void 0?r:Object.assign(r,{lazy:c,lazyArgs:s})}o(e$24,`e`);function t$47(o,s,c){let l=o.length-s.length;if(l===0)return o(...s);if(l===1)return e$24(o,s,c);throw Error(`Wrong number of arguments`)}o(t$47,`t`);function t$46(...o){return t$47(s,o)}o(t$46,`t`);const s=o((o,s)=>s.every(s=>s(o)),`n`);function t$45(...o){return t$47(c,o)}o(t$45,`t`);const c=o((o,s)=>s.some(s=>s(o)),`n`);function t$44(...o){return t$47(n$42,o)}o(t$44,`t`);function n$42(o,s){if(s<1)throw RangeError(`chunk: A chunk size of '${s.toString()}' would result in an infinite array`);if(o.length===0)return[];if(s>=o.length)return[[...o]];let c=Math.ceil(o.length/s),l=Array(c);if(s===1)for(let[s,c]of o.entries())l[s]=[c];else for(let u=0;u<c;u+=1){let c=u*s;l[u]=o.slice(c,c+s)}return l}o(n$42,`n`);function t$43(...o){return t$47(l,o)}o(t$43,`t`);const l=o((o,{min:s,max:c})=>s!==void 0&&o<s?s:c!==void 0&&o>c?c:o,`n`);function t$42(...o){return t$47(u,o)}o(t$42,`t`);const u=o((o,s)=>[...o,...s],`n`);function e$23(o){return()=>o}o(e$23,`e`);const d={done:!0,hasNext:!1},h={done:!1,hasNext:!1},g=o(()=>d,`n`),_=o(o=>({hasNext:!0,next:o,done:!1}),`r`);function t$40(o,...s){let c=o,l=s.map(o=>`lazy`in o?r$16(o):void 0),u=0;for(;u<s.length;){if(l[u]===void 0||!i$9(c)){let o=s[u];c=o(c),u+=1;continue}let o=[];for(let c=u;c<s.length;c++){let s=l[c];if(s===void 0||(o.push(s),s.isSingle))break}let d=[];for(let s of c)if(n$38(s,d,o))break;let{isSingle:h}=o.at(-1);c=h?d[0]:d,u+=o.length}return c}o(t$40,`t`);function n$38(o,s,c){if(c.length===0)return s.push(o),!1;let l=o,u=h,d=!1;for(let[o,h]of c.entries()){let{index:g,items:_}=h;if(_.push(l),u=h(l,g,_),h.index+=1,u.hasNext){if(u.hasMany??!1){for(let l of u.next)if(n$38(l,s,c.slice(o+1)))return!0;return d}l=u.next}if(!u.hasNext)break;u.done&&(d=!0)}return u.hasNext&&s.push(l),d}o(n$38,`n`);function r$16(o){let{lazy:s,lazyArgs:c}=o,l=s(...c);return Object.assign(l,{isSingle:s.single??!1,index:0,items:[]})}o(r$16,`r`);function i$9(o){return typeof o==`string`||typeof o==`object`&&!!o&&Symbol.iterator in o}o(i$9,`i`);function t$39(o,s){let c=s.length-o.length;if(c===1){let[c,...l]=s;return t$40(c,{lazy:o,lazyArgs:l})}if(c===0){let c={lazy:o,lazyArgs:s};return Object.assign(o=>t$40(o,c),c)}throw Error(`Wrong number of arguments`)}o(t$39,`t`);function r$15(...o){return t$39(i$8,o)}o(r$15,`r`);function i$8(o){if(o.length===0)return _;let s=new Map;for(let c of o)s.set(c,(s.get(c)??0)+1);return o=>{let c=s.get(o);return c===void 0||c===0?{done:!1,hasNext:!0,next:o}:(s.set(o,c-1),h)}}o(i$8,`i`);function t$38(...o){return t$47(v,o)}o(t$38,`t`);const v=o((o,s)=>o.length>=s,`n`),y={asc:(o,s)=>o>s,desc:(o,s)=>o<s};function t$37(o,s){let[c,...l]=s;if(!i$7(c))return o(c,r$14(...l));let u=r$14(c,...l);return s=>o(s,u)}o(t$37,`t`);function r$14(o,s,...c){let l=typeof o==`function`?o:o[0],u=typeof o==`function`?`asc`:o[1],{[u]:d}=y,h=s===void 0?void 0:r$14(s,...c);return(o,s)=>{let c=l(o),u=l(s);return d(c,u)?1:d(u,c)?-1:h?.(o,s)??0}}o(r$14,`r`);function i$7(o){if(b(o))return!0;if(typeof o!=`object`||!Array.isArray(o))return!1;let[s,c,...l]=o;return b(s)&&typeof c==`string`&&c in y&&l.length===0}o(i$7,`i`);const b=o(o=>typeof o==`function`&&o.length===1,`a`);function t$36(...o){return t$47(n$36,o)}o(t$36,`t`);function n$36(o,s){for(let[c,l]of o.entries())if(!s(l,c,o))return o.slice(c);return[]}o(n$36,`n`);function t$35(...o){return t$47(Object.entries,o)}o(t$35,`t`);function n$35(...o){return t$47(x,o,S)}o(n$35,`n`);const x=o((o,s)=>o.filter(s),`r`),S=o(o=>(s,c,l)=>o(s,c,l)?{done:!1,hasNext:!0,next:s}:h,`i`),C=o(o=>Object.assign(o,{single:!0}),`e`);function r$12(...o){return t$47(w,o,C(T))}o(r$12,`r`);const w=o((o,s)=>o.find(s),`i`),T=o(o=>(s,c,l)=>o(s,c,l)?{done:!0,hasNext:!0,next:s}:h,`a`);function t$34(...o){return t$47(E,o)}o(t$34,`t`);const E=o((o,s)=>{for(let c=o.length-1;c>=0;c--){let l=o[c];if(s(l,c,o))return l}},`n`);function n$33(...o){return t$47(D,o,C(O))}o(n$33,`n`);const D=o(([o])=>o,`r`),O=o(()=>k,`i`),k=o(o=>({hasNext:!0,next:o,done:!0}),`a`);function n$32(o,s){return typeof o==`object`?A(o,s):e$24(A,o===void 0?[]:[o],j)}o(n$32,`n`);const A=o((o,s)=>s===void 0?o.flat():o.flat(s),`r`),j=o(o=>o===void 0||o===1?M:o<=0?_:s=>Array.isArray(s)?{next:s.flat(o-1),hasNext:!0,hasMany:!0,done:!1}:{next:s,hasNext:!0,done:!1},`i`),M=o(o=>Array.isArray(o)?{next:o,hasNext:!0,hasMany:!0,done:!1}:{next:o,hasNext:!0,done:!1},`a`);function t$33(...o){return t$47(N,o,P)}o(t$33,`t`);const N=o((o,s)=>o.flatMap(s),`n`),P=o(o=>(s,c,l)=>{let u=o(s,c,l);return Array.isArray(u)?{done:!1,hasNext:!0,hasMany:!0,next:u}:{done:!1,hasNext:!0,next:u}},`r`);function t$32(...o){return t$47(n$30,o,F)}o(t$32,`t`);function n$30(o,s){return o.forEach(s),o}o(n$30,`n`);const F=o(o=>(s,c,l)=>(o(s,c,l),{done:!1,hasNext:!0,next:s}),`r`);function t$31(...o){return t$47(n$29,o)}o(t$31,`t`);function n$29(o,s){for(let[c,l]of Object.entries(o))s(l,c,o);return o}o(n$29,`n`);const I=Symbol(`funnel/voidReducer`),L=o(()=>I,`t`);function n$28(o,{triggerAt:s=`end`,minQuietPeriodMs:c,maxBurstDurationMs:l,minGapMs:u,reducer:d=L}){let h,g,_,v,f=()=>{let s=_;s!==void 0&&(_=void 0,s===I?o():o(s),u!==void 0&&(g=setTimeout(p,u)))},p=()=>{clearTimeout(g),g=void 0,h===void 0&&f()},m=()=>{clearTimeout(h),h=void 0,v=void 0,g===void 0&&f()};return{call:(...o)=>{let y=h===void 0&&g===void 0;if((s!==`start`||y)&&(_=d(_,...o)),!(h===void 0&&!y)){if(c!==void 0||l!==void 0||u===void 0){clearTimeout(h);let o=Date.now();v??=o;let s=l===void 0?c??0:Math.min(c??l,Math.max(0,l-(o-v)));h=setTimeout(m,s)}s!==`end`&&y&&f()}},cancel:()=>{clearTimeout(h),h=void 0,v=void 0,clearTimeout(g),g=void 0,_=void 0},flush:()=>{m(),p()},get isIdle(){return h===void 0&&g===void 0}}}o(n$28,`n`);function t$29(...o){return t$47(R,o)}o(t$29,`t`);const R=o((o,s)=>{let c=Object.create(null);for(let l=0;l<o.length;l++){let u=o[l],d=s(u,l,o);if(d!==void 0){let o=c[d];o===void 0?c[d]=[u]:o.push(u)}}return Object.setPrototypeOf(c,Object.prototype),c},`n`);function t$28(...o){return t$47(n$26,o)}o(t$28,`t`);function n$26(o,s){let c=Object.create(null);for(let l of o){let o=l?.[s];if(o!==void 0){let s=c[o];s===void 0?c[o]=[l]:s.push(l)}}return Object.setPrototypeOf(c,Object.prototype),c}o(n$26,`n`);function t$27(...o){return t$47(n$25,o)}o(t$27,`t`);function n$25(o,s){if(o===s||Object.is(o,s))return!0;if(typeof o!=`object`||typeof s!=`object`||o===null||s===null||Object.getPrototypeOf(o)!==Object.getPrototypeOf(s))return!1;if(Array.isArray(o))return r$7(o,s);if(o instanceof Map)return i$2(o,s);if(o instanceof Set)return a(o,s);if(o instanceof Date)return o.getTime()===s.getTime();if(o instanceof RegExp)return o.toString()===s.toString();if(Object.keys(o).length!==Object.keys(s).length)return!1;for(let[c,l]of Object.entries(o))if(!(c in s)||!n$25(l,s[c]))return!1;return!0}o(n$25,`n`);function r$7(o,s){if(o.length!==s.length)return!1;for(let[c,l]of o.entries())if(!n$25(l,s[c]))return!1;return!0}o(r$7,`r`);function i$2(o,s){if(o.size!==s.size)return!1;for(let[c,l]of o.entries())if(!s.has(c)||!n$25(l,s.get(c)))return!1;return!0}o(i$2,`i`);function a(o,s){if(o.size!==s.size)return!1;let c=[...s];for(let s of o){let o=!1;for(let[l,u]of c.entries())if(n$25(s,u)){o=!0,c.splice(l,1);break}if(!o)return!1}return!0}function e$18(){return z}o(e$18,`e`);const z=o(o=>o,`t`);function t$25(...o){return t$47(n$24,o)}o(t$25,`t`);function n$24(o,s){let c={};for(let[l,u]of o.entries()){let d=s(u,l,o);c[d]=u}return c}o(n$24,`n`);function e$17(o){return Array.isArray(o)}o(e$17,`e`);function e$16(o){return typeof o==`boolean`}o(e$16,`e`);function e$15(o){return o!==void 0}o(e$15,`e`);function e$14(o){return o===``||o===void 0?!0:Array.isArray(o)?o.length===0:Object.keys(o).length===0}o(e$14,`e`);function e$13(o){if(o==null||o===``)return!0;if(typeof o!=`object`)return!1;if(`length`in o&&typeof o.length==`number`)return o.length===0;if(`size`in o&&typeof o.size==`number`)return o.size===0;for(let s in o)return!1;return Object.getOwnPropertySymbols(o).length===0}o(e$13,`e`);const B=o(o=>typeof o==`function`,`e`);function e$11(o){return o!=null}o(e$11,`e`);function e$10(o){return s=>!o(s)}o(e$10,`e`);function e$9(o){return o==null}o(e$9,`e`);function e$8(o){return typeof o==`number`&&!Number.isNaN(o)}o(e$8,`e`);function e$7(o){return o instanceof Promise}o(e$7,`e`);function t$24(...o){return t$47(n$23,o)}o(t$24,`t`);function n$23(o,s){if(o===s||Object.is(o,s))return!0;if(typeof o!=`object`||!o||typeof s!=`object`||!s)return!1;if(o instanceof Map&&s instanceof Map)return r$6(o,s);if(o instanceof Set&&s instanceof Set)return i$1(o,s);let c=Object.keys(o);if(c.length!==Object.keys(s).length)return!1;for(let l of c){if(!Object.hasOwn(s,l))return!1;let{[l]:c}=o,{[l]:u}=s;if(c!==u||!Object.is(c,u))return!1}return!0}o(n$23,`n`);function r$6(o,s){if(o.size!==s.size)return!1;for(let[c,l]of o){let o=s.get(c);if(l!==o||!Object.is(l,o))return!1}return!0}o(r$6,`r`);function i$1(o,s){if(o.size!==s.size)return!1;for(let c of o)if(!s.has(c))return!1;return!0}o(i$1,`i`);function e$6(o){return typeof o==`string`}o(e$6,`e`);function e$5(o){return!!o}o(e$5,`e`);function t$23(...o){return t$47(V,o)}o(t$23,`t`);const V=o((o,s)=>o.join(s),`n`);function t$22(...o){return t$47(Object.keys,o)}o(t$22,`t`);function t$21(...o){return t$47(H,o)}o(t$21,`t`);const H=o(o=>o.at(-1),`n`);function t$20(...o){return t$47(U,o,W)}o(t$20,`t`);const U=o((o,s)=>o.map(s),`n`),W=o(o=>(s,c,l)=>({done:!1,hasNext:!0,next:o(s,c,l)}),`r`);function t$19(...o){return t$47(n$19,o)}o(t$19,`t`);function n$19(o,s){let c={};for(let[l,u]of o.entries()){let[d,h]=s(u,l,o);c[d]=h}return c}o(n$19,`n`);function t$18(...o){return t$47(n$18,o)}o(t$18,`t`);function n$18(o,s){let c={};for(let[l,u]of Object.entries(o))c[l]=s(u,l,o);return c}o(n$18,`n`);function n$17(...o){return t$47(r$4,o)}o(n$17,`n`);function r$4(o,s){if(!t$38(s,1))return{...o};if(!t$38(s,2)){let{[s[0]]:c,...l}=o;return l}let c={...o};for(let o of s)delete c[o];return c}o(r$4,`r`);function t$17(...o){return t$47(n$16,o)}o(t$17,`t`);function n$16(o,s){let c={...o};for(let[l,u]of Object.entries(c))s(u,l,o)&&delete c[l];return c}o(n$16,`n`);function e$4(o){let s=!1,c;return()=>(s||=(c=o(),!0),c)}o(e$4,`e`);function t$16(...o){return t$47(G,o)}o(t$16,`t`);const G=o(o=>o.length===1?o[0]:void 0,`n`);function t$15(...o){return t$47(K,o)}o(t$15,`t`);const K=o((o,s)=>{let c=[[],[]];for(let[l,u]of o.entries())s(u,l,o)?c[0].push(u):c[1].push(u);return c},`n`);function t$14(...o){return t$47(n$13,o)}o(t$14,`t`);function n$13(o,s){let c={};for(let l of s)l in o&&(c[l]=o[l]);return c}o(n$13,`n`);function t$13(...o){return t$47(n$12,o)}o(t$13,`t`);function n$12(o,s){let c={};for(let[l,u]of Object.entries(o))s(u,l,o)&&(c[l]=u);return c}o(n$12,`n`);function t$12(...o){return s=>t$40(s,...o)}o(t$12,`t`);function e$3(o,...s){return typeof o==`string`||typeof o==`number`||typeof o==`symbol`?c=>t$11(c,o,...s):t$11(o,...s)}o(e$3,`e`);function t$11(o,...s){let c=o;for(let o of s){if(c==null)return;c=c[o]}return c}o(t$11,`t`);function t$10(...o){return t$47(n$11,o)}o(t$10,`t`);function n$11(o,s,c){let l={};for(let[u,d]of o.entries()){let h=s(d,u,o);l[h]=c(d,u,o)}return l}o(n$11,`n`);function e$2(o,s){let c=Math.ceil(o),l=Math.floor(s);if(l<c)throw RangeError(`randomInteger: The range [${o.toString()},${s.toString()}] contains no integer`);return Math.floor(Math.random()*(l-c+1)+c)}o(e$2,`e`);function t$9(...o){return t$47(n$10,o)}o(t$9,`t`);function n$10(o){let s=[];for(let c=0;c<o;c++){let o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(Math.random()*62)];s.push(o)}return s.join(``)}o(n$10,`n`);function t$8(...o){return t$47(q,o)}o(t$8,`t`);const q=o((o,s,c)=>o.reduce(s,c),`n`);function t$7(...o){return t$47(n$8,o)}o(t$7,`t`);function n$8(o){return[...o].reverse()}o(n$8,`n`);function t$6(...o){return t$47(n$7,o)}o(t$6,`t`);function n$7(o,s){let c=[...o];return c.sort(s),c}o(n$7,`n`);function t$5(...o){return t$37(J,o)}o(t$5,`t`);const J=o((o,s)=>[...o].sort(s),`n`);function e$1(o,s,c){return typeof s==`number`||s===void 0?c=>c.split(o,s):o.split(s,c)}o(e$1,`e`);function n$5(...o){return t$47(Y,o,i)}o(n$5,`n`);const Y=o((o,s)=>s<0?[]:o.slice(0,s),`r`);function i(o){if(o<=0)return g;let s=o;return o=>(--s,{done:s<=0,hasNext:!0,next:o})}function t$4(...o){return t$47(n$4,o)}o(t$4,`t`);function n$4(o,s){let c=[];for(let[l,u]of o.entries()){if(!s(u,l,o))break;c.push(u)}return c}o(n$4,`n`);function t$3(...o){return t$47(n$3,o)}o(t$3,`t`);function n$3(o,s){return s(o),o}o(n$3,`n`);function n$2(...o){return t$39(r$2,o)}o(n$2,`n`);function r$2(){let o=new Set;return s=>o.has(s)?h:(o.add(s),{done:!1,hasNext:!0,next:s})}o(r$2,`r`);function n$1(...o){return t$39(r$1,o)}o(n$1,`n`);function r$1(o){let s=o,c=new Set;return(o,l,u)=>{let d=s(o,l,u);return c.has(d)?h:(c.add(d),{done:!1,hasNext:!0,next:o})}}o(r$1,`r`);function t$2(...o){return t$47(Object.values,o)}o(t$2,`t`);function e(...o){return o.length===2?(s,...c)=>X(s,...o,...c):X(...o)}const X=o((o,s,c,...l)=>s(o,...l)?typeof c==`function`?c(o,...l):c.onTrue(o,...l):typeof c==`function`?o:c.onFalse(o,...l),`t`);function t(...o){return t$47(n,o,r)}const n=(o,s)=>o.length<s.length?o.map((o,c)=>[o,s[c]]):s.map((s,c)=>[o[c],s]),r=o=>(s,c)=>({hasNext:!0,next:[s,o[c]],done:c>=o.length-1});export{t$32 as $,t$22 as A,B,e$4 as C,t$19 as D,t$18 as E,e$7 as F,e$17 as G,e$14 as H,e$8 as I,t$27 as J,t$25 as K,e$9 as L,e$5 as M,e$6 as N,t$20 as O,t$24 as P,t$31 as Q,e$10 as R,t$16 as S,n$17 as T,e$15 as U,e$13 as V,e$16 as W,t$29 as X,t$28 as Y,n$28 as Z,e$3 as _,t$47 as _t,n$2 as a,n$35 as at,t$14 as b,n$5 as c,t$38 as ct,t$6 as d,e$23 as dt,t$33 as et,t$7 as f,t$42 as ft,t$10 as g,t$46 as gt,e$2 as h,t$45 as ht,n$1 as i,r$12 as it,t$23 as j,t$21 as k,e$1 as l,r$15 as lt,t$9 as m,t$44 as mt,e as n,n$33 as nt,t$3 as o,t$35 as ot,t$8 as p,t$43 as pt,e$18 as q,t$2 as r,t$34 as rt,t$4 as s,t$36 as st,t,n$32 as tt,t$5 as u,t$40 as ut,t$12 as v,t$17 as w,t$15 as x,t$13 as y,e$11 as z};
1
+ import{i as o}from"../rolldown-runtime.mjs";function e$25(o,s,c){let r=c=>o(c,...s);return c===void 0?r:Object.assign(r,{lazy:c,lazyArgs:s})}o(e$25,`e`);function t$47(o,s,c){let l=o.length-s.length;if(l===0)return o(...s);if(l===1)return e$25(o,s,c);throw Error(`Wrong number of arguments`)}o(t$47,`t`);function t$46(...o){return t$47(s,o)}o(t$46,`t`);const s=o((o,s)=>s.every(s=>s(o)),`n`);function t$45(...o){return t$47(c,o)}o(t$45,`t`);const c=o((o,s)=>s.some(s=>s(o)),`n`);function t$44(...o){return t$47(n$42,o)}o(t$44,`t`);function n$42(o,s){if(s<1)throw RangeError(`chunk: A chunk size of '${s.toString()}' would result in an infinite array`);if(o.length===0)return[];if(s>=o.length)return[[...o]];let c=Math.ceil(o.length/s),l=Array(c);if(s===1)for(let[s,c]of o.entries())l[s]=[c];else for(let u=0;u<c;u+=1){let c=u*s;l[u]=o.slice(c,c+s)}return l}o(n$42,`n`);function t$43(...o){return t$47(l,o)}o(t$43,`t`);const l=o((o,{min:s,max:c})=>s!==void 0&&o<s?s:c!==void 0&&o>c?c:o,`n`);function t$42(...o){return t$47(u,o)}o(t$42,`t`);const u=o((o,s)=>[...o,...s],`n`);function e$24(o){return()=>o}o(e$24,`e`);const d={done:!0,hasNext:!1},h={done:!1,hasNext:!1},g=o(()=>d,`n`),_=o(o=>({hasNext:!0,next:o,done:!1}),`r`);function t$40(o,...s){let c=o,l=s.map(o=>`lazy`in o?r$16(o):void 0),u=0;for(;u<s.length;){if(l[u]===void 0||!i$9(c)){let o=s[u];c=o(c),u+=1;continue}let o=[];for(let c=u;c<s.length;c++){let s=l[c];if(s===void 0||(o.push(s),s.isSingle))break}let d=[];for(let s of c)if(n$38(s,d,o))break;let{isSingle:h}=o.at(-1);c=h?d[0]:d,u+=o.length}return c}o(t$40,`t`);function n$38(o,s,c){if(c.length===0)return s.push(o),!1;let l=o,u=h,d=!1;for(let[o,h]of c.entries()){let{index:g,items:_}=h;if(_.push(l),u=h(l,g,_),h.index+=1,u.hasNext){if(u.hasMany??!1){for(let l of u.next)if(n$38(l,s,c.slice(o+1)))return!0;return d}l=u.next}if(!u.hasNext)break;u.done&&(d=!0)}return u.hasNext&&s.push(l),d}o(n$38,`n`);function r$16(o){let{lazy:s,lazyArgs:c}=o,l=s(...c);return Object.assign(l,{isSingle:s.single??!1,index:0,items:[]})}o(r$16,`r`);function i$9(o){return typeof o==`string`||typeof o==`object`&&!!o&&Symbol.iterator in o}o(i$9,`i`);function t$39(o,s){let c=s.length-o.length;if(c===1){let[c,...l]=s;return t$40(c,{lazy:o,lazyArgs:l})}if(c===0){let c={lazy:o,lazyArgs:s};return Object.assign(o=>t$40(o,c),c)}throw Error(`Wrong number of arguments`)}o(t$39,`t`);function r$15(...o){return t$39(i$8,o)}o(r$15,`r`);function i$8(o){if(o.length===0)return _;let s=new Map;for(let c of o)s.set(c,(s.get(c)??0)+1);return o=>{let c=s.get(o);return c===void 0||c===0?{done:!1,hasNext:!0,next:o}:(s.set(o,c-1),h)}}o(i$8,`i`);function t$38(...o){return t$47(v,o)}o(t$38,`t`);const v=o((o,s)=>o.length>=s,`n`),y={asc:(o,s)=>o>s,desc:(o,s)=>o<s};function t$37(o,s){let[c,...l]=s;if(!i$7(c))return o(c,r$14(...l));let u=r$14(c,...l);return s=>o(s,u)}o(t$37,`t`);function r$14(o,s,...c){let l=typeof o==`function`?o:o[0],u=typeof o==`function`?`asc`:o[1],{[u]:d}=y,h=s===void 0?void 0:r$14(s,...c);return(o,s)=>{let c=l(o),u=l(s);return d(c,u)?1:d(u,c)?-1:h?.(o,s)??0}}o(r$14,`r`);function i$7(o){if(b(o))return!0;if(typeof o!=`object`||!Array.isArray(o))return!1;let[s,c,...l]=o;return b(s)&&typeof c==`string`&&c in y&&l.length===0}o(i$7,`i`);const b=o(o=>typeof o==`function`&&o.length===1,`a`);function t$36(...o){return t$47(n$36,o)}o(t$36,`t`);function n$36(o,s){for(let[c,l]of o.entries())if(!s(l,c,o))return o.slice(c);return[]}o(n$36,`n`);function t$35(...o){return t$47(Object.entries,o)}o(t$35,`t`);function n$35(...o){return t$47(x,o,S)}o(n$35,`n`);const x=o((o,s)=>o.filter(s),`r`),S=o(o=>(s,c,l)=>o(s,c,l)?{done:!1,hasNext:!0,next:s}:h,`i`),C=o(o=>Object.assign(o,{single:!0}),`e`);function r$12(...o){return t$47(w,o,C(T))}o(r$12,`r`);const w=o((o,s)=>o.find(s),`i`),T=o(o=>(s,c,l)=>o(s,c,l)?{done:!0,hasNext:!0,next:s}:h,`a`);function t$34(...o){return t$47(E,o)}o(t$34,`t`);const E=o((o,s)=>{for(let c=o.length-1;c>=0;c--){let l=o[c];if(s(l,c,o))return l}},`n`);function n$33(...o){return t$47(D,o,C(O))}o(n$33,`n`);const D=o(([o])=>o,`r`),O=o(()=>k,`i`),k=o(o=>({hasNext:!0,next:o,done:!0}),`a`);function n$32(o,s){return typeof o==`object`?A(o,s):e$25(A,o===void 0?[]:[o],j)}o(n$32,`n`);const A=o((o,s)=>s===void 0?o.flat():o.flat(s),`r`),j=o(o=>o===void 0||o===1?M:o<=0?_:s=>Array.isArray(s)?{next:s.flat(o-1),hasNext:!0,hasMany:!0,done:!1}:{next:s,hasNext:!0,done:!1},`i`),M=o(o=>Array.isArray(o)?{next:o,hasNext:!0,hasMany:!0,done:!1}:{next:o,hasNext:!0,done:!1},`a`);function t$33(...o){return t$47(N,o,P)}o(t$33,`t`);const N=o((o,s)=>o.flatMap(s),`n`),P=o(o=>(s,c,l)=>{let u=o(s,c,l);return Array.isArray(u)?{done:!1,hasNext:!0,hasMany:!0,next:u}:{done:!1,hasNext:!0,next:u}},`r`);function t$32(...o){return t$47(n$30,o,F)}o(t$32,`t`);function n$30(o,s){return o.forEach(s),o}o(n$30,`n`);const F=o(o=>(s,c,l)=>(o(s,c,l),{done:!1,hasNext:!0,next:s}),`r`);function t$31(...o){return t$47(n$29,o)}o(t$31,`t`);function n$29(o,s){for(let[c,l]of Object.entries(o))s(l,c,o);return o}o(n$29,`n`);const I=Symbol(`funnel/voidReducer`),L=o(()=>I,`t`);function n$28(o,{triggerAt:s=`end`,minQuietPeriodMs:c,maxBurstDurationMs:l,minGapMs:u,reducer:d=L}){let h,g,_,v,f=()=>{let s=_;s!==void 0&&(_=void 0,s===I?o():o(s),u!==void 0&&(g=setTimeout(p,u)))},p=()=>{clearTimeout(g),g=void 0,h===void 0&&f()},m=()=>{clearTimeout(h),h=void 0,v=void 0,g===void 0&&f()};return{call:(...o)=>{let y=h===void 0&&g===void 0;if((s!==`start`||y)&&(_=d(_,...o)),!(h===void 0&&!y)){if(c!==void 0||l!==void 0||u===void 0){clearTimeout(h);let o=Date.now();v??=o;let s=l===void 0?c??0:Math.min(c??l,Math.max(0,l-(o-v)));h=setTimeout(m,s)}s!==`end`&&y&&f()}},cancel:()=>{clearTimeout(h),h=void 0,v=void 0,clearTimeout(g),g=void 0,_=void 0},flush:()=>{m(),p()},get isIdle(){return h===void 0&&g===void 0}}}o(n$28,`n`);function t$29(...o){return t$47(R,o)}o(t$29,`t`);const R=o((o,s)=>{let c=Object.create(null);for(let l=0;l<o.length;l++){let u=o[l],d=s(u,l,o);if(d!==void 0){let o=c[d];o===void 0?c[d]=[u]:o.push(u)}}return Object.setPrototypeOf(c,Object.prototype),c},`n`);function t$28(...o){return t$47(n$26,o)}o(t$28,`t`);function n$26(o,s){let c=Object.create(null);for(let l of o){let o=l?.[s];if(o!==void 0){let s=c[o];s===void 0?c[o]=[l]:s.push(l)}}return Object.setPrototypeOf(c,Object.prototype),c}o(n$26,`n`);function t$27(...o){return t$47(n$25,o)}o(t$27,`t`);function n$25(o,s){if(o===s||Object.is(o,s))return!0;if(typeof o!=`object`||typeof s!=`object`||o===null||s===null||Object.getPrototypeOf(o)!==Object.getPrototypeOf(s))return!1;if(Array.isArray(o))return r$7(o,s);if(o instanceof Map)return i$2(o,s);if(o instanceof Set)return a(o,s);if(o instanceof Date)return o.getTime()===s.getTime();if(o instanceof RegExp)return o.toString()===s.toString();if(Object.keys(o).length!==Object.keys(s).length)return!1;for(let[c,l]of Object.entries(o))if(!(c in s)||!n$25(l,s[c]))return!1;return!0}o(n$25,`n`);function r$7(o,s){if(o.length!==s.length)return!1;for(let[c,l]of o.entries())if(!n$25(l,s[c]))return!1;return!0}o(r$7,`r`);function i$2(o,s){if(o.size!==s.size)return!1;for(let[c,l]of o.entries())if(!s.has(c)||!n$25(l,s.get(c)))return!1;return!0}o(i$2,`i`);function a(o,s){if(o.size!==s.size)return!1;let c=[...s];for(let s of o){let o=!1;for(let[l,u]of c.entries())if(n$25(s,u)){o=!0,c.splice(l,1);break}if(!o)return!1}return!0}function e$19(){return z}o(e$19,`e`);const z=o(o=>o,`t`);function t$25(...o){return t$47(n$24,o)}o(t$25,`t`);function n$24(o,s){let c={};for(let[l,u]of o.entries()){let d=s(u,l,o);c[d]=u}return c}o(n$24,`n`);function e$18(o){return Array.isArray(o)}o(e$18,`e`);function e$17(o){return typeof o==`boolean`}o(e$17,`e`);function e$16(o){return o!==void 0}o(e$16,`e`);function e$15(o){return o===``||o===void 0?!0:Array.isArray(o)?o.length===0:Object.keys(o).length===0}o(e$15,`e`);function e$14(o){if(o==null||o===``)return!0;if(typeof o!=`object`)return!1;if(`length`in o&&typeof o.length==`number`)return o.length===0;if(`size`in o&&typeof o.size==`number`)return o.size===0;for(let s in o)return!1;return Object.getOwnPropertySymbols(o).length===0}o(e$14,`e`);const B=o(o=>typeof o==`function`,`e`);function e$12(o){return o!=null}o(e$12,`e`);function e$11(o){return s=>!o(s)}o(e$11,`e`);function e$10(o){return o==null}o(e$10,`e`);function e$9(o){return typeof o==`number`&&!Number.isNaN(o)}o(e$9,`e`);function e$8(o){return typeof o==`object`&&!!o}o(e$8,`e`);function e$7(o){return o instanceof Promise}o(e$7,`e`);function t$24(...o){return t$47(n$23,o)}o(t$24,`t`);function n$23(o,s){if(o===s||Object.is(o,s))return!0;if(typeof o!=`object`||!o||typeof s!=`object`||!s)return!1;if(o instanceof Map&&s instanceof Map)return r$6(o,s);if(o instanceof Set&&s instanceof Set)return i$1(o,s);let c=Object.keys(o);if(c.length!==Object.keys(s).length)return!1;for(let l of c){if(!Object.hasOwn(s,l))return!1;let{[l]:c}=o,{[l]:u}=s;if(c!==u||!Object.is(c,u))return!1}return!0}o(n$23,`n`);function r$6(o,s){if(o.size!==s.size)return!1;for(let[c,l]of o){let o=s.get(c);if(l!==o||!Object.is(l,o))return!1}return!0}o(r$6,`r`);function i$1(o,s){if(o.size!==s.size)return!1;for(let c of o)if(!s.has(c))return!1;return!0}o(i$1,`i`);function e$6(o){return typeof o==`string`}o(e$6,`e`);function e$5(o){return!!o}o(e$5,`e`);function t$23(...o){return t$47(V,o)}o(t$23,`t`);const V=o((o,s)=>o.join(s),`n`);function t$22(...o){return t$47(Object.keys,o)}o(t$22,`t`);function t$21(...o){return t$47(H,o)}o(t$21,`t`);const H=o(o=>o.at(-1),`n`);function t$20(...o){return t$47(U,o,W)}o(t$20,`t`);const U=o((o,s)=>o.map(s),`n`),W=o(o=>(s,c,l)=>({done:!1,hasNext:!0,next:o(s,c,l)}),`r`);function t$19(...o){return t$47(n$19,o)}o(t$19,`t`);function n$19(o,s){let c={};for(let[l,u]of o.entries()){let[d,h]=s(u,l,o);c[d]=h}return c}o(n$19,`n`);function t$18(...o){return t$47(n$18,o)}o(t$18,`t`);function n$18(o,s){let c={};for(let[l,u]of Object.entries(o))c[l]=s(u,l,o);return c}o(n$18,`n`);function n$17(...o){return t$47(r$4,o)}o(n$17,`n`);function r$4(o,s){if(!t$38(s,1))return{...o};if(!t$38(s,2)){let{[s[0]]:c,...l}=o;return l}let c={...o};for(let o of s)delete c[o];return c}o(r$4,`r`);function t$17(...o){return t$47(n$16,o)}o(t$17,`t`);function n$16(o,s){let c={...o};for(let[l,u]of Object.entries(c))s(u,l,o)&&delete c[l];return c}o(n$16,`n`);function e$4(o){let s=!1,c;return()=>(s||=(c=o(),!0),c)}o(e$4,`e`);function t$16(...o){return t$47(G,o)}o(t$16,`t`);const G=o(o=>o.length===1?o[0]:void 0,`n`);function t$15(...o){return t$47(K,o)}o(t$15,`t`);const K=o((o,s)=>{let c=[[],[]];for(let[l,u]of o.entries())s(u,l,o)?c[0].push(u):c[1].push(u);return c},`n`);function t$14(...o){return t$47(n$13,o)}o(t$14,`t`);function n$13(o,s){let c={};for(let l of s)l in o&&(c[l]=o[l]);return c}o(n$13,`n`);function t$13(...o){return t$47(n$12,o)}o(t$13,`t`);function n$12(o,s){let c={};for(let[l,u]of Object.entries(o))s(u,l,o)&&(c[l]=u);return c}o(n$12,`n`);function t$12(...o){return s=>t$40(s,...o)}o(t$12,`t`);function e$3(o,...s){return typeof o==`string`||typeof o==`number`||typeof o==`symbol`?c=>t$11(c,o,...s):t$11(o,...s)}o(e$3,`e`);function t$11(o,...s){let c=o;for(let o of s){if(c==null)return;c=c[o]}return c}o(t$11,`t`);function t$10(...o){return t$47(n$11,o)}o(t$10,`t`);function n$11(o,s,c){let l={};for(let[u,d]of o.entries()){let h=s(d,u,o);l[h]=c(d,u,o)}return l}o(n$11,`n`);function e$2(o,s){let c=Math.ceil(o),l=Math.floor(s);if(l<c)throw RangeError(`randomInteger: The range [${o.toString()},${s.toString()}] contains no integer`);return Math.floor(Math.random()*(l-c+1)+c)}o(e$2,`e`);function t$9(...o){return t$47(n$10,o)}o(t$9,`t`);function n$10(o){let s=[];for(let c=0;c<o;c++){let o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(Math.random()*62)];s.push(o)}return s.join(``)}o(n$10,`n`);function t$8(...o){return t$47(q,o)}o(t$8,`t`);const q=o((o,s,c)=>o.reduce(s,c),`n`);function t$7(...o){return t$47(n$8,o)}o(t$7,`t`);function n$8(o){return[...o].reverse()}o(n$8,`n`);function t$6(...o){return t$47(n$7,o)}o(t$6,`t`);function n$7(o,s){let c=[...o];return c.sort(s),c}o(n$7,`n`);function t$5(...o){return t$37(J,o)}o(t$5,`t`);const J=o((o,s)=>[...o].sort(s),`n`);function e$1(o,s,c){return typeof s==`number`||s===void 0?c=>c.split(o,s):o.split(s,c)}o(e$1,`e`);function n$5(...o){return t$47(Y,o,i)}o(n$5,`n`);const Y=o((o,s)=>s<0?[]:o.slice(0,s),`r`);function i(o){if(o<=0)return g;let s=o;return o=>(--s,{done:s<=0,hasNext:!0,next:o})}function t$4(...o){return t$47(n$4,o)}o(t$4,`t`);function n$4(o,s){let c=[];for(let[l,u]of o.entries()){if(!s(u,l,o))break;c.push(u)}return c}o(n$4,`n`);function t$3(...o){return t$47(n$3,o)}o(t$3,`t`);function n$3(o,s){return s(o),o}o(n$3,`n`);function n$2(...o){return t$39(r$2,o)}o(n$2,`n`);function r$2(){let o=new Set;return s=>o.has(s)?h:(o.add(s),{done:!1,hasNext:!0,next:s})}o(r$2,`r`);function n$1(...o){return t$39(r$1,o)}o(n$1,`n`);function r$1(o){let s=o,c=new Set;return(o,l,u)=>{let d=s(o,l,u);return c.has(d)?h:(c.add(d),{done:!1,hasNext:!0,next:o})}}o(r$1,`r`);function t$2(...o){return t$47(Object.values,o)}o(t$2,`t`);function e(...o){return o.length===2?(s,...c)=>X(s,...o,...c):X(...o)}const X=o((o,s,c,...l)=>s(o,...l)?typeof c==`function`?c(o,...l):c.onTrue(o,...l):typeof c==`function`?o:c.onFalse(o,...l),`t`);function t(...o){return t$47(n,o,r)}const n=(o,s)=>o.length<s.length?o.map((o,c)=>[o,s[c]]):s.map((s,c)=>[o[c],s]),r=o=>(s,c)=>({hasNext:!0,next:[s,o[c]],done:c>=o.length-1});export{t$31 as $,t$22 as A,e$12 as B,e$4 as C,t$19 as D,t$18 as E,e$7 as F,e$17 as G,e$14 as H,e$8 as I,e$19 as J,e$18 as K,e$9 as L,e$5 as M,e$6 as N,t$20 as O,t$24 as P,n$28 as Q,e$10 as R,t$16 as S,n$17 as T,e$15 as U,B as V,e$16 as W,t$28 as X,t$27 as Y,t$29 as Z,e$3 as _,t$46 as _t,n$2 as a,r$12 as at,t$14 as b,n$5 as c,t$36 as ct,t$6 as d,t$40 as dt,t$32 as et,t$7 as f,e$24 as ft,t$10 as g,t$45 as gt,e$2 as h,t$44 as ht,n$1 as i,t$34 as it,t$23 as j,t$21 as k,e$1 as l,t$38 as lt,t$9 as m,t$43 as mt,e as n,n$32 as nt,t$3 as o,n$35 as ot,t$8 as p,t$42 as pt,t$25 as q,t$2 as r,n$33 as rt,t$4 as s,t$35 as st,t,t$33 as tt,t$5 as u,r$15 as ut,t$12 as v,t$47 as vt,t$17 as w,t$15 as x,t$13 as y,e$11 as z};
@@ -1,4 +1 @@
1
- import"../rolldown-runtime.mjs";function isForwardRefNode(e){return typeof e==`object`&&!!e&&typeof e.id==`string`}function isNodeModel(e){return typeof e==`object`&&!!e&&e.$$type===`Node`&&typeof e.id==`string`}function isNodeRef(e){return isNodeModel(e)||isForwardRefNode(e)}function isNodeRefLike(e){return typeof e==`string`||isNodeRef(e)}function isNodeRefGroupLike(e){return Array.isArray(e)&&e.every(isNodeRefLike)}function isCompass(e){return[`n`,`ne`,`e`,`se`,`s`,`sw`,`w`,`nw`,`c`].includes(e)}function toNodeRef(e){if(isNodeRef(e))return e;let[t,n,r]=e.split(`:`);return isCompass(r)?{id:t,port:n,compass:r}:{id:t,port:n}}function toNodeRefGroup(e){if(e.length<2&&(isNodeRefLike(e[0])&&isNodeRefLike(e[1]))===!1)throw Error(`EdgeTargets must have at least 2 elements.`);return e.map(e=>toNodeRef(e))}const e=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function createModelsContext(t){return Object.assign(Object.seal(Object.assign({},e)),t)}function _pipe(...e){let[t,...n]=e;return(...e)=>n.reduce((e,t)=>t(e),t(...e))}function pipe(e,...t){return _pipe(e,...t)}const defer=e=>(...t)=>n=>e(n,...t),toIterable=e=>({[Symbol.iterator]:e}),t=defer((e,t)=>Array.from(toIterable(function*(){for(let n of e)yield t(n)})));var Builder=class{options;getLocation(){return this.options?.locationFunction?.()??null}constructor(e){this.options=e}createElement(e,t,n=[]){return{location:this.getLocation(),...t,type:e,children:n}}};const n=Builder.prototype.createElement.bind(new Builder),r=/\r?\n/;function joinBy(e){return t=>t.join(e)}function wrapWith(e){return t=>e+t+e}function wrapByPair(e,t){return n=>e+n+t}function leftPadWith(e){return t=>e+t}const escape=e=>e.replace(/\r/g,`\\r`).replace(/\n/g,`\\n`).replace(/"/g,`\\"`),splitByLine=e=>e.split(r),indent=(e,n,r)=>pipe(splitByLine,t(leftPadWith(e===`space`?` `.repeat(n):`
2
- `)),joinBy(r)),endOfLine=e=>{switch(e){case`crlf`:return`\r
3
- `;case`lf`:return`
4
- `}},i={match(e){return e.type===`AttributeList`},print(e,n){if(n.children.length===0)return`${n.kind.toLocaleLowerCase()} [];`;let r=endOfLine(e.endOfLine);return pipe(t(e.print),joinBy(r),indent(e.indentStyle,e.indentSize,r),wrapByPair(`${n.kind.toLocaleLowerCase()} [${r}`,`${r}];`))(n.children)}},a={match(e){return e.type===`Attribute`},print(e,t){return`${e.print(t.key)} = ${e.print(t.value)};`}},o={match(e){return e.type===`Comment`},print(e,n){let r=endOfLine(e.endOfLine);switch(n.kind){case`Block`:return pipe(splitByLine,t(leftPadWith(` * `)),joinBy(r),wrapByPair(`/**${r}`,`${r} */`))(n.value);case`Macro`:return pipe(splitByLine,t(leftPadWith(`# `)),joinBy(r))(n.value);default:return pipe(splitByLine,t(leftPadWith(`// `)),joinBy(r))(n.value)}}},s={match(e){return e.type===`Dot`},print(e,t){return t.children.map(e.print).join(endOfLine(e.endOfLine))}},c={match(e){return e.type===`Edge`},print(e,n){let r=pipe(t(e.print),joinBy(e.directed?` -> `:` -- `))(n.targets);if(n.children.length===0)return`${r};`;let i=endOfLine(e.endOfLine);return`${r} ${pipe(t(e.print),joinBy(i),indent(e.indentStyle,e.indentSize,i),wrapByPair(`[${i}`,`${i}];`))(n.children)}`}},l={match(e){return e.type===`Graph`},print(e,n){e.directed=n.directed;let r=[];if(n.strict&&r.push(`strict`),r.push(n.directed?`digraph`:`graph`),n.id&&r.push(e.print(n.id)),n.children.length===0)return`${r.join(` `)} {}`;let i=endOfLine(e.endOfLine),a=pipe(t(e.print),joinBy(i),indent(e.indentStyle,e.indentSize,i),wrapByPair(`{${i}`,`${i}}`))(n.children);return`${r.join(` `)} ${a}`}},u=pipe(escape,wrapWith(`"`)),d=wrapByPair(`<`,`>`),f=[i,a,o,s,c,l,{match(e){return e.type===`Literal`},print(e,t){switch(t.quoted){case`html`:return d(t.value);case!0:return u(t.value);default:return escape(t.value)}}},{match(e){return e.type===`Node`},print(e,n){let r=e.print(n.id);if(n.children.length===0)return`${r};`;let i=endOfLine(e.endOfLine);return`${r} ${pipe(t(e.print),joinBy(i),indent(e.indentStyle,e.indentSize,i),wrapByPair(`[${i}`,`${i}];`))(n.children)}`}},{match(e){return e.type===`NodeRefGroup`},print(e,n){return pipe(t(e.print),joinBy(` `),wrapByPair(`{`,`}`))(n.children)}},{match(e){return e.type===`NodeRef`},print(e,t){let n=[e.print(t.id)];return t.port&&n.push(e.print(t.port)),t.compass&&n.push(e.print(t.compass)),n.join(`:`)}},{match(e){return e.type===`Subgraph`},print(e,n){let r=[`subgraph`];if(n.id&&r.push(e.print(n.id)),n.children.length===0)return`${r.join(` `)} {}`;let i=endOfLine(e.endOfLine),a=pipe(t(e.print),joinBy(i),indent(e.indentStyle,e.indentSize,i),wrapByPair(`{${i}`,`${i}}`))(n.children);return`${r.join(` `)} ${a}`}}];var Printer=class{options;#e=[...f];constructor(e={}){this.options=e}print(e){let t=[...this.#e],{indentSize:n=2,indentStyle:r=`space`,endOfLine:i=`lf`}=this.options,a={directed:!0,indentSize:n,indentStyle:r,endOfLine:i,print(e){for(let n of t)if(n.match(e))return n.print(a,e);throw Error()}};return a.print(e)}};function stringify(e,t){let n=new Printer(t).print(e);if(!n)throw Error();return n}function convertAttribute(e,t){if(typeof t==`string`){let r=t.trim();return/^<.+>$/ms.test(r)?n(`Attribute`,{key:n(`Literal`,{value:e,quoted:!1},[]),value:n(`Literal`,{value:r.slice(1,r.length-1),quoted:`html`},[])},[]):n(`Attribute`,{key:n(`Literal`,{value:e,quoted:!1},[]),value:n(`Literal`,{value:t,quoted:!0},[])},[])}return n(`Attribute`,{key:n(`Literal`,{value:e,quoted:!1},[]),value:n(`Literal`,{value:String(t),quoted:!1},[])},[])}function convertComment(e,t){return n(`Comment`,{kind:t,value:e},[])}function convertClusterChildren(e,t){return Array.from((function*(){for(let[e,n]of t.values)yield convertAttribute(e,n);for(let n of Object.values(t.attributes))n.size>0&&(n.comment&&(yield convertComment(n.comment,e.commentKind)),yield e.convert(n));for(let n of t.nodes)n.comment&&(yield convertComment(n.comment,e.commentKind)),yield e.convert(n);for(let n of t.subgraphs)n.comment&&(yield convertComment(n.comment,e.commentKind)),yield e.convert(n);for(let n of t.edges)n.comment&&(yield convertComment(n.comment,e.commentKind)),yield e.convert(n)})())}const p=[{match(e){return e.$$type===`AttributeList`},convert(e,t){return n(`AttributeList`,{kind:t.$$kind},t.values.map(([e,t])=>convertAttribute(e,t)))}},{match(e){return e.$$type===`Edge`},convert(e,t){return n(`Edge`,{targets:t.targets.map(e=>isNodeModel(e)?n(`NodeRef`,{id:n(`Literal`,{value:e.id,quoted:!0},[])},[]):isForwardRefNode(e)?n(`NodeRef`,{id:n(`Literal`,{value:e.id,quoted:!0},[]),port:e.port?n(`Literal`,{value:e.port,quoted:!0},[]):void 0,compass:e.compass?n(`Literal`,{value:e.compass,quoted:!0},[]):void 0},[]):n(`NodeRefGroup`,{},e.map(e=>isNodeModel(e)?n(`NodeRef`,{id:n(`Literal`,{value:e.id,quoted:!0},[])},[]):n(`NodeRef`,{id:n(`Literal`,{value:e.id,quoted:!0},[]),port:e.port?n(`Literal`,{value:e.port,quoted:!0},[]):void 0,compass:e.compass?n(`Literal`,{value:e.compass,quoted:!0},[]):void 0},[]))))},[...t.attributes.comment?[convertComment(t.attributes.comment,e.commentKind)]:[],...t.attributes.values.map(([e,t])=>convertAttribute(e,t))])}},{match(e){return e.$$type===`Node`},convert(e,t){return n(`Node`,{id:n(`Literal`,{value:t.id,quoted:!0},[])},[...t.attributes.comment?[convertComment(t.attributes.comment,e.commentKind)]:[],...t.attributes.values.map(([e,t])=>convertAttribute(e,t))])}},{match(e){return e.$$type===`Graph`},convert(e,t){return n(`Dot`,{},[...t.comment?[convertComment(t.comment,e.commentKind)]:[],n(`Graph`,{directed:t.directed,strict:t.strict,id:t.id?n(`Literal`,{value:t.id,quoted:!0},[]):void 0},convertClusterChildren(e,t))])}},{match(e){return e.$$type===`Subgraph`},convert(e,t){return n(`Subgraph`,{id:t.id?n(`Literal`,{value:t.id,quoted:!0},[]):void 0},convertClusterChildren(e,t))}}];var FromModelConverter=class{options;#e=[...p];constructor(e={}){this.options=e}convert(e){let t=[...this.#e],{commentKind:n=`Slash`}=this.options,r={commentKind:n,convert(e){for(let n of t)if(n.match(e))return n.convert(r,e);throw Error()}};return r.convert(e)}};function fromModel(e,t){return new FromModelConverter(t).convert(e)}const m=new Proxy(Object.freeze({}),{get:(e,t)=>t});var DotObject=class{},AttributesBase=class extends DotObject{#e=new Map;constructor(e){super(),e!==void 0&&this.apply(e)}get values(){return Array.from(this.#e.entries())}get size(){return this.#e.size}get(e){return this.#e.get(e)}set(e,t){t!=null&&this.#e.set(e,t)}delete(e){this.#e.delete(e)}apply(e){let t=Array.isArray(e)?e:Object.entries(e);for(let[e,n]of t)this.set(e,n)}clear(){this.#e.clear()}},AttributeList=class extends AttributesBase{$$kind;get $$type(){return`AttributeList`}comment;constructor(e,t){super(t),this.$$kind=e}},GraphBase=class extends AttributesBase{#e=e;id;comment;attributes=Object.freeze({graph:new AttributeList(`Graph`),edge:new AttributeList(`Edge`),node:new AttributeList(`Node`)});get nodes(){return Array.from(this.#t.nodes.values())}get edges(){return Array.from(this.#t.edges.values())}get subgraphs(){return Array.from(this.#t.subgraphs.values())}#t={nodes:new Map,edges:new Set,subgraphs:new Set};with(e){this.#e=createModelsContext(e)}addNode(e){this.#t.nodes.set(e.id,e)}addEdge(e){this.#t.edges.add(e)}addSubgraph(e){this.#t.subgraphs.add(e)}existNode(e){return this.#t.nodes.has(e)}existEdge(e){return this.#t.edges.has(e)}existSubgraph(e){return this.#t.subgraphs.has(e)}createSubgraph(...e){let t=new this.#e.Subgraph(...e);return t.with(this.#e),this.addSubgraph(t),t}removeNode(e){this.#t.nodes.delete(typeof e==`string`?e:e.id)}removeEdge(e){this.#t.edges.delete(e)}removeSubgraph(e){this.#t.subgraphs.delete(e)}createNode(e,t){let n=new this.#e.Node(e,t);return this.addNode(n),n}getSubgraph(e){return Array.from(this.#t.subgraphs.values()).find(t=>t.id===e)}getNode(e){return this.#t.nodes.get(e)}createEdge(e,t){let n=e.map(e=>isNodeRefGroupLike(e)?toNodeRefGroup(e):toNodeRef(e)),r=new this.#e.Edge(n,t);return this.addEdge(r),r}subgraph(...e){let t=e.find(e=>typeof e==`string`),n=e.find(e=>typeof e==`object`&&!!e),r=e.find(e=>typeof e==`function`),i=t?this.getSubgraph(t)??this.createSubgraph(t):this.createSubgraph();return n!==void 0&&i.apply(n),r!==void 0&&r(i),i}node(e,...t){if(typeof e==`string`){let n=e,r=t.find(e=>typeof e==`object`&&!!e),i=t.find(e=>typeof e==`function`),a=this.getNode(n)??this.createNode(n);return r!==void 0&&a.attributes.apply(r),i!==void 0&&i(a),a}typeof e==`object`&&e&&this.attributes.node.apply(e)}edge(e,...t){if(Array.isArray(e)){let n=e,r=t.find(e=>typeof e==`object`),i=t.find(e=>typeof e==`function`),a=this.createEdge(n,r);return i!==void 0&&i(a),a}typeof e==`object`&&e&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}},RootGraph=class extends GraphBase{get $$type(){return`Graph`}id;strict;constructor(...e){super(),this.id=e.find(e=>typeof e==`string`),this.strict=e.find(e=>typeof e==`boolean`)??!1;let t=e.find(e=>typeof e==`object`&&!!e);t!==void 0&&this.apply(t)}},Digraph=class extends RootGraph{get directed(){return!0}},Graph=class extends RootGraph{get directed(){return!1}},Subgraph=class extends GraphBase{get $$type(){return`Subgraph`}id;constructor(...e){super(),this.id=e.find(e=>typeof e==`string`);let t=e.find(e=>typeof e==`object`&&!!e);t!==void 0&&this.apply(t)}isSubgraphCluster(){return typeof this.id==`string`?this.id.startsWith(`cluster`):!1}},AttributesGroup=class extends AttributesBase{comment},Node=class extends DotObject{id;get $$type(){return`Node`}comment;attributes;constructor(e,t){super(),this.id=e,this.attributes=new AttributesGroup(t)}port(e){return typeof e==`string`?{id:this.id,port:e}:{id:this.id,...e}}},Edge=class extends DotObject{targets;get $$type(){return`Edge`}comment;attributes;constructor(e,t){if(super(),this.targets=e,e.length<2&&(isNodeRefLike(e[0])&&isNodeRefLike(e[1]))===!1)throw Error(`The element of Edge target is missing or not satisfied as Edge target.`);this.attributes=new AttributesGroup(t)}};Object.assign(e,{Graph,Digraph,Subgraph,Node,Edge});function ModelFactoryBuilder(e,t){return(...n)=>{let r=e?this.Digraph:this.Graph,i=n.find(e=>typeof e==`string`),a=n.find(e=>typeof e==`object`),o=n.find(e=>typeof e==`function`),s=new r(i,t,a);return s.with(this),typeof o==`function`&&o(s),s}}function createModelFactories(t,n=e){return Object.freeze({digraph:ModelFactoryBuilder.call(n,!0,t),graph:ModelFactoryBuilder.call(n,!1,t)})}const h=createModelFactories(!1),g=h.digraph;h.graph,createModelFactories(!0);function toDot(e,t){return stringify(fromModel(e,t?.convert),t?.print)}export{g as n,toDot as r,m as t};
1
+ import"../rolldown-runtime.mjs";import{t as e}from"./@ts-graphviz/core.mjs";import{n as t,r,t as i}from"./@ts-graphviz/ast.mjs";const a=new Proxy(Object.freeze({}),{get:(e,t)=>t});function f(e,t){return(...r)=>{let i=e?this.Digraph:this.Graph,a=r.find(e=>typeof e==`string`),o=r.find(e=>typeof e==`object`),s=r.find(e=>typeof e==`function`),c=new i(a,t,o);return c.with(this),typeof s==`function`&&s(c),c}}function n(e,t=r){return Object.freeze({digraph:f.call(t,!0,e),graph:f.call(t,!1,e)})}const o=n(!1),s=o.digraph;o.graph,n(!0);function O(e,r){return t(i(e,r?.convert),r?.print)}e();export{O as n,a as r,s as t};
@@ -0,0 +1 @@
1
+ import"../rolldown-runtime.mjs";function createContext(e={}){let t,n=!1,checkConflict=e=>{if(t&&t!==e)throw Error(`Context conflict`)},i;if(e.asyncContext){let t=e.AsyncLocalStorage||globalThis.AsyncLocalStorage;t?i=new t:console.warn("[unctx] `AsyncLocalStorage` is not provided.")}let _getCurrentInstance=()=>{if(i){let e=i.getStore();if(e!==void 0)return e}return t};return{use:()=>{let e=_getCurrentInstance();if(e===void 0)throw Error(`Context is not available`);return e},tryUse:()=>_getCurrentInstance(),set:(e,r)=>{r||checkConflict(e),t=e,n=!0},unset:()=>{t=void 0,n=!1},call:(e,r)=>{checkConflict(e),t=e;try{return i?i.run(e,r):r()}finally{n||(t=void 0)}},async callAsync(e,a){t=e;let onRestore=()=>{t=e},onLeave=()=>t===e?onRestore:void 0;r.add(onLeave);try{let r=i?i.run(e,a):a();return n||(t=void 0),await r}finally{r.delete(onLeave)}}}}function createNamespace(e={}){let t={};return{get(n,r={}){return t[n]||(t[n]=createContext({...e,...r})),t[n]}}}const e=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof global<`u`?global:typeof window<`u`?window:{},t=`__unctx__`;e[t]||(e[t]=createNamespace());const n=`__unctx_async_handlers__`,r=e[n]||(e[n]=new Set);export{createContext as t};