finch-markdown-editor 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bmmd/bin/bmmd.mjs +3 -3
- package/dist/bmmd/bin/{dist-BoUxJM-2.mjs → dist-Cudvh-06.mjs} +1 -1
- package/dist/bmmd/bin/{html-CGVTbdd7.mjs → html-BvKWgga7.mjs} +220 -212
- package/dist/bmmd/bin/remark-highlight-C36j5KDt.mjs +7 -0
- package/dist/bmmd/bin/{text-CtjMWodY.mjs → text-iKoE8yN9.mjs} +1 -1
- package/dist/index.js +1 -1
- package/dist/panel.css +7 -0
- package/package.json +2 -2
- package/dist/bmmd/bin/remark-highlight-DGWP7eu3.mjs +0 -7
package/dist/bmmd/bin/bmmd.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{i as e,o as t,r as n,s as r,t as i}from"./dist-
|
|
2
|
+
import{i as e,o as t,r as n,s as r,t as i}from"./dist-Cudvh-06.mjs";import a from"node:process";import{readFile as o,writeFile as s}from"node:fs/promises";function c(e){return e==null?[]:Array.isArray(e)?e:[e]}function l(e,t,n,r){var i,a=e[t],o=~r.string.indexOf(t)?n==null||n===!0?``:String(n):typeof n==`boolean`?n:~r.boolean.indexOf(t)?n===`false`?!1:n===`true`||(e._.push((i=+n,i*0==0?i:n)),!!n):(i=+n,i*0==0?i:n);e[t]=a==null?o:Array.isArray(a)?a.concat(o):[a,o]}function u(e,t){e||=[],t||={};var n,r,i,a,o,s={_:[]},u=0,d=0,f=0,p=e.length;let m=t.alias!==void 0,h=t.unknown!==void 0,ee=t.default!==void 0;if(t.alias=t.alias||{},t.string=c(t.string),t.boolean=c(t.boolean),m)for(n in t.alias)for(r=t.alias[n]=c(t.alias[n]),u=0;u<r.length;u++)(t.alias[r[u]]=r.concat(n)).splice(u,1);for(u=t.boolean.length;u-->0;)for(r=t.alias[t.boolean[u]]||[],d=r.length;d-->0;)t.boolean.push(r[d]);for(u=t.string.length;u-->0;)for(r=t.alias[t.string[u]]||[],d=r.length;d-->0;)t.string.push(r[d]);if(ee){for(n in t.default)if(a=typeof t.default[n],r=t.alias[n]=t.alias[n]||[],t[a]!==void 0)for(t[a].push(n),u=0;u<r.length;u++)t[a].push(r[u])}let te=h?Object.keys(t.alias):[];for(u=0;u<p;u++){if(i=e[u],i===`--`){s._=s._.concat(e.slice(++u));break}for(d=0;d<i.length&&i.charCodeAt(d)===45;d++);if(d===0)s._.push(i);else if(i.substring(d,d+3)===`no-`){if(a=i.substring(d+3),h&&!~te.indexOf(a))return t.unknown(i);s[a]=!1}else{for(f=d+1;f<i.length&&i.charCodeAt(f)!==61;f++);for(a=i.substring(d,f),o=i.substring(++f)||u+1===p||(``+e[u+1]).charCodeAt(0)===45||e[++u],r=d===2?[a]:a,f=0;f<r.length;f++){if(a=r[f],h&&!~te.indexOf(a))return t.unknown(`-`.repeat(d)+a);l(s,a,f+1<r.length||o,t)}}}if(ee)for(n in t.default)s[n]===void 0&&(s[n]=t.default[n]);if(m)for(n in s)for(r=t.alias[n]||[];r.length>0;)s[r.shift()]=s[n];return s}function d(e){return e.replace(/[<[].+/,``).trim()}function f(e){let t=/<([^>]+)>/g,n=/\[([^\]]+)\]/g,r=[],i=e=>{let t=!1,n=e[1];return n.startsWith(`...`)&&(n=n.slice(3),t=!0),{required:e[0].startsWith(`<`),value:n,variadic:t}},a;for(;a=t.exec(e);)r.push(i(a));let o;for(;o=n.exec(e);)r.push(i(o));return r}function p(e){let t={alias:{},boolean:[]};for(let[n,r]of e.entries())r.names.length>1&&(t.alias[r.names[0]]=r.names.slice(1)),r.isBoolean&&(r.negated&&e.some((e,t)=>t!==n&&e.names.some(e=>r.names.includes(e))&&typeof e.required==`boolean`)||t.boolean.push(r.names[0]));return t}function m(e){return e.sort((e,t)=>e.length>t.length?-1:1)[0]}function h(e,t){return e.length>=t?e:`${e}${` `.repeat(t-e.length)}`}function ee(e){return e.replaceAll(/([a-z])-([a-z])/g,(e,t,n)=>t+n.toUpperCase())}function te(e,t,n){let r=e;for(let e=0;e<t.length;e++){let i=t[e];if(e===t.length-1){r[i]=n;return}if(r[i]==null){let n=+t[e+1]>-1;r[i]=n?[]:{}}r=r[i]}}function ne(e,t){for(let n of Object.keys(t)){let r=t[n];r.shouldTransform&&(e[n]=[e[n]].flat(),typeof r.transformFunction==`function`&&(e[n]=e[n].map(r.transformFunction)))}}function re(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:``}function ie(e){return e.split(`.`).map((e,t)=>t===0?ee(e):e).join(`.`)}var ae=class extends Error{constructor(e){super(e),this.name=`CACError`,typeof Error.captureStackTrace!=`function`&&(this.stack=Error(e).stack)}},oe=class{rawName;description;name;names;isBoolean;required;config;negated;constructor(e,t,n){this.rawName=e,this.description=t,this.config=Object.assign({},n),e=e.replaceAll(`.*`,``),this.negated=!1,this.names=d(e).split(`,`).map(e=>{let t=e.trim().replace(/^-{1,2}/,``);return t.startsWith(`no-`)&&(this.negated=!0,t=t.replace(/^no-/,``)),ie(t)}).sort((e,t)=>e.length>t.length?1:-1),this.name=this.names.at(-1),this.negated&&this.config.default==null&&(this.config.default=!0),e.includes(`<`)?this.required=!0:e.includes(`[`)?this.required=!1:this.isBoolean=!0}};let se,ce;if(typeof process<`u`){let e;e=typeof Deno<`u`&&typeof Deno.version?.deno==`string`?`deno`:typeof Bun<`u`&&typeof Bun.version==`string`?`bun`:`node`,ce=`${process.platform}-${process.arch} ${e}-${process.version}`,se=process.argv}else ce=typeof navigator>`u`?`unknown`:`${navigator.platform} ${navigator.userAgent}`;var le=class{rawName;description;config;cli;options;aliasNames;name;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;constructor(e,t,n={},r){this.rawName=e,this.description=t,this.config=n,this.cli=r,this.options=[],this.aliasNames=[],this.name=d(e),this.args=f(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t=`-v, --version`){return this.versionNumber=e,this.option(t,`Display version number`),this}example(e){return this.examples.push(e),this}option(e,t,n){let r=new oe(e,t,n);return this.options.push(r),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return this.name===``||this.aliasNames.includes(`!`)}get isGlobalCommand(){return this instanceof ue}hasOption(e){return e=e.split(`.`)[0],this.options.find(t=>t.names.includes(e))}outputHelp(){let{name:e,commands:t}=this.cli,{versionNumber:n,options:r,helpCallback:i}=this.cli.globalCommand,a=[{body:`${e}${n?`/${n}`:``}`}];if(a.push({title:`Usage`,body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){let n=m(t.map(e=>e.rawName));a.push({title:`Commands`,body:t.map(e=>` ${h(e.rawName,n.length)} ${e.description}`).join(`
|
|
3
3
|
`)},{title:"For more info, run any command with the `--help` flag",body:t.map(t=>` $ ${e}${t.name===``?``:` ${t.name}`} --help`).join(`
|
|
4
4
|
`)})}let o=this.isGlobalCommand?r:[...this.options,...r||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(o=o.filter(e=>e.name!==`version`)),o.length>0){let e=m(o.map(e=>e.rawName));a.push({title:`Options`,body:o.map(t=>` ${h(t.rawName,e.length)} ${t.description} ${t.config.default===void 0?``:`(default: ${t.config.default})`}`).join(`
|
|
5
5
|
`)})}this.examples.length>0&&a.push({title:`Examples`,body:this.examples.map(t=>typeof t==`function`?t(e):t).join(`
|
|
6
6
|
`)}),i&&(a=i(a)||a),console.info(a.map(e=>e.title?`${e.title}:\n${e.body}`:e.body).join(`
|
|
7
7
|
|
|
8
|
-
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.info(`${e}/${t} ${ce}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new ae(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new ae(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new ae(`option \`${t.rawName}\` value is missing`)}}}checkUnusedArgs(){let e=this.args.some(e=>e.variadic)?1/0:this.args.length;if(e<this.cli.args.length)throw new ae(`Unused args: ${this.cli.args.slice(e).map(e=>`\`${e}\``).join(`, `)}`)}},ue=class extends le{constructor(e){super(`@@global@@`,``,{},e)}},de=class extends EventTarget{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new ue(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new le(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e,{run:t=!0}={}){if(!e){if(!se)throw Error(`No argv provided and runtime process argv is not available.`);e=se}this.rawArgs=e,this.name||=e[1]?re(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e={...r,args:r.args.slice(1)};this.setParsedInfo(e,t,i),this.dispatchEvent(new CustomEvent(`command:${i}`,{detail:t}))}}if(n){for(let t of this.commands)if(t.isDefaultCommand){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.dispatchEvent(new CustomEvent(`command:!`,{detail:t}))}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.dispatchEvent(new CustomEvent(`command:*`,{detail:this.args[0]})),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],r=p(n),i=[],a=e.indexOf(`--`);a!==-1&&(i=e.slice(a+1),e=e.slice(0,a));let o=u(e,r);o=Object.keys(o).reduce((e,t)=>({...e,[ie(t)]:o[t]}),{_:[]});let s=o._,c={"--":i},l=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,d=Object.create(null);for(let e of n){if(!l&&e.config.default!==void 0)for(let t of e.names)c[t]=e.config.default;Array.isArray(e.config.type)&&d[e.name]===void 0&&(d[e.name]=Object.create(null),d[e.name].shouldTransform=!0,d[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(o))e!==`_`&&(te(c,e.split(`.`),o[e]),ne(c,d));return{args:s,options:c}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs(),n.checkUnusedArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const fe=(e=``)=>new de(e);var pe=`0.3.2`,me=`Markdown 排版 CLI,支持微信公众号与 HTML 输出。`,he;function g(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ge=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(he=globalThis).__zod_globalConfig??(he.__zod_globalConfig={});const v=globalThis.__zod_globalConfig;function y(e){return e&&Object.assign(v,e),v}function _e(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ve(e,t){return typeof t==`bigint`?t.toString():t}function ye(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function be(e){return e==null}function xe(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}const Se=Symbol(`evaluating`);function b(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Se)return r===void 0&&(r=Se,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function x(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function S(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ce(e){return JSON.stringify(e)}function we(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Te=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Ee=ye(()=>{if(v.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function w(e){if(C(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(C(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function De(e){return w(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Oe=new Set([`string`,`number`,`symbol`]);function T(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function E(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function D(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ke(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function Ae(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return E(e,S(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return x(this,`shape`,e),e},checks:[]}))}function je(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return E(e,S(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return x(this,`shape`,r),r},checks:[]}))}function Me(e,t){if(!w(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return E(e,S(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return x(this,`shape`,n),n}}))}function Ne(e,t){if(!w(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return E(e,S(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return x(this,`shape`,n),n}}))}function Pe(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return E(e,S(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return x(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Fe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return E(t,S(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return x(this,`shape`,i),i},checks:[]}))}function Ie(e,t,n){return E(t,S(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return x(this,`shape`,i),i}}))}function O(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Le(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Re(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function k(e){return typeof e==`string`?e:e?.message}function A(e,t,n){let r=e.message?e.message:k(e.inst?._zod.def?.error?.(e))??k(t?.error?.(e))??k(n.customError?.(e))??k(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ze(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function j(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const Be=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ve,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ve=g(`$ZodError`,Be),He=g(`$ZodError`,Be,{Parent:Error});function Ue(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function We(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}const Ge=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new _;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>A(e,a,y())));throw Te(t,i?.callee),t}return o.value},Ke=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>A(e,a,y())));throw Te(t,i?.callee),t}return o.value},M=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new _;return a.issues.length?{success:!1,error:new(e??Ve)(a.issues.map(e=>A(e,i,y())))}:{success:!0,data:a.value}},qe=M(He),N=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>A(e,i,y())))}:{success:!0,data:a.value}},Je=N(He),Ye=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ge(e)(t,n,i)},Xe=e=>(t,n,r)=>Ge(e)(t,n,r),Ze=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ke(e)(t,n,i)},Qe=e=>async(t,n,r)=>Ke(e)(t,n,r),$e=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return M(e)(t,n,i)},et=e=>(t,n,r)=>M(e)(t,n,r),tt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return N(e)(t,n,i)},nt=e=>async(t,n,r)=>N(e)(t,n,r),rt=/^[cC][0-9a-z]{6,}$/,it=/^[0-9a-z]+$/,at=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ot=/^[0-9a-vA-V]{20}$/,st=/^[A-Za-z0-9]{27}$/,ct=/^[a-zA-Z0-9_-]{21}$/,lt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ut=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,dt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ft=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function pt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const mt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ht=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,gt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_t=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yt=/^[A-Za-z0-9_-]*$/,bt=/^https?$/,xt=/^\+[1-9]\d{6,14}$/,St=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Ct=RegExp(`^${St}$`);function wt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Tt(e){return RegExp(`^${wt(e)}$`)}function Et(e){let t=wt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${St}T(?:${r})$`)}const Dt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ot=/^(?:true|false)$/i,kt=/^[^A-Z]*$/,At=/^[^a-z]*$/,P=g(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),jt=g(`$ZodCheckMaxLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!be(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ze(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mt=g(`$ZodCheckMinLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!be(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ze(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Nt=g(`$ZodCheckLengthEquals`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!be(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ze(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),F=g(`$ZodCheckStringFormat`,(e,t)=>{var n,r;P.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Pt=g(`$ZodCheckRegex`,(e,t)=>{F.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ft=g(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=kt,F.init(e,t)}),It=g(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=At,F.init(e,t)}),Lt=g(`$ZodCheckIncludes`,(e,t)=>{P.init(e,t);let n=T(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rt=g(`$ZodCheckStartsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`^${T(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zt=g(`$ZodCheckEndsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`.*${T(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Bt=g(`$ZodCheckOverwrite`,(e,t)=>{P.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Vt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
8
|
+
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.info(`${e}/${t} ${ce}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new ae(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new ae(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new ae(`option \`${t.rawName}\` value is missing`)}}}checkUnusedArgs(){let e=this.args.some(e=>e.variadic)?1/0:this.args.length;if(e<this.cli.args.length)throw new ae(`Unused args: ${this.cli.args.slice(e).map(e=>`\`${e}\``).join(`, `)}`)}},ue=class extends le{constructor(e){super(`@@global@@`,``,{},e)}},de=class extends EventTarget{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new ue(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new le(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e,{run:t=!0}={}){if(!e){if(!se)throw Error(`No argv provided and runtime process argv is not available.`);e=se}this.rawArgs=e,this.name||=e[1]?re(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e={...r,args:r.args.slice(1)};this.setParsedInfo(e,t,i),this.dispatchEvent(new CustomEvent(`command:${i}`,{detail:t}))}}if(n){for(let t of this.commands)if(t.isDefaultCommand){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.dispatchEvent(new CustomEvent(`command:!`,{detail:t}))}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.dispatchEvent(new CustomEvent(`command:*`,{detail:this.args[0]})),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],r=p(n),i=[],a=e.indexOf(`--`);a!==-1&&(i=e.slice(a+1),e=e.slice(0,a));let o=u(e,r);o=Object.keys(o).reduce((e,t)=>({...e,[ie(t)]:o[t]}),{_:[]});let s=o._,c={"--":i},l=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,d=Object.create(null);for(let e of n){if(!l&&e.config.default!==void 0)for(let t of e.names)c[t]=e.config.default;Array.isArray(e.config.type)&&d[e.name]===void 0&&(d[e.name]=Object.create(null),d[e.name].shouldTransform=!0,d[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(o))e!==`_`&&(te(c,e.split(`.`),o[e]),ne(c,d));return{args:s,options:c}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs(),n.checkUnusedArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const fe=(e=``)=>new de(e);var pe=`0.3.4`,me=`Markdown 排版 CLI,支持微信公众号与 HTML 输出。`,he;function g(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ge=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(he=globalThis).__zod_globalConfig??(he.__zod_globalConfig={});const v=globalThis.__zod_globalConfig;function y(e){return e&&Object.assign(v,e),v}function _e(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ve(e,t){return typeof t==`bigint`?t.toString():t}function ye(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function be(e){return e==null}function xe(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}const Se=Symbol(`evaluating`);function b(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Se)return r===void 0&&(r=Se,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function x(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function S(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ce(e){return JSON.stringify(e)}function we(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Te=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Ee=ye(()=>{if(v.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function w(e){if(C(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(C(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function De(e){return w(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Oe=new Set([`string`,`number`,`symbol`]);function T(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function E(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function D(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ke(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function Ae(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return E(e,S(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return x(this,`shape`,e),e},checks:[]}))}function je(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return E(e,S(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return x(this,`shape`,r),r},checks:[]}))}function Me(e,t){if(!w(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return E(e,S(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return x(this,`shape`,n),n}}))}function Ne(e,t){if(!w(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return E(e,S(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return x(this,`shape`,n),n}}))}function Pe(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return E(e,S(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return x(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Fe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return E(t,S(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return x(this,`shape`,i),i},checks:[]}))}function Ie(e,t,n){return E(t,S(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return x(this,`shape`,i),i}}))}function O(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Le(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Re(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function k(e){return typeof e==`string`?e:e?.message}function A(e,t,n){let r=e.message?e.message:k(e.inst?._zod.def?.error?.(e))??k(t?.error?.(e))??k(n.customError?.(e))??k(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ze(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function j(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const Be=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ve,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ve=g(`$ZodError`,Be),He=g(`$ZodError`,Be,{Parent:Error});function Ue(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function We(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}const Ge=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new _;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>A(e,a,y())));throw Te(t,i?.callee),t}return o.value},Ke=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>A(e,a,y())));throw Te(t,i?.callee),t}return o.value},M=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new _;return a.issues.length?{success:!1,error:new(e??Ve)(a.issues.map(e=>A(e,i,y())))}:{success:!0,data:a.value}},qe=M(He),N=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>A(e,i,y())))}:{success:!0,data:a.value}},Je=N(He),Ye=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ge(e)(t,n,i)},Xe=e=>(t,n,r)=>Ge(e)(t,n,r),Ze=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ke(e)(t,n,i)},Qe=e=>async(t,n,r)=>Ke(e)(t,n,r),$e=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return M(e)(t,n,i)},et=e=>(t,n,r)=>M(e)(t,n,r),tt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return N(e)(t,n,i)},nt=e=>async(t,n,r)=>N(e)(t,n,r),rt=/^[cC][0-9a-z]{6,}$/,it=/^[0-9a-z]+$/,at=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ot=/^[0-9a-vA-V]{20}$/,st=/^[A-Za-z0-9]{27}$/,ct=/^[a-zA-Z0-9_-]{21}$/,lt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ut=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,dt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ft=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function pt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const mt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ht=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,gt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_t=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yt=/^[A-Za-z0-9_-]*$/,bt=/^https?$/,xt=/^\+[1-9]\d{6,14}$/,St=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Ct=RegExp(`^${St}$`);function wt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Tt(e){return RegExp(`^${wt(e)}$`)}function Et(e){let t=wt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${St}T(?:${r})$`)}const Dt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ot=/^(?:true|false)$/i,kt=/^[^A-Z]*$/,At=/^[^a-z]*$/,P=g(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),jt=g(`$ZodCheckMaxLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!be(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ze(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mt=g(`$ZodCheckMinLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!be(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ze(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Nt=g(`$ZodCheckLengthEquals`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!be(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ze(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),F=g(`$ZodCheckStringFormat`,(e,t)=>{var n,r;P.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Pt=g(`$ZodCheckRegex`,(e,t)=>{F.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ft=g(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=kt,F.init(e,t)}),It=g(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=At,F.init(e,t)}),Lt=g(`$ZodCheckIncludes`,(e,t)=>{P.init(e,t);let n=T(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rt=g(`$ZodCheckStartsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`^${T(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zt=g(`$ZodCheckEndsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`.*${T(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Bt=g(`$ZodCheckOverwrite`,(e,t)=>{P.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Vt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
9
9
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
10
10
|
`))}};const Ht={major:4,minor:4,patch:3},I=g(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ht;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=O(e),i;for(let a of t){if(a._zod.def.when){if(Le(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new _;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=O(e,t))});else{if(e.issues.length===t)continue;r||=O(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(O(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new _;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new _;return o.then(e=>t(e,r,a))}return t(o,r,a)}}b(e,`~standard`,()=>({validate:t=>{try{let n=qe(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Je(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ut=g(`$ZodString`,(e,t)=>{I.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Dt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),L=g(`$ZodStringFormat`,(e,t)=>{F.init(e,t),Ut.init(e,t)}),Wt=g(`$ZodGUID`,(e,t)=>{t.pattern??=ut,L.init(e,t)}),Gt=g(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=dt(e)}else t.pattern??=dt();L.init(e,t)}),Kt=g(`$ZodEmail`,(e,t)=>{t.pattern??=ft,L.init(e,t)}),qt=g(`$ZodURL`,(e,t)=>{L.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===bt.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Jt=g(`$ZodEmoji`,(e,t)=>{t.pattern??=pt(),L.init(e,t)}),Yt=g(`$ZodNanoID`,(e,t)=>{t.pattern??=ct,L.init(e,t)}),Xt=g(`$ZodCUID`,(e,t)=>{t.pattern??=rt,L.init(e,t)}),Zt=g(`$ZodCUID2`,(e,t)=>{t.pattern??=it,L.init(e,t)}),Qt=g(`$ZodULID`,(e,t)=>{t.pattern??=at,L.init(e,t)}),$t=g(`$ZodXID`,(e,t)=>{t.pattern??=ot,L.init(e,t)}),en=g(`$ZodKSUID`,(e,t)=>{t.pattern??=st,L.init(e,t)}),tn=g(`$ZodISODateTime`,(e,t)=>{t.pattern??=Et(t),L.init(e,t)}),nn=g(`$ZodISODate`,(e,t)=>{t.pattern??=Ct,L.init(e,t)}),rn=g(`$ZodISOTime`,(e,t)=>{t.pattern??=Tt(t),L.init(e,t)}),an=g(`$ZodISODuration`,(e,t)=>{t.pattern??=lt,L.init(e,t)}),on=g(`$ZodIPv4`,(e,t)=>{t.pattern??=mt,L.init(e,t),e._zod.bag.format=`ipv4`}),sn=g(`$ZodIPv6`,(e,t)=>{t.pattern??=ht,L.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),cn=g(`$ZodCIDRv4`,(e,t)=>{t.pattern??=gt,L.init(e,t)}),ln=g(`$ZodCIDRv6`,(e,t)=>{t.pattern??=_t,L.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function un(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const dn=g(`$ZodBase64`,(e,t)=>{t.pattern??=vt,L.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{un(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function fn(e){if(!yt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return un(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const pn=g(`$ZodBase64URL`,(e,t)=>{t.pattern??=yt,L.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{fn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),mn=g(`$ZodE164`,(e,t)=>{t.pattern??=xt,L.init(e,t)});function hn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const gn=g(`$ZodJWT`,(e,t)=>{L.init(e,t),e._zod.check=n=>{hn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),_n=g(`$ZodBoolean`,(e,t)=>{I.init(e,t),e._zod.pattern=Ot,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),vn=g(`$ZodUnknown`,(e,t)=>{I.init(e,t),e._zod.parse=e=>e}),yn=g(`$ZodNever`,(e,t)=>{I.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function bn(e,t,n){e.issues.length&&t.issues.push(...Re(n,e.issues)),t.value[n]=e.value}const xn=g(`$ZodArray`,(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>bn(t,n,e))):bn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function R(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Re(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Sn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ke(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Cn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>R(e,n,i,t,u,d))):R(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const wn=g(`$ZodObject`,(e,t)=>{if(I.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=ye(()=>Sn(t));b(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=C,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>R(n,t,e,s,r,i))):R(a,t,e,s,r,i)}return i?Cn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Tn=g(`$ZodObjectJIT`,(e,t)=>{wn.init(e,t);let n=e._zod.parse,r=ye(()=>Sn(t)),i=e=>{let t=new Vt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Ce(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Ce(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
11
11
|
if (${n}.issues.length) {
|
|
@@ -68,6 +68,6 @@ import{i as e,o as t,r as n,s as r,t as i}from"./dist-BoUxJM-2.mjs";import a fro
|
|
|
68
68
|
|
|
69
69
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=C,s=!v.jitless,c=s&&Ee.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Cn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function En(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!O(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>A(e,r,y())))}),t)}const Dn=g(`$ZodUnion`,(e,t)=>{I.init(e,t),b(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),b(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),b(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),b(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>xe(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>En(t,r,e,i)):En(o,r,e,i)}}),On=g(`$ZodIntersection`,(e,t)=>{I.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>An(e,t,n)):An(e,i,a)}});function kn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(w(e)&&w(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=kn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=kn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function An(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),O(e))return e;let o=kn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const jn=g(`$ZodEnum`,(e,t)=>{I.init(e,t);let n=_e(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Oe.has(typeof e)).map(e=>typeof e==`string`?T(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Mn=g(`$ZodTransform`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ge(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new _;return n.value=i,n.fallback=!0,n}});function Nn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Pn=g(`$ZodOptional`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,b(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),b(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${xe(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Nn(e,r)):Nn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Fn=g(`$ZodExactOptional`,(e,t)=>{Pn.init(e,t),b(e._zod,`values`,()=>t.innerType._zod.values),b(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),In=g(`$ZodNullable`,(e,t)=>{I.init(e,t),b(e._zod,`optin`,()=>t.innerType._zod.optin),b(e._zod,`optout`,()=>t.innerType._zod.optout),b(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${xe(e.source)}|null)$`):void 0}),b(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ln=g(`$ZodDefault`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,b(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Rn(e,t)):Rn(r,t)}});function Rn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const zn=g(`$ZodPrefault`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,b(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Bn=g(`$ZodNonOptional`,(e,t)=>{I.init(e,t),b(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Vn(t,e)):Vn(i,e)}});function Vn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Hn=g(`$ZodCatch`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,b(e._zod,`optout`,()=>t.innerType._zod.optout),b(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>A(e,n,y()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>A(e,n,y()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Un=g(`$ZodPipe`,(e,t)=>{I.init(e,t),b(e._zod,`values`,()=>t.in._zod.values),b(e._zod,`optin`,()=>t.in._zod.optin),b(e._zod,`optout`,()=>t.out._zod.optout),b(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>z(e,t.in,n)):z(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>z(e,t.out,n)):z(r,t.out,n)}});function z(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Wn=g(`$ZodReadonly`,(e,t)=>{I.init(e,t),b(e._zod,`propValues`,()=>t.innerType._zod.propValues),b(e._zod,`values`,()=>t.innerType._zod.values),b(e._zod,`optin`,()=>t.innerType?._zod?.optin),b(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Gn):Gn(r)}});function Gn(e){return e.value=Object.freeze(e.value),e}const Kn=g(`$ZodCustom`,(e,t)=>{P.init(e,t),I.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>qn(t,n,r,e));qn(i,n,r,e)}});function qn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(j(e))}}var Jn,Yn=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Xn(){return new Yn}(Jn=globalThis).__zod_globalRegistry??(Jn.__zod_globalRegistry=Xn());const B=globalThis.__zod_globalRegistry;function Zn(e,t){return new e({type:`string`,...D(t)})}function Qn(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...D(t)})}function $n(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...D(t)})}function er(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...D(t)})}function tr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...D(t)})}function nr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...D(t)})}function rr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...D(t)})}function ir(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...D(t)})}function ar(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...D(t)})}function or(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...D(t)})}function sr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...D(t)})}function cr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...D(t)})}function lr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...D(t)})}function ur(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...D(t)})}function dr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...D(t)})}function fr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...D(t)})}function pr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...D(t)})}function mr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...D(t)})}function hr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...D(t)})}function gr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...D(t)})}function _r(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...D(t)})}function vr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...D(t)})}function yr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...D(t)})}function br(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...D(t)})}function xr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...D(t)})}function Sr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...D(t)})}function Cr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...D(t)})}function wr(e,t){return new e({type:`boolean`,...D(t)})}function Tr(e){return new e({type:`unknown`})}function Er(e,t){return new e({type:`never`,...D(t)})}function Dr(e,t){return new jt({check:`max_length`,...D(t),maximum:e})}function V(e,t){return new Mt({check:`min_length`,...D(t),minimum:e})}function Or(e,t){return new Nt({check:`length_equals`,...D(t),length:e})}function kr(e,t){return new Pt({check:`string_format`,format:`regex`,...D(t),pattern:e})}function Ar(e){return new Ft({check:`string_format`,format:`lowercase`,...D(e)})}function jr(e){return new It({check:`string_format`,format:`uppercase`,...D(e)})}function Mr(e,t){return new Lt({check:`string_format`,format:`includes`,...D(t),includes:e})}function Nr(e,t){return new Rt({check:`string_format`,format:`starts_with`,...D(t),prefix:e})}function Pr(e,t){return new zt({check:`string_format`,format:`ends_with`,...D(t),suffix:e})}function H(e){return new Bt({check:`overwrite`,tx:e})}function Fr(e){return H(t=>t.normalize(e))}function Ir(){return H(e=>e.trim())}function Lr(){return H(e=>e.toLowerCase())}function Rr(){return H(e=>e.toUpperCase())}function zr(){return H(e=>we(e))}function Br(e,t,n){return new e({type:`array`,element:t,...D(n)})}function Vr(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...D(n)})}function Hr(e,t){let n=Ur(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(j(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(j(r))}},e(t.value,t)),t);return n}function Ur(e,t){let n=new P({check:`custom`,...D(t)});return n._zod.check=e,n}function Wr(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??B,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function U(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,U(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&W(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Gr(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
70
70
|
|
|
71
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Kr(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:G(t,`input`,e.processors),output:G(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function W(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return W(r.element,n);if(r.type===`set`)return W(r.valueType,n);if(r.type===`lazy`)return W(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return W(r.innerType,n);if(r.type===`intersection`)return W(r.left,n)||W(r.right,n);if(r.type===`record`||r.type===`map`)return W(r.keyType,n)||W(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:W(r.in,n)||W(r.out,n);if(r.type===`object`){for(let e in r.shape)if(W(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(W(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(W(e,n))return!0;return!!(r.rest&&W(r.rest,n))}return!1}const qr=(e,t={})=>n=>{let r=Wr({...n,processors:t});return U(e,r),Gr(r,e),Kr(r,e)},G=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Wr({...i??{},target:a,io:t,processors:n});return U(e,o),Gr(o,e),Kr(o,e)},Jr={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Yr=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Jr[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Xr=(e,t,n,r)=>{n.type=`boolean`},Zr=(e,t,n,r)=>{n.not={}},Qr=(e,t,n,r)=>{let i=e._zod.def,a=_e(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},$r=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ei=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ti=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=U(a.element,t,{...r,path:[...r.path,`items`]})},ni=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=U(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=U(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ri=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>U(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ii=(e,t,n,r)=>{let i=e._zod.def,a=U(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=U(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ai=(e,t,n,r)=>{let i=e._zod.def,a=U(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},oi=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},si=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ci=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},li=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ui=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;U(o,t,r);let s=t.seen.get(e);s.ref=o},di=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},fi=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pi=g(`ZodISODateTime`,(e,t)=>{tn.init(e,t),Y.init(e,t)});function mi(e){return br(pi,e)}const hi=g(`ZodISODate`,(e,t)=>{nn.init(e,t),Y.init(e,t)});function gi(e){return xr(hi,e)}const _i=g(`ZodISOTime`,(e,t)=>{rn.init(e,t),Y.init(e,t)});function vi(e){return Sr(_i,e)}const yi=g(`ZodISODuration`,(e,t)=>{an.init(e,t),Y.init(e,t)});function bi(e){return Cr(yi,e)}const xi=(e,t)=>{Ve.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>We(e,t)},flatten:{value:t=>Ue(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ve,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ve,2)}},isEmpty:{get(){return e.issues.length===0}}})},Si=g(`ZodError`,xi),K=g(`ZodError`,xi,{Parent:Error}),Ci=Ge(K),wi=Ke(K),Ti=M(K),Ei=N(K),Di=Ye(K),Oi=Xe(K),ki=Ze(K),Ai=Qe(K),ji=$e(K),Mi=et(K),Ni=tt(K),Pi=nt(K),Fi=new WeakMap;function Ii(e,t,n){let r=Object.getPrototypeOf(e),i=Fi.get(r);if(i||(i=new Set,Fi.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const q=g(`ZodType`,(e,t)=>(I.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:G(e,`input`),output:G(e,`output`)}}),e.toJSONSchema=qr(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Ci(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ti(e,t,n),e.parseAsync=async(t,n)=>wi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ei(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Di(e,t,n),e.decode=(t,n)=>Oi(e,t,n),e.encodeAsync=async(t,n)=>ki(e,t,n),e.decodeAsync=async(t,n)=>Ai(e,t,n),e.safeEncode=(t,n)=>ji(e,t,n),e.safeDecode=(t,n)=>Mi(e,t,n),e.safeEncodeAsync=async(t,n)=>Ni(e,t,n),e.safeDecodeAsync=async(t,n)=>Pi(e,t,n),Ii(e,`ZodType`,{check(...e){let t=this.def;return this.clone(S(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return E(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(za(e,t))},superRefine(e,t){return this.check(Ba(e,t))},overwrite(e){return this.check(H(e))},optional(){return xa(this)},exactOptional(){return Ca(this)},nullable(){return Ta(this)},nullish(){return xa(Ta(this))},nonoptional(e){return ja(this,e)},array(){return da(this)},or(e){return ma([this,e])},and(e){return ga(this,e)},transform(e){return Fa(this,ya(e))},default(e){return Da(this,e)},prefault(e){return ka(this,e)},catch(e){return Na(this,e)},pipe(e){return Fa(this,e)},readonly(){return La(this)},describe(e){let t=this.clone();return B.add(t,{description:e}),t},meta(...e){if(e.length===0)return B.get(this);let t=this.clone();return B.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return B.get(e)?.description},configurable:!0}),e)),Li=g(`_ZodString`,(e,t)=>{Ut.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yr(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ii(e,`_ZodString`,{regex(...e){return this.check(kr(...e))},includes(...e){return this.check(Mr(...e))},startsWith(...e){return this.check(Nr(...e))},endsWith(...e){return this.check(Pr(...e))},min(...e){return this.check(V(...e))},max(...e){return this.check(Dr(...e))},length(...e){return this.check(Or(...e))},nonempty(...e){return this.check(V(1,...e))},lowercase(e){return this.check(Ar(e))},uppercase(e){return this.check(jr(e))},trim(){return this.check(Ir())},normalize(...e){return this.check(Fr(...e))},toLowerCase(){return this.check(Lr())},toUpperCase(){return this.check(Rr())},slugify(){return this.check(zr())}})}),Ri=g(`ZodString`,(e,t)=>{Ut.init(e,t),Li.init(e,t),e.email=t=>e.check(Qn(zi,t)),e.url=t=>e.check(ir(Hi,t)),e.jwt=t=>e.check(yr(ra,t)),e.emoji=t=>e.check(ar(Ui,t)),e.guid=t=>e.check($n(Bi,t)),e.uuid=t=>e.check(er(Vi,t)),e.uuidv4=t=>e.check(tr(Vi,t)),e.uuidv6=t=>e.check(nr(Vi,t)),e.uuidv7=t=>e.check(rr(Vi,t)),e.nanoid=t=>e.check(or(Wi,t)),e.guid=t=>e.check($n(Bi,t)),e.cuid=t=>e.check(sr(Gi,t)),e.cuid2=t=>e.check(cr(Ki,t)),e.ulid=t=>e.check(lr(qi,t)),e.base64=t=>e.check(gr(ea,t)),e.base64url=t=>e.check(_r(ta,t)),e.xid=t=>e.check(ur(Ji,t)),e.ksuid=t=>e.check(dr(Yi,t)),e.ipv4=t=>e.check(fr(Xi,t)),e.ipv6=t=>e.check(pr(Zi,t)),e.cidrv4=t=>e.check(mr(Qi,t)),e.cidrv6=t=>e.check(hr($i,t)),e.e164=t=>e.check(vr(na,t)),e.datetime=t=>e.check(mi(t)),e.date=t=>e.check(gi(t)),e.time=t=>e.check(vi(t)),e.duration=t=>e.check(bi(t))});function J(e){return Zn(Ri,e)}const Y=g(`ZodStringFormat`,(e,t)=>{L.init(e,t),Li.init(e,t)}),zi=g(`ZodEmail`,(e,t)=>{Kt.init(e,t),Y.init(e,t)}),Bi=g(`ZodGUID`,(e,t)=>{Wt.init(e,t),Y.init(e,t)}),Vi=g(`ZodUUID`,(e,t)=>{Gt.init(e,t),Y.init(e,t)}),Hi=g(`ZodURL`,(e,t)=>{qt.init(e,t),Y.init(e,t)}),Ui=g(`ZodEmoji`,(e,t)=>{Jt.init(e,t),Y.init(e,t)}),Wi=g(`ZodNanoID`,(e,t)=>{Yt.init(e,t),Y.init(e,t)}),Gi=g(`ZodCUID`,(e,t)=>{Xt.init(e,t),Y.init(e,t)}),Ki=g(`ZodCUID2`,(e,t)=>{Zt.init(e,t),Y.init(e,t)}),qi=g(`ZodULID`,(e,t)=>{Qt.init(e,t),Y.init(e,t)}),Ji=g(`ZodXID`,(e,t)=>{$t.init(e,t),Y.init(e,t)}),Yi=g(`ZodKSUID`,(e,t)=>{en.init(e,t),Y.init(e,t)}),Xi=g(`ZodIPv4`,(e,t)=>{on.init(e,t),Y.init(e,t)}),Zi=g(`ZodIPv6`,(e,t)=>{sn.init(e,t),Y.init(e,t)}),Qi=g(`ZodCIDRv4`,(e,t)=>{cn.init(e,t),Y.init(e,t)}),$i=g(`ZodCIDRv6`,(e,t)=>{ln.init(e,t),Y.init(e,t)}),ea=g(`ZodBase64`,(e,t)=>{dn.init(e,t),Y.init(e,t)}),ta=g(`ZodBase64URL`,(e,t)=>{pn.init(e,t),Y.init(e,t)}),na=g(`ZodE164`,(e,t)=>{mn.init(e,t),Y.init(e,t)}),ra=g(`ZodJWT`,(e,t)=>{gn.init(e,t),Y.init(e,t)}),ia=g(`ZodBoolean`,(e,t)=>{_n.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,n,r)});function aa(e){return wr(ia,e)}const oa=g(`ZodUnknown`,(e,t)=>{vn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function sa(){return Tr(oa)}const ca=g(`ZodNever`,(e,t)=>{yn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zr(e,t,n,r)});function la(e){return Er(ca,e)}const ua=g(`ZodArray`,(e,t)=>{xn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ti(e,t,n,r),e.element=t.element,Ii(e,`ZodArray`,{min(e,t){return this.check(V(e,t))},nonempty(e){return this.check(V(1,e))},max(e,t){return this.check(Dr(e,t))},length(e,t){return this.check(Or(e,t))},unwrap(){return this.element}})});function da(e,t){return Br(ua,e,t)}const fa=g(`ZodObject`,(e,t)=>{Tn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ni(e,t,n,r),b(e,`shape`,()=>t.shape),Ii(e,`ZodObject`,{keyof(){return Z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:sa()})},loose(){return this.clone({...this._zod.def,catchall:sa()})},strict(){return this.clone({...this._zod.def,catchall:la()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Me(this,e)},safeExtend(e){return Ne(this,e)},merge(e){return Pe(this,e)},pick(e){return Ae(this,e)},omit(e){return je(this,e)},partial(...e){return Fe(ba,this,e[0])},required(...e){return Ie(Aa,this,e[0])}})});function X(e,t){let n={type:`object`,shape:e??{},...D(t)};return new fa(n)}const pa=g(`ZodUnion`,(e,t)=>{Dn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ri(e,t,n,r),e.options=t.options});function ma(e,t){return new pa({type:`union`,options:e,...D(t)})}const ha=g(`ZodIntersection`,(e,t)=>{On.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ii(e,t,n,r)});function ga(e,t){return new ha({type:`intersection`,left:e,right:t})}const _a=g(`ZodEnum`,(e,t)=>{jn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qr(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new _a({...t,checks:[],...D(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new _a({...t,checks:[],...D(r),entries:i})}});function Z(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new _a({type:`enum`,entries:n,...D(t)})}const va=g(`ZodTransform`,(e,t)=>{Mn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ei(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ge(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(j(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(j(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function ya(e){return new va({type:`transform`,transform:e})}const ba=g(`ZodOptional`,(e,t)=>{Pn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xa(e){return new ba({type:`optional`,innerType:e})}const Sa=g(`ZodExactOptional`,(e,t)=>{Fn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ca(e){return new Sa({type:`optional`,innerType:e})}const wa=g(`ZodNullable`,(e,t)=>{In.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ta(e){return new wa({type:`nullable`,innerType:e})}const Ea=g(`ZodDefault`,(e,t)=>{Ln.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>si(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Da(e,t){return new Ea({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():De(t)}})}const Oa=g(`ZodPrefault`,(e,t)=>{zn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ci(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ka(e,t){return new Oa({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():De(t)}})}const Aa=g(`ZodNonOptional`,(e,t)=>{Bn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ja(e,t){return new Aa({type:`nonoptional`,innerType:e,...D(t)})}const Ma=g(`ZodCatch`,(e,t)=>{Hn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Na(e,t){return new Ma({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Pa=g(`ZodPipe`,(e,t)=>{Un.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r),e.in=t.in,e.out=t.out});function Fa(e,t){return new Pa({type:`pipe`,in:e,out:t})}const Ia=g(`ZodReadonly`,(e,t)=>{Wn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ia({type:`readonly`,innerType:e})}const Ra=g(`ZodCustom`,(e,t)=>{Kn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$r(e,t,n,r)});function za(e,t={}){return Vr(Ra,e,t)}function Ba(e,t){return Hr(e,t)}const Va=5*1024*1024,Ha=`输入内容不能超过 5MB`,Q={name:`output`,description:`输出文件,默认输出到 stdout`,type:`string`,input:!1,valueName:`file`},Ua={name:`extract`,title:`提取 Markdown 纯文本`,description:`从 Markdown 文档中提取纯文本内容,移除所有格式标记(如标题符号、链接、图片、代码块等)。适用于字数统计、文本分析、生成摘要、或作为语音朗读的输入。`,inputSchema:X({markdown:J().max(Va,Ha).describe(`要提取文本的 Markdown 源文本`)}),outputSchema:X({result:J().describe(`提取后的纯文本内容,保留段落分隔,已移除所有 Markdown 格式标记`)}),cli:{inputField:`markdown`,inputLabel:`file`,options:[Q]}},Wa={name:`lint`,title:`校验并修复 Markdown`,description:`使用 markdownlint 规则对 Markdown 内容进行规范校验,并自动修复可修复的问题。包括:统一标题层级、修复列表缩进、规范空行、移除行尾空格等。`,inputSchema:X({markdown:J().max(Va,Ha).describe(`要校验和修复的 Markdown 源文本`)}),outputSchema:X({result:J().describe(`校验并自动修复后的 Markdown 文本`)}),cli:{inputField:`markdown`,inputLabel:`file`,options:[Q,{name:`fix`,description:`将修复结果写回输入文件;不能与 --output 同时使用`,type:`boolean`,input:!1}]}},Ga={name:`parse`,title:`解析 HTML 为 Markdown`,description:`将 HTML 内容反向转换为 Markdown 格式。适用于从网页复制内容、导入已有文章、或将富文本转换为 Markdown 进行编辑。会自动清理不安全的 HTML 标签。`,inputSchema:X({html:J().max(Va,Ha).describe(`要转换的 HTML 源代码,可以是完整文档或 HTML 片段`)}),outputSchema:X({result:J().describe(`转换后的 Markdown 文本,使用 - 作为无序列表标记`)}),cli:{inputField:`html`,inputLabel:`file`,options:[Q]}},Ka=[{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,isDark:!0},{id:`catppuccin-latte`,name:`Catppuccin Latte`,isDark:!1},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,isDark:!0},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,isDark:!0},{id:`kimbie-dark`,name:`Kimbie Dark`,isDark:!0},{id:`kimbie-light`,name:`Kimbie Light`,isDark:!1},{id:`panda-syntax-dark`,name:`Panda Syntax Dark`,isDark:!0},{id:`panda-syntax-light`,name:`Panda Syntax Light`,isDark:!1},{id:`paraiso-dark`,name:`Paraiso Dark`,isDark:!0},{id:`paraiso-light`,name:`Paraiso Light`,isDark:!1},{id:`rose-pine`,name:`Rosé Pine`,isDark:!0},{id:`rose-pine-dawn`,name:`Rosé Pine Dawn`,isDark:!1},{id:`tokyo-night-dark`,name:`Tokyo Night Dark`,isDark:!0},{id:`tokyo-night-light`,name:`Tokyo Night Light`,isDark:!1}].map(e=>e.id);function qa(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Ja(e){let t=e.bg.replace(`#`,``),n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),i=Number.parseInt(t.slice(4,6),16);return(.2126*n+.7152*r+.0722*i)/255<.5}const Ya=[{id:``,name:`Default`,isDark:!1},...Object.keys(i).sort().map(e=>({id:e,name:qa(e),isDark:Ja(i[e])}))].map(e=>e.id),Xa=[`html`,`wechat`],Za=Z(Xa),Qa=Z(e),$a=Z(Ka),eo=Z(Ya),to=Z(r),no=Z(t),ro={name:`render`,title:`渲染 Markdown 为 HTML`,description:`将 Markdown 内容渲染为适用于不同平台的 HTML 片段。支持 GFM 语法、数学公式(KaTeX)、代码高亮,并自动将 CSS 样式内联到元素上,确保在微信公众号等富文本编辑器中正确显示。`,inputSchema:X({markdown:J().max(Va,Ha).describe(`要渲染的 Markdown 源文本,支持 GFM(GitHub Flavored Markdown)语法、数学公式($..$ 或 $$..$$)`),markdownStyle:Qa.optional().default(n).describe(`Markdown 排版样式 ID`),codeTheme:$a.optional().default(`kimbie-light`).describe(`代码块高亮主题 ID`),mermaidTheme:eo.optional().default(``).describe(`Mermaid 流程图主题 ID,空字符串表示使用默认主题`),infographicTheme:to.optional().default(`default`).describe(`Infographic 信息图主题 ID`),infographicPalette:no.optional().default(`antv`).describe(`Infographic 信息图配色 ID`),customCss:J().max(5e4,`自定义 CSS 不能超过 50000 字符`).optional().default(``).describe(`自定义 CSS 样式,在主题样式之后应用。选择器需约束在 #bm-md 下,例如:#bm-md h1 { color: red; }`),enableFootnoteLinks:aa().optional().default(!0).describe(`是否将文中链接自动转换为脚注形式,便于阅读时查看原始链接`),openLinksInNewWindow:aa().optional().default(!0).describe(`是否为所有外部链接添加 target="_blank",在新窗口打开`),platform:Za.optional().default(`html`).describe(`目标发布平台。wechat 会进行微信公众号适配,html 使用通用 HTML 输出`),footnoteLabel:J().max(50).optional().default(`Footnotes`).describe(`GFM 脚注区域标题`),referenceTitle:J().max(50).optional().default(`References`).describe(`外部链接参考区域标题`)}),outputSchema:X({result:J().describe(`渲染后的 HTML 片段,CSS 样式已内联到元素上,可直接复制粘贴到富文本编辑器`)}),cli:{inputField:`markdown`,inputLabel:`file`,options:[Q,{name:`platform`,description:`目标发布平台`,type:`string`,choices:Xa,valueName:`platform`},{name:`markdownStyle`,description:`Markdown 排版样式 ID`,type:`string`,choices:e,valueName:`id`},{name:`codeTheme`,description:`代码块高亮主题 ID`,type:`string`,choices:Ka,valueName:`id`},{name:`mermaidTheme`,description:`Mermaid 流程图主题 ID,留空表示使用默认主题`,type:`string`,choices:Ya,valueName:`id`},{name:`infographicTheme`,description:`Infographic 信息图主题 ID`,type:`string`,choices:r,valueName:`id`},{name:`infographicPalette`,description:`Infographic 信息图配色 ID`,type:`string`,choices:t,valueName:`id`},{name:`customCss`,description:`追加自定义 CSS`,type:`string`,valueName:`css`},{name:`customCssFile`,description:`从文件追加自定义 CSS`,type:`string`,input:!1,valueName:`file`},{name:`enableFootnoteLinks`,description:`关闭文中链接脚注转换`,type:`boolean`,cliKey:`footnoteLinks`,flag:`no-footnote-links`},{name:`openLinksInNewWindow`,description:`关闭外部链接新窗口打开`,type:`boolean`,cliKey:`openLinks`,flag:`no-open-links`},{name:`footnoteLabel`,description:`GFM 脚注区域标题`,type:`string`,valueName:`text`},{name:`referenceTitle`,description:`外部链接参考区域标题`,type:`string`,valueName:`text`}]}};function io(e,t){return{...e,run:t}}const ao=[io(ro,async e=>{let{render:t}=await import(`./html-CGVTbdd7.mjs`);return t(e)}),io(Ga,async e=>{let{parse:t}=await import(`./html-CSUv3zEC.mjs`);return t(e.html)}),io(Ua,async e=>{let{extract:t}=await import(`./text-CtjMWodY.mjs`);return t(e.markdown)}),io(Wa,async e=>{let{lint:t}=await import(`./markdown-KovTQZtX.mjs`);return t(e.markdown)})];function oo(e,t){let n=e.run;return n(t)}const so=ao;function co(e){return e instanceof Si?e.issues.map(e=>`${e.path.join(`.`)||`input`}: ${e.message}`).join(`
|
|
71
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Kr(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:G(t,`input`,e.processors),output:G(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function W(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return W(r.element,n);if(r.type===`set`)return W(r.valueType,n);if(r.type===`lazy`)return W(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return W(r.innerType,n);if(r.type===`intersection`)return W(r.left,n)||W(r.right,n);if(r.type===`record`||r.type===`map`)return W(r.keyType,n)||W(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:W(r.in,n)||W(r.out,n);if(r.type===`object`){for(let e in r.shape)if(W(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(W(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(W(e,n))return!0;return!!(r.rest&&W(r.rest,n))}return!1}const qr=(e,t={})=>n=>{let r=Wr({...n,processors:t});return U(e,r),Gr(r,e),Kr(r,e)},G=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Wr({...i??{},target:a,io:t,processors:n});return U(e,o),Gr(o,e),Kr(o,e)},Jr={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Yr=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Jr[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Xr=(e,t,n,r)=>{n.type=`boolean`},Zr=(e,t,n,r)=>{n.not={}},Qr=(e,t,n,r)=>{let i=e._zod.def,a=_e(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},$r=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ei=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ti=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=U(a.element,t,{...r,path:[...r.path,`items`]})},ni=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=U(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=U(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ri=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>U(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ii=(e,t,n,r)=>{let i=e._zod.def,a=U(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=U(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ai=(e,t,n,r)=>{let i=e._zod.def,a=U(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},oi=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},si=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ci=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},li=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ui=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;U(o,t,r);let s=t.seen.get(e);s.ref=o},di=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},fi=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pi=g(`ZodISODateTime`,(e,t)=>{tn.init(e,t),Y.init(e,t)});function mi(e){return br(pi,e)}const hi=g(`ZodISODate`,(e,t)=>{nn.init(e,t),Y.init(e,t)});function gi(e){return xr(hi,e)}const _i=g(`ZodISOTime`,(e,t)=>{rn.init(e,t),Y.init(e,t)});function vi(e){return Sr(_i,e)}const yi=g(`ZodISODuration`,(e,t)=>{an.init(e,t),Y.init(e,t)});function bi(e){return Cr(yi,e)}const xi=(e,t)=>{Ve.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>We(e,t)},flatten:{value:t=>Ue(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ve,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ve,2)}},isEmpty:{get(){return e.issues.length===0}}})},Si=g(`ZodError`,xi),K=g(`ZodError`,xi,{Parent:Error}),Ci=Ge(K),wi=Ke(K),Ti=M(K),Ei=N(K),Di=Ye(K),Oi=Xe(K),ki=Ze(K),Ai=Qe(K),ji=$e(K),Mi=et(K),Ni=tt(K),Pi=nt(K),Fi=new WeakMap;function Ii(e,t,n){let r=Object.getPrototypeOf(e),i=Fi.get(r);if(i||(i=new Set,Fi.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const q=g(`ZodType`,(e,t)=>(I.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:G(e,`input`),output:G(e,`output`)}}),e.toJSONSchema=qr(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Ci(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ti(e,t,n),e.parseAsync=async(t,n)=>wi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ei(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Di(e,t,n),e.decode=(t,n)=>Oi(e,t,n),e.encodeAsync=async(t,n)=>ki(e,t,n),e.decodeAsync=async(t,n)=>Ai(e,t,n),e.safeEncode=(t,n)=>ji(e,t,n),e.safeDecode=(t,n)=>Mi(e,t,n),e.safeEncodeAsync=async(t,n)=>Ni(e,t,n),e.safeDecodeAsync=async(t,n)=>Pi(e,t,n),Ii(e,`ZodType`,{check(...e){let t=this.def;return this.clone(S(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return E(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(za(e,t))},superRefine(e,t){return this.check(Ba(e,t))},overwrite(e){return this.check(H(e))},optional(){return xa(this)},exactOptional(){return Ca(this)},nullable(){return Ta(this)},nullish(){return xa(Ta(this))},nonoptional(e){return ja(this,e)},array(){return da(this)},or(e){return ma([this,e])},and(e){return ga(this,e)},transform(e){return Fa(this,ya(e))},default(e){return Da(this,e)},prefault(e){return ka(this,e)},catch(e){return Na(this,e)},pipe(e){return Fa(this,e)},readonly(){return La(this)},describe(e){let t=this.clone();return B.add(t,{description:e}),t},meta(...e){if(e.length===0)return B.get(this);let t=this.clone();return B.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return B.get(e)?.description},configurable:!0}),e)),Li=g(`_ZodString`,(e,t)=>{Ut.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yr(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ii(e,`_ZodString`,{regex(...e){return this.check(kr(...e))},includes(...e){return this.check(Mr(...e))},startsWith(...e){return this.check(Nr(...e))},endsWith(...e){return this.check(Pr(...e))},min(...e){return this.check(V(...e))},max(...e){return this.check(Dr(...e))},length(...e){return this.check(Or(...e))},nonempty(...e){return this.check(V(1,...e))},lowercase(e){return this.check(Ar(e))},uppercase(e){return this.check(jr(e))},trim(){return this.check(Ir())},normalize(...e){return this.check(Fr(...e))},toLowerCase(){return this.check(Lr())},toUpperCase(){return this.check(Rr())},slugify(){return this.check(zr())}})}),Ri=g(`ZodString`,(e,t)=>{Ut.init(e,t),Li.init(e,t),e.email=t=>e.check(Qn(zi,t)),e.url=t=>e.check(ir(Hi,t)),e.jwt=t=>e.check(yr(ra,t)),e.emoji=t=>e.check(ar(Ui,t)),e.guid=t=>e.check($n(Bi,t)),e.uuid=t=>e.check(er(Vi,t)),e.uuidv4=t=>e.check(tr(Vi,t)),e.uuidv6=t=>e.check(nr(Vi,t)),e.uuidv7=t=>e.check(rr(Vi,t)),e.nanoid=t=>e.check(or(Wi,t)),e.guid=t=>e.check($n(Bi,t)),e.cuid=t=>e.check(sr(Gi,t)),e.cuid2=t=>e.check(cr(Ki,t)),e.ulid=t=>e.check(lr(qi,t)),e.base64=t=>e.check(gr(ea,t)),e.base64url=t=>e.check(_r(ta,t)),e.xid=t=>e.check(ur(Ji,t)),e.ksuid=t=>e.check(dr(Yi,t)),e.ipv4=t=>e.check(fr(Xi,t)),e.ipv6=t=>e.check(pr(Zi,t)),e.cidrv4=t=>e.check(mr(Qi,t)),e.cidrv6=t=>e.check(hr($i,t)),e.e164=t=>e.check(vr(na,t)),e.datetime=t=>e.check(mi(t)),e.date=t=>e.check(gi(t)),e.time=t=>e.check(vi(t)),e.duration=t=>e.check(bi(t))});function J(e){return Zn(Ri,e)}const Y=g(`ZodStringFormat`,(e,t)=>{L.init(e,t),Li.init(e,t)}),zi=g(`ZodEmail`,(e,t)=>{Kt.init(e,t),Y.init(e,t)}),Bi=g(`ZodGUID`,(e,t)=>{Wt.init(e,t),Y.init(e,t)}),Vi=g(`ZodUUID`,(e,t)=>{Gt.init(e,t),Y.init(e,t)}),Hi=g(`ZodURL`,(e,t)=>{qt.init(e,t),Y.init(e,t)}),Ui=g(`ZodEmoji`,(e,t)=>{Jt.init(e,t),Y.init(e,t)}),Wi=g(`ZodNanoID`,(e,t)=>{Yt.init(e,t),Y.init(e,t)}),Gi=g(`ZodCUID`,(e,t)=>{Xt.init(e,t),Y.init(e,t)}),Ki=g(`ZodCUID2`,(e,t)=>{Zt.init(e,t),Y.init(e,t)}),qi=g(`ZodULID`,(e,t)=>{Qt.init(e,t),Y.init(e,t)}),Ji=g(`ZodXID`,(e,t)=>{$t.init(e,t),Y.init(e,t)}),Yi=g(`ZodKSUID`,(e,t)=>{en.init(e,t),Y.init(e,t)}),Xi=g(`ZodIPv4`,(e,t)=>{on.init(e,t),Y.init(e,t)}),Zi=g(`ZodIPv6`,(e,t)=>{sn.init(e,t),Y.init(e,t)}),Qi=g(`ZodCIDRv4`,(e,t)=>{cn.init(e,t),Y.init(e,t)}),$i=g(`ZodCIDRv6`,(e,t)=>{ln.init(e,t),Y.init(e,t)}),ea=g(`ZodBase64`,(e,t)=>{dn.init(e,t),Y.init(e,t)}),ta=g(`ZodBase64URL`,(e,t)=>{pn.init(e,t),Y.init(e,t)}),na=g(`ZodE164`,(e,t)=>{mn.init(e,t),Y.init(e,t)}),ra=g(`ZodJWT`,(e,t)=>{gn.init(e,t),Y.init(e,t)}),ia=g(`ZodBoolean`,(e,t)=>{_n.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,n,r)});function aa(e){return wr(ia,e)}const oa=g(`ZodUnknown`,(e,t)=>{vn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function sa(){return Tr(oa)}const ca=g(`ZodNever`,(e,t)=>{yn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zr(e,t,n,r)});function la(e){return Er(ca,e)}const ua=g(`ZodArray`,(e,t)=>{xn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ti(e,t,n,r),e.element=t.element,Ii(e,`ZodArray`,{min(e,t){return this.check(V(e,t))},nonempty(e){return this.check(V(1,e))},max(e,t){return this.check(Dr(e,t))},length(e,t){return this.check(Or(e,t))},unwrap(){return this.element}})});function da(e,t){return Br(ua,e,t)}const fa=g(`ZodObject`,(e,t)=>{Tn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ni(e,t,n,r),b(e,`shape`,()=>t.shape),Ii(e,`ZodObject`,{keyof(){return Z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:sa()})},loose(){return this.clone({...this._zod.def,catchall:sa()})},strict(){return this.clone({...this._zod.def,catchall:la()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Me(this,e)},safeExtend(e){return Ne(this,e)},merge(e){return Pe(this,e)},pick(e){return Ae(this,e)},omit(e){return je(this,e)},partial(...e){return Fe(ba,this,e[0])},required(...e){return Ie(Aa,this,e[0])}})});function X(e,t){let n={type:`object`,shape:e??{},...D(t)};return new fa(n)}const pa=g(`ZodUnion`,(e,t)=>{Dn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ri(e,t,n,r),e.options=t.options});function ma(e,t){return new pa({type:`union`,options:e,...D(t)})}const ha=g(`ZodIntersection`,(e,t)=>{On.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ii(e,t,n,r)});function ga(e,t){return new ha({type:`intersection`,left:e,right:t})}const _a=g(`ZodEnum`,(e,t)=>{jn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qr(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new _a({...t,checks:[],...D(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new _a({...t,checks:[],...D(r),entries:i})}});function Z(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new _a({type:`enum`,entries:n,...D(t)})}const va=g(`ZodTransform`,(e,t)=>{Mn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ei(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ge(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(j(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(j(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function ya(e){return new va({type:`transform`,transform:e})}const ba=g(`ZodOptional`,(e,t)=>{Pn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xa(e){return new ba({type:`optional`,innerType:e})}const Sa=g(`ZodExactOptional`,(e,t)=>{Fn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ca(e){return new Sa({type:`optional`,innerType:e})}const wa=g(`ZodNullable`,(e,t)=>{In.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ta(e){return new wa({type:`nullable`,innerType:e})}const Ea=g(`ZodDefault`,(e,t)=>{Ln.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>si(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Da(e,t){return new Ea({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():De(t)}})}const Oa=g(`ZodPrefault`,(e,t)=>{zn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ci(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ka(e,t){return new Oa({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():De(t)}})}const Aa=g(`ZodNonOptional`,(e,t)=>{Bn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ja(e,t){return new Aa({type:`nonoptional`,innerType:e,...D(t)})}const Ma=g(`ZodCatch`,(e,t)=>{Hn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Na(e,t){return new Ma({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Pa=g(`ZodPipe`,(e,t)=>{Un.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r),e.in=t.in,e.out=t.out});function Fa(e,t){return new Pa({type:`pipe`,in:e,out:t})}const Ia=g(`ZodReadonly`,(e,t)=>{Wn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ia({type:`readonly`,innerType:e})}const Ra=g(`ZodCustom`,(e,t)=>{Kn.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$r(e,t,n,r)});function za(e,t={}){return Vr(Ra,e,t)}function Ba(e,t){return Hr(e,t)}const Va=5*1024*1024,Ha=`输入内容不能超过 5MB`,Q={name:`output`,description:`输出文件,默认输出到 stdout`,type:`string`,input:!1,valueName:`file`},Ua={name:`extract`,title:`提取 Markdown 纯文本`,description:`从 Markdown 文档中提取纯文本内容,移除所有格式标记(如标题符号、链接、图片、代码块等)。适用于字数统计、文本分析、生成摘要、或作为语音朗读的输入。`,inputSchema:X({markdown:J().max(Va,Ha).describe(`要提取文本的 Markdown 源文本`)}),outputSchema:X({result:J().describe(`提取后的纯文本内容,保留段落分隔,已移除所有 Markdown 格式标记`)}),cli:{inputField:`markdown`,inputLabel:`file`,options:[Q]}},Wa={name:`lint`,title:`校验并修复 Markdown`,description:`使用 markdownlint 规则对 Markdown 内容进行规范校验,并自动修复可修复的问题。包括:统一标题层级、修复列表缩进、规范空行、移除行尾空格等。`,inputSchema:X({markdown:J().max(Va,Ha).describe(`要校验和修复的 Markdown 源文本`)}),outputSchema:X({result:J().describe(`校验并自动修复后的 Markdown 文本`)}),cli:{inputField:`markdown`,inputLabel:`file`,options:[Q,{name:`fix`,description:`将修复结果写回输入文件;不能与 --output 同时使用`,type:`boolean`,input:!1}]}},Ga={name:`parse`,title:`解析 HTML 为 Markdown`,description:`将 HTML 内容反向转换为 Markdown 格式。适用于从网页复制内容、导入已有文章、或将富文本转换为 Markdown 进行编辑。会自动清理不安全的 HTML 标签。`,inputSchema:X({html:J().max(Va,Ha).describe(`要转换的 HTML 源代码,可以是完整文档或 HTML 片段`)}),outputSchema:X({result:J().describe(`转换后的 Markdown 文本,使用 - 作为无序列表标记`)}),cli:{inputField:`html`,inputLabel:`file`,options:[Q]}},Ka=[{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,isDark:!0},{id:`catppuccin-latte`,name:`Catppuccin Latte`,isDark:!1},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,isDark:!0},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,isDark:!0},{id:`kimbie-dark`,name:`Kimbie Dark`,isDark:!0},{id:`kimbie-light`,name:`Kimbie Light`,isDark:!1},{id:`panda-syntax-dark`,name:`Panda Syntax Dark`,isDark:!0},{id:`panda-syntax-light`,name:`Panda Syntax Light`,isDark:!1},{id:`paraiso-dark`,name:`Paraiso Dark`,isDark:!0},{id:`paraiso-light`,name:`Paraiso Light`,isDark:!1},{id:`rose-pine`,name:`Rosé Pine`,isDark:!0},{id:`rose-pine-dawn`,name:`Rosé Pine Dawn`,isDark:!1},{id:`tokyo-night-dark`,name:`Tokyo Night Dark`,isDark:!0},{id:`tokyo-night-light`,name:`Tokyo Night Light`,isDark:!1}].map(e=>e.id);function qa(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Ja(e){let t=e.bg.replace(`#`,``),n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),i=Number.parseInt(t.slice(4,6),16);return(.2126*n+.7152*r+.0722*i)/255<.5}const Ya=[{id:``,name:`Default`,isDark:!1},...Object.keys(i).sort().map(e=>({id:e,name:qa(e),isDark:Ja(i[e])}))].map(e=>e.id),Xa=[`html`,`wechat`],Za=Z(Xa),Qa=Z(e),$a=Z(Ka),eo=Z(Ya),to=Z(r),no=Z(t),ro={name:`render`,title:`渲染 Markdown 为 HTML`,description:`将 Markdown 内容渲染为适用于不同平台的 HTML 片段。支持 GFM 语法、数学公式(KaTeX)、代码高亮,并自动将 CSS 样式内联到元素上,确保在微信公众号等富文本编辑器中正确显示。`,inputSchema:X({markdown:J().max(Va,Ha).describe(`要渲染的 Markdown 源文本,支持 GFM(GitHub Flavored Markdown)语法、数学公式($..$ 或 $$..$$)`),markdownStyle:Qa.optional().default(n).describe(`Markdown 排版样式 ID`),codeTheme:$a.optional().default(`kimbie-light`).describe(`代码块高亮主题 ID`),mermaidTheme:eo.optional().default(``).describe(`Mermaid 流程图主题 ID,空字符串表示使用默认主题`),infographicTheme:to.optional().default(`default`).describe(`Infographic 信息图主题 ID`),infographicPalette:no.optional().default(`antv`).describe(`Infographic 信息图配色 ID`),customCss:J().max(5e4,`自定义 CSS 不能超过 50000 字符`).optional().default(``).describe(`自定义 CSS 样式,在主题样式之后应用。选择器需约束在 #bm-md 下,例如:#bm-md h1 { color: red; }`),enableFootnoteLinks:aa().optional().default(!0).describe(`是否将文中链接自动转换为脚注形式,便于阅读时查看原始链接`),breaks:aa().optional().default(!1).describe(`是否将段落内的软换行转换为 HTML 换行,不影响代码块`),openLinksInNewWindow:aa().optional().default(!0).describe(`是否为所有外部链接添加 target="_blank",在新窗口打开`),platform:Za.optional().default(`html`).describe(`目标发布平台。wechat 会进行微信公众号适配,html 使用通用 HTML 输出`),footnoteLabel:J().max(50).optional().default(`Footnotes`).describe(`GFM 脚注区域标题`),referenceTitle:J().max(50).optional().default(`References`).describe(`外部链接参考区域标题`)}),outputSchema:X({result:J().describe(`渲染后的 HTML 片段,CSS 样式已内联到元素上,可直接复制粘贴到富文本编辑器`)}),cli:{inputField:`markdown`,inputLabel:`file`,options:[Q,{name:`breaks`,description:`将段落内的软换行转换为 HTML 换行`,type:`boolean`},{name:`platform`,description:`目标发布平台`,type:`string`,choices:Xa,valueName:`platform`},{name:`markdownStyle`,description:`Markdown 排版样式 ID`,type:`string`,choices:e,valueName:`id`},{name:`codeTheme`,description:`代码块高亮主题 ID`,type:`string`,choices:Ka,valueName:`id`},{name:`mermaidTheme`,description:`Mermaid 流程图主题 ID,留空表示使用默认主题`,type:`string`,choices:Ya,valueName:`id`},{name:`infographicTheme`,description:`Infographic 信息图主题 ID`,type:`string`,choices:r,valueName:`id`},{name:`infographicPalette`,description:`Infographic 信息图配色 ID`,type:`string`,choices:t,valueName:`id`},{name:`customCss`,description:`追加自定义 CSS`,type:`string`,valueName:`css`},{name:`customCssFile`,description:`从文件追加自定义 CSS`,type:`string`,input:!1,valueName:`file`},{name:`enableFootnoteLinks`,description:`关闭文中链接脚注转换`,type:`boolean`,cliKey:`footnoteLinks`,flag:`no-footnote-links`},{name:`openLinksInNewWindow`,description:`关闭外部链接新窗口打开`,type:`boolean`,cliKey:`openLinks`,flag:`no-open-links`},{name:`footnoteLabel`,description:`GFM 脚注区域标题`,type:`string`,valueName:`text`},{name:`referenceTitle`,description:`外部链接参考区域标题`,type:`string`,valueName:`text`}]}};function io(e,t){return{...e,run:t}}const ao=[io(ro,async e=>{let{render:t}=await import(`./html-BvKWgga7.mjs`);return t(e)}),io(Ga,async e=>{let{parse:t}=await import(`./html-CSUv3zEC.mjs`);return t(e.html)}),io(Ua,async e=>{let{extract:t}=await import(`./text-iKoE8yN9.mjs`);return t(e.markdown)}),io(Wa,async e=>{let{lint:t}=await import(`./markdown-KovTQZtX.mjs`);return t(e.markdown)})];function oo(e,t){let n=e.run;return n(t)}const so=ao;function co(e){return e instanceof Si?e.issues.map(e=>`${e.path.join(`.`)||`input`}: ${e.message}`).join(`
|
|
72
72
|
`):e instanceof Error?e.message:String(e)}function lo(e,t){let n=t.flag??t.name.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),r=t.type===`boolean`?`--${n}`:`--${n} <${t.valueName??n}>`,i=t.choices?.filter(Boolean),a=i?.length?`${t.description}(可选值: ${i.join(`, `)})`:t.description;e.option(r,a)}async function uo(e){if(e)return o(e,`utf8`);if(a.stdin.isTTY)throw Error(`请提供输入文件,或通过 stdin 传入内容`);let t=``;a.stdin.setEncoding(`utf8`);for await(let e of a.stdin)t+=String(e);return t}async function fo(e,t){if(t){await s(t,e);return}a.stdout.write(e)}async function po(e,t,n){let r={[e.cli.inputField]:await uo(t)};for(let t of e.cli.options){if(t.input===!1)continue;let e=n[t.cliKey??t.name];e!==void 0&&(r[t.name]=e)}if(e.name===`render`){let e=typeof n.customCssFile==`string`&&n.customCssFile.length>0?n.customCssFile:void 0;e&&(r.customCss=[typeof r.customCss==`string`?r.customCss:``,await o(e,`utf8`)].filter(Boolean).join(`
|
|
73
73
|
`))}return r}async function mo(e,t,n){let r=typeof n.output==`string`&&n.output.length>0?n.output:void 0,i=n.fix===!0;if(e.name===`lint`&&i){if(!t)throw Error(`--fix 需要提供输入文件`);if(r)throw Error(`--fix 不能与 --output 同时使用`)}let a=await po(e,t,n),o=await oo(e,e.inputSchema.parse(a));if(e.name===`lint`&&i){await fo(o,t);return}await fo(o,r)}const $=fe(`bmmd`);function ho(e){e().catch(e=>{console.error(`bmmd: ${co(e)}`),a.exitCode=1})}for(let e of so){let t=$.command(`${e.name} [${e.cli.inputLabel}]`,e.description);for(let n of e.cli.options)lo(t,n);t.action((t,n)=>ho(()=>mo(e,t,n)))}$.help(e=>{let t=$.matchedCommandName&&$.matchedCommand?.description?$.matchedCommand.description:me,n=e.findIndex(e=>e.body.includes(pe));e.splice(n+1,0,{body:t})}),$.version(pe,`--version`),a.argv.length<=2?$.outputHelp():$.parse();export{};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,t as n}from"./rolldown-runtime-8V8biNmG.mjs";function r(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}const i=[`default`,`dark`,`hand-drawn`],a=[`antv`,`spectral`],o=i.map(e=>({id:e,name:r(e),isDark:e===`dark`})),s=a.map(e=>({id:e,name:r(e)})),c=o.map(e=>e.id),l=s.map(e=>e.id);function u(e){return i.includes(e)}function d(e){return a.includes(e)}const f=[{id:`kami`,name:`Kami`},{id:`bauhaus`,name:`Bauhaus`},{id:`blueprint`,name:`Blueprint`},{id:`botanical`,name:`Botanical`},{id:`newsprint`,name:`Newsprint`},{id:`retro`,name:`Retro`},{id:`sketch`,name:`Sketch`},{id:`terminal`,name:`Terminal`}],p=f.map(e=>e.id),m=`kami`,h=new Set([`kami`,`botanical`,`newsprint`]);function g(e){return e!=null&&f.some(t=>t.id===e)&&!h.has(e)?`sans-serif`:`serif`}var _=e(n(((e,n)=>{(function(t){if(typeof e==`object`&&n!==void 0)n.exports=t();else if(typeof define==`function`&&define.amd)define([],t);else{var r=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this;r.dagre=t()}})(function(){return(function(){function e(n,r,i){function a(s,c){if(!r[s]){if(!n[s]){var l=typeof t==`function`&&t;if(!c&&l)return l(s,!0);if(o)return o(s,!0);var u=Error(`Cannot find module '`+s+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=r[s]={exports:{}};n[s][0].call(d.exports,function(e){var t=n[s][1][e];return a(t||e)},d,d.exports,e,n,r,i)}return r[s].exports}for(var o=typeof t==`function`&&t,s=0;s<i.length;s++)a(i[s]);return a}return e})()({1:[function(e,t,n){t.exports={graphlib:e("@dagrejs/graphlib"),layout:e("./lib/layout"),debug:e("./lib/debug"),util:{time:e("./lib/util").time,notime:e("./lib/util").notime},version:e("./lib/version")}},{"./lib/debug":6,"./lib/layout":8,"./lib/util":27,"./lib/version":28,"@dagrejs/graphlib":29}],2:[function(e,t,n){let r=e("./greedy-fas"),i=e("./util").uniqueId;t.exports={run:a,undo:s};function a(e){(e.graph().acyclicer===`greedy`?r(e,t(e)):o(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,i(`rev`))});function t(e){return t=>e.edge(t).weight}}function o(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function s(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}},{"./greedy-fas":7,"./util":27}],3:[function(e,t,n){let r=e("./util");t.exports=i;function i(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)a(e,`borderLeft`,`_bl`,n,i,t),a(e,`borderRight`,`_br`,n,i,t)}}e.children().forEach(t)}function a(e,t,n,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=r.addDummyNode(e,`border`,s,n);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}},{"./util":27}],4:[function(e,t,n){t.exports={adjust:r,undo:i};function r(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&a(e)}function i(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&s(e),(t===`lr`||t===`rl`)&&(l(e),a(e))}function a(e){e.nodes().forEach(t=>o(e.node(t))),e.edges().forEach(t=>o(e.edge(t)))}function o(e){let t=e.width;e.width=e.height,e.height=t}function s(e){e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(c),Object.hasOwn(n,`y`)&&c(n)})}function c(e){e.y=-e.y}function l(e){e.nodes().forEach(t=>u(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(u),Object.hasOwn(n,`x`)&&u(n)})}function u(e){let t=e.x;e.x=e.y,e.y=t}},{}],5:[function(e,t,n){class r{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return i(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&i(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,a)),n=n._prev;return`[`+e.join(`, `)+`]`}}function i(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function a(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=r},{}],6:[function(e,t,n){let r=e("./util"),i=e("@dagrejs/graphlib").Graph;t.exports={debugOrdering:a};function a(e){let t=r.buildLayerMatrix(e),n=new i({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}},{"./util":27,"@dagrejs/graphlib":29}],7:[function(e,t,n){let r=e("@dagrejs/graphlib").Graph,i=e("./data/list");t.exports=o;let a=()=>1;function o(e,t){if(e.nodeCount()<=1)return[];let n=l(e,t||a);return s(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function s(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)c(e,t,n,o);for(;o=i.dequeue();)c(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(c(e,t,n,o,!0));break}}}return r}function c(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,u(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,u(t,n,o)}),e.removeNode(r.v),a}function l(e,t){let n=new r,a=0,o=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let r=n.edge(e.v,e.w)||0,i=t(e),s=r+i;n.setEdge(e.v,e.w,s),o=Math.max(o,n.node(e.v).out+=i),a=Math.max(a,n.node(e.w).in+=i)});let s=d(o+a+3).map(()=>new i),c=a+1;return n.nodes().forEach(e=>{u(s,c,n.node(e))}),{graph:n,buckets:s,zeroIdx:c}}function u(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function d(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}},{"./data/list":5,"@dagrejs/graphlib":29}],8:[function(e,t,n){let r=e("./acyclic"),i=e("./normalize"),a=e("./rank"),o=e("./util").normalizeRanks,s=e("./parent-dummy-chains"),c=e("./util").removeEmptyRanks,l=e("./nesting-graph"),u=e("./add-border-segments"),d=e("./coordinate-system"),f=e("./order"),p=e("./position"),m=e("./util"),h=e("@dagrejs/graphlib").Graph;t.exports=g;function g(e,t){let n=t&&t.debugTiming?m.time:m.notime;n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>ne(e));n(` runLayout`,()=>_(r,n,t)),n(` updateInputGraph`,()=>v(e,r))})}function _(e,t,n){t(` makeSpaceForEdgeLabels`,()=>T(e)),t(` removeSelfEdges`,()=>ue(e)),t(` acyclic`,()=>r.run(e)),t(` nestingGraph.run`,()=>l.run(e)),t(` rank`,()=>a(m.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>re(e)),t(` removeEmptyRanks`,()=>c(e)),t(` nestingGraph.cleanup`,()=>l.cleanup(e)),t(` normalizeRanks`,()=>o(e)),t(` assignRankMinMax`,()=>ie(e)),t(` removeEdgeLabelProxies`,()=>ae(e)),t(` normalize.run`,()=>i.run(e)),t(` parentDummyChains`,()=>s(e)),t(` addBorderSegments`,()=>u(e)),t(` order`,()=>f(e,n)),t(` insertSelfEdges`,()=>de(e)),t(` adjustCoordinateSystem`,()=>d.adjust(e)),t(` position`,()=>p(e)),t(` positionSelfEdges`,()=>fe(e)),t(` removeBorderNodes`,()=>le(e)),t(` normalize.undo`,()=>i.undo(e)),t(` fixupEdgeLabelCoords`,()=>E(e)),t(` undoCoordinateSystem`,()=>d.undo(e)),t(` translateGraph`,()=>oe(e)),t(` assignNodeIntersects`,()=>se(e)),t(` reversePoints`,()=>ce(e)),t(` acyclic.undo`,()=>r.undo(e))}function v(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}let y=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],b={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},x=[`acyclicer`,`ranker`,`rankdir`,`align`],S=[`width`,`height`,`rank`],C={width:0,height:0},ee=[`minlen`,`weight`,`width`,`height`,`labeloffset`],te={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},w=[`labelpos`];function ne(e){let t=new h({multigraph:!0,compound:!0}),n=O(e.graph());return t.setGraph(Object.assign({},b,D(n,y),m.pick(n,x))),e.nodes().forEach(n=>{let r=D(O(e.node(n)),S);Object.keys(C).forEach(e=>{r[e]===void 0&&(r[e]=C[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=O(e.edge(n));t.setEdge(n,Object.assign({},te,D(r,ee),m.pick(r,w)))}),t}function T(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function re(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};m.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function ie(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function ae(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function oe(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function se(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(m.intersectRect(r,a)),n.points.push(m.intersectRect(i,o))})}function E(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function ce(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function le(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function ue(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function de(e){m.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{m.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function fe(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function D(e,t){return m.mapValues(m.pick(e,t),Number)}function O(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}},{"./acyclic":2,"./add-border-segments":3,"./coordinate-system":4,"./nesting-graph":9,"./normalize":10,"./order":15,"./parent-dummy-chains":20,"./position":22,"./rank":24,"./util":27,"@dagrejs/graphlib":29}],9:[function(e,t,n){let r=e("./util");t.exports={run:i,cleanup:c};function i(e){let t=r.addDummyNode(e,`root`,{},`_root`),n=o(e),i=Object.values(n),c=r.applyWithChunking(Math.max,i)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=s(e)+1;e.children().forEach(r=>a(e,t,l,u,c,n,r)),e.graph().nodeRankFactor=l}function a(e,t,n,i,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:n});return}let u=r.addBorderNode(e,`_bt`),d=r.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(r=>{a(e,t,n,i,o,s,r);let l=e.node(r),f=l.borderTop?l.borderTop:r,p=l.borderBottom?l.borderBottom:r,m=l.borderTop?i:2*i,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function o(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function s(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function c(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}},{"./util":27}],10:[function(e,t,n){let r=e("./util");t.exports={run:i,undo:o};function i(e){e.graph().dummyChains=[],e.edges().forEach(t=>a(e,t))}function a(e,t){let n=t.v,i=e.node(n).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=r.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(n,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,a,{weight:c.weight},s)}function o(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}},{"./util":27}],11:[function(e,t,n){t.exports=r;function r(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}},{}],12:[function(e,t,n){t.exports=r;function r(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}},{}],13:[function(e,t,n){let r=e("@dagrejs/graphlib").Graph,i=e("../util");t.exports=a;function a(e,t,n,i){i||=e.nodes();let a=o(e),s=new r({compound:!0}).setGraph({root:a}).setDefaultNodeLabel(t=>e.node(t));return i.forEach(r=>{let i=e.node(r),o=e.parent(r);(i.rank===t||i.minRank<=t&&t<=i.maxRank)&&(s.setNode(r),s.setParent(r,o||a),e[n](r).forEach(t=>{let n=t.v===r?t.w:t.v,i=s.edge(n,r),a=i===void 0?0:i.weight;s.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(i,`minRank`)&&s.setNode(r,{borderLeft:i.borderLeft[t],borderRight:i.borderRight[t]}))}),s}function o(e){for(var t;e.hasNode(t=i.uniqueId(`_root`)););return t}},{"../util":27,"@dagrejs/graphlib":29}],14:[function(e,t,n){let r=e("../util").zipObject;t.exports=i;function i(e,t){let n=0;for(let r=1;r<t.length;++r)n+=a(e,t[r-1],t[r]);return n}function a(e,t,n){let i=r(n,n.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<n.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}},{"../util":27}],15:[function(e,t,n){let r=e("./init-order"),i=e("./cross-count"),a=e("./sort-subgraph"),o=e("./build-layer-graph"),s=e("./add-subgraph-constraints"),c=e("@dagrejs/graphlib").Graph,l=e("../util");t.exports=u;function u(e,t){if(t&&typeof t.customOrder==`function`){t.customOrder(e,u);return}let n=l.maxRank(e),a=d(e,l.range(1,n+1),`inEdges`),o=d(e,l.range(n-1,-1,-1),`outEdges`),s=r(e);if(p(e,s),t&&t.disableOptimalOrderHeuristic)return;let c=1/0,m;for(let t=0,n=0;n<4;++t,++n){f(t%2?a:o,t%4>=2),s=l.buildLayerMatrix(e);let r=i(e,s);r<c&&(n=0,m=Object.assign({},s),c=r)}p(e,m)}function d(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return o(e,t,n,r.get(t)||[])})}function f(e,t){let n=new c;e.forEach(function(e){let r=e.graph().root,i=a(e,r,n,t);i.vs.forEach((t,n)=>e.node(t).order=n),s(e,n,i.vs)})}function p(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}},{"../util":27,"./add-subgraph-constraints":11,"./build-layer-graph":13,"./cross-count":14,"./init-order":16,"./sort-subgraph":18,"@dagrejs/graphlib":29}],16:[function(e,t,n){let r=e("../util");t.exports=i;function i(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),i=n.map(t=>e.node(t).rank),a=r.applyWithChunking(Math.max,i),o=r.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return n.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}},{"../util":27}],17:[function(e,t,n){let r=e("../util");t.exports=i;function i(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),a(Object.values(n).filter(e=>!e.indegree))}function a(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&o(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(n(r)),r.out.forEach(i(r))}return t.filter(e=>!e.merged).map(e=>r.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function o(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}},{"../util":27}],18:[function(e,t,n){let r=e("./barycenter"),i=e("./resolve-conflicts"),a=e("./sort");t.exports=o;function o(e,t,n,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=r(e,u);h.forEach(t=>{if(e.children(t.v).length){let r=o(e,t.v,n,l);m[t.v]=r,Object.hasOwn(r,`barycenter`)&&c(t,r)}});let g=i(h,n);s(g,m);let _=a(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function s(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function c(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}},{"./barycenter":12,"./resolve-conflicts":17,"./sort":19}],19:[function(e,t,n){let r=e("../util");t.exports=i;function i(e,t){let n=r.partition(e,e=>Object.hasOwn(e,`barycenter`)),i=n.lhs,s=n.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;i.sort(o(!!t)),d=a(c,s,d),i.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=a(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function a(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function o(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}},{"../util":27}],20:[function(e,t,n){t.exports=r;function r(e){let t=a(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),a=r.edgeObj,o=i(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(r=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<r.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=r.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function i(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function a(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}},{}],21:[function(e,t,n){let r=e("@dagrejs/graphlib").Graph,i=e("../util");t.exports={positionX:g,findType1Conflicts:a,findType2Conflicts:o,addConflict:c,hasConflict:l,verticalAlignment:u,horizontalCompaction:d,alignCoordinates:m,findSmallestWidthAlignment:p,balance:h};function a(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=s(e,t),f=d?e.node(d).order:o;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&c(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function o(e,t){let n={};function r(t,r,a,o,s){let l;i.range(r,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>s)&&c(n,t,l)})})}function a(t,n){let i=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function s(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function c(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function l(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function u(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let c=Math.floor(r),u=Math.ceil(r);c<=u;++c){let r=s[c];a[e]===e&&t<o[r]&&!l(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function d(e,t,n,r,i){let a={},o=f(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes(),r=n.pop(),i={};for(;r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function f(e,t,n,i){let a=new r,o=e.graph(),s=_(o.nodesep,o.edgesep,i);return t.forEach(t=>{let r;t.forEach(t=>{let i=n[t];if(a.setNode(i),r){var o=n[r],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,r),c||0))}r=t})}),a}function p(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=v(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function m(e,t){let n=Object.values(t),r=i.applyWithChunking(Math.min,n),a=i.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=r-i.applyWithChunking(Math.min,l);o!==`l`&&(u=a-i.applyWithChunking(Math.max,l)),u&&(e[s]=i.mapValues(c,e=>e+u))})})}function h(e,t){return i.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function g(e){let t=i.buildLayerMatrix(e),n=Object.assign(a(e,t),o(e,t)),r={},s;return[`u`,`d`].forEach(a=>{s=a===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let o=(a===`u`?e.predecessors:e.successors).bind(e),c=u(e,s,n,o),l=d(e,s,c.root,c.align,t===`r`);t===`r`&&(l=i.mapValues(l,e=>-e)),r[a+t]=l})}),m(r,p(e,r)),h(r,e.graph().align)}function _(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function v(e,t){return e.node(t).width}},{"../util":27,"@dagrejs/graphlib":29}],22:[function(e,t,n){let r=e("../util"),i=e("./bk").positionX;t.exports=a;function a(e){e=r.asNonCompoundGraph(e),o(e),Object.entries(i(e)).forEach(([t,n])=>e.node(t).x=n)}function o(e){let t=r.buildLayerMatrix(e),n=e.graph().ranksep,i=0;t.forEach(t=>{let r=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>e.node(t).y=i+r/2),i+=r+n})}},{"../util":27,"./bk":21}],23:[function(e,t,n){var r=e("@dagrejs/graphlib").Graph,i=e("./util").slack;t.exports=a;function a(e){var t=new r({directed:!1}),n=e.nodes()[0],a=e.nodeCount();t.setNode(n,{});for(var l,u;o(t,e)<a;)l=s(t,e),u=t.hasNode(l.v)?i(e,l):-i(e,l),c(t,e,u);return t}function o(e,t){function n(r){t.nodeEdges(r).forEach(a=>{var o=a.v,s=r===o?a.w:o;!e.hasNode(s)&&!i(t,a)&&(e.setNode(s,{}),e.setEdge(r,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function s(e,t){return t.edges().reduce((n,r)=>{let a=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(a=i(t,r)),a<n[0]?[a,r]:n},[1/0,null])[1]}function c(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}},{"./util":26,"@dagrejs/graphlib":29}],24:[function(e,t,n){var r=e("./util").longestPath,i=e("./feasible-tree"),a=e("./network-simplex");t.exports=o;function o(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:l(e);break;case`tight-tree`:c(e);break;case`longest-path`:s(e);break;case`none`:break;default:l(e)}}var s=r;function c(e){r(e),i(e)}function l(e){a(e)}},{"./feasible-tree":23,"./network-simplex":25,"./util":26}],25:[function(e,t,n){var r=e("./feasible-tree"),i=e("./util").slack,a=e("./util").longestPath,o=e("@dagrejs/graphlib").alg.preorder,s=e("@dagrejs/graphlib").alg.postorder,c=e("../util").simplify;t.exports=l,l.initLowLimValues=p,l.initCutValues=u,l.calcCutValue=f,l.leaveEdge=h,l.enterEdge=g,l.exchangeEdges=_;function l(e){e=c(e),a(e);var t=r(e);p(t),u(t,e);for(var n,i;n=h(t);)i=g(t,e,n),_(t,e,n,i)}function u(e,t){var n=s(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>d(e,t,n))}function d(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=f(e,t,n)}function f(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,y(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function p(e,t){arguments.length<2&&(t=e.nodes()[0]),m(e,{},1,t)}function m(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=m(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function h(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function g(e,t,n){var r=n.v,a=n.w;t.hasEdge(r,a)||(r=n.w,a=n.v);var o=e.node(r),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===b(e,e.node(t.v),c)&&l!==b(e,e.node(t.w),c)).reduce((e,n)=>i(t,n)<i(t,e)?n:e)}function _(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),p(e),u(e,t),v(e,t)}function v(e,t){var n=o(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function y(e,t,n){return e.hasEdge(t,n)}function b(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}},{"../util":27,"./feasible-tree":23,"./util":26,"@dagrejs/graphlib":29}],26:[function(e,t,n){let{applyWithChunking:r}=e("../util");t.exports={longestPath:i,slack:a};function i(e){var t={};function n(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen);var s=r(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(n)}function a(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}},{"../util":27}],27:[function(e,t,n){let r=e("@dagrejs/graphlib").Graph;t.exports={addBorderNode:p,addDummyNode:i,applyWithChunking:g,asNonCompoundGraph:o,buildLayerMatrix:u,intersectRect:l,mapValues:te,maxRank:_,normalizeRanks:d,notime:b,partition:v,pick:ee,predecessorWeights:c,range:C,removeEmptyRanks:f,simplify:a,successorWeights:s,time:y,uniqueId:S,zipObject:w};function i(e,t,n,r){for(var i=r;e.hasNode(i);)i=S(r);return n.dummy=t,e.setNode(i,n),i}function a(e){let t=new r().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function o(e){let t=new r({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function s(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return w(e.nodes(),t)}function c(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return w(e.nodes(),t)}function l(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function u(e){let t=C(_(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function d(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=g(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function f(e){let t=e.nodes().map(t=>e.node(t).rank),n=g(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function p(e,t,n,r){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=r),i(e,`border`,a,t)}function m(e,t=h){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}let h=65535;function g(e,t){if(t.length>h){let n=m(t);return e.apply(null,n.map(t=>e.apply(null,t)))}else return e.apply(null,t)}function _(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return g(Math.max,t)}function v(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function y(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function b(e,t){return t()}let x=0;function S(e){return e+(``+ ++x)}function C(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function ee(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function te(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function w(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}},{"@dagrejs/graphlib":29}],28:[function(e,t,n){t.exports=`1.1.8`},{}],29:[function(e,t,n){var r=e("./lib");t.exports={Graph:r.Graph,json:e("./lib/json"),alg:e("./lib/alg"),version:r.version}},{"./lib":45,"./lib/alg":36,"./lib/json":46}],30:[function(e,t,n){t.exports=r;function r(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}},{}],31:[function(e,t,n){t.exports=r;function r(e,t,n){Array.isArray(t)||(t=[t]);var r=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),o=n===`post`?i:a,s=[],c={};return t.forEach(t=>{if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);o(t,r,c,s)}),s}function i(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var a=i.pop();a[1]?r.push(a[0]):Object.hasOwn(n,a[0])||(n[a[0]]=!0,i.push([a[0],!0]),o(t(a[0]),e=>i.push([e,!1])))}}function a(e,t,n,r){for(var i=[e];i.length>0;){var a=i.pop();Object.hasOwn(n,a)||(n[a]=!0,r.push(a),o(t(a),e=>i.push(e)))}}function o(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}},{}],32:[function(e,t,n){var r=e("./dijkstra");t.exports=i;function i(e,t,n){return e.nodes().reduce(function(i,a){return i[a]=r(e,a,t,n),i},{})}},{"./dijkstra":33}],33:[function(e,t,n){var r=e("../data/priority-queue");t.exports=a;var i=()=>1;function a(e,t,n,r){return o(e,String(t),n||i,r||function(t){return e.outEdges(t)})}function o(e,t,n,i){var a={},o=new r,s,c,l=function(e){var t=e.v===s?e.w:e.v,r=a[t],i=n(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<r.distance&&(r.distance=l,r.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}},{"../data/priority-queue":43}],34:[function(e,t,n){var r=e("./tarjan");t.exports=i;function i(e){return r(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}},{"./tarjan":41}],35:[function(e,t,n){t.exports=i;var r=()=>1;function i(e,t,n){return a(e,t||r,n||function(t){return e.outEdges(t)})}function a(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}},{}],36:[function(e,t,n){t.exports={components:e("./components"),dijkstra:e("./dijkstra"),dijkstraAll:e("./dijkstra-all"),findCycles:e("./find-cycles"),floydWarshall:e("./floyd-warshall"),isAcyclic:e("./is-acyclic"),postorder:e("./postorder"),preorder:e("./preorder"),prim:e("./prim"),tarjan:e("./tarjan"),topsort:e("./topsort")}},{"./components":30,"./dijkstra":33,"./dijkstra-all":32,"./find-cycles":34,"./floyd-warshall":35,"./is-acyclic":37,"./postorder":38,"./preorder":39,"./prim":40,"./tarjan":41,"./topsort":42}],37:[function(e,t,n){var r=e("./topsort");t.exports=i;function i(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}},{"./topsort":42}],38:[function(e,t,n){var r=e("./dfs");t.exports=i;function i(e,t){return r(e,t,`post`)}},{"./dfs":31}],39:[function(e,t,n){var r=e("./dfs");t.exports=i;function i(e,t){return r(e,t,`pre`)}},{"./dfs":31}],40:[function(e,t,n){var r=e("../graph"),i=e("../data/priority-queue");t.exports=a;function a(e,t){var n=new r,a={},o=new i,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){o.add(e,1/0),n.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))n.setEdge(s,a[s]);else if(l)throw Error(`Input graph is not connected: `+e);else l=!0;e.nodeEdges(s).forEach(c)}return n}},{"../data/priority-queue":43,"../graph":44}],41:[function(e,t,n){t.exports=r;function r(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}},{}],42:[function(e,t,n){function r(e){var t={},n={},r=[];function a(o){if(Object.hasOwn(n,o))throw new i;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],r.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new i;return r}class i extends Error{constructor(){super(...arguments)}}t.exports=r,r.CycleException=i},{}],43:[function(e,t,n){class r{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}t.exports=r},{}],44:[function(e,t,n){class r{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>void 0;_defaultEdgeLabelFn=()=>void 0;_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else if(e===`\0`)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,a=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(r=arguments[1],a=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],a=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=o(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return a&&(this._edgeLabels[l]=r),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=a?r:this._defaultEdgeLabelFn(e,t,n);var u=s(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,i(this._preds[t],e),i(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[t],e),a(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.v===t):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.w===t):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}}function i(e,t){e[t]?e[t]++:e[t]=1}function a(e,t){--e[t]||delete e[t]}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function s(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function c(e,t){return o(e,t.v,t.w,t.name)}t.exports=r},{}],45:[function(e,t,n){t.exports={Graph:e("./graph"),version:e("./version")}},{"./graph":44,"./version":47}],46:[function(e,t,n){var r=e("./graph");t.exports={write:i,read:s};function i(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:a(e),edges:o(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function a(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function o(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function s(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}},{"./graph":44}],47:[function(e,t,n){t.exports=`2.2.4`},{}]},{},[1])(1)})}))(),1),v={bg:`#FFFFFF`,fg:`#27272A`},y={textSec:60,textMuted:40,textFaint:25,line:30,arrow:50,nodeFill:3,nodeStroke:20,groupHeader:5,innerStroke:12,keyBadge:10},b={"zinc-dark":{bg:`#18181B`,fg:`#FAFAFA`},"tokyo-night":{bg:`#1a1b26`,fg:`#a9b1d6`,line:`#3d59a1`,accent:`#7aa2f7`,muted:`#565f89`},"tokyo-night-storm":{bg:`#24283b`,fg:`#a9b1d6`,line:`#3d59a1`,accent:`#7aa2f7`,muted:`#565f89`},"tokyo-night-light":{bg:`#d5d6db`,fg:`#343b58`,line:`#34548a`,accent:`#34548a`,muted:`#9699a3`},"catppuccin-mocha":{bg:`#1e1e2e`,fg:`#cdd6f4`,line:`#585b70`,accent:`#cba6f7`,muted:`#6c7086`},"catppuccin-latte":{bg:`#eff1f5`,fg:`#4c4f69`,line:`#9ca0b0`,accent:`#8839ef`,muted:`#9ca0b0`},nord:{bg:`#2e3440`,fg:`#d8dee9`,line:`#4c566a`,accent:`#88c0d0`,muted:`#616e88`},"nord-light":{bg:`#eceff4`,fg:`#2e3440`,line:`#aab1c0`,accent:`#5e81ac`,muted:`#7b88a1`},dracula:{bg:`#282a36`,fg:`#f8f8f2`,line:`#6272a4`,accent:`#bd93f9`,muted:`#6272a4`},"github-light":{bg:`#ffffff`,fg:`#1f2328`,line:`#d1d9e0`,accent:`#0969da`,muted:`#59636e`},"github-dark":{bg:`#0d1117`,fg:`#e6edf3`,line:`#3d444d`,accent:`#4493f8`,muted:`#9198a1`},"solarized-light":{bg:`#fdf6e3`,fg:`#657b83`,line:`#93a1a1`,accent:`#268bd2`,muted:`#93a1a1`},"solarized-dark":{bg:`#002b36`,fg:`#839496`,line:`#586e75`,accent:`#268bd2`,muted:`#586e75`},"one-dark":{bg:`#282c34`,fg:`#abb2bf`,line:`#4b5263`,accent:`#c678dd`,muted:`#5c6370`}};function x(e,t){let n=[`@import url('https://fonts.googleapis.com/css2?family=${encodeURIComponent(e)}:wght@400;500;600;700&display=swap');`,...t?[`@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');`]:[]],r=`
|
|
1
|
+
import{a as e,i as t,t as n}from"./rolldown-runtime-8V8biNmG.mjs";function r(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}const i=[`default`,`dark`,`hand-drawn`],a=[`antv`,`spectral`],o=i.map(e=>({id:e,name:r(e),isDark:e===`dark`})),s=a.map(e=>({id:e,name:r(e)})),c=o.map(e=>e.id),l=s.map(e=>e.id);function u(e){return i.includes(e)}function d(e){return a.includes(e)}const f=[{id:`kami`,name:`Kami`,description:`简洁的纸张阅读风格(默认)`},{id:`bauhaus`,name:`Bauhaus`,description:`包豪斯风格,几何与功能主义`},{id:`blueprint`,name:`Blueprint`,description:`蓝图技术文档风格`},{id:`botanical`,name:`Botanical`,description:`植物园风格,自然柔和`},{id:`newsprint`,name:`Newsprint`,description:`报纸印刷风格`},{id:`retro`,name:`Retro`,description:`复古怀旧风格`},{id:`sketch`,name:`Sketch`,description:`手绘素描风格`},{id:`terminal`,name:`Terminal`,description:`终端/命令行风格`},{id:`forest-review`,name:`Forest Review`,description:`森林季报风格,暖调编辑排版`},{id:`navy-vellum`,name:`Navy Vellum`,description:`深蓝羊皮纸风格,静谧的学术手记`},{id:`rose-nocturne`,name:`Rose Nocturne`,description:`玫瑰夜曲风格,暗色调时尚编辑`},{id:`solar-catalog`,name:`Solar Catalog`,description:`日光图录风格,展览海报质感`},{id:`triad-paper`,name:`Triad Paper`,description:`三调纸面风格,三色时尚杂志感`},{id:`field-tablet`,name:`Field Tablet`,description:`田野铭牌风格,考古手册质感`},{id:`public-square`,name:`Public Square`,description:`公共广场风格,行动主义海报`},{id:`pixel-orbit`,name:`Pixel Orbit`,description:`像素轨道风格,复古像素街机`}],p=f.map(e=>e.id),m=`kami`,h=new Set([`kami`,`botanical`,`newsprint`,`forest-review`]);function g(e){return e!=null&&f.some(t=>t.id===e)&&!h.has(e)?`sans-serif`:`serif`}var _=e(n(((e,n)=>{(function(t){if(typeof e==`object`&&n!==void 0)n.exports=t();else if(typeof define==`function`&&define.amd)define([],t);else{var r=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this;r.dagre=t()}})(function(){return(function(){function e(n,r,i){function a(s,c){if(!r[s]){if(!n[s]){var l=typeof t==`function`&&t;if(!c&&l)return l(s,!0);if(o)return o(s,!0);var u=Error(`Cannot find module '`+s+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=r[s]={exports:{}};n[s][0].call(d.exports,function(e){var t=n[s][1][e];return a(t||e)},d,d.exports,e,n,r,i)}return r[s].exports}for(var o=typeof t==`function`&&t,s=0;s<i.length;s++)a(i[s]);return a}return e})()({1:[function(e,t,n){t.exports={graphlib:e("@dagrejs/graphlib"),layout:e("./lib/layout"),debug:e("./lib/debug"),util:{time:e("./lib/util").time,notime:e("./lib/util").notime},version:e("./lib/version")}},{"./lib/debug":6,"./lib/layout":8,"./lib/util":27,"./lib/version":28,"@dagrejs/graphlib":29}],2:[function(e,t,n){let r=e("./greedy-fas"),i=e("./util").uniqueId;t.exports={run:a,undo:s};function a(e){(e.graph().acyclicer===`greedy`?r(e,t(e)):o(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,i(`rev`))});function t(e){return t=>e.edge(t).weight}}function o(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function s(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}},{"./greedy-fas":7,"./util":27}],3:[function(e,t,n){let r=e("./util");t.exports=i;function i(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)a(e,`borderLeft`,`_bl`,n,i,t),a(e,`borderRight`,`_br`,n,i,t)}}e.children().forEach(t)}function a(e,t,n,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=r.addDummyNode(e,`border`,s,n);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}},{"./util":27}],4:[function(e,t,n){t.exports={adjust:r,undo:i};function r(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&a(e)}function i(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&s(e),(t===`lr`||t===`rl`)&&(l(e),a(e))}function a(e){e.nodes().forEach(t=>o(e.node(t))),e.edges().forEach(t=>o(e.edge(t)))}function o(e){let t=e.width;e.width=e.height,e.height=t}function s(e){e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(c),Object.hasOwn(n,`y`)&&c(n)})}function c(e){e.y=-e.y}function l(e){e.nodes().forEach(t=>u(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(u),Object.hasOwn(n,`x`)&&u(n)})}function u(e){let t=e.x;e.x=e.y,e.y=t}},{}],5:[function(e,t,n){class r{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return i(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&i(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,a)),n=n._prev;return`[`+e.join(`, `)+`]`}}function i(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function a(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=r},{}],6:[function(e,t,n){let r=e("./util"),i=e("@dagrejs/graphlib").Graph;t.exports={debugOrdering:a};function a(e){let t=r.buildLayerMatrix(e),n=new i({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}},{"./util":27,"@dagrejs/graphlib":29}],7:[function(e,t,n){let r=e("@dagrejs/graphlib").Graph,i=e("./data/list");t.exports=o;let a=()=>1;function o(e,t){if(e.nodeCount()<=1)return[];let n=l(e,t||a);return s(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function s(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)c(e,t,n,o);for(;o=i.dequeue();)c(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(c(e,t,n,o,!0));break}}}return r}function c(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,u(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,u(t,n,o)}),e.removeNode(r.v),a}function l(e,t){let n=new r,a=0,o=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let r=n.edge(e.v,e.w)||0,i=t(e),s=r+i;n.setEdge(e.v,e.w,s),o=Math.max(o,n.node(e.v).out+=i),a=Math.max(a,n.node(e.w).in+=i)});let s=d(o+a+3).map(()=>new i),c=a+1;return n.nodes().forEach(e=>{u(s,c,n.node(e))}),{graph:n,buckets:s,zeroIdx:c}}function u(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function d(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}},{"./data/list":5,"@dagrejs/graphlib":29}],8:[function(e,t,n){let r=e("./acyclic"),i=e("./normalize"),a=e("./rank"),o=e("./util").normalizeRanks,s=e("./parent-dummy-chains"),c=e("./util").removeEmptyRanks,l=e("./nesting-graph"),u=e("./add-border-segments"),d=e("./coordinate-system"),f=e("./order"),p=e("./position"),m=e("./util"),h=e("@dagrejs/graphlib").Graph;t.exports=g;function g(e,t){let n=t&&t.debugTiming?m.time:m.notime;n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>ne(e));n(` runLayout`,()=>_(r,n,t)),n(` updateInputGraph`,()=>v(e,r))})}function _(e,t,n){t(` makeSpaceForEdgeLabels`,()=>T(e)),t(` removeSelfEdges`,()=>ue(e)),t(` acyclic`,()=>r.run(e)),t(` nestingGraph.run`,()=>l.run(e)),t(` rank`,()=>a(m.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>re(e)),t(` removeEmptyRanks`,()=>c(e)),t(` nestingGraph.cleanup`,()=>l.cleanup(e)),t(` normalizeRanks`,()=>o(e)),t(` assignRankMinMax`,()=>ie(e)),t(` removeEdgeLabelProxies`,()=>ae(e)),t(` normalize.run`,()=>i.run(e)),t(` parentDummyChains`,()=>s(e)),t(` addBorderSegments`,()=>u(e)),t(` order`,()=>f(e,n)),t(` insertSelfEdges`,()=>de(e)),t(` adjustCoordinateSystem`,()=>d.adjust(e)),t(` position`,()=>p(e)),t(` positionSelfEdges`,()=>fe(e)),t(` removeBorderNodes`,()=>le(e)),t(` normalize.undo`,()=>i.undo(e)),t(` fixupEdgeLabelCoords`,()=>E(e)),t(` undoCoordinateSystem`,()=>d.undo(e)),t(` translateGraph`,()=>oe(e)),t(` assignNodeIntersects`,()=>se(e)),t(` reversePoints`,()=>ce(e)),t(` acyclic.undo`,()=>r.undo(e))}function v(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}let y=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],b={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},x=[`acyclicer`,`ranker`,`rankdir`,`align`],S=[`width`,`height`,`rank`],C={width:0,height:0},ee=[`minlen`,`weight`,`width`,`height`,`labeloffset`],te={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},w=[`labelpos`];function ne(e){let t=new h({multigraph:!0,compound:!0}),n=O(e.graph());return t.setGraph(Object.assign({},b,D(n,y),m.pick(n,x))),e.nodes().forEach(n=>{let r=D(O(e.node(n)),S);Object.keys(C).forEach(e=>{r[e]===void 0&&(r[e]=C[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=O(e.edge(n));t.setEdge(n,Object.assign({},te,D(r,ee),m.pick(r,w)))}),t}function T(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function re(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};m.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function ie(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function ae(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function oe(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function se(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(m.intersectRect(r,a)),n.points.push(m.intersectRect(i,o))})}function E(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function ce(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function le(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function ue(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function de(e){m.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{m.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function fe(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function D(e,t){return m.mapValues(m.pick(e,t),Number)}function O(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}},{"./acyclic":2,"./add-border-segments":3,"./coordinate-system":4,"./nesting-graph":9,"./normalize":10,"./order":15,"./parent-dummy-chains":20,"./position":22,"./rank":24,"./util":27,"@dagrejs/graphlib":29}],9:[function(e,t,n){let r=e("./util");t.exports={run:i,cleanup:c};function i(e){let t=r.addDummyNode(e,`root`,{},`_root`),n=o(e),i=Object.values(n),c=r.applyWithChunking(Math.max,i)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=s(e)+1;e.children().forEach(r=>a(e,t,l,u,c,n,r)),e.graph().nodeRankFactor=l}function a(e,t,n,i,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:n});return}let u=r.addBorderNode(e,`_bt`),d=r.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(r=>{a(e,t,n,i,o,s,r);let l=e.node(r),f=l.borderTop?l.borderTop:r,p=l.borderBottom?l.borderBottom:r,m=l.borderTop?i:2*i,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function o(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function s(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function c(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}},{"./util":27}],10:[function(e,t,n){let r=e("./util");t.exports={run:i,undo:o};function i(e){e.graph().dummyChains=[],e.edges().forEach(t=>a(e,t))}function a(e,t){let n=t.v,i=e.node(n).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=r.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(n,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,a,{weight:c.weight},s)}function o(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}},{"./util":27}],11:[function(e,t,n){t.exports=r;function r(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}},{}],12:[function(e,t,n){t.exports=r;function r(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}},{}],13:[function(e,t,n){let r=e("@dagrejs/graphlib").Graph,i=e("../util");t.exports=a;function a(e,t,n,i){i||=e.nodes();let a=o(e),s=new r({compound:!0}).setGraph({root:a}).setDefaultNodeLabel(t=>e.node(t));return i.forEach(r=>{let i=e.node(r),o=e.parent(r);(i.rank===t||i.minRank<=t&&t<=i.maxRank)&&(s.setNode(r),s.setParent(r,o||a),e[n](r).forEach(t=>{let n=t.v===r?t.w:t.v,i=s.edge(n,r),a=i===void 0?0:i.weight;s.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(i,`minRank`)&&s.setNode(r,{borderLeft:i.borderLeft[t],borderRight:i.borderRight[t]}))}),s}function o(e){for(var t;e.hasNode(t=i.uniqueId(`_root`)););return t}},{"../util":27,"@dagrejs/graphlib":29}],14:[function(e,t,n){let r=e("../util").zipObject;t.exports=i;function i(e,t){let n=0;for(let r=1;r<t.length;++r)n+=a(e,t[r-1],t[r]);return n}function a(e,t,n){let i=r(n,n.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<n.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}},{"../util":27}],15:[function(e,t,n){let r=e("./init-order"),i=e("./cross-count"),a=e("./sort-subgraph"),o=e("./build-layer-graph"),s=e("./add-subgraph-constraints"),c=e("@dagrejs/graphlib").Graph,l=e("../util");t.exports=u;function u(e,t){if(t&&typeof t.customOrder==`function`){t.customOrder(e,u);return}let n=l.maxRank(e),a=d(e,l.range(1,n+1),`inEdges`),o=d(e,l.range(n-1,-1,-1),`outEdges`),s=r(e);if(p(e,s),t&&t.disableOptimalOrderHeuristic)return;let c=1/0,m;for(let t=0,n=0;n<4;++t,++n){f(t%2?a:o,t%4>=2),s=l.buildLayerMatrix(e);let r=i(e,s);r<c&&(n=0,m=Object.assign({},s),c=r)}p(e,m)}function d(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return o(e,t,n,r.get(t)||[])})}function f(e,t){let n=new c;e.forEach(function(e){let r=e.graph().root,i=a(e,r,n,t);i.vs.forEach((t,n)=>e.node(t).order=n),s(e,n,i.vs)})}function p(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}},{"../util":27,"./add-subgraph-constraints":11,"./build-layer-graph":13,"./cross-count":14,"./init-order":16,"./sort-subgraph":18,"@dagrejs/graphlib":29}],16:[function(e,t,n){let r=e("../util");t.exports=i;function i(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),i=n.map(t=>e.node(t).rank),a=r.applyWithChunking(Math.max,i),o=r.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return n.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}},{"../util":27}],17:[function(e,t,n){let r=e("../util");t.exports=i;function i(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),a(Object.values(n).filter(e=>!e.indegree))}function a(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&o(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(n(r)),r.out.forEach(i(r))}return t.filter(e=>!e.merged).map(e=>r.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function o(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}},{"../util":27}],18:[function(e,t,n){let r=e("./barycenter"),i=e("./resolve-conflicts"),a=e("./sort");t.exports=o;function o(e,t,n,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=r(e,u);h.forEach(t=>{if(e.children(t.v).length){let r=o(e,t.v,n,l);m[t.v]=r,Object.hasOwn(r,`barycenter`)&&c(t,r)}});let g=i(h,n);s(g,m);let _=a(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function s(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function c(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}},{"./barycenter":12,"./resolve-conflicts":17,"./sort":19}],19:[function(e,t,n){let r=e("../util");t.exports=i;function i(e,t){let n=r.partition(e,e=>Object.hasOwn(e,`barycenter`)),i=n.lhs,s=n.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;i.sort(o(!!t)),d=a(c,s,d),i.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=a(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function a(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function o(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}},{"../util":27}],20:[function(e,t,n){t.exports=r;function r(e){let t=a(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),a=r.edgeObj,o=i(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(r=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<r.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=r.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function i(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function a(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}},{}],21:[function(e,t,n){let r=e("@dagrejs/graphlib").Graph,i=e("../util");t.exports={positionX:g,findType1Conflicts:a,findType2Conflicts:o,addConflict:c,hasConflict:l,verticalAlignment:u,horizontalCompaction:d,alignCoordinates:m,findSmallestWidthAlignment:p,balance:h};function a(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=s(e,t),f=d?e.node(d).order:o;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&c(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function o(e,t){let n={};function r(t,r,a,o,s){let l;i.range(r,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>s)&&c(n,t,l)})})}function a(t,n){let i=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function s(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function c(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function l(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function u(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let c=Math.floor(r),u=Math.ceil(r);c<=u;++c){let r=s[c];a[e]===e&&t<o[r]&&!l(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function d(e,t,n,r,i){let a={},o=f(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes(),r=n.pop(),i={};for(;r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function f(e,t,n,i){let a=new r,o=e.graph(),s=_(o.nodesep,o.edgesep,i);return t.forEach(t=>{let r;t.forEach(t=>{let i=n[t];if(a.setNode(i),r){var o=n[r],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,r),c||0))}r=t})}),a}function p(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=v(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function m(e,t){let n=Object.values(t),r=i.applyWithChunking(Math.min,n),a=i.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=r-i.applyWithChunking(Math.min,l);o!==`l`&&(u=a-i.applyWithChunking(Math.max,l)),u&&(e[s]=i.mapValues(c,e=>e+u))})})}function h(e,t){return i.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function g(e){let t=i.buildLayerMatrix(e),n=Object.assign(a(e,t),o(e,t)),r={},s;return[`u`,`d`].forEach(a=>{s=a===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let o=(a===`u`?e.predecessors:e.successors).bind(e),c=u(e,s,n,o),l=d(e,s,c.root,c.align,t===`r`);t===`r`&&(l=i.mapValues(l,e=>-e)),r[a+t]=l})}),m(r,p(e,r)),h(r,e.graph().align)}function _(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function v(e,t){return e.node(t).width}},{"../util":27,"@dagrejs/graphlib":29}],22:[function(e,t,n){let r=e("../util"),i=e("./bk").positionX;t.exports=a;function a(e){e=r.asNonCompoundGraph(e),o(e),Object.entries(i(e)).forEach(([t,n])=>e.node(t).x=n)}function o(e){let t=r.buildLayerMatrix(e),n=e.graph().ranksep,i=0;t.forEach(t=>{let r=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>e.node(t).y=i+r/2),i+=r+n})}},{"../util":27,"./bk":21}],23:[function(e,t,n){var r=e("@dagrejs/graphlib").Graph,i=e("./util").slack;t.exports=a;function a(e){var t=new r({directed:!1}),n=e.nodes()[0],a=e.nodeCount();t.setNode(n,{});for(var l,u;o(t,e)<a;)l=s(t,e),u=t.hasNode(l.v)?i(e,l):-i(e,l),c(t,e,u);return t}function o(e,t){function n(r){t.nodeEdges(r).forEach(a=>{var o=a.v,s=r===o?a.w:o;!e.hasNode(s)&&!i(t,a)&&(e.setNode(s,{}),e.setEdge(r,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function s(e,t){return t.edges().reduce((n,r)=>{let a=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(a=i(t,r)),a<n[0]?[a,r]:n},[1/0,null])[1]}function c(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}},{"./util":26,"@dagrejs/graphlib":29}],24:[function(e,t,n){var r=e("./util").longestPath,i=e("./feasible-tree"),a=e("./network-simplex");t.exports=o;function o(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:l(e);break;case`tight-tree`:c(e);break;case`longest-path`:s(e);break;case`none`:break;default:l(e)}}var s=r;function c(e){r(e),i(e)}function l(e){a(e)}},{"./feasible-tree":23,"./network-simplex":25,"./util":26}],25:[function(e,t,n){var r=e("./feasible-tree"),i=e("./util").slack,a=e("./util").longestPath,o=e("@dagrejs/graphlib").alg.preorder,s=e("@dagrejs/graphlib").alg.postorder,c=e("../util").simplify;t.exports=l,l.initLowLimValues=p,l.initCutValues=u,l.calcCutValue=f,l.leaveEdge=h,l.enterEdge=g,l.exchangeEdges=_;function l(e){e=c(e),a(e);var t=r(e);p(t),u(t,e);for(var n,i;n=h(t);)i=g(t,e,n),_(t,e,n,i)}function u(e,t){var n=s(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>d(e,t,n))}function d(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=f(e,t,n)}function f(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,y(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function p(e,t){arguments.length<2&&(t=e.nodes()[0]),m(e,{},1,t)}function m(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=m(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function h(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function g(e,t,n){var r=n.v,a=n.w;t.hasEdge(r,a)||(r=n.w,a=n.v);var o=e.node(r),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===b(e,e.node(t.v),c)&&l!==b(e,e.node(t.w),c)).reduce((e,n)=>i(t,n)<i(t,e)?n:e)}function _(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),p(e),u(e,t),v(e,t)}function v(e,t){var n=o(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function y(e,t,n){return e.hasEdge(t,n)}function b(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}},{"../util":27,"./feasible-tree":23,"./util":26,"@dagrejs/graphlib":29}],26:[function(e,t,n){let{applyWithChunking:r}=e("../util");t.exports={longestPath:i,slack:a};function i(e){var t={};function n(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen);var s=r(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(n)}function a(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}},{"../util":27}],27:[function(e,t,n){let r=e("@dagrejs/graphlib").Graph;t.exports={addBorderNode:p,addDummyNode:i,applyWithChunking:g,asNonCompoundGraph:o,buildLayerMatrix:u,intersectRect:l,mapValues:te,maxRank:_,normalizeRanks:d,notime:b,partition:v,pick:ee,predecessorWeights:c,range:C,removeEmptyRanks:f,simplify:a,successorWeights:s,time:y,uniqueId:S,zipObject:w};function i(e,t,n,r){for(var i=r;e.hasNode(i);)i=S(r);return n.dummy=t,e.setNode(i,n),i}function a(e){let t=new r().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function o(e){let t=new r({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function s(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return w(e.nodes(),t)}function c(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return w(e.nodes(),t)}function l(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function u(e){let t=C(_(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function d(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=g(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function f(e){let t=e.nodes().map(t=>e.node(t).rank),n=g(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function p(e,t,n,r){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=r),i(e,`border`,a,t)}function m(e,t=h){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}let h=65535;function g(e,t){if(t.length>h){let n=m(t);return e.apply(null,n.map(t=>e.apply(null,t)))}else return e.apply(null,t)}function _(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return g(Math.max,t)}function v(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function y(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function b(e,t){return t()}let x=0;function S(e){return e+(``+ ++x)}function C(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function ee(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function te(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function w(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}},{"@dagrejs/graphlib":29}],28:[function(e,t,n){t.exports=`1.1.8`},{}],29:[function(e,t,n){var r=e("./lib");t.exports={Graph:r.Graph,json:e("./lib/json"),alg:e("./lib/alg"),version:r.version}},{"./lib":45,"./lib/alg":36,"./lib/json":46}],30:[function(e,t,n){t.exports=r;function r(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}},{}],31:[function(e,t,n){t.exports=r;function r(e,t,n){Array.isArray(t)||(t=[t]);var r=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),o=n===`post`?i:a,s=[],c={};return t.forEach(t=>{if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);o(t,r,c,s)}),s}function i(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var a=i.pop();a[1]?r.push(a[0]):Object.hasOwn(n,a[0])||(n[a[0]]=!0,i.push([a[0],!0]),o(t(a[0]),e=>i.push([e,!1])))}}function a(e,t,n,r){for(var i=[e];i.length>0;){var a=i.pop();Object.hasOwn(n,a)||(n[a]=!0,r.push(a),o(t(a),e=>i.push(e)))}}function o(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}},{}],32:[function(e,t,n){var r=e("./dijkstra");t.exports=i;function i(e,t,n){return e.nodes().reduce(function(i,a){return i[a]=r(e,a,t,n),i},{})}},{"./dijkstra":33}],33:[function(e,t,n){var r=e("../data/priority-queue");t.exports=a;var i=()=>1;function a(e,t,n,r){return o(e,String(t),n||i,r||function(t){return e.outEdges(t)})}function o(e,t,n,i){var a={},o=new r,s,c,l=function(e){var t=e.v===s?e.w:e.v,r=a[t],i=n(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<r.distance&&(r.distance=l,r.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}},{"../data/priority-queue":43}],34:[function(e,t,n){var r=e("./tarjan");t.exports=i;function i(e){return r(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}},{"./tarjan":41}],35:[function(e,t,n){t.exports=i;var r=()=>1;function i(e,t,n){return a(e,t||r,n||function(t){return e.outEdges(t)})}function a(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}},{}],36:[function(e,t,n){t.exports={components:e("./components"),dijkstra:e("./dijkstra"),dijkstraAll:e("./dijkstra-all"),findCycles:e("./find-cycles"),floydWarshall:e("./floyd-warshall"),isAcyclic:e("./is-acyclic"),postorder:e("./postorder"),preorder:e("./preorder"),prim:e("./prim"),tarjan:e("./tarjan"),topsort:e("./topsort")}},{"./components":30,"./dijkstra":33,"./dijkstra-all":32,"./find-cycles":34,"./floyd-warshall":35,"./is-acyclic":37,"./postorder":38,"./preorder":39,"./prim":40,"./tarjan":41,"./topsort":42}],37:[function(e,t,n){var r=e("./topsort");t.exports=i;function i(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}},{"./topsort":42}],38:[function(e,t,n){var r=e("./dfs");t.exports=i;function i(e,t){return r(e,t,`post`)}},{"./dfs":31}],39:[function(e,t,n){var r=e("./dfs");t.exports=i;function i(e,t){return r(e,t,`pre`)}},{"./dfs":31}],40:[function(e,t,n){var r=e("../graph"),i=e("../data/priority-queue");t.exports=a;function a(e,t){var n=new r,a={},o=new i,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){o.add(e,1/0),n.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))n.setEdge(s,a[s]);else if(l)throw Error(`Input graph is not connected: `+e);else l=!0;e.nodeEdges(s).forEach(c)}return n}},{"../data/priority-queue":43,"../graph":44}],41:[function(e,t,n){t.exports=r;function r(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}},{}],42:[function(e,t,n){function r(e){var t={},n={},r=[];function a(o){if(Object.hasOwn(n,o))throw new i;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],r.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new i;return r}class i extends Error{constructor(){super(...arguments)}}t.exports=r,r.CycleException=i},{}],43:[function(e,t,n){class r{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}t.exports=r},{}],44:[function(e,t,n){class r{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>void 0;_defaultEdgeLabelFn=()=>void 0;_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else if(e===`\0`)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,a=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(r=arguments[1],a=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],a=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=o(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return a&&(this._edgeLabels[l]=r),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=a?r:this._defaultEdgeLabelFn(e,t,n);var u=s(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,i(this._preds[t],e),i(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[t],e),a(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.v===t):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.w===t):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}}function i(e,t){e[t]?e[t]++:e[t]=1}function a(e,t){--e[t]||delete e[t]}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function s(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function c(e,t){return o(e,t.v,t.w,t.name)}t.exports=r},{}],45:[function(e,t,n){t.exports={Graph:e("./graph"),version:e("./version")}},{"./graph":44,"./version":47}],46:[function(e,t,n){var r=e("./graph");t.exports={write:i,read:s};function i(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:a(e),edges:o(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function a(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function o(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function s(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}},{"./graph":44}],47:[function(e,t,n){t.exports=`2.2.4`},{}]},{},[1])(1)})}))(),1),v={bg:`#FFFFFF`,fg:`#27272A`},y={textSec:60,textMuted:40,textFaint:25,line:30,arrow:50,nodeFill:3,nodeStroke:20,groupHeader:5,innerStroke:12,keyBadge:10},b={"zinc-dark":{bg:`#18181B`,fg:`#FAFAFA`},"tokyo-night":{bg:`#1a1b26`,fg:`#a9b1d6`,line:`#3d59a1`,accent:`#7aa2f7`,muted:`#565f89`},"tokyo-night-storm":{bg:`#24283b`,fg:`#a9b1d6`,line:`#3d59a1`,accent:`#7aa2f7`,muted:`#565f89`},"tokyo-night-light":{bg:`#d5d6db`,fg:`#343b58`,line:`#34548a`,accent:`#34548a`,muted:`#9699a3`},"catppuccin-mocha":{bg:`#1e1e2e`,fg:`#cdd6f4`,line:`#585b70`,accent:`#cba6f7`,muted:`#6c7086`},"catppuccin-latte":{bg:`#eff1f5`,fg:`#4c4f69`,line:`#9ca0b0`,accent:`#8839ef`,muted:`#9ca0b0`},nord:{bg:`#2e3440`,fg:`#d8dee9`,line:`#4c566a`,accent:`#88c0d0`,muted:`#616e88`},"nord-light":{bg:`#eceff4`,fg:`#2e3440`,line:`#aab1c0`,accent:`#5e81ac`,muted:`#7b88a1`},dracula:{bg:`#282a36`,fg:`#f8f8f2`,line:`#6272a4`,accent:`#bd93f9`,muted:`#6272a4`},"github-light":{bg:`#ffffff`,fg:`#1f2328`,line:`#d1d9e0`,accent:`#0969da`,muted:`#59636e`},"github-dark":{bg:`#0d1117`,fg:`#e6edf3`,line:`#3d444d`,accent:`#4493f8`,muted:`#9198a1`},"solarized-light":{bg:`#fdf6e3`,fg:`#657b83`,line:`#93a1a1`,accent:`#268bd2`,muted:`#93a1a1`},"solarized-dark":{bg:`#002b36`,fg:`#839496`,line:`#586e75`,accent:`#268bd2`,muted:`#586e75`},"one-dark":{bg:`#282c34`,fg:`#abb2bf`,line:`#4b5263`,accent:`#c678dd`,muted:`#5c6370`}};function x(e,t){let n=[`@import url('https://fonts.googleapis.com/css2?family=${encodeURIComponent(e)}:wght@400;500;600;700&display=swap');`,...t?[`@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');`]:[]],r=`
|
|
2
2
|
/* Derived from --bg and --fg (overridable via --line, --accent, etc.) */
|
|
3
3
|
--_text: var(--fg);
|
|
4
4
|
--_text-sec: var(--muted, color-mix(in srgb, var(--fg) ${y.textSec}%, var(--bg)));
|