import{k as e}from"./utils-BakkG8Vx.js";import{d as t,f as n,m as r,s as i,t as a}from"./hooks.module-5xe-uC6c.js";import{I as o,_t as s}from"./content_renderer-CoENEE63.js";import{s as c}from"./options-CDt8ZGCW.js";import{t as l}from"./jsxRuntime.module--xb8gfv5.js";import{Q as u,T as d}from"./hooks-CSTgmcXO.js";import{t as f}from"./Button-XVZ6KZoL.js";import{t as p}from"./FormGroup--CU8SFQh.js";import{t as m}from"./FormTextBox-oE57I0qB.js";import{t as h}from"./SetupForm-DSf0oesd.js";t();var g=e.isElectron(),_=`1vHRoWCEjj0L`;function v({note:e,ntxId:t}){let[n]=d(e,`webViewSrc`),[r]=d(e,`disabled:webViewSrc`);return r?l(S,{note:e,url:r}):n?l(g?y:b,{src:n,ntxId:t}):l(x,{note:e})}function y({src:e,ntxId:t}){let n=a(null);return r(()=>{let e=n.current;if(!e)return;function r(){document.activeElement===e&&t&&o.tabManager.activateNoteContext(t)}return e.addEventListener(`focus`,r),()=>{e.removeEventListener(`focus`,r)}},[t]),l(`webview`,{ref:n,src:e,class:`note-detail-web-view-content`},e)}function b({src:e,ntxId:t}){let n=a(null);return r(()=>{function e(){document.activeElement===n.current&&t&&o.tabManager.activateNoteContext(t)}return window.addEventListener(`blur`,e),()=>{window.removeEventListener(`blur`,e)}},[t]),l(`iframe`,{ref:n,src:e,class:`note-detail-web-view-content`,sandbox:`allow-same-origin allow-scripts allow-popups`},e)}function x({note:e}){let[,t]=d(e,`webViewSrc`),[r,a]=i(``),o=n(e=>{try{new URL(e)}catch{s.showErrorTitleAndMessage(c(`web_view_setup.invalid_url_title`),c(`web_view_setup.invalid_url_message`));return}t(e)},[t]);return l(h,{icon:`bx bx-globe-alt`,inAppHelpPage:_,onSubmit:()=>o(r),children:[l(p,{name:`web-view-src-detail`,label:c(`web_view_setup.title`),children:l(`input`,{className:`form-control`,type:`text`,value:r,placeholder:c(`web_view_setup.url_placeholder`),onChange:e=>{a(e.target?.value)}})}),l(f,{text:c(`web_view_setup.create_button`),kind:`primary`,keyboardShortcut:`Enter`})]})}function S({note:e,url:t}){return l(h,{icon:`bx bx-globe-alt`,inAppHelpPage:_,children:[l(p,{name:`web-view-src-detail`,label:c(`web_view_setup.disabled_description`),children:l(m,{type:`url`,currentValue:t,disabled:!0})}),l(f,{text:c(`web_view_setup.disabled_button_enable`),icon:`bx bx-check-shield`,onClick:()=>u.toggleDangerousAttribute(e,`label`,`webViewSrc`,!0),kind:`primary`})]})}export{v as default};