@coffer-org/web 7.2.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/ChatWidget-Bhj-WiNC.js +5 -0
- package/dist/assets/DiagnosticsPage-CAWQ6aOl.js +1 -0
- package/dist/assets/{MarkdownEditor-0mNSwLu_.js → MarkdownEditor-On2GbApm.js} +3 -3
- package/dist/assets/NewRecordView-Y6PoWPB9.js +1 -0
- package/dist/assets/PluginSettingsPage-CcTksC-8.js +1 -0
- package/dist/assets/ScanSummary-xxY2oZVM.js +1 -0
- package/dist/assets/SettingsForm-NWfklsPY.js +1 -0
- package/dist/assets/SettingsPage-CjsbuhdW.js +3 -0
- package/dist/assets/ThemeSwitcher-DKrSbFhp.js +1 -0
- package/dist/assets/{api-DD1tY5Dq.js → api-QNHQU9to.js} +1 -1
- package/dist/assets/{auth-context-BCos5wiL.js → auth-context-CoCE5oPD.js} +1 -1
- package/dist/assets/condition-B5taAXkb.js +1 -0
- package/dist/assets/countries-CoGvAZ5u.js +1 -0
- package/dist/assets/{data-size-qpzofknI.js → data-size-BMG0D59K.js} +1 -1
- package/dist/assets/{development-olQNibq5.js → development-ChLInqDF.js} +1 -1
- package/dist/assets/{esm-BsLSfif3.js → esm-CX8ST5Fv.js} +1 -1
- package/dist/assets/esm-oGoWacTd.js +24 -0
- package/dist/assets/extend-yQ8zoqGc.js +1 -0
- package/dist/assets/fields-CV3RQg0Y.js +64 -0
- package/dist/assets/file-text-CITvp61x.js +1 -0
- package/dist/assets/{icons-BTbA1N7a.js → icons-0CjpO0K1.js} +1 -1
- package/dist/assets/ilamy-view-CQD1H32m.js +7 -0
- package/dist/assets/index-4Lr8BOK1.js +22 -0
- package/dist/assets/index-lbeXf7OV.css +2 -0
- package/dist/assets/{input-tJjsdU1x.js → input-BFMNMo6y.js} +1 -1
- package/dist/assets/list-cache-DOhsI_p2.js +1 -0
- package/dist/assets/{markdown-vendor-CtaBI5gJ.js → markdown-vendor-WSL3P01P.js} +15 -15
- package/dist/assets/phone-input-BZ9vGYpI.js +21 -0
- package/dist/assets/phone-input-BpNLpzg_.js +1 -0
- package/dist/assets/plugin-Cjr7lgQH.js +1 -0
- package/dist/assets/{version-CtfLXkhy.js → plugin-label-CfdhA4_L.js} +1 -1
- package/dist/assets/{popover-C2xHG6L3.js → popover-C1KB68Kk.js} +1 -1
- package/dist/assets/registration-BBxYynR4.js +1 -0
- package/dist/assets/settings-Bo5IOwVg.js +1 -0
- package/dist/assets/shelf-Cj_pNvd-.js +1 -0
- package/dist/assets/showcase-BeBnutzT.js +1 -0
- package/dist/assets/src-0TBpEeKK.js +1 -0
- package/dist/assets/src-1AsWJbID.js +7 -0
- package/dist/assets/src-4bmZI2h_.js +1 -0
- package/dist/assets/src-B2aXBzDf.js +4 -0
- package/dist/assets/src-BHz-TcxU.js +1 -0
- package/dist/assets/src-BZK1QVol.js +1 -0
- package/dist/assets/src-BjYucEBM.js +1 -0
- package/dist/assets/src-Bl8rYgUt2.js +1 -0
- package/dist/assets/src-BmyfVP9z.js +1 -0
- package/dist/assets/src-BrHtOaqX.js +1 -0
- package/dist/assets/src-Bzgh6Ge5.js +1 -0
- package/dist/assets/src-C46sbhiF.js +2 -0
- package/dist/assets/src-CD1zBxk2.js +1 -0
- package/dist/assets/src-CE1TPDES.js +6 -0
- package/dist/assets/src-CQOQ3BNT.js +1 -0
- package/dist/assets/{src-IYiBUs1S.js → src-Cz38tTr3.js} +1 -1
- package/dist/assets/src-D14fQdLH.js +1 -0
- package/dist/assets/src-DgQcfYnz.js +1 -0
- package/dist/assets/src-DnN2GqEI.js +1 -0
- package/dist/assets/src-Dr_dOgc9.js +6 -0
- package/dist/assets/src-Ds6m7Evp2.js +1 -0
- package/dist/assets/src-Mln-mCD3.js +1 -0
- package/dist/assets/src-Q4BhkNtH.js +1 -0
- package/dist/assets/src-qJ0szNVM.js +1 -0
- package/dist/assets/src-rMuD7zD4.js +1 -0
- package/dist/assets/{src-DEcZTAam.js → src-tKMBP4Dv.js} +3 -3
- package/dist/assets/src-xh_qAK43.js +1 -0
- package/dist/assets/ui-BuqzqLDw.js +2 -0
- package/dist/assets/ui-CqUVBwcW.js +2 -0
- package/dist/assets/ui-Dj0Nsb2P.js +2 -0
- package/dist/assets/ui-QzaKLk9q.js +2 -0
- package/dist/assets/ui-vendor-C0IUUP3F.js +44 -0
- package/dist/index.html +22 -22
- package/dist-vendor/web-ui.js +20098 -14890
- package/package.json +1 -1
- package/dist/assets/ChatWidget-ByBb2eNs.js +0 -31
- package/dist/assets/DiagnosticsPage-tAFkmCz8.js +0 -1
- package/dist/assets/NewRecordView-CTSqFBfe.js +0 -1
- package/dist/assets/PluginSettingsPage-BFsSZgTa.js +0 -1
- package/dist/assets/ScanSummary-CaG-s5qh.js +0 -1
- package/dist/assets/SettingsForm-C_K9RpFr.js +0 -1
- package/dist/assets/SettingsPage-Cqp1tUyi.js +0 -3
- package/dist/assets/ThemeSwitcher-BPuCvU1U.js +0 -1
- package/dist/assets/arrow-left-DDsxjRCq.js +0 -1
- package/dist/assets/esm-DJsKiDbH.js +0 -24
- package/dist/assets/extend-BMkkNVfm.js +0 -1
- package/dist/assets/fields-GPyF03tK.js +0 -64
- package/dist/assets/file-text-DI3tERhf.js +0 -1
- package/dist/assets/index-C5rNjIku.css +0 -2
- package/dist/assets/index-DpBBejzP.js +0 -24
- package/dist/assets/lib-DU7Qh2A4.js +0 -1
- package/dist/assets/list-cache-B4i_A9fj.js +0 -1
- package/dist/assets/phone-input-BeYLRpyW.js +0 -1
- package/dist/assets/phone-input-CZF7hU3E.js +0 -21
- package/dist/assets/plugin-CFEkHH3f.js +0 -1
- package/dist/assets/plugin-ui-CKd6q8ec.js +0 -1
- package/dist/assets/settings-rQsBFoL2.js +0 -1
- package/dist/assets/shelf-CpE68_8d.js +0 -1
- package/dist/assets/showcase-CUDyXMb7.js +0 -1
- package/dist/assets/src-2QhdFJyH.js +0 -1
- package/dist/assets/src-BRA1s942.js +0 -1
- package/dist/assets/src-Bmc_xgWr.js +0 -1
- package/dist/assets/src-BnvKHmLu.js +0 -1
- package/dist/assets/src-Bv7IbF5F.js +0 -1
- package/dist/assets/src-C3X1cmlu.js +0 -1
- package/dist/assets/src-C3hdIsRT.js +0 -1
- package/dist/assets/src-CIrBx5O0.js +0 -1
- package/dist/assets/src-CTlBmB5n.js +0 -1
- package/dist/assets/src-Cp4yFztL.js +0 -4
- package/dist/assets/src-CvUhNHtO.js +0 -1
- package/dist/assets/src-D5pqHmdF.js +0 -1
- package/dist/assets/src-D9ZNj5Fi2.js +0 -1
- package/dist/assets/src-DAUYP87f2.js +0 -1
- package/dist/assets/src-DEqFDnFO.js +0 -1
- package/dist/assets/src-DXSkgVrX.js +0 -4
- package/dist/assets/src-DaHZILQZ.js +0 -1
- package/dist/assets/src-Dvbi--2I.js +0 -6
- package/dist/assets/src-Uu0k-CHA.js +0 -1
- package/dist/assets/src-WB1-7_Wh.js +0 -1
- package/dist/assets/src-dXlj2maQ.js +0 -1
- package/dist/assets/src-d_-Z83D-.js +0 -2
- package/dist/assets/src-eAsO2o4h2.js +0 -1
- package/dist/assets/src-uWOnIJWD.js +0 -6
- package/dist/assets/src-yL3q5Nfe.js +0 -1
- package/dist/assets/ui-A8aS2-NQ.js +0 -2
- package/dist/assets/ui-BK1F_c4b.js +0 -2
- package/dist/assets/ui-C9-epiVm.js +0 -2
- package/dist/assets/ui-kICtw37s.js +0 -1
- package/dist/assets/ui-vendor-BuwRGdK1.js +0 -44
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./countries-CoGvAZ5u.js";import{E as n,_ as r,d as i,g as a,h as o,i as s,m as c,p as l,u,x as d}from"./fields-CV3RQg0Y.js";import{a as f,i as p,n as m}from"./condition-B5taAXkb.js";import{c as h,f as g,g as _,o as v,r as y}from"./shelf-Cj_pNvd-.js";import{t as b}from"./plugin-Cjr7lgQH.js";import{n as x}from"./extend-yQ8zoqGc.js";var S=(()=>{try{return Intl.supportedValuesOf(`currency`)}catch{return[`USD`,`EUR`,`UAH`,`GBP`,`PLN`]}})();new Set(S);function C(e,t){try{return new Intl.NumberFormat(t,{style:`currency`,currency:e,currencyDisplay:`narrowSymbol`}).formatToParts(0).find(e=>e.type===`currency`)?.value??e}catch{return e}}function w(e,t=`en`){try{return new Intl.DisplayNames([t],{type:`currency`}).of(e)??e}catch{return e}}var T=[{name:`countries`,options:t.map(e=>({value:e.code,title:`core.countries.${e.code}`,icon:{kind:`icon`,value:`flag:${e.code}`},subtitle:e.code.toUpperCase()}))},{name:`colors`,options:e.map(e=>({value:e.name,title:`core.colors.${e.name}`,icon:{kind:`swatch`,value:e.hex},subtitle:e.hex}))},{name:`sex`,options:[...a]},{name:`weekdays`,options:[...r]},{name:`languages`,options:o.map(e=>({value:e.code,title:e.name}))},{name:`currencies`,options:S.map(e=>({value:e,title:w(e),subtitle:C(e)}))}],E=class extends Error{};function D(e,t){let n=e.split(`.`);for(let e of n)if(e===``)throw new E(`[mutate-path] '${t}': empty segment — a path may not contain '..', a leading '.' beyond the first character, or a trailing '.'`);return n}function O(e){if(typeof e!=`string`||e.trim()===``)throw new E(`[mutate-path] a target path must be a non-empty string`);let t=e.startsWith(`.`),n=t?e.slice(1):e;if(n===``)throw new E(`[mutate-path] '${e}': nothing after the leading '.'`);let r=n.split(`/`);if(r.some(e=>e===``))throw new E(`[mutate-path] '${e}': empty side of a '/' — both a relation path and a target path are required`);let i=D(r[r.length-1],e);return{hops:r.slice(0,-1).map(t=>D(t,e)),path:i,relative:t}}function k(e,t){if(!e.relative)return e;let n=[...t];return e.hops.length>0?{hops:[[...n,...e.hops[0]],...e.hops.slice(1)],path:e.path,relative:!1}:{hops:[],path:[...n,...e.path],relative:!1}}var A=class extends Error{};function j(e,t){return`${e}#${t.join(`.`)}`}function M(e,t){return P(e,t,0)}function N(e,t,n,r){let i=n[r],a=r===n.length-1,o=e.parts?.find(e=>e.key===i)??e.parts?.find(e=>e.role===i);return o?a?{relation:o.meta.relation,desc:`part '${i}' of composite '${t}' (kind '${o.meta.kind}')`}:o.meta.parts?N(o.meta,`${t}.${i}`,n,r+1):null:e.columns&&i in e.columns&&a?{desc:`sub-column '${i}' of composite '${t}'`}:null}function P(e,t,n){let r=t[n],a=n===t.length-1;for(let o of e){if(i(o)){if(o.key!==r)continue;return a?{relation:o.type.relation,desc:`field '${r}' (kind '${o.type.kind}')`}:N(o.type,r,t,n+1)}if(s(o)){if(!l(o)){let e=P(o.fields,t,n);if(e)return e;continue}if(o.key===r){if(a)return o.compute===void 0?null:{desc:`group '${r}' (a container)`};let e=P(o.fields,t,n+1);if(e)return e;continue}}}return null}function F(e,t){if(t.startsWith(`extend:`)){let n=t.slice(7);return e.extends_.find(e=>e.id===n).fields}let n=t.indexOf(`/`);return e.getShelf(t.slice(0,n),t.slice(n+1)).fields}function I(e,t,n,r,i){let a=`[mutate] ${t}.${n.join(`.`)}: target '${r}'`,o=t,s=F(e,o);for(let t of i.hops){let n=M(s,t);if(!n)throw new A(`${a} — unknown segment in relation hop '${t.join(`.`)}'`);if(!n.relation)throw new A(`${a} — '${t.join(`.`)}' is not a relation — it is ${n.desc}`);o=`${n.relation.library}/${n.relation.shelf}`,s=F(e,o)}if(!M(s,i.path))throw new A(`${a} — unknown segment in path '${i.path.join(`.`)}' (looked up in ${o})`);return o}function L(e,t,n){for(let r of e)if(i(r)){let e=[...t,r.key];r.type.mutate?.length&&n.push({path:e,scope:t,meta:r.type});for(let i of r.type.parts??[])i.meta.mutate?.length&&n.push({path:[...e,i.key],scope:t,meta:i.meta})}else s(r)&&L(r.fields,l(r)?[...t,r.key]:t,n)}function R(e){for(let t of e)if(s(t)){if(l(t)&&t.compute!==void 0){for(let e of t.fields)if(i(e)&&e.type.compute!==void 0)throw new A(`[mutate] group '${t.key}': child '${e.key}' carries its own value while the group already carries value — two writers for one column, drop one of the two computations.`)}R(t.fields)}}function ee(e){let t=new Map;for(let[n,r]of e)for(let e of r){let r=j(n,e.from),i=j(e.toShelf,e.to.path),a=t.get(r);a?a.push(i):t.set(r,[i])}let n=new Map,r=[],i=e=>{n.set(e,1),r.push(e);for(let a of t.get(e)??[]){let e=n.get(a)??0;if(e===0){let e=i(a);if(e)return e}else if(e===1){let e=r.indexOf(a);return[...r.slice(e),a]}}return r.pop(),n.set(e,2),null};for(let e of t.keys())if((n.get(e)??0)===0){let t=i(e);if(t)return t}return null}function z(e,t,n,r){for(let a of e)if(i(a)){let e=[...n,a.key],i=a.type;i.compute!==void 0&&r.push({scope:t,path:e,cache:i.cache});for(let n of i.parts??[])n.mode===`computedStored`&&r.push({scope:t,path:[...e,n.key],cache:n.meta?.cache})}else if(s(a)){let e=l(a)?[...n,a.key]:n;l(a)&&a.compute!==void 0&&r.push({scope:t,path:e,cache:void 0}),z(a.fields,t,e,r)}}function B(e,t){let n=new Set;for(let e of t.values())for(let t of e)n.add(j(t.toShelf,t.to.path));let r=[...(e.shelves??[]).map(e=>({scope:`${e.library}/${e.shelf}`,fields:e.fields})),...(e.extends_??[]).map(e=>({scope:`extend:${e.id}`,fields:e.fields}))];for(let{scope:e,fields:t}of r){let r=[];z(t,e,[],r);for(let t of r)t.cache===void 0&&(n.has(j(t.scope,t.path))||console.warn(`[mutate-graph] ${e}: '${t.path.join(`.`)}' is a computed-and-stored unit with no incoming mutate edge and no cache — nothing will ever trigger its recompute after it is first written.`))}}function V(e){let t=new Map,n=[...(e.shelves??[]).map(e=>({scope:`${e.library}/${e.shelf}`,fields:e.fields})),...(e.extends_??[]).map(e=>({scope:`extend:${e.id}`,fields:e.fields}))];for(let{fields:e}of n)R(e);for(let{scope:r,fields:i}of n){let n=[];if(L(i,[],n),!n.length)continue;let a=[];for(let t of n)for(let n of t.meta.mutate??[]){let i=k(O(n),t.scope),o=I(e,r,t.path,n,i);a.push({from:t.path,to:i,toShelf:o})}t.set(r,a)}let r=ee(t);if(r)throw new A(`[mutate] cycle: ${r.join(` -> `)}`);return B(e,t),t}var H=63,U=`__cachedAt`;H-10;var W=`_parent_id_index`;H-16;function G(e,t){for(let n of t){let t=`key`in n?n.key:void 0;if(t?.includes(`__`))throw Error(`[storage] ${e}: key '${t}' contains '__', the storage path separator — two different paths would spell one column name. Rename the key; an enclosing group's prefix supplies the '__'.`);s(n)&&G(e,n.fields)}}function K(e,t,n){if(t.length>47)throw Error(`[storage] ${e}: table name '${t}' is ${t.length} characters, over the 47-character budget (${H} minus '${W}', the identifier the ORM derives from it). PostgreSQL truncates a longer one silently. Shorten the library, the shelf, or a collection key along the path.`);let r=new Map;for(let[t,i]of v(n)){if(i.columns){if(!i.parts)throw Error(`[storage] ${e}.${t}: sets \`columns\` without \`parts\` — build a composite's columns from roles via resolveParts (see f.measured), or store the value whole with \`json: true\``);if(i.json)throw Error(`[storage] ${e}.${t}: is both a composite (\`columns\`) and JSON-stored (\`json\`) — a field persists one way or the other`)}for(let[n]of _(t,i)){let i=r.get(n);if(i!==void 0&&i!==t)throw Error(`[storage] ${e}: fields '${i}' and '${t}' both generate the column '${n}' — one value would overwrite the other and the second field would vanish from every response. Rename one.`);if(r.set(n,t),n.length>53)throw Error(`[storage] ${e}.${t}: generated column '${n}' is ${n.length} characters, over the 53-character budget (${H} minus '${U}'). PostgreSQL truncates a longer one silently. Shorten a key along the path.`)}}G(e,n);for(let r of y(n))K(`${e}/${r.key}`,`${t}__${r.key}`,r.group.fields)}function q(e,t={}){let r=t.disabled??new Set,a=e.filter(e=>!r.has(e.id)),o=new Map;for(let e of a){for(let t of e.libraries??[])for(let n of t.shelves)o.set(`${n.library}/${n.shelf}`,e.id);for(let t of e.libraryShelves??[])o.set(`${t.library}/${t.shelf}`,e.id)}let l=(e,t)=>o.get(`${e}/${t}`);for(let e of a)for(let t of e.dependsOn)if(r.has(t))throw Error(`[plugin] '${e.id}' is enabled, but its dependency '${t}' is disabled`);let _=b(a),{order:y,libraries:S}=_,C=_.shelves.map(d),w=_.extends_.map(d),E=new Map(a.filter(e=>e.settings).map(e=>[e.id,d(e.settings).fields]));for(let e of t.settingsGroups??[])if(E.has(e.id))throw Error(`[settings] group '${e.id}' is declared by a plugin and passed in by the caller — pick one owner`);let D=[...[...E].map(([e,t])=>({id:e,fields:t})),...t.settingsGroups??[]],O=new Map;for(let e of a)for(let t of e.fieldContribs??[]){let e=`${t.library}/${t.shelf}/${t.field}`,n=O.get(e)??{options:[],suggestions:[]};t.options&&n.options.push(...t.options),t.suggestions&&n.suggestions.push(...t.suggestions),O.set(e,n)}let k=(e,t)=>{if(t.options.length){let n=new Set((e.options??[]).map(e=>e.value));e.options=[...e.options??[],...t.options.filter(e=>!n.has(e.value))]}if(t.suggestions.length){let n=e.hints.suggestions??[],r=new Set(n);e.hints.suggestions=[...n,...t.suggestions.filter(e=>!r.has(e))]}},A=new Map;for(let e of T)A.set(e.name,e.options);for(let e of a)for(let t of e.optionLists??[])A.set(t.name,t.options);let j=e=>A.get(e)??[];for(let[e,t,n]of[...C.map(e=>[`${e.library}/${e.shelf}`,`${e.library}__${e.shelf}`,e.fields]),...D.map(e=>[`_settings/${e.id}`,`_settings__${e.id}`,e.fields]),...w.map(e=>[`extend/${e.id}`,`extend__${e.id}`,e.fields])])K(e,t,n);for(let e of C)for(let[t,n]of v(e.fields)){let r=O.get(`${e.library}/${e.shelf}/${t}`);r&&k(n,r)}for(let e of D)for(let[t,r]of v(e.fields)){let i=O.get(`_settings/${e.id}/${t}`);i&&(k(r,i),c(r)&&r.options?.length&&n(r,r.options.map(e=>e.value)))}let M=new Map;for(let e of C)for(let[t,r]of v(e.fields)){let i=r.hints.source,a=r.options??[],o=i?A.get(i)??[]:[],s=new Set(a.map(e=>e.value)),l=[...a,...o.filter(e=>!s.has(e.value))];c(r)&&l.length&&n(r,l.map(e=>e.value)),l.length&&(r.options=l,M.set(`${e.library}/${e.shelf}/${t}`,l))}let N=e=>{let t=[];for(let n of e)i(n)?t.push(n.type):s(n)&&t.push(...N(n.fields));return t};for(let e of w)for(let t of N(e.fields)){if(!c(t))continue;let e=t.hints.source;if(!e)continue;let r=A.get(e)??[],i=t.options??[],a=new Set(i.map(e=>e.value)),o=[...i,...r.filter(e=>!a.has(e.value))];o.length&&n(t,o.map(e=>e.value))}let P=(e,t,n)=>{let r=e[t];if(!r)throw Error(n);return r},F=[];for(let e of a)for(let t of e.showcases??[]){let e=C.find(e=>e.library===t.source.library&&e.shelf===t.source.shelf);if(!e)throw Error(`[showcase] ${t.library}/${t.id}: unknown source shelf ${t.source.library}/${t.source.shelf}`);let n=Object.fromEntries(v(e.fields));for(let e of p(t.filter)){let r=P(n,e,`[showcase] ${t.library}/${t.id}: filter field '${e}' is not in ${t.source.library}/${t.source.shelf}`),i=f(t.filter,e),a=i.filter(e=>m.has(e));if(a.length&&!r.hints.multiple)throw Error(`[showcase] ${t.library}/${t.id}: operator '${a[0]}' on '${e}' needs a multiple field, but ${t.source.library}/${t.source.shelf}.${e} stores a single value`);if(u(r)&&a.length!==i.length)throw Error(`[showcase] ${t.library}/${t.id}: filter field '${e}' is stored as JSON — only ${[...m].join(`/`)} applies`);if(r.columns)throw Error(`[showcase] ${t.library}/${t.id}: filter field '${e}' is a composite scalar stored across sub-columns`)}let r=g(e);for(let e of t.columns){if(!n[e])throw Error(`[showcase] ${t.library}/${t.id}: column '${e}' is not in ${t.source.library}/${t.source.shelf}`);if(!r.includes(e))throw Error(`[showcase] ${t.library}/${t.id}: column '${e}' is outside ${t.source.library}/${t.source.shelf}'s list projection (views.list/groupBy/inline) and would render blank`)}if(t.defaultGroupBy!==void 0){if(!n[t.defaultGroupBy])throw Error(`[showcase] ${t.library}/${t.id}: defaultGroupBy '${t.defaultGroupBy}' is not in ${t.source.library}/${t.source.shelf}`);if(!h(e).includes(t.defaultGroupBy))throw Error(`[showcase] ${t.library}/${t.id}: defaultGroupBy '${t.defaultGroupBy}' is not a grouping candidate of ${t.source.library}/${t.source.shelf} (views.groupBy)`)}if(F.some(e=>e.library===t.library&&e.id===t.id))throw Error(`[showcase] duplicate ${t.library}/${t.id}`);F.push(t)}let I=[...C.map(e=>({label:`${e.library}/${e.shelf}`,fields:e.fields})),...w.map(e=>({label:`extend '${e.id}'`,fields:e.fields}))];for(let{label:e,fields:t}of I)for(let[n,r]of v(t)){let t=r.relation;if(!t)continue;let i=C.find(e=>e.library===t.library&&e.shelf===t.shelf);if(!i)throw Error(`[relation] ${e}.${n}: unknown target shelf ${t.library}/${t.shelf}`);if(!t.filter)continue;let a=Object.fromEntries(v(i.fields));for(let r of p(t.filter))P(a,r,`[relation] ${e}.${n}: filter key '${r}' is not in ${t.library}/${t.shelf}`)}let L={order:y,libraries:S,shelves:C,extends_:w,showcases:F,getShowcase:(e,t)=>F.find(n=>n.library===e&&n.id===t),getShowcasesFor:e=>F.filter(t=>t.library===e),getShelf:(e,t)=>C.find(n=>n.library===e&&n.shelf===t),getLibrary:e=>S.find(t=>t.meta.id===e),getExtendsFor:(e,t)=>w.filter(n=>x(n,e,t)),getFieldOptions:(e,t,n)=>M.get(`${e}/${t}/${n}`)??[],getOptionList:j,getShelfOwner:l,mutateGraph:new Map};return L.mutateGraph=V(L),L}var J=null;function Y(e){J=q(e)}function X(){if(!J)throw Error(`[registry] not initialized — call initRegistry() in the boot loader`);return J}var Z=(e,t)=>X().getShelf(e,t),Q=(e,t)=>X().getExtendsFor(e,t),te=e=>X().getOptionList(e),ne=(e,t)=>X().getShowcase(e,t),re=e=>X().getShowcasesFor(e),ie=()=>X().libraries,ae=()=>X().shelves,oe=20,$=new Map;function se(e){let t=$.get(e);if(t)return $.delete(e),$.set(e,t),t}function ce(e,t){for($.delete(e),$.set(e,{rows:t,ts:Date.now()});$.size>oe;){let e=$.keys().next();if(e.done)break;$.delete(e.value)}}function le(e){for(let t of[...$.keys()])(t===e||t.startsWith(`${e}?`))&&$.delete(t)}function ue(e,t){let n=String(t.id??``);if(n)for(let[r,i]of $){if(r!==e&&!r.startsWith(`${e}?`))continue;let a=!1,o=i.rows.map(e=>{if(String(e.id)!==n)return e;a=!0;let r={...e};for(let n of Object.keys(e))n in t&&(r[n]=t[n]);return r});a&&$.set(r,{rows:o,ts:i.ts})}}export{Q as a,Z as c,re as d,Y as f,ce as i,ae as l,ue as n,ie as o,C as p,se as r,te as s,le as t,ne as u};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var t=e();function n(e){t=e}var r={exec:()=>null};function i(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(a.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var a={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},o=/^(?:[ \t]*(?:\n|$))+/,s=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,c=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,l=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,u=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,d=/(?:[*+-]|\d{1,9}[.)])/,f=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,p=i(f).replace(/bull/g,d).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ee=i(f).replace(/bull/g,d).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),m=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,te=/^[^\n]+/,h=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ne=i(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,h).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),re=i(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,d).getRegex(),g=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,_=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,
|
|
2
|
-
]`).replace(`lheading`,p).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},
|
|
1
|
+
function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var t=e();function n(e){t=e}var r={exec:()=>null};function i(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(a.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var a={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},o=/^(?:[ \t]*(?:\n|$))+/,s=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,c=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,l=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,u=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,d=/(?:[*+-]|\d{1,9}[.)])/,f=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,p=i(f).replace(/bull/g,d).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ee=i(f).replace(/bull/g,d).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),m=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,te=/^[^\n]+/,h=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ne=i(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,h).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),re=i(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,d).getRegex(),g=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,_=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ie=i(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,_).replace(`tag`,g).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),v=i(m).replace(`hr`,l).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,g).getRegex(),y={blockquote:i(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,v).getRegex(),code:s,def:ne,fences:c,heading:u,hr:l,html:ie,lheading:p,list:re,newline:o,paragraph:v,table:r,text:te},b=i(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,l).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,g).getRegex(),ae={...y,lheading:ee,table:b,paragraph:i(m).replace(`hr`,l).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,b).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,g).getRegex()},oe={...y,html:i(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,_).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:r,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:i(m).replace(`hr`,l).replace(`heading`,` *#{1,6} *[^
|
|
2
|
+
]`).replace(`lheading`,p).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},x=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,S=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,C=/^( {2,}|\\)\n(?!\s*$)/,se=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,w=/[\p{P}\p{S}]/u,T=/[\s\p{P}\p{S}]/u,E=/[^\s\p{P}\p{S}]/u,ce=i(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,T).getRegex(),D=/(?!~)[\p{P}\p{S}]/u,le=/(?!~)[\s\p{P}\p{S}]/u,ue=/(?:[^\s\p{P}\p{S}]|~)/u,de=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,O=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,fe=i(O,`u`).replace(/punct/g,w).getRegex(),pe=i(O,`u`).replace(/punct/g,D).getRegex(),k=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,me=i(k,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),he=i(k,`gu`).replace(/notPunctSpace/g,ue).replace(/punctSpace/g,le).replace(/punct/g,D).getRegex(),ge=i(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),_e=i(/\\(punct)/,`gu`).replace(/punct/g,w).getRegex(),ve=i(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ye=i(_).replace(`(?:-->|$)`,`-->`).getRegex(),A=i(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,ye).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),j=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,M=i(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,j).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),N=i(/^!?\[(label)\]\[(ref)\]/).replace(`label`,j).replace(`ref`,h).getRegex(),P=i(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,h).getRegex(),F={_backpedal:r,anyPunctuation:_e,autolink:ve,blockSkip:de,br:C,code:S,del:r,emStrongLDelim:fe,emStrongRDelimAst:me,emStrongRDelimUnd:ge,escape:x,link:M,nolink:P,punctuation:ce,reflink:N,reflinkSearch:i(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,N).replace(`nolink`,P).getRegex(),tag:A,text:se,url:r},be={...F,link:i(/^!?\[(label)\]\((.*?)\)/).replace(`label`,j).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,j).getRegex()},I={...F,emStrongRDelimAst:he,emStrongLDelim:pe,url:i(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,`i`).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},xe={...I,br:i(C).replace(`{2,}`,`*`).getRegex(),text:i(I.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},L={normal:y,gfm:ae,pedantic:oe},R={normal:F,gfm:I,breaks:xe,pedantic:be},Se={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},z=e=>Se[e];function B(e,t){if(t){if(a.escapeTest.test(e))return e.replace(a.escapeReplace,z)}else if(a.escapeTestNoEncode.test(e))return e.replace(a.escapeReplaceNoEncode,z);return e}function V(e){try{e=encodeURI(e).replace(a.percentDecode,`%`)}catch{return null}return e}function H(e,t){let n=e.replace(a.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(a.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(a.slashPipe,`|`);return n}function U(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Ce(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function W(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function we(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
3
3
|
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
4
|
-
`)}var
|
|
5
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=
|
|
6
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=
|
|
4
|
+
`)}var G=class{options;rules;lexer;constructor(e){this.options=e||t}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:U(e,`
|
|
5
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=we(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=U(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:U(t[0],`
|
|
6
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=U(t[0],`
|
|
7
7
|
`).split(`
|
|
8
8
|
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
9
9
|
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
@@ -21,9 +21,9 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
21
21
|
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
22
22
|
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
23
23
|
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
|
|
24
|
-
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=
|
|
25
|
-
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(
|
|
26
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=
|
|
24
|
+
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=H(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
25
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(H(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
26
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=U(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Ce(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),W(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return W(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&!(r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},K=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t,this.options.tokenizer=this.options.tokenizer||new G,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:a,block:L.normal,inline:R.normal};this.options.pedantic?(n.block=L.pedantic,n.inline=R.pedantic):this.options.gfm&&(n.block=L.gfm,this.options.breaks?n.inline=R.breaks:n.inline=R.gfm),this.tokenizer.rules=n}static get rules(){return{block:L,inline:R}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(a.carriageReturn,`
|
|
27
27
|
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(a.tabCharGlobal,` `).replace(a.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
28
28
|
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
29
29
|
`+r.raw,n.text+=`
|
|
@@ -33,16 +33,16 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
33
33
|
`+r.raw,a.text+=`
|
|
34
34
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=`
|
|
35
35
|
`+r.raw,n.text+=`
|
|
36
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,a)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},
|
|
37
|
-
`;return r?`<pre><code class="language-`+
|
|
38
|
-
`:`<pre><code>`+(n?i:
|
|
36
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,a)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},q=class{options;parser;constructor(e){this.options=e||t}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(a.notSpaceStart)?.[0],i=e.replace(a.endingNewline,``)+`
|
|
37
|
+
`;return r?`<pre><code class="language-`+B(r)+`">`+(n?i:B(i,!0))+`</code></pre>
|
|
38
|
+
`:`<pre><code>`+(n?i:B(i,!0))+`</code></pre>
|
|
39
39
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
40
40
|
${this.parser.parse(e)}</blockquote>
|
|
41
41
|
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
42
42
|
`}hr(e){return`<hr>
|
|
43
43
|
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
44
44
|
`+r+`</`+i+`>
|
|
45
|
-
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+
|
|
45
|
+
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+B(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
46
46
|
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
47
47
|
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
48
48
|
<thead>
|
|
@@ -51,6 +51,6 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
51
51
|
`}tablerow({text:e}){return`<tr>
|
|
52
52
|
${e}</tr>
|
|
53
53
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
54
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${
|
|
55
|
-
`+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},
|
|
56
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+
|
|
54
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${B(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=V(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+B(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=V(e);if(i===null)return B(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${B(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:B(e.text)}},J=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},Y=class e{options;renderer;textRenderer;constructor(e){this.options=e||t,this.options.renderer=this.options.renderer||new q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new J}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
55
|
+
`+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},X=class{options;block;constructor(e){this.options=e||t}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?K.lex:K.lexInline}provideParser(){return this.block?Y.parse:Y.parseInline}},Z=class{defaults=e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Y;Renderer=q;TextRenderer=J;Lexer=K;Tokenizer=G;Hooks=X;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new q(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new G(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new X;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];X.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return K.lex(e,t??this.defaults)}parser(e,t){return Y.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?K.lex:K.lexInline,s=i.hooks?i.hooks.provideParser():e?Y.parse:Y.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
56
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+B(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Q=new Z;function $(e,t){return Q.parse(e,t)}$.options=$.setOptions=function(e){return Q.setOptions(e),$.defaults=Q.defaults,n($.defaults),$},$.getDefaults=e,$.defaults=t,$.use=function(...e){return Q.use(...e),$.defaults=Q.defaults,n($.defaults),$},$.walkTokens=function(e,t){return Q.walkTokens(e,t)},$.parseInline=Q.parseInline,$.Parser=Y,$.parser=Y.parse,$.Renderer=q,$.TextRenderer=J,$.Lexer=K,$.lexer=K.lex,$.Tokenizer=G,$.Hooks=X,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,Y.parse,K.lex;export{Z as t};
|