2025-03-23 20:59:56 +01:00

12 lines
304 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";var e=require("obsidian");function t(e,t,o,i){return new(o||(o=Promise))((function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function r(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,r)}l((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const o=["Custom","editingToolbar","editingToolbarSub","editingToolbarAdd","editingToolbarDelete","editingToolbarReload","codeblock-glyph","underline-glyph","superscript-glyph","subscript-glyph","bot-glyph","header-1","header-2","header-3","header-4","header-5","header-6","header-n","obsidian","obsidian-new","accessibility","activity","air-vent","airplay","alarm-check","alarm-clock-off","alarm-clock","alarm-minus","alarm-plus","album","alert-circle","alert-octagon","alert-triangle","align-center-horizontal","align-center-vertical","align-center","align-end-horizontal","align-end-vertical","align-horizontal-distribute-center","align-horizontal-distribute-end","align-horizontal-distribute-start","align-horizontal-justify-center","align-horizontal-justify-end","align-horizontal-justify-start","align-horizontal-space-around","align-horizontal-space-between","align-justify","align-left","align-right","align-start-horizontal","align-start-vertical","align-vertical-distribute-center","align-vertical-distribute-end","align-vertical-distribute-start","align-vertical-justify-center","align-vertical-justify-end","align-vertical-justify-start","align-vertical-space-around","align-vertical-space-between","anchor","angry","annoyed","aperture","apple","archive-restore","archive","armchair","arrow-big-down","arrow-big-left","arrow-big-right","arrow-big-up","arrow-down-circle","arrow-down-left","arrow-down-right","arrow-down","arrow-left-circle","arrow-left-right","arrow-left","arrow-right-circle","arrow-right","arrow-up-circle","arrow-up-left","arrow-up-right","arrow-up","asterisk","at-sign","award","axe","axis-3d","baby","backpack","baggage-claim","banana","banknote","bar-chart-2","bar-chart-3","bar-chart-4","bar-chart-horizontal","bar-chart","baseline","bath","battery-charging","battery-full","battery-low","battery-medium","battery","beaker","bed-double","bed-single","bed","beer","bell-minus","bell-off","bell-plus","bell-ring","bell","bike","binary","bitcoin","bluetooth-connected","bluetooth-off","bluetooth-searching","bluetooth","bold","bomb","bone","book-open","book","bookmark-minus","bookmark-plus","bookmark","bot","box-select","box","boxes","briefcase","brush","bug","building-2","building","bus","cake","calculator","calendar-check-2","calendar-check","calendar-clock","calendar-days","calendar-heart","calendar-minus","calendar-off","calendar-plus","calendar-range","calendar-search","calendar-x2","calendar-x","calendar","camera-off","camera","car","carrot","cast","check-circle-2","check-circle","check-square","check","chef-hat","cherry","chevron-down","chevron-first","chevron-last","chevron-left","chevron-right","chevron-up","chevrons-down-up","chevrons-down","chevrons-left-right","chevrons-left","chevrons-right-left","chevrons-right","chevrons-up-down","chevrons-up","chrome","cigarette-off","cigarette","circle-dot","circle-ellipsis","circle-slashed","circle","citrus","clapperboard","clipboard-check","clipboard-copy","clipboard-edit","clipboard-list","clipboard-signature","clipboard-type","clipboard-x","clipboard","clock-1","clock-10","clock-11","clock-12","clock-2","clock-3","clock-4","clock-5","clock-6","clock-7","clock-8","clock-9","clock","cloud-cog","cloud-drizzle","cloud-fog","cloud-hail","cloud-lightning","cloud-moon-rain","cloud-moon","cloud-off","cloud-rain-wind","cloud-rain","cloud-snow","cloud-sun-rain","cloud-sun","cloud","cloudy","clover","code-2","code","codepen","codesandbox","coffee","cog","coins","columns","command","compass","component","contact","contrast","cookie","copy","copyleft","copyright","corner-down-left","corner-down-right","corner-left-down","corner-left-up","corner-right-down","corner-right-up","corner-up-left","corner-up-right","cpu","credit-card","croissant","crop","cross","crosshair","crown","cup-soda","curly-braces","currency","database","delete","diamond","dice-1","dice-2","dice-3","dice-4","dice-5","dice-6","dices","diff","disc","divide-circle","divide-square","divide","dollar-sign","download-cloud","download","dribbble","droplet","droplets","drumstick","edit-2","edit-3","edit","egg-fried","egg","equal-not","equal","eraser","euro","expand","external-link","eye-off","eye","facebook","factory","fast-forward","feather","figma","file-archive","file-audio-2","file-audio","file-axis-3d","file-badge-2","file-badge","file-bar-chart-2","file-bar-chart","file-box","file-check-2","file-check","file-clock","file-code","file-cog-2","file-cog","file-diff","file-digit","file-down","file-edit","file-heart","file-image","file-input","file-json-2","file-json","file-key-2","file-key","file-line-chart","file-lock-2","file-lock","file-minus-2","file-minus","file-output","file-pie-chart","file-plus-2","file-plus","file-question","file-scan","file-search-2","file-search","file-signature","file-spreadsheet","file-symlink","file-terminal","file-text","file-type-2","file-type","file-up","file-video-2","file-video","file-volume-2","file-volume","file-warning","file-x2","file-x","file","files","film","filter","fingerprint","flag-off","flag-triangle-left","flag-triangle-right","flag","flame","flashlight-off","flashlight","flask-conical","flask-round","flip-horizontal-2","flip-horizontal","flip-vertical-2","flip-vertical","flower-2","flower","focus","folder-archive","folder-check","folder-clock","folder-closed","folder-cog-2","folder-cog","folder-down","folder-edit","folder-heart","folder-input","folder-key","folder-lock","folder-minus","folder-open","folder-output","folder-plus","folder-search-2","folder-search","folder-symlink","folder-tree","folder-up","folder-x","folder","folders","form-input","forward","frame","framer","frown","fuel","function-square","gamepad-2","gamepad","gauge","gavel","gem","ghost","gift","git-branch-plus","git-branch","git-commit","git-compare","git-fork","git-merge","git-pull-request-closed","git-pull-request-draft","git-pull-request","github","gitlab","glass-water","glasses","globe-2","globe","grab","graduation-cap","grape","grid","grip-horizontal","grip-vertical","hammer","hand-metal","hand","hard-drive","hard-hat","hash","haze","headphones","heart-crack","heart-handshake","heart-off","heart-pulse","heart","help-circle","hexagon","highlighter","history","home","hourglass","ice-cream","image-minus","image-off","image-plus","image","import","inbox","indent","indian-rupee","infinity","info","inspect","instagram","italic","japanese-yen","joystick","key","keyboard","lamp-ceiling","lamp-desk","lamp-floor","lamp-wall-down","lamp-wall-up","lamp","landmark","languages","laptop-2","laptop","lasso-select","lasso","laugh","layers","layout-dashboard","layout-grid","layout-list","layout-template","layout","leaf","library","life-buoy","lightbulb-off","lightbulb","line-chart","link-2off","link-2","link","linkedin","list-checks","list-end","list-minus","list-music","list-ordered","list-plus","list-start","list-video","list-x","list","loader-2","loader","locate-fixed","locate-off","locate","lock","log-in","log-out","luggage","magnet","mail-check","mail-minus","mail-open","mail-plus","mail-question","mail-search","mail-warning","mail-x","mail","mails","map-pin-off","map-pin","map","martini","maximize-2","maximize","medal","megaphone-off","megaphone","meh","menu","message-circle","message-square","mic-2","mic-off","mic","microscope","milestone","minimize-2","minimize","minus-circle","minus-square","minus","monitor-off","monitor-speaker","monitor","moon","more-horizontal","more-vertical","mountain-snow","mountain","mouse-pointer-2","mouse-pointer-click","mouse-pointer","mouse","move-3d","move-diagonal-2","move-diagonal","move-horizontal","move-vertical","move","music-2","music-3","music-4","music","navigation-2off","navigation-2","navigation-off","navigation","network","newspaper","octagon","option","outdent","package-2","package-check","package-minus","package-open","package-plus","package-search","package-x","package","paint-bucket","paintbrush-2","paintbrush","palette","palmtree","paperclip","party-popper","pause-circle","pause-octagon","pause","pen-tool","pencil","percent","person-standing","phone-call","phone-forwarded","phone-incoming","phone-missed","phone-off","phone-outgoing","phone","pie-chart","piggy-bank","pin-off","pin","pipette","pizza","plane","play-circle","play","plug-zap","plus-circle","plus-square","plus","pocket","podcast","pointer","pound-sterling","power-off","power","printer","puzzle","qr-code","quote","radio-receiver","radio","recycle","redo-2","redo","refresh-ccw","refresh-cw","regex","repeat-1","repeat","reply-all","reply","rewind","rocket","rocking-chair","rotate-3d","rotate-ccw","rotate-cw","rss","ruler","russian-ruble","save","scale-3d","scale","scaling","scan-face","scan-line","scan","scissors","screen-share-off","screen-share","scroll","search","send","separator-horizontal","separator-vertical","server-cog","server-crash","server-off","server","settings-2","settings","share-2","share","sheet","shield-alert","shield-check","shield-close","shield-off","shield","shirt","shopping-bag","shopping-cart","shovel","shrink","shrub","shuffle","sidebar-close","sidebar-open","sidebar","sigma","signal-high","signal-low","signal-medium","signal-zero","signal","siren","skip-back","skip-forward","skull","slack","slash","slice","sliders-horizontal","sliders","smartphone-charging","smartphone","smile-plus","smile","snowflake","sofa","sort-asc","sort-desc","speaker","sprout","square","star-half","star-off","star","stethoscope","sticker","sticky-note","stop-circle","stretch-horizontal","stretch-vertical","strikethrough","subscript","sun-dim","sun-medium","sun-moon","sun-snow","sun","sunrise","sunset","superscript","swiss-franc","switch-camera","sword","swords","syringe","table-2","table","tablet","tag","tags","target","tent","terminal-square","terminal","text-cursor-input","text-cursor","thermometer-snowflake","thermometer-sun","thermometer","thumbs-down","thumbs-up","ticket","timer-off","timer-reset","timer","toggle-left","toggle-right","tornado","toy-brick","train","trash-2","trash","tree-deciduous","tree-pine","trees","trello","trending-down","trending-up","triangle","trophy","truck","tv-2","tv","twitch","twitter","type","umbrella","underline","undo-2","undo","unlink-2","unlink","unlock","upload-cloud","upload","usb","user-check","user-cog","user-minus","user-plus","user-x","user","users","utensils-crossed","utensils","venetian-mask","verified","vibrate-off","vibrate","video-off","video","view","voicemail","volume-1","volume-2","volume-x","volume","wallet","wand-2","wand","watch","waves","webcam","webhook","wifi-off","wifi","wind","wine","wrap-text","wrench","x-circle","x-octagon","x-square","x","youtube","zap-off","zap","zoom-in","zoom-out","create-new","trash","search","right-triangle","document","folder","pencil","left-arrow","right-arrow","three-horizontal-bars","dot-network","audio-file","image-file","pdf-file","gear","documents","blocks","go-to-file","presentation","cross-in-box","microphone","microphone-filled","two-columns","link","popup-open","checkmark","hashtag","left-arrow-with-tail","right-arrow-with-tail","up-arrow-with-tail","down-arrow-with-tail","lines-of-text","vertical-three-dots","pin","magnifying-glass","info","horizontal-split","vertical-split","calendar-with-checkmark","folder-minus","sheets-in-box","up-and-down-arrows","broken-link","cross","any-key","reset","star","crossed-star","dice","filled-pin","enter","help","vault","open-vault","paper-plane","bullet-list","uppercase-lowercase-a","star-list","expand-vertically","languages","switch","pane-layout","install","sync","check-in-circle","sync-small","check-small","paused","forward-arrow","stacked-levels","bracket-glyph","note-glyph","tag-glyph","price-tag-glyph","heading-glyph","bold-glyph","italic-glyph","strikethrough-glyph","highlight-glyph","code-glyph","quote-glyph","link-glyph","bullet-list-glyph","number-list-glyph","checkbox-glyph","undo-glyph","redo-glyph","up-chevron-glyph","down-chevron-glyph","left-chevron-glyph","right-chevron-glyph","percent-sign-glyph","keyboard-glyph","double-up-arrow-glyph","double-down-arrow-glyph","image-glyph","wrench-screwdriver-glyph","clock","plus-with-circle","minus-with-circle","indent-glyph","unindent-glyph","fullscreen","exit-fullscreen","cloud","run-command","compress-glyph","enlarge-glyph","scissors-glyph","up-curly-arrow-glyph","down-curly-arrow-glyph","plus-minus-glyph","links-going-out","links-coming-in","add-note-glyph","duplicate-glyph","clock-glyph","calendar-glyph","command-glyph","dice-glyph","file-explorer-glyph","graph-glyph","import-glyph","navigate-glyph","open-elsewhere-glyph","presentation-glyph","paper-plane-glyph","question-mark-glyph","restore-file-glyph","search-glyph","star-glyph","play-audio-glyph","stop-audio-glyph","tomorrow-glyph","wand-glyph","workspace-glyph","yesterday-glyph","box-glyph","merge-files-glyph","merge-files","two-blank-pages","scissors","paste","paste-text","split","select-all-text","wand","github-glyph","reading-glasses","user-manual-filled","discord-filled","chat-bubbles-filled","experiment-filled","bracket-glyph","box-glyph","check-small","dice-glyph","dice","discord","right-triangle","heading-glyph","help","keyboard-toggle","broken-link","experiment","left-arrow","link","link-glyph","links-coming-in","links-going-out","open-vault","paused","question-mark-glyph","right-arrow","sidebar-left","sidebar-right","sheets-in-box","star-list","sync-small","tabs","uppercase-lowercase-a","vault","stack-horizontal","stack-vertical","stretch-horizontal","stretch-vertical","distribute-space-horizontal","distribute-space-vertical"];function i(e){let t=Date.now().toString(36);return t+=Math.random().toString(36).substr(3,e),t}function n(e,t,o,i){let n,s={index:-1,subindex:-1},a=i;return o?a.forEach(((e,o)=>{if("SubmenuCommands"in e&&(n=e.SubmenuCommands.findIndex((e=>e.id==t.id)),n>=0))return s={index:o,subindex:n},s})):(n=a.findIndex((e=>e.id==t.id)),s={index:n,subindex:-1}),s}function s(e,t){let o,i=t.getLine(t.getCursor().line),n="";const s=/^(\>*(\[[!\w]+\])?\s*)#+\s/;let a;const r=i.match(s);r&&(a=r[0].trim()),e==a||""==e?o=i.replace(s,"$1"):(o=i.replace(/^\s*(#*|\>|\-|\d+\.)\s*/m,""),o=e+" "+o),n=""!=o?t.getRange(t.getCursor(),{line:t.getCursor().line,ch:i.length}):t.getRange(t.getCursor(),{line:t.getCursor().line,ch:0}),t.setLine(t.getCursor().line,o),t.setCursor({line:t.getCursor().line,ch:Number(o.length-n.length)})}function a(e,t){if(!t)return;const o=t.getSelection();if(!o||""===o.trim())return;const i=/<font\s+color=["']?[^"'>]+["']?>(.*?)<\/font>/gms,n=i.test(o);if(s=o,new RegExp(`^<font\\s+color=["']?${e}["']?>(.+)<\\/font>$`,"ms").test(s.trim()))return;var s;const a=o.replace(i,((t,o)=>o.split("\n").map((t=>t.trim()?`<font color="${e}">${t}</font>`:t)).join("\n"))),r=a===o?o.split("\n").map((t=>t.trim()?`<font color="${e}">${t}</font>`:t)).join("\n"):a,l=t.listSelections().map((t=>{const o=n?0:`<font color="${e}"></font>`.length;return t.anchor.line<t.head.line||t.anchor.line===t.head.line&&t.anchor.ch<t.head.ch?{anchor:{line:t.anchor.line,ch:t.anchor.ch},head:{line:t.head.line,ch:t.head.ch+o}}:{anchor:{line:t.anchor.line,ch:t.anchor.ch+o},head:{line:t.head.line,ch:t.head.ch}}}));t.replaceSelection(r),t.setSelections(l)}function r(e,t){if(!t)return;const o=t.getSelection();if(!o||""===o.trim())return;const i=/<span\s+style=["']?background:(?:#[0-9a-fA-F]{3,6}|rgba?\([^)]+\))["']?>([\s\S]*?)<\/span>/g.test(o);if(((e,t)=>{const o=t.replace(/([()[{*+.$^\\|?])/g,"\\$1");return new RegExp(`^<span\\s+style=["']?background:${o}["']?>([sS]+)<\\/span>$`).test(e.trim())})(o,e))return;let n;n=i?o.replace(/(background:)(?:#[0-9a-fA-F]{3,6}|rgba?\([^)]+\))/gi,`$1${e}`):o.split("\n").map((t=>t.trim()?`<span style="background:${e}">${t}</span>`:t)).join("\n");const s=t.listSelections().map((t=>{const o=i?0:`<span style="background:${e}"></span>`.length;return t.anchor.line<t.head.line||t.anchor.line===t.head.line&&t.anchor.ch<t.head.ch?{anchor:{line:t.anchor.line,ch:t.anchor.ch},head:{line:t.head.line,ch:t.head.ch+o}}:{anchor:{line:t.anchor.line,ch:t.anchor.ch+o},head:{line:t.head.line,ch:t.head.ch}}}));t.replaceSelection(n),t.setSelections(s)}let l;const c=t=>{l=e.requireApiVersion("0.15.0")?activeWindow.document:window.document;let o=l.getElementById("editingToolbarModalBar");o&&(o.style.visibility=0==t?"hidden":"visible")},d=t=>{l=e.requireApiVersion("0.15.0")?activeWindow.document:window.document,l.documentElement.style.setProperty("--toolbar-vertical-offset",`${t.verticalPosition}px`);let o=l.getElementById("editingToolbarModalBar");o&&"fixed"==t.positionStyle&&o.setAttribute("style",`left: calc(50% - calc(${28*t.cMenuNumRows}px / 2)); bottom: 4.25em; grid-template-columns: repeat(${t.cMenuNumRows}, 28px)`)},u=t=>{l=e.requireApiVersion("0.15.0")?activeWindow.document:window.document,l.documentElement.style.setProperty("--toolbar-horizontal-offset",`${t.horizontalPosition}px`)};var p={"Editing Toolbar append method":"Editing Toolbar append method","Choose where Editing Toolbar will append upon regeneration. To see the change, hit the refresh button below, or in the status bar menu.":"Choose where Editing Toolbar will append upon regeneration. To see the change, hit the refresh button below, or in the status bar menu.","Editing Toolbar aesthetic":"Editing Toolbar aesthetic","Choose between a glass morphism ,tiny and default style for Editing Toolbar. To see the change, hit the refresh button below, or in the status bar menu.":"Choose between a glass morphism ,tiny and default style for Editing Toolbar. To see the change, hit the refresh button below, or in the status bar menu.","Editing Toolbar position":"Editing Toolbar position","Choose between fixed position or cursor following mode.":"Choose between fixed position , cursor following or Top mode .","Editing Toolbar columns":"Editing Toolbar columns","Choose the number of columns per row to display on Editing Toolbar.":"Choose the number of columns per row to display on Editing Toolbar.","Editing Toolbar refresh":"Editing Toolbar refresh","Editing Toolbar commands":"Editing Toolbar commands","Add a command onto Editing Toolbar from Obsidian's commands library. To reorder the commands, drag and drop the command items. To delete them, use the delete buttom to the right of the command item. Editing Toolbar will not automaticaly refresh after reordering commands. Use the refresh button above.":"Add a command onto Editing Toolbar from Obsidian's commands library. To reorder the commands, drag and drop the command items. To delete them, use the delete buttom to the right of the command item. Editing Toolbar will not automaticaly refresh after reordering commands. Use the refresh button above.","Format Brush Off!":"Format Brush Off!","Hide & Show":"Hide & Show","Editing Toolbar will only refresh automatically after you have either added or deleted a command from it. To see UI changes to editingToolbar (above settings changes) use the refresh button. If you forget to refresh in settings, no worries. There is also a refresh button in the editingToolbar status bar menu.":"Editing Toolbar will only refresh automatically after you have either added or deleted a command from it. To see UI changes to editingToolbar (above settings changes) use the refresh button. If you forget to refresh in settings, no worries. There is also a refresh button in the editingToolbar status bar menu.","Font-Color formatting brush ON!":"Font-Color formatting brush ON!",More:"More","Font Colors":"Font Colors","Format Brush":"Format Brush","Background color":"Background color",Refresh:"Refresh",Add:"Add",Delete:"Delete","Change Command name":"Change Command name","Add submenu":"Add submenu","add hr":"add hr","Enter the icon code, it looks like <svg>.... </svg> format":"Enter the icon code, it looks like <svg>.... </svg> format","Please enter a new name":"Please enter a new name","Drag the slider to move the position":"Drag the slider to move the position","Plugin Settings":"Plugin Settings","Background-color formatting brush ON!":"Background-color formatting brush ON!\nClick the mouse middle or right key to close the formatting-brush","Clear formatting brush ON!":"Clear formatting brush ON!","Clear formatting brush ON!\nClick the mouse middle or right key to close the formatting-brush":"Clear formatting brush ON!\nClick the mouse middle or right key to close the formatting-brush","The toolbar is displayed when the mouse moves over it, otherwise it is automatically hidden":"The toolbar is displayed when the mouse moves over it, otherwise it is automatically hidden","Editing Toolbar Auto-hide":"Editing Toolbar Auto-hide","Custom Backgroud Color":"Custom Backgroud Color","Custom Font Color":"Custom Font Color","🎨 Set custom background":"🎨 Set custom background","🖌 Set custom font color":"🖌 Set custom font color","Click on the picker to adjust the colour":"Click on the picker to adjust the colour","Mobile enabled or not":"Mobile enabled or not","Whether to enable the plugin for the mobile client, the default is enabled.":"Whether to enable the plugin for the mobile client, the default is enabled.","Whether to enable on mobile devices with device width less than 768px, the default is disable.":"Whether to enable on mobile devices with device width less than 768px, the default is disable.",Reset:"Reset",Fix:"Fix","Fix Editing Toolbar":"Fix Editing Toolbar",General:"General",Appearance:"Appearance",Commands:"Commands","Choose between fixed position or cursor following mode":"Choose between fixed position , cursor following or Top mode .","Add and manage commands":"Add and manage commands","Choose where Editing Toolbar will append upon regeneration.":"Choose where Editing Toolbar will append upon regeneration.","Whether to enable on mobile devices with device width less than 768px":"Whether to enable on mobile devices with device width less than 768px","Choose between a glass morphism, tiny and default style":"Choose between a glass morphism, tiny and default style","Refresh Toolbar":"Refresh Toolbar","Add Command":"Add Command",Settings:"Settings","Position Style":"Position Style",Columns:"Columns","Drag to Adjust Position":"Drag to Adjust Position","Vertical Position":"Vertical Position","Horizontal Position":"Horizontal Position","Toolbar Position":"Toolbar Position","Choose an icon":"Choose an icon","Search for an icon...":"Search for an icon...",All:"All",Obsidian:"Obsidian",Glyph:"Glyph",Custom:"Custom","Choose a command":"Choose a command","The command":"The command","already exists":"already exists","Enter the icon code, format as <svg>.... </svg>":"Enter the icon code, format as <svg>.... </svg>","No matching icons found":"No matching icons found","Custom Commands":"Custom Commands","Toolbar Commands":"Toolbar Commands",ID:"ID",Prefix:"Prefix",Suffix:"Suffix",Pattern:"Pattern","Custom Format Commands":"Custom Format Commands","Add, edit or delete custom format commands":"Add, edit or delete custom format commands",Edit:"Edit","Command ID":"Command ID",'Unique identifier, no spaces, e.g.: "my-custom-format"':'Unique identifier, no spaces, e.g.: "my-custom-format"',"Displayed name in toolbar and menu":"Displayed name in toolbar and menu","Add content before selected text":"Add content before selected text","Add content after selected text":"Add content after selected text","Character offset of cursor after formatting":"Character offset of cursor after formatting","Line offset of cursor after formatting":"Line offset of cursor after formatting","Whether to insert at the beginning of the next line":"Whether to insert at the beginning of the next line","Command icon (click to select)":"Command icon (click to select)","Choose Icon":"Choose Icon",Save:"Save",Cancel:"Cancel","Edit Custom Command":"Edit Custom Command","Add Custom Command":"Add Custom Command","Command ID and command name cannot be empty":"Command ID and command name cannot be empty","Command ID cannot contain spaces":"Command ID cannot contain spaces",'Command ID "${this.commandId}" already exists':'Command ID "${this.commandId}" already exists',"Cursor Position Offset":"Cursor Position Offset","Line Offset":"Line Offset","Line Head Format":"Line Head Format",Icon:"Icon","Command Name":"Command Name","Are you sure you want to restore all settings to default? This will lose all your custom configurations.":"Are you sure you want to restore all settings to default? This will lose all your custom configurations.","Restore default":"Restore default","Restore default settings":"Restore default settings","🔄Restore default settings":"🔄Restore default settings","🔧Data repair":"🔧Data repair","Command IDs have been successfully repaired!":"Command IDs have been successfully repaired!","No command IDs need to be repaired":"No command IDs need to be repaired","Error repairing command IDs, please check the console for details":"Error repairing command IDs, please check the console for details","Error restoring default settings, please check the console for details":"Error restoring default settings, please check the console for details","Successfully restored default settings!":"Successfully restored default settings!",Close:"Close",Tips:"Tips","This update changed the ID of some commands, please click this button to repair the commands to ensure the toolbar works properly":"This update changed the ID of some commands, please click this button to repair the commands to ensure the toolbar works properly","Repair command ID":"Repair command ID","This will reset all your custom configurations":"This will reset all your custom configurations","Notice:":"Notice:","This update rebuilds the entire code, reducing resource consumption":"This update rebuilds the entire code, reducing resource consumption","Optimized mobile usage, added canvas support, and added custom commands":"Optimized mobile usage, added canvas support, and added custom commands","This update is not compatible with 2.x version command ids, please click [Repair command] to be compatible":"This update is not compatible with 2.x version command ids, please click [Repair command] to be compatible","If you want to restore the default settings, please click [Restore default settings]":"If you want to restore the default settings, please click [Restore default settings]","Please execute a editingToolbar format command first, then enable the format brush":"Please execute a editingToolbar format command first, then enable the format brush","Format brush ON! Select text to apply":"Format brush ON! Select text to apply","format":"format\nClick the mouse middle or right key to close the formatting-brush","Add to Toolbar":"Add to Toolbar","This command is already in the toolbar":"This command is already in the toolbar","Command added to toolbar":"Command added to toolbar","Add this command to the toolbar":"Add this command to the toolbar","Callout Type":"Callout Type",Title:"Title","Optional, leave blank for default title":"Optional, leave blank for default title","Input title":"Input title","Collapse State":"Collapse State",Open:"Open",Closed:"Closed",Content:"Content",Insert:"Insert",Default:"Default","Input content":"Input content","Link Text":"Link Text","Link Alias":"Link Alias","Link URL":"Link URL","Embed Content":"Embed Content","Image Size":"Image Size","Insert New Line":"Insert New Line","Paste and Parse":"Paste and Parse","URL Format Error":"URL Format Error","Image Width":"Image Width","Image Height":"Image Height","If it is an image, turn on":"If it is an image, turn on","Insert a link on the next line":"Insert a link on the next line","Link Alias(optional)":"Link Alias(optional)",Alias:"Alias",Optional:"Optional","Default 0, format will keep the text selected":"Default 0, format will keep the text selected","to insert":"to insert","Latest Changes":"Latest Changes","📋View full changelog":"📋View full changelog","Open changelog":"Open changelog","Loading changelog...":"Loading changelog...","Open the complete changelog in your browser":"Open the complete changelog in your browser","Enable multiple configurations":"Enable multiple configurations","Enable different command configurations for each position style (following, top, fixed)":"Enable different command configurations for each position style (following, top, fixed)","Currently editing commands for":"Currently editing commands for","position style":"position style","Current Configuration":"Current Configuration","Switch between different command configurations":"Switch between different command configurations","Following Style":"Following Style","Top Style":"Top Style","Fixed Style":"Fixed Style","Mobile Style":"Mobile Style",configuration:"configuration","Deploy command to configurations":"Deploy command to configurations","All Configurations":"All Configurations",Deploy:"Deploy","Command deployed to selected configurations":"Command deployed to selected configurations","No configuration selected for deployment":"No configuration selected for deployment","Command already exists in selected configurations":"Command already exists in selected configurations","Command deployed to: ":"Command deployed to: ","Command deleted":"Command deleted","Confirm delete?":"Confirm delete?","Are you sure you want to restore all settings to default? But custom commands will be preserved.":"Are you sure you want to restore all settings to default? But custom commands will be preserved.","Successfully restored default settings! (Custom commands preserved)":"Successfully restored default settings! (Custom commands preserved)","This will reset all your custom configurations, but custom commands will be preserved":"This will reset all your custom configurations, but custom commands will be preserved","Import/Export":"Import/Export","Export Configuration":"Export Configuration","Export your toolbar configuration to share with others":"Export your toolbar configuration to share with others",Export:"Export","Import Configuration":"Import Configuration","Import toolbar configuration from JSON":"Import toolbar configuration from JSON",Import:"Import","Usage Instructions":"Usage Instructions","Export: Generate a JSON configuration that you can save or share":"Export: Generate a JSON configuration that you can save or share","Import: Paste a previously exported JSON configuration":"Import: Paste a previously exported JSON configuration","You can choose to export all settings, only toolbar commands, or only custom commands":"You can choose to export all settings, only toolbar commands, or only custom commands","When importing, the plugin will only update the settings included in the import data":"When importing, the plugin will only update the settings included in the import data","Warning: Importing configuration will overwrite your current settings. Consider exporting your current configuration first as a backup.":"Warning: Importing configuration will overwrite your current settings. Consider exporting your current configuration first as a backup.","Export Type":"Export Type","Choose what to export":"Choose what to export","All Settings":"All Settings","Toolbar Commands Only":"Toolbar Commands Only","Custom Commands Only":"Custom Commands Only","Export Content":"Export Content","Copy this content to share with others":"Copy this content to share with others","Loading...":"Loading...","Copy to Clipboard":"Copy to Clipboard","Configuration copied to clipboard":"Configuration copied to clipboard","Failed to copy configuration":"Failed to copy configuration","Paste the configuration JSON here":"Paste the configuration JSON here","Paste configuration here...":"Paste configuration here...","Invalid import data":"Invalid import data","Configuration imported successfully":"Configuration imported successfully","No valid configuration found in import data":"No valid configuration found in import data","Failed to import configuration. Invalid format.":"Failed to import configuration. Invalid format.","Import Mode":"Import Mode","Choose how to import the configuration":"Choose how to import the configuration","Update Mode (Add new items and update existing ones)":"Update Mode (Add new items and update existing ones)","Overwrite Mode (Replace all settings with imported ones)":"Overwrite Mode (Replace all settings with imported ones)","Configuration imported successfully (Overwrite mode)":"Configuration imported successfully (Overwrite mode)","Configuration imported successfully (Update mode)":"Configuration imported successfully (Update mode)","Warning: Overwrite mode will completely replace your current settings with the imported ones. Consider exporting your current configuration first as a backup.":"Warning: Overwrite mode will completely replace your current settings with the imported ones. Consider exporting your current configuration first as a backup.","Warning: Update mode will add new items and update existing ones based on the imported configuration.":"Warning: Update mode will add new items and update existing ones based on the imported configuration.","Add Format Command":"Add Format Command",Regex:"Regex","Prefix/Suffix":"Prefix/Suffix","Add Regex Command":"Add Regex Command","Please select text first":"Please select text first","The selected text does not meet the condition requirements":"The selected text does not meet the condition requirements","Regex command execution error:":"Regex command execution error:","Copy code":"Copy code","Copied!":"Copied!","Explain the syntax of JavaScript regular expressions":"Explain the syntax of JavaScript regular expressions","Apply regular expression replacement":"Apply regular expression replacement","Conditional matching":"Conditional matching","Complete regular expression code (copy to AI for explanation)":"Complete regular expression code (copy to AI for explanation)","Error:":"Error:","Regex pattern cannot be empty":"Regex pattern cannot be empty","Command already exists":"Command already exists","Choose icon":"Choose icon","URL to Markdown link":"URL to Markdown link","Convert MM/DD/YYYY to YYYY-MM-DD":"Convert MM/DD/YYYY to YYYY-MM-DD","Add bold to keywords":"Add bold to keywords","Format phone number":"Format phone number","Remove extra spaces":"Remove extra spaces","Convert HTML bold tags to Markdown format":"Convert HTML bold tags to Markdown format","Convert quoted text to quote block":"Convert quoted text to quote block","Convert CSV to Markdown table row":"Convert CSV to Markdown table row","Add uniform alias to Markdown links":"Add uniform alias to Markdown links","Delete empty lines (multiline mode)":"Delete empty lines (multiline mode)","Add list symbol to each line (multiline mode)":"Add list symbol to each line (multiline mode)","If the text contains important, set the text highlight (conditional format)":"If the text contains important, set the text highlight (conditional format)","Matching pattern":"Matching pattern","Regex pattern to match":"Regex pattern to match","Replacement pattern (use $1, $2, etc. to reference capture groups)":"Replacement pattern (use $1, $2, etc. to reference capture groups)","Ignore case":"Ignore case","Global replace":"Global replace","Multiline mode":"Multiline mode","Use condition":"Use condition","Condition pattern":"Condition pattern","Only apply custom command when text matches the condition":"Only apply custom command when text matches the condition","Must exist regular expression or text":"Must exist regular expression or text","Replacement pattern":"Replacement pattern","Match case-insensitive":"Match case-insensitive","^ and $ match the start and end of each line":"^ and $ match the start and end of each line","Replace all matches":"Replace all matches",Command:"Command","Error: ":"Error:","Input example text to view the formatting effect of the command...":"Input example text to view the formatting effect of the command...",Description:"Description","[Example]":"[Example]","[Requirements]":"[Requirements]","[Output]":"[Output]","AI question template:":"AI question template:","I need to convert the url to a markdown format link":"I need to convert the url to a markdown format link","For example, convert https://example.com to [https://example.com](https://example.com)":"For example, convert https://example.com to [https://example.com](https://example.com)","Use js regular expression to implement, and output the parameters in the following format (the result does not need to be escaped with json)":"Use js regular expression to implement, and output the parameters in the following format (the result does not need to be escaped with json)","[Description]":"[Description]","How to use AI to get regular expressions?":"How to use AI to get regular expressions?","Regular expression examples":"Regular expression examples","Edit regular expression command":"Edit regular expression command","Add regular expression command":"Add regular expression command","Result:":"Result:","Example text:":"Example text:",Preview:"Preview",Result:"Result","Please select text or copy text to clipboard first":"Please select text or copy text to clipboard first","Overwrite Import":"Overwrite Import","Update Import":"Update Import","Importing configuration...":"Importing configuration...","Following Style Only":"Following Style Only","Top Style Only":"Top Style Only","Fixed Style Only":"Fixed Style Only","Mobile Style Only":"Mobile Style Only","Unknown import type":"Unknown import type","All Toolbar Commands":"All Toolbar Commands","Initialize Commands":"Initialize Commands","Copy commands from the main menu configuration":"Copy commands from the main menu configuration","Initialize commands to default settings":"Initialize commands to default settings","Reset Commands":"Reset Commands","Commands reset successfully":"Commands reset successfully","Following style commands initialized from current menu commands":"Following style commands initialized from current menu commands","Commands initialized successfully":"Commands initialized successfully","Reset to Menu Commands":"Reset to Menu Commands","Are you sure you want to reset the current configuration?":"Are you sure you want to reset the current configuration?","Following style commands successfully initialized":"Following style commands successfully initialized","Top style commands successfully initialized":"Top style commands successfully initialized","Fixed style commands successfully initialized":"Fixed style commands successfully initialized","Mobile style commands successfully initialized":"Mobile style commands successfully initialized","Reset commands to default settings":"Reset commands to default settings",Clear:"Clear","Remove all commands from this configuration":"Remove all commands from this configuration","Are you sure you want to clear all commands under the current style?":"Are you sure you want to clear all commands under the current style?","Current style commands have been cleared":"Current style commands have been cleared","Manage Commands":"Manage Commands","Reset or clear all commands in this configuration":"Reset or clear all commands in this configuration","One-click clear":"One-click clear","Import Commands from Other Styles":"Import Commands from Other Styles","Copy commands from another style configuration":"Copy commands from another style configuration","Main menu only":"Main menu only","This import will update:":"This import will update:","Custom commands":"Custom commands","Toolbar commands":"Toolbar commands","General settings":"General settings","Please paste configuration data first":"Please paste configuration data first","Invalid import data format":"Invalid import data format","Import From":"Import From","This import will:":"This import will:","Update general settings":"Update general settings","Update Main Menu Commands":"Update Main Menu Commands","Update Custom Commands":"Update Custom Commands","Update Following Style Commands":"Update Following Style Commands","Update Top Style Commands":"Update Top Style Commands","Update Fixed Style Commands":"Update Fixed Style Commands","Update Mobile Style Commands":"Update Mobile Style Commands","Clear all Main Menu Commands":"Clear all Main Menu Commands","Clear all Custom Commands":"Clear all Custom Commands","Clear all Following Style Commands":"Clear all Following Style Commands","Clear all Top Style Commands":"Clear all Top Style Commands","Clear all Fixed Style Commands":"Clear all Fixed Style Commands","Clear all Mobile Style Commands":"Clear all Mobile Style Commands","Overwrite Mode (Replace settings with imported ones)":"Overwrite Mode (Replace settings with imported ones)","Warning: Overwrite mode will replace existing settings with imported ones.":"Warning: Overwrite mode will replace existing settings with imported ones.","Warning: Update mode will add new items and update existing ones.":"Warning: Update mode will add new items and update existing ones.","Enable Multiple Config":"Enable Multiple Config","Set Multiple Config to:":"Set Multiple Config to:",Enable:"Enable",Disable:"Disable","Set Position Style to:":"Set Position Style to:",Following:"Following",Top:"Top",Fixed:"Fixed",Mobile:"Mobile","All commands":"All commands"," Overwrite mode will replace existing settings with imported ones.":" Overwrite mode will replace existing settings with imported ones."," Update mode will merge imported settings with existing ones.":" Update mode will merge imported settings with existing ones.","Do you want to continue?":"Do you want to continue?","Imported settings:":"Imported settings:","Imported commands:":"Imported commands:","Disable toolbar for this view":"Disable toolbar for this view","Enable toolbar for this view":"Enable toolbar for this view","Manage all view types":"Manage all view types","Current View: ":"Current View: ","Appearance Style":"Appearance Style","Position Settings":"Position Settings"},m={"Editing Toolbar append method":"","Choose where Editing Toolbar will append upon regeneration. To see the change, hit the refresh button below, or in the status bar menu.":"Obsidianbody","Editing Toolbar aesthetic":"","Choose between a glass morphism ,tiny and default style for Editing Toolbar. To see the change, hit the refresh button below, or in the status bar menu.":",","Editing Toolbar position":"","Choose between fixed position or cursor following mode.":",","Editing Toolbar columns":"","Choose the number of columns per row to display on Editing Toolbar.":"Editing Toolbar","Editing Toolbar refresh":"","Editing Toolbar commands":"","Add a command onto Editing Toolbar from Obsidian's commands library. To reorder the commands, drag and drop the command items. To delete them, use the delete buttom to the right of the command item. Editing Toolbar will not automaticaly refresh after reordering commands. Use the refresh button above.":"Obsidian使Custom","Format Brush Off!":"","Hide & Show":" & ","Editing Toolbar will only refresh automatically after you have either added or deleted a command from it. To see UI changes to editingToolbar (above settings changes) use the refresh button. If you forget to refresh in settings, no worries. There is also a refresh button in the editingToolbar status bar menu.":"使","Font-Color formatting brush ON!":"\n",More:"","Font Colors":"","Format Brush":"","Background color":"",Refresh:"",Add:"",Delete:"","Change Command name":"","Add submenu":"","add hr":"线","Enter the icon code, it looks like <svg>.... </svg> format":"<svg>.... </svg>","Please enter a new name":"","Drag the slider to move the position":"","Plugin Settings":"","Background-color formatting brush ON!":"","Clear formatting brush ON!":"","Clear formatting brush ON!\nClick the mouse middle or right key to close the formatting-brush":"\n","The toolbar is displayed when the mouse moves over it, otherwise it is automatically hidden":"","Editing Toolbar Auto-hide":"","Custom Backgroud Color":"","Custom Font Color":"","🎨 Set custom background":"🎨 ","🖌 Set custom font color":"🖌 ","Click on the picker to adjust the colour":"","Mobile enabled or not":"","Whether to enable on mobile devices with device width less than 768px, the default is disable.":"768",Reset:"",Fix:"","Fix Editing Toolbar":"",General:"",Appearance:"",Commands:"","Choose between fixed position or cursor following mode":"","Add and manage commands":"","Choose where Editing Toolbar will append upon regeneration.":"Obsidian","Whether to enable on mobile devices with device width less than 768px":"","Choose between a glass morphism, tiny and default style":",","Refresh Toolbar":"","Add Command":"",Settings:"","Adjust Toolbar Position[Fixed mode]":"[]","Position Style":"",Columns:"","Drag to Adjust Position":"","Vertical Position":"","Horizontal Position":"","Toolbar Position":"","Choose an icon":"","Search for an icon...":"...",All:"",Obsidian:"Obsidian",Glyph:"Glyph",Custom:"","Choose a command":"","The command":"","already exists":"","Enter the icon code, format as <svg>.... </svg>":" <svg>.... </svg>","No matching icons found":"","Custom Commands":"","Toolbar Commands":"",ID:"ID",Prefix:"",Suffix:"","Custom Format Commands":"","Add, edit or delete custom format commands":"",Edit:"","Command ID":"ID",'Unique identifier, no spaces, e.g.: "my-custom-format"':'"my-custom-format"',"Displayed name in toolbar and menu":"","Add content before selected text":"","Add content after selected text":"","Character offset of cursor after formatting":"","Line offset of cursor after formatting":"","Whether to insert at the beginning of the next line":"","Command icon (click to select)":"","Choose Icon":"",Save:"",Cancel:"","Edit Custom Command":"","Add Custom Command":"","Command ID and command name cannot be empty":"ID","Command ID cannot contain spaces":"ID",'Command ID "${this.commandId}" already exists':'ID "${this.commandId}" ',"Command Name":"","Cursor Position Offset":"","Line Offset":"","Line Head Format":"",Icon:"","Are you sure you want to restore all settings to default? This will lose all your custom configurations.":"","Restore default":"","Restore default settings":"","🔄Restore default settings":"🔄","🔧Data repair":"🔧","Command IDs have been successfully repaired!":"ID","No command IDs need to be repaired":"ID","Error repairing command IDs, please check the console for details":"ID","Error restoring default settings, please check the console for details":"","Successfully restored default settings!":"",Close:"",Tips:"","This update changed the ID of some commands, please click this button to repair the commands to ensure the toolbar works properly":"ID","Repair command ID":"ID","This will reset all your custom configurations":"","Notice:":"","This update rebuilds the entire code, reducing resource consumption":"","Optimized mobile usage, added canvas support, and added custom commands":"canvas","This update is not compatible with 2.x version command ids, please click [Repair command] to be compatible":"2.xid","If you want to restore the default settings, please click [Restore default settings]":"","Please execute a editingToolbar format command first, then enable the format brush":"","Format brush ON! Select text to apply":"\n","format":"\n","Add to Toolbar":"","This command is already in the toolbar":"","Command added to toolbar":"","Add this command to the toolbar":"","Callout Type":"Callout ",Title:"","Optional, leave blank for default title":"使","Input title":"","Collapse State":"",Open:"",Closed:"",Content:"",Insert:"",Default:"","Input content":"","Link Text":"","Link Alias":"","Link URL":"","Embed Content":"","Image Size":"","Insert New Line":"","Paste and Parse":"","URL Format Error":"URL","Image Width":"","Image Height":"","Insert a link on the next line":"","If it is an image, turn on":"","Link Alias(optional)":"()",Alias:"",Optional:"","Default 0, format will keep the text selected":"0","to insert":"","Latest Changes":"","📋View full changelog":"📋","Open changelog":"","Loading changelog...":"...","Open the complete changelog in your browser":"","Enable multiple configurations":"","Enable different command configurations for each position style (following, top, fixed)":"followingtopfixed","Currently editing commands for":"","position style":"","Current Configuration":"","Switch between different command configurations":"","Following Style":"","Top Style":"","Fixed Style":"","Mobile Style":"",configuration:"","Deploy command to configurations":"","All Configurations":"",Deploy:"","Command deployed to selected configurations":"","No configuration selected for deployment":"","Command already exists in selected configurations":"","Command deployed to: ":"","Command deleted":"","Confirm delete?":"","Are you sure you want to restore all settings to default? But custom commands will be preserved.":"","Successfully restored default settings! (Custom commands preserved)":"","This will reset all your custom configurations, but custom commands will be preserved":"","Import/Export":"/","Export Configuration":"","Export your toolbar configuration to share with others":"",Export:"","Import Configuration":"","Import toolbar configuration from JSON":"JSON",Import:"","Usage Instructions":"使","Export: Generate a JSON configuration that you can save or share":"JSON","Import: Paste a previously exported JSON configuration":"JSON","You can choose to export all settings, only toolbar commands, or only custom commands":"","When importing, the plugin will only update the settings included in the import data":"","Warning: Importing configuration will overwrite your current settings. Consider exporting your current configuration first as a backup.":"","Export Type":"","Choose what to export":"","All Settings":"","Toolbar Commands Only":"","Custom Commands Only":"","Export Content":"","Copy this content to share with others":"","Loading...":"...","Copy to Clipboard":"","Configuration copied to clipboard":"","Failed to copy configuration":"","Paste the configuration JSON here":"JSON","Paste configuration here...":"...","Invalid import data":"","Configuration imported successfully":"","No valid configuration found in import data":"","Failed to import configuration. Invalid format.":"","Import Mode":"","Choose how to import the configuration":"","Update Mode (Add new items and update existing ones)":"","Overwrite Mode (Replace all settings with imported ones)":"","Configuration imported successfully (Overwrite mode)":"","Configuration imported successfully (Update mode)":"","Warning: Overwrite mode will completely replace your current settings with the imported ones. Consider exporting your current configuration first as a backup.":"","Warning: Update mode will add new items and update existing ones based on the imported configuration.":"","Add Format Command":"",Regex:"","Prefix/Suffix":"/","Add Regex Command":"","Please select text first":"","The selected text does not meet the condition requirements":"","Regex command execution error:":"","Copy code":"","Copied!":"","Explain the syntax of JavaScript regular expressions":"JavaScript","Apply regular expression replacement":"","Conditional matching":"","Complete regular expression code (copy to AI for explanation)":"AI","Error:":"","Regex pattern cannot be empty":"","Command already exists":"","Choose icon":"","URL to Markdown link":"URLMarkdown","Convert MM/DD/YYYY to YYYY-MM-DD":"MM/DD/YYYYYYYY-MM-DD","Add bold to keywords":"","Format phone number":"","Remove extra spaces":"","Convert HTML bold tags to Markdown format":"HTMLMarkdown","Convert quoted text to quote block":"","Convert CSV to Markdown table row":"CSVMarkdown","Add uniform alias to Markdown links":"Markdown","Delete empty lines (multiline mode)":"","Add list symbol to each line (multiline mode)":"","If the text contains important, set the text highlight (conditional format)":"","Matching pattern":"","Regex pattern to match":"","Replacement pattern (use $1, $2, etc. to reference capture groups)":"使$1, $2","Ignore case":"","Global replace":"","Multiline mode":"","Use condition":"使","Condition pattern":"","Only apply custom command when text matches the condition":"","Must exist regular expression or text":"","Replacement pattern":"","Match case-insensitive":"","^ and $ match the start and end of each line":"^ $ ","Replace all matches":"",Command:"","Error: ":"","Input example text to view the formatting effect of the command...":"...",Description:"","[Example]":"[]","[Requirements]":"[]","[Output]":"[]","AI question template:":"AI","I need to convert the url to a markdown format link":"URLMarkdown","For example, convert https://example.com to [https://example.com](https://example.com)":"https://example.com[https://example.com](https://example.com)","Use js regular expression to implement, and output the parameters in the following format (the result does not need to be escaped with json)":"使jsjson","[Description]":"[]","How to use AI to get regular expressions?":"使AI","Regular expression examples":"","Edit regular expression command":"","Add regular expression command":"","Result:":"","Example text:":"",Preview:"",Result:"","Update Import":"","Overwrite Import":"","Importing configuration...":"...","Following Style Only":"Following","Top Style Only":"Top","Fixed Style Only":"Fixed","Mobile Style Only":"Mobile","Unknown import type":"","All Toolbar Commands":"","Following style commands successfully initialized":"Following","Top style commands successfully initialized":"Top","Fixed style commands successfully initialized":"Fixed","Mobile style commands successfully initialized":"Mobile","Commands initialized successfully":"","Reset Commands":"","Are you sure you want to reset the current configuration?":"","Commands reset successfully":"","Initialize Commands":"","Initialize commands to default settings":"","Reset commands to default settings":"",Clear:"","Remove all commands from this configuration":"","Are you sure you want to clear all commands under the current style?":"","Current style commands have been cleared":"","Manage Commands":"","Reset or clear all commands in this configuration":"","Import Commands from Other Styles":"","Copy commands from another style configuration":"","Main menu only":"Main menu only","This import will update:":"","Custom commands":"","Toolbar commands":"","All settings":"","Following style only":"","Top style only":"","Fixed style only":"","Mobile style only":"","Main Menu Commands":"","Following Style Commands":"","Top Style Commands":"","Fixed Style Commands":"","Mobile Style Commands":"","General settings":"","Please paste configuration data first":"","Invalid import data format":"","Do you want to continue?":"","Warning: Update mode will add new items and update existing ones.":"","Warning: Overwrite mode will completely replace your current settings with the imported ones.":"","Overwrite Mode (Replace settings with imported ones)":"","Warning: Overwrite mode will replace existing settings with imported ones.":"","Enable Multiple Config":"","One-click clear":"","This import will:":"","Update general settings":"","Update Main Menu Commands":"","Update Custom Commands":"","Update Following Style Commands":"","Update Top Style Commands":"","Update Fixed Style Commands":"","Clear all Main Menu Commands":"","Clear all Custom Commands":"","Clear all Following Style Commands":"","Clear all Top Style Commands":"","Clear all Fixed Style Commands":"","Clear all Mobile Style Commands":"","Set Multiple Config to:":"",Enable:"",Disable:"","Set Position Style to:":"",Following:"",Top:"",Fixed:"",Mobile:"","All commands":""," Overwrite mode will replace existing settings with imported ones.":" "," Update mode will merge imported settings with existing ones.":" ","Imported settings:":"","Imported commands:":"","Disable toolbar for this view":"","Enable toolbar for this view":"","Manage all view types":"","Current View: ":"","Appearance Style":"","Position Settings":""},h=Object.assign({},m);const g={ar:{},cs:{},da:{},de:{},en:p,"en-gb":{},es:{},fr:{},hi:{},id:{},it:{},ja:{},ko:{},nl:{},nn:{},pl:{},pt:{},"pt-br":{},ro:{},ru:{},tr:{},"zh-cn":m,"zh-tw":h}[e.moment.locale()];function f(e){return g&&g[e]||p[e]}class b extends e.FuzzySuggestModal{constructor(e,t,o=!1,i,n){super(e.app),this.customCallback=null,this.plugin=e,this.command=t,this.issub=o,this.customCallback=i||null,this.setPlaceholder(f("Choose an icon")),this.currentEditingConfig=n||""}capitalJoin(e){return e.split(" ").map((e=>e[0].toUpperCase()+e.substring(1))).join(" ")}getItems(){return o}getItemText(e){return this.capitalJoin(e.replace("feather-","").replace("remix-","").replace("bx-","").replace(/([A-Z])/g," $1").trim().replace(/-/gi," "))}renderSuggestion(t,o){const i=createSpan({cls:"editingToolbarIconPick"});o.appendChild(i),e.setIcon(i,t.item),super.renderSuggestion(t,o)}onChooseItem(e){return t(this,void 0,void 0,(function*(){if("Custom"===e)return this.customCallback?void new v(this.app,this.plugin,{id:this.command.id,name:this.command.name,icon:""},this.issub,(e=>{this.customCallback(e)})).open():void new v(this.app,this.plugin,this.command,this.issub,null,this.currentEditingConfig).open();if(this.customCallback)return void this.customCallback(e);const t=this.plugin.getCurrentCommands(this.currentEditingConfig);if(this.command.icon){let o=n(this.plugin,this.command,this.issub,t);this.issub?t[o.index].SubmenuCommands[o.subindex].icon=e:t[o.index].icon=e,this.plugin.updateCurrentCommands(t)}else this.command.icon=e,t.push(this.command),this.plugin.updateCurrentCommands(t);yield this.plugin.saveSettings(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100),console.log(`%c '${this.command.name}' `,"color: Violet")}))}}class v extends e.Modal{constructor(e,t,o,i,n,s){super(e),this.customCallback=null,this.plugin=t,this.item=o,this.issub=i,this.customCallback=n||null,this.currentEditingConfig=s||"",this.containerEl.addClass("editingToolbar-Modal"),this.containerEl.addClass("customicon")}onOpen(){const{contentEl:e}=this;e.createEl("b",{text:f("Enter the icon code, format as <svg>.... </svg>")});const o=document.createElement("textarea");o.className="wideInputPromptInputEl",o.placeholder="",o.value=this.item.icon||"",o.style.width="100%",o.style.height="200px",e.appendChild(o),o.addEventListener("input",(()=>t(this,void 0,void 0,(function*(){const e=o.value;if(this.customCallback)return void(this.item.icon=e);this.item.icon=e;const t=this.plugin.getCurrentCommands(this.currentEditingConfig),i=n(this.plugin,this.item,this.issub,t);if(this.issub){let t=i.subindex;-1===t?this.plugin.settings.menuCommands[i.index].SubmenuCommands.push(this.item):this.plugin.settings.menuCommands[i.index].SubmenuCommands[t].icon=e}else{let e=i.index;-1===e?this.plugin.settings.menuCommands.push(this.item):this.plugin.settings.menuCommands[e].icon=this.item.icon}yield this.plugin.saveSettings()})))),this.submitEnterCallback&&o.addEventListener("keydown",this.submitEnterCallback)}onClose(){const{contentEl:e}=this;e.empty(),this.customCallback?this.customCallback(this.item.icon||""):setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100)}}class y extends e.FuzzySuggestModal{constructor(e,t){super(e.app),this.plugin=e,this.app,this.setPlaceholder(f("Choose a command")),this.currentEditingConfig=t||""}getItems(){return app.commands.listCommands()}getItemText(e){return e.name}onChooseItem(o){return t(this,void 0,void 0,(function*(){const t=this.plugin.getCurrentCommands(this.currentEditingConfig);t.findIndex((e=>e.id==o.id))>-1?new e.Notice(f("The command")+o.name+f("already exists"),3e3):o.icon?(t.push(o),this.plugin.updateCurrentCommands(t),yield this.plugin.saveSettings(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100),console.log(`%c '${o.name}' `,"color: Violet")):new b(this.plugin,o,!1).open()}))}}class C extends e.Modal{constructor(e,t,o,i,n){super(t.app),this.plugin=t,this.item=o,this.issub=i,this.currentEditingConfig=n||"",this.containerEl.addClass("editingToolbar-Modal"),this.containerEl.addClass("changename")}onOpen(){var o;const{contentEl:i}=this;i.createEl("b",{text:f("Please enter a new name")});const s=new e.TextComponent(i);s.inputEl.classList.add("InputPromptInputEl"),s.setPlaceholder("").setValue(null!==(o=this.item.name)&&void 0!==o?o:"").onChange(e.debounce((e=>t(this,void 0,void 0,(function*(){const t=this.plugin.getCurrentCommands(this.currentEditingConfig);let o=n(this.plugin,this.item,this.issub,t);if(this.item.name=e,this.issub){let i=o.subindex;-1===i?t[o.index].SubmenuCommands.push(this.item):t[o.index].SubmenuCommands[i].name=e}else{let e=o.index;-1===e?t.push(this.item):t[e].name=this.item.name}this.plugin.updateCurrentCommands(t),yield this.plugin.saveSettings()}))),100,!0)).inputEl.addEventListener("keydown",this.submitEnterCallback)}onClose(){const{contentEl:e}=this;e.empty(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100)}}class w extends e.Modal{constructor(e,t){super(t.app),this.needSave=!1,this.plugin=t,this.containerEl.addClass("editingToolbar-Modal")}onOpen(){const{contentEl:o}=this;o.createEl("p",{text:f("Drag the slider to move the position")});const i=o.createDiv({cls:"slider-container"}),n=i.createDiv({cls:"vertical-slider-container"});n.createEl("p",{text:f("Vertical Position")});const s=i.createDiv({cls:"horizontal-slider-container"});s.createEl("p",{text:f("Horizontal Position")});const a=i.createDiv({cls:"columns-slider-container"});a.createEl("p",{text:f("Editing Toolbar columns")});const r=document.body.clientHeight,l=document.body.clientWidth,c=Math.floor(r/3),p=-Math.floor(r),m=Math.floor(l/2),h=-Math.floor(l/2),g=new e.SliderComponent(n).setLimits(p,c,5).setValue(this.plugin.settings.verticalPosition||0).onChange(e.debounce((e=>{this.needSave=!0,this.plugin.settings.verticalPosition=e,d(this.plugin.settings)}),100,!0)).setDynamicTooltip(),b=new e.SliderComponent(s).setLimits(h,m,10).setValue(this.plugin.settings.horizontalPosition||0).onChange(e.debounce((e=>{this.needSave=!0,this.plugin.settings.horizontalPosition=e,u(this.plugin.settings)}),100,!0)).setDynamicTooltip(),v=new e.SliderComponent(a).setLimits(1,32,1).setValue(this.plugin.settings.cMenuNumRows||12).onChange(e.debounce((e=>t(this,void 0,void 0,(function*(){this.needSave=!0,this.plugin.settings.cMenuNumRows=e,yield this.plugin.saveSettings(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100)}))),100,!0)).setDynamicTooltip();i.createDiv({cls:"reset-container"}).createEl("button",{text:f("Reset"),cls:"reset-button"}).addEventListener("click",(()=>{this.needSave=!0,g.setValue(0),b.setValue(0),v.setValue(12),this.plugin.settings.verticalPosition=0,this.plugin.settings.horizontalPosition=0,this.plugin.settings.cMenuNumRows=12,d(this.plugin.settings),u(this.plugin.settings)}))}onClose(){return t(this,void 0,void 0,(function*(){const{contentEl:e}=this;e.empty(),this.needSave&&(yield this.plugin.saveSettings())}))}}const x=["body","workspace"],k=["glass","default","tiny"],S=["fixed","following","top"],E={lastVersion:"0.0.0",aestheticStyle:"default",positionStyle:"top",menuCommands:[{id:"editing-toolbar:editor-undo",name:"Undo editor",icon:"undo-glyph"},{id:"editing-toolbar:editor-redo",name:"Redo editor",icon:"redo-glyph"},{id:"editing-toolbar:toggle-format-brush",name:"Format Brush",icon:"paintbrush"},{id:"editing-toolbar:format-eraser",name:"Clear text formatting",icon:"eraser"},{id:"editing-toolbar:header2-text",name:"Header 2",icon:"header-2"},{id:"editing-toolbar:header3-text",name:"Header 3",icon:"header-3"},{id:"SubmenuCommands-header",name:"submenu",icon:"header-n",SubmenuCommands:[{id:"editing-toolbar:header1-text",name:"Header 1",icon:"header-1"},{id:"editing-toolbar:header4-text",name:"Header 4",icon:"header-4"},{id:"editing-toolbar:header5-text",name:"Header 5",icon:"header-5"},{id:"editing-toolbar:header6-text",name:"Header 6",icon:"header-6"}]},{id:"editing-toolbar:toggle-bold",name:"Bold",icon:"bold-glyph"},{id:"editing-toolbar:toggle-italics",name:"Italics",icon:"italic-glyph"},{id:"editing-toolbar:toggle-strikethrough",name:"Strikethrough",icon:"strikethrough-glyph"},{id:"editing-toolbar:underline",name:"Underline",icon:"underline-glyph"},{id:"editing-toolbar:toggle-highlight",name:"==Highlight==",icon:"highlight-glyph"},{id:"SubmenuCommands-lucdf3en5",name:"submenu",icon:"edit",SubmenuCommands:[{id:"editing-toolbar:editor-copy",name:"Copy",icon:"lucide-copy"},{id:"editing-toolbar:editor-cut",name:"Cut",icon:"lucide-scissors"},{id:"editing-toolbar:editor-paste",name:"Paste",icon:"lucide-clipboard-type"},{id:"editing-toolbar:editor:swap-line-down",name:"Swap line down",icon:"lucide-corner-right-down"},{id:"editing-toolbar:editor:swap-line-up",name:"Swap line up",icon:"lucide-corner-right-up"}]},{id:"editing-toolbar:editor:attach-file",name:"Attach file",icon:"lucide-paperclip"},{id:"editing-toolbar:editor:insert-table",name:"Insert Table",icon:"lucide-table"},{id:"editing-toolbar:editor:cycle-list-checklist",name:"Cycle list checklist",icon:"check-circle"},{id:"SubmenuCommands-luc8efull",name:"submenu",icon:"message-square",SubmenuCommands:[{id:"editing-toolbar:editor:toggle-blockquote",name:"Blockquote",icon:"lucide-text-quote"},{id:"editing-toolbar:insert-callout",name:"Insert Callout ",icon:"lucide-quote"}]},{id:"SubmenuCommands-mdcmder",name:"submenu",icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M464 608 l0 -568 q0 -3 -2.5 -5.5 q-2.5 -2.5 -5.5 -2.5 l-80 0 q-3 0 -5.5 2.5 q-2.5 2.5 -2.5 5.5 l0 568 l-232 0 q-3 0 -5.5 2.5 q-2.5 2.5 -2.5 5.5 l0 80 q0 3 2.5 5.5 q2.5 2.5 5.5 2.5 l560 0 q3 0 5.5 -2.5 q2.5 -2.5 2.5 -5.5 l0 -80 q0 -3 -2.5 -5.5 q-2.5 -2.5 -5.5 -2.5 l-232 0 ZM864 696 q17 0 28.5 11.5 q11.5 11.5 11.5 28.5 q0 17 -11.5 28.5 q-11.5 11.5 -28.5 11.5 q-17 0 -28.5 -11.5 q-11.5 -11.5 -11.5 -28.5 q0 -17 11.5 -28.5 q11.5 -11.5 28.5 -11.5 ZM864 640 q-40 0 -68 28 q-28 28 -28 68 q0 40 28 68 q28 28 68 28 q40 0 68 -28 q28 -28 28 -68 q0 -40 -28 -68 q-28 -28 -68 -28 ZM576 322 l0 -63 q0 -3 2 -5 l89 -70 l-89 -70 q-2 -2 -2 -5 l0 -63 q0 -4 3.5 -5.5 q3.5 -1.5 6.5 0.5 l170 133 q4 3 4.5 8.5 q0.5 5.5 -2.5 9.5 l-2 2 l-170 133 q-3 2 -6.5 0.5 q-3.5 -1.5 -3.5 -5.5 ZM256 322 l0 -63 q0 -3 -2 -5 l-89 -70 l89 -70 q2 -2 2 -5 l0 -63 q0 -4 -3.5 -5.5 q-3.5 -1.5 -6.5 0.5 l-170 133 q-4 3 -4.5 8.5 q-0.5 5.5 2.5 9.5 l2 2 l170 133 q3 2 6.5 0.5 q3.5 -1.5 3.5 -5.5 Z"></path></g></svg>',SubmenuCommands:[{id:"editing-toolbar:superscript",name:"Superscript",icon:"superscript-glyph"},{id:"editing-toolbar:subscript",name:"Subscript",icon:"subscript-glyph"},{id:"editing-toolbar:editor:toggle-code",name:"Inline code",icon:"code-glyph"},{id:"editing-toolbar:codeblock",name:"Code block",icon:"codeblock-glyph"},{id:"editing-toolbar:editor:insert-wikilink",name:"Insert wikilink [[]]",icon:'<svg width="15" height="15" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M306 134 l91 0 q1 0 1 -8 l0 -80 q0 -8 -1 -8 l-91 0 q-1 0 -1 7 q0 -8 -5 -8 l-45 0 q-5 0 -5 8 l0 784 q0 8 5 8 l45 0 q5 0 5 -8 q0 8 1 8 l91 0 q1 0 1 -8 l0 -80 q0 -8 -1 -8 l-91 0 q-1 0 -1 8 l0 -623 q0 8 1 8 ZM139 134 l91 0 q1 0 1 -8 l0 -80 q0 -8 -1 -8 l-91 0 q-1 0 -1 7 q0 -8 -5 -8 l-45 0 q-5 0 -5 8 l0 784 q0 8 5 8 l45 0 q5 0 5 -8 q0 8 1 8 l91 0 q1 0 1 -8 l0 -80 q0 -8 -1 -8 l-91 0 q-1 0 -1 8 l0 -623 q0 8 1 8 ZM711 134 q1 0 1 -8 l0 623 q0 -8 -1 -8 l-91 0 q-1 0 -1 8 l0 80 q0 8 1 8 l91 0 q1 0 1 -8 q0 8 4 8 l46 0 q4 0 4 -8 l0 -784 q0 -8 -4 -8 l-46 0 q-4 0 -4 8 q0 -7 -1 -7 l-91 0 q-1 0 -1 8 l0 80 q0 8 1 8 l91 0 ZM878 134 q1 0 1 -8 l0 623 q0 -8 -1 -8 l-91 0 q-1 0 -1 8 l0 80 q0 8 1 8 l91 0 q1 0 1 -8 q0 8 5 8 l45 0 q4 0 4 -8 l0 -784 q0 -8 -4 -8 l-45 0 q-5 0 -5 8 q0 -7 -1 -7 l-91 0 q-1 0 -1 8 l0 80 q0 8 1 8 l91 0 Z"></path></g></svg>'},{id:"editing-toolbar:editor:insert-embed",name:"Insert embed ![[]]",icon:"note-glyph"},{id:"editing-toolbar:insert-link",name:"Insert link []()",icon:"link-glyph"},{id:"editing-toolbar:hrline",name:"Horizontal divider",icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M912 424 l0 -80 q0 -3 -2.5 -5.5 q-2.5 -2.5 -5.5 -2.5 l-784 0 q-3 0 -5.5 2.5 q-2.5 2.5 -2.5 5.5 l0 80 q0 3 2.5 5.5 q2.5 2.5 5.5 2.5 l784 0 q3 0 5.5 -2.5 q2.5 -2.5 2.5 -5.5 Z"></path></g></svg>'},{id:"editing-toolbar:toggle-inline-math",name:"Inline math",icon:"lucide-sigma"},{id:"editing-toolbar:editor:insert-mathblock",name:"MathBlock",icon:"lucide-sigma-square"}]},{id:"SubmenuCommands-list",name:"submenu-list",icon:"bullet-list-glyph",SubmenuCommands:[{id:"editing-toolbar:editor:toggle-checklist-status",name:"Checklist",icon:"checkbox-glyph"},{id:"editing-toolbar:toggle-numbered-list",name:"Numbered list",icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M860 424 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-457 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l457 0 ZM860 756 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-457 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l457 0 ZM860 92 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-457 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l457 0 ZM264 136 l-3 -3 l-51 -57 l56 0 q14 0 24.5 -10 q10.5 -10 11.5 -25 l0 -1 q0 -15 -10.5 -25.5 q-10.5 -10.5 -24.5 -10.5 l-137 0 q-15 0 -25 10 q-10 10 -11 24.5 q-1 14.5 9 25.5 l63 70 l49 54 q7 7 7 16.5 q0 9.5 -7.5 16.5 q-7.5 7 -18.5 7 q-11 0 -18.5 -6.5 q-7.5 -6.5 -8.5 -16.5 l0 0 q0 -15 -10.5 -25.5 q-10.5 -10.5 -25.5 -10.5 q-15 0 -25.5 10.5 q-10.5 10.5 -10.5 25.5 q0 26 13.5 47.5 q13.5 21.5 36 34.5 q22.5 13 49 13 q26.5 0 49.5 -13 q23 -13 36 -34.5 q13 -21.5 13 -47.5 q0 -20 -7.5 -37.5 q-7.5 -17.5 -21.5 -30.5 l-1 -1 ZM173 794 q11 11 25 10.5 q14 -0.5 24.5 -10.5 q10.5 -10 10.5 -25 l0 -293 q0 -15 -10 -25.5 q-10 -10.5 -25 -10.5 q-15 0 -25.5 10 q-10.5 10 -11.5 25 l0 211 q-10 -8 -23.5 -7 q-13.5 1 -22.5 11 l-1 0 q-10 11 -9.5 25.5 q0.5 14.5 10.5 24.5 l58 54 Z"></path></g></svg>'},{id:"editing-toolbar:toggle-bullet-list",name:"Bullet list",icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M860 424 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-477 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l477 0 ZM860 756 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-477 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l477 0 ZM860 92 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-477 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l477 0 ZM176 716 l0 0 ZM112 716 q0 -27 18.5 -45.5 q18.5 -18.5 45.5 -18.5 q27 0 45.5 18.5 q18.5 18.5 18.5 45.5 q0 27 -18.5 45.5 q-18.5 18.5 -45.5 18.5 q-27 0 -45.5 -18.5 q-18.5 -18.5 -18.5 -45.5 ZM176 384 l0 0 ZM112 384 q0 -27 18.5 -45.5 q18.5 -18.5 45.5 -18.5 q27 0 45.5 18.5 q18.5 18.5 18.5 45.5 q0 27 -18.5 45.5 q-18.5 18.5 -45.5 18.5 q-27 0 -45.5 -18.5 q-18.5 -18.5 -18.5 -45.5 ZM176 52 l0 0 ZM112 52 q0 -27 18.5 -45.5 q18.5 -18.5 45.5 -18.5 q27 0 45.5 18.5 q18.5 18.5 18.5 45.5 q0 27 -18.5 45.5 q-18.5 18.5 -45.5 18.5 q-27 0 -45.5 -18.5 q-18.5 -18.5 -18.5 -45.5 Z"></path></g></svg>'},{id:"editing-toolbar:undent-list",name:"Unindent-list",icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M872 302 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-429 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l429 0 ZM872 542 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-429 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l429 0 ZM872 784 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 ZM872 62 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 ZM244 534 l-123 -122 q-8 -7 -8 -18 q0 -11 8 -18 l123 -122 q8 -7 19 -7 q11 0 18.5 7.5 q7.5 7.5 7.5 18.5 l0 242 q0 11 -7.5 18.5 q-7.5 7.5 -18.5 7.5 q-11 0 -19 -7 Z"></path></g></svg>'},{id:"editing-toolbar:indent-list",name:"Indent list",icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M872 302 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-429 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l429 0 ZM872 542 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-429 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l429 0 ZM872 784 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 ZM872 62 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 ZM158 534 l124 -122 q7 -7 7 -18 q0 -11 -7 -18 l-124 -122 q-7 -7 -18 -7 q-11 0 -19 7.5 q-8 7.5 -8 18.5 l0 242 q0 11 8 18.5 q8 7.5 19 7.5 q11 0 18 -7 Z"></path></g></svg>'}]},{id:"SubmenuCommands-aligin",name:"submenu-aligin",icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M724 304 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-421 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l421 0 ZM872 540 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 ZM724 776 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-421 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l421 0 ZM872 68 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 Z"></path></g></svg>',SubmenuCommands:[{id:"editing-toolbar:justify",name:'<p aligin="justify"></p>',icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M112 736 l0 0 ZM120 736 l784 0 q8 0 8 -8 l0 -80 q0 -8 -8 -8 l-784 0 q-8 0 -8 8 l0 80 q0 8 8 8 ZM112 331 l0 0 ZM120 331 l784 0 q8 0 8 -8 l0 -80 q0 -8 -8 -8 l-784 0 q-8 0 -8 8 l0 80 q0 8 8 8 ZM112 128 l0 0 ZM120 128 l784 0 q8 0 8 -8 l0 -80 q0 -8 -8 -8 l-784 0 q-8 0 -8 8 l0 80 q0 8 8 8 ZM112 533 l0 0 ZM120 533 l784 0 q8 0 8 -8 l0 -80 q0 -8 -8 -8 l-784 0 q-8 0 -8 8 l0 80 q0 8 8 8 Z"></path></g></svg>'},{id:"editing-toolbar:left",name:'<p aligin="left"></p>',icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M572 304 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-421 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l421 0 ZM872 540 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 ZM572 776 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-421 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l421 0 ZM872 68 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 Z"></path></g></svg>'},{id:"editing-toolbar:center",name:"<center>",icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M724 304 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-421 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l421 0 ZM872 540 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 ZM724 776 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-421 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l421 0 ZM872 68 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 Z"></path></g></svg>'},{id:"editing-toolbar:right",name:'<p aligin="right"></p>',icon:'<svg width="18" height="18" focusable="false" fill="currentColor" viewBox="0 0 1024 1024"><g transform="scale(1, -1) translate(0, -896) scale(0.9, 0.9) "><path class="path" d="M872 304 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-421 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l421 0 ZM872 540 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 ZM872 776 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-421 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l421 0 ZM872 68 q17 0 28.5 -11.5 q11.5 -11.5 11.5 -28 q0 -16.5 -11.5 -28.5 q-11.5 -12 -27.5 -12 l-721 0 q-17 0 -28.5 11.5 q-11.5 11.5 -11.5 28 q0 16.5 11.5 28.5 q11.5 12 27.5 12 l721 0 Z"></path></g></svg>'}]},{id:"editing-toolbar:change-font-color",name:"Change font color[html]",icon:'<svg width="24" height="24" focusable="false" fill="currentColor"><g fill-rule="evenodd"><path id="change-font-color-icon" d="M3 18h18v3H3z" style="fill:#2DC26B"></path><path d="M8.7 16h-.8a.5.5 0 01-.5-.6l2.7-9c.1-.3.3-.4.5-.4h2.8c.2 0 .4.1.5.4l2.7 9a.5.5 0 01-.5.6h-.8a.5.5 0 01-.4-.4l-.7-2.2c0-.3-.3-.4-.5-.4h-3.4c-.2 0-.4.1-.5.4l-.7 2.2c0 .3-.2.4-.4.4zm2.6-7.6l-.6 2a.5.5 0 00.5.6h1.6a.5.5 0 00.5-.6l-.6-2c0-.3-.3-.4-.5-.4h-.4c-.2 0-.4.1-.5.4z"></path></g></svg>'},{id:"editing-toolbar:change-background-color",name:"Change Backgroundcolor[html]",icon:'<svg width="18" height="24" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg"><g stroke="none" stroke-width="1" fill="currentColor" fill-rule="evenodd"><g ><g fill="currentColor"><g transform="translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)" ><path d="M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z" fill-rule="nonzero"></path><path d="M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z" fill-rule="evenodd"></path><path d="M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z" fill-rule="nonzero"></path></g></g><path d="M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z" id="change-background-color-icon" style="fill:#FA541C"></path></g></g></svg>'},{id:"editing-toolbar:fullscreen-focus",name:"Fullscreen focus mode",icon:"fullscreen"},{id:"editing-toolbar:workplace-fullscreen-focus",name:"Workplace-Fullscreen ",icon:"exit-fullscreen"}],followingCommands:[],topCommands:[],fixedCommands:[],mobileCommands:[],enableMultipleConfig:!1,appendMethod:"workspace",shouldShowMenuOnSelect:!1,cMenuVisibility:!0,cMenuBottomValue:4.25,cMenuNumRows:12,cMenuWidth:610,cMenuFontColor:"#2DC26B",cMenuBackgroundColor:"#d3f8b6",autohide:!1,custom_bg1:"#FFB78B8C",custom_bg2:"#CDF4698C",custom_bg3:"#A0CCF68C",custom_bg4:"#F0A7D88C",custom_bg5:"#ADEFEF8C",custom_fc1:"#D83931",custom_fc2:"#DE7802",custom_fc3:"#245BDB",custom_fc4:"#6425D0",custom_fc5:"#646A73",isLoadOnMobile:!1,horizontalPosition:0,verticalPosition:0,formatBrushes:{},customCommands:[],viewTypeSettings:{}};class T{static isAllowedViewType(e,t){var o,i,n,s;if(!e)return!1;const a=e.getViewType(),r=null===(n=null===(i=null===(o=window.app)||void 0===o?void 0:o.plugins)||void 0===i?void 0:i.plugins)||void 0===n?void 0:n["editing-toolbar"];if((null===(s=null==r?void 0:r.settings)||void 0===s?void 0:s.viewTypeSettings)&&void 0!==r.settings.viewTypeSettings[a])return r.settings.viewTypeSettings[a];return(t||["markdown","canvas","thino_view","meld-encrypted-view","excalidraw","image"]).includes(a)}static isSourceMode(e){var t;return!!e&&"source"===(null===(t=e.getMode)||void 0===t?void 0:t.call(e))}}let M;const q={markdown:".markdown-source-view",thino_view:".markdown-source-view",canvas:".canvas-wrapper",excalidraw:".excalidraw-wrapper",image:".image-container",pdf:".view-content"};function I(){M=e.requireApiVersion("0.15.0")?activeWindow.document:window.document;const t=M.getElementById("editingToolbarModalBar");t&&t.remove();const o=function(){const t=[];t.push(app.workspace.rootSplit);const o=app.workspace.floatingSplit;return null==o||o.children.forEach((o=>{o instanceof e.WorkspaceWindow&&t.push(o)})),t}();o&&o.forEach((e=>{(null==e?void 0:e.containerEl)&&(e=>{let t=e.querySelectorAll("#editingToolbarModalBar"),o=e.querySelectorAll("#editingToolbarPopoverBar");t.forEach((e=>{e&&(e.firstChild&&e.removeChild(e.firstChild),e.remove())})),o.forEach((e=>{e&&(e.firstChild&&e.removeChild(e.firstChild),e.remove())}))})(null==e?void 0:e.containerEl)}))}function A(t,o){var i,n;M=e.requireApiVersion("0.15.0")?activeWindow.document:window.document;let s="top"==o.positionStyle?null===(n=null===(i=t.workspace.activeLeaf)||void 0===i?void 0:i.view.containerEl)||void 0===n?void 0:n.querySelector("#editingToolbarModalBar"):M.getElementById("editingToolbarModalBar");return s||null}const D=(e,t)=>t.reduce(((e,t)=>e&&"undefined"!==e[t]?e[t]:void 0),e);function _(e,t){return e&&void 0!==e[1][0]?t+e.flat(2).join("+").replace("Mod","Ctrl")+t:t+""+t}function B(e,t,o=!0){let i=e.commands.findCommand(t),n=o?"*":"";if(i){let t=i.hotkeys?[[D(i.hotkeys,[0,"modifiers"])],[D(i.hotkeys,[0,"key"])]]:void 0,o=e.hotkeyManager.customKeys[i.id];var s=o?[[D(o,[0,"modifiers"])],[D(o,[0,"key"])]]:void 0;return s?_(s,n):_(t,"")}return""}function O(e){return/<[^>]+>/g.test(e)}function N(t,o,i){M=e.requireApiVersion("0.15.0")?activeWindow.document:window.document;const n=o.commandsManager.getActiveEditor();let s=A(t,o.settings),l=null==s?void 0:s.querySelector("#"+i);if(l){let e=l.rows,t=e.length;for(let s=1;s<t;s++){let t=e[s].cells;for(let e=0;e<t.length;e++)t[e].onclick=function(){let e=this.style.backgroundColor;if(""!=e){if(e=L(e),"x-color-picker-table"==i){o.settings.cMenuFontColor=e,a(e,n),M.querySelectorAll("#change-font-color-icon").forEach((t=>{t.style.fill=e}))}else if("x-backgroundcolor-picker-table"==i){o.settings.cMenuBackgroundColor=e,r(e,n),M.querySelectorAll("#change-background-color-icon").forEach((t=>{t.style.fill=e}))}o.saveSettings()}}}}}const L=function(e){let t=e;if(/^(rgb|RGB)/.test(t)){let e=t.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),o="#";for(let t=0;t<e.length;t++){let i=Number(e[t]).toString(16);"0"===i&&(i+=i),1==i.length&&(i="0"+i),o+=i}return 7!==o.length&&(o=t),o}if(!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t))return t;{let e=t.replace(/#/,"").split("");if(6===e.length)return t;if(3===e.length){let t="#";for(let o=0;o<e.length;o+=1)t+=e[o]+e[o];return t}}};function F(e){e.quiteAllFormatBrushes()}function R(e,t){let o=t.getSelection();if(!o||""===o.trim())return;if(o.match(/^>\s*\[\![\w\s]*\]/m)){let e=o.split("\n"),i=[],n=!1,s=0,a=!1;for(let t=0;t<e.length;t++){let o=e[t],r=o.match(/^(>+)\s*\[\!([\w\s]*)\]\s*(.*?)$/);if(!r||a)if(n){let e=o.match(/^(>+)\s*/);if(e&&e[1].length>=s){let e=o.replace(new RegExp(`^>{${s}}\\s*`),"");i.push(e)}else n=!1,i.push(o)}else i.push(o);else s=r[1].length,a=!0,r[3].trim()&&i.push(r[3].trim()),n=!0}return void t.replaceSelection(i.join("\n"))}o=o.replace(/(^#+\s|^#(?=\s)|^\>|^\- \[( |x)\]|^\+ |\<[^\<\>]+?\>|^1\. |^\s*\- |^\-+$|^\*+$)/gm,""),o=o.replace(/^[ ]+|[ ]+$/gm,""),o=o.replace(/\!?\[\[([^\[\]\|]*\|)*([^\(\)\[\]]+)\]\]/g,"$2"),o=o.replace(/\!?\[+([^\[\]\(\)]+)\]+\(([^\(\)]+)\)/g,"$1"),o=o.replace(/`([^`]+)`/g,"$1"),o=o.replace(/_([^_]+)_/g,"$1"),o=o.replace(/==([^=]+)==/g,"$1"),o=o.replace(/\*\*\*([^\*]+)\*\*\*/g,"$1"),o=o.replace(/\*\*?([^\*]+)\*\*?/g,"$1"),o=o.replace(/~~([^~]+)~~/g,"$1"),t.replaceSelection(o)}function P(t,o,i){var n,s,a,r;let l=A(t,o);const c=t.workspace.getActiveViewOfType(e.ItemView);if(T.isAllowedViewType(c)){if("following"===o.positionStyle){if("markdown"===(null==c?void 0:c.getViewType()))if(T.isSourceMode(c)){if(l&&(l.style.visibility=i.somethingSelected()?"visible":"hidden",l.style.height="tiny"===o.aestheticStyle?"30px":"40px",l.addClass("editingToolbarFlex"),l.removeClass("editingToolbarGrid"),"visible"===l.style.visibility)){const e=i.containerEl.getBoundingClientRect(),t=l.offsetWidth,o=l.offsetHeight,c=(e=>{var t,o,i;let n,s=e.getCursor("head");if(e.getCursor("head").ch!==e.getCursor("from").ch&&(s.ch=Math.max(0,s.ch-1)),e.cursorCoords)n=e.cursorCoords(!0,"window");else{if(!e.coordsAtPos)return;{const a=e.posToOffset(s);n=null!==(i=null===(o=(t=e.cm).coordsAtPos)||void 0===o?void 0:o.call(t,a))&&void 0!==i?i:e.coordsAtPos(a)}}return n})(i),d=i.getCursor("head").ch==i.getCursor("from").ch,u=12,p=(null!==(s=null===(n=M.getElementsByClassName("mod-left-split")[0])||void 0===n?void 0:n.clientWidth)&&void 0!==s?s:0)+(null!==(r=null===(a=M.getElementsByClassName("side-dock-ribbon mod-left")[0])||void 0===a?void 0:a.clientWidth)&&void 0!==r?r:0);let m=c.left-p;m+t+u>=e.right&&(m=Math.max(0,e.right-t-p-u));let h=0;d?(h=c.top-o-10,h<=e.top&&(h=e.top+o)):(h=c.top+25,h>=e.bottom-o&&(h=e.bottom-2*o)),l.style.left=m+"px",l.style.top=h+"px"}}else l&&(l.style.visibility="hidden");else l&&(l.style.visibility="visible",l.style.height="tiny"===o.aestheticStyle?"30px":"40px",l.addClass("editingToolbarFlex"),l.removeClass("editingToolbarGrid"))}}else l&&(l.style.visibility="hidden")}function V(t,o){let i=o.settings;M=e.requireApiVersion("0.15.0")?activeWindow.document:window.document,function(){const n=()=>{var n,s;let a=0,r=0,l=createEl("div");l&&("top"==i.positionStyle?(l.setAttribute("style","position: relative; grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));"),l.className+=" top",i.autohide&&(l.className+=" autohide")):"following"==i.positionStyle&&(l.style.visibility="hidden")),l.setAttribute("id","editingToolbarModalBar");let c=createEl("div");if(c.addClass("editingToolbarpopover"),c.addClass("editingToolbarTinyAesthetic"),c.setAttribute("id","editingToolbarPopoverBar"),c.style.visibility="hidden",c.style.height="0","default"==i.aestheticStyle?(l.addClass("editingToolbarDefaultAesthetic"),l.removeClass("editingToolbarTinyAesthetic"),l.removeClass("editingToolbarGlassAesthetic")):"tiny"==i.aestheticStyle?(l.addClass("editingToolbarTinyAesthetic"),l.removeClass("editingToolbarDefaultAesthetic"),l.removeClass("editingToolbarGlassAesthetic")):(l.addClass("editingToolbarGlassAesthetic"),l.removeClass("editingToolbarTinyAesthetic"),l.removeClass("editingToolbarDefaultAesthetic")),"top"==i.positionStyle){let e=t.workspace.activeLeaf.view.containerEl,o=null;const i=t.workspace.activeLeaf.view.getViewType(),n=q[i];if(n&&(o=null==e?void 0:e.querySelector(n)),!o){const t=null==e?void 0:e.querySelector(".view-content");if(t){const e=t.querySelectorAll(":scope > div");o=e.length>0?e[0]:t}}if(!o)return void console.log("Editing Toolbar: Failed to find target DOM element for toolbar insertion");(null==e?void 0:e.querySelector("#editingToolbarPopoverBar"))||o.insertAdjacentElement("afterbegin",c),o.insertAdjacentElement("afterbegin",l),r=null==o?void 0:o.offsetWidth}else"body"==i.appendMethod?M.body.appendChild(l):"workspace"==i.appendMethod&&(null===(n=M.body)||void 0===n||n.querySelector(".mod-vertical.mod-root").insertAdjacentElement("afterbegin",l));let d=null===(s=t.workspace.activeLeaf.view.containerEl)||void 0===s?void 0:s.querySelector("#editingToolbarPopoverBar");o.getCurrentCommands().forEach(((n,s)=>{let c;if("SubmenuCommands"in n){let u;a>=r-104&&r>100?(o.setIS_MORE_Button(!0),u=new e.ButtonComponent(d)):u=new e.ButtonComponent(l),u.setClass("editingToolbarCommandsubItem"+s),s>=i.cMenuNumRows?u.setClass("editingToolbarSecond"):"top"!=i.positionStyle&&u.buttonEl.setAttribute("aria-label-position","top"),O(n.icon)?u.buttonEl.innerHTML=n.icon:u.setIcon(n.icon),a+=28;let p=function(e){let t=createEl("div");return t.addClass(e),t}("subitem");p&&n.SubmenuCommands.forEach((o=>{let n=B(t,o.id);c=""==n?o.name:o.name+"("+n+")";let a=new e.ButtonComponent(p).setTooltip(c).setClass("menu-item").onClick((()=>{t.commands.executeCommandById(o.id),0==i.cMenuVisibility||"following"==i.positionStyle?l.style.visibility="hidden":l.style.visibility="visible"}));s<i.cMenuNumRows&&"top"!=i.positionStyle&&a.buttonEl.setAttribute("aria-label-position","top"),"editingToolbar-Divider-Line"==o.id&&a.setClass("editingToolbar-Divider-Line"),O(o.icon)?a.buttonEl.innerHTML=o.icon:a.setIcon(o.icon),u.buttonEl.insertAdjacentElement("afterbegin",p)}))}else if("editing-toolbar:change-font-color"==n.id){let s=new e.ButtonComponent(l);s.setClass("editingToolbarCommandsubItem-font-color").setTooltip(f("Font Colors")).onClick((()=>{t.commands.executeCommandById(n.id),0==i.cMenuVisibility||"following"==i.positionStyle?l.style.visibility="hidden":l.style.visibility="visible"})),O(n.icon)?s.buttonEl.innerHTML=n.icon:s.setIcon(n.icon),a+=26;let r=createEl("div");if(r.addClass("subitem"),r){r.innerHTML=function(e){return`<div class='x-color-picker-wrapper'>\n<div class='x-color-picker' >\n <table class="x-color-picker-table" id='x-color-picker-table'>\n <tbody>\n <tr>\n <th colspan="10" class="ui-widget-content">Theme Colors</th>\n </tr>\n <tr>\n <td style="background-color:#ffffff"><span></span></td>\n <td style="background-color:#000000"><span></span></td>\n <td style="background-color:#eeece1"><span></span></td>\n <td style="background-color:#1f497d"><span></span></td>\n <td style="background-color:#4f81bd"><span></span></td>\n <td style="background-color:#c0504d"><span></span></td>\n <td style="background-color:#9bbb59"><span></span></td>\n <td style="background-color:#8064a2"><span></span></td>\n <td style="background-color:#4bacc6"><span></span></td>\n <td style="background-color:#f79646"><span></span></td>\n </tr>\n <tr>\n <th colspan="10"></th>\n </tr>\n <tr class="top">\n <td style="background-color:#f2f2f2"><span></span></td>\n <td style="background-color:#7f7f7f"><span></span></td>\n <td style="background-color:#ddd9c3"><span></span></td>\n <td style="background-color:#c6d9f0"><span></span></td>\n <td style="background-color:#dbe5f1"><span></span></td>\n <td style="background-color:#f2dcdb"><span></span></td>\n <td style="background-color:#ebf1dd"><span></span></td>\n <td style="background-color:#e5e0ec"><span></span></td>\n <td style="background-color:#dbeef3"><span></span></td>\n <td style="background-color:#fdeada"><span></span></td>\n </tr>\n <tr class="in">\n <td style="background-color:#d8d8d8"><span></span></td>\n <td style="background-color:#595959"><span></span></td>\n <td style="background-color:#c4bd97"><span></span></td>\n <td style="background-color:#8db3e2"><span></span></td>\n <td style="background-color:#b8cce4"><span></span></td>\n <td style="background-color:#e5b9b7"><span></span></td>\n <td style="background-color:#d7e3bc"><span></span></td>\n <td style="background-color:#ccc1d9"><span></span></td>\n <td style="background-color:#b7dde8"><span></span></td>\n <td style="background-color:#fbd5b5"><span></span></td>\n </tr>\n <tr class="in">\n <td style="background-color:#bfbfbf"><span></span></td>\n <td style="background-color:#3f3f3f"><span></span></td>\n <td style="background-color:#938953"><span></span></td>\n <td style="background-color:#548dd4"><span></span></td>\n <td style="background-color:#95b3d7"><span></span></td>\n <td style="background-color:#d99694"><span></span></td>\n <td style="background-color:#c3d69b"><span></span></td>\n <td style="background-color:#b2a2c7"><span></span></td>\n <td style="background-color:#92cddc"><span></span></td>\n <td style="background-color:#fac08f"><span></span></td>\n </tr>\n <tr class="in">\n <td style="background-color:#a5a5a5"><span></span></td>\n <td style="background-color:#262626"><span></span></td>\n <td style="background-color:#494429"><span></span></td>\n <td style="background-color:#17365d"><span></span></td>\n <td style="background-color:#366092"><span></span></td>\n <td style="background-color:#953734"><span></span></td>\n <td style="background-color:#76923c"><span></span></td>\n <td style="background-color:#5f497a"><span></span></td>\n <td style="background-color:#31859b"><span></span></td>\n <td style="background-color:#e36c09"><span></span></td>\n </tr>\n <tr class="bottom">\n <td style="background-color:#7f7f7f"><span></span></td>\n <td style="background-color:#0c0c0c"><span></span></td>\n <td style="background-color:#1d1b10"><span></span></td>\n <td style="background-color:#0f243e"><span></span></td>\n <td style="background-color:#244061"><span></span></td>\n <td style="background-color:#632423"><span></span></td>\n <td style="background-color:#4f6128"><span></span></td>\n <td style="background-color:#3f3151"><span></span></td>\n <td style="background-color:#205867"><span></span></td>\n <td style="background-color:#974806"><span></span></td>\n </tr>\n <tr>\n <th colspan="10"></th>\n </tr>\n <tr>\n <th colspan="10" class="ui-widget-content">Standard Colors</th>\n </tr>\n <tr>\n <td style="background-color:#c00000"><span></span></td>\n <td style="background-color:#ff0000"><span></span></td>\n <td style="background-color:#ffc000"><span></span></td>\n <td style="background-color:#ffff00"><span></span></td>\n <td style="background-color:#92d050"><span></span></td>\n <td style="background-color:#00b050"><span></span></td>\n <td style="background-color:#00b0f0"><span></span></td>\n <td style="background-color:#0070c0"><span></span></td>\n <td style="background-color:#002060"><span></span></td>\n <td style="background-color:#7030a0"><span></span></td>\n </tr>\n <tr>\n <th colspan="10" class="ui-widget-content">Custom Font Colors</th>\n </tr>\n <tr>\n <td style="background-color:${e.settings.custom_fc1}"><span></span></td>\n <td style="background-color:${e.settings.custom_fc2}"><span></span></td>\n <td style="background-color:${e.settings.custom_fc3}"><span></span></td>\n <td style="background-color:${e.settings.custom_fc4}"><span></span></td>\n <td style="background-color:${e.settings.custom_fc5}"><span></span></td>\n </tr>\n </tbody>\n </table>\n</div>\n</div>`}(o),s.buttonEl.insertAdjacentElement("afterbegin",r),N(t,o,"x-color-picker-table");let i=r.querySelector(".x-color-picker-wrapper");new e.ButtonComponent(i).setIcon("paintbrush").setTooltip(f("Format Brush")).onClick((()=>{F(o),o.setEN_FontColor_Format_Brush(!0),o.Temp_Notice=new e.Notice(f("Font-Color formatting brush ON!"),0)})),new e.ButtonComponent(i).setIcon("palette").setTooltip(f("Custom Font Color")).onClick((()=>{t.setting.open(),t.setting.openTabById("editing-toolbar"),setTimeout((()=>{const e=t.setting.activeTab.containerEl.querySelector(".editing-toolbar-tabs");if(e){const o=e.children[1];null==o||o.click(),setTimeout((()=>{var e;let o=t.setting.activeTab.containerEl.querySelector(".custom_font");o&&(null===(e=o.addClass)||void 0===e||e.call(o,"toolbar-cta"))}),100)}}),200)}))}}else if("editing-toolbar:change-background-color"==n.id){let s=new e.ButtonComponent(l);s.setClass("editingToolbarCommandsubItem-font-color").setTooltip(f("Background color")).onClick((()=>{t.commands.executeCommandById(n.id),0==i.cMenuVisibility||"following"==i.positionStyle?l.style.visibility="hidden":l.style.visibility="visible"})),O(n.icon)?s.buttonEl.innerHTML=n.icon:s.setIcon(n.icon),a+=26;let r=createEl("div");if(r.addClass("subitem"),r){r.innerHTML=function(e){return`<div class='x-color-picker-wrapper'>\n<div class='x-color-picker' >\n <table class="x-color-picker-table" id='x-backgroundcolor-picker-table'>\n <tbody>\n <tr>\n <th colspan="5" class="ui-widget-content">Translucent Colors</th>\n </tr>\n <tr class="top">\n <td style="background-color:rgba(140, 140, 140, 0.12)"><span></span></td>\n <td style="background-color:rgba(92, 92, 92, 0.2)"><span></span></td>\n <td style="background-color:rgba(163, 67, 31, 0.2)"><span></span></td>\n <td style="background-color:rgba(240, 107, 5, 0.2)"><span></span></td>\n <td style="background-color:rgba(240, 200, 0, 0.2)"><span></span></td>\n </tr>\n <tr class="bottom">\n <td style="background-color:rgba(3, 135, 102, 0.2)"><span></span></td>\n <td style="background-color:rgba(3, 135, 102, 0.2)"><span></span></td>\n <td style="background-color:rgba(5, 117, 197, 0.2)"><span></span></td>\n <td style="background-color:rgba(74, 82, 199, 0.2)"><span></span></td>\n <td style="background-color:rgba(136, 49, 204, 0.2)"><span></span></td>\n </tr>\n\n <tr>\n <th colspan="5" class="ui-widget-content">Highlighter Colors</th>\n </tr>\n \n <tr class="top">\n <td style="background-color:rgb(255, 248, 143)"><span></span></td>\n <td style="background-color:rgb(211, 248, 182)"><span></span></td>\n <td style="background-color:rgb(175, 250, 209)"><span></span></td>\n <td style="background-color:rgb(177, 255, 255)"><span></span></td>\n <td style="background-color:rgb(253, 191, 255)"><span></span></td>\n </tr>\n <tr class="bottom">\n <td style="background-color:rgb(210, 203, 255);"><span></span></td>\n <td style="background-color:rgb(64, 169, 255);"><span></span></td>\n <td style="background-color:rgb(255, 77, 79);"><span></span></td>\n <td style="background-color:rgb(212, 177, 6);"><span></span></td>\n <td style="background-color:rgb(146, 84, 222);"><span></span></td>\n </tr>\n <tr>\n <th colspan="5" class="ui-widget-content">Custom Colors</th>\n </tr>\n <tr class="bottom">\n <td style="background-color: ${e.settings.custom_bg1};"><span></span></td>\n <td style="background-color:${e.settings.custom_bg2};"><span></span></td>\n <td style="background-color:${e.settings.custom_bg3};"><span></span></td>\n <td style="background-color:${e.settings.custom_bg4};"><span></span></td>\n <td style="background-color:${e.settings.custom_bg5};"><span></span></td>\n </tr>\n </tbody>\n </table>\n</div>\n</div>`}(o),s.buttonEl.insertAdjacentElement("afterbegin",r),N(t,o,"x-backgroundcolor-picker-table");let i=r.querySelector(".x-color-picker-wrapper");new e.ButtonComponent(i).setIcon("paintbrush").setTooltip(f("Format Brush")).onClick((()=>{F(o),o.setEN_BG_Format_Brush(!0),o.Temp_Notice=new e.Notice(f("Font-Color formatting brush ON!"),0)})),new e.ButtonComponent(i).setIcon("palette").setTooltip(f("Custom Backgroud Color")).onClick((()=>{t.setting.open(),t.setting.openTabById("editing-toolbar"),setTimeout((()=>{const e=t.setting.activeTab.containerEl.querySelector(".editing-toolbar-tabs");if(e){const o=e.children[1];null==o||o.click(),setTimeout((()=>{var e;let o=t.setting.activeTab.containerEl.querySelector(".custom_bg");o&&(null===(e=o.addClass)||void 0===e||e.call(o,"toolbar-cta"))}),100)}}),200)}))}}else{let u;a>=r-104&&r>100?(o.setIS_MORE_Button(!0),u=new e.ButtonComponent(d)):u=new e.ButtonComponent(l);let p=B(t,n.id);c=""==p?n.name:n.name+"("+p+")",u.setTooltip(c).onClick((()=>{t.commands.executeCommandById(n.id),0==i.cMenuVisibility||"following"==i.positionStyle?l.style.visibility="hidden":l.style.visibility="visible"})),u.setClass("editingToolbarCommandItem"),s>=i.cMenuNumRows?u.setClass("editingToolbarSecond"):"top"!=i.positionStyle&&u.buttonEl.setAttribute("aria-label-position","top"),"editingToolbar-Divider-Line"==n.id&&u.setClass("editingToolbar-Divider-Line"),O(n.icon)?u.buttonEl.innerHTML=n.icon:u.setIcon(n.icon),a+=26}})),function(t,o,i){const n=t.workspace.getActiveViewOfType(e.ItemView);if(!T.isAllowedViewType(n))return;let s=n.containerEl.querySelector("#editingToolbarPopoverBar");if(!o.IS_MORE_Button)return;let a=i.createEl("span");a.addClass("more-menu");let r=new e.ButtonComponent(a);r.setClass("editingToolbarCommandItem").setTooltip(f("More")).onClick((()=>{"hidden"==s.style.visibility?(s.style.visibility="visible",s.style.height="32px"):(s.style.visibility="hidden",s.style.height="0")})),r.buttonEl.innerHTML='<svg width="14" height="14" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" enable-background="new 0 0 1024 1024" xml:space="preserve"><path fill="#666" d="M510.29 14.13 q17.09 -15.07 40.2 -14.07 q23.12 1 39.2 18.08 l334.66 385.92 q25.12 30.15 34.16 66.83 q9.04 36.68 0.5 73.87 q-8.54 37.19 -32.66 67.34 l-335.67 390.94 q-15.07 18.09 -38.69 20.1 q-23.62 2.01 -41.71 -13.07 q-18.08 -15.08 -20.09 -38.19 q-2.01 -23.12 13.06 -41.21 l334.66 -390.94 q11.06 -13.06 11.56 -29.65 q0.5 -16.58 -10.55 -29.64 l-334.67 -386.92 q-15.07 -17.09 -13.56 -40.7 q1.51 -23.62 19.59 -38.7 ZM81.17 14.13 q17.08 -15.07 40.19 -14.07 q23.11 1 39.2 18.08 l334.66 385.92 q25.12 30.15 34.16 66.83 q9.04 36.68 0.5 73.87 q-8.54 37.19 -32.66 67.34 l-335.67 390.94 q-15.07 18.09 -38.69 20.6 q-23.61 2.51 -41.7 -12.57 q-18.09 -15.08 -20.1 -38.69 q-2.01 -23.62 13.06 -41.71 l334.66 -390.94 q11.06 -13.06 11.56 -29.65 q0.5 -16.58 -10.55 -29.64 l-334.66 -386.92 q-15.08 -17.09 -13.57 -40.7 q1.51 -23.62 19.6 -38.7 Z"/></svg>',o.setIS_MORE_Button(!1)}(t,o,l),Math.abs(o.settings.cMenuWidth-Number(a))>30&&(o.settings.cMenuWidth=Number(a),setTimeout((()=>{o.saveSettings()}),100))};if(!o.isLoadMobile())return;const s=t.workspace.getActiveViewOfType(e.ItemView);T.isAllowedViewType(s)&&(A(t,o.settings)||(n(),u(o.settings),d(o.settings),function(t,o){M=e.requireApiVersion("0.15.0")?activeWindow.document:window.document;let i=M.querySelectorAll("#change-font-color-icon");i&&i.forEach((e=>{e.style.fill=t}));let n=M.querySelectorAll("#change-background-color-icon");n&&n.forEach((e=>{e.style.fill=o}))}
/**!
* Sortable 1.15.6
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/(i.cMenuFontColor,i.cMenuBackgroundColor)))}()}function $(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,i)}return o}function z(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?$(Object(o),!0).forEach((function(t){U(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):$(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}function U(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function W(){return W=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},W.apply(this,arguments)}function j(e,t){if(null==e)return{};var o,i,n=function(e,t){if(null==e)return{};var o,i,n={},s=Object.keys(e);for(i=0;i<s.length;i++)o=s[i],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)o=s[i],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}function Z(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var Y=Z(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),G=Z(/Edge/i),X=Z(/firefox/i),J=Z(/safari/i)&&!Z(/chrome/i)&&!Z(/android/i),K=Z(/iP(ad|od|hone)/i),Q=Z(/chrome/i)&&Z(/android/i),ee={capture:!1,passive:!1};function te(e,t,o){e.addEventListener(t,o,!Y&&ee)}function oe(e,t,o){e.removeEventListener(t,o,!Y&&ee)}function ie(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function ne(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function se(e,t,o,i){if(e){o=o||document;do{if(null!=t&&(">"===t[0]?e.parentNode===o&&ie(e,t):ie(e,t))||i&&e===o)return e;if(e===o)break}while(e=ne(e))}return null}var ae,re=/\s+/g;function le(e,t,o){if(e&&t)if(e.classList)e.classList[o?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(re," ").replace(" "+t+" "," ");e.className=(i+(o?" "+t:"")).replace(re," ")}}function ce(e,t,o){var i=e&&e.style;if(i){if(void 0===o)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(o=e.currentStyle),void 0===t?o:o[t];t in i||-1!==t.indexOf("webkit")||(t="-webkit-"+t),i[t]=o+("string"==typeof o?"":"px")}}function de(e,t){var o="";if("string"==typeof e)o=e;else do{var i=ce(e,"transform");i&&"none"!==i&&(o=i+" "+o)}while(!t&&(e=e.parentNode));var n=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return n&&new n(o)}function ue(e,t,o){if(e){var i=e.getElementsByTagName(t),n=0,s=i.length;if(o)for(;n<s;n++)o(i[n],n);return i}return[]}function pe(){var e=document.scrollingElement;return e||document.documentElement}function me(e,t,o,i,n){if(e.getBoundingClientRect||e===window){var s,a,r,l,c,d,u;if(e!==window&&e.parentNode&&e!==pe()?(a=(s=e.getBoundingClientRect()).top,r=s.left,l=s.bottom,c=s.right,d=s.height,u=s.width):(a=0,r=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(t||o)&&e!==window&&(n=n||e.parentNode,!Y))do{if(n&&n.getBoundingClientRect&&("none"!==ce(n,"transform")||o&&"static"!==ce(n,"position"))){var p=n.getBoundingClientRect();a-=p.top+parseInt(ce(n,"border-top-width")),r-=p.left+parseInt(ce(n,"border-left-width")),l=a+s.height,c=r+s.width;break}}while(n=n.parentNode);if(i&&e!==window){var m=de(n||e),h=m&&m.a,g=m&&m.d;m&&(l=(a/=g)+(d/=g),c=(r/=h)+(u/=h))}return{top:a,left:r,bottom:l,right:c,width:u,height:d}}}function he(e,t,o){for(var i=ye(e,!0),n=me(e)[t];i;){var s=me(i)[o];if(!("top"===o||"left"===o?n>=s:n<=s))return i;if(i===pe())break;i=ye(i,!1)}return!1}function ge(e,t,o,i){for(var n=0,s=0,a=e.children;s<a.length;){if("none"!==a[s].style.display&&a[s]!==kt.ghost&&(i||a[s]!==kt.dragged)&&se(a[s],o.draggable,e,!1)){if(n===t)return a[s];n++}s++}return null}function fe(e,t){for(var o=e.lastElementChild;o&&(o===kt.ghost||"none"===ce(o,"display")||t&&!ie(o,t));)o=o.previousElementSibling;return o||null}function be(e,t){var o=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===kt.clone||t&&!ie(e,t)||o++;return o}function ve(e){var t=0,o=0,i=pe();if(e)do{var n=de(e),s=n.a,a=n.d;t+=e.scrollLeft*s,o+=e.scrollTop*a}while(e!==i&&(e=e.parentNode));return[t,o]}function ye(e,t){if(!e||!e.getBoundingClientRect)return pe();var o=e,i=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var n=ce(o);if(o.clientWidth<o.scrollWidth&&("auto"==n.overflowX||"scroll"==n.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==n.overflowY||"scroll"==n.overflowY)){if(!o.getBoundingClientRect||o===document.body)return pe();if(i||t)return o;i=!0}}}while(o=o.parentNode);return pe()}function Ce(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function we(e,t){return function(){if(!ae){var o=arguments;1===o.length?e.call(this,o[0]):e.apply(this,o),ae=setTimeout((function(){ae=void 0}),t)}}}function xe(e,t,o){e.scrollLeft+=t,e.scrollTop+=o}function ke(e){var t=window.Polymer,o=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):o?o(e).clone(!0)[0]:e.cloneNode(!0)}function Se(e,t,o){var i={};return Array.from(e.children).forEach((function(n){var s,a,r,l;if(se(n,t.draggable,e,!1)&&!n.animated&&n!==o){var c=me(n);i.left=Math.min(null!==(s=i.left)&&void 0!==s?s:1/0,c.left),i.top=Math.min(null!==(a=i.top)&&void 0!==a?a:1/0,c.top),i.right=Math.max(null!==(r=i.right)&&void 0!==r?r:-1/0,c.right),i.bottom=Math.max(null!==(l=i.bottom)&&void 0!==l?l:-1/0,c.bottom)}})),i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}var Ee="Sortable"+(new Date).getTime();function Te(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(e){if("none"!==ce(e,"display")&&e!==kt.ghost){t.push({target:e,rect:me(e)});var o=z({},t[t.length-1].rect);if(e.thisAnimationDuration){var i=de(e,!0);i&&(o.top-=i.f,o.left-=i.e)}e.fromRect=o}}))},addAnimationState:function(e){t.push(e)},removeAnimationState:function(e){t.splice(function(e,t){for(var o in e)if(e.hasOwnProperty(o))for(var i in t)if(t.hasOwnProperty(i)&&t[i]===e[o][i])return Number(o);return-1}(t,{target:e}),1)},animateAll:function(o){var i=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof o&&o());var n=!1,s=0;t.forEach((function(e){var t=0,o=e.target,a=o.fromRect,r=me(o),l=o.prevFromRect,c=o.prevToRect,d=e.rect,u=de(o,!0);u&&(r.top-=u.f,r.left-=u.e),o.toRect=r,o.thisAnimationDuration&&Ce(l,r)&&!Ce(a,r)&&(d.top-r.top)/(d.left-r.left)==(a.top-r.top)/(a.left-r.left)&&(t=function(e,t,o,i){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-o.top,2)+Math.pow(t.left-o.left,2))*i.animation}(d,l,c,i.options)),Ce(r,a)||(o.prevFromRect=a,o.prevToRect=r,t||(t=i.options.animation),i.animate(o,d,r,t)),t&&(n=!0,s=Math.max(s,t),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout((function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null}),t),o.thisAnimationDuration=t)})),clearTimeout(e),n?e=setTimeout((function(){"function"==typeof o&&o()}),s):"function"==typeof o&&o(),t=[]},animate:function(e,t,o,i){if(i){ce(e,"transition",""),ce(e,"transform","");var n=de(this.el),s=n&&n.a,a=n&&n.d,r=(t.left-o.left)/(s||1),l=(t.top-o.top)/(a||1);e.animatingX=!!r,e.animatingY=!!l,ce(e,"transform","translate3d("+r+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),ce(e,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),ce(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){ce(e,"transition",""),ce(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),i)}}}}var Me=[],qe={initializeByDefault:!0},Ie={mount:function(e){for(var t in qe)qe.hasOwnProperty(t)&&!(t in e)&&(e[t]=qe[t]);Me.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),Me.push(e)},pluginEvent:function(e,t,o){var i=this;this.eventCanceled=!1,o.cancel=function(){i.eventCanceled=!0};var n=e+"Global";Me.forEach((function(i){t[i.pluginName]&&(t[i.pluginName][n]&&t[i.pluginName][n](z({sortable:t},o)),t.options[i.pluginName]&&t[i.pluginName][e]&&t[i.pluginName][e](z({sortable:t},o)))}))},initializePlugins:function(e,t,o,i){for(var n in Me.forEach((function(i){var n=i.pluginName;if(e.options[n]||i.initializeByDefault){var s=new i(e,t,e.options);s.sortable=e,s.options=e.options,e[n]=s,W(o,s.defaults)}})),e.options)if(e.options.hasOwnProperty(n)){var s=this.modifyOption(e,n,e.options[n]);void 0!==s&&(e.options[n]=s)}},getEventProperties:function(e,t){var o={};return Me.forEach((function(i){"function"==typeof i.eventProperties&&W(o,i.eventProperties.call(t[i.pluginName],e))})),o},modifyOption:function(e,t,o){var i;return Me.forEach((function(n){e[n.pluginName]&&n.optionListeners&&"function"==typeof n.optionListeners[t]&&(i=n.optionListeners[t].call(e[n.pluginName],o))})),i}};var Ae=["evt"],De=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=o.evt,n=j(o,Ae);Ie.pluginEvent.bind(kt)(e,t,z({dragEl:Be,parentEl:Oe,ghostEl:Ne,rootEl:Le,nextEl:Fe,lastDownEl:Re,cloneEl:Pe,cloneHidden:Ve,dragStarted:Qe,putSortable:je,activeSortable:kt.active,originalEvent:i,oldIndex:$e,oldDraggableIndex:He,newIndex:ze,newDraggableIndex:Ue,hideGhostForTarget:yt,unhideGhostForTarget:Ct,cloneNowHidden:function(){Ve=!0},cloneNowShown:function(){Ve=!1},dispatchSortableEvent:function(e){_e({sortable:t,name:e,originalEvent:i})}},n))};function _e(e){!function(e){var t=e.sortable,o=e.rootEl,i=e.name,n=e.targetEl,s=e.cloneEl,a=e.toEl,r=e.fromEl,l=e.oldIndex,c=e.newIndex,d=e.oldDraggableIndex,u=e.newDraggableIndex,p=e.originalEvent,m=e.putSortable,h=e.extraEventProperties;if(t=t||o&&o[Ee]){var g,f=t.options,b="on"+i.charAt(0).toUpperCase()+i.substr(1);!window.CustomEvent||Y||G?(g=document.createEvent("Event")).initEvent(i,!0,!0):g=new CustomEvent(i,{bubbles:!0,cancelable:!0}),g.to=a||o,g.from=r||o,g.item=n||o,g.clone=s,g.oldIndex=l,g.newIndex=c,g.oldDraggableIndex=d,g.newDraggableIndex=u,g.originalEvent=p,g.pullMode=m?m.lastPutMode:void 0;var v=z(z({},h),Ie.getEventProperties(i,t));for(var y in v)g[y]=v[y];o&&o.dispatchEvent(g),f[b]&&f[b].call(t,g)}}(z({putSortable:je,cloneEl:Pe,targetEl:Be,rootEl:Le,oldIndex:$e,oldDraggableIndex:He,newIndex:ze,newDraggableIndex:Ue},e))}var Be,Oe,Ne,Le,Fe,Re,Pe,Ve,$e,ze,He,Ue,We,je,Ze,Ye,Ge,Xe,Je,Ke,Qe,et,tt,ot,it,nt=!1,st=!1,at=[],rt=!1,lt=!1,ct=[],dt=!1,ut=[],pt="undefined"!=typeof document,mt=K,ht=G||Y?"cssFloat":"float",gt=pt&&!Q&&!K&&"draggable"in document.createElement("div"),ft=function(){if(pt){if(Y)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),bt=function(e,t){var o=ce(e),i=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),n=ge(e,0,t),s=ge(e,1,t),a=n&&ce(n),r=s&&ce(s),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+me(n).width,c=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+me(s).width;if("flex"===o.display)return"column"===o.flexDirection||"column-reverse"===o.flexDirection?"vertical":"horizontal";if("grid"===o.display)return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(n&&a.float&&"none"!==a.float){var d="left"===a.float?"left":"right";return!s||"both"!==r.clear&&r.clear!==d?"horizontal":"vertical"}return n&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=i&&"none"===o[ht]||s&&"none"===o[ht]&&l+c>i)?"vertical":"horizontal"},vt=function(e){function t(e,o){return function(i,n,s,a){var r=i.options.group.name&&n.options.group.name&&i.options.group.name===n.options.group.name;if(null==e&&(o||r))return!0;if(null==e||!1===e)return!1;if(o&&"clone"===e)return e;if("function"==typeof e)return t(e(i,n,s,a),o)(i,n,s,a);var l=(o?i:n).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var o={},i=e.group;i&&"object"==H(i)||(i={name:i}),o.name=i.name,o.checkPull=t(i.pull,!0),o.checkPut=t(i.put),o.revertClone=i.revertClone,e.group=o},yt=function(){!ft&&Ne&&ce(Ne,"display","none")},Ct=function(){!ft&&Ne&&ce(Ne,"display","")};pt&&!Q&&document.addEventListener("click",(function(e){if(st)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),st=!1,!1}),!0);var wt=function(e){if(Be){e=e.touches?e.touches[0]:e;var t=(n=e.clientX,s=e.clientY,at.some((function(e){var t=e[Ee].options.emptyInsertThreshold;if(t&&!fe(e)){var o=me(e),i=n>=o.left-t&&n<=o.right+t,r=s>=o.top-t&&s<=o.bottom+t;return i&&r?a=e:void 0}})),a);if(t){var o={};for(var i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[Ee]._onDragOver(o)}}var n,s,a},xt=function(e){Be&&Be.parentNode[Ee]._isOutsideThisEl(e.target)};function kt(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=W({},t),e[Ee]=this;var o={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return bt(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==kt.supportPointer&&"PointerEvent"in window&&(!J||K),emptyInsertThreshold:5};for(var i in Ie.initializePlugins(this,e,o),o)!(i in t)&&(t[i]=o[i]);for(var n in vt(t),this)"_"===n.charAt(0)&&"function"==typeof this[n]&&(this[n]=this[n].bind(this));this.nativeDraggable=!t.forceFallback&&gt,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?te(e,"pointerdown",this._onTapStart):(te(e,"mousedown",this._onTapStart),te(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(te(e,"dragover",this),te(e,"dragenter",this)),at.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),W(this,Te())}function St(e,t,o,i,n,s,a,r){var l,c,d=e[Ee],u=d.options.onMove;return!window.CustomEvent||Y||G?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=o,l.draggedRect=i,l.related=n||t,l.relatedRect=s||me(t),l.willInsertAfter=r,l.originalEvent=a,e.dispatchEvent(l),u&&(c=u.call(d,l,a)),c}function Et(e){e.draggable=!1}function Tt(){dt=!1}function Mt(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,o=t.length,i=0;o--;)i+=t.charCodeAt(o);return i.toString(36)}function qt(e){return setTimeout(e,0)}function It(e){return clearTimeout(e)}kt.prototype={constructor:kt,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(et=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Be):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,o=this.el,i=this.options,n=i.preventOnFilter,s=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,r=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||r,c=i.filter;if(function(e){ut.length=0;var t=e.getElementsByTagName("input"),o=t.length;for(;o--;){var i=t[o];i.checked&&ut.push(i)}}(o),!Be&&!(/mousedown|pointerdown/.test(s)&&0!==e.button||i.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!J||!r||"SELECT"!==r.tagName.toUpperCase())&&!((r=se(r,i.draggable,o,!1))&&r.animated||Re===r)){if($e=be(r),He=be(r,i.draggable),"function"==typeof c){if(c.call(this,e,r,this))return _e({sortable:t,rootEl:l,name:"filter",targetEl:r,toEl:o,fromEl:o}),De("filter",t,{evt:e}),void(n&&e.preventDefault())}else if(c&&(c=c.split(",").some((function(i){if(i=se(l,i.trim(),o,!1))return _e({sortable:t,rootEl:i,name:"filter",targetEl:r,fromEl:o,toEl:o}),De("filter",t,{evt:e}),!0}))))return void(n&&e.preventDefault());i.handle&&!se(l,i.handle,o,!1)||this._prepareDragStart(e,a,r)}}},_prepareDragStart:function(e,t,o){var i,n=this,s=n.el,a=n.options,r=s.ownerDocument;if(o&&!Be&&o.parentNode===s){var l=me(o);if(Le=s,Oe=(Be=o).parentNode,Fe=Be.nextSibling,Re=o,We=a.group,kt.dragged=Be,Ze={target:Be,clientX:(t||e).clientX,clientY:(t||e).clientY},Je=Ze.clientX-l.left,Ke=Ze.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Be.style["will-change"]="all",i=function(){De("delayEnded",n,{evt:e}),kt.eventCanceled?n._onDrop():(n._disableDelayedDragEvents(),!X&&n.nativeDraggable&&(Be.draggable=!0),n._triggerDragStart(e,t),_e({sortable:n,name:"choose",originalEvent:e}),le(Be,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){ue(Be,e.trim(),Et)})),te(r,"dragover",wt),te(r,"mousemove",wt),te(r,"touchmove",wt),a.supportPointer?(te(r,"pointerup",n._onDrop),!this.nativeDraggable&&te(r,"pointercancel",n._onDrop)):(te(r,"mouseup",n._onDrop),te(r,"touchend",n._onDrop),te(r,"touchcancel",n._onDrop)),X&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Be.draggable=!0),De("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(G||Y))i();else{if(kt.eventCanceled)return void this._onDrop();a.supportPointer?(te(r,"pointerup",n._disableDelayedDrag),te(r,"pointercancel",n._disableDelayedDrag)):(te(r,"mouseup",n._disableDelayedDrag),te(r,"touchend",n._disableDelayedDrag),te(r,"touchcancel",n._disableDelayedDrag)),te(r,"mousemove",n._delayedDragTouchMoveHandler),te(r,"touchmove",n._delayedDragTouchMoveHandler),a.supportPointer&&te(r,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(i,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Be&&Et(Be),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;oe(e,"mouseup",this._disableDelayedDrag),oe(e,"touchend",this._disableDelayedDrag),oe(e,"touchcancel",this._disableDelayedDrag),oe(e,"pointerup",this._disableDelayedDrag),oe(e,"pointercancel",this._disableDelayedDrag),oe(e,"mousemove",this._delayedDragTouchMoveHandler),oe(e,"touchmove",this._delayedDragTouchMoveHandler),oe(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?te(document,"pointermove",this._onTouchMove):te(document,t?"touchmove":"mousemove",this._onTouchMove):(te(Be,"dragend",this),te(Le,"dragstart",this._onDragStart));try{document.selection?qt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(nt=!1,Le&&Be){De("dragStarted",this,{evt:t}),this.nativeDraggable&&te(document,"dragover",xt);var o=this.options;!e&&le(Be,o.dragClass,!1),le(Be,o.ghostClass,!0),kt.active=this,e&&this._appendGhost(),_e({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Ye){this._lastX=Ye.clientX,this._lastY=Ye.clientY,yt();for(var e=document.elementFromPoint(Ye.clientX,Ye.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Ye.clientX,Ye.clientY))!==t;)t=e;if(Be.parentNode[Ee]._isOutsideThisEl(e),t)do{if(t[Ee]){if(t[Ee]._onDragOver({clientX:Ye.clientX,clientY:Ye.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=ne(t));Ct()}},_onTouchMove:function(e){if(Ze){var t=this.options,o=t.fallbackTolerance,i=t.fallbackOffset,n=e.touches?e.touches[0]:e,s=Ne&&de(Ne,!0),a=Ne&&s&&s.a,r=Ne&&s&&s.d,l=mt&&it&&ve(it),c=(n.clientX-Ze.clientX+i.x)/(a||1)+(l?l[0]-ct[0]:0)/(a||1),d=(n.clientY-Ze.clientY+i.y)/(r||1)+(l?l[1]-ct[1]:0)/(r||1);if(!kt.active&&!nt){if(o&&Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(Ne){s?(s.e+=c-(Ge||0),s.f+=d-(Xe||0)):s={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");ce(Ne,"webkitTransform",u),ce(Ne,"mozTransform",u),ce(Ne,"msTransform",u),ce(Ne,"transform",u),Ge=c,Xe=d,Ye=n}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Ne){var e=this.options.fallbackOnBody?document.body:Le,t=me(Be,!0,mt,!0,e),o=this.options;if(mt){for(it=e;"static"===ce(it,"position")&&"none"===ce(it,"transform")&&it!==document;)it=it.parentNode;it!==document.body&&it!==document.documentElement?(it===document&&(it=pe()),t.top+=it.scrollTop,t.left+=it.scrollLeft):it=pe(),ct=ve(it)}le(Ne=Be.cloneNode(!0),o.ghostClass,!1),le(Ne,o.fallbackClass,!0),le(Ne,o.dragClass,!0),ce(Ne,"transition",""),ce(Ne,"transform",""),ce(Ne,"box-sizing","border-box"),ce(Ne,"margin",0),ce(Ne,"top",t.top),ce(Ne,"left",t.left),ce(Ne,"width",t.width),ce(Ne,"height",t.height),ce(Ne,"opacity","0.8"),ce(Ne,"position",mt?"absolute":"fixed"),ce(Ne,"zIndex","100000"),ce(Ne,"pointerEvents","none"),kt.ghost=Ne,e.appendChild(Ne),ce(Ne,"transform-origin",Je/parseInt(Ne.style.width)*100+"% "+Ke/parseInt(Ne.style.height)*100+"%")}},_onDragStart:function(e,t){var o=this,i=e.dataTransfer,n=o.options;De("dragStart",this,{evt:e}),kt.eventCanceled?this._onDrop():(De("setupClone",this),kt.eventCanceled||((Pe=ke(Be)).removeAttribute("id"),Pe.draggable=!1,Pe.style["will-change"]="",this._hideClone(),le(Pe,this.options.chosenClass,!1),kt.clone=Pe),o.cloneId=qt((function(){De("clone",o),kt.eventCanceled||(o.options.removeCloneOnHide||Le.insertBefore(Pe,Be),o._hideClone(),_e({sortable:o,name:"clone"}))})),!t&&le(Be,n.dragClass,!0),t?(st=!0,o._loopId=setInterval(o._emulateDragOver,50)):(oe(document,"mouseup",o._onDrop),oe(document,"touchend",o._onDrop),oe(document,"touchcancel",o._onDrop),i&&(i.effectAllowed="move",n.setData&&n.setData.call(o,i,Be)),te(document,"drop",o),ce(Be,"transform","translateZ(0)")),nt=!0,o._dragStartId=qt(o._dragStarted.bind(o,t,e)),te(document,"selectstart",o),Qe=!0,window.getSelection().removeAllRanges(),J&&ce(document.body,"user-select","none"))},_onDragOver:function(e){var t,o,i,n,s=this.el,a=e.target,r=this.options,l=r.group,c=kt.active,d=We===l,u=r.sort,p=je||c,m=this,h=!1;if(!dt){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),a=se(a,r.draggable,s,!0),I("dragOver"),kt.eventCanceled)return h;if(Be.contains(e.target)||a.animated&&a.animatingX&&a.animatingY||m._ignoreWhileAnimating===a)return D(!1);if(st=!1,c&&!r.disabled&&(d?u||(i=Oe!==Le):je===this||(this.lastPutMode=We.checkPull(this,c,Be,e))&&l.checkPut(this,c,Be,e))){if(n="vertical"===this._getDirection(e,a),t=me(Be),I("dragOverValid"),kt.eventCanceled)return h;if(i)return Oe=Le,A(),this._hideClone(),I("revert"),kt.eventCanceled||(Fe?Le.insertBefore(Be,Fe):Le.appendChild(Be)),D(!0);var g=fe(s,r.draggable);if(!g||function(e,t,o){var i=me(fe(o.el,o.options.draggable)),n=Se(o.el,o.options,Ne),s=10;return t?e.clientX>n.right+s||e.clientY>i.bottom&&e.clientX>i.left:e.clientY>n.bottom+s||e.clientX>i.right&&e.clientY>i.top}(e,n,this)&&!g.animated){if(g===Be)return D(!1);if(g&&s===e.target&&(a=g),a&&(o=me(a)),!1!==St(Le,s,Be,t,a,o,e,!!a))return A(),g&&g.nextSibling?s.insertBefore(Be,g.nextSibling):s.appendChild(Be),Oe=s,_(),D(!0)}else if(g&&function(e,t,o){var i=me(ge(o.el,0,o.options,!0)),n=Se(o.el,o.options,Ne),s=10;return t?e.clientX<n.left-s||e.clientY<i.top&&e.clientX<i.right:e.clientY<n.top-s||e.clientY<i.bottom&&e.clientX<i.left}(e,n,this)){var f=ge(s,0,r,!0);if(f===Be)return D(!1);if(o=me(a=f),!1!==St(Le,s,Be,t,a,o,e,!1))return A(),s.insertBefore(Be,f),Oe=s,_(),D(!0)}else if(a.parentNode===s){o=me(a);var b,v,y,C=Be.parentNode!==s,w=!function(e,t,o){var i=o?e.left:e.top,n=o?e.right:e.bottom,s=o?e.width:e.height,a=o?t.left:t.top,r=o?t.right:t.bottom,l=o?t.width:t.height;return i===a||n===r||i+s/2===a+l/2}(Be.animated&&Be.toRect||t,a.animated&&a.toRect||o,n),x=n?"top":"left",k=he(a,"top","top")||he(Be,"top","top"),S=k?k.scrollTop:void 0;if(et!==a&&(v=o[x],rt=!1,lt=!w&&r.invertSwap||C),b=function(e,t,o,i,n,s,a,r){var l=i?e.clientY:e.clientX,c=i?o.height:o.width,d=i?o.top:o.left,u=i?o.bottom:o.right,p=!1;if(!a)if(r&&ot<c*n){if(!rt&&(1===tt?l>d+c*s/2:l<u-c*s/2)&&(rt=!0),rt)p=!0;else if(1===tt?l<d+ot:l>u-ot)return-tt}else if(l>d+c*(1-n)/2&&l<u-c*(1-n)/2)return function(e){return be(Be)<be(e)?1:-1}(t);if((p=p||a)&&(l<d+c*s/2||l>u-c*s/2))return l>d+c/2?1:-1;return 0}(e,a,o,n,w?1:r.swapThreshold,null==r.invertedSwapThreshold?r.swapThreshold:r.invertedSwapThreshold,lt,et===a),0!==b){var E=be(Be);do{E-=b,y=Oe.children[E]}while(y&&("none"===ce(y,"display")||y===Ne))}if(0===b||y===a)return D(!1);et=a,tt=b;var T=a.nextElementSibling,M=!1,q=St(Le,s,Be,t,a,o,e,M=1===b);if(!1!==q)return 1!==q&&-1!==q||(M=1===q),dt=!0,setTimeout(Tt,30),A(),M&&!T?s.appendChild(Be):a.parentNode.insertBefore(Be,M?T:a),k&&xe(k,0,S-k.scrollTop),Oe=Be.parentNode,void 0===v||lt||(ot=Math.abs(v-me(a)[x])),_(),D(!0)}if(s.contains(Be))return D(!1)}return!1}function I(r,l){De(r,m,z({evt:e,isOwner:d,axis:n?"vertical":"horizontal",revert:i,dragRect:t,targetRect:o,canSort:u,fromSortable:p,target:a,completed:D,onMove:function(o,i){return St(Le,s,Be,t,o,me(o),e,i)},changed:_},l))}function A(){I("dragOverAnimationCapture"),m.captureAnimationState(),m!==p&&p.captureAnimationState()}function D(t){return I("dragOverCompleted",{insertion:t}),t&&(d?c._hideClone():c._showClone(m),m!==p&&(le(Be,je?je.options.ghostClass:c.options.ghostClass,!1),le(Be,r.ghostClass,!0)),je!==m&&m!==kt.active?je=m:m===kt.active&&je&&(je=null),p===m&&(m._ignoreWhileAnimating=a),m.animateAll((function(){I("dragOverAnimationComplete"),m._ignoreWhileAnimating=null})),m!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(a===Be&&!Be.animated||a===s&&!a.animated)&&(et=null),r.dragoverBubble||e.rootEl||a===document||(Be.parentNode[Ee]._isOutsideThisEl(e.target),!t&&wt(e)),!r.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function _(){ze=be(Be),Ue=be(Be,r.draggable),_e({sortable:m,name:"change",toEl:s,newIndex:ze,newDraggableIndex:Ue,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){oe(document,"mousemove",this._onTouchMove),oe(document,"touchmove",this._onTouchMove),oe(document,"pointermove",this._onTouchMove),oe(document,"dragover",wt),oe(document,"mousemove",wt),oe(document,"touchmove",wt)},_offUpEvents:function(){var e=this.el.ownerDocument;oe(e,"mouseup",this._onDrop),oe(e,"touchend",this._onDrop),oe(e,"pointerup",this._onDrop),oe(e,"pointercancel",this._onDrop),oe(e,"touchcancel",this._onDrop),oe(document,"selectstart",this)},_onDrop:function(e){var t=this.el,o=this.options;ze=be(Be),Ue=be(Be,o.draggable),De("drop",this,{evt:e}),Oe=Be&&Be.parentNode,ze=be(Be),Ue=be(Be,o.draggable),kt.eventCanceled||(nt=!1,lt=!1,rt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),It(this.cloneId),It(this._dragStartId),this.nativeDraggable&&(oe(document,"drop",this),oe(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),J&&ce(document.body,"user-select",""),ce(Be,"transform",""),e&&(Qe&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),Ne&&Ne.parentNode&&Ne.parentNode.removeChild(Ne),(Le===Oe||je&&"clone"!==je.lastPutMode)&&Pe&&Pe.parentNode&&Pe.parentNode.removeChild(Pe),Be&&(this.nativeDraggable&&oe(Be,"dragend",this),Et(Be),Be.style["will-change"]="",Qe&&!nt&&le(Be,je?je.options.ghostClass:this.options.ghostClass,!1),le(Be,this.options.chosenClass,!1),_e({sortable:this,name:"unchoose",toEl:Oe,newIndex:null,newDraggableIndex:null,originalEvent:e}),Le!==Oe?(ze>=0&&(_e({rootEl:Oe,name:"add",toEl:Oe,fromEl:Le,originalEvent:e}),_e({sortable:this,name:"remove",toEl:Oe,originalEvent:e}),_e({rootEl:Oe,name:"sort",toEl:Oe,fromEl:Le,originalEvent:e}),_e({sortable:this,name:"sort",toEl:Oe,originalEvent:e})),je&&je.save()):ze!==$e&&ze>=0&&(_e({sortable:this,name:"update",toEl:Oe,originalEvent:e}),_e({sortable:this,name:"sort",toEl:Oe,originalEvent:e})),kt.active&&(null!=ze&&-1!==ze||(ze=$e,Ue=He),_e({sortable:this,name:"end",toEl:Oe,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){De("nulling",this),Le=Be=Oe=Ne=Fe=Pe=Re=Ve=Ze=Ye=Qe=ze=Ue=$e=He=et=tt=je=We=kt.dragged=kt.ghost=kt.clone=kt.active=null,ut.forEach((function(e){e.checked=!0})),ut.length=Ge=Xe=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Be&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],o=this.el.children,i=0,n=o.length,s=this.options;i<n;i++)se(e=o[i],s.draggable,this.el,!1)&&t.push(e.getAttribute(s.dataIdAttr)||Mt(e));return t},sort:function(e,t){var o={},i=this.el;this.toArray().forEach((function(e,t){var n=i.children[t];se(n,this.options.draggable,i,!1)&&(o[e]=n)}),this),t&&this.captureAnimationState(),e.forEach((function(e){o[e]&&(i.removeChild(o[e]),i.appendChild(o[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return se(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var o=this.options;if(void 0===t)return o[e];var i=Ie.modifyOption(this,e,t);o[e]=void 0!==i?i:t,"group"===e&&vt(o)},destroy:function(){De("destroy",this);var e=this.el;e[Ee]=null,oe(e,"mousedown",this._onTapStart),oe(e,"touchstart",this._onTapStart),oe(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(oe(e,"dragover",this),oe(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),at.splice(at.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Ve){if(De("hideClone",this),kt.eventCanceled)return;ce(Pe,"display","none"),this.options.removeCloneOnHide&&Pe.parentNode&&Pe.parentNode.removeChild(Pe),Ve=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(Ve){if(De("showClone",this),kt.eventCanceled)return;Be.parentNode!=Le||this.options.group.revertClone?Fe?Le.insertBefore(Pe,Fe):Le.appendChild(Pe):Le.insertBefore(Pe,Be),this.options.group.revertClone&&this.animate(Be,Pe),ce(Pe,"display",""),Ve=!1}}else this._hideClone()}},pt&&te(document,"touchmove",(function(e){(kt.active||nt)&&e.cancelable&&e.preventDefault()})),kt.utils={on:te,off:oe,css:ce,find:ue,is:function(e,t){return!!se(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);return e},throttle:we,closest:se,toggleClass:le,clone:ke,index:be,nextTick:qt,cancelNextTick:It,detectDirection:bt,getChild:ge,expando:Ee},kt.get=function(e){return e[Ee]},kt.mount=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(kt.utils=z(z({},kt.utils),e.utils)),Ie.mount(e)}))},kt.create=function(e,t){return new kt(e,t)},kt.version="1.15.6";var At,Dt,_t,Bt,Ot,Nt,Lt=[],Ft=!1;function Rt(){Lt.forEach((function(e){clearInterval(e.pid)})),Lt=[]}function Pt(){clearInterval(Nt)}var Vt=we((function(e,t,o,i){if(t.scroll){var n,s=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,r=t.scrollSensitivity,l=t.scrollSpeed,c=pe(),d=!1;Dt!==o&&(Dt=o,Rt(),At=t.scroll,n=t.scrollFn,!0===At&&(At=ye(o,!0)));var u=0,p=At;do{var m=p,h=me(m),g=h.top,f=h.bottom,b=h.left,v=h.right,y=h.width,C=h.height,w=void 0,x=void 0,k=m.scrollWidth,S=m.scrollHeight,E=ce(m),T=m.scrollLeft,M=m.scrollTop;m===c?(w=y<k&&("auto"===E.overflowX||"scroll"===E.overflowX||"visible"===E.overflowX),x=C<S&&("auto"===E.overflowY||"scroll"===E.overflowY||"visible"===E.overflowY)):(w=y<k&&("auto"===E.overflowX||"scroll"===E.overflowX),x=C<S&&("auto"===E.overflowY||"scroll"===E.overflowY));var q=w&&(Math.abs(v-s)<=r&&T+y<k)-(Math.abs(b-s)<=r&&!!T),I=x&&(Math.abs(f-a)<=r&&M+C<S)-(Math.abs(g-a)<=r&&!!M);if(!Lt[u])for(var A=0;A<=u;A++)Lt[A]||(Lt[A]={});Lt[u].vx==q&&Lt[u].vy==I&&Lt[u].el===m||(Lt[u].el=m,Lt[u].vx=q,Lt[u].vy=I,clearInterval(Lt[u].pid),0==q&&0==I||(d=!0,Lt[u].pid=setInterval(function(){i&&0===this.layer&&kt.active._onTouchMove(Ot);var t=Lt[this.layer].vy?Lt[this.layer].vy*l:0,o=Lt[this.layer].vx?Lt[this.layer].vx*l:0;"function"==typeof n&&"continue"!==n.call(kt.dragged.parentNode[Ee],o,t,e,Ot,Lt[this.layer].el)||xe(Lt[this.layer].el,o,t)}.bind({layer:u}),24))),u++}while(t.bubbleScroll&&p!==c&&(p=ye(p,!1)));Ft=d}}),30),$t=function(e){var t=e.originalEvent,o=e.putSortable,i=e.dragEl,n=e.activeSortable,s=e.dispatchSortableEvent,a=e.hideGhostForTarget,r=e.unhideGhostForTarget;if(t){var l=o||n;a();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,d=document.elementFromPoint(c.clientX,c.clientY);r(),l&&!l.el.contains(d)&&(s("spill"),this.onSpill({dragEl:i,putSortable:o}))}};function zt(){}function Ht(){}zt.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var i=ge(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),o&&o.animateAll()},drop:$t},W(zt,{pluginName:"revertOnSpill"}),Ht.prototype={onSpill:function(e){var t=e.dragEl,o=e.putSortable||this.sortable;o.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),o.animateAll()},drop:$t},W(Ht,{pluginName:"removeOnSpill"}),kt.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?te(document,"dragover",this._handleAutoScroll):this.options.supportPointer?te(document,"pointermove",this._handleFallbackAutoScroll):t.touches?te(document,"touchmove",this._handleFallbackAutoScroll):te(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?oe(document,"dragover",this._handleAutoScroll):(oe(document,"pointermove",this._handleFallbackAutoScroll),oe(document,"touchmove",this._handleFallbackAutoScroll),oe(document,"mousemove",this._handleFallbackAutoScroll)),Pt(),Rt(),clearTimeout(ae),ae=void 0},nulling:function(){Ot=Dt=At=Ft=Nt=_t=Bt=null,Lt.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var o=this,i=(e.touches?e.touches[0]:e).clientX,n=(e.touches?e.touches[0]:e).clientY,s=document.elementFromPoint(i,n);if(Ot=e,t||this.options.forceAutoScrollFallback||G||Y||J){Vt(e,this.options,s,t);var a=ye(s,!0);!Ft||Nt&&i===_t&&n===Bt||(Nt&&Pt(),Nt=setInterval((function(){var s=ye(document.elementFromPoint(i,n),!0);s!==a&&(a=s,Rt()),Vt(e,o.options,s,t)}),10),_t=i,Bt=n)}else{if(!this.options.bubbleScroll||ye(s,!0)===pe())return void Rt();Vt(e,this.options,ye(s,!1),!1)}}},W(e,{pluginName:"scroll",initializeByDefault:!0})}),kt.mount(Ht,zt);class Ut extends e.Modal{constructor(e,t){super(e),this.changelogContent="",this.changelogLoaded=!1,this.plugin=t}loadChangelog(){return t(this,void 0,void 0,(function*(){try{const t=yield e.request({url:"https://raw.githubusercontent.com/PKM-er/obsidian-editing-toolbar/master/CHANGELOG.md",method:"GET"});if(!t)throw new Error("无法获取 Changelog 内容");{const e=t.split("\n");let o="",i=[],n=!1;for(const t of e)if(t.startsWith("## ")&&!o)o=t.substring(3).trim(),n=!0,i.push(t);else{if(t.startsWith("## ")&&n)break;n&&i.push(t)}this.changelogContent=i.join("\n")}}catch(e){console.error("加载 Changelog 时出错:",e),this.changelogContent="### 无法加载更新说明\n\n请[点击此处查看最新更新说明](https://github.com/PKM-er/obsidian-editing-toolbar/blob/master/CHANGELOG.md)"}this.changelogLoaded=!0,this.updateChangelogDisplay()}))}updateChangelogDisplay(){this.changelogContainer&&this.changelogContentEl&&this.changelogLoaded&&(this.changelogContentEl.empty(),e.MarkdownRenderer.renderMarkdown(this.changelogContent,this.changelogContentEl,"",this.plugin))}fixCommandIds(){return t(this,void 0,void 0,(function*(){try{const t={"editor:toggle-numbered-list":"editing-toolbar:toggle-numbered-list","editor:toggle-bullet-list":"editing-toolbar:toggle-bullet-list","editor:toggle-highlight":"editing-toolbar:toggle-highlight","toggle-highlight":"editing-toolbar:toggle-highlight","editing-toolbar:editor:toggle-bold":"editing-toolbar:toggle-bold","editing-toolbar:editor:toggle-italics":"editing-toolbar:toggle-italics","editing-toolbar:editor:toggle-strikethrough":"editing-toolbar:toggle-strikethrough","editing-toolbar:editor:toggle-inline-math":"editing-toolbar:toggle-inline-math","editing-toolbar:editor:insert-callout":"editing-toolbar:insert-callout","editing-toolbar:editor:insert-link":"editing-toolbar:insert-link","cMenuToolbar-Divider-Line":"editingToolbar-Divider-Line"};let o=!1;const i=this.plugin.settings,n=e=>{e&&Array.isArray(e)&&e.forEach((e=>{e.id&&t[e.id]&&(e.id=t[e.id],o=!0),"editing-toolbar:format-eraser"===e.id&&(e.icon="eraser",o=!0),e.SubmenuCommands&&n(e.SubmenuCommands)}))},s=e=>{if(!e||!Array.isArray(e))return!1;for(const t of e){if("editing-toolbar:toggle-format-brush"===t.id)return!0;if(t.SubmenuCommands){if(s(t.SubmenuCommands))return!0}}return!1},a=e=>{if(!e||!Array.isArray(e))return!1;if(!s(e)&&e.length>=2){const t={id:"editing-toolbar:toggle-format-brush",name:"Format Brush",icon:"paintbrush"};return e.splice(2,0,t),!0}return!1};i.menuCommands&&(n(i.menuCommands),a(i.menuCommands)&&(o=!0)),i.enableMultipleConfig&&(i.followingCommands&&(n(i.followingCommands),a(i.followingCommands)&&(o=!0)),i.topCommands&&(n(i.topCommands),a(i.topCommands)&&(o=!0)),i.fixedCommands&&(n(i.fixedCommands),a(i.fixedCommands)&&(o=!0)),i.mobileCommands&&(n(i.mobileCommands),a(i.mobileCommands)&&(o=!0))),o?(yield this.plugin.saveSettings(),new e.Notice(f("Command IDs have been successfully repaired!")),dispatchEvent(new Event("editingToolbar-NewCommand"))):new e.Notice(f("No command IDs need to be repaired"))}catch(t){console.error("修复命令ID时出错:",t),new e.Notice(f("Error repairing command IDs, please check the console for details"))}}))}reloadPlugin(e){return t(this,void 0,void 0,(function*(){const{plugins:t}=this.app;try{yield t.disablePlugin(e),yield t.enablePlugin(e)}catch(e){console.error(e)}}))}restoreDefaultSettings(){return t(this,void 0,void 0,(function*(){try{const t=this.plugin.settings.lastVersion,o=this.plugin.settings.customCommands;this.plugin.settings=Object.assign(Object.assign({},E),{lastVersion:t,customCommands:o}),yield this.plugin.saveSettings(),new e.Notice(f("Successfully restored default settings! (Custom commands preserved)")),this.reloadPlugin(this.plugin.manifest.id),this.close()}catch(t){console.error("恢复默认设置时出错:",t),new e.Notice(f("Error restoring default settings, please check the console for details"))}}))}onOpen(){const{contentEl:o}=this;o.createEl("h2",{text:this.plugin.manifest.version+"⚡Tips"}),o.createEl("p",{text:f("Notice:")});const i=o.createEl("ul");i.createEl("li",{text:f("⚠This update is not compatible with 2.x version command ids, please click [Repair command] to be compatible")}),i.createEl("li",{text:f("⚠If you want to restore the default settings, please click [Restore default settings]")}),this.changelogContainer=o.createDiv({cls:"changelog-container"}),this.changelogContainer.createEl("h3",{text:f("Latest Changes")}),this.changelogContentEl=this.changelogContainer.createDiv({cls:"changelog-content"}),this.changelogContentEl.setText(f("Loading changelog...")),setTimeout((()=>{this.loadChangelog()}),100),new e.Setting(o).setName(f("🔧Data repair")).setDesc(f("This update changed the ID of some commands, please click this button to repair the commands to ensure the toolbar works properly")).addButton((e=>e.setButtonText(f("Repair command ID")).onClick((()=>t(this,void 0,void 0,(function*(){yield this.fixCommandIds()})))))),new e.Setting(o).setName(f("🔄Restore default settings")).setDesc(f("This will reset all your custom configurations, but custom commands will be preserved")).addButton((e=>e.setButtonText(f("Restore default")).onClick((()=>t(this,void 0,void 0,(function*(){confirm(f("Are you sure you want to restore all settings to default? But custom commands will be preserved."))&&(yield this.restoreDefaultSettings())})))))),new e.Setting(o).setName(f("📋View full changelog")).setDesc(f("Open the complete changelog in your browser")).addButton((e=>e.setButtonText(f("Open changelog")).onClick((()=>{window.open("https://github.com/PKM-er/obsidian-editing-toolbar/blob/master/CHANGELOG.md","_blank")})))),new e.Setting(o).addButton((e=>e.setButtonText(f("Close")).onClick((()=>{this.close()})))),o.createEl("style",{text:"\n .changelog-container {\n margin-top: 20px;\n margin-bottom: 20px;\n padding: 10px;\n border: 1px solid var(--background-modifier-border);\n border-radius: 5px;\n max-height: 200px;\n overflow-y: auto;\n }\n .changelog-content {\n padding: 0 10px;\n }\n .changelog-content a {\n text-decoration: underline;\n }\n "})}onClose(){const{contentEl:e}=this;e.empty()}}function Wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}
/*! Pickr 1.8.4 MIT | https://github.com/Simonwep/pickr */
var jt=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){self,e.exports=(()=>{var e={d:(t,o)=>{for(var i in o)e.o(o,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:o[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.d(t,{default:()=>D});var o={};function i(e,t,o,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t instanceof HTMLCollection||t instanceof NodeList?t=Array.from(t):Array.isArray(t)||(t=[t]),Array.isArray(o)||(o=[o]);for(const s of t)for(const t of o)s[e](t,i,{capture:!1,...n});return Array.prototype.slice.call(arguments,1)}e.r(o),e.d(o,{adjustableInputNumbers:()=>d,createElementFromString:()=>a,createFromTemplate:()=>r,eventPath:()=>l,off:()=>s,on:()=>n,resolveElement:()=>c});const n=i.bind(null,"addEventListener"),s=i.bind(null,"removeEventListener");function a(e){const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstElementChild}function r(e){const t=(e,t)=>{const o=e.getAttribute(t);return e.removeAttribute(t),o},o=function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=t(e,":obj"),s=t(e,":ref"),a=n?i[n]={}:i;s&&(i[s]=e);for(const i of Array.from(e.children)){const e=t(i,":arr"),n=o(i,e?{}:a);e&&(a[e]||(a[e]=[])).push(Object.keys(n).length?n:i)}return i};return o(a(e))}function l(e){let t=e.path||e.composedPath&&e.composedPath();if(t)return t;let o=e.target.parentElement;for(t=[e.target,o];o=o.parentElement;)t.push(o);return t.push(document,window),t}function c(e){return e instanceof Element?e:"string"==typeof e?e.split(/>>/g).reduce(((e,t,o,i)=>(e=e.querySelector(t),o<i.length-1?e.shadowRoot:e)),document):null}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;function o(o){const i=[.001,.01,.1][Number(o.shiftKey||2*o.ctrlKey)]*(o.deltaY<0?1:-1);let n=0,s=e.selectionStart;e.value=e.value.replace(/[\d.]+/g,((e,o)=>o<=s&&o+e.length>=s?(s=o,t(Number(e),i,n)):(n++,e))),e.focus(),e.setSelectionRange(s,s),o.preventDefault(),e.dispatchEvent(new Event("input"))}n(e,"focus",(()=>n(window,"wheel",o,{passive:!1}))),n(e,"blur",(()=>s(window,"wheel",o)))}const{min:u,max:p,floor:m,round:h}=Math;function g(e,t,o){t/=100,o/=100;const i=m(e=e/360*6),n=e-i,s=o*(1-t),a=o*(1-n*t),r=o*(1-(1-n)*t),l=i%6;return[255*[o,a,s,s,r,o][l],255*[r,o,o,a,s,s][l],255*[s,s,r,o,o,a][l]]}function f(e,t,o){return g(e,t,o).map((e=>h(e).toString(16).padStart(2,"0")))}function b(e,t,o){const i=g(e,t,o),n=i[0]/255,s=i[1]/255,a=i[2]/255,r=u(1-n,1-s,1-a);return[100*(1===r?0:(1-n-r)/(1-r)),100*(1===r?0:(1-s-r)/(1-r)),100*(1===r?0:(1-a-r)/(1-r)),100*r]}function v(e,t,o){const i=(2-(t/=100))*(o/=100)/2;return 0!==i&&(t=1===i?0:i<.5?t*o/(2*i):t*o/(2-2*i)),[e,100*t,100*i]}function y(e,t,o){const i=u(e/=255,t/=255,o/=255),n=p(e,t,o),s=n-i;let a,r;if(0===s)a=r=0;else{r=s/n;const i=((n-e)/6+s/2)/s,l=((n-t)/6+s/2)/s,c=((n-o)/6+s/2)/s;e===n?a=c-l:t===n?a=1/3+i-c:o===n&&(a=2/3+l-i),a<0?a+=1:a>1&&(a-=1)}return[360*a,100*r,100*n]}function C(e,t,o,i){return t/=100,o/=100,[...y(255*(1-u(1,(e/=100)*(1-(i/=100))+i)),255*(1-u(1,t*(1-i)+i)),255*(1-u(1,o*(1-i)+i)))]}function w(e,t,o){t/=100;const i=2*(t*=(o/=100)<.5?o:1-o)/(o+t)*100,n=100*(o+t);return[e,isNaN(i)?0:i,n]}function x(e){return y(...e.match(/.{2}/g).map((e=>parseInt(e,16))))}function k(e){e=e.match(/^[a-zA-Z]+$/)?function(e){if("black"===e.toLowerCase())return"#000";const t=document.createElement("canvas").getContext("2d");return t.fillStyle=e,"#000"===t.fillStyle?null:t.fillStyle}(e):e;const t={cmyk:/^cmyk[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)/i,rgba:/^((rgba)|rgb)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i,hsla:/^((hsla)|hsl)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i,hsva:/^((hsva)|hsv)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i,hexa:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},o=e=>e.map((e=>/^(|\d+)\.\d+|\d+$/.test(e)?Number(e):void 0));let i;e:for(const n in t){if(!(i=t[n].exec(e)))continue;const s=e=>!!i[2]==("number"==typeof e);switch(n){case"cmyk":{const[,e,t,s,a]=o(i);if(e>100||t>100||s>100||a>100)break e;return{values:C(e,t,s,a),type:n}}case"rgba":{const[,,,e,t,a,r]=o(i);if(e>255||t>255||a>255||r<0||r>1||!s(r))break e;return{values:[...y(e,t,a),r],a:r,type:n}}case"hexa":{let[,e]=i;4!==e.length&&3!==e.length||(e=e.split("").map((e=>e+e)).join(""));const t=e.substring(0,6);let o=e.substring(6);return o=o?parseInt(o,16)/255:void 0,{values:[...x(t),o],a:o,type:n}}case"hsla":{const[,,,e,t,a,r]=o(i);if(e>360||t>100||a>100||r<0||r>1||!s(r))break e;return{values:[...w(e,t,a),r],a:r,type:n}}case"hsva":{const[,,,e,t,a,r]=o(i);if(e>360||t>100||a>100||r<0||r>1||!s(r))break e;return{values:[e,t,a,r],a:r,type:n}}}}return{values:null,type:null}}function S(){const e=(e,t)=>function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;return t(~o?e.map((e=>Number(e.toFixed(o)))):e)},t={h:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,s:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,v:arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a:arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,toHSVA(){const o=[t.h,t.s,t.v,t.a];return o.toString=e(o,(e=>`hsva(${e[0]}, ${e[1]}%, ${e[2]}%, ${t.a})`)),o},toHSLA(){const o=[...v(t.h,t.s,t.v),t.a];return o.toString=e(o,(e=>`hsla(${e[0]}, ${e[1]}%, ${e[2]}%, ${t.a})`)),o},toRGBA(){const o=[...g(t.h,t.s,t.v),t.a];return o.toString=e(o,(e=>`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t.a})`)),o},toCMYK(){const o=b(t.h,t.s,t.v);return o.toString=e(o,(e=>`cmyk(${e[0]}%, ${e[1]}%, ${e[2]}%, ${e[3]}%)`)),o},toHEXA(){const e=f(t.h,t.s,t.v),o=t.a>=1?"":Number((255*t.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return o&&e.push(o),e.toString=()=>`#${e.join("").toUpperCase()}`,e},clone:()=>S(t.h,t.s,t.v,t.a)};return t}const E=e=>Math.max(Math.min(e,1),0);function T(e){const t={options:Object.assign({lock:null,onchange:()=>0,onstop:()=>0},e),_keyboard(e){const{options:o}=t,{type:i,key:n}=e;if(document.activeElement===o.wrapper){const{lock:o}=t.options,s="ArrowUp"===n,a="ArrowRight"===n,r="ArrowDown"===n,l="ArrowLeft"===n;if("keydown"===i&&(s||a||r||l)){let i=0,n=0;"v"===o?i=s||a?1:-1:"h"===o?i=s||a?-1:1:(n=s?-1:r?1:0,i=l?-1:a?1:0),t.update(E(t.cache.x+.01*i),E(t.cache.y+.01*n)),e.preventDefault()}else n.startsWith("Arrow")&&(t.options.onstop(),e.preventDefault())}},_tapstart(e){n(document,["mouseup","touchend","touchcancel"],t._tapstop),n(document,["mousemove","touchmove"],t._tapmove),e.cancelable&&e.preventDefault(),t._tapmove(e)},_tapmove(e){const{options:o,cache:i}=t,{lock:n,element:s,wrapper:a}=o,r=a.getBoundingClientRect();let l=0,c=0;if(e){const t=e&&e.touches&&e.touches[0];l=e?(t||e).clientX:0,c=e?(t||e).clientY:0,l<r.left?l=r.left:l>r.left+r.width&&(l=r.left+r.width),c<r.top?c=r.top:c>r.top+r.height&&(c=r.top+r.height),l-=r.left,c-=r.top}else i&&(l=i.x*r.width,c=i.y*r.height);"h"!==n&&(s.style.left=`calc(${l/r.width*100}% - ${s.offsetWidth/2}px)`),"v"!==n&&(s.style.top=`calc(${c/r.height*100}% - ${s.offsetHeight/2}px)`),t.cache={x:l/r.width,y:c/r.height};const d=E(l/r.width),u=E(c/r.height);switch(n){case"v":return o.onchange(d);case"h":return o.onchange(u);default:return o.onchange(d,u)}},_tapstop(){t.options.onstop(),s(document,["mouseup","touchend","touchcancel"],t._tapstop),s(document,["mousemove","touchmove"],t._tapmove)},trigger(){t._tapmove()},update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const{left:i,top:n,width:s,height:a}=t.options.wrapper.getBoundingClientRect();"h"===t.options.lock&&(o=e),t._tapmove({clientX:i+s*e,clientY:n+a*o})},destroy(){const{options:e,_tapstart:o,_keyboard:i}=t;s(document,["keydown","keyup"],i),s([e.wrapper,e.element],"mousedown",o),s([e.wrapper,e.element],"touchstart",o,{passive:!1})}},{options:o,_tapstart:i,_keyboard:a}=t;return n([o.wrapper,o.element],"mousedown",i),n([o.wrapper,o.element],"touchstart",i,{passive:!1}),n(document,["keydown","keyup"],a),t}function M(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=Object.assign({onchange:()=>0,className:"",elements:[]},e);const t=n(e.elements,"click",(t=>{e.elements.forEach((o=>o.classList[t.target===o?"add":"remove"](e.className))),e.onchange(t),t.stopPropagation()}));return{destroy:()=>s(...t)}}const q={variantFlipOrder:{start:"sme",middle:"mse",end:"ems"},positionFlipOrder:{top:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},position:"bottom",margin:8},I=(e,t,o)=>{const{container:i,margin:n,position:s,variantFlipOrder:a,positionFlipOrder:r}={container:document.documentElement.getBoundingClientRect(),...q,...o},{left:l,top:c}=t.style;t.style.left="0",t.style.top="0";const d=e.getBoundingClientRect(),u=t.getBoundingClientRect(),p={t:d.top-u.height-n,b:d.bottom+n,r:d.right+n,l:d.left-u.width-n},m={vs:d.left,vm:d.left+d.width/2+-u.width/2,ve:d.left+d.width-u.width,hs:d.top,hm:d.bottom-d.height/2-u.height/2,he:d.bottom-u.height},[h,g="middle"]=s.split("-"),f=r[h],b=a[g],{top:v,left:y,bottom:C,right:w}=i;for(const e of f){const o="t"===e||"b"===e,i=p[e],[n,s]=o?["top","left"]:["left","top"],[a,r]=o?[u.height,u.width]:[u.width,u.height],[l,c]=o?[C,w]:[w,C],[d,h]=o?[v,y]:[y,v];if(!(i<d||i+a>l))for(const a of b){const l=m[(o?"v":"h")+a];if(!(l<h||l+r>c))return t.style[s]=l-u[s]+"px",t.style[n]=i-u[n]+"px",e+a}}return t.style.left=l,t.style.top=c,null};function A(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}class D{constructor(e){A(this,"_initializingActive",!0),A(this,"_recalc",!0),A(this,"_nanopop",null),A(this,"_root",null),A(this,"_color",S()),A(this,"_lastColor",S()),A(this,"_swatchColors",[]),A(this,"_setupAnimationFrame",null),A(this,"_eventListener",{init:[],save:[],hide:[],show:[],clear:[],change:[],changestop:[],cancel:[],swatchselect:[]}),this.options=e=Object.assign({...D.DEFAULT_OPTIONS},e);const{swatches:t,components:o,theme:i,sliders:n,lockOpacity:s,padding:a}=e;["nano","monolith"].includes(i)&&!n&&(e.sliders="h"),o.interaction||(o.interaction={});const{preview:r,opacity:l,hue:c,palette:d}=o;o.opacity=!s&&l,o.palette=d||r||l||c,this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),t&&t.length&&t.forEach((e=>this.addSwatch(e)));const{button:u,app:p}=this._root;this._nanopop=((e,t,o)=>{const i="object"!=typeof e||e instanceof HTMLElement?{reference:e,popper:t,...o}:e;return{update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i;const{reference:t,popper:o}=Object.assign(i,e);if(!o||!t)throw new Error("Popper- or reference-element missing.");return I(t,o,i)}}})(u,p,{margin:a}),u.setAttribute("role","button"),u.setAttribute("aria-label",this._t("btn:toggle"));const m=this;this._setupAnimationFrame=requestAnimationFrame((function t(){if(!p.offsetWidth)return m._setupAnimationFrame=requestAnimationFrame(t);m.setColor(e.default),m._rePositioningPicker(),e.defaultRepresentation&&(m._representation=e.defaultRepresentation,m.setColorRepresentation(m._representation)),e.showAlways&&m.show(),m._initializingActive=!1,m._emit("init")}))}_preBuild(){const{options:e}=this;for(const t of["el","container"])e[t]=c(e[t]);this._root=(e=>{const{components:t,useAsButton:o,inline:i,appClass:n,theme:s,lockOpacity:a}=e.options,l=e=>e?"":'style="display:none" hidden',c=t=>e._t(t),d=r(`\n <div :ref="root" class="pickr">\n\n ${o?"":'<button type="button" :ref="button" class="pcr-button"></button>'}\n\n <div :ref="app" class="pcr-app ${n||""}" data-theme="${s}" ${i?'style="position: unset"':""} aria-label="${c("ui:dialog")}" role="window">\n <div class="pcr-selection" ${l(t.palette)}>\n <div :obj="preview" class="pcr-color-preview" ${l(t.preview)}>\n <button type="button" :ref="lastColor" class="pcr-last-color" aria-label="${c("btn:last-color")}"></button>\n <div :ref="currentColor" class="pcr-current-color"></div>\n </div>\n\n <div :obj="palette" class="pcr-color-palette">\n <div :ref="picker" class="pcr-picker"></div>\n <div :ref="palette" class="pcr-palette" tabindex="0" aria-label="${c("aria:palette")}" role="listbox"></div>\n </div>\n\n <div :obj="hue" class="pcr-color-chooser" ${l(t.hue)}>\n <div :ref="picker" class="pcr-picker"></div>\n <div :ref="slider" class="pcr-hue pcr-slider" tabindex="0" aria-label="${c("aria:hue")}" role="slider"></div>\n </div>\n\n <div :obj="opacity" class="pcr-color-opacity" ${l(t.opacity)}>\n <div :ref="picker" class="pcr-picker"></div>\n <div :ref="slider" class="pcr-opacity pcr-slider" tabindex="0" aria-label="${c("aria:opacity")}" role="slider"></div>\n </div>\n </div>\n\n <div class="pcr-swatches ${t.palette?"":"pcr-last"}" :ref="swatches"></div>\n\n <div :obj="interaction" class="pcr-interaction" ${l(Object.keys(t.interaction).length)}>\n <input :ref="result" class="pcr-result" type="text" spellcheck="false" ${l(t.interaction.input)} aria-label="${c("aria:input")}">\n\n <input :arr="options" class="pcr-type" data-type="HEXA" value="${a?"HEX":"HEXA"}" type="button" ${l(t.interaction.hex)}>\n <input :arr="options" class="pcr-type" data-type="RGBA" value="${a?"RGB":"RGBA"}" type="button" ${l(t.interaction.rgba)}>\n <input :arr="options" class="pcr-type" data-type="HSLA" value="${a?"HSL":"HSLA"}" type="button" ${l(t.interaction.hsla)}>\n <input :arr="options" class="pcr-type" data-type="HSVA" value="${a?"HSV":"HSVA"}" type="button" ${l(t.interaction.hsva)}>\n <input :arr="options" class="pcr-type" data-type="CMYK" value="CMYK" type="button" ${l(t.interaction.cmyk)}>\n\n <input :ref="save" class="pcr-save" value="${c("btn:save")}" type="button" ${l(t.interaction.save)} aria-label="${c("aria:btn:save")}">\n <input :ref="cancel" class="pcr-cancel" value="${c("btn:cancel")}" type="button" ${l(t.interaction.cancel)} aria-label="${c("aria:btn:cancel")}">\n <input :ref="clear" class="pcr-clear" value="${c("btn:clear")}" type="button" ${l(t.interaction.clear)} aria-label="${c("aria:btn:clear")}">\n </div>\n </div>\n </div>\n `),u=d.interaction;return u.options.find((e=>!e.hidden&&!e.classList.add("active"))),u.type=()=>u.options.find((e=>e.classList.contains("active"))),d})(this),e.useAsButton&&(this._root.button=e.el),e.container.appendChild(this._root.root)}_finalBuild(){const e=this.options,t=this._root;if(e.container.removeChild(t.root),e.inline){const o=e.el.parentElement;e.el.nextSibling?o.insertBefore(t.app,e.el.nextSibling):o.appendChild(t.app)}else e.container.appendChild(t.app);e.useAsButton?e.inline&&e.el.remove():e.el.parentNode.replaceChild(t.root,e.el),e.disabled&&this.disable(),e.comparison||(t.button.style.transition="none",e.useAsButton||(t.preview.lastColor.style.transition="none")),this.hide()}_buildComponents(){const e=this,t=this.options.components,o=(e.options.sliders||"v").repeat(2),[i,n]=o.match(/^[vh]+$/g)?o:[],s=()=>this._color||(this._color=this._lastColor.clone()),a={palette:T({element:e._root.palette.picker,wrapper:e._root.palette.palette,onstop:()=>e._emit("changestop","slider",e),onchange(o,i){if(!t.palette)return;const n=s(),{_root:a,options:r}=e,{lastColor:l,currentColor:c}=a.preview;e._recalc&&(n.s=100*o,n.v=100-100*i,n.v<0&&(n.v=0),e._updateOutput("slider"));const d=n.toRGBA().toString(0);this.element.style.background=d,this.wrapper.style.background=`\n linear-gradient(to top, rgba(0, 0, 0, ${n.a}), transparent),\n linear-gradient(to left, hsla(${n.h}, 100%, 50%, ${n.a}), rgba(255, 255, 255, ${n.a}))\n `,r.comparison?r.useAsButton||e._lastColor||l.style.setProperty("--pcr-color",d):(a.button.style.setProperty("--pcr-color",d),a.button.classList.remove("clear"));const u=n.toHEXA().toString();for(const{el:t,color:o}of e._swatchColors)t.classList[u===o.toHEXA().toString()?"add":"remove"]("pcr-active");c.style.setProperty("--pcr-color",d)}}),hue:T({lock:"v"===n?"h":"v",element:e._root.hue.picker,wrapper:e._root.hue.slider,onstop:()=>e._emit("changestop","slider",e),onchange(o){if(!t.hue||!t.palette)return;const i=s();e._recalc&&(i.h=360*o),this.element.style.backgroundColor=`hsl(${i.h}, 100%, 50%)`,a.palette.trigger()}}),opacity:T({lock:"v"===i?"h":"v",element:e._root.opacity.picker,wrapper:e._root.opacity.slider,onstop:()=>e._emit("changestop","slider",e),onchange(o){if(!t.opacity||!t.palette)return;const i=s();e._recalc&&(i.a=Math.round(100*o)/100),this.element.style.background=`rgba(0, 0, 0, ${i.a})`,a.palette.trigger()}}),selectable:M({elements:e._root.interaction.options,className:"active",onchange(t){e._representation=t.target.getAttribute("data-type").toUpperCase(),e._recalc&&e._updateOutput("swatch")}})};this._components=a}_bindEvents(){const{_root:e,options:t}=this,o=[n(e.interaction.clear,"click",(()=>this._clearColor())),n([e.interaction.cancel,e.preview.lastColor],"click",(()=>{this.setHSVA(...(this._lastColor||this._color).toHSVA(),!0),this._emit("cancel")})),n(e.interaction.save,"click",(()=>{!this.applyColor()&&!t.showAlways&&this.hide()})),n(e.interaction.result,["keyup","input"],(e=>{this.setColor(e.target.value,!0)&&!this._initializingActive&&(this._emit("change",this._color,"input",this),this._emit("changestop","input",this)),e.stopImmediatePropagation()})),n(e.interaction.result,["focus","blur"],(e=>{this._recalc="blur"===e.type,this._recalc&&this._updateOutput(null)})),n([e.palette.palette,e.palette.picker,e.hue.slider,e.hue.picker,e.opacity.slider,e.opacity.picker],["mousedown","touchstart"],(()=>this._recalc=!0),{passive:!0})];if(!t.showAlways){const i=t.closeWithKey;o.push(n(e.button,"click",(()=>this.isOpen()?this.hide():this.show())),n(document,"keyup",(e=>this.isOpen()&&(e.key===i||e.code===i)&&this.hide())),n(document,["touchstart","mousedown"],(t=>{this.isOpen()&&!l(t).some((t=>t===e.app||t===e.button))&&this.hide()}),{capture:!0}))}if(t.adjustableNumbers){const t={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};d(e.interaction.result,((e,o,i)=>{const n=t[this.getColorRepresentation().toLowerCase()];if(n){const t=n[i],s=e+(t>=100?1e3*o:o);return s<=0?0:Number((s<t?s:t).toPrecision(3))}return e}))}if(t.autoReposition&&!t.inline){let e=null;const i=this;o.push(n(window,["scroll","resize"],(()=>{i.isOpen()&&(t.closeOnScroll&&i.hide(),null===e?(e=setTimeout((()=>e=null),100),requestAnimationFrame((function t(){i._rePositioningPicker(),null!==e&&requestAnimationFrame(t)}))):(clearTimeout(e),e=setTimeout((()=>e=null),100)))}),{capture:!0}))}this._eventBindings=o}_rePositioningPicker(){const{options:e}=this;if(!e.inline&&!this._nanopop.update({container:document.body.getBoundingClientRect(),position:e.position})){const e=this._root.app,t=e.getBoundingClientRect();e.style.top=(window.innerHeight-t.height)/2+"px",e.style.left=(window.innerWidth-t.width)/2+"px"}}_updateOutput(e){const{_root:t,_color:o,options:i}=this;if(t.interaction.type()){const e=`to${t.interaction.type().getAttribute("data-type")}`;t.interaction.result.value="function"==typeof o[e]?o[e]().toString(i.outputPrecision):""}!this._initializingActive&&this._recalc&&this._emit("change",o,e,this)}_clearColor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{_root:t,options:o}=this;o.useAsButton||t.button.style.setProperty("--pcr-color","rgba(0, 0, 0, 0.15)"),t.button.classList.add("clear"),o.showAlways||this.hide(),this._lastColor=null,this._initializingActive||e||(this._emit("save",null),this._emit("clear"))}_parseLocalColor(e){const{values:t,type:o,a:i}=k(e),{lockOpacity:n}=this.options,s=void 0!==i&&1!==i;return t&&3===t.length&&(t[3]=void 0),{values:!t||n&&s?null:t,type:o}}_t(e){return this.options.i18n[e]||D.I18N_DEFAULTS[e]}_emit(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),i=1;i<t;i++)o[i-1]=arguments[i];this._eventListener[e].forEach((e=>e(...o,this)))}on(e,t){return this._eventListener[e].push(t),this}off(e,t){const o=this._eventListener[e]||[],i=o.indexOf(t);return~i&&o.splice(i,1),this}addSwatch(e){const{values:t}=this._parseLocalColor(e);if(t){const{_swatchColors:e,_root:o}=this,i=S(...t),s=a(`<button type="button" style="--pcr-color: ${i.toRGBA().toString(0)}" aria-label="${this._t("btn:swatch")}"/>`);return o.swatches.appendChild(s),e.push({el:s,color:i}),this._eventBindings.push(n(s,"click",(()=>{this.setHSVA(...i.toHSVA(),!0),this._emit("swatchselect",i),this._emit("change",i,"swatch",this)}))),!0}return!1}removeSwatch(e){const t=this._swatchColors[e];if(t){const{el:o}=t;return this._root.swatches.removeChild(o),this._swatchColors.splice(e,1),!0}return!1}applyColor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{preview:t,button:o}=this._root,i=this._color.toRGBA().toString(0);return t.lastColor.style.setProperty("--pcr-color",i),this.options.useAsButton||o.style.setProperty("--pcr-color",i),o.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||e||this._emit("save",this._color),this}destroy(){cancelAnimationFrame(this._setupAnimationFrame),this._eventBindings.forEach((e=>s(...e))),Object.keys(this._components).forEach((e=>this._components[e].destroy()))}destroyAndRemove(){this.destroy();const{root:e,app:t}=this._root;e.parentElement&&e.parentElement.removeChild(e),t.parentElement.removeChild(t),Object.keys(this).forEach((e=>this[e]=null))}hide(){return!!this.isOpen()&&(this._root.app.classList.remove("visible"),this._emit("hide"),!0)}show(){return!this.options.disabled&&!this.isOpen()&&(this._root.app.classList.add("visible"),this._rePositioningPicker(),this._emit("show",this._color),this)}isOpen(){return this._root.app.classList.contains("visible")}setHSVA(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:360,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=this._recalc;if(this._recalc=!1,e<0||e>360||t<0||t>100||o<0||o>100||i<0||i>1)return!1;this._color=S(e,t,o,i);const{hue:a,opacity:r,palette:l}=this._components;return a.update(e/360),r.update(i),l.update(t/100,1-o/100),n||this.applyColor(),s&&this._updateOutput(),this._recalc=s,!0}setColor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===e)return this._clearColor(t),!0;const{values:o,type:i}=this._parseLocalColor(e);if(o){const e=i.toUpperCase(),{options:n}=this._root.interaction,s=n.find((t=>t.getAttribute("data-type")===e));if(s&&!s.hidden)for(const e of n)e.classList[e===s?"add":"remove"]("active");return!!this.setHSVA(...o,t)&&this.setColorRepresentation(e)}return!1}setColorRepresentation(e){return e=e.toUpperCase(),!!this._root.interaction.options.find((t=>t.getAttribute("data-type").startsWith(e)&&!t.click()))}getColorRepresentation(){return this._representation}getColor(){return this._color}getSelectedColor(){return this._lastColor}getRoot(){return this._root}disable(){return this.hide(),this.options.disabled=!0,this._root.button.classList.add("disabled"),this}enable(){return this.options.disabled=!1,this._root.button.classList.remove("disabled"),this}}return A(D,"utils",o),A(D,"version","1.8.4"),A(D,"I18N_DEFAULTS",{"ui:dialog":"color picker dialog","btn:toggle":"toggle color picker dialog","btn:swatch":"color swatch","btn:last-color":"use previous color","btn:save":"Save","btn:cancel":"Cancel","btn:clear":"Clear","aria:btn:save":"save and close","aria:btn:cancel":"cancel and close","aria:btn:clear":"clear and close","aria:input":"color input field","aria:palette":"color selection area","aria:hue":"hue selection slider","aria:opacity":"selection slider"}),A(D,"DEFAULT_OPTIONS",{appClass:null,theme:"classic",useAsButton:!1,padding:8,disabled:!1,comparison:!0,closeOnScroll:!1,outputPrecision:0,lockOpacity:!1,autoReposition:!0,container:"body",components:{interaction:{}},i18n:{},swatches:null,inline:!1,sliders:null,default:"#42445a",defaultRepresentation:null,position:"bottom-middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"}),A(D,"create",(e=>new D(e))),t.default})()})),Zt=Wt(jt),Yt=[],Gt=[];!function(e,t){if(e&&"undefined"!=typeof document){var o,i=!0===t.prepend?"prepend":"append",n=!0===t.singleTag,s="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(n){var a=Yt.indexOf(s);-1===a&&(a=Yt.push(s)-1,Gt[a]={}),o=Gt[a]&&Gt[a][i]?Gt[a][i]:Gt[a][i]=r()}else o=r();65279===e.charCodeAt(0)&&(e=e.substring(1)),o.styleSheet?o.styleSheet.cssText+=e:o.appendChild(document.createTextNode(e))}function r(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var o=Object.keys(t.attributes),n=0;n<o.length;n++)e.setAttribute(o[n],t.attributes[o[n]]);var a="prepend"===i?"afterbegin":"beforeend";return s.insertAdjacentElement(a,e),e}}('/*! Pickr 1.8.4 MIT | https://github.com/Simonwep/pickr */\n.pickr{position:relative;overflow:visible;transform:translateY(0)}.pickr *{box-sizing:border-box;outline:none;border:none;-webkit-appearance:none}.pickr .pcr-button{position:relative;height:2em;width:2em;padding:0.5em;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",Arial,sans-serif;border-radius:.15em;background:url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" stroke="%2342445A" stroke-width="5px" stroke-linecap="round"><path d="M45,45L5,5"></path><path d="M45,5L5,45"></path></svg>\') no-repeat center;background-size:0;transition:all 0.3s}.pickr .pcr-button::before{position:absolute;content:\'\';top:0;left:0;width:100%;height:100%;background:url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>\');background-size:.5em;border-radius:.15em;z-index:-1}.pickr .pcr-button::before{z-index:initial}.pickr .pcr-button::after{position:absolute;content:\'\';top:0;left:0;height:100%;width:100%;transition:background 0.3s;background:var(--pcr-color);border-radius:.15em}.pickr .pcr-button.clear{background-size:70%}.pickr .pcr-button.clear::before{opacity:0}.pickr .pcr-button.clear:focus{box-shadow:0 0 0 1px rgba(255,255,255,0.85),0 0 0 3px var(--pcr-color)}.pickr .pcr-button.disabled{cursor:not-allowed}.pickr *,.pcr-app *{box-sizing:border-box;outline:none;border:none;-webkit-appearance:none}.pickr input:focus,.pickr input.pcr-active,.pickr button:focus,.pickr button.pcr-active,.pcr-app input:focus,.pcr-app input.pcr-active,.pcr-app button:focus,.pcr-app button.pcr-active{box-shadow:0 0 0 1px rgba(255,255,255,0.85),0 0 0 3px var(--pcr-color)}.pickr .pcr-palette,.pickr .pcr-slider,.pcr-app .pcr-palette,.pcr-app .pcr-slider{transition:box-shadow 0.3s}.pickr .pcr-palette:focus,.pickr .pcr-slider:focus,.pcr-app .pcr-palette:focus,.pcr-app .pcr-slider:focus{box-shadow:0 0 0 1px rgba(255,255,255,0.85),0 0 0 3px rgba(0,0,0,0.25)}.pcr-app{position:fixed;display:flex;flex-direction:column;z-index:10000;border-radius:0.1em;background:#fff;opacity:0;visibility:hidden;transition:opacity 0.3s, visibility 0s 0.3s;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",Arial,sans-serif;box-shadow:0 0.15em 1.5em 0 rgba(0,0,0,0.1),0 0 1em 0 rgba(0,0,0,0.03);left:0;top:0}.pcr-app.visible{transition:opacity 0.3s;visibility:visible;opacity:1}.pcr-app .pcr-swatches{display:flex;flex-wrap:wrap;margin-top:0.75em}.pcr-app .pcr-swatches.pcr-last{margin:0}@supports (display: grid){.pcr-app .pcr-swatches{display:grid;align-items:center;grid-template-columns:repeat(auto-fit, 1.75em)}}.pcr-app .pcr-swatches>button{font-size:1em;position:relative;width:calc(1.75em - 5px);height:calc(1.75em - 5px);border-radius:0.15em;cursor:pointer;margin:2.5px;flex-shrink:0;justify-self:center;transition:all 0.15s;overflow:hidden;background:transparent;z-index:1}.pcr-app .pcr-swatches>button::before{position:absolute;content:\'\';top:0;left:0;width:100%;height:100%;background:url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>\');background-size:6px;border-radius:.15em;z-index:-1}.pcr-app .pcr-swatches>button::after{content:\'\';position:absolute;top:0;left:0;width:100%;height:100%;background:var(--pcr-color);border:1px solid rgba(0,0,0,0.05);border-radius:0.15em;box-sizing:border-box}.pcr-app .pcr-swatches>button:hover{filter:brightness(1.05)}.pcr-app .pcr-swatches>button:not(.pcr-active){box-shadow:none}.pcr-app .pcr-interaction{display:flex;flex-wrap:wrap;align-items:center;margin:0 -0.2em 0 -0.2em}.pcr-app .pcr-interaction>*{margin:0 0.2em}.pcr-app .pcr-interaction input{letter-spacing:0.07em;font-size:0.75em;text-align:center;cursor:pointer;color:#75797e;background:#f1f3f4;border-radius:.15em;transition:all 0.15s;padding:0.45em 0.5em;margin-top:0.75em}.pcr-app .pcr-interaction input:hover{filter:brightness(0.975)}.pcr-app .pcr-interaction input:focus{box-shadow:0 0 0 1px rgba(255,255,255,0.85),0 0 0 3px rgba(66,133,244,0.75)}.pcr-app .pcr-interaction .pcr-result{color:#75797e;text-align:left;flex:1 1 8em;min-width:8em;transition:all 0.2s;border-radius:.15em;background:#f1f3f4;cursor:text}.pcr-app .pcr-interaction .pcr-result::-moz-selection{background:#4285f4;color:#fff}.pcr-app .pcr-interaction .pcr-result::selection{background:#4285f4;color:#fff}.pcr-app .pcr-interaction .pcr-type.active{color:#fff;background:#4285f4}.pcr-app .pcr-interaction .pcr-save,.pcr-app .pcr-interaction .pcr-cancel,.pcr-app .pcr-interaction .pcr-clear{color:#fff;width:auto}.pcr-app .pcr-interaction .pcr-save,.pcr-app .pcr-interaction .pcr-cancel,.pcr-app .pcr-interaction .pcr-clear{color:#fff}.pcr-app .pcr-interaction .pcr-save:hover,.pcr-app .pcr-interaction .pcr-cancel:hover,.pcr-app .pcr-interaction .pcr-clear:hover{filter:brightness(0.925)}.pcr-app .pcr-interaction .pcr-save{background:#4285f4}.pcr-app .pcr-interaction .pcr-clear,.pcr-app .pcr-interaction .pcr-cancel{background:#f44250}.pcr-app .pcr-interaction .pcr-clear:focus,.pcr-app .pcr-interaction .pcr-cancel:focus{box-shadow:0 0 0 1px rgba(255,255,255,0.85),0 0 0 3px rgba(244,66,80,0.75)}.pcr-app .pcr-selection .pcr-picker{position:absolute;height:18px;width:18px;border:2px solid #fff;border-radius:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pcr-app .pcr-selection .pcr-color-palette,.pcr-app .pcr-selection .pcr-color-chooser,.pcr-app .pcr-selection .pcr-color-opacity{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column;cursor:grab;cursor:-webkit-grab}.pcr-app .pcr-selection .pcr-color-palette:active,.pcr-app .pcr-selection .pcr-color-chooser:active,.pcr-app .pcr-selection .pcr-color-opacity:active{cursor:grabbing;cursor:-webkit-grabbing}.pcr-app[data-theme=\'nano\']{width:14.25em;max-width:95vw}.pcr-app[data-theme=\'nano\'] .pcr-swatches{margin-top:.6em;padding:0 .6em}.pcr-app[data-theme=\'nano\'] .pcr-interaction{padding:0 .6em .6em .6em}.pcr-app[data-theme=\'nano\'] .pcr-selection{display:grid;grid-gap:.6em;grid-template-columns:1fr 4fr;grid-template-rows:5fr auto auto;align-items:center;height:10.5em;width:100%;align-self:flex-start}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-preview{grid-area:2 / 1 / 4 / 1;height:100%;width:100%;display:flex;flex-direction:row;justify-content:center;margin-left:.6em}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-preview .pcr-last-color{display:none}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-preview .pcr-current-color{position:relative;background:var(--pcr-color);width:2em;height:2em;border-radius:50em;overflow:hidden}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-preview .pcr-current-color::before{position:absolute;content:\'\';top:0;left:0;width:100%;height:100%;background:url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>\');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-palette{grid-area:1 / 1 / 2 / 3;width:100%;height:100%;z-index:1}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-palette .pcr-palette{border-radius:.15em;width:100%;height:100%}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-palette .pcr-palette::before{position:absolute;content:\'\';top:0;left:0;width:100%;height:100%;background:url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>\');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-chooser{grid-area:2 / 2 / 2 / 2}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-opacity{grid-area:3 / 2 / 3 / 2}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-chooser,.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-opacity{height:0.5em;margin:0 .6em}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-chooser .pcr-picker,.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-opacity .pcr-picker{top:50%;transform:translateY(-50%)}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-chooser .pcr-slider,.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-opacity .pcr-slider{flex-grow:1;border-radius:50em}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-chooser .pcr-slider{background:linear-gradient(to right, red, #ff0, lime, cyan, blue, #f0f, red)}.pcr-app[data-theme=\'nano\'] .pcr-selection .pcr-color-opacity .pcr-slider{background:linear-gradient(to right, transparent, black),url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>\');background-size:100%, 0.25em}\n\n',{});class Xt extends e.Modal{constructor(e,t,o){if(super(e),this.plugin=t,this.commandIndex=o,null!==o){const e=t.settings.customCommands[o];this.commandId=e.id,this.commandName=e.name,this.icon=e.icon||"",this.regexPattern=e.regexPattern||"",this.regexReplacement=e.regexReplacement||"",this.regexCaseInsensitive=e.regexCaseInsensitive||!1,this.regexGlobal=!1!==e.regexGlobal,this.regexMultiline=e.regexMultiline||!1,this.useCondition=e.useCondition||!1,this.conditionPattern=e.conditionPattern||""}else this.commandId="",this.commandName="",this.icon="",this.regexPattern="",this.regexReplacement="",this.regexCaseInsensitive=!1,this.regexGlobal=!0,this.regexMultiline=!1,this.useCondition=!1,this.conditionPattern=""}onOpen(){const{contentEl:t}=this;this.modalEl.addClass("custom-commands-modal"),t.empty(),t.createEl("h2",{text:null!==this.commandIndex?f("Edit regular expression command"):f("Add regular expression command")});const o=t.createDiv("basic-settings-container");new e.Setting(o).setName(f("Command ID")).setDesc(f('Unique identifier, no spaces, e.g.: "my-custom-format"')).addText((e=>(e.setValue(this.commandId),null!==this.commandIndex?(e.setDisabled(!0),e.inputEl.addClass("id-is-disabled")):e.onChange((e=>{this.commandId=e;const o=t.querySelector(".setting-item:nth-child(2) input");o instanceof HTMLInputElement&&(o.value=e,this.commandName=e)})),e))),new e.Setting(o).setName(f("Command Name")).setDesc(f("Displayed name in toolbar and menu")).addText((e=>e.setValue(this.commandName).onChange((e=>this.commandName=e))));const i=t.createDiv("regex-settings");i.style.border="1px solid var(--background-modifier-border)",i.style.padding="10px",i.style.borderRadius="5px",i.style.marginBottom="10px";const n=i.createEl("details",{cls:"ai-help-container"});n.style.marginBottom="10px",n.style.borderRadius="5px",n.style.overflow="hidden";const s=n.createEl("summary",{text:f("How to use AI to get regular expressions?")});s.style.padding="8px 12px",s.style.backgroundColor="var(--background-secondary)",s.style.cursor="pointer",s.style.fontWeight="bold",s.style.borderRadius="4px",s.style.userSelect="none";const a=n.createDiv("ai-help-content");a.style.padding="6px",a.style.backgroundColor="var(--background-secondary-alt)",a.style.borderBottomLeftRadius="5px",a.style.borderBottomRightRadius="5px",a.style.marginTop="1px",a.setAttribute("contenteditable","false"),a.style.userSelect="text",a.innerHTML=`\n <p><strong>${f("AI question template:")}</strong><br>\n ${f("[Description]")}:\n ${f("I need to convert the url to a markdown format link")}\n <br>\n ${f("[Example]")}: \n ${f("For example, convert https://example.com to [https://example.com](https://example.com)")}\n <br>\n ${f("[Requirements]")}: \n ${f("Use js regular expression to implement, and output the parameters in the following format (the result does not need to be escaped with json)")}\n <br>\n ${f("[Output]")}:\n <br>\n "name": "[Descriptive Name]", <br>\n "pattern": "[Regex Pattern]", <br>\n "replacement": "[Replacement Pattern, if applicable]", <br>\n "flags": "[Regex Flags]" <br>\n </p>\n `,new e.Setting(i).setName(f("Matching pattern")).setDesc(f("Regex pattern to match")).addText((e=>this.regexPatternInput=e.setValue(this.regexPattern).onChange((e=>{this.regexPattern=e,this.updatePreview()})))),new e.Setting(i).setName(f("Replacement pattern")).setDesc(f("Replacement pattern (use $1, $2, etc. to reference capture groups)")).addText((e=>this.regexReplacementInput=e.setValue(this.regexReplacement).onChange((e=>{this.regexReplacement=e,this.updatePreview()}))));const r=i.createDiv("regex-options");r.style.display="flex",r.style.gap="8px",new e.Setting(r).setName(f("Ignore case")).setDesc(f("Match case-insensitive")).addToggle((e=>e.setValue(this.regexCaseInsensitive).onChange((e=>{this.regexCaseInsensitive=e,this.updatePreview()})))),new e.Setting(r).setName(f("Global replace")).setDesc(f("Replace all matches")).addToggle((e=>e.setValue(this.regexGlobal).onChange((e=>{this.regexGlobal=e,this.updatePreview()})))),new e.Setting(r).setName(f("Multiline mode")).setDesc(f("^ and $ match the start and end of each line")).addToggle((e=>this.regexMultilineToggle=e.setValue(this.regexMultiline).onChange((e=>{this.regexMultiline=e,this.updatePreview()}))));const l=i.createDiv("condition-container");new e.Setting(l).setName(f("Use condition")).setDesc(f("Only apply custom command when text matches the condition")).addToggle((e=>this.useConditionToggle=e.setValue(this.useCondition).onChange((e=>{this.useCondition=e,c.style.display=e?"block":"none"}))));const c=l.createDiv("condition-settings");c.style.display=this.useCondition?"block":"none",c.style.border="1px solid var(--background-modifier-border)",c.style.padding="10px",c.style.borderRadius="5px",c.style.marginBottom="15px",new e.Setting(c).setName(f("Condition pattern")).setDesc(f("Must exist regular expression or text")).addText((e=>this.conditionPatternInput=e.setValue(this.conditionPattern).onChange((e=>{this.conditionPattern=e}))));const d=new e.Setting(i).setName(f("Icon")).setDesc(f("Command icon (click to select)"));if(this.iconDisplay=d.controlEl.createDiv("editingToolbarSettingsIcon"),this.icon)try{e.setIcon(this.iconDisplay,this.icon)}catch(e){this.iconDisplay.setText(this.icon)}d.addButton((t=>t.setButtonText(f("Choose icon")).onClick((()=>{const t={id:this.commandId,name:this.commandName,icon:this.icon};new b(this.plugin,t,!1,(t=>{if(this.icon=t,this.iconDisplay.empty(),this.icon)try{e.setIcon(this.iconDisplay,this.icon)}catch(e){this.iconDisplay.setText(this.icon)}const o=d.controlEl.querySelector("input");o&&(o.value=this.icon)})).open()})))),i.createSpan("regex-help");const u=i.createEl("details",{cls:"regex-examples-container"});u.style.marginTop="15px",u.style.borderRadius="5px",u.style.overflow="hidden";const p=u.createEl("summary",{text:f("Regular expression examples")});p.style.padding="8px 12px",p.style.backgroundColor="var(--background-secondary)",p.style.cursor="pointer",p.style.fontWeight="bold",p.style.borderRadius="4px",p.style.userSelect="none";const m=u.createDiv("examples-content");m.style.padding="10px",m.style.backgroundColor="var(--background-secondary-alt)",m.style.borderBottomLeftRadius="5px",m.style.borderBottomRightRadius="5px",m.style.marginTop="1px";const h=m.createEl("ul");h.style.paddingLeft="20px",h.style.margin="0";[{name:f("URL to Markdown link"),pattern:"(https?://\\S+)",replacement:"[$1]($1)"},{name:f("Convert MM/DD/YYYY to YYYY-MM-DD"),pattern:"(\\d{1,2})/(\\d{1,2})/(\\d{4})",replacement:"$3-$1-$2"},{name:f("Add bold to keywords"),pattern:"\\b(important|critical|urgent)\\b",replacement:"**$1**"},{name:f("Format phone number"),pattern:"(\\d{3})(\\d{3})(\\d{4})",replacement:"($1) $2-$3"},{name:f("Remove extra spaces"),pattern:"\\s{2,}",replacement:" "},{name:f("Convert HTML bold tags to Markdown format"),pattern:"<strong>(.*?)</strong>",replacement:"**$1**"},{name:f("Convert quoted text to quote block"),pattern:'"([^"]+)"',replacement:"> $1"},{name:f("Add uniform alias to Markdown links"),pattern:"\\[([^\\]]+)\\]\\(([^\\)]+)\\)",replacement:"[$1|alias]($2)"},{name:f("Delete empty lines (multiline mode)"),pattern:"^\\s*$\\n",replacement:"",toggleMultiline:!0},{name:f("Add list symbol to each line (multiline mode)"),pattern:"^(.+)$",replacement:"- $1",toggleMultiline:!0},{name:f("If the text contains important, set the text highlight (conditional format)"),pattern:"(.+)",replacement:"==$1==",useCondition:!0,conditionPattern:"important"}].forEach((e=>{const t=h.createEl("li");t.style.marginBottom="8px";const o=t.createEl("a",{text:e.name,href:"#"});o.style.color="var(--text-accent)",o.style.textDecoration="none",o.addEventListener("mouseenter",(()=>{o.style.textDecoration="underline"})),o.addEventListener("mouseleave",(()=>{o.style.textDecoration="none"})),o.addEventListener("click",(t=>{t.preventDefault(),this.regexPattern=e.pattern,this.regexReplacement=e.replacement,this.regexPatternInput.setValue(e.pattern),this.regexReplacementInput.setValue(e.replacement),e.useCondition?(this.useCondition=!0,this.conditionPattern=e.conditionPattern||"",this.useConditionToggle.setValue(!0),this.conditionPatternInput.setValue(this.conditionPattern),c.style.display="block"):(this.useCondition=!1,this.useConditionToggle.setValue(!1),this.conditionPatternInput.setValue(""),c.style.display="none"),e.toggleMultiline?this.regexMultilineToggle.setValue(!0):this.regexMultilineToggle.setValue(!1),this.updatePreview(),u.removeAttribute("open")}))}));const g=t.createDiv("preview-container");g.style.marginTop="20px",g.style.marginBottom="20px",g.style.border="1px solid var(--background-modifier-border)",g.style.padding="10px",g.style.borderRadius="5px",g.createEl("label",{text:f("Preview")});const v=g.createDiv("preview-input-container");v.style.marginBottom="10px";const y=v.createEl("label",{text:f("Example text:")});y.style.display="block",y.style.marginBottom="5px",this.previewInput=v.createEl("textarea",{attr:{placeholder:f("Input example text to view the formatting effect of the command...")}}),this.previewInput.style.height="auto",this.previewInput.style.width="100%",this.previewInput.style.padding="8px",this.previewInput.style.borderRadius="4px",this.previewInput.style.border="1px solid var(--background-modifier-border)",this.previewInput.value="Sample text https://example.com important text 1234567890",this.previewInput.addEventListener("input",(()=>{this.updatePreview()}));const C=g.createDiv("preview-output-container"),w=C.createEl("label",{text:f("Result:")});w.style.display="block",w.style.marginBottom="5px",this.previewOutput=C.createDiv("preview-output"),this.previewOutput.style.padding="8px",this.previewOutput.style.borderRadius="4px",this.previewOutput.style.border="1px solid var(--background-modifier-border)",this.previewOutput.style.backgroundColor="var(--background-secondary)",this.previewOutput.style.minHeight="3em",this.updatePreview(),new e.Setting(t).addButton((t=>t.setButtonText("保存").setCta().onClick((()=>{if(!this.commandId||!this.commandName)return void new e.Notice(f("Command ID and command name cannot be empty"));if(this.commandId.includes(" "))return void new e.Notice(f("Command ID cannot contain spaces"));if(!this.regexPattern)return void new e.Notice(f("Regex pattern cannot be empty"));const t=null===this.commandIndex?`custom-${this.commandId}`:this.commandId;if(null===this.commandIndex){if(this.plugin.settings.customCommands.findIndex((e=>e.id===t))>=0)return void new e.Notice(f("Command")+" "+this.commandId+" "+f("already exists"),8e3)}const o={id:t,name:this.commandName,icon:this.icon,useRegex:!0,regexPattern:this.regexPattern,regexReplacement:this.regexReplacement,regexCaseInsensitive:this.regexCaseInsensitive,regexGlobal:this.regexGlobal,regexMultiline:this.regexMultiline,useCondition:this.useCondition,conditionPattern:this.conditionPattern,prefix:"",suffix:"",char:0,line:0,islinehead:!1};null!==this.commandIndex?this.plugin.settings.customCommands[this.commandIndex]=o:this.plugin.settings.customCommands.push(o),this.plugin.saveSettings().then((()=>{this.close(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand")),this.plugin.reloadCustomCommands()}),100)}))})))).addButton((e=>e.setButtonText(f("Cancel")).onClick((()=>this.close()))))}onClose(){const{contentEl:e}=this;e.empty()}updatePreview(){var e;const t=this.previewInput.value;let o=t;try{if(this.regexPattern){let e="";this.regexGlobal&&(e+="g"),this.regexCaseInsensitive&&(e+="i"),this.regexMultiline&&(e+="m");const i=new RegExp(this.regexPattern,e);o=t.replace(i,this.regexReplacement||""),this.showCompleteRegexCode(e)}this.previewOutput.empty(),o.split("\n").forEach(((e,t,o)=>{this.previewOutput.createSpan({text:e}),t<o.length-1&&this.previewOutput.createEl("br")})),this.previewOutput.style.color="var(--text-normal)"}catch(t){this.previewOutput.setText(f("Error: ")+t.message),this.previewOutput.style.color="var(--text-error)";const o=null===(e=this.previewOutput.parentElement)||void 0===e?void 0:e.querySelector(".regex-code-container");o&&o.remove()}}showCompleteRegexCode(e){const t=this.previewOutput.parentElement;if(!t)return;let o=t.querySelector(".regex-code-container");if(o){o.empty();const e=o.createEl("div",{text:f("Complete regular expression code (copy to AI for explanation)")});e.style.marginBottom="5px",e.style.fontWeight="bold"}else{o=t.createDiv("regex-code-container"),o.style.marginTop="15px",o.style.borderTop="1px solid var(--background-modifier-border)",o.style.paddingTop="10px";const e=o.createEl("div",{text:f("Complete regular expression code (copy to AI for explanation)")});e.style.marginBottom="5px",e.style.fontWeight="bold"}const i=o.createEl("pre");i.style.backgroundColor="var(--background-code)",i.style.padding="8px",i.style.borderRadius="4px",i.style.overflowX="auto",i.style.fontFamily="monospace",i.style.fontSize="var(--font-smaller)";let n=`//${f("Explain the syntax of JavaScript regular expressions")}\n`;n+=`const regex = /${this.escapeRegexForDisplay(this.regexPattern)}/${e};\n`,n+=`const result = text.replace(regex, "${this.escapeStringForDisplay(this.regexReplacement)}");\n`,this.useCondition&&this.conditionPattern&&(n+=`\n//${f("Conditional matching")}\n`,n+=`const condition = /${this.escapeRegexForDisplay(this.conditionPattern)}/;\n`,n+="if (condition.test(text)) {\n",n+=` //${f("Apply regular expression replacement")}\n`,n+=` const result = text.replace(regex, "${this.escapeStringForDisplay(this.regexReplacement)}");\n`,n+="}"),i.textContent=n;const s=o.createEl("button",{text:f("Copy code")});s.style.marginTop="5px",s.style.padding="4px 8px",s.style.borderRadius="4px",s.style.cursor="pointer",s.addEventListener("click",(()=>{navigator.clipboard.writeText(n).then((()=>{s.textContent=f("Copied!"),setTimeout((()=>{s.textContent=f("Copy code")}),2e3)}))}))}escapeRegexForDisplay(e){return e.replace(/\\/g,"\\\\")}escapeStringForDisplay(e){return e.replace(/"/g,'\\"')}}class Jt extends e.Modal{constructor(e,t,o){if(super(e),this.plugin=t,this.commandIndex=o,null!==o){const e=t.settings.customCommands[o];this.commandId=e.id,this.commandName=e.name,this.prefix=e.prefix,this.suffix=e.suffix,this.char=e.char,this.line=e.line,this.islinehead=e.islinehead,this.icon=e.icon||""}else this.commandId="",this.commandName="",this.prefix="",this.suffix="",this.char=0,this.line=0,this.islinehead=!1,this.icon=""}onOpen(){const{contentEl:t}=this;this.modalEl.addClass("custom-commands-modal"),t.empty(),t.createEl("h2",{text:null!==this.commandIndex?f("Edit Custom Command"):f("Add Custom Command")});const o=t.createDiv("switch-to-regex-container");o.style.marginBottom="20px",o.style.textAlign="center";const i=o.createEl("button",{text:"切换到正则表达式命令"});i.addClass("mod-cta"),i.addEventListener("click",(()=>{this.close(),new Xt(this.app,this.plugin,null).open()})),new e.Setting(t).setName(f("Command ID")).setDesc(f('Unique identifier, no spaces, e.g.: "my-custom-format"')).addText((e=>(this.commandIdInput=e,e.setValue(this.commandId),null!==this.commandIndex?(e.setDisabled(!0),e.inputEl.addClass("id-is-disabled")):e.onChange((e=>{this.commandId=e,this.commandNameInput&&(this.commandNameInput.setValue(e),this.commandName=e)})),e))),new e.Setting(t).setName(f("Command Name")).setDesc(f("Displayed name in toolbar and menu")).addText((e=>this.commandNameInput=e.setValue(this.commandName).onChange((e=>this.commandName=e)))),new e.Setting(t).setName(f("Prefix")).setDesc(f("Add content before selected text")).addText((e=>e.setValue(this.prefix).onChange((e=>{this.prefix=e;const o=this.getMirrorText(e);if(o){this.suffix=o;const e=t.querySelector(".setting-item:nth-child(5) input");e instanceof HTMLInputElement&&(e.value=o,this.suffix=o)}})))),new e.Setting(t).setName(f("Suffix")).setDesc(f("Add content after selected text")).addText((e=>e.setValue(this.suffix).onChange((e=>this.suffix=e)))),new e.Setting(t).setName(f("Cursor Position Offset")).setDesc(f("Default 0, format will keep the text selected")).addText((e=>e.setValue(this.char.toString()).onChange((e=>this.char=parseInt(e)||0)))),new e.Setting(t).setName(f("Line Offset")).setDesc(f("Line offset of cursor after formatting")).addText((e=>e.setValue(this.line.toString()).onChange((e=>this.line=parseInt(e)||0)))),new e.Setting(t).setName(f("Line Head Format")).setDesc(f("Whether to insert at the beginning of the next line")).addToggle((e=>e.setValue(this.islinehead).onChange((e=>this.islinehead=e))));const n=new e.Setting(t).setName(f("Icon")).setDesc(f("Command icon (click to select)"));if(this.iconDisplay=n.controlEl.createDiv("editingToolbarSettingsIcon"),this.icon)try{e.setIcon(this.iconDisplay,this.icon)}catch(e){this.iconDisplay.setText(this.icon)}n.addButton((t=>t.setButtonText(f("Choose Icon")).onClick((()=>{const t={id:this.commandId,name:this.commandName,icon:this.icon};new b(this.plugin,t,!1,(t=>{if(this.icon=t,this.iconDisplay.empty(),this.icon)try{e.setIcon(this.iconDisplay,this.icon)}catch(e){this.iconDisplay.setText(this.icon)}const o=n.controlEl.querySelector("input");o&&(o.value=this.icon)})).open()})))),new e.Setting(t).addButton((t=>t.setButtonText(f("Save")).setCta().onClick((()=>{if(!this.commandId||!this.commandName)return void new e.Notice(f("Command ID and command name cannot be empty"));if(this.commandId.includes(" "))return void new e.Notice(f("Command ID cannot contain spaces"));const t=null===this.commandIndex?`custom-${this.commandId}`:this.commandId;if(null===this.commandIndex){if(this.plugin.settings.customCommands.findIndex((e=>e.id===t))>=0)return void new e.Notice(f("The command")+this.commandId+f("already exists"),8e3)}const o={id:t,name:this.commandName,prefix:this.prefix,suffix:this.suffix,char:this.char,line:this.line,islinehead:this.islinehead,icon:this.icon};if(null!==this.commandIndex){if(this.plugin.settings.customCommands[this.commandIndex].icon!==this.icon){const e=`editing-toolbar:${t}`;this.updateCommandIcon(this.plugin.settings.menuCommands,e),this.plugin.settings.enableMultipleConfig&&(this.updateCommandIcon(this.plugin.settings.followingCommands,e),this.updateCommandIcon(this.plugin.settings.topCommands,e),this.updateCommandIcon(this.plugin.settings.fixedCommands,e),this.plugin.settings.isLoadOnMobile&&this.updateCommandIcon(this.plugin.settings.mobileCommands,e))}this.plugin.settings.customCommands[this.commandIndex]=o}else this.plugin.settings.customCommands.push(o);this.plugin.saveSettings().then((()=>{this.close(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand")),this.plugin.reloadCustomCommands()}),100)}))})))).addButton((e=>e.setButtonText(f("Cancel")).onClick((()=>this.close())))),setTimeout((()=>{this.commandIndex?this.commandIdInput.inputEl.focus():this.commandNameInput.inputEl.focus()}),10)}updateCommandIcon(e,t){e&&e.forEach((e=>{e.id===t&&(e.icon=this.icon),e.SubmenuCommands&&this.updateCommandIcon(e.SubmenuCommands,t)}))}onClose(){const{contentEl:e}=this;e.empty()}getMirrorText(e){const t={"**":"**","*":"*",__:"__",_:"_","~~":"~~","`":"`","```":"```",$:"$",$$:"$$","(":")","[":"]","{":"}","<":">","==":"==","*==":"==*","**==":"==**","***==":"==***"};if(!e)return"";if(e in t)return t[e];const o=e.match(/^<(\w+)([^>]*)>$/);return o?`</${o[1]}>`:""}}class Kt extends e.Modal{constructor(e,t,o){super(e),this.deployOptions=[],this.plugin=t,this.command=o,this.deployOptions=[{id:"following",name:f("Following Style"),enabled:!0},{id:"top",name:f("Top Style"),enabled:!0},{id:"fixed",name:f("Fixed Style"),enabled:!0}],this.plugin.settings.isLoadOnMobile&&this.deployOptions.push({id:"mobile",name:f("Mobile Style"),enabled:!0})}onOpen(){const{contentEl:t}=this;t.empty(),t.createEl("h3",{text:f("Deploy command to configurations")}),t.createDiv("deploy-option");const o=t.createDiv("deploy-options");this.deployOptions.forEach((t=>{new e.Setting(o).setName(t.name).addToggle((e=>e.setValue(t.enabled).onChange((e=>{t.enabled=e})))).settingEl.addClass("deploy-option")}));const i=t.createDiv("deploy-buttons");new e.Setting(i).addButton((e=>e.setButtonText(f("Deploy")).setCta().onClick((()=>{this.deployCommand(),this.close()})))).addButton((e=>e.setButtonText(f("Cancel")).onClick((()=>{this.close()}))))}deployCommand(){const t={id:`editing-toolbar:${this.command.id}`,name:this.command.name,icon:this.command.icon||"obsidian-new"};this.plugin.settings.menuCommands.some((e=>e.id===t.id))||this.plugin.settings.menuCommands.push(Object.assign({},t));let o=0;this.deployOptions.forEach((e=>{if(e.enabled){let i;switch(e.id){case"mobile":i=this.plugin.settings.mobileCommands;break;case"following":i=this.plugin.settings.followingCommands;break;case"top":i=this.plugin.settings.topCommands;break;case"fixed":i=this.plugin.settings.fixedCommands}i&&!i.some((e=>e.id===t.id))&&(i.push(Object.assign({},t)),o++)}})),this.plugin.saveSettings().then((()=>{let t="";if(o>0){const e=this.deployOptions.filter((e=>e.enabled)).map((e=>e.name)).join(", ");t=f("Command deployed to: ")+e}else t=f("Command already exists in selected configurations");new e.Notice(t),dispatchEvent(new Event("editingToolbar-NewCommand")),this.plugin.reloadCustomCommands()}))}}class Qt extends e.Modal{constructor(e,t,o){super(e),this.plugin=t,this.mode=o,this.exportType="all",this.importMode="update"}onOpen(){const{contentEl:t}=this;if(t.addClass("editing-toolbar-import-export-modal"),t.createEl("h2",{text:"import"===this.mode?f("Import Configuration"):f("Export Configuration"),cls:"import-export-title"}),"export"===this.mode){new e.Setting(t).setName(f("Export Type")).setDesc(f("Choose what to export")).addDropdown((e=>{e.addOption("all",f("All Settings")).addOption("All commands",f("All Toolbar Commands")).addOption("custom",f("Custom Commands Only")),this.plugin.settings.enableMultipleConfig&&e.addOption("following",f("Following Style Only")).addOption("top",f("Top Style Only")).addOption("fixed",f("Fixed Style Only")).addOption("mobile",f("Mobile Style Only")),e.setValue(this.exportType).onChange((e=>{this.exportType=e,this.updateExportContent()}))}));const o=t.createDiv("export-container");o.style.border="1px solid var(--background-modifier-border)",o.style.padding="10px",o.style.borderRadius="5px",this.textArea=new e.TextAreaComponent(o),this.textArea.setValue("").setPlaceholder(f("Loading...")).then((e=>{e.inputEl.style.width="100%",e.inputEl.style.height="200px",e.inputEl.style.fontFamily="monospace",e.inputEl.style.fontSize="12px",e.inputEl.style.padding="8px",e.inputEl.style.border="1px solid var(--background-modifier-border)",e.inputEl.style.borderRadius="4px"})),this.updateExportContent();const i=t.createDiv("import-export-button-container");i.style.display="flex",i.style.justifyContent="flex-end",i.style.marginTop="16px";i.createEl("button",{text:f("Copy to Clipboard"),cls:"mod-cta"}).addEventListener("click",(()=>{navigator.clipboard.writeText(this.textArea.getValue()).then((()=>{new e.Notice(f("Configuration copied to clipboard"))})).catch((t=>{console.error("Failed to copy: ",t),new e.Notice(f("Failed to copy configuration"))}))}))}else{new e.Setting(t).setName(f("Import Mode")).setDesc(f("Choose how to import the configuration")).addDropdown((e=>{e.addOption("update",f("Update Mode (Add new items and update existing ones)")).addOption("overwrite",f("Overwrite Mode (Replace settings with imported ones)")).setValue(this.importMode).onChange((e=>{this.importMode=e,this.importButton.setButtonText("overwrite"===this.importMode?f("Overwrite Import"):f("Update Import")),this.warningContent.setText("overwrite"===this.importMode?f("Warning: Overwrite mode will replace existing settings with imported ones."):f("Warning: Update mode will add new items and update existing ones."))}))}));const o=t.createDiv("import-container");o.style.border="1px solid var(--background-modifier-border)",o.style.padding="10px",o.style.borderRadius="5px",this.textArea=new e.TextAreaComponent(o),this.textArea.setValue("").setPlaceholder(f("Paste configuration here...")).then((e=>{e.inputEl.style.width="100%",e.inputEl.style.height="200px",e.inputEl.style.fontFamily="monospace",e.inputEl.style.fontSize="12px",e.inputEl.style.padding="8px",e.inputEl.style.border="1px solid var(--background-modifier-border)",e.inputEl.style.borderRadius="4px"}));const i=t.createDiv("import-export-button-container");i.style.display="flex",i.style.justifyContent="flex-end",i.style.marginTop="16px",new e.Setting(i).addButton((e=>{this.importButton=e.setIcon("import").setButtonText(f("Import Configuration")).onClick((()=>{this.importConfiguration()}))}));const n=t.createDiv("import-export-warning");n.style.marginTop="16px",n.style.padding="8px 12px",n.style.backgroundColor="rgba(var(--color-red-rgb), 0.1)",n.style.borderRadius="4px",n.style.border="1px solid rgba(var(--color-red-rgb), 0.3)";const s=n.createEl("p",{text:f("Warning: Update mode will add new items and update existing ones."),cls:"warning-text"});s.style.margin="0",this.warningContent=s}}updateExportContent(){let e={_exportInfo:{version:this.plugin.manifest.version,exportType:this.exportType,exportTime:(new Date).toISOString(),pluginId:this.plugin.manifest.id}};switch(this.exportType){case"all":e=Object.assign(Object.assign({},e),{menuCommands:this.plugin.settings.menuCommands||[],followingCommands:this.plugin.settings.followingCommands||[],topCommands:this.plugin.settings.topCommands||[],fixedCommands:this.plugin.settings.fixedCommands||[],mobileCommands:this.plugin.settings.mobileCommands||[],customCommands:this.plugin.settings.customCommands||[],enableMultipleConfig:this.plugin.settings.enableMultipleConfig,positionStyle:this.plugin.settings.positionStyle,aestheticStyle:this.plugin.settings.aestheticStyle,appendMethod:this.plugin.settings.appendMethod,autohide:this.plugin.settings.autohide,isLoadOnMobile:this.plugin.settings.isLoadOnMobile,cMenuNumRows:this.plugin.settings.cMenuNumRows,custom_bg1:this.plugin.settings.custom_bg1,custom_bg2:this.plugin.settings.custom_bg2,custom_bg3:this.plugin.settings.custom_bg3,custom_bg4:this.plugin.settings.custom_bg4,custom_bg5:this.plugin.settings.custom_bg5,custom_fc1:this.plugin.settings.custom_fc1,custom_fc2:this.plugin.settings.custom_fc2,custom_fc3:this.plugin.settings.custom_fc3,custom_fc4:this.plugin.settings.custom_fc4,custom_fc5:this.plugin.settings.custom_fc5});break;case"All commands":e=Object.assign(Object.assign({},e),{menuCommands:this.plugin.settings.menuCommands||[],followingCommands:this.plugin.settings.followingCommands||[],topCommands:this.plugin.settings.topCommands||[],fixedCommands:this.plugin.settings.fixedCommands||[],mobileCommands:this.plugin.settings.mobileCommands||[],enableMultipleConfig:this.plugin.settings.enableMultipleConfig});break;case"custom":e=Object.assign(Object.assign({},e),{customCommands:this.plugin.settings.customCommands||[]});break;case"following":e=Object.assign(Object.assign({},e),{followingCommands:this.plugin.settings.followingCommands||[]});break;case"top":e=Object.assign(Object.assign({},e),{topCommands:this.plugin.settings.topCommands||[]});break;case"fixed":e=Object.assign(Object.assign({},e),{fixedCommands:this.plugin.settings.fixedCommands||[]});break;case"mobile":e=Object.assign(Object.assign({},e),{mobileCommands:this.plugin.settings.mobileCommands||[]})}this.validateExportContent(e),this.textArea.setValue(JSON.stringify(e,null,2))}validateExportContent(e){["menuCommands","followingCommands","topCommands","fixedCommands","mobileCommands","customCommands"].forEach((t=>{t in e&&!e[t]&&(e[t]=[])})),"enableMultipleConfig"in e&&void 0===e.enableMultipleConfig&&(e.enableMultipleConfig=!1),"autohide"in e&&void 0===e.autohide&&(e.autohide=!1),"isLoadOnMobile"in e&&void 0===e.isLoadOnMobile&&(e.isLoadOnMobile=!0),"positionStyle"in e&&!e.positionStyle&&(e.positionStyle="top"),"aestheticStyle"in e&&!e.aestheticStyle&&(e.aestheticStyle="default"),"appendMethod"in e&&!e.appendMethod&&(e.appendMethod="workspace"),"cMenuNumRows"in e&&void 0===e.cMenuNumRows&&(e.cMenuNumRows=1)}importConfiguration(){return t(this,void 0,void 0,(function*(){try{const t=this.textArea.getValue();if(!t.trim())return void new e.Notice(f("Please paste configuration data first"));const o=JSON.parse(t);if(!o||"object"!=typeof o)return void new e.Notice(f("Invalid import data format"));const i="menuCommands"in o,n="customCommands"in o,s="followingCommands"in o,a="topCommands"in o,r="fixedCommands"in o,l="mobileCommands"in o,c="positionStyle"in o||"aestheticStyle"in o,d="enableMultipleConfig"in o,u=o.positionStyle,p=i&&Array.isArray(o.menuCommands)&&o.menuCommands.length>0,m=n&&Array.isArray(o.customCommands)&&o.customCommands.length>0,h=s&&Array.isArray(o.followingCommands)&&o.followingCommands.length>0,g=a&&Array.isArray(o.topCommands)&&o.topCommands.length>0,b=r&&Array.isArray(o.fixedCommands)&&o.fixedCommands.length>0,v=l&&Array.isArray(o.mobileCommands)&&o.mobileCommands.length>0,y=i&&(!Array.isArray(o.menuCommands)||0===o.menuCommands.length),C=n&&(!Array.isArray(o.customCommands)||0===o.customCommands.length),w=s&&(!Array.isArray(o.followingCommands)||0===o.followingCommands.length),x=a&&(!Array.isArray(o.topCommands)||0===o.topCommands.length),k=r&&(!Array.isArray(o.fixedCommands)||0===o.fixedCommands.length),S=l&&(!Array.isArray(o.mobileCommands)||0===o.mobileCommands.length);let E=f("This import will:")+"\n";if(c&&(E+="• "+f("Update general settings")+"\n"),p&&(E+="• "+f("Update Main Menu Commands")+" ("+o.menuCommands.length+" )\n"),m&&(E+="• "+f("Update Custom Commands")+" ("+o.customCommands.length+" )\n"),h&&(E+="• "+f("Update Following Style Commands")+" ("+o.followingCommands.length+" )\n"),g&&(E+="• "+f("Update Top Style Commands")+" ("+o.topCommands.length+" )\n"),b&&(E+="• "+f("Update Fixed Style Commands")+" ("+o.fixedCommands.length+" )\n"),v&&(E+="• "+f("Update Mobile Style Commands")+" ("+o.mobileCommands.length+" )\n"),"overwrite"===this.importMode&&(y&&(E+="• "+f("Clear all Main Menu Commands")+" ⚠️\n"),C&&(E+="• "+f("Clear all Custom Commands")+" ⚠️\n"),w&&(E+="• "+f("Clear all Following Style Commands")+" ⚠️\n"),x&&(E+="• "+f("Clear all Top Style Commands")+" ⚠️\n"),k&&(E+="• "+f("Clear all Fixed Style Commands")+" ⚠️\n"),S&&(E+="• "+f("Clear all Mobile Style Commands")+" ⚠️\n")),d){const e=o.enableMultipleConfig?f("Enable"):f("Disable");E+="• "+f("Set Multiple Config to:")+" "+e+"\n"}if(u&&(E+="• "+f("Set Position Style to:")+" "+this.getPositionStyleName(u)+"\n"),!(p||m||h||g||b||v||y||C||w||x||k||S||c||d))return void new e.Notice(f("No valid configuration found in import data"));if("overwrite"===this.importMode?E+="\n"+f("⚠️ Overwrite mode will replace existing settings with imported ones."):E+="\n"+f(" Update mode will merge imported settings with existing ones."),!confirm(E+"\n"+f("Do you want to continue?")))return;const T={positionStyle:this.plugin.settings.positionStyle,menuCommands:[...this.plugin.settings.menuCommands],customCommands:[...this.plugin.settings.customCommands],followingCommands:[...this.plugin.settings.followingCommands],topCommands:[...this.plugin.settings.topCommands],fixedCommands:[...this.plugin.settings.fixedCommands],mobileCommands:[...this.plugin.settings.mobileCommands]};try{"overwrite"===this.importMode?this.performOverwriteImport(o):this.performUpdateImport(o),this.fixImportedCommandIds(),yield this.plugin.saveSettings(),this.plugin.reloadCustomCommands(),dispatchEvent(new Event("editingToolbar-NewCommand")),new e.Notice(f("Configuration imported successfully")),this.close()}catch(e){throw this.restoreBackup(T),e}}catch(t){console.error("Import error:",t),new e.Notice(f("Error:")+" "+t.message)}}))}performOverwriteImport(e){this.importGeneralSettings(e),e.menuCommands&&(this.plugin.settings.menuCommands=e.menuCommands),e.customCommands&&(this.plugin.settings.customCommands=e.customCommands),e.followingCommands&&(this.plugin.settings.followingCommands=e.followingCommands),e.topCommands&&(this.plugin.settings.topCommands=e.topCommands),e.fixedCommands&&(this.plugin.settings.fixedCommands=e.fixedCommands),e.mobileCommands&&(this.plugin.settings.mobileCommands=e.mobileCommands)}performUpdateImport(e){this.importGeneralSettings(e),e.menuCommands&&this.updateCommandArray(this.plugin.settings.menuCommands,e.menuCommands),e.customCommands&&this.updateCommandArray(this.plugin.settings.customCommands,e.customCommands),e.followingCommands&&this.updateCommandArray(this.plugin.settings.followingCommands,e.followingCommands),e.topCommands&&this.updateCommandArray(this.plugin.settings.topCommands,e.topCommands),e.fixedCommands&&this.updateCommandArray(this.plugin.settings.fixedCommands,e.fixedCommands),e.mobileCommands&&this.updateCommandArray(this.plugin.settings.mobileCommands,e.mobileCommands)}updateCommandArray(e,t){return e?(t.forEach((t=>{var o;const i=e.findIndex((e=>e.id===t.id));i>=0?e[i]=t:e.push(t),t.SubmenuCommands&&(null===(o=e[i])||void 0===o?void 0:o.SubmenuCommands)&&this.updateCommandArray(e[i].SubmenuCommands,t.SubmenuCommands)})),e):t.slice()}importGeneralSettings(e){["positionStyle","aestheticStyle","appendMethod","autohide","isLoadOnMobile","cMenuNumRows","enableMultipleConfig","custom_bg1","custom_bg2","custom_bg3","custom_bg4","custom_bg5","custom_fc1","custom_fc2","custom_fc3","custom_fc4","custom_fc5"].forEach((t=>{void 0!==e[t]&&(this.plugin.settings[t]=e[t])}))}fixImportedCommandIds(){const e={"editor:toggle-numbered-list":"editing-toolbar:toggle-numbered-list","editor:toggle-bullet-list":"editing-toolbar:toggle-bullet-list","editor:toggle-highlight":"editing-toolbar:toggle-highlight","toggle-highlight":"editing-toolbar:toggle-highlight","editing-toolbar:editor:toggle-bold":"editing-toolbar:toggle-bold","editing-toolbar:editor:toggle-italics":"editing-toolbar:toggle-italics","editing-toolbar:editor:toggle-strikethrough":"editing-toolbar:toggle-strikethrough","editing-toolbar:editor:toggle-inline-math":"editing-toolbar:toggle-inline-math","editing-toolbar:editor:insert-callout":"editing-toolbar:insert-callout","editing-toolbar:editor:insert-link":"editing-toolbar:insert-link","cMenuToolbar-Divider-Line":"editingToolbar-Divider-Line"},t=o=>{o&&Array.isArray(o)&&o.forEach((o=>{o.id&&e[o.id]&&(o.id=e[o.id]),o.SubmenuCommands&&Array.isArray(o.SubmenuCommands)&&t(o.SubmenuCommands)}))};t(this.plugin.settings.menuCommands),t(this.plugin.settings.customCommands),t(this.plugin.settings.followingCommands),t(this.plugin.settings.topCommands),t(this.plugin.settings.fixedCommands),t(this.plugin.settings.mobileCommands)}restoreBackup(e){this.plugin.settings.positionStyle=e.positionStyle,this.plugin.settings.menuCommands=e.menuCommands,this.plugin.settings.customCommands=e.customCommands,this.plugin.settings.followingCommands=e.followingCommands,this.plugin.settings.topCommands=e.topCommands,this.plugin.settings.fixedCommands=e.fixedCommands,this.plugin.settings.mobileCommands=e.mobileCommands}onClose(){const{contentEl:e}=this;e.empty()}getPositionStyleName(e){switch(e){case"following":return f("Following Style");case"top":return f("Top Style");case"fixed":return f("Fixed Style");default:return e}}}const eo=[{id:"general",name:f("General"),icon:"gear"},{id:"appearance",name:f("Appearance"),icon:"brush"},{id:"customcommands",name:f("Custom Commands"),icon:"lucide-rectangle-ellipsis"},{id:"commands",name:f("Toolbar Commands"),icon:"lucide-command"},{id:"importexport",name:f("Import/Export"),icon:"lucide-import"}];function to(e){const{el:t,containerEl:o,swatches:i,opacity:n,defaultColor:s}=e;return{el:t,container:o,theme:"nano",swatches:i,lockOpacity:!n,default:s,position:"left-middle",components:{preview:!0,hue:!0,opacity:!!n,interaction:{hex:!0,rgba:!1,hsla:!1,input:!0,cancel:!0,save:!0}}}}function oo(e,t){let o;return t.forEach(((t,i)=>{t.id===e&&(o=i)})),o}class io extends e.PluginSettingTab{constructor(e,t){super(e,t),this.pickrs=[],this.activeTab="general",this.plugin=t,this.currentEditingConfig=this.plugin.settings.positionStyle,addEventListener("editingToolbar-NewCommand",(()=>{I(),V(e,this.plugin),this.display()}))}display(){this.destroyPickrs();const{containerEl:t}=this;t.empty(),this.createHeader(t);const o=t.createEl("div",{cls:"editing-toolbar-tabs"});eo.forEach((t=>{const i=o.createEl("div",{cls:"editing-toolbar-tab "+(this.activeTab===t.id?"active":"")});e.setIcon(i,t.icon),i.createEl("span",{text:t.name}),i.addEventListener("click",(()=>{this.activeTab=t.id,this.display()}))}));const i=t.createEl("div",{cls:"editing-toolbar-content"});switch(this.activeTab){case"general":this.displayGeneralSettings(i);break;case"appearance":this.displayAppearanceSettings(i);break;case"customcommands":this.displayCustomCommandSettings(i);break;case"commands":this.displayCommandSettings(i);break;case"importexport":this.displayImportExportSettings(i)}}createDeleteButton(e,o,i=f("Delete")){let n,s=!1;e.setIcon("editingToolbarDelete").setTooltip(i).onClick((()=>t(this,void 0,void 0,(function*(){s?(clearTimeout(n),e.setIcon("editingToolbarDelete").setTooltip(i),e.buttonEl.removeClass("mod-warning"),s=!1,yield o()):(s=!0,e.setTooltip(f("Confirm delete?")).setButtonText(f("Confirm delete?")),e.buttonEl.addClass("mod-warning"),n=setTimeout((()=>{e.setIcon("editingToolbarDelete").setTooltip(i),e.buttonEl.removeClass("mod-warning"),s=!1}),3500))}))))}onPositionStyleChange(t){if(this.plugin.settings.enableMultipleConfig)switch(t){case"following":this.plugin.settings.followingCommands&&0!==this.plugin.settings.followingCommands.length||(this.plugin.settings.followingCommands=[...this.plugin.settings.menuCommands],this.plugin.saveSettings(),new e.Notice(f("Following style commands successfully initialized")));break;case"top":this.plugin.settings.topCommands&&0!==this.plugin.settings.topCommands.length||(this.plugin.settings.topCommands=[...this.plugin.settings.menuCommands],this.plugin.saveSettings(),new e.Notice(f("Top style commands successfully initialized")));break;case"fixed":this.plugin.settings.fixedCommands&&0!==this.plugin.settings.fixedCommands.length||(this.plugin.settings.fixedCommands=[...this.plugin.settings.menuCommands],this.plugin.saveSettings(),new e.Notice(f("Fixed style commands successfully initialized")));break;case"mobile":this.plugin.settings.mobileCommands&&0!==this.plugin.settings.mobileCommands.length||(this.plugin.settings.mobileCommands=[...this.plugin.settings.menuCommands],this.plugin.saveSettings(),new e.Notice(f("Mobile style commands successfully initialized")))}dispatchEvent(new Event("editingToolbar-NewCommand"))}displayGeneralSettings(o){new e.Setting(o).setName(f("Editing Toolbar append method")).setDesc(f("Choose where Editing Toolbar will append upon regeneration.")).addDropdown((e=>{let t={};x.map((e=>t[e]=e)),e.addOptions(t),e.setValue(this.plugin.settings.appendMethod).onChange((e=>{this.plugin.settings.appendMethod=e,this.plugin.saveSettings()}))})),new e.Setting(o).setName(f("Enable multiple configurations")).setDesc(f("Enable different command configurations for each position style (following, top, fixed)")).addToggle((e=>e.setValue(this.plugin.settings.enableMultipleConfig||!1).onChange((e=>t(this,void 0,void 0,(function*(){this.plugin.settings.enableMultipleConfig=e,this.onPositionStyleChange(this.plugin.settings.positionStyle),yield this.plugin.saveSettings(),this.display()})))))),new e.Setting(o).setName(f("Mobile enabled or not")).setDesc(f("Whether to enable on mobile devices with device width less than 768px")).addToggle((e=>{var t,o;return e.setValue(null!==(o=null===(t=this.plugin.settings)||void 0===t?void 0:t.isLoadOnMobile)&&void 0!==o&&o).onChange((e=>{this.plugin.settings.isLoadOnMobile=e,this.plugin.saveSettings(),this.triggerRefresh()}))}))}displayAppearanceSettings(o){new e.Setting(o).setName(f("Editing Toolbar aesthetic")).setDesc(f("Choose between a glass morphism, tiny and default style")).addDropdown((e=>{let t={};k.map((e=>t[e]=e)),e.addOptions(t).setValue(this.plugin.settings.aestheticStyle).onChange((e=>{this.plugin.settings.aestheticStyle=e,this.plugin.saveSettings(),this.triggerRefresh()}))})),new e.Setting(o).setName(f("Editing Toolbar position")).setDesc(f("Choose between fixed position or cursor following mode")).addDropdown((e=>{let o={};S.map((e=>o[e]=e)),e.addOptions(o).setValue(this.plugin.settings.positionStyle).onChange((e=>t(this,void 0,void 0,(function*(){this.plugin.settings.positionStyle=e,yield this.plugin.saveSettings(),this.onPositionStyleChange(e),this.display()}))))})),"top"==this.plugin.settings.positionStyle&&new e.Setting(o).setName(f("Editing Toolbar Auto-hide")).setDesc(f("The toolbar is displayed when the mouse moves over it, otherwise it is automatically hidden")).addToggle((e=>{var t;return e.setValue(null===(t=this.plugin.settings)||void 0===t?void 0:t.autohide).onChange((e=>{this.plugin.settings.autohide=e,this.plugin.saveSettings(),this.triggerRefresh()}))})),"fixed"==this.plugin.settings.positionStyle&&new e.Setting(o).setName(f("Editing Toolbar columns")).setDesc(f("Choose the number of columns per row to display on Editing Toolbar.")).addSlider((o=>{o.setLimits(1,32,1).setValue(this.plugin.settings.cMenuNumRows).onChange(e.debounce((e=>t(this,void 0,void 0,(function*(){this.plugin.settings.cMenuNumRows=e,yield this.plugin.saveSettings()}))),100,!0)).setDynamicTooltip()})),this.createColorSettings(o)}displayCommandSettings(o){if(this.plugin.settings.enableMultipleConfig&&new e.Setting(o).setName(f("Current Configuration")).setDesc(f("Switch between different command configurations")).addDropdown((e=>{e.addOption("top",f("Top Style")),e.addOption("fixed",f("Fixed Style")),e.addOption("following",f("Following Style")),this.plugin.settings.isLoadOnMobile&&e.addOption("mobile",f("Mobile Style")),e.setValue(this.currentEditingConfig),e.onChange((e=>t(this,void 0,void 0,(function*(){this.currentEditingConfig=e,this.display()}))))})),this.plugin.settings.enableMultipleConfig){const i=this.currentEditingConfig;this.getCommandsArrayByType(i);const n=o.createDiv("command-buttons-container");n.style.display="flex",n.style.flexDirection="column",n.style.gap="10px",n.style.marginBottom="1rem";const s=new e.Setting(n).setName(f("Import From")).setDesc(f("Copy commands from another style configuration"));let a="Main menu";const r=new e.Setting(n);r.addDropdown((e=>{e.addOption("Main menu","Main Menu Commands"),"following"!==i&&this.plugin.settings.followingCommands&&e.addOption("following",f("Following Style")),"top"!==i&&this.plugin.settings.topCommands&&e.addOption("top",f("Top Style")),"fixed"!==i&&this.plugin.settings.fixedCommands&&e.addOption("fixed",f("Fixed Style")),"mobile"!==i&&this.plugin.settings.mobileCommands&&e.addOption("mobile",f("Mobile Style")),e.setValue(a).onChange((e=>{a=e}))})),r.addExtraButton((e=>e.setIcon("arrow-right"))),r.addButton((o=>o.setButtonText(this.currentEditingConfig.replace(this.currentEditingConfig[0],this.currentEditingConfig[0].toUpperCase())+" "+f("Import")).setTooltip("Copy commands from selected style").onClick((()=>t(this,void 0,void 0,(function*(){const t=this.getCommandsArrayByType(a);if(!t||0===t.length)return void new e.Notice("The selected style has no commands to import");const o=`Import commands from "${a}" to "${this.currentEditingConfig}" `+f("configuration")+"?";if(confirm(o)){switch(i){case"Main menu":this.plugin.settings.menuCommands=[...t];break;case"following":this.plugin.settings.followingCommands=[...t];break;case"top":this.plugin.settings.topCommands=[...t];break;case"fixed":this.plugin.settings.fixedCommands=[...t];break;case"mobile":this.plugin.settings.mobileCommands=[...t]}yield this.plugin.saveSettings(),new e.Notice(`Commands imported successfully from "${a}" to "${this.currentEditingConfig}" `+f("configuration")),this.display()}})))))),s.addButton((o=>o.setButtonText(f("Clear")+" "+`${this.currentEditingConfig}`).setTooltip(f("Remove all commands from this configuration")).setWarning().onClick((()=>t(this,void 0,void 0,(function*(){if(confirm(f("Are you sure you want to clear all commands under the current style?"))){switch(i){case"following":this.plugin.settings.followingCommands=[];break;case"top":this.plugin.settings.topCommands=[];break;case"fixed":this.plugin.settings.fixedCommands=[];break;case"mobile":this.plugin.settings.mobileCommands=[]}yield this.plugin.saveSettings(),new e.Notice("All commands have been removed"),this.display()}}))))))}else{const i=o.createDiv("command-buttons-container");i.style.display="flex",i.style.flexDirection="column",i.style.gap="10px",i.style.marginBottom="1rem";new e.Setting(i).addButton((o=>o.setButtonText(f("One-click clear")).setTooltip(f("Remove all commands from this configuration")).setWarning().onClick((()=>t(this,void 0,void 0,(function*(){confirm(f("Are you sure you want to clear all commands under the current style?"))&&(this.plugin.settings.menuCommands=[],yield this.plugin.saveSettings(),new e.Notice("All commands have been removed"),this.display())}))))))}this.plugin.settings.enableMultipleConfig&&o.createEl("div",{cls:`position-style-info ${this.currentEditingConfig}`,text:f("Currently editing commands for")+` "${this.currentEditingConfig} Style" `+f("configuration")}),new e.Setting(o).setName(f("Editing Toolbar commands")).setDesc(f("Add a command onto Editing Toolbar from Obsidian's commands library. To reorder the commands, drag and drop the command items. To delete them, use the delete buttom to the right of the command item. Editing Toolbar will not automaticaly refresh after reordering commands. Use the refresh button above.")).addButton((e=>{e.setIcon("plus").setTooltip(f("Add")).onClick((()=>{new y(this.plugin,this.currentEditingConfig).open(),this.triggerRefresh()}))})),this.createCommandList(o)}displayCustomCommandSettings(o){o.empty();const i=o.createDiv("custom-commands-container");i.createEl("p",{text:f("Add, edit or delete custom format commands")});const n=i.createDiv("command-list-container"),s=i.createDiv("add-command-button-container");s.style.marginBottom="20px",s.style.marginTop="20px",s.style.display="flex",s.style.gap="10px";const a=s.createEl("button",{text:f("Add Format Command")});a.addClass("mod-cta"),a.addEventListener("click",(()=>{new Jt(this.app,this.plugin,null).open()}));const r=s.createEl("button",{text:f("Add Regex Command")});r.addClass("mod-cta"),r.addEventListener("click",(()=>{new Xt(this.app,this.plugin,null).open()})),this.plugin.settings.customCommands.forEach(((o,i)=>{const s=new e.Setting(n).setName(o.name),a=createFragment();let r=`${f("ID")}: ${o.id}`;o.useRegex?r+=`, ${f("Pattern")}: ${o.regexPattern}`:r+=`, ${f("Prefix")}: ${o.prefix}, ${f("Suffix")}: ${o.suffix}`,a.createSpan({text:r});const l=a.createSpan({cls:"command-type-badge"});if(o.useRegex?(l.addClass("regex"),l.setText(f("Regex"))):l.setText(f("Prefix/Suffix")),s.descEl.appendChild(a),s.addButton((t=>t.setButtonText(f("Add to Toolbar")).setTooltip(f("Add this command to the toolbar")).setButtonText(f("Add to Toolbar")).setTooltip(f("Add this command to the toolbar")).onClick((()=>{if(this.plugin.settings.enableMultipleConfig)new Kt(this.app,this.plugin,o).open();else{if(this.plugin.settings.menuCommands.some((e=>e.id===`editing-toolbar:${o.id}`)))return void new e.Notice(f("This command is already in the toolbar"));const t={id:`editing-toolbar:${o.id}`,name:o.name,icon:o.icon||"obsidian-new"};this.plugin.settings.menuCommands.push(t),this.plugin.saveSettings().then((()=>{new e.Notice(f("Command added to toolbar")),dispatchEvent(new Event("editingToolbar-NewCommand")),this.plugin.reloadCustomCommands()}))}})))).addExtraButton((e=>{e.setIcon("pencil").setTooltip(f("Edit")).onClick((()=>{o.useRegex?new Xt(this.app,this.plugin,i).open():new Jt(this.app,this.plugin,i).open()}))})).addButton((o=>this.createDeleteButton(o,(()=>t(this,void 0,void 0,(function*(){const t=`editing-toolbar:${this.plugin.settings.customCommands[i].id}`;this.removeCommandFromConfig(this.plugin.settings.menuCommands,t),this.plugin.settings.enableMultipleConfig&&(this.removeCommandFromConfig(this.plugin.settings.followingCommands,t),this.removeCommandFromConfig(this.plugin.settings.topCommands,t),this.removeCommandFromConfig(this.plugin.settings.fixedCommands,t),this.plugin.settings.isLoadOnMobile&&this.removeCommandFromConfig(this.plugin.settings.mobileCommands,t)),this.plugin.settings.customCommands.splice(i,1),yield this.plugin.saveSettings(),this.plugin.reloadCustomCommands(),this.display(),new e.Notice(f("Command deleted"))})))))),o.icon)try{const t=s.nameEl.createSpan({cls:"editingToolbarSettingsIcon"});t.style.marginRight="8px",O(o.icon)?t.innerHTML=o.icon:e.setIcon(t,o.icon)}catch(e){console.error("Failed to set icon:",e)}}))}triggerRefresh(){setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100)}createHeader(t){const o=t.createEl("div",{cls:"editing-toolbar-header"});o.createEl("div",{cls:"editing-toolbar-title-container"}).createEl("h1",{text:"Obsidian Editing Toolbar:"+this.plugin.manifest.version,cls:"editing-toolbar-title"});const i=o.createEl("div",{cls:"editing-toolbar-info"});i.createEl("span",{text:"作者:"}).createEl("a",{text:"Cuman ✨",href:"https://github.com/cumany"}),i.createEl("span",{text:" 教程:"}).createEl("a",{text:"pkmer.cn",href:"https://pkmer.cn/show/20230329145815"}),new e.Setting(i).setClass("editing-toolbar-fix-button").addButton((e=>{e.setIcon("wrench").setTooltip(f("Fix")).onClick((()=>{new Ut(this.app,this.plugin).open()}))}))}createColorSettings(t){new e.Setting(t).setName(f("🎨 Set custom background")).setDesc(f("Click on the picker to adjust the colour")).setClass("custom_bg").then((e=>{const t=e.controlEl.createDiv({cls:"pickr-container"});for(let e=0;e<5;e++){const o=t.createDiv({cls:"picker"}),i=Zt.create(to({isView:!1,el:o,containerEl:t,swatches:["#FFB78B8C","#CDF4698C","#A0CCF68C","#F0A7D88C","#ADEFEF8C"],opacity:!0,defaultColor:this.plugin.settings[`custom_bg${e+1}`]||"#000000"}));this.setupPickrEvents(i,`custom_bg${e+1}`),this.pickrs.push(i)}})),new e.Setting(t).setName(f("🖌️ Set custom font color")).setDesc(f("Click on the picker to adjust the colour")).setClass("custom_font").then((e=>{const t=e.controlEl.createDiv({cls:"pickr-container"});for(let e=0;e<5;e++){const o=t.createDiv({cls:"picker"}),i=Zt.create(to({isView:!1,el:o,containerEl:t,swatches:["#D83931","#DE7802","#245BDB","#6425D0","#646A73"],opacity:!0,defaultColor:this.plugin.settings[`custom_fc${e+1}`]||"#000000"}));this.setupPickrEvents(i,`custom_fc${e+1}`),this.pickrs.push(i)}}))}createCommandList(o){let n=[];if(this.plugin.settings.enableMultipleConfig)switch(this.currentEditingConfig){case"mobile":n=this.plugin.settings.mobileCommands;break;case"following":n=this.plugin.settings.followingCommands;break;case"top":n=this.plugin.settings.topCommands;break;case"fixed":n=this.plugin.settings.fixedCommands;break;default:n=this.plugin.settings.menuCommands}else n=this.plugin.settings.menuCommands;const s=o.createEl("div",{cls:"editingToolbarSettingsTabsContainer"});let a="";kt.create(s,{group:"item",animation:500,draggable:".setting-item",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",dragoverBubble:!1,forceFallback:!0,fallbackOnBody:!0,swapThreshold:.7,fallbackClass:"sortable-fallback",easing:"cubic-bezier(1, 0, 0, 1)",delay:800,delayOnTouchOnly:!0,touchStartThreshold:5,onChoose:function(e){e.item.classList.add("sortable-chosen-feedback")},onUnchoose:function(e){e.item.classList.remove("sortable-chosen-feedback")},onSort:e=>{if(e.from.className===e.to.className){const t=n,[o]=t.splice(e.oldIndex,1);if(t.splice(e.newIndex,0,o),this.plugin.settings.enableMultipleConfig)switch(this.currentEditingConfig){case"mobile":this.plugin.settings.mobileCommands=t;break;case"following":this.plugin.settings.followingCommands=t;break;case"top":this.plugin.settings.topCommands=t;break;case"fixed":this.plugin.settings.fixedCommands=t}else this.plugin.settings.menuCommands=t;this.plugin.saveSettings()}this.triggerRefresh()},onStart:function(e){a=e.item.className}});const r=n;r.forEach(((o,l)=>{const c=new e.Setting(s);if("SubmenuCommands"in o){if(c.settingEl.setAttribute("data-id",o.id),c.setClass("editingToolbarCommandItem").setClass("editingToolbarCommandsubItem").setName(o.name).addButton((e=>{e.setClass("editingToolbarSettingsIcon").onClick((()=>t(this,void 0,void 0,(function*(){new b(this.plugin,o,!1,null,this.currentEditingConfig).open()})))),O(o.icon)?e.buttonEl.innerHTML=o.icon:e.setIcon(o.icon)})).addButton((e=>this.createDeleteButton(e,(()=>t(this,void 0,void 0,(function*(){r.remove(o),this.plugin.updateCurrentCommands(r),yield this.plugin.saveSettings(),this.display(),this.triggerRefresh(),console.log(`%cCommand '${o.name}' was removed from editingToolbar`,"color: #989cab")})))))),"editingToolbar-plugin:change-font-color"==o.id)return;if("editingToolbar-plugin:change-background-color"==o.id)return;const i=c.settingEl.createEl("div",{cls:"editingToolbarSettingsTabsContainer_sub"});kt.create(i,{group:{name:"item",pull:!0,put:function(){return!a.includes("editingToolbarCommandsubItem")}},draggable:".setting-item",animation:150,ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",dragoverBubble:!1,fallbackOnBody:!0,swapThreshold:.7,forceFallback:!0,delay:800,delayOnTouchOnly:!0,touchStartThreshold:5,fallbackClass:"sortable-fallback",easing:"cubic-bezier(1, 0, 0, 1)",onStart:function(){},onSort:e=>{var t,o,i;if(e.from.className===e.to.className){const o=n,i=null===(t=o[l])||void 0===t?void 0:t.SubmenuCommands;if(i){const[t]=i.splice(e.oldIndex,1);i.splice(e.newIndex,0,t),this.plugin.updateCurrentCommands(o),this.plugin.saveSettings()}}else if("editingToolbarSettingsTabsContainer"===e.to.className){const t=n;const i=null===(o=t[oo(e.target.parentElement.dataset.id,t)])||void 0===o?void 0:o.SubmenuCommands;if(i){const[o]=i.splice(e.oldIndex,1);t.splice(e.newIndex,0,o),this.plugin.updateCurrentCommands(t),this.plugin.saveSettings()}else console.error("Subresult is undefined.")}else if("editingToolbarSettingsTabsContainer"===e.from.className){const t=n,o=null===(i=t[oo(e.target.parentElement.dataset.id,t)])||void 0===i?void 0:i.SubmenuCommands;if(o){const[i]=t.splice(e.oldIndex,1);o.splice(e.newIndex,0,i),this.plugin.updateCurrentCommands(t),this.plugin.saveSettings()}else console.error("Subresult is undefined.")}this.triggerRefresh()}}),o.SubmenuCommands.forEach((n=>{const s=new e.Setting(i);s.setClass("editingToolbarCommandItem").addButton((e=>{e.setClass("editingToolbarSettingsIcon").onClick((()=>t(this,void 0,void 0,(function*(){new b(this.plugin,n,!0,null,this.currentEditingConfig).open()})))),O(null==n?void 0:n.icon)?e.buttonEl.innerHTML=n.icon:e.setIcon(n.icon)})).setName(n.name).addButton((e=>{e.setIcon("pencil").setTooltip(f("Change Command name")).setClass("editingToolbarSettingsButton").onClick((()=>t(this,void 0,void 0,(function*(){new C(this.app,this.plugin,n,!0,this.currentEditingConfig).open()}))))})).addButton((e=>this.createDeleteButton(e,(()=>t(this,void 0,void 0,(function*(){o.SubmenuCommands.remove(n),yield this.plugin.saveSettings(),this.display(),this.triggerRefresh(),console.log(`%cCommand '${o.name}' was removed from editingToolbar`,"color: #989cab")})))))),s.nameEl}))}else c.addButton((e=>{e.setClass("editingToolbarSettingsIcon").onClick((()=>t(this,void 0,void 0,(function*(){new b(this.plugin,o,!1,null,this.currentEditingConfig).open()})))),O(o.icon)?e.buttonEl.innerHTML=o.icon:e.setIcon(o.icon)})),"editingToolbar-Divider-Line"==o.id&&c.setClass("editingToolbar-Divider-Line"),c.setClass("editingToolbarCommandItem").setName(o.name).addButton((e=>{e.setIcon("pencil").setTooltip(f("Change Command name")).setClass("editingToolbarSettingsButton").onClick((()=>t(this,void 0,void 0,(function*(){new C(this.app,this.plugin,o,!1,this.currentEditingConfig).open()}))))})).addButton((e=>{e.setIcon("editingToolbarSub").setTooltip(f("Add submenu")).setClass("editingToolbarSettingsButton").setClass("editingToolbarSettingsButtonaddsub").onClick((()=>t(this,void 0,void 0,(function*(){const e={id:"SubmenuCommands-"+i(1),name:"submenu",icon:"remix-Filter3Line",SubmenuCommands:[]},t=n;t.splice(l+1,0,e),this.plugin.updateCurrentCommands(t),yield this.plugin.saveSettings(),this.display(),this.triggerRefresh(),console.log(`%cCommand '${e.id}' add `,"color: #989cab")}))))})).addButton((e=>{e.setIcon("vertical-split").setTooltip(f("add hr")).setClass("editingToolbarSettingsButton").setClass("editingToolbarSettingsButtonaddsub").onClick((()=>t(this,void 0,void 0,(function*(){const e=n;e.splice(l+1,0,{id:"editingToolbar-Divider-Line",name:"HR",icon:"vertical-split"}),this.plugin.updateCurrentCommands(e),yield this.plugin.saveSettings(),this.display(),this.triggerRefresh()}))))})).addButton((e=>this.createDeleteButton(e,(()=>t(this,void 0,void 0,(function*(){r.remove(o),this.plugin.updateCurrentCommands(r),yield this.plugin.saveSettings(),this.display(),this.triggerRefresh(),console.log(`%cCommand '${o.name}' was removed from editingToolbar`,"color: #989cab")}))))))}))}setupPickrEvents(e,o){e.on("save",((e,i)=>t(this,void 0,void 0,(function*(){e&&(this.plugin.settings[o]=e.toHEXA().toString(),yield this.plugin.saveSettings(),i.hide(),i.addSwatch(e.toHEXA().toString()))})))).on("show",(()=>{const{result:t}=e.getRoot().interaction;requestAnimationFrame((()=>t.select()))})).on("cancel",(e=>{e.hide()}))}destroyPickrs(){this.pickrs.forEach((e=>{e&&e.destroyAndRemove()})),this.pickrs=[]}hide(){this.destroyPickrs(),this.triggerRefresh()}removeCommandFromConfig(e,t){if(e)for(let o=e.length-1;o>=0;o--)e[o].id!==t?e[o].SubmenuCommands&&this.removeCommandFromConfig(e[o].SubmenuCommands,t):e.splice(o,1)}displayImportExportSettings(t){const o=t.createDiv("import-export-container");o.style.padding="16px",o.style.borderRadius="8px",o.style.backgroundColor="var(--background-secondary)",o.style.marginBottom="20px",new e.Setting(o).setName(f("Export Configuration")).setDesc(f("Export your toolbar configuration to share with others")).addButton((e=>e.setButtonText(f("Export")).setCta().onClick((()=>{new Qt(this.app,this.plugin,"export").open()})))),new e.Setting(o).setName(f("Import Configuration")).setDesc(f("Import toolbar configuration from JSON")).addButton((e=>e.setButtonText(f("Import")).setCta().onClick((()=>{new Qt(this.app,this.plugin,"import").open()}))));const i=t.createDiv("import-export-info");i.style.marginTop="20px",i.style.padding="16px",i.style.borderRadius="8px",i.style.backgroundColor="var(--background-secondary)",i.createEl("h3",{text:f("Usage Instructions"),cls:"import-export-heading"}).style.marginTop="0";const n=i.createEl("ul");n.style.paddingLeft="20px",n.createEl("li",{text:f("Export: Generate a JSON configuration that you can save or share")}),n.createEl("li",{text:f("Import: Paste a previously exported JSON configuration")}),n.createEl("li",{text:f("You can choose to export all settings, only toolbar commands, or only custom commands")}),n.createEl("li",{text:f("When importing, the plugin will only update the settings included in the import data")});const s=t.createDiv("import-export-warning");s.style.marginTop="20px",s.style.padding="16px",s.style.borderRadius="8px",s.style.backgroundColor="rgba(var(--color-red-rgb), 0.1)",s.style.border="1px solid rgba(var(--color-red-rgb), 0.3)",s.createEl("p",{text:f("Warning: Importing configuration will overwrite your current settings. Consider exporting your current configuration first as a backup."),cls:"warning-text"}).style.margin="0"}getCommandsArrayByType(e){switch(e){case"following":return this.plugin.settings.followingCommands;case"top":return this.plugin.settings.topCommands;case"fixed":return this.plugin.settings.fixedCommands;case"mobile":return this.plugin.settings.mobileCommands;default:return this.plugin.settings.menuCommands}}}const no={editingToolbar:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="0" stroke-linecap="round" stroke-linejoin="round"><path d="M19 10H5c-1.103 0-2 .897-2 2v8c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-8c0-1.103-.897-2-2-2zM5 20v-8h14l.002 8H5zM5 6h14v2H5zm2-4h10v2H7z" fill="currentColor"/></svg>',editingToolbarSub:'<svg t="1661526346488" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16880" ><path d="M597.333333 85.333333h-341.333333C187.733333 85.333333 128 140.8 128 213.333333v597.333334c0 72.533333 59.733333 128 128 128h426.666667c72.533333 0 128-55.466667 128-128V298.666667l-213.333334-213.333334z m170.666667 725.333334c0 46.933333-38.4 85.333333-85.333333 85.333333H256c-46.933333 0-85.333333-38.4-85.333333-85.333333V213.333333c0-46.933333 38.4-85.333333 85.333333-85.333333h298.666667v213.333333h213.333333v469.333334z m-320-234.666667h128c12.8 0 21.333333 8.533333 21.333333 21.333333s-8.533333 21.333333-21.333333 21.333334h-128v128c0 12.8-8.533333 21.333333-21.333333 21.333333s-21.333333-8.533333-21.333334-21.333333v-128h-128c-12.8 0-21.333333-8.533333-21.333333-21.333334s8.533333-21.333333 21.333333-21.333333h128v-128c0-12.8 8.533333-21.333333 21.333334-21.333333s21.333333 8.533333 21.333333 21.333333v128z" fill="#8a8a8a" p-id="16881"></path></svg>',editingToolbarAdd:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke="white" stroke-width="0" stroke-linecap="round" stroke-linejoin="round"><path d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z" fill="currentColor"/><path d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10s10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8s8 3.589 8 8s-3.589 8-8 8z" fill="currentColor"/></svg>',editingToolbarDelete:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke="white" stroke-width="0" stroke-linecap="round" stroke-linejoin="round"><path d="M5 20a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8h2V6h-4V4a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v2H3v2h2zM9 4h6v2H9zM8 8h9v12H7V8z" fill="var(--text-error)"/><path d="M9 10h2v8H9zm4 0h2v8h-2z" fill="var(--text-error)"/></svg>',editingToolbarReload:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke="white" stroke-width="0" stroke-linecap="round" stroke-linejoin="round"><path d="M19 10H5c-1.103 0-2 .897-2 2v8c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-8c0-1.103-.897-2-2-2zM5 20v-8h14l.002 8H5zM5 6h14v2H5zm2-4h10v2H7z" fill="currentColor"/></svg>',"codeblock-glyph":'<svg xmlns="http://www.w3.org/2000/svg" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"><path fill="currentColor" d="M20 3H4c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h16c1.103 0 2-.897 2-2V5c0-1.103-.897-2-2-2zM4 19V7h16l.002 12H4z" fill="currentColor"/><path d="M9.293 9.293L5.586 13l3.707 3.707l1.414-1.414L8.414 13l2.293-2.293zm5.414 0l-1.414 1.414L15.586 13l-2.293 2.293l1.414 1.414L18.414 13z"/></svg>',"underline-glyph":'<svg xmlns="http://www.w3.org/2000/svg" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 1024 1024"><path fill="currentColor" d="M824 804H200c-4.4 0-8 3.4-8 7.6v60.8c0 4.2 3.6 7.6 8 7.6h624c4.4 0 8-3.4 8-7.6v-60.8c0-4.2-3.6-7.6-8-7.6zm-312-76c69.4 0 134.6-27.1 183.8-76.2C745 602.7 772 537.4 772 468V156c0-6.6-5.4-12-12-12h-60c-6.6 0-12 5.4-12 12v312c0 97-79 176-176 176s-176-79-176-176V156c0-6.6-5.4-12-12-12h-60c-6.6 0-12 5.4-12 12v312c0 69.4 27.1 134.6 76.2 183.8C377.3 701 442.6 728 512 728z"/></svg>',"superscript-glyph":'<svg xmlns="http://www.w3.org/2000/svg" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"><path fill="currentColor"d="M16 7.41L11.41 12L16 16.59L14.59 18L10 13.41L5.41 18L4 16.59L8.59 12L4 7.41L5.41 6L10 10.59L14.59 6L16 7.41M21.85 9h-4.88V8l.89-.82c.76-.64 1.32-1.18 1.7-1.63c.37-.44.56-.85.57-1.23a.884.884 0 0 0-.27-.7c-.18-.19-.47-.28-.86-.29c-.31.01-.58.07-.84.17l-.66.39l-.45-1.17c.27-.22.59-.39.98-.53S18.85 2 19.32 2c.78 0 1.38.2 1.78.61c.4.39.62.93.62 1.57c-.01.56-.19 1.08-.54 1.55c-.34.48-.76.93-1.27 1.36l-.64.52v.02h2.58V9z"/></svg>',"subscript-glyph":'<svg xmlns="http://www.w3.org/2000/svg" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"><path fill="currentColor" d="M16 7.41L11.41 12L16 16.59L14.59 18L10 13.41L5.41 18L4 16.59L8.59 12L4 7.41L5.41 6L10 10.59L14.59 6L16 7.41m5.85 13.62h-4.88v-1l.89-.8c.76-.65 1.32-1.19 1.7-1.63c.37-.44.56-.85.57-1.24a.898.898 0 0 0-.27-.7c-.18-.16-.47-.28-.86-.28c-.31 0-.58.06-.84.18l-.66.38l-.45-1.17c.27-.21.59-.39.98-.53s.82-.24 1.29-.24c.78.04 1.38.25 1.78.66c.4.41.62.93.62 1.57c-.01.56-.19 1.08-.54 1.55c-.34.47-.76.92-1.27 1.36l-.64.52v.02h2.58v1.35z"/></svg>',"bot-glyph":'<svg xmlns="http://www.w3.org/2000/svg" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"><path fill="currentColor" d="M21.928 11.607c-.202-.488-.635-.605-.928-.633V8c0-1.103-.897-2-2-2h-6V4.61c.305-.274.5-.668.5-1.11a1.5 1.5 0 0 0-3 0c0 .442.195.836.5 1.11V6H5c-1.103 0-2 .897-2 2v2.997l-.082.006A1 1 0 0 0 1.99 12v2a1 1 0 0 0 1 1H3v5c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-5a1 1 0 0 0 1-1v-1.938a1.006 1.006 0 0 0-.072-.455zM5 20V8h14l.001 3.996L19 12v2l.001.005l.001 5.995H5z" fill="currentColor"/><ellipse cx="8.5" cy="12" rx="1.5" ry="2" fill="currentColor"/><ellipse cx="15.5" cy="12" rx="1.5" ry="2" fill="currentColor"/><path d="M8 16h8v2H8z" fill="currentColor"/></svg>',"header-1":'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill="currentColor" d="M835.626667 349.397333A42.666667 42.666667 0 0 1 853.333333 384v426.666667a42.666667 42.666667 0 0 1-85.333333 0v-367.488l-71.850667 23.978666a42.666667 42.666667 0 0 1-26.965333-80.981333l128-42.666667a42.666667 42.666667 0 0 1 38.4 5.888zM128 170.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v256h256V213.333333a42.666667 42.666667 0 1 1 85.333333 0v597.333334a42.666667 42.666667 0 1 1-85.333333 0v-256H170.666667v256a42.666667 42.666667 0 1 1-85.333334 0V213.333333a42.666667 42.666667 0 0 1 42.666667-42.666666z" p-id="1635"></path></svg>',"header-2":'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M768 426.666667a85.333333 85.333333 0 0 0-85.333333 85.333333v21.333333a42.666667 42.666667 0 1 1-85.333334 0V512a170.666667 170.666667 0 0 1 170.666667-170.666667h7.338667a163.328 163.328 0 0 1 115.498666 278.869334L742.997333 768H896a42.666667 42.666667 0 1 1 0 85.333333h-256a42.666667 42.666667 0 0 1-30.165333-72.832l220.672-220.672A77.994667 77.994667 0 0 0 775.338667 426.666667H768zM128 170.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v256h256V213.333333a42.666667 42.666667 0 1 1 85.333333 0v597.333334a42.666667 42.666667 0 1 1-85.333333 0v-256H170.666667v256a42.666667 42.666667 0 1 1-85.333334 0V213.333333a42.666667 42.666667 0 0 1 42.666667-42.666666z" p-id="1791"></path></svg>',"header-3":'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M597.333333 384a42.666667 42.666667 0 0 1 42.666667-42.666667h256a42.666667 42.666667 0 0 1 30.165333 72.832l-105.941333 105.984A170.752 170.752 0 0 1 768 853.333333a170.666667 170.666667 0 0 1-160.938667-113.877333 42.666667 42.666667 0 0 1 80.469334-28.373333A85.333333 85.333333 0 1 0 768 597.333333h-42.666667a42.666667 42.666667 0 0 1-30.165333-72.832L793.002667 426.666667H640a42.666667 42.666667 0 0 1-42.666667-42.666667zM128 170.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v256h256V213.333333a42.666667 42.666667 0 1 1 85.333333 0v597.333334a42.666667 42.666667 0 1 1-85.333333 0v-256H170.666667v256a42.666667 42.666667 0 1 1-85.333334 0V213.333333a42.666667 42.666667 0 0 1 42.666667-42.666666z" p-id="1949"></path></svg>',"header-4":'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M780.714667 343.296a42.666667 42.666667 0 0 1 28.032 53.418667L719.36 682.666667H896a42.666667 42.666667 0 1 1 0 85.333333h-234.666667a42.666667 42.666667 0 0 1-40.704-55.381333l106.666667-341.333334a42.666667 42.666667 0 0 1 53.418667-27.989333z" p-id="2107"></path><path d="M853.333333 554.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v213.333334a42.666667 42.666667 0 1 1-85.333333 0v-213.333334a42.666667 42.666667 0 0 1 42.666666-42.666666zM128 170.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v256h256V213.333333a42.666667 42.666667 0 1 1 85.333333 0v597.333334a42.666667 42.666667 0 1 1-85.333333 0v-256H170.666667v256a42.666667 42.666667 0 1 1-85.333334 0V213.333333a42.666667 42.666667 0 0 1 42.666667-42.666666z" p-id="2108"></path></svg>',"header-5":'\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M683.946667 373.674667A42.666667 42.666667 0 0 1 725.333333 341.333333h170.666667a42.666667 42.666667 0 1 1 0 85.333334h-137.301333l-22.016 88.234666A170.666667 170.666667 0 1 1 640 795.562667a42.666667 42.666667 0 1 1 64-56.448 85.333333 85.333333 0 1 0 0-112.896 42.666667 42.666667 0 0 1-73.386667-38.528l53.333334-214.016zM128 170.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v256h256V213.333333a42.666667 42.666667 0 1 1 85.333333 0v597.333334a42.666667 42.666667 0 1 1-85.333333 0v-256H170.666667v256a42.666667 42.666667 0 1 1-85.333334 0V213.333333a42.666667 42.666667 0 0 1 42.666667-42.666666z" p-id="2264"></path></svg>',"header-6":'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M831.274667 303.957333a42.666667 42.666667 0 0 1 16.725333 57.984l-83.498667 151.466667a170.453333 170.453333 0 0 1 88.746667 22.741333 169.557333 169.557333 0 0 1 62.506667 232.277334 171.093333 171.093333 0 0 1-232.96 62.165333 169.557333 169.557333 0 0 1-62.805334-231.850667l153.301334-278.016a42.666667 42.666667 0 0 1 57.984-16.768z m-20.48 306.176a85.76 85.76 0 0 0-116.736 31.018667 84.224 84.224 0 0 0 31.189333 115.456 85.76 85.76 0 0 0 116.736-31.018667 84.224 84.224 0 0 0-31.232-115.456zM128 170.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v256h256V213.333333a42.666667 42.666667 0 1 1 85.333333 0v597.333334a42.666667 42.666667 0 1 1-85.333333 0v-256H170.666667v256a42.666667 42.666667 0 1 1-85.333334 0V213.333333a42.666667 42.666667 0 0 1 42.666667-42.666666z" p-id="2422"></path></svg>',"header-n":'<svg viewBox="0 0 24 24" ><path d="M2 3a1 1 0 0 0-1 1v16a1 1 0 1 0 2 0v-7h9v7a1 1 0 1 0 2 0V4a1 1 0 1 0-2 0v7H3V4a1 1 0 0 0-1-1Zm14 9a1 1 0 0 1 1.984-.177 4.099 4.099 0 0 1 1.757-.576 3.447 3.447 0 0 1 3.759 3.432V20a1 1 0 1 1-2 0v-5.32c0-.851-.73-1.519-1.578-1.442A2.114 2.114 0 0 0 18 15.344V20a1 1 0 1 1-2 0v-8Z" fill="currentColor"></path></svg>',obsidian:'<svg viewBox="0 0 100 100" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="logo-wireframe"><path d="M 30.91 17.52 L 34.43 35.7 M 61.44 14.41 L 62.61 0 M 34.43 35.7 L 37.57 90.47 M 81 26.39 L 61.44 14.41 L 34.43 35.7 L 65.35 100 M 62.61 0 L 30.91 17.52 L 18 45.45 L 37.57 90.47 L 65.35 100 L 70.44 89.8 L 81 26.39 L 62.61 0 Z"></path></svg>',"obsidian-new":'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#A88BFA" d="m6.91927 14.5955c.64053-.1907 1.67255-.4839 2.85923-.5565-.71191-1.7968-.88376-3.3691-.74554-4.76905.15962-1.61678.72977-2.9662 1.28554-4.11442.1186-.24501.2326-.47313.3419-.69198.1549-.30984.3004-.60109.4365-.8953.2266-.48978.3948-.92231.4798-1.32416.0836-.39515.0841-.74806-.0148-1.08657-.099-.338982-.3093-.703864-.7093-1.1038132-.5222-.1353116-1.1017-.0165173-1.53613.3742922l-5.15591 4.638241c-.28758.25871-.47636.60929-.53406.99179l-.44455 2.94723c.69903.6179 2.42435 2.41414 3.47374 4.90644.09364.2224.1819.4505.26358.6838z"></path><path fill="#A88BFA" d="m2.97347 10.3512c-.02431.1037-.05852.205-.10221.3024l-2.724986 6.0735c-.279882.6238-.15095061 1.3552.325357 1.8457l4.288349 4.4163c2.1899-3.2306 1.87062-6.2699.87032-8.6457-.75846-1.8013-1.90801-3.2112-2.65683-3.9922z"></path><path fill="#A88BFA" d="m5.7507 23.5094c.07515.012.15135.0192.2281.0215.81383.0244 2.18251.0952 3.29249.2997.90551.1669 2.70051.6687 4.17761 1.1005 1.1271.3294 2.2886-.5707 2.4522-1.7336.1192-.8481.343-1.8075.7553-2.6869l-.0095.0033c-.6982-1.9471-1.5865-3.2044-2.5178-4.0073-.9284-.8004-1.928-1.1738-2.8932-1.3095-1.60474-.2257-3.07497.1961-4.00103.4682.55465 2.3107.38396 5.0295-1.48417 7.8441z"></path><path fill="#A88BFA" d="m17.3708 19.3102c.9267-1.3985 1.5868-2.4862 1.9352-3.0758.1742-.295.1427-.6648-.0638-.9383-.5377-.7126-1.5666-2.1607-2.1272-3.5015-.5764-1.3785-.6624-3.51876-.6673-4.56119-.0019-.39626-.1275-.78328-.3726-1.09465l-3.3311-4.23183c-.0117.19075-.0392.37998-.0788.56747-.1109.52394-.32 1.04552-.5585 1.56101-.1398.30214-.3014.62583-.4646.95284-.1086.21764-.218.4368-.3222.652-.5385 1.11265-1.0397 2.32011-1.1797 3.73901-.1299 1.31514.0478 2.84484.8484 4.67094.1333.0113.2675.0262.4023.0452 1.1488.1615 2.3546.6115 3.4647 1.5685.9541.8226 1.8163 2.0012 2.5152 3.6463z"></path></svg>'};class so{constructor(e){this.plugin=e}init(){this.statusBarIcon=this.plugin.addStatusBarItem(),this.statusBarIcon.addClass("editingToolbar-statusbar-button"),e.setIcon(this.statusBarIcon,"editingToolbar"),this.registerClickEvent()}registerClickEvent(){this.plugin.registerDomEvent(this.statusBarIcon,"click",(()=>{const e=this.statusBarIcon.parentElement.getBoundingClientRect(),t=this.statusBarIcon.getBoundingClientRect();this.showMenu(t,e)}))}showMenu(t,o){const i=new e.Menu;i.addSections(["settings"]),this.addVisibilityToggle(i),this.addAestheticStyleToggle(i),i.addSections(["viewType"]),this.addViewTypeToggle(i),i.addSections(["controls"]),this.addToolbarControls(i);i.dom.addClass("editingToolbar-statusbar-menu"),i.showAtPosition({x:t.right+5,y:o.top-5})}addVisibilityToggle(o){o.addItem((o=>{o.setTitle(f("Hide & Show")),!e.requireApiVersion("0.15.0")||o.setSection("settings");const i=o.dom,n=new e.ToggleComponent(i).setValue(this.plugin.settings.cMenuVisibility).setDisabled(!0),s=()=>t(this,void 0,void 0,(function*(){this.plugin.settings.cMenuVisibility=!this.plugin.settings.cMenuVisibility,n.setValue(this.plugin.settings.cMenuVisibility),1==this.plugin.settings.cMenuVisibility?setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100):c(this.plugin.settings.cMenuVisibility),I(),yield this.plugin.saveSettings()}));o.onClick((e=>{e.preventDefault(),e.stopImmediatePropagation(),s()}))})),o.addItem((o=>{o.setTitle(f("Toolbar Position")),!e.requireApiVersion("0.15.0")||o.setSection("settings"),o.setIcon("dock");const i=o.setSubmenu();["top","fixed","following"].forEach((e=>{i.addItem((o=>{o.setTitle(e),o.setIcon(this.plugin.settings.positionStyle===e?"check":""),o.onClick((()=>t(this,void 0,void 0,(function*(){this.plugin.settings.positionStyle=e,yield this.plugin.saveSettings(),I(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100)}))))}))}))}))}addViewTypeToggle(o){const i=this.plugin.app.workspace.getActiveViewOfType(e.ItemView);if(!i)return;const n=i.getViewType();o.addItem((o=>{o.setTitle(f("Current View: ")+n),!e.requireApiVersion("0.15.0")||o.setSection("settings"),o.setIcon("layout-template");const s=o.setSubmenu(),a=T.isAllowedViewType(i);s.addItem((e=>{e.setTitle(f(a?"Disable toolbar for this view":"Enable toolbar for this view")),e.setIcon(a?"eye-off":"eye"),e.onClick((()=>t(this,void 0,void 0,(function*(){this.plugin.settings.viewTypeSettings||(this.plugin.settings.viewTypeSettings={}),this.plugin.settings.viewTypeSettings[n]=!a,yield this.plugin.saveSettings(),I(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100)}))))})),s.addItem((e=>{e.setTitle(f("Manage all view types")),e.setIcon("settings-2");const o=e.setSubmenu(),i=new Set(["markdown","canvas","thino_view","meld-encrypted-view","excalidraw","image",...Object.keys(this.plugin.settings.viewTypeSettings||{})]);Array.from(i).sort().forEach((e=>{const i=this.isViewTypeAllowed(e);o.addItem((o=>{o.setTitle(e),o.setIcon(i?"check":""),o.onClick((()=>t(this,void 0,void 0,(function*(){this.plugin.settings.viewTypeSettings||(this.plugin.settings.viewTypeSettings={}),this.plugin.settings.viewTypeSettings[e]=!i,n===e&&(I(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100)),yield this.plugin.saveSettings()}))))}))}))}))}))}isViewTypeAllowed(e){if(!this.plugin.settings.viewTypeSettings||void 0===this.plugin.settings.viewTypeSettings[e]){return["markdown","canvas","thino_view","meld-encrypted-view","excalidraw","image"].includes(e)}return this.plugin.settings.viewTypeSettings[e]}addToolbarControls(t){const o=[{icon:"plus",title:f("Add Command"),click:()=>new y(this.plugin).open()}];"fixed"===this.plugin.settings.positionStyle&&o.push({icon:"file-sliders",title:f("Position Settings"),click:()=>new w(this.plugin.app,this.plugin).open()}),o.forEach((o=>{t.addItem((t=>{t.setIcon(o.icon),t.setTitle(o.title),t.onClick(o.click),e.requireApiVersion("0.15.0")&&t.setSection("controls")}))}))}addAestheticStyleToggle(o){o.addItem((o=>{o.setTitle(f("Appearance Style")),!e.requireApiVersion("0.15.0")||o.setSection("settings"),o.setIcon("cherry");const i=o.setSubmenu();k.forEach((e=>{i.addItem((o=>{o.setTitle(e),o.setIcon(this.plugin.settings.aestheticStyle===e?"check":""),o.onClick((()=>t(this,void 0,void 0,(function*(){this.plugin.settings.aestheticStyle=e,yield this.plugin.saveSettings(),I(),setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100)}))))}))}))}))}}let ao,ro;class lo extends e.Modal{constructor(e){super(e.app),this.plugin=e,this.type="note",this.title="",this.content="",this.collapse="none",this.calloutTypes=[{type:"note",aliases:["cite"],icon:"lucide-pencil",label:"Note",color:"var(--callout-default)"},{type:"abstract",aliases:["summary","tldr"],icon:"lucide-clipboard-list",label:"Abstract",color:"var(--callout-summary)"},{type:"info",aliases:[],icon:"lucide-info",label:"Info",color:"var(--callout-info)"},{type:"todo",aliases:[],icon:"lucide-check-circle-2",label:"Todo",color:"var(--callout-todo)"},{type:"important",aliases:[],icon:"lucide-flame",label:"Important",color:"var(--callout-important)"},{type:"tip",aliases:["hint"],icon:"lucide-flame",label:"Tip",color:"var(--callout-tip)"},{type:"success",aliases:["check","done"],icon:"lucide-check",label:"Success",color:"var(--callout-success)"},{type:"question",aliases:["help","faq"],icon:"help-circle",label:"Question",color:"var(--callout-question)"},{type:"warning",aliases:["caution","attention"],icon:"lucide-alert-triangle",label:"Warning",color:"var(--callout-warning)"},{type:"failure",aliases:["fail","missing"],icon:"lucide-x",label:"Failure",color:"var(--callout-fail)"},{type:"danger",aliases:["error"],icon:"lucide-zap",label:"Danger",color:"var(--callout-error)"},{type:"bug",aliases:[],icon:"lucide-bug",label:"Bug",color:"var(--callout-bug)"},{type:"example",aliases:[],icon:"lucide-list",label:"Example",color:"var(--callout-example)"},{type:"quote",aliases:["cite"],icon:"quote-glyph",label:"Quote",color:"var(--callout-quote)"}],this.containerEl.addClass("insert-callout-modal");const t=this.plugin.commandsManager.getActiveEditor();if(t){const e=t.getSelection();e&&(this.content=e)}}onOpen(){this.display()}display(){return t(this,void 0,void 0,(function*(){const{contentEl:t}=this;t.empty(),t.addEventListener("keydown",(e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.insertButton&&this.insertButton.click())}));const o=t.createDiv("callout-type-container");new e.Setting(o).setName(f("Callout Type")).addDropdown((e=>{this.calloutTypes.forEach((({type:t,aliases:o,label:i})=>{e.addOption(t,i),o.forEach((t=>{e.addOption(t,`${i} (${t})`)}))})),e.setValue(this.type),e.onChange((e=>{this.type=e,this.updateIconAndColor(i,e)}))}));const i=o.createDiv("callout-icon-container");this.updateIconAndColor(i,this.type),new e.Setting(t).setName(f("Title")).setDesc(f("Optional, leave blank for default title")).addText((e=>{e.setPlaceholder(f("Input title")).setValue(this.title).onChange((e=>{this.title=e}))})),new e.Setting(t).setName(f("Collapse State")).addDropdown((e=>{e.addOption("none",f("Default")).addOption("open",f("Open")).addOption("closed",f("Closed")).setValue(this.collapse).onChange((e=>{this.collapse=e}))})),new e.Setting(t).setName(f("Content")).addTextArea((e=>{e.setPlaceholder(f("Input content")).setValue(this.content).onChange((e=>{this.content=e})),e.inputEl.rows=5,e.inputEl.cols=40,this.contentTextArea=e.inputEl}));const n=t.createDiv("shortcut-hint");n.setText(`${e.Platform.isMacOS?"⌘":"Ctrl"} + Enter ${f("to insert")}`),n.style.textAlign="right",n.style.fontSize="0.8em",n.style.opacity="0.7",n.style.marginTop="5px",new e.Setting(t).addButton((e=>(e.setButtonText(f("Insert")).setCta().onClick((()=>{this.insertCallout(),this.close()})),this.insertButton=e.buttonEl,e))).addButton((e=>(e.setButtonText(f("Cancel")).setTooltip(f("Cancel")).onClick((()=>this.close())),e))),setTimeout((()=>{this.contentTextArea&&this.contentTextArea.focus()}),10)}))}updateIconAndColor(t,o){const i=this.calloutTypes.find((e=>e.type===o||e.aliases.includes(o)));i&&(t.empty(),e.setIcon(t,i.icon),t.style.setProperty("--callout-color",i.color))}insertCallout(){const e=this.plugin.commandsManager.getActiveEditor();if(!e)return;let t=`> [!${this.type}]`;"none"!==this.collapse&&(t+=""+("open"===this.collapse?"+":"-")),this.title&&(t+=` ${this.title}`),t+=`\n> ${this.content.replace(/\n/g,"\n> ")}`;const o=e.getCursor(),i=e.getLine(o.line),n=0===o.ch;let s;if(e.getSelection()){!n&&i.trim().length>0&&(t="\n"+t);const o=e.getCursor("from");e.replaceSelection(t);const a=t.split("\n").length;s={line:o.line+a,ch:0}}else{!n&&i.trim().length>0&&(t="\n"+t),e.replaceRange(t,o);const a=t.split("\n").length;s={line:o.line+a,ch:0}}setTimeout((()=>{e.replaceRange("\n",s),e.setCursor({line:s.line+1,ch:0}),e.focus()}),0)}}class co extends e.Modal{constructor(e){super(e.app),this.plugin=e,this.linkText="",this.linkUrl="",this.linkAlias="",this.isEmbed=!1,this.insertNewLine=!1,this.imageWidth="",this.imageHeight="",this.prefixText="",this.suffixText="",this.selectedText="";const t=this.plugin.commandsManager.getActiveEditor();if(t){const e=t.getSelection()||"";e?(this.selectedText=e,this.parseSelectedText(e)):this.parseClipboard()}else this.parseClipboard();this.updateHeader()}parseSelectedText(e){const t=e.match(/!\[.*?\]\(.*?\)/);if(t){const o=e.substring(0,t.index),i=e.substring(t.index+t[0].length),n=this.parseMarkdownImageLink(e);if(n)return this.linkText=n.title,this.linkUrl=n.url,this.imageWidth=n.width||"",this.imageHeight=n.height||"",this.isEmbed=!0,this.prefixText=o,void(this.suffixText=i)}const o=e.match(/\[.*?\]\(.*?\)/);if(o){const t=o[0],i=e.substring(0,o.index),n=e.substring(o.index+t.length),s=this.parseMarkdownLink(t);s&&(this.linkText=s.title,this.linkUrl=s.url,this.linkAlias=s.alias||"",this.isEmbed=!1),this.prefixText=i,this.suffixText=n}else{const t=this.parseMixedContent(e);t&&(this.linkText=t.title,this.linkUrl=t.url)}}parseMixedContent(e){let t;return(t=e.match(/^\[(.*?)\]\((.*?)\)$/))?{title:t[1].trim(),url:t[2].trim()}:(t=e.match(/<a[^>]+href=["']([^"']+)["'][^>]*>([^<]+)<\/a>/i))?{title:t[2].trim(),url:t[1].trim()}:(t=e.match(/^(.*?)\s*((?:https?:\/\/|www\.)\S+)$/i))&&t[1].trim()?{title:t[1].trim(),url:t[2].trim()}:this.isValidUrl(e.trim())?{title:this.extractTitleFromUrl(e.trim()),url:e.trim()}:{title:e.trim(),url:""}}extractTitleFromUrl(e){const t=e.match(/^([a-zA-Z]+):\/\/(.+)$/);if(t){const[,e,o]=t,i=o.split(/[/\\]/),n=i[i.length-1];return n?decodeURIComponent(n).trim():e.toUpperCase()}const o=e.match(/^\[\[(.*?)\]\]$/);if(o)return o[1];const i=e.match(/[^/\\]+$/);return i?i[0].replace(/\.[^/.]+$/,"").replace(/[-_]/g," ").trim():e}isValidUrl(e){if(!e||e.includes("\n")||/\s/.test(e))return!1;if(["obsidian://","zotero://","evernote://","notion://","bear://","things://","drafts://","x-devonthink-item://","file://","ftp://","ftps://","http://","https://","tel:","mailto:"].some((t=>e.startsWith(t))))return!0;if(e.match(/^\[\[.*?\]\]$/))return!0;if(e.match(/^[./\\]/)||e.match(/^[a-zA-Z]:\\/)||e.match(/^\/[^/]/)||e.match(/^[a-zA-Z]+:\/\//))return!0;try{return new URL(e),!0}catch(e){return!1}}parseMarkdownImageLink(e){const t=e.match(/!\[(.*?)(?:\|(\d+)(?:x(\d+))?)?\]\(([^)]+)\)(?:!.*)?$/);if(t){const[,e,o,i,n]=t;if(this.isEmbed=!0,this.embedToggle){this.embedToggle.setValue(!0);const e=this.contentEl.querySelector(".image-size-setting");e&&(e.style.display="block")}return{title:e.trim(),url:n.trim(),width:o,height:i}}return null}parseMarkdownLink(e){const t=e.match(/\[(.*?)(?:\|(.*?))?\]\(([^)]+)\)/);if(t){const[,e,o,i]=t;return{title:e.trim(),url:i.trim(),alias:null==o?void 0:o.trim()}}return null}parseClipboard(){return t(this,void 0,void 0,(function*(){try{const e=yield this.readClipboard(),t=e["text/plain"];if(t){const e=this.parseMarkdownImageLink(t);if(e)return this.linkText=e.title,this.linkUrl=e.url,(e.width||e.height)&&(this.isEmbed=!0,this.imageWidth=e.width||"",this.imageHeight=e.height||""),void this.updateUI();const o=this.parseMarkdownLink(t);if(o)return this.linkText=o.title,this.linkUrl=o.url,this.linkAlias=o.alias||"",this.isEmbed=!1,void this.updateUI()}if(e["text/html"]){const t=this.parseHtmlContent(e["text/html"]);t&&(this.linkText=this.linkText||t.title,this.linkUrl=t.url)}else if(e["text/markdown"]){const t=this.parseMarkdownContent(e["text/markdown"]);t&&(this.linkText=this.linkText||t.title,this.linkUrl=t.url)}else if(e["text/plain"]){const t=this.parseMixedContent(e["text/plain"]);t&&(this.linkText=this.linkText||t.title,this.linkUrl=t.url)}this.updateUI()}catch(e){console.error("Failed to read clipboard:",e)}}))}readClipboard(){return t(this,void 0,void 0,(function*(){const e={};try{const t=yield navigator.clipboard.read();for(const o of t){const t=o.types;for(const i of t)if("text/html"===i||"text/plain"===i||"text/markdown"===i){const t=yield o.getType(i);e[i]=yield t.text()}}}catch(t){try{const t=yield navigator.clipboard.readText();e["text/plain"]=t}catch(e){console.error("Failed to read clipboard:",e)}}return e}))}parseHtmlContent(e){var t;const o=(new DOMParser).parseFromString(e,"text/html"),i=o.querySelector("a");if(i)return{title:(null===(t=i.textContent)||void 0===t?void 0:t.trim())||"",url:i.href};const n=o.body.textContent||"";return this.parseMixedContent(n)}parseMarkdownContent(e){const t=e.match(/\[([^\]]+)\]\(([^)]+)\)/);return t?{title:t[1].trim(),url:t[2].trim()}:this.parseMixedContent(e)}onOpen(){this.display()}updateHeader(){const e=this.getPreviewText();this.previewSetting&&(this.previewSetting.controlEl.querySelector("input").value=e)}getPreviewText(){const e=this.linkText||"",t=this.linkUrl;let o=this.isEmbed?"!":"";return o+=`[${e}`,this.isEmbed&&(this.imageWidth||this.imageHeight)?(o+="|",this.imageWidth&&this.imageHeight?o+=`${this.imageWidth}x${this.imageHeight}`:this.imageWidth?o+=this.imageWidth:this.imageHeight&&(o+=`x${this.imageHeight}`)):!this.isEmbed&&this.linkAlias&&(o+=`|${this.linkAlias}`),o+=`](${t})`,o}display(){return t(this,void 0,void 0,(function*(){const{contentEl:o}=this;o.empty(),o.addClass("insert-link-modal"),this.titleEl.textContent="",this.titleEl.addClass("insert-link-modal-title"),o.addEventListener("keydown",(e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.insertButton&&this.insertButton.click())}));const i=new e.Setting(o).setName(f("Link Text")).addText((e=>{this.linkTextInput=e,e.setPlaceholder(f("Link Text")).setValue(this.linkText).onChange((e=>{this.linkText=e,this.updateHeader()}))})),n=new e.Setting(i.controlEl).setName(f("Alias")).addText((e=>{this.linkAliasInput=e,e.setPlaceholder(f("Link Alias(optional)")).setValue(this.linkAlias).onChange((e=>{this.linkAlias=e,this.updateHeader()}))})),s=new e.Setting(o).setName(f("Link URL")).setClass("link-url-setting").addText((e=>{this.linkUrlInput=e,e.setPlaceholder(f("Link URL")).setValue(this.linkUrl).onChange((e=>{this.linkUrl=e.trim(),this.validateUrl(this.linkUrl),this.updateHeader()}))})).addButton((e=>{e.setIcon("lucide-clipboard").setTooltip(f("Paste and Parse")).onClick((()=>t(this,void 0,void 0,(function*(){yield this.parseClipboard(),this.updateHeader()}))))}));this.urlErrorMsg=s.descEl.createDiv("url-error"),this.urlErrorMsg.style.color="var(--text-error)",this.urlErrorMsg.style.display="none";const a=new e.Setting(o).setName(f("Embed Content")).setDesc(f("If it is an image, turn on"));this.embedToggle=new e.ToggleComponent(a.controlEl),this.embedToggle.setValue(this.isEmbed).onChange((e=>{this.isEmbed=e;const t=o.querySelector(".image-size-setting"),i=n.settingEl;t&&(t.style.display=e?"flex":"none"),i&&(i.style.display=e?"none":"flex"),this.updateHeader()}));new e.Setting(o).setClass("image-size-setting").setName(f("Image Size")).addText((e=>{e.inputEl.addClass("image-width-input"),e.setPlaceholder(f("Image Width")).setValue(this.imageWidth).onChange((t=>{this.imageWidth=t.replace(/[^\d]/g,""),e.setValue(this.imageWidth),this.updateHeader()}))})).addText((e=>{e.inputEl.addClass("image-height-input"),e.setPlaceholder(f("Image Height")).setValue(this.imageHeight).onChange((t=>{this.imageHeight=t.replace(/[^\d]/g,""),e.setValue(this.imageHeight),this.updateHeader()}))})).settingEl.style.display=this.isEmbed?"block":"none",new e.Setting(o).setName(f("Insert New Line")).setDesc(f("Insert a link on the next line")).addToggle((e=>{e.setValue(this.insertNewLine).onChange((e=>{this.insertNewLine=e,this.updateHeader()}))})),this.previewSetting=new e.Setting(o).setClass("preview-setting").addText((e=>{e.setValue(this.getPreviewText()).inputEl.setAttribute("readonly","true")}));const r=o.createDiv("shortcut-hint");r.setText(`${e.Platform.isMacOS?"⌘":"Ctrl"} + Enter ${f("to insert")}`),r.style.textAlign="right",r.style.fontSize="0.8em",r.style.opacity="0.7",r.style.marginTop="5px",new e.Setting(o).addButton((e=>{e.setButtonText(f("Insert")).setCta().onClick((()=>{this.insertLink(),this.close()})),this.insertButton=e.buttonEl})).addButton((e=>e.setButtonText(f("Cancel")).onClick((()=>{this.close()})))),setTimeout((()=>{this.linkText||this.linkUrl?!this.linkText&&this.linkUrl?this.linkTextInput.inputEl.focus():this.linkText&&!this.linkUrl?this.linkUrlInput.inputEl.focus():this.linkAliasInput.inputEl.focus():this.linkTextInput.inputEl.focus()}),10)}))}validateUrl(e){return e?this.isValidUrl(e)?(this.urlErrorMsg.style.display="none",!0):(this.urlErrorMsg.textContent=f("URL Format Error"),this.urlErrorMsg.style.display="block",!1):(this.urlErrorMsg.style.display="none",!0)}insertLink(){if(!this.validateUrl(this.linkUrl))return;const e=this.plugin.commandsManager.getActiveEditor();if(!e)return;let t=this.linkText||this.linkUrl;const o=this.linkUrl;let i,n=this.isEmbed?"!":"";n+=`[${t}`,this.isEmbed&&(this.imageWidth||this.imageHeight)?(n+="|",this.imageWidth&&this.imageHeight?n+=`${this.imageWidth}x${this.imageHeight}`:this.imageWidth?n+=this.imageWidth:this.imageHeight&&(n+=`x${this.imageHeight}`)):!this.isEmbed&&this.linkAlias&&(n+=`|${this.linkAlias}`),n+=`](${o})`;if(e.getSelection()){const t=e.getCursor("from"),o=e.getCursor("to");if(this.insertNewLine)e.replaceRange("\n"+n,{line:o.line,ch:e.getLine(o.line).length}),i={line:o.line+1,ch:n.length};else{const s=this.prefixText+n+this.suffixText;e.replaceRange(s,{line:t.line,ch:0},o),i={line:t.line,ch:this.prefixText.length+n.length}}}else{const t=e.getCursor(),o=e.getLine(t.line);if(this.insertNewLine){const s=t.line+1;e.replaceRange("\n",{line:t.line,ch:o.length}),e.setCursor({line:s,ch:0}),e.replaceRange(n,{line:s,ch:0}),i={line:s,ch:n.length}}else e.replaceRange(n,t),i={line:t.line,ch:t.ch+n.length}}setTimeout((()=>{i&&e.setCursor(i),e.focus()}),0)}updateUI(){this.linkTextInput&&this.linkTextInput.setValue(this.linkText),this.linkUrlInput&&(this.linkUrlInput.setValue(this.linkUrl),this.validateUrl(this.linkUrl));const e=this.contentEl.querySelector(".image-width-input"),t=this.contentEl.querySelector(".image-height-input");e&&(e.value=this.imageWidth),t&&(t.value=this.imageHeight),this.linkAliasInput&&this.linkAliasInput.setValue(this.linkAlias);const o=this.contentEl.querySelector(".setting-item:nth-child(2)");o&&(o.style.display=this.isEmbed?"none":"flex"),this.updateHeader()}}class uo{constructor(e){this.executeCommandWithoutBlur=(e,o)=>t(this,void 0,void 0,(function*(){e&&(e.getSelection(),e.getCursor(),yield o(),e.focus())})),this._commandsMap={hrline:{char:5,line:1,prefix:"\n---",suffix:"\n",islinehead:!0},justify:{char:0,line:0,prefix:'<p align="justify">',suffix:"</p>",islinehead:!1},left:{char:0,line:0,prefix:'<p align="left">',suffix:"</p>",islinehead:!1},right:{char:0,line:0,prefix:'<p align="right">',suffix:"</p>",islinehead:!1},center:{char:0,line:0,prefix:"<center>",suffix:"</center>",islinehead:!1},underline:{char:0,line:0,prefix:"<u>",suffix:"</u>",islinehead:!1},superscript:{char:0,line:0,prefix:"<sup>",suffix:"</sup>",islinehead:!1},subscript:{char:0,line:0,prefix:"<sub>",suffix:"</sub>",islinehead:!1},codeblock:{char:4,line:0,prefix:"\n```\n",suffix:"\n```\n",islinehead:!1}},this.modCommands=[{id:"editor:insert-embed",name:"Add embed",icon:"note-glyph"},{id:"editor:insert-link",name:"Insert markdown link",icon:"link-glyph"},{id:"editor:insert-tag",name:"Add tag",icon:"price-tag-glyph"},{id:"editor:insert-wikilink",name:"Add internal link",icon:"bracket-glyph"},{id:"editor:toggle-code",name:"Code",icon:"code-glyph"},{id:"editor:toggle-blockquote",name:"Blockquote",icon:"lucide-text-quote"},{id:"editor:toggle-checklist-status",name:"Checklist status",icon:"checkbox-glyph"},{id:"editor:toggle-comments",name:"Comment",icon:"percent-sign-glyph"},{id:"editor:insert-callout",name:"Insert Callout",icon:"lucide-quote"},{id:"editor:insert-mathblock",name:"MathBlock",icon:"lucide-sigma-square"},{id:"editor:insert-table",name:"Insert Table",icon:"lucide-table"},{id:"editor:swap-line-up",name:"Swap line up",icon:"lucide-corner-right-up"},{id:"editor:swap-line-down",name:"Swap line down",icon:"lucide-corner-right-down"},{id:"editor:attach-file",name:"Attach file",icon:"lucide-paperclip"},{id:"editor:clear-formatting",name:"Clear formatting",icon:"lucide-eraser"}],this.applyCommand=(e,t)=>{const o=t.getSelection(),i=t.getCursor("from"),n=t.getCursor("to");let s=e.prefix;e.islinehead&&i.ch>0&&(s="\n"+s);const a=e.suffix,r={line:i.line-e.line,ch:i.ch-s.length};if(t.getRange(r,i)==s){const l={line:i.line+e.line,ch:n.ch+a.length};if(t.getRange(n,l)==a){t.replaceRange(o,r,l),t.setCursor(i.line-e.line,i.ch);const n={line:i.line,ch:i.ch-s.length},a={line:i.line,ch:n.ch+o.length};return void t.setSelection(n,a)}}if(t.replaceSelection(`${s}${o}${a}`),e.char>0)t.setCursor(i.line+e.line,i.ch+e.char+o.length);else{const e=i,n={line:e.line,ch:e.ch+s.length},a={line:e.line,ch:n.ch+o.length};t.setSelection(n,a)}},this.plugin=e}applyRegexCommand(o,i){return t(this,void 0,void 0,(function*(){try{let t=o.getSelection();const n=o.getCursor("from");o.getCursor("to");if(!t)try{const i=yield this.readClipboard();if(t=i["text/html"]?e.htmlToMarkdown(i["text/html"]):i["text/markdown"]||i["text/plain"],!t)return void new e.Notice(f("Please select text or copy text to clipboard first"));o.replaceRange(t,n,n);const s=o.offsetToPos(o.posToOffset(n)+t.length);o.setSelection(n,s)}catch(t){return console.error("读取剪贴板失败:",t),void new e.Notice(f("Please select text first"))}if(i.useCondition&&i.conditionPattern){if(!new RegExp(i.conditionPattern).test(t))return void new e.Notice(f("The selected text does not meet the condition requirements"))}let s="";!1!==i.regexGlobal&&(s+="g"),i.regexCaseInsensitive&&(s+="i"),i.regexMultiline&&(s+="m");const a=new RegExp(i.regexPattern,s),r=o.getCursor("from"),l=o.getCursor("to");o.transaction({changes:[{from:r,to:l,text:t.replace(a,i.regexReplacement)}]});const c=o.getSelection(),d=o.offsetToPos(o.posToOffset(r)),u=o.offsetToPos(o.posToOffset(r)+c.length);o.setSelection(d,u)}catch(t){console.error("正则表达式命令执行错误:",t),new e.Notice(f("Regex command execution error:")+t.message)}}))}readClipboard(){return t(this,void 0,void 0,(function*(){const e={};try{const t=yield navigator.clipboard.read();for(const o of t){const t=o.types;for(const i of t)if("text/html"===i||"text/plain"===i||"text/markdown"===i){const t=yield o.getType(i);e[i]=yield t.text()}}}catch(t){try{const t=yield navigator.clipboard.readText();e["text/plain"]=t}catch(e){console.error("读取剪贴板失败:",e)}}return e}))}getActiveEditor(){var t,o,i;const n=this.plugin.app.workspace.getActiveViewOfType(e.MarkdownView);if(n)return n.editor;const s=null===(t=this.plugin.app.workspace)||void 0===t?void 0:t.activeEditor;if(s&&s.editor)return s.editor;const a=null===(i=null===(o=this.plugin.app.workspace.activeLeaf)||void 0===o?void 0:o.view)||void 0===i?void 0:i.editor;return a||null}registerCommands(){this.plugin.addCommand({id:"hide-show-menu",name:"Hide/show ",icon:"editingToolbar",callback:()=>t(this,void 0,void 0,(function*(){this.plugin.settings.cMenuVisibility=!this.plugin.settings.cMenuVisibility,this.plugin.settings.cMenuVisibility?setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100):c(this.plugin.settings.cMenuVisibility),I(),yield this.plugin.saveSettings()}))}),this.plugin.addCommand({id:"format-eraser",name:"Format Eraser",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>R(this.plugin,e)))},icon:"eraser"}),this.plugin.addCommand({id:"change-font-color",name:"Change font color[html]",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>{var t;return a(null!==(t=this.plugin.settings.cMenuFontColor)&&void 0!==t?t:"#2DC26B",e)}))},icon:'<svg width="24" height="24" focusable="false" fill="currentColor"><g fill-rule="evenodd"><path id="change-font-color-icon" d="M3 18h18v3H3z" style="fill:#2DC26B"></path><path d="M8.7 16h-.8a.5.5 0 01-.5-.6l2.7-9c.1-.3.3-.4.5-.4h2.8c.2 0 .4.1.5.4l2.7 9a.5.5 0 01-.5.6h-.8a.5.5 0 01-.4-.4l-.7-2.2c0-.3-.3-.4-.5-.4h-3.4c-.2 0-.4.1-.5.4l-.7 2.2c0 .3-.2.4-.4.4zm2.6-7.6l-.6 2a.5.5 0 00.5.6h1.6a.5.5 0 00.5-.6l-.6-2c0-.3-.3-.4-.5-.4h-.4c-.2 0-.4.1-.5.4z"></path></g></svg>'}),this.plugin.addCommand({id:"change-background-color",name:"Change Backgroundcolor[html]",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>{var t;return r(null!==(t=this.plugin.settings.cMenuBackgroundColor)&&void 0!==t?t:"#FA541C",e)}))},icon:'<svg width="18" height="24" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg"><g stroke="none" stroke-width="1" fill="currentColor" fill-rule="evenodd"><g ><g fill="currentColor"><g transform="translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)" ><path d="M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z" fill-rule="nonzero"></path><path d="M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z" fill-rule="evenodd"></path><path d="M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z" fill-rule="nonzero"></path></g></g><path d="M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z" id="change-background-color-icon" style="fill:#FA541C"></path></g></g></svg>'}),this.plugin.addCommand({id:"indent-list",name:"Indent list",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.indentList()))},icon:"indent-glyph"}),this.plugin.addCommand({id:"undent-list",name:"Unindent list",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.unindentList()))},icon:"unindent-glyph"}),this.plugin.addCommand({id:"toggle-numbered-list",name:"Numbered list",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.toggleNumberList()))},icon:"number-list-glyph"}),this.plugin.addCommand({id:"toggle-bullet-list",name:"bullet list",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.toggleBulletList()))},icon:"bullet-list-glyph"}),this.plugin.addCommand({id:"toggle-highlight",name:"highlight",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.toggleMarkdownFormatting("highlight")))},icon:"highlight-glyph"}),this.plugin.addCommand({id:"toggle-bold",name:"Bold",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>{e.toggleMarkdownFormatting("bold")}))},icon:"bold-glyph"}),this.plugin.addCommand({id:"toggle-italics",name:"Italics",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.toggleMarkdownFormatting("italic")))},icon:"italic-glyph"}),this.plugin.addCommand({id:"toggle-strikethrough",name:"Strikethrough",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.toggleMarkdownFormatting("strikethrough")))},icon:"strikethrough-glyph"}),this.plugin.addCommand({id:"toggle-inline-math",name:"Inline math",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.toggleMarkdownFormatting("math")))},icon:"lucide-sigma"}),this.plugin.addCommand({id:"editor:cycle-list-checklist",name:"Cycle list checklist",icon:"lucide-check-square",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.toggleCheckList(!0)))}}),this.plugin.addCommand({id:"editor-undo",name:"Undo editor",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.undo()))},icon:"undo-glyph"}),this.plugin.addCommand({id:"editor-redo",name:"Redo editor",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>null==e?void 0:e.redo()))},icon:"redo-glyph"}),this.plugin.addCommand({id:"editor-copy",name:"Copy editor",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>t(this,void 0,void 0,(function*(){try{yield window.navigator.clipboard.writeText(e.getSelection()),this.plugin.app.commands.executeCommandById("editor:focus")}catch(e){console.error("Copy failed:",e)}}))))},icon:"lucide-copy"}),this.plugin.addCommand({id:"editor-paste",name:"Paste editor",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>t(this,void 0,void 0,(function*(){try{const t=yield window.navigator.clipboard.readText();t&&e.replaceSelection(t),this.plugin.app.commands.executeCommandById("editor:focus")}catch(e){console.error("Paste failed:",e)}}))))},icon:"lucide-clipboard-type"}),this.plugin.addCommand({id:"editor-cut",name:"Cut editor",callback:()=>{const e=this.getActiveEditor();e&&this.executeCommandWithoutBlur(e,(()=>t(this,void 0,void 0,(function*(){try{yield window.navigator.clipboard.writeText(e.getSelection()),e.replaceSelection(""),this.plugin.app.commands.executeCommandById("editor:focus")}catch(e){console.error("Cut failed:",e)}}))))},icon:"lucide-scissors"}),this.plugin.addCommand({id:"insert-callout",name:"Insert Callout(Modal)",icon:"lucide-quote",callback:()=>{new lo(this.plugin).open()}}),this.plugin.addCommand({id:"insert-link",name:"Insert Link(Modal)",icon:"lucide-link",callback:()=>{new co(this.plugin).open()}}),this.plugin.addCommand({id:"fullscreen-focus",name:"Fullscreen focus mode",hotkeys:[{modifiers:["Mod","Shift"],key:"F11"}],callback:()=>function(t){var o;Object.defineProperty(exports,"__esModule",{value:!0}),exports.toggleFull=exports.isFull=exports.exitFull=exports.beFull=void 0;let i=document.documentElement,n=i.querySelector("head"),s=document.createElement("style"),a="requestFullscreen",r="exitFullscreen",l="fullscreenElement";"webkitRequestFullScreen"in i?(a="webkitRequestFullScreen",r="webkitExitFullscreen",l="webkitFullscreenElement"):"msRequestFullscreen"in i?(a="msRequestFullscreen",r="msExitFullscreen",l="msFullscreenElement"):"mozRequestFullScreen"in i?(a="mozRequestFullScreen",r="mozCancelFullScreen",l="mozFullScreenElement"):"requestFullscreen"in i||console.log("当前浏览器不支持Fullscreen API !");const c=t.workspace.getActiveViewOfType(e.MarkdownView);if(!c)return;let d,u=c.containerEl,p=null===(o=document.body)||void 0===o?void 0:o.querySelector(".mod-vertical.mod-root .workspace-tab-container");function m(e){return e[a]()}function h(){return i.contains(s)&&(null==n||n.removeChild(s)),document[r]()}function g(e){return e===document[l]}d=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){if(g(p))try{document.body.removeChild(e),u.appendChild(e)}catch(e){console.log(e.message)}}))}))})),p.addEventListener("fullscreenchange",(function(){g(p)||d.disconnect()})),g(p)?(d.disconnect(),h()):(m(p),d.observe(document.body,{childList:!0})),exports.beFull=m,exports.exitFull=h,exports.isFull=g,exports.toggleFull=function(e){return g(e)?(h(),!1):(m(e),!0)}}(app),icon:"fullscreen"}),this.plugin.addCommand({id:"workplace-fullscreen-focus",name:"Workplace Fullscreen Focus",callback:()=>function(t){ao=e.requireApiVersion("0.15.0")?activeWindow.document:window.document;let o=ao;t.workspace.leftSplit.collapsed&&t.workspace.rightSplit.collapsed?(t.commands.executeCommandById("app:toggle-right-sidebar"),t.commands.executeCommandById("app:toggle-left-sidebar"),t.workspace.leftRibbon.show(),o.body.classList.contains("auto-hide-header")&&o.body.classList.remove("auto-hide-header")):(o.body.classList.contains("auto-hide-header")||o.body.classList.add("auto-hide-header"),t.workspace.leftRibbon.hide(),t.workspace.leftSplit.collapsed||t.commands.executeCommandById("app:toggle-left-sidebar"),t.workspace.rightSplit.collapsed||t.commands.executeCommandById("app:toggle-right-sidebar"))}(app),hotkeys:[{modifiers:["Mod"],key:"F11"}],icon:"remix-SplitCellsHorizontal"});for(let e=0;e<=6;e++)this.plugin.addCommand({id:`header${e}-text`,name:0===e?"Remove header level":`Header ${e}`,callback:()=>{const t=this.getActiveEditor();t&&this.executeCommandWithoutBlur(t,(()=>s("#".repeat(e),t)))},icon:0===e?"heading-glyph":`header-${e}`});Object.keys(this._commandsMap).forEach((e=>{this.plugin.addCommand({id:`${e}`,name:`Toggle ${e}`,icon:`${e}-glyph`,callback:()=>{const t=this.getActiveEditor();t&&this.executeCommandWithoutBlur(t,(()=>{this.applyCommand(this._commandsMap[e],t)}))}})})),this.modCommands.forEach((e=>{this.plugin.addCommand({id:`${e.id}`,name:`${e.name}`,icon:`${e.icon}`,callback:()=>{const o=this.getActiveEditor();o&&this.executeCommandWithoutBlur(o,(()=>t(this,void 0,void 0,(function*(){const t=o.getCursor("to");let i=this.getCharacterOffset(e.id);yield this.plugin.app.commands.executeCommandById(`${e.id}`),0!=i&&o.setCursor(t.line,t.ch+i)}))))}})})),this.plugin.addCommand({id:"toggle-format-brush",name:"Toggle Format Brush",icon:"paintbrush",editorCallback:e=>{this.plugin.toggleFormatBrush()}}),this.registerCustomCommands();["toggle-bold","toggle-italics","toggle-strikethrough","toggle-highlight","toggle-code","toggle-blockquote","header0-text","header1-text","header2-text","header3-text","header4-text","header5-text","header6-text","format-eraser","change-font-color","change-background-color",...this.plugin.settings.customCommands.map((e=>`${e.id}`)),...Object.keys(this._commandsMap)].forEach((e=>{const t=this.plugin.app.commands.commands[`editing-toolbar:${e}`];if(t&&t.callback){const o=t.callback;t.callback=()=>{o(),this.plugin.setLastExecutedCommand(`editing-toolbar:${e}`)}}}))}getCharacterOffset(e){switch(e){case"editor:insert-tag":return 1;case"editor:insert-callout":return 11;default:return 0}}reloadCustomCommands(){this.plugin.settings.customCommands.forEach((e=>{const t=`${e.id}`;this.plugin.app.commands.commands[`editing-toolbar:${t}`]&&delete this.plugin.app.commands.commands[`editing-toolbar:${t}`]})),this.registerCustomCommands()}registerCustomCommands(){this.plugin.settings.customCommands.forEach((e=>{const t=`${e.id}`;this.plugin.addCommand({id:t,name:e.name,icon:e.icon,editorCallback:o=>{if(e.useRegex&&e.regexPattern)o&&this.executeCommandWithoutBlur(o,(()=>{this.applyRegexCommand(o,e),this.plugin.setLastExecutedCommand(`editing-toolbar:${t}`)}));else{const i={prefix:e.prefix,suffix:e.suffix,char:e.char,line:e.line,islinehead:e.islinehead};this._commandsMap[e.id]=i,o&&this.executeCommandWithoutBlur(o,(()=>{this.applyCommand(i,o),this.plugin.setLastExecutedCommand(`editing-toolbar:${t}`)}))}}})}))}get commandsMap(){return this._commandsMap}}class po extends e.Plugin{constructor(){super(...arguments),this.lastExecutedCommand=null,this.formatBrushActive=!1,this.formatBrushNotice=null,this.lastExecutedCommandName=null,this.handleeditingToolbar=()=>{if(1==this.settings.cMenuVisibility){const t=this.app.workspace.getActiveViewOfType(e.ItemView);let o=A(this.app,this.settings);if(!T.isAllowedViewType(t)&&o)return void(o.style.visibility="hidden");"markdown"===(null==t?void 0:t.getViewType())?T.isSourceMode(t)?"following"===this.settings.positionStyle?o&&(o.style.visibility="hidden"):o&&(o.style.visibility="visible"):o&&(o.style.visibility="hidden"):o&&(o.style.visibility="visible"),o||setTimeout((()=>{V(this.app,this)}),100)}},this.handleeditingToolbar_layout=()=>{if(!this.settings.cMenuVisibility)return!1;const t=this.app.workspace.getActiveViewOfType(e.ItemView);let o=A(this.app,this.settings);if(!T.isAllowedViewType(t))return void(o&&(o.style.visibility="hidden"));"markdown"===(null==t?void 0:t.getViewType())?T.isSourceMode(t)?"following"===this.settings.positionStyle?o&&(o.style.visibility="hidden"):o&&(o.style.visibility="visible"):o&&(o.style.visibility="hidden"):o&&(o.style.visibility="visible"),o||setTimeout((()=>{V(this.app,this)}),100)},this.handleeditingToolbar_resize=()=>{var t;if(1!=this.settings.cMenuVisibility||"top"!=this.settings.positionStyle)return!1;{const o=app.workspace.getActiveViewOfType(e.ItemView);if(T.isSourceMode(o)){let o=null!==(t=this.app.workspace.activeLeaf.view.leaf.width)&&void 0!==t?t:0;if(this.Leaf_Width==o)return!1;if(o>0&&(this.Leaf_Width=o,this.settings.cMenuWidth&&o)){if(o-this.settings.cMenuWidth<78&&o>this.settings.cMenuWidth)return;setTimeout((()=>{(function(){M=e.requireApiVersion("0.15.0")?activeWindow.document:window.document;let t=M,o=t.querySelectorAll("#editingToolbarModalBar"),i=t.querySelectorAll("#editingToolbarPopoverBar");o.forEach((e=>{e&&(e.firstChild&&e.removeChild(e.firstChild),e.remove())})),i.forEach((e=>{e&&(e.firstChild&&e.removeChild(e.firstChild),e.remove())}))})(),V(app,this)}),200)}}}}}onload(){var o;return t(this,void 0,void 0,(function*(){const t=this.manifest.version;console.log("editingToolbar v"+t+" loaded"),ro=e.requireApiVersion("0.15.0")?activeWindow.document:window.document,yield this.loadSettings(),this.settingTab=new io(this.app,this),this.addSettingTab(this.settingTab),this.commandsManager=new uo(this),this.commandsManager.registerCommands();const i=this.commandsManager.getActiveEditor();this.app.workspace.onLayoutReady((()=>{this.statusBar=new so(this),this.statusBar.init()})),this.init_evt(ro,i),e.requireApiVersion("0.15.0")&&this.app.workspace.on("window-open",(e=>{this.init_evt(e.doc,i)}));const n=(null===(o=this.settings)||void 0===o?void 0:o.lastVersion)||"0.0.0",s=e=>{const t=e.split(".").map((e=>parseInt(e)));return{major:t[0]||0,minor:t[1]||0,patch:t[2]||0}},a=s(n);s(t);!("0.0.0"===n)&&(a.major<3||3===a.major&&a.minor<1)&&setTimeout((()=>{new Ut(this.app,this).open()}),3e3),this.settings.lastVersion=t,yield this.saveSettings();app.plugins.enabledPlugins.has("obsidian-memos")&&this.registerEvent(this.app.workspace.on("thino-editor-created",this.handleeditingToolbar)),this.registerEvent(this.app.workspace.on("active-leaf-change",this.handleeditingToolbar)),this.registerEvent(this.app.workspace.on("layout-change",this.handleeditingToolbar_layout)),this.registerEvent(this.app.workspace.on("resize",this.handleeditingToolbar_resize)),1==this.settings.cMenuVisibility&&setTimeout((()=>{dispatchEvent(new Event("editingToolbar-NewCommand"))}),100),Object.keys(no).forEach((t=>{e.addIcon(t,no[t])}))}))}isLoadMobile(){var t;let o=window.innerWidth>0?window.innerWidth:screen.width,i=!!(null===(t=this.settings)||void 0===t?void 0:t.isLoadOnMobile)&&this.settings.isLoadOnMobile;return!(e.Platform.isMobileApp&&!i&&o<=768)||(console.log("editing toolbar disable loading on mobile"),!1)}init_evt(e,o){this.EN_FontColor_Format_Brush=!1,this.EN_BG_Format_Brush=!1,this.EN_Text_Format_Brush=!1,this.formatBrushActive=!1,this.registerDomEvent(e,"mouseup",(e=>t(this,void 0,void 0,(function*(){if(e.button&&(this.EN_FontColor_Format_Brush||this.EN_BG_Format_Brush||this.EN_Text_Format_Brush||this.formatBrushActive)&&F(this),!this.isView())return;let t=this.commandsManager.getActiveEditor();if(null==t?void 0:t.hasFocus()){let e=A(this.app,this.settings);if(null==t.getSelection()||""==t.getSelection())return void(e&&"following"==this.settings.positionStyle&&(e.style.visibility="hidden"));this.EN_FontColor_Format_Brush?a(this.settings.cMenuFontColor,t):this.EN_BG_Format_Brush?r(this.settings.cMenuBackgroundColor,t):this.EN_Text_Format_Brush?R(0,t):this.formatBrushActive&&this.lastExecutedCommand?this.applyFormatBrush(t):"following"==this.settings.positionStyle&&P(this.app,this.settings,t)}else(this.EN_FontColor_Format_Brush||this.EN_BG_Format_Brush||this.EN_Text_Format_Brush||this.formatBrushActive)&&F(this)})))),this.registerDomEvent(ro,"keydown",(e=>{if("following"!==this.settings.positionStyle)return;const t=A(this.app,this.settings);!e.shiftKey&&t&&(t.style.visibility="hidden")})),this.registerDomEvent(ro,"wheel",(()=>{if("following"!==this.settings.positionStyle)return;const e=A(this.app,this.settings);e&&(e.style.visibility="hidden")}))}onunload(){I(),console.log("editingToolbar unloaded"),this.app.workspace.off("active-leaf-change",this.handleeditingToolbar),this.app.workspace.off("layout-change",this.handleeditingToolbar_layout),this.app.workspace.off("resize",this.handleeditingToolbar_resize)}isView(){const t=this.app.workspace.getActiveViewOfType(e.ItemView);return T.isAllowedViewType(t)}setIS_MORE_Button(e){this.IS_MORE_Button=e}setEN_BG_Format_Brush(e){this.EN_BG_Format_Brush=e}setEN_FontColor_Format_Brush(e){this.EN_FontColor_Format_Brush=e}setEN_Text_Format_Brush(e){this.EN_Text_Format_Brush=e}setTemp_Notice(e){this.Temp_Notice=e}loadSettings(){return t(this,void 0,void 0,(function*(){this.settings=Object.assign({},E,yield this.loadData())}))}getCurrentCommands(t){if(!this.settings.enableMultipleConfig)return this.settings.menuCommands;let o=t||this.settings.positionStyle;if(this.settings.isLoadOnMobile&&e.Platform.isMobileApp)return this.settings.mobileCommands;switch(o){case"following":return this.settings.followingCommands;case"top":return this.settings.topCommands;case"fixed":return this.settings.fixedCommands;default:return this.settings.menuCommands}}updateCurrentCommands(t){if(this.settings.enableMultipleConfig)if(this.settings.isLoadOnMobile&&e.Platform.isMobileApp)this.settings.mobileCommands=t;else switch(this.settings.positionStyle){case"following":this.settings.followingCommands=t;break;case"top":this.settings.topCommands=t;break;case"fixed":this.settings.fixedCommands=t;break;default:this.settings.menuCommands=t}else this.settings.menuCommands=t}saveSettings(){return t(this,void 0,void 0,(function*(){yield this.saveData(this.settings)}))}setLastExecutedCommand(e){this.lastExecutedCommand=e;const t=this.app.commands.commands[e];if(t&&t.name)this.lastExecutedCommandName=t.name;else{const t=e.split(":");this.lastExecutedCommandName=t[t.length-1].replace(/-/g," ")}}toggleFormatBrush(){this.lastExecutedCommand?(this.formatBrushActive=!this.formatBrushActive,this.formatBrushActive?(this.EN_FontColor_Format_Brush=!1,this.EN_BG_Format_Brush=!1,this.EN_Text_Format_Brush=!1,this.formatBrushNotice&&this.formatBrushNotice.hide(),this.formatBrushNotice=new e.Notice(f("Format brush ON! Select text to apply【")+this.lastExecutedCommandName+f("】format"),0)):this.formatBrushNotice&&(this.formatBrushNotice.hide(),this.formatBrushNotice=null)):new e.Notice(f("Please execute a editingToolbar format command first, then enable the format brush"))}applyFormatBrush(t){if(!this.lastExecutedCommand||!this.formatBrushActive)return;const o=this.app.commands.commands[this.lastExecutedCommand];o&&o.callback&&o.callback(),o&&o.editorCallback&&o.editorCallback(t,this.app.workspace.getActiveViewOfType(e.MarkdownView))}quiteAllFormatBrushes(){this.EN_FontColor_Format_Brush=!1,this.EN_BG_Format_Brush=!1,this.EN_Text_Format_Brush=!1,this.formatBrushActive&&(this.formatBrushActive=!1,this.formatBrushNotice&&(this.formatBrushNotice.hide(),this.formatBrushNotice=null)),this.Temp_Notice&&(this.Temp_Notice.hide(),this.Temp_Notice=null)}getCommandsManager(){return this.commandsManager}reloadCustomCommands(){this.commandsManager.reloadCustomCommands()}}module.exports=po;
/* nosourcemap */