@popmelt.com/core 0.30.1 → 0.31.0
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.
- package/README.md +2 -0
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/ParticipantRuntime-PPIOE3NJ.mjs +139 -0
- package/dist/{PopmeltTasteConnectedPane-L5ULGACH.mjs → PopmeltTasteConnectedPane-4WRVLYUV.mjs} +1 -1
- package/dist/{ThreadErrorCard-Q5GQ4EIF.mjs → ThreadErrorCard-5ADUBZKJ.mjs} +1 -1
- package/dist/adapter-react-three-fiber.d.mts +1 -1
- package/dist/bridge-entry.mjs +1 -1
- package/dist/browser-runtime-OZCPXHEN.mjs +2 -0
- package/dist/browser.d.mts +4 -4
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-PCP5ENOU.mjs → chunk-4AEU4OCH.mjs} +2 -2
- package/dist/chunk-4LHTPRFY.mjs +2 -0
- package/dist/chunk-4V7SK3M6.mjs +0 -0
- package/dist/{chunk-3JJP637I.mjs → chunk-A7DRONSB.mjs} +2 -2
- package/dist/{chunk-MZNY6VXR.mjs → chunk-D32YV5O6.mjs} +1 -1
- package/dist/{chunk-CWX3XV2M.mjs → chunk-DPU2WFIZ.mjs} +1 -1
- package/dist/{chunk-VNSLQY5N.mjs → chunk-F3S6L45N.mjs} +1 -1
- package/dist/{chunk-GHBFZOHT.mjs → chunk-G25T4PMF.mjs} +1 -1
- package/dist/chunk-J4WDYITA.mjs +2 -0
- package/dist/{chunk-HTHUSDZT.mjs → chunk-NE263MLG.mjs} +1 -1
- package/dist/chunk-PBQCGGJL.mjs +342 -0
- package/dist/chunk-RXRZTZPN.mjs +3 -0
- package/dist/chunk-UU5ISCUC.mjs +62 -0
- package/dist/{chunk-5IEPFMP7.mjs → chunk-YM6BOUNF.mjs} +21 -21
- package/dist/cli.mjs +2 -2
- package/dist/codex-note-context-MKZ7WCS7.mjs +2 -0
- package/dist/{codex-project-JDNFTUP7.mjs → codex-project-3OAJJ7ZI.mjs} +1 -1
- package/dist/codex-session-registry-25DAA2KO.mjs +0 -0
- package/dist/focus-inspection-GJKMI6OE.mjs +2 -0
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +1 -1
- package/dist/media.d.mts +3 -3
- package/dist/{participantBootstrap-QZ3wuqi1.d.mts → participantBootstrap-B0lvfCwM.d.mts} +2 -2
- package/dist/peer-client-WF35M2Y4.mjs +2 -0
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{subjects-CG6UyWFr.d.mts → subjects-EWAR5-0S.d.mts} +16 -1
- package/dist/{video-adapter-DrTI5cRl.d.mts → video-adapter-BUMpNTCP.d.mts} +1 -1
- package/dist/workspace-snapshot-LKQWBDNS.mjs +2 -0
- package/package.json +32 -22
- package/dist/ParticipantRuntime-XGBQEJLU.mjs +0 -139
- package/dist/browser-runtime-7324UU2Y.mjs +0 -2
- package/dist/chunk-3LBOX7HQ.mjs +0 -3
- package/dist/chunk-CXTR5UHL.mjs +0 -342
- package/dist/chunk-ENGMQINZ.mjs +0 -62
- package/dist/codex-note-context-EKARSPXV.mjs +0 -2
- package/dist/focus-inspection-2FPCQIN2.mjs +0 -2
- package/dist/peer-client-CVBTNOO5.mjs +0 -2
- package/dist/workspace-snapshot-EJQHHDQ4.mjs +0 -2
- /package/dist/{chunk-42LISDBE.mjs → chunk-MINAH2EM.mjs} +0 -0
- /package/dist/{chunk-2RRYBN2J.mjs → chunk-V44RIEET.mjs} +0 -0
package/dist/chunk-ENGMQINZ.mjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as Mn}from"./chunk-MP7S5ALD.mjs";import{j as vt,a as V,f as Sn,i as He,g as Tn,h as bt}from"./chunk-XOGBFVWI.mjs";import{b as We,g as je,e as Ye}from"./chunk-2RRYBN2J.mjs";import{a as In,b as kn}from"./chunk-LVEMYZOA.mjs";import{a as Mt,d as ke,v as En,h as Cn,i as St,c as Ee,f as Ce,b as Tt,e as An,g as Rn}from"./chunk-HGW2U6PD.mjs";import{Clock as It,OctagonAlert as Nn,MessageCircleQuestionMark as Ln,TriangleAlert as Dn,Reply as On,Eye as $n,SendHorizontal as Ae,CornerDownLeft as _n}from"lucide-react";import{createContext as qe,useContext as ye,useState as re,useEffect as G,useLayoutEffect as kt,useId as Fn,useRef as le,useMemo as Pn,useCallback as zn,useReducer as Bn,useSyncExternalStore as Hn}from"react";import{jsxs as R,jsx as x,Fragment as W}from"react/jsx-runtime";var Re=new Set,Ne;function Ue(e){if(Re.add(e),!Ne){let t=new Map,o=new Map,i="",n=!0,r=!0,a=!1,l=!0,d=0,u=()=>{let h=new Set,c=new Map,f=y=>{if(h.add(y),!t.has(y)){let m=new MutationObserver(k=>{let w=k.filter(v=>!(v.target.nodeType===1?v.target:v.target.parentElement)?.closest("[data-devtools]"));w.length&&(n=!0),w.some(v=>v.type==="childList")&&(r=!0)});m.observe(y,{subtree:!0,childList:!0,characterData:!0,attributes:!0});let g=()=>{n=!0};y.addEventListener("scroll",g,!0),y.addEventListener("load",g,!0),t.set(y,()=>{m.disconnect(),y.removeEventListener("scroll",g,!0),y.removeEventListener("load",g,!0)})}for(let m of y.querySelectorAll("*")){if(m.shadowRoot&&!m.closest("[data-devtools]")&&f(m.shadowRoot),m.localName!=="iframe"||m.closest("[data-devtools],[data-popmelt-peer-surface]"))continue;let g=Tt(m);c.set(m,g),g&&f(g)}};f(document);for(let[y,m]of t)h.has(y)||(m(),t.delete(y));o=c,r=!1,n=!0},p=()=>{if(!l)return;(r||[...o].some(([f,y])=>Tt(f)!==y))&&u();let h=[];for(let[f,y]of o){let m=f.getBoundingClientRect();h.push(y?.URL,m.x,m.y,m.width,m.height,y?.defaultView?.scrollX,y?.defaultView?.scrollY)}let c=JSON.stringify(h);if((n||c!==i)&&(n=!1,i=c,a))for(let f of Re)f();a=!0,l&&(d=requestAnimationFrame(p))};p(),Ne=()=>{l=!1,cancelAnimationFrame(d);for(let h of t.values())h()}}return()=>{Re.delete(e),Re.size||(Ne?.(),Ne=void 0)}}var Le=qe(!0);function Xe(e,t){let o=e.match(/^oklch\(([^)]+)\)$/i);if(o)return`oklch(${o[1]} / ${t})`;let i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(i){let n=parseInt(i[1],16),r=parseInt(i[2],16),a=parseInt(i[3],16);return`rgba(${n}, ${r}, ${a}, ${t})`}return`color-mix(in srgb, ${e} ${Math.round(t*100)}%, transparent)`}function Et(e,t){let o=Tn(e),i=t.toLowerCase(),n=-1;for(let r=o.length-1;r>=0;r--){let a=o[r].name;if(a===t){let l=bt(o[r].fiber)??e;return{name:t,path:o.map(d=>d.name),depthIndex:r,rootElement:l}}if(n===-1){let l=a.toLowerCase();(l.length>=4&&i.includes(l)||i.length>=4&&l.includes(i))&&(n=r)}}if(n>=0){let r=bt(o[n].fiber)??e;return{name:t,path:o.map(a=>a.name),depthIndex:n,rootElement:r}}return null}function Wn(e){let t=De(),o=[],i=new Set,n=t.currentNode;for(;n=t.nextNode();){let r=Et(n,e);r&&!i.has(r.rootElement)&&(i.add(r.rootElement),o.push(r))}return o}function jn(e){let t=new Map;if(e.size===0)return t;let o=new Set(e),i=De(),n=new Set,r=i.currentNode;for(;(r=i.nextNode())&&o.size>0;)for(let a of o){let l=Et(r,a);if(!l||n.has(l.rootElement))continue;n.add(l.rootElement);let d=l.rootElement.getBoundingClientRect();t.set(a,d.top+window.scrollY),o.delete(a);break}for(let a of o)t.set(a,1/0);return t}function De(){return document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return e.closest("#devtools-toolbar, #devtools-canvas, #devtools-scrim, [data-popmelt-panel]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}})}function q(e,t){return e.style.getPropertyValue(t)!==""}function Yn(e,t=30){if(e<=0)return[];let o=[],i=De(),n=.5,r=i.currentNode;for(;(r=i.nextNode())&&o.length<t;){let a=r,l=a.getBoundingClientRect();if(l.bottom<-50||l.top>window.innerHeight+50||l.right<-50||l.left>window.innerWidth+50||l.width<1||l.height<1)continue;let d=getComputedStyle(a);!q(a,"padding-top")&&Math.abs((parseFloat(d.paddingTop)||0)-e)<n&&o.push({element:a,property:"padding-top"}),!q(a,"padding-bottom")&&Math.abs((parseFloat(d.paddingBottom)||0)-e)<n&&o.length<t&&o.push({element:a,property:"padding-bottom"}),!q(a,"padding-left")&&Math.abs((parseFloat(d.paddingLeft)||0)-e)<n&&o.length<t&&o.push({element:a,property:"padding-left"}),!q(a,"padding-right")&&Math.abs((parseFloat(d.paddingRight)||0)-e)<n&&o.length<t&&o.push({element:a,property:"padding-right"}),!q(a,"margin-top")&&Math.abs((parseFloat(d.marginTop)||0)-e)<n&&o.length<t&&o.push({element:a,property:"margin-top"}),!q(a,"margin-bottom")&&Math.abs((parseFloat(d.marginBottom)||0)-e)<n&&o.length<t&&o.push({element:a,property:"margin-bottom"}),!q(a,"margin-left")&&Math.abs((parseFloat(d.marginLeft)||0)-e)<n&&o.length<t&&o.push({element:a,property:"margin-left"}),!q(a,"margin-right")&&Math.abs((parseFloat(d.marginRight)||0)-e)<n&&o.length<t&&o.push({element:a,property:"margin-right"});let u=d.display;if((u.includes("flex")||u.includes("grid"))&&o.length<t){let p=q(a,"gap"),h=parseFloat(d.gap)||0,c=parseFloat(d.rowGap)||0,f=parseFloat(d.columnGap)||0;!p&&Math.abs(h-e)<n?o.push({element:a,property:"gap"}):!q(a,"row-gap")&&Math.abs(c-e)<n?o.push({element:a,property:"row-gap"}):!q(a,"column-gap")&&Math.abs(f-e)<n&&o.push({element:a,property:"column-gap"})}}return o}function qn(e){return typeof e=="string"?{value:e}:e}var Ct={gap:["gap","row-gap","column-gap"],padding:["padding-top","padding-bottom","padding-left","padding-right"],margin:["margin-top","margin-bottom","margin-left","margin-right"]};function At(e,t){let o=Ct[t];return o?o.includes(e):!1}function Un(e,t){let o=e.split(/\s+/);for(let i of o){if(i===t)return!0;let n=i.lastIndexOf(":");if(n>=0&&i.slice(n+1)===t)return!0}return!1}function Xn(e){let t=e.lastIndexOf(":"),o=t>=0?e.slice(t+1):e,i=o.indexOf("-");if(i<0)return null;let n=o.slice(0,i),r={gap:"gap","gap-x":"column-gap","gap-y":"row-gap",p:"padding",pt:"padding-top",pb:"padding-bottom",pl:"padding-left",pr:"padding-right",px:"padding-left",py:"padding-top",m:"margin",mt:"margin-top",mb:"margin-bottom",ml:"margin-left",mr:"margin-right",mx:"margin-left",my:"margin-top"},a=o.slice(0,o.indexOf("-",i+1)>0?o.indexOf("-",i+1):i);return r[a]??r[n]??null}function Kn(e,t=30){let o=parseFloat(e.value);if(isNaN(o)||o<=0)return[];if(e.bindings&&e.bindings.length>0){let n=[],r=De(),a=r.currentNode;for(;(a=r.nextNode())&&n.length<t;){let l=a,d=l.getBoundingClientRect();if(d.bottom<-50||d.top>window.innerHeight+50||d.right<-50||d.left>window.innerWidth+50||d.width<1||d.height<1)continue;let u=l.className;if(typeof u=="string")for(let p of e.bindings){if(!Un(u,p))continue;let h=Xn(p);if(h&&!(e.property&&!At(h,e.property))){n.push({element:l,property:h});break}}}return n}let i=Yn(o,t*2);return e.property?i.filter(n=>At(n.property,e.property)).slice(0,t):i.slice(0,t)}function Vn(e,t){let o=new Set,i=we(t);for(let n of e){let r=Rt[n.property];if(!r)continue;let a=n.element.className;if(typeof a=="string")for(let l of r){let d=`${l}-${i}`;for(let u of a.split(/\s+/)){let p=u.lastIndexOf(":"),h=p>=0?u.slice(p+1):u;if(h===d){o.add(h);break}}}}return[...o]}function Gn(e){let t=new Set;for(let o of e)for(let[i,n]of Object.entries(Ct))if(n.includes(o.property)){t.add(i);break}if(t.size===1)return[...t][0]}function Jn(e,t,o){if(t===o)return e;let i=we(t),n=we(o);return e.map(r=>{let a=r.lastIndexOf("-");if(a<0)return r;let l=r.slice(0,a),d=r.slice(a+1);return d===i||d===`[${t}px]`?`${l}-${n}`:r})}var Qn={0:"0",1:"px",2:"0.5",4:"1",6:"1.5",8:"2",12:"3",16:"4",20:"5",24:"6",28:"7",32:"8",40:"10",48:"12",64:"16",80:"20",96:"24"};function we(e){return Qn[e]??`[${e}px]`}var Rt={"padding-top":["pt","py","p"],"padding-bottom":["pb","py","p"],"padding-left":["pl","px","p"],"padding-right":["pr","px","p"],"margin-top":["mt","my","m"],"margin-bottom":["mb","my","m"],"margin-left":["ml","mx","m"],"margin-right":["mr","mx","m"],gap:["gap"],"row-gap":["gap-y","gap"],"column-gap":["gap-x","gap"]};function Zn(e,t,o,i){let n=Rt[t];if(!n)return null;let r=we(o);for(let a of n){let l=new RegExp("(?:^|\\s)((?:[\\w-]+:)*"+a+"-(?:"+eo(r)+"|\\["+o+"px\\]))(?:\\s|$)"),d=e.match(l);if(d?.[1]){let u=we(i),p=d[1].lastIndexOf(":"),h=p>=0?d[1].slice(0,p+1):"";return{matched:d[1],suggested:`${h}${a}-${u}`}}}return null}function eo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function to(e,t,o){let i=new Set,n=[];for(let r of e){let a=V(r.element),l=`${a}::${r.property}`;if(i.has(l))continue;i.add(l);let d=Sn(r.element),u=r.element.className||"",p=Zn(u,r.property,t,o);n.push({selector:a,reactComponent:d?.name,className:u,property:r.property,matchedClass:p?.matched,suggestedClass:p?.suggested})}return n}function no(e){let t=window.getComputedStyle(e).display;return t==="flex"||t==="inline-flex"||t==="grid"||t==="inline-grid"}function oo(e){let t=window.getComputedStyle(e);return{row:parseFloat(t.rowGap)||0,column:parseFloat(t.columnGap)||0}}function io(e){let t=[];for(let o of e){let i=t.find(n=>n.axis!==o.axis?!1:o.axis==="row"?Math.abs(n.y-o.y)<2&&Math.abs(n.h-o.h)<2:Math.abs(n.x-o.x)<2&&Math.abs(n.w-o.w)<2);if(i)if(o.axis==="row"){let n=Math.min(i.x,o.x),r=Math.max(i.x+i.w,o.x+o.w);i.x=n,i.w=r-n}else{let n=Math.min(i.y,o.y),r=Math.max(i.y+i.h,o.y+o.h);i.y=n,i.h=r-n}else t.push({...o})}return t}function ao(e){let t=Array.from(e.children).filter(l=>{if(!(l instanceof HTMLElement))return!1;let d=window.getComputedStyle(l);return d.display!=="none"&&d.position!=="absolute"&&d.position!=="fixed"});if(t.length<2)return[];let o=[],i=e.getBoundingClientRect(),n=window.getComputedStyle(e).flexDirection,r=n==="column"||n==="column-reverse",a=6;for(let l=0;l<t.length-1;l++){let d=t[l].getBoundingClientRect(),u=t[l+1].getBoundingClientRect();if(u.left>d.right+.5&&o.push({axis:"column",x:d.right,y:i.top,w:u.left-d.right,h:i.height}),u.top>d.bottom+.5&&o.push({axis:"row",x:i.left,y:d.bottom,w:i.width,h:u.top-d.bottom}),!(u.left>d.right+.5)&&!(u.top>d.bottom+.5))if(r){let p=(d.bottom+u.top)/2;o.push({axis:"row",x:i.left,y:p-a/2,w:i.width,h:a})}else{let p=(d.right+u.left)/2;o.push({axis:"column",x:p-a/2,y:i.top,w:a,h:i.height})}}return io(o)}function ro(e,t){let o=window.getComputedStyle(e),i=o.display;if(i!=="flex"&&i!=="inline-flex")return!1;let n=o.justifyContent;if(n!=="space-between"&&n!=="space-around"&&n!=="space-evenly"&&n!=="stretch")return!1;let r=o.flexDirection;return!(t!==(r==="column"||r==="column-reverse"?"row":"column")||parseFloat(t==="row"?o.rowGap:o.columnGap)>0)}function lo(e){let t=window.getComputedStyle(e);return{top:parseFloat(t.paddingTop)||0,right:parseFloat(t.paddingRight)||0,bottom:parseFloat(t.paddingBottom)||0,left:parseFloat(t.paddingLeft)||0}}function so(e){let t=window.getComputedStyle(e);return{top:parseFloat(t.marginTop)||0,right:parseFloat(t.marginRight)||0,bottom:parseFloat(t.marginBottom)||0,left:parseFloat(t.marginLeft)||0}}function Nt(e){let t=window.getComputedStyle(e);return{topLeft:t.borderTopLeftRadius,topRight:t.borderTopRightRadius,bottomRight:t.borderBottomRightRadius,bottomLeft:t.borderBottomLeftRadius}}function Lt(e){let t=window.getComputedStyle(e);return{"top-left":parseFloat(t.borderTopLeftRadius)||0,"top-right":parseFloat(t.borderTopRightRadius)||0,"bottom-right":parseFloat(t.borderBottomRightRadius)||0,"bottom-left":parseFloat(t.borderBottomLeftRadius)||0}}function uo(e){for(let t of e.childNodes)if(t.nodeType===Node.TEXT_NODE&&(t.textContent||"").trim().length>0)return!0;return!1}function po(e){let t=document.createRange(),o=!1;for(let p of e.childNodes)p.nodeType===Node.TEXT_NODE&&(p.textContent||"").trim().length>0&&(o||(t.setStart(p,0),o=!0),t.setEnd(p,p.textContent?.length??0));if(!o)return null;let i=t.getBoundingClientRect(),n=window.getComputedStyle(e),r=parseFloat(n.fontSize)||16,a=parseFloat(n.lineHeight);isNaN(a)&&(a=r*1.2);let l=Math.max(1,t.getClientRects().length),d=Math.max(i.height,l*a),u=(d-i.height)/2;return new DOMRect(i.x,i.y-u,i.width,d)}function co(e){let t=window.getComputedStyle(e),o=parseFloat(t.fontSize)||16,i=parseFloat(t.lineHeight);return isNaN(i)&&(i=o*1.2),{fontSize:o,lineHeight:i}}function fo(e){let t=e.startsWith("top-");return{top:t?4:12,right:4,bottom:t?12:4,left:4}}function ho({hasCommentEntry:e,stagedChangeCount:t}){return e&&t===0?2:6}function go({annotationNumber:e,stickerCount:t,interactionEpisodeStepCount:o,hasStatus:i,hasSend:n,controlGap:r}){let a=16+Math.max(1,e===void 0?0:String(e).length)*7.2,l=t*28-Math.max(0,t-1)*2,d=o>0?32+String(o).length*7.2:0,u=28,p=t>0?l+(d>0?d-2:0)+(n?u-2:0):0,h=[t>0?p:0,t===0?d:0,t===0&&n?u:0,i?u:0].filter(c=>c>0);return a+h.reduce((c,f)=>c+f,0)+h.length*r}function mo(e,t,o){let i=e.horizontalAlignment==="right"?e.left-t:e.left;return{left:i,top:e.top,right:i+t,bottom:e.top+o}}function yo(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function wo(e,t,o){let i=Math.max(0,e.left+t-o);return Math.max(0,t-e.right)<i?"right":"left"}function Dt(e,t,o,i,n=0,r=Number.POSITIVE_INFINITY){if(e.height>=i)return{anchor:"top-left",horizontalAlignment:"left",left:e.left+8,top:e.top+8};let a=wo(e,n,r);return e.top>=t+o?{anchor:a==="right"?"top-right":"top-left",horizontalAlignment:a,left:a==="right"?e.right:e.left,top:e.top-t-o}:{anchor:a==="right"?"bottom-right":"bottom-left",horizontalAlignment:a,left:a==="right"?e.right:e.left,top:e.bottom+o}}function Ke(e){return e.left+e.width}function Oe(e){return e.top+e.height}function Ve(e,t){if(e.length===0)return t;let o=Math.min(...e.map(a=>a.left)),i=Math.min(...e.map(a=>a.top)),n=Math.max(...e.map(Ke)),r=Math.max(...e.map(Oe));return{left:o,top:i,width:n-o,height:r-i}}function Ge(e){let t=[...e].sort((i,n)=>i.top-n.top||i.left-n.left),o=[];for(let i of t){let n=i.top+i.height/2,r=o.find(p=>{let h=p.top+p.height/2;return Math.abs(n-h)<=Math.max(p.height,i.height)*.4});if(!r){o.push({...i});continue}let a=Math.min(r.left,i.left),l=Math.min(r.top,i.top),d=Math.max(Ke(r),Ke(i)),u=Math.max(Oe(r),Oe(i));r.left=a,r.top=l,r.width=d-a,r.height=u-l}return o.sort((i,n)=>i.top-n.top||i.left-n.left)}function xo({display:e,fragmentRects:t,elementRect:o,parentContentRect:i}){let n=Ge(t),r=Ve(n,o);if(!(e==="inline"&&n.length>1&&i&&i.width>0))return{textRect:r,boundaryRect:o,boundaryRects:[o],firstLineIndent:0};let a=n[0],l={left:i.left,top:a.top,width:i.width,height:Math.max(r.height,Oe(r)-a.top)},d=Math.max(0,Math.min(l.width,a.left-l.left));return{textRect:r,boundaryRect:Ve(n,o),boundaryRects:n,flowRect:l,firstLineIndent:d}}var Je=new WeakMap;function vo(e){let t={listeners:new Set,rafId:null,schedule:()=>{t.rafId===null&&(t.rafId=e.requestAnimationFrame(()=>{t.rafId=null;for(let o of t.listeners)o()}))}};return Je.set(e,t),e.addEventListener("scroll",t.schedule,{passive:!0,capture:!0}),e.addEventListener("resize",t.schedule),t}function Ot(e,t=window){let o=Je.get(t)??vo(t);return o.listeners.add(e),()=>{o.listeners.delete(e)&&(o.listeners.size>0||(t.removeEventListener("scroll",o.schedule,!0),t.removeEventListener("resize",o.schedule),o.rafId!==null&&t.cancelAnimationFrame(o.rafId),Je.delete(t)))}}var de={topLeft:"0px",topRight:"0px",bottomRight:"0px",bottomLeft:"0px"};function $t(e,t){return e.radii.topLeft!==t.radii.topLeft||e.radii.topRight!==t.radii.topRight||e.radii.bottomRight!==t.radii.bottomRight||e.radii.bottomLeft!==t.radii.bottomLeft||e.outline!==t.outline||e.fragments.length!==t.fragments.length?!1:e.fragments.every((o,i)=>{let n=t.fragments[i];return!!n&&o.left===n.left&&o.top===n.top&&o.width===n.width&&o.height===n.height})}function _t(e){if(!e.isConnected||!Cn(e.ownerDocument))return{fragments:[],radii:de};let t=St(ke(e),e.ownerDocument);if(Mt(e.ownerDocument)&&(!t.width||!t.height))return{fragments:[],radii:de};if(e.getAttribute("data-popmelt-subject-projection")==="true")return{fragments:[{left:t.left,top:t.top,width:t.width,height:t.height}],radii:de,outline:e.getAttribute("data-popmelt-subject-outline")??void 0};let o=Array.from(e.getClientRects()).map(i=>St(Ee(i,e.ownerDocument),e.ownerDocument)).filter(i=>i.width>0&&i.height>0).map(i=>({left:i.left,top:i.top,width:i.width,height:i.height}));return{fragments:Ge(o.length>0?o:[{left:t.left,top:t.top,width:t.width,height:t.height}]),radii:Nt(e)}}function Ft({element:e,projectedRect:t,isSelected:o=!1,elementInfo:i,color:n="#3b82f6",annotationNumber:r,changeCount:a,hideTooltip:l=!1,hideOutline:d=!1,hideFill:u=!1,fillOpacity:p=.05,subjectRegistry:h,railGap:c=2,railHeight:f=22,railWidth:y=0,renderRail:m,refreshKey:g,outlineZIndex:k=9996,onActivate:w,onRemove:v}){let S=ye(Le),[b,C]=re({fragments:[],radii:de});G(()=>{if(!S)return;if(!e){C({fragments:[],radii:de});return}let P=null,H=()=>{let ee=_t(e);C(Te=>$t(Te,ee)?Te:ee)},E=()=>{P===null&&(P=requestAnimationFrame(()=>{P=null,H()}))};H();let ce=e.getAttribute("data-popmelt-subject-projection")==="true"&&!!h,fe=ce?h.subscribeFrame(H):void 0,he=ce||typeof ResizeObserver>"u"?null:new ResizeObserver(E);he?.observe(e);let B=ce?null:new MutationObserver(E);B?.observe(e,{attributes:!0,attributeFilter:["style","class"]});let ae=Ot(H,e.ownerDocument.defaultView??window),ge=Mt(e.ownerDocument)?Ue(H):void 0;return()=>{ae(),ge?.(),fe?.(),he?.disconnect(),B?.disconnect(),P!==null&&cancelAnimationFrame(P)}},[S,e,h]),kt(()=>{if(!S||!e||g===void 0)return;let P=_t(e);C(H=>$t(H,P)?H:P)},[S,e,g]);let{fragments:N,radii:z}=t?{fragments:[t],radii:de}:b;if(N.length===0||!e&&!t)return null;let A=Ve(N,N[0]),I=e?.tagName.toLowerCase()??"",K=e?.id?`#${e.id}`:"",oe=e&&e.classList.length>0?"."+Array.from(e.classList).slice(0,2).join("."):"",ie=i?.reactComponent,be=e?.getAttribute("data-popmelt-subject-adapter"),Me=e?.getAttribute("data-popmelt-subject-label"),Pe=be&&Me?`<${Me}>`:ie?`<${ie}> ${I}${K}${oe}`:`${I}${K}${oe}`,Z=Dt({left:A.left,right:A.left+A.width,top:A.top,bottom:A.top+A.height,height:A.height},f,c,window.innerHeight,y,window.innerWidth),Se={zIndex:9997,display:"flex",alignItems:"center",gap:6,backgroundColor:n,color:"#fff",fontSize:12,fontFamily:We,lineHeight:"14px",padding:"4px 8px",borderRadius:8,pointerEvents:"none",whiteSpace:"nowrap",maxWidth:400,position:"fixed",top:Z.top,left:Z.left},ze=!l&&R("div",{ref:P=>{e&&In(e,P)},"data-devtools":"tooltip",style:Se,children:[r!==void 0&&R("span",{children:[r,"."]}),x("span",{style:{overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},children:Pe}),a!==void 0&&a>0&&R("span",{style:{opacity:.8},children:["(",a," ",a===1?"change":"changes",")"]})]});return R(W,{children:[!d&&N.map((P,H)=>x("div",{"data-devtools":"highlight",onContextMenu:v?E=>{E.preventDefault(),E.stopPropagation(),v()}:void 0,role:w?"button":void 0,tabIndex:w?0:void 0,"aria-label":w?"Open annotation thread":void 0,onPointerDown:w?E=>{E.preventDefault(),E.stopPropagation()}:void 0,onClick:w?E=>{E.preventDefault(),E.stopPropagation(),w()}:void 0,onKeyDown:w?E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),E.stopPropagation(),w())}:void 0,style:{position:"fixed",top:P.top,left:P.left,width:P.width,height:P.height,pointerEvents:w||v?"auto":"none",cursor:w?"pointer":void 0,zIndex:k,overflow:"visible"},children:x("div",{style:b.outline?{position:"absolute",inset:0,pointerEvents:"none"}:{position:"absolute",inset:0,boxSizing:"border-box",backgroundColor:u?"transparent":Xe(n,p),borderColor:n,borderStyle:o?"solid":"dashed",borderWidth:1,borderTopLeftRadius:z.topLeft,borderTopRightRadius:z.topRight,borderBottomRightRadius:z.bottomRight,borderBottomLeftRadius:z.bottomLeft,pointerEvents:"none"},children:b.outline?x("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",style:{display:"block",overflow:"visible"},"aria-hidden":"true",children:x("polygon",{points:b.outline,fill:u?"transparent":Xe(n,p),stroke:n,strokeWidth:1,strokeDasharray:o?void 0:"4 3",vectorEffect:"non-scaling-stroke"})}):null})},`${P.left}:${P.top}:${H}`)),m?m(Z,A):ze]})}function Pt(e){return e==="bottom-left"?[2,8,8,8]:e==="bottom-right"?[8,2,8,8]:e==="top-right"?[8,8,2,8]:[8,8,8,2]}function bo(e){return Pt(e).map(t=>`${t}px`).join(" ")}var xe=1.1666666666666667,zt=2048;function Qe(e){return e.length>zt?`${e.slice(0,zt)}\u2026`:e}function Mo(e,t,o){let i=Qe(t);if(!i||e.measureText(i).width<=o)return[i];let n=i.split(/\s+/),r=[],a="";for(let l of n){let d=a?`${a} ${l}`:l;a&&e.measureText(d).width>o?(r.push(a),a=l):a=d}return a&&r.push(a),r.length>0?r:[i]}function So(e,t,o){return t.flatMap(i=>Mo(e,i,o))}var ne=We,Ze=400,Bt=16,et=60,To=12,tt=16;function Ht(e){let t=window.innerWidth-e-Bt;return Math.max(et,Math.min(Ze,t))}function nt(e,t,o){let i=Qe(t);if(i===t&&e.measureText(i).width<=o)return i;let n="\u2026",r=0,a=i.endsWith(n)?i.length-1:i.length;for(;r<a;){let l=Math.ceil((r+a)/2);e.measureText(i.slice(0,l)+n).width<=o?r=l:a=l-1}return r>0?i.slice(0,r)+n:n}function Io(e,t,o){if(e===void 0||t===void 0||o.avoidLeft===void 0&&o.avoidRight===void 0)return!0;let i=typeof window<"u"?window.innerWidth:9999,n=o.avoidLeft??0,r=o.avoidRight??i;return e+t>n&&e<r}function Wt(e,t,o,i,n){let r=typeof window<"u"?window.innerHeight:9999,a=0,l=r;o&&Io(i,n,o)&&(a=o.avoidTop??a,l=o.avoidBottom??l);let d=Math.max(a,l-t);return Math.max(a,Math.min(e,d))}function jt(e,t=12,o,i){let n=t*xe+8,r=e.y-4,a=e.x-8,l=Wt(r,n,o,a,i);return l===r?e:{...e,y:l+4}}function ko(e,t,o,i,n=12,r,a,l,d="#dddddd",u,p=!1){if(!o)return;let h=n*xe,c=o.replace(/\n/g," "),f=r!==void 0?r+". "+c:c;e.font=`${n}px ${ne}`,e.textBaseline="middle";let y=a!==void 0?Math.min(Ze,Math.max(et,window.innerWidth-a-Bt)):Ze,m=p?tt:0,g=nt(e,f,Math.max(et,y-m)),k=e.measureText(g).width,w=m+k,v=jt(t,n,l,w+16);e.fillStyle=i;let S=v.x-8,b=v.y-4,C=w+16,N=h+8;e.beginPath(),e.roundRect(S,b,C,N,Pt(u)),e.fill();let z=v.y+h/2;if(p){let A=v.x,I=z-To/2;e.strokeStyle=d,e.lineWidth=1.5,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(A+7.5,I+4),e.lineTo(A+10.5,I+6.5),e.lineTo(A+7.5,I+9),e.moveTo(A+1.5,I+1.5),e.lineTo(A+1.5,I+4.5),e.quadraticCurveTo(A+1.5,I+6.5,A+3.5,I+6.5),e.lineTo(A+10.5,I+6.5),e.stroke()}e.fillStyle=d,e.fillText(g,v.x+m,z)}function Eo(e,t,o){let i=e.filter(n=>!n.captured&&n.selector===t&&(!n.pathname||n.pathname===o));return i.length?{type:"MODIFY_TEXT_CONTENTS",payload:i.map(n=>({...n,modified:n.original}))}:null}function Yt(e,t){return e.type!=="text"?!1:(e.groupId?t.filter(o=>o.groupId===e.groupId):[e]).every(o=>(o.status??"pending")==="pending"&&!o.threadId)}var qt=qe(0),ot=`
|
|
3
|
-
0%, 100% { translate: 0 0; }
|
|
4
|
-
20% { translate: -4px 0; }
|
|
5
|
-
45% { translate: 4px 0; }
|
|
6
|
-
70% { translate: -2px 0; }
|
|
7
|
-
88% { translate: 1px 0; }
|
|
8
|
-
`;function it(e=22){return{height:e,minHeight:e,maxHeight:e,boxSizing:"border-box",flexShrink:0}}function Ut(e){return`
|
|
9
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
|
|
10
|
-
<defs>
|
|
11
|
-
<mask id="cutout">
|
|
12
|
-
<rect width="100%" height="100%" fill="white" />
|
|
13
|
-
<rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="${e.radius}" fill="black" />
|
|
14
|
-
</mask>
|
|
15
|
-
</defs>
|
|
16
|
-
<rect width="100%" height="100%" fill="white" mask="url(#cutout)" />
|
|
17
|
-
</svg>`}function Xt(e){return`url("data:image/svg+xml,${encodeURIComponent(e)}")`}var ve=Xt(Ut({x:-100,y:-2,width:104,height:26,radius:10})),Co=Xt(Ut({x:-100,y:-5.929,width:108,height:26,radius:10})),at=10;function Ao(e){if(!(!Number.isFinite(e)||e<=0))return Math.max(1,Math.round(e/6))*6}function Ro(e,t,o){let i={topLeft:Math.max(0,o.topLeft),topRight:Math.max(0,o.topRight),bottomRight:Math.max(0,o.bottomRight),bottomLeft:Math.max(0,o.bottomLeft)},n=Math.min(1,e/Math.max(1,i.topLeft+i.topRight),e/Math.max(1,i.bottomLeft+i.bottomRight),t/Math.max(1,i.topLeft+i.bottomLeft),t/Math.max(1,i.topRight+i.bottomRight));return{topLeft:i.topLeft*n,topRight:i.topRight*n,bottomRight:i.bottomRight*n,bottomLeft:i.bottomLeft*n}}function No(e,t,o,i=.5){let n=Math.max(0,e-i*2),r=Math.max(0,t-i*2),a=Ro(e,t,o),l=Math.max(0,a.topLeft-i),d=Math.max(0,a.topRight-i),u=Math.max(0,a.bottomRight-i),p=Math.max(0,a.bottomLeft-i),h=i+n,c=i+r;return[`M ${i+l} ${i}`,`H ${h-d}`,`A ${d} ${d} 0 0 1 ${h} ${i+d}`,`V ${c-u}`,`A ${u} ${u} 0 0 1 ${h-u} ${c}`,`H ${i+p}`,`A ${p} ${p} 0 0 1 ${i} ${c-p}`,`V ${i+l}`,`A ${l} ${l} 0 0 1 ${i+l} ${i}`,"Z"].join(" ")}var se=12,J=8,ue=8;function Kt(e){return e>0?16+String(e).length*7.2+16:0}function Vt({stepCount:e,onClear:t,layered:o=!1,submitted:i=!1,style:n}){let[r]=je(),a=Ye[r];if(e<1)return null;let l=`${e} recorded ${e===1?"action":"actions"}${i?", sent":""}`;return R("span",{"data-devtools":"interaction-episode-badge","data-popmelt-submitted":i?"true":void 0,"aria-label":l,onContextMenu:d=>{d.preventDefault(),d.stopPropagation(),t?.()},style:{height:22,display:"inline-flex",alignItems:"center",boxSizing:"border-box",backgroundColor:i?"#8c8c8c":a.surface,border:`1px solid ${i?"#8c8c8c":a.border}`,borderRadius:J,color:i?"#dddddd":a.primary,fontFamily:ne,fontSize:12,fontWeight:600,padding:o?`0 8px 0 ${at*.7}px`:"0 8px 0 5.6px",gap:4,pointerEvents:t?"auto":"none",WebkitMaskImage:o?ve:void 0,maskImage:o?ve:void 0,...n},children:[R("svg",{"aria-hidden":!0,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[x("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),x("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})]}),x("span",{children:e})]})}var Lo=3,Do=250;function Oo(e){let t=e?.current?.getBoundingClientRect();return!t||typeof window>"u"?{}:t.top<window.innerHeight/2?{avoidTop:t.bottom+ue,avoidLeft:t.left-ue,avoidRight:t.right+ue}:{avoidBottom:t.top-ue,avoidLeft:t.left-ue,avoidRight:t.right+ue}}function $o(e,t,o){if(o.avoidLeft===void 0&&o.avoidRight===void 0)return!0;let i=typeof window<"u"?window.innerWidth:9999,n=o.avoidLeft??0,r=o.avoidRight??i;return e+t>n&&e<r}function rt(e,t,o){return $o(t,o,e)?e:{}}function _o(e,t,o){let i=o.avoidTop!==void 0?`${o.avoidTop}px`:"0px",n=o.avoidBottom!==void 0?`${o.avoidBottom}px`:"100dvh";return`translate(min(0px, calc(100vw - ${e} - 100%)), min(max(0px, calc(${i} - ${t})), calc(${n} - ${t} - 100%)))`}function Gt(e,t,o){if(o.avoidTop===void 0&&o.avoidBottom===void 0)return e;let i=typeof window<"u"?window.innerHeight:9999,n=o.avoidTop??0,r=o.avoidBottom??i,a=Math.max(n,r-t);return Math.max(n,Math.min(e,a))}function Jt({left:e,top:t,scrollX:o,scrollY:i,avoidTop:n,avoidBottom:r,style:a,children:l,...d}){let u=`calc(${e}px - var(--popmelt-scroll-x, ${o}px))`,p=`calc(${t}px - var(--popmelt-scroll-y, ${i}px))`,h=`calc(${e+se}px - var(--popmelt-scroll-x, ${o}px))`,c=`calc(${t+se}px - var(--popmelt-scroll-y, ${i}px))`;return x("div",{"data-devtools":"badge-hit-area",...d,style:{position:"fixed",left:0,top:0,padding:se,...a,transform:`translate3d(${u}, ${p}, 0)`,willChange:"transform"},children:x("div",{style:{transform:_o(h,c,{avoidTop:n,avoidBottom:r})},children:l})})}function Qt({bundleCount:e,style:t,layered:o=!1,compact:i=!1,description:n,replacementText:r,onHoverChange:a,onSend:l}){let[d,u]=re(!1),[p]=je(),h=Ye[p],c=ye(qt),f=Fn(),y=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"\u2318":"Ctrl",m=Math.max(1,e),g=i&&!d,k=C=>g?x(Ae,{size:12,strokeWidth:2,"aria-hidden":!0}):C?R(W,{children:[x("span",{style:{color:"inherit",fontWeight:600},children:m>1?`Send all ${m}`:"Send"}),x(Ae,{size:12,strokeWidth:2,"aria-hidden":!0})]}):R(W,{children:[R("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"inherit",fontWeight:600},children:[x("span",{children:y}),x("span",{children:"+"}),x(_n,{size:12,strokeWidth:2,"aria-hidden":!0})]}),x("span",{style:{color:h.secondary,fontWeight:600},children:"to"}),x(Ae,{size:12,strokeWidth:2,"aria-hidden":!0}),m>1&&x("span",{style:{color:"inherit",fontWeight:600},children:m})]}),w=C=>R(W,{children:[x("span",{className:"popmelt-send-hint-desktop",style:{alignItems:"center",gap:4},children:k(C)}),R("span",{className:"popmelt-send-hint-mobile",style:{alignItems:"center",gap:4},children:[!g&&x("span",{style:{color:"inherit",fontWeight:600},children:"Send"}),x(Ae,{size:12,strokeWidth:2,"aria-hidden":!0})]})]}),v=r?x("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:r}):null,S={...it(),lineHeight:`${12*xe}px`,display:"flex",alignItems:"center",boxSizing:"border-box",backgroundColor:h.surface,border:`1px solid ${h.border}`,fontFamily:ne,fontSize:12,color:h.primary,userSelect:"none",padding:o?`0 8px 0 ${at}px`:"0 8px",gap:4,whiteSpace:"nowrap",borderRadius:J,letterSpacing:"0.24px",WebkitMaskImage:o?ve:void 0,maskImage:o?ve:void 0},b=m>1?`Send all ${m} pending annotations`:"Send pending annotation";return R("div",{"data-devtools":"send-hint-hit-area","data-popmelt-send-rejection":c?c%2?"odd":"even":void 0,onMouseEnter:()=>{u(!0),a?.(!0)},onMouseLeave:()=>{u(!1),a?.(!1)},style:{display:"grid",width:"max-content",...t},children:[x("style",{children:`
|
|
18
|
-
@keyframes popmelt-send-rejection-odd { ${ot} }
|
|
19
|
-
@keyframes popmelt-send-rejection-even { ${ot} }
|
|
20
|
-
[data-popmelt-send-rejection="odd"] { animation: popmelt-send-rejection-odd 220ms ease-out; }
|
|
21
|
-
[data-popmelt-send-rejection="even"] { animation: popmelt-send-rejection-even 220ms ease-out; }
|
|
22
|
-
@media (prefers-reduced-motion: reduce) {
|
|
23
|
-
[data-popmelt-send-rejection] { animation: none; }
|
|
24
|
-
}
|
|
25
|
-
.popmelt-send-hint-desktop { display: inline-flex; }
|
|
26
|
-
.popmelt-send-hint-mobile { display: none; }
|
|
27
|
-
@media (max-width: 767px) {
|
|
28
|
-
.popmelt-send-hint-desktop { display: none; }
|
|
29
|
-
.popmelt-send-hint-mobile { display: inline-flex; }
|
|
30
|
-
}
|
|
31
|
-
`}),x("div",{"aria-hidden":!0,style:{...S,gridArea:"1 / 1",visibility:"hidden"},children:w(!1)}),R("button",{type:"button","data-devtools":"annotation-badge","aria-label":b,"aria-describedby":n?f:void 0,disabled:!l,onPointerDown:C=>{C.preventDefault(),C.stopPropagation()},onClick:C=>{C.preventDefault(),C.stopPropagation(),l?.()},style:{...S,gridArea:"1 / 1",justifySelf:"start",maxWidth:r?"min(320px, calc(100vw - 16px))":void 0,overflow:r?"hidden":void 0,appearance:"none",margin:0,opacity:1,cursor:l?"pointer":"default",touchAction:"manipulation"},children:[n&&x("span",{id:f,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:n}),v??w(d)]})]})}function Zt({count:e,color:t,size:o=22,onHoverChange:i}){return R("div",{"data-devtools":"nested-annotation-count-badge",onMouseEnter:()=>i?.(!0),onMouseLeave:()=>i?.(!1),style:{height:o,display:"flex",alignItems:"center",backgroundColor:t,color:t==="#8c8c8c"?"#dddddd":"#ffffff",fontFamily:ne,fontSize:12,fontWeight:600,lineHeight:1,padding:"0 8px",borderRadius:J,userSelect:"none",whiteSpace:"nowrap"},children:["+",e]})}function Fo({annotations:e,supersededAnnotations:t,inFlightIds:o,orientationLabels:i,activeIds:n,queuePositions:r,scrollX:a,scrollY:l,annotationGroupMap:d,onViewThread:u,onSelectAnnotation:p,onDeleteDraftAnnotation:h,onClearInteractionEpisode:c,onHoverAnnotation:f,canvasRef:y,toolbarRef:m,activeBundleAnnotationIds:g,inactiveBundleOpacity:k=.5,animateBundleOpacity:w=!0,hoverRestoredAnnotationIds:v,nestedAnnotationCountById:S,nestedAnnotationIdsById:b,onHoverNestedAnnotations:C,onHoverSendBundle:N,onSend:z,sendHintAnchorId:A,pendingBundleCount:I=1,parentPinnedAnnotationIds:K,parentPinnedLocationLabels:oe,parentPinnedTooltipAnnotationId:ie,onActivateAnnotation:be,hiddenAnnotationIds:Me,displayAnnotations:Pe}){let Z=ye(Le),Se=le(null),[ze,P]=re(0),H=!!(o&&o.size>0&&(n===void 0||n.size>0));G(()=>{if(!H||!Z)return;let s=setInterval(()=>{P(M=>(M+1)%Lo)},Do);return()=>{clearInterval(s)}},[H,Z]),G(()=>{if(!Z)return;let s=Se.current;if(!s)return;let M=()=>{s.style.setProperty("--popmelt-scroll-x",`${window.scrollX}px`),s.style.setProperty("--popmelt-scroll-y",`${window.scrollY}px`)};return M(),window.addEventListener("scroll",M,{passive:!0,capture:!0}),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[Z]);let E=[],ce=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"\u2318":"Ctrl";for(let s of e){if(s.type!=="text"||!s.text||!s.points[0]||t.has(s)||Me?.has(s.id))continue;let M=s.groupId?e.filter(T=>T.groupId===s.groupId):[s],O=s.status??"pending",F=I>0&&s.id===A,L=s.interactionEpisode?.steps.length??0,j=S?.get(s.id)??0,U=b?.get(s.id)??[],D=M.reduce((T,bn)=>Math.max(T,bn.replyCount??0),0),Y=O==="sending"||M.some(T=>T.status==="sending"),X=O==="awaiting_review",$=!Y&&(!!(o&&(o.has(s.id)||M.some(T=>o.has(T.id))))||s.status==="in_flight"||M.some(T=>T.status==="in_flight")),me=M.some(T=>T.status==="resolved"&&(T.replyCount??0)>0||T.status==="needs_review"),te=M.some(T=>T.threadId),cn=!g||M.some(T=>g.has(T.id)||v?.has(T.id));if(!(F||Y||X||$||O==="resolved"||O==="failed"||O==="needs_review"||me||te||L>0)&&j===0)continue;let fn=s.threadId||M.find(T=>T.threadId)?.threadId,ct=O==="needs_review"||M.some(T=>T.status==="needs_review"),ft=O==="waiting_input"||M.some(T=>T.status==="waiting_input"),ht=O==="failed"||M.some(T=>T.status==="failed"),gt=F||Y||X||$||ct||ft||ht||D>0||O==="resolved"&&te||L>0;if(!gt&&j===0)continue;let Be=s.points[0],mt=s.fontSize||12,hn=mt*xe,yt=d.get(s.id),wt=((Pe?.find(T=>T.id===s.id)??s).text??s.text).replace(/\n/g," "),gn=yt!==void 0?yt+". "+wt:wt,Ie=y?.current?.getContext("2d")??document.createElement("canvas").getContext("2d");if(!Ie)continue;Ie.font=`${mt}px ${ne}`;let mn=Be.x-a,xt=K?.has(s.id)?tt:0,yn=Math.max(60,Ht(mn)-xt),wn=nt(Ie,gn,yn),xn=Ie.measureText(wn).width,vn=$&&!!n&&!n.has(s.id)&&!M.some(T=>n.has(T.id));E.push({id:s.id,threadId:fn,linkedSelector:s.linkedSelector||M.find(T=>T.linkedSelector)?.linkedSelector,x:Be.x+xn+xt+8+2,y:Be.y-4,size:hn+8,color:F?"#000000":s.color,isSending:Y,isAwaitingReview:X,isInFlight:$,orientationLabel:i?.get(s.id)??M.map(T=>i?.get(T.id)).find(Boolean),isQueued:vn,queuePosition:void 0,isNeedsReview:ct,isQuestion:ft,isFailed:ht,replyCount:D>0?D:O==="resolved"&&te?1:0,isInActiveBundle:cn,isSendHint:F,interactionEpisodeStepCount:L,interactionEpisodeSubmitted:O!=="pending",nestedCount:j,nestedAnnotationIds:U,nestedColor:O==="pending"?s.color:"#8c8c8c",showActionBadge:gt,canDeleteDraft:Yt(s,e)})}let fe=E.filter(s=>s.isQueued);if(fe.length>0&&fe.forEach((s,M)=>{s.queuePosition=r?.get(s.id)??`(${M+1}/${fe.length})`}),E.length===0)return null;let he=2,B=y?.current?.getContext("2d")??document.createElement("canvas").getContext("2d"),ae=E.map(s=>{B&&(B.font=`12px ${ne}`);let M=s.nestedCount>0?(B?.measureText(`+${s.nestedCount}`).width??String(s.nestedCount).length*7.2+7.2)+16:0,O=Kt(s.interactionEpisodeStepCount);if(!s.showActionBadge)return M+O;let F=ie===s.id?oe?.get(s.id):void 0,L;F?L=F:s.isSendHint?L=ce:s.isSending?L="Sending":s.isAwaitingReview?L="Awaiting review":s.isInFlight?L=s.isQueued?`Queued${s.queuePosition?` ${s.queuePosition}`:""}`:s.orientationLabel??"Thinking":s.isQuestion?L="Question":s.isFailed?L="Failed":s.replyCount>0?L="Replied":L="Needs decision";let j=s.isSendHint||F?0:12,U=4,D=L.length*7.2;B&&(D=B.measureText(L).width);let Y=s.isSendHint&&B?B.measureText("to").width:s.isSendHint?14.4:0,X=s.isSendHint&&B?B.measureText("+").width:s.isSendHint?7.2:0,$=s.isSendHint&&I>1&&B?B.measureText(String(I)).width:s.isSendHint&&I>1?7.2:0,me=F?Math.min(D+16,320):s.isSendHint?D+X+Y+$+16+12+12+4+U*(I>1?3:2):6+j+U+D+8,te=+(O>0)+ +(M>0)+1;return O+M+me+(te-1)*2}),ge=Oo(m),ee=[];for(let s=0;s<E.length;s++){let M=E[s].y-l,O=E[s].x-a,F=rt(ge,O,ae[s]),L=Gt(M,E[s].size,F),j=L+E[s].size,U=O;for(let D=0;D<s;D++){let Y=E[D].y-l,X=rt(ge,ee[D],ae[D]),$=Gt(Y,E[D].size,X),me=$+E[D].size;if(!(L<me&&j>$))continue;let te=ee[D]+ae[D];U<te+he&&(U=te+he)}ee.push(U)}let Te={position:"fixed",inset:0,pointerEvents:"none",zIndex:9999,"--popmelt-scroll-x":`${a}px`,"--popmelt-scroll-y":`${l}px`};return R("div",{ref:Se,"data-devtools":"annotation-badge-layer",style:Te,children:[x("style",{dangerouslySetInnerHTML:{__html:`
|
|
32
|
-
[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"]::selection,
|
|
33
|
-
[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"] *::selection {
|
|
34
|
-
background: #000000;
|
|
35
|
-
color: #ffffff;
|
|
36
|
-
}
|
|
37
|
-
`}}),E.map((s,M)=>{let O=!!s.threadId,F=oe?.get(s.id),L=!!F&&ie===s.id,j=O||!!F,U=s.showActionBadge&&s.isSendHint,D=j&&!U,Y=()=>{if(be){be(s.id,s.threadId);return}p?.(s.id),s.threadId&&u?.(s.threadId)},X=rt(ge,ee[M],ae[M]);return x(Jt,{left:ee[M]+a-se,top:s.y-se,scrollX:a,scrollY:l,avoidTop:X.avoidTop,avoidBottom:X.avoidBottom,onMouseDown:$=>$.stopPropagation(),onContextMenu:$=>{$.preventDefault(),$.stopPropagation(),s.canDeleteDraft&&h&&h(s.id)},onClick:j?$=>{$.stopPropagation(),Y()}:void 0,onMouseEnter:()=>{f?.(s.id)},onMouseLeave:()=>{f?.(null)},onFocus:()=>f?.(s.id),onBlur:()=>f?.(null),onKeyDown:D?$=>{$.key!=="Enter"&&$.key!==" "||($.preventDefault(),Y())}:void 0,role:D?"button":void 0,tabIndex:D?0:void 0,"aria-label":D&&F?`${F}. Activate to reveal the annotation source${O?" and open its thread":""}`:void 0,style:{pointerEvents:"auto",cursor:j?"pointer":void 0,zIndex:9999,minWidth:s.isSendHint?ae[M]:void 0},children:R("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:2},children:[x(Vt,{stepCount:s.interactionEpisodeStepCount,submitted:s.interactionEpisodeSubmitted,onClear:s.canDeleteDraft&&c?()=>c(s.id):void 0}),s.nestedCount>0&&x(Zt,{count:s.nestedCount,color:s.nestedColor,size:s.size,onHoverChange:$=>C?.(s.id,$?s.nestedAnnotationIds:null)}),s.showActionBadge&&(s.isSendHint?x(Qt,{bundleCount:I,description:F?`${F}. Activate the annotation label to reveal its source.`:void 0,replacementText:L?F:void 0,onHoverChange:N,onSend:z}):x("div",{"data-devtools":"annotation-badge",style:{...it(s.size),display:"flex",alignItems:"center",backgroundColor:s.color,fontFamily:ne,fontSize:12,color:"#ffffff",userSelect:"none",padding:"0 8px 0 6px",gap:4,whiteSpace:"nowrap",maxWidth:L?"min(320px, calc(100vw - 16px))":void 0,overflow:L?"hidden":void 0,borderRadius:J,opacity:s.isInActiveBundle?1:k,transition:w?"opacity 120ms ease-out":"none"},children:L?x("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:F}):s.isAwaitingReview?R(W,{children:[x(It,{size:12,strokeWidth:2.25}),"Awaiting review"]}):s.isQueued?R("span",{style:{opacity:.6,color:"inherit",display:"inline-flex",alignItems:"center",gap:4},children:[x(It,{size:12,strokeWidth:2.25}),"Queued",s.queuePosition?` ${s.queuePosition}`:""]}):s.isSending||s.isInFlight?R(W,{children:[s.orientationLabel==="Approval needed"?x(Nn,{size:12,"aria-label":"Approval needed"}):x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle",opacity:.6},children:ze===1?R(W,{children:[x("circle",{cx:"7",cy:"7",r:"2"}),x("circle",{cx:"17",cy:"7",r:"2"}),x("circle",{cx:"7",cy:"17",r:"2"}),x("circle",{cx:"17",cy:"17",r:"2"})]}):R(W,{children:[x("circle",{cx:"12",cy:"6",r:"2"}),x("circle",{cx:"6",cy:"12",r:"2"}),x("circle",{cx:"18",cy:"12",r:"2"}),x("circle",{cx:"12",cy:"18",r:"2"})]})}),x("span",{style:{opacity:.6,color:"inherit"},children:s.isSending?"Sending":s.isQueued?`Queued${s.queuePosition?` ${s.queuePosition}`:""}`:s.orientationLabel??"Thinking"})]}):R(W,{children:[s.isQuestion?x(Ln,{size:12,strokeWidth:2.25}):s.isFailed?x(Dn,{size:12,strokeWidth:2.25}):s.replyCount>0?x(On,{size:12,strokeWidth:2.25}):R("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[x("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"}),x("path",{d:"M10 21h4"})]}),x("span",{style:{color:"inherit"},children:s.isQuestion?"Question":s.isFailed?"Failed":s.replyCount>0?"Replied":"Needs decision"})]})}))]})},s.id)})]})}function Po({d:e,color:t,animated:o}){let i=le(null);return kt(()=>{let n=i.current;if(!n||typeof n.getTotalLength!="function")return;let r=Ao(n.getTotalLength());r===void 0?n.removeAttribute("pathLength"):n.setAttribute("pathLength",String(r))},[e]),x("path",{ref:i,d:e,fill:"none",stroke:t,strokeWidth:"1",strokeDasharray:o?"4 2":void 0,"data-popmelt-marching-stroke":o||void 0,style:o?{animation:"popmelt-march 0.6s linear infinite"}:void 0})}function zo({inFlightSelectorColors:e,animated:t=!0,subjectRegistry:o,selectorElementInfo:i}){let n=ye(Le),[r,a]=re([]);return G(()=>{if(!n)return;if(e.size===0){a([]);return}let l=null,d=()=>{let f=[];for(let[y,m]of e){let g=En(y,i?.get(y));if(!g)continue;let k=ke(g);f.push({selector:y,top:k.top,left:k.left,width:k.width,height:k.height,color:m,radius:Lt(g),radiusStyle:Nt(g)})}a(f)},u=()=>{l&&cancelAnimationFrame(l),l=requestAnimationFrame(d)};d(),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u,!0);let p=new MutationObserver(u);p.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class"]});let h=o?.subscribeFrame(d),c=[...e.keys()].some(f=>f.startsWith("@frame("))?Ue(d):void 0;return()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u,!0),p.disconnect(),h?.(),c?.(),l&&cancelAnimationFrame(l)}},[e,o,i,n]),r.length===0?null:R(W,{children:[t&&x("style",{children:`
|
|
38
|
-
@keyframes popmelt-march {
|
|
39
|
-
from { stroke-dashoffset: 0; }
|
|
40
|
-
to { stroke-dashoffset: -6; }
|
|
41
|
-
}
|
|
42
|
-
@media (prefers-reduced-motion: reduce) {
|
|
43
|
-
[data-popmelt-marching-stroke="true"] { animation: none !important; }
|
|
44
|
-
}
|
|
45
|
-
`}),r.map(l=>x("div",{"data-devtools":"marching-ants",style:{position:"fixed",top:l.top,left:l.left,width:l.width,height:l.height,pointerEvents:"none",zIndex:9995,overflow:"visible",borderTopLeftRadius:l.radiusStyle.topLeft,borderTopRightRadius:l.radiusStyle.topRight,borderBottomRightRadius:l.radiusStyle.bottomRight,borderBottomLeftRadius:l.radiusStyle.bottomLeft},children:x("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible"},children:x(Po,{d:No(l.width,l.height,{topLeft:l.radius["top-left"],topRight:l.radius["top-right"],bottomRight:l.radius["bottom-right"],bottomLeft:l.radius["bottom-left"]}),color:l.color,animated:t})})},l.selector))]})}function Bo({element:e,elements:t,registry:o,label:i="Looking",engaged:n=!0,outlineColor:r,inverse:a=!1}){let l=le(0),d=Pn(()=>t??(e?[e]:[]),[t,e]),[u,p]=re(()=>d.map(c=>({target:c,id:++l.current,animateEntrance:!0,exiting:!1}))),h=zn(c=>{p(f=>f.filter(y=>y.id!==c))},[]);return G(()=>{d.length&&p(c=>{let f=c.some(({target:m})=>m.isConnected),y=d.map(m=>c.find(g=>g.target===m&&!g.exiting)??{target:m,id:++l.current,animateEntrance:!f,exiting:!1});return[...c.filter(m=>!m.exiting&&!d.includes(m.target)).map(m=>({...m,exiting:!0})),...y]})},[d]),x(W,{children:u.map(({target:c,id:f,animateEntrance:y,exiting:m})=>x(Ho,{id:f,element:n&&d.includes(c)?c:null,target:c,animateEntrance:y,exiting:m,registry:o,label:i,outlineColor:r,inverse:a,onDone:h},f))})}function Ho({id:e,element:t,target:o,animateEntrance:i,exiting:n,registry:r,label:a,outlineColor:l,inverse:d,onDone:u}){let[p]=je(),h=Ye[p],c=o,[f,y]=re(!1),m=le(Date.now()),[g,k]=re(null);return G(()=>{if(!c)return;let w,v=()=>{let S=kn(c);k(b=>S?b?.left===S.left&&b.top===S.top?b:{left:S.left,top:S.top}:null),w=requestAnimationFrame(v)};return v(),()=>cancelAnimationFrame(w)},[c]),G(()=>{let w,v;return n?v=setTimeout(()=>u(e),200):t?(m.current=Date.now(),y(!1)):w=setTimeout(()=>{y(!0),v=setTimeout(()=>u(e),300)},Math.max(0,m.current+1700-Date.now())),()=>{clearTimeout(w),clearTimeout(v)}},[t,n,e,u]),c?.isConnected?R(W,{children:[x("style",{children:`
|
|
46
|
-
@keyframes popmelt-looking-in-left { from { opacity: 0; transform: translateX(26px); clip-path: inset(0 100% 0 0); } to { opacity: 1; transform: translateX(0); clip-path: inset(0); } }
|
|
47
|
-
@keyframes popmelt-looking-out-left { from { opacity: 1; } to { opacity: 0; } }
|
|
48
|
-
@keyframes popmelt-looking-in-up { from { opacity: 0; transform: translateY(26px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: translateY(0); clip-path: inset(0); } }
|
|
49
|
-
@keyframes popmelt-looking-in-alone-up-left { from { opacity: 0; transform: translate(8px, 8px); } to { opacity: 1; transform: translate(0, 0); } }
|
|
50
|
-
@keyframes popmelt-looking-in-alone-down-left { from { opacity: 0; transform: translate(8px, -8px); } to { opacity: 1; transform: translate(0, 0); } }
|
|
51
|
-
@keyframes popmelt-looking-in-alone-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
|
|
52
|
-
@keyframes popmelt-looking-in-alone-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
|
|
53
|
-
@keyframes popmelt-looking-out-up { from { opacity: 1; } to { opacity: 0; } }
|
|
54
|
-
@keyframes popmelt-looking-fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
55
|
-
@keyframes popmelt-looking-fade-out { from { opacity: 1; } to { opacity: 0; } }
|
|
56
|
-
@keyframes popmelt-looking-blink { 0%, 40%, 72.5%, 100% { transform: scaleY(1); } 50%, 62.5% { transform: scaleY(0.1); } }
|
|
57
|
-
.popmelt-looking-eye { animation: popmelt-looking-blink 1000ms 200ms both; transform-origin: center; }
|
|
58
|
-
@media (prefers-reduced-motion: reduce) {
|
|
59
|
-
[data-devtools="focus-inspection"], .popmelt-looking-eye { animation: none !important; }
|
|
60
|
-
[data-popmelt-looking-exiting] { opacity: 0 !important; }
|
|
61
|
-
}
|
|
62
|
-
`}),x(Ft,{element:c,subjectRegistry:r,hideOutline:!l||f||n,color:l,outlineZIndex:l?10002:void 0,hideFill:!0,hideTooltip:!0,railHeight:22,renderRail:(w,v)=>{let S=g??w,b=S.left>=28,C=!g&&w.anchor.startsWith("bottom-"),N=g?b?"left":"up":`${C?"down":"up"}${b?"-left":""}`,z=g&&!b?Math.max(4,S.top-22-2):S.top,A=b?S.left-22-2:S.left,I=v.left+v.width/2>=A+22/2,K=v.top+v.height/2>=z+22/2?I?"borderBottomRightRadius":"borderBottomLeftRadius":I?"borderTopRightRadius":"borderTopLeftRadius";return x("div",{"data-devtools":"focus-inspection","data-popmelt-looking-exiting":n?"true":void 0,"data-popmelt-canvas-block":!0,role:"status","aria-live":n?"off":"polite","aria-hidden":n||void 0,"aria-label":a,title:a,style:{position:"fixed",animation:n?"popmelt-looking-fade-out 200ms ease both":!f&&!i?"popmelt-looking-fade-in 200ms ease both":`popmelt-looking-${f?"out":g?"in":"in-alone"}-${f?b?"left":"up":N} ${f?300:200}ms ease both`,left:A,top:z,height:22,width:22,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:d?h.actionSurface:h.surface,color:d?h.actionForeground:h.primary,border:`1px solid ${d?h.actionHover:h.border}`,borderTopLeftRadius:J,borderTopRightRadius:J,borderBottomLeftRadius:J,borderBottomRightRadius:J,...g?{}:{[K]:2},fontFamily:We,fontSize:12,letterSpacing:"0.24px",whiteSpace:"nowrap",pointerEvents:n?"none":"auto",zIndex:c.hasAttribute("data-popmelt-thread-header")?10005:10002},children:x($n,{className:i&&!n?"popmelt-looking-eye":void 0,size:12,"aria-hidden":!0})})}})]}):null}var Wo={production:{issuer:"https://popmelt.com",resource:"https://mcp.popmelt.com"},staging:{issuer:"https://webapp-staging-1bed.up.railway.app",resource:"https://mcp-staging-8731.up.railway.app"}};function jo(e){if(typeof e!="string")throw new Error("Unexpected sign-in destination.");let t=new URL(e);if(!Object.values(Wo).some(({issuer:o})=>t.origin===o)||t.pathname!=="/mcp/grant"||t.username||t.password||t.hash)throw new Error("Unexpected sign-in destination.");return t}var $e={toolbar:{toggleKey:["Meta","Control"],toggleTaps:2,toggleWindowMs:300},tools:{imprint:{key:"i",tool:"model"},steer:{key:"s",tool:"sticker"},comment:{key:"c",tool:"inspector"}},actions:{send:{key:"Enter",commandOrControl:!0},screenshot:{key:"c",commandOrControl:!0},clear:{keys:["Backspace","Delete"],commandOrControl:!0},undo:{key:"z",commandOrControl:!0},redo:{key:"z",commandOrControl:!0,shift:!0}},omnidial:{previous:["a","ArrowLeft"],next:["d","ArrowRight"],previousFacet:["q"],nextFacet:["e"],descendOrApply:["w","Enter"],ascend:["s","Escape"],query:[" "]}},Yo=[{type:"model",label:"Imprint",shortcut:"I"},{type:"sticker",label:"Steer",shortcut:"S"},{type:"inspector",label:"Chat",shortcut:"C"}];function qo(e){let t=e.toLowerCase();return Object.values($e.tools).find(o=>o.key===t)?.tool??null}function Uo(e){let t=e.length===1?e.toLowerCase():e,o=$e.omnidial;return[...o.previous,...o.next,...o.previousFacet,...o.nextFacet,...o.descendOrApply,...o.ascend,...o.query].includes(t)||/^[a-z0-9]$/i.test(e)}var en=qe(null),Xo=()=>()=>{},tn=()=>null;function lt(){return Math.random().toString(36).substring(2,9)}function _e(e){return e.status?e:e.captured?{...e,status:"in_flight"}:{...e,status:"pending"}}function _(e){return{...e,undoStack:[...e.undoStack,{annotations:e.annotations,styleModifications:e.styleModifications,textModifications:e.textModifications,domModifications:e.domModifications,spacingTokenChanges:e.spacingTokenChanges,spacingTokenMods:e.spacingTokenMods}],redoStack:[]}}function Ko(e,t){return{...e,isAnnotating:t}}function Vo(e,t){return{...e,activeTool:t}}function Go(e,t){return{...e,activeColor:t}}function Jo(e,t){return{...e,strokeWidth:t}}function Qo(e,t){let o={id:t.id??lt(),type:"text",points:[t.point],text:t.text,fontSize:t.fontSize||12,color:e.activeColor,strokeWidth:e.strokeWidth,timestamp:Date.now(),status:"pending",pathname:typeof window<"u"?window.location.pathname:"/",groupId:t.groupId,linkedSelector:t.linkedSelector,target:t.target,linkedAnchor:t.linkedAnchor,elements:t.elements,...t.imageCount?{imageCount:t.imageCount}:{},...t.attachments?.length?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}};return{...t.groupId?e:_(e),annotations:[...e.annotations,o]}}function Zo(e,t){return{..._(e),annotations:e.annotations.map(o=>o.id===t.id?{...o,text:t.text,...t.imageCount!=null?{imageCount:t.imageCount}:{},...t.attachments?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}}:o)}}function ei(e,t){return{...e,annotations:e.annotations.map(o=>o.id===t.id?{...o,fontSize:Math.max(12,Math.min(72,t.fontSize))}:o)}}function ti(e,t){return{..._(e),annotations:e.annotations.map(o=>{if(o.id!==t.id)return o;let i=o.interactionEpisode?.frames?.length??0,{interactionEpisode:n,...r}=o;if(i===0)return r;let a=Math.max(0,(o.imageCount??0)-i);if(a===0){let{imageCount:l,...d}=r;return d}return{...r,imageCount:a}})}}function ni(e,t){let o=_(e),i=e.annotations.find(r=>r.id===t.id)?.groupId,n=new Set(e.annotations.filter(r=>r.id===t.id||i&&r.groupId===i).map(r=>r.id));return{...o,annotations:e.annotations.filter(r=>r.id!==t.id&&!(i&&r.groupId===i)),selectedAnnotationIds:e.selectedAnnotationIds.filter(r=>!n.has(r)),lastSelectedId:e.lastSelectedId&&n.has(e.lastSelectedId)?null:e.lastSelectedId}}function oi(e,t){let o=t.saveUndo?_(e):e,i=e.annotations.find(n=>n.id===t.id)?.groupId;return{...o,annotations:e.annotations.map(n=>{if(!(n.id===t.id||i&&n.groupId===i))return n;let r=t.delta.x,a=t.delta.y;return{...n,points:n.points.map(l=>({x:l.x+r,y:l.y+a}))}})}}function ii(e,t){let o=t.saveUndo?_(e):e,i=e.annotations.find(a=>a.id===t.id);if(!i||i.type==="text"||i.points.length<2)return e;let n=0,r=0;if(i.type==="rectangle"&&i.groupId){let a=t.points,l=Math.min(a[0].x,a[1].x),d=Math.max(a[0].y,a[1].y),u=i.points[0],p=i.points[i.points.length-1],h=Math.min(u.x,p.x),c=Math.max(u.y,p.y);n=l-h,r=d-c}return{...o,annotations:e.annotations.map(a=>a.id===t.id?{...a,points:t.points}:i.groupId&&a.groupId===i.groupId&&a.type==="text"?{...a,points:a.points.map(l=>({x:l.x+n,y:l.y+r}))}:a)}}function ai(e,t){return{..._(e),annotations:[...e.annotations,...t.annotations.map(_e)]}}function ri(e,t){let o=new Set,i=[];for(let n of t.annotations)o.has(n.id)||(o.add(n.id),i.push(_e(n)));return{...e,annotations:i}}function li(e,t){let o=new Map(e.annotations.map(n=>[n.id,n])),i=t.annotations.map(n=>{let r=_e(n),a=o.get(r.id);return!a||!r.linkedSelector||a.linkedSelector!==r.linkedSelector?r:{...r,points:a.points,linkedAnchor:a.linkedAnchor}});return{...e,annotations:i}}function di(e,t){let o=new Set(e.annotations.map(n=>n.id)),i=t.annotations.filter(n=>!o.has(n.id)).map(_e);return i.length>0?{...e,annotations:[...e.annotations,...i]}:e}function si(e){if(e.undoStack.length===0)return e;let t=e.undoStack[e.undoStack.length-1];return{...e,annotations:t?.annotations||[],styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],undoStack:e.undoStack.slice(0,-1),redoStack:[...e.redoStack,{annotations:e.annotations,styleModifications:e.styleModifications,textModifications:e.textModifications,domModifications:e.domModifications,spacingTokenChanges:e.spacingTokenChanges,spacingTokenMods:e.spacingTokenMods}]}}function ui(e){if(e.redoStack.length===0)return e;let t=e.redoStack[e.redoStack.length-1];return{...e,annotations:t?.annotations||[],styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],redoStack:e.redoStack.slice(0,-1),undoStack:[...e.undoStack,{annotations:e.annotations,styleModifications:e.styleModifications,textModifications:e.textModifications,domModifications:e.domModifications,spacingTokenChanges:e.spacingTokenChanges,spacingTokenMods:e.spacingTokenMods}]}}function pi(e,t){let{id:o,addToSelection:i}=t;if(o===null)return{...e,selectedAnnotationIds:[],lastSelectedId:null};if(i)if(e.selectedAnnotationIds.includes(o)){let n=e.selectedAnnotationIds.filter(r=>r!==o);return{...e,selectedAnnotationIds:n,lastSelectedId:n.length>0?n[n.length-1]:null}}else return{...e,selectedAnnotationIds:[...e.selectedAnnotationIds,o],lastSelectedId:o};return{...e,selectedAnnotationIds:[o],lastSelectedId:o}}function ci(e,t){let o=e.annotations.find(n=>n.id===t.id)?.groupId,i=new Set;for(let n of e.selectedAnnotationIds){let r=e.annotations.find(a=>a.id===n);r?.groupId&&i.add(r.groupId)}return{...e,annotations:e.annotations.map(n=>n.id===t.id||e.selectedAnnotationIds.includes(n.id)||n.groupId&&(n.groupId===o||i.has(n.groupId))?{...n,color:t.color}:n)}}function fi(e,t){let o=typeof window<"u"?window.location.pathname:"/",i=t?new Set(t):void 0;return{...e,annotations:e.annotations.map(n=>i&&!i.has(n.id)?n:{...n,captured:!0,status:n.status==="pending"||n.status==="sending"||!n.status?"in_flight":n.status}),styleModifications:e.styleModifications.map(n=>!n.pathname||n.pathname===o?{...n,captured:!0}:n),textModifications:e.textModifications.map(n=>!n.pathname||n.pathname===o?{...n,captured:!0}:n),domModifications:e.domModifications.map(n=>!n.pathname||n.pathname===o?{...n,captured:!0}:n),spacingTokenChanges:e.spacingTokenChanges.map(n=>({...n,captured:!0})),spacingTokenMods:e.spacingTokenMods.map(n=>({...n,captured:!0}))}}function hi(e){return e.annotations.some(t=>(t.status??"pending")==="pending")||e.styleModifications.some(t=>!t.captured)||e.textModifications.some(t=>!t.captured)||e.domModifications.some(t=>!t.captured)||e.spacingTokenChanges.some(t=>!t.captured)||e.spacingTokenMods.some(t=>!t.captured)?{..._(e),annotations:e.annotations.filter(t=>(t.status??"pending")!=="pending"),styleModifications:e.styleModifications.filter(t=>t.captured),textModifications:e.textModifications.filter(t=>t.captured),domModifications:e.domModifications.filter(t=>t.captured),spacingTokenChanges:e.spacingTokenChanges.filter(t=>t.captured),spacingTokenMods:e.spacingTokenMods.filter(t=>t.captured),selectedAnnotationIds:[],lastSelectedId:null}:e}function gi(e){return{...e,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]}}function mi(e,t){let{selector:o,element:i,property:n,original:r,modified:a}=t,l=typeof window<"u"?window.location.pathname:"/",d=e.styleModifications.findIndex(u=>u.selector===o&&(!u.pathname||u.pathname===l));if(r===a&&d<0)return e;if(d>=0){let u=e.styleModifications[d];if(u.captured){let y=_(e),m=y.styleModifications.map((g,k)=>k===d?{...g,changes:[{property:n,original:r,modified:a}],createdAt:g.createdAt??Date.now(),captured:!1,pathname:l}:g);return{...y,styleModifications:m}}let p=u.changes.findIndex(y=>y.property===n),h,c=e;if(p>=0){let y=u.changes[p];a===y.original?h=u.changes.filter((m,g)=>g!==p):h=u.changes.map((m,g)=>g===p?{...m,modified:a}:m)}else{if(r===a)return e;c=_(e),h=[...u.changes,{property:n,original:r,modified:a}]}if(h.length===0)return{...c,styleModifications:c.styleModifications.filter((y,m)=>m!==d)};let f=c.styleModifications.map((y,m)=>m===d?{...y,changes:h,createdAt:y.createdAt??Date.now()}:y);return{...c,styleModifications:f}}else{let u=_(e),p={selector:o,element:i,changes:[{property:n,original:r,modified:a}],createdAt:Date.now(),pathname:l};return{...u,styleModifications:[...u.styleModifications,p]}}}function yi(e,t){let{selector:o,durableSelector:i,element:n,changes:r}=t,a=typeof window<"u"?window.location.pathname:"/",l=r.filter(p=>p.original!==p.modified);if(l.length===0)return e;let d=_(e),u=d.styleModifications.findIndex(p=>p.selector===o&&(!p.pathname||p.pathname===a));if(u>=0){let p=d.styleModifications[u],h=p.captured?[]:[...p.changes];for(let c of l){let f=h.findIndex(y=>y.property===c.property);f>=0?c.modified===h[f].original?h=h.filter((y,m)=>m!==f):h=h.map((y,m)=>m===f?{...y,modified:c.modified,token:c.token,sticker:c.sticker}:y):h.push(c)}return h.length===0?{...d,styleModifications:d.styleModifications.filter((c,f)=>f!==u)}:{...d,styleModifications:d.styleModifications.map((c,f)=>f===u?{...c,changes:h,createdAt:c.createdAt??Date.now(),captured:!1,pathname:a}:c)}}else return{...d,styleModifications:[...d.styleModifications,{selector:o,durableSelector:i,element:n,changes:l,createdAt:Date.now(),pathname:a}]}}function wi(e,t){let{selector:o,property:i}=t,n=typeof window<"u"?window.location.pathname:"/",r=_(e),a=r.styleModifications.map(l=>l.selector!==o||l.pathname&&l.pathname!==n?l:{...l,changes:l.changes.filter(d=>d.property!==i)}).filter(l=>l.changes.length>0);return{...r,styleModifications:a}}function xi(e,t){let{selector:o,sticker:i}=t,n=typeof window<"u"?window.location.pathname:"/";if(!e.styleModifications.find(l=>l.selector===o&&(!l.pathname||l.pathname===n)&&!l.captured&&l.changes.some(d=>d.sticker?.family===i.family&&d.sticker.subproperty===i.subproperty)))return e;let r=_(e),a=r.styleModifications.map(l=>l.selector!==o||l.pathname&&l.pathname!==n||l.captured?l:{...l,changes:l.changes.filter(d=>d.sticker?.family!==i.family||d.sticker.subproperty!==i.subproperty)}).filter(l=>l.changes.length>0);return{...r,styleModifications:a}}function vi(e){return e.styleModifications.length===0?e:{..._(e),styleModifications:[]}}function bi(e,t){let o=new Set(t.selectors);if(o.size===0)return e;let i=e.styleModifications.filter(n=>!n.captured||!o.has(n.selector)&&(!n.durableSelector||!o.has(n.durableSelector)));return i.length===e.styleModifications.length?e:{...e,styleModifications:i}}function Mi(e,t){let o=Date.now();return{...e,styleModifications:t.map((i,n)=>({...i,createdAt:i.createdAt??o+n}))}}function Si(e,t,o,i){return e.selector===t&&(!e.pathname||e.pathname===i)&&e.textNodePath.length===o.length&&e.textNodePath.every((n,r)=>n===o[r])}function nn(e,t,o=!0){let{selector:i,durableSelector:n,element:r,textNodePath:a,original:l,modified:d}=t,u=typeof window<"u"?window.location.pathname:"/",p=e.textModifications.findIndex(c=>Si(c,i,a,u));if(l===d&&p<0)return e;if(p>=0){let c=e.textModifications[p],f=c.captured&&o?_(e):e,y=c.captured?l:c.original;return d===y?{...f,textModifications:f.textModifications.filter((m,g)=>g!==p)}:{...f,textModifications:f.textModifications.map((m,g)=>g===p?{...m,durableSelector:n,element:r,original:y,modified:d,createdAt:m.createdAt??Date.now(),captured:!1,pathname:u}:m)}}let h=o?_(e):e;return{...h,textModifications:[...h.textModifications,{selector:i,durableSelector:n,element:r,textNodePath:a,original:l,modified:d,createdAt:Date.now(),pathname:u}]}}function Ti(e,t,o=!0){return t.length===0?e:t.reduce((i,n)=>nn(i,n,!1),o?_(e):e)}function Ii(e,t){let o=Date.now();return{...e,textModifications:t.map((i,n)=>({...i,createdAt:i.createdAt??o+n}))}}function ki(e,t){let o=_(e),i=o.domModifications.findIndex(n=>n.id===t.id);return i>=0?{...o,domModifications:o.domModifications.map((n,r)=>r===i?{...t,captured:!1}:n)}:{...o,domModifications:[...o.domModifications,t]}}function Ei(e,t){return{...e,domModifications:t}}function Ci(e,t){let{updates:o}=t,i=new Map(o.map(n=>[n.id,n]));return{...e,annotations:e.annotations.map(n=>{let r=i.get(n.id);return r?{...n,points:[r.point,...n.points.slice(1)],...r.linkedAnchor?{linkedAnchor:r.linkedAnchor}:{}}:n})}}function Ai(e,t){let o=new Set(t.ids);return{...e,annotations:e.annotations.map(i=>o.has(i.id)?{...i,status:t.status}:i)}}function Ri(e,t){let o=new Set(t.ids),i=new Set;for(let n of e.annotations)o.has(n.id)&&n.groupId&&i.add(n.groupId);return{...e,annotations:e.annotations.map(n=>{if(!o.has(n.id)&&!(n.groupId&&i.has(n.groupId)))return n;let r=!!t.jobId&&n.replyJobIds?.includes(t.jobId),a=n.status==="waiting_input";return{...n,status:a?"waiting_input":"resolved",replyCount:(n.replyCount??0)+(r?0:1),replyJobIds:t.jobId&&!r?[...n.replyJobIds??[],t.jobId]:n.replyJobIds,threadId:n.threadId||t.threadId,question:a?n.question:void 0}})}}function Ni(e,t){let o=new Set(t.ids),i=new Set;for(let n of e.annotations)o.has(n.id)&&n.groupId&&i.add(n.groupId);return{...e,annotations:e.annotations.map(n=>o.has(n.id)||n.groupId&&i.has(n.groupId)?{...n,status:"failed",threadId:n.threadId||t.threadId,question:void 0}:n)}}function Li(e,t){let o=new Set(t.ids),i=new Set;for(let n of e.annotations)o.has(n.id)&&n.groupId&&i.add(n.groupId);return{...e,annotations:e.annotations.map(n=>o.has(n.id)||n.groupId&&i.has(n.groupId)?{...n,threadId:t.threadId,targetBindingId:t.targetBindingId}:n)}}function Di(e,t){let o=new Set(t.ids),i=new Set;for(let n of e.annotations)o.has(n.id)&&n.groupId&&i.add(n.groupId);return{...e,annotations:e.annotations.map(n=>o.has(n.id)||n.groupId&&i.has(n.groupId)?{...n,status:"waiting_input",question:t.question,threadId:t.threadId}:n)}}function Oi(e,t){let o=new Map(t.resolutions.map(n=>[n.annotationId,n])),i=new Map;for(let n of e.annotations){let r=o.get(n.id);r&&n.groupId&&i.set(n.groupId,r)}return{...e,annotations:e.annotations.map(n=>{let r=o.get(n.id)||(n.groupId?i.get(n.groupId):void 0);if(!r)return n;let a=!!t.jobId&&n.replyJobIds?.includes(t.jobId);return{...n,status:r.status,resolutionSummary:r.summary,scope:r.finalScope??r.inferredScope??null,replyCount:(n.replyCount??0)+(a?0:1),replyJobIds:t.jobId&&!a?[...n.replyJobIds??[],t.jobId]:n.replyJobIds,question:void 0,threadId:n.threadId||t.threadId}})}}function $i(e,t){let{linkedSelectors:o,styleSelectors:i}=t,n=new Set(o),r=new Set(i),a=typeof window<"u"?window.location.pathname:"/",l=new Set,d=new Set;for(let f of e.annotations)f.linkedSelector&&n.has(f.linkedSelector)&&(l.add(f.id),f.groupId&&d.add(f.groupId));for(let f of e.annotations)f.groupId&&d.has(f.groupId)&&l.add(f.id);let u=e.annotations.filter(f=>!l.has(f.id)),p=e.styleModifications.filter(f=>!r.has(f.selector)||f.pathname&&f.pathname!==a),h=e.domModifications.filter(f=>!r.has(f.selector)||f.pathname&&f.pathname!==a);if(u.length===e.annotations.length&&p.length===e.styleModifications.length&&h.length===e.domModifications.length)return e;let c=e.selectedAnnotationIds.filter(f=>!l.has(f));return{...e,annotations:u,styleModifications:p,domModifications:h,selectedAnnotationIds:c,lastSelectedId:c.length>0?c[c.length-1]:null}}function _i(e,t){let o=e.spacingTokenChanges.findIndex(i=>i.tokenPath===t.tokenPath);return o>=0?{...e,spacingTokenChanges:e.spacingTokenChanges.map((i,n)=>n===o?t:i)}:{...e,spacingTokenChanges:[...e.spacingTokenChanges,t]}}function Fi(e,t){return{...e,spacingTokenChanges:t}}function Pi(e,t){let o=_(e),i=e.spacingTokenMods.findIndex(r=>r.tokenPath===t.tokenPath),n;if(i>=0){let r=e.spacingTokenMods[i],a={...t,originalValue:r.captured?r.currentValue:r.originalValue,originalPx:r.captured?r.currentPx:r.originalPx,captured:!1};n=e.spacingTokenMods.map((l,d)=>d===i?a:l)}else n=[...e.spacingTokenMods,{...t,captured:!1}];return{...o,spacingTokenMods:n}}function zi(e,t){let o=_(e),i=e.spacingTokenMods.findIndex(u=>u.tokenPath===t.tokenPath),n=i>=0?e.spacingTokenMods[i]:null,r=i>=0?n.captured?n.currentValue:n.originalValue:t.originalValue,a=i>=0?n.captured?n.currentPx:n.originalPx:parseFloat(t.originalValue)||0,l={tokenPath:t.tokenPath,originalValue:r,currentValue:"__deleted__",targets:n?.targets??[],originalPx:a,currentPx:0,captured:!1},d;return i>=0?d=e.spacingTokenMods.map((u,p)=>p===i?l:u):d=[...e.spacingTokenMods,l],{...o,spacingTokenMods:d}}function on(e,t){switch(t.type){case"SET_ANNOTATING":return Ko(e,t.payload);case"SET_TOOL":return Vo(e,t.payload);case"SET_COLOR":return Go(e,t.payload);case"SET_STROKE_WIDTH":return Jo(e,t.payload);case"ADD_TEXT":return Qo(e,t.payload);case"UPDATE_TEXT":return Zo(e,t.payload);case"CLEAR_INTERACTION_EPISODE":return ti(e,t.payload);case"UPDATE_TEXT_SIZE":return ei(e,t.payload);case"DELETE_ANNOTATION":return ni(e,t.payload);case"MOVE_ANNOTATION":return oi(e,t.payload);case"RESIZE_ANNOTATION":return ii(e,t.payload);case"PASTE_ANNOTATIONS":return ai(e,t.payload);case"RESTORE_ANNOTATIONS":return ri(e,t.payload);case"SYNC_ANNOTATIONS":return li(e,t.payload);case"MERGE_ANNOTATIONS":return di(e,t.payload);case"UNDO":return si(e);case"REDO":return ui(e);case"SELECT_ANNOTATION":return pi(e,t.payload);case"UPDATE_ANNOTATION_COLOR":return ci(e,t.payload);case"MARK_CAPTURED":return fi(e,t.payload?.annotationIds);case"CLEAR":return gi(e);case"DISCARD_DRAFT":return hi(e);case"MODIFY_STYLE":return mi(e,t.payload);case"MODIFY_STYLES_BATCH":return yi(e,t.payload);case"CLEAR_STYLE":return wi(e,t.payload);case"CLEAR_STICKER":return xi(e,t.payload);case"CLEAR_ALL_STYLES":return vi(e);case"SETTLE_CAPTURED_STYLES":return bi(e,t.payload);case"RESTORE_STYLE_MODIFICATIONS":return Mi(e,t.payload);case"MODIFY_TEXT_CONTENT":return nn(e,t.payload);case"MODIFY_TEXT_CONTENTS":return Ti(e,t.payload,t.saveUndo??!0);case"RESTORE_TEXT_MODIFICATIONS":return Ii(e,t.payload);case"MODIFY_DOM_STRUCTURE":return ki(e,t.payload);case"RESTORE_DOM_MODIFICATIONS":return Ei(e,t.payload);case"UPDATE_LINKED_POSITIONS":return Ci(e,t.payload);case"CLEANUP_ORPHANED":return $i(e,t.payload);case"SET_ANNOTATION_STATUS":return Ai(e,t.payload);case"MARK_ANNOTATIONS_REPLIED":return Ri(e,t.payload);case"MARK_ANNOTATIONS_FAILED":return Ni(e,t.payload);case"SET_ANNOTATION_THREAD":return Li(e,t.payload);case"SET_ANNOTATION_QUESTION":return Di(e,t.payload);case"APPLY_RESOLUTIONS":return Oi(e,t.payload);case"ADD_SPACING_TOKEN_CHANGE":return _i(e,t.payload);case"RESTORE_SPACING_TOKEN_CHANGES":return Fi(e,t.payload);case"MODIFY_SPACING_TOKEN":return Pi(e,t.payload);case"DELETE_SPACING_TOKEN":return zi(e,t.payload);default:return t}}function Bi(e,t){let o=ye(en),[i,n]=Bn(on,Mn),r=Hn(o?.subscribe??Xo,o?.getSnapshot??tn,o?.getSnapshot??tn)??i,a=o?.dispatch??n;G(()=>{if(!r.isAnnotating)return;let d=u=>{t?.current||u.defaultPrevented||u.isComposing||u.altKey||u.composedPath().some(p=>p instanceof Element&&(p.matches('input, textarea, select, [role="textbox"]')||p instanceof HTMLElement&&p.isContentEditable||p.hasAttribute("contenteditable")&&p.getAttribute("contenteditable")!=="false"))||(u.metaKey||u.ctrlKey)&&u.key.toLowerCase()===$e.actions.undo.key&&(u.preventDefault(),u.shiftKey?a({type:"REDO"}):e?.current?.()||a({type:"UNDO"}))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[a,r.isAnnotating,e,t]);let l=o?.getUndoHead?o.getUndoHead():r.undoStack.at(-1);return[r,a,l]}function pe(e){return e?!!e.closest("#devtools-toolbar, #devtools-scrim, #devtools-text-input, [data-devtools], [data-popmelt-panel], [data-popmelt-shadow-host]"):!1}function Hi(e,t,o=document){let i=o,n=i.caretPositionFromPoint?.(e,t);if(n?.offsetNode?.nodeType===Node.TEXT_NODE)return n.offsetNode;let r=i.caretRangeFromPoint?.(e,t);return r?.startContainer?.nodeType===Node.TEXT_NODE?r.startContainer:null}function Wi(e,t){if(!e)return t();let o=e.style.pointerEvents;e.style.pointerEvents="none";try{return t()}finally{e.style.pointerEvents=o}}function ji(e,t,o){let i=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(r){return r.textContent?.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),n=i.nextNode();for(;n;){let r=n,a=e.ownerDocument.createRange();a.selectNodeContents(r);let l=Array.from(a.getClientRects());if(a.detach?.(),l.some(d=>t>=d.left&&t<=d.right&&o>=d.top&&o<=d.bottom))return r;n=i.nextNode()}return null}function Yi(e,t,o){return Wi(o,()=>{let i=vt(e,t);if(!i||pe(i))return null;let n=i?.ownerDocument??document,r=An(e,t,n),a=Hi(r.x,r.y,n);if(a&&!i.contains(a)&&(a=null),!a){let b=i;b&&!pe(b)&&(a=ji(b,r.x,r.y))}if(!a||!Rn(a.parentElement))return null;let l=a.parentElement;if(pe(l))return null;for(;l.parentElement&&l!==n.body;){let b=Ce(l).getComputedStyle(l).display,C=b==="inline-block"&&l.childNodes.length===1&&l.firstChild?.nodeType===Node.ELEMENT_NODE;if(b!=="inline"&&b!=="contents"&&!C)break;let N=l.parentElement;if(pe(N))break;if(Array.from(N.childNodes).some(I=>I.nodeType===Node.TEXT_NODE&&!!I.nodeValue?.trim())){l=N;continue}let z=Ce(N).getComputedStyle(N).display,A=z==="inline-block"&&N.childNodes.length===1&&N.firstChild?.nodeType===Node.ELEMENT_NODE;if(z==="inline"||z==="contents"||A){l=N;continue}break}let d=l.tagName.toLowerCase();if(d==="script"||d==="style"||d==="textarea"||d==="input")return null;let u=Ui(l),p=u.map(b=>b.originalText).join("");if(!p.trim())return null;let h=an(l,a);if(!h)return null;let c=Ce(l).getComputedStyle(l),f=ln(u,l,c),{textRect:y,boundaryRect:m,boundaryRects:g,flowRect:k,firstLineIndent:w}=f;if(y.width<=0||y.height<=0)return null;let v=parseFloat(c.fontSize)||12,S=c.whiteSpace!=="nowrap"&&c.whiteSpace!=="pre"&&(Vi(a)||c.display!=="inline");return{textNode:a,targetElement:l,textNodePath:h,segments:u,originalText:p,rect:y,boundaryRect:m,boundaryRects:g,flowRect:k,firstLineIndent:w,styles:c,fontSize:v,wrapsText:S}})}function an(e,t){let o=[],i=t;for(;i&&i!==e;){let n=i.parentNode;if(!n)return null;o.unshift(Array.prototype.indexOf.call(n.childNodes,i)),i=n}return i===e?o:null}function qi(e,t){let o=e.ownerDocument.createRange();o.selectNodeContents(e);let i=Ee(o.getBoundingClientRect(),e.ownerDocument);if(o.detach?.(),i.width>0&&i.height>0)return{left:i.left,top:i.top,width:i.width,height:i.height};let n=ke(t);return{left:n.left,top:n.top,width:n.width,height:n.height}}function Ui(e){let t=[],o=i=>{if(i.nodeType===Node.TEXT_NODE){let r=i,a=an(e,r);a&&t.push({textNode:r,textNodePath:a,originalText:r.nodeValue??""});return}if(i.nodeType!==Node.ELEMENT_NODE&&i!==e)return;let n=i.tagName?.toLowerCase();n==="script"||n==="style"||i.childNodes.forEach(o)};return e.childNodes.forEach(o),t}function rn(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}function Xi(e){let t=[];for(let o of e){if(!o.textNode.isConnected||!o.originalText.trim())continue;let i=o.textNode.ownerDocument.createRange();i.selectNodeContents(o.textNode),t.push(...Array.from(i.getClientRects()).filter(n=>n.width>0&&n.height>0).map(n=>rn(Ee(n,o.textNode.ownerDocument)))),i.detach?.()}return Ge(t)}function Ki(e){let t=e.getBoundingClientRect(),o=Ce(e).getComputedStyle(e),i=(parseFloat(o.borderLeftWidth)||0)+(parseFloat(o.paddingLeft)||0),n=(parseFloat(o.borderRightWidth)||0)+(parseFloat(o.paddingRight)||0),r=(parseFloat(o.borderTopWidth)||0)+(parseFloat(o.paddingTop)||0),a=(parseFloat(o.borderBottomWidth)||0)+(parseFloat(o.paddingBottom)||0);return Ee({left:t.left+i,top:t.top+r,width:Math.max(0,t.width-i-n),height:Math.max(0,t.height-r-a)},e.ownerDocument)}function ln(e,t,o){let i=rn(ke(t)),n=Xi(e),r=e[0]?.textNode?qi(e[0].textNode,t):i,a=n.length>0?n:[r];return xo({display:o.display,fragmentRects:a,elementRect:i,parentContentRect:t.parentElement?Ki(t.parentElement):void 0})}function Vi(e){let t=e.ownerDocument.createRange();t.selectNodeContents(e);let o=Array.from(t.getClientRects()).filter(i=>i.width>0&&i.height>0).length;return t.detach?.(),o>1}function Gi(e,t,o){if(t===o||e.length===0)return[];let i=0;for(;i<t.length&&i<o.length&&t[i]===o[i];)i+=1;let n=0;for(;n<t.length-i&&n<o.length-i&&t[t.length-1-n]===o[o.length-1-n];)n+=1;let r=i,a=t.length-n,l=o.slice(i,o.length-n),d=0,u=!1;return e.flatMap((p,h)=>{let c=d,f=c+p.originalText.length;d=f;let y=r===a,m=y&&(r>=c&&r<f||h===e.length-1&&r===f),g=!y&&f>r&&c<a;if(!m&&!g)return[];let k=Math.max(0,Math.min(p.originalText.length,r-c)),w=Math.max(0,Math.min(p.originalText.length,a-c)),v=p.originalText.slice(0,k);return u||(v+=l,u=!0),v+=p.originalText.slice(w),v===p.originalText?[]:[{segment:p,modifiedText:v}]})}function dt(e,t){return Math.abs(e.left-t.left)<.5&&Math.abs(e.top-t.top)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5}function Ji(e,t){return!e||!t?e===t:dt(e,t)}function Qi(e,t){return e.length===t.length&&e.every((o,i)=>dt(o,t[i]))}function Zi(){return{isDragging:!1,hasMoved:!1,mode:"move",startX:0,startY:0,element:null,originalParent:null,originalIndex:-1,selector:null,durableSelector:null,elementInfo:null}}function Fe(e){if(!e||e===document.body||e===document.documentElement||pe(e))return!1;let t=e.tagName.toLowerCase();return["script","style","link","meta","head","html","body","input","textarea","select","option","button"].includes(t)?!1:!!e.parentElement}function Q(e){let t=e.getAttribute("data-pm");return t||(t=Math.random().toString(36).substring(2,8),e.setAttribute("data-pm",t)),`[data-pm="${t}"]`}function st(e){return e.parentElement?Array.from(e.parentElement.children).indexOf(e):-1}function dn(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(t=>t.removeAttribute("data-pm"))}function sn(e,t,o,i,n=vt){let r=o.parentElement;if(!r)return null;let a=n(e,t);for(;a&&a!==document.body;){if(a===o||o.contains(a)){a=a.parentElement;continue}if(a.parentElement===r&&Fe(a))break;a=a.parentElement}if(!a||a===document.body||a.parentElement!==r||a===i)return null;let l=a.getBoundingClientRect(),d=l.height>=l.width?t<l.top+l.height/2?"before":"after":e<l.left+l.width/2?"before":"after",u=st(a),p=d==="before"?u:u+1;return{parent:r,reference:a,placement:d,index:p}}function ut(e,t,o){let i=Array.from(e.children).filter(r=>r!==t),n=Math.max(0,Math.min(o,i.length));e.insertBefore(t,i[n]??null)}function ea({drag:e,clientX:t,clientY:o,pathname:i,createId:n,rootElement:r,elementAtPoint:a}){let l=e.element;if(!l||!e.selector||!e.durableSelector||!e.elementInfo)return null;let d=sn(t,o,l,r,a);if(!d)return null;let u=e.originalParent===d.parent&&d.index>e.originalIndex?d.index-1:d.index;if(e.mode==="move"&&e.originalParent===d.parent&&(u===e.originalIndex||u===e.originalIndex+1))return null;let p=V(d.parent),h=Q(d.parent),c=V(d.reference),f=Q(d.reference),y=e.selector,m=e.durableSelector,g=e.elementInfo;if(e.mode==="copy"){let w=l.cloneNode(!0);if(!(w instanceof Element))return null;dn(w),ut(d.parent,w,u),y=Q(w),m=V(w),g={...He(w),selector:y}}else ut(d.parent,l,u);let k=e.originalParent;return{id:n(),operation:e.mode,selector:y,durableSelector:m,element:g,sourceSelector:e.mode==="copy"?e.selector:void 0,sourceDurableSelector:e.mode==="copy"?e.durableSelector:void 0,sourceElement:e.mode==="copy"?e.elementInfo:void 0,originalParentSelector:k?Q(k):void 0,originalParentDurableSelector:k?V(k):void 0,originalIndex:e.originalIndex,targetParentSelector:h,targetParentDurableSelector:p,targetIndex:u,referenceSelector:f,referenceDurableSelector:c,placement:d.placement,pathname:i}}function un(e){return e instanceof HTMLElement&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable===!0||e.getAttribute("contenteditable")==="true")}function ta(){if(typeof document>"u")return null;let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}function pt(e){let t=e.composedPath?.()[0]??e.target;return un(t)||un(ta())}function pn(e,t,o){if(o)return[o];let i=new Set(t),n=new Map;for(let a of e)a.groupId&&a.threadId&&n.set(a.groupId,a.threadId);let r=new Set;for(let a of e){if(!i.has(a.id))continue;let l=a.threadId||(a.groupId?n.get(a.groupId):void 0);l&&r.add(l)}return[...r]}function na({state:e,stateRef:t,activeTextRef:o,selectedIdsRef:i,dispatch:n,clearSelection:r,selectAnnotation:a,handHoveredElement:l,onArchiveThread:d,openThreadId:u,currentPathname:p,hasOpenThread:h}){let c=le([]),f=le(0),y=le(null);G(()=>{let m=g=>{if(g.key==="Escape"){if(g.defaultPrevented||g.repeat||o.current||h||pt(g))return;if(i.current.length>0){g.preventDefault(),r();return}let w=t.current;if(w.annotations.some(v=>(v.status??"pending")==="pending")||w.styleModifications.some(v=>!v.captured)||w.textModifications.some(v=>!v.captured)||w.domModifications.some(v=>!v.captured)||w.spacingTokenChanges.some(v=>!v.captured)||w.spacingTokenMods.some(v=>!v.captured)){g.preventDefault(),n({type:"DISCARD_DRAFT"});return}}if((g.metaKey||g.ctrlKey)&&g.key.toLowerCase()==="c"&&e.activeTool==="hand"&&l&&!o.current){if(Fe(l)){g.preventDefault();let w=Q(l);y.current={source:l,sourceSelector:w,sourceDurableSelector:V(l),sourceElement:{...He(l),selector:w}}}return}if((g.metaKey||g.ctrlKey)&&g.key.toLowerCase()==="v"&&e.activeTool==="hand"&&y.current&&!o.current){let w=y.current,v=l&&Fe(l)?l:w.source,S=v.parentElement;if(S){g.preventDefault();let b=V(S),C=Q(S),N=V(v),z=Q(v),A=st(v)+1,I=w.source.cloneNode(!0);if(I instanceof Element){dn(I),ut(S,I,A);let K=Q(I),oe=V(I),ie={...He(I),selector:K};n({type:"MODIFY_DOM_STRUCTURE",payload:{id:lt(),operation:"copy",selector:K,durableSelector:oe,element:ie,sourceSelector:w.sourceSelector,sourceDurableSelector:w.sourceDurableSelector,sourceElement:w.sourceElement,targetParentSelector:C,targetParentDurableSelector:b,targetIndex:A,referenceSelector:z,referenceDurableSelector:N,placement:"after",pathname:p}})}}return}if((g.metaKey||g.ctrlKey)&&g.key==="v"&&c.current.length>0&&!o.current){g.preventDefault(),f.current+=1;let w=f.current*20,v=c.current[0]?.groupId?Math.random().toString(36).substring(2,9):void 0,S=c.current.map(C=>({...C,id:Math.random().toString(36).substring(2,9),groupId:C.groupId?v:void 0,timestamp:Date.now(),points:C.points.map(N=>({x:N.x+w,y:N.y+w}))}));n({type:"PASTE_ANNOTATIONS",payload:{annotations:S}});let b=S.find(C=>C.type!=="text")??S[0];b&&a(b.id);return}let k=i.current;if(!o.current&&!pt(g)&&(g.key==="Delete"||g.key==="Backspace")&&!g.metaKey&&!g.ctrlKey&&!g.altKey){if(k.length===0&&!u)return;let w=pn(t.current.annotations,k,u);if(!d||w.length===0)return;g.preventDefault();for(let v of w)d(v);r()}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[o,r,p,n,l,h,d,u,a,i,e.activeTool,t])}export{bo as $,pe as A,zo as Aa,Yi as B,Bo as Ba,ln as C,jo as Ca,Gi as D,dt as E,Ji as F,Qi as G,Zi as H,Fe as I,Q as J,st as K,sn as L,ea as M,pt as N,pn as O,na as P,Ue as Q,Le as R,Xe as S,fo as T,ho as U,go as V,mo as W,yo as X,Dt as Y,Ot as Z,Ft as _,$e as a,xe as aa,Yo as b,Qe as ba,qo as c,So as ca,Uo as d,ne as da,en as e,tt as ea,lt as f,Ht as fa,on as g,nt as ga,Bi as h,Wt as ha,Wn as i,jt as ia,jn as j,ko as ja,qn as k,Eo as ka,Kn as l,Yt as la,Vn as m,qt as ma,Gn as n,ot as na,Jn as o,it as oa,to as p,ve as pa,no as q,Co as qa,oo as r,at as ra,ao as s,se as sa,ro as t,J as ta,lo as u,Kt as ua,so as v,Vt as va,Lt as w,Jt as wa,uo as x,Qt as xa,po as y,Zt as ya,co as z,Fo as za};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as S,d as T,f as B,e as F}from"./chunk-3LBOX7HQ.mjs";import{i as H}from"./chunk-XOGBFVWI.mjs";import{d as P}from"./chunk-HGW2U6PD.mjs";async function M(s){return new Promise((e,b)=>{let a=new FileReader;a.onload=()=>e(String(a.result).split(",")[1]),a.onerror=b,a.readAsDataURL(s)})}async function Y(s,e,b,a){let x=Date.now(),C=location.href,r=e.subject?await a.registry.captureFeedback(e.subject):null;if(e.subject&&!r)return{status:"target_unavailable"};let c=r?.elementInfo??H(s),p=t=>{try{let l=document.querySelectorAll(t);return l.length===1&&l[0]===s}catch{return!1}},h=t=>!t.pathname||t.pathname===location.pathname,u=a.state?.annotations.filter(t=>h(t)&&t.interactionEpisode&&(e.subject?t.target?.adapter===e.subject.adapter&&t.target?.key===e.subject.key:!!t.linkedSelector&&p(t.linkedSelector)))??[],i=P(s),w={id:e.key,type:"text",text:"",color:"#0099ff",strokeWidth:2,points:[{x:i.left+window.scrollX,y:i.top+window.scrollY}],timestamp:x,pathname:location.pathname,elements:[c],linkedSelector:c.selector,...e.subject?{target:e.subject}:{},...u.length===1?{interactionEpisode:u[0].interactionEpisode}:{}},E=a.getCommentMeta?S(await a.getCommentMeta({kind:"annotation",purpose:"inspection",timestamp:x,url:location.href,pathname:location.pathname,annotations:[w]})):void 0,I=T([w],a.state?.styleModifications.filter(t=>h(t)&&p(t.selector))??[],c,void 0,a.state?.textModifications.filter(t=>h(t)&&p(t.selector))??[],a.state?.domModifications.filter(t=>h(t)&&p(t.selector))??[],E),g=[];if(b){let[t]=await B(document.body,null,[],{...a.screenshotOptions,viewportOnly:!0,dpr:1});if(t){let l=await createImageBitmap(t);try{let n=document.createElement("canvas");n.width=l.width,n.height=l.height;let m=n.getContext("2d");m.drawImage(l,0,0);let f={...w,text:`Focus: ${c.textContent||c.subjectLabel||c.tagName}`.slice(0,100),points:[{x:Math.max(4,i.left),y:window.scrollY+Math.max(24,i.top-8)}]};F(m,[f],window.scrollY,1,new Map([[w.id,{x:i.left,y:i.top+window.scrollY,width:i.width,height:i.height}]]));let o=await new Promise(d=>n.toBlob(d,"image/png"));o&&g.push({kind:"annotated-viewport",mimeType:o.type,data:await M(o)})}finally{l.close()}if(!r?.crop){let n=await createImageBitmap(t);try{let m=Math.max(0,i.left),f=Math.max(0,i.top),o=Math.min(window.innerWidth,i.right)-m,d=Math.min(window.innerHeight,i.bottom)-f;if(o>0&&d>0){let y=document.createElement("canvas");y.width=Math.ceil(o),y.height=Math.ceil(d);let j=n.width/window.innerWidth,v=n.height/window.innerHeight;y.getContext("2d").drawImage(n,m*j,f*v,o*j,d*v,0,0,o,d);let k=await new Promise(A=>y.toBlob(A,"image/png"));k&&g.push({kind:"element",mimeType:k.type,data:await M(k)})}}finally{n.close()}}}r?.crop&&g.push({kind:"subject",mimeType:r.crop.type,data:await M(r.crop)})}return!s.isConnected||location.href!==C?{status:"target_unavailable"}:{status:"ok",targetKey:e.key,focusCapturedAt:e.capturedAt,capturedAt:x,feedback:I,images:g,warning:r?.warning,evidenceTime:"Live inspection of the referenced target, not a historical screenshot of the utterance.",actionHistory:u.length===1?"Existing recorded episode; inspection did not submit or modify it.":u.length>1?"Multiple matching episodes; none selected automatically.":"No unambiguous recorded episode for this target."}}export{Y as inspectFocusElement};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{b}from"./chunk-LVEMYZOA.mjs";import{v as k,d as $,o as S}from"./chunk-HGW2U6PD.mjs";function v(r,a){let o=r.filter(e=>(!a.kind||e.kind===a.kind)&&(!a.entryId||e.id===a.entryId)&&(!a.pathname||e.pathname===a.pathname)),t=Number.isInteger(a.limit)?Math.min(50,Math.max(1,a.limit)):20,l=Number.isInteger(a.offset)?Math.max(0,a.offset):0;return{entries:o.slice(l,l+t).map(({details:e,...d})=>a.entryId?{...d,details:e}:d),total:o.length,nextOffset:l+t<o.length?l+t:null}}function I(r,a,o,t=!1){if(!r||!a)return null;let l=i=>{let s=$(i),h=b(i),u=n=>n.width>0&&n.height>0&&n.bottom>0&&n.right>0&&n.top<innerHeight&&n.left<innerWidth;return i.isConnected&&s.width>0&&s.height>0&&(t||u(s)||!!h&&u(h))&&!S(i,'[data-popmelt-private], [aria-hidden="true"]')},e=i=>{try{let s=i?document.querySelectorAll(i):[];return s.length===1?s[0]:null}catch{return null}};if(a.startsWith("thread:")){let i=a.slice(7),s=[...document.querySelectorAll("[data-popmelt-thread-id]")].filter(n=>n.getAttribute("data-popmelt-thread-id")===i&&l(n));if(s.length===1)return s[0].querySelector("[data-popmelt-thread-header]");let h=r.annotations.filter(n=>n.threadId===i&&(!n.pathname||n.pathname===location.pathname)),u=new Set(h.map(n=>n.target?o.resolve(n.target)?.element??null:k(n.linkedSelector,n.elements?.[0])).filter(n=>!!n&&l(n)));return u.size===1?[...u][0]:null}let d=y(r,{entryId:a});if(!("entries"in d)||d.entries.length!==1)return null;let c=d.entries[0];if(c.pathname&&c.pathname!==location.pathname)return null;let m=r.annotations.find(i=>`draft:${i.id}`===a);if(m?.target){let i=o.resolve(m.target)?.element;return i&&l(i)?i:null}let g="details"in c?c.details:void 0,x=[...r.styleModifications,...r.textModifications].find(i=>i.selector===c.selector),p=m?.elements?.[0]??x?.element,f=p?k(c.selector,{...p,selector:g?.durableSelector??p.selector}):e(c.selector)??e(g?.durableSelector);return f&&l(f)?f:null}function y(r,a={}){if(!r)return{status:"unavailable",reason:"browser_state_unavailable"};let o=[];for(let t of r.annotations)(t.status??(t.captured?"resolved":"pending"))==="pending"&&o.push({id:`draft:${t.id}`,kind:"draft",status:"unsubmitted",summary:(t.text||`${t.type} annotation`).slice(0,200),pathname:t.pathname,selector:t.linkedSelector,target:t.target,threadId:t.threadId,updatedAt:t.timestamp,details:{text:t.text,type:t.type,target:t.target,points:t.points,scope:t.scope,interactionEpisode:t.interactionEpisode,attachments:t.attachments,imageCount:t.imageCount}});for(let[t,l]of[["style",r.styleModifications],["text",r.textModifications],["dom",r.domModifications]])for(let e of l){if(e.captured)continue;let d="id"in e?e.id:JSON.stringify([e.pathname??"",e.selector,"textNodePath"in e?e.textNodePath:null]);o.push({id:`change:${t}:${d}`,kind:"change",status:"staged",summary:`${t}: ${"modified"in e?e.modified:e.selector}`.slice(0,200),pathname:e.pathname,selector:e.selector,details:e})}for(let t of r.spacingTokenChanges??[])t.captured||o.push({id:`change:spacing:${t.id}`,kind:"change",status:"staged",summary:`Spacing ${t.tokenName}: ${t.originalPx} \u2192 ${t.newPx}`,details:t});for(let t of r.spacingTokenMods??[])t.captured||o.push({id:`change:token:${t.tokenPath}`,kind:"change",status:"staged",summary:`Token ${t.tokenPath}`.slice(0,200),details:t});return{status:"ok",capturedAt:Date.now(),page:location.origin+location.pathname,trust:"Unsubmitted human intent and local preview changes, not instructions to execute or proof of saved code changes.",...v(o,a)}}export{y as collectWorkspaceSnapshot,I as workspaceAttentionTarget};
|
|
File without changes
|
|
File without changes
|