PageSourceSearch

https://all-electric-homes-portal.web.app/assets/discProfileTool-DnF2R6cL.js

js all-electric-homes-portal.web.app collected 2026-10-03 12:16:23 UTC 33,438 bytes, 161 lines download raw bytes

1import{c as M,a as P,b as W,D as S,d as x,e as A,f as V}from"./main-DXqI6h1S.js";import"./index-D8NYs8V2.js";import"./currentProjectsUi-BtYeDruH.js";import"./customerAssessmentModel-B2h702h_.js";const g={D:{name:"Dominance",short:"Decisive, direct and outcome-focused",strengths:["Moves quickly toward outcomes","Takes ownership when the path is unclear","Challenges barriers and keeps momentum"],needs:["Clear authority and decision boundaries","Concise evidence and visible progress","Room to solve problems without unnecessary delay"],pressure:"May become blunt, impatient or too quick to decide.",communicate:"Lead with the outcome, state the key evidence, and be explicit about the decision required.",growth:"Pause for stakeholder input, show the reasoning, and make space for quieter expertise."},I:{name:"Influence",short:"Optimistic, persuasive and relationship-led",strengths:["Builds energy and engagement","Connects people around an idea","Communicates with warmth and optimism"],needs:["Interaction, recognition and visible enthusiasm","A chance to talk ideas through","Simple follow-up structures that preserve momentum"],pressure:"May over-promise, lose detail or seek agreement too quickly.",communicate:"Start with the people impact, invite discussion, then confirm owners, dates and written next steps.",growth:"Slow down for detail, test assumptions, and close the loop in writing."},S:{name:"Steadiness",short:"Patient, dependable and supportive",strengths:["Creates trust and consistency","Listens carefully and supports others","Keeps routines and commitments stable"],needs:["Predictability and respectful change","Time to process and ask questions","A cooperative environment with clear expectations"],pressure:"May avoid conflict, defer difficult decisions or absorb too much work.",communicate:"Give context, explain what will stay stable, allow time for questions, and avoid manufactured urgency.",growth:"Surface concerns earlier, practise direct requests, and set firmer boundaries."},C:{name:"Conscientiousness",short:"Analytical, careful and quality-focused",strengths:["Protects quality and accuracy","Finds risks before they become problems","Builds repeatable, evidence-based processes"],needs:["Clear standards and complete information","Time for analysis and verification","Logical decisions with documented rationale"],pressure:"May over-analyse, become overly critical or delay while seeking certainty.",communicate:"Provide facts, criteria and constraints; separate knowns from assumptions; and allow time for review.",growth:"Define what is good enough, time-box analysis, and share early drafts rather than waiting for perfection."}};function a(t=""){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function _(t=""){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?a(t):new Intl.DateTimeFormat("en-AU",{dateStyle:"medium",timeStyle:"short"}).format(s)}async function U(t){return typeof(t==null?void 0:t.authStateReady)=="function"&&await t.authStateReady(),t!=null&&t.currentUser?t.currentUser.getIdToken():""}async function k(t,{auth:s=null,method:e="GET",body:i=null,requireAuth:n=!1,includeAuth:o=!1,idempotencyKey:r="",apiBase:d=S}={}){const c={Accept:"application/json"};if(i&&(c["Content-Type"]="application/json"),P){const l=await W(P,!1);l!=null&&l.token&&(c["X-Firebase-AppCheck"]=l.token)}if(r&&(c["X-Idempotency-Key"]=r),n||o){const l=await U(s);if(n&&!l)throw new Error("Admin or manager sign-in is required for this action.");l&&(c.Authorization=`Bearer ${l}`)}const u=await fetch(`${d}${t}`,{method:e,headers:c,body:i?JSON.stringify(i):void 0}),h=await u.json().catch(()=>({}));if(!u.ok||h.ok===!1)throw new Error(h.error||`DISC request failed (${u.status}).`);return h}async function N(t=""){var i;if((i=navigator.clipboard)!=null&&i.writeText){await navigator.clipboard.writeText(t);return}const s=document.createElement("textarea");s.value=t,s.setAttribute("readonly",""),s.style.position="fixed",s.style.opacity="0",document.body.append(s),s.select();const e=document.execCommand("copy");if(s.remove(),!e)throw new Error("Browser copy command returned false.")}function I(t,s={}){const e=["D","I","S","C"].map(i=>{const n=Math.max(0,Math.min(100,Number(s[i]||0)));return`<div class="disc-graph__row disc-graph__row--${i.toLowerCase()}">
2      <strong>${i}</strong>
3      <div class="disc-graph__track" aria-label="${i} score ${n} out of 100">
4        <span style="width:${n}%"></span>
5      </div>
6      <b>${n}</b>
7    </div>`}).join("");return`<section class="disc-report__graph"><h3>${a(t)}</h3>${e}</section>`}function q(t=""){const s=String(t||"").split("").filter(e=>g[e]);return s.length?s:["D"]}function B(t=""){return q(t).map(s=>{const e=g[s];return`<article class="disc-insight-card disc-insight-card--${s.toLowerCase()}">
8      <span class="disc-pattern-pill">${s}</span>
9      <h3>${a(e.name)}</h3>
10      <p>${a(e.short)}</p>
11      <h4>Likely strengths</h4>
12      <ul>${e.strengths.map(i=>`<li>${a(i)}</li>`).join("")}</ul>
13      <h4>Works best with</h4>
14      <ul>${e.needs.map(i=>`<li>${a(i)}</li>`).join("")}</ul>
15    </article>`}).join("")}function G(t=""){const s=q(t),e=g[s[0]],i=s[1]?g[s[1]]:null;return`<section class="disc-report__section">
16    <h2>Role alignment</h2>
17    <p>This profile is likely to perform best where ${a(e.short.toLowerCase())} behaviour is useful${i?` and ${a(i.short.toLowerCase())} behaviour is also valued`:""}. This is a coaching prompt, not a hiring decision or clinical assessment.</p>
18    <div class="disc-report__columns">
19      <div><h3>Role conditions to provide</h3><ul>${e.needs.map(n=>`<li>${a(n)}</li>`).join("")}</ul></div>
20      <div><h3>Role-fit questions</h3><ul>
21        <li>Which parts of the role naturally create energy, and which create friction?</li>
22        <li>What information or authority is needed to make good decisions?</li>
23        <li>How should feedback and escalation work during busy periods?</li>
24      </ul></div>
25    </div>
26  </section>`}function Q(t=""){const s=q(t),e=g[s[0]],i=s[1]?g[s[1]]:null;return`<section class="disc-report__section">
27    <h2>90-day development plan</h2>
28    <div class="disc-plan-grid">
29      <article><span>Days 1–30</span><h3>Notice</h3><p>Track when your natural approach helps and when it creates friction. Ask two colleagues for examples.</p></article>
30      <article><span>Days 31–60</span><h3>Practise</h3><p>${a(e.growth)}${i?` Also practise: ${a(i.growth)}`:""}</p></article>
31      <article><span>Days 61–90</span><h3>Embed</h3><p>Agree one observable behaviour, one measure, and a fortnightly manager check-in.</p></article>
32    </div>
33  </section>`}function j(t={},{privateWorkspace:s=!1}={}){var c,u,h;const e=t.calculation||{},i=e.naturalPattern||"D",n=e.adaptedPattern||i,o=g[q(n)[0]],r=String(((c=t.profile)==null?void 0:c.company)||"").trim(),d=s&&/^(?:all electric homes|aeh)$/i.test(r)?"":r;return`<article class="disc-report" data-disc-result-id="${a(t.id)}">
34    <header class="disc-report__header">
35      <div><span class="eyebrow">DISC-style workplace profile</span><h1>${a(((u=t.profile)==null?void 0:u.name)||"Participant")}</h1>
36      <p>${a(((h=t.profile)==null?void 0:h.position)||"Role not supplied")}${d?` · ${a(d)}`:""}</p></div>
37      <div class="disc-report__codes"><strong>${a(t.resultCode||"")}</strong><span>${_(t.createdAt)}</span></div>
38    </header>
39    <section class="disc-report__summary">
40      <div><span>Adopted Environment</span><strong>${a(n)}</strong><p>Derived from the statements you ranked most like you.</p></div>
41      <div><span>Natural</span><strong>${a(i)}</strong><p>Derived from the dimensions you were least likely to rank last.</p></div>
42    </section>
43    <div class="disc-report__graphs">
44      ${I("Adopted Environment",e.adapted||{})}
45      ${I("Natural",e.natural||{})}
46    </div>
47    <section class="disc-report__section"><h2>Profile interpretation</h2><p>Your strongest Adopted Environment theme is <strong>${a(o.name)}</strong>: ${a(o.short.toLowerCase())}. Treat both indexes as reflection prompts—not population percentiles or measures of ability, intelligence or suitability.</p>
48      <div class="disc-insight-grid">${B(n)}</div>
49    </section>
50    <section class="disc-report__section"><h2>Communication and pressure</h2><div class="disc-report__columns">
51      <div><h3>Communicating with this profile</h3><p>${a(o.communicate)}</p></div>
52      <div><h3>Under pressure</h3><p>${a(o.pressure)}</p></div>
53    </div></section>
54    ${G(n)}
55    <section class="disc-report__section"><h2>Values alignment prompts</h2><ul>
56      <li><strong>Safety:</strong> How does this person surface risk, uncertainty and stop-work concerns?</li>
57      <li><strong>Customer:</strong> What communication style helps them create clarity and confidence?</li>
58      <li><strong>Ownership:</strong> Which decisions should they own, and what escalation path is needed?</li>
59      <li><strong>Team:</strong> What behaviour from colleagues helps them contribute at their best?</li>
60    </ul></section>
61    ${Q(n)}
62    <section class="disc-report__section"><h2>Role scorecard template</h2><div class="disc-scorecard-grid">
63      <span>Outcome / KPI</span><span>Target</span><span>Review rhythm</span><span>Support needed</span>
64      <em>Define with manager</em><em>Specific and measurable</em><em>Weekly / monthly</em><em>Tools, authority, coaching</em>
65    </div></section>
66    <footer class="disc-report__disclaimer">This is a DISC-style ipsative workplace-development tool. Its graph values use the original legacy raw-count conversion tables for the rank-1 Adopted Environment and rank-4 Natural responses. Instrument ${a(e.instrumentVersion||t.instrumentVersion||"—")} · Scoring ${a(e.scoringVersion||t.scoringVersion||"—")}. It is not a clinical or diagnostic instrument and must not be used as the sole basis for employment decisions.</footer>
67  </article>`}function K(){return`<article class="disc-manager-guide">
68    <header><span class="eyebrow">Manager guide</span><h2>Turn profiles into useful conversations</h2><p>Use observable behaviour and role outcomes. Avoid labels, absolutes and hiring shortcuts.</p></header>
69    <div class="disc-manager-grid">${Object.entries(g).map(([t,s])=>`<section class="disc-manager-card disc-manager-card--${t.toLowerCase()}">
70      <span class="disc-pattern-pill">${t}</span><h3>${a(s.name)}</h3>
71      <p>${a(s.short)}</p>
72      <h4>Do</h4><p>${a(s.communicate)}</p>
73      <h4>Watch for</h4><p>${a(s.pressure)}</p>
74      <h4>Coach toward</h4><p>${a(s.growth)}</p>
75    </section>`).join("")}</div>
76    <section class="disc-guide-checklist"><h3>Review conversation</h3><ol>
77      <li>Ask what feels accurate and what does not.</li><li>Compare the Adopted Environment and Natural patterns without assuming they prove context, stress or authenticity.</li>
78      <li>Connect behaviours to current role outcomes and customer impact.</li><li>Choose one strength to use deliberately and one stretch behaviour to practise.</li>
79      <li>Record an observable action and review date.</li>
80    </ol></section>
81  </article>`}function z(t=[]){return t.map((s,e)=>`<fieldset class="disc-question" data-disc-question="${s.id}">
82    <legend><span>${e+1}</span> Rank each statement</legend>
83    <p class="helper">Use each number once: 1 = most like me, 4 = least like me.</p>
84    <div class="disc-question__statements">${s.statements.map(i=>`<label>
85      <span>${a(i.text)}</span>
86      <select name="q${s.id}_${i.itemId}" data-item-id="${i.itemId}" required>
87        <option value="">Rank</option><option value="1">1 · Most</option><option value="2">2</option><option value="3">3</option><option value="4">4 · Least</option>
88      </select>
89    </label>`).join("")}</div>
90    <div class="disc-question__status" aria-live="polite"></div>
91  </fieldset>`).join("")}function C(t){const e=[...t.querySelectorAll("select")].map(o=>o.value).filter(Boolean).sort(),i=e.join(",")==="1,2,3,4",n=t.querySelector(".disc-question__status");return t.classList.toggle("is-complete",i),n&&(n.textContent=i?"Complete":`${4-e.length} ranking${4-e.length===1?"":"s"} remaining`),i}function Y(t,s=[]){const e={};for(const i of s){const n=t.querySelector(`[data-disc-question="${i.id}"]`);if(!n||!C(n))throw new Error(`Complete all four unique rankings for question ${i.id}.`);e[i.id]=Object.fromEntries([...n.querySelectorAll("select")].map(o=>[o.dataset.itemId,Number(o.value)]))}return e}async function X({form:t,questions:s,inviteToken:e,instrumentVersion:i,idempotencyKey:n,auth:o}){const r=new FormData(t),d=new URLSearchParams(window.location.search).get("mode")==="self"?"self/admin":void 0;return k("/results",{auth:o,method:"POST",includeAuth:d==="self/admin",idempotencyKey:n,body:{instrumentVersion:i,inviteToken:e,assessmentMode:d,profile:{name:r.get("name"),email:r.get("email"),position:r.get("position"),company:r.get("company"),privacyConsent:r.get("privacyConsent")==="on"},rankings:Y(t,s)}})}function J(){const s=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("invite")||"";return s&&window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}`),s}function F(t=!1){return t?'<header class="disc-public-header disc-public-header--neutral"><div class="disc-public-mark" aria-hidden="true">DISC</div><div><span>Private workplace profile</span><h1>DISC Assessment</h1></div></header>':'<header class="disc-public-header"><img src="/aeh-whitesimple.png" alt="All Electric Homes"><div><span>Workplace profile</span><h1>DISC Assessment</h1></div></header>'}function Z({privatePresentation:t=!1}={}){return`<main class="disc-public-shell${t?" disc-public-shell--neutral":""}">
92    ${F(t)}
93    <section class="disc-public-intro"><span class="disc-public-kicker">About 15 minutes</span><h2>Rank how you operate at work</h2><p>For each group, use every rank once. There are no right or wrong answers—choose what best reflects you.</p></section>
94    <div id="disc-public-status" class="disc-public-status" aria-l
94ive="polite">Loading the assessment…</div>
95    <form id="disc-assessment-form" class="disc-assessment-form" hidden>
96      <section class="disc-profile-fields"><h2>Your details</h2><div class="disc-form-grid">
97        <label>Full name<input name="name" autocomplete="name" maxlength="100" required></label>
98        <label>Email<input name="email" type="email" autocomplete="email" maxlength="254" required></label>
99        <label>Position / role<input name="position" autocomplete="organization-title" maxlength="120"></label>
100        <label>${t?"Company (optional)":"Company"}<input id="disc-public-company" name="company" autocomplete="organization" maxlength="120"${t?"":' value="All Electric Homes"'}></label>
101      </div><label class="disc-consent"><input name="privacyConsent" type="checkbox" required> <span>I consent to this workplace-development assessment being scored and stored for the stated review or development purpose. I understand it is not a clinical test or a standalone hiring decision.</span></label></section>
102      <section id="disc-question-list" class="disc-question-list"></section>
103      <section class="disc-submit-panel"><p>Your response is scored and stored securely when you submit.</p><button class="btn btn--primary" type="submit">Submit and view my profile</button></section>
104    </form>
105    <section id="disc-participant-report" class="disc-participant-report" hidden></section>
106  </main>`}function R(t,s=!1){const e=t.querySelector(".disc-public-shell");e==null||e.classList.toggle("disc-public-shell--neutral",s);const i=t.querySelector(".disc-public-header");i&&(i.outerHTML=F(s));const n=t.querySelector("#disc-public-company");if(n){const o=n.closest("label");o!=null&&o.firstChild&&(o.firstChild.textContent=s?"Company (optional)":"Company"),s&&/^(?:all electric homes|aeh)$/i.test(n.value.trim())&&(n.value=""),!s&&!n.value&&(n.value="All Electric Homes")}}async function ve({container:t,auth:s,privateRoute:e=!1}){const i=J(),n=M(),o=e||!!i;t.innerHTML=Z({privatePresentation:o});const r=t.querySelector("#disc-public-status"),d=t.querySelector("#disc-assessment-form"),c=t.querySelector("#disc-participant-report");try{const u=await k("/questions"),h=u.questions||[];if(e&&!i)throw new Error("A secure private assessment invitation is required.");const l=i?(await k("/invites/resolve",{method:"POST",body:{token:i}})).invite:null,v=(l==null?void 0:l.presentationMode)==="neutral-private";if(e&&!v)throw new Error("This invitation is not valid for the private assessment.");R(t,v),v&&(document.title="DISC Assessment"),d.querySelector('[name="name"]').value=(l==null?void 0:l.name)||"",d.querySelector('[name="email"]').value=(l==null?void 0:l.emailMasked)||"",d.querySelector('[name="position"]').value=(l==null?void 0:l.role)||"",l&&(d.querySelector('[name="name"]').readOnly=!0,d.querySelector('[name="email"]').readOnly=!0,d.querySelector('[name="email"]').required=!1),t.querySelector("#disc-question-list").innerHTML=z(h),t.querySelectorAll(".disc-question").forEach(p=>{C(p),p.addEventListener("change",b=>{if(b.target.tagName!=="SELECT"||!b.target.value)return C(p);p.querySelectorAll("select").forEach(y=>{y!==b.target&&y.value===b.target.value&&(y.value="")}),C(p)})}),r.textContent=l?`Secure assessment for ${l.name}`:"Direct public assessment",r.classList.add("is-ready"),d.hidden=!1,d.addEventListener("submit",async p=>{p.preventDefault();const b=d.querySelector('button[type="submit"]');b.disabled=!0,r.textContent="Scoring and saving your profile…";try{const y=await X({form:d,questions:h,inviteToken:i,instrumentVersion:u.instrumentVersion,idempotencyKey:n.current(),auth:s});d.hidden=!0,r.textContent="Assessment complete";const w=v?"Download / Save PDF":"Print / Save PDF";c.innerHTML=`<div class="disc-report-actions"><button class="btn btn--secondary" type="button" id="disc-print-report">${w}</button></div>${j(y.result,{privateWorkspace:v})}`,c.hidden=!1,O(c.querySelector("#disc-print-report"),{getReport:()=>c.querySelector(".disc-report"),statusElement:r}),window.scrollTo({top:0,behavior:"smooth"})}catch(y){r.textContent=y.message,r.classList.add("is-error"),b.disabled=!1}})}catch(u){r.textContent=u.message,r.classList.add("is-error")}}function ee(t=[]){return t.length?t.map((s,e)=>{var i,n,o,r;return`<tr>
107    <td>${a(((i=s.profile)==null?void 0:i.name)||"—")}</td><td>${a(((n=s.profile)==null?void 0:n.position)||"—")}</td>
108    <td><strong>${a(((o=s.calculation)==null?void 0:o.naturalPattern)||"—")}</strong> / ${a(((r=s.calculation)==null?void 0:r.adaptedPattern)||"—")}</td>
109    <td>${a(s.assessmentMode||"—")}</td><td>${_(s.createdAt)}</td>
110    <td><button class="btn btn--compact btn--secondary" type="button" data-disc-view-result="${e}">View report</button></td>
111  </tr>`}).join(""):'<tr><td colspan="6">No Firebase-hosted results yet.</td></tr>'}function te(t=[]){return t.length?t.map(s=>`<tr><td>${a(s.name)}</td><td>${a(s.email)}</td><td>${a(s.type)}</td><td>
111<span class="status-pill">${a(s.status)}</span></td><td>${_(s.createdAt)}</td></tr>`).join(""):'<tr><td colspan="5">No Firebase-hosted invitations yet.</td></tr>'}async function se({auth:t,apiBase:s=S}){const[e,i]=await Promise.all([k("/results",{auth:t,requireAuth:!0,apiBase:s}),k("/invites",{auth:t,requireAuth:!0,apiBase:s})]);return{results:e.results||[],invites:i.invites||[]}}function H(t){const s=new FormData(t);return{name:s.get("name"),email:s.get("email"),role:s.get("role"),type:s.get("type"),subject:s.get("subject"),body:s.get("body")}}async function ie({form:t,auth:s,apiBase:e=S}){return k("/invites",{auth:s,method:"POST",requireAuth:!0,body:H(t),apiBase:e})}function ne({invite:t={},url:s="",manualEmail:e=null}={},{privateWorkspace:i=!1}={}){if(!i)return`<p><strong>Invitation created for ${a(t.email||"recipient")}.</strong><br><a href="${a(s)}" target="_blank" rel="noopener">Open secure assessment</a> <button class="btn btn--compact btn--secondary" type="button" id="copy-created-link">Copy link</button></p>`;const n=(e==null?void 0:e.recipient)||t.email||"",o=(e==null?void 0:e.subject)||"",r=(e==null?void 0:e.body)||"",d=`To: ${n}
112Subject: ${o}
113
114${r}`;return`<section class="disc-manual-email" aria-labelledby="disc-manual-email-title">
115    <div class="disc-manual-email__header"><div><span class="eyebrow">Manual email</span><h3 id="disc-manual-email-title">Invitation ready to copy</h3><p class="helper">Copy these details into your preferred email service. Nothing is sent from this workspace.</p></div>
116      <a class="btn btn--compact btn--secondary" href="${a(s)}" target="_blank" rel="noopener">Preview assessment</a></div>
117    <label>Recipient<input id="disc-manual-recipient" type="text" readonly value="${a(n)}"></label>
118    <button class="btn btn--compact btn--secondary" type="button" data-disc-copy-field="recipient">Copy recipient</button>
119    <label>Subject<input id="disc-manual-subject" type="text" readonly value="${a(o)}"></label>
120    <button class="btn btn--compact btn--secondary" type="button" data-disc-copy-field="subject">Copy subject</button>
121    <label>Email message<textarea id="disc-manual-body" rows="10" readonly>${a(r)}</textarea></label>
122    <div class="cta-row">
123      <button class="btn btn--compact btn--secondary" type="button" data-disc-copy-field="body">Copy email message</button>
124      <button class="btn btn--compact btn--primary" type="button" data-disc-copy-field="all" data-disc-copy-all="${a(d)}">Copy all email details</button>
125      <button class="btn btn--compact btn--secondary" type="button" data-disc-copy-field="link">
125Copy assessment link</button>
126    </div>
127    <input id="disc-created-assessment-link" type="text" readonly value="${a(s)}" aria-label="Assessment link">
128    <p class="helper" data-disc-copy-status aria-live="polite"></p>
129  </section>`}function ae(t){const s={recipient:()=>{var e;return((e=t.querySelector("#disc-manual-recipient"))==null?void 0:e.value)||""},subject:()=>{var e;return((e=t.querySelector("#disc-manual-subject"))==null?void 0:e.value)||""},body:()=>{var e;return((e=t.querySelector("#disc-manual-body"))==null?void 0:e.value)||""},link:()=>{var e;return((e=t.querySelector("#disc-created-assessment-link"))==null?void 0:e.value)||""},all:e=>e.dataset.discCopyAll||""};t.querySelectorAll("[data-disc-copy-field]").forEach(e=>{e.addEventListener("click",async()=>{const i=t.querySelector("[data-disc-copy-status]");try{const n=s[e.dataset.discCopyField];await N(n?n(e):""),i&&(i.textContent=`${e.textContent} copied.`)}catch(n){i&&(i.textContent=`Could not copy: ${n.message}`)}})})}async function re({form:t,auth:s,idempotencyKey:e}){const i=H(t);if(!window.confirm(`Send this assessment invitation from [email protected] to ${i.email}?`))throw new Error("Email send cancelled.");return k("/invites/send",{auth:s,method:"POST",requireAuth:!0,body:{...i,confirmSend:!0,idempotencyKey:e}})}const $=new WeakMap;function oe(t,{documentRef:s=globalThis.document}={}){var v;if(!t||typeof t.cloneNode!="function"||!(s!=null&&s.body))throw new Error("A rendered DISC report is required for printing.");const e=s.body,i=s.documentElement,n=$.get(e);if(n!=null&&n.hasInvokedPrint())return null;const o=[...e.children].filter(p=>p.classList.contains("disc-print-root")),r=e.classList.contains("disc-report-printing"),d=(i==null?void 0:i.classList.contains("disc-report-printing"))??!1;let c=null;try{c=s.createElement("div"),c.className="disc-print-root",c.appendChild(t.cloneNode(!0)),e.appendChild(c),e.classList.add("disc-report-printing"),i==null||i.classList.add("disc-report-printing")}catch(p){if((c==null?void 0:c.parentNode)===e)try{e.removeChild(c)}catch{(v=c.remove)==null||v.call(c)}throw r||e.classList.remove("disc-report-printing"),i&&!d&&i.classList.remove("disc-report-printing"),p}let u=!1,h=!1;const l={hasInvokedPrint(){return!u&&h},isActive(){return!u&&$.get(e)===l},markPrintInvoked(){return l.isActive()?(h=!0,!0):!1},cleanup(){u||(u=!0,c.remove(),$.get(e)===l&&($.delete(e),e.classList.remove("disc-report-printing"),i==null||i.classList.remove("disc-report-printing")))}};return $.set(e,l),o.forEach(p=>{p.parentNode===e&&e.removeChild(p)}),l}function E(t){return new Promise(s=>t.requestAnimationFrame(s))}async function ce(t,s){var e;(e=t.fonts)!=null&&e.ready&&await Promise.resolve(t.fonts.ready).catch(()=>{}),await E(s),await E(s)}const le=6e4;async function de(t,{documentRef:s=globalThis.document,windowRef:e=globalThis.window}={}){var d;const i=oe(t,{documentRef:s});if(!i)return!1;let n=!1,o=null;const r=()=>{var c,u;n||(n=!0,(c=e==null?void 0:e.removeEventListener)==null||c.call(e,"afterprint",r),o!==null&&((u=e==null?void 0:e.clearTimeout)==null||u.call(e,o),o=null),i.cleanup())};try{if(!e||typeof e.print!="function"||typeof e.requestAnimationFrame!="function")throw new Error("Printing is not available in this browser.");return await ce(s,e),i.markPrintInvoked()?((d=e.addEventListener)==null||d.call(e,"afterprint",r,{once:!0}),e.print(),n||(o=e.setTimeout(r,le)),!0):(r(),!1)}catch(c){throw r(),c}}async function pe(t,{alertFn:s,documentRef:e=globalThis.document,statusElement:i=null,windowRef:n=globalThis.window}={}){var o;try{const r=await de(t,{documentRef:e,windowRef:n});return{ok:r,superseded:!r}}catch(r){const c=`Unable to print this DISC report.${typeof(r==null?void 0:r.message)=="string"&&r.message.trim()?` ${r.message.trim()}`:""}`;try{i?(i.textContent=c,i.classList.remove("is-ready"),i.classList.add("is-error")):typeof s=="function"?s(c):(o=n==null?void 0:n.alert)==null||o.call(n,c)}catch{}return{ok:!1,error:r,message:c}}}function O(t,{documentRef:s=globalThis.document,getReport:e,statusElement:i=null,windowRef:n=globalThis.window}={}){var o;(o=t==null?void 0:t.addEventListener)==null||o.call(t,"click",()=>{pe(e==null?void 0:e(),{documentRef:s,statusElement:i,windowRef:n})})}
129function ue(t,s=[],{privateWorkspace:e=!1}={}){var i;(i=t.querySelector("[data-disc-close-report]"))==null||i.addEventListener("click",()=>t.close()),O(t.querySelector("[data-disc-print-report]"),{getReport:()=>t.querySelector(".disc-report")}),document.querySelectorAll("[data-disc-view-result]").forEach(n=>{n.addEventListener("click",()=>{const o=s[Number(n.dataset.discViewResult)];t.querySelector(".disc-report-dialog__content").innerHTML=j(o,{privateWorkspace:e}),t.showModal()})})}async function fe({container:t,auth:s,toolState:e}){var L,T;const i=e.apiBase||S,n=e.allowDirectAssessment!==!1,o=e.allowEmailSend!==!1,r=e.privateWorkspace===!0,d=e.reportActionLabel||"Print / Save PDF",c=n?`<div class="disc-admin-hero__actions"><a class="btn btn--primary" href="${A}" target="_blank" rel="noopener">Open assessment</a><a class="btn btn--secondary" href="${A}?mode=self" target="_blank" rel="noopener">Take ourselves</a><button class="btn btn--secondary" id="disc-copy-direct-link" type="button">Copy assessment link</button></div>`:'<div class="disc-admin-hero__actions"><span class="status-pill">Secure invitation links only</span></div>',u=e.privateWorkspace?'<option value="client">Client</option>':'<option value="employee">Employee</option><option value="applicant">Applicant</option>',h=o?`<label>Subject<input name="subject" maxlength="240" value="Employee DISC assessment link"></label>
130        <label>Message<textarea name="body" rows="9">Hi there,
131
132As part of our employee development and review process, please complete this short DISC-style assessment.
133
134Start assessment:
135[assessment link will be inserted here]
136
137Please complete it in one sitting and answer based on how you operate in the workplace.
138
139Thanks,
140All Electric Homes / Want A Group</textarea></label>`:"",l=o?'<button class="btn btn--primary" type="button" id="disc-send-invite">Send from Outlook</button>':"",v=n?`<article class="disc-admin-panel disc-admin-panel--qr"><span class="eyebrow">Direct public access</span><h2>Assessment link and QR</h2><img src="${x}" alt="QR code for the public Firebase DISC assessment"><code>${a(A)}</code><p>${a(e.networkDetail)}</p><a class="btn btn--secondary" href="${x}" download>Download QR SVG</a></article>`:`<article class="disc-admin-panel disc-admin-panel--qr"><span class="eyebrow">Private data boundary</span><h2>Owner-scoped client records</h2><p>${a(e.networkDetail)}</p><p class="helper">Create a secure link for each client. Direct public submissions are intentionally disabled in this workspace.</p></article>`;t.innerHTML=`<section class="disc-admin-workspace">
141    <header class="disc-admin-hero"><div><span class="eyebrow">${a(e.audienceLabel)}</span><h1>${a(e.title)}</h1><p>${a(e.intro)}</p>
142      <div class="disc-admin-hero__badges"><span>${a(e.launchSummary)}</span><span>${a(e.networkNotice)}</span></div></div>
143      ${c}
144    </header>
145    <div id="disc-admin-status" class="disc-public-status" aria-live="polite">Loading Firebase results and invitations…</div>
146    <section class="disc-admin-grid">
147      <article class="disc-admin-panel disc-admin-panel--invite"><div class="disc-admin-panel__header"><span class="eyebrow">Secure invitation</span><h2>${r?"Create assessment link":"Create or send assessment"}</h2><p>${r?"Create the link, then copy the ready-to-use email details into your preferred email service.":"Links expire after 30 days and can be completed once."}</p></div>
148        <form id="disc-invite-form"><div class="disc-form-grid">
149          <label>Name<input name="name" maxlength="100" required></label><label>Email<input name="email" type="email" maxlength="254" required></label>
150          <label>Role<input name="role" maxlength="120"></label><label>Type<select name="type">${u}</select></label>
151        </div>${h}
152        <div class="disc-invite-actions"><button class="btn btn--secondary" type="button" id="disc-create-invite">Create secure link</button>${l}</div>
153        <div id="disc-invite-output" class="disc-invite-output" hidden></div></form>
154      </article>
155      ${v}
156    </section>
157    <section class="disc-admin-panel"><div class="disc-admin-panel__header"><span class="eyebrow">Profiles</span><h2>Assessment results</h2></div><div class="table-wrap"><table><thead><tr><th>
157Name</th><th>Role</th><th>Natural / Adopted Environment</th><th>Mode</th><th>Completed</th><th></th></tr></thead><tbody id="disc-results-body"><tr><td colspan="6">Loading…</td></tr></tbody></table></div></section>
158    <section class="disc-admin-panel"><div class="disc-admin-panel__header"><span class="eyebrow">Invitations</span><h2>Delivery and completion status</h2></div><div class="table-wrap"><table><thead><tr><th>Name</th><th>Email</th><th>Type</th><th>Status</th><th>Created</th></tr></thead><tbody id="disc-invites-body"><tr><td colspan="5">Loading…</td></tr></tbody></table></div></section>
159    <section class="disc-admin-panel">${K()}</section>
160    <dialog id="disc-report-dialog" class="disc-report-dialog"><div class="disc-report-dialog__toolbar"><button class="btn btn--secondary" type="button" data-disc-print-report>${a(d)}</button><button class="btn btn--secondary" type="button" data-disc-close-report>Close</button></div><div class="disc-report-dialog__content"></div></dialog>
161  </section>`;const p=t.querySelector("#disc-admin-status"),b=t.querySelector("#disc-invite-form"),y=t.querySelector("#disc-invite-output"),w=M(),D=async()=>{try{const m=await se({auth:s,apiBase:i});t.querySelector("#disc-results-body").innerHTML=ee(m.results),t.querySelector("#disc-invites-body").innerHTML=te(m.invites),ue(t.querySelector("#disc-report-dialog"),m.results,{privateWorkspace:r}),p.textContent=`${m.results.length} result${m.results.length===1?"":"s"} · ${m.invites.length} invitation${m.invites.length===1?"":"s"} in Firebase`,p.classList.add("is-ready")}catch(m){p.textContent=m.message,p.classList.add("is-error")}};(L=t.querySelector("#disc-copy-direct-link"))==null||L.addEventListener("click",async()=>{try{await V({clipboard:navigator.clipboard,fallbackCopy:()=>document.execCommand("copy")}),p.textContent="Public assessment link copied."}catch(m){p.textContent=m.message}}),t.querySelector("#disc-create-invite").addEventListener("click",async()=>{var m;try{if(!b.reportValidity())return;const f=await ie({form:b,auth:s,apiBase:i});y.hidden=!1,y.innerHTML=ne(f,{privateWorkspace:r}),r?ae(y):(m=y.querySelector("#copy-created-link"))==null||m.addEventListener("click",()=>N(f.url)),await D()}catch(f){p.textContent=f.message,p.classList.add("is-error")}}),(T=t.querySelector("#disc-send-invite"))==null||T.addEventListener("click",async m=>{try{if(!b.reportValidity())return;m.currentTarget.disabled=!0;const f=await re({form:b,auth:s,idempotencyKey:w.current()});w.rotate(),y.hidden=!1,y.innerHTML=`<strong>Email accepted by Outlook</strong><span>Sent from ${a(f.emailDelivery.mailbox)}.</span><code>${a(f.url)}</code>`,await D()}catch(f){p.textContent=f.message,f.message!=="Email send cancelled."&&p.classList.add("is-error")}finally{m.currentTarget.disabled=!1}}),await D()}export{O as bindDiscReportPrintButton,ie as createDiscInvite,k as discApiFetch,se as loadDiscResults,fe as mountDiscProfileTool,oe as prepareDiscReportPrint,de as printDiscReport,z as renderDiscAssessmentQuestions,Z as renderDiscAssessmentShell,ne as renderDiscInviteOutput,K as renderDiscManagerGuide,j as renderDiscReport,ve as renderPublicDiscAssessment,pe as requestDiscReportPrint,re as sendDiscAssessmentEmail,X as submitDiscAssessment};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.