comment-modal.js•35.2 kB
import{r as R,I as ze,f as X,k as Ue,i as Fe,j as v,d as Xe,B as Y,C as Z,l as J,m as Q,n as ee,p as Ge,q as ve}from"./i18n.js";function Ve({i18n:t,defaultNS:r,children:n}){const e=R.useMemo(()=>({i18n:t,defaultNS:r}),[t,r]);return R.createElement(ze.Provider,{value:e},n)}/**
* @license lucide-react v0.468.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qe=X("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
* @license lucide-react v0.468.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ke=X("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
* @license lucide-react v0.468.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ye=X("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
* @license lucide-react v0.468.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ge=X("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/*!
* iro.js v5.5.2
* 2016-2021 James Daniel
* Licensed under MPL 2.0
* github.com/jaames/iro.js
*/var x,z,Ee,ie,Se,M={},le=[],Ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;function j(t,r){for(var n in r)t[n]=r[n];return t}function Ce(t){var r=t.parentNode;r&&r.removeChild(t)}function _(t,r,n){var e,i,a,o,s=arguments;if(r=j({},r),arguments.length>3)for(n=[n],e=3;e<arguments.length;e++)n.push(s[e]);if(n!=null&&(r.children=n),t!=null&&t.defaultProps!=null)for(i in t.defaultProps)r[i]===void 0&&(r[i]=t.defaultProps[i]);return o=r.key,(a=r.ref)!=null&&delete r.ref,o!=null&&delete r.key,ae(t,r,o,a)}function ae(t,r,n,e){var i={type:t,props:r,key:n,ref:e,__k:null,__p:null,__b:0,__e:null,l:null,__c:null,constructor:void 0};return x.vnode&&x.vnode(i),i}function G(t){return t.children}function Je(t){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number")return ae(null,t,null,null);if(t.__e!=null||t.__c!=null){var r=ae(t.type,t.props,t.key,null);return r.__e=t.__e,r}return t}function W(t,r){this.props=t,this.context=r}function U(t,r){if(r==null)return t.__p?U(t.__p,t.__p.__k.indexOf(t)+1):null;for(var n;r<t.__k.length;r++)if((n=t.__k[r])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?U(t):null}function Ie(t){var r,n;if((t=t.__p)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,r=0;r<t.__k.length;r++)if((n=t.__k[r])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return Ie(t)}}function te(t){(!t.__d&&(t.__d=!0)&&z.push(t)===1||ie!==x.debounceRendering)&&(ie=x.debounceRendering,(x.debounceRendering||Ee)(Qe))}function Qe(){var t,r,n,e,i,a,o,s;for(z.sort(function(c,u){return u.__v.__b-c.__v.__b});t=z.pop();)t.__d&&(n=void 0,e=void 0,a=(i=(r=t).__v).__e,o=r.__P,s=r.u,r.u=!1,o&&(n=[],e=he(o,i,j({},i),r.__n,o.ownerSVGElement!==void 0,null,n,s,a??U(i)),Re(n,i),e!=a&&Ie(i)))}function Ne(t,r,n,e,i,a,o,s,c){var u,h,l,d,f,p,m,w=n&&n.__k||le,y=w.length;if(s==M&&(s=a!=null?a[0]:y?U(n,0):null),u=0,r.__k=ce(r.__k,function(g){if(g!=null){if(g.__p=r,g.__b=r.__b+1,(l=w[u])===null||l&&g.key==l.key&&g.type===l.type)w[u]=void 0;else for(h=0;h<y;h++){if((l=w[h])&&g.key==l.key&&g.type===l.type){w[h]=void 0;break}l=null}if(d=he(t,g,l=l||M,e,i,a,o,null,s,c),(h=g.ref)&&l.ref!=h&&(m||(m=[])).push(h,g.__c||d,g),d!=null){if(p==null&&(p=d),g.l!=null)d=g.l,g.l=null;else if(a==l||d!=s||d.parentNode==null){e:if(s==null||s.parentNode!==t)t.appendChild(d);else{for(f=s,h=0;(f=f.nextSibling)&&h<y;h+=2)if(f==d)break e;t.insertBefore(d,s)}r.type=="option"&&(t.value="")}s=d.nextSibling,typeof r.type=="function"&&(r.l=d)}}return u++,g}),r.__e=p,a!=null&&typeof r.type!="function")for(u=a.length;u--;)a[u]!=null&&Ce(a[u]);for(u=y;u--;)w[u]!=null&&Me(w[u],w[u]);if(m)for(u=0;u<m.length;u++)je(m[u],m[++u],m[++u])}function ce(t,r,n){if(n==null&&(n=[]),t==null||typeof t=="boolean")r&&n.push(r(null));else if(Array.isArray(t))for(var e=0;e<t.length;e++)ce(t[e],r,n);else n.push(r?r(Je(t)):t);return n}function et(t,r,n,e,i){var a;for(a in n)a in r||_e(t,a,null,n[a],e);for(a in r)i&&typeof r[a]!="function"||a==="value"||a==="checked"||n[a]===r[a]||_e(t,a,r[a],n[a],e)}function me(t,r,n){r[0]==="-"?t.setProperty(r,n):t[r]=typeof n=="number"&&Ze.test(r)===!1?n+"px":n??""}function _e(t,r,n,e,i){var a,o,s,c,u;if(!((r=i?r==="className"?"class":r:r==="class"?"className":r)==="key"||r==="children"))if(r==="style")if(a=t.style,typeof n=="string")a.cssText=n;else{if(typeof e=="string"&&(a.cssText="",e=null),e)for(o in e)n&&o in n||me(a,o,"");if(n)for(s in n)e&&n[s]===e[s]||me(a,s,n[s])}else r[0]==="o"&&r[1]==="n"?(c=r!==(r=r.replace(/Capture$/,"")),u=r.toLowerCase(),r=(u in t?u:r).slice(2),n?(e||t.addEventListener(r,be,c),(t.t||(t.t={}))[r]=n):t.removeEventListener(r,be,c)):r!=="list"&&r!=="tagName"&&r!=="form"&&!i&&r in t?t[r]=n??"":typeof n!="function"&&r!=="dangerouslySetInnerHTML"&&(r!==(r=r.replace(/^xlink:?/,""))?n==null||n===!1?t.removeAttributeNS("http://www.w3.org/1999/xlink",r.toLowerCase()):t.setAttributeNS("http://www.w3.org/1999/xlink",r.toLowerCase(),n):n==null||n===!1?t.removeAttribute(r):t.setAttribute(r,n))}function be(t){return this.t[t.type](x.event?x.event(t):t)}function he(t,r,n,e,i,a,o,s,c,u){var h,l,d,f,p,m,w,y,g,b,I=r.type;if(r.constructor!==void 0)return null;(h=x.__b)&&h(r);try{e:if(typeof I=="function"){if(y=r.props,g=(h=I.contextType)&&e[h.__c],b=h?g?g.props.value:h.__p:e,n.__c?w=(l=r.__c=n.__c).__p=l.__E:("prototype"in I&&I.prototype.render?r.__c=l=new I(y,b):(r.__c=l=new W(y,b),l.constructor=I,l.render=rt),g&&g.sub(l),l.props=y,l.state||(l.state={}),l.context=b,l.__n=e,d=l.__d=!0,l.__h=[]),l.__s==null&&(l.__s=l.state),I.getDerivedStateFromProps!=null&&j(l.__s==l.state?l.__s=j({},l.__s):l.__s,I.getDerivedStateFromProps(y,l.__s)),d)I.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&o.push(l);else{if(I.getDerivedStateFromProps==null&&s==null&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(y,b),!s&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(y,l.__s,b)===!1){for(l.props=y,l.state=l.__s,l.__d=!1,l.__v=r,r.__e=c!=null?c!==n.__e?c:n.__e:null,r.__k=n.__k,h=0;h<r.__k.length;h++)r.__k[h]&&(r.__k[h].__p=r);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(y,l.__s,b)}for(f=l.props,p=l.state,l.context=b,l.props=y,l.state=l.__s,(h=x.__r)&&h(r),l.__d=!1,l.__v=r,l.__P=t,h=l.render(l.props,l.state,l.context),r.__k=ce(h!=null&&h.type==G&&h.key==null?h.props.children:h),l.getChildContext!=null&&(e=j(j({},e),l.getChildContext())),d||l.getSnapshotBeforeUpdate==null||(m=l.getSnapshotBeforeUpdate(f,p)),Ne(t,r,n,e,i,a,o,c,u),l.base=r.__e;h=l.__h.pop();)l.__s&&(l.state=l.__s),h.call(l);d||f==null||l.componentDidUpdate==null||l.componentDidUpdate(f,p,m),w&&(l.__E=l.__p=null)}else r.__e=tt(n.__e,r,n,e,i,a,o,u);(h=x.diffed)&&h(r)}catch(Be){x.__e(Be,r,n)}return r.__e}function Re(t,r){for(var n;n=t.pop();)try{n.componentDidMount()}catch(e){x.__e(e,n.__v)}x.__c&&x.__c(r)}function tt(t,r,n,e,i,a,o,s){var c,u,h,l,d=n.props,f=r.props;if(i=r.type==="svg"||i,t==null&&a!=null){for(c=0;c<a.length;c++)if((u=a[c])!=null&&(r.type===null?u.nodeType===3:u.localName===r.type)){t=u,a[c]=null;break}}if(t==null){if(r.type===null)return document.createTextNode(f);t=i?document.createElementNS("http://www.w3.org/2000/svg",r.type):document.createElement(r.type),a=null}return r.type===null?d!==f&&(a!=null&&(a[a.indexOf(t)]=null),t.data=f):r!==n&&(a!=null&&(a=le.slice.call(t.childNodes)),h=(d=n.props||M).dangerouslySetInnerHTML,l=f.dangerouslySetInnerHTML,s||(l||h)&&(l&&h&&l.__html==h.__html||(t.innerHTML=l&&l.__html||"")),et(t,f,d,i,s),r.__k=r.props.children,l||Ne(t,r,n,e,r.type!=="foreignObject"&&i,a,o,M,s),s||("value"in f&&f.value!==void 0&&f.value!==t.value&&(t.value=f.value==null?"":f.value),"checked"in f&&f.checked!==void 0&&f.checked!==t.checked&&(t.checked=f.checked))),t}function je(t,r,n){try{typeof t=="function"?t(r):t.current=r}catch(e){x.__e(e,n)}}function Me(t,r,n){var e,i,a;if(x.unmount&&x.unmount(t),(e=t.ref)&&je(e,null,r),n||typeof t.type=="function"||(n=(i=t.__e)!=null),t.__e=t.l=null,(e=t.__c)!=null){if(e.componentWillUnmount)try{e.componentWillUnmount()}catch(o){x.__e(o,r)}e.base=e.__P=null}if(e=t.__k)for(a=0;a<e.length;a++)e[a]&&Me(e[a],r,n);i!=null&&Ce(i)}function rt(t,r,n){return this.constructor(t,n)}function nt(t,r,n){var e,i,a;x.__p&&x.__p(t,r),i=(e=n===Se)?null:r.__k,t=_(G,null,[t]),a=[],he(r,r.__k=t,i||M,M,r.ownerSVGElement!==void 0,i?null:le.slice.call(r.childNodes),a,!1,M,e),Re(a,t)}x={},W.prototype.setState=function(t,r){var n=this.__s!==this.state&&this.__s||(this.__s=j({},this.state));(typeof t!="function"||(t=t(n,this.props)))&&j(n,t),t!=null&&this.__v&&(this.u=!1,r&&this.__h.push(r),te(this))},W.prototype.forceUpdate=function(t){this.__v&&(t&&this.__h.push(t),this.u=!0,te(this))},W.prototype.render=G,z=[],Ee=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ie=x.debounceRendering,x.__e=function(t,r,n){for(var e;r=r.__p;)if((e=r.__c)&&!e.__p)try{if(e.constructor&&e.constructor.getDerivedStateFromError!=null)e.setState(e.constructor.getDerivedStateFromError(t));else{if(e.componentDidCatch==null)continue;e.componentDidCatch(t)}return te(e.__E=e)}catch(i){t=i}throw t},Se=M;function it(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function at(t,r,n){return r&&it(t.prototype,r),t}function C(){return C=Object.assign||function(t){for(var r=arguments,n=1;n<arguments.length;n++){var e=r[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},C.apply(this,arguments)}var ot="[-\\+]?\\d+%?",st="[-\\+]?\\d*\\.\\d+%?",P="(?:"+st+")|(?:"+ot+")",Ae="[\\s|\\(]+("+P+")[,|\\s]+("+P+")[,|\\s]+("+P+")\\s*\\)?",Pe="[\\s|\\(]+("+P+")[,|\\s]+("+P+")[,|\\s]+("+P+")[,|\\s]+("+P+")\\s*\\)?",lt=new RegExp("rgb"+Ae),ct=new RegExp("rgba"+Pe),ht=new RegExp("hsl"+Ae),ut=new RegExp("hsla"+Pe),V="^(?:#?|0x?)",T="([0-9a-fA-F]{1})",H="([0-9a-fA-F]{2})",dt=new RegExp(V+T+T+T+"$"),ft=new RegExp(V+T+T+T+T+"$"),vt=new RegExp(V+H+H+H+"$"),gt=new RegExp(V+H+H+H+H+"$"),mt=2e3,_t=4e4,B=Math.log,O=Math.round,L=Math.floor;function N(t,r,n){return Math.min(Math.max(t,r),n)}function E(t,r){var n=t.indexOf("%")>-1,e=parseFloat(t);return n?r/100*e:e}function S(t){return parseInt(t,16)}function A(t){return t.toString(16).padStart(2,"0")}var $=(function(){function t(n,e){this.$={h:0,s:0,v:0,a:1},n&&this.set(n),this.onChange=e,this.initialValue=C({},this.$)}var r=t.prototype;return r.set=function(e){if(typeof e=="string")/^(?:#?|0x?)[0-9a-fA-F]{3,8}$/.test(e)?this.hexString=e:/^rgba?/.test(e)?this.rgbString=e:/^hsla?/.test(e)&&(this.hslString=e);else if(typeof e=="object")e instanceof t?this.hsva=e.hsva:"r"in e&&"g"in e&&"b"in e?this.rgb=e:"h"in e&&"s"in e&&"v"in e?this.hsv=e:"h"in e&&"s"in e&&"l"in e?this.hsl=e:"kelvin"in e&&(this.kelvin=e.kelvin);else throw new Error("Invalid color value")},r.setChannel=function(e,i,a){var o;this[e]=C({},this[e],(o={},o[i]=a,o))},r.reset=function(){this.hsva=this.initialValue},r.clone=function(){return new t(this)},r.unbind=function(){this.onChange=void 0},t.hsvToRgb=function(e){var i=e.h/60,a=e.s/100,o=e.v/100,s=L(i),c=i-s,u=o*(1-a),h=o*(1-c*a),l=o*(1-(1-c)*a),d=s%6,f=[o,h,u,u,l,o][d],p=[l,o,o,h,u,u][d],m=[u,u,l,o,o,h][d];return{r:N(f*255,0,255),g:N(p*255,0,255),b:N(m*255,0,255)}},t.rgbToHsv=function(e){var i=e.r/255,a=e.g/255,o=e.b/255,s=Math.max(i,a,o),c=Math.min(i,a,o),u=s-c,h=0,l=s,d=s===0?0:u/s;switch(s){case c:h=0;break;case i:h=(a-o)/u+(a<o?6:0);break;case a:h=(o-i)/u+2;break;case o:h=(i-a)/u+4;break}return{h:h*60%360,s:N(d*100,0,100),v:N(l*100,0,100)}},t.hsvToHsl=function(e){var i=e.s/100,a=e.v/100,o=(2-i)*a,s=o<=1?o:2-o,c=s<1e-9?0:i*a/s;return{h:e.h,s:N(c*100,0,100),l:N(o*50,0,100)}},t.hslToHsv=function(e){var i=e.l*2,a=e.s*(i<=100?i:200-i)/100,o=i+a<1e-9?0:2*a/(i+a);return{h:e.h,s:N(o*100,0,100),v:N((i+a)/2,0,100)}},t.kelvinToRgb=function(e){var i=e/100,a,o,s;return i<66?(a=255,o=-155.25485562709179-.44596950469579133*(o=i-2)+104.49216199393888*B(o),s=i<20?0:-254.76935184120902+.8274096064007395*(s=i-10)+115.67994401066147*B(s)):(a=351.97690566805693+.114206453784165*(a=i-55)-40.25366309332127*B(a),o=325.4494125711974+.07943456536662342*(o=i-50)-28.0852963507957*B(o),s=255),{r:N(L(a),0,255),g:N(L(o),0,255),b:N(L(s),0,255)}},t.rgbToKelvin=function(e){for(var i=e.r,a=e.b,o=.4,s=mt,c=_t,u;c-s>o;){u=(c+s)*.5;var h=t.kelvinToRgb(u);h.b/h.r>=a/i?c=u:s=u}return u},at(t,[{key:"hsv",get:function(){var e=this.$;return{h:e.h,s:e.s,v:e.v}},set:function(e){var i=this.$;if(e=C({},i,e),this.onChange){var a={h:!1,v:!1,s:!1,a:!1};for(var o in i)a[o]=e[o]!=i[o];this.$=e,(a.h||a.s||a.v||a.a)&&this.onChange(this,a)}else this.$=e}},{key:"hsva",get:function(){return C({},this.$)},set:function(e){this.hsv=e}},{key:"hue",get:function(){return this.$.h},set:function(e){this.hsv={h:e}}},{key:"saturation",get:function(){return this.$.s},set:function(e){this.hsv={s:e}}},{key:"value",get:function(){return this.$.v},set:function(e){this.hsv={v:e}}},{key:"alpha",get:function(){return this.$.a},set:function(e){this.hsv=C({},this.hsv,{a:e})}},{key:"kelvin",get:function(){return t.rgbToKelvin(this.rgb)},set:function(e){this.rgb=t.kelvinToRgb(e)}},{key:"red",get:function(){var e=this.rgb;return e.r},set:function(e){this.rgb=C({},this.rgb,{r:e})}},{key:"green",get:function(){var e=this.rgb;return e.g},set:function(e){this.rgb=C({},this.rgb,{g:e})}},{key:"blue",get:function(){var e=this.rgb;return e.b},set:function(e){this.rgb=C({},this.rgb,{b:e})}},{key:"rgb",get:function(){var e=t.hsvToRgb(this.$),i=e.r,a=e.g,o=e.b;return{r:O(i),g:O(a),b:O(o)}},set:function(e){this.hsv=C({},t.rgbToHsv(e),{a:e.a===void 0?1:e.a})}},{key:"rgba",get:function(){return C({},this.rgb,{a:this.alpha})},set:function(e){this.rgb=e}},{key:"hsl",get:function(){var e=t.hsvToHsl(this.$),i=e.h,a=e.s,o=e.l;return{h:O(i),s:O(a),l:O(o)}},set:function(e){this.hsv=C({},t.hslToHsv(e),{a:e.a===void 0?1:e.a})}},{key:"hsla",get:function(){return C({},this.hsl,{a:this.alpha})},set:function(e){this.hsl=e}},{key:"rgbString",get:function(){var e=this.rgb;return"rgb("+e.r+", "+e.g+", "+e.b+")"},set:function(e){var i,a,o,s,c=1;if((i=lt.exec(e))?(a=E(i[1],255),o=E(i[2],255),s=E(i[3],255)):(i=ct.exec(e))&&(a=E(i[1],255),o=E(i[2],255),s=E(i[3],255),c=E(i[4],1)),i)this.rgb={r:a,g:o,b:s,a:c};else throw new Error("Invalid rgb string")}},{key:"rgbaString",get:function(){var e=this.rgba;return"rgba("+e.r+", "+e.g+", "+e.b+", "+e.a+")"},set:function(e){this.rgbString=e}},{key:"hexString",get:function(){var e=this.rgb;return"#"+A(e.r)+A(e.g)+A(e.b)},set:function(e){var i,a,o,s,c=255;if((i=dt.exec(e))?(a=S(i[1])*17,o=S(i[2])*17,s=S(i[3])*17):(i=ft.exec(e))?(a=S(i[1])*17,o=S(i[2])*17,s=S(i[3])*17,c=S(i[4])*17):(i=vt.exec(e))?(a=S(i[1]),o=S(i[2]),s=S(i[3])):(i=gt.exec(e))&&(a=S(i[1]),o=S(i[2]),s=S(i[3]),c=S(i[4])),i)this.rgb={r:a,g:o,b:s,a:c/255};else throw new Error("Invalid hex string")}},{key:"hex8String",get:function(){var e=this.rgba;return"#"+A(e.r)+A(e.g)+A(e.b)+A(L(e.a*255))},set:function(e){this.hexString=e}},{key:"hslString",get:function(){var e=this.hsl;return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},set:function(e){var i,a,o,s,c=1;if((i=ht.exec(e))?(a=E(i[1],360),o=E(i[2],100),s=E(i[3],100)):(i=ut.exec(e))&&(a=E(i[1],360),o=E(i[2],100),s=E(i[3],100),c=E(i[4],1)),i)this.hsl={h:a,s:o,l:s,a:c};else throw new Error("Invalid hsl string")}},{key:"hslaString",get:function(){var e=this.hsla;return"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"},set:function(e){this.hslString=e}}]),t})(),bt={sliderShape:"bar",sliderType:"value",minTemperature:2200,maxTemperature:11e3};function ue(t){var r,n=t.width,e=t.sliderSize,i=t.borderWidth,a=t.handleRadius,o=t.padding,s=t.sliderShape,c=t.layoutDirection==="horizontal";return e=(r=e)!=null?r:o*2+a*2,s==="circle"?{handleStart:t.padding+t.handleRadius,handleRange:n-o*2-a*2,width:n,height:n,cx:n/2,cy:n/2,radius:n/2-i/2}:{handleStart:e/2,handleRange:n-e,radius:e/2,x:0,y:0,width:c?e:n,height:c?n:e}}function xt(t,r){var n=r.hsva,e=r.rgb;switch(t.sliderType){case"red":return e.r/2.55;case"green":return e.g/2.55;case"blue":return e.b/2.55;case"alpha":return n.a*100;case"kelvin":var i=t.minTemperature,a=t.maxTemperature,o=a-i,s=(r.kelvin-i)/o*100;return Math.max(0,Math.min(s,100));case"hue":return n.h/=3.6;case"saturation":return n.s;case"value":default:return n.v}}function yt(t,r,n){var e=ue(t),i=e.handleRange,a=e.handleStart,o;t.layoutDirection==="horizontal"?o=-1*n+i+a:o=r-a,o=Math.max(Math.min(o,i),0);var s=Math.round(100/i*o);switch(t.sliderType){case"kelvin":var c=t.minTemperature,u=t.maxTemperature,h=u-c;return c+h*(s/100);case"alpha":return s/100;case"hue":return s*3.6;case"red":case"blue":case"green":return s*2.55;default:return s}}function pt(t,r){var n=ue(t),e=n.width,i=n.height,a=n.handleRange,o=n.handleStart,s=t.layoutDirection==="horizontal",c=xt(t,r),u=s?e/2:i/2,h=o+c/100*a;return s&&(h=-1*h+a+o*2),{x:s?u:h,y:s?h:u}}function wt(t,r){var n=r.hsv,e=r.rgb;switch(t.sliderType){case"red":return[[0,"rgb(0,"+e.g+","+e.b+")"],[100,"rgb(255,"+e.g+","+e.b+")"]];case"green":return[[0,"rgb("+e.r+",0,"+e.b+")"],[100,"rgb("+e.r+",255,"+e.b+")"]];case"blue":return[[0,"rgb("+e.r+","+e.g+",0)"],[100,"rgb("+e.r+","+e.g+",255)"]];case"alpha":return[[0,"rgba("+e.r+","+e.g+","+e.b+",0)"],[100,"rgb("+e.r+","+e.g+","+e.b+")"]];case"kelvin":for(var i=[],a=t.minTemperature,o=t.maxTemperature,s=8,c=o-a,u=a,h=0;u<o;u+=c/s,h+=1){var l=$.kelvinToRgb(u),d=l.r,f=l.g,p=l.b;i.push([100/s*h,"rgb("+d+","+f+","+p+")"])}return i;case"hue":return[[0,"#f00"],[16.666,"#ff0"],[33.333,"#0f0"],[50,"#0ff"],[66.666,"#00f"],[83.333,"#f0f"],[100,"#f00"]];case"saturation":var m=$.hsvToHsl({h:n.h,s:0,v:n.v}),w=$.hsvToHsl({h:n.h,s:100,v:n.v});return[[0,"hsl("+m.h+","+m.s+"%,"+m.l+"%)"],[100,"hsl("+w.h+","+w.s+"%,"+w.l+"%)"]];case"value":default:var y=$.hsvToHsl({h:n.h,s:n.s,v:100});return[[0,"#000"],[100,"hsl("+y.h+","+y.s+"%,"+y.l+"%)"]]}}var Te=Math.PI*2,kt=function(r,n){return(r%n+n)%n},He=function(r,n){return Math.sqrt(r*r+n*n)};function De(t){return t.width/2-t.padding-t.handleRadius-t.borderWidth}function Et(t,r,n){var e=q(t),i=e.cx,a=e.cy,o=t.width/2;return He(i-r,a-n)<o}function q(t){var r=t.width/2;return{width:t.width,radius:r-t.borderWidth,cx:r,cy:r}}function Oe(t,r,n){var e=t.wheelAngle,i=t.wheelDirection;return n&&i==="clockwise"?r=e+r:i==="clockwise"?r=360-e+r:n&&i==="anticlockwise"?r=e+180-r:i==="anticlockwise"&&(r=e-r),kt(r,360)}function St(t,r){var n=r.hsv,e=q(t),i=e.cx,a=e.cy,o=De(t),s=(180+Oe(t,n.h,!0))*(Te/360),c=n.s/100*o,u=t.wheelDirection==="clockwise"?-1:1;return{x:i+c*Math.cos(s)*u,y:a+c*Math.sin(s)*u}}function xe(t,r,n){var e=q(t),i=e.cx,a=e.cy,o=De(t);r=i-r,n=a-n;var s=Oe(t,Math.atan2(-n,-r)*(360/Te)),c=Math.min(He(r,n),o);return{h:Math.round(s),s:Math.round(100/o*c)}}function de(t){var r=t.width,n=t.boxHeight,e=t.padding,i=t.handleRadius;return{width:r,height:n??r,radius:e+i}}function ye(t,r,n){var e=de(t),i=e.width,a=e.height,o=e.radius,s=o,c=i-o*2,u=a-o*2,h=(r-s)/c*100,l=(n-s)/u*100;return{s:Math.max(0,Math.min(h,100)),v:Math.max(0,Math.min(100-l,100))}}function Ct(t,r){var n=de(t),e=n.width,i=n.height,a=n.radius,o=r.hsv,s=a,c=e-a*2,u=i-a*2;return{x:s+o.s/100*c,y:s+(u-o.v/100*u)}}function It(t,r){var n=r.hue;return[[[0,"#fff"],[100,"hsl("+n+",100%,50%)"]],[[0,"rgba(0,0,0,0)"],[100,"#000"]]]}var re;function Nt(t){re||(re=document.getElementsByTagName("base"));var r=window.navigator.userAgent,n=/^((?!chrome|android).)*safari/i.test(r),e=/iPhone|iPod|iPad/i.test(r),i=window.location;return(n||e)&&re.length>0?i.protocol+"//"+i.host+i.pathname+i.search+t:t}function $e(t,r,n,e){for(var i=0;i<e.length;i++){var a=e[i].x-r,o=e[i].y-n,s=Math.sqrt(a*a+o*o);if(s<t.handleRadius)return i}return null}function fe(t){return{boxSizing:"border-box",border:t.borderWidth+"px solid "+t.borderColor}}function oe(t,r,n){return t+"-gradient("+r+", "+n.map(function(e){var i=e[0],a=e[1];return a+" "+i+"%"}).join(",")+")"}function k(t){return typeof t=="string"?t:t+"px"}var Rt={width:300,height:300,color:"#fff",colors:[],padding:6,layoutDirection:"vertical",borderColor:"#fff",borderWidth:0,handleRadius:8,activeHandleRadius:null,handleSvg:null,handleProps:{x:0,y:0},wheelLightness:!0,wheelAngle:0,wheelDirection:"anticlockwise",sliderSize:null,sliderMargin:12,boxHeight:null},pe=["mousemove","touchmove","mouseup","touchend"],K=(function(t){function r(n){t.call(this,n),this.uid=(Math.random()+1).toString(36).substring(5)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.render=function(e){var i=this.handleEvent.bind(this),a={onMouseDown:i,ontouchstart:i},o=e.layoutDirection==="horizontal",s=e.margin===null?e.sliderMargin:e.margin,c={overflow:"visible",display:o?"inline-block":"block"};return e.index>0&&(c[o?"marginLeft":"marginTop"]=s),_(G,null,e.children(this.uid,a,c))},r.prototype.handleEvent=function(e){var i=this,a=this.props.onInput,o=this.base.getBoundingClientRect();e.preventDefault();var s=e.touches?e.changedTouches[0]:e,c=s.clientX-o.left,u=s.clientY-o.top;switch(e.type){case"mousedown":case"touchstart":var h=a(c,u,0);h!==!1&&pe.forEach(function(l){document.addEventListener(l,i,{passive:!1})});break;case"mousemove":case"touchmove":a(c,u,1);break;case"mouseup":case"touchend":a(c,u,2),pe.forEach(function(l){document.removeEventListener(l,i,{passive:!1})});break}},r})(W);function D(t){var r=t.r,n=t.url,e=r,i=r;return _("svg",{className:"IroHandle IroHandle--"+t.index+" "+(t.isActive?"IroHandle--isActive":""),style:{"-webkit-tap-highlight-color":"rgba(0, 0, 0, 0);",transform:"translate("+k(t.x)+", "+k(t.y)+")",willChange:"transform",top:k(-r),left:k(-r),width:k(r*2),height:k(r*2),position:"absolute",overflow:"visible"}},n&&_("use",Object.assign({xlinkHref:Nt(n)},t.props)),!n&&_("circle",{cx:e,cy:i,r,fill:"none","stroke-width":2,stroke:"#000"}),!n&&_("circle",{cx:e,cy:i,r:r-2,fill:t.fill,"stroke-width":2,stroke:"#fff"}))}D.defaultProps={fill:"none",x:0,y:0,r:8,url:null,props:{x:0,y:0}};function F(t){var r=t.activeIndex,n=r!==void 0&&r<t.colors.length?t.colors[r]:t.color,e=ue(t),i=e.width,a=e.height,o=e.radius,s=pt(t,n),c=wt(t,n);function u(h,l,d){var f=yt(t,h,l);t.parent.inputActive=!0,n[t.sliderType]=f,t.onInput(d,t.id)}return _(K,Object.assign({},t,{onInput:u}),function(h,l,d){return _("div",Object.assign({},l,{className:"IroSlider",style:Object.assign({},{position:"relative",width:k(i),height:k(a),borderRadius:k(o),background:"conic-gradient(#ccc 25%, #fff 0 50%, #ccc 0 75%, #fff 0)",backgroundSize:"8px 8px"},d)}),_("div",{className:"IroSliderGradient",style:Object.assign({},{position:"absolute",top:0,left:0,width:"100%",height:"100%",borderRadius:k(o),background:oe("linear",t.layoutDirection==="horizontal"?"to top":"to right",c)},fe(t))}),_(D,{isActive:!0,index:n.index,r:t.handleRadius,url:t.handleSvg,props:t.handleProps,x:s.x,y:s.y}))})}F.defaultProps=Object.assign({},bt);function jt(t){var r=de(t),n=r.width,e=r.height,i=r.radius,a=t.colors,o=t.parent,s=t.activeIndex,c=s!==void 0&&s<t.colors.length?t.colors[s]:t.color,u=It(t,c),h=a.map(function(d){return Ct(t,d)});function l(d,f,p){if(p===0){var m=$e(t,d,f,h);m!==null?o.setActiveColor(m):(o.inputActive=!0,c.hsv=ye(t,d,f),t.onInput(p,t.id))}else p===1&&(o.inputActive=!0,c.hsv=ye(t,d,f));t.onInput(p,t.id)}return _(K,Object.assign({},t,{onInput:l}),function(d,f,p){return _("div",Object.assign({},f,{className:"IroBox",style:Object.assign({},{width:k(n),height:k(e),position:"relative"},p)}),_("div",{className:"IroBox",style:Object.assign({},{width:"100%",height:"100%",borderRadius:k(i)},fe(t),{background:oe("linear","to bottom",u[1])+","+oe("linear","to right",u[0])})}),a.filter(function(m){return m!==c}).map(function(m){return _(D,{isActive:!1,index:m.index,fill:m.hslString,r:t.handleRadius,url:t.handleSvg,props:t.handleProps,x:h[m.index].x,y:h[m.index].y})}),_(D,{isActive:!0,index:c.index,fill:c.hslString,r:t.activeHandleRadius||t.handleRadius,url:t.handleSvg,props:t.handleProps,x:h[c.index].x,y:h[c.index].y}))})}var Mt="conic-gradient(red, yellow, lime, aqua, blue, magenta, red)",At="conic-gradient(red, magenta, blue, aqua, lime, yellow, red)";function We(t){var r=q(t),n=r.width,e=t.colors;t.borderWidth;var i=t.parent,a=t.color,o=a.hsv,s=e.map(function(h){return St(t,h)}),c={position:"absolute",top:0,left:0,width:"100%",height:"100%",borderRadius:"50%",boxSizing:"border-box"};function u(h,l,d){if(d===0){if(!Et(t,h,l))return!1;var f=$e(t,h,l,s);f!==null?i.setActiveColor(f):(i.inputActive=!0,a.hsv=xe(t,h,l),t.onInput(d,t.id))}else d===1&&(i.inputActive=!0,a.hsv=xe(t,h,l));t.onInput(d,t.id)}return _(K,Object.assign({},t,{onInput:u}),function(h,l,d){return _("div",Object.assign({},l,{className:"IroWheel",style:Object.assign({},{width:k(n),height:k(n),position:"relative"},d)}),_("div",{className:"IroWheelHue",style:Object.assign({},c,{transform:"rotateZ("+(t.wheelAngle+90)+"deg)",background:t.wheelDirection==="clockwise"?Mt:At})}),_("div",{className:"IroWheelSaturation",style:Object.assign({},c,{background:"radial-gradient(circle closest-side, #fff, transparent)"})}),t.wheelLightness&&_("div",{className:"IroWheelLightness",style:Object.assign({},c,{background:"#000",opacity:1-o.v/100})}),_("div",{className:"IroWheelBorder",style:Object.assign({},c,fe(t))}),e.filter(function(f){return f!==a}).map(function(f){return _(D,{isActive:!1,index:f.index,fill:f.hslString,r:t.handleRadius,url:t.handleSvg,props:t.handleProps,x:s[f.index].x,y:s[f.index].y})}),_(D,{isActive:!0,index:a.index,fill:a.hslString,r:t.activeHandleRadius||t.handleRadius,url:t.handleSvg,props:t.handleProps,x:s[a.index].x,y:s[a.index].y}))})}function Pt(t){var r=function(n,e){var i,a=document.createElement("div");nt(_(t,Object.assign({},{ref:function(s){return i=s}},e)),a);function o(){var s=n instanceof Element?n:document.querySelector(n);s.appendChild(i.base),i.onMount(s)}return document.readyState!=="loading"?o():document.addEventListener("DOMContentLoaded",o),i};return r.prototype=t.prototype,Object.assign(r,t),r.__component=t,r}var Le=(function(t){function r(n){var e=this;t.call(this,n),this.colors=[],this.inputActive=!1,this.events={},this.activeEvents={},this.deferredEvents={},this.id=n.id;var i=n.colors.length>0?n.colors:[n.color];i.forEach(function(a){return e.addColor(a)}),this.setActiveColor(0),this.state=Object.assign({},n,{color:this.color,colors:this.colors,layout:n.layout})}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.addColor=function(e,i){i===void 0&&(i=this.colors.length);var a=new $(e,this.onColorChange.bind(this));this.colors.splice(i,0,a),this.colors.forEach(function(o,s){return o.index=s}),this.state&&this.setState({colors:this.colors}),this.deferredEmit("color:init",a)},r.prototype.removeColor=function(e){var i=this.colors.splice(e,1)[0];i.unbind(),this.colors.forEach(function(a,o){return a.index=o}),this.state&&this.setState({colors:this.colors}),i.index===this.color.index&&this.setActiveColor(0),this.emit("color:remove",i)},r.prototype.setActiveColor=function(e){this.color=this.colors[e],this.state&&this.setState({color:this.color}),this.emit("color:setActive",this.color)},r.prototype.setColors=function(e,i){var a=this;i===void 0&&(i=0),this.colors.forEach(function(o){return o.unbind()}),this.colors=[],e.forEach(function(o){return a.addColor(o)}),this.setActiveColor(i),this.emit("color:setAll",this.colors)},r.prototype.on=function(e,i){var a=this,o=this.events;(Array.isArray(e)?e:[e]).forEach(function(s){(o[s]||(o[s]=[])).push(i),a.deferredEvents[s]&&(a.deferredEvents[s].forEach(function(c){i.apply(null,c)}),a.deferredEvents[s]=[])})},r.prototype.off=function(e,i){var a=this;(Array.isArray(e)?e:[e]).forEach(function(o){var s=a.events[o];s&&s.splice(s.indexOf(i),1)})},r.prototype.emit=function(e){for(var i=this,a=[],o=arguments.length-1;o-- >0;)a[o]=arguments[o+1];var s=this.activeEvents,c=s.hasOwnProperty(e)?s[e]:!1;if(!c){s[e]=!0;var u=this.events[e]||[];u.forEach(function(h){return h.apply(i,a)}),s[e]=!1}},r.prototype.deferredEmit=function(e){for(var i,a=[],o=arguments.length-1;o-- >0;)a[o]=arguments[o+1];var s=this.deferredEvents;(i=this).emit.apply(i,[e].concat(a)),(s[e]||(s[e]=[])).push(a)},r.prototype.setOptions=function(e){this.setState(e)},r.prototype.resize=function(e){this.setOptions({width:e})},r.prototype.reset=function(){this.colors.forEach(function(e){return e.reset()}),this.setState({colors:this.colors})},r.prototype.onMount=function(e){this.el=e,this.deferredEmit("mount",this)},r.prototype.onColorChange=function(e,i){this.setState({color:this.color}),this.inputActive&&(this.inputActive=!1,this.emit("input:change",e,i)),this.emit("color:change",e,i)},r.prototype.emitInputEvent=function(e,i){e===0?this.emit("input:start",this.color,i):e===1?this.emit("input:move",this.color,i):e===2&&this.emit("input:end",this.color,i)},r.prototype.render=function(e,i){var a=this,o=i.layout;return Array.isArray(o)||(o=[{component:We},{component:F}],i.transparency&&o.push({component:F,options:{sliderType:"alpha"}})),_("div",{class:"IroColorPicker",id:i.id,style:{display:i.display}},o.map(function(s,c){var u=s.component,h=s.options;return _(u,Object.assign({},i,h,{ref:void 0,onInput:a.emitInputEvent.bind(a),parent:a,index:c}))}))},r})(W);Le.defaultProps=Object.assign({},Rt,{colors:[],display:"block",id:null,layout:"default",margin:null});var Tt=Pt(Le),se;(function(t){t.version="5.5.2",t.Color=$,t.ColorPicker=Tt,(function(r){r.h=_,r.ComponentBase=K,r.Handle=D,r.Slider=F,r.Wheel=We,r.Box=jt})(t.ui||(t.ui={}))})(se||(se={}));var ne=se;function Ht({selectedText:t,existingComment:r,onSave:n,onCancel:e}){const i=Ue(),{t:a}=Fe(),[o,s]=R.useState(r?.text||""),[c,u]=R.useState(r?.highlightColor?.border||"#FFEB3B"),[h,l]=R.useState(null),d=R.useRef(null);R.useEffect(()=>{if(d.current&&!h){const g=new ne.ColorPicker(d.current,{width:200,color:c,borderWidth:2,borderColor:"#fff",layout:[{component:ne.ui.Wheel,options:{}},{component:ne.ui.Slider,options:{sliderType:"value"}}]});g.on("color:change",b=>{u(b.hexString.toUpperCase())}),l(g)}return()=>{h&&h.off("color:change")}},[h]),R.useEffect(()=>{const g=b=>{(b.ctrlKey||b.metaKey)&&b.key==="Enter"?(b.preventDefault(),f()):b.key==="Escape"&&(b.preventDefault(),e())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o,c,e]);const f=()=>{o.trim()&&m(c)&&n(o.trim(),c)},p=g=>{const b=g.target.value.toUpperCase();m(b)?(u(b),h&&(h.color.hexString=b)):u(b)},m=g=>/^#[0-9A-Fa-f]{6}$/.test(g),w=()=>{if(m(c)){const g=parseInt(c.slice(1,3),16),b=parseInt(c.slice(3,5),16),I=parseInt(c.slice(5,7),16);return{backgroundColor:`rgba(${g}, ${b}, ${I}, 0.3)`,borderColor:c,borderWidth:"2px"}}return{}},y=o.trim().length>0&&m(c);return v.jsxs("div",{className:Xe("h-full flex flex-col overflow-hidden p-6",`vscode-${i}`),children:[v.jsxs("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(qe,{className:"h-5 w-5 text-primary"}),v.jsx("h1",{className:"text-lg font-semibold",children:a(r?"commentModal.title.edit":"commentModal.title.add")})]}),v.jsx(Y,{variant:"ghost",size:"sm",onClick:e,className:"h-8 w-8 p-0",children:v.jsx(ge,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:[v.jsxs(Z,{children:[v.jsx(J,{className:"pb-3",children:v.jsx(Q,{className:"text-sm",children:a("commentModal.selectedText")})}),v.jsx(ee,{children:v.jsx("div",{className:"p-3 rounded-md bg-muted font-mono text-sm leading-relaxed max-h-32 overflow-y-auto border",style:w(),children:t})})]}),v.jsxs(Z,{children:[v.jsx(J,{className:"pb-3",children:v.jsxs(Q,{className:"text-sm flex items-center gap-2",children:[v.jsx(Ke,{className:"h-4 w-4"}),a("commentModal.highlightColor")]})}),v.jsxs(ee,{className:"space-y-4",children:[v.jsx("div",{className:"flex justify-center p-4 bg-muted/30 rounded-lg border",children:v.jsx("div",{ref:d})}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex-1",children:[v.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:a("commentModal.hexColor")}),v.jsx("input",{type:"text",value:c,onChange:p,className:"w-full px-3 py-2 text-sm font-mono bg-background border rounded-md focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"#FFEB3B",maxLength:7})]}),v.jsxs("div",{className:"flex flex-col items-center gap-1",children:[v.jsx("div",{className:"w-12 h-12 border-2 rounded-md shadow-sm",style:{backgroundColor:m(c)?c:"#gray",borderColor:m(c)?c:"#gray"}}),v.jsx("span",{className:"text-xs text-muted-foreground",children:a("commentModal.preview")})]})]})]})]}),v.jsxs(Z,{children:[v.jsx(J,{className:"pb-3",children:v.jsx(Q,{className:"text-sm",children:a("commentModal.yourComment")})}),v.jsxs(ee,{children:[v.jsx("textarea",{value:o,onChange:g=>s(g.target.value),className:"w-full min-h-24 px-3 py-2 text-sm bg-background border rounded-md resize-y focus:outline-none focus:ring-2 focus:ring-ring",placeholder:a("commentModal.placeholder"),autoFocus:!0}),v.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:a("commentModal.tip")})]})]})]}),v.jsxs("div",{className:"flex justify-end gap-2 pt-4 mt-4 border-t border-border flex-shrink-0",children:[v.jsxs(Y,{variant:"outline",onClick:e,className:"flex items-center gap-2",children:[v.jsx(ge,{className:"h-4 w-4"}),a("commentModal.cancel")]}),v.jsxs(Y,{onClick:f,disabled:!y,className:"flex items-center gap-2",children:[v.jsx(Ye,{className:"h-4 w-4"}),a(r?"commentModal.update":"commentModal.add")]})]})]})}const we=window.acquireVsCodeApi?.();function Dt(){const t=window.initialState?.selectedText||ve.t("commentModal.noTextSelected"),r=window.initialState?.existingComment||null,n=(i,a)=>{const o={command:"save",comment:i,color:a};we?.postMessage(o)},e=()=>{const i={command:"cancel"};we?.postMessage(i)};return v.jsx(Ve,{i18n:ve,children:v.jsx(Ht,{selectedText:t,existingComment:r,onSave:n,onCancel:e})})}const ke=document.getElementById("root");ke&&Ge.createRoot(ke).render(v.jsx(Dt,{}));