@bitvea/feedback-toolbar 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/PinLayer.d.ts.map +1 -1
- package/dist/PinLayer.js +10 -1
- package/dist/PinLayer.js.map +1 -1
- package/dist/browser/toolbar.js +1 -1
- package/dist/browser/toolbar.js.map +2 -2
- package/dist/cli/init.js +1 -1
- package/dist/cli/register.d.ts +29 -0
- package/dist/cli/register.d.ts.map +1 -1
- package/dist/cli/register.js +41 -0
- package/dist/cli/register.js.map +1 -1
- package/dist/cli/registration.d.ts +6 -0
- package/dist/cli/registration.d.ts.map +1 -1
- package/dist/cli/registration.js +1 -0
- package/dist/cli/registration.js.map +1 -1
- package/dist/vendor/types/project.d.ts +1 -0
- package/dist/vendor/types/project.d.ts.map +1 -1
- package/dist/vendor/types/project.js +16 -0
- package/dist/vendor/types/project.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/toolbar.js
CHANGED
|
@@ -34,5 +34,5 @@ Error generating stack: `+i.message+`
|
|
|
34
34
|
`))+1))}let a="#".repeat(r),o=n.enter("headingAtx"),u=n.enter("phrasing");l.move(a+" ");let s=n.containerPhrasing(t,{before:"# ",after:`
|
|
35
35
|
`,...l.current()});return/^[\t ]/.test(s)&&(s=Xi(s.charCodeAt(0))+s.slice(1)),s=s?a+" "+s:a,n.options.closeAtx&&(s+=" "+a),u(),o(),s}Tm.peek=iO;function Tm(t){return t.value||""}function iO(){return"<"}Em.peek=rO;function Em(t,e,n,i){let r=Ll(n),l=r==='"'?"Quote":"Apostrophe",a=n.enter("image"),o=n.enter("label"),u=n.createTracker(i),s=u.move("![");return s+=u.move(n.safe(t.alt,{before:s,after:"]",...u.current()})),s+=u.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),s+=u.move("<"),s+=u.move(n.safe(t.url,{before:s,after:">",...u.current()})),s+=u.move(">")):(o=n.enter("destinationRaw"),s+=u.move(n.safe(t.url,{before:s,after:t.title?" ":")",...u.current()}))),o(),t.title&&(o=n.enter(`title${l}`),s+=u.move(" "+r),s+=u.move(n.safe(t.title,{before:s,after:r,...u.current()})),s+=u.move(r),o()),s+=u.move(")"),a(),s}function rO(){return"!"}Cm.peek=lO;function Cm(t,e,n,i){let r=t.referenceType,l=n.enter("imageReference"),a=n.enter("label"),o=n.createTracker(i),u=o.move("!["),s=n.safe(t.alt,{before:u,after:"]",...o.current()});u+=o.move(s+"]["),a();let c=n.stack;n.stack=[],a=n.enter("reference");let f=n.safe(n.associationId(t),{before:u,after:"]",...o.current()});return a(),n.stack=c,l(),r==="full"||!s||s!==f?u+=o.move(f+"]"):r==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function lO(){return"!"}Am.peek=aO;function Am(t,e,n){let i=t.value||"",r="`",l=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(i);)r+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++l<n.unsafe.length;){let a=n.unsafe[l],o=n.compilePattern(a),u;if(a.atBreak)for(;u=o.exec(i);){let s=u.index;i.charCodeAt(s)===10&&i.charCodeAt(s-1)===13&&s--,i=i.slice(0,s)+" "+i.slice(u.index+1)}}return r+i+r}function aO(){return"`"}function Mm(t,e){let n=xr(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Om.peek=oO;function Om(t,e,n,i){let r=Ll(n),l=r==='"'?"Quote":"Apostrophe",a=n.createTracker(i),o,u;if(Mm(t,n)){let c=n.stack;n.stack=[],o=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(t,{before:f,after:">",...a.current()})),f+=a.move(">"),o(),n.stack=c,f}o=n.enter("link"),u=n.enter("label");let s=a.move("[");return s+=a.move(n.containerPhrasing(t,{before:s,after:"](",...a.current()})),s+=a.move("]("),u(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),s+=a.move("<"),s+=a.move(n.safe(t.url,{before:s,after:">",...a.current()})),s+=a.move(">")):(u=n.enter("destinationRaw"),s+=a.move(n.safe(t.url,{before:s,after:t.title?" ":")",...a.current()}))),u(),t.title&&(u=n.enter(`title${l}`),s+=a.move(" "+r),s+=a.move(n.safe(t.title,{before:s,after:r,...a.current()})),s+=a.move(r),u()),s+=a.move(")"),o(),s}function oO(t,e,n){return Mm(t,n)?"<":"["}Dm.peek=uO;function Dm(t,e,n,i){let r=t.referenceType,l=n.enter("linkReference"),a=n.enter("label"),o=n.createTracker(i),u=o.move("["),s=n.containerPhrasing(t,{before:u,after:"]",...o.current()});u+=o.move(s+"]["),a();let c=n.stack;n.stack=[],a=n.enter("reference");let f=n.safe(n.associationId(t),{before:u,after:"]",...o.current()});return a(),n.stack=c,l(),r==="full"||!s||s!==f?u+=o.move(f+"]"):r==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function uO(){return"["}function Bl(t){let e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function pS(t){let e=Bl(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function mS(t){let e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function Vs(t){let e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function hS(t,e,n,i){let r=n.enter("list"),l=n.bulletCurrent,a=t.ordered?mS(n):Bl(n),o=t.ordered?a==="."?")":".":pS(n),u=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){let c=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),Vs(n)===a&&c){let f=-1;for(;++f<t.children.length;){let d=t.children[f];if(d&&d.type==="listItem"&&d.children&&d.children[0]&&d.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(a=o),n.bulletCurrent=a;let s=n.containerFlow(t,i);return n.bulletLastUsed=a,n.bulletCurrent=l,r(),s}function gS(t){let e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function yS(t,e,n,i){let r=gS(n),l=n.bulletCurrent||Bl(n);e&&e.type==="list"&&e.ordered&&(l=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+l);let a=l.length+1;(r==="tab"||r==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);let o=n.createTracker(i);o.move(l+" ".repeat(a-l.length)),o.shift(a);let u=n.enter("listItem"),s=n.indentLines(n.containerFlow(t,o.current()),c);return u(),s;function c(f,d,p){return d?(p?"":" ".repeat(a))+f:(p?l:l+" ".repeat(a-l.length))+f}}function bS(t,e,n,i){let r=n.enter("paragraph"),l=n.enter("phrasing"),a=n.containerPhrasing(t,i);return l(),r(),a}var zm=Vi(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function xS(t,e,n,i){return(t.children.some(function(a){return zm(a)})?n.containerPhrasing:n.containerFlow).call(n,t,i)}function vS(t){let e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Rm.peek=sO;function Rm(t,e,n,i){let r=vS(n),l=n.enter("strong"),a=n.createTracker(i),o=a.move(r+r),u=a.move(n.containerPhrasing(t,{after:r,before:o,...a.current()})),s=u.charCodeAt(0),c=Nl(i.before.charCodeAt(i.before.length-1),s,r);c.inside&&(u=Xi(s)+u.slice(1));let f=u.charCodeAt(u.length-1),d=Nl(i.after.charCodeAt(0),f,r);d.inside&&(u=u.slice(0,-1)+Xi(f));let p=a.move(r+r);return l(),n.attentionEncodeSurroundingInfo={after:d.outside,before:c.outside},o+u+p}function sO(t,e,n){return n.options.strong||"*"}function SS(t,e,n,i){return n.safe(t.value,i)}function kS(t){let e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function wS(t,e,n){let i=(Vs(n)+(n.options.ruleSpaces?" ":"")).repeat(kS(n));return n.options.ruleSpaces?i.slice(0,-1):i}var yo={blockquote:nS,break:km,code:uS,definition:sS,emphasis:wm,hardBreak:km,heading:dS,html:Tm,image:Em,imageReference:Cm,inlineCode:Am,link:Om,linkReference:Dm,list:hS,listItem:yS,paragraph:bS,root:xS,strong:Rm,text:SS,thematicBreak:wS};function Lm(){return{enter:{table:cO,tableData:TS,tableHeader:TS,tableRow:dO},exit:{codeText:pO,table:fO,tableData:_m,tableHeader:_m,tableRow:_m}}}function cO(t){let e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function fO(t){this.exit(t),this.data.inTable=void 0}function dO(t){this.enter({type:"tableRow",children:[]},t)}function _m(t){this.exit(t)}function TS(t){this.enter({type:"tableCell",children:[]},t)}function pO(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,mO));let n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function mO(t,e){return e==="|"?e:t}function Nm(t){let e=t||{},n=e.tableCellPadding,i=e.tablePipeAlign,r=e.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
36
36
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:d,table:a,tableCell:u,tableRow:o}};function a(p,g,b,T){return s(c(p,b,T),p.align)}function o(p,g,b,T){let m=f(p,b,T),h=s([m]);return h.slice(0,h.indexOf(`
|
|
37
|
-
`))}function u(p,g,b,T){let m=b.enter("tableCell"),h=b.enter("phrasing"),y=b.containerPhrasing(p,{...T,before:l,after:l});return h(),m(),y}function s(p,g){return eS(p,{align:g,alignDelimiters:i,padding:n,stringLength:r})}function c(p,g,b){let T=p.children,m=-1,h=[],y=g.enter("table");for(;++m<T.length;)h[m]=f(T[m],g,b);return y(),h}function f(p,g,b){let T=p.children,m=-1,h=[],y=g.enter("tableRow");for(;++m<T.length;)h[m]=u(T[m],p,g,b);return y(),h}function d(p,g,b){let T=yo.inlineCode(p,g,b);return b.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function Bm(){return{exit:{taskListCheckValueChecked:ES,taskListCheckValueUnchecked:ES,paragraph:hO}}}function Um(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:gO}}}function ES(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function hO(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let n=this.stack[this.stack.length-1];n.type;let i=n.children[0];if(i&&i.type==="text"){let r=e.children,l=-1,a;for(;++l<r.length;){let o=r[l];if(o.type==="paragraph"){a=o;break}}a===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function gO(t,e,n,i){let r=t.children[0],l=typeof t.checked=="boolean"&&r&&r.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",o=n.createTracker(i);l&&o.move(a);let u=yo.listItem(t,e,n,{...i,...o.current()});return l&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,s)),u;function s(c){return c+a}}function Hm(){return[gm(),bm(),vm(),Lm(),Bm()]}function jm(t){return{extensions:[ym(),xm(t),Sm(),Nm(t),Um()]}}var yO={tokenize:kO,partial:!0},CS={tokenize:wO,partial:!0},AS={tokenize:TO,partial:!0},MS={tokenize:EO,partial:!0},bO={tokenize:CO,partial:!0},OS={name:"wwwAutolink",tokenize:vO,previous:zS},DS={name:"protocolAutolink",tokenize:SO,previous:RS},li={name:"emailAutolink",tokenize:xO,previous:_S},Mn={};function qm(){return{text:Mn}}var Or=48;for(;Or<123;)Mn[Or]=li,Or++,Or===58?Or=65:Or===91&&(Or=97);Mn[43]=li;Mn[45]=li;Mn[46]=li;Mn[95]=li;Mn[72]=[li,DS];Mn[104]=[li,DS];Mn[87]=[li,OS];Mn[119]=[li,OS];function xO(t,e,n){let i=this,r,l;return a;function a(f){return!Im(f)||!_S.call(i,i.previous)||Fm(i.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),o(f))}function o(f){return Im(f)?(t.consume(f),o):f===64?(t.consume(f),u):n(f)}function u(f){return f===46?t.check(bO,c,s)(f):f===45||f===95||Ht(f)?(l=!0,t.consume(f),u):c(f)}function s(f){return t.consume(f),r=!0,u}function c(f){return l&&r&&$t(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function vO(t,e,n){let i=this;return r;function r(a){return a!==87&&a!==119||!zS.call(i,i.previous)||Fm(i.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(yO,t.attempt(CS,t.attempt(AS,l),n),n)(a))}function l(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function SO(t,e,n){let i=this,r="",l=!1;return a;function a(f){return(f===72||f===104)&&RS.call(i,i.previous)&&!Fm(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),r+=String.fromCodePoint(f),t.consume(f),o):n(f)}function o(f){if($t(f)&&r.length<5)return r+=String.fromCodePoint(f),t.consume(f),o;if(f===58){let d=r.toLowerCase();if(d==="http"||d==="https")return t.consume(f),u}return n(f)}function u(f){return f===47?(t.consume(f),l?s:(l=!0,u)):n(f)}function s(f){return f===null||vr(f)||at(f)||Cn(f)||Sr(f)?n(f):t.attempt(CS,t.attempt(AS,c),n)(f)}function c(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function kO(t,e,n){let i=0;return r;function r(a){return(a===87||a===119)&&i<3?(i++,t.consume(a),r):a===46&&i===3?(t.consume(a),l):n(a)}function l(a){return a===null?n(a):e(a)}}function wO(t,e,n){let i,r,l;return a;function a(s){return s===46||s===95?t.check(MS,u,o)(s):s===null||at(s)||Cn(s)||s!==45&&Sr(s)?u(s):(l=!0,t.consume(s),a)}function o(s){return s===95?i=!0:(r=i,i=void 0),t.consume(s),a}function u(s){return r||i||!l?n(s):e(s)}}function TO(t,e){let n=0,i=0;return r;function r(a){return a===40?(n++,t.consume(a),r):a===41&&i<n?l(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(MS,e,l)(a):a===null||at(a)||Cn(a)?e(a):(t.consume(a),r)}function l(a){return a===41&&i++,t.consume(a),r}}function EO(t,e,n){return i;function i(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(t.consume(o),i):o===38?(t.consume(o),l):o===93?(t.consume(o),r):o===60||o===null||at(o)||Cn(o)?e(o):n(o)}function r(o){return o===null||o===40||o===91||at(o)||Cn(o)?e(o):i(o)}function l(o){return $t(o)?a(o):n(o)}function a(o){return o===59?(t.consume(o),i):$t(o)?(t.consume(o),a):n(o)}}function CO(t,e,n){return i;function i(l){return t.consume(l),r}function r(l){return Ht(l)?n(l):e(l)}}function zS(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||at(t)}function RS(t){return!$t(t)}function _S(t){return!(t===47||Im(t))}function Im(t){return t===43||t===45||t===46||t===95||Ht(t)}function Fm(t){let e=t.length,n=!1;for(;e--;){let i=t[e][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var AO={tokenize:LO,partial:!0};function Ym(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:zO,continuation:{tokenize:RO},exit:_O}},text:{91:{name:"gfmFootnoteCall",tokenize:DO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:MO,resolveTo:OO}}}}function MO(t,e,n){let i=this,r=i.events.length,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),a;for(;r--;){let u=i.events[r][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return o;function o(u){if(!a||!a._balanced)return n(u);let s=he(i.sliceSerialize({start:a.end,end:i.now()}));return s.codePointAt(0)!==94||!l.includes(s.slice(1))?n(u):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(u),t.exit("gfmFootnoteCallLabelMarker"),e(u))}}function OO(t,e){let n=t.length,i;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){i=t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",l,e],["exit",l,e],["enter",a,e],["enter",o,e],["exit",o,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function DO(t,e,n){let i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),l=0,a;return o;function o(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),u}function u(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",s)}function s(f){if(l>999||f===93&&!a||f===null||f===91||at(f))return n(f);if(f===93){t.exit("chunkString");let d=t.exit("gfmFootnoteCallString");return r.includes(he(i.sliceSerialize(d)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return at(f)||(a=!0),l++,t.consume(f),f===92?c:s}function c(f){return f===91||f===92||f===93?(t.consume(f),l++,s):s(f)}}function zO(t,e,n){let i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),l,a=0,o;return u;function u(g){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),s}function s(g){return g===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",c):n(g)}function c(g){if(a>999||g===93&&!o||g===null||g===91||at(g))return n(g);if(g===93){t.exit("chunkString");let b=t.exit("gfmFootnoteDefinitionLabelString");return l=he(i.sliceSerialize(b)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),d}return at(g)||(o=!0),a++,t.consume(g),g===92?f:c}function f(g){return g===91||g===92||g===93?(t.consume(g),a++,c):c(g)}function d(g){return g===58?(t.enter("definitionMarker"),t.consume(g),t.exit("definitionMarker"),r.includes(l)||r.push(l),Y(t,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return e(g)}}function RO(t,e,n){return t.check(An,e,t.attempt(AO,e,n))}function _O(t){t.exit("gfmFootnoteDefinition")}function LO(t,e,n){let i=this;return Y(t,r,"gfmFootnoteDefinitionIndent",5);function r(l){let a=i.events[i.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(l):n(l)}}function Vm(t){let n=(t||{}).singleTilde,i={name:"strikethrough",tokenize:l,resolveAll:r};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function r(a,o){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let s=u;for(;s--;)if(a[s][0]==="exit"&&a[s][1].type==="strikethroughSequenceTemporary"&&a[s][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[s][1].end.offset-a[s][1].start.offset){a[u][1].type="strikethroughSequence",a[s][1].type="strikethroughSequence";let c={type:"strikethrough",start:Object.assign({},a[s][1].start),end:Object.assign({},a[u][1].end)},f={type:"strikethroughText",start:Object.assign({},a[s][1].end),end:Object.assign({},a[u][1].start)},d=[["enter",c,o],["enter",a[s][1],o],["exit",a[s][1],o],["enter",f,o]],p=o.parser.constructs.insideSpan.null;p&&Ft(d,d.length,0,Fi(p,a.slice(s+1,u),o)),Ft(d,d.length,0,[["exit",f,o],["enter",a[u][1],o],["exit",a[u][1],o],["exit",c,o]]),Ft(a,s-1,u-s+3,d),u=s+d.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function l(a,o,u){let s=this.previous,c=this.events,f=0;return d;function d(g){return s===126&&c[c.length-1][1].type!=="characterEscape"?u(g):(a.enter("strikethroughSequenceTemporary"),p(g))}function p(g){let b=ri(s);if(g===126)return f>1?u(g):(a.consume(g),f++,p);if(f<2&&!n)return u(g);let T=a.exit("strikethroughSequenceTemporary"),m=ri(g);return T._open=!m||m===2&&!!b,T._close=!b||b===2&&!!m,o(g)}}}var Xs=class{constructor(){this.map=[]}add(e,n,i){NO(this,e,n,i)}consume(e){if(this.map.sort(function(l,a){return l[0]-a[0]}),this.map.length===0)return;let n=this.map.length,i=[];for(;n>0;)n-=1,i.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];i.push(e.slice()),e.length=0;let r=i.pop();for(;r;){for(let l of r)e.push(l);r=i.pop()}this.map.length=0}};function NO(t,e,n,i){let r=0;if(!(n===0&&i.length===0)){for(;r<t.map.length;){if(t.map[r][0]===e){t.map[r][1]+=n,t.map[r][2].push(...i);return}r+=1}t.map.push([e,n,i])}}function LS(t,e){let n=!1,i=[];for(;e<t.length;){let r=t[e];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&i.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){let l=i.length-1;i[l]=i[l]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return i}function Xm(){return{flow:{null:{name:"table",tokenize:BO,resolveAll:UO}}}}function BO(t,e,n){let i=this,r=0,l=0,a;return o;function o(k){let lt=i.events.length-1;for(;lt>-1;){let I=i.events[lt][1].type;if(I==="lineEnding"||I==="linePrefix")lt--;else break}let j=lt>-1?i.events[lt][1].type:null,H=j==="tableHead"||j==="tableRow"?w:u;return H===w&&i.parser.lazy[i.now().line]?n(k):H(k)}function u(k){return t.enter("tableHead"),t.enter("tableRow"),s(k)}function s(k){return k===124||(a=!0,l+=1),c(k)}function c(k){return k===null?n(k):B(k)?l>1?(l=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),p):n(k):X(k)?Y(t,c,"whitespace")(k):(l+=1,a&&(a=!1,r+=1),k===124?(t.enter("tableCellDivider"),t.consume(k),t.exit("tableCellDivider"),a=!0,c):(t.enter("data"),f(k)))}function f(k){return k===null||k===124||at(k)?(t.exit("data"),c(k)):(t.consume(k),k===92?d:f)}function d(k){return k===92||k===124?(t.consume(k),f):f(k)}function p(k){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(k):(t.enter("tableDelimiterRow"),a=!1,X(k)?Y(t,g,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):g(k))}function g(k){return k===45||k===58?T(k):k===124?(a=!0,t.enter("tableCellDivider"),t.consume(k),t.exit("tableCellDivider"),b):M(k)}function b(k){return X(k)?Y(t,T,"whitespace")(k):T(k)}function T(k){return k===58?(l+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(k),t.exit("tableDelimiterMarker"),m):k===45?(l+=1,m(k)):k===null||B(k)?S(k):M(k)}function m(k){return k===45?(t.enter("tableDelimiterFiller"),h(k)):M(k)}function h(k){return k===45?(t.consume(k),h):k===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(k),t.exit("tableDelimiterMarker"),y):(t.exit("tableDelimiterFiller"),y(k))}function y(k){return X(k)?Y(t,S,"whitespace")(k):S(k)}function S(k){return k===124?g(k):k===null||B(k)?!a||r!==l?M(k):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(k)):M(k)}function M(k){return n(k)}function w(k){return t.enter("tableRow"),A(k)}function A(k){return k===124?(t.enter("tableCellDivider"),t.consume(k),t.exit("tableCellDivider"),A):k===null||B(k)?(t.exit("tableRow"),e(k)):X(k)?Y(t,A,"whitespace")(k):(t.enter("data"),N(k))}function N(k){return k===null||k===124||at(k)?(t.exit("data"),A(k)):(t.consume(k),k===92?R:N)}function R(k){return k===92||k===124?(t.consume(k),N):N(k)}}function UO(t,e){let n=-1,i=!0,r=0,l=[0,0,0,0],a=[0,0,0,0],o=!1,u=0,s,c,f,d=new Xs;for(;++n<t.length;){let p=t[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(o=!1,u!==0&&(NS(d,e,u,s,c),c=void 0,u=0),s={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},d.add(n,0,[["enter",s,e]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(i=!0,f=void 0,l=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,c={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},d.add(n,0,[["enter",c,e]])),r=g.type==="tableDelimiterRow"?2:c?3:1):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(i=!1,a[2]===0&&(l[1]!==0&&(a[0]=a[1],f=Gs(d,e,l,r,void 0,f),l=[0,0,0,0]),a[2]=n)):g.type==="tableCellDivider"&&(i?i=!1:(l[1]!==0&&(a[0]=a[1],f=Gs(d,e,l,r,void 0,f)),l=a,a=[l[1],n,0,0])):g.type==="tableHead"?(o=!0,u=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(u=n,l[1]!==0?(a[0]=a[1],f=Gs(d,e,l,r,n,f)):a[1]!==0&&(f=Gs(d,e,a,r,n,f)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&NS(d,e,u,s,c),d.consume(e.events),n=-1;++n<e.events.length;){let p=e.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=LS(e.events,n))}return t}function Gs(t,e,n,i,r,l){let a=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(l.end=Object.assign({},Ul(e.events,n[0])),t.add(n[0],0,[["exit",l,e]]));let u=Ul(e.events,n[1]);if(l={type:a,start:Object.assign({},u),end:Object.assign({},u)},t.add(n[1],0,[["enter",l,e]]),n[2]!==0){let s=Ul(e.events,n[2]),c=Ul(e.events,n[3]),f={type:o,start:Object.assign({},s),end:Object.assign({},c)};if(t.add(n[2],0,[["enter",f,e]]),i!==2){let d=e.events[n[2]],p=e.events[n[3]];if(d[1].end=Object.assign({},p[1].end),d[1].type="chunkText",d[1].contentType="text",n[3]>n[2]+1){let g=n[2]+1,b=n[3]-n[2]-1;t.add(g,b,[])}}t.add(n[3]+1,0,[["exit",f,e]])}return r!==void 0&&(l.end=Object.assign({},Ul(e.events,r)),t.add(r,0,[["exit",l,e]]),l=void 0),l}function NS(t,e,n,i,r){let l=[],a=Ul(e.events,n);r&&(r.end=Object.assign({},a),l.push(["exit",r,e])),i.end=Object.assign({},a),l.push(["exit",i,e]),t.add(n+1,0,l)}function Ul(t,e){let n=t[e],i=n[0]==="enter"?"start":"end";return n[1][i]}var HO={name:"tasklistCheck",tokenize:jO};function Gm(){return{text:{91:HO}}}function jO(t,e,n){let i=this;return r;function r(u){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(u):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(u),t.exit("taskListCheckMarker"),l)}function l(u){return at(u)?(t.enter("taskListCheckValueUnchecked"),t.consume(u),t.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(t.enter("taskListCheckValueChecked"),t.consume(u),t.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(t.enter("taskListCheckMarker"),t.consume(u),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),o):n(u)}function o(u){return B(u)?e(u):X(u)?t.check({tokenize:IO},e,n)(u):n(u)}}function IO(t,e,n){return Y(t,i,"whitespace");function i(r){return r===null?n(r):e(r)}}function BS(t){return xs([qm(),Ym(),Vm(t),Xm(),Gm()])}var qO={};function Qs(t){let e=this,n=t||qO,i=e.data(),r=i.micromarkExtensions||(i.micromarkExtensions=[]),l=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),a=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);r.push(BS(n)),l.push(Hm()),a.push(jm(n))}var we=Ct(me(),1);function US({theme:t,body:e}){let n={p:({children:i})=>(0,we.jsx)("p",{style:{...rt,...q.bodySm,color:t.colors.ink,overflowWrap:"break-word",marginBottom:O.xxs},children:i}),strong:({children:i})=>(0,we.jsx)("span",{style:{fontWeight:500,color:t.colors.ink},children:i}),em:({children:i})=>(0,we.jsx)("span",{style:{fontStyle:"italic"},children:i}),del:({children:i})=>(0,we.jsx)("span",{style:{textDecoration:"line-through",color:t.colors.body},children:i}),a:({href:i,children:r})=>i===void 0||i===""?(0,we.jsx)("span",{style:{color:t.colors.body},children:r}):(0,we.jsx)("a",{href:i,target:"_blank",rel:"noopener noreferrer nofollow",style:{color:t.colors.link,textDecoration:"underline",textUnderlineOffset:"2px"},children:r}),code:({children:i})=>(0,we.jsx)("code",{style:{...q.captionMono,background:t.colors.canvasSoft2,borderRadius:"3px",padding:"0 3px",color:t.colors.ink},children:i}),pre:({children:i})=>(0,we.jsx)("pre",{style:{...rt,...q.captionMono,background:t.colors.canvasSoft2,color:t.colors.ink,borderRadius:"4px",padding:O.xs,marginBottom:O.xxs,overflowX:"auto"},children:i}),ul:({children:i})=>(0,we.jsx)("ul",{style:{...rt,listStyle:"disc outside",paddingLeft:O.md,marginBottom:O.xxs},children:i}),ol:({children:i})=>(0,we.jsx)("ol",{style:{...rt,listStyle:"decimal outside",paddingLeft:O.md,marginBottom:O.xxs},children:i}),li:({children:i})=>(0,we.jsx)("li",{style:{...q.bodySm,color:t.colors.ink},children:i}),blockquote:({children:i})=>(0,we.jsx)("blockquote",{style:{...rt,borderLeft:`2px solid ${t.colors.hairline}`,paddingLeft:O.xs,color:t.colors.body,marginBottom:O.xxs},children:i}),hr:()=>(0,we.jsx)("hr",{style:{...rt,border:0,borderTop:`1px solid ${t.colors.hairline}`,margin:`${O.xs} 0`}})};return(0,we.jsx)(sm,{remarkPlugins:[Qs],rehypePlugins:[],urlTransform:Q0,allowedElements:[...K0],unwrapDisallowed:!0,components:n,children:e})}var HS=["data-testid","data-test-id","data-qa"];function jS(t){return t.length>40||/^:r[0-9a-z]+:$/i.test(t)||/^[0-9a-f]{16,}$/i.test(t)||/^(radix|headlessui|mui|chakra)-/i.test(t)}function IS(t){let e=globalThis.CSS?.escape;return e?e(t):t.replace(/[^\w-]/g,"\\$&")}function FO(t){let e=t.tagName.toLowerCase(),n=t.parentElement;if(!n)return e;let i=Array.from(n.children).filter(r=>r.tagName===t.tagName);return i.length===1?e:`${e}:nth-of-type(${i.indexOf(t)+1})`}function qS(t){if(t.id&&!jS(t.id)){let r=`#${IS(t.id)}`;if(bo(r,t))return r}for(let r of HS){let l=t.getAttribute(r);if(l){let a=`[${r}="${FS(l)}"]`;if(bo(a,t))return a}}let e=[],n=t;for(;n&&n!==document.documentElement;){e.unshift(FO(n));let r=n.parentElement;if(r){let a=YO(r);if(a){let o=`${a} > ${e.join(" > ")}`;if(bo(o,t))return o}}let l=e.join(" > ");if(bo(l,t))return l;n=r}let i=e.join(" > ");return bo(i,t)?i:null}function YO(t){if(t.id&&!jS(t.id))return`#${IS(t.id)}`;for(let e of HS){let n=t.getAttribute(e);if(n)return`[${e}="${FS(n)}"]`}return null}function FS(t){return t.replace(/["\\]/g,"\\$&")}function bo(t,e){try{let n=document.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}}function Qm(t){try{return document.querySelector(t)}catch{return null}}function YS(t,e,n){let i=t.getBoundingClientRect(),r=i.width>0?(e-i.left)/i.width:.5,l=i.height>0?(n-i.top)/i.height:.5;return{offsetX:Math.min(1,Math.max(0,r)),offsetY:Math.min(1,Math.max(0,l))}}function VS(t,e,n){let i=Qm(t);if(!i)return null;let r=i.getBoundingClientRect();return r.width===0&&r.height===0?null:{x:r.left+r.width*e,y:r.top+r.height*n}}var z=Ct(me(),1),VO='[data-bitvea-pin-surface], [data-testid="pin-composer"], [data-bitvea-feedback-toolbar]',Hl=16,XS=12,Pm=`calc(100vw - ${rn*2}px)`,XO=200,PS=Number.parseFloat(Et.thread),Jm=120,Ks="draft",GO=1200;function JS({client:t,config:e,organizationId:n,theme:i=Cl,picking:r,onPickingChange:l,showResolved:a=!1,focusPinId:o=null,onFocusHandled:u,deepLinkPinId:s=null,onOpenCountChange:c}){let[f,d]=(0,V.useState)([]),[p,g]=(0,V.useState)(null),[b,T]=(0,V.useState)(null),[m,h]=(0,V.useState)({}),[y,S]=(0,V.useState)(null),[M,w]=(0,V.useState)({}),[A,N]=(0,V.useState)(!1),[R,k]=(0,V.useState)(0),lt=Tl(),j=(0,V.useCallback)(async()=>{try{d(await t.listForPage(n,lt))}catch{d([])}finally{N(!0)}},[t,n,lt]);(0,V.useEffect)(()=>{j()},[j]),(0,V.useEffect)(()=>{let L=()=>k(G=>G+1);return window.addEventListener("scroll",L,{passive:!0}),window.addEventListener("resize",L),()=>{window.removeEventListener("scroll",L),window.removeEventListener("resize",L)}},[]),(0,V.useEffect)(()=>{let L=G=>{if(G.key==="Escape"){if(p!==null)g(null);else if(b!==null)T(null);else if(r)l(!1);else if(y!==null)S(null);else return;G.stopPropagation()}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[p,y,r,b,l]),(0,V.useEffect)(()=>{let L=e.pinShortcut;if(L===null)return;let G=new Pu,fe=Ju(typeof navigator>"u"?void 0:navigator),Re=Dn=>{G.down(Dn.key),!Zx(Dn.target)&&Px(L,Dn,G.keys(),fe)&&p===null&&(r||(l(!0),Dn.preventDefault(),Dn.stopPropagation()))},sn=Dn=>G.up(Dn.key),Qi=()=>G.clear();return window.addEventListener("keydown",Re,!0),window.addEventListener("keyup",sn,!0),window.addEventListener("blur",Qi),document.addEventListener("visibilitychange",Qi),()=>{window.removeEventListener("keydown",Re,!0),window.removeEventListener("keyup",sn,!0),window.removeEventListener("blur",Qi),document.removeEventListener("visibilitychange",Qi)}},[e.pinShortcut,p,r,l]),(0,V.useEffect)(()=>{if(y===null)return;let L=G=>{let fe=G.target;fe instanceof Element&&fe.closest(VO)!==null||S(null)};return window.addEventListener("pointerdown",L,!0),()=>window.removeEventListener("pointerdown",L,!0)},[y]);let H=(0,V.useMemo)(()=>f.filter(L=>L.status!=="DONE").length,[f]);(0,V.useEffect)(()=>{c?.(H)},[H,c]);let I=(0,V.useMemo)(()=>f.filter(L=>L.kind==="PINNED"&&L.pin&&(a||L.status!=="DONE"||L.id===y)).map(L=>L.id),[y,f,a]),[K,bt]=(0,V.useState)(I),[pt,Yt]=(0,V.useState)([]);if(K!==I){let L=K.filter(G=>!I.includes(G));bt(I),L.length>0&&Yt(G=>[...G,...L.filter(fe=>!G.includes(fe))])}(0,V.useEffect)(()=>{if(pt.length===0)return;let L=window.setTimeout(()=>Yt([]),Pa(it.duration.fast));return()=>window.clearTimeout(L)},[pt]);let Lt=(0,V.useMemo)(()=>{let L=new Set(I);return f.filter(G=>G.kind==="PINNED"&&G.pin&&(L.has(G.id)||pt.includes(G.id))).map(G=>({item:G,at:VS(G.pin.selector,G.pin.offsetX,G.pin.offsetY),departing:!L.has(G.id)})).filter(G=>G.at!==null)},[pt,I,f,R]),x=o??s,[F,nt]=(0,V.useState)(null);x!==null&&x!==F&&(nt(x),S(x)),(0,V.useEffect)(()=>{o!==null&&(GS(f,o),u?.())},[o,f,u]);let v=(0,V.useRef)(!1);(0,V.useEffect)(()=>{s===null||v.current||!A||(v.current=!0,GS(f,s))},[s,A,f]);let Vt=f.find(L=>L.id===y)??null,ce=Vt!==null&&!Lt.some(L=>L.item.id===Vt.id)?Vt:null,[ql,Dr]=(0,V.useState)(!1),Zt=s!==null&&A&&!ql&&!f.some(L=>L.id===s);function Gi(L){w(G=>({...G,[L.id]:L.replies.length}))}async function un(L){let G=b,fe=Zm(L.currentTarget,L.clientX,L.clientY);if(T(null),!fe||G===null)return;let Re=await o0(fe);Re!==null&&h(sn=>({...sn,[G]:Re}))}function On(L){let G=Zm(L.currentTarget,L.clientX,L.clientY);if(!G)return;let fe=qS(G);if(!fe){l(!1);return}let{offsetX:Re,offsetY:sn}=YS(G,L.clientX,L.clientY);g({selector:fe,offsetX:Re,offsetY:sn,x:L.clientX,y:L.clientY}),l(!1)}return(0,z.jsxs)(z.Fragment,{children:[r?(0,z.jsx)(QS,{theme:i,onPick:On}):null,b!==null?(0,z.jsx)(QS,{theme:i,onPick:L=>{un(L)}}):null,Lt.map(({item:L,at:G,departing:fe})=>(0,z.jsx)(QO,{item:L,at:G,theme:i,departing:fe,dimmed:L.status==="DONE",focused:y===L.id,unread:L.replies.length>(M[L.id]??-1),outdated:ZS(L,e),attachment:m[L.id]??null,onRequestCapture:()=>T(L.id),onClearAttachment:()=>h(({[L.id]:Re,...sn})=>sn),apiUrl:e.apiUrl,open:y===L.id,onToggle:()=>{Gi(L),S(Re=>Re===L.id?null:L.id)},client:t,organizationId:n,onChanged:j},L.id)),ce?(0,z.jsx)("div",{"data-testid":`pin-stranded-${ce.id}`,"data-bitvea-pin-surface":"",style:{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:hn.thread},children:(0,z.jsx)($S,{item:ce,theme:i,client:t,organizationId:n,onChanged:j,outdated:ZS(ce,e),attachment:m[ce.id]??null,onRequestCapture:()=>T(ce.id),onClearAttachment:()=>h(({[ce.id]:L,...G})=>G),apiUrl:e.apiUrl,position:{position:"relative"},note:ce.pin?"The element this was pinned to is gone, so the thread is shown here instead.":"A note about the page as a whole, so it has no pin.",onClose:()=>S(null)})}):null,Zt?(0,z.jsxs)("div",{role:"alert","data-testid":"pin-missing",style:{position:"fixed",left:"50%",top:O.md,transform:"translateX(-50%)",zIndex:hn.alert,display:"flex",alignItems:"center",gap:O.xs,padding:`${O.xs} ${O.sm}`,maxWidth:Pm,background:i.colors.canvas,border:`1px solid ${i.colors.hairline}`,borderRadius:et.lg,boxShadow:i.shadows.popover,...q.bodySm,color:i.colors.body},children:[(0,z.jsx)("span",{children:"That feedback is not on this page any more."}),(0,z.jsx)("button",{type:"button","data-testid":"pin-missing-dismiss",onClick:()=>Dr(!0),style:{padding:0,border:"none",background:"transparent",color:i.colors.body,cursor:"pointer",...q.bodySmStrong,outline:"revert"},children:"Dismiss"})]}):null,p?(0,z.jsx)(ZO,{draft:p,theme:i,client:t,config:e,organizationId:n,onDone:()=>{g(null),h(({[Ks]:L,...G})=>G),j()},attachment:m[Ks]??null,onRequestCapture:()=>T(Ks),onClearAttachment:()=>h(({[Ks]:L,...G})=>G)}):null]})}function GS(t,e){let n=t.find(r=>r.id===e);(n?.pin?Qm(n.pin.selector):null)?.scrollIntoView({behavior:"smooth",block:"center"})}function Zm(t,e,n){let i=t.style.visibility;t.style.visibility="hidden";let r=document.elementFromPoint(e,n);return t.style.visibility=i,!r||r===document.body||r===document.documentElement||r.closest("[data-bitvea-feedback-toolbar]")!==null?null:r}function QS({theme:t,onPick:e}){let[n,i]=(0,V.useState)(null);return(0,z.jsx)("div",{"data-testid":"pin-picker",onClick:e,onMouseMove:r=>{let l=Zm(r.currentTarget,r.clientX,r.clientY);i(l?l.getBoundingClientRect():null)},onMouseLeave:()=>i(null),style:{position:"fixed",inset:0,zIndex:hn.picker,cursor:"crosshair",background:t.colors.pickTint},children:n?(0,z.jsx)("div",{"data-testid":"pin-picker-outline","aria-hidden":"true",style:{position:"fixed",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,border:`2px dashed ${t.colors.ink}`,borderRadius:et.sm,background:t.colors.inkSoft,boxShadow:`0 0 0 1px ${t.colors.markerRing}, inset 0 0 0 1px ${t.colors.markerRing}`,pointerEvents:"none"}}):null})}function QO({item:t,at:e,theme:n,departing:i,dimmed:r,focused:l,unread:a,open:o,onToggle:u,client:s,organizationId:c,onChanged:f,outdated:d,attachment:p,onRequestCapture:g,onClearAttachment:b,apiUrl:T}){let m=us(o,El(it.duration.fast)),h=pe(),y=Math.min(PS,window.innerWidth-rn*2),S=window.innerWidth-rn-(e.x+Hl),M=e.x-Hl-rn,w=S<y&&M>S?e.x-Hl-y:e.x+Hl,A=Math.min(Math.max(w,rn),window.innerWidth-rn-y);return(0,z.jsxs)("div",{"data-bitvea-pin-surface":"",inert:i,style:{position:"fixed",left:e.x,top:e.y,zIndex:m.mounted?hn.thread:hn.marker,...i?{pointerEvents:"none"}:{}},children:[(0,z.jsxs)("button",{type:"button","data-testid":`pin-${t.id}`,"data-bitvea-pin":t.id,"aria-label":`Feedback from ${Wa(t.author.name,t.author.email)}: ${t.body.slice(0,60)}`,onClick:u,style:{position:"absolute",transform:"translate(0, -100%)",width:Et.icon,height:Et.icon,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,borderRadius:`50% 50% 50% ${et.xs}`,border:`2px solid ${n.colors.markerRing}`,background:Zd.gradient,color:Zd.onAccent,...q.caption,fontWeight:500,boxShadow:l?`${n.shadows.focusRing}, ${n.shadows.marker}`:n.shadows.marker,opacity:i?0:r?.45:1,transition:Xe(["opacity"],it.duration.fast,i?it.easing.exit:it.easing.inOut,h),cursor:"pointer",outline:"revert"},children:[ip(t.author.name,t.author.email),a?(0,z.jsx)("span",{"data-testid":`pin-unread-${t.id}`,"aria-hidden":"true",style:{position:"absolute",top:`-${O.xxs}`,right:`-${O.xxs}`,width:Et.dot,height:Et.dot,borderRadius:et.pill,background:n.colors.ink,border:`2px solid ${n.colors.markerRing}`,boxSizing:"content-box"}}):null]}),m.mounted?(0,z.jsx)($S,{item:t,theme:n,client:s,organizationId:c,onChanged:f,outdated:d,attachment:p,onRequestCapture:g,onClearAttachment:b,apiUrl:T,position:{position:"absolute",left:`${A-e.x}px`,top:`${Hl}px`},origin:`${e.x-A}px -${Hl}px`,leaving:m.leaving}):null]})}function $S({item:t,theme:e,client:n,organizationId:i,onChanged:r,position:l,note:a,onClose:o,origin:u,leaving:s=!1,outdated:c=!1,attachment:f,onRequestCapture:d,onClearAttachment:p,apiUrl:g}){let[b,T]=(0,V.useState)(""),[m,h]=(0,V.useState)(!1),[y,S]=(0,V.useState)(null),[M,w]=(0,V.useState)(!1),[A,N]=(0,V.useState)(!1),[R,k]=(0,V.useState)(!1),lt=Ui(),j=pe(),H=v0(t.replies.map(F=>F.id)),I=(0,V.useRef)(null);async function K(){let F=b.trim();if(F.length!==0){h(!0),S(null);try{await n.reply(i,t.id,F,f??void 0),T(""),p(),xo(I.current),r()}catch{S("Could not post that reply.")}finally{h(!1)}}}async function bt(F){w(!0),S(null);try{await n.setStatus(i,t.id,F),r()}catch(nt){S(nt instanceof mn&&nt.code==="not_invited_to_project"?"You are not invited to this project any more.":"Could not change the status.")}finally{w(!1)}}let pt=t.status==="DONE",Yt=b.trim().length>0,Lt=[rp(t.createdAt)],x=[Al(t.createdAt),t.userAgent].filter(F=>typeof F=="string"&&F!=="").join(" \xB7 ");return(0,z.jsxs)("section",{"data-testid":`pin-thread-${t.id}`,style:{...rt,...l,width:Et.thread,maxWidth:Pm,maxHeight:Et.threadMaxHeight,boxSizing:"border-box",display:"flex",flexDirection:"column",background:e.colors.canvas,border:`1px solid ${e.colors.hairline}`,borderRadius:et.lg,boxShadow:e.shadows.popover,...q.bodySm,color:e.colors.body,...ti({visible:lt,leaving:s,reduced:j,origin:u})},children:[o?(0,z.jsx)("header",{style:{...rt,flex:"0 0 auto",display:"flex",justifyContent:"flex-end",padding:`${O.xs} ${O.xs} 0`},children:(0,z.jsx)(ai,{theme:e,label:"Close thread",testId:`pin-thread-close-${t.id}`,onClick:o,children:(0,z.jsx)(Ml,{})})}):null,(0,z.jsxs)("div",{style:{flex:"1 1 auto",minHeight:0,overflowY:"auto",overscrollBehavior:"contain"},children:[a?(0,z.jsx)("p",{"data-testid":`pin-note-${t.id}`,style:{...rt,margin:`${O.sm} ${O.sm} 0`,padding:O.xs,borderRadius:et.sm,background:e.colors.canvasSoft2,color:e.colors.body,...q.caption},children:a}):null,(0,z.jsx)(KS,{theme:e,testId:`pin-message-${t.id}`,name:t.author.name,email:t.author.email,body:t.body,facts:Lt,factsTitle:x,badge:c?(0,z.jsx)(KO,{theme:e,id:t.id}):void 0,alwaysShowActions:!0,actions:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Km,{theme:e,label:"Copy link to this thread",text:ts(t.pageUrl,t.id),icon:(0,z.jsx)(q0,{})}),(0,z.jsx)(Km,{theme:e,label:"Copy message",text:t.body,icon:(0,z.jsx)(lp,{})}),(0,z.jsx)(ai,{theme:e,label:pt?"Reopen":"Resolve",srText:pt?"Reopen":"Resolve",testId:`pin-resolve-${t.id}`,tone:pt?"ink":"ghost",disabled:M,onClick:()=>{bt(pt?"OPEN":"DONE")},children:(0,z.jsx)(ap,{})})]})}),t.replies.map((F,nt)=>(0,z.jsx)(KS,{theme:e,testId:`pin-message-${F.id}`,name:F.author.name,email:F.author.email,body:F.body,facts:[...F.viaAgent?["via agent"]:[],rp(F.createdAt)],factsTitle:Al(F.createdAt),image:F.screenshotUrl?{url:F.screenshotUrl.startsWith("/")?`${g}${F.screenshotUrl}`:F.screenshotUrl,alt:`Screenshot attached by ${Wa(F.author.name,F.author.email)}`}:void 0,divided:nt===0,arriving:H(F.id),actions:(0,z.jsx)(Km,{theme:e,label:"Copy reply",text:F.body,icon:(0,z.jsx)(lp,{})})},F.id))]}),(0,z.jsxs)("div",{style:{...rt,flex:"0 0 auto",padding:O.sm,borderTop:`1px solid ${e.colors.hairline}`},children:[y?(0,z.jsx)("p",{role:"alert",style:{...rt,margin:`0 0 ${O.xxs}`,color:e.colors.error,...q.caption},children:y}):null,(0,z.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:O.xs,padding:O.xs,borderRadius:et.sm,background:e.colors.canvasSoft2,boxShadow:A?e.shadows.focusRing:"none"},children:[f?(0,z.jsxs)("div",{"data-testid":`pin-attachment-${t.id}`,style:{position:"relative",alignSelf:"flex-start",borderRadius:et.sm,border:`1px solid ${e.colors.hairline}`,overflow:"hidden",lineHeight:0},children:[(0,z.jsx)("img",{src:f,alt:"The element you captured, attached to this reply",style:{display:"block",maxWidth:"120px",maxHeight:"80px"}}),(0,z.jsx)("button",{type:"button","aria-label":"Remove screenshot",title:"Remove screenshot","data-testid":`pin-attachment-remove-${t.id}`,onClick:p,style:{...rt,position:"absolute",top:"2px",right:"2px",width:"16px",height:"16px",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:et.sm,cursor:"pointer",background:e.colors.ink,color:e.colors.onInk,lineHeight:1},children:(0,z.jsx)(Ml,{})})]}):null,(0,z.jsx)("textarea",{ref:I,value:b,onChange:F=>{T(F.target.value),xo(F.target)},onFocus:()=>N(!0),onBlur:()=>N(!1),onKeyDown:F=>{F.key==="Enter"&&(F.nativeEvent.isComposing||F.shiftKey||F.altKey||(F.preventDefault(),!(m||!Yt)&&K()))},rows:1,placeholder:"Add a reply\u2026","aria-label":"Reply","data-testid":`pin-reply-${t.id}`,maxLength:hr,style:{...rt,display:"block",width:"100%",minHeight:q.bodySm.lineHeight,maxHeight:`${Jm}px`,overflowY:"auto",resize:"none",...q.bodySm,color:e.colors.ink,background:"transparent",outline:"none"}}),(0,z.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:O.xxs,flex:"0 0 auto"},children:[R?(0,z.jsx)(WS,{theme:e,onApply:F=>{let nt=I.current;if(!nt)return;let v=mp(b,nt.selectionStart,nt.selectionEnd,F);T(v.text),requestAnimationFrame(()=>{nt.focus(),nt.setSelectionRange(v.selectionStart,v.selectionEnd),xo(nt)})}}):null,(0,z.jsx)(ai,{theme:e,label:"Take a screenshot",testId:`pin-attach-${t.id}`,tone:f?"ink":"ghost",onClick:d,children:(0,z.jsx)(up,{})}),(0,z.jsx)("span",{"aria-hidden":"true",style:{width:"1px",height:"16px",background:e.colors.hairline,margin:`0 ${O.xxs}`}}),(0,z.jsx)(ai,{theme:e,label:R?"Hide formatting":"Formatting",testId:`pin-format-${t.id}`,tone:R?"ink":"ghost",onClick:()=>k(F=>!F),children:(0,z.jsx)("span",{style:{...q.captionMono,lineHeight:1},children:"Aa"})}),(0,z.jsx)("span",{style:{flex:"1 1 auto"}}),(0,z.jsx)(ai,{theme:e,label:"Reply",srText:"Reply",busy:m,tone:Yt?"ink":"ghost",disabled:m||!Yt,onClick:()=>{K()},children:(0,z.jsx)(op,{})})]})]})]})]})}function KS({theme:t,testId:e,name:n,email:i,body:r,facts:l,factsTitle:a,actions:o,badge:u,image:s,alwaysShowActions:c=!1,divided:f=!1,arriving:d=!1}){let p=Ui(),g=pe(),[b,T]=(0,V.useState)(!1),m=c||b;return(0,z.jsxs)("div",{"data-testid":e,onPointerEnter:()=>T(!0),onPointerLeave:()=>T(!1),onFocus:()=>T(!0),onBlur:()=>T(!1),style:{...rt,display:"flex",gap:O.xs,padding:O.sm,...f?{borderTop:`1px solid ${t.colors.hairline}`}:{},...d?ti({visible:p,reduced:g,slide:"y"}):{}},children:[(0,z.jsx)(to,{theme:t,name:n,email:i}),(0,z.jsxs)("div",{style:{flex:"1 1 auto",minWidth:0},children:[(0,z.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:O.xs,minHeight:Et.action},children:[(0,z.jsx)("span",{style:{minWidth:0,color:t.colors.ink,...q.bodySmStrong,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Wa(n,i)}),u===void 0?null:(0,z.jsx)("span",{style:{flex:"0 0 auto",marginLeft:O.xxs},children:u}),(0,z.jsx)("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:O.xxs,flex:"0 0 auto",opacity:m?1:0,transition:Xe(["opacity"],it.duration.instant,it.easing.inOut,g)},children:o})]}),(0,z.jsx)("p",{title:a,style:{...rt,...q.captionMono,color:t.colors.body,overflowWrap:"anywhere"},children:l.join(" \xB7 ")}),(0,z.jsx)("div",{style:{marginTop:O.xxs},children:(0,z.jsx)(US,{theme:t,body:r})}),s?(0,z.jsx)("img",{src:s.url,alt:s.alt,style:{display:"block",marginTop:O.xxs,maxWidth:"100%",borderRadius:et.sm,border:`1px solid ${t.colors.hairline}`}}):null]})]})}function ai({theme:t,label:e,srText:n,onClick:i,disabled:r,testId:l,tone:a="ghost",busy:o,children:u}){let[s,c]=(0,V.useState)(!1),[f,d]=(0,V.useState)(!1),[p,g]=(0,V.useState)(!1),b=pe(),T=a==="ink";return(0,z.jsxs)("button",{type:"button","aria-label":e,title:e,...o===void 0?{}:{"aria-busy":o},...l===void 0?{}:{"data-testid":l},onClick:i,disabled:r,onFocus:()=>c(!0),onBlur:()=>c(!1),onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),g(!1)},onPointerDown:()=>g(!0),onPointerUp:()=>g(!1),onPointerCancel:()=>g(!1),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",width:Et.action,height:Et.action,padding:0,boxSizing:"border-box",border:"none",borderRadius:et.sm,background:T?t.colors.ink:f&&r!==!0?t.colors.canvasSoft2:"transparent",color:T?t.colors.onInk:t.colors.body,cursor:r===!0?"not-allowed":"pointer",outline:"revert",boxShadow:s?t.shadows.focusRing:"none",transform:Wn(p&&r!==!0?`scale(${it.pressScale})`:"none",b),transition:Xe(["background-color","color","transform"],it.duration.instant,it.easing.inOut,b)},children:[u,n===void 0?null:(0,z.jsx)("span",{style:m0,children:n})]})}function xo(t){t&&(t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,Jm)}px`)}function WS({theme:t,onApply:e}){let n={bold:"Bold",italic:"Italic",strike:"Strikethrough",code:"Code"},i={bold:"B",italic:"I",strike:"S",code:"<>"};return(0,z.jsx)("div",{role:"group","aria-label":"Formatting","data-testid":"pin-format-bar",style:{position:"absolute",bottom:`calc(100% + ${O.xxs})`,left:0,display:"flex",alignItems:"center",gap:O.xxs,padding:O.xxs,borderRadius:et.md,background:t.colors.canvas,border:`1px solid ${t.colors.hairline}`,boxShadow:t.shadows.popover,zIndex:1},children:Object.keys(pp).map(r=>(0,z.jsxs)(V.Fragment,{children:[r==="code"?(0,z.jsx)("span",{"aria-hidden":"true",style:{width:"1px",height:"16px",background:t.colors.hairline,margin:`0 ${O.xxs}`}}):null,(0,z.jsx)("button",{type:"button","aria-label":n[r],title:n[r],"data-testid":`pin-format-${r}`,onMouseDown:l=>l.preventDefault(),onClick:()=>e(r),style:{...rt,width:Et.action,height:Et.action,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:et.sm,cursor:"pointer",color:t.colors.body,outline:"revert",...q.captionMono,fontWeight:r==="bold"?500:400,fontStyle:r==="italic"?"italic":"normal",textDecoration:r==="strike"?"line-through":"none"},children:i[r]})]},r))})}function Km({theme:t,label:e,text:n,icon:i}){let[r,l]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{if(!r)return;let a=window.setTimeout(()=>l(!1),GO);return()=>window.clearTimeout(a)},[r]),(0,z.jsx)(ai,{theme:t,label:e,onClick:()=>{navigator.clipboard?.writeText(n).then(()=>l(!0),()=>{})},children:r?(0,z.jsx)(ap,{}):i})}function ZS(t,e){let n=t.gitCommit,i=e.gitCommit;return!n||!i?!1:n!==i}function KO({theme:t,id:e}){return(0,z.jsx)("span",{"data-testid":`pin-outdated-${e}`,title:"Written before the latest update to this page. It may already be fixed.",style:{padding:`0 ${O.xs}`,borderRadius:et.sm,background:t.colors.canvasSoft2,color:t.colors.body,...q.caption,whiteSpace:"nowrap"},children:"Outdated"})}function ZO({draft:t,theme:e,client:n,config:i,organizationId:r,onDone:l,attachment:a,onRequestCapture:o,onClearAttachment:u}){let[s,c]=(0,V.useState)(""),[f,d]=(0,V.useState)(!1),[p,g]=(0,V.useState)(null),[b,T]=(0,V.useState)(!1),[m,h]=(0,V.useState)(!1),y=(0,V.useRef)(null),S=s.trim(),M=S.length>0&&S.length<=hr,w=Ui(),A=pe(),N=Math.min(PS,window.innerWidth-rn*2),R=Math.min(Math.max(t.x+XS,rn),window.innerWidth-rn-N),k=Math.max(rn,Math.min(t.y+XS,window.innerHeight-XO));async function lt(){d(!0),g(null);try{let j=a??await es();await n.submit({organizationId:r,kind:"PINNED",body:S,metadata:Ka(i),pin:{selector:t.selector,offsetX:t.offsetX,offsetY:t.offsetY},...j?{screenshot:j}:{}}),l()}catch(j){d(!1),g(j instanceof mn&&j.code==="not_invited_to_project"?"You are not invited to this project any more.":"Could not save that pin. Your text is still here.")}}return(0,z.jsx)("section",{"data-testid":"pin-composer",style:{...rt,position:"fixed",left:R,top:k,width:Et.thread,maxWidth:Pm,boxSizing:"border-box",padding:0,background:e.colors.canvas,border:`1px solid ${e.colors.hairline}`,borderRadius:et.lg,boxShadow:e.shadows.popover,overflow:"hidden",zIndex:hn.thread,...q.bodySm,color:e.colors.body,...ti({visible:w,reduced:A,origin:`${t.x-R}px ${t.y-k}px`})},children:(0,z.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:O.xs,padding:O.sm,background:e.colors.canvasSoft2,boxShadow:b?e.shadows.focusRing:"none"},children:[a?(0,z.jsxs)("div",{"data-testid":"pin-composer-attachment",style:{position:"relative",alignSelf:"flex-start",borderRadius:et.sm,border:`1px solid ${e.colors.hairline}`,overflow:"hidden",lineHeight:0},children:[(0,z.jsx)("img",{src:a,alt:"The element you captured, attached to this report",style:{display:"block",maxWidth:"120px",maxHeight:"80px"}}),(0,z.jsx)("button",{type:"button","aria-label":"Remove screenshot",title:"Remove screenshot","data-testid":"pin-composer-attachment-remove",onClick:u,style:{...rt,position:"absolute",top:"2px",right:"2px",width:"16px",height:"16px",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:et.sm,cursor:"pointer",background:e.colors.ink,color:e.colors.onInk,lineHeight:1},children:(0,z.jsx)(Ml,{})})]}):null,(0,z.jsx)("textarea",{autoFocus:!0,ref:y,value:s,onChange:j=>{c(j.target.value),xo(j.target)},onFocus:()=>T(!0),onBlur:()=>T(!1),onKeyDown:j=>{j.key==="Enter"&&(j.nativeEvent.isComposing||j.shiftKey||j.altKey||(j.preventDefault(),!(f||!M)&<()))},rows:1,placeholder:"Start a new thread\u2026","aria-label":"Pinned feedback","data-testid":"pin-body",maxLength:hr,style:{...rt,display:"block",width:"100%",minHeight:q.bodySm.lineHeight,maxHeight:`${Jm}px`,overflowY:"auto",resize:"none",...q.bodySm,color:e.colors.ink,background:"transparent",outline:"none"}}),p?(0,z.jsx)("p",{role:"alert",style:{...rt,color:e.colors.error,...q.caption},children:p}):null,(0,z.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:O.xxs,flex:"0 0 auto"},children:[m?(0,z.jsx)(WS,{theme:e,onApply:j=>{let H=y.current;if(!H)return;let I=mp(s,H.selectionStart,H.selectionEnd,j);c(I.text),requestAnimationFrame(()=>{H.focus(),H.setSelectionRange(I.selectionStart,I.selectionEnd),xo(H)})}}):null,(0,z.jsx)(ai,{theme:e,label:"Take a screenshot",testId:"pin-composer-attach",tone:a?"ink":"ghost",onClick:o,children:(0,z.jsx)(up,{})}),(0,z.jsx)("span",{"aria-hidden":"true",style:{width:"1px",height:"16px",background:e.colors.hairline,margin:`0 ${O.xxs}`}}),(0,z.jsx)(ai,{theme:e,label:m?"Hide formatting":"Formatting",testId:"pin-composer-format",tone:m?"ink":"ghost",onClick:()=>h(j=>!j),children:(0,z.jsx)("span",{style:{...q.captionMono,lineHeight:1},children:"Aa"})}),(0,z.jsx)("span",{style:{flex:"1 1 auto"}}),(0,z.jsx)(ai,{theme:e,label:"Pin it",srText:"Pin it",busy:f,tone:M?"ink":"ghost",disabled:f||!M,onClick:()=>{lt()},children:(0,z.jsx)(op,{})})]})]})})}var jl=Ct(xn(),1);function tk(t,e){let[n,i]=(0,jl.useState)({kind:"loading"}),r=(0,jl.useCallback)(async()=>{i({kind:"loading"});try{i({kind:"session",session:await t.session(e)})}catch(a){i({kind:"error",message:a instanceof mn&&a.code==="network_error"?"Could not reach the feedback service.":"Something went wrong loading your session."})}},[t,e]);(0,jl.useEffect)(()=>{r()},[r]);let l=n.kind==="session"&&n.session.state==="ready"?n.session.project?.id??null:null;return{phase:n,readyProjectId:l,reload:()=>{r()}}}var Q=Ct(me(),1),PO=t=>(0,Q.jsx)(X0,{...t});function lk({env:t,children:e,renderInbox:n=PO,...i}){let r=(0,st.useMemo)(()=>$u(t??hD(),i),[t]);return r.enabled?(0,Q.jsx)(JO,{config:r,renderInbox:n,children:e}):null}function JO({config:t,children:e,renderInbox:n}){let[i,r]=(0,st.useState)(null),[l,a]=(0,st.useState)(!1),o=(0,st.useSyncExternalStore)(fs.subscribe,fs.getSnapshot,fs.getServerSnapshot),[u,s]=(0,st.useState)(!1),[c,f]=(0,st.useState)(null),[d,p]=(0,st.useState)(0),{mode:g,theme:b,setMode:T}=uD(),{collapsed:m,dock:h}=(0,st.useSyncExternalStore)(Hi.subscribe,Hi.getSnapshot,Hi.getServerSnapshot),y=os(h),S=cD(),M=(0,st.useSyncExternalStore)($O,Wx,eD);(0,st.useEffect)(()=>{if(M===null)return;Yd();let nt=window.setTimeout(Yd,0);return()=>window.clearTimeout(nt)},[M]),(0,st.useEffect)(()=>{c0(document,t.assetOrigin)},[t.assetOrigin]);let w=(0,st.useMemo)(()=>Za(t.apiUrl),[t.apiUrl]),A=tk(w,t.projectUrl),N=(0,st.useCallback)(()=>{a(!0),r(null)},[]),R=(0,st.useCallback)(nt=>{r(v=>v===nt?null:nt),a(!1)},[]),k=(0,st.useCallback)(nt=>{f(nt),r(null)},[]),lt=(0,st.useCallback)(nt=>{G0(nt)},[]),j=(0,st.useCallback)(nt=>{$a({collapsed:nt}),nt&&(r(null),a(!1))},[]);(0,st.useEffect)(()=>{if(i===null)return;let nt=v=>{v.key==="Escape"&&(r(null),v.stopPropagation())};return window.addEventListener("keydown",nt),()=>window.removeEventListener("keydown",nt)},[i]),(0,st.useEffect)(()=>{if(i===null)return;let nt=v=>{let Vt=v.target;Vt instanceof Element&&Vt.closest("[data-bitvea-feedback-toolbar]")!==null||r(null)};return window.addEventListener("pointerdown",nt,!0),()=>window.removeEventListener("pointerdown",nt,!0)},[i]);let H=(0,st.useSyncExternalStore)(ek,WO,tD),I=(0,st.useSyncExternalStore)(ek,()=>t.pinShortcut===null?null:Jx(t.pinShortcut,Ju(navigator)),()=>null),K=t.gitBranch??t.environment,bt=t.gitCommit?.slice(0,7)??null,pt=A.readyProjectId,Yt=n!=null&&o&&pt!==null,Lt=n?d:0,x=(0,Q.jsx)(Il,{theme:b,testId:"feedback-toggle",label:i==="note"?"Close feedback":"Leave a note",expanded:i==="note",active:i==="note",onClick:()=>R("note"),children:(0,Q.jsx)(U0,{})}),F=(0,Q.jsxs)("div",{"data-bitvea-feedback-toolbar":"",style:{...rt,position:"fixed",left:0,top:0,width:0,height:0,zIndex:Bi,fontFamily:p0.sans,letterSpacing:"normal",wordSpacing:"normal",textTransform:"none",fontStyle:"normal",fontVariant:"normal",textAlign:"left",textIndent:0,lineHeight:1.5,textDecoration:"none",whiteSpace:"normal",colorScheme:b.resolved},children:[(0,Q.jsxs)("div",{"data-testid":"feedback-dock",style:{position:"fixed",top:0,right:0,bottom:0,left:0,display:"flex",flexDirection:y.flexDirection,justifyContent:"flex-end",alignItems:y.alignItems,boxSizing:"border-box",padding:Ve.inset,paddingBottom:y.paddingBottom,paddingRight:Yt?`clamp(${O.xs}, calc(100vw - 420px), ${dp}px)`:Ve.inset,pointerEvents:"none",zIndex:hn.bar},children:[e===void 0?null:(0,Q.jsx)("div",{style:{pointerEvents:"auto"},children:e}),i!==null?(0,Q.jsx)(dD,{theme:b,tool:i,edge:y,children:i==="note"?(0,Q.jsx)(R0,{config:t,phase:A.phase,theme:b,onReloadSession:A.reload,onDone:()=>r(null)}):(0,Q.jsx)(_0,{config:t,phase:A.phase,theme:b,mode:g,onModeChange:T,onReloadSession:A.reload})}):null,(0,Q.jsx)("div",{"aria-label":"BitVea Feedback toolbar","data-testid":"feedback-bar","data-toolbar-state":m?"collapsed":"expanded",...S.handlers,style:{display:"flex",alignItems:"center",padding:Ve.padding,maxWidth:"100%",boxSizing:"border-box",pointerEvents:"auto",background:b.colors.barSurface,border:`1px solid ${b.colors.barBorder}`,borderRadius:m?et.pill:Ve.radius,boxShadow:b.shadows.bar,cursor:"grab",touchAction:"none",...S.style},children:(0,Q.jsx)(fD,{form:m,children:m?(0,Q.jsxs)(Il,{theme:b,testId:"toolbar-expand",label:Lt>0?`Expand toolbar, ${Lt} open`:"Expand toolbar",expanded:!1,onClick:()=>j(!1),children:[(0,Q.jsx)(ik,{theme:b,size:18,inline:!0}),Lt>0?(0,Q.jsx)(mD,{theme:b,at:y.badge}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ik,{theme:b}),(0,Q.jsx)(Il,{theme:b,testId:"toolbar-pin",label:"Pin to an element",hint:I??void 0,active:l,onClick:()=>l?a(!1):N(),children:(0,Q.jsx)(B0,{})}),x,n?(0,Q.jsx)(Il,{theme:b,testId:"toolbar-inbox",label:Lt>0?`Inbox, ${Lt} open`:"Inbox",expanded:o,active:o,onClick:()=>lt(!o),badge:Lt,children:(0,Q.jsx)(H0,{})}):null,(0,Q.jsx)(Il,{theme:b,testId:"toolbar-account",label:"Account",expanded:i==="account",active:i==="account",onClick:()=>R("account"),children:(0,Q.jsx)(j0,{})}),(0,Q.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:O.xs,height:Ve.button,padding:`0 ${O.sm}`,maxWidth:"220px",flex:"0 1 auto",minWidth:0,boxSizing:"border-box",borderRadius:et.pill,background:b.colors.barHover,...q.captionMono},children:[(0,Q.jsx)("span",{"data-testid":"toolbar-branch",title:K,style:{minWidth:0,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",color:b.colors.body},children:K}),bt?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("span",{"aria-hidden":"true",style:{color:b.colors.body},children:"\xB7"}),(0,Q.jsx)("span",{"data-testid":"toolbar-commit",title:t.gitCommit,style:{flex:"0 0 auto",whiteSpace:"nowrap",color:b.colors.body},children:bt})]}):null]}),(0,Q.jsx)(Il,{theme:b,testId:"toolbar-collapse",label:"Collapse toolbar",expanded:!0,onClick:()=>j(!0),children:(0,Q.jsx)(I0,{turn:y.chevron})})]})})})]}),pt?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(JS,{client:w,config:t,organizationId:pt,theme:b,picking:l,onPickingChange:a,showResolved:u,focusPinId:c,deepLinkPinId:M,onFocusHandled:()=>f(null),onOpenCountChange:p}),n?.({client:w,config:t,organizationId:pt,theme:b,open:o,onClose:()=>lt(!1),showResolved:u,onShowResolvedChange:s,onFocusPin:k})]}):null]});return H?(0,rk.createPortal)(F,document.body):null}function $O(){return()=>{}}function ek(){return()=>{}}function WO(){return typeof document<"u"&&document.body!==null}function tD(){return!1}function eD(){return null}var $m=null,Wm=new Set;function nD(){try{let t=window.localStorage.getItem(Jd);if(b0(t))return t}catch{}return $m??"system"}function iD(t){try{window.localStorage.setItem(Jd,t),$m=null}catch{$m=t}Wm.forEach(e=>e())}function rD(t){return Wm.add(t),()=>Wm.delete(t)}function lD(t){if(typeof window.matchMedia!="function")return()=>{};let e=window.matchMedia($d);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function aD(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia($d).matches}function oD(){return"system"}function uD(){let t=(0,st.useSyncExternalStore)(rD,nD,oD),e=(0,st.useSyncExternalStore)(lD,aD,()=>!1),n=t==="system"?e?"dark":"light":t;return{mode:t,theme:(0,st.useMemo)(()=>y0(n),[n]),setMode:iD}}function nk(t,e,n,i){return Math.max(-e,Math.min(t,i-e-n))}function sD(t,e){let n=window.innerWidth||1,i=window.innerHeight||1,r=t<n/3?"left":t>n*2/3?"right":"center",l=e<i/3?"top":e>i*2/3?"bottom":"middle",o=`${l==="middle"&&r==="center"?e<i/2?"top":"bottom":l}-${r}`;return as(o)?o:ls}function cD(){let[t,e]=(0,st.useState)(null),[n,i]=(0,st.useState)(null),r=(0,st.useRef)(!1),l=n!==null;return(0,st.useEffect)(()=>{if(t===null)return;let a=c=>{let f=c.clientX-t.x,d=c.clientY-t.y;return{x:nk(f,t.left,t.width,window.innerWidth),y:nk(d,t.top,t.height,window.innerHeight),past:l||Math.hypot(f,d)>=h0}},o=c=>{if(c.buttons===0){e(null),i(null);return}let{x:f,y:d,past:p}=a(c);p&&i({x:f,y:d})},u=c=>{let{x:f,y:d,past:p}=a(c);p&&($a({dock:sD(t.left+f+t.width/2,t.top+d+t.height/2)}),r.current=!0),e(null),i(null)},s=()=>{e(null),i(null)};return window.addEventListener("pointermove",o),window.addEventListener("pointerup",u),window.addEventListener("pointercancel",s),()=>{window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",s)}},[t,l]),{style:{...n===null?{}:{transform:`translate3d(${n.x}px, ${n.y}px, 0)`,cursor:"grabbing"},...t===null?{}:{userSelect:"none"}},handlers:{onPointerDown:a=>{if(a.button>0)return;r.current=!1;let o=a.target,u=o instanceof Element&&o.closest("button, a, input, textarea, select")!==null,s=a.currentTarget.dataset.toolbarState==="collapsed";if(u&&!s)return;let c=a.currentTarget.getBoundingClientRect();e({x:a.clientX,y:a.clientY,left:c.left,top:c.top,width:c.width,height:c.height})},onClickCapture:a=>{r.current&&(a.stopPropagation(),a.preventDefault(),r.current=!1)}}}}function fD({form:t,children:e}){let n=x0(t),i=pe();return(0,Q.jsx)("div",{style:{display:"flex",alignItems:"center",gap:Ve.gap,minWidth:0,...ti({visible:n,reduced:i,duration:it.duration.settle})},children:e},String(t))}function Il({theme:t,testId:e,label:n,hint:i,active:r,expanded:l,badge:a,onClick:o,children:u}){let[s,c]=(0,st.useState)(!1),[f,d]=(0,st.useState)(!1),[p,g]=(0,st.useState)(!1),b=pe();return(0,Q.jsxs)("button",{type:"button","data-testid":e,"aria-label":n,title:i===void 0?n:`${n} (${i})`,...l===void 0?{}:{"aria-expanded":l},...r===void 0?{}:{"aria-pressed":r},onClick:o,onPointerEnter:()=>c(!0),onPointerLeave:()=>{c(!1),g(!1)},onPointerDown:()=>g(!0),onPointerUp:()=>g(!1),onPointerCancel:()=>g(!1),onFocus:()=>d(!0),onBlur:()=>d(!1),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:Ve.button,height:Ve.button,flex:"0 0 auto",padding:0,border:"none",borderRadius:et.pill,background:r?t.colors.ink:s?t.colors.barHover:"transparent",color:r?t.colors.onInk:t.colors.barInk,cursor:"pointer",transform:Wn(p?`scale(${it.pressScale})`:"none",b),transition:Xe(["background-color","color","transform"],it.duration.instant,it.easing.inOut,b),outline:"revert",boxShadow:f?t.shadows.focusRing:"none"},children:[u,a!==void 0&&a>0?(0,Q.jsx)(pD,{theme:t,testId:e,active:r??!1,count:a,children:a>99?"99+":a}):null]})}function dD({theme:t,tool:e,edge:n,children:i}){let r=Ui(),l=pe();return(0,Q.jsx)("div",{role:"dialog","aria-label":"BitVea Feedback","data-testid":"feedback-panel","data-toolbar-surface":e,style:{width:e==="note"?"320px":"280px",maxWidth:"100%",boxSizing:"border-box",pointerEvents:"auto",[n.popoverGap]:O.xs,padding:O.sm,background:t.colors.canvas,border:`1px solid ${t.colors.hairline}`,borderRadius:et.lg,boxShadow:t.shadows.popover,color:t.colors.body,...q.bodySm,...ti({visible:r,reduced:l,origin:n.popoverOrigin})},children:i})}function pD({theme:t,testId:e,active:n,count:i,children:r}){let l=pe(),a=S0(i);return(0,Q.jsx)("span",{"data-testid":`${e}-count`,style:{position:"absolute",top:0,right:0,minWidth:Et.badge,height:Et.badge,padding:`0 ${O.xxs}`,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:et.pill,background:n?t.colors.onInk:t.colors.ink,color:n?t.colors.ink:t.colors.onInk,...q.captionMono,border:`1px solid ${n?t.colors.ink:t.colors.barSurface}`,transform:Wn(a?`scale(${it.enterScale})`:"none",l),transition:Xe(["background-color","color","border-color","transform"],it.duration.instant,it.easing.inOut,l)},children:r})}function mD({theme:t,at:e}){return(0,Q.jsx)("span",{"data-testid":"toolbar-expand-count","aria-hidden":"true",style:{position:"absolute",...e,width:Et.dot,height:Et.dot,borderRadius:et.pill,background:t.colors.ink,border:`2px solid ${t.colors.barSurface}`,boxSizing:"content-box"}})}function ik({theme:t,size:e=18,inline:n=!1}){return(0,Q.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",...n?{}:{width:Ve.button,height:Ve.button},flex:"0 0 auto",color:t?.colors.barInk},children:(0,Q.jsxs)("svg",{viewBox:"0 0 435 439",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"BitVea",style:{display:"block",width:`${e}px`,height:`${e}px`},children:[(0,Q.jsx)("path",{d:"M347.997 88.1161H87.207L159.233 0.373047H333.067L347.997 88.1161Z",fill:"currentColor"}),(0,Q.jsx)("path",{d:"M434.913 160.795V336.203L347.996 351.268V88.1167L434.913 160.795Z",fill:"currentColor"}),(0,Q.jsx)("path",{d:"M347.997 351.267L275.971 438.971H102.098L87.207 351.267H347.997Z",fill:"currentColor"}),(0,Q.jsx)("path",{d:"M87.2056 88.1167V351.268L0.25 278.59V103.143L87.2056 88.1167Z",fill:"currentColor"})]})})}function hD(){return typeof process>"u"||!process.env?{}:process.env}var sk=Ct(me(),1),ak="data-bitvea-feedback-toolbar-root",gD=/^data-.*(key|secret|token|password)$/i;function yD(t){let e=o=>{let u=t.getAttribute(o);return u===null||u.length===0?void 0:u},n={[qd]:e("data-api-url"),[jd]:e("data-environment"),[Hd]:e("data-force")},i={},r=e("data-project-url"),l=e("data-git-branch"),a=e("data-git-commit");return r&&(i.projectUrl=r),l&&(i.gitBranch=l),a&&(i.gitCommit=a),{env:n,overrides:i}}function bD(t){return t.getAttributeNames().filter(e=>gD.test(e))}function Zs(t){let e=bD(t);if(e.length>0)return console.error(`[bitvea-feedback] refusing to load: ${e.join(", ")} on the script tag would publish a secret to every visitor. Remove it. Register the project from a terminal or CI instead: npx @bitvea/feedback-toolbar register --project-url <url> --api-key <key>`),null;let{env:n,overrides:i}=yD(t);if(!$u(n,i).enabled||document.querySelector(`[${ak}]`))return null;let r=document.createElement("div");r.setAttribute(ak,""),document.body.appendChild(r);let l=(0,ok.createRoot)(r);return l.render((0,sk.jsx)(lk,{env:n,...i})),{container:r,root:l}}function xD(){return document.currentScript??document.querySelector("script[data-api-url]")}function uk(){let t=xD();return t?document.body?Zs(t):(document.addEventListener("DOMContentLoaded",()=>Zs(t),{once:!0}),null):null}uk();return Sk(vD);})();
|
|
37
|
+
`))}function u(p,g,b,T){let m=b.enter("tableCell"),h=b.enter("phrasing"),y=b.containerPhrasing(p,{...T,before:l,after:l});return h(),m(),y}function s(p,g){return eS(p,{align:g,alignDelimiters:i,padding:n,stringLength:r})}function c(p,g,b){let T=p.children,m=-1,h=[],y=g.enter("table");for(;++m<T.length;)h[m]=f(T[m],g,b);return y(),h}function f(p,g,b){let T=p.children,m=-1,h=[],y=g.enter("tableRow");for(;++m<T.length;)h[m]=u(T[m],p,g,b);return y(),h}function d(p,g,b){let T=yo.inlineCode(p,g,b);return b.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function Bm(){return{exit:{taskListCheckValueChecked:ES,taskListCheckValueUnchecked:ES,paragraph:hO}}}function Um(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:gO}}}function ES(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function hO(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let n=this.stack[this.stack.length-1];n.type;let i=n.children[0];if(i&&i.type==="text"){let r=e.children,l=-1,a;for(;++l<r.length;){let o=r[l];if(o.type==="paragraph"){a=o;break}}a===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function gO(t,e,n,i){let r=t.children[0],l=typeof t.checked=="boolean"&&r&&r.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",o=n.createTracker(i);l&&o.move(a);let u=yo.listItem(t,e,n,{...i,...o.current()});return l&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,s)),u;function s(c){return c+a}}function Hm(){return[gm(),bm(),vm(),Lm(),Bm()]}function jm(t){return{extensions:[ym(),xm(t),Sm(),Nm(t),Um()]}}var yO={tokenize:kO,partial:!0},CS={tokenize:wO,partial:!0},AS={tokenize:TO,partial:!0},MS={tokenize:EO,partial:!0},bO={tokenize:CO,partial:!0},OS={name:"wwwAutolink",tokenize:vO,previous:zS},DS={name:"protocolAutolink",tokenize:SO,previous:RS},li={name:"emailAutolink",tokenize:xO,previous:_S},Mn={};function qm(){return{text:Mn}}var Or=48;for(;Or<123;)Mn[Or]=li,Or++,Or===58?Or=65:Or===91&&(Or=97);Mn[43]=li;Mn[45]=li;Mn[46]=li;Mn[95]=li;Mn[72]=[li,DS];Mn[104]=[li,DS];Mn[87]=[li,OS];Mn[119]=[li,OS];function xO(t,e,n){let i=this,r,l;return a;function a(f){return!Im(f)||!_S.call(i,i.previous)||Fm(i.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),o(f))}function o(f){return Im(f)?(t.consume(f),o):f===64?(t.consume(f),u):n(f)}function u(f){return f===46?t.check(bO,c,s)(f):f===45||f===95||Ht(f)?(l=!0,t.consume(f),u):c(f)}function s(f){return t.consume(f),r=!0,u}function c(f){return l&&r&&$t(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function vO(t,e,n){let i=this;return r;function r(a){return a!==87&&a!==119||!zS.call(i,i.previous)||Fm(i.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(yO,t.attempt(CS,t.attempt(AS,l),n),n)(a))}function l(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function SO(t,e,n){let i=this,r="",l=!1;return a;function a(f){return(f===72||f===104)&&RS.call(i,i.previous)&&!Fm(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),r+=String.fromCodePoint(f),t.consume(f),o):n(f)}function o(f){if($t(f)&&r.length<5)return r+=String.fromCodePoint(f),t.consume(f),o;if(f===58){let d=r.toLowerCase();if(d==="http"||d==="https")return t.consume(f),u}return n(f)}function u(f){return f===47?(t.consume(f),l?s:(l=!0,u)):n(f)}function s(f){return f===null||vr(f)||at(f)||Cn(f)||Sr(f)?n(f):t.attempt(CS,t.attempt(AS,c),n)(f)}function c(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function kO(t,e,n){let i=0;return r;function r(a){return(a===87||a===119)&&i<3?(i++,t.consume(a),r):a===46&&i===3?(t.consume(a),l):n(a)}function l(a){return a===null?n(a):e(a)}}function wO(t,e,n){let i,r,l;return a;function a(s){return s===46||s===95?t.check(MS,u,o)(s):s===null||at(s)||Cn(s)||s!==45&&Sr(s)?u(s):(l=!0,t.consume(s),a)}function o(s){return s===95?i=!0:(r=i,i=void 0),t.consume(s),a}function u(s){return r||i||!l?n(s):e(s)}}function TO(t,e){let n=0,i=0;return r;function r(a){return a===40?(n++,t.consume(a),r):a===41&&i<n?l(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(MS,e,l)(a):a===null||at(a)||Cn(a)?e(a):(t.consume(a),r)}function l(a){return a===41&&i++,t.consume(a),r}}function EO(t,e,n){return i;function i(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(t.consume(o),i):o===38?(t.consume(o),l):o===93?(t.consume(o),r):o===60||o===null||at(o)||Cn(o)?e(o):n(o)}function r(o){return o===null||o===40||o===91||at(o)||Cn(o)?e(o):i(o)}function l(o){return $t(o)?a(o):n(o)}function a(o){return o===59?(t.consume(o),i):$t(o)?(t.consume(o),a):n(o)}}function CO(t,e,n){return i;function i(l){return t.consume(l),r}function r(l){return Ht(l)?n(l):e(l)}}function zS(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||at(t)}function RS(t){return!$t(t)}function _S(t){return!(t===47||Im(t))}function Im(t){return t===43||t===45||t===46||t===95||Ht(t)}function Fm(t){let e=t.length,n=!1;for(;e--;){let i=t[e][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var AO={tokenize:LO,partial:!0};function Ym(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:zO,continuation:{tokenize:RO},exit:_O}},text:{91:{name:"gfmFootnoteCall",tokenize:DO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:MO,resolveTo:OO}}}}function MO(t,e,n){let i=this,r=i.events.length,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),a;for(;r--;){let u=i.events[r][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return o;function o(u){if(!a||!a._balanced)return n(u);let s=he(i.sliceSerialize({start:a.end,end:i.now()}));return s.codePointAt(0)!==94||!l.includes(s.slice(1))?n(u):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(u),t.exit("gfmFootnoteCallLabelMarker"),e(u))}}function OO(t,e){let n=t.length,i;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){i=t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",l,e],["exit",l,e],["enter",a,e],["enter",o,e],["exit",o,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function DO(t,e,n){let i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),l=0,a;return o;function o(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),u}function u(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",s)}function s(f){if(l>999||f===93&&!a||f===null||f===91||at(f))return n(f);if(f===93){t.exit("chunkString");let d=t.exit("gfmFootnoteCallString");return r.includes(he(i.sliceSerialize(d)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return at(f)||(a=!0),l++,t.consume(f),f===92?c:s}function c(f){return f===91||f===92||f===93?(t.consume(f),l++,s):s(f)}}function zO(t,e,n){let i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),l,a=0,o;return u;function u(g){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),s}function s(g){return g===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",c):n(g)}function c(g){if(a>999||g===93&&!o||g===null||g===91||at(g))return n(g);if(g===93){t.exit("chunkString");let b=t.exit("gfmFootnoteDefinitionLabelString");return l=he(i.sliceSerialize(b)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),d}return at(g)||(o=!0),a++,t.consume(g),g===92?f:c}function f(g){return g===91||g===92||g===93?(t.consume(g),a++,c):c(g)}function d(g){return g===58?(t.enter("definitionMarker"),t.consume(g),t.exit("definitionMarker"),r.includes(l)||r.push(l),Y(t,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return e(g)}}function RO(t,e,n){return t.check(An,e,t.attempt(AO,e,n))}function _O(t){t.exit("gfmFootnoteDefinition")}function LO(t,e,n){let i=this;return Y(t,r,"gfmFootnoteDefinitionIndent",5);function r(l){let a=i.events[i.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(l):n(l)}}function Vm(t){let n=(t||{}).singleTilde,i={name:"strikethrough",tokenize:l,resolveAll:r};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function r(a,o){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let s=u;for(;s--;)if(a[s][0]==="exit"&&a[s][1].type==="strikethroughSequenceTemporary"&&a[s][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[s][1].end.offset-a[s][1].start.offset){a[u][1].type="strikethroughSequence",a[s][1].type="strikethroughSequence";let c={type:"strikethrough",start:Object.assign({},a[s][1].start),end:Object.assign({},a[u][1].end)},f={type:"strikethroughText",start:Object.assign({},a[s][1].end),end:Object.assign({},a[u][1].start)},d=[["enter",c,o],["enter",a[s][1],o],["exit",a[s][1],o],["enter",f,o]],p=o.parser.constructs.insideSpan.null;p&&Ft(d,d.length,0,Fi(p,a.slice(s+1,u),o)),Ft(d,d.length,0,[["exit",f,o],["enter",a[u][1],o],["exit",a[u][1],o],["exit",c,o]]),Ft(a,s-1,u-s+3,d),u=s+d.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function l(a,o,u){let s=this.previous,c=this.events,f=0;return d;function d(g){return s===126&&c[c.length-1][1].type!=="characterEscape"?u(g):(a.enter("strikethroughSequenceTemporary"),p(g))}function p(g){let b=ri(s);if(g===126)return f>1?u(g):(a.consume(g),f++,p);if(f<2&&!n)return u(g);let T=a.exit("strikethroughSequenceTemporary"),m=ri(g);return T._open=!m||m===2&&!!b,T._close=!b||b===2&&!!m,o(g)}}}var Xs=class{constructor(){this.map=[]}add(e,n,i){NO(this,e,n,i)}consume(e){if(this.map.sort(function(l,a){return l[0]-a[0]}),this.map.length===0)return;let n=this.map.length,i=[];for(;n>0;)n-=1,i.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];i.push(e.slice()),e.length=0;let r=i.pop();for(;r;){for(let l of r)e.push(l);r=i.pop()}this.map.length=0}};function NO(t,e,n,i){let r=0;if(!(n===0&&i.length===0)){for(;r<t.map.length;){if(t.map[r][0]===e){t.map[r][1]+=n,t.map[r][2].push(...i);return}r+=1}t.map.push([e,n,i])}}function LS(t,e){let n=!1,i=[];for(;e<t.length;){let r=t[e];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&i.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){let l=i.length-1;i[l]=i[l]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return i}function Xm(){return{flow:{null:{name:"table",tokenize:BO,resolveAll:UO}}}}function BO(t,e,n){let i=this,r=0,l=0,a;return o;function o(k){let lt=i.events.length-1;for(;lt>-1;){let I=i.events[lt][1].type;if(I==="lineEnding"||I==="linePrefix")lt--;else break}let j=lt>-1?i.events[lt][1].type:null,H=j==="tableHead"||j==="tableRow"?w:u;return H===w&&i.parser.lazy[i.now().line]?n(k):H(k)}function u(k){return t.enter("tableHead"),t.enter("tableRow"),s(k)}function s(k){return k===124||(a=!0,l+=1),c(k)}function c(k){return k===null?n(k):B(k)?l>1?(l=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),p):n(k):X(k)?Y(t,c,"whitespace")(k):(l+=1,a&&(a=!1,r+=1),k===124?(t.enter("tableCellDivider"),t.consume(k),t.exit("tableCellDivider"),a=!0,c):(t.enter("data"),f(k)))}function f(k){return k===null||k===124||at(k)?(t.exit("data"),c(k)):(t.consume(k),k===92?d:f)}function d(k){return k===92||k===124?(t.consume(k),f):f(k)}function p(k){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(k):(t.enter("tableDelimiterRow"),a=!1,X(k)?Y(t,g,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):g(k))}function g(k){return k===45||k===58?T(k):k===124?(a=!0,t.enter("tableCellDivider"),t.consume(k),t.exit("tableCellDivider"),b):M(k)}function b(k){return X(k)?Y(t,T,"whitespace")(k):T(k)}function T(k){return k===58?(l+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(k),t.exit("tableDelimiterMarker"),m):k===45?(l+=1,m(k)):k===null||B(k)?S(k):M(k)}function m(k){return k===45?(t.enter("tableDelimiterFiller"),h(k)):M(k)}function h(k){return k===45?(t.consume(k),h):k===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(k),t.exit("tableDelimiterMarker"),y):(t.exit("tableDelimiterFiller"),y(k))}function y(k){return X(k)?Y(t,S,"whitespace")(k):S(k)}function S(k){return k===124?g(k):k===null||B(k)?!a||r!==l?M(k):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(k)):M(k)}function M(k){return n(k)}function w(k){return t.enter("tableRow"),A(k)}function A(k){return k===124?(t.enter("tableCellDivider"),t.consume(k),t.exit("tableCellDivider"),A):k===null||B(k)?(t.exit("tableRow"),e(k)):X(k)?Y(t,A,"whitespace")(k):(t.enter("data"),N(k))}function N(k){return k===null||k===124||at(k)?(t.exit("data"),A(k)):(t.consume(k),k===92?R:N)}function R(k){return k===92||k===124?(t.consume(k),N):N(k)}}function UO(t,e){let n=-1,i=!0,r=0,l=[0,0,0,0],a=[0,0,0,0],o=!1,u=0,s,c,f,d=new Xs;for(;++n<t.length;){let p=t[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(o=!1,u!==0&&(NS(d,e,u,s,c),c=void 0,u=0),s={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},d.add(n,0,[["enter",s,e]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(i=!0,f=void 0,l=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,c={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},d.add(n,0,[["enter",c,e]])),r=g.type==="tableDelimiterRow"?2:c?3:1):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(i=!1,a[2]===0&&(l[1]!==0&&(a[0]=a[1],f=Gs(d,e,l,r,void 0,f),l=[0,0,0,0]),a[2]=n)):g.type==="tableCellDivider"&&(i?i=!1:(l[1]!==0&&(a[0]=a[1],f=Gs(d,e,l,r,void 0,f)),l=a,a=[l[1],n,0,0])):g.type==="tableHead"?(o=!0,u=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(u=n,l[1]!==0?(a[0]=a[1],f=Gs(d,e,l,r,n,f)):a[1]!==0&&(f=Gs(d,e,a,r,n,f)),r=0):r&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&NS(d,e,u,s,c),d.consume(e.events),n=-1;++n<e.events.length;){let p=e.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=LS(e.events,n))}return t}function Gs(t,e,n,i,r,l){let a=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(l.end=Object.assign({},Ul(e.events,n[0])),t.add(n[0],0,[["exit",l,e]]));let u=Ul(e.events,n[1]);if(l={type:a,start:Object.assign({},u),end:Object.assign({},u)},t.add(n[1],0,[["enter",l,e]]),n[2]!==0){let s=Ul(e.events,n[2]),c=Ul(e.events,n[3]),f={type:o,start:Object.assign({},s),end:Object.assign({},c)};if(t.add(n[2],0,[["enter",f,e]]),i!==2){let d=e.events[n[2]],p=e.events[n[3]];if(d[1].end=Object.assign({},p[1].end),d[1].type="chunkText",d[1].contentType="text",n[3]>n[2]+1){let g=n[2]+1,b=n[3]-n[2]-1;t.add(g,b,[])}}t.add(n[3]+1,0,[["exit",f,e]])}return r!==void 0&&(l.end=Object.assign({},Ul(e.events,r)),t.add(r,0,[["exit",l,e]]),l=void 0),l}function NS(t,e,n,i,r){let l=[],a=Ul(e.events,n);r&&(r.end=Object.assign({},a),l.push(["exit",r,e])),i.end=Object.assign({},a),l.push(["exit",i,e]),t.add(n+1,0,l)}function Ul(t,e){let n=t[e],i=n[0]==="enter"?"start":"end";return n[1][i]}var HO={name:"tasklistCheck",tokenize:jO};function Gm(){return{text:{91:HO}}}function jO(t,e,n){let i=this;return r;function r(u){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(u):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(u),t.exit("taskListCheckMarker"),l)}function l(u){return at(u)?(t.enter("taskListCheckValueUnchecked"),t.consume(u),t.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(t.enter("taskListCheckValueChecked"),t.consume(u),t.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(t.enter("taskListCheckMarker"),t.consume(u),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),o):n(u)}function o(u){return B(u)?e(u):X(u)?t.check({tokenize:IO},e,n)(u):n(u)}}function IO(t,e,n){return Y(t,i,"whitespace");function i(r){return r===null?n(r):e(r)}}function BS(t){return xs([qm(),Ym(),Vm(t),Xm(),Gm()])}var qO={};function Qs(t){let e=this,n=t||qO,i=e.data(),r=i.micromarkExtensions||(i.micromarkExtensions=[]),l=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),a=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);r.push(BS(n)),l.push(Hm()),a.push(jm(n))}var we=Ct(me(),1);function US({theme:t,body:e}){let n={p:({children:i})=>(0,we.jsx)("p",{style:{...rt,...q.bodySm,color:t.colors.ink,overflowWrap:"break-word",marginBottom:O.xxs},children:i}),strong:({children:i})=>(0,we.jsx)("span",{style:{fontWeight:500,color:t.colors.ink},children:i}),em:({children:i})=>(0,we.jsx)("span",{style:{fontStyle:"italic"},children:i}),del:({children:i})=>(0,we.jsx)("span",{style:{textDecoration:"line-through",color:t.colors.body},children:i}),a:({href:i,children:r})=>i===void 0||i===""?(0,we.jsx)("span",{style:{color:t.colors.body},children:r}):(0,we.jsx)("a",{href:i,target:"_blank",rel:"noopener noreferrer nofollow",style:{color:t.colors.link,textDecoration:"underline",textUnderlineOffset:"2px"},children:r}),code:({children:i})=>(0,we.jsx)("code",{style:{...q.captionMono,background:t.colors.canvasSoft2,borderRadius:"3px",padding:"0 3px",color:t.colors.ink},children:i}),pre:({children:i})=>(0,we.jsx)("pre",{style:{...rt,...q.captionMono,background:t.colors.canvasSoft2,color:t.colors.ink,borderRadius:"4px",padding:O.xs,marginBottom:O.xxs,overflowX:"auto"},children:i}),ul:({children:i})=>(0,we.jsx)("ul",{style:{...rt,listStyle:"disc outside",paddingLeft:O.md,marginBottom:O.xxs},children:i}),ol:({children:i})=>(0,we.jsx)("ol",{style:{...rt,listStyle:"decimal outside",paddingLeft:O.md,marginBottom:O.xxs},children:i}),li:({children:i})=>(0,we.jsx)("li",{style:{...q.bodySm,color:t.colors.ink},children:i}),blockquote:({children:i})=>(0,we.jsx)("blockquote",{style:{...rt,borderLeft:`2px solid ${t.colors.hairline}`,paddingLeft:O.xs,color:t.colors.body,marginBottom:O.xxs},children:i}),hr:()=>(0,we.jsx)("hr",{style:{...rt,border:0,borderTop:`1px solid ${t.colors.hairline}`,margin:`${O.xs} 0`}})};return(0,we.jsx)(sm,{remarkPlugins:[Qs],rehypePlugins:[],urlTransform:Q0,allowedElements:[...K0],unwrapDisallowed:!0,components:n,children:e})}var HS=["data-testid","data-test-id","data-qa"];function jS(t){return t.length>40||/^:r[0-9a-z]+:$/i.test(t)||/^[0-9a-f]{16,}$/i.test(t)||/^(radix|headlessui|mui|chakra)-/i.test(t)}function IS(t){let e=globalThis.CSS?.escape;return e?e(t):t.replace(/[^\w-]/g,"\\$&")}function FO(t){let e=t.tagName.toLowerCase(),n=t.parentElement;if(!n)return e;let i=Array.from(n.children).filter(r=>r.tagName===t.tagName);return i.length===1?e:`${e}:nth-of-type(${i.indexOf(t)+1})`}function qS(t){if(t.id&&!jS(t.id)){let r=`#${IS(t.id)}`;if(bo(r,t))return r}for(let r of HS){let l=t.getAttribute(r);if(l){let a=`[${r}="${FS(l)}"]`;if(bo(a,t))return a}}let e=[],n=t;for(;n&&n!==document.documentElement;){e.unshift(FO(n));let r=n.parentElement;if(r){let a=YO(r);if(a){let o=`${a} > ${e.join(" > ")}`;if(bo(o,t))return o}}let l=e.join(" > ");if(bo(l,t))return l;n=r}let i=e.join(" > ");return bo(i,t)?i:null}function YO(t){if(t.id&&!jS(t.id))return`#${IS(t.id)}`;for(let e of HS){let n=t.getAttribute(e);if(n)return`[${e}="${FS(n)}"]`}return null}function FS(t){return t.replace(/["\\]/g,"\\$&")}function bo(t,e){try{let n=document.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}}function Qm(t){try{return document.querySelector(t)}catch{return null}}function YS(t,e,n){let i=t.getBoundingClientRect(),r=i.width>0?(e-i.left)/i.width:.5,l=i.height>0?(n-i.top)/i.height:.5;return{offsetX:Math.min(1,Math.max(0,r)),offsetY:Math.min(1,Math.max(0,l))}}function VS(t,e,n){let i=Qm(t);if(!i)return null;let r=i.getBoundingClientRect();return r.width===0&&r.height===0?null:{x:r.left+r.width*e,y:r.top+r.height*n}}var z=Ct(me(),1),VO='[data-bitvea-pin-surface], [data-testid="pin-composer"], [data-bitvea-feedback-toolbar]',Hl=16,XS=12,Pm=`calc(100vw - ${rn*2}px)`,XO=200,PS=Number.parseFloat(Et.thread),Jm=120,Ks="draft",GO=1200;function JS({client:t,config:e,organizationId:n,theme:i=Cl,picking:r,onPickingChange:l,showResolved:a=!1,focusPinId:o=null,onFocusHandled:u,deepLinkPinId:s=null,onOpenCountChange:c}){let[f,d]=(0,V.useState)([]),[p,g]=(0,V.useState)(null),[b,T]=(0,V.useState)(null),[m,h]=(0,V.useState)({}),[y,S]=(0,V.useState)(null),[M,w]=(0,V.useState)({}),[A,N]=(0,V.useState)(!1),[R,k]=(0,V.useState)(0),lt=Tl(),j=(0,V.useCallback)(async()=>{try{d(await t.listForPage(n,lt))}catch{d([])}finally{N(!0)}},[t,n,lt]);(0,V.useEffect)(()=>{j()},[j]),(0,V.useEffect)(()=>{let L=()=>k(G=>G+1);return window.addEventListener("scroll",L,{passive:!0}),window.addEventListener("resize",L),()=>{window.removeEventListener("scroll",L),window.removeEventListener("resize",L)}},[]),(0,V.useEffect)(()=>{let L=G=>{if(G.key==="Escape"){if(p!==null)g(null);else if(b!==null)T(null);else if(r)l(!1);else if(y!==null)S(null);else return;G.stopPropagation()}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[p,y,r,b,l]),(0,V.useEffect)(()=>{let L=e.pinShortcut;if(L==null)return;let G=new Pu,fe=Ju(typeof navigator>"u"?void 0:navigator),Re=Dn=>{G.down(Dn.key),!Zx(Dn.target)&&Px(L,Dn,G.keys(),fe)&&p===null&&(r||(l(!0),Dn.preventDefault(),Dn.stopPropagation()))},sn=Dn=>G.up(Dn.key),Qi=()=>G.clear();return window.addEventListener("keydown",Re,!0),window.addEventListener("keyup",sn,!0),window.addEventListener("blur",Qi),document.addEventListener("visibilitychange",Qi),()=>{window.removeEventListener("keydown",Re,!0),window.removeEventListener("keyup",sn,!0),window.removeEventListener("blur",Qi),document.removeEventListener("visibilitychange",Qi)}},[e.pinShortcut,p,r,l]),(0,V.useEffect)(()=>{if(y===null)return;let L=G=>{let fe=G.target;fe instanceof Element&&fe.closest(VO)!==null||S(null)};return window.addEventListener("pointerdown",L,!0),()=>window.removeEventListener("pointerdown",L,!0)},[y]);let H=(0,V.useMemo)(()=>f.filter(L=>L.status!=="DONE").length,[f]);(0,V.useEffect)(()=>{c?.(H)},[H,c]);let I=(0,V.useMemo)(()=>f.filter(L=>L.kind==="PINNED"&&L.pin&&(a||L.status!=="DONE"||L.id===y)).map(L=>L.id),[y,f,a]),[K,bt]=(0,V.useState)(I),[pt,Yt]=(0,V.useState)([]);if(K!==I){let L=K.filter(G=>!I.includes(G));bt(I),L.length>0&&Yt(G=>[...G,...L.filter(fe=>!G.includes(fe))])}(0,V.useEffect)(()=>{if(pt.length===0)return;let L=window.setTimeout(()=>Yt([]),Pa(it.duration.fast));return()=>window.clearTimeout(L)},[pt]);let Lt=(0,V.useMemo)(()=>{let L=new Set(I);return f.filter(G=>G.kind==="PINNED"&&G.pin&&(L.has(G.id)||pt.includes(G.id))).map(G=>({item:G,at:VS(G.pin.selector,G.pin.offsetX,G.pin.offsetY),departing:!L.has(G.id)})).filter(G=>G.at!==null)},[pt,I,f,R]),x=o??s,[F,nt]=(0,V.useState)(null);x!==null&&x!==F&&(nt(x),S(x)),(0,V.useEffect)(()=>{o!==null&&(GS(f,o),u?.())},[o,f,u]);let v=(0,V.useRef)(!1);(0,V.useEffect)(()=>{s===null||v.current||!A||(v.current=!0,GS(f,s))},[s,A,f]);let Vt=f.find(L=>L.id===y)??null,ce=Vt!==null&&!Lt.some(L=>L.item.id===Vt.id)?Vt:null,[ql,Dr]=(0,V.useState)(!1),Zt=s!==null&&A&&!ql&&!f.some(L=>L.id===s);function Gi(L){w(G=>({...G,[L.id]:L.replies.length}))}async function un(L){let G=b,fe=Zm(L.currentTarget,L.clientX,L.clientY);if(T(null),!fe||G===null)return;let Re=await o0(fe);Re!==null&&h(sn=>({...sn,[G]:Re}))}function On(L){let G=Zm(L.currentTarget,L.clientX,L.clientY);if(!G)return;let fe=qS(G);if(!fe){l(!1);return}let{offsetX:Re,offsetY:sn}=YS(G,L.clientX,L.clientY);g({selector:fe,offsetX:Re,offsetY:sn,x:L.clientX,y:L.clientY}),l(!1)}return(0,z.jsxs)(z.Fragment,{children:[r?(0,z.jsx)(QS,{theme:i,onPick:On}):null,b!==null?(0,z.jsx)(QS,{theme:i,onPick:L=>{un(L)}}):null,Lt.map(({item:L,at:G,departing:fe})=>(0,z.jsx)(QO,{item:L,at:G,theme:i,departing:fe,dimmed:L.status==="DONE",focused:y===L.id,unread:L.replies.length>(M[L.id]??-1),outdated:ZS(L,e),attachment:m[L.id]??null,onRequestCapture:()=>T(L.id),onClearAttachment:()=>h(({[L.id]:Re,...sn})=>sn),apiUrl:e.apiUrl,open:y===L.id,onToggle:()=>{Gi(L),S(Re=>Re===L.id?null:L.id)},client:t,organizationId:n,onChanged:j},L.id)),ce?(0,z.jsx)("div",{"data-testid":`pin-stranded-${ce.id}`,"data-bitvea-pin-surface":"",style:{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:hn.thread},children:(0,z.jsx)($S,{item:ce,theme:i,client:t,organizationId:n,onChanged:j,outdated:ZS(ce,e),attachment:m[ce.id]??null,onRequestCapture:()=>T(ce.id),onClearAttachment:()=>h(({[ce.id]:L,...G})=>G),apiUrl:e.apiUrl,position:{position:"relative"},note:ce.pin?"The element this was pinned to is gone, so the thread is shown here instead.":"A note about the page as a whole, so it has no pin.",onClose:()=>S(null)})}):null,Zt?(0,z.jsxs)("div",{role:"alert","data-testid":"pin-missing",style:{position:"fixed",left:"50%",top:O.md,transform:"translateX(-50%)",zIndex:hn.alert,display:"flex",alignItems:"center",gap:O.xs,padding:`${O.xs} ${O.sm}`,maxWidth:Pm,background:i.colors.canvas,border:`1px solid ${i.colors.hairline}`,borderRadius:et.lg,boxShadow:i.shadows.popover,...q.bodySm,color:i.colors.body},children:[(0,z.jsx)("span",{children:"That feedback is not on this page any more."}),(0,z.jsx)("button",{type:"button","data-testid":"pin-missing-dismiss",onClick:()=>Dr(!0),style:{padding:0,border:"none",background:"transparent",color:i.colors.body,cursor:"pointer",...q.bodySmStrong,outline:"revert"},children:"Dismiss"})]}):null,p?(0,z.jsx)(ZO,{draft:p,theme:i,client:t,config:e,organizationId:n,onDone:()=>{g(null),h(({[Ks]:L,...G})=>G),j()},attachment:m[Ks]??null,onRequestCapture:()=>T(Ks),onClearAttachment:()=>h(({[Ks]:L,...G})=>G)}):null]})}function GS(t,e){let n=t.find(r=>r.id===e);(n?.pin?Qm(n.pin.selector):null)?.scrollIntoView({behavior:"smooth",block:"center"})}function Zm(t,e,n){let i=t.style.visibility;t.style.visibility="hidden";let r=document.elementFromPoint(e,n);return t.style.visibility=i,!r||r===document.body||r===document.documentElement||r.closest("[data-bitvea-feedback-toolbar]")!==null?null:r}function QS({theme:t,onPick:e}){let[n,i]=(0,V.useState)(null);return(0,z.jsx)("div",{"data-testid":"pin-picker",onClick:e,onMouseMove:r=>{let l=Zm(r.currentTarget,r.clientX,r.clientY);i(l?l.getBoundingClientRect():null)},onMouseLeave:()=>i(null),style:{position:"fixed",inset:0,zIndex:hn.picker,cursor:"crosshair",background:t.colors.pickTint},children:n?(0,z.jsx)("div",{"data-testid":"pin-picker-outline","aria-hidden":"true",style:{position:"fixed",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,border:`2px dashed ${t.colors.ink}`,borderRadius:et.sm,background:t.colors.inkSoft,boxShadow:`0 0 0 1px ${t.colors.markerRing}, inset 0 0 0 1px ${t.colors.markerRing}`,pointerEvents:"none"}}):null})}function QO({item:t,at:e,theme:n,departing:i,dimmed:r,focused:l,unread:a,open:o,onToggle:u,client:s,organizationId:c,onChanged:f,outdated:d,attachment:p,onRequestCapture:g,onClearAttachment:b,apiUrl:T}){let m=us(o,El(it.duration.fast)),h=pe(),y=Math.min(PS,window.innerWidth-rn*2),S=window.innerWidth-rn-(e.x+Hl),M=e.x-Hl-rn,w=S<y&&M>S?e.x-Hl-y:e.x+Hl,A=Math.min(Math.max(w,rn),window.innerWidth-rn-y);return(0,z.jsxs)("div",{"data-bitvea-pin-surface":"",inert:i,style:{position:"fixed",left:e.x,top:e.y,zIndex:m.mounted?hn.thread:hn.marker,...i?{pointerEvents:"none"}:{}},children:[(0,z.jsxs)("button",{type:"button","data-testid":`pin-${t.id}`,"data-bitvea-pin":t.id,"aria-label":`Feedback from ${Wa(t.author.name,t.author.email)}: ${t.body.slice(0,60)}`,onClick:u,style:{position:"absolute",transform:"translate(0, -100%)",width:Et.icon,height:Et.icon,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,borderRadius:`50% 50% 50% ${et.xs}`,border:`2px solid ${n.colors.markerRing}`,background:Zd.gradient,color:Zd.onAccent,...q.caption,fontWeight:500,boxShadow:l?`${n.shadows.focusRing}, ${n.shadows.marker}`:n.shadows.marker,opacity:i?0:r?.45:1,transition:Xe(["opacity"],it.duration.fast,i?it.easing.exit:it.easing.inOut,h),cursor:"pointer",outline:"revert"},children:[ip(t.author.name,t.author.email),a?(0,z.jsx)("span",{"data-testid":`pin-unread-${t.id}`,"aria-hidden":"true",style:{position:"absolute",top:`-${O.xxs}`,right:`-${O.xxs}`,width:Et.dot,height:Et.dot,borderRadius:et.pill,background:n.colors.ink,border:`2px solid ${n.colors.markerRing}`,boxSizing:"content-box"}}):null]}),m.mounted?(0,z.jsx)($S,{item:t,theme:n,client:s,organizationId:c,onChanged:f,outdated:d,attachment:p,onRequestCapture:g,onClearAttachment:b,apiUrl:T,position:{position:"absolute",left:`${A-e.x}px`,top:`${Hl}px`},origin:`${e.x-A}px -${Hl}px`,leaving:m.leaving}):null]})}function $S({item:t,theme:e,client:n,organizationId:i,onChanged:r,position:l,note:a,onClose:o,origin:u,leaving:s=!1,outdated:c=!1,attachment:f,onRequestCapture:d,onClearAttachment:p,apiUrl:g}){let[b,T]=(0,V.useState)(""),[m,h]=(0,V.useState)(!1),[y,S]=(0,V.useState)(null),[M,w]=(0,V.useState)(!1),[A,N]=(0,V.useState)(!1),[R,k]=(0,V.useState)(!1),lt=Ui(),j=pe(),H=v0(t.replies.map(F=>F.id)),I=(0,V.useRef)(null);async function K(){let F=b.trim();if(F.length!==0){h(!0),S(null);try{await n.reply(i,t.id,F,f??void 0),T(""),p(),xo(I.current),r()}catch{S("Could not post that reply.")}finally{h(!1)}}}async function bt(F){w(!0),S(null);try{await n.setStatus(i,t.id,F),r()}catch(nt){S(nt instanceof mn&&nt.code==="not_invited_to_project"?"You are not invited to this project any more.":"Could not change the status.")}finally{w(!1)}}let pt=t.status==="DONE",Yt=b.trim().length>0,Lt=[rp(t.createdAt)],x=[Al(t.createdAt),t.userAgent].filter(F=>typeof F=="string"&&F!=="").join(" \xB7 ");return(0,z.jsxs)("section",{"data-testid":`pin-thread-${t.id}`,style:{...rt,...l,width:Et.thread,maxWidth:Pm,maxHeight:Et.threadMaxHeight,boxSizing:"border-box",display:"flex",flexDirection:"column",background:e.colors.canvas,border:`1px solid ${e.colors.hairline}`,borderRadius:et.lg,boxShadow:e.shadows.popover,...q.bodySm,color:e.colors.body,...ti({visible:lt,leaving:s,reduced:j,origin:u})},children:[o?(0,z.jsx)("header",{style:{...rt,flex:"0 0 auto",display:"flex",justifyContent:"flex-end",padding:`${O.xs} ${O.xs} 0`},children:(0,z.jsx)(ai,{theme:e,label:"Close thread",testId:`pin-thread-close-${t.id}`,onClick:o,children:(0,z.jsx)(Ml,{})})}):null,(0,z.jsxs)("div",{style:{flex:"1 1 auto",minHeight:0,overflowY:"auto",overscrollBehavior:"contain"},children:[a?(0,z.jsx)("p",{"data-testid":`pin-note-${t.id}`,style:{...rt,margin:`${O.sm} ${O.sm} 0`,padding:O.xs,borderRadius:et.sm,background:e.colors.canvasSoft2,color:e.colors.body,...q.caption},children:a}):null,(0,z.jsx)(KS,{theme:e,testId:`pin-message-${t.id}`,name:t.author.name,email:t.author.email,body:t.body,facts:Lt,factsTitle:x,badge:c?(0,z.jsx)(KO,{theme:e,id:t.id}):void 0,alwaysShowActions:!0,actions:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Km,{theme:e,label:"Copy link to this thread",text:ts(t.pageUrl,t.id),icon:(0,z.jsx)(q0,{})}),(0,z.jsx)(Km,{theme:e,label:"Copy message",text:t.body,icon:(0,z.jsx)(lp,{})}),(0,z.jsx)(ai,{theme:e,label:pt?"Reopen":"Resolve",srText:pt?"Reopen":"Resolve",testId:`pin-resolve-${t.id}`,tone:pt?"ink":"ghost",disabled:M,onClick:()=>{bt(pt?"OPEN":"DONE")},children:(0,z.jsx)(ap,{})})]})}),t.replies.map((F,nt)=>(0,z.jsx)(KS,{theme:e,testId:`pin-message-${F.id}`,name:F.author.name,email:F.author.email,body:F.body,facts:[...F.viaAgent?["via agent"]:[],rp(F.createdAt)],factsTitle:Al(F.createdAt),image:F.screenshotUrl?{url:F.screenshotUrl.startsWith("/")?`${g}${F.screenshotUrl}`:F.screenshotUrl,alt:`Screenshot attached by ${Wa(F.author.name,F.author.email)}`}:void 0,divided:nt===0,arriving:H(F.id),actions:(0,z.jsx)(Km,{theme:e,label:"Copy reply",text:F.body,icon:(0,z.jsx)(lp,{})})},F.id))]}),(0,z.jsxs)("div",{style:{...rt,flex:"0 0 auto",padding:O.sm,borderTop:`1px solid ${e.colors.hairline}`},children:[y?(0,z.jsx)("p",{role:"alert",style:{...rt,margin:`0 0 ${O.xxs}`,color:e.colors.error,...q.caption},children:y}):null,(0,z.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:O.xs,padding:O.xs,borderRadius:et.sm,background:e.colors.canvasSoft2,boxShadow:A?e.shadows.focusRing:"none"},children:[f?(0,z.jsxs)("div",{"data-testid":`pin-attachment-${t.id}`,style:{position:"relative",alignSelf:"flex-start",borderRadius:et.sm,border:`1px solid ${e.colors.hairline}`,overflow:"hidden",lineHeight:0},children:[(0,z.jsx)("img",{src:f,alt:"The element you captured, attached to this reply",style:{display:"block",maxWidth:"120px",maxHeight:"80px"}}),(0,z.jsx)("button",{type:"button","aria-label":"Remove screenshot",title:"Remove screenshot","data-testid":`pin-attachment-remove-${t.id}`,onClick:p,style:{...rt,position:"absolute",top:"2px",right:"2px",width:"16px",height:"16px",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:et.sm,cursor:"pointer",background:e.colors.ink,color:e.colors.onInk,lineHeight:1},children:(0,z.jsx)(Ml,{})})]}):null,(0,z.jsx)("textarea",{ref:I,value:b,onChange:F=>{T(F.target.value),xo(F.target)},onFocus:()=>N(!0),onBlur:()=>N(!1),onKeyDown:F=>{F.key==="Enter"&&(F.nativeEvent.isComposing||F.shiftKey||F.altKey||(F.preventDefault(),!(m||!Yt)&&K()))},rows:1,placeholder:"Add a reply\u2026","aria-label":"Reply","data-testid":`pin-reply-${t.id}`,maxLength:hr,style:{...rt,display:"block",width:"100%",minHeight:q.bodySm.lineHeight,maxHeight:`${Jm}px`,overflowY:"auto",resize:"none",...q.bodySm,color:e.colors.ink,background:"transparent",outline:"none"}}),(0,z.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:O.xxs,flex:"0 0 auto"},children:[R?(0,z.jsx)(WS,{theme:e,onApply:F=>{let nt=I.current;if(!nt)return;let v=mp(b,nt.selectionStart,nt.selectionEnd,F);T(v.text),requestAnimationFrame(()=>{nt.focus(),nt.setSelectionRange(v.selectionStart,v.selectionEnd),xo(nt)})}}):null,(0,z.jsx)(ai,{theme:e,label:"Take a screenshot",testId:`pin-attach-${t.id}`,tone:f?"ink":"ghost",onClick:d,children:(0,z.jsx)(up,{})}),(0,z.jsx)("span",{"aria-hidden":"true",style:{width:"1px",height:"16px",background:e.colors.hairline,margin:`0 ${O.xxs}`}}),(0,z.jsx)(ai,{theme:e,label:R?"Hide formatting":"Formatting",testId:`pin-format-${t.id}`,tone:R?"ink":"ghost",onClick:()=>k(F=>!F),children:(0,z.jsx)("span",{style:{...q.captionMono,lineHeight:1},children:"Aa"})}),(0,z.jsx)("span",{style:{flex:"1 1 auto"}}),(0,z.jsx)(ai,{theme:e,label:"Reply",srText:"Reply",busy:m,tone:Yt?"ink":"ghost",disabled:m||!Yt,onClick:()=>{K()},children:(0,z.jsx)(op,{})})]})]})]})]})}function KS({theme:t,testId:e,name:n,email:i,body:r,facts:l,factsTitle:a,actions:o,badge:u,image:s,alwaysShowActions:c=!1,divided:f=!1,arriving:d=!1}){let p=Ui(),g=pe(),[b,T]=(0,V.useState)(!1),m=c||b;return(0,z.jsxs)("div",{"data-testid":e,onPointerEnter:()=>T(!0),onPointerLeave:()=>T(!1),onFocus:()=>T(!0),onBlur:()=>T(!1),style:{...rt,display:"flex",gap:O.xs,padding:O.sm,...f?{borderTop:`1px solid ${t.colors.hairline}`}:{},...d?ti({visible:p,reduced:g,slide:"y"}):{}},children:[(0,z.jsx)(to,{theme:t,name:n,email:i}),(0,z.jsxs)("div",{style:{flex:"1 1 auto",minWidth:0},children:[(0,z.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:O.xs,minHeight:Et.action},children:[(0,z.jsx)("span",{style:{minWidth:0,color:t.colors.ink,...q.bodySmStrong,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Wa(n,i)}),u===void 0?null:(0,z.jsx)("span",{style:{flex:"0 0 auto",marginLeft:O.xxs},children:u}),(0,z.jsx)("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:O.xxs,flex:"0 0 auto",opacity:m?1:0,transition:Xe(["opacity"],it.duration.instant,it.easing.inOut,g)},children:o})]}),(0,z.jsx)("p",{title:a,style:{...rt,...q.captionMono,color:t.colors.body,overflowWrap:"anywhere"},children:l.join(" \xB7 ")}),(0,z.jsx)("div",{style:{marginTop:O.xxs},children:(0,z.jsx)(US,{theme:t,body:r})}),s?(0,z.jsx)("img",{src:s.url,alt:s.alt,style:{display:"block",marginTop:O.xxs,maxWidth:"100%",borderRadius:et.sm,border:`1px solid ${t.colors.hairline}`}}):null]})]})}function ai({theme:t,label:e,srText:n,onClick:i,disabled:r,testId:l,tone:a="ghost",busy:o,children:u}){let[s,c]=(0,V.useState)(!1),[f,d]=(0,V.useState)(!1),[p,g]=(0,V.useState)(!1),b=pe(),T=a==="ink";return(0,z.jsxs)("button",{type:"button","aria-label":e,title:e,...o===void 0?{}:{"aria-busy":o},...l===void 0?{}:{"data-testid":l},onClick:i,disabled:r,onFocus:()=>c(!0),onBlur:()=>c(!1),onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),g(!1)},onPointerDown:()=>g(!0),onPointerUp:()=>g(!1),onPointerCancel:()=>g(!1),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",width:Et.action,height:Et.action,padding:0,boxSizing:"border-box",border:"none",borderRadius:et.sm,background:T?t.colors.ink:f&&r!==!0?t.colors.canvasSoft2:"transparent",color:T?t.colors.onInk:t.colors.body,cursor:r===!0?"not-allowed":"pointer",outline:"revert",boxShadow:s?t.shadows.focusRing:"none",transform:Wn(p&&r!==!0?`scale(${it.pressScale})`:"none",b),transition:Xe(["background-color","color","transform"],it.duration.instant,it.easing.inOut,b)},children:[u,n===void 0?null:(0,z.jsx)("span",{style:m0,children:n})]})}function xo(t){t&&(t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,Jm)}px`)}function WS({theme:t,onApply:e}){let n={bold:"Bold",italic:"Italic",strike:"Strikethrough",code:"Code"},i={bold:"B",italic:"I",strike:"S",code:"<>"};return(0,z.jsx)("div",{role:"group","aria-label":"Formatting","data-testid":"pin-format-bar",style:{position:"absolute",bottom:`calc(100% + ${O.xxs})`,left:0,display:"flex",alignItems:"center",gap:O.xxs,padding:O.xxs,borderRadius:et.md,background:t.colors.canvas,border:`1px solid ${t.colors.hairline}`,boxShadow:t.shadows.popover,zIndex:1},children:Object.keys(pp).map(r=>(0,z.jsxs)(V.Fragment,{children:[r==="code"?(0,z.jsx)("span",{"aria-hidden":"true",style:{width:"1px",height:"16px",background:t.colors.hairline,margin:`0 ${O.xxs}`}}):null,(0,z.jsx)("button",{type:"button","aria-label":n[r],title:n[r],"data-testid":`pin-format-${r}`,onMouseDown:l=>l.preventDefault(),onClick:()=>e(r),style:{...rt,width:Et.action,height:Et.action,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:et.sm,cursor:"pointer",color:t.colors.body,outline:"revert",...q.captionMono,fontWeight:r==="bold"?500:400,fontStyle:r==="italic"?"italic":"normal",textDecoration:r==="strike"?"line-through":"none"},children:i[r]})]},r))})}function Km({theme:t,label:e,text:n,icon:i}){let[r,l]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{if(!r)return;let a=window.setTimeout(()=>l(!1),GO);return()=>window.clearTimeout(a)},[r]),(0,z.jsx)(ai,{theme:t,label:e,onClick:()=>{navigator.clipboard?.writeText(n).then(()=>l(!0),()=>{})},children:r?(0,z.jsx)(ap,{}):i})}function ZS(t,e){let n=t.gitCommit,i=e.gitCommit;return!n||!i?!1:n!==i}function KO({theme:t,id:e}){return(0,z.jsx)("span",{"data-testid":`pin-outdated-${e}`,title:"Written before the latest update to this page. It may already be fixed.",style:{padding:`0 ${O.xs}`,borderRadius:et.sm,background:t.colors.canvasSoft2,color:t.colors.body,...q.caption,whiteSpace:"nowrap"},children:"Outdated"})}function ZO({draft:t,theme:e,client:n,config:i,organizationId:r,onDone:l,attachment:a,onRequestCapture:o,onClearAttachment:u}){let[s,c]=(0,V.useState)(""),[f,d]=(0,V.useState)(!1),[p,g]=(0,V.useState)(null),[b,T]=(0,V.useState)(!1),[m,h]=(0,V.useState)(!1),y=(0,V.useRef)(null),S=s.trim(),M=S.length>0&&S.length<=hr,w=Ui(),A=pe(),N=Math.min(PS,window.innerWidth-rn*2),R=Math.min(Math.max(t.x+XS,rn),window.innerWidth-rn-N),k=Math.max(rn,Math.min(t.y+XS,window.innerHeight-XO));async function lt(){d(!0),g(null);try{let j=a??await es();await n.submit({organizationId:r,kind:"PINNED",body:S,metadata:Ka(i),pin:{selector:t.selector,offsetX:t.offsetX,offsetY:t.offsetY},...j?{screenshot:j}:{}}),l()}catch(j){d(!1),g(j instanceof mn&&j.code==="not_invited_to_project"?"You are not invited to this project any more.":"Could not save that pin. Your text is still here.")}}return(0,z.jsx)("section",{"data-testid":"pin-composer",style:{...rt,position:"fixed",left:R,top:k,width:Et.thread,maxWidth:Pm,boxSizing:"border-box",padding:0,background:e.colors.canvas,border:`1px solid ${e.colors.hairline}`,borderRadius:et.lg,boxShadow:e.shadows.popover,overflow:"hidden",zIndex:hn.thread,...q.bodySm,color:e.colors.body,...ti({visible:w,reduced:A,origin:`${t.x-R}px ${t.y-k}px`})},children:(0,z.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:O.xs,padding:O.sm,background:e.colors.canvasSoft2,boxShadow:b?e.shadows.focusRing:"none"},children:[a?(0,z.jsxs)("div",{"data-testid":"pin-composer-attachment",style:{position:"relative",alignSelf:"flex-start",borderRadius:et.sm,border:`1px solid ${e.colors.hairline}`,overflow:"hidden",lineHeight:0},children:[(0,z.jsx)("img",{src:a,alt:"The element you captured, attached to this report",style:{display:"block",maxWidth:"120px",maxHeight:"80px"}}),(0,z.jsx)("button",{type:"button","aria-label":"Remove screenshot",title:"Remove screenshot","data-testid":"pin-composer-attachment-remove",onClick:u,style:{...rt,position:"absolute",top:"2px",right:"2px",width:"16px",height:"16px",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:et.sm,cursor:"pointer",background:e.colors.ink,color:e.colors.onInk,lineHeight:1},children:(0,z.jsx)(Ml,{})})]}):null,(0,z.jsx)("textarea",{autoFocus:!0,ref:y,value:s,onChange:j=>{c(j.target.value),xo(j.target)},onFocus:()=>T(!0),onBlur:()=>T(!1),onKeyDown:j=>{j.key==="Enter"&&(j.nativeEvent.isComposing||j.shiftKey||j.altKey||(j.preventDefault(),!(f||!M)&<()))},rows:1,placeholder:"Start a new thread\u2026","aria-label":"Pinned feedback","data-testid":"pin-body",maxLength:hr,style:{...rt,display:"block",width:"100%",minHeight:q.bodySm.lineHeight,maxHeight:`${Jm}px`,overflowY:"auto",resize:"none",...q.bodySm,color:e.colors.ink,background:"transparent",outline:"none"}}),p?(0,z.jsx)("p",{role:"alert",style:{...rt,color:e.colors.error,...q.caption},children:p}):null,(0,z.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:O.xxs,flex:"0 0 auto"},children:[m?(0,z.jsx)(WS,{theme:e,onApply:j=>{let H=y.current;if(!H)return;let I=mp(s,H.selectionStart,H.selectionEnd,j);c(I.text),requestAnimationFrame(()=>{H.focus(),H.setSelectionRange(I.selectionStart,I.selectionEnd),xo(H)})}}):null,(0,z.jsx)(ai,{theme:e,label:"Take a screenshot",testId:"pin-composer-attach",tone:a?"ink":"ghost",onClick:o,children:(0,z.jsx)(up,{})}),(0,z.jsx)("span",{"aria-hidden":"true",style:{width:"1px",height:"16px",background:e.colors.hairline,margin:`0 ${O.xxs}`}}),(0,z.jsx)(ai,{theme:e,label:m?"Hide formatting":"Formatting",testId:"pin-composer-format",tone:m?"ink":"ghost",onClick:()=>h(j=>!j),children:(0,z.jsx)("span",{style:{...q.captionMono,lineHeight:1},children:"Aa"})}),(0,z.jsx)("span",{style:{flex:"1 1 auto"}}),(0,z.jsx)(ai,{theme:e,label:"Pin it",srText:"Pin it",busy:f,tone:M?"ink":"ghost",disabled:f||!M,onClick:()=>{lt()},children:(0,z.jsx)(op,{})})]})]})})}var jl=Ct(xn(),1);function tk(t,e){let[n,i]=(0,jl.useState)({kind:"loading"}),r=(0,jl.useCallback)(async()=>{i({kind:"loading"});try{i({kind:"session",session:await t.session(e)})}catch(a){i({kind:"error",message:a instanceof mn&&a.code==="network_error"?"Could not reach the feedback service.":"Something went wrong loading your session."})}},[t,e]);(0,jl.useEffect)(()=>{r()},[r]);let l=n.kind==="session"&&n.session.state==="ready"?n.session.project?.id??null:null;return{phase:n,readyProjectId:l,reload:()=>{r()}}}var Q=Ct(me(),1),PO=t=>(0,Q.jsx)(X0,{...t});function lk({env:t,children:e,renderInbox:n=PO,...i}){let r=(0,st.useMemo)(()=>$u(t??hD(),i),[t]);return r.enabled?(0,Q.jsx)(JO,{config:r,renderInbox:n,children:e}):null}function JO({config:t,children:e,renderInbox:n}){let[i,r]=(0,st.useState)(null),[l,a]=(0,st.useState)(!1),o=(0,st.useSyncExternalStore)(fs.subscribe,fs.getSnapshot,fs.getServerSnapshot),[u,s]=(0,st.useState)(!1),[c,f]=(0,st.useState)(null),[d,p]=(0,st.useState)(0),{mode:g,theme:b,setMode:T}=uD(),{collapsed:m,dock:h}=(0,st.useSyncExternalStore)(Hi.subscribe,Hi.getSnapshot,Hi.getServerSnapshot),y=os(h),S=cD(),M=(0,st.useSyncExternalStore)($O,Wx,eD);(0,st.useEffect)(()=>{if(M===null)return;Yd();let nt=window.setTimeout(Yd,0);return()=>window.clearTimeout(nt)},[M]),(0,st.useEffect)(()=>{c0(document,t.assetOrigin)},[t.assetOrigin]);let w=(0,st.useMemo)(()=>Za(t.apiUrl),[t.apiUrl]),A=tk(w,t.projectUrl),N=(0,st.useCallback)(()=>{a(!0),r(null)},[]),R=(0,st.useCallback)(nt=>{r(v=>v===nt?null:nt),a(!1)},[]),k=(0,st.useCallback)(nt=>{f(nt),r(null)},[]),lt=(0,st.useCallback)(nt=>{G0(nt)},[]),j=(0,st.useCallback)(nt=>{$a({collapsed:nt}),nt&&(r(null),a(!1))},[]);(0,st.useEffect)(()=>{if(i===null)return;let nt=v=>{v.key==="Escape"&&(r(null),v.stopPropagation())};return window.addEventListener("keydown",nt),()=>window.removeEventListener("keydown",nt)},[i]),(0,st.useEffect)(()=>{if(i===null)return;let nt=v=>{let Vt=v.target;Vt instanceof Element&&Vt.closest("[data-bitvea-feedback-toolbar]")!==null||r(null)};return window.addEventListener("pointerdown",nt,!0),()=>window.removeEventListener("pointerdown",nt,!0)},[i]);let H=(0,st.useSyncExternalStore)(ek,WO,tD),I=(0,st.useSyncExternalStore)(ek,()=>t.pinShortcut===null?null:Jx(t.pinShortcut,Ju(navigator)),()=>null),K=t.gitBranch??t.environment,bt=t.gitCommit?.slice(0,7)??null,pt=A.readyProjectId,Yt=n!=null&&o&&pt!==null,Lt=n?d:0,x=(0,Q.jsx)(Il,{theme:b,testId:"feedback-toggle",label:i==="note"?"Close feedback":"Leave a note",expanded:i==="note",active:i==="note",onClick:()=>R("note"),children:(0,Q.jsx)(U0,{})}),F=(0,Q.jsxs)("div",{"data-bitvea-feedback-toolbar":"",style:{...rt,position:"fixed",left:0,top:0,width:0,height:0,zIndex:Bi,fontFamily:p0.sans,letterSpacing:"normal",wordSpacing:"normal",textTransform:"none",fontStyle:"normal",fontVariant:"normal",textAlign:"left",textIndent:0,lineHeight:1.5,textDecoration:"none",whiteSpace:"normal",colorScheme:b.resolved},children:[(0,Q.jsxs)("div",{"data-testid":"feedback-dock",style:{position:"fixed",top:0,right:0,bottom:0,left:0,display:"flex",flexDirection:y.flexDirection,justifyContent:"flex-end",alignItems:y.alignItems,boxSizing:"border-box",padding:Ve.inset,paddingBottom:y.paddingBottom,paddingRight:Yt?`clamp(${O.xs}, calc(100vw - 420px), ${dp}px)`:Ve.inset,pointerEvents:"none",zIndex:hn.bar},children:[e===void 0?null:(0,Q.jsx)("div",{style:{pointerEvents:"auto"},children:e}),i!==null?(0,Q.jsx)(dD,{theme:b,tool:i,edge:y,children:i==="note"?(0,Q.jsx)(R0,{config:t,phase:A.phase,theme:b,onReloadSession:A.reload,onDone:()=>r(null)}):(0,Q.jsx)(_0,{config:t,phase:A.phase,theme:b,mode:g,onModeChange:T,onReloadSession:A.reload})}):null,(0,Q.jsx)("div",{"aria-label":"BitVea Feedback toolbar","data-testid":"feedback-bar","data-toolbar-state":m?"collapsed":"expanded",...S.handlers,style:{display:"flex",alignItems:"center",padding:Ve.padding,maxWidth:"100%",boxSizing:"border-box",pointerEvents:"auto",background:b.colors.barSurface,border:`1px solid ${b.colors.barBorder}`,borderRadius:m?et.pill:Ve.radius,boxShadow:b.shadows.bar,cursor:"grab",touchAction:"none",...S.style},children:(0,Q.jsx)(fD,{form:m,children:m?(0,Q.jsxs)(Il,{theme:b,testId:"toolbar-expand",label:Lt>0?`Expand toolbar, ${Lt} open`:"Expand toolbar",expanded:!1,onClick:()=>j(!1),children:[(0,Q.jsx)(ik,{theme:b,size:18,inline:!0}),Lt>0?(0,Q.jsx)(mD,{theme:b,at:y.badge}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ik,{theme:b}),(0,Q.jsx)(Il,{theme:b,testId:"toolbar-pin",label:"Pin to an element",hint:I??void 0,active:l,onClick:()=>l?a(!1):N(),children:(0,Q.jsx)(B0,{})}),x,n?(0,Q.jsx)(Il,{theme:b,testId:"toolbar-inbox",label:Lt>0?`Inbox, ${Lt} open`:"Inbox",expanded:o,active:o,onClick:()=>lt(!o),badge:Lt,children:(0,Q.jsx)(H0,{})}):null,(0,Q.jsx)(Il,{theme:b,testId:"toolbar-account",label:"Account",expanded:i==="account",active:i==="account",onClick:()=>R("account"),children:(0,Q.jsx)(j0,{})}),(0,Q.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:O.xs,height:Ve.button,padding:`0 ${O.sm}`,maxWidth:"220px",flex:"0 1 auto",minWidth:0,boxSizing:"border-box",borderRadius:et.pill,background:b.colors.barHover,...q.captionMono},children:[(0,Q.jsx)("span",{"data-testid":"toolbar-branch",title:K,style:{minWidth:0,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",color:b.colors.body},children:K}),bt?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("span",{"aria-hidden":"true",style:{color:b.colors.body},children:"\xB7"}),(0,Q.jsx)("span",{"data-testid":"toolbar-commit",title:t.gitCommit,style:{flex:"0 0 auto",whiteSpace:"nowrap",color:b.colors.body},children:bt})]}):null]}),(0,Q.jsx)(Il,{theme:b,testId:"toolbar-collapse",label:"Collapse toolbar",expanded:!0,onClick:()=>j(!0),children:(0,Q.jsx)(I0,{turn:y.chevron})})]})})})]}),pt?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(JS,{client:w,config:t,organizationId:pt,theme:b,picking:l,onPickingChange:a,showResolved:u,focusPinId:c,deepLinkPinId:M,onFocusHandled:()=>f(null),onOpenCountChange:p}),n?.({client:w,config:t,organizationId:pt,theme:b,open:o,onClose:()=>lt(!1),showResolved:u,onShowResolvedChange:s,onFocusPin:k})]}):null]});return H?(0,rk.createPortal)(F,document.body):null}function $O(){return()=>{}}function ek(){return()=>{}}function WO(){return typeof document<"u"&&document.body!==null}function tD(){return!1}function eD(){return null}var $m=null,Wm=new Set;function nD(){try{let t=window.localStorage.getItem(Jd);if(b0(t))return t}catch{}return $m??"system"}function iD(t){try{window.localStorage.setItem(Jd,t),$m=null}catch{$m=t}Wm.forEach(e=>e())}function rD(t){return Wm.add(t),()=>Wm.delete(t)}function lD(t){if(typeof window.matchMedia!="function")return()=>{};let e=window.matchMedia($d);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function aD(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia($d).matches}function oD(){return"system"}function uD(){let t=(0,st.useSyncExternalStore)(rD,nD,oD),e=(0,st.useSyncExternalStore)(lD,aD,()=>!1),n=t==="system"?e?"dark":"light":t;return{mode:t,theme:(0,st.useMemo)(()=>y0(n),[n]),setMode:iD}}function nk(t,e,n,i){return Math.max(-e,Math.min(t,i-e-n))}function sD(t,e){let n=window.innerWidth||1,i=window.innerHeight||1,r=t<n/3?"left":t>n*2/3?"right":"center",l=e<i/3?"top":e>i*2/3?"bottom":"middle",o=`${l==="middle"&&r==="center"?e<i/2?"top":"bottom":l}-${r}`;return as(o)?o:ls}function cD(){let[t,e]=(0,st.useState)(null),[n,i]=(0,st.useState)(null),r=(0,st.useRef)(!1),l=n!==null;return(0,st.useEffect)(()=>{if(t===null)return;let a=c=>{let f=c.clientX-t.x,d=c.clientY-t.y;return{x:nk(f,t.left,t.width,window.innerWidth),y:nk(d,t.top,t.height,window.innerHeight),past:l||Math.hypot(f,d)>=h0}},o=c=>{if(c.buttons===0){e(null),i(null);return}let{x:f,y:d,past:p}=a(c);p&&i({x:f,y:d})},u=c=>{let{x:f,y:d,past:p}=a(c);p&&($a({dock:sD(t.left+f+t.width/2,t.top+d+t.height/2)}),r.current=!0),e(null),i(null)},s=()=>{e(null),i(null)};return window.addEventListener("pointermove",o),window.addEventListener("pointerup",u),window.addEventListener("pointercancel",s),()=>{window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",s)}},[t,l]),{style:{...n===null?{}:{transform:`translate3d(${n.x}px, ${n.y}px, 0)`,cursor:"grabbing"},...t===null?{}:{userSelect:"none"}},handlers:{onPointerDown:a=>{if(a.button>0)return;r.current=!1;let o=a.target,u=o instanceof Element&&o.closest("button, a, input, textarea, select")!==null,s=a.currentTarget.dataset.toolbarState==="collapsed";if(u&&!s)return;let c=a.currentTarget.getBoundingClientRect();e({x:a.clientX,y:a.clientY,left:c.left,top:c.top,width:c.width,height:c.height})},onClickCapture:a=>{r.current&&(a.stopPropagation(),a.preventDefault(),r.current=!1)}}}}function fD({form:t,children:e}){let n=x0(t),i=pe();return(0,Q.jsx)("div",{style:{display:"flex",alignItems:"center",gap:Ve.gap,minWidth:0,...ti({visible:n,reduced:i,duration:it.duration.settle})},children:e},String(t))}function Il({theme:t,testId:e,label:n,hint:i,active:r,expanded:l,badge:a,onClick:o,children:u}){let[s,c]=(0,st.useState)(!1),[f,d]=(0,st.useState)(!1),[p,g]=(0,st.useState)(!1),b=pe();return(0,Q.jsxs)("button",{type:"button","data-testid":e,"aria-label":n,title:i===void 0?n:`${n} (${i})`,...l===void 0?{}:{"aria-expanded":l},...r===void 0?{}:{"aria-pressed":r},onClick:o,onPointerEnter:()=>c(!0),onPointerLeave:()=>{c(!1),g(!1)},onPointerDown:()=>g(!0),onPointerUp:()=>g(!1),onPointerCancel:()=>g(!1),onFocus:()=>d(!0),onBlur:()=>d(!1),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:Ve.button,height:Ve.button,flex:"0 0 auto",padding:0,border:"none",borderRadius:et.pill,background:r?t.colors.ink:s?t.colors.barHover:"transparent",color:r?t.colors.onInk:t.colors.barInk,cursor:"pointer",transform:Wn(p?`scale(${it.pressScale})`:"none",b),transition:Xe(["background-color","color","transform"],it.duration.instant,it.easing.inOut,b),outline:"revert",boxShadow:f?t.shadows.focusRing:"none"},children:[u,a!==void 0&&a>0?(0,Q.jsx)(pD,{theme:t,testId:e,active:r??!1,count:a,children:a>99?"99+":a}):null]})}function dD({theme:t,tool:e,edge:n,children:i}){let r=Ui(),l=pe();return(0,Q.jsx)("div",{role:"dialog","aria-label":"BitVea Feedback","data-testid":"feedback-panel","data-toolbar-surface":e,style:{width:e==="note"?"320px":"280px",maxWidth:"100%",boxSizing:"border-box",pointerEvents:"auto",[n.popoverGap]:O.xs,padding:O.sm,background:t.colors.canvas,border:`1px solid ${t.colors.hairline}`,borderRadius:et.lg,boxShadow:t.shadows.popover,color:t.colors.body,...q.bodySm,...ti({visible:r,reduced:l,origin:n.popoverOrigin})},children:i})}function pD({theme:t,testId:e,active:n,count:i,children:r}){let l=pe(),a=S0(i);return(0,Q.jsx)("span",{"data-testid":`${e}-count`,style:{position:"absolute",top:0,right:0,minWidth:Et.badge,height:Et.badge,padding:`0 ${O.xxs}`,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:et.pill,background:n?t.colors.onInk:t.colors.ink,color:n?t.colors.ink:t.colors.onInk,...q.captionMono,border:`1px solid ${n?t.colors.ink:t.colors.barSurface}`,transform:Wn(a?`scale(${it.enterScale})`:"none",l),transition:Xe(["background-color","color","border-color","transform"],it.duration.instant,it.easing.inOut,l)},children:r})}function mD({theme:t,at:e}){return(0,Q.jsx)("span",{"data-testid":"toolbar-expand-count","aria-hidden":"true",style:{position:"absolute",...e,width:Et.dot,height:Et.dot,borderRadius:et.pill,background:t.colors.ink,border:`2px solid ${t.colors.barSurface}`,boxSizing:"content-box"}})}function ik({theme:t,size:e=18,inline:n=!1}){return(0,Q.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",...n?{}:{width:Ve.button,height:Ve.button},flex:"0 0 auto",color:t?.colors.barInk},children:(0,Q.jsxs)("svg",{viewBox:"0 0 435 439",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"BitVea",style:{display:"block",width:`${e}px`,height:`${e}px`},children:[(0,Q.jsx)("path",{d:"M347.997 88.1161H87.207L159.233 0.373047H333.067L347.997 88.1161Z",fill:"currentColor"}),(0,Q.jsx)("path",{d:"M434.913 160.795V336.203L347.996 351.268V88.1167L434.913 160.795Z",fill:"currentColor"}),(0,Q.jsx)("path",{d:"M347.997 351.267L275.971 438.971H102.098L87.207 351.267H347.997Z",fill:"currentColor"}),(0,Q.jsx)("path",{d:"M87.2056 88.1167V351.268L0.25 278.59V103.143L87.2056 88.1167Z",fill:"currentColor"})]})})}function hD(){return typeof process>"u"||!process.env?{}:process.env}var sk=Ct(me(),1),ak="data-bitvea-feedback-toolbar-root",gD=/^data-.*(key|secret|token|password)$/i;function yD(t){let e=o=>{let u=t.getAttribute(o);return u===null||u.length===0?void 0:u},n={[qd]:e("data-api-url"),[jd]:e("data-environment"),[Hd]:e("data-force")},i={},r=e("data-project-url"),l=e("data-git-branch"),a=e("data-git-commit");return r&&(i.projectUrl=r),l&&(i.gitBranch=l),a&&(i.gitCommit=a),{env:n,overrides:i}}function bD(t){return t.getAttributeNames().filter(e=>gD.test(e))}function Zs(t){let e=bD(t);if(e.length>0)return console.error(`[bitvea-feedback] refusing to load: ${e.join(", ")} on the script tag would publish a secret to every visitor. Remove it. Register the project from a terminal or CI instead: npx @bitvea/feedback-toolbar register --project-url <url> --api-key <key>`),null;let{env:n,overrides:i}=yD(t);if(!$u(n,i).enabled||document.querySelector(`[${ak}]`))return null;let r=document.createElement("div");r.setAttribute(ak,""),document.body.appendChild(r);let l=(0,ok.createRoot)(r);return l.render((0,sk.jsx)(lk,{env:n,...i})),{container:r,root:l}}function xD(){return document.currentScript??document.querySelector("script[data-api-url]")}function uk(){let t=xD();return t?document.body?Zs(t):(document.addEventListener("DOMContentLoaded",()=>Zs(t),{once:!0}),null):null}uk();return Sk(vD);})();
|
|
38
38
|
//# sourceMappingURL=toolbar.js.map
|