@popmelt.com/core 0.34.0 → 0.36.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.
Files changed (106) hide show
  1. package/README.md +24 -868
  2. package/THIRD_PARTY_NOTICES.md +72 -0
  3. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  4. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  5. package/dist/ExploreAttachment-H5WPEAZB.mjs +1 -0
  6. package/dist/PagePreviewLayer-WCYOBKAS.mjs +1 -0
  7. package/dist/ParticipantRuntime-HEC26AER.mjs +1 -0
  8. package/dist/PhoneHostGate-Q2AXVOSH.mjs +1 -0
  9. package/dist/PopmeltTasteConnectedPane-B7DHQKRQ.mjs +1 -0
  10. package/dist/{PreviewRuntime-EYKB7MG5.mjs → PreviewRuntime-H2UOLP6T.mjs} +1 -1
  11. package/dist/QueuedReplies-ESIFFRKS.mjs +1 -0
  12. package/dist/SuppliedContext-7ASO6GAW.mjs +1 -0
  13. package/dist/ThreadErrorCard-6R7W3RGZ.mjs +1 -0
  14. package/dist/ThreadPanel-3IS7GUYS.mjs +1 -0
  15. package/dist/adapter-react-three-fiber.d.mts +1 -1
  16. package/dist/bridge-entry.mjs +1 -1
  17. package/dist/browser-runtime-ILNTJLZ5.mjs +1 -0
  18. package/dist/browser.d.mts +4 -4
  19. package/dist/browser.mjs +1 -1
  20. package/dist/{checkFixture-AMLLLJNS.mjs → checkFixture-YE2ROOLL.mjs} +1 -1
  21. package/dist/chunk-26P7UUHT.mjs +1 -0
  22. package/dist/chunk-3SEXH3AZ.mjs +1 -0
  23. package/dist/chunk-3XJEC6LS.mjs +1 -0
  24. package/dist/chunk-7CGKO4IU.mjs +30 -0
  25. package/dist/{chunk-YXPRWW6B.mjs → chunk-AH6LZOQC.mjs} +1 -1
  26. package/dist/chunk-APP5IYTE.mjs +1 -0
  27. package/dist/chunk-DC47WNPG.mjs +1 -0
  28. package/dist/chunk-DJTGR3RO.mjs +1 -0
  29. package/dist/{chunk-QQB5G3VB.mjs → chunk-DLUNNAZC.mjs} +1 -1
  30. package/dist/chunk-EXIUW3JX.mjs +1 -0
  31. package/dist/chunk-FLTHWLRC.mjs +1 -0
  32. package/dist/chunk-GBVPRXA3.mjs +1 -0
  33. package/dist/chunk-HU2XWUJC.mjs +1 -0
  34. package/dist/chunk-L7QONR4K.mjs +1 -0
  35. package/dist/chunk-MSWXKP77.mjs +1 -0
  36. package/dist/{chunk-YTUQYKLM.mjs → chunk-NDGM4DAP.mjs} +1 -1
  37. package/dist/chunk-NWE5PYKM.mjs +1 -0
  38. package/dist/{chunk-GSEMSZDB.mjs → chunk-OAHYSDJ4.mjs} +1 -1
  39. package/dist/{chunk-Y6WD56SO.mjs → chunk-OZBMHEOD.mjs} +1 -1
  40. package/dist/chunk-PNTM77NT.mjs +1 -0
  41. package/dist/chunk-PYGRFSUU.mjs +1 -0
  42. package/dist/{chunk-H2RLTCUJ.mjs → chunk-R3AJWOID.mjs} +1 -1
  43. package/dist/chunk-TLREGQQB.mjs +1 -0
  44. package/dist/chunk-TUXBMJQZ.mjs +1 -0
  45. package/dist/chunk-WDAXARLI.mjs +1 -0
  46. package/dist/chunk-X2Q3H6X7.mjs +1 -0
  47. package/dist/chunk-XJQJQ5V5.mjs +1 -0
  48. package/dist/chunk-YHYFWNN6.mjs +1 -0
  49. package/dist/{chunk-MJ2PFKF3.mjs → chunk-ZDXQ7WNW.mjs} +1 -1
  50. package/dist/chunk-ZSL57PQ7.mjs +1 -0
  51. package/dist/cli.mjs +1 -1
  52. package/dist/codex-note-context-YFURG7VL.mjs +1 -0
  53. package/dist/codex-project-3NSU5OWL.mjs +1 -0
  54. package/dist/focus-inspection-SZJ5KP23.mjs +1 -0
  55. package/dist/index.d.mts +5 -5
  56. package/dist/index.mjs +1 -1
  57. package/dist/media.d.mts +3 -3
  58. package/dist/memory-store.d.mts +1 -1
  59. package/dist/{participantBootstrap-ClKpD2qC.d.mts → participantBootstrap-DFJlcKRI.d.mts} +2 -2
  60. package/dist/peer-client-56EAHIGF.mjs +1 -0
  61. package/dist/plugin-astro.mjs +1 -1
  62. package/dist/plugin-nuxt.mjs +1 -1
  63. package/dist/plugin-vite.d.mts +17 -0
  64. package/dist/plugin-vite.mjs +1 -1
  65. package/dist/server.d.mts +6 -6
  66. package/dist/server.mjs +1 -1
  67. package/dist/{steerStyles-VKQD57KC.mjs → steerStyles-E76E44PI.mjs} +1 -1
  68. package/dist/{subjects-EWAR5-0S.d.mts → subjects-DdavjSTL.d.mts} +12 -0
  69. package/dist/{types-C8tjyhiF.d.mts → types-g9YCBx4Z.d.mts} +2 -1
  70. package/dist/{video-adapter-BUMpNTCP.d.mts → video-adapter-DB6Hex1f.d.mts} +1 -1
  71. package/package.json +2 -3
  72. package/dist/ExploreAttachment-BG7ZOQSA.mjs +0 -1
  73. package/dist/PagePreviewLayer-CBDGPMJQ.mjs +0 -1
  74. package/dist/ParticipantRuntime-FSZX2PUQ.mjs +0 -1
  75. package/dist/PhoneHostGate-OM7FLOJ2.mjs +0 -1
  76. package/dist/PopmeltTasteConnectedPane-KJSBPJQR.mjs +0 -1
  77. package/dist/QueuedReplies-ZYUDSTS2.mjs +0 -1
  78. package/dist/SuppliedContext-7THB2WZY.mjs +0 -1
  79. package/dist/ThreadErrorCard-J2VTA5JW.mjs +0 -1
  80. package/dist/ThreadPanel-PNVMIIYJ.mjs +0 -1
  81. package/dist/browser-runtime-FFT5NH66.mjs +0 -1
  82. package/dist/chunk-2ETPREWQ.mjs +0 -1
  83. package/dist/chunk-3WSTAV5B.mjs +0 -1
  84. package/dist/chunk-67OWRNU3.mjs +0 -30
  85. package/dist/chunk-BFVLMSG5.mjs +0 -1
  86. package/dist/chunk-BJ25TGJN.mjs +0 -1
  87. package/dist/chunk-E5WNW4WE.mjs +0 -1
  88. package/dist/chunk-F5XSNRGT.mjs +0 -1
  89. package/dist/chunk-FMI4VQDZ.mjs +0 -1
  90. package/dist/chunk-GRPDZGPP.mjs +0 -1
  91. package/dist/chunk-JRP5XFYN.mjs +0 -1
  92. package/dist/chunk-LD3532UC.mjs +0 -1
  93. package/dist/chunk-MP6ZV2DN.mjs +0 -1
  94. package/dist/chunk-N66ZZG3L.mjs +0 -1
  95. package/dist/chunk-P4KM3K5M.mjs +0 -1
  96. package/dist/chunk-PQT5FYN5.mjs +0 -1
  97. package/dist/chunk-R3FPXDQS.mjs +0 -1
  98. package/dist/chunk-RSUMSUAW.mjs +0 -1
  99. package/dist/chunk-TRHC7WBO.mjs +0 -1
  100. package/dist/chunk-XSMCZUDR.mjs +0 -1
  101. package/dist/chunk-YC5CUNRU.mjs +0 -1
  102. package/dist/codex-note-context-NUKGR2WT.mjs +0 -1
  103. package/dist/codex-project-KE7ZZ6YX.mjs +0 -1
  104. package/dist/focus-inspection-BPPRCMNN.mjs +0 -1
  105. package/dist/peer-client-UQDASAO7.mjs +0 -1
  106. /package/dist/{chunk-3GXLNBXU.mjs → chunk-YD3PDEFX.mjs} +0 -0
