@snagset/server 0.1.20 → 0.1.22

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.
Files changed (77) hide show
  1. package/dist/app.js +10 -2
  2. package/dist/app.js.map +1 -1
  3. package/dist/instance/region.js +78 -0
  4. package/dist/instance/region.js.map +1 -0
  5. package/dist/routes/cors.js +5 -1
  6. package/dist/routes/cors.js.map +1 -1
  7. package/dist/routes/owner.js +61 -40
  8. package/dist/routes/owner.js.map +1 -1
  9. package/dist/routes/threads.js +23 -12
  10. package/dist/routes/threads.js.map +1 -1
  11. package/dist/routes/widget.js +8 -2
  12. package/dist/routes/widget.js.map +1 -1
  13. package/package.json +1 -1
  14. package/static/dashboard/assets/{CompositeItem-DFk-PY9L.js → CompositeItem-DYE4B5ie.js} +1 -1
  15. package/static/dashboard/assets/{ConfirmDialog-COCFkJPd.js → ConfirmDialog-DPSRr1Tb.js} +1 -1
  16. package/static/dashboard/assets/{CopyButton-BSZUdGOe.js → CopyButton-Dq8Se8Kg.js} +1 -1
  17. package/static/dashboard/assets/{FieldItemContext-B1tO9RIm.js → FieldItemContext-Cycc3Rw9.js} +1 -1
  18. package/static/dashboard/assets/{InstallTag-C-bSYUSW.js → InstallTag-CaP_CQOx.js} +1 -1
  19. package/static/dashboard/assets/{SaveState-9-TiAnKs.js → SaveState-DXTIcqJC.js} +1 -1
  20. package/static/dashboard/assets/{_app-dK3H_NFl.js → _app-JGBrws2g.js} +1 -1
  21. package/static/dashboard/assets/{_app-B6Dr81cl.js → _app-mxIRCNh9.js} +2 -2
  22. package/static/dashboard/assets/activity-_UjZ67D7.js +1 -0
  23. package/static/dashboard/assets/{arrow-left-et5uGMTY.js → arrow-left-D4fa3GwW.js} +1 -1
  24. package/static/dashboard/assets/{avatar-BYKf3ktl.js → avatar-Cat2daxa.js} +1 -1
  25. package/static/dashboard/assets/{badge-DRNYZLcD.js → badge-BZyZu9Jq.js} +1 -1
  26. package/static/dashboard/assets/{card-DktMrBl6.js → card-CP8kl9Er.js} +1 -1
  27. package/static/dashboard/assets/{check-BeXhTRNQ.js → check-c3QcseGY.js} +1 -1
  28. package/static/dashboard/assets/{chevron-right-BoL12ADN.js → chevron-right-QCzavn7R.js} +1 -1
  29. package/static/dashboard/assets/{copy-0Bxto2zb.js → copy-Cz7bbj9i.js} +1 -1
  30. package/static/dashboard/assets/{dialog-CNPOwLFE.js → dialog-Co13w87g.js} +2 -2
  31. package/static/dashboard/assets/{dropdown-menu-QyfFmK0B.js → dropdown-menu-DZF40OGy.js} +1 -1
  32. package/static/dashboard/assets/{image-off-1l9j0o-Y.js → image-off-DQRteqKJ.js} +1 -1
  33. package/static/dashboard/assets/{index-C9T0i6pH.js → index-C7DSx6Sq.js} +17 -17
  34. package/static/dashboard/assets/{invite-B3ovcCvz.js → invite-DK8BFo_c.js} +1 -1
  35. package/static/dashboard/assets/{label-CgEiXFTT.js → label-DIqFFeu7.js} +1 -1
  36. package/static/dashboard/assets/{layout-grid-CFk40Q2_.js → layout-grid-DQkpZWXb.js} +1 -1
  37. package/static/dashboard/assets/me-O_b4NSqM.js +1 -0
  38. package/static/dashboard/assets/{parts-BGzYN_gW.js → parts-D6YhZQkR.js} +1 -1
  39. package/static/dashboard/assets/{plus-D5bA9-ud.js → plus-B53oe0mC.js} +1 -1
  40. package/static/dashboard/assets/s._site-CBXNZf6x.js +1 -0
  41. package/static/dashboard/assets/{s._site.comments-DPD4knbJ.js → s._site.comments-BifYLuF1.js} +13 -13
  42. package/static/dashboard/assets/s._site.reviewers-iNi9zWp4.js +1 -0
  43. package/static/dashboard/assets/{s._site.settings-S8ZkUOGQ.js → s._site.settings-BjkdQsXe.js} +1 -1
  44. package/static/dashboard/assets/{setup-ytPE-o-a.js → setup-CQ5WdHwH.js} +1 -1
  45. package/static/dashboard/assets/{sign-in-CApTsuZI.js → sign-in-DjePsY6S.js} +1 -1
  46. package/static/dashboard/assets/{sign-up-DV3c0gT-.js → sign-up-CLeZIFgM.js} +1 -1
  47. package/static/dashboard/assets/{sites-DpoUZ8eC.js → sites-7b8V0YiH.js} +1 -1
  48. package/static/dashboard/assets/studio-CC2IHhpE.js +1 -0
  49. package/static/dashboard/assets/{studio-Cd2-mZl3.js → studio-CLhtJ_jG.js} +1 -1
  50. package/static/dashboard/assets/{studio.index-CdwWnkIX.js → studio.index-DLKZ77jA.js} +1 -1
  51. package/static/dashboard/assets/studio.integrations-gZFE71OD.js +1 -0
  52. package/static/dashboard/assets/{studio.members-DwvB-uiz.js → studio.members-Cq7DLLom.js} +2 -2
  53. package/static/dashboard/assets/{sun-DYPmuuya.js → sun-Ozkb0b11.js} +1 -1
  54. package/static/dashboard/assets/{switch-C4MjDp48.js → switch-CeFR9G4m.js} +1 -1
  55. package/static/dashboard/assets/{table-CoSJYMlW.js → table-BTQlEmr9.js} +1 -1
  56. package/static/dashboard/assets/{useAriaLabelledBy-CVMe8zQw.js → useAriaLabelledBy-B3Uz7OxG.js} +1 -1
  57. package/static/dashboard/assets/{useBaseQuery-BNAoRl4M.js → useBaseQuery-BOxBxtrs.js} +1 -1
  58. package/static/dashboard/assets/useQuery-C4DAYIse.js +1 -0
  59. package/static/dashboard/assets/useRender-BSEN3cz1.js +1 -0
  60. package/static/dashboard/assets/{useValueChanged-BzSqaaKy.js → useValueChanged-DuDldoH9.js} +1 -1
  61. package/static/dashboard/assets/{users-CxehfZhl.js → users-BQitcseY.js} +1 -1
  62. package/static/dashboard/assets/welcome-BMb9diyE.js +11 -0
  63. package/static/dashboard/assets/{widget-signin-BaYrguyh.js → widget-signin-Bu_gkSNQ.js} +1 -1
  64. package/static/dashboard/assets/{you-CYkvyH8i.js → you-DjZsBSqu.js} +1 -1
  65. package/static/dashboard/assets/{zod-CYYNMx2f.js → zod-DB58sa1C.js} +1 -1
  66. package/static/dashboard/index.html +1 -1
  67. package/static/widget/snag.dock.js +5 -5
  68. package/static/widget/snag.runtime.js +2 -2
  69. package/static/dashboard/assets/activity-B-4_ONuX.js +0 -1
  70. package/static/dashboard/assets/me-DnFJ72fX.js +0 -1
  71. package/static/dashboard/assets/s._site-BU8qgyq7.js +0 -1
  72. package/static/dashboard/assets/s._site.reviewers-cXimPkop.js +0 -1
  73. package/static/dashboard/assets/studio-CFiRRKhi.js +0 -1
  74. package/static/dashboard/assets/studio.integrations-Bwi2ns8H.js +0 -1
  75. package/static/dashboard/assets/useQuery-D4G3Az8s.js +0 -1
  76. package/static/dashboard/assets/useRender-BIly5s7F.js +0 -1
  77. package/static/dashboard/assets/welcome-B0Xqk_GB.js +0 -11
