@krantho/studio 1.1.2 → 1.1.4
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/{AssistantPanel-ECkcslXS.js → AssistantPanel-DpYeurU-.js} +1 -1
- package/dist/assets/{GraphBrowser-BBKTzzRV.js → GraphBrowser-Cm5q82MJ.js} +2 -2
- package/dist/assets/{GraphCanvas-Cct1E2As.js → GraphCanvas-CZJNUa_J.js} +1 -1
- package/dist/assets/{api-seo-CwGP6Bi2.js → api-seo-DeG5gsh6.js} +1 -1
- package/dist/assets/{collection-view--erTGbRH.js → collection-view-Bbr6ff-2.js} +1 -1
- package/dist/assets/{editor-page-XOJrwlcZ.js → editor-page-ydSt1TIL.js} +3 -3
- package/dist/assets/{fill-job-YPZFETW1.js → fill-job-CKtHKXwV.js} +1 -1
- package/dist/assets/{fill-run-view-B6rnYhKS.js → fill-run-view-ChrOLoV4.js} +1 -1
- package/dist/assets/{graph-config-DKVGDPTG.js → graph-config-CgXhm7XP.js} +1 -1
- package/dist/assets/{image-editor-BX-DHJDa.js → image-editor-CAZbOhRZ.js} +1 -1
- package/dist/assets/{index-CEQ7ZdKC.js → index-d5j-az5g.js} +2 -2
- package/dist/assets/{live-markdown-editor-DM8hYG3n.js → live-markdown-editor-DSsCNBWR.js} +1 -1
- package/dist/assets/{media-page-CeBC5FQS.js → media-page-DuSUjFO1.js} +1 -1
- package/dist/assets/{pulse-page-C00oCF2o.js → pulse-page-zRYAQJh6.js} +1 -1
- package/dist/assets/{setup-page-BHJcTaTH.js → setup-page-CshRkFJ-.js} +1 -1
- package/dist/assets/{site-BYsfQB_3.js → site-CGs9-oiw.js} +1 -1
- package/dist/assets/{site-model-C5bJvTbk.js → site-model-BXHOxNij.js} +1 -1
- package/dist/assets/{site-overview-5EhmXIR0.js → site-overview-B0Dnsj2N.js} +1 -1
- package/dist/assets/{structure-page-9d9MG7vU.js → structure-page-DpM1G-M9.js} +2 -2
- package/dist/assets/{use-drawer-actions-CR6Q0qdd.js → use-drawer-actions-BeAi2hJS.js} +1 -1
- package/dist/assets/{use-loaded-BBFak2E1.js → use-loaded-BNCu0C-c.js} +1 -1
- package/dist/assets/{use-locale-versions-BycCbBLd.js → use-locale-versions-CcJ_us1I.js} +1 -1
- package/dist/assets/vendor-markdown-BeOOOWTF.js +74 -0
- package/dist/index.html +1 -1
- package/package.json +5 -5
- package/dist/assets/vendor-markdown-pd8vs9n-.js +0 -74
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphBrowser-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,i as c,m as l,n as u,o as d,p as ee,t as te,y as ne}from"./api-seo-CwGP6Bi2.js";import{t as f}from"./triangle-exclamation-point-ttN5lZI0.js";import{a as re,o as ie,s as ae}from"./vendor-diff-DGCTJYJ4.js";import{r as p,t as m}from"./vendor-router-B4czwg8X.js";import{i as oe}from"./auth-CIpilSKF.js";import{D as se,G as ce,Ot as le,V as ue,a as de,c as h,ct as fe,d as g,et as _,f as v,l as pe,pt as me,s as y,st as he,wt as b,xt as ge,yt as _e}from"./index-CEQ7ZdKC.js";import{i as x,n as S,t as C}from"./createLucideIcon-BklFHeMd.js";import{t as w}from"./empty-state-CeUZocHx.js";import{i as ve,n as ye,r as be,t as xe}from"./fill-run-view-B6rnYhKS.js";import{t as T}from"./external-link-Dh7p8Ii6.js";import{n as Se,t as E}from"./format-C3ZX9yGM.js";import{n as Ce}from"./guards-BFEDbduR.js";import{t as D}from"./use-loaded-BBFak2E1.js";import{t as we}from"./data-table-B1kqxrEw.js";import{t as Te}from"./rotate-ccw-BgARBEK3.js";import{t as Ee}from"./save-ClSXW9cb.js";import{t as O}from"./action-button-DIrhqMRc.js";import{t as De}from"./source-CGZGd3Xy.js";import{a as Oe,c as ke,i as Ae,o as je,s as Me,u as k}from"./fill-job-YPZFETW1.js";import{C as Ne,D as A,E as j,S as Pe,c as Fe,d as Ie,i as Le,n as Re,s as ze,u as Be,w as Ve,x as He}from"./graph-config-DKVGDPTG.js";import{a as Ue,i as We,n as Ge,t as Ke}from"./export-helpers-C_HVpJN9.js";import{t as qe}from"./pen-line-B524Nue8.js";import{t as Je}from"./vendor-reactflow-CMKi7AEX.js";import{a as Ye,r as Xe}from"./findability-BrhtZ2yD.js";import{t as Ze}from"./layers-0VWe0rKm.js";import{t as Qe}from"./circle-dashed-cuYrILNo.js";import{t as $e}from"./circle-x-peGpq98w.js";import{n as et,t as tt}from"./catalog-offer-CeRRk2Zo.js";import{t as nt}from"./arrow-down-B5kfR2lG.js";import{t as rt}from"./info-Cxkabti5.js";import{t as it}from"./list-checks-BCEhMMVY.js";var at={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};at.node;var ot=C(at),st={name:`file-search`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]};st.node;var ct=C(st),lt={name:`sparkle`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}]]};lt.node;var ut=C(lt),dt={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};dt.node;var ft=C(dt),M=e(ae(),1);function N(e){return e.status>=200&&e.status<300}async function P(e){try{let t=await fetch(e,{credentials:`omit`,cache:`no-store`});return{path:e,status:t.status,text:await t.text()}}catch{return{path:e,status:0,text:``}}}function F(e){return e.status===0?`The site did not answer at ${e.path}.`:e.status===404?`The site serves nothing at ${e.path} (HTTP 404).`:`The site answered ${e.path} with HTTP ${e.status}.`}function I(e,t){return e.getElementsByTagNameNS(`*`,t)[0]?.textContent?.trim()||void 0}function pt(e){let t=new DOMParser().parseFromString(e,`application/xml`);return t.getElementsByTagName(`parsererror`).length>0||t.documentElement.localName!==`urlset`?null:[...t.getElementsByTagNameNS(`*`,`url`)].flatMap(e=>{let t=I(e,`loc`);return t?[{loc:t,lastmod:I(e,`lastmod`),changefreq:I(e,`changefreq`),priority:I(e,`priority`)}]:[]})}function L(e,t){return N(e)?e.text.trimEnd()===t.trimEnd()?`krantho`:`own`:`none`}function mt(e,t){return e===null?`krantho's own llms.txt could not be read, so where this one comes from could not be determined.`:e===`own`?`Written by the site's own /llms.txt route, not by krantho: it differs from what krantho's API builds, and Studio does not change it.`:t===`snapshot`?`Served from krantho's API: the snapshot saved through the assistant, until another is saved.`:t===`generated`?`Served from krantho's API, built from the live pages on each request: the site's name, the site entity's description as its summary, then each collection with pages and a link per live, indexable page with its description.`:`Served from krantho's API, which did not say how it made it: its origin could not be determined.`}function ht(e){switch(e){case`krantho`:return`The site serves this at /robots.txt.`;case`own`:return`The site's /robots.txt is answered by its own route, so what is saved here does not reach it.`;case`none`:return`The site serves no /robots.txt: route it to /api/seo/robots.txt to serve this.`}}async function gt(){let e=await P(`/sitemap.xml`);return N(e)?{served:e,entries:pt(e.text),krantho:null}:{served:e,entries:null,krantho:await ee().then(e=>e.urls,()=>null)}}async function _t(){let[e,t,r,i,a]=await Promise.all([gt(),P(`/robots.txt`),n(),P(`/llms.txt`),c().catch(()=>null)]);return{sitemap:e,robots:{served:t,krantho:r},llms:{served:i,krantho:a}}}var R=ie();function z({title:e,lead:t,aside:n,id:r,children:i}){let a=(0,M.useId)();return(0,R.jsxs)(`section`,{id:r,className:`structure-card`,"aria-labelledby":a,children:[(0,R.jsxs)(`div`,{className:`structure-card-head`,children:[(0,R.jsx)(`h3`,{id:a,className:`structure-card-title`,children:e}),n]}),t&&(0,R.jsx)(`p`,{className:`structure-note`,children:t}),i]})}function B({types:e}){return e.length===0?(0,R.jsx)(`span`,{className:`structure-muted`,children:`None set`}):(0,R.jsx)(`span`,{className:`structure-chips`,children:e.map(e=>(0,R.jsx)(y,{children:e},e))})}function vt(e,t,n,r){return e?t?`Saving…`:r===`save`&&!n?`Change the text first.`:null:`robots.txt is changed by an admin.`}function yt(e){let t=_(),[n,r]=(0,M.useState)(null);async function i(n,i){r(n);try{t({text:await i()}),e()}catch(e){t({text:v(e,`robots.txt could not be saved`),tone:`error`})}finally{r(null)}}return{busy:n,save:e=>void i(`save`,async()=>(await o(e),`Override saved. /api/seo/robots.txt now serves it.`)),reset:()=>void i(`reset`,async()=>await s()?`Override removed. krantho generates robots.txt again.`:`There was no override: krantho already generates robots.txt.`)}}function bt(e){let[t,n]=(0,M.useState)(e),[r,i]=(0,M.useState)(e);return r!==e&&(i(e),n(e)),[t,n]}function xt(e){let{busy:t,save:n,reset:r}=yt(e.onSaved),i=e.draft!==e.served;return(0,R.jsxs)(`div`,{className:`structure-actions`,children:[(0,R.jsx)(O,{variant:`primary`,icon:Ee,reason:vt(e.admin,t,i,`save`),onClick:()=>n(e.draft),children:t===`save`?`Saving…`:`Save`}),(0,R.jsx)(O,{icon:Te,reason:vt(e.admin,t,i,`reset`),onClick:r,children:t===`reset`?`Resetting…`:`Reset`})]})}function St({robots:e,site:t,admin:n,onSaved:r}){let[i,a]=bt(e.krantho),o=(0,M.useId)(),s=l(t);return(0,R.jsxs)(z,{title:`robots.txt`,lead:`${s?`The override saved in Studio`:`Generated by krantho: every crawler allowed, the sitemap named`}. ${ht(L(e.served,e.krantho))}`,children:[(0,R.jsxs)(`div`,{className:`structure-row`,children:[(0,R.jsx)(`label`,{htmlFor:o,className:`structure-label`,children:`robots.txt`}),(0,R.jsx)(y,{tone:s?`accent`:`neutral`,children:s?`Override`:`Generated`})]}),(0,R.jsx)(`textarea`,{id:o,className:`structure-textarea`,rows:8,spellCheck:!1,value:i,readOnly:!n,onChange:e=>a(e.target.value)}),(0,R.jsx)(xt,{draft:i,served:e.krantho,admin:n,onSaved:r})]})}async function Ct(){let[e,t,n,i]=await Promise.all([se(),ue(),De(!0,r),De(!0,d)]);return{site:e,collections:t,configs:n,catalog:i}}function wt(){return a()}function V(e,t){return e.find(e=>e.id===t)??null}function H(e,t){return e.filter(e=>e.scope===t)}function Tt(e){return e.state===`ok`?new Set(e.value.types.filter(e=>e.siteLevel).map(e=>e.type)):new Set}function Et(e){if(e.state!==`ok`)return new Set;let t=e.value.types.filter(e=>e.siteLevel&&!e.documentLevel);return new Set(t.map(e=>e.type))}var Dt=[{id:`loc`,header:`URL`,primary:!0,cell:e=>{let t=Ce(e.loc);return t?(0,R.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[e.loc,(0,R.jsx)(`span`,{className:`visually-hidden`,children:` (opens in a new tab)`})]}):e.loc}},{id:`lastmod`,header:`Last modified`,cell:e=>e.lastmod?`${Se(e.lastmod)} UTC`:`—`},{id:`changefreq`,header:`Change frequency`,cell:e=>e.changefreq??`—`},{id:`priority`,header:`Priority`,numeric:!0,cell:e=>e.priority??`—`}];function Ot({entries:e,caption:t}){return e.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`It lists no URL.`}):(0,R.jsx)(we,{caption:t,columns:Dt,rows:e,rowKey:e=>e.loc})}var kt=e=>e.map(e=>({...e}));function At({sitemap:e}){let{served:t,entries:n,krantho:r}=e;return N(t)?(0,R.jsx)(z,{title:`Sitemap`,lead:`As the site serves it at /sitemap.xml${n?`: ${n.length} URL${n.length===1?``:`s`}`:``}. krantho lists every live, indexable page of the collections with pages.`,children:n?(0,R.jsx)(Ot,{entries:n,caption:`Sitemap as served`}):(0,R.jsx)(`p`,{className:`structure-note`,children:`What the site serves at /sitemap.xml is not a sitemap.`})}):(0,R.jsx)(z,{title:`Sitemap`,lead:`${F(t)} What krantho's API builds at /api/seo/sitemap from the live pages:`,children:r?(0,R.jsx)(Ot,{entries:kt(r),caption:`Sitemap krantho builds`}):(0,R.jsx)(`p`,{className:`structure-note`,children:`krantho's sitemap could not be read either.`})})}function jt({llms:e}){let{served:t,krantho:n}=e;if(!N(t))return(0,R.jsx)(z,{title:`llms.txt`,lead:`${F(t)} krantho's API serves one at /api/seo/llms.txt; route /llms.txt to it to serve it.`});let r=n?L(t,n.text):null;return(0,R.jsxs)(z,{title:`llms.txt`,lead:(0,R.jsxs)(R.Fragment,{children:[`As the site serves it at /llms.txt, read-only.`,` `,mt(r,n?.origin??null)]}),children:[(0,R.jsx)(`section`,{className:`structure-text`,tabIndex:0,"aria-label":`llms.txt as served`,children:(0,R.jsx)(`pre`,{children:t.text})}),(0,R.jsxs)(`a`,{href:`/llms.txt`,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[`Open /llms.txt`,(0,R.jsx)(T,{"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`visually-hidden`,children:` (opens in a new tab)`})]})]})}function Mt({base:e,admin:t,state:n}){let r=(0,M.useCallback)(()=>_t(),[]),{loaded:i,reload:a}=D(r,`What crawlers read could not be read`),o=e.configs.state===`ok`?V(e.configs.value,`site`):null,s=(0,M.useCallback)(()=>{a(),n.reloadBase()},[a,n]);return i.state===`loading`?(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading what the site serves…`}):i.state===`error`?(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,children:i.message}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`structure-tab-lead`,children:`What search engines and assistants fetch from the site's own addresses, read as they read them.`}),(0,R.jsx)(At,{sitemap:i.data.sitemap}),(0,R.jsx)(St,{robots:i.data.robots,site:o?.config??null,admin:t,onSaved:s}),(0,R.jsx)(jt,{llms:i.data.llms})]})}function Nt({provider:e,reason:t}){return e===`missing`?(0,R.jsxs)(`p`,{className:`structure-note`,children:[`No language model is set up. Set one up in`,` `,(0,R.jsx)(m,{to:ge,children:`Setup › AI provider`}),`.`]}):t?(0,R.jsx)(`p`,{className:`structure-note`,children:t}):null}function Pt(){return(0,R.jsxs)(`p`,{className:`structure-modal-lead`,children:[`Fills what is `,(0,R.jsx)(`em`,{children:`missing`}),` — meta descriptions and the Schema.org properties no one has set — with the language model set up in Setup › AI provider. It never overwrites a value someone set. What it fills is saved to each document at once: the meta description as a new version and in the document's SEO settings, the Schema.org properties in those settings. The SEO settings have no versions, so the structured data on the live pages — and the meta descriptions the site reads from them first — change straight away.`]})}function Ft({collections:e,admin:t,run:n,onStart:r,onClose:i}){let[a,o]=(0,M.useState)({scope:`all`}),s=Be(),c=n.state===`running`,l=c?`Enrichment is running.`:be(t,s);return(0,R.jsxs)(g,{title:`Fill what's missing`,onClose:i,actions:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(S,{onClick:i,children:c?`Close (it keeps running)`:`Close`}),(0,R.jsx)(O,{variant:`primary`,icon:k,reason:l,onClick:()=>r(a),children:`Fill what's missing`})]}),children:[(0,R.jsx)(Pt,{}),(0,R.jsx)(ye,{collections:e,value:a,disabled:c,onChange:o}),!c&&(0,R.jsx)(Nt,{provider:s,reason:l}),(0,R.jsx)(xe,{run:n})]})}var It=e(Je(),1);function Lt(e){return{width:e.length*7+12,height:16}}function Rt(e){let t=new It.default.graphlib.Graph({multigraph:!0});t.setGraph({rankdir:`LR`,nodesep:28,ranksep:96,marginx:16,marginy:16}),t.setDefaultEdgeLabel(()=>({}));for(let n of e.nodes)t.setNode(n.key,{width:216,height:96});return e.edges.forEach((e,n)=>{t.setEdge(e.from,e.to,{...Lt(e.property),labelpos:`c`},`e${n}`)}),t}function zt(e){let t=Rt(e);It.default.layout(t);let n=e.nodes.map(e=>{let n=t.node(e.key);return{key:e.key,x:n?.x??0,y:n?.y??0}}),r=e.edges.map((e,n)=>{let r=t.edge({v:e.from,w:e.to,name:`e${n}`}),i=r?.points??[],a=i[Math.floor(i.length/2)]??{x:0,y:0};return{key:`e${n}`,property:e.property,points:i,labelX:r?.x??a.x,labelY:r?.y??a.y}}),i=t.graph();return{width:i.width??0,height:i.height??0,nodes:n,edges:r}}var U={site:{label:`site`,meaning:`A site entity: every page states it`},collection:{label:`collection`,meaning:`From the collection's archetype`},route:{label:`URL pattern`,meaning:`From a URL pattern's override`},document:{label:`document`,meaning:`From this page's own SEO settings`},derived:{label:`derived`,meaning:`Composed by krantho for the page: no scope sets it`}};function Bt(e,t,n){let r=t=>e.find(e=>e.id===t)?.config??null;return{document:r(`doc:${t}/${n}`),collection:r(`collection:${t}`),routes:e.filter(e=>e.scope===`route`).map(e=>e.config)}}var W=(e,t)=>e?.entities.some(e=>e[`@type`]===t)??!1;function Vt(e,t,n){return e.scope===`site`?`site`:t?W(n.document,e.type)?`document`:n.routes.some(t=>W(t,e.type))?`route`:W(n.collection,e.type)?`collection`:`derived`:`derived`}function Ht(e,t,n){return e.filter(e=>e.nodeId&&t?e.nodeId===t:e.type===n)}function Ut(e,t,n,r){let i=t.id!==``&&r.resolved.some(e=>e.id===t.id),a=Ht(r.features,t.id,t.type);return{key:t.id||`node-${n}`,id:t.id,type:Ne(e[`@type`])??t.type,kind:Vt(t,i,r.scopes),propertyCount:t.rows.length,features:a,missing:[...new Set(a.flatMap(e=>e.missing))],view:t}}function Wt(e,t){let n=new Map(e.filter(e=>e.id).map(e=>[e.id,e.key])),r=[];return t.forEach((t,i)=>{let a=e[i]?.key;if(a){for(let[e,i]of Object.entries(t))if(!e.startsWith(`@`))for(let t of Fe(i)){let i=n.get(t);i&&i!==a&&r.push({from:a,to:i,property:e})}}}),r}function Gt(e){let t=ze({nodes:e.nodes,resolved:e.resolved,siteTypes:e.siteTypes}),n=e.nodes.flatMap((n,r)=>{let i=t[r];return i?[Ut(n,i,r,e)]:[]});return{nodes:n,edges:Wt(n,e.nodes)}}function Kt(e){let t=new Set(e.nodes.map(e=>e.kind)),n=[`site`,`collection`,`document`,`derived`];return Object.keys(U).filter(e=>n.includes(e)||t.has(e))}function qt(e,t){let n=new Map(e.nodes.map(e=>[e.key,e.type])),r=e.edges.filter(e=>e.from===t).map(e=>`${e.property} → ${n.get(e.to)??e.to}`);return[...new Set(r)]}var Jt={site:j,collection:Ze,route:Ve,document:Ye,derived:ut};function Yt(e){return e===1?`1 property`:`${e} properties`}function Xt(e){if(e.features.length===0)return null;let t=[...new Set(e.features.map(e=>e.feature))].join(`, `),n=e.features.every(e=>e.eligible),r=e.features.every(e=>e.eligible||e.status===`restricted`);return{text:`${t}${n?``:r?` · on conditions`:` · not eligible`}`,eligible:n}}function G({kind:e}){let t=Jt[e];return(0,R.jsxs)(`span`,{className:h(`neutral`,`structure-kind`),title:U[e].meaning,children:[(0,R.jsx)(t,{className:`ui-chip-icon`,"aria-hidden":`true`}),U[e].label]})}function Zt({node:e}){let t=Xt(e);return(0,R.jsxs)(`span`,{className:`structure-node-chips`,children:[(0,R.jsx)(`span`,{className:h(`neutral`),children:Yt(e.propertyCount)}),t&&(0,R.jsxs)(`span`,{className:h(t.eligible?`success`:`warning`),children:[t.eligible?(0,R.jsx)(me,{className:`ui-chip-icon`,"aria-hidden":`true`}):(0,R.jsx)(A,{className:`ui-chip-icon`,"aria-hidden":`true`}),t.text]}),e.missing.length>0&&(0,R.jsxs)(`span`,{className:h(`danger`),children:[(0,R.jsx)(f,{className:`ui-chip-icon`,"aria-hidden":`true`}),e.missing.length,` missing`]})]})}function Qt({node:e}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`structure-node-head`,children:[(0,R.jsx)(`span`,{className:`structure-node-type`,children:e.type}),(0,R.jsx)(G,{kind:e.kind})]}),(0,R.jsx)(`code`,{className:`structure-node-id`,title:e.id||void 0,children:e.id?Pe(e.id):`no @id`}),(0,R.jsx)(Zt,{node:e})]})}function $t(e){return e.map((e,t)=>`${t===0?`M`:`L`}${e.x},${e.y}`).join(` `)}function en({edge:e,marker:t}){return(0,R.jsxs)(`g`,{children:[(0,R.jsx)(`path`,{d:$t(e.points),className:`structure-canvas-edge`,markerEnd:`url(#${t})`}),(0,R.jsx)(`text`,{x:e.labelX,y:e.labelY,className:`structure-canvas-label`,textAnchor:`middle`,dominantBaseline:`middle`,children:e.property})]})}function tn(e){let t=(0,M.useId)();return(0,R.jsxs)(`svg`,{className:`structure-canvas-edges`,width:e.width,height:e.height,"aria-hidden":`true`,children:[(0,R.jsx)(`defs`,{children:(0,R.jsx)(`marker`,{id:t,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`8`,markerHeight:`8`,orient:`auto`,children:(0,R.jsx)(`path`,{d:`M0,0 L8,4 L0,8 z`,className:`structure-canvas-arrow`})})}),e.edges.map(e=>(0,R.jsx)(en,{edge:e,marker:t},e.key))]})}function nn({node:e,links:t,x:n,y:r,selected:i,onSelect:a}){return(0,R.jsxs)(`button`,{type:`button`,className:`structure-node structure-node--canvas`,"data-kind":e.kind,"aria-pressed":i,style:{left:n-108,top:r-48,width:216,height:96},onClick:()=>a(e.key),children:[(0,R.jsx)(Qt,{node:e}),t.length>0&&(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[`Links: `,t.join(`; `)]})]})}function rn({graph:e,selected:t,onSelect:n}){let r=(0,M.useMemo)(()=>zt(e),[e]),i=new Map(e.nodes.map(e=>[e.key,e]));return(0,R.jsx)(`section`,{className:`structure-canvas`,"aria-label":`Graph canvas`,tabIndex:0,children:(0,R.jsxs)(`div`,{className:`structure-canvas-stage`,style:{width:r.width,height:r.height},children:[(0,R.jsx)(tn,{edges:r.edges,width:r.width,height:r.height}),r.nodes.map(r=>{let a=i.get(r.key);return a?(0,R.jsx)(nn,{node:a,links:qt(e,r.key),x:r.x,y:r.y,selected:t===r.key,onSelect:n},r.key):null})]})})}function an({graph:e,selected:t,onSelect:n}){return(0,R.jsx)(`ul`,{className:`structure-graph-list`,"aria-label":`Graph nodes`,children:e.nodes.map(r=>{let i=qt(e,r.key);return(0,R.jsxs)(`li`,{className:`structure-graph-item`,children:[(0,R.jsx)(`button`,{type:`button`,className:`structure-node structure-node--list`,"data-kind":r.kind,"aria-pressed":t===r.key,onClick:()=>n(r.key),children:(0,R.jsx)(Qt,{node:r})}),i.length>0&&(0,R.jsx)(`ul`,{className:`structure-graph-links`,"aria-label":`Links of ${r.type}`,children:i.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsx)(`code`,{children:e})},e))})]},r.key)})})}function on(e){let{node:t,collection:n,slug:r}=e;return t.kind===`site`?le(`site`):b(n,r)}function sn(e){switch(e.node.kind){case`site`:return`Every page states it. Its values are set in Scopes & archetypes › Site entities, or come from the site section of krantho.config.ts.`;case`collection`:return`Its type comes from the collection's archetype; its values from the page's fields and the SEO settings. Set a value for this page in its Data mode.`;case`route`:return`Its type comes from a URL pattern's override. Set a value for this page in its Data mode.`;case`document`:return`Its type comes from this page's own SEO settings, which its Data mode edits.`;case`derived`:return`krantho composes it for the page from what the page states (its address, its trail, its dates). Change those, not this node.`}}function cn({feature:e,props:t}){return(0,R.jsxs)(`li`,{className:`structure-missing`,children:[(0,R.jsx)(f,{className:`structure-missing-icon`,"aria-hidden":`true`}),(0,R.jsxs)(`span`,{className:`structure-missing-text`,children:[t.readerName(e.reader),`'s `,e.feature,` needs`,` `,e.missing.map((e,t)=>(0,R.jsxs)(`span`,{children:[t>0&&`, `,(0,R.jsx)(`code`,{children:e})]},e)),`.`,` `,(0,R.jsxs)(`a`,{href:e.source,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[`The rule `,(0,R.jsx)(`span`,{className:`visually-hidden`,children:`(opens in a new tab)`})]})]}),(0,R.jsxs)(m,{to:on(t),className:x(`secondary`,`sm`),children:[(0,R.jsx)(ft,{className:`ui-button-icon`,"aria-hidden":`true`}),`Fix `,(0,R.jsx)(`span`,{className:`visually-hidden`,children:e.feature})]})]})}function ln(e){let{node:t}=e,n=t.features.filter(e=>e.missing.length>0),r=[...new Set(t.features.flatMap(e=>e.conditions))];return(0,R.jsxs)(`section`,{className:`structure-card structure-node-card`,"aria-label":`Selected node: ${t.type}`,children:[(0,R.jsxs)(`div`,{className:`structure-card-head`,children:[(0,R.jsx)(`h3`,{className:`structure-card-title`,children:`Selected node`}),(0,R.jsx)(G,{kind:t.kind})]}),n.length>0&&(0,R.jsx)(`ul`,{className:`structure-missing-list`,"aria-label":`Missing requirements`,children:n.map(t=>(0,R.jsx)(cn,{feature:t,props:e},`${t.reader}:${t.feature}`))}),(0,R.jsxs)(`p`,{className:`structure-note`,children:[U[t.kind].meaning,`. `,sn(e)]}),r.map(e=>(0,R.jsxs)(`p`,{className:`structure-note`,children:[`Shown on a condition: `,e,`.`]},e)),(0,R.jsx)(Le,{views:[t.view]})]})}function un(e){let t=new DOMParser().parseFromString(e,`text/html`),n=[],r=0;for(let e of t.querySelectorAll(`script[type="application/ld+json"]`))try{n.push(JSON.parse(e.textContent??``))}catch{r++}return{scripts:n,nodes:n.flatMap(Re),unreadable:r}}function dn(e){return e.scripts.length===1?e.scripts[0]:e.scripts}async function fn(e){let{page:t}=e,[n,r]=await Promise.all([P(t.path),i(t.collection,t.slug)]);if(!N(n))return{state:`unserved`,reason:F(n)};let a=un(n.text);return a.nodes.length===0?{state:`unserved`,reason:`The page at ${t.path} serves no JSON-LD.`}:{state:`served`,served:a,graph:Gt({nodes:a.nodes,resolved:r.entities,siteTypes:e.siteTypes,scopes:Bt(e.configs,t.collection,t.slug),features:t.features})}}function pn(e,t){let n=(0,M.useRef)(e);(0,M.useLayoutEffect)(()=>{n.current=e});let r=`${e.page.collection}/${e.page.slug}`,i=(0,M.useCallback)(()=>fn(n.current),[r]),{loaded:a,reload:o}=D(i,`The page could not be read`),s=(0,M.useRef)(t);return(0,M.useEffect)(()=>{s.current!==t&&(s.current=t,o())},[t,o]),a}var mn=`(min-width: 1200px)`,hn=`page`,K=e=>`${e.collection}/${e.slug}`;function gn(e){let[t,n]=p(),r=t.get(hn);return[e.find(e=>K(e)===r)??e[0]??null,e=>{n(t=>{let n=new URLSearchParams(t);return n.set(hn,e),n},{replace:!0})}]}function _n({pages:e,value:t,onChange:n}){let r=(0,M.useId)();return(0,R.jsxs)(`div`,{className:`structure-field`,children:[(0,R.jsx)(`label`,{htmlFor:r,children:`Page`}),(0,R.jsx)(`select`,{id:r,className:`structure-select`,value:t,onChange:e=>n(e.target.value),children:e.map(e=>(0,R.jsxs)(`option`,{value:K(e),children:[e.path,` · `,K(e)]},K(e)))})]})}function vn({graph:e}){return(0,R.jsx)(`ul`,{className:`structure-legend`,"aria-label":`Where each node comes from`,children:Kt(e).map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(G,{kind:e}),(0,R.jsx)(`span`,{className:`structure-legend-text`,children:U[e].meaning})]},e))})}function yn(e){return e.nodes.find(e=>e.kind!==`site`&&e.kind!==`derived`)??e.nodes[0]??null}function bn({page:e,served:t}){function n(){let n=We(e.collection,e.slug);Ke(Ge(dn(t)),n,`application/ld+json`)}return(0,R.jsxs)(`div`,{className:`structure-actions`,children:[(0,R.jsx)(S,{size:`sm`,icon:Ue,onClick:n,children:`Export JSON-LD`}),(0,R.jsxs)(m,{to:b(e.collection,e.slug),className:x(`secondary`,`sm`),children:[(0,R.jsx)(qe,{className:`ui-button-icon`,"aria-hidden":`true`}),`Edit or import in Data mode`]})]})}function xn({page:e,served:t,graph:n,readerName:r}){let i=_e(mn),[a,o]=(0,M.useState)(null),s=n.nodes.find(e=>e.key===a)??yn(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`structure-row`,children:[(0,R.jsx)(vn,{graph:n}),(0,R.jsx)(bn,{page:e,served:t})]}),(0,R.jsx)(i?rn:an,{graph:n,selected:s?.key??null,onSelect:o}),s&&(0,R.jsx)(ln,{node:s,collection:e.collection,slug:e.slug,readerName:r}),t.unreadable>0&&(0,R.jsxs)(`p`,{className:`structure-note`,children:[t.unreadable,` JSON-LD script`,t.unreadable===1?` is`:`s are`,` not valid JSON: search engines skip `,t.unreadable===1?`it`:`them`,`.`]}),(0,R.jsxs)(`details`,{className:`structure-disclosure`,children:[(0,R.jsx)(`summary`,{children:`What the page emits · view-source`}),(0,R.jsx)(Ie,{data:dn(t),label:`application/ld+json · ${e.path}`})]})]})}function Sn({target:e,revision:t,readerName:n}){let r=pn(e,t);return r.state===`loading`?(0,R.jsxs)(`p`,{className:`structure-note`,children:[`Reading `,e.page.path,` as served…`]}):r.state===`error`?(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,children:r.message}):r.data.state===`unserved`?(0,R.jsx)(w,{icon:ct,title:`The page could not be read as served`,children:r.data.reason}):(0,R.jsx)(xn,{page:e.page,served:r.data.served,graph:r.data.graph,readerName:n},`${e.page.collection}/${e.page.slug}`)}function Cn({findings:e,configs:t,siteTypes:n,revision:r}){let[i,a]=gn(e.pages),o=t=>e.readers.find(e=>e.id===t)?.name??t,s=(0,M.useMemo)(()=>i?{page:i,configs:t,siteTypes:n}:null,[i,t,n]);return!i||!s?(0,R.jsx)(w,{icon:he,title:`No live pages yet`,children:`The graph is read from the pages the site serves. Publish a page to see its graph.`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`structure-tab-lead`,children:`A live page's graph as the site serves it, in the default locale. Each node's values carry their source; its rich results follow the search engines' rules.`}),(0,R.jsx)(_n,{pages:e.pages,value:K(i),onChange:a}),(0,R.jsx)(Sn,{target:s,revision:r,readerName:o})]})}function wn({base:e,state:t}){let n=e.configs.state===`ok`?e.configs.value:[],r=(0,M.useMemo)(()=>Tt(e.catalog),[e.catalog]),{findings:i}=t;return i.state===`loading`?(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading the live pages…`}):i.state===`error`?(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,children:i.message}):(0,R.jsx)(Cn,{findings:i.data,configs:n,siteTypes:r,revision:t.revision})}var q=`google`;function Tn(e){return{collection:e.collection,slug:e.slug,path:e.path}}function En(e,t){return e.find(e=>e.id===t)?.name??t}function Dn(e,t){return{pages:new Map,card:{key:`${e.reader}:${e.feature}`,reader:e.reader,readerName:En(t,e.reader),feature:e.feature,status:e.status,applicable:0,eligible:0,missing:[],conditions:[...e.conditions],source:e.source,types:[e.type]}}}function On(e,t,n,r){let i=r.has(t.type);for(let r of t.missing){let a=e.missing.find(e=>e.property===r&&e.type===t.type);if(!a){let o=i?le(`site`):b(n.collection,n.slug);a={property:r,type:t.type,pages:[],fix:o,site:i},e.missing.push(a)}a.pages.some(e=>e.collection===n.collection&&e.slug===n.slug)||a.pages.push(Tn(n))}}function kn(e,t,n){let r=new Map;for(let i of e)for(let e of i.features){let a=`${e.reader}:${e.feature}`,o=r.get(a)??Dn(e,t);r.set(a,o),o.card.types.includes(e.type)||o.card.types.push(e.type);let s=`${i.collection}/${i.slug}`;o.pages.set(s,(o.pages.get(s)??!1)||e.eligible),On(o.card,e,i,n)}return r}function An(e,t,n){if(n.some(e=>e.id===q))for(let r of t){let t=r.richResultStatus;if(!r.richResult||t!==`active`&&t!==`restricted`)continue;let i=`${q}:${r.richResult}`,a=e.get(i);if(a){a.pages.size===0&&!a.card.types.includes(r.type)&&a.card.types.push(r.type);continue}let o={reader:q,feature:r.richResult,type:r.type,status:t,eligible:!1,missing:[],conditions:[],source:r.docsUrl};e.set(i,Dn(o,n))}}function jn(e,t,n,r=[]){let i=kn(e,t,n);An(i,r,t);let a=e=>{let n=t.findIndex(t=>t.id===e.reader);return n<0?t.length:n},o=e=>+(e.applicable===0);return[...i.values()].map(({card:e,pages:t})=>({...e,applicable:t.size,eligible:[...t.values()].filter(Boolean).length})).sort((e,t)=>a(e)-a(t)||o(e)-o(t)||e.feature.localeCompare(t.feature))}function Mn(e){return e.reduce((e,t)=>({eligible:e.eligible+t.eligible,applicable:e.applicable+t.applicable}),{eligible:0,applicable:0})}function Nn(e){return e.status===`restricted`?`conditional`:e.applicable===0?`unused`:e.eligible===e.applicable?`eligible`:e.eligible===0?`not-eligible`:`partly`}function Pn(e){return e?.configs.state===`ok`?V(e.configs.value,`site`)?.config.entities.length??0:null}function Fn(e,t){let n=Pn(e);if(t.state!==`ready`)return{graphs:null,siteEntities:n,rich:null};let{pages:r,readers:i}=t.data,a=jn(r,i,Et(e?.catalog??{state:`failed`}));return{graphs:{valid:r.filter(Xe).length,pages:r.length},siteEntities:n,rich:Mn(a)}}function In(e){return e.catalog.state===`ok`?e.catalog.value:null}var Ln={eligible:{label:`Eligible`,tone:`success`,icon:me},partly:{label:`Partly eligible`,tone:`warning`,icon:A},"not-eligible":{label:`Not eligible`,tone:`danger`,icon:$e},conditional:{label:`Shown on conditions`,tone:`neutral`,icon:Qe},unused:{label:`Not used yet`,tone:`neutral`,icon:ot}};function Rn(e){let t=e.pages.slice(0,3).map(e=>e.path),n=e.pages.length-t.length;return`${t.join(`, `)}${n>0?` and ${n} more`:``}`}function zn({line:e,feature:t}){let n=e.site?`in Site entities`:`on ${e.pages[0]?.path??`the page`}`;return(0,R.jsxs)(`li`,{className:`structure-missing`,children:[(0,R.jsxs)(`span`,{className:`structure-missing-text`,children:[(0,R.jsxs)(`code`,{children:[e.type,`.`,e.property]}),` `,`missing on `,e.pages.length,` page`,e.pages.length===1?``:`s`,`: `,Rn(e),e.site&&` — a site entity, so one value fixes every page`]}),(0,R.jsxs)(m,{to:e.fix,className:x(`secondary`,`sm`),children:[(0,R.jsx)(ft,{className:`ui-button-icon`,"aria-hidden":`true`}),`Fix`,` `,(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[t,`: `,e.property,` `,n]})]})]})}function Bn({card:e}){if(e.applicable===0){let t=e.types.length>0?` (${e.types.join(` or `)})`:``;return(0,R.jsxs)(`p`,{className:`structure-note`,children:[`No page of this site is of this type yet`,t,`.`]})}return e.missing.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`Nothing is missing.`}):(0,R.jsx)(`ul`,{className:`structure-missing-list`,"aria-label":`What ${e.feature} is missing`,children:e.missing.map(t=>(0,R.jsx)(zn,{line:t,feature:e.feature},`${t.type}.${t.property}`))})}function Vn({card:e}){let t=(0,M.useId)(),n=Ln[Nn(e)];return(0,R.jsxs)(`section`,{className:`structure-card structure-rich-card`,"aria-labelledby":t,children:[(0,R.jsxs)(`div`,{className:`structure-card-head`,children:[(0,R.jsxs)(`h3`,{id:t,className:`structure-card-title`,children:[e.feature,` `,(0,R.jsxs)(`span`,{className:`structure-card-sub`,children:[`· `,e.readerName]})]}),(0,R.jsx)(y,{tone:n.tone,icon:n.icon,children:n.label})]}),(0,R.jsxs)(`p`,{className:`structure-rich-count`,children:[(0,R.jsxs)(`span`,{className:`structure-figure-value`,children:[e.eligible,` / `,e.applicable]}),` `,`live page`,e.applicable===1?``:`s`,` eligible`,e.status===`restricted`&&`: shown only under the rule's conditions`]}),e.conditions.map(e=>(0,R.jsxs)(`p`,{className:`structure-note`,children:[`Condition: `,e,`.`]},e)),(0,R.jsx)(Bn,{card:e}),(0,R.jsxs)(`a`,{href:e.source,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[e.readerName,`'s rule`,(0,R.jsx)(T,{"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`visually-hidden`,children:` (opens in a new tab)`})]})]})}function Hn({base:e,state:t}){let{findings:n}=t,r=(0,M.useMemo)(()=>Et(e.catalog),[e.catalog]),i=In(e),a=(0,M.useMemo)(()=>n.state===`ready`?jn(n.data.pages,n.data.readers,r,i?.types):[],[n,r,i]);return n.state===`loading`?(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading the live pages…`}):n.state===`error`?(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,children:n.message}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`structure-tab-lead`,children:`The features the search engines still show, by their own rules, checked on every live page in the default locale. A page is eligible when its entity has everything the rule requires.`}),a.length===0?(0,R.jsx)(w,{icon:k,title:`No rich result to show`,children:`The search engines' rules, as krantho reads them, list no feature they still show.`}):(0,R.jsx)(`div`,{className:`structure-rich-grid`,children:a.map(e=>(0,R.jsx)(Vn,{card:e},e.key))})]})}var Un=e=>e.map(e=>`${e.entityType}.${e.property}`).join(`, `);function Wn({doc:e,collection:t}){return(0,R.jsxs)(`li`,{children:[(0,R.jsx)(m,{to:b(t,e.slug),className:`structure-link`,children:e.title||e.slug}),e.orphanedProperties.length>0&&(0,R.jsxs)(`span`,{children:[` · unused: `,Un(e.orphanedProperties)]}),e.missingRequired.length>0&&(0,R.jsxs)(`span`,{children:[` · missing: `,Un(e.missingRequired)]})]})}function Gn({impact:e,collection:t}){if(e.affectedDocuments.length===0)return(0,R.jsx)(`p`,{children:`No page of the collection would lose a value or lack a required one.`});let{summary:n}=e;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{children:[`Of `,e.totalDocuments,` pages, `,n.documentsWithOrphans,` would keep values no chosen type reads, and `,n.documentsWithMissingRequired,` would lack values a chosen type requires:`]}),(0,R.jsx)(`ul`,{className:`structure-impact-list`,children:e.affectedDocuments.map(e=>(0,R.jsx)(Wn,{doc:e,collection:t},e.slug))})]})}function Kn({impact:e,collection:t}){return(0,R.jsxs)(`div`,{className:`structure-impact`,"aria-live":`polite`,children:[(0,R.jsx)(`h3`,{className:`structure-label`,children:`What the change does to the pages`}),e.state===`idle`&&(0,R.jsx)(`p`,{children:`Change the types to see which pages it touches.`}),e.state===`reading`&&(0,R.jsx)(`p`,{children:`Checking the collection's pages…`}),e.state===`error`&&(0,R.jsx)(`p`,{children:`The impact could not be read.`}),e.state===`ready`&&(0,R.jsx)(Gn,{impact:e.impact,collection:t})]})}function qn(e){if(e.state!==`ok`)return null;let t=e.value;return{siteEntities:V(t,`site`)?.config.entities.length??0,collections:H(t,`collection`).length,routes:H(t,`route`).length,documents:H(t,`document`).length}}function Jn(e){let t=e=>e||null;return[{label:`Name`,value:e.name,setting:`site.name`},{label:`Domain`,value:e.domain,setting:`site.domain`},{label:`Base URL`,value:e.baseUrl,setting:`site.baseUrl`},{label:`Language`,value:e.language,setting:`site.language`},{label:`Description`,value:t(e.description),setting:`site.description`},{label:`Alternate name`,value:t(e.alternateName),setting:`site.alternateName`},{label:`Logo`,value:t(e.logo),setting:`site.logo`},{label:`Profiles elsewhere`,value:e.sameAs.length>0?e.sameAs.join(`, `):null,setting:`site.sameAs`}]}var J=`The stored settings could not be read; reload before changing them.`;function Yn(e,t){return e.state===`ok`?{state:`read`,config:V(e.value,t)?.config??null}:{state:`unread`}}function Xn(e,t){return e.filter(e=>e.pages).map(e=>{let n=Yn(t,`collection:${e.name}`);return{collection:e,stored:n,types:n.state===`read`?n.config?.entities.map(e=>e[`@type`])??[]:null}})}function Zn(e,t){let n=e?.entities??[],r=t.map(e=>n.find(t=>t[`@type`]===e)??{"@type":e,properties:{}});return{...e??{},entities:r}}function Y(e,t){let n=[];for(let r of t){let t=n.find(e=>e.category===r.category);t||(t={category:r.category,label:e.categories[r.category]??r.category,types:[]},n.push(t)),t.types.push(r)}return n}function Qn(e){return Y(e,e.types.filter(e=>e.richResultStatus!==`retired`))}function $n(e,t){return Y(e,e.types.filter(e=>e.documentLevel&&et(e,t.has(e.type))))}function er(e,t,n){let[r,i]=(0,M.useState)({state:`idle`}),a=t.join(`,`);return(0,M.useEffect)(()=>{if(!n||a===``){i({state:`idle`});return}let t=!0;return i({state:`reading`}),u(e,a).then(e=>t&&i({state:`ready`,impact:e}),()=>t&&i({state:`error`})),()=>{t=!1}},[e,a,n]),r}var tr=new Set([`status`,`locale`,`slug`,`version`,`source`,`changedBy`,`createdAt`,`updatedAt`]);function nr(e){let[t,n]=(0,M.useState)(null);return(0,M.useEffect)(()=>{let t=!0;return ce(e).then(e=>{let r=Object.keys(e.schema.properties??{});t&&n(r.filter(e=>!tr.has(e)))},()=>t&&n(null)),()=>{t=!1}},[e]),t}function rr(e){let t=tt(e);if(t===`retired`)return`No longer shown in search results`;let n=e.richResult??`No search feature`;return t?`${n} · ${t}`:n}function ir(e){let{type:t}=e;return(0,R.jsxs)(`div`,{className:`structure-type-option`,children:[(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:e.checked,onChange:()=>e.onToggle(t.type)}),(0,R.jsx)(`span`,{className:`structure-type-name`,children:t.label}),(0,R.jsx)(`span`,{className:`structure-type-rich`,children:rr(t)})]}),t.docsUrl&&(0,R.jsxs)(`a`,{href:t.docsUrl,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[`Docs`,(0,R.jsx)(T,{"aria-hidden":`true`}),(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[` for `,t.label,` (opens in a new tab)`]})]})]})}function ar(e){return(0,R.jsx)(`div`,{className:`structure-type-picker`,children:$n(e.catalog,e.chosen).map(t=>(0,R.jsxs)(`fieldset`,{className:`structure-type-group`,children:[(0,R.jsx)(`legend`,{children:t.label}),t.types.map(t=>(0,R.jsx)(ir,{type:t,checked:e.chosen.has(t.type),onToggle:e.onToggle},t.type))]},t.category))})}function or(e){let[t,n]=(0,M.useState)(()=>new Set(e)),r=[...t],i=r.length!==e.length||r.some(t=>!e.includes(t));function a(e){n(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})}return{chosen:t,types:r,changed:i,toggle:a}}function sr(e){let[n,r]=(0,M.useState)(!1),i=_(),a=e.row.collection.name;async function o(n){let{stored:o}=e.row;if(o.state!==`read`)i({text:J,tone:`error`});else{r(!0);try{await t(`collection:${a}`,Zn(o.config,n));let r=E(a);i({text:`${r}'s archetype saved. Its pages' structured data has changed.`}),e.onSaved(),e.onClose()}catch(e){i({text:v(e,`The archetype could not be saved`),tone:`error`}),r(!1)}}}return{saving:n,save:e=>void o(e)}}function cr(e){let t=e.row.collection.name,{chosen:n,types:r,changed:i,toggle:a}=or(e.row.types??[]),{saving:o,save:s}=sr(e),c=er(t,r,i),l=nr(t),u=o?`Saving…`:i?null:`Change the types first.`,d=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(S,{onClick:e.onClose,children:`Cancel`}),(0,R.jsx)(O,{variant:`primary`,reason:u,onClick:()=>s(r),children:o?`Saving…`:`Save`})]});return(0,R.jsxs)(g,{title:`Change ${E(t)}'s archetype`,onClose:e.onClose,busy:o,actions:d,children:[(0,R.jsxs)(`p`,{className:`structure-modal-lead`,children:[`The Schema.org types every page of `,E(t),` states. They are saved to the collection's SEO settings, which have no versions: its pages' structured data changes at once. A page's own settings still win.`]}),l&&l.length>0&&(0,R.jsxs)(`p`,{className:`structure-note`,children:[`The types' properties can be filled from its fields: `,l.join(`, `),`.`]}),(0,R.jsx)(ar,{catalog:e.catalog,chosen:n,onToggle:a}),(0,R.jsx)(Kn,{impact:c,collection:t})]})}var X=(e,t,n)=>`${e} ${e===1?t:n}`,lr=[{id:`site`,title:`Site`,says:`Who the site is`,icon:j,count:e=>X(e.siteEntities,`site entity`,`site entities`)},{id:`collection`,title:`Collection`,says:`What kind of page`,icon:Ze,count:e=>X(e.collections,`collection archetype`,`collection archetypes`)},{id:`route`,title:`URL pattern`,says:`Overrides by route`,icon:Ve,count:e=>X(e.routes,`URL pattern`,`URL patterns`)},{id:`document`,title:`Document`,says:`One page's own say, which wins over everything above`,icon:Ye,count:e=>X(e.documents,`page with its own settings`,`pages with their own settings`)}],ur=e=>`cascade-${e}`,Z=e=>`scope-${e}`;function dr({step:e,next:t,counts:n}){let r=e.icon;return(0,R.jsxs)(`li`,{id:ur(e.id),className:`structure-cascade-step`,children:[(0,R.jsx)(`span`,{className:`structure-cascade-icon`,"aria-hidden":`true`,children:(0,R.jsx)(r,{})}),(0,R.jsx)(`span`,{className:`structure-cascade-title`,children:(0,R.jsx)(`a`,{href:`#${Z(e.id)}`,className:`structure-link`,children:e.title})}),(0,R.jsx)(`span`,{className:`structure-cascade-says`,children:e.says}),(0,R.jsx)(`span`,{className:`structure-cascade-count`,children:n?e.count(n):`Not read`}),t&&(0,R.jsxs)(`a`,{href:`#${ur(t.id)}`,className:`structure-cascade-next`,children:[(0,R.jsx)(nt,{"aria-hidden":`true`}),`Then: `,t.title]})]})}function fr({counts:e}){let t=(0,M.useId)();return(0,R.jsxs)(`section`,{className:`structure-cascade`,"aria-labelledby":t,children:[(0,R.jsx)(`h3`,{id:t,className:`structure-card-title`,children:`Four scopes, the narrowest wins`}),(0,R.jsx)(`ol`,{className:`structure-cascade-steps`,children:lr.map((t,n)=>(0,R.jsx)(dr,{step:t,next:lr[n+1],counts:e},t.id))}),(0,R.jsx)(`p`,{className:`structure-note`,children:`Site and collection are seeded from krantho.config.ts when the site starts; edits made here persist.`})]})}function pr(e,t,n){return e?n.state===`ok`?t?null:`The catalog could not be read.`:J:`Archetypes are changed by an admin.`}function mr(e,t){return[{id:`collection`,header:`Collection`,primary:!0,cell:e=>E(e.collection.name)},{id:`path`,header:`Renders at`,cell:e=>(0,R.jsx)(`code`,{children:de(e.collection)??`—`})},{id:`types`,header:`Schema.org types`,cell:e=>e.types?(0,R.jsx)(B,{types:e.types}):(0,R.jsx)(`span`,{className:`structure-muted`,children:`Not read`})},{id:`change`,header:`Change`,cell:n=>(0,R.jsxs)(O,{size:`sm`,icon:qe,reason:t,onClick:()=>e(n),children:[`Change`,` `,(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[E(n.collection.name),`'s archetype`]})]})}]}function hr(e){let{collections:t,configs:n,catalog:r,admin:i,onSaved:a}=e,[o,s]=(0,M.useState)(null),c=(0,M.useMemo)(()=>Xn(t,n),[t,n]),l=pr(i,r,n);return(0,R.jsxs)(z,{id:Z(`collection`),title:`Collection archetypes`,lead:`What kind of page each collection's documents are. Seeded from krantho.config.ts (seo.collections) when the site starts; a change here persists.`,children:[(0,R.jsx)(we,{caption:`Collection archetypes`,columns:mr(s,l),rows:c,rowKey:e=>e.collection.name}),o&&r&&(0,R.jsx)(cr,{row:o,catalog:r,onClose:()=>s(null),onSaved:a})]})}var gr=(0,M.lazy)(()=>re(()=>import(`./GraphBrowser-BBKTzzRV.js`).then(e=>({default:e.GraphBrowser})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30])));function _r({site:e}){return(0,R.jsx)(z,{title:`From krantho.config.ts`,lead:`The site's identity is code: every site entity reads it. Studio shows it; change it where it is set.`,children:(0,R.jsx)(`dl`,{className:`structure-identity`,children:Jn(e).map(e=>(0,R.jsxs)(`div`,{className:`structure-identity-row`,children:[(0,R.jsx)(`dt`,{children:e.label}),(0,R.jsxs)(`dd`,{children:[(0,R.jsxs)(`span`,{className:`structure-identity-value`,children:[(0,R.jsx)(fe,{"aria-hidden":`true`}),e.value??(0,R.jsx)(`span`,{className:`structure-muted`,children:`Not set`})]}),(0,R.jsxs)(`span`,{className:`structure-identity-where`,children:[`Change it in krantho.config.ts (`,(0,R.jsx)(`code`,{children:e.setting}),`)`]})]})]},e.setting))})})}function vr(e){return{"@context":`https://schema.org`,"@graph":e.entities.map(e=>({"@type":e[`@type`],...e[`@id`]?{"@id":e[`@id`]}:{},...e.properties}))}}function yr(e){let[t,n]=(0,M.useState)(new Map),r=e.entities.map(e=>e[`@type`]).join(`,`);return(0,M.useEffect)(()=>{let e=!0;return Promise.allSettled(r.split(`,`).filter(Boolean).map(te)).then(t=>{let r=new Map;for(let e of t)e.status===`fulfilled`&&r.set(e.value.type.type,e.value);e&&n(r)}),()=>{e=!1}},[r]),t}function br(e){let n=_();return(0,M.useCallback)(async r=>{try{await t(`site`,r),n({text:`Site entities saved. Every page's structured data has changed.`}),e()}catch(e){throw n({text:v(e,`The site entities could not be saved`),tone:`error`}),e}},[n,e])}var xr={entities:[]};function Sr(e,t){return t?J:e?`Kept in the site's SEO settings, which have no versions: Save changes every page's structured data at once.`:`Kept in the site's SEO settings. Changing them is for admins: here they are browsed and exported.`}function Cr({stored:e,catalogTypes:t,admin:n,onSaved:r}){let i=e.state===`read`?e.config??xr:xr,a=e.state!==`read`,o=n&&!a,s=(0,M.useMemo)(()=>vr(i),[i]),c=(0,M.useMemo)(()=>He(s),[s]),l=yr(i),u=(0,M.useMemo)(()=>new Set(i.entities.map(e=>e[`@type`])),[i]),d=br(r);return(0,R.jsx)(z,{title:`Site entities`,lead:Sr(n,a),children:!a&&(0,R.jsx)(M.Suspense,{fallback:(0,R.jsx)(`p`,{className:`structure-note`,children:`Loading the graph browser…`}),children:(0,R.jsx)(gr,{model:c,catalogTypes:t,catalogDetails:l,rawData:s,configData:o?i:void 0,onSave:o?d:void 0,siteLevelTypeSet:u})})})}function wr(e){let[t,n]=(0,M.useState)({state:`loading`});return(0,M.useEffect)(()=>{let t=!0;return te(e).then(e=>t&&n({state:`ready`,detail:e}),()=>t&&n({state:`error`})),()=>{t=!1}},[e]),t}function Tr({detail:e}){return e.properties.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`The catalog lists no property for it.`}):(0,R.jsxs)(`table`,{className:`structure-table`,children:[(0,R.jsxs)(`caption`,{className:`visually-hidden`,children:[`The properties of `,e.type.label]}),(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{scope:`col`,children:`Property`}),(0,R.jsx)(`th`,{scope:`col`,children:`Importance`}),(0,R.jsx)(`th`,{scope:`col`,children:`Filled from`})]})}),(0,R.jsx)(`tbody`,{children:e.properties.map(e=>(0,R.jsxs)(`tr`,{children:[(0,R.jsxs)(`th`,{scope:`row`,children:[(0,R.jsx)(`code`,{children:e.property}),e.hint&&(0,R.jsxs)(`span`,{className:`structure-muted`,children:[` · `,e.hint]})]}),(0,R.jsx)(`td`,{children:e.importance}),(0,R.jsx)(`td`,{children:e.autoMapField?(0,R.jsx)(`code`,{children:e.autoMapField}):e.source})]},e.property))})]})}var Q=e=>(e??[]).join(`, `);function Er({rule:e}){return(0,R.jsxs)(`li`,{className:`structure-rule`,children:[(0,R.jsx)(`strong`,{children:e.readerName}),` · `,e.feature??`No search feature`,` ·`,` `,e.status===`restricted`?`shown only under conditions`:e.status===`active`?`shown`:`no search feature`,(e.required?.length??0)>0&&(0,R.jsxs)(`span`,{children:[` · requires `,Q(e.required)]}),e.oneOf?.map(e=>(0,R.jsxs)(`span`,{children:[` · one of `,Q(e)]},e.join())),(e.recommended?.length??0)>0&&(0,R.jsxs)(`span`,{children:[` · recommends `,Q(e.recommended)]}),e.conditions?.map(e=>(0,R.jsxs)(`span`,{children:[` · `,e]},e)),` `,(0,R.jsxs)(`a`,{href:e.source,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[`Source, verified `,e.verifiedAt,(0,R.jsx)(T,{"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`visually-hidden`,children:` (opens in a new tab)`})]})]})}function Dr({type:e,onClose:t}){let n=wr(e),r=n.state===`ready`?n.detail.rules.filter(e=>e.status!==`retired`):[];return(0,R.jsxs)(g,{title:n.state===`ready`?n.detail.type.label:e,onClose:t,actions:(0,R.jsx)(S,{onClick:t,children:`Close`}),children:[n.state===`loading`&&(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading the type…`}),n.state===`error`&&(0,R.jsx)(`p`,{className:`structure-note`,children:`The type could not be read.`}),n.state===`ready`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`structure-modal-lead`,children:n.detail.type.description}),(0,R.jsx)(`h3`,{className:`structure-label`,children:`Properties`}),(0,R.jsx)(Tr,{detail:n.detail}),(0,R.jsx)(`h3`,{className:`structure-label`,children:`The search engines' rules`}),r.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`No active search engine has a rule for it beyond Schema.org.`}):(0,R.jsx)(`ul`,{className:`structure-rules`,children:r.map(e=>(0,R.jsx)(Er,{rule:e},e.reader))})]})]})}function Or(e){return!e.richResult||e.richResultStatus===`none`?`No search feature`:e.richResultStatus===`restricted`?`${e.richResult} · shown only under conditions`:e.richResult}function kr(e){return e.siteLevel&&e.documentLevel?`site or page`:e.siteLevel?`site`:`page`}function Ar({type:e,onDetail:t}){return(0,R.jsxs)(`li`,{className:`structure-catalog-type`,children:[(0,R.jsx)(`span`,{className:`structure-type-name`,children:e.label}),(0,R.jsx)(y,{children:kr(e)}),(0,R.jsx)(`span`,{className:`structure-type-rich`,children:Or(e)}),(0,R.jsxs)(S,{size:`sm`,variant:`ghost`,icon:rt,onClick:()=>t(e.type),children:[`Details `,(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[`of `,e.label]})]})]})}function jr({catalog:e}){let[t,n]=(0,M.useState)(null);return(0,R.jsxs)(z,{id:`scope-catalog`,title:`The catalog`,lead:`The Schema.org types krantho composes, by what they describe; each with the search feature it can appear in by the search engines' rules.`,children:[Qn(e).map(e=>(0,R.jsxs)(`div`,{className:`structure-catalog-group`,children:[(0,R.jsx)(`h4`,{className:`structure-label`,children:e.label}),(0,R.jsx)(`ul`,{className:`structure-catalog-types`,children:e.types.map(e=>(0,R.jsx)(Ar,{type:e,onDetail:n},e.type))})]},e.category)),t&&(0,R.jsx)(Dr,{type:t,onClose:()=>n(null)})]})}var Mr=e=>e.config.entities.map(e=>e[`@type`]);function Nr({configs:e}){let t=H(e,`route`);return(0,R.jsx)(z,{id:Z(`route`),title:`URL patterns`,lead:`Overrides for the pages whose address matches a pattern; the most specific pattern wins. Seeded from krantho.config.ts (seo.routes).`,children:t.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`No URL pattern has its own types.`}):(0,R.jsx)(`ul`,{className:`structure-scope-list`,children:t.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`code`,{children:e.id.replace(/^route:/,``)}),(0,R.jsx)(B,{types:Mr(e)})]},e.id))})})}function Pr({configs:e}){let t=H(e,`document`);return(0,R.jsx)(z,{id:Z(`document`),title:`Pages with their own settings`,lead:`One page's own say, which wins over everything above. A page's settings are edited in its Data mode.`,children:t.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`No page has settings of its own.`}):(0,R.jsx)(`ul`,{className:`structure-scope-list`,children:t.map(e=>{let[t=``,n=``]=e.id.replace(/^doc:/,``).split(`/`);return(0,R.jsxs)(`li`,{children:[(0,R.jsxs)(m,{to:b(t,n),className:`structure-link`,children:[t,`/`,n]}),(0,R.jsx)(B,{types:Mr(e)})]},e.id)})})})}function Fr({base:e,admin:t,state:n}){let r=e.configs.state===`ok`?e.configs.value:[],i=In(e);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(fr,{counts:qn(e.configs)}),e.configs.state!==`ok`&&(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,role:`alert`,children:`The SEO settings could not be read. Nothing stored can be changed until they are: reload the page.`}),(0,R.jsxs)(`div`,{id:Z(`site`),className:`structure-stack`,children:[(0,R.jsx)(_r,{site:e.site.site}),(0,R.jsx)(Cr,{stored:Yn(e.configs,`site`),catalogTypes:i?.types??[],admin:t,onSaved:n.reloadBase})]}),(0,R.jsx)(hr,{collections:e.collections,configs:e.configs,catalog:i,admin:t,onSaved:n.reloadBase}),(0,R.jsx)(Nr,{configs:r}),(0,R.jsx)(Pr,{configs:r}),i&&(0,R.jsx)(jr,{catalog:i})]})}function Ir(e){return`${e} live page${e===1?``:`s`}`}function Lr({validate:e}){let t=_(),[n,r]=(0,M.useState)(!1);async function i(){r(!0);let n=await e();if(r(!1),!n){t({text:`The live pages' findings could not be read.`,tone:`error`});return}let i=n.pages.filter(Xe).length;t({text:`Validated ${Ir(n.pages.length)}: ${i} with a valid graph.`})}return(0,R.jsx)(S,{icon:it,"aria-disabled":n,onClick:n?void 0:()=>void i(),children:n?`Validating…`:`Validate all pages`})}function Rr({fill:e}){return e.state===`running`?(0,R.jsxs)(`p`,{className:`structure-note`,children:[`Filling… `,je(e.plan,e.step),` (`,ke[e.step],`). Open Fill what's missing to follow it.`]}):null}function zr(e){let t=e.siteName??`the site`;return(0,R.jsxs)(`header`,{className:`structure-header`,children:[(0,R.jsxs)(`div`,{className:`structure-header-text`,children:[(0,R.jsx)(`h1`,{className:`structure-title`,children:`Structure`}),(0,R.jsxs)(`p`,{className:`structure-lead`,children:[`How search engines and AI assistants read `,t,`. Every page carries one connected Schema.org graph — no one writes JSON-LD by hand.`]}),(0,R.jsx)(`div`,{role:`status`,children:(0,R.jsx)(Rr,{fill:e.fill})})]}),(0,R.jsxs)(`div`,{className:`structure-actions`,children:[(0,R.jsx)(Lr,{validate:e.validate}),(0,R.jsx)(O,{variant:`primary`,icon:k,reason:e.onFill?e.fillBlocker:`Reading the site…`,onClick:()=>e.onFill?.(),children:`Fill what's missing`})]})]})}function $({label:e,value:t,detail:n}){return(0,R.jsxs)(`div`,{className:`structure-figure`,children:[(0,R.jsx)(`dt`,{children:e}),(0,R.jsxs)(`dd`,{children:[(0,R.jsx)(`span`,{className:`structure-figure-value`,children:t??`—`}),(0,R.jsx)(`span`,{className:`structure-figure-detail`,children:t===null?`Not read`:n})]})]})}function Br({figures:e}){let{graphs:t,siteEntities:n,rich:r}=e,i=(0,M.useId)();return(0,R.jsxs)(`section`,{className:`structure-intro`,"aria-labelledby":i,children:[(0,R.jsx)(`h2`,{id:i,className:`structure-intro-title`,children:`One graph per page, assembled from four scopes`}),(0,R.jsxs)(`dl`,{className:`structure-figures`,children:[(0,R.jsx)($,{label:`Pages with a valid graph`,value:t?`${t.valid} / ${t.pages}`:null,detail:`Live pages no search engine's rules find an error in`}),(0,R.jsx)($,{label:`Site entities`,value:n===null?null:String(n),detail:`In every page's graph, from the site's SEO settings`}),(0,R.jsx)($,{label:`Eligible rich results`,value:r?`${r.eligible} / ${r.applicable}`:null,detail:`Features of live pages, by the search engines' rules`})]})]})}var Vr=`The live pages' findings could not be read`;function Hr(){let[e,t]=(0,M.useState)({state:`loading`}),n=(0,M.useRef)(!0),r=(0,M.useCallback)(async()=>{try{let e=await wt();return n.current&&t({state:`ready`,data:e}),e}catch(e){return n.current&&t({state:`error`,message:v(e,Vr)}),null}},[]);return(0,M.useEffect)(()=>(n.current=!0,r(),()=>{n.current=!1}),[r]),{findings:e,read:r}}function Ur(){let[e,t]=(0,M.useState)(0),n=(0,M.useCallback)(()=>t(e=>e+1),[]),{loaded:r,reload:i}=D(Ct,`Structure could not be read`),{findings:a,read:o}=Hr();return{base:r,findings:a,validate:(0,M.useCallback)(async()=>{let e=await o();return n(),e},[o,n]),reloadBase:(0,M.useCallback)(()=>{i(),o(),n()},[i,o,n]),revision:e}}var Wr=`fill`;function Gr({tab:e,...t}){switch(e){case`graph`:return(0,R.jsx)(wn,{...t});case`scopes`:return(0,R.jsx)(Fr,{...t});case`rich-results`:return(0,R.jsx)(Hn,{...t});case`crawlers`:return(0,R.jsx)(Mt,{...t})}}function Kr({message:e,onRetry:t}){return(0,R.jsx)(`div`,{role:`alert`,children:(0,R.jsx)(w,{icon:f,title:`Structure could not load`,action:(0,R.jsx)(S,{icon:ne,onClick:t,children:`Try again`}),children:e})})}function qr(){let[e,t]=p(),[n,r]=(0,M.useState)(!1);return(0,M.useEffect)(()=>{e.get(Wr)!==null&&(r(!0),t(e=>{let t=new URLSearchParams(e);return t.delete(Wr),t},{replace:!0}))},[e,t]),[n,r]}function Jr(e){return e.state===`failed`?{text:`Fill what's missing failed: ${e.message}`,tone:`error`}:{text:`Fill what's missing finished. Open it to see what each step filled.`}}function Yr(e){let t=Me(),n=_(),r=(0,M.useCallback)(e=>Oe(e,e=>n(Jr(e))),[n]),i=t.state===`running`,a=(0,M.useRef)(i);return(0,M.useEffect)(()=>{a.current&&!i&&e(),a.current=i},[i,e]),{run:t,start:r}}function Xr(e){let{tab:t,state:n}=e,r=(0,M.useId)(),i=(0,M.useCallback)(e=>`${r}-tab-${e}`,[r]);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ve,{label:`Structure`,tabs:pe,current:t,tabId:i,panelId:`${r}-panel`}),(0,R.jsxs)(`div`,{id:`${r}-panel`,role:`tabpanel`,"aria-labelledby":i(t),className:`structure-panel`,children:[n.base.state===`loading`&&(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading Structure…`}),n.base.state===`error`&&(0,R.jsx)(Kr,{message:n.base.message,onRetry:n.reloadBase}),n.base.state===`ready`&&(0,R.jsx)(Gr,{tab:t,base:n.base.data,state:n,admin:e.admin})]})]})}function Zr({tab:e}){let t=Ur(),n=oe().hasRole(`admin`),[r,i]=qr(),a=Yr(t.reloadBase),o=(0,M.useCallback)(()=>{i(!1),Ae()},[i]),s=t.base.state===`ready`?t.base.data:null,c=(0,M.useMemo)(()=>Fn(s,t.findings),[s,t.findings]);return(0,R.jsxs)(`div`,{className:`structure`,"aria-busy":t.base.state===`loading`,children:[(0,R.jsx)(zr,{siteName:s?.site.site.name??null,fill:a.run,validate:t.validate,onFill:s?()=>i(!0):null,fillBlocker:n?null:`Enrichment is run by an admin.`}),(0,R.jsx)(Br,{figures:c}),(0,R.jsx)(Xr,{tab:e,state:t,admin:n}),r&&s&&(0,R.jsx)(Ft,{collections:s.collections.filter(e=>e.pages),admin:n,run:a.run,onStart:a.start,onClose:o})]})}export{Zr as StructurePage};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphBrowser-Cm5q82MJ.js","assets/rolldown-runtime-COiEfhsA.js","assets/save-ClSXW9cb.js","assets/createLucideIcon-BklFHeMd.js","assets/vendor-diff-DGCTJYJ4.js","assets/createLucideIcon-DO6kYgVn.css","assets/upload-CaqQJaUr.js","assets/graph-config-CgXhm7XP.js","assets/use-loaded-BNCu0C-c.js","assets/index-d5j-az5g.js","assets/vendor-react-CXaWJ_ii.js","assets/vendor-react-DLioOiRN.css","assets/vendor-router-B4czwg8X.js","assets/auth-CIpilSKF.js","assets/format-C3ZX9yGM.js","assets/api-client-BRi_ki2Y.js","assets/index-Buq8auz3.css","assets/copy-V85khWct.js","assets/corner-down-right-BpwOGRFR.js","assets/findability-BrhtZ2yD.js","assets/layers-0VWe0rKm.js","assets/guards-BFEDbduR.js","assets/graph-config-mZyX0Lqo.css","assets/catalog-offer-CeRRk2Zo.js","assets/circle-check-big-DQjpuxcC.js","assets/circle-x-peGpq98w.js","assets/trash-DzRCm500.js","assets/export-helpers-C_HVpJN9.js","assets/triangle-exclamation-point-ttN5lZI0.js","assets/external-link-Dh7p8Ii6.js","assets/GraphBrowser-U_-D112C.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,i as c,m as l,n as u,o as d,p as ee,t as te,y as ne}from"./api-seo-DeG5gsh6.js";import{t as f}from"./triangle-exclamation-point-ttN5lZI0.js";import{a as re,o as ie,s as ae}from"./vendor-diff-DGCTJYJ4.js";import{r as p,t as m}from"./vendor-router-B4czwg8X.js";import{i as oe}from"./auth-CIpilSKF.js";import{D as se,G as ce,Ot as le,V as ue,a as de,c as h,ct as fe,d as g,et as _,f as v,l as pe,pt as me,s as y,st as he,wt as b,xt as ge,yt as _e}from"./index-d5j-az5g.js";import{i as x,n as S,t as C}from"./createLucideIcon-BklFHeMd.js";import{t as w}from"./empty-state-CeUZocHx.js";import{i as ve,n as ye,r as be,t as xe}from"./fill-run-view-ChrOLoV4.js";import{t as T}from"./external-link-Dh7p8Ii6.js";import{n as Se,t as E}from"./format-C3ZX9yGM.js";import{n as Ce}from"./guards-BFEDbduR.js";import{t as D}from"./use-loaded-BNCu0C-c.js";import{t as we}from"./data-table-B1kqxrEw.js";import{t as Te}from"./rotate-ccw-BgARBEK3.js";import{t as Ee}from"./save-ClSXW9cb.js";import{t as O}from"./action-button-DIrhqMRc.js";import{t as De}from"./source-CGZGd3Xy.js";import{a as Oe,c as ke,i as Ae,o as je,s as Me,u as k}from"./fill-job-CKtHKXwV.js";import{C as Ne,D as A,E as j,S as Pe,c as Fe,d as Ie,i as Le,n as Re,s as ze,u as Be,w as Ve,x as He}from"./graph-config-CgXhm7XP.js";import{a as Ue,i as We,n as Ge,t as Ke}from"./export-helpers-C_HVpJN9.js";import{t as qe}from"./pen-line-B524Nue8.js";import{t as Je}from"./vendor-reactflow-CMKi7AEX.js";import{a as Ye,r as Xe}from"./findability-BrhtZ2yD.js";import{t as Ze}from"./layers-0VWe0rKm.js";import{t as Qe}from"./circle-dashed-cuYrILNo.js";import{t as $e}from"./circle-x-peGpq98w.js";import{n as et,t as tt}from"./catalog-offer-CeRRk2Zo.js";import{t as nt}from"./arrow-down-B5kfR2lG.js";import{t as rt}from"./info-Cxkabti5.js";import{t as it}from"./list-checks-BCEhMMVY.js";var at={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};at.node;var ot=C(at),st={name:`file-search`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]};st.node;var ct=C(st),lt={name:`sparkle`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}]]};lt.node;var ut=C(lt),dt={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};dt.node;var ft=C(dt),M=e(ae(),1);function N(e){return e.status>=200&&e.status<300}async function P(e){try{let t=await fetch(e,{credentials:`omit`,cache:`no-store`});return{path:e,status:t.status,text:await t.text()}}catch{return{path:e,status:0,text:``}}}function F(e){return e.status===0?`The site did not answer at ${e.path}.`:e.status===404?`The site serves nothing at ${e.path} (HTTP 404).`:`The site answered ${e.path} with HTTP ${e.status}.`}function I(e,t){return e.getElementsByTagNameNS(`*`,t)[0]?.textContent?.trim()||void 0}function pt(e){let t=new DOMParser().parseFromString(e,`application/xml`);return t.getElementsByTagName(`parsererror`).length>0||t.documentElement.localName!==`urlset`?null:[...t.getElementsByTagNameNS(`*`,`url`)].flatMap(e=>{let t=I(e,`loc`);return t?[{loc:t,lastmod:I(e,`lastmod`),changefreq:I(e,`changefreq`),priority:I(e,`priority`)}]:[]})}function L(e,t){return N(e)?e.text.trimEnd()===t.trimEnd()?`krantho`:`own`:`none`}function mt(e,t){return e===null?`krantho's own llms.txt could not be read, so where this one comes from could not be determined.`:e===`own`?`Written by the site's own /llms.txt route, not by krantho: it differs from what krantho's API builds, and Studio does not change it.`:t===`snapshot`?`Served from krantho's API: the snapshot saved through the assistant, until another is saved.`:t===`generated`?`Served from krantho's API, built from the live pages on each request: the site's name, the site entity's description as its summary, then each collection with pages and a link per live, indexable page with its description.`:`Served from krantho's API, which did not say how it made it: its origin could not be determined.`}function ht(e){switch(e){case`krantho`:return`The site serves this at /robots.txt.`;case`own`:return`The site's /robots.txt is answered by its own route, so what is saved here does not reach it.`;case`none`:return`The site serves no /robots.txt: route it to /api/seo/robots.txt to serve this.`}}async function gt(){let e=await P(`/sitemap.xml`);return N(e)?{served:e,entries:pt(e.text),krantho:null}:{served:e,entries:null,krantho:await ee().then(e=>e.urls,()=>null)}}async function _t(){let[e,t,r,i,a]=await Promise.all([gt(),P(`/robots.txt`),n(),P(`/llms.txt`),c().catch(()=>null)]);return{sitemap:e,robots:{served:t,krantho:r},llms:{served:i,krantho:a}}}var R=ie();function z({title:e,lead:t,aside:n,id:r,children:i}){let a=(0,M.useId)();return(0,R.jsxs)(`section`,{id:r,className:`structure-card`,"aria-labelledby":a,children:[(0,R.jsxs)(`div`,{className:`structure-card-head`,children:[(0,R.jsx)(`h3`,{id:a,className:`structure-card-title`,children:e}),n]}),t&&(0,R.jsx)(`p`,{className:`structure-note`,children:t}),i]})}function B({types:e}){return e.length===0?(0,R.jsx)(`span`,{className:`structure-muted`,children:`None set`}):(0,R.jsx)(`span`,{className:`structure-chips`,children:e.map(e=>(0,R.jsx)(y,{children:e},e))})}function vt(e,t,n,r){return e?t?`Saving…`:r===`save`&&!n?`Change the text first.`:null:`robots.txt is changed by an admin.`}function yt(e){let t=_(),[n,r]=(0,M.useState)(null);async function i(n,i){r(n);try{t({text:await i()}),e()}catch(e){t({text:v(e,`robots.txt could not be saved`),tone:`error`})}finally{r(null)}}return{busy:n,save:e=>void i(`save`,async()=>(await o(e),`Override saved. /api/seo/robots.txt now serves it.`)),reset:()=>void i(`reset`,async()=>await s()?`Override removed. krantho generates robots.txt again.`:`There was no override: krantho already generates robots.txt.`)}}function bt(e){let[t,n]=(0,M.useState)(e),[r,i]=(0,M.useState)(e);return r!==e&&(i(e),n(e)),[t,n]}function xt(e){let{busy:t,save:n,reset:r}=yt(e.onSaved),i=e.draft!==e.served;return(0,R.jsxs)(`div`,{className:`structure-actions`,children:[(0,R.jsx)(O,{variant:`primary`,icon:Ee,reason:vt(e.admin,t,i,`save`),onClick:()=>n(e.draft),children:t===`save`?`Saving…`:`Save`}),(0,R.jsx)(O,{icon:Te,reason:vt(e.admin,t,i,`reset`),onClick:r,children:t===`reset`?`Resetting…`:`Reset`})]})}function St({robots:e,site:t,admin:n,onSaved:r}){let[i,a]=bt(e.krantho),o=(0,M.useId)(),s=l(t);return(0,R.jsxs)(z,{title:`robots.txt`,lead:`${s?`The override saved in Studio`:`Generated by krantho: every crawler allowed, the sitemap named`}. ${ht(L(e.served,e.krantho))}`,children:[(0,R.jsxs)(`div`,{className:`structure-row`,children:[(0,R.jsx)(`label`,{htmlFor:o,className:`structure-label`,children:`robots.txt`}),(0,R.jsx)(y,{tone:s?`accent`:`neutral`,children:s?`Override`:`Generated`})]}),(0,R.jsx)(`textarea`,{id:o,className:`structure-textarea`,rows:8,spellCheck:!1,value:i,readOnly:!n,onChange:e=>a(e.target.value)}),(0,R.jsx)(xt,{draft:i,served:e.krantho,admin:n,onSaved:r})]})}async function Ct(){let[e,t,n,i]=await Promise.all([se(),ue(),De(!0,r),De(!0,d)]);return{site:e,collections:t,configs:n,catalog:i}}function wt(){return a()}function V(e,t){return e.find(e=>e.id===t)??null}function H(e,t){return e.filter(e=>e.scope===t)}function Tt(e){return e.state===`ok`?new Set(e.value.types.filter(e=>e.siteLevel).map(e=>e.type)):new Set}function Et(e){if(e.state!==`ok`)return new Set;let t=e.value.types.filter(e=>e.siteLevel&&!e.documentLevel);return new Set(t.map(e=>e.type))}var Dt=[{id:`loc`,header:`URL`,primary:!0,cell:e=>{let t=Ce(e.loc);return t?(0,R.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[e.loc,(0,R.jsx)(`span`,{className:`visually-hidden`,children:` (opens in a new tab)`})]}):e.loc}},{id:`lastmod`,header:`Last modified`,cell:e=>e.lastmod?`${Se(e.lastmod)} UTC`:`—`},{id:`changefreq`,header:`Change frequency`,cell:e=>e.changefreq??`—`},{id:`priority`,header:`Priority`,numeric:!0,cell:e=>e.priority??`—`}];function Ot({entries:e,caption:t}){return e.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`It lists no URL.`}):(0,R.jsx)(we,{caption:t,columns:Dt,rows:e,rowKey:e=>e.loc})}var kt=e=>e.map(e=>({...e}));function At({sitemap:e}){let{served:t,entries:n,krantho:r}=e;return N(t)?(0,R.jsx)(z,{title:`Sitemap`,lead:`As the site serves it at /sitemap.xml${n?`: ${n.length} URL${n.length===1?``:`s`}`:``}. krantho lists every live, indexable page of the collections with pages.`,children:n?(0,R.jsx)(Ot,{entries:n,caption:`Sitemap as served`}):(0,R.jsx)(`p`,{className:`structure-note`,children:`What the site serves at /sitemap.xml is not a sitemap.`})}):(0,R.jsx)(z,{title:`Sitemap`,lead:`${F(t)} What krantho's API builds at /api/seo/sitemap from the live pages:`,children:r?(0,R.jsx)(Ot,{entries:kt(r),caption:`Sitemap krantho builds`}):(0,R.jsx)(`p`,{className:`structure-note`,children:`krantho's sitemap could not be read either.`})})}function jt({llms:e}){let{served:t,krantho:n}=e;if(!N(t))return(0,R.jsx)(z,{title:`llms.txt`,lead:`${F(t)} krantho's API serves one at /api/seo/llms.txt; route /llms.txt to it to serve it.`});let r=n?L(t,n.text):null;return(0,R.jsxs)(z,{title:`llms.txt`,lead:(0,R.jsxs)(R.Fragment,{children:[`As the site serves it at /llms.txt, read-only.`,` `,mt(r,n?.origin??null)]}),children:[(0,R.jsx)(`section`,{className:`structure-text`,tabIndex:0,"aria-label":`llms.txt as served`,children:(0,R.jsx)(`pre`,{children:t.text})}),(0,R.jsxs)(`a`,{href:`/llms.txt`,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[`Open /llms.txt`,(0,R.jsx)(T,{"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`visually-hidden`,children:` (opens in a new tab)`})]})]})}function Mt({base:e,admin:t,state:n}){let r=(0,M.useCallback)(()=>_t(),[]),{loaded:i,reload:a}=D(r,`What crawlers read could not be read`),o=e.configs.state===`ok`?V(e.configs.value,`site`):null,s=(0,M.useCallback)(()=>{a(),n.reloadBase()},[a,n]);return i.state===`loading`?(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading what the site serves…`}):i.state===`error`?(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,children:i.message}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`structure-tab-lead`,children:`What search engines and assistants fetch from the site's own addresses, read as they read them.`}),(0,R.jsx)(At,{sitemap:i.data.sitemap}),(0,R.jsx)(St,{robots:i.data.robots,site:o?.config??null,admin:t,onSaved:s}),(0,R.jsx)(jt,{llms:i.data.llms})]})}function Nt({provider:e,reason:t}){return e===`missing`?(0,R.jsxs)(`p`,{className:`structure-note`,children:[`No language model is set up. Set one up in`,` `,(0,R.jsx)(m,{to:ge,children:`Setup › AI provider`}),`.`]}):t?(0,R.jsx)(`p`,{className:`structure-note`,children:t}):null}function Pt(){return(0,R.jsxs)(`p`,{className:`structure-modal-lead`,children:[`Fills what is `,(0,R.jsx)(`em`,{children:`missing`}),` — meta descriptions and the Schema.org properties no one has set — with the language model set up in Setup › AI provider. It never overwrites a value someone set. What it fills is saved to each document at once: the meta description as a new version and in the document's SEO settings, the Schema.org properties in those settings. The SEO settings have no versions, so the structured data on the live pages — and the meta descriptions the site reads from them first — change straight away.`]})}function Ft({collections:e,admin:t,run:n,onStart:r,onClose:i}){let[a,o]=(0,M.useState)({scope:`all`}),s=Be(),c=n.state===`running`,l=c?`Enrichment is running.`:be(t,s);return(0,R.jsxs)(g,{title:`Fill what's missing`,onClose:i,actions:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(S,{onClick:i,children:c?`Close (it keeps running)`:`Close`}),(0,R.jsx)(O,{variant:`primary`,icon:k,reason:l,onClick:()=>r(a),children:`Fill what's missing`})]}),children:[(0,R.jsx)(Pt,{}),(0,R.jsx)(ye,{collections:e,value:a,disabled:c,onChange:o}),!c&&(0,R.jsx)(Nt,{provider:s,reason:l}),(0,R.jsx)(xe,{run:n})]})}var It=e(Je(),1);function Lt(e){return{width:e.length*7+12,height:16}}function Rt(e){let t=new It.default.graphlib.Graph({multigraph:!0});t.setGraph({rankdir:`LR`,nodesep:28,ranksep:96,marginx:16,marginy:16}),t.setDefaultEdgeLabel(()=>({}));for(let n of e.nodes)t.setNode(n.key,{width:216,height:96});return e.edges.forEach((e,n)=>{t.setEdge(e.from,e.to,{...Lt(e.property),labelpos:`c`},`e${n}`)}),t}function zt(e){let t=Rt(e);It.default.layout(t);let n=e.nodes.map(e=>{let n=t.node(e.key);return{key:e.key,x:n?.x??0,y:n?.y??0}}),r=e.edges.map((e,n)=>{let r=t.edge({v:e.from,w:e.to,name:`e${n}`}),i=r?.points??[],a=i[Math.floor(i.length/2)]??{x:0,y:0};return{key:`e${n}`,property:e.property,points:i,labelX:r?.x??a.x,labelY:r?.y??a.y}}),i=t.graph();return{width:i.width??0,height:i.height??0,nodes:n,edges:r}}var U={site:{label:`site`,meaning:`A site entity: every page states it`},collection:{label:`collection`,meaning:`From the collection's archetype`},route:{label:`URL pattern`,meaning:`From a URL pattern's override`},document:{label:`document`,meaning:`From this page's own SEO settings`},derived:{label:`derived`,meaning:`Composed by krantho for the page: no scope sets it`}};function Bt(e,t,n){let r=t=>e.find(e=>e.id===t)?.config??null;return{document:r(`doc:${t}/${n}`),collection:r(`collection:${t}`),routes:e.filter(e=>e.scope===`route`).map(e=>e.config)}}var W=(e,t)=>e?.entities.some(e=>e[`@type`]===t)??!1;function Vt(e,t,n){return e.scope===`site`?`site`:t?W(n.document,e.type)?`document`:n.routes.some(t=>W(t,e.type))?`route`:W(n.collection,e.type)?`collection`:`derived`:`derived`}function Ht(e,t,n){return e.filter(e=>e.nodeId&&t?e.nodeId===t:e.type===n)}function Ut(e,t,n,r){let i=t.id!==``&&r.resolved.some(e=>e.id===t.id),a=Ht(r.features,t.id,t.type);return{key:t.id||`node-${n}`,id:t.id,type:Ne(e[`@type`])??t.type,kind:Vt(t,i,r.scopes),propertyCount:t.rows.length,features:a,missing:[...new Set(a.flatMap(e=>e.missing))],view:t}}function Wt(e,t){let n=new Map(e.filter(e=>e.id).map(e=>[e.id,e.key])),r=[];return t.forEach((t,i)=>{let a=e[i]?.key;if(a){for(let[e,i]of Object.entries(t))if(!e.startsWith(`@`))for(let t of Fe(i)){let i=n.get(t);i&&i!==a&&r.push({from:a,to:i,property:e})}}}),r}function Gt(e){let t=ze({nodes:e.nodes,resolved:e.resolved,siteTypes:e.siteTypes}),n=e.nodes.flatMap((n,r)=>{let i=t[r];return i?[Ut(n,i,r,e)]:[]});return{nodes:n,edges:Wt(n,e.nodes)}}function Kt(e){let t=new Set(e.nodes.map(e=>e.kind)),n=[`site`,`collection`,`document`,`derived`];return Object.keys(U).filter(e=>n.includes(e)||t.has(e))}function qt(e,t){let n=new Map(e.nodes.map(e=>[e.key,e.type])),r=e.edges.filter(e=>e.from===t).map(e=>`${e.property} → ${n.get(e.to)??e.to}`);return[...new Set(r)]}var Jt={site:j,collection:Ze,route:Ve,document:Ye,derived:ut};function Yt(e){return e===1?`1 property`:`${e} properties`}function Xt(e){if(e.features.length===0)return null;let t=[...new Set(e.features.map(e=>e.feature))].join(`, `),n=e.features.every(e=>e.eligible),r=e.features.every(e=>e.eligible||e.status===`restricted`);return{text:`${t}${n?``:r?` · on conditions`:` · not eligible`}`,eligible:n}}function G({kind:e}){let t=Jt[e];return(0,R.jsxs)(`span`,{className:h(`neutral`,`structure-kind`),title:U[e].meaning,children:[(0,R.jsx)(t,{className:`ui-chip-icon`,"aria-hidden":`true`}),U[e].label]})}function Zt({node:e}){let t=Xt(e);return(0,R.jsxs)(`span`,{className:`structure-node-chips`,children:[(0,R.jsx)(`span`,{className:h(`neutral`),children:Yt(e.propertyCount)}),t&&(0,R.jsxs)(`span`,{className:h(t.eligible?`success`:`warning`),children:[t.eligible?(0,R.jsx)(me,{className:`ui-chip-icon`,"aria-hidden":`true`}):(0,R.jsx)(A,{className:`ui-chip-icon`,"aria-hidden":`true`}),t.text]}),e.missing.length>0&&(0,R.jsxs)(`span`,{className:h(`danger`),children:[(0,R.jsx)(f,{className:`ui-chip-icon`,"aria-hidden":`true`}),e.missing.length,` missing`]})]})}function Qt({node:e}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`structure-node-head`,children:[(0,R.jsx)(`span`,{className:`structure-node-type`,children:e.type}),(0,R.jsx)(G,{kind:e.kind})]}),(0,R.jsx)(`code`,{className:`structure-node-id`,title:e.id||void 0,children:e.id?Pe(e.id):`no @id`}),(0,R.jsx)(Zt,{node:e})]})}function $t(e){return e.map((e,t)=>`${t===0?`M`:`L`}${e.x},${e.y}`).join(` `)}function en({edge:e,marker:t}){return(0,R.jsxs)(`g`,{children:[(0,R.jsx)(`path`,{d:$t(e.points),className:`structure-canvas-edge`,markerEnd:`url(#${t})`}),(0,R.jsx)(`text`,{x:e.labelX,y:e.labelY,className:`structure-canvas-label`,textAnchor:`middle`,dominantBaseline:`middle`,children:e.property})]})}function tn(e){let t=(0,M.useId)();return(0,R.jsxs)(`svg`,{className:`structure-canvas-edges`,width:e.width,height:e.height,"aria-hidden":`true`,children:[(0,R.jsx)(`defs`,{children:(0,R.jsx)(`marker`,{id:t,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`8`,markerHeight:`8`,orient:`auto`,children:(0,R.jsx)(`path`,{d:`M0,0 L8,4 L0,8 z`,className:`structure-canvas-arrow`})})}),e.edges.map(e=>(0,R.jsx)(en,{edge:e,marker:t},e.key))]})}function nn({node:e,links:t,x:n,y:r,selected:i,onSelect:a}){return(0,R.jsxs)(`button`,{type:`button`,className:`structure-node structure-node--canvas`,"data-kind":e.kind,"aria-pressed":i,style:{left:n-108,top:r-48,width:216,height:96},onClick:()=>a(e.key),children:[(0,R.jsx)(Qt,{node:e}),t.length>0&&(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[`Links: `,t.join(`; `)]})]})}function rn({graph:e,selected:t,onSelect:n}){let r=(0,M.useMemo)(()=>zt(e),[e]),i=new Map(e.nodes.map(e=>[e.key,e]));return(0,R.jsx)(`section`,{className:`structure-canvas`,"aria-label":`Graph canvas`,tabIndex:0,children:(0,R.jsxs)(`div`,{className:`structure-canvas-stage`,style:{width:r.width,height:r.height},children:[(0,R.jsx)(tn,{edges:r.edges,width:r.width,height:r.height}),r.nodes.map(r=>{let a=i.get(r.key);return a?(0,R.jsx)(nn,{node:a,links:qt(e,r.key),x:r.x,y:r.y,selected:t===r.key,onSelect:n},r.key):null})]})})}function an({graph:e,selected:t,onSelect:n}){return(0,R.jsx)(`ul`,{className:`structure-graph-list`,"aria-label":`Graph nodes`,children:e.nodes.map(r=>{let i=qt(e,r.key);return(0,R.jsxs)(`li`,{className:`structure-graph-item`,children:[(0,R.jsx)(`button`,{type:`button`,className:`structure-node structure-node--list`,"data-kind":r.kind,"aria-pressed":t===r.key,onClick:()=>n(r.key),children:(0,R.jsx)(Qt,{node:r})}),i.length>0&&(0,R.jsx)(`ul`,{className:`structure-graph-links`,"aria-label":`Links of ${r.type}`,children:i.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsx)(`code`,{children:e})},e))})]},r.key)})})}function on(e){let{node:t,collection:n,slug:r}=e;return t.kind===`site`?le(`site`):b(n,r)}function sn(e){switch(e.node.kind){case`site`:return`Every page states it. Its values are set in Scopes & archetypes › Site entities, or come from the site section of krantho.config.ts.`;case`collection`:return`Its type comes from the collection's archetype; its values from the page's fields and the SEO settings. Set a value for this page in its Data mode.`;case`route`:return`Its type comes from a URL pattern's override. Set a value for this page in its Data mode.`;case`document`:return`Its type comes from this page's own SEO settings, which its Data mode edits.`;case`derived`:return`krantho composes it for the page from what the page states (its address, its trail, its dates). Change those, not this node.`}}function cn({feature:e,props:t}){return(0,R.jsxs)(`li`,{className:`structure-missing`,children:[(0,R.jsx)(f,{className:`structure-missing-icon`,"aria-hidden":`true`}),(0,R.jsxs)(`span`,{className:`structure-missing-text`,children:[t.readerName(e.reader),`'s `,e.feature,` needs`,` `,e.missing.map((e,t)=>(0,R.jsxs)(`span`,{children:[t>0&&`, `,(0,R.jsx)(`code`,{children:e})]},e)),`.`,` `,(0,R.jsxs)(`a`,{href:e.source,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[`The rule `,(0,R.jsx)(`span`,{className:`visually-hidden`,children:`(opens in a new tab)`})]})]}),(0,R.jsxs)(m,{to:on(t),className:x(`secondary`,`sm`),children:[(0,R.jsx)(ft,{className:`ui-button-icon`,"aria-hidden":`true`}),`Fix `,(0,R.jsx)(`span`,{className:`visually-hidden`,children:e.feature})]})]})}function ln(e){let{node:t}=e,n=t.features.filter(e=>e.missing.length>0),r=[...new Set(t.features.flatMap(e=>e.conditions))];return(0,R.jsxs)(`section`,{className:`structure-card structure-node-card`,"aria-label":`Selected node: ${t.type}`,children:[(0,R.jsxs)(`div`,{className:`structure-card-head`,children:[(0,R.jsx)(`h3`,{className:`structure-card-title`,children:`Selected node`}),(0,R.jsx)(G,{kind:t.kind})]}),n.length>0&&(0,R.jsx)(`ul`,{className:`structure-missing-list`,"aria-label":`Missing requirements`,children:n.map(t=>(0,R.jsx)(cn,{feature:t,props:e},`${t.reader}:${t.feature}`))}),(0,R.jsxs)(`p`,{className:`structure-note`,children:[U[t.kind].meaning,`. `,sn(e)]}),r.map(e=>(0,R.jsxs)(`p`,{className:`structure-note`,children:[`Shown on a condition: `,e,`.`]},e)),(0,R.jsx)(Le,{views:[t.view]})]})}function un(e){let t=new DOMParser().parseFromString(e,`text/html`),n=[],r=0;for(let e of t.querySelectorAll(`script[type="application/ld+json"]`))try{n.push(JSON.parse(e.textContent??``))}catch{r++}return{scripts:n,nodes:n.flatMap(Re),unreadable:r}}function dn(e){return e.scripts.length===1?e.scripts[0]:e.scripts}async function fn(e){let{page:t}=e,[n,r]=await Promise.all([P(t.path),i(t.collection,t.slug)]);if(!N(n))return{state:`unserved`,reason:F(n)};let a=un(n.text);return a.nodes.length===0?{state:`unserved`,reason:`The page at ${t.path} serves no JSON-LD.`}:{state:`served`,served:a,graph:Gt({nodes:a.nodes,resolved:r.entities,siteTypes:e.siteTypes,scopes:Bt(e.configs,t.collection,t.slug),features:t.features})}}function pn(e,t){let n=(0,M.useRef)(e);(0,M.useLayoutEffect)(()=>{n.current=e});let r=`${e.page.collection}/${e.page.slug}`,i=(0,M.useCallback)(()=>fn(n.current),[r]),{loaded:a,reload:o}=D(i,`The page could not be read`),s=(0,M.useRef)(t);return(0,M.useEffect)(()=>{s.current!==t&&(s.current=t,o())},[t,o]),a}var mn=`(min-width: 1200px)`,hn=`page`,K=e=>`${e.collection}/${e.slug}`;function gn(e){let[t,n]=p(),r=t.get(hn);return[e.find(e=>K(e)===r)??e[0]??null,e=>{n(t=>{let n=new URLSearchParams(t);return n.set(hn,e),n},{replace:!0})}]}function _n({pages:e,value:t,onChange:n}){let r=(0,M.useId)();return(0,R.jsxs)(`div`,{className:`structure-field`,children:[(0,R.jsx)(`label`,{htmlFor:r,children:`Page`}),(0,R.jsx)(`select`,{id:r,className:`structure-select`,value:t,onChange:e=>n(e.target.value),children:e.map(e=>(0,R.jsxs)(`option`,{value:K(e),children:[e.path,` · `,K(e)]},K(e)))})]})}function vn({graph:e}){return(0,R.jsx)(`ul`,{className:`structure-legend`,"aria-label":`Where each node comes from`,children:Kt(e).map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(G,{kind:e}),(0,R.jsx)(`span`,{className:`structure-legend-text`,children:U[e].meaning})]},e))})}function yn(e){return e.nodes.find(e=>e.kind!==`site`&&e.kind!==`derived`)??e.nodes[0]??null}function bn({page:e,served:t}){function n(){let n=We(e.collection,e.slug);Ke(Ge(dn(t)),n,`application/ld+json`)}return(0,R.jsxs)(`div`,{className:`structure-actions`,children:[(0,R.jsx)(S,{size:`sm`,icon:Ue,onClick:n,children:`Export JSON-LD`}),(0,R.jsxs)(m,{to:b(e.collection,e.slug),className:x(`secondary`,`sm`),children:[(0,R.jsx)(qe,{className:`ui-button-icon`,"aria-hidden":`true`}),`Edit or import in Data mode`]})]})}function xn({page:e,served:t,graph:n,readerName:r}){let i=_e(mn),[a,o]=(0,M.useState)(null),s=n.nodes.find(e=>e.key===a)??yn(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`structure-row`,children:[(0,R.jsx)(vn,{graph:n}),(0,R.jsx)(bn,{page:e,served:t})]}),(0,R.jsx)(i?rn:an,{graph:n,selected:s?.key??null,onSelect:o}),s&&(0,R.jsx)(ln,{node:s,collection:e.collection,slug:e.slug,readerName:r}),t.unreadable>0&&(0,R.jsxs)(`p`,{className:`structure-note`,children:[t.unreadable,` JSON-LD script`,t.unreadable===1?` is`:`s are`,` not valid JSON: search engines skip `,t.unreadable===1?`it`:`them`,`.`]}),(0,R.jsxs)(`details`,{className:`structure-disclosure`,children:[(0,R.jsx)(`summary`,{children:`What the page emits · view-source`}),(0,R.jsx)(Ie,{data:dn(t),label:`application/ld+json · ${e.path}`})]})]})}function Sn({target:e,revision:t,readerName:n}){let r=pn(e,t);return r.state===`loading`?(0,R.jsxs)(`p`,{className:`structure-note`,children:[`Reading `,e.page.path,` as served…`]}):r.state===`error`?(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,children:r.message}):r.data.state===`unserved`?(0,R.jsx)(w,{icon:ct,title:`The page could not be read as served`,children:r.data.reason}):(0,R.jsx)(xn,{page:e.page,served:r.data.served,graph:r.data.graph,readerName:n},`${e.page.collection}/${e.page.slug}`)}function Cn({findings:e,configs:t,siteTypes:n,revision:r}){let[i,a]=gn(e.pages),o=t=>e.readers.find(e=>e.id===t)?.name??t,s=(0,M.useMemo)(()=>i?{page:i,configs:t,siteTypes:n}:null,[i,t,n]);return!i||!s?(0,R.jsx)(w,{icon:he,title:`No live pages yet`,children:`The graph is read from the pages the site serves. Publish a page to see its graph.`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`structure-tab-lead`,children:`A live page's graph as the site serves it, in the default locale. Each node's values carry their source; its rich results follow the search engines' rules.`}),(0,R.jsx)(_n,{pages:e.pages,value:K(i),onChange:a}),(0,R.jsx)(Sn,{target:s,revision:r,readerName:o})]})}function wn({base:e,state:t}){let n=e.configs.state===`ok`?e.configs.value:[],r=(0,M.useMemo)(()=>Tt(e.catalog),[e.catalog]),{findings:i}=t;return i.state===`loading`?(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading the live pages…`}):i.state===`error`?(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,children:i.message}):(0,R.jsx)(Cn,{findings:i.data,configs:n,siteTypes:r,revision:t.revision})}var q=`google`;function Tn(e){return{collection:e.collection,slug:e.slug,path:e.path}}function En(e,t){return e.find(e=>e.id===t)?.name??t}function Dn(e,t){return{pages:new Map,card:{key:`${e.reader}:${e.feature}`,reader:e.reader,readerName:En(t,e.reader),feature:e.feature,status:e.status,applicable:0,eligible:0,missing:[],conditions:[...e.conditions],source:e.source,types:[e.type]}}}function On(e,t,n,r){let i=r.has(t.type);for(let r of t.missing){let a=e.missing.find(e=>e.property===r&&e.type===t.type);if(!a){let o=i?le(`site`):b(n.collection,n.slug);a={property:r,type:t.type,pages:[],fix:o,site:i},e.missing.push(a)}a.pages.some(e=>e.collection===n.collection&&e.slug===n.slug)||a.pages.push(Tn(n))}}function kn(e,t,n){let r=new Map;for(let i of e)for(let e of i.features){let a=`${e.reader}:${e.feature}`,o=r.get(a)??Dn(e,t);r.set(a,o),o.card.types.includes(e.type)||o.card.types.push(e.type);let s=`${i.collection}/${i.slug}`;o.pages.set(s,(o.pages.get(s)??!1)||e.eligible),On(o.card,e,i,n)}return r}function An(e,t,n){if(n.some(e=>e.id===q))for(let r of t){let t=r.richResultStatus;if(!r.richResult||t!==`active`&&t!==`restricted`)continue;let i=`${q}:${r.richResult}`,a=e.get(i);if(a){a.pages.size===0&&!a.card.types.includes(r.type)&&a.card.types.push(r.type);continue}let o={reader:q,feature:r.richResult,type:r.type,status:t,eligible:!1,missing:[],conditions:[],source:r.docsUrl};e.set(i,Dn(o,n))}}function jn(e,t,n,r=[]){let i=kn(e,t,n);An(i,r,t);let a=e=>{let n=t.findIndex(t=>t.id===e.reader);return n<0?t.length:n},o=e=>+(e.applicable===0);return[...i.values()].map(({card:e,pages:t})=>({...e,applicable:t.size,eligible:[...t.values()].filter(Boolean).length})).sort((e,t)=>a(e)-a(t)||o(e)-o(t)||e.feature.localeCompare(t.feature))}function Mn(e){return e.reduce((e,t)=>({eligible:e.eligible+t.eligible,applicable:e.applicable+t.applicable}),{eligible:0,applicable:0})}function Nn(e){return e.status===`restricted`?`conditional`:e.applicable===0?`unused`:e.eligible===e.applicable?`eligible`:e.eligible===0?`not-eligible`:`partly`}function Pn(e){return e?.configs.state===`ok`?V(e.configs.value,`site`)?.config.entities.length??0:null}function Fn(e,t){let n=Pn(e);if(t.state!==`ready`)return{graphs:null,siteEntities:n,rich:null};let{pages:r,readers:i}=t.data,a=jn(r,i,Et(e?.catalog??{state:`failed`}));return{graphs:{valid:r.filter(Xe).length,pages:r.length},siteEntities:n,rich:Mn(a)}}function In(e){return e.catalog.state===`ok`?e.catalog.value:null}var Ln={eligible:{label:`Eligible`,tone:`success`,icon:me},partly:{label:`Partly eligible`,tone:`warning`,icon:A},"not-eligible":{label:`Not eligible`,tone:`danger`,icon:$e},conditional:{label:`Shown on conditions`,tone:`neutral`,icon:Qe},unused:{label:`Not used yet`,tone:`neutral`,icon:ot}};function Rn(e){let t=e.pages.slice(0,3).map(e=>e.path),n=e.pages.length-t.length;return`${t.join(`, `)}${n>0?` and ${n} more`:``}`}function zn({line:e,feature:t}){let n=e.site?`in Site entities`:`on ${e.pages[0]?.path??`the page`}`;return(0,R.jsxs)(`li`,{className:`structure-missing`,children:[(0,R.jsxs)(`span`,{className:`structure-missing-text`,children:[(0,R.jsxs)(`code`,{children:[e.type,`.`,e.property]}),` `,`missing on `,e.pages.length,` page`,e.pages.length===1?``:`s`,`: `,Rn(e),e.site&&` — a site entity, so one value fixes every page`]}),(0,R.jsxs)(m,{to:e.fix,className:x(`secondary`,`sm`),children:[(0,R.jsx)(ft,{className:`ui-button-icon`,"aria-hidden":`true`}),`Fix`,` `,(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[t,`: `,e.property,` `,n]})]})]})}function Bn({card:e}){if(e.applicable===0){let t=e.types.length>0?` (${e.types.join(` or `)})`:``;return(0,R.jsxs)(`p`,{className:`structure-note`,children:[`No page of this site is of this type yet`,t,`.`]})}return e.missing.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`Nothing is missing.`}):(0,R.jsx)(`ul`,{className:`structure-missing-list`,"aria-label":`What ${e.feature} is missing`,children:e.missing.map(t=>(0,R.jsx)(zn,{line:t,feature:e.feature},`${t.type}.${t.property}`))})}function Vn({card:e}){let t=(0,M.useId)(),n=Ln[Nn(e)];return(0,R.jsxs)(`section`,{className:`structure-card structure-rich-card`,"aria-labelledby":t,children:[(0,R.jsxs)(`div`,{className:`structure-card-head`,children:[(0,R.jsxs)(`h3`,{id:t,className:`structure-card-title`,children:[e.feature,` `,(0,R.jsxs)(`span`,{className:`structure-card-sub`,children:[`· `,e.readerName]})]}),(0,R.jsx)(y,{tone:n.tone,icon:n.icon,children:n.label})]}),(0,R.jsxs)(`p`,{className:`structure-rich-count`,children:[(0,R.jsxs)(`span`,{className:`structure-figure-value`,children:[e.eligible,` / `,e.applicable]}),` `,`live page`,e.applicable===1?``:`s`,` eligible`,e.status===`restricted`&&`: shown only under the rule's conditions`]}),e.conditions.map(e=>(0,R.jsxs)(`p`,{className:`structure-note`,children:[`Condition: `,e,`.`]},e)),(0,R.jsx)(Bn,{card:e}),(0,R.jsxs)(`a`,{href:e.source,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[e.readerName,`'s rule`,(0,R.jsx)(T,{"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`visually-hidden`,children:` (opens in a new tab)`})]})]})}function Hn({base:e,state:t}){let{findings:n}=t,r=(0,M.useMemo)(()=>Et(e.catalog),[e.catalog]),i=In(e),a=(0,M.useMemo)(()=>n.state===`ready`?jn(n.data.pages,n.data.readers,r,i?.types):[],[n,r,i]);return n.state===`loading`?(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading the live pages…`}):n.state===`error`?(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,children:n.message}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`structure-tab-lead`,children:`The features the search engines still show, by their own rules, checked on every live page in the default locale. A page is eligible when its entity has everything the rule requires.`}),a.length===0?(0,R.jsx)(w,{icon:k,title:`No rich result to show`,children:`The search engines' rules, as krantho reads them, list no feature they still show.`}):(0,R.jsx)(`div`,{className:`structure-rich-grid`,children:a.map(e=>(0,R.jsx)(Vn,{card:e},e.key))})]})}var Un=e=>e.map(e=>`${e.entityType}.${e.property}`).join(`, `);function Wn({doc:e,collection:t}){return(0,R.jsxs)(`li`,{children:[(0,R.jsx)(m,{to:b(t,e.slug),className:`structure-link`,children:e.title||e.slug}),e.orphanedProperties.length>0&&(0,R.jsxs)(`span`,{children:[` · unused: `,Un(e.orphanedProperties)]}),e.missingRequired.length>0&&(0,R.jsxs)(`span`,{children:[` · missing: `,Un(e.missingRequired)]})]})}function Gn({impact:e,collection:t}){if(e.affectedDocuments.length===0)return(0,R.jsx)(`p`,{children:`No page of the collection would lose a value or lack a required one.`});let{summary:n}=e;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{children:[`Of `,e.totalDocuments,` pages, `,n.documentsWithOrphans,` would keep values no chosen type reads, and `,n.documentsWithMissingRequired,` would lack values a chosen type requires:`]}),(0,R.jsx)(`ul`,{className:`structure-impact-list`,children:e.affectedDocuments.map(e=>(0,R.jsx)(Wn,{doc:e,collection:t},e.slug))})]})}function Kn({impact:e,collection:t}){return(0,R.jsxs)(`div`,{className:`structure-impact`,"aria-live":`polite`,children:[(0,R.jsx)(`h3`,{className:`structure-label`,children:`What the change does to the pages`}),e.state===`idle`&&(0,R.jsx)(`p`,{children:`Change the types to see which pages it touches.`}),e.state===`reading`&&(0,R.jsx)(`p`,{children:`Checking the collection's pages…`}),e.state===`error`&&(0,R.jsx)(`p`,{children:`The impact could not be read.`}),e.state===`ready`&&(0,R.jsx)(Gn,{impact:e.impact,collection:t})]})}function qn(e){if(e.state!==`ok`)return null;let t=e.value;return{siteEntities:V(t,`site`)?.config.entities.length??0,collections:H(t,`collection`).length,routes:H(t,`route`).length,documents:H(t,`document`).length}}function Jn(e){let t=e=>e||null;return[{label:`Name`,value:e.name,setting:`site.name`},{label:`Domain`,value:e.domain,setting:`site.domain`},{label:`Base URL`,value:e.baseUrl,setting:`site.baseUrl`},{label:`Language`,value:e.language,setting:`site.language`},{label:`Description`,value:t(e.description),setting:`site.description`},{label:`Alternate name`,value:t(e.alternateName),setting:`site.alternateName`},{label:`Logo`,value:t(e.logo),setting:`site.logo`},{label:`Profiles elsewhere`,value:e.sameAs.length>0?e.sameAs.join(`, `):null,setting:`site.sameAs`}]}var J=`The stored settings could not be read; reload before changing them.`;function Yn(e,t){return e.state===`ok`?{state:`read`,config:V(e.value,t)?.config??null}:{state:`unread`}}function Xn(e,t){return e.filter(e=>e.pages).map(e=>{let n=Yn(t,`collection:${e.name}`);return{collection:e,stored:n,types:n.state===`read`?n.config?.entities.map(e=>e[`@type`])??[]:null}})}function Zn(e,t){let n=e?.entities??[],r=t.map(e=>n.find(t=>t[`@type`]===e)??{"@type":e,properties:{}});return{...e??{},entities:r}}function Y(e,t){let n=[];for(let r of t){let t=n.find(e=>e.category===r.category);t||(t={category:r.category,label:e.categories[r.category]??r.category,types:[]},n.push(t)),t.types.push(r)}return n}function Qn(e){return Y(e,e.types.filter(e=>e.richResultStatus!==`retired`))}function $n(e,t){return Y(e,e.types.filter(e=>e.documentLevel&&et(e,t.has(e.type))))}function er(e,t,n){let[r,i]=(0,M.useState)({state:`idle`}),a=t.join(`,`);return(0,M.useEffect)(()=>{if(!n||a===``){i({state:`idle`});return}let t=!0;return i({state:`reading`}),u(e,a).then(e=>t&&i({state:`ready`,impact:e}),()=>t&&i({state:`error`})),()=>{t=!1}},[e,a,n]),r}var tr=new Set([`status`,`locale`,`slug`,`version`,`source`,`changedBy`,`createdAt`,`updatedAt`]);function nr(e){let[t,n]=(0,M.useState)(null);return(0,M.useEffect)(()=>{let t=!0;return ce(e).then(e=>{let r=Object.keys(e.schema.properties??{});t&&n(r.filter(e=>!tr.has(e)))},()=>t&&n(null)),()=>{t=!1}},[e]),t}function rr(e){let t=tt(e);if(t===`retired`)return`No longer shown in search results`;let n=e.richResult??`No search feature`;return t?`${n} · ${t}`:n}function ir(e){let{type:t}=e;return(0,R.jsxs)(`div`,{className:`structure-type-option`,children:[(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:e.checked,onChange:()=>e.onToggle(t.type)}),(0,R.jsx)(`span`,{className:`structure-type-name`,children:t.label}),(0,R.jsx)(`span`,{className:`structure-type-rich`,children:rr(t)})]}),t.docsUrl&&(0,R.jsxs)(`a`,{href:t.docsUrl,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[`Docs`,(0,R.jsx)(T,{"aria-hidden":`true`}),(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[` for `,t.label,` (opens in a new tab)`]})]})]})}function ar(e){return(0,R.jsx)(`div`,{className:`structure-type-picker`,children:$n(e.catalog,e.chosen).map(t=>(0,R.jsxs)(`fieldset`,{className:`structure-type-group`,children:[(0,R.jsx)(`legend`,{children:t.label}),t.types.map(t=>(0,R.jsx)(ir,{type:t,checked:e.chosen.has(t.type),onToggle:e.onToggle},t.type))]},t.category))})}function or(e){let[t,n]=(0,M.useState)(()=>new Set(e)),r=[...t],i=r.length!==e.length||r.some(t=>!e.includes(t));function a(e){n(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})}return{chosen:t,types:r,changed:i,toggle:a}}function sr(e){let[n,r]=(0,M.useState)(!1),i=_(),a=e.row.collection.name;async function o(n){let{stored:o}=e.row;if(o.state!==`read`)i({text:J,tone:`error`});else{r(!0);try{await t(`collection:${a}`,Zn(o.config,n));let r=E(a);i({text:`${r}'s archetype saved. Its pages' structured data has changed.`}),e.onSaved(),e.onClose()}catch(e){i({text:v(e,`The archetype could not be saved`),tone:`error`}),r(!1)}}}return{saving:n,save:e=>void o(e)}}function cr(e){let t=e.row.collection.name,{chosen:n,types:r,changed:i,toggle:a}=or(e.row.types??[]),{saving:o,save:s}=sr(e),c=er(t,r,i),l=nr(t),u=o?`Saving…`:i?null:`Change the types first.`,d=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(S,{onClick:e.onClose,children:`Cancel`}),(0,R.jsx)(O,{variant:`primary`,reason:u,onClick:()=>s(r),children:o?`Saving…`:`Save`})]});return(0,R.jsxs)(g,{title:`Change ${E(t)}'s archetype`,onClose:e.onClose,busy:o,actions:d,children:[(0,R.jsxs)(`p`,{className:`structure-modal-lead`,children:[`The Schema.org types every page of `,E(t),` states. They are saved to the collection's SEO settings, which have no versions: its pages' structured data changes at once. A page's own settings still win.`]}),l&&l.length>0&&(0,R.jsxs)(`p`,{className:`structure-note`,children:[`The types' properties can be filled from its fields: `,l.join(`, `),`.`]}),(0,R.jsx)(ar,{catalog:e.catalog,chosen:n,onToggle:a}),(0,R.jsx)(Kn,{impact:c,collection:t})]})}var X=(e,t,n)=>`${e} ${e===1?t:n}`,lr=[{id:`site`,title:`Site`,says:`Who the site is`,icon:j,count:e=>X(e.siteEntities,`site entity`,`site entities`)},{id:`collection`,title:`Collection`,says:`What kind of page`,icon:Ze,count:e=>X(e.collections,`collection archetype`,`collection archetypes`)},{id:`route`,title:`URL pattern`,says:`Overrides by route`,icon:Ve,count:e=>X(e.routes,`URL pattern`,`URL patterns`)},{id:`document`,title:`Document`,says:`One page's own say, which wins over everything above`,icon:Ye,count:e=>X(e.documents,`page with its own settings`,`pages with their own settings`)}],ur=e=>`cascade-${e}`,Z=e=>`scope-${e}`;function dr({step:e,next:t,counts:n}){let r=e.icon;return(0,R.jsxs)(`li`,{id:ur(e.id),className:`structure-cascade-step`,children:[(0,R.jsx)(`span`,{className:`structure-cascade-icon`,"aria-hidden":`true`,children:(0,R.jsx)(r,{})}),(0,R.jsx)(`span`,{className:`structure-cascade-title`,children:(0,R.jsx)(`a`,{href:`#${Z(e.id)}`,className:`structure-link`,children:e.title})}),(0,R.jsx)(`span`,{className:`structure-cascade-says`,children:e.says}),(0,R.jsx)(`span`,{className:`structure-cascade-count`,children:n?e.count(n):`Not read`}),t&&(0,R.jsxs)(`a`,{href:`#${ur(t.id)}`,className:`structure-cascade-next`,children:[(0,R.jsx)(nt,{"aria-hidden":`true`}),`Then: `,t.title]})]})}function fr({counts:e}){let t=(0,M.useId)();return(0,R.jsxs)(`section`,{className:`structure-cascade`,"aria-labelledby":t,children:[(0,R.jsx)(`h3`,{id:t,className:`structure-card-title`,children:`Four scopes, the narrowest wins`}),(0,R.jsx)(`ol`,{className:`structure-cascade-steps`,children:lr.map((t,n)=>(0,R.jsx)(dr,{step:t,next:lr[n+1],counts:e},t.id))}),(0,R.jsx)(`p`,{className:`structure-note`,children:`Site and collection are seeded from krantho.config.ts when the site starts; edits made here persist.`})]})}function pr(e,t,n){return e?n.state===`ok`?t?null:`The catalog could not be read.`:J:`Archetypes are changed by an admin.`}function mr(e,t){return[{id:`collection`,header:`Collection`,primary:!0,cell:e=>E(e.collection.name)},{id:`path`,header:`Renders at`,cell:e=>(0,R.jsx)(`code`,{children:de(e.collection)??`—`})},{id:`types`,header:`Schema.org types`,cell:e=>e.types?(0,R.jsx)(B,{types:e.types}):(0,R.jsx)(`span`,{className:`structure-muted`,children:`Not read`})},{id:`change`,header:`Change`,cell:n=>(0,R.jsxs)(O,{size:`sm`,icon:qe,reason:t,onClick:()=>e(n),children:[`Change`,` `,(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[E(n.collection.name),`'s archetype`]})]})}]}function hr(e){let{collections:t,configs:n,catalog:r,admin:i,onSaved:a}=e,[o,s]=(0,M.useState)(null),c=(0,M.useMemo)(()=>Xn(t,n),[t,n]),l=pr(i,r,n);return(0,R.jsxs)(z,{id:Z(`collection`),title:`Collection archetypes`,lead:`What kind of page each collection's documents are. Seeded from krantho.config.ts (seo.collections) when the site starts; a change here persists.`,children:[(0,R.jsx)(we,{caption:`Collection archetypes`,columns:mr(s,l),rows:c,rowKey:e=>e.collection.name}),o&&r&&(0,R.jsx)(cr,{row:o,catalog:r,onClose:()=>s(null),onSaved:a})]})}var gr=(0,M.lazy)(()=>re(()=>import(`./GraphBrowser-Cm5q82MJ.js`).then(e=>({default:e.GraphBrowser})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30])));function _r({site:e}){return(0,R.jsx)(z,{title:`From krantho.config.ts`,lead:`The site's identity is code: every site entity reads it. Studio shows it; change it where it is set.`,children:(0,R.jsx)(`dl`,{className:`structure-identity`,children:Jn(e).map(e=>(0,R.jsxs)(`div`,{className:`structure-identity-row`,children:[(0,R.jsx)(`dt`,{children:e.label}),(0,R.jsxs)(`dd`,{children:[(0,R.jsxs)(`span`,{className:`structure-identity-value`,children:[(0,R.jsx)(fe,{"aria-hidden":`true`}),e.value??(0,R.jsx)(`span`,{className:`structure-muted`,children:`Not set`})]}),(0,R.jsxs)(`span`,{className:`structure-identity-where`,children:[`Change it in krantho.config.ts (`,(0,R.jsx)(`code`,{children:e.setting}),`)`]})]})]},e.setting))})})}function vr(e){return{"@context":`https://schema.org`,"@graph":e.entities.map(e=>({"@type":e[`@type`],...e[`@id`]?{"@id":e[`@id`]}:{},...e.properties}))}}function yr(e){let[t,n]=(0,M.useState)(new Map),r=e.entities.map(e=>e[`@type`]).join(`,`);return(0,M.useEffect)(()=>{let e=!0;return Promise.allSettled(r.split(`,`).filter(Boolean).map(te)).then(t=>{let r=new Map;for(let e of t)e.status===`fulfilled`&&r.set(e.value.type.type,e.value);e&&n(r)}),()=>{e=!1}},[r]),t}function br(e){let n=_();return(0,M.useCallback)(async r=>{try{await t(`site`,r),n({text:`Site entities saved. Every page's structured data has changed.`}),e()}catch(e){throw n({text:v(e,`The site entities could not be saved`),tone:`error`}),e}},[n,e])}var xr={entities:[]};function Sr(e,t){return t?J:e?`Kept in the site's SEO settings, which have no versions: Save changes every page's structured data at once.`:`Kept in the site's SEO settings. Changing them is for admins: here they are browsed and exported.`}function Cr({stored:e,catalogTypes:t,admin:n,onSaved:r}){let i=e.state===`read`?e.config??xr:xr,a=e.state!==`read`,o=n&&!a,s=(0,M.useMemo)(()=>vr(i),[i]),c=(0,M.useMemo)(()=>He(s),[s]),l=yr(i),u=(0,M.useMemo)(()=>new Set(i.entities.map(e=>e[`@type`])),[i]),d=br(r);return(0,R.jsx)(z,{title:`Site entities`,lead:Sr(n,a),children:!a&&(0,R.jsx)(M.Suspense,{fallback:(0,R.jsx)(`p`,{className:`structure-note`,children:`Loading the graph browser…`}),children:(0,R.jsx)(gr,{model:c,catalogTypes:t,catalogDetails:l,rawData:s,configData:o?i:void 0,onSave:o?d:void 0,siteLevelTypeSet:u})})})}function wr(e){let[t,n]=(0,M.useState)({state:`loading`});return(0,M.useEffect)(()=>{let t=!0;return te(e).then(e=>t&&n({state:`ready`,detail:e}),()=>t&&n({state:`error`})),()=>{t=!1}},[e]),t}function Tr({detail:e}){return e.properties.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`The catalog lists no property for it.`}):(0,R.jsxs)(`table`,{className:`structure-table`,children:[(0,R.jsxs)(`caption`,{className:`visually-hidden`,children:[`The properties of `,e.type.label]}),(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{scope:`col`,children:`Property`}),(0,R.jsx)(`th`,{scope:`col`,children:`Importance`}),(0,R.jsx)(`th`,{scope:`col`,children:`Filled from`})]})}),(0,R.jsx)(`tbody`,{children:e.properties.map(e=>(0,R.jsxs)(`tr`,{children:[(0,R.jsxs)(`th`,{scope:`row`,children:[(0,R.jsx)(`code`,{children:e.property}),e.hint&&(0,R.jsxs)(`span`,{className:`structure-muted`,children:[` · `,e.hint]})]}),(0,R.jsx)(`td`,{children:e.importance}),(0,R.jsx)(`td`,{children:e.autoMapField?(0,R.jsx)(`code`,{children:e.autoMapField}):e.source})]},e.property))})]})}var Q=e=>(e??[]).join(`, `);function Er({rule:e}){return(0,R.jsxs)(`li`,{className:`structure-rule`,children:[(0,R.jsx)(`strong`,{children:e.readerName}),` · `,e.feature??`No search feature`,` ·`,` `,e.status===`restricted`?`shown only under conditions`:e.status===`active`?`shown`:`no search feature`,(e.required?.length??0)>0&&(0,R.jsxs)(`span`,{children:[` · requires `,Q(e.required)]}),e.oneOf?.map(e=>(0,R.jsxs)(`span`,{children:[` · one of `,Q(e)]},e.join())),(e.recommended?.length??0)>0&&(0,R.jsxs)(`span`,{children:[` · recommends `,Q(e.recommended)]}),e.conditions?.map(e=>(0,R.jsxs)(`span`,{children:[` · `,e]},e)),` `,(0,R.jsxs)(`a`,{href:e.source,target:`_blank`,rel:`noreferrer`,className:`structure-link`,children:[`Source, verified `,e.verifiedAt,(0,R.jsx)(T,{"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`visually-hidden`,children:` (opens in a new tab)`})]})]})}function Dr({type:e,onClose:t}){let n=wr(e),r=n.state===`ready`?n.detail.rules.filter(e=>e.status!==`retired`):[];return(0,R.jsxs)(g,{title:n.state===`ready`?n.detail.type.label:e,onClose:t,actions:(0,R.jsx)(S,{onClick:t,children:`Close`}),children:[n.state===`loading`&&(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading the type…`}),n.state===`error`&&(0,R.jsx)(`p`,{className:`structure-note`,children:`The type could not be read.`}),n.state===`ready`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`structure-modal-lead`,children:n.detail.type.description}),(0,R.jsx)(`h3`,{className:`structure-label`,children:`Properties`}),(0,R.jsx)(Tr,{detail:n.detail}),(0,R.jsx)(`h3`,{className:`structure-label`,children:`The search engines' rules`}),r.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`No active search engine has a rule for it beyond Schema.org.`}):(0,R.jsx)(`ul`,{className:`structure-rules`,children:r.map(e=>(0,R.jsx)(Er,{rule:e},e.reader))})]})]})}function Or(e){return!e.richResult||e.richResultStatus===`none`?`No search feature`:e.richResultStatus===`restricted`?`${e.richResult} · shown only under conditions`:e.richResult}function kr(e){return e.siteLevel&&e.documentLevel?`site or page`:e.siteLevel?`site`:`page`}function Ar({type:e,onDetail:t}){return(0,R.jsxs)(`li`,{className:`structure-catalog-type`,children:[(0,R.jsx)(`span`,{className:`structure-type-name`,children:e.label}),(0,R.jsx)(y,{children:kr(e)}),(0,R.jsx)(`span`,{className:`structure-type-rich`,children:Or(e)}),(0,R.jsxs)(S,{size:`sm`,variant:`ghost`,icon:rt,onClick:()=>t(e.type),children:[`Details `,(0,R.jsxs)(`span`,{className:`visually-hidden`,children:[`of `,e.label]})]})]})}function jr({catalog:e}){let[t,n]=(0,M.useState)(null);return(0,R.jsxs)(z,{id:`scope-catalog`,title:`The catalog`,lead:`The Schema.org types krantho composes, by what they describe; each with the search feature it can appear in by the search engines' rules.`,children:[Qn(e).map(e=>(0,R.jsxs)(`div`,{className:`structure-catalog-group`,children:[(0,R.jsx)(`h4`,{className:`structure-label`,children:e.label}),(0,R.jsx)(`ul`,{className:`structure-catalog-types`,children:e.types.map(e=>(0,R.jsx)(Ar,{type:e,onDetail:n},e.type))})]},e.category)),t&&(0,R.jsx)(Dr,{type:t,onClose:()=>n(null)})]})}var Mr=e=>e.config.entities.map(e=>e[`@type`]);function Nr({configs:e}){let t=H(e,`route`);return(0,R.jsx)(z,{id:Z(`route`),title:`URL patterns`,lead:`Overrides for the pages whose address matches a pattern; the most specific pattern wins. Seeded from krantho.config.ts (seo.routes).`,children:t.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`No URL pattern has its own types.`}):(0,R.jsx)(`ul`,{className:`structure-scope-list`,children:t.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`code`,{children:e.id.replace(/^route:/,``)}),(0,R.jsx)(B,{types:Mr(e)})]},e.id))})})}function Pr({configs:e}){let t=H(e,`document`);return(0,R.jsx)(z,{id:Z(`document`),title:`Pages with their own settings`,lead:`One page's own say, which wins over everything above. A page's settings are edited in its Data mode.`,children:t.length===0?(0,R.jsx)(`p`,{className:`structure-note`,children:`No page has settings of its own.`}):(0,R.jsx)(`ul`,{className:`structure-scope-list`,children:t.map(e=>{let[t=``,n=``]=e.id.replace(/^doc:/,``).split(`/`);return(0,R.jsxs)(`li`,{children:[(0,R.jsxs)(m,{to:b(t,n),className:`structure-link`,children:[t,`/`,n]}),(0,R.jsx)(B,{types:Mr(e)})]},e.id)})})})}function Fr({base:e,admin:t,state:n}){let r=e.configs.state===`ok`?e.configs.value:[],i=In(e);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(fr,{counts:qn(e.configs)}),e.configs.state!==`ok`&&(0,R.jsx)(`p`,{className:`structure-note structure-note--error`,role:`alert`,children:`The SEO settings could not be read. Nothing stored can be changed until they are: reload the page.`}),(0,R.jsxs)(`div`,{id:Z(`site`),className:`structure-stack`,children:[(0,R.jsx)(_r,{site:e.site.site}),(0,R.jsx)(Cr,{stored:Yn(e.configs,`site`),catalogTypes:i?.types??[],admin:t,onSaved:n.reloadBase})]}),(0,R.jsx)(hr,{collections:e.collections,configs:e.configs,catalog:i,admin:t,onSaved:n.reloadBase}),(0,R.jsx)(Nr,{configs:r}),(0,R.jsx)(Pr,{configs:r}),i&&(0,R.jsx)(jr,{catalog:i})]})}function Ir(e){return`${e} live page${e===1?``:`s`}`}function Lr({validate:e}){let t=_(),[n,r]=(0,M.useState)(!1);async function i(){r(!0);let n=await e();if(r(!1),!n){t({text:`The live pages' findings could not be read.`,tone:`error`});return}let i=n.pages.filter(Xe).length;t({text:`Validated ${Ir(n.pages.length)}: ${i} with a valid graph.`})}return(0,R.jsx)(S,{icon:it,"aria-disabled":n,onClick:n?void 0:()=>void i(),children:n?`Validating…`:`Validate all pages`})}function Rr({fill:e}){return e.state===`running`?(0,R.jsxs)(`p`,{className:`structure-note`,children:[`Filling… `,je(e.plan,e.step),` (`,ke[e.step],`). Open Fill what's missing to follow it.`]}):null}function zr(e){let t=e.siteName??`the site`;return(0,R.jsxs)(`header`,{className:`structure-header`,children:[(0,R.jsxs)(`div`,{className:`structure-header-text`,children:[(0,R.jsx)(`h1`,{className:`structure-title`,children:`Structure`}),(0,R.jsxs)(`p`,{className:`structure-lead`,children:[`How search engines and AI assistants read `,t,`. Every page carries one connected Schema.org graph — no one writes JSON-LD by hand.`]}),(0,R.jsx)(`div`,{role:`status`,children:(0,R.jsx)(Rr,{fill:e.fill})})]}),(0,R.jsxs)(`div`,{className:`structure-actions`,children:[(0,R.jsx)(Lr,{validate:e.validate}),(0,R.jsx)(O,{variant:`primary`,icon:k,reason:e.onFill?e.fillBlocker:`Reading the site…`,onClick:()=>e.onFill?.(),children:`Fill what's missing`})]})]})}function $({label:e,value:t,detail:n}){return(0,R.jsxs)(`div`,{className:`structure-figure`,children:[(0,R.jsx)(`dt`,{children:e}),(0,R.jsxs)(`dd`,{children:[(0,R.jsx)(`span`,{className:`structure-figure-value`,children:t??`—`}),(0,R.jsx)(`span`,{className:`structure-figure-detail`,children:t===null?`Not read`:n})]})]})}function Br({figures:e}){let{graphs:t,siteEntities:n,rich:r}=e,i=(0,M.useId)();return(0,R.jsxs)(`section`,{className:`structure-intro`,"aria-labelledby":i,children:[(0,R.jsx)(`h2`,{id:i,className:`structure-intro-title`,children:`One graph per page, assembled from four scopes`}),(0,R.jsxs)(`dl`,{className:`structure-figures`,children:[(0,R.jsx)($,{label:`Pages with a valid graph`,value:t?`${t.valid} / ${t.pages}`:null,detail:`Live pages no search engine's rules find an error in`}),(0,R.jsx)($,{label:`Site entities`,value:n===null?null:String(n),detail:`In every page's graph, from the site's SEO settings`}),(0,R.jsx)($,{label:`Eligible rich results`,value:r?`${r.eligible} / ${r.applicable}`:null,detail:`Features of live pages, by the search engines' rules`})]})]})}var Vr=`The live pages' findings could not be read`;function Hr(){let[e,t]=(0,M.useState)({state:`loading`}),n=(0,M.useRef)(!0),r=(0,M.useCallback)(async()=>{try{let e=await wt();return n.current&&t({state:`ready`,data:e}),e}catch(e){return n.current&&t({state:`error`,message:v(e,Vr)}),null}},[]);return(0,M.useEffect)(()=>(n.current=!0,r(),()=>{n.current=!1}),[r]),{findings:e,read:r}}function Ur(){let[e,t]=(0,M.useState)(0),n=(0,M.useCallback)(()=>t(e=>e+1),[]),{loaded:r,reload:i}=D(Ct,`Structure could not be read`),{findings:a,read:o}=Hr();return{base:r,findings:a,validate:(0,M.useCallback)(async()=>{let e=await o();return n(),e},[o,n]),reloadBase:(0,M.useCallback)(()=>{i(),o(),n()},[i,o,n]),revision:e}}var Wr=`fill`;function Gr({tab:e,...t}){switch(e){case`graph`:return(0,R.jsx)(wn,{...t});case`scopes`:return(0,R.jsx)(Fr,{...t});case`rich-results`:return(0,R.jsx)(Hn,{...t});case`crawlers`:return(0,R.jsx)(Mt,{...t})}}function Kr({message:e,onRetry:t}){return(0,R.jsx)(`div`,{role:`alert`,children:(0,R.jsx)(w,{icon:f,title:`Structure could not load`,action:(0,R.jsx)(S,{icon:ne,onClick:t,children:`Try again`}),children:e})})}function qr(){let[e,t]=p(),[n,r]=(0,M.useState)(!1);return(0,M.useEffect)(()=>{e.get(Wr)!==null&&(r(!0),t(e=>{let t=new URLSearchParams(e);return t.delete(Wr),t},{replace:!0}))},[e,t]),[n,r]}function Jr(e){return e.state===`failed`?{text:`Fill what's missing failed: ${e.message}`,tone:`error`}:{text:`Fill what's missing finished. Open it to see what each step filled.`}}function Yr(e){let t=Me(),n=_(),r=(0,M.useCallback)(e=>Oe(e,e=>n(Jr(e))),[n]),i=t.state===`running`,a=(0,M.useRef)(i);return(0,M.useEffect)(()=>{a.current&&!i&&e(),a.current=i},[i,e]),{run:t,start:r}}function Xr(e){let{tab:t,state:n}=e,r=(0,M.useId)(),i=(0,M.useCallback)(e=>`${r}-tab-${e}`,[r]);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ve,{label:`Structure`,tabs:pe,current:t,tabId:i,panelId:`${r}-panel`}),(0,R.jsxs)(`div`,{id:`${r}-panel`,role:`tabpanel`,"aria-labelledby":i(t),className:`structure-panel`,children:[n.base.state===`loading`&&(0,R.jsx)(`p`,{className:`structure-note`,children:`Reading Structure…`}),n.base.state===`error`&&(0,R.jsx)(Kr,{message:n.base.message,onRetry:n.reloadBase}),n.base.state===`ready`&&(0,R.jsx)(Gr,{tab:t,base:n.base.data,state:n,admin:e.admin})]})]})}function Zr({tab:e}){let t=Ur(),n=oe().hasRole(`admin`),[r,i]=qr(),a=Yr(t.reloadBase),o=(0,M.useCallback)(()=>{i(!1),Ae()},[i]),s=t.base.state===`ready`?t.base.data:null,c=(0,M.useMemo)(()=>Fn(s,t.findings),[s,t.findings]);return(0,R.jsxs)(`div`,{className:`structure`,"aria-busy":t.base.state===`loading`,children:[(0,R.jsx)(zr,{siteName:s?.site.site.name??null,fill:a.run,validate:t.validate,onFill:s?()=>i(!0):null,fillBlocker:n?null:`Enrichment is run by an admin.`}),(0,R.jsx)(Br,{figures:c}),(0,R.jsx)(Xr,{tab:e,state:t,admin:n}),r&&s&&(0,R.jsx)(Ft,{collections:s.collections.filter(e=>e.pages),admin:n,run:a.run,onStart:a.start,onClose:o})]})}export{Zr as StructurePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{o as t,s as n}from"./vendor-diff-DGCTJYJ4.js";import{n as r,t as i}from"./createLucideIcon-BklFHeMd.js";import{t as a}from"./upload-CaqQJaUr.js";import{F as o,I as s,L as c,N as l,T as u,c as d,s as f}from"./media-model-D4F1Farw.js";import{et as p,f as m,mt as h}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{o as t,s as n}from"./vendor-diff-DGCTJYJ4.js";import{n as r,t as i}from"./createLucideIcon-BklFHeMd.js";import{t as a}from"./upload-CaqQJaUr.js";import{F as o,I as s,L as c,N as l,T as u,c as d,s as f}from"./media-model-D4F1Farw.js";import{et as p,f as m,mt as h}from"./index-d5j-az5g.js";import{t as g}from"./action-button-DIrhqMRc.js";var _={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};_.node;var v=i(_),y={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};y.node;var b=i(y),x={name:`crop`,size:24,node:[[`path`,{d:`M6 2v14a2 2 0 0 0 2 2h14`,key:`ron5a4`}],[`path`,{d:`M18 22V8a2 2 0 0 0-2-2H2`,key:`7s9ehn`}]]};x.node;var S=i(x),C={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};C.node;var w=i(C),T={name:`image-up`,size:24,node:[[`path`,{d:`M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21`,key:`9csbqa`}],[`path`,{d:`m14 19.5 3-3 3 3`,key:`9vmjn0`}],[`path`,{d:`M17 22v-5.5`,key:`1aa6fl`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};T.node;var E=i(T),D=e(n(),1),O=t();async function k(e,t){let n=[],r=[];for(let[i,a]of e.entries()){t({state:`uploading`,done:i,total:e.length,name:a.name});try{n.push(await c(a))}catch(e){r.push({name:a.name,error:m(e,`Upload failed`)})}}return t({state:`finished`,uploaded:n.length}),{uploaded:n,failures:r}}function A(e){return e.state===`uploading`?`Uploading ${e.done+1} of ${e.total}: ${e.name}…`:e.state===`finished`?`Uploaded ${d(e.uploaded)}.`:e.state===`refused`?`Your role cannot upload files.`:``}function j(e){let[t,n]=(0,D.useState)({state:`idle`}),[r,i]=(0,D.useState)([]),a=t.state===`uploading`;function o(t){a||t.length===0||(i([]),k(t,n).then(t=>{i(t.failures),t.uploaded.length>0&&e(t.uploaded)}))}return{progress:t,failures:r,start:o,refuse:()=>n({state:`refused`})}}function M(e,t){let[n,r]=(0,D.useState)(!1);return{over:n,handlers:{onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),t||r(!0))},onDragLeave:()=>r(!1),onDrop:t=>{t.preventDefault(),r(!1),e([...t.dataTransfer.files])}}}}function N({progress:e,failures:t}){return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`media-drop-progress`,role:`status`,children:A(e)}),(0,O.jsx)(`ul`,{className:`media-drop-failures`,role:`alert`,children:t.map(e=>(0,O.jsxs)(`li`,{children:[e.name,`: `,e.error]},e.name))})]})}function P({onUploaded:e,blocked:t,multiple:n=!0}){let r=(0,D.useRef)(null),{progress:i,failures:o,start:s,refuse:c}=j(e),{over:l,handlers:u}=M(e=>t?c():s(e),t!==null),d=n?`Choose files`:`Choose a file`;return(0,O.jsxs)(`section`,{className:`media-drop${l?` media-drop--over`:``}`,"aria-label":`Upload`,...u,children:[(0,O.jsx)(a,{className:`media-drop-icon`,"aria-hidden":`true`}),(0,O.jsx)(`p`,{children:n?`Drop images here, or`:`Drop an image here, or`}),(0,O.jsx)(`input`,{ref:r,type:`file`,accept:`image/*`,multiple:n,hidden:!0,"aria-label":d,onChange:e=>{s([...e.target.files??[]]),e.target.value=``}}),(0,O.jsx)(g,{size:`sm`,reason:t,onClick:()=>r.current?.click(),children:d}),(0,O.jsx)(N,{progress:i,failures:o})]})}function F({page:e,count:t,onPage:n}){return t<=1?null:(0,O.jsxs)(`nav`,{className:`media-pages`,"aria-label":`Pages`,children:[(0,O.jsx)(r,{size:`sm`,variant:`ghost`,icon:b,disabled:e===0,onClick:()=>n(e-1),children:`Previous`}),(0,O.jsxs)(`span`,{className:`media-pages-where`,children:[`Page `,e+1,` of `,t]}),(0,O.jsx)(r,{size:`sm`,variant:`ghost`,icon:h,disabled:e>=t-1,onClick:()=>n(e+1),children:`Next`})]})}function I(e,t,n,r){let[i,a]=(0,D.useState)(!1),o=(0,D.useRef)(!1),s=p();async function c(...i){if(!o.current){o.current=!0,a(!0);try{let n=await e(...i);s({text:t(n)}),r(n)}catch(e){s({text:m(e,n),tone:`error`})}finally{o.current=!1,a(!1)}}}return{busy:i,run:c}}function L(e,t){return I(t=>s(e.id,{altText:t.altText,tags:t.tags,...t.filename===e.filename?{}:{filename:t.filename}}),()=>`Saved on the media file.`,`The file could not be saved`,t)}function R(e,t){return I(t=>s(e.id,{altText:t}),()=>`Alt text saved on the media file.`,`The alt text could not be saved`,t)}function z(e,t){return I(t=>o(e.id,t),t=>{let n=t._referencesUpdated??0,r=n>0?` ${f(n)} that held its old URL now ${n===1?`holds`:`hold`} the new one.`:``;return`${e.filename} replaced; it keeps its id, so pages that use it show the new file.${r}`},`The file could not be replaced`,t)}function B(e,t){return I(()=>u(e.id),e=>`Duplicated as ${e.filename}, with a new id.`,`The file could not be duplicated`,t)}function V(e,t){return I(t=>l(e.id,t),()=>`Moved.`,`The file could not be moved`,t)}function H(){let e=p();return(t,n)=>{let r=()=>e({text:`Could not copy. Copy it yourself: ${t}`,tone:`error`});navigator.clipboard?navigator.clipboard.writeText(t).then(()=>e({text:`${n} copied: ${t}`}),r):r()}}export{R as a,P as c,S as d,b as f,z as i,E as l,B as n,L as o,v as p,V as r,F as s,H as t,w as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{s as t}from"./vendor-diff-DGCTJYJ4.js";import{t as n}from"./createLucideIcon-BklFHeMd.js";import{f as r}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{s as t}from"./vendor-diff-DGCTJYJ4.js";import{t as n}from"./createLucideIcon-BklFHeMd.js";import{f as r}from"./index-d5j-az5g.js";var i={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};i.node;var a=n(i),o=e(t(),1);function s(e,t){let[n,i]=(0,o.useState)({state:`loading`}),[a,s]=(0,o.useState)(0),[c,l]=(0,o.useState)(()=>e);return c!==e&&(l(()=>e),i({state:`loading`})),(0,o.useEffect)(()=>{let n=!0;return e().then(e=>{n&&i({state:`ready`,data:e})}).catch(e=>{n&&i({state:`error`,message:r(e,t)})}),()=>{n=!1}},[e,t,a]),{loaded:n,reload:(0,o.useCallback)(()=>{i(e=>e.state===`error`?{state:`loading`}:e),s(e=>e+1)},[])}}export{a as n,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{s as t}from"./vendor-diff-DGCTJYJ4.js";import{F as n,H as r,M as i}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{s as t}from"./vendor-diff-DGCTJYJ4.js";import{F as n,H as r,M as i}from"./index-d5j-az5g.js";import{t as a}from"./api-client-BRi_ki2Y.js";var o=e(t(),1);async function s(e,t,n){try{let a=await r(e,t,n);return a.meta.locale===n?{state:`exists`,status:i(a.meta)}:{state:`missing`,status:null}}catch(e){return{state:e instanceof a&&e.status===404?`missing`:`unknown`,status:null}}}function c(e,t,n){let r=t.toUpperCase();if(e===`exists`)throw Error(`The ${r} version of ${n} exists now: someone created it. Open it.`);if(e===`unknown`)throw Error(`Could not check whether the ${r} version of ${n} exists, so nothing was created. Try again.`)}async function l(e,t,i,a,o=()=>void 0){let l=await s(e,t,i);o(l),c(l.state,i,t);let{fields:u,body:d,metadata:f}=await r(e,t,a);await n(e,{slug:t,fields:u,body:d,metadata:f,locale:i})}function u(e){if(!e)return{states:null,statuses:null};let t=[...e];return{states:new Map(t.map(([e,t])=>[e,t.state])),statuses:new Map(t.flatMap(([e,t])=>t.status?[[e,t.status]]:[]))}}function d(e,t,n,r){let[i,a]=(0,o.useState)(null),c=n.join(`,`),d=(0,o.useCallback)((e,t)=>{a(n=>new Map([...n??[],[e,t]]))},[]);(0,o.useEffect)(()=>{if(a(null),n.length<2)return;let r=!0;return Promise.all(n.map(n=>s(e,t,n))).then(e=>{if(!r)return;let t={state:`unknown`,status:null},i=n.map((n,r)=>[n,e[r]??t]);a(e=>new Map([...i,...e??[]]))}),()=>{r=!1}},[e,t,c]);let f=(0,o.useCallback)(async n=>{await l(e,t,n,r,e=>d(n,e)),d(n,{state:`exists`,status:`draft`})},[e,t,r,d]);return{...(0,o.useMemo)(()=>u(i),[i]),create:f}}export{d as n,l as t};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
function e(e,t){this.v=e,this.k=t}function t(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e){if(Array.isArray(e))return e}function r(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function i(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a(e,t){return n(e)||r(e,t)||o(e,t)||i()}function o(e,n){if(e){if(typeof e==`string`)return t(e,n);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function s(t){var n,r;function i(n,r){try{var o=t[n](r),s=o.value,c=s instanceof e;Promise.resolve(c?s.v:s).then(function(e){if(c){var r=n===`return`&&s.k?n:`next`;if(!s.k||e.done)return i(r,e);e=t[r](e).value}a(!!o.done,e)},function(e){i(`throw`,e)})}catch(e){a(2,e)}}function a(e,t){e===2?n.reject(t):n.resolve({value:t,done:e}),(n=n.next)?i(n.key,n.arg):r=null}this._invoke=function(e,t){return new Promise(function(a,o){var s={key:e,arg:t,resolve:a,reject:o,next:null};r?r=r.next=s:(n=r=s,i(e,t))})},typeof t.return!=`function`&&(this.return=void 0)}s.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},s.prototype.next=function(e){return this._invoke(`next`,e)},s.prototype.throw=function(e){return this._invoke(`throw`,e)},s.prototype.return=function(e){return this._invoke(`return`,e)};var c=Object.entries,l=Object.keys,u=Object.setPrototypeOf,d=Object.isFrozen,f=Object.getPrototypeOf,p=Object.getOwnPropertyDescriptor,m=Object.freeze,h=Object.seal,g=Object.create,ee=typeof Reflect<`u`&&Reflect,te=ee.apply,ne=ee.construct;m||=function(e){return e},h||=function(e){return e},te||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ne||=function(e){return new e(...[...arguments].slice(1))};var _=S(Array.prototype.forEach),re=S(Array.prototype.lastIndexOf),ie=S(Array.prototype.pop),ae=S(Array.prototype.push),oe=S(Array.prototype.slice),se=S(Array.prototype.splice),ce=Array.isArray,le=C(Set),ue=S(Set.prototype.add),de=S(Set.prototype.has),fe=S(String.prototype.toLowerCase),pe=S(String.prototype.toString),me=S(String.prototype.match),he=S(String.prototype.replace),ge=S(String.prototype.indexOf),_e=S(String.prototype.trim),ve=S(Number.prototype.toString),ye=S(Boolean.prototype.toString),be=typeof BigInt>`u`?null:S(BigInt.prototype.toString),xe=typeof Symbol>`u`?null:S(Symbol.prototype.toString),v=S(Object.prototype.hasOwnProperty),y=S(Object.prototype.toString),Se=RegExp.prototype.test,b=function(e,t){return e instanceof RegExp&&(e.lastIndex=0),te(Se,e,[t])},x=C(TypeError);function S(e){return function(t){var n=[...arguments].slice(1);return te(e,t,n)}}function C(e){return function(){return ne(e,[...arguments])}}function w(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fe;if(u&&u(e,null),!ce(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(d(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ce(e){for(let t=0;t<e.length;t++)v(e,t)||(e[t]=null);return e}function we(e){let t=g(null);for(let r of c(e)){var n=a(r,2);let i=n[0],o=n[1];v(e,i)&&(t[i]=ce(o)?Ce(o):o&&typeof o==`object`&&o.constructor===Object?we(o):o)}return t}function Te(e){let t=g(null),n=l(e),r=n.length;for(;r--;)t[n[r]]=e[n[r]];return t}function Ee(e){switch(typeof e){case`string`:return e;case`number`:return ve(e);case`boolean`:return ye(e);case`bigint`:return be?be(e):`0`;case`symbol`:return xe?xe(e):`Symbol()`;case`undefined`:return y(e);case`function`:case`object`:{if(e===null)return y(e);let t=e,n=T(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:y(e)}return y(e)}default:return y(e)}}function T(e,t){for(;e!==null;){let n=p(e,t);if(n){if(n.get)return S(n.get);if(typeof n.value==`function`)return S(n.value)}e=f(e)}function n(){return null}return n}function De(e,t){for(;e!==null;){let n=p(e,t);if(n)return n.get?S(n.get):null;e=f(e)}return null}function Oe(e){if(!e)return!1;try{return b(e,``),!0}catch{return!1}}var ke=m(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Ae=m(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.filter.font.g.glyph.glyphref.hkern.image.line.lineargradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),je=m([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Me=m([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Ne=m(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Pe=m([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Fe=m([`#text`]),Ie=m(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Le=m(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Re=m(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ze=m([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Be=h(/{{[\w\W]*|^[\w\W]*}}/g),Ve=h(/<%[\w\W]*|^[\w\W]*%>/g),He=h(/\${[\w\W]*/g),Ue=h(/{{|}}|\${|<%|%>|<%|%>/),We=h(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ge=h(/^aria-[\-\w]+$/),Ke=h(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qe=h(/^(?:\w+script|data):/i),Je=h(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ye=h(/^html$/i),Xe=h(/^[a-z][.\w]*(-[.\w]+)+$/i),Ze=h(/<[/\w!]/g),Qe=h(/<[/\w]/g),$e=h(/<\/no(script|embed|frames)/i),et=h(/\/>/i),tt=h(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),nt=h(/^[\r\n\t ]+/),E={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},rt=m(w({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),it=function(){return typeof window>`u`?null:window},at=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ot=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},st=function(e,t,n,r){return v(e,t)&&ce(e[t])?w(r.base?Te(r.base):{},e[t],r.transform):n},ct=function(e,t,n){let r=v(e,t)?e[t]:void 0;return r&&typeof r==`object`?we(r):n};function lt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:it(),t=e=>lt(e);if(t.version=`3.4.18`,t.removed=[],!e||!e.document||e.document.nodeType!==E.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript,a=e.HTMLTemplateElement,o=e.Node,s=e.Element,l=e.NodeFilter,u=e.DOMParser,d=e.trustedTypes,f=s.prototype,p=T(f,`cloneNode`),ee=T(f,`remove`),te=T(f,`removeAttributeNode`),ne=T(f,`nextSibling`),ve=T(f,`childNodes`),ye=T(f,`parentNode`),be=T(f,`shadowRoot`),xe=T(f,`attributes`),y=o&&o.prototype?T(o.prototype,`nodeType`):null,Se=o&&o.prototype?T(o.prototype,`nodeName`):null,S=o&&o.prototype?T(o.prototype,`ownerDocument`):null,C=function(e){return y?y(e):e.nodeType},Ce=function(e){return Se?Se(e):e.nodeName},ut=De(f,`namespaceURI`),dt=function(e){return ut?ut(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,O=``,k,A=!1,j=0,ft=function(){if(j>0)throw x(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},M=function(e){ft(),j++;try{return D.createHTML(e)}finally{j--}},pt=function(e){return D&&Wt?M(e):e},mt=function(e){ft(),j++;try{return D.createScriptURL(e)}finally{j--}},ht=function(){return A||=(k=at(d,i),!0),k},N=n,gt=N.implementation,_t=N.createNodeIterator,vt=N.createDocumentFragment,yt=N.getElementsByTagName,bt=r.importNode,P=ot();t.isSupported=typeof c==`function`&&typeof ye==`function`&>&>.createHTMLDocument!==void 0;let xt=Be,St=Ve,Ct=He,wt=We,Tt=Ge,Et=qe,Dt=Je,Ot=Xe,kt=Ke,F=null,At=w({},[...ke,...Ae,...je,...Ne,...Fe]),I=null,jt=w({},[...Ie,...Le,...Re,...ze]),L=null,Mt=null,Nt=null,R=Object.seal(g(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Pt=!0,z=!0,Ft=!1,It=!0,B=!1,Lt=!0,V=!1,Rt=!1,zt=null,Bt=null,Vt=!1,Ht=!1,Ut=!1,Wt=!1,Gt=!0,Kt=!1,qt=`user-content-`,Jt=!0,Yt=!1,H=null,Xt=!1,Zt=null,Qt=w({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),$t=null,en=w({},[`audio`,`video`,`img`,`source`,`image`,`track`]),tn=null,nn=w({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),rn=`http://www.w3.org/1998/Math/MathML`,an=`http://www.w3.org/2000/svg`,U=`http://www.w3.org/1999/xhtml`,on=U,sn=!1,cn=null,ln=w({},[rn,an,U],pe),un=m(w({},[`mi`,`mo`,`mn`,`ms`,`mtext`])),dn=null,fn=m(w({},[`annotation-xml`])),pn=null,mn=m(g(null)),hn=w({},[`title`,`style`,`font`,`a`,`script`]),gn=null,_n=[`application/xhtml+xml`,`text/html`],W=null,vn=null,yn=n.createElement(`form`),G=function(e){return e instanceof RegExp||e instanceof Function},bn=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e&&typeof e==`object`||(e={}),e=we(e),gn=_n.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,W=gn===`application/xhtml+xml`?pe:fe,F=st(e,`ALLOWED_TAGS`,At,{transform:W}),I=st(e,`ALLOWED_ATTR`,jt,{transform:W}),cn=st(e,`ALLOWED_NAMESPACES`,ln,{transform:pe}),tn=st(e,`ADD_URI_SAFE_ATTR`,nn,{transform:W,base:nn}),$t=st(e,`ADD_DATA_URI_TAGS`,en,{transform:W,base:en}),Zt=st(e,`FORBID_CONTENTS`,Qt,{transform:W}),Mt=st(e,`FORBID_TAGS`,g(null),{transform:W}),Nt=st(e,`FORBID_ATTR`,g(null),{transform:W}),Xt=v(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?we(e.USE_PROFILES):e.USE_PROFILES:!1,Pt=e.ALLOW_ARIA_ATTR!==!1,z=e.ALLOW_DATA_ATTR!==!1,Ft=e.ALLOW_UNKNOWN_PROTOCOLS||!1,It=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,B=e.SAFE_FOR_TEMPLATES||!1,Lt=e.SAFE_FOR_XML!==!1,V=e.WHOLE_DOCUMENT||!1,Ht=e.RETURN_DOM||!1,Ut=e.RETURN_DOM_FRAGMENT||!1,Wt=e.RETURN_TRUSTED_TYPE||!1,Vt=e.FORCE_BODY||!1,Gt=e.SANITIZE_DOM!==!1,Kt=e.SANITIZE_NAMED_PROPS||!1,Jt=e.KEEP_CONTENT!==!1,Yt=e.IN_PLACE||!1,kt=Oe(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ke,on=typeof e.NAMESPACE==`string`?e.NAMESPACE:U,dn=ct(e,`MATHML_TEXT_INTEGRATION_POINTS`,un),pn=ct(e,`HTML_INTEGRATION_POINTS`,fn);let t=ct(e,`CUSTOM_ELEMENT_HANDLING`,mn);if(L=g(null),v(t,`tagNameCheck`)&&G(t.tagNameCheck)&&(L.tagNameCheck=t.tagNameCheck),v(t,`attributeNameCheck`)&&G(t.attributeNameCheck)&&(L.attributeNameCheck=t.attributeNameCheck),v(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(L.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),h(L),B&&(z=!1),Ut&&(Ht=!0),Xt&&((v(e,`ALLOWED_TAGS`)||v(e,`ALLOWED_ATTR`))&&typeof console<`u`&&typeof console.warn==`function`&&console.warn(`DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together.`),F=w({},Fe),I=g(null),Xt.html===!0&&(w(F,ke),w(I,Ie)),Xt.svg===!0&&(w(F,Ae),w(I,Le),w(I,ze)),Xt.svgFilters===!0&&(w(F,je),w(I,Le),w(I,ze)),Xt.mathMl===!0&&(w(F,Ne),w(I,Re),w(I,ze))),R.tagCheck=null,R.attributeCheck=null,v(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?R.tagCheck=e.ADD_TAGS:ce(e.ADD_TAGS)&&(F===At&&(F=Te(F)),w(F,e.ADD_TAGS,W))),v(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?R.attributeCheck=e.ADD_ATTR:ce(e.ADD_ATTR)&&(I===jt&&(I=Te(I)),w(I,e.ADD_ATTR,W))),v(e,`ADD_FORBID_CONTENTS`)&&ce(e.ADD_FORBID_CONTENTS)&&(Zt===Qt&&(Zt=Te(Zt)),w(Zt,e.ADD_FORBID_CONTENTS,W)),Jt&&(F[`#text`]=!0),V&&w(F,[`html`,`head`,`body`]),F.table&&(F.tbody=!0,delete Mt.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw x(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw x(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=D;D=e.TRUSTED_TYPES_POLICY;try{O=M(``)}catch(e){throw D=t,e}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,O=``):(D===void 0&&(D=ht()),D&&typeof O==`string`&&(O=M(``)));vn=m(e)},xn=w({},[...Ae,...je,...Me]),Sn=w({},[...Ne,...Pe]),K=function(e,t,n){return t===U?e===`svg`:t===rn?e===`svg`&&(n===`annotation-xml`||dn[n]):!!xn[e]},Cn=function(e,t,n){return t===U?e===`math`:t===an?e===`math`&&pn[n]:!!Sn[e]},wn=function(e,t,n){return t===an&&!pn[n]||t===rn&&!dn[n]?!1:!Sn[e]&&(hn[e]||!xn[e])},Tn=function(e){let t=dt(e),n=fe(Ce(e)),r=ye(e),i=on,a=`template`;return r&&C(r)===E.element&&(i=dt(r),a=fe(Ce(r))),cn[t]?t===an?K(n,i,a):t===rn?Cn(n,i,a):t===U?wn(n,i,a):gn===`application/xhtml+xml`:!1},q=function(e){ae(t.removed,{element:e});try{ye(e).removeChild(e)}catch{if(ee(e),!ye(e))throw x(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},En=function(e,t,n){try{te(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Dn=function(e){jn(e);let t=ve(e);t&&_(oe(t),e=>{try{ee(e)}catch{}}),C(e)===E.element&&kn(e,!1)},On=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}if(ae(t.removed,{attribute:r||null,from:n}),r)En(n,r,e);else try{n.removeAttribute(e)}catch{}if(e===`is`){if(Ht||Ut)try{q(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},kn=function(e,t){let n=xe(e);if(n)for(let r=n.length-1;r>=0;--r){let i=n[r],a=i&&i.name;typeof a==`string`&&!(t&&I[W(a)])&&En(e,i,a)}},An=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===E.element){let t=be(e);Hn(t)&&r.push(t)}let i=ve(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},jn=function(e){An(e,e=>{C(e)===E.element&&kn(e,!0)})},Mn=function(e){let t=[];return An(e,e=>{t.push(e)},!0),t},Nn=function(e,t){let n=le();_(Mn(e),e=>{C(e)===E.element&&ue(n,e)}),_(t,e=>{C(e)===E.element&&!de(n,e)&&kn(e,!0)})},Pn=function(e,n){let r=!1;return _(t.removed,t=>{t.element&&(r||=t.element===e,jn(t.element))}),Nn(e,n),r},Fn=function(e,t){let n=H,r=null,i=()=>(r||(r=le(),_(t,e=>{ue(r,e)})),r);for(let t=0;;t++){let r=Mn(e),a=[e],o=!1;if(_(r,e=>{C(e)===E.documentFragment?ae(a,e):!o&&!de(n,e)&&(o=de(i(),e))}),!o)return;if(t>=8)throw x(`the tree kept changing during in-place sanitization; refusing to return it`);_(a,(t,n)=>{J(t,n>0,e,i())})}},J=function(e,t,n,r){let i=X(e),a;for(;a=i.nextNode();)de(r,a)&&!de(H,a)&&(t&&$(P.uponSanitizeShadowNode,a,null),rr(a,n))},In=function(e){H&&ue(H,e)},Ln=function(e,t){return Lt?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Y=function(e){Lt&&An(e,e=>{let t=C(e);if(t===E.processingInstruction||t===E.comment&&b(Qe,e.data)){try{ee(e)}catch{}return!1}if(t===E.element){let t=e,n=W(Ce(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Ln(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Rn=function(e){let t=null,r=null;if(Vt)e=`<remove></remove>`+e;else{let t=me(e,nt);r=t&&t[0]}gn===`application/xhtml+xml`&&on===U&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?M(e):e;if(on===U)try{t=new u().parseFromString(i,gn)}catch{}if(!t||!t.documentElement){t=gt.createDocument(on,`template`,null);try{t.documentElement.innerHTML=sn?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),on===U?yt.call(t,V?`html`:`body`)[0]:V?t.documentElement:a},X=function(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],n=S?S(e):e.ownerDocument;return _t.call(n||e,e,(t?0:l.SHOW_ELEMENT)|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},zn=function(e){return e=he(e,xt,` `),e=he(e,St,` `),e=he(e,Ct,` `),e},Z=function(e){Q(e);let t=e.querySelectorAll?.call(e,`template`);t&&_(t,e=>{Hn(e.content)&&Z(e.content)})},Q=function(e){e.normalize();let t=X(e,!0),n=t.nextNode();for(;n;)n.data=zn(n.data),n=t.nextNode()},Bn=function(e){let t=Se?Se(e):null;return typeof t!=`string`||W(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==xe(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==ve(e)},Vn=function(e){if(!y||typeof e!=`object`||!e)return null;try{let t=y(e);return typeof t==`number`?t:null}catch{return null}},Hn=function(e){return Vn(e)===E.documentFragment},Un=function(e){return Vn(e)!==null};function $(e,n,r){e.length!==0&&_(e,e=>{e.call(t,n,r,vn)})}let Wn=function(e,t,n){return!!(Lt&&n===E.element&&e.hasChildNodes()&&!Un(e.firstElementChild)&&b(Ze,e.textContent)&&b(Ze,e.innerHTML)||Lt&&rt[t]&&n===E.element&&dt(e)===U&&(Un(e.firstElementChild)||typeof e.textContent==`string`&&b(Ze,e.textContent))||n===E.processingInstruction||Lt&&n===E.comment&&b(Qe,e.data))},Gn=function(e,t){return e instanceof RegExp?b(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Kn=function(e,t,n){if(!Mt[t]&&Qn(t)&&Gn(L.tagNameCheck,t))return!1;if(Jt&&!Zt[t]&&!Zt[fe(t)]){let t=ye(e),r=ve(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?p(r[a],!0):r[a];t.insertBefore(i,ne(e))}}}return q(e),!0},qn=function(e,t,n,r){return e.length===0?t:t===n||t===r?Te(t):t},Jn=function(e,t){return e===t||ye(e)!==null?!1:(Yt&&jn(e),!0)},Yn=function(e,n){if(In(e),$(P.beforeSanitizeElements,e,null),Jn(e,n))return!0;if(Bn(e))return q(e),!0;let r=W(Ce(e)),i=C(e);if(F=qn(P.uponSanitizeElement,F,At,zt),$(P.uponSanitizeElement,e,{tagName:r,allowedTags:F}),Jn(e,n))return!0;if(Wn(e,r,i))return q(e),!0;if(Mt[r]||!(R.tagCheck instanceof Function&&R.tagCheck(r))&&!F[r]){let t=Kn(e,r,n);return t===!1&&($(P.afterSanitizeElements,e,null),Jn(e,n))?!0:t}if(i===E.element&&!Tn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&b($e,e.innerHTML))return q(e),!0;if(B&&i===E.text){let n=e.textContent,r=zn(n);n!==r&&(ae(t.removed,{element:e.cloneNode()}),e.textContent=r)}return $(P.afterSanitizeElements,e,null),Jn(e,n)},Xn=function(e,t,r){if(Nt[t]||Ln(t,e)||Gt&&(t===`id`||t===`name`)&&(r in n||r in yn))return!1;let i=I[t]||R.attributeCheck instanceof Function&&R.attributeCheck(t,e);if(z&&b(wt,t)||Pt&&b(Tt,t))return!0;if(!i)return Qn(e)&&Gn(L.tagNameCheck,e)&&Gn(L.attributeNameCheck,t,e)||t===`is`&&L.allowCustomizedBuiltInElements&&Gn(L.tagNameCheck,r);if(tn[t])return!0;let a=he(r,Dt,``);return b(kt,a)||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ge(r,`data:`)===0&&$t[e]||Ft&&!b(Et,a)?!0:!r},Zn=w({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Qn=function(e){return!Zn[fe(e)]&&b(Ot,e)},$n=function(e,t,n,r){if(D&&typeof d==`object`&&typeof d.getAttributeType==`function`&&!n)switch(d.getAttributeType(e,t)){case`TrustedHTML`:return M(r);case`TrustedScriptURL`:return mt(r)}return r},er=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Bn(e)||(q(e),!1)}catch{return On(t,e),!1}},tr=function(e,t){return Lt&&b(tt,t)?!0:fe(e)===`attributename`&&ge(t,`href`)!==-1},nr=function(e,n){if($(P.beforeSanitizeAttributes,e,null),Jn(e,n))return;let r=e.attributes;if(!r||Bn(e))return;I=qn(P.uponSanitizeAttribute,I,jt,Bt);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},a=r.length,o=W(Ce(e));for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=W(s),d=l,f=s===`value`?d:_e(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,$(P.uponSanitizeAttribute,e,i),f=i.attrValue,Kt&&(u===`id`||u===`name`)&&ge(f,qt)!==0&&(On(s,e,n),f=qt+f,p=!0),tr(s,f)?On(s,e,n):i.forceKeepAttr||(i.keepAttr?!It&&b(et,f)?On(s,e,n):(B&&(f=zn(f)),Xn(o,u,f)?(f=$n(o,u,c,f),f!==d&&er(e,s,c,f)&&p&&ie(t.removed)):On(s,e,n)):On(s,e,n))}$(P.afterSanitizeAttributes,e,null),Jn(e,n)},rr=function(e,t){Yn(e,t),nr(e,t),Hn(e.content)&&ir(e.content)},ir=function(e){let t=null,n=X(e);for($(P.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(P.uponSanitizeShadowNode,t,null),rr(t,e),C(t)===E.element){let e=be(t);Hn(e)&&(ar(e),ir(e))}B&&Q(e),$(P.afterSanitizeShadowDOM,e,null)},ar=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){ir(e.shadow);continue}let n=e.node,r=C(n)===E.element,i=ve(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=Se?Se(n):null;if(typeof e==`string`&&W(e)===`template`){let e=n.content;Hn(e)&&t.push({node:e,shadow:null})}}if(r){let e=be(n);Hn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(sn=!e,sn&&(e=`<!-->`),typeof e!=`string`&&!Un(e)&&(e=Ee(e),typeof e!=`string`))throw x(`dirty is not a string, aborting`);if(!t.isSupported)return e;Rt?(F=zt,I=Bt):bn(n),t.removed=[];let c=Yt&&typeof e!=`string`&&Un(e),l=[],u=H;if(c){Y(e);let t=Ce(e);if(typeof t==`string`){let n=W(t);if(!F[n]||Mt[n])throw Dn(e),x(`root node is forbidden and cannot be sanitized in-place`)}if(Bn(e))throw Dn(e),x(`root node is clobbered and cannot be sanitized in-place`);l=Mn(e),H=le()}else if(Un(e))i=Rn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===E.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),ar(i);else{if(!Ht&&!B&&!V&&e.indexOf(`<`)===-1)return pt(e);if(i=Rn(e),!i)return Ht?null:Wt?O:``}i&&Vt&&q(i.firstChild);let d=c?e:i;try{c&&ar(e);let t=X(d);for(;o=t.nextNode();)rr(o,d);c&&Fn(e,l)}catch(t){throw c&&(Dn(e),Pn(e,l)),t}finally{H=u}if(c){if(Pn(e,l))throw x(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return B&&Z(e),e}if(Ht){if(B&&Z(i),Ut)for(s=vt.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(I.shadowroot||I.shadowrootmode)&&(s=bt.call(r,s,!0)),s}let f=()=>V?i.outerHTML:i.innerHTML,p=f();return B&&b(Ue,p)&&(Q(i),p=f()),V&&F[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&b(Ye,i.ownerDocument.doctype.name)&&(p=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
3
|
+
`+p),pt(p)},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bn(e),Rt=!0,zt=F,Bt=I},t.clearConfig=function(){vn=null,Rt=!1,zt=null,Bt=null,D=k,O=``},t.isValidAttribute=function(e,t,n){vn||bn({});let r=W(e),i=W(t);return typeof n==`string`&&(tr(t,n)||!It&&b(et,n))?!1:Xn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&v(P,e)&&ae(P[e],t)},t.removeHook=function(e,t){if(v(P,e)){if(t!==void 0){let n=re(P[e],t);return n===-1?void 0:se(P[e],n,1)[0]}return ie(P[e])}},t.removeHooks=function(e){v(P,e)&&(P[e]=[])},t.removeAllHooks=function(){P=ot()},t}var ut=lt();function dt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var D=dt();function O(e){D=e}var k={exec:()=>null};function A(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function j(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(M.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ft=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),M={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,listInterruptsParagraph:/^ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ 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,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,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,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:A(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:A(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:A(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:A(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:A(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:A(e=>RegExp(`^ {0,${e}}(?:</?(?:${Tt})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:A(e=>RegExp(`^ {0,${e}}>`)),nestedContainerMarkers:/^(?: {0,3}(?:(?:[*+-]|\d{1,9}[.)])[ \t]+|>[ \t]?))+/},pt=/^(?:[ \t]*(?:\n|$))+/,mt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ht=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,N=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,gt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_t=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,vt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,yt=j(vt).replace(/bull/g,_t).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),bt=j(vt).replace(/bull/g,_t).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),P=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,xt=/^[^\n]+/,St=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,Ct=j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,St).replace(`title`,/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),wt=j(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_t).getRegex(),Tt=`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`,Et=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Dt=j(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Et).replace(`tag`,Tt).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ot=e=>j(P).replace(`hr`,N).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,Tt).getRegex(),kt=Ot(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),F=Ot(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),At={blockquote:j(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace(`paragraph`,F).getRegex(),code:mt,def:Ct,fences:ht,heading:gt,hr:N,html:Dt,lheading:yt,list:wt,newline:pt,paragraph:kt,table:k,text:xt},I=j(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,N).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,Tt).getRegex(),jt={...At,lheading:bt,table:I,paragraph:j(P).replace(`hr`,N).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,I).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,Tt).getRegex()},L={...At,html:j(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace(`comment`,Et).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:k,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:j(P).replace(`hr`,N).replace(`heading`,` *#{1,6} *[^
|
|
4
|
+
]`).replace(`lheading`,yt).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Mt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Nt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,R=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Pt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,z=/[\p{P}\p{S}]/u,Ft=/[\s\p{P}\p{S}]/u,It=/[^\s\p{P}\p{S}]/u,B=j(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Ft).getRegex(),Lt=/[\p{Pi}\p{Ps}"']/u,V=/(?!~)[\p{P}\p{S}]/u,Rt=/(?!~)[\s\p{P}\p{S}]/u,zt=/(?:[^\s\p{P}\p{S}]|~)/u,Bt=j(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ft?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Vt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ht=j(Vt,`u`).replace(/punct/g,z).getRegex(),Ut=j(Vt,`u`).replace(/punct/g,V).getRegex(),Wt=j(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Lt).replace(/punct/g,z).getRegex(),Gt=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Kt=j(Gt,`gu`).replace(/notPunctSpace/g,It).replace(/punctSpace/g,Ft).replace(/punct/g,z).getRegex(),qt=j(Gt,`gu`).replace(/notPunctSpace/g,zt).replace(/punctSpace/g,Rt).replace(/punct/g,V).getRegex(),Jt=j(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,It).replace(/punctSpace/g,Ft).replace(/punct/g,z).getRegex(),Yt=j(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,It).replace(/punctSpace/g,Ft).replace(/punct/g,z).getRegex(),H=j(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,It).replace(/punctSpace/g,Ft).replace(/punct/g,z).getRegex(),Xt=j(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,z).getRegex(),Zt=j(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,It).replace(/punctSpace/g,Ft).replace(/punct/g,z).getRegex(),Qt=j(/\\(punct)/,`gu`).replace(/punct/g,z).getRegex(),$t=j(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,z).getRegex(),en=j(/^<(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(),tn=j(Et).replace(`(?:-->|$)`,`-->`).getRegex(),nn=j(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,tn).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),rn=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,an=j(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,rn).getRegex(),U=j(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,an).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),on=j(/^!?\[(label)\]\[(ref)\]/).replace(`label`,an).replace(`ref`,St).getRegex(),sn=j(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,St).getRegex(),cn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,ln=j(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,rn).getRegex(),un=j(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,j(/^!?\[(label)\]\[(ref)\]/).replace(`label`,ln).replace(`ref`,cn).getRegex()).replace(`nolink`,j(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,cn).getRegex()).getRegex(),dn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,fn=j(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),pn={_backpedal:k,anyPunctuation:Qt,anyPunctuationOutsideCode:$t,autolink:en,blockSkip:Bt,br:R,code:Nt,del:k,delLDelim:k,delRDelim:k,emStrongLDelim:Ht,emStrongRDelimAst:Kt,emStrongRDelimUnd:Yt,escape:Mt,link:U,nolink:sn,punctuation:B,reflink:on,reflinkSearch:un,tag:nn,text:Pt,url:k},mn={...pn,emStrongLDelim:Wt,emStrongRDelimAst:Jt,emStrongRDelimUnd:H,link:j(/^!?\[(label)\]\((.*?)\)/).replace(`label`,an).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,an).getRegex()},hn={...pn,emStrongRDelimAst:qt,emStrongLDelim:Ut,delLDelim:Xt,delRDelim:Zt,url:j(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,fn).replace(`protocol`,dn).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:j(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,dn).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace(`wwwStart`,ft?`(?<![^\\s*_~(])www\\.`:`www\\.`).getRegex()},gn={...hn,br:j(R).replace(`{2,}`,`*`).getRegex(),text:j(hn.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},_n={normal:At,gfm:jt,pedantic:L},W={normal:pn,gfm:hn,breaks:gn,pedantic:mn},vn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},yn=e=>vn[e];function G(e,t){if(t){if(M.escapeTest.test(e))return e.replace(M.escapeReplace,yn)}else if(M.escapeTestNoEncode.test(e))return e.replace(M.escapeReplaceNoEncode,yn);return e}function bn(e){return M.numericCharacterReference.test(e)?e.replace(M.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&`:String.fromCodePoint(r)}):e}function xn(e){try{e=encodeURI(e).replace(M.percentDecode,`%`)}catch{return null}return e}function Sn(e,t){let n=e.replace(M.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(M.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(M.slashPipe,`|`);return n}function K(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 Cn(e){let t=e.split(`
|
|
5
|
+
`),n=t.length-1;for(;n>=0&&M.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
6
|
+
`)}function wn(e){return e.trim().replace(M.multipleSpaceGlobal,` `).toLowerCase().toUpperCase().toLowerCase()}function Tn(e,t){if(e.indexOf(t[0])===-1&&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}var q=new WeakMap;function En(e){let t={"*":-1,_:-1},n=-1,r=e.length;for(let i=0;i<r;i++){let a=e[i];if(a!==`*`&&a!==`_`&&a!==`~`)continue;let o=i===0?`
|
|
7
|
+
`:e[i-1],s=i+1;for(;s<r&&e[s]===a;)s++;o!==` `&&o!==` `&&o!==`
|
|
8
|
+
`&&o!==`\r`&&o!==`\f`&&(a===`~`?n=i:t[a]=i),i=s-1}return{maskedSrc:e,lastPossibleEmStrongCloserIndex:t,lastPossibleDelCloserIndex:n}}function Dn(e,t){let n=En(t),r=q.get(e);r?r.push(n):q.set(e,[n])}function On(e){let t=q.get(e);t&&(t.pop(),t.length===0&&q.delete(e))}function kn(e,t,n){let r=q.get(e)?.at(-1);return r&&r.maskedSrc===t?r.lastPossibleEmStrongCloserIndex[n]:En(t).lastPossibleEmStrongCloserIndex[n]}function An(e,t){let n=q.get(e)?.at(-1);return n&&n.maskedSrc===t?n.lastPossibleDelCloserIndex:En(t).lastPossibleDelCloserIndex}function jn(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Mn(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function Nn(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
9
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
10
|
+
`)}function Pn(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var Fn=class{options;rules;lexer;constructor(e){this.options=e||D}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=this.options.pedantic?t[0]:Cn(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Nn(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=K(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:K(t[0],`
|
|
11
|
+
`),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:K(t[0],`
|
|
12
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=K(t[0],`
|
|
13
|
+
`).split(`
|
|
14
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;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(`
|
|
15
|
+
`),c=s.replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>t+jn(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`
|
|
16
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
17
|
+
${s}`:s,r=r?`${r}
|
|
18
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`||u?.type===`table`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
19
|
+
`),o=t.raw+`
|
|
20
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
21
|
+
`).length:0,d=l?e.slice(0,-l):e;if(d.length>0&&(n=`${n}
|
|
22
|
+
${d.join(`
|
|
23
|
+
`)}`),r=r.substring(0,r.length-t.text.length)+s.text,e=e.slice(d.length),e.length>0&&this.rules.other.blockquoteStart.test(e[0]))continue;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
24
|
+
`+e.join(`
|
|
25
|
+
`),o=this.list(a);i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`
|
|
26
|
+
`).length:0;if(s>0){let t=e.slice(0,s).join(`
|
|
27
|
+
`);n=`${n}
|
|
28
|
+
${t}`,r=`${r}
|
|
29
|
+
${t}`}e=e.slice(s)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){if(!this.options.pedantic&&this.lexer.state.lastToken?.type===`text`&&!this.rules.other.listInterruptsParagraph.test(e))return;let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
|
|
30
|
+
`,1)[0],d=t[1].length,f=this.options.pedantic?jn(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>jn(e,d)),p=e.split(`
|
|
31
|
+
`,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h),c=!1;for(;e;){let l=e.split(`
|
|
32
|
+
`,1)[0],u;if(p=l,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),u=p):u=p.replace(this.rules.other.leadingSpaceTab,e=>jn(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(u.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
|
|
33
|
+
`+u.slice(h),c=!1;else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||o.test(f)||n.test(f))break;if(!this.options.pedantic&&!c){let e=f.replace(this.rules.other.nestedContainerMarkers,``);if(this.rules.block.fences.test(e)||this.rules.block.heading.test(e)||this.rules.block.hr.test(e))break}let e=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}
|
|
34
|
+
${p}`)?` ${u.replace(/^ {0,3}/,``)}`:p;a+=`
|
|
35
|
+
`+e,c=!0}m=!p.trim(),e=e.substring(l.length+1),f=u.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Cn(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&Tn(t[2],`()`)!==-1)return;let e=wn(t[1]),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:K(t[0],`
|
|
36
|
+
`),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=Sn(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
37
|
+
`):[],a={type:`table`,raw:K(t[0],`
|
|
38
|
+
`),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(Sn(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){let e=t[1].trim();return{type:`heading`,raw:K(t[0],`
|
|
39
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
40
|
+
`?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){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Pn(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=K(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=Tn(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 i=K(t[0].slice(0,-1),`\\`);if((t[0].length-i.length)%2==0)return;let a=t[2],o=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(a);e&&(a=e[1],o=e[3])}else o=t[3]?t[3].slice(1,-1):``;return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(a=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a.slice(1):a.slice(1,-1)),Mn(t,{href:a&&a.replace(this.rules.inline.anyPunctuation,`$1`),title:o&&o.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 r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Pn(e,n[1],r,this.rules))return;let i=t[wn(n[2]||n[1])];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Mn(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:n===`*`||n===`_`||!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l);if(i!==`*`&&i!==`_`)return;let ee=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,te=kn(this,t,i),ne=t.length-e.length+n;if(te<ne)return;t=t.slice(-1*e.length+n);let _=te-ne;for(ee.lastIndex=0;(r=ee.exec(t))!==null&&!(r.index>_);){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;if(f=[...u].length,r[3]||r[4]){p+=f;continue}if(r[5]||r[6]||g){if(a&&(r[5]||r[6]))break;if(h%3&&!((h+f)%3)){m+=f;continue}}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let t=[...r[0]][0].length,i=e.slice(0,n+r.index+t+f);if(Math.min(n,f)%2){let e=i.slice(1,-1);return{type:`em`,raw:i,text:e,tokens:this.lexer.inlineTokens(e)}}let o=i.slice(2,-2);return{type:`strong`,raw:i,text:o,tokens:this.lexer.inlineTokens(o)}}}}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,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim,c=An(this,t),l=t.length-e.length+n;if(c<l)return;t=t.slice(-1*e.length+n);let u=c-l;for(s.lastIndex=0;(r=s.exec(t))!==null&&!(r.index>u);){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}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,autolink:!0,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,autolink:!0,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:e?t[0]:bn(t[0]),escaped:e}}}},J=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||D,this.options.tokenizer=this.options.tokenizer||new Fn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:M,block:_n.normal,inline:W.normal};this.options.pedantic?(t.block=_n.pedantic,t.inline=W.pedantic):this.options.gfm&&(t.block=_n.gfm,t.inline=this.options.breaks?W.breaks:W.gfm),this.tokenizer.rules=t}static get rules(){return{block:_n,inline:W}}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(M.carriageReturn,`
|
|
41
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this;let r=this.state.lastToken;this.options.pedantic&&(e=e.replace(M.tabCharGlobal,` `).replace(M.spaceLine,``));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}this.state.lastToken=t.at(-1);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+=`
|
|
42
|
+
`: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+=(n.raw.endsWith(`
|
|
43
|
+
`)?``:`
|
|
44
|
+
`)+r.raw,n.text+=`
|
|
45
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if((r=this.tokenizer.fences(e))||(r=this.tokenizer.heading(e))||(r=this.tokenizer.hr(e))||(r=this.tokenizer.blockquote(e))||(r=this.tokenizer.list(e))||(r=this.tokenizer.html(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
46
|
+
`)?``:`
|
|
47
|
+
`)+r.raw,n.text+=`
|
|
48
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):(this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title}),t.push(r));continue}if((r=this.tokenizer.table(e))||(r=this.tokenizer.lheading(e))){e=e.substring(r.raw.length),t.push(r);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(a))){let i=t.at(-1);n&&i?.type===`paragraph`?(i.raw+=(i.raw.endsWith(`
|
|
49
|
+
`)?``:`
|
|
50
|
+
`)+r.raw,i.text+=`
|
|
51
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(r),n=a.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
52
|
+
`)?``:`
|
|
53
|
+
`)+r.raw,n.text+=`
|
|
54
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,this.state.lastToken=r,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,wn(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e.includes(`*`)||e.includes(`_`)||e.includes(`~`)||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==Fn.prototype.emStrong||this.tokenizer.del!==Fn.prototype.del?this.#r(e):e;Dn(this.tokenizer,n);try{return this.#t(e,n,t)}finally{On(this.tokenizer)}}#t(e,t,n){let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(t=>(o=t.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let t=n.at(-1);o.type===`text`&&t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o);continue}if((o=this.tokenizer.emStrong(e,t,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,t,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),n.push(o);continue}let s=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&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let t=n.at(-1);t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#n(e){let{blockSkip:t,tag:n,autolink:r}=this.tokenizer.rules.inline,i=``,a=0,o;for(t.lastIndex=0;o=t.exec(e);){let s=o.index+(o[2]?o[2].length:0),c=o.index+o[0].length;if(e.charAt(s)===`<`){let i=e.slice(s),a=n.exec(i)||r.exec(i);if(!a){t.lastIndex=s+1;continue}c=s+a[0].length,t.lastIndex=c}i+=e.slice(a,s)+`[`+`a`.repeat(c-s-2)+`]`,a=c}return i+e.slice(a)}#r(e){let t=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,n=t=>{let r=t.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,wn(t.slice(r+1,-1))))return t;if(r>1&&t.charAt(0)!==`!`){let i=t.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,n)+`][`+`a`.repeat(t.length-r-2)+`]`}return`[`+`a`.repeat(t.length-2)+`]`};t=t.replace(e,n)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),t=this.#n(t),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},In=class{options;parser;constructor(e){this.options=e||D}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(M.notSpaceStart)?.[0],i=e?e.replace(M.endingNewline,``)+`
|
|
55
|
+
`:``;return r?`<pre><code class="language-`+G(r)+`">`+(n?i:G(i,!0))+`</code></pre>
|
|
56
|
+
`:`<pre><code>`+(n?i:G(i,!0))+`</code></pre>
|
|
57
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
58
|
+
${this.parser.parse(e)}</blockquote>
|
|
59
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
60
|
+
`}hr(e){return`<hr>
|
|
61
|
+
`}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+`>
|
|
62
|
+
`+r+`</`+i+`>
|
|
63
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
64
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
65
|
+
`}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>
|
|
66
|
+
<thead>
|
|
67
|
+
`+t+`</thead>
|
|
68
|
+
`+r+`</table>
|
|
69
|
+
`}tablerow({text:e}){return`<tr>
|
|
70
|
+
${e}</tr>
|
|
71
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
72
|
+
`}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>${G(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?G(n,!0):this.parser.parseInline(r),o=xn(e);if(o===null)return a;e=G(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+G(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=xn(e);if(i===null)return G(n);e=i;let a=`<img src="${G(e)}" alt="${G(n)}"`;return t&&(a+=` title="${G(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:G(e.text)}},Ln=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return`
|
|
73
|
+
`}checkbox({raw:e}){return e}},Y=class e{options;renderer;textRenderer;constructor(e){this.options=e||D,this.options.renderer=this.options.renderer||new In,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ln,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n===!1?``:n??``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;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`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e===!1?``: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`checkbox`:n+=t.checkbox(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}},Rn=class{options;block;constructor(e){this.options=e||D}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?J.lex:J.lexInline}provideParser(e=this.block){return e?Y.parse:Y.parseInline}};function X(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var zn=class{defaults=dt();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Y;Renderer=In;TextRenderer=Ln;Lexer=J;Tokenizer=Fn;Hooks=Rn;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(X(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)X(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)X(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;X(n,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);X(n,this.walkTokens(i,t))}):e.tokens&&X(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};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 In(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===!1?``:n??``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Fn(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 Rn;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];t[r]=Rn.passThroughHooks.has(n)?e=>{if(t.options.async&&Rn.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();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 X(n,r.call(this,e)),t&&X(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return J.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(typeof t>`u`||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`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?J.lex:J.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Y.parse:Y.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?J.lex:J.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Y.parse:Y.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
74
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+G(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Z=new zn;function Q(e,t){return Z.parse(e,t)}Q.options=Q.setOptions=function(e){return Z.setOptions(e),Q.defaults=Z.defaults,O(Q.defaults),Q},Q.getDefaults=dt,Q.defaults=D;function Bn(...e){return Z.use(...e),Q.defaults=Z.defaults,O(Q.defaults),Q}Q.use=Bn,Q.walkTokens=function(e,t){return Z.walkTokens(e,t)},Q.parseInline=Z.parseInline,Q.Parser=Y,Q.parser=Y.parse,Q.Renderer=In,Q.TextRenderer=Ln,Q.Lexer=J,Q.lexer=J.lex,Q.Tokenizer=Fn,Q.Hooks=Rn,Q.parse=Q,Q.options,Q.setOptions,Q.walkTokens,Q.parseInline,Y.parse,J.lex;export{Q as n,ut as r,zn as t};
|
package/dist/index.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
document.documentElement.setAttribute('data-theme', t)
|
|
18
18
|
})()
|
|
19
19
|
</script>
|
|
20
|
-
<script type="module" crossorigin src="/studio/assets/index-
|
|
20
|
+
<script type="module" crossorigin src="/studio/assets/index-d5j-az5g.js"></script>
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/studio/assets/rolldown-runtime-COiEfhsA.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/studio/assets/vendor-diff-DGCTJYJ4.js">
|
|
23
23
|
<link rel="modulepreload" crossorigin href="/studio/assets/vendor-react-CXaWJ_ii.js">
|