// Terms of Service and Privacy Policy. Body items: a string is a paragraph, { h } is a subheading,
// { list: [...] } is a bulleted list; a list item written as [label, text] shows the label in bold.
const LEGAL_CONTACT = { body: ['OneCloud Networks LLC', 'Plano, Texas'], contact: true };
const LEGAL = {
  terms: {
    title: 'Terms of Service', updated: 'April 3, 2026',
    sections: [
      ['Acceptance of Terms', ['By accessing or using services provided by OneCloud Networks LLC (“OneCloud Networks,” “we,” “us,” or “our”), including our website at onecloudnetworks.com, our AI Receptionist platform, and our social media management application OCN Social Poster, you agree to be bound by these Terms of Service (“Terms”). If you do not agree to these Terms, please do not use our services.']],
      ['Description of Services', ['OneCloud Networks provides telecommunications, VoIP, and AI-powered business communication services to small and medium-sized businesses. Our services include:', { list: [
        ['AI Receptionist', 'An AI-powered phone answering service that handles calls, books appointments, answers FAQs, and routes urgent calls for businesses.'],
        ['OCN Social Poster', 'A social media content management and publishing application that enables businesses to create, schedule, and publish content across multiple social media platforms, including but not limited to Facebook, Instagram, TikTok, and YouTube. OCN Social Poster uses authorized APIs provided by each platform to publish content on behalf of authenticated users.'],
        ['VoIP and Telecom Services', 'Business phone systems, number management, and related telecommunications services.']] }]],
      ['User Accounts and Authentication', ['To use certain features of our services, including OCN Social Poster, you may be required to authenticate with third-party platforms (such as TikTok, Facebook, Instagram, or YouTube) using their official login and authorization mechanisms. By authenticating, you grant OneCloud Networks permission to publish content to your connected social media accounts on your behalf, in accordance with the permissions you approve during the authorization process.']],
      ['User Responsibilities', ['You agree to:', { list: ['Provide accurate and complete information when using our services', 'Maintain the security of your account credentials', 'Comply with all applicable laws and regulations', 'Not use our services for any unlawful, harmful, or prohibited purpose', 'Not publish content that violates any third-party platform’s community guidelines or terms of service', 'Take responsibility for all content published through OCN Social Poster on your connected accounts'] }]],
      ['Content Ownership', ['You retain ownership of all content you create and publish through our services, including OCN Social Poster. By using our publishing tools, you grant OneCloud Networks a limited license to transmit and display your content solely for the purpose of delivering the service (i.e., publishing to your designated social media accounts).']],
      ['Third-Party Platform Terms', ['When using OCN Social Poster to publish content to third-party platforms such as TikTok, Facebook, Instagram, or YouTube, you must also comply with those platforms’ respective terms of service and community guidelines. OneCloud Networks is not responsible for any actions taken by third-party platforms regarding your content or account.']],
      ['Intellectual Property', ['All intellectual property rights in our services, including software, designs, trademarks, and documentation, remain the property of OneCloud Networks LLC. You may not copy, modify, distribute, or reverse engineer any part of our services without prior written consent.']],
      ['Limitation of Liability', ['To the maximum extent permitted by law, OneCloud Networks shall not be liable for any indirect, incidental, special, consequential, or punitive damages arising out of or related to your use of our services. Our total liability shall not exceed the amount you paid for the services in the twelve (12) months preceding the claim.']],
      ['Service Availability', ['We strive to maintain high availability of our services but do not guarantee uninterrupted access. We reserve the right to modify, suspend, or discontinue any part of our services at any time with reasonable notice.']],
      ['Termination', ['Either party may terminate the use of services at any time. Upon termination, your right to use our services ceases immediately. We may terminate or suspend your access if you violate these Terms.']],
      ['Privacy', [{ privacyLink: true }]],
      ['Governing Law', ['These Terms shall be governed by and construed in accordance with the laws of the State of Texas, without regard to its conflict of law provisions. Any disputes shall be resolved in the courts of Collin County, Texas.']],
      ['Changes to Terms', ['We may update these Terms from time to time. We will notify users of material changes by posting the updated Terms on our website. Your continued use of our services after such changes constitutes acceptance of the updated Terms.']],
      ['Contact Information', ['If you have any questions about these Terms of Service, please contact us:', LEGAL_CONTACT]],
    ],
  },
  privacy: {
    title: 'Privacy Policy', updated: 'April 3, 2026',
    sections: [
      ['Introduction', ['OneCloud Networks LLC ("OneCloud Networks," "we," "us," or "our") is committed to protecting the privacy of our users. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use our services, including our website at onecloudnetworks.com, our AI Receptionist platform, and our social media management application OCN Social Poster.', 'By using our services, you consent to the data practices described in this Privacy Policy.']],
      ['Information We Collect', [{ h: '2.1 Information You Provide' }, 'When you use our services, including OCN Social Poster, we may collect:', { list: [
        ['Account Information', 'Your name, email address, phone number, and business information provided during registration or contact form submissions.'],
        ['Authentication Data', 'When you connect third-party social media accounts (such as TikTok, Facebook, Instagram, or YouTube) to OCN Social Poster, we receive and store OAuth tokens that allow us to publish content on your behalf. We do not store your social media passwords.'],
        ['Content Data', 'Social media posts, images, captions, and scheduling preferences you create through OCN Social Poster for publishing to your connected platforms.'],
        ['Communication Data', 'Information from calls handled by our AI Receptionist, including caller information and call logs.']] },
        { h: '2.2 Information Collected Automatically' }, { list: [
        ['Usage Data', 'Information about how you interact with our services, including pages visited, features used, and timestamps.'],
        ['Device Information', 'Browser type, operating system, IP address, and device identifiers.'],
        ['Analytics Data', 'We use Google Analytics (GA4) to understand website traffic and user behavior.']] }]],
      ['How We Use Your Information', ['We use the information we collect to:', { list: ['Provide, operate, and maintain our services, including publishing content through OCN Social Poster to your connected social media accounts', 'Process and manage your AI Receptionist call handling', 'Communicate with you about your account, services, and support requests', 'Improve and optimize our services and user experience', 'Comply with legal obligations and protect our rights'] }]],
      ['How We Share Your Information', ['We do not sell your personal information. We may share your information in the following circumstances:', { list: [
        ['Third-Party Platforms', 'When you use OCN Social Poster to publish content, we transmit your content to the social media platforms you have authorized (e.g., TikTok, Facebook, Instagram, YouTube) via their official APIs.'],
        ['Service Providers', 'We may share information with trusted third-party service providers who assist us in operating our services, such as cloud hosting providers, analytics services, and API providers.'],
        ['Legal Requirements', 'We may disclose information if required by law, regulation, legal process, or governmental request.'],
        ['Business Transfers', 'In the event of a merger, acquisition, or sale of assets, your information may be transferred as part of the transaction.']] }]],
      ['Data Security', ['We implement appropriate technical and organizational measures to protect your personal information against unauthorized access, alteration, disclosure, or destruction. This includes encryption of data in transit, secure storage of authentication tokens, and regular security reviews.']],
      ['Data Retention', ['We retain your information for as long as necessary to provide our services and fulfill the purposes described in this Privacy Policy. When you disconnect a social media account from OCN Social Poster, we delete the associated OAuth tokens. You may request deletion of your account and associated data at any time by contacting us.']],
      ['Your Rights', ['Depending on your jurisdiction, you may have the following rights regarding your personal information:', { list: ['Access and receive a copy of your personal data', 'Correct inaccurate or incomplete data', 'Request deletion of your personal data', 'Object to or restrict the processing of your data', 'Withdraw consent at any time', 'Revoke OCN Social Poster\'s access to your social media accounts at any time through the respective platform\'s settings'] }]],
      ['Third-Party Links and Services', ['Our services may contain links to third-party websites or integrate with third-party platforms. We are not responsible for the privacy practices of these third parties. We encourage you to review the privacy policies of any third-party services you connect to through our platform.']],
      ["Children's Privacy", ['Our services are not intended for individuals under the age of 13. We do not knowingly collect personal information from children under 13. If we become aware that we have collected such information, we will take steps to delete it promptly.']],
      ['Changes to This Privacy Policy', ['We may update this Privacy Policy from time to time. We will notify you of material changes by posting the updated policy on our website with a revised "Last updated" date. Your continued use of our services after such changes constitutes acceptance of the updated Privacy Policy.']],
      ['Contact Us', ['If you have any questions about this Privacy Policy or our data practices, please contact us:', LEGAL_CONTACT]],
    ],
  },
};
const LEGAL_EMAIL = 'sales@onecloudnetworks.com';
const legalId = (n, t) => 's' + (n + 1) + '-' + t.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/-$/, '');

