openclaw-node-harness 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +184 -0
- package/bin/discord-read.js +228 -0
- package/bin/fleet-deploy.js +365 -0
- package/bin/lane-watchdog.js +232 -0
- package/bin/mesh-agent.js +714 -0
- package/bin/mesh-bridge.js +535 -0
- package/bin/mesh-deploy-listener.js +322 -0
- package/bin/mesh-deploy.js +1048 -0
- package/bin/mesh-health-publisher.js +247 -0
- package/bin/mesh-task-daemon.js +451 -0
- package/bin/mesh-tool-discord.js +293 -0
- package/bin/mesh.js +649 -0
- package/boot/manifest.yaml +187 -0
- package/cli.js +35 -0
- package/config/daemon.json.template +16 -0
- package/config/obsidian-sync.json.template +39 -0
- package/config/openclaw.json.template +124 -0
- package/config/transcript-sources.json.template +22 -0
- package/identity/AGENTS.md +201 -0
- package/identity/CLAUDE.md +64 -0
- package/identity/DELEGATION.md +304 -0
- package/identity/HEARTBEAT.md +163 -0
- package/identity/MEMORY_SPEC.md +368 -0
- package/identity/PRINCIPLES.md +81 -0
- package/identity/SOUL.md +48 -0
- package/identity/TOOLS.md +47 -0
- package/install.sh +895 -0
- package/lib/agent-activity.js +390 -0
- package/lib/kanban-io.js +352 -0
- package/lib/mesh-registry.js +194 -0
- package/lib/mesh-roles.js +13 -0
- package/lib/mesh-tasks.js +306 -0
- package/lib/nats-resolve.js +108 -0
- package/mission-control/README.md +36 -0
- package/mission-control/drizzle/0000_simple_silhouette.sql +62 -0
- package/mission-control/drizzle/meta/0000_snapshot.json +413 -0
- package/mission-control/drizzle/meta/_journal.json +13 -0
- package/mission-control/drizzle.config.ts +13 -0
- package/mission-control/eslint.config.mjs +18 -0
- package/mission-control/next.config.ts +7 -0
- package/mission-control/package-lock.json +10518 -0
- package/mission-control/package.json +49 -0
- package/mission-control/postcss.config.mjs +7 -0
- package/mission-control/public/file.svg +1 -0
- package/mission-control/public/globe.svg +1 -0
- package/mission-control/public/next.svg +1 -0
- package/mission-control/public/vercel.svg +1 -0
- package/mission-control/public/window.svg +1 -0
- package/mission-control/scripts/enrich-descriptions.js +193 -0
- package/mission-control/scripts/gen-chronology.js +102 -0
- package/mission-control/scripts/import-pipeline-v2.js +523 -0
- package/mission-control/scripts/import-pipeline.js +295 -0
- package/mission-control/src/app/api/activity/live/route.ts +27 -0
- package/mission-control/src/app/api/activity/route.ts +47 -0
- package/mission-control/src/app/api/burndown/route.ts +112 -0
- package/mission-control/src/app/api/critical-path/route.ts +159 -0
- package/mission-control/src/app/api/dependencies/route.ts +176 -0
- package/mission-control/src/app/api/memory/categories/route.ts +93 -0
- package/mission-control/src/app/api/memory/consolidate/route.ts +107 -0
- package/mission-control/src/app/api/memory/doc/route.ts +89 -0
- package/mission-control/src/app/api/memory/flush/route.ts +129 -0
- package/mission-control/src/app/api/memory/graph/route.ts +105 -0
- package/mission-control/src/app/api/memory/items/route.ts +86 -0
- package/mission-control/src/app/api/memory/list/route.ts +48 -0
- package/mission-control/src/app/api/memory/retrieve/route.ts +51 -0
- package/mission-control/src/app/api/memory/search/route.ts +143 -0
- package/mission-control/src/app/api/memory/sync/route.ts +23 -0
- package/mission-control/src/app/api/memory/wikilinks/route.ts +75 -0
- package/mission-control/src/app/api/mesh/events/route.ts +67 -0
- package/mission-control/src/app/api/mesh/nodes/route.ts +221 -0
- package/mission-control/src/app/api/mesh/tokens/route.ts +133 -0
- package/mission-control/src/app/api/projects/route.ts +102 -0
- package/mission-control/src/app/api/resolve-path/route.ts +92 -0
- package/mission-control/src/app/api/scheduler/tick/route.ts +38 -0
- package/mission-control/src/app/api/scheduler/waves/route.ts +54 -0
- package/mission-control/src/app/api/screenshot/route.ts +127 -0
- package/mission-control/src/app/api/settings/gateway/route.ts +92 -0
- package/mission-control/src/app/api/skills/[id]/health/route.ts +57 -0
- package/mission-control/src/app/api/skills/list/route.ts +41 -0
- package/mission-control/src/app/api/souls/[id]/evolution/route.ts +253 -0
- package/mission-control/src/app/api/souls/[id]/prompt/route.ts +205 -0
- package/mission-control/src/app/api/souls/[id]/propagate/route.ts +146 -0
- package/mission-control/src/app/api/souls/route.ts +174 -0
- package/mission-control/src/app/api/tasks/[id]/handoff/route.ts +115 -0
- package/mission-control/src/app/api/tasks/[id]/route.ts +266 -0
- package/mission-control/src/app/api/tasks/[id]/tree/route.ts +94 -0
- package/mission-control/src/app/api/tasks/route.ts +253 -0
- package/mission-control/src/app/api/tts/route.ts +47 -0
- package/mission-control/src/app/api/workspace/files/route.ts +88 -0
- package/mission-control/src/app/api/workspace/read/route.ts +73 -0
- package/mission-control/src/app/burndown/page.tsx +309 -0
- package/mission-control/src/app/calendar/page.tsx +839 -0
- package/mission-control/src/app/favicon.ico +0 -0
- package/mission-control/src/app/globals.css +67 -0
- package/mission-control/src/app/graph/page.tsx +352 -0
- package/mission-control/src/app/layout.tsx +35 -0
- package/mission-control/src/app/live/page.tsx +232 -0
- package/mission-control/src/app/memory/page.tsx +154 -0
- package/mission-control/src/app/mesh/page.tsx +457 -0
- package/mission-control/src/app/obsidian/page.tsx +252 -0
- package/mission-control/src/app/page.tsx +70 -0
- package/mission-control/src/app/roadmap/page.tsx +1757 -0
- package/mission-control/src/app/settings/page.tsx +260 -0
- package/mission-control/src/app/souls/page.tsx +573 -0
- package/mission-control/src/components/board/activity-timeline.tsx +96 -0
- package/mission-control/src/components/board/daily-board.tsx +373 -0
- package/mission-control/src/components/board/kanban-board.tsx +364 -0
- package/mission-control/src/components/board/kanban-column.tsx +105 -0
- package/mission-control/src/components/board/live-stream.tsx +116 -0
- package/mission-control/src/components/board/skill-health-card.tsx +128 -0
- package/mission-control/src/components/board/status-banner.tsx +124 -0
- package/mission-control/src/components/board/task-card.tsx +454 -0
- package/mission-control/src/components/board/unified-task-dialog.tsx +1043 -0
- package/mission-control/src/components/layout/resizable-layout.tsx +68 -0
- package/mission-control/src/components/layout/sidebar.tsx +90 -0
- package/mission-control/src/components/live/audio-spectrum.tsx +106 -0
- package/mission-control/src/components/live/chat-bubble.tsx +52 -0
- package/mission-control/src/components/live/chat-input.tsx +92 -0
- package/mission-control/src/components/memory/doc-reader.tsx +172 -0
- package/mission-control/src/components/memory/memory-list.tsx +169 -0
- package/mission-control/src/components/memory/search-bar.tsx +67 -0
- package/mission-control/src/components/memory/search-results.tsx +149 -0
- package/mission-control/src/components/obsidian/backlinks-panel.tsx +52 -0
- package/mission-control/src/components/obsidian/file-tree.tsx +186 -0
- package/mission-control/src/components/obsidian/local-graph.tsx +107 -0
- package/mission-control/src/components/obsidian/obsidian-graph.tsx +192 -0
- package/mission-control/src/components/obsidian/obsidian-reader.tsx +246 -0
- package/mission-control/src/lib/activity.ts +29 -0
- package/mission-control/src/lib/config.ts +21 -0
- package/mission-control/src/lib/db/index.ts +429 -0
- package/mission-control/src/lib/db/schema.ts +218 -0
- package/mission-control/src/lib/gateway-notify.ts +113 -0
- package/mission-control/src/lib/hooks.ts +536 -0
- package/mission-control/src/lib/memory/categories.ts +125 -0
- package/mission-control/src/lib/memory/entities.ts +482 -0
- package/mission-control/src/lib/memory/extract.ts +369 -0
- package/mission-control/src/lib/memory/retrieval.ts +281 -0
- package/mission-control/src/lib/memory/wikilinks.ts +147 -0
- package/mission-control/src/lib/nats.ts +126 -0
- package/mission-control/src/lib/parsers/clawvault-doc.ts +98 -0
- package/mission-control/src/lib/parsers/daily-log.ts +73 -0
- package/mission-control/src/lib/parsers/memory-md.ts +81 -0
- package/mission-control/src/lib/parsers/task-markdown.ts +459 -0
- package/mission-control/src/lib/parsers/transcript.ts +209 -0
- package/mission-control/src/lib/scheduler.ts +394 -0
- package/mission-control/src/lib/speech/use-speech-pipeline.ts +176 -0
- package/mission-control/src/lib/sync/memory.ts +224 -0
- package/mission-control/src/lib/sync/tasks.ts +271 -0
- package/mission-control/src/lib/tts/edge.ts +31 -0
- package/mission-control/src/lib/tts/google.ts +78 -0
- package/mission-control/src/lib/tts/index.ts +39 -0
- package/mission-control/src/lib/tts/types.ts +18 -0
- package/mission-control/tsconfig.json +42 -0
- package/obsidian-vault/.obsidian/app.json +10 -0
- package/obsidian-vault/.obsidian/community-plugins.json +8 -0
- package/obsidian-vault/.obsidian/graph.json +40 -0
- package/obsidian-vault/.obsidian/plugins/obsidian-local-rest-api/main.js +58769 -0
- package/obsidian-vault/.obsidian/plugins/obsidian-local-rest-api/manifest.json +10 -0
- package/obsidian-vault/.obsidian/plugins/obsidian-local-rest-api/styles.css +47 -0
- package/obsidian-vault/00-meta/.gitkeep +0 -0
- package/obsidian-vault/01-architecture/.gitkeep +0 -0
- package/obsidian-vault/02-smart-contracts/.gitkeep +0 -0
- package/obsidian-vault/03-backend/.gitkeep +0 -0
- package/obsidian-vault/04-mobile/.gitkeep +0 -0
- package/obsidian-vault/05-ar-mapping/.gitkeep +0 -0
- package/obsidian-vault/06-3d-assets/.gitkeep +0 -0
- package/obsidian-vault/07-sound-music/.gitkeep +0 -0
- package/obsidian-vault/08-lore/.gitkeep +0 -0
- package/obsidian-vault/09-quests-playthrough/.gitkeep +0 -0
- package/obsidian-vault/10-economy/.gitkeep +0 -0
- package/obsidian-vault/11-nft-assets/.gitkeep +0 -0
- package/obsidian-vault/12-nft-mechanics/.gitkeep +0 -0
- package/obsidian-vault/13-dao-guild-social/.gitkeep +0 -0
- package/obsidian-vault/14-game-progression/.gitkeep +0 -0
- package/obsidian-vault/15-analytics/.gitkeep +0 -0
- package/obsidian-vault/16-security/.gitkeep +0 -0
- package/obsidian-vault/17-devops/.gitkeep +0 -0
- package/obsidian-vault/18-marketplace/.gitkeep +0 -0
- package/obsidian-vault/19-decisions/.gitkeep +0 -0
- package/obsidian-vault/20-business-strategy/.gitkeep +0 -0
- package/obsidian-vault/21-legal-regulatory/.gitkeep +0 -0
- package/obsidian-vault/nodes/.gitkeep +0 -0
- package/openclaw.env.example +17 -0
- package/package.json +45 -0
- package/services/launchd/ai.openclaw.gateway.plist +59 -0
- package/services/launchd/ai.openclaw.lane-watchdog.plist +32 -0
- package/services/launchd/ai.openclaw.log-rotate.plist +28 -0
- package/services/launchd/ai.openclaw.memory-daemon.plist +36 -0
- package/services/launchd/ai.openclaw.mesh-agent.plist +38 -0
- package/services/launchd/ai.openclaw.mesh-bridge.plist +36 -0
- package/services/launchd/ai.openclaw.mesh-deploy-listener.plist +33 -0
- package/services/launchd/ai.openclaw.mesh-health-publisher.plist +29 -0
- package/services/launchd/ai.openclaw.mesh-task-daemon.plist +36 -0
- package/services/launchd/ai.openclaw.mesh-tool-discord.plist +36 -0
- package/services/launchd/ai.openclaw.mission-control.plist +41 -0
- package/services/service-manifest.json +13 -0
- package/services/systemd/openclaw-gateway.service +21 -0
- package/services/systemd/openclaw-lane-watchdog.service +21 -0
- package/services/systemd/openclaw-log-rotate.service +13 -0
- package/services/systemd/openclaw-log-rotate.timer +9 -0
- package/services/systemd/openclaw-memory-daemon.service +21 -0
- package/services/systemd/openclaw-mesh-agent.service +19 -0
- package/services/systemd/openclaw-mesh-bridge.service +21 -0
- package/services/systemd/openclaw-mesh-deploy-listener.service +23 -0
- package/services/systemd/openclaw-mesh-health-publisher.service +21 -0
- package/services/systemd/openclaw-mesh-task-daemon.service +21 -0
- package/services/systemd/openclaw-mesh-tool-discord.service +21 -0
- package/services/systemd/openclaw-mission-control.service +22 -0
- package/skills/1password/.clawhub/origin.json +7 -0
- package/skills/1password/SKILL.md +63 -0
- package/skills/1password/references/cli-examples.md +29 -0
- package/skills/1password/references/get-started.md +17 -0
- package/skills/acquisition-channel-advisor/SKILL.md +643 -0
- package/skills/acquisition-channel-advisor/examples/conversation-flow.md +531 -0
- package/skills/agent-browser/.clawhub/origin.json +7 -0
- package/skills/agent-browser/CONTRIBUTING.md +63 -0
- package/skills/agent-browser/SKILL.md +338 -0
- package/skills/agentic-compass/.clawhub/origin.json +7 -0
- package/skills/agentic-compass/README.md +96 -0
- package/skills/agentic-compass/SKILL.md +112 -0
- package/skills/agentic-compass/references/README.md +5 -0
- package/skills/agentic-compass/scripts/agentic-compass.py +196 -0
- package/skills/arcane-dev-ops/SKILL.md +61 -0
- package/skills/arcane-dev-ops/references/checklist.md +22 -0
- package/skills/arcane-dev-ops/references/validation-cases.md +11 -0
- package/skills/arcane-dev-ops/scripts/prepush_check.sh +41 -0
- package/skills/auto-updater/.clawhub/origin.json +7 -0
- package/skills/auto-updater/SKILL.md +158 -0
- package/skills/auto-updater/references/agent-guide.md +152 -0
- package/skills/auto-updater/references/summary-examples.md +109 -0
- package/skills/business-health-diagnostic/SKILL.md +782 -0
- package/skills/byterover/.clawhub/origin.json +7 -0
- package/skills/byterover/SKILL.md +105 -0
- package/skills/byterover/TROUBLESHOOTING.md +50 -0
- package/skills/byterover/WORKFLOWS.md +229 -0
- package/skills/capability-evolver/.clawhub/origin.json +7 -0
- package/skills/capability-evolver/CONTRIBUTING.md +11 -0
- package/skills/capability-evolver/README.md +157 -0
- package/skills/capability-evolver/README.zh-CN.md +112 -0
- package/skills/capability-evolver/SKILL.md +93 -0
- package/skills/capability-evolver/assets/gep/capsules.json +5 -0
- package/skills/capability-evolver/assets/gep/genes.json +104 -0
- package/skills/capability-evolver/index.js +59 -0
- package/skills/capability-evolver/package.json +22 -0
- package/skills/capability-evolver/scripts/analyze_by_skill.js +121 -0
- package/skills/capability-evolver/scripts/build_public.js +350 -0
- package/skills/capability-evolver/scripts/export_history.js +98 -0
- package/skills/capability-evolver/scripts/extract_log.js +85 -0
- package/skills/capability-evolver/scripts/generate_history.js +75 -0
- package/skills/capability-evolver/scripts/human_report.js +147 -0
- package/skills/capability-evolver/scripts/publish_public.js +516 -0
- package/skills/capability-evolver/scripts/suggest_version.js +89 -0
- package/skills/capability-evolver/src/evolve.js +594 -0
- package/skills/capability-evolver/src/gep/assetStore.js +204 -0
- package/skills/capability-evolver/src/gep/candidates.js +134 -0
- package/skills/capability-evolver/src/gep/paths.js +23 -0
- package/skills/capability-evolver/src/gep/prompt.js +254 -0
- package/skills/capability-evolver/src/gep/selector.js +89 -0
- package/skills/capability-evolver/src/gep/signals.js +27 -0
- package/skills/cc-godmode/.clawhub/origin.json +7 -0
- package/skills/cc-godmode/CHANGELOG.md +66 -0
- package/skills/cc-godmode/README.md +293 -0
- package/skills/cc-godmode/SKILL.md +242 -0
- package/skills/cc-godmode/docs/AGENTS.md +332 -0
- package/skills/cc-godmode/docs/MIGRATION.md +206 -0
- package/skills/cc-godmode/docs/TROUBLESHOOTING.md +357 -0
- package/skills/cc-godmode/docs/WORKFLOWS.md +329 -0
- package/skills/cc-godmode/references/agents.md +433 -0
- package/skills/cc-godmode/scripts/build-skill.js +232 -0
- package/skills/clawdbot-filesystem/.clawhub/origin.json +7 -0
- package/skills/clawdbot-filesystem/LICENSE.md +21 -0
- package/skills/clawdbot-filesystem/README.md +322 -0
- package/skills/clawdbot-filesystem/SKILL.md +219 -0
- package/skills/clawdbot-filesystem/config.json +41 -0
- package/skills/clawdbot-filesystem/package.json +69 -0
- package/skills/clawdbot-security-check/.clawhub/origin.json +7 -0
- package/skills/clawdbot-security-check/README.md +168 -0
- package/skills/clawdbot-security-check/SKILL.md +145 -0
- package/skills/clawdbot-security-check/references/audit-checks.md +521 -0
- package/skills/clawdbot-security-check/skill.json +42 -0
- package/skills/clawddocs/.clawhub/origin.json +7 -0
- package/skills/clawddocs/SKILL.md +176 -0
- package/skills/clawddocs/package.json +9 -0
- package/skills/clawddocs/scripts/build-index.sh +17 -0
- package/skills/clawddocs/scripts/cache.sh +13 -0
- package/skills/clawddocs/scripts/fetch-doc.sh +7 -0
- package/skills/clawddocs/scripts/recent.sh +5 -0
- package/skills/clawddocs/scripts/search.sh +8 -0
- package/skills/clawddocs/scripts/sitemap.sh +23 -0
- package/skills/clawddocs/scripts/track-changes.sh +16 -0
- package/skills/clawddocs/snippets/common-configs.md +69 -0
- package/skills/clawguard/.clawhub/origin.json +7 -0
- package/skills/clawguard/SKILL.md +137 -0
- package/skills/company-research/SKILL.md +393 -0
- package/skills/company-research/examples/sample.md +164 -0
- package/skills/company-research/template.md +60 -0
- package/skills/crypto-price/.clawhub/origin.json +7 -0
- package/skills/crypto-price/ARCHITECTURE.md +437 -0
- package/skills/crypto-price/README.md +194 -0
- package/skills/crypto-price/SKILL.md +61 -0
- package/skills/crypto-price/requirements.txt +1 -0
- package/skills/crypto-price/scripts/get_price_chart.py +988 -0
- package/skills/customer-journey-map/SKILL.md +343 -0
- package/skills/customer-journey-map/examples/sample.md +33 -0
- package/skills/customer-journey-map/template.md +28 -0
- package/skills/customer-journey-mapping-workshop/SKILL.md +522 -0
- package/skills/deep-research/.clawhub/origin.json +7 -0
- package/skills/deep-research/SKILL.md +93 -0
- package/skills/deep-research/rules/logic.md +32 -0
- package/skills/discord-telegram-triage/SKILL.md +59 -0
- package/skills/discord-telegram-triage/references/discord-runbook.md +28 -0
- package/skills/discord-telegram-triage/references/validation-cases.md +11 -0
- package/skills/discord-telegram-triage/scripts/triage_snapshot.sh +23 -0
- package/skills/discovery-interview-prep/SKILL.md +408 -0
- package/skills/discovery-process/SKILL.md +503 -0
- package/skills/discovery-process/examples/sample.md +60 -0
- package/skills/discovery-process/template.md +39 -0
- package/skills/dist/arcane-dev-ops.skill +0 -0
- package/skills/dist/discord-telegram-triage.skill +0 -0
- package/skills/dist/founder-brief-summarizer.skill +0 -0
- package/skills/epic-breakdown-advisor/SKILL.md +664 -0
- package/skills/epic-hypothesis/SKILL.md +285 -0
- package/skills/epic-hypothesis/examples/sample.md +104 -0
- package/skills/epic-hypothesis/template.md +30 -0
- package/skills/excel/.clawhub/origin.json +7 -0
- package/skills/excel/SKILL.md +332 -0
- package/skills/excel/scripts/excel.py +1120 -0
- package/skills/fast-browser-use/.clawhub/origin.json +7 -0
- package/skills/fast-browser-use/CODEBUDDY.md +142 -0
- package/skills/fast-browser-use/Cargo.toml +77 -0
- package/skills/fast-browser-use/README.md +62 -0
- package/skills/fast-browser-use/SKILL.md +217 -0
- package/skills/fast-browser-use/package-lock.json +28 -0
- package/skills/fast-browser-use/package.json +8 -0
- package/skills/fast-browser-use/rustfmt.toml +10 -0
- package/skills/fast-browser-use/src/bin/cli.rs +373 -0
- package/skills/fast-browser-use/src/bin/mcp_server.rs +203 -0
- package/skills/fast-browser-use/src/browser/config.rs +136 -0
- package/skills/fast-browser-use/src/browser/debug.rs +16 -0
- package/skills/fast-browser-use/src/browser/mod.rs +61 -0
- package/skills/fast-browser-use/src/browser/session.rs +478 -0
- package/skills/fast-browser-use/src/dom/element.rs +442 -0
- package/skills/fast-browser-use/src/dom/extract_dom.js +849 -0
- package/skills/fast-browser-use/src/dom/mod.rs +14 -0
- package/skills/fast-browser-use/src/dom/tree.rs +296 -0
- package/skills/fast-browser-use/src/dom/yaml.rs +149 -0
- package/skills/fast-browser-use/src/error.rs +115 -0
- package/skills/fast-browser-use/src/lib.rs +17 -0
- package/skills/fast-browser-use/src/mcp/handler.rs +63 -0
- package/skills/fast-browser-use/src/mcp/mod.rs +81 -0
- package/skills/fast-browser-use/src/tools/Readability.min.js +1480 -0
- package/skills/fast-browser-use/src/tools/annotate.rs +165 -0
- package/skills/fast-browser-use/src/tools/click.rs +84 -0
- package/skills/fast-browser-use/src/tools/close.rs +35 -0
- package/skills/fast-browser-use/src/tools/close_tab.rs +45 -0
- package/skills/fast-browser-use/src/tools/convert_to_markdown.js +117 -0
- package/skills/fast-browser-use/src/tools/cookies.rs +58 -0
- package/skills/fast-browser-use/src/tools/debug.rs +44 -0
- package/skills/fast-browser-use/src/tools/evaluate.rs +40 -0
- package/skills/fast-browser-use/src/tools/extract.rs +66 -0
- package/skills/fast-browser-use/src/tools/go_back.rs +35 -0
- package/skills/fast-browser-use/src/tools/go_forward.rs +35 -0
- package/skills/fast-browser-use/src/tools/hover.js +33 -0
- package/skills/fast-browser-use/src/tools/hover.rs +97 -0
- package/skills/fast-browser-use/src/tools/html_to_markdown.rs +99 -0
- package/skills/fast-browser-use/src/tools/input.rs +93 -0
- package/skills/fast-browser-use/src/tools/local_storage.rs +159 -0
- package/skills/fast-browser-use/src/tools/markdown.rs +181 -0
- package/skills/fast-browser-use/src/tools/mod.rs +326 -0
- package/skills/fast-browser-use/src/tools/navigate.rs +55 -0
- package/skills/fast-browser-use/src/tools/new_tab.rs +60 -0
- package/skills/fast-browser-use/src/tools/press_key.rs +78 -0
- package/skills/fast-browser-use/src/tools/read_links.rs +59 -0
- package/skills/fast-browser-use/src/tools/readability_script.rs +8 -0
- package/skills/fast-browser-use/src/tools/screenshot.rs +47 -0
- package/skills/fast-browser-use/src/tools/scroll.js +22 -0
- package/skills/fast-browser-use/src/tools/scroll.rs +95 -0
- package/skills/fast-browser-use/src/tools/select.js +23 -0
- package/skills/fast-browser-use/src/tools/select.rs +129 -0
- package/skills/fast-browser-use/src/tools/sitemap.rs +426 -0
- package/skills/fast-browser-use/src/tools/snapshot.rs +324 -0
- package/skills/fast-browser-use/src/tools/switch_tab.rs +69 -0
- package/skills/fast-browser-use/src/tools/tab_list.rs +76 -0
- package/skills/fast-browser-use/src/tools/utils.rs +92 -0
- package/skills/fast-browser-use/src/tools/wait.rs +53 -0
- package/skills/fast-browser-use/test_auth.json +3 -0
- package/skills/fast-browser-use/test_state.json +6 -0
- package/skills/fast-browser-use/tests/browser_tools_integration.rs +233 -0
- package/skills/fast-browser-use/tests/cli_recipes_integration.rs +112 -0
- package/skills/fast-browser-use/tests/cookies_integration.rs +56 -0
- package/skills/fast-browser-use/tests/debug_integration.rs +83 -0
- package/skills/fast-browser-use/tests/dom_integration.rs +170 -0
- package/skills/fast-browser-use/tests/local_storage_integration.rs +75 -0
- package/skills/fast-browser-use/tests/markdown_integration.rs +448 -0
- package/skills/fast-browser-use/tests/navigation_integration.rs +241 -0
- package/skills/fast-browser-use/tests/sitemap_integration.rs +326 -0
- package/skills/fast-browser-use/tests/tab_management_integration.rs +300 -0
- package/skills/feature-investment-advisor/SKILL.md +639 -0
- package/skills/feature-investment-advisor/examples/conversation-flow.md +538 -0
- package/skills/finance-based-pricing-advisor/SKILL.md +763 -0
- package/skills/finance-metrics-quickref/SKILL.md +309 -0
- package/skills/find-skills/.clawhub/origin.json +7 -0
- package/skills/find-skills/SKILL.md +143 -0
- package/skills/flavor-text-writer/SKILL.md +27 -0
- package/skills/founder-brief-summarizer/SKILL.md +52 -0
- package/skills/founder-brief-summarizer/references/response-templates.md +15 -0
- package/skills/founder-brief-summarizer/references/validation-cases.md +11 -0
- package/skills/founder-brief-summarizer/scripts/brief_template.sh +28 -0
- package/skills/frontend-design/.clawhub/origin.json +7 -0
- package/skills/frontend-design/LICENSE.txt +190 -0
- package/skills/frontend-design/SKILL.md +53 -0
- package/skills/gemini/.clawhub/origin.json +7 -0
- package/skills/gemini/SKILL.md +33 -0
- package/skills/gemini-deep-research/.clawhub/origin.json +7 -0
- package/skills/gemini-deep-research/SKILL.md +78 -0
- package/skills/gemini-deep-research/scripts/deep_research.py +176 -0
- package/skills/git-essentials/.clawhub/origin.json +7 -0
- package/skills/git-essentials/SKILL.md +239 -0
- package/skills/git-essentials/references/advanced.md +211 -0
- package/skills/github/.clawhub/origin.json +7 -0
- package/skills/github/SKILL.md +57 -0
- package/skills/google-drive/.clawhub/origin.json +7 -0
- package/skills/google-drive/LICENSE.txt +21 -0
- package/skills/google-drive/SKILL.md +320 -0
- package/skills/growth-loop/SKILL.md +270 -0
- package/skills/growth-loop/_meta.json +9 -0
- package/skills/growth-loop/references/diagnosis-framework.md +84 -0
- package/skills/growth-loop/references/platform-benchmarks.md +79 -0
- package/skills/growth-loop/scripts/init-campaign.sh +274 -0
- package/skills/humanize-ai-text/.clawhub/origin.json +7 -0
- package/skills/humanize-ai-text/SKILL.md +192 -0
- package/skills/humanize-ai-text/scripts/compare.py +58 -0
- package/skills/humanize-ai-text/scripts/detect.py +160 -0
- package/skills/humanize-ai-text/scripts/patterns.json +191 -0
- package/skills/humanize-ai-text/scripts/transform.py +127 -0
- package/skills/humanizer/.clawhub/origin.json +7 -0
- package/skills/humanizer/README.md +82 -0
- package/skills/humanizer/SKILL.md +443 -0
- package/skills/jobs-to-be-done/SKILL.md +378 -0
- package/skills/jobs-to-be-done/examples/sample.md +80 -0
- package/skills/jobs-to-be-done/template.md +65 -0
- package/skills/lean-ux-canvas/SKILL.md +561 -0
- package/skills/lean-ux-canvas/examples/sample.md +88 -0
- package/skills/lean-ux-canvas/template.md +32 -0
- package/skills/markdown-formatter/.clawhub/origin.json +7 -0
- package/skills/markdown-formatter/README.md +137 -0
- package/skills/markdown-formatter/SKILL.md +369 -0
- package/skills/markdown-formatter/config.json +20 -0
- package/skills/markdown-formatter/index.js +439 -0
- package/skills/markdown-formatter/package.json +23 -0
- package/skills/markdown-formatter/test.js +23 -0
- package/skills/marketing-mode/.clawhub/origin.json +7 -0
- package/skills/marketing-mode/README.md +49 -0
- package/skills/marketing-mode/SKILL.md +703 -0
- package/skills/marketing-mode/mode-prompt.md +39 -0
- package/skills/marketing-mode/skill.json +51 -0
- package/skills/memory-hygiene/.clawhub/origin.json +7 -0
- package/skills/memory-hygiene/SKILL.md +91 -0
- package/skills/memory-setup/.clawhub/origin.json +7 -0
- package/skills/memory-setup/SKILL.md +180 -0
- package/skills/memorylayer/.clawhub/origin.json +7 -0
- package/skills/memorylayer/README.md +197 -0
- package/skills/memorylayer/SKILL.md +227 -0
- package/skills/memorylayer/examples/agent-integration.js +145 -0
- package/skills/memorylayer/examples/basic-usage.js +87 -0
- package/skills/memorylayer/examples/token-savings-demo.js +183 -0
- package/skills/memorylayer/index.js +115 -0
- package/skills/memorylayer/package-lock.json +295 -0
- package/skills/memorylayer/package.json +27 -0
- package/skills/memorylayer/python/memorylayer_skill.py +230 -0
- package/skills/memorylayer/python/requirements.txt +7 -0
- package/skills/mesh/SKILL.md +184 -0
- package/skills/model-usage/.clawhub/origin.json +7 -0
- package/skills/model-usage/SKILL.md +54 -0
- package/skills/model-usage/references/codexbar-cli.md +28 -0
- package/skills/model-usage/scripts/model_usage.py +310 -0
- package/skills/moltbook-interact/.clawhub/origin.json +7 -0
- package/skills/moltbook-interact/INSTALL.md +139 -0
- package/skills/moltbook-interact/README.md +198 -0
- package/skills/moltbook-interact/SKILL.md +72 -0
- package/skills/moltbook-interact/references/api.md +106 -0
- package/skills/moltbook-interact/scripts/moltbook.sh +142 -0
- package/skills/moltbook-registry/.clawhub/origin.json +7 -0
- package/skills/moltbook-registry/README.md +26 -0
- package/skills/moltbook-registry/SKILL.md +82 -0
- package/skills/moltbook-registry/index.js +180 -0
- package/skills/moltbook-registry/package.json +11 -0
- package/skills/mythril-scanner/SKILL.md +27 -0
- package/skills/n8n/.clawhub/origin.json +7 -0
- package/skills/n8n/SKILL.md +141 -0
- package/skills/n8n/references/api.md +156 -0
- package/skills/n8n/scripts/n8n_api.py +158 -0
- package/skills/n8n-workflow-automation/.clawhub/origin.json +7 -0
- package/skills/n8n-workflow-automation/SKILL.md +103 -0
- package/skills/n8n-workflow-automation/assets/runbook-template.md +32 -0
- package/skills/narrative-designer/SKILL.md +27 -0
- package/skills/ontology/.clawhub/origin.json +7 -0
- package/skills/ontology/SKILL.md +236 -0
- package/skills/ontology/references/queries.md +211 -0
- package/skills/ontology/references/schema.md +322 -0
- package/skills/ontology/scripts/ontology.py +374 -0
- package/skills/openai-image-gen/.clawhub/origin.json +7 -0
- package/skills/openai-image-gen/SKILL.md +45 -0
- package/skills/openai-image-gen/scripts/gen.py +227 -0
- package/skills/openclaw-agent-optimize/.clawhub/origin.json +7 -0
- package/skills/openclaw-agent-optimize/SKILL.md +33 -0
- package/skills/openclaw-agent-optimize/references/agent-orchestration.md +20 -0
- package/skills/openclaw-agent-optimize/references/context-management.md +15 -0
- package/skills/openclaw-agent-optimize/references/continuous-learning.md +14 -0
- package/skills/openclaw-agent-optimize/references/cron-optimization.md +16 -0
- package/skills/openclaw-agent-optimize/references/memory-patterns.md +14 -0
- package/skills/openclaw-agent-optimize/references/model-selection.md +18 -0
- package/skills/openclaw-skill-scanner/.clawhub/origin.json +7 -0
- package/skills/openclaw-skill-scanner/SKILL.md +88 -0
- package/skills/openclaw-skill-scanner/install-hook.sh +294 -0
- package/skills/openclaw-skill-scanner/report-template.md +53 -0
- package/skills/openclaw-skill-scanner/scanner.py +929 -0
- package/skills/openclaw-skill-scanner/whitelist.json +18 -0
- package/skills/opportunity-solution-tree/SKILL.md +428 -0
- package/skills/opportunity-solution-tree/examples/sample.md +104 -0
- package/skills/opportunity-solution-tree/template.md +33 -0
- package/skills/pdf/.clawhub/origin.json +7 -0
- package/skills/pdf/SKILL.md +304 -0
- package/skills/pestel-analysis/SKILL.md +384 -0
- package/skills/pestel-analysis/examples/sample.md +143 -0
- package/skills/pestel-analysis/template.md +53 -0
- package/skills/pol-probe/SKILL.md +217 -0
- package/skills/pol-probe/examples/sample.md +136 -0
- package/skills/pol-probe/template.md +59 -0
- package/skills/pol-probe-advisor/SKILL.md +492 -0
- package/skills/positioning-statement/SKILL.md +229 -0
- package/skills/positioning-statement/examples/sample.md +51 -0
- package/skills/positioning-statement/template.md +25 -0
- package/skills/positioning-workshop/SKILL.md +424 -0
- package/skills/prd-development/SKILL.md +654 -0
- package/skills/prd-development/examples/sample.md +43 -0
- package/skills/prd-development/template.md +55 -0
- package/skills/press-release/SKILL.md +277 -0
- package/skills/press-release/examples/sample.md +73 -0
- package/skills/press-release/template.md +39 -0
- package/skills/prioritization-advisor/SKILL.md +451 -0
- package/skills/proactive-messages/.clawhub/origin.json +7 -0
- package/skills/proactive-messages/SKILL.md +91 -0
- package/skills/problem-framing-canvas/SKILL.md +466 -0
- package/skills/problem-framing-canvas/examples/sample.md +58 -0
- package/skills/problem-framing-canvas/template.md +22 -0
- package/skills/problem-statement/SKILL.md +255 -0
- package/skills/problem-statement/examples/sample.md +82 -0
- package/skills/problem-statement/template.md +37 -0
- package/skills/product-strategy-session/SKILL.md +434 -0
- package/skills/product-strategy-session/examples/sample.md +67 -0
- package/skills/product-strategy-session/template.md +38 -0
- package/skills/prompt-guard/.clawhub/origin.json +7 -0
- package/skills/prompt-guard/ARCHITECTURE.md +364 -0
- package/skills/prompt-guard/CHANGELOG.md +200 -0
- package/skills/prompt-guard/README.md +215 -0
- package/skills/prompt-guard/SECURITY.md +66 -0
- package/skills/prompt-guard/SKILL.md +174 -0
- package/skills/prompt-guard/blog/how-i-secured-my-ai-agent.md +185 -0
- package/skills/prompt-guard/config.example.yaml +56 -0
- package/skills/prompt-guard/references/detection-patterns.md +298 -0
- package/skills/prompt-guard/requirements.txt +1 -0
- package/skills/prompt-guard/scripts/analyze_log.py +224 -0
- package/skills/prompt-guard/scripts/audit.py +344 -0
- package/skills/prompt-guard/scripts/detect.py +1587 -0
- package/skills/prompt-guard/scripts/hivefence.py +345 -0
- package/skills/proto-persona/SKILL.md +336 -0
- package/skills/proto-persona/examples/sample.md +97 -0
- package/skills/proto-persona/template.md +45 -0
- package/skills/recommendation-canvas/SKILL.md +382 -0
- package/skills/recommendation-canvas/examples/sample.md +94 -0
- package/skills/recommendation-canvas/template.md +86 -0
- package/skills/refactor-suggest/.clawhub/origin.json +7 -0
- package/skills/refactor-suggest/SKILL.md +94 -0
- package/skills/roadmap-planning/SKILL.md +506 -0
- package/skills/roadmap-planning/examples/sample.md +62 -0
- package/skills/roadmap-planning/template.md +30 -0
- package/skills/saas-economics-efficiency-metrics/SKILL.md +694 -0
- package/skills/saas-economics-efficiency-metrics/examples/cash-trap.md +365 -0
- package/skills/saas-economics-efficiency-metrics/examples/healthy-unit-economics.md +279 -0
- package/skills/saas-economics-efficiency-metrics/template.md +263 -0
- package/skills/saas-revenue-growth-metrics/SKILL.md +629 -0
- package/skills/saas-revenue-growth-metrics/examples/healthy-saas.md +131 -0
- package/skills/saas-revenue-growth-metrics/examples/warning-signs.md +229 -0
- package/skills/saas-revenue-growth-metrics/template.md +192 -0
- package/skills/save-money/.clawhub/origin.json +7 -0
- package/skills/save-money/SKILL.md +173 -0
- package/skills/scripts/golden_skills_v3.sh +32 -0
- package/skills/search/.clawhub/origin.json +7 -0
- package/skills/search/SKILL.md +18 -0
- package/skills/search/skill.json +1 -0
- package/skills/second-brain/.clawhub/origin.json +7 -0
- package/skills/second-brain/SKILL.md +278 -0
- package/skills/second-brain/scripts/ensue-api.sh +37 -0
- package/skills/self-improving-agent/.clawhub/origin.json +7 -0
- package/skills/self-improving-agent/.learnings/ERRORS.md +5 -0
- package/skills/self-improving-agent/.learnings/FEATURE_REQUESTS.md +5 -0
- package/skills/self-improving-agent/.learnings/LEARNINGS.md +5 -0
- package/skills/self-improving-agent/SKILL.md +130 -0
- package/skills/self-improving-agent/assets/LEARNINGS.md +45 -0
- package/skills/self-improving-agent/assets/SKILL-TEMPLATE.md +177 -0
- package/skills/self-improving-agent/hooks/openclaw/HOOK.md +23 -0
- package/skills/self-improving-agent/hooks/openclaw/handler.js +56 -0
- package/skills/self-improving-agent/hooks/openclaw/handler.ts +62 -0
- package/skills/self-improving-agent/references/examples.md +374 -0
- package/skills/self-improving-agent/references/hooks-setup.md +223 -0
- package/skills/self-improving-agent/references/openclaw-integration.md +248 -0
- package/skills/self-improving-agent/references/templates.md +480 -0
- package/skills/self-improving-agent/scripts/activator.sh +20 -0
- package/skills/self-improving-agent/scripts/error-detector.sh +55 -0
- package/skills/self-improving-agent/scripts/extract-skill.sh +203 -0
- package/skills/self-improving-agent-1-0-2/.clawhub/origin.json +7 -0
- package/skills/self-improving-agent-1-0-2/SKILL.md +562 -0
- package/skills/self-improving-agent-1-0-2/assets/LEARNINGS.md +45 -0
- package/skills/self-improving-agent-1-0-2/assets/SKILL-TEMPLATE.md +182 -0
- package/skills/self-improving-agent-1-0-2/references/clawdbot-integration.md +311 -0
- package/skills/self-improving-agent-1-0-2/references/examples.md +374 -0
- package/skills/self-improving-agent-1-0-2/references/hooks-setup.md +223 -0
- package/skills/self-improving-agent-1-0-2/scripts/activator.sh +20 -0
- package/skills/self-improving-agent-1-0-2/scripts/error-detector.sh +55 -0
- package/skills/self-improving-agent-1-0-2/scripts/extract-skill.sh +203 -0
- package/skills/self-love-confidence/.clawhub/origin.json +7 -0
- package/skills/self-love-confidence/SKILL.md +79 -0
- package/skills/self-reflection/.clawhub/origin.json +7 -0
- package/skills/self-reflection/README.md +292 -0
- package/skills/self-reflection/SKILL.md +110 -0
- package/skills/self-reflection/self-reflection.example.json +6 -0
- package/skills/slither-analyzer/SKILL.md +27 -0
- package/skills/solidity-audit/SKILL.md +27 -0
- package/skills/soulcraft/.clawhub/origin.json +7 -0
- package/skills/soulcraft/README.md +123 -0
- package/skills/soulcraft/SKILL.md +340 -0
- package/skills/soulcraft/references/question-bank.md +154 -0
- package/skills/soulcraft/references/soul-examples.md +207 -0
- package/skills/soulcraft/research/RESEARCH_REPORT.md +317 -0
- package/skills/spotify-player/.clawhub/origin.json +7 -0
- package/skills/spotify-player/SKILL.md +44 -0
- package/skills/storyboard/SKILL.md +259 -0
- package/skills/storyboard/examples/sample.md +71 -0
- package/skills/storyboard/template.md +41 -0
- package/skills/summarize/.clawhub/origin.json +7 -0
- package/skills/summarize/SKILL.md +59 -0
- package/skills/superdesign/.clawhub/origin.json +7 -0
- package/skills/superdesign/SKILL.md +224 -0
- package/skills/tam-sam-som-calculator/SKILL.md +399 -0
- package/skills/tam-sam-som-calculator/examples/sample.md +142 -0
- package/skills/tam-sam-som-calculator/scripts/market-sizing.py +95 -0
- package/skills/tam-sam-som-calculator/template.md +35 -0
- package/skills/tavily-search/.clawhub/origin.json +7 -0
- package/skills/tavily-search/SKILL.md +49 -0
- package/skills/tavily-search/scripts/extract.mjs +59 -0
- package/skills/tavily-search/scripts/search.mjs +101 -0
- package/skills/twitter/SKILL.md +74 -0
- package/skills/twitter/_meta.json +9 -0
- package/skills/twitter/references/validation-cases.md +53 -0
- package/skills/twitter/scripts/twitter.sh +421 -0
- package/skills/ui-ux-pro-max/.clawhub/origin.json +7 -0
- package/skills/ui-ux-pro-max/SKILL.md +54 -0
- package/skills/ui-ux-pro-max/assets/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/assets/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/assets/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/assets/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/assets/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/assets/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/assets/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/assets/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/assets/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/assets/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/assets/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/references/upstream-README.md +488 -0
- package/skills/ui-ux-pro-max/references/upstream-skill-content.md +288 -0
- package/skills/ui-ux-pro-max/scripts/__init__.py +0 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1071 -0
- package/skills/ui-ux-pro-max/scripts/search.py +111 -0
- package/skills/user-story/SKILL.md +272 -0
- package/skills/user-story/examples/sample.md +110 -0
- package/skills/user-story/scripts/user-story-template.py +65 -0
- package/skills/user-story/template.md +32 -0
- package/skills/user-story-mapping/SKILL.md +296 -0
- package/skills/user-story-mapping/examples/sample.md +77 -0
- package/skills/user-story-mapping/template.md +41 -0
- package/skills/user-story-mapping-workshop/SKILL.md +485 -0
- package/skills/user-story-mapping-workshop/template.md +28 -0
- package/skills/user-story-splitting/SKILL.md +313 -0
- package/skills/user-story-splitting/examples/sample.md +147 -0
- package/skills/user-story-splitting/template.md +37 -0
- package/skills/wacli/.clawhub/origin.json +7 -0
- package/skills/wacli/SKILL.md +53 -0
- package/skills/web-search/.clawhub/origin.json +7 -0
- package/skills/web-search/SKILL.md +151 -0
- package/skills/web-search/references/api-details.md +207 -0
- package/skills/web-search/scripts/search.py +576 -0
- package/skills/workshop-facilitation/SKILL.md +88 -0
- package/skills/world-builder/SKILL.md +27 -0
- package/souls/blockchain-auditor/PRINCIPLES.md +75 -0
- package/souls/blockchain-auditor/SOUL.md +56 -0
- package/souls/blockchain-auditor/capabilities.json +33 -0
- package/souls/blockchain-auditor/evolution/capsules.json +4 -0
- package/souls/blockchain-auditor/evolution/events.jsonl +1 -0
- package/souls/blockchain-auditor/evolution/genes.json +62 -0
- package/souls/daedalus/PRINCIPLES.md +78 -0
- package/souls/daedalus/SOUL.md +48 -0
- package/souls/daedalus/capabilities.json +46 -0
- package/souls/identity-architect/PRINCIPLES.md +83 -0
- package/souls/identity-architect/SOUL.md +66 -0
- package/souls/identity-architect/capabilities.json +38 -0
- package/souls/identity-architect/evolution/capsules.json +4 -0
- package/souls/identity-architect/evolution/events.jsonl +0 -0
- package/souls/identity-architect/evolution/genes.json +4 -0
- package/souls/infra-ops/PRINCIPLES.md +77 -0
- package/souls/infra-ops/SOUL.md +56 -0
- package/souls/infra-ops/capabilities.json +33 -0
- package/souls/infra-ops/evolution/capsules.json +4 -0
- package/souls/infra-ops/evolution/events.jsonl +0 -0
- package/souls/infra-ops/evolution/genes.json +4 -0
- package/souls/lore-writer/PRINCIPLES.md +74 -0
- package/souls/lore-writer/SOUL.md +54 -0
- package/souls/lore-writer/capabilities.json +37 -0
- package/souls/lore-writer/evolution/capsules.json +4 -0
- package/souls/lore-writer/evolution/events.jsonl +0 -0
- package/souls/lore-writer/evolution/genes.json +4 -0
- package/souls/qa-evidence/PRINCIPLES.md +97 -0
- package/souls/qa-evidence/SOUL.md +66 -0
- package/souls/qa-evidence/capabilities.json +32 -0
- package/souls/qa-evidence/evolution/capsules.json +4 -0
- package/souls/qa-evidence/evolution/events.jsonl +0 -0
- package/souls/qa-evidence/evolution/genes.json +4 -0
- package/souls/registry.json +211 -0
- package/souls/sync-registry.js +65 -0
- package/uninstall.sh +102 -0
- package/workspace-bin/auto-checkpoint +60 -0
- package/workspace-bin/clawvault-access-control +65 -0
- package/workspace-bin/clawvault-local +28 -0
- package/workspace-bin/compile-boot +494 -0
- package/workspace-bin/daily-log-writer.mjs +251 -0
- package/workspace-bin/evolve +540 -0
- package/workspace-bin/fitness_score.py +395 -0
- package/workspace-bin/hooks/pre-commit +80 -0
- package/workspace-bin/install-daemon +299 -0
- package/workspace-bin/lane-watchdog.js +232 -0
- package/workspace-bin/lib/__init__.py +0 -0
- package/workspace-bin/lib/frontmatter.py +114 -0
- package/workspace-bin/memory-daemon.mjs +879 -0
- package/workspace-bin/memory-maintenance.mjs +531 -0
- package/workspace-bin/mesh-bridge.mjs +154 -0
- package/workspace-bin/multi-review +130 -0
- package/workspace-bin/obsidian +125 -0
- package/workspace-bin/obsidian-sync.mjs +888 -0
- package/workspace-bin/openclaw-register-source +102 -0
- package/workspace-bin/proactive-scan +147 -0
- package/workspace-bin/quality-gate +175 -0
- package/workspace-bin/screenshot +96 -0
- package/workspace-bin/session-recap +453 -0
- package/workspace-bin/skill-audit +494 -0
- package/workspace-bin/skill-quality-check +134 -0
- package/workspace-bin/skill-routing-eval +599 -0
- package/workspace-bin/soul-prompt +251 -0
- package/workspace-bin/subagent-audit.mjs +267 -0
- package/workspace-bin/test-multi-soul-workflow +130 -0
- package/workspace-bin/trust-registry +465 -0
- package/workspace-docs/AGENTS.md +201 -0
- package/workspace-docs/CLAUDE.md +64 -0
- package/workspace-docs/PRINCIPLES.md +81 -0
- package/workspace-docs/SOUL.md +48 -0
|
@@ -0,0 +1,1480 @@
|
|
|
1
|
+
function Readability(e, t) {
|
|
2
|
+
if (t && t.documentElement) ((e = t), (t = arguments[2]));
|
|
3
|
+
else if (!e || !e.documentElement)
|
|
4
|
+
throw new Error(
|
|
5
|
+
"First argument to Readability constructor should be a document object.",
|
|
6
|
+
);
|
|
7
|
+
if (
|
|
8
|
+
((t = t || {}),
|
|
9
|
+
(this._doc = e),
|
|
10
|
+
(this._docJSDOMParser = this._doc.firstChild.__JSDOMParser__),
|
|
11
|
+
(this._articleTitle = null),
|
|
12
|
+
(this._articleByline = null),
|
|
13
|
+
(this._articleDir = null),
|
|
14
|
+
(this._articleSiteName = null),
|
|
15
|
+
(this._attempts = []),
|
|
16
|
+
(this._metadata = {}),
|
|
17
|
+
(this._debug = !!t.debug),
|
|
18
|
+
(this._maxElemsToParse =
|
|
19
|
+
t.maxElemsToParse || this.DEFAULT_MAX_ELEMS_TO_PARSE),
|
|
20
|
+
(this._nbTopCandidates =
|
|
21
|
+
t.nbTopCandidates || this.DEFAULT_N_TOP_CANDIDATES),
|
|
22
|
+
(this._charThreshold = t.charThreshold || this.DEFAULT_CHAR_THRESHOLD),
|
|
23
|
+
(this._classesToPreserve = this.CLASSES_TO_PRESERVE.concat(
|
|
24
|
+
t.classesToPreserve || [],
|
|
25
|
+
)),
|
|
26
|
+
(this._keepClasses = !!t.keepClasses),
|
|
27
|
+
(this._serializer =
|
|
28
|
+
t.serializer ||
|
|
29
|
+
function (e) {
|
|
30
|
+
return e.innerHTML;
|
|
31
|
+
}),
|
|
32
|
+
(this._disableJSONLD = !!t.disableJSONLD),
|
|
33
|
+
(this._allowedVideoRegex = t.allowedVideoRegex || this.REGEXPS.videos),
|
|
34
|
+
(this._linkDensityModifier = t.linkDensityModifier || 0),
|
|
35
|
+
(this._flags =
|
|
36
|
+
this.FLAG_STRIP_UNLIKELYS |
|
|
37
|
+
this.FLAG_WEIGHT_CLASSES |
|
|
38
|
+
this.FLAG_CLEAN_CONDITIONALLY),
|
|
39
|
+
this._debug)
|
|
40
|
+
) {
|
|
41
|
+
let t = function (e) {
|
|
42
|
+
if (e.nodeType == e.TEXT_NODE)
|
|
43
|
+
return `${e.nodeName} ("${e.textContent}")`;
|
|
44
|
+
var t = Array.from(e.attributes || [], function (e) {
|
|
45
|
+
return `${e.name}="${e.value}"`;
|
|
46
|
+
}).join(" ");
|
|
47
|
+
return `<${e.localName} ${t}>`;
|
|
48
|
+
};
|
|
49
|
+
this.log = function () {
|
|
50
|
+
if ("undefined" != typeof console) {
|
|
51
|
+
let e = Array.from(arguments, (e) =>
|
|
52
|
+
e && e.nodeType == this.ELEMENT_NODE ? t(e) : e,
|
|
53
|
+
);
|
|
54
|
+
(e.unshift("Reader: (Readability)"), console.log(...e));
|
|
55
|
+
} else {
|
|
56
|
+
var e;
|
|
57
|
+
"undefined" != typeof dump &&
|
|
58
|
+
((e = Array.prototype.map
|
|
59
|
+
.call(arguments, function (e) {
|
|
60
|
+
return e && e.nodeName ? t(e) : e;
|
|
61
|
+
})
|
|
62
|
+
.join(" ")),
|
|
63
|
+
dump("Reader: (Readability) " + e + "\n"));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
} else this.log = function () {};
|
|
67
|
+
}
|
|
68
|
+
((Readability.prototype = {
|
|
69
|
+
FLAG_STRIP_UNLIKELYS: 1,
|
|
70
|
+
FLAG_WEIGHT_CLASSES: 2,
|
|
71
|
+
FLAG_CLEAN_CONDITIONALLY: 4,
|
|
72
|
+
ELEMENT_NODE: 1,
|
|
73
|
+
TEXT_NODE: 3,
|
|
74
|
+
DEFAULT_MAX_ELEMS_TO_PARSE: 0,
|
|
75
|
+
DEFAULT_N_TOP_CANDIDATES: 5,
|
|
76
|
+
DEFAULT_TAGS_TO_SCORE: "section,h2,h3,h4,h5,h6,p,td,pre"
|
|
77
|
+
.toUpperCase()
|
|
78
|
+
.split(","),
|
|
79
|
+
DEFAULT_CHAR_THRESHOLD: 500,
|
|
80
|
+
REGEXPS: {
|
|
81
|
+
unlikelyCandidates:
|
|
82
|
+
/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,
|
|
83
|
+
okMaybeItsACandidate: /and|article|body|column|content|main|shadow/i,
|
|
84
|
+
positive:
|
|
85
|
+
/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,
|
|
86
|
+
negative:
|
|
87
|
+
/-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|footer|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|widget/i,
|
|
88
|
+
extraneous:
|
|
89
|
+
/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,
|
|
90
|
+
byline: /byline|author|dateline|writtenby|p-author/i,
|
|
91
|
+
replaceFonts: /<(\/?)font[^>]*>/gi,
|
|
92
|
+
normalize: /\s{2,}/g,
|
|
93
|
+
videos:
|
|
94
|
+
/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,
|
|
95
|
+
shareElements: /(\b|_)(share|sharedaddy)(\b|_)/i,
|
|
96
|
+
nextLink: /(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,
|
|
97
|
+
prevLink: /(prev|earl|old|new|<|«)/i,
|
|
98
|
+
tokenize: /\W+/g,
|
|
99
|
+
whitespace: /^\s*$/,
|
|
100
|
+
hasContent: /\S$/,
|
|
101
|
+
hashUrl: /^#.+/,
|
|
102
|
+
srcsetUrl: /(\S+)(\s+[\d.]+[xw])?(\s*(?:,|$))/g,
|
|
103
|
+
b64DataUrl: /^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i,
|
|
104
|
+
commas: /\u002C|\u060C|\uFE50|\uFE10|\uFE11|\u2E41|\u2E34|\u2E32|\uFF0C/g,
|
|
105
|
+
jsonLdArticleTypes:
|
|
106
|
+
/^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/,
|
|
107
|
+
adWords:
|
|
108
|
+
/^(ad(vertising|vertisement)?|pub(licité)?|werb(ung)?|广告|Реклама|Anuncio)$/iu,
|
|
109
|
+
loadingWords:
|
|
110
|
+
/^((loading|正在加载|Загрузка|chargement|cargando)(…|\.\.\.)?)$/iu,
|
|
111
|
+
},
|
|
112
|
+
UNLIKELY_ROLES: [
|
|
113
|
+
"menu",
|
|
114
|
+
"menubar",
|
|
115
|
+
"complementary",
|
|
116
|
+
"navigation",
|
|
117
|
+
"alert",
|
|
118
|
+
"alertdialog",
|
|
119
|
+
"dialog",
|
|
120
|
+
],
|
|
121
|
+
DIV_TO_P_ELEMS: new Set([
|
|
122
|
+
"BLOCKQUOTE",
|
|
123
|
+
"DL",
|
|
124
|
+
"DIV",
|
|
125
|
+
"IMG",
|
|
126
|
+
"OL",
|
|
127
|
+
"P",
|
|
128
|
+
"PRE",
|
|
129
|
+
"TABLE",
|
|
130
|
+
"UL",
|
|
131
|
+
]),
|
|
132
|
+
ALTER_TO_DIV_EXCEPTIONS: ["DIV", "ARTICLE", "SECTION", "P", "OL", "UL"],
|
|
133
|
+
PRESENTATIONAL_ATTRIBUTES: [
|
|
134
|
+
"align",
|
|
135
|
+
"background",
|
|
136
|
+
"bgcolor",
|
|
137
|
+
"border",
|
|
138
|
+
"cellpadding",
|
|
139
|
+
"cellspacing",
|
|
140
|
+
"frame",
|
|
141
|
+
"hspace",
|
|
142
|
+
"rules",
|
|
143
|
+
"style",
|
|
144
|
+
"valign",
|
|
145
|
+
"vspace",
|
|
146
|
+
],
|
|
147
|
+
DEPRECATED_SIZE_ATTRIBUTE_ELEMS: ["TABLE", "TH", "TD", "HR", "PRE"],
|
|
148
|
+
PHRASING_ELEMS: [
|
|
149
|
+
"ABBR",
|
|
150
|
+
"AUDIO",
|
|
151
|
+
"B",
|
|
152
|
+
"BDO",
|
|
153
|
+
"BR",
|
|
154
|
+
"BUTTON",
|
|
155
|
+
"CITE",
|
|
156
|
+
"CODE",
|
|
157
|
+
"DATA",
|
|
158
|
+
"DATALIST",
|
|
159
|
+
"DFN",
|
|
160
|
+
"EM",
|
|
161
|
+
"EMBED",
|
|
162
|
+
"I",
|
|
163
|
+
"IMG",
|
|
164
|
+
"INPUT",
|
|
165
|
+
"KBD",
|
|
166
|
+
"LABEL",
|
|
167
|
+
"MARK",
|
|
168
|
+
"MATH",
|
|
169
|
+
"METER",
|
|
170
|
+
"NOSCRIPT",
|
|
171
|
+
"OBJECT",
|
|
172
|
+
"OUTPUT",
|
|
173
|
+
"PROGRESS",
|
|
174
|
+
"Q",
|
|
175
|
+
"RUBY",
|
|
176
|
+
"SAMP",
|
|
177
|
+
"SCRIPT",
|
|
178
|
+
"SELECT",
|
|
179
|
+
"SMALL",
|
|
180
|
+
"SPAN",
|
|
181
|
+
"STRONG",
|
|
182
|
+
"SUB",
|
|
183
|
+
"SUP",
|
|
184
|
+
"TEXTAREA",
|
|
185
|
+
"TIME",
|
|
186
|
+
"VAR",
|
|
187
|
+
"WBR",
|
|
188
|
+
],
|
|
189
|
+
CLASSES_TO_PRESERVE: ["page"],
|
|
190
|
+
HTML_ESCAPE_MAP: { lt: "<", gt: ">", amp: "&", quot: '"', apos: "'" },
|
|
191
|
+
_postProcessContent(e) {
|
|
192
|
+
(this._fixRelativeUris(e),
|
|
193
|
+
this._simplifyNestedElements(e),
|
|
194
|
+
this._keepClasses || this._cleanClasses(e));
|
|
195
|
+
},
|
|
196
|
+
_removeNodes(e, t) {
|
|
197
|
+
if (this._docJSDOMParser && e._isLiveNodeList)
|
|
198
|
+
throw new Error("Do not pass live node lists to _removeNodes");
|
|
199
|
+
for (var i = e.length - 1; 0 <= i; i--) {
|
|
200
|
+
var a = e[i],
|
|
201
|
+
r = a.parentNode;
|
|
202
|
+
!r || (t && !t.call(this, a, i, e)) || r.removeChild(a);
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
_replaceNodeTags(e, t) {
|
|
206
|
+
if (this._docJSDOMParser && e._isLiveNodeList)
|
|
207
|
+
throw new Error("Do not pass live node lists to _replaceNodeTags");
|
|
208
|
+
for (const i of e) this._setNodeTag(i, t);
|
|
209
|
+
},
|
|
210
|
+
_forEachNode(e, t) {
|
|
211
|
+
Array.prototype.forEach.call(e, t, this);
|
|
212
|
+
},
|
|
213
|
+
_findNode(e, t) {
|
|
214
|
+
return Array.prototype.find.call(e, t, this);
|
|
215
|
+
},
|
|
216
|
+
_someNode(e, t) {
|
|
217
|
+
return Array.prototype.some.call(e, t, this);
|
|
218
|
+
},
|
|
219
|
+
_everyNode(e, t) {
|
|
220
|
+
return Array.prototype.every.call(e, t, this);
|
|
221
|
+
},
|
|
222
|
+
_getAllNodesWithTag(t, e) {
|
|
223
|
+
return t.querySelectorAll
|
|
224
|
+
? t.querySelectorAll(e.join(","))
|
|
225
|
+
: [].concat.apply(
|
|
226
|
+
[],
|
|
227
|
+
e.map(function (e) {
|
|
228
|
+
e = t.getElementsByTagName(e);
|
|
229
|
+
return Array.isArray(e) ? e : Array.from(e);
|
|
230
|
+
}),
|
|
231
|
+
);
|
|
232
|
+
},
|
|
233
|
+
_cleanClasses(e) {
|
|
234
|
+
var t = this._classesToPreserve,
|
|
235
|
+
i = (e.getAttribute("class") || "")
|
|
236
|
+
.split(/\s+/)
|
|
237
|
+
.filter((e) => t.includes(e))
|
|
238
|
+
.join(" ");
|
|
239
|
+
for (
|
|
240
|
+
i ? e.setAttribute("class", i) : e.removeAttribute("class"),
|
|
241
|
+
e = e.firstElementChild;
|
|
242
|
+
e;
|
|
243
|
+
e = e.nextElementSibling
|
|
244
|
+
)
|
|
245
|
+
this._cleanClasses(e);
|
|
246
|
+
},
|
|
247
|
+
_isUrl(e) {
|
|
248
|
+
try {
|
|
249
|
+
return (new URL(e), !0);
|
|
250
|
+
} catch {
|
|
251
|
+
return !1;
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
_fixRelativeUris(e) {
|
|
255
|
+
var t = this._doc.baseURI,
|
|
256
|
+
i = this._doc.documentURI;
|
|
257
|
+
function r(e) {
|
|
258
|
+
if (t == i && "#" == e.charAt(0)) return e;
|
|
259
|
+
try {
|
|
260
|
+
return new URL(e, t).href;
|
|
261
|
+
} catch (e) {}
|
|
262
|
+
return e;
|
|
263
|
+
}
|
|
264
|
+
var a = this._getAllNodesWithTag(e, ["a"]),
|
|
265
|
+
a =
|
|
266
|
+
(this._forEachNode(a, function (e) {
|
|
267
|
+
var t = e.getAttribute("href");
|
|
268
|
+
if (t)
|
|
269
|
+
if (0 === t.indexOf("javascript:"))
|
|
270
|
+
if (
|
|
271
|
+
1 === e.childNodes.length &&
|
|
272
|
+
e.childNodes[0].nodeType === this.TEXT_NODE
|
|
273
|
+
) {
|
|
274
|
+
var i = this._doc.createTextNode(e.textContent);
|
|
275
|
+
e.parentNode.replaceChild(i, e);
|
|
276
|
+
} else {
|
|
277
|
+
for (var a = this._doc.createElement("span"); e.firstChild; )
|
|
278
|
+
a.appendChild(e.firstChild);
|
|
279
|
+
e.parentNode.replaceChild(a, e);
|
|
280
|
+
}
|
|
281
|
+
else e.setAttribute("href", r(t));
|
|
282
|
+
}),
|
|
283
|
+
this._getAllNodesWithTag(e, [
|
|
284
|
+
"img",
|
|
285
|
+
"picture",
|
|
286
|
+
"figure",
|
|
287
|
+
"video",
|
|
288
|
+
"audio",
|
|
289
|
+
"source",
|
|
290
|
+
]));
|
|
291
|
+
this._forEachNode(a, function (e) {
|
|
292
|
+
var t = e.getAttribute("src"),
|
|
293
|
+
i = e.getAttribute("poster"),
|
|
294
|
+
a = e.getAttribute("srcset");
|
|
295
|
+
(t && e.setAttribute("src", r(t)),
|
|
296
|
+
i && e.setAttribute("poster", r(i)),
|
|
297
|
+
a &&
|
|
298
|
+
((t = a.replace(this.REGEXPS.srcsetUrl, function (e, t, i, a) {
|
|
299
|
+
return r(t) + (i || "") + a;
|
|
300
|
+
})),
|
|
301
|
+
e.setAttribute("srcset", t)));
|
|
302
|
+
});
|
|
303
|
+
},
|
|
304
|
+
_simplifyNestedElements(e) {
|
|
305
|
+
for (var t = e; t; ) {
|
|
306
|
+
if (
|
|
307
|
+
t.parentNode &&
|
|
308
|
+
["DIV", "SECTION"].includes(t.tagName) &&
|
|
309
|
+
(!t.id || !t.id.startsWith("readability"))
|
|
310
|
+
) {
|
|
311
|
+
if (this._isElementWithoutContent(t)) {
|
|
312
|
+
t = this._removeAndGetNext(t);
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (
|
|
316
|
+
this._hasSingleTagInsideElement(t, "DIV") ||
|
|
317
|
+
this._hasSingleTagInsideElement(t, "SECTION")
|
|
318
|
+
) {
|
|
319
|
+
for (var i = t.children[0], a = 0; a < t.attributes.length; a++)
|
|
320
|
+
i.setAttributeNode(t.attributes[a].cloneNode());
|
|
321
|
+
(t.parentNode.replaceChild(i, t), (t = i));
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
t = this._getNextNode(t);
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
_getArticleTitle() {
|
|
329
|
+
var e = this._doc,
|
|
330
|
+
t = "",
|
|
331
|
+
i = "";
|
|
332
|
+
try {
|
|
333
|
+
"string" != typeof (t = i = e.title.trim()) &&
|
|
334
|
+
(t = i = this._getInnerText(e.getElementsByTagName("title")[0]));
|
|
335
|
+
} catch (e) {}
|
|
336
|
+
var a,
|
|
337
|
+
r,
|
|
338
|
+
s = !1;
|
|
339
|
+
function n(e) {
|
|
340
|
+
return e.split(/\s+/).length;
|
|
341
|
+
}
|
|
342
|
+
if (/ [\|\-\\\/>»] /.test(t)) {
|
|
343
|
+
s = / [\\\/>»] /.test(t);
|
|
344
|
+
let e = Array.from(i.matchAll(/ [\|\-\\\/>»] /gi));
|
|
345
|
+
n((t = i.substring(0, e.pop().index))) < 3 &&
|
|
346
|
+
(t = i.replace(/^[^\|\-\\\/>»]*[\|\-\\\/>»]/gi, ""));
|
|
347
|
+
} else
|
|
348
|
+
t.includes(": ")
|
|
349
|
+
? ((r = this._getAllNodesWithTag(e, ["h1", "h2"])),
|
|
350
|
+
(a = t.trim()),
|
|
351
|
+
this._someNode(r, function (e) {
|
|
352
|
+
return e.textContent.trim() === a;
|
|
353
|
+
}) ||
|
|
354
|
+
(n((t = i.substring(i.lastIndexOf(":") + 1))) < 3
|
|
355
|
+
? (t = i.substring(i.indexOf(":") + 1))
|
|
356
|
+
: 5 < n(i.substr(0, i.indexOf(":"))) && (t = i)))
|
|
357
|
+
: (150 < t.length || t.length < 15) &&
|
|
358
|
+
1 === (r = e.getElementsByTagName("h1")).length &&
|
|
359
|
+
(t = this._getInnerText(r[0]));
|
|
360
|
+
e = n((t = t.trim().replace(this.REGEXPS.normalize, " ")));
|
|
361
|
+
return (t =
|
|
362
|
+
e <= 4 && (!s || e != n(i.replace(/[\|\-\\\/>»]+/g, "")) - 1) ? i : t);
|
|
363
|
+
},
|
|
364
|
+
_prepDocument() {
|
|
365
|
+
var e = this._doc;
|
|
366
|
+
(this._removeNodes(this._getAllNodesWithTag(e, ["style"])),
|
|
367
|
+
e.body && this._replaceBrs(e.body),
|
|
368
|
+
this._replaceNodeTags(this._getAllNodesWithTag(e, ["font"]), "SPAN"));
|
|
369
|
+
},
|
|
370
|
+
_nextNode(e) {
|
|
371
|
+
for (
|
|
372
|
+
var t = e;
|
|
373
|
+
t &&
|
|
374
|
+
t.nodeType != this.ELEMENT_NODE &&
|
|
375
|
+
this.REGEXPS.whitespace.test(t.textContent);
|
|
376
|
+
)
|
|
377
|
+
t = t.nextSibling;
|
|
378
|
+
return t;
|
|
379
|
+
},
|
|
380
|
+
_replaceBrs(e) {
|
|
381
|
+
this._forEachNode(this._getAllNodesWithTag(e, ["br"]), function (e) {
|
|
382
|
+
for (
|
|
383
|
+
var t = e.nextSibling, i = !1;
|
|
384
|
+
(t = this._nextNode(t)) && "BR" == t.tagName;
|
|
385
|
+
) {
|
|
386
|
+
var i = !0,
|
|
387
|
+
a = t.nextSibling;
|
|
388
|
+
(t.remove(), (t = a));
|
|
389
|
+
}
|
|
390
|
+
if (i) {
|
|
391
|
+
var r = this._doc.createElement("p");
|
|
392
|
+
for (e.parentNode.replaceChild(r, e), t = r.nextSibling; t; ) {
|
|
393
|
+
if ("BR" == t.tagName) {
|
|
394
|
+
var s = this._nextNode(t.nextSibling);
|
|
395
|
+
if (s && "BR" == s.tagName) break;
|
|
396
|
+
}
|
|
397
|
+
if (!this._isPhrasingContent(t)) break;
|
|
398
|
+
s = t.nextSibling;
|
|
399
|
+
(r.appendChild(t), (t = s));
|
|
400
|
+
}
|
|
401
|
+
for (; r.lastChild && this._isWhitespace(r.lastChild); )
|
|
402
|
+
r.lastChild.remove();
|
|
403
|
+
"P" === r.parentNode.tagName && this._setNodeTag(r.parentNode, "DIV");
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
},
|
|
407
|
+
_setNodeTag(e, t) {
|
|
408
|
+
if ((this.log("_setNodeTag", e, t), this._docJSDOMParser))
|
|
409
|
+
return (
|
|
410
|
+
(e.localName = t.toLowerCase()),
|
|
411
|
+
(e.tagName = t.toUpperCase()),
|
|
412
|
+
e
|
|
413
|
+
);
|
|
414
|
+
for (var i = e.ownerDocument.createElement(t); e.firstChild; )
|
|
415
|
+
i.appendChild(e.firstChild);
|
|
416
|
+
(e.parentNode.replaceChild(i, e),
|
|
417
|
+
e.readability && (i.readability = e.readability));
|
|
418
|
+
for (var a = 0; a < e.attributes.length; a++)
|
|
419
|
+
i.setAttributeNode(e.attributes[a].cloneNode());
|
|
420
|
+
return i;
|
|
421
|
+
},
|
|
422
|
+
_prepArticle(e) {
|
|
423
|
+
(this._cleanStyles(e),
|
|
424
|
+
this._markDataTables(e),
|
|
425
|
+
this._fixLazyImages(e),
|
|
426
|
+
this._cleanConditionally(e, "form"),
|
|
427
|
+
this._cleanConditionally(e, "fieldset"),
|
|
428
|
+
this._clean(e, "object"),
|
|
429
|
+
this._clean(e, "embed"),
|
|
430
|
+
this._clean(e, "footer"),
|
|
431
|
+
this._clean(e, "link"),
|
|
432
|
+
this._clean(e, "aside"));
|
|
433
|
+
var i = this.DEFAULT_CHAR_THRESHOLD;
|
|
434
|
+
(this._forEachNode(e.children, function (e) {
|
|
435
|
+
this._cleanMatchedNodes(e, function (e, t) {
|
|
436
|
+
return this.REGEXPS.shareElements.test(t) && e.textContent.length < i;
|
|
437
|
+
});
|
|
438
|
+
}),
|
|
439
|
+
this._clean(e, "iframe"),
|
|
440
|
+
this._clean(e, "input"),
|
|
441
|
+
this._clean(e, "textarea"),
|
|
442
|
+
this._clean(e, "select"),
|
|
443
|
+
this._clean(e, "button"),
|
|
444
|
+
this._cleanHeaders(e),
|
|
445
|
+
this._cleanConditionally(e, "table"),
|
|
446
|
+
this._cleanConditionally(e, "ul"),
|
|
447
|
+
this._cleanConditionally(e, "div"),
|
|
448
|
+
this._replaceNodeTags(this._getAllNodesWithTag(e, ["h1"]), "h2"),
|
|
449
|
+
this._removeNodes(this._getAllNodesWithTag(e, ["p"]), function (e) {
|
|
450
|
+
return (
|
|
451
|
+
0 ===
|
|
452
|
+
this._getAllNodesWithTag(e, ["img", "embed", "object", "iframe"])
|
|
453
|
+
.length && !this._getInnerText(e, !1)
|
|
454
|
+
);
|
|
455
|
+
}),
|
|
456
|
+
this._forEachNode(this._getAllNodesWithTag(e, ["br"]), function (e) {
|
|
457
|
+
var t = this._nextNode(e.nextSibling);
|
|
458
|
+
t && "P" == t.tagName && e.remove();
|
|
459
|
+
}),
|
|
460
|
+
this._forEachNode(this._getAllNodesWithTag(e, ["table"]), function (e) {
|
|
461
|
+
var t = this._hasSingleTagInsideElement(e, "TBODY")
|
|
462
|
+
? e.firstElementChild
|
|
463
|
+
: e;
|
|
464
|
+
this._hasSingleTagInsideElement(t, "TR") &&
|
|
465
|
+
((t = t.firstElementChild),
|
|
466
|
+
this._hasSingleTagInsideElement(t, "TD") &&
|
|
467
|
+
((t = t.firstElementChild),
|
|
468
|
+
(t = this._setNodeTag(
|
|
469
|
+
t,
|
|
470
|
+
this._everyNode(t.childNodes, this._isPhrasingContent)
|
|
471
|
+
? "P"
|
|
472
|
+
: "DIV",
|
|
473
|
+
)),
|
|
474
|
+
e.parentNode.replaceChild(t, e)));
|
|
475
|
+
}));
|
|
476
|
+
},
|
|
477
|
+
_initializeNode(e) {
|
|
478
|
+
switch (((e.readability = { contentScore: 0 }), e.tagName)) {
|
|
479
|
+
case "DIV":
|
|
480
|
+
e.readability.contentScore += 5;
|
|
481
|
+
break;
|
|
482
|
+
case "PRE":
|
|
483
|
+
case "TD":
|
|
484
|
+
case "BLOCKQUOTE":
|
|
485
|
+
e.readability.contentScore += 3;
|
|
486
|
+
break;
|
|
487
|
+
case "ADDRESS":
|
|
488
|
+
case "OL":
|
|
489
|
+
case "UL":
|
|
490
|
+
case "DL":
|
|
491
|
+
case "DD":
|
|
492
|
+
case "DT":
|
|
493
|
+
case "LI":
|
|
494
|
+
case "FORM":
|
|
495
|
+
e.readability.contentScore -= 3;
|
|
496
|
+
break;
|
|
497
|
+
case "H1":
|
|
498
|
+
case "H2":
|
|
499
|
+
case "H3":
|
|
500
|
+
case "H4":
|
|
501
|
+
case "H5":
|
|
502
|
+
case "H6":
|
|
503
|
+
case "TH":
|
|
504
|
+
e.readability.contentScore -= 5;
|
|
505
|
+
}
|
|
506
|
+
e.readability.contentScore += this._getClassWeight(e);
|
|
507
|
+
},
|
|
508
|
+
_removeAndGetNext(e) {
|
|
509
|
+
var t = this._getNextNode(e, !0);
|
|
510
|
+
return (e.remove(), t);
|
|
511
|
+
},
|
|
512
|
+
_getNextNode(e, t) {
|
|
513
|
+
if (!t && e.firstElementChild) return e.firstElementChild;
|
|
514
|
+
if (e.nextElementSibling) return e.nextElementSibling;
|
|
515
|
+
for (; (e = e.parentNode) && !e.nextElementSibling; );
|
|
516
|
+
return e && e.nextElementSibling;
|
|
517
|
+
},
|
|
518
|
+
_textSimilarity(e, t) {
|
|
519
|
+
var i = e.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean),
|
|
520
|
+
e = t.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean);
|
|
521
|
+
return i.length && e.length
|
|
522
|
+
? 1 -
|
|
523
|
+
e.filter((e) => !i.includes(e)).join(" ").length / e.join(" ").length
|
|
524
|
+
: 0;
|
|
525
|
+
},
|
|
526
|
+
_isValidByline(e, t) {
|
|
527
|
+
var i = e.getAttribute("rel"),
|
|
528
|
+
a = e.getAttribute("itemprop"),
|
|
529
|
+
e = e.textContent.trim().length;
|
|
530
|
+
return (
|
|
531
|
+
("author" === i ||
|
|
532
|
+
(a && a.includes("author")) ||
|
|
533
|
+
this.REGEXPS.byline.test(t)) &&
|
|
534
|
+
!!e &&
|
|
535
|
+
e < 100
|
|
536
|
+
);
|
|
537
|
+
},
|
|
538
|
+
_getNodeAncestors(e, t) {
|
|
539
|
+
t = t || 0;
|
|
540
|
+
for (
|
|
541
|
+
var i = 0, a = [];
|
|
542
|
+
e.parentNode && (a.push(e.parentNode), !t || ++i !== t);
|
|
543
|
+
)
|
|
544
|
+
e = e.parentNode;
|
|
545
|
+
return a;
|
|
546
|
+
},
|
|
547
|
+
_grabArticle(t) {
|
|
548
|
+
this.log("**** grabArticle ****");
|
|
549
|
+
var i = this._doc,
|
|
550
|
+
M = null !== t;
|
|
551
|
+
if (!(t = t || this._doc.body))
|
|
552
|
+
return (this.log("No body found in document. Abort."), null);
|
|
553
|
+
for (var H = t.innerHTML; ; ) {
|
|
554
|
+
this.log("Starting grabArticle loop");
|
|
555
|
+
var k = this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),
|
|
556
|
+
a = [],
|
|
557
|
+
r = this._doc.documentElement;
|
|
558
|
+
let e = !0;
|
|
559
|
+
for (; r; ) {
|
|
560
|
+
"HTML" === r.tagName && (this._articleLang = r.getAttribute("lang"));
|
|
561
|
+
var s = r.className + " " + r.id;
|
|
562
|
+
if (this._isProbablyVisible(r))
|
|
563
|
+
if (
|
|
564
|
+
"true" == r.getAttribute("aria-modal") &&
|
|
565
|
+
"dialog" == r.getAttribute("role")
|
|
566
|
+
)
|
|
567
|
+
r = this._removeAndGetNext(r);
|
|
568
|
+
else if (
|
|
569
|
+
this._articleByline ||
|
|
570
|
+
this._metadata.byline ||
|
|
571
|
+
!this._isValidByline(r, s)
|
|
572
|
+
)
|
|
573
|
+
if (e && this._headerDuplicatesTitle(r))
|
|
574
|
+
(this.log(
|
|
575
|
+
"Removing header: ",
|
|
576
|
+
r.textContent.trim(),
|
|
577
|
+
this._articleTitle.trim(),
|
|
578
|
+
),
|
|
579
|
+
(e = !1),
|
|
580
|
+
(r = this._removeAndGetNext(r)));
|
|
581
|
+
else {
|
|
582
|
+
if (k) {
|
|
583
|
+
if (
|
|
584
|
+
this.REGEXPS.unlikelyCandidates.test(s) &&
|
|
585
|
+
!this.REGEXPS.okMaybeItsACandidate.test(s) &&
|
|
586
|
+
!this._hasAncestorTag(r, "table") &&
|
|
587
|
+
!this._hasAncestorTag(r, "code") &&
|
|
588
|
+
"BODY" !== r.tagName &&
|
|
589
|
+
"A" !== r.tagName
|
|
590
|
+
) {
|
|
591
|
+
(this.log("Removing unlikely candidate - " + s),
|
|
592
|
+
(r = this._removeAndGetNext(r)));
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
if (this.UNLIKELY_ROLES.includes(r.getAttribute("role"))) {
|
|
596
|
+
(this.log(
|
|
597
|
+
"Removing content with role " +
|
|
598
|
+
r.getAttribute("role") +
|
|
599
|
+
" - " +
|
|
600
|
+
s,
|
|
601
|
+
),
|
|
602
|
+
(r = this._removeAndGetNext(r)));
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (
|
|
607
|
+
("DIV" !== r.tagName &&
|
|
608
|
+
"SECTION" !== r.tagName &&
|
|
609
|
+
"HEADER" !== r.tagName &&
|
|
610
|
+
"H1" !== r.tagName &&
|
|
611
|
+
"H2" !== r.tagName &&
|
|
612
|
+
"H3" !== r.tagName &&
|
|
613
|
+
"H4" !== r.tagName &&
|
|
614
|
+
"H5" !== r.tagName &&
|
|
615
|
+
"H6" !== r.tagName) ||
|
|
616
|
+
!this._isElementWithoutContent(r)
|
|
617
|
+
) {
|
|
618
|
+
if (
|
|
619
|
+
(this.DEFAULT_TAGS_TO_SCORE.includes(r.tagName) && a.push(r),
|
|
620
|
+
"DIV" === r.tagName)
|
|
621
|
+
) {
|
|
622
|
+
for (var n, l = null, o = r.firstChild; o; ) {
|
|
623
|
+
var U = o.nextSibling;
|
|
624
|
+
if (this._isPhrasingContent(o))
|
|
625
|
+
null !== l
|
|
626
|
+
? l.appendChild(o)
|
|
627
|
+
: this._isWhitespace(o) ||
|
|
628
|
+
((l = i.createElement("p")),
|
|
629
|
+
r.replaceChild(l, o),
|
|
630
|
+
l.appendChild(o));
|
|
631
|
+
else if (null !== l) {
|
|
632
|
+
for (; l.lastChild && this._isWhitespace(l.lastChild); )
|
|
633
|
+
l.lastChild.remove();
|
|
634
|
+
l = null;
|
|
635
|
+
}
|
|
636
|
+
o = U;
|
|
637
|
+
}
|
|
638
|
+
this._hasSingleTagInsideElement(r, "P") &&
|
|
639
|
+
this._getLinkDensity(r) < 0.25
|
|
640
|
+
? ((n = r.children[0]),
|
|
641
|
+
r.parentNode.replaceChild(n, r),
|
|
642
|
+
a.push((r = n)))
|
|
643
|
+
: this._hasChildBlockElement(r) ||
|
|
644
|
+
((r = this._setNodeTag(r, "P")), a.push(r));
|
|
645
|
+
}
|
|
646
|
+
r = this._getNextNode(r);
|
|
647
|
+
} else r = this._removeAndGetNext(r);
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
for (
|
|
651
|
+
var W = this._getNextNode(r, !0),
|
|
652
|
+
h = this._getNextNode(r),
|
|
653
|
+
d = null;
|
|
654
|
+
h && h != W;
|
|
655
|
+
) {
|
|
656
|
+
var c = h.getAttribute("itemprop");
|
|
657
|
+
if (c && c.includes("name")) {
|
|
658
|
+
d = h;
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
h = this._getNextNode(h);
|
|
662
|
+
}
|
|
663
|
+
((this._articleByline = (d ?? r).textContent.trim()),
|
|
664
|
+
(r = this._removeAndGetNext(r)));
|
|
665
|
+
}
|
|
666
|
+
else
|
|
667
|
+
(this.log("Removing hidden node - " + s),
|
|
668
|
+
(r = this._removeAndGetNext(r)));
|
|
669
|
+
}
|
|
670
|
+
for (
|
|
671
|
+
var g = [],
|
|
672
|
+
_ =
|
|
673
|
+
(this._forEachNode(a, function (e) {
|
|
674
|
+
var t, i;
|
|
675
|
+
!e.parentNode ||
|
|
676
|
+
void 0 === e.parentNode.tagName ||
|
|
677
|
+
(t = this._getInnerText(e)).length < 25 ||
|
|
678
|
+
(0 !== (e = this._getNodeAncestors(e, 5)).length &&
|
|
679
|
+
((i = 0),
|
|
680
|
+
++i,
|
|
681
|
+
(i =
|
|
682
|
+
(i += t.split(this.REGEXPS.commas).length) +
|
|
683
|
+
Math.min(Math.floor(t.length / 100), 3)),
|
|
684
|
+
this._forEachNode(e, function (e, t) {
|
|
685
|
+
e.tagName &&
|
|
686
|
+
e.parentNode &&
|
|
687
|
+
void 0 !== e.parentNode.tagName &&
|
|
688
|
+
(void 0 === e.readability &&
|
|
689
|
+
(this._initializeNode(e), g.push(e)),
|
|
690
|
+
(e.readability.contentScore +=
|
|
691
|
+
i / (0 === t ? 1 : 1 === t ? 2 : 3 * t)));
|
|
692
|
+
})));
|
|
693
|
+
}),
|
|
694
|
+
[]),
|
|
695
|
+
m = 0,
|
|
696
|
+
F = g.length;
|
|
697
|
+
m < F;
|
|
698
|
+
m += 1
|
|
699
|
+
) {
|
|
700
|
+
var u = g[m],
|
|
701
|
+
p = u.readability.contentScore * (1 - this._getLinkDensity(u));
|
|
702
|
+
((u.readability.contentScore = p),
|
|
703
|
+
this.log("Candidate:", u, "with score " + p));
|
|
704
|
+
for (var N = 0; N < this._nbTopCandidates; N++) {
|
|
705
|
+
var E = _[N];
|
|
706
|
+
if (!E || p > E.readability.contentScore) {
|
|
707
|
+
(_.splice(N, 0, u), _.length > this._nbTopCandidates && _.pop());
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
var f = _[0] || null,
|
|
713
|
+
b = !1;
|
|
714
|
+
if (null === f || "BODY" === f.tagName) {
|
|
715
|
+
for (f = i.createElement("DIV"), b = !0; t.firstChild; )
|
|
716
|
+
(this.log("Moving child out:", t.firstChild),
|
|
717
|
+
f.appendChild(t.firstChild));
|
|
718
|
+
(t.appendChild(f), this._initializeNode(f));
|
|
719
|
+
} else if (f) {
|
|
720
|
+
for (var T = [], A = 1; A < _.length; A++)
|
|
721
|
+
0.75 <= _[A].readability.contentScore / f.readability.contentScore &&
|
|
722
|
+
T.push(this._getNodeAncestors(_[A]));
|
|
723
|
+
if (3 <= T.length)
|
|
724
|
+
for (S = f.parentNode; "BODY" !== S.tagName; ) {
|
|
725
|
+
for (var y = 0, v = 0; v < T.length && y < 3; v++)
|
|
726
|
+
y += Number(T[v].includes(S));
|
|
727
|
+
if (3 <= y) {
|
|
728
|
+
f = S;
|
|
729
|
+
break;
|
|
730
|
+
}
|
|
731
|
+
S = S.parentNode;
|
|
732
|
+
}
|
|
733
|
+
f.readability || this._initializeNode(f);
|
|
734
|
+
for (
|
|
735
|
+
var S = f.parentNode, C = f.readability.contentScore, X = C / 3;
|
|
736
|
+
"BODY" !== S.tagName;
|
|
737
|
+
)
|
|
738
|
+
if (S.readability) {
|
|
739
|
+
var L = S.readability.contentScore;
|
|
740
|
+
if (L < X) break;
|
|
741
|
+
if (C < L) {
|
|
742
|
+
f = S;
|
|
743
|
+
break;
|
|
744
|
+
}
|
|
745
|
+
((C = S.readability.contentScore), (S = S.parentNode));
|
|
746
|
+
} else S = S.parentNode;
|
|
747
|
+
for (S = f.parentNode; "BODY" != S.tagName && 1 == S.children.length; )
|
|
748
|
+
S = (f = S).parentNode;
|
|
749
|
+
f.readability || this._initializeNode(f);
|
|
750
|
+
}
|
|
751
|
+
for (
|
|
752
|
+
var D = i.createElement("DIV"),
|
|
753
|
+
$ =
|
|
754
|
+
(M && (D.id = "readability-content"),
|
|
755
|
+
Math.max(10, 0.2 * f.readability.contentScore)),
|
|
756
|
+
x = (S = f.parentNode).children,
|
|
757
|
+
I = 0,
|
|
758
|
+
j = x.length;
|
|
759
|
+
I < j;
|
|
760
|
+
I++
|
|
761
|
+
) {
|
|
762
|
+
var R,
|
|
763
|
+
V,
|
|
764
|
+
P,
|
|
765
|
+
O = x[I],
|
|
766
|
+
w = !1;
|
|
767
|
+
(this.log(
|
|
768
|
+
"Looking at sibling node:",
|
|
769
|
+
O,
|
|
770
|
+
O.readability ? "with score " + O.readability.contentScore : "",
|
|
771
|
+
),
|
|
772
|
+
this.log(
|
|
773
|
+
"Sibling has score",
|
|
774
|
+
O.readability ? O.readability.contentScore : "Unknown",
|
|
775
|
+
),
|
|
776
|
+
O === f
|
|
777
|
+
? (w = !0)
|
|
778
|
+
: ((R = 0),
|
|
779
|
+
O.className === f.className &&
|
|
780
|
+
"" !== f.className &&
|
|
781
|
+
(R += 0.2 * f.readability.contentScore),
|
|
782
|
+
O.readability && O.readability.contentScore + R >= $
|
|
783
|
+
? (w = !0)
|
|
784
|
+
: "P" === O.nodeName &&
|
|
785
|
+
((R = this._getLinkDensity(O)),
|
|
786
|
+
((80 < (P = (V = this._getInnerText(O)).length) &&
|
|
787
|
+
R < 0.25) ||
|
|
788
|
+
(P < 80 &&
|
|
789
|
+
0 < P &&
|
|
790
|
+
0 === R &&
|
|
791
|
+
-1 !== V.search(/\.( |$)/))) &&
|
|
792
|
+
(w = !0))),
|
|
793
|
+
w &&
|
|
794
|
+
(this.log("Appending node:", O),
|
|
795
|
+
this.ALTER_TO_DIV_EXCEPTIONS.includes(O.nodeName) ||
|
|
796
|
+
(this.log("Altering sibling:", O, "to div."),
|
|
797
|
+
(O = this._setNodeTag(O, "DIV"))),
|
|
798
|
+
D.appendChild(O),
|
|
799
|
+
(x = S.children),
|
|
800
|
+
--I,
|
|
801
|
+
--j));
|
|
802
|
+
}
|
|
803
|
+
if (
|
|
804
|
+
(this._debug && this.log("Article content pre-prep: " + D.innerHTML),
|
|
805
|
+
this._prepArticle(D),
|
|
806
|
+
this._debug && this.log("Article content post-prep: " + D.innerHTML),
|
|
807
|
+
b)
|
|
808
|
+
)
|
|
809
|
+
((f.id = "readability-page-1"), (f.className = "page"));
|
|
810
|
+
else {
|
|
811
|
+
var B = i.createElement("DIV");
|
|
812
|
+
for (B.id = "readability-page-1", B.className = "page"; D.firstChild; )
|
|
813
|
+
B.appendChild(D.firstChild);
|
|
814
|
+
D.appendChild(B);
|
|
815
|
+
}
|
|
816
|
+
this._debug && this.log("Article content after paging: " + D.innerHTML);
|
|
817
|
+
var b = !0,
|
|
818
|
+
G = this._getInnerText(D, !0).length;
|
|
819
|
+
if (G < this._charThreshold)
|
|
820
|
+
if (
|
|
821
|
+
((b = !1),
|
|
822
|
+
(t.innerHTML = H),
|
|
823
|
+
this._attempts.push({ articleContent: D, textLength: G }),
|
|
824
|
+
this._flagIsActive(this.FLAG_STRIP_UNLIKELYS))
|
|
825
|
+
)
|
|
826
|
+
this._removeFlag(this.FLAG_STRIP_UNLIKELYS);
|
|
827
|
+
else if (this._flagIsActive(this.FLAG_WEIGHT_CLASSES))
|
|
828
|
+
this._removeFlag(this.FLAG_WEIGHT_CLASSES);
|
|
829
|
+
else if (this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY))
|
|
830
|
+
this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY);
|
|
831
|
+
else {
|
|
832
|
+
if (
|
|
833
|
+
(this._attempts.sort(function (e, t) {
|
|
834
|
+
return t.textLength - e.textLength;
|
|
835
|
+
}),
|
|
836
|
+
!this._attempts[0].textLength)
|
|
837
|
+
)
|
|
838
|
+
return null;
|
|
839
|
+
((D = this._attempts[0].articleContent), (b = !0));
|
|
840
|
+
}
|
|
841
|
+
if (b)
|
|
842
|
+
return (
|
|
843
|
+
(G = [S, f].concat(this._getNodeAncestors(S))),
|
|
844
|
+
this._someNode(G, function (e) {
|
|
845
|
+
if (!e.tagName) return !1;
|
|
846
|
+
e = e.getAttribute("dir");
|
|
847
|
+
return !!e && ((this._articleDir = e), !0);
|
|
848
|
+
}),
|
|
849
|
+
D
|
|
850
|
+
);
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
_unescapeHtmlEntities(e) {
|
|
854
|
+
if (!e) return e;
|
|
855
|
+
var i = this.HTML_ESCAPE_MAP;
|
|
856
|
+
return e
|
|
857
|
+
.replace(/&(quot|amp|apos|lt|gt);/g, function (e, t) {
|
|
858
|
+
return i[t];
|
|
859
|
+
})
|
|
860
|
+
.replace(/&#(?:x([0-9a-f]+)|([0-9]+));/gi, function (e, t, i) {
|
|
861
|
+
i = parseInt(t || i, t ? 16 : 10);
|
|
862
|
+
return (
|
|
863
|
+
(0 == i || 1114111 < i || (55296 <= i && i <= 57343)) && (i = 65533),
|
|
864
|
+
String.fromCodePoint(i)
|
|
865
|
+
);
|
|
866
|
+
});
|
|
867
|
+
},
|
|
868
|
+
_getJSONLD(e) {
|
|
869
|
+
var l,
|
|
870
|
+
e = this._getAllNodesWithTag(e, ["script"]);
|
|
871
|
+
return (
|
|
872
|
+
this._forEachNode(e, function (e) {
|
|
873
|
+
if (!l && "application/ld+json" === e.getAttribute("type"))
|
|
874
|
+
try {
|
|
875
|
+
var t = e.textContent.replace(/^\s*<!\[CDATA\[|\]\]>\s*$/g, ""),
|
|
876
|
+
i = JSON.parse(t);
|
|
877
|
+
if (
|
|
878
|
+
Array.isArray(i) &&
|
|
879
|
+
!(i = i.find(
|
|
880
|
+
(e) =>
|
|
881
|
+
e["@type"] &&
|
|
882
|
+
e["@type"].match(this.REGEXPS.jsonLdArticleTypes),
|
|
883
|
+
))
|
|
884
|
+
)
|
|
885
|
+
return;
|
|
886
|
+
var a,
|
|
887
|
+
r,
|
|
888
|
+
s,
|
|
889
|
+
n = /^https?\:\/\/schema\.org\/?$/;
|
|
890
|
+
if (
|
|
891
|
+
!(
|
|
892
|
+
("string" == typeof i["@context"] && i["@context"].match(n)) ||
|
|
893
|
+
("object" == typeof i["@context"] &&
|
|
894
|
+
"string" == typeof i["@context"]["@vocab"] &&
|
|
895
|
+
i["@context"]["@vocab"].match(n))
|
|
896
|
+
)
|
|
897
|
+
)
|
|
898
|
+
return;
|
|
899
|
+
if (
|
|
900
|
+
!(i =
|
|
901
|
+
!i["@type"] && Array.isArray(i["@graph"])
|
|
902
|
+
? i["@graph"].find((e) =>
|
|
903
|
+
(e["@type"] || "").match(this.REGEXPS.jsonLdArticleTypes),
|
|
904
|
+
)
|
|
905
|
+
: i) ||
|
|
906
|
+
!i["@type"] ||
|
|
907
|
+
!i["@type"].match(this.REGEXPS.jsonLdArticleTypes)
|
|
908
|
+
)
|
|
909
|
+
return;
|
|
910
|
+
((l = {}),
|
|
911
|
+
"string" == typeof i.name &&
|
|
912
|
+
"string" == typeof i.headline &&
|
|
913
|
+
i.name !== i.headline
|
|
914
|
+
? ((a = this._getArticleTitle()),
|
|
915
|
+
(r = 0.75 < this._textSimilarity(i.name, a)),
|
|
916
|
+
(s = 0.75 < this._textSimilarity(i.headline, a)),
|
|
917
|
+
(l.title = s && !r ? i.headline : i.name))
|
|
918
|
+
: "string" == typeof i.name
|
|
919
|
+
? (l.title = i.name.trim())
|
|
920
|
+
: "string" == typeof i.headline &&
|
|
921
|
+
(l.title = i.headline.trim()),
|
|
922
|
+
i.author &&
|
|
923
|
+
("string" == typeof i.author.name
|
|
924
|
+
? (l.byline = i.author.name.trim())
|
|
925
|
+
: Array.isArray(i.author) &&
|
|
926
|
+
i.author[0] &&
|
|
927
|
+
"string" == typeof i.author[0].name &&
|
|
928
|
+
(l.byline = i.author
|
|
929
|
+
.filter(function (e) {
|
|
930
|
+
return e && "string" == typeof e.name;
|
|
931
|
+
})
|
|
932
|
+
.map(function (e) {
|
|
933
|
+
return e.name.trim();
|
|
934
|
+
})
|
|
935
|
+
.join(", "))),
|
|
936
|
+
"string" == typeof i.description &&
|
|
937
|
+
(l.excerpt = i.description.trim()),
|
|
938
|
+
i.publisher &&
|
|
939
|
+
"string" == typeof i.publisher.name &&
|
|
940
|
+
(l.siteName = i.publisher.name.trim()),
|
|
941
|
+
"string" == typeof i.datePublished &&
|
|
942
|
+
(l.datePublished = i.datePublished.trim()));
|
|
943
|
+
} catch (e) {
|
|
944
|
+
this.log(e.message);
|
|
945
|
+
}
|
|
946
|
+
}),
|
|
947
|
+
l || {}
|
|
948
|
+
);
|
|
949
|
+
},
|
|
950
|
+
_getArticleMetadata(e) {
|
|
951
|
+
var t = {},
|
|
952
|
+
s = {},
|
|
953
|
+
i = this._doc.getElementsByTagName("meta"),
|
|
954
|
+
n =
|
|
955
|
+
/\s*(article|dc|dcterm|og|twitter)\s*:\s*(author|creator|description|published_time|title|site_name)\s*/gi,
|
|
956
|
+
l =
|
|
957
|
+
/^\s*(?:(dc|dcterm|og|twitter|parsely|weibo:(article|webpage))\s*[-\.:]\s*)?(author|creator|pub-date|description|title|site_name)\s*$/i,
|
|
958
|
+
i =
|
|
959
|
+
(this._forEachNode(i, function (e) {
|
|
960
|
+
var t,
|
|
961
|
+
i,
|
|
962
|
+
a = e.getAttribute("name"),
|
|
963
|
+
r = e.getAttribute("property"),
|
|
964
|
+
e = e.getAttribute("content");
|
|
965
|
+
e &&
|
|
966
|
+
((i = t = null),
|
|
967
|
+
r &&
|
|
968
|
+
(t = r.match(n)) &&
|
|
969
|
+
((i = t[0].toLowerCase().replace(/\s/g, "")), (s[i] = e.trim())),
|
|
970
|
+
!t &&
|
|
971
|
+
a &&
|
|
972
|
+
l.test(a) &&
|
|
973
|
+
((i = a),
|
|
974
|
+
e &&
|
|
975
|
+
((i = i.toLowerCase().replace(/\s/g, "").replace(/\./g, ":")),
|
|
976
|
+
(s[i] = e.trim()))));
|
|
977
|
+
}),
|
|
978
|
+
(t.title =
|
|
979
|
+
e.title ||
|
|
980
|
+
s["dc:title"] ||
|
|
981
|
+
s["dcterm:title"] ||
|
|
982
|
+
s["og:title"] ||
|
|
983
|
+
s["weibo:article:title"] ||
|
|
984
|
+
s["weibo:webpage:title"] ||
|
|
985
|
+
s.title ||
|
|
986
|
+
s["twitter:title"] ||
|
|
987
|
+
s["parsely-title"]),
|
|
988
|
+
t.title || (t.title = this._getArticleTitle()),
|
|
989
|
+
"string" != typeof s["article:author"] ||
|
|
990
|
+
this._isUrl(s["article:author"])
|
|
991
|
+
? void 0
|
|
992
|
+
: s["article:author"]);
|
|
993
|
+
return (
|
|
994
|
+
(t.byline =
|
|
995
|
+
e.byline ||
|
|
996
|
+
s["dc:creator"] ||
|
|
997
|
+
s["dcterm:creator"] ||
|
|
998
|
+
s.author ||
|
|
999
|
+
s["parsely-author"] ||
|
|
1000
|
+
i),
|
|
1001
|
+
(t.excerpt =
|
|
1002
|
+
e.excerpt ||
|
|
1003
|
+
s["dc:description"] ||
|
|
1004
|
+
s["dcterm:description"] ||
|
|
1005
|
+
s["og:description"] ||
|
|
1006
|
+
s["weibo:article:description"] ||
|
|
1007
|
+
s["weibo:webpage:description"] ||
|
|
1008
|
+
s.description ||
|
|
1009
|
+
s["twitter:description"]),
|
|
1010
|
+
(t.siteName = e.siteName || s["og:site_name"]),
|
|
1011
|
+
(t.publishedTime =
|
|
1012
|
+
e.datePublished ||
|
|
1013
|
+
s["article:published_time"] ||
|
|
1014
|
+
s["parsely-pub-date"] ||
|
|
1015
|
+
null),
|
|
1016
|
+
(t.title = this._unescapeHtmlEntities(t.title)),
|
|
1017
|
+
(t.byline = this._unescapeHtmlEntities(t.byline)),
|
|
1018
|
+
(t.excerpt = this._unescapeHtmlEntities(t.excerpt)),
|
|
1019
|
+
(t.siteName = this._unescapeHtmlEntities(t.siteName)),
|
|
1020
|
+
(t.publishedTime = this._unescapeHtmlEntities(t.publishedTime)),
|
|
1021
|
+
t
|
|
1022
|
+
);
|
|
1023
|
+
},
|
|
1024
|
+
_isSingleImage(e) {
|
|
1025
|
+
for (; e; ) {
|
|
1026
|
+
if ("IMG" === e.tagName) return !0;
|
|
1027
|
+
if (1 !== e.children.length || "" !== e.textContent.trim()) return !1;
|
|
1028
|
+
e = e.children[0];
|
|
1029
|
+
}
|
|
1030
|
+
return !1;
|
|
1031
|
+
},
|
|
1032
|
+
_unwrapNoscriptImages(o) {
|
|
1033
|
+
var e = Array.from(o.getElementsByTagName("img")),
|
|
1034
|
+
e =
|
|
1035
|
+
(this._forEachNode(e, function (e) {
|
|
1036
|
+
for (var t = 0; t < e.attributes.length; t++) {
|
|
1037
|
+
var i = e.attributes[t];
|
|
1038
|
+
switch (i.name) {
|
|
1039
|
+
case "src":
|
|
1040
|
+
case "srcset":
|
|
1041
|
+
case "data-src":
|
|
1042
|
+
case "data-srcset":
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
if (/\.(jpg|jpeg|png|webp)/i.test(i.value)) return;
|
|
1046
|
+
}
|
|
1047
|
+
e.remove();
|
|
1048
|
+
}),
|
|
1049
|
+
Array.from(o.getElementsByTagName("noscript")));
|
|
1050
|
+
this._forEachNode(e, function (e) {
|
|
1051
|
+
if (this._isSingleImage(e)) {
|
|
1052
|
+
var t = o.createElement("div"),
|
|
1053
|
+
i = ((t.innerHTML = e.innerHTML), e.previousElementSibling);
|
|
1054
|
+
if (i && this._isSingleImage(i)) {
|
|
1055
|
+
for (
|
|
1056
|
+
var a = i,
|
|
1057
|
+
r =
|
|
1058
|
+
("IMG" !== a.tagName && (a = i.getElementsByTagName("img")[0]),
|
|
1059
|
+
t.getElementsByTagName("img")[0]),
|
|
1060
|
+
s = 0;
|
|
1061
|
+
s < a.attributes.length;
|
|
1062
|
+
s++
|
|
1063
|
+
) {
|
|
1064
|
+
var n,
|
|
1065
|
+
l = a.attributes[s];
|
|
1066
|
+
"" === l.value ||
|
|
1067
|
+
("src" !== l.name &&
|
|
1068
|
+
"srcset" !== l.name &&
|
|
1069
|
+
!/\.(jpg|jpeg|png|webp)/i.test(l.value)) ||
|
|
1070
|
+
r.getAttribute(l.name) === l.value ||
|
|
1071
|
+
((n = l.name),
|
|
1072
|
+
r.hasAttribute(n) && (n = "data-old-" + n),
|
|
1073
|
+
r.setAttribute(n, l.value));
|
|
1074
|
+
}
|
|
1075
|
+
e.parentNode.replaceChild(t.firstElementChild, i);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1079
|
+
},
|
|
1080
|
+
_removeScripts(e) {
|
|
1081
|
+
this._removeNodes(this._getAllNodesWithTag(e, ["script", "noscript"]));
|
|
1082
|
+
},
|
|
1083
|
+
_hasSingleTagInsideElement(e, t) {
|
|
1084
|
+
return (
|
|
1085
|
+
1 == e.children.length &&
|
|
1086
|
+
e.children[0].tagName === t &&
|
|
1087
|
+
!this._someNode(e.childNodes, function (e) {
|
|
1088
|
+
return (
|
|
1089
|
+
e.nodeType === this.TEXT_NODE &&
|
|
1090
|
+
this.REGEXPS.hasContent.test(e.textContent)
|
|
1091
|
+
);
|
|
1092
|
+
})
|
|
1093
|
+
);
|
|
1094
|
+
},
|
|
1095
|
+
_isElementWithoutContent(e) {
|
|
1096
|
+
return !(
|
|
1097
|
+
e.nodeType !== this.ELEMENT_NODE ||
|
|
1098
|
+
e.textContent.trim().length ||
|
|
1099
|
+
(e.children.length &&
|
|
1100
|
+
e.children.length !=
|
|
1101
|
+
e.getElementsByTagName("br").length +
|
|
1102
|
+
e.getElementsByTagName("hr").length)
|
|
1103
|
+
);
|
|
1104
|
+
},
|
|
1105
|
+
_hasChildBlockElement(e) {
|
|
1106
|
+
return this._someNode(e.childNodes, function (e) {
|
|
1107
|
+
return (
|
|
1108
|
+
this.DIV_TO_P_ELEMS.has(e.tagName) || this._hasChildBlockElement(e)
|
|
1109
|
+
);
|
|
1110
|
+
});
|
|
1111
|
+
},
|
|
1112
|
+
_isPhrasingContent(e) {
|
|
1113
|
+
return (
|
|
1114
|
+
e.nodeType === this.TEXT_NODE ||
|
|
1115
|
+
this.PHRASING_ELEMS.includes(e.tagName) ||
|
|
1116
|
+
(("A" === e.tagName || "DEL" === e.tagName || "INS" === e.tagName) &&
|
|
1117
|
+
this._everyNode(e.childNodes, this._isPhrasingContent))
|
|
1118
|
+
);
|
|
1119
|
+
},
|
|
1120
|
+
_isWhitespace(e) {
|
|
1121
|
+
return (
|
|
1122
|
+
(e.nodeType === this.TEXT_NODE && 0 === e.textContent.trim().length) ||
|
|
1123
|
+
(e.nodeType === this.ELEMENT_NODE && "BR" === e.tagName)
|
|
1124
|
+
);
|
|
1125
|
+
},
|
|
1126
|
+
_getInnerText(e, t) {
|
|
1127
|
+
t = void 0 === t || t;
|
|
1128
|
+
e = e.textContent.trim();
|
|
1129
|
+
return t ? e.replace(this.REGEXPS.normalize, " ") : e;
|
|
1130
|
+
},
|
|
1131
|
+
_getCharCount(e, t) {
|
|
1132
|
+
return ((t = t || ","), this._getInnerText(e).split(t).length - 1);
|
|
1133
|
+
},
|
|
1134
|
+
_cleanStyles(e) {
|
|
1135
|
+
if (e && "svg" !== e.tagName.toLowerCase()) {
|
|
1136
|
+
for (var t = 0; t < this.PRESENTATIONAL_ATTRIBUTES.length; t++)
|
|
1137
|
+
e.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[t]);
|
|
1138
|
+
this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.includes(e.tagName) &&
|
|
1139
|
+
(e.removeAttribute("width"), e.removeAttribute("height"));
|
|
1140
|
+
for (var i = e.firstElementChild; null !== i; )
|
|
1141
|
+
(this._cleanStyles(i), (i = i.nextElementSibling));
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
_getLinkDensity(e) {
|
|
1145
|
+
var t = this._getInnerText(e).length;
|
|
1146
|
+
if (0 === t) return 0;
|
|
1147
|
+
var i = 0;
|
|
1148
|
+
return (
|
|
1149
|
+
this._forEachNode(e.getElementsByTagName("a"), function (e) {
|
|
1150
|
+
var t = e.getAttribute("href"),
|
|
1151
|
+
t = t && this.REGEXPS.hashUrl.test(t) ? 0.3 : 1;
|
|
1152
|
+
i += this._getInnerText(e).length * t;
|
|
1153
|
+
}),
|
|
1154
|
+
i / t
|
|
1155
|
+
);
|
|
1156
|
+
},
|
|
1157
|
+
_getClassWeight(e) {
|
|
1158
|
+
if (!this._flagIsActive(this.FLAG_WEIGHT_CLASSES)) return 0;
|
|
1159
|
+
var t = 0;
|
|
1160
|
+
return (
|
|
1161
|
+
"string" == typeof e.className &&
|
|
1162
|
+
"" !== e.className &&
|
|
1163
|
+
(this.REGEXPS.negative.test(e.className) && (t -= 25),
|
|
1164
|
+
this.REGEXPS.positive.test(e.className) && (t += 25)),
|
|
1165
|
+
"string" == typeof e.id &&
|
|
1166
|
+
"" !== e.id &&
|
|
1167
|
+
(this.REGEXPS.negative.test(e.id) && (t -= 25),
|
|
1168
|
+
this.REGEXPS.positive.test(e.id) && (t += 25)),
|
|
1169
|
+
t
|
|
1170
|
+
);
|
|
1171
|
+
},
|
|
1172
|
+
_clean(e, t) {
|
|
1173
|
+
var i = ["object", "embed", "iframe"].includes(t);
|
|
1174
|
+
this._removeNodes(this._getAllNodesWithTag(e, [t]), function (e) {
|
|
1175
|
+
if (i) {
|
|
1176
|
+
for (var t = 0; t < e.attributes.length; t++)
|
|
1177
|
+
if (this._allowedVideoRegex.test(e.attributes[t].value)) return !1;
|
|
1178
|
+
if ("object" === e.tagName && this._allowedVideoRegex.test(e.innerHTML))
|
|
1179
|
+
return !1;
|
|
1180
|
+
}
|
|
1181
|
+
return !0;
|
|
1182
|
+
});
|
|
1183
|
+
},
|
|
1184
|
+
_hasAncestorTag(e, t, i, a) {
|
|
1185
|
+
((i = i || 3), (t = t.toUpperCase()));
|
|
1186
|
+
for (var r = 0; e.parentNode; ) {
|
|
1187
|
+
if (0 < i && i < r) return !1;
|
|
1188
|
+
if (e.parentNode.tagName === t && (!a || a(e.parentNode))) return !0;
|
|
1189
|
+
((e = e.parentNode), r++);
|
|
1190
|
+
}
|
|
1191
|
+
return !1;
|
|
1192
|
+
},
|
|
1193
|
+
_getRowAndColumnCount(e) {
|
|
1194
|
+
for (
|
|
1195
|
+
var t = 0, i = 0, a = e.getElementsByTagName("tr"), r = 0;
|
|
1196
|
+
r < a.length;
|
|
1197
|
+
r++
|
|
1198
|
+
) {
|
|
1199
|
+
var s = a[r].getAttribute("rowspan") || 0;
|
|
1200
|
+
t += (s = s && parseInt(s, 10)) || 1;
|
|
1201
|
+
for (
|
|
1202
|
+
var n = 0, l = a[r].getElementsByTagName("td"), o = 0;
|
|
1203
|
+
o < l.length;
|
|
1204
|
+
o++
|
|
1205
|
+
) {
|
|
1206
|
+
var h = l[o].getAttribute("colspan") || 0;
|
|
1207
|
+
n += (h = h && parseInt(h, 10)) || 1;
|
|
1208
|
+
}
|
|
1209
|
+
i = Math.max(i, n);
|
|
1210
|
+
}
|
|
1211
|
+
return { rows: t, columns: i };
|
|
1212
|
+
},
|
|
1213
|
+
_markDataTables(e) {
|
|
1214
|
+
for (var t = e.getElementsByTagName("table"), i = 0; i < t.length; i++) {
|
|
1215
|
+
var a,
|
|
1216
|
+
r = t[i];
|
|
1217
|
+
"presentation" == r.getAttribute("role")
|
|
1218
|
+
? (r._readabilityDataTable = !1)
|
|
1219
|
+
: "0" == r.getAttribute("datatable")
|
|
1220
|
+
? (r._readabilityDataTable = !1)
|
|
1221
|
+
: r.getAttribute("summary") ||
|
|
1222
|
+
((a = r.getElementsByTagName("caption")[0]) &&
|
|
1223
|
+
a.childNodes.length)
|
|
1224
|
+
? (r._readabilityDataTable = !0)
|
|
1225
|
+
: ["col", "colgroup", "tfoot", "thead", "th"].some(function (e) {
|
|
1226
|
+
return !!r.getElementsByTagName(e)[0];
|
|
1227
|
+
})
|
|
1228
|
+
? (this.log("Data table because found data-y descendant"),
|
|
1229
|
+
(r._readabilityDataTable = !0))
|
|
1230
|
+
: r.getElementsByTagName("table")[0] ||
|
|
1231
|
+
1 == (a = this._getRowAndColumnCount(r)).columns ||
|
|
1232
|
+
1 == a.rows
|
|
1233
|
+
? (r._readabilityDataTable = !1)
|
|
1234
|
+
: 10 <= a.rows || 4 < a.columns
|
|
1235
|
+
? (r._readabilityDataTable = !0)
|
|
1236
|
+
: (r._readabilityDataTable = 10 < a.rows * a.columns);
|
|
1237
|
+
}
|
|
1238
|
+
},
|
|
1239
|
+
_fixLazyImages(e) {
|
|
1240
|
+
this._forEachNode(
|
|
1241
|
+
this._getAllNodesWithTag(e, ["img", "picture", "figure"]),
|
|
1242
|
+
function (e) {
|
|
1243
|
+
if (e.src && this.REGEXPS.b64DataUrl.test(e.src)) {
|
|
1244
|
+
var t = this.REGEXPS.b64DataUrl.exec(e.src);
|
|
1245
|
+
if ("image/svg+xml" === t[1]) return;
|
|
1246
|
+
for (var i = !1, a = 0; a < e.attributes.length; a++) {
|
|
1247
|
+
var r = e.attributes[a];
|
|
1248
|
+
if ("src" !== r.name && /\.(jpg|jpeg|png|webp)/i.test(r.value)) {
|
|
1249
|
+
i = !0;
|
|
1250
|
+
break;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
i &&
|
|
1254
|
+
((t = t[0].length),
|
|
1255
|
+
e.src.length - t < 133 && e.removeAttribute("src"));
|
|
1256
|
+
}
|
|
1257
|
+
if (
|
|
1258
|
+
!(e.src || (e.srcset && "null" != e.srcset)) ||
|
|
1259
|
+
e.className.toLowerCase().includes("lazy")
|
|
1260
|
+
)
|
|
1261
|
+
for (var s, n, l = 0; l < e.attributes.length; l++)
|
|
1262
|
+
"src" !== (r = e.attributes[l]).name &&
|
|
1263
|
+
"srcset" !== r.name &&
|
|
1264
|
+
"alt" !== r.name &&
|
|
1265
|
+
((s = null),
|
|
1266
|
+
/\.(jpg|jpeg|png|webp)\s+\d/.test(r.value)
|
|
1267
|
+
? (s = "srcset")
|
|
1268
|
+
: /^\s*\S+\.(jpg|jpeg|png|webp)\S*\s*$/.test(r.value) &&
|
|
1269
|
+
(s = "src"),
|
|
1270
|
+
s &&
|
|
1271
|
+
("IMG" === e.tagName || "PICTURE" === e.tagName
|
|
1272
|
+
? e.setAttribute(s, r.value)
|
|
1273
|
+
: "FIGURE" !== e.tagName ||
|
|
1274
|
+
this._getAllNodesWithTag(e, ["img", "picture"]).length ||
|
|
1275
|
+
((n = this._doc.createElement("img")).setAttribute(
|
|
1276
|
+
s,
|
|
1277
|
+
r.value,
|
|
1278
|
+
),
|
|
1279
|
+
e.appendChild(n))));
|
|
1280
|
+
},
|
|
1281
|
+
);
|
|
1282
|
+
},
|
|
1283
|
+
_getTextDensity(e, t) {
|
|
1284
|
+
var i = this._getInnerText(e, !0).length;
|
|
1285
|
+
if (0 === i) return 0;
|
|
1286
|
+
var a = 0,
|
|
1287
|
+
e = this._getAllNodesWithTag(e, t);
|
|
1288
|
+
return (
|
|
1289
|
+
this._forEachNode(e, (e) => (a += this._getInnerText(e, !0).length)),
|
|
1290
|
+
a / i
|
|
1291
|
+
);
|
|
1292
|
+
},
|
|
1293
|
+
_cleanConditionally(e, T) {
|
|
1294
|
+
this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY) &&
|
|
1295
|
+
this._removeNodes(this._getAllNodesWithTag(e, [T]), function (e) {
|
|
1296
|
+
function t(e) {
|
|
1297
|
+
return e._readabilityDataTable;
|
|
1298
|
+
}
|
|
1299
|
+
var i,
|
|
1300
|
+
a = "ul" === T || "ol" === T;
|
|
1301
|
+
if (
|
|
1302
|
+
(a ||
|
|
1303
|
+
((i = 0),
|
|
1304
|
+
(m = this._getAllNodesWithTag(e, ["ul", "ol"])),
|
|
1305
|
+
this._forEachNode(m, (e) => (i += this._getInnerText(e).length)),
|
|
1306
|
+
(a = 0.9 < i / this._getInnerText(e).length)),
|
|
1307
|
+
"table" === T && t(e))
|
|
1308
|
+
)
|
|
1309
|
+
return !1;
|
|
1310
|
+
if (this._hasAncestorTag(e, "table", -1, t)) return !1;
|
|
1311
|
+
if (this._hasAncestorTag(e, "code")) return !1;
|
|
1312
|
+
if (
|
|
1313
|
+
[...e.getElementsByTagName("table")].some(
|
|
1314
|
+
(e) => e._readabilityDataTable,
|
|
1315
|
+
)
|
|
1316
|
+
)
|
|
1317
|
+
return !1;
|
|
1318
|
+
var r = this._getClassWeight(e);
|
|
1319
|
+
this.log("Cleaning Conditionally", e);
|
|
1320
|
+
if (r + 0 < 0) return !0;
|
|
1321
|
+
if (this._getCharCount(e, ",") < 10) {
|
|
1322
|
+
for (
|
|
1323
|
+
var s = e.getElementsByTagName("p").length,
|
|
1324
|
+
n = e.getElementsByTagName("img").length,
|
|
1325
|
+
l = e.getElementsByTagName("li").length - 100,
|
|
1326
|
+
o = e.getElementsByTagName("input").length,
|
|
1327
|
+
h = this._getTextDensity(e, ["h1", "h2", "h3", "h4", "h5", "h6"]),
|
|
1328
|
+
d = 0,
|
|
1329
|
+
c = this._getAllNodesWithTag(e, ["object", "embed", "iframe"]),
|
|
1330
|
+
g = 0;
|
|
1331
|
+
g < c.length;
|
|
1332
|
+
g++
|
|
1333
|
+
) {
|
|
1334
|
+
for (var _ = 0; _ < c[g].attributes.length; _++)
|
|
1335
|
+
if (this._allowedVideoRegex.test(c[g].attributes[_].value))
|
|
1336
|
+
return !1;
|
|
1337
|
+
if (
|
|
1338
|
+
"object" === c[g].tagName &&
|
|
1339
|
+
this._allowedVideoRegex.test(c[g].innerHTML)
|
|
1340
|
+
)
|
|
1341
|
+
return !1;
|
|
1342
|
+
d++;
|
|
1343
|
+
}
|
|
1344
|
+
var m = this._getInnerText(e);
|
|
1345
|
+
if (this.REGEXPS.adWords.test(m) || this.REGEXPS.loadingWords.test(m))
|
|
1346
|
+
return !0;
|
|
1347
|
+
var u = m.length,
|
|
1348
|
+
p = this._getLinkDensity(e),
|
|
1349
|
+
m = ["SPAN", "LI", "TD"].concat(Array.from(this.DIV_TO_P_ELEMS)),
|
|
1350
|
+
N = this._getTextDensity(e, m),
|
|
1351
|
+
E = this._hasAncestorTag(e, "figure"),
|
|
1352
|
+
f = (() => {
|
|
1353
|
+
const e = [];
|
|
1354
|
+
return (
|
|
1355
|
+
!E &&
|
|
1356
|
+
1 < n &&
|
|
1357
|
+
s / n < 0.5 &&
|
|
1358
|
+
e.push(`Bad p to img ratio (img=${n}, p=${s})`),
|
|
1359
|
+
!a &&
|
|
1360
|
+
s < l &&
|
|
1361
|
+
e.push(`Too many li's outside of a list. (li=${l} > p=${s})`),
|
|
1362
|
+
o > Math.floor(s / 3) &&
|
|
1363
|
+
e.push(`Too many inputs per p. (input=${o}, p=${s})`),
|
|
1364
|
+
!a &&
|
|
1365
|
+
!E &&
|
|
1366
|
+
h < 0.9 &&
|
|
1367
|
+
u < 25 &&
|
|
1368
|
+
(0 === n || 2 < n) &&
|
|
1369
|
+
0 < p &&
|
|
1370
|
+
e.push(
|
|
1371
|
+
`Suspiciously short. (headingDensity=${h}, img=${n}, linkDensity=${p})`,
|
|
1372
|
+
),
|
|
1373
|
+
!a &&
|
|
1374
|
+
r < 25 &&
|
|
1375
|
+
p > 0.2 + this._linkDensityModifier &&
|
|
1376
|
+
e.push(`Low weight and a little linky. (linkDensity=${p})`),
|
|
1377
|
+
25 <= r &&
|
|
1378
|
+
p > 0.5 + this._linkDensityModifier &&
|
|
1379
|
+
e.push(`High weight and mostly links. (linkDensity=${p})`),
|
|
1380
|
+
((1 === d && u < 75) || 1 < d) &&
|
|
1381
|
+
e.push(
|
|
1382
|
+
`Suspicious embed. (embedCount=${d}, contentLength=${u})`,
|
|
1383
|
+
),
|
|
1384
|
+
0 === n &&
|
|
1385
|
+
0 === N &&
|
|
1386
|
+
e.push(`No useful content. (img=${n}, textDensity=${N})`),
|
|
1387
|
+
!!e.length && (this.log("Checks failed", e), !0)
|
|
1388
|
+
);
|
|
1389
|
+
})();
|
|
1390
|
+
if (a && f) {
|
|
1391
|
+
for (var b = 0; b < e.children.length; b++)
|
|
1392
|
+
if (1 < e.children[b].children.length) return f;
|
|
1393
|
+
m = e.getElementsByTagName("li").length;
|
|
1394
|
+
if (n == m) return !1;
|
|
1395
|
+
}
|
|
1396
|
+
return f;
|
|
1397
|
+
}
|
|
1398
|
+
return !1;
|
|
1399
|
+
});
|
|
1400
|
+
},
|
|
1401
|
+
_cleanMatchedNodes(e, t) {
|
|
1402
|
+
for (
|
|
1403
|
+
var i = this._getNextNode(e, !0), a = this._getNextNode(e);
|
|
1404
|
+
a && a != i;
|
|
1405
|
+
)
|
|
1406
|
+
a = t.call(this, a, a.className + " " + a.id)
|
|
1407
|
+
? this._removeAndGetNext(a)
|
|
1408
|
+
: this._getNextNode(a);
|
|
1409
|
+
},
|
|
1410
|
+
_cleanHeaders(e) {
|
|
1411
|
+
e = this._getAllNodesWithTag(e, ["h1", "h2"]);
|
|
1412
|
+
this._removeNodes(e, function (e) {
|
|
1413
|
+
var t = this._getClassWeight(e) < 0;
|
|
1414
|
+
return (t && this.log("Removing header with low class weight:", e), t);
|
|
1415
|
+
});
|
|
1416
|
+
},
|
|
1417
|
+
_headerDuplicatesTitle(e) {
|
|
1418
|
+
if ("H1" != e.tagName && "H2" != e.tagName) return !1;
|
|
1419
|
+
e = this._getInnerText(e, !1);
|
|
1420
|
+
return (
|
|
1421
|
+
this.log("Evaluating similarity of header:", e, this._articleTitle),
|
|
1422
|
+
0.75 < this._textSimilarity(this._articleTitle, e)
|
|
1423
|
+
);
|
|
1424
|
+
},
|
|
1425
|
+
_flagIsActive(e) {
|
|
1426
|
+
return 0 < (this._flags & e);
|
|
1427
|
+
},
|
|
1428
|
+
_removeFlag(e) {
|
|
1429
|
+
this._flags = this._flags & ~e;
|
|
1430
|
+
},
|
|
1431
|
+
_isProbablyVisible(e) {
|
|
1432
|
+
return (
|
|
1433
|
+
(!e.style || "none" != e.style.display) &&
|
|
1434
|
+
(!e.style || "hidden" != e.style.visibility) &&
|
|
1435
|
+
!e.hasAttribute("hidden") &&
|
|
1436
|
+
(!e.hasAttribute("aria-hidden") ||
|
|
1437
|
+
"true" != e.getAttribute("aria-hidden") ||
|
|
1438
|
+
(e.className &&
|
|
1439
|
+
e.className.includes &&
|
|
1440
|
+
e.className.includes("fallback-image")))
|
|
1441
|
+
);
|
|
1442
|
+
},
|
|
1443
|
+
parse() {
|
|
1444
|
+
if (0 < this._maxElemsToParse) {
|
|
1445
|
+
var e = this._doc.getElementsByTagName("*").length;
|
|
1446
|
+
if (e > this._maxElemsToParse)
|
|
1447
|
+
throw new Error("Aborting parsing document; " + e + " elements found");
|
|
1448
|
+
}
|
|
1449
|
+
this._unwrapNoscriptImages(this._doc);
|
|
1450
|
+
var e = this._disableJSONLD ? {} : this._getJSONLD(this._doc),
|
|
1451
|
+
e =
|
|
1452
|
+
(this._removeScripts(this._doc),
|
|
1453
|
+
this._prepDocument(),
|
|
1454
|
+
this._getArticleMetadata(e)),
|
|
1455
|
+
t =
|
|
1456
|
+
((this._metadata = e),
|
|
1457
|
+
(this._articleTitle = e.title),
|
|
1458
|
+
this._grabArticle());
|
|
1459
|
+
if (!t) return null;
|
|
1460
|
+
(this.log("Grabbed: " + t.innerHTML),
|
|
1461
|
+
this._postProcessContent(t),
|
|
1462
|
+
e.excerpt ||
|
|
1463
|
+
((i = t.getElementsByTagName("p")).length &&
|
|
1464
|
+
(e.excerpt = i[0].textContent.trim())));
|
|
1465
|
+
var i = t.textContent;
|
|
1466
|
+
return {
|
|
1467
|
+
title: this._articleTitle,
|
|
1468
|
+
byline: e.byline || this._articleByline,
|
|
1469
|
+
dir: this._articleDir,
|
|
1470
|
+
lang: this._articleLang,
|
|
1471
|
+
content: this._serializer(t),
|
|
1472
|
+
textContent: i,
|
|
1473
|
+
length: i.length,
|
|
1474
|
+
excerpt: e.excerpt,
|
|
1475
|
+
siteName: e.siteName || this._articleSiteName,
|
|
1476
|
+
publishedTime: e.publishedTime,
|
|
1477
|
+
};
|
|
1478
|
+
},
|
|
1479
|
+
}),
|
|
1480
|
+
"object" == typeof module && (module.exports = Readability));
|