@axceera/playstep 0.11.2 → 0.11.3

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.
@@ -0,0 +1,13 @@
1
+ const e=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,t=/\+?\(?\d[\d\s().-]{5,}\d/g,n=/\d{6,}/g,r=/\b(?=[\w-]*\d)[\w-]{24,}\b/g;function i(i){return[e,r,n].some(e=>new RegExp(e.source).test(i))||[...i.matchAll(t)].some(e=>e[0].replace(/\D/g,``).length>=7)}function a(i){return i.replace(e,`[email]`).replace(r,`[id]`).replace(t,e=>e.replace(/\D/g,``).length>=7?`[number]`:e).replace(n,`[number]`)}function o(e){if(!e)return``;let t=a(e.replace(/\s+/g,` `).trim());return t.length>80?`${t.slice(0,79)}…`:t}function s(e=80){let t=/^(:|radix-|headlessui-|react-|ember\d|mui-|v-|css-|sc-|jsx-)|\d{3,}|[a-f0-9]{8,}|__/i,n=/active|selected|current|open|hover|focus|disabled|hidden|show|visible|checked|loading/i,r=e=>(e??``).replace(/\s+/g,` `).trim().slice(0,80),i=e=>`"${e.replace(/["\\]/g,`\\$&`)}"`,a=e=>CSS.escape(e),o=e=>{try{return document.querySelectorAll(e).length===1}catch{return!1}},s=e=>{let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return n.visibility!==`hidden`&&n.display!==`none`&&Number(n.opacity||1)>.05},c=e=>{let t=e.getAttribute(`role`),n=e.tagName,r=(e.getAttribute(`type`)??``).toLowerCase();return t===`tab`||t===`menuitem`||t===`link`||t===`button`?t:t===`checkbox`||t===`switch`||n===`INPUT`&&(r===`checkbox`||r===`radio`)?`checkbox`:n===`A`?`link`:n===`BUTTON`||n===`SUMMARY`||n===`INPUT`&&/^(submit|button|reset|image)$/.test(r)?`button`:n===`SELECT`?`select`:n===`INPUT`||n===`TEXTAREA`?`input`:`other`},l=e=>{let r=e.tagName.toLowerCase(),s=[];e.id&&!t.test(e.id)&&s.push(`#${a(e.id)}`);for(let t of[`data-testid`,`data-test`,`data-cy`,`data-qa`]){let n=e.getAttribute(t);n&&s.push(`[${t}=${i(n)}]`)}for(let t of[`aria-label`,`name`,`title`,`placeholder`]){let n=e.getAttribute(t);n&&n.length<=80&&s.push(`${r}[${t}=${i(n)}]`)}let c=e.getAttribute(`href`);r===`a`&&c&&!/^javascript:|[?#]/i.test(c)&&c.length<=200&&s.push(`a[href=${i(c)}]`);let l=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!t.test(e)&&!n.test(e));l.length&&s.push(`${r}.${l.slice(0,3).map(a).join(`.`)}`);for(let e of s)if(o(e))return e;let u=[],d=e;for(;d&&u.length<7;){if(d===document.body){u.unshift(`body`);break}if(d!==e&&d.id&&!t.test(d.id)){u.unshift(`#${a(d.id)}`);break}let n=d.tagName.toLowerCase(),r=d.parentElement?[...d.parentElement.children].filter(e=>e.tagName===d.tagName):[];u.unshift(r.length>1?`${n}:nth-of-type(${r.indexOf(d)+1})`:n),d=d.parentElement}let f=u.join(`>`);return o(f)?f:void 0},u=e=>{let t=e.getAttribute(`aria-label`)||e.getAttribute(`title`);if(t)return t;let n=e.getAttribute(`aria-labelledby`);if(n)return n.split(/\s+/).map(e=>document.getElementById(e)?.textContent??``).join(` `);let r=e.labels;return r?.length?r[0].innerText:``},d=[...document.querySelectorAll(`a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],[data-guide]`)].filter(e=>!e.closest(`[data-private],[aria-hidden=true],[inert]`)&&s(e)&&!e.parentElement?.closest(`a[href],button,[role=button],[role=link]`)).map((e,t)=>{let n=e.getBoundingClientRect(),r=n.bottom>0&&n.top<innerHeight;return{e,i:t,score:(e.hasAttribute(`data-guide`)?0:2)+ +!r}}).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,e).sort((e,t)=>e.i-t.i),f=[];for(let{e}of d){let t=c(e),n=e.getAttribute(`data-guide`),i=t===`input`||t===`select`?``:r(e.innerText||e.textContent),a=r(u(e))||(e.tagName===`INPUT`&&t===`button`?r(e.value):``),o=r(e.getAttribute(`placeholder`)),s=e.getAttribute(`href`),d;if(e.tagName===`A`&&s)try{let e=new URL(s,location.href);e.origin===location.origin&&(d=e.pathname)}catch{}let p=n?void 0:l(e);if(!n&&!p)continue;let m=e.getBoundingClientRect();f.push({ref:`e${f.length+1}`,role:t,...i?{text:i}:{},...a&&a!==i?{label:a}:{},...o?{placeholder:o}:{},...d?{href:d}:{},...n?{anchor:n.slice(0,64)}:{css:p.slice(0,300)},clickable:t!==`input`&&t!==`select`&&t!==`other`,rect:[m.left+scrollX,m.top+scrollY,m.width,m.height].map(Math.round)})}let p=[...document.querySelectorAll(`h1,h2,h3,[role=heading]`)].filter(e=>!e.closest(`[data-private]`)&&s(e)).map(e=>r(e.innerText)).filter(Boolean).slice(0,10);return{platform:`web`,path:location.pathname||`/`,...document.title?{title:r(document.title)}:{},headings:p,viewport:[innerWidth,innerHeight],elements:f}}function c(){let e=document.createElement(`canvas`);e.width=e.height=1;let t=e.getContext(`2d`,{willReadFrequently:!0}),n=e=>{if(!t||!e||e===`transparent`||e===`none`||(t.fillStyle=`#010203`,t.fillStyle=e,t.fillStyle===`#010203`&&!/^#010203$/i.test(e)))return null;t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let n=t.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]/255]},r=e=>`#${e.slice(0,3).map(e=>e.toString(16).padStart(2,`0`)).join(``)}`,i=e=>(Math.max(e[0],e[1],e[2])-Math.min(e[0],e[1],e[2]))/255,a=e=>{let[t,n,r]=e.slice(0,3).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},o=(e,t)=>{let r=n(e),i=n(t);return Math.hypot(r[0]-i[0],r[1]-i[1],r[2]-i[2])<30},s=e=>{let t=e.getBoundingClientRect();if(t.width<4||t.height<4||t.bottom<0||t.top>innerHeight*3)return null;let n=getComputedStyle(e);return n.visibility===`hidden`||n.display===`none`||Number(n.opacity||1)<.3?null:{r:t,s:n}},c=e=>{let t=n(e);return t&&t[3]>=.9?t:null},l=e=>e.length?e.sort((e,t)=>e-t)[Math.floor(e.length/2)]:void 0,u=null;for(let e of[document.querySelector(`#root,#app,#__next,[data-reactroot],main`),document.body,document.documentElement])if(u=e?c(getComputedStyle(e).backgroundColor):null,u)break;for(let e=document.elementFromPoint(innerWidth/2,innerHeight/2);!u&&e;e=e.parentElement)u=c(getComputedStyle(e).backgroundColor);u??(u=getComputedStyle(document.documentElement).colorScheme.trim()===`dark`?[18,18,18,1]:[255,255,255,1]);let d=a(u)<.2,f=n(getComputedStyle(document.querySelector(`main`)??document.body).color),p=[],m=(e,t,n)=>{let r=p.find(t=>t.from===n&&o(t.color,e));r?r.weight+=t:p.push({color:e,weight:t,from:n})},h=[],g=document.querySelectorAll(`button,[role=button],input[type=submit],input[type=button],a,[class*=btn],[class*=Btn],[class*=button],[class*=Button]`);for(let e of[...g].slice(0,400)){let t=s(e);if(!t)continue;let o=c(t.s.backgroundColor);if(o&&i(o)>.18&&a(o)>.02&&a(o)<.9){m(r(o),Math.min(t.r.width*t.r.height,3e4),`button`);let e=Number.parseFloat(t.s.borderTopLeftRadius)||0;h.push(e>=t.r.height/2-1?999:e)}else if(e.tagName===`A`){let e=n(t.s.color);e&&i(e)>.25&&m(r(e),400,`link`)}}let _=getComputedStyle(document.documentElement),v=/* @__PURE__ */ new Set,y=0;for(let e of[...document.styleSheets]){let t;try{t=e.cssRules}catch{continue}for(let e of[...t]){if(++y>3e3)break;let t=e.style;if(t&&/:root|html|body|\.light|\[data-theme/.test(e.selectorText??``))for(let e of[...t]){if(!e.startsWith(`--`)||v.has(e)||!/primary|accent|brand/i.test(e)||/foreground|fg|text|contrast|muted|soft|subtle|hover|active|border|ring|shadow|sidebar|chart|50\b|100\b|900\b/i.test(e))continue;v.add(e);let t=_.getPropertyValue(e).trim(),a=n(t)??n(`hsl(${t})`)??n(`rgb(${t})`)??n(`oklch(${t})`);a&&a[3]>=.9&&i(a)>.18&&m(r(a),/^--(color-)?(primary|brand)$/i.test(e)?8e4:4e4,`variable`)}}}let b=n(document.querySelector(`meta[name=theme-color]`)?.getAttribute(`content`));b&&i(b)>.18&&m(r(b),2e4,`theme-color`);let x=[],S=[],C=document.querySelectorAll(`section,article,aside,dialog,[role=dialog],[class*=card],[class*=Card],[class*=panel],[class*=Panel],div`);for(let e of[...C].slice(0,800)){let t=s(e);if(!t||t.r.width*t.r.height<2e4||t.r.width>innerWidth*.95)continue;let n=c(t.s.backgroundColor);if(!n||i(n)>.2||o(r(n),r(u))||a(n)<.2!==d)continue;let l=t.s.boxShadow!==`none`||Number.parseFloat(t.s.borderTopWidth)>0,f=r(n),p=x.find(e=>o(e.color,f)),m=Math.min(t.r.width*t.r.height,2e5)*(l?2:1);p?p.weight+=m:x.push({color:f,weight:m}),l&&S.push(Number.parseFloat(t.s.borderTopLeftRadius)||0)}let w=getComputedStyle(document.body).fontFamily,T=document.querySelector(`h1,h2`),E=T?getComputedStyle(T).fontFamily:void 0;return{scheme:d?`dark`:`light`,background:r(u),...f?{text:r(f)}:{},accents:p.sort((e,t)=>t.weight-e.weight).slice(0,8),surfaces:x.sort((e,t)=>t.weight-e.weight).slice(0,4).map(e=>e.color),...w?{font:w.slice(0,300)}:{},...E&&E!==w?{displayFont:E.slice(0,300)}:{},...h.length?{radius:l(h)}:{},...S.length?{cardRadius:l(S)}:{}}}function l(){try{return c()}catch{return}}const u=`playstep_preview`,d=`playstep_capture_on`,f={get:e=>{try{return sessionStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}catch{}}};function p(e){let t=e=>e&&o(e)||void 0;return{...e,title:t(e.title),headings:(e.headings??[]).map(e=>o(e)).filter(Boolean),elements:e.elements.map(e=>({...e,text:t(e.text),label:t(e.label),placeholder:t(e.placeholder),href:e.href&&!i(e.href)?e.href:void 0,css:e.css&&!i(e.css)?e.css:void 0})).filter(e=>e.anchor||e.css)}}function m(e,t){let n=document.createElement(`playstep-capture`),r=n.attachShadow({mode:`open`});document.body.appendChild(n);let i=document.createElement(`div`);i.className=`p`,i.setAttribute(`role`,`region`),i.setAttribute(`aria-label`,`PlayStep capture`),r.innerHTML=`<style>:host{all:initial}
2
+ .p{position:fixed;left:24px;bottom:24px;z-index:2147483001;width:320px;max-width:calc(100vw - 48px);box-sizing:border-box;padding:16px;border-radius:16px;background:#fff;color:#151823;font:14px/20px system-ui,-apple-system,"Segoe UI",sans-serif;box-shadow:0 12px 32px #15182333,0 0 0 1px #15182314}
3
+ h2{margin:0 0 4px;font-size:15px;line-height:22px;font-weight:700;display:flex;align-items:center;gap:8px}
4
+ p{margin:0 0 12px;color:#4a5163}
5
+ .dot{width:8px;height:8px;border-radius:50%;background:#e5484d;animation:b 1.6s ease-in-out infinite}
6
+ @keyframes b{50%{opacity:.35}}
7
+ .row{display:flex;gap:8px;flex-wrap:wrap}
8
+ button{font:600 14px/20px inherit;font-family:inherit;border:0;border-radius:999px;padding:8px 14px;cursor:pointer;background:#eef0f5;color:#151823}
9
+ button.go{background:#2e5bff;color:#fff}
10
+ button:focus-visible{outline:2px solid #2e5bff;outline-offset:2px}
11
+ .last{margin:-6px 0 12px;font-size:12px;color:#4a5163;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
12
+ @media (prefers-color-scheme:dark){.p{background:#151821;color:#e7e9ee;box-shadow:0 12px 32px #0008,0 0 0 1px #ffffff1a}p,.last{color:#b4bccb}button{background:#262a35;color:#e7e9ee}button.go{background:#4f78ff}}
13
+ @media (prefers-reduced-motion:reduce){.dot{animation:none}}</style>`,r.appendChild(i);let a=0,o=``,c,m=!1,h=(n=``)=>`${e.endpoint}${n}?key=${encodeURIComponent(t)}`,g=(e,t,n=!1)=>{let r=document.createElement(`button`);return r.textContent=e,n&&(r.className=`go`),r.onclick=t,r},_=(e,t,n,r={})=>{i.innerHTML=``;let a=document.createElement(`h2`);r.live&&(a.innerHTML=`<span class="dot" aria-hidden="true"></span>`),a.append(e);let o=document.createElement(`p`);if(o.textContent=t,o.setAttribute(`aria-live`,`polite`),i.append(a,o),r.note){let e=document.createElement(`div`);e.className=`last`,e.textContent=r.note,i.append(e)}let s=document.createElement(`div`);s.className=`row`,s.append(...n),i.append(s)},v=()=>{m=!0,clearTimeout(c),f.set(u,null),f.set(d,null),n.remove()},y=()=>{m=!0,f.set(u,null),f.set(d,null),_(`Capture link expired`,`Get a new link from Generate with AI in PlayStep.`,[g(`Close`,v,!0)])},b=e=>_(`Capturing · ${a} ${a===1?`page`:`pages`}`,`Open the pages your users need help with. Each one is added as you go.`,[g(`Capture this page`,()=>void x()),g(`Finish`,()=>void S(),!0)],{live:!0,note:e});async function x(){if(m)return;clearTimeout(c);let e={...p(s()),style:l()};try{let t=await fetch(h(`/screens`),{method:`POST`,headers:{"content-type":`text/plain`},body:JSON.stringify(e)});if(t.status===404||t.status===410)return y();let n=await t.json().catch(()=>({}));if(!t.ok)return b(n.message??`That page could not be added.`);a=n.screens??a+1,o=location.pathname,b(`Added ${e.title||o}`)}catch{b(`PlayStep could not be reached. It will try again on the next page.`)}}async function S(){m=!0,await fetch(h(`/finish`),{method:`POST`}).catch(()=>void 0),f.set(u,null),f.set(d,null),_(`Capture finished`,`${a} ${a===1?`page`:`pages`} captured. Go back to PlayStep to generate tours.`,[g(`Close`,()=>n.remove(),!0)])}let C=()=>{m||f.get(d)!==`1`||location.pathname===o||(clearTimeout(c),c=setTimeout(()=>void x(),1200))};for(let e of[`pushState`,`replaceState`]){let t=history[e];history[e]=function(...e){t.apply(this,e),C()}}addEventListener(`popstate`,C);let w=()=>{f.set(d,`1`),b(),C()};return f.get(d)===`1`?fetch(h()).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{a=e.screens,w()}).catch(e=>e===404?y():w()):_(`Show PlayStep your app`,`Visit the pages your users need help with. PlayStep notes the buttons, links and headings on each page. Never what you type, and no screenshots.`,[g(`Start capturing`,w,!0),g(`Not now`,v)]),{captureNow:x,stop:v}}export{p as redactScreen,s as snapshotPage,m as start};
@@ -1 +1 @@
1
- var __playstep_capture=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,n=/\+?\(?\d[\d\s().-]{5,}\d/g,o=/\d{6,}/g,r=/\b(?=[\w-]*\d)[\w-]{24,}\b/g;function l(e){return[t,r,o].some(t=>new RegExp(t.source).test(e))||[...e.matchAll(n)].some(e=>e[0].replace(/\D/g,"").length>=7)}function a(e){return e.replace(t,"[email]").replace(r,"[id]").replace(n,e=>e.replace(/\D/g,"").length>=7?"[number]":e).replace(o,"[number]")}function i(e){if(!e)return"";let t=a(e.replace(/\s+/g," ").trim());return t.length>80?`${t.slice(0,79)}…`:t}function s(e=80){let t=/^(:|radix-|headlessui-|react-|ember\d|mui-|v-|css-|sc-|jsx-)|\d{3,}|[a-f0-9]{8,}|__/i,n=/active|selected|current|open|hover|focus|disabled|hidden|show|visible|checked|loading/i,o=e=>(e??"").replace(/\s+/g," ").trim().slice(0,80),r=e=>`"${e.replace(/["\\]/g,"\\$&")}"`,l=e=>CSS.escape(e),a=e=>{try{return 1===document.querySelectorAll(e).length}catch{return!1}},i=e=>{let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return"hidden"!==n.visibility&&"none"!==n.display&&Number(n.opacity||1)>.05},s=e=>{let t=e.getAttribute("role"),n=e.tagName,o=(e.getAttribute("type")??"").toLowerCase();return"tab"===t||"menuitem"===t||"link"===t||"button"===t?t:"checkbox"===t||"switch"===t||"INPUT"===n&&("checkbox"===o||"radio"===o)?"checkbox":"A"===n?"link":"BUTTON"===n||"SUMMARY"===n||"INPUT"===n&&/^(submit|button|reset|image)$/.test(o)?"button":"SELECT"===n?"select":"INPUT"===n||"TEXTAREA"===n?"input":"other"},c=e=>{let o=e.tagName.toLowerCase(),i=[];e.id&&!t.test(e.id)&&i.push(`#${l(e.id)}`);for(let t of["data-testid","data-test","data-cy","data-qa"]){let n=e.getAttribute(t);n&&i.push(`[${t}=${r(n)}]`)}for(let t of["aria-label","name","title","placeholder"]){let n=e.getAttribute(t);n&&n.length<=80&&i.push(`${o}[${t}=${r(n)}]`)}let s=e.getAttribute("href");"a"===o&&s&&!/^javascript:/i.test(s)&&s.length<=200&&i.push(`a[href=${r(s)}]`);let c=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!t.test(e)&&!n.test(e));c.length&&i.push(`${o}.${c.slice(0,3).map(l).join(".")}`);for(let e of i)if(a(e))return e;let u=[],d=e;for(;d&&u.length<7;){if(d===document.body){u.unshift("body");break}if(d!==e&&d.id&&!t.test(d.id)){u.unshift(`#${l(d.id)}`);break}let n=d.tagName.toLowerCase(),o=d.parentElement?[...d.parentElement.children].filter(e=>e.tagName===d.tagName):[];u.unshift(o.length>1?`${n}:nth-of-type(${o.indexOf(d)+1})`:n),d=d.parentElement}let p=u.join(">");return a(p)?p:void 0},u=e=>{let t=e.getAttribute("aria-label")||e.getAttribute("title");if(t)return t;let n=e.getAttribute("aria-labelledby");if(n)return n.split(/\s+/).map(e=>document.getElementById(e)?.textContent??"").join(" ");let o=e.labels;return o?.length?o[0].innerText:""},d=[...document.querySelectorAll("a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],[data-guide]")].filter(e=>!e.closest("[data-private],[aria-hidden=true],[inert]")&&i(e)&&!e.parentElement?.closest("a[href],button,[role=button],[role=link]")).map((e,t)=>{let n=e.getBoundingClientRect(),o=n.bottom>0&&n.top<innerHeight;return{e:e,i:t,score:(e.hasAttribute("data-guide")?0:2)+ +!o}}).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,e).sort((e,t)=>e.i-t.i),p=[];for(let{e:e}of d){let t,n=s(e),r=e.getAttribute("data-guide"),l="input"===n||"select"===n?"":o(e.innerText||e.textContent),a=o(u(e))||("INPUT"===e.tagName&&"button"===n?o(e.value):""),i=o(e.getAttribute("placeholder")),d=e.getAttribute("href");if("A"===e.tagName&&d)try{let e=new URL(d,location.href);e.origin===location.origin&&(t=e.pathname)}catch{}let h=r?void 0:c(e);if(!r&&!h)continue;let m=e.getBoundingClientRect();p.push({ref:`e${p.length+1}`,role:n,...l?{text:l}:{},...a&&a!==l?{label:a}:{},...i?{placeholder:i}:{},...t?{href:t}:{},...r?{anchor:r.slice(0,64)}:{css:h.slice(0,300)},clickable:"input"!==n&&"select"!==n&&"other"!==n,rect:[m.left+scrollX,m.top+scrollY,m.width,m.height].map(Math.round)})}let h=[...document.querySelectorAll("h1,h2,h3,[role=heading]")].filter(e=>!e.closest("[data-private]")&&i(e)).map(e=>o(e.innerText)).filter(Boolean).slice(0,10);return{platform:"web",path:location.pathname||"/",...document.title?{title:o(document.title)}:{},headings:h,viewport:[innerWidth,innerHeight],elements:p}}function c(){try{return function(){let e=document.createElement("canvas");e.width=e.height=1;let t=e.getContext("2d",{willReadFrequently:!0}),n=e=>{if(!t||!e||"transparent"===e||"none"===e||(t.fillStyle="#010203",t.fillStyle=e,"#010203"===t.fillStyle&&!/^#010203$/i.test(e)))return null;t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let n=t.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]/255]},o=e=>`#${e.slice(0,3).map(e=>e.toString(16).padStart(2,"0")).join("")}`,r=e=>(Math.max(e[0],e[1],e[2])-Math.min(e[0],e[1],e[2]))/255,l=e=>{let[t,n,o]=e.slice(0,3).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*o},a=(e,t)=>{let o=n(e),r=n(t);return Math.hypot(o[0]-r[0],o[1]-r[1],o[2]-r[2])<30},i=e=>{let t=e.getBoundingClientRect();if(t.width<4||t.height<4||t.bottom<0||t.top>3*innerHeight)return null;let n=getComputedStyle(e);return"hidden"===n.visibility||"none"===n.display||Number(n.opacity||1)<.3?null:{r:t,s:n}},s=e=>{let t=n(e);return t&&t[3]>=.9?t:null},c=e=>e.length?e.sort((e,t)=>e-t)[Math.floor(e.length/2)]:void 0,u=null;for(let e of[document.querySelector("#root,#app,#__next,[data-reactroot],main"),document.body,document.documentElement])if(u=e?s(getComputedStyle(e).backgroundColor):null,u)break;for(let e=document.elementFromPoint(innerWidth/2,innerHeight/2);!u&&e;e=e.parentElement)u=s(getComputedStyle(e).backgroundColor);u??(u="dark"===getComputedStyle(document.documentElement).colorScheme.trim()?[18,18,18,1]:[255,255,255,1]);let d=l(u)<.2,p=n(getComputedStyle(document.querySelector("main")??document.body).color),h=[],m=(e,t,n)=>{let o=h.find(t=>t.from===n&&a(t.color,e));o?o.weight+=t:h.push({color:e,weight:t,from:n})},g=[],f=document.querySelectorAll("button,[role=button],input[type=submit],input[type=button],a,[class*=btn],[class*=Btn],[class*=button],[class*=Button]");for(let e of[...f].slice(0,400)){let t=i(e);if(!t)continue;let a=s(t.s.backgroundColor);if(a&&r(a)>.18&&l(a)>.02&&l(a)<.9){m(o(a),Math.min(t.r.width*t.r.height,3e4),"button");let e=Number.parseFloat(t.s.borderTopLeftRadius)||0;g.push(e>=t.r.height/2-1?999:e)}else if("A"===e.tagName){let e=n(t.s.color);e&&r(e)>.25&&m(o(e),400,"link")}}let b=getComputedStyle(document.documentElement),y=new Set,x=0;for(let e of[...document.styleSheets]){let t;try{t=e.cssRules}catch{continue}for(let e of[...t]){if(++x>3e3)break;let t=e.style;if(t&&/:root|html|body|\.light|\[data-theme/.test(e.selectorText??""))for(let e of[...t]){if(!e.startsWith("--")||y.has(e)||!/primary|accent|brand/i.test(e)||/foreground|fg|text|contrast|muted|soft|subtle|hover|active|border|ring|shadow|sidebar|chart|50\b|100\b|900\b/i.test(e))continue;y.add(e);let t=b.getPropertyValue(e).trim(),l=n(t)??n(`hsl(${t})`)??n(`rgb(${t})`)??n(`oklch(${t})`);l&&l[3]>=.9&&r(l)>.18&&m(o(l),/^--(color-)?(primary|brand)$/i.test(e)?8e4:4e4,"variable")}}}let w=n(document.querySelector("meta[name=theme-color]")?.getAttribute("content"));w&&r(w)>.18&&m(o(w),2e4,"theme-color");let S=[],v=[],k=document.querySelectorAll("section,article,aside,dialog,[role=dialog],[class*=card],[class*=Card],[class*=panel],[class*=Panel],div");for(let e of[...k].slice(0,800)){let t=i(e);if(!t||t.r.width*t.r.height<2e4||t.r.width>.95*innerWidth)continue;let n=s(t.s.backgroundColor);if(!n||r(n)>.2||a(o(n),o(u))||l(n)<.2!==d)continue;let c="none"!==t.s.boxShadow||Number.parseFloat(t.s.borderTopWidth)>0,p=o(n),h=S.find(e=>a(e.color,p)),m=Math.min(t.r.width*t.r.height,2e5)*(c?2:1);h?h.weight+=m:S.push({color:p,weight:m}),c&&v.push(Number.parseFloat(t.s.borderTopLeftRadius)||0)}let C=getComputedStyle(document.body).fontFamily,$=document.querySelector("h1,h2"),A=$?getComputedStyle($).fontFamily:void 0;return{scheme:d?"dark":"light",background:o(u),...p?{text:o(p)}:{},accents:h.sort((e,t)=>t.weight-e.weight).slice(0,8),surfaces:S.sort((e,t)=>t.weight-e.weight).slice(0,4).map(e=>e.color),...C?{font:C.slice(0,300)}:{},...A&&A!==C?{displayFont:A.slice(0,300)}:{},...g.length?{radius:c(g)}:{},...v.length?{cardRadius:c(v)}:{}}}()}catch{return}}let u="playstep_preview",d="playstep_capture_on",p=e=>{try{return sessionStorage.getItem(e)}catch{return null}},h=(e,t)=>{try{null===t?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}catch{}};function m(e){let t=e=>e&&i(e)||void 0;return{...e,title:t(e.title),headings:(e.headings??[]).map(e=>i(e)).filter(Boolean),elements:e.elements.map(e=>({...e,text:t(e.text),label:t(e.label),placeholder:t(e.placeholder),href:e.href&&!l(e.href)?e.href:void 0,css:e.css&&!l(e.css)?e.css:void 0})).filter(e=>e.anchor||e.css)}}return e.redactScreen=m,e.snapshotPage=s,e.start=function(e,t){let n=document.createElement("playstep-capture"),o=n.attachShadow({mode:"open"});document.body.appendChild(n);let r=document.createElement("div");r.className="p",r.setAttribute("role","region"),r.setAttribute("aria-label","PlayStep capture"),o.innerHTML='<style>:host{all:initial}\n.p{position:fixed;left:24px;bottom:24px;z-index:2147483001;width:320px;max-width:calc(100vw - 48px);box-sizing:border-box;padding:16px;border-radius:16px;background:#fff;color:#151823;font:14px/20px system-ui,-apple-system,"Segoe UI",sans-serif;box-shadow:0 12px 32px #15182333,0 0 0 1px #15182314}\nh2{margin:0 0 4px;font-size:15px;line-height:22px;font-weight:700;display:flex;align-items:center;gap:8px}\np{margin:0 0 12px;color:#4a5163}\n.dot{width:8px;height:8px;border-radius:50%;background:#e5484d;animation:b 1.6s ease-in-out infinite}\n@keyframes b{50%{opacity:.35}}\n.row{display:flex;gap:8px;flex-wrap:wrap}\nbutton{font:600 14px/20px inherit;font-family:inherit;border:0;border-radius:999px;padding:8px 14px;cursor:pointer;background:#eef0f5;color:#151823}\nbutton.go{background:#2e5bff;color:#fff}\nbutton:focus-visible{outline:2px solid #2e5bff;outline-offset:2px}\n.last{margin:-6px 0 12px;font-size:12px;color:#4a5163;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n@media (prefers-color-scheme:dark){.p{background:#151821;color:#e7e9ee;box-shadow:0 12px 32px #0008,0 0 0 1px #ffffff1a}p,.last{color:#b4bccb}button{background:#262a35;color:#e7e9ee}button.go{background:#4f78ff}}\n@media (prefers-reduced-motion:reduce){.dot{animation:none}}</style>',o.appendChild(r);let l,a=0,i="",g=!1,f=(n="")=>`${e.endpoint}${n}?key=${encodeURIComponent(t)}`,b=(e,t,n=!1)=>{let o=document.createElement("button");return o.textContent=e,n&&(o.className="go"),o.onclick=t,o},y=(e,t,n,o={})=>{r.innerHTML="";let l=document.createElement("h2");o.live&&(l.innerHTML='<span class="dot" aria-hidden="true"></span>'),l.append(e);let a=document.createElement("p");if(a.textContent=t,a.setAttribute("aria-live","polite"),r.append(l,a),o.note){let e=document.createElement("div");e.className="last",e.textContent=o.note,r.append(e)}let i=document.createElement("div");i.className="row",i.append(...n),r.append(i)},x=()=>{g=!0,clearTimeout(l),h(u,null),h(d,null),n.remove()},w=()=>{g=!0,h(u,null),h(d,null),y("Capture link expired","Get a new link from Generate with AI in PlayStep.",[b("Close",x,!0)])},S=e=>y(`Capturing · ${a} ${1===a?"page":"pages"}`,"Open the pages your users need help with. Each one is added as you go.",[b("Capture this page",()=>{v()}),b("Finish",()=>{!async function(){g=!0,await fetch(f("/finish"),{method:"POST"}).catch(()=>{}),h(u,null),h(d,null),y("Capture finished",`${a} ${1===a?"page":"pages"} captured. Go back to PlayStep to generate tours.`,[b("Close",()=>n.remove(),!0)])}()},!0)],{live:!0,note:e});async function v(){if(g)return;clearTimeout(l);let e={...m(s()),style:c()};try{let t=await fetch(f("/screens"),{method:"POST",headers:{"content-type":"text/plain"},body:JSON.stringify(e)});if(404===t.status||410===t.status)return w();let n=await t.json().catch(()=>({}));if(!t.ok)return S(n.message??"That page could not be added.");a=n.screens??a+1,i=location.pathname,S(`Added ${e.title||i}`)}catch{S("PlayStep could not be reached. It will try again on the next page.")}}let k=()=>{g||"1"!==p(d)||location.pathname===i||(clearTimeout(l),l=setTimeout(()=>{v()},1200))};for(let e of["pushState","replaceState"]){let t=history[e];history[e]=function(...e){t.apply(this,e),k()}}addEventListener("popstate",k);let C=()=>{h(d,"1"),S(),k()};return"1"===p(d)?fetch(f()).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{a=e.screens,C()}).catch(e=>404===e?w():C()):y("Show PlayStep your app","Visit the pages your users need help with. PlayStep notes the buttons, links and headings on each page. Never what you type, and no screenshots.",[b("Start capturing",C,!0),b("Not now",x)]),{captureNow:v,stop:x}},e}({});
1
+ var __playstep_capture=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,n=/\+?\(?\d[\d\s().-]{5,}\d/g,o=/\d{6,}/g,r=/\b(?=[\w-]*\d)[\w-]{24,}\b/g;function l(e){return[t,r,o].some(t=>new RegExp(t.source).test(e))||[...e.matchAll(n)].some(e=>e[0].replace(/\D/g,"").length>=7)}function a(e){return e.replace(t,"[email]").replace(r,"[id]").replace(n,e=>e.replace(/\D/g,"").length>=7?"[number]":e).replace(o,"[number]")}function i(e){if(!e)return"";let t=a(e.replace(/\s+/g," ").trim());return t.length>80?`${t.slice(0,79)}…`:t}function s(e=80){let t=/^(:|radix-|headlessui-|react-|ember\d|mui-|v-|css-|sc-|jsx-)|\d{3,}|[a-f0-9]{8,}|__/i,n=/active|selected|current|open|hover|focus|disabled|hidden|show|visible|checked|loading/i,o=e=>(e??"").replace(/\s+/g," ").trim().slice(0,80),r=e=>`"${e.replace(/["\\]/g,"\\$&")}"`,l=e=>CSS.escape(e),a=e=>{try{return 1===document.querySelectorAll(e).length}catch{return!1}},i=e=>{let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return"hidden"!==n.visibility&&"none"!==n.display&&Number(n.opacity||1)>.05},s=e=>{let t=e.getAttribute("role"),n=e.tagName,o=(e.getAttribute("type")??"").toLowerCase();return"tab"===t||"menuitem"===t||"link"===t||"button"===t?t:"checkbox"===t||"switch"===t||"INPUT"===n&&("checkbox"===o||"radio"===o)?"checkbox":"A"===n?"link":"BUTTON"===n||"SUMMARY"===n||"INPUT"===n&&/^(submit|button|reset|image)$/.test(o)?"button":"SELECT"===n?"select":"INPUT"===n||"TEXTAREA"===n?"input":"other"},c=e=>{let o=e.tagName.toLowerCase(),i=[];e.id&&!t.test(e.id)&&i.push(`#${l(e.id)}`);for(let t of["data-testid","data-test","data-cy","data-qa"]){let n=e.getAttribute(t);n&&i.push(`[${t}=${r(n)}]`)}for(let t of["aria-label","name","title","placeholder"]){let n=e.getAttribute(t);n&&n.length<=80&&i.push(`${o}[${t}=${r(n)}]`)}let s=e.getAttribute("href");"a"===o&&s&&!/^javascript:|[?#]/i.test(s)&&s.length<=200&&i.push(`a[href=${r(s)}]`);let c=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!t.test(e)&&!n.test(e));c.length&&i.push(`${o}.${c.slice(0,3).map(l).join(".")}`);for(let e of i)if(a(e))return e;let u=[],d=e;for(;d&&u.length<7;){if(d===document.body){u.unshift("body");break}if(d!==e&&d.id&&!t.test(d.id)){u.unshift(`#${l(d.id)}`);break}let n=d.tagName.toLowerCase(),o=d.parentElement?[...d.parentElement.children].filter(e=>e.tagName===d.tagName):[];u.unshift(o.length>1?`${n}:nth-of-type(${o.indexOf(d)+1})`:n),d=d.parentElement}let p=u.join(">");return a(p)?p:void 0},u=e=>{let t=e.getAttribute("aria-label")||e.getAttribute("title");if(t)return t;let n=e.getAttribute("aria-labelledby");if(n)return n.split(/\s+/).map(e=>document.getElementById(e)?.textContent??"").join(" ");let o=e.labels;return o?.length?o[0].innerText:""},d=[...document.querySelectorAll("a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],[data-guide]")].filter(e=>!e.closest("[data-private],[aria-hidden=true],[inert]")&&i(e)&&!e.parentElement?.closest("a[href],button,[role=button],[role=link]")).map((e,t)=>{let n=e.getBoundingClientRect(),o=n.bottom>0&&n.top<innerHeight;return{e:e,i:t,score:(e.hasAttribute("data-guide")?0:2)+ +!o}}).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,e).sort((e,t)=>e.i-t.i),p=[];for(let{e:e}of d){let t,n=s(e),r=e.getAttribute("data-guide"),l="input"===n||"select"===n?"":o(e.innerText||e.textContent),a=o(u(e))||("INPUT"===e.tagName&&"button"===n?o(e.value):""),i=o(e.getAttribute("placeholder")),d=e.getAttribute("href");if("A"===e.tagName&&d)try{let e=new URL(d,location.href);e.origin===location.origin&&(t=e.pathname)}catch{}let h=r?void 0:c(e);if(!r&&!h)continue;let m=e.getBoundingClientRect();p.push({ref:`e${p.length+1}`,role:n,...l?{text:l}:{},...a&&a!==l?{label:a}:{},...i?{placeholder:i}:{},...t?{href:t}:{},...r?{anchor:r.slice(0,64)}:{css:h.slice(0,300)},clickable:"input"!==n&&"select"!==n&&"other"!==n,rect:[m.left+scrollX,m.top+scrollY,m.width,m.height].map(Math.round)})}let h=[...document.querySelectorAll("h1,h2,h3,[role=heading]")].filter(e=>!e.closest("[data-private]")&&i(e)).map(e=>o(e.innerText)).filter(Boolean).slice(0,10);return{platform:"web",path:location.pathname||"/",...document.title?{title:o(document.title)}:{},headings:h,viewport:[innerWidth,innerHeight],elements:p}}function c(){try{return function(){let e=document.createElement("canvas");e.width=e.height=1;let t=e.getContext("2d",{willReadFrequently:!0}),n=e=>{if(!t||!e||"transparent"===e||"none"===e||(t.fillStyle="#010203",t.fillStyle=e,"#010203"===t.fillStyle&&!/^#010203$/i.test(e)))return null;t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let n=t.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]/255]},o=e=>`#${e.slice(0,3).map(e=>e.toString(16).padStart(2,"0")).join("")}`,r=e=>(Math.max(e[0],e[1],e[2])-Math.min(e[0],e[1],e[2]))/255,l=e=>{let[t,n,o]=e.slice(0,3).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*o},a=(e,t)=>{let o=n(e),r=n(t);return Math.hypot(o[0]-r[0],o[1]-r[1],o[2]-r[2])<30},i=e=>{let t=e.getBoundingClientRect();if(t.width<4||t.height<4||t.bottom<0||t.top>3*innerHeight)return null;let n=getComputedStyle(e);return"hidden"===n.visibility||"none"===n.display||Number(n.opacity||1)<.3?null:{r:t,s:n}},s=e=>{let t=n(e);return t&&t[3]>=.9?t:null},c=e=>e.length?e.sort((e,t)=>e-t)[Math.floor(e.length/2)]:void 0,u=null;for(let e of[document.querySelector("#root,#app,#__next,[data-reactroot],main"),document.body,document.documentElement])if(u=e?s(getComputedStyle(e).backgroundColor):null,u)break;for(let e=document.elementFromPoint(innerWidth/2,innerHeight/2);!u&&e;e=e.parentElement)u=s(getComputedStyle(e).backgroundColor);u??(u="dark"===getComputedStyle(document.documentElement).colorScheme.trim()?[18,18,18,1]:[255,255,255,1]);let d=l(u)<.2,p=n(getComputedStyle(document.querySelector("main")??document.body).color),h=[],m=(e,t,n)=>{let o=h.find(t=>t.from===n&&a(t.color,e));o?o.weight+=t:h.push({color:e,weight:t,from:n})},g=[],f=document.querySelectorAll("button,[role=button],input[type=submit],input[type=button],a,[class*=btn],[class*=Btn],[class*=button],[class*=Button]");for(let e of[...f].slice(0,400)){let t=i(e);if(!t)continue;let a=s(t.s.backgroundColor);if(a&&r(a)>.18&&l(a)>.02&&l(a)<.9){m(o(a),Math.min(t.r.width*t.r.height,3e4),"button");let e=Number.parseFloat(t.s.borderTopLeftRadius)||0;g.push(e>=t.r.height/2-1?999:e)}else if("A"===e.tagName){let e=n(t.s.color);e&&r(e)>.25&&m(o(e),400,"link")}}let b=getComputedStyle(document.documentElement),y=new Set,x=0;for(let e of[...document.styleSheets]){let t;try{t=e.cssRules}catch{continue}for(let e of[...t]){if(++x>3e3)break;let t=e.style;if(t&&/:root|html|body|\.light|\[data-theme/.test(e.selectorText??""))for(let e of[...t]){if(!e.startsWith("--")||y.has(e)||!/primary|accent|brand/i.test(e)||/foreground|fg|text|contrast|muted|soft|subtle|hover|active|border|ring|shadow|sidebar|chart|50\b|100\b|900\b/i.test(e))continue;y.add(e);let t=b.getPropertyValue(e).trim(),l=n(t)??n(`hsl(${t})`)??n(`rgb(${t})`)??n(`oklch(${t})`);l&&l[3]>=.9&&r(l)>.18&&m(o(l),/^--(color-)?(primary|brand)$/i.test(e)?8e4:4e4,"variable")}}}let w=n(document.querySelector("meta[name=theme-color]")?.getAttribute("content"));w&&r(w)>.18&&m(o(w),2e4,"theme-color");let S=[],v=[],k=document.querySelectorAll("section,article,aside,dialog,[role=dialog],[class*=card],[class*=Card],[class*=panel],[class*=Panel],div");for(let e of[...k].slice(0,800)){let t=i(e);if(!t||t.r.width*t.r.height<2e4||t.r.width>.95*innerWidth)continue;let n=s(t.s.backgroundColor);if(!n||r(n)>.2||a(o(n),o(u))||l(n)<.2!==d)continue;let c="none"!==t.s.boxShadow||Number.parseFloat(t.s.borderTopWidth)>0,p=o(n),h=S.find(e=>a(e.color,p)),m=Math.min(t.r.width*t.r.height,2e5)*(c?2:1);h?h.weight+=m:S.push({color:p,weight:m}),c&&v.push(Number.parseFloat(t.s.borderTopLeftRadius)||0)}let C=getComputedStyle(document.body).fontFamily,$=document.querySelector("h1,h2"),A=$?getComputedStyle($).fontFamily:void 0;return{scheme:d?"dark":"light",background:o(u),...p?{text:o(p)}:{},accents:h.sort((e,t)=>t.weight-e.weight).slice(0,8),surfaces:S.sort((e,t)=>t.weight-e.weight).slice(0,4).map(e=>e.color),...C?{font:C.slice(0,300)}:{},...A&&A!==C?{displayFont:A.slice(0,300)}:{},...g.length?{radius:c(g)}:{},...v.length?{cardRadius:c(v)}:{}}}()}catch{return}}let u="playstep_preview",d="playstep_capture_on",p=e=>{try{return sessionStorage.getItem(e)}catch{return null}},h=(e,t)=>{try{null===t?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}catch{}};function m(e){let t=e=>e&&i(e)||void 0;return{...e,title:t(e.title),headings:(e.headings??[]).map(e=>i(e)).filter(Boolean),elements:e.elements.map(e=>({...e,text:t(e.text),label:t(e.label),placeholder:t(e.placeholder),href:e.href&&!l(e.href)?e.href:void 0,css:e.css&&!l(e.css)?e.css:void 0})).filter(e=>e.anchor||e.css)}}return e.redactScreen=m,e.snapshotPage=s,e.start=function(e,t){let n=document.createElement("playstep-capture"),o=n.attachShadow({mode:"open"});document.body.appendChild(n);let r=document.createElement("div");r.className="p",r.setAttribute("role","region"),r.setAttribute("aria-label","PlayStep capture"),o.innerHTML='<style>:host{all:initial}\n.p{position:fixed;left:24px;bottom:24px;z-index:2147483001;width:320px;max-width:calc(100vw - 48px);box-sizing:border-box;padding:16px;border-radius:16px;background:#fff;color:#151823;font:14px/20px system-ui,-apple-system,"Segoe UI",sans-serif;box-shadow:0 12px 32px #15182333,0 0 0 1px #15182314}\nh2{margin:0 0 4px;font-size:15px;line-height:22px;font-weight:700;display:flex;align-items:center;gap:8px}\np{margin:0 0 12px;color:#4a5163}\n.dot{width:8px;height:8px;border-radius:50%;background:#e5484d;animation:b 1.6s ease-in-out infinite}\n@keyframes b{50%{opacity:.35}}\n.row{display:flex;gap:8px;flex-wrap:wrap}\nbutton{font:600 14px/20px inherit;font-family:inherit;border:0;border-radius:999px;padding:8px 14px;cursor:pointer;background:#eef0f5;color:#151823}\nbutton.go{background:#2e5bff;color:#fff}\nbutton:focus-visible{outline:2px solid #2e5bff;outline-offset:2px}\n.last{margin:-6px 0 12px;font-size:12px;color:#4a5163;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n@media (prefers-color-scheme:dark){.p{background:#151821;color:#e7e9ee;box-shadow:0 12px 32px #0008,0 0 0 1px #ffffff1a}p,.last{color:#b4bccb}button{background:#262a35;color:#e7e9ee}button.go{background:#4f78ff}}\n@media (prefers-reduced-motion:reduce){.dot{animation:none}}</style>',o.appendChild(r);let l,a=0,i="",g=!1,f=(n="")=>`${e.endpoint}${n}?key=${encodeURIComponent(t)}`,b=(e,t,n=!1)=>{let o=document.createElement("button");return o.textContent=e,n&&(o.className="go"),o.onclick=t,o},y=(e,t,n,o={})=>{r.innerHTML="";let l=document.createElement("h2");o.live&&(l.innerHTML='<span class="dot" aria-hidden="true"></span>'),l.append(e);let a=document.createElement("p");if(a.textContent=t,a.setAttribute("aria-live","polite"),r.append(l,a),o.note){let e=document.createElement("div");e.className="last",e.textContent=o.note,r.append(e)}let i=document.createElement("div");i.className="row",i.append(...n),r.append(i)},x=()=>{g=!0,clearTimeout(l),h(u,null),h(d,null),n.remove()},w=()=>{g=!0,h(u,null),h(d,null),y("Capture link expired","Get a new link from Generate with AI in PlayStep.",[b("Close",x,!0)])},S=e=>y(`Capturing · ${a} ${1===a?"page":"pages"}`,"Open the pages your users need help with. Each one is added as you go.",[b("Capture this page",()=>{v()}),b("Finish",()=>{!async function(){g=!0,await fetch(f("/finish"),{method:"POST"}).catch(()=>{}),h(u,null),h(d,null),y("Capture finished",`${a} ${1===a?"page":"pages"} captured. Go back to PlayStep to generate tours.`,[b("Close",()=>n.remove(),!0)])}()},!0)],{live:!0,note:e});async function v(){if(g)return;clearTimeout(l);let e={...m(s()),style:c()};try{let t=await fetch(f("/screens"),{method:"POST",headers:{"content-type":"text/plain"},body:JSON.stringify(e)});if(404===t.status||410===t.status)return w();let n=await t.json().catch(()=>({}));if(!t.ok)return S(n.message??"That page could not be added.");a=n.screens??a+1,i=location.pathname,S(`Added ${e.title||i}`)}catch{S("PlayStep could not be reached. It will try again on the next page.")}}let k=()=>{g||"1"!==p(d)||location.pathname===i||(clearTimeout(l),l=setTimeout(()=>{v()},1200))};for(let e of["pushState","replaceState"]){let t=history[e];history[e]=function(...e){t.apply(this,e),k()}}addEventListener("popstate",k);let C=()=>{h(d,"1"),S(),k()};return"1"===p(d)?fetch(f()).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{a=e.screens,C()}).catch(e=>404===e?w():C()):y("Show PlayStep your app","Visit the pages your users need help with. PlayStep notes the buttons, links and headings on each page. Never what you type, and no screenshots.",[b("Start capturing",C,!0),b("Not now",x)]),{captureNow:v,stop:x}},e}({});
@@ -1 +1 @@
1
- !function(){let e="playstep:q",t=(e,t)=>fetch(e,{method:"POST",body:t,keepalive:!0,headers:{"content-type":"text/plain"}}).then(e=>({status:e.status,retryAfter:Number(e.headers.get("retry-after"))||void 0}),()=>({status:0})),r={read(e){try{return JSON.parse(localStorage.getItem(e))??[]}catch{return[]}},write(t,r){try{r.length?localStorage.setItem(t,JSON.stringify(r)):localStorage.removeItem(t);let a=!1;for(let e=0;e<localStorage.length;e++)a||(a=!!localStorage.key(e)?.startsWith("playstep:q:"));a?localStorage.setItem(e,"1"):localStorage.removeItem(e)}catch{}}};function a(e){let a,i,n=[],l=[],s=[],o=0,u=!1,c=`${e.storageKey}:${Math.random().toString(36).slice(2,10)}`,d=()=>r.write(c,[...s,...l]),g=async r=>await(e.send?.(e.url,r))??(e.send?{status:204}:t(e.url,r));try{for(let t=localStorage.length-1;t>=0;t--){let a=localStorage.key(t);a?.startsWith(`${e.storageKey}:`)&&(l.push(...r.read(a).filter(e=>Date.now()-e.t<6048e5)),localStorage.removeItem(a))}}catch{}async function p(){if(!u&&!i){u=!0;try{for(;l.length;){let e=await g(l[0].b);if(0===e.status||408===e.status||429===e.status||e.status>=500){o=Math.min(6e4,2*o||2e3),i=setTimeout(()=>{i=void 0,p()},Math.max(o,1e3*(e.retryAfter??0)));break}o=0,l.shift(),d()}}finally{u=!1}}}function h(r=!1){clearTimeout(a),a=void 0;let i=n.length?e.envelope():null;if(i){for(;n.length;)l.push({b:JSON.stringify({...i,events:n.splice(0,20)}),t:Date.now()});l=l.slice(-25),d()}if(r){for(let r of l.splice(0))e.send?g(r.b):navigator.sendBeacon?.(e.url,r.b)||t(e.url,r.b),s.push(r);s=s.slice(-25),d()}else p()}return l=l.sort((e,t)=>e.t-t.t).slice(-25),d(),addEventListener("visibilitychange",()=>"hidden"===document.visibilityState&&h(!0)),addEventListener("pagehide",()=>h(!0)),l.length&&p(),{push(t){n.push(t),n.length>=20?h():a??(a=setTimeout(h,e.delayMs??2e3))},flush:()=>h(),get size(){return n.length},get pending(){return l.length}}}let i={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},n=/^(:|radix-|headlessui-|react-|ember\d|mui-|v-|css-|sc-|jsx-)|\d{3,}|[a-f0-9]{8,}|__/i,l=/active|selected|current|open|hover|focus|disabled|hidden|show|visible|checked|loading/i,s=e=>`"${e.replace(/["\\]/g,"\\$&")}"`,o=e=>CSS.escape(e);function u(e,t){try{return 1===e.querySelectorAll(t).length}catch{return!1}}function c(e){let t=e.getAttribute("role"),r=e.tagName,a=(e.getAttribute("type")??"").toLowerCase();return"tab"===t||"menuitem"===t||"link"===t||"button"===t?t:"checkbox"===t||"switch"===t||"INPUT"===r&&("checkbox"===a||"radio"===a)?"checkbox":"A"===r?"link":"BUTTON"===r||"SUMMARY"===r||"INPUT"===r&&/^(submit|button|reset|image)$/.test(a)?"button":"SELECT"===r?"select":"INPUT"===r||"TEXTAREA"===r?"input":"other"}function d(e){let t=e.ownerDocument,r=e.tagName.toLowerCase(),a=[];e.id&&!n.test(e.id)&&a.push(`#${o(e.id)}`);for(let t of["data-testid","data-test","data-cy","data-qa"]){let r=e.getAttribute(t);r&&a.push(`[${t}=${s(r)}]`)}for(let t of["aria-label","name","title","placeholder"]){let i=e.getAttribute(t);i&&i.length<=80&&a.push(`${r}[${t}=${s(i)}]`)}let i=e.getAttribute("href");"a"===r&&i&&!/^javascript:/i.test(i)&&i.length<=200&&a.push(`a[href=${s(i)}]`);let c=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!n.test(e)&&!l.test(e));c.length&&a.push(`${r}.${c.slice(0,3).map(o).join(".")}`);for(let e of a)if(u(t,e))return e;let d=[],g=e;for(;g&&d.length<7;){if(g===t.body){d.unshift("body");break}if(g!==e&&g.id&&!n.test(g.id)){d.unshift(`#${o(g.id)}`);break}let r=g.tagName.toLowerCase(),a=g.parentElement?[...g.parentElement.children].filter(e=>e.tagName===g.tagName):[];d.unshift(a.length>1?`${r}:nth-of-type(${a.indexOf(g)+1})`:r),g=g.parentElement}let p=d.join(">");return u(t,p)?p:void 0}function g(e){let t=e.getAttribute("aria-label")||e.getAttribute("title");if(t)return t;let r=e.getAttribute("aria-labelledby");if(r)return r.split(/\s+/).map(t=>e.ownerDocument.getElementById(t)?.textContent??"").join(" ");let a=e.labels;return a?.length?a[0].innerText:""}function p(e,t=[]){if(e.closest("[data-private],[aria-hidden=true],[inert],[data-ps-no-capture],playstep-root,playstep-capture"))return!0;for(let r of t)try{if(e.closest(r))return!0}catch{}return!1}let h=()=>crypto.randomUUID(),f=async e=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)))].map(e=>e.toString(16).padStart(2,"0")).join(""),m=e=>/^(string|number|boolean)$/.test(typeof e),y=e=>Object.keys(e).length,b=e=>(e??"").replace(/\s+/g," ").trim().slice(0,80);function v(e,t=!0){let r={};for(let a in e){let i=e[a];y(r)<50&&/^[A-Za-z_$][\w.:-]{0,63}$/.test(a)&&(null===i||m(i)||t&&Array.isArray(i)&&i.every(m))&&(r[a]=Array.isArray(i)?i.slice(0,25):i)}return r}function $(){let e,t={};for(let[e,r]of new URLSearchParams(location.search))e.startsWith("utm_")&&(t[e.slice(4)]=r);try{e=new URL(document.referrer)}catch{}return{r:e&&e.host!=location.host?e.origin:void 0,u:y(t)?t:void 0}}function w(e,t,r){let a=r&&b(/^(INPUT|SELECT|TEXTAREA)$/.test(e.tagName)?g(e):e.innerText||g(e)),i=e.href;return{selector:d(e),text:a||void 0,role:c(e),href:"string"==typeof i&&i||void 0,x:0|t.pageX,y:0|t.pageY,vw:innerWidth,vh:innerHeight}}let S=function(e={}){let t,r,n,l,s,o,u,c,m,S="",k=[],A={},T={},x={},E=[],N=e=>{let t=i.get("a:d");return!t&&e&&i.set("a:d",t=`d_${h()}`),t||void 0},I=()=>t&&(u??(!o&&t.anonymous?N(!0):void 0)),L=()=>{let e=I();if(!e)return null;let a=i.get("a:s"),n=e=>"string"==typeof e?e:void 0;return{v:1,key:S,sdk:r,actor:e,device:u&&N()||void 0,guide_key:c,traits:y(A)?A:void 0,user:t.identities&&o?{id:o,email:n(A.email),name:n(A.name)}:void 0,groups:y(T)?T:void 0,context:{platform:"web",locale:navigator.language,referrer:a?.r,utm:a?.u}}};function _(e){let t=Date.now(),r=i.get("a:s");(!r||t-r.t>18e5)&&(r={id:h(),t:t,...$()},s.push({id:h(),name:"$session_start",ts:e.ts,session:r.id})),r.t=t,i.set("a:s",r),s.push({...e,session:r.id})}let U=()=>"granted"==l&&I()&&E.splice(0).forEach(_);function M(e,r={}){if(!t||"denied"==l)return;let a={...x,...r.props},i={id:h(),name:e,ts:Date.now(),page:r.el&&m,...r,props:y(a)?a:void 0};"granted"==l&&I()?_(i):E.length<100&&E.push(i)}function O(e,r){A=v(r,!1),e==o&&e?u&&M("$identify"):(s.flush(),o=e,u=c=void 0,e?Promise.all([f(`${t.hash_key}:${e}`),f(`${S}:${e}`)]).then(([t,r])=>{o==e&&(u=`u_${t.slice(0,40)}`,c=`u_${r.slice(0,40)}`,M("$identify"),U())}):T={})}function C(){let e=[];addEventListener("click",t=>{let r=t.target;if(!(r instanceof Element))return;let a=r.closest("a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],[data-guide]");if(p(a??r,k)||(n.rage&&(e=e.filter(e=>t.timeStamp-e.t<700&&Math.abs(e.x-t.clientX)<30&&Math.abs(e.y-t.clientY)<30),3==e.push({t:t.timeStamp,x:t.clientX,y:t.clientY})&&M("$rage_click",{el:w(a??r,t,!!a)})),!a))return;let i=w(a,t,!0);if(n.clicks&&M("$click",{el:i}),n.dead){let e=!1,t=location.href,r=new MutationObserver(()=>e=!0);r.observe(document,{subtree:!0,childList:!0,attributes:!0}),setTimeout(()=>{r.disconnect(),!e&&t==location.href&&M("$dead_click",{el:i})},1e3)}},!0),n.forms&&addEventListener("submit",e=>{let t=e.target;t instanceof HTMLFormElement&&!p(t,k)&&M("$submit",{el:{selector:d(t),role:"form",text:b(g(t)||t.getAttribute("name"))}})},!0)}function j(o,u){!t&&o&&!u.preview&&crypto.subtle&&(t=o,S=u.appKey,r={name:u.sdkName||"web",version:"0.11.2"},n={...o.autocapture,...e.autocapture},k=[...o.mask,...e.mask??[]],l=i.get("a:c")??o.consent,s=a({url:o.url,storageKey:`playstep:a:q:${S}`,envelope:L,send:e.send}),C())}return{plugin:(...e)=>{"config"==e[0]?j(e[1].analytics,e[2]):t&&("identify"==e[0]?O(e[1],e[2]):"track"==e[0]?M(e[1],{props:v(e[2])}):"page"==e[0]?(m={path:e[1]},n.pages&&M("$pageview",{page:{path:e[1],title:document.title}})):(O("",{}),x={},E=[],i.set("a:d",null),i.set("a:s",null)))},setConsent:e=>{l=e?"granted":"denied",i.set("a:c",l),e?U():(E=[],i.set("a:d",null))},register:e=>{x={...x,...v(e)}},unregister:e=>{delete x[e]},group:(e,t,r)=>{(e in T||y(T)<5)&&(T[e]=t),M("$group",{props:{...v(r),group_type:e,group_id:t}})},flush:()=>s?.flush()}}(),k=window.playstepInsights;if(window.playstepInsights=S,Array.isArray(k))for(let[e,...t]of k)S[e](...t);window.playstep?.use(S.plugin)}();
1
+ !function(){let e="playstep:q",t=(e,t)=>fetch(e,{method:"POST",body:t,keepalive:!0,headers:{"content-type":"text/plain"}}).then(e=>({status:e.status,retryAfter:Number(e.headers.get("retry-after"))||void 0}),()=>({status:0})),r={read(e){try{return JSON.parse(localStorage.getItem(e))??[]}catch{return[]}},write(t,r){try{r.length?localStorage.setItem(t,JSON.stringify(r)):localStorage.removeItem(t);let n=!1;for(let e=0;e<localStorage.length;e++)n||(n=!!localStorage.key(e)?.startsWith("playstep:q:"));n?localStorage.setItem(e,"1"):localStorage.removeItem(e)}catch{}}};function n(e){let n,i,a=[],l=[],s=[],o=0,u=!1,c=`${e.storageKey}:${Math.random().toString(36).slice(2,10)}`,d=()=>r.write(c,[...s,...l]),p=async r=>await(e.send?.(e.url,r))??(e.send?{status:204}:t(e.url,r));try{for(let t=localStorage.length-1;t>=0;t--){let n=localStorage.key(t);n?.startsWith(`${e.storageKey}:`)&&(l.push(...r.read(n).filter(e=>Date.now()-e.t<6048e5)),localStorage.removeItem(n))}}catch{}async function f(){if(!u&&!i){u=!0;try{for(;l.length;){let e=await p(l[0].b);if(0===e.status||408===e.status||429===e.status||e.status>=500){o=Math.min(6e4,2*o||2e3),i=setTimeout(()=>{i=void 0,f()},Math.max(o,1e3*(e.retryAfter??0)));break}o=0,l.shift(),d()}}finally{u=!1}}}function g(r=!1){clearTimeout(n),n=void 0;let i=a.length?e.envelope():null;if(i){for(;a.length;)l.push({b:JSON.stringify({...i,events:a.splice(0,20)}),t:Date.now()});l=l.slice(-25),d()}if(r){for(let r of l.splice(0))e.send?p(r.b):navigator.sendBeacon?.(e.url,r.b)||t(e.url,r.b),s.push(r);s=s.slice(-25),d()}else f()}return l=l.sort((e,t)=>e.t-t.t).slice(-25),d(),addEventListener("visibilitychange",()=>"hidden"===document.visibilityState&&g(!0)),addEventListener("pagehide",()=>g(!0)),l.length&&f(),{push(t){a.push(t),a.length>=20?g():n??(n=setTimeout(g,e.delayMs??2e3))},flush:()=>g(),get size(){return a.length},get pending(){return l.length}}}let i={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},a=/^(:|radix-|headlessui-|react-|ember\d|mui-|v-|css-|sc-|jsx-)|\d{3,}|[a-f0-9]{8,}|__/i,l=/active|selected|current|open|hover|focus|disabled|hidden|show|visible|checked|loading/i,s=e=>`"${e.replace(/["\\]/g,"\\$&")}"`,o=e=>CSS.escape(e);function u(e,t){try{return 1===e.querySelectorAll(t).length}catch{return!1}}function c(e){let t=e.getAttribute("role"),r=e.tagName,n=(e.getAttribute("type")??"").toLowerCase();return"tab"===t||"menuitem"===t||"link"===t||"button"===t?t:"checkbox"===t||"switch"===t||"INPUT"===r&&("checkbox"===n||"radio"===n)?"checkbox":"A"===r?"link":"BUTTON"===r||"SUMMARY"===r||"INPUT"===r&&/^(submit|button|reset|image)$/.test(n)?"button":"SELECT"===r?"select":"INPUT"===r||"TEXTAREA"===r?"input":"other"}function d(e){let t=e.ownerDocument,r=e.tagName.toLowerCase(),n=[];e.id&&!a.test(e.id)&&n.push(`#${o(e.id)}`);for(let t of["data-testid","data-test","data-cy","data-qa"]){let r=e.getAttribute(t);r&&n.push(`[${t}=${s(r)}]`)}for(let t of["aria-label","name","title","placeholder"]){let i=e.getAttribute(t);i&&i.length<=80&&n.push(`${r}[${t}=${s(i)}]`)}let i=e.getAttribute("href");"a"===r&&i&&!/^javascript:|[?#]/i.test(i)&&i.length<=200&&n.push(`a[href=${s(i)}]`);let c=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!a.test(e)&&!l.test(e));c.length&&n.push(`${r}.${c.slice(0,3).map(o).join(".")}`);for(let e of n)if(u(t,e))return e;let d=[],p=e;for(;p&&d.length<7;){if(p===t.body){d.unshift("body");break}if(p!==e&&p.id&&!a.test(p.id)){d.unshift(`#${o(p.id)}`);break}let r=p.tagName.toLowerCase(),n=p.parentElement?[...p.parentElement.children].filter(e=>e.tagName===p.tagName):[];d.unshift(n.length>1?`${r}:nth-of-type(${n.indexOf(p)+1})`:r),p=p.parentElement}let f=d.join(">");return u(t,f)?f:void 0}function p(e){let t=e.getAttribute("aria-label")||e.getAttribute("title");if(t)return t;let r=e.getAttribute("aria-labelledby");if(r)return r.split(/\s+/).map(t=>e.ownerDocument.getElementById(t)?.textContent??"").join(" ");let n=e.labels;return n?.length?n[0].innerText:""}function f(e,t=[]){if(e.closest("[data-private],[aria-hidden=true],[inert],[data-ps-no-capture],playstep-root,playstep-capture"))return!0;for(let r of t)try{if(e.closest(r))return!0}catch{}return!1}let g=()=>crypto.randomUUID(),h=async e=>"u_"+[...new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)),0,20)].map(e=>e.toString(16).padStart(2,"0")).join(""),m=e=>/^(string|number|boolean)$/.test(typeof e),y=e=>Object.keys(e).length,b=e=>(e??"").replace(/\s+/g," ").trim().slice(0,80),v=e=>{try{localStorage.removeItem(`playstep:${e}`)}catch{}},$=()=>{};function w(e,t=!0){let r={};for(let n in e){let i=e[n];y(r)<50&&/^[A-Za-z_$][\w.:-]{0,63}$/.test(n)&&(null===i||m(i)||t&&Array.isArray(i)&&i.every(m))&&(r[n]=Array.isArray(i)?i.slice(0,25):i)}return r}function S(){let e={};for(let[t,r]of new URLSearchParams(location.search))t.startsWith("utm_")&&(e[t.slice(4)]=r);let t=document.referrer&&new URL(document.referrer);return{r:t&&t.host!=location.host?t.origin:void 0,u:y(e)?e:void 0}}function k(e,t,r,n){let i="";if(r&&!e.matches("input,select,textarea")){i=e.innerText;for(let t of e.querySelectorAll("*")){let e=f(t,n)&&t.innerText;e&&(i=i.includes(e)?i.replace(e,""):"")}}let a=e.href;return{selector:d(e),text:r&&(b(i)||b(p(e)))||void 0,role:c(e),href:"string"==typeof a&&a.split(/[?#]/)[0]||void 0,x:0|t.pageX,y:0|t.pageY,vw:innerWidth,vh:innerHeight}}let x=function(e={}){let t,r,a,l,s,o,u,c,m,x,A="",T=[],N=!1,I={},E={},L={},_=[],O=e=>{let t=i.get("a:d");return!t&&e&&i.set("a:d",t=`d_${g()}`),t},M=()=>t&&(c??(!u&&t.anonymous?O(!0):void 0)),U=()=>{let e=M();if(!e)return null;let n=i.get("a:s"),a=e=>"string"==typeof e?e:void 0;return{v:1,key:A,sdk:r,actor:e,device:c&&O()||void 0,guide_key:m,traits:y(I)?I:void 0,user:t.identities&&u?{id:u,email:a(I.email),name:a(I.name)}:void 0,groups:y(E)?E:void 0,context:{platform:"web",locale:navigator.language,referrer:n?.r,utm:n?.u}}};function j(e){let t=Date.now(),r=i.get("a:s");(!r||t-r.t>18e5)&&(r={id:g(),t:t,...S()},s.push({id:g(),name:"$session_start",ts:e.ts,session:r.id})),r.t=t,i.set("a:s",r),s.push({...e,session:r.id})}let C=()=>"granted"==l&&M()&&_.splice(0).forEach(j);function D(e,r={}){if(!t||"denied"==l)return;let n={...L,...r.props},i={id:g(),name:e,ts:Date.now(),page:r.el&&x,...r,props:y(n)?n:void 0};"granted"==l&&M()?j(i):_.length<100&&""!==u&&_.push(i)}function J(e,r){let n=JSON.stringify(I)==JSON.stringify(I=w(r,!1));e==u&&e?c&&!n&&D("$identify"):(s.flush(),u&&!e&&(_=[],v("a:d")),u=e||u&&"",c=m=void 0,e?Promise.all([h(`${t.hash_key}:${e}`),h(`${A}:${e}`)]).then(t=>{u==e&&([c,m]=t,D("$identify"),C())}):E={})}function P(){o={url:t.url,storageKey:`playstep:a:q:${A}`,envelope:U,send:"denied"==l?$:e.send},s=n(o)}function q(n,s){if(!t&&n&&!s.preview){if(!crypto.subtle)return void(N||(console.warn("PlayStep Insights needs a secure context"),N=!0));t=n,A=s.appKey,r={name:s.sdkName||"web",version:"0.11.3"},a={...n.autocapture,...e.autocapture},T=[...n.mask,...e.mask??[]],l=i.get("a:c")??n.consent,P(),function(){let e=[];addEventListener("click",t=>{let r=t.target;if(!(r instanceof Element))return;let n=r.closest("a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],[data-guide]");if(f(n??r,T))return;let i=!!n?.matches("a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch]")&&0!=a.text;if(a.rage&&(e=e.filter(e=>t.timeStamp-e.t<700&&Math.abs(e.x-t.clientX)<30&&Math.abs(e.y-t.clientY)<30),3==e.push({t:t.timeStamp,x:t.clientX,y:t.clientY})&&D("$rage_click",{el:k(n??r,t,i,T)})),!n)return;let l=k(n,t,i,T);if(a.clicks&&D("$click",{el:l}),a.dead){let e=!1,t=location.href,r=new MutationObserver(()=>e=!0);r.observe(document,{subtree:!0,childList:!0,attributes:!0}),setTimeout(()=>{r.disconnect(),!e&&t==location.href&&D("$dead_click",{el:l})},1e3)}},!0),a.forms&&addEventListener("submit",e=>{let t=e.target;t instanceof HTMLFormElement&&!f(t,T)&&D("$submit",{el:{selector:d(t),role:"form",text:b(p(t)||t.getAttribute("name"))}})},!0)}()}}return{plugin:(...e)=>{"config"==e[0]?q(e[1].analytics,e[2]):t&&("identify"==e[0]?J(e[1],e[2]):"track"==e[0]?D(e[1],{props:w(e[2])}):"page"==e[0]?function(e){let t=x={path:e};a.pages&&D("$pageview",{page:t}),setTimeout(()=>x==t&&(t.title=document.title),500)}(e[1]):(J("",{}),L={},_=[],v("a:d"),v("a:s")))},setConsent:e=>{l=e?"granted":"denied",i.set("a:c",l),e?(o?.send==$&&P(),C()):(_=[],v("a:d"),o&&(o.send=$,o.envelope=()=>null,s.flush()))},register:e=>{L={...L,...w(e)}},unregister:e=>{delete L[e]},group:(e,t,r)=>{(e in E||y(E)<5)&&(E[e]=t),D("$group",{props:{...w(r),group_type:e,group_id:t}})},flush:()=>s?.flush()}}(),A=window.playstepInsights;if(window.playstepInsights=x,Array.isArray(A))for(let[e,...t]of A)x[e](...t);window.playstep?.use(x.plugin)}();
@@ -1 +1 @@
1
- var __playstep_launcher=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=e=>"dark"==e||"light"==e?e:void 0;function o(e,o,r){let n=t(r)??t(e.theme?.mode)??t(o);return n?"dark"==n:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,o=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(o)return"dark"==o[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}return e.captureIntegrity="sha256-xYb6IwwD6GJoL/XyK5zw9pL4DDS0Z6+RXcBG6mP6Tig=",e.drawLauncher=function(e,t,r,n,i){let l=t.launcherGuides();if(!l.length)return;let d=o(r,i.colorMode),a=r.theme?.[d?"dark":"light"]??{},c=l.filter(e=>!t.progress.guides[e.id]).length;e.innerHTML=`<button style="position:fixed;${r.launcher.position.slice(7)}:24px;bottom:24px;z-index:2147483000;padding:15px;border:0;border-radius:50%;cursor:pointer;background:${a.accent??(d?"#7091ff":"#2e5bff")};color:${a["on-accent"]??(d?"#0c0e13":"#fff")};box-shadow:0 8px 24px #0004"><svg width=26 height=26 viewBox="0 0 24 24" fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 21a9 9 0 1 0-8.05-4.98L3 21l4.98-.95A8.96 8.96 0 0 0 12 21zM10 9v6l5-3z"/></svg>${c?`<b style="position:absolute;top:-2px;right:-2px;padding:0 6px;border-radius:9px;background:#ffc933;color:#151823;font:800 11px/20px sans-serif">${c}</b>`:""}</button>`;let s=e.firstChild;s.setAttribute("aria-label",r.words[r.lang].open_guides),s.onclick=n},e}({});
1
+ var __playstep_launcher=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=e=>"dark"==e||"light"==e?e:void 0;function o(e,o,r){let n=t(r)??t(e.theme?.mode)??t(o);return n?"dark"==n:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,o=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(o)return"dark"==o[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}return e.captureIntegrity="sha256-GR6Z1PA1Mg0YuMheouXxZY3VPZsT69SjjG8IR6P01VY=",e.drawLauncher=function(e,t,r,n,i){let l=t.launcherGuides();if(!l.length)return;let d=o(r,i.colorMode),a=r.theme?.[d?"dark":"light"]??{},c=l.filter(e=>!t.progress.guides[e.id]).length;e.innerHTML=`<button style="position:fixed;${r.launcher.position.slice(7)}:24px;bottom:24px;z-index:2147483000;padding:15px;border:0;border-radius:50%;cursor:pointer;background:${a.accent??(d?"#7091ff":"#2e5bff")};color:${a["on-accent"]??(d?"#0c0e13":"#fff")};box-shadow:0 8px 24px #0004"><svg width=26 height=26 viewBox="0 0 24 24" fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 21a9 9 0 1 0-8.05-4.98L3 21l4.98-.95A8.96 8.96 0 0 0 12 21zM10 9v6l5-3z"/></svg>${c?`<b style="position:absolute;top:-2px;right:-2px;padding:0 6px;border-radius:9px;background:#ffc933;color:#151823;font:800 11px/20px sans-serif">${c}</b>`:""}</button>`;let s=e.firstChild;s.setAttribute("aria-label",r.words[r.lang].open_guides),s.onclick=n},e}({});
@@ -1 +1 @@
1
- !function(){let e=e=>e.length>1?e.replace(/\/+$/,""):e;function t(t,n){return!!t&&void 0!==n&&(i=e(t),RegExp(`^${i.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`)).test(e(n));var i}function n(e){let n,i,r=e.progress??{seen:!1,guides:{}},s=e.traits??{},a=null,u=new Set,o=new Set,c=!1,d=e.config.flags,p=e.config.guides,l=e=>p.find(t=>t.id===e),g=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),h=(e,t)=>(t||!e.held_out)&&!c&&!d.disabled&&(!d.paused_for_new_users||r.seen)&&function(e,t){return(e??[]).every(e=>{let n=t[e.trait];return"exists"==e.op?null!=n:"in"==e.op?Array.isArray(e.value)&&e.value.includes(n):"eq"==e.op?n===e.value:"neq"==e.op&&n!==e.value})}(e.segments,s),y=e=>{let t=r.guides[e.id];return!a&&!u.has(e.id)&&h(e,1)&&(!t||("held_out"==t.status?!e.held_out:"done"!=t.status&&("running"==t.status||!e.trigger.once)))},f=(e,t,n)=>{r.guides[e.id]={...r.guides[e.id],version:e.version,step:n,status:t}},m=e=>t(e.path,i),v=e=>t(e.skip_if_on,i)||m(e.complete_on),_=e=>!i||t(e.page??"*",i),w=(e,t,i)=>{for(;t<e.steps.length;){if(a={guide:e,index:t,status:"running"},n=void 0,f(e,"running",t),i.push(g("step_shown",e,t)),!v(e.steps[t]))return i;i.push(g("step_completed",e,t++))}return a={guide:e,index:--t,status:"completed"},f(e,"done",t),i.push(g("guide_completed",e)),i},x=(e,t,n="trigger")=>(r.seen=!0,o.add(e.id),r.guides[e.id]={source:n},w(e,t,[{...g("guide_shown",e),source:n}])),$=()=>{let e=a;return w(e.guide,e.index+1,[g("step_completed",e.guide,e.index)])},S=e=>{let t=p.find(t=>y(t)&&e(t));return t?t.held_out?(f(t,"held_out",0),[g("guide_held_out",t)]):x(t,0):[]},E=e=>"first_visit"==e.trigger.type||m(e.trigger),b=(e=E)=>{let t=0,n=p.find(e=>{let n=r.guides[e.id];return t=n?.version===e.version?n.step:0,!a&&"running"==n?.status&&!u.has(e.id)&&h(e)&&_(e.steps[t])});return n?o.has(n.id)?w(n,t,[]):x(n,t,r.guides[n.id].source):S(e)};return{get active(){return c?null:a},progress:r,dispatch:function(e){let d="running"==a?.status?a.guide.steps[a.index]:null,p=c?null:d;switch(e.type){case"init":return i=e.path,u.clear(),o.clear(),b();case"pause":return c=!0,[];case"arrived":return S(t=>e.guides.includes(t)&&E(t));case"resume":return c?(c=!1,b()):[];case"page_view":return i=e.path,c||"waiting"!=a?.status?p&&v(p)?$():(d&&!_(d)&&(a=null),b(e=>m(e.trigger))):x(a.guide,0,a.source);case"reset_progress":{let t="string"==typeof e.guide&&l(e.guide);return void 0===t?[]:((!t||a?.guide===t)&&(a=null),t?delete r.guides[t.id]:r.guides={},[{type:"progress_reset",...t&&{guide_id:t.id}},...(u.clear(),S(E))])}case"event":return"event"==p?.complete_on.type&&p.complete_on.name===e.name?$():S(t=>"event"==t.trigger.type&&t.trigger.name===e.name);case"tap":return"tap_anchor"==p?.complete_on.type&&p.anchor===e.anchor?$():[];case"complete":return p?.id===e.step?$():[];case"next":return"next_button"==p?.complete_on.type?$():[];case"back":return p&&0!==a.index?(a={...a,index:a.index-1},f(a.guide,"running",a.index),[g("step_shown",a.guide,a.index)]):[];case"hide":return p&&(u.add(a.guide.id),a=null),[];case"close":if("completed"!=a?.status)return[];case"dismiss":{let e=a;return a=null,d?(f(e.guide,"dismissed",e.index),[g("guide_dismissed",e.guide,e.index)]):"completed"==e?.status?b(t=>m(t.trigger)||t.trigger.guide==e.guide.id):[]}case"start":{let n=l(e.guide);if(!n||!h(n)||p&&a.guide===n&&n.steps.slice(0,a.index).every(v))return[];let r=e.source??"api";return e.to&&!t(n.start_path,i)?(a={guide:n,index:0,status:"waiting",source:r},[]):x(n,0,r)}case"anchor_missing":return p&&p.anchor===e.anchor&&n!==e.anchor?(n=e.anchor,[{...g("anchor_missing",a.guide,a.index),anchor:e.anchor}]):[];case"identify":return s={...s,...e.traits},[]}},launcherGuides:()=>p.filter(e=>e.launcher&&h(e)),use(e){let t=e.guides.filter(e=>!l(e.id));return p=e.guides,a&&(a={...a,guide:l(a.guide.id)??a.guide}),t}}}let i={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},r="playstep_preview",s=document.currentScript;function a(e,t){return new Promise((n,i)=>{document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,s?.src||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>n(window[`__playstep_${e}`]),onerror:()=>i(Error(e))}))})}let u=()=>a("launcher","sha256-9tsCv75S3cus4vUFhh/YRYoBnNHADIrpN7L5CDavv0s="),o=function(e,t,s,a){let u,o,c,d,p,l,g,h,y,f,m,v={},_=!1,w=[],x=[],$=[],S=[],E=()=>`p:${u.appKey}`,b=e=>{let t=e.progress,n=o.progress;if(t&&p!=m){m&&Object.assign(n,{seen:!1,guides:{}}),t.seen&&(n.seen=!0),Object.assign(n.guides,t.guides);for(let e of t.reset)delete n.guides[e];m=p}},L=()=>u.preview||i.set(E(),o.progress),K=e=>{let t={...e,ts:Date.now()};u?.preview||(l?l.send(t):x.push(t)),u?.onEvent?.(t)},I=e=>{try{K({type:"sdk_error",message:String(e)})}catch{}},U=e=>(...t)=>{try{e(...t)}catch(e){I(e)}},j=(...e)=>S?S.length<50&&S.push(e):$.forEach(t=>U(t)(...e)),O=(e,t)=>U(n=>k({type:e,[t]:n}));function k(e){if(!o)return void w.push(e);if("start"==e.type&&void 0===e.to&&u.navigate)return void P().then(t=>t?.start(e));let t=o.dispatch(e);L(),t.forEach(U(K)),(o.active||i.get("q")||x.length)&&P(),l?.update()}function A(){return h??(h=document.body.appendChild(document.createElement("playstep-root")).attachShadow({mode:"open"}))}function P(){return g??(g=e().then(e=>{let t=A();return t.innerHTML="",l=e.mount({engine:o,get config(){return c},options:u,root:t,outbox:x,userId:()=>y,dispatch:U(k),emit:U(K)})}).catch(I))}let T,C=()=>{let e=u?.locale??navigator.language??"",t=y;d?.(e).then(n=>{n.guides&&(u.locale??navigator.language??"")==e&&t==y&&(b(n),k({type:"arrived",guides:o.use(c=n)}))}).catch(I)},H=U((e={})=>{o?o.launcherGuides().length&&P().then(t=>t?.openLauncher(e.anchor)):T=e});function R(e){e.launcher?.enabled&&o.launcherGuides().length&&!g&&t&&t().then(t=>{g||t.drawLauncher(A(),o,e,H,u)}).catch(I)}let Y=e=>U(()=>{_!==e&&(_=e,o&&(k({type:e?"pause":"resume"}),!g&&(e?h&&(h.innerHTML=""):R(c))))}),D={version:"0.11.2",init:U(e=>{if(u||!e?.appKey)return;u={...e},f&&(u.locale=f);let t=()=>setTimeout(()=>async function(){let e=u,t=(e.apiBase??"https://cdn.playstep.app").replace(/\/$/,""),l=null;try{l=new URLSearchParams(location.search).get(r)||(e.config?null:sessionStorage.getItem(r))}catch{}e.preview||(e.preview=!(!e.config&&!l)),d=async n=>{let i="";p=y;try{y&&!l&&(i="&u="+btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(`${e.appKey}:${y}`))))))}catch{}return(await fetch(`${t}/v2/${l?`preview/${l}?key=${e.appKey}&`:`config/${e.appKey}?`}v=2&l=${n}${i}`)).json()};let g=e.config;try{g??(g=await d(u?.locale??navigator.language??""))}catch{return}try{l&&sessionStorage[g.guides?"setItem":"removeItem"](r,l)}catch{}if(g?.capture)s?.().then(t=>t.start(g.capture,e.appKey)).catch(I);else if(g?.guides&&!g.flags?.disabled&&(c=g,e.eventsUrl=g.ingest_url??`${t}/v1/events`,g.analytics||(S=void 0),$.splice(0).forEach(D.use),S&&a?.().catch(I),o=n({config:g,progress:e.preview?void 0:i.get(E()),traits:v}),b(g),_&&o.dispatch({type:"pause"}),k({type:"init",path:location.pathname}),w.splice(0).forEach(k),T&&H(T),R(g),!e.config&&p!=y&&C(),!1!==e.autoPageViews)){let e=location.pathname;j("page",e);let t=U(()=>location.pathname!==e&&D.page(e=location.pathname));for(let e of["pushState","replaceState"]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener("popstate",t)}}().catch(I));"complete"==document.readyState?t():addEventListener("load",t)}),identify:U((e,t)=>{y=e,v={...v,...t},k({type:"identify",traits:v}),j("identify",e,v),c&&e!=p&&!u.config&&C()}),track:U((e,t)=>{k({type:"event",name:e}),j("track",e,t)}),start:O("start","guide"),complete:O("complete","step"),page:U((e=location.pathname)=>{k({type:"page_view",path:e}),j("page",e)}),openLauncher:H,resetProgress:O("reset_progress","guide"),reset:U(()=>{k({type:"dismiss"}),y=void 0,v={},o&&(Object.assign(o.progress,{seen:!1,guides:{}}),L(),l?.update()),u?.preview||i.set("d",null),j("reset")}),pause:Y(!0),resume:Y(!1),isPaused:()=>_,setLocale:U(e=>{f=e,u&&(u.locale=e),C()}),use:U(e=>{$.push(e),c&&(U(e)("config",c,u),S&&(()=>{let e=S;S=void 0,e.forEach(e=>j(...e))})())})};return D}(()=>a("ui","sha256-uHYzIstISah3JFX8/T7+YtdJoaUzftsK/h2pEoVjy/w="),u,()=>u().then(e=>a("capture",e.captureIntegrity)),()=>a("insights","sha256-++PAfmiuuL4Dws2GxlRUFTerimnKYUWgsslLtE7bViU="));if(!window.playstep){window.playstep=o;let e=s?.dataset;e?.appKey&&o.init({appKey:e.appKey,apiBase:e.api,locale:e.locale})}}();
1
+ !function(){let e=e=>e.length>1?e.replace(/\/+$/,""):e;function t(t,n){return!!t&&void 0!==n&&(r=e(t),RegExp(`^${r.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`)).test(e(n));var r}function n(e){let n,r,i=e.progress??{seen:!1,guides:{}},s=e.traits??{},a=null,u=new Set,o=new Set,d=!1,c=e.config.flags,p=e.config.guides,l=e=>p.find(t=>t.id===e),g=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),h=(e,t)=>(t||!e.held_out)&&!d&&!c.disabled&&(!c.paused_for_new_users||i.seen)&&function(e,t){return(e??[]).every(e=>{let n=t[e.trait];return"exists"==e.op?null!=n:"in"==e.op?Array.isArray(e.value)&&e.value.includes(n):"eq"==e.op?n===e.value:"neq"==e.op&&n!==e.value})}(e.segments,s),y=e=>{let t=i.guides[e.id];return!a&&!u.has(e.id)&&h(e,1)&&(!t||("held_out"==t.status?!e.held_out:"done"!=t.status&&("running"==t.status||!e.trigger.once)))},f=(e,t,n)=>{i.guides[e.id]={...i.guides[e.id],version:e.version,step:n,status:t}},m=e=>t(e.path,r),v=e=>t(e.skip_if_on,r)||m(e.complete_on),_=e=>!r||t(e.page??"*",r),w=(e,t,r)=>{for(;t<e.steps.length;){if(a={guide:e,index:t,status:"running"},n=void 0,f(e,"running",t),r.push(g("step_shown",e,t)),!v(e.steps[t]))return r;r.push(g("step_completed",e,t++))}return a={guide:e,index:--t,status:"completed"},f(e,"done",t),r.push(g("guide_completed",e)),r},x=(e,t,n="trigger")=>(i.seen=!0,o.add(e.id),i.guides[e.id]={source:n},w(e,t,[{...g("guide_shown",e),source:n}])),$=()=>{let e=a;return w(e.guide,e.index+1,[g("step_completed",e.guide,e.index)])},S=e=>{let t=p.find(t=>y(t)&&e(t));return t?t.held_out?(f(t,"held_out",0),[g("guide_held_out",t)]):x(t,0):[]},E=e=>"first_visit"==e.trigger.type||m(e.trigger),b=(e=E)=>{let t=0,n=p.find(e=>{let n=i.guides[e.id];return t=n?.version===e.version?n.step:0,!a&&"running"==n?.status&&!u.has(e.id)&&h(e)&&_(e.steps[t])});return n?o.has(n.id)?w(n,t,[]):x(n,t,i.guides[n.id].source):S(e)};return{get active(){return d?null:a},progress:i,dispatch:function(e){let c="running"==a?.status?a.guide.steps[a.index]:null,p=d?null:c;switch(e.type){case"init":return r=e.path,u.clear(),o.clear(),b();case"pause":return d=!0,[];case"arrived":return S(t=>e.guides.includes(t)&&E(t));case"resume":return d?(d=!1,b()):[];case"page_view":return r=e.path,d||"waiting"!=a?.status?p&&v(p)?$():(c&&!_(c)&&(a=null),b(e=>m(e.trigger))):x(a.guide,0,a.source);case"reset_progress":{let t="string"==typeof e.guide&&l(e.guide);return void 0===t?[]:((!t||a?.guide===t)&&(a=null),t?delete i.guides[t.id]:i.guides={},[{type:"progress_reset",...t&&{guide_id:t.id}},...(u.clear(),S(E))])}case"event":return"event"==p?.complete_on.type&&p.complete_on.name===e.name?$():S(t=>"event"==t.trigger.type&&t.trigger.name===e.name);case"tap":return"tap_anchor"==p?.complete_on.type&&p.anchor===e.anchor?$():[];case"complete":return p?.id===e.step?$():[];case"next":return"next_button"==p?.complete_on.type?$():[];case"back":return p&&0!==a.index?(a={...a,index:a.index-1},f(a.guide,"running",a.index),[g("step_shown",a.guide,a.index)]):[];case"hide":return p&&(u.add(a.guide.id),a=null),[];case"close":if("completed"!=a?.status)return[];case"dismiss":{let e=a;return a=null,c?(f(e.guide,"dismissed",e.index),[g("guide_dismissed",e.guide,e.index)]):"completed"==e?.status?b(t=>m(t.trigger)||t.trigger.guide==e.guide.id):[]}case"start":{let n=l(e.guide);if(!n||!h(n)||p&&a.guide===n&&n.steps.slice(0,a.index).every(v))return[];let i=e.source??"api";return e.to&&!t(n.start_path,r)?(a={guide:n,index:0,status:"waiting",source:i},[]):x(n,0,i)}case"anchor_missing":return p&&p.anchor===e.anchor&&n!==e.anchor?(n=e.anchor,[{...g("anchor_missing",a.guide,a.index),anchor:e.anchor}]):[];case"identify":return s={...s,...e.traits},[]}},launcherGuides:()=>p.filter(e=>e.launcher&&h(e)),use(e){let t=e.guides.filter(e=>!l(e.id));return p=e.guides,a&&(a={...a,guide:l(a.guide.id)??a.guide}),t}}}let r={get(e){try{return JSON.parse(localStorage.getItem(`playstep:${e}`))}catch{}},set(e,t){try{localStorage.setItem(`playstep:${e}`,JSON.stringify(t))}catch{}}},i="playstep_preview",s=document.currentScript;function a(e,t){return new Promise((n,r)=>{document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,s?.src||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))})}let u=()=>a("launcher","sha256-7GduXkKwWst9CfjWlle2/CzedQlyYz8xP2loNKqBvUU="),o=function(e,t,s,a){let u,o,d,c,p,l,g,h,y,f,m,v={},_=!1,w=[],x=[],$=[],S=[],E=()=>`p:${u.appKey}`,b=e=>{let t=e.progress,n=o.progress;if(t&&p!=m){m&&Object.assign(n,{seen:!1,guides:{}}),t.seen&&(n.seen=!0),Object.assign(n.guides,t.guides);for(let e of t.reset)delete n.guides[e];m=p}},K=()=>u.preview||r.set(E(),o.progress),L=e=>{let t={...e,ts:Date.now()};u?.preview||(l?l.send(t):x.push(t)),u?.onEvent?.(t)},I=e=>{try{L({type:"sdk_error",message:String(e)})}catch{}},j=e=>(...t)=>{try{e(...t)}catch(e){I(e)}},k=(...e)=>S?S.length<50&&S.push(e):$.forEach(t=>j(t)(...e)),O=(e,t)=>j(n=>q({type:e,[t]:n}));function q(e){if(!o)return void w.push(e);if("start"==e.type&&void 0===e.to&&u.navigate)return void B().then(t=>t?.start(e));let t=o.dispatch(e);K(),t.forEach(j(L)),(o.active||r.get("q")||x.length)&&B(),l?.update()}function U(){return h??(h=document.body.appendChild(document.createElement("playstep-root")).attachShadow({mode:"open"}))}function B(){return g??(g=e().then(e=>{let t=U();return t.innerHTML="",l=e.mount({engine:o,get config(){return d},options:u,root:t,outbox:x,userId:()=>y,dispatch:j(q),emit:j(L)})}).catch(I))}let C,N=()=>{let e=u?.locale??navigator.language??"",t=y;c?.(e).then(n=>{n.guides&&(u.locale??navigator.language??"")==e&&t==y&&(b(n),q({type:"arrived",guides:o.use(d=n)}))}).catch(I)},P=j((e={})=>{o?o.launcherGuides().length&&B().then(t=>t?.openLauncher(e.anchor)):C=e});function A(e){e.launcher?.enabled&&o.launcherGuides().length&&!g&&t&&t().then(t=>{g||t.drawLauncher(U(),o,e,P,u)}).catch(I)}let G=e=>j(()=>{_!==e&&(_=e,o&&(q({type:e?"pause":"resume"}),!g&&(e?h&&(h.innerHTML=""):A(d))))}),H={version:"0.11.3",init:j(e=>{if(u||!e?.appKey)return;u={...e},f&&(u.locale=f);let t=()=>setTimeout(()=>async function(){let e=u,t=(e.apiBase??"https://cdn.playstep.app").replace(/\/$/,""),l=null;try{l=new URLSearchParams(location.search).get(i)||(e.config?null:sessionStorage.getItem(i))}catch{}e.preview||(e.preview=!(!e.config&&!l)),c=async n=>{let r="";p=y;try{y&&!l&&(r="&u="+btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(`${e.appKey}:${y}`))))))}catch{}return(await fetch(`${t}/v2/${l?`preview/${l}?key=${e.appKey}&`:`config/${e.appKey}?`}v=2&l=${n}${r}`)).json()};let g=e.config;try{g??(g=await c(u?.locale??navigator.language??""))}catch{return}try{l&&sessionStorage[g.guides?"setItem":"removeItem"](i,l)}catch{}if(g?.capture)s?.().then(t=>t.start(g.capture,e.appKey)).catch(I);else if(g?.guides&&!g.flags?.disabled&&(d=g,e.eventsUrl=g.ingest_url??`${t}/v1/events`,g.analytics||(S=void 0),$.splice(0).forEach(H.use),S&&a?.().catch(I),o=n({config:g,progress:e.preview?void 0:r.get(E()),traits:v}),b(g),_&&o.dispatch({type:"pause"}),q({type:"init",path:location.pathname}),w.splice(0).forEach(q),C&&P(C),A(g),!e.config&&p!=y&&N(),!1!==e.autoPageViews)){let e=location.pathname;k("page",e);let t=j(()=>location.pathname!==e&&H.page(e=location.pathname));for(let e of["pushState","replaceState"]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener("popstate",t)}}().catch(I));"complete"==document.readyState?t():addEventListener("load",t)}),identify:j((e,t)=>{y=e,v={...v,...t},q({type:"identify",traits:v}),k("identify",e,v),d&&e!=p&&!u.config&&N()}),track:j((e,t)=>{q({type:"event",name:e}),k("track",e,t)}),start:O("start","guide"),complete:O("complete","step"),page:j((e=location.pathname)=>{q({type:"page_view",path:e}),k("page",e)}),openLauncher:P,resetProgress:O("reset_progress","guide"),reset:j(()=>{q({type:"dismiss"}),y=void 0,v={},o&&(Object.assign(o.progress,{seen:!1,guides:{}}),K(),l?.update()),u?.preview||r.set("d",null),k("reset")}),pause:G(!0),resume:G(!1),isPaused:()=>_,setLocale:j(e=>{f=e,u&&(u.locale=e),N()}),use:j(e=>{$.push(e),d&&(j(e)("config",d,u),S&&(()=>{let e=S;S=void 0,e.forEach(e=>k(...e))})())})};return H}(()=>a("ui","sha256-/y7HfDIBoJyKEHisQ3htah3SjNNdha3oBr1kmu0XaOM="),u,()=>u().then(e=>a("capture",e.captureIntegrity)),()=>a("insights","sha256-MnGrBRTqQYv/FtllU8ge1NheI+mt7S0qwhqZlCo7MrA="));if(!window.playstep){window.playstep=o;let e=s?.dataset;e?.appKey&&o.init({appKey:e.appKey,apiBase:e.api,locale:e.locale})}}();
package/dist/cdn/ui.js CHANGED
@@ -1 +1 @@
1
- var __playstep_ui=function(e){function t(e,t){let i=e=>!!e?.getClientRects().length,a=[...document.querySelectorAll(`[data-guide="${CSS.escape(e)}"]`)].find(i)??null;try{a||(a=t?[...document.querySelectorAll(t.css)].find(e=>i(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return i(a)?a:null}Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let i=e=>"dark"==e||"light"==e?e:void 0;function a(e,t,a){let s=i(a)??i(e.theme?.mode)??i(t);return s?"dark"==s:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,i=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(i)return"dark"==i[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}let s=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},n={x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',play:'<path d="M5 5a2 2 0 0 1 3-1.7l12 7a2 2 0 0 1 0 3.5l-12 7A2 2 0 0 1 5 19z"/>',"volume-2":'<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.4 18.4a9 9 0 0 0 0-12.7"/>',"volume-x":'<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="m16.5 14.5 5-5"/><path d="m16.5 9.5 5 5"/>',check:'<path d="M20 6 9 17l-5-5"/>',"maximize-2":'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',"arrow-right":'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',"rotate-ccw":'<path d="M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"/><path d="M3 3v5h5"/>',"external-link":'<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',"ps-launcher":'<path d="M12 21a9 9 0 1 0-8-5L3 21l5-.9A9 9 0 0 0 12 21z"/><path d="M10 9v6l5-3z"/>',"ps-level-up":'<path d="M3 21h5v-4h5v-4h5V9"/><path d="M18 9V3l4 2.5L18 8"/>',"ps-guide":'<rect x="4" y="3" width="4" height="18" rx="2"/><path d="M12 5.5v10l7.5-5z"/>'};function r(e,t,...i){let a=document.createElement(e);for(let e in t){let i=t[e];if(null!=i&&!1!==i)if("o"==e[0]&&"n"==e[1])a.addEventListener(e.slice(2).toLowerCase(),i);else if("ref"==e)i(a);else if("style"==e)for(let e in i)a.style.setProperty(e,i[e]);else a.setAttribute(e,!0===i?"":String(i))}return o(a,i),a}function o(e,t){for(let i of t)Array.isArray(i)?o(e,i):null!=i&&!1!==i&&e.appendChild("object"==typeof i?i:document.createTextNode(String(i)))}let l=document.createElement("template");function p(e){return l.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n[e]}</svg>`,l.content.firstChild}let d=(e,...t)=>{e.textContent="",o(e,t)},c=(e,t=e.config.lang)=>(i,a)=>((e,t={})=>e.replace(/\{(\w+)\}/g,(e,i)=>i in t?String(t[i]):e))(e.config.words[t]?.[i]??i,a);function u(e,t,i,a,s,n){(!n||function(e){try{let t=JSON.parse(sessionStorage.getItem("playstep:clips")??"[]");if(t.includes(e))return!1;sessionStorage.setItem("playstep:clips",JSON.stringify([...t,e].slice(-200)))}catch{}return!0}(`${s}|${a.url}`))&&e.emit({type:s,guide_id:t.id,guide_version:t.version,step_id:t.steps[i].id,step_index:i,clip_id:a.clip_id,clip_source:a.source})}function h(e,t,i,a,n,o,l){let h=c(e,t.lang),f=t.steps[i].title,g=r("div",{class:"clip"}),m=!0,b=a.duration_ms??0;if("embed"==a.kind)return g.className="clip embed",d(g,a.poster&&r("img",{src:a.poster,alt:""}),r("button",{class:"play","aria-label":h("play_video"),onClick:()=>{d(g,r("iframe",{src:a.url,title:h("video",{title:f}),allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowfullscreen:!0})),u(e,t,i,a,"clip_played")}},p("play")),r("div",{class:"bar"},r("span",{class:"pill"},p("external-link"),a.label,b?` · ${s(b)}`:""))),l(0),g;let x=()=>{let n=r("video",{src:a.url,poster:a.poster,loop:!0,autoplay:!0,playsinline:!0,preload:"auto","aria-label":h("clip",{title:f}),onLoadeddata:()=>u(e,t,i,a,"clip_loaded",!0),onPlaying:()=>u(e,t,i,a,"clip_played",!0),onLoadedmetadata:()=>{Number.isFinite(n.duration)&&(b=1e3*n.duration,c.textContent=`${s(b)} `,l(b))}});n.muted=!0;let c=r("span",null,b?`${s(b)} `:""),x=r("button",{class:"round","aria-label":h("unmute_clip"),onClick:()=>{m=!m,n.muted=m,x.setAttribute("aria-label",h(m?"unmute_clip":"mute_clip")),d(x,p(m?"volume-x":"volume-2")),m||u(e,t,i,a,"clip_unmuted")}},p("volume-x")),v=r("button",{class:"round","aria-label":h("expand_clip"),"aria-pressed":"false",onClick:()=>{let e=o.classList.toggle("big");v.setAttribute("aria-label",h(e?"shrink_clip":"expand_clip")),v.setAttribute("aria-pressed",String(e))}},p("maximize-2"));d(g,n,r("div",{class:"bar"},r("span",{class:"pill"},p("play"),c,h("loop")),x,v)),n.play()?.catch(()=>{}),l(b)};return n?d(g,a.poster&&r("img",{src:a.poster,alt:""}),r("button",{class:"play","aria-label":h("play_clip"),onClick:x},p("play"))):x(),g}function f(e,t,i,a,s){let n=t.steps[i],o=t.steps.length,l=c(e,t.lang),f="next_button"==n.complete_on.type,g=n.media,m=l("step_of",{n:i+1,total:o}),b=t.steps.map((e,t)=>r("span",{class:"seg"+(t<i?" done":t==i?" cur":"")}));s.classList.remove("big"),s.dataset.step=n.id,s.lang=t.lang,t.rtl?s.dir="rtl":s.removeAttribute("dir"),d(s,"image"==g?.kind?r("div",{class:"clip img"},r("img",{src:g.url,alt:g.label??"",width:g.width,height:g.height})):g&&h(e,t,i,g,a,s,e=>{let t=b[i];t.className="seg cur"+(e&&!a?" anim":""),e?t.style.setProperty("--d",`${e}ms`):t.style.removeProperty("--d")}),r("div",{class:"body"},r("div",{class:"meta"},r("span",null,`${m} · ${t.name}`),r("button",{class:"x","aria-label":l("close_guide"),onClick:()=>e.dispatch({type:"dismiss"})},p("x"))),r("div",{class:"steps",role:"img","aria-label":m},b),r("h2",{class:"title",id:"ps-title"},n.title),r("p",{class:"text",id:"ps-text"},n.body)),r("div",{class:"foot"},f?r("span",{class:"sp"}):r("span",{class:"wait"},r("span",{class:"pulse","aria-hidden":"true"}),l("waiting")),n.back&&r("button",{class:"btn gho",onClick:()=>e.dispatch({type:"back"})},l("back")),f&&r("button",{class:"btn pri",onClick:()=>e.dispatch({type:"next"})},l(i+1==o?"done":"next"),p("arrow-right"))));let x=t.steps[i+1]?.media;if(x&&"embed"!=x.kind&&!a&&!navigator.connection?.saveData)if("image"==x.kind)(new Image).src=x.url;else{let a=document.createElement("video");a.preload="auto",a.muted=!0,a.src=x.url,"hosted"==x.source&&u(e,t,i+1,x,"clip_loaded",!0)}}function g(e,t,i,a,s,n=!1,r=12){let o={bottom:e.bottom+s+i<=innerHeight-r,top:e.top-s-i>=r,left:e.left-s-t>=r,right:e.right+s+t<=innerWidth-r},l=a.find(e=>o[e])??a[0],p=(e,t)=>Math.max(r,Math.min(e,t-r));return"top"==l||"bottom"==l?{x:p(n?e.left:e.left+(e.width-t)/2,innerWidth-t),y:"top"==l?e.top-s-i:e.bottom+s}:{x:"left"==l?e.left-s-t:e.right+s,y:p(e.top+(e.height-i)/2,innerHeight-i)}}let m=document.currentScript?.src,b=(e,t,i)=>t?new Promise((i,a)=>document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,m||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>i(window[`__playstep_${e}`]),onerror:()=>a(Error(e))}))):i(),x=()=>b("events","sha256-4vyjrnK5rttEM/kZCgUVyDOH2+Q28gM+5u/1U5TZHWw=",()=>import("../core/transport")),v=()=>b("list","sha256-28L8SfXyI2tnqGcN1BhJvRjS6lhEYeXgyl9SH/E2Npk=",()=>import("./list")),y=()=>b("done","sha256-NQjGrSn5EuVz6RfEcLwXPj+spBN6kWyQkMIO8c3LAg8=",()=>import("./done"));function k(e,t,i){let a=c(e),s=e.engine.launcherGuides().filter(t=>!e.engine.progress.guides[t.id]).length;t.className="lb"+("bottom-left"==e.config.launcher.position?" left":""),t.setAttribute("aria-label",a(i?"close_guides":"open_guides")),t.setAttribute("aria-expanded",String(i)),d(t,p("ps-launcher"),s>0&&!i&&r("span",{class:"cnt"},s))}function w(e){let t=location.pathname.split("/"),i=!0,a=e.split("/").map((e,a)=>"*"==e?t[a]||(i=!1,""):e).join("/");return i?a:""}let _=(e,t,i,a)=>(e.addEventListener(t,i,a),()=>e.removeEventListener(t,i,a));function M(e,i,a){let s,n,o=r("div",{class:"card",role:"dialog","aria-modal":"false","aria-labelledby":"ps-title","aria-describedby":"ps-text",tabindex:"-1",style:{visibility:"hidden"}}),l=r("div",{class:"spot","aria-hidden":"true"}),p=r("div",{class:"scrim","aria-hidden":"true"}),d=!1,c=!1,u=-1,h=null,m=[],b=[],x=[],v=!1,y="",k="",w=e=>e.splice(0).forEach(e=>e()),M=()=>s.steps[u];function S(e,t,i){o.style.transform=`translate(${Math.round(e)}px,${Math.round(t)}px)`,o.style.visibility="",v||(o.style.transition="none",requestAnimationFrame(()=>(v=!0,o.style.transition=""))),d!=!(!h||!i)&&(d=!d,a()),h&&i&&Object.assign(l.style,{width:`${i.w}px`,height:`${i.h}px`,transform:`translate(${i.x}px,${i.y}px)`,borderRadius:`${i.r}px`}),y!=M().id&&(y=M().id,document.hasFocus()&&!document.activeElement?.matches("input,textarea,select,[contenteditable]:not([contenteditable=false])")&&o.focus({preventScroll:!0}))}function $(){w(x);let e=o;if(c!=(!h&&"center"==s.position)&&(c=!c,a()),!h){let t=()=>S((innerWidth-e.offsetWidth)/2,"center"==s.position?(innerHeight-e.offsetHeight)/2:innerHeight-e.offsetHeight-24);t();let i=new ResizeObserver(t);return i.observe(e),void x.push(()=>i.disconnect(),_(window,"resize",t))}let t=h,n=t.getBoundingClientRect();(n.bottom<0||n.top>innerHeight)&&t.scrollIntoView({block:"center",behavior:i?"auto":"smooth"});let r=()=>{let i=t.getBoundingClientRect(),a=Number.parseFloat(getComputedStyle(t).borderTopLeftRadius)||8,s=M().placement,{x:n,y:r}=g(i,e.offsetWidth,e.offsetHeight,["auto"==s?"bottom":s,"top","left","right"],18);S(n,r,{x:i.left-6,y:i.top-6,w:i.width+12,h:i.height+12,r:Math.min(a+6,(i.height+12)/2)})};r();let l=new ResizeObserver(r);l.observe(t),l.observe(e);let p=setInterval(r,400);x.push(()=>l.disconnect(),()=>clearInterval(p),_(window,"scroll",r,{capture:!0,passive:!0}),_(window,"resize",r))}function C(i){h=i,w(b),clearTimeout(n);let a=M();if(i)b.push(_(document,"click",t=>{t.composedPath().includes(i)&&(k="",e.dispatch({type:"tap",anchor:a.anchor}))},!0)),i==t(a.anchor,a.find?.web)&&(k=a.id);else if(k==a.id){let i=u;n=setTimeout(()=>{for(let a=i;a--;){let n=s.steps[a];if(!n.anchor||"page"==n.complete_on.type)return;if(t(n.anchor,n.find?.web)){for(let t=i;t-- >a;)e.dispatch({type:"back"});return}}},400)}b.push(_(document,"keydown",t=>{if("Tab"!=t.key)return;let a=[...o.querySelectorAll('button,a,iframe,[tabindex="0"]')],s=t.composedPath().includes(o),n=a[0],r=a.at(-1),l=e.root.activeElement;s&&!t.shiftKey&&l==r?(t.preventDefault(),(i??n)?.focus()):s&&t.shiftKey&&l==n?(t.preventDefault(),(i??r)?.focus()):i&&document.activeElement==i&&(t.preventDefault(),(t.shiftKey?r:n)?.focus())},!0)),$()}function E(){w(m);let i=M(),a=i.anchor?t(i.anchor,i.find?.web):null;if(C(a),!i.anchor)return;let s=0,n=()=>{s=0;let e=t(i.anchor,i.find?.web);e!=a&&C(a=e)},r=new MutationObserver(()=>s||(s=requestAnimationFrame(n)));r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-guide","hidden","style","class"]});let o=setTimeout(()=>!a&&e.dispatch({type:"anchor_missing",anchor:i.anchor}),3e3);m.push(()=>r.disconnect(),()=>clearTimeout(o),()=>cancelAnimationFrame(s))}return{nodes:()=>[d&&l,c&&p,o],get guide(){return s},update(t,a){if(t==s&&a==u)return;let n=!s||a!=u||t.steps[a]?.id!=M().id;s=t,u=a,f(e,t,a,i,o),n?E():$()},stop(){w(m),w(b),w(x),clearTimeout(n)}}}return e.fillEl=d,e.h=r,e.icon=p,e.mount=function(e){let i=e.options,s=t=>{e.outbox.push(t)};x().then(({createTransport:t})=>{let a=t({appKey:i.appKey,url:i.eventsUrl,sdk:i.sdkName??"web",version:"0.11.2",preview:i.preview,userId:e.userId,locale:()=>(e=>e.options.locale??navigator.language??"en")(e),send:i.transport});e.outbox.splice(0).forEach(a.push),s=a.push}).catch(t=>e.emit({type:"sdk_error",message:String(t)}));let n=e.root;n.appendChild(r("style",null,':host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-inline-start:auto}[dir=rtl] .btn svg{transform:scaleX(-1)}.img>img{object-fit:contain}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:var(--ps-radius-btn,99px);border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.left{right:auto;left:24px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}'));let o,l,p,d,u,h,f,m,b=n.appendChild(r("div",{class:"l"})),S=r("div",{class:"sr","aria-live":"polite"}),$=!1,C=null,E=r("button",{onClick:()=>N(!$)}),A=t=>e.emit({type:"sdk_error",message:String(t)}),L=()=>u??(u=v().then(e=>(p=e,n.appendChild(r("style",null,e.css)),P())).catch(A)),z=()=>h??(h=y().then(e=>(d=e,n.appendChild(r("style",null,e.css)),P())).catch(A)),j=[],H=()=>[S],N=e=>{$=e,P()};function O(e){let t=e.filter(Boolean);for(t.forEach((e,t)=>b.childNodes[t]!=e&&b.insertBefore(e,b.childNodes[t]??null));b.childNodes.length>t.length;)b.lastChild.remove()}function P(){let t=e.engine.active,s=t?.guide,u=a(e.config,i.colorMode,s?.mode)?"dark":"light";n.host.setAttribute("data-mode",u),b.removeAttribute("style");for(let[t,i]of Object.entries({...e.config.theme?.[u],...s?.tokens?.[u]}))b.style.setProperty(`--ps-${t}`,i);let h=e.engine.launcherGuides().length>0,x=!!l;$&&h&&p?(l??(l=r("div",{tabindex:"-1",role:"dialog"})),p.drawList(e,l,()=>N(!1))):(l=void 0,$&&h&&L()),h&&k(e,E,$),$||"running"!=t?.status?(f?.stop(),f=void 0):f?.guide?.id!=s.id&&(f?.stop(),f=M(e,matchMedia("(prefers-reduced-motion: reduce)").matches,()=>O(H()))),"running"==t?.status&&t.index==s.steps.length-1&&z();let v=!$&&"completed"==t?.status&&!!d;!$&&"completed"==t?.status&&!d&&z();let y=v&&(m!=s||!j.length);if(v?y&&(j=d.drawDone(e,s)):j=[],m=v?s:void 0,S.textContent="running"==t?.status?`${c(e,s.lang)("step_of",{n:t.index+1,total:s.steps.length})}: ${s.steps[t.index].title}`:"completed"==t?.status?c(e,s.lang)("level_cleared"):"",H=()=>[l,h&&e.config.launcher.enabled&&E,...f?.nodes()??[],...j,S],O(H()),f?.update(s,t.index),l&&!x){if(C=n.activeElement??document.activeElement,o){let{x:e,y:t}=g(o.getBoundingClientRect(),l.offsetWidth,l.offsetHeight,["top","bottom"],8,!0);l.style.cssText=`left:${e}px;top:${t}px;right:auto;bottom:auto`}l.focus()}else!l&&x&&C?.focus();y&&j[1]?.focus()}_(window,"keydown",i=>{if("Escape"!=i.key||i.defaultPrevented||!i.composedPath().includes(n.host))return;let a=e.engine.active;if($)N(!1);else if("completed"==a?.status)e.dispatch({type:"close"});else{if("running"!=a?.status)return;{let i=a.guide.steps[a.index],s=i.anchor?t(i.anchor,i.find?.web):null;e.dispatch({type:"hide"}),s?.focus({preventScroll:!0})}}i.preventDefault(),i.stopPropagation()},!0);let T=new MutationObserver(()=>P());for(let e of[document.documentElement,document.body])T.observe(e,{attributes:!0});return _(matchMedia("(prefers-color-scheme: dark)"),"change",()=>P()),P(),{update:()=>{e.engine.launcherGuides().length||($=!1),P()},openLauncher:e=>{let t=document.activeElement;o=e??(t!=document.body&&t!=n.host?t??void 0:void 0),N(!0)},send:e=>s(e),start:t=>{let a=e.config.guides.find(e=>e.id==t.guide)?.start_path;try{let s=a&&(i.startPage??w)(a,t.guide)||"";e.dispatch({...t,to:s});let n=e.engine.active;"waiting"==n?.status&&n.guide.id==t.guide&&i.navigate(s)}catch(a){A(a),e.dispatch({...t,to:""})}}}},e.words=c,e}({});
1
+ var __playstep_ui=function(e){function t(e,t){let i=e=>!!e?.getClientRects().length,a=[...document.querySelectorAll(`[data-guide="${CSS.escape(e)}"]`)].find(i)??null;try{a||(a=t?[...document.querySelectorAll(t.css)].find(e=>i(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return i(a)?a:null}Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let i=e=>"dark"==e||"light"==e?e:void 0;function a(e,t,a){let s=i(a)??i(e.theme?.mode)??i(t);return s?"dark"==s:function(){for(let e of[document.documentElement,document.body]){if(!e)continue;let t=getComputedStyle(e).colorScheme,i=/\b(dark|light)\b/.exec(`${e.className} ${Object.values(e.dataset)} ${/^(dark|light)$/.test(t)?t:""}`);if(i)return"dark"==i[1]}}()??matchMedia("(prefers-color-scheme: dark)").matches}let s=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},n={x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',play:'<path d="M5 5a2 2 0 0 1 3-1.7l12 7a2 2 0 0 1 0 3.5l-12 7A2 2 0 0 1 5 19z"/>',"volume-2":'<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.4 18.4a9 9 0 0 0 0-12.7"/>',"volume-x":'<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="m16.5 14.5 5-5"/><path d="m16.5 9.5 5 5"/>',check:'<path d="M20 6 9 17l-5-5"/>',"maximize-2":'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',"arrow-right":'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',"rotate-ccw":'<path d="M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"/><path d="M3 3v5h5"/>',"external-link":'<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',"ps-launcher":'<path d="M12 21a9 9 0 1 0-8-5L3 21l5-.9A9 9 0 0 0 12 21z"/><path d="M10 9v6l5-3z"/>',"ps-level-up":'<path d="M3 21h5v-4h5v-4h5V9"/><path d="M18 9V3l4 2.5L18 8"/>',"ps-guide":'<rect x="4" y="3" width="4" height="18" rx="2"/><path d="M12 5.5v10l7.5-5z"/>'};function r(e,t,...i){let a=document.createElement(e);for(let e in t){let i=t[e];if(null!=i&&!1!==i)if("o"==e[0]&&"n"==e[1])a.addEventListener(e.slice(2).toLowerCase(),i);else if("ref"==e)i(a);else if("style"==e)for(let e in i)a.style.setProperty(e,i[e]);else a.setAttribute(e,!0===i?"":String(i))}return o(a,i),a}function o(e,t){for(let i of t)Array.isArray(i)?o(e,i):null!=i&&!1!==i&&e.appendChild("object"==typeof i?i:document.createTextNode(String(i)))}let l=document.createElement("template");function p(e){return l.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n[e]}</svg>`,l.content.firstChild}let d=(e,...t)=>{e.textContent="",o(e,t)},c=(e,t=e.config.lang)=>(i,a)=>((e,t={})=>e.replace(/\{(\w+)\}/g,(e,i)=>i in t?String(t[i]):e))(e.config.words[t]?.[i]??i,a);function u(e,t,i,a,s,n){(!n||function(e){try{let t=JSON.parse(sessionStorage.getItem("playstep:clips")??"[]");if(t.includes(e))return!1;sessionStorage.setItem("playstep:clips",JSON.stringify([...t,e].slice(-200)))}catch{}return!0}(`${s}|${a.url}`))&&e.emit({type:s,guide_id:t.id,guide_version:t.version,step_id:t.steps[i].id,step_index:i,clip_id:a.clip_id,clip_source:a.source})}function h(e,t,i,a,n,o,l){let h=c(e,t.lang),f=t.steps[i].title,g=r("div",{class:"clip"}),m=!0,b=a.duration_ms??0;if("embed"==a.kind)return g.className="clip embed",d(g,a.poster&&r("img",{src:a.poster,alt:""}),r("button",{class:"play","aria-label":h("play_video"),onClick:()=>{d(g,r("iframe",{src:a.url,title:h("video",{title:f}),allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowfullscreen:!0})),u(e,t,i,a,"clip_played")}},p("play")),r("div",{class:"bar"},r("span",{class:"pill"},p("external-link"),a.label,b?` · ${s(b)}`:""))),l(0),g;let x=()=>{let n=r("video",{src:a.url,poster:a.poster,loop:!0,autoplay:!0,playsinline:!0,preload:"auto","aria-label":h("clip",{title:f}),onLoadeddata:()=>u(e,t,i,a,"clip_loaded",!0),onPlaying:()=>u(e,t,i,a,"clip_played",!0),onLoadedmetadata:()=>{Number.isFinite(n.duration)&&(b=1e3*n.duration,c.textContent=`${s(b)} `,l(b))}});n.muted=!0;let c=r("span",null,b?`${s(b)} `:""),x=r("button",{class:"round","aria-label":h("unmute_clip"),onClick:()=>{m=!m,n.muted=m,x.setAttribute("aria-label",h(m?"unmute_clip":"mute_clip")),d(x,p(m?"volume-x":"volume-2")),m||u(e,t,i,a,"clip_unmuted")}},p("volume-x")),v=r("button",{class:"round","aria-label":h("expand_clip"),"aria-pressed":"false",onClick:()=>{let e=o.classList.toggle("big");v.setAttribute("aria-label",h(e?"shrink_clip":"expand_clip")),v.setAttribute("aria-pressed",String(e))}},p("maximize-2"));d(g,n,r("div",{class:"bar"},r("span",{class:"pill"},p("play"),c,h("loop")),x,v)),n.play()?.catch(()=>{}),l(b)};return n?d(g,a.poster&&r("img",{src:a.poster,alt:""}),r("button",{class:"play","aria-label":h("play_clip"),onClick:x},p("play"))):x(),g}function f(e,t,i,a,s){let n=t.steps[i],o=t.steps.length,l=c(e,t.lang),f="next_button"==n.complete_on.type,g=n.media,m=l("step_of",{n:i+1,total:o}),b=t.steps.map((e,t)=>r("span",{class:"seg"+(t<i?" done":t==i?" cur":"")}));s.classList.remove("big"),s.dataset.step=n.id,s.lang=t.lang,t.rtl?s.dir="rtl":s.removeAttribute("dir"),d(s,"image"==g?.kind?r("div",{class:"clip img"},r("img",{src:g.url,alt:g.label??"",width:g.width,height:g.height})):g&&h(e,t,i,g,a,s,e=>{let t=b[i];t.className="seg cur"+(e&&!a?" anim":""),e?t.style.setProperty("--d",`${e}ms`):t.style.removeProperty("--d")}),r("div",{class:"body"},r("div",{class:"meta"},r("span",null,`${m} · ${t.name}`),r("button",{class:"x","aria-label":l("close_guide"),onClick:()=>e.dispatch({type:"dismiss"})},p("x"))),r("div",{class:"steps",role:"img","aria-label":m},b),r("h2",{class:"title",id:"ps-title"},n.title),r("p",{class:"text",id:"ps-text"},n.body)),r("div",{class:"foot"},f?r("span",{class:"sp"}):r("span",{class:"wait"},r("span",{class:"pulse","aria-hidden":"true"}),l("waiting")),n.back&&r("button",{class:"btn gho",onClick:()=>e.dispatch({type:"back"})},l("back")),f&&r("button",{class:"btn pri",onClick:()=>e.dispatch({type:"next"})},l(i+1==o?"done":"next"),p("arrow-right"))));let x=t.steps[i+1]?.media;if(x&&"embed"!=x.kind&&!a&&!navigator.connection?.saveData)if("image"==x.kind)(new Image).src=x.url;else{let a=document.createElement("video");a.preload="auto",a.muted=!0,a.src=x.url,"hosted"==x.source&&u(e,t,i+1,x,"clip_loaded",!0)}}function g(e,t,i,a,s,n=!1,r=12){let o={bottom:e.bottom+s+i<=innerHeight-r,top:e.top-s-i>=r,left:e.left-s-t>=r,right:e.right+s+t<=innerWidth-r},l=a.find(e=>o[e])??a[0],p=(e,t)=>Math.max(r,Math.min(e,t-r));return"top"==l||"bottom"==l?{x:p(n?e.left:e.left+(e.width-t)/2,innerWidth-t),y:"top"==l?e.top-s-i:e.bottom+s}:{x:"left"==l?e.left-s-t:e.right+s,y:p(e.top+(e.height-i)/2,innerHeight-i)}}let m=document.currentScript?.src,b=(e,t,i)=>t?new Promise((i,a)=>document.head.append(Object.assign(document.createElement("script"),{src:new URL(`${e}.js`,m||location.href).href,integrity:t,crossOrigin:"anonymous",onload:()=>i(window[`__playstep_${e}`]),onerror:()=>a(Error(e))}))):i(),x=()=>b("events","sha256-4vyjrnK5rttEM/kZCgUVyDOH2+Q28gM+5u/1U5TZHWw=",()=>import("../core/transport")),v=()=>b("list","sha256-28L8SfXyI2tnqGcN1BhJvRjS6lhEYeXgyl9SH/E2Npk=",()=>import("./list")),y=()=>b("done","sha256-NQjGrSn5EuVz6RfEcLwXPj+spBN6kWyQkMIO8c3LAg8=",()=>import("./done"));function k(e,t,i){let a=c(e),s=e.engine.launcherGuides().filter(t=>!e.engine.progress.guides[t.id]).length;t.className="lb"+("bottom-left"==e.config.launcher.position?" left":""),t.setAttribute("aria-label",a(i?"close_guides":"open_guides")),t.setAttribute("aria-expanded",String(i)),d(t,p("ps-launcher"),s>0&&!i&&r("span",{class:"cnt"},s))}function w(e){let t=location.pathname.split("/"),i=!0,a=e.split("/").map((e,a)=>"*"==e?t[a]||(i=!1,""):e).join("/");return i?a:""}let _=(e,t,i,a)=>(e.addEventListener(t,i,a),()=>e.removeEventListener(t,i,a));function M(e,i,a){let s,n,o=r("div",{class:"card",role:"dialog","aria-modal":"false","aria-labelledby":"ps-title","aria-describedby":"ps-text",tabindex:"-1",style:{visibility:"hidden"}}),l=r("div",{class:"spot","aria-hidden":"true"}),p=r("div",{class:"scrim","aria-hidden":"true"}),d=!1,c=!1,u=-1,h=null,m=[],b=[],x=[],v=!1,y="",k="",w=e=>e.splice(0).forEach(e=>e()),M=()=>s.steps[u];function S(e,t,i){o.style.transform=`translate(${Math.round(e)}px,${Math.round(t)}px)`,o.style.visibility="",v||(o.style.transition="none",requestAnimationFrame(()=>(v=!0,o.style.transition=""))),d!=!(!h||!i)&&(d=!d,a()),h&&i&&Object.assign(l.style,{width:`${i.w}px`,height:`${i.h}px`,transform:`translate(${i.x}px,${i.y}px)`,borderRadius:`${i.r}px`}),y!=M().id&&(y=M().id,document.hasFocus()&&!document.activeElement?.matches("input,textarea,select,[contenteditable]:not([contenteditable=false])")&&o.focus({preventScroll:!0}))}function $(){w(x);let e=o;if(c!=(!h&&"center"==s.position)&&(c=!c,a()),!h){let t=()=>S((innerWidth-e.offsetWidth)/2,"center"==s.position?(innerHeight-e.offsetHeight)/2:innerHeight-e.offsetHeight-24);t();let i=new ResizeObserver(t);return i.observe(e),void x.push(()=>i.disconnect(),_(window,"resize",t))}let t=h,n=t.getBoundingClientRect();(n.bottom<0||n.top>innerHeight)&&t.scrollIntoView({block:"center",behavior:i?"auto":"smooth"});let r=()=>{let i=t.getBoundingClientRect(),a=Number.parseFloat(getComputedStyle(t).borderTopLeftRadius)||8,s=M().placement,{x:n,y:r}=g(i,e.offsetWidth,e.offsetHeight,["auto"==s?"bottom":s,"top","left","right"],18);S(n,r,{x:i.left-6,y:i.top-6,w:i.width+12,h:i.height+12,r:Math.min(a+6,(i.height+12)/2)})};r();let l=new ResizeObserver(r);l.observe(t),l.observe(e);let p=setInterval(r,400);x.push(()=>l.disconnect(),()=>clearInterval(p),_(window,"scroll",r,{capture:!0,passive:!0}),_(window,"resize",r))}function C(i){h=i,w(b),clearTimeout(n);let a=M();if(i)b.push(_(document,"click",t=>{t.composedPath().includes(i)&&(k="",e.dispatch({type:"tap",anchor:a.anchor}))},!0)),i==t(a.anchor,a.find?.web)&&(k=a.id);else if(k==a.id){let i=u;n=setTimeout(()=>{for(let a=i;a--;){let n=s.steps[a];if(!n.anchor||"page"==n.complete_on.type)return;if(t(n.anchor,n.find?.web)){for(let t=i;t-- >a;)e.dispatch({type:"back"});return}}},400)}b.push(_(document,"keydown",t=>{if("Tab"!=t.key)return;let a=[...o.querySelectorAll('button,a,iframe,[tabindex="0"]')],s=t.composedPath().includes(o),n=a[0],r=a.at(-1),l=e.root.activeElement;s&&!t.shiftKey&&l==r?(t.preventDefault(),(i??n)?.focus()):s&&t.shiftKey&&l==n?(t.preventDefault(),(i??r)?.focus()):i&&document.activeElement==i&&(t.preventDefault(),(t.shiftKey?r:n)?.focus())},!0)),$()}function E(){w(m);let i=M(),a=i.anchor?t(i.anchor,i.find?.web):null;if(C(a),!i.anchor)return;let s=0,n=()=>{s=0;let e=t(i.anchor,i.find?.web);e!=a&&C(a=e)},r=new MutationObserver(()=>s||(s=requestAnimationFrame(n)));r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-guide","hidden","style","class"]});let o=setTimeout(()=>!a&&e.dispatch({type:"anchor_missing",anchor:i.anchor}),3e3);m.push(()=>r.disconnect(),()=>clearTimeout(o),()=>cancelAnimationFrame(s))}return{nodes:()=>[d&&l,c&&p,o],get guide(){return s},update(t,a){if(t==s&&a==u)return;let n=!s||a!=u||t.steps[a]?.id!=M().id;s=t,u=a,f(e,t,a,i,o),n?E():$()},stop(){w(m),w(b),w(x),clearTimeout(n)}}}return e.fillEl=d,e.h=r,e.icon=p,e.mount=function(e){let i=e.options,s=t=>{e.outbox.push(t)};x().then(({createTransport:t})=>{let a=t({appKey:i.appKey,url:i.eventsUrl,sdk:i.sdkName??"web",version:"0.11.3",preview:i.preview,userId:e.userId,locale:()=>(e=>e.options.locale??navigator.language??"en")(e),send:i.transport});e.outbox.splice(0).forEach(a.push),s=a.push}).catch(t=>e.emit({type:"sdk_error",message:String(t)}));let n=e.root;n.appendChild(r("style",null,':host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-inline-start:auto}[dir=rtl] .btn svg{transform:scaleX(-1)}.img>img{object-fit:contain}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:var(--ps-radius-btn,99px);border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.left{right:auto;left:24px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}'));let o,l,p,d,u,h,f,m,b=n.appendChild(r("div",{class:"l"})),S=r("div",{class:"sr","aria-live":"polite"}),$=!1,C=null,E=r("button",{onClick:()=>N(!$)}),A=t=>e.emit({type:"sdk_error",message:String(t)}),L=()=>u??(u=v().then(e=>(p=e,n.appendChild(r("style",null,e.css)),P())).catch(A)),z=()=>h??(h=y().then(e=>(d=e,n.appendChild(r("style",null,e.css)),P())).catch(A)),j=[],H=()=>[S],N=e=>{$=e,P()};function O(e){let t=e.filter(Boolean);for(t.forEach((e,t)=>b.childNodes[t]!=e&&b.insertBefore(e,b.childNodes[t]??null));b.childNodes.length>t.length;)b.lastChild.remove()}function P(){let t=e.engine.active,s=t?.guide,u=a(e.config,i.colorMode,s?.mode)?"dark":"light";n.host.setAttribute("data-mode",u),b.removeAttribute("style");for(let[t,i]of Object.entries({...e.config.theme?.[u],...s?.tokens?.[u]}))b.style.setProperty(`--ps-${t}`,i);let h=e.engine.launcherGuides().length>0,x=!!l;$&&h&&p?(l??(l=r("div",{tabindex:"-1",role:"dialog"})),p.drawList(e,l,()=>N(!1))):(l=void 0,$&&h&&L()),h&&k(e,E,$),$||"running"!=t?.status?(f?.stop(),f=void 0):f?.guide?.id!=s.id&&(f?.stop(),f=M(e,matchMedia("(prefers-reduced-motion: reduce)").matches,()=>O(H()))),"running"==t?.status&&t.index==s.steps.length-1&&z();let v=!$&&"completed"==t?.status&&!!d;!$&&"completed"==t?.status&&!d&&z();let y=v&&(m!=s||!j.length);if(v?y&&(j=d.drawDone(e,s)):j=[],m=v?s:void 0,S.textContent="running"==t?.status?`${c(e,s.lang)("step_of",{n:t.index+1,total:s.steps.length})}: ${s.steps[t.index].title}`:"completed"==t?.status?c(e,s.lang)("level_cleared"):"",H=()=>[l,h&&e.config.launcher.enabled&&E,...f?.nodes()??[],...j,S],O(H()),f?.update(s,t.index),l&&!x){if(C=n.activeElement??document.activeElement,o){let{x:e,y:t}=g(o.getBoundingClientRect(),l.offsetWidth,l.offsetHeight,["top","bottom"],8,!0);l.style.cssText=`left:${e}px;top:${t}px;right:auto;bottom:auto`}l.focus()}else!l&&x&&C?.focus();y&&j[1]?.focus()}_(window,"keydown",i=>{if("Escape"!=i.key||i.defaultPrevented||!i.composedPath().includes(n.host))return;let a=e.engine.active;if($)N(!1);else if("completed"==a?.status)e.dispatch({type:"close"});else{if("running"!=a?.status)return;{let i=a.guide.steps[a.index],s=i.anchor?t(i.anchor,i.find?.web):null;e.dispatch({type:"hide"}),s?.focus({preventScroll:!0})}}i.preventDefault(),i.stopPropagation()},!0);let T=new MutationObserver(()=>P());for(let e of[document.documentElement,document.body])T.observe(e,{attributes:!0});return _(matchMedia("(prefers-color-scheme: dark)"),"change",()=>P()),P(),{update:()=>{e.engine.launcherGuides().length||($=!1),P()},openLauncher:e=>{let t=document.activeElement;o=e??(t!=document.body&&t!=n.host?t??void 0:void 0),N(!0)},send:e=>s(e),start:t=>{let a=e.config.guides.find(e=>e.id==t.guide)?.start_path;try{let s=a&&(i.startPage??w)(a,t.guide)||"";e.dispatch({...t,to:s});let n=e.engine.active;"waiting"==n?.status&&n.guide.id==t.guide&&i.navigate(s)}catch(a){A(a),e.dispatch({...t,to:""})}}}},e.words=c,e}({});
@@ -1 +1 @@
1
- import{h as e,icon as t,words as n}from"./ui-BXeMvUwo.js";const r=`.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.art i{position:absolute;border-radius:99px}.art i:nth-child(1){width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)}.art i:nth-child(2){width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)}.art i:nth-child(3){width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)}.art i:nth-child(4){width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)}.art i:nth-child(5){width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)}.art i:nth-child(6){width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}`;function i(r,i){let a=r.engine.launcherGuides().find(e=>e.id!=i.id&&r.engine.progress.guides[e.id]?.status!=`done`),o=n(r,i.lang),s=e(`div`,{class:`cel`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabindex:`-1`,lang:i.lang,dir:i.rtl&&`rtl`},e(`div`,{class:`art`,"aria-hidden":`true`},[1,2,3,4,5,6].map(()=>e(`i`)),e(`span`,{class:`tile`},t(`ps-level-up`))),e(`h2`,{id:`ps-cel`},o(`level_cleared`)),e(`p`,null,o(`finished`,{guide:i.name}),a?` ${o(`next_up`,{guide:a.name})}`:``),e(`div`,{class:`acts`},e(`button`,{class:`btn sec`,onClick:()=>r.dispatch({type:`start`,guide:i.id,source:`launcher`})},t(`rotate-ccw`),o(`replay`)),a?e(`button`,{class:`btn pri`,onClick:()=>r.dispatch({type:`start`,guide:a.id,source:`launcher`})},o(`next_guide`),t(`arrow-right`)):e(`button`,{class:`btn pri`,onClick:()=>r.dispatch({type:`close`})},o(`done`))));return[e(`div`,{class:`scrim`,onClick:()=>r.dispatch({type:`close`})}),s]}export{r as css,i as drawDone};
1
+ import{h as e,icon as t,words as n}from"./ui-BO-r82nO.js";const r=`.cel{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:336px;max-width:calc(100vw - 24px);padding:24px 20px 20px;text-align:center;overflow:hidden}.cel h2{font-size:24px;line-height:30px;font-weight:800}.cel p{margin-bottom:16px}.art{position:relative;height:72px;margin-bottom:8px}.tile{position:absolute;left:50%;top:4px;width:64px;height:64px;margin-left:-32px;border-radius:var(--ps-radius-lg);background:var(--ps-spark);color:var(--ps-on-spark);display:grid;place-items:center;animation:pop .6s cubic-bezier(.2,1.6,.4,1) both}.tile svg{width:30px;height:30px}.art i{position:absolute;border-radius:99px}.art i:nth-child(1){width:22px;height:8px;left:22%;top:14px;transform:rotate(-20deg);background:var(--ps-accent)}.art i:nth-child(2){width:10px;height:10px;left:30%;top:46px;background:var(--ps-spark)}.art i:nth-child(3){width:12px;height:12px;right:24%;top:10px;background:var(--ps-chart-4)}.art i:nth-child(4){width:24px;height:8px;right:20%;top:44px;transform:rotate(24deg);background:var(--ps-chart-5)}.art i:nth-child(5){width:8px;height:8px;left:16%;top:60px;background:var(--ps-chart-5)}.art i:nth-child(6){width:8px;height:8px;right:30%;top:64px;background:var(--ps-accent)}@keyframes pop{0%{opacity:0;transform:scale(.4) rotate(-12deg)}}`;function i(r,i){let a=r.engine.launcherGuides().find(e=>e.id!=i.id&&r.engine.progress.guides[e.id]?.status!=`done`),o=n(r,i.lang),s=e(`div`,{class:`cel`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ps-cel`,tabindex:`-1`,lang:i.lang,dir:i.rtl&&`rtl`},e(`div`,{class:`art`,"aria-hidden":`true`},[1,2,3,4,5,6].map(()=>e(`i`)),e(`span`,{class:`tile`},t(`ps-level-up`))),e(`h2`,{id:`ps-cel`},o(`level_cleared`)),e(`p`,null,o(`finished`,{guide:i.name}),a?` ${o(`next_up`,{guide:a.name})}`:``),e(`div`,{class:`acts`},e(`button`,{class:`btn sec`,onClick:()=>r.dispatch({type:`start`,guide:i.id,source:`launcher`})},t(`rotate-ccw`),o(`replay`)),a?e(`button`,{class:`btn pri`,onClick:()=>r.dispatch({type:`start`,guide:a.id,source:`launcher`})},o(`next_guide`),t(`arrow-right`)):e(`button`,{class:`btn pri`,onClick:()=>r.dispatch({type:`close`})},o(`done`))));return[e(`div`,{class:`scrim`,onClick:()=>r.dispatch({type:`close`})}),s]}export{r as css,i as drawDone};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as PlayStepPlugin, d as AnalyticsEvent, f as ColorMode, i as PlayStep, m as RenderedGuide, n as InitOptions, p as RenderedConfig, r as OpenLauncherOptions, t as EventProps } from "./plugin-nV4NXmVz.js";
1
+ import { a as PlayStepPlugin, d as AnalyticsEvent, f as ColorMode, i as PlayStep, m as RenderedGuide, n as InitOptions, p as RenderedConfig, r as OpenLauncherOptions, t as EventProps } from "./plugin-D1kCpTL9.js";
2
2
  //#region src/index.d.ts
3
3
  export declare const playstep: PlayStep;
4
4
  //#endregion
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{n as e}from"./sdk-DOZSBvmE.js";const t=e(()=>import(`./ui-BXeMvUwo.js`).then(e=>e.t),()=>import(`./launcher-button-B62YRJZF.js`),()=>import(`./capture-cKutY_OF.js`));export{t as default,t as playstep};
1
+ import{n as e}from"./sdk-yfleEVbE.js";const t=e(()=>import(`./ui-BO-r82nO.js`).then(e=>e.t),()=>import(`./launcher-button-B62YRJZF.js`),()=>import(`./capture-DeCzAgRI.js`));export{t as default,t as playstep};
@@ -1 +1 @@
1
- import{fillEl as e,h as t,icon as n,words as r}from"./ui-BXeMvUwo.js";const i=`.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.panel.left{right:auto;left:24px}@media (max-width:480px){.panel{right:18px;bottom:86px}.solo{bottom:18px}.panel.left{left:18px}}`;function a(i,a,o){let s=i.config.launcher,c=r(i),l=i.engine.launcherGuides(),u=i.engine.progress.guides;a.className=`panel${s.position==`bottom-left`?` left`:``}${s.enabled?``:` solo`}`,a.setAttribute(`aria-label`,c(`guides`)),a.lang=i.config.lang,i.config.rtl&&(a.dir=`rtl`),e(a,t(`button`,{class:`x`,"aria-label":c(`close_guides`),onClick:o},n(`x`)),t(`h2`,null,s.title),t(`p`,null,s.description),t(`ul`,{class:`rows`},l.map(e=>{let r=u[e.id],a=e.steps.length,s=r?.status==`done`,l=r?.status==`running`;return t(`li`,null,t(`button`,{class:`row`,onClick:()=>{o(),r&&i.dispatch({type:`reset_progress`,guide:e.id}),i.dispatch({type:`start`,guide:e.id,source:`launcher`})}},t(`span`,{class:`ti${s?` mint`:r?``:` spark`}`},n(s?`check`:`ps-guide`)),t(`span`,{class:`rb`},t(`span`,{class:`rt`},e.name),t(`span`,{class:`rm`},s?c(`completed`):l?c(`step_of`,{n:r.step+1,total:a}):c(`n_steps`,{n:a})),l&&t(`span`,{class:`prog`,"aria-hidden":`true`},t(`i`,{style:{width:`${r.step/a*100}%`}}))),r?t(`span`,{class:`rp`},n(`rotate-ccw`),c(`replay`)):t(`span`,{class:`new`},c(`new`))))})),l.some(e=>u[e.id])&&t(`div`,{class:`acts so`},t(`button`,{class:`btn gho`,onClick:()=>{i.dispatch({type:`reset_progress`}),i.engine.active?o():a.focus()}},c(`start_over`))),i.config.flags?.show_badge!==!1&&t(`a`,{class:`pb`,href:`https://playstep.app/?ref=badge`,target:`_blank`,rel:`noopener`},t(`span`,{style:{display:`inline-flex`,width:`16px`,height:`16px`},ref:e=>e.innerHTML=`<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>`}),`Powered by PlayStep`))}export{i as css,a as drawList};
1
+ import{fillEl as e,h as t,icon as n,words as r}from"./ui-BO-r82nO.js";const i=`.panel{position:fixed;right:24px;bottom:96px;width:320px;max-width:calc(100vw - 36px);max-height:calc(100vh - 120px);overflow:auto;padding:16px}.solo{bottom:24px}.panel .x{float:right}.panel>p{font-size:13px;line-height:18px;color:var(--ps-ink-muted);margin:-2px 0 12px}.rows{list-style:none;padding:0}.row{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--ps-radius-md);text-align:left}.ti{width:36px;height:36px;flex:none;border-radius:var(--ps-radius-md);display:grid;place-items:center;background:var(--ps-primary-soft);color:var(--ps-primary-ink)}.ti.spark{background:var(--ps-spark-soft);color:var(--ps-spark-ink)}.ti.mint{background:var(--ps-tag-mint);color:var(--ps-ink)}.ti svg{width:18px;height:18px}.rb{flex:1;min-width:0}.rt,.rm{display:block;font-weight:600}.rm{font-size:12px;line-height:16px;font-weight:500;color:var(--ps-ink-muted)}.prog{display:block;height:6px;border-radius:99px;background:var(--ps-surface-sunken);margin-top:6px;overflow:hidden}.prog i{display:block;height:100%;background:var(--ps-accent)}.rp{display:flex;align-items:center;gap:4px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.so{margin-top:8px}.new{height:24px;padding:0 10px;border-radius:99px;background:var(--ps-spark-soft);color:var(--ps-spark-ink);font-size:12px;line-height:24px;font-weight:600}.pb{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);text-decoration:none}.panel.left{right:auto;left:24px}@media (max-width:480px){.panel{right:18px;bottom:86px}.solo{bottom:18px}.panel.left{left:18px}}`;function a(i,a,o){let s=i.config.launcher,c=r(i),l=i.engine.launcherGuides(),u=i.engine.progress.guides;a.className=`panel${s.position==`bottom-left`?` left`:``}${s.enabled?``:` solo`}`,a.setAttribute(`aria-label`,c(`guides`)),a.lang=i.config.lang,i.config.rtl&&(a.dir=`rtl`),e(a,t(`button`,{class:`x`,"aria-label":c(`close_guides`),onClick:o},n(`x`)),t(`h2`,null,s.title),t(`p`,null,s.description),t(`ul`,{class:`rows`},l.map(e=>{let r=u[e.id],a=e.steps.length,s=r?.status==`done`,l=r?.status==`running`;return t(`li`,null,t(`button`,{class:`row`,onClick:()=>{o(),r&&i.dispatch({type:`reset_progress`,guide:e.id}),i.dispatch({type:`start`,guide:e.id,source:`launcher`})}},t(`span`,{class:`ti${s?` mint`:r?``:` spark`}`},n(s?`check`:`ps-guide`)),t(`span`,{class:`rb`},t(`span`,{class:`rt`},e.name),t(`span`,{class:`rm`},s?c(`completed`):l?c(`step_of`,{n:r.step+1,total:a}):c(`n_steps`,{n:a})),l&&t(`span`,{class:`prog`,"aria-hidden":`true`},t(`i`,{style:{width:`${r.step/a*100}%`}}))),r?t(`span`,{class:`rp`},n(`rotate-ccw`),c(`replay`)):t(`span`,{class:`new`},c(`new`))))})),l.some(e=>u[e.id])&&t(`div`,{class:`acts so`},t(`button`,{class:`btn gho`,onClick:()=>{i.dispatch({type:`reset_progress`}),i.engine.active?o():a.focus()}},c(`start_over`))),i.config.flags?.show_badge!==!1&&t(`a`,{class:`pb`,href:`https://playstep.app/?ref=badge`,target:`_blank`,rel:`noopener`},t(`span`,{style:{display:`inline-flex`,width:`16px`,height:`16px`},ref:e=>e.innerHTML=`<svg viewBox="0 0 48 48" aria-hidden="true"><rect width="48" height="48" rx="13" fill="#2E5BFF"/><rect x="11" y="10" width="8" height="28" rx="4" fill="#fff"/><path d="M23.5 12v17l12-8.5z" fill="#FFC933" stroke="#FFC933" stroke-width="3.5" stroke-linejoin="round"/></svg>`}),`Powered by PlayStep`))}export{i as css,a as drawList};
@@ -124,12 +124,14 @@ interface AnalyticsConfig {
124
124
  hash_key: string;
125
125
  anonymous: boolean;
126
126
  consent: 'granted' | 'pending' | 'denied';
127
+ /** `text` (PLAY-107) is missing from configs published before it: missing means on. */
127
128
  autocapture: {
128
129
  pages: boolean;
129
130
  clicks: boolean;
130
131
  forms: boolean;
131
132
  rage: boolean;
132
133
  dead: boolean;
134
+ text: boolean;
133
135
  };
134
136
  identities: boolean;
135
137
  mask: string[];
@@ -281,7 +283,11 @@ interface SendResult {
281
283
  /** Retry-After, in seconds. */
282
284
  retryAfter?: number;
283
285
  }
284
- /** `E` is an event and `B` the batch around it: guide events by default; Insights' add-on queues its own batches. */
286
+ /**
287
+ * `E` is an event and `B` the batch around it: guide events by default; Insights' add-on queues its own batches.
288
+ * The queue reads `envelope` and `send` from this object each time it uses them, never a copy: Insights' add-on swaps
289
+ * them when consent is withdrawn, so what a queue holds is dropped instead of sent (sdk-analytics, PLAY-100).
290
+ */
285
291
  interface QueueOptions<B = Omit<EventBatch, 'events' | 'platform'>> {
286
292
  url: string;
287
293
  /** The batch envelope (who and where), or null to keep the events for now. */
package/dist/plugin.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as PlayStepPlugin, c as QueueOptions, i as PlayStep, l as SendResult, n as InitOptions, o as PluginCall, s as store, t as EventProps, u as createQueue } from "./plugin-nV4NXmVz.js";
1
+ import { a as PlayStepPlugin, c as QueueOptions, i as PlayStep, l as SendResult, n as InitOptions, o as PluginCall, s as store, t as EventProps, u as createQueue } from "./plugin-D1kCpTL9.js";
2
2
  export { type EventProps, type InitOptions, type PlayStep, type PlayStepPlugin, type PluginCall, type QueueOptions, type SendResult, createQueue, store };
@@ -1 +1 @@
1
- import{n as e}from"./util-X5IoDowG.js";const t=e=>RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`)}$`),n=e=>e.length>1?e.replace(/\/+$/,``):e;function r(e,r){return!!e&&r!==void 0&&t(n(e)).test(n(r))}function i(e,t){return(e??[]).every(e=>{let n=t[e.trait];return e.op==`exists`?n!=null:e.op==`in`?Array.isArray(e.value)&&e.value.includes(n):e.op==`eq`?n===e.value:e.op==`neq`&&n!==e.value})}function a(e){let t=e.progress??{seen:!1,guides:{}},n=e.traits??{},a=null,o,s=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set,l=!1,u=e.config.flags,d=e.config.guides,f=e=>d.find(t=>t.id===e),p=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),m=(e,r)=>(r||!e.held_out)&&!l&&!u.disabled&&(!u.paused_for_new_users||t.seen)&&i(e.segments,n),h=e=>{let n=t.guides[e.id];return!a&&!s.has(e.id)&&m(e,1)&&(!n||(n.status==`held_out`?!e.held_out:n.status!=`done`&&(n.status==`running`||!e.trigger.once)))},g=(e,n,r)=>{t.guides[e.id]={...t.guides[e.id],version:e.version,step:r,status:n}},_,v=e=>r(e.path,_),y=e=>r(e.skip_if_on,_)||v(e.complete_on),b=e=>!_||r(e.page??`*`,_),x=(e,t,n)=>{for(;t<e.steps.length;){if(a={guide:e,index:t,status:`running`},o=void 0,g(e,`running`,t),n.push(p(`step_shown`,e,t)),!y(e.steps[t]))return n;n.push(p(`step_completed`,e,t++))}return a={guide:e,index:--t,status:`completed`},g(e,`done`,t),n.push(p(`guide_completed`,e)),n},S=(e,n,r=`trigger`)=>(t.seen=!0,c.add(e.id),t.guides[e.id]={source:r},x(e,n,[{...p(`guide_shown`,e),source:r}])),C=()=>{let e=a;return x(e.guide,e.index+1,[p(`step_completed`,e.guide,e.index)])},w=e=>{let t=d.find(t=>h(t)&&e(t));return t?t.held_out?(g(t,`held_out`,0),[p(`guide_held_out`,t)]):S(t,0):[]},T=e=>e.trigger.type==`first_visit`||v(e.trigger),E=()=>(s.clear(),w(T)),D=(e=T)=>{let n=0,r=d.find(e=>{let r=t.guides[e.id];return n=r?.version===e.version?r.step:0,!a&&r?.status==`running`&&!s.has(e.id)&&m(e)&&b(e.steps[n])});return r?c.has(r.id)?x(r,n,[]):S(r,n,t.guides[r.id].source):w(e)};function O(e){let i=a?.status==`running`?a.guide.steps[a.index]:null,u=l?null:i;switch(e.type){case`init`:return _=e.path,s.clear(),c.clear(),D();case`pause`:return l=!0,[];case`arrived`:return w(t=>e.guides.includes(t)&&T(t));case`resume`:return l?(l=!1,D()):[];case`page_view`:return _=e.path,!l&&a?.status==`waiting`?S(a.guide,0,a.source):u&&y(u)?C():(i&&!b(i)&&(a=null),D(e=>v(e.trigger)));case`reset_progress`:{let n=typeof e.guide==`string`&&f(e.guide);return n===void 0?[]:((!n||a?.guide===n)&&(a=null),n?delete t.guides[n.id]:t.guides={},[{type:`progress_reset`,...n&&{guide_id:n.id}},...E()])}case`event`:return u?.complete_on.type==`event`&&u.complete_on.name===e.name?C():w(t=>t.trigger.type==`event`&&t.trigger.name===e.name);case`tap`:return u?.complete_on.type==`tap_anchor`&&u.anchor===e.anchor?C():[];case`complete`:return u?.id===e.step?C():[];case`next`:return u?.complete_on.type==`next_button`?C():[];case`back`:return!u||a.index===0?[]:(a={...a,index:a.index-1},g(a.guide,`running`,a.index),[p(`step_shown`,a.guide,a.index)]);case`hide`:return u&&(s.add(a.guide.id),a=null),[];case`close`:if(a?.status!=`completed`)return[];case`dismiss`:{let e=a;return a=null,i?(g(e.guide,`dismissed`,e.index),[p(`guide_dismissed`,e.guide,e.index)]):e?.status==`completed`?D(t=>v(t.trigger)||t.trigger.guide==e.guide.id):[]}case`start`:{let t=f(e.guide);if(!t||!m(t)||u&&a.guide===t&&t.steps.slice(0,a.index).every(y))return[];let n=e.source??`api`;return e.to&&!r(t.start_path,_)?(a={guide:t,index:0,status:`waiting`,source:n},[]):S(t,0,n)}case`anchor_missing`:return!u||u.anchor!==e.anchor||o===e.anchor?[]:(o=e.anchor,[{...p(`anchor_missing`,a.guide,a.index),anchor:e.anchor}]);case`identify`:return n={...n,...e.traits},[]}}return{get active(){return l?null:a},progress:t,dispatch:O,launcherGuides:()=>d.filter(e=>e.launcher&&m(e)),use(e){let t=e.guides.filter(e=>!f(e.id));return d=e.guides,a&&(a={...a,guide:f(a.guide.id)??a.guide}),t}}}const o=`0.11.2`,s=`playstep_preview`;function c(t,n,r,i){let c,l,u,d,f,p,m,h,g,_={},v=!1,y,b=[],x=[],S=[],C=[],w=()=>`p:${c.appKey}`,T,E=e=>{let t=e.progress,n=l.progress;if(t&&f!=T){T&&Object.assign(n,{seen:!1,guides:{}}),t.seen&&(n.seen=!0),Object.assign(n.guides,t.guides);for(let e of t.reset)delete n.guides[e];T=f}},D=()=>c.preview||e.set(w(),l.progress),O=e=>{let t={...e,ts:Date.now()};c?.preview||(p?p.send(t):x.push(t)),c?.onEvent?.(t)},k=e=>{try{O({type:`sdk_error`,message:String(e)})}catch{}},A=e=>(...t)=>{try{e(...t)}catch(e){k(e)}},j=(...e)=>C?C.length<50&&C.push(e):S.forEach(t=>A(t)(...e)),M=()=>{let e=C;C=void 0,e.forEach(e=>j(...e))},N=(e,t)=>A(n=>P({type:e,[t]:n}));function P(t){if(!l)return void b.push(t);if(t.type==`start`&&t.to===void 0&&c.navigate)return void I().then(e=>e?.start(t));let n=l.dispatch(t);D(),n.forEach(A(O)),(l.active||e.get(`q`)||x.length)&&I(),p?.update()}function F(){return h??(h=document.body.appendChild(document.createElement(`playstep-root`)).attachShadow({mode:`open`}))}function I(){return m??(m=t().then(e=>{let t=F();return t.innerHTML=``,p=e.mount({engine:l,get config(){return u},options:c,root:t,outbox:x,userId:()=>g,dispatch:A(P),emit:A(O)})}).catch(k))}let L=()=>{let e=c?.locale??navigator.language??``,t=g;d?.(e).then(n=>{n.guides&&(c.locale??navigator.language??``)==e&&t==g&&(E(n),P({type:`arrived`,guides:l.use(u=n)}))}).catch(k)},R,z=A((e={})=>{l?l.launcherGuides().length&&I().then(t=>t?.openLauncher(e.anchor)):R=e});function B(e){e.launcher?.enabled&&l.launcherGuides().length&&!m&&n&&n().then(t=>{m||t.drawLauncher(F(),l,e,z,c)}).catch(k)}let V=e=>A(()=>{v!==e&&(v=e,l&&(P({type:e?`pause`:`resume`}),!m&&(e?h&&(h.innerHTML=``):B(u))))});async function H(){let t=c,n=(t.apiBase??`https://cdn.playstep.app`).replace(/\/$/,``),o=null;try{o=new URLSearchParams(location.search).get(s)||(t.config?null:sessionStorage.getItem(s))}catch{}t.preview||(t.preview=!!(t.config||o)),d=async e=>{let r=``;f=g;try{g&&!o&&(r=`&u=`+btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(`${t.appKey}:${g}`))))))}catch{}return(await fetch(`${n}/v2/${o?`preview/${o}?key=${t.appKey}&`:`config/${t.appKey}?`}v=2&l=${e}${r}`)).json()};let p=t.config;try{p??(p=await d(c?.locale??navigator.language??``))}catch{return}try{o&&sessionStorage[p.guides?`setItem`:`removeItem`](s,o)}catch{}if(p?.capture)return void r?.().then(e=>e.start(p.capture,t.appKey)).catch(k);if(p?.guides&&!p.flags?.disabled&&(u=p,t.eventsUrl=p.ingest_url??`${n}/v1/events`,p.analytics||(C=void 0),S.splice(0).forEach(U.use),C&&i?.().catch(k),l=a({config:p,progress:t.preview?void 0:e.get(w()),traits:_}),E(p),v&&l.dispatch({type:`pause`}),P({type:`init`,path:location.pathname}),b.splice(0).forEach(P),R&&z(R),B(p),!t.config&&f!=g&&L(),t.autoPageViews!==!1)){let e=location.pathname;j(`page`,e);let t=A(()=>location.pathname!==e&&U.page(e=location.pathname));for(let e of[`pushState`,`replaceState`]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener(`popstate`,t)}}let U={version:o,init:A(e=>{if(c||!e?.appKey)return;c={...e},y&&(c.locale=y);let t=()=>setTimeout(()=>H().catch(k));document.readyState==`complete`?t():addEventListener(`load`,t)}),identify:A((e,t)=>{g=e,_={..._,...t},P({type:`identify`,traits:_}),j(`identify`,e,_),u&&e!=f&&!c.config&&L()}),track:A((e,t)=>{P({type:`event`,name:e}),j(`track`,e,t)}),start:N(`start`,`guide`),complete:N(`complete`,`step`),page:A((e=location.pathname)=>{P({type:`page_view`,path:e}),j(`page`,e)}),openLauncher:z,resetProgress:N(`reset_progress`,`guide`),reset:A(()=>{P({type:`dismiss`}),g=void 0,_={},l&&(Object.assign(l.progress,{seen:!1,guides:{}}),D(),p?.update()),c?.preview||e.set(`d`,null),j(`reset`)}),pause:V(!0),resume:V(!1),isPaused:()=>v,setLocale:A(e=>{y=e,c&&(c.locale=e),L()}),use:A(e=>{S.push(e),u&&(A(e)(`config`,u,c),C&&M())})};return U}export{c as n,o as t};
1
+ import{n as e}from"./util-X5IoDowG.js";const t=e=>RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`)}$`),n=e=>e.length>1?e.replace(/\/+$/,``):e;function r(e,r){return!!e&&r!==void 0&&t(n(e)).test(n(r))}function i(e,t){return(e??[]).every(e=>{let n=t[e.trait];return e.op==`exists`?n!=null:e.op==`in`?Array.isArray(e.value)&&e.value.includes(n):e.op==`eq`?n===e.value:e.op==`neq`&&n!==e.value})}function a(e){let t=e.progress??{seen:!1,guides:{}},n=e.traits??{},a=null,o,s=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set,l=!1,u=e.config.flags,d=e.config.guides,f=e=>d.find(t=>t.id===e),p=(e,t,n)=>({type:e,guide_id:t.id,guide_version:t.version,...n>=0&&{step_id:t.steps[n].id,step_index:n}}),m=(e,r)=>(r||!e.held_out)&&!l&&!u.disabled&&(!u.paused_for_new_users||t.seen)&&i(e.segments,n),h=e=>{let n=t.guides[e.id];return!a&&!s.has(e.id)&&m(e,1)&&(!n||(n.status==`held_out`?!e.held_out:n.status!=`done`&&(n.status==`running`||!e.trigger.once)))},g=(e,n,r)=>{t.guides[e.id]={...t.guides[e.id],version:e.version,step:r,status:n}},_,v=e=>r(e.path,_),y=e=>r(e.skip_if_on,_)||v(e.complete_on),b=e=>!_||r(e.page??`*`,_),x=(e,t,n)=>{for(;t<e.steps.length;){if(a={guide:e,index:t,status:`running`},o=void 0,g(e,`running`,t),n.push(p(`step_shown`,e,t)),!y(e.steps[t]))return n;n.push(p(`step_completed`,e,t++))}return a={guide:e,index:--t,status:`completed`},g(e,`done`,t),n.push(p(`guide_completed`,e)),n},S=(e,n,r=`trigger`)=>(t.seen=!0,c.add(e.id),t.guides[e.id]={source:r},x(e,n,[{...p(`guide_shown`,e),source:r}])),C=()=>{let e=a;return x(e.guide,e.index+1,[p(`step_completed`,e.guide,e.index)])},w=e=>{let t=d.find(t=>h(t)&&e(t));return t?t.held_out?(g(t,`held_out`,0),[p(`guide_held_out`,t)]):S(t,0):[]},T=e=>e.trigger.type==`first_visit`||v(e.trigger),E=()=>(s.clear(),w(T)),D=(e=T)=>{let n=0,r=d.find(e=>{let r=t.guides[e.id];return n=r?.version===e.version?r.step:0,!a&&r?.status==`running`&&!s.has(e.id)&&m(e)&&b(e.steps[n])});return r?c.has(r.id)?x(r,n,[]):S(r,n,t.guides[r.id].source):w(e)};function O(e){let i=a?.status==`running`?a.guide.steps[a.index]:null,u=l?null:i;switch(e.type){case`init`:return _=e.path,s.clear(),c.clear(),D();case`pause`:return l=!0,[];case`arrived`:return w(t=>e.guides.includes(t)&&T(t));case`resume`:return l?(l=!1,D()):[];case`page_view`:return _=e.path,!l&&a?.status==`waiting`?S(a.guide,0,a.source):u&&y(u)?C():(i&&!b(i)&&(a=null),D(e=>v(e.trigger)));case`reset_progress`:{let n=typeof e.guide==`string`&&f(e.guide);return n===void 0?[]:((!n||a?.guide===n)&&(a=null),n?delete t.guides[n.id]:t.guides={},[{type:`progress_reset`,...n&&{guide_id:n.id}},...E()])}case`event`:return u?.complete_on.type==`event`&&u.complete_on.name===e.name?C():w(t=>t.trigger.type==`event`&&t.trigger.name===e.name);case`tap`:return u?.complete_on.type==`tap_anchor`&&u.anchor===e.anchor?C():[];case`complete`:return u?.id===e.step?C():[];case`next`:return u?.complete_on.type==`next_button`?C():[];case`back`:return!u||a.index===0?[]:(a={...a,index:a.index-1},g(a.guide,`running`,a.index),[p(`step_shown`,a.guide,a.index)]);case`hide`:return u&&(s.add(a.guide.id),a=null),[];case`close`:if(a?.status!=`completed`)return[];case`dismiss`:{let e=a;return a=null,i?(g(e.guide,`dismissed`,e.index),[p(`guide_dismissed`,e.guide,e.index)]):e?.status==`completed`?D(t=>v(t.trigger)||t.trigger.guide==e.guide.id):[]}case`start`:{let t=f(e.guide);if(!t||!m(t)||u&&a.guide===t&&t.steps.slice(0,a.index).every(y))return[];let n=e.source??`api`;return e.to&&!r(t.start_path,_)?(a={guide:t,index:0,status:`waiting`,source:n},[]):S(t,0,n)}case`anchor_missing`:return!u||u.anchor!==e.anchor||o===e.anchor?[]:(o=e.anchor,[{...p(`anchor_missing`,a.guide,a.index),anchor:e.anchor}]);case`identify`:return n={...n,...e.traits},[]}}return{get active(){return l?null:a},progress:t,dispatch:O,launcherGuides:()=>d.filter(e=>e.launcher&&m(e)),use(e){let t=e.guides.filter(e=>!f(e.id));return d=e.guides,a&&(a={...a,guide:f(a.guide.id)??a.guide}),t}}}const o=`0.11.3`,s=`playstep_preview`;function c(t,n,r,i){let c,l,u,d,f,p,m,h,g,_={},v=!1,y,b=[],x=[],S=[],C=[],w=()=>`p:${c.appKey}`,T,E=e=>{let t=e.progress,n=l.progress;if(t&&f!=T){T&&Object.assign(n,{seen:!1,guides:{}}),t.seen&&(n.seen=!0),Object.assign(n.guides,t.guides);for(let e of t.reset)delete n.guides[e];T=f}},D=()=>c.preview||e.set(w(),l.progress),O=e=>{let t={...e,ts:Date.now()};c?.preview||(p?p.send(t):x.push(t)),c?.onEvent?.(t)},k=e=>{try{O({type:`sdk_error`,message:String(e)})}catch{}},A=e=>(...t)=>{try{e(...t)}catch(e){k(e)}},j=(...e)=>C?C.length<50&&C.push(e):S.forEach(t=>A(t)(...e)),M=()=>{let e=C;C=void 0,e.forEach(e=>j(...e))},N=(e,t)=>A(n=>P({type:e,[t]:n}));function P(t){if(!l)return void b.push(t);if(t.type==`start`&&t.to===void 0&&c.navigate)return void I().then(e=>e?.start(t));let n=l.dispatch(t);D(),n.forEach(A(O)),(l.active||e.get(`q`)||x.length)&&I(),p?.update()}function F(){return h??(h=document.body.appendChild(document.createElement(`playstep-root`)).attachShadow({mode:`open`}))}function I(){return m??(m=t().then(e=>{let t=F();return t.innerHTML=``,p=e.mount({engine:l,get config(){return u},options:c,root:t,outbox:x,userId:()=>g,dispatch:A(P),emit:A(O)})}).catch(k))}let L=()=>{let e=c?.locale??navigator.language??``,t=g;d?.(e).then(n=>{n.guides&&(c.locale??navigator.language??``)==e&&t==g&&(E(n),P({type:`arrived`,guides:l.use(u=n)}))}).catch(k)},R,z=A((e={})=>{l?l.launcherGuides().length&&I().then(t=>t?.openLauncher(e.anchor)):R=e});function B(e){e.launcher?.enabled&&l.launcherGuides().length&&!m&&n&&n().then(t=>{m||t.drawLauncher(F(),l,e,z,c)}).catch(k)}let V=e=>A(()=>{v!==e&&(v=e,l&&(P({type:e?`pause`:`resume`}),!m&&(e?h&&(h.innerHTML=``):B(u))))});async function H(){let t=c,n=(t.apiBase??`https://cdn.playstep.app`).replace(/\/$/,``),o=null;try{o=new URLSearchParams(location.search).get(s)||(t.config?null:sessionStorage.getItem(s))}catch{}t.preview||(t.preview=!!(t.config||o)),d=async e=>{let r=``;f=g;try{g&&!o&&(r=`&u=`+btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(`${t.appKey}:${g}`))))))}catch{}return(await fetch(`${n}/v2/${o?`preview/${o}?key=${t.appKey}&`:`config/${t.appKey}?`}v=2&l=${e}${r}`)).json()};let p=t.config;try{p??(p=await d(c?.locale??navigator.language??``))}catch{return}try{o&&sessionStorage[p.guides?`setItem`:`removeItem`](s,o)}catch{}if(p?.capture)return void r?.().then(e=>e.start(p.capture,t.appKey)).catch(k);if(p?.guides&&!p.flags?.disabled&&(u=p,t.eventsUrl=p.ingest_url??`${n}/v1/events`,p.analytics||(C=void 0),S.splice(0).forEach(U.use),C&&i?.().catch(k),l=a({config:p,progress:t.preview?void 0:e.get(w()),traits:_}),E(p),v&&l.dispatch({type:`pause`}),P({type:`init`,path:location.pathname}),b.splice(0).forEach(P),R&&z(R),B(p),!t.config&&f!=g&&L(),t.autoPageViews!==!1)){let e=location.pathname;j(`page`,e);let t=A(()=>location.pathname!==e&&U.page(e=location.pathname));for(let e of[`pushState`,`replaceState`]){let n=history[e];history[e]=function(...e){n.apply(this,e),t()}}addEventListener(`popstate`,t)}}let U={version:o,init:A(e=>{if(c||!e?.appKey)return;c={...e},y&&(c.locale=y);let t=()=>setTimeout(()=>H().catch(k));document.readyState==`complete`?t():addEventListener(`load`,t)}),identify:A((e,t)=>{g=e,_={..._,...t},P({type:`identify`,traits:_}),j(`identify`,e,_),u&&e!=f&&!c.config&&L()}),track:A((e,t)=>{P({type:`event`,name:e}),j(`track`,e,t)}),start:N(`start`,`guide`),complete:N(`complete`,`step`),page:A((e=location.pathname)=>{P({type:`page_view`,path:e}),j(`page`,e)}),openLauncher:z,resetProgress:N(`reset_progress`,`guide`),reset:A(()=>{P({type:`dismiss`}),g=void 0,_={},l&&(Object.assign(l.progress,{seen:!1,guides:{}}),D(),p?.update()),c?.preview||e.set(`d`,null),j(`reset`)}),pause:V(!0),resume:V(!1),isPaused:()=>v,setLocale:A(e=>{y=e,c&&(c.locale=e),L()}),use:A(e=>{S.push(e),u&&(A(e)(`config`,u,c),C&&M())})};return U}export{c as n,o as t};
@@ -1 +1 @@
1
- import{t as e}from"./sdk-DOZSBvmE.js";import{t}from"./util-X5IoDowG.js";import{t as n}from"./mode-CPlpg1Yl.js";var r=Object.defineProperty,i=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n};const a={x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,play:`<path d="M5 5a2 2 0 0 1 3-1.7l12 7a2 2 0 0 1 0 3.5l-12 7A2 2 0 0 1 5 19z"/>`,"volume-2":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.4 18.4a9 9 0 0 0 0-12.7"/>`,"volume-x":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="m16.5 14.5 5-5"/><path d="m16.5 9.5 5 5"/>`,check:`<path d="M20 6 9 17l-5-5"/>`,"maximize-2":`<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>`,"arrow-right":`<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>`,"rotate-ccw":`<path d="M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"/><path d="M3 3v5h5"/>`,"external-link":`<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>`,"ps-launcher":`<path d="M12 21a9 9 0 1 0-8-5L3 21l5-.9A9 9 0 0 0 12 21z"/><path d="M10 9v6l5-3z"/>`,"ps-level-up":`<path d="M3 21h5v-4h5v-4h5V9"/><path d="M18 9V3l4 2.5L18 8"/>`,"ps-guide":`<rect x="4" y="3" width="4" height="18" rx="2"/><path d="M12 5.5v10l7.5-5z"/>`};function o(e,t,...n){let r=document.createElement(e);for(let e in t){let n=t[e];if(n!=null&&n!==!1){if(e[0]==`o`&&e[1]==`n`)r.addEventListener(e.slice(2).toLowerCase(),n);else if(e==`ref`)n(r);else if(e==`style`)for(let e in n)r.style.setProperty(e,n[e]);else r.setAttribute(e,n===!0?``:String(n))}}return s(r,n),r}function s(e,t){for(let n of t)Array.isArray(n)?s(e,n):n!=null&&n!==!1&&e.appendChild(typeof n==`object`?n:document.createTextNode(String(n)))}const c=document.createElement(`template`);function l(e){return c.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${a[e]}</svg>`,c.content.firstChild}const u=(e,...t)=>{e.textContent=``,s(e,t)},d=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e),f=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},p=e=>e.options.locale??navigator.language??`en`,m=(e,t=e.config.lang)=>(n,r)=>d(e.config.words[t]?.[n]??n,r);function h(e,t){let n=e=>!!e?.getClientRects().length,r=[...document.querySelectorAll(`[data-guide="${CSS.escape(e)}"]`)].find(n)??null;try{r||(r=t?[...document.querySelectorAll(t.css)].find(e=>n(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return n(r)?r:null}function g(e){try{let t=JSON.parse(sessionStorage.getItem(`playstep:clips`)??`[]`);if(t.includes(e))return!1;sessionStorage.setItem(`playstep:clips`,JSON.stringify([...t,e].slice(-200)))}catch{}return!0}function _(e,t,n,r,i,a){(!a||g(`${i}|${r.url}`))&&e.emit({type:i,guide_id:t.id,guide_version:t.version,step_id:t.steps[n].id,step_index:n,clip_id:r.clip_id,clip_source:r.source})}function v(e,t,n,r,i,a,s){let c=m(e,t.lang),d=t.steps[n].title,p=o(`div`,{class:`clip`}),h=!0,g=r.duration_ms??0;if(r.kind==`embed`)return p.className=`clip embed`,u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_video`),onClick:()=>{u(p,o(`iframe`,{src:r.url,title:c(`video`,{title:d}),allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowfullscreen:!0})),_(e,t,n,r,`clip_played`)}},l(`play`)),o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`external-link`),r.label,g?` · ${f(g)}`:``))),s(0),p;let v=()=>{let i=o(`video`,{src:r.url,poster:r.poster,loop:!0,autoplay:!0,playsinline:!0,preload:`auto`,"aria-label":c(`clip`,{title:d}),onLoadeddata:()=>_(e,t,n,r,`clip_loaded`,!0),onPlaying:()=>_(e,t,n,r,`clip_played`,!0),onLoadedmetadata:()=>{Number.isFinite(i.duration)&&(g=i.duration*1e3,m.textContent=`${f(g)} `,s(g))}});i.muted=!0;let m=o(`span`,null,g?`${f(g)} `:``),v=o(`button`,{class:`round`,"aria-label":c(`unmute_clip`),onClick:()=>{h=!h,i.muted=h,v.setAttribute(`aria-label`,c(h?`unmute_clip`:`mute_clip`)),u(v,l(h?`volume-x`:`volume-2`)),h||_(e,t,n,r,`clip_unmuted`)}},l(`volume-x`)),y=o(`button`,{class:`round`,"aria-label":c(`expand_clip`),"aria-pressed":`false`,onClick:()=>{let e=a.classList.toggle(`big`);y.setAttribute(`aria-label`,c(e?`shrink_clip`:`expand_clip`)),y.setAttribute(`aria-pressed`,String(e))}},l(`maximize-2`));u(p,i,o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`play`),m,c(`loop`)),v,y)),i.play()?.catch(()=>{}),s(g)};return i?u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_clip`),onClick:v},l(`play`))):v(),p}function y(e,t,n,r,i){let a=t.steps[n],s=t.steps.length,c=m(e,t.lang),d=a.complete_on.type==`next_button`,f=a.media,p=c(`step_of`,{n:n+1,total:s}),h=t.steps.map((e,t)=>o(`span`,{class:`seg${t<n?` done`:t==n?` cur`:``}`})),g=e=>{let t=h[n];t.className=`seg cur${e&&!r?` anim`:``}`,e?t.style.setProperty(`--d`,`${e}ms`):t.style.removeProperty(`--d`)};i.classList.remove(`big`),i.dataset.step=a.id,i.lang=t.lang,t.rtl?i.dir=`rtl`:i.removeAttribute(`dir`),u(i,f?.kind==`image`?o(`div`,{class:`clip img`},o(`img`,{src:f.url,alt:f.label??``,width:f.width,height:f.height})):f&&v(e,t,n,f,r,i,g),o(`div`,{class:`body`},o(`div`,{class:`meta`},o(`span`,null,`${p} · ${t.name}`),o(`button`,{class:`x`,"aria-label":c(`close_guide`),onClick:()=>e.dispatch({type:`dismiss`})},l(`x`))),o(`div`,{class:`steps`,role:`img`,"aria-label":p},h),o(`h2`,{class:`title`,id:`ps-title`},a.title),o(`p`,{class:`text`,id:`ps-text`},a.body)),o(`div`,{class:`foot`},d?o(`span`,{class:`sp`}):o(`span`,{class:`wait`},o(`span`,{class:`pulse`,"aria-hidden":`true`}),c(`waiting`)),a.back&&o(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`})},c(`back`)),d&&o(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`})},c(n+1==s?`done`:`next`),l(`arrow-right`))));let y=t.steps[n+1]?.media;if(y&&y.kind!=`embed`&&!r&&!navigator.connection?.saveData){if(y.kind==`image`)new Image().src=y.url;else{let r=document.createElement(`video`);r.preload=`auto`,r.muted=!0,r.src=y.url,y.source==`hosted`&&_(e,t,n+1,y,`clip_loaded`,!0)}}}function b(e,t,n,r,i,a=!1,o=12){let s={bottom:e.bottom+i+n<=innerHeight-o,top:e.top-i-n>=o,left:e.left-i-t>=o,right:e.right+i+t<=innerWidth-o},c=r.find(e=>s[e])??r[0],l=(e,t)=>Math.max(o,Math.min(e,t-o));return c==`top`||c==`bottom`?{x:l(a?e.left:e.left+(e.width-t)/2,innerWidth-t),y:c==`top`?e.top-i-n:e.bottom+i}:{x:c==`left`?e.left-i-t:e.right+i,y:l(e.top+(e.height-n)/2,innerHeight-n)}}var x=/* @__PURE__ */ i({fillEl:()=>u,h:()=>o,icon:()=>l,mount:()=>j,words:()=>m});const S=document.currentScript?.src,C=(e,t,n)=>t?new Promise((n,r)=>document.head.append(Object.assign(document.createElement(`script`),{src:new URL(`${e}.js`,S||location.href).href,integrity:t,crossOrigin:`anonymous`,onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))):n(),w=()=>C(`events`,``,()=>import(`./transport-dyLfVpw6.js`)),T=()=>C(`list`,typeof __PLAYSTEP_LIST_INTEGRITY__==`string`?__PLAYSTEP_LIST_INTEGRITY__:``,()=>import(`./list-aBMfDFaK.js`)),E=()=>C(`done`,typeof __PLAYSTEP_DONE_INTEGRITY__==`string`?__PLAYSTEP_DONE_INTEGRITY__:``,()=>import(`./done-C-XNQR1q.js`));function D(e,t,n){let r=m(e),i=e.engine.launcherGuides().filter(t=>!e.engine.progress.guides[t.id]).length;t.className=`lb${e.config.launcher.position==`bottom-left`?` left`:``}`,t.setAttribute(`aria-label`,r(n?`close_guides`:`open_guides`)),t.setAttribute(`aria-expanded`,String(n)),u(t,l(`ps-launcher`),i>0&&!n&&o(`span`,{class:`cnt`},i))}function O(e){let t=location.pathname.split(`/`),n=!0,r=e.split(`/`).map((e,r)=>e==`*`?t[r]||(n=!1,``):e).join(`/`);return n?r:``}const k=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r));function A(e,t,n){let r=o(`div`,{class:`card`,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabindex:`-1`,style:{visibility:`hidden`}}),i=o(`div`,{class:`spot`,"aria-hidden":`true`}),a=o(`div`,{class:`scrim`,"aria-hidden":`true`}),s=!1,c=!1,l,u=-1,d=null,f=[],p=[],m=[],g=!1,_=``,v=``,x,S=e=>e.splice(0).forEach(e=>e()),C=()=>l.steps[u];function w(e,t,a){r.style.transform=`translate(${Math.round(e)}px,${Math.round(t)}px)`,r.style.visibility=``,g||(r.style.transition=`none`,requestAnimationFrame(()=>(g=!0,r.style.transition=``))),s!=!!(d&&a)&&(s=!s,n()),d&&a&&Object.assign(i.style,{width:`${a.w}px`,height:`${a.h}px`,transform:`translate(${a.x}px,${a.y}px)`,borderRadius:`${a.r}px`}),_!=C().id&&(_=C().id,document.hasFocus()&&!document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)&&r.focus({preventScroll:!0}))}function T(){S(m);let e=r;if(c!=(!d&&l.position==`center`)&&(c=!c,n()),!d){let t=()=>w((innerWidth-e.offsetWidth)/2,l.position==`center`?(innerHeight-e.offsetHeight)/2:innerHeight-e.offsetHeight-24);t();let n=new ResizeObserver(t);n.observe(e),m.push(()=>n.disconnect(),k(window,`resize`,t));return}let i=d,a=i.getBoundingClientRect();(a.bottom<0||a.top>innerHeight)&&i.scrollIntoView({block:`center`,behavior:t?`auto`:`smooth`});let o=()=>{let t=i.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(i).borderTopLeftRadius)||8,r=C().placement,{x:a,y:o}=b(t,e.offsetWidth,e.offsetHeight,[r==`auto`?`bottom`:r,`top`,`left`,`right`],18);w(a,o,{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(n+6,(t.height+12)/2)})};o();let s=new ResizeObserver(o);s.observe(i),s.observe(e);let u=setInterval(o,400);m.push(()=>s.disconnect(),()=>clearInterval(u),k(window,`scroll`,o,{capture:!0,passive:!0}),k(window,`resize`,o))}function E(t){d=t,S(p),clearTimeout(x);let n=C();if(t)p.push(k(document,`click`,(r=>{r.composedPath().includes(t)&&(v=``,e.dispatch({type:`tap`,anchor:n.anchor}))}),!0)),t==h(n.anchor,n.find?.web)&&(v=n.id);else if(v==n.id){let t=u;x=setTimeout(()=>{for(let n=t;n--;){let r=l.steps[n];if(!r.anchor||r.complete_on.type==`page`)return;if(h(r.anchor,r.find?.web)){for(let r=t;r-->n;)e.dispatch({type:`back`});return}}},400)}p.push(k(document,`keydown`,(n=>{if(n.key!=`Tab`)return;let i=[...r.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],a=n.composedPath().includes(r),o=i[0],s=i.at(-1),c=e.root.activeElement;a&&!n.shiftKey&&c==s?(n.preventDefault(),(t??o)?.focus()):a&&n.shiftKey&&c==o?(n.preventDefault(),(t??s)?.focus()):t&&document.activeElement==t&&(n.preventDefault(),(n.shiftKey?s:o)?.focus())}),!0)),T()}function D(){S(f);let t=C(),n=t.anchor?h(t.anchor,t.find?.web):null;if(E(n),!t.anchor)return;let r=0,i=()=>{r=0;let e=h(t.anchor,t.find?.web);e!=n&&E(n=e)},a=new MutationObserver(()=>r||(r=requestAnimationFrame(i)));a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-guide`,`hidden`,`style`,`class`]});let o=setTimeout(()=>!n&&e.dispatch({type:`anchor_missing`,anchor:t.anchor}),3e3);f.push(()=>a.disconnect(),()=>clearTimeout(o),()=>cancelAnimationFrame(r))}return{nodes:()=>[s&&i,c&&a,r],get guide(){return l},update(n,i){if(n==l&&i==u)return;let a=!l||i!=u||n.steps[i]?.id!=C().id;l=n,u=i,y(e,n,i,t,r),a?D():T()},stop(){S(f),S(p),S(m),clearTimeout(x)}}}function j(r){let i=r.options,a=e=>void r.outbox.push(e);w().then(({createTransport:t})=>{let n=t({appKey:i.appKey,url:i.eventsUrl,sdk:i.sdkName??`web`,version:e,preview:i.preview,userId:r.userId,locale:()=>p(r),send:i.transport});r.outbox.splice(0).forEach(n.push),a=n.push}).catch(e=>r.emit({type:`sdk_error`,message:String(e)}));let s=r.root;s.appendChild(o(`style`,null,`:host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-inline-start:auto}[dir=rtl] .btn svg{transform:scaleX(-1)}.img>img{object-fit:contain}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:var(--ps-radius-btn,99px);border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.left{right:auto;left:24px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}`));let c=s.appendChild(o(`div`,{class:`l`})),l=o(`div`,{class:`sr`,"aria-live":`polite`}),u=!1,d,f,g=null,_=o(`button`,{onClick:()=>L(!u)}),v,y,x,S,C=e=>r.emit({type:`sdk_error`,message:String(e)}),j=()=>x??(x=T().then(e=>(v=e,s.appendChild(o(`style`,null,e.css)),z())).catch(C)),M=()=>S??(S=E().then(e=>(y=e,s.appendChild(o(`style`,null,e.css)),z())).catch(C)),N,P=[],F=()=>[l],I,L=e=>{u=e,z()};function R(e){let t=e.filter(Boolean);for(t.forEach((e,t)=>c.childNodes[t]!=e&&c.insertBefore(e,c.childNodes[t]??null));c.childNodes.length>t.length;)c.lastChild.remove()}function z(){let e=r.engine.active,a=e?.guide,p=n(r.config,i.colorMode,a?.mode)?`dark`:`light`;s.host.setAttribute(`data-mode`,p),c.removeAttribute(`style`);for(let[e,t]of Object.entries({...r.config.theme?.[p],...a?.tokens?.[p]}))c.style.setProperty(`--ps-${e}`,t);let h=r.engine.launcherGuides().length>0,x=!!f;u&&h&&v?(f??(f=o(`div`,{tabindex:`-1`,role:`dialog`})),v.drawList(r,f,()=>L(!1))):(f=void 0,u&&h&&j()),h&&D(r,_,u),!u&&e?.status==`running`?N?.guide?.id!=a.id&&(N?.stop(),N=A(r,t(),()=>R(F()))):(N?.stop(),N=void 0),e?.status==`running`&&e.index==a.steps.length-1&&M();let S=!u&&e?.status==`completed`&&!!y;!u&&e?.status==`completed`&&!y&&M();let C=S&&(I!=a||!P.length);if(S?C&&(P=y.drawDone(r,a)):P=[],I=S?a:void 0,l.textContent=e?.status==`running`?`${m(r,a.lang)(`step_of`,{n:e.index+1,total:a.steps.length})}: ${a.steps[e.index].title}`:e?.status==`completed`?m(r,a.lang)(`level_cleared`):``,F=()=>[f,h&&r.config.launcher.enabled&&_,...N?.nodes()??[],...P,l],R(F()),N?.update(a,e.index),f&&!x){if(g=s.activeElement??document.activeElement,d){let{x:e,y:t}=b(d.getBoundingClientRect(),f.offsetWidth,f.offsetHeight,[`top`,`bottom`],8,!0);f.style.cssText=`left:${e}px;top:${t}px;right:auto;bottom:auto`}f.focus()}else!f&&x&&g?.focus();C&&P[1]?.focus()}k(window,`keydown`,(e=>{if(e.key!=`Escape`||e.defaultPrevented||!e.composedPath().includes(s.host))return;let t=r.engine.active;if(u)L(!1);else if(t?.status==`completed`)r.dispatch({type:`close`});else if(t?.status==`running`){let e=t.guide.steps[t.index],n=e.anchor?h(e.anchor,e.find?.web):null;r.dispatch({type:`hide`}),n?.focus({preventScroll:!0})}else return;e.preventDefault(),e.stopPropagation()}),!0);let B=new MutationObserver(()=>z());for(let e of[document.documentElement,document.body])B.observe(e,{attributes:!0});return k(matchMedia(`(prefers-color-scheme: dark)`),`change`,()=>z()),z(),{update:()=>{r.engine.launcherGuides().length||(u=!1),z()},openLauncher:e=>{let t=document.activeElement;d=e??(t!=document.body&&t!=s.host?t??void 0:void 0),L(!0)},send:e=>a(e),start:e=>{let t=r.config.guides.find(t=>t.id==e.guide)?.start_path;try{let n=t&&(i.startPage??O)(t,e.guide)||``;r.dispatch({...e,to:n});let a=r.engine.active;a?.status==`waiting`&&a.guide.id==e.guide&&i.navigate(n)}catch(t){C(t),r.dispatch({...e,to:``})}}}}export{u as fillEl,o as h,l as icon,j as mount,x as t,m as words};
1
+ import{t as e}from"./sdk-yfleEVbE.js";import{t}from"./util-X5IoDowG.js";import{t as n}from"./mode-CPlpg1Yl.js";var r=Object.defineProperty,i=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n};const a={x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,play:`<path d="M5 5a2 2 0 0 1 3-1.7l12 7a2 2 0 0 1 0 3.5l-12 7A2 2 0 0 1 5 19z"/>`,"volume-2":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.4 18.4a9 9 0 0 0 0-12.7"/>`,"volume-x":`<path d="M11 4.7a.7.7 0 0 0-1.2-.5L6.4 7.6A1.4 1.4 0 0 1 5.4 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.4a1.4 1.4 0 0 1 1 .4l3.4 3.4A.7.7 0 0 0 11 19.3z"/><path d="m16.5 14.5 5-5"/><path d="m16.5 9.5 5 5"/>`,check:`<path d="M20 6 9 17l-5-5"/>`,"maximize-2":`<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>`,"arrow-right":`<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>`,"rotate-ccw":`<path d="M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"/><path d="M3 3v5h5"/>`,"external-link":`<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>`,"ps-launcher":`<path d="M12 21a9 9 0 1 0-8-5L3 21l5-.9A9 9 0 0 0 12 21z"/><path d="M10 9v6l5-3z"/>`,"ps-level-up":`<path d="M3 21h5v-4h5v-4h5V9"/><path d="M18 9V3l4 2.5L18 8"/>`,"ps-guide":`<rect x="4" y="3" width="4" height="18" rx="2"/><path d="M12 5.5v10l7.5-5z"/>`};function o(e,t,...n){let r=document.createElement(e);for(let e in t){let n=t[e];if(n!=null&&n!==!1){if(e[0]==`o`&&e[1]==`n`)r.addEventListener(e.slice(2).toLowerCase(),n);else if(e==`ref`)n(r);else if(e==`style`)for(let e in n)r.style.setProperty(e,n[e]);else r.setAttribute(e,n===!0?``:String(n))}}return s(r,n),r}function s(e,t){for(let n of t)Array.isArray(n)?s(e,n):n!=null&&n!==!1&&e.appendChild(typeof n==`object`?n:document.createTextNode(String(n)))}const c=document.createElement(`template`);function l(e){return c.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${a[e]}</svg>`,c.content.firstChild}const u=(e,...t)=>{e.textContent=``,s(e,t)},d=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e),f=e=>{let t=Math.round(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},p=e=>e.options.locale??navigator.language??`en`,m=(e,t=e.config.lang)=>(n,r)=>d(e.config.words[t]?.[n]??n,r);function h(e,t){let n=e=>!!e?.getClientRects().length,r=[...document.querySelectorAll(`[data-guide="${CSS.escape(e)}"]`)].find(n)??null;try{r||(r=t?[...document.querySelectorAll(t.css)].find(e=>n(e)&&(!t.text||e.innerText.includes(t.text)))??null:null)}catch{}return n(r)?r:null}function g(e){try{let t=JSON.parse(sessionStorage.getItem(`playstep:clips`)??`[]`);if(t.includes(e))return!1;sessionStorage.setItem(`playstep:clips`,JSON.stringify([...t,e].slice(-200)))}catch{}return!0}function _(e,t,n,r,i,a){(!a||g(`${i}|${r.url}`))&&e.emit({type:i,guide_id:t.id,guide_version:t.version,step_id:t.steps[n].id,step_index:n,clip_id:r.clip_id,clip_source:r.source})}function v(e,t,n,r,i,a,s){let c=m(e,t.lang),d=t.steps[n].title,p=o(`div`,{class:`clip`}),h=!0,g=r.duration_ms??0;if(r.kind==`embed`)return p.className=`clip embed`,u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_video`),onClick:()=>{u(p,o(`iframe`,{src:r.url,title:c(`video`,{title:d}),allow:`autoplay; encrypted-media; picture-in-picture; fullscreen`,allowfullscreen:!0})),_(e,t,n,r,`clip_played`)}},l(`play`)),o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`external-link`),r.label,g?` · ${f(g)}`:``))),s(0),p;let v=()=>{let i=o(`video`,{src:r.url,poster:r.poster,loop:!0,autoplay:!0,playsinline:!0,preload:`auto`,"aria-label":c(`clip`,{title:d}),onLoadeddata:()=>_(e,t,n,r,`clip_loaded`,!0),onPlaying:()=>_(e,t,n,r,`clip_played`,!0),onLoadedmetadata:()=>{Number.isFinite(i.duration)&&(g=i.duration*1e3,m.textContent=`${f(g)} `,s(g))}});i.muted=!0;let m=o(`span`,null,g?`${f(g)} `:``),v=o(`button`,{class:`round`,"aria-label":c(`unmute_clip`),onClick:()=>{h=!h,i.muted=h,v.setAttribute(`aria-label`,c(h?`unmute_clip`:`mute_clip`)),u(v,l(h?`volume-x`:`volume-2`)),h||_(e,t,n,r,`clip_unmuted`)}},l(`volume-x`)),y=o(`button`,{class:`round`,"aria-label":c(`expand_clip`),"aria-pressed":`false`,onClick:()=>{let e=a.classList.toggle(`big`);y.setAttribute(`aria-label`,c(e?`shrink_clip`:`expand_clip`)),y.setAttribute(`aria-pressed`,String(e))}},l(`maximize-2`));u(p,i,o(`div`,{class:`bar`},o(`span`,{class:`pill`},l(`play`),m,c(`loop`)),v,y)),i.play()?.catch(()=>{}),s(g)};return i?u(p,r.poster&&o(`img`,{src:r.poster,alt:``}),o(`button`,{class:`play`,"aria-label":c(`play_clip`),onClick:v},l(`play`))):v(),p}function y(e,t,n,r,i){let a=t.steps[n],s=t.steps.length,c=m(e,t.lang),d=a.complete_on.type==`next_button`,f=a.media,p=c(`step_of`,{n:n+1,total:s}),h=t.steps.map((e,t)=>o(`span`,{class:`seg${t<n?` done`:t==n?` cur`:``}`})),g=e=>{let t=h[n];t.className=`seg cur${e&&!r?` anim`:``}`,e?t.style.setProperty(`--d`,`${e}ms`):t.style.removeProperty(`--d`)};i.classList.remove(`big`),i.dataset.step=a.id,i.lang=t.lang,t.rtl?i.dir=`rtl`:i.removeAttribute(`dir`),u(i,f?.kind==`image`?o(`div`,{class:`clip img`},o(`img`,{src:f.url,alt:f.label??``,width:f.width,height:f.height})):f&&v(e,t,n,f,r,i,g),o(`div`,{class:`body`},o(`div`,{class:`meta`},o(`span`,null,`${p} · ${t.name}`),o(`button`,{class:`x`,"aria-label":c(`close_guide`),onClick:()=>e.dispatch({type:`dismiss`})},l(`x`))),o(`div`,{class:`steps`,role:`img`,"aria-label":p},h),o(`h2`,{class:`title`,id:`ps-title`},a.title),o(`p`,{class:`text`,id:`ps-text`},a.body)),o(`div`,{class:`foot`},d?o(`span`,{class:`sp`}):o(`span`,{class:`wait`},o(`span`,{class:`pulse`,"aria-hidden":`true`}),c(`waiting`)),a.back&&o(`button`,{class:`btn gho`,onClick:()=>e.dispatch({type:`back`})},c(`back`)),d&&o(`button`,{class:`btn pri`,onClick:()=>e.dispatch({type:`next`})},c(n+1==s?`done`:`next`),l(`arrow-right`))));let y=t.steps[n+1]?.media;if(y&&y.kind!=`embed`&&!r&&!navigator.connection?.saveData){if(y.kind==`image`)new Image().src=y.url;else{let r=document.createElement(`video`);r.preload=`auto`,r.muted=!0,r.src=y.url,y.source==`hosted`&&_(e,t,n+1,y,`clip_loaded`,!0)}}}function b(e,t,n,r,i,a=!1,o=12){let s={bottom:e.bottom+i+n<=innerHeight-o,top:e.top-i-n>=o,left:e.left-i-t>=o,right:e.right+i+t<=innerWidth-o},c=r.find(e=>s[e])??r[0],l=(e,t)=>Math.max(o,Math.min(e,t-o));return c==`top`||c==`bottom`?{x:l(a?e.left:e.left+(e.width-t)/2,innerWidth-t),y:c==`top`?e.top-i-n:e.bottom+i}:{x:c==`left`?e.left-i-t:e.right+i,y:l(e.top+(e.height-n)/2,innerHeight-n)}}var x=/* @__PURE__ */ i({fillEl:()=>u,h:()=>o,icon:()=>l,mount:()=>j,words:()=>m});const S=document.currentScript?.src,C=(e,t,n)=>t?new Promise((n,r)=>document.head.append(Object.assign(document.createElement(`script`),{src:new URL(`${e}.js`,S||location.href).href,integrity:t,crossOrigin:`anonymous`,onload:()=>n(window[`__playstep_${e}`]),onerror:()=>r(Error(e))}))):n(),w=()=>C(`events`,``,()=>import(`./transport-dyLfVpw6.js`)),T=()=>C(`list`,typeof __PLAYSTEP_LIST_INTEGRITY__==`string`?__PLAYSTEP_LIST_INTEGRITY__:``,()=>import(`./list-CNnA4ZXr.js`)),E=()=>C(`done`,typeof __PLAYSTEP_DONE_INTEGRITY__==`string`?__PLAYSTEP_DONE_INTEGRITY__:``,()=>import(`./done-wfyo_bTO.js`));function D(e,t,n){let r=m(e),i=e.engine.launcherGuides().filter(t=>!e.engine.progress.guides[t.id]).length;t.className=`lb${e.config.launcher.position==`bottom-left`?` left`:``}`,t.setAttribute(`aria-label`,r(n?`close_guides`:`open_guides`)),t.setAttribute(`aria-expanded`,String(n)),u(t,l(`ps-launcher`),i>0&&!n&&o(`span`,{class:`cnt`},i))}function O(e){let t=location.pathname.split(`/`),n=!0,r=e.split(`/`).map((e,r)=>e==`*`?t[r]||(n=!1,``):e).join(`/`);return n?r:``}const k=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r));function A(e,t,n){let r=o(`div`,{class:`card`,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`ps-title`,"aria-describedby":`ps-text`,tabindex:`-1`,style:{visibility:`hidden`}}),i=o(`div`,{class:`spot`,"aria-hidden":`true`}),a=o(`div`,{class:`scrim`,"aria-hidden":`true`}),s=!1,c=!1,l,u=-1,d=null,f=[],p=[],m=[],g=!1,_=``,v=``,x,S=e=>e.splice(0).forEach(e=>e()),C=()=>l.steps[u];function w(e,t,a){r.style.transform=`translate(${Math.round(e)}px,${Math.round(t)}px)`,r.style.visibility=``,g||(r.style.transition=`none`,requestAnimationFrame(()=>(g=!0,r.style.transition=``))),s!=!!(d&&a)&&(s=!s,n()),d&&a&&Object.assign(i.style,{width:`${a.w}px`,height:`${a.h}px`,transform:`translate(${a.x}px,${a.y}px)`,borderRadius:`${a.r}px`}),_!=C().id&&(_=C().id,document.hasFocus()&&!document.activeElement?.matches(`input,textarea,select,[contenteditable]:not([contenteditable=false])`)&&r.focus({preventScroll:!0}))}function T(){S(m);let e=r;if(c!=(!d&&l.position==`center`)&&(c=!c,n()),!d){let t=()=>w((innerWidth-e.offsetWidth)/2,l.position==`center`?(innerHeight-e.offsetHeight)/2:innerHeight-e.offsetHeight-24);t();let n=new ResizeObserver(t);n.observe(e),m.push(()=>n.disconnect(),k(window,`resize`,t));return}let i=d,a=i.getBoundingClientRect();(a.bottom<0||a.top>innerHeight)&&i.scrollIntoView({block:`center`,behavior:t?`auto`:`smooth`});let o=()=>{let t=i.getBoundingClientRect(),n=Number.parseFloat(getComputedStyle(i).borderTopLeftRadius)||8,r=C().placement,{x:a,y:o}=b(t,e.offsetWidth,e.offsetHeight,[r==`auto`?`bottom`:r,`top`,`left`,`right`],18);w(a,o,{x:t.left-6,y:t.top-6,w:t.width+12,h:t.height+12,r:Math.min(n+6,(t.height+12)/2)})};o();let s=new ResizeObserver(o);s.observe(i),s.observe(e);let u=setInterval(o,400);m.push(()=>s.disconnect(),()=>clearInterval(u),k(window,`scroll`,o,{capture:!0,passive:!0}),k(window,`resize`,o))}function E(t){d=t,S(p),clearTimeout(x);let n=C();if(t)p.push(k(document,`click`,(r=>{r.composedPath().includes(t)&&(v=``,e.dispatch({type:`tap`,anchor:n.anchor}))}),!0)),t==h(n.anchor,n.find?.web)&&(v=n.id);else if(v==n.id){let t=u;x=setTimeout(()=>{for(let n=t;n--;){let r=l.steps[n];if(!r.anchor||r.complete_on.type==`page`)return;if(h(r.anchor,r.find?.web)){for(let r=t;r-->n;)e.dispatch({type:`back`});return}}},400)}p.push(k(document,`keydown`,(n=>{if(n.key!=`Tab`)return;let i=[...r.querySelectorAll(`button,a,iframe,[tabindex="0"]`)],a=n.composedPath().includes(r),o=i[0],s=i.at(-1),c=e.root.activeElement;a&&!n.shiftKey&&c==s?(n.preventDefault(),(t??o)?.focus()):a&&n.shiftKey&&c==o?(n.preventDefault(),(t??s)?.focus()):t&&document.activeElement==t&&(n.preventDefault(),(n.shiftKey?s:o)?.focus())}),!0)),T()}function D(){S(f);let t=C(),n=t.anchor?h(t.anchor,t.find?.web):null;if(E(n),!t.anchor)return;let r=0,i=()=>{r=0;let e=h(t.anchor,t.find?.web);e!=n&&E(n=e)},a=new MutationObserver(()=>r||(r=requestAnimationFrame(i)));a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-guide`,`hidden`,`style`,`class`]});let o=setTimeout(()=>!n&&e.dispatch({type:`anchor_missing`,anchor:t.anchor}),3e3);f.push(()=>a.disconnect(),()=>clearTimeout(o),()=>cancelAnimationFrame(r))}return{nodes:()=>[s&&i,c&&a,r],get guide(){return l},update(n,i){if(n==l&&i==u)return;let a=!l||i!=u||n.steps[i]?.id!=C().id;l=n,u=i,y(e,n,i,t,r),a?D():T()},stop(){S(f),S(p),S(m),clearTimeout(x)}}}function j(r){let i=r.options,a=e=>void r.outbox.push(e);w().then(({createTransport:t})=>{let n=t({appKey:i.appKey,url:i.eventsUrl,sdk:i.sdkName??`web`,version:e,preview:i.preview,userId:r.userId,locale:()=>p(r),send:i.transport});r.outbox.splice(0).forEach(n.push),a=n.push}).catch(e=>r.emit({type:`sdk_error`,message:String(e)}));let s=r.root;s.appendChild(o(`style`,null,`:host{--ps-radius-md:14px;--ps-radius-lg:20px;--ps-font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;--ps-font-sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;--ps-clip-overlay:rgba(12,14,19,.72);--ps-ease:cubic-bezier(.2,.8,.2,1);--ps-accent:var(--ps-primary);--ps-accent-hover:var(--ps-primary-hover);--ps-on-accent:var(--ps-on-primary);--ps-surface:#fff;--ps-surface-sunken:#f5f6f9;--ps-surface-raised:#fff;--ps-line:#e3e6ec;--ps-ink:#151823;--ps-ink-secondary:#454b5c;--ps-ink-muted:#646b7d;--ps-primary:#2e5bff;--ps-primary-hover:#2149e6;--ps-primary-soft:#e8edff;--ps-primary-ink:#2149e6;--ps-on-primary:#fff;--ps-spark:#ffc933;--ps-spark-soft:#fff4cc;--ps-spark-ink:#7a5a00;--ps-on-spark:#151823;--ps-scrim:rgba(12,14,19,.64);--ps-tag-mint:#ddf5ea;--ps-chart-4:#14b37d;--ps-chart-5:#ff7a59;--ps-shadow-lg:0 20px 48px -12px rgba(21,24,35,.28),0 4px 10px rgba(21,24,35,.06);--ps-ring-focus:0 0 0 2px #fff,0 0 0 4px #2e5bff}:host([data-mode=dark]){--ps-surface:#161922;--ps-surface-sunken:#1d212b;--ps-surface-raised:#222633;--ps-line:#2a2f3c;--ps-ink:#f2f4f8;--ps-ink-secondary:#c5cad5;--ps-ink-muted:#959cad;--ps-primary:#7091ff;--ps-primary-hover:#8da7ff;--ps-primary-soft:#1c2550;--ps-primary-ink:#93abff;--ps-on-primary:#0c0e13;--ps-spark:#ffd452;--ps-spark-soft:#3a2f0a;--ps-spark-ink:#ffd86b;--ps-on-spark:#151823;--ps-scrim:rgba(0,0,0,.72);--ps-tag-mint:#0f2c22;--ps-chart-4:#3dd9a0;--ps-chart-5:#ff9478;--ps-shadow-lg:0 20px 48px -12px rgba(0,0,0,.8),0 4px 10px rgba(0,0,0,.5);--ps-ring-focus:0 0 0 2px #161922,0 0 0 4px #7091ff}:host{all:initial}*{box-sizing:border-box;margin:0}.l{position:fixed;inset:0;pointer-events:none;z-index:2147483000;font:400 14px/20px var(--ps-font-sans);color:var(--ps-ink);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit;border:0;padding:0;background:none;cursor:pointer}button:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--ps-ring-focus)}svg{width:16px;height:16px;flex:none}.scrim{position:fixed;inset:0;background:var(--ps-scrim);pointer-events:auto}.spot,.card{position:fixed;left:0;top:0;transition:transform .36s var(--ps-ease),width .36s var(--ps-ease),height .36s var(--ps-ease)}.spot{box-shadow:0 0 0 9999px var(--ps-scrim)}.spot:after{content:"";position:absolute;inset:-4px;border-radius:18px;border:2px solid var(--ps-spark);animation:ring 1.8s ease-out infinite}.card,.cel,.panel{background:var(--ps-surface-raised);border-radius:var(--ps-radius-lg);box-shadow:var(--ps-shadow-lg);pointer-events:auto;outline:none}.card{width:336px;max-width:calc(100vw - 24px);padding:10px}.big{width:min(720px,calc(100vw - 24px))}.clip{position:relative;aspect-ratio:16/10;border-radius:var(--ps-radius-md);overflow:hidden;background:var(--ps-surface-sunken)}.clip>video,.clip>img,.clip>iframe{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border:0}.bar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;align-items:center;gap:6px;color:#fff}.pill,.round{background:var(--ps-clip-overlay);border-radius:99px;display:inline-flex;align-items:center;justify-content:center}.pill{height:24px;padding:0 8px;gap:4px;font:700 11px/1 var(--ps-font-sans)}.pill svg{width:13px;height:13px}.round{width:28px;height:28px}.round svg{width:14px;height:14px}.bar .round:first-of-type{margin-inline-start:auto}[dir=rtl] .btn svg{transform:scaleX(-1)}.img>img{object-fit:contain}.play{position:absolute;inset:0;margin:auto;width:60px;height:60px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);display:grid;place-items:center}.play svg{width:26px;height:26px}.body{padding:14px 8px 6px}.meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted);margin-bottom:10px}.meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.x{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;margin:-6px -6px -6px 0}.x:hover,.gho:hover,.row:hover,.sec:hover{background:var(--ps-surface-sunken);color:var(--ps-ink)}.steps{display:flex;gap:4px;margin-bottom:12px}.seg{flex:1;height:6px;border-radius:99px;background:var(--ps-surface-sunken);overflow:hidden;position:relative}.done{background:var(--ps-accent)}.cur:after{content:"";position:absolute;left:0;top:0;bottom:0;width:55%;border-radius:99px;background:var(--ps-spark)}.anim:after{animation:fill var(--d,4s) linear infinite}.title,.cel h2,.panel h2{font:700 20px/26px var(--ps-font-display);letter-spacing:-.01em;margin-bottom:4px}.text,.cel p{color:var(--ps-ink-secondary)}.foot{display:flex;align-items:center;gap:8px;padding:14px 8px 4px}.wait,.sp{flex:1}.wait{display:flex;align-items:center;gap:8px;font-size:12px;line-height:16px;font-weight:600;color:var(--ps-ink-muted)}.pulse{width:8px;height:8px;border-radius:50%;background:var(--ps-spark);animation:pulse 1.6s ease-out infinite}.btn{height:32px;padding:0 14px;border-radius:var(--ps-radius-btn,99px);border:1px solid transparent;font-size:13px;line-height:18px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.pri{background:var(--ps-accent);color:var(--ps-on-accent)}.pri:hover{background:var(--ps-accent-hover)}.x{color:var(--ps-ink-muted)}.gho{color:var(--ps-ink-secondary)}.embed{background:#151823}.sec{background:var(--ps-surface);border-color:var(--ps-line)}.acts{display:flex;justify-content:center;gap:12px}.lb{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--ps-accent);color:var(--ps-on-accent);box-shadow:var(--ps-shadow-lg);display:grid;place-items:center;pointer-events:auto}.lb svg{width:26px;height:26px}.cnt{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:99px;background:var(--ps-spark);color:var(--ps-on-spark);font:800 11px/20px var(--ps-font-sans)}.left{right:auto;left:24px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}@keyframes ring{to{opacity:0;transform:scale(1.12)}}@keyframes pulse{0%{box-shadow:0 0 0 0 var(--ps-spark)}70%,to{box-shadow:0 0 0 8px transparent}}@keyframes fill{0%{width:0}to{width:100%}}@media (max-width:480px){.card{width:300px}.title{font-size:17px;line-height:22px}.lb{right:18px;bottom:18px}.left{right:auto;left:18px}}@media (prefers-reduced-motion:reduce){.spot,.card{transition:none}.spot:after,.pulse,.cur:after,.tile{animation:none}}`));let c=s.appendChild(o(`div`,{class:`l`})),l=o(`div`,{class:`sr`,"aria-live":`polite`}),u=!1,d,f,g=null,_=o(`button`,{onClick:()=>L(!u)}),v,y,x,S,C=e=>r.emit({type:`sdk_error`,message:String(e)}),j=()=>x??(x=T().then(e=>(v=e,s.appendChild(o(`style`,null,e.css)),z())).catch(C)),M=()=>S??(S=E().then(e=>(y=e,s.appendChild(o(`style`,null,e.css)),z())).catch(C)),N,P=[],F=()=>[l],I,L=e=>{u=e,z()};function R(e){let t=e.filter(Boolean);for(t.forEach((e,t)=>c.childNodes[t]!=e&&c.insertBefore(e,c.childNodes[t]??null));c.childNodes.length>t.length;)c.lastChild.remove()}function z(){let e=r.engine.active,a=e?.guide,p=n(r.config,i.colorMode,a?.mode)?`dark`:`light`;s.host.setAttribute(`data-mode`,p),c.removeAttribute(`style`);for(let[e,t]of Object.entries({...r.config.theme?.[p],...a?.tokens?.[p]}))c.style.setProperty(`--ps-${e}`,t);let h=r.engine.launcherGuides().length>0,x=!!f;u&&h&&v?(f??(f=o(`div`,{tabindex:`-1`,role:`dialog`})),v.drawList(r,f,()=>L(!1))):(f=void 0,u&&h&&j()),h&&D(r,_,u),!u&&e?.status==`running`?N?.guide?.id!=a.id&&(N?.stop(),N=A(r,t(),()=>R(F()))):(N?.stop(),N=void 0),e?.status==`running`&&e.index==a.steps.length-1&&M();let S=!u&&e?.status==`completed`&&!!y;!u&&e?.status==`completed`&&!y&&M();let C=S&&(I!=a||!P.length);if(S?C&&(P=y.drawDone(r,a)):P=[],I=S?a:void 0,l.textContent=e?.status==`running`?`${m(r,a.lang)(`step_of`,{n:e.index+1,total:a.steps.length})}: ${a.steps[e.index].title}`:e?.status==`completed`?m(r,a.lang)(`level_cleared`):``,F=()=>[f,h&&r.config.launcher.enabled&&_,...N?.nodes()??[],...P,l],R(F()),N?.update(a,e.index),f&&!x){if(g=s.activeElement??document.activeElement,d){let{x:e,y:t}=b(d.getBoundingClientRect(),f.offsetWidth,f.offsetHeight,[`top`,`bottom`],8,!0);f.style.cssText=`left:${e}px;top:${t}px;right:auto;bottom:auto`}f.focus()}else!f&&x&&g?.focus();C&&P[1]?.focus()}k(window,`keydown`,(e=>{if(e.key!=`Escape`||e.defaultPrevented||!e.composedPath().includes(s.host))return;let t=r.engine.active;if(u)L(!1);else if(t?.status==`completed`)r.dispatch({type:`close`});else if(t?.status==`running`){let e=t.guide.steps[t.index],n=e.anchor?h(e.anchor,e.find?.web):null;r.dispatch({type:`hide`}),n?.focus({preventScroll:!0})}else return;e.preventDefault(),e.stopPropagation()}),!0);let B=new MutationObserver(()=>z());for(let e of[document.documentElement,document.body])B.observe(e,{attributes:!0});return k(matchMedia(`(prefers-color-scheme: dark)`),`change`,()=>z()),z(),{update:()=>{r.engine.launcherGuides().length||(u=!1),z()},openLauncher:e=>{let t=document.activeElement;d=e??(t!=document.body&&t!=s.host?t??void 0:void 0),L(!0)},send:e=>a(e),start:e=>{let t=r.config.guides.find(t=>t.id==e.guide)?.start_path;try{let n=t&&(i.startPage??O)(t,e.guide)||``;r.dispatch({...e,to:n});let a=r.engine.active;a?.status==`waiting`&&a.guide.id==e.guide&&i.navigate(n)}catch(t){C(t),r.dispatch({...e,to:``})}}}}export{u as fillEl,o as h,l as icon,j as mount,x as t,m as words};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axceera/playstep",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "PlayStep web SDK: playable, video-first guides for any web app. A 3.7 KB loader; the guide UI loads only when a guide shows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,8 +43,8 @@
43
43
  "typescript": "~6.0.3",
44
44
  "vite": "^8.3.4",
45
45
  "vitest": "^4.1.11",
46
- "@playstep/spec": "0.1.0",
47
- "@playstep/design-system": "0.1.0"
46
+ "@playstep/design-system": "0.1.0",
47
+ "@playstep/spec": "0.1.0"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsdown && node scripts/cdn.ts",
@@ -1,13 +0,0 @@
1
- const e=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,t=/\+?\(?\d[\d\s().-]{5,}\d/g,n=/\d{6,}/g,r=/\b(?=[\w-]*\d)[\w-]{24,}\b/g;function i(i){return[e,r,n].some(e=>new RegExp(e.source).test(i))||[...i.matchAll(t)].some(e=>e[0].replace(/\D/g,``).length>=7)}function a(i){return i.replace(e,`[email]`).replace(r,`[id]`).replace(t,e=>e.replace(/\D/g,``).length>=7?`[number]`:e).replace(n,`[number]`)}function o(e){if(!e)return``;let t=a(e.replace(/\s+/g,` `).trim());return t.length>80?`${t.slice(0,79)}…`:t}function s(e=80){let t=/^(:|radix-|headlessui-|react-|ember\d|mui-|v-|css-|sc-|jsx-)|\d{3,}|[a-f0-9]{8,}|__/i,n=/active|selected|current|open|hover|focus|disabled|hidden|show|visible|checked|loading/i,r=e=>(e??``).replace(/\s+/g,` `).trim().slice(0,80),i=e=>`"${e.replace(/["\\]/g,`\\$&`)}"`,a=e=>CSS.escape(e),o=e=>{try{return document.querySelectorAll(e).length===1}catch{return!1}},s=e=>{let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return n.visibility!==`hidden`&&n.display!==`none`&&Number(n.opacity||1)>.05},c=e=>{let t=e.getAttribute(`role`),n=e.tagName,r=(e.getAttribute(`type`)??``).toLowerCase();return t===`tab`||t===`menuitem`||t===`link`||t===`button`?t:t===`checkbox`||t===`switch`||n===`INPUT`&&(r===`checkbox`||r===`radio`)?`checkbox`:n===`A`?`link`:n===`BUTTON`||n===`SUMMARY`||n===`INPUT`&&/^(submit|button|reset|image)$/.test(r)?`button`:n===`SELECT`?`select`:n===`INPUT`||n===`TEXTAREA`?`input`:`other`},l=e=>{let r=e.tagName.toLowerCase(),s=[];e.id&&!t.test(e.id)&&s.push(`#${a(e.id)}`);for(let t of[`data-testid`,`data-test`,`data-cy`,`data-qa`]){let n=e.getAttribute(t);n&&s.push(`[${t}=${i(n)}]`)}for(let t of[`aria-label`,`name`,`title`,`placeholder`]){let n=e.getAttribute(t);n&&n.length<=80&&s.push(`${r}[${t}=${i(n)}]`)}let c=e.getAttribute(`href`);r===`a`&&c&&!/^javascript:/i.test(c)&&c.length<=200&&s.push(`a[href=${i(c)}]`);let l=[...e.classList].filter(e=>/^[a-z][\w-]{1,40}$/i.test(e)&&!t.test(e)&&!n.test(e));l.length&&s.push(`${r}.${l.slice(0,3).map(a).join(`.`)}`);for(let e of s)if(o(e))return e;let u=[],d=e;for(;d&&u.length<7;){if(d===document.body){u.unshift(`body`);break}if(d!==e&&d.id&&!t.test(d.id)){u.unshift(`#${a(d.id)}`);break}let n=d.tagName.toLowerCase(),r=d.parentElement?[...d.parentElement.children].filter(e=>e.tagName===d.tagName):[];u.unshift(r.length>1?`${n}:nth-of-type(${r.indexOf(d)+1})`:n),d=d.parentElement}let f=u.join(`>`);return o(f)?f:void 0},u=e=>{let t=e.getAttribute(`aria-label`)||e.getAttribute(`title`);if(t)return t;let n=e.getAttribute(`aria-labelledby`);if(n)return n.split(/\s+/).map(e=>document.getElementById(e)?.textContent??``).join(` `);let r=e.labels;return r?.length?r[0].innerText:``},d=[...document.querySelectorAll(`a[href],button,input:not([type=hidden]),select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],[data-guide]`)].filter(e=>!e.closest(`[data-private],[aria-hidden=true],[inert]`)&&s(e)&&!e.parentElement?.closest(`a[href],button,[role=button],[role=link]`)).map((e,t)=>{let n=e.getBoundingClientRect(),r=n.bottom>0&&n.top<innerHeight;return{e,i:t,score:(e.hasAttribute(`data-guide`)?0:2)+ +!r}}).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,e).sort((e,t)=>e.i-t.i),f=[];for(let{e}of d){let t=c(e),n=e.getAttribute(`data-guide`),i=t===`input`||t===`select`?``:r(e.innerText||e.textContent),a=r(u(e))||(e.tagName===`INPUT`&&t===`button`?r(e.value):``),o=r(e.getAttribute(`placeholder`)),s=e.getAttribute(`href`),d;if(e.tagName===`A`&&s)try{let e=new URL(s,location.href);e.origin===location.origin&&(d=e.pathname)}catch{}let p=n?void 0:l(e);if(!n&&!p)continue;let m=e.getBoundingClientRect();f.push({ref:`e${f.length+1}`,role:t,...i?{text:i}:{},...a&&a!==i?{label:a}:{},...o?{placeholder:o}:{},...d?{href:d}:{},...n?{anchor:n.slice(0,64)}:{css:p.slice(0,300)},clickable:t!==`input`&&t!==`select`&&t!==`other`,rect:[m.left+scrollX,m.top+scrollY,m.width,m.height].map(Math.round)})}let p=[...document.querySelectorAll(`h1,h2,h3,[role=heading]`)].filter(e=>!e.closest(`[data-private]`)&&s(e)).map(e=>r(e.innerText)).filter(Boolean).slice(0,10);return{platform:`web`,path:location.pathname||`/`,...document.title?{title:r(document.title)}:{},headings:p,viewport:[innerWidth,innerHeight],elements:f}}function c(){let e=document.createElement(`canvas`);e.width=e.height=1;let t=e.getContext(`2d`,{willReadFrequently:!0}),n=e=>{if(!t||!e||e===`transparent`||e===`none`||(t.fillStyle=`#010203`,t.fillStyle=e,t.fillStyle===`#010203`&&!/^#010203$/i.test(e)))return null;t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let n=t.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]/255]},r=e=>`#${e.slice(0,3).map(e=>e.toString(16).padStart(2,`0`)).join(``)}`,i=e=>(Math.max(e[0],e[1],e[2])-Math.min(e[0],e[1],e[2]))/255,a=e=>{let[t,n,r]=e.slice(0,3).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},o=(e,t)=>{let r=n(e),i=n(t);return Math.hypot(r[0]-i[0],r[1]-i[1],r[2]-i[2])<30},s=e=>{let t=e.getBoundingClientRect();if(t.width<4||t.height<4||t.bottom<0||t.top>innerHeight*3)return null;let n=getComputedStyle(e);return n.visibility===`hidden`||n.display===`none`||Number(n.opacity||1)<.3?null:{r:t,s:n}},c=e=>{let t=n(e);return t&&t[3]>=.9?t:null},l=e=>e.length?e.sort((e,t)=>e-t)[Math.floor(e.length/2)]:void 0,u=null;for(let e of[document.querySelector(`#root,#app,#__next,[data-reactroot],main`),document.body,document.documentElement])if(u=e?c(getComputedStyle(e).backgroundColor):null,u)break;for(let e=document.elementFromPoint(innerWidth/2,innerHeight/2);!u&&e;e=e.parentElement)u=c(getComputedStyle(e).backgroundColor);u??(u=getComputedStyle(document.documentElement).colorScheme.trim()===`dark`?[18,18,18,1]:[255,255,255,1]);let d=a(u)<.2,f=n(getComputedStyle(document.querySelector(`main`)??document.body).color),p=[],m=(e,t,n)=>{let r=p.find(t=>t.from===n&&o(t.color,e));r?r.weight+=t:p.push({color:e,weight:t,from:n})},h=[],g=document.querySelectorAll(`button,[role=button],input[type=submit],input[type=button],a,[class*=btn],[class*=Btn],[class*=button],[class*=Button]`);for(let e of[...g].slice(0,400)){let t=s(e);if(!t)continue;let o=c(t.s.backgroundColor);if(o&&i(o)>.18&&a(o)>.02&&a(o)<.9){m(r(o),Math.min(t.r.width*t.r.height,3e4),`button`);let e=Number.parseFloat(t.s.borderTopLeftRadius)||0;h.push(e>=t.r.height/2-1?999:e)}else if(e.tagName===`A`){let e=n(t.s.color);e&&i(e)>.25&&m(r(e),400,`link`)}}let _=getComputedStyle(document.documentElement),v=/* @__PURE__ */ new Set,y=0;for(let e of[...document.styleSheets]){let t;try{t=e.cssRules}catch{continue}for(let e of[...t]){if(++y>3e3)break;let t=e.style;if(t&&/:root|html|body|\.light|\[data-theme/.test(e.selectorText??``))for(let e of[...t]){if(!e.startsWith(`--`)||v.has(e)||!/primary|accent|brand/i.test(e)||/foreground|fg|text|contrast|muted|soft|subtle|hover|active|border|ring|shadow|sidebar|chart|50\b|100\b|900\b/i.test(e))continue;v.add(e);let t=_.getPropertyValue(e).trim(),a=n(t)??n(`hsl(${t})`)??n(`rgb(${t})`)??n(`oklch(${t})`);a&&a[3]>=.9&&i(a)>.18&&m(r(a),/^--(color-)?(primary|brand)$/i.test(e)?8e4:4e4,`variable`)}}}let b=n(document.querySelector(`meta[name=theme-color]`)?.getAttribute(`content`));b&&i(b)>.18&&m(r(b),2e4,`theme-color`);let x=[],S=[],C=document.querySelectorAll(`section,article,aside,dialog,[role=dialog],[class*=card],[class*=Card],[class*=panel],[class*=Panel],div`);for(let e of[...C].slice(0,800)){let t=s(e);if(!t||t.r.width*t.r.height<2e4||t.r.width>innerWidth*.95)continue;let n=c(t.s.backgroundColor);if(!n||i(n)>.2||o(r(n),r(u))||a(n)<.2!==d)continue;let l=t.s.boxShadow!==`none`||Number.parseFloat(t.s.borderTopWidth)>0,f=r(n),p=x.find(e=>o(e.color,f)),m=Math.min(t.r.width*t.r.height,2e5)*(l?2:1);p?p.weight+=m:x.push({color:f,weight:m}),l&&S.push(Number.parseFloat(t.s.borderTopLeftRadius)||0)}let w=getComputedStyle(document.body).fontFamily,T=document.querySelector(`h1,h2`),E=T?getComputedStyle(T).fontFamily:void 0;return{scheme:d?`dark`:`light`,background:r(u),...f?{text:r(f)}:{},accents:p.sort((e,t)=>t.weight-e.weight).slice(0,8),surfaces:x.sort((e,t)=>t.weight-e.weight).slice(0,4).map(e=>e.color),...w?{font:w.slice(0,300)}:{},...E&&E!==w?{displayFont:E.slice(0,300)}:{},...h.length?{radius:l(h)}:{},...S.length?{cardRadius:l(S)}:{}}}function l(){try{return c()}catch{return}}const u=`playstep_preview`,d=`playstep_capture_on`,f={get:e=>{try{return sessionStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}catch{}}};function p(e){let t=e=>e&&o(e)||void 0;return{...e,title:t(e.title),headings:(e.headings??[]).map(e=>o(e)).filter(Boolean),elements:e.elements.map(e=>({...e,text:t(e.text),label:t(e.label),placeholder:t(e.placeholder),href:e.href&&!i(e.href)?e.href:void 0,css:e.css&&!i(e.css)?e.css:void 0})).filter(e=>e.anchor||e.css)}}function m(e,t){let n=document.createElement(`playstep-capture`),r=n.attachShadow({mode:`open`});document.body.appendChild(n);let i=document.createElement(`div`);i.className=`p`,i.setAttribute(`role`,`region`),i.setAttribute(`aria-label`,`PlayStep capture`),r.innerHTML=`<style>:host{all:initial}
2
- .p{position:fixed;left:24px;bottom:24px;z-index:2147483001;width:320px;max-width:calc(100vw - 48px);box-sizing:border-box;padding:16px;border-radius:16px;background:#fff;color:#151823;font:14px/20px system-ui,-apple-system,"Segoe UI",sans-serif;box-shadow:0 12px 32px #15182333,0 0 0 1px #15182314}
3
- h2{margin:0 0 4px;font-size:15px;line-height:22px;font-weight:700;display:flex;align-items:center;gap:8px}
4
- p{margin:0 0 12px;color:#4a5163}
5
- .dot{width:8px;height:8px;border-radius:50%;background:#e5484d;animation:b 1.6s ease-in-out infinite}
6
- @keyframes b{50%{opacity:.35}}
7
- .row{display:flex;gap:8px;flex-wrap:wrap}
8
- button{font:600 14px/20px inherit;font-family:inherit;border:0;border-radius:999px;padding:8px 14px;cursor:pointer;background:#eef0f5;color:#151823}
9
- button.go{background:#2e5bff;color:#fff}
10
- button:focus-visible{outline:2px solid #2e5bff;outline-offset:2px}
11
- .last{margin:-6px 0 12px;font-size:12px;color:#4a5163;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
12
- @media (prefers-color-scheme:dark){.p{background:#151821;color:#e7e9ee;box-shadow:0 12px 32px #0008,0 0 0 1px #ffffff1a}p,.last{color:#b4bccb}button{background:#262a35;color:#e7e9ee}button.go{background:#4f78ff}}
13
- @media (prefers-reduced-motion:reduce){.dot{animation:none}}</style>`,r.appendChild(i);let a=0,o=``,c,m=!1,h=(n=``)=>`${e.endpoint}${n}?key=${encodeURIComponent(t)}`,g=(e,t,n=!1)=>{let r=document.createElement(`button`);return r.textContent=e,n&&(r.className=`go`),r.onclick=t,r},_=(e,t,n,r={})=>{i.innerHTML=``;let a=document.createElement(`h2`);r.live&&(a.innerHTML=`<span class="dot" aria-hidden="true"></span>`),a.append(e);let o=document.createElement(`p`);if(o.textContent=t,o.setAttribute(`aria-live`,`polite`),i.append(a,o),r.note){let e=document.createElement(`div`);e.className=`last`,e.textContent=r.note,i.append(e)}let s=document.createElement(`div`);s.className=`row`,s.append(...n),i.append(s)},v=()=>{m=!0,clearTimeout(c),f.set(u,null),f.set(d,null),n.remove()},y=()=>{m=!0,f.set(u,null),f.set(d,null),_(`Capture link expired`,`Get a new link from Generate with AI in PlayStep.`,[g(`Close`,v,!0)])},b=e=>_(`Capturing · ${a} ${a===1?`page`:`pages`}`,`Open the pages your users need help with. Each one is added as you go.`,[g(`Capture this page`,()=>void x()),g(`Finish`,()=>void S(),!0)],{live:!0,note:e});async function x(){if(m)return;clearTimeout(c);let e={...p(s()),style:l()};try{let t=await fetch(h(`/screens`),{method:`POST`,headers:{"content-type":`text/plain`},body:JSON.stringify(e)});if(t.status===404||t.status===410)return y();let n=await t.json().catch(()=>({}));if(!t.ok)return b(n.message??`That page could not be added.`);a=n.screens??a+1,o=location.pathname,b(`Added ${e.title||o}`)}catch{b(`PlayStep could not be reached. It will try again on the next page.`)}}async function S(){m=!0,await fetch(h(`/finish`),{method:`POST`}).catch(()=>void 0),f.set(u,null),f.set(d,null),_(`Capture finished`,`${a} ${a===1?`page`:`pages`} captured. Go back to PlayStep to generate tours.`,[g(`Close`,()=>n.remove(),!0)])}let C=()=>{m||f.get(d)!==`1`||location.pathname===o||(clearTimeout(c),c=setTimeout(()=>void x(),1200))};for(let e of[`pushState`,`replaceState`]){let t=history[e];history[e]=function(...e){t.apply(this,e),C()}}addEventListener(`popstate`,C);let w=()=>{f.set(d,`1`),b(),C()};return f.get(d)===`1`?fetch(h()).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>{a=e.screens,w()}).catch(e=>e===404?y():w()):_(`Show PlayStep your app`,`Visit the pages your users need help with. PlayStep notes the buttons, links and headings on each page. Never what you type, and no screenshots.`,[g(`Start capturing`,w,!0),g(`Not now`,v)]),{captureNow:x,stop:v}}export{p as redactScreen,s as snapshotPage,m as start};