import{a as e,l as t}from"./preact.module-CNakwbc9.js";import{d as n,i as r,t as i}from"./hooks.module-BrXTvcfS.js";import{G as a,m as o}from"./content_renderer-DOj8g78V.js";import{B as s,T as c,a as l,t as u}from"./i18n-BaLR3UdQ.js";import{t as d}from"./jsxRuntime.module-Cao1NCKs.js";import{$ as f,U as p,X as m,k as h}from"./hooks-ClTXKdUl.js";import{t as g}from"./Dropdown-BUar6udP.js";import{a as _,t as v}from"./FormList-CnuOJg6b.js";import{n as y}from"./FormToggle-wwys3uI5.js";import{t as b}from"./Button-Du0dYm4Z.js";import{n as x}from"./syntax_highlighting-iHJxyTXm.js";import{t as S}from"./syntax_highlighting-DR-aZPjE.js";import{t as C}from"./FormSelect-BDRio0zO.js";import{n as w,t as T}from"./OptionsRow-CcGZJWUG.js";import{t as E}from"./OptionsSection-C2t30BmG.js";import{t as D}from"./FormText-P1Ovp7qM.js";n();function O({values:e,keyProperty:t,titleProperty:n,disabledProperty:r,currentValue:i,onChange:a,columnWidth:o}){function s(e){i.includes(e)?a(i.filter(t=>t!==e)):a([...i,e])}return d(`ul`,{style:{listStyleType:`none`,marginBottom:0,columnWidth:o??`400px`},children:e.map(e=>d(`li`,{children:d(`label`,{className:`tn-checkbox`,children:[d(`input`,{type:`checkbox`,className:`form-check-input`,value:String(e[t]),checked:i.includes(String(e[t])),disabled:!!(r&&e[r]),onChange:e=>s(e.target.value)}),String(e[n??t]??e[t])]})}))})}function k(){let e=i(null);p(e,r(()=>({title(){let e=this.querySelector(`input`)?.value;if(!e||e===`text/plain`)return``;let t=!!S[e],n=!!x[e];return`
                <strong>${l(`code_mime_types.tooltip_syntax_highlighting`)}</strong>
                ${t?`✅`:`❌`} ${l(`code_mime_types.tooltip_code_block_syntax`)}
                ${n?`✅`:`❌`} ${l(`code_mime_types.tooltip_code_note_syntax`)}
            `},selector:`label`,customClass:`tooltip-top`,placement:`left`,fallbackPlacements:[`left`,`right`],animation:!1,html:!0,trigger:`hover`}),[]));let[t,n]=f(`codeNotesMimeTypes`),a=r(()=>{o.loadMimeTypes();let e=Array.from(o.getMimeTypes()),t=e.shift(),n={};e.sort((e,t)=>e.title.localeCompare(t.title)),t&&(n[``]=[t],t.enabled=!0,t.disabled=!0);for(let t of e){let e=t.title.charAt(0).toUpperCase();n[e]||(n[e]=[]),n[e].push(t)}return n},[]);return d(`ul`,{class:`options-mime-types`,ref:e,children:Object.entries(a).map(([e,r])=>d(`section`,{children:[e&&d(`h5`,{children:e}),d(O,{values:r,keyProperty:`mime`,titleProperty:`title`,disabledProperty:`disabled`,currentValue:t,onChange:n,columnWidth:`inherit`})]}))})}n(),t();function A({id:t,locales:n,currentValue:r,onChange:i,defaultLocale:a,extraChildren:o}){let{activeLocale:s,processedLocales:c}=j(n,a,r??a?.id??``);return d(g,{id:t,text:s?.name,children:[c.map((e,t)=>typeof e==`object`?d(_,{rtl:e.rtl,checked:e.id===r,onClick:()=>{i(e.id)},children:e.name},e.id):d(v,{},`divider-${t}`)),o&&d(e,{children:[d(v,{}),o]})]})}function j(e,t,n){return{activeLocale:t?.id===n?t:e.find(e=>e.id===n),processedLocales:r(()=>{let n=e.filter(e=>!e.rtl),r=e.filter(e=>e.rtl),i=[];return t&&i.push(t),n.length>0&&(i.length>0&&i.push(`---`),i=[...i,...n]),r.length>0&&(i=[...i,`---`,...r]),i},[e,t])}}function M({actions:e,below:t,helpUrl:n}){let{note:r}=h();return!r&&!e&&!t?null:d(`div`,{className:`options-page-header`,children:d(`div`,{className:`options-page-header-inner`,children:[(r||e)&&d(`div`,{className:`options-page-header-main`,children:[r&&d(`div`,{className:`options-page-header-titles`,children:[d(`span`,{className:`options-page-header-icon ${r.getIcon()}`,"aria-hidden":`true`}),d(`h2`,{className:`options-page-header-title`,children:r.title}),n&&d(y,{helpPage:n})]}),e&&d(`div`,{className:`options-page-header-actions`,children:e})]}),t&&d(`div`,{className:`options-page-header-below`,children:t})]})})}function N({items:e}){let t=e.filter(e=>e.enabled!==!1);return t.length===0?null:d(E,{title:l(`settings.related_settings`),children:t.map(e=>{let{targetPage:t,targetNoteId:n}=e;return d(w,{label:e.title,description:e.description,href:n?`#root/_hidden/${n}`:`#root/_hidden/_options/${t}`,noContainedNavigation:!!n,onClick:n?e=>{e.preventDefault(),e.stopPropagation(),a.triggerCommand(`openInTreePopup`,{noteIdOrPath:n,hoistedNoteId:n})}:void 0},t??n)})})}n(),t();function P(){return d(e,{children:[d(M,{}),d(F,{}),d(L,{}),c()&&d(N,{items:[{title:l(`spellcheck.title`),description:l(`spellcheck.related_description`),targetPage:`_optionsSpellcheck`}]})]})}function F(){let{uiLocales:e,formattingLocales:t}=r(()=>{let e=u();return{uiLocales:e.filter(e=>!(e.contentOnly||e.devOnly&&!glob.isDev)),formattingLocales:[...e.filter(e=>!(!e.electronLocale||e.devOnly&&!glob.isDev))]}},[]),[n,i]=m(`locale`),[a,o]=m(`formattingLocale`);return d(E,{title:l(`i18n.title`),children:[d(T,{name:`language`,label:l(`i18n.language`),children:d(A,{locales:e,currentValue:n,onChange:i})}),d(T,{name:`formatting-locale`,label:l(`i18n.formatting-locale`),children:d(A,{locales:t,currentValue:a,onChange:o,defaultLocale:{id:``,name:l(`i18n.formatting-locale-auto`)}})}),d(I,{})]})}function I(){let[t,n]=m(`firstDayOfWeek`),[r,i]=m(`firstWeekOfYear`),[a,o]=m(`minDaysInFirstWeek`);return d(e,{children:[d(T,{name:`first-day-of-week`,label:l(`i18n.first-day-of-the-week`),children:d(C,{name:`first-day-of-week`,currentValue:t,onChange:n,keyProperty:`value`,titleProperty:`label`,values:[{value:`1`,label:l(`i18n.monday`)},{value:`2`,label:l(`i18n.tuesday`)},{value:`3`,label:l(`i18n.wednesday`)},{value:`4`,label:l(`i18n.thursday`)},{value:`5`,label:l(`i18n.friday`)},{value:`6`,label:l(`i18n.saturday`)},{value:`7`,label:l(`i18n.sunday`)}]})}),d(T,{name:`first-week-of-year`,label:l(`i18n.first-week-of-the-year`),description:l(`i18n.first-week-warning`),children:d(C,{name:`first-week-of-year`,currentValue:r,onChange:i,keyProperty:`value`,titleProperty:`label`,values:[{value:`0`,label:l(`i18n.first-week-contains-first-day`)},{value:`1`,label:l(`i18n.first-week-contains-first-thursday`)},{value:`2`,label:l(`i18n.first-week-has-minimum-days`)}]})}),r===`2`&&d(T,{name:`min-days-in-first-week`,label:l(`i18n.min-days-in-first-week`),children:d(C,{keyProperty:`days`,currentValue:a,onChange:o,values:Array.from({length:7},(e,t)=>({days:String(t+1)}))})}),d(T,{name:`restart`,centered:!0,children:d(b,{name:`restart-app-button`,text:l(`electron_integration.restart-app-button`),size:`micro`,onClick:s})})]})}function L(){return d(E,{title:l(`content_language.title`),children:[d(D,{children:l(`content_language.description`)}),d(R,{})]})}function R(){let e=r(()=>u(),[]),[t,n]=f(`languages`);return d(O,{values:e,keyProperty:`id`,titleProperty:`name`,currentValue:t,onChange:n,columnWidth:`300px`})}export{A as a,O as c,M as i,P as n,j as o,N as r,k as s,R as t};