@@ -1,2 +1,2 @@
1
- const ve="Snagset",Co="snagset",gn="snagset.v1",To="Snagset",zt="Snag",Ro="Snags",_o={config:"SnagsetConfig"},Io={root:"data-snag-root"},Ot=e=>Io[e],Po={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},Mo=e=>Po[e],M={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"},zo=e=>`var(${M[e]})`,Oo=e=>"snag_"+e,wt={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},Do="snag:disclosure:v1",Dt="snag:identity",yn="data-snag-theme",ce={session:e=>`snag:session:${e}`,silent:e=>`snag:silent:${e}`,identity:Dt,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:Do},Ie={panels:"snag.panels.js",crumbs:"snag.crumbs.js",capture:"snag.capture.js",screenshot:"snag.screenshot.js",anchorExt:"snag.anchor-ext.js",anchorFuzzy:"snag.anchor-fuzzy.js",dock:"snag.dock.js",text:"snag.text.js"},xt={thread:"thr_",comment:"cmt_",attachment:"att_"},Lt={attachmentKind:"x-snagset-attachment-kind",attachmentWidth:"x-snagset-attachment-width",attachmentHeight:"x-snagset-attachment-height"},Lo={route:"snagset:route"},bn={original:"snagset.original",wrapped:"snagset.wrapped"},vn="position:absolute!important;top:0!important;left:0!important;width:0!important;height:0!important;margin:0!important;padding:0!important;border:0!important;pointer-events:none!important;z-index:2147483647;isolation:isolate;color-scheme:light dark;";function wn(e){const t=e.ownerDocument.defaultView?.getComputedStyle(e);return t?t.transform!=="none"&&t.transform!==""||t.filter!=="none"&&t.filter!==""||t.perspective!=="none"&&t.perspective!==""||/transform|filter|perspective|contain/.test(t.willChange)||/paint|layout|strict|content/.test(t.contain)||t.containerType!==void 0&&t.containerType!=="normal"&&t.containerType!=="":!1}function Nt(e){const t=e.documentElement,n=e.body;return t&&wn(t)?{parent:n??t,trapped:!0}:n&&wn(n)?{parent:t??n,trapped:!1}:{parent:n??t,trapped:!1}}function xn(e=document){const t=Ot("root"),n=e.querySelector(`[${t}]`);if(n?.shadowRoot)return n.shadowRoot;const o=e.createElement("div");return o.setAttribute(t,""),o.style.cssText=vn,Nt(e).parent.appendChild(o),o.attachShadow({mode:"open"})}function No(e,t,n=5){const o=e.ownerDocument??document,r=e.host,l=Nt(o).parent;if(typeof MutationObserver!="function"||!l)return()=>{};let u=0;const a=new MutationObserver(()=>{if(!r.isConnected){if(u++,u>n){a.disconnect(),t(u);return}Nt(o).parent.appendChild(r)}});return a.observe(l,{childList:!0}),()=>a.disconnect()}const Sn=[["pointerdown",!0],["mousedown",!0],["touchstart",!0],["pointerup",!0],["mouseup",!0],["touchend",!0],["click",!0],["dblclick",!0],["focusin",!0],["focusout",!0]];function Ho(e){const t=e.host,n=o=>o.stopPropagation();for(const[o,r]of Sn)t.addEventListener(o,n,{passive:r});return()=>{for(const[o]of Sn)t.removeEventListener(o,n)}}function Wo(e,t,n=20){const o=e.host;if(typeof MutationObserver!="function")return()=>{};let r=0;const l=()=>{let a=!1;return o.getAttribute("aria-hidden")==="true"&&(o.removeAttribute("aria-hidden"),a=!0),o.hasAttribute("inert")&&(o.removeAttribute("inert"),a=!0),a},u=new MutationObserver(()=>{l()&&++r>n&&(u.disconnect(),t(r))});return l(),u.observe(o,{attributes:!0,attributeFilter:["aria-hidden","inert"]}),()=>u.disconnect()}const Uo={product:ve,set:To,item:zt,items:Ro};function An(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(o,r)=>{const l=n?.[r]??Uo[r];return l===void 0?o:String(l)})}const jo=e=>new Intl.NumberFormat().format(e),kn={"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}"},$n=An(kn),En={open:{colour:"#4f6ef7"},progress:{colour:"#f59e0b"},review:{colour:"#8b5cf6"},resolved:{colour:"#10b981"}},Cn=e=>e==="open"||e==="review"?"#fff":"#16161a",Tn=e=>e in En?$n(`status.${e}`):e,Fo=e=>$n(`where.${e.anchorState}`,{label:e.anchor.label});class Ht extends Error{code;constructor(t,n){super(n??t),this.name="AdapterError",this.code=t}}function Rn(e){return{id:e.id,key:e.key,route:e.route,...e.scope?{scope:e.scope}:{},...e.attachments?.length?{attachments:e.attachments}:{},anchor:e.anchor,anchorState:e.anchorState,context:e.context,status:"open",comments:e.comment?[{id:e.comment.id,snagId:e.id,body:e.comment.body,author:e.comment.author,createdAt:e.createdAt}]:[],createdBy:e.createdBy,createdAt:e.createdAt,updatedAt:e.createdAt}}const A=Object.fromEntries(Object.keys(M).map(e=>[e,zo(e)])),Bo=Object.entries(En).map(([e,t])=>` ${M[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
2
- `),Zo=` :host{all:initial}[hidden]{display:none!important}:host{display:block;font:400 14px/1.45 ${A.font};color:${A.fg};${M.font}:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;${M.accent}:#2a51b8;${M.bg}:#fefdfc;${M.fg}:#181716;${M.muted}:#666564;${M.border}:#e4e3e0;${M.radius}:8px;${M.shadow}:0 6px 24px -4px rgb(0 0 0 / .18);${M.z}:2147483647;${M.motion}:160ms;${M.surface}:color-mix(in srgb,${A.fg} 6%,${A.bg});${M.sunken}:color-mix(in srgb,${A.fg} 3%,${A.bg});${M.hover}:color-mix(in srgb,${A.fg} 8%,${A.bg});${M.onAccent}:#fff;${M.focus}:color-mix(in srgb,${A.accent} 62%,${A.fg});${M.disabled}:color-mix(in srgb,${A.muted} 52%,${A.bg});${Bo} ${M.anchorOrphan}:#DC2626;}:host([${yn}="dark"]){${M.accent}:#8aafff;${M.onAccent}:#1d1c1a;${M.bg}:#1d1c1a;${M.fg}:#f0eeec;${M.muted}:#9a9997;${M.border}:#2d2c2b;${M.shadow}:0 6px 24px -4px rgb(0 0 0 / .6);}@media (prefers-reduced-motion:reduce){:host{${M.motion}:0ms}}@media (forced-colors:active){:host{${M.bg}:Canvas;${M.fg}:CanvasText;${M.muted}:CanvasText;${M.border}:CanvasText;${M.accent}:Highlight;${M.onAccent}:HighlightText;${M.surface}:Canvas;${M.sunken}:Canvas;${M.hover}:Canvas;${M.focus}:Highlight;${M.disabled}:GrayText;${M.shadow}:none;${M.anchorOrphan}:CanvasText;}.snag-pin{border-color:CanvasText!important;color:CanvasText!important;forced-color-adjust:none}}`,Ke={shield:1,pins:3,dock:5,notice:6,toolbar:7},_n=new WeakMap;function rt(e,t,n){let o=_n.get(e);if(o||_n.set(e,o=new Set),o.has(t))return;o.add(t);try{const u=new CSSStyleSheet;u.replaceSync(n),e.adoptedStyleSheets=[...e.adoptedStyleSheets,u];return}catch{}const l=(e.ownerDocument??document).createElement("style");l.setAttribute(`data-snag-${t}`,""),l.textContent=n,e.appendChild(l)}function Vo(e){return e==="light"||e==="dark"?e:"auto"}function Yo(e,t){const n=yn;if(t!=="auto")return e.setAttribute(n,t),()=>e.removeAttribute(n);const o=e.ownerDocument?.defaultView?.matchMedia?.("(prefers-color-scheme: dark)");if(!o)return e.setAttribute(n,"light"),()=>e.removeAttribute(n);const r=()=>e.setAttribute(n,o.matches?"dark":"light");return r(),o.addEventListener("change",r),()=>{o.removeEventListener("change",r),e.removeAttribute(n)}}function Wt(e){return e.getBoundingClientRect()}function St(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=Wt(e);if(!(n.width>0||n.height>0||e.getClientRects().length>0))return!1;const r=e.ownerDocument?.defaultView;return r?r.getComputedStyle(e).visibility!=="hidden":!0}const Xo="button,a[href],[role=button],[role=link],[role=tab],[role=menuitem],label,input,select,textarea,summary",Ko=3,In=8,Jo=new Set(["img","picture","canvas","video","audio","iframe","embed","object","svg","math","input","select","textarea","button","progress","meter"]);function qo(e,t){return Jo.has(e.tagName.toLowerCase())?!1:t.getComputedStyle(e).display==="inline"}function Pn(e){const t=e.ownerDocument?.defaultView;if(!t)return e;let n=e;for(let r=e;r;r=r.parentElement){const l=Wt(r);if(l.width>=In&&l.height>=In&&!qo(r,t)){n=r;break}n=r}let o=0;for(let r=n;r&&o<=Ko;r=r.parentElement){if(r.matches(Xo))return r;o++}return n}const Qo=10,Ut=[["click",!1],["auxclick",!1],["dblclick",!1],["pointerdown",!1],["pointerup",!1],["mousedown",!1],["mouseup",!1],["contextmenu",!1],["dragstart",!1],["wheel",!1],["touchstart",!0],["touchmove",!0],["touchend",!0],["selectstart",!0],["keydown",!1],["keyup",!1]];function Go(e,t,n){let o=e;for(;o&&o!==o.ownerDocument.documentElement&&o!==o.ownerDocument.body;){const r=getComputedStyle(o),l=(r.overflowY==="auto"||r.overflowY==="scroll")&&o.scrollHeight>o.clientHeight&&(t>0&&o.scrollTop+o.clientHeight<o.scrollHeight-1||t<0&&o.scrollTop>0),u=(r.overflowX==="auto"||r.overflowX==="scroll")&&o.scrollWidth>o.clientWidth&&(n>0&&o.scrollLeft+o.clientWidth<o.scrollWidth-1||n<0&&o.scrollLeft>0);if(l||u)return o;o=o.parentElement}return null}function Mn(e,t){const n=t==="y"?e.deltaY:e.deltaX;return e.deltaMode===1?n*16:e.deltaMode===2?n*(t==="y"?innerHeight:innerWidth):n}const er=["position:fixed","inset:0",`z-index:${Ke.shield}`,"touch-action:pan-x pan-y pinch-zoom","background:transparent"].join(";");function tr(e,t={}){const n=t.doc??e.ownerDocument??document,o=n.defaultView??window;let r=t.coarsePointer??o.matchMedia?.("(pointer: coarse)").matches??!1;const l=c=>{const T=c.pointerType,b=T==="touch"?!0:T==="mouse"||T==="pen"?!1:r;b!==r&&(r=b,d())},u=n.createElement("div");u.className="snag-shield",u.style.cssText=er;let a="browse";const d=()=>{u.style.pointerEvents=r?"none":"auto",u.style.cursor="crosshair"};d();const m=c=>{const T=c;return!T||typeof T.closest!="function"?!1:e.contains(T)?!0:!!T.closest(`[${Ot("root")}]`)};function w(c,T,b){let I=b,L=0;for(;I.shadowRoot&&L++<Qo;){const W=C(I.shadowRoot,c,T);if(!W||W===I)break;I=W}return I}function C(c,T,b){const I=c.elementsFromPoint;if(typeof I=="function"){for(const W of I.call(c,T,b))if(W.getRootNode()===c)return W;return null}const L=c.elementFromPoint(T,b);return L&&L.getRootNode()===c?L:null}function p(c,T){const b=[];for(const I of n.elementsFromPoint(c,T)){if(m(I))continue;if(I===n.documentElement||I===n.body){b.push(I);continue}const L=w(c,T,I);b.push(m(L)?I:L)}return b}let P=null;const F=(c,T)=>{const[b]=p(c,T);b&&t.onPick?.(Pn(b),{x:c,y:T})};let $=!1;const z=()=>{const c=n.getSelection?.();if(!c||c.isCollapsed||c.rangeCount===0||!c.toString().trim())return!1;const T=c.anchorNode;if(!T||e.contains(T))return!1;const b=T.nodeType===1?T:T.parentElement;return!m(b)},se=c=>{const T=c.composedPath()[0];if(T&&m(T)){$=!1;return}if(c.type==="selectstart"){t.onSelectStart?.();return}const b=c.type;if(b.endsWith("down")||b.endsWith("start")){$=!1;return}if(b.endsWith("up")||b.endsWith("end")){$=z();return}if(b==="click"||b==="auxclick"){if(!$)return;$=!1,c.preventDefault(),c.stopImmediatePropagation()}},q=c=>{if(c.type==="pointerdown"&&l(c),a==="comments"){se(c);return}if(a!=="add")return;if(c.type==="keydown"||c.type==="keyup"){g(c);return}const T=c.composedPath()[0];if(T&&T!==u&&m(T))return;const b=Ut.find(([I])=>I===c.type)?.[1]??!1;if(c.stopImmediatePropagation(),!b){if(r&&c.type==="pointerdown"){const I=c;P={x:I.clientX,y:I.clientY,t:performance.now()},D(I.clientX,I.clientY)}if(r&&c.type==="pointerup"&&P){const I=c,L=P;P=null,Math.hypot(I.clientX-L.x,I.clientY-L.y)<=8&&performance.now()-L.t<=700&&F(I.clientX,I.clientY);return}if(c.type==="click"||c.type==="auxclick"||c.type==="dblclick"){c.preventDefault();const I=c;F(I.clientX,I.clientY);return}if(c.type==="wheel"){const I=c,L=Mn(I,"y"),W=Mn(I,"x"),[X]=p(I.clientX,I.clientY),ae=Go(X??null,L,W);ae&&(ae.scrollTop+=L,ae.scrollLeft+=W,c.preventDefault());return}if(c.type==="dragstart"||c.type==="contextmenu"){c.preventDefault();return}(c.type==="pointerdown"||c.type==="mousedown")&&!r&&c.preventDefault()}},G=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," ","Spacebar","PageUp","PageDown","Home","End"]),J=/^[a-z0-9/?]$/;function h(c){for(const T of c.composedPath()){const b=T;if(!(!b||b.nodeType!==1||typeof b.matches!="function")&&b.matches('input:not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),textarea,select,[contenteditable=""],[contenteditable=true],[role=textbox],[role=searchbox],[role=combobox]'))return!0}return!1}function g(c){G.has(c.key)||c.metaKey||c.ctrlKey||c.altKey||/^F\d{1,2}$/.test(c.key)||c.key!=="Escape"&&c.key.length===1&&J.test(c.key.toLowerCase())&&!h(c)&&(c.preventDefault(),c.stopImmediatePropagation())}for(const[c,T]of Ut)o.addEventListener(c,q,{capture:!0,passive:T});let _=0,O=null;function Z(){if(_=0,a!=="add"||!O)return;const[c]=p(O.x,O.y);t.onHover?.(c?Pn(c):null)}function D(c,T){a==="add"&&(O={x:c,y:T},!_&&(_=o.requestAnimationFrame(Z)))}return u.addEventListener("pointermove",c=>D(c.clientX,c.clientY)),u.addEventListener("pointerleave",()=>{O=null,t.onHover?.(null)}),{shield:u,getMode:()=>a,setMode(c){a=c,$=!1,d(),c==="add"?e.appendChild(u):u.remove(),c!=="add"&&(O=null,t.onHover?.(null))},hitTest:p,destroy(){_&&o.cancelAnimationFrame(_);for(const[c]of Ut)o.removeEventListener(c,q,{capture:!0});u.remove()}}}const nr=/[\u200B-\u200D\u2060\uFEFF]/gu,or=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,rr=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function sr(e){let t=e.normalize("NFC").replace(nr,"");for(const[n,o]of rr)t=t.replace(n,o);return t.replace(or," ").trim()}const ar={testid:1,domid:1,css:.9,aria:.75,"text-exact":.8,"text-fuzzy":.78,"path-rect":.35,none:0,manual:1},zn={anchored:.75,approximate:.35};function ir(e,t){const n=ar[e];return t===1?n:n/(1+Math.log2(t))}function On(e){return e>=zn.anchored?"anchored":e>=zn.approximate?"approximate":"orphaned"}const cr=[Mo("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],Dn=e=>typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/["\\]/g,"\\$&"),lr=[{strategy:"testid",applicable:e=>!!e.testid,find:(e,t)=>jt(t,cr.map(n=>`[${n}="${Dn(e.testid)}"]`).join(","))},{strategy:"domid",applicable:e=>!!e.domid,find:(e,t)=>jt(t,`#${Dn(e.domid)}`)},{strategy:"css",applicable:e=>!!e.css,find:(e,t)=>{try{return jt(t,e.css)}catch{return[]}}}];function jt(e,t){return[...e.querySelectorAll(t)].filter(dr)}function dr(e){return!e.closest(`[${Ot("root")}]`)}function ur(e,t){const n=t.text?.exact;if(!n)return!0;const o=sr(e.textContent??"");return o?o===n||o.includes(n)||n.includes(o):!0}function Ln(e,t,n,o){St(e)||o.push("hidden"),t.hostPath?.length&&o.push("shadow-boundary");const r=!ur(e,t);r&&o.push("text-drift");let l=o.includes("hidden")?Math.min(n,.7):n;return r&&(l=Math.min(l,.5)),l}const fr={element:null,strategy:"none",score:0,state:"orphaned",reasons:["not-found"],candidates:0};function Ft(e,t=document,n={}){const o=[];for(const r of lr){if(!r.applicable(e))continue;const l=r.find(e,t);if(l.length===0)continue;const u=ir(r.strategy,l.length),a=l[0];l.length>1&&o.push("ambiguous");const d=Ln(a,e,u,o),m={element:a,strategy:r.strategy,score:d,state:On(d),reasons:o.length?o:["exact"],candidates:l.length};if(m.reasons.includes("text-drift")&&n.extended){const w=n.extended(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}});if(w&&w.score>m.score)return w}return m}return n.extended?.(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}})??fr}const hr={"toolbar.aria":"{product} review toolbar","toolbar.group":"What you see","toolbar.browse":"Browse","toolbar.comments":"Comment","toolbar.comments.unresolved":"Comment, {n} unresolved","toolbar.add":"Add a comment","toolbar.add.draft":"Add a comment \u2014 one is unfinished","toolbar.panel":"All comments","pin.aria":"Comment {key} on {target}. {status}, {replies} replies. Press Enter.","pin.aria.one":"Comment {key} on {target}. {status}, 1 reply. Press Enter.","pin.aria.none":"Comment {key} on {target}. {status}. Press Enter.","pin.aria.moved":"Comment {key} on {target}. {status}. {where}. Press Enter.","pin.target":"{role} \u201C{name}\u201D","cluster.aria":"{n} comments here: {list}","nav.announce":"Comment {n} on {label}, {i} of {total}","action.retry":"Retry","action.dismiss":"Dismiss","action.export":"Export","action.exportclear":"Export & clear","error.quota":"Storage is full \u2014 this {item} is on screen but not saved. Export to keep them.","error.nostorage":"Comments won't be saved in this browser. Export before you leave to keep them.","error.linkrevoked":"This review link was turned off. Ask whoever sent it for a new one.","error.sessionended":"This review session has ended. Open your review link again to carry on.","error.sendfailed":"That {item} couldn't be sent, so it wasn't kept. Check your connection and try again.","error.origin":"{product} is not enabled for {origin}. Add that address to the site's allowed origins.","error.panels":"{product} loaded, but its comment UI didn't. You can still see the comments on the page.","error.panels.add":"Adding comments is unavailable until the comment UI loads.","error.capture":"{product} can't take new comments \u2014 the part that records the page didn't load. Everything already here still works.","paused.dialog":"Review paused \u2014 a dialog is open on this page. Close it to carry on commenting. Commenting inside a native dialog isn't supported yet.","paused.close":"Close","announce.created":"Comment {key} added.","permalink.unknown":"That comment isn't on this page any more"},pr={...kn,...hr},V=An(pr);function mr(e,t){const n=new Array(e.length),o=[],r=new Map,l=[];let u=0;for(let a=0;a<e.length;a++){u++;const d=e[a],m=Math.floor(d.x/t),w=Math.floor(d.y/t);let C=-1;e:for(let p=-1;p<=1;p++)for(let P=-1;P<=1;P++)for(const F of r.get(`${m+p},${w+P}`)??[]){const $=l[F],z=d.x-$.x,se=d.y-$.y;if(z*z+se*se<=t*t){C=F;break e}}if(C===-1){C=o.length,o.push([]),l.push(d);const p=`${m},${w}`,P=r.get(p);P?P.push(C):r.set(p,[C])}n[a]=C,o[C].push(a)}return{group:n,members:o,visits:u}}const gr=`position:absolute;top:0;left:0;width:0;height:0;pointer-events:none;z-index:${Ke.pins}`,yr=' .snag-pp{animation:snag-pp .5s ease-out 2}@keyframes snag-pp{50%{transform:scale(1.45)}}@media (prefers-reduced-motion: reduce){.snag-pp{animation:none}}.snag-pin{width:28px;height:28px;margin:-14px 0 0 -14px}.snag-pin::after{content:"";position:absolute;inset:-8px}@media (pointer:coarse){.snag-pin{width:34px;height:34px;margin:-17px 0 0 -17px}}',br=`position:fixed;inset:0;width:0;height:0;pointer-events:none;z-index:${Ke.pins}`,st=["position:absolute",`color:${A.onAccent}`,`font:600 12px/1 ${A.font}`,"display:flex","align-items:center","justify-content:center","box-shadow:0 1px 4px rgb(0 0 0 / .35)","pointer-events:auto","cursor:pointer","box-sizing:border-box"].join(";"),At="border-radius:50% 50% 50% 2px",Nn=e=>A[`status${e[0].toUpperCase()}${e.slice(1)}`]??A.muted;function Hn(e,t){const n=Cn(t.status),o=`background:${Nn(t.status)};color:${n}`,r="0 1px 4px rgb(0 0 0 / .35)";return e==="anchored"?`${st};${At};${o};border:2px solid ${n};box-shadow:${r}`:e==="approximate"?`${st};${At};${o};border:2px dashed ${n};box-shadow:${r}`:`${st};${At};${o};border:2px solid ${n};box-shadow:inset 0 0 0 2px ${n},${r}`}function vr(e,t){const n=[];let o="static",r=!1;for(let l=e;l&&l!==e.ownerDocument.documentElement;l=l.parentElement){const u=t.getComputedStyle(l),a=l!==e.ownerDocument.body&&/auto|scroll|hidden|overlay/.test(u.overflowY+u.overflowX);a&&!r&&n.push(l),u.position==="fixed"?(o="dynamic",r=!0):u.transform!=="none"||u.filter!=="none"||u.perspective!=="none"?(o="dynamic",r=!1):(u.position==="sticky"||u.willChange.includes("transform")||u.contain.includes("layout")||a&&(l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth))&&(o="dynamic")}return{tier:o,clips:n}}function wr(e,t,n,o){const r=e.ownerDocument??document,l=r.defaultView??window;rt(e,"pins",yr);const u=r.createElement("div");u.className="snag-pins",u.style.cssText=gr,e.appendChild(u);const a=r.createElement("div");a.className="snag-pins-dyn",a.style.cssText=br,e.appendChild(a);let d=[],m=[];const w=new Map;let C=new Map,p=null;const P=new Map;let F=new Map;const $=l.matchMedia?.("(pointer: coarse)").matches??!1,z=$?32:24,se=$?34:28;let q=[],G=null,J=null,h={x:0,y:0};function g(){const S=r.defaultView,k=u.getBoundingClientRect();h={x:k.left+(S?.scrollX??0),y:k.top+(S?.scrollY??0)}}let _=[];const O=new Map,Z=1e4,D=5,c=new Map,T=new Set(["testid","domid"]);function b(S){const k=c.get(S.id),y=k?.ref.deref();if(!y||!y.isConnected)return null;if(T.has(k.strategy))return y;if(S.anchor.css)try{if(!y.matches(S.anchor.css))return null}catch{return null}return y}function I(S,k){const y=[],U=Ln(k,S.anchor,1,y);return{element:k,strategy:c.get(S.id).strategy,score:U,state:On(U),reasons:y.length?y:["exact"],candidates:1}}function L(S,k="authoritative"){w.clear(),_=[];const y=Date.now(),U=n?.newPass?.();return S.map(v=>{const N=b(v),E=n?.get();let x=N?I(v,N):Ft(v.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...E?{extended:E}:{},...U?{passCaches:U}:{}});if(N&&x.reasons.includes("text-drift")){const j=Ft(v.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...E?{extended:E}:{},...U?{passCaches:U}:{}});j.score>x.score&&(x=j)}if(n&&(!x.element||x.reasons.includes("text-drift"))&&n.want(v.anchor),!x.element&&n){const j=n.fuzzyHit?.(v.id);j?x=j:n.wantFuzzy?.(v.id,v.anchor)}const oe=x.element&&v.anchor.text?.exact&&(x.reasons.includes("text-drift")||x.strategy==="path-rect"&&x.score<.5);if(n&&oe){const j=n.fuzzyHit?.(v.id);j&&j.score>x.score?x=j:j||n.wantFuzzy?.(v.id,v.anchor)}x.element?c.set(v.id,{ref:new WeakRef(x.element),strategy:x.strategy}):c.delete(v.id),x.element&&w.set(v.id,x.element);let Q=!1;if(x.state==="orphaned"){const j=O.get(v.id)??{firstSeenAt:y,tries:0,best:x};j.tries++,x.score>=j.best.score&&(j.best=x),O.set(v.id,j);const ee=n?.unavailable?.()??!1,te=ee?2:D,de=y-j.firstSeenAt<Z;k==="optimistic"||de&&(k==="navigating"||j.tries<te)?Q=!0:(x=j.best,ee&&!x.reasons.includes("budget-exceeded")&&(x={...x,reasons:[...x.reasons,"budget-exceeded"]}),O.delete(v.id))}else O.delete(v.id);Q||_.push({id:v.id,state:x.state,strategy:x.strategy,confidence:x.score});const H=x.element?Wt(x.element):void 0;if(H&&(H.width>0||H.height>0)){const j=r.defaultView;v.anchor.rect={x:H.left+(j?.scrollX??0),y:H.top+(j?.scrollY??0),w:H.width,h:H.height}}return{...v,anchorState:Q?v.anchorState:x.state,anchorPending:Q,anchorReasons:x.reasons}})}function W(){const S=r.documentElement;return{w:S.scrollWidth,h:S.scrollHeight}}function X(S,k,y){return{x:Math.min(Math.max(S,14),Math.max(y.w,28)-14),y:Math.min(Math.max(k,14),Math.max(y.h,28)-14)}}function ae(S,k){g(),u.textContent="",a.textContent="",d=[],m=[],C=new Map,F=new Map,P.clear(),q=[],J=null,S.forEach((y,U)=>{const v=y.anchor.rect;if(!v)return;const N=y.anchor.offset??{fx:.5,fy:.5},E=r.createElement("div");E.className="snag-pin",E.setAttribute("data-state",y.anchorPending?"pending":y.anchorState),E.setAttribute("data-key",y.key),E.style.cssText=y.anchorPending?`${Hn("approximate",y)};opacity:.55`:Hn(y.anchorState,y);const x=w.get(y.id),{tier:oe,clips:Q}=x?vr(x,l):{tier:"static",clips:[]};if(oe==="dynamic"&&x){const ne=x.getBoundingClientRect(),ye=Fe();E.style.left=`${ne.left-ye.left+ne.width*N.fx}px`,E.style.top=`${ne.top-ye.top+ne.height*N.fy}px`,P.set(E,{x:ne.left+ne.width*N.fx+l.scrollX-h.x,y:ne.top+ne.height*N.fy+l.scrollY-h.y});const De={node:E,el:x,fx:N.fx,fy:N.fy,clips:Q};d.push(De),E.hidden=!St(x),E.hidden||Be(De,ne,new Map(Q.map(ut=>[ut,ut.getBoundingClientRect()])))}else{const ne=X(v.x+v.w*N.fx-h.x,v.y+v.h*N.fy-h.y,W());E.style.left=`${ne.x}px`,E.style.top=`${ne.y}px`,P.set(E,ne),x&&(m.push({node:E,el:x,fx:N.fx,fy:N.fy,clips:[]}),E.hidden=!St(x))}E.textContent=String(U+1);const H=Fo(y),j=y.anchor.role?V("pin.target",{role:y.anchor.role,name:y.anchor.accessibleName??y.anchor.label}):y.anchor.label,ee=y.comments.length-1,te=y.anchorState==="approximate"?`~ ${y.key}`:y.key;E.setAttribute("role","button"),E.setAttribute("tabindex","0");const de=y.anchorState==="anchored"?V(ee===0?"pin.aria.none":ee===1?"pin.aria.one":"pin.aria",{key:te,target:j,status:Tn(y.status),replies:ee}):V("pin.aria.moved",{key:te,target:j,status:Tn(y.status),where:H});E.title=de,E.setAttribute("aria-label",de),t&&Se(E,()=>t(y)),k?.has(y.id)&&(E.hidden=!0,E.setAttribute("data-fo","")),C.set(y.id,E),F.set(E,{snag:y,ordinal:U+1}),(oe==="dynamic"?a:u).appendChild(E)}),qe(),p&&Ze(p),Oe(),le="",he(r.visibilityState==="visible"&&C.size>0)}const Fe=()=>a.getBoundingClientRect();let xe=!1;function Be(S,k,y){for(const U of S.clips){const v=y.get(U);if(v&&(k.right<=v.left||k.left>=v.right||k.bottom<=v.top||k.top>=v.bottom)){S.node.hidden=!0;return}}S.node.hidden=!1}function Ct(S){const k=new Map;for(const y of S)for(const U of y.clips)k.has(U)||k.set(U,U.getBoundingClientRect());return k}const Re=["open","progress","review","resolved"];function Se(S,k){S.addEventListener("click",k),S.addEventListener("keydown",y=>{y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),k())})}function ze(S,k,y,U,v){const N=Re.find(x=>S.some(oe=>oe.snag.status===x))??"open",E=r.createElement("div");E.className="snag-pin snag-cluster",E.style.cssText=`${st};border-radius:50%;background:${Nn(N)};color:${Cn(N)};border:2px solid ${A.onAccent}`,E.style.left=`${k}px`,E.style.top=`${y}px`,E.textContent=String(S.length),E.setAttribute("data-count",String(S.length)),E.setAttribute("data-state",N),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),v&&E.setAttribute("aria-expanded","true"),E.setAttribute("aria-label",V("cluster.aria",{n:S.length,list:S.map(x=>x.ordinal).join(", ")})),Se(E,()=>{if(v)G=null;else if(S.length<=6)G=U;else{o?.(S.map(x=>x.snag.id));return}qe()}),u.appendChild(E),q.push(E)}function fe(S,k,y,U){ze(S,k,y,U,!0),S.forEach((v,N)=>{const E=k,x=y+(N+1)*(se+12),oe=v.x-E,Q=v.y-x,H=Math.hypot(oe,Q);if(H>4){const ee=r.createElement("div");ee.className="snag-leader",ee.setAttribute("aria-hidden","true"),ee.style.cssText=`position:absolute;left:${E}px;top:${x}px;width:${H}px;height:0;border-top:1px solid ${A.onAccent};transform-origin:0 0;transform:rotate(${Math.atan2(Q,oe)}rad)`,u.appendChild(ee),q.push(ee)}const j=v.dot.cloneNode(!0);j.style.visibility="",j.style.left=`${E}px`,j.style.top=`${x}px`,Se(j,()=>t?.(v.snag)),u.appendChild(j),q.push(j)})}function qe(){for(const v of q)v.remove();q=[];const S=[];for(const[v,N]of F){if(v.hidden){v.style.visibility="";continue}const E=P.get(v);E&&S.push({dot:v,snag:N.snag,ordinal:N.ordinal,x:E.x,y:E.y})}const{members:k,visits:y}=mr(S,z);u.setAttribute("data-cv",String(y)),u.setAttribute("data-cp",String(S.length));let U=!1;for(const v of k){if(v.length<2){S[v[0]].dot.style.visibility="";continue}const N=v.map(Q=>S[Q]),E=N.map(Q=>Q.snag.id).sort().join("|");for(const Q of N)Q.dot.style.visibility="hidden";const x=N.reduce((Q,H)=>Q+H.x,0)/N.length,oe=N.reduce((Q,H)=>Q+H.y,0)/N.length;G===E&&N.length<=6?(U=!0,fe(N,x,oe,E)):ze(N,x,oe,E,!1)}G&&!U&&(G=null)}function Qe(S){J?.remove(),J=null;const k=S.anchor.rect;if(!k)return;const y=S.anchor.offset??{fx:.5,fy:.5},U=r.createElement("div");U.className="snag-pin snag-ghost",U.style.cssText=`${st};${At};background:transparent;border:2px dashed ${A.anchorOrphan};color:${A.anchorOrphan};box-shadow:none;pointer-events:none`;const v=X(k.x+k.w*y.fx-h.x,k.y+k.h*y.fy-h.y,W());U.style.left=`${v.x}px`,U.style.top=`${v.y}px`,U.setAttribute("aria-hidden","true"),u.appendChild(U),J=U}function Oe(S=!1){const k=S?[...d,...m]:d;xe||k.length===0||(xe=!0,l.requestAnimationFrame(()=>{xe=!1;const y=performance.now(),U=l.scrollX,v=l.scrollY,N=Fe(),E=k.map(H=>H.el.isConnected?H.el.getBoundingClientRect():null),x=k.map(H=>H.el.isConnected&&St(H.el)),oe=Ct(k),Q=W();k.forEach((H,j)=>{const ee=E[j];if(!ee)return;if(H.node.hasAttribute("data-fo")){H.node.hidden=!0;return}if(!x[j]){H.node.hidden=!0;return}H.node.hidden=!1;const te=ee.left+ee.width*H.fx,de=ee.top+ee.height*H.fy;if(H.node.parentElement===a)H.node.style.left=`${te-N.left}px`,H.node.style.top=`${de-N.top}px`,Be(H,ee,oe),P.set(H.node,{x:te+U-h.x,y:de+v-h.y});else{const ne=X(te+U-h.x,de+v-h.y,Q);H.node.style.left=`${ne.x}px`,H.node.style.top=`${ne.y}px`,P.set(H.node,ne)}}),qe(),u.setAttribute("data-ms",(performance.now()-y).toFixed(2))}))}const Ae=()=>Oe();r.addEventListener("scroll",Ae,{capture:!0,passive:!0});const lt=typeof l.ResizeObserver=="function"?new l.ResizeObserver(()=>Oe(!0)):null;lt?.observe(r.documentElement);let ke=null,le="";function Tt(){let S="";for(const k of[...m,...d]){if(!k.el.isConnected)continue;const y=k.el.getBoundingClientRect();S+=`${Math.round(y.left)},${Math.round(y.top)},${Math.round(y.width)};`}!S||S===le||(le=S,Oe(!0))}function he(S){if(ke&&clearTimeout(ke),ke=null,!S)return;const k=()=>{Tt(),ke=setTimeout(k,500)};ke=setTimeout(k,500)}const dt=()=>he(r.visibilityState==="visible"&&C.size>0);r.addEventListener("visibilitychange",dt);function ie(S){const k=C.get(S);k&&(k.classList.remove("snag-pp"),l.requestAnimationFrame(()=>k.classList.add("snag-pp")),l.setTimeout(()=>k.classList.remove("snag-pp"),1400))}function Ze(S){const k=p?C.get(p):void 0;k&&(k.style.transform="",k.style.zIndex=""),p=S;const y=S?C.get(S):void 0;y&&(y.style.transform="scale(1.4)",y.style.zIndex="1")}return{el:u,render:ae,showGhost:Qe,pulse:ie,reanchor:L,settled:()=>_,hasPending:()=>O.size>0,highlight:Ze,destroy(){r.removeEventListener("scroll",Ae,{capture:!0}),r.removeEventListener("visibilitychange",dt),lt?.disconnect(),he(!1),u.remove(),a.remove()}}}const xr=` .snag-notice{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(24px + var(${M.tbH},56px));z-index:${Ke.notice};max-width:min(420px,calc(100vw - 24px));background:${A.bg};color:${A.fg};border:1px solid ${A.border};border-inline-start:3px solid ${A.anchorOrphan};border-radius:${A.radius};box-shadow:${A.shadow};padding:12px 14px;pointer-events:auto;font:400 13px/1.45 ${A.font};display:flex;flex-direction:column;gap:10px}@media (pointer:coarse){.snag-notice{bottom:calc(12px + var(${M.tbH},64px))}}.snag-notice p{margin:0}.snag-notice-actions{display:flex;gap:6px;justify-content:flex-end}.snag-notice button{appearance:none;font:inherit;cursor:pointer;border-radius:calc(${A.radius} - 2px);padding:6px 12px;min-height:30px;border:0;transition:background ${A.motion}}.snag-notice-retry{background:${A.accent};color:${A.onAccent};font-weight:600}.snag-notice-dismiss{background:transparent;color:${A.muted}}.snag-notice-dismiss:hover{background:${A.hover};color:inherit}.snag-notice button:focus-visible{outline:2px solid ${A.focus};outline-offset:2px}`;function Sr(e,t){const n=e.ownerDocument??document,o=n.defaultView??window;rt(e,"notice",xr);const r=n.createElement("div");r.className="snag-notice",r.setAttribute("role","alert"),r.hidden=!0;const l=n.createElement("p"),u=n.createElement("div");u.className="snag-notice-actions";const a=n.createElement("button");a.type="button",a.className="snag-notice-dismiss",a.textContent=V("action.dismiss"),a.addEventListener("click",()=>C());const d=n.createElement("button");d.type="button",d.className="snag-notice-retry",u.append(a,d),r.append(l,u);let m;d.addEventListener("click",()=>{C(),m?.run()});let w=0;function C(){w&&o.cancelAnimationFrame(w),w=0,r.hidden=!0,r.remove()}return{show(p,P,F){m=P,d.hidden=!P,P&&(d.textContent=V(P.label)),r.hidden=!1,l.textContent="",(t??e).appendChild(r);const $=V(p,F);w&&o.cancelAnimationFrame(w),w=o.requestAnimationFrame(()=>{w=0,l.textContent=$})},hide:C,visible:()=>r.isConnected&&!r.hidden,destroy(){r.remove()}}}const Ar=` .snag-paused{border:0;padding:0;background:transparent;pointer-events:auto;max-width:min(420px,calc(100vw - 32px))}.snag-paused::backdrop{background:rgb(0 0 0 / .28)}.snag-paused-box{background:${A.bg};color:${A.fg};border:1px solid ${A.border};border-inline-start:3px solid ${A.accent};border-radius:${A.radius};box-shadow:${A.shadow};padding:14px 16px;font:400 13px/1.45 ${A.font};display:flex;flex-direction:column;gap:12px}.snag-paused p{margin:0}.snag-paused-actions{display:flex;justify-content:flex-end}.snag-paused button{appearance:none;font:inherit;cursor:pointer;border:0;font-weight:600;border-radius:calc(${A.radius} - 2px);padding:6px 14px;min-height:30px;background:${A.accent};color:${A.onAccent}}.snag-paused button:focus-visible{outline:2px solid ${A.focus};outline-offset:2px}`;function kr(e,t){const n=e.ownerDocument??document;rt(e,"paused",Ar);const o=n.createElement("dialog");o.className="snag-paused",o.setAttribute("aria-label",V("paused.dialog"));const r=n.createElement("div");r.className="snag-paused-box",r.setAttribute("role","status");const l=n.createElement("p");l.textContent=V("paused.dialog");const u=n.createElement("div");u.className="snag-paused-actions";const a=n.createElement("button");a.type="button",a.textContent=V("paused.close"),a.addEventListener("click",()=>w()),u.append(a),r.append(l,u),o.append(r);let d=!1;function m(){if(!d){(t??e).appendChild(o);try{o.showModal(),d=!0}catch{o.setAttribute("open",""),d=!0}}}function w(){if(d){d=!1;try{o.close()}catch{o.removeAttribute("open")}o.remove()}}return o.addEventListener("close",()=>{d=!1,o.remove()}),{show:m,hide:w,destroy(){w(),o.remove()}}}const $r=Symbol.for(bn.original),Wn=Symbol.for(bn.wrapped),at=()=>{};function Er(e,t,n){let o;try{o=e[t]}catch{return at}if(typeof o!="function"||o[Wn])return at;const r=o,l=n(r);let u=!1;const a=function(...d){return u?r.apply(this,d):l.apply(this,d)};try{const d=a;d[Wn]=!0,d[$r]=r,Object.defineProperty(a,"name",{value:r.name,configurable:!0}),Object.defineProperty(a,"length",{value:r.length,configurable:!0})}catch{}try{e[t]=a}catch{return at}return e[t]!==a?at:()=>{let d;try{d=e[t]}catch{d=void 0}if(d===a)try{e[t]=r;return}catch{}u=!0}}function Cr(e,t){const n=[];let o=0;const r=()=>{o||(o=e.requestAnimationFrame(()=>{o=0,t.onResize()}))};e.addEventListener("resize",r),n.push(()=>{o&&e.cancelAnimationFrame(o),e.removeEventListener("resize",r)}),e.visualViewport?.addEventListener("resize",r),n.push(()=>e.visualViewport?.removeEventListener("resize",r));const l=()=>void e.setTimeout(t.onResize,250);e.addEventListener("orientationchange",l),n.push(()=>e.removeEventListener("orientationchange",l));let u=e.location.pathname;const a=()=>{const z=e.location.pathname;z!==u&&(u=z,t.onRoute())},d=e.navigation;if(d){const z=()=>void e.setTimeout(a,0);d.addEventListener("navigatesuccess",z),n.push(()=>d.removeEventListener("navigatesuccess",z))}else for(const z of["pushState","replaceState"])n.push(Er(e.history,z,se=>function(...q){const G=se.apply(this,q);return e.setTimeout(a,0),G}));const m=e.document;let w=!0;try{m.documentElement.matches(":modal")}catch{w=!1}const C=()=>{const z=m.querySelectorAll("dialog[open]");if(!w)return z.length>0;for(const se of z)if(se.matches(":modal"))return!0;return!1};let p=!1;const P=()=>{const z=C();z!==p&&(p=z,t.onModal(z))};m.addEventListener("toggle",P,!0),n.push(()=>m.removeEventListener("toggle",P,!0));const F=new MutationObserver(P);F.observe(m.documentElement,{subtree:!0,attributes:!0,attributeFilter:["open"]}),n.push(()=>F.disconnect());const $=()=>void e.setTimeout(a,0);return e.addEventListener("popstate",$),n.push(()=>e.removeEventListener("popstate",$)),{destroy(){for(const z of n)z();n.length=0}}}function Tr(e,t){try{e.sessionStorage.setItem(ce.handoff,JSON.stringify({openThreadId:t}))}catch{}}function Rr(e){try{const t=e.sessionStorage.getItem(ce.handoff);if(t===null)return null;e.sessionStorage.removeItem(ce.handoff);const n=JSON.parse(t);return typeof n.openThreadId=="string"?n.openThreadId:null}catch{return null}}function _r(){return{statuses:[],read:"all",pageOnly:!1,newOnly:!1,sort:"page"}}const Ir=["open","progress","review","resolved"];function Pr(e,t,n){if(t.statuses.length>0&&Ir.includes(e.status)&&!t.statuses.includes(e.status)||t.by&&e.createdBy.id!==t.by||t.page&&e.route!==t.page)return!1;if(t.read!=="all"&&n){const o=Mr(e,n);if(t.read==="unread"&&!o||t.read==="read"&&o)return!1}return!0}function Mr(e,t){const n=t.get(e.id)??0;return Date.parse(e.updatedAt)>n}function zr(e,t,n){const o=e.visualViewport;let r=0;const l=()=>{if(r=0,!o)return;const a=o.offsetLeft,d=o.offsetTop;t.style.translate=a||d?`${a}px ${d}px`:"",t.style.width=`${o.width}px`,t.style.height=`${o.height}px`,n?.(o.scale)},u=()=>{r||(r=e.requestAnimationFrame(l))};return o?.addEventListener("resize",u,{passive:!0}),o?.addEventListener("scroll",u,{passive:!0}),u(),()=>{r&&e.cancelAnimationFrame(r),o?.removeEventListener("resize",u),o?.removeEventListener("scroll",u)}}const Or=/^eyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/,Dr=/^[a-f0-9]{32,}$/i,Lr=/^(?=[A-Za-z0-9_-]{24,}$)(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]+$/,Nr="[redacted]";function Un(e){return e.includes("/")?e.split("/").map(t=>Or.test(t)||Dr.test(t)||Lr.test(t)?Nr:t).join("/"):e}const Hr=/\/index\.(html?|php)$/i;function Wr(e){if(!e.startsWith("/"))return e;let t=e.replace(Hr,"/");return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t.toLowerCase()}function Ur(e){try{const t=e.querySelector(`meta[name="${Lo.route}"]`)?.getAttribute("content")?.trim();return!t||t.length>512||!t.startsWith("/")?null:t}catch{return null}}function jr(e,t){const n=t??Ur(e);return Wr(n??Un(e.location.pathname))}const Fr=[/^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$/],Br=[...wt.query,...wt.fragment];function Zr(e,t=[]){return Br.includes(e)||t.includes(e)?!0:Fr.some(n=>n.test(e))}function Vr(e,t={}){const n=t.significantQueryParams??[];if(n!=="*"&&n.length===0)return;let o;try{o=new URLSearchParams(e)}catch{return}const r={};for(const[l,u]of o)Zr(l,t.ignoredQueryParams??[])||n!=="*"&&!n.includes(l)||(r[l]=u);return Object.keys(r).length>0?r:void 0}function Yr(e,t,n={}){const o=n.significantQueryParams??[];if(o==="*"){const r=e??{},l=t??{},u=new Set([...Object.keys(r),...Object.keys(l)]);for(const a of u)if(r[a]!==l[a])return!1;return!0}for(const r of o)if((e?.[r]??void 0)!==(t?.[r]??void 0))return!1;return!0}const Xr=120,Kr=1e3,Jr=200,qr=1e4;function Qr(e,t,n){const o=t.MutationObserver;if(typeof o!="function")return{destroy:()=>{}};let r=!1,l=null,u=!1,a=!1,d=0,m=C(),w=0;function C(){return t.performance?.now?.()??0}const p=new o(()=>{r=!0,d++,F()});function P(){const z=C();return z-m>=1e3&&(d>Jr&&(w=z+qr),d=0,m=z),z<w?Kr:Xr}function F(){l||(l=setTimeout($,P()))}function $(){if(l=null,!!r){if(u){a=!0;return}r=!1,u=!0;try{n()}finally{u=!1,a&&(a=!1,r=!0,F())}}}return p.observe(e.documentElement,{childList:!0,subtree:!0}),{destroy(){p.disconnect(),l&&clearTimeout(l),l=null}}}const Gr="0.0.0",es={capture:Ie.capture,"anchor-ext":Ie.anchorExt,"anchor-fuzzy":Ie.anchorFuzzy,crumbs:Ie.crumbs,screenshot:Ie.screenshot,dock:Ie.dock,text:Ie.text},jn=new Map,Bt=new Map,Fn=new Map;function ts(e,t,n){const o=new URL(t,n.location.href).href,r=new URL(es[e],o);r.searchParams.set("cv",Gr);const l=Fn.get(e)??0;return l>0&&r.searchParams.set("r",String(l)),Fn.set(e,l+1),r.href}async function Pe(e,t,n=document){const o=jn.get(e);if(o)return{ok:!0,mod:o};const r=Bt.get(e);if(r)return r;const l=(async()=>{for(let u=0;u<2;u++)try{const a=await import(ts(e,t,n));return jn.set(e,a),{ok:!0,mod:a}}catch{}return{ok:!1,reason:"unavailable"}})();Bt.set(e,l);try{return await l}finally{Bt.delete(e)}}const ns="composer",Zt=e=>ce.draft(e,ns),os=ce.draft("\0","").split("\0")[0];function rs(e){try{return e.body.trim()?(localStorage.setItem(Zt(e.route),JSON.stringify(e)),!0):(Bn(e.route),!0)}catch{return!1}}function ss(e){try{const t=localStorage.getItem(Zt(e));if(!t)return null;const n=JSON.parse(t);return!n||typeof n.body!="string"||!n.anchor||n.route!==e?null:n}catch{return null}}function Bn(e){try{localStorage.removeItem(Zt(e))}catch{}}function Vt(){try{for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t&&t.startsWith(os))return!0}return!1}catch{return!1}}const as="http://www.w3.org/2000/svg";function Me(e,t,n,o=[]){const r=e.createElementNS(as,t);for(const l in n)r.setAttribute(l,n[l]);for(const l of o)r.appendChild(l);return r}const Yt=(e,t="16",n="16",o="0 0 16 16")=>({width:t,height:n,viewBox:o,fill:"none","aria-hidden":"true"}),is=e=>Me(e,"svg",Yt(),[Me(e,"path",{d:"M8 3v10M3 8h10",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round"})]),cs=e=>Me(e,"svg",Yt(),[Me(e,"rect",{x:"2.25",y:"3.25",width:"11.5",height:"9.5",rx:"1.75",stroke:"currentColor","stroke-width":"1.5"}),Me(e,"path",{d:"M9.5 3.5v9",stroke:"currentColor","stroke-width":"1.5"})]),ls=e=>Me(e,"svg",{...Yt(e,"10","16","0 0 10 16"),fill:"currentColor"},[Me(e,"g",{fill:"currentColor"},[4,8,12].flatMap(t=>[3,7].map(n=>Me(e,"circle",{cx:String(n),cy:String(t),r:"1"}))))]),ds=` .snag-tb{position:fixed;z-index:${Ke.toolbar};display:flex;align-items:center;gap:2px;padding:4px;border-radius:calc(${A.radius} + 4px);background:${A.bg};color:${A.fg};box-shadow:${A.shadow};font:500 13px/1 ${A.font};pointer-events:auto;user-select:none;border:1px solid ${A.border}}.snag-tb{transition:inset-inline-end ${A.motion}}.snag-tb--fine{inset-inline-end:calc(20px + env(safe-area-inset-right) + var(${M.dockW},0px));inset-block-end:calc(20px + env(safe-area-inset-bottom));transition:inset-inline-end ${A.motion}}.snag-tb--coarse{inset-inline:0;inset-block-end:0;border-radius:14px 14px 0 0;padding:6px 10px calc(6px + env(safe-area-inset-bottom));justify-content:center;gap:4px;flex-direction:column}.snag-grabber{width:36px;height:4px;border-radius:2px;background:${A.muted};margin:2px auto 6px}.snag-row{display:flex;align-items:center;gap:2px}.snag-grip{display:flex;align-items:center;padding:0 4px;color:${A.muted};cursor:grab;touch-action:none}.snag-grip:active{cursor:grabbing}.snag-seg{display:flex;background:${A.surface};border-radius:${A.radius};padding:2px;position:relative}.snag-seg::before{content:"";position:absolute;inset-block:2px;inset-inline-start:var(${M.thumbX},0);width:var(${M.thumbW},0);background:${A.accent};border-radius:calc(${A.radius} - 2px);pointer-events:none;transition:inset-inline-start ${A.motion},width ${A.motion}}.snag-seg>.snag-b[aria-pressed="true"]{background:transparent;color:${A.onAccent}}.snag-seg>.snag-b{z-index:1}.snag-b{appearance:none;border:0;background:transparent;color:inherit;font:inherit;padding:6px 11px;border-radius:calc(${A.radius} - 2px);cursor:pointer;display:flex;align-items:center;gap:6px;position:relative;min-height:32px;transition:background ${A.motion}}.snag-b:hover:not(:disabled){background:color-mix(in srgb,currentColor 12%,transparent)}.snag-b:disabled{opacity:.4;cursor:not-allowed}.snag-b[aria-pressed="true"]{background:${A.accent};color:${A.onAccent}}.snag-b:focus-visible{outline:2px solid ${A.focus};outline-offset:2px}.snag-icon{padding:6px 9px}@media (pointer:coarse){.snag-b{min-height:44px;min-width:44px;padding:6px 14px}.snag-icon{padding:6px 14px}}.snag-puck .snag-row>:not([aria-expanded]){display:none}.snag-puck{padding:4px;border-radius:50%}.snag-puck [aria-expanded]{min-width:44px;min-height:44px;border-radius:50%}`;function us(e,t){const n=e.ownerDocument??document,o=t.coarsePointer??n.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;rt(e,"toolbar",ds);const r=n.createElement("div");r.className=`snag-tb ${o?"snag-tb--coarse":"snag-tb--fine"}`,r.setAttribute("role","toolbar"),r.setAttribute("aria-label",V("toolbar.aria"));const l=n.createElement("div");l.className="snag-grabber",l.setAttribute("aria-hidden","true");const u=n.createElement("div");u.className="snag-row";const a=n.createElement("span");a.className="snag-grip",a.setAttribute("aria-hidden","true"),a.appendChild(ls(n));const d=n.createElement("div");d.className="snag-seg",d.setAttribute("role","group"),d.setAttribute("aria-label",V("toolbar.group"));const m=(c,T,b)=>{const I=n.createElement("button");return I.type="button",I.className=`snag-b ${c}`,I.setAttribute("aria-label",T),typeof b=="string"?I.textContent=b:I.appendChild(b),I},w=m("",V("toolbar.browse"),V("toolbar.browse")),C=m("",V("toolbar.comments"),V("toolbar.comments")),p=m("snag-icon",V("toolbar.add"),is(n)),P=m("snag-icon",V("toolbar.panel"),cs(n));P.setAttribute("aria-expanded","false"),d.append(w,C),o||u.appendChild(a),u.append(d,p,P),o&&r.appendChild(l),r.appendChild(u),(t.parent??e).appendChild(r);const F=()=>{e.host.style.setProperty(M.tbH,`${r.offsetHeight}px`)};F();let $=null;function z(c,T){const b=n.defaultView,I=r.offsetWidth,L=r.offsetHeight,W=Zn(c,8,Math.max(8,b.innerWidth-I-8)),X=Zn(T,8,Math.max(8,b.innerHeight-L-8));$={left:W,top:X},r.style.left=`${W}px`,r.style.top=`${X}px`,r.style.right="auto",r.style.bottom="auto"}const se=()=>{F(),$&&z($.left,$.top)},q=n.defaultView;if(q?.addEventListener("resize",se),w.addEventListener("click",()=>t.onState("browse")),C.addEventListener("click",()=>t.onState("comments")),p.addEventListener("click",()=>t.onState(G==="add"?"comments":"add")),P.addEventListener("click",()=>t.onPanel()),!o){let c=null;a.addEventListener("pointerdown",b=>{c={x:b.clientX,y:b.clientY,r:r.getBoundingClientRect()},a.setPointerCapture(b.pointerId),b.preventDefault()}),a.addEventListener("pointermove",b=>{c&&z(c.r.left+(b.clientX-c.x),c.r.top+(b.clientY-c.y))});const T=b=>{c=null,a.hasPointerCapture(b.pointerId)&&a.releasePointerCapture(b.pointerId)};a.addEventListener("pointerup",T),a.addEventListener("pointercancel",T)}let G="browse";function J(c){G=c,w.setAttribute("aria-pressed",String(c==="browse")),C.setAttribute("aria-pressed",String(c!=="browse")),p.setAttribute("aria-pressed",String(c==="add")),h()}function h(){const c=d.querySelector('.snag-b[aria-pressed="true"]'),T=d.getBoundingClientRect(),b=c?.getBoundingClientRect();if(!c||!b?.width){d.style.setProperty(M.thumbW,"0px");return}const I=n.defaultView?.getComputedStyle(d),L=I?.direction==="rtl",W=parseFloat((L?I?.paddingRight:I?.paddingLeft)??"0")||0,X=(L?T.right-b.right:b.left-T.left)-W;d.style.setProperty(M.thumbW,`${Math.round(b.width)}px`),d.style.setProperty(M.thumbX,`${Math.max(0,Math.round(X))}px`)}function g(c){p.disabled=c,c?p.title=V("error.panels.add"):p.removeAttribute("title")}function _(c){p.setAttribute("aria-label",V(c?"toolbar.add.draft":"toolbar.add"))}function O(c){C.setAttribute("aria-label",c!==null&&c>0?V("toolbar.comments.unresolved",{n:jo(c)}):V("toolbar.comments"))}J("browse"),O(0);function Z(c){r.classList.toggle("snag-puck",c),c||h()}function D(c){r.hidden=c,c||h(),F()}return{el:r,setState:J,setCount:O,setDegraded:g,setDraft:_,setPuck:Z,setConcealed:D,destroy(){q?.removeEventListener("resize",se),e.host.style.removeProperty(M.tbH),r.remove()}}}const Zn=(e,t,n)=>e<t?t:e>n?n:e,Vn=24;function fs(e,t){const n=e.innerHeight,o=t.querySelector(".snag-dk");if(!o)return{top:0,bottom:n};const r=o.getBoundingClientRect();return r.height>=n-1?{top:0,bottom:n}:{top:0,bottom:Math.max(0,r.top)}}function hs(e,t,n){const o=n.anchor.rect;if(!o)return;const r=n.anchor.offset??{fy:.5},l=o.y+o.h*r.fy,u=fs(e,t),a=l-e.scrollY;if(a>=u.top+Vn&&a<=u.bottom-Vn)return;const d=e.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;e.scrollTo({top:Math.max(0,l-(u.top+u.bottom)/2),behavior:d?"auto":"smooth"})}function Xt(){const e=new Uint8Array(16);crypto.getRandomValues(e);const t=Date.now();e[0]=Math.floor(t/2**40)&255,e[1]=Math.floor(t/2**32)&255,e[2]=Math.floor(t/2**24)&255,e[3]=Math.floor(t/2**16)&255,e[4]=Math.floor(t/2**8)&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128;const n=Array.from(e,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}const ps=()=>xt.thread+Xt(),Yn=()=>xt.comment+Xt(),ms=()=>xt.attachment+Xt(),gs={attachments:"direct",realtime:"none",anchorReports:!1,identity:["guest"],export:["json","md"],serverSideSearch:!1,privateThreads:!1,assignees:!1};function ys(){const e=ce.threads("probe","probe");try{return localStorage.setItem(e,"1"),localStorage.removeItem(e),!0}catch(t){return Xn(t)}}function bs(e,t,n){const o=ce.threads(e,t);function r(){let a=null;try{a=localStorage.getItem(o)}catch{return[]}if(!a)return[];try{const d=JSON.parse(a);return Array.isArray(d)?d.filter(ws):[]}catch{return[]}}function l(a){try{localStorage.setItem(o,JSON.stringify(a))}catch(d){if(!Xn(d))return;throw new Ht("local_quota_exceeded")}}const u=a=>({...a,updatedAt:new Date().toISOString()});return{kind:"local",capabilities:gs,async init(a){return{uid:a.uid,env:a.env,features:{screenshots:!0,uploads:!1}}},async listThreads(a={}){let d=r();return a.route!==void 0&&(d=d.filter(m=>m.route===a.route)),a.status?.length&&(d=d.filter(m=>a.status.includes(m.status))),{data:d,serverTime:new Date().toISOString()}},async getThread(a){return r().find(d=>d.id===a)??null},async createThread(a){const d=Rn(a);return l([...r(),d]),d},async patchThread(a,d){const m=r(),w=m.findIndex(F=>F.id===a);if(w<0)return null;const{assignee:C,...p}=d,P=u({...m[w],...vs(p)});return m[w]=P,l(m),P},async deleteThread(a){const d=r(),m=d.find(C=>C.id===a),w=d.filter(C=>C.id!==a);w.length!==d.length&&l(w);for(const C of m?.attachments??[])n?.del(C.id).catch(()=>{})},async uploadAttachment(a,d){if(!n)throw new Ht("attachments_unsupported");const m=ms();return await n.put(m,{blob:a,uid:e,env:t,kind:d.kind,...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{},createdAt:Date.now()}),{id:m,kind:d.kind,url:"",...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{},bytes:a.size,contentType:a.type}},async createComment(a,d){const m=r(),w=m.findIndex(p=>p.id===a);if(w<0)return null;const C={id:d.id,snagId:a,body:d.body,author:d.author,createdAt:new Date().toISOString()};return m[w]=u({...m[w],comments:[...m[w].comments,C]}),l(m),C},async patchComment(a,d){const m=r();for(let w=0;w<m.length;w++){const C=m[w].comments.find(P=>P.id===a);if(!C)continue;const p={...C,body:d};return m[w]=u({...m[w],comments:m[w].comments.map(P=>P.id===a?p:P)}),l(m),p}return null},async deleteComment(a){const d=r(),m=d.findIndex(w=>w.comments.some(C=>C.id===a));m<0||(d[m]=u({...d[m],comments:d[m].comments.filter(w=>w.id!==a)}),l(d))}}}function vs(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Xn(e){return e instanceof Error?e.name==="QuotaExceededError"||e.name==="NS_ERROR_DOM_QUOTA_REACHED"||e.code===22||e.code===1014:!1}function ws(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id=="string"&&typeof t.key=="string"&&typeof t.route=="string"&&typeof t.anchor=="object"&&t.anchor!==null&&typeof t.anchor.label=="string"&&Array.isArray(t.comments)}function xs(e,t,n=()=>Date.now()){const o=ce.seen(e,t);let r=null;function l(){if(r)return r;try{const a=localStorage.getItem(o),d=a?JSON.parse(a):{};return r=typeof d=="object"&&d!==null&&!Array.isArray(d)?d:{}}catch{return r={}}}function u(a){r=a;try{localStorage.setItem(o,JSON.stringify(a))}catch{}}return{map:()=>new Map(Object.entries(l())),mark(a){u({...l(),[a]:n()})},markAll(a){const d=n(),m={...l()};for(const w of a)m[w.id]=d;u(m)}}}function it(){let e=null;try{e=localStorage.getItem(Dt)}catch{return{}}if(!e)return{};if(e[0]!=="{")return{name:e};try{const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function Kn(e){try{localStorage.setItem(Dt,JSON.stringify(e))}catch{}}function Kt(){const e=it();return{name:typeof e.name=="string"?e.name:"",...e.email?{email:e.email}:{}}}function Jn(e){return it().projects?.[e]?.holderId}function Ss(e){const t=it().projects?.[e]?.holderSecret;return t&&/^[\w-]{43}$/.test(t)?t:void 0}function As(e,t,n){const o=it();Kn({...o,projects:{...o.projects,[e]:{holderId:t,holderSecret:n}}})}function ks(e,t){const n=it(),o=n.projects?.[e];o&&Kn({...n,projects:{...n.projects,[e]:{...o,holderId:t}}})}const Ue=e=>ce.session(e);function qn(e){if(!e)return null;const t=JSON.parse(e);return typeof t?.token=="string"&&typeof t?.refreshableUntil=="number"?t:null}function Je(e){try{const t=qn(sessionStorage.getItem(Ue(e)));if(t)return t;const n=qn(localStorage.getItem(Ue(e)));return n?.member?n:null}catch{return null}}function Jt(e,t){try{t.member?(localStorage.setItem(Ue(e),JSON.stringify(t)),sessionStorage.removeItem(Ue(e))):sessionStorage.setItem(Ue(e),JSON.stringify(t))}catch{}}function ct(e){try{sessionStorage.removeItem(Ue(e)),localStorage.removeItem(Ue(e))}catch{}}const $s=(e,t=Date.now())=>t>e.expiresAt-3e4,qt=(e,t=Date.now())=>t>=e.refreshableUntil;class je extends Error{code;status;constructor(t,n,o){super(o),this.name="HttpAdapterError",this.status=t,this.code=n}}function Es(e){const{offset:t,testId:n,domId:o,page:r,schemaVersion:l,...u}=e;return{...u,...n?{testid:n}:{},...o?{domid:o}:{},...t?{offset:{fx:t.x,fy:t.y}}:{}}}function Cs(e,t){const n=e.url??"",o=/^https?:/i.test(n)?n:n?`${t}${n.startsWith("/")?"":"/"}${n}`:`${t}/api/v1/attachments/${encodeURIComponent(e.id)}/blob`;return{...e,url:o}}function kt(e,t,n){return{id:e.id,route:e.anchor?.page?.route??"",key:e.key,status:e.status,anchor:Es(e.anchor),anchorState:e.anchorState,context:e.context,comments:e.comments??[],createdBy:e.createdBy,assignee:e.assignee??null,createdAt:e.createdAt,updatedAt:e.updatedAt,...e.resolvedAt?{resolvedAt:e.resolvedAt}:{},...e.attachments?.length?{attachments:e.attachments.map(o=>Cs(o,n))}:{},...t?{scope:{environment:t}}:{}}}function Ts(e,t){const{offset:n,testid:o,domid:r,...l}=e;return{...l,schemaVersion:gn,...o?{testId:o}:{},...r?{domId:r}:{},offset:n?{x:n.fx,y:n.fy}:{x:.5,y:.5},page:{route:t,pathname:location.pathname,origin:location.origin}}}function Rs(e,t){const n=o=>/^[\d.]+$|:/.test(o)?o:o.split(".").slice(-2).join(".");return n(e)===n(t)}const Qn=10*6e4;function _s(e,t,n,o={}){const r=e.replace(/\/+$/,""),l=`${r}/api/v1/projects/${encodeURIComponent(t)}`;let u=o.reviewToken,a=Je(t),d=[];const m=ce.silent(t);let w=0,C=Promise.resolve(!1);function p(){if(u||Date.now()-w<Qn)return C;try{if(!Rs(location.hostname,new URL(r).hostname)||localStorage.getItem(m)||Date.now()-Number(sessionStorage.getItem(m))<Qn)return C}catch{}return w=Date.now(),C=(async()=>{try{const h=await fetch(`${l}/sessions/member/silent`,{method:"POST",credentials:"include",...n?{body:JSON.stringify({environment:n})}:{}});if(h.status===201)return F(await h.json()),w=0,!0}catch{}try{sessionStorage.setItem(m,String(Date.now()))}catch{}return!1})()}let P=null;function F(h){a={token:h.sessionToken,expiresAt:Date.parse(h.expiresAt),refreshableUntil:Date.parse(h.refreshableUntil),reviewerId:h.reviewer.id,permissions:h.permissions,member:h.reviewer.name,...h.moderator?{moderator:!0}:{}},Jt(t,a),o.onSessionStarted?.()}const $=()=>a;async function z(h=!1){const g=a&&!qt(a)?a.token:null,_=!!g&&!u&&!h,O=_?void 0:u?{kind:"link",token:u,name:Kt().name||void 0}:{kind:"guest",name:Kt().name||"Anonymous",holderId:Jn(t),holderSecret:Ss(t)};let Z;try{Z=await fetch(`${l}/sessions`,{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...g?{Authorization:`Bearer ${g}`}:{}},body:JSON.stringify({...n?{environment:n}:{},...O?{identity:O}:{},client:{widget:Co,schema:gn}})})}catch(T){throw new je(0,"network_error",T.message)}finally{u=void 0}if(!Z.ok){const b=(await Z.json().catch(()=>null))?.error?.code??"unauthorized",I=_&&!!a?.member;if(ct(t),a=null,I&&Z.status===401&&await p())return $();throw b==="session_revoked"||b==="token_revoked"?o.onSessionEnded?.("revoked"):Z.status===401&&o.onSessionEnded?.("expired"),new je(Z.status,b,"This review session is not valid.")}const D=await Z.json();D.holderSecret&&D.reviewer?As(t,D.reviewer.id,D.holderSecret):D.reviewer&&ks(t,D.reviewer.id);const c=D.round?.number??(_||h?a?.round:void 0);return a={token:D.sessionToken,expiresAt:Date.parse(D.expiresAt),refreshableUntil:Date.parse(D.refreshableUntil),reviewerId:D.reviewer?.id??a?.reviewerId??"",permissions:D.permissions??a?.permissions??[],...c!==void 0?{round:c}:{},..._&&a?.member?{member:a.member}:{},..._&&a?.member&&a.moderator?{moderator:!0}:{}},Jt(t,a),O&&(q=O.name??null),o.onSessionStarted?.(),a}async function se(){if(a){if(qt(a)){ct(t),a=null,await p()||o.onSessionEnded?.("expired");return}await z().catch(()=>{})}}let q=null;async function G(){if(await(P??=a?.member?Promise.resolve():p()),a&&qt(a)&&(ct(t),a=null,q=null,!await p()))return o.onSessionEnded?.("expired"),null;const h=Kt().name||null,g=a!==null&&!a.member&&h!==null&&h!==q;if(!a||$s(a)||u||g)try{await z(g)}catch(_){if(!(_ instanceof je)||_.status===0)throw _;return null}return a?.token??null}async function J(h,g,_=!1){const O=await G();let Z;try{Z=await fetch(l+h,{...g,headers:{"content-type":"application/json",...O?{Authorization:`Bearer ${O}`}:{},...g?.headers??{}},credentials:"omit"})}catch(D){throw new je(0,"network_error",D.message)}if(!Z.ok){const D=await Z.json().catch(()=>null),c=D?.error?.code??"http_error";if(Z.status===401&&!_&&c!=="session_revoked"){const T=!!a?.member;return ct(t),a=null,T&&await p(),J(h,g,!0)}throw new je(Z.status,c,D?.error?.message??`The server answered ${Z.status}.`)}return await Z.json()}return{kind:"http",capabilities:{attachments:"none",realtime:"none",anchorReports:!0,identity:["guest"],export:[],serverSideSearch:!1,privateThreads:!1,assignees:!0},async init(h){const g=await J("/config");return this.capabilities.attachments=g.features.screenshots?"direct":"none",d=g.rounds??[],{uid:h.uid,env:h.env,features:g.features,...g.rounds?{rounds:g.rounds}:{},...g.writable===void 0?{}:{writable:g.writable},...g.reason===void 0?{}:{reason:g.reason}}},async reportAnchors(h){if(h.length!==0)for(let g=0;g<h.length;g+=50)try{await J("/anchor-reports",{method:"POST",body:JSON.stringify({reports:h.slice(g,g+50)})})}catch{return}},revalidate:se,member:()=>a?.member??null,adoptSession(h){try{localStorage.removeItem(m)}catch{}F(h)},signOut(){ct(t),a=null,q=null;try{localStorage.setItem(m,"out")}catch{}},getRound(){return a?.round??Je(t)?.round??null},setRound(h){a&&(a={...a,round:h});const g=Je(t);g&&Jt(t,{...g,round:h})},async fetchForeignImage(h){try{const g=await G(),_=await fetch(`${l}/image?src=${encodeURIComponent(h)}`,{credentials:"omit",...g?{headers:{Authorization:`Bearer ${g}`}}:{}});if(!_.ok)return null;const O=await _.blob();return O.type.startsWith("image/")?O:null}catch{return null}},async uploadAttachment(h,g){const _=await G(),O=await fetch(`${l}/attachments`,{method:"POST",credentials:"omit",headers:{"content-type":h.type||"image/webp",[Lt.attachmentKind]:g.kind,...g.width?{[Lt.attachmentWidth]:String(g.width)}:{},...g.height?{[Lt.attachmentHeight]:String(g.height)}:{},..._?{Authorization:`Bearer ${_}`}:{}},body:h});if(!O.ok){const D=await O.json().catch(()=>null);throw new je(O.status,D?.error?.code??"upload_failed",D?.error?.message??"Upload failed.")}const Z=await O.json();return{id:Z.id,kind:g.kind,contentType:Z.contentType,byteSize:Z.byteSize,...g.width?{width:g.width}:{},...g.height?{height:g.height}:{},url:`${r}/api/v1/attachments/${Z.id}/blob`}},async listThreads(h){await G();const g=new URLSearchParams;n&&g.set("env",n),h?.route&&g.set("route",h.route),a?.round&&g.set("round",String(a.round));const _=await J(`/threads?${g}`);return{data:_.data.map(O=>kt(O,n,r)),..._.nextCursor?{nextCursor:_.nextCursor}:{},deleted:[],serverTime:_.serverTime}},async getThread(h){return(await this.listThreads()).data.find(_=>_.id===h)??null},async getThreadByKey(h){const g=new URLSearchParams({key:h});n&&g.set("env",n);const O=(await J(`/threads?${g}`)).data[0];return O?kt(O,n,r):null},async createThread(h){const g=a?.round,_=d.some(D=>D.number===g&&!D.closed)?g:void 0,O=D=>J("/threads",{method:"POST",body:JSON.stringify({id:h.id,anchor:Ts(h.anchor,h.route),anchorState:h.anchorState,context:h.context,...n||D?{scope:{...n?{environment:n}:{},...D?{round:D}:{}}}:{},createdBy:{name:h.createdBy.name},...h.comment?{comment:{id:h.comment.id,body:h.comment.body}}:{},...h.attachments?.length?{attachments:h.attachments.map(c=>c.id)}:{}})}),Z=await O(_).catch(D=>{if(_&&D instanceof je&&D.code.startsWith("round_"))return O();throw D});return kt(Z,n,r)},async patchThread(h,g){const _="assignee"in g;if(!g.status&&!_)return null;const O=await J(`/threads/${encodeURIComponent(h)}`,{method:"PATCH",body:JSON.stringify({...g.status?{status:g.status}:{},..._?{assignee:g.assignee??null}:{}})});return kt(O,n,r)},async listAssignees(h){return(await J(`/assignees${h?`?q=${encodeURIComponent(h)}`:""}`)).data??[]},async deleteThread(h){await J(`/threads/${encodeURIComponent(h)}`,{method:"DELETE"})},isMine(h){return h.id?h.id===(a??Je(t))?.reviewerId||h.id===Jn(t):!1},canModerate(){const h=a??Je(t);return!!h?.member&&!!h.moderator},can(h){return(a??Je(t))?.permissions.includes(h)??!1},async createComment(h,g){const _=await J(`/threads/${encodeURIComponent(h)}/comments`,{method:"POST",body:JSON.stringify({id:g.id,body:g.body})});return{id:_.id,snagId:h,body:_.body,author:_.author,createdAt:_.createdAt}},async patchComment(h,g){return await J(`/comments/${encodeURIComponent(h)}`,{method:"PATCH",body:JSON.stringify({body:g})}),null},async deleteComment(h){await J(`/comments/${encodeURIComponent(h)}`,{method:"DELETE"})}}}async function Is(e,t){if(e.url&&/^https?:/i.test(e.url))try{const n=await fetch(e.url,{credentials:"omit"});if(!n.ok)return null;const o=await n.blob();return o.type&&!o.type.startsWith("image/")?null:o}catch{return null}return t(e.id)}const Ps=64,Ms=4096,zs=e=>ce.counts(e),Os=e=>e.filter(t=>t.status!=="resolved").length;function Ds(e,t,n){const o=new Map;for(const a of t){const d=o.get(a.route)??{n:0,seen:""};a.status!=="resolved"&&d.n++,a.updatedAt>d.seen&&(d.seen=a.updatedAt),o.set(a.route,d)}o.has(n)||o.set(n,{n:0,seen:new Date().toISOString()});const l=[...o.entries()].sort((a,d)=>d[1].seen.localeCompare(a[1].seen)).slice(0,Ps);l.some(([a])=>a===n)||(l[l.length-1]=[n,o.get(n)]);let u={v:1,p:Os(t),r:Object.fromEntries(l.map(([a,d])=>[a,d.n])),t:new Date().toISOString()};JSON.stringify(u).length>Ms&&(u={...u,r:{}});try{localStorage.setItem(zs(e),JSON.stringify(u))}catch{return null}return u}function Ls(e,t){return e?.r[t]??0}const Ns="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",Hs=new RegExp(`(["'\`]?)(?<![A-Za-z0-9])(?:${Ns})[\\w-]*\\b\\1?\\s*[:=]\\s*(?:(["'\`])((?:\\\\.|(?!\\2)[^\\\\])*)\\2|([^\\s,;&}\\])]{3,}))`,"gi"),Ws=/^(?:Bearer|Basic|Digest|Negotiate|Token)$/i,Us=(e,t,n,o,r,l,u)=>{if(!n&&Ws.test(r)&&u.slice(l+e.length).startsWith(" [redacted]")||(n?o:r).startsWith("[redacted"))return e;const a=n?`${n}${o}${n}`:r;return e.slice(0,e.length-a.length)+(n?`${n}[redacted]${n}`:"[redacted]")},Gn=/data:[a-z0-9.+-]*\/?[a-z0-9.+-]*;base64,[A-Za-z0-9+/=]{16,}/gi,eo=/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{0,}/g,to=/\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,js=/\b(Bearer|Basic|Digest|Negotiate|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi,no=/\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,Qt=/\b(?:\d[ -]?){12,18}\d\b/g,oo=/\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,ro=/\b[0-9a-f]{32,}\b/gi,so=/\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,ao=/\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,io=/\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/gi,Fs=/^(?=[A-Za-z0-9_~.+/=-]*[a-z])(?=[A-Za-z0-9_~.+/=-]*[A-Z])(?=[A-Za-z0-9_~.+/=-]*\d)[A-Za-z0-9_~.+/=-]{24,}$/;function Te(e,t){e.lastIndex=0;const n=e.test(t);return e.lastIndex=0,n}function co(e){const t=e.replace(/[ -]/g,"");if(t.length<13||t.length>19)return!1;let n=0,o=!1;for(let r=t.length-1;r>=0;r--){let l=t.charCodeAt(r)-48;o&&(l*=2,l>9&&(l-=9)),n+=l,o=!o}return n%10===0}function Bs(e){Qt.lastIndex=0;for(const t of e.matchAll(Qt))if(co(t[0]))return!0;return!1}function $t(e){let t=e;return t=t.replace(Gn,"data:[redacted]"),t=t.replace(js,"$1 [redacted]"),t=t.replace(Hs,Us),t=t.replace(eo,"[redacted:jwt]"),t=t.replace(to,"[redacted:key]"),t=t.replace(ao,"[redacted:key]"),t=t.replace(io,"[redacted:url-cred]@"),t=t.replace(no,"[redacted:email]"),t=t.replace(Qt,n=>co(n)?"[redacted:card]":n),t=t.replace(so,n=>`[redacted:b64:${n.length}]`),t=t.replace(oo,n=>`[redacted:b64:${n.length}]`),t=t.replace(ro,n=>`[redacted:hex:${n.length}]`),t}const Zs=wt.query,Vs=wt.fragment;function Ys(e,t=[]){let n;try{const o=globalThis.location?.href;n=new URL(e,o)}catch{return $t(e)}n.username="",n.password="";for(const o of[...n.searchParams.keys()]){if(Vs.includes(o)){n.searchParams.set(o,"[redacted]");continue}if(Zs.includes(o))continue;if(!t.includes(o)){n.searchParams.set(o,"[redacted]");continue}const r=n.searchParams.get(o)??"";$t(r)!==r&&n.searchParams.set(o,"[redacted]")}return n.hash&&n.hash.length>1&&(n.hash=t.includes("#")?n.hash:"#[redacted]"),$t(n.toString().replace(/%5Bredacted%5D/gi,"[redacted]"))}function Xs(e){return e.length>120?!0:Te(no,e)||Te(eo,e)||Te(to,e)||Te(ro,e)||Te(oo,e)||Te(Gn,e)||Te(so,e)||Te(ao,e)||Te(io,e)||Fs.test(e)||Bs(e)}const Et={id:"rev_local",name:V("author.unknown"),kind:"guest"},Ks="0.0.0";function lo(e,t){if(e)return{...Et,name:e,...t?{email:t}:{}};try{const n=localStorage.getItem(ce.identity);if(n)return{...Et,name:n[0]==="{"?JSON.parse(n).name??Et.name:n}}catch{}return Et}function Js(e){return`SN-${e.reduce((n,o)=>{const r=Number(o.key.split("-")[1]??0);return Number.isFinite(r)&&r>n?r:n},0)+1}`}let Gt=null;const we=e=>jr(e,Gt);function qs(e,t){const n=xn(),o=n.ownerDocument??document,r=o.defaultView??window,l=t?.config?.site??"local",u=t?.emit??(()=>{}),a=t?.assetBase??"./",d=t?.config?.env??"default";rt(n,"tokens",Zo);const m=Yo(n.host,Vo(t?.config?.theme)),w={},C=t?.config?.storage==="local"?void 0:t?.config?.host,p=C&&l!=="local"?_s(C,l,t?.config?.env,{reviewToken:t?.reviewToken,onSessionEnded:s=>{ie.show(s==="revoked"?"error.linkrevoked":"error.sessionended")},onSessionStarted:()=>ie.hide()}):bs(l,d,{put:(s,i)=>w.put(s,i),del:s=>w.del(s)}),P=xs(l,d);let F=null;p.init({uid:l,env:d}).then(s=>{F=s.rounds??null,X?.update(x()),s.writable===!1&&s.reason==="origin_not_allowed"&&ie.show("error.origin",void 0,{origin:location.origin})}).catch(()=>{});let $=[],z=[];const se=ys();let q=null,G=null,J=!1,h=!1,g=!1,_=null,O=!1;const Z={get:()=>q,unavailable:()=>h||g,newPass:()=>G?.createPassCaches(),fuzzyHit:s=>_?.hit(s)??null,wantFuzzy:(s,i)=>{if(_){_.enqueue(s,i,()=>re());return}O||!G||!i.text?.exact||i.text.exact.length<8||(O=!0,Pe("anchor-fuzzy",a,o).then(f=>{if(!f.ok||!G){g=!0,re();return}_=f.mod.createFuzzyEngine(o,G.fuzzyDeps),Ee()}))},want:s=>{J||!(s.role&&s.accessibleName)&&!s.text?.exact&&!s.path?.length||(J=!0,Pe("anchor-ext",a,o).then(i=>{if(!i.ok){h=!0,re();return}G=i.mod,q=i.mod.resolveExtended,Ee()}))}};let D=null,c=_r();const T=()=>c.statuses.length>0||!!c.by||!!c.page||c.read!=="all",b=wr(n,s=>{if(L==="add"){if(W?.hasText()){W.pulse();return}W?.close(),W=null,pe("comments")}v(s.id)},Z,s=>{D=s,X?X.update(x()):v()});let L=(()=>{try{return sessionStorage.getItem(ce.mode)==="comments"?"comments":"browse"}catch{return"browse"}})(),W=null,X=null,ae=null,Fe=!1,xe=null,Be=!1,Ct=null,Re=null,Se=null,ze=!1;function fe(){return Se?Promise.resolve(Se):ze?Promise.resolve(null):Pe("capture",a,o).then(i=>i.ok?(w.put=i.mod.putBlob,w.del=i.mod.deleteBlob,Se=i.mod):(qe(new Error("chunk unavailable")),null))}function qe(s){ze||(ze=!0,L==="add"&&pe("comments"),te.setDegraded(!0),ie.show("error.capture",{label:"action.retry",run:()=>{ze=!1,te.setDegraded(!1),fe()}}),console.warn(`[${ve}] the capture chunk failed to load`,s))}let Qe=0;function Oe(){const s=new URL(a,o.location.href).href,i=new URL(Ie.panels,s);return i.searchParams.set("cv",Ks),Qe>0&&i.searchParams.set("r",String(Qe)),Qe++,import(i.href)}async function Ae(){if(Be)return null;if(xe)return xe.catch(()=>null);xe=Oe().catch(async()=>(await new Promise(s=>setTimeout(s,1e3)),Oe()));try{return Ct=await xe}catch(s){return xe=null,lt(s),null}}function lt(s){Be=!0,L==="add"&&pe("comments"),te.setDegraded(!0),ie.show("error.panels",{label:"action.retry",run:()=>{Be=!1,te.setDegraded(!1),v(ae)}}),console.warn(`[${ve}] the panels chunk failed to load`,s)}const ke=o.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;let le=null;async function Tt(){if(le)return;const s=await fe();!s||le||(le=s.createAddChrome(n,ke,{pick:(i,f)=>void k(i,f),announce:et}),le.setActive(L==="add"))}const he=o.createElement("div");he.style.cssText=`position:fixed;left:0;top:0;pointer-events:none;z-index:${Ke.dock}`,n.appendChild(he);const dt=zr(r,he,s=>te.setPuck(s>1.2)),ie=Sr(n,he),Ze=kr(n,he),S=tr(n,{onPick:(s,i)=>void k(s,i),onHover:s=>s?le?.show(s):le?.clear(),onSelectStart:()=>{ke||rn()}});async function k(s,i){if(W?.hasText()){W.pulse();return}W?.close();const[f,R]=await Promise.all([Ae(),fe()]);if(!f||!R)return;const B=R.captureContext({page:R.derivePageRef(o.location,mt()),...yt()});mn(s);const K=R.deriveAnchorLabel(s);y(f,s,i,B,K,R)}function y(s,i,f,R,B,K,Y,He){let be=i;gt=!1;const me=we(o);Pt=!1;const bt=()=>{W=null,Bn(me),te.setDraft(Vt()),pe("comments")},ot=()=>{nt?.abort(),Ne=nt=null,bt()},ge=F?.find(ue=>ue.number===p.getRound?.())?.closed?F.find(ue=>!ue.closed):void 0,We={at:f,label:B,...Y?{initialBody:Y.body,initialName:Y.author,...Y.email?{initialEmail:Y.email}:{}}:{},onDraft:(ue,_e,vt)=>{const Eo=rs({route:me,body:ue,author:_e,...vt?{email:vt}:{},label:B,anchor:He??K.createElementAnchor(i,{point:f,viewportWidth:r.innerWidth,label:B,...K.describeElement(i)}),at:{x:f.x+r.scrollX,y:f.y+r.scrollY},savedAt:new Date().toISOString()});te.setDraft(Vt()),!Eo&&!Pt&&(Pt=!0,ln())},onSend:(ue,_e,vt)=>{bt(),ge&&p.setRound(ge.number),dn(be,f,R,ue,_e,vt,He).then(()=>ge&&Ee())},onRetarget:ue=>{const _e=ue==="up"?K.widen(be):K.narrow(be);_e&&(be=_e,le?.show(_e),W?.setLabel(K.deriveAnchorLabel(_e)))},...de&&tt!==!1?{onShotOptIn:ue=>gt=ue}:{},onCancel:ot,crumbsOn:pn!==!1,shotsOn:tt!==!1,...C&&l!=="local"?{serverHost:new URL(C).host}:{},...C&&p.adoptSession?{studio:{host:C,uid:l,env:t?.config?.env,member:p.member(),adopt:ue=>p.adoptSession(ue),signOut:()=>p.signOut()}}:{},...He?.text?.exact?{quote:He.text.exact}:{},...ge?{roundNote:ge.name}:{}};W=s.openComposer(n,We,he),ne()}async function U(){const s=we(o),i=ss(s);if(te.setDraft(Vt()),!i||W)return;const[f,R]=await Promise.all([Ae(),fe()]);if(!f||!R)return;const B=Ft(i.anchor,o,{viewportWidth:r.innerWidth,...q?{extended:q}:{}});if(!B.element)return;const K=B.element.getBoundingClientRect();if(K.width===0&&K.height===0)return;const Y={x:i.at.x-r.scrollX,y:i.at.y-r.scrollY};pe("add"),y(f,B.element,Y,R.captureContext({page:R.derivePageRef(o.location,mt()),...yt()}),i.label,R,{body:i.body,author:i.author,...i.email?{email:i.email}:{}})}async function v(s=null){if(s&&s!==ae&&u("thread:open",{threadId:s}),s&&P.mark(s),ae=s,Fe=!0,L==="browse"&&pe("comments"),X){X.update(x());return}if(!await Ae())return;const f=await Pe("dock",a,o);if(!f.ok){ie.show("error.panels",{label:"action.retry",run:()=>void v(ae)});return}!Fe||X||(Re=f.mod,X=f.mod.openDock(n,x(),he),ne())}function N(){P.markAll($),c.newOnly&&(c={...c,newOnly:!1}),Fe=!1,X?.close(),X=null,ae=null,b.highlight(null),ne(),T()&&re()}function E(s){const i=s?$.find(f=>f.id===s):void 0;if(i&&i.route!==we(o)){Tr(r,i.id),r.location.assign(i.route);return}s&&P.mark(s),ae=s,b.highlight(null),T()?re():X?.update(x()),i&&Re?.scrollToSnag(r,n,i)}function x(){return{snags:$,route:we(o),openId:ae,seenAt:P.map(),onOpen:E,onStatus:(s,i)=>void po(s,i),onReply:(s,i,f)=>void go(s,i,f),onEdit:(s,i)=>void Q(s,i),onDeleteComment:s=>void H(s),onDeleteThread:s=>void j(s),...p.isMine?{isMine:s=>p.isMine(s)}:{},...C&&p.adoptSession?{studio:{host:C,uid:l,env:t?.config?.env,member:p.member(),adopt:s=>p.adoptSession(s),signOut:()=>p.signOut()}}:{},canDeleteOwnThread:p.can?p.can("thread:delete:own"):!0,canStatus:p.can?p.can("thread:resolve"):!0,canModerate:p.canModerate?.()??!1,...p.listAssignees&&p.can?.("thread:assign")?{assignees:()=>p.listAssignees(),onAssign:(s,i)=>void mo(s,i)}:{},onClearAll:()=>void ee(),onClose:N,...p.kind==="local"?{onExport:It}:{},onHover:s=>b.highlight(s),...F&&F.length>1&&p.setRound?{rounds:F,activeRound:p.getRound?.()??F.find(s=>!s.closed)?.number??F[0].number,onRound:s=>{p.setRound(s),Ee()}}:{},onAnnounce:et,loadShot:s=>Is(s,async i=>{const f=await fe();return f?(await f.getBlob(i))?.blob??null:null}),filter:c,onFilter:s=>{const i=s.statuses.join()!==c.statuses.join()||s.by!==c.by||s.page!==c.page||s.read!==c.read;c=s,i?re():X?.update(x())},...D?{clusterFilter:D}:{},onClusterClear:()=>{D=null,X?.update(x())},onShowAnyway:s=>{b.showGhost(s),Re?.scrollToSnag(r,n,s)}}}async function oe(s,i){const f=$;$=s,re();try{await Ye(i)}catch{$=f,re(),ie.show("error.sendfailed",void 0,{item:"change"})}}async function Q(s,i){await oe($.map(f=>({...f,comments:f.comments.map(R=>R.id===s?{...R,body:i}:R)})),()=>p.patchComment(s,i))}async function H(s){await oe($.map(i=>({...i,comments:i.comments.filter(f=>f.id!==s)})),()=>p.deleteComment(s))}async function j(s){const i=ae;ae===s&&(ae=null),await oe($.filter(f=>f.id!==s),()=>p.deleteThread(s)),$.some(f=>f.id===s)&&(ae=i)}async function ee(){const s=$.map(i=>i.id);$=[],ae=null,re(),await Promise.all(s.map(i=>Ye(()=>p.deleteThread(i))))}const te=us(n,{onState:s=>pe(s),onPanel:()=>X?N():void v(),onNav:s=>nn(s),parent:he}),de=r.matchMedia?.("(pointer: coarse)").matches??!1,ne=()=>{de&&te.setConcealed(!!W||!!X)};let ye=null,De=[];function ut(s){let i=!1;const f=()=>{i||(i=!0,r.removeEventListener("scrollend",f),s())};r.addEventListener("scrollend",f,{once:!0}),r.setTimeout(f,600)}const Ge=o.createElement("div");Ge.setAttribute("aria-live","polite"),Ge.setAttribute("role","status");const en="position:absolute;width:1px;height:1px;overflow:hidden";Ge.style.cssText=en;const Rt=o.createElement("div");Rt.setAttribute("aria-live","assertive"),Rt.style.cssText=en,n.append(Ge,Rt);let tn=0;function et(s){r.clearTimeout(tn),tn=r.setTimeout(()=>{Ge.textContent=s},400)}function nn(s){const i=De.length;if(i===0)return;ye=ye===null?s===1?0:i-1:(ye+s+i)%i;const f=De[ye];hs(r,n,f);const R=ye+1;ut(()=>{b.pulse(f.id),et(V("nav.announce",{n:R,label:f.anchor.label,i:R,total:i}))})}function on(){if(L!=="comments"||ke){$e?.disarm();return}rn().then(s=>{s&&L==="comments"&&s.arm()})}let $e=null,_t=null;async function rn(){if($e)return $e;const s=await Pe("text",a,o);return!s.ok||$e||(_t=s.mod,$e=s.mod.createSelectionWatcher(n,{onQuote:(i,f)=>void uo(i,f)})),$e}async function uo(s,i){const f=Se??await fe();if(!f||!_t)return;const R=_t.createTextAnchor(s,f,{viewportWidth:r.innerWidth,ourRoot:n});if(R.kind==="refused-form-control"){k(R.el,i);return}if(R.kind!=="text")return;const B=await Ae();if(!B)return;const K=f.captureContext({page:f.derivePageRef(o.location,mt()),...yt()});try{s.removeAllRanges()}catch{}y(B,R.el,R.point,K,R.label,f,void 0,R.record)}function pe(s,i=!1){const f=L;L=s,s!=="add"&&W&&!i&&(W.close(),W=null),s==="add"&&X&&N(),s==="add"&&(Ae(),fe());try{sessionStorage.setItem(ce.mode,s==="add"?"comments":s)}catch{}S.setMode(s),s!==f&&et(V(`toolbar.${s}`)),ne(),s==="add"&&Tt(),on(),le?.setActive(s==="add"),te.setState(s),re(),s!==f&&u("modechange",{mode:s,previous:f})}let Ve=0,sn=0;const an=[300,800,1600,3200];function fo(){if(Ve||!b.hasPending()){b.hasPending()||(sn=0);return}const s=an[Math.min(sn++,an.length-1)];Ve=r.setTimeout(()=>{Ve=0,re()},s)}const ho=3e3;let cn=0;function re(s){const i=s??(Date.now()<cn?"navigating":"authoritative");z=b.reanchor($.filter(Ao()),i),So(),fo();const f=new Map(z.map(Y=>[Y.id,Y]));$=$.map(Y=>f.get(Y.id)??Y);const R=T()?new Set(z.filter(Y=>!Pr(Y,c,P.map())&&Y.id!==ae).map(Y=>Y.id)):void 0;De=R?z.filter(Y=>!R.has(Y.id)):z,b.render(L==="browse"?[]:z,R);const B=we(o),K=se?Ds(o.location.origin,$,B):null;te.setCount(K?Ls(K,B):se?z.filter(Y=>Y.status!=="resolved").length:null),ye!==null&&ye>=De.length&&(ye=null),X?.update(x())}async function Ee(){const{data:s}=await p.listThreads();$=s,re();const i=b.settled();for(const f of i)u("anchor:settled",{threadId:f.id,state:f.state,strategy:f.strategy,confidence:f.confidence});return p.capabilities.anchorReports&&p.reportAnchors&&i.length&&Ye(()=>p.reportAnchors(i.map(f=>({threadId:f.id,state:f.state,confidence:f.confidence,strategy:f.strategy})))),p.capabilities.anchorReports||await Promise.all(s.flatMap(f=>{const R=$.find(B=>B.id===f.id);return!R||R.anchorState===f.anchorState?[]:[Ye(()=>p.patchThread(R.id,{anchor:R.anchor,anchorState:R.anchorState}))]})),z}async function po(s,i){u("thread:resolve",{threadId:s,status:i}),await oe($.map(f=>f.id===s?{...f,status:i}:f),()=>p.patchThread(s,{status:i}))}async function mo(s,i){await oe($.map(f=>f.id===s?{...f,assignee:i}:f),()=>p.patchThread(s,{assignee:i&&i.id}))}async function go(s,i,f){const R={id:Yn(),body:i,author:lo(f)};$=$.map(B=>B.id===s?{...B,comments:[...B.comments,{...R,snagId:s,createdAt:new Date().toISOString()}]}:B),P.mark(s),re(),u("comment:create",{threadId:s,comment:R}),await Ye(()=>p.createComment(s,R))}function ln(){ie.show("error.quota",{label:"action.exportclear",run:()=>{It("json"),ee()}}),console.warn(`[${ve}] ${V("error.quota")}`)}async function Ye(s){try{return await s()}catch(i){if(i instanceof Ht&&i.code==="local_quota_exceeded")return ln(),null;throw i}}function It(s){fe().then(async i=>{if(!i)return;const f=await i.resolveAttachmentUris($).catch(()=>new Map);i.download(n,i.buildExport(s,$,{origin:o.location.origin,exportedAt:new Date().toISOString()},f),r)})}async function dn(s,i,f,R,B,K,Y){const He=lo(B,K),be=Se??await fe();if(!be)throw new Error(`[${ve}] add() needs the capture chunk`);Ne||mn(s);const me=Ne?await Ne:null;Ne=nt=null,be.applyShotOutcome(f,me,tt===!1,de&&!gt);const bt=me?.blob&&p.uploadAttachment?p.uploadAttachment(me.blob,{kind:"screenshot",...me.width!==void 0?{width:me.width}:{},...me.height!==void 0?{height:me.height}:{}}).catch(()=>null):Promise.resolve(null),ot={id:ps(),key:Js($),route:we(o),anchor:Y??be.createElementAnchor(s,{point:i,viewportWidth:r.innerWidth,label:be.deriveAnchorLabel(s),...be.describeElement(s)}),anchorState:"anchored",scope:wo(),context:f,createdBy:He,createdAt:new Date().toISOString(),...R?{comment:{id:Yn(),body:R,author:He}}:{}},Ce=Rn(ot);me?.blob&&(Ce.screenshotBlob=me.blob),$=[...$,Ce],P.mark(Ce.id),et(V("announce.created",{key:Ce.key})),u("thread:create",{thread:Ce}),L==="browse"?pe("comments"):re();try{const ge=await bt;ge&&(ot.attachments=[ge],$=$.map(We=>We.id===Ce.id?{...We,attachments:[ge]}:We),re()),await Ye(()=>p.createThread(ot))}catch(ge){throw $=$.filter(We=>We.id!==Ce.id),re(),ie.show("error.sendfailed",void 0,{item:zt.toLowerCase()}),console.warn(`[${ve}] ${V("error.sendfailed",{item:zt.toLowerCase()})}`,ge),ge}return Ce}function un(s){if((s.key==="n"||s.key==="p")&&L==="comments"&&!W){if(s.metaKey||s.ctrlKey||s.altKey)return;const i=s.composedPath()[0]??s.target;if(i&&(i.closest?.("input,textarea,select,[contenteditable]")||i.isContentEditable))return;s.preventDefault(),s.stopPropagation(),nn(s.key==="n"?1:-1);return}L==="add"&&s.key==="Escape"&&(W||(s.stopPropagation(),pe("comments")))}o.addEventListener("keydown",un,!0);let fn=0;const hn=()=>{if(o.hidden||!p.revalidate)return;const s=Date.now();s-fn<3e4||(fn=s,p.revalidate())};o.addEventListener("visibilitychange",hn);const yo=Ho(n),bo=Wo(n,s=>{console.warn(`[${ve}] the host page hid the widget from assistive technology ${s} times; leaving it alone.`)}),vo=No(n,s=>{console.warn(`[${ve}] the host page removed the widget ${s} times; leaving it alone. Reload to comment again.`)});function wo(){return{environment:d,...t?.config?.branch?{branch:t.config.branch}:{}}}let ft={route:we(o),url:o.location.href},Pt=!1,ht=null;function xo(s){if(s){if(L==="browse")return;ht=L,pe("browse",!0),Ze.show(),u("paused",{reason:"modal-dialog"})}else if(ht){const i=ht;ht=null,Ze.hide(),pe(i),u("resumed",{mode:i})}}Ae();function So(){z.length>0&&Pe("dock",a,o)}{const s=o.createElement("div");s.style.cssText="position:fixed;inset:0;pointer-events:none;visibility:hidden",n.appendChild(s);const i=s.getBoundingClientRect(),f=Math.abs(i.left)>1||Math.abs(i.top)>1||Math.abs(i.width-r.innerWidth)>1||Math.abs(i.height-r.innerHeight)>1;s.remove(),f&&(console.warn(`[${ve}] fixed-trapped: <html> has transform/filter/contain, so our fixed layer follows it, not the viewport. Remove it, or expect drift.`),u("error",{code:"fixed-trapped"}))}let Xe=null;const pt=new Set,Le=(()=>{const s=r[_o.config];return s&&typeof s=="object"?s:void 0})(),pn=Le?.breadcrumbs,Mt=(()=>{const s=Le?.significantQueryParams,i=Le?.ignoredQueryParams,f={};return s==="*"?f.significantQueryParams="*":Array.isArray(s)&&(f.significantQueryParams=s.map(String)),Array.isArray(i)&&(f.ignoredQueryParams=i.map(String)),f})(),mt=()=>({routeOverride:Gt,query:Mt,doc:o}),tt=Le?.screenshot===!1?!1:Le?.screenshot&&typeof Le.screenshot=="object"?Le.screenshot:{};let gt=!1,Ne=null,nt=null;function mn(s){if(tt===!1||Ne||de&&!gt)return;nt=new AbortController;const i=nt.signal;Ne=Pe("screenshot",a,o).then(f=>f.ok?f.mod.captureScreenshot({doc:o,target:s,signal:i,...tt,...p.fetchForeignImage?{fetchForeignImage:R=>p.fetchForeignImage(R)}:{}}):{situation:"engine-load-failed",blindSpots:[],maskedCount:0})}function Ao(){const s=we(o),i=Un(o.location.pathname),f=Vr(o.location.search,Mt);return R=>(R.route===s||R.context?.page?.pathname===i)&&Yr(R.context?.page?.query,f,Mt)}{const s=pn;s!==!1&&Pe("crumbs",a,o).then(i=>{i.ok&&(Xe=i.mod.installTierC({win:r,...t?.early?{early:t.early}:{},...s&&typeof s=="object"?{config:s}:{},subscribeNav:f=>(pt.add(f),()=>pt.delete(f))}))})}const yt=()=>Xe?{breadcrumbs:{records:Xe.drain(),status:Xe.status()}}:{},ko=Qr(o,r,()=>{L!=="browse"&&z.length>0&&re()}),$o=Cr(r,{onResize:()=>re(),onRoute:()=>{const s={route:we(o),url:o.location.href},i=s.route!==ft.route;if(i){u("navigate",{from:ft,to:s});for(const f of pt)f(ft.url,s.url)}if(ft=s,!i){Ee();return}cn=Date.now()+ho,r.setTimeout(()=>{p.listThreads().then(({data:f})=>{$=f,re("optimistic")})},100),r.setTimeout(()=>void Ee(),600)},onModal:xo});return te.setState(L),S.setMode(L),on(),se||ie.show("error.nostorage",{label:"action.export",run:()=>It("md")}),Ee().then(async s=>{const i=Rr(r);if(!i){const R=new URLSearchParams(o.location.search).get(Oo("t"));if(R){let B=s.find(K=>K.key===R);if(!B&&p.getThreadByKey){const K=await p.getThreadByKey(R).catch(()=>null);K&&($=[...$.filter(Y=>Y.id!==K.id),K],re(),B=$.find(Y=>Y.id===K.id))}B?(await v(B.id),Re?.scrollToSnag(r,n,B)):(ie.show("permalink.unknown"),await v(null));return}await U();return}const f=s.find(R=>R.id===i);await v(f?i:null),f&&Re?.scrollToSnag(r,n,f)}),{root:n,assetBase:t?.assetBase??"",snags:()=>z,async add(s,i,f,R){const B=R?null:await fe(),K=R??(B?B.captureContext({page:B.derivePageRef(o.location,mt()),...yt()}):void 0);if(!K)throw new Error(`[${ve}] add() needs the capture chunk, or an explicit context`);return dn(s,i,K,f)},refresh:Ee,setRoute(s){Gt=s&&s.startsWith("/")?s:null,Ee()},setState:pe,getState:()=>L,openPanel:v,async open(s){const i=s.startsWith(xt.thread)?$.find(f=>f.id===s):$.find(f=>f.key===s);return i?i.route!==we(o)?{ok:!1,reason:"wrong-page",url:i.context?.url??i.route,route:i.route}:(await v(i.id),Re?.scrollToSnag(r,n,i),{ok:!0,anchorState:i.anchorState}):{ok:!1,reason:"not-found"}},closePanel:N,hitTest:(s,i)=>S.hitTest(s,i),destroy(){W?.close(),N(),le?.destroy(),ie.destroy(),Ze.destroy(),dt(),vo(),bo(),yo(),$o.destroy(),ko.destroy(),Xe?.destroy(),Xe=null,pt.clear(),$e?.destroy(),$e=null,_?.destroy(),_=null,Ve&&r.clearTimeout(Ve),Ve=0,o.removeEventListener("keydown",un,!0),o.removeEventListener("visibilitychange",hn),m(),S.destroy(),b.destroy(),te.destroy(),n.host.remove()}}}export{vn as HOST_CSS,xn as createHost,Xs as isSensitiveValue,qs as mount,$t as redactText,Ys as redactUrl};
1
+ const xe="Snagset",To="snagset",gn="snagset.v1",Ro="Snagset",zt="Snag",_o="Snags",Io={config:"SnagsetConfig"},Po={root:"data-snag-root"},Ot=e=>Po[e],Mo={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},zo=e=>Mo[e],z={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"},Oo=e=>`var(${z[e]})`,Do=e=>"snag_"+e,vt={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},Lo="snag:disclosure:v1",Dt="snag:identity",yn="data-snag-theme",de={session:e=>`snag:session:${e}`,silent:e=>`snag:silent:${e}`,identity:Dt,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:Lo},Me={panels:"snag.panels.js",crumbs:"snag.crumbs.js",capture:"snag.capture.js",screenshot:"snag.screenshot.js",anchorExt:"snag.anchor-ext.js",anchorFuzzy:"snag.anchor-fuzzy.js",dock:"snag.dock.js",text:"snag.text.js"},wt={thread:"thr_",comment:"cmt_",attachment:"att_"},Lt={attachmentKind:"x-snagset-attachment-kind",attachmentWidth:"x-snagset-attachment-width",attachmentHeight:"x-snagset-attachment-height"},No={route:"snagset:route"},bn={original:"snagset.original",wrapped:"snagset.wrapped"},vn="position:absolute!important;top:0!important;left:0!important;width:0!important;height:0!important;margin:0!important;padding:0!important;border:0!important;pointer-events:none!important;z-index:2147483647;isolation:isolate;color-scheme:light dark;";function wn(e){const t=e.ownerDocument.defaultView?.getComputedStyle(e);return t?t.transform!=="none"&&t.transform!==""||t.filter!=="none"&&t.filter!==""||t.perspective!=="none"&&t.perspective!==""||/transform|filter|perspective|contain/.test(t.willChange)||/paint|layout|strict|content/.test(t.contain)||t.containerType!==void 0&&t.containerType!=="normal"&&t.containerType!=="":!1}function Nt(e){const t=e.documentElement,n=e.body;return t&&wn(t)?{parent:n??t,trapped:!0}:n&&wn(n)?{parent:t??n,trapped:!1}:{parent:n??t,trapped:!1}}function xn(e=document){const t=Ot("root"),n=e.querySelector(`[${t}]`);if(n?.shadowRoot)return n.shadowRoot;const o=e.createElement("div");return o.setAttribute(t,""),o.style.cssText=vn,Nt(e).parent.appendChild(o),o.attachShadow({mode:"open"})}function Ho(e,t,n=5){const o=e.ownerDocument??document,r=e.host,c=Nt(o).parent;if(typeof MutationObserver!="function"||!c)return()=>{};let u=0;const a=new MutationObserver(()=>{if(!r.isConnected){if(u++,u>n){a.disconnect(),t(u);return}Nt(o).parent.appendChild(r)}});return a.observe(c,{childList:!0}),()=>a.disconnect()}const Sn=[["pointerdown",!0],["mousedown",!0],["touchstart",!0],["pointerup",!0],["mouseup",!0],["touchend",!0],["click",!0],["dblclick",!0],["focusin",!0],["focusout",!0]];function Wo(e){const t=e.host,n=o=>o.stopPropagation();for(const[o,r]of Sn)t.addEventListener(o,n,{passive:r});return()=>{for(const[o]of Sn)t.removeEventListener(o,n)}}function jo(e,t,n=20){const o=e.host;if(typeof MutationObserver!="function")return()=>{};let r=0;const c=()=>{let a=!1;return o.getAttribute("aria-hidden")==="true"&&(o.removeAttribute("aria-hidden"),a=!0),o.hasAttribute("inert")&&(o.removeAttribute("inert"),a=!0),a},u=new MutationObserver(()=>{c()&&++r>n&&(u.disconnect(),t(r))});return c(),u.observe(o,{attributes:!0,attributeFilter:["aria-hidden","inert"]}),()=>u.disconnect()}const Uo={product:xe,set:Ro,item:zt,items:_o};function An(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(o,r)=>{const c=n?.[r]??Uo[r];return c===void 0?o:String(c)})}const Fo=e=>new Intl.NumberFormat().format(e),kn={"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}"},$n=An(kn),En={open:{colour:"#4f6ef7"},progress:{colour:"#f59e0b"},review:{colour:"#8b5cf6"},resolved:{colour:"#10b981"}},Cn=e=>e==="open"||e==="review"?"#fff":"#16161a",Tn=e=>e in En?$n(`status.${e}`):e,Bo=e=>$n(`where.${e.anchorState}`,{label:e.anchor.label});class Ht extends Error{code;constructor(t,n){super(n??t),this.name="AdapterError",this.code=t}}function Rn(e){return{id:e.id,key:e.key,route:e.route,...e.scope?{scope:e.scope}:{},...e.attachments?.length?{attachments:e.attachments}:{},anchor:e.anchor,anchorState:e.anchorState,context:e.context,status:"open",comments:e.comment?[{id:e.comment.id,snagId:e.id,body:e.comment.body,author:e.comment.author,createdAt:e.createdAt}]:[],createdBy:e.createdBy,createdAt:e.createdAt,updatedAt:e.createdAt}}const x=Object.fromEntries(Object.keys(z).map(e=>[e,Oo(e)])),Zo=Object.entries(En).map(([e,t])=>` ${z[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
2
+ `),Vo=` :host{all:initial}[hidden]{display:none!important}:host{display:block;font:400 14px/1.45 ${x.font};color:${x.fg};${z.font}:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;${z.accent}:#2a51b8;${z.bg}:#fefdfc;${z.fg}:#181716;${z.muted}:#666564;${z.border}:#e4e3e0;${z.radius}:8px;${z.shadow}:0 6px 24px -4px rgb(0 0 0 / .18);${z.z}:2147483647;${z.motion}:160ms;${z.surface}:color-mix(in srgb,${x.fg} 6%,${x.bg});${z.sunken}:color-mix(in srgb,${x.fg} 3%,${x.bg});${z.hover}:color-mix(in srgb,${x.fg} 8%,${x.bg});${z.onAccent}:#fff;${z.focus}:color-mix(in srgb,${x.accent} 62%,${x.fg});${z.disabled}:color-mix(in srgb,${x.muted} 52%,${x.bg});${Zo} ${z.anchorOrphan}:#DC2626;}:host([${yn}="dark"]){${z.accent}:#8aafff;${z.onAccent}:#1d1c1a;${z.bg}:#1d1c1a;${z.fg}:#f0eeec;${z.muted}:#9a9997;${z.border}:#2d2c2b;${z.shadow}:0 6px 24px -4px rgb(0 0 0 / .6);}@media (prefers-reduced-motion:reduce){:host{${z.motion}:0ms}}@media (forced-colors:active){:host{${z.bg}:Canvas;${z.fg}:CanvasText;${z.muted}:CanvasText;${z.border}:CanvasText;${z.accent}:Highlight;${z.onAccent}:HighlightText;${z.surface}:Canvas;${z.sunken}:Canvas;${z.hover}:Canvas;${z.focus}:Highlight;${z.disabled}:GrayText;${z.shadow}:none;${z.anchorOrphan}:CanvasText;}.snag-pin{border-color:CanvasText!important;color:CanvasText!important;forced-color-adjust:none}}`,Je={shield:1,pins:3,dock:5,notice:6,toolbar:7},_n=new WeakMap;function at(e,t,n){let o=_n.get(e);if(o||_n.set(e,o=new Set),o.has(t))return;o.add(t);try{const u=new CSSStyleSheet;u.replaceSync(n),e.adoptedStyleSheets=[...e.adoptedStyleSheets,u];return}catch{}const c=(e.ownerDocument??document).createElement("style");c.setAttribute(`data-snag-${t}`,""),c.textContent=n,e.appendChild(c)}function Yo(e){return e==="light"||e==="dark"?e:"auto"}function Xo(e,t){const n=yn;if(t!=="auto")return e.setAttribute(n,t),()=>e.removeAttribute(n);const o=e.ownerDocument?.defaultView?.matchMedia?.("(prefers-color-scheme: dark)");if(!o)return e.setAttribute(n,"light"),()=>e.removeAttribute(n);const r=()=>e.setAttribute(n,o.matches?"dark":"light");return r(),o.addEventListener("change",r),()=>{o.removeEventListener("change",r),e.removeAttribute(n)}}function Wt(e){return e.getBoundingClientRect()}function xt(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=Wt(e);if(!(n.width>0||n.height>0||e.getClientRects().length>0))return!1;const r=e.ownerDocument?.defaultView;return r?r.getComputedStyle(e).visibility!=="hidden":!0}const Ko="button,a[href],[role=button],[role=link],[role=tab],[role=menuitem],label,input,select,textarea,summary",Jo=3,In=8,qo=new Set(["img","picture","canvas","video","audio","iframe","embed","object","svg","math","input","select","textarea","button","progress","meter"]);function Qo(e,t){return qo.has(e.tagName.toLowerCase())?!1:t.getComputedStyle(e).display==="inline"}function Pn(e){const t=e.ownerDocument?.defaultView;if(!t)return e;let n=e;for(let r=e;r;r=r.parentElement){const c=Wt(r);if(c.width>=In&&c.height>=In&&!Qo(r,t)){n=r;break}n=r}let o=0;for(let r=n;r&&o<=Jo;r=r.parentElement){if(r.matches(Ko))return r;o++}return n}const Go=10,jt=[["click",!1],["auxclick",!1],["dblclick",!1],["pointerdown",!1],["pointerup",!1],["mousedown",!1],["mouseup",!1],["contextmenu",!1],["dragstart",!1],["wheel",!1],["touchstart",!0],["touchmove",!0],["touchend",!0],["selectstart",!0],["keydown",!1],["keyup",!1]];function er(e,t,n){let o=e;for(;o&&o!==o.ownerDocument.documentElement&&o!==o.ownerDocument.body;){const r=getComputedStyle(o),c=(r.overflowY==="auto"||r.overflowY==="scroll")&&o.scrollHeight>o.clientHeight&&(t>0&&o.scrollTop+o.clientHeight<o.scrollHeight-1||t<0&&o.scrollTop>0),u=(r.overflowX==="auto"||r.overflowX==="scroll")&&o.scrollWidth>o.clientWidth&&(n>0&&o.scrollLeft+o.clientWidth<o.scrollWidth-1||n<0&&o.scrollLeft>0);if(c||u)return o;o=o.parentElement}return null}function Mn(e,t){const n=t==="y"?e.deltaY:e.deltaX;return e.deltaMode===1?n*16:e.deltaMode===2?n*(t==="y"?innerHeight:innerWidth):n}const tr=["position:fixed","inset:0",`z-index:${Je.shield}`,"touch-action:pan-x pan-y pinch-zoom","background:transparent"].join(";");function nr(e,t={}){const n=t.doc??e.ownerDocument??document,o=n.defaultView??window;let r=t.coarsePointer??o.matchMedia?.("(pointer: coarse)").matches??!1;const c=l=>{const b=l.pointerType,E=b==="touch"?!0:b==="mouse"||b==="pen"?!1:r;E!==r&&(r=E,d())},u=n.createElement("div");u.className="snag-shield",u.style.cssText=tr;let a="browse";const d=()=>{u.style.pointerEvents=r?"none":"auto",u.style.cursor="crosshair"};d();const m=l=>{const b=l;return!b||typeof b.closest!="function"?!1:e.contains(b)?!0:!!b.closest(`[${Ot("root")}]`)};function v(l,b,E){let S=E,Q=0;for(;S.shadowRoot&&Q++<Go;){const H=_(S.shadowRoot,l,b);if(!H||H===S)break;S=H}return S}function _(l,b,E){const S=l.elementsFromPoint;if(typeof S=="function"){for(const H of S.call(l,b,E))if(H.getRootNode()===l)return H;return null}const Q=l.elementFromPoint(b,E);return Q&&Q.getRootNode()===l?Q:null}function p(l,b){const E=[];for(const S of n.elementsFromPoint(l,b)){if(m(S))continue;if(S===n.documentElement||S===n.body){E.push(S);continue}const Q=v(l,b,S);E.push(m(Q)?S:Q)}return E}let P=null;const j=(l,b)=>{const[E]=p(l,b);E&&t.onPick?.(Pn(E),{x:l,y:b})};let B=!1;const y=()=>{const l=n.getSelection?.();if(!l||l.isCollapsed||l.rangeCount===0||!l.toString().trim())return!1;const b=l.anchorNode;if(!b||e.contains(b))return!1;const E=b.nodeType===1?b:b.parentElement;return!m(E)},K=l=>{const b=l.composedPath()[0];if(b&&m(b)){B=!1;return}if(l.type==="selectstart"){t.onSelectStart?.();return}const E=l.type;if(E.endsWith("down")||E.endsWith("start")){B=!1;return}if(E.endsWith("up")||E.endsWith("end")){B=y();return}if(E==="click"||E==="auxclick"){if(!B)return;B=!1,l.preventDefault(),l.stopImmediatePropagation()}},re=l=>{if(l.type==="pointerdown"&&c(l),a==="comments"){K(l);return}if(a!=="add")return;if(l.type==="keydown"||l.type==="keyup"){w(l);return}const b=l.composedPath()[0];if(b&&b!==u&&m(b))return;const E=jt.find(([S])=>S===l.type)?.[1]??!1;if(l.stopImmediatePropagation(),!E){if(r&&l.type==="pointerdown"){const S=l;P={x:S.clientX,y:S.clientY,t:performance.now()},D(S.clientX,S.clientY)}if(r&&l.type==="pointerup"&&P){const S=l,Q=P;P=null,Math.hypot(S.clientX-Q.x,S.clientY-Q.y)<=8&&performance.now()-Q.t<=700&&j(S.clientX,S.clientY);return}if(l.type==="click"||l.type==="auxclick"||l.type==="dblclick"){l.preventDefault();const S=l;j(S.clientX,S.clientY);return}if(l.type==="wheel"){const S=l,Q=Mn(S,"y"),H=Mn(S,"x"),[Z]=p(S.clientX,S.clientY),te=er(Z??null,Q,H);te&&(te.scrollTop+=Q,te.scrollLeft+=H,l.preventDefault());return}if(l.type==="dragstart"||l.type==="contextmenu"){l.preventDefault();return}(l.type==="pointerdown"||l.type==="mousedown")&&!r&&l.preventDefault()}},G=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," ","Spacebar","PageUp","PageDown","Home","End"]),J=/^[a-z0-9/?]$/;function h(l){for(const b of l.composedPath()){const E=b;if(!(!E||E.nodeType!==1||typeof E.matches!="function")&&E.matches('input:not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),textarea,select,[contenteditable=""],[contenteditable=true],[role=textbox],[role=searchbox],[role=combobox]'))return!0}return!1}function w(l){G.has(l.key)||l.metaKey||l.ctrlKey||l.altKey||/^F\d{1,2}$/.test(l.key)||l.key!=="Escape"&&l.key.length===1&&J.test(l.key.toLowerCase())&&!h(l)&&(l.preventDefault(),l.stopImmediatePropagation())}for(const[l,b]of jt)o.addEventListener(l,re,{capture:!0,passive:b});let T=0,M=null;function U(){if(T=0,a!=="add"||!M)return;const[l]=p(M.x,M.y);t.onHover?.(l?Pn(l):null)}function D(l,b){a==="add"&&(M={x:l,y:b},!T&&(T=o.requestAnimationFrame(U)))}return u.addEventListener("pointermove",l=>D(l.clientX,l.clientY)),u.addEventListener("pointerleave",()=>{M=null,t.onHover?.(null)}),{shield:u,getMode:()=>a,setMode(l){a=l,B=!1,d(),l==="add"?e.appendChild(u):u.remove(),l!=="add"&&(M=null,t.onHover?.(null))},hitTest:p,destroy(){T&&o.cancelAnimationFrame(T);for(const[l]of jt)o.removeEventListener(l,re,{capture:!0});u.remove()}}}const or=/[\u200B-\u200D\u2060\uFEFF]/gu,rr=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,sr=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function ar(e){let t=e.normalize("NFC").replace(or,"");for(const[n,o]of sr)t=t.replace(n,o);return t.replace(rr," ").trim()}const ir={testid:1,domid:1,css:.9,aria:.75,"text-exact":.8,"text-fuzzy":.78,"path-rect":.35,none:0,manual:1},zn={anchored:.75,approximate:.35};function cr(e,t){const n=ir[e];return t===1?n:n/(1+Math.log2(t))}function On(e){return e>=zn.anchored?"anchored":e>=zn.approximate?"approximate":"orphaned"}const lr=[zo("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],Dn=e=>typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/["\\]/g,"\\$&"),dr=[{strategy:"testid",applicable:e=>!!e.testid,find:(e,t)=>Ut(t,lr.map(n=>`[${n}="${Dn(e.testid)}"]`).join(","))},{strategy:"domid",applicable:e=>!!e.domid,find:(e,t)=>Ut(t,`#${Dn(e.domid)}`)},{strategy:"css",applicable:e=>!!e.css,find:(e,t)=>{try{return Ut(t,e.css)}catch{return[]}}}];function Ut(e,t){return[...e.querySelectorAll(t)].filter(ur)}function ur(e){return!e.closest(`[${Ot("root")}]`)}function fr(e,t){const n=t.text?.exact;if(!n)return!0;const o=ar(e.textContent??"");return o?o===n||o.includes(n)||n.includes(o):!0}function Ln(e,t,n,o){xt(e)||o.push("hidden"),t.hostPath?.length&&o.push("shadow-boundary");const r=!fr(e,t);r&&o.push("text-drift");let c=o.includes("hidden")?Math.min(n,.7):n;return r&&(c=Math.min(c,.5)),c}const hr={element:null,strategy:"none",score:0,state:"orphaned",reasons:["not-found"],candidates:0};function Ft(e,t=document,n={}){const o=[];for(const r of dr){if(!r.applicable(e))continue;const c=r.find(e,t);if(c.length===0)continue;const u=cr(r.strategy,c.length),a=c[0];c.length>1&&o.push("ambiguous");const d=Ln(a,e,u,o),m={element:a,strategy:r.strategy,score:d,state:On(d),reasons:o.length?o:["exact"],candidates:c.length};if(m.reasons.includes("text-drift")&&n.extended){const v=n.extended(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}});if(v&&v.score>m.score)return v}return m}return n.extended?.(e,t,{...n.viewportWidth===void 0?{}:{viewportWidth:n.viewportWidth},...n.passCaches?{caches:n.passCaches}:{}})??hr}const pr={"toolbar.aria":"{product} review toolbar","toolbar.group":"What you see","toolbar.browse":"Browse","toolbar.comments":"Comment","toolbar.comments.unresolved":"Comment, {n} unresolved","toolbar.add":"Add a comment","toolbar.add.draft":"Add a comment \u2014 one is unfinished","toolbar.panel":"All comments","pin.aria":"Comment {key} on {target}. {status}, {replies} replies. Press Enter.","pin.aria.one":"Comment {key} on {target}. {status}, 1 reply. Press Enter.","pin.aria.none":"Comment {key} on {target}. {status}. Press Enter.","pin.aria.moved":"Comment {key} on {target}. {status}. {where}. Press Enter.","pin.target":"{role} \u201C{name}\u201D","cluster.aria":"{n} comments here: {list}","nav.announce":"Comment {n} on {label}, {i} of {total}","action.retry":"Retry","action.dismiss":"Dismiss","action.export":"Export","action.exportclear":"Export & clear","error.quota":"Storage is full \u2014 this {item} is on screen but not saved. Export to keep them.","error.nostorage":"Comments won't be saved in this browser. Export before you leave to keep them.","error.linkrevoked":"This review link was turned off. Ask whoever sent it for a new one.","error.sessionended":"This review session has ended. Open your review link again to carry on.","error.sendfailed":"That {item} couldn't be sent, so it wasn't kept. Check your connection and try again.","error.origin":"{product} is not enabled for {origin}. Add that address to the site's allowed origins.","error.panels":"{product} loaded, but its comment UI didn't. You can still see the comments on the page.","error.panels.add":"Adding comments is unavailable until the comment UI loads.","error.capture":"{product} can't take new comments \u2014 the part that records the page didn't load. Everything already here still works.","paused.dialog":"Review paused \u2014 a dialog is open on this page. Close it to carry on commenting. Commenting inside a native dialog isn't supported yet.","paused.close":"Close","announce.created":"Comment {key} added.","permalink.unknown":"That comment isn't on this page any more"},mr={...kn,...pr},V=An(mr);function gr(e,t){const n=new Array(e.length),o=[],r=new Map,c=[];let u=0;for(let a=0;a<e.length;a++){u++;const d=e[a],m=Math.floor(d.x/t),v=Math.floor(d.y/t);let _=-1;e:for(let p=-1;p<=1;p++)for(let P=-1;P<=1;P++)for(const j of r.get(`${m+p},${v+P}`)??[]){const B=c[j],y=d.x-B.x,K=d.y-B.y;if(y*y+K*K<=t*t){_=j;break e}}if(_===-1){_=o.length,o.push([]),c.push(d);const p=`${m},${v}`,P=r.get(p);P?P.push(_):r.set(p,[_])}n[a]=_,o[_].push(a)}return{group:n,members:o,visits:u}}const yr=`position:absolute;top:0;left:0;width:0;height:0;pointer-events:none;z-index:${Je.pins}`,br=' .snag-pp{animation:snag-pp .5s ease-out 2}@keyframes snag-pp{50%{transform:scale(1.45)}}@media (prefers-reduced-motion: reduce){.snag-pp{animation:none}}.snag-pin{width:28px;height:28px;margin:-14px 0 0 -14px}.snag-pin::after{content:"";position:absolute;inset:-8px}@media (pointer:coarse){.snag-pin{width:34px;height:34px;margin:-17px 0 0 -17px}}',vr=`position:fixed;inset:0;width:0;height:0;pointer-events:none;z-index:${Je.pins}`,it=["position:absolute",`color:${x.onAccent}`,`font:600 12px/1 ${x.font}`,"display:flex","align-items:center","justify-content:center","box-shadow:0 1px 4px rgb(0 0 0 / .35)","pointer-events:auto","cursor:pointer","box-sizing:border-box"].join(";"),St="border-radius:50% 50% 50% 2px",Nn=e=>x[`status${e[0].toUpperCase()}${e.slice(1)}`]??x.muted;function Hn(e,t){const n=Cn(t.status),o=`background:${Nn(t.status)};color:${n}`,r="0 1px 4px rgb(0 0 0 / .35)";return e==="anchored"?`${it};${St};${o};border:2px solid ${n};box-shadow:${r}`:e==="approximate"?`${it};${St};${o};border:2px dashed ${n};box-shadow:${r}`:`${it};${St};${o};border:2px solid ${n};box-shadow:inset 0 0 0 2px ${n},${r}`}function wr(e,t){const n=[];let o="static",r=!1;for(let c=e;c&&c!==e.ownerDocument.documentElement;c=c.parentElement){const u=t.getComputedStyle(c),a=c!==e.ownerDocument.body&&/auto|scroll|hidden|overlay/.test(u.overflowY+u.overflowX);a&&!r&&n.push(c),u.position==="fixed"?(o="dynamic",r=!0):u.transform!=="none"||u.filter!=="none"||u.perspective!=="none"?(o="dynamic",r=!1):(u.position==="sticky"||u.willChange.includes("transform")||u.contain.includes("layout")||a&&(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth))&&(o="dynamic")}return{tier:o,clips:n}}function xr(e,t,n,o){const r=e.ownerDocument??document,c=r.defaultView??window;at(e,"pins",br);const u=r.createElement("div");u.className="snag-pins",u.style.cssText=yr,e.appendChild(u);const a=r.createElement("div");a.className="snag-pins-dyn",a.style.cssText=vr,e.appendChild(a);let d=[],m=[];const v=new Map;let _=new Map,p=null;const P=new Map;let j=new Map;const B=c.matchMedia?.("(pointer: coarse)").matches??!1,y=B?32:24,K=B?34:28;let re=[],G=null,J=null,h={x:0,y:0};function w(){const A=r.defaultView,k=u.getBoundingClientRect();h={x:k.left+(A?.scrollX??0),y:k.top+(A?.scrollY??0)}}let T=[];const M=new Map,U=1e4,D=5,l=new Map,b=new Set(["testid","domid"]);function E(A){const k=l.get(A.id),g=k?.ref.deref();if(!g||!g.isConnected)return null;if(b.has(k.strategy))return g;if(A.anchor.css)try{if(!g.matches(A.anchor.css))return null}catch{return null}return g}function S(A,k){const g=[],L=Ln(k,A.anchor,1,g);return{element:k,strategy:l.get(A.id).strategy,score:L,state:On(L),reasons:g.length?g:["exact"],candidates:1}}function Q(A,k="authoritative"){v.clear(),T=[];const g=Date.now(),L=n?.newPass?.();return A.map(C=>{const O=E(C),$=n?.get();let R=O?S(C,O):Ft(C.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...$?{extended:$}:{},...L?{passCaches:L}:{}});if(O&&R.reasons.includes("text-drift")){const W=Ft(C.anchor,r,{viewportWidth:r.defaultView?.innerWidth??0,...$?{extended:$}:{},...L?{passCaches:L}:{}});W.score>R.score&&(R=W)}if(n&&(!R.element||R.reasons.includes("text-drift"))&&n.want(C.anchor),!R.element&&n){const W=n.fuzzyHit?.(C.id);W?R=W:n.wantFuzzy?.(C.id,C.anchor)}const ee=R.element&&C.anchor.text?.exact&&(R.reasons.includes("text-drift")||R.strategy==="path-rect"&&R.score<.5);if(n&&ee){const W=n.fuzzyHit?.(C.id);W&&W.score>R.score?R=W:W||n.wantFuzzy?.(C.id,C.anchor)}R.element?l.set(C.id,{ref:new WeakRef(R.element),strategy:R.strategy}):l.delete(C.id),R.element&&v.set(C.id,R.element);let Y=!1;if(R.state==="orphaned"){const W=M.get(C.id)??{firstSeenAt:g,tries:0,best:R};W.tries++,R.score>=W.best.score&&(W.best=R),M.set(C.id,W);const se=n?.unavailable?.()??!1,ye=se?2:D,ne=g-W.firstSeenAt<U;k==="optimistic"||ne&&(k==="navigating"||W.tries<ye)?Y=!0:(R=W.best,se&&!R.reasons.includes("budget-exceeded")&&(R={...R,reasons:[...R.reasons,"budget-exceeded"]}),M.delete(C.id))}else M.delete(C.id);Y||T.push({id:C.id,state:R.state,strategy:R.strategy,confidence:R.score});const N=R.element?Wt(R.element):void 0;if(N&&(N.width>0||N.height>0)){const W=r.defaultView;C.anchor.rect={x:N.left+(W?.scrollX??0),y:N.top+(W?.scrollY??0),w:N.width,h:N.height}}return{...C,anchorState:Y?C.anchorState:R.state,anchorPending:Y,anchorReasons:R.reasons}})}function H(){const A=r.documentElement;return{w:A.scrollWidth,h:A.scrollHeight}}function Z(A,k,g){return{x:Math.min(Math.max(A,14),Math.max(g.w,28)-14),y:Math.min(Math.max(k,14),Math.max(g.h,28)-14)}}function te(A,k){w(),u.textContent="",a.textContent="",d=[],m=[],_=new Map,j=new Map,P.clear(),re=[],J=null,A.forEach((g,L)=>{const C=g.anchor.rect;if(!C)return;const O=g.anchor.offset??{fx:.5,fy:.5},$=r.createElement("div");$.className="snag-pin",$.setAttribute("data-state",g.anchorPending?"pending":g.anchorState),$.setAttribute("data-key",g.key),$.style.cssText=g.anchorPending?`${Hn("approximate",g)};opacity:.55`:Hn(g.anchorState,g);const R=v.get(g.id),{tier:ee,clips:Y}=R?wr(R,c):{tier:"static",clips:[]};if(ee==="dynamic"&&R){const oe=R.getBoundingClientRect(),He=ie();$.style.left=`${oe.left-He.left+oe.width*O.fx}px`,$.style.top=`${oe.top-He.top+oe.height*O.fy}px`,P.set($,{x:oe.left+oe.width*O.fx+c.scrollX-h.x,y:oe.top+oe.height*O.fy+c.scrollY-h.y});const be={node:$,el:R,fx:O.fx,fy:O.fy,clips:Y};d.push(be),$.hidden=!xt(R),$.hidden||Re(be,oe,new Map(Y.map(We=>[We,We.getBoundingClientRect()])))}else{const oe=Z(C.x+C.w*O.fx-h.x,C.y+C.h*O.fy-h.y,H());$.style.left=`${oe.x}px`,$.style.top=`${oe.y}px`,P.set($,oe),R&&(m.push({node:$,el:R,fx:O.fx,fy:O.fy,clips:[]}),$.hidden=!xt(R))}$.textContent=String(L+1);const N=Bo(g),W=g.anchor.role?V("pin.target",{role:g.anchor.role,name:g.anchor.accessibleName??g.anchor.label}):g.anchor.label,se=g.comments.length-1,ye=g.anchorState==="approximate"?`~ ${g.key}`:g.key;$.setAttribute("role","button"),$.setAttribute("tabindex","0");const ne=g.anchorState==="anchored"?V(se===0?"pin.aria.none":se===1?"pin.aria.one":"pin.aria",{key:ye,target:W,status:Tn(g.status),replies:se}):V("pin.aria.moved",{key:ye,target:W,status:Tn(g.status),where:N});$.title=ne,$.setAttribute("aria-label",ne),t&&ve($,()=>t(g)),k?.has(g.id)&&($.hidden=!0,$.setAttribute("data-fo","")),_.set(g.id,$),j.set($,{snag:g,ordinal:L+1}),(ee==="dynamic"?a:u).appendChild($)}),le(),p&&ce(p),Ie(),Ne="",et(r.visibilityState==="visible"&&_.size>0)}const ie=()=>a.getBoundingClientRect();let De=!1;function Re(A,k,g){for(const L of A.clips){const C=g.get(L);if(C&&(k.right<=C.left||k.left>=C.right||k.bottom<=C.top||k.top>=C.bottom)){A.node.hidden=!0;return}}A.node.hidden=!1}function Qe(A){const k=new Map;for(const g of A)for(const L of g.clips)k.has(L)||k.set(L,L.getBoundingClientRect());return k}const Et=["open","progress","review","resolved"];function ve(A,k){A.addEventListener("click",k),A.addEventListener("keydown",g=>{g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),k())})}function _e(A,k,g,L,C){const O=Et.find(R=>A.some(ee=>ee.snag.status===R))??"open",$=r.createElement("div");$.className="snag-pin snag-cluster",$.style.cssText=`${it};border-radius:50%;background:${Nn(O)};color:${Cn(O)};border:2px solid ${x.onAccent}`,$.style.left=`${k}px`,$.style.top=`${g}px`,$.textContent=String(A.length),$.setAttribute("data-count",String(A.length)),$.setAttribute("data-state",O),$.setAttribute("role","button"),$.setAttribute("tabindex","0"),C&&$.setAttribute("aria-expanded","true"),$.setAttribute("aria-label",V("cluster.aria",{n:A.length,list:A.map(R=>R.ordinal).join(", ")})),ve($,()=>{if(C)G=null;else if(A.length<=6)G=L;else{o?.(A.map(R=>R.snag.id));return}le()}),u.appendChild($),re.push($)}function Ve(A,k,g,L){_e(A,k,g,L,!0),A.forEach((C,O)=>{const $=k,R=g+(O+1)*(K+12),ee=C.x-$,Y=C.y-R,N=Math.hypot(ee,Y);if(N>4){const se=r.createElement("div");se.className="snag-leader",se.setAttribute("aria-hidden","true"),se.style.cssText=`position:absolute;left:${$}px;top:${R}px;width:${N}px;height:0;border-top:1px solid ${x.onAccent};transform-origin:0 0;transform:rotate(${Math.atan2(Y,ee)}rad)`,u.appendChild(se),re.push(se)}const W=C.dot.cloneNode(!0);W.style.visibility="",W.style.left=`${$}px`,W.style.top=`${R}px`,ve(W,()=>t?.(C.snag)),u.appendChild(W),re.push(W)})}function le(){for(const C of re)C.remove();re=[];const A=[];for(const[C,O]of j){if(C.hidden){C.style.visibility="";continue}const $=P.get(C);$&&A.push({dot:C,snag:O.snag,ordinal:O.ordinal,x:$.x,y:$.y})}const{members:k,visits:g}=gr(A,y);u.setAttribute("data-cv",String(g)),u.setAttribute("data-cp",String(A.length));let L=!1;for(const C of k){if(C.length<2){A[C[0]].dot.style.visibility="";continue}const O=C.map(Y=>A[Y]),$=O.map(Y=>Y.snag.id).sort().join("|");for(const Y of O)Y.dot.style.visibility="hidden";const R=O.reduce((Y,N)=>Y+N.x,0)/O.length,ee=O.reduce((Y,N)=>Y+N.y,0)/O.length;G===$&&O.length<=6?(L=!0,Ve(O,R,ee,$)):_e(O,R,ee,$,!1)}G&&!L&&(G=null)}function Ct(A){J?.remove(),J=null;const k=A.anchor.rect;if(!k)return;const g=A.anchor.offset??{fx:.5,fy:.5},L=r.createElement("div");L.className="snag-pin snag-ghost",L.style.cssText=`${it};${St};background:transparent;border:2px dashed ${x.anchorOrphan};color:${x.anchorOrphan};box-shadow:none;pointer-events:none`;const C=Z(k.x+k.w*g.fx-h.x,k.y+k.h*g.fy-h.y,H());L.style.left=`${C.x}px`,L.style.top=`${C.y}px`,L.setAttribute("aria-hidden","true"),u.appendChild(L),J=L}function Ie(A=!1){const k=A?[...d,...m]:d;De||k.length===0||(De=!0,c.requestAnimationFrame(()=>{De=!1;const g=performance.now(),L=c.scrollX,C=c.scrollY,O=ie(),$=k.map(N=>N.el.isConnected?N.el.getBoundingClientRect():null),R=k.map(N=>N.el.isConnected&&xt(N.el)),ee=Qe(k),Y=H();k.forEach((N,W)=>{const se=$[W];if(!se)return;if(N.node.hasAttribute("data-fo")){N.node.hidden=!0;return}if(!R[W]){N.node.hidden=!0;return}N.node.hidden=!1;const ye=se.left+se.width*N.fx,ne=se.top+se.height*N.fy;if(N.node.parentElement===a)N.node.style.left=`${ye-O.left}px`,N.node.style.top=`${ne-O.top}px`,Re(N,se,ee),P.set(N.node,{x:ye+L-h.x,y:ne+C-h.y});else{const oe=Z(ye+L-h.x,ne+C-h.y,Y);N.node.style.left=`${oe.x}px`,N.node.style.top=`${oe.y}px`,P.set(N.node,oe)}}),le(),u.setAttribute("data-ms",(performance.now()-g).toFixed(2))}))}const Ge=()=>Ie();r.addEventListener("scroll",Ge,{capture:!0,passive:!0});const Ae=typeof c.ResizeObserver=="function"?new c.ResizeObserver(()=>Ie(!0)):null;Ae?.observe(r.documentElement);let Le=null,Ne="";function me(){let A="";for(const k of[...m,...d]){if(!k.el.isConnected)continue;const g=k.el.getBoundingClientRect();A+=`${Math.round(g.left)},${Math.round(g.top)},${Math.round(g.width)};`}!A||A===Ne||(Ne=A,Ie(!0))}function et(A){if(Le&&clearTimeout(Le),Le=null,!A)return;const k=()=>{me(),Le=setTimeout(k,500)};Le=setTimeout(k,500)}const ge=()=>et(r.visibilityState==="visible"&&_.size>0);r.addEventListener("visibilitychange",ge);function Tt(A){const k=_.get(A);k&&(k.classList.remove("snag-pp"),c.requestAnimationFrame(()=>k.classList.add("snag-pp")),c.setTimeout(()=>k.classList.remove("snag-pp"),1400))}function ce(A){const k=p?_.get(p):void 0;k&&(k.style.transform="",k.style.zIndex=""),p=A;const g=A?_.get(A):void 0;g&&(g.style.transform="scale(1.4)",g.style.zIndex="1")}return{el:u,render:te,showGhost:Ct,pulse:Tt,reanchor:Q,settled:()=>T,hasPending:()=>M.size>0,highlight:ce,destroy(){r.removeEventListener("scroll",Ge,{capture:!0}),r.removeEventListener("visibilitychange",ge),Ae?.disconnect(),et(!1),u.remove(),a.remove()}}}const Sr=` .snag-notice{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(24px + var(${z.tbH},56px));z-index:${Je.notice};max-width:min(420px,calc(100vw - 24px));background:${x.bg};color:${x.fg};border:1px solid ${x.border};border-inline-start:3px solid ${x.anchorOrphan};border-radius:${x.radius};box-shadow:${x.shadow};padding:12px 14px;pointer-events:auto;font:400 13px/1.45 ${x.font};display:flex;flex-direction:column;gap:10px}@media (pointer:coarse){.snag-notice{bottom:calc(12px + var(${z.tbH},64px))}}.snag-notice p{margin:0}.snag-notice-actions{display:flex;gap:6px;justify-content:flex-end}.snag-notice button{appearance:none;font:inherit;cursor:pointer;border-radius:calc(${x.radius} - 2px);padding:6px 12px;min-height:30px;border:0;transition:background ${x.motion}}.snag-notice-retry{background:${x.accent};color:${x.onAccent};font-weight:600}.snag-notice-dismiss{background:transparent;color:${x.muted}}.snag-notice-dismiss:hover{background:${x.hover};color:inherit}.snag-notice button:focus-visible{outline:2px solid ${x.focus};outline-offset:2px}`;function Ar(e,t){const n=e.ownerDocument??document,o=n.defaultView??window;at(e,"notice",Sr);const r=n.createElement("div");r.className="snag-notice",r.setAttribute("role","alert"),r.hidden=!0;const c=n.createElement("p"),u=n.createElement("div");u.className="snag-notice-actions";const a=n.createElement("button");a.type="button",a.className="snag-notice-dismiss",a.textContent=V("action.dismiss"),a.addEventListener("click",()=>_());const d=n.createElement("button");d.type="button",d.className="snag-notice-retry",u.append(a,d),r.append(c,u);let m;d.addEventListener("click",()=>{_(),m?.run()});let v=0;function _(){v&&o.cancelAnimationFrame(v),v=0,r.hidden=!0,r.remove()}return{show(p,P,j){m=P,d.hidden=!P,P&&(d.textContent=V(P.label)),r.hidden=!1,c.textContent="",(t??e).appendChild(r);const B=V(p,j);v&&o.cancelAnimationFrame(v),v=o.requestAnimationFrame(()=>{v=0,c.textContent=B})},hide:_,visible:()=>r.isConnected&&!r.hidden,destroy(){r.remove()}}}const kr=` .snag-paused{border:0;padding:0;background:transparent;pointer-events:auto;max-width:min(420px,calc(100vw - 32px))}.snag-paused::backdrop{background:rgb(0 0 0 / .28)}.snag-paused-box{background:${x.bg};color:${x.fg};border:1px solid ${x.border};border-inline-start:3px solid ${x.accent};border-radius:${x.radius};box-shadow:${x.shadow};padding:14px 16px;font:400 13px/1.45 ${x.font};display:flex;flex-direction:column;gap:12px}.snag-paused p{margin:0}.snag-paused-actions{display:flex;justify-content:flex-end}.snag-paused button{appearance:none;font:inherit;cursor:pointer;border:0;font-weight:600;border-radius:calc(${x.radius} - 2px);padding:6px 14px;min-height:30px;background:${x.accent};color:${x.onAccent}}.snag-paused button:focus-visible{outline:2px solid ${x.focus};outline-offset:2px}`;function $r(e,t){const n=e.ownerDocument??document;at(e,"paused",kr);const o=n.createElement("dialog");o.className="snag-paused",o.setAttribute("aria-label",V("paused.dialog"));const r=n.createElement("div");r.className="snag-paused-box",r.setAttribute("role","status");const c=n.createElement("p");c.textContent=V("paused.dialog");const u=n.createElement("div");u.className="snag-paused-actions";const a=n.createElement("button");a.type="button",a.textContent=V("paused.close"),a.addEventListener("click",()=>v()),u.append(a),r.append(c,u),o.append(r);let d=!1;function m(){if(!d){(t??e).appendChild(o);try{o.showModal(),d=!0}catch{o.setAttribute("open",""),d=!0}}}function v(){if(d){d=!1;try{o.close()}catch{o.removeAttribute("open")}o.remove()}}return o.addEventListener("close",()=>{d=!1,o.remove()}),{show:m,hide:v,destroy(){v(),o.remove()}}}const Er=Symbol.for(bn.original),Wn=Symbol.for(bn.wrapped),ct=()=>{};function Cr(e,t,n){let o;try{o=e[t]}catch{return ct}if(typeof o!="function"||o[Wn])return ct;const r=o,c=n(r);let u=!1;const a=function(...d){return u?r.apply(this,d):c.apply(this,d)};try{const d=a;d[Wn]=!0,d[Er]=r,Object.defineProperty(a,"name",{value:r.name,configurable:!0}),Object.defineProperty(a,"length",{value:r.length,configurable:!0})}catch{}try{e[t]=a}catch{return ct}return e[t]!==a?ct:()=>{let d;try{d=e[t]}catch{d=void 0}if(d===a)try{e[t]=r;return}catch{}u=!0}}function Tr(e,t){const n=[];let o=0;const r=()=>{o||(o=e.requestAnimationFrame(()=>{o=0,t.onResize()}))};e.addEventListener("resize",r),n.push(()=>{o&&e.cancelAnimationFrame(o),e.removeEventListener("resize",r)}),e.visualViewport?.addEventListener("resize",r),n.push(()=>e.visualViewport?.removeEventListener("resize",r));const c=()=>void e.setTimeout(t.onResize,250);e.addEventListener("orientationchange",c),n.push(()=>e.removeEventListener("orientationchange",c));let u=e.location.pathname;const a=()=>{const y=e.location.pathname;y!==u&&(u=y,t.onRoute())},d=e.navigation;if(d){const y=()=>void e.setTimeout(a,0);d.addEventListener("navigatesuccess",y),n.push(()=>d.removeEventListener("navigatesuccess",y))}else for(const y of["pushState","replaceState"])n.push(Cr(e.history,y,K=>function(...re){const G=K.apply(this,re);return e.setTimeout(a,0),G}));const m=e.document;let v=!0;try{m.documentElement.matches(":modal")}catch{v=!1}const _=()=>{const y=m.querySelectorAll("dialog[open]");if(!v)return y.length>0;for(const K of y)if(K.matches(":modal"))return!0;return!1};let p=!1;const P=()=>{const y=_();y!==p&&(p=y,t.onModal(y))};m.addEventListener("toggle",P,!0),n.push(()=>m.removeEventListener("toggle",P,!0));const j=new MutationObserver(P);j.observe(m.documentElement,{subtree:!0,attributes:!0,attributeFilter:["open"]}),n.push(()=>j.disconnect());const B=()=>void e.setTimeout(a,0);return e.addEventListener("popstate",B),n.push(()=>e.removeEventListener("popstate",B)),{destroy(){for(const y of n)y();n.length=0}}}function Rr(e,t){try{e.sessionStorage.setItem(de.handoff,JSON.stringify({openThreadId:t}))}catch{}}function _r(e){try{const t=e.sessionStorage.getItem(de.handoff);if(t===null)return null;e.sessionStorage.removeItem(de.handoff);const n=JSON.parse(t);return typeof n.openThreadId=="string"?n.openThreadId:null}catch{return null}}function Ir(){return{statuses:[],read:"all",pageOnly:!1,newOnly:!1,sort:"page"}}const Pr=["open","progress","review","resolved"];function Mr(e,t,n){if(t.statuses.length>0&&Pr.includes(e.status)&&!t.statuses.includes(e.status)||t.by&&e.createdBy.id!==t.by||t.page&&e.route!==t.page)return!1;if(t.read!=="all"&&n){const o=zr(e,n);if(t.read==="unread"&&!o||t.read==="read"&&o)return!1}return!0}function zr(e,t){const n=t.get(e.id)??0;return Date.parse(e.updatedAt)>n}function Or(e,t,n){const o=e.visualViewport;let r=0;const c=()=>{if(r=0,!o)return;const a=o.offsetLeft,d=o.offsetTop;t.style.translate=a||d?`${a}px ${d}px`:"",t.style.width=`${o.width}px`,t.style.height=`${o.height}px`,n?.(o.scale)},u=()=>{r||(r=e.requestAnimationFrame(c))};return o?.addEventListener("resize",u,{passive:!0}),o?.addEventListener("scroll",u,{passive:!0}),u(),()=>{r&&e.cancelAnimationFrame(r),o?.removeEventListener("resize",u),o?.removeEventListener("scroll",u)}}const Dr=/^eyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/,Lr=/^[a-f0-9]{32,}$/i,Nr=/^(?=[A-Za-z0-9_-]{24,}$)(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]+$/,Hr="[redacted]";function jn(e){return e.includes("/")?e.split("/").map(t=>Dr.test(t)||Lr.test(t)||Nr.test(t)?Hr:t).join("/"):e}const Wr=/\/index\.(html?|php)$/i;function jr(e){if(!e.startsWith("/"))return e;let t=e.replace(Wr,"/");return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t.toLowerCase()}function Ur(e){try{const t=e.querySelector(`meta[name="${No.route}"]`)?.getAttribute("content")?.trim();return!t||t.length>512||!t.startsWith("/")?null:t}catch{return null}}function Fr(e,t){const n=t??Ur(e);return jr(n??jn(e.location.pathname))}const Br=[/^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$/],Zr=[...vt.query,...vt.fragment];function Vr(e,t=[]){return Zr.includes(e)||t.includes(e)?!0:Br.some(n=>n.test(e))}function Yr(e,t={}){const n=t.significantQueryParams??[];if(n!=="*"&&n.length===0)return;let o;try{o=new URLSearchParams(e)}catch{return}const r={};for(const[c,u]of o)Vr(c,t.ignoredQueryParams??[])||n!=="*"&&!n.includes(c)||(r[c]=u);return Object.keys(r).length>0?r:void 0}function Xr(e,t,n={}){const o=n.significantQueryParams??[];if(o==="*"){const r=e??{},c=t??{},u=new Set([...Object.keys(r),...Object.keys(c)]);for(const a of u)if(r[a]!==c[a])return!1;return!0}for(const r of o)if((e?.[r]??void 0)!==(t?.[r]??void 0))return!1;return!0}const Kr=120,Jr=1e3,qr=200,Qr=1e4;function Gr(e,t,n){const o=t.MutationObserver;if(typeof o!="function")return{destroy:()=>{}};let r=!1,c=null,u=!1,a=!1,d=0,m=_(),v=0;function _(){return t.performance?.now?.()??0}const p=new o(()=>{r=!0,d++,j()});function P(){const y=_();return y-m>=1e3&&(d>qr&&(v=y+Qr),d=0,m=y),y<v?Jr:Kr}function j(){c||(c=setTimeout(B,P()))}function B(){if(c=null,!!r){if(u){a=!0;return}r=!1,u=!0;try{n()}finally{u=!1,a&&(a=!1,r=!0,j())}}}return p.observe(e.documentElement,{childList:!0,subtree:!0}),{destroy(){p.disconnect(),c&&clearTimeout(c),c=null}}}const es="0.0.0",ts={capture:Me.capture,"anchor-ext":Me.anchorExt,"anchor-fuzzy":Me.anchorFuzzy,crumbs:Me.crumbs,screenshot:Me.screenshot,dock:Me.dock,text:Me.text},Un=new Map,Bt=new Map,Fn=new Map;function ns(e,t,n){const o=new URL(t,n.location.href).href,r=new URL(ts[e],o);r.searchParams.set("cv",es);const c=Fn.get(e)??0;return c>0&&r.searchParams.set("r",String(c)),Fn.set(e,c+1),r.href}async function ze(e,t,n=document){const o=Un.get(e);if(o)return{ok:!0,mod:o};const r=Bt.get(e);if(r)return r;const c=(async()=>{for(let u=0;u<2;u++)try{const a=await import(ns(e,t,n));return Un.set(e,a),{ok:!0,mod:a}}catch{}return{ok:!1,reason:"unavailable"}})();Bt.set(e,c);try{return await c}finally{Bt.delete(e)}}const os="composer",Zt=e=>de.draft(e,os),rs=de.draft("\0","").split("\0")[0];function ss(e){try{return e.body.trim()?(localStorage.setItem(Zt(e.route),JSON.stringify(e)),!0):(Bn(e.route),!0)}catch{return!1}}function as(e){try{const t=localStorage.getItem(Zt(e));if(!t)return null;const n=JSON.parse(t);return!n||typeof n.body!="string"||!n.anchor||n.route!==e?null:n}catch{return null}}function Bn(e){try{localStorage.removeItem(Zt(e))}catch{}}function Vt(){try{for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);if(t&&t.startsWith(rs))return!0}return!1}catch{return!1}}const is="http://www.w3.org/2000/svg";function Oe(e,t,n,o=[]){const r=e.createElementNS(is,t);for(const c in n)r.setAttribute(c,n[c]);for(const c of o)r.appendChild(c);return r}const Yt=(e,t="16",n="16",o="0 0 16 16")=>({width:t,height:n,viewBox:o,fill:"none","aria-hidden":"true"}),cs=e=>Oe(e,"svg",Yt(),[Oe(e,"path",{d:"M8 3v10M3 8h10",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round"})]),ls=e=>Oe(e,"svg",Yt(),[Oe(e,"rect",{x:"2.25",y:"3.25",width:"11.5",height:"9.5",rx:"1.75",stroke:"currentColor","stroke-width":"1.5"}),Oe(e,"path",{d:"M9.5 3.5v9",stroke:"currentColor","stroke-width":"1.5"})]),ds=e=>Oe(e,"svg",{...Yt(e,"10","16","0 0 10 16"),fill:"currentColor"},[Oe(e,"g",{fill:"currentColor"},[4,8,12].flatMap(t=>[3,7].map(n=>Oe(e,"circle",{cx:String(n),cy:String(t),r:"1"}))))]),us=` .snag-tb{position:fixed;z-index:${Je.toolbar};display:flex;align-items:center;gap:2px;padding:4px;border-radius:calc(${x.radius} + 4px);background:${x.bg};color:${x.fg};box-shadow:${x.shadow};font:500 13px/1 ${x.font};pointer-events:auto;user-select:none;border:1px solid ${x.border}}.snag-tb{transition:inset-inline-end ${x.motion}}.snag-tb--fine{inset-inline-end:calc(20px + env(safe-area-inset-right) + var(${z.dockW},0px));inset-block-end:calc(20px + env(safe-area-inset-bottom));transition:inset-inline-end ${x.motion}}.snag-tb--coarse{inset-inline:0;inset-block-end:0;border-radius:14px 14px 0 0;padding:6px 10px calc(6px + env(safe-area-inset-bottom));justify-content:center;gap:4px;flex-direction:column}.snag-grabber{width:36px;height:4px;border-radius:2px;background:${x.muted};margin:2px auto 6px}.snag-row{display:flex;align-items:center;gap:2px}.snag-grip{display:flex;align-items:center;padding:0 4px;color:${x.muted};cursor:grab;touch-action:none}.snag-grip:active{cursor:grabbing}.snag-seg{display:flex;background:${x.surface};border-radius:${x.radius};padding:2px;position:relative}.snag-seg::before{content:"";position:absolute;inset-block:2px;inset-inline-start:var(${z.thumbX},0);width:var(${z.thumbW},0);background:${x.accent};border-radius:calc(${x.radius} - 2px);pointer-events:none;transition:inset-inline-start ${x.motion},width ${x.motion}}.snag-seg>.snag-b[aria-pressed="true"]{background:transparent;color:${x.onAccent}}.snag-seg>.snag-b{z-index:1}.snag-b{appearance:none;border:0;background:transparent;color:inherit;font:inherit;padding:6px 11px;border-radius:calc(${x.radius} - 2px);cursor:pointer;display:flex;align-items:center;gap:6px;position:relative;min-height:32px;transition:background ${x.motion}}.snag-b:hover:not(:disabled){background:color-mix(in srgb,currentColor 12%,transparent)}.snag-b:disabled{opacity:.4;cursor:not-allowed}.snag-b[aria-pressed="true"]{background:${x.accent};color:${x.onAccent}}.snag-b:focus-visible{outline:2px solid ${x.focus};outline-offset:2px}.snag-icon{padding:6px 9px}@media (pointer:coarse){.snag-b{min-height:44px;min-width:44px;padding:6px 14px}.snag-icon{padding:6px 14px}}.snag-puck .snag-row>:not([aria-expanded]){display:none}.snag-puck{padding:4px;border-radius:50%}.snag-puck [aria-expanded]{min-width:44px;min-height:44px;border-radius:50%}`;function fs(e,t){const n=e.ownerDocument??document,o=t.coarsePointer??n.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;at(e,"toolbar",us);const r=n.createElement("div");r.className=`snag-tb ${o?"snag-tb--coarse":"snag-tb--fine"}`,r.setAttribute("role","toolbar"),r.setAttribute("aria-label",V("toolbar.aria"));const c=n.createElement("div");c.className="snag-grabber",c.setAttribute("aria-hidden","true");const u=n.createElement("div");u.className="snag-row";const a=n.createElement("span");a.className="snag-grip",a.setAttribute("aria-hidden","true"),a.appendChild(ds(n));const d=n.createElement("div");d.className="snag-seg",d.setAttribute("role","group"),d.setAttribute("aria-label",V("toolbar.group"));const m=(l,b,E)=>{const S=n.createElement("button");return S.type="button",S.className=`snag-b ${l}`,S.setAttribute("aria-label",b),typeof E=="string"?S.textContent=E:S.appendChild(E),S},v=m("",V("toolbar.browse"),V("toolbar.browse")),_=m("",V("toolbar.comments"),V("toolbar.comments")),p=m("snag-icon",V("toolbar.add"),cs(n)),P=m("snag-icon",V("toolbar.panel"),ls(n));P.setAttribute("aria-expanded","false"),d.append(v,_),o||u.appendChild(a),u.append(d,p,P),o&&r.appendChild(c),r.appendChild(u),(t.parent??e).appendChild(r);const j=()=>{e.host.style.setProperty(z.tbH,`${r.offsetHeight}px`)};j();let B=null;function y(l,b){const E=n.defaultView,S=r.offsetWidth,Q=r.offsetHeight,H=Zn(l,8,Math.max(8,E.innerWidth-S-8)),Z=Zn(b,8,Math.max(8,E.innerHeight-Q-8));B={left:H,top:Z},r.style.left=`${H}px`,r.style.top=`${Z}px`,r.style.right="auto",r.style.bottom="auto"}const K=()=>{j(),B&&y(B.left,B.top)},re=n.defaultView;if(re?.addEventListener("resize",K),v.addEventListener("click",()=>t.onState("browse")),_.addEventListener("click",()=>t.onState("comments")),p.addEventListener("click",()=>t.onState(G==="add"?"comments":"add")),P.addEventListener("click",()=>t.onPanel()),!o){let l=null;a.addEventListener("pointerdown",E=>{l={x:E.clientX,y:E.clientY,r:r.getBoundingClientRect()},a.setPointerCapture(E.pointerId),E.preventDefault()}),a.addEventListener("pointermove",E=>{l&&y(l.r.left+(E.clientX-l.x),l.r.top+(E.clientY-l.y))});const b=E=>{l=null,a.hasPointerCapture(E.pointerId)&&a.releasePointerCapture(E.pointerId)};a.addEventListener("pointerup",b),a.addEventListener("pointercancel",b)}let G="browse";function J(l){G=l,v.setAttribute("aria-pressed",String(l==="browse")),_.setAttribute("aria-pressed",String(l!=="browse")),p.setAttribute("aria-pressed",String(l==="add")),h()}function h(){const l=d.querySelector('.snag-b[aria-pressed="true"]'),b=d.getBoundingClientRect(),E=l?.getBoundingClientRect();if(!l||!E?.width){d.style.setProperty(z.thumbW,"0px");return}const S=n.defaultView?.getComputedStyle(d),Q=S?.direction==="rtl",H=parseFloat((Q?S?.paddingRight:S?.paddingLeft)??"0")||0,Z=(Q?b.right-E.right:E.left-b.left)-H;d.style.setProperty(z.thumbW,`${Math.round(E.width)}px`),d.style.setProperty(z.thumbX,`${Math.max(0,Math.round(Z))}px`)}function w(l){p.disabled=l,l?p.title=V("error.panels.add"):p.removeAttribute("title")}function T(l){p.setAttribute("aria-label",V(l?"toolbar.add.draft":"toolbar.add"))}function M(l){_.setAttribute("aria-label",l!==null&&l>0?V("toolbar.comments.unresolved",{n:Fo(l)}):V("toolbar.comments"))}J("browse"),M(0);function U(l){r.classList.toggle("snag-puck",l),l||h()}function D(l){r.hidden=l,l||h(),j()}return{el:r,setState:J,setCount:M,setDegraded:w,setDraft:T,setPuck:U,setConcealed:D,destroy(){re?.removeEventListener("resize",K),e.host.style.removeProperty(z.tbH),r.remove()}}}const Zn=(e,t,n)=>e<t?t:e>n?n:e,Vn=24;function hs(e,t){const n=e.innerHeight,o=t.querySelector(".snag-dk");if(!o)return{top:0,bottom:n};const r=o.getBoundingClientRect();return r.height>=n-1?{top:0,bottom:n}:{top:0,bottom:Math.max(0,r.top)}}function ps(e,t,n){const o=n.anchor.rect;if(!o)return;const r=n.anchor.offset??{fy:.5},c=o.y+o.h*r.fy,u=hs(e,t),a=c-e.scrollY;if(a>=u.top+Vn&&a<=u.bottom-Vn)return;const d=e.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;e.scrollTo({top:Math.max(0,c-(u.top+u.bottom)/2),behavior:d?"auto":"smooth"})}function Xt(){const e=new Uint8Array(16);crypto.getRandomValues(e);const t=Date.now();e[0]=Math.floor(t/2**40)&255,e[1]=Math.floor(t/2**32)&255,e[2]=Math.floor(t/2**24)&255,e[3]=Math.floor(t/2**16)&255,e[4]=Math.floor(t/2**8)&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128;const n=Array.from(e,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}const ms=()=>wt.thread+Xt(),Yn=()=>wt.comment+Xt(),gs=()=>wt.attachment+Xt(),ys={attachments:"direct",realtime:"none",anchorReports:!1,identity:["guest"],export:["json","md"],serverSideSearch:!1,privateThreads:!1,assignees:!1};function bs(){const e=de.threads("probe","probe");try{return localStorage.setItem(e,"1"),localStorage.removeItem(e),!0}catch(t){return Xn(t)}}function vs(e,t,n){const o=de.threads(e,t);function r(){let a=null;try{a=localStorage.getItem(o)}catch{return[]}if(!a)return[];try{const d=JSON.parse(a);return Array.isArray(d)?d.filter(xs):[]}catch{return[]}}function c(a){try{localStorage.setItem(o,JSON.stringify(a))}catch(d){if(!Xn(d))return;throw new Ht("local_quota_exceeded")}}const u=a=>({...a,updatedAt:new Date().toISOString()});return{kind:"local",capabilities:ys,async init(a){return{uid:a.uid,env:a.env,features:{screenshots:!0,uploads:!1}}},async listThreads(a={}){let d=r();return a.route!==void 0&&(d=d.filter(m=>m.route===a.route)),a.status?.length&&(d=d.filter(m=>a.status.includes(m.status))),{data:d,serverTime:new Date().toISOString()}},async getThread(a){return r().find(d=>d.id===a)??null},async createThread(a){const d=Rn(a);return c([...r(),d]),d},async patchThread(a,d){const m=r(),v=m.findIndex(j=>j.id===a);if(v<0)return null;const{assignee:_,...p}=d,P=u({...m[v],...ws(p)});return m[v]=P,c(m),P},async deleteThread(a){const d=r(),m=d.find(_=>_.id===a),v=d.filter(_=>_.id!==a);v.length!==d.length&&c(v);for(const _ of m?.attachments??[])n?.del(_.id).catch(()=>{})},async uploadAttachment(a,d){if(!n)throw new Ht("attachments_unsupported");const m=gs();return await n.put(m,{blob:a,uid:e,env:t,kind:d.kind,...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{},createdAt:Date.now()}),{id:m,kind:d.kind,url:"",...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{},bytes:a.size,contentType:a.type}},async createComment(a,d){const m=r(),v=m.findIndex(p=>p.id===a);if(v<0)return null;const _={id:d.id,snagId:a,body:d.body,author:d.author,createdAt:new Date().toISOString()};return m[v]=u({...m[v],comments:[...m[v].comments,_]}),c(m),_},async patchComment(a,d){const m=r();for(let v=0;v<m.length;v++){const _=m[v].comments.find(P=>P.id===a);if(!_)continue;const p={..._,body:d};return m[v]=u({...m[v],comments:m[v].comments.map(P=>P.id===a?p:P)}),c(m),p}return null},async deleteComment(a){const d=r(),m=d.findIndex(v=>v.comments.some(_=>_.id===a));m<0||(d[m]=u({...d[m],comments:d[m].comments.filter(v=>v.id!==a)}),c(d))}}}function ws(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Xn(e){return e instanceof Error?e.name==="QuotaExceededError"||e.name==="NS_ERROR_DOM_QUOTA_REACHED"||e.code===22||e.code===1014:!1}function xs(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id=="string"&&typeof t.key=="string"&&typeof t.route=="string"&&typeof t.anchor=="object"&&t.anchor!==null&&typeof t.anchor.label=="string"&&Array.isArray(t.comments)}function Ss(e,t,n=()=>Date.now()){const o=de.seen(e,t);let r=null;function c(){if(r)return r;try{const a=localStorage.getItem(o),d=a?JSON.parse(a):{};return r=typeof d=="object"&&d!==null&&!Array.isArray(d)?d:{}}catch{return r={}}}function u(a){r=a;try{localStorage.setItem(o,JSON.stringify(a))}catch{}}return{map:()=>new Map(Object.entries(c())),mark(a){u({...c(),[a]:n()})},markAll(a){const d=n(),m={...c()};for(const v of a)m[v.id]=d;u(m)}}}function lt(){let e=null;try{e=localStorage.getItem(Dt)}catch{return{}}if(!e)return{};if(e[0]!=="{")return{name:e};try{const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function Kn(e){try{localStorage.setItem(Dt,JSON.stringify(e))}catch{}}function Kt(){const e=lt();return{name:typeof e.name=="string"?e.name:"",...e.email?{email:e.email}:{}}}function Jn(e){return lt().projects?.[e]?.holderId}function As(e){const t=lt().projects?.[e]?.holderSecret;return t&&/^[\w-]{43}$/.test(t)?t:void 0}function ks(e,t,n){const o=lt();Kn({...o,projects:{...o.projects,[e]:{holderId:t,holderSecret:n}}})}function $s(e,t){const n=lt(),o=n.projects?.[e];o&&Kn({...n,projects:{...n.projects,[e]:{...o,holderId:t}}})}const Ze=e=>de.session(e);function qn(e){if(!e)return null;const t=JSON.parse(e);return typeof t?.token=="string"&&typeof t?.refreshableUntil=="number"?t:null}function qe(e){try{const t=qn(sessionStorage.getItem(Ze(e)));if(t)return t;const n=qn(localStorage.getItem(Ze(e)));return n?.member?n:null}catch{return null}}function Jt(e,t){try{t.member?(localStorage.setItem(Ze(e),JSON.stringify(t)),sessionStorage.removeItem(Ze(e))):sessionStorage.setItem(Ze(e),JSON.stringify(t))}catch{}}function dt(e){try{sessionStorage.removeItem(Ze(e)),localStorage.removeItem(Ze(e))}catch{}}const Es=(e,t=Date.now())=>t>e.expiresAt-3e4,qt=(e,t=Date.now())=>t>=e.refreshableUntil;class Ce extends Error{code;status;constructor(t,n,o){super(o),this.name="HttpAdapterError",this.status=t,this.code=n}}function Cs(e){const{offset:t,testId:n,domId:o,page:r,schemaVersion:c,...u}=e;return{...u,...n?{testid:n}:{},...o?{domid:o}:{},...t?{offset:{fx:t.x,fy:t.y}}:{}}}function Ts(e,t){const n=e.url??"",o=/^https?:/i.test(n)?n:n?`${t}${n.startsWith("/")?"":"/"}${n}`:`${t}/api/v1/attachments/${encodeURIComponent(e.id)}/blob`;return{...e,url:o}}function At(e,t,n){return{id:e.id,route:e.anchor?.page?.route??"",key:e.key,status:e.status,anchor:Cs(e.anchor),anchorState:e.anchorState,context:e.context,comments:e.comments??[],createdBy:e.createdBy,assignee:e.assignee??null,createdAt:e.createdAt,updatedAt:e.updatedAt,...e.resolvedAt?{resolvedAt:e.resolvedAt}:{},...e.attachments?.length?{attachments:e.attachments.map(o=>Ts(o,n))}:{},...t?{scope:{environment:t}}:{}}}function Rs(e,t){const{offset:n,testid:o,domid:r,...c}=e;return{...c,schemaVersion:gn,...o?{testId:o}:{},...r?{domId:r}:{},offset:n?{x:n.fx,y:n.fy}:{x:.5,y:.5},page:{route:t,pathname:location.pathname,origin:location.origin}}}function _s(e,t){const n=o=>/^[\d.]+$|:/.test(o)?o:o.split(".").slice(-2).join(".");return n(e)===n(t)}const Qn=10*6e4;function Is(e,t,n,o={}){const r=e.replace(/\/+$/,""),c=`${r}/api/v1/projects/${encodeURIComponent(t)}`;let u=o.reviewToken,a=qe(t),d=[];const m=de.silent(t);let v=0,_=Promise.resolve(!1);function p(){if(u||Date.now()-v<Qn)return _;try{if(!_s(location.hostname,new URL(r).hostname)||localStorage.getItem(m)||Date.now()-Number(sessionStorage.getItem(m))<Qn)return _}catch{}return v=Date.now(),_=(async()=>{try{const h=await fetch(`${c}/sessions/member/silent`,{method:"POST",credentials:"include",...n?{body:JSON.stringify({environment:n})}:{}});if(h.status===201)return j(await h.json()),v=0,!0}catch{}try{sessionStorage.setItem(m,String(Date.now()))}catch{}return!1})()}let P=null;function j(h){a={token:h.sessionToken,expiresAt:Date.parse(h.expiresAt),refreshableUntil:Date.parse(h.refreshableUntil),reviewerId:h.reviewer.id,permissions:h.permissions,member:h.reviewer.name,...h.moderator?{moderator:!0}:{}},Jt(t,a),o.onSessionStarted?.()}const B=()=>a;async function y(h=!1){const w=a&&!qt(a)?a.token:null,T=!!w&&!u&&!h,M=T?void 0:u?{kind:"link",token:u,name:Kt().name||void 0}:{kind:"guest",name:Kt().name||"Anonymous",holderId:Jn(t),holderSecret:As(t)};let U;try{U=await fetch(`${c}/sessions`,{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...w?{Authorization:`Bearer ${w}`}:{}},body:JSON.stringify({...n?{environment:n}:{},...M?{identity:M}:{},client:{widget:To,schema:gn}})})}catch(E){throw new Ce(0,"network_error",E.message)}finally{u=void 0}if(!U.ok){const S=(await U.json().catch(()=>null))?.error?.code??"unauthorized",Q=T&&!!a?.member;if(dt(t),a=null,Q&&U.status===401&&await p())return B();throw S==="session_revoked"||S==="token_revoked"?o.onSessionEnded?.("revoked"):U.status===401&&o.onSessionEnded?.("expired"),new Ce(U.status,S,"This review session is not valid.")}const D=await U.json();D.holderSecret&&D.reviewer?ks(t,D.reviewer.id,D.holderSecret):D.reviewer&&$s(t,D.reviewer.id);const l=D.round?.number??(T||h?a?.round:void 0),b=M?M.name:a?.name;return a={token:D.sessionToken,expiresAt:Date.parse(D.expiresAt),refreshableUntil:Date.parse(D.refreshableUntil),reviewerId:D.reviewer?.id??a?.reviewerId??"",permissions:D.permissions??a?.permissions??[],...l!==void 0?{round:l}:{},...T&&a?.member?{member:a.member}:{},...T&&a?.member&&a.moderator?{moderator:!0}:{},...b?{name:b}:{}},Jt(t,a),o.onSessionStarted?.(),a}async function K(){if(a){if(qt(a)){dt(t),a=null,await p()||o.onSessionEnded?.("expired");return}await y().catch(()=>{})}}let re=null;async function G(){if(await(P??=a?.member?Promise.resolve():p()),a&&qt(a)&&(dt(t),a=null,!await p()))return o.onSessionEnded?.("expired"),null;const h=Kt().name||null,w=a!==null&&!a.member&&h!==null&&h!==(a.name??null);if(!a||Es(a)||u||w)try{await(re??=y(w).finally(()=>re=null))}catch(T){if(!(T instanceof Ce)||T.status===0)throw T;return null}return a?.token??null}async function J(h,w,T=!1){const M=await G();let U;try{U=await fetch(c+h,{...w,headers:{"content-type":"application/json",...M?{Authorization:`Bearer ${M}`}:{},...w?.headers??{}},credentials:"omit"})}catch(D){throw new Ce(0,"network_error",D.message)}if(!U.ok){const D=await U.json().catch(()=>null),l=D?.error?.code??"http_error";if(U.status===401&&!T&&l!=="session_revoked"){const b=!!a?.member;return dt(t),a=null,b&&await p(),J(h,w,!0)}throw new Ce(U.status,l,D?.error?.message??`The server answered ${U.status}.`)}return await U.json()}return{kind:"http",capabilities:{attachments:"none",realtime:"none",anchorReports:!0,identity:["guest"],export:[],serverSideSearch:!1,privateThreads:!1,assignees:!0},async init(h){G().catch(()=>{});const w=await fetch(`${c}/config`).catch(M=>{throw new Ce(0,"network_error",M.message)});if(!w.ok)throw new Ce(w.status,"http_error",`The server answered ${w.status}.`);const T=await w.json();return this.capabilities.attachments=T.features.screenshots?"direct":"none",d=T.rounds??[],{uid:h.uid,env:h.env,features:T.features,...T.rounds?{rounds:T.rounds}:{},...T.writable===void 0?{}:{writable:T.writable},...T.reason===void 0?{}:{reason:T.reason}}},async reportAnchors(h){if(h.length!==0)for(let w=0;w<h.length;w+=50)try{await J("/anchor-reports",{method:"POST",body:JSON.stringify({reports:h.slice(w,w+50)})})}catch{return}},revalidate:K,member:()=>a?.member??null,adoptSession(h){try{localStorage.removeItem(m)}catch{}j(h)},signOut(){dt(t),a=null;try{localStorage.setItem(m,"out")}catch{}},getRound(){return a?.round??qe(t)?.round??null},setRound(h){a&&(a={...a,round:h});const w=qe(t);w&&Jt(t,{...w,round:h})},async fetchForeignImage(h){try{const w=await G(),T=await fetch(`${c}/image?src=${encodeURIComponent(h)}`,{credentials:"omit",...w?{headers:{Authorization:`Bearer ${w}`}}:{}});if(!T.ok)return null;const M=await T.blob();return M.type.startsWith("image/")?M:null}catch{return null}},async uploadAttachment(h,w){const T=await G(),M=await fetch(`${c}/attachments`,{method:"POST",credentials:"omit",headers:{"content-type":h.type||"image/webp",[Lt.attachmentKind]:w.kind,...w.width?{[Lt.attachmentWidth]:String(w.width)}:{},...w.height?{[Lt.attachmentHeight]:String(w.height)}:{},...T?{Authorization:`Bearer ${T}`}:{}},body:h});if(!M.ok){const D=await M.json().catch(()=>null);throw new Ce(M.status,D?.error?.code??"upload_failed",D?.error?.message??"Upload failed.")}const U=await M.json();return{id:U.id,kind:w.kind,contentType:U.contentType,byteSize:U.byteSize,...w.width?{width:w.width}:{},...w.height?{height:w.height}:{},url:`${r}/api/v1/attachments/${U.id}/blob`}},async listThreads(h){const w=!a&&!u;w?G().catch(()=>{}):await G();const T=new URLSearchParams;n&&T.set("env",n),h?.route&&T.set("route",h.route),a?.round&&T.set("round",String(a.round));const M=`/threads?${T}`,U=()=>J(M),D=w?await fetch(c+M,{credentials:"omit"}).then(l=>l.ok?l.json():U(),U):await U();return{data:D.data.map(l=>At(l,n,r)),...D.nextCursor?{nextCursor:D.nextCursor}:{},deleted:[],serverTime:D.serverTime}},async getThread(h){return(await this.listThreads()).data.find(T=>T.id===h)??null},async getThreadByKey(h){const w=new URLSearchParams({key:h});n&&w.set("env",n);const M=(await J(`/threads?${w}`)).data[0];return M?At(M,n,r):null},async createThread(h){const w=a?.round,T=d.some(D=>D.number===w&&!D.closed)?w:void 0,M=D=>J("/threads",{method:"POST",body:JSON.stringify({id:h.id,anchor:Rs(h.anchor,h.route),anchorState:h.anchorState,context:h.context,...n||D?{scope:{...n?{environment:n}:{},...D?{round:D}:{}}}:{},createdBy:{name:h.createdBy.name},...h.comment?{comment:{id:h.comment.id,body:h.comment.body}}:{},...h.attachments?.length?{attachments:h.attachments.map(l=>l.id)}:{}})}),U=await M(T).catch(D=>{if(T&&D instanceof Ce&&D.code.startsWith("round_"))return M();throw D});return At(U,n,r)},async patchThread(h,w){const T="assignee"in w;if(!w.status&&!T)return null;const M=await J(`/threads/${encodeURIComponent(h)}`,{method:"PATCH",body:JSON.stringify({...w.status?{status:w.status}:{},...T?{assignee:w.assignee??null}:{}})});return At(M,n,r)},async listAssignees(h){return(await J(`/assignees${h?`?q=${encodeURIComponent(h)}`:""}`)).data??[]},async deleteThread(h){await J(`/threads/${encodeURIComponent(h)}`,{method:"DELETE"})},isMine(h){return h.id?h.id===(a??qe(t))?.reviewerId||h.id===Jn(t):!1},canModerate(){const h=a??qe(t);return!!h?.member&&!!h.moderator},can(h){return(a??qe(t))?.permissions.includes(h)??!1},async createComment(h,w){const T=await J(`/threads/${encodeURIComponent(h)}/comments`,{method:"POST",body:JSON.stringify({id:w.id,body:w.body})});return{id:T.id,snagId:h,body:T.body,author:T.author,createdAt:T.createdAt}},async patchComment(h,w){return await J(`/comments/${encodeURIComponent(h)}`,{method:"PATCH",body:JSON.stringify({body:w})}),null},async deleteComment(h){await J(`/comments/${encodeURIComponent(h)}`,{method:"DELETE"})}}}async function Ps(e,t){if(e.url&&/^https?:/i.test(e.url))try{const n=await fetch(e.url,{credentials:"omit"});if(!n.ok)return null;const o=await n.blob();return o.type&&!o.type.startsWith("image/")?null:o}catch{return null}return t(e.id)}const Ms=64,zs=4096,Os=e=>de.counts(e),Ds=e=>e.filter(t=>t.status!=="resolved").length;function Ls(e,t,n){const o=new Map;for(const a of t){const d=o.get(a.route)??{n:0,seen:""};a.status!=="resolved"&&d.n++,a.updatedAt>d.seen&&(d.seen=a.updatedAt),o.set(a.route,d)}o.has(n)||o.set(n,{n:0,seen:new Date().toISOString()});const c=[...o.entries()].sort((a,d)=>d[1].seen.localeCompare(a[1].seen)).slice(0,Ms);c.some(([a])=>a===n)||(c[c.length-1]=[n,o.get(n)]);let u={v:1,p:Ds(t),r:Object.fromEntries(c.map(([a,d])=>[a,d.n])),t:new Date().toISOString()};JSON.stringify(u).length>zs&&(u={...u,r:{}});try{localStorage.setItem(Os(e),JSON.stringify(u))}catch{return null}return u}function Ns(e,t){return e?.r[t]??0}const Hs="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",Ws=new RegExp(`(["'\`]?)(?<![A-Za-z0-9])(?:${Hs})[\\w-]*\\b\\1?\\s*[:=]\\s*(?:(["'\`])((?:\\\\.|(?!\\2)[^\\\\])*)\\2|([^\\s,;&}\\])]{3,}))`,"gi"),js=/^(?:Bearer|Basic|Digest|Negotiate|Token)$/i,Us=(e,t,n,o,r,c,u)=>{if(!n&&js.test(r)&&u.slice(c+e.length).startsWith(" [redacted]")||(n?o:r).startsWith("[redacted"))return e;const a=n?`${n}${o}${n}`:r;return e.slice(0,e.length-a.length)+(n?`${n}[redacted]${n}`:"[redacted]")},Gn=/data:[a-z0-9.+-]*\/?[a-z0-9.+-]*;base64,[A-Za-z0-9+/=]{16,}/gi,eo=/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{0,}/g,to=/\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,Fs=/\b(Bearer|Basic|Digest|Negotiate|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi,no=/\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,Qt=/\b(?:\d[ -]?){12,18}\d\b/g,oo=/\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,ro=/\b[0-9a-f]{32,}\b/gi,so=/\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,ao=/\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,io=/\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/gi,Bs=/^(?=[A-Za-z0-9_~.+/=-]*[a-z])(?=[A-Za-z0-9_~.+/=-]*[A-Z])(?=[A-Za-z0-9_~.+/=-]*\d)[A-Za-z0-9_~.+/=-]{24,}$/;function Te(e,t){e.lastIndex=0;const n=e.test(t);return e.lastIndex=0,n}function co(e){const t=e.replace(/[ -]/g,"");if(t.length<13||t.length>19)return!1;let n=0,o=!1;for(let r=t.length-1;r>=0;r--){let c=t.charCodeAt(r)-48;o&&(c*=2,c>9&&(c-=9)),n+=c,o=!o}return n%10===0}function Zs(e){Qt.lastIndex=0;for(const t of e.matchAll(Qt))if(co(t[0]))return!0;return!1}function kt(e){let t=e;return t=t.replace(Gn,"data:[redacted]"),t=t.replace(Fs,"$1 [redacted]"),t=t.replace(Ws,Us),t=t.replace(eo,"[redacted:jwt]"),t=t.replace(to,"[redacted:key]"),t=t.replace(ao,"[redacted:key]"),t=t.replace(io,"[redacted:url-cred]@"),t=t.replace(no,"[redacted:email]"),t=t.replace(Qt,n=>co(n)?"[redacted:card]":n),t=t.replace(so,n=>`[redacted:b64:${n.length}]`),t=t.replace(oo,n=>`[redacted:b64:${n.length}]`),t=t.replace(ro,n=>`[redacted:hex:${n.length}]`),t}const Vs=vt.query,Ys=vt.fragment;function Xs(e,t=[]){let n;try{const o=globalThis.location?.href;n=new URL(e,o)}catch{return kt(e)}n.username="",n.password="";for(const o of[...n.searchParams.keys()]){if(Ys.includes(o)){n.searchParams.set(o,"[redacted]");continue}if(Vs.includes(o))continue;if(!t.includes(o)){n.searchParams.set(o,"[redacted]");continue}const r=n.searchParams.get(o)??"";kt(r)!==r&&n.searchParams.set(o,"[redacted]")}return n.hash&&n.hash.length>1&&(n.hash=t.includes("#")?n.hash:"#[redacted]"),kt(n.toString().replace(/%5Bredacted%5D/gi,"[redacted]"))}function Ks(e){return e.length>120?!0:Te(no,e)||Te(eo,e)||Te(to,e)||Te(ro,e)||Te(oo,e)||Te(Gn,e)||Te(so,e)||Te(ao,e)||Te(io,e)||Bs.test(e)||Zs(e)}const $t={id:"rev_local",name:V("author.unknown"),kind:"guest"},Js="0.0.0";function lo(e,t){if(e)return{...$t,name:e,...t?{email:t}:{}};try{const n=localStorage.getItem(de.identity);if(n)return{...$t,name:n[0]==="{"?JSON.parse(n).name??$t.name:n}}catch{}return $t}function qs(e){return`SN-${e.reduce((n,o)=>{const r=Number(o.key.split("-")[1]??0);return Number.isFinite(r)&&r>n?r:n},0)+1}`}let Gt=null;const Se=e=>Fr(e,Gt);function Qs(e,t){const n=xn(),o=n.ownerDocument??document,r=o.defaultView??window,c=t?.config?.site??"local",u=t?.emit??(()=>{}),a=t?.assetBase??"./",d=t?.config?.env??"default";at(n,"tokens",Vo);const m=Xo(n.host,Yo(t?.config?.theme)),v={},_=t?.config?.storage==="local"?void 0:t?.config?.host,p=_&&c!=="local"?Is(_,c,t?.config?.env,{reviewToken:t?.reviewToken,onSessionEnded:s=>{ce.show(s==="revoked"?"error.linkrevoked":"error.sessionended")},onSessionStarted:()=>ce.hide()}):vs(c,d,{put:(s,i)=>v.put(s,i),del:s=>v.del(s)}),P=Ss(c,d);let j=null;const B=s=>p.init({uid:c,env:d}).catch(i=>s>=3?Promise.reject(i):new Promise(f=>setTimeout(f,1500*(s+1))).then(()=>B(s+1)));B(0).then(s=>{j=s.rounds??null,te?.update(ee()),s.writable===!1&&s.reason==="origin_not_allowed"&&ce.show("error.origin",void 0,{origin:location.origin})}).catch(()=>{});let y=[],K=[];const re=bs();let G=null,J=null,h=!1,w=!1,T=!1,M=null,U=!1;const D={get:()=>G,unavailable:()=>w||T,newPass:()=>J?.createPassCaches(),fuzzyHit:s=>M?.hit(s)??null,wantFuzzy:(s,i)=>{if(M){M.enqueue(s,i,()=>ae());return}U||!J||!i.text?.exact||i.text.exact.length<8||(U=!0,ze("anchor-fuzzy",a,o).then(f=>{if(!f.ok||!J){T=!0,ae();return}M=f.mod.createFuzzyEngine(o,J.fuzzyDeps),$e()}))},want:s=>{h||!(s.role&&s.accessibleName)&&!s.text?.exact&&!s.path?.length||(h=!0,ze("anchor-ext",a,o).then(i=>{if(!i.ok){w=!0,ae();return}J=i.mod,G=i.mod.resolveExtended,$e()}))}};let l=null,b=Ir();const E=()=>b.statuses.length>0||!!b.by||!!b.page||b.read!=="all",S=xr(n,s=>{if(H==="add"){if(Z?.hasText()){Z.pulse();return}Z?.close(),Z=null,fe("comments")}O(s.id)},D,s=>{l=s,te?te.update(ee()):O()});let H=(()=>{try{return sessionStorage.getItem(de.mode)==="comments"?"comments":"browse"}catch{return"browse"}})(),Z=null,te=null,ie=null,De=!1,Re=null,Qe=!1,Et=null,ve=null,_e=null,Ve=!1;function le(){return _e?Promise.resolve(_e):Ve?Promise.resolve(null):ze("capture",a,o).then(i=>i.ok?(v.put=i.mod.putBlob,v.del=i.mod.deleteBlob,_e=i.mod):(Ct(new Error("chunk unavailable")),null))}function Ct(s){Ve||(Ve=!0,H==="add"&&fe("comments"),ne.setDegraded(!0),ce.show("error.capture",{label:"action.retry",run:()=>{Ve=!1,ne.setDegraded(!1),le()}}),console.warn(`[${xe}] the capture chunk failed to load`,s))}let Ie=0;function Ge(){const s=new URL(a,o.location.href).href,i=new URL(Me.panels,s);return i.searchParams.set("cv",Js),Ie>0&&i.searchParams.set("r",String(Ie)),Ie++,import(i.href)}async function Ae(){if(Qe)return null;if(Re)return Re.catch(()=>null);Re=Ge().catch(async()=>(await new Promise(s=>setTimeout(s,1e3)),Ge()));try{return Et=await Re}catch(s){return Re=null,Le(s),null}}function Le(s){Qe=!0,H==="add"&&fe("comments"),ne.setDegraded(!0),ce.show("error.panels",{label:"action.retry",run:()=>{Qe=!1,ne.setDegraded(!1),O(ie)}}),console.warn(`[${xe}] the panels chunk failed to load`,s)}const Ne=o.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1;let me=null;async function et(){if(me)return;const s=await le();!s||me||(me=s.createAddChrome(n,Ne,{pick:(i,f)=>void g(i,f),announce:nt}),me.setActive(H==="add"))}const ge=o.createElement("div");ge.style.cssText=`position:fixed;left:0;top:0;pointer-events:none;z-index:${Je.dock}`,n.appendChild(ge);const Tt=Or(r,ge,s=>ne.setPuck(s>1.2)),ce=Ar(n,ge),A=$r(n,ge),k=nr(n,{onPick:(s,i)=>void g(s,i),onHover:s=>s?me?.show(s):me?.clear(),onSelectStart:()=>{Ne||rn()}});async function g(s,i){if(Z?.hasText()){Z.pulse();return}Z?.close();const[f,I]=await Promise.all([Ae(),le()]);if(!f||!I)return;const F=I.captureContext({page:I.derivePageRef(o.location,pt()),...gt()});mn(s);const q=I.deriveAnchorLabel(s);L(f,s,i,F,q,I)}function L(s,i,f,I,F,q,X,Fe){let we=i;mt=!1;const he=Se(o);Pt=!1;const yt=()=>{Z=null,Bn(he),ne.setDraft(Vt()),fe("comments")},st=()=>{rt?.abort(),Ue=rt=null,yt()},pe=j?.find(ue=>ue.number===p.getRound?.())?.closed?j.find(ue=>!ue.closed):void 0,Be={at:f,label:F,...X?{initialBody:X.body,initialName:X.author,...X.email?{initialEmail:X.email}:{}}:{},onDraft:(ue,Pe,bt)=>{const Co=ss({route:he,body:ue,author:Pe,...bt?{email:bt}:{},label:F,anchor:Fe??q.createElementAnchor(i,{point:f,viewportWidth:r.innerWidth,label:F,...q.describeElement(i)}),at:{x:f.x+r.scrollX,y:f.y+r.scrollY},savedAt:new Date().toISOString()});ne.setDraft(Vt()),!Co&&!Pt&&(Pt=!0,ln())},onSend:(ue,Pe,bt)=>{yt(),pe&&p.setRound(pe.number),dn(we,f,I,ue,Pe,bt,Fe).then(()=>pe&&$e())},onRetarget:ue=>{const Pe=ue==="up"?q.widen(we):q.narrow(we);Pe&&(we=Pe,me?.show(Pe),Z?.setLabel(q.deriveAnchorLabel(Pe)))},...oe&&ot!==!1?{onShotOptIn:ue=>mt=ue}:{},onCancel:st,crumbsOn:pn!==!1,shotsOn:ot!==!1,..._&&c!=="local"?{serverHost:new URL(_).host}:{},..._&&p.adoptSession?{studio:{host:_,uid:c,env:t?.config?.env,member:p.member(),adopt:ue=>p.adoptSession(ue),signOut:()=>p.signOut()}}:{},...Fe?.text?.exact?{quote:Fe.text.exact}:{},...pe?{roundNote:pe.name}:{}};Z=s.openComposer(n,Be,ge),He()}async function C(){const s=Se(o),i=as(s);if(ne.setDraft(Vt()),!i||Z)return;const[f,I]=await Promise.all([Ae(),le()]);if(!f||!I)return;const F=Ft(i.anchor,o,{viewportWidth:r.innerWidth,...G?{extended:G}:{}});if(!F.element)return;const q=F.element.getBoundingClientRect();if(q.width===0&&q.height===0)return;const X={x:i.at.x-r.scrollX,y:i.at.y-r.scrollY};fe("add"),L(f,F.element,X,I.captureContext({page:I.derivePageRef(o.location,pt()),...gt()}),i.label,I,{body:i.body,author:i.author,...i.email?{email:i.email}:{}})}async function O(s=null){if(s&&s!==ie&&u("thread:open",{threadId:s}),s&&P.mark(s),ie=s,De=!0,H==="browse"&&fe("comments"),te){te.update(ee());return}if(!await Ae())return;const f=await ze("dock",a,o);if(!f.ok){ce.show("error.panels",{label:"action.retry",run:()=>void O(ie)});return}!De||te||(ve=f.mod,te=f.mod.openDock(n,ee(),ge),He())}function $(){P.markAll(y),b.newOnly&&(b={...b,newOnly:!1}),De=!1,te?.close(),te=null,ie=null,S.highlight(null),He(),E()&&ae()}function R(s){const i=s?y.find(f=>f.id===s):void 0;if(i&&i.route!==Se(o)){Rr(r,i.id),r.location.assign(i.route);return}s&&P.mark(s),ie=s,S.highlight(null),E()?ae():te?.update(ee()),i&&ve?.scrollToSnag(r,n,i)}function ee(){return{snags:y,route:Se(o),openId:ie,seenAt:P.map(),onOpen:R,onStatus:(s,i)=>void mo(s,i),onReply:(s,i,f)=>void yo(s,i,f),onEdit:(s,i)=>void N(s,i),onDeleteComment:s=>void W(s),onDeleteThread:s=>void se(s),...p.isMine?{isMine:s=>p.isMine(s)}:{},..._&&p.adoptSession?{studio:{host:_,uid:c,env:t?.config?.env,member:p.member(),adopt:s=>p.adoptSession(s),signOut:()=>p.signOut()}}:{},canDeleteOwnThread:p.can?p.can("thread:delete:own"):!0,canStatus:p.can?p.can("thread:resolve"):!0,canModerate:p.canModerate?.()??!1,...p.listAssignees&&p.can?.("thread:assign")?{assignees:()=>p.listAssignees(),onAssign:(s,i)=>void go(s,i)}:{},onClearAll:()=>void ye(),onClose:$,...p.kind==="local"?{onExport:It}:{},onHover:s=>S.highlight(s),...j&&j.length>1&&p.setRound?{rounds:j,activeRound:p.getRound?.()??j.find(s=>!s.closed)?.number??j[0].number,onRound:s=>{p.setRound(s),$e()}}:{},onAnnounce:nt,loadShot:s=>Ps(s,async i=>{const f=await le();return f?(await f.getBlob(i))?.blob??null:null}),filter:b,onFilter:s=>{const i=s.statuses.join()!==b.statuses.join()||s.by!==b.by||s.page!==b.page||s.read!==b.read;b=s,i?ae():te?.update(ee())},...l?{clusterFilter:l}:{},onClusterClear:()=>{l=null,te?.update(ee())},onShowAnyway:s=>{S.showGhost(s),ve?.scrollToSnag(r,n,s)}}}async function Y(s,i){const f=y;y=s,ae();try{await Xe(i)}catch{y=f,ae(),ce.show("error.sendfailed",void 0,{item:"change"})}}async function N(s,i){await Y(y.map(f=>({...f,comments:f.comments.map(I=>I.id===s?{...I,body:i}:I)})),()=>p.patchComment(s,i))}async function W(s){await Y(y.map(i=>({...i,comments:i.comments.filter(f=>f.id!==s)})),()=>p.deleteComment(s))}async function se(s){const i=ie;ie===s&&(ie=null),await Y(y.filter(f=>f.id!==s),()=>p.deleteThread(s)),y.some(f=>f.id===s)&&(ie=i)}async function ye(){const s=y.map(i=>i.id);y=[],ie=null,ae(),await Promise.all(s.map(i=>Xe(()=>p.deleteThread(i))))}const ne=fs(n,{onState:s=>fe(s),onPanel:()=>te?$():void O(),onNav:s=>nn(s),parent:ge}),oe=r.matchMedia?.("(pointer: coarse)").matches??!1,He=()=>{oe&&ne.setConcealed(!!Z||!!te)};let be=null,We=[];function uo(s){let i=!1;const f=()=>{i||(i=!0,r.removeEventListener("scrollend",f),s())};r.addEventListener("scrollend",f,{once:!0}),r.setTimeout(f,600)}const tt=o.createElement("div");tt.setAttribute("aria-live","polite"),tt.setAttribute("role","status");const en="position:absolute;width:1px;height:1px;overflow:hidden";tt.style.cssText=en;const Rt=o.createElement("div");Rt.setAttribute("aria-live","assertive"),Rt.style.cssText=en,n.append(tt,Rt);let tn=0;function nt(s){r.clearTimeout(tn),tn=r.setTimeout(()=>{tt.textContent=s},400)}function nn(s){const i=We.length;if(i===0)return;be=be===null?s===1?0:i-1:(be+s+i)%i;const f=We[be];ps(r,n,f);const I=be+1;uo(()=>{S.pulse(f.id),nt(V("nav.announce",{n:I,label:f.anchor.label,i:I,total:i}))})}function on(){if(H!=="comments"||Ne){ke?.disarm();return}rn().then(s=>{s&&H==="comments"&&s.arm()})}let ke=null,_t=null;async function rn(){if(ke)return ke;const s=await ze("text",a,o);return!s.ok||ke||(_t=s.mod,ke=s.mod.createSelectionWatcher(n,{onQuote:(i,f)=>void fo(i,f)})),ke}async function fo(s,i){const f=_e??await le();if(!f||!_t)return;const I=_t.createTextAnchor(s,f,{viewportWidth:r.innerWidth,ourRoot:n});if(I.kind==="refused-form-control"){g(I.el,i);return}if(I.kind!=="text")return;const F=await Ae();if(!F)return;const q=f.captureContext({page:f.derivePageRef(o.location,pt()),...gt()});try{s.removeAllRanges()}catch{}L(F,I.el,I.point,q,I.label,f,void 0,I.record)}function fe(s,i=!1){const f=H;H=s,s!=="add"&&Z&&!i&&(Z.close(),Z=null),s==="add"&&te&&$(),s==="add"&&(Ae(),le());try{sessionStorage.setItem(de.mode,s==="add"?"comments":s)}catch{}k.setMode(s),s!==f&&nt(V(`toolbar.${s}`)),He(),s==="add"&&et(),on(),me?.setActive(s==="add"),ne.setState(s),ae(),s!==f&&u("modechange",{mode:s,previous:f})}let Ye=0,sn=0;const an=[300,800,1600,3200];function ho(){if(Ye||!S.hasPending()){S.hasPending()||(sn=0);return}const s=an[Math.min(sn++,an.length-1)];Ye=r.setTimeout(()=>{Ye=0,ae()},s)}const po=3e3;let cn=0;function ae(s){const i=s??(Date.now()<cn?"navigating":"authoritative");K=S.reanchor(y.filter(ko()),i),Ao(),ho();const f=new Map(K.map(X=>[X.id,X]));y=y.map(X=>f.get(X.id)??X);const I=E()?new Set(K.filter(X=>!Mr(X,b,P.map())&&X.id!==ie).map(X=>X.id)):void 0;We=I?K.filter(X=>!I.has(X.id)):K,S.render(H==="browse"?[]:K,I);const F=Se(o),q=re?Ls(o.location.origin,y,F):null;ne.setCount(q?Ns(q,F):re?K.filter(X=>X.status!=="resolved").length:null),be!==null&&be>=We.length&&(be=null),te?.update(ee())}async function $e(){const{data:s}=await p.listThreads();y=s,ae();const i=S.settled();for(const f of i)u("anchor:settled",{threadId:f.id,state:f.state,strategy:f.strategy,confidence:f.confidence});return p.capabilities.anchorReports&&p.reportAnchors&&i.length&&Xe(()=>p.reportAnchors(i.map(f=>({threadId:f.id,state:f.state,confidence:f.confidence,strategy:f.strategy})))),p.capabilities.anchorReports||await Promise.all(s.flatMap(f=>{const I=y.find(F=>F.id===f.id);return!I||I.anchorState===f.anchorState?[]:[Xe(()=>p.patchThread(I.id,{anchor:I.anchor,anchorState:I.anchorState}))]})),K}async function mo(s,i){u("thread:resolve",{threadId:s,status:i}),await Y(y.map(f=>f.id===s?{...f,status:i}:f),()=>p.patchThread(s,{status:i}))}async function go(s,i){await Y(y.map(f=>f.id===s?{...f,assignee:i}:f),()=>p.patchThread(s,{assignee:i&&i.id}))}async function yo(s,i,f){const I={id:Yn(),body:i,author:lo(f)};y=y.map(F=>F.id===s?{...F,comments:[...F.comments,{...I,snagId:s,createdAt:new Date().toISOString()}]}:F),P.mark(s),ae(),u("comment:create",{threadId:s,comment:I}),await Xe(()=>p.createComment(s,I))}function ln(){ce.show("error.quota",{label:"action.exportclear",run:()=>{It("json"),ye()}}),console.warn(`[${xe}] ${V("error.quota")}`)}async function Xe(s){try{return await s()}catch(i){if(i instanceof Ht&&i.code==="local_quota_exceeded")return ln(),null;throw i}}function It(s){le().then(async i=>{if(!i)return;const f=await i.resolveAttachmentUris(y).catch(()=>new Map);i.download(n,i.buildExport(s,y,{origin:o.location.origin,exportedAt:new Date().toISOString()},f),r)})}async function dn(s,i,f,I,F,q,X){const Fe=lo(F,q),we=_e??await le();if(!we)throw new Error(`[${xe}] add() needs the capture chunk`);Ue||mn(s);const he=Ue?await Ue:null;Ue=rt=null,we.applyShotOutcome(f,he,ot===!1,oe&&!mt);const yt=he?.blob&&p.uploadAttachment?p.uploadAttachment(he.blob,{kind:"screenshot",...he.width!==void 0?{width:he.width}:{},...he.height!==void 0?{height:he.height}:{}}).catch(()=>null):Promise.resolve(null),st={id:ms(),key:qs(y),route:Se(o),anchor:X??we.createElementAnchor(s,{point:i,viewportWidth:r.innerWidth,label:we.deriveAnchorLabel(s),...we.describeElement(s)}),anchorState:"anchored",scope:xo(),context:f,createdBy:Fe,createdAt:new Date().toISOString(),...I?{comment:{id:Yn(),body:I,author:Fe}}:{}},Ee=Rn(st);he?.blob&&(Ee.screenshotBlob=he.blob),y=[...y,Ee],P.mark(Ee.id),nt(V("announce.created",{key:Ee.key})),u("thread:create",{thread:Ee}),H==="browse"?fe("comments"):ae();try{const pe=await yt;pe&&(st.attachments=[pe],y=y.map(Be=>Be.id===Ee.id?{...Be,attachments:[pe]}:Be),ae()),await Xe(()=>p.createThread(st))}catch(pe){throw y=y.filter(Be=>Be.id!==Ee.id),ae(),ce.show("error.sendfailed",void 0,{item:zt.toLowerCase()}),console.warn(`[${xe}] ${V("error.sendfailed",{item:zt.toLowerCase()})}`,pe),pe}return Ee}function un(s){if((s.key==="n"||s.key==="p")&&H==="comments"&&!Z){if(s.metaKey||s.ctrlKey||s.altKey)return;const i=s.composedPath()[0]??s.target;if(i&&(i.closest?.("input,textarea,select,[contenteditable]")||i.isContentEditable))return;s.preventDefault(),s.stopPropagation(),nn(s.key==="n"?1:-1);return}H==="add"&&s.key==="Escape"&&(Z||(s.stopPropagation(),fe("comments")))}o.addEventListener("keydown",un,!0);let fn=0;const hn=()=>{if(o.hidden||!p.revalidate)return;const s=Date.now();s-fn<3e4||(fn=s,p.revalidate())};o.addEventListener("visibilitychange",hn);const bo=Wo(n),vo=jo(n,s=>{console.warn(`[${xe}] the host page hid the widget from assistive technology ${s} times; leaving it alone.`)}),wo=Ho(n,s=>{console.warn(`[${xe}] the host page removed the widget ${s} times; leaving it alone. Reload to comment again.`)});function xo(){return{environment:d,...t?.config?.branch?{branch:t.config.branch}:{}}}let ut={route:Se(o),url:o.location.href},Pt=!1,ft=null;function So(s){if(s){if(H==="browse")return;ft=H,fe("browse",!0),A.show(),u("paused",{reason:"modal-dialog"})}else if(ft){const i=ft;ft=null,A.hide(),fe(i),u("resumed",{mode:i})}}Ae();function Ao(){K.length>0&&ze("dock",a,o)}{const s=o.createElement("div");s.style.cssText="position:fixed;inset:0;pointer-events:none;visibility:hidden",n.appendChild(s);const i=s.getBoundingClientRect(),f=Math.abs(i.left)>1||Math.abs(i.top)>1||Math.abs(i.width-r.innerWidth)>1||Math.abs(i.height-r.innerHeight)>1;s.remove(),f&&(console.warn(`[${xe}] fixed-trapped: <html> has transform/filter/contain, so our fixed layer follows it, not the viewport. Remove it, or expect drift.`),u("error",{code:"fixed-trapped"}))}let Ke=null;const ht=new Set,je=(()=>{const s=r[Io.config];return s&&typeof s=="object"?s:void 0})(),pn=je?.breadcrumbs,Mt=(()=>{const s=je?.significantQueryParams,i=je?.ignoredQueryParams,f={};return s==="*"?f.significantQueryParams="*":Array.isArray(s)&&(f.significantQueryParams=s.map(String)),Array.isArray(i)&&(f.ignoredQueryParams=i.map(String)),f})(),pt=()=>({routeOverride:Gt,query:Mt,doc:o}),ot=je?.screenshot===!1?!1:je?.screenshot&&typeof je.screenshot=="object"?je.screenshot:{};let mt=!1,Ue=null,rt=null;function mn(s){if(ot===!1||Ue||oe&&!mt)return;rt=new AbortController;const i=rt.signal;Ue=ze("screenshot",a,o).then(f=>f.ok?f.mod.captureScreenshot({doc:o,target:s,signal:i,...ot,...p.fetchForeignImage?{fetchForeignImage:I=>p.fetchForeignImage(I)}:{}}):{situation:"engine-load-failed",blindSpots:[],maskedCount:0})}function ko(){const s=Se(o),i=jn(o.location.pathname),f=Yr(o.location.search,Mt);return I=>(I.route===s||I.context?.page?.pathname===i)&&Xr(I.context?.page?.query,f,Mt)}{const s=pn;s!==!1&&ze("crumbs",a,o).then(i=>{i.ok&&(Ke=i.mod.installTierC({win:r,...t?.early?{early:t.early}:{},...s&&typeof s=="object"?{config:s}:{},subscribeNav:f=>(ht.add(f),()=>ht.delete(f))}))})}const gt=()=>Ke?{breadcrumbs:{records:Ke.drain(),status:Ke.status()}}:{},$o=Gr(o,r,()=>{H!=="browse"&&K.length>0&&ae()}),Eo=Tr(r,{onResize:()=>ae(),onRoute:()=>{const s={route:Se(o),url:o.location.href},i=s.route!==ut.route;if(i){u("navigate",{from:ut,to:s});for(const f of ht)f(ut.url,s.url)}if(ut=s,!i){$e();return}cn=Date.now()+po,r.setTimeout(()=>{p.listThreads().then(({data:f})=>{y=f,ae("optimistic")})},100),r.setTimeout(()=>void $e(),600)},onModal:So});return ne.setState(H),k.setMode(H),on(),re||ce.show("error.nostorage",{label:"action.export",run:()=>It("md")}),$e().then(async s=>{const i=_r(r);if(!i){const I=new URLSearchParams(o.location.search).get(Do("t"));if(I){let F=s.find(q=>q.key===I);if(!F&&p.getThreadByKey){const q=await p.getThreadByKey(I).catch(()=>null);q&&(y=[...y.filter(X=>X.id!==q.id),q],ae(),F=y.find(X=>X.id===q.id))}F?(await O(F.id),ve?.scrollToSnag(r,n,F)):(ce.show("permalink.unknown"),await O(null));return}await C();return}const f=s.find(I=>I.id===i);await O(f?i:null),f&&ve?.scrollToSnag(r,n,f)}),{root:n,assetBase:t?.assetBase??"",snags:()=>K,async add(s,i,f,I){const F=I?null:await le(),q=I??(F?F.captureContext({page:F.derivePageRef(o.location,pt()),...gt()}):void 0);if(!q)throw new Error(`[${xe}] add() needs the capture chunk, or an explicit context`);return dn(s,i,q,f)},refresh:$e,setRoute(s){Gt=s&&s.startsWith("/")?s:null,$e()},setState:fe,getState:()=>H,openPanel:O,async open(s){const i=s.startsWith(wt.thread)?y.find(f=>f.id===s):y.find(f=>f.key===s);return i?i.route!==Se(o)?{ok:!1,reason:"wrong-page",url:i.context?.url??i.route,route:i.route}:(await O(i.id),ve?.scrollToSnag(r,n,i),{ok:!0,anchorState:i.anchorState}):{ok:!1,reason:"not-found"}},closePanel:$,hitTest:(s,i)=>k.hitTest(s,i),destroy(){Z?.close(),$(),me?.destroy(),ce.destroy(),A.destroy(),Tt(),wo(),vo(),bo(),Eo.destroy(),$o.destroy(),Ke?.destroy(),Ke=null,ht.clear(),ke?.destroy(),ke=null,M?.destroy(),M=null,Ye&&r.clearTimeout(Ye),Ye=0,o.removeEventListener("keydown",un,!0),o.removeEventListener("visibilitychange",hn),m(),k.destroy(),S.destroy(),ne.destroy(),n.host.remove()}}}export{vn as HOST_CSS,xn as createHost,Ks as isSensitiveValue,Qs as mount,kt as redactText,Xs as redactUrl};
@@ -1 +0,0 @@
1
- import{Q as g,T as f,U as p,o as v,j as e,B as m,V as N,L as P,p as j}from"./index-C9T0i6pH.js";import{Q as y,u as b}from"./useBaseQuery-BNAoRl4M.js";import{P as w,S}from"./parts-BGzYN_gW.js";import{b as R,c as E,S as F}from"./labels--UUyt9uB.js";import{u as k}from"./me-DnFJ72fX.js";import"./card-DktMrBl6.js";var M=class extends y{constructor(s,n){super(s,n)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,n){const{state:i}=s,l=super.createResult(s,n),{isFetching:o,isRefetching:r,isError:u,isRefetchError:d}=l,t=i.fetchMeta?.fetchMore?.direction,c=u&&t==="forward",a=o&&t==="forward",h=u&&t==="backward",x=o&&t==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:f(n,i.data),hasPreviousPage:g(n,i.data),isFetchNextPageError:c,isFetchingNextPage:a,isFetchPreviousPageError:h,isFetchingPreviousPage:x,isRefetchError:d&&!c&&!h,isRefetching:r&&!a&&!x}}};function A(s,n){return b(s,M)}const C=[{value:"unresolved",label:"Needs attention"},...E.map(s=>({value:s,label:F[s]})),{value:"all",label:"Everything"}];function O(s,n=new Date){const i=new Date(s),l=r=>new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),o=Math.round((l(n)-l(i))/864e5);return o<=0?"Today":o===1?"Yesterday":o<7?i.toLocaleDateString(void 0,{weekday:"long"}):i.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function U(){const s=k(),{status:n="unresolved",site:i}=p.useSearch(),l=v({from:"/activity"}),o=t=>void l({search:c=>({...c,...t}),replace:!0}),r=A({queryKey:["activity",n,i??null],queryFn:({pageParam:t})=>j.activity({status:n,...i?{site:i}:{},...t?{cursor:t}:{}}),initialPageParam:"",getNextPageParam:t=>t.nextCursor??void 0,refetchOnWindowFocus:!0}),u=r.data?.pages.flatMap(t=>t.data)??[],d=[];for(const t of u){const c=O(t.updatedAt),a=d[d.length-1];a?.day===c?a.rows.push(t):d.push({day:c,rows:[t]})}return e.jsxs("div",{className:"flex flex-col gap-5 p-7",children:[e.jsx(w,{title:"Activity",sub:`Every site, newest first${i?"":" — all of them"}`}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[C.map(t=>e.jsx(m,{size:"sm",variant:n===t.value?"default":"outline",onClick:()=>o({status:t.value}),children:t.label},t.value)),e.jsx("div",{className:"flex-1"}),e.jsxs("label",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:["Site",e.jsxs("select",{"aria-label":"Site",value:i??"",onChange:t=>o({site:t.target.value||void 0}),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px] text-foreground",children:[e.jsx("option",{value:"",children:"All sites"}),s.projects.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))]})]})]}),r.isPending&&e.jsx(N,{rows:4}),r.isError&&e.jsx("p",{className:"m-0 text-[13px] text-destructive",children:"Could not read the feed. Reload to try again."}),r.isSuccess&&u.length===0&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:n==="resolved"?"Nothing has been resolved yet — this is where finished comments go.":n==="unresolved"?"Nothing needs attention. Every comment on every site is resolved.":"No comments yet on any site."}),d.map(({day:t,rows:c})=>e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx("h2",{className:"m-0 text-[12px] font-medium uppercase tracking-wide text-muted-foreground",children:t}),e.jsx("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:c.map(a=>e.jsx("li",{children:e.jsxs(P,{to:"/s/$site/comments",params:{site:a.site.uid},search:{thread:a.key},className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2.5 no-underline transition-colors hover:bg-muted/60",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[13px]",children:[e.jsx(S,{status:a.status}),e.jsx("span",{className:"font-medium text-foreground",children:a.site.name}),e.jsx("code",{className:"font-mono text-[12px] text-muted-foreground",children:a.route}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:R(a.updatedAt)})]}),a.latest?.body&&e.jsxs("span",{className:"line-clamp-2 text-[13px] text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[a.latest.author??a.createdBy.name,": "]}),a.latest.body]}),e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:a.key}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[a.commentCount," ",a.commentCount===1?"comment":"comments"]}),a.assignee&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:a.assignee})]})]})]})},a.id))})]},t)),r.hasNextPage&&e.jsx("div",{children:e.jsx(m,{variant:"outline",size:"sm",disabled:r.isFetchingNextPage,onClick:()=>void r.fetchNextPage(),children:r.isFetchingNextPage?"Reading…":"Show older"})})]})}export{U as component};
@@ -1 +0,0 @@
1
- import{u as r,Q as u,d as s}from"./useBaseQuery-BNAoRl4M.js";import{y as t}from"./index-C9T0i6pH.js";function a(e,o){return r({...e,enabled:!0,suspense:!0,throwOnError:s,placeholderData:void 0},u)}function i(){return a(t.me()).data}export{i as u};
@@ -1 +0,0 @@
1
- import{j as t,O as o}from"./index-C9T0i6pH.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1 +0,0 @@
1
- import{aH as A,r as f,j as e,B as g,aI as S,f as I,aJ as E,y as k,X as F,F as H,H as y}from"./index-C9T0i6pH.js";import{u as C}from"./useQuery-D4G3Az8s.js";import{u as L,a as P}from"./zod-CYYNMx2f.js";import{C as R}from"./card-DktMrBl6.js";import{X as M,E as U,G as $,I as B,H as z,J,K}from"./dialog-CNPOwLFE.js";import{L as N,I as V}from"./label-CgEiXFTT.js";import{T as X,a as Y,b as D,c as p,d as q,e as j}from"./table-CoSJYMlW.js";import{C as G}from"./ConfirmDialog-COCFkJPd.js";import{C as O}from"./CopyButton-BSZUdGOe.js";import{P as Q,E as W}from"./parts-BGzYN_gW.js";import{b as T}from"./labels--UUyt9uB.js";import{C as Z}from"./check-BeXhTRNQ.js";import{U as _}from"./users-CxehfZhl.js";import{P as ee}from"./plus-D5bA9-ud.js";import"./useBaseQuery-BNAoRl4M.js";import"./copy-0Bxto2zb.js";function be(){const{site:s}=A.useParams(),{site:d}=A.useRouteContext(),r=C(k.links(s)),l=C(k.origins(s)),[x,t]=f.useState(!1),[n,a]=f.useState(null);f.useEffect(()=>a(null),[s]);const i=r.data?.data??[],c=l.data?.origins[0]?.replace(/\/+$/,"")??"",m=n?`${c}/${n.fragment}`:"",v=e.jsxs(g,{onClick:()=>t(!0),children:[e.jsx(ee,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(Q,{title:"Reviewers",sub:`Each reviewer gets their own link to ${d.name}`,actions:v}),n&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(Z,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[n.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:m}),e.jsx(O,{text:m,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>a(null),children:e.jsx(M,{})})]}),r.isSuccess&&i.length===0?e.jsx(R,{className:"max-w-[1040px]",children:e.jsx(W,{icon:e.jsx(_,{className:"size-5"}),title:"No reviewers yet",action:v,children:"Add your client and send them their link. They never need an account."})}):e.jsx(R,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(X,{children:[e.jsx(Y,{children:e.jsxs(D,{children:[e.jsx(p,{children:"Name"}),e.jsx(p,{children:"Status"}),e.jsx(p,{children:"Uses"}),e.jsx(p,{children:"Last seen"}),e.jsx(p,{className:"w-0"})]})}),e.jsx(q,{children:i.map(u=>e.jsx(se,{link:u,uid:s,onRevoked:()=>a(h=>h?.id===u.id?null:h)},u.id))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"Revoking ends every session minted from the link within 10 seconds. The comments a reviewer left stay."}),e.jsx(te,{uid:s,open:x,onOpenChange:t,onMinted:a})]})}function se({link:s,uid:d,onRevoked:r}){const l=S(d),[x,t]=f.useState(!1),n=!!s.revokedAt,a=!n&&new Date(s.expiresAt).getTime()<=Date.now(),i=n||a,c=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(D,{className:I(i&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:n?e.jsxs("span",{children:["Revoked ",T(s.revokedAt)]}):a?e.jsx("span",{children:"Expired"}):e.jsxs("span",{children:[e.jsx("span",{className:"rounded-full bg-ok-soft px-2 py-0.5 text-[11.5px] font-medium text-ok",children:"Active"}),e.jsxs("span",{className:"ml-2 text-[12px] text-muted-foreground",children:["expires in ",c," day",c===1?"":"s"]})]})}),e.jsx(j,{children:s.useCount}),e.jsx(j,{className:"text-muted-foreground",children:s.lastUsedAt?T(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!n&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>t(!0),children:"Revoke"}),e.jsx(G,{open:x,onOpenChange:t,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:l.isPending,onConfirm:()=>{t(!1),r(),l.mutate(s.id)}})]})]})}const ne=H({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function te({uid:s,open:d,onOpenChange:r,onMinted:l}){const x=E(s),t=C({...k.rounds(s),enabled:d}),[n,a]=f.useState(""),{register:i,handleSubmit:c,formState:m,reset:v}=L({resolver:P(ne),defaultValues:{days:"14",roundId:""}}),u=c(async o=>{a("");const b=Number(o.days);try{const w=await x.mutateAsync({name:o.name,...Number.isFinite(b)&&b>0?{expiresAt:new Date(Date.now()+b*864e5).toISOString()}:{},...o.roundId?{roundId:o.roundId}:{}});l(w),v(),r(!1)}catch(w){a(F(w))}}),h="h-8 w-full rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50";return e.jsx(U,{open:d,onOpenChange:r,children:e.jsx($,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(B,{children:[e.jsx(z,{children:"New reviewer"}),e.jsx(J,{children:"Your client's name, as you will see it on their comments. A link is generated once and shown to you once."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(V,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!m.errors.name,...i("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsxs("select",{id:"reviewer-days",className:h,...i("days"),children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"You can revoke it at any time before that."})]}),t.data&&t.data.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-round",children:"Pin to a round"}),e.jsxs("select",{id:"reviewer-round",className:h,...i("roundId"),children:[e.jsx("option",{value:"",children:"Any round"}),t.data.data.map(o=>e.jsx("option",{value:o.id,children:o.name},o.id))]})]}),e.jsxs(K,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:m.isSubmitting,children:m.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{be as component};
@@ -1 +0,0 @@
1
- import{j as t,O as o}from"./index-C9T0i6pH.js";const n=()=>t.jsx(o,{});export{n as component};