import{B as e,C as t,D as n,E as r,F as i,G as a,H as o,J as s,K as c,M as l,O as u,P as d,R as f,U as p,W as m,Y as h,h as g,i as _,j as v,k as y,m as b,n as x,o as S,q as C,r as w,t as T,v as E,z as D}from"./CrashPanel-Di_mLyQI.js";import{a as O,i as k,n as A,t as j}from"./settings-Cj-DsjE4.js";var M={launch:`ocr:launch`,captureRegion:`ocr:capture-region`,openOptions:`ocr:open-options`},N=`/content-scripts/overlay.js`;async function P(e){await b.scripting.executeScript({target:{tabId:e},files:[N]}),await b.tabs.sendMessage(e,{type:M.launch})}function F(e){return e?/^https?:/.test(e)&&!e.startsWith(`https://chromewebstore.google.com`):!1}var I=y(`<div class="pop svelte-mr0fgi"><header class="svelte-mr0fgi"><!> <span class="brand svelte-mr0fgi"> </span> <span class="trust-chip"><svg viewBox="0 0 24 24" width="11" height="11" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><rect x="5" y="11" width="14" height="9" rx="2"></rect><path d="M8 11 V7 a4 4 0 0 1 8 0 V11"></path></svg> </span></header> <div class="body svelte-mr0fgi"><button><svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 8 V5 a1 1 0 0 1 1 -1 H8"></path><path d="M16 4 H19 a1 1 0 0 1 1 1 V8"></path><path d="M20 16 V19 a1 1 0 0 1 -1 1 H16"></path><path d="M8 20 H5 a1 1 0 0 1 -1 -1 V16"></path></svg> <span class="lbl svelte-mr0fgi"><b class="svelte-mr0fgi"> </b> <em class="svelte-mr0fgi"> </em></span></button> <button class="file svelte-mr0fgi"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="var(--accent-deep)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"></rect><circle cx="8.5" cy="10" r="1.5"></circle><path d="M21 16 l-5 -5 L5 19"></path></svg> <span class="lbl svelte-mr0fgi"><b class="svelte-mr0fgi"> </b> <em class="svelte-mr0fgi"> </em></span></button> <div class="lang svelte-mr0fgi"><span> <b class="svelte-mr0fgi"> </b></span> <button class="switch svelte-mr0fgi"> <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg></button></div> <footer class="svelte-mr0fgi"><button class="settings svelte-mr0fgi"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="3"></circle><path d="M12 2 v3 M12 19 v3 M2 12 h3 M19 12 h3 M5 5 l2 2 M17 17 l2 2 M19 5 l-2 2 M7 17 l-2 2"></path></svg> </button> <a class="sr svelte-mr0fgi"> </a></footer></div></div>`);function L(v,y){C(y,!0);let w=p(!0),M=p(`chi_sim_eng`),N=p(void 0),L=m(()=>S(O(d(M)).labelKey));g(()=>{(async()=>{o(M,(await j()).langId,!0);try{let[e]=await b.tabs.query({active:!0,currentWindow:!0});o(N,e?.id,!0),o(w,F(e?.url),!0)}catch(e){_(`popup`,e)}})()});async function R(){if(!(!d(w)||d(N)===void 0))try{await P(d(N)),window.close()}catch(e){await _(`popup`,e)}}function z(){b.tabs.create({url:b.runtime.getURL(`/workspace.html`)}),window.close()}async function B(){let e=k.findIndex(e=>e.id===d(M));o(M,k[(e+1)%k.length].id,!0),await A({langId:d(M)})}function V(){b.runtime.openOptionsPage(),window.close()}var H=u();a(D(H),{onerror:e=>_(`popup`,e),failed:e=>{T(e,{})}},a=>{var o=I(),c=f(o),u=f(c);x(u,{size:30,radius:8});var p=e(u,2),m=f(p,!0);h(p);var g=e(p,2),_=e(f(g));h(g),h(c);var v=e(c,2),y=f(v);let C;var T=e(f(y),2),D=f(T),O=f(D,!0);h(D);var k=e(D,2),A=f(k,!0);h(k),h(T),h(y);var j=e(y,2),M=e(f(j),2),N=f(M),P=f(N,!0);h(N);var F=e(N,2),H=f(F,!0);h(F),h(M),h(j);var U=e(j,2),W=f(U),G=f(W),K=e(G),q=f(K,!0);h(K),h(W);var J=e(W,2),Y=f(J);s(),h(J),h(U);var X=e(U,2),Z=f(X),Q=e(f(Z));h(Z);var $=e(Z,2),ee=f($,!0);h($),h(X),h(v),h(o),i((e,n,i,a,o,s,c,l,u,f,p)=>{r(m,e),r(_,` ${n??``}`),C=t(y,1,`capture svelte-mr0fgi`,null,C,{disabled:!d(w)}),y.disabled=!d(w),r(O,i),r(A,a),r(P,o),r(H,s),r(G,`${c??``}: `),r(q,d(L)),r(Y,`${l??``} `),r(Q,` ${u??``}`),E($,`href`,f),r(ee,p)},[()=>S(`popupBrand`),()=>S(`trustBadge`),()=>d(w)?S(`captureBtn`):S(`captureDisabled`),()=>d(w)?S(`captureBtnSub`):S(`captureDisabledSub`),()=>S(`fileBtn`),()=>S(`fileBtnSub`),()=>S(`recogLabel`),()=>S(`switchAction`),()=>S(`settings`),()=>b.runtime.getURL(`/workspace.html`),()=>S(`sameMakerLink`)]),l(`click`,y,R),l(`click`,j,z),l(`click`,J,B),l(`click`,Z,V),l(`click`,$,e=>{e.preventDefault(),z()}),n(a,o)}),n(v,H),c()}v([`click`]),w(`popup`,L);