function LegalBlock({ b, go }) {
  if (typeof b === 'string') return <p>{b}</p>;
  if (b.h) return <h3>{b.h}</h3>;
  if (b.list) return <ul>{b.list.map(it => Array.isArray(it) ? <li key={it[0]}><strong>{it[0]}:</strong> {it[1]}</li> : <li key={it}>{it}</li>)}</ul>;
  if (b.privacyLink) return <p>Your use of our services is also governed by our <a href={pathFor('privacy')} onClick={e => { e.preventDefault(); go('privacy'); }}>Privacy Policy</a>, which describes how we collect, use, and protect your information.</p>;
  if (b.contact) return <address className="legal-contact">{b.body.map(l => <span key={l}>{l}</span>)}<span>Phone: <a href={TEL} className="num">(877) 774-1777</a></span><span>Email: <a href={'mailto:' + LEGAL_EMAIL}>{LEGAL_EMAIL}</a></span><span>Website: <a href="https://onecloudnetworks.com/" target="_blank" rel="noopener">onecloudnetworks.com</a></span></address>;
  return null;
}

function LegalScreen({ doc, go }) {
  const d = LEGAL[doc]; const ids = d.sections.map(([t], n) => legalId(n, t));
  const [cur, setCur] = React.useState(ids[0]);
  // Highlight the section being read in the contents list
  React.useEffect(() => {
    const els = ids.map(id => document.getElementById(id)).filter(Boolean);
    const seen = new Set();
    const io = new IntersectionObserver(es => { es.forEach(e => e.isIntersecting ? seen.add(e.target.id) : seen.delete(e.target.id)); const first = ids.find(id => seen.has(id)); if (first) setCur(first); }, { rootMargin: '-96px 0px -65% 0px' });
    els.forEach(el => io.observe(el)); return () => io.disconnect();
  }, [doc]);
  const jump = (e, id) => { e.preventDefault(); const el = document.getElementById(id); if (el) window.scrollTo({ top: el.getBoundingClientRect().top + window.scrollY - 96, behavior: 'smooth' }); setCur(id); };
  return <>
    <section className="legal-head"><Container><div className="reveal"><p className="caption">Legal</p><h1>{d.title}</h1><p>Last updated: {d.updated}</p></div></Container></section>
    <Container><div className="legal">
      <nav className="legal-toc" aria-label={d.title + ' contents'}><p className="caption">On this page</p><ol>{d.sections.map(([t], n) => <li key={t}><a href={'#' + ids[n]} aria-current={cur === ids[n] ? 'true' : undefined} onClick={e => jump(e, ids[n])}><span className="num">{n + 1}.</span>{t}</a></li>)}</ol>
        <p className="legal-other">{doc === 'terms' ? <a href={pathFor('privacy')} onClick={e => { e.preventDefault(); go('privacy'); }}>Read the Privacy Policy</a> : <a href={pathFor('terms')} onClick={e => { e.preventDefault(); go('terms'); }}>Read the Terms of Service</a>}</p></nav>
      <article className="legal-body">{d.sections.map(([t, body], n) => <section key={t} id={ids[n]} aria-labelledby={ids[n] + '-h'}><h2 id={ids[n] + '-h'}><span className="num">{n + 1}.</span> {t}</h2>{body.map((b, j) => <LegalBlock key={j} b={b} go={go} />)}</section>)}</article>
    </div></Container>
  </>;
}
const TermsScreen = props => <LegalScreen doc="terms" {...props} />;
const PrivacyScreen = props => <LegalScreen doc="privacy" {...props} />;
Object.assign(window, { TermsScreen, PrivacyScreen });
