page-harness 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(){var e=[`bolder`,`quieter`,`polish`,`typeset`,`colorize`,`layout`,`distill`,`adapt`,`animate`,`delight`,`overdrive`,`freeform`],t=/^(padding|margin)(-|$)/;function n(e){return e.trim().replace(/\s+/g,` `)}function r(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function i(e){return/(?:^|[\s>+~])(?:ul|ol)(?![a-z-])/i.test(e)}function a(e){let t=n(e),r=t.match(/^(.*?)\s*(?:>\s*)?li(?![a-z-])/i);return r&&i(r[1])?n(r[1]):i(t)&&!/(?:^|[\s>+~])li(?![a-z-])/i.test(t)?t:null}function o(e,t){let r=n(e),i=n(t);if(!r||r===i||!i.startsWith(r))return!1;let a=i.charAt(r.length);return a===` `||a===`>`||a===`+`||a===`~`}function s(e){if(e.kind!==`patch`||!e.patch||e.patch.text!==void 0||e.patch.attrs)return!1;let n=Object.keys(e.patch.style??{});return n.length>0&&n.every(e=>t.test(e))}function c(e){if(e?.style)return Object.entries(e.style).map(([e,t])=>`${e}: ${t}`).join(`; `)||void 0}function l(e){let t={selector:e.selector},n=c(e.patch);return n&&(t.css=n),e.patch?.text!==void 0&&(t.text=e.anchor?.text?`${e.anchor.text} → ${e.patch.text}`:e.patch.text),e.patch?.attrs?.src&&(t.image=e.patch.attrs.src.startsWith(`data:`)?`(uploaded image)`:e.patch.attrs.src),t}function u(e){return e.patch?.style??{}}function d(e){let t=e.anchor?.text?.trim();if(t)return`「${r(t,42)}」这一块`;let n=(e.anchor?.tag||``).toLowerCase();if(n===`img`||/(?:^|[\s>+~])img(?![a-z-])/i.test(e.selector))return`这张照片`;if(/^h[1-6]$/.test(n)||/(?:^|[\s>+~])h[1-6](?![a-z-])/i.test(e.selector))return`这个标题`;let i=e.label?.replace(/^[a-z0-9-]+\s*/i,``).replace(/^"|"$/g,``).trim();return i?`「${r(i,42)}」这一块`:`页面上标出的这一块`}function f(e){return(e.anchor?.tag||``).toLowerCase()===`img`||/(?:^|[\s>+~])img(?![a-z-])/i.test(e.selector)||!!e.patch?.attrs?.src}function p(e){return/^h[1-6]$/i.test(e.anchor?.tag||``)||/(?:^|[\s>+~])h[1-6](?![a-z-])/i.test(e.selector)}function m(e){let t=e.map(e=>`${e.anchor?.text??``} ${e.label??``} ${e.note??``}`).join(` `);return/书目|书单|bibliography|\bC\+\+|Tour of|Programming:/i.test(t)}function h(e){let t=u(e),n=Object.values(t).join(` `),r=/#fff\b|#ffffff|white|rgb\(\s*255\s*,\s*255\s*,\s*255/i.test(n),i=!!(t.border||t[`border-width`]||t[`border-style`]||t[`border-color`]),a=/rotate\(\s*(-?[\d.]+)\s*deg/i.exec(t.transform||n),o=a?Number(a[1]):0,s=!!t[`box-shadow`],c=[];i&&c.push(r?`加上一圈白边`:`加上了边框`),a&&o<-.2?c.push(`微微向左倾斜`):a&&o>.2&&c.push(`微微向右倾斜`),s&&c.push(`底下多了一层阴影`);let l=r&&i&&!!a&&s,d=c.length?`这张照片${c.join(`,`)}${l?`,看起来像一张放在桌上的拍立得`:``}。`:`这张照片的外观改了,改前和改后的样子在下面。`,f=`照片的外观改了`;return l?f=`照片改成斜放的拍立得`:r&&i&&a?f=`照片加上白边并斜放`:c[0]&&(f=`照片${c[0]}`),{title:f,say:d}}function g(e){let t=e.anchor?.text?.trim(),n=e.patch?.text?.trim(),i=u(e)[`font-style`]===`italic`,a=!!t?.endsWith(`!`)&&!!n&&!n.endsWith(`!`),o=p(e)?`标题`:`这段文字`,s=[];return t&&n&&t!==n?s.push(`从「${r(t,80)}」改成了「${r(n,80)}」`):n&&s.push(`改成了「${r(n,80)}」`),i&&s.push(s.length?`并改成斜体`:`改成了斜体`),a&&s.push(`感叹号去掉了`),s.length?{title:i&&a?`${o}改成斜体,并去掉感叹号`:i?`${o}改成斜体`:a?`${o}去掉感叹号`:`${o}文字改了`,say:`${o}${s.join(`,`)}。`}:x(e)}var _=[`零`,`一`,`两`,`三`,`四`,`五`,`六`,`七`,`八`,`九`,`十`],v=e=>e>=1&&e<=10?_[e]:String(e);function y(e){if(!e)return NaN;let t=parseFloat(e);return Number.isFinite(t)?t:NaN}function b(e){let t=m(e)?`书目`:`列表`,r=e.map(e=>{let t=Number(/nth-(?:child|of-type)\((\d+)\)/i.exec(e.selector)?.[1]??NaN),n=u(e);return{n:t,px:y(n[`font-size`]),border:!!(n[`border-bottom`]||n[`border-bottom-width`]),bold:Number(n[`font-weight`])>=600||/bold/i.test(n[`font-weight`]||``)}}).filter(e=>!Number.isNaN(e.n)&&!Number.isNaN(e.px)).sort((e,t)=>e.n-t.n),i=+!!r.length;for(let e=1;e<r.length&&r[e].px<r[e-1].px-.5;e++)i=e+1;let o=r.find(e=>e.border),s=o?r.indexOf(o)+1:i,c=r.slice(s).some(e=>e.bold),l=e.find(e=>a(e.selector)===n(e.selector)),d=[`整段${t}${/none/i.test(u(l??e[0])[`list-style`]||u(l??e[0])[`list-style-type`]||``)?`不再是同一号字的圆点列表`:`的字号层次改了`}`];return s>=2&&d.push(`前${v(s)}项由大到小排开`),o&&d.push(`第${v(o.n)}项下面加了一条线`),c&&d.push(`后面的项改成同一号的加粗字`),{title:s>=2?`${t}改成由大到小的字号阶梯`:`${t}的外观改了`,say:`${d.join(`,`)}。`}}function x(e){let t=u(e),n=[];t[`font-style`]===`italic`&&n.push(`改成了斜体`),(Number(t[`font-weight`])>=600||/bold/i.test(t[`font-weight`]||``))&&n.push(`改成了粗体`),t[`font-size`]&&n.push(`字号改成 ${t[`font-size`].replace(`px`,` 像素`)}`),t[`font-family`]&&n.push(`换了一套字体`),t.color&&n.push(`文字颜色改了`),(t[`background-color`]||t.background)&&n.push(`背景改了`),t[`border-radius`]&&n.push(`圆角改了`),(t.border||t[`border-color`])&&n.push(`边框改了`),(t[`text-decoration`]||t[`text-decoration-line`])&&n.push(`文字装饰改了`),t.opacity&&n.push(`透明度改了`);let r=d(e);return n.length?{title:`这一块的外观改了`,say:`${r}${n.join(`,`)}。`}:{title:`这一块的外观改了`,say:`${r}的外观改了,差别看下面的改前和改后。`}}function S(e){let t=e.note.trim();return{title:r(t.split(/[。.!!?\n]/)[0]?.trim()||`文字意见`,36),say:t,where:`关于${d(e)}`}}function C(e,t){if(t)return b(e);let n=e[0];return!n||n.kind===`note`?S(n):n.patch?.text===void 0?f(n)?h(n):x(n):g(n)}function w(e,t,r){let i=r?a(e[0].selector):null,o=r?e.find(e=>n(e.selector)===i)??[...e].sort((e,t)=>e.selector.length-t.selector.length||e.n-t.n)[0]:e[0],s=C(e,r),c=[...e].sort((e,t)=>e.n-t.n),u=[...c,...t].map(l);return{id:o.id,n:o.n,kind:o.kind,path:o.path,primary:o,members:c,extras:t,title:s.title,say:s.say,...s.where?{where:s.where}:{},status:e.every(e=>e.status===`resolved`)?`resolved`:`open`,authorName:o.author?.name||``,lines:u}}function T(e){let t=new Map;for(let n of e){let e=a(n.selector);if(!e)continue;let r=e;t.set(r,[...t.get(r)??[],n])}return[...t.values()].filter(e=>e.length>=2)}function E(e){let t=[...new Set(e.map(e=>e.path))],n=[];for(let r of t){let t=e.filter(e=>e.path===r),i=t.filter(e=>e.kind!==`patch`||!e.patch),a=t.filter(e=>e.kind===`patch`&&e.patch),c=T(a),l=new Set(c.flat().map(e=>e.id)),u=a.filter(e=>!l.has(e.id)),d=new Set(u.filter(e=>s(e)&&u.some(t=>t!==e&&o(e.selector,t.selector))||s(e)&&c.some(t=>t.some(t=>o(e.selector,t.selector)))).map(e=>e.id)),f=u.filter(e=>d.has(e.id)),p=u.filter(e=>!d.has(e.id)),m=[...i.map(e=>w([e],[],!1)),...c.map(e=>w(e,f.filter(t=>e.some(e=>o(t.selector,e.selector))),!0)),...p.map(e=>w([e],f.filter(t=>o(t.selector,e.selector)),!1))];n.push(...m)}return n.sort((e,t)=>Number(e.status===`resolved`)-Number(t.status===`resolved`)||e.n-t.n)}function D(e){return E(e.map((e,t)=>({id:`tmp_${t}`,n:t+1,kind:`patch`,path:`/`,selector:e.selector,note:``,patch:e.patch,author:{id:`tmp`,name:`tmp`,kind:`human`},status:`open`,replies:[],createdAt:0}))).map(e=>e.primary.selector)}var O=/^(css|sc|jsx|emotion|svelte|astro|data-v)-|[0-9a-f]{6,}|__[A-Za-z0-9]{5,}$|^_/,k=80,A=4e3,j=e=>e.replace(/\s+/g,` `).trim(),ee=e=>j(e.textContent??``);function te(e){return[...e.classList].filter(e=>!O.test(e)&&e.length<40).slice(0,6)}function M(e,t){if(e===t)return 1;if(!e||!t||e.length<2||t.length<2)return 0;let n=new Map;for(let t=0;t<e.length-1;t++){let r=e.slice(t,t+2);n.set(r,(n.get(r)??0)+1)}let r=0;for(let e=0;e<t.length-1;e++){let i=t.slice(e,e+2),a=n.get(i)??0;a>0&&(n.set(i,a-1),r++)}return 2*r/(e.length+t.length-2)}function ne(e,t,n=[]){if(e.tagName.toLowerCase()!==t.tag)return 0;let r=0,i=0,a=(e,t)=>{i+=e,r+=e*t};if(t.id&&a(3,+(e.id===t.id)),t.attrs)for(let[n,r]of Object.entries(t.attrs)){let t=e.getAttribute(n);a(n===`href`||n===`src`?1:2,t===r?1:t?M(t,r)*.5:0)}if(t.text!==void 0){let r=ee(e).slice(0,k);if(a(4,Math.max(M(r,t.text),...n.map(e=>M(r,j(e).slice(0,k))))),t.prefix||t.suffix){let n=e.parentElement?ee(e.parentElement):``,r=[t.prefix&&n.includes(t.prefix.slice(-12))?1:0,t.suffix&&n.includes(t.suffix.slice(0,12))?1:0];a(1,(r[0]+r[1])/(+!!t.prefix+ +!!t.suffix))}}if(t.classes?.length){let n=new Set(te(e));a(1,t.classes.filter(e=>n.has(e)).length/t.classes.length)}return i?r/i:1}function re(e,t,n={}){let r=n.root??document,i=n.isOwn??(()=>!1),a=[];try{a=[...r.querySelectorAll(e)].filter(e=>!i(e))}catch{}if(!t)return a[0]?{el:a[0],how:`selector`,score:1}:null;let o=null;for(let e of a.slice(0,50)){let r=ne(e,t,n.altTexts);r>=.35&&(!o||r>o.score)&&(o={el:e,how:`selector`,score:r})}if(o&&o.score>=.6)return o;let s=r.getElementsByTagName(t.tag),c=null;for(let e=0;e<s.length&&e<A;e++){let r=s[e];if(i(r))continue;let a=ne(r,t,n.altTexts);a>=.6&&(!c||a>c.score)&&(c={el:r,how:`fuzzy`,score:a})}return c&&(!o||c.score>o.score+.15)?c:o}var N=/^(css|sc|jsx|emotion|svelte|astro|data-v)-|[0-9a-f]{6,}|__[A-Za-z0-9]{5,}$|^_/;function P(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e.replace(/[^\w-]/g,e=>`\\${e}`)}function F(e){return[...e.classList].filter(e=>!N.test(e)&&e.length<40).slice(0,3)}function ie(e){let t=e.ownerDocument;if(e.id&&!/\d{3,}/.test(e.id)){let n=`#${P(e.id)}`;try{if(t.querySelectorAll(n).length===1)return n}catch{}}let n=[],r=e;for(let e=0;r&&r!==t.documentElement&&e<6;e++){let e=r.tagName.toLowerCase();if(r.id&&!/\d{3,}/.test(r.id)){n.unshift(`#${P(r.id)}`);break}let i=F(r);i.length&&(e+=i.map(e=>`.${P(e)}`).join(``));let a=r.parentElement;if(a){let t=[...a.children].filter(e=>e.tagName===r.tagName);t.length>1&&(e+=`:nth-of-type(${t.indexOf(r)+1})`)}n.unshift(e);let o=n.join(` > `);try{if(t.querySelectorAll(o).length===1)return o}catch{}r=a}return n.join(` > `)}function I(e,t){return e.length>t?e.slice(0,t-1)+`…`:e}var L=e=>e.replace(/\s+/g,` `).trim(),ae=/^[ \t\n\r\f]*$/;function R(e){let t=L(e.innerText??e.textContent??``),n=t.split(` `);if(n.length<4||n.filter(e=>[...e].length===1).length/n.length<.6)return t;let r=L(z(e));return r.replace(/\s/g,``)===t.replace(/\s/g,``)?r:t}function z(e){let t=``,n=e=>{let r=getComputedStyle(e).display,i=/flex|grid/.test(r);for(let r of e.childNodes)if(r.nodeType===Node.TEXT_NODE){let e=r.nodeValue??``;t+=ae.test(e)?i?``:` `:e}else if(r.nodeType===Node.ELEMENT_NODE){let e=getComputedStyle(r).display;if(e===`none`)continue;let a=!e.startsWith(`inline`)&&e!==`contents`&&!i;a&&(t+=` `),n(r),a&&(t+=` `)}};return n(e),t}function oe(e,t,n={}){let r=n.gap??12,i=n.margin??12,a=innerWidth,o=innerHeight,s=Math.min(e.offsetWidth||320,a-i*2),c=Math.min(e.offsetHeight||200,o-i*2),l=(n.avoid??[]).filter(e=>e.width>0&&e.height>0),u=e=>Math.min(Math.max(i,e),a-s-i),d=e=>Math.min(Math.max(i,e),o-c-i),f=(e,t)=>e>=i-.5&&t>=i-.5&&e+s<=a-i+.5&&t+c<=o-i+.5,p=(e,t)=>l.some(n=>e<n.right&&e+s>n.left&&t<n.bottom&&t+c>n.top),m=e=>[u(t.left),...l.flatMap(t=>e<t.bottom&&e+c>t.top?[u(t.right+r),u(t.left-r-s)]:[])],h=t.bottom+r,g=t.top-r-c,_=[[t.right+r,d(t.top)],[t.left-r-s,d(t.top)],...m(h).map(e=>[e,h]),...m(g).map(e=>[e,g])],v=_.find(([e,t])=>f(e,t)&&!p(e,t))??_.find(([e,t])=>f(e,t))??[u(t.left),d(o-t.bottom>t.top?h:g)];e.style.left=`${Math.round(v[0])}px`,e.style.top=`${Math.round(v[1])}px`}function se(e,t=[]){let n=0,r=()=>{n||=requestAnimationFrame(()=>(n=0,e()))};addEventListener(`scroll`,r,{capture:!0,passive:!0}),addEventListener(`resize`,r);let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;for(let e of t)i?.observe(e);return()=>{removeEventListener(`scroll`,r,{capture:!0}),removeEventListener(`resize`,r),i?.disconnect(),n&&cancelAnimationFrame(n),n=0}}function B(e){let t=e.cloneNode(!0),n=t.matches?.(`input[type=password]`)?[t]:[...t.querySelectorAll(`input[type=password]`)];for(let e of n)e.removeAttribute(`value`);return t.outerHTML}var V=[`display`,`position`,`color`,`background-color`,`font-family`,`font-size`,`font-weight`,`line-height`,`letter-spacing`,`text-align`,`padding`,`margin`,`gap`,`border`,`border-radius`,`box-shadow`,`width`,`height`,`flex-direction`,`justify-content`,`align-items`,`grid-template-columns`];function ce(e){let t=getComputedStyle(e),n={};for(let e of V){let r=t.getPropertyValue(e);r&&r!==`none`&&r!==`normal`&&r!==`auto`&&r!==`0px`&&r!==`rgba(0, 0, 0, 0)`&&(n[e]=r)}return{selector:ie(e),tagName:e.tagName,id:e.id||void 0,classes:[...e.classList],text:I(R(e),300),outerHTML:I(B(e),6e3),styles:n,url:location.href}}function le(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}var ue=50;function de(){let e=new Map,t=new Map,n=e=>{let n=(t.get(e)??0)+1;return t.set(e,n),n<=ue},r=(t,n,r)=>{let i={el:n,style:{},shown:{}};for(let[e,t]of Object.entries(r.style??{}))i.style[e]=[n.style.getPropertyValue(e),n.style.getPropertyPriority(e)],n.style.setProperty(e,t,`important`),i.shown[e]=n.style.getPropertyValue(e);if(r.text!==void 0&&(i.children=[...n.childNodes],n.textContent=r.text,i.applied=n.innerHTML),r.attrs){i.attrs={};let e=(e,t)=>{t!==void 0&&(i.attrs[e]=n.getAttribute(e),n.setAttribute(e,t))};r.attrs.src!==void 0&&(i.attrs.srcset=n.getAttribute(`srcset`),n.removeAttribute(`srcset`)),e(`src`,r.attrs.src),e(`alt`,r.attrs.alt)}e.set(t,i)},i=t=>{let n=e.get(t);if(n&&(e.delete(t),n.el.isConnected)){for(let[e,[t,r]]of Object.entries(n.style))t?n.el.style.setProperty(e,t,r):n.el.style.removeProperty(e);n.children&&n.el.replaceChildren(...n.children);for(let[e,t]of Object.entries(n.attrs??{}))t===null?n.el.removeAttribute(e):n.el.setAttribute(e,t)}};return{elOf(t){let n=e.get(t);return n?.el.isConnected?n.el:void 0},ensure(t,i,a){let o=e.get(t);if(!o||!o.el.isConnected){e.delete(t);let o=a();return o&&n(t)&&r(t,o,i),o}let s=o.el.style;for(let[e,r]of Object.entries(i.style??{}))(s.getPropertyValue(e)!==o.shown[e]||s.getPropertyPriority(e)!==`important`)&&n(t)&&(s.setProperty(e,r,`important`),o.shown[e]=s.getPropertyValue(e));o.applied!==void 0&&o.el.innerHTML!==o.applied&&n(t)&&(o.children=[...o.el.childNodes],o.el.textContent=i.text??``,o.applied=o.el.innerHTML);let c=i.attrs?.src;return c!==void 0&&(o.el.getAttribute(`src`)!==c||o.el.hasAttribute(`srcset`))&&n(t)&&(o.el.removeAttribute(`srcset`),o.el.setAttribute(`src`,c)),i.attrs?.alt!==void 0&&o.el.getAttribute(`alt`)!==i.attrs.alt&&n(t)&&o.el.setAttribute(`alt`,i.attrs.alt),o.el},revert:i,revertOn(t){for(let[n,r]of[...e].reverse())r.el===t&&i(n)},prune(n){for(let t of[...e.keys()].reverse())n(t)||i(t);for(let e of[...t.keys()])n(e)||t.delete(e)}}}var H=`display.position.color.background-color.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-align.text-decoration.text-decoration-line.padding.margin.border.border-top.border-right.border-bottom.border-left.border-radius.box-shadow.width.height.max-width.transform.list-style.list-style-type.opacity.white-space.gap`.split(`.`),fe=new Set([`normal`,`auto`,`0px`,`rgba(0, 0, 0, 0)`,`static`]),U=new Set([`list-style`,`list-style-type`,`text-decoration`,`text-decoration-line`]),W=48;function pe(e){if(e.tagName===`LI`||e.closest(`li`)){let t=e.closest(`ul, ol`);if(t instanceof HTMLElement)return t}return e}function me(e){let t=e.cloneNode(!0),n=[e,...e.querySelectorAll(`*`)].slice(0,W),r=[t,...t.querySelectorAll(`*`)];for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(!(t instanceof HTMLElement)||!(i instanceof HTMLElement))continue;let a=getComputedStyle(t),o=[];for(let e of H){let t=a.getPropertyValue(e);t&&!fe.has(t)&&(t!==`none`||U.has(e))&&o.push(`${e}: ${t}`)}t instanceof HTMLImageElement&&(t.currentSrc||t.src)&&(i.src=t.currentSrc||t.src),o.length&&i.setAttribute(`style`,o.join(`; `))}t.querySelectorAll(`script, iframe, object`).forEach(e=>e.remove());let i=t.outerHTML;return i.length>4e4?i.slice(0,4e4):i}var G={pick:`取点`,pickTip:`点选页面元素:引用到对话、评论或修改(Shift+点击直接引用,Esc 退出)`,pickTipReviewer:`点选页面元素来评论或修改(Esc 退出)`,pickBusy:`Agent 正在操作页面,暂不能取点`,artifacts:`产物`,chat:`对话`,eye:`候选`,eyeTip:`按住看原版,单击隐藏候选`,notReady:`面板加载中…`,brand:`Page Harness`,theme:`切换明暗`,collapse:`收起`,close:`关闭`,bannerOn:`Agent 可操作此页面`,bannerBusy:`Agent 正在操作…`,stop:`停止`,picked:`已加入对话`,pickedQueued:`已暂存,面板就绪后加入对话`,pickLimit:`最多暂存 20 个元素`,sessionDead:`与 Page Harness 的连接已断开,请检查终端`,review:`意见`,reviewTitle:`页面意见`,reviewEmpty:`还没有意见。`,showChanges:`显示修改`,exportMd:`导出`,clearAll:`清空`,clearConfirm:`再点一次确认清空`,sev_issue:`问题`,sev_suggestion:`建议`,sev_info:`说明`,kindPatch:`修改`,viewOriginal:`看原版`,viewChange:`看修改`,remove:`删除`,notFound:`页面上找不到这个元素`,reviewEmptyHere:`这个页面还没有意见,其他页面的在「全部」里。`,tabHere:`本页`,tabAll:`全部`,comment:`评论`,edit:`编辑`,commentPh:`这里有什么问题或建议?`,pickQuote:`引用到对话`,pickLive:`Live 候选`,approveLabel:`本页结论`,reviewHow:`点底栏「取点」,选中元素后点「评论」。`,reviewHowEdit:`点底栏「取点」,选中元素后点「评论」或「编辑」。`,editSourceOnly:`有源码时请让 Agent 直接改代码;页面编辑只在评审模式可用`,save:`保存`,reply:`回复`,replyPh:`回复…(Enter 发送)`,replies:`{n} 条回复`,resolve:`标记解决`,reopen:`重新打开`,resolved:`已解决`,approve:`通过`,requestChanges:`需修改`,approvedBy:`✓ {name} 通过`,changesBy:`✎ {name} 需修改`,detached:`页面上找不到了`,goPage:`去`,fieldText:`文字`,fieldColor:`文字颜色`,fieldBg:`背景`,fieldSize:`字号 px`,fieldWeight:`字重`,fieldPadding:`内边距`,fieldRadius:`圆角`,fieldImage:`图片地址`,fieldNote:`说明(可选):为什么这么改`,textLocked:`这个元素里还有子元素,不能直接改文字;想改文字请选更里层的元素。`,noChanges:`还没有任何修改`,needName:`先在面板里填写你的名字`,newFrom:`{name} 添加了 #{n}`,reviewer:`评审`,modeSelect:`选元素`,modeInsert:`插入区块`,steerPlaceholder:`或描述整页要怎么改…`,steerGo:`生成`,quote:`引用`,designTitle:`设计候选`,promptPlaceholder:`补充说明(可选)`,insertPlaceholder:`描述要插入的区块…`,before:`之前`,after:`之后`,count:`数量`,display:`展示`,inplace:`原位切换`,compare:`并排对比`,marks:`批注`,draw:`圈画`,pin:`定位`,undo:`撤销`,clear:`清空`,notePlaceholder:`这里要怎么改?`,noteEmpty:`意见不能为空`,generate:`生成候选`,cancel:`取消`,original:`原版`,accept:`采用`,discard:`放弃`,retry:`重试`,retryAccept:`重试并采用`,refinePlaceholder:`细化当前候选…`,reload:`重新加载`,tellAgent:`告诉 Agent`,notMounted:`候选没有出现在页面上`,otherRoute:`候选在另一个页面`,goThere:`跳过去`,params:`参数`,status_generating:`生成中`,status_refining:`细化中`,status_accepting:`采用中`,status_discarding:`放弃中`,status_ready:`可挑选`,status_failed:`失败`,status_accepted:`已采用`,status_discarded:`已放弃`,maxMarks:`最多 8 处批注`,blockedNested:`这里已有候选,请先采用或放弃`,actions:{bolder:`加粗`,quieter:`减弱`,polish:`润色`,typeset:`排版`,colorize:`配色`,layout:`布局`,distill:`精简`,adapt:`适配`,animate:`动效`,delight:`惊喜`,overdrive:`大胆`,freeform:`自由`}},he={pick:`Pick`,pickTip:`Click an element to quote it in the chat, comment on it or change it (Shift+click quotes directly, Esc exits)`,pickTipReviewer:`Click an element to comment on it or change it (Esc exits)`,pickBusy:`The agent is operating the page`,artifacts:`Artifacts`,chat:`Chat`,eye:`Candidates`,eyeTip:`Hold to see the original, click to hide candidates`,notReady:`Panel is loading…`,brand:`Page Harness`,theme:`Toggle theme`,collapse:`Collapse`,close:`Close`,bannerOn:`The agent can operate this page`,bannerBusy:`The agent is operating…`,stop:`Stop`,picked:`Added to chat`,pickedQueued:`Saved; it will be added when the panel is ready`,pickLimit:`Up to 20 elements can be queued`,sessionDead:`Lost connection to Page Harness; check the terminal`,review:`Notes`,reviewTitle:`Page notes`,reviewEmpty:`No notes yet.`,showChanges:`Show changes`,exportMd:`Export`,clearAll:`Clear`,clearConfirm:`Click again to clear all`,sev_issue:`Issue`,sev_suggestion:`Suggestion`,sev_info:`Info`,kindPatch:`Change`,viewOriginal:`Original`,viewChange:`Changed`,remove:`Remove`,notFound:`This element is not on the page`,reviewEmptyHere:`No notes on this page yet; other pages are under All.`,tabHere:`This page`,tabAll:`All`,comment:`Comment`,edit:`Edit`,commentPh:`What is wrong here, or what would you suggest?`,pickQuote:`Quote in chat`,pickLive:`Live candidates`,approveLabel:`This page`,reviewHow:`Click Pick in the dock, choose an element, then Comment.`,reviewHowEdit:`Click Pick in the dock, choose an element, then Comment or Edit.`,editSourceOnly:`With source, ask the agent to change the code; page edits are for review mode`,save:`Save`,reply:`Reply`,replyPh:`Reply… (Enter to send)`,replies:`{n} replies`,resolve:`Resolve`,reopen:`Reopen`,resolved:`Resolved`,approve:`Approve`,requestChanges:`Request changes`,approvedBy:`✓ {name} approved`,changesBy:`✎ {name} requested changes`,detached:`not found on the page`,goPage:`Go to`,fieldText:`Text`,fieldColor:`Text color`,fieldBg:`Background`,fieldSize:`Size px`,fieldWeight:`Weight`,fieldPadding:`Padding`,fieldRadius:`Radius`,fieldImage:`Image URL`,fieldNote:`Why (optional)`,textLocked:`This element contains other elements, so its text cannot be edited here; pick an inner element.`,noChanges:`Nothing changed yet`,needName:`Enter your name in the panel first`,newFrom:`{name} added #{n}`,reviewer:`Review`,modeSelect:`Select`,modeInsert:`Insert block`,steerPlaceholder:`Or describe a page-wide change…`,steerGo:`Generate`,quote:`Quote`,designTitle:`Design candidates`,promptPlaceholder:`Extra instructions (optional)`,insertPlaceholder:`Describe the block to insert…`,before:`Before`,after:`After`,count:`Count`,display:`Display`,inplace:`In place`,compare:`Side by side`,marks:`Marks`,draw:`Circle`,pin:`Pin`,undo:`Undo`,clear:`Clear`,notePlaceholder:`What should change here?`,noteEmpty:`A note needs text`,generate:`Generate`,cancel:`Cancel`,original:`Original`,accept:`Accept`,discard:`Discard`,retry:`Retry`,retryAccept:`Retry & accept`,refinePlaceholder:`Refine this candidate…`,reload:`Reload`,tellAgent:`Tell the agent`,notMounted:`The candidates did not appear on the page`,otherRoute:`The candidates are on another page`,goThere:`Go there`,params:`Tune`,status_generating:`Generating`,status_refining:`Refining`,status_accepting:`Accepting`,status_discarding:`Discarding`,status_ready:`Ready`,status_failed:`Failed`,status_accepted:`Accepted`,status_discarded:`Discarded`,maxMarks:`Up to 8 marks`,blockedNested:`There are candidates here already; accept or discard them first`,actions:{bolder:`Bolder`,quieter:`Quieter`,polish:`Polish`,typeset:`Typeset`,colorize:`Colorize`,layout:`Layout`,distill:`Distill`,adapt:`Adapt`,animate:`Animate`,delight:`Delight`,overdrive:`Overdrive`,freeform:`Freeform`}};function ge(e){return e===`en`?he:G}var _e=`
1
+ (function(){var e=[`bolder`,`quieter`,`polish`,`typeset`,`colorize`,`layout`,`distill`,`adapt`,`animate`,`delight`,`overdrive`,`freeform`],t=/^(padding|margin)(-|$)/;function n(e){return e.trim().replace(/\s+/g,` `)}function r(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function i(e){return/(?:^|[\s>+~])(?:ul|ol)(?![a-z-])/i.test(e)}function a(e){let t=n(e),r=t.match(/^(.*?)\s*(?:>\s*)?li(?![a-z-])/i);return r&&i(r[1])?n(r[1]):i(t)&&!/(?:^|[\s>+~])li(?![a-z-])/i.test(t)?t:null}function o(e,t){let r=n(e),i=n(t);if(!r||r===i||!i.startsWith(r))return!1;let a=i.charAt(r.length);return a===` `||a===`>`||a===`+`||a===`~`}function s(e){if(e.kind!==`patch`||!e.patch||e.patch.text!==void 0||e.patch.attrs)return!1;let n=Object.keys(e.patch.style??{});return n.length>0&&n.every(e=>t.test(e))}function c(e){if(e?.style)return Object.entries(e.style).map(([e,t])=>`${e}: ${t}`).join(`; `)||void 0}function l(e){let t={selector:e.selector},n=c(e.patch);return n&&(t.css=n),e.patch?.text!==void 0&&(t.text=e.anchor?.text?`${e.anchor.text} → ${e.patch.text}`:e.patch.text),e.patch?.attrs?.src&&(t.image=e.patch.attrs.src.startsWith(`data:`)?`(uploaded image)`:e.patch.attrs.src),t}function u(e){return e.patch?.style??{}}function d(e){let t=e.anchor?.text?.trim();if(t)return`「${r(t,42)}」这一块`;let n=(e.anchor?.tag||``).toLowerCase();if(n===`img`||/(?:^|[\s>+~])img(?![a-z-])/i.test(e.selector))return`这张照片`;if(/^h[1-6]$/.test(n)||/(?:^|[\s>+~])h[1-6](?![a-z-])/i.test(e.selector))return`这个标题`;let i=e.label?.replace(/^[a-z0-9-]+\s*/i,``).replace(/^"|"$/g,``).trim();return i?`「${r(i,42)}」这一块`:`页面上标出的这一块`}function f(e){return(e.anchor?.tag||``).toLowerCase()===`img`||/(?:^|[\s>+~])img(?![a-z-])/i.test(e.selector)||!!e.patch?.attrs?.src}function p(e){return/^h[1-6]$/i.test(e.anchor?.tag||``)||/(?:^|[\s>+~])h[1-6](?![a-z-])/i.test(e.selector)}function m(e){let t=e.map(e=>`${e.anchor?.text??``} ${e.label??``} ${e.note??``}`).join(` `);return/书目|书单|bibliography|\bC\+\+|Tour of|Programming:/i.test(t)}function h(e){let t=u(e),n=Object.values(t).join(` `),r=/#fff\b|#ffffff|white|rgb\(\s*255\s*,\s*255\s*,\s*255/i.test(n),i=!!(t.border||t[`border-width`]||t[`border-style`]||t[`border-color`]),a=/rotate\(\s*(-?[\d.]+)\s*deg/i.exec(t.transform||n),o=a?Number(a[1]):0,s=!!t[`box-shadow`],c=[];i&&c.push(r?`加上一圈白边`:`加上了边框`),a&&o<-.2?c.push(`微微向左倾斜`):a&&o>.2&&c.push(`微微向右倾斜`),s&&c.push(`底下多了一层阴影`);let l=r&&i&&!!a&&s,d=c.length?`这张照片${c.join(`,`)}${l?`,看起来像一张放在桌上的拍立得`:``}。`:`这张照片的外观改了,改前和改后的样子在下面。`,f=`照片的外观改了`;return l?f=`照片改成斜放的拍立得`:r&&i&&a?f=`照片加上白边并斜放`:c[0]&&(f=`照片${c[0]}`),{title:f,say:d}}function g(e){let t=e.anchor?.text?.trim(),n=e.patch?.text?.trim(),i=u(e)[`font-style`]===`italic`,a=!!t?.endsWith(`!`)&&!!n&&!n.endsWith(`!`),o=p(e)?`标题`:`这段文字`,s=[];return t&&n&&t!==n?s.push(`从「${r(t,80)}」改成了「${r(n,80)}」`):n&&s.push(`改成了「${r(n,80)}」`),i&&s.push(s.length?`并改成斜体`:`改成了斜体`),a&&s.push(`感叹号去掉了`),s.length?{title:i&&a?`${o}改成斜体,并去掉感叹号`:i?`${o}改成斜体`:a?`${o}去掉感叹号`:o===`标题`?`标题文字改了`:`这段文字改了`,say:`${o}${s.join(`,`)}。`}:x(e)}var _=[`零`,`一`,`两`,`三`,`四`,`五`,`六`,`七`,`八`,`九`,`十`],v=e=>e>=1&&e<=10?_[e]:String(e);function y(e){if(!e)return NaN;let t=parseFloat(e);return Number.isFinite(t)?t:NaN}function b(e){let t=m(e)?`书目`:`列表`,r=e.map(e=>{let t=Number(/nth-(?:child|of-type)\((\d+)\)/i.exec(e.selector)?.[1]??NaN),n=u(e);return{n:t,px:y(n[`font-size`]),border:!!(n[`border-bottom`]||n[`border-bottom-width`]),bold:Number(n[`font-weight`])>=600||/bold/i.test(n[`font-weight`]||``)}}).filter(e=>!Number.isNaN(e.n)&&!Number.isNaN(e.px)).sort((e,t)=>e.n-t.n),i=+!!r.length;for(let e=1;e<r.length&&r[e].px<r[e-1].px-.5;e++)i=e+1;let o=r.find(e=>e.border),s=o?r.indexOf(o)+1:i,c=r.slice(s).some(e=>e.bold),l=e.find(e=>a(e.selector)===n(e.selector)),d=[`整段${t}${/none/i.test(u(l??e[0])[`list-style`]||u(l??e[0])[`list-style-type`]||``)?`不再是同一号字的圆点列表`:`的字号层次改了`}`];return s>=2&&d.push(`前${v(s)}项由大到小排开`),o&&d.push(`第${v(o.n)}项下面加了一条线`),c&&d.push(`后面的项改成同一号的加粗字`),{title:s>=2?`${t}改成由大到小的字号阶梯`:`${t}的外观改了`,say:`${d.join(`,`)}。`}}function x(e){let t=u(e),n=[];t[`font-style`]===`italic`&&n.push(`改成了斜体`),(Number(t[`font-weight`])>=600||/bold/i.test(t[`font-weight`]||``))&&n.push(`改成了粗体`),t[`font-size`]&&n.push(`字号改成 ${t[`font-size`].replace(`px`,` 像素`)}`),t[`font-family`]&&n.push(`换了一套字体`),t.color&&n.push(`文字颜色改了`),(t[`background-color`]||t.background)&&n.push(`背景改了`),t[`border-radius`]&&n.push(`圆角改了`),(t.border||t[`border-color`])&&n.push(`边框改了`),(t[`text-decoration`]||t[`text-decoration-line`])&&n.push(`文字装饰改了`),t.opacity&&n.push(`透明度改了`);let r=d(e);return n.length?{title:`这一块的外观改了`,say:`${r}${n.join(`,`)}。`}:{title:`这一块的外观改了`,say:`${r}的外观改了,差别看下面的改前和改后。`}}function S(e){let t=e.note.trim();return{title:r(t.split(/[。.!!?\n]/)[0]?.trim()||`文字意见`,36),say:t,where:`关于${d(e)}`}}function C(e,t){if(t)return b(e);let n=e[0];return!n||n.kind===`note`?S(n):n.patch?.text===void 0?f(n)?h(n):x(n):g(n)}function w(e,t,r){let i=r?a(e[0].selector):null,o=r?e.find(e=>n(e.selector)===i)??[...e].sort((e,t)=>e.selector.length-t.selector.length||e.n-t.n)[0]:e[0],s=C(e,r),c=[...e].sort((e,t)=>e.n-t.n),u=[...c,...t].map(l);return{id:o.id,n:o.n,kind:o.kind,path:o.path,primary:o,members:c,extras:t,title:s.title,say:s.say,...s.where?{where:s.where}:{},status:e.every(e=>e.status===`resolved`)?`resolved`:`open`,authorName:o.author?.name||``,lines:u}}function T(e){let t=new Map;for(let n of e){let e=a(n.selector);if(!e)continue;let r=e;t.set(r,[...t.get(r)??[],n])}return[...t.values()].filter(e=>e.length>=2)}function E(e){let t=[...new Set(e.map(e=>e.path))],n=[];for(let r of t){let t=e.filter(e=>e.path===r),i=t.filter(e=>e.kind!==`patch`||!e.patch),a=t.filter(e=>e.kind===`patch`&&e.patch),c=T(a),l=new Set(c.flat().map(e=>e.id)),u=a.filter(e=>!l.has(e.id)),d=new Set(u.filter(e=>s(e)&&u.some(t=>t!==e&&o(e.selector,t.selector))||s(e)&&c.some(t=>t.some(t=>o(e.selector,t.selector)))).map(e=>e.id)),f=u.filter(e=>d.has(e.id)),p=u.filter(e=>!d.has(e.id)),m=[...i.map(e=>w([e],[],!1)),...c.map(e=>w(e,f.filter(t=>e.some(e=>o(t.selector,e.selector))),!0)),...p.map(e=>w([e],f.filter(t=>o(t.selector,e.selector)),!1))];n.push(...m)}return n.sort((e,t)=>Number(e.status===`resolved`)-Number(t.status===`resolved`)||e.n-t.n)}function D(e){return E(e.map((e,t)=>({id:`tmp_${t}`,n:t+1,kind:`patch`,path:`/`,selector:e.selector,note:``,patch:e.patch,author:{id:`tmp`,name:`tmp`,kind:`human`},status:`open`,replies:[],createdAt:0,host:``}))).map(e=>e.primary.selector)}var O=/^(css|sc|jsx|emotion|svelte|astro|data-v)-|[0-9a-f]{6,}|__[A-Za-z0-9]{5,}$|^_/,k=80,A=4e3,j=e=>e.replace(/\s+/g,` `).trim(),ee=e=>j(e.textContent??``);function te(e){return[...e.classList].filter(e=>!O.test(e)&&e.length<40).slice(0,6)}function M(e,t){if(e===t)return 1;if(!e||!t||e.length<2||t.length<2)return 0;let n=new Map;for(let t=0;t<e.length-1;t++){let r=e.slice(t,t+2);n.set(r,(n.get(r)??0)+1)}let r=0;for(let e=0;e<t.length-1;e++){let i=t.slice(e,e+2),a=n.get(i)??0;a>0&&(n.set(i,a-1),r++)}return 2*r/(e.length+t.length-2)}function ne(e,t,n=[]){if(e.tagName.toLowerCase()!==t.tag)return 0;let r=0,i=0,a=(e,t)=>{i+=e,r+=e*t};if(t.id&&a(3,+(e.id===t.id)),t.attrs)for(let[n,r]of Object.entries(t.attrs)){let t=e.getAttribute(n);a(n===`href`||n===`src`?1:2,t===r?1:t?M(t,r)*.5:0)}if(t.text!==void 0){let r=ee(e).slice(0,k);if(a(4,Math.max(M(r,t.text),...n.map(e=>M(r,j(e).slice(0,k))))),t.prefix||t.suffix){let n=e.parentElement?ee(e.parentElement):``,r=[t.prefix&&n.includes(t.prefix.slice(-12))?1:0,t.suffix&&n.includes(t.suffix.slice(0,12))?1:0];a(1,(r[0]+r[1])/(+!!t.prefix+ +!!t.suffix))}}if(t.classes?.length){let n=new Set(te(e));a(1,t.classes.filter(e=>n.has(e)).length/t.classes.length)}return i?r/i:1}function re(e,t,n={}){let r=n.root??document,i=n.isOwn??(()=>!1),a=[];try{a=[...r.querySelectorAll(e)].filter(e=>!i(e))}catch{}if(!t)return a[0]?{el:a[0],how:`selector`,score:1}:null;let o=null;for(let e of a.slice(0,50)){let r=ne(e,t,n.altTexts);r>=.35&&(!o||r>o.score)&&(o={el:e,how:`selector`,score:r})}if(o&&o.score>=.6)return o;let s=r.getElementsByTagName(t.tag),c=null;for(let e=0;e<s.length&&e<A;e++){let r=s[e];if(i(r))continue;let a=ne(r,t,n.altTexts);a>=.6&&(!c||a>c.score)&&(c={el:r,how:`fuzzy`,score:a})}return c&&(!o||c.score>o.score+.15)?c:o}var N=/^(css|sc|jsx|emotion|svelte|astro|data-v)-|[0-9a-f]{6,}|__[A-Za-z0-9]{5,}$|^_/;function P(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e.replace(/[^\w-]/g,e=>`\\${e}`)}function F(e){return[...e.classList].filter(e=>!N.test(e)&&e.length<40).slice(0,3)}function ie(e){let t=e.ownerDocument;if(e.id&&!/\d{3,}/.test(e.id)){let n=`#${P(e.id)}`;try{if(t.querySelectorAll(n).length===1)return n}catch{}}let n=[],r=e;for(let e=0;r&&r!==t.documentElement&&e<6;e++){let e=r.tagName.toLowerCase();if(r.id&&!/\d{3,}/.test(r.id)){n.unshift(`#${P(r.id)}`);break}let i=F(r);i.length&&(e+=i.map(e=>`.${P(e)}`).join(``));let a=r.parentElement;if(a){let t=[...a.children].filter(e=>e.tagName===r.tagName);t.length>1&&(e+=`:nth-of-type(${t.indexOf(r)+1})`)}n.unshift(e);let o=n.join(` > `);try{if(t.querySelectorAll(o).length===1)return o}catch{}r=a}return n.join(` > `)}function I(e,t){return e.length>t?e.slice(0,t-1)+`…`:e}var L=e=>e.replace(/\s+/g,` `).trim(),ae=/^[ \t\n\r\f]*$/;function R(e){let t=L(e.innerText??e.textContent??``),n=t.split(` `);if(n.length<4||n.filter(e=>[...e].length===1).length/n.length<.6)return t;let r=L(z(e));return r.replace(/\s/g,``)===t.replace(/\s/g,``)?r:t}function z(e){let t=``,n=e=>{let r=getComputedStyle(e).display,i=/flex|grid/.test(r);for(let r of e.childNodes)if(r.nodeType===Node.TEXT_NODE){let e=r.nodeValue??``;t+=ae.test(e)?i?``:` `:e}else if(r.nodeType===Node.ELEMENT_NODE){let e=getComputedStyle(r).display;if(e===`none`)continue;let a=!e.startsWith(`inline`)&&e!==`contents`&&!i;a&&(t+=` `),n(r),a&&(t+=` `)}};return n(e),t}function oe(e,t,n={}){let r=n.gap??12,i=n.margin??12,a=innerWidth,o=innerHeight,s=Math.min(e.offsetWidth||320,a-i*2),c=Math.min(e.offsetHeight||200,o-i*2),l=(n.avoid??[]).filter(e=>e.width>0&&e.height>0),u=e=>Math.min(Math.max(i,e),a-s-i),d=e=>Math.min(Math.max(i,e),o-c-i),f=(e,t)=>e>=i-.5&&t>=i-.5&&e+s<=a-i+.5&&t+c<=o-i+.5,p=(e,t)=>l.some(n=>e<n.right&&e+s>n.left&&t<n.bottom&&t+c>n.top),m=e=>[u(t.left),...l.flatMap(t=>e<t.bottom&&e+c>t.top?[u(t.right+r),u(t.left-r-s)]:[])],h=t.bottom+r,g=t.top-r-c,_=[[t.right+r,d(t.top)],[t.left-r-s,d(t.top)],...m(h).map(e=>[e,h]),...m(g).map(e=>[e,g])],v=_.find(([e,t])=>f(e,t)&&!p(e,t))??_.find(([e,t])=>f(e,t))??[u(t.left),d(o-t.bottom>t.top?h:g)];e.style.left=`${Math.round(v[0])}px`,e.style.top=`${Math.round(v[1])}px`}function se(e,t=[]){let n=0,r=()=>{n||=requestAnimationFrame(()=>(n=0,e()))};addEventListener(`scroll`,r,{capture:!0,passive:!0}),addEventListener(`resize`,r);let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;for(let e of t)i?.observe(e);return()=>{removeEventListener(`scroll`,r,{capture:!0}),removeEventListener(`resize`,r),i?.disconnect(),n&&cancelAnimationFrame(n),n=0}}function B(e){let t=e.cloneNode(!0),n=t.matches?.(`input[type=password]`)?[t]:[...t.querySelectorAll(`input[type=password]`)];for(let e of n)e.removeAttribute(`value`);return t.outerHTML}var V=[`display`,`position`,`color`,`background-color`,`font-family`,`font-size`,`font-weight`,`line-height`,`letter-spacing`,`text-align`,`padding`,`margin`,`gap`,`border`,`border-radius`,`box-shadow`,`width`,`height`,`flex-direction`,`justify-content`,`align-items`,`grid-template-columns`];function ce(e){let t=getComputedStyle(e),n={};for(let e of V){let r=t.getPropertyValue(e);r&&r!==`none`&&r!==`normal`&&r!==`auto`&&r!==`0px`&&r!==`rgba(0, 0, 0, 0)`&&(n[e]=r)}return{selector:ie(e),tagName:e.tagName,id:e.id||void 0,classes:[...e.classList],text:I(R(e),300),outerHTML:I(B(e),6e3),styles:n,url:location.href}}function le(){return matchMedia(`(prefers-reduced-motion: reduce)`).matches}var ue=50;function de(){let e=new Map,t=new Map,n=e=>{let n=(t.get(e)??0)+1;return t.set(e,n),n<=ue},r=(t,n,r)=>{let i={el:n,style:{},shown:{}};for(let[e,t]of Object.entries(r.style??{}))i.style[e]=[n.style.getPropertyValue(e),n.style.getPropertyPriority(e)],n.style.setProperty(e,t,`important`),i.shown[e]=n.style.getPropertyValue(e);if(r.text!==void 0&&(i.children=[...n.childNodes],n.textContent=r.text,i.applied=n.innerHTML),r.attrs){i.attrs={};let e=(e,t)=>{t!==void 0&&(i.attrs[e]=n.getAttribute(e),n.setAttribute(e,t))};r.attrs.src!==void 0&&(i.attrs.srcset=n.getAttribute(`srcset`),n.removeAttribute(`srcset`)),e(`src`,r.attrs.src),e(`alt`,r.attrs.alt)}e.set(t,i)},i=t=>{let n=e.get(t);if(n&&(e.delete(t),n.el.isConnected)){for(let[e,[t,r]]of Object.entries(n.style))t?n.el.style.setProperty(e,t,r):n.el.style.removeProperty(e);n.children&&n.el.replaceChildren(...n.children);for(let[e,t]of Object.entries(n.attrs??{}))t===null?n.el.removeAttribute(e):n.el.setAttribute(e,t)}};return{elOf(t){let n=e.get(t);return n?.el.isConnected?n.el:void 0},ensure(t,i,a){let o=e.get(t);if(!o||!o.el.isConnected){e.delete(t);let o=a();return o&&n(t)&&r(t,o,i),o}let s=o.el.style;for(let[e,r]of Object.entries(i.style??{}))(s.getPropertyValue(e)!==o.shown[e]||s.getPropertyPriority(e)!==`important`)&&n(t)&&(s.setProperty(e,r,`important`),o.shown[e]=s.getPropertyValue(e));o.applied!==void 0&&o.el.innerHTML!==o.applied&&n(t)&&(o.children=[...o.el.childNodes],o.el.textContent=i.text??``,o.applied=o.el.innerHTML);let c=i.attrs?.src;return c!==void 0&&(o.el.getAttribute(`src`)!==c||o.el.hasAttribute(`srcset`))&&n(t)&&(o.el.removeAttribute(`srcset`),o.el.setAttribute(`src`,c)),i.attrs?.alt!==void 0&&o.el.getAttribute(`alt`)!==i.attrs.alt&&n(t)&&o.el.setAttribute(`alt`,i.attrs.alt),o.el},revert:i,revertOn(t){for(let[n,r]of[...e].reverse())r.el===t&&i(n)},prune(n){for(let t of[...e.keys()].reverse())n(t)||i(t);for(let e of[...t.keys()])n(e)||t.delete(e)}}}var H=`display.position.color.background-color.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-align.text-decoration.text-decoration-line.padding.margin.border.border-top.border-right.border-bottom.border-left.border-radius.box-shadow.width.height.max-width.transform.list-style.list-style-type.opacity.white-space.gap`.split(`.`),fe=new Set([`normal`,`auto`,`0px`,`rgba(0, 0, 0, 0)`,`static`]),U=new Set([`list-style`,`list-style-type`,`text-decoration`,`text-decoration-line`]),W=48;function pe(e){if(e.tagName===`LI`||e.closest(`li`)){let t=e.closest(`ul, ol`);if(t instanceof HTMLElement)return t}return e}function me(e){let t=e.cloneNode(!0),n=[e,...e.querySelectorAll(`*`)].slice(0,W),r=[t,...t.querySelectorAll(`*`)];for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(!(t instanceof HTMLElement)||!(i instanceof HTMLElement))continue;let a=getComputedStyle(t),o=[];for(let e of H){let t=a.getPropertyValue(e);t&&!fe.has(t)&&(t!==`none`||U.has(e))&&o.push(`${e}: ${t}`)}t instanceof HTMLImageElement&&(t.currentSrc||t.src)&&(i.src=t.currentSrc||t.src),o.length&&i.setAttribute(`style`,o.join(`; `))}t.querySelectorAll(`script, iframe, object`).forEach(e=>e.remove());let i=t.outerHTML;return i.length>4e4?i.slice(0,4e4):i}var G={pick:`取点`,pickTip:`点选页面元素:引用到对话、评论或修改(Shift+点击直接引用,Esc 退出)`,pickTipReviewer:`点选页面元素来评论或修改(Esc 退出)`,pickBusy:`Agent 正在操作页面,暂不能取点`,artifacts:`产物`,chat:`对话`,eye:`候选`,eyeTip:`按住看原版,单击隐藏候选`,notReady:`面板加载中…`,brand:`Page Harness`,theme:`切换明暗`,collapse:`收起`,close:`关闭`,bannerOn:`Agent 可操作此页面`,bannerBusy:`Agent 正在操作…`,stop:`停止`,picked:`已加入对话`,pickedQueued:`已暂存,面板就绪后加入对话`,pickLimit:`最多暂存 20 个元素`,sessionDead:`与 Page Harness 的连接已断开,请检查终端`,review:`意见`,reviewOnly:`仅评审`,reviewOffline:`连不上本机 page-harness。HTTPS 页面访问 http://127.0.0.1 常被浏览器拦截,请看主页说明。`,reviewTitle:`页面意见`,reviewEmpty:`还没有意见。`,showChanges:`显示修改`,exportMd:`导出`,copyPrompt:`复制 Prompt`,copyPromptTip:`复制一段说明,让本机 Agent 分页拉完未处理意见并逐条标记`,promptCopied:`✓ 已复制`,copyFailed:`复制失败,请检查浏览器的剪贴板权限`,clearAll:`清空`,clearConfirm:`再点一次确认清空`,sev_issue:`问题`,sev_suggestion:`建议`,sev_info:`说明`,kindPatch:`修改`,viewOriginal:`看原版`,viewChange:`看修改`,remove:`删除`,notFound:`页面上找不到这个元素`,reviewEmptyHere:`这个页面还没有意见,其他页面的在「全部」里。`,tabHere:`本页`,tabAll:`全部`,comment:`评论`,edit:`编辑`,commentPh:`这里有什么问题或建议?`,pickQuote:`引用到对话`,pickLive:`在线生成`,approveLabel:`本页结论`,reviewHow:`点底栏「取点」,选中元素后点「评论」。`,reviewHowEdit:`点底栏「取点」,选中元素后点「评论」或「编辑」。`,editSourceOnly:`有源码时请让 Agent 直接改代码;页面编辑只在评审模式可用`,save:`保存`,reply:`回复`,replyPh:`回复…(Enter 发送)`,replies:`{n} 条回复`,resolve:`标记解决`,reopen:`重新打开`,resolved:`已解决`,approve:`通过`,requestChanges:`需修改`,approvedBy:`✓ {name} 通过`,changesBy:`✎ {name} 需修改`,detached:`页面上找不到了`,goPage:`去`,fieldText:`文字`,fieldColor:`文字颜色`,fieldBg:`背景`,fieldSize:`字号 px`,fieldWeight:`字重`,fieldPadding:`内边距`,fieldRadius:`圆角`,fieldImage:`图片地址`,fieldNote:`说明(可选):为什么这么改`,textLocked:`这个元素里还有子元素,不能直接改文字;想改文字请选更里层的元素。`,noChanges:`还没有任何修改`,needName:`先在面板里填写你的名字`,newFrom:`{name} 添加了 #{n}`,reviewer:`评审`,modeSelect:`选元素`,modeInsert:`插入区块`,steerPlaceholder:`或描述整页要怎么改…`,steerGo:`生成`,quote:`引用`,designTitle:`设计候选`,promptPlaceholder:`补充说明(可选)`,insertPlaceholder:`描述要插入的区块…`,before:`之前`,after:`之后`,count:`数量`,display:`展示`,inplace:`原位切换`,compare:`并排对比`,marks:`批注`,draw:`圈画`,pin:`定位`,undo:`撤销`,clear:`清空`,notePlaceholder:`这里要怎么改?`,noteEmpty:`意见不能为空`,generate:`生成候选`,cancel:`取消`,original:`原版`,accept:`采用`,discard:`放弃`,retry:`重试`,retryAccept:`重试并采用`,refinePlaceholder:`细化当前候选…`,reload:`重新加载`,tellAgent:`告诉 Agent`,notMounted:`候选没有出现在页面上`,otherRoute:`候选在另一个页面`,goThere:`跳过去`,params:`参数`,status_generating:`生成中`,status_refining:`细化中`,status_accepting:`采用中`,status_discarding:`放弃中`,status_ready:`可挑选`,status_failed:`失败`,status_accepted:`已采用`,status_discarded:`已放弃`,maxMarks:`最多 8 处批注`,blockedNested:`这里已有候选,请先采用或放弃`,actions:{bolder:`加粗`,quieter:`减弱`,polish:`润色`,typeset:`排版`,colorize:`配色`,layout:`布局`,distill:`精简`,adapt:`适配`,animate:`动效`,delight:`惊喜`,overdrive:`大胆`,freeform:`自由`}},he={pick:`Pick`,pickTip:`Click an element to quote it in the chat, comment on it or change it (Shift+click quotes directly, Esc exits)`,pickTipReviewer:`Click an element to comment on it or change it (Esc exits)`,pickBusy:`The agent is operating the page`,artifacts:`Artifacts`,chat:`Chat`,eye:`Candidates`,eyeTip:`Hold to see the original, click to hide candidates`,notReady:`Panel is loading…`,brand:`Page Harness`,theme:`Toggle theme`,collapse:`Collapse`,close:`Close`,bannerOn:`The agent can operate this page`,bannerBusy:`The agent is operating…`,stop:`Stop`,picked:`Added to chat`,pickedQueued:`Saved; it will be added when the panel is ready`,pickLimit:`Up to 20 elements can be queued`,sessionDead:`Lost connection to Page Harness; check the terminal`,review:`Notes`,reviewOnly:`Review only`,reviewOffline:`Cannot reach page-harness on this machine. HTTPS pages often block http://127.0.0.1. See the home page for what works.`,reviewTitle:`Page notes`,reviewEmpty:`No notes yet.`,showChanges:`Show changes`,exportMd:`Export`,copyPrompt:`Copy prompt`,copyPromptTip:`Copy instructions that tell a local agent to page through open notes and mark each one`,promptCopied:`✓ Copied`,copyFailed:`Copy failed; check the clipboard permission`,clearAll:`Clear`,clearConfirm:`Click again to clear all`,sev_issue:`Issue`,sev_suggestion:`Suggestion`,sev_info:`Info`,kindPatch:`Change`,viewOriginal:`Original`,viewChange:`Changed`,remove:`Remove`,notFound:`This element is not on the page`,reviewEmptyHere:`No notes on this page yet; other pages are under All.`,tabHere:`This page`,tabAll:`All`,comment:`Comment`,edit:`Edit`,commentPh:`What is wrong here, or what would you suggest?`,pickQuote:`Quote in chat`,pickLive:`Live candidates`,approveLabel:`This page`,reviewHow:`Click Pick in the dock, choose an element, then Comment.`,reviewHowEdit:`Click Pick in the dock, choose an element, then Comment or Edit.`,editSourceOnly:`With source, ask the agent to change the code; page edits are for review mode`,save:`Save`,reply:`Reply`,replyPh:`Reply… (Enter to send)`,replies:`{n} replies`,resolve:`Resolve`,reopen:`Reopen`,resolved:`Resolved`,approve:`Approve`,requestChanges:`Request changes`,approvedBy:`✓ {name} approved`,changesBy:`✎ {name} requested changes`,detached:`not found on the page`,goPage:`Go to`,fieldText:`Text`,fieldColor:`Text color`,fieldBg:`Background`,fieldSize:`Size px`,fieldWeight:`Weight`,fieldPadding:`Padding`,fieldRadius:`Radius`,fieldImage:`Image URL`,fieldNote:`Why (optional)`,textLocked:`This element contains other elements, so its text cannot be edited here; pick an inner element.`,noChanges:`Nothing changed yet`,needName:`Enter your name in the panel first`,newFrom:`{name} added #{n}`,reviewer:`Review`,modeSelect:`Select`,modeInsert:`Insert block`,steerPlaceholder:`Or describe a page-wide change…`,steerGo:`Generate`,quote:`Quote`,designTitle:`Design candidates`,promptPlaceholder:`Extra instructions (optional)`,insertPlaceholder:`Describe the block to insert…`,before:`Before`,after:`After`,count:`Count`,display:`Display`,inplace:`In place`,compare:`Side by side`,marks:`Marks`,draw:`Circle`,pin:`Pin`,undo:`Undo`,clear:`Clear`,notePlaceholder:`What should change here?`,noteEmpty:`A note needs text`,generate:`Generate`,cancel:`Cancel`,original:`Original`,accept:`Accept`,discard:`Discard`,retry:`Retry`,retryAccept:`Retry & accept`,refinePlaceholder:`Refine this candidate…`,reload:`Reload`,tellAgent:`Tell the agent`,notMounted:`The candidates did not appear on the page`,otherRoute:`The candidates are on another page`,goThere:`Go there`,params:`Tune`,status_generating:`Generating`,status_refining:`Refining`,status_accepting:`Accepting`,status_discarding:`Discarding`,status_ready:`Ready`,status_failed:`Failed`,status_accepted:`Accepted`,status_discarded:`Discarded`,maxMarks:`Up to 8 marks`,blockedNested:`There are candidates here already; accept or discard them first`,actions:{bolder:`Bolder`,quieter:`Quieter`,polish:`Polish`,typeset:`Typeset`,colorize:`Colorize`,layout:`Layout`,distill:`Distill`,adapt:`Adapt`,animate:`Animate`,delight:`Delight`,overdrive:`Overdrive`,freeform:`Freeform`}};function ge(e){return e===`en`?he:G}var _e=`
2
2
  .lv-card { position: fixed; z-index: 2147483646; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); font-size: var(--fs); }
3
3
  .lv-card button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); background: var(--bg); border-radius: var(--r); padding: 0 10px; height: var(--h); white-space: nowrap; transition: background .12s, border-color .12s; }
4
4
  .lv-card button:hover:not(:disabled) { background: var(--bg2); }