use-chisel 0.1.6 → 0.1.7
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.
|
@@ -12,7 +12,7 @@ export type WorkspaceComposerProps = {
|
|
|
12
12
|
renderContent(editor: ReactNode, hasAttachments?: boolean, uploading?: boolean, actions?: ReactNode): ReactNode;
|
|
13
13
|
};
|
|
14
14
|
export default function CommentBox({ target, text, onText, onCancel, onPost, style, changes, editing, commentId, renderComposer, hasExistingAttachments, onDraftChange, hidden }: {
|
|
15
|
-
target: Element;
|
|
15
|
+
target: Element | null;
|
|
16
16
|
text: string;
|
|
17
17
|
onText(value: string): void;
|
|
18
18
|
onCancel(): void;
|
package/dist/workspace-entry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{jsx as u,jsxs as h,Fragment as na}from"react/jsx-runtime";import{useEffect as ke,useLayoutEffect as Fa,useRef as z,useState as F}from"react";import{forwardRef as Po,createElement as Do}from"react";var pt=a=>a?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function mt(a,t,r=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:pt(a),size:24,node:t,...r.length>0?{aliases:r}:{}}}var ht=a=>{let t="",r=!1;for(let o of a){if(o==="-"||o==="_"||o<=" "){r=t.length>0;continue}t.length===0?t+=o.toLowerCase():t+=r?o.toUpperCase():o,r=!1}return t};var xt=a=>{let t=ht(a);return t.charAt(0).toUpperCase()+t.slice(1)};import{forwardRef as vo,createElement as bt}from"react";var $e=(...a)=>a.filter((t,r,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===r).join(" ").trim();var Pe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function Ga(a){return a!=null}function Lt(a,t={}){let r=t.attributeNames??{},o=k=>r[k]??k,l=a.size??a.width??Pe.width,n=a.size??a.height??Pe.height,s=a.aliases?.filter(k=>typeof k=="string"&&k.trim()!=="").map(k=>`lucide-${k}`)??[],c=[...a.name?[`lucide-${a.name}`]:[],...s],g=t.className?.split(" ").filter(Boolean)??[],w=t.includeDefaultClasses===!1?$e(...g):$e("lucide",...c,...g),S=t.absoluteStrokeWidth?Number(t.strokeWidth??Pe["stroke-width"])*Number(a.size??a.width??Pe.width)/Number(t.size??t.width??Pe.width):t.strokeWidth??Pe["stroke-width"];return["svg",{...Object.entries(Pe).reduce((k,[I,R])=>(k[o(I)]=R,k),{}),..."color"in t&&t.color&&{[o("stroke")]:t.color},..."size"in t&&Ga(t.size)&&{[o("width")]:t.size,[o("height")]:t.size},..."width"in t&&Ga(t.width)&&{[o("width")]:t.width},..."height"in t&&Ga(t.height)&&{[o("height")]:t.height},[o("stroke-width")]:S,...w&&{[o("class")]:w},[o("viewBox")]:`0 0 ${l} ${n}`,...t.hasA11yProp===!1?{[o("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},a.node.map(k=>{let[I,R,q]=k,X=t.nonScalingStroke?{[o("vector-effect")]:"non-scaling-stroke",...R}:R;return q?[I,X,q]:[I,X]})]}function gt(a,t={}){return Lt(a,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var It=a=>{for(let t in a)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};import{createContext as So,useContext as wo,useMemo as fr,createElement as nr}from"react";var yo=So({});var Ct=()=>wo(yo);var kt=vo(({color:a,size:t,width:r,height:o,strokeWidth:l,absoluteStrokeWidth:n,nonScalingStroke:s,className:c="",children:g,iconNode:w=[],icon:S={node:w,aliases:[],size:24},...y},k)=>{let{size:I=24,strokeWidth:R=2,absoluteStrokeWidth:q=!1,nonScalingStroke:X=!1,color:K="currentColor",className:ae=""}=Ct()??{},P=!!g||It(y),[H,p,x=[]]=gt(S,{color:a??K,width:r??t??I,height:o??t??I,strokeWidth:l??R,absoluteStrokeWidth:n??q,nonScalingStroke:s??X,className:$e(ae,c),hasA11yProp:P,attributes:y});return bt(H,{ref:k,...p},[...x.map(([te,m])=>bt(te,m)),...Array.isArray(g)?g:[g]])});function C(a,t=[],r=[]){let o=typeof a=="string"?mt(a,t,r):a,l=Po(({className:n,...s},c)=>Do(kt,{ref:c,icon:o,className:n,...s}));return o.name&&(l.displayName=xt(o.name)),l}var St={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};St.node;var Ze=C(St);var wt={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};wt.node;var je=C(wt);var yt={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};yt.node;var Fe=C(yt);var vt={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};vt.node;var _e=C(vt);var Pt={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};Pt.node;var Re=C(Pt);var Dt={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};Dt.node;var De=C(Dt);var At={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};At.node;var Je=C(At);var Bt={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};Bt.node;var Qe=C(Bt);var Mt={name:"grip-horizontal",size:24,node:[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]};Mt.node;var Ye=C(Mt);var Ft={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};Ft.node;var ea=C(Ft);var Rt={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};Rt.node;var Ae=C(Rt);var Tt={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};Tt.node;var aa=C(Tt);var qt={name:"message-circle",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]};qt.node;var ze=C(qt);var Ut={name:"mouse-pointer-2",size:24,node:[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]};Ut.node;var ta=C(Ut);var Ht={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};Ht.node;var Ne=C(Ht);var Ot={name:"pipette",size:24,node:[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]]};Ot.node;var oa=C(Ot);var Et={name:"rotate-ccw",size:24,node:[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]};Et.node;var ra=C(Et);var zt={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};zt.node;var da=C(zt);var Nt={name:"sliders-horizontal",size:24,node:[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]};Nt.node;var Te=C(Nt);var Gt={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};Gt.node;var Be=C(Gt);var Wt={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Wt.node;var la=C(Wt);import{jsx as M,jsxs as ee,Fragment as Fo}from"react/jsx-runtime";import{useEffect as _t,useId as Ro,useState as be}from"react";import{jsx as ne,jsxs as ua}from"react/jsx-runtime";import{useEffect as Ao,useRef as Xt,useState as Ge}from"react";import{createPortal as Bo}from"react-dom";function Vt(a,t,r,o=1){a/=255,t/=255,r/=255;let l=Math.max(a,t,r),n=Math.min(a,t,r),s=l-n;return{h:(s?l===a?((t-r)/s+6)%6:l===t?(r-a)/s+2:(a-t)/s+4:0)*60,s:l?s/l:0,v:l,a:o}}function ka({h:a,s:t,v:r,a:o}){let l=n=>{let s=(n+a/60)%6;return Math.round(255*r*(1-t*Math.max(0,Math.min(s,4-s,1)))).toString(16).padStart(2,"0")};return`#${l(5)}${l(3)}${l(1)}${o<1?Math.round(o*255).toString(16).padStart(2,"0"):""}`}function Sa(a){if(typeof document<"u"){let t=document.createElement("canvas");t.width=t.height=1;let r=t.getContext("2d");if(r){r.fillStyle=a,r.fillRect(0,0,1,1);let[o,l,n,s]=r.getImageData(0,0,1,1).data;return Vt(o,l,n,s/255)}}return Vt(0,0,0)}function Wa({label:a,value:t,onChange:r,disabled:o}){let l=Xt(null),n=Xt(null),[s,c]=Ge(null),[g,w]=Ge({h:0,s:0,v:0,a:1}),[S,y]=Ge(""),[k,I]=Ge(!1),[R,q]=Ge(!1),[X,K]=Ge(!1);function ae(){c(null)}Ao(()=>{if(!s)return;let p=T=>{!n.current?.contains(T.target)&&!l.current?.contains(T.target)&&ae()},x=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),ae(),l.current?.focus())},te=l.current?.getBoundingClientRect(),m=T=>{if(n.current?.contains(T.target))return;let G=l.current?.getBoundingClientRect();(G?.top!==te?.top||G?.left!==te?.left)&&ae()};return document.addEventListener("pointerdown",p),document.addEventListener("keydown",x,!0),window.addEventListener("resize",ae),document.addEventListener("scroll",m,!0),n.current?.querySelector("input")?.focus({preventScroll:!0}),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("keydown",x,!0),window.removeEventListener("resize",ae),document.removeEventListener("scroll",m,!0)}},[s]);function P(p){p.a===0&&(p={...p,a:1}),w(p);let x=ka(p);y(x.slice(1).toUpperCase()),I(!1),r(x)}function H(p){let x=p.currentTarget.getBoundingClientRect();P({...g,s:Math.max(0,Math.min(1,(p.clientX-x.left)/x.width)),v:1-Math.max(0,Math.min(1,(p.clientY-x.top)/x.height))})}return ua("div",{className:"comment-box-color",children:[ne("button",{ref:l,className:"comment-color-trigger",type:"button","aria-label":`${a} picker`,"aria-haspopup":"dialog","aria-expanded":!!s,disabled:o,onClick:()=>{if(s){ae();return}let p=Sa(t);w(p),y(ka(p).slice(1).toUpperCase()),I(!1),q("EyeDropper"in window);let x=l.current.getBoundingClientRect();c({left:Math.max(8,Math.min(x.right-256,window.innerWidth-264)),top:Math.max(8,Math.min(x.bottom+8,window.innerHeight-330))})},children:ne("span",{style:{background:t}})}),ne("span",{className:"comment-color-value",title:t,children:t}),s&&Bo(ua("div",{ref:n,className:"chisel-color-picker",role:"dialog","aria-label":`${a} color picker`,style:s,onKeyDown:p=>{if(p.key!=="Tab")return;let x=Array.from(n.current.querySelectorAll("button:not(:disabled), input:not(:disabled)"));p.shiftKey&&document.activeElement===x[0]?(p.preventDefault(),x[x.length-1]?.focus()):!p.shiftKey&&document.activeElement===x[x.length-1]&&(p.preventDefault(),x[0]?.focus())},children:[ua("div",{className:"chisel-color-plane",style:{backgroundColor:`hsl(${g.h} 100% 50%)`},onPointerDown:p=>{p.currentTarget.setPointerCapture(p.pointerId),H(p)},onPointerMove:p=>{p.currentTarget.hasPointerCapture(p.pointerId)&&H(p)},children:[ne("span",{className:"chisel-color-thumb",style:{left:`${g.s*100}%`,top:`${(1-g.v)*100}%`,background:ka({...g,a:1})}}),ne("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} saturation`,min:0,max:100,value:Math.round(g.s*100),onChange:p=>P({...g,s:Number(p.target.value)/100})}),ne("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} brightness`,min:0,max:100,value:Math.round(g.v*100),onChange:p=>P({...g,v:Number(p.target.value)/100})})]}),ua("div",{className:"chisel-color-tools",children:[ne("input",{className:"chisel-color-hue",type:"range","aria-label":`${a} hue`,min:0,max:360,value:Math.round(g.h),style:{"--hue":`hsl(${g.h} 100% 50%)`},onChange:p=>P({...g,h:Number(p.target.value)})}),ne("button",{type:"button","aria-label":`Pick ${a.toLowerCase()} from screen`,title:R?"Pick a color from the screen":"Screen color picker is not supported in this browser",disabled:!R||X,onClick:async()=>{let p=window.EyeDropper;if(p){K(!0);try{let x=await new p().open();n.current&&P(Sa(x.sRGBHex))}catch{}finally{K(!1)}}},children:ne(oa,{size:18})})]}),ua("label",{className:"chisel-color-hex",children:["HEX",ne("input",{"aria-label":`${a} hex`,value:S,maxLength:9,spellCheck:!1,"aria-invalid":k,onChange:p=>{let x=p.target.value.replace(/^#/,"");y(x);let te=/^(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(x);if(I(!te),te){let m=Sa(`#${x}`);w(m),r(`#${x}`)}}})]}),k&&ne("span",{className:"chisel-color-error",role:"status",children:"Enter a valid hex color."})]}),document.body)]})}import{jsx as Kt}from"react/jsx-runtime";import{useRef as Mo}from"react";function sa({onMoveStart:a}){let t=Mo(null);function r(o,l,n){let s=o.closest(".comment-box,.comment-thread"),c=s?.closest(".feedback-viewport");if(!s||!c)return;let g=c.getBoundingClientRect(),w=s.getBoundingClientRect();for(let[S,y]of[["x",Math.max(g.left+8-w.left,Math.min(l,g.right-8-w.right))],["y",Math.max(g.top+8-w.top,Math.min(n,g.bottom-8-w.bottom))]]){let k=`--comment-drag-${S}`;s.style.setProperty(k,`${(parseFloat(s.style.getPropertyValue(k))||0)+y}px`)}}return Kt("button",{type:"button",className:"comment-window-drag","aria-label":"Move comment window",title:"Drag to move \xB7 Arrow keys to nudge",onPointerDown:o=>{!o.isPrimary||o.button!==0||(o.preventDefault(),a?.(),o.currentTarget.closest(".comment-box,.comment-thread")?.getAnimations().forEach(l=>l.cancel()),o.currentTarget.setPointerCapture(o.pointerId),t.current={id:o.pointerId,x:o.clientX,y:o.clientY},o.currentTarget.dataset.dragging="true")},onPointerMove:o=>{let l=t.current;!l||l.id!==o.pointerId||(r(o.currentTarget,o.clientX-l.x,o.clientY-l.y),l.x=o.clientX,l.y=o.clientY)},onPointerUp:o=>{o.currentTarget.hasPointerCapture(o.pointerId)&&o.currentTarget.releasePointerCapture(o.pointerId)},onLostPointerCapture:o=>{t.current=null,delete o.currentTarget.dataset.dragging},onKeyDown:o=>{let l={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[o.key];if(!l)return;o.preventDefault(),o.stopPropagation(),a?.();let n=o.shiftKey?40:10;r(o.currentTarget,l[0]*n,l[1]*n)},children:Kt(Ye,{size:16,"aria-hidden":"true"})})}function $t(a,t,r,o){let l={[a]:t},n=r.find(s=>s!==a);if(!n||!r.includes(a))return l;if(r.includes("width")){let s=parseFloat(o.width)/parseFloat(o.height),c=parseFloat(t);if(!Number.isFinite(s)||s<=0||!Number.isFinite(c))return l;l[n]=`${a==="width"?c/s:c*s}px`}else l[n]=t;return l}var Zt=new Set(["color","background-color","opacity","font-family","font-size","font-weight","border-color","border-width","width","height",...["padding","margin"].flatMap(a=>["top","right","bottom","left"].map(t=>`${a}-${t}`))]);function jt(a,t){let r={...a},o={...a};for(let l of Array.isArray(t)?t:[])!l||!Object.prototype.hasOwnProperty.call(a,l.property)||typeof l.before!="string"||typeof l.after!="string"||l.property!=="text"&&(!Zt.has(l.property)||!CSS.supports(l.property,l.after))||(r[l.property]=l.before,o[l.property]=l.after);return{initial:r,values:o}}function wa(a,t){if(!Array.isArray(t))return()=>{};let r=a.style,o=a.getAttribute("style"),l=a.textContent,n=!1;for(let c of t)!c||typeof c.after!="string"||(c.property==="text"&&!a.children.length?(a.textContent=c.after,n=!0):r&&Zt.has(c.property)&&CSS.supports(c.property,c.after)&&r.setProperty(c.property,c.after,"important"));let s=!1;return()=>{s||(s=!0,o===null?a.removeAttribute("style"):a.setAttribute("style",o),n&&!a.children.length&&(a.textContent=l))}}var Qt=[["Text color","color","color"],["Background","background-color","color"],["Opacity","opacity","number"],["Font","font-family","font"],["Font size","font-size","number"],["Font weight","font-weight","weight"],["Border color","border-color","color"],["Border width","border-width","number"]],To=["top","bottom","left","right"],Jt=[{label:"Size",pairs:[["width","height"]]},...["padding","margin"].map(a=>({label:a[0].toUpperCase()+a.slice(1),pairs:[[`${a}-top`,`${a}-bottom`],[`${a}-left`,`${a}-right`]]}))];function qo(a){let t=a.ownerDocument.defaultView.getComputedStyle(a);return Object.fromEntries([["text",a.children.length?"":a.textContent??""],...["width","height"].map(r=>[r,t.getPropertyValue(r)]),...Qt.map(([,r])=>[r,t.getPropertyValue(r)]),...["padding","margin"].flatMap(r=>To.map(o=>[`${r}-${o}`,t.getPropertyValue(`${r}-${o}`)]))])}function Va({target:a,text:t,onText:r,onCancel:o,onPost:l,style:n,changes:s=[],editing:c=!1,commentId:g,renderComposer:w,hasExistingAttachments:S=!1,onDraftChange:y,hidden:k=!1}){let[I]=be(()=>jt(qo(a),s)),R=I.initial,[q,X]=be(I.values),[K]=be(()=>({style:a.getAttribute("style"),text:a.textContent})),[ae,P]=be({}),[H,p]=be(!1),[x]=be(t),[te,m]=be(!1),[U,T]=be(""),[G,Se]=be(!1),V=Ro();function oe(){K.style===null?a.removeAttribute("style"):a.setAttribute("style",K.style),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode(K.text??""))}function W(){oe(),o()}_t(()=>(wa(a,s),oe),[a,K]);function pe(E,$){if(E==="text"){X(v=>({...v,text:$})),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode($));return}let ue=Jt.flatMap(v=>v.pairs).find(v=>v.includes(E)&&ae[v.join(":")]),Z=ue?$t(E,$,ue,R):{[E]:$};X(v=>({...v,...Z}));for(let[v,A]of Object.entries(Z))CSS.supports(v,A)&&a.style.setProperty(v,A,"important")}let we=Object.entries(q).some(([E,$])=>$!==R[E]),He=!!(t.trim()||we||te||c&&t!==x);_t(()=>(y?.(He),()=>y?.(!1)),[He,y]);async function Q(E=t,$,ue,Z){if(H||!E.trim()&&!ue?.length&&!S)return!1;let v=Object.entries(q).filter(([A,L])=>L!==R[A]).map(([A,L])=>({property:A,before:R[A],after:L}));if(v.some(A=>A.property!=="text"&&!CSS.supports(A.property,A.after)))return T("Check the style values before posting."),!1;p(!0),T("");try{let A=await l(v,E.trimEnd(),$,ue,Z);return A?W():T("Could not post. Your changes are still here; please try again."),A}catch{return T("Could not post. Please try again."),!1}finally{p(!1)}}let We=(E,$=!1,ue=!1,Z)=>ee(Fo,{children:[ee("div",{className:"comment-box-prompt",children:[M("button",{type:"button",className:"comment-box-symbol","aria-label":"Comment settings",title:"Comment settings","aria-expanded":G,"aria-controls":V,disabled:H,onClick:()=>Se(v=>!v),children:M(Te,{})}),E]}),ee("div",{className:"comment-box-settings",id:V,hidden:!G,children:[ee("div",{className:"comment-box-element",children:[ee("code",{children:["<",a.tagName.toLowerCase(),">"]}),we&&M("span",{className:"comment-box-preview-status",role:"status",children:"Unsaved preview"}),M(sa,{})]}),ee("fieldset",{className:"comment-box-properties",disabled:H||!G,children:[ee("label",{className:"comment-box-row",children:[M("span",{children:"Text"}),M("input",{"aria-label":"Element text",value:q.text,disabled:!!a.children.length,title:a.children.length?"Select a text-only element to change its text":void 0,onChange:v=>pe("text",v.target.value)})]}),["Typography","Appearance"].map(v=>ee("div",{className:"comment-box-control-group",children:[M("h3",{children:v}),Qt.filter(([,A])=>v==="Typography"===["color","font-family","font-size","font-weight"].includes(A)).map(([A,L,de])=>ee("div",{className:"comment-box-row",children:[M("span",{children:A}),de==="color"?G&&M(Wa,{label:A,value:q[L],disabled:H,onChange:B=>pe(L,B)}):de==="font"?M("select",{"aria-label":A,value:q[L],onChange:B=>pe(L,B.target.value),children:Array.from(new Set([R[L],"Arial, sans-serif","Georgia, serif","system-ui","monospace"])).map(B=>M("option",{value:B,children:B},B))}):de==="weight"?M("select",{"aria-label":A,value:q[L],onChange:B=>pe(L,B.target.value),children:Array.from(new Set([R[L],...[100,200,300,400,500,600,700,800,900].map(String)])).map(B=>M("option",{children:B},B))}):ee("div",{className:"comment-box-number",children:[M("input",{type:"number","aria-label":A,value:Number.isFinite(parseFloat(q[L]))?parseFloat(q[L]):"",min:0,max:L==="opacity"?1:void 0,step:"any",onChange:B=>pe(L,B.target.value+(L==="opacity"?"":"px"))}),L!=="opacity"&&M("span",{children:"px"})]})]},L))]},v)),Jt.map(v=>ee("details",{className:"comment-box-group",open:!0,children:[ee("summary",{children:[v.label,M(Re,{size:12,"aria-hidden":"true"})]}),v.pairs.map(A=>{let L=A.join(":"),de=v.label==="Size"?"Lock aspect ratio":`Link ${v.label.toLowerCase()} ${A[0].split("-")[1]} and ${A[1].split("-")[1]}`;return ee("div",{className:"comment-box-pair",children:[M("button",{className:"comment-box-link",type:"button","aria-label":de,title:de,"aria-pressed":!!ae[L],onClick:()=>P(B=>({...B,[L]:!B[L]})),children:M(ea,{size:12})}),A.map(B=>{let Oe=B.includes("-")?B.split("-")[1]:B;return ee("label",{className:"comment-box-row",children:[M("span",{children:Oe[0].toUpperCase()+Oe.slice(1)}),ee("span",{className:"comment-box-number",children:[M("input",{type:"number",step:"any",min:B.startsWith("margin-")?void 0:0,"aria-label":B.replace("-"," ").replace(/^width$/,"Width").replace(/^height$/,"Height"),value:Number.isFinite(parseFloat(q[B]))?parseFloat(q[B]):"",onChange:Ta=>pe(B,`${Ta.target.value}px`)}),M("span",{children:"px"})]})]},B)})]},L)})]},v.label))]})]}),U&&M("p",{className:"comment-box-error",role:"alert",children:U}),ee("footer",{className:"comment-box-footer",children:[M("button",{type:"button",className:"comment-box-cancel",onClick:W,disabled:H,children:"Cancel"}),M("span",{}),Z,M("button",{type:"submit",className:"comment-box-submit","aria-label":c?"Save comment":"Post comment",title:c?"Save comment":"Post comment",disabled:H||ue||!t.trim()&&!$&&!S,children:H?M("span",{className:"comment-box-saving"}):M(Fe,{})})]})]}),re=`comment-box${w?" comment-box-native":""}`,Ve=E=>{E.key==="Escape"&&!H&&(E.preventDefault(),E.stopPropagation(),W())};return w?M("div",{className:re,hidden:k,"data-settings-open":G,style:n,onKeyDown:Ve,children:w({text:t,onText:r,disabled:H,commentId:g,onAttachmentDraftChange:m,onSubmit:Q,renderContent:We})}):M("form",{className:re,hidden:k,"data-settings-open":G,style:n,"aria-label":c?"Edit comment":"New comment",onKeyDown:Ve,onSubmit:E=>{E.preventDefault(),Q()},children:We(M("input",{"aria-label":"Comment",placeholder:"Leave a comment\u2026",value:t,onChange:E=>r(E.target.value),autoFocus:!0,maxLength:4e3,required:!0,disabled:H}))})}import{jsx as ce,jsxs as Ue,Fragment as Uo}from"react/jsx-runtime";import{useEffect as Ho,useLayoutEffect as Oo,useRef as va,useState as Pa}from"react";function qe(a,t,r="/"){if(!a.trim())return null;try{let o=new URL(a.trim(),new URL(r,t)),l=decodeURIComponent(o.pathname);return!/^https?:$/.test(o.protocol)||o.origin!==t||o.username||o.password||/^\/(chisel|feedback)(\/|$)/.test(l)?null:o.pathname+o.search+o.hash}catch{return null}}function ya(a){return a.split(/[?#]/,1)[0]}function Xa(a){try{let{pathname:t,search:r,hash:o}=a.location;return t.startsWith("/")?t+r+o:null}catch{return null}}function Yt(a,t){let r;try{r=a.history}catch{return()=>{}}let o=r.pushState,l=r.replaceState,n=!0,s=()=>{let w=Xa(a);n&&w!==null&&t(w)},c=function(...w){o.apply(this,w),s()},g=function(...w){l.apply(this,w),s()};return r.pushState=c,r.replaceState=g,a.addEventListener("popstate",s),a.addEventListener("hashchange",s),s(),()=>{n=!1,r.pushState===c&&(r.pushState=o),r.replaceState===g&&(r.replaceState=l),a.removeEventListener("popstate",s),a.removeEventListener("hashchange",s)}}function Ka({path:a,routes:t,disabled:r,onNavigate:o,onOpen:l}){let n=va(null),s=va(null),c=va(null),g=va(!1),[w,S]=Pa(!1),[y,k]=Pa(""),[I,R]=Pa(!1),[q,X]=Pa(""),K=ya(a),ae=[...new Set([a,...t].map(ya))],P=y.trim();if(/^https?:\/\//i.test(P))try{let m=new URL(P);m.origin===window.location.origin&&(P=m.pathname)}catch{}else P=ya(P);let H=P.toLocaleLowerCase(),p=ae.filter(m=>m.toLocaleLowerCase().includes(H));function x(m=!1){n.current&&(n.current.open=!1),S(!1),m&&s.current?.focus({preventScroll:!0})}Oo(()=>{if(!w)return;let m=()=>{let U=n.current,T=U?.closest(".feedback-sidebar-panel");U&&T&&U.style.setProperty("--feedback-page-space",`${Math.max(0,U.getBoundingClientRect().top-T.getBoundingClientRect().top-12)}px`)};return m(),c.current?.focus(),c.current?.select(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[w]),Ho(()=>{if(!w)return;let m=G=>{!g.current&&!n.current?.contains(G.target)&&x()},U=G=>{G.key!=="Escape"||g.current||(G.preventDefault(),G.stopPropagation(),x(!0))},T=()=>{g.current||x()};return document.addEventListener("pointerdown",m),document.addEventListener("keydown",U,!0),window.addEventListener("blur",T),()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("keydown",U,!0),window.removeEventListener("blur",T)}},[w]);async function te(m){if(!(r||g.current)){g.current=!0,R(!0),X("");try{await o(m)&&x(!0)}catch(U){X(U instanceof Error&&U.message?U.message:"This page could not be opened. Try again.")}finally{g.current=!1,R(!1)}}}return Ue("details",{ref:n,className:"feedback-page-control",onToggle:m=>S(m.currentTarget.open),children:[Ue("summary",{ref:s,"aria-label":`Current page: ${a}`,"aria-disabled":r||I,tabIndex:r||I?-1:0,onClick:m=>{m.preventDefault(),!(r||I||!n.current)&&(n.current.open?x():(k(""),X(""),l?.(),n.current.open=!0,S(!0)))},children:[ce(Qe,{"aria-hidden":"true"}),ce("span",{title:a,children:a}),ce(_e,{className:"feedback-page-chevron","aria-hidden":"true"})]}),Ue("div",{className:"feedback-page-popover",children:[Ue("form",{className:"feedback-page-form",onSubmit:m=>{m.preventDefault(),te(y)},children:[ce("input",{ref:c,"aria-label":"Page URL or path",value:y,placeholder:"Enter a URL or path",autoComplete:"off",autoCapitalize:"off",spellCheck:!1,disabled:r||I,onChange:m=>{k(m.target.value),X("")}}),ce("button",{type:"submit","aria-label":"Go to page",title:"Go to page","aria-busy":I,disabled:r||I||!y.trim(),children:ce(Ze,{"aria-hidden":"true"})})]}),q&&ce("p",{className:"feedback-page-error",role:"alert",children:q}),Ue("nav",{className:"feedback-page-routes","aria-label":"Known pages",children:[p.map(m=>Ue("button",{type:"button",title:m,"aria-current":m===K?"page":void 0,disabled:r||I,onClick:()=>{m===K?x(!0):te(m)},children:[ce("span",{children:H?Ue(Uo,{children:[m.slice(0,m.toLocaleLowerCase().indexOf(H)),ce("mark",{children:m.slice(m.toLocaleLowerCase().indexOf(H),m.toLocaleLowerCase().indexOf(H)+P.length)}),m.slice(m.toLocaleLowerCase().indexOf(H)+P.length)]}):m}),m===K&&ce(Fe,{"aria-hidden":"true"})]},m)),!p.length&&ce("p",{className:"feedback-page-empty",children:"No matching pages"})]})]})]})}import{jsx as ia,jsxs as eo}from"react/jsx-runtime";import{useEffect as ao,useRef as $a,useState as Eo}from"react";function zo({request:a,finish:t,returnFocus:r}){let o=$a(null);return ao(()=>(o.current?.showModal(),()=>r?.focus({preventScroll:!0})),[]),eo("dialog",{ref:o,className:"feedback-confirmation","aria-labelledby":"feedback-confirmation-title","aria-describedby":"feedback-confirmation-description",onCancel:l=>{l.preventDefault(),t(!1)},children:[ia("h2",{id:"feedback-confirmation-title",children:a.title}),ia("p",{id:"feedback-confirmation-description",children:a.description}),eo("div",{children:[ia("button",{type:"button",autoFocus:!0,onClick:()=>t(!1),children:"Cancel"}),ia("button",{type:"button","data-danger":a.danger,onClick:()=>t(!0),children:a.action})]})]})}function to(){let[a,t]=Eo(null),r=$a(null),o=$a(null);ao(()=>()=>o.current?.(!1),[]);function l(s){o.current?.(s),o.current=null,t(null)}function n(s){return o.current?Promise.resolve(!1):(r.current=document.activeElement,t(s),new Promise(c=>{o.current=c}))}return{confirm:n,dialog:a&&ia(zo,{request:a,finish:l,returnFocus:r.current})}}function oo(a){if(!(a.defaultPrevented||a.repeat||a.isComposing||a.ctrlKey||a.metaKey||a.altKey||a.composedPath().some(r=>{let o=r;return o.nodeType===1&&(o.isContentEditable||o.closest('input,textarea,select,[role="textbox"],[role="combobox"],[contenteditable]:not([contenteditable="false"])'))})))switch(a.key.toLowerCase()){case"c":return a.shiftKey?"toggle-comments":"comment";case"e":return"edit";case"v":return"view"}}function ro(a){let t,r=()=>clearTimeout(t);return{cancel:r,schedule(){r(),t=setTimeout(a,70)}}}function lo(a,t,r){let c=(X,K)=>Math.max(8,Math.min(X,K)),g=a.x+36+8,w=a.x+-4-8-t.width,S=r.width-t.width-8,y=Math.max(0,r.height-16);if(g<=S||w>=8)return{left:c(g<=S?g:w,S),top:c(a.y,r.height-Math.min(t.height,y)-8),maxHeight:y};let k=c(a.y+36+8,r.height-8),I=c(a.y+-4-8,r.height-8),R=r.height-k-8,q=I-8;return R>=q?{left:c(a.x+-4,S),top:k,maxHeight:R}:{left:c(a.x+-4,S),top:I-Math.min(t.height,q),maxHeight:q}}var Da=new WeakMap;function Aa(a,t=!1,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches||!a.animate)return r?.cancel(),null;let o=r?.playState==="running",l=window.getComputedStyle(a);if(a.dataset.expanded==="true"){let k={opacity:0,transform:"translateY(4px)"},I={opacity:1,transform:"translateY(0px)"},R=o?{opacity:l.opacity,transform:l.transform}:t?I:k;return r?.cancel(),a.animate([R,t?k:I],{duration:t?100:140,easing:"cubic-bezier(.4,0,.2,1)"})}let n=a.querySelector(".feedback-hover-preview"),s=Da.get(a)??{width:a.offsetWidth,height:a.offsetHeight,content:n,contentWidth:n?.style.width??""},c={width:`${(Number(a.dataset.pinWidth)||40)-8}px`,height:"32px",opacity:0,transform:`translate(${Number(a.dataset.pinX)-a.offsetLeft}px, ${Number(a.dataset.pinY)-a.offsetTop}px)`,borderRadius:"16px 16px 16px 0px"},g={width:`${s.width}px`,height:`${s.height}px`,opacity:1,transform:"translate(0px, 0px)",borderRadius:l.borderRadius},w=o?{width:l.width,height:l.height,opacity:l.opacity,transform:l.transform,borderRadius:l.borderRadius}:t?g:c;n&&(n.style.width=`${s.width-(parseFloat(l.borderLeftWidth)||0)-(parseFloat(l.borderRightWidth)||0)}px`),r?.cancel();let S=a.animate([{...w,overflow:"hidden"},{...t?c:g,overflow:"hidden"}],{duration:t?120:140,easing:"cubic-bezier(.4,0,.2,1)",fill:t?"forwards":"none"});s.animation=S,Da.set(a,s);let y=()=>{Da.get(a)?.animation===S&&(s.content&&(s.content.style.width=s.contentWidth),Da.delete(a))};return S.finished.then(()=>{t||y()},y),S}import{jsx as No}from"react/jsx-runtime";var uo=`
|
|
1
|
+
"use client";import{jsx as u,jsxs as h,Fragment as ca}from"react/jsx-runtime";import{useEffect as ke,useLayoutEffect as Ta,useRef as z,useState as F}from"react";import{forwardRef as Ao,createElement as Bo}from"react";var mt=a=>a?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function ht(a,t,r=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:mt(a),size:24,node:t,...r.length>0?{aliases:r}:{}}}var xt=a=>{let t="",r=!1;for(let o of a){if(o==="-"||o==="_"||o<=" "){r=t.length>0;continue}t.length===0?t+=o.toLowerCase():t+=r?o.toUpperCase():o,r=!1}return t};var Lt=a=>{let t=xt(a);return t.charAt(0).toUpperCase()+t.slice(1)};import{forwardRef as Do,createElement as kt}from"react";var Ze=(...a)=>a.filter((t,r,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===r).join(" ").trim();var Pe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function Wa(a){return a!=null}function gt(a,t={}){let r=t.attributeNames??{},o=k=>r[k]??k,l=a.size??a.width??Pe.width,n=a.size??a.height??Pe.height,s=a.aliases?.filter(k=>typeof k=="string"&&k.trim()!=="").map(k=>`lucide-${k}`)??[],c=[...a.name?[`lucide-${a.name}`]:[],...s],g=t.className?.split(" ").filter(Boolean)??[],w=t.includeDefaultClasses===!1?Ze(...g):Ze("lucide",...c,...g),S=t.absoluteStrokeWidth?Number(t.strokeWidth??Pe["stroke-width"])*Number(a.size??a.width??Pe.width)/Number(t.size??t.width??Pe.width):t.strokeWidth??Pe["stroke-width"];return["svg",{...Object.entries(Pe).reduce((k,[I,R])=>(k[o(I)]=R,k),{}),..."color"in t&&t.color&&{[o("stroke")]:t.color},..."size"in t&&Wa(t.size)&&{[o("width")]:t.size,[o("height")]:t.size},..."width"in t&&Wa(t.width)&&{[o("width")]:t.width},..."height"in t&&Wa(t.height)&&{[o("height")]:t.height},[o("stroke-width")]:S,...w&&{[o("class")]:w},[o("viewBox")]:`0 0 ${l} ${n}`,...t.hasA11yProp===!1?{[o("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},a.node.map(k=>{let[I,R,U]=k,X=t.nonScalingStroke?{[o("vector-effect")]:"non-scaling-stroke",...R}:R;return U?[I,X,U]:[I,X]})]}function It(a,t={}){return gt(a,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Ct=a=>{for(let t in a)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};import{createContext as yo,useContext as vo,useMemo as cr,createElement as pr}from"react";var Po=yo({});var bt=()=>vo(Po);var St=Do(({color:a,size:t,width:r,height:o,strokeWidth:l,absoluteStrokeWidth:n,nonScalingStroke:s,className:c="",children:g,iconNode:w=[],icon:S={node:w,aliases:[],size:24},...y},k)=>{let{size:I=24,strokeWidth:R=2,absoluteStrokeWidth:U=!1,nonScalingStroke:X=!1,color:K="currentColor",className:ae=""}=bt()??{},P=!!g||Ct(y),[O,p,x=[]]=It(S,{color:a??K,width:r??t??I,height:o??t??I,strokeWidth:l??R,absoluteStrokeWidth:n??U,nonScalingStroke:s??X,className:Ze(ae,c),hasA11yProp:P,attributes:y});return kt(O,{ref:k,...p},[...x.map(([te,m])=>kt(te,m)),...Array.isArray(g)?g:[g]])});function b(a,t=[],r=[]){let o=typeof a=="string"?ht(a,t,r):a,l=Ao(({className:n,...s},c)=>Bo(St,{ref:c,icon:o,className:n,...s}));return o.name&&(l.displayName=Lt(o.name)),l}var wt={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};wt.node;var je=b(wt);var yt={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};yt.node;var _e=b(yt);var vt={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};vt.node;var Re=b(vt);var Pt={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};Pt.node;var Je=b(Pt);var Dt={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};Dt.node;var Te=b(Dt);var At={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};At.node;var De=b(At);var Bt={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};Bt.node;var Qe=b(Bt);var Mt={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};Mt.node;var Ye=b(Mt);var Ft={name:"grip-horizontal",size:24,node:[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]};Ft.node;var ea=b(Ft);var Rt={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};Rt.node;var aa=b(Rt);var Tt={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};Tt.node;var Ae=b(Tt);var qt={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};qt.node;var ta=b(qt);var Ut={name:"message-circle",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]};Ut.node;var Ne=b(Ut);var Ht={name:"mouse-pointer-2",size:24,node:[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]};Ht.node;var oa=b(Ht);var Ot={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};Ot.node;var Ge=b(Ot);var Et={name:"pipette",size:24,node:[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]]};Et.node;var ra=b(Et);var zt={name:"rotate-ccw",size:24,node:[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]};zt.node;var da=b(zt);var Nt={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};Nt.node;var la=b(Nt);var Gt={name:"sliders-horizontal",size:24,node:[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]};Gt.node;var qe=b(Gt);var Wt={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};Wt.node;var Be=b(Wt);var Vt={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Vt.node;var ua=b(Vt);import{jsx as M,jsxs as ee,Fragment as To}from"react/jsx-runtime";import{useEffect as Jt,useId as qo,useState as be}from"react";import{jsx as ne,jsxs as sa}from"react/jsx-runtime";import{useEffect as Mo,useRef as Kt,useState as We}from"react";import{createPortal as Fo}from"react-dom";function Xt(a,t,r,o=1){a/=255,t/=255,r/=255;let l=Math.max(a,t,r),n=Math.min(a,t,r),s=l-n;return{h:(s?l===a?((t-r)/s+6)%6:l===t?(r-a)/s+2:(a-t)/s+4:0)*60,s:l?s/l:0,v:l,a:o}}function wa({h:a,s:t,v:r,a:o}){let l=n=>{let s=(n+a/60)%6;return Math.round(255*r*(1-t*Math.max(0,Math.min(s,4-s,1)))).toString(16).padStart(2,"0")};return`#${l(5)}${l(3)}${l(1)}${o<1?Math.round(o*255).toString(16).padStart(2,"0"):""}`}function ya(a){if(typeof document<"u"){let t=document.createElement("canvas");t.width=t.height=1;let r=t.getContext("2d");if(r){r.fillStyle=a,r.fillRect(0,0,1,1);let[o,l,n,s]=r.getImageData(0,0,1,1).data;return Xt(o,l,n,s/255)}}return Xt(0,0,0)}function Va({label:a,value:t,onChange:r,disabled:o}){let l=Kt(null),n=Kt(null),[s,c]=We(null),[g,w]=We({h:0,s:0,v:0,a:1}),[S,y]=We(""),[k,I]=We(!1),[R,U]=We(!1),[X,K]=We(!1);function ae(){c(null)}Mo(()=>{if(!s)return;let p=T=>{!n.current?.contains(T.target)&&!l.current?.contains(T.target)&&ae()},x=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),ae(),l.current?.focus())},te=l.current?.getBoundingClientRect(),m=T=>{if(n.current?.contains(T.target))return;let G=l.current?.getBoundingClientRect();(G?.top!==te?.top||G?.left!==te?.left)&&ae()};return document.addEventListener("pointerdown",p),document.addEventListener("keydown",x,!0),window.addEventListener("resize",ae),document.addEventListener("scroll",m,!0),n.current?.querySelector("input")?.focus({preventScroll:!0}),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("keydown",x,!0),window.removeEventListener("resize",ae),document.removeEventListener("scroll",m,!0)}},[s]);function P(p){p.a===0&&(p={...p,a:1}),w(p);let x=wa(p);y(x.slice(1).toUpperCase()),I(!1),r(x)}function O(p){let x=p.currentTarget.getBoundingClientRect();P({...g,s:Math.max(0,Math.min(1,(p.clientX-x.left)/x.width)),v:1-Math.max(0,Math.min(1,(p.clientY-x.top)/x.height))})}return sa("div",{className:"comment-box-color",children:[ne("button",{ref:l,className:"comment-color-trigger",type:"button","aria-label":`${a} picker`,"aria-haspopup":"dialog","aria-expanded":!!s,disabled:o,onClick:()=>{if(s){ae();return}let p=ya(t);w(p),y(wa(p).slice(1).toUpperCase()),I(!1),U("EyeDropper"in window);let x=l.current.getBoundingClientRect();c({left:Math.max(8,Math.min(x.right-256,window.innerWidth-264)),top:Math.max(8,Math.min(x.bottom+8,window.innerHeight-330))})},children:ne("span",{style:{background:t}})}),ne("span",{className:"comment-color-value",title:t,children:t}),s&&Fo(sa("div",{ref:n,className:"chisel-color-picker",role:"dialog","aria-label":`${a} color picker`,style:s,onKeyDown:p=>{if(p.key!=="Tab")return;let x=Array.from(n.current.querySelectorAll("button:not(:disabled), input:not(:disabled)"));p.shiftKey&&document.activeElement===x[0]?(p.preventDefault(),x[x.length-1]?.focus()):!p.shiftKey&&document.activeElement===x[x.length-1]&&(p.preventDefault(),x[0]?.focus())},children:[sa("div",{className:"chisel-color-plane",style:{backgroundColor:`hsl(${g.h} 100% 50%)`},onPointerDown:p=>{p.currentTarget.setPointerCapture(p.pointerId),O(p)},onPointerMove:p=>{p.currentTarget.hasPointerCapture(p.pointerId)&&O(p)},children:[ne("span",{className:"chisel-color-thumb",style:{left:`${g.s*100}%`,top:`${(1-g.v)*100}%`,background:wa({...g,a:1})}}),ne("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} saturation`,min:0,max:100,value:Math.round(g.s*100),onChange:p=>P({...g,s:Number(p.target.value)/100})}),ne("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} brightness`,min:0,max:100,value:Math.round(g.v*100),onChange:p=>P({...g,v:Number(p.target.value)/100})})]}),sa("div",{className:"chisel-color-tools",children:[ne("input",{className:"chisel-color-hue",type:"range","aria-label":`${a} hue`,min:0,max:360,value:Math.round(g.h),style:{"--hue":`hsl(${g.h} 100% 50%)`},onChange:p=>P({...g,h:Number(p.target.value)})}),ne("button",{type:"button","aria-label":`Pick ${a.toLowerCase()} from screen`,title:R?"Pick a color from the screen":"Screen color picker is not supported in this browser",disabled:!R||X,onClick:async()=>{let p=window.EyeDropper;if(p){K(!0);try{let x=await new p().open();n.current&&P(ya(x.sRGBHex))}catch{}finally{K(!1)}}},children:ne(ra,{size:18})})]}),sa("label",{className:"chisel-color-hex",children:["HEX",ne("input",{"aria-label":`${a} hex`,value:S,maxLength:9,spellCheck:!1,"aria-invalid":k,onChange:p=>{let x=p.target.value.replace(/^#/,"");y(x);let te=/^(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(x);if(I(!te),te){let m=ya(`#${x}`);w(m),r(`#${x}`)}}})]}),k&&ne("span",{className:"chisel-color-error",role:"status",children:"Enter a valid hex color."})]}),document.body)]})}import{jsx as $t}from"react/jsx-runtime";import{useRef as Ro}from"react";function ia({onMoveStart:a}){let t=Ro(null);function r(o,l,n){let s=o.closest(".comment-box,.comment-thread"),c=s?.closest(".feedback-viewport");if(!s||!c)return;let g=c.getBoundingClientRect(),w=s.getBoundingClientRect();for(let[S,y]of[["x",Math.max(g.left+8-w.left,Math.min(l,g.right-8-w.right))],["y",Math.max(g.top+8-w.top,Math.min(n,g.bottom-8-w.bottom))]]){let k=`--comment-drag-${S}`;s.style.setProperty(k,`${(parseFloat(s.style.getPropertyValue(k))||0)+y}px`)}}return $t("button",{type:"button",className:"comment-window-drag","aria-label":"Move comment window",title:"Drag to move \xB7 Arrow keys to nudge",onPointerDown:o=>{!o.isPrimary||o.button!==0||(o.preventDefault(),a?.(),o.currentTarget.closest(".comment-box,.comment-thread")?.getAnimations().forEach(l=>l.cancel()),o.currentTarget.setPointerCapture(o.pointerId),t.current={id:o.pointerId,x:o.clientX,y:o.clientY},o.currentTarget.dataset.dragging="true")},onPointerMove:o=>{let l=t.current;!l||l.id!==o.pointerId||(r(o.currentTarget,o.clientX-l.x,o.clientY-l.y),l.x=o.clientX,l.y=o.clientY)},onPointerUp:o=>{o.currentTarget.hasPointerCapture(o.pointerId)&&o.currentTarget.releasePointerCapture(o.pointerId)},onLostPointerCapture:o=>{t.current=null,delete o.currentTarget.dataset.dragging},onKeyDown:o=>{let l={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[o.key];if(!l)return;o.preventDefault(),o.stopPropagation(),a?.();let n=o.shiftKey?40:10;r(o.currentTarget,l[0]*n,l[1]*n)},children:$t(ea,{size:16,"aria-hidden":"true"})})}function Zt(a,t,r,o){let l={[a]:t},n=r.find(s=>s!==a);if(!n||!r.includes(a))return l;if(r.includes("width")){let s=parseFloat(o.width)/parseFloat(o.height),c=parseFloat(t);if(!Number.isFinite(s)||s<=0||!Number.isFinite(c))return l;l[n]=`${a==="width"?c/s:c*s}px`}else l[n]=t;return l}var jt=new Set(["color","background-color","opacity","font-family","font-size","font-weight","border-color","border-width","width","height",...["padding","margin"].flatMap(a=>["top","right","bottom","left"].map(t=>`${a}-${t}`))]);function _t(a,t){let r={...a},o={...a};for(let l of Array.isArray(t)?t:[])!l||!Object.prototype.hasOwnProperty.call(a,l.property)||typeof l.before!="string"||typeof l.after!="string"||l.property!=="text"&&(!jt.has(l.property)||!CSS.supports(l.property,l.after))||(r[l.property]=l.before,o[l.property]=l.after);return{initial:r,values:o}}function va(a,t){if(!Array.isArray(t))return()=>{};let r=a.style,o=a.getAttribute("style"),l=a.textContent,n=!1;for(let c of t)!c||typeof c.after!="string"||(c.property==="text"&&!a.children.length?(a.textContent=c.after,n=!0):r&&jt.has(c.property)&&CSS.supports(c.property,c.after)&&r.setProperty(c.property,c.after,"important"));let s=!1;return()=>{s||(s=!0,o===null?a.removeAttribute("style"):a.setAttribute("style",o),n&&!a.children.length&&(a.textContent=l))}}var Yt=[["Text color","color","color"],["Background","background-color","color"],["Opacity","opacity","number"],["Font","font-family","font"],["Font size","font-size","number"],["Font weight","font-weight","weight"],["Border color","border-color","color"],["Border width","border-width","number"]],Uo=["top","bottom","left","right"],Qt=[{label:"Size",pairs:[["width","height"]]},...["padding","margin"].map(a=>({label:a[0].toUpperCase()+a.slice(1),pairs:[[`${a}-top`,`${a}-bottom`],[`${a}-left`,`${a}-right`]]}))];function Ho(a){let t=a.ownerDocument.defaultView.getComputedStyle(a);return Object.fromEntries([["text",a.children.length?"":a.textContent??""],...["width","height"].map(r=>[r,t.getPropertyValue(r)]),...Yt.map(([,r])=>[r,t.getPropertyValue(r)]),...["padding","margin"].flatMap(r=>Uo.map(o=>[`${r}-${o}`,t.getPropertyValue(`${r}-${o}`)]))])}function Xa({target:a,text:t,onText:r,onCancel:o,onPost:l,style:n,changes:s=[],editing:c=!1,commentId:g,renderComposer:w,hasExistingAttachments:S=!1,onDraftChange:y,hidden:k=!1}){let[I]=be(()=>_t(a?Ho(a):{},s)),R=I.initial,[U,X]=be(I.values),[K]=be(()=>({style:a?.getAttribute("style")??null,text:a?.textContent??null})),[ae,P]=be({}),[O,p]=be(!1),[x]=be(t),[te,m]=be(!1),[H,T]=be(""),[G,Se]=be(!1),V=qo();function oe(){a&&(K.style===null?a.removeAttribute("style"):a.setAttribute("style",K.style),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode(K.text??"")))}function W(){oe(),o()}Jt(()=>(a&&va(a,s),oe),[a,K]);function pe(E,$){if(!a)return;if(E==="text"){X(v=>({...v,text:$})),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode($));return}let ue=Qt.flatMap(v=>v.pairs).find(v=>v.includes(E)&&ae[v.join(":")]),Z=ue?Zt(E,$,ue,R):{[E]:$};X(v=>({...v,...Z}));for(let[v,A]of Object.entries(Z))CSS.supports(v,A)&&a.style.setProperty(v,A,"important")}let we=Object.entries(U).some(([E,$])=>$!==R[E]),Oe=!!(t.trim()||we||te||c&&t!==x);Jt(()=>(y?.(Oe),()=>y?.(!1)),[Oe,y]);async function Q(E=t,$,ue,Z){if(O||!E.trim()&&!ue?.length&&!S)return!1;let v=Object.entries(U).filter(([A,L])=>L!==R[A]).map(([A,L])=>({property:A,before:R[A],after:L}));if(v.some(A=>A.property!=="text"&&!CSS.supports(A.property,A.after)))return T("Check the style values before posting."),!1;p(!0),T("");try{let A=await l(v,E.trimEnd(),$,ue,Z);return A?W():T("Could not post. Your changes are still here; please try again."),A}catch{return T("Could not post. Please try again."),!1}finally{p(!1)}}let Ve=(E,$=!1,ue=!1,Z)=>ee(To,{children:[ee("div",{className:"comment-box-prompt",children:[a&&M("button",{type:"button",className:"comment-box-symbol","aria-label":"Comment settings",title:"Comment settings","aria-expanded":G,"aria-controls":V,disabled:O,onClick:()=>Se(v=>!v),children:M(qe,{})}),E]}),a&&ee("div",{className:"comment-box-settings",id:V,hidden:!G,children:[ee("div",{className:"comment-box-element",children:[ee("code",{children:["<",a.tagName.toLowerCase(),">"]}),we&&M("span",{className:"comment-box-preview-status",role:"status",children:"Unsaved preview"}),M(ia,{})]}),ee("fieldset",{className:"comment-box-properties",disabled:O||!G,children:[ee("label",{className:"comment-box-row",children:[M("span",{children:"Text"}),M("input",{"aria-label":"Element text",value:U.text,disabled:!!a.children.length,title:a.children.length?"Select a text-only element to change its text":void 0,onChange:v=>pe("text",v.target.value)})]}),["Typography","Appearance"].map(v=>ee("div",{className:"comment-box-control-group",children:[M("h3",{children:v}),Yt.filter(([,A])=>v==="Typography"===["color","font-family","font-size","font-weight"].includes(A)).map(([A,L,de])=>ee("div",{className:"comment-box-row",children:[M("span",{children:A}),de==="color"?G&&M(Va,{label:A,value:U[L],disabled:O,onChange:B=>pe(L,B)}):de==="font"?M("select",{"aria-label":A,value:U[L],onChange:B=>pe(L,B.target.value),children:Array.from(new Set([R[L],"Arial, sans-serif","Georgia, serif","system-ui","monospace"])).map(B=>M("option",{value:B,children:B},B))}):de==="weight"?M("select",{"aria-label":A,value:U[L],onChange:B=>pe(L,B.target.value),children:Array.from(new Set([R[L],...[100,200,300,400,500,600,700,800,900].map(String)])).map(B=>M("option",{children:B},B))}):ee("div",{className:"comment-box-number",children:[M("input",{type:"number","aria-label":A,value:Number.isFinite(parseFloat(U[L]))?parseFloat(U[L]):"",min:0,max:L==="opacity"?1:void 0,step:"any",onChange:B=>pe(L,B.target.value+(L==="opacity"?"":"px"))}),L!=="opacity"&&M("span",{children:"px"})]})]},L))]},v)),Qt.map(v=>ee("details",{className:"comment-box-group",open:!0,children:[ee("summary",{children:[v.label,M(Te,{size:12,"aria-hidden":"true"})]}),v.pairs.map(A=>{let L=A.join(":"),de=v.label==="Size"?"Lock aspect ratio":`Link ${v.label.toLowerCase()} ${A[0].split("-")[1]} and ${A[1].split("-")[1]}`;return ee("div",{className:"comment-box-pair",children:[M("button",{className:"comment-box-link",type:"button","aria-label":de,title:de,"aria-pressed":!!ae[L],onClick:()=>P(B=>({...B,[L]:!B[L]})),children:M(aa,{size:12})}),A.map(B=>{let Ee=B.includes("-")?B.split("-")[1]:B;return ee("label",{className:"comment-box-row",children:[M("span",{children:Ee[0].toUpperCase()+Ee.slice(1)}),ee("span",{className:"comment-box-number",children:[M("input",{type:"number",step:"any",min:B.startsWith("margin-")?void 0:0,"aria-label":B.replace("-"," ").replace(/^width$/,"Width").replace(/^height$/,"Height"),value:Number.isFinite(parseFloat(U[B]))?parseFloat(U[B]):"",onChange:Ua=>pe(B,`${Ua.target.value}px`)}),M("span",{children:"px"})]})]},B)})]},L)})]},v.label))]})]}),H&&M("p",{className:"comment-box-error",role:"alert",children:H}),ee("footer",{className:"comment-box-footer",children:[M("button",{type:"button",className:"comment-box-cancel",onClick:W,disabled:O,children:"Cancel"}),M("span",{}),Z,M("button",{type:"submit",className:"comment-box-submit","aria-label":c?"Save comment":"Post comment",title:c?"Save comment":"Post comment",disabled:O||ue||!t.trim()&&!$&&!S,children:O?M("span",{className:"comment-box-saving"}):M(Re,{})})]})]}),re=`comment-box${w?" comment-box-native":""}`,Xe=E=>{E.key==="Escape"&&!O&&(E.preventDefault(),E.stopPropagation(),W())};return w?M("div",{className:re,hidden:k,"data-settings-open":G,style:n,onKeyDown:Xe,children:w({text:t,onText:r,disabled:O,commentId:g,onAttachmentDraftChange:m,onSubmit:Q,renderContent:Ve})}):M("form",{className:re,hidden:k,"data-settings-open":G,style:n,"aria-label":c?"Edit comment":"New comment",onKeyDown:Xe,onSubmit:E=>{E.preventDefault(),Q()},children:Ve(M("input",{"aria-label":"Comment",placeholder:"Leave a comment\u2026",value:t,onChange:E=>r(E.target.value),autoFocus:!0,maxLength:4e3,required:!0,disabled:O}))})}import{jsx as ce,jsxs as He,Fragment as Oo}from"react/jsx-runtime";import{useEffect as Eo,useLayoutEffect as zo,useRef as Da,useState as Aa}from"react";function Ue(a,t,r="/"){if(!a.trim())return null;try{let o=new URL(a.trim(),new URL(r,t)),l=decodeURIComponent(o.pathname);return!/^https?:$/.test(o.protocol)||o.origin!==t||o.username||o.password||/^\/(chisel|feedback)(\/|$)/.test(l)?null:o.pathname+o.search+o.hash}catch{return null}}function Pa(a){return a.split(/[?#]/,1)[0]}function Ka(a){try{let{pathname:t,search:r,hash:o}=a.location;return t.startsWith("/")?t+r+o:null}catch{return null}}function eo(a,t){let r;try{r=a.history}catch{return()=>{}}let o=r.pushState,l=r.replaceState,n=!0,s=()=>{let w=Ka(a);n&&w!==null&&t(w)},c=function(...w){o.apply(this,w),s()},g=function(...w){l.apply(this,w),s()};return r.pushState=c,r.replaceState=g,a.addEventListener("popstate",s),a.addEventListener("hashchange",s),s(),()=>{n=!1,r.pushState===c&&(r.pushState=o),r.replaceState===g&&(r.replaceState=l),a.removeEventListener("popstate",s),a.removeEventListener("hashchange",s)}}function $a({path:a,routes:t,disabled:r,onNavigate:o,onOpen:l}){let n=Da(null),s=Da(null),c=Da(null),g=Da(!1),[w,S]=Aa(!1),[y,k]=Aa(""),[I,R]=Aa(!1),[U,X]=Aa(""),K=Pa(a),ae=[...new Set([a,...t].map(Pa))],P=y.trim();if(/^https?:\/\//i.test(P))try{let m=new URL(P);m.origin===window.location.origin&&(P=m.pathname)}catch{}else P=Pa(P);let O=P.toLocaleLowerCase(),p=ae.filter(m=>m.toLocaleLowerCase().includes(O));function x(m=!1){n.current&&(n.current.open=!1),S(!1),m&&s.current?.focus({preventScroll:!0})}zo(()=>{if(!w)return;let m=()=>{let H=n.current,T=H?.closest(".feedback-sidebar-panel");H&&T&&H.style.setProperty("--feedback-page-space",`${Math.max(0,H.getBoundingClientRect().top-T.getBoundingClientRect().top-12)}px`)};return m(),c.current?.focus(),c.current?.select(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[w]),Eo(()=>{if(!w)return;let m=G=>{!g.current&&!n.current?.contains(G.target)&&x()},H=G=>{G.key!=="Escape"||g.current||(G.preventDefault(),G.stopPropagation(),x(!0))},T=()=>{g.current||x()};return document.addEventListener("pointerdown",m),document.addEventListener("keydown",H,!0),window.addEventListener("blur",T),()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("keydown",H,!0),window.removeEventListener("blur",T)}},[w]);async function te(m){if(!(r||g.current)){g.current=!0,R(!0),X("");try{await o(m)&&x(!0)}catch(H){X(H instanceof Error&&H.message?H.message:"This page could not be opened. Try again.")}finally{g.current=!1,R(!1)}}}return He("details",{ref:n,className:"feedback-page-control",onToggle:m=>S(m.currentTarget.open),children:[He("summary",{ref:s,"aria-label":`Current page: ${a}`,"aria-disabled":r||I,tabIndex:r||I?-1:0,onClick:m=>{m.preventDefault(),!(r||I||!n.current)&&(n.current.open?x():(k(""),X(""),l?.(),n.current.open=!0,S(!0)))},children:[ce(Ye,{"aria-hidden":"true"}),ce("span",{title:a,children:a}),ce(Je,{className:"feedback-page-chevron","aria-hidden":"true"})]}),He("div",{className:"feedback-page-popover",children:[He("form",{className:"feedback-page-form",onSubmit:m=>{m.preventDefault(),te(y)},children:[ce("input",{ref:c,"aria-label":"Page URL or path",value:y,placeholder:"Enter a URL or path",autoComplete:"off",autoCapitalize:"off",spellCheck:!1,disabled:r||I,onChange:m=>{k(m.target.value),X("")}}),ce("button",{type:"submit","aria-label":"Go to page",title:"Go to page","aria-busy":I,disabled:r||I||!y.trim(),children:ce(je,{"aria-hidden":"true"})})]}),U&&ce("p",{className:"feedback-page-error",role:"alert",children:U}),He("nav",{className:"feedback-page-routes","aria-label":"Known pages",children:[p.map(m=>He("button",{type:"button",title:m,"aria-current":m===K?"page":void 0,disabled:r||I,onClick:()=>{m===K?x(!0):te(m)},children:[ce("span",{children:O?He(Oo,{children:[m.slice(0,m.toLocaleLowerCase().indexOf(O)),ce("mark",{children:m.slice(m.toLocaleLowerCase().indexOf(O),m.toLocaleLowerCase().indexOf(O)+P.length)}),m.slice(m.toLocaleLowerCase().indexOf(O)+P.length)]}):m}),m===K&&ce(Re,{"aria-hidden":"true"})]},m)),!p.length&&ce("p",{className:"feedback-page-empty",children:"No matching pages"})]})]})]})}import{jsx as fa,jsxs as ao}from"react/jsx-runtime";import{useEffect as to,useRef as Za,useState as No}from"react";function Go({request:a,finish:t,returnFocus:r}){let o=Za(null);return to(()=>(o.current?.showModal(),()=>r?.focus({preventScroll:!0})),[]),ao("dialog",{ref:o,className:"feedback-confirmation","aria-labelledby":"feedback-confirmation-title","aria-describedby":"feedback-confirmation-description",onCancel:l=>{l.preventDefault(),t(!1)},children:[fa("h2",{id:"feedback-confirmation-title",children:a.title}),fa("p",{id:"feedback-confirmation-description",children:a.description}),ao("div",{children:[fa("button",{type:"button",autoFocus:!0,onClick:()=>t(!1),children:"Cancel"}),fa("button",{type:"button","data-danger":a.danger,onClick:()=>t(!0),children:a.action})]})]})}function oo(){let[a,t]=No(null),r=Za(null),o=Za(null);to(()=>()=>o.current?.(!1),[]);function l(s){o.current?.(s),o.current=null,t(null)}function n(s){return o.current?Promise.resolve(!1):(r.current=document.activeElement,t(s),new Promise(c=>{o.current=c}))}return{confirm:n,dialog:a&&fa(Go,{request:a,finish:l,returnFocus:r.current})}}function ro(a){if(!(a.defaultPrevented||a.repeat||a.isComposing||a.ctrlKey||a.metaKey||a.altKey||a.composedPath().some(r=>{let o=r;return o.nodeType===1&&(o.isContentEditable||o.closest('input,textarea,select,[role="textbox"],[role="combobox"],[contenteditable]:not([contenteditable="false"])'))})))switch(a.key.toLowerCase()){case"c":return a.shiftKey?"toggle-comments":"comment";case"e":return"edit";case"v":return"view"}}function lo(a){let t,r=()=>clearTimeout(t);return{cancel:r,schedule(){r(),t=setTimeout(a,70)}}}function uo(a,t,r){let c=(X,K)=>Math.max(8,Math.min(X,K)),g=a.x+36+8,w=a.x+-4-8-t.width,S=r.width-t.width-8,y=Math.max(0,r.height-16);if(g<=S||w>=8)return{left:c(g<=S?g:w,S),top:c(a.y,r.height-Math.min(t.height,y)-8),maxHeight:y};let k=c(a.y+36+8,r.height-8),I=c(a.y+-4-8,r.height-8),R=r.height-k-8,U=I-8;return R>=U?{left:c(a.x+-4,S),top:k,maxHeight:R}:{left:c(a.x+-4,S),top:I-Math.min(t.height,U),maxHeight:U}}var Ba=new WeakMap;function Ma(a,t=!1,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches||!a.animate)return r?.cancel(),null;let o=r?.playState==="running",l=window.getComputedStyle(a);if(a.dataset.expanded==="true"){let k={opacity:0,transform:"translateY(4px)"},I={opacity:1,transform:"translateY(0px)"},R=o?{opacity:l.opacity,transform:l.transform}:t?I:k;return r?.cancel(),a.animate([R,t?k:I],{duration:t?100:140,easing:"cubic-bezier(.4,0,.2,1)"})}let n=a.querySelector(".feedback-hover-preview"),s=Ba.get(a)??{width:a.offsetWidth,height:a.offsetHeight,content:n,contentWidth:n?.style.width??""},c={width:`${(Number(a.dataset.pinWidth)||40)-8}px`,height:"32px",opacity:0,transform:`translate(${Number(a.dataset.pinX)-a.offsetLeft}px, ${Number(a.dataset.pinY)-a.offsetTop}px)`,borderRadius:"16px 16px 16px 0px"},g={width:`${s.width}px`,height:`${s.height}px`,opacity:1,transform:"translate(0px, 0px)",borderRadius:l.borderRadius},w=o?{width:l.width,height:l.height,opacity:l.opacity,transform:l.transform,borderRadius:l.borderRadius}:t?g:c;n&&(n.style.width=`${s.width-(parseFloat(l.borderLeftWidth)||0)-(parseFloat(l.borderRightWidth)||0)}px`),r?.cancel();let S=a.animate([{...w,overflow:"hidden"},{...t?c:g,overflow:"hidden"}],{duration:t?120:140,easing:"cubic-bezier(.4,0,.2,1)",fill:t?"forwards":"none"});s.animation=S,Ba.set(a,s);let y=()=>{Ba.get(a)?.animation===S&&(s.content&&(s.content.style.width=s.contentWidth),Ba.delete(a))};return S.finished.then(()=>{t||y()},y),S}import{jsx as Wo}from"react/jsx-runtime";var so=`
|
|
2
2
|
:is(.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box) :focus{outline:none}
|
|
3
3
|
.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{color-scheme:light;--chisel-ui-panel-shadow:0 4px 20px rgba(0,0,0,.08);--chisel-ui-canvas:#f7f7f7;--chisel-ui-surface:#ffffff;--chisel-ui-raised:#f5f5f5;--chisel-ui-inset:#eeeeee;--chisel-ui-hover:#f0f0f0;--chisel-ui-selected:#eaeaea;--chisel-ui-border:#e2e2e2;--chisel-ui-border-strong:#c4c4c4;--chisel-ui-text:#242424;--chisel-ui-secondary:#626262;--chisel-ui-muted:#686868;--chisel-ui-focus:#2468d3;--chisel-ui-accent-text:#2468d3;--chisel-ui-accent-surface:#edf4ff;--chisel-ui-action:#242424;--chisel-ui-action-text:#ffffff;--chisel-ui-danger:#b33737;--chisel-ui-avatar:#ededed;--chisel-ui-avatar-text:#565656;--chisel-ui-scrollbar:#c2c2c2;--chisel-ui-checker-light:#e5e5e5;--chisel-ui-checker-dark:#c7c7c7;}
|
|
4
4
|
@media(prefers-color-scheme:dark){.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{color-scheme:dark;--chisel-ui-panel-shadow:0 4px 20px #0003;--chisel-ui-canvas:#171717;--chisel-ui-surface:#222222;--chisel-ui-raised:#2a2a2a;--chisel-ui-inset:#191919;--chisel-ui-hover:#303030;--chisel-ui-selected:#383838;--chisel-ui-border:#3c3c3c;--chisel-ui-border-strong:#555555;--chisel-ui-text:#ededed;--chisel-ui-secondary:#b7b7b7;--chisel-ui-muted:#a5a5a5;--chisel-ui-focus:#8bb9ff;--chisel-ui-accent-text:#8bb9ff;--chisel-ui-accent-surface:#253447;--chisel-ui-action:#ededed;--chisel-ui-action-text:#111111;--chisel-ui-danger:#ffa5a5;--chisel-ui-avatar:#383838;--chisel-ui-avatar-text:#cccccc;--chisel-ui-scrollbar:#50504d;--chisel-ui-checker-light:#555555;--chisel-ui-checker-dark:#333333;}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{--chisel-ui-font:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;--chisel-ui-space:4px;--chisel-ui-control:40px;--chisel-ui-radius:8px;--chisel-ui-text-size:13px;--chisel-ui-small:12px;--chisel-ui-motion:120ms cubic-bezier(.2,0,0,1);--chisel-ui-popover-shadow:0 2px 6px #0000000f,0 12px 36px #0000001f;}
|
|
8
8
|
@media(prefers-color-scheme:dark){.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{--chisel-ui-popover-shadow:0 0 0 1px #ffffff0d,0 4px 12px #0003,0 16px 40px #0004;}}
|
|
9
|
-
`;var
|
|
9
|
+
`;var Vo=`
|
|
10
10
|
.feedback-confirmation{width:360px;max-width:calc(100vw - 32px);padding:24px;border:0;border-radius:16px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);box-shadow:var(--chisel-ui-popover-shadow);font:14px var(--chisel-ui-font)}
|
|
11
11
|
.feedback-confirmation::backdrop{background:#0005}
|
|
12
12
|
.feedback-confirmation h2{margin:0 0 8px;font-size:16px;font-weight:600}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
.feedback-confirmation button{min-height:40px;padding:0 16px;border:0;border-radius:8px;background:var(--chisel-ui-raised);color:var(--chisel-ui-text)}
|
|
16
16
|
.feedback-confirmation button[data-danger=true]{background:var(--chisel-ui-danger);color:var(--chisel-ui-surface)}
|
|
17
17
|
|
|
18
|
-
${
|
|
18
|
+
${so}
|
|
19
19
|
.feedback-shell,.feedback-shell *{box-sizing:border-box}
|
|
20
20
|
.feedback-shell{font-synthesis:none;-webkit-font-smoothing:antialiased;position:fixed;inset:0;background:var(--chisel-ui-canvas);color:var(--chisel-ui-text);z-index:999999;font-family:var(--chisel-ui-font);font-size:13px;letter-spacing:0}
|
|
21
21
|
.feedback-avatar{overflow:hidden}
|
|
@@ -339,12 +339,12 @@ ${uo}
|
|
|
339
339
|
@media(pointer:coarse){.feedback-toolbar button{height:44px}.feedback-tabs button,.feedback-account summary{min-width:44px}.feedback-review-invite summary{min-height:44px}.feedback-pin:after{content:"";position:absolute;inset:-2px;border-radius:inherit}.feedback-account summary,.feedback-review-invite button,.feedback-shell .feedback-primary{min-height:44px}.feedback-shell .comment-window-drag,.feedback-thread-header-actions .feedback-thread-close{width:44px;height:44px}.comment-box-footer{height:60px;min-height:60px}.comment-box-footer button{height:44px;width:44px}.comment-box-footer .comment-box-submit{width:44px}}
|
|
340
340
|
@media(forced-colors:active){.feedback-sidebar-panel,.comment-box,.feedback-composer.comment-thread,.feedback-confirmation,.feedback-account>div{border:1px solid CanvasText;box-shadow:none;background:Canvas;color:CanvasText}.feedback-shell button[aria-pressed=true]{outline:1px solid Highlight;outline-offset:-2px}.feedback-shell input,.feedback-shell textarea,.comment-box-number{border:1px solid CanvasText}.feedback-avatar{border:1px solid CanvasText}}
|
|
341
341
|
|
|
342
|
-
`;function
|
|
343
|
-
html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) { --chisel-comment-cursor:${
|
|
342
|
+
`;function ja(){return Wo("style",{children:Vo})}function _a(a,t){if(t.type==="create")return t.comment;let r=a.find(o=>o.id===t.id);if(!r)throw new Error("This comment no longer exists. Reload and try again.");switch(t.type){case"edit":return{...r,text:t.text,changes:t.changes,...t.body===void 0?{}:{body:t.body}};case"edit_reply":return{...r,replies:r.replies.map(o=>typeof o!="string"&&o.id===t.replyId?{...o,text:t.text,body:t.body}:o)};case"resolve":return{...r,resolved:t.resolved};case"reply":return{...r,replies:[...r.replies,t.reply]}}}function na(a,t){return a.some(r=>r.id===t.id)?a.map(r=>r.id===t.id?t:r):[...a,t]}function Fa(a,t){return a.filter(r=>r.id!==t)}function Ra(a){let t=new Map;for(let r of[a,...a.replies]){if(typeof r=="string")continue;let o=r.authorId?`id:${r.authorId}`:`name:${r.author}`;t.has(o)||t.set(o,{author:r.author,authorImage:r.authorImage})}return[...t.values()]}function io(a,t,r){let o=r.trim().toLocaleLowerCase();return a.filter(l=>(t==="all"||l.resolved===(t==="resolved"))&&[l.text,l.author,l.path,...(l.attachments??[]).map(n=>n.name),...l.replies.map(n=>typeof n=="string"?n:`${n.author} ${n.text}`)].some(n=>n.toLocaleLowerCase().includes(o)))}function fo(a,t=Date.now()){let r=Math.max(0,t-Date.parse(a));if(!Number.isFinite(r))return"";if(r<6e4)return"Just now";let[o,l]=r<36e5?["minute",6e4]:r<864e5?["hour",36e5]:["day",864e5];return new Intl.RelativeTimeFormat(void 0,{numeric:"always"}).format(-Math.floor(r/l),o)}var Ja="chisel-feedback-v1",qa=process.env.NODE_ENV!=="production";function no(a,t){let r=`<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 40 40"><defs><filter id="shadow" x="-25%" y="-25%" width="150%" height="150%"><feDropShadow dx="0" dy="2" stdDeviation="2" flood-opacity=".16"/></filter></defs><path d="M4 20a16 16 0 1 1 16 16H4Z" fill="${a}" stroke="${t}" filter="url(#shadow)"/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(r)}") 3 3, crosshair`}function co(a){for(let r of["data-chisel-id","data-ai-edit","data-component","id"]){let o=a.getAttribute(r);if(o){let l=`[${r}="${CSS.escape(o)}"]`,n=a.ownerDocument.querySelectorAll(l);if(n.length===1&&n[0]===a)return l}}let t=a.parentElement;return t?`${co(t)} > :nth-child(${Array.from(t.children).indexOf(a)+1})`:a.tagName.toLowerCase()}function po({user:a,validateSession:t,signOut:r,commentStore:o,canManageComments:l=!1,getReviewLink:n,collaboration:s,commentUI:c}){let{confirm:g,dialog:w}=oo(),S=z(null),[y,k]=F([]),[I,R]=F("/"),[U,X]=F(["/"]),[K,ae]=F([]),[P,O]=F(qa?"edit":"comment"),p=z(P),x=z(null),te=z(null),m=z(null),H=z(!1),T=z(null),G=z(""),Se=z(!1),V=z(!1),oe=z(null),W=z(null),pe=z(null),[we,Oe]=F(null),[Q,Ve]=F(!1),[re,Xe]=F(!1),E=z(re);E.current=re;let[$,ue]=F(null),[Z,v]=F(null),A=z(Z);A.current=Z;let[L,de]=F(null),B=z(L),Ee=z(!1);B.current=L;let[Ua,Le]=F(null),[j,ho]=F(null),[xo,ze]=F(null),[Lo,Ke]=F(""),[ye,ie]=F(""),[_,ge]=F(null);ke(()=>{ge(null),V.current=!1},[Z]);let[$e,go]=F("open"),[pa,Io]=F(""),[Qa,Y]=F(""),[Ya,ma]=F(!!o),[me,ha]=F(!1),[Ie,et]=F(null),[Ha,at]=F(null),[tt,Co]=F(""),[xa,ot]=F(!1),[rt,La]=F(""),he=z(!1),Me=z(0),ga=z(null),dt=z(!1),Oa=z(null),[Ea,lt]=F({x:0,y:0});G.current=ye,W.current||(W.current=lo(()=>{let e=document.activeElement,d=x.current?.contains(e)&&e?.matches('input,textarea,[contenteditable="true"]');!T.current||G.current.trim()||Se.current||V.current||d||it()}));let i=y.find(e=>e.id===Z),Ia=Ie?.type==="resolve"&&Ie.id===i?.id?Ie:null,ut=Ia?Ia.resolved?"Resolving thread\u2026":"Reopening thread\u2026":i?.resolved?"Reopen thread":"Resolve thread";async function st(e=!1){if(!(!n||xa)){ot(!0),La("");try{let d=await n(e);Co(d);try{await navigator.clipboard.writeText(d),La(e?"New link copied. The previous link no longer accepts new reviewers.":"Link copied. Your client can sign in with any Google account.")}catch{La("Select and copy the review link below.")}}catch{La("The review link could not be created. Please try again.")}finally{ot(!1)}}}async function it(){if((G.current.trim()||Se.current||V.current)&&!await fe()||(W.current?.cancel(),T.current=null,H.current))return;H.current=!0;let e=x.current?Ma(x.current,!0,m.current):null;m.current=e;let d=()=>{!H.current||m.current!==e||(H.current=!1,ve(),v(null),ie(""))};e?e.finished.then(d,()=>{}):d()}function za(){W.current?.cancel(),H.current&&(H.current=!1,m.current=x.current?Ma(x.current,!1,m.current):null)}function Ca(){m.current?.cancel(),m.current=null,H.current=!1,Ve(!0)}async function ft(e){if(!await fe()||he.current)return;let d=null;try{d=e.selector?j?.querySelector(e.selector)??null:null}catch{}if(!d){Y("This element is no longer on the page. Its changes cannot be edited.");return}ve(),W.current?.cancel(),ie(""),oe.current=null,ue(e.id),Ke(e.text),de(e)}function nt(e){W.current?.cancel(),!(L||e.path!==I||(ye.trim()||Se.current||V.current)&&Z!==e.id)&&(Z===e.id&&Q||(T.current=e.id,ka(e,!0)))}function ve(){pe.current?.(),pe.current=null,Oe(null)}async function fe(){return!he.current&&(!(B.current&&Ee.current)&&!G.current.trim()&&!Se.current&&!V.current||await g({title:"Discard this draft?",description:"Your comment and unsaved preview changes will be discarded.",action:"Discard draft",danger:!0}))}async function ba(e){if(e===p.current||!await fe())return;W.current?.cancel(),T.current=null,ve(),O(e),p.current=e,de(null),ue(null),Le(null),e==="comment"&&Xe(!1);let d=S.current?.contentDocument;d?.documentElement&&(d.documentElement.dataset.chiselMode=e,S.current?.contentWindow?.dispatchEvent(new Event("chisel:mode")));let f=new URL(window.location.href);f.searchParams.set("mode",e),window.history.replaceState(window.history.state,"",f)}function bo(){let e=S.current?.contentDocument;if(!e)return;let d=Array.from(e.querySelectorAll("a[href]:not([download])"),f=>Ue(f.href,window.location.origin));ae([...new Set(d.filter(f=>f!==null))])}async function ko(e){let d=Ue(e,window.location.origin,I);if(!d)throw new Error("Enter a page path or URL from this site.");if(d===I)return!0;if(!await fe())return!1;let f=S.current?.contentWindow;return f?(W.current?.cancel(),T.current=null,ve(),de(null),ue(null),v(null),Le(null),ze(null),Ke(""),ie(""),ga.current=null,oe.current=null,Ee.current=!1,Se.current=!1,f.location.assign(d),!0):!1}function se(e){let d=null;try{d=e.selector?j?.querySelector(e.selector)??null:null}catch{}let f=d?.getBoundingClientRect();return{rect:f,x:f?f.left+f.width*(e.offsetX??0):e.x-Ea.x,y:f?f.top+f.height*(e.offsetY??0):e.y-Ea.y}}async function ka(e,d=!1){let f=Ue(e.path,window.location.origin);if(!f){Y("This comment's page cannot be opened in the preview.");return}if(!d&&!await fe()||(za(),d||s?.markRead(e.id),d||(Ca(),T.current=null),Z===e.id&&I===e.path))return;Ve(!d),ve(),v(e.id),de(null),Le(null),ze(e),ie(""),oe.current=null;let C=S.current?.contentDocument;if(C?.documentElement&&e.selector&&(C.documentElement.dataset.chiselSelection=e.selector),I!==f){S.current?.contentWindow?.location.assign(f);return}let N=se(e);d||S.current?.contentWindow?.scrollTo({top:Math.max(0,N.y+Ea.y-180),behavior:"smooth"})}async function xe(e,d=[]){if(he.current)return!1;he.current=!0,ha(!0),et(e),++Me.current;let f=e.type==="create"?e.comment.id:e.id,C=y.find(J=>J.id===f),N=!1;try{if(e.type==="create"||e.type==="reply"){let D=e.type==="create"?{...e.comment,body:e.body,attachments:d,pending:!0}:_a(y,{...e,reply:{...e.reply,body:e.body,attachments:d,date:new Date().toISOString(),pending:!0}});k(q=>na(q,{...D,pending:!0})),ma(!1),Y(""),N=!0}if(!await t())throw new Error("Your session has expired. Reload this page to sign in again.");let J=o?await o.mutate(e):_a(y,e);return++Me.current,o||localStorage.setItem(Ja,JSON.stringify(na(y,J))),k(D=>na(D,J)),ma(!1),Y(""),!0}catch(J){return N&&k(D=>C?na(D,C):Fa(D,f)),Y(J instanceof Error?J.message:"Your comment could not be saved. Your draft is still here; please try again."),!1}finally{he.current=!1,ha(!1),et(null)}}async function So(e){if(!(he.current||!await g({title:"Delete this comment?",description:"The comment and all its replies will be permanently deleted.",action:"Delete comment",danger:!0}))){he.current=!0,ha(!0),at(e.id),Y(""),++Me.current;try{if(!await t()){Y("Your session has expired. Reload this page to sign in again.");return}if(o){if(!o.delete)throw new Error("Comment deletion is unavailable");await o.delete(e.id)}else localStorage.setItem(Ja,JSON.stringify(Fa(y,e.id)));++Me.current,A.current===e.id&&(ve(),v(null),ie(""),ze(null)),k(d=>Fa(d,e.id)),Y("")}catch{Y("The comment could not be deleted. Please try again.")}finally{he.current=!1,ha(!1),at(null)}}}function Na(){let e=S.current?.contentDocument,d=S.current?.contentWindow;if(!e?.documentElement||!d)return;let f=Ka(d);if(f===null||e===Oa.current)return;if(Oa.current=null,!dt.current){if(dt.current=!0,!o)try{let le=JSON.parse(localStorage.getItem(Ja)||"[]");if(!Array.isArray(le)||le.some(Fe=>typeof Fe.id!="string"||typeof Fe.text!="string"||!Array.isArray(Fe.replies)))throw Error();k(le)}catch{Y("Saved comments could not be loaded.")}let D=new URLSearchParams(window.location.search).get("mode"),q=D==="browse"?"view":D;q&&["edit","comment","view"].includes(q)&&(q!=="edit"||qa)&&(O(q),p.current=q);let Ce=new URLSearchParams(window.location.search).get("path");if(Ce){let le=Ue(Ce,window.location.origin);if(!le)Y("That preview page is invalid. Enter a URL from this site.");else if(le!==f){if(le.split("#")[0]!==f.split("#")[0]){Oa.current=e,d.location.replace(le);return}d.location.replace(le),f=le}}}if(R(f),ho(e),!d.chiselReady){e.addEventListener("chisel:ready",Na,{once:!0});return}let C=e.documentElement;if(C.dataset.feedbackBound)return;C.dataset.feedbackBound="true";let N=e.createElement("style");N.textContent=`
|
|
343
|
+
html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) { --chisel-comment-cursor:${no("#ffffff","#e2e2e2")};cursor:var(--chisel-comment-cursor) !important; }
|
|
344
344
|
html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) :not([data-chisel-root], [data-chisel-root] *) { cursor:var(--chisel-comment-cursor) !important; }
|
|
345
345
|
html[data-chisel-mode="comment"] [data-chisel-root] { cursor:auto; }
|
|
346
346
|
@media(prefers-color-scheme:dark) {
|
|
347
|
-
html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) { --chisel-comment-cursor:${
|
|
347
|
+
html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) { --chisel-comment-cursor:${no("#222222","#3c3c3c")}; }
|
|
348
348
|
}
|
|
349
349
|
html[data-chisel-mode="edit"] .chisel-panel-inner { border-radius:0;box-shadow:none; }
|
|
350
350
|
@media(min-width:761px) {
|
|
@@ -356,7 +356,7 @@ ${uo}
|
|
|
356
356
|
@media(max-width:760px) {
|
|
357
357
|
html[data-chisel-mode="edit"] .chisel-panel { left:0;right:0;bottom:0; }
|
|
358
358
|
}
|
|
359
|
-
`,e.head.append(N),b.dataset.chiselMode=p.current,b.dataset.chiselCommentsHidden=String(E.current),d.dispatchEvent(new Event("chisel:mode")),d.addEventListener("chisel:selection",D=>{let O=D.detail;Ee(O),O.selector&&(b.dataset.chiselSelection=O.selector)});let J=()=>dt({x:d.scrollX,y:d.scrollY});J(),d.addEventListener("scroll",J),d.addEventListener("resize",()=>{Le(null),J()}),e.addEventListener("scroll",()=>{Le(null),J()},!0),e.addEventListener("mousemove",D=>{let O=D.target;Le(p.current==="comment"&&!E.current&&O?.nodeType===1?O.getBoundingClientRect():null)},!0),e.addEventListener("mouseleave",()=>Le(null)),e.addEventListener("keydown",D=>{D.key==="Escape"&&!he.current&&(de(null),v(null),Le(null),Ee(null),delete b.dataset.chiselSelection)}),e.addEventListener("click",async D=>{let O=D.target;if(!O||O.nodeType!==1||O.closest("[data-chisel-root]")||p.current==="view"||p.current==="comment"&&E.current||p.current==="comment"&&(D.preventDefault(),D.stopImmediatePropagation(),!await fe()))return;ve();let Ce=O.getBoundingClientRect(),le={x:D.clientX+d.scrollX,y:D.clientY+d.scrollY,selector:no(O),tag:O.tagName.toLowerCase(),offsetX:Ce.width?(D.clientX-Ce.left)/Ce.width:0,offsetY:Ce.height?(D.clientY-Ce.top)/Ce.height:0};Ee(le),b.dataset.chiselSelection=le.selector,p.current!=="edit"&&(D.preventDefault(),D.stopImmediatePropagation(),v(null),Xe(""),Le(null),ue(null),La.current=crypto.randomUUID(),de(le))},!0)}ke(()=>{let e=j?.defaultView;if(e)return Yt(e,d=>{if(!qe(d,window.location.origin))return;R(d),X(b=>b.includes(d)?b:[...b,d]);let f=new URL(window.location.href);d==="/"?f.searchParams.delete("path"):f.searchParams.set("path",d),window.history.replaceState(window.history.state,"",f)})},[j]),ke(()=>{j&&(j.documentElement.dataset.chiselCommentsHidden=String(re))},[re,j]),ke(()=>()=>W.current?.cancel(),[]),ke(()=>{if(!o)return;let e=!1,d,f=()=>{clearTimeout(d),d=setTimeout(()=>{d=void 0,b()},1e4)},b=async()=>{if(e||document.visibilityState==="hidden")return;if(he.current){f();return}clearTimeout(d),d=void 0;let D=++Me.current;try{let O=await o.list();!e&&D===Me.current&&(clearTimeout(d),d=void 0,k(O),pa(!1),Y(""))}catch{!e&&D===Me.current&&(pa(!1),Y("Shared comments could not be loaded. Check your connection; retrying automatically."),f())}};b();let N=o.subscribe?.(()=>{b()}),J=o.subscribe?void 0:window.setInterval(()=>{b()},1e4);return window.addEventListener("focus",b),document.addEventListener("visibilitychange",b),()=>{e=!0,clearTimeout(d),N?.(),window.clearInterval(J),window.removeEventListener("focus",b),document.removeEventListener("visibilitychange",b)}},[o]);let nt=s?.setPage;ke(()=>{nt?.(I)},[I,nt]),Fa(()=>{let e=te.current;e&&(e.style.height="auto",e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[ye,Q,i?.id,re,P,I]),Fa(()=>{let e=S.current?.parentElement,d=e?.querySelector(".comment-box");if(!L||!e||!d||re)return;let f=()=>{let N=lo(se(L),{width:d.offsetWidth,height:d.offsetHeight},{width:e.clientWidth,height:e.clientHeight});d.style.left=`${N.left}px`,d.style.top=`${N.top}px`,d.style.maxHeight=`${N.maxHeight}px`};f();let b=new ResizeObserver(f);return b.observe(d),b.observe(e),()=>b.disconnect()}),Fa(()=>{let e=x.current;if(!e||re||m.current?.playState==="running")return;let d=e.parentElement?.parentElement,f=d?.clientHeight??356,b=d?.clientWidth??416,N=Number(e.dataset.pinX),J=Number(e.dataset.pinY),D=Q?Math.max(8,Math.min(J-40,f-Math.min(340,f-16)-8)):Math.max(8,Math.min(J+32-e.offsetHeight,f-e.offsetHeight-8)),O=Q?N+44:N;e.style.left=`${Math.max(8,Math.min(O,b-e.offsetWidth-8))}px`,e.style.top=`${D}px`,e.style.maxHeight=`${f-D-8}px`}),Fa(()=>(U.current=!1,m.current=x.current&&!re?Aa(x.current):null,()=>{U.current=!1,m.current?.cancel()}),[i?.id,!!L,P,re,I]),ke(()=>{S.current?.contentDocument?.readyState==="complete"&&Ea()},[]),ke(()=>{let e=d=>{if(document.querySelector('dialog[open], [aria-modal="true"]'))return;let f=oo(d);if(!(!f||f===p.current||f==="edit"&&!Ra)){if(d.preventDefault(),d.stopPropagation(),f==="toggle-comments"){W.current?.cancel(),ve(),Ve(b=>!b);return}Ca(f)}};return document.addEventListener("keydown",e,!0),j?.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0),j?.removeEventListener("keydown",e,!0)}},[j]),ke(()=>{if(!i||we!==i.id||L||P==="edit"||i.path!==I||!i.selector||!j)return;let e;try{e=j.querySelector(i.selector)}catch{e=null}if(!e){He(null),Y("This element is no longer on the page. Its saved changes cannot be previewed.");return}let d=wa(e,i.changes??[]);return pe.current=d,dt({x:e.ownerDocument.defaultView.scrollX,y:e.ownerDocument.defaultView.scrollY}),d},[we,i,L,P,I,j]);let za=qa?y.filter(e=>e.id!==qa):y,ct=so(za,Ke,ca);return h("main",{"aria-label":"Chisel workspace",className:`feedback-shell ${c?.className??""} ${P==="edit"?"is-editing":""} ${re?"comments-hidden":""}`,children:[u(Za,{}),w,h("div",{className:"feedback-workspace",children:[h("section",{className:"feedback-canvas","aria-label":"Website preview",children:[h("div",{className:"feedback-viewport",children:[u("iframe",{ref:S,src:"/",title:"Website for feedback",onLoad:Ea}),h("div",{className:"feedback-comment-layer","data-hover-preview":!!(i&&!Q&&!L),hidden:re,children:[L&&Ie?.type!=="create"&&u("span",{className:"feedback-pin comment-box-draft-pin","aria-hidden":"true",style:{left:se(L).x,top:se(L).y}}),i&&!L&&P!=="edit"&&i.path===I&&h("section",{ref:x,hidden:qa===i.id,"data-pin-x":se(i).x,"data-pin-y":se(i).y,"data-pin-width":40+(Math.min(Ma(i).length,4)-1)*20,"data-expanded":Q,onPointerEnter:()=>{U.current||W.current?.cancel()},onPointerMove:Oa,onPointerLeave:()=>W.current?.schedule(),onFocus:Oa,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||W.current?.schedule()},"data-native-ui":!!c,className:"feedback-composer feedback-thread-popup comment-thread",role:"dialog","aria-label":"Comment thread",style:{left:`clamp(8px, ${se(i).x-4}px, calc(100% - 408px))`,top:`clamp(8px, ${se(i).y-4}px, calc(100% - ${Q?340:128}px))`},children:[!Q&&h("button",{type:"button",className:"feedback-hover-preview","aria-label":`Expand comment: ${i.text||i.attachments?.map(e=>e.name).join(", ")}`,onClick:()=>{ba(i)},children:[u("span",{className:"feedback-avatar",children:i.authorImage?u("img",{src:i.authorImage,alt:"",width:24,height:24}):i.author.slice(0,1).toUpperCase()}),h("span",{className:"feedback-hover-copy",children:[h("span",{className:"feedback-hover-byline",children:[u("strong",{children:i.author}),u("time",{dateTime:i.date,children:io(i.date)})]}),u("span",{className:"feedback-hover-message",children:i.text||i.attachments?.map(e=>e.name).join(", ")})]})]}),h("div",{className:"feedback-thread-content",hidden:!Q,children:[h("header",{className:"feedback-thread-header",children:[u(sa,{onMoveStart:()=>{T.current=null,W.current?.cancel(),Ia()}}),h("div",{className:"feedback-thread-header-actions",children:[u("button",{className:"feedback-thread-close",type:"button",title:lt,"aria-label":lt,"aria-busy":!!ga,disabled:me||!!o&&!l&&i.authorId!==a.id,onClick:()=>{xe({type:"resolve",id:i.id,resolved:!i.resolved})},children:ga?u(Ae,{size:18,className:"chisel-spin"}):i.resolved?u(ra,{size:18}):u(De,{size:18})}),(!o||o.delete)&&(!o||i.authorId===a.id||l)&&u("button",{className:"feedback-thread-close feedback-thread-delete",type:"button",title:"Delete comment","aria-label":"Delete comment",disabled:me,onClick:()=>{ko(i)},children:u(Be,{size:16})}),u("button",{className:"feedback-thread-close",type:"button",title:"Close thread","aria-label":"Close thread",onClick:st,children:u(la,{size:18})})]})]}),h("div",{className:"feedback-thread-summary",children:[!c&&_&&_.id===i.id?h("form",{onSubmit:async e=>{e.preventDefault(),await xe({type:"edit",id:i.id,text:_.text.trimEnd(),changes:i.changes??[]})&&(V.current=!1,ge(null))},children:[u("textarea",{"aria-label":"Edit comment",value:_.text,onChange:e=>{V.current=e.target.value!==_.original,ge({..._,text:e.target.value})}}),u("button",{type:"button",onClick:async()=>{V.current&&!await fe()||(V.current=!1,ge(null))},children:"Cancel"}),i.selector&&u("button",{type:"button",onClick:()=>{it(i)},children:"Edit styles"}),u("button",{type:"submit",disabled:me||!_.text.trim()&&!i.attachments?.length,children:"Save"})]}):!c&&h("button",{type:"button",className:"feedback-thread-summary-button","aria-label":`Expand comment: ${i.text}`,"aria-expanded":Q,onClick:Ia,children:[u("span",{className:"feedback-avatar",children:i.authorImage?u("img",{src:i.authorImage,alt:"",width:27,height:27}):i.author.slice(0,1).toUpperCase()}),h("span",{className:"feedback-thread-summary-copy",children:[h("span",{className:"feedback-thread-byline",children:[u("strong",{children:i.author}),u("time",{dateTime:i.date,children:new Date(i.date).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),u("span",{className:"feedback-thread-message",children:i.text}),!Q&&u("span",{className:"feedback-thread-reply-count",children:i.replies.length?`${i.replies.length} ${i.replies.length===1?"reply":"replies"}`:"Reply\u2026"})]})]}),!c&&i.authorId===a.id&&_?.id!==i.id&&u("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:me,onClick:async()=>{await fe()&&(ie(""),V.current=!1,ge({id:i.id,text:i.text,original:i.text}))},children:u(Ne,{size:16})})]}),!!i.changes?.length&&u("div",{className:"feedback-proposal-actions",children:h("button",{type:"button",className:"feedback-preview","aria-pressed":we===i.id,disabled:!i.selector,onClick:()=>{Y(""),He(we===i.id?null:i.id)},children:[u(Je,{size:16}),we===i.id?"Exit preview":"Preview changes"]})}),(Q||c)&&u(na,{children:c?c.renderThread({comment:i,expanded:Q,reply:ye,saving:me,submittingReply:Ie?.type==="reply"&&Ie.id===i.id,userId:a.id,onEditDraftChange:e=>{V.current=e},onDiscardEdit:fe,onBeginEdit:async()=>await fe()?(ie(""),oe.current=null,!0):!1,onEditStyles:i.selector?()=>{it(i)}:void 0,onEdit:(e,d,f)=>xe(e?{type:"edit_reply",id:i.id,replyId:e,text:d,body:f}:{type:"edit",id:i.id,text:d,changes:i.changes??[],body:f}),canResolve:!o||l||i.authorId===a.id,replyAuthor:a,onAttachmentDraftChange:e=>{Se.current=e},onReplyText:e=>{ie(e),oe.current=null},onReply:async(e,d,f,b)=>{if(!e.trim()&&!f?.length)return!1;let N=await xe({type:"reply",id:i.id,body:d,attachmentTokens:f,reply:{id:oe.current??(oe.current=crypto.randomUUID()),text:e.trimEnd(),author:a.name,authorId:a.id,authorImage:a.image}},b);return N&&(ie(""),oe.current=null),N},onResolve:()=>{xe({type:"resolve",id:i.id,resolved:!i.resolved})},onExpand:Ia}):h(na,{children:[u("div",{className:"feedback-thread-replies",children:i.replies.map((e,d)=>h("div",{className:"feedback-thread-reply",children:[u("span",{className:"feedback-avatar","aria-hidden":"true",children:(typeof e=="string"?"?":e.author.slice(0,1)).toUpperCase()}),h("div",{children:[typeof e!="string"&&u("strong",{children:e.author}),typeof e!="string"&&_&&_.id===e.id?h("form",{onSubmit:async f=>{f.preventDefault(),await xe({type:"edit_reply",id:i.id,replyId:_.id,text:_.text.trimEnd()})&&(V.current=!1,ge(null))},children:[u("textarea",{"aria-label":"Edit comment",value:_.text,onChange:f=>{V.current=f.target.value!==_.original,ge({..._,text:f.target.value})}}),u("button",{type:"button",onClick:async()=>{V.current&&!await fe()||(V.current=!1,ge(null))},children:"Cancel"}),u("button",{type:"submit",disabled:me||!_.text.trim()&&!e.attachments?.length,children:"Save"})]}):u("p",{children:typeof e=="string"?e:e.text})]}),typeof e!="string"&&e.id&&e.authorId===a.id&&_?.id!==e.id&&u("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:me,onClick:async()=>{await fe()&&(ie(""),V.current=!1,ge({id:e.id,text:e.text,original:e.text}))},children:u(Ne,{size:16})})]},d))}),h("form",{hidden:Ie?.type==="reply"&&Ie.id===i.id,onSubmit:async e=>{e.preventDefault(),ye.trim()&&await xe({type:"reply",id:i.id,reply:{id:oe.current??(oe.current=crypto.randomUUID()),text:ye.trimEnd(),author:a.name,authorId:a.id,authorImage:a.image}})&&(ie(""),oe.current=null)},children:[u("textarea",{ref:te,"aria-label":"Reply",rows:1,placeholder:"Write a reply\u2026",value:ye,maxLength:4e3,onChange:e=>{ie(e.target.value),oe.current=null},disabled:me,required:!0}),u("div",{className:"feedback-thread-actions",children:h("button",{type:"submit",className:"feedback-primary",disabled:me||!ye.trim(),"aria-label":"Reply",children:["Reply ",u(je,{})]})})]})]})})]})]},i.id),P==="comment"&&[Ta,se(L??i??ho??{x:0,y:0}).rect].map((e,d)=>e&&u("div",{"data-testid":d===0?"element-hover":"element-selection",className:`feedback-element-box ${d===1?"is-selected":""}`,style:{left:e.left,top:e.top,width:e.width,height:e.height}},d)),P!=="edit"&&za.filter(e=>e.path===I&&!e.resolved).map(e=>{let d=Ma(e);return h("button",{"aria-label":`Open comment: ${e.text}`,title:d.map(f=>f.author).join(", "),className:`feedback-pin ${d.length>1?"feedback-pin-group":""} ${Z===e.id?"selected":""}`,onPointerEnter:f=>{f.pointerType!=="touch"&&ft(e)},onPointerLeave:()=>W.current?.schedule(),style:{left:se(e).x,top:se(e).y},onClick:()=>ba(e),children:[d.slice(0,3).map((f,b)=>u("span",{className:"feedback-avatar","aria-hidden":"true",children:f.authorImage?u("img",{src:f.authorImage,alt:"",width:24,height:24}):f.author.slice(0,1).toUpperCase()},b)),d.length>3&&h("span",{className:"feedback-avatar feedback-pin-more","aria-hidden":"true",children:["+",d.length-3]})]},e.id)}),L?.selector&&j?.querySelector(L.selector)&&u(Va,{target:j.querySelector(L.selector),text:xo,onText:Xe,onDraftChange:e=>{Oe.current=e},hidden:Ie?.type==="create",editing:!!$,commentId:$??void 0,renderComposer:c?.renderComposer,changes:y.find(e=>e.id===$)?.changes,hasExistingAttachments:!!y.find(e=>e.id===$)?.attachments?.length,onCancel:()=>{de(null),Xe(""),ue(null)},onPost:(e,d,f,b,N)=>$?xe({type:"edit",id:$,text:d,changes:e,body:f,attachmentTokens:b}):xe({type:"create",body:f,attachmentTokens:b,comment:{id:La.current??(La.current=crypto.randomUUID()),path:I,...L,text:d,author:a.name,authorId:a.id,authorImage:a.image,date:new Date().toISOString(),resolved:!1,replies:[],changes:e}},N),style:{left:se(L).x+44,top:se(L).y}},`${L.selector}:${L.x}:${L.y}`)]})]}),h("div",{className:"feedback-toolbar","aria-label":"Preview mode",children:[Ra&&h("button",{title:"Edit styles","aria-keyshortcuts":"E","aria-pressed":P==="edit",onClick:()=>Ca("edit"),children:[u(Te,{}),u("span",{children:"Edit"})]}),h("button",{title:"Add comments","aria-keyshortcuts":"C","aria-pressed":P==="comment",onClick:()=>Ca("comment"),children:[u(ze,{}),u("span",{children:"Comment"})]}),h("button",{title:"View website","aria-keyshortcuts":"V","aria-pressed":P==="view",onClick:()=>Ca("view"),children:[u(ta,{}),u("span",{children:"View"})]})]})]}),u("aside",{className:"feedback-sidebar",hidden:P==="edit"||re,children:h("div",{className:"feedback-sidebar-panel",children:[h("div",{className:"feedback-sidebar-title",children:[h("h1",{children:["Comments ",u("span",{children:za.length})]}),h("details",{className:"feedback-account",children:[u("summary",{title:`Signed in as ${a.name}`,"aria-label":`Account: ${a.name}`,children:u("span",{className:"feedback-avatar",children:a.image?u("img",{src:a.image,alt:"",width:27,height:27}):a.name.slice(0,1).toUpperCase()})}),h("div",{children:[u("strong",{children:a.name}),u("span",{children:a.email}),h("button",{onClick:async()=>{try{await r(),window.location.reload()}catch{Y("Sign out failed. Please try again.")}},children:[u(aa,{}),"Sign out"]})]})]})]}),h("label",{className:"feedback-search",children:[u(da,{"aria-hidden":"true",size:18}),u("input",{type:"search","aria-label":"Search comments",placeholder:"Search",value:ca,onChange:e=>go(e.target.value)})]}),s&&(s.status!=="connected"||s.participants.length>0||s.unreadThreadIds.length>0)&&h("div",{className:"feedback-collaboration","aria-label":"Review activity",children:[s.status!=="connected"&&u("span",{role:"status",children:s.status==="connecting"||s.status==="initial"?"Connecting\u2026":"Reconnecting\u2026"}),u("div",{className:"feedback-reviewers",children:s.participants.map(e=>u("span",{className:"feedback-avatar",title:`${e.name} \xB7 ${e.path}`,"aria-label":`${e.name} is reviewing ${e.path}`,children:e.image?u("img",{src:e.image,alt:"",width:24,height:24}):e.name.slice(0,1).toUpperCase()},e.id))}),s.unreadThreadIds.length>0&&h("span",{className:"feedback-unread-count",children:[s.unreadThreadIds.length," unread"]})]}),u("div",{className:"feedback-tabs",role:"group","aria-label":"Filter comments",children:["open","resolved","all"].map(e=>u("button",{"aria-pressed":Ke===e,onClick:()=>Lo(e),children:e[0].toUpperCase()+e.slice(1)},e))}),Ja&&u("p",{role:"alert",className:"feedback-error",children:Ja}),h("div",{className:"feedback-comment-list",children:[ct.map(e=>u("article",{onPointerEnter:d=>{d.pointerType!=="touch"&&ft(e)},onPointerLeave:()=>W.current?.schedule(),className:`feedback-comment ${Z===e.id?"active":""}`,children:h("button",{className:"feedback-comment-main","aria-pressed":Z===e.id,onClick:()=>ba(e),children:[h("span",{className:"feedback-comment-heading",children:[u("span",{className:"feedback-avatar",children:e.authorImage?u("img",{src:e.authorImage,alt:"",width:28,height:28}):e.author.slice(0,1).toUpperCase()}),h("span",{className:"feedback-comment-identity",children:[h("span",{className:"feedback-comment-meta",children:[u("strong",{children:e.author}),e.pending?u("span",{role:"status",children:"Sending\u2026"}):u("time",{dateTime:e.date,children:new Date(e.date).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),h("span",{className:"feedback-comment-status",children:[Ke==="all"&&h(na,{children:[e.resolved?"Resolved":"Open",u("span",{"aria-hidden":"true",children:" \xB7 "})]}),u("span",{className:"feedback-comment-path",title:e.path,children:e.path})]})]}),s?.unreadThreadIds.includes(e.id)&&u("span",{className:"feedback-comment-unread-dot","aria-hidden":"true"})]}),u("span",{className:"feedback-comment-body",children:e.text||e.attachments?.map(d=>d.name).join(", ")}),(e.replies.length>0||s?.unreadThreadIds.includes(e.id))&&h("span",{className:"feedback-comment-activity",children:[e.replies.length>0&&h(na,{children:[u("span",{className:"feedback-comment-avatars",children:Ma(e).slice(1,4).map((d,f)=>u("span",{className:"feedback-avatar",title:d.author,children:d.authorImage?u("img",{src:d.authorImage,alt:"",width:20,height:20}):d.author.slice(0,1).toUpperCase()},f))}),h("span",{className:"feedback-comment-reply-count",children:[e.replies.length," ",e.replies.length===1?"reply":"replies"]})]}),s?.unreadThreadIds.includes(e.id)&&u("span",{className:"feedback-unread-label",children:e.replies.length?"New replies":"Unread"})]})]})},e.id)),Qa&&u("p",{role:"status",children:"Loading shared comments\u2026"}),!Qa&&!ct.length&&h("div",{className:"feedback-empty",children:[u("span",{children:u(ze,{size:30})}),u("h2",{children:ca.trim()?"No matching comments":Ke==="resolved"?"Nothing resolved yet":"No comments yet"}),u("p",{children:ca.trim()?"Try another name, phrase, or page.":Ke==="resolved"?"Resolved threads will appear here.":"Click anywhere on the page to leave your first comment."})]})]}),u(Ka,{path:I,disabled:me||!j,onNavigate:bo,onOpen:Co,routes:[...new Set([I,...q,...K,...y.map(e=>e.path)])].filter(e=>j&&qe(e,window.location.origin)).sort((e,d)=>e.localeCompare(d))}),n&&l&&h("details",{className:"feedback-review-invite",children:[h("summary",{children:[u(Re,{"aria-hidden":"true"}),"Share review link"]}),h("form",{onSubmit:e=>{e.preventDefault(),ut()},children:[u("p",{children:"Anyone with this link can sign in and review this website."}),u("button",{type:"submit",className:"feedback-primary",disabled:ha,children:ha?"Preparing link\u2026":"Copy review link"}),at&&h(na,{children:[u("input",{"aria-label":"Review link",value:at,readOnly:!0,onFocus:e=>e.currentTarget.select()}),u("button",{type:"button",onClick:()=>{ut(!0)},disabled:ha,children:"Replace invitation link"}),u("p",{children:"Replacing the link blocks new joins through the old link. Existing reviewers keep access."})]}),ot&&u("p",{role:"status",children:ot})]})]})]})})]})]})}import{jsx as Wo}from"react/jsx-runtime";import{useEffect as po,useSyncExternalStore as Vo}from"react";import{Chisel as Xo}from"use-chisel";function Ko(a){return window.addEventListener("chisel:mode",a),()=>window.removeEventListener("chisel:mode",a)}function $o(){try{return window.self!==window.top&&window.parent.location.origin===window.location.origin&&window.parent.location.pathname==="/chisel"?document.documentElement.dataset.chiselMode??"view":"site"}catch{return"site"}}function Zo({projectName:a="Chisel"}){let t=Vo(Ko,$o,()=>"site");return po(()=>{process.env.NEXT_PUBLIC_CHISEL_ENABLED!=="0"&&(window.chiselReady=!0,document.dispatchEvent(new Event("chisel:ready")))},[]),po(()=>{if(t!=="edit")return;let r=window.setTimeout(()=>window.dispatchEvent(new Event("chisel:select")),50);return()=>window.clearTimeout(r)},[t]),t==="site"||process.env.NODE_ENV==="production"||process.env.NEXT_PUBLIC_CHISEL_ENABLED==="0"?null:Wo(Xo,{embedded:!0,enabled:t==="edit",projectName:a})}export{Zo as ChiselPreview,co as ChiselWorkspace,Za as ChiselWorkspaceStyles};
|
|
359
|
+
`,e.head.append(N),C.dataset.chiselMode=p.current,C.dataset.chiselCommentsHidden=String(E.current),d.dispatchEvent(new Event("chisel:mode")),d.addEventListener("chisel:selection",D=>{let q=D.detail;ze(q),q.selector&&(C.dataset.chiselSelection=q.selector)});let J=()=>lt({x:d.scrollX,y:d.scrollY});J(),d.addEventListener("scroll",J),d.addEventListener("resize",()=>{Le(null),J()}),e.addEventListener("scroll",()=>{Le(null),J()},!0),e.addEventListener("mousemove",D=>{let q=D.target;Le(p.current==="comment"&&!E.current&&q?.nodeType===1?q.getBoundingClientRect():null)},!0),e.addEventListener("mouseleave",()=>Le(null)),e.addEventListener("keydown",D=>{D.key==="Escape"&&!he.current&&(de(null),v(null),Le(null),ze(null),delete C.dataset.chiselSelection)}),e.addEventListener("click",async D=>{let q=D.target;if(!q||q.nodeType!==1||q.closest("[data-chisel-root]")||p.current==="view"||p.current==="comment"&&E.current)return;let Ce=q.getBoundingClientRect(),le=Ce.width?(D.clientX-Ce.left)/Ce.width:-1,Fe=Ce.height?(D.clientY-Ce.top)/Ce.height:-1,wo=q!==e.body&&q!==C&&le>=0&&le<=1&&Fe>=0&&Fe<=1,Sa={x:D.clientX+d.scrollX,y:D.clientY+d.scrollY,...wo?{selector:co(q),tag:q.tagName.toLowerCase(),offsetX:le,offsetY:Fe}:{}};p.current==="comment"&&(D.preventDefault(),D.stopImmediatePropagation(),!await fe())||(ve(),ze(Sa),Sa.selector?C.dataset.chiselSelection=Sa.selector:delete C.dataset.chiselSelection,p.current!=="edit"&&(D.preventDefault(),D.stopImmediatePropagation(),v(null),Ke(""),Le(null),ue(null),ga.current=crypto.randomUUID(),de(Sa)))},!0)}ke(()=>{let e=j?.defaultView;if(e)return eo(e,d=>{if(!Ue(d,window.location.origin))return;R(d),X(C=>C.includes(d)?C:[...C,d]);let f=new URL(window.location.href);d==="/"?f.searchParams.delete("path"):f.searchParams.set("path",d),window.history.replaceState(window.history.state,"",f)})},[j]),ke(()=>{j&&(j.documentElement.dataset.chiselCommentsHidden=String(re))},[re,j]),ke(()=>()=>W.current?.cancel(),[]),ke(()=>{if(!o)return;let e=!1,d,f=()=>{clearTimeout(d),d=setTimeout(()=>{d=void 0,C()},1e4)},C=async()=>{if(e||document.visibilityState==="hidden")return;if(he.current){f();return}clearTimeout(d),d=void 0;let D=++Me.current;try{let q=await o.list();!e&&D===Me.current&&(clearTimeout(d),d=void 0,k(q),ma(!1),Y(""))}catch{!e&&D===Me.current&&(ma(!1),Y("Shared comments could not be loaded. Check your connection; retrying automatically."),f())}};C();let N=o.subscribe?.(()=>{C()}),J=o.subscribe?void 0:window.setInterval(()=>{C()},1e4);return window.addEventListener("focus",C),document.addEventListener("visibilitychange",C),()=>{e=!0,clearTimeout(d),N?.(),window.clearInterval(J),window.removeEventListener("focus",C),document.removeEventListener("visibilitychange",C)}},[o]);let ct=s?.setPage;ke(()=>{ct?.(I)},[I,ct]),Ta(()=>{let e=te.current;e&&(e.style.height="auto",e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[ye,Q,i?.id,re,P,I]),Ta(()=>{let e=S.current?.parentElement,d=e?.querySelector(".comment-box");if(!L||!e||!d||re)return;let f=()=>{let N=uo(se(L),{width:d.offsetWidth,height:d.offsetHeight},{width:e.clientWidth,height:e.clientHeight});d.style.left=`${N.left}px`,d.style.top=`${N.top}px`,d.style.maxHeight=`${N.maxHeight}px`};f();let C=new ResizeObserver(f);return C.observe(d),C.observe(e),()=>C.disconnect()}),Ta(()=>{let e=x.current;if(!e||re||m.current?.playState==="running")return;let d=e.parentElement?.parentElement,f=d?.clientHeight??356,C=d?.clientWidth??416,N=Number(e.dataset.pinX),J=Number(e.dataset.pinY),D=Q?Math.max(8,Math.min(J-40,f-Math.min(340,f-16)-8)):Math.max(8,Math.min(J+32-e.offsetHeight,f-e.offsetHeight-8)),q=Q?N+44:N;e.style.left=`${Math.max(8,Math.min(q,C-e.offsetWidth-8))}px`,e.style.top=`${D}px`,e.style.maxHeight=`${f-D-8}px`}),Ta(()=>(H.current=!1,m.current=x.current&&!re?Ma(x.current):null,()=>{H.current=!1,m.current?.cancel()}),[i?.id,!!L,P,re,I]),ke(()=>{S.current?.contentDocument?.readyState==="complete"&&Na()},[]),ke(()=>{let e=d=>{if(document.querySelector('dialog[open], [aria-modal="true"]'))return;let f=ro(d);if(!(!f||f===p.current||f==="edit"&&!qa)){if(d.preventDefault(),d.stopPropagation(),f==="toggle-comments"){W.current?.cancel(),ve(),Xe(C=>!C);return}ba(f)}};return document.addEventListener("keydown",e,!0),j?.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0),j?.removeEventListener("keydown",e,!0)}},[j]),ke(()=>{if(!i||we!==i.id||L||P==="edit"||i.path!==I||!i.selector||!j)return;let e;try{e=j.querySelector(i.selector)}catch{e=null}if(!e){Oe(null),Y("This element is no longer on the page. Its saved changes cannot be previewed.");return}let d=va(e,i.changes??[]);return pe.current=d,lt({x:e.ownerDocument.defaultView.scrollX,y:e.ownerDocument.defaultView.scrollY}),d},[we,i,L,P,I,j]);let Ga=Ha?y.filter(e=>e.id!==Ha):y,pt=io(Ga,$e,pa);return h("main",{"aria-label":"Chisel workspace",className:`feedback-shell ${c?.className??""} ${P==="edit"?"is-editing":""} ${re?"comments-hidden":""}`,children:[u(ja,{}),w,h("div",{className:"feedback-workspace",children:[h("section",{className:"feedback-canvas","aria-label":"Website preview",children:[h("div",{className:"feedback-viewport",children:[u("iframe",{ref:S,src:"/",title:"Website for feedback",onLoad:Na}),h("div",{className:"feedback-comment-layer","data-hover-preview":!!(i&&!Q&&!L),hidden:re,children:[L&&Ie?.type!=="create"&&u("span",{className:"feedback-pin comment-box-draft-pin","aria-hidden":"true",style:{left:se(L).x,top:se(L).y}}),i&&!L&&P!=="edit"&&i.path===I&&h("section",{ref:x,hidden:Ha===i.id,"data-pin-x":se(i).x,"data-pin-y":se(i).y,"data-pin-width":40+(Math.min(Ra(i).length,4)-1)*20,"data-expanded":Q,onPointerEnter:()=>{H.current||W.current?.cancel()},onPointerMove:za,onPointerLeave:()=>W.current?.schedule(),onFocus:za,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||W.current?.schedule()},"data-native-ui":!!c,className:"feedback-composer feedback-thread-popup comment-thread",role:"dialog","aria-label":"Comment thread",style:{left:`clamp(8px, ${se(i).x-4}px, calc(100% - 408px))`,top:`clamp(8px, ${se(i).y-4}px, calc(100% - ${Q?340:128}px))`},children:[!Q&&h("button",{type:"button",className:"feedback-hover-preview","aria-label":`Expand comment: ${i.text||i.attachments?.map(e=>e.name).join(", ")}`,onClick:()=>{ka(i)},children:[u("span",{className:"feedback-avatar",children:i.authorImage?u("img",{src:i.authorImage,alt:"",width:24,height:24}):i.author.slice(0,1).toUpperCase()}),h("span",{className:"feedback-hover-copy",children:[h("span",{className:"feedback-hover-byline",children:[u("strong",{children:i.author}),u("time",{dateTime:i.date,children:fo(i.date)})]}),u("span",{className:"feedback-hover-message",children:i.text||i.attachments?.map(e=>e.name).join(", ")})]})]}),h("div",{className:"feedback-thread-content",hidden:!Q,children:[h("header",{className:"feedback-thread-header",children:[u(ia,{onMoveStart:()=>{T.current=null,W.current?.cancel(),Ca()}}),h("div",{className:"feedback-thread-header-actions",children:[u("button",{className:"feedback-thread-close",type:"button",title:ut,"aria-label":ut,"aria-busy":!!Ia,disabled:me||!!o&&!l&&i.authorId!==a.id,onClick:()=>{xe({type:"resolve",id:i.id,resolved:!i.resolved})},children:Ia?u(Ae,{size:18,className:"chisel-spin"}):i.resolved?u(da,{size:18}):u(De,{size:18})}),(!o||o.delete)&&(!o||i.authorId===a.id||l)&&u("button",{className:"feedback-thread-close feedback-thread-delete",type:"button",title:"Delete comment","aria-label":"Delete comment",disabled:me,onClick:()=>{So(i)},children:u(Be,{size:16})}),u("button",{className:"feedback-thread-close",type:"button",title:"Close thread","aria-label":"Close thread",onClick:it,children:u(ua,{size:18})})]})]}),h("div",{className:"feedback-thread-summary",children:[!c&&_&&_.id===i.id?h("form",{onSubmit:async e=>{e.preventDefault(),await xe({type:"edit",id:i.id,text:_.text.trimEnd(),changes:i.changes??[]})&&(V.current=!1,ge(null))},children:[u("textarea",{"aria-label":"Edit comment",value:_.text,onChange:e=>{V.current=e.target.value!==_.original,ge({..._,text:e.target.value})}}),u("button",{type:"button",onClick:async()=>{V.current&&!await fe()||(V.current=!1,ge(null))},children:"Cancel"}),i.selector&&u("button",{type:"button",onClick:()=>{ft(i)},children:"Edit styles"}),u("button",{type:"submit",disabled:me||!_.text.trim()&&!i.attachments?.length,children:"Save"})]}):!c&&h("button",{type:"button",className:"feedback-thread-summary-button","aria-label":`Expand comment: ${i.text}`,"aria-expanded":Q,onClick:Ca,children:[u("span",{className:"feedback-avatar",children:i.authorImage?u("img",{src:i.authorImage,alt:"",width:27,height:27}):i.author.slice(0,1).toUpperCase()}),h("span",{className:"feedback-thread-summary-copy",children:[h("span",{className:"feedback-thread-byline",children:[u("strong",{children:i.author}),u("time",{dateTime:i.date,children:new Date(i.date).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),u("span",{className:"feedback-thread-message",children:i.text}),!Q&&u("span",{className:"feedback-thread-reply-count",children:i.replies.length?`${i.replies.length} ${i.replies.length===1?"reply":"replies"}`:"Reply\u2026"})]})]}),!c&&i.authorId===a.id&&_?.id!==i.id&&u("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:me,onClick:async()=>{await fe()&&(ie(""),V.current=!1,ge({id:i.id,text:i.text,original:i.text}))},children:u(Ge,{size:16})})]}),!!i.changes?.length&&u("div",{className:"feedback-proposal-actions",children:h("button",{type:"button",className:"feedback-preview","aria-pressed":we===i.id,disabled:!i.selector,onClick:()=>{Y(""),Oe(we===i.id?null:i.id)},children:[u(Qe,{size:16}),we===i.id?"Exit preview":"Preview changes"]})}),(Q||c)&&u(ca,{children:c?c.renderThread({comment:i,expanded:Q,reply:ye,saving:me,submittingReply:Ie?.type==="reply"&&Ie.id===i.id,userId:a.id,onEditDraftChange:e=>{V.current=e},onDiscardEdit:fe,onBeginEdit:async()=>await fe()?(ie(""),oe.current=null,!0):!1,onEditStyles:i.selector?()=>{ft(i)}:void 0,onEdit:(e,d,f)=>xe(e?{type:"edit_reply",id:i.id,replyId:e,text:d,body:f}:{type:"edit",id:i.id,text:d,changes:i.changes??[],body:f}),canResolve:!o||l||i.authorId===a.id,replyAuthor:a,onAttachmentDraftChange:e=>{Se.current=e},onReplyText:e=>{ie(e),oe.current=null},onReply:async(e,d,f,C)=>{if(!e.trim()&&!f?.length)return!1;let N=await xe({type:"reply",id:i.id,body:d,attachmentTokens:f,reply:{id:oe.current??(oe.current=crypto.randomUUID()),text:e.trimEnd(),author:a.name,authorId:a.id,authorImage:a.image}},C);return N&&(ie(""),oe.current=null),N},onResolve:()=>{xe({type:"resolve",id:i.id,resolved:!i.resolved})},onExpand:Ca}):h(ca,{children:[u("div",{className:"feedback-thread-replies",children:i.replies.map((e,d)=>h("div",{className:"feedback-thread-reply",children:[u("span",{className:"feedback-avatar","aria-hidden":"true",children:(typeof e=="string"?"?":e.author.slice(0,1)).toUpperCase()}),h("div",{children:[typeof e!="string"&&u("strong",{children:e.author}),typeof e!="string"&&_&&_.id===e.id?h("form",{onSubmit:async f=>{f.preventDefault(),await xe({type:"edit_reply",id:i.id,replyId:_.id,text:_.text.trimEnd()})&&(V.current=!1,ge(null))},children:[u("textarea",{"aria-label":"Edit comment",value:_.text,onChange:f=>{V.current=f.target.value!==_.original,ge({..._,text:f.target.value})}}),u("button",{type:"button",onClick:async()=>{V.current&&!await fe()||(V.current=!1,ge(null))},children:"Cancel"}),u("button",{type:"submit",disabled:me||!_.text.trim()&&!e.attachments?.length,children:"Save"})]}):u("p",{children:typeof e=="string"?e:e.text})]}),typeof e!="string"&&e.id&&e.authorId===a.id&&_?.id!==e.id&&u("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:me,onClick:async()=>{await fe()&&(ie(""),V.current=!1,ge({id:e.id,text:e.text,original:e.text}))},children:u(Ge,{size:16})})]},d))}),h("form",{hidden:Ie?.type==="reply"&&Ie.id===i.id,onSubmit:async e=>{e.preventDefault(),ye.trim()&&await xe({type:"reply",id:i.id,reply:{id:oe.current??(oe.current=crypto.randomUUID()),text:ye.trimEnd(),author:a.name,authorId:a.id,authorImage:a.image}})&&(ie(""),oe.current=null)},children:[u("textarea",{ref:te,"aria-label":"Reply",rows:1,placeholder:"Write a reply\u2026",value:ye,maxLength:4e3,onChange:e=>{ie(e.target.value),oe.current=null},disabled:me,required:!0}),u("div",{className:"feedback-thread-actions",children:h("button",{type:"submit",className:"feedback-primary",disabled:me||!ye.trim(),"aria-label":"Reply",children:["Reply ",u(_e,{})]})})]})]})})]})]},i.id),P==="comment"&&[Ua,se(L??i??xo??{x:0,y:0}).rect].map((e,d)=>e&&u("div",{"data-testid":d===0?"element-hover":"element-selection",className:`feedback-element-box ${d===1?"is-selected":""}`,style:{left:e.left,top:e.top,width:e.width,height:e.height}},d)),P!=="edit"&&Ga.filter(e=>e.path===I&&!e.resolved).map(e=>{let d=Ra(e);return h("button",{"aria-label":`Open comment: ${e.text}`,title:d.map(f=>f.author).join(", "),className:`feedback-pin ${d.length>1?"feedback-pin-group":""} ${Z===e.id?"selected":""}`,onPointerEnter:f=>{f.pointerType!=="touch"&&nt(e)},onPointerLeave:()=>W.current?.schedule(),style:{left:se(e).x,top:se(e).y},onClick:()=>ka(e),children:[d.slice(0,3).map((f,C)=>u("span",{className:"feedback-avatar","aria-hidden":"true",children:f.authorImage?u("img",{src:f.authorImage,alt:"",width:24,height:24}):f.author.slice(0,1).toUpperCase()},C)),d.length>3&&h("span",{className:"feedback-avatar feedback-pin-more","aria-hidden":"true",children:["+",d.length-3]})]},e.id)}),L&&j&&u(Xa,{target:L.selector?j.querySelector(L.selector):null,text:Lo,onText:Ke,onDraftChange:e=>{Ee.current=e},hidden:Ie?.type==="create",editing:!!$,commentId:$??void 0,renderComposer:c?.renderComposer,changes:y.find(e=>e.id===$)?.changes,hasExistingAttachments:!!y.find(e=>e.id===$)?.attachments?.length,onCancel:()=>{de(null),Ke(""),ue(null)},onPost:(e,d,f,C,N)=>$?xe({type:"edit",id:$,text:d,changes:e,body:f,attachmentTokens:C}):xe({type:"create",body:f,attachmentTokens:C,comment:{id:ga.current??(ga.current=crypto.randomUUID()),path:I,...L,text:d,author:a.name,authorId:a.id,authorImage:a.image,date:new Date().toISOString(),resolved:!1,replies:[],changes:e}},N),style:{left:se(L).x+44,top:se(L).y}},`${L.selector}:${L.x}:${L.y}`)]})]}),h("div",{className:"feedback-toolbar","aria-label":"Preview mode",children:[qa&&h("button",{title:"Edit styles","aria-keyshortcuts":"E","aria-pressed":P==="edit",onClick:()=>ba("edit"),children:[u(qe,{}),u("span",{children:"Edit"})]}),h("button",{title:"Add comments","aria-keyshortcuts":"C","aria-pressed":P==="comment",onClick:()=>ba("comment"),children:[u(Ne,{}),u("span",{children:"Comment"})]}),h("button",{title:"View website","aria-keyshortcuts":"V","aria-pressed":P==="view",onClick:()=>ba("view"),children:[u(oa,{}),u("span",{children:"View"})]})]})]}),u("aside",{className:"feedback-sidebar",hidden:P==="edit"||re,children:h("div",{className:"feedback-sidebar-panel",children:[h("div",{className:"feedback-sidebar-title",children:[h("h1",{children:["Comments ",u("span",{children:Ga.length})]}),h("details",{className:"feedback-account",children:[u("summary",{title:`Signed in as ${a.name}`,"aria-label":`Account: ${a.name}`,children:u("span",{className:"feedback-avatar",children:a.image?u("img",{src:a.image,alt:"",width:27,height:27}):a.name.slice(0,1).toUpperCase()})}),h("div",{children:[u("strong",{children:a.name}),u("span",{children:a.email}),h("button",{onClick:async()=>{try{await r(),window.location.reload()}catch{Y("Sign out failed. Please try again.")}},children:[u(ta,{}),"Sign out"]})]})]})]}),h("label",{className:"feedback-search",children:[u(la,{"aria-hidden":"true",size:18}),u("input",{type:"search","aria-label":"Search comments",placeholder:"Search",value:pa,onChange:e=>Io(e.target.value)})]}),s&&(s.status!=="connected"||s.participants.length>0||s.unreadThreadIds.length>0)&&h("div",{className:"feedback-collaboration","aria-label":"Review activity",children:[s.status!=="connected"&&u("span",{role:"status",children:s.status==="connecting"||s.status==="initial"?"Connecting\u2026":"Reconnecting\u2026"}),u("div",{className:"feedback-reviewers",children:s.participants.map(e=>u("span",{className:"feedback-avatar",title:`${e.name} \xB7 ${e.path}`,"aria-label":`${e.name} is reviewing ${e.path}`,children:e.image?u("img",{src:e.image,alt:"",width:24,height:24}):e.name.slice(0,1).toUpperCase()},e.id))}),s.unreadThreadIds.length>0&&h("span",{className:"feedback-unread-count",children:[s.unreadThreadIds.length," unread"]})]}),u("div",{className:"feedback-tabs",role:"group","aria-label":"Filter comments",children:["open","resolved","all"].map(e=>u("button",{"aria-pressed":$e===e,onClick:()=>go(e),children:e[0].toUpperCase()+e.slice(1)},e))}),Qa&&u("p",{role:"alert",className:"feedback-error",children:Qa}),h("div",{className:"feedback-comment-list",children:[pt.map(e=>u("article",{onPointerEnter:d=>{d.pointerType!=="touch"&&nt(e)},onPointerLeave:()=>W.current?.schedule(),className:`feedback-comment ${Z===e.id?"active":""}`,children:h("button",{className:"feedback-comment-main","aria-pressed":Z===e.id,onClick:()=>ka(e),children:[h("span",{className:"feedback-comment-heading",children:[u("span",{className:"feedback-avatar",children:e.authorImage?u("img",{src:e.authorImage,alt:"",width:28,height:28}):e.author.slice(0,1).toUpperCase()}),h("span",{className:"feedback-comment-identity",children:[h("span",{className:"feedback-comment-meta",children:[u("strong",{children:e.author}),e.pending?u("span",{role:"status",children:"Sending\u2026"}):u("time",{dateTime:e.date,children:new Date(e.date).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),h("span",{className:"feedback-comment-status",children:[$e==="all"&&h(ca,{children:[e.resolved?"Resolved":"Open",u("span",{"aria-hidden":"true",children:" \xB7 "})]}),u("span",{className:"feedback-comment-path",title:e.path,children:e.path})]})]}),s?.unreadThreadIds.includes(e.id)&&u("span",{className:"feedback-comment-unread-dot","aria-hidden":"true"})]}),u("span",{className:"feedback-comment-body",children:e.text||e.attachments?.map(d=>d.name).join(", ")}),(e.replies.length>0||s?.unreadThreadIds.includes(e.id))&&h("span",{className:"feedback-comment-activity",children:[e.replies.length>0&&h(ca,{children:[u("span",{className:"feedback-comment-avatars",children:Ra(e).slice(1,4).map((d,f)=>u("span",{className:"feedback-avatar",title:d.author,children:d.authorImage?u("img",{src:d.authorImage,alt:"",width:20,height:20}):d.author.slice(0,1).toUpperCase()},f))}),h("span",{className:"feedback-comment-reply-count",children:[e.replies.length," ",e.replies.length===1?"reply":"replies"]})]}),s?.unreadThreadIds.includes(e.id)&&u("span",{className:"feedback-unread-label",children:e.replies.length?"New replies":"Unread"})]})]})},e.id)),Ya&&u("p",{role:"status",children:"Loading shared comments\u2026"}),!Ya&&!pt.length&&h("div",{className:"feedback-empty",children:[u("span",{children:u(Ne,{size:30})}),u("h2",{children:pa.trim()?"No matching comments":$e==="resolved"?"Nothing resolved yet":"No comments yet"}),u("p",{children:pa.trim()?"Try another name, phrase, or page.":$e==="resolved"?"Resolved threads will appear here.":"Click anywhere on the page to leave your first comment."})]})]}),u($a,{path:I,disabled:me||!j,onNavigate:ko,onOpen:bo,routes:[...new Set([I,...U,...K,...y.map(e=>e.path)])].filter(e=>j&&Ue(e,window.location.origin)).sort((e,d)=>e.localeCompare(d))}),n&&l&&h("details",{className:"feedback-review-invite",children:[h("summary",{children:[u(Te,{"aria-hidden":"true"}),"Share review link"]}),h("form",{onSubmit:e=>{e.preventDefault(),st()},children:[u("p",{children:"Anyone with this link can sign in and review this website."}),u("button",{type:"submit",className:"feedback-primary",disabled:xa,children:xa?"Preparing link\u2026":"Copy review link"}),tt&&h(ca,{children:[u("input",{"aria-label":"Review link",value:tt,readOnly:!0,onFocus:e=>e.currentTarget.select()}),u("button",{type:"button",onClick:()=>{st(!0)},disabled:xa,children:"Replace invitation link"}),u("p",{children:"Replacing the link blocks new joins through the old link. Existing reviewers keep access."})]}),rt&&u("p",{role:"status",children:rt})]})]})]})})]})]})}import{jsx as Xo}from"react/jsx-runtime";import{useEffect as mo,useSyncExternalStore as Ko}from"react";import{Chisel as $o}from"use-chisel";function Zo(a){return window.addEventListener("chisel:mode",a),()=>window.removeEventListener("chisel:mode",a)}function jo(){try{return window.self!==window.top&&window.parent.location.origin===window.location.origin&&window.parent.location.pathname==="/chisel"?document.documentElement.dataset.chiselMode??"view":"site"}catch{return"site"}}function _o({projectName:a="Chisel"}){let t=Ko(Zo,jo,()=>"site");return mo(()=>{process.env.NEXT_PUBLIC_CHISEL_ENABLED!=="0"&&(window.chiselReady=!0,document.dispatchEvent(new Event("chisel:ready")))},[]),mo(()=>{if(t!=="edit")return;let r=window.setTimeout(()=>window.dispatchEvent(new Event("chisel:select")),50);return()=>window.clearTimeout(r)},[t]),t==="site"||process.env.NODE_ENV==="production"||process.env.NEXT_PUBLIC_CHISEL_ENABLED==="0"?null:Xo($o,{embedded:!0,enabled:t==="edit",projectName:a})}export{_o as ChiselPreview,po as ChiselWorkspace,ja as ChiselWorkspaceStyles};
|
|
360
360
|
/*! Bundled license information:
|
|
361
361
|
|
|
362
362
|
lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs:
|