@ddict/bubble 1.3.9 → 1.3.11
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/dist/bubble.css +1 -1
- package/dist/bubble.es.js +915 -899
- package/dist/bubble.umd.js +3 -3
- package/package.json +1 -1
package/dist/bubble.umd.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(U,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(U=typeof globalThis<"u"?globalThis:U||self,n(U.Bubble={},U.Vue))})(this,function(U,n){"use strict";const ce=Math.min,j=Math.max,de=Math.round,ue=Math.floor,P=e=>({x:e,y:e}),mt={left:"right",right:"left",bottom:"top",top:"bottom"},ht={start:"end",end:"start"};function Oe(e,t,o){return j(e,ce(t,o))}function fe(e,t){return typeof e=="function"?e(t):e}function Z(e){return e.split("-")[0]}function me(e){return e.split("-")[1]}function We(e){return e==="x"?"y":"x"}function Pe(e){return e==="y"?"height":"width"}function J(e){return["top","bottom"].includes(Z(e))?"y":"x"}function He(e){return We(J(e))}function pt(e,t,o){o===void 0&&(o=!1);const i=me(e),r=He(e),a=Pe(r);let l=r==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=he(l)),[l,he(l)]}function gt(e){const t=he(e);return[ke(e),t,ke(t)]}function ke(e){return e.replace(/start|end/g,t=>ht[t])}function Ct(e,t,o){const i=["left","right"],r=["right","left"],a=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return o?t?r:i:t?i:r;case"left":case"right":return t?a:l;default:return[]}}function bt(e,t,o,i){const r=me(e);let a=Ct(Z(e),o==="start",i);return r&&(a=a.map(l=>l+"-"+r),t&&(a=a.concat(a.map(ke)))),a}function he(e){return e.replace(/left|right|bottom|top/g,t=>mt[t])}function wt(e){return{top:0,right:0,bottom:0,left:0,...e}}function yt(e){return typeof e!="number"?wt(e):{top:e,right:e,bottom:e,left:e}}function pe(e){const{x:t,y:o,width:i,height:r}=e;return{width:i,height:r,top:o,left:t,right:t+i,bottom:o+r,x:t,y:o}}function Ue(e,t,o){let{reference:i,floating:r}=e;const a=J(t),l=He(t),c=Pe(l),s=Z(t),d=a==="y",f=i.x+i.width/2-r.width/2,p=i.y+i.height/2-r.height/2,g=i[c]/2-r[c]/2;let m;switch(s){case"top":m={x:f,y:i.y-r.height};break;case"bottom":m={x:f,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:p};break;case"left":m={x:i.x-r.width,y:p};break;default:m={x:i.x,y:i.y}}switch(me(t)){case"start":m[l]-=g*(o&&d?-1:1);break;case"end":m[l]+=g*(o&&d?-1:1);break}return m}const xt=async(e,t,o)=>{const{placement:i="bottom",strategy:r="absolute",middleware:a=[],platform:l}=o,c=a.filter(Boolean),s=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:p}=Ue(d,i,s),g=i,m={},h=0;for(let b=0;b<c.length;b++){const{name:w,fn:x}=c[b],{x:y,y:E,data:L,reset:k}=await x({x:f,y:p,initialPlacement:i,placement:g,strategy:r,middlewareData:m,rects:d,platform:l,elements:{reference:e,floating:t}});f=y??f,p=E??p,m={...m,[w]:{...m[w],...L}},k&&h<=50&&(h++,typeof k=="object"&&(k.placement&&(g=k.placement),k.rects&&(d=k.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:f,y:p}=Ue(d,g,s)),b=-1)}return{x:f,y:p,placement:g,strategy:r,middlewareData:m}};async function je(e,t){var o;t===void 0&&(t={});const{x:i,y:r,platform:a,rects:l,elements:c,strategy:s}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:g=!1,padding:m=0}=fe(t,e),h=yt(m),w=c[g?p==="floating"?"reference":"floating":p],x=pe(await a.getClippingRect({element:(o=await(a.isElement==null?void 0:a.isElement(w)))==null||o?w:w.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:d,rootBoundary:f,strategy:s})),y=p==="floating"?{x:i,y:r,width:l.floating.width,height:l.floating.height}:l.reference,E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),L=await(a.isElement==null?void 0:a.isElement(E))?await(a.getScale==null?void 0:a.getScale(E))||{x:1,y:1}:{x:1,y:1},k=pe(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:E,strategy:s}):y);return{top:(x.top-k.top+h.top)/L.y,bottom:(k.bottom-x.bottom+h.bottom)/L.y,left:(x.left-k.left+h.left)/L.x,right:(k.right-x.right+h.right)/L.x}}const Et=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,i;const{placement:r,middlewareData:a,rects:l,initialPlacement:c,platform:s,elements:d}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:b=!0,...w}=fe(e,t);if((o=a.arrow)!=null&&o.alignmentOffset)return{};const x=Z(r),y=J(c),E=Z(c)===c,L=await(s.isRTL==null?void 0:s.isRTL(d.floating)),k=g||(E||!b?[he(c)]:gt(c)),B=h!=="none";!g&&B&&k.push(...bt(c,b,h,L));const v=[c,...k],A=await je(t,w),z=[];let G=((i=a.flip)==null?void 0:i.overflows)||[];if(f&&z.push(A[x]),p){const D=pt(r,l,L);z.push(A[D[0]],A[D[1]])}if(G=[...G,{placement:r,overflows:z}],!z.every(D=>D<=0)){var re,le;const D=(((re=a.flip)==null?void 0:re.index)||0)+1,ye=v[D];if(ye)return{data:{index:D,overflows:G},reset:{placement:ye}};let O=(le=G.filter(W=>W.overflows[0]<=0).sort((W,R)=>W.overflows[1]-R.overflows[1])[0])==null?void 0:le.placement;if(!O)switch(m){case"bestFit":{var _;const W=(_=G.filter(R=>{if(B){const V=J(R.placement);return V===y||V==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(V=>V>0).reduce((V,ae)=>V+ae,0)]).sort((R,V)=>R[1]-V[1])[0])==null?void 0:_[0];W&&(O=W);break}case"initialPlacement":O=c;break}if(r!==O)return{reset:{placement:O}}}return{}}}};async function kt(e,t){const{placement:o,platform:i,elements:r}=e,a=await(i.isRTL==null?void 0:i.isRTL(r.floating)),l=Z(o),c=me(o),s=J(o)==="y",d=["left","top"].includes(l)?-1:1,f=a&&s?-1:1,p=fe(t,e);let{mainAxis:g,crossAxis:m,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return c&&typeof h=="number"&&(m=c==="end"?h*-1:h),s?{x:m*f,y:g*d}:{x:g*d,y:m*f}}const vt=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,i;const{x:r,y:a,placement:l,middlewareData:c}=t,s=await kt(t,e);return l===((o=c.offset)==null?void 0:o.placement)&&(i=c.arrow)!=null&&i.alignmentOffset?{}:{x:r+s.x,y:a+s.y,data:{...s,placement:l}}}}},Lt=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:i,placement:r}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:w=>{let{x,y}=w;return{x,y}}},...s}=fe(e,t),d={x:o,y:i},f=await je(t,s),p=J(Z(r)),g=We(p);let m=d[g],h=d[p];if(a){const w=g==="y"?"top":"left",x=g==="y"?"bottom":"right",y=m+f[w],E=m-f[x];m=Oe(y,m,E)}if(l){const w=p==="y"?"top":"left",x=p==="y"?"bottom":"right",y=h+f[w],E=h-f[x];h=Oe(y,h,E)}const b=c.fn({...t,[g]:m,[p]:h});return{...b,data:{x:b.x-o,y:b.y-i}}}}};function q(e){return ve(e)?(e.nodeName||"").toLowerCase():"#document"}function T(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function M(e){var t;return(t=(ve(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ve(e){return e instanceof Node||e instanceof T(e).Node}function N(e){return e instanceof Element||e instanceof T(e).Element}function I(e){return e instanceof HTMLElement||e instanceof T(e).HTMLElement}function Ze(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof T(e).ShadowRoot}function ne(e){const{overflow:t,overflowX:o,overflowY:i,display:r}=$(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+o)&&!["inline","contents"].includes(r)}function St(e){return["table","td","th"].includes(q(e))}function ge(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Le(e){const t=Se(),o=$(e);return o.transform!=="none"||o.perspective!=="none"||(o.containerType?o.containerType!=="normal":!1)||!t&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!t&&(o.filter?o.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(o.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(o.contain||"").includes(i))}function Bt(e){let t=H(e);for(;I(t)&&!Q(t);){if(ge(t))return null;if(Le(t))return t;t=H(t)}return null}function Se(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Q(e){return["html","body","#document"].includes(q(e))}function $(e){return T(e).getComputedStyle(e)}function Ce(e){return N(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function H(e){if(q(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ze(e)&&e.host||M(e);return Ze(t)?t.host:t}function qe(e){const t=H(e);return Q(t)?e.ownerDocument?e.ownerDocument.body:e.body:I(t)&&ne(t)?t:qe(t)}function oe(e,t,o){var i;t===void 0&&(t=[]),o===void 0&&(o=!0);const r=qe(e),a=r===((i=e.ownerDocument)==null?void 0:i.body),l=T(r);return a?t.concat(l,l.visualViewport||[],ne(r)?r:[],l.frameElement&&o?oe(l.frameElement):[]):t.concat(r,oe(r,[],o))}function Xe(e){const t=$(e);let o=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=I(e),a=r?e.offsetWidth:o,l=r?e.offsetHeight:i,c=de(o)!==a||de(i)!==l;return c&&(o=a,i=l),{width:o,height:i,$:c}}function Be(e){return N(e)?e:e.contextElement}function ee(e){const t=Be(e);if(!I(t))return P(1);const o=t.getBoundingClientRect(),{width:i,height:r,$:a}=Xe(t);let l=(a?de(o.width):o.width)/i,c=(a?de(o.height):o.height)/r;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const Tt=P(0);function Ye(e){const t=T(e);return!Se()||!t.visualViewport?Tt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function At(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==T(e)?!1:t}function X(e,t,o,i){t===void 0&&(t=!1),o===void 0&&(o=!1);const r=e.getBoundingClientRect(),a=Be(e);let l=P(1);t&&(i?N(i)&&(l=ee(i)):l=ee(e));const c=At(a,o,i)?Ye(a):P(0);let s=(r.left+c.x)/l.x,d=(r.top+c.y)/l.y,f=r.width/l.x,p=r.height/l.y;if(a){const g=T(a),m=i&&N(i)?T(i):i;let h=g,b=h.frameElement;for(;b&&i&&m!==h;){const w=ee(b),x=b.getBoundingClientRect(),y=$(b),E=x.left+(b.clientLeft+parseFloat(y.paddingLeft))*w.x,L=x.top+(b.clientTop+parseFloat(y.paddingTop))*w.y;s*=w.x,d*=w.y,f*=w.x,p*=w.y,s+=E,d+=L,h=T(b),b=h.frameElement}}return pe({width:f,height:p,x:s,y:d})}function $t(e){let{elements:t,rect:o,offsetParent:i,strategy:r}=e;const a=r==="fixed",l=M(i),c=t?ge(t.floating):!1;if(i===l||c&&a)return o;let s={scrollLeft:0,scrollTop:0},d=P(1);const f=P(0),p=I(i);if((p||!p&&!a)&&((q(i)!=="body"||ne(l))&&(s=Ce(i)),I(i))){const g=X(i);d=ee(i),f.x=g.x+i.clientLeft,f.y=g.y+i.clientTop}return{width:o.width*d.x,height:o.height*d.y,x:o.x*d.x-s.scrollLeft*d.x+f.x,y:o.y*d.y-s.scrollTop*d.y+f.y}}function Rt(e){return Array.from(e.getClientRects())}function Ke(e){return X(M(e)).left+Ce(e).scrollLeft}function Vt(e){const t=M(e),o=Ce(e),i=e.ownerDocument.body,r=j(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),a=j(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let l=-o.scrollLeft+Ke(e);const c=-o.scrollTop;return $(i).direction==="rtl"&&(l+=j(t.clientWidth,i.clientWidth)-r),{width:r,height:a,x:l,y:c}}function Nt(e,t){const o=T(e),i=M(e),r=o.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,s=0;if(r){a=r.width,l=r.height;const d=Se();(!d||d&&t==="fixed")&&(c=r.offsetLeft,s=r.offsetTop)}return{width:a,height:l,x:c,y:s}}function It(e,t){const o=X(e,!0,t==="fixed"),i=o.top+e.clientTop,r=o.left+e.clientLeft,a=I(e)?ee(e):P(1),l=e.clientWidth*a.x,c=e.clientHeight*a.y,s=r*a.x,d=i*a.y;return{width:l,height:c,x:s,y:d}}function Ge(e,t,o){let i;if(t==="viewport")i=Nt(e,o);else if(t==="document")i=Vt(M(e));else if(N(t))i=It(t,o);else{const r=Ye(e);i={...t,x:t.x-r.x,y:t.y-r.y}}return pe(i)}function Je(e,t){const o=H(e);return o===t||!N(o)||Q(o)?!1:$(o).position==="fixed"||Je(o,t)}function _t(e,t){const o=t.get(e);if(o)return o;let i=oe(e,[],!1).filter(c=>N(c)&&q(c)!=="body"),r=null;const a=$(e).position==="fixed";let l=a?H(e):e;for(;N(l)&&!Q(l);){const c=$(l),s=Le(l);!s&&c.position==="fixed"&&(r=null),(a?!s&&!r:!s&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||ne(l)&&!s&&Je(e,l))?i=i.filter(f=>f!==l):r=c,l=H(l)}return t.set(e,i),i}function Mt(e){let{element:t,boundary:o,rootBoundary:i,strategy:r}=e;const l=[...o==="clippingAncestors"?ge(t)?[]:_t(t,this._c):[].concat(o),i],c=l[0],s=l.reduce((d,f)=>{const p=Ge(t,f,r);return d.top=j(p.top,d.top),d.right=ce(p.right,d.right),d.bottom=ce(p.bottom,d.bottom),d.left=j(p.left,d.left),d},Ge(t,c,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Ft(e){const{width:t,height:o}=Xe(e);return{width:t,height:o}}function zt(e,t,o){const i=I(t),r=M(t),a=o==="fixed",l=X(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const s=P(0);if(i||!i&&!a)if((q(t)!=="body"||ne(r))&&(c=Ce(t)),i){const p=X(t,!0,a,t);s.x=p.x+t.clientLeft,s.y=p.y+t.clientTop}else r&&(s.x=Ke(r));const d=l.left+c.scrollLeft-s.x,f=l.top+c.scrollTop-s.y;return{x:d,y:f,width:l.width,height:l.height}}function Te(e){return $(e).position==="static"}function Qe(e,t){return!I(e)||$(e).position==="fixed"?null:t?t(e):e.offsetParent}function et(e,t){const o=T(e);if(ge(e))return o;if(!I(e)){let r=H(e);for(;r&&!Q(r);){if(N(r)&&!Te(r))return r;r=H(r)}return o}let i=Qe(e,t);for(;i&&St(i)&&Te(i);)i=Qe(i,t);return i&&Q(i)&&Te(i)&&!Le(i)?o:i||Bt(e)||o}const Dt=async function(e){const t=this.getOffsetParent||et,o=this.getDimensions,i=await o(e.floating);return{reference:zt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Ot(e){return $(e).direction==="rtl"}const Wt={convertOffsetParentRelativeRectToViewportRelativeRect:$t,getDocumentElement:M,getClippingRect:Mt,getOffsetParent:et,getElementRects:Dt,getClientRects:Rt,getDimensions:Ft,getScale:ee,isElement:N,isRTL:Ot};function Pt(e,t){let o=null,i;const r=M(e);function a(){var c;clearTimeout(i),(c=o)==null||c.disconnect(),o=null}function l(c,s){c===void 0&&(c=!1),s===void 0&&(s=1),a();const{left:d,top:f,width:p,height:g}=e.getBoundingClientRect();if(c||t(),!p||!g)return;const m=ue(f),h=ue(r.clientWidth-(d+p)),b=ue(r.clientHeight-(f+g)),w=ue(d),y={rootMargin:-m+"px "+-h+"px "+-b+"px "+-w+"px",threshold:j(0,ce(1,s))||1};let E=!0;function L(k){const B=k[0].intersectionRatio;if(B!==s){if(!E)return l();B?l(!1,B):i=setTimeout(()=>{l(!1,1e-7)},1e3)}E=!1}try{o=new IntersectionObserver(L,{...y,root:r.ownerDocument})}catch{o=new IntersectionObserver(L,y)}o.observe(e)}return l(!0),a}function Ht(e,t,o,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:s=!1}=i,d=Be(e),f=r||a?[...d?oe(d):[],...oe(t)]:[];f.forEach(x=>{r&&x.addEventListener("scroll",o,{passive:!0}),a&&x.addEventListener("resize",o)});const p=d&&c?Pt(d,o):null;let g=-1,m=null;l&&(m=new ResizeObserver(x=>{let[y]=x;y&&y.target===d&&m&&(m.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=m)==null||E.observe(t)})),o()}),d&&!s&&m.observe(d),m.observe(t));let h,b=s?X(e):null;s&&w();function w(){const x=X(e);b&&(x.x!==b.x||x.y!==b.y||x.width!==b.width||x.height!==b.height)&&o(),b=x,h=requestAnimationFrame(w)}return o(),()=>{var x;f.forEach(y=>{r&&y.removeEventListener("scroll",o),a&&y.removeEventListener("resize",o)}),p==null||p(),(x=m)==null||x.disconnect(),m=null,s&&cancelAnimationFrame(h)}}const Ut=vt,jt=Lt,Zt=Et,qt=(e,t,o)=>{const i=new Map,r={platform:Wt,...o},a={...r.platform,_c:i};return xt(e,t,{...r,platform:a})};function Xt(e){return e!=null&&typeof e=="object"&&"$el"in e}function tt(e){if(Xt(e)){const t=e.$el;return ve(t)&&q(t)==="#comment"?null:t}return e}function ie(e){return typeof e=="function"?e():n.unref(e)}function nt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ot(e,t){const o=nt(e);return Math.round(t*o)/o}function Yt(e,t,o){o===void 0&&(o={});const i=o.whileElementsMounted,r=n.computed(()=>{var v;return(v=ie(o.open))!=null?v:!0}),a=n.computed(()=>ie(o.middleware)),l=n.computed(()=>{var v;return(v=ie(o.placement))!=null?v:"bottom"}),c=n.computed(()=>{var v;return(v=ie(o.strategy))!=null?v:"absolute"}),s=n.computed(()=>{var v;return(v=ie(o.transform))!=null?v:!0}),d=n.computed(()=>tt(e.value)),f=n.computed(()=>tt(t.value)),p=n.ref(0),g=n.ref(0),m=n.ref(c.value),h=n.ref(l.value),b=n.shallowRef({}),w=n.ref(!1),x=n.computed(()=>{const v={position:m.value,left:"0",top:"0"};if(!f.value)return v;const A=ot(f.value,p.value),z=ot(f.value,g.value);return s.value?{...v,transform:"translate("+A+"px, "+z+"px)",...nt(f.value)>=1.5&&{willChange:"transform"}}:{position:m.value,left:A+"px",top:z+"px"}});let y;function E(){d.value==null||f.value==null||qt(d.value,f.value,{middleware:a.value,placement:l.value,strategy:c.value}).then(v=>{p.value=v.x,g.value=v.y,m.value=v.strategy,h.value=v.placement,b.value=v.middlewareData,w.value=!0})}function L(){typeof y=="function"&&(y(),y=void 0)}function k(){if(L(),i===void 0){E();return}if(d.value!=null&&f.value!=null){y=i(d.value,f.value,E);return}}function B(){r.value||(w.value=!1)}return n.watch([a,l,c],E,{flush:"sync"}),n.watch([d,f],k,{flush:"sync"}),n.watch(r,B,{flush:"sync"}),n.getCurrentScope()&&n.onScopeDispose(L),{x:n.shallowReadonly(p),y:n.shallowReadonly(g),strategy:n.shallowReadonly(m),placement:n.shallowReadonly(h),middlewareData:n.shallowReadonly(b),isPositioned:n.shallowReadonly(w),floatingStyles:x,update:E}}const Kt="data:image/svg+xml,%3csvg%20width='1324'%20height='1326'%20viewBox='0%200%201324%201326'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='141'%20y='78'%20width='1042'%20height='1170'%20fill='white'/%3e%3cpath%20d='M184.533%201.99984C135.867%207.19984%2089.8666%2029.8665%2056.4%2065.1998C29.6%2093.4665%2012.5333%20126.266%203.73329%20166.4L0.666626%20180V663.333V1146.67L3.73329%201160.27C12.5333%201200.4%2029.6%201233.2%2056.4%201261.47C90.4%201297.33%20135.333%201319.33%20185.6%201324.67C203.333%201326.53%201122.53%201326.4%201139.73%201324.53C1188.53%201319.33%201229.07%201299.73%201264.13%201264.8C1294.27%201234.67%201311.47%201202.67%201320.8%201159.33C1323.2%201148.4%201323.33%201130%201323.33%20663.333C1323.33%20196.667%201323.2%20178.266%201320.8%20167.333C1311.47%20124%201294.27%2091.9998%201264.13%2061.8664C1229.07%2026.9331%201188.53%207.33314%201139.73%202.13314C1124.67%200.399809%20200%200.399842%20184.533%201.99984ZM732.933%20151.466C746.8%20152.933%20763.333%20157.6%20774%20163.067C800.267%20176.267%20822.4%20200.4%20833.2%20227.333C841.867%20249.333%20841.467%20233.467%20841.067%20502C840.533%20777.6%20841.733%20750.267%20829.2%20776.133C822.133%20790.933%20810.667%20806.533%20800.267%20815.2C795.2%20819.6%20793.2%20822.267%20792%20827.067C786.133%20848.267%20768.667%20885.867%20755.2%20906.133C724.533%20952%20681.2%20986.133%20624%201009.33C615.6%201012.8%20608.4%201015.87%20608.133%201016.13C607.867%201016.27%20614.533%201023.33%20622.933%201031.6C633.467%201042.13%20639.333%201049.07%20642.133%201054.4C646.933%201063.87%20645.467%201064%20672.667%201050.8C724.933%201025.47%20762.933%20994.8%20794.933%20952C811.467%20929.867%20829.867%20895.333%20839.333%20868.267C841.333%20862.667%20843.467%20858%20844.133%20858C844.667%20858%20845.6%20859.333%20846.133%20860.933C848.267%20868.133%20863.333%20900.8%20870.133%20913.2C898%20963.867%20931.6%201001.2%20975.333%201030.27C989.867%201040%201017.2%201054.4%201031.6%201059.73L1037.2%201061.87L1041.33%201054.67C1048.4%201042.4%201056.67%201032.27%201067.87%201022.4L1078.67%201012.8L1071.6%201010.27C1067.87%201008.8%201060.53%201006%201055.6%201004.13C1040.93%20998.533%201013.73%20984%201000%20974.267C985.733%20964.133%20960.8%20940.667%20948.933%20926.267C935.067%20909.333%20921.467%20887.467%20910%20864C900.133%20844%20887.2%20812.133%20884.667%20801.6L883.733%20798H971.867H1060V769.333V740.667H963.333H866.533L867.333%20736.267C868.4%20729.867%20870.4%20693.067%20871.467%20662.933C872.267%20639.067%20872.533%20636.4%20874.8%20635.2C878.667%20633.2%20881.333%20626.667%20882.267%20617.333L883.067%20608.667H872.133C864.133%20608.667%20861.067%20608.133%20860.533%20606.8C860%20605.467%20881.2%20466%20886.133%20438.267L886.933%20433.867L977.867%20434.4C1066.67%20434.8%201068.93%20434.8%201079.87%20437.733C1124.8%20449.6%201158.67%20482.533%201172.93%20528L1176.67%20540V808V1076L1172.93%201087.73C1158.53%201133.6%201126.13%201164.93%201078.93%201178.4L1068.67%201181.33L812.667%201181.73C638.8%201182%20552.667%201181.73%20544.4%201180.67C488.667%201174.4%20443.2%201132.13%20432.533%201076.93C431.067%201068.93%20430.667%201046.4%20430.667%20956.667V846.133L340.4%20845.6C252.8%20845.2%20249.6%20845.067%20239.067%20842.267C196.533%20831.067%20164.533%20800.133%20151.067%20757.333L147.333%20745.333V499.333V253.333L150.4%20242C159.067%20209.067%20180.4%20181.866%20210.667%20164.933C221.2%20159.066%20240.4%20152.933%20252.667%20151.6C268.533%20149.733%20716.933%20149.6%20732.933%20151.466Z'%20fill='%233B5695'/%3e%3cpath%20d='M256.533%20213.333C232.933%20218.533%20214.133%20237.067%20209.333%20259.733C208.4%20264.533%20208%20337.2%20208.267%20502L208.667%20737.333L211.733%20744.933C218.533%20761.733%20231.733%20774.533%20248.667%20780.933L256.667%20784L490%20784.4C749.2%20784.8%20734.4%20785.333%20750.133%20776C764.267%20767.6%20775.467%20752.4%20778.667%20737.067C779.6%20732.8%20780%20652.133%20779.733%20494L779.333%20257.333L775.067%20248.267C767.2%20231.6%20756.933%20222%20740.133%20215.467L731.333%20212L498%20211.733C306.8%20211.6%20263.2%20211.867%20256.533%20213.333ZM492%20281.2C546.267%20290.267%20590.267%20311.2%20622.533%20343.333C653.867%20374.667%20671.867%20409.867%20680.267%20456.667C684.133%20478.533%20684.133%20516.267%20680.133%20538.533C665.467%20621.067%20606.933%20684.4%20524%20707.467C490%20716.933%20488.4%20716.933%20392.4%20717.6L305.333%20718.133V498V277.867L391.733%20278.4C465.733%20278.8%20480%20279.2%20492%20281.2Z'%20fill='%233B5695'/%3e%3cpath%20d='M384%20462.933V576.133L345.067%20611.467C306.533%20646.267%20306.133%20646.667%20310.667%20647.067C313.2%20647.333%20348.933%20647.333%20390%20646.933C472.667%20646.267%20477.6%20645.867%20503.6%20637.333C527.6%20629.333%20543.333%20620%20560.267%20603.6C590.133%20574.667%20604.4%20536.267%20602.267%20489.733C600.533%20450.267%20588.267%20420%20564%20395.333C546.8%20377.867%20531.6%20368.4%20506.267%20360C482.933%20352.133%20474.533%20351.2%20427.067%20350.4L384%20349.733V462.933Z'%20fill='%233B5695'/%3e%3c/svg%3e",Y=(e,t)=>{const o=e.__vccOpts||e;for(const[i,r]of t)o[i]=r;return o},Gt={name:"Logo"},Jt={src:Kt,alt:"DDict Logo",class:"w-6 h-6 cursor-pointer"};function Qt(e,t,o,i,r,a){return n.openBlock(),n.createElementBlock("img",Jt)}const en=Y(Gt,[["render",Qt]]),tn={},nn={class:"w-12 h-12 text-primary",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},on=[n.createStaticVNode('<circle cx="18" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".67" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".33" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="6" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin="0" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle>',3)];function rn(e,t){return n.openBlock(),n.createElementBlock("svg",nn,on)}const ln=Y(tn,[["render",rn]]),an={class:"rounded-lg bg-base-100 px-4 py-2 border border-base-300 shadow-lg"},sn={class:"flex justify-center"},cn={__name:"Loading",setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",an,[n.createElementVNode("div",sn,[n.createVNode(ln)])]))}},dn={name:"Phonetic",props:["phonetic"]},un={class:"p-0 m-0"},fn={class:"text-xs font-md text-base-content/60"};function mn(e,t,o,i,r,a){return n.openBlock(),n.createElementBlock("p",un,[n.createElementVNode("span",fn,"/"+n.toDisplayString(o.phonetic)+"/",1)])}const hn=Y(dn,[["render",mn]]),pn={class:"flex flex-col gap-2"},gn={__name:"Sentences",props:{sentences:{type:String,default:""}},setup(e){const t=e,o=n.computed(()=>t.sentences.split(`
|
|
2
|
-
`));return(i,r)=>(n.openBlock(),n.createElementBlock("div",
|
|
3
|
-
`))||[],(a,l)=>(n.openBlock(),n.createElementBlock("li",{key:`${a}-${l}`,innerHTML:a,class:"text-base text-base-content"},null,8,An))),128))])):n.createCommentVNode("",!0)])}}},Rn=["disabled"],Vn=[n.createElementVNode("path",{d:"M2.33325 4.66667H3.51125C3.82693 4.6667 4.13239 4.55473 4.37325 4.35067L6.83392 2.26667C6.99592 2.12953 7.19374 2.04156 7.40407 2.01312C7.61441 1.98468 7.82849 2.01696 8.02109 2.10615C8.21369 2.19534 8.37678 2.33772 8.49114 2.51652C8.60551 2.69532 8.66638 2.90309 8.66659 3.11534V12.8847C8.66649 13.097 8.60565 13.305 8.49125 13.4839C8.37685 13.6628 8.21367 13.8053 8.02094 13.8945C7.82822 13.9837 7.614 14.0159 7.40356 13.9874C7.19312 13.9588 6.99523 13.8707 6.83325 13.7333L4.37325 11.6487C4.13229 11.4449 3.82685 11.3331 3.51125 11.3333H2.33325C2.06804 11.3333 1.81368 11.228 1.62615 11.0404C1.43861 10.8529 1.33325 10.5986 1.33325 10.3333V5.66667C1.33325 5.40145 1.43861 5.1471 1.62615 4.95956C1.81368 4.77203 2.06804 4.66667 2.33325 4.66667ZM11.1779 11.18C11.5969 10.763 11.9294 10.2674 12.1562 9.72156C12.3831 9.17572 12.4999 8.59044 12.4999 7.99934C12.4999 7.40823 12.3831 6.82295 12.1562 6.27711C11.9294 5.73127 11.5969 5.23564 11.1779 4.81867C11.1317 4.77098 11.0765 4.73297 11.0155 4.70686C10.9544 4.68075 10.8888 4.66705 10.8224 4.66657C10.756 4.66609 10.6902 4.67883 10.6288 4.70406C10.5674 4.72929 10.5116 4.76649 10.4647 4.8135C10.4179 4.86051 10.3808 4.91639 10.3558 4.97787C10.3307 5.03935 10.3181 5.10521 10.3188 5.17159C10.3195 5.23798 10.3334 5.30357 10.3597 5.36453C10.3859 5.42549 10.4241 5.48061 10.4719 5.52667C10.7977 5.85079 11.0562 6.23609 11.2326 6.66043C11.409 7.08477 11.4998 7.53979 11.4998 7.99934C11.4998 8.45888 11.409 8.9139 11.2326 9.33824C11.0562 9.76258 10.7977 10.1479 10.4719 10.472C10.4241 10.5181 10.3859 10.5732 10.3597 10.6341C10.3334 10.6951 10.3195 10.7607 10.3188 10.8271C10.3181 10.8935 10.3307 10.9593 10.3558 11.0208C10.3808 11.0823 10.4179 11.1382 10.4647 11.1852C10.5116 11.2322 10.5674 11.2694 10.6288 11.2946C10.6902 11.3198 10.756 11.3326 10.8224 11.3321C10.8888 11.3316 10.9544 11.3179 11.0155 11.2918C11.0765 11.2657 11.1317 11.2277 11.1779 11.18ZM12.7113 13.2127C12.6123 13.2126 12.5157 13.1832 12.4335 13.1281C12.3513 13.0731 12.2873 12.9949 12.2495 12.9035C12.2118 12.8121 12.202 12.7115 12.2214 12.6146C12.2408 12.5176 12.2886 12.4285 12.3586 12.3587C12.9317 11.7866 13.3865 11.1071 13.6967 10.359C14.0069 9.61101 14.1666 8.80915 14.1666 7.99934C14.1666 7.18952 14.0069 6.38766 13.6967 5.63963C13.3865 4.8916 12.9317 4.2121 12.3586 3.64C12.3122 3.59351 12.2754 3.53834 12.2503 3.47764C12.2252 3.41693 12.2124 3.35188 12.2124 3.2862C12.2125 3.22052 12.2255 3.15549 12.2507 3.09483C12.2759 3.03417 12.3128 2.97907 12.3593 2.93267C12.4057 2.88627 12.4609 2.84948 12.5216 2.8244C12.5823 2.79932 12.6474 2.78645 12.7131 2.78651C12.7787 2.78657 12.8438 2.79957 12.9044 2.82476C12.9651 2.84995 13.0202 2.88685 13.0666 2.93334C13.7327 3.59825 14.2612 4.38801 14.6218 5.25741C14.9824 6.12681 15.168 7.05879 15.168 8C15.168 8.94122 14.9824 9.87319 14.6218 10.7426C14.2612 11.612 13.7327 12.4018 13.0666 13.0667C13.02 13.1134 12.9646 13.1504 12.9036 13.1756C12.8426 13.2007 12.7772 13.2129 12.7113 13.2127Z",fill:"currentColor"},null,-1)],Nn=["disabled"],In=[n.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z","clip-rule":"evenodd",fill:"currentColor"},null,-1)],_n={__name:"Player",props:{tts:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["loadTTS"],setup(e,{emit:t}){const o=e,i=t,r=n.computed(()=>o.tts),a=n.ref(!1),l=new Audio,c=new(window.AudioContext||window.webkitAudioContext);let s=null;n.watch(r,()=>{if(!r.value){a.value=!1;return}f()},{immediate:!0}),n.onUnmounted(()=>{g(),l.src="",c.close()});function d(){if(r.value){f();return}a.value=!0,i("loadTTS")}async function f(){if(r.value){a.value=!0;try{l.src=r.value,l.playbackRate=.7,await l.play(),l.onended=()=>{a.value=!1}}catch{await p()}}}async function p(){try{const h=await(await fetch(r.value)).arrayBuffer(),b=await c.decodeAudioData(h);s=c.createBufferSource(),s.buffer=b,s.playbackRate.value=.7,s.connect(c.destination),s.start(),s.onended=()=>{a.value=!1,s=null}}catch{a.value=!1}}function g(){s&&(s.stop(),s.disconnect(),s=null),l.pause(),l.currentTime=0,a.value=!1}return(m,h)=>a.value?(n.openBlock(),n.createElementBlock("button",{key:1,class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled,onClick:g},[(n.openBlock(),n.createElementBlock("svg",{class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},In,2))],10,Nn)):(n.openBlock(),n.createElementBlock("button",{key:0,class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled,onClick:d},[(n.openBlock(),n.createElementBlock("svg",{class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Vn,2))],10,Rn))}},Mn={class:"bg-base-100 tooltip tooltip-top before:!bottom-[100%] before:!bg-base-100 before:!border before:!border-solid before:!border-base-300 before:!shadow-lg before:!rounded-md before:!text-base-content after:!border-transparent","data-tip":"Favorite"},Fn=["disabled"],zn=[n.createElementVNode("path",{d:"M14.9491 5.89315C14.8278 5.53128 14.5111 5.27252 14.1226 5.21783L10.5264 4.7114L8.91813 1.55315C8.74435 1.21195 8.39257 1 7.99998 1C7.60739 1 7.25557 1.21195 7.08183 1.55315L5.47358 4.7114L1.8774 5.21783C1.48888 5.27252 1.17219 5.53128 1.05086 5.89315C0.929554 6.25501 1.02881 6.64477 1.30993 6.91038L3.91217 9.36871L3.29786 12.8399C3.2315 13.215 3.38755 13.5868 3.7052 13.8105C3.88128 13.9344 4.08938 14 4.30704 14C4.47232 14 4.63705 13.9606 4.78341 13.886L7.99995 12.2471L11.2165 13.886C11.3628 13.9606 11.5276 14 11.6929 14C11.9106 14 12.1187 13.9345 12.2948 13.8105C12.6124 13.5868 12.7685 13.215 12.7021 12.84L12.0878 9.36871L14.6901 6.91035C14.9712 6.64477 15.0704 6.25498 14.9491 5.89315ZM14.0266 6.25082L11.2455 8.87813C11.1335 8.98392 11.0824 9.13637 11.1089 9.28575L11.7654 12.9956C11.7701 13.0226 11.759 13.0493 11.7362 13.0653C11.7202 13.0766 11.7038 13.079 11.6929 13.079C11.6809 13.079 11.6694 13.0762 11.6587 13.0708L8.22108 11.3192C8.15189 11.284 8.07593 11.2663 7.99998 11.2663C7.92402 11.2663 7.84807 11.284 7.77882 11.3193L4.34118 13.0708C4.33052 13.0763 4.31904 13.079 4.30701 13.079C4.29611 13.079 4.27969 13.0767 4.26373 13.0654C4.24092 13.0494 4.22975 13.0226 4.2345 12.9957L4.89104 9.28584C4.91747 9.13646 4.86637 8.98401 4.75439 8.87822L1.97327 6.25091C1.95308 6.23184 1.94595 6.20383 1.95466 6.17786C1.9634 6.15185 1.98612 6.13326 2.01405 6.12933L5.85743 5.58807C6.0122 5.56626 6.14599 5.47208 6.21521 5.33616L7.93404 1.9608C7.94653 1.9363 7.97178 1.92107 7.99998 1.92107C8.02818 1.92107 8.05343 1.9363 8.06591 1.9608L9.78468 5.33607C9.85391 5.47199 9.9877 5.5662 10.1425 5.58799L13.9859 6.12924C14.0138 6.1332 14.0365 6.15176 14.0452 6.17777C14.0539 6.20374 14.0468 6.23175 14.0266 6.25082Z",fill:"currentColor"},null,-1)],Dn=[n.createElementVNode("path",{d:"M7.47207 1.31905C7.57125 1.12371 7.77589 1 8.00001 1C8.22413 1 8.42877 1.12367 8.52795 1.31905L10.3721 4.95175L14.4959 5.53427C14.7177 5.5656 14.9019 5.7166 14.9712 5.9238C15.0404 6.13101 14.9827 6.35843 14.8222 6.51049L11.8382 9.33816L12.5427 13.3309C12.5806 13.5456 12.4897 13.7626 12.3084 13.8906C12.1272 14.0187 11.8868 14.0356 11.6884 13.9342L8.00004 12.0491L4.31158 13.9343C4.11323 14.0356 3.87286 14.0187 3.69157 13.8907C3.51028 13.7627 3.4195 13.5457 3.45736 13.3309L4.1618 9.33819L1.17781 6.51052C1.01735 6.35846 0.959571 6.13101 1.02884 5.92383C1.09807 5.71663 1.28232 5.56563 1.50409 5.53431L5.62787 4.95178L7.47207 1.31905Z",fill:"currentColor"},null,-1)],On={__name:"Favorite",props:{isFilled:Boolean,disabled:Boolean},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",Mn,[n.createElementVNode("button",{class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled},[e.isFilled?(n.openBlock(),n.createElementBlock("svg",{key:1,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Dn,2)):(n.openBlock(),n.createElementBlock("svg",{key:0,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},zn,2))],10,Fn)]))}},Wn={},Pn={class:"w-6 h-6 text-primary",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Hn=[n.createStaticVNode('<circle cx="18" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".67" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".33" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="6" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin="0" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle>',3)];function Un(e,t){return n.openBlock(),n.createElementBlock("svg",Pn,Hn)}const Ae=Y(Wn,[["render",Un]]),jn={class:"bg-base-100 tooltip tooltip-top before:!bottom-[100%] before:!bg-base-100 before:!border before:!border-solid before:!border-base-300 before:!shadow-lg before:!rounded-md before:!text-base-content after:!border-transparent","data-tip":"AI Translate"},Zn=["disabled"],qn=[n.createElementVNode("path",{d:"M6.8544 3.20309C5.39975 2.89815 4.26277 1.76117 3.95787 0.30649C3.92042 0.12792 3.76292 0 3.58041 0C3.3979 0 3.2404 0.12792 3.20297 0.30652C2.89805 1.76117 1.76107 2.89812 0.306418 3.20302C0.127818 3.24045 -0.00012207 3.39798 -0.00012207 3.58046C-0.00012207 3.76295 0.127798 3.92047 0.306418 3.9579C1.76105 4.26285 2.89798 5.3998 3.2029 6.85448C3.24033 7.03307 3.39783 7.16102 3.58034 7.16102C3.76282 7.16102 3.92035 7.0331 3.95778 6.85448C4.26272 5.39983 5.39973 4.26287 6.85438 3.95799C7.03297 3.92056 7.16092 3.76306 7.16092 3.58056C7.1609 3.39805 7.03297 3.24052 6.8544 3.20309ZM3.58036 5.60938C3.14292 4.73132 2.42956 4.01792 1.55151 3.58049C2.42958 3.14305 3.14297 2.42968 3.58041 1.55161C4.01785 2.4297 4.73122 3.14307 5.60926 3.58053C4.73119 4.01797 4.0178 4.73132 3.58036 5.60938Z",fill:"currentColor"},null,-1),n.createElementVNode("path",{d:"M6.21683 9.574C5.53147 9.4303 4.99578 8.8947 4.85209 8.2093C4.81466 8.0307 4.65716 7.90271 4.47465 7.90271C4.29217 7.90271 4.13464 8.0306 4.09721 8.2092C3.95352 8.8946 3.4178 9.4303 2.73244 9.574C2.55385 9.6114 2.4259 9.7689 2.4259 9.9514C2.4259 10.1339 2.55383 10.2914 2.73244 10.3288C3.41778 10.4725 3.95349 11.0082 4.09716 11.6936C4.13459 11.8722 4.2921 12.0002 4.4746 12.0002C4.65709 12.0002 4.81461 11.8723 4.85204 11.6936C4.99574 11.0082 5.53145 10.4725 6.21683 10.3289C6.39543 10.2914 6.52337 10.1339 6.52337 9.9514C6.52337 9.7689 6.39545 9.6114 6.21683 9.574ZM4.47463 10.6408C4.29163 10.3688 4.05725 10.1345 3.78526 9.9515C4.0573 9.7684 4.29163 9.5341 4.47463 9.2621C4.65765 9.5341 4.892 9.7685 5.164 9.9515C4.892 10.1345 4.65763 10.3688 4.47463 10.6408Z",fill:"currentColor"},null,-1),n.createElementVNode("path",{d:"M11.4271 6.00324C10.5007 5.80904 9.7766 5.08496 9.5825 4.15859C9.545 3.98 9.3875 3.85205 9.205 3.85205C9.0225 3.85205 8.865 3.97995 8.8276 4.15857C8.6334 5.08496 7.90932 5.80902 6.98293 6.0032C6.80434 6.04063 6.67639 6.19815 6.67639 6.38064C6.67639 6.56312 6.80431 6.72062 6.98293 6.75807C7.9093 6.95228 8.6334 7.67633 8.8275 8.6027C8.865 8.7813 9.0225 8.9093 9.205 8.9093C9.3875 8.9093 9.545 8.7814 9.5824 8.6027C9.7766 7.67633 10.5007 6.95228 11.4271 6.75812C11.6057 6.72067 11.7336 6.56317 11.7336 6.38068C11.7336 6.1982 11.6057 6.04067 11.4271 6.00324ZM9.205 7.47681C8.9365 7.02634 8.5593 6.64914 8.1089 6.38066C8.5593 6.11218 8.9365 5.73502 9.205 5.28453C9.4735 5.73502 9.8507 6.11221 10.3012 6.38068C9.8507 6.64916 9.4735 7.02636 9.205 7.47681Z",fill:"currentColor"},null,-1)],Xn=[n.createStaticVNode('<path d="M6.8544 3.20309C5.39975 2.89815 4.26277 1.76117 3.95787 0.30649C3.92042 0.12792 3.76292 0 3.58041 0C3.3979 0 3.2404 0.12792 3.20297 0.30652C2.89805 1.76117 1.76107 2.89812 0.306418 3.20302C0.127818 3.24045 -0.00012207 3.39798 -0.00012207 3.58046C-0.00012207 3.76295 0.127798 3.92047 0.306418 3.9579C1.76105 4.26285 2.89798 5.3998 3.2029 6.85448C3.24033 7.03307 3.39783 7.16102 3.58034 7.16102C3.76282 7.16102 3.92035 7.0331 3.95778 6.85448C4.26272 5.39983 5.39973 4.26287 6.85438 3.95799C7.03297 3.92056 7.16092 3.76306 7.16092 3.58056C7.1609 3.39805 7.03297 3.24052 6.8544 3.20309ZM3.58036 5.60938C3.14292 4.73132 2.42956 4.01792 1.55151 3.58049C2.42958 3.14305 3.14297 2.42968 3.58041 1.55161C4.01785 2.4297 4.73122 3.14307 5.60926 3.58053C4.73119 4.01797 4.0178 4.73132 3.58036 5.60938Z" fill="currentColor"></path><path d="M6.21683 9.574C5.53147 9.4303 4.99578 8.8947 4.85209 8.2093C4.81466 8.0307 4.65716 7.90271 4.47465 7.90271C4.29217 7.90271 4.13464 8.0306 4.09721 8.2092C3.95352 8.8946 3.4178 9.4303 2.73244 9.574C2.55385 9.6114 2.4259 9.7689 2.4259 9.9514C2.4259 10.1339 2.55383 10.2914 2.73244 10.3288C3.41778 10.4725 3.95349 11.0082 4.09716 11.6936C4.13459 11.8722 4.2921 12.0002 4.4746 12.0002C4.65709 12.0002 4.81461 11.8723 4.85204 11.6936C4.99574 11.0082 5.53145 10.4725 6.21683 10.3289C6.39543 10.2914 6.52337 10.1339 6.52337 9.9514C6.52337 9.7689 6.39545 9.6114 6.21683 9.574ZM4.47463 10.6408C4.29163 10.3688 4.05725 10.1345 3.78526 9.9515C4.0573 9.7684 4.29163 9.5341 4.47463 9.2621C4.65765 9.5341 4.892 9.7685 5.164 9.9515C4.892 10.1345 4.65763 10.3688 4.47463 10.6408Z" fill="currentColor"></path><path d="M11.4271 6.00324C10.5007 5.80904 9.7766 5.08496 9.5825 4.15859C9.545 3.98 9.3875 3.85205 9.205 3.85205C9.0225 3.85205 8.865 3.97995 8.8276 4.15857C8.6334 5.08496 7.90932 5.80902 6.98293 6.0032C6.80434 6.04063 6.67639 6.19815 6.67639 6.38064C6.67639 6.56312 6.80431 6.72062 6.98293 6.75807C7.9093 6.95228 8.6334 7.67633 8.8275 8.6027C8.865 8.7813 9.0225 8.9093 9.205 8.9093C9.3875 8.9093 9.545 8.7814 9.5824 8.6027C9.7766 7.67633 10.5007 6.95228 11.4271 6.75812C11.6057 6.72067 11.7336 6.56317 11.7336 6.38068C11.7336 6.1982 11.6057 6.04067 11.4271 6.00324ZM9.205 7.47681C8.9365 7.02634 8.5593 6.64914 8.1089 6.38066C8.5593 6.11218 8.9365 5.73502 9.205 5.28453C9.4735 5.73502 9.8507 6.11221 10.3012 6.38068C9.8507 6.64916 9.4735 7.02636 9.205 7.47681Z" fill="currentColor"></path><circle cx="3.5" cy="3.5" r="1.5" fill="currentColor"></circle><ellipse cx="4.5" cy="10" rx="0.5" ry="1" fill="currentColor"></ellipse><circle cx="9" cy="6" r="1" fill="currentColor"></circle>',6)],Yn={__name:"AITranslateBtn",props:{isLoading:Boolean,disabled:Boolean,isFilled:Boolean},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",jn,[e.isLoading?(n.openBlock(),n.createBlock(Ae,{key:0,class:"inset-0 flex items-center justify-center"})):(n.openBlock(),n.createElementBlock("button",{key:1,class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled},[e.isFilled?(n.openBlock(),n.createElementBlock("svg",{key:1,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Xn,2)):(n.openBlock(),n.createElementBlock("svg",{key:0,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qn,2))],10,Zn))]))}},Kn={class:"bg-base-100 tooltip tooltip-top before:!bottom-[100%] before:!bg-base-100 before:!border before:!border-solid before:!border-base-300 before:!shadow-lg before:!rounded-md before:!text-base-content after:!border-transparent","data-tip":"AI Summarize"},Gn=["disabled"],Jn=[n.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12h1m-3.5-6.5 1-1M12 3V2M5.5 5.5l-1-1M3 12H2m8 10h4m3-10a5 5 0 1 0-7 4.584V19h4v-2.416A5.001 5.001 0 0 0 17 12z"},null,-1)],Qn=[n.createElementVNode("path",{fill:"currentColor",d:"M12 7a5 5 0 0 0-2 9.584V19h4v-2.416A5.001 5.001 0 0 0 12 7z"},null,-1),n.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12h1m-3.5-6.5 1-1M12 3V2M5.5 5.5l-1-1M3 12H2m8 10h4m3-10a5 5 0 1 0-7 4.584V19h4v-2.416A5.001 5.001 0 0 0 17 12z"},null,-1)],eo={__name:"AIExplainBtn",props:{isLoading:Boolean,disabled:Boolean,isFilled:Boolean},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",Kn,[e.isLoading?(n.openBlock(),n.createBlock(Ae,{key:0})):(n.openBlock(),n.createElementBlock("button",{key:1,class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled},[e.isFilled?(n.openBlock(),n.createElementBlock("svg",{key:1,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Qn,2)):(n.openBlock(),n.createElementBlock("svg",{key:0,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Jn,2))],10,Gn))]))}},to={},no={class:"btn btn-xs btn-ghost btn-circle"},oo=[n.createElementVNode("svg",{class:"w-4 h-4 text-primary",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{d:"M9.12596 1.63869C9.46935 1.54364 9.83221 1.70329 9.99413 2.02068C10.3672 2.75191 11.1261 3.25 12 3.25C12.8739 3.25 13.6328 2.75191 14.0059 2.02068C14.1678 1.70329 14.5307 1.54364 14.874 1.63869C16.5585 2.10497 18.0759 2.9704 19.3184 4.12574C19.5611 4.35137 19.6269 4.70948 19.4804 5.00666C19.3331 5.30535 19.25 5.6419 19.25 6C19.25 7.24263 20.2574 8.25 21.5 8.25L21.5314 8.24977C21.8629 8.24504 22.1583 8.45859 22.2576 8.77495C22.5777 9.79397 22.75 10.8776 22.75 12C22.75 12.7408 22.6749 13.4649 22.5318 14.1648C22.4548 14.5411 22.1059 14.7985 21.7237 14.7609C21.6504 14.7537 21.5758 14.75 21.5 14.75C20.2574 14.75 19.25 15.7574 19.25 17C19.25 17.5531 19.4486 18.0579 19.7793 18.4498C20.027 18.7434 20.0128 19.1767 19.7465 19.4535C18.4777 20.7719 16.8745 21.7678 15.0721 22.3044C14.6807 22.4209 14.2681 22.2029 14.1437 21.814C13.8535 20.906 13.0024 20.25 12 20.25C10.9976 20.25 10.1465 20.906 9.85629 21.814C9.73195 22.2029 9.31927 22.4209 8.92789 22.3044C7.12545 21.7678 5.52229 20.7719 4.25353 19.4535C3.98716 19.1767 3.97299 18.7434 4.22072 18.4498C4.55139 18.0579 4.75 17.5531 4.75 17C4.75 15.7574 3.74264 14.75 2.5 14.75C2.42423 14.75 2.34963 14.7537 2.27634 14.7609C1.89406 14.7985 1.54519 14.5411 1.46821 14.1648C1.32505 13.4649 1.25 12.7408 1.25 12C1.25 10.8776 1.42227 9.79398 1.74236 8.77494C1.84173 8.45859 2.13705 8.24504 2.4686 8.24977L2.5 8.25C3.74264 8.25 4.75 7.24263 4.75 6C4.75 5.6419 4.66689 5.30535 4.51962 5.00666C4.3731 4.70948 4.43894 4.35137 4.68159 4.12574C5.92411 2.9704 7.44153 2.10497 9.12596 1.63869ZM6.08277 4.88991C6.19152 5.24123 6.25 5.61424 6.25 6C6.25 7.88945 4.85261 9.45253 3.03493 9.71213C2.84898 10.4432 2.75 11.2096 2.75 12C2.75 12.4294 2.77921 12.8516 2.83567 13.2648C4.74948 13.4346 6.25 15.0421 6.25 17C6.25 17.6669 6.0754 18.2941 5.76971 18.8372C6.62645 19.6184 7.63002 20.2404 8.73362 20.657C9.37706 19.5189 10.598 18.75 12 18.75C13.402 18.75 14.6229 19.5189 15.2664 20.657C16.37 20.2404 17.3735 19.6184 18.2303 18.8372C17.9246 18.2941 17.75 17.6669 17.75 17C17.75 15.0421 19.2505 13.4346 21.1643 13.2648C21.2208 12.8516 21.25 12.4294 21.25 12C21.25 11.2096 21.151 10.4432 20.9651 9.71213C19.1474 9.45252 17.75 7.88945 17.75 6C17.75 5.61424 17.8085 5.24123 17.9172 4.88991C17.0618 4.1771 16.0762 3.61614 15.0018 3.24775C14.3184 4.15897 13.2287 4.75 12 4.75C10.7713 4.75 9.68158 4.15897 8.99819 3.24775C7.92382 3.61614 6.93823 4.1771 6.08277 4.88991Z",fill:"currentColor"}),n.createElementVNode("path",{d:"M7.75 12C7.75 9.65278 9.65279 7.75 12 7.75C14.3472 7.75 16.25 9.65278 16.25 12C16.25 14.3472 14.3472 16.25 12 16.25C9.65279 16.25 7.75 14.3472 7.75 12ZM12 9.25C10.4812 9.25 9.25 10.4812 9.25 12C9.25 13.5188 10.4812 14.75 12 14.75C13.5188 14.75 14.75 13.5188 14.75 12C14.75 10.4812 13.5188 9.25 12 9.25Z",fill:"currentColor"})],-1)];function io(e,t){return n.openBlock(),n.createElementBlock("button",no,oo)}const ro=Y(to,[["render",io]]),lo={},ao={class:"btn btn-xs btn-circle btn-ghost"},so=[n.createElementVNode("svg",{class:"w-4 h-4 text-primary",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.19102 3.19102C3.44571 2.93633 3.85864 2.93633 4.11333 3.19102L12.809 11.8867C13.0637 12.1414 13.0637 12.5543 12.809 12.809C12.5543 13.0637 12.1414 13.0637 11.8867 12.809L3.19102 4.11333C2.93633 3.85864 2.93633 3.44571 3.19102 3.19102Z",fill:"currentColor"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.809 3.19102C13.0637 3.44571 13.0637 3.85864 12.809 4.11333L4.11333 12.809C3.85864 13.0637 3.44571 13.0637 3.19102 12.809C2.93633 12.5543 2.93633 12.1414 3.19102 11.8867L11.8867 3.19102C12.1414 2.93633 12.5543 2.93633 12.809 3.19102Z",fill:"currentColor"})],-1)];function co(e,t){return n.openBlock(),n.createElementBlock("button",ao,so)}const uo=Y(lo,[["render",co]]),fo={name:"ThemeSelector",props:{currentTheme:{type:String,default:"lofi"}},data(){return{availableThemes:[{value:"lofi",name:"Lo-Fi",color:"#0f0f23"},{value:"pastel",name:"Pastel",color:"#d1c1d7"},{value:"fantasy",name:"Fantasy",color:"#6e0b75"},{value:"autumn",name:"Autumn",color:"#8c0327"},{value:"retro",name:"Retro",color:"#ef9995"},{value:"synthwave",name:"Synthwave",color:"#e779c1"},{value:"halloween",name:"Halloween",color:"#f28c18"},{value:"dracula",name:"Dracula",color:"#ff79c6"},{value:"coffee",name:"Coffee",color:"#db924b"},{value:"dim",name:"Dim",color:"#9fe88d"},{value:"sunset",name:"Sunset",color:"#ff865b"},{value:"cyberpunk",name:"Cyberpunk",color:"#ff7598"}]}},methods:{handleThemeChange(e){this.$emit("themeChange",e)},handleLabelClick(e){e.stopPropagation(),this.$nextTick(()=>{const t=this.$el.querySelector('[role="button"]');t&&t.blur()})}}},mo={class:"dropdown dropdown-end z-50"},ho=n.createElementVNode("div",{tabindex:"0",role:"button",class:"btn btn-ghost btn-circle btn-xs"},[n.createElementVNode("svg",{class:"w-4 h-4 text-primary",fill:"currentColor",viewBox:"0 0 20 20"},[n.createElementVNode("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})])],-1),po={tabindex:"0",class:"dropdown-content menu p-2 shadow bg-base-100 rounded-box w-52 max-h-96 overflow-y-auto z-50 border border-base-300"},go=["id","value","checked","onChange"],Co=["for"],bo={class:"flex items-center gap-2"};function wo(e,t,o,i,r,a){return n.openBlock(),n.createElementBlock("div",mo,[ho,n.createElementVNode("ul",po,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.availableThemes,l=>(n.openBlock(),n.createElementBlock("li",{key:l.value},[n.createElementVNode("input",{type:"radio",id:`theme-${l.value}`,value:l.value,checked:o.currentTheme===l.value,onChange:c=>a.handleThemeChange(l.value),class:"theme-controller sr-only"},null,40,go),n.createElementVNode("label",{for:`theme-${l.value}`,class:n.normalizeClass(["cursor-pointer rounded-lg px-2 py-1 hover:bg-base-200",{"bg-primary text-primary-content":o.currentTheme===l.value}]),onClick:t[0]||(t[0]=(...c)=>a.handleLabelClick&&a.handleLabelClick(...c))},[n.createElementVNode("span",bo,[n.createElementVNode("span",{class:"w-3 h-3 rounded-full",style:n.normalizeStyle({backgroundColor:l.color})},null,4),n.createTextVNode(" "+n.toDisplayString(l.name),1)])],10,Co)]))),128))])])}const yo=Y(fo,[["render",wo]]),xo={class:"flex flex-col"},Eo={class:"flex min-w-0 gap-1","data-mode-toggle":""},ko=["disabled"],vo={class:"flex shrink-0 items-center"},Lo={key:0,class:"flex items-center gap-1 px-2 pb-1"},it={__name:"Header",props:{tts:String,isServiceUnavailable:Boolean,isFavorite:Boolean,isFavoriteFeatureEnabled:Boolean,isAITranslate:Boolean,isAIExplain:Boolean,isAITranslationLoading:Boolean,isAIExplainLoading:Boolean,isAIExplainVisible:Boolean,isAITranslateVisible:Boolean,theme:{type:String,default:"lofi"},showThemeSelector:{type:Boolean,default:!0},mode:{type:String,default:"translate"},canWrite:{type:Boolean,default:!0}},emits:["favorite","setting","close","loadTTS","aiTranslate","aiExplain","themeChange","dragStart","requestTranslate","requestWrite"],setup(e,{emit:t}){const o=e,i=n.computed(()=>o.mode!=="write"&&!o.isServiceUnavailable),r=t,a=c=>{c.target.closest('button, input, select, textarea, [role="button"]')||(r("dragStart",{type:"mouse",event:c}),c.preventDefault())},l=c=>{c.target.closest('button, input, select, textarea, [role="button"]')||(r("dragStart",{type:"touch",event:c}),c.preventDefault())};return(c,s)=>(n.openBlock(),n.createElementBlock("div",xo,[n.createElementVNode("div",{class:"flex cursor-grab flex-row items-center justify-between gap-1 p-2 pb-1 active:cursor-grabbing",onMousedown:a,onTouchstart:l},[n.createElementVNode("div",Eo,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["btn btn-xs",e.mode==="write"?"btn-ghost":"btn-primary"]),"data-mode":"translate",onClick:s[0]||(s[0]=d=>r("requestTranslate"))}," Translate ",2),n.createElementVNode("button",{type:"button",class:n.normalizeClass(["btn btn-xs",e.mode==="write"?"btn-primary":"btn-ghost"]),disabled:!e.canWrite,"data-mode":"write",onClick:s[1]||(s[1]=d=>r("requestWrite"))}," Write ",10,ko)]),n.createElementVNode("div",vo,[e.showThemeSelector?(n.openBlock(),n.createBlock(yo,{key:0,"current-theme":e.theme,onThemeChange:s[2]||(s[2]=d=>r("themeChange",d))},null,8,["current-theme"])):n.createCommentVNode("",!0),n.createVNode(ro,{onClick:s[3]||(s[3]=d=>r("setting"))}),n.createVNode(uo,{onClick:s[4]||(s[4]=d=>r("close"))})])],32),i.value?(n.openBlock(),n.createElementBlock("div",Lo,[n.createVNode(_n,{disabled:e.isAITranslationLoading||e.isAIExplainLoading,tts:o.tts,onLoadTTS:s[5]||(s[5]=d=>c.$emit("loadTTS"))},null,8,["disabled","tts"]),e.isAITranslateVisible?(n.openBlock(),n.createBlock(Yn,{key:0,isLoading:e.isAITranslationLoading,isFilled:e.isAITranslate,onClick:s[6]||(s[6]=d=>r("aiTranslate"))},null,8,["isLoading","isFilled"])):n.createCommentVNode("",!0),e.isAIExplainVisible?(n.openBlock(),n.createBlock(eo,{key:1,isLoading:e.isAIExplainLoading,isFilled:e.isAIExplain,onClick:s[7]||(s[7]=d=>r("aiExplain"))},null,8,["isLoading","isFilled"])):n.createCommentVNode("",!0),o.isFavoriteFeatureEnabled?(n.openBlock(),n.createBlock(On,{key:2,isFilled:o.isFavorite,onClick:s[8]||(s[8]=d=>r("favorite")),disabled:e.isAITranslationLoading||e.isAIExplainLoading},null,8,["isFilled","disabled"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]))}},So={class:"pointer-events-none absolute inset-0 z-20"},Bo=["data-resize","aria-label","onPointerdown"],To={__name:"ResizeHandle",emits:["resizeStart"],setup(e,{emit:t}){const o=t,i=[{name:"n",class:"inset-x-3 top-0 h-2 cursor-ns-resize"},{name:"s",class:"inset-x-3 bottom-0 h-2 cursor-ns-resize"},{name:"e",class:"inset-y-3 right-0 w-2 cursor-ew-resize"},{name:"w",class:"inset-y-3 left-0 w-2 cursor-ew-resize"},{name:"nw",class:"left-0 top-0 h-3 w-3 cursor-nwse-resize"},{name:"ne",class:"right-0 top-0 h-3 w-3 cursor-nesw-resize"},{name:"sw",class:"bottom-0 left-0 h-3 w-3 cursor-nesw-resize"},{name:"se",class:"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"}],r=(a,l)=>{var c,s;l.pointerType==="mouse"&&l.button!==0||(l.preventDefault(),l.stopPropagation(),(s=(c=l.currentTarget).setPointerCapture)==null||s.call(c,l.pointerId),o("resizeStart",{edge:a,event:l}))};return(a,l)=>(n.openBlock(),n.createElementBlock("div",So,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(i,c=>n.createElementVNode("div",{key:c.name,"data-resize":c.name,class:n.normalizeClass(["pointer-events-auto absolute touch-none hover:bg-base-content/20",c.class]),"aria-label":`Resize from the ${c.name} border`,onPointerdown:s=>r(c.name,s),onClick:l[0]||(l[0]=n.withModifiers(()=>{},["stop"]))},null,42,Bo)),64))]))}},$e=4,be="check",Ao=[{value:"check",label:"Check"},{value:"improve",label:"Improve"},{value:"improve-plus",label:"Academy"},{value:"friendly",label:"Friendly"},{value:"simplify",label:"Simplify"},{value:"more-detailed",label:"More detailed"}],$o=new Set(["","text","search","email","url","tel"]),Ro=4e4;function rt(e,t){return!!e&&String(t||"").trim().length>=$e}function Vo(e){const t=(e==null?void 0:e.nodeType)===3?e.parentElement:e;if(!t||t.nodeType!==1)return!1;if(No(t))return!0;if(t.disabled||t.readOnly)return!1;const o=t.tagName;return o==="TEXTAREA"?!0:o==="INPUT"?$o.has((t.type||"text").toLowerCase()):!1}function No(e){var o;let t=e;for(;t&&t.nodeType===1;){const i=(o=t.getAttribute)==null?void 0:o.call(t,"contenteditable"),r=typeof t.contentEditable=="string"?t.contentEditable:"";if(i==="false"||r==="false")return!1;if(t.isContentEditable||i===""||i==="true"||i==="plaintext-only"||r==="true"||r==="plaintext-only")return!0;t=t.parentElement}return!1}function Io(e,t){const o=lt(e),i=lt(t);return!o.length&&!i.length?[]:o.length*i.length>Ro?[{value:String(t||""),added:!1,removed:!1}]:zo(o,i,Fo(o,i))}function _o(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Mo(e,t){return Io(e,t).map(o=>{const i=_o(o.value);return o.added?`<span class="bg-success/40">${i}</span>`:o.removed?`<span class="bg-error/30 line-through">${i}</span>`:i}).join("")}function lt(e){return String(e||"").split(/(\s+)/).filter(t=>t.length)}function Fo(e,t){const o=Array.from({length:e.length+1},()=>new Array(t.length+1).fill(0));for(let i=e.length-1;i>=0;i--)for(let r=t.length-1;r>=0;r--)o[i][r]=e[i]===t[r]?o[i+1][r+1]+1:Math.max(o[i+1][r],o[i][r+1]);return o}function zo(e,t,o){const i=[];let r=0,a=0;const l=(c,s,d)=>{const f=i[i.length-1];if(f&&f.added===s&&f.removed===d){f.value+=c;return}i.push({value:c,added:s,removed:d})};for(;r<e.length&&a<t.length;)e[r]===t[a]?(l(e[r],!1,!1),r+=1,a+=1):o[r+1][a]>=o[r][a+1]?(l(e[r],!1,!0),r+=1):(l(t[a],!0,!1),a+=1);for(;r<e.length;)l(e[r],!1,!0),r+=1;for(;a<t.length;)l(t[a],!0,!1),a+=1;return i}const Do={class:"flex flex-col gap-2 border-t border-base-300 p-3","data-write-view":""},Oo={class:"flex items-center gap-1"},Wo=["value","disabled"],Po=["value"],Ho=["disabled"],Uo=["disabled"],jo={key:0,"data-write-loading":""},Zo={key:1,class:"text-sm"},qo=["innerHTML"],Xo={key:3,class:"whitespace-pre-wrap break-words text-sm","data-result":""},Yo={__name:"WriteView",props:{text:{type:String,default:""},result:{type:String,default:""},action:{type:String,default:"check"},loading:Boolean,editable:Boolean,unavailable:Boolean},emits:["action","copy","replace"],setup(e,{emit:t}){const o=e,i=t,r=n.computed(()=>o.text.trim().length<$e),a=n.computed(()=>!o.loading&&!!o.result),l=n.computed(()=>o.editable&&a.value),c=n.computed(()=>o.action==="check"&&!!o.result),s=n.computed(()=>c.value?Mo(o.text,o.result):"");function d(){a.value&&i("copy",o.result)}function f(){l.value&&i("replace",{text:o.text,result:o.result})}return(p,g)=>(n.openBlock(),n.createElementBlock("div",Do,[n.createElementVNode("div",Oo,[n.createElementVNode("select",{class:"select select-bordered select-xs min-w-0 flex-1",value:e.action,disabled:e.loading||r.value,"data-write-action":"",onChange:g[0]||(g[0]=m=>i("action",m.target.value))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Ao),m=>(n.openBlock(),n.createElementBlock("option",{key:m.value,value:m.value},n.toDisplayString(m.label),9,Po))),128))],40,Wo),n.createElementVNode("button",{type:"button",class:"btn btn-xs",disabled:!a.value,"data-copy":"",onClick:d}," Copy ",8,Ho),n.createElementVNode("button",{type:"button",class:"btn btn-xs btn-primary",disabled:!l.value,"data-replace":"",onClick:f}," Replace ",8,Uo)]),e.loading?(n.openBlock(),n.createElementBlock("div",jo,[n.createVNode(Ae)])):e.unavailable?(n.openBlock(),n.createElementBlock("p",Zo,"Service Unavailable")):c.value?(n.openBlock(),n.createElementBlock("pre",{key:2,class:"m-0 whitespace-pre-wrap break-words font-sans text-sm","data-diff":"",innerHTML:s.value},null,8,qo)):e.result?(n.openBlock(),n.createElementBlock("p",Xo,n.toDisplayString(e.result),1)):n.createCommentVNode("",!0)]))}},F={LOGO:"LOGO",LOADING:"LOADING",DATA:"DATA",ERROR:"ERROR",HIDDEN:"HIDDEN"},Ko=320,Go=240,Jo=250,Qo=120,ei=8,ti=["ar","fa","iw","yi","ur","pa"],ni={key:0,class:"flex justify-center"},oi={key:1,class:"flex justify-center"},ii={class:"p-3 border-t border-base-300"},ri=Object.assign({name:"Bubble",props:["translation","explanation","tts","status","isFavorite","isFavoriteFeatureEnabled","isAITranslate","isAIExplain","aiExplainMinLength","theme","showThemeSelector","constrained","mode","editable","writing","writeAction","isWriteLoading","selectedText"],emits:["logo","favorite","settings","close","loadTTS","aiTranslate","aiExplain","learn","themeChange","dragStart","resizeStart","write","replace","copy"],data(){return{data:null,isLongSentence:!1,isServiceUnavailable:!1,isAITranslationLoading:!1,isAIExplainLoading:!1}},computed:{showAIPrompt(){var e,t,o;return!this.isAITranslate&&!this.isServiceUnavailable&&((t=(e=this.data)==null?void 0:e.dictionary)==null?void 0:t.length)===0&&!!((o=this.data)!=null&&o.result)},showAIExplainPrompt(){var e,t,o,i,r;return!this.isAIExplain&&!this.isServiceUnavailable&&((t=(e=this.data)==null?void 0:e.dictionary)==null?void 0:t.length)===0&&!!((o=this.data)!=null&&o.result)&&((r=(i=this.data)==null?void 0:i.text)==null?void 0:r.length)>=this.aiExplainMinLength},showLearnPrompt(){var e;return this.isFavorite&&!this.isServiceUnavailable&&!!((e=this.data)!=null&&e.result)},isWrite(){return this.mode==="write"},currentAction(){var e;return this.writeAction||((e=this.writing)==null?void 0:e.action)||be},activeText(){var e,t;return this.selectedText||((e=this.writing)==null?void 0:e.text)||((t=this.data)==null?void 0:t.text)||""},canWrite(){return this.activeText.trim().length>=$e},shownResult(){var e;return!((e=this.writing)!=null&&e.result)||this.selectedText&&this.writing.text&&this.writing.text!==this.selectedText?"":this.writing.result}},methods:{handleLogo(){if(rt(this.editable,this.selectedText)){this.$emit("write",{text:this.selectedText,action:this.currentAction});return}this.$emit("logo")},requestWrite(){this.isWrite||!this.canWrite||this.$emit("write",{text:this.activeText,action:this.currentAction})},requestTranslate(){this.isWrite&&this.$emit("logo")},handleWriteAction(e){!this.canWrite||e===this.currentAction||this.$emit("write",{text:this.activeText,action:e})},handleCopy(e){this.$emit("copy",e)},handleReplace(e){this.editable&&this.$emit("replace",e)},handleAITranslate(){this.isAITranslationLoading=!0,this.$emit("aiTranslate")},handleAIExplain(){this.isAIExplainLoading=!0,this.$emit("aiExplain")},handleLearn(){var e,t,o;this.$emit("learn",{word:(e=this.data)==null?void 0:e.text,translation:(t=this.data)==null?void 0:t.result,dictionary:(o=this.data)==null?void 0:o.dictionary})}},watch:{translation:{handler(){var e,t,o,i;try{this.data=this.translation,this.isLongSentence=!((t=(e=this.data)==null?void 0:e.phonetic)!=null&&t.src||((i=(o=this.data)==null?void 0:o.dictionary)==null?void 0:i.length)>0),this.isServiceUnavailable=!1}catch{this.isServiceUnavailable=!0}finally{this.isAITranslationLoading=!1,this.isAIExplainLoading=!1}},immediate:!0},explanation:{handler(){this.isAIExplainLoading=!1},immediate:!0},status(){this.status===F.ERROR&&(this.isServiceUnavailable=!0)}}},{setup(e){return(t,o)=>{var i,r,a,l,c,s,d,f,p,g,m;return e.status===n.unref(F).LOGO?(n.openBlock(),n.createElementBlock("div",ni,[n.createVNode(en,{onClick:t.handleLogo},null,8,["onClick"])])):e.status===n.unref(F).LOADING?(n.openBlock(),n.createElementBlock("div",oi,[n.createVNode(cn)])):e.status!==n.unref(F).HIDDEN?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["wrapper rounded-lg text-base-content text-sm shadow-lg relative bg-[length:300%_300%] bg-[position:0%_50%]",e.constrained?"flex h-full w-full min-w-0 flex-col":"",{"p-0.5 bg-gradient-to-br from-primary via-secondary via-accent to-info animate-moveGradient":e.isAITranslate||e.isAIExplain,"p-0.5 bg-base-300":!e.isAITranslate&&!e.isAIExplain}])},[n.createElementVNode("div",{class:n.normalizeClass(["bg-base-100 rounded-md relative z-10",e.constrained?"flex min-h-0 min-w-0 flex-1 flex-col":""])},[t.isServiceUnavailable?(n.openBlock(),n.createBlock(it,{key:0,class:"shrink-0",isServiceUnavailable:t.isServiceUnavailable,isLongSentence:!1,theme:e.theme,showThemeSelector:e.showThemeSelector,mode:e.mode,canWrite:t.canWrite,onFavorite:o[0]||(o[0]=h=>t.$emit("favorite")),onSetting:o[1]||(o[1]=h=>t.$emit("settings")),onClose:o[2]||(o[2]=h=>t.$emit("close")),onLoadTTS:o[3]||(o[3]=h=>t.$emit("loadTTS")),onThemeChange:o[4]||(o[4]=h=>t.$emit("themeChange",h)),onRequestTranslate:t.requestTranslate,onRequestWrite:t.requestWrite},null,8,["isServiceUnavailable","theme","showThemeSelector","mode","canWrite","onRequestTranslate","onRequestWrite"])):(n.openBlock(),n.createBlock(it,{key:1,class:"shrink-0",tts:e.tts,isFavorite:e.isFavorite,isAITranslate:e.isAITranslate,isAITranslateVisible:((r=(i=t.data)==null?void 0:i.dictionary)==null?void 0:r.length)===0,isAIExplain:e.isAIExplain,isAIExplainVisible:((l=(a=t.data)==null?void 0:a.text)==null?void 0:l.length)>=e.aiExplainMinLength,isAITranslationLoading:t.isAITranslationLoading,isAIExplainLoading:t.isAIExplainLoading,isFavoriteFeatureEnabled:e.isFavoriteFeatureEnabled,isLongSentence:t.isLongSentence,theme:e.theme,showThemeSelector:e.showThemeSelector,mode:e.mode,canWrite:t.canWrite,onFavorite:o[5]||(o[5]=h=>t.$emit("favorite")),onSetting:o[6]||(o[6]=h=>t.$emit("settings")),onClose:o[7]||(o[7]=h=>t.$emit("close")),onLoadTTS:o[8]||(o[8]=h=>t.$emit("loadTTS")),onAiTranslate:t.handleAITranslate,onAiExplain:t.handleAIExplain,onThemeChange:o[9]||(o[9]=h=>t.$emit("themeChange",h)),onDragStart:o[10]||(o[10]=h=>t.$emit("dragStart",h)),onRequestTranslate:t.requestTranslate,onRequestWrite:t.requestWrite},null,8,["tts","isFavorite","isAITranslate","isAITranslateVisible","isAIExplain","isAIExplainVisible","isAITranslationLoading","isAIExplainLoading","isFavoriteFeatureEnabled","isLongSentence","theme","showThemeSelector","mode","canWrite","onAiTranslate","onAiExplain","onRequestTranslate","onRequestWrite"])),n.createElementVNode("div",{class:n.normalizeClass(e.constrained?"min-h-0 min-w-0 flex-1 overflow-y-auto overflow-x-hidden break-words overscroll-contain":"")},[t.isWrite?(n.openBlock(),n.createBlock(Yo,{key:0,text:t.activeText,result:t.shownResult,action:t.currentAction,loading:e.isWriteLoading,editable:e.editable,unavailable:t.isServiceUnavailable,onAction:t.handleWriteAction,onCopy:t.handleCopy,onReplace:t.handleReplace},null,8,["text","result","action","loading","editable","unavailable","onAction","onCopy","onReplace"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",ii,[(s=(c=t.data)==null?void 0:c.phonetic)!=null&&s.src?(n.openBlock(),n.createBlock(hn,{key:0,phonetic:(f=(d=t.data)==null?void 0:d.phonetic)==null?void 0:f.src},null,8,["phonetic"])):n.createCommentVNode("",!0),n.createVNode(gn,{sentences:t.isServiceUnavailable?"Service Unavailable":(p=t.data)==null?void 0:p.result},null,8,["sentences"]),n.createVNode(bn,{show:t.showAIPrompt,isLoading:t.isAITranslationLoading,onClick:t.handleAITranslate},null,8,["show","isLoading","onClick"]),n.createVNode(yn,{show:t.showAIExplainPrompt,isLoading:t.isAIExplainLoading,onClick:t.handleAIExplain},null,8,["show","isLoading","onClick"]),n.createVNode(En,{show:t.showLearnPrompt,onClick:t.handleLearn},null,8,["show","onClick"])]),!t.isServiceUnavailable&&((m=(g=t.data)==null?void 0:g.dictionary)==null?void 0:m.length)>0?(n.openBlock(),n.createBlock(Ln,{key:0,class:"p-3 pt-0 border-t border-base-300",dictionary:t.data.dictionary},null,8,["dictionary"])):n.createCommentVNode("",!0),!t.isServiceUnavailable&&e.isAIExplain&&e.explanation?(n.openBlock(),n.createBlock($n,{key:1,class:"p-3 pt-0 border-t border-base-300",explanation:e.explanation},null,8,["explanation"])):n.createCommentVNode("",!0)],64))],2),n.createVNode(To,{onResizeStart:o[11]||(o[11]=h=>t.$emit("resizeStart",h))})],2)],2)):n.createCommentVNode("",!0)}}});function li(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re={exports:{}},at;function ai(){return at||(at=1,function(e){(function(){var t=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],o=typeof window<"u",i=o&&window.mozInnerScreenX!=null;function r(a,l,c){if(!o)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var s=c&&c.debug||!1;if(s){var d=document.querySelector("#input-textarea-caret-position-mirror-div");d&&d.parentNode.removeChild(d)}var f=document.createElement("div");f.id="input-textarea-caret-position-mirror-div",document.body.appendChild(f);var p=f.style,g=window.getComputedStyle?window.getComputedStyle(a):a.currentStyle,m=a.nodeName==="INPUT";p.whiteSpace="pre-wrap",m||(p.wordWrap="break-word"),p.position="absolute",s||(p.visibility="hidden"),t.forEach(function(w){m&&w==="lineHeight"?p.lineHeight=g.height:p[w]=g[w]}),i?a.scrollHeight>parseInt(g.height)&&(p.overflowY="scroll"):p.overflow="hidden",f.textContent=a.value.substring(0,l),m&&(f.textContent=f.textContent.replace(/\s/g," "));var h=document.createElement("span");h.textContent=a.value.substring(l)||".",f.appendChild(h);var b={top:h.offsetTop+parseInt(g.borderTopWidth),left:h.offsetLeft+parseInt(g.borderLeftWidth),height:parseInt(g.lineHeight)};return s?h.style.backgroundColor="#aaa":document.body.removeChild(f),b}e.exports=r})()}(Re)),Re.exports}var si=ai();const st=li(si);function K(e){const t=window.getSelection();let o=t+"";if(o=o.trim(),e&&e.type==="password"||!o.length&&(!e||e.selectionStart==null||e.selectionEnd==null||e.selectionStart===e.selectionEnd||(o=e.value.substring(e.selectionStart,e.selectionEnd),o=o.trim(),!o.length)))return!1;let i=ui(t),{top:r,bottom:a,left:l,width:c,height:s}=i;if(!a&&!l){if(!e||e.selectionStart==null||e.selectionEnd==null)return!1;let d=st(e,e.selectionStart),f=st(e,e.selectionEnd);i=e.getBoundingClientRect(),l=i.left+d.left,c=f.left-d.left,d.top!=f.top&&(l=i.left,c=i.width),r=i.top+d.top,a=i.top+f.top+20}return s===0&&(s=a-r),{text:o,x:l,y:r,top:r,bottom:a,left:l,right:l+c,width:c,height:s}}function ci(e){var t;return((t=e==null?void 0:e.key)==null?void 0:t.toLowerCase())==="a"&&!!(e.ctrlKey||e.metaKey)}function di(e){return(e==null?void 0:e.key)==="Control"||(e==null?void 0:e.key)==="Meta"||(e==null?void 0:e.key)==="Shift"||(e==null?void 0:e.key)==="Alt"}function ui(e){if(!e||e.rangeCount===0)return{top:0,bottom:0,left:0,width:0,height:0};try{return e.getRangeAt(0).getBoundingClientRect()}catch{return{top:0,bottom:0,left:0,width:0,height:0}}}function fi(){const e=document.getElementsByTagName("ddict-div");for(let t of e)if(!t.parentNode.matches('wrapper[dir="rtl"]')){const o=document.createElement("wrapper");o.setAttribute("dir","rtl"),t.parentNode.insertBefore(o,t),o.appendChild(t)}}function mi(){const e=document.querySelectorAll('wrapper[dir="rtl"]');for(let t of e){const o=t.querySelector("ddict-div");o&&(t.parentNode.insertBefore(o,t),t.remove())}}const ct={supportRTL:fi,removeRTL:mi},hi=2,pi={n:{x:!1,y:!0,fromStartX:!1,fromStartY:!0},s:{x:!1,y:!0,fromStartX:!1,fromStartY:!1},e:{x:!0,y:!1,fromStartX:!1,fromStartY:!1},w:{x:!0,y:!1,fromStartX:!0,fromStartY:!1},ne:{x:!0,y:!0,fromStartX:!1,fromStartY:!0},nw:{x:!0,y:!0,fromStartX:!0,fromStartY:!0},se:{x:!0,y:!0,fromStartX:!1,fromStartY:!1},sw:{x:!0,y:!0,fromStartX:!0,fromStartY:!1}};function gi(e,t,o=hi){return Math.abs(e)>=o||Math.abs(t)>=o}function we(e,t,o){const i=o>t?o:t;return Math.min(i,Math.max(t,e))}function Ci({x:e,y:t,width:o,height:i,dx:r,dy:a,scale:l=1,edge:c,minWidth:s,minHeight:d,viewportWidth:f,viewportHeight:p,margin:g=8}){const m=pi[c];if(!m)return{x:e,y:t,width:o,height:i};const h=l>0?l:1,b=e+o*h,w=t+i*h,x=f-g,y=p-g;let E=e,L=t,k=o,B=i;if(m.x&&m.fromStartX){const v=g,A=b-s*h;E=we(e+r,v,A),k=(b-E)/h}else m.x&&(k=we(o+r/h,s,Math.max(s,(x-e)/h)));if(m.y&&m.fromStartY){const v=g,A=w-d*h;L=we(t+a,v,A),B=(w-L)/h}else m.y&&(B=we(i+a/h,d,Math.max(d,(y-t)/h)));return{x:Math.round(E),y:Math.round(L),width:Math.round(k),height:Math.round(B)}}function bi(e){const t=Li(e);if(!t)return null;if(Si(t)){const a=t.selectionStart,l=t.selectionEnd;return a==null||l==null||a===l?null:{kind:"value",element:t,start:a,end:l,text:t.value.slice(a,l)}}const o=window.getSelection();if(!o||o.rangeCount===0)return null;const i=o.getRangeAt(0).cloneRange(),r=i.toString();return r?{kind:"range",element:t,range:i,text:r}:null}function wi(e,t){return!e||t==null?!1:e.kind==="value"?xi(e,t):Ei(e,t)}async function yi(e){var t;if(!e)return!1;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return vi(e)}function xi(e,t){const o=e.element;if(!o||o.value.slice(e.start,e.end)!==e.text)return!1;const i=o.value.slice(0,e.start)+t+o.value.slice(e.end);ki(o,i);const r=e.start+t.length;return o.focus(),o.setSelectionRange(r,r),dt(o),!0}function Ei(e,t){const o=e.range;if(!o||o.toString()!==e.text)return!1;o.deleteContents();const i=o.startContainer.ownerDocument.createTextNode(t);return o.insertNode(i),o.setStartAfter(i),o.collapse(!0),dt(e.element),!0}function ki(e,t){var i;const o=(i=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value"))==null?void 0:i.set;o?o.call(e,t):e.value=t}function dt(e){e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function vi(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();let o=!1;try{o=document.execCommand("copy")}catch{o=!1}return t.remove(),o}function Li(e){return e?e.nodeType===3?e.parentElement:e:null}function Si(e){return e.tagName==="TEXTAREA"||e.tagName==="INPUT"}const Bi={__name:"HotKeysListener",props:{textSelected:String},emits:["toggleKey","close"],setup(e,{emit:t}){const o=e,i=t,r=()=>{setTimeout(()=>{o.textSelected&&c("DoubleClick")},50)},a=s=>{(s.altKey&&s.key.toLowerCase()==="w"||s.key==="∑")&&o.textSelected&&(c("Alt+W"),s.preventDefault()),s.key==="Escape"&&(c("Escape"),s.preventDefault())},l=s=>{s.key==="Shift"&&o.textSelected&&c("Shift")},c=s=>{switch(s){case"DoubleClick":i("toggleKey","DoubleClick");break;case"Shift":i("toggleKey","Shift");break;case"Alt+W":i("toggleKey","Alt+W");break;case"Escape":i("close");break}};return n.onMounted(()=>{window.addEventListener("dblclick",r),window.addEventListener("keydown",a),window.addEventListener("keyup",l)}),n.onUnmounted(()=>{window.removeEventListener("dblclick",r),window.removeEventListener("keydown",a),window.removeEventListener("keyup",l)}),(s,d)=>(n.openBlock(),n.createElementBlock("div"))}},Ti=["data-theme"],Ai={__name:"BubbleWrapper",props:{translation:Object,explanation:Object,isFavoriteFeatureEnabled:Boolean,isAITranslate:Boolean,isAIExplain:Boolean,isFavorite:Boolean,tts:String,status:String,scale:{type:Number,default:1},aiExplainMinLength:{type:Number,default:0},theme:{type:String,default:"lofi"},showThemeSelector:{type:Boolean,default:!0},mode:{type:String,default:"translate"},writing:{type:Object,default:null},writeAction:{type:String,default:be},isWriteLoading:{type:Boolean,default:!1}},emits:["toggleKey","logo","favorite","settings","close","loadTTS","aiTranslate","aiExplain","learn","themeChange","write","replace","copy"],setup(e,{emit:t}){const o=e,i=t,r=n.ref(null),a=n.ref(null),l=n.ref(null),c=n.ref(!1),s=n.ref(""),d=n.ref(!1),f=n.ref(o.writeAction||be);let p=null;n.watch(()=>o.writeAction,(u,C)=>{u&&u!==C&&(f.value=u)});const g=n.ref(o.theme),m=n.ref(!1),h=n.ref(!1),b=n.ref({x:0,y:0}),w=n.ref(null),x=n.ref(null),y=n.ref(null),E=n.ref(!1);let L=!1,k=0,B=!1,v="",A="";const z=n.computed(()=>typeof window>"u"||!l.value||!s.value?null:{getBoundingClientRect:()=>K(l.value),getClientRects:()=>K(l.value)}),{floatingStyles:G,update:re}=Yt(z,r,{placement:"bottom",middleware:[Ut(4),Zt(),jt()],whileElementsMounted(u,C,S){return Ht(u,C,S,{ancestorScroll:!0,elementResize:!1})}}),le=n.computed(()=>o.status===F.DATA||o.status===F.ERROR),_=n.computed(()=>{var u,C;return le.value?{width:((u=x.value)==null?void 0:u.width)??Ko,height:((C=x.value)==null?void 0:C.height)??Go}:null}),D=n.computed(()=>{let u=G.value;if(w.value)u={...u,position:"fixed",left:`${w.value.x}px`,top:`${w.value.y}px`,transform:"none"};else if(E.value&&l.value&&s.value){const C=K(l.value);C&&(u={...u,position:"fixed",left:`${C.x}px`,top:`${C.y+C.height+4}px`,transform:"none"})}return u={...u,zIndex:9999},_.value&&(u={...u,width:`${_.value.width}px`,height:`${_.value.height}px`,maxWidth:`${_.value.width}px`,boxSizing:"border-box"}),u}),ye=n.computed(()=>{const u={transform:o.scale!==1?`scale(${o.scale})`:"none",transformOrigin:"top left"};return _.value&&(u.width=`${_.value.width}px`,u.height=`${_.value.height}px`,u.boxSizing="border-box"),u});n.onMounted(()=>{document.addEventListener("keyup",W),document.addEventListener("select",R),document.addEventListener("selectionchange",V),document.documentElement.onclick=u=>{if(ut())return;const C=K(u.target);if(!C){Ne();return}Ve(C,u)},document.documentElement.ontouchend=u=>{if(ut())return;const C=K(u.target);if(!C){Ne();return}Ve(C,u)}}),n.onUnmounted(()=>{document.removeEventListener("keyup",W),document.removeEventListener("select",R),document.removeEventListener("selectionchange",V),cancelAnimationFrame(O),document.documentElement.onclick=null,document.documentElement.ontouchend=null,clearTimeout(k),document.removeEventListener("mousemove",Ie),document.removeEventListener("mouseup",Me),document.removeEventListener("touchmove",_e),document.removeEventListener("touchend",Fe),De()});let O=0;const W=u=>{if(!di(u)){if(ci(u)){ae();return}K(u.target)||Ne()}},R=u=>{ae(u.target)},V=()=>{o.status===F.DATA||o.status===F.LOADING||ae()},ae=u=>{cancelAnimationFrame(O),O=requestAnimationFrame(()=>{const C=u||document.activeElement,S=K(C);S&&(c.value&&s.value===S.text||Ve(S,{target:C}))})},Ve=(u,C)=>{o.status!==F.LOGO&&i("close"),c.value&&!E.value&&(E.value=!0),l.value=C.target,d.value=Vo(C.target),p=d.value?bi(C.target):null,s.value=u.text,c.value=!0,n.nextTick(re)},Ne=()=>{s.value="",d.value=!1,p=null,se()},$i=u=>{yi(u),i("copy",u),se()},Ri=u=>{wi(p,u==null?void 0:u.result),p=null,i("replace",u),se()},Vi=u=>{u!=null&&u.action&&(f.value=u.action),i("write",u)},Ni=u=>{if(rt(d.value,s.value)){i("write",{text:s.value,action:f.value||be});return}i("toggleKey",u)},Ii=u=>{u.stopPropagation()},se=async()=>{De(),c.value=!1,w.value=null,E.value=!1,i("close")},_i=u=>{g.value=u,i("themeChange",u)},Mi=({type:u,event:C})=>{m.value=!0;const S=r.value.getBoundingClientRect();if(u==="mouse")b.value={x:C.clientX-S.left,y:C.clientY-S.top},document.addEventListener("mousemove",Ie),document.addEventListener("mouseup",Me);else if(u==="touch"){const te=C.touches[0];b.value={x:te.clientX-S.left,y:te.clientY-S.top},document.addEventListener("touchmove",_e),document.addEventListener("touchend",Fe)}},Ie=u=>{m.value&&(w.value={x:u.clientX-b.value.x,y:u.clientY-b.value.y})},_e=u=>{if(!m.value)return;const C=u.touches[0];w.value={x:C.clientX-b.value.x,y:C.clientY-b.value.y}},Me=()=>{m.value&&ze(),m.value=!1,document.removeEventListener("mousemove",Ie),document.removeEventListener("mouseup",Me)},Fe=()=>{m.value&&ze(),m.value=!1,document.removeEventListener("touchmove",_e),document.removeEventListener("touchend",Fe)},ut=()=>m.value||h.value?!0:L?(L=!1,clearTimeout(k),!0):!1,ze=()=>{L=!0,clearTimeout(k),k=window.setTimeout(()=>{L=!1},50)},Fi={n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize",ne:"nesw-resize",sw:"nesw-resize",nw:"nwse-resize",se:"nwse-resize"},zi=u=>{!document.body||B||(v=document.body.style.cursor,A=document.body.style.userSelect,document.body.style.cursor=Fi[u]||"nwse-resize",document.body.style.userSelect="none",B=!0)},Di=()=>{!document.body||!B||(document.body.style.cursor=v,document.body.style.userSelect=A,B=!1)},Oi=({edge:u,event:C})=>{if(!a.value||!r.value||!a.value.offsetWidth||!a.value.offsetHeight)return;const S=r.value.getBoundingClientRect();h.value=!0,y.value={pointerX:C.clientX,pointerY:C.clientY,left:S.left,top:S.top,width:a.value.offsetWidth,height:a.value.offsetHeight,edge:u,moved:!1},zi(u),document.addEventListener("pointermove",ft),document.addEventListener("pointerup",xe),document.addEventListener("pointercancel",xe)},Wi=(u,C)=>{if(!h.value||!y.value||!r.value)return;const S=u-y.value.pointerX,te=C-y.value.pointerY;if(!y.value.moved&&!gi(S,te))return;y.value.moved=!0;const Ee=Ci({x:y.value.left,y:y.value.top,width:y.value.width,height:y.value.height,dx:S,dy:te,scale:o.scale,edge:y.value.edge,minWidth:Jo,minHeight:Qo,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,margin:ei});w.value={x:Ee.x,y:Ee.y},x.value={width:Ee.width,height:Ee.height}},ft=u=>{u.cancelable&&u.preventDefault(),Wi(u.clientX,u.clientY)},xe=()=>{De()},De=()=>{h.value&&ze(),h.value=!1,y.value=null,Di(),document.removeEventListener("pointermove",ft),document.removeEventListener("pointerup",xe),document.removeEventListener("pointercancel",xe)},Pi=()=>{var C;const u=(C=o==null?void 0:o.translation)==null?void 0:C.target;ti.includes(u)?ct.supportRTL():ct.removeRTL()};return n.watch(()=>o.status,()=>{c.value&&n.nextTick(re),Pi()}),n.watch(()=>o.theme,u=>{g.value=u}),(u,C)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[c.value?(n.openBlock(),n.createElementBlock("div",{key:0,ref_key:"floatingEl",ref:r,style:n.normalizeStyle(D.value),onClick:Ii},[n.createElementVNode("div",{ref_key:"contentEl",ref:a,class:"relative rounded-lg",style:n.normalizeStyle(ye.value),"data-theme":g.value},[n.createVNode(ri,{translation:o.translation,explanation:o.explanation,tts:o.tts,status:o.status,isFavorite:o.isFavorite,isFavoriteFeatureEnabled:o.isFavoriteFeatureEnabled,isAITranslate:o.isAITranslate,isAIExplain:o.isAIExplain,aiExplainMinLength:o.aiExplainMinLength,theme:g.value,showThemeSelector:o.showThemeSelector,constrained:le.value,mode:o.mode,writing:o.writing,writeAction:f.value,isWriteLoading:o.isWriteLoading,editable:d.value,selectedText:s.value,onLogo:C[0]||(C[0]=S=>i("logo")),onWrite:Vi,onReplace:Ri,onCopy:$i,onFavorite:C[1]||(C[1]=S=>i("favorite")),onSettings:C[2]||(C[2]=S=>i("settings")),onClose:se,onLoadTTS:C[3]||(C[3]=S=>i("loadTTS")),onAiTranslate:C[4]||(C[4]=S=>i("aiTranslate")),onAiExplain:C[5]||(C[5]=S=>i("aiExplain")),onLearn:C[6]||(C[6]=S=>i("learn",S)),onThemeChange:_i,onDragStart:Mi,onResizeStart:Oi},null,8,["translation","explanation","tts","status","isFavorite","isFavoriteFeatureEnabled","isAITranslate","isAIExplain","aiExplainMinLength","theme","showThemeSelector","constrained","mode","writing","writeAction","isWriteLoading","editable","selectedText"])],12,Ti)],4)):n.createCommentVNode("",!0),n.createVNode(Bi,{textSelected:s.value,onToggleKey:Ni,onClose:se},null,8,["textSelected"])],64))}};U.default=Ai,Object.defineProperties(U,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(P,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(P=typeof globalThis<"u"?globalThis:P||self,n(P.Bubble={},P.Vue))})(this,function(P,n){"use strict";const ce=Math.min,H=Math.max,de=Math.round,ue=Math.floor,O=e=>({x:e,y:e}),vt={left:"right",right:"left",bottom:"top",top:"bottom"},Lt={start:"end",end:"start"};function He(e,t,o){return H(e,ce(t,o))}function fe(e,t){return typeof e=="function"?e(t):e}function U(e){return e.split("-")[0]}function me(e){return e.split("-")[1]}function Ue(e){return e==="x"?"y":"x"}function je(e){return e==="y"?"height":"width"}function J(e){return["top","bottom"].includes(U(e))?"y":"x"}function Ze(e){return Ue(J(e))}function St(e,t,o){o===void 0&&(o=!1);const i=me(e),r=Ze(e),a=je(r);let l=r==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=he(l)),[l,he(l)]}function Bt(e){const t=he(e);return[ve(e),t,ve(t)]}function ve(e){return e.replace(/start|end/g,t=>Lt[t])}function Tt(e,t,o){const i=["left","right"],r=["right","left"],a=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return o?t?r:i:t?i:r;case"left":case"right":return t?a:l;default:return[]}}function At(e,t,o,i){const r=me(e);let a=Tt(U(e),o==="start",i);return r&&(a=a.map(l=>l+"-"+r),t&&(a=a.concat(a.map(ve)))),a}function he(e){return e.replace(/left|right|bottom|top/g,t=>vt[t])}function $t(e){return{top:0,right:0,bottom:0,left:0,...e}}function Rt(e){return typeof e!="number"?$t(e):{top:e,right:e,bottom:e,left:e}}function pe(e){const{x:t,y:o,width:i,height:r}=e;return{width:i,height:r,top:o,left:t,right:t+i,bottom:o+r,x:t,y:o}}function qe(e,t,o){let{reference:i,floating:r}=e;const a=J(t),l=Ze(t),c=je(l),s=U(t),d=a==="y",f=i.x+i.width/2-r.width/2,p=i.y+i.height/2-r.height/2,g=i[c]/2-r[c]/2;let m;switch(s){case"top":m={x:f,y:i.y-r.height};break;case"bottom":m={x:f,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:p};break;case"left":m={x:i.x-r.width,y:p};break;default:m={x:i.x,y:i.y}}switch(me(t)){case"start":m[l]-=g*(o&&d?-1:1);break;case"end":m[l]+=g*(o&&d?-1:1);break}return m}const Vt=async(e,t,o)=>{const{placement:i="bottom",strategy:r="absolute",middleware:a=[],platform:l}=o,c=a.filter(Boolean),s=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:p}=qe(d,i,s),g=i,m={},h=0;for(let b=0;b<c.length;b++){const{name:w,fn:x}=c[b],{x:E,y,data:S,reset:v}=await x({x:f,y:p,initialPlacement:i,placement:g,strategy:r,middlewareData:m,rects:d,platform:l,elements:{reference:e,floating:t}});f=E??f,p=y??p,m={...m,[w]:{...m[w],...S}},v&&h<=50&&(h++,typeof v=="object"&&(v.placement&&(g=v.placement),v.rects&&(d=v.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:r}):v.rects),{x:f,y:p}=qe(d,g,s)),b=-1)}return{x:f,y:p,placement:g,strategy:r,middlewareData:m}};async function Xe(e,t){var o;t===void 0&&(t={});const{x:i,y:r,platform:a,rects:l,elements:c,strategy:s}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:g=!1,padding:m=0}=fe(t,e),h=Rt(m),w=c[g?p==="floating"?"reference":"floating":p],x=pe(await a.getClippingRect({element:(o=await(a.isElement==null?void 0:a.isElement(w)))==null||o?w:w.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:d,rootBoundary:f,strategy:s})),E=p==="floating"?{x:i,y:r,width:l.floating.width,height:l.floating.height}:l.reference,y=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),S=await(a.isElement==null?void 0:a.isElement(y))?await(a.getScale==null?void 0:a.getScale(y))||{x:1,y:1}:{x:1,y:1},v=pe(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:y,strategy:s}):E);return{top:(x.top-v.top+h.top)/S.y,bottom:(v.bottom-x.bottom+h.bottom)/S.y,left:(x.left-v.left+h.left)/S.x,right:(v.right-x.right+h.right)/S.x}}const Nt=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,i;const{placement:r,middlewareData:a,rects:l,initialPlacement:c,platform:s,elements:d}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:b=!0,...w}=fe(e,t);if((o=a.arrow)!=null&&o.alignmentOffset)return{};const x=U(r),E=J(c),y=U(c)===c,S=await(s.isRTL==null?void 0:s.isRTL(d.floating)),v=g||(y||!b?[he(c)]:Bt(c)),B=h!=="none";!g&&B&&v.push(...At(c,b,h,S));const k=[c,...v],V=await Xe(t,w),_=[];let Y=((i=a.flip)==null?void 0:i.overflows)||[];if(f&&_.push(V[x]),p){const T=St(r,l,S);_.push(V[T[0]],V[T[1]])}if(Y=[...Y,{placement:r,overflows:_}],!_.every(T=>T<=0)){var we,le;const T=(((we=a.flip)==null?void 0:we.index)||0)+1,ye=k[T];if(ye)return{data:{index:T,overflows:Y},reset:{placement:ye}};let K=(le=Y.filter(F=>F.overflows[0]<=0).sort((F,A)=>F.overflows[1]-A.overflows[1])[0])==null?void 0:le.placement;if(!K)switch(m){case"bestFit":{var ae;const F=(ae=Y.filter(A=>{if(B){const $=J(A.placement);return $===E||$==="y"}return!0}).map(A=>[A.placement,A.overflows.filter($=>$>0).reduce(($,G)=>$+G,0)]).sort((A,$)=>A[1]-$[1])[0])==null?void 0:ae[0];F&&(K=F);break}case"initialPlacement":K=c;break}if(r!==K)return{reset:{placement:K}}}return{}}}};async function It(e,t){const{placement:o,platform:i,elements:r}=e,a=await(i.isRTL==null?void 0:i.isRTL(r.floating)),l=U(o),c=me(o),s=J(o)==="y",d=["left","top"].includes(l)?-1:1,f=a&&s?-1:1,p=fe(t,e);let{mainAxis:g,crossAxis:m,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return c&&typeof h=="number"&&(m=c==="end"?h*-1:h),s?{x:m*f,y:g*d}:{x:g*d,y:m*f}}const Mt=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,i;const{x:r,y:a,placement:l,middlewareData:c}=t,s=await It(t,e);return l===((o=c.offset)==null?void 0:o.placement)&&(i=c.arrow)!=null&&i.alignmentOffset?{}:{x:r+s.x,y:a+s.y,data:{...s,placement:l}}}}},_t=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:i,placement:r}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:w=>{let{x,y:E}=w;return{x,y:E}}},...s}=fe(e,t),d={x:o,y:i},f=await Xe(t,s),p=J(U(r)),g=Ue(p);let m=d[g],h=d[p];if(a){const w=g==="y"?"top":"left",x=g==="y"?"bottom":"right",E=m+f[w],y=m-f[x];m=He(E,m,y)}if(l){const w=p==="y"?"top":"left",x=p==="y"?"bottom":"right",E=h+f[w],y=h-f[x];h=He(E,h,y)}const b=c.fn({...t,[g]:m,[p]:h});return{...b,data:{x:b.x-o,y:b.y-i}}}}};function j(e){return Le(e)?(e.nodeName||"").toLowerCase():"#document"}function R(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function z(e){var t;return(t=(Le(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Le(e){return e instanceof Node||e instanceof R(e).Node}function I(e){return e instanceof Element||e instanceof R(e).Element}function M(e){return e instanceof HTMLElement||e instanceof R(e).HTMLElement}function Ye(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof R(e).ShadowRoot}function ne(e){const{overflow:t,overflowX:o,overflowY:i,display:r}=N(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+o)&&!["inline","contents"].includes(r)}function Ft(e){return["table","td","th"].includes(j(e))}function ge(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Se(e){const t=Be(),o=N(e);return o.transform!=="none"||o.perspective!=="none"||(o.containerType?o.containerType!=="normal":!1)||!t&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!t&&(o.filter?o.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(o.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(o.contain||"").includes(i))}function zt(e){let t=W(e);for(;M(t)&&!Q(t);){if(ge(t))return null;if(Se(t))return t;t=W(t)}return null}function Be(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Q(e){return["html","body","#document"].includes(j(e))}function N(e){return R(e).getComputedStyle(e)}function Ce(e){return I(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function W(e){if(j(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ye(e)&&e.host||z(e);return Ye(t)?t.host:t}function Ke(e){const t=W(e);return Q(t)?e.ownerDocument?e.ownerDocument.body:e.body:M(t)&&ne(t)?t:Ke(t)}function oe(e,t,o){var i;t===void 0&&(t=[]),o===void 0&&(o=!0);const r=Ke(e),a=r===((i=e.ownerDocument)==null?void 0:i.body),l=R(r);return a?t.concat(l,l.visualViewport||[],ne(r)?r:[],l.frameElement&&o?oe(l.frameElement):[]):t.concat(r,oe(r,[],o))}function Ge(e){const t=N(e);let o=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=M(e),a=r?e.offsetWidth:o,l=r?e.offsetHeight:i,c=de(o)!==a||de(i)!==l;return c&&(o=a,i=l),{width:o,height:i,$:c}}function Te(e){return I(e)?e:e.contextElement}function ee(e){const t=Te(e);if(!M(t))return O(1);const o=t.getBoundingClientRect(),{width:i,height:r,$:a}=Ge(t);let l=(a?de(o.width):o.width)/i,c=(a?de(o.height):o.height)/r;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const Dt=O(0);function Je(e){const t=R(e);return!Be()||!t.visualViewport?Dt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ot(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==R(e)?!1:t}function Z(e,t,o,i){t===void 0&&(t=!1),o===void 0&&(o=!1);const r=e.getBoundingClientRect(),a=Te(e);let l=O(1);t&&(i?I(i)&&(l=ee(i)):l=ee(e));const c=Ot(a,o,i)?Je(a):O(0);let s=(r.left+c.x)/l.x,d=(r.top+c.y)/l.y,f=r.width/l.x,p=r.height/l.y;if(a){const g=R(a),m=i&&I(i)?R(i):i;let h=g,b=h.frameElement;for(;b&&i&&m!==h;){const w=ee(b),x=b.getBoundingClientRect(),E=N(b),y=x.left+(b.clientLeft+parseFloat(E.paddingLeft))*w.x,S=x.top+(b.clientTop+parseFloat(E.paddingTop))*w.y;s*=w.x,d*=w.y,f*=w.x,p*=w.y,s+=y,d+=S,h=R(b),b=h.frameElement}}return pe({width:f,height:p,x:s,y:d})}function Wt(e){let{elements:t,rect:o,offsetParent:i,strategy:r}=e;const a=r==="fixed",l=z(i),c=t?ge(t.floating):!1;if(i===l||c&&a)return o;let s={scrollLeft:0,scrollTop:0},d=O(1);const f=O(0),p=M(i);if((p||!p&&!a)&&((j(i)!=="body"||ne(l))&&(s=Ce(i)),M(i))){const g=Z(i);d=ee(i),f.x=g.x+i.clientLeft,f.y=g.y+i.clientTop}return{width:o.width*d.x,height:o.height*d.y,x:o.x*d.x-s.scrollLeft*d.x+f.x,y:o.y*d.y-s.scrollTop*d.y+f.y}}function Pt(e){return Array.from(e.getClientRects())}function Qe(e){return Z(z(e)).left+Ce(e).scrollLeft}function Ht(e){const t=z(e),o=Ce(e),i=e.ownerDocument.body,r=H(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),a=H(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let l=-o.scrollLeft+Qe(e);const c=-o.scrollTop;return N(i).direction==="rtl"&&(l+=H(t.clientWidth,i.clientWidth)-r),{width:r,height:a,x:l,y:c}}function Ut(e,t){const o=R(e),i=z(e),r=o.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,s=0;if(r){a=r.width,l=r.height;const d=Be();(!d||d&&t==="fixed")&&(c=r.offsetLeft,s=r.offsetTop)}return{width:a,height:l,x:c,y:s}}function jt(e,t){const o=Z(e,!0,t==="fixed"),i=o.top+e.clientTop,r=o.left+e.clientLeft,a=M(e)?ee(e):O(1),l=e.clientWidth*a.x,c=e.clientHeight*a.y,s=r*a.x,d=i*a.y;return{width:l,height:c,x:s,y:d}}function et(e,t,o){let i;if(t==="viewport")i=Ut(e,o);else if(t==="document")i=Ht(z(e));else if(I(t))i=jt(t,o);else{const r=Je(e);i={...t,x:t.x-r.x,y:t.y-r.y}}return pe(i)}function tt(e,t){const o=W(e);return o===t||!I(o)||Q(o)?!1:N(o).position==="fixed"||tt(o,t)}function Zt(e,t){const o=t.get(e);if(o)return o;let i=oe(e,[],!1).filter(c=>I(c)&&j(c)!=="body"),r=null;const a=N(e).position==="fixed";let l=a?W(e):e;for(;I(l)&&!Q(l);){const c=N(l),s=Se(l);!s&&c.position==="fixed"&&(r=null),(a?!s&&!r:!s&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||ne(l)&&!s&&tt(e,l))?i=i.filter(f=>f!==l):r=c,l=W(l)}return t.set(e,i),i}function qt(e){let{element:t,boundary:o,rootBoundary:i,strategy:r}=e;const l=[...o==="clippingAncestors"?ge(t)?[]:Zt(t,this._c):[].concat(o),i],c=l[0],s=l.reduce((d,f)=>{const p=et(t,f,r);return d.top=H(p.top,d.top),d.right=ce(p.right,d.right),d.bottom=ce(p.bottom,d.bottom),d.left=H(p.left,d.left),d},et(t,c,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Xt(e){const{width:t,height:o}=Ge(e);return{width:t,height:o}}function Yt(e,t,o){const i=M(t),r=z(t),a=o==="fixed",l=Z(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const s=O(0);if(i||!i&&!a)if((j(t)!=="body"||ne(r))&&(c=Ce(t)),i){const p=Z(t,!0,a,t);s.x=p.x+t.clientLeft,s.y=p.y+t.clientTop}else r&&(s.x=Qe(r));const d=l.left+c.scrollLeft-s.x,f=l.top+c.scrollTop-s.y;return{x:d,y:f,width:l.width,height:l.height}}function Ae(e){return N(e).position==="static"}function nt(e,t){return!M(e)||N(e).position==="fixed"?null:t?t(e):e.offsetParent}function ot(e,t){const o=R(e);if(ge(e))return o;if(!M(e)){let r=W(e);for(;r&&!Q(r);){if(I(r)&&!Ae(r))return r;r=W(r)}return o}let i=nt(e,t);for(;i&&Ft(i)&&Ae(i);)i=nt(i,t);return i&&Q(i)&&Ae(i)&&!Se(i)?o:i||zt(e)||o}const Kt=async function(e){const t=this.getOffsetParent||ot,o=this.getDimensions,i=await o(e.floating);return{reference:Yt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Gt(e){return N(e).direction==="rtl"}const Jt={convertOffsetParentRelativeRectToViewportRelativeRect:Wt,getDocumentElement:z,getClippingRect:qt,getOffsetParent:ot,getElementRects:Kt,getClientRects:Pt,getDimensions:Xt,getScale:ee,isElement:I,isRTL:Gt};function Qt(e,t){let o=null,i;const r=z(e);function a(){var c;clearTimeout(i),(c=o)==null||c.disconnect(),o=null}function l(c,s){c===void 0&&(c=!1),s===void 0&&(s=1),a();const{left:d,top:f,width:p,height:g}=e.getBoundingClientRect();if(c||t(),!p||!g)return;const m=ue(f),h=ue(r.clientWidth-(d+p)),b=ue(r.clientHeight-(f+g)),w=ue(d),E={rootMargin:-m+"px "+-h+"px "+-b+"px "+-w+"px",threshold:H(0,ce(1,s))||1};let y=!0;function S(v){const B=v[0].intersectionRatio;if(B!==s){if(!y)return l();B?l(!1,B):i=setTimeout(()=>{l(!1,1e-7)},1e3)}y=!1}try{o=new IntersectionObserver(S,{...E,root:r.ownerDocument})}catch{o=new IntersectionObserver(S,E)}o.observe(e)}return l(!0),a}function en(e,t,o,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:s=!1}=i,d=Te(e),f=r||a?[...d?oe(d):[],...oe(t)]:[];f.forEach(x=>{r&&x.addEventListener("scroll",o,{passive:!0}),a&&x.addEventListener("resize",o)});const p=d&&c?Qt(d,o):null;let g=-1,m=null;l&&(m=new ResizeObserver(x=>{let[E]=x;E&&E.target===d&&m&&(m.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(t)})),o()}),d&&!s&&m.observe(d),m.observe(t));let h,b=s?Z(e):null;s&&w();function w(){const x=Z(e);b&&(x.x!==b.x||x.y!==b.y||x.width!==b.width||x.height!==b.height)&&o(),b=x,h=requestAnimationFrame(w)}return o(),()=>{var x;f.forEach(E=>{r&&E.removeEventListener("scroll",o),a&&E.removeEventListener("resize",o)}),p==null||p(),(x=m)==null||x.disconnect(),m=null,s&&cancelAnimationFrame(h)}}const tn=Mt,nn=_t,on=Nt,rn=(e,t,o)=>{const i=new Map,r={platform:Jt,...o},a={...r.platform,_c:i};return Vt(e,t,{...r,platform:a})};function ln(e){return e!=null&&typeof e=="object"&&"$el"in e}function it(e){if(ln(e)){const t=e.$el;return Le(t)&&j(t)==="#comment"?null:t}return e}function ie(e){return typeof e=="function"?e():n.unref(e)}function rt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lt(e,t){const o=rt(e);return Math.round(t*o)/o}function an(e,t,o){o===void 0&&(o={});const i=o.whileElementsMounted,r=n.computed(()=>{var k;return(k=ie(o.open))!=null?k:!0}),a=n.computed(()=>ie(o.middleware)),l=n.computed(()=>{var k;return(k=ie(o.placement))!=null?k:"bottom"}),c=n.computed(()=>{var k;return(k=ie(o.strategy))!=null?k:"absolute"}),s=n.computed(()=>{var k;return(k=ie(o.transform))!=null?k:!0}),d=n.computed(()=>it(e.value)),f=n.computed(()=>it(t.value)),p=n.ref(0),g=n.ref(0),m=n.ref(c.value),h=n.ref(l.value),b=n.shallowRef({}),w=n.ref(!1),x=n.computed(()=>{const k={position:m.value,left:"0",top:"0"};if(!f.value)return k;const V=lt(f.value,p.value),_=lt(f.value,g.value);return s.value?{...k,transform:"translate("+V+"px, "+_+"px)",...rt(f.value)>=1.5&&{willChange:"transform"}}:{position:m.value,left:V+"px",top:_+"px"}});let E;function y(){d.value==null||f.value==null||rn(d.value,f.value,{middleware:a.value,placement:l.value,strategy:c.value}).then(k=>{p.value=k.x,g.value=k.y,m.value=k.strategy,h.value=k.placement,b.value=k.middlewareData,w.value=!0})}function S(){typeof E=="function"&&(E(),E=void 0)}function v(){if(S(),i===void 0){y();return}if(d.value!=null&&f.value!=null){E=i(d.value,f.value,y);return}}function B(){r.value||(w.value=!1)}return n.watch([a,l,c],y,{flush:"sync"}),n.watch([d,f],v,{flush:"sync"}),n.watch(r,B,{flush:"sync"}),n.getCurrentScope()&&n.onScopeDispose(S),{x:n.shallowReadonly(p),y:n.shallowReadonly(g),strategy:n.shallowReadonly(m),placement:n.shallowReadonly(h),middlewareData:n.shallowReadonly(b),isPositioned:n.shallowReadonly(w),floatingStyles:x,update:y}}const sn="data:image/svg+xml,%3csvg%20width='1324'%20height='1326'%20viewBox='0%200%201324%201326'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='141'%20y='78'%20width='1042'%20height='1170'%20fill='white'/%3e%3cpath%20d='M184.533%201.99984C135.867%207.19984%2089.8666%2029.8665%2056.4%2065.1998C29.6%2093.4665%2012.5333%20126.266%203.73329%20166.4L0.666626%20180V663.333V1146.67L3.73329%201160.27C12.5333%201200.4%2029.6%201233.2%2056.4%201261.47C90.4%201297.33%20135.333%201319.33%20185.6%201324.67C203.333%201326.53%201122.53%201326.4%201139.73%201324.53C1188.53%201319.33%201229.07%201299.73%201264.13%201264.8C1294.27%201234.67%201311.47%201202.67%201320.8%201159.33C1323.2%201148.4%201323.33%201130%201323.33%20663.333C1323.33%20196.667%201323.2%20178.266%201320.8%20167.333C1311.47%20124%201294.27%2091.9998%201264.13%2061.8664C1229.07%2026.9331%201188.53%207.33314%201139.73%202.13314C1124.67%200.399809%20200%200.399842%20184.533%201.99984ZM732.933%20151.466C746.8%20152.933%20763.333%20157.6%20774%20163.067C800.267%20176.267%20822.4%20200.4%20833.2%20227.333C841.867%20249.333%20841.467%20233.467%20841.067%20502C840.533%20777.6%20841.733%20750.267%20829.2%20776.133C822.133%20790.933%20810.667%20806.533%20800.267%20815.2C795.2%20819.6%20793.2%20822.267%20792%20827.067C786.133%20848.267%20768.667%20885.867%20755.2%20906.133C724.533%20952%20681.2%20986.133%20624%201009.33C615.6%201012.8%20608.4%201015.87%20608.133%201016.13C607.867%201016.27%20614.533%201023.33%20622.933%201031.6C633.467%201042.13%20639.333%201049.07%20642.133%201054.4C646.933%201063.87%20645.467%201064%20672.667%201050.8C724.933%201025.47%20762.933%20994.8%20794.933%20952C811.467%20929.867%20829.867%20895.333%20839.333%20868.267C841.333%20862.667%20843.467%20858%20844.133%20858C844.667%20858%20845.6%20859.333%20846.133%20860.933C848.267%20868.133%20863.333%20900.8%20870.133%20913.2C898%20963.867%20931.6%201001.2%20975.333%201030.27C989.867%201040%201017.2%201054.4%201031.6%201059.73L1037.2%201061.87L1041.33%201054.67C1048.4%201042.4%201056.67%201032.27%201067.87%201022.4L1078.67%201012.8L1071.6%201010.27C1067.87%201008.8%201060.53%201006%201055.6%201004.13C1040.93%20998.533%201013.73%20984%201000%20974.267C985.733%20964.133%20960.8%20940.667%20948.933%20926.267C935.067%20909.333%20921.467%20887.467%20910%20864C900.133%20844%20887.2%20812.133%20884.667%20801.6L883.733%20798H971.867H1060V769.333V740.667H963.333H866.533L867.333%20736.267C868.4%20729.867%20870.4%20693.067%20871.467%20662.933C872.267%20639.067%20872.533%20636.4%20874.8%20635.2C878.667%20633.2%20881.333%20626.667%20882.267%20617.333L883.067%20608.667H872.133C864.133%20608.667%20861.067%20608.133%20860.533%20606.8C860%20605.467%20881.2%20466%20886.133%20438.267L886.933%20433.867L977.867%20434.4C1066.67%20434.8%201068.93%20434.8%201079.87%20437.733C1124.8%20449.6%201158.67%20482.533%201172.93%20528L1176.67%20540V808V1076L1172.93%201087.73C1158.53%201133.6%201126.13%201164.93%201078.93%201178.4L1068.67%201181.33L812.667%201181.73C638.8%201182%20552.667%201181.73%20544.4%201180.67C488.667%201174.4%20443.2%201132.13%20432.533%201076.93C431.067%201068.93%20430.667%201046.4%20430.667%20956.667V846.133L340.4%20845.6C252.8%20845.2%20249.6%20845.067%20239.067%20842.267C196.533%20831.067%20164.533%20800.133%20151.067%20757.333L147.333%20745.333V499.333V253.333L150.4%20242C159.067%20209.067%20180.4%20181.866%20210.667%20164.933C221.2%20159.066%20240.4%20152.933%20252.667%20151.6C268.533%20149.733%20716.933%20149.6%20732.933%20151.466Z'%20fill='%233B5695'/%3e%3cpath%20d='M256.533%20213.333C232.933%20218.533%20214.133%20237.067%20209.333%20259.733C208.4%20264.533%20208%20337.2%20208.267%20502L208.667%20737.333L211.733%20744.933C218.533%20761.733%20231.733%20774.533%20248.667%20780.933L256.667%20784L490%20784.4C749.2%20784.8%20734.4%20785.333%20750.133%20776C764.267%20767.6%20775.467%20752.4%20778.667%20737.067C779.6%20732.8%20780%20652.133%20779.733%20494L779.333%20257.333L775.067%20248.267C767.2%20231.6%20756.933%20222%20740.133%20215.467L731.333%20212L498%20211.733C306.8%20211.6%20263.2%20211.867%20256.533%20213.333ZM492%20281.2C546.267%20290.267%20590.267%20311.2%20622.533%20343.333C653.867%20374.667%20671.867%20409.867%20680.267%20456.667C684.133%20478.533%20684.133%20516.267%20680.133%20538.533C665.467%20621.067%20606.933%20684.4%20524%20707.467C490%20716.933%20488.4%20716.933%20392.4%20717.6L305.333%20718.133V498V277.867L391.733%20278.4C465.733%20278.8%20480%20279.2%20492%20281.2Z'%20fill='%233B5695'/%3e%3cpath%20d='M384%20462.933V576.133L345.067%20611.467C306.533%20646.267%20306.133%20646.667%20310.667%20647.067C313.2%20647.333%20348.933%20647.333%20390%20646.933C472.667%20646.267%20477.6%20645.867%20503.6%20637.333C527.6%20629.333%20543.333%20620%20560.267%20603.6C590.133%20574.667%20604.4%20536.267%20602.267%20489.733C600.533%20450.267%20588.267%20420%20564%20395.333C546.8%20377.867%20531.6%20368.4%20506.267%20360C482.933%20352.133%20474.533%20351.2%20427.067%20350.4L384%20349.733V462.933Z'%20fill='%233B5695'/%3e%3c/svg%3e",q=(e,t)=>{const o=e.__vccOpts||e;for(const[i,r]of t)o[i]=r;return o},cn={name:"Logo"},dn={src:sn,alt:"DDict Logo",class:"w-6 h-6 cursor-pointer"};function un(e,t,o,i,r,a){return n.openBlock(),n.createElementBlock("img",dn)}const fn=q(cn,[["render",un]]),mn={},hn={class:"w-12 h-12 text-primary",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},pn=[n.createStaticVNode('<circle cx="18" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".67" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".33" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="6" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin="0" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle>',3)];function gn(e,t){return n.openBlock(),n.createElementBlock("svg",hn,pn)}const Cn=q(mn,[["render",gn]]),bn={class:"rounded-lg bg-base-100 px-4 py-2 border border-base-300 shadow-lg"},wn={class:"flex justify-center"},yn={__name:"Loading",setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",bn,[n.createElementVNode("div",wn,[n.createVNode(Cn)])]))}},xn={name:"Phonetic",props:["phonetic"]},En={class:"p-0 m-0"},kn={class:"text-xs font-md text-base-content/60"};function vn(e,t,o,i,r,a){return n.openBlock(),n.createElementBlock("p",En,[n.createElementVNode("span",kn,"/"+n.toDisplayString(o.phonetic)+"/",1)])}const Ln=q(xn,[["render",vn]]),Sn={class:"flex flex-col gap-2"},Bn={__name:"Sentences",props:{sentences:{type:String,default:""}},setup(e){const t=e,o=n.computed(()=>t.sentences.split(`
|
|
2
|
+
`));return(i,r)=>(n.openBlock(),n.createElementBlock("div",Sn,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.value,(a,l)=>(n.openBlock(),n.createElementBlock("p",{key:l,class:"text-base text-base-content leading-tight p-0 mr-2"},n.toDisplayString(a),1))),128))]))}},Tn=[n.createElementVNode("p",{class:"text-sm font-medium text-primary text-center"},[n.createTextVNode(" 🤔 Don't understand? "),n.createElementVNode("span",{class:"text-secondary font-semibold"},"Try AI"),n.createTextVNode(" ✨ ")],-1)],An={__name:"AIPromptButton",props:{show:{type:Boolean,default:!1},isLoading:{type:Boolean,default:!1}},emits:["click"],setup(e){return(t,o)=>e.show?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["mt-2 p-2 bg-gradient-to-r rounded-lg border transition-all duration-200",e.isLoading?"from-primary/5 to-secondary/5 border-primary/10 cursor-not-allowed opacity-75":"from-primary/10 to-secondary/10 border-primary/20 cursor-pointer hover:from-primary/20 hover:to-secondary/20 hover:border-primary/30"]),onClick:o[0]||(o[0]=i=>!e.isLoading&&t.$emit("click"))},Tn,2)):n.createCommentVNode("",!0)}},$n=[n.createElementVNode("p",{class:"text-sm font-medium text-accent text-center"},"💡 Need Summary? ✨",-1)],Rn={__name:"AIExplainPromptButton",props:{show:{type:Boolean,default:!1},isLoading:{type:Boolean,default:!1}},emits:["click"],setup(e){return(t,o)=>e.show?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["mt-2 p-2 bg-gradient-to-r rounded-lg border transition-all duration-200",e.isLoading?"from-accent/5 to-info/5 border-accent/10 cursor-not-allowed opacity-75":"from-accent/10 to-info/10 border-accent/20 cursor-pointer hover:from-accent/20 hover:to-info/20 hover:border-accent/30"]),onClick:o[0]||(o[0]=i=>!e.isLoading&&t.$emit("click"))},$n,2)):n.createCommentVNode("",!0)}},Vn=[n.createElementVNode("p",{class:"text-sm font-medium text-success text-center"},[n.createTextVNode(" 📚 Learn this? "),n.createElementVNode("span",{class:"text-warning font-semibold"},"Study now"),n.createTextVNode(" 🎯 ")],-1)],Nn={__name:"LearnPromptButton",props:{show:{type:Boolean,default:!1}},emits:["click"],setup(e){return(t,o)=>e.show?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["mt-2 p-2 bg-gradient-to-r rounded-lg border transition-all duration-200","from-success/10 to-warning/10 border-success/20 cursor-pointer hover:from-success/20 hover:to-warning/20 hover:border-success/30"]),onClick:o[0]||(o[0]=i=>t.$emit("click"))},Vn)):n.createCommentVNode("",!0)}},In={class:"capitalize text-base italic font-normal text-base-content/60"},Mn={class:"text-base leading-6 text-base-content"},_n={__name:"Dict",props:{dictionary:Array},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.dictionary,(i,r)=>(n.openBlock(),n.createElementBlock("div",{key:r,class:"mt-2"},[n.createElementVNode("p",In,n.toDisplayString(i.pos),1),n.createElementVNode("span",Mn,n.toDisplayString(i.terms.join(", ")),1)]))),128))]))}},Fn={class:""},zn=n.createElementVNode("p",{class:"capitalize text-base italic font-normal text-base-content/60 mt-2"},"Summary",-1),Dn={key:0,class:"list-none list-outside mt-2"},On=["innerHTML"],Wn={__name:"Explanation",props:{explanation:Object},setup(e){return(t,o)=>{var i,r;return n.openBlock(),n.createElementBlock("div",Fn,[zn,(i=e.explanation)!=null&&i.result?(n.openBlock(),n.createElementBlock("ul",Dn,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(((r=e.explanation)==null?void 0:r.result.split(`
|
|
3
|
+
`))||[],(a,l)=>(n.openBlock(),n.createElementBlock("li",{key:`${a}-${l}`,innerHTML:a,class:"text-base text-base-content"},null,8,On))),128))])):n.createCommentVNode("",!0)])}}},Pn=["disabled"],Hn=[n.createElementVNode("path",{d:"M2.33325 4.66667H3.51125C3.82693 4.6667 4.13239 4.55473 4.37325 4.35067L6.83392 2.26667C6.99592 2.12953 7.19374 2.04156 7.40407 2.01312C7.61441 1.98468 7.82849 2.01696 8.02109 2.10615C8.21369 2.19534 8.37678 2.33772 8.49114 2.51652C8.60551 2.69532 8.66638 2.90309 8.66659 3.11534V12.8847C8.66649 13.097 8.60565 13.305 8.49125 13.4839C8.37685 13.6628 8.21367 13.8053 8.02094 13.8945C7.82822 13.9837 7.614 14.0159 7.40356 13.9874C7.19312 13.9588 6.99523 13.8707 6.83325 13.7333L4.37325 11.6487C4.13229 11.4449 3.82685 11.3331 3.51125 11.3333H2.33325C2.06804 11.3333 1.81368 11.228 1.62615 11.0404C1.43861 10.8529 1.33325 10.5986 1.33325 10.3333V5.66667C1.33325 5.40145 1.43861 5.1471 1.62615 4.95956C1.81368 4.77203 2.06804 4.66667 2.33325 4.66667ZM11.1779 11.18C11.5969 10.763 11.9294 10.2674 12.1562 9.72156C12.3831 9.17572 12.4999 8.59044 12.4999 7.99934C12.4999 7.40823 12.3831 6.82295 12.1562 6.27711C11.9294 5.73127 11.5969 5.23564 11.1779 4.81867C11.1317 4.77098 11.0765 4.73297 11.0155 4.70686C10.9544 4.68075 10.8888 4.66705 10.8224 4.66657C10.756 4.66609 10.6902 4.67883 10.6288 4.70406C10.5674 4.72929 10.5116 4.76649 10.4647 4.8135C10.4179 4.86051 10.3808 4.91639 10.3558 4.97787C10.3307 5.03935 10.3181 5.10521 10.3188 5.17159C10.3195 5.23798 10.3334 5.30357 10.3597 5.36453C10.3859 5.42549 10.4241 5.48061 10.4719 5.52667C10.7977 5.85079 11.0562 6.23609 11.2326 6.66043C11.409 7.08477 11.4998 7.53979 11.4998 7.99934C11.4998 8.45888 11.409 8.9139 11.2326 9.33824C11.0562 9.76258 10.7977 10.1479 10.4719 10.472C10.4241 10.5181 10.3859 10.5732 10.3597 10.6341C10.3334 10.6951 10.3195 10.7607 10.3188 10.8271C10.3181 10.8935 10.3307 10.9593 10.3558 11.0208C10.3808 11.0823 10.4179 11.1382 10.4647 11.1852C10.5116 11.2322 10.5674 11.2694 10.6288 11.2946C10.6902 11.3198 10.756 11.3326 10.8224 11.3321C10.8888 11.3316 10.9544 11.3179 11.0155 11.2918C11.0765 11.2657 11.1317 11.2277 11.1779 11.18ZM12.7113 13.2127C12.6123 13.2126 12.5157 13.1832 12.4335 13.1281C12.3513 13.0731 12.2873 12.9949 12.2495 12.9035C12.2118 12.8121 12.202 12.7115 12.2214 12.6146C12.2408 12.5176 12.2886 12.4285 12.3586 12.3587C12.9317 11.7866 13.3865 11.1071 13.6967 10.359C14.0069 9.61101 14.1666 8.80915 14.1666 7.99934C14.1666 7.18952 14.0069 6.38766 13.6967 5.63963C13.3865 4.8916 12.9317 4.2121 12.3586 3.64C12.3122 3.59351 12.2754 3.53834 12.2503 3.47764C12.2252 3.41693 12.2124 3.35188 12.2124 3.2862C12.2125 3.22052 12.2255 3.15549 12.2507 3.09483C12.2759 3.03417 12.3128 2.97907 12.3593 2.93267C12.4057 2.88627 12.4609 2.84948 12.5216 2.8244C12.5823 2.79932 12.6474 2.78645 12.7131 2.78651C12.7787 2.78657 12.8438 2.79957 12.9044 2.82476C12.9651 2.84995 13.0202 2.88685 13.0666 2.93334C13.7327 3.59825 14.2612 4.38801 14.6218 5.25741C14.9824 6.12681 15.168 7.05879 15.168 8C15.168 8.94122 14.9824 9.87319 14.6218 10.7426C14.2612 11.612 13.7327 12.4018 13.0666 13.0667C13.02 13.1134 12.9646 13.1504 12.9036 13.1756C12.8426 13.2007 12.7772 13.2129 12.7113 13.2127Z",fill:"currentColor"},null,-1)],Un=["disabled"],jn=[n.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z","clip-rule":"evenodd",fill:"currentColor"},null,-1)],Zn={__name:"Player",props:{tts:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["loadTTS"],setup(e,{emit:t}){const o=e,i=t,r=n.computed(()=>o.tts),a=n.ref(!1),l=new Audio,c=new(window.AudioContext||window.webkitAudioContext);let s=null;n.watch(r,()=>{if(!r.value){a.value=!1;return}f()},{immediate:!0}),n.onUnmounted(()=>{g(),l.src="",c.close()});function d(){if(r.value){f();return}a.value=!0,i("loadTTS")}async function f(){if(r.value){a.value=!0;try{l.src=r.value,l.playbackRate=.7,await l.play(),l.onended=()=>{a.value=!1}}catch{await p()}}}async function p(){try{const h=await(await fetch(r.value)).arrayBuffer(),b=await c.decodeAudioData(h);s=c.createBufferSource(),s.buffer=b,s.playbackRate.value=.7,s.connect(c.destination),s.start(),s.onended=()=>{a.value=!1,s=null}}catch{a.value=!1}}function g(){s&&(s.stop(),s.disconnect(),s=null),l.pause(),l.currentTime=0,a.value=!1}return(m,h)=>a.value?(n.openBlock(),n.createElementBlock("button",{key:1,class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled,onClick:g},[(n.openBlock(),n.createElementBlock("svg",{class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},jn,2))],10,Un)):(n.openBlock(),n.createElementBlock("button",{key:0,class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled,onClick:d},[(n.openBlock(),n.createElementBlock("svg",{class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Hn,2))],10,Pn))}},qn={class:"bg-base-100 tooltip tooltip-top before:!bottom-[100%] before:!bg-base-100 before:!border before:!border-solid before:!border-base-300 before:!shadow-lg before:!rounded-md before:!text-base-content after:!border-transparent","data-tip":"Favorite"},Xn=["disabled"],Yn=[n.createElementVNode("path",{d:"M14.9491 5.89315C14.8278 5.53128 14.5111 5.27252 14.1226 5.21783L10.5264 4.7114L8.91813 1.55315C8.74435 1.21195 8.39257 1 7.99998 1C7.60739 1 7.25557 1.21195 7.08183 1.55315L5.47358 4.7114L1.8774 5.21783C1.48888 5.27252 1.17219 5.53128 1.05086 5.89315C0.929554 6.25501 1.02881 6.64477 1.30993 6.91038L3.91217 9.36871L3.29786 12.8399C3.2315 13.215 3.38755 13.5868 3.7052 13.8105C3.88128 13.9344 4.08938 14 4.30704 14C4.47232 14 4.63705 13.9606 4.78341 13.886L7.99995 12.2471L11.2165 13.886C11.3628 13.9606 11.5276 14 11.6929 14C11.9106 14 12.1187 13.9345 12.2948 13.8105C12.6124 13.5868 12.7685 13.215 12.7021 12.84L12.0878 9.36871L14.6901 6.91035C14.9712 6.64477 15.0704 6.25498 14.9491 5.89315ZM14.0266 6.25082L11.2455 8.87813C11.1335 8.98392 11.0824 9.13637 11.1089 9.28575L11.7654 12.9956C11.7701 13.0226 11.759 13.0493 11.7362 13.0653C11.7202 13.0766 11.7038 13.079 11.6929 13.079C11.6809 13.079 11.6694 13.0762 11.6587 13.0708L8.22108 11.3192C8.15189 11.284 8.07593 11.2663 7.99998 11.2663C7.92402 11.2663 7.84807 11.284 7.77882 11.3193L4.34118 13.0708C4.33052 13.0763 4.31904 13.079 4.30701 13.079C4.29611 13.079 4.27969 13.0767 4.26373 13.0654C4.24092 13.0494 4.22975 13.0226 4.2345 12.9957L4.89104 9.28584C4.91747 9.13646 4.86637 8.98401 4.75439 8.87822L1.97327 6.25091C1.95308 6.23184 1.94595 6.20383 1.95466 6.17786C1.9634 6.15185 1.98612 6.13326 2.01405 6.12933L5.85743 5.58807C6.0122 5.56626 6.14599 5.47208 6.21521 5.33616L7.93404 1.9608C7.94653 1.9363 7.97178 1.92107 7.99998 1.92107C8.02818 1.92107 8.05343 1.9363 8.06591 1.9608L9.78468 5.33607C9.85391 5.47199 9.9877 5.5662 10.1425 5.58799L13.9859 6.12924C14.0138 6.1332 14.0365 6.15176 14.0452 6.17777C14.0539 6.20374 14.0468 6.23175 14.0266 6.25082Z",fill:"currentColor"},null,-1)],Kn=[n.createElementVNode("path",{d:"M7.47207 1.31905C7.57125 1.12371 7.77589 1 8.00001 1C8.22413 1 8.42877 1.12367 8.52795 1.31905L10.3721 4.95175L14.4959 5.53427C14.7177 5.5656 14.9019 5.7166 14.9712 5.9238C15.0404 6.13101 14.9827 6.35843 14.8222 6.51049L11.8382 9.33816L12.5427 13.3309C12.5806 13.5456 12.4897 13.7626 12.3084 13.8906C12.1272 14.0187 11.8868 14.0356 11.6884 13.9342L8.00004 12.0491L4.31158 13.9343C4.11323 14.0356 3.87286 14.0187 3.69157 13.8907C3.51028 13.7627 3.4195 13.5457 3.45736 13.3309L4.1618 9.33819L1.17781 6.51052C1.01735 6.35846 0.959571 6.13101 1.02884 5.92383C1.09807 5.71663 1.28232 5.56563 1.50409 5.53431L5.62787 4.95178L7.47207 1.31905Z",fill:"currentColor"},null,-1)],Gn={__name:"Favorite",props:{isFilled:Boolean,disabled:Boolean},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",qn,[n.createElementVNode("button",{class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled},[e.isFilled?(n.openBlock(),n.createElementBlock("svg",{key:1,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Kn,2)):(n.openBlock(),n.createElementBlock("svg",{key:0,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Yn,2))],10,Xn)]))}},Jn={},Qn={class:"w-6 h-6 text-primary",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},eo=[n.createStaticVNode('<circle cx="18" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".67" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".33" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="6" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin="0" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle>',3)];function to(e,t){return n.openBlock(),n.createElementBlock("svg",Qn,eo)}const $e=q(Jn,[["render",to]]),no={class:"bg-base-100 tooltip tooltip-top before:!bottom-[100%] before:!bg-base-100 before:!border before:!border-solid before:!border-base-300 before:!shadow-lg before:!rounded-md before:!text-base-content after:!border-transparent","data-tip":"AI Translate"},oo=["disabled"],io=[n.createElementVNode("path",{d:"M6.8544 3.20309C5.39975 2.89815 4.26277 1.76117 3.95787 0.30649C3.92042 0.12792 3.76292 0 3.58041 0C3.3979 0 3.2404 0.12792 3.20297 0.30652C2.89805 1.76117 1.76107 2.89812 0.306418 3.20302C0.127818 3.24045 -0.00012207 3.39798 -0.00012207 3.58046C-0.00012207 3.76295 0.127798 3.92047 0.306418 3.9579C1.76105 4.26285 2.89798 5.3998 3.2029 6.85448C3.24033 7.03307 3.39783 7.16102 3.58034 7.16102C3.76282 7.16102 3.92035 7.0331 3.95778 6.85448C4.26272 5.39983 5.39973 4.26287 6.85438 3.95799C7.03297 3.92056 7.16092 3.76306 7.16092 3.58056C7.1609 3.39805 7.03297 3.24052 6.8544 3.20309ZM3.58036 5.60938C3.14292 4.73132 2.42956 4.01792 1.55151 3.58049C2.42958 3.14305 3.14297 2.42968 3.58041 1.55161C4.01785 2.4297 4.73122 3.14307 5.60926 3.58053C4.73119 4.01797 4.0178 4.73132 3.58036 5.60938Z",fill:"currentColor"},null,-1),n.createElementVNode("path",{d:"M6.21683 9.574C5.53147 9.4303 4.99578 8.8947 4.85209 8.2093C4.81466 8.0307 4.65716 7.90271 4.47465 7.90271C4.29217 7.90271 4.13464 8.0306 4.09721 8.2092C3.95352 8.8946 3.4178 9.4303 2.73244 9.574C2.55385 9.6114 2.4259 9.7689 2.4259 9.9514C2.4259 10.1339 2.55383 10.2914 2.73244 10.3288C3.41778 10.4725 3.95349 11.0082 4.09716 11.6936C4.13459 11.8722 4.2921 12.0002 4.4746 12.0002C4.65709 12.0002 4.81461 11.8723 4.85204 11.6936C4.99574 11.0082 5.53145 10.4725 6.21683 10.3289C6.39543 10.2914 6.52337 10.1339 6.52337 9.9514C6.52337 9.7689 6.39545 9.6114 6.21683 9.574ZM4.47463 10.6408C4.29163 10.3688 4.05725 10.1345 3.78526 9.9515C4.0573 9.7684 4.29163 9.5341 4.47463 9.2621C4.65765 9.5341 4.892 9.7685 5.164 9.9515C4.892 10.1345 4.65763 10.3688 4.47463 10.6408Z",fill:"currentColor"},null,-1),n.createElementVNode("path",{d:"M11.4271 6.00324C10.5007 5.80904 9.7766 5.08496 9.5825 4.15859C9.545 3.98 9.3875 3.85205 9.205 3.85205C9.0225 3.85205 8.865 3.97995 8.8276 4.15857C8.6334 5.08496 7.90932 5.80902 6.98293 6.0032C6.80434 6.04063 6.67639 6.19815 6.67639 6.38064C6.67639 6.56312 6.80431 6.72062 6.98293 6.75807C7.9093 6.95228 8.6334 7.67633 8.8275 8.6027C8.865 8.7813 9.0225 8.9093 9.205 8.9093C9.3875 8.9093 9.545 8.7814 9.5824 8.6027C9.7766 7.67633 10.5007 6.95228 11.4271 6.75812C11.6057 6.72067 11.7336 6.56317 11.7336 6.38068C11.7336 6.1982 11.6057 6.04067 11.4271 6.00324ZM9.205 7.47681C8.9365 7.02634 8.5593 6.64914 8.1089 6.38066C8.5593 6.11218 8.9365 5.73502 9.205 5.28453C9.4735 5.73502 9.8507 6.11221 10.3012 6.38068C9.8507 6.64916 9.4735 7.02636 9.205 7.47681Z",fill:"currentColor"},null,-1)],ro=[n.createStaticVNode('<path d="M6.8544 3.20309C5.39975 2.89815 4.26277 1.76117 3.95787 0.30649C3.92042 0.12792 3.76292 0 3.58041 0C3.3979 0 3.2404 0.12792 3.20297 0.30652C2.89805 1.76117 1.76107 2.89812 0.306418 3.20302C0.127818 3.24045 -0.00012207 3.39798 -0.00012207 3.58046C-0.00012207 3.76295 0.127798 3.92047 0.306418 3.9579C1.76105 4.26285 2.89798 5.3998 3.2029 6.85448C3.24033 7.03307 3.39783 7.16102 3.58034 7.16102C3.76282 7.16102 3.92035 7.0331 3.95778 6.85448C4.26272 5.39983 5.39973 4.26287 6.85438 3.95799C7.03297 3.92056 7.16092 3.76306 7.16092 3.58056C7.1609 3.39805 7.03297 3.24052 6.8544 3.20309ZM3.58036 5.60938C3.14292 4.73132 2.42956 4.01792 1.55151 3.58049C2.42958 3.14305 3.14297 2.42968 3.58041 1.55161C4.01785 2.4297 4.73122 3.14307 5.60926 3.58053C4.73119 4.01797 4.0178 4.73132 3.58036 5.60938Z" fill="currentColor"></path><path d="M6.21683 9.574C5.53147 9.4303 4.99578 8.8947 4.85209 8.2093C4.81466 8.0307 4.65716 7.90271 4.47465 7.90271C4.29217 7.90271 4.13464 8.0306 4.09721 8.2092C3.95352 8.8946 3.4178 9.4303 2.73244 9.574C2.55385 9.6114 2.4259 9.7689 2.4259 9.9514C2.4259 10.1339 2.55383 10.2914 2.73244 10.3288C3.41778 10.4725 3.95349 11.0082 4.09716 11.6936C4.13459 11.8722 4.2921 12.0002 4.4746 12.0002C4.65709 12.0002 4.81461 11.8723 4.85204 11.6936C4.99574 11.0082 5.53145 10.4725 6.21683 10.3289C6.39543 10.2914 6.52337 10.1339 6.52337 9.9514C6.52337 9.7689 6.39545 9.6114 6.21683 9.574ZM4.47463 10.6408C4.29163 10.3688 4.05725 10.1345 3.78526 9.9515C4.0573 9.7684 4.29163 9.5341 4.47463 9.2621C4.65765 9.5341 4.892 9.7685 5.164 9.9515C4.892 10.1345 4.65763 10.3688 4.47463 10.6408Z" fill="currentColor"></path><path d="M11.4271 6.00324C10.5007 5.80904 9.7766 5.08496 9.5825 4.15859C9.545 3.98 9.3875 3.85205 9.205 3.85205C9.0225 3.85205 8.865 3.97995 8.8276 4.15857C8.6334 5.08496 7.90932 5.80902 6.98293 6.0032C6.80434 6.04063 6.67639 6.19815 6.67639 6.38064C6.67639 6.56312 6.80431 6.72062 6.98293 6.75807C7.9093 6.95228 8.6334 7.67633 8.8275 8.6027C8.865 8.7813 9.0225 8.9093 9.205 8.9093C9.3875 8.9093 9.545 8.7814 9.5824 8.6027C9.7766 7.67633 10.5007 6.95228 11.4271 6.75812C11.6057 6.72067 11.7336 6.56317 11.7336 6.38068C11.7336 6.1982 11.6057 6.04067 11.4271 6.00324ZM9.205 7.47681C8.9365 7.02634 8.5593 6.64914 8.1089 6.38066C8.5593 6.11218 8.9365 5.73502 9.205 5.28453C9.4735 5.73502 9.8507 6.11221 10.3012 6.38068C9.8507 6.64916 9.4735 7.02636 9.205 7.47681Z" fill="currentColor"></path><circle cx="3.5" cy="3.5" r="1.5" fill="currentColor"></circle><ellipse cx="4.5" cy="10" rx="0.5" ry="1" fill="currentColor"></ellipse><circle cx="9" cy="6" r="1" fill="currentColor"></circle>',6)],lo={__name:"AITranslateBtn",props:{isLoading:Boolean,disabled:Boolean,isFilled:Boolean},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",no,[e.isLoading?(n.openBlock(),n.createBlock($e,{key:0,class:"inset-0 flex items-center justify-center"})):(n.openBlock(),n.createElementBlock("button",{key:1,class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled},[e.isFilled?(n.openBlock(),n.createElementBlock("svg",{key:1,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ro,2)):(n.openBlock(),n.createElementBlock("svg",{key:0,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},io,2))],10,oo))]))}},ao={class:"bg-base-100 tooltip tooltip-top before:!bottom-[100%] before:!bg-base-100 before:!border before:!border-solid before:!border-base-300 before:!shadow-lg before:!rounded-md before:!text-base-content after:!border-transparent","data-tip":"AI Summarize"},so=["disabled"],co=[n.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12h1m-3.5-6.5 1-1M12 3V2M5.5 5.5l-1-1M3 12H2m8 10h4m3-10a5 5 0 1 0-7 4.584V19h4v-2.416A5.001 5.001 0 0 0 17 12z"},null,-1)],uo=[n.createElementVNode("path",{fill:"currentColor",d:"M12 7a5 5 0 0 0-2 9.584V19h4v-2.416A5.001 5.001 0 0 0 12 7z"},null,-1),n.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12h1m-3.5-6.5 1-1M12 3V2M5.5 5.5l-1-1M3 12H2m8 10h4m3-10a5 5 0 1 0-7 4.584V19h4v-2.416A5.001 5.001 0 0 0 17 12z"},null,-1)],fo={__name:"AIExplainBtn",props:{isLoading:Boolean,disabled:Boolean,isFilled:Boolean},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",ao,[e.isLoading?(n.openBlock(),n.createBlock($e,{key:0})):(n.openBlock(),n.createElementBlock("button",{key:1,class:n.normalizeClass(["btn btn-xs btn-circle",[{"btn-ghost":!e.disabled},{"!bg-transparent !border-none !shadow-none !ring-0":e.disabled}]]),disabled:e.disabled},[e.isFilled?(n.openBlock(),n.createElementBlock("svg",{key:1,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},uo,2)):(n.openBlock(),n.createElementBlock("svg",{key:0,class:n.normalizeClass(["w-4 h-4 text-primary",[{"opacity-100":!e.disabled},{"opacity-50 transform":e.disabled}]]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},co,2))],10,so))]))}},mo={},ho={class:"btn btn-xs btn-ghost btn-circle"},po=[n.createElementVNode("svg",{class:"w-4 h-4 text-primary",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{d:"M9.12596 1.63869C9.46935 1.54364 9.83221 1.70329 9.99413 2.02068C10.3672 2.75191 11.1261 3.25 12 3.25C12.8739 3.25 13.6328 2.75191 14.0059 2.02068C14.1678 1.70329 14.5307 1.54364 14.874 1.63869C16.5585 2.10497 18.0759 2.9704 19.3184 4.12574C19.5611 4.35137 19.6269 4.70948 19.4804 5.00666C19.3331 5.30535 19.25 5.6419 19.25 6C19.25 7.24263 20.2574 8.25 21.5 8.25L21.5314 8.24977C21.8629 8.24504 22.1583 8.45859 22.2576 8.77495C22.5777 9.79397 22.75 10.8776 22.75 12C22.75 12.7408 22.6749 13.4649 22.5318 14.1648C22.4548 14.5411 22.1059 14.7985 21.7237 14.7609C21.6504 14.7537 21.5758 14.75 21.5 14.75C20.2574 14.75 19.25 15.7574 19.25 17C19.25 17.5531 19.4486 18.0579 19.7793 18.4498C20.027 18.7434 20.0128 19.1767 19.7465 19.4535C18.4777 20.7719 16.8745 21.7678 15.0721 22.3044C14.6807 22.4209 14.2681 22.2029 14.1437 21.814C13.8535 20.906 13.0024 20.25 12 20.25C10.9976 20.25 10.1465 20.906 9.85629 21.814C9.73195 22.2029 9.31927 22.4209 8.92789 22.3044C7.12545 21.7678 5.52229 20.7719 4.25353 19.4535C3.98716 19.1767 3.97299 18.7434 4.22072 18.4498C4.55139 18.0579 4.75 17.5531 4.75 17C4.75 15.7574 3.74264 14.75 2.5 14.75C2.42423 14.75 2.34963 14.7537 2.27634 14.7609C1.89406 14.7985 1.54519 14.5411 1.46821 14.1648C1.32505 13.4649 1.25 12.7408 1.25 12C1.25 10.8776 1.42227 9.79398 1.74236 8.77494C1.84173 8.45859 2.13705 8.24504 2.4686 8.24977L2.5 8.25C3.74264 8.25 4.75 7.24263 4.75 6C4.75 5.6419 4.66689 5.30535 4.51962 5.00666C4.3731 4.70948 4.43894 4.35137 4.68159 4.12574C5.92411 2.9704 7.44153 2.10497 9.12596 1.63869ZM6.08277 4.88991C6.19152 5.24123 6.25 5.61424 6.25 6C6.25 7.88945 4.85261 9.45253 3.03493 9.71213C2.84898 10.4432 2.75 11.2096 2.75 12C2.75 12.4294 2.77921 12.8516 2.83567 13.2648C4.74948 13.4346 6.25 15.0421 6.25 17C6.25 17.6669 6.0754 18.2941 5.76971 18.8372C6.62645 19.6184 7.63002 20.2404 8.73362 20.657C9.37706 19.5189 10.598 18.75 12 18.75C13.402 18.75 14.6229 19.5189 15.2664 20.657C16.37 20.2404 17.3735 19.6184 18.2303 18.8372C17.9246 18.2941 17.75 17.6669 17.75 17C17.75 15.0421 19.2505 13.4346 21.1643 13.2648C21.2208 12.8516 21.25 12.4294 21.25 12C21.25 11.2096 21.151 10.4432 20.9651 9.71213C19.1474 9.45252 17.75 7.88945 17.75 6C17.75 5.61424 17.8085 5.24123 17.9172 4.88991C17.0618 4.1771 16.0762 3.61614 15.0018 3.24775C14.3184 4.15897 13.2287 4.75 12 4.75C10.7713 4.75 9.68158 4.15897 8.99819 3.24775C7.92382 3.61614 6.93823 4.1771 6.08277 4.88991Z",fill:"currentColor"}),n.createElementVNode("path",{d:"M7.75 12C7.75 9.65278 9.65279 7.75 12 7.75C14.3472 7.75 16.25 9.65278 16.25 12C16.25 14.3472 14.3472 16.25 12 16.25C9.65279 16.25 7.75 14.3472 7.75 12ZM12 9.25C10.4812 9.25 9.25 10.4812 9.25 12C9.25 13.5188 10.4812 14.75 12 14.75C13.5188 14.75 14.75 13.5188 14.75 12C14.75 10.4812 13.5188 9.25 12 9.25Z",fill:"currentColor"})],-1)];function go(e,t){return n.openBlock(),n.createElementBlock("button",ho,po)}const Co=q(mo,[["render",go]]),bo={},wo={class:"btn btn-xs btn-circle btn-ghost"},yo=[n.createElementVNode("svg",{class:"w-4 h-4 text-primary",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.19102 3.19102C3.44571 2.93633 3.85864 2.93633 4.11333 3.19102L12.809 11.8867C13.0637 12.1414 13.0637 12.5543 12.809 12.809C12.5543 13.0637 12.1414 13.0637 11.8867 12.809L3.19102 4.11333C2.93633 3.85864 2.93633 3.44571 3.19102 3.19102Z",fill:"currentColor"}),n.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.809 3.19102C13.0637 3.44571 13.0637 3.85864 12.809 4.11333L4.11333 12.809C3.85864 13.0637 3.44571 13.0637 3.19102 12.809C2.93633 12.5543 2.93633 12.1414 3.19102 11.8867L11.8867 3.19102C12.1414 2.93633 12.5543 2.93633 12.809 3.19102Z",fill:"currentColor"})],-1)];function xo(e,t){return n.openBlock(),n.createElementBlock("button",wo,yo)}const Eo=q(bo,[["render",xo]]),ko={name:"ThemeSelector",props:{currentTheme:{type:String,default:"lofi"}},data(){return{availableThemes:[{value:"lofi",name:"Lo-Fi",color:"#0f0f23"},{value:"pastel",name:"Pastel",color:"#d1c1d7"},{value:"fantasy",name:"Fantasy",color:"#6e0b75"},{value:"autumn",name:"Autumn",color:"#8c0327"},{value:"retro",name:"Retro",color:"#ef9995"},{value:"synthwave",name:"Synthwave",color:"#e779c1"},{value:"halloween",name:"Halloween",color:"#f28c18"},{value:"dracula",name:"Dracula",color:"#ff79c6"},{value:"coffee",name:"Coffee",color:"#db924b"},{value:"dim",name:"Dim",color:"#9fe88d"},{value:"sunset",name:"Sunset",color:"#ff865b"},{value:"cyberpunk",name:"Cyberpunk",color:"#ff7598"}]}},methods:{handleThemeChange(e){this.$emit("themeChange",e)},handleLabelClick(e){e.stopPropagation(),this.$nextTick(()=>{const t=this.$el.querySelector('[role="button"]');t&&t.blur()})}}},vo={class:"dropdown dropdown-end z-50"},Lo=n.createElementVNode("div",{tabindex:"0",role:"button",class:"btn btn-ghost btn-circle btn-xs"},[n.createElementVNode("svg",{class:"w-4 h-4 text-primary",fill:"currentColor",viewBox:"0 0 20 20"},[n.createElementVNode("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})])],-1),So={tabindex:"0",class:"dropdown-content menu p-2 shadow bg-base-100 rounded-box w-52 max-h-96 overflow-y-auto z-50 border border-base-300"},Bo=["id","value","checked","onChange"],To=["for"],Ao={class:"flex items-center gap-2"};function $o(e,t,o,i,r,a){return n.openBlock(),n.createElementBlock("div",vo,[Lo,n.createElementVNode("ul",So,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.availableThemes,l=>(n.openBlock(),n.createElementBlock("li",{key:l.value},[n.createElementVNode("input",{type:"radio",id:`theme-${l.value}`,value:l.value,checked:o.currentTheme===l.value,onChange:c=>a.handleThemeChange(l.value),class:"theme-controller sr-only"},null,40,Bo),n.createElementVNode("label",{for:`theme-${l.value}`,class:n.normalizeClass(["cursor-pointer rounded-lg px-2 py-1 hover:bg-base-200",{"bg-primary text-primary-content":o.currentTheme===l.value}]),onClick:t[0]||(t[0]=(...c)=>a.handleLabelClick&&a.handleLabelClick(...c))},[n.createElementVNode("span",Ao,[n.createElementVNode("span",{class:"w-3 h-3 rounded-full",style:n.normalizeStyle({backgroundColor:l.color})},null,4),n.createTextVNode(" "+n.toDisplayString(l.name),1)])],10,To)]))),128))])])}const Ro=q(ko,[["render",$o]]),Vo={class:"flex flex-col"},No={class:"flex min-w-0 gap-1","data-mode-toggle":""},Io=["disabled"],Mo={class:"flex shrink-0 items-center"},_o={key:0,class:"flex items-center gap-1 px-2 pb-1"},at={__name:"Header",props:{tts:String,isServiceUnavailable:Boolean,isFavorite:Boolean,isFavoriteFeatureEnabled:Boolean,isAITranslate:Boolean,isAIExplain:Boolean,isAITranslationLoading:Boolean,isAIExplainLoading:Boolean,isAIExplainVisible:Boolean,isAITranslateVisible:Boolean,theme:{type:String,default:"lofi"},showThemeSelector:{type:Boolean,default:!0},mode:{type:String,default:"translate"},canWrite:{type:Boolean,default:!0}},emits:["favorite","setting","close","loadTTS","aiTranslate","aiExplain","themeChange","dragStart","requestTranslate","requestWrite"],setup(e,{emit:t}){const o=e,i=n.computed(()=>o.mode!=="write"&&!o.isServiceUnavailable),r=t,a=c=>{c.target.closest('button, input, select, textarea, [role="button"]')||(r("dragStart",{type:"mouse",event:c}),c.preventDefault())},l=c=>{c.target.closest('button, input, select, textarea, [role="button"]')||(r("dragStart",{type:"touch",event:c}),c.preventDefault())};return(c,s)=>(n.openBlock(),n.createElementBlock("div",Vo,[n.createElementVNode("div",{class:"flex cursor-grab flex-row items-center justify-between gap-1 p-2 pb-1 active:cursor-grabbing",onMousedown:a,onTouchstart:l},[n.createElementVNode("div",No,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["btn btn-xs",e.mode==="write"?"btn-ghost":"btn-primary"]),"data-mode":"translate",onClick:s[0]||(s[0]=d=>r("requestTranslate"))}," Translate ",2),n.createElementVNode("button",{type:"button",class:n.normalizeClass(["btn btn-xs",e.mode==="write"?"btn-primary":"btn-ghost"]),disabled:!e.canWrite,"data-mode":"write",onClick:s[1]||(s[1]=d=>r("requestWrite"))}," Write ",10,Io)]),n.createElementVNode("div",Mo,[e.showThemeSelector?(n.openBlock(),n.createBlock(Ro,{key:0,"current-theme":e.theme,onThemeChange:s[2]||(s[2]=d=>r("themeChange",d))},null,8,["current-theme"])):n.createCommentVNode("",!0),n.createVNode(Co,{onClick:s[3]||(s[3]=d=>r("setting"))}),n.createVNode(Eo,{onClick:s[4]||(s[4]=d=>r("close"))})])],32),i.value?(n.openBlock(),n.createElementBlock("div",_o,[n.createVNode(Zn,{disabled:e.isAITranslationLoading||e.isAIExplainLoading,tts:o.tts,onLoadTTS:s[5]||(s[5]=d=>c.$emit("loadTTS"))},null,8,["disabled","tts"]),e.isAITranslateVisible?(n.openBlock(),n.createBlock(lo,{key:0,isLoading:e.isAITranslationLoading,isFilled:e.isAITranslate,onClick:s[6]||(s[6]=d=>r("aiTranslate"))},null,8,["isLoading","isFilled"])):n.createCommentVNode("",!0),e.isAIExplainVisible?(n.openBlock(),n.createBlock(fo,{key:1,isLoading:e.isAIExplainLoading,isFilled:e.isAIExplain,onClick:s[7]||(s[7]=d=>r("aiExplain"))},null,8,["isLoading","isFilled"])):n.createCommentVNode("",!0),o.isFavoriteFeatureEnabled?(n.openBlock(),n.createBlock(Gn,{key:2,isFilled:o.isFavorite,onClick:s[8]||(s[8]=d=>r("favorite")),disabled:e.isAITranslationLoading||e.isAIExplainLoading},null,8,["isFilled","disabled"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]))}},Fo={class:"pointer-events-none absolute inset-0 z-20"},zo=["data-resize","aria-label","onPointerdown"],Do={__name:"ResizeHandle",emits:["resizeStart"],setup(e,{emit:t}){const o=t,i=[{name:"n",class:"inset-x-3 top-0 h-2 cursor-ns-resize"},{name:"s",class:"inset-x-3 bottom-0 h-2 cursor-ns-resize"},{name:"e",class:"inset-y-3 right-0 w-2 cursor-ew-resize"},{name:"w",class:"inset-y-3 left-0 w-2 cursor-ew-resize"},{name:"nw",class:"left-0 top-0 h-3 w-3 cursor-nwse-resize"},{name:"ne",class:"right-0 top-0 h-3 w-3 cursor-nesw-resize"},{name:"sw",class:"bottom-0 left-0 h-3 w-3 cursor-nesw-resize"},{name:"se",class:"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"}],r=(a,l)=>{var c,s;l.pointerType==="mouse"&&l.button!==0||(l.preventDefault(),l.stopPropagation(),(s=(c=l.currentTarget).setPointerCapture)==null||s.call(c,l.pointerId),o("resizeStart",{edge:a,event:l}))};return(a,l)=>(n.openBlock(),n.createElementBlock("div",Fo,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(i,c=>n.createElementVNode("div",{key:c.name,"data-resize":c.name,class:n.normalizeClass(["pointer-events-auto absolute touch-none hover:bg-base-content/20",c.class]),"aria-label":`Resize from the ${c.name} border`,onPointerdown:s=>r(c.name,s),onClick:l[0]||(l[0]=n.withModifiers(()=>{},["stop"]))},null,42,zo)),64))]))}},Re=4,be="check",Oo=[{value:"check",label:"Check"},{value:"improve",label:"Improve"},{value:"improve-plus",label:"Academy"},{value:"friendly",label:"Friendly"},{value:"simplify",label:"Simplify"},{value:"more-detailed",label:"More detailed"}],Wo=new Set(["","text","search","email","url","tel"]),Po=4e4;function st(e,t){return!!e&&String(t||"").trim().length>=Re}function Ho(e){const t=(e==null?void 0:e.nodeType)===3?e.parentElement:e;if(!t||t.nodeType!==1)return!1;if(Uo(t))return!0;if(t.disabled||t.readOnly)return!1;const o=t.tagName;return o==="TEXTAREA"?!0:o==="INPUT"?Wo.has((t.type||"text").toLowerCase()):!1}function Uo(e){var o;let t=e;for(;t&&t.nodeType===1;){const i=(o=t.getAttribute)==null?void 0:o.call(t,"contenteditable"),r=typeof t.contentEditable=="string"?t.contentEditable:"";if(i==="false"||r==="false")return!1;if(t.isContentEditable||i===""||i==="true"||i==="plaintext-only"||r==="true"||r==="plaintext-only")return!0;t=t.parentElement}return!1}function jo(e,t){const o=ct(e),i=ct(t);return!o.length&&!i.length?[]:o.length*i.length>Po?[{value:String(t||""),added:!1,removed:!1}]:Yo(o,i,Xo(o,i))}function Zo(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function qo(e,t){return jo(e,t).map(o=>{const i=Zo(o.value);return o.added?`<span class="bg-success/40">${i}</span>`:o.removed?`<span class="bg-error/30 line-through">${i}</span>`:i}).join("")}function ct(e){return String(e||"").split(/(\s+)/).filter(t=>t.length)}function Xo(e,t){const o=Array.from({length:e.length+1},()=>new Array(t.length+1).fill(0));for(let i=e.length-1;i>=0;i--)for(let r=t.length-1;r>=0;r--)o[i][r]=e[i]===t[r]?o[i+1][r+1]+1:Math.max(o[i+1][r],o[i][r+1]);return o}function Yo(e,t,o){const i=[];let r=0,a=0;const l=(c,s,d)=>{const f=i[i.length-1];if(f&&f.added===s&&f.removed===d){f.value+=c;return}i.push({value:c,added:s,removed:d})};for(;r<e.length&&a<t.length;)e[r]===t[a]?(l(e[r],!1,!1),r+=1,a+=1):o[r+1][a]>=o[r][a+1]?(l(e[r],!1,!0),r+=1):(l(t[a],!0,!1),a+=1);for(;r<e.length;)l(e[r],!1,!0),r+=1;for(;a<t.length;)l(t[a],!0,!1),a+=1;return i}const Ko={class:"flex flex-col gap-2 border-t border-base-300 p-3","data-write-view":""},Go={class:"flex items-center gap-1"},Jo=["value","disabled"],Qo=["value"],ei=["disabled"],ti={key:0,"data-write-loading":""},ni={key:1,class:"text-base leading-tight text-base-content"},oi=["innerHTML"],ii={key:3,class:"whitespace-pre-wrap break-words text-base leading-tight text-base-content","data-result":""},ri={__name:"WriteView",props:{text:{type:String,default:""},result:{type:String,default:""},action:{type:String,default:"check"},loading:Boolean,editable:Boolean,unavailable:Boolean},emits:["action","copy","replace"],setup(e,{emit:t}){const o=e,i=t,r=n.computed(()=>o.text.trim().length<Re),a=n.computed(()=>!o.loading&&!!o.result),l=n.computed(()=>o.editable&&a.value),c=n.computed(()=>o.action==="check"&&!!o.result),s=n.computed(()=>c.value?qo(o.text,o.result):"");function d(){a.value&&i("copy",o.result)}function f(){l.value&&i("replace",{text:o.text,result:o.result})}return(p,g)=>(n.openBlock(),n.createElementBlock("div",Ko,[n.createElementVNode("div",Go,[n.createElementVNode("select",{class:"select select-bordered select-xs min-w-0 flex-1",value:e.action,disabled:e.loading||r.value,"data-write-action":"",onChange:g[0]||(g[0]=m=>i("action",m.target.value))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Oo),m=>(n.openBlock(),n.createElementBlock("option",{key:m.value,value:m.value},n.toDisplayString(m.label),9,Qo))),128))],40,Jo),n.createElementVNode("button",{type:"button",class:"btn btn-xs",disabled:!a.value,"data-copy":"",onClick:d}," Copy ",8,ei),l.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"btn btn-xs btn-primary","data-replace":"",onClick:f}," Replace ")):n.createCommentVNode("",!0)]),e.loading?(n.openBlock(),n.createElementBlock("div",ti,[n.createVNode($e)])):e.unavailable?(n.openBlock(),n.createElementBlock("p",ni," Service Unavailable ")):c.value?(n.openBlock(),n.createElementBlock("pre",{key:2,class:"m-0 whitespace-pre-wrap break-words text-base leading-tight text-base-content","data-diff":"",innerHTML:s.value},null,8,oi)):e.result?(n.openBlock(),n.createElementBlock("p",ii,n.toDisplayString(e.result),1)):n.createCommentVNode("",!0)]))}},D={LOGO:"LOGO",LOADING:"LOADING",DATA:"DATA",ERROR:"ERROR",HIDDEN:"HIDDEN"},dt=320,li=240,ut=250,ai=120,si=8,ci=["ar","fa","iw","yi","ur","pa"],di={key:0,class:"flex justify-center"},ui={key:1,class:"flex justify-center"},fi={class:"p-3 border-t border-base-300"},mi=Object.assign({name:"Bubble",props:["translation","explanation","tts","status","isFavorite","isFavoriteFeatureEnabled","isAITranslate","isAIExplain","aiExplainMinLength","theme","showThemeSelector","constrained","mode","editable","writing","writeAction","isWriteLoading","selectedText"],emits:["logo","favorite","settings","close","loadTTS","aiTranslate","aiExplain","learn","themeChange","dragStart","resizeStart","write","replace","copy"],data(){return{data:null,isLongSentence:!1,isServiceUnavailable:!1,isAITranslationLoading:!1,isAIExplainLoading:!1}},computed:{showAIPrompt(){var e,t,o;return!this.isAITranslate&&!this.isServiceUnavailable&&((t=(e=this.data)==null?void 0:e.dictionary)==null?void 0:t.length)===0&&!!((o=this.data)!=null&&o.result)},showAIExplainPrompt(){var e,t,o,i,r;return!this.isAIExplain&&!this.isServiceUnavailable&&((t=(e=this.data)==null?void 0:e.dictionary)==null?void 0:t.length)===0&&!!((o=this.data)!=null&&o.result)&&((r=(i=this.data)==null?void 0:i.text)==null?void 0:r.length)>=this.aiExplainMinLength},showLearnPrompt(){var e;return this.isFavorite&&!this.isServiceUnavailable&&!!((e=this.data)!=null&&e.result)},isWrite(){return this.mode==="write"},currentAction(){var e;return this.writeAction||((e=this.writing)==null?void 0:e.action)||be},activeText(){var e,t;return this.selectedText||((e=this.writing)==null?void 0:e.text)||((t=this.data)==null?void 0:t.text)||""},canWrite(){return this.activeText.trim().length>=Re},shownResult(){var e;return!((e=this.writing)!=null&&e.result)||this.selectedText&&this.writing.text&&this.writing.text!==this.selectedText?"":this.writing.result}},methods:{handleLogo(){if(st(this.editable,this.selectedText)){this.$emit("write",{text:this.selectedText,action:this.currentAction});return}this.$emit("logo")},requestWrite(){this.isWrite||!this.canWrite||this.$emit("write",{text:this.activeText,action:this.currentAction})},requestTranslate(){this.isWrite&&this.$emit("logo")},handleWriteAction(e){!this.canWrite||e===this.currentAction||this.$emit("write",{text:this.activeText,action:e})},handleCopy(e){this.$emit("copy",e)},handleReplace(e){this.editable&&this.$emit("replace",e)},handleAITranslate(){this.isAITranslationLoading=!0,this.$emit("aiTranslate")},handleAIExplain(){this.isAIExplainLoading=!0,this.$emit("aiExplain")},handleLearn(){var e,t,o;this.$emit("learn",{word:(e=this.data)==null?void 0:e.text,translation:(t=this.data)==null?void 0:t.result,dictionary:(o=this.data)==null?void 0:o.dictionary})}},watch:{translation:{handler(){var e,t,o,i;try{this.data=this.translation,this.isLongSentence=!((t=(e=this.data)==null?void 0:e.phonetic)!=null&&t.src||((i=(o=this.data)==null?void 0:o.dictionary)==null?void 0:i.length)>0),this.isServiceUnavailable=!1}catch{this.isServiceUnavailable=!0}finally{this.isAITranslationLoading=!1,this.isAIExplainLoading=!1}},immediate:!0},explanation:{handler(){this.isAIExplainLoading=!1},immediate:!0},status(){this.status===D.ERROR&&(this.isServiceUnavailable=!0)}}},{setup(e){return(t,o)=>{var i,r,a,l,c,s,d,f,p,g,m;return e.status===n.unref(D).LOGO?(n.openBlock(),n.createElementBlock("div",di,[n.createVNode(fn,{onClick:t.handleLogo},null,8,["onClick"])])):e.status===n.unref(D).LOADING?(n.openBlock(),n.createElementBlock("div",ui,[n.createVNode(yn)])):e.status!==n.unref(D).HIDDEN?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["wrapper rounded-lg text-base-content text-sm shadow-lg relative bg-[length:300%_300%] bg-[position:0%_50%]",e.constrained?"flex h-full w-full min-w-0 flex-col":"",{"p-0.5 bg-gradient-to-br from-primary via-secondary via-accent to-info animate-moveGradient":e.isAITranslate||e.isAIExplain,"p-0.5 bg-base-300":!e.isAITranslate&&!e.isAIExplain}])},[n.createElementVNode("div",{class:n.normalizeClass(["bg-base-100 rounded-md relative z-10",e.constrained?"flex min-h-0 min-w-0 flex-1 flex-col":""])},[t.isServiceUnavailable?(n.openBlock(),n.createBlock(at,{key:0,class:"shrink-0",isServiceUnavailable:t.isServiceUnavailable,isLongSentence:!1,theme:e.theme,showThemeSelector:e.showThemeSelector,mode:e.mode,canWrite:t.canWrite,onFavorite:o[0]||(o[0]=h=>t.$emit("favorite")),onSetting:o[1]||(o[1]=h=>t.$emit("settings")),onClose:o[2]||(o[2]=h=>t.$emit("close")),onLoadTTS:o[3]||(o[3]=h=>t.$emit("loadTTS")),onThemeChange:o[4]||(o[4]=h=>t.$emit("themeChange",h)),onRequestTranslate:t.requestTranslate,onRequestWrite:t.requestWrite},null,8,["isServiceUnavailable","theme","showThemeSelector","mode","canWrite","onRequestTranslate","onRequestWrite"])):(n.openBlock(),n.createBlock(at,{key:1,class:"shrink-0",tts:e.tts,isFavorite:e.isFavorite,isAITranslate:e.isAITranslate,isAITranslateVisible:((r=(i=t.data)==null?void 0:i.dictionary)==null?void 0:r.length)===0,isAIExplain:e.isAIExplain,isAIExplainVisible:((l=(a=t.data)==null?void 0:a.text)==null?void 0:l.length)>=e.aiExplainMinLength,isAITranslationLoading:t.isAITranslationLoading,isAIExplainLoading:t.isAIExplainLoading,isFavoriteFeatureEnabled:e.isFavoriteFeatureEnabled,isLongSentence:t.isLongSentence,theme:e.theme,showThemeSelector:e.showThemeSelector,mode:e.mode,canWrite:t.canWrite,onFavorite:o[5]||(o[5]=h=>t.$emit("favorite")),onSetting:o[6]||(o[6]=h=>t.$emit("settings")),onClose:o[7]||(o[7]=h=>t.$emit("close")),onLoadTTS:o[8]||(o[8]=h=>t.$emit("loadTTS")),onAiTranslate:t.handleAITranslate,onAiExplain:t.handleAIExplain,onThemeChange:o[9]||(o[9]=h=>t.$emit("themeChange",h)),onDragStart:o[10]||(o[10]=h=>t.$emit("dragStart",h)),onRequestTranslate:t.requestTranslate,onRequestWrite:t.requestWrite},null,8,["tts","isFavorite","isAITranslate","isAITranslateVisible","isAIExplain","isAIExplainVisible","isAITranslationLoading","isAIExplainLoading","isFavoriteFeatureEnabled","isLongSentence","theme","showThemeSelector","mode","canWrite","onAiTranslate","onAiExplain","onRequestTranslate","onRequestWrite"])),n.createElementVNode("div",{class:n.normalizeClass(e.constrained?"min-h-0 min-w-0 flex-1 overflow-y-auto overflow-x-hidden break-words overscroll-contain":"")},[t.isWrite?(n.openBlock(),n.createBlock(ri,{key:0,text:t.activeText,result:t.shownResult,action:t.currentAction,loading:e.isWriteLoading,editable:e.editable,unavailable:t.isServiceUnavailable,onAction:t.handleWriteAction,onCopy:t.handleCopy,onReplace:t.handleReplace},null,8,["text","result","action","loading","editable","unavailable","onAction","onCopy","onReplace"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",fi,[(s=(c=t.data)==null?void 0:c.phonetic)!=null&&s.src?(n.openBlock(),n.createBlock(Ln,{key:0,phonetic:(f=(d=t.data)==null?void 0:d.phonetic)==null?void 0:f.src},null,8,["phonetic"])):n.createCommentVNode("",!0),n.createVNode(Bn,{sentences:t.isServiceUnavailable?"Service Unavailable":(p=t.data)==null?void 0:p.result},null,8,["sentences"]),n.createVNode(An,{show:t.showAIPrompt,isLoading:t.isAITranslationLoading,onClick:t.handleAITranslate},null,8,["show","isLoading","onClick"]),n.createVNode(Rn,{show:t.showAIExplainPrompt,isLoading:t.isAIExplainLoading,onClick:t.handleAIExplain},null,8,["show","isLoading","onClick"]),n.createVNode(Nn,{show:t.showLearnPrompt,onClick:t.handleLearn},null,8,["show","onClick"])]),!t.isServiceUnavailable&&((m=(g=t.data)==null?void 0:g.dictionary)==null?void 0:m.length)>0?(n.openBlock(),n.createBlock(_n,{key:0,class:"p-3 pt-0 border-t border-base-300",dictionary:t.data.dictionary},null,8,["dictionary"])):n.createCommentVNode("",!0),!t.isServiceUnavailable&&e.isAIExplain&&e.explanation?(n.openBlock(),n.createBlock(Wn,{key:1,class:"p-3 pt-0 border-t border-base-300",explanation:e.explanation},null,8,["explanation"])):n.createCommentVNode("",!0)],64))],2),n.createVNode(Do,{onResizeStart:o[11]||(o[11]=h=>t.$emit("resizeStart",h))})],2)],2)):n.createCommentVNode("",!0)}}});function hi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ve={exports:{}},ft;function pi(){return ft||(ft=1,function(e){(function(){var t=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],o=typeof window<"u",i=o&&window.mozInnerScreenX!=null;function r(a,l,c){if(!o)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var s=c&&c.debug||!1;if(s){var d=document.querySelector("#input-textarea-caret-position-mirror-div");d&&d.parentNode.removeChild(d)}var f=document.createElement("div");f.id="input-textarea-caret-position-mirror-div",document.body.appendChild(f);var p=f.style,g=window.getComputedStyle?window.getComputedStyle(a):a.currentStyle,m=a.nodeName==="INPUT";p.whiteSpace="pre-wrap",m||(p.wordWrap="break-word"),p.position="absolute",s||(p.visibility="hidden"),t.forEach(function(w){m&&w==="lineHeight"?p.lineHeight=g.height:p[w]=g[w]}),i?a.scrollHeight>parseInt(g.height)&&(p.overflowY="scroll"):p.overflow="hidden",f.textContent=a.value.substring(0,l),m&&(f.textContent=f.textContent.replace(/\s/g," "));var h=document.createElement("span");h.textContent=a.value.substring(l)||".",f.appendChild(h);var b={top:h.offsetTop+parseInt(g.borderTopWidth),left:h.offsetLeft+parseInt(g.borderLeftWidth),height:parseInt(g.lineHeight)};return s?h.style.backgroundColor="#aaa":document.body.removeChild(f),b}e.exports=r})()}(Ve)),Ve.exports}var gi=pi();const mt=hi(gi);function X(e){const t=window.getSelection();let o=t+"";if(o=o.trim(),e&&e.type==="password"||!o.length&&(!e||e.selectionStart==null||e.selectionEnd==null||e.selectionStart===e.selectionEnd||(o=e.value.substring(e.selectionStart,e.selectionEnd),o=o.trim(),!o.length)))return!1;let i=wi(t),{top:r,bottom:a,left:l,width:c,height:s}=i;if(!a&&!l){if(!e||e.selectionStart==null||e.selectionEnd==null)return!1;let d=mt(e,e.selectionStart),f=mt(e,e.selectionEnd);i=e.getBoundingClientRect(),l=i.left+d.left,c=f.left-d.left,d.top!=f.top&&(l=i.left,c=i.width),r=i.top+d.top,a=i.top+f.top+20}return s===0&&(s=a-r),{text:o,x:l,y:r,top:r,bottom:a,left:l,right:l+c,width:c,height:s}}function Ci(e){var t;return((t=e==null?void 0:e.key)==null?void 0:t.toLowerCase())==="a"&&!!(e.ctrlKey||e.metaKey)}function Ne(e,t){return!!(e||t)}function bi(e){return(e==null?void 0:e.key)==="Control"||(e==null?void 0:e.key)==="Meta"||(e==null?void 0:e.key)==="Shift"||(e==null?void 0:e.key)==="Alt"}function wi(e){if(!e||e.rangeCount===0)return{top:0,bottom:0,left:0,width:0,height:0};try{return e.getRangeAt(0).getBoundingClientRect()}catch{return{top:0,bottom:0,left:0,width:0,height:0}}}function yi(){const e=document.getElementsByTagName("ddict-div");for(let t of e)if(!t.parentNode.matches('wrapper[dir="rtl"]')){const o=document.createElement("wrapper");o.setAttribute("dir","rtl"),t.parentNode.insertBefore(o,t),o.appendChild(t)}}function xi(){const e=document.querySelectorAll('wrapper[dir="rtl"]');for(let t of e){const o=t.querySelector("ddict-div");o&&(t.parentNode.insertBefore(o,t),t.remove())}}const ht={supportRTL:yi,removeRTL:xi},Ei=2,ki={n:{x:!1,y:!0,fromStartX:!1,fromStartY:!0},s:{x:!1,y:!0,fromStartX:!1,fromStartY:!1},e:{x:!0,y:!1,fromStartX:!1,fromStartY:!1},w:{x:!0,y:!1,fromStartX:!0,fromStartY:!1},ne:{x:!0,y:!0,fromStartX:!1,fromStartY:!0},nw:{x:!0,y:!0,fromStartX:!0,fromStartY:!0},se:{x:!0,y:!0,fromStartX:!1,fromStartY:!1},sw:{x:!0,y:!0,fromStartX:!0,fromStartY:!1}};function vi(e,t,o=Ei){return Math.abs(e)>=o||Math.abs(t)>=o}function re(e,t,o){const i=o>t?o:t;return Math.min(i,Math.max(t,e))}function Li({x:e,y:t,width:o,height:i,dx:r,dy:a,scale:l=1,edge:c,minWidth:s,minHeight:d,viewportWidth:f,viewportHeight:p,margin:g=8}){const m=ki[c];if(!m)return{x:e,y:t,width:o,height:i};const h=l>0?l:1,b=e+o*h,w=t+i*h,x=f-g,E=p-g;let y=e,S=t,v=o,B=i;if(m.x&&m.fromStartX){const k=g,V=b-s*h;y=re(e+r,k,V),v=(b-y)/h}else m.x&&(v=re(o+r/h,s,Math.max(s,(x-e)/h)));if(m.y&&m.fromStartY){const k=g,V=w-d*h;S=re(t+a,k,V),B=(w-S)/h}else m.y&&(B=re(i+a/h,d,Math.max(d,(E-t)/h)));return{x:Math.round(y),y:Math.round(S),width:Math.round(v),height:Math.round(B)}}function Si(e){const t=Ni(e);if(!t)return null;if(Ii(t)){const a=t.selectionStart,l=t.selectionEnd;return a==null||l==null||a===l?null:{kind:"value",element:t,start:a,end:l,text:t.value.slice(a,l)}}const o=window.getSelection();if(!o||o.rangeCount===0)return null;const i=o.getRangeAt(0).cloneRange(),r=i.toString();return r?{kind:"range",element:t,range:i,text:r}:null}function Bi(e,t){return!e||t==null?!1:e.kind==="value"?Ai(e,t):$i(e,t)}async function Ti(e){var t;if(!e)return!1;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return Vi(e)}function Ai(e,t){const o=e.element;if(!o||o.value.slice(e.start,e.end)!==e.text)return!1;const i=o.value.slice(0,e.start)+t+o.value.slice(e.end);Ri(o,i);const r=e.start+t.length;return o.focus(),o.setSelectionRange(r,r),pt(o),!0}function $i(e,t){const o=e.range;if(!o||o.toString()!==e.text)return!1;o.deleteContents();const i=o.startContainer.ownerDocument.createTextNode(t);return o.insertNode(i),o.setStartAfter(i),o.collapse(!0),pt(e.element),!0}function Ri(e,t){var i;const o=(i=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value"))==null?void 0:i.set;o?o.call(e,t):e.value=t}function pt(e){e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function Vi(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();let o=!1;try{o=document.execCommand("copy")}catch{o=!1}return t.remove(),o}function Ni(e){return e?e.nodeType===3?e.parentElement:e:null}function Ii(e){return e.tagName==="TEXTAREA"||e.tagName==="INPUT"}const Mi={__name:"HotKeysListener",props:{textSelected:String},emits:["toggleKey","close"],setup(e,{emit:t}){const o=e,i=t,r=()=>{setTimeout(()=>{o.textSelected&&c("DoubleClick")},50)},a=s=>{(s.altKey&&s.key.toLowerCase()==="w"||s.key==="∑")&&o.textSelected&&(c("Alt+W"),s.preventDefault()),s.key==="Escape"&&(c("Escape"),s.preventDefault())},l=s=>{s.key==="Shift"&&o.textSelected&&c("Shift")},c=s=>{switch(s){case"DoubleClick":i("toggleKey","DoubleClick");break;case"Shift":i("toggleKey","Shift");break;case"Alt+W":i("toggleKey","Alt+W");break;case"Escape":i("close");break}};return n.onMounted(()=>{window.addEventListener("dblclick",r),window.addEventListener("keydown",a),window.addEventListener("keyup",l)}),n.onUnmounted(()=>{window.removeEventListener("dblclick",r),window.removeEventListener("keydown",a),window.removeEventListener("keyup",l)}),(s,d)=>(n.openBlock(),n.createElementBlock("div"))}},_i=["data-theme"],Fi={__name:"BubbleWrapper",props:{translation:Object,explanation:Object,isFavoriteFeatureEnabled:Boolean,isAITranslate:Boolean,isAIExplain:Boolean,isFavorite:Boolean,tts:String,status:String,scale:{type:Number,default:1},aiExplainMinLength:{type:Number,default:0},theme:{type:String,default:"lofi"},showThemeSelector:{type:Boolean,default:!0},mode:{type:String,default:"translate"},writing:{type:Object,default:null},writeAction:{type:String,default:be},isWriteLoading:{type:Boolean,default:!1}},emits:["toggleKey","logo","favorite","settings","close","loadTTS","aiTranslate","aiExplain","learn","themeChange","write","replace","copy"],setup(e,{emit:t}){const o=e,i=t,r=n.ref(null),a=n.ref(null),l=n.ref(null),c=n.ref(!1),s=n.ref(""),d=n.ref(!1),f=n.ref(o.writeAction||be);let p=null;n.watch(()=>o.writeAction,(u,C)=>{u&&u!==C&&(f.value=u)});const g=n.ref(o.theme),m=n.ref(!1),h=n.ref(!1),b=n.ref({x:0,y:0}),w=n.ref(null),x=n.ref(null),E=n.ref(null),y=n.ref(null),S=n.ref(!1);let v=!1,B=0,k=!1,V="",_="";const Y=n.computed(()=>typeof window>"u"||!l.value||!s.value?null:{getBoundingClientRect:()=>X(l.value),getClientRects:()=>X(l.value)}),{floatingStyles:we,update:le}=an(Y,r,{placement:"bottom",middleware:[tn(4),on(),nn()],whileElementsMounted(u,C,L){return en(u,C,L,{ancestorScroll:!0,elementResize:!1})}}),ae=n.computed(()=>o.status===D.DATA||o.status===D.ERROR),T=n.computed(()=>{var C,L;if(!ae.value)return null;const u=E.value?re(E.value,ut,dt):dt;return{width:((C=x.value)==null?void 0:C.width)??u,height:((L=x.value)==null?void 0:L.height)??li}}),ye=n.computed(()=>{let u=we.value;if(w.value)u={...u,position:"fixed",left:`${w.value.x}px`,top:`${w.value.y}px`,transform:"none"};else if(S.value&&l.value&&s.value){const C=X(l.value);C&&(u={...u,position:"fixed",left:`${C.x}px`,top:`${C.y+C.height+4}px`,transform:"none"})}return u={...u,zIndex:9999},T.value&&(u={...u,width:`${T.value.width}px`,height:`${T.value.height}px`,maxWidth:`${T.value.width}px`,boxSizing:"border-box"}),u}),K=n.computed(()=>{const u={transform:o.scale!==1?`scale(${o.scale})`:"none",transformOrigin:"top left"};return T.value&&(u.width=`${T.value.width}px`,u.height=`${T.value.height}px`,u.boxSizing="border-box"),u});n.onMounted(()=>{document.addEventListener("keyup",wt),document.addEventListener("select",yt),document.addEventListener("selectionchange",xt),document.addEventListener("pointerdown",gt),document.addEventListener("pointerup",Ct),document.addEventListener("pointercancel",bt),document.documentElement.onclick=u=>{if(Ie(),Et())return;const C=X(u.target);if(!C){_e();return}Me(C,u)},document.documentElement.ontouchend=u=>{if(Ie(),Et())return;const C=X(u.target);if(!C){_e();return}Me(C,u)}}),n.onUnmounted(()=>{document.removeEventListener("keyup",wt),document.removeEventListener("select",yt),document.removeEventListener("selectionchange",xt),document.removeEventListener("pointerdown",gt),document.removeEventListener("pointerup",Ct),document.removeEventListener("pointercancel",bt),cancelAnimationFrame(F),clearTimeout(G),document.documentElement.onclick=null,document.documentElement.ontouchend=null,clearTimeout(B),document.removeEventListener("mousemove",Fe),document.removeEventListener("mouseup",De),document.removeEventListener("touchmove",ze),document.removeEventListener("touchend",Oe),Pe()});let F=0,A=!1,$=!1,G=0;const gt=()=>{A=!0,$=!0,clearTimeout(G)},Ct=()=>{A=!1,clearTimeout(G),G=window.setTimeout(()=>{$=!1,xe()},50)},bt=()=>{A=!1,Ie()},Ie=()=>{$=!1,clearTimeout(G)},wt=u=>{if(!bi(u)){if(Ci(u)){xe();return}X(u.target)||_e()}},yt=u=>{Ne(A,$)||xe(u.target)},xt=()=>{Ne(A,$)||o.status===D.DATA||o.status===D.LOADING||xe()},xe=u=>{cancelAnimationFrame(F),F=requestAnimationFrame(()=>{if(Ne(A,$))return;const C=u||document.activeElement,L=X(C);L&&(c.value&&s.value===L.text||Me(L,{target:C}))})},Me=(u,C)=>{o.status!==D.LOGO&&i("close"),c.value&&!S.value&&(S.value=!0),l.value=C.target,u.width&&(E.value=u.width),d.value=Ho(C.target),p=d.value?Si(C.target):null,s.value=u.text,c.value=!0,n.nextTick(le)},_e=()=>{s.value="",d.value=!1,p=null,se()},zi=u=>{Ti(u),i("copy",u),se()},Di=u=>{Bi(p,u==null?void 0:u.result),p=null,i("replace",u),se()},Oi=u=>{u!=null&&u.action&&(f.value=u.action),i("write",u)},Wi=u=>{if(st(d.value,s.value)){i("write",{text:s.value,action:f.value||be});return}i("toggleKey",u)},Pi=u=>{u.stopPropagation()},se=async()=>{Pe(),c.value=!1,w.value=null,S.value=!1,i("close")},Hi=u=>{g.value=u,i("themeChange",u)},Ui=({type:u,event:C})=>{m.value=!0;const L=r.value.getBoundingClientRect();if(u==="mouse")b.value={x:C.clientX-L.left,y:C.clientY-L.top},document.addEventListener("mousemove",Fe),document.addEventListener("mouseup",De);else if(u==="touch"){const te=C.touches[0];b.value={x:te.clientX-L.left,y:te.clientY-L.top},document.addEventListener("touchmove",ze),document.addEventListener("touchend",Oe)}},Fe=u=>{m.value&&(w.value={x:u.clientX-b.value.x,y:u.clientY-b.value.y})},ze=u=>{if(!m.value)return;const C=u.touches[0];w.value={x:C.clientX-b.value.x,y:C.clientY-b.value.y}},De=()=>{m.value&&We(),m.value=!1,document.removeEventListener("mousemove",Fe),document.removeEventListener("mouseup",De)},Oe=()=>{m.value&&We(),m.value=!1,document.removeEventListener("touchmove",ze),document.removeEventListener("touchend",Oe)},Et=()=>m.value||h.value?!0:v?(v=!1,clearTimeout(B),!0):!1,We=()=>{v=!0,clearTimeout(B),B=window.setTimeout(()=>{v=!1},50)},ji={n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize",ne:"nesw-resize",sw:"nesw-resize",nw:"nwse-resize",se:"nwse-resize"},Zi=u=>{!document.body||k||(V=document.body.style.cursor,_=document.body.style.userSelect,document.body.style.cursor=ji[u]||"nwse-resize",document.body.style.userSelect="none",k=!0)},qi=()=>{!document.body||!k||(document.body.style.cursor=V,document.body.style.userSelect=_,k=!1)},Xi=({edge:u,event:C})=>{if(!a.value||!r.value||!a.value.offsetWidth||!a.value.offsetHeight)return;const L=r.value.getBoundingClientRect();h.value=!0,y.value={pointerX:C.clientX,pointerY:C.clientY,left:L.left,top:L.top,width:a.value.offsetWidth,height:a.value.offsetHeight,edge:u,moved:!1},Zi(u),document.addEventListener("pointermove",kt),document.addEventListener("pointerup",Ee),document.addEventListener("pointercancel",Ee)},Yi=(u,C)=>{if(!h.value||!y.value||!r.value)return;const L=u-y.value.pointerX,te=C-y.value.pointerY;if(!y.value.moved&&!vi(L,te))return;y.value.moved=!0;const ke=Li({x:y.value.left,y:y.value.top,width:y.value.width,height:y.value.height,dx:L,dy:te,scale:o.scale,edge:y.value.edge,minWidth:ut,minHeight:ai,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,margin:si});w.value={x:ke.x,y:ke.y},x.value={width:ke.width,height:ke.height}},kt=u=>{u.cancelable&&u.preventDefault(),Yi(u.clientX,u.clientY)},Ee=()=>{Pe()},Pe=()=>{h.value&&We(),h.value=!1,y.value=null,qi(),document.removeEventListener("pointermove",kt),document.removeEventListener("pointerup",Ee),document.removeEventListener("pointercancel",Ee)},Ki=()=>{var C;const u=(C=o==null?void 0:o.translation)==null?void 0:C.target;ci.includes(u)?ht.supportRTL():ht.removeRTL()};return n.watch(()=>o.status,()=>{c.value&&n.nextTick(le),Ki()}),n.watch(()=>o.theme,u=>{g.value=u}),(u,C)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[c.value?(n.openBlock(),n.createElementBlock("div",{key:0,ref_key:"floatingEl",ref:r,style:n.normalizeStyle(ye.value),onClick:Pi},[n.createElementVNode("div",{ref_key:"contentEl",ref:a,class:"relative rounded-lg",style:n.normalizeStyle(K.value),"data-theme":g.value},[n.createVNode(mi,{translation:o.translation,explanation:o.explanation,tts:o.tts,status:o.status,isFavorite:o.isFavorite,isFavoriteFeatureEnabled:o.isFavoriteFeatureEnabled,isAITranslate:o.isAITranslate,isAIExplain:o.isAIExplain,aiExplainMinLength:o.aiExplainMinLength,theme:g.value,showThemeSelector:o.showThemeSelector,constrained:ae.value,mode:o.mode,writing:o.writing,writeAction:f.value,isWriteLoading:o.isWriteLoading,editable:d.value,selectedText:s.value,onLogo:C[0]||(C[0]=L=>i("logo")),onWrite:Oi,onReplace:Di,onCopy:zi,onFavorite:C[1]||(C[1]=L=>i("favorite")),onSettings:C[2]||(C[2]=L=>i("settings")),onClose:se,onLoadTTS:C[3]||(C[3]=L=>i("loadTTS")),onAiTranslate:C[4]||(C[4]=L=>i("aiTranslate")),onAiExplain:C[5]||(C[5]=L=>i("aiExplain")),onLearn:C[6]||(C[6]=L=>i("learn",L)),onThemeChange:Hi,onDragStart:Ui,onResizeStart:Xi},null,8,["translation","explanation","tts","status","isFavorite","isFavoriteFeatureEnabled","isAITranslate","isAIExplain","aiExplainMinLength","theme","showThemeSelector","constrained","mode","writing","writeAction","isWriteLoading","editable","selectedText"])],12,_i)],4)):n.createCommentVNode("",!0),n.createVNode(Mi,{textSelected:s.value,onToggleKey:Wi,onClose:se},null,8,["textSelected"])],64))}};P.default=Fi,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|