@snagset/server 0.0.1 → 0.0.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 @@
1
+ (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))o(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var ee,C,Pe,U,pe,xe,Ie,te,V,F,Ee,ae,ie,se,Q={},X=[],Be=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ne=Array.isArray;function D(e,n){for(var r in n)e[r]=n[r];return e}function ce(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function We(e,n,r){var o,i,s,a={};for(s in n)s=="key"?o=n[s]:s=="ref"?i=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?ee.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)a[s]===void 0&&(a[s]=e.defaultProps[s]);return K(e,a,o,i,null)}function K(e,n,r,o,i){var s={type:e,props:n,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Pe,__i:-1,__u:0};return i==null&&C.vnode!=null&&C.vnode(s),s}function N(e){return e.children}function J(e,n){this.props=e,this.context=n}function q(e,n){if(n==null)return e.__?q(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?q(e):null}function Ge(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],i=[],s=D({},n);s.__v=n.__v+1,C.vnode&&C.vnode(s),de(e.__P,s,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,r??q(n),!!(32&n.__u),i),s.__v=n.__v,s.__.__k[s.__i]=s,Le(o,s,i),n.__e=n.__=null,s.__e!=r&&je(s)}}function je(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),je(e)}function me(e){(!e.__d&&(e.__d=!0)&&U.push(e)&&!Z.__r++||pe!=C.debounceRendering)&&((pe=C.debounceRendering)||xe)(Z)}function Z(){try{for(var e,n=1;U.length;)U.length>n&&U.sort(Ie),e=U.shift(),n=U.length,Ge(e)}finally{U.length=Z.__r=0}}function Ne(e,n,r,o,i,s,a,c,_,d,p){var k,l,h,m,y,b,f=o&&o.__k||X,g=n.length;for(_=ze(r,n,f,_,g),k=0;k<g;k++)(h=r.__k[k])!=null&&(l=h.__i!=-1&&f[h.__i]||Q,h.__i=k,b=de(e,h,l,i,s,a,c,_,d,p),m=h.__e,h.ref&&l.ref!=h.ref&&(l.ref&&ue(l.ref,null,h),p.push(h.ref,h.__c||m,h)),y==null&&m!=null&&(y=m),4&h.__u?(_=Re(h,_,e),l.__e&&(l.__e=null)):typeof h.type=="function"&&b!==void 0?_=b:m&&(_=m.nextSibling),h.__u&=-7);return r.__e=y,_}function ze(e,n,r,o,i){var s,a,c,_,d,p=r.length,k=p,l=0;for(e.__k=new Array(i),s=0;s<i;s++)(a=n[s])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[s]=K(null,a,null,null,null):ne(a)?a=e.__k[s]=K(N,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[s]=K(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[s]=a,_=s+l,a.__=e,a.__b=e.__b+1,c=null,(d=a.__i=Ve(a,r,_,k))!=-1&&(k--,(c=r[d])&&(c.__u|=2)),c==null||c.__v==null?(d==-1&&(i>p?l--:i<p&&l++),typeof a.type!="function"&&(a.__u|=4)):d!=_&&(d==_-1?l--:d==_+1?l++:(d>_?l--:l++,a.__u|=4))):e.__k[s]=null;if(k)for(s=0;s<p;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==o&&(o=q(c)),qe(c,c));return o}function Re(e,n,r){var o,i;if(typeof e.type=="function"){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,n=Re(o[i],n,r));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=q(e)),n=r.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Ve(e,n,r,o){var i,s,a,c=e.key,_=e.type,d=n[r],p=d!=null&&(2&d.__u)==0;if(d===null&&c==null||p&&c==d.key&&_==d.type)return r;if(o>(p?1:0)){for(i=r-1,s=r+1;i>=0||s<n.length;)if((d=n[a=i>=0?i--:s++])!=null&&(2&d.__u)==0&&c==d.key&&_==d.type)return a}return-1}function fe(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||Be.test(n)?r:r+"px"}function G(e,n,r,o,i){var s,a;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(n in o)r&&n in r||fe(e.style,n,"");if(r)for(n in r)o&&r[n]==o[n]||fe(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")s=n!=(n=n.replace(Ee,"$1")),a=n.toLowerCase(),n=a in e||n=="onFocusOut"||n=="onFocusIn"?a.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+s]=r,r?o?r[F]=o[F]:(r[F]=ae,e.addEventListener(n,s?se:ie,s)):e.removeEventListener(n,s?se:ie,s);else{if(i=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function ve(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[V]==null)n[V]=ae++;else if(n[V]<r[F])return;return r(C.event?C.event(n):n)}}}function de(e,n,r,o,i,s,a,c,_,d){var p,k,l,h,m,y,b,f,g,T,R,v,u,S,A,$,j=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(_=!!(32&r.__u),s=[c=n.__e=r.__e]),(p=C.__b)&&p(n);e:if(typeof j=="function"){k=a.length;try{if(g=n.props,T=j.prototype&&j.prototype.render,R=(p=j.contextType)&&o[p.__c],v=p?R?R.props.value:p.__:o,r.__c?f=(l=n.__c=r.__c).__=l.__E:(T?n.__c=l=new j(g,v):(n.__c=l=new J(g,v),l.constructor=j,l.render=Je),R&&R.sub(l),l.state||(l.state={}),l.__n=o,h=l.__d=!0,l.__h=[],l._sb=[]),T&&l.__s==null&&(l.__s=l.state),T&&j.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=D({},l.__s)),D(l.__s,j.getDerivedStateFromProps(g,l.__s))),m=l.props,y=l.state,l.__v=n,h)T&&j.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),T&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(T&&j.getDerivedStateFromProps==null&&g!==m&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(g,v),n.__v==r.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(g,l.__s,v)===!1){n.__v!=r.__v&&(l.props=g,l.state=l.__s,l.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(O){O&&(O.__=n)}),X.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&a.push(l),c=q(r);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(g,l.__s,v),T&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(m,y,b)})}if(l.context=v,l.props=g,l.__P=e,l.__e=!1,u=C.__r,S=0,T)l.state=l.__s,l.__d=!1,u&&u(n),p=l.render(l.props,l.state,l.context),X.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,u&&u(n),p=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++S<25);l.state=l.__s,l.getChildContext!=null&&(o=D(D({},o),l.getChildContext())),T&&!h&&l.getSnapshotBeforeUpdate!=null&&(b=l.getSnapshotBeforeUpdate(m,y)),A=p!=null&&p.type===N&&p.key==null?Ue(p.props.children):p,c=Ne(e,ne(A)?A:[A],n,r,o,i,s,a,c,_,d),l.base=n.__e,n.__u&=-161,l.__h.length&&a.push(l),f&&(l.__E=l.__=null)}catch(O){if(a.length=k,n.__v=null,_||s!=null){if(O.then){for(n.__u|=_?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s!=null&&(s[s.indexOf(c)]=null),n.__e=c}else if(s!=null)for($=s.length;$--;)ce(s[$])}else n.__e=r.__e;n.__k==null&&(n.__k=r.__k||[]),O.then||De(n),C.__e(O,n,r)}}else s==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=Ke(r.__e,n,r,o,i,s,a,_,d);return(p=C.diffed)&&p(n),128&n.__u?void 0:c}function De(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(De))}function Le(e,n,r){for(var o=0;o<r.length;o++)ue(r[o],r[++o],r[++o]);C.__c&&C.__c(n,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){C.__e(s,i.__v)}})}function Ue(e){return typeof e!="object"||e==null||e.__b>0?e:ne(e)?e.map(Ue):e.constructor!==void 0?null:D({},e)}function Ke(e,n,r,o,i,s,a,c,_){var d,p,k,l,h,m,y,b=r.props||Q,f=n.props,g=n.type;if(g=="svg"?i="http://www.w3.org/2000/svg":g=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(d=0;d<s.length;d++)if((h=s[d])&&"setAttribute"in h==!!g&&(g?h.localName==g:h.nodeType==3)){e=h,s[d]=null;break}}if(e==null){if(g==null)return document.createTextNode(f);e=document.createElementNS(i,g,f.is&&f),c&&(C.__m&&C.__m(n,s),c=!1),s=null}if(g==null)b===f||c&&e.data==f||(e.data=f);else{if(s=g=="textarea"&&f.defaultValue!=null?null:s&&ee.call(e.childNodes),!c&&s!=null)for(b={},d=0;d<e.attributes.length;d++)b[(h=e.attributes[d]).name]=h.value;for(d in b)h=b[d],d=="dangerouslySetInnerHTML"?k=h:d=="children"||d in f||d=="value"&&"defaultValue"in f||d=="checked"&&"defaultChecked"in f||G(e,d,null,h,i);for(d in f)h=f[d],d=="children"?l=h:d=="dangerouslySetInnerHTML"?p=h:d=="value"?m=h:d=="checked"?y=h:c&&typeof h!="function"||b[d]===h||G(e,d,h,b[d],i);if(p)c||k&&(p.__html==k.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),n.__k=[];else if(k&&(e.innerHTML=""),Ne(n.type=="template"?e.content:e,ne(l)?l:[l],n,r,o,g=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,a,s?s[0]:r.__k&&q(r,0),c,_),s!=null)for(d=s.length;d--;)ce(s[d]);c&&g!="textarea"||(d="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[d]||g=="progress"&&!m||g=="option"&&m!=b[d])&&G(e,d,m,b[d],i),d="checked",y!=null&&y!=e[d]&&G(e,d,y,b[d],i))}return e}function ue(e,n,r){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&n==null||(e.__u=e(n))}else e.current=n}catch(i){C.__e(i,r)}}function qe(e,n,r){var o,i;if(C.unmount&&C.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ue(o,null,n)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(s){C.__e(s,n)}o.base=o.__P=o.__n=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&qe(o[i],n,r||typeof e.type!="function");r||ce(e.__e),e.__c=e.__=e.__e=void 0}function Je(e,n,r){return this.constructor(e,r)}function Ye(e,n,r){var o,i,s,a;n==document&&(n=document.documentElement),C.__&&C.__(e,n),i=(o=!1)?null:n.__k,s=[],a=[],de(n,e=n.__k=We(N,null,[e]),i||Q,Q,n.namespaceURI,i?null:n.firstChild?ee.call(n.childNodes):null,s,i?i.__e:n.firstChild,o,a),Le(s,e,a),e.props.children=null}ee=X.slice,C={__e:function(e,n,r,o){for(var i,s,a;n=n.__;)if((i=n.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),a=i.__d),a)return i.__E=i}catch(c){e=c}throw e}},Pe=0,J.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=D({},this.state),typeof e=="function"&&(e=e(D({},r),this.props)),e&&D(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),me(this))},J.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),me(this))},J.prototype.render=N,U=[],xe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ie=function(e,n){return e.__v.__b-n.__v.__b},Z.__r=0,te=Math.random().toString(8),V="__d"+te,F="__a"+te,Ee=/(PointerCapture)$|Capture$/i,ae=0,ie=ve(!1),se=ve(!0);var Qe=0;function t(e,n,r,o,i,s){n||(n={});var a,c,_=n;if("ref"in _)for(c in _={},n)c=="ref"?a=n[c]:_[c]=n[c];var d={type:e,props:_,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Qe,__i:-1,__u:0,__source:i,__self:s};if(typeof e=="function"&&(a=e.defaultProps))for(c in a)_[c]===void 0&&(_[c]=a[c]);return C.vnode&&C.vnode(d),d}var B,P,re,ge,W=0,Oe=[],x=C,ye=x.__b,be=x.__r,we=x.diffed,ke=x.__c,Se=x.unmount,Ce=x.__;function _e(e,n){x.__h&&x.__h(P,e,W||n),W=0;var r=P.__H||(P.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function w(e){return W=1,Xe(Fe,e)}function Xe(e,n,r){var o=_e(B++,2);if(o.t=e,!o.__c&&(o.__=[Fe(void 0,n),function(c){var _=o.__N?o.__N[0]:o.__[0],d=o.t(_,c);_!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=P,!P.__f)){var i=function(c,_,d){if(!o.__c.__H)return!0;var p=!1,k=o.__c.props!==c;if(o.__c.__H.__.some(function(h){if(h.__N){p=!0;var m=h.__[0];h.__=h.__N,h.__N=void 0,m!==h.__[0]&&(k=!0)}}),s){var l=s.call(this,c,_,d);return p?l||k:l}return!p||k};P.__f=!0;var s=P.shouldComponentUpdate,a=P.componentWillUpdate;P.componentWillUpdate=function(c,_,d){if(this.__e){var p=s;s=void 0,i(c,_,d),s=p}a&&a.call(this,c,_,d)},P.shouldComponentUpdate=i}return o.__N||o.__}function M(e,n){var r=_e(B++,3);!x.__s&&Me(r.__H,n)&&(r.__=e,r.u=n,P.__H.__h.push(r))}function Ze(e){return W=5,he(function(){return{current:e}},[])}function he(e,n){var r=_e(B++,7);return Me(r.__H,n)&&(r.__=e(),r.__H=n,r.__h=e),r.__}function He(e,n){return W=8,he(function(){return e},n)}function en(){for(var e;e=Oe.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(Y),n.__h.some(oe),n.__h=[]}catch(r){n.__h=[],x.__e(r,e.__v)}}}x.__b=function(e){P=null,ye&&ye(e)},x.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Ce&&Ce(e,n)},x.__r=function(e){be&&be(e),B=0;var n=(P=e.__c).__H;n&&(re===P?(n.__h=[],P.__h=[],n.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(n.__h.some(Y),n.__h.some(oe),n.__h=[],B=0)),re=P},x.diffed=function(e){we&&we(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Oe.push(n)!==1&&ge===x.requestAnimationFrame||((ge=x.requestAnimationFrame)||nn)(en)),n.__H.__.some(function(r){r.u&&(r.__H=r.u,r.u=void 0)})),re=P=null},x.__c=function(e,n){n.some(function(r){try{r.__h.some(Y),r.__h=r.__h.filter(function(o){return!o.__||oe(o)})}catch(o){n.some(function(i){i.__h&&(i.__h=[])}),n=[],x.__e(o,r.__v)}}),ke&&ke(e,n)},x.unmount=function(e){Se&&Se(e);var n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(o){try{Y(o)}catch(i){n=i}}),r.__H=void 0,n&&x.__e(n,r.__v))};var $e=typeof requestAnimationFrame=="function";function nn(e){var n,r=function(){clearTimeout(o),$e&&cancelAnimationFrame(n),setTimeout(e)},o=setTimeout(r,35);$e&&(n=requestAnimationFrame(r))}function Y(e){var n=P,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),P=n}function oe(e){var n=P;e.__c=e.__(),P=n}function Me(e,n){return!e||e.length!==n.length||n.some(function(r,o){return r!==e[o]})}function Fe(e,n){return typeof n=="function"?n(e):n}const tn={csrf:"snag_csrf"},rn=tn.csrf,sn={csrf:"x-snagset-csrf"};class L extends Error{status;code;constructor(n,r){super(r.message),this.status=n,this.code=r.code}}function on(){for(const e of document.cookie.split(";")){const n=e.indexOf("=");if(n>0&&e.slice(0,n).trim()===rn)return e.slice(n+1).trim()}return""}async function E(e,n,r){const o=await fetch(n,{method:e,credentials:"same-origin",headers:{...r===void 0?{}:{"content-type":"application/json"},...e==="GET"?{}:{[sn.csrf]:on()}},...r===void 0?{}:{body:JSON.stringify(r)}});if(o.status===204)return;const i=await o.json().catch(()=>null);if(!o.ok){const s=i?.error;throw new L(o.status,s??{code:"unknown",message:`Request failed (${o.status}).`})}return i}const I={me:()=>E("GET","/api/v1/me"),setup:e=>E("POST","/api/v1/setup",e),login:(e,n)=>E("POST","/auth/login",{email:e,password:n}),logout:()=>E("POST","/auth/logout"),threads:(e,n={})=>{const r=new URLSearchParams;n.status&&r.set("status",n.status),n.route&&r.set("route",n.route),n.round&&r.set("round",String(n.round)),n.q&&r.set("q",n.q),n.since&&r.set("since",n.since);const o=r.toString();return E("GET",`/api/v1/projects/${encodeURIComponent(e)}/threads${o?`?${o}`:""}`)},createProject:(e,n)=>E("POST","/api/v1/projects",{name:e,origins:n}),setAudience:(e,n)=>E("PATCH",`/api/v1/projects/${encodeURIComponent(e)}`,{writeMode:n}),origins:e=>E("GET",`/api/v1/projects/${encodeURIComponent(e)}/origins`),addOrigin:(e,n)=>E("POST",`/api/v1/projects/${encodeURIComponent(e)}/origins`,{origin:n}),rounds:e=>E("GET",`/api/v1/projects/${encodeURIComponent(e)}/rounds`),createRound:(e,n)=>E("POST",`/api/v1/projects/${encodeURIComponent(e)}/rounds`,{name:n}),setStatus:(e,n,r)=>E("PATCH",`/api/v1/projects/${encodeURIComponent(e)}/threads/${encodeURIComponent(n)}`,{status:r}),addComment:(e,n)=>E("POST",`/api/v1/threads/${encodeURIComponent(e)}/comments`,{id:crypto.randomUUID(),body:n}),listLinks:e=>E("GET",`/api/v1/projects/${encodeURIComponent(e)}/review-links`),mintLink:(e,n)=>E("POST",`/api/v1/projects/${encodeURIComponent(e)}/review-links`,n),revokeLink:e=>E("DELETE",`/api/v1/review-links/${encodeURIComponent(e)}`)};function Te(e){const n=new Date(e),r=Math.round((Date.now()-n.getTime())/6e4);return r<1?"just now":r<60?`${r}m ago`:r<1440?`${Math.round(r/60)}h ago`:n.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function ln({context:e}){const n=e?.capture,r=e?.viewport,i=[["Viewport",r?.w?`${r.w} × ${r.h}`:null],["Browser",e?.browser??e?.ua??null],["Platform",e?.os??e?.platform??null],["Device pixel ratio",e?.dpr??null]].filter(([,c])=>c!=null&&c!==""),s=n?.category&&n.category!=="ok"&&n.category!=="full";return!i.length&&!n?null:t("section",{class:"block",children:[t("h2",{children:["Capture",t("button",{type:"button",class:"linkish",style:"float:right;font-size:12px",onClick:()=>{navigator.clipboard?.writeText(JSON.stringify(e,null,2))},children:"Copy environment"})]}),i.length>0&&t("dl",{class:"kv",children:i.map(([c,_])=>t(N,{children:[t("dt",{children:c}),t("dd",{children:String(_)})]}))}),s&&t("p",{class:"warn",style:"margin:10px 0 0",children:[t("b",{children:n.category}),n.reasons?.length?` — ${n.reasons.join("; ")}`:""]}),n?.blindSpots?.length?t("p",{class:"warn",style:"margin:6px 0 0",children:[n.blindSpots.length," blind spot",n.blindSpots.length===1?"":"s",": ",n.blindSpots.join("; ")]}):null,n?.droppedCategories?.length?t("p",{class:"warn",style:"margin:6px 0 0",children:["Dropped: ",n.droppedCategories.join(", ")]}):null]})}function an({onReply:e}){const[n,r]=w(""),[o,i]=w(!1),[s,a]=w("");return t("form",{class:"composer",onSubmit:async c=>{c.preventDefault();const _=n.trim();if(!(!_||o)){i(!0),a("");try{await e(_),r("")}catch(d){a(d instanceof L?d.message:"Could not send that reply.")}finally{i(!1)}}},children:[t("label",{class:"field",children:[t("span",{children:"Reply"}),t("textarea",{rows:3,placeholder:"Write a reply…",value:n,disabled:o,onInput:c=>r(c.target.value)})]}),s&&t("p",{class:"err",children:s}),t("button",{class:"btn btn-primary",type:"submit",disabled:o||!n.trim(),children:o?"Sending…":"Reply"})]})}function cn({thread:e,onStatus:n,onReply:r,busy:o}){const i=e.attachments?.find(c=>c.kind==="screenshot")??e.attachments?.[0],s=e.anchor?.label??"",a=e.anchor??{};return t("article",{class:"detail detail-open",children:[t("div",{class:"detail-head",children:[t("span",{class:"key",children:e.key}),t("h1",{children:s||"A comment on this page"}),t("span",{class:`status status-${e.status}`,children:le[e.status]??e.status})]}),t("p",{style:"margin:6px 0 0;color:var(--ink-soft);font-size:13px",children:["Round ",e.roundNumber," · ",e.route||"/"," · left by ",e.createdBy.name||"someone"," ",Te(e.createdAt)]}),i?t("figure",{class:"shot",children:[t("img",{src:i.url,alt:`Screenshot of the page when ${e.key} was left`,width:i.width,height:i.height,loading:"lazy"}),t("figcaption",{children:["captured at ",i.width??"?"," × ",i.height??"?"]})]}):t("div",{class:"no-shot",children:[t("b",{children:"No screenshot for this one."}),t("p",{style:"margin:6px 0 0",children:"Either this instance had no bucket connected when it was left, or the reviewer turned the picture off for this comment. The anchor and the page context below are unaffected."})]}),t("section",{class:"thread",children:[e.comments.length===0&&t("p",{style:"color:var(--ink-soft)",children:"This thread has no readable comments."}),e.comments.map(c=>t("div",{class:"comment",children:[t("div",{class:"comment-head",children:[t("b",{children:c.author.name||"Anonymous"}),c.author.kind==="agent"&&t("span",{class:"agent",children:"agent"}),t("span",{style:"color:var(--ink-faint)",children:Te(c.createdAt)})]}),t("p",{children:c.body??t("i",{style:"color:var(--ink-faint)",children:"deleted"})})]},c.id))]}),t(an,{onReply:r}),t("section",{class:"block",children:[t("h2",{children:"Anchor"}),t("dl",{class:"kv",children:[t("dt",{children:"State"}),t("dd",{children:e.anchorState}),s&&t(N,{children:[t("dt",{children:"Label"}),t("dd",{children:s})]}),a.css&&t(N,{children:[t("dt",{children:"Selector"}),t("dd",{children:String(a.css)})]}),a.domid&&t(N,{children:[t("dt",{children:"DOM id"}),t("dd",{children:String(a.domid)})]}),a.page?.pathname&&t(N,{children:[t("dt",{children:"Path"}),t("dd",{children:String(a.page.pathname)})]})]})]}),t(ln,{context:e.context??{}}),t("div",{class:"actions",children:[e.status!=="resolved"?t("button",{class:"btn btn-primary",disabled:o,onClick:()=>n("resolved"),children:"Mark resolved"}):t("button",{class:"btn",disabled:o,onClick:()=>n("open"),children:"Reopen"}),e.status!=="progress"&&e.status!=="resolved"&&t("button",{class:"btn",disabled:o,onClick:()=>n("progress"),children:"In progress"}),a.page?.origin&&t("a",{class:"btn",href:`${a.page.origin}${a.page.pathname??"/"}?snag_t=${encodeURIComponent(e.key)}`,target:"_blank",rel:"noreferrer noopener",children:"Open on site ↗"})]})]})}function z(e){return e?new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):"—"}function dn({uid:e,rounds:n}){const[r,o]=w(null),[i,s]=w(""),[a,c]=w(null),[_,d]=w(null),[p,k]=w(""),[l,h]=w("14"),[m,y]=w(""),[b,f]=w(!1),g=()=>{o(null),I.listLinks(e).then(v=>o(v.data)).catch(v=>s(v instanceof L?v.message:"Could not load the links."))};M(()=>{c(null),s(""),g()},[e]);const T=async v=>{v.preventDefault();const u=p.trim();if(!(!u||b)){f(!0),s("");try{const S=Number(l),A=Number.isFinite(S)&&S>0?new Date(Date.now()+S*864e5).toISOString():void 0,$=await I.mintLink(e,{name:u,...A?{expiresAt:A}:{},...m?{roundId:m}:{}});c($),k(""),h("14"),y(""),g()}catch(S){s(S instanceof L?S.message:"Could not create that link.")}finally{f(!1)}}},R=async v=>{if(confirm(`Revoke "${v.name}"? Every session minted from it is out within 10 s. This cannot be undone — minting a new link is the recovery.`)){d(v.id),s("");try{await I.revokeLink(v.id),c(u=>u?.id===v.id?null:u),g()}catch(u){s(u instanceof L?u.message:"Could not revoke that link.")}finally{d(null)}}};return t("div",{class:"links",children:[t("div",{class:"links-list",children:[t("h1",{class:"links-title",children:"Review links"}),i&&t("p",{class:"err",children:i}),r===null&&t("p",{class:"empty",children:"Loading…"}),r?.length===0&&t("div",{class:"empty",children:[t("h2",{children:"No links yet"}),t("p",{children:"Mint one on the right — once this project needs a link, it is the only way a reviewer gets in."})]}),r&&r.length>0&&t("table",{class:"link-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Name"}),t("th",{children:"Created"}),t("th",{children:"Expires"}),t("th",{children:"Last used"}),t("th",{children:"Uses"}),t("th",{})]})}),t("tbody",{children:r.map(v=>{const u=!!v.revokedAt,S=!u&&new Date(v.expiresAt).getTime()<=Date.now(),A=v.roundId?n?.find($=>$.id===v.roundId):null;return t("tr",{class:u||S?"link-dead":"",children:[t("td",{children:[v.name,A&&t("span",{class:"link-round",children:A.name})]}),t("td",{children:z(v.createdAt)}),t("td",{children:u?t("span",{class:"warn",children:["revoked ",z(v.revokedAt)]}):S?t("span",{class:"warn",children:"expired"}):z(v.expiresAt)}),t("td",{children:z(v.lastUsedAt)}),t("td",{children:v.useCount}),t("td",{children:!u&&t("button",{class:"btn",disabled:_===v.id,onClick:()=>void R(v),children:_===v.id?"Revoking…":"Revoke"})})]},v.id)})})]})]}),t("div",{class:"links-side",children:[a&&t("div",{class:"card minted",children:[t("h2",{children:['"',a.name,'" is ready']}),t("p",{class:"sub",children:["This is the only time the token is shown — the list on the left never carries it again. Paste it after the reviewed site's URL, e.g. ",t("code",{children:["https://yoursite.com/page",a.fragment]}),"."]}),t("div",{class:"token-box",children:[t("code",{children:a.fragment}),t("button",{class:"btn",onClick:()=>void navigator.clipboard.writeText(a.fragment).catch(()=>{}),children:"Copy"})]}),t("button",{class:"linkish",style:"margin-top:10px",onClick:()=>c(null),children:"Done"})]}),t("form",{class:"card",onSubmit:T,children:[t("h2",{children:"New link"}),t("label",{class:"field",children:[t("span",{children:"Name"}),t("input",{required:!0,placeholder:"Client review — round 2",value:p,onInput:v=>k(v.target.value)})]}),t("label",{class:"field",children:[t("span",{children:"Expires in (days, up to 90)"}),t("input",{type:"number",min:1,max:90,value:l,onInput:v=>h(v.target.value)})]}),n&&n.length>0&&t("label",{class:"field",children:[t("span",{children:"Pin to a round (optional)"}),t("select",{value:m,onChange:v=>y(v.target.value),children:[t("option",{value:"",children:"Any round"}),n.map(v=>t("option",{value:v.id,children:v.name},v.id))]})]}),t("button",{class:"btn btn-primary",type:"submit",disabled:b||!p.trim(),children:b?"Creating…":"Create link"})]})]})]})}function un({me:e,onAdded:n,origin:r}){const[o,i]=w(""),[s,a]=w(""),[c,_]=w(!1),[d,p]=w(""),[k,l]=w(null);return t("div",{class:"sites",children:[t("section",{class:"site-add",children:[t("h2",{children:"Add a site"}),t("form",{onSubmit:async m=>{if(m.preventDefault(),!c){_(!0),p("");try{const y=await I.createProject(o.trim(),s.trim());l({uid:y.uid,name:y.name,...y.warning?{warning:y.warning}:{}}),i(""),a(""),n(y.uid)}catch(y){p(y instanceof L?y.message:"Something went wrong. Try again.")}finally{_(!1)}}},children:[t("label",{children:["Name",t("input",{value:o,placeholder:"Acme redesign",onInput:m=>i(m.target.value),required:!0})]}),t("label",{children:["Where it runs",t("input",{value:s,placeholder:"https://staging.acme.com, http://localhost:3000",onInput:m=>a(m.target.value)}),t("small",{children:["Comma-separated, with the scheme. Only these can talk to the site — a tag on any other address is ignored. ",t("code",{children:"https://*.acme.com"})," covers subdomains."]})]}),t("button",{type:"submit",disabled:c||!o.trim(),children:c?"Adding…":"Add site"}),d&&t("p",{class:"error",children:d})]})]}),k&&t(_n,{site:k,origin:r}),t("section",{class:"site-list",children:[t("h2",{children:"Your sites"}),t("ul",{children:e.projects.map(m=>t("li",{children:[t("strong",{children:m.name}),t("code",{children:m.uid}),t("span",{children:[m.threads," snag",m.threads===1?"":"s"," · ",m.unresolved," open"]})]},m.uid))})]})]})}function _n({site:e,origin:n}){const[r,o]=w([]),[i,s]=w(""),[a,c]=w(""),[_,d]=w("everyone"),[p,k]=w(""),l=y=>{const b=_;d(y),k(""),I.setAudience(e.uid,y==="everyone"?"open":"link-required").catch(()=>{d(b),k("Could not save — try again.")})},h=He(()=>{I.origins(e.uid).then(y=>o(y.origins)).catch(()=>o([]))},[e.uid]);M(h,[h]);const m=`<script src="${n}/snag.js" data-snag-site="${e.uid}" defer><\/script>`;return t("section",{class:"site-made",children:[t("h2",{children:[e.name," is ready"]}),t("p",{children:"Paste this into the site, immediately before the closing </body> tag."}),t("div",{class:"site-audience",role:"radiogroup","aria-label":"Who sees the toolbar",children:[t("label",{children:[t("input",{type:"radio",name:"audience",checked:_==="everyone",onChange:()=>l("everyone")}),t("span",{children:[t("strong",{children:"Everyone on these addresses"})," — the toolbar just appears, and anyone can comment. For staging. Saved to the server: change it here any time, no re-paste."]})]}),t("label",{children:[t("input",{type:"radio",name:"audience",checked:_==="links",onChange:()=>l("links")}),t("span",{children:[t("strong",{children:"Only people with a review link"})," — visitors see nothing. For production, where the visitors are your client's customers."]})]}),p&&t("p",{class:"error",children:p})]}),t("pre",{children:t("code",{children:m})}),t("button",{class:"linkish",onClick:()=>{navigator.clipboard?.writeText(m)},children:"Copy"}),t("h3",{children:"Allowed origins"}),r.length?t("ul",{class:"origins",children:r.map(y=>t("li",{children:t("code",{children:y})},y))}):t("p",{class:"warn",children:e.warning??"None yet — the tag will load and every request from it will be refused. Add one below."}),t("form",{onSubmit:async y=>{y.preventDefault();const b=i.trim();if(b){c("");try{const f=await I.addOrigin(e.uid,b);o(f.origins),s("")}catch(f){c(f instanceof L?f.message:"Could not add that origin.")}}},children:[t("input",{value:i,placeholder:"https://www.acme.com",onInput:y=>s(y.target.value)}),t("button",{type:"submit",disabled:!i.trim(),children:"Allow"}),a&&t("p",{class:"error",children:a})]})]})}function hn(e,n,r=[]){const o=new Set(r),i=e.filter(s=>!o.has(s.id));for(const s of n){if(o.has(s.id))continue;const a=i.findIndex(c=>c.id===s.id);a===-1?i.push(s):i[a]=s}return i}function pn({token:e,onClaimed:n}){const[r,o]=w(""),[i,s]=w(""),[a,c]=w(""),[_,d]=w(""),[p,k]=w(!1),[l,h]=w(""),[m,y]=w(null);return m?t(mn,{site:m,onContinue:n}):t("div",{class:"setup",children:[t("h1",{children:"Set up Snagset"}),t("p",{class:"setup-lede",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."}),t("form",{onSubmit:async f=>{if(f.preventDefault(),!p){k(!0),h("");try{const g=await I.setup({token:e,orgName:r.trim()||"My studio",projectName:i.trim(),email:a.trim(),password:_});y(g.project)}catch(g){h(g instanceof L?g.message:"Something went wrong. Try again.")}finally{k(!1)}}},children:[t("label",{children:["Your email",t("input",{type:"email",value:a,autocomplete:"username",required:!0,onInput:f=>c(f.target.value)})]}),t("label",{children:["Password",t("input",{type:"password",value:_,autocomplete:"new-password",required:!0,minLength:12,onInput:f=>d(f.target.value)}),t("small",{children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),t("label",{children:["Studio name ",t("span",{class:"setup-opt",children:"optional"}),t("input",{value:r,placeholder:"My studio",onInput:f=>o(f.target.value)})]}),t("label",{children:["First site ",t("span",{class:"setup-opt",children:"optional"}),t("input",{value:i,placeholder:"Acme redesign",onInput:f=>s(f.target.value)})]}),t("button",{type:"submit",disabled:p||!a.trim()||_.length<12,children:p?"Setting up…":"Create my account"}),l&&t("p",{class:"error",children:l})]})]})}function mn({site:e,onContinue:n}){const r=`<script src="${location.origin}/snag.js" data-snag-site="${e.uid}" defer><\/script>`;return t("div",{class:"setup",children:[t("h1",{children:[e.name," is ready"]}),t("p",{class:"setup-lede",children:"Paste this into the site you want reviewed, before the closing </body> tag."}),t("pre",{children:t("code",{children:r})}),t("div",{class:"setup-actions",children:[t("button",{type:"button",class:"linkish",onClick:()=>void navigator.clipboard?.writeText(r),children:"Copy"}),t("button",{type:"button",onClick:n,children:"Open the dashboard"})]}),t("p",{class:"setup-note",children:"The site's address has to be on its allow-list before comments can reach you — add it on the Sites screen. A tag on any other address loads and is ignored."})]})}const fn=["open","progress","review","resolved"],le={open:"Active",progress:"In progress",review:"In review",resolved:"Resolved"};function H(){const e=new URLSearchParams(location.search);return{project:e.get("project")??"",thread:e.get("t")??"",status:e.get("status")??"",q:e.get("q")??"",round:e.get("round")??"",screen:e.get("screen")??"",claim:e.get("claim")??""}}function Ae(e){const n={...H(),...e},r=new URLSearchParams;n.project&&r.set("project",n.project),n.thread&&r.set("t",n.thread),n.status&&r.set("status",n.status),n.q&&r.set("q",n.q),n.round&&r.set("round",n.round),n.screen&&r.set("screen",n.screen);const o=`${location.pathname}${r.toString()?`?${r}`:""}`;history.pushState(null,"",o)}function vn({onIn:e}){const[n,r]=w(""),[o,i]=w(""),[s,a]=w(""),[c,_]=w(!1);return t("div",{class:"gate",children:t("form",{class:"card",onSubmit:async d=>{d.preventDefault(),_(!0),a("");try{await I.login(n,o),e()}catch(p){a(p instanceof L?p.message:"Could not reach the server.")}finally{_(!1)}},children:[t("h1",{children:"Sign in"}),t("p",{class:"sub",children:"The studio side of Snagset. Reviewers do not sign in — they open a link."}),s&&t("p",{class:"err",children:s}),t("label",{class:"field",children:[t("span",{children:"Email"}),t("input",{type:"email",autocomplete:"username",required:!0,value:n,onInput:d=>r(d.target.value)})]}),t("label",{class:"field",children:[t("span",{children:"Password"}),t("input",{type:"password",autocomplete:"current-password",required:!0,value:o,onInput:d=>i(d.target.value)})]}),t("button",{class:"btn btn-primary",disabled:c,children:c?"Signing in…":"Sign in"}),t("p",{class:"sub",style:"margin:14px 0 0",children:["Forgotten it? There is no reset email on a fresh install — set a new one from the machine that runs the server: ",t("code",{children:"snagset passwd you@example.com"})]})]})})}function gn(){const[e,n]=w(null),[r,o]=w("loading"),[i,s]=w(H()),[a,c]=w(null),_=Ze(null),[d,p]=w(!1),[k,l]=w(null),[h,m]=w(null),y=He(async()=>{try{const u=await I.me();n(u),o("in"),!H().project&&u.projects[0]&&(Ae({project:u.projects[0].uid}),s(H()))}catch{o("out")}},[]);M(()=>{y(),fetch("/api/v1/meta").then(S=>S.json()).then(l).catch(()=>{});const u=()=>s(H());return addEventListener("popstate",u),()=>removeEventListener("popstate",u)},[y]);const b=i.project;M(()=>{if(r!=="in"||!b)return;let u=!0;return m(null),I.rounds(b).then(S=>u&&m(S.data)).catch(()=>u&&m([])),()=>{u=!1}},[r,b]);const f=i.round?Number(i.round):h?.[0]?.number??null;M(()=>{if(r!=="in"||!b||f===null)return;let u=!0;return c(null),I.threads(b,{round:f,...i.status?{status:i.status}:{},...i.q?{q:i.q}:{}}).then(S=>{u&&(c(S.data),_.current=S.serverTime)}).catch(()=>u&&c([])),()=>{u=!1}},[r,b,f,i.status,i.q]),M(()=>{if(r!=="in"||!b)return;let u=0;const S=()=>{if(document.hidden||!_.current)return;const A=Date.now();A-u<3e4||(u=A,I.threads(b,{...f===null?{}:{round:f},since:_.current,...i.status?{status:i.status}:{},...i.q?{q:i.q}:{}}).then($=>{_.current=$.serverTime,!(!$.data.length&&!$.deleted?.length)&&c(j=>j&&hn(j,$.data,$.deleted))}).catch(()=>{}))};return document.addEventListener("visibilitychange",S),()=>document.removeEventListener("visibilitychange",S)},[r,b,f,i.status,i.q]);const g=he(()=>a?.find(u=>u.key===i.thread)??null,[a,i.thread]),T=u=>{Ae(u),s(H())};if(r==="loading")return t("div",{class:"empty",children:"Loading…"});if(r==="out"&&i.claim)return t(pn,{token:i.claim,onClaimed:()=>void y()});if(r==="out")return t(vn,{onIn:()=>void y()});const R=async u=>{if(g){p(!0);try{const S=await I.setStatus(b,g.id,u);c(A=>A?.map($=>$.id===S.id?{...$,...S}:$)??A)}finally{p(!1)}}},v=async u=>{if(!g)return;const S=await I.addComment(g.id,u);c(A=>A?.map($=>$.id===g.id?{...$,comments:[...$.comments,S],commentCount:$.commentCount+1}:$)??A)};return t("div",{class:"shell",children:[t("header",{class:"topbar",children:[t("div",{class:"brand",children:["Snagset ",t("span",{children:"studio"})]}),t("select",{value:b,onChange:u=>T({project:u.target.value,thread:""}),children:e.projects.map(u=>t("option",{value:u.uid,children:[u.name," · ",u.unresolved," open"]},u.uid))}),h&&h.length>0&&t("select",{value:String(f??""),onChange:u=>T({round:u.target.value,thread:""}),children:h.map(u=>t("option",{value:String(u.number),children:[u.name,u.closed?" (closed)":""," · ",u.unresolved," open"]},u.id))}),t("button",{class:"linkish",title:"Start a new round. The page goes clean; nothing is deleted.",onClick:async()=>{const u=(h?.[0]?.number??0)+1,S=prompt("Name for the new round",`Round ${u}`);if(S===null)return;const A=await I.createRound(b,S).catch(()=>null);if(!A)return;const $=await I.rounds(b).catch(()=>null);$&&m($.data),T({round:String(A.number),thread:""})},children:"+ Round"}),t("button",{class:"linkish","aria-pressed":i.screen==="links",onClick:()=>T({screen:i.screen==="links"?"":"links",thread:""}),children:"Links"}),t("button",{class:"linkish","aria-pressed":i.screen==="sites",onClick:()=>T({screen:i.screen==="sites"?"":"sites",thread:""}),children:"Sites"}),t("div",{class:"spacer"}),t("span",{class:"who",children:e.user.email}),t("button",{class:"linkish",onClick:async()=>{await I.logout().catch(()=>{}),o("out")},children:"Sign out"})]}),i.screen==="sites"?t(un,{me:e,origin:location.origin,onAdded:async u=>{const S=await I.me().catch(()=>null);S&&n(S),T({project:u,thread:""})}}):i.screen==="links"?t(dn,{uid:b,rounds:h}):t(N,{children:[h&&f!==null&&t(N,{children:h.filter(u=>u.number!==f&&u.unresolved>0).map(u=>t("button",{class:"carryover",onClick:()=>T({round:String(u.number),thread:""}),children:[t("b",{children:[u.unresolved," unresolved"]})," in ",u.name," — still open, not carried over. Go there ↗"]},u.id))}),t("div",{class:"inbox",children:[t("div",{class:"list",children:[t("div",{class:"filters",children:[t("input",{type:"search",placeholder:"Search comments",value:i.q,onInput:u=>T({q:u.target.value})}),fn.map(u=>t("button",{class:"chip","aria-pressed":i.status===u,onClick:()=>T({status:i.status===u?"":u}),children:le[u]},u))]}),t("div",{class:"rows",children:[a===null&&t("p",{class:"empty",children:"Loading…"}),a?.length===0&&t("div",{class:"empty",children:[t("h2",{children:"Nothing here"}),t("p",{children:i.q||i.status?"No comment matches that filter.":"No comments on this project yet. Paste the script tag on the site and click something."})]}),a?.map(u=>t("button",{class:"row","aria-current":u.key===i.thread,onClick:()=>T({thread:u.key}),children:[t("div",{class:"row-top",children:[t("span",{class:"key",children:u.key}),t("span",{class:`status status-${u.status}`,children:le[u.status]})]}),t("p",{class:"row-body",children:u.comments[0]?.body??u.anchor?.label??"(no comment)"}),t("div",{class:"row-meta",children:[t("span",{children:u.route||"/"}),t("span",{children:"·"}),t("span",{children:u.createdBy.name||"someone"}),u.attachments?.length?t("span",{children:"· 📷"}):null]})]},u.id))]})]}),g?t(cn,{thread:g,onStatus:u=>void R(u),onReply:v,busy:d}):t("div",{class:"empty",children:[t("h2",{children:"Pick a comment"}),t("p",{children:"Its screenshot, the thread, the anchor and the page context all open here."})]})]})]}),t("footer",{class:"foot",children:[t("span",{children:[e.org.name," · ",k?.version??"…"]}),k?.commit&&t("span",{children:k.commit.slice(0,8)})]})]})}Ye(t(gn,{}),document.getElementById("app"));
@@ -4,9 +4,10 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <meta name="color-scheme" content="light dark" />
7
+ <link rel="icon" href="/mark.svg" type="image/svg+xml" />
7
8
  <title>Snagset</title>
8
- <script type="module" crossorigin src="/assets/index-DfTNjHCK.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-CaPfKhFP.css">
9
+ <script type="module" crossorigin src="/assets/index-DultqpS7.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/assets/index-DsUJ96yc.css">
10
11
  </head>
11
12
  <body>
12
13
  <div id="app"></div>
@@ -0,0 +1,25 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-label="Snagset">
2
+ <!--
3
+ D78. The pin at rest on a rule: the shipped pin (a circle of r 12 with its
4
+ lower-left quadrant squared — the same construction as
5
+ `border-radius: 50% 50% 50% 2px` in pins.ts) floating 4.3 units above a
6
+ full-bleed rule.
7
+
8
+ Three things are load-bearing and must not be tidied:
9
+ · the pin FLOATS — it has not landed; touching the rule parks it
10
+ · the composition is ASYMMETRIC — 8 units of rule run on past the pin,
11
+ which is what says `page` rather than `underline`
12
+ · the pin's sharp corner and the rule's left end share x 0, the one
13
+ alignment, which reads only because nothing else lines up
14
+
15
+ Stroke weight, colour and file preparation are in scope for a refinement.
16
+ Position, scale and alignment are the composition.
17
+ -->
18
+ <style>
19
+ :root { color-scheme: light dark; }
20
+ path { fill: #181716; stroke: #181716; }
21
+ @media (prefers-color-scheme: dark) { path { fill: #f0eeec; stroke: #f0eeec; } }
22
+ </style>
23
+ <path d="M0 24V12A12 12 0 0 1 12 0a12 12 0 0 1 12 12 12 12 0 0 1-12 12z" stroke="none"/>
24
+ <path d="M0 30h32" fill="none" stroke-width="3.4" stroke-linecap="square"/>
25
+ </svg>
@@ -1,4 +1,4 @@
1
- const Me="Snagset",H="snagset",T="snagset.v1",Ze="Snagset",Pe="Snag",Ie="Snags",Ue={root:"data-snag-root"},F=e=>Ue[e],Be={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},A=e=>Be[e],We={mask:"snag-mask",block:"snag-block"},j=e=>We[e],d={font:"--snag-font",accent:"--snag-accent",onAccent:"--snag-onAccent",bg:"--snag-bg",fg:"--snag-fg",muted:"--snag-muted",border:"--snag-border",radius:"--snag-radius",shadow:"--snag-shadow",z:"--snag-z",motion:"--snag-motion",surface:"--snag-surface",sunken:"--snag-sunken",hover:"--snag-hover",focus:"--snag-focus",disabled:"--snag-disabled",statusOpen:"--snag-status-open",statusProgress:"--snag-status-progress",statusReview:"--snag-status-review",statusResolved:"--snag-status-resolved",anchorOrphan:"--snag-anchor-orphan",tbH:"--snag-tb-h",dockW:"--snag-dock-w",kb:"--snag-kb",thumbX:"--snag-thumb-x",thumbW:"--snag-thumb-w"},He=e=>`var(${d[e]})`,C={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},Fe="snag:disclosure:v1",je="snag:identity",qe="data-snag-theme",Ve={session:e=>`snag:session:${e}`,identity:je,threads:(e,t)=>`snag:threads:${e}:${t}`,counts:e=>`snag:counts:${e}`,draft:(e,t)=>`snag:draft:${e}:${t}`,outbox:e=>`snag:outbox:${e}`,mode:"snag:mode",handoff:"snag:handoff",seenCoach:"snag:seen-coach",disclosure:Fe},z={database:"snag:blobs",store:"blobs"},Ke={route:"snagset:route"};function Xe(e,t){let n="Unknown";/Edg\//.test(e)?n="Edge":/OPR\//.test(e)?n="Opera":/Firefox\//.test(e)?n="Firefox":/Chrome\//.test(e)?n="Chrome":/Safari\//.test(e)&&(n="Safari");let r="";if(/Macintosh/.test(e)?r="macOS":/Windows/.test(e)?r="Windows":/iPhone|iPad/.test(e)?r="iOS":/Android/.test(e)?r="Android":/Linux/.test(e)&&(r="Linux"),t?.brands?.length){const s=t.brands.find(i=>!/Not.?A.?Brand/i.test(i.brand));s&&(n=s.brand)}t?.platform&&(r=t.platform);let a=!1;try{a=typeof matchMedia=="function"&&matchMedia("(pointer:coarse)").matches}catch{}const o=t?.mobile??(a||/Mobi|iPhone|Android/.test(e))?"Mobile":"Desktop";return{browser:n,os:r,device:o}}const Ye={ok:{status:"ok"},release:{status:"disabled",reason:"Screenshots are not available in this release."},"config-off":{status:"disabled",reason:"Screenshots are switched off for this project."},"feature-off":{status:"disabled",reason:"Screenshots are switched off for this project."},"reviewer-removed":{status:"disabled",reason:"You removed the screenshot before sending."},"csp-blocked":{status:"failed",reason:"Your Content-Security-Policy blocks data: images, so no screenshot could be taken."},"engine-load-failed":{status:"failed",reason:"The screenshot engine could not be loaded."},"engine-failed":{status:"failed",reason:"The screenshot engine failed on this page."},timeout:{status:"timeout",reason:"The screenshot timed out."},tainted:{status:"tainted",reason:"A cross-origin image made the page canvas unreadable."},"scope-forced":{status:"ok",reason:"The page was too large to capture in full; captured the area around your pin."},"masking-failed":{status:"failed",reason:"Masking could not be verified, so the screenshot was discarded."},navigated:{status:"failed",reason:"The page changed while the screenshot was being taken."}},Qe={disabled:"Console and network capture is off for this project.",truncated:"Earlier console and network entries were dropped to fit the buffer."};function v(e={}){const t=Ye[e.screenshot??"release"],n=e.breadcrumbs??"disabled",r=[];t.reason&&r.push(t.reason),n!=="ok"&&r.push(Qe[n]);const a={screenshot:t.status,breadcrumbs:n,reasons:r};return e.blindSpots?.length&&(a.blindSpots=e.blindSpots),e.droppedCategories?.length&&(a.droppedCategories=e.droppedCategories),e.maskedCount!==void 0&&e.maskedCount>0&&(a.maskedCount=e.maskedCount),a}function Je(e,t,n,r=!1){const a=e.capture?.breadcrumbs??"disabled";if(n){e.capture=v({screenshot:"config-off",breadcrumbs:a});return}if(r&&!t){e.capture=v({screenshot:"reviewer-removed",breadcrumbs:a});return}t&&(e.capture=v({screenshot:t.situation,breadcrumbs:a,...t.blindSpots.length?{blindSpots:t.blindSpots}:{},...t.maskedCount>0?{maskedCount:t.maskedCount}:{}}))}const Ge="pass(?:word|wd)?|pwd|secret|token|api[_-]?key|apikey|auth(?:orization)?|credential|session|sid|cookie|jwt|bearer|otp|mfa|totp|cvv|cvc|ssn|nino|iban|card(?:[_-]?number)?|account[_-]?number|private[_-]?key|signature|client[_-]?secret|refresh[_-]?token|access[_-]?token",et=new RegExp(`(["'\`]?)(?<![A-Za-z0-9])(?:${Ge})[\\w-]*\\b\\1?\\s*[:=]\\s*(?:(["'\`])((?:\\\\.|(?!\\2)[^\\\\])*)\\2|([^\\s,;&}\\])]{3,}))`,"gi"),tt=/^(?:Bearer|Basic|Digest|Negotiate|Token)$/i,nt=(e,t,n,r,a,o,s)=>{if(!n&&tt.test(a)&&s.slice(o+e.length).startsWith(" [redacted]")||(n?r:a).startsWith("[redacted"))return e;const i=n?`${n}${r}${n}`:a;return e.slice(0,e.length-i.length)+(n?`${n}[redacted]${n}`:"[redacted]")},q=/data:[a-z0-9.+-]*\/?[a-z0-9.+-]*;base64,[A-Za-z0-9+/=]{16,}/gi,V=/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{0,}/g,K=/\b(sk-[A-Za-z0-9]+-[A-Za-z0-9_-]{20,}|sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9]{20,}|(sk|pk|rk)_(live|test)_[A-Za-z0-9]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|glpat-[A-Za-z0-9_-]{16,}|xox[baprs]-[A-Za-z0-9-]{10,}|xapp-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16}|ASIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|ya29\.[A-Za-z0-9_-]{20,}|SG\.[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{30,}|dop_v1_[a-f0-9]{40,}|shpat_[a-f0-9]{30,}|sbp_[a-f0-9]{30,}|hf_[A-Za-z0-9]{30,}|nvapi-[A-Za-z0-9_-]{20,})\b/g,rt=/\b(Bearer|Basic|Digest|Negotiate|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi,X=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z]{2,24})+\b/g,R=/\b(?:\d[ -]?){12,18}\d\b/g,Y=/\b(?=[A-Za-z0-9+/]*[a-z])(?=[A-Za-z0-9+/]*[A-Z])(?=[A-Za-z0-9+/]*\d)[A-Za-z0-9+/]{40,}={0,2}\b/g,Q=/\b[0-9a-f]{32,}\b/gi,J=/\b(?=[A-Za-z0-9_-]*[a-z])(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{40,}\b/g,G=/\b[a-z][a-z0-9]{1,15}(?:_[a-z0-9]{1,15}){0,2}_(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{24,}\b/g,ee=/\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/gi,at=/^(?=[A-Za-z0-9_~.+/=-]*[a-z])(?=[A-Za-z0-9_~.+/=-]*[A-Z])(?=[A-Za-z0-9_~.+/=-]*\d)[A-Za-z0-9_~.+/=-]{24,}$/;function y(e,t){e.lastIndex=0;const n=e.test(t);return e.lastIndex=0,n}function te(e){const t=e.replace(/[ -]/g,"");if(t.length<13||t.length>19)return!1;let n=0,r=!1;for(let a=t.length-1;a>=0;a--){let o=t.charCodeAt(a)-48;r&&(o*=2,o>9&&(o-=9)),n+=o,r=!r}return n%10===0}function ot(e){R.lastIndex=0;for(const t of e.matchAll(R))if(te(t[0]))return!0;return!1}function E(e){let t=e;return t=t.replace(q,"data:[redacted]"),t=t.replace(rt,"$1 [redacted]"),t=t.replace(et,nt),t=t.replace(V,"[redacted:jwt]"),t=t.replace(K,"[redacted:key]"),t=t.replace(G,"[redacted:key]"),t=t.replace(ee,"[redacted:url-cred]@"),t=t.replace(X,"[redacted:email]"),t=t.replace(R,n=>te(n)?"[redacted:card]":n),t=t.replace(J,n=>`[redacted:b64:${n.length}]`),t=t.replace(Y,n=>`[redacted:b64:${n.length}]`),t=t.replace(Q,n=>`[redacted:hex:${n.length}]`),t}const st=C.query,it=C.fragment;function ne(e,t=[]){let n;try{const r=globalThis.location?.href;n=new URL(e,r)}catch{return E(e)}n.username="",n.password="";for(const r of[...n.searchParams.keys()]){if(it.includes(r)){n.searchParams.set(r,"[redacted]");continue}if(st.includes(r))continue;if(!t.includes(r)){n.searchParams.set(r,"[redacted]");continue}const a=n.searchParams.get(r)??"";E(a)!==a&&n.searchParams.set(r,"[redacted]")}return n.hash&&n.hash.length>1&&(n.hash=t.includes("#")?n.hash:"#[redacted]"),E(n.toString().replace(/%5Bredacted%5D/gi,"[redacted]"))}function O(e){return e.length>120?!0:y(X,e)||y(V,e)||y(K,e)||y(Q,e)||y(Y,e)||y(q,e)||y(J,e)||y(G,e)||y(ee,e)||at.test(e)||ot(e)}const ct=/^eyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/,lt=/^[a-f0-9]{32,}$/i,dt=/^(?=[A-Za-z0-9_-]{24,}$)(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]+$/,ut="[redacted]";function ht(e){return e.includes("/")?e.split("/").map(t=>ct.test(t)||lt.test(t)||dt.test(t)?ut:t).join("/"):e}const ft=/\/index\.(html?|php)$/i;function mt(e){if(!e.startsWith("/"))return e;let t=e.replace(ft,"/");return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t.toLowerCase()}function re(e){try{const t=e.querySelector(`meta[name="${Ke.route}"]`)?.getAttribute("content")?.trim();return!t||t.length>512||!t.startsWith("/")?null:t}catch{return null}}const gt=[/^utm_/,/^(gclid|gbraid|wbraid|fbclid|msclkid|ttclid|twclid|igshid|yclid|li_fat_id)$/,/^(mc_cid|mc_eid|_hsenc|_hsmi|vero_id|oly_enc_id|oly_anon_id)$/,/^_vercel_/,/^__vercel_/,/^_rsc$/],pt=[...C.query,...C.fragment];function bt(e,t=[]){return pt.includes(e)||t.includes(e)?!0:gt.some(n=>n.test(e))}function wt(e,t={}){const n=t.significantQueryParams??[];if(n!=="*"&&n.length===0)return;let r;try{r=new URLSearchParams(e)}catch{return}const a={};for(const[o,s]of r)bt(o,t.ignoredQueryParams??[])||n!=="*"&&!n.includes(o)||(a[o]=s);return Object.keys(a).length>0?a:void 0}function ae(e,t){const n=e.length>4096?e.slice(0,4096):e,r=ne(n,t);return r.length<=2048?r:r.slice(0,2048)+`\u2026[+${r.length-2048}]`}function yt(e=location,t={}){const n=ht(e.pathname),r=t.routeOverride??(t.doc?re(t.doc):typeof document<"u"?re(document):null),a=wt(e.search??"",t.query);return{route:mt(r??n),pathname:n,...a?{query:a}:{},origin:e.origin}}function xt(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function $t(e){const t=e.urlParamAllowList??[];let n;try{n=ae(location.href,t)}catch{try{n=ae(document.URL,t)}catch{n=E(location.origin+location.pathname)}}let r=innerWidth,a=innerHeight;(r===0||a===0)&&(r=document.documentElement.clientWidth,a=document.documentElement.clientHeight);let o={w:0,h:0};try{o={w:screen.width,h:screen.height}}catch{}const s=navigator.userAgent||"",i=navigator.userAgentData,l=i?{brands:(i.brands??[]).map(u=>({brand:u.brand,version:u.version})),platform:i.platform,mobile:i.mobile}:void 0,h={schemaVersion:T,url:n,page:e.page,viewport:{w:r,h:a,dpr:devicePixelRatio||1},screen:o,ua:s,derived:Xe(s,l),language:navigator.language||navigator.languages?.[0]||"en",prefersColorScheme:xt()?"dark":"light",timestamp:new Date().toISOString(),capture:v({breadcrumbs:e.breadcrumbs?.status??"disabled"})};return l&&(h.uaData=l),e.breadcrumbs&&e.breadcrumbs.status!=="disabled"&&(h.breadcrumbs=e.breadcrumbs.records),h}const At={product:Me,set:Ze,item:Pe,items:Ie};function oe(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(r,a)=>{const o=n?.[a]??At[a];return o===void 0?r:String(o)})}const se=e=>new Intl.NumberFormat().format(e),ie=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)},ce={"where.anchored":"{label}","where.approximate":"position approximate \u2014 the page changed","where.orphaned":"moved \u2014 the element is gone","status.open":"Active","status.progress":"In progress","status.review":"In review","status.resolved":"Resolved","author.unknown":"Someone","label.image":"an image","label.link":"a link","label.button":"a button","label.tag":"the {tag}"},S=oe(ce),vt={"detail.details":"Anchor details","detail.hidden":"This element isn't visible right now \u2014 it may be inside a closed menu, tab, or accordion.","detail.orphaned":"The element this was pinned to has moved or gone \u2014 it was {label}.","detail.approximate":"The page changed since this was written, so the pin is close rather than exact \u2014 it points at {label}.","detail.unavailable":"Some of the matching steps couldn't load, so this was judged with the basic ones only.","detail.filedat":"Filed at {query}.","detail.openquery":"Open with original query","capture.agent":"{browser} \xB7 {os}","capture.agent.noos":"{browser}","capture.device":"{device} \xB7 {w}\xD7{h} @{dpr}x","capture.device.at1x":"{device} \xB7 {w}\xD7{h}"},Et={"export.title":"{product} \u2014 {origin}","export.summary.one":"1 comment, {unresolved} unresolved \xB7 exported {date}","export.summary.many":"{total} comments, {unresolved} unresolved \xB7 exported {date}","export.heading":"{n} \xB7 {key} \u2014 {status}","export.on":"On {label}","export.device":"Device","export.selector":"Selector","export.by":"By","export.nobody":"_(no comment)_","cursor.proxy":"Pick an element \u2014 Tab to move, Enter to comment","cursor.at":"{role}, {name}, {i} of {n}","cursor.here":"{role} {name}","export.screenshot":"Screenshot {key}","label.text":"\u201C{text}\u201D","hint.fine":"Click anything to comment \u2014 Esc when done","hint.coarse":"Tap anything to comment","highlight.chip":"{tag} \xB7 {name} \xB7 {w}\xD7{h}","highlight.chip.unnamed":"{tag} \xB7 {w}\xD7{h}"},f=oe({...ce,...vt,...Et}),St=[`[${A("mask")}]`,`.${j("mask")}`,`.${j("block")}`].join(", ");function le(e,t){return O(t)||!!e.closest?.(St)}function de(e){const n=(e.innerText??e.textContent??"").slice(0,512).trim().replace(/\s+/g," ");if(n&&!le(e,n))return f("label.text",{text:n.length>52?n.slice(0,52)+"\u2026":n});const r=e.tagName.toLowerCase();return r==="img"?f("label.image"):r==="a"?f("label.link"):r==="button"?f("label.button"):f("label.tag",{tag:r})}function _t(e,t){const n=t.trim().replace(/\s+/g," ");return n&&!le(e,n)?f("label.text",{text:n.length>52?n.slice(0,52)+"\u2026":n}):de(e)}const ue={open:{colour:"#4F6EF7"},progress:{colour:"#F59E0B"},review:{colour:"#8B5CF6"},resolved:{colour:"#10B981"}},kt=e=>e in ue?S(`status.${e}`):e;class Tt extends Error{code;constructor(t,n){super(n??t),this.name="AdapterError",this.code=t}}function he(e,t){const{anchorPending:n,anchorReasons:r,screenshotBlob:a,...o}=e;return o.attachments?.length&&t?.size&&(o.attachments=o.attachments.map(s=>{const i=t.get(s.id);return i?{...s,url:i}:s})),o}function fe(e){const t=e.context,n=t?.derived,r=t?.viewport;if(!t||!n||!r)return"";const a=Math.round(r.dpr*100)/100,o=n.os?f("capture.agent",{browser:n.browser,os:n.os}):f("capture.agent.noos",{browser:n.browser}),s=a===1?f("capture.device.at1x",{device:n.device,w:r.w,h:r.h}):f("capture.device",{device:n.device,w:r.w,h:r.h,dpr:a});return`${o} \xB7 ${s}`}function Ct(e,t,n){const r=e.map(l=>he(l,n)),a=r.filter(l=>l.status!=="resolved").length,o=[],s=[`# ${f("export.title",{origin:t.origin})}`,"",f(r.length===1?"export.summary.one":"export.summary.many",{total:se(r.length),unresolved:se(a),date:ie(t.exportedAt)})],i=new Map;for(const l of r)i.set(l.route,[...i.get(l.route)??[],l]);for(const[l,h]of i)s.push("","---","",`## ${l}`),h.forEach((u,b)=>{const g=u.comments[0];s.push("",`### ${f("export.heading",{n:b+1,key:u.key,status:kt(u.status)})}`,"",`**${f("export.on",{label:u.anchor.label})}**`,...u.anchorState==="anchored"?[]:[f(`detail.${u.anchorState}`,{label:u.anchor.label})],...u.anchor.css?[`**${f("export.selector")}** \`${u.anchor.css}\``]:[],...fe(u)?[`**${f("export.device")}** ${fe(u)}`]:[],`**${f("export.by")}** ${g?.author.name??u.createdBy.name} \xB7 ${ie(u.createdAt)}`,"",g?.body??f("export.nobody"));for(const c of u.attachments??[])c.url.startsWith("data:")&&(s.push("",`![${f("export.screenshot",{key:u.key})}][${c.id}]`),o.push(`[${c.id}]: ${c.url}`));for(const c of u.comments.slice(1))s.push("",`- **${c.author.name}** \u2014 ${c.body??""}`)});return o.length&&s.push("","---","",...o),s.join(`
1
+ const Me="Snagset",H="snagset",T="snagset.v1",Ze="Snagset",Pe="Snag",Ie="Snags",Ue={root:"data-snag-root"},j=e=>Ue[e],Be={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},A=e=>Be[e],We={mask:"snag-mask",block:"snag-block"},q=e=>We[e],d={font:"--snag-font",accent:"--snag-accent",onAccent:"--snag-onAccent",bg:"--snag-bg",fg:"--snag-fg",muted:"--snag-muted",border:"--snag-border",radius:"--snag-radius",shadow:"--snag-shadow",z:"--snag-z",motion:"--snag-motion",surface:"--snag-surface",sunken:"--snag-sunken",hover:"--snag-hover",focus:"--snag-focus",disabled:"--snag-disabled",statusOpen:"--snag-status-open",statusProgress:"--snag-status-progress",statusReview:"--snag-status-review",statusResolved:"--snag-status-resolved",anchorOrphan:"--snag-anchor-orphan",tbH:"--snag-tb-h",dockW:"--snag-dock-w",kb:"--snag-kb",thumbX:"--snag-thumb-x",thumbW:"--snag-thumb-w"},He=e=>`var(${d[e]})`,C={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},je="snag:disclosure:v1",qe="snag:identity",Fe="data-snag-theme",Ve={session:e=>`snag:session:${e}`,identity:qe,threads:(e,t)=>`snag:threads:${e}:${t}`,seen:(e,t)=>`snag:seen:${e}:${t}`,counts:e=>`snag:counts:${e}`,draft:(e,t)=>`snag:draft:${e}:${t}`,outbox:e=>`snag:outbox:${e}`,mode:"snag:mode",handoff:"snag:handoff",seenCoach:"snag:seen-coach",disclosure:je},z={database:"snag:blobs",store:"blobs"},Ke={route:"snagset:route"};function Xe(e,t){let n="Unknown";/Edg\//.test(e)?n="Edge":/OPR\//.test(e)?n="Opera":/Firefox\//.test(e)?n="Firefox":/Chrome\//.test(e)?n="Chrome":/Safari\//.test(e)&&(n="Safari");let r="";if(/Macintosh/.test(e)?r="macOS":/Windows/.test(e)?r="Windows":/iPhone|iPad/.test(e)?r="iOS":/Android/.test(e)?r="Android":/Linux/.test(e)&&(r="Linux"),t?.brands?.length){const s=t.brands.find(i=>!/Not.?A.?Brand/i.test(i.brand));s&&(n=s.brand)}t?.platform&&(r=t.platform);let a=!1;try{a=typeof matchMedia=="function"&&matchMedia("(pointer:coarse)").matches}catch{}const o=t?.mobile??(a||/Mobi|iPhone|Android/.test(e))?"Mobile":"Desktop";return{browser:n,os:r,device:o}}const Ye={ok:{status:"ok"},release:{status:"disabled",reason:"Screenshots are not available in this release."},"config-off":{status:"disabled",reason:"Screenshots are switched off for this project."},"feature-off":{status:"disabled",reason:"Screenshots are switched off for this project."},"reviewer-removed":{status:"disabled",reason:"You removed the screenshot before sending."},"csp-blocked":{status:"failed",reason:"Your Content-Security-Policy blocks data: images, so no screenshot could be taken."},"engine-load-failed":{status:"failed",reason:"The screenshot engine could not be loaded."},"engine-failed":{status:"failed",reason:"The screenshot engine failed on this page."},timeout:{status:"timeout",reason:"The screenshot timed out."},tainted:{status:"tainted",reason:"A cross-origin image made the page canvas unreadable."},"scope-forced":{status:"ok",reason:"The page was too large to capture in full; captured the area around your pin."},"masking-failed":{status:"failed",reason:"Masking could not be verified, so the screenshot was discarded."},navigated:{status:"failed",reason:"The page changed while the screenshot was being taken."}},Qe={disabled:"Console and network capture is off for this project.",truncated:"Earlier console and network entries were dropped to fit the buffer."};function v(e={}){const t=Ye[e.screenshot??"release"],n=e.breadcrumbs??"disabled",r=[];t.reason&&r.push(t.reason),n!=="ok"&&r.push(Qe[n]);const a={screenshot:t.status,breadcrumbs:n,reasons:r};return e.blindSpots?.length&&(a.blindSpots=e.blindSpots),e.droppedCategories?.length&&(a.droppedCategories=e.droppedCategories),e.maskedCount!==void 0&&e.maskedCount>0&&(a.maskedCount=e.maskedCount),a}function Je(e,t,n,r=!1){const a=e.capture?.breadcrumbs??"disabled";if(n){e.capture=v({screenshot:"config-off",breadcrumbs:a});return}if(r&&!t){e.capture=v({screenshot:"reviewer-removed",breadcrumbs:a});return}t&&(e.capture=v({screenshot:t.situation,breadcrumbs:a,...t.blindSpots.length?{blindSpots:t.blindSpots}:{},...t.maskedCount>0?{maskedCount:t.maskedCount}:{}}))}const Ge="pass(?:word|wd)?|pwd|secret|token|api[_-]?key|apikey|auth(?:orization)?|credential|session|sid|cookie|jwt|bearer|otp|mfa|totp|cvv|cvc|ssn|nino|iban|card(?:[_-]?number)?|account[_-]?number|private[_-]?key|signature|client[_-]?secret|refresh[_-]?token|access[_-]?token",et=new RegExp(`(["'\`]?)(?<![A-Za-z0-9])(?:${Ge})[\\w-]*\\b\\1?\\s*[:=]\\s*(?:(["'\`])((?:\\\\.|(?!\\2)[^\\\\])*)\\2|([^\\s,;&}\\])]{3,}))`,"gi"),tt=/^(?:Bearer|Basic|Digest|Negotiate|Token)$/i,nt=(e,t,n,r,a,o,s)=>{if(!n&&tt.test(a)&&s.slice(o+e.length).startsWith(" [redacted]")||(n?r:a).startsWith("[redacted"))return e;const i=n?`${n}${r}${n}`:a;return e.slice(0,e.length-i.length)+(n?`${n}[redacted]${n}`:"[redacted]")},F=/data:[a-z0-9.+-]*\/?[a-z0-9.+-]*;base64,[A-Za-z0-9+/=]{16,}/gi,V=/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{0,}/g,K=/\b(sk-[A-Za-z0-9]+-[A-Za-z0-9_-]{20,}|sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9]{20,}|(sk|pk|rk)_(live|test)_[A-Za-z0-9]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|glpat-[A-Za-z0-9_-]{16,}|xox[baprs]-[A-Za-z0-9-]{10,}|xapp-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16}|ASIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|ya29\.[A-Za-z0-9_-]{20,}|SG\.[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{30,}|dop_v1_[a-f0-9]{40,}|shpat_[a-f0-9]{30,}|sbp_[a-f0-9]{30,}|hf_[A-Za-z0-9]{30,}|nvapi-[A-Za-z0-9_-]{20,})\b/g,rt=/\b(Bearer|Basic|Digest|Negotiate|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi,X=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z]{2,24})+\b/g,R=/\b(?:\d[ -]?){12,18}\d\b/g,Y=/\b(?=[A-Za-z0-9+/]*[a-z])(?=[A-Za-z0-9+/]*[A-Z])(?=[A-Za-z0-9+/]*\d)[A-Za-z0-9+/]{40,}={0,2}\b/g,Q=/\b[0-9a-f]{32,}\b/gi,J=/\b(?=[A-Za-z0-9_-]*[a-z])(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{40,}\b/g,G=/\b[a-z][a-z0-9]{1,15}(?:_[a-z0-9]{1,15}){0,2}_(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{24,}\b/g,ee=/\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/gi,at=/^(?=[A-Za-z0-9_~.+/=-]*[a-z])(?=[A-Za-z0-9_~.+/=-]*[A-Z])(?=[A-Za-z0-9_~.+/=-]*\d)[A-Za-z0-9_~.+/=-]{24,}$/;function y(e,t){e.lastIndex=0;const n=e.test(t);return e.lastIndex=0,n}function te(e){const t=e.replace(/[ -]/g,"");if(t.length<13||t.length>19)return!1;let n=0,r=!1;for(let a=t.length-1;a>=0;a--){let o=t.charCodeAt(a)-48;r&&(o*=2,o>9&&(o-=9)),n+=o,r=!r}return n%10===0}function ot(e){R.lastIndex=0;for(const t of e.matchAll(R))if(te(t[0]))return!0;return!1}function E(e){let t=e;return t=t.replace(F,"data:[redacted]"),t=t.replace(rt,"$1 [redacted]"),t=t.replace(et,nt),t=t.replace(V,"[redacted:jwt]"),t=t.replace(K,"[redacted:key]"),t=t.replace(G,"[redacted:key]"),t=t.replace(ee,"[redacted:url-cred]@"),t=t.replace(X,"[redacted:email]"),t=t.replace(R,n=>te(n)?"[redacted:card]":n),t=t.replace(J,n=>`[redacted:b64:${n.length}]`),t=t.replace(Y,n=>`[redacted:b64:${n.length}]`),t=t.replace(Q,n=>`[redacted:hex:${n.length}]`),t}const st=C.query,it=C.fragment;function ne(e,t=[]){let n;try{const r=globalThis.location?.href;n=new URL(e,r)}catch{return E(e)}n.username="",n.password="";for(const r of[...n.searchParams.keys()]){if(it.includes(r)){n.searchParams.set(r,"[redacted]");continue}if(st.includes(r))continue;if(!t.includes(r)){n.searchParams.set(r,"[redacted]");continue}const a=n.searchParams.get(r)??"";E(a)!==a&&n.searchParams.set(r,"[redacted]")}return n.hash&&n.hash.length>1&&(n.hash=t.includes("#")?n.hash:"#[redacted]"),E(n.toString().replace(/%5Bredacted%5D/gi,"[redacted]"))}function O(e){return e.length>120?!0:y(X,e)||y(V,e)||y(K,e)||y(Q,e)||y(Y,e)||y(F,e)||y(J,e)||y(G,e)||y(ee,e)||at.test(e)||ot(e)}const ct=/^eyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/,lt=/^[a-f0-9]{32,}$/i,dt=/^(?=[A-Za-z0-9_-]{24,}$)(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]+$/,ut="[redacted]";function ht(e){return e.includes("/")?e.split("/").map(t=>ct.test(t)||lt.test(t)||dt.test(t)?ut:t).join("/"):e}const ft=/\/index\.(html?|php)$/i;function mt(e){if(!e.startsWith("/"))return e;let t=e.replace(ft,"/");return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t.toLowerCase()}function re(e){try{const t=e.querySelector(`meta[name="${Ke.route}"]`)?.getAttribute("content")?.trim();return!t||t.length>512||!t.startsWith("/")?null:t}catch{return null}}const gt=[/^utm_/,/^(gclid|gbraid|wbraid|fbclid|msclkid|ttclid|twclid|igshid|yclid|li_fat_id)$/,/^(mc_cid|mc_eid|_hsenc|_hsmi|vero_id|oly_enc_id|oly_anon_id)$/,/^_vercel_/,/^__vercel_/,/^_rsc$/],pt=[...C.query,...C.fragment];function bt(e,t=[]){return pt.includes(e)||t.includes(e)?!0:gt.some(n=>n.test(e))}function wt(e,t={}){const n=t.significantQueryParams??[];if(n!=="*"&&n.length===0)return;let r;try{r=new URLSearchParams(e)}catch{return}const a={};for(const[o,s]of r)bt(o,t.ignoredQueryParams??[])||n!=="*"&&!n.includes(o)||(a[o]=s);return Object.keys(a).length>0?a:void 0}function ae(e,t){const n=e.length>4096?e.slice(0,4096):e,r=ne(n,t);return r.length<=2048?r:r.slice(0,2048)+`\u2026[+${r.length-2048}]`}function yt(e=location,t={}){const n=ht(e.pathname),r=t.routeOverride??(t.doc?re(t.doc):typeof document<"u"?re(document):null),a=wt(e.search??"",t.query);return{route:mt(r??n),pathname:n,...a?{query:a}:{},origin:e.origin}}function xt(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function $t(e){const t=e.urlParamAllowList??[];let n;try{n=ae(location.href,t)}catch{try{n=ae(document.URL,t)}catch{n=E(location.origin+location.pathname)}}let r=innerWidth,a=innerHeight;(r===0||a===0)&&(r=document.documentElement.clientWidth,a=document.documentElement.clientHeight);let o={w:0,h:0};try{o={w:screen.width,h:screen.height}}catch{}const s=navigator.userAgent||"",i=navigator.userAgentData,l=i?{brands:(i.brands??[]).map(u=>({brand:u.brand,version:u.version})),platform:i.platform,mobile:i.mobile}:void 0,h={schemaVersion:T,url:n,page:e.page,viewport:{w:r,h:a,dpr:devicePixelRatio||1},screen:o,ua:s,derived:Xe(s,l),language:navigator.language||navigator.languages?.[0]||"en",prefersColorScheme:xt()?"dark":"light",timestamp:new Date().toISOString(),capture:v({breadcrumbs:e.breadcrumbs?.status??"disabled"})};return l&&(h.uaData=l),e.breadcrumbs&&e.breadcrumbs.status!=="disabled"&&(h.breadcrumbs=e.breadcrumbs.records),h}const At={product:Me,set:Ze,item:Pe,items:Ie};function oe(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(r,a)=>{const o=n?.[a]??At[a];return o===void 0?r:String(o)})}const se=e=>new Intl.NumberFormat().format(e),ie=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)},ce={"where.anchored":"{label}","where.approximate":"position approximate \u2014 the page changed","where.orphaned":"moved \u2014 the element is gone","status.open":"Active","status.progress":"In progress","status.review":"In review","status.resolved":"Resolved","author.unknown":"Someone","label.image":"an image","label.link":"a link","label.button":"a button","label.tag":"the {tag}"},S=oe(ce),vt={"detail.details":"Anchor details","detail.hidden":"This element isn't visible right now \u2014 it may be inside a closed menu, tab, or accordion.","detail.orphaned":"The element this was pinned to has moved or gone \u2014 it was {label}.","detail.approximate":"The page changed since this was written, so the pin is close rather than exact \u2014 it points at {label}.","detail.unavailable":"Some of the matching steps couldn't load, so this was judged with the basic ones only.","detail.filedat":"Filed at {query}.","detail.openquery":"Open with original query","capture.agent":"{browser} \xB7 {os}","capture.agent.noos":"{browser}","capture.device":"{device} \xB7 {w}\xD7{h} @{dpr}x","capture.device.at1x":"{device} \xB7 {w}\xD7{h}"},Et={"export.title":"{product} \u2014 {origin}","export.summary.one":"1 comment, {unresolved} unresolved \xB7 exported {date}","export.summary.many":"{total} comments, {unresolved} unresolved \xB7 exported {date}","export.heading":"{n} \xB7 {key} \u2014 {status}","export.on":"On {label}","export.device":"Device","export.selector":"Selector","export.by":"By","export.nobody":"_(no comment)_","cursor.proxy":"Pick an element \u2014 Tab to move, Enter to comment","cursor.at":"{role}, {name}, {i} of {n}","cursor.here":"{role} {name}","export.screenshot":"Screenshot {key}","label.text":"\u201C{text}\u201D","hint.fine":"Click anything to comment \u2014 Esc when done","hint.coarse":"Tap anything to comment","highlight.chip":"{tag} \xB7 {name} \xB7 {w}\xD7{h}","highlight.chip.unnamed":"{tag} \xB7 {w}\xD7{h}"},f=oe({...ce,...vt,...Et}),St=[`[${A("mask")}]`,`.${q("mask")}`,`.${q("block")}`].join(", ");function le(e,t){return O(t)||!!e.closest?.(St)}function de(e){const n=(e.innerText??e.textContent??"").slice(0,512).trim().replace(/\s+/g," ");if(n&&!le(e,n))return f("label.text",{text:n.length>52?n.slice(0,52)+"\u2026":n});const r=e.tagName.toLowerCase();return r==="img"?f("label.image"):r==="a"?f("label.link"):r==="button"?f("label.button"):f("label.tag",{tag:r})}function _t(e,t){const n=t.trim().replace(/\s+/g," ");return n&&!le(e,n)?f("label.text",{text:n.length>52?n.slice(0,52)+"\u2026":n}):de(e)}const ue={open:{colour:"#009ed3"},progress:{colour:"#bd5000"},review:{colour:"#6700bf"},resolved:{colour:"#b2e3a3"}},kt=e=>e in ue?S(`status.${e}`):e;class Tt extends Error{code;constructor(t,n){super(n??t),this.name="AdapterError",this.code=t}}function he(e,t){const{anchorPending:n,anchorReasons:r,screenshotBlob:a,...o}=e;return o.attachments?.length&&t?.size&&(o.attachments=o.attachments.map(s=>{const i=t.get(s.id);return i?{...s,url:i}:s})),o}function fe(e){const t=e.context,n=t?.derived,r=t?.viewport;if(!t||!n||!r)return"";const a=Math.round(r.dpr*100)/100,o=n.os?f("capture.agent",{browser:n.browser,os:n.os}):f("capture.agent.noos",{browser:n.browser}),s=a===1?f("capture.device.at1x",{device:n.device,w:r.w,h:r.h}):f("capture.device",{device:n.device,w:r.w,h:r.h,dpr:a});return`${o} \xB7 ${s}`}function Ct(e,t,n){const r=e.map(l=>he(l,n)),a=r.filter(l=>l.status!=="resolved").length,o=[],s=[`# ${f("export.title",{origin:t.origin})}`,"",f(r.length===1?"export.summary.one":"export.summary.many",{total:se(r.length),unresolved:se(a),date:ie(t.exportedAt)})],i=new Map;for(const l of r)i.set(l.route,[...i.get(l.route)??[],l]);for(const[l,h]of i)s.push("","---","",`## ${l}`),h.forEach((u,b)=>{const g=u.comments[0];s.push("",`### ${f("export.heading",{n:b+1,key:u.key,status:kt(u.status)})}`,"",`**${f("export.on",{label:u.anchor.label})}**`,...u.anchorState==="anchored"?[]:[f(`detail.${u.anchorState}`,{label:u.anchor.label})],...u.anchor.css?[`**${f("export.selector")}** \`${u.anchor.css}\``]:[],...fe(u)?[`**${f("export.device")}** ${fe(u)}`]:[],`**${f("export.by")}** ${g?.author.name??u.createdBy.name} \xB7 ${ie(u.createdAt)}`,"",g?.body??f("export.nobody"));for(const c of u.attachments??[])c.url.startsWith("data:")&&(s.push("",`![${f("export.screenshot",{key:u.key})}][${c.id}]`),o.push(`[${c.id}]: ${c.url}`));for(const c of u.comments.slice(1))s.push("",`- **${c.author.name}** \u2014 ${c.body??""}`)});return o.length&&s.push("","---","",...o),s.join(`
2
2
  `)+`
3
- `}function zt(e,t,n){return JSON.stringify({schemaVersion:T,...t,threads:e.map(r=>he(r,n))},null,2)}function Nt(e,t,n,r){const a=n.exportedAt.slice(0,10);return e==="md"?{name:`${H}-${a}.md`,mime:"text/markdown",text:Ct(t,n,r)}:{name:`${H}-${a}.json`,mime:"application/json",text:zt(t,n,r)}}function Rt(e,t,n){const r=e.ownerDocument??e,a=URL.createObjectURL(new Blob([t.text],{type:`${t.mime};charset=utf-8`})),o=r.createElement("a");o.href=a,o.download=t.name,o.style.display="none",e.appendChild(o),o.dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!0,composed:!1})),o.remove(),n.setTimeout(()=>URL.revokeObjectURL(a),0)}let $=null;function Ot(){return $||($=new Promise((e,t)=>{let n;try{n=indexedDB.open(z.database,1)}catch(r){t(r);return}n.onupgradeneeded=()=>{n.result.createObjectStore(z.store).createIndex("project",["uid","env"])},n.onsuccess=()=>{n.result.onversionchange=()=>{n.result.close(),$=null},e(n.result)},n.onerror=()=>t(n.error??new Error("indexeddb-unavailable")),n.onblocked=()=>t(new Error("indexeddb-blocked"))}),$.catch(()=>{$=null}),$)}function D(e,t){return Ot().then(n=>new Promise((r,a)=>{const o=n.transaction(z.store,e),s=t(o.objectStore(z.store));o.oncomplete=()=>r(s.result),o.onerror=()=>a(o.error??s.error??new Error("indexeddb-error")),o.onabort=()=>{const i=o.error;i&&(i.name==="QuotaExceededError"||/quota/i.test(i.message??""))?a(new Tt("local_quota_exceeded")):a(i??new Error("indexeddb-abort"))}}))}async function me(e,t){const{blob:n,...r}=t,a={...r,bytes:await n.arrayBuffer(),type:n.type};await D("readwrite",o=>o.put(a,e))}function ge(e){return D("readonly",t=>t.get(e)).then(t=>{if(!t)return null;const{bytes:n,type:r,...a}=t;return{...a,blob:new Blob([n],{type:r})}})}function Dt(e){return D("readwrite",t=>t.delete(e)).then(()=>{})}function Lt(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>typeof r.result=="string"?t(r.result):n(new Error("read-failed")),r.onerror=()=>n(r.error??new Error("read-failed")),r.readAsDataURL(e)})}function Mt(e){const t=/^data:([^;,]+)?(;base64)?,(.*)$/s.exec(e);if(!t)throw new Error("not-a-data-uri");const n=t[1]??"application/octet-stream";if(!t[2])return new Blob([decodeURIComponent(t[3])],{type:n});const r=atob(t[3]),a=new Uint8Array(r.length);for(let o=0;o<r.length;o++)a[o]=r.charCodeAt(o);return new Blob([a],{type:n})}async function Zt(e){const t=e.flatMap(r=>r.attachments??[]),n=new Map;return t.length===0||await Promise.all(t.map(async r=>{const a=await ge(r.id).catch(()=>null);a&&n.set(r.id,await Lt(a.blob))})),n}async function Pt(e,t,n){const r=JSON.parse(e);if(r.schemaVersion!==T||!Array.isArray(r.threads))throw new Error(`not a ${T} archive`);const a=[];let o=0;for(const s of r.threads){if(!s.attachments?.length){a.push(s);continue}const i=[];for(const l of s.attachments)if(l.url.startsWith("data:")){const h=Mt(l.url);await me(l.id,{blob:h,uid:t,env:n,kind:l.kind,...l.width!==void 0?{width:l.width}:{},...l.height!==void 0?{height:l.height}:{},createdAt:Date.now()}),o++,i.push({...l,url:""})}else i.push(l);a.push({...s,attachments:i})}return localStorage.setItem(Ve.threads(t,n),JSON.stringify(a)),{threads:a.length,blobs:o}}function L(e){return e.getBoundingClientRect()}function pe(e){if(e.closest('[inert],[aria-hidden="true"]'))return!1;const t=e.checkVisibility;if(typeof t=="function")return t.call(e,{contentVisibilityAuto:!0,opacityProperty:!1,visibilityProperty:!0});const n=L(e);if(!(n.width>0||n.height>0||e.getClientRects().length>0))return!1;const a=e.ownerDocument?.defaultView;return a?a.getComputedStyle(e).visibility!=="hidden":!0}const be=`[${F("root")}]`;function we(e){const t=e.parentElement;return!t||t===e.ownerDocument.body||t===e.ownerDocument.documentElement||t.closest(be)?null:t}function ye(e){for(const t of e.children)if(!t.closest(be)&&pe(t))return t;return null}const xe=10;function $e(e){let t=e,n=0;for(;n++<xe;){const r=t.getRootNode();if(!(r instanceof ShadowRoot))break;t=r.host}return t}function It(e){const t=[];let n=e,r=0;for(;r++<xe;){const a=n.getRootNode();if(!(a instanceof ShadowRoot))break;n=a.host,t.unshift(n)}return t}const Ut=/[\u200B-\u200D\u2060\uFEFF]/gu,Bt=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,Wt=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function Ht(e){let t=e.normalize("NFC").replace(Ut,"");for(const[n,r]of Wt)t=t.replace(n,r);return t.replace(Bt," ").trim()}const Ft=[A("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],jt=256,qt=200,Vt=12;function Kt(e){for(const t of Ft){const n=e.getAttribute(t);if(n)return{attr:t,value:n}}}function Xt(e,t=Vt){const n=[];let r=e;for(;r&&r.nodeType===1&&n.length<t;){const a=r.tagName.toLowerCase();if(a==="html")break;const o=r.parentElement;if(o){const s=[...o.children].filter(i=>i.tagName===r.tagName);n.push(s.length>1?`${a}:nth-of-type(${s.indexOf(r)+1})`:a)}else n.push(a);r=o}return n.reverse()}function Ae(e){const t=e.getAttribute("role");if(t)return t;const n=e.tagName.toLowerCase();if(n==="button")return"button";if(n==="a"&&e.hasAttribute("href"))return"link";if(n==="input"){const r=(e.getAttribute("type")??"text").toLowerCase();return r==="checkbox"||r==="radio"||r==="button"||r==="submit"?r==="submit"?"button":r:"textbox"}if(/^h[1-6]$/.test(n))return"heading";if(n==="nav")return"navigation";if(n==="img")return"img"}function M(e){const t=e.getAttribute("aria-label");if(t?.trim())return t.trim();const n=e.getAttribute("aria-labelledby");if(n){const o=n.split(/\s+/).map(s=>e.ownerDocument.getElementById(s)?.textContent??"").join(" ").trim();if(o)return o}const r=e.getAttribute("alt")??e.getAttribute("title");if(r?.trim())return r.trim();const a=(e.textContent??"").trim();return a?a.slice(0,jt):void 0}function Yt(e){const t=e.tagName.toLowerCase();return t==="img"?S("label.image"):t==="a"?S("label.link"):t==="button"?S("label.button"):S("label.tag",{tag:t})}function Qt(e){return e<480?"xs":e<768?"sm":e<1024?"md":e<1440?"lg":"xl"}function Jt(e,t={}){const n=$e(e),r=Kt(n),a=L(n),o=n.ownerDocument,s=o.defaultView?.scrollX??0,i=o.defaultView?.scrollY??0,l=Ht(n.textContent??"").slice(0,qt),h={path:Xt(n),rect:{x:a.left+s,y:a.top+i,w:a.width,h:a.height},label:t.label??Yt(n)};r&&(h.testid=r.value),t.domid&&(h.domid=t.domid),t.css&&(h.css=t.css),t.hostPath?.length&&(h.hostPath=t.hostPath),t.xpath&&(h.xpath=t.xpath);const u=Ae(n);u&&(h.role=u);const b=M(n);b&&(h.accessibleName=b),l&&(h.text={exact:l}),t.point&&a.width>0&&a.height>0&&(h.offset={fx:ve((t.point.x-a.left)/a.width),fy:ve((t.point.y-a.top)/a.height)});const g=t.viewportWidth??o.defaultView?.innerWidth;return g&&(h.breakpoint=Qt(g)),h}const ve=e=>e<0?0:e>1?1:e,Gt='a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"]),[role], h1,h2,h3,h4,h5,h6, img, video, figure, table, li,main, nav, header, footer, aside, section[aria-label], form, [data-testid]',en=`[${F("root")}]`;function Ee(e=document.body){return[...e.querySelectorAll(Gt)].filter(t=>!t.closest(en)&&pe(t))}function tn(e,t){const n=e.ownerDocument??document,r=n.createElement("button");r.type="button",r.className="snag-cursor-proxy",r.setAttribute("aria-label",f("cursor.proxy")),r.style.cssText="position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;pointer-events:none",e.appendChild(r);let a=[],o=-1,s=null,i=null;const l=()=>i??a[o]??null;function h(c){const w=Ae(c),p=M(c),x=i?0:o+1;t.announce(i||!p?f("cursor.here",{role:w??c.tagName.toLowerCase(),name:p??""}):f("cursor.at",{role:w??c.tagName.toLowerCase(),name:p,i:x,n:a.length}))}function u(c){c&&(t.show(c),c.scrollIntoView({block:"nearest",behavior:"auto"}),h(c))}function b(c){i=null,a.length!==0&&(o=o<0?c===1?0:a.length-1:(o+c+a.length)%a.length,u(a[o]))}function g(c){const w=l();if(!w)return;const p=c==="out"?we(w):ye(w);if(!p)return;const x=a.indexOf(p);x>=0?(i=null,o=x):i=p,u(p)}return r.addEventListener("keydown",c=>{if(!(c.metaKey||c.ctrlKey||c.altKey))switch(c.key){case"Tab":case"ArrowDown":case"ArrowRight":c.preventDefault(),b(c.key==="Tab"&&c.shiftKey?-1:1);return;case"ArrowUp":case"ArrowLeft":c.preventDefault(),b(-1);return;case"[":c.preventDefault(),g("out");return;case"]":c.preventDefault(),g("in");return;case"Enter":case" ":{const w=l();if(!w)return;c.preventDefault();const p=w.getBoundingClientRect();t.pick(w,{x:p.left+p.width/2,y:p.top+p.height/2});return}}}),{engage(){a=Ee(n.body),o=-1,i=null,s=e.activeElement??n.activeElement,r.focus({preventScroll:!0})},release(){i=null,e.activeElement===r&&s?.focus?.(),s=null},destroy(){r.remove()}}}const m=Object.fromEntries(Object.keys(d).map(e=>[e,He(e)])),nn=Object.entries(ue).map(([e,t])=>` ${d[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
4
- `);`${m.font}${m.fg}${d.font}${d.accent}${d.bg}${d.fg}${d.muted}${d.border}${d.radius}${d.shadow}${d.z}${d.motion}${d.surface}${m.fg}${m.bg}${d.sunken}${m.fg}${m.bg}${d.hover}${m.fg}${m.bg}${d.onAccent}${d.focus}${m.accent}${m.fg}${d.disabled}${m.muted}${m.bg}${nn}${d.anchorOrphan}${qe}${d.accent}${d.onAccent}${d.bg}${d.fg}${d.muted}${d.border}${d.shadow}${d.motion}${d.bg}${d.fg}${d.muted}${d.border}${d.accent}${d.onAccent}${d.surface}${d.sunken}${d.hover}${d.focus}${d.disabled}${d.shadow}${d.anchorOrphan}`;const Se={highlight:2,chip:4},_e=new WeakMap;function rn(e,t,n){let r=_e.get(e);if(r||_e.set(e,r=new Set),r.has(t))return;r.add(t);try{const s=new CSSStyleSheet;s.replaceSync(n),e.adoptedStyleSheets=[...e.adoptedStyleSheets,s];return}catch{}const o=(e.ownerDocument??document).createElement("style");o.setAttribute(`data-snag-${t}`,""),o.textContent=n,e.appendChild(o)}const an=` .snag-hl-layer{position:fixed;inset:0;pointer-events:none;z-index:${Se.highlight};contain:layout style;overflow:hidden}.snag-hl{position:absolute;box-sizing:border-box;border:2px solid ${m.accent};border-radius:3px;background:color-mix(in srgb,${m.accent} 12%,transparent);box-shadow:0 0 0 100vmax color-mix(in srgb,#000 4%,transparent);transition:top ${m.motion},left ${m.motion},width ${m.motion},height ${m.motion}}.snag-hl-chip{position:absolute;background:${m.accent};color:${m.onAccent};font:600 11px/1.5 ${m.font};padding:2px 7px;border-radius:4px;white-space:nowrap;max-width:min(48ch,90vw);overflow:hidden;text-overflow:ellipsis}.snag-hint{position:fixed;top:calc(12px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:${Se.chip};pointer-events:none;background:${m.bg};color:${m.fg};border:1px solid ${m.border};box-shadow:${m.shadow};border-radius:999px;padding:7px 14px;font:500 12px/1 ${m.font};white-space:nowrap;max-width:calc(100vw - 24px);overflow:hidden;text-overflow:ellipsis}`;function on(e,t,n){const r=e.ownerDocument??document;rn(e,"highlight",an);const a=r.createElement("div");a.className="snag-hl-layer",a.hidden=!0;const o=r.createElement("div");o.className="snag-hl";const s=r.createElement("div");s.className="snag-hl-chip",a.append(o,s);const i=r.createElement("div");i.className="snag-hint",i.setAttribute("role","status"),i.hidden=!0,i.textContent=f(t?"hint.coarse":"hint.fine");let l;function h(g){const c=L(g);if(c.width<=0&&c.height<=0)return u();a.hidden=!1,o.style.left=`${c.left}px`,o.style.top=`${c.top}px`,o.style.width=`${c.width}px`,o.style.height=`${c.height}px`;const w=M(g),p=g.tagName.toLowerCase(),x=Math.round(c.width),W=Math.round(c.height);s.textContent=w?f("highlight.chip",{tag:p,name:w,w:x,h:W}):f("highlight.chip.unnamed",{tag:p,w:x,h:W});const Le=c.top>=22;s.style.top=Le?`${c.top-20}px`:`${c.bottom+4}px`,s.style.left=`${Math.max(2,c.left)}px`,t&&(clearTimeout(l),l=setTimeout(u,400))}function u(){a.hidden=!0}let b=null;return{show:h,clear:u,setActive(g){n&&(b??=tn(e,{...n,show:h}),g?b.engage():b.release()),g||u(),g?e.append(a,i):(a.remove(),i.remove()),i.hidden=!g},destroy(){clearTimeout(l),b?.destroy(),a.remove(),i.remove()}}}const sn=new Set(["role","name","aria-label","rel","href"]);function cn(e,t){let n=sn.has(e);n||=e.startsWith("data-")&&_(e);let r=_(t)&&t.length<100;return r||=t.startsWith("#")&&_(t.slice(1)),n&&r}function ln(e){return _(e)}function dn(e){return _(e)}function un(e){return!0}function ke(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return"html";const n={root:document.body,idName:ln,className:dn,tagName:un,attr:cn,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,a={...n,...t},o=pn(a.root,n);let s,i=0;for(const h of hn(e,a,o)){if(new Date().getTime()-r.getTime()>a.timeoutMs||i>=a.maxNumberOfPathChecks){const b=mn(e,o);if(!b)throw new Error(`Timeout: Can't find a unique selector after ${a.timeoutMs}ms`);return k(b)}if(i++,I(h,o)){s=h;break}}if(!s)throw new Error("Selector was not found.");const l=[...Ne(s,e,a,o,r)];return l.sort(Z),l.length>0?k(l[0]):k(s)}function*hn(e,t,n){const r=[];let a=[],o=e,s=0;for(;o&&o!==n;){const i=fn(o,t);for(const l of i)l.level=s;if(r.push(i),o=o.parentElement,s++,a.push(...ze(r)),s>=t.seedMinLength){a.sort(Z);for(const l of a)yield l;a=[]}}a.sort(Z);for(const i of a)yield i}function _(e){if(/^[a-z\-]{3,}$/i.test(e)){const t=e.split(/-|[A-Z]/);for(const n of t)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return!1;return!0}return!1}function fn(e,t){const n=[],r=e.getAttribute("id");r&&t.idName(r)&&n.push({name:"#"+CSS.escape(r),penalty:0});for(let s=0;s<e.classList.length;s++){const i=e.classList[s];t.className(i)&&n.push({name:"."+CSS.escape(i),penalty:1})}for(let s=0;s<e.attributes.length;s++){const i=e.attributes[s];t.attr(i.name,i.value)&&n.push({name:`[${CSS.escape(i.name)}="${CSS.escape(i.value)}"]`,penalty:2})}const a=e.tagName.toLowerCase();if(t.tagName(a)){n.push({name:a,penalty:5});const s=P(e,a);s!==void 0&&n.push({name:Ce(a,s),penalty:10})}const o=P(e);return o!==void 0&&n.push({name:gn(a,o),penalty:50}),n}function k(e){let t=e[0],n=t.name;for(let r=1;r<e.length;r++){const a=e[r].level||0;t.level===a-1?n=`${e[r].name} > ${n}`:n=`${e[r].name} ${n}`,t=e[r]}return n}function Te(e){return e.map(t=>t.penalty).reduce((t,n)=>t+n,0)}function Z(e,t){return Te(e)-Te(t)}function P(e,t){const n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let a=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&a++,r!==e);)r=r.nextSibling;return a}function mn(e,t){let n=0,r=e;const a=[];for(;r&&r!==t;){const o=r.tagName.toLowerCase(),s=P(r,o);if(s===void 0)return;a.push({name:Ce(o,s),penalty:NaN,level:n}),r=r.parentElement,n++}if(I(a,t))return a}function gn(e,t){return e==="html"?"html":`${e}:nth-child(${t})`}function Ce(e,t){return e==="html"?"html":`${e}:nth-of-type(${t})`}function*ze(e,t=[]){if(e.length>0)for(let n of e[0])yield*ze(e.slice(1,e.length),t.concat(n));else yield t}function pn(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function I(e,t){const n=k(e);switch(t.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return!0;default:return!1}}function*Ne(e,t,n,r,a){if(e.length>2&&e.length>n.optimizedMinLength)for(let o=1;o<e.length-1;o++){if(new Date().getTime()-a.getTime()>n.timeoutMs)return;const i=[...e];i.splice(o,1),I(i,r)&&r.querySelector(k(i))===t&&(yield i,yield*Ne(i,t,n,r,a))}}const bn=A("anchor").replace(/anchor$/,""),wn=[A("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],Re=new Set([...wn,"name","aria-label","role","type","itemprop"]),yn=new Set(["name","type","role","aria-label","itemprop","href","alt","lang"]),xn=[/^class$|^style$/,/^data-v-/,/^_ngcontent-|^_nghost-|^ng-version$|^ng-reflect-/,/^data-reactid$|^data-react-checksum$|^data-react-helmet$/,/^data-radix-|^data-headlessui-|^data-floating-ui-|^data-state$|^data-side$/,/^data-svelte-h$|^data-astro-|^data-styled|^data-emotion$/],$n=[/^[0-9a-f]{8}-[0-9a-f]{4}-/i,/^[0-9a-f]{16,}$/i,/^:r[0-9a-z]+:$/,/^«r[0-9a-z]+»$/,/^\d{4,}$/,/^(ember|mui|mat|cdk|headlessui|radix|reach)-?\d/i,/^(ember|mui|mat|cdk|headlessui|radix|reach)(-?[a-z]+)*-?\d+$/i];function An(e){return e.startsWith(bn)&&e!==A("anchor")||e.startsWith("aria-")&&e!=="aria-label"||xn.some(t=>t.test(e))?!1:Re.has(e)||yn.has(e)}function vn(e,t){return!t||t.length>120||e==="href"&&(t.includes("?")||/^[a-z]+:\/\//i.test(t))?!0:$n.some(n=>n.test(t))}const N=(e,t)=>!vn(e,t)&&!O(t);function U(e){return N("id",e)&&/^[a-zA-Z0-9_-]+$/.test(e)}const En=e=>`"${e.replace(/([\\"])/g,"\\$1")}"`,Oe=e=>e.replace(/"[^"]*"|'[^']*'|#([A-Za-z_-][\w-]*)/g,(t,n)=>n?`[id=${En(n)}]`:t);function De(e,t,n){try{return n.querySelectorAll(e).length===1&&n.querySelector(e)===t}catch{return!1}}function B(e,t=document.body){const n={root:t,tagName:()=>!0,idName:U,seedMinLength:2,optimizedMinLength:2};try{const r=ke(e,{...n,timeoutMs:150,className:()=>!1,attr:(o,s)=>Re.has(o)&&N(o,s)}),a=Oe(r);if(De(a,e,t))return a}catch{}try{const r=ke(e,{...n,timeoutMs:300,className:Sn,attr:(o,s)=>An(o)&&N(o,s)}),a=Oe(r);return De(a,e,t)?a:void 0}catch{return}}function Sn(e){return!(!e||e.length>60||/^[a-z-]*\d/.test(e)||/[:[\]/]/.test(e)||/_[A-Za-z0-9]{5,}$/.test(e)||/^[a-z]+-[0-9a-f]{6,}$/i.test(e))}function _n(e){const t=[];let n=e;for(let r=0;n&&n.nodeType===1&&r<40;r++){const a=n.tagName.toLowerCase();let o=1,s=!1;for(let i=n.previousElementSibling;i;i=i.previousElementSibling)i.tagName===n.tagName&&o++;for(let i=n.nextElementSibling;!s&&i;i=i.nextElementSibling)i.tagName===n.tagName&&(s=!0);t.unshift(o>1||s?`${a}[${o}]`:a),n=n.parentElement}return`/${t.join("/")}`}function kn(e){const t=$e(e),n={},r=It(e);if(r.length){const o=r.map(s=>B(s)).filter(s=>!!s);o.length&&(n.hostPath=o)}const a=B(t);a&&(n.css=a),t.id&&U(t.id)&&(n.domid=t.id);try{n.xpath=_n(t)}catch{}return n}export{Je as applyShotOutcome,Nt as buildExport,Ee as candidates,$t as captureContext,v as captureReport,on as createAddChrome,Jt as createElementAnchor,Dt as deleteBlob,de as deriveAnchorLabel,yt as derivePageRef,_t as deriveQuoteLabel,kn as describeElement,Rt as download,B as generateCss,ge as getBlob,Pt as importArchive,O as isSensitiveValue,U as isStableId,N as isUsableAttrValue,ye as narrow,me as putBlob,E as redactText,ne as redactUrl,Zt as resolveAttachmentUris,we as widen};
3
+ `}function zt(e,t,n){return JSON.stringify({schemaVersion:T,...t,threads:e.map(r=>he(r,n))},null,2)}function Nt(e,t,n,r){const a=n.exportedAt.slice(0,10);return e==="md"?{name:`${H}-${a}.md`,mime:"text/markdown",text:Ct(t,n,r)}:{name:`${H}-${a}.json`,mime:"application/json",text:zt(t,n,r)}}function Rt(e,t,n){const r=e.ownerDocument??e,a=URL.createObjectURL(new Blob([t.text],{type:`${t.mime};charset=utf-8`})),o=r.createElement("a");o.href=a,o.download=t.name,o.style.display="none",e.appendChild(o),o.dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!0,composed:!1})),o.remove(),n.setTimeout(()=>URL.revokeObjectURL(a),0)}let $=null;function Ot(){return $||($=new Promise((e,t)=>{let n;try{n=indexedDB.open(z.database,1)}catch(r){t(r);return}n.onupgradeneeded=()=>{n.result.createObjectStore(z.store).createIndex("project",["uid","env"])},n.onsuccess=()=>{n.result.onversionchange=()=>{n.result.close(),$=null},e(n.result)},n.onerror=()=>t(n.error??new Error("indexeddb-unavailable")),n.onblocked=()=>t(new Error("indexeddb-blocked"))}),$.catch(()=>{$=null}),$)}function D(e,t){return Ot().then(n=>new Promise((r,a)=>{const o=n.transaction(z.store,e),s=t(o.objectStore(z.store));o.oncomplete=()=>r(s.result),o.onerror=()=>a(o.error??s.error??new Error("indexeddb-error")),o.onabort=()=>{const i=o.error;i&&(i.name==="QuotaExceededError"||/quota/i.test(i.message??""))?a(new Tt("local_quota_exceeded")):a(i??new Error("indexeddb-abort"))}}))}async function me(e,t){const{blob:n,...r}=t,a={...r,bytes:await n.arrayBuffer(),type:n.type};await D("readwrite",o=>o.put(a,e))}function ge(e){return D("readonly",t=>t.get(e)).then(t=>{if(!t)return null;const{bytes:n,type:r,...a}=t;return{...a,blob:new Blob([n],{type:r})}})}function Dt(e){return D("readwrite",t=>t.delete(e)).then(()=>{})}function Lt(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>typeof r.result=="string"?t(r.result):n(new Error("read-failed")),r.onerror=()=>n(r.error??new Error("read-failed")),r.readAsDataURL(e)})}function Mt(e){const t=/^data:([^;,]+)?(;base64)?,(.*)$/s.exec(e);if(!t)throw new Error("not-a-data-uri");const n=t[1]??"application/octet-stream";if(!t[2])return new Blob([decodeURIComponent(t[3])],{type:n});const r=atob(t[3]),a=new Uint8Array(r.length);for(let o=0;o<r.length;o++)a[o]=r.charCodeAt(o);return new Blob([a],{type:n})}async function Zt(e){const t=e.flatMap(r=>r.attachments??[]),n=new Map;return t.length===0||await Promise.all(t.map(async r=>{const a=await ge(r.id).catch(()=>null);a&&n.set(r.id,await Lt(a.blob))})),n}async function Pt(e,t,n){const r=JSON.parse(e);if(r.schemaVersion!==T||!Array.isArray(r.threads))throw new Error(`not a ${T} archive`);const a=[];let o=0;for(const s of r.threads){if(!s.attachments?.length){a.push(s);continue}const i=[];for(const l of s.attachments)if(l.url.startsWith("data:")){const h=Mt(l.url);await me(l.id,{blob:h,uid:t,env:n,kind:l.kind,...l.width!==void 0?{width:l.width}:{},...l.height!==void 0?{height:l.height}:{},createdAt:Date.now()}),o++,i.push({...l,url:""})}else i.push(l);a.push({...s,attachments:i})}return localStorage.setItem(Ve.threads(t,n),JSON.stringify(a)),{threads:a.length,blobs:o}}function L(e){return e.getBoundingClientRect()}function pe(e){if(e.closest('[inert],[aria-hidden="true"]'))return!1;const t=e.checkVisibility;if(typeof t=="function")return t.call(e,{contentVisibilityAuto:!0,opacityProperty:!1,visibilityProperty:!0});const n=L(e);if(!(n.width>0||n.height>0||e.getClientRects().length>0))return!1;const a=e.ownerDocument?.defaultView;return a?a.getComputedStyle(e).visibility!=="hidden":!0}const be=`[${j("root")}]`;function we(e){const t=e.parentElement;return!t||t===e.ownerDocument.body||t===e.ownerDocument.documentElement||t.closest(be)?null:t}function ye(e){for(const t of e.children)if(!t.closest(be)&&pe(t))return t;return null}const xe=10;function $e(e){let t=e,n=0;for(;n++<xe;){const r=t.getRootNode();if(!(r instanceof ShadowRoot))break;t=r.host}return t}function It(e){const t=[];let n=e,r=0;for(;r++<xe;){const a=n.getRootNode();if(!(a instanceof ShadowRoot))break;n=a.host,t.unshift(n)}return t}const Ut=/[\u200B-\u200D\u2060\uFEFF]/gu,Bt=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,Wt=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function Ht(e){let t=e.normalize("NFC").replace(Ut,"");for(const[n,r]of Wt)t=t.replace(n,r);return t.replace(Bt," ").trim()}const jt=[A("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],qt=256,Ft=200,Vt=12;function Kt(e){for(const t of jt){const n=e.getAttribute(t);if(n)return{attr:t,value:n}}}function Xt(e,t=Vt){const n=[];let r=e;for(;r&&r.nodeType===1&&n.length<t;){const a=r.tagName.toLowerCase();if(a==="html")break;const o=r.parentElement;if(o){const s=[...o.children].filter(i=>i.tagName===r.tagName);n.push(s.length>1?`${a}:nth-of-type(${s.indexOf(r)+1})`:a)}else n.push(a);r=o}return n.reverse()}function Ae(e){const t=e.getAttribute("role");if(t)return t;const n=e.tagName.toLowerCase();if(n==="button")return"button";if(n==="a"&&e.hasAttribute("href"))return"link";if(n==="input"){const r=(e.getAttribute("type")??"text").toLowerCase();return r==="checkbox"||r==="radio"||r==="button"||r==="submit"?r==="submit"?"button":r:"textbox"}if(/^h[1-6]$/.test(n))return"heading";if(n==="nav")return"navigation";if(n==="img")return"img"}function M(e){const t=e.getAttribute("aria-label");if(t?.trim())return t.trim();const n=e.getAttribute("aria-labelledby");if(n){const o=n.split(/\s+/).map(s=>e.ownerDocument.getElementById(s)?.textContent??"").join(" ").trim();if(o)return o}const r=e.getAttribute("alt")??e.getAttribute("title");if(r?.trim())return r.trim();const a=(e.textContent??"").trim();return a?a.slice(0,qt):void 0}function Yt(e){const t=e.tagName.toLowerCase();return t==="img"?S("label.image"):t==="a"?S("label.link"):t==="button"?S("label.button"):S("label.tag",{tag:t})}function Qt(e){return e<480?"xs":e<768?"sm":e<1024?"md":e<1440?"lg":"xl"}function Jt(e,t={}){const n=$e(e),r=Kt(n),a=L(n),o=n.ownerDocument,s=o.defaultView?.scrollX??0,i=o.defaultView?.scrollY??0,l=Ht(n.textContent??"").slice(0,Ft),h={path:Xt(n),rect:{x:a.left+s,y:a.top+i,w:a.width,h:a.height},label:t.label??Yt(n)};r&&(h.testid=r.value),t.domid&&(h.domid=t.domid),t.css&&(h.css=t.css),t.hostPath?.length&&(h.hostPath=t.hostPath),t.xpath&&(h.xpath=t.xpath);const u=Ae(n);u&&(h.role=u);const b=M(n);b&&(h.accessibleName=b),l&&(h.text={exact:l}),t.point&&a.width>0&&a.height>0&&(h.offset={fx:ve((t.point.x-a.left)/a.width),fy:ve((t.point.y-a.top)/a.height)});const g=t.viewportWidth??o.defaultView?.innerWidth;return g&&(h.breakpoint=Qt(g)),h}const ve=e=>e<0?0:e>1?1:e,Gt='a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"]),[role], h1,h2,h3,h4,h5,h6, img, video, figure, table, li,main, nav, header, footer, aside, section[aria-label], form, [data-testid]',en=`[${j("root")}]`;function Ee(e=document.body){return[...e.querySelectorAll(Gt)].filter(t=>!t.closest(en)&&pe(t))}function tn(e,t){const n=e.ownerDocument??document,r=n.createElement("button");r.type="button",r.className="snag-cursor-proxy",r.setAttribute("aria-label",f("cursor.proxy")),r.style.cssText="position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;pointer-events:none",e.appendChild(r);let a=[],o=-1,s=null,i=null;const l=()=>i??a[o]??null;function h(c){const w=Ae(c),p=M(c),x=i?0:o+1;t.announce(i||!p?f("cursor.here",{role:w??c.tagName.toLowerCase(),name:p??""}):f("cursor.at",{role:w??c.tagName.toLowerCase(),name:p,i:x,n:a.length}))}function u(c){c&&(t.show(c),c.scrollIntoView({block:"nearest",behavior:"auto"}),h(c))}function b(c){i=null,a.length!==0&&(o=o<0?c===1?0:a.length-1:(o+c+a.length)%a.length,u(a[o]))}function g(c){const w=l();if(!w)return;const p=c==="out"?we(w):ye(w);if(!p)return;const x=a.indexOf(p);x>=0?(i=null,o=x):i=p,u(p)}return r.addEventListener("keydown",c=>{if(!(c.metaKey||c.ctrlKey||c.altKey))switch(c.key){case"Tab":case"ArrowDown":case"ArrowRight":c.preventDefault(),b(c.key==="Tab"&&c.shiftKey?-1:1);return;case"ArrowUp":case"ArrowLeft":c.preventDefault(),b(-1);return;case"[":c.preventDefault(),g("out");return;case"]":c.preventDefault(),g("in");return;case"Enter":case" ":{const w=l();if(!w)return;c.preventDefault();const p=w.getBoundingClientRect();t.pick(w,{x:p.left+p.width/2,y:p.top+p.height/2});return}}}),{engage(){a=Ee(n.body),o=-1,i=null,s=e.activeElement??n.activeElement,r.focus({preventScroll:!0})},release(){i=null,e.activeElement===r&&s?.focus?.(),s=null},destroy(){r.remove()}}}const m=Object.fromEntries(Object.keys(d).map(e=>[e,He(e)])),nn=Object.entries(ue).map(([e,t])=>` ${d[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
4
+ `);`${m.font}${m.fg}${d.font}${d.accent}${d.bg}${d.fg}${d.muted}${d.border}${d.radius}${d.shadow}${d.z}${d.motion}${d.surface}${m.fg}${m.bg}${d.sunken}${m.fg}${m.bg}${d.hover}${m.fg}${m.bg}${d.onAccent}${d.focus}${m.accent}${m.fg}${d.disabled}${m.muted}${m.bg}${nn}${d.anchorOrphan}${Fe}${d.accent}${d.onAccent}${d.bg}${d.fg}${d.muted}${d.border}${d.shadow}${d.motion}${d.bg}${d.fg}${d.muted}${d.border}${d.accent}${d.onAccent}${d.surface}${d.sunken}${d.hover}${d.focus}${d.disabled}${d.shadow}${d.anchorOrphan}`;const Se={highlight:2,chip:4},_e=new WeakMap;function rn(e,t,n){let r=_e.get(e);if(r||_e.set(e,r=new Set),r.has(t))return;r.add(t);try{const s=new CSSStyleSheet;s.replaceSync(n),e.adoptedStyleSheets=[...e.adoptedStyleSheets,s];return}catch{}const o=(e.ownerDocument??document).createElement("style");o.setAttribute(`data-snag-${t}`,""),o.textContent=n,e.appendChild(o)}const an=` .snag-hl-layer{position:fixed;inset:0;pointer-events:none;z-index:${Se.highlight};contain:layout style;overflow:hidden}.snag-hl{position:absolute;box-sizing:border-box;border:2px solid ${m.accent};border-radius:3px;background:color-mix(in srgb,${m.accent} 12%,transparent);box-shadow:0 0 0 100vmax color-mix(in srgb,#000 4%,transparent);transition:top ${m.motion},left ${m.motion},width ${m.motion},height ${m.motion}}.snag-hl-chip{position:absolute;background:${m.accent};color:${m.onAccent};font:600 11px/1.5 ${m.font};padding:2px 7px;border-radius:4px;white-space:nowrap;max-width:min(48ch,90vw);overflow:hidden;text-overflow:ellipsis}.snag-hint{position:fixed;top:calc(12px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:${Se.chip};pointer-events:none;background:${m.bg};color:${m.fg};border:1px solid ${m.border};box-shadow:${m.shadow};border-radius:999px;padding:7px 14px;font:500 12px/1 ${m.font};white-space:nowrap;max-width:calc(100vw - 24px);overflow:hidden;text-overflow:ellipsis}`;function on(e,t,n){const r=e.ownerDocument??document;rn(e,"highlight",an);const a=r.createElement("div");a.className="snag-hl-layer",a.hidden=!0;const o=r.createElement("div");o.className="snag-hl";const s=r.createElement("div");s.className="snag-hl-chip",a.append(o,s);const i=r.createElement("div");i.className="snag-hint",i.setAttribute("role","status"),i.hidden=!0,i.textContent=f(t?"hint.coarse":"hint.fine");let l;function h(g){const c=L(g);if(c.width<=0&&c.height<=0)return u();a.hidden=!1,o.style.left=`${c.left}px`,o.style.top=`${c.top}px`,o.style.width=`${c.width}px`,o.style.height=`${c.height}px`;const w=M(g),p=g.tagName.toLowerCase(),x=Math.round(c.width),W=Math.round(c.height);s.textContent=w?f("highlight.chip",{tag:p,name:w,w:x,h:W}):f("highlight.chip.unnamed",{tag:p,w:x,h:W});const Le=c.top>=22;s.style.top=Le?`${c.top-20}px`:`${c.bottom+4}px`,s.style.left=`${Math.max(2,c.left)}px`,t&&(clearTimeout(l),l=setTimeout(u,400))}function u(){a.hidden=!0}let b=null;return{show:h,clear:u,setActive(g){n&&(b??=tn(e,{...n,show:h}),g?b.engage():b.release()),g||u(),g?e.append(a,i):(a.remove(),i.remove()),i.hidden=!g},destroy(){clearTimeout(l),b?.destroy(),a.remove(),i.remove()}}}const sn=new Set(["role","name","aria-label","rel","href"]);function cn(e,t){let n=sn.has(e);n||=e.startsWith("data-")&&_(e);let r=_(t)&&t.length<100;return r||=t.startsWith("#")&&_(t.slice(1)),n&&r}function ln(e){return _(e)}function dn(e){return _(e)}function un(e){return!0}function ke(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return"html";const n={root:document.body,idName:ln,className:dn,tagName:un,attr:cn,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,a={...n,...t},o=pn(a.root,n);let s,i=0;for(const h of hn(e,a,o)){if(new Date().getTime()-r.getTime()>a.timeoutMs||i>=a.maxNumberOfPathChecks){const b=mn(e,o);if(!b)throw new Error(`Timeout: Can't find a unique selector after ${a.timeoutMs}ms`);return k(b)}if(i++,I(h,o)){s=h;break}}if(!s)throw new Error("Selector was not found.");const l=[...Ne(s,e,a,o,r)];return l.sort(Z),l.length>0?k(l[0]):k(s)}function*hn(e,t,n){const r=[];let a=[],o=e,s=0;for(;o&&o!==n;){const i=fn(o,t);for(const l of i)l.level=s;if(r.push(i),o=o.parentElement,s++,a.push(...ze(r)),s>=t.seedMinLength){a.sort(Z);for(const l of a)yield l;a=[]}}a.sort(Z);for(const i of a)yield i}function _(e){if(/^[a-z\-]{3,}$/i.test(e)){const t=e.split(/-|[A-Z]/);for(const n of t)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return!1;return!0}return!1}function fn(e,t){const n=[],r=e.getAttribute("id");r&&t.idName(r)&&n.push({name:"#"+CSS.escape(r),penalty:0});for(let s=0;s<e.classList.length;s++){const i=e.classList[s];t.className(i)&&n.push({name:"."+CSS.escape(i),penalty:1})}for(let s=0;s<e.attributes.length;s++){const i=e.attributes[s];t.attr(i.name,i.value)&&n.push({name:`[${CSS.escape(i.name)}="${CSS.escape(i.value)}"]`,penalty:2})}const a=e.tagName.toLowerCase();if(t.tagName(a)){n.push({name:a,penalty:5});const s=P(e,a);s!==void 0&&n.push({name:Ce(a,s),penalty:10})}const o=P(e);return o!==void 0&&n.push({name:gn(a,o),penalty:50}),n}function k(e){let t=e[0],n=t.name;for(let r=1;r<e.length;r++){const a=e[r].level||0;t.level===a-1?n=`${e[r].name} > ${n}`:n=`${e[r].name} ${n}`,t=e[r]}return n}function Te(e){return e.map(t=>t.penalty).reduce((t,n)=>t+n,0)}function Z(e,t){return Te(e)-Te(t)}function P(e,t){const n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let a=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&a++,r!==e);)r=r.nextSibling;return a}function mn(e,t){let n=0,r=e;const a=[];for(;r&&r!==t;){const o=r.tagName.toLowerCase(),s=P(r,o);if(s===void 0)return;a.push({name:Ce(o,s),penalty:NaN,level:n}),r=r.parentElement,n++}if(I(a,t))return a}function gn(e,t){return e==="html"?"html":`${e}:nth-child(${t})`}function Ce(e,t){return e==="html"?"html":`${e}:nth-of-type(${t})`}function*ze(e,t=[]){if(e.length>0)for(let n of e[0])yield*ze(e.slice(1,e.length),t.concat(n));else yield t}function pn(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function I(e,t){const n=k(e);switch(t.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return!0;default:return!1}}function*Ne(e,t,n,r,a){if(e.length>2&&e.length>n.optimizedMinLength)for(let o=1;o<e.length-1;o++){if(new Date().getTime()-a.getTime()>n.timeoutMs)return;const i=[...e];i.splice(o,1),I(i,r)&&r.querySelector(k(i))===t&&(yield i,yield*Ne(i,t,n,r,a))}}const bn=A("anchor").replace(/anchor$/,""),wn=[A("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],Re=new Set([...wn,"name","aria-label","role","type","itemprop"]),yn=new Set(["name","type","role","aria-label","itemprop","href","alt","lang"]),xn=[/^class$|^style$/,/^data-v-/,/^_ngcontent-|^_nghost-|^ng-version$|^ng-reflect-/,/^data-reactid$|^data-react-checksum$|^data-react-helmet$/,/^data-radix-|^data-headlessui-|^data-floating-ui-|^data-state$|^data-side$/,/^data-svelte-h$|^data-astro-|^data-styled|^data-emotion$/],$n=[/^[0-9a-f]{8}-[0-9a-f]{4}-/i,/^[0-9a-f]{16,}$/i,/^:r[0-9a-z]+:$/,/^«r[0-9a-z]+»$/,/^\d{4,}$/,/^(ember|mui|mat|cdk|headlessui|radix|reach)-?\d/i,/^(ember|mui|mat|cdk|headlessui|radix|reach)(-?[a-z]+)*-?\d+$/i];function An(e){return e.startsWith(bn)&&e!==A("anchor")||e.startsWith("aria-")&&e!=="aria-label"||xn.some(t=>t.test(e))?!1:Re.has(e)||yn.has(e)}function vn(e,t){return!t||t.length>120||e==="href"&&(t.includes("?")||/^[a-z]+:\/\//i.test(t))?!0:$n.some(n=>n.test(t))}const N=(e,t)=>!vn(e,t)&&!O(t);function U(e){return N("id",e)&&/^[a-zA-Z0-9_-]+$/.test(e)}const En=e=>`"${e.replace(/([\\"])/g,"\\$1")}"`,Oe=e=>e.replace(/"[^"]*"|'[^']*'|#([A-Za-z_-][\w-]*)/g,(t,n)=>n?`[id=${En(n)}]`:t);function De(e,t,n){try{return n.querySelectorAll(e).length===1&&n.querySelector(e)===t}catch{return!1}}function B(e,t=document.body){const n={root:t,tagName:()=>!0,idName:U,seedMinLength:2,optimizedMinLength:2};try{const r=ke(e,{...n,timeoutMs:150,className:()=>!1,attr:(o,s)=>Re.has(o)&&N(o,s)}),a=Oe(r);if(De(a,e,t))return a}catch{}try{const r=ke(e,{...n,timeoutMs:300,className:Sn,attr:(o,s)=>An(o)&&N(o,s)}),a=Oe(r);return De(a,e,t)?a:void 0}catch{return}}function Sn(e){return!(!e||e.length>60||/^[a-z-]*\d/.test(e)||/[:[\]/]/.test(e)||/_[A-Za-z0-9]{5,}$/.test(e)||/^[a-z]+-[0-9a-f]{6,}$/i.test(e))}function _n(e){const t=[];let n=e;for(let r=0;n&&n.nodeType===1&&r<40;r++){const a=n.tagName.toLowerCase();let o=1,s=!1;for(let i=n.previousElementSibling;i;i=i.previousElementSibling)i.tagName===n.tagName&&o++;for(let i=n.nextElementSibling;!s&&i;i=i.nextElementSibling)i.tagName===n.tagName&&(s=!0);t.unshift(o>1||s?`${a}[${o}]`:a),n=n.parentElement}return`/${t.join("/")}`}function kn(e){const t=$e(e),n={},r=It(e);if(r.length){const o=r.map(s=>B(s)).filter(s=>!!s);o.length&&(n.hostPath=o)}const a=B(t);a&&(n.css=a),t.id&&U(t.id)&&(n.domid=t.id);try{n.xpath=_n(t)}catch{}return n}export{Je as applyShotOutcome,Nt as buildExport,Ee as candidates,$t as captureContext,v as captureReport,on as createAddChrome,Jt as createElementAnchor,Dt as deleteBlob,de as deriveAnchorLabel,yt as derivePageRef,_t as deriveQuoteLabel,kn as describeElement,Rt as download,B as generateCss,ge as getBlob,Pt as importArchive,O as isSensitiveValue,U as isStableId,N as isUsableAttrValue,ye as narrow,me as putBlob,E as redactText,ne as redactUrl,Zt as resolveAttachmentUris,we as widen};