dsh-thoughtdag 0.4.15 → 0.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/dist-app/assets/{canonical-DTNQ8ZyS.js → canonical-ChxvAi6N.js} +2 -2
  2. package/dist-app/assets/{canvas-record-BpzYIDTK.js → canvas-record-Be2aKIf8.js} +1 -1
  3. package/dist-app/assets/{claude-code-session-08B7zSLL.js → claude-code-session-B51keZPd.js} +1 -1
  4. package/dist-app/assets/{codex-session-BKlqnTH8.js → codex-session-BR_x_Fzf.js} +1 -1
  5. package/dist-app/assets/{dsh-session-_DiyvUhU.js → dsh-session-D0yZa0_o.js} +1 -1
  6. package/dist-app/assets/{experiment-loop-C7qTId-P.js → experiment-loop-pAs6MwPV.js} +1 -1
  7. package/dist-app/assets/{index-Cjn_YjwD.js → index-962V9CYS.js} +1 -1
  8. package/dist-app/assets/{index-B1OFUPjm.js → index-DvBTIsHr.js} +1 -1
  9. package/dist-app/assets/{index-Riy9XSe2.js → index-JMt9ljo3.js} +130 -130
  10. package/dist-app/assets/{index-CUd4MgnK.js → index-_B6z8_Ff.js} +3 -3
  11. package/dist-app/assets/{live-mirror-C9-vJyVP.js → live-mirror-C9sTXAvv.js} +2 -2
  12. package/dist-app/assets/{pi-session-BbkGALnB.js → pi-session-B7frsRRp.js} +1 -1
  13. package/dist-app/assets/{sensitive-scan-Czmnw-J7.js → sensitive-scan-Cwg4RAEk.js} +1 -1
  14. package/dist-app/assets/{session-handoff-DDOYaogN.js → session-handoff-BXosSY-e.js} +2 -2
  15. package/dist-app/assets/{shared-BbpS43F9.js → shared-L3KzXorg.js} +1 -1
  16. package/dist-app/assets/{turndown-plugin-gfm.cjs-B2rQZ838.js → turndown-plugin-gfm.cjs-pG4f1F8S.js} +1 -1
  17. package/dist-app/assets/{update-check-BNKKZiy0.js → update-check-lHz7ROW6.js} +1 -1
  18. package/dist-app/index.html +1 -1
  19. package/lib/why.mjs +33 -21
  20. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CUd4MgnK.js","assets/index-Riy9XSe2.js","assets/index-C3fERes9.css","assets/experiment-loop-C7qTId-P.js"])))=>i.map(i=>d[i]);
