const CACHE_NAME = "posthog-handbook-2026-05-04-f787d34bec9c";
const CORE_PATHS = [
  "./",
  "index.html",
  "company.html",
  "print.html",
  "changes.html",
  "changes.md",
  "manifest.json",
  "search-index.json",
  "site.webmanifest?v=f787d34bec9c",
  "offline.html",
  "assets/library.css?v=f787d34bec9c",
  "assets/search.js?v=f787d34bec9c",
  "assets/reader.js?v=f787d34bec9c",
  "assets/icon.svg?v=f787d34bec9c",
  "sections/brand.html",
  "sections/community.html",
  "sections/company.html",
  "sections/content.html",
  "sections/cs-and-onboarding.html",
  "sections/docs-and-wizard.html",
  "sections/engineering.html",
  "sections/exec.html",
  "sections/getting-started.html",
  "sections/growth.html",
  "sections/root.html",
  "sections/marketing.html",
  "sections/onboarding.html",
  "sections/people.html",
  "sections/product.html",
  "sections/strategy.html",
  "sections/support.html",
  "pages/brand-art-requests.html",
  "pages/brand-designing-posthog-website.html",
  "pages/brand-email-comms.html",
  "pages/brand-in-app.html",
  "pages/brand-overview.html",
  "pages/brand-partners.html",
  "pages/brand-philosophy.html",
  "pages/brand-press.html",
  "pages/brand-startups.html",
  "pages/brand-style-guide.html",
  "pages/brand-testimonials.html",
  "pages/community-index.html",
  "pages/community-points.html",
  "pages/community-profiles.html",
  "pages/community-questions.html",
  "pages/company-snippets-soc2.html",
  "pages/company-adding-tools.html",
  "pages/company-brand-assets.html",
  "pages/company-communication.html",
  "pages/company-culture.html",
  "pages/company-do-more-weird.html",
  "pages/company-fuzzy-ownership.html",
  "pages/company-goal-setting.html",
  "pages/company-grown-ups.html",
  "pages/company-kudos.html",
  "pages/company-lore.html",
  "pages/company-management.html",
  "pages/company-merch-store.html",
  "pages/company-new-to-github.html",
  "pages/company-offsites.html",
  "pages/company-post-mortems-2025-09-29-flags-is-down.html",
  "pages/company-post-mortems-2025-10-03-surveys-sdk-bug.html",
  "pages/company-post-mortems-2025-10-21-feature-flags-recurring-outages.html",
  "pages/company-post-mortems-2025-11-15-persons-db-migration.html",
  "pages/company-post-mortems-2025-11-26-shai-hulud-attack.html",
  "pages/company-post-mortems-2026-01-17-replay-sdk-fetch-wrapper-incident.html",
  "pages/company-post-mortems-2026-02-06-feature-flags-cache-degradation.html",
  "pages/company-post-mortems-2026-02-20-posthog-us-logs-data-loss.html",
  "pages/company-post-mortems-2026-04-27-workflow-wait-until-condition.html",
  "pages/company-post-mortems-index.html",
  "pages/company-security-advisories.html",
  "pages/company-security.html",
  "pages/company-small-teams.html",
  "pages/company-sprints.html",
  "pages/company-team-changes.html",
  "pages/content-snippets-list-no-nextline-md.html",
  "pages/content-snippets-list-no-nextline.html",
  "pages/content-snippets-list-with-nextline-md.html",
  "pages/content-snippets-list-with-nextline.html",
  "pages/content-brand-message.html",
  "pages/content-index.html",
  "pages/content-linkedin.html",
  "pages/content-metadata.html",
  "pages/content-newsletter-ads.html",
  "pages/content-newsletter-tips.html",
  "pages/content-newsletter.html",
  "pages/content-posthog-style-guide.html",
  "pages/content-screen-recording-guide.html",
  "pages/content-seo-guide.html",
  "pages/content-youtube.html",
  "pages/cs-and-onboarding-churn-reasons.html",
  "pages/cs-and-onboarding-customer-churn-retros.html",
  "pages/cs-and-onboarding-customer-industry-segments.html",
  "pages/cs-and-onboarding-customer-success.html",
  "pages/cs-and-onboarding-feature-requests.html",
  "pages/cs-and-onboarding-foundation-check.html",
  "pages/cs-and-onboarding-getting-started-with-customers.html",
  "pages/cs-and-onboarding-handling-customer-issues.html",
  "pages/cs-and-onboarding-health-checks.html",
  "pages/cs-and-onboarding-health-tracking.html",
  "pages/cs-and-onboarding-how-we-use-automation.html",
  "pages/cs-and-onboarding-how-we-work.html",
  "pages/cs-and-onboarding-lifecycle-csm.html",
  "pages/cs-and-onboarding-new-hire-onboarding-exercise.html",
  "pages/cs-and-onboarding-new-hire-onboarding.html",
  "pages/cs-and-onboarding-onboarding-success-plan.html",
  "pages/cs-and-onboarding-renewals.html",
  "pages/docs-and-wizard-snippets-hogref-schema.html",
  "pages/docs-and-wizard-api-specifications.html",
  "pages/docs-and-wizard-changelog.html",
  "pages/docs-and-wizard-content-writer-agent.html",
  "pages/docs-and-wizard-context-mill.html",
  "pages/docs-and-wizard-developing-the-wizard.html",
  "pages/docs-and-wizard-docs-ownership.html",
  "pages/docs-and-wizard-docs-style-guide.html",
  "pages/docs-and-wizard-how-to-publish-changelog.html",
  "pages/docs-and-wizard-index.html",
  "pages/docs-and-wizard-mdx-and-components.html",
  "pages/docs-and-wizard-onboarding-docs.html",
  "pages/docs-and-wizard-sdk-reference-docs.html",
  "pages/docs-and-wizard-vale.html",
  "pages/docs-and-wizard-writing-product-docs.html",
  "pages/engineering-ai-ai-platform.html",
  "pages/engineering-ai-architecture.html",
  "pages/engineering-ai-implementation.html",
  "pages/engineering-ai-products.html",
  "pages/engineering-ai-team-structure.html",
  "pages/engineering-bug-prioritization.html",
  "pages/engineering-clickhouse-clusters.html",
  "pages/engineering-clickhouse-data-ingestion.html",
  "pages/engineering-clickhouse-data-storage.html",
  "pages/engineering-clickhouse-dictionaries.html",
  "pages/engineering-clickhouse-index.html",
  "pages/engineering-clickhouse-operations.html",
  "pages/engineering-clickhouse-performance.html",
  "pages/engineering-clickhouse-query-attribution.html",
  "pages/engineering-clickhouse-schema-app-metrics.html",
  "pages/engineering-clickhouse-schema-index.html",
  "pages/engineering-clickhouse-schema-person-distinct-id.html",
  "pages/engineering-clickhouse-schema-sharded-events.html",
  "pages/engineering-clickhouse-working-with-json.html",
  "pages/engineering-cloud-providers.html",
  "pages/engineering-conventions-scripts.html",
  "pages/engineering-customer-comms.html",
  "pages/engineering-deployments-support.html",
  "pages/engineering-developer-experience.html",
  "pages/engineering-development-process.html",
  "pages/engineering-feature-ownership.html",
  "pages/engineering-feature-pricing.html",
  "pages/engineering-how-to-access-posthog-cloud-infra.html",
  "pages/engineering-how-we-review.html",
  "pages/engineering-operations-incidents.html",
  "pages/engineering-operations-on-call-rotation.html",
  "pages/engineering-operations-post-mortems.html",
  "pages/engineering-operations-support-hero.html",
  "pages/engineering-posthog-com-add-team-member.html",
  "pages/engineering-posthog-com-api-docs.html",
  "pages/engineering-posthog-com-assets.html",
  "pages/engineering-posthog-com-changelog.html",
  "pages/engineering-posthog-com-cool-tech-jobs.html",
  "pages/engineering-posthog-com-developing-the-website.html",
  "pages/engineering-posthog-com-how-posthog-website-works.html",
  "pages/engineering-posthog-com-jobs.html",
  "pages/engineering-posthog-com-markdown.html",
  "pages/engineering-posthog-com-mdx-setup.html",
  "pages/engineering-posthog-com-merch-store.html",
  "pages/engineering-posthog-com-overview.html",
  "pages/engineering-posthog-com-presentations.html",
  "pages/engineering-posthog-com-product-comparisons.html",
  "pages/engineering-posthog-com-roadmap.html",
  "pages/engineering-posthog-com-small-teams.html",
  "pages/engineering-posthog-com-technical-architecture.html",
  "pages/engineering-product-design-process.html",
  "pages/engineering-product-design.html",
  "pages/engineering-product-engineering.html",
  "pages/engineering-revenue-and-forecasting.html",
  "pages/engineering-sdks-guidelines.html",
  "pages/engineering-sdks-index.html",
  "pages/engineering-sdks-releases.html",
  "pages/engineering-sdks-support-rotation.html",
  "pages/engineering-security.html",
  "pages/engineering-session-replay-session-replay-architecture.html",
  "pages/engineering-tech-talks.html",
  "pages/engineering-usage-reports.html",
  "pages/engineering-visiting-customers.html",
  "pages/engineering-working-with-max-ai.html",
  "pages/engineering-writing-docs.html",
  "pages/exec-all-hands-topics.html",
  "pages/exec-annual-planning.html",
  "pages/exec-responsibilities.html",
  "pages/finance.html",
  "pages/future.html",
  "pages/getting-started-meetings.html",
  "pages/growth-billing-customer-billing-configurations.html",
  "pages/growth-cross-selling-cross-sell-motions.html",
  "pages/growth-cross-selling-error-tracking-cross-sell.html",
  "pages/growth-cross-selling-how-we-upsell-and-cross-sell.html",
  "pages/growth-cross-selling-tracking-cross-sells.html",
  "pages/growth-growth-engineering-growth-sessions.html",
  "pages/growth-growth-engineering-per-product-activation.html",
  "pages/growth-growth-engineering-product-intents.html",
  "pages/growth-revops-credits.html",
  "pages/growth-revops-lead-assignment-ooo.html",
  "pages/growth-revops-lifecycle-analysis.html",
  "pages/growth-revops-overview.html",
  "pages/growth-revops-retention-metrics.html",
  "pages/growth-revops-revenue-adjustments.html",
  "pages/growth-sales-account-allocation.html",
  "pages/growth-sales-account-planning.html",
  "pages/growth-sales-accounts-overview.html",
  "pages/growth-sales-automations.html",
  "pages/growth-sales-billing.html",
  "pages/growth-sales-communications-templates-feature-adoption.html",
  "pages/growth-sales-communications-templates-fundraising.html",
  "pages/growth-sales-communications-templates-incidents.html",
  "pages/growth-sales-communications-templates.html",
  "pages/growth-sales-contract-rules.html",
  "pages/growth-sales-contracts.html",
  "pages/growth-sales-crm.html",
  "pages/growth-sales-csm-tam-overlay-coverage.html",
  "pages/growth-sales-customer-faqs.html",
  "pages/growth-sales-customer-onboarding.html",
  "pages/growth-sales-customer-onsites.html",
  "pages/growth-sales-customer-training.html",
  "pages/growth-sales-expansion-and-retention.html",
  "pages/growth-sales-expansion-strategies.html",
  "pages/growth-sales-getting-people-to-talk-to-you.html",
  "pages/growth-sales-historical-import.html",
  "pages/growth-sales-how-to-do-discovery.html",
  "pages/growth-sales-how-we-work.html",
  "pages/growth-sales-lead-scoring.html",
  "pages/growth-sales-new-hire-onboarding.html",
  "pages/growth-sales-new-sales.html",
  "pages/growth-sales-outbound-sales.html",
  "pages/growth-sales-overview.html",
  "pages/growth-sales-product-enablement.html",
  "pages/growth-sales-product-led-lead-qualification.html",
  "pages/growth-sales-product-led-sales.html",
  "pages/growth-sales-professional-services.html",
  "pages/growth-sales-refunds.html",
  "pages/growth-sales-risk-mitigation-and-churn-prevention.html",
  "pages/growth-sales-running-trials.html",
  "pages/growth-sales-sales-and-cs-tools.html",
  "pages/growth-sales-sales-operations.html",
  "pages/growth-sales-selling-via-aws.html",
  "pages/growth-sales-slack-channels.html",
  "pages/growth-sales-tam-excellence.html",
  "pages/growth-sales-team-leads.html",
  "pages/growth-sales-trials.html",
  "pages/growth-sales-turning-knowledge-into-agent-skills.html",
  "pages/growth-sales-user-event-streams.html",
  "pages/growth-sales-utilization-by-business-type.html",
  "pages/growth-sales-who-we-do-business-with.html",
  "pages/growth-sales-why-buy-posthog.html",
  "pages/growth-use-case-selling-ai-llm-observability.html",
  "pages/growth-use-case-selling-customer-experience.html",
  "pages/growth-use-case-selling-data-infrastructure.html",
  "pages/growth-use-case-selling-growth-and-marketing.html",
  "pages/growth-use-case-selling-observability.html",
  "pages/growth-use-case-selling-product-intelligence.html",
  "pages/growth-use-case-selling-release-engineering.html",
  "pages/growth-use-case-selling-use-case-selling.html",
  "pages/help.html",
  "pages/how-we-get-users.html",
  "pages/how-we-make-money.html",
  "pages/low-prices.html",
  "pages/making-users-happy.html",
  "pages/marketing-campaigns-and-coupons.html",
  "pages/marketing-co-marketing.html",
  "pages/marketing-customer-case-studies.html",
  "pages/marketing-events.html",
  "pages/marketing-exporting-blog-post-image.html",
  "pages/marketing-incident-comms.html",
  "pages/marketing-index.html",
  "pages/marketing-influencers.html",
  "pages/marketing-open-source-sponsorship.html",
  "pages/marketing-ownership.html",
  "pages/marketing-paid.html",
  "pages/marketing-positioning.html",
  "pages/marketing-product-announcements.html",
  "pages/marketing-speaker-guide.html",
  "pages/marketing-templates.html",
  "pages/marketing-video.html",
  "pages/marketing-working-with-website.html",
  "pages/onboarding-chrome-extension-billing-case-study-wildfire.html",
  "pages/onboarding-metabase-account-analysis.html",
  "pages/onboarding-new-hire-onboarding.html",
  "pages/onboarding-onboarding-conversations-playbook.html",
  "pages/onboarding-onboarding-data.html",
  "pages/onboarding-onboarding-program.html",
  "pages/onboarding-onboarding-team.html",
  "pages/onboarding-onboarding-tracking.html",
  "pages/onboarding-sales-handover.html",
  "pages/people-benefits.html",
  "pages/people-bookhog.html",
  "pages/people-career-progression.html",
  "pages/people-compensation.html",
  "pages/people-feedback.html",
  "pages/people-finance.html",
  "pages/people-grievances.html",
  "pages/people-hiring-process-design-hiring.html",
  "pages/people-hiring-process-devrel-hiring.html",
  "pages/people-hiring-process-engineering-hiring.html",
  "pages/people-hiring-process-engineering-superday.html",
  "pages/people-hiring-process-engineering-tech-screen.html",
  "pages/people-hiring-process-exec-hiring.html",
  "pages/people-hiring-process-how-to-interview.html",
  "pages/people-hiring-process-index.html",
  "pages/people-hiring-process-marketing-hiring.html",
  "pages/people-hiring-process-operations-hiring.html",
  "pages/people-hiring-process-sales-cs-hiring.html",
  "pages/people-hogpatch-operations.html",
  "pages/people-hogpatch.html",
  "pages/people-offboarding.html",
  "pages/people-onboarding.html",
  "pages/people-overview.html",
  "pages/people-philosophy-club.html",
  "pages/people-ramp-up-product-manager.html",
  "pages/people-share-options.html",
  "pages/people-side-gigs.html",
  "pages/people-spending-money.html",
  "pages/people-talent.html",
  "pages/people-time-off.html",
  "pages/people-training.html",
  "pages/product-metrics.html",
  "pages/product-per-product-cost-margin-analysis.html",
  "pages/product-per-product-growth-reviews.html",
  "pages/product-prioritizing-work-for-mature-products.html",
  "pages/product-product-manager-hiring.html",
  "pages/product-product-manager-role.html",
  "pages/product-product-team.html",
  "pages/product-releasing-new-products-and-features.html",
  "pages/product-user-feedback.html",
  "pages/product-visiting-customers.html",
  "pages/story.html",
  "pages/strategy-brand.html",
  "pages/strong-team.html",
  "pages/support-customer-support.html",
  "pages/support-support-incident-response.html",
  "pages/support-support-smes.html",
  "pages/support-support-team.html",
  "pages/support-support-zero.html",
  "pages/support-troubleshooting-tips.html",
  "pages/values.html",
  "pages/which-products.html",
  "pages/who-we-build-for.html",
  "pages/why-does-posthog-exist.html",
  "pages/wide-company.html",
  "pages/world-class-engineering.html"
];

self.addEventListener("install", (event) => {
  event.waitUntil(
    caches.open(CACHE_NAME)
      .then((cache) => cache.addAll(CORE_PATHS.map((item) => new URL(item, self.registration.scope).href)))
      .then(() => self.skipWaiting())
  );
});

self.addEventListener("activate", (event) => {
  event.waitUntil(
    caches.keys()
      .then((names) => Promise.all(names.filter((name) => name.startsWith("posthog-handbook-") && name !== CACHE_NAME).map((name) => caches.delete(name))))
      .then(() => self.clients.claim())
  );
});

self.addEventListener("fetch", (event) => {
  const request = event.request;
  if (request.method !== "GET") return;
  const url = new URL(request.url);
  if (url.origin !== self.location.origin) return;
  event.respondWith(
    fetch(request)
      .then((response) => {
        const copy = response.clone();
        caches.open(CACHE_NAME).then((cache) => cache.put(request, copy));
        return response;
      })
      .catch(() => caches.match(request).then((cached) => cached || caches.match(new URL("offline.html", self.registration.scope).href)))
  );
});