@@ -1 +0,0 @@
1
- "use client";import{f as e}from"./chunk-J4WDYITA.mjs";import{l as t,d as n}from"./chunk-WHJEKDNP.mjs";import{destroyContext as o,createContext as i,domToCanvas as r}from"modern-screenshot";var a="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",l=24e6,s=["position","inset","top","right","bottom","left","z-index","display","visibility","opacity","overflow","overflow-x","overflow-y","box-sizing","box-decoration-break","float","clear","width","min-width","max-width","height","min-height","max-height","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","border","border-width","border-style","border-color","border-top","border-right","border-bottom","border-left","border-radius","outline","outline-offset","box-shadow","background","background-color","background-image","background-size","background-position","background-repeat","background-clip","background-origin","color","font","font-family","font-size","font-style","font-weight","font-stretch","font-variant","line-height","letter-spacing","text-align","text-decoration","text-indent","text-overflow","text-shadow","text-transform","white-space","word-break","overflow-wrap","vertical-align","direction","writing-mode","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","align-content","align-items","align-self","justify-content","justify-items","justify-self","gap","row-gap","column-gap","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-row","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","order","columns","column-count","column-fill","column-rule","column-span","column-width","list-style","list-style-image","list-style-position","list-style-type","object-fit","object-position","aspect-ratio","transform","transform-box","transform-origin","transform-style","perspective","perspective-origin","backface-visibility","clip","clip-path","filter","backdrop-filter","mix-blend-mode","isolation","mask","mask-image","mask-position","mask-repeat","mask-size","content","quotes","counter-increment","counter-reset","appearance","accent-color","caret-color","cursor","pointer-events","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity"];async function c(e,t){try{let t=await e();if(t)return t}catch{}return t()}var d=new Map,h=new WeakMap,m=1;function u(){return typeof performance<"u"?performance.now():Date.now()}function g(e){if(void 0!==e?.debug)return e.debug;if(typeof window>"u")return!1;try{return"true"===window.localStorage.getItem("popmelt:screenshot-debug")}catch{return!1}}function f(e,t){let n=null;return async o=>{if(!w(o))return!1;n??(n=Date.now()+e);let i=n-Date.now();if(i<=0)return t(),a;let r=new AbortController,l=setTimeout(()=>r.abort(),i);try{let e=await fetch(o,{cache:"force-cache",mode:"cors",signal:r.signal});if(!e.ok)throw new Error(`Asset returned ${e.status}`);return await function(e){return new Promise((t,n)=>{let o=new FileReader;o.onload=()=>t(String(o.result)),o.onerror=()=>n(o.error??new Error("Asset could not be read")),o.readAsDataURL(e)})}(await e.blob())}catch{return t(),a}finally{clearTimeout(l)}}}function p(e,t,n){let o=Math.min(t,n);return{top:Math.max(0,Math.min(e,n-o)),height:o,annotations:[]}}function w(e){if(typeof window>"u")return!1;try{let t=new URL(e,window.location.href);return("http:"===t.protocol||"https:"===t.protocol)&&t.origin!==window.location.origin}catch{return!1}}function y(e){let t=document.createElement("canvas").getContext("2d");return t?(t.fillStyle=e,t.fillStyle):"#888888"}function b(e,t=[],n,o,i=[],r=[],a){let l=new Map,s=[];for(let t of e)if(t.groupId){let e=l.get(t.groupId)||[];e.push(t),l.set(t.groupId,e)}else s.push(t);let c=[];for(let[e,t]of l){let e=t.find(e=>"text"!==e.type),n=t.find(e=>"text"===e.type);if(e){let t=e.linkedSelector||n?.linkedSelector,o=n?.imageCount||e.imageCount,i=n?.attachments||e.attachments,r=n?.interactionEpisode||e.interactionEpisode,a=e.pathname||n?.pathname;c.push({id:e.id,type:e.type,instruction:n?.text,...t?{linkedSelector:t}:{},...e.target||n?.target?{target:e.target??n?.target}:{},...a?{pathname:a}:{},elements:e.elements||[],...o?{imageCount:o}:{},...i?.length?{attachments:i}:{},...r?{interactionEpisode:r}:{}})}}for(let e of s)c.push({id:e.id,type:e.type,instruction:"text"===e.type?e.text:void 0,...e.linkedSelector?{linkedSelector:e.linkedSelector}:{},...e.target?{target:e.target}:{},...e.pathname?{pathname:e.pathname}:{},elements:e.elements||[],...e.region?{region:e.region}:{},...e.imageCount?{imageCount:e.imageCount}:{},...e.attachments?.length?{attachments:e.attachments}:{},...e.interactionEpisode?{interactionEpisode:e.interactionEpisode}:{}});return{timestamp:(new Date).toISOString(),url:window.location.href,viewport:{width:window.innerWidth,height:window.innerHeight},scrollPosition:{x:window.scrollX,y:window.scrollY},annotations:c,styleModifications:t,...i.length>0?{textModifications:i}:{},...r.length>0?{domModifications:r}:{},...n?{inspectedElement:n}:{},...o&&o.length>0?{spacingTokenChanges:o}:{},...a?{meta:a}:{}}}function x(e){if(!e.points||0===e.points.length)return null;let t=[...e.points,...e.region?.points??[]],n=t.map(e=>e.x),o=t.map(e=>e.y);return{minX:Math.min(...n),minY:Math.min(...o),maxX:Math.max(...n),maxY:Math.max(...o)}}function M(e){let o=new Map;for(let i of e)if(i.linkedSelector)try{let e=t(i.linkedSelector);if(e){let t=n(e);o.set(i.id,{x:t.left+window.scrollX,y:t.top+window.scrollY,width:t.width,height:t.height})}}catch{}return o}function v(t,n,o,i,r){if(t.save(),t.scale(i,i),r)for(let e of n){let n=r.get(e.id);if(!n)continue;let i=n.y-o;t.fillStyle=e.color,t.globalAlpha=.05,t.fillRect(n.x,i,n.width,n.height),t.globalAlpha=1,t.strokeStyle=e.color,t.lineWidth=1,t.setLineDash([2,4]),t.strokeRect(n.x,i,n.width,n.height),t.setLineDash([])}for(let i of n){let n=i.points.map(e=>({x:e.x,y:e.y-o}));switch(t.strokeStyle=i.color,t.fillStyle=i.color,t.lineWidth=i.strokeWidth,t.lineCap="round",t.lineJoin="round",i.region&&e(t,i.region.points.map(e=>({x:e.x,y:e.y-o})),i.color),i.type){case"freehand":if(n.length<2)break;t.beginPath(),t.moveTo(n[0].x,n[0].y);for(let e=1;e<n.length;e++)t.lineTo(n[e].x,n[e].y);t.stroke();break;case"line":if(n.length<2)break;t.beginPath(),t.moveTo(n[0].x,n[0].y),t.lineTo(n[n.length-1].x,n[n.length-1].y),t.stroke();break;case"rectangle":{if(n.length<2)break;let e=n[0],o=n[n.length-1],i=Math.min(e.x,o.x),r=Math.min(e.y,o.y),a=Math.abs(o.x-e.x),l=Math.abs(o.y-e.y);t.strokeRect(i,r,a,l);break}case"circle":{if(n.length<2)break;let e=n[0],o=n[n.length-1],i=(e.x+o.x)/2,r=(e.y+o.y)/2,a=Math.abs(o.x-e.x)/2,l=Math.abs(o.y-e.y)/2;t.beginPath(),t.ellipse(i,r,a,l,0,0,2*Math.PI),t.stroke();break}case"text":{if(!i.text||n.length<1)break;let e=n[0],o=i.fontSize||16;t.font=`${o}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`,t.fillStyle=i.color;let r=(i.imageCount&&i.imageCount>0?`[${i.imageCount} image${i.imageCount>1?"s":""}] ${i.text}`:i.text).split("\n"),a=1.2*o,l=4,s=0;for(let e of r)s=Math.max(s,t.measureText(e).width);t.fillRect(e.x-l,e.y-l,s+2*l,r.length*a+2*l),t.fillStyle="#ffffff",r.forEach((n,i)=>{t.fillText(n,e.x,e.y+o+i*a)});break}}}t.restore()}async function k(e,t,n=[],r){let c=function(e,t,n){let o=h.get(e);o||(o=m++,h.set(e,o));let i=t.filter(e=>"pending"===(e.status??"pending")).map(e=>{let t=e.points[0],n=e.points[e.points.length-1];return`${e.id}:${e.points.length}:${t?.x??""}:${t?.y??""}:${n?.x??""}:${n?.y??""}`}).join("|");return[o,window.location.href,window.innerWidth,window.innerHeight,n?.dpr??window.devicePixelRatio??1,n?.viewportOnly?window.scrollY:"",i].join("::")}(e,n,r),y=d.get(c);if(y)return g(r)&&console.debug("[Screenshot] Reusing in-flight capture",c),y;let b=async function(e,t,n){let r=u(),c=n?.dpr??(window.devicePixelRatio||1),d=window.innerWidth,h=window.innerHeight,m=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight),y=Math.max(250,n?.mediaTimeoutMs??1500),b=g(n),v=t.filter(e=>"pending"===(e.status??"pending")),k=M(v),E=n?.viewportOnly?[p(window.scrollY,h,m)]:function(e,t,n,o){return 0===e.length?[{top:Math.max(0,Math.min(o,Math.max(0,n-t))),height:Math.min(t,n||t),annotations:[]}]:e.map(e=>{let o=Math.min(t,n||t);return{top:Math.max(0,Math.min(e.top,Math.max(0,n-o))),height:o,annotations:e.annotations}})}(function(e,t){if(0===e.length)return[];let n=e.map(e=>({annotation:e,bounds:x(e)})).filter(e=>null!==e.bounds);if(0===n.length)return[];n.sort((e,t)=>e.bounds.minY-t.bounds.minY);let o=Math.min(...n.map(e=>e.bounds.minY)),i=Math.max(...n.map(e=>e.bounds.maxY));if(i-o<=t){let n=(o+i)/2,r=Math.max(0,n-t/2);return[{top:r,bottom:r+t,annotations:e}]}let r=[],a=Math.max(0,o-50),l=[],s=a;for(let{annotation:e,bounds:o}of n){let n=o.maxY+50;if(n-a<=t)l.push(e),s=Math.max(s,n);else{if(l.length>0){let e=(a+s)/2,n=Math.max(0,e-t/2);r.push({top:n,bottom:n+t,annotations:l})}a=Math.max(0,o.minY-50),l=[e],s=o.maxY+50}}if(l.length>0){let e=(a+s)/2,n=Math.max(0,e-t/2);r.push({top:n,bottom:n+t,annotations:l})}return r}(v,h),h,m,window.scrollY),P=function(e){let t=0,n=0;for(let o of e.querySelectorAll("img[src]"))w(o.currentSrc||o.src)&&(t++,(!o.complete||0===o.naturalWidth)&&n++);return{remoteImages:t,unresolvedRemoteImages:n}}(e),L={startedAt:r,mode:"dom",mediaTimeoutMs:y,ranges:E.length,...P,remoteAssetFallbacks:0,nativeMs:0,contextMs:0,renderMs:0,compositeMs:0,encodeMs:0};console.log("[Screenshot] Starting capture with",v.length,"active annotations (filtered",t.length-v.length,"captured);",`${E.length} range(s), ${P.remoteImages} remote image(s), ${P.unresolvedRemoteImages} unresolved`);let U=null,O=null,$=function(e,t,n){if(0===e.length)return null;let o=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.top+e.height))-o,r=t*i*n*n;return i>16e3||r>l?null:{top:o,height:i}}(E,d,c),j=$??E[0],D=async()=>{if(!U){let t=u();U=async function(e,t,n,o,r,l,c,d){let h=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)>4*window.innerHeight||e.querySelectorAll("*").length>2500,m=d?await d():[];return R(m,()=>i(e,{autoDestruct:!1,filter:S,features:{restoreScrollPosition:!0},onCloneNode:t=>{e===document.body&&(t.style.margin=getComputedStyle(e).margin)},onCloneEachNode:e=>{if(1===e.nodeType&&"html"===e.localName&&e.ownerDocument!==document){let t=e.style;t.overflow="hidden",t.display="inline-block",t.clipPath=`inset(0 round ${t.borderRadius||"0px"})`}},scale:o,backgroundColor:A(),width:n,height:t.height,style:{transform:`translate(${-window.scrollX}px, ${-t.top}px)`,transformOrigin:"top left"},timeout:r,debug:l,includeStyleProperties:h?[...s]:null,fetchFn:f(r,()=>{c.remoteAssetFallbacks++}),fetch:{requestInit:{cache:"force-cache"},placeholderImage:a}}))}(e,j,d,c,y,b,L,n?.captureSurfaces).then(e=>(O=e,L.contextMs+=u()-t,e))}return U};try{let e,t=u();if($){let t=await C($,d,c,n,D,L);e=E.map(e=>I(t,$.top,e,d,c,k))}else{e=[];for(let t of E){let o=await C(t,d,c,n,D,L);e.push(I(o,t.top,t,d,c,k))}}let o=function(e){if(1===e.length)return e[0];let t=document.createElement("canvas");t.width=e[0]?.width??0,t.height=e.reduce((e,t)=>e+t.height,0);let n=t.getContext("2d");if(!n)throw new Error("Canvas context unavailable");let o=0;for(let t of e)n.drawImage(t,0,o),o+=t.height;return t}(e);L.compositeMs+=u()-t-L.renderMs-L.nativeMs-L.contextMs;let i=u(),r=await function(e,t="image/webp",n=.8){return new Promise(o=>e.toBlob(o,t,n))}(o);L.encodeMs=u()-i;let a=u()-L.startedAt,l={mode:L.mode,totalMs:Math.round(a),mediaTimeoutMs:L.mediaTimeoutMs,ranges:L.ranges,remoteImages:L.remoteImages,unresolvedRemoteImages:L.unresolvedRemoteImages,remoteAssetFallbacks:L.remoteAssetFallbacks,nativeMs:Math.round(L.nativeMs),contextMs:Math.round(L.contextMs),renderMs:Math.round(L.renderMs),compositeMs:Math.max(0,Math.round(L.compositeMs)),encodeMs:Math.round(L.encodeMs),overBudget:a>5e3};return console.log("[Screenshot] Capture complete",JSON.stringify(l)),r?[r]:[]}catch(e){return console.error("[Screenshot] Capture failed:",e),[]}finally{O&&o(O)}}(e,n,r).finally(()=>d.delete(c));return d.set(c,b),b}function A(){let e=getComputedStyle(document.documentElement).backgroundColor;return e&&"rgba(0, 0, 0, 0)"!==e&&"transparent"!==e?e:"#ffffff"}function S(e){return!(e instanceof HTMLElement)||"devtools-canvas"!==e.id&&"devtools-toolbar"!==e.id&&"devtools-scrim"!==e.id&&void 0===e.dataset.devtools}async function R(e,t){let n=[];for(let t of e){let e=Object.getOwnPropertyDescriptor(t.element,"toDataURL");try{Object.defineProperty(t.element,"toDataURL",{configurable:!0,value:()=>t.dataUrl}),n.push(()=>{e?Object.defineProperty(t.element,"toDataURL",e):Reflect.deleteProperty(t.element,"toDataURL")})}catch{}}try{return await t()}finally{for(let e of n.reverse())e()}}async function C(e,t,n,o,i,a){if(o?.nativeCapture){let i=u();try{let r=await o.nativeCapture({url:window.location.href,clip:{x:window.scrollX,y:e.top,width:t,height:e.height},scale:n});if(a.nativeMs+=u()-i,r)return a.mode=a.renderMs>0||a.contextMs>0?"mixed":"native",async function(e,t,n){let o=document.createElement("canvas");o.width=t,o.height=n;let i=o.getContext("2d");if(!i)throw new Error("Canvas context unavailable");if("function"==typeof createImageBitmap){let r=await createImageBitmap(e);return i.drawImage(r,0,0,t,n),r.close(),o}let r=new Image,a=URL.createObjectURL(e);try{return await new Promise((e,t)=>{r.onload=()=>e(),r.onerror=()=>t(new Error("Native screenshot could not be decoded")),r.src=a}),i.drawImage(r,0,0,t,n),o}finally{URL.revokeObjectURL(a)}}(r,Math.round(t*n),Math.round(e.height*n))}catch(e){a.nativeMs+=u()-i,g(o)&&console.debug("[Screenshot] Native capture unavailable; using DOM fallback",e)}}let l=await i(),s=u(),c=await async function(e,t,n){return e.width=n,e.height=t.height,e.style={transform:`translate(${-window.scrollX}px, ${-t.top}px)`,transformOrigin:"top left"},r(e)}(l,e,t);return a.renderMs+=u()-s,a.mode="native"===a.mode?"mixed":"dom",c}function I(e,t,n,o,i,r){let a=document.createElement("canvas");a.width=Math.round(o*i),a.height=Math.round(n.height*i);let l=a.getContext("2d");if(!l)throw new Error("Canvas context unavailable");let s=Math.round((n.top-t)*i);return l.drawImage(e,0,s,a.width,a.height,0,0,a.width,a.height),v(l,n.annotations,n.top,i,r),a}async function E(e){if(0===e.length)return null;if(1===e.length)return e[0];let t=await Promise.all(e.map(e=>new Promise((t,n)=>{let o=new Image;o.onload=()=>t(o),o.onerror=n,o.src=URL.createObjectURL(e)}))),n=t[0].width,o=t.reduce((e,t)=>e+t.height,0),i=document.createElement("canvas");i.width=n,i.height=o;let r=i.getContext("2d");if(!r)return null;let a=0;for(let e of t)r.drawImage(e,0,a),a+=e.height,URL.revokeObjectURL(e.src);return new Promise(e=>{i.toBlob(t=>e(t),"image/webp",.8)})}async function P(e,t,n,o,i){try{let r=Array.isArray(e)?e:[e];if(0===r.length)return!1;let a=await E(r);if(!a)return!1;let l=a;if("image/png"!==a.type){let e=new Image,t=URL.createObjectURL(a);await new Promise(n=>{e.onload=()=>n(),e.src=t}),URL.revokeObjectURL(t);let n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight,n.getContext("2d").drawImage(e,0,0),l=await new Promise(e=>n.toBlob(t=>e(t),"image/png"))}let s={"image/png":l},c=t&&t.length>0,d=n&&n.length>0,h=o&&o.length>0,m=i&&i.length>0;if(c||d||h||m){let e=t?t.filter(e=>"pending"===(e.status??"pending")):[];if(e.length>0||d||h||m){let t=b(e,n||[],void 0,void 0,o||[],i||[]),r=new Blob([JSON.stringify(t,null,2)],{type:"text/plain"});s["text/plain"]=r}}return await navigator.clipboard.write([new ClipboardItem(s)]),!0}catch(e){return console.warn("Clipboard write failed:",e),!1}}export{c as a,y as b,b as c,v as d,k as e,R as f,E as g,P as h};
@@ -1 +0,0 @@
1
- import{a as m}from"./chunk-YXPRWW6B.mjs";import"./chunk-2ETPREWQ.mjs";import"./chunk-QQB5G3VB.mjs";import"./chunk-RSUMSUAW.mjs";import"./chunk-67OWRNU3.mjs";import"./chunk-GRPDZGPP.mjs";import"./chunk-HV7HRQ2S.mjs";import"./chunk-RUJC32MA.mjs";import"./chunk-QXVMGZFP.mjs";import"./chunk-NOHXTT24.mjs";export{m as canvasReceiptsForTurn};
@@ -1 +0,0 @@
1
- import{a as o,b as e,c as m,d as r,e as s,f as i}from"./chunk-QQB5G3VB.mjs";import"./chunk-RSUMSUAW.mjs";import"./chunk-67OWRNU3.mjs";import"./chunk-GRPDZGPP.mjs";import"./chunk-HV7HRQ2S.mjs";import"./chunk-RUJC32MA.mjs";import"./chunk-QXVMGZFP.mjs";import"./chunk-NOHXTT24.mjs";export{i as callCodexBridge,m as codexExecutionOwner,o as discoverCodexPopmeltProjects,s as ensureCodexBridge,e as findCodexPopmeltProject,r as isBridgeOwnedCodexRun};
@@ -1 +0,0 @@
1
- "use client";import{a as t}from"./chunk-Q74FBX2I.mjs";import{c as e,e as i,d as a}from"./chunk-YC5CUNRU.mjs";import"./chunk-J4WDYITA.mjs";import"./chunk-4LHTPRFY.mjs";import{f as n}from"./chunk-XT6PHPPG.mjs";import"./chunk-5K7SACPW.mjs";import{d as o}from"./chunk-WHJEKDNP.mjs";async function r(t){return new Promise((e,i)=>{let a=new FileReader;a.onload=()=>e(String(a.result).split(",")[1]),a.onerror=i,a.readAsDataURL(t)})}async function l(l,s,c,m){let d=Date.now(),p=location.href,h=s.subject?await m.registry.captureFeedback(s.subject):null;if(s.subject&&!h)return{status:"target_unavailable"};let u=h?.elementInfo??n(l),w=t=>{try{let e=document.querySelectorAll(t);return 1===e.length&&e[0]===l}catch{return!1}},g=t=>!t.pathname||t.pathname===location.pathname,f=m.state?.annotations.filter(t=>g(t)&&t.interactionEpisode&&(s.subject?t.target?.adapter===s.subject.adapter&&t.target?.key===s.subject.key:!!t.linkedSelector&&w(t.linkedSelector)))??[],y=o(l),k={id:s.key,type:"text",text:"",color:"#0099ff",strokeWidth:2,points:[{x:y.left+window.scrollX,y:y.top+window.scrollY}],timestamp:d,pathname:location.pathname,elements:[u],linkedSelector:u.selector,...s.subject?{target:s.subject}:{},...1===f.length?{interactionEpisode:f[0].interactionEpisode}:{}},b=m.getCommentMeta?t(await m.getCommentMeta({kind:"annotation",purpose:"inspection",timestamp:d,url:location.href,pathname:location.pathname,annotations:[k]})):void 0,j=e([k],m.state?.styleModifications.filter(t=>g(t)&&w(t.selector))??[],u,void 0,m.state?.textModifications.filter(t=>g(t)&&w(t.selector))??[],m.state?.domModifications.filter(t=>g(t)&&w(t.selector))??[],b),x=[];if(c){let[t]=await i(document.body,null,[],{...m.screenshotOptions,viewportOnly:!0,dpr:1});if(t){let e=await createImageBitmap(t);try{let t=document.createElement("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0);let n={...k,text:`Focus: ${u.textContent||u.subjectLabel||u.tagName}`.slice(0,100),points:[{x:Math.max(4,y.left),y:window.scrollY+Math.max(24,y.top-8)}]};a(i,[n],window.scrollY,1,new Map([[k.id,{x:y.left,y:y.top+window.scrollY,width:y.width,height:y.height}]]));let o=await new Promise(e=>t.toBlob(e,"image/png"));o&&x.push({kind:"annotated-viewport",mimeType:o.type,data:await r(o)})}finally{e.close()}if(!h?.crop){let e=await createImageBitmap(t);try{let t=Math.max(0,y.left),i=Math.max(0,y.top),a=Math.min(window.innerWidth,y.right)-t,n=Math.min(window.innerHeight,y.bottom)-i;if(a>0&&n>0){let o=document.createElement("canvas");o.width=Math.ceil(a),o.height=Math.ceil(n);let l=e.width/window.innerWidth,s=e.height/window.innerHeight;o.getContext("2d").drawImage(e,t*l,i*s,a*l,n*s,0,0,a,n);let c=await new Promise(t=>o.toBlob(t,"image/png"));c&&x.push({kind:"element",mimeType:c.type,data:await r(c)})}}finally{e.close()}}}h?.crop&&x.push({kind:"subject",mimeType:h.crop.type,data:await r(h.crop)})}return l.isConnected&&location.href===p?{status:"ok",targetKey:s.key,focusCapturedAt:s.capturedAt,capturedAt:d,feedback:j,images:x,warning:h?.warning,evidenceTime:"Live inspection of the referenced target, not a historical screenshot of the utterance.",actionHistory:1===f.length?"Existing recorded episode; inspection did not submit or modify it.":f.length>1?"Multiple matching episodes; none selected automatically.":"No unambiguous recorded episode for this target."}:{status:"target_unavailable"}}export{l as inspectFocusElement};
@@ -1 +0,0 @@
1
- import{a as m,b as n,c as s,d as r,e as a,f as e}from"./chunk-2ETPREWQ.mjs";import"./chunk-QQB5G3VB.mjs";import"./chunk-RSUMSUAW.mjs";import"./chunk-67OWRNU3.mjs";import"./chunk-GRPDZGPP.mjs";import"./chunk-HV7HRQ2S.mjs";import"./chunk-RUJC32MA.mjs";import"./chunk-QXVMGZFP.mjs";import"./chunk-NOHXTT24.mjs";export{m as agentCredentialFile,a as callPeer,r as canvasChatRequest,s as enrolledCanvasEndpoint,e as runPeerCommand,n as sendThreadNote};
File without changes