2
- import{c as N,b as y,_ as E,p as q,r as M,h as O,a as H,u as j,j as X,s as B,k as Q,l as z,f as U,m as $,n as W,t as Y,o as F,q as Z,v as tt}from"./index-Riy9XSe2.js";const et=190;async function dt(o){const{anyRunnerSessionConversation:n}=await E(async()=>{const{anyRunnerSessionConversation:a}=await import("./index-CUd4MgnK.js");return{anyRunnerSessionConversation:a}},__vite__mapDeps([0,1,2])),e=await n(o);return V(e)}function at(o,n){let a=0,s=!1;return async()=>{if(s)return null;const c=await window.desktopSessions.readRange(o,n,a,8388608);return a=c.nextStart,c.eof&&(s=!0),c.text}}function L(o){if(!o)return null;for(const n of N.getState().projects){const e=n.sourceSession;if(!e)continue;if(e.sessionId===o)return{project:n,entry:e};const a=e.chapters?.find(c=>c.sessionId===o);if(a)return{project:n,entry:a};const s=e.branches?.find(c=>c.sessionId===o);if(s)return{project:n,entry:s}}return null}function K(o,n,e,a,s){const c=a.position.x+(s?560:0),m=c-40,d=c+580,t=o.nodes.reduce((w,S)=>{const x=S.width??S.measured?.width??540;if(S.position.x+x<m||S.position.x>d)return w;const l=S.height??S.measured?.height??300;return Math.max(w,S.position.y+l)},s?a.position.y-300:a.position.y+(a.height??140)),u=c-n[0].position.x,f=Math.max(t+et,s?a.position.y:-1/0)-n[0].position.y,i=n.map(w=>({...w,position:{x:w.position.x+u,y:w.position.y+f}})),h=[{id:F(),source:a.id,target:i[0].id,type:"smoothstep"},...e];return{moved:i,edges:h}}async function V(o){if(!o)return null;const n=o.build(),e=n.nodes.filter(m=>m.data.importSource),a=e.at(-1)?.id??n.nodes.at(-1)?.id??"";if(n.nodes.length===0)return null;const s=L(o.sessionId);if(s)return G(o,n,e,a,s);if(o.sessionId){const m=await st(o.sessionId);if(m){let d=-1,t="";if(e.forEach((u,f)=>{const i=u.data.importSource?.itemIds?.[0],h=i?m.byFirstId.get(i):void 0;h&&(d=f,t=h)}),d>=0){await M(m.projectId,"chapter",{sessionId:o.sessionId,runner:o.source,importedCount:d+1,tailNodeId:t});const u=L(o.sessionId);if(u)return G(o,n,e,a,u)}}}if(o.sessionId&&e.length>0){const{parseAnchor:m}=await E(async()=>{const{parseAnchor:t}=await import("./experiment-loop-C7qTId-P.js");return{parseAnchor:t}},__vite__mapDeps([3,1,2])),d=m(e[0].data.question??"");if(d&&N.getState().projects.some(t=>t.id===d.project)){await O(d.project);const t=y.getState(),u=N.getState().projects.find(i=>i.id===d.project);let f=t.nodes.find(i=>i.id===d.node)??null;if(!f&&d.mode==="continue"&&u.sourceSession?.sessionId){const i=u.sourceSession;f=t.nodes.find(h=>h.id===i.tailNodeId)??t.nodes.filter(h=>h.data.importSource?.sessionId===i.sessionId).at(-1)??null}if(f){const i=n.nodes.find(l=>l.data.importSource&&l.data.stepKind!=="note");if(i&&m(i.data.question??"")){const l=H("exp.openerMark");i.data={...i.data,question:l,source:i.data.source?{...i.data.source,question:l}:i.data.source}}const h=new Set(n.nodes.map(l=>l.id)),w=n.edges.filter(l=>h.has(l.source)&&h.has(l.target)),S=d.mode!=="continue",x=K(t,n.nodes,w,f,S);if(S){const l=x.moved.find(_=>_.data.importSource&&_.data.stepKind!=="note");l&&(l.data={...l.data,isBranch:!0})}return t.pushHistory(),y.setState(l=>({nodes:[...l.nodes,...x.moved],edges:[...l.edges,...x.edges]})),await M(d.project,S?"branch":"chapter",{sessionId:o.sessionId,runner:o.source,importedCount:e.length,tailNodeId:a,anchorNodeId:f.id}),j.getState().setArrivalFocusNodeId(x.moved[x.moved.length-1].id),{kind:"mounted",mode:S?"branch":"continue",turns:e.length}}}}const c=crypto.randomUUID();return await X(q(c),JSON.stringify({state:{nodes:B(n.nodes),edges:n.edges},version:1})),j.getState().setArrivalFocusNodeId(n.nodes[n.nodes.length-1].id),await Q(c,o.title.slice(0,60),"chat",o.sessionId?{sourceSession:{sessionId:o.sessionId,runner:o.source,importedCount:e.length,tailNodeId:a}}:void 0),{kind:"imported",nodeCount:n.nodes.length}}async function ct(o,n){if(!o||!o.sessionId)return null;if(L(o.sessionId))return V(o);const e=o.build(),a=e.nodes.filter(i=>i.data.importSource);if(e.nodes.length===0)return null;await O(n);const s=y.getState(),c=N.getState().projects.find(i=>i.id===n);if(!c)return null;const m=c.sourceSession,d=(m?.sessionId?s.nodes.find(i=>i.id===m.tailNodeId)??s.nodes.filter(i=>i.data.importSource?.sessionId===m.sessionId).at(-1):null)??s.nodes.at(-1)??null;if(!d)return null;const t=new Set(e.nodes.map(i=>i.id)),u=e.edges.filter(i=>t.has(i.source)&&t.has(i.target)),f=K(s,e.nodes,u,d,!1);return s.pushHistory(),y.setState(i=>({nodes:[...i.nodes,...f.moved],edges:[...i.edges,...f.edges]})),await M(n,"chapter",{sessionId:o.sessionId,runner:o.source,importedCount:a.length,tailNodeId:a.at(-1)?.id??e.nodes.at(-1).id,anchorNodeId:d.id}),j.getState().setArrivalFocusNodeId(f.moved[f.moved.length-1].id),{kind:"mounted",mode:"continue",turns:a.length}}async function st(o){const{projects:n,activeId:e}=N.getState(),a=[...n].sort((s,c)=>s.id===e?-1:c.id===e?1:c.updatedAt-s.updatedAt);for(const s of a){if(s.id!==e&&s.provenanceSessions&&!s.provenanceSessions.includes(o))continue;let c;if(s.id===e)c=y.getState().nodes;else try{const{get:d}=await E(async()=>{const{get:f}=await import("./index-Riy9XSe2.js").then(i=>i.F);return{get:f}},__vite__mapDeps([1,2])),t=await d(q(s.id));c=(typeof t=="string"?JSON.parse(t):t)?.state?.nodes??[]}catch{continue}if(s.id!==e&&!s.provenanceSessions){const d=[...new Set(c.map(t=>t.data.importSource?.sessionId).filter(t=>!!t))];N.setState(t=>({projects:t.projects.map(u=>u.id===s.id?{...u,provenanceSessions:d}:u)}))}const m=new Map;for(const d of c)if(d.data.importSource?.sessionId===o&&d.data.stepKind!=="note"){const t=d.data.importSource.itemIds?.[0];t&&m.set(t,d.id)}if(m.size>0)return{projectId:s.id,byFirstId:m}}return null}async function G(o,n,e,a,s){await O(s.project.id);const c=y.getState(),m=c.nodes.filter(p=>p.data.importSource?.sessionId===o.sessionId),d=c.nodes.find(p=>p.id===s.entry.tailNodeId)??m.at(-1)??null,t=s.entry.importedCount>0&&e.length>=s.entry.importedCount?e[s.entry.importedCount-1]:null;if(t){const p=t.data.importSource?.itemIds?.[0],r=p?m.find(C=>C.data.importSource?.itemIds?.[0]===p):void 0,g=r?.data.source,k=!!g&&r.data.question===g.question&&(r.data.response??"")===(g.response??""),I=t.data,D=!!r&&(I.question!==r.data.question||(I.response??"")!==(r.data.response??"")),A=r?.data.attachments??[],T=I.attachments??[],J=!!r&&T.length>A.length&&A.every((C,R)=>T[R]?.name===C.name);if(r&&k&&(D||J)){const C=D?I.attachments:[...A,...T.slice(A.length)];y.setState(R=>({nodes:R.nodes.map(P=>P.id===r.id?{...P,data:{...P.data,question:I.question,response:I.response,responses:I.responses,responseIndex:I.responseIndex,tokenCount:I.tokenCount,attachments:C,importSource:I.importSource,source:I.source}}:P)})),y.getState().recomputeStaleness()}}if(e.length<=s.entry.importedCount)return j.getState().setArrivalFocusNodeId(d?.id??null),{kind:"opened"};const u=e[s.entry.importedCount],f=n.nodes.findIndex(p=>p.id===u.id),i=n.nodes.slice(f),h=new Set(i.map(p=>p.id)),w=n.edges.filter(p=>h.has(p.source)&&h.has(p.target)),S=new Map;for(const p of m){const r=p.data.importSource?.itemIds?.[0];r&&S.set(r,p.id)}const x=new Map;for(const p of n.nodes){const r=p.data.importSource?.itemIds?.[0];r&&!h.has(p.id)&&x.set(p.id,r)}const l=[];for(const p of n.edges){if(!h.has(p.target)||h.has(p.source))continue;const r=x.get(p.source),g=r?S.get(r):void 0;g&&l.push({...p,id:F(),source:g})}const _=new Set(l.map(p=>p.target));let v,b;if(d){const p=K(c,i,w,d,!1);v=p.moved;const r=new Set(w.map(g=>g.target));b=p.edges.filter(g=>!(g.source===d.id&&_.has(g.target)));for(const g of v)g.id!==v[0].id&&!r.has(g.id)&&!_.has(g.id)&&g.data.stepKind!=="note"&&b.push({id:F(),source:d.id,target:g.id,type:"smoothstep"});b=[...b,...l]}else{const r=(c.nodes.length?Math.max(...c.nodes.map(I=>I.position.x)):0)+560-i[0].position.x,g=-i[0].position.y;v=i.map(I=>({...I,position:{x:I.position.x+r,y:I.position.y+g}}));const k=nt(ot(e.length-s.entry.importedCount),v[0]);v=[k,...v],b=[{id:F(),source:k.id,target:v[1].id,type:"smoothstep"},...w]}return c.pushHistory(),y.setState(p=>({nodes:[...p.nodes,...v],edges:[...p.edges,...b]})),await Z(s.project.id,o.sessionId,{importedCount:e.length,tailNodeId:a}),j.getState().setArrivalFocusNodeId(v[d?0:1].id),{kind:"appended",turns:e.length-s.entry.importedCount}}function ot(o){return`[Mirror] The source session grew by ${o} turn(s); the earlier mirrored turns were removed from this canvas by hand, so the new turns land here on their own.`}function nt(o,n){const e=tt(o,"",!1);return e.data.stepKind="note",e.data.importSource=n.data.importSource?{...n.data.importSource,itemIds:[]}:void 0,e.width=460,e.position={x:n.position.x-520,y:n.position.y},e}async function ut(o){const{projects:n,activeId:e}=N.getState(),a=n.find(t=>t.id===o);if(!a?.sourceSession)return"native";if((a.sourceSession.chapters?.length??0)>0||(a.sourceSession.branches?.length??0)>0)return"diverged-mirror";let s;if(o===e)s=y.getState().nodes;else{const{get:t}=await E(async()=>{const{get:f}=await import("./index-Riy9XSe2.js").then(i=>i.F);return{get:f}},__vite__mapDeps([1,2])),u=await t(q(o));try{s=(typeof u=="string"?JSON.parse(u):u)?.state?.nodes??[]}catch{return"diverged-mirror"}}const c=a.sourceSession.sessionId,m=s.filter(t=>t.data.importSource?.sessionId===c);return s.some(t=>!t.data.importSource)||s.some(t=>t.data.importSource&&t.data.importSource.sessionId!==c)||m.filter(t=>t.data.source).length<a.sourceSession.importedCount||m.some(t=>t.data.source&&(t.data.question!==t.data.source.question||t.data.response!==t.data.source.response))?"diverged-mirror":"pristine-mirror"}async function pt(){const{bootProjects:o}=await E(async()=>{const{bootProjects:u}=await import("./index-Riy9XSe2.js").then(f=>f.H);return{bootProjects:u}},__vite__mapDeps([1,2]));await o();const{projects:n,activeId:e}=N.getState(),a=n.find(u=>u.id===e);if(!a?.sourceSession)return;const s=$(a);if(s.length===0)return;const c=new Set;for(const u of y.getState().nodes){const f=u.data.importSource?.sessionId;f&&c.add(f)}const m=s.filter(u=>!c.has(u));if(m.length===0)return;for(const u of m)await W(a.id,u);const t=N.getState().projects.find(u=>u.id===a.id)?.sourceSession?"toast.unsubscribed":"toast.unsubscribedNative";Y("info",U(H(t),{n:m.length}),8e3)}async function mt(o,n){const e=o.filter(d=>!!d&&!!d.sessionId);if(e.length===0)return null;const a=n??await z(U(H("atlas.mergedName"),{title:e[0].title.slice(0,24),n:e.length}));await O(a),y.getState().pushHistory();let s=0,c=0;for(const d of e){const t=d.sessionId;if(L(t)){c++;continue}const u=d.build();if(u.nodes.length===0){c++;continue}const f=u.nodes.filter(r=>r.data.importSource),i=y.getState().nodes,h=i.reduce((r,g)=>Math.max(r,g.position.x+(g.width??g.measured?.width??540)),-1/0),w=i.reduce((r,g)=>Math.min(r,g.position.y),1/0),S=Math.min(...u.nodes.map(r=>r.position.x)),x=Math.min(...u.nodes.map(r=>r.position.y)),l=(Number.isFinite(h)?h+180:0)-S,_=(Number.isFinite(w)?w:0)-x,v=u.nodes.map(r=>({...r,position:{x:r.position.x+l,y:r.position.y+_}})),b=new Set(v.map(r=>r.id)),p=u.edges.filter(r=>b.has(r.source)&&b.has(r.target));y.setState(r=>({nodes:[...r.nodes,...v],edges:[...r.edges,...p]})),await M(a,"chapter",{sessionId:t,runner:d.source,importedCount:f.length,tailNodeId:f.at(-1)?.id??v[v.length-1].id}),s++}y.getState().pushHistory();const m=y.getState().nodes.at(-1);return s>0&&m&&j.getState().setArrivalFocusNodeId(m.id),{mounted:s,skipped:c,projectId:a}}export{ut as canvasUniqueness,V as importOrAppendConversation,dt as importOrAppendSession,mt as mergeSessionsIntoProject,ct as mountConversationToProject,at as shellSessionReader,$ as subscribedSessionIds,pt as unsubscribeOrphanedSessions};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-_B6z8_Ff.js","assets/index-JMt9ljo3.js","assets/index-C3fERes9.css","assets/experiment-loop-pAs6MwPV.js"])))=>i.map(i=>d[i]);
2
+ import{c as N,b as y,_ as E,p as q,r as M,h as O,a as H,u as j,j as X,s as B,k as Q,l as z,f as U,m as $,n as W,t as Y,o as F,q as Z,v as tt}from"./index-JMt9ljo3.js";const et=190;async function dt(o){const{anyRunnerSessionConversation:n}=await E(async()=>{const{anyRunnerSessionConversation:a}=await import("./index-_B6z8_Ff.js");return{anyRunnerSessionConversation:a}},__vite__mapDeps([0,1,2])),e=await n(o);return V(e)}function at(o,n){let a=0,s=!1;return async()=>{if(s)return null;const c=await window.desktopSessions.readRange(o,n,a,8388608);return a=c.nextStart,c.eof&&(s=!0),c.text}}function L(o){if(!o)return null;for(const n of N.getState().projects){const e=n.sourceSession;if(!e)continue;if(e.sessionId===o)return{project:n,entry:e};const a=e.chapters?.find(c=>c.sessionId===o);if(a)return{project:n,entry:a};const s=e.branches?.find(c=>c.sessionId===o);if(s)return{project:n,entry:s}}return null}function K(o,n,e,a,s){const c=a.position.x+(s?560:0),m=c-40,d=c+580,t=o.nodes.reduce((w,S)=>{const x=S.width??S.measured?.width??540;if(S.position.x+x<m||S.position.x>d)return w;const l=S.height??S.measured?.height??300;return Math.max(w,S.position.y+l)},s?a.position.y-300:a.position.y+(a.height??140)),u=c-n[0].position.x,f=Math.max(t+et,s?a.position.y:-1/0)-n[0].position.y,i=n.map(w=>({...w,position:{x:w.position.x+u,y:w.position.y+f}})),h=[{id:F(),source:a.id,target:i[0].id,type:"smoothstep"},...e];return{moved:i,edges:h}}async function V(o){if(!o)return null;const n=o.build(),e=n.nodes.filter(m=>m.data.importSource),a=e.at(-1)?.id??n.nodes.at(-1)?.id??"";if(n.nodes.length===0)return null;const s=L(o.sessionId);if(s)return G(o,n,e,a,s);if(o.sessionId){const m=await st(o.sessionId);if(m){let d=-1,t="";if(e.forEach((u,f)=>{const i=u.data.importSource?.itemIds?.[0],h=i?m.byFirstId.get(i):void 0;h&&(d=f,t=h)}),d>=0){await M(m.projectId,"chapter",{sessionId:o.sessionId,runner:o.source,importedCount:d+1,tailNodeId:t});const u=L(o.sessionId);if(u)return G(o,n,e,a,u)}}}if(o.sessionId&&e.length>0){const{parseAnchor:m}=await E(async()=>{const{parseAnchor:t}=await import("./experiment-loop-pAs6MwPV.js");return{parseAnchor:t}},__vite__mapDeps([3,1,2])),d=m(e[0].data.question??"");if(d&&N.getState().projects.some(t=>t.id===d.project)){await O(d.project);const t=y.getState(),u=N.getState().projects.find(i=>i.id===d.project);let f=t.nodes.find(i=>i.id===d.node)??null;if(!f&&d.mode==="continue"&&u.sourceSession?.sessionId){const i=u.sourceSession;f=t.nodes.find(h=>h.id===i.tailNodeId)??t.nodes.filter(h=>h.data.importSource?.sessionId===i.sessionId).at(-1)??null}if(f){const i=n.nodes.find(l=>l.data.importSource&&l.data.stepKind!=="note");if(i&&m(i.data.question??"")){const l=H("exp.openerMark");i.data={...i.data,question:l,source:i.data.source?{...i.data.source,question:l}:i.data.source}}const h=new Set(n.nodes.map(l=>l.id)),w=n.edges.filter(l=>h.has(l.source)&&h.has(l.target)),S=d.mode!=="continue",x=K(t,n.nodes,w,f,S);if(S){const l=x.moved.find(_=>_.data.importSource&&_.data.stepKind!=="note");l&&(l.data={...l.data,isBranch:!0})}return t.pushHistory(),y.setState(l=>({nodes:[...l.nodes,...x.moved],edges:[...l.edges,...x.edges]})),await M(d.project,S?"branch":"chapter",{sessionId:o.sessionId,runner:o.source,importedCount:e.length,tailNodeId:a,anchorNodeId:f.id}),j.getState().setArrivalFocusNodeId(x.moved[x.moved.length-1].id),{kind:"mounted",mode:S?"branch":"continue",turns:e.length}}}}const c=crypto.randomUUID();return await X(q(c),JSON.stringify({state:{nodes:B(n.nodes),edges:n.edges},version:1})),j.getState().setArrivalFocusNodeId(n.nodes[n.nodes.length-1].id),await Q(c,o.title.slice(0,60),"chat",o.sessionId?{sourceSession:{sessionId:o.sessionId,runner:o.source,importedCount:e.length,tailNodeId:a}}:void 0),{kind:"imported",nodeCount:n.nodes.length}}async function ct(o,n){if(!o||!o.sessionId)return null;if(L(o.sessionId))return V(o);const e=o.build(),a=e.nodes.filter(i=>i.data.importSource);if(e.nodes.length===0)return null;await O(n);const s=y.getState(),c=N.getState().projects.find(i=>i.id===n);if(!c)return null;const m=c.sourceSession,d=(m?.sessionId?s.nodes.find(i=>i.id===m.tailNodeId)??s.nodes.filter(i=>i.data.importSource?.sessionId===m.sessionId).at(-1):null)??s.nodes.at(-1)??null;if(!d)return null;const t=new Set(e.nodes.map(i=>i.id)),u=e.edges.filter(i=>t.has(i.source)&&t.has(i.target)),f=K(s,e.nodes,u,d,!1);return s.pushHistory(),y.setState(i=>({nodes:[...i.nodes,...f.moved],edges:[...i.edges,...f.edges]})),await M(n,"chapter",{sessionId:o.sessionId,runner:o.source,importedCount:a.length,tailNodeId:a.at(-1)?.id??e.nodes.at(-1).id,anchorNodeId:d.id}),j.getState().setArrivalFocusNodeId(f.moved[f.moved.length-1].id),{kind:"mounted",mode:"continue",turns:a.length}}async function st(o){const{projects:n,activeId:e}=N.getState(),a=[...n].sort((s,c)=>s.id===e?-1:c.id===e?1:c.updatedAt-s.updatedAt);for(const s of a){if(s.id!==e&&s.provenanceSessions&&!s.provenanceSessions.includes(o))continue;let c;if(s.id===e)c=y.getState().nodes;else try{const{get:d}=await E(async()=>{const{get:f}=await import("./index-JMt9ljo3.js").then(i=>i.F);return{get:f}},__vite__mapDeps([1,2])),t=await d(q(s.id));c=(typeof t=="string"?JSON.parse(t):t)?.state?.nodes??[]}catch{continue}if(s.id!==e&&!s.provenanceSessions){const d=[...new Set(c.map(t=>t.data.importSource?.sessionId).filter(t=>!!t))];N.setState(t=>({projects:t.projects.map(u=>u.id===s.id?{...u,provenanceSessions:d}:u)}))}const m=new Map;for(const d of c)if(d.data.importSource?.sessionId===o&&d.data.stepKind!=="note"){const t=d.data.importSource.itemIds?.[0];t&&m.set(t,d.id)}if(m.size>0)return{projectId:s.id,byFirstId:m}}return null}async function G(o,n,e,a,s){await O(s.project.id);const c=y.getState(),m=c.nodes.filter(p=>p.data.importSource?.sessionId===o.sessionId),d=c.nodes.find(p=>p.id===s.entry.tailNodeId)??m.at(-1)??null,t=s.entry.importedCount>0&&e.length>=s.entry.importedCount?e[s.entry.importedCount-1]:null;if(t){const p=t.data.importSource?.itemIds?.[0],r=p?m.find(C=>C.data.importSource?.itemIds?.[0]===p):void 0,g=r?.data.source,k=!!g&&r.data.question===g.question&&(r.data.response??"")===(g.response??""),I=t.data,D=!!r&&(I.question!==r.data.question||(I.response??"")!==(r.data.response??"")),A=r?.data.attachments??[],T=I.attachments??[],J=!!r&&T.length>A.length&&A.every((C,R)=>T[R]?.name===C.name);if(r&&k&&(D||J)){const C=D?I.attachments:[...A,...T.slice(A.length)];y.setState(R=>({nodes:R.nodes.map(P=>P.id===r.id?{...P,data:{...P.data,question:I.question,response:I.response,responses:I.responses,responseIndex:I.responseIndex,tokenCount:I.tokenCount,attachments:C,importSource:I.importSource,source:I.source}}:P)})),y.getState().recomputeStaleness()}}if(e.length<=s.entry.importedCount)return j.getState().setArrivalFocusNodeId(d?.id??null),{kind:"opened"};const u=e[s.entry.importedCount],f=n.nodes.findIndex(p=>p.id===u.id),i=n.nodes.slice(f),h=new Set(i.map(p=>p.id)),w=n.edges.filter(p=>h.has(p.source)&&h.has(p.target)),S=new Map;for(const p of m){const r=p.data.importSource?.itemIds?.[0];r&&S.set(r,p.id)}const x=new Map;for(const p of n.nodes){const r=p.data.importSource?.itemIds?.[0];r&&!h.has(p.id)&&x.set(p.id,r)}const l=[];for(const p of n.edges){if(!h.has(p.target)||h.has(p.source))continue;const r=x.get(p.source),g=r?S.get(r):void 0;g&&l.push({...p,id:F(),source:g})}const _=new Set(l.map(p=>p.target));let v,b;if(d){const p=K(c,i,w,d,!1);v=p.moved;const r=new Set(w.map(g=>g.target));b=p.edges.filter(g=>!(g.source===d.id&&_.has(g.target)));for(const g of v)g.id!==v[0].id&&!r.has(g.id)&&!_.has(g.id)&&g.data.stepKind!=="note"&&b.push({id:F(),source:d.id,target:g.id,type:"smoothstep"});b=[...b,...l]}else{const r=(c.nodes.length?Math.max(...c.nodes.map(I=>I.position.x)):0)+560-i[0].position.x,g=-i[0].position.y;v=i.map(I=>({...I,position:{x:I.position.x+r,y:I.position.y+g}}));const k=nt(ot(e.length-s.entry.importedCount),v[0]);v=[k,...v],b=[{id:F(),source:k.id,target:v[1].id,type:"smoothstep"},...w]}return c.pushHistory(),y.setState(p=>({nodes:[...p.nodes,...v],edges:[...p.edges,...b]})),await Z(s.project.id,o.sessionId,{importedCount:e.length,tailNodeId:a}),j.getState().setArrivalFocusNodeId(v[d?0:1].id),{kind:"appended",turns:e.length-s.entry.importedCount}}function ot(o){return`[Mirror] The source session grew by ${o} turn(s); the earlier mirrored turns were removed from this canvas by hand, so the new turns land here on their own.`}function nt(o,n){const e=tt(o,"",!1);return e.data.stepKind="note",e.data.importSource=n.data.importSource?{...n.data.importSource,itemIds:[]}:void 0,e.width=460,e.position={x:n.position.x-520,y:n.position.y},e}async function ut(o){const{projects:n,activeId:e}=N.getState(),a=n.find(t=>t.id===o);if(!a?.sourceSession)return"native";if((a.sourceSession.chapters?.length??0)>0||(a.sourceSession.branches?.length??0)>0)return"diverged-mirror";let s;if(o===e)s=y.getState().nodes;else{const{get:t}=await E(async()=>{const{get:f}=await import("./index-JMt9ljo3.js").then(i=>i.F);return{get:f}},__vite__mapDeps([1,2])),u=await t(q(o));try{s=(typeof u=="string"?JSON.parse(u):u)?.state?.nodes??[]}catch{return"diverged-mirror"}}const c=a.sourceSession.sessionId,m=s.filter(t=>t.data.importSource?.sessionId===c);return s.some(t=>!t.data.importSource)||s.some(t=>t.data.importSource&&t.data.importSource.sessionId!==c)||m.filter(t=>t.data.source).length<a.sourceSession.importedCount||m.some(t=>t.data.source&&(t.data.question!==t.data.source.question||t.data.response!==t.data.source.response))?"diverged-mirror":"pristine-mirror"}async function pt(){const{bootProjects:o}=await E(async()=>{const{bootProjects:u}=await import("./index-JMt9ljo3.js").then(f=>f.H);return{bootProjects:u}},__vite__mapDeps([1,2]));await o();const{projects:n,activeId:e}=N.getState(),a=n.find(u=>u.id===e);if(!a?.sourceSession)return;const s=$(a);if(s.length===0)return;const c=new Set;for(const u of y.getState().nodes){const f=u.data.importSource?.sessionId;f&&c.add(f)}const m=s.filter(u=>!c.has(u));if(m.length===0)return;for(const u of m)await W(a.id,u);const t=N.getState().projects.find(u=>u.id===a.id)?.sourceSession?"toast.unsubscribed":"toast.unsubscribedNative";Y("info",U(H(t),{n:m.length}),8e3)}async function mt(o,n){const e=o.filter(d=>!!d&&!!d.sessionId);if(e.length===0)return null;const a=n??await z(U(H("atlas.mergedName"),{title:e[0].title.slice(0,24),n:e.length}));await O(a),y.getState().pushHistory();let s=0,c=0;for(const d of e){const t=d.sessionId;if(L(t)){c++;continue}const u=d.build();if(u.nodes.length===0){c++;continue}const f=u.nodes.filter(r=>r.data.importSource),i=y.getState().nodes,h=i.reduce((r,g)=>Math.max(r,g.position.x+(g.width??g.measured?.width??540)),-1/0),w=i.reduce((r,g)=>Math.min(r,g.position.y),1/0),S=Math.min(...u.nodes.map(r=>r.position.x)),x=Math.min(...u.nodes.map(r=>r.position.y)),l=(Number.isFinite(h)?h+180:0)-S,_=(Number.isFinite(w)?w:0)-x,v=u.nodes.map(r=>({...r,position:{x:r.position.x+l,y:r.position.y+_}})),b=new Set(v.map(r=>r.id)),p=u.edges.filter(r=>b.has(r.source)&&b.has(r.target));y.setState(r=>({nodes:[...r.nodes,...v],edges:[...r.edges,...p]})),await M(a,"chapter",{sessionId:t,runner:d.source,importedCount:f.length,tailNodeId:f.at(-1)?.id??v[v.length-1].id}),s++}y.getState().pushHistory();const m=y.getState().nodes.at(-1);return s>0&&m&&j.getState().setArrivalFocusNodeId(m.id),{mounted:s,skipped:c,projectId:a}}export{ut as canvasUniqueness,V as importOrAppendConversation,dt as importOrAppendSession,mt as mergeSessionsIntoProject,ct as mountConversationToProject,at as shellSessionReader,$ as subscribedSessionIds,pt as unsubscribeOrphanedSessions};
@@ -1 +1 @@
1
- import{b as c,c as p,E as m,s as v,d as w,e as h,g}from"./index-Riy9XSe2.js";const S=6e4,T=4e3;function y(e){const s=(e.data.attachments??[]).map(t=>({id:t.id,name:t.name,type:t.type,size:t.size,content:"",...t.addedAt?{addedAt:t.addedAt}:{},...t.extractedText?{extractedText:t.extractedText.slice(0,T)}:{},...t.paths?{paths:t.paths}:{},...t.op?{op:t.op}:{}}));return{...e,data:{...e.data,attachments:s}}}function j(){const{nodes:e,edges:s,events:t}=c.getState(),{projects:u,activeId:a}=p.getState();if(!a||e.length===0)return null;const r=u.find(l=>l.id===a),f=JSON.stringify({version:m,name:w(),projectId:a,exportedAt:new Date().toISOString(),record:"thoughtdag-canvas-record",instantiatedFrom:r?.instantiatedFrom,sourceSession:r?.sourceSession,nodes:v(e).map(y),edges:s,events:t});return{projectId:a,json:f}}let n=null,o=!1;async function d(){n&&(clearTimeout(n),n=null),o=!1;const e=window.desktopCanvas;if(!e)return!1;const s=j();return s?!!(await e.write(s.projectId,s.json).catch(()=>({ok:!1}))).ok:!1}function x(){o=!0,n&&clearTimeout(n),n=setTimeout(()=>{n=null,o&&d().catch(e=>console.warn("[thoughtdag] canvas record write failed:",e))},S)}let i=!1;function E(){i||h||typeof window>"u"||!window.desktopCanvas||(i=!0,c.subscribe((e,s)=>{(e.nodes!==s.nodes||e.edges!==s.edges||e.events!==s.events)&&x()}),g.push(async()=>{o&&await d()}),window.addEventListener("pagehide",()=>{o&&d()}))}async function R(e){await window.desktopCanvas?.remove(e).catch(()=>{})}export{j as canvasRecordPayload,d as flushCanvasRecord,R as removeCanvasRecord,E as startCanvasRecord};
1
+ import{b as c,c as p,E as m,s as v,d as w,e as h,g}from"./index-JMt9ljo3.js";const S=6e4,T=4e3;function y(e){const s=(e.data.attachments??[]).map(t=>({id:t.id,name:t.name,type:t.type,size:t.size,content:"",...t.addedAt?{addedAt:t.addedAt}:{},...t.extractedText?{extractedText:t.extractedText.slice(0,T)}:{},...t.paths?{paths:t.paths}:{},...t.op?{op:t.op}:{}}));return{...e,data:{...e.data,attachments:s}}}function j(){const{nodes:e,edges:s,events:t}=c.getState(),{projects:u,activeId:a}=p.getState();if(!a||e.length===0)return null;const r=u.find(l=>l.id===a),f=JSON.stringify({version:m,name:w(),projectId:a,exportedAt:new Date().toISOString(),record:"thoughtdag-canvas-record",instantiatedFrom:r?.instantiatedFrom,sourceSession:r?.sourceSession,nodes:v(e).map(y),edges:s,events:t});return{projectId:a,json:f}}let n=null,o=!1;async function d(){n&&(clearTimeout(n),n=null),o=!1;const e=window.desktopCanvas;if(!e)return!1;const s=j();return s?!!(await e.write(s.projectId,s.json).catch(()=>({ok:!1}))).ok:!1}function x(){o=!0,n&&clearTimeout(n),n=setTimeout(()=>{n=null,o&&d().catch(e=>console.warn("[thoughtdag] canvas record write failed:",e))},S)}let i=!1;function E(){i||h||typeof window>"u"||!window.desktopCanvas||(i=!0,c.subscribe((e,s)=>{(e.nodes!==s.nodes||e.edges!==s.edges||e.events!==s.events)&&x()}),g.push(async()=>{o&&await d()}),window.addEventListener("pagehide",()=>{o&&d()}))}async function R(e){await window.desktopCanvas?.remove(e).catch(()=>{})}export{j as canvasRecordPayload,d as flushCanvasRecord,R as removeCanvasRecord,E as startCanvasRecord};
@@ -1,4 +1,4 @@
1
- import{v as I,B as g,o as T}from"./index-Riy9XSe2.js";import{t as C,a as _,r as A,b as x,c as w,d as L,e as v,s as S,f as k,m as O,T as b,A as B,g as M}from"./shared-BbpS43F9.js";const q=16e3;function f(o){return typeof o=="string"?o:Array.isArray(o)?o.filter(t=>t.type==="text"&&t.text).map(t=>t.text).join(`
1
+ import{v as I,B as g,o as T}from"./index-JMt9ljo3.js";import{t as C,a as _,r as A,b as x,c as w,d as L,e as v,s as S,f as k,m as O,T as b,A as B,g as M}from"./shared-L3KzXorg.js";const q=16e3;function f(o){return typeof o=="string"?o:Array.isArray(o)?o.filter(t=>t.type==="text"&&t.text).map(t=>t.text).join(`
2
2
  `):""}function N(o){return typeof o=="string"?o:Array.isArray(o)?o.map(t=>t.type==="text"&&t.text?t.text:t.type==="image"?"[image result omitted]":"").filter(Boolean).join(`
3
3
  `):""}const p=v;class ${turns=[];pendingTools=new Map;current=null;pendingCompaction;sessionId=null;customTitle=null;summary=null;slug=null;firstQuestion=null;cwd=null;mode=null;feedLine(t){const s=t.trim();if(!s)return;let n;try{n=JSON.parse(s)}catch{return}this.feed(n)}flush(){const t=this.current;t&&(t.question||t.response||t.tools.length)&&this.turns.push(t),this.current=null}feed(t){if(t.type==="custom-title"&&t.customTitle&&(this.customTitle=t.customTitle),t.type==="summary"&&t.summary&&!this.summary&&(this.summary=t.summary),t.slug&&!this.slug&&(this.slug=t.slug),t.cwd&&!this.cwd&&(this.cwd=t.cwd),this.mode===null&&(t.type==="user"||t.type==="assistant")&&t.uuid&&(this.mode=t.isSidechain&&t.agentId?"sidechain":"main",this.mode==="sidechain"&&(this.sessionId=t.agentId)),!!t.isSidechain==(this.mode==="sidechain")){if(t.type==="system"&&t.subtype==="compact_boundary"){this.flush();const s=t.compactMetadata;this.pendingCompaction=`[Compaction] The source runner compacted its history here${s?.preTokens?` (${s.preTokens} → ${s.postTokens??"?"} tokens)`:""}. Everything above this point reached later turns only as a summary.`;return}if((t.type==="user"||t.type==="assistant")&&t.uuid&&t.sessionId&&!this.sessionId&&(this.sessionId=t.sessionId),t.type==="user"){const s=t.message?.content;if(Array.isArray(s)){for(const e of s)if(e.type==="tool_result"&&e.tool_use_id){const i=this.pendingTools.get(e.tool_use_id);if(i&&this.current){const a=p(N(e.content),b);this.current.tools.push({name:i.name,call:i.call,result:a.text,truncated:a.truncated,...i.paths.length?{paths:i.paths}:{},op:i.op,nativeCallId:e.tool_use_id,...i.url?{url:i.url}:{},...i.locator?{locator:i.locator}:{}}),this.pendingTools.delete(e.tool_use_id)}}}const n=f(s);if(!n.trim())return;if(/^\s*<task-notification>/.test(n)){if(this.current){const e=p(n,q);this.current.tools.push({name:"Agent",call:"(task notification)",result:e.text,truncated:e.truncated,op:"agent"})}return}this.flush(),this.firstQuestion||(this.firstQuestion=n.trim()),this.current={question:n,response:"",itemIds:t.uuid?[t.uuid]:[],tools:[],parentItemId:t.parentUuid??void 0,...t.timestamp?{at:t.timestamp}:{}},this.pendingCompaction&&(this.current.compactionBefore=this.pendingCompaction,this.pendingCompaction=void 0);return}if(t.type==="assistant"&&this.current){t.uuid&&this.current.itemIds.push(t.uuid);const s=t.message?.content,n=f(s);if(n.trim()&&(this.current.response=this.current.response?`${this.current.response}
4
4
 
@@ -1,4 +1,4 @@
1
- import{v as p,o as d,B as m}from"./index-Riy9XSe2.js";import{t as y,a as _,d as g,e as I,m as x,f as T,s as C,A as w,g as v,T as A}from"./shared-BbpS43F9.js";function B(n){const t=[];for(const e of n.matchAll(/^\*\*\* (?:Add|Update|Delete) File: (.+)$/gm))t.push(e[1].trim());return t}const h=I,L=n=>(n??[]).filter(t=>t.text&&(t.type==="input_text"||t.type==="output_text"||t.type==="text")).map(t=>t.text).join(`
1
+ import{v as p,o as d,B as m}from"./index-JMt9ljo3.js";import{t as y,a as _,d as g,e as I,m as x,f as T,s as C,A as w,g as v,T as A}from"./shared-L3KzXorg.js";function B(n){const t=[];for(const e of n.matchAll(/^\*\*\* (?:Add|Update|Delete) File: (.+)$/gm))t.push(e[1].trim());return t}const h=I,L=n=>(n??[]).filter(t=>t.text&&(t.type==="input_text"||t.type==="output_text"||t.type==="text")).map(t=>t.text).join(`
2
2
  `),S=/^\s*<\/?[a-zA-Z_][\w-]*[^>]*>/,q=n=>S.test(n)||n.trimStart().startsWith("# AGENTS.md instructions for "),O=n=>(n??[]).filter(t=>t.text&&(t.type==="input_text"||t.type==="text")&&!q(t.text)).map(t=>t.text).join(`
3
3
  `),N=n=>typeof n=="string"?n:Array.isArray(n)?n.map(t=>t?.text??"").filter(Boolean).join(`
4
4
  `):n==null?"":JSON.stringify(n);class ${turns=[];pendingCalls=new Map;current=null;pendingCompaction;sessionId=null;cwd="";day="";sawItems=!1;firstQuestion=null;parentThreadId=null;feedLine(t){const e=t.trim();if(!e)return;let s;try{s=JSON.parse(e)}catch{return}this.feed(s)}flush(){const t=this.current;t&&(t.question||t.response||t.tools.length)&&this.turns.push(t),this.current=null}ensure(){return this.current||(this.current={question:"",response:"",itemIds:[],tools:[]},this.pendingCompaction&&(this.current.compactionBefore=this.pendingCompaction,this.pendingCompaction=void 0)),this.current}feed(t){const e=t.payload??{};if(t.type==="session_meta"&&e.id&&!this.sessionId){this.sessionId=e.id,this.cwd=e.cwd??"",this.day=e.timestamp?.slice(0,10)??"",this.parentThreadId=e.parent_thread_id??null;return}if((t.type==="response_item"||t.type==="event_msg")&&(this.sawItems=!0),t.type==="compacted"){this.flush(),this.pendingCompaction="[Compaction] The source runner compacted its history here. Everything above this point reached later turns only as a summary.";return}if(t.type==="turn_context"||t.type==="event_msg"&&e.type==="task_started"){this.flush();const s=this.ensure();e.turn_id&&s.itemIds.push(e.turn_id);return}if(t.type==="response_item"){if(e.type==="message"){if(e.role==="user"){const s=O(e.content);if(s.trim()){this.firstQuestion||(this.firstQuestion=s.trim());const o=this.ensure();!o.at&&t.timestamp&&(o.at=t.timestamp),o.question=o.question?`${o.question}
@@ -1,4 +1,4 @@
1
- import{v as T,B as w,o as C}from"./index-Riy9XSe2.js";import{t as x,a as l,b as f,c as p,e as d,r as g,d as L,T as m,A as h,g as I,f as S,s as A}from"./shared-BbpS43F9.js";function c(o,s=0){return typeof o=="string"?o:!Array.isArray(o)||s>2?"":o.map(t=>{if(!t||typeof t!="object")return"";const e=t;return e.type==="text"&&typeof e.text=="string"?e.text:e.type==="image"?"[image omitted]":e.type==="reasoning"?"":c(e.text??e.content,s+1)}).filter(Boolean).join(`
1
+ import{v as T,B as w,o as C}from"./index-JMt9ljo3.js";import{t as x,a as l,b as f,c as p,e as d,r as g,d as L,T as m,A as h,g as I,f as S,s as A}from"./shared-L3KzXorg.js";function c(o,s=0){return typeof o=="string"?o:!Array.isArray(o)||s>2?"":o.map(t=>{if(!t||typeof t!="object")return"";const e=t;return e.type==="text"&&typeof e.text=="string"?e.text:e.type==="image"?"[image omitted]":e.type==="reasoning"?"":c(e.text??e.content,s+1)}).filter(Boolean).join(`
2
2
  `)}function O(o,s,t){const e=l(o);if(e==="run"||/^run_code$/i.test(o)){const r=t??{};return d(typeof r.code=="string"?r.code:s,h)}const n=t&&typeof t=="object"?g(o,t):s;return d(n,e==="write"||e==="edit"?h:I)}const b=o=>{try{return JSON.parse(o??"")}catch{return}};class q{turns=[];pendingTools=new Map;current=null;sessionId=null;cwd=null;title=null;firstQuestion=null;feedLine(s){const t=s.trim();if(!t)return;let e;try{e=JSON.parse(t)}catch{return}this.feed(e)}flush(){const s=this.current;s&&(s.question||s.response||s.tools.length)&&this.turns.push(s),this.current=null}ensure(){return this.current||(this.current={question:"",response:"",itemIds:[],tools:[]}),this.current}feed(s){if(s.type==="session"&&s.id&&!("timestamp"in s)){this.sessionId||(this.sessionId=s.id),s.cwd&&!this.cwd&&(this.cwd=s.cwd);return}if(s.type==="session/title"&&s.data?.title&&!this.title){this.title=s.data.title;return}if(s.type==="user/message"){const t=s,e=t.data?.source?.kind;if(e&&e!=="user")return;const n=c(t.data?.content).trim();if(!n)return;this.firstQuestion||(this.firstQuestion=n.split(`
3
3
  `)[0].slice(0,80)),this.flush();const r=this.ensure();r.question=n,r.itemIds=[t.data?.id??`u${t.seq}`],t.time&&(r.at=new Date(t.time).toISOString());return}if(s.type==="assistant/message"&&this.current){const t=s,e=t.data?.message?.content,n=c(e).trim(),r=t.data?.message?.id;r&&this.current.itemIds.push(r),n&&(this.current.response=this.current.response?`${this.current.response}
4
4
 
@@ -1,2 +1,2 @@
1
- import{a as c,b as l,c as p,x as h,t as u,f as m}from"./index-Riy9XSe2.js";const b=/\[ThoughtDAG anchor: project=([\w-]+) node=([\w-]+) bundle=([\w-]+)(?: mode=(branch|continue))?\]/;function f(o){const n=o.match(b);return n?{project:n[1],node:n[2],bundle:n[3],mode:n[4]==="continue"?"continue":"branch"}:null}function g(o,n){const e=[];e.push(c("exp.mdIntro")),e.push("");for(const s of o.context.messages){const t=s.content[0].text;switch(s.source.layer){case"system":e.push(`**${c("exp.mdRole")}** ${t}`);break;case"chain":e.push(s.role==="assistant"?`**A:** ${t}`:`**Q:** ${t}`);break;default:e.push(t)}e.push("")}return e.push("---"),e.push(c("exp.mdOutro")),e.push(""),e.push(`[ThoughtDAG anchor: project=${n.project} node=${n.node} bundle=${n.bundle}${n.mode==="continue"?" mode=continue":""}]`),e.join(`
1
+ import{a as c,b as l,c as p,x as h,t as u,f as m}from"./index-JMt9ljo3.js";const b=/\[ThoughtDAG anchor: project=([\w-]+) node=([\w-]+) bundle=([\w-]+)(?: mode=(branch|continue))?\]/;function f(o){const n=o.match(b);return n?{project:n[1],node:n[2],bundle:n[3],mode:n[4]==="continue"?"continue":"branch"}:null}function g(o,n){const e=[];e.push(c("exp.mdIntro")),e.push("");for(const s of o.context.messages){const t=s.content[0].text;switch(s.source.layer){case"system":e.push(`**${c("exp.mdRole")}** ${t}`);break;case"chain":e.push(s.role==="assistant"?`**A:** ${t}`:`**Q:** ${t}`);break;default:e.push(t)}e.push("")}return e.push("---"),e.push(c("exp.mdOutro")),e.push(""),e.push(`[ThoughtDAG anchor: project=${n.project} node=${n.node} bundle=${n.bundle}${n.mode==="continue"?" mode=continue":""}]`),e.join(`
2
2
  `)}async function w(o,n="branch"){const e=l.getState(),s=p.getState().activeId??"default",t=await h(o,e.nodes,e.edges,{now:new Date().toISOString(),projectId:s,staleIds:e.staleIds}),d={project:s,node:o,bundle:t.id,mode:n},i=g(t,d);try{await navigator.clipboard.writeText(i)}catch{return u("error",c("exp.clipboardFailed")),!1}{const a=[...new Set(t.context.messages.map(r=>r.source?.node_id).filter(r=>!!r))];e.logEvent("commit",o,{kind:"bundle",sha:t.integrity.content_hash,bundle:t.id,n:t.context.messages.length,...a.length?{m:a.slice(0,200).join(",")}:{},...a.length>200?{more:!0}:{}})}return u("success",m(c("exp.copied"),{n:t.context.messages.length,tok:t.budget.estimated_tokens}),12e3),!0}export{f as parseAnchor,g as renderHandoffMarkdown,w as takeToExperiment};
@@ -1,4 +1,4 @@
1
- import{y as Os,z as pn,A as Is}from"./index-Riy9XSe2.js";function Ns(e,n){for(var t=0;t<n.length;t++){const r=n[t];if(typeof r!="string"&&!Array.isArray(r)){for(const c in r)if(c!=="default"&&!(c in e)){const i=Object.getOwnPropertyDescriptor(r,c);i&&Object.defineProperty(e,c,i.get?i:{enumerable:!0,get:()=>r[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Ze={},Ii="1.13.8",Fa=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},nr=Array.prototype,Ni=Object.prototype,Ca=typeof Symbol<"u"?Symbol.prototype:null,Ls=nr.push,dt=nr.slice,it=Ni.toString,Ms=Ni.hasOwnProperty,$c=typeof ArrayBuffer<"u",qs=typeof DataView<"u",Ps=Array.isArray,Sa=Object.keys,Ba=Object.create,ka=$c&&ArrayBuffer.isView,zs=isNaN,js=isFinite,Yc=!{toString:null}.propertyIsEnumerable("toString"),Wa=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Xs=Math.pow(2,53)-1;function ze(e,n){return n=n==null?e.length-1:+n,function(){for(var t=Math.max(arguments.length-n,0),r=Array(t),c=0;c<t;c++)r[c]=arguments[c+n];switch(n){case 0:return e.call(this,r);case 1:return e.call(this,arguments[0],r);case 2:return e.call(this,arguments[0],arguments[1],r)}var i=Array(n+1);for(c=0;c<n;c++)i[c]=arguments[c];return i[n]=r,e.apply(this,i)}}function bn(e){var n=typeof e;return n==="function"||n==="object"&&!!e}function Kc(e){return e===null}function Li(e){return e===void 0}function Mi(e){return e===!0||e===!1||it.call(e)==="[object Boolean]"}function Qc(e){return!!(e&&e.nodeType===1)}function Pe(e){var n="[object "+e+"]";return function(t){return it.call(t)===n}}const tr=Pe("String"),qi=Pe("Number"),Jc=Pe("Date"),eu=Pe("RegExp"),nu=Pe("Error"),Pi=Pe("Symbol"),zi=Pe("ArrayBuffer");var tu=Pe("Function"),Vs=Fa.document&&Fa.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof Vs!="function"&&(tu=function(e){return typeof e=="function"||!1});const qe=tu,ru=Pe("Object");var iu=qs&&(!/\[native code\]/.test(String(DataView))||ru(new DataView(new ArrayBuffer(8)))),ji=typeof Map<"u"&&ru(new Map),Hs=Pe("DataView");function Gs(e){return e!=null&&qe(e.getInt8)&&zi(e.buffer)}const at=iu?Gs:Hs,yn=Ps||Pe("Array");function Dn(e,n){return e!=null&&Ms.call(e,n)}var Ri=Pe("Arguments");(function(){Ri(arguments)||(Ri=function(e){return Dn(e,"callee")})})();const rr=Ri;function au(e){return!Pi(e)&&js(e)&&!isNaN(parseFloat(e))}function Xi(e){return qi(e)&&zs(e)}function Vi(e){return function(){return e}}function ou(e){return function(n){var t=e(n);return typeof t=="number"&&t>=0&&t<=Xs}}function cu(e){return function(n){return n?.[e]}}const Yt=cu("byteLength"),Zs=ou(Yt);var $s=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function Ys(e){return ka?ka(e)&&!at(e):Zs(e)&&$s.test(it.call(e))}const Hi=$c?Ys:Vi(!1),Me=cu("length");function Ks(e){for(var n={},t=e.length,r=0;r<t;++r)n[e[r]]=!0;return{contains:function(c){return n[c]===!0},push:function(c){return n[c]=!0,e.push(c)}}}function uu(e,n){n=Ks(n);var t=Wa.length,r=e.constructor,c=qe(r)&&r.prototype||Ni,i="constructor";for(Dn(e,i)&&!n.contains(i)&&n.push(i);t--;)i=Wa[t],i in e&&e[i]!==c[i]&&!n.contains(i)&&n.push(i)}function Oe(e){if(!bn(e))return[];if(Sa)return Sa(e);var n=[];for(var t in e)Dn(e,t)&&n.push(t);return Yc&&uu(e,n),n}function su(e){if(e==null)return!0;var n=Me(e);return typeof n=="number"&&(yn(e)||tr(e)||rr(e))?n===0:Me(Oe(e))===0}function Gi(e,n){var t=Oe(n),r=t.length;if(e==null)return!r;for(var c=Object(e),i=0;i<r;i++){var a=t[i];if(n[a]!==c[a]||!(a in c))return!1}return!0}function Ae(e){if(e instanceof Ae)return e;if(!(this instanceof Ae))return new Ae(e);this._wrapped=e}Ae.VERSION=Ii;Ae.prototype.value=function(){return this._wrapped};Ae.prototype.valueOf=Ae.prototype.toJSON=Ae.prototype.value;Ae.prototype.toString=function(){return String(this._wrapped)};function Ra(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,Yt(e))}var Oa="[object DataView]";function du(e,n){for(var t=[{a:e,b:n}],r=[],c=[];t.length;){var i=t.pop();if(i===!0){r.pop(),c.pop();continue}if(e=i.a,n=i.b,e===n){if(e!==0||1/e===1/n)continue;return!1}if(e==null||n==null)return!1;if(e!==e){if(n!==n)continue;return!1}var a=typeof e;if(a!=="function"&&a!=="object"&&typeof n!="object")return!1;e instanceof Ae&&(e=e._wrapped),n instanceof Ae&&(n=n._wrapped);var o=it.call(e);if(o!==it.call(n))return!1;if(iu&&o=="[object Object]"&&at(e)){if(!at(n))return!1;o=Oa}switch(o){case"[object RegExp]":case"[object String]":if(""+e==""+n)continue;return!1;case"[object Number]":t.push({a:+e,b:+n});continue;case"[object Date]":case"[object Boolean]":if(+e==+n)continue;return!1;case"[object Symbol]":if(Ca.valueOf.call(e)===Ca.valueOf.call(n))continue;return!1;case"[object ArrayBuffer]":case Oa:t.push({a:Ra(e),b:Ra(n)});continue}var u=o==="[object Array]";if(!u&&Hi(e)){var h=Yt(e);if(h!==Yt(n))return!1;if(e.buffer===n.buffer&&e.byteOffset===n.byteOffset)continue;u=!0}if(!u){if(typeof e!="object"||typeof n!="object")return!1;var b=e.constructor,m=n.constructor;if(b!==m&&!(qe(b)&&b instanceof b&&qe(m)&&m instanceof m)&&"constructor"in e&&"constructor"in n)return!1}for(var g=r.length;g--;)if(r[g]===e){if(c[g]===n)break;return!1}if(!(g>=0))if(r.push(e),c.push(n),t.push(!0),u){if(g=e.length,g!==n.length)return!1;for(;g--;)t.push({a:e[g],b:n[g]})}else{var f=Oe(e),y;if(g=f.length,Oe(n).length!==g)return!1;for(;g--;){if(y=f[g],!Dn(n,y))return!1;t.push({a:e[y],b:n[y]})}}}return!0}function jn(e){if(!bn(e))return[];var n=[];for(var t in e)n.push(t);return Yc&&uu(e,n),n}function Zi(e){var n=Me(e);return function(t){if(t==null)return!1;var r=jn(t);if(Me(r))return!1;for(var c=0;c<n;c++)if(!qe(t[e[c]]))return!1;return e!==hu||!qe(t[$i])}}var $i="forEach",lu="has",Yi=["clear","delete"],fu=["get",lu,"set"],Qs=Yi.concat($i,fu),hu=Yi.concat(fu),Js=["add"].concat(Yi,$i,lu);const pu=ji?Zi(Qs):Pe("Map"),gu=ji?Zi(hu):Pe("WeakMap"),mu=ji?Zi(Js):Pe("Set"),bu=Pe("WeakSet");function kn(e){for(var n=Oe(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=e[n[c]];return r}function yu(e){for(var n=Oe(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=[n[c],e[n[c]]];return r}function Ki(e){for(var n={},t=Oe(e),r=0,c=t.length;r<c;r++)n[e[t[r]]]=t[r];return n}function ot(e){var n=[];for(var t in e)qe(e[t])&&n.push(t);return n.sort()}function Qi(e,n){return function(t){var r=arguments.length;if(n&&(t=Object(t)),r<2||t==null)return t;for(var c=1;c<r;c++)for(var i=arguments[c],a=e(i),o=a.length,u=0;u<o;u++){var h=a[u];(!n||t[h]===void 0)&&(t[h]=i[h])}return t}}const Ji=Qi(jn),Pn=Qi(Oe),ea=Qi(jn,!0);function ed(){return function(){}}function Du(e){if(!bn(e))return{};if(Ba)return Ba(e);var n=ed();n.prototype=e;var t=new n;return n.prototype=null,t}function vu(e,n){var t=Du(e);return n&&Pn(t,n),t}function xu(e){return bn(e)?yn(e)?e.slice():Ji({},e):e}function _u(e,n){return n(e),e}function na(e){return yn(e)?e:[e]}Ae.toPath=na;function lt(e){return Ae.toPath(e)}function ta(e,n){for(var t=n.length,r=0;r<t;r++){if(e==null)return;e=e[n[r]]}return t?e:void 0}function ra(e,n,t){var r=ta(e,lt(n));return Li(r)?t:r}function Uu(e,n){n=lt(n);for(var t=n.length,r=0;r<t;r++){var c=n[r];if(!Dn(e,c))return!1;e=e[c]}return!!t}function ir(e){return e}function Bn(e){return e=Pn({},e),function(n){return Gi(n,e)}}function ar(e){return e=lt(e),function(n){return ta(n,e)}}function ft(e,n,t){if(n===void 0)return e;switch(t??3){case 1:return function(r){return e.call(n,r)};case 3:return function(r,c,i){return e.call(n,r,c,i)};case 4:return function(r,c,i,a){return e.call(n,r,c,i,a)}}return function(){return e.apply(n,arguments)}}function Tu(e,n,t){return e==null?ir:qe(e)?ft(e,n,t):bn(e)&&!yn(e)?Bn(e):ar(e)}function or(e,n){return Tu(e,n,1/0)}Ae.iteratee=or;function je(e,n,t){return Ae.iteratee!==or?Ae.iteratee(e,n):Tu(e,n,t)}function wu(e,n,t){n=je(n,t);for(var r=Oe(e),c=r.length,i={},a=0;a<c;a++){var o=r[a];i[o]=n(e[o],o,e)}return i}function ia(){}function Eu(e){return e==null?ia:function(n){return ra(e,n)}}function Au(e,n,t){var r=Array(Math.max(0,e));n=ft(n,t,1);for(var c=0;c<e;c++)r[c]=n(c);return r}function Kt(e,n){return n==null&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))}const zn=Date.now||function(){return new Date().getTime()};function Fu(e){var n=function(i){return e[i]},t="(?:"+Oe(e).join("|")+")",r=RegExp(t),c=RegExp(t,"g");return function(i){return i=i==null?"":""+i,r.test(i)?i.replace(c,n):i}}const Cu={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},Su=Fu(Cu),nd=Ki(Cu),Bu=Fu(nd),ku=Ae.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var Fr=/(.)^/,td={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},rd=/\\|'|\r|\n|\u2028|\u2029/g;function id(e){return"\\"+td[e]}var ad=/^\s*(\w|\$)+\s*$/;function Wu(e,n,t){!n&&t&&(n=t),n=ea({},n,Ae.templateSettings);var r=RegExp([(n.escape||Fr).source,(n.interpolate||Fr).source,(n.evaluate||Fr).source].join("|")+"|$","g"),c=0,i="__p+='";e.replace(r,function(h,b,m,g,f){return i+=e.slice(c,f).replace(rd,id),c=f+h.length,b?i+=`'+
1
+ import{y as Os,z as pn,A as Is}from"./index-JMt9ljo3.js";function Ns(e,n){for(var t=0;t<n.length;t++){const r=n[t];if(typeof r!="string"&&!Array.isArray(r)){for(const c in r)if(c!=="default"&&!(c in e)){const i=Object.getOwnPropertyDescriptor(r,c);i&&Object.defineProperty(e,c,i.get?i:{enumerable:!0,get:()=>r[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Ze={},Ii="1.13.8",Fa=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},nr=Array.prototype,Ni=Object.prototype,Ca=typeof Symbol<"u"?Symbol.prototype:null,Ls=nr.push,dt=nr.slice,it=Ni.toString,Ms=Ni.hasOwnProperty,$c=typeof ArrayBuffer<"u",qs=typeof DataView<"u",Ps=Array.isArray,Sa=Object.keys,Ba=Object.create,ka=$c&&ArrayBuffer.isView,zs=isNaN,js=isFinite,Yc=!{toString:null}.propertyIsEnumerable("toString"),Wa=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Xs=Math.pow(2,53)-1;function ze(e,n){return n=n==null?e.length-1:+n,function(){for(var t=Math.max(arguments.length-n,0),r=Array(t),c=0;c<t;c++)r[c]=arguments[c+n];switch(n){case 0:return e.call(this,r);case 1:return e.call(this,arguments[0],r);case 2:return e.call(this,arguments[0],arguments[1],r)}var i=Array(n+1);for(c=0;c<n;c++)i[c]=arguments[c];return i[n]=r,e.apply(this,i)}}function bn(e){var n=typeof e;return n==="function"||n==="object"&&!!e}function Kc(e){return e===null}function Li(e){return e===void 0}function Mi(e){return e===!0||e===!1||it.call(e)==="[object Boolean]"}function Qc(e){return!!(e&&e.nodeType===1)}function Pe(e){var n="[object "+e+"]";return function(t){return it.call(t)===n}}const tr=Pe("String"),qi=Pe("Number"),Jc=Pe("Date"),eu=Pe("RegExp"),nu=Pe("Error"),Pi=Pe("Symbol"),zi=Pe("ArrayBuffer");var tu=Pe("Function"),Vs=Fa.document&&Fa.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof Vs!="function"&&(tu=function(e){return typeof e=="function"||!1});const qe=tu,ru=Pe("Object");var iu=qs&&(!/\[native code\]/.test(String(DataView))||ru(new DataView(new ArrayBuffer(8)))),ji=typeof Map<"u"&&ru(new Map),Hs=Pe("DataView");function Gs(e){return e!=null&&qe(e.getInt8)&&zi(e.buffer)}const at=iu?Gs:Hs,yn=Ps||Pe("Array");function Dn(e,n){return e!=null&&Ms.call(e,n)}var Ri=Pe("Arguments");(function(){Ri(arguments)||(Ri=function(e){return Dn(e,"callee")})})();const rr=Ri;function au(e){return!Pi(e)&&js(e)&&!isNaN(parseFloat(e))}function Xi(e){return qi(e)&&zs(e)}function Vi(e){return function(){return e}}function ou(e){return function(n){var t=e(n);return typeof t=="number"&&t>=0&&t<=Xs}}function cu(e){return function(n){return n?.[e]}}const Yt=cu("byteLength"),Zs=ou(Yt);var $s=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function Ys(e){return ka?ka(e)&&!at(e):Zs(e)&&$s.test(it.call(e))}const Hi=$c?Ys:Vi(!1),Me=cu("length");function Ks(e){for(var n={},t=e.length,r=0;r<t;++r)n[e[r]]=!0;return{contains:function(c){return n[c]===!0},push:function(c){return n[c]=!0,e.push(c)}}}function uu(e,n){n=Ks(n);var t=Wa.length,r=e.constructor,c=qe(r)&&r.prototype||Ni,i="constructor";for(Dn(e,i)&&!n.contains(i)&&n.push(i);t--;)i=Wa[t],i in e&&e[i]!==c[i]&&!n.contains(i)&&n.push(i)}function Oe(e){if(!bn(e))return[];if(Sa)return Sa(e);var n=[];for(var t in e)Dn(e,t)&&n.push(t);return Yc&&uu(e,n),n}function su(e){if(e==null)return!0;var n=Me(e);return typeof n=="number"&&(yn(e)||tr(e)||rr(e))?n===0:Me(Oe(e))===0}function Gi(e,n){var t=Oe(n),r=t.length;if(e==null)return!r;for(var c=Object(e),i=0;i<r;i++){var a=t[i];if(n[a]!==c[a]||!(a in c))return!1}return!0}function Ae(e){if(e instanceof Ae)return e;if(!(this instanceof Ae))return new Ae(e);this._wrapped=e}Ae.VERSION=Ii;Ae.prototype.value=function(){return this._wrapped};Ae.prototype.valueOf=Ae.prototype.toJSON=Ae.prototype.value;Ae.prototype.toString=function(){return String(this._wrapped)};function Ra(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,Yt(e))}var Oa="[object DataView]";function du(e,n){for(var t=[{a:e,b:n}],r=[],c=[];t.length;){var i=t.pop();if(i===!0){r.pop(),c.pop();continue}if(e=i.a,n=i.b,e===n){if(e!==0||1/e===1/n)continue;return!1}if(e==null||n==null)return!1;if(e!==e){if(n!==n)continue;return!1}var a=typeof e;if(a!=="function"&&a!=="object"&&typeof n!="object")return!1;e instanceof Ae&&(e=e._wrapped),n instanceof Ae&&(n=n._wrapped);var o=it.call(e);if(o!==it.call(n))return!1;if(iu&&o=="[object Object]"&&at(e)){if(!at(n))return!1;o=Oa}switch(o){case"[object RegExp]":case"[object String]":if(""+e==""+n)continue;return!1;case"[object Number]":t.push({a:+e,b:+n});continue;case"[object Date]":case"[object Boolean]":if(+e==+n)continue;return!1;case"[object Symbol]":if(Ca.valueOf.call(e)===Ca.valueOf.call(n))continue;return!1;case"[object ArrayBuffer]":case Oa:t.push({a:Ra(e),b:Ra(n)});continue}var u=o==="[object Array]";if(!u&&Hi(e)){var h=Yt(e);if(h!==Yt(n))return!1;if(e.buffer===n.buffer&&e.byteOffset===n.byteOffset)continue;u=!0}if(!u){if(typeof e!="object"||typeof n!="object")return!1;var b=e.constructor,m=n.constructor;if(b!==m&&!(qe(b)&&b instanceof b&&qe(m)&&m instanceof m)&&"constructor"in e&&"constructor"in n)return!1}for(var g=r.length;g--;)if(r[g]===e){if(c[g]===n)break;return!1}if(!(g>=0))if(r.push(e),c.push(n),t.push(!0),u){if(g=e.length,g!==n.length)return!1;for(;g--;)t.push({a:e[g],b:n[g]})}else{var f=Oe(e),y;if(g=f.length,Oe(n).length!==g)return!1;for(;g--;){if(y=f[g],!Dn(n,y))return!1;t.push({a:e[y],b:n[y]})}}}return!0}function jn(e){if(!bn(e))return[];var n=[];for(var t in e)n.push(t);return Yc&&uu(e,n),n}function Zi(e){var n=Me(e);return function(t){if(t==null)return!1;var r=jn(t);if(Me(r))return!1;for(var c=0;c<n;c++)if(!qe(t[e[c]]))return!1;return e!==hu||!qe(t[$i])}}var $i="forEach",lu="has",Yi=["clear","delete"],fu=["get",lu,"set"],Qs=Yi.concat($i,fu),hu=Yi.concat(fu),Js=["add"].concat(Yi,$i,lu);const pu=ji?Zi(Qs):Pe("Map"),gu=ji?Zi(hu):Pe("WeakMap"),mu=ji?Zi(Js):Pe("Set"),bu=Pe("WeakSet");function kn(e){for(var n=Oe(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=e[n[c]];return r}function yu(e){for(var n=Oe(e),t=n.length,r=Array(t),c=0;c<t;c++)r[c]=[n[c],e[n[c]]];return r}function Ki(e){for(var n={},t=Oe(e),r=0,c=t.length;r<c;r++)n[e[t[r]]]=t[r];return n}function ot(e){var n=[];for(var t in e)qe(e[t])&&n.push(t);return n.sort()}function Qi(e,n){return function(t){var r=arguments.length;if(n&&(t=Object(t)),r<2||t==null)return t;for(var c=1;c<r;c++)for(var i=arguments[c],a=e(i),o=a.length,u=0;u<o;u++){var h=a[u];(!n||t[h]===void 0)&&(t[h]=i[h])}return t}}const Ji=Qi(jn),Pn=Qi(Oe),ea=Qi(jn,!0);function ed(){return function(){}}function Du(e){if(!bn(e))return{};if(Ba)return Ba(e);var n=ed();n.prototype=e;var t=new n;return n.prototype=null,t}function vu(e,n){var t=Du(e);return n&&Pn(t,n),t}function xu(e){return bn(e)?yn(e)?e.slice():Ji({},e):e}function _u(e,n){return n(e),e}function na(e){return yn(e)?e:[e]}Ae.toPath=na;function lt(e){return Ae.toPath(e)}function ta(e,n){for(var t=n.length,r=0;r<t;r++){if(e==null)return;e=e[n[r]]}return t?e:void 0}function ra(e,n,t){var r=ta(e,lt(n));return Li(r)?t:r}function Uu(e,n){n=lt(n);for(var t=n.length,r=0;r<t;r++){var c=n[r];if(!Dn(e,c))return!1;e=e[c]}return!!t}function ir(e){return e}function Bn(e){return e=Pn({},e),function(n){return Gi(n,e)}}function ar(e){return e=lt(e),function(n){return ta(n,e)}}function ft(e,n,t){if(n===void 0)return e;switch(t??3){case 1:return function(r){return e.call(n,r)};case 3:return function(r,c,i){return e.call(n,r,c,i)};case 4:return function(r,c,i,a){return e.call(n,r,c,i,a)}}return function(){return e.apply(n,arguments)}}function Tu(e,n,t){return e==null?ir:qe(e)?ft(e,n,t):bn(e)&&!yn(e)?Bn(e):ar(e)}function or(e,n){return Tu(e,n,1/0)}Ae.iteratee=or;function je(e,n,t){return Ae.iteratee!==or?Ae.iteratee(e,n):Tu(e,n,t)}function wu(e,n,t){n=je(n,t);for(var r=Oe(e),c=r.length,i={},a=0;a<c;a++){var o=r[a];i[o]=n(e[o],o,e)}return i}function ia(){}function Eu(e){return e==null?ia:function(n){return ra(e,n)}}function Au(e,n,t){var r=Array(Math.max(0,e));n=ft(n,t,1);for(var c=0;c<e;c++)r[c]=n(c);return r}function Kt(e,n){return n==null&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))}const zn=Date.now||function(){return new Date().getTime()};function Fu(e){var n=function(i){return e[i]},t="(?:"+Oe(e).join("|")+")",r=RegExp(t),c=RegExp(t,"g");return function(i){return i=i==null?"":""+i,r.test(i)?i.replace(c,n):i}}const Cu={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},Su=Fu(Cu),nd=Ki(Cu),Bu=Fu(nd),ku=Ae.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var Fr=/(.)^/,td={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},rd=/\\|'|\r|\n|\u2028|\u2029/g;function id(e){return"\\"+td[e]}var ad=/^\s*(\w|\$)+\s*$/;function Wu(e,n,t){!n&&t&&(n=t),n=ea({},n,Ae.templateSettings);var r=RegExp([(n.escape||Fr).source,(n.interpolate||Fr).source,(n.evaluate||Fr).source].join("|")+"|$","g"),c=0,i="__p+='";e.replace(r,function(h,b,m,g,f){return i+=e.slice(c,f).replace(rd,id),c=f+h.length,b?i+=`'+
2
2
  ((__t=(`+b+`))==null?'':_.escape(__t))+
3
3
  '`:m?i+=`'+
4
4
  ((__t=(`+m+`))==null?'':__t)+
@@ -1,4 +1,4 @@
1
- import{A as me}from"./index-Riy9XSe2.js";function fe(Ot,Bt){for(var $t=0;$t<Bt.length;$t++){const xt=Bt[$t];if(typeof xt!="string"&&!Array.isArray(xt)){for(const Tt in xt)if(Tt!=="default"&&!(Tt in Ot)){const qt=Object.getOwnPropertyDescriptor(xt,Tt);qt&&Object.defineProperty(Ot,Tt,qt.get?qt:{enumerable:!0,get:()=>xt[Tt]})}}}return Object.freeze(Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"}))}var Dt={exports:{}},pe=Dt.exports,ne;function ge(){return ne||(ne=1,(function(Ot,Bt){(function($t,xt){Ot.exports=xt()})(Object(typeof self<"u"?self:pe),(()=>(()=>{var $t={2640(at,w){Object.defineProperty(w,"__esModule",{value:!0}),w.TW_ARBITRARY_RE=w.TW_SPECIAL_CLASS_RE=w.TW_COLOR_CLASS_RE=w.TAILWIND_SPECIAL=w.TAILWIND_COLORS=w.ALLOWED_ATTRIBUTES_DEBUG=w.ALLOWED_ATTRIBUTES=w.ALLOWED_EMPTY_ELEMENTS=w.FOOTNOTE_LIST_SELECTORS=w.FOOTNOTE_INLINE_REFERENCES=w.TEST_ATTRIBUTES_SELECTOR=w.PARTIAL_SELECTORS_ANCHORED_REGEX=w.PARTIAL_SELECTORS_REGEX=w.PARTIAL_SELECTORS=w.TEST_ATTRIBUTES=w.EXACT_SELECTORS_JOINED=w.EXACT_SELECTORS=w.HIDDEN_EXACT_SKIP_SELECTOR=w.HIDDEN_EXACT_SELECTOR=w.CONTENT_ELEMENT_SELECTOR=w.INLINE_ELEMENTS=w.PRESERVE_ELEMENTS=w.BLOCK_LEVEL_ELEMENTS=w.BLOCK_ELEMENTS_SET=w.BLOCK_ELEMENTS_SELECTOR=w.BLOCK_ELEMENTS=w.MOBILE_WIDTH=w.ENTRY_POINT_ELEMENTS=void 0,w.ENTRY_POINT_ELEMENTS=["#post",".post-content",".post-body",".article-content","#article-content",".js-article-content",".article_post",".article-wrapper",".entry-content",".content-article",".instapaper_body",".post",".markdown-body","article",'[role="article"]',"main",'[role="main"]',".article-body","#content","body"],w.MOBILE_WIDTH=600,w.BLOCK_ELEMENTS=["div","section","article","main","aside","header","footer","nav","content"],w.BLOCK_ELEMENTS_SELECTOR=w.BLOCK_ELEMENTS.join(","),w.BLOCK_ELEMENTS_SET=new Set(w.BLOCK_ELEMENTS),w.BLOCK_LEVEL_ELEMENTS=new Set([...w.BLOCK_ELEMENTS,"p","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","pre","blockquote","figure","figcaption","table","thead","tbody","tfoot","tr","td","th","details","summary","address","hr","form","fieldset"]),w.PRESERVE_ELEMENTS=new Set(["pre","code","table","thead","tbody","tr","td","th","ul","ol","li","dl","dt","dd","figure","figcaption","picture","details","summary","blockquote","form","fieldset"]),w.INLINE_ELEMENTS=new Set(["a","span","strong","em","i","b","u","code","br","small","sub","sup","mark","date","del","ins","q","abbr","cite","relative-time","time","font"]),w.CONTENT_ELEMENT_SELECTOR=["math","[data-mathml]",".katex",".katex-mathml",".katex-display",".MathJax",".MathJax_Display",".MathJax_SVG","mjx-container","pre","code","table","img","picture","video","blockquote","figure"].join(", ");const I=["[hidden]",'[aria-hidden="true"]',".hidden",".invisible"],P=I.map((L=>L==='[aria-hidden="true"]'?'[aria-hidden="true"]:not([class*="math"]):not(svg):not([class*="paywall"])':L));w.HIDDEN_EXACT_SELECTOR=P.join(","),w.HIDDEN_EXACT_SKIP_SELECTOR=I.join(","),w.EXACT_SELECTORS=["noscript",'script:not([type^="math/"])',"style","meta","link","audio:not([src]):not(:has(source))","video:not([src]):not(:has(source))",".jwplayer",'.ad:not([class*="gradient"])','[class^="ad-" i]','[class$="-ad" i]',"[data-ad-wrapper]",'[id^="ad-" i]','[id$="-ad" i]','[role="banner" i]','[alt*="advert" i]',".promo",".Promo","#barrier-page",".alert",'[rel="sponsored" i]','[href*="source=promotion" i]','[id="comments" i]','[id="comment" i]','div[class*="cover-"]','div[id*="cover-"]',"ads-breadcrumbs","header:not(:has(p + p)):not(:has(img))",'header[class~="fixed"]','header[class~="sticky"]',".header:not(.banner)","#header","#Header","#banner","#Banner","nav",".navigation","#navigation",'[role="navigation" i]','[role="dialog" i]','[role="alertdialog" i]','[role*="complementary" i]','[class*="pagination" i]',".menu","#siteSub",".previous",".author",".Author",'[class$="_bio"]',"#categories",".contributor",".date","#date","[data-date]",".entry-meta",".meta",".tags","#tags",'[rel="tag"]',".headline","#headline","#title","#Title","#articleTag",'[href*="/author/"]','[href*="/author?"]','[href$="/author"]','a[href*="copyright.com"]','a[href*="google.com/preferences"]','[href="#top"]','[href="#Top"]','[href="#page-header"]','[href="#content"]','[href="#site-content"]','[href="#main-content"]','[href^="#main"]','[src*="author"]',".toc",".Toc","#toc",'[href*="#toc"]',"footer",".aside",'aside:not([class*="callout"])',"button","canvas","date","dialog","fieldset","form",'input:not([type="checkbox"])','input[type="checkbox"][class*="sidebar" i]','input[type="checkbox"][id*="sidebar" i]','input[type="checkbox"][class*="drawer" i]','input[type="checkbox"][id*="drawer" i]','input[type="checkbox"][class*="hamburger" i]','input[type="checkbox"][id*="hamburger" i]','input[type="checkbox"][class*="toggle" i]','input[type="checkbox"][id*="toggle" i]','input[type="checkbox"][class*="trigger" i]','input[type="checkbox"][id*="trigger" i]',"label","option","select",'[role="listbox"]','[role="option"]',"textarea",...P,"instaread-player","iframe:not([src])",'iframe[src*="blink.net"]','iframe[src*="giscus.app"]','iframe[src*="tinypass.com"]','iframe[src*="trinitymedia.ai"]','[class="logo" i]',"#logo","#Logo","#newsletter","#Newsletter",".subscribe",'[data-component-name="ButtonCreateButton"]','[data-component-name="DigestPostEmbed"]','[data-component-name="SubscribeWidgetToDOM"]','[class*="digestPostEmbed"]',".noprint",'[data-print-layout="hide" i]','[data-block="donotprint" i]','[class*="clickable-icon" i]','li span[class*="ltx_tag" i][class*="ltx_tag_item" i]','a[href^="#"][class*="anchor" i]','a[href^="#"][class*="ref" i]:not(.ltx_ref):not(.footnote-backref)','[data-container*="most-viewed" i]',".sidebar",".Sidebar","#sidebar","#Sidebar","#side-bar","#secondary","#sitesub",'[href*="/sitemap/sitemap.xml"]','[data-link-name*="skip" i]','[aria-label*="skip" i]','[title^="Share on" i]','[aria-label="Dismiss" i]','[aria-label="Close" i]',"svg[data-icon]",'[data-testid="load-more-posts"] + div',".copyright","#copyright",".licensebox","#page-info","#rss","#feed",".gutter","#primaryaudio","#NYT_ABOVE_MAIN_CONTENT_REGION",'[data-testid="photoviewer-children-figure"] > span',"table.infobox",'[data-optimizely="related-articles-section" i]','[data-orientation="vertical"]',".gh-header-sticky",'[data-testid="issue-metadata-sticky"]'],w.EXACT_SELECTORS_JOINED=w.EXACT_SELECTORS.join(","),w.TEST_ATTRIBUTES=["class","id","data-component","data-test","data-testid","data-test-id","data-qa","data-cy"],w.PARTIAL_SELECTORS=["a-statement","(?<!main-)access-wall","activitypub","actioncall","addcomment","addtoany","advert","adlayout","ad-tldr","ad-placement","adplacehold","ads-container","_ad_","AdBlock_","AdUnit","after_content","after_main_article","afterpost","allterms","-alert-","alert-box","_archive","around-the-web","aroundpages","article-author","article-badges","article-banner","article-bottom-section","article-bottom","article-category","article-card","article-citation","article-continues","article__copy","article_date","article-date","article-end ","article_header","article-header","article__header","article__hero","article__info","article-info","article-meta","article_meta","article__meta","articlename","article-subject","article_subject","article-snippet","article-separator","article--share","article-share","article--topics","article-tools","articletags","article-tags","article_tags","articletitle","article-title","article_title","articletopics","article-topics","article-actions","article--lede","articlewell","associated-people","ambient-video__button","audio-card","beyondwords","about-author","author-bio","author-box","author-info","author_info","authorm","author-mini-bio","author-name","author-publish-info","authored-by","avatar","back-to-top","backlink_container","backlinks-section","bio-block","biobox","blog-pager","bookmark-","-bookmark","bottominfo","bottomnav","bottom-of-article","bottom-wrapper","brand-bar","bcrumb","breadcrumb","brdcrumb","crumbs","bubblewrapper","button-wrapper","buttons-container","btn-","-btn","byline","captcha","card-text","card-media","card-post","carouselcontainer","carousel-container","cat_header","cat-overlay","catlinks","_categories","card-author","card-content","chapter-list","collections","comments","-comment\\b","commentbox","comment-button","commentcomp","comment-content","comment-count","comment-form","comment-number","comment-respond","comment-thread","comment-wrap","complementary","consent","contact-","contactus","cookie.law","content-card","copycontent","copy-tooltip","content-topics","contentpromo","context-bar","context-widget","core-collateral","cover-image","cover-photo","cover-wrap","created-date","creative-commons_","c-subscribe","_cta","-cta","cta-","cta_","current-issue","custom-list-number","dateline","dateheader","date-header","date-pub","disclaimer","disclosure","discussion","discuss_","-dismiss","disqus","donate","donation","dropdown","editorial_contact","editorial-contact","element-invisible","elementor-shortcode","eletters","emailsignup","emoji-bar","engagement-widget","enhancement-","entry-author-info","entry-categories","entry-date","entry-title","entry-utility","-error","error-","eyebrow","expand-reduce","external-anchor","externallinkembedwrapper","extra-services","extra-title","facebook","fancy-box","favorite","featured-content","feature_feed","feedback","feed-links","field-site-sections","filed","fixheader","floating-vid","follower","footer","footnote-back","footnoteback","form-group","for-you","frontmatter","further-reading","fullbleedheader","gallery-count","gated-popup","gh-feed","gist-meta","goog-","graph-view","hamburger","hawk-","header-pattern","hero[_\\-a-z]","hide-for-print","hide-print","hide-when-no-script","hidden-print","hidden-sidenote","hidden-accessibility","home-link","icon-sidebar","inarticle-ad","infoline","inline-topic","instacartIntegration","interlude","interaction","itemendrow","intro-date","invisible","jp-no-solution","jp-relatedposts","jswarning","js-warning","jumplink","jumpto","jump-to-","js-skip-to-content","keepreading","keep-reading","keep_reading","keyword_wrap","kicker","labstab","-labels","language-name","lastupdated","latest-content","-ledes-","-license","license-","lightbox-popup","like-button","link-box","links-grid","links-title","listing-dynamic-terms","list-tags","live-blog-header-live-label","listinks","loading","loa-info","logo","ltx_role_refnum","ltx_tag_bibitem","ltx_error","masthead","marketing","media-inquiry","-menu","menu-","metadata","meta-bottom","meta-date","meta-row","might-like","minibio","more-about","mod-paywall","_modal","-modal","more-","morenews","morestories","more_wrapper","most-read","move-helper","mw-editsection","mw-cite-backlink","mw-indicators","mw-jump-link","nav-","nav_","navigation-post","next-","next_prev","no-script","newsgallery","news-story-title","newsletter_","newsletterbanner","newslettercontainer","newsletter-form","newsletter-signup","newslettersignup","newsletterwidget","newsletterwrapper","not-found","notessection","nomobile","noprint","onward-journey","open-slideshow","originally-published","osano-cm","other-blogs","outline-view","pagefoot","pagehead","page-header","page-title","paywall_message","-partners","permission-","plea","popular","popup_links","pop_stories","pop-up","post__author","post-author","post-bottom","post__category","postcomment","postdate","post-date","post_date","post-details","post-feeds","postinfo","post-info","post_info","post-inline-date","post-links","postlist","post_list","post_meta","post-meta","postmeta","post_more","postnavi","post-navigation","postpath","post-preview","postsnippet","post_snippet","post-snippet","post-subject","posttax","post-tax","post_tax","posttag","post-tag","post_time","posttitle","post-title","post_title","post__title","post-ufi-button","prev-post","prevnext","prev_next","prev-next","previousnext","press-inquiries","print-none","print-header","print:hidden","privacy-notice","privacy-settings","profile","promo_article","promo-bar","promo-box","pubdate","pub_date","pub-date","publish_date","publish-date","publication-date","publicationName","qr-code","qr_code","quick_up","_rail","ratingssection","read_also","readmore","read-next","read_next","read_time","read-time","reading_time","reading-time","reading-list","recent-","recent-articles","recentpost","recent_post","recent-post","recommend","redirectedfrom","recirc","register","(?<!h[1-6]-)related","relevant","relposts","reversefootnote","rightcol","\\bnocontent\\b","_rss","rss-link","rubricwrapper","screen-reader-text","scroll_to","scroll-to","_search","-search","section-nav","series-banner","share-box","sharedaddy","share-icons","sharelinks","share-links","share-post","share-print","share-section","share-text","sharing_","shariff-","shortcode-id","show-for-print","sidebartitle","sidebar-content","sidebar-wrapper","sideitems","sidebar-author","sidebar-item","side-box","sign-in-gate","similar-","similar_","similars-","site-index","site-header","siteheader","site-name","site-wordpress","skip-content","skip-to-content","skip-link","c-skip-link","_skip-link","-slider","slug-wrap","social-author","social-button","social-shar","social-date","speechify-ignore","speedbump","sponsor","springercitation","sr-only","_stats","sticky-social","story-date","story-navigation","storyreadtime","storysmall","storypublishdate","subject-label","submenu","-subscribe-","subscriber-drive","subscription-","_tags","tags__item","tag_list","tag-list","tag-module","takeaways","taxonomy","table-of-contents","tblc","tabs-","terminaltout","time-rubric","timestamp","time-read","time-to-read","tip_off","-ticker","tiptout","-tout-","toc-container","toggle-caption","tooltip-content","topbar","subnavbar","topic-authors","topic-footer","topic-list","topic-subnav","top-wrapper","tree-item","trending","trust-feat","trust-badge","trust-project","chakra-badge","twiblock","u-hide","upsell","vid_carousel","viewbottom","view-language","yarpp-related","visually-hidden","welcomebox","widget_pages","window__widget","w-form-done","w-form-fail"],w.PARTIAL_SELECTORS_REGEX=new RegExp(w.PARTIAL_SELECTORS.join("|"),"i"),w.PARTIAL_SELECTORS_ANCHORED_REGEX=new RegExp("^(?:"+w.PARTIAL_SELECTORS.join("|")+")$","i"),w.TEST_ATTRIBUTES_SELECTOR=w.TEST_ATTRIBUTES.map((L=>`[${L}]`)).join(","),w.FOOTNOTE_INLINE_REFERENCES=["sup.reference","cite.ltx_cite",'sup[id^="fnr"]','span[id^="fnr"]','span[class*="footnote_ref"]','span[class*="footnote-ref"]',"span.footnote-link","a.citation",'a[id^="ref-link"]','a[href^="#fn"]','a[href^="#cite"]','a[href^="#reference"]','a[href^="#footnote"]','a[href^="#r"]','a[href^="#b"]','a[href*="cite_note"]','a[href*="cite_ref"]',"a.footnote-anchor","span.footnote-hovercard-target a",'a[role="doc-biblioref"]','a[id^="fnref"]','a[id^="ref-link"]',"sup.footnoteref","sup.footnote-reference",'sup[data-fn] > a[href^="#"]','sup[id^="ftnt_ref"] a[href^="#ftnt"]','span.easy-footnote > a[href^="#easy-footnote-bottom-"]','a.footnote[href^="#"]','a[data-type="noteref"]'].join(","),w.FOOTNOTE_LIST_SELECTORS=["div.footnote ol","div.footnotes ol",'div[role="doc-endnotes"]','div[role="doc-footnotes"]',"ol.footnotes-list","ol.footnotes","ol.references",'ol[class*="article-references"]',"section.footnotes ol",'section[role="doc-endnotes"]','section[role="doc-footnotes"]','section[role="doc-bibliography"]',"ul.footnotes-list","ul.ltx_biblist",'div.footnote[data-component-name="FootnoteToDOM"]',"div.footnotes-footer","div.footnote-definitions","div.footnote-definition","ol.wp-block-footnotes","ol.easy-footnotes-wrapper","div.footnotes-segment","#footnotes"].join(","),w.ALLOWED_EMPTY_ELEMENTS=new Set(["area","audio","base","br","circle","col","defs","ellipse","embed","figure","g","hr","iframe","img","input","line","link","mask","meta","object","param","path","pattern","picture","polygon","polyline","rect","source","stop","svg","td","th","track","use","video","wbr"]),w.ALLOWED_ATTRIBUTES=new Set(["alt","allow","allowfullscreen","aria-label","checked","colspan","controls","data-latex","data-src","data-srcset","data-callout","data-callout-fold","data-callout-title","data-lang","dir","display","frameborder","headers","height","href","kind","label","lang","role","rowspan","sandbox","src","srclang","srcset","start","title","type","width","accent","accentunder","align","columnalign","columnlines","columnspacing","columnspan","data-mjx-texclass","depth","displaystyle","fence","frame","framespacing","linethickness","lspace","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","rowalign","rowlines","rowspacing","rowspan","rspace","scriptlevel","separator","stretchy","symmetric","voffset","xmlns"]),w.ALLOWED_ATTRIBUTES_DEBUG=new Set(["class","id"]),w.TAILWIND_COLORS={slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},w.TAILWIND_SPECIAL={black:"#000",white:"#fff",transparent:"transparent",current:"currentColor"},w.TW_COLOR_CLASS_RE=/^(fill|stroke)-([a-z]+)-(\d{2,3})(?:\/(\d+))?$/,w.TW_SPECIAL_CLASS_RE=/^(fill|stroke)-(black|white|transparent|current)$/,w.TW_ARBITRARY_RE=/^text-\[(.+)\]$/},4467(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.findContentStart=function s(i,c){const f=(function(y,a){const d=(0,P.normalizeText)(a);if(!d)return null;const p=y.querySelectorAll("h1, h2");for(const x of p)if((0,P.normalizeText)(x.textContent||"")===d)return x;return null})(i,c)||null,u=i.ownerDocument.createTreeWalker(i,1);f&&(u.currentNode=f);let h=null,b=null,g=u.nextNode();for(;g;){const y=g;if(o(y)){if(t.has(y.tagName)){h=y;break}b||(b=y)}g=u.nextNode()}if(h)return h;if(b){let y=b;for(;;){let a=null,d=!1;for(const p of y.children)if(o(p)){if(a){d=!0;break}a=p}if(!a||d)break;y=a}return y}return f?s(i,""):null},w.isAboveContentStart=function(s,i){if(!i||s===i)return!1;const c=s.compareDocumentPosition(i);return!(1&c)&&!!(4&c)};const P=I(2552),L=/(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*|\d{4}[-/]\d{1,2}[-/]\d{1,2})/i,_=/^by\s+\S/i,A=/[.!?]/,S=/\b(?:isHidden(?:-[A-Za-z0-9_]+)?|is-hidden)\b/,n=new Set(["P","DIV","SECTION","ARTICLE","BLOCKQUOTE","FONT"]),t=new Set(["P","BLOCKQUOTE","FONT"]),r='[role="dialog"], [role="alertdialog"]',e=`aside, nav, header, footer, form, ${r}`;function o(s){if(!s.tagName||!n.has(s.tagName)||s.closest(e))return!1;const i=typeof s.className=="string"?s.className:"";if(S.test(i)||s.querySelector(r)||s.querySelector("script, style"))return!1;const c=(s.textContent||"").trim();if(!c)return!1;const f=(0,P.countWords)(c);return!(f<7)&&!!A.test(c)&&!(_.test(c)&&f<15)&&!(L.test(c)&&f<20)&&!((function(u){let h=0;for(const b of u.querySelectorAll("a"))h+=(b.textContent||"").length;return h})(s)>.7*c.length)&&!(s.tagName==="DIV"&&!s.querySelector("p"))}},5628(at,w,I){var P=this&&this.__awaiter||function(y,a,d,p){return new(d||(d=Promise))((function(x,l){function m(q){try{E(p.next(q))}catch(C){l(C)}}function v(q){try{E(p.throw(q))}catch(C){l(C)}}function E(q){var C;q.done?x(q.value):(C=q.value,C instanceof d?C:new d((function(N){N(C)}))).then(m,v)}E((p=p.apply(y,a||[])).next())}))};Object.defineProperty(w,"__esModule",{value:!0}),w.Defuddle=void 0;const L=I(1608),_=I(1917),A=I(2640),S=I(4840),n=I(3610),t=I(7726),r=I(3550),e=I(2408),o=I(8983),s=I(7393),i=I(3172),c=I(662),f=I(2552),u=I(639),h=new Set(["title","author","published","site","description","image","language"]),b=/[:\[\]()#>~+,]/;class g{constructor(a,d={}){this._schemaOrgData=void 0,this._schemaOrgExtracted=!1,this._inExtractorPipelineRun=!1,this.doc=a,this.options=d,this.debug=d.debug||!1}getSchemaOrgData(){return this._schemaOrgExtracted||(this._schemaOrgData=this._extractSchemaOrgData(this.doc),this._schemaOrgExtracted=!0),this._schemaOrgData}parse(){this.doc.body&&(this._normalizeAttributes(this.doc.body),this._resolveNoscriptImages(this.doc.body));let a=this.parseInternal();if(a.wordCount<200){this._log("Initial parse returned very little content, trying again");const p=this.parseInternal({removePartialSelectors:!1});p.wordCount>2*a.wordCount&&(this._log("Retry produced more content"),a=p)}if(a.wordCount<50){this._log("Still very little content, retrying without hidden-element removal");const p=this.parseInternal({removeHiddenElements:!1});p.wordCount>2*a.wordCount&&(this._log("Hidden-element retry produced more content"),a=p);const x=this.findLargestHiddenContentSelector();if(x){this._log("Retrying with hidden content selector:",x);const l=this.parseInternal({removeHiddenElements:!1,removePartialSelectors:!1,contentSelector:x});(l.wordCount>a.wordCount||l.wordCount>Math.max(20,.7*a.wordCount)&&l.content.length<a.content.length)&&(this._log("Hidden-selector retry produced better focused content"),a=l)}}if(a.wordCount<50){this._log("Still very little content, retrying without scoring/partial selectors (possible index page)");const p=this.parseInternal({removeLowScoring:!1,removePartialSelectors:!1,removeContentPatterns:!1});p.wordCount>a.wordCount&&(this._log("Index page retry produced more content"),a=p)}const d=this._getSchemaText(a.schemaOrgData);if(d&&this.countHtmlWords(d)>1.5*a.wordCount){const p=this.doc,x=p.cloneNode(!0);this._stripUnsafeElements(x.body),this.doc=x;try{const l=this._findElementBySchemaText(this.doc.body,d);if(l){const m=this.getElementSelector(l);this._log("Schema.org suggests a better content element, retrying with selector:",m),a=this.parseInternal({contentSelector:m})}else this._log("Using schema.org text as content (DOM element not found)"),a.content=d,a.wordCount=this.countHtmlWords(d)}finally{this.doc=p}}return a}_getSchemaText(a,d=0){if(!a||d>10)return"";const p=Array.isArray(a)?a:[a];for(const x of p)if(Array.isArray(x)){const l=this._getSchemaText(x,d+1);if(l)return l}else{if(x?.text&&typeof x.text=="string")return x.text;if(x?.articleBody&&typeof x.articleBody=="string")return x.articleBody;if(x?.["@graph"]&&Array.isArray(x["@graph"])){const l=this._getSchemaText(x["@graph"],d+1);if(l)return l}}return""}_serializeFallbackBody(){if(!this.doc.body)return"";const a=this.doc.body.cloneNode(!0);return this._stripUnsafeElements(a),this.resolveContentUrls((0,u.serializeHTML)(a))}_stripUnsafeElements(a){if(!a)return;const d=a.querySelectorAll('script:not([type^="math/"]), style, noscript, frame, frameset, object, embed, applet, base');for(const x of d)x.remove();const p=[a,...Array.from(a.querySelectorAll("*"))];for(const x of p)for(const l of Array.from(x.attributes)){const m=l.name.toLowerCase();if(m.startsWith("on"))x.removeAttribute(l.name);else if(m==="srcdoc")x.removeAttribute(l.name);else if(["href","src","action","formaction","xlink:href"].includes(m)){const v=!(m==="src"&&x.tagName==="IFRAME");(0,u.isDangerousUrl)(l.value,v)&&x.removeAttribute(l.name)}}}_deduplicateImages(a){for(const p of a.querySelectorAll("figure")){const x=Array.from(p.querySelectorAll("img")).filter((m=>!m.closest("noscript")&&m.parentElement));if(x.length<2)continue;const l=new Map;for(const m of x){const v=m.getAttribute("src")||"";if(!v||v.startsWith("data:"))continue;const E=(m.getAttribute("alt")||"").trim()||null,q=l.get(E)||[];q.push(m),l.set(E,q)}for(const[m,v]of l)v.length<2||m!==null&&v.every((E=>E.getAttribute("src")===v[0].getAttribute("src")))||this._keepBestImage(v)}const d=Array.from(a.querySelectorAll("img"));for(let p=0;p<d.length-1;p++){const x=d[p];if(!x.parentElement||x.closest("noscript")||x.closest("figure"))continue;const l=(x.getAttribute("alt")||"").trim();if(!l)continue;const m=x.getAttribute("src")||"";if(!m||m.startsWith("data:"))continue;const v=d[p+1];if(!v.parentElement||v.closest("noscript")||v.closest("figure")||(v.getAttribute("alt")||"").trim()!==l)continue;const E=v.getAttribute("src")||"";E&&!E.startsWith("data:")&&E!==m&&this._noVisibleContentBetween(x,v)&&this._keepBestImage([x,v])}for(const p of Array.from(a.querySelectorAll("img"))){if(!p.parentElement||p.closest("a, figure, noscript"))continue;const x=p.getAttribute("src")||"";if(!x||x.startsWith("data:"))continue;const l=p.parentElement,m=this._normalizeSrc(x);for(const v of l.querySelectorAll(":scope > a[href]")){if(!v.querySelector("img"))continue;const E=v.getAttribute("href")||"";if(m===this._normalizeSrc(E)){p.remove();break}}}}_keepBestImage(a){let d=a[0];for(let p=1;p<a.length;p++){const x=this._pickBestImage(d,a[p]);(x===d?a[p]:d).remove(),d=x}}_noVisibleContentBetween(a,d){const p=x=>{if(!x)return null;if(x.firstChild)return x.firstChild;let l=x;for(;l;){if(l.nextSibling)return l.nextSibling;l=l.parentNode}return null};for(let x=p(a);x&&x!==d;x=p(x))if(x.nodeType===3&&(x.textContent||"").trim())return!1;return!0}_normalizeSrc(a){return a.replace(/^https?:\/\//,"").split("?")[0]}_removeCoverImage(a,d){if(!d)return;const p=this._normalizeSrc(d);for(const x of a.querySelectorAll("img")){const l=x.getAttribute("src")||"";if(!l||l.startsWith("data:")||this._normalizeSrc(l)!==p)continue;const m=this._getLargestImageSrc(x),v=x.closest("figure");return v&&v.querySelector("figcaption")||x.remove(),m}}_pickBestImage(a,d){const p=a.getAttribute("srcset")?2:a.closest("picture")?1:0,x=d.getAttribute("srcset")?2:d.closest("picture")?1:0;if(p!==x)return p>x?a:d;const l=g._urlWidth(a),m=g._urlWidth(d);return l!==m?l>m?a:d:a}static _urlWidth(a){const d=(a.getAttribute("src")||"").match(g._urlWidthPattern);return d?parseInt(d[1],10):0}_normalizeAttributes(a){const d=[["srcSet","srcset"]],p=a.querySelectorAll("img, source");for(const x of p)for(const[l,m]of d){const v=x.getAttribute(l);v!==null&&(x.removeAttribute(l),x.setAttribute(m,v))}}_resolveNoscriptImages(a){const d=a.querySelectorAll("noscript");for(const p of d){let x=p.querySelector("img");if(!x){let C=p.innerHTML||"";if(C.includes("<img")||(C=p.textContent||""),!C.includes("<img"))continue;x=(0,u.parseHTML)(this.doc,C).querySelector("img")}if(!x)continue;const l=x.getAttribute("src")||"";if(!l||l.startsWith("data:"))continue;const m=x.getAttribute("alt"),v=p.parentElement;if(!v)continue;let E=!1;const q=v.querySelectorAll(":scope > img");for(const C of q){if(!(C.getAttribute("src")||"").startsWith("data:")||!m||C.getAttribute("alt")!==m)continue;C.setAttribute("src",l);const N=x.getAttribute("srcset")||"";N&&C.setAttribute("srcset",N),E=!0;break}if(!E&&this._isLazyImageContext(p)){const C=(p.closest("figure")||v).querySelectorAll("img");let N=!1;for(const O of C){if(O.closest("noscript"))continue;const T=O.getAttribute("src")||"";if(T&&!T.startsWith("data:")){N=!0;break}}if(!N){const O=x.cloneNode(!0);v.insertBefore(O,p)}}}}_isLazyImageContext(a){if(a.closest("figure"))return!0;const d=a.parentElement;if(d){for(const x of d.children)if(x!==a&&(0,u.getClassName)(x).toLowerCase().includes("lazy"))return!0;const p=(0,u.getClassName)(d).toLowerCase();if(p.includes("image")||p.includes("img")||p.includes("picture")||p.includes("photo")||p.includes("media"))return!0}return!1}_findElementBySchemaText(a,d){var p;const x=(((p=d.split(/\n\s*\n/)[0])===null||p===void 0?void 0:p.trim())||"").substring(0,100).trim();if(!x)return null;const l=(0,f.countWords)(d);let m=null,v=1/0;const E=a.querySelectorAll("*");for(const q of E){if(q===a)continue;const C=q.textContent||"";if(!C.includes(x))continue;const N=(0,f.countWords)(C);N>=.8*l&&N<v&&(v=N,m=q)}return m}findLargestHiddenContentSelector(){const a=this.doc.body;if(!a)return;const d=Array.from(a.querySelectorAll(A.HIDDEN_EXACT_SKIP_SELECTOR)).filter((l=>!(l.getAttribute("class")||"").includes("math")));let p=null,x=0;for(const l of d){const m=(0,f.countWords)(l.textContent||"");m>x&&(p=l,x=m)}return!p||x<30?void 0:this.getElementSelector(p)}_getLargestImageSrc(a){const d=a.getAttribute("srcset")||"";if(!d)return a.getAttribute("src")||"";const p=/(.+?)\s+(\d+(?:\.\d+)?)w/g;let x,l="",m=0,v=0;for(;(x=p.exec(d))!==null;){let q=x[1].trim();v>0&&(q=q.replace(/^,\s*/,"")),v=p.lastIndex;const C=parseFloat(x[2]);q&&C>m&&(m=C,l=q)}let E=l||a.getAttribute("src")||"";return E=E.replace(/,w_\d+/g,"").replace(/,c_\w+/g,""),E}parseAsync(){return P(this,void 0,void 0,(function*(){var a;if(this.options.useAsync!==!1){const p=yield this.tryAsyncExtractor(_.ExtractorRegistry.findPreferredAsyncExtractor.bind(_.ExtractorRegistry));if(p)return p}const d=this.parse();return d.wordCount>0||this.options.useAsync===!1?d:(a=yield this.tryAsyncExtractor(_.ExtractorRegistry.findAsyncExtractor.bind(_.ExtractorRegistry)))!==null&&a!==void 0?a:d}))}fetchAsyncVariables(){return P(this,void 0,void 0,(function*(){var a;if(this.options.useAsync===!1)return null;try{const d=this.options.url||this.doc.URL,p=this.getSchemaOrgData(),x={includeReplies:(a=this.options.includeReplies)!==null&&a!==void 0?a:"extractors",language:this.options.language,fetch:this.options.fetch},l=_.ExtractorRegistry.findPreferredAsyncExtractor(this.doc,d,p,x);if(l){const m=yield l.extractAsync();return this.getExtractorVariables(m.variables)||null}}catch(d){console.error("Defuddle","Error fetching async variables:",d)}return null}))}tryAsyncExtractor(a){return P(this,void 0,void 0,(function*(){var d;try{const p=this.options.url||this.doc.URL,x=this.getSchemaOrgData(),l={includeReplies:(d=this.options.includeReplies)!==null&&d!==void 0?d:"extractors",language:this.options.language,fetch:this.options.fetch},m=a(this.doc,p,x,l);if(m){const v=Date.now(),E=yield m.extractAsync(),q=this._collectMetaTags(),C=L.MetadataExtractor.extract(this.doc,x,q);return this.buildExtractorResponse(E,C,v,m,q)}}catch(p){console.error("Defuddle","Error in async extraction:",p)}return null}))}parseInternal(a={}){var d,p,x,l,m,v,E;const q=Date.now(),C={},N=(d=this.options.profile)!==null&&d!==void 0&&d,O=(W,B)=>{if(!N)return B();const H=performance.now(),k=B();return C[W]=Math.round(performance.now()-H),k};if(!this.doc.documentElement){const W=this.options.url||"";return{content:"",title:"",description:"",domain:W?new URL(W).hostname:"",favicon:"",image:"",language:"",parseTime:Date.now()-q,published:"",author:"",site:"",schemaOrgData:null,wordCount:0}}const T=Object.assign(Object.assign({removeExactSelectors:!0,removePartialSelectors:!0,removeHiddenElements:!0,removeLowScoring:!0,removeSmallImages:!0,removeContentPatterns:!0,standardize:!0,includeReplies:"extractors"},this.options),a),R=[],D=this.getSchemaOrgData();this._metaTags||(this._metaTags=this._collectMetaTags());const $=this._metaTags;this._metadata||(this._metadata=L.MetadataExtractor.extract(this.doc,D,$));const M=this._metadata;T.removeImages&&this.removeImages(this.doc);try{const W=T.url||this.doc.URL,B={includeReplies:T.includeReplies,language:T.language,fetch:T.fetch};if(!this._inExtractorPipelineRun){const K=_.ExtractorRegistry.findExtractor(this.doc,W,D,B);if(K&&K.canExtract()){const V=K.extract();if(V.contentSelector){this._inExtractorPipelineRun=!0;try{const X=this.parseInternal({contentSelector:V.contentSelector,removeLowScoring:!1,removeHiddenElements:!1}),Z=this.getExtractorVariables(V.variables);return Object.assign(Object.assign(Object.assign({},X),{title:((p=V.variables)===null||p===void 0?void 0:p.title)||X.title,description:((x=V.variables)===null||x===void 0?void 0:x.description)||X.description,author:((l=V.variables)===null||l===void 0?void 0:l.author)||X.author,published:((m=V.variables)===null||m===void 0?void 0:m.published)||X.published,site:((v=V.variables)===null||v===void 0?void 0:v.site)||X.site,language:((E=V.variables)===null||E===void 0?void 0:E.language)||X.language,extractorType:K.constructor.name.replace("Extractor","").toLowerCase()}),Z?{variables:Z}:{})}finally{this._inExtractorPipelineRun=!1}}return this.buildExtractorResponse(V,M,q,K,$)}}this._mobileStyles||(this._mobileStyles=this._evaluateMediaQueries(this.doc));const H=this._mobileStyles;this._smallImages||(this._smallImages=(0,e.findSmallImages)(this.doc,this.debug));const k=this._smallImages;let F;O("cloneDocument",(()=>{var K;F=this.doc.cloneNode(!0),(K=F.body)===null||K===void 0||K.normalize()})),O("flattenShadowRoots",(()=>this.flattenShadowRoots(this.doc,F))),O("resolveStreamedContent",(()=>this.resolveStreamedContent(F))),O("applyMobileStyles",(()=>this.applyMobileStyles(F,H)));const z=O("findMainContent",(()=>{let K=null;if(T.contentSelector&&(K=F.querySelector(T.contentSelector),this._log("Using contentSelector:",T.contentSelector,K?"found":"not found")),K||(K=this.findMainContent(F)),K){const V=K.closest("[data-defuddle]");V&&(K=V)}if(K&&K.tagName.toLowerCase()==="body"){const V=this._getSchemaText(D);if(V){const X=this._findElementBySchemaText(F.body,V);X&&(this._log("Found content element via schema.org text"),K=X)}}return K}));if(!z){const K=this._serializeFallbackBody(),V=Date.now();return Object.assign(Object.assign({content:K},M),{wordCount:this.countHtmlWords(K),parseTime:Math.round(V-q),metaTags:$})}O("removeMetadataBlock",(()=>{(M.published||M.author)&&(0,c.removeMetadataBlock)(z),z.querySelectorAll("wbr").forEach((K=>K.remove()))})),O("adoptExternalFootnotes",(()=>{T.standardize&&this.adoptExternalFootnotes(z,F)})),O("standardizeFootnotesCallouts",(()=>{T.standardize&&((0,n.standardizeFootnotes)(z),(0,t.standardizeCallouts)(z))})),O("removeSmallImages",(()=>{T.removeSmallImages&&(0,e.removeSmallImages)(F,k,this.debug)})),O("removeHiddenElements",(()=>{T.removeHiddenElements&&(0,o.removeHiddenElements)(F,this.debug,R)})),O("removeEyebrowLabel",(()=>{T.removeContentPatterns&&z&&(0,i.removeEyebrowLabel)(z,this.debug,R)})),O("removeBySelector",(()=>{(T.removeExactSelectors||T.removePartialSelectors)&&(0,s.removeBySelector)(F,this.debug,T.removeExactSelectors,T.removePartialSelectors,z,R,T.removeHiddenElements===!1)})),O("removeLowScoring",(()=>{T.removeLowScoring&&r.ContentScorer.scoreAndRemove(F,this.debug,R,z)})),O("removeByContentPattern",(()=>{if(T.removeContentPatterns&&z){const K=this.options.url||this.doc.URL||"";(0,i.removeByContentPattern)(z,this.debug,K,M.title||"",M.description||"",R)}})),O("standardizeContent",(()=>{T.standardize&&(0,S.standardizeContent)(z,M,this.doc,this.debug,N?C:void 0)})),O("resolveRelativeUrls",(()=>this.resolveRelativeUrls(z))),this._deduplicateImages(z);const Y=this._removeCoverImage(z,M.image||"");Y&&(M.image=Y),this._stripUnsafeElements(z);const ot=z.outerHTML,U=Date.now(),Q=Object.assign(Object.assign({content:ot},M),{wordCount:this.countHtmlWords(ot),parseTime:Math.round(U-q),metaTags:$});return this.debug&&(Q.debug={contentSelector:this.getElementSelector(z),removals:R}),this.options.profile&&(Q.profile=C),Q}catch(W){console.error("Defuddle","Error processing document:",W);const B=this._serializeFallbackBody(),H=Date.now();return Object.assign(Object.assign({content:B},M),{wordCount:this.countHtmlWords(B),parseTime:Math.round(H-q),metaTags:$})}}countHtmlWords(a){const d=a.replace(/<[^>]*>/g," ").replace(/&nbsp;/gi," ").replace(/&amp;/gi,"&").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#\d+;/g," ").replace(/&\w+;/g," ");return(0,f.countWords)(d)}_log(...a){this.debug&&console.log("Defuddle:",...a)}_evaluateMediaQueries(a){const d=[],p=/max-width[^:]*:\s*(\d+)/;try{if(!a.styleSheets)return d;Array.from(a.styleSheets).filter((l=>{try{return l.cssRules,!0}catch(m){return m instanceof DOMException&&m.name,!1}})).flatMap((l=>{try{return typeof CSSMediaRule>"u"?[]:Array.from(l.cssRules).filter((m=>m instanceof CSSMediaRule&&m.conditionText.includes("max-width")))}catch(m){return this.debug&&console.warn("Defuddle: Failed to process stylesheet:",m),[]}})).forEach((l=>{const m=l.conditionText.match(p);if(m){const v=parseInt(m[1]);A.MOBILE_WIDTH<=v&&Array.from(l.cssRules).filter((E=>E instanceof CSSStyleRule)).forEach((E=>{try{d.push({selector:E.selectorText,styles:E.style.cssText})}catch(q){this.debug&&console.warn("Defuddle: Failed to process CSS rule:",q)}}))}}))}catch(x){console.error("Defuddle: Error evaluating media queries:",x)}return d}applyMobileStyles(a,d){d.forEach((({selector:p,styles:x})=>{try{a.querySelectorAll(p).forEach((l=>{l.setAttribute("style",(l.getAttribute("style")||"")+x)}))}catch(l){console.error("Defuddle","Error applying styles for selector:",p,l)}}))}removeImages(a){const d=a.getElementsByTagName("img");Array.from(d).forEach((p=>{p.remove()}))}findMainContent(a){const d=[];if(A.ENTRY_POINT_ELEMENTS.forEach(((l,m)=>{a.querySelectorAll(l).forEach((v=>{let E=40*(A.ENTRY_POINT_ELEMENTS.length-m);E+=r.ContentScorer.scoreElement(v),d.push({element:v,score:E,selectorIndex:m})}))})),d.length===0)return this.findContentByScoring(a);if(d.sort(((l,m)=>m.score-l.score)),this.debug&&this._log("Content candidates:",d.map((l=>({element:l.element.tagName,selector:this.getElementSelector(l.element),score:l.score})))),d.length===1&&d[0].element.tagName.toLowerCase()==="body"){const l=this.findTableBasedContent(a);if(l)return l}const p=d[0];let x=p;for(let l=1;l<d.length;l++){const m=d[l],v=(0,f.countWords)(m.element.textContent||"");if(m.selectorIndex<x.selectorIndex&&x.element.contains(m.element)&&v>50){let E=0;for(const q of d)if(q.selectorIndex===m.selectorIndex&&p.element.contains(q.element)&&++E>1)break;if(E>1)continue;x=m}}return x!==p?x.element:p.element}findTableBasedContent(a){if(!Array.from(a.getElementsByTagName("table")).some((l=>{var m;const v=parseInt(l.getAttribute("width")||"0"),E=this.getComputedStyle(l),q=(0,u.getClassName)(l).toLowerCase();return v>400||((m=E?.width)===null||m===void 0?void 0:m.includes("px"))&&parseInt(E.width)>400||l.getAttribute("align")==="center"||q.includes("content")||q.includes("article")||Array.from(l.getElementsByTagName("tr")).some((C=>{const N=Array.from(C.children).filter((O=>O.tagName==="TD"));return N.length>=2&&N.some((O=>O.getAttribute("width")))}))})))return null;const p=Array.from(a.getElementsByTagName("td")),x=r.ContentScorer.findBestElement(p);return x?2*(0,f.countWords)(x.textContent||"")<(0,f.countWords)((a.body||a.documentElement).textContent||"")?null:x:null}findContentByScoring(a){const d=[];return a.querySelectorAll(A.BLOCK_ELEMENTS_SELECTOR).forEach((p=>{const x=r.ContentScorer.scoreElement(p);x>0&&d.push({score:x,element:p})})),d.length>0?d.sort(((p,x)=>x.score-p.score))[0].element:null}getElementSelector(a){const d=[];let p=a;for(;p&&p!==this.doc.documentElement;){let x=p.tagName.toLowerCase();if(p.id)x+="#"+p.id;else if((0,u.getClassName)(p)){const l=(0,u.getClassName)(p).trim().split(/\s+/).filter((m=>!b.test(m)));l.length&&(x+="."+l.join("."))}d.unshift(x),p=p.parentElement}return d.join(" > ")}getComputedStyle(a){return(0,f.getComputedStyle)(a)}adoptExternalFootnotes(a,d){const p=d.body||d;p&&a!==p&&p.querySelectorAll("div, section, aside").forEach((x=>{var l;const m=(0,u.getClassName)(x),v=x.id||"";if(!/footnote/i.test(m)&&!/footnote/i.test(v)||a.contains(x)||x.contains(a))return;const E=x.querySelector("h1, h2, h3, h4, h5, h6");E&&n.FOOTNOTE_SECTION_RE.test(((l=E.textContent)===null||l===void 0?void 0:l.trim())||"")&&a.appendChild(x)}))}resolveRelativeUrls(a){const d=this.options.url||this.doc.URL;if(!d)return;let p=d;const x=this.doc.querySelector("base[href]");if(x){const m=x.getAttribute("href");if(m)try{p=new URL(m,d).href}catch{}}const l=m=>{const v=m.trim().replace(/^\\?["']+/,"").replace(/\\?["']+$/,"");if(v.startsWith("#"))return v;try{return new URL(v,p).href}catch{return v||m}};a.querySelectorAll("[href]").forEach((m=>{const v=m.getAttribute("href");v&&m.setAttribute("href",l(v))})),a.querySelectorAll("[src]").forEach((m=>{const v=m.getAttribute("src");v&&m.setAttribute("src",l(v))})),a.querySelectorAll("[srcset]").forEach((m=>{const v=m.getAttribute("srcset");if(v){const E=/(.+?)\s+(\d+(?:\.\d+)?[wx])/g,q=[];let C,N=0;for(;(C=E.exec(v))!==null;){let O=C[1].trim();N>0&&(O=O.replace(/^,\s*/,"")),N=E.lastIndex,q.push(`${l(O)} ${C[2]}`)}if(q.length>0)m.setAttribute("srcset",q.join(", "));else{const O=v.split(",").map((T=>{const R=T.trim().split(/\s+/);return R[0]&&(R[0]=l(R[0])),R.join(" ")})).join(", ");m.setAttribute("srcset",O)}}})),a.querySelectorAll("[poster]").forEach((m=>{const v=m.getAttribute("poster");v&&m.setAttribute("poster",l(v))}))}flattenShadowRoots(a,d){var p,x,l;if(!a.body||!d.body)return;const m=Array.from(a.body.querySelectorAll("*")),v=m.find((q=>q.shadowRoot));if(!v)return;const E=Array.from(d.body.querySelectorAll("*"));if(((l=(x=(p=v.shadowRoot)===null||p===void 0?void 0:p.childNodes)===null||x===void 0?void 0:x.length)!==null&&l!==void 0?l:0)>0)for(let q=m.length-1;q>=0;q--){const C=m[q];if(!C.shadowRoot)continue;const N=E[q];if(!N)continue;const O=C.shadowRoot.innerHTML;O.length>0&&this.replaceShadowHost(N,O,d)}else{const q=[];for(let C=0;C<m.length;C++){const N=m[C],O=N.getAttribute("data-defuddle-shadow");if(!O)continue;const T=E[C];T&&(q.push({cloneEl:T,html:O}),N.removeAttribute("data-defuddle-shadow"),T.removeAttribute("data-defuddle-shadow"))}for(const{cloneEl:C,html:N}of q)this.replaceShadowHost(C,N,d)}}resolveStreamedContent(a){const d=a.querySelectorAll("script"),p=[],x=/\$RC\("(B:\d+)","(S:\d+)"\)/g;for(const m of d){const v=m.textContent||"";if(!v.includes("$RC("))continue;let E;for(x.lastIndex=0;(E=x.exec(v))!==null;)p.push({templateId:E[1],contentId:E[2]})}if(p.length===0)return;let l=0;for(const{templateId:m,contentId:v}of p){const E=a.getElementById(m),q=a.getElementById(v);if(!E||!q)continue;const C=E.parentNode;if(!C)continue;let N=E.nextSibling,O=!1;for(;N;){const T=N.nextSibling;if(N.nodeType===8&&N.data==="/$"){N.remove(),O=!0;break}N.remove(),N=T}if(O){for(;q.firstChild;)C.insertBefore(q.firstChild,E);E.remove(),q.remove(),l++}}l>0&&this._log("Resolved streamed content:",l,"suspense boundaries")}replaceShadowHost(a,d,p){var x;const l=(0,u.parseHTML)(p,d);if(a.tagName.includes("-")){const m=p.createElement("div");m.appendChild(l),(x=a.parentNode)===null||x===void 0||x.replaceChild(m,a)}else a.textContent="",a.appendChild(l)}resolveContentUrls(a){if(!(this.options.url||this.doc.URL))return a;const d=this.doc.createElement("div");return d.appendChild((0,u.parseHTML)(this.doc,a)),this.resolveRelativeUrls(d),(0,u.serializeHTML)(d)}_extractSchemaOrgData(a){const d=a.querySelectorAll('script[type="application/ld+json"]'),p=[];d.forEach((l=>{let m=l.textContent||"";try{m=m.replace(/\/\*[\s\S]*?\*\/|^\s*\/\/.*$/gm,"").replace(/^\s*<!\[CDATA\[([\s\S]*?)\]\]>\s*$/,"$1").replace(/^\s*(\*\/|\/\*)\s*|\s*(\*\/|\/\*)\s*$/g,"").trim();const v=JSON.parse(m);v["@graph"]&&Array.isArray(v["@graph"])?p.push(...v["@graph"]):p.push(v)}catch(v){console.error("Defuddle: Error parsing schema.org data:",v),this.debug&&console.error("Defuddle: Problematic JSON content:",m)}}));const x=l=>{if(typeof l=="string")return this._decodeHTMLEntities(l);if(Array.isArray(l))return l.map(x);if(typeof l=="object"&&l!==null){const m={};for(const v in l)Object.prototype.hasOwnProperty.call(l,v)&&(m[v]=x(l[v]));return m}return l};return p.map(x)}_collectMetaTags(){const a=[];return this.doc.querySelectorAll("meta").forEach((d=>{const p=d.getAttribute("name"),x=d.getAttribute("property");let l=d.getAttribute("content");l&&a.push({name:p,property:x,content:this._decodeHTMLEntities(l)})})),a}_decodeHTMLEntities(a){return(0,u.decodeHTMLEntities)(this.doc,a)}buildExtractorResponse(a,d,p,x,l){var m,v,E,q,C,N;const O=this._sanitizeExtractorHtml(a.contentHtml),T=this.getExtractorVariables(a.variables);return Object.assign({content:O,title:((m=a.variables)===null||m===void 0?void 0:m.title)||d.title,description:((v=a.variables)===null||v===void 0?void 0:v.description)||d.description,domain:d.domain,favicon:d.favicon,image:d.image,language:((E=a.variables)===null||E===void 0?void 0:E.language)||d.language,published:((q=a.variables)===null||q===void 0?void 0:q.published)||d.published,author:((C=a.variables)===null||C===void 0?void 0:C.author)||d.author,site:((N=a.variables)===null||N===void 0?void 0:N.site)||d.site,schemaOrgData:d.schemaOrgData,wordCount:this.countHtmlWords(O),parseTime:Math.round(Date.now()-p),extractorType:x.constructor.name.replace("Extractor","").toLowerCase(),metaTags:l},T?{variables:T}:{})}_sanitizeExtractorHtml(a){if(!a)return a;const d=this.doc.createElement("div");return d.appendChild((0,u.parseHTML)(this.doc,a)),this._stripUnsafeElements(d),this.resolveRelativeUrls(d),(0,u.serializeHTML)(d)}getExtractorVariables(a){if(!a)return;const d={};let p=!1;for(const[x,l]of Object.entries(a))h.has(x)||(d[x]=l,p=!0);return p?d:void 0}}w.Defuddle=g,g._urlWidthPattern=/(?:width[=:/]|[/,?&]w[_:=])(\d+)/},7726(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.standardizeCallouts=function(_){var A,S;const n=_.ownerDocument;if(!n)return;const t=Array.from(_.querySelectorAll(".callout.is-collapsed, .callout.is-collapsible"));for(const c of t){const f=c.classList.contains("is-collapsed");c.classList.remove("is-collapsed","is-collapsible"),c.hasAttribute("data-callout-fold")||c.setAttribute("data-callout-fold",f?"-":"+");const u=c.querySelector(".callout-fold");u&&u.remove();const h=c.querySelector(".callout-content");if(h){const b=h.getAttribute("style");if(b){const g=b.replace(/display\s*:\s*none\s*;?/gi,"").trim();g?h.setAttribute("style",g):h.removeAttribute("style")}}}const r=Array.from(_.querySelectorAll(".markdown-alert"));for(const c of r){const f=Array.from(c.classList).find((g=>g.startsWith("markdown-alert-")&&g!=="markdown-alert")),u=f?f.replace("markdown-alert-",""):"note",h=u.charAt(0).toUpperCase()+u.slice(1),b=c.querySelector(".markdown-alert-title");b&&b.remove(),c.replaceWith(L(n,u,h,c))}const e=Array.from(_.querySelectorAll('aside[class*="callout"]'));for(const c of e){const f=Array.from(c.classList).find((g=>g.startsWith("callout-"))),u=f?f.replace("callout-",""):"note",h=u.charAt(0).toUpperCase()+u.slice(1),b=c.querySelector(".callout-content");c.replaceWith(L(n,u,h,b||c))}const o=new Set(["info","warning","note","tip","danger","caution","important","abstract","success","question","failure","bug","example","quote"]),s=Array.from(_.querySelectorAll(".admonition"));for(const c of s){if(c.getAttribute("data-callout"))continue;const f=Array.from(c.classList).find((g=>o.has(g)))||"note",u=c.querySelector(".admonition-title"),h=((A=u?.textContent)===null||A===void 0?void 0:A.trim())||f.charAt(0).toUpperCase()+f.slice(1);u&&u.remove();const b=c.querySelector(".admonition-content")||c.querySelector(".details-content")||c;c.replaceWith(L(n,f,h,b))}const i=Array.from(_.querySelectorAll('.alert[class*="alert-"]'));for(const c of i){const f=Array.from(c.classList).find((g=>g.startsWith("alert-")&&g!=="alert-dismissible")),u=f?f.replace("alert-",""):"note",h=c.querySelector(".alert-heading, .alert-title"),b=((S=h?.textContent)===null||S===void 0?void 0:S.trim())||u.charAt(0).toUpperCase()+u.slice(1);h&&h.remove(),c.replaceWith(L(n,u,b,c))}};const P=I(639);function L(_,A,S,n){const t=_.createElement("div");t.setAttribute("data-callout",A),t.className="callout";const r=_.createElement("div");r.className="callout-title";const e=_.createElement("div");e.className="callout-title-inner",e.textContent=S,r.appendChild(e),t.appendChild(r);const o=_.createElement("div");return o.className="callout-content",(0,P.transferContent)(n,o),t.appendChild(o),t}},754(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.codeBlockRules=void 0;const P=I(2552),L=[/^language-(\w+)$/,/^lang-(\w+)$/,/^(\w+)-code$/,/^code-(\w+)$/,/^syntax-(\w+)$/,/^code-snippet__(\w+)$/,/^highlight-(\w+)$/,/^(\w+)-snippet$/,/(?:^|\s)(?:language|lang|brush|syntax)-(\w+)(?:\s|$)/i],_=new Set(["abap","actionscript","ada","adoc","agda","antlr4","applescript","arduino","armasm","asciidoc","aspnet","atom","bash","batch","c","clojure","cmake","cobol","coffeescript","cpp","c++","crystal","csharp","cs","dart","django","dockerfile","dotnet","elixir","elm","erlang","fortran","fsharp","gdscript","gitignore","glsl","golang","gradle","graphql","groovy","haskell","hs","haxe","hlsl","html","idris","java","javascript","js","jsx","jsdoc","json","jsonp","julia","kotlin","latex","lean","lean4","lisp","elisp","livescript","lua","makefile","markdown","md","markup","masm","mathml","matlab","mongodb","mysql","nasm","nginx","nim","nix","objc","ocaml","pascal","perl","php","postgresql","powershell","prolog","puppet","python","regex","rss","ruby","rb","rust","scala","scheme","shell","sh","solidity","sparql","sql","ssml","svg","swift","tcl","terraform","tex","toml","typescript","ts","tsx","unrealscript","verilog","vhdl","webassembly","wasm","xml","yaml","yml","zig"]);w.codeBlockRules=[{selector:["pre",'div[class*="prismjs"]',".syntaxhighlighter",".highlight",".highlight-source",".wp-block-syntaxhighlighter-code",".wp-block-code",'div[class*="language-"]',".code-block[data-lang]","code.hl.block"].join(", "),element:"pre",transform:(A,S)=>{var n;if(!(h=>"classList"in h&&"getAttribute"in h&&"querySelector"in h)(A))return A;A.querySelectorAll('button, [class*="codeblock-button"]').forEach((h=>h.remove())),A.querySelectorAll('[class*="header"], [class*="toolbar"], [class*="titlebar"], [class*="title-bar"]').forEach((h=>{var b;const g=h.tagName;if(g!=="DIV"&&g!=="SPAN")return;const y=(b=h.closest)===null||b===void 0?void 0:b.call(h,"[data-line], .line");if(y&&A.contains(y)||h.querySelector("[data-line], .line, pre"))return;const a=(h.textContent||"").trim();(0,P.countWords)(a)<=5&&h.remove()}));const t=h=>{var b;const g=h.getAttribute("data-lang")||h.getAttribute("data-language")||h.getAttribute("language");if(g)return g.toLowerCase();const y=Array.from(h.classList||[]);if(!((b=h.classList)===null||b===void 0)&&b.contains("syntaxhighlighter")){const a=y.find((d=>!["syntaxhighlighter","nogutter"].includes(d)));if(a&&_.has(a.toLowerCase()))return a.toLowerCase()}for(const a of y)for(const d of L){const p=a.toLowerCase().match(d);if(p&&p[1]&&_.has(p[1].toLowerCase()))return p[1].toLowerCase()}for(const a of y)if(_.has(a.toLowerCase()))return a.toLowerCase();return""};let r="",e=A;for(;e&&!r;){if(r=t(e),!r&&e===A){const h=e.querySelector('code[data-lang], code[class*="language-"]')||e.querySelector("code");h&&(r=t(h))}e=e.parentElement}const o=A.querySelector(".cm-content");if(o&&!r){const h=Array.from(A.querySelectorAll("div"));for(const b of h){if(b.contains(o))continue;const g=(b.textContent||"").trim().toLowerCase();if(g&&_.has(g)){r=g;break}}}const s=h=>{var b;if((0,P.isTextNode)(h))return!((b=h.parentElement)===null||b===void 0)&&b.querySelector("[data-line], .line")&&!(h.textContent||"").trim()?"":h.textContent||"";let g="";if((0,P.isElement)(h)){if(h.matches(".hover-info, .hover-container")||h.tagName==="BUTTON"||h.tagName==="STYLE")return"";if(h.tagName==="BR"){const y=h.previousElementSibling;return y&&y.matches('div[class*="line"], span[class*="line"], .ec-line, [data-line-number], [data-line]')?"":`
1
+ import{A as me}from"./index-JMt9ljo3.js";function fe(Ot,Bt){for(var $t=0;$t<Bt.length;$t++){const xt=Bt[$t];if(typeof xt!="string"&&!Array.isArray(xt)){for(const Tt in xt)if(Tt!=="default"&&!(Tt in Ot)){const qt=Object.getOwnPropertyDescriptor(xt,Tt);qt&&Object.defineProperty(Ot,Tt,qt.get?qt:{enumerable:!0,get:()=>xt[Tt]})}}}return Object.freeze(Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"}))}var Dt={exports:{}},pe=Dt.exports,ne;function ge(){return ne||(ne=1,(function(Ot,Bt){(function($t,xt){Ot.exports=xt()})(Object(typeof self<"u"?self:pe),(()=>(()=>{var $t={2640(at,w){Object.defineProperty(w,"__esModule",{value:!0}),w.TW_ARBITRARY_RE=w.TW_SPECIAL_CLASS_RE=w.TW_COLOR_CLASS_RE=w.TAILWIND_SPECIAL=w.TAILWIND_COLORS=w.ALLOWED_ATTRIBUTES_DEBUG=w.ALLOWED_ATTRIBUTES=w.ALLOWED_EMPTY_ELEMENTS=w.FOOTNOTE_LIST_SELECTORS=w.FOOTNOTE_INLINE_REFERENCES=w.TEST_ATTRIBUTES_SELECTOR=w.PARTIAL_SELECTORS_ANCHORED_REGEX=w.PARTIAL_SELECTORS_REGEX=w.PARTIAL_SELECTORS=w.TEST_ATTRIBUTES=w.EXACT_SELECTORS_JOINED=w.EXACT_SELECTORS=w.HIDDEN_EXACT_SKIP_SELECTOR=w.HIDDEN_EXACT_SELECTOR=w.CONTENT_ELEMENT_SELECTOR=w.INLINE_ELEMENTS=w.PRESERVE_ELEMENTS=w.BLOCK_LEVEL_ELEMENTS=w.BLOCK_ELEMENTS_SET=w.BLOCK_ELEMENTS_SELECTOR=w.BLOCK_ELEMENTS=w.MOBILE_WIDTH=w.ENTRY_POINT_ELEMENTS=void 0,w.ENTRY_POINT_ELEMENTS=["#post",".post-content",".post-body",".article-content","#article-content",".js-article-content",".article_post",".article-wrapper",".entry-content",".content-article",".instapaper_body",".post",".markdown-body","article",'[role="article"]',"main",'[role="main"]',".article-body","#content","body"],w.MOBILE_WIDTH=600,w.BLOCK_ELEMENTS=["div","section","article","main","aside","header","footer","nav","content"],w.BLOCK_ELEMENTS_SELECTOR=w.BLOCK_ELEMENTS.join(","),w.BLOCK_ELEMENTS_SET=new Set(w.BLOCK_ELEMENTS),w.BLOCK_LEVEL_ELEMENTS=new Set([...w.BLOCK_ELEMENTS,"p","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","pre","blockquote","figure","figcaption","table","thead","tbody","tfoot","tr","td","th","details","summary","address","hr","form","fieldset"]),w.PRESERVE_ELEMENTS=new Set(["pre","code","table","thead","tbody","tr","td","th","ul","ol","li","dl","dt","dd","figure","figcaption","picture","details","summary","blockquote","form","fieldset"]),w.INLINE_ELEMENTS=new Set(["a","span","strong","em","i","b","u","code","br","small","sub","sup","mark","date","del","ins","q","abbr","cite","relative-time","time","font"]),w.CONTENT_ELEMENT_SELECTOR=["math","[data-mathml]",".katex",".katex-mathml",".katex-display",".MathJax",".MathJax_Display",".MathJax_SVG","mjx-container","pre","code","table","img","picture","video","blockquote","figure"].join(", ");const I=["[hidden]",'[aria-hidden="true"]',".hidden",".invisible"],P=I.map((L=>L==='[aria-hidden="true"]'?'[aria-hidden="true"]:not([class*="math"]):not(svg):not([class*="paywall"])':L));w.HIDDEN_EXACT_SELECTOR=P.join(","),w.HIDDEN_EXACT_SKIP_SELECTOR=I.join(","),w.EXACT_SELECTORS=["noscript",'script:not([type^="math/"])',"style","meta","link","audio:not([src]):not(:has(source))","video:not([src]):not(:has(source))",".jwplayer",'.ad:not([class*="gradient"])','[class^="ad-" i]','[class$="-ad" i]',"[data-ad-wrapper]",'[id^="ad-" i]','[id$="-ad" i]','[role="banner" i]','[alt*="advert" i]',".promo",".Promo","#barrier-page",".alert",'[rel="sponsored" i]','[href*="source=promotion" i]','[id="comments" i]','[id="comment" i]','div[class*="cover-"]','div[id*="cover-"]',"ads-breadcrumbs","header:not(:has(p + p)):not(:has(img))",'header[class~="fixed"]','header[class~="sticky"]',".header:not(.banner)","#header","#Header","#banner","#Banner","nav",".navigation","#navigation",'[role="navigation" i]','[role="dialog" i]','[role="alertdialog" i]','[role*="complementary" i]','[class*="pagination" i]',".menu","#siteSub",".previous",".author",".Author",'[class$="_bio"]',"#categories",".contributor",".date","#date","[data-date]",".entry-meta",".meta",".tags","#tags",'[rel="tag"]',".headline","#headline","#title","#Title","#articleTag",'[href*="/author/"]','[href*="/author?"]','[href$="/author"]','a[href*="copyright.com"]','a[href*="google.com/preferences"]','[href="#top"]','[href="#Top"]','[href="#page-header"]','[href="#content"]','[href="#site-content"]','[href="#main-content"]','[href^="#main"]','[src*="author"]',".toc",".Toc","#toc",'[href*="#toc"]',"footer",".aside",'aside:not([class*="callout"])',"button","canvas","date","dialog","fieldset","form",'input:not([type="checkbox"])','input[type="checkbox"][class*="sidebar" i]','input[type="checkbox"][id*="sidebar" i]','input[type="checkbox"][class*="drawer" i]','input[type="checkbox"][id*="drawer" i]','input[type="checkbox"][class*="hamburger" i]','input[type="checkbox"][id*="hamburger" i]','input[type="checkbox"][class*="toggle" i]','input[type="checkbox"][id*="toggle" i]','input[type="checkbox"][class*="trigger" i]','input[type="checkbox"][id*="trigger" i]',"label","option","select",'[role="listbox"]','[role="option"]',"textarea",...P,"instaread-player","iframe:not([src])",'iframe[src*="blink.net"]','iframe[src*="giscus.app"]','iframe[src*="tinypass.com"]','iframe[src*="trinitymedia.ai"]','[class="logo" i]',"#logo","#Logo","#newsletter","#Newsletter",".subscribe",'[data-component-name="ButtonCreateButton"]','[data-component-name="DigestPostEmbed"]','[data-component-name="SubscribeWidgetToDOM"]','[class*="digestPostEmbed"]',".noprint",'[data-print-layout="hide" i]','[data-block="donotprint" i]','[class*="clickable-icon" i]','li span[class*="ltx_tag" i][class*="ltx_tag_item" i]','a[href^="#"][class*="anchor" i]','a[href^="#"][class*="ref" i]:not(.ltx_ref):not(.footnote-backref)','[data-container*="most-viewed" i]',".sidebar",".Sidebar","#sidebar","#Sidebar","#side-bar","#secondary","#sitesub",'[href*="/sitemap/sitemap.xml"]','[data-link-name*="skip" i]','[aria-label*="skip" i]','[title^="Share on" i]','[aria-label="Dismiss" i]','[aria-label="Close" i]',"svg[data-icon]",'[data-testid="load-more-posts"] + div',".copyright","#copyright",".licensebox","#page-info","#rss","#feed",".gutter","#primaryaudio","#NYT_ABOVE_MAIN_CONTENT_REGION",'[data-testid="photoviewer-children-figure"] > span',"table.infobox",'[data-optimizely="related-articles-section" i]','[data-orientation="vertical"]',".gh-header-sticky",'[data-testid="issue-metadata-sticky"]'],w.EXACT_SELECTORS_JOINED=w.EXACT_SELECTORS.join(","),w.TEST_ATTRIBUTES=["class","id","data-component","data-test","data-testid","data-test-id","data-qa","data-cy"],w.PARTIAL_SELECTORS=["a-statement","(?<!main-)access-wall","activitypub","actioncall","addcomment","addtoany","advert","adlayout","ad-tldr","ad-placement","adplacehold","ads-container","_ad_","AdBlock_","AdUnit","after_content","after_main_article","afterpost","allterms","-alert-","alert-box","_archive","around-the-web","aroundpages","article-author","article-badges","article-banner","article-bottom-section","article-bottom","article-category","article-card","article-citation","article-continues","article__copy","article_date","article-date","article-end ","article_header","article-header","article__header","article__hero","article__info","article-info","article-meta","article_meta","article__meta","articlename","article-subject","article_subject","article-snippet","article-separator","article--share","article-share","article--topics","article-tools","articletags","article-tags","article_tags","articletitle","article-title","article_title","articletopics","article-topics","article-actions","article--lede","articlewell","associated-people","ambient-video__button","audio-card","beyondwords","about-author","author-bio","author-box","author-info","author_info","authorm","author-mini-bio","author-name","author-publish-info","authored-by","avatar","back-to-top","backlink_container","backlinks-section","bio-block","biobox","blog-pager","bookmark-","-bookmark","bottominfo","bottomnav","bottom-of-article","bottom-wrapper","brand-bar","bcrumb","breadcrumb","brdcrumb","crumbs","bubblewrapper","button-wrapper","buttons-container","btn-","-btn","byline","captcha","card-text","card-media","card-post","carouselcontainer","carousel-container","cat_header","cat-overlay","catlinks","_categories","card-author","card-content","chapter-list","collections","comments","-comment\\b","commentbox","comment-button","commentcomp","comment-content","comment-count","comment-form","comment-number","comment-respond","comment-thread","comment-wrap","complementary","consent","contact-","contactus","cookie.law","content-card","copycontent","copy-tooltip","content-topics","contentpromo","context-bar","context-widget","core-collateral","cover-image","cover-photo","cover-wrap","created-date","creative-commons_","c-subscribe","_cta","-cta","cta-","cta_","current-issue","custom-list-number","dateline","dateheader","date-header","date-pub","disclaimer","disclosure","discussion","discuss_","-dismiss","disqus","donate","donation","dropdown","editorial_contact","editorial-contact","element-invisible","elementor-shortcode","eletters","emailsignup","emoji-bar","engagement-widget","enhancement-","entry-author-info","entry-categories","entry-date","entry-title","entry-utility","-error","error-","eyebrow","expand-reduce","external-anchor","externallinkembedwrapper","extra-services","extra-title","facebook","fancy-box","favorite","featured-content","feature_feed","feedback","feed-links","field-site-sections","filed","fixheader","floating-vid","follower","footer","footnote-back","footnoteback","form-group","for-you","frontmatter","further-reading","fullbleedheader","gallery-count","gated-popup","gh-feed","gist-meta","goog-","graph-view","hamburger","hawk-","header-pattern","hero[_\\-a-z]","hide-for-print","hide-print","hide-when-no-script","hidden-print","hidden-sidenote","hidden-accessibility","home-link","icon-sidebar","inarticle-ad","infoline","inline-topic","instacartIntegration","interlude","interaction","itemendrow","intro-date","invisible","jp-no-solution","jp-relatedposts","jswarning","js-warning","jumplink","jumpto","jump-to-","js-skip-to-content","keepreading","keep-reading","keep_reading","keyword_wrap","kicker","labstab","-labels","language-name","lastupdated","latest-content","-ledes-","-license","license-","lightbox-popup","like-button","link-box","links-grid","links-title","listing-dynamic-terms","list-tags","live-blog-header-live-label","listinks","loading","loa-info","logo","ltx_role_refnum","ltx_tag_bibitem","ltx_error","masthead","marketing","media-inquiry","-menu","menu-","metadata","meta-bottom","meta-date","meta-row","might-like","minibio","more-about","mod-paywall","_modal","-modal","more-","morenews","morestories","more_wrapper","most-read","move-helper","mw-editsection","mw-cite-backlink","mw-indicators","mw-jump-link","nav-","nav_","navigation-post","next-","next_prev","no-script","newsgallery","news-story-title","newsletter_","newsletterbanner","newslettercontainer","newsletter-form","newsletter-signup","newslettersignup","newsletterwidget","newsletterwrapper","not-found","notessection","nomobile","noprint","onward-journey","open-slideshow","originally-published","osano-cm","other-blogs","outline-view","pagefoot","pagehead","page-header","page-title","paywall_message","-partners","permission-","plea","popular","popup_links","pop_stories","pop-up","post__author","post-author","post-bottom","post__category","postcomment","postdate","post-date","post_date","post-details","post-feeds","postinfo","post-info","post_info","post-inline-date","post-links","postlist","post_list","post_meta","post-meta","postmeta","post_more","postnavi","post-navigation","postpath","post-preview","postsnippet","post_snippet","post-snippet","post-subject","posttax","post-tax","post_tax","posttag","post-tag","post_time","posttitle","post-title","post_title","post__title","post-ufi-button","prev-post","prevnext","prev_next","prev-next","previousnext","press-inquiries","print-none","print-header","print:hidden","privacy-notice","privacy-settings","profile","promo_article","promo-bar","promo-box","pubdate","pub_date","pub-date","publish_date","publish-date","publication-date","publicationName","qr-code","qr_code","quick_up","_rail","ratingssection","read_also","readmore","read-next","read_next","read_time","read-time","reading_time","reading-time","reading-list","recent-","recent-articles","recentpost","recent_post","recent-post","recommend","redirectedfrom","recirc","register","(?<!h[1-6]-)related","relevant","relposts","reversefootnote","rightcol","\\bnocontent\\b","_rss","rss-link","rubricwrapper","screen-reader-text","scroll_to","scroll-to","_search","-search","section-nav","series-banner","share-box","sharedaddy","share-icons","sharelinks","share-links","share-post","share-print","share-section","share-text","sharing_","shariff-","shortcode-id","show-for-print","sidebartitle","sidebar-content","sidebar-wrapper","sideitems","sidebar-author","sidebar-item","side-box","sign-in-gate","similar-","similar_","similars-","site-index","site-header","siteheader","site-name","site-wordpress","skip-content","skip-to-content","skip-link","c-skip-link","_skip-link","-slider","slug-wrap","social-author","social-button","social-shar","social-date","speechify-ignore","speedbump","sponsor","springercitation","sr-only","_stats","sticky-social","story-date","story-navigation","storyreadtime","storysmall","storypublishdate","subject-label","submenu","-subscribe-","subscriber-drive","subscription-","_tags","tags__item","tag_list","tag-list","tag-module","takeaways","taxonomy","table-of-contents","tblc","tabs-","terminaltout","time-rubric","timestamp","time-read","time-to-read","tip_off","-ticker","tiptout","-tout-","toc-container","toggle-caption","tooltip-content","topbar","subnavbar","topic-authors","topic-footer","topic-list","topic-subnav","top-wrapper","tree-item","trending","trust-feat","trust-badge","trust-project","chakra-badge","twiblock","u-hide","upsell","vid_carousel","viewbottom","view-language","yarpp-related","visually-hidden","welcomebox","widget_pages","window__widget","w-form-done","w-form-fail"],w.PARTIAL_SELECTORS_REGEX=new RegExp(w.PARTIAL_SELECTORS.join("|"),"i"),w.PARTIAL_SELECTORS_ANCHORED_REGEX=new RegExp("^(?:"+w.PARTIAL_SELECTORS.join("|")+")$","i"),w.TEST_ATTRIBUTES_SELECTOR=w.TEST_ATTRIBUTES.map((L=>`[${L}]`)).join(","),w.FOOTNOTE_INLINE_REFERENCES=["sup.reference","cite.ltx_cite",'sup[id^="fnr"]','span[id^="fnr"]','span[class*="footnote_ref"]','span[class*="footnote-ref"]',"span.footnote-link","a.citation",'a[id^="ref-link"]','a[href^="#fn"]','a[href^="#cite"]','a[href^="#reference"]','a[href^="#footnote"]','a[href^="#r"]','a[href^="#b"]','a[href*="cite_note"]','a[href*="cite_ref"]',"a.footnote-anchor","span.footnote-hovercard-target a",'a[role="doc-biblioref"]','a[id^="fnref"]','a[id^="ref-link"]',"sup.footnoteref","sup.footnote-reference",'sup[data-fn] > a[href^="#"]','sup[id^="ftnt_ref"] a[href^="#ftnt"]','span.easy-footnote > a[href^="#easy-footnote-bottom-"]','a.footnote[href^="#"]','a[data-type="noteref"]'].join(","),w.FOOTNOTE_LIST_SELECTORS=["div.footnote ol","div.footnotes ol",'div[role="doc-endnotes"]','div[role="doc-footnotes"]',"ol.footnotes-list","ol.footnotes","ol.references",'ol[class*="article-references"]',"section.footnotes ol",'section[role="doc-endnotes"]','section[role="doc-footnotes"]','section[role="doc-bibliography"]',"ul.footnotes-list","ul.ltx_biblist",'div.footnote[data-component-name="FootnoteToDOM"]',"div.footnotes-footer","div.footnote-definitions","div.footnote-definition","ol.wp-block-footnotes","ol.easy-footnotes-wrapper","div.footnotes-segment","#footnotes"].join(","),w.ALLOWED_EMPTY_ELEMENTS=new Set(["area","audio","base","br","circle","col","defs","ellipse","embed","figure","g","hr","iframe","img","input","line","link","mask","meta","object","param","path","pattern","picture","polygon","polyline","rect","source","stop","svg","td","th","track","use","video","wbr"]),w.ALLOWED_ATTRIBUTES=new Set(["alt","allow","allowfullscreen","aria-label","checked","colspan","controls","data-latex","data-src","data-srcset","data-callout","data-callout-fold","data-callout-title","data-lang","dir","display","frameborder","headers","height","href","kind","label","lang","role","rowspan","sandbox","src","srclang","srcset","start","title","type","width","accent","accentunder","align","columnalign","columnlines","columnspacing","columnspan","data-mjx-texclass","depth","displaystyle","fence","frame","framespacing","linethickness","lspace","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","rowalign","rowlines","rowspacing","rowspan","rspace","scriptlevel","separator","stretchy","symmetric","voffset","xmlns"]),w.ALLOWED_ATTRIBUTES_DEBUG=new Set(["class","id"]),w.TAILWIND_COLORS={slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},w.TAILWIND_SPECIAL={black:"#000",white:"#fff",transparent:"transparent",current:"currentColor"},w.TW_COLOR_CLASS_RE=/^(fill|stroke)-([a-z]+)-(\d{2,3})(?:\/(\d+))?$/,w.TW_SPECIAL_CLASS_RE=/^(fill|stroke)-(black|white|transparent|current)$/,w.TW_ARBITRARY_RE=/^text-\[(.+)\]$/},4467(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.findContentStart=function s(i,c){const f=(function(y,a){const d=(0,P.normalizeText)(a);if(!d)return null;const p=y.querySelectorAll("h1, h2");for(const x of p)if((0,P.normalizeText)(x.textContent||"")===d)return x;return null})(i,c)||null,u=i.ownerDocument.createTreeWalker(i,1);f&&(u.currentNode=f);let h=null,b=null,g=u.nextNode();for(;g;){const y=g;if(o(y)){if(t.has(y.tagName)){h=y;break}b||(b=y)}g=u.nextNode()}if(h)return h;if(b){let y=b;for(;;){let a=null,d=!1;for(const p of y.children)if(o(p)){if(a){d=!0;break}a=p}if(!a||d)break;y=a}return y}return f?s(i,""):null},w.isAboveContentStart=function(s,i){if(!i||s===i)return!1;const c=s.compareDocumentPosition(i);return!(1&c)&&!!(4&c)};const P=I(2552),L=/(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*|\d{4}[-/]\d{1,2}[-/]\d{1,2})/i,_=/^by\s+\S/i,A=/[.!?]/,S=/\b(?:isHidden(?:-[A-Za-z0-9_]+)?|is-hidden)\b/,n=new Set(["P","DIV","SECTION","ARTICLE","BLOCKQUOTE","FONT"]),t=new Set(["P","BLOCKQUOTE","FONT"]),r='[role="dialog"], [role="alertdialog"]',e=`aside, nav, header, footer, form, ${r}`;function o(s){if(!s.tagName||!n.has(s.tagName)||s.closest(e))return!1;const i=typeof s.className=="string"?s.className:"";if(S.test(i)||s.querySelector(r)||s.querySelector("script, style"))return!1;const c=(s.textContent||"").trim();if(!c)return!1;const f=(0,P.countWords)(c);return!(f<7)&&!!A.test(c)&&!(_.test(c)&&f<15)&&!(L.test(c)&&f<20)&&!((function(u){let h=0;for(const b of u.querySelectorAll("a"))h+=(b.textContent||"").length;return h})(s)>.7*c.length)&&!(s.tagName==="DIV"&&!s.querySelector("p"))}},5628(at,w,I){var P=this&&this.__awaiter||function(y,a,d,p){return new(d||(d=Promise))((function(x,l){function m(q){try{E(p.next(q))}catch(C){l(C)}}function v(q){try{E(p.throw(q))}catch(C){l(C)}}function E(q){var C;q.done?x(q.value):(C=q.value,C instanceof d?C:new d((function(N){N(C)}))).then(m,v)}E((p=p.apply(y,a||[])).next())}))};Object.defineProperty(w,"__esModule",{value:!0}),w.Defuddle=void 0;const L=I(1608),_=I(1917),A=I(2640),S=I(4840),n=I(3610),t=I(7726),r=I(3550),e=I(2408),o=I(8983),s=I(7393),i=I(3172),c=I(662),f=I(2552),u=I(639),h=new Set(["title","author","published","site","description","image","language"]),b=/[:\[\]()#>~+,]/;class g{constructor(a,d={}){this._schemaOrgData=void 0,this._schemaOrgExtracted=!1,this._inExtractorPipelineRun=!1,this.doc=a,this.options=d,this.debug=d.debug||!1}getSchemaOrgData(){return this._schemaOrgExtracted||(this._schemaOrgData=this._extractSchemaOrgData(this.doc),this._schemaOrgExtracted=!0),this._schemaOrgData}parse(){this.doc.body&&(this._normalizeAttributes(this.doc.body),this._resolveNoscriptImages(this.doc.body));let a=this.parseInternal();if(a.wordCount<200){this._log("Initial parse returned very little content, trying again");const p=this.parseInternal({removePartialSelectors:!1});p.wordCount>2*a.wordCount&&(this._log("Retry produced more content"),a=p)}if(a.wordCount<50){this._log("Still very little content, retrying without hidden-element removal");const p=this.parseInternal({removeHiddenElements:!1});p.wordCount>2*a.wordCount&&(this._log("Hidden-element retry produced more content"),a=p);const x=this.findLargestHiddenContentSelector();if(x){this._log("Retrying with hidden content selector:",x);const l=this.parseInternal({removeHiddenElements:!1,removePartialSelectors:!1,contentSelector:x});(l.wordCount>a.wordCount||l.wordCount>Math.max(20,.7*a.wordCount)&&l.content.length<a.content.length)&&(this._log("Hidden-selector retry produced better focused content"),a=l)}}if(a.wordCount<50){this._log("Still very little content, retrying without scoring/partial selectors (possible index page)");const p=this.parseInternal({removeLowScoring:!1,removePartialSelectors:!1,removeContentPatterns:!1});p.wordCount>a.wordCount&&(this._log("Index page retry produced more content"),a=p)}const d=this._getSchemaText(a.schemaOrgData);if(d&&this.countHtmlWords(d)>1.5*a.wordCount){const p=this.doc,x=p.cloneNode(!0);this._stripUnsafeElements(x.body),this.doc=x;try{const l=this._findElementBySchemaText(this.doc.body,d);if(l){const m=this.getElementSelector(l);this._log("Schema.org suggests a better content element, retrying with selector:",m),a=this.parseInternal({contentSelector:m})}else this._log("Using schema.org text as content (DOM element not found)"),a.content=d,a.wordCount=this.countHtmlWords(d)}finally{this.doc=p}}return a}_getSchemaText(a,d=0){if(!a||d>10)return"";const p=Array.isArray(a)?a:[a];for(const x of p)if(Array.isArray(x)){const l=this._getSchemaText(x,d+1);if(l)return l}else{if(x?.text&&typeof x.text=="string")return x.text;if(x?.articleBody&&typeof x.articleBody=="string")return x.articleBody;if(x?.["@graph"]&&Array.isArray(x["@graph"])){const l=this._getSchemaText(x["@graph"],d+1);if(l)return l}}return""}_serializeFallbackBody(){if(!this.doc.body)return"";const a=this.doc.body.cloneNode(!0);return this._stripUnsafeElements(a),this.resolveContentUrls((0,u.serializeHTML)(a))}_stripUnsafeElements(a){if(!a)return;const d=a.querySelectorAll('script:not([type^="math/"]), style, noscript, frame, frameset, object, embed, applet, base');for(const x of d)x.remove();const p=[a,...Array.from(a.querySelectorAll("*"))];for(const x of p)for(const l of Array.from(x.attributes)){const m=l.name.toLowerCase();if(m.startsWith("on"))x.removeAttribute(l.name);else if(m==="srcdoc")x.removeAttribute(l.name);else if(["href","src","action","formaction","xlink:href"].includes(m)){const v=!(m==="src"&&x.tagName==="IFRAME");(0,u.isDangerousUrl)(l.value,v)&&x.removeAttribute(l.name)}}}_deduplicateImages(a){for(const p of a.querySelectorAll("figure")){const x=Array.from(p.querySelectorAll("img")).filter((m=>!m.closest("noscript")&&m.parentElement));if(x.length<2)continue;const l=new Map;for(const m of x){const v=m.getAttribute("src")||"";if(!v||v.startsWith("data:"))continue;const E=(m.getAttribute("alt")||"").trim()||null,q=l.get(E)||[];q.push(m),l.set(E,q)}for(const[m,v]of l)v.length<2||m!==null&&v.every((E=>E.getAttribute("src")===v[0].getAttribute("src")))||this._keepBestImage(v)}const d=Array.from(a.querySelectorAll("img"));for(let p=0;p<d.length-1;p++){const x=d[p];if(!x.parentElement||x.closest("noscript")||x.closest("figure"))continue;const l=(x.getAttribute("alt")||"").trim();if(!l)continue;const m=x.getAttribute("src")||"";if(!m||m.startsWith("data:"))continue;const v=d[p+1];if(!v.parentElement||v.closest("noscript")||v.closest("figure")||(v.getAttribute("alt")||"").trim()!==l)continue;const E=v.getAttribute("src")||"";E&&!E.startsWith("data:")&&E!==m&&this._noVisibleContentBetween(x,v)&&this._keepBestImage([x,v])}for(const p of Array.from(a.querySelectorAll("img"))){if(!p.parentElement||p.closest("a, figure, noscript"))continue;const x=p.getAttribute("src")||"";if(!x||x.startsWith("data:"))continue;const l=p.parentElement,m=this._normalizeSrc(x);for(const v of l.querySelectorAll(":scope > a[href]")){if(!v.querySelector("img"))continue;const E=v.getAttribute("href")||"";if(m===this._normalizeSrc(E)){p.remove();break}}}}_keepBestImage(a){let d=a[0];for(let p=1;p<a.length;p++){const x=this._pickBestImage(d,a[p]);(x===d?a[p]:d).remove(),d=x}}_noVisibleContentBetween(a,d){const p=x=>{if(!x)return null;if(x.firstChild)return x.firstChild;let l=x;for(;l;){if(l.nextSibling)return l.nextSibling;l=l.parentNode}return null};for(let x=p(a);x&&x!==d;x=p(x))if(x.nodeType===3&&(x.textContent||"").trim())return!1;return!0}_normalizeSrc(a){return a.replace(/^https?:\/\//,"").split("?")[0]}_removeCoverImage(a,d){if(!d)return;const p=this._normalizeSrc(d);for(const x of a.querySelectorAll("img")){const l=x.getAttribute("src")||"";if(!l||l.startsWith("data:")||this._normalizeSrc(l)!==p)continue;const m=this._getLargestImageSrc(x),v=x.closest("figure");return v&&v.querySelector("figcaption")||x.remove(),m}}_pickBestImage(a,d){const p=a.getAttribute("srcset")?2:a.closest("picture")?1:0,x=d.getAttribute("srcset")?2:d.closest("picture")?1:0;if(p!==x)return p>x?a:d;const l=g._urlWidth(a),m=g._urlWidth(d);return l!==m?l>m?a:d:a}static _urlWidth(a){const d=(a.getAttribute("src")||"").match(g._urlWidthPattern);return d?parseInt(d[1],10):0}_normalizeAttributes(a){const d=[["srcSet","srcset"]],p=a.querySelectorAll("img, source");for(const x of p)for(const[l,m]of d){const v=x.getAttribute(l);v!==null&&(x.removeAttribute(l),x.setAttribute(m,v))}}_resolveNoscriptImages(a){const d=a.querySelectorAll("noscript");for(const p of d){let x=p.querySelector("img");if(!x){let C=p.innerHTML||"";if(C.includes("<img")||(C=p.textContent||""),!C.includes("<img"))continue;x=(0,u.parseHTML)(this.doc,C).querySelector("img")}if(!x)continue;const l=x.getAttribute("src")||"";if(!l||l.startsWith("data:"))continue;const m=x.getAttribute("alt"),v=p.parentElement;if(!v)continue;let E=!1;const q=v.querySelectorAll(":scope > img");for(const C of q){if(!(C.getAttribute("src")||"").startsWith("data:")||!m||C.getAttribute("alt")!==m)continue;C.setAttribute("src",l);const N=x.getAttribute("srcset")||"";N&&C.setAttribute("srcset",N),E=!0;break}if(!E&&this._isLazyImageContext(p)){const C=(p.closest("figure")||v).querySelectorAll("img");let N=!1;for(const O of C){if(O.closest("noscript"))continue;const T=O.getAttribute("src")||"";if(T&&!T.startsWith("data:")){N=!0;break}}if(!N){const O=x.cloneNode(!0);v.insertBefore(O,p)}}}}_isLazyImageContext(a){if(a.closest("figure"))return!0;const d=a.parentElement;if(d){for(const x of d.children)if(x!==a&&(0,u.getClassName)(x).toLowerCase().includes("lazy"))return!0;const p=(0,u.getClassName)(d).toLowerCase();if(p.includes("image")||p.includes("img")||p.includes("picture")||p.includes("photo")||p.includes("media"))return!0}return!1}_findElementBySchemaText(a,d){var p;const x=(((p=d.split(/\n\s*\n/)[0])===null||p===void 0?void 0:p.trim())||"").substring(0,100).trim();if(!x)return null;const l=(0,f.countWords)(d);let m=null,v=1/0;const E=a.querySelectorAll("*");for(const q of E){if(q===a)continue;const C=q.textContent||"";if(!C.includes(x))continue;const N=(0,f.countWords)(C);N>=.8*l&&N<v&&(v=N,m=q)}return m}findLargestHiddenContentSelector(){const a=this.doc.body;if(!a)return;const d=Array.from(a.querySelectorAll(A.HIDDEN_EXACT_SKIP_SELECTOR)).filter((l=>!(l.getAttribute("class")||"").includes("math")));let p=null,x=0;for(const l of d){const m=(0,f.countWords)(l.textContent||"");m>x&&(p=l,x=m)}return!p||x<30?void 0:this.getElementSelector(p)}_getLargestImageSrc(a){const d=a.getAttribute("srcset")||"";if(!d)return a.getAttribute("src")||"";const p=/(.+?)\s+(\d+(?:\.\d+)?)w/g;let x,l="",m=0,v=0;for(;(x=p.exec(d))!==null;){let q=x[1].trim();v>0&&(q=q.replace(/^,\s*/,"")),v=p.lastIndex;const C=parseFloat(x[2]);q&&C>m&&(m=C,l=q)}let E=l||a.getAttribute("src")||"";return E=E.replace(/,w_\d+/g,"").replace(/,c_\w+/g,""),E}parseAsync(){return P(this,void 0,void 0,(function*(){var a;if(this.options.useAsync!==!1){const p=yield this.tryAsyncExtractor(_.ExtractorRegistry.findPreferredAsyncExtractor.bind(_.ExtractorRegistry));if(p)return p}const d=this.parse();return d.wordCount>0||this.options.useAsync===!1?d:(a=yield this.tryAsyncExtractor(_.ExtractorRegistry.findAsyncExtractor.bind(_.ExtractorRegistry)))!==null&&a!==void 0?a:d}))}fetchAsyncVariables(){return P(this,void 0,void 0,(function*(){var a;if(this.options.useAsync===!1)return null;try{const d=this.options.url||this.doc.URL,p=this.getSchemaOrgData(),x={includeReplies:(a=this.options.includeReplies)!==null&&a!==void 0?a:"extractors",language:this.options.language,fetch:this.options.fetch},l=_.ExtractorRegistry.findPreferredAsyncExtractor(this.doc,d,p,x);if(l){const m=yield l.extractAsync();return this.getExtractorVariables(m.variables)||null}}catch(d){console.error("Defuddle","Error fetching async variables:",d)}return null}))}tryAsyncExtractor(a){return P(this,void 0,void 0,(function*(){var d;try{const p=this.options.url||this.doc.URL,x=this.getSchemaOrgData(),l={includeReplies:(d=this.options.includeReplies)!==null&&d!==void 0?d:"extractors",language:this.options.language,fetch:this.options.fetch},m=a(this.doc,p,x,l);if(m){const v=Date.now(),E=yield m.extractAsync(),q=this._collectMetaTags(),C=L.MetadataExtractor.extract(this.doc,x,q);return this.buildExtractorResponse(E,C,v,m,q)}}catch(p){console.error("Defuddle","Error in async extraction:",p)}return null}))}parseInternal(a={}){var d,p,x,l,m,v,E;const q=Date.now(),C={},N=(d=this.options.profile)!==null&&d!==void 0&&d,O=(W,B)=>{if(!N)return B();const H=performance.now(),k=B();return C[W]=Math.round(performance.now()-H),k};if(!this.doc.documentElement){const W=this.options.url||"";return{content:"",title:"",description:"",domain:W?new URL(W).hostname:"",favicon:"",image:"",language:"",parseTime:Date.now()-q,published:"",author:"",site:"",schemaOrgData:null,wordCount:0}}const T=Object.assign(Object.assign({removeExactSelectors:!0,removePartialSelectors:!0,removeHiddenElements:!0,removeLowScoring:!0,removeSmallImages:!0,removeContentPatterns:!0,standardize:!0,includeReplies:"extractors"},this.options),a),R=[],D=this.getSchemaOrgData();this._metaTags||(this._metaTags=this._collectMetaTags());const $=this._metaTags;this._metadata||(this._metadata=L.MetadataExtractor.extract(this.doc,D,$));const M=this._metadata;T.removeImages&&this.removeImages(this.doc);try{const W=T.url||this.doc.URL,B={includeReplies:T.includeReplies,language:T.language,fetch:T.fetch};if(!this._inExtractorPipelineRun){const K=_.ExtractorRegistry.findExtractor(this.doc,W,D,B);if(K&&K.canExtract()){const V=K.extract();if(V.contentSelector){this._inExtractorPipelineRun=!0;try{const X=this.parseInternal({contentSelector:V.contentSelector,removeLowScoring:!1,removeHiddenElements:!1}),Z=this.getExtractorVariables(V.variables);return Object.assign(Object.assign(Object.assign({},X),{title:((p=V.variables)===null||p===void 0?void 0:p.title)||X.title,description:((x=V.variables)===null||x===void 0?void 0:x.description)||X.description,author:((l=V.variables)===null||l===void 0?void 0:l.author)||X.author,published:((m=V.variables)===null||m===void 0?void 0:m.published)||X.published,site:((v=V.variables)===null||v===void 0?void 0:v.site)||X.site,language:((E=V.variables)===null||E===void 0?void 0:E.language)||X.language,extractorType:K.constructor.name.replace("Extractor","").toLowerCase()}),Z?{variables:Z}:{})}finally{this._inExtractorPipelineRun=!1}}return this.buildExtractorResponse(V,M,q,K,$)}}this._mobileStyles||(this._mobileStyles=this._evaluateMediaQueries(this.doc));const H=this._mobileStyles;this._smallImages||(this._smallImages=(0,e.findSmallImages)(this.doc,this.debug));const k=this._smallImages;let F;O("cloneDocument",(()=>{var K;F=this.doc.cloneNode(!0),(K=F.body)===null||K===void 0||K.normalize()})),O("flattenShadowRoots",(()=>this.flattenShadowRoots(this.doc,F))),O("resolveStreamedContent",(()=>this.resolveStreamedContent(F))),O("applyMobileStyles",(()=>this.applyMobileStyles(F,H)));const z=O("findMainContent",(()=>{let K=null;if(T.contentSelector&&(K=F.querySelector(T.contentSelector),this._log("Using contentSelector:",T.contentSelector,K?"found":"not found")),K||(K=this.findMainContent(F)),K){const V=K.closest("[data-defuddle]");V&&(K=V)}if(K&&K.tagName.toLowerCase()==="body"){const V=this._getSchemaText(D);if(V){const X=this._findElementBySchemaText(F.body,V);X&&(this._log("Found content element via schema.org text"),K=X)}}return K}));if(!z){const K=this._serializeFallbackBody(),V=Date.now();return Object.assign(Object.assign({content:K},M),{wordCount:this.countHtmlWords(K),parseTime:Math.round(V-q),metaTags:$})}O("removeMetadataBlock",(()=>{(M.published||M.author)&&(0,c.removeMetadataBlock)(z),z.querySelectorAll("wbr").forEach((K=>K.remove()))})),O("adoptExternalFootnotes",(()=>{T.standardize&&this.adoptExternalFootnotes(z,F)})),O("standardizeFootnotesCallouts",(()=>{T.standardize&&((0,n.standardizeFootnotes)(z),(0,t.standardizeCallouts)(z))})),O("removeSmallImages",(()=>{T.removeSmallImages&&(0,e.removeSmallImages)(F,k,this.debug)})),O("removeHiddenElements",(()=>{T.removeHiddenElements&&(0,o.removeHiddenElements)(F,this.debug,R)})),O("removeEyebrowLabel",(()=>{T.removeContentPatterns&&z&&(0,i.removeEyebrowLabel)(z,this.debug,R)})),O("removeBySelector",(()=>{(T.removeExactSelectors||T.removePartialSelectors)&&(0,s.removeBySelector)(F,this.debug,T.removeExactSelectors,T.removePartialSelectors,z,R,T.removeHiddenElements===!1)})),O("removeLowScoring",(()=>{T.removeLowScoring&&r.ContentScorer.scoreAndRemove(F,this.debug,R,z)})),O("removeByContentPattern",(()=>{if(T.removeContentPatterns&&z){const K=this.options.url||this.doc.URL||"";(0,i.removeByContentPattern)(z,this.debug,K,M.title||"",M.description||"",R)}})),O("standardizeContent",(()=>{T.standardize&&(0,S.standardizeContent)(z,M,this.doc,this.debug,N?C:void 0)})),O("resolveRelativeUrls",(()=>this.resolveRelativeUrls(z))),this._deduplicateImages(z);const Y=this._removeCoverImage(z,M.image||"");Y&&(M.image=Y),this._stripUnsafeElements(z);const ot=z.outerHTML,U=Date.now(),Q=Object.assign(Object.assign({content:ot},M),{wordCount:this.countHtmlWords(ot),parseTime:Math.round(U-q),metaTags:$});return this.debug&&(Q.debug={contentSelector:this.getElementSelector(z),removals:R}),this.options.profile&&(Q.profile=C),Q}catch(W){console.error("Defuddle","Error processing document:",W);const B=this._serializeFallbackBody(),H=Date.now();return Object.assign(Object.assign({content:B},M),{wordCount:this.countHtmlWords(B),parseTime:Math.round(H-q),metaTags:$})}}countHtmlWords(a){const d=a.replace(/<[^>]*>/g," ").replace(/&nbsp;/gi," ").replace(/&amp;/gi,"&").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#\d+;/g," ").replace(/&\w+;/g," ");return(0,f.countWords)(d)}_log(...a){this.debug&&console.log("Defuddle:",...a)}_evaluateMediaQueries(a){const d=[],p=/max-width[^:]*:\s*(\d+)/;try{if(!a.styleSheets)return d;Array.from(a.styleSheets).filter((l=>{try{return l.cssRules,!0}catch(m){return m instanceof DOMException&&m.name,!1}})).flatMap((l=>{try{return typeof CSSMediaRule>"u"?[]:Array.from(l.cssRules).filter((m=>m instanceof CSSMediaRule&&m.conditionText.includes("max-width")))}catch(m){return this.debug&&console.warn("Defuddle: Failed to process stylesheet:",m),[]}})).forEach((l=>{const m=l.conditionText.match(p);if(m){const v=parseInt(m[1]);A.MOBILE_WIDTH<=v&&Array.from(l.cssRules).filter((E=>E instanceof CSSStyleRule)).forEach((E=>{try{d.push({selector:E.selectorText,styles:E.style.cssText})}catch(q){this.debug&&console.warn("Defuddle: Failed to process CSS rule:",q)}}))}}))}catch(x){console.error("Defuddle: Error evaluating media queries:",x)}return d}applyMobileStyles(a,d){d.forEach((({selector:p,styles:x})=>{try{a.querySelectorAll(p).forEach((l=>{l.setAttribute("style",(l.getAttribute("style")||"")+x)}))}catch(l){console.error("Defuddle","Error applying styles for selector:",p,l)}}))}removeImages(a){const d=a.getElementsByTagName("img");Array.from(d).forEach((p=>{p.remove()}))}findMainContent(a){const d=[];if(A.ENTRY_POINT_ELEMENTS.forEach(((l,m)=>{a.querySelectorAll(l).forEach((v=>{let E=40*(A.ENTRY_POINT_ELEMENTS.length-m);E+=r.ContentScorer.scoreElement(v),d.push({element:v,score:E,selectorIndex:m})}))})),d.length===0)return this.findContentByScoring(a);if(d.sort(((l,m)=>m.score-l.score)),this.debug&&this._log("Content candidates:",d.map((l=>({element:l.element.tagName,selector:this.getElementSelector(l.element),score:l.score})))),d.length===1&&d[0].element.tagName.toLowerCase()==="body"){const l=this.findTableBasedContent(a);if(l)return l}const p=d[0];let x=p;for(let l=1;l<d.length;l++){const m=d[l],v=(0,f.countWords)(m.element.textContent||"");if(m.selectorIndex<x.selectorIndex&&x.element.contains(m.element)&&v>50){let E=0;for(const q of d)if(q.selectorIndex===m.selectorIndex&&p.element.contains(q.element)&&++E>1)break;if(E>1)continue;x=m}}return x!==p?x.element:p.element}findTableBasedContent(a){if(!Array.from(a.getElementsByTagName("table")).some((l=>{var m;const v=parseInt(l.getAttribute("width")||"0"),E=this.getComputedStyle(l),q=(0,u.getClassName)(l).toLowerCase();return v>400||((m=E?.width)===null||m===void 0?void 0:m.includes("px"))&&parseInt(E.width)>400||l.getAttribute("align")==="center"||q.includes("content")||q.includes("article")||Array.from(l.getElementsByTagName("tr")).some((C=>{const N=Array.from(C.children).filter((O=>O.tagName==="TD"));return N.length>=2&&N.some((O=>O.getAttribute("width")))}))})))return null;const p=Array.from(a.getElementsByTagName("td")),x=r.ContentScorer.findBestElement(p);return x?2*(0,f.countWords)(x.textContent||"")<(0,f.countWords)((a.body||a.documentElement).textContent||"")?null:x:null}findContentByScoring(a){const d=[];return a.querySelectorAll(A.BLOCK_ELEMENTS_SELECTOR).forEach((p=>{const x=r.ContentScorer.scoreElement(p);x>0&&d.push({score:x,element:p})})),d.length>0?d.sort(((p,x)=>x.score-p.score))[0].element:null}getElementSelector(a){const d=[];let p=a;for(;p&&p!==this.doc.documentElement;){let x=p.tagName.toLowerCase();if(p.id)x+="#"+p.id;else if((0,u.getClassName)(p)){const l=(0,u.getClassName)(p).trim().split(/\s+/).filter((m=>!b.test(m)));l.length&&(x+="."+l.join("."))}d.unshift(x),p=p.parentElement}return d.join(" > ")}getComputedStyle(a){return(0,f.getComputedStyle)(a)}adoptExternalFootnotes(a,d){const p=d.body||d;p&&a!==p&&p.querySelectorAll("div, section, aside").forEach((x=>{var l;const m=(0,u.getClassName)(x),v=x.id||"";if(!/footnote/i.test(m)&&!/footnote/i.test(v)||a.contains(x)||x.contains(a))return;const E=x.querySelector("h1, h2, h3, h4, h5, h6");E&&n.FOOTNOTE_SECTION_RE.test(((l=E.textContent)===null||l===void 0?void 0:l.trim())||"")&&a.appendChild(x)}))}resolveRelativeUrls(a){const d=this.options.url||this.doc.URL;if(!d)return;let p=d;const x=this.doc.querySelector("base[href]");if(x){const m=x.getAttribute("href");if(m)try{p=new URL(m,d).href}catch{}}const l=m=>{const v=m.trim().replace(/^\\?["']+/,"").replace(/\\?["']+$/,"");if(v.startsWith("#"))return v;try{return new URL(v,p).href}catch{return v||m}};a.querySelectorAll("[href]").forEach((m=>{const v=m.getAttribute("href");v&&m.setAttribute("href",l(v))})),a.querySelectorAll("[src]").forEach((m=>{const v=m.getAttribute("src");v&&m.setAttribute("src",l(v))})),a.querySelectorAll("[srcset]").forEach((m=>{const v=m.getAttribute("srcset");if(v){const E=/(.+?)\s+(\d+(?:\.\d+)?[wx])/g,q=[];let C,N=0;for(;(C=E.exec(v))!==null;){let O=C[1].trim();N>0&&(O=O.replace(/^,\s*/,"")),N=E.lastIndex,q.push(`${l(O)} ${C[2]}`)}if(q.length>0)m.setAttribute("srcset",q.join(", "));else{const O=v.split(",").map((T=>{const R=T.trim().split(/\s+/);return R[0]&&(R[0]=l(R[0])),R.join(" ")})).join(", ");m.setAttribute("srcset",O)}}})),a.querySelectorAll("[poster]").forEach((m=>{const v=m.getAttribute("poster");v&&m.setAttribute("poster",l(v))}))}flattenShadowRoots(a,d){var p,x,l;if(!a.body||!d.body)return;const m=Array.from(a.body.querySelectorAll("*")),v=m.find((q=>q.shadowRoot));if(!v)return;const E=Array.from(d.body.querySelectorAll("*"));if(((l=(x=(p=v.shadowRoot)===null||p===void 0?void 0:p.childNodes)===null||x===void 0?void 0:x.length)!==null&&l!==void 0?l:0)>0)for(let q=m.length-1;q>=0;q--){const C=m[q];if(!C.shadowRoot)continue;const N=E[q];if(!N)continue;const O=C.shadowRoot.innerHTML;O.length>0&&this.replaceShadowHost(N,O,d)}else{const q=[];for(let C=0;C<m.length;C++){const N=m[C],O=N.getAttribute("data-defuddle-shadow");if(!O)continue;const T=E[C];T&&(q.push({cloneEl:T,html:O}),N.removeAttribute("data-defuddle-shadow"),T.removeAttribute("data-defuddle-shadow"))}for(const{cloneEl:C,html:N}of q)this.replaceShadowHost(C,N,d)}}resolveStreamedContent(a){const d=a.querySelectorAll("script"),p=[],x=/\$RC\("(B:\d+)","(S:\d+)"\)/g;for(const m of d){const v=m.textContent||"";if(!v.includes("$RC("))continue;let E;for(x.lastIndex=0;(E=x.exec(v))!==null;)p.push({templateId:E[1],contentId:E[2]})}if(p.length===0)return;let l=0;for(const{templateId:m,contentId:v}of p){const E=a.getElementById(m),q=a.getElementById(v);if(!E||!q)continue;const C=E.parentNode;if(!C)continue;let N=E.nextSibling,O=!1;for(;N;){const T=N.nextSibling;if(N.nodeType===8&&N.data==="/$"){N.remove(),O=!0;break}N.remove(),N=T}if(O){for(;q.firstChild;)C.insertBefore(q.firstChild,E);E.remove(),q.remove(),l++}}l>0&&this._log("Resolved streamed content:",l,"suspense boundaries")}replaceShadowHost(a,d,p){var x;const l=(0,u.parseHTML)(p,d);if(a.tagName.includes("-")){const m=p.createElement("div");m.appendChild(l),(x=a.parentNode)===null||x===void 0||x.replaceChild(m,a)}else a.textContent="",a.appendChild(l)}resolveContentUrls(a){if(!(this.options.url||this.doc.URL))return a;const d=this.doc.createElement("div");return d.appendChild((0,u.parseHTML)(this.doc,a)),this.resolveRelativeUrls(d),(0,u.serializeHTML)(d)}_extractSchemaOrgData(a){const d=a.querySelectorAll('script[type="application/ld+json"]'),p=[];d.forEach((l=>{let m=l.textContent||"";try{m=m.replace(/\/\*[\s\S]*?\*\/|^\s*\/\/.*$/gm,"").replace(/^\s*<!\[CDATA\[([\s\S]*?)\]\]>\s*$/,"$1").replace(/^\s*(\*\/|\/\*)\s*|\s*(\*\/|\/\*)\s*$/g,"").trim();const v=JSON.parse(m);v["@graph"]&&Array.isArray(v["@graph"])?p.push(...v["@graph"]):p.push(v)}catch(v){console.error("Defuddle: Error parsing schema.org data:",v),this.debug&&console.error("Defuddle: Problematic JSON content:",m)}}));const x=l=>{if(typeof l=="string")return this._decodeHTMLEntities(l);if(Array.isArray(l))return l.map(x);if(typeof l=="object"&&l!==null){const m={};for(const v in l)Object.prototype.hasOwnProperty.call(l,v)&&(m[v]=x(l[v]));return m}return l};return p.map(x)}_collectMetaTags(){const a=[];return this.doc.querySelectorAll("meta").forEach((d=>{const p=d.getAttribute("name"),x=d.getAttribute("property");let l=d.getAttribute("content");l&&a.push({name:p,property:x,content:this._decodeHTMLEntities(l)})})),a}_decodeHTMLEntities(a){return(0,u.decodeHTMLEntities)(this.doc,a)}buildExtractorResponse(a,d,p,x,l){var m,v,E,q,C,N;const O=this._sanitizeExtractorHtml(a.contentHtml),T=this.getExtractorVariables(a.variables);return Object.assign({content:O,title:((m=a.variables)===null||m===void 0?void 0:m.title)||d.title,description:((v=a.variables)===null||v===void 0?void 0:v.description)||d.description,domain:d.domain,favicon:d.favicon,image:d.image,language:((E=a.variables)===null||E===void 0?void 0:E.language)||d.language,published:((q=a.variables)===null||q===void 0?void 0:q.published)||d.published,author:((C=a.variables)===null||C===void 0?void 0:C.author)||d.author,site:((N=a.variables)===null||N===void 0?void 0:N.site)||d.site,schemaOrgData:d.schemaOrgData,wordCount:this.countHtmlWords(O),parseTime:Math.round(Date.now()-p),extractorType:x.constructor.name.replace("Extractor","").toLowerCase(),metaTags:l},T?{variables:T}:{})}_sanitizeExtractorHtml(a){if(!a)return a;const d=this.doc.createElement("div");return d.appendChild((0,u.parseHTML)(this.doc,a)),this._stripUnsafeElements(d),this.resolveRelativeUrls(d),(0,u.serializeHTML)(d)}getExtractorVariables(a){if(!a)return;const d={};let p=!1;for(const[x,l]of Object.entries(a))h.has(x)||(d[x]=l,p=!0);return p?d:void 0}}w.Defuddle=g,g._urlWidthPattern=/(?:width[=:/]|[/,?&]w[_:=])(\d+)/},7726(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.standardizeCallouts=function(_){var A,S;const n=_.ownerDocument;if(!n)return;const t=Array.from(_.querySelectorAll(".callout.is-collapsed, .callout.is-collapsible"));for(const c of t){const f=c.classList.contains("is-collapsed");c.classList.remove("is-collapsed","is-collapsible"),c.hasAttribute("data-callout-fold")||c.setAttribute("data-callout-fold",f?"-":"+");const u=c.querySelector(".callout-fold");u&&u.remove();const h=c.querySelector(".callout-content");if(h){const b=h.getAttribute("style");if(b){const g=b.replace(/display\s*:\s*none\s*;?/gi,"").trim();g?h.setAttribute("style",g):h.removeAttribute("style")}}}const r=Array.from(_.querySelectorAll(".markdown-alert"));for(const c of r){const f=Array.from(c.classList).find((g=>g.startsWith("markdown-alert-")&&g!=="markdown-alert")),u=f?f.replace("markdown-alert-",""):"note",h=u.charAt(0).toUpperCase()+u.slice(1),b=c.querySelector(".markdown-alert-title");b&&b.remove(),c.replaceWith(L(n,u,h,c))}const e=Array.from(_.querySelectorAll('aside[class*="callout"]'));for(const c of e){const f=Array.from(c.classList).find((g=>g.startsWith("callout-"))),u=f?f.replace("callout-",""):"note",h=u.charAt(0).toUpperCase()+u.slice(1),b=c.querySelector(".callout-content");c.replaceWith(L(n,u,h,b||c))}const o=new Set(["info","warning","note","tip","danger","caution","important","abstract","success","question","failure","bug","example","quote"]),s=Array.from(_.querySelectorAll(".admonition"));for(const c of s){if(c.getAttribute("data-callout"))continue;const f=Array.from(c.classList).find((g=>o.has(g)))||"note",u=c.querySelector(".admonition-title"),h=((A=u?.textContent)===null||A===void 0?void 0:A.trim())||f.charAt(0).toUpperCase()+f.slice(1);u&&u.remove();const b=c.querySelector(".admonition-content")||c.querySelector(".details-content")||c;c.replaceWith(L(n,f,h,b))}const i=Array.from(_.querySelectorAll('.alert[class*="alert-"]'));for(const c of i){const f=Array.from(c.classList).find((g=>g.startsWith("alert-")&&g!=="alert-dismissible")),u=f?f.replace("alert-",""):"note",h=c.querySelector(".alert-heading, .alert-title"),b=((S=h?.textContent)===null||S===void 0?void 0:S.trim())||u.charAt(0).toUpperCase()+u.slice(1);h&&h.remove(),c.replaceWith(L(n,u,b,c))}};const P=I(639);function L(_,A,S,n){const t=_.createElement("div");t.setAttribute("data-callout",A),t.className="callout";const r=_.createElement("div");r.className="callout-title";const e=_.createElement("div");e.className="callout-title-inner",e.textContent=S,r.appendChild(e),t.appendChild(r);const o=_.createElement("div");return o.className="callout-content",(0,P.transferContent)(n,o),t.appendChild(o),t}},754(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.codeBlockRules=void 0;const P=I(2552),L=[/^language-(\w+)$/,/^lang-(\w+)$/,/^(\w+)-code$/,/^code-(\w+)$/,/^syntax-(\w+)$/,/^code-snippet__(\w+)$/,/^highlight-(\w+)$/,/^(\w+)-snippet$/,/(?:^|\s)(?:language|lang|brush|syntax)-(\w+)(?:\s|$)/i],_=new Set(["abap","actionscript","ada","adoc","agda","antlr4","applescript","arduino","armasm","asciidoc","aspnet","atom","bash","batch","c","clojure","cmake","cobol","coffeescript","cpp","c++","crystal","csharp","cs","dart","django","dockerfile","dotnet","elixir","elm","erlang","fortran","fsharp","gdscript","gitignore","glsl","golang","gradle","graphql","groovy","haskell","hs","haxe","hlsl","html","idris","java","javascript","js","jsx","jsdoc","json","jsonp","julia","kotlin","latex","lean","lean4","lisp","elisp","livescript","lua","makefile","markdown","md","markup","masm","mathml","matlab","mongodb","mysql","nasm","nginx","nim","nix","objc","ocaml","pascal","perl","php","postgresql","powershell","prolog","puppet","python","regex","rss","ruby","rb","rust","scala","scheme","shell","sh","solidity","sparql","sql","ssml","svg","swift","tcl","terraform","tex","toml","typescript","ts","tsx","unrealscript","verilog","vhdl","webassembly","wasm","xml","yaml","yml","zig"]);w.codeBlockRules=[{selector:["pre",'div[class*="prismjs"]',".syntaxhighlighter",".highlight",".highlight-source",".wp-block-syntaxhighlighter-code",".wp-block-code",'div[class*="language-"]',".code-block[data-lang]","code.hl.block"].join(", "),element:"pre",transform:(A,S)=>{var n;if(!(h=>"classList"in h&&"getAttribute"in h&&"querySelector"in h)(A))return A;A.querySelectorAll('button, [class*="codeblock-button"]').forEach((h=>h.remove())),A.querySelectorAll('[class*="header"], [class*="toolbar"], [class*="titlebar"], [class*="title-bar"]').forEach((h=>{var b;const g=h.tagName;if(g!=="DIV"&&g!=="SPAN")return;const y=(b=h.closest)===null||b===void 0?void 0:b.call(h,"[data-line], .line");if(y&&A.contains(y)||h.querySelector("[data-line], .line, pre"))return;const a=(h.textContent||"").trim();(0,P.countWords)(a)<=5&&h.remove()}));const t=h=>{var b;const g=h.getAttribute("data-lang")||h.getAttribute("data-language")||h.getAttribute("language");if(g)return g.toLowerCase();const y=Array.from(h.classList||[]);if(!((b=h.classList)===null||b===void 0)&&b.contains("syntaxhighlighter")){const a=y.find((d=>!["syntaxhighlighter","nogutter"].includes(d)));if(a&&_.has(a.toLowerCase()))return a.toLowerCase()}for(const a of y)for(const d of L){const p=a.toLowerCase().match(d);if(p&&p[1]&&_.has(p[1].toLowerCase()))return p[1].toLowerCase()}for(const a of y)if(_.has(a.toLowerCase()))return a.toLowerCase();return""};let r="",e=A;for(;e&&!r;){if(r=t(e),!r&&e===A){const h=e.querySelector('code[data-lang], code[class*="language-"]')||e.querySelector("code");h&&(r=t(h))}e=e.parentElement}const o=A.querySelector(".cm-content");if(o&&!r){const h=Array.from(A.querySelectorAll("div"));for(const b of h){if(b.contains(o))continue;const g=(b.textContent||"").trim().toLowerCase();if(g&&_.has(g)){r=g;break}}}const s=h=>{var b;if((0,P.isTextNode)(h))return!((b=h.parentElement)===null||b===void 0)&&b.querySelector("[data-line], .line")&&!(h.textContent||"").trim()?"":h.textContent||"";let g="";if((0,P.isElement)(h)){if(h.matches(".hover-info, .hover-container")||h.tagName==="BUTTON"||h.tagName==="STYLE")return"";if(h.tagName==="BR"){const y=h.previousElementSibling;return y&&y.matches('div[class*="line"], span[class*="line"], .ec-line, [data-line-number], [data-line]')?"":`
2
2
  `}if(h.matches("span.lnt")||h.matches("span.lineno")||h.matches(".react-syntax-highlighter-line-number")||h.matches(".rouge-gutter"))return"";if((h.tagName==="DIV"||h.tagName==="SPAN")&&h.children.length===2){const y=(h.children[0].textContent||"").trim();if(/^\d+$/.test(y))return s(h.children[1]).replace(/\n$/,"")+`
3
3
  `}if(h.matches('div[class*="line"], span[class*="line"], .ec-line, [data-line-number], [data-line]')){const y=h.querySelector('.code:not(.token), .content:not(.token), [class*="code-"], [class*="content-"]');if(y)return(y.textContent||"").replace(/\n$/,"")+`
4
4
  `;const a=h.querySelector('.line-number, .gutter, [class*="line-number"], [class*="gutter"]');return a?Array.from(h.childNodes).filter((d=>!a.contains(d))).map((d=>s(d))).join("").replace(/\n$/,"")+`