diff --git a/app/assets/builds/tailwind.css b/app/assets/builds/tailwind.css index 0590c47..c2c2463 100644 --- a/app/assets/builds/tailwind.css +++ b/app/assets/builds/tailwind.css @@ -1166,6 +1166,10 @@ video { margin-top: 1.5rem; } +.mt-1 { + margin-top: 0.25rem; +} + .block { display: block; } @@ -1377,6 +1381,10 @@ video { grid-template-columns: repeat(7, minmax(0, 1fr)); } +.grid-cols-1 { + grid-template-columns: repeat(1, minmax(0, 1fr)); +} + .grid-rows-1 { grid-template-rows: repeat(1, minmax(0, 1fr)); } @@ -1622,6 +1630,11 @@ video { background-color: rgb(252 231 243 / var(--tw-bg-opacity)); } +.bg-pink-200 { + --tw-bg-opacity: 1; + background-color: rgb(251 207 232 / var(--tw-bg-opacity)); +} + .bg-pink-50 { --tw-bg-opacity: 1; background-color: rgb(253 242 248 / var(--tw-bg-opacity)); @@ -1637,14 +1650,14 @@ video { background-color: rgb(255 255 255 / var(--tw-bg-opacity)); } -.bg-pink-400 { +.bg-yellow-50 { --tw-bg-opacity: 1; - background-color: rgb(244 114 182 / var(--tw-bg-opacity)); + background-color: rgb(254 252 232 / var(--tw-bg-opacity)); } -.bg-pink-200 { +.bg-red-50 { --tw-bg-opacity: 1; - background-color: rgb(251 207 232 / var(--tw-bg-opacity)); + background-color: rgb(254 242 242 / var(--tw-bg-opacity)); } .bg-opacity-75 { @@ -1909,6 +1922,16 @@ video { color: rgb(219 39 119 / var(--tw-text-opacity)); } +.text-pink-800 { + --tw-text-opacity: 1; + color: rgb(157 23 77 / var(--tw-text-opacity)); +} + +.text-pink-900 { + --tw-text-opacity: 1; + color: rgb(131 24 67 / var(--tw-text-opacity)); +} + .text-red-200 { --tw-text-opacity: 1; color: rgb(254 202 202 / var(--tw-text-opacity)); @@ -1924,14 +1947,9 @@ video { color: rgb(255 255 255 / var(--tw-text-opacity)); } -.text-pink-900 { +.text-yellow-400 { --tw-text-opacity: 1; - color: rgb(131 24 67 / var(--tw-text-opacity)); -} - -.text-pink-800 { - --tw-text-opacity: 1; - color: rgb(157 23 77 / var(--tw-text-opacity)); + color: rgb(250 204 21 / var(--tw-text-opacity)); } .underline { @@ -2223,6 +2241,11 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { background-color: rgb(254 226 226 / var(--tw-bg-opacity)); } +.hover\:bg-yellow-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 249 195 / var(--tw-bg-opacity)); +} + .hover\:fill-blue-400:hover { fill: #60a5fa; } @@ -2290,6 +2313,11 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: rgb(248 113 113 / var(--tw-text-opacity)); } +.hover\:text-yellow-400:hover { + --tw-text-opacity: 1; + color: rgb(250 204 21 / var(--tw-text-opacity)); +} + .hover\:underline:hover { text-decoration-line: underline; } @@ -2381,6 +2409,16 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: rgb(219 234 254 / var(--tw-text-opacity)); } +.prose-code\:bg-pink-100 :is(:where(code):not(:where([class~="not-prose"] *))) { + --tw-bg-opacity: 1; + background-color: rgb(252 231 243 / var(--tw-bg-opacity)); +} + +.prose-code\:text-pink-900 :is(:where(code):not(:where([class~="not-prose"] *))) { + --tw-text-opacity: 1; + color: rgb(131 24 67 / var(--tw-text-opacity)); +} + .prose-ul\:mt-0 :is(:where(ul):not(:where([class~="not-prose"] *))) { margin-top: 0px; } @@ -2517,6 +2555,11 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { background-color: rgb(15 23 42 / var(--tw-bg-opacity)); } + .dark\:bg-yellow-900 { + --tw-bg-opacity: 1; + background-color: rgb(113 63 18 / var(--tw-bg-opacity)); + } + .dark\:text-amber-500 { --tw-text-opacity: 1; color: rgb(245 158 11 / var(--tw-text-opacity)); @@ -2592,6 +2635,16 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: rgb(49 46 129 / var(--tw-text-opacity)); } + .dark\:text-pink-100 { + --tw-text-opacity: 1; + color: rgb(252 231 243 / var(--tw-text-opacity)); + } + + .dark\:text-pink-200 { + --tw-text-opacity: 1; + color: rgb(251 207 232 / var(--tw-text-opacity)); + } + .dark\:text-pink-400 { --tw-text-opacity: 1; color: rgb(244 114 182 / var(--tw-text-opacity)); @@ -2617,14 +2670,9 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: rgb(255 255 255 / var(--tw-text-opacity)); } - .dark\:text-pink-200 { + .dark\:text-yellow-400 { --tw-text-opacity: 1; - color: rgb(251 207 232 / var(--tw-text-opacity)); - } - - .dark\:text-pink-100 { - --tw-text-opacity: 1; - color: rgb(252 231 243 / var(--tw-text-opacity)); + color: rgb(250 204 21 / var(--tw-text-opacity)); } .dark\:shadow-pink-200 { @@ -2747,6 +2795,11 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { background-color: rgb(2 6 23 / var(--tw-bg-opacity)); } + .dark\:hover\:bg-yellow-800:hover { + --tw-bg-opacity: 1; + background-color: rgb(133 77 14 / var(--tw-bg-opacity)); + } + .hover\:dark\:bg-blue-800:hover { --tw-bg-opacity: 1; background-color: rgb(30 64 175 / var(--tw-bg-opacity)); diff --git a/app/assets/js/app.js b/app/assets/js/app.js index 2829076..16ec487 100644 --- a/app/assets/js/app.js +++ b/app/assets/js/app.js @@ -3,11 +3,6 @@ import "../builds/tailwind.css"; import { md_gallery } from "./gallery.js"; (function() { - document.addEventListener('alpine:init', () => { - Alpine.magic('clipboard', () => { - return subject => navigator.clipboard.writeText(subject) - }) - }) document.addEventListener("DOMContentLoaded", function () { if (window.hljs !== undefined) { window.hljs.highlightAll(); diff --git a/public/assets/admin/app.css b/public/assets/admin/app.css new file mode 100644 index 0000000..d2d0ae0 --- /dev/null +++ b/public/assets/admin/app.css @@ -0,0 +1,2272 @@ +/* app/assets/builds/tailwind.css */ +*, +::before, +::after { + box-sizing: border-box; + border-width: 0; + border-style: solid; + border-color: #e5e7eb; +} +::before, +::after { + --tw-content: ""; +} +html { + line-height: 1.5; + -webkit-text-size-adjust: 100%; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + font-family: + ui-sans-serif, + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + Roboto, + "Helvetica Neue", + Arial, + "Noto Sans", + sans-serif, + "Apple Color Emoji", + "Segoe UI Emoji", + "Segoe UI Symbol", + "Noto Color Emoji"; + font-feature-settings: normal; + font-variation-settings: normal; +} +body { + margin: 0; + line-height: inherit; +} +hr { + height: 0; + color: inherit; + border-top-width: 1px; +} +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} +a { + color: inherit; + text-decoration: inherit; +} +b, +strong { + font-weight: bolder; +} +code, +kbd, +samp, +pre { + font-family: + ui-monospace, + SFMono-Regular, + Menlo, + Monaco, + Consolas, + "Liberation Mono", + "Courier New", + monospace; + font-size: 1em; +} +small { + font-size: 80%; +} +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} +sub { + bottom: -0.25em; +} +sup { + top: -0.5em; +} +table { + text-indent: 0; + border-color: inherit; + border-collapse: collapse; +} +button, +input, +optgroup, +select, +textarea { + font-family: inherit; + font-size: 100%; + font-weight: inherit; + line-height: inherit; + color: inherit; + margin: 0; + padding: 0; +} +button, +select { + text-transform: none; +} +button, +[type=button], +[type=reset], +[type=submit] { + -webkit-appearance: button; + background-color: transparent; + background-image: none; +} +:-moz-focusring { + outline: auto; +} +:-moz-ui-invalid { + box-shadow: none; +} +progress { + vertical-align: baseline; +} +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} +[type=search] { + -webkit-appearance: textfield; + outline-offset: -2px; +} +::-webkit-search-decoration { + -webkit-appearance: none; +} +::-webkit-file-upload-button { + -webkit-appearance: button; + font: inherit; +} +summary { + display: list-item; +} +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} +fieldset { + margin: 0; + padding: 0; +} +legend { + padding: 0; +} +ol, +ul, +menu { + list-style: none; + margin: 0; + padding: 0; +} +textarea { + resize: vertical; +} +input::-moz-placeholder, +textarea::-moz-placeholder { + opacity: 1; + color: #9ca3af; +} +input::placeholder, +textarea::placeholder { + opacity: 1; + color: #9ca3af; +} +button, +[role=button] { + cursor: pointer; +} +:disabled { + cursor: default; +} +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; + vertical-align: middle; +} +img, +video { + max-width: 100%; + height: auto; +} +[hidden] { + display: none; +} +*, +::before, +::after { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; +} +::backdrop { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; +} +.container { + width: 100%; +} +@media (min-width: 640px) { + .container { + max-width: 640px; + } +} +@media (min-width: 768px) { + .container { + max-width: 768px; + } +} +@media (min-width: 1024px) { + .container { + max-width: 1024px; + } +} +@media (min-width: 1280px) { + .container { + max-width: 1280px; + } +} +@media (min-width: 1536px) { + .container { + max-width: 1536px; + } +} +.prose { + color: var(--tw-prose-body); + max-width: 65ch; +} +.prose :where(p):not(:where([class~=not-prose] *)) { + margin-top: 1.25em; + margin-bottom: 1.25em; +} +.prose :where([class~=lead]):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-lead); + font-size: 1.25em; + line-height: 1.6; + margin-top: 1.2em; + margin-bottom: 1.2em; +} +.prose :where(a):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-links); + text-decoration: underline; + font-weight: 500; +} +.prose :where(strong):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-bold); + font-weight: 600; +} +.prose :where(a strong):not(:where([class~=not-prose] *)) { + color: inherit; +} +.prose :where(blockquote strong):not(:where([class~=not-prose] *)) { + color: inherit; +} +.prose :where(thead th strong):not(:where([class~=not-prose] *)) { + color: inherit; +} +.prose :where(ol):not(:where([class~=not-prose] *)) { + list-style-type: decimal; + margin-top: 1.25em; + margin-bottom: 1.25em; + padding-left: 1.625em; +} +.prose :where(ol[type=A]):not(:where([class~=not-prose] *)) { + list-style-type: upper-alpha; +} +.prose :where(ol[type=a]):not(:where([class~=not-prose] *)) { + list-style-type: lower-alpha; +} +.prose :where(ol[type=A s]):not(:where([class~=not-prose] *)) { + list-style-type: upper-alpha; +} +.prose :where(ol[type=a s]):not(:where([class~=not-prose] *)) { + list-style-type: lower-alpha; +} +.prose :where(ol[type=I]):not(:where([class~=not-prose] *)) { + list-style-type: upper-roman; +} +.prose :where(ol[type=i]):not(:where([class~=not-prose] *)) { + list-style-type: lower-roman; +} +.prose :where(ol[type=I s]):not(:where([class~=not-prose] *)) { + list-style-type: upper-roman; +} +.prose :where(ol[type=i s]):not(:where([class~=not-prose] *)) { + list-style-type: lower-roman; +} +.prose :where(ol[type="1"]):not(:where([class~=not-prose] *)) { + list-style-type: decimal; +} +.prose :where(ul):not(:where([class~=not-prose] *)) { + list-style-type: disc; + margin-top: 1.25em; + margin-bottom: 1.25em; + padding-left: 1.625em; +} +.prose :where(ol > li):not(:where([class~=not-prose] *))::marker { + font-weight: 400; + color: var(--tw-prose-counters); +} +.prose :where(ul > li):not(:where([class~=not-prose] *))::marker { + color: var(--tw-prose-bullets); +} +.prose :where(hr):not(:where([class~=not-prose] *)) { + border-color: var(--tw-prose-hr); + border-top-width: 1px; + margin-top: 3em; + margin-bottom: 3em; +} +.prose :where(blockquote):not(:where([class~=not-prose] *)) { + font-weight: 500; + font-style: italic; + color: var(--tw-prose-quotes); + border-left-width: 0.25rem; + border-left-color: var(--tw-prose-quote-borders); + quotes: "\201c""\201d""\2018""\2019"; + margin-top: 1.6em; + margin-bottom: 1.6em; + padding-left: 1em; +} +.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose] *))::before { + content: open-quote; +} +.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose] *))::after { + content: close-quote; +} +.prose :where(h1):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-headings); + font-weight: 800; + font-size: 2.25em; + margin-top: 0; + margin-bottom: 0.8888889em; + line-height: 1.1111111; +} +.prose :where(h1 strong):not(:where([class~=not-prose] *)) { + font-weight: 900; + color: inherit; +} +.prose :where(h2):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-headings); + font-weight: 700; + font-size: 1.5em; + margin-top: 2em; + margin-bottom: 1em; + line-height: 1.3333333; +} +.prose :where(h2 strong):not(:where([class~=not-prose] *)) { + font-weight: 800; + color: inherit; +} +.prose :where(h3):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-headings); + font-weight: 600; + font-size: 1.25em; + margin-top: 1.6em; + margin-bottom: 0.6em; + line-height: 1.6; +} +.prose :where(h3 strong):not(:where([class~=not-prose] *)) { + font-weight: 700; + color: inherit; +} +.prose :where(h4):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-headings); + font-weight: 600; + margin-top: 1.5em; + margin-bottom: 0.5em; + line-height: 1.5; +} +.prose :where(h4 strong):not(:where([class~=not-prose] *)) { + font-weight: 700; + color: inherit; +} +.prose :where(img):not(:where([class~=not-prose] *)) { + margin-top: 2em; + margin-bottom: 2em; +} +.prose :where(figure > *):not(:where([class~=not-prose] *)) { + margin-top: 0; + margin-bottom: 0; +} +.prose :where(figcaption):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-captions); + font-size: 0.875em; + line-height: 1.4285714; + margin-top: 0.8571429em; +} +.prose :where(code):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-code); + font-weight: 600; + font-size: 0.875em; +} +.prose :where(code):not(:where([class~=not-prose] *))::before { + content: "`"; +} +.prose :where(code):not(:where([class~=not-prose] *))::after { + content: "`"; +} +.prose :where(a code):not(:where([class~=not-prose] *)) { + color: inherit; +} +.prose :where(h1 code):not(:where([class~=not-prose] *)) { + color: inherit; +} +.prose :where(h2 code):not(:where([class~=not-prose] *)) { + color: inherit; + font-size: 0.875em; +} +.prose :where(h3 code):not(:where([class~=not-prose] *)) { + color: inherit; + font-size: 0.9em; +} +.prose :where(h4 code):not(:where([class~=not-prose] *)) { + color: inherit; +} +.prose :where(blockquote code):not(:where([class~=not-prose] *)) { + color: inherit; +} +.prose :where(thead th code):not(:where([class~=not-prose] *)) { + color: inherit; +} +.prose :where(pre):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-pre-code); + background-color: var(--tw-prose-pre-bg); + overflow-x: auto; + font-weight: 400; + font-size: 0.875em; + line-height: 1.7142857; + margin-top: 1.7142857em; + margin-bottom: 1.7142857em; + border-radius: 0.375rem; + padding-top: 0.8571429em; + padding-right: 1.1428571em; + padding-bottom: 0.8571429em; + padding-left: 1.1428571em; +} +.prose :where(pre code):not(:where([class~=not-prose] *)) { + background-color: transparent; + border-width: 0; + border-radius: 0; + padding: 0; + font-weight: inherit; + color: inherit; + font-size: inherit; + font-family: inherit; + line-height: inherit; +} +.prose :where(pre code):not(:where([class~=not-prose] *))::before { + content: none; +} +.prose :where(pre code):not(:where([class~=not-prose] *))::after { + content: none; +} +.prose :where(table):not(:where([class~=not-prose] *)) { + width: 100%; + table-layout: auto; + text-align: left; + margin-top: 2em; + margin-bottom: 2em; + font-size: 0.875em; + line-height: 1.7142857; +} +.prose :where(thead):not(:where([class~=not-prose] *)) { + border-bottom-width: 1px; + border-bottom-color: var(--tw-prose-th-borders); +} +.prose :where(thead th):not(:where([class~=not-prose] *)) { + color: var(--tw-prose-headings); + font-weight: 600; + vertical-align: bottom; + padding-right: 0.5714286em; + padding-bottom: 0.5714286em; + padding-left: 0.5714286em; +} +.prose :where(tbody tr):not(:where([class~=not-prose] *)) { + border-bottom-width: 1px; + border-bottom-color: var(--tw-prose-td-borders); +} +.prose :where(tbody tr:last-child):not(:where([class~=not-prose] *)) { + border-bottom-width: 0; +} +.prose :where(tbody td):not(:where([class~=not-prose] *)) { + vertical-align: baseline; +} +.prose :where(tfoot):not(:where([class~=not-prose] *)) { + border-top-width: 1px; + border-top-color: var(--tw-prose-th-borders); +} +.prose :where(tfoot td):not(:where([class~=not-prose] *)) { + vertical-align: top; +} +.prose { + --tw-prose-body: #374151; + --tw-prose-headings: #111827; + --tw-prose-lead: #4b5563; + --tw-prose-links: #111827; + --tw-prose-bold: #111827; + --tw-prose-counters: #6b7280; + --tw-prose-bullets: #d1d5db; + --tw-prose-hr: #e5e7eb; + --tw-prose-quotes: #111827; + --tw-prose-quote-borders: #e5e7eb; + --tw-prose-captions: #6b7280; + --tw-prose-code: #111827; + --tw-prose-pre-code: #e5e7eb; + --tw-prose-pre-bg: #1f2937; + --tw-prose-th-borders: #d1d5db; + --tw-prose-td-borders: #e5e7eb; + --tw-prose-invert-body: #d1d5db; + --tw-prose-invert-headings: #fff; + --tw-prose-invert-lead: #9ca3af; + --tw-prose-invert-links: #fff; + --tw-prose-invert-bold: #fff; + --tw-prose-invert-counters: #9ca3af; + --tw-prose-invert-bullets: #4b5563; + --tw-prose-invert-hr: #374151; + --tw-prose-invert-quotes: #f3f4f6; + --tw-prose-invert-quote-borders: #374151; + --tw-prose-invert-captions: #9ca3af; + --tw-prose-invert-code: #fff; + --tw-prose-invert-pre-code: #d1d5db; + --tw-prose-invert-pre-bg: rgb(0 0 0 / 50%); + --tw-prose-invert-th-borders: #4b5563; + --tw-prose-invert-td-borders: #374151; + font-size: 1rem; + line-height: 1.75; +} +.prose :where(video):not(:where([class~=not-prose] *)) { + margin-top: 2em; + margin-bottom: 2em; +} +.prose :where(figure):not(:where([class~=not-prose] *)) { + margin-top: 2em; + margin-bottom: 2em; +} +.prose :where(li):not(:where([class~=not-prose] *)) { + margin-top: 0.5em; + margin-bottom: 0.5em; +} +.prose :where(ol > li):not(:where([class~=not-prose] *)) { + padding-left: 0.375em; +} +.prose :where(ul > li):not(:where([class~=not-prose] *)) { + padding-left: 0.375em; +} +.prose :where(.prose > ul > li p):not(:where([class~=not-prose] *)) { + margin-top: 0.75em; + margin-bottom: 0.75em; +} +.prose :where(.prose > ul > li > *:first-child):not(:where([class~=not-prose] *)) { + margin-top: 1.25em; +} +.prose :where(.prose > ul > li > *:last-child):not(:where([class~=not-prose] *)) { + margin-bottom: 1.25em; +} +.prose :where(.prose > ol > li > *:first-child):not(:where([class~=not-prose] *)) { + margin-top: 1.25em; +} +.prose :where(.prose > ol > li > *:last-child):not(:where([class~=not-prose] *)) { + margin-bottom: 1.25em; +} +.prose :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~=not-prose] *)) { + margin-top: 0.75em; + margin-bottom: 0.75em; +} +.prose :where(hr + *):not(:where([class~=not-prose] *)) { + margin-top: 0; +} +.prose :where(h2 + *):not(:where([class~=not-prose] *)) { + margin-top: 0; +} +.prose :where(h3 + *):not(:where([class~=not-prose] *)) { + margin-top: 0; +} +.prose :where(h4 + *):not(:where([class~=not-prose] *)) { + margin-top: 0; +} +.prose :where(thead th:first-child):not(:where([class~=not-prose] *)) { + padding-left: 0; +} +.prose :where(thead th:last-child):not(:where([class~=not-prose] *)) { + padding-right: 0; +} +.prose :where(tbody td, tfoot td):not(:where([class~=not-prose] *)) { + padding-top: 0.5714286em; + padding-right: 0.5714286em; + padding-bottom: 0.5714286em; + padding-left: 0.5714286em; +} +.prose :where(tbody td:first-child, tfoot td:first-child):not(:where([class~=not-prose] *)) { + padding-left: 0; +} +.prose :where(tbody td:last-child, tfoot td:last-child):not(:where([class~=not-prose] *)) { + padding-right: 0; +} +.prose :where(.prose > :first-child):not(:where([class~=not-prose] *)) { + margin-top: 0; +} +.prose :where(.prose > :last-child):not(:where([class~=not-prose] *)) { + margin-bottom: 0; +} +.fixed { + position: fixed; +} +.absolute { + position: absolute; +} +.relative { + position: relative; +} +.inset-0 { + inset: 0px; +} +.-top-4 { + top: -1rem; +} +.z-40 { + z-index: 40; +} +.z-50 { + z-index: 50; +} +.col-span-1 { + grid-column: span 1 / span 1; +} +.col-span-4 { + grid-column: span 4 / span 4; +} +.col-span-5 { + grid-column: span 5 / span 5; +} +.col-span-7 { + grid-column: span 7 / span 7; +} +.float-right { + float: right; +} +.float-left { + float: left; +} +.m-0 { + margin: 0px; +} +.m-2 { + margin: 0.5rem; +} +.mx-auto { + margin-left: auto; + margin-right: auto; +} +.my-auto { + margin-top: auto; + margin-bottom: auto; +} +.mb-0 { + margin-bottom: 0px; +} +.mb-1 { + margin-bottom: 0.25rem; +} +.mb-12 { + margin-bottom: 3rem; +} +.mb-2 { + margin-bottom: 0.5rem; +} +.mb-4 { + margin-bottom: 1rem; +} +.mb-6 { + margin-bottom: 1.5rem; +} +.mb-8 { + margin-bottom: 2rem; +} +.mb-\[20\] { + margin-bottom: 20; +} +.ml-1 { + margin-left: 0.25rem; +} +.ml-1\.5 { + margin-left: 0.375rem; +} +.ml-\[5\] { + margin-left: 5; +} +.mr-0 { + margin-right: 0px; +} +.mr-1 { + margin-right: 0.25rem; +} +.mr-1\.5 { + margin-right: 0.375rem; +} +.mr-2 { + margin-right: 0.5rem; +} +.mr-4 { + margin-right: 1rem; +} +.mt-0 { + margin-top: 0px; +} +.mt-0\.5 { + margin-top: 0.125rem; +} +.mt-12 { + margin-top: 3rem; +} +.mt-2 { + margin-top: 0.5rem; +} +.mt-4 { + margin-top: 1rem; +} +.mt-6 { + margin-top: 1.5rem; +} +.mt-1 { + margin-top: 0.25rem; +} +.block { + display: block; +} +.inline-block { + display: inline-block; +} +.inline { + display: inline; +} +.flex { + display: flex; +} +.table { + display: table; +} +.grid { + display: grid; +} +.hidden { + display: none; +} +.h-16 { + height: 4rem; +} +.h-2 { + height: 0.5rem; +} +.h-32 { + height: 8rem; +} +.h-44 { + height: 11rem; +} +.h-48 { + height: 12rem; +} +.h-8 { + height: 2rem; +} +.max-h-12 { + max-height: 3rem; +} +.max-h-full { + max-height: 100%; +} +.w-1 { + width: 0.25rem; +} +.w-14 { + width: 3.5rem; +} +.w-2 { + width: 0.5rem; +} +.w-24 { + width: 6rem; +} +.w-32 { + width: 8rem; +} +.w-36 { + width: 9rem; +} +.w-4 { + width: 1rem; +} +.w-44 { + width: 11rem; +} +.w-48 { + width: 12rem; +} +.w-6 { + width: 1.5rem; +} +.w-8 { + width: 2rem; +} +.w-full { + width: 100%; +} +.w-screen { + width: 100vw; +} +.max-w-3xl { + max-width: 48rem; +} +.max-w-prose { + max-width: 65ch; +} +.max-w-screen-md { + max-width: 768px; +} +.max-w-xs { + max-width: 20rem; +} +.flex-1 { + flex: 1 1 0%; +} +.flex-auto { + flex: 1 1 auto; +} +.flex-initial { + flex: 0 1 auto; +} +.flex-none { + flex: none; +} +.grow { + flex-grow: 1; +} +.basis-auto { + flex-basis: auto; +} +.table-auto { + table-layout: auto; +} +.table-fixed { + table-layout: fixed; +} +.-rotate-45 { + --tw-rotate: -45deg; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} +.cursor-pointer { + cursor: pointer; +} +.resize { + resize: both; +} +.columns-2 { + -moz-columns: 2; + columns: 2; +} +.break-inside-avoid-column { + -moz-column-break-inside: avoid; + break-inside: avoid-column; +} +.grid-flow-row { + grid-auto-flow: row; +} +.grid-flow-col { + grid-auto-flow: column; +} +.grid-cols-2 { + grid-template-columns: repeat(2, minmax(0, 1fr)); +} +.grid-cols-3 { + grid-template-columns: repeat(3, minmax(0, 1fr)); +} +.grid-cols-4 { + grid-template-columns: repeat(4, minmax(0, 1fr)); +} +.grid-cols-5 { + grid-template-columns: repeat(5, minmax(0, 1fr)); +} +.grid-cols-7 { + grid-template-columns: repeat(7, minmax(0, 1fr)); +} +.grid-cols-1 { + grid-template-columns: repeat(1, minmax(0, 1fr)); +} +.grid-rows-1 { + grid-template-rows: repeat(1, minmax(0, 1fr)); +} +.grid-rows-2 { + grid-template-rows: repeat(2, minmax(0, 1fr)); +} +.flex-row { + flex-direction: row; +} +.flex-col { + flex-direction: column; +} +.content-center { + align-content: center; +} +.items-center { + align-items: center; +} +.justify-end { + justify-content: flex-end; +} +.justify-center { + justify-content: center; +} +.justify-between { + justify-content: space-between; +} +.gap-2 { + gap: 0.5rem; +} +.gap-4 { + gap: 1rem; +} +.gap-x-1 { + -moz-column-gap: 0.25rem; + column-gap: 0.25rem; +} +.gap-x-1\.5 { + -moz-column-gap: 0.375rem; + column-gap: 0.375rem; +} +.space-x-1 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.25rem * var(--tw-space-x-reverse)); + margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse))); +} +.overflow-auto { + overflow: auto; +} +.overflow-hidden { + overflow: hidden; +} +.text-ellipsis { + text-overflow: ellipsis; +} +.break-normal { + overflow-wrap: normal; + word-break: normal; +} +.rounded { + border-radius: 0.25rem; +} +.rounded-full { + border-radius: 9999px; +} +.rounded-lg { + border-radius: 0.5rem; +} +.rounded-md { + border-radius: 0.375rem; +} +.border { + border-width: 1px; +} +.border-2 { + border-width: 2px; +} +.border-b-2 { + border-bottom-width: 2px; +} +.border-b-4 { + border-bottom-width: 4px; +} +.border-l-2 { + border-left-width: 2px; +} +.border-t { + border-top-width: 1px; +} +.border-solid { + border-style: solid; +} +.border-blue-200 { + --tw-border-opacity: 1; + border-color: rgb(191 219 254 / var(--tw-border-opacity)); +} +.border-blue-400 { + --tw-border-opacity: 1; + border-color: rgb(96 165 250 / var(--tw-border-opacity)); +} +.border-gray-200 { + --tw-border-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-border-opacity)); +} +.border-gray-400 { + --tw-border-opacity: 1; + border-color: rgb(156 163 175 / var(--tw-border-opacity)); +} +.border-orange-200 { + --tw-border-opacity: 1; + border-color: rgb(254 215 170 / var(--tw-border-opacity)); +} +.border-transparent { + border-color: transparent; +} +.bg-black { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); +} +.bg-blue-100 { + --tw-bg-opacity: 1; + background-color: rgb(219 234 254 / var(--tw-bg-opacity)); +} +.bg-blue-200 { + --tw-bg-opacity: 1; + background-color: rgb(191 219 254 / var(--tw-bg-opacity)); +} +.bg-blue-300 { + --tw-bg-opacity: 1; + background-color: rgb(147 197 253 / var(--tw-bg-opacity)); +} +.bg-blue-400 { + --tw-bg-opacity: 1; + background-color: rgb(96 165 250 / var(--tw-bg-opacity)); +} +.bg-blue-50 { + --tw-bg-opacity: 1; + background-color: rgb(239 246 255 / var(--tw-bg-opacity)); +} +.bg-blue-500 { + --tw-bg-opacity: 1; + background-color: rgb(59 130 246 / var(--tw-bg-opacity)); +} +.bg-emerald-50 { + --tw-bg-opacity: 1; + background-color: rgb(236 253 245 / var(--tw-bg-opacity)); +} +.bg-fuchsia-100 { + --tw-bg-opacity: 1; + background-color: rgb(250 232 255 / var(--tw-bg-opacity)); +} +.bg-fuchsia-50 { + --tw-bg-opacity: 1; + background-color: rgb(253 244 255 / var(--tw-bg-opacity)); +} +.bg-gray-100 { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} +.bg-gray-50 { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity)); +} +.bg-green-500 { + --tw-bg-opacity: 1; + background-color: rgb(34 197 94 / var(--tw-bg-opacity)); +} +.bg-indigo-100 { + --tw-bg-opacity: 1; + background-color: rgb(224 231 255 / var(--tw-bg-opacity)); +} +.bg-indigo-300 { + --tw-bg-opacity: 1; + background-color: rgb(165 180 252 / var(--tw-bg-opacity)); +} +.bg-indigo-50 { + --tw-bg-opacity: 1; + background-color: rgb(238 242 255 / var(--tw-bg-opacity)); +} +.bg-orange-100 { + --tw-bg-opacity: 1; + background-color: rgb(255 237 213 / var(--tw-bg-opacity)); +} +.bg-orange-500 { + --tw-bg-opacity: 1; + background-color: rgb(249 115 22 / var(--tw-bg-opacity)); +} +.bg-pink-100 { + --tw-bg-opacity: 1; + background-color: rgb(252 231 243 / var(--tw-bg-opacity)); +} +.bg-pink-200 { + --tw-bg-opacity: 1; + background-color: rgb(251 207 232 / var(--tw-bg-opacity)); +} +.bg-pink-50 { + --tw-bg-opacity: 1; + background-color: rgb(253 242 248 / var(--tw-bg-opacity)); +} +.bg-red-400 { + --tw-bg-opacity: 1; + background-color: rgb(248 113 113 / var(--tw-bg-opacity)); +} +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} +.bg-yellow-50 { + --tw-bg-opacity: 1; + background-color: rgb(254 252 232 / var(--tw-bg-opacity)); +} +.bg-red-50 { + --tw-bg-opacity: 1; + background-color: rgb(254 242 242 / var(--tw-bg-opacity)); +} +.bg-opacity-75 { + --tw-bg-opacity: 0.75; +} +.fill-blue-100 { + fill: #dbeafe; +} +.fill-current { + fill: currentColor; +} +.fill-pink-100 { + fill: #fce7f3; +} +.fill-purple-100 { + fill: #f3e8ff; +} +.object-contain { + -o-object-fit: contain; + object-fit: contain; +} +.object-cover { + -o-object-fit: cover; + object-fit: cover; +} +.p-0 { + padding: 0px; +} +.p-1 { + padding: 0.25rem; +} +.p-2 { + padding: 0.5rem; +} +.p-4 { + padding: 1rem; +} +.px-1 { + padding-left: 0.25rem; + padding-right: 0.25rem; +} +.px-2 { + padding-left: 0.5rem; + padding-right: 0.5rem; +} +.px-4 { + padding-left: 1rem; + padding-right: 1rem; +} +.px-8 { + padding-left: 2rem; + padding-right: 2rem; +} +.py-2 { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} +.pb-10 { + padding-bottom: 2.5rem; +} +.pb-4 { + padding-bottom: 1rem; +} +.pb-8 { + padding-bottom: 2rem; +} +.pl-6 { + padding-left: 1.5rem; +} +.pr-2 { + padding-right: 0.5rem; +} +.pr-8 { + padding-right: 2rem; +} +.pt-1 { + padding-top: 0.25rem; +} +.pt-2 { + padding-top: 0.5rem; +} +.pt-4 { + padding-top: 1rem; +} +.text-left { + text-align: left; +} +.text-center { + text-align: center; +} +.text-right { + text-align: right; +} +.align-middle { + vertical-align: middle; +} +.text-4xl { + font-size: 2.441rem; +} +.text-\[2\.041rem\] { + font-size: 2.041rem; +} +.text-base { + font-size: 1rem; +} +.text-sm { + font-size: 0.8rem; +} +.text-xl { + font-size: 1.25rem; +} +.font-bold { + font-weight: 700; +} +.font-extrabold { + font-weight: 800; +} +.font-semibold { + font-weight: 600; +} +.uppercase { + text-transform: uppercase; +} +.leading-6 { + line-height: 1.5rem; +} +.leading-relaxed { + line-height: 1.625; +} +.text-blue-100 { + --tw-text-opacity: 1; + color: rgb(219 234 254 / var(--tw-text-opacity)); +} +.text-blue-200 { + --tw-text-opacity: 1; + color: rgb(191 219 254 / var(--tw-text-opacity)); +} +.text-blue-400 { + --tw-text-opacity: 1; + color: rgb(96 165 250 / var(--tw-text-opacity)); +} +.text-blue-500 { + --tw-text-opacity: 1; + color: rgb(59 130 246 / var(--tw-text-opacity)); +} +.text-blue-600 { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); +} +.text-blue-900 { + --tw-text-opacity: 1; + color: rgb(30 58 138 / var(--tw-text-opacity)); +} +.text-emerald-400 { + --tw-text-opacity: 1; + color: rgb(52 211 153 / var(--tw-text-opacity)); +} +.text-fuchsia-200 { + --tw-text-opacity: 1; + color: rgb(245 208 254 / var(--tw-text-opacity)); +} +.text-gray-100 { + --tw-text-opacity: 1; + color: rgb(243 244 246 / var(--tw-text-opacity)); +} +.text-gray-200 { + --tw-text-opacity: 1; + color: rgb(229 231 235 / var(--tw-text-opacity)); +} +.text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} +.text-gray-600 { + --tw-text-opacity: 1; + color: rgb(75 85 99 / var(--tw-text-opacity)); +} +.text-gray-800 { + --tw-text-opacity: 1; + color: rgb(31 41 55 / var(--tw-text-opacity)); +} +.text-green-100 { + --tw-text-opacity: 1; + color: rgb(220 252 231 / var(--tw-text-opacity)); +} +.text-indigo-400 { + --tw-text-opacity: 1; + color: rgb(129 140 248 / var(--tw-text-opacity)); +} +.text-indigo-900 { + --tw-text-opacity: 1; + color: rgb(49 46 129 / var(--tw-text-opacity)); +} +.text-orange-100 { + --tw-text-opacity: 1; + color: rgb(255 237 213 / var(--tw-text-opacity)); +} +.text-pink-400 { + --tw-text-opacity: 1; + color: rgb(244 114 182 / var(--tw-text-opacity)); +} +.text-pink-600 { + --tw-text-opacity: 1; + color: rgb(219 39 119 / var(--tw-text-opacity)); +} +.text-pink-800 { + --tw-text-opacity: 1; + color: rgb(157 23 77 / var(--tw-text-opacity)); +} +.text-pink-900 { + --tw-text-opacity: 1; + color: rgb(131 24 67 / var(--tw-text-opacity)); +} +.text-red-200 { + --tw-text-opacity: 1; + color: rgb(254 202 202 / var(--tw-text-opacity)); +} +.text-red-600 { + --tw-text-opacity: 1; + color: rgb(220 38 38 / var(--tw-text-opacity)); +} +.text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} +.text-yellow-400 { + --tw-text-opacity: 1; + color: rgb(250 204 21 / var(--tw-text-opacity)); +} +.underline { + text-decoration-line: underline; +} +.no-underline { + text-decoration-line: none; +} +.decoration-wavy { + text-decoration-style: wavy; +} +.shadow-solid { + --tw-shadow: 10px 10px 1px 2px; + --tw-shadow-colored: 10px 10px 1px 2px var(--tw-shadow-color); + box-shadow: + var(--tw-ring-offset-shadow, 0 0 #0000), + var(--tw-ring-shadow, 0 0 #0000), + var(--tw-shadow); +} +.shadow-pink-100 { + --tw-shadow-color: #fce7f3; + --tw-shadow: var(--tw-shadow-colored); +} +.outline-none { + outline: 2px solid transparent; + outline-offset: 2px; +} +.transition { + transition-property: + color, + background-color, + border-color, + text-decoration-color, + fill, + stroke, + opacity, + box-shadow, + transform, + filter, + -webkit-backdrop-filter; + transition-property: + color, + background-color, + border-color, + text-decoration-color, + fill, + stroke, + opacity, + box-shadow, + transform, + filter, + backdrop-filter; + transition-property: + color, + background-color, + border-color, + text-decoration-color, + fill, + stroke, + opacity, + box-shadow, + transform, + filter, + backdrop-filter, + -webkit-backdrop-filter; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} +.transition-colors { + transition-property: + color, + background-color, + border-color, + text-decoration-color, + fill, + stroke; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} +.transition-transform { + transition-property: transform; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} +.ease-out { + transition-timing-function: cubic-bezier(0, 0, 0.2, 1); +} +@tailwind typography; +@font-face { + font-family: "Rubik"; + src: url("../Rubik-VariableFont_wght-HRLVMUVA.ttf") format("truetype"); + font-display: swap; +} +@font-face { + font-family: "JetBrainsMono"; + src: url("../JetBrainsMono-VariableFont_wght-LU32XR3Q.ttf") format("truetype"); + font-display: swap; +} +@font-face { + font-family: "Karla"; + src: url("../Karla-VariableFont_wght-6X53IMBB.ttf") format("truetype"); + font-display: swap; +} +* { + font-family: + "Karla", + Helvetica, + Arial, + sans-serif; +} +h1, +h2, +h3, +h4, +h5, +h6, +h1 a, +h2 a, +h3 a, +h4 a, +h5 a, +h6 a { + font-family: + "Rubik", + Helvetica, + Arial, + sans-serif; +} +.prose h1 a { + border-bottom: none; + text-decoration: none; +} +.prose h1 a:hover { + opacity: 0.8; +} +.gist tr { + border-bottom: none; +} +.gist span { + font-family: + "JetBrainsMono", + Monaco, + monospace; +} +.map-marker { + border: 3px solid blue; + border-radius: 8px; + background: RGBa(0, 0, 255, 0.1); + width: 14px; + height: 14px; +} +.prose pre code::before { + padding-left: unset; +} +.prose pre code:after { + padding-right: unset; +} +.prose code { + font-weight: 400; + border-radius: 0.25rem; +} +.prose code:before { + content: ""; + padding: 0 0 0 0.25rem; +} +.prose pre { + padding: 0; +} +.prose code:after { + content: ""; + padding: 0 0.25rem 0 0; +} +.video-container { + position: relative; + padding-bottom: 56.25%; + height: 0; +} +.video-container iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border-radius: 8px; +} +@media (prefers-color-scheme: dark) { + .dark\:prose-invert { + --tw-prose-body: var(--tw-prose-invert-body); + --tw-prose-headings: var(--tw-prose-invert-headings); + --tw-prose-lead: var(--tw-prose-invert-lead); + --tw-prose-links: var(--tw-prose-invert-links); + --tw-prose-bold: var(--tw-prose-invert-bold); + --tw-prose-counters: var(--tw-prose-invert-counters); + --tw-prose-bullets: var(--tw-prose-invert-bullets); + --tw-prose-hr: var(--tw-prose-invert-hr); + --tw-prose-quotes: var(--tw-prose-invert-quotes); + --tw-prose-quote-borders: var(--tw-prose-invert-quote-borders); + --tw-prose-captions: var(--tw-prose-invert-captions); + --tw-prose-code: var(--tw-prose-invert-code); + --tw-prose-pre-code: var(--tw-prose-invert-pre-code); + --tw-prose-pre-bg: var(--tw-prose-invert-pre-bg); + --tw-prose-th-borders: var(--tw-prose-invert-th-borders); + --tw-prose-td-borders: var(--tw-prose-invert-td-borders); + } +} +.selection\:bg-blue-100 *::-moz-selection { + --tw-bg-opacity: 1; + background-color: rgb(219 234 254 / var(--tw-bg-opacity)); +} +.selection\:bg-blue-100 *::selection { + --tw-bg-opacity: 1; + background-color: rgb(219 234 254 / var(--tw-bg-opacity)); +} +.selection\:text-blue-900 *::-moz-selection { + --tw-text-opacity: 1; + color: rgb(30 58 138 / var(--tw-text-opacity)); +} +.selection\:text-blue-900 *::selection { + --tw-text-opacity: 1; + color: rgb(30 58 138 / var(--tw-text-opacity)); +} +.selection\:bg-blue-100::-moz-selection { + --tw-bg-opacity: 1; + background-color: rgb(219 234 254 / var(--tw-bg-opacity)); +} +.selection\:bg-blue-100::selection { + --tw-bg-opacity: 1; + background-color: rgb(219 234 254 / var(--tw-bg-opacity)); +} +.selection\:text-blue-900::-moz-selection { + --tw-text-opacity: 1; + color: rgb(30 58 138 / var(--tw-text-opacity)); +} +.selection\:text-blue-900::selection { + --tw-text-opacity: 1; + color: rgb(30 58 138 / var(--tw-text-opacity)); +} +.hover\:scale-105:hover { + --tw-scale-x: 1.05; + --tw-scale-y: 1.05; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} +.hover\:cursor-pointer:hover { + cursor: pointer; +} +.hover\:border-b-2:hover { + border-bottom-width: 2px; +} +.hover\:border-blue-600:hover { + --tw-border-opacity: 1; + border-color: rgb(37 99 235 / var(--tw-border-opacity)); +} +.hover\:bg-blue-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(219 234 254 / var(--tw-bg-opacity)); +} +.hover\:bg-blue-200:hover { + --tw-bg-opacity: 1; + background-color: rgb(191 219 254 / var(--tw-bg-opacity)); +} +.hover\:bg-blue-300:hover { + --tw-bg-opacity: 1; + background-color: rgb(147 197 253 / var(--tw-bg-opacity)); +} +.hover\:bg-emerald-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(209 250 229 / var(--tw-bg-opacity)); +} +.hover\:bg-fuchsia-200:hover { + --tw-bg-opacity: 1; + background-color: rgb(245 208 254 / var(--tw-bg-opacity)); +} +.hover\:bg-gray-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} +.hover\:bg-orange-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(255 237 213 / var(--tw-bg-opacity)); +} +.hover\:bg-orange-200:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 215 170 / var(--tw-bg-opacity)); +} +.hover\:bg-pink-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(252 231 243 / var(--tw-bg-opacity)); +} +.hover\:bg-pink-200:hover { + --tw-bg-opacity: 1; + background-color: rgb(251 207 232 / var(--tw-bg-opacity)); +} +.hover\:bg-red-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 226 226 / var(--tw-bg-opacity)); +} +.hover\:bg-yellow-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 249 195 / var(--tw-bg-opacity)); +} +.hover\:fill-blue-400:hover { + fill: #60a5fa; +} +.hover\:fill-pink-400:hover { + fill: #f472b6; +} +.hover\:fill-purple-400:hover { + fill: #c084fc; +} +.hover\:text-blue-400:hover { + --tw-text-opacity: 1; + color: rgb(96 165 250 / var(--tw-text-opacity)); +} +.hover\:text-blue-600:hover { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); +} +.hover\:text-blue-900:hover { + --tw-text-opacity: 1; + color: rgb(30 58 138 / var(--tw-text-opacity)); +} +.hover\:text-emerald-400:hover { + --tw-text-opacity: 1; + color: rgb(52 211 153 / var(--tw-text-opacity)); +} +.hover\:text-gray-400:hover { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} +.hover\:text-gray-600:hover { + --tw-text-opacity: 1; + color: rgb(75 85 99 / var(--tw-text-opacity)); +} +.hover\:text-indigo-200:hover { + --tw-text-opacity: 1; + color: rgb(199 210 254 / var(--tw-text-opacity)); +} +.hover\:text-orange-400:hover { + --tw-text-opacity: 1; + color: rgb(251 146 60 / var(--tw-text-opacity)); +} +.hover\:text-pink-400:hover { + --tw-text-opacity: 1; + color: rgb(244 114 182 / var(--tw-text-opacity)); +} +.hover\:text-pink-600:hover { + --tw-text-opacity: 1; + color: rgb(219 39 119 / var(--tw-text-opacity)); +} +.hover\:text-red-400:hover { + --tw-text-opacity: 1; + color: rgb(248 113 113 / var(--tw-text-opacity)); +} +.hover\:text-yellow-400:hover { + --tw-text-opacity: 1; + color: rgb(250 204 21 / var(--tw-text-opacity)); +} +.hover\:underline:hover { + text-decoration-line: underline; +} +.hover\:decoration-wavy:hover { + text-decoration-style: wavy; +} +.hover\:opacity-80:hover { + opacity: 0.8; +} +.focus\:outline-none:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} +.prose-p\:m-1 :is(:where(p):not(:where([class~=not-prose] *))) { + margin: 0.25rem; +} +.prose-p\:mb-0 :is(:where(p):not(:where([class~=not-prose] *))) { + margin-bottom: 0px; +} +.prose-a\:rounded-sm :is(:where(a):not(:where([class~=not-prose] *))) { + border-radius: 0.125rem; +} +.prose-a\:p-0 :is(:where(a):not(:where([class~=not-prose] *))) { + padding: 0px; +} +.prose-a\:p-0\.5 :is(:where(a):not(:where([class~=not-prose] *))) { + padding: 0.125rem; +} +.prose-a\:text-blue-400 :is(:where(a):not(:where([class~=not-prose] *))) { + --tw-text-opacity: 1; + color: rgb(96 165 250 / var(--tw-text-opacity)); +} +.prose-a\:text-blue-600 :is(:where(a):not(:where([class~=not-prose] *))) { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); +} +.prose-a\:no-underline :is(:where(a):not(:where([class~=not-prose] *))) { + text-decoration-line: none; +} +.prose-a\:decoration-wavy :is(:where(a):not(:where([class~=not-prose] *))) { + text-decoration-style: wavy; +} +.hover\:prose-a\:text-blue-400 :is(:where(a):not(:where([class~=not-prose] *))):hover { + --tw-text-opacity: 1; + color: rgb(96 165 250 / var(--tw-text-opacity)); +} +.hover\:prose-a\:underline :is(:where(a):not(:where([class~=not-prose] *))):hover { + text-decoration-line: underline; +} +.prose-em\:rounded :is(:where(em):not(:where([class~=not-prose] *))) { + border-radius: 0.25rem; +} +.prose-em\:bg-blue-600 :is(:where(em):not(:where([class~=not-prose] *))) { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); +} +.prose-em\:px-1 :is(:where(em):not(:where([class~=not-prose] *))) { + padding-left: 0.25rem; + padding-right: 0.25rem; +} +.prose-em\:font-bold :is(:where(em):not(:where([class~=not-prose] *))) { + font-weight: 700; +} +.prose-em\:not-italic :is(:where(em):not(:where([class~=not-prose] *))) { + font-style: normal; +} +.prose-em\:text-blue-100 :is(:where(em):not(:where([class~=not-prose] *))) { + --tw-text-opacity: 1; + color: rgb(219 234 254 / var(--tw-text-opacity)); +} +.prose-code\:bg-pink-100 :is(:where(code):not(:where([class~=not-prose] *))) { + --tw-bg-opacity: 1; + background-color: rgb(252 231 243 / var(--tw-bg-opacity)); +} +.prose-code\:text-pink-900 :is(:where(code):not(:where([class~=not-prose] *))) { + --tw-text-opacity: 1; + color: rgb(131 24 67 / var(--tw-text-opacity)); +} +.prose-ul\:mt-0 :is(:where(ul):not(:where([class~=not-prose] *))) { + margin-top: 0px; +} +.prose-ul\:list-none :is(:where(ul):not(:where([class~=not-prose] *))) { + list-style-type: none; +} +.prose-ul\:pl-0 :is(:where(ul):not(:where([class~=not-prose] *))) { + padding-left: 0px; +} +.prose-li\:pl-0 :is(:where(li):not(:where([class~=not-prose] *))) { + padding-left: 0px; +} +.prose-img\:m-0 :is(:where(img):not(:where([class~=not-prose] *))) { + margin: 0px; +} +.prose-img\:my-2 :is(:where(img):not(:where([class~=not-prose] *))) { + margin-top: 0.5rem; + margin-bottom: 0.5rem; +} +.prose-img\:rounded :is(:where(img):not(:where([class~=not-prose] *))) { + border-radius: 0.25rem; +} +.prose-video\:rounded :is(:where(video):not(:where([class~=not-prose] *))) { + border-radius: 0.25rem; +} +@media (prefers-color-scheme: dark) { + .dark\:block { + display: block; + } + .dark\:hidden { + display: none; + } + .dark\:border-amber-400 { + --tw-border-opacity: 1; + border-color: rgb(251 191 36 / var(--tw-border-opacity)); + } + .dark\:border-gray-600 { + --tw-border-opacity: 1; + border-color: rgb(75 85 99 / var(--tw-border-opacity)); + } + .dark\:border-gray-800 { + --tw-border-opacity: 1; + border-color: rgb(31 41 55 / var(--tw-border-opacity)); + } + .dark\:border-slate-800 { + --tw-border-opacity: 1; + border-color: rgb(30 41 59 / var(--tw-border-opacity)); + } + .dark\:bg-amber-400 { + --tw-bg-opacity: 1; + background-color: rgb(251 191 36 / var(--tw-bg-opacity)); + } + .dark\:bg-black { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + .dark\:bg-blue-600 { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); + } + .dark\:bg-blue-900 { + --tw-bg-opacity: 1; + background-color: rgb(30 58 138 / var(--tw-bg-opacity)); + } + .dark\:bg-blue-900\/60 { + background-color: rgb(30 58 138 / 0.6); + } + .dark\:bg-emerald-900 { + --tw-bg-opacity: 1; + background-color: rgb(6 78 59 / var(--tw-bg-opacity)); + } + .dark\:bg-fuchsia-800 { + --tw-bg-opacity: 1; + background-color: rgb(134 25 143 / var(--tw-bg-opacity)); + } + .dark\:bg-fuchsia-900 { + --tw-bg-opacity: 1; + background-color: rgb(112 26 117 / var(--tw-bg-opacity)); + } + .dark\:bg-gray-900 { + --tw-bg-opacity: 1; + background-color: rgb(17 24 39 / var(--tw-bg-opacity)); + } + .dark\:bg-indigo-400 { + --tw-bg-opacity: 1; + background-color: rgb(129 140 248 / var(--tw-bg-opacity)); + } + .dark\:bg-indigo-950 { + --tw-bg-opacity: 1; + background-color: rgb(30 27 75 / var(--tw-bg-opacity)); + } + .dark\:bg-orange-600 { + --tw-bg-opacity: 1; + background-color: rgb(234 88 12 / var(--tw-bg-opacity)); + } + .dark\:bg-pink-600 { + --tw-bg-opacity: 1; + background-color: rgb(219 39 119 / var(--tw-bg-opacity)); + } + .dark\:bg-pink-900 { + --tw-bg-opacity: 1; + background-color: rgb(131 24 67 / var(--tw-bg-opacity)); + } + .dark\:bg-slate-900 { + --tw-bg-opacity: 1; + background-color: rgb(15 23 42 / var(--tw-bg-opacity)); + } + .dark\:bg-yellow-900 { + --tw-bg-opacity: 1; + background-color: rgb(113 63 18 / var(--tw-bg-opacity)); + } + .dark\:text-amber-500 { + --tw-text-opacity: 1; + color: rgb(245 158 11 / var(--tw-text-opacity)); + } + .dark\:text-blue-200 { + --tw-text-opacity: 1; + color: rgb(191 219 254 / var(--tw-text-opacity)); + } + .dark\:text-blue-600 { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); + } + .dark\:text-blue-900 { + --tw-text-opacity: 1; + color: rgb(30 58 138 / var(--tw-text-opacity)); + } + .dark\:text-emerald-400 { + --tw-text-opacity: 1; + color: rgb(52 211 153 / var(--tw-text-opacity)); + } + .dark\:text-fuchsia-500 { + --tw-text-opacity: 1; + color: rgb(217 70 239 / var(--tw-text-opacity)); + } + .dark\:text-gray-100 { + --tw-text-opacity: 1; + color: rgb(243 244 246 / var(--tw-text-opacity)); + } + .dark\:text-gray-200 { + --tw-text-opacity: 1; + color: rgb(229 231 235 / var(--tw-text-opacity)); + } + .dark\:text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); + } + .dark\:text-gray-600 { + --tw-text-opacity: 1; + color: rgb(75 85 99 / var(--tw-text-opacity)); + } + .dark\:text-indigo-300 { + --tw-text-opacity: 1; + color: rgb(165 180 252 / var(--tw-text-opacity)); + } + .dark\:text-indigo-400 { + --tw-text-opacity: 1; + color: rgb(129 140 248 / var(--tw-text-opacity)); + } + .dark\:text-indigo-50 { + --tw-text-opacity: 1; + color: rgb(238 242 255 / var(--tw-text-opacity)); + } + .dark\:text-indigo-600 { + --tw-text-opacity: 1; + color: rgb(79 70 229 / var(--tw-text-opacity)); + } + .dark\:text-indigo-900 { + --tw-text-opacity: 1; + color: rgb(49 46 129 / var(--tw-text-opacity)); + } + .dark\:text-pink-100 { + --tw-text-opacity: 1; + color: rgb(252 231 243 / var(--tw-text-opacity)); + } + .dark\:text-pink-200 { + --tw-text-opacity: 1; + color: rgb(251 207 232 / var(--tw-text-opacity)); + } + .dark\:text-pink-400 { + --tw-text-opacity: 1; + color: rgb(244 114 182 / var(--tw-text-opacity)); + } + .dark\:text-red-400 { + --tw-text-opacity: 1; + color: rgb(248 113 113 / var(--tw-text-opacity)); + } + .dark\:text-red-900 { + --tw-text-opacity: 1; + color: rgb(127 29 29 / var(--tw-text-opacity)); + } + .dark\:text-slate-200 { + --tw-text-opacity: 1; + color: rgb(226 232 240 / var(--tw-text-opacity)); + } + .dark\:text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); + } + .dark\:text-yellow-400 { + --tw-text-opacity: 1; + color: rgb(250 204 21 / var(--tw-text-opacity)); + } + .dark\:shadow-pink-200 { + --tw-shadow-color: #fbcfe8; + --tw-shadow: var(--tw-shadow-colored); + } + .dark\:selection\:bg-amber-600 *::-moz-selection { + --tw-bg-opacity: 1; + background-color: rgb(217 119 6 / var(--tw-bg-opacity)); + } + .dark\:selection\:bg-amber-600 *::selection { + --tw-bg-opacity: 1; + background-color: rgb(217 119 6 / var(--tw-bg-opacity)); + } + .dark\:selection\:bg-blue-600 *::-moz-selection { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); + } + .dark\:selection\:bg-blue-600 *::selection { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); + } + .dark\:selection\:text-amber-400 *::-moz-selection { + --tw-text-opacity: 1; + color: rgb(251 191 36 / var(--tw-text-opacity)); + } + .dark\:selection\:text-amber-400 *::selection { + --tw-text-opacity: 1; + color: rgb(251 191 36 / var(--tw-text-opacity)); + } + .dark\:selection\:text-blue-100 *::-moz-selection { + --tw-text-opacity: 1; + color: rgb(219 234 254 / var(--tw-text-opacity)); + } + .dark\:selection\:text-blue-100 *::selection { + --tw-text-opacity: 1; + color: rgb(219 234 254 / var(--tw-text-opacity)); + } + .dark\:selection\:bg-amber-600::-moz-selection { + --tw-bg-opacity: 1; + background-color: rgb(217 119 6 / var(--tw-bg-opacity)); + } + .dark\:selection\:bg-amber-600::selection { + --tw-bg-opacity: 1; + background-color: rgb(217 119 6 / var(--tw-bg-opacity)); + } + .dark\:selection\:bg-blue-600::-moz-selection { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); + } + .dark\:selection\:bg-blue-600::selection { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); + } + .dark\:selection\:text-amber-400::-moz-selection { + --tw-text-opacity: 1; + color: rgb(251 191 36 / var(--tw-text-opacity)); + } + .dark\:selection\:text-amber-400::selection { + --tw-text-opacity: 1; + color: rgb(251 191 36 / var(--tw-text-opacity)); + } + .dark\:selection\:text-blue-100::-moz-selection { + --tw-text-opacity: 1; + color: rgb(219 234 254 / var(--tw-text-opacity)); + } + .dark\:selection\:text-blue-100::selection { + --tw-text-opacity: 1; + color: rgb(219 234 254 / var(--tw-text-opacity)); + } + .hover\:dark\:border-slate-900:hover { + --tw-border-opacity: 1; + border-color: rgb(15 23 42 / var(--tw-border-opacity)); + } + .dark\:hover\:bg-emerald-800:hover { + --tw-bg-opacity: 1; + background-color: rgb(6 95 70 / var(--tw-bg-opacity)); + } + .dark\:hover\:bg-fuchsia-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(162 28 175 / var(--tw-bg-opacity)); + } + .dark\:hover\:bg-orange-800:hover { + --tw-bg-opacity: 1; + background-color: rgb(154 52 18 / var(--tw-bg-opacity)); + } + .dark\:hover\:bg-pink-800:hover { + --tw-bg-opacity: 1; + background-color: rgb(157 23 77 / var(--tw-bg-opacity)); + } + .dark\:hover\:bg-red-200:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 202 202 / var(--tw-bg-opacity)); + } + .dark\:hover\:bg-slate-950:hover { + --tw-bg-opacity: 1; + background-color: rgb(2 6 23 / var(--tw-bg-opacity)); + } + .dark\:hover\:bg-yellow-800:hover { + --tw-bg-opacity: 1; + background-color: rgb(133 77 14 / var(--tw-bg-opacity)); + } + .hover\:dark\:bg-blue-800:hover { + --tw-bg-opacity: 1; + background-color: rgb(30 64 175 / var(--tw-bg-opacity)); + } + .hover\:dark\:bg-orange-900:hover { + --tw-bg-opacity: 1; + background-color: rgb(124 45 18 / var(--tw-bg-opacity)); + } + .hover\:dark\:bg-pink-900:hover { + --tw-bg-opacity: 1; + background-color: rgb(131 24 67 / var(--tw-bg-opacity)); + } + .dark\:hover\:text-pink-100:hover { + --tw-text-opacity: 1; + color: rgb(252 231 243 / var(--tw-text-opacity)); + } + .hover\:dark\:text-blue-100:hover { + --tw-text-opacity: 1; + color: rgb(219 234 254 / var(--tw-text-opacity)); + } + .hover\:dark\:text-slate-600:hover { + --tw-text-opacity: 1; + color: rgb(71 85 105 / var(--tw-text-opacity)); + } + .dark\:prose-a\:text-blue-600 :is(:where(a):not(:where([class~=not-prose] *))) { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); + } + .prose-a\:dark\:text-gray-100 :is(:where(a):not(:where([class~=not-prose] *))) { + --tw-text-opacity: 1; + color: rgb(243 244 246 / var(--tw-text-opacity)); + } + .prose-a\:dark\:text-indigo-300 :is(:where(a):not(:where([class~=not-prose] *))) { + --tw-text-opacity: 1; + color: rgb(165 180 252 / var(--tw-text-opacity)); + } +} +@media (min-width: 640px) { + .sm\:col-span-1 { + grid-column: span 1 / span 1; + } + .sm\:col-span-6 { + grid-column: span 6 / span 6; + } +} +@media (min-width: 768px) { + .md\:mx-0 { + margin-left: 0px; + margin-right: 0px; + } + .md\:mb-12 { + margin-bottom: 3rem; + } + .md\:block { + display: block; + } + .md\:h-10 { + height: 2.5rem; + } + .md\:h-3 { + height: 0.75rem; + } + .md\:w-10 { + width: 2.5rem; + } + .md\:w-3 { + width: 0.75rem; + } + .md\:flex-auto { + flex: 1 1 auto; + } + .md\:pt-8 { + padding-top: 2rem; + } + .md\:text-sm { + font-size: 0.8rem; + } + .md\:text-xl { + font-size: 1.25rem; + } +} + +/* slices/admin/assets/css/app.css */ +body { + background-color: #fff; + color: #000; + font-family: sans-serif; +} diff --git a/public/assets/admin/app.js b/public/assets/admin/app.js new file mode 100644 index 0000000..4542924 --- /dev/null +++ b/public/assets/admin/app.js @@ -0,0 +1,3176 @@ +(() => { + var __create = Object.create; + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __getProtoOf = Object.getPrototypeOf; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + }; + var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + + // node_modules/tiny-markdown-editor/lib/svg/svg.js + var require_svg = __commonJS({ + "node_modules/tiny-markdown-editor/lib/svg/svg.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = void 0; + var svg = { + blockquote: ``, + bold: ``, + clear_formatting: ``, + code: ``, + h1: ``, + h2: ``, + hr: ``, + image: ``, + italic: ``, + link: ``, + ol: ``, + strikethrough: ``, + ul: `` + }; + var _default = exports.default = svg; + } + }); + + // node_modules/tiny-markdown-editor/lib/TinyMDECommandBar.js + var require_TinyMDECommandBar = __commonJS({ + "node_modules/tiny-markdown-editor/lib/TinyMDECommandBar.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = void 0; + var _svg = _interopRequireDefault(require_svg()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + var isMacLike = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform); + var DefaultCommands = { + "bold": { + name: "bold", + action: "bold", + innerHTML: _svg.default.bold, + title: "Bold", + hotkey: "Mod-B" + }, + "italic": { + name: "italic", + action: "italic", + innerHTML: _svg.default.italic, + title: "Italic", + hotkey: "Mod-I" + }, + "strikethrough": { + name: "strikethrough", + action: "strikethrough", + innerHTML: _svg.default.strikethrough, + title: "Strikethrough", + hotkey: "Mod2-Shift-5" + }, + "code": { + name: "code", + action: "code", + innerHTML: _svg.default.code, + title: "Format as code" + }, + "h1": { + name: "h1", + action: "h1", + innerHTML: _svg.default.h1, + title: "Level 1 heading", + hotkey: "Mod-Shift-1" + }, + "h2": { + name: "h2", + action: "h2", + innerHTML: _svg.default.h2, + title: "Level 2 heading", + hotkey: "Mod-Shift-2" + }, + "ul": { + name: "ul", + action: "ul", + innerHTML: _svg.default.ul, + title: "Bulleted list" + }, + "ol": { + name: "ol", + action: "ol", + innerHTML: _svg.default.ol, + title: "Numbered list" + }, + "blockquote": { + name: "blockquote", + action: "blockquote", + innerHTML: _svg.default.blockquote, + title: "Quote", + hotkey: "Mod2-Shift-Q" + }, + "insertLink": { + name: "insertLink", + action: (editor) => { + if (editor.isInlineFormattingAllowed()) + editor.wrapSelection("[", "]()"); + }, + enabled: (editor, focus, anchor) => editor.isInlineFormattingAllowed(focus, anchor) ? false : null, + innerHTML: _svg.default.link, + title: "Insert link", + hotkey: "Mod-K" + }, + "insertImage": { + name: "insertImage", + action: (editor) => { + if (editor.isInlineFormattingAllowed()) + editor.wrapSelection("![", "]()"); + }, + enabled: (editor, focus, anchor) => editor.isInlineFormattingAllowed(focus, anchor) ? false : null, + innerHTML: _svg.default.image, + title: "Insert image", + hotkey: "Mod2-Shift-I" + }, + "hr": { + name: "hr", + action: (editor) => editor.paste("\n***\n"), + enabled: () => false, + innerHTML: _svg.default.hr, + title: "Insert horizontal line", + hotkey: "Mod2-Shift-L" + } + }; + var CommandBar = class { + constructor(props) { + this.e = null; + this.editor = null; + this.commands = []; + this.buttons = {}; + this.state = {}; + this.hotkeys = []; + let element = props.element; + if (element && !element.tagName) { + element = document.getElementById(props.element); + } + if (!element) { + element = document.body; + } + this.createCommandBarElement(element, props.commands || ["bold", "italic", "strikethrough", "|", "code", "|", "h1", "h2", "|", "ul", "ol", "|", "blockquote", "hr", "|", "insertLink", "insertImage"]); + document.addEventListener("keydown", (e) => this.handleKeydown(e)); + if (props.editor) + this.setEditor(props.editor); + } + createCommandBarElement(parentElement, commands) { + this.e = document.createElement("div"); + this.e.className = "TMCommandBar"; + for (let command of commands) { + if (command == "|") { + let el = document.createElement("div"); + el.className = "TMCommandDivider"; + this.e.appendChild(el); + } else { + let commandName; + if (typeof command == "string") { + if (DefaultCommands[command]) { + commandName = command; + this.commands[commandName] = DefaultCommands[commandName]; + } else { + continue; + } + } else if (typeof command == "object" && command.name) { + commandName = command.name; + this.commands[commandName] = {}; + if (DefaultCommands[commandName]) + Object.assign(this.commands[commandName], DefaultCommands[commandName]); + Object.assign(this.commands[commandName], command); + } else { + continue; + } + let title = this.commands[commandName].title || commandName; + if (this.commands[commandName].hotkey) { + const keys = this.commands[commandName].hotkey.split("-"); + let modifiers = []; + let modifierexplanation = []; + for (let i = 0; i < keys.length - 1; i++) { + switch (keys[i]) { + case "Ctrl": + modifiers.push("ctrlKey"); + modifierexplanation.push("Ctrl"); + break; + case "Cmd": + modifiers.push("metaKey"); + modifierexplanation.push("\u2318"); + break; + case "Alt": + modifiers.push("altKey"); + modifierexplanation.push("Alt"); + break; + case "Option": + modifiers.push("altKey"); + modifierexplanation.push("\u2325"); + break; + case "Win": + modifiers.push("metaKey"); + modifierexplanation.push("\u229E Win"); + break; + case "Shift": + modifiers.push("shiftKey"); + modifierexplanation.push("\u21E7"); + break; + case "Mod": + if (isMacLike) { + modifiers.push("metaKey"); + modifierexplanation.push("\u2318"); + } else { + modifiers.push("ctrlKey"); + modifierexplanation.push("Ctrl"); + } + break; + case "Mod2": + modifiers.push("altKey"); + if (isMacLike) + modifierexplanation.push("\u2325"); + else + modifierexplanation.push("Alt"); + break; + } + } + modifierexplanation.push(keys[keys.length - 1]); + let hotkey = { + modifiers, + command: commandName + }; + if (keys[keys.length - 1].match(/^[0-9]$/)) { + hotkey.code = `Digit${keys[keys.length - 1]}`; + } else { + hotkey.key = keys[keys.length - 1].toLowerCase(); + } + this.hotkeys.push(hotkey); + title = title.concat(` (${modifierexplanation.join("+")})`); + } + this.buttons[commandName] = document.createElement("div"); + this.buttons[commandName].className = "TMCommandButton TMCommandButton_Disabled"; + this.buttons[commandName].title = title; + this.buttons[commandName].innerHTML = this.commands[commandName].innerHTML; + this.buttons[commandName].addEventListener("mousedown", (e) => this.handleClick(commandName, e)); + this.e.appendChild(this.buttons[commandName]); + } + } + parentElement.appendChild(this.e); + } + handleClick(commandName, event) { + if (!this.editor) + return; + event.preventDefault(); + if (typeof this.commands[commandName].action == "string") { + if (this.state[commandName] === false) + this.editor.setCommandState(commandName, true); + else + this.editor.setCommandState(commandName, false); + } else if (typeof this.commands[commandName].action == "function") { + this.commands[commandName].action(this.editor); + } + } + setEditor(editor) { + this.editor = editor; + editor.addEventListener("selection", (e) => this.handleSelection(e)); + } + handleSelection(event) { + if (event.commandState) { + for (let command in this.commands) { + if (event.commandState[command] === void 0) { + if (this.commands[command].enabled) + this.state[command] = this.commands[command].enabled(this.editor, event.focus, event.anchor); + else + this.state[command] = event.focus ? false : null; + } else { + this.state[command] = event.commandState[command]; + } + if (this.state[command] === true) { + this.buttons[command].className = "TMCommandButton TMCommandButton_Active"; + } else if (this.state[command] === false) { + this.buttons[command].className = "TMCommandButton TMCommandButton_Inactive"; + } else { + this.buttons[command].className = "TMCommandButton TMCommandButton_Disabled"; + } + } + } + } + handleKeydown(event) { + outer: + for (let hotkey of this.hotkeys) { + if (hotkey.key && event.key.toLowerCase() == hotkey.key || hotkey.code && event.code == hotkey.code) { + for (let modifier of hotkey.modifiers) { + if (!event[modifier]) + continue outer; + } + this.handleClick(hotkey.command, event); + return; + } + } + } + }; + var _default = exports.default = CommandBar; + } + }); + + // node_modules/core-js/internals/global.js + var require_global = __commonJS({ + "node_modules/core-js/internals/global.js"(exports, module) { + "use strict"; + var check = function(it) { + return it && it.Math === Math && it; + }; + module.exports = // eslint-disable-next-line es/no-global-this -- safe + check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || // eslint-disable-next-line no-restricted-globals -- safe + check(typeof self == "object" && self) || check(typeof global == "object" && global) || check(typeof exports == "object" && exports) || // eslint-disable-next-line no-new-func -- fallback + function() { + return this; + }() || Function("return this")(); + } + }); + + // node_modules/core-js/internals/fails.js + var require_fails = __commonJS({ + "node_modules/core-js/internals/fails.js"(exports, module) { + "use strict"; + module.exports = function(exec) { + try { + return !!exec(); + } catch (error) { + return true; + } + }; + } + }); + + // node_modules/core-js/internals/descriptors.js + var require_descriptors = __commonJS({ + "node_modules/core-js/internals/descriptors.js"(exports, module) { + "use strict"; + var fails = require_fails(); + module.exports = !fails(function() { + return Object.defineProperty({}, 1, { get: function() { + return 7; + } })[1] !== 7; + }); + } + }); + + // node_modules/core-js/internals/function-bind-native.js + var require_function_bind_native = __commonJS({ + "node_modules/core-js/internals/function-bind-native.js"(exports, module) { + "use strict"; + var fails = require_fails(); + module.exports = !fails(function() { + var test = function() { + }.bind(); + return typeof test != "function" || test.hasOwnProperty("prototype"); + }); + } + }); + + // node_modules/core-js/internals/function-uncurry-this.js + var require_function_uncurry_this = __commonJS({ + "node_modules/core-js/internals/function-uncurry-this.js"(exports, module) { + "use strict"; + var NATIVE_BIND = require_function_bind_native(); + var FunctionPrototype = Function.prototype; + var call = FunctionPrototype.call; + var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call); + module.exports = NATIVE_BIND ? uncurryThisWithBind : function(fn) { + return function() { + return call.apply(fn, arguments); + }; + }; + } + }); + + // node_modules/core-js/internals/document-all.js + var require_document_all = __commonJS({ + "node_modules/core-js/internals/document-all.js"(exports, module) { + "use strict"; + var documentAll = typeof document == "object" && document.all; + var IS_HTMLDDA = typeof documentAll == "undefined" && documentAll !== void 0; + module.exports = { + all: documentAll, + IS_HTMLDDA + }; + } + }); + + // node_modules/core-js/internals/is-callable.js + var require_is_callable = __commonJS({ + "node_modules/core-js/internals/is-callable.js"(exports, module) { + "use strict"; + var $documentAll = require_document_all(); + var documentAll = $documentAll.all; + module.exports = $documentAll.IS_HTMLDDA ? function(argument) { + return typeof argument == "function" || argument === documentAll; + } : function(argument) { + return typeof argument == "function"; + }; + } + }); + + // node_modules/core-js/internals/is-null-or-undefined.js + var require_is_null_or_undefined = __commonJS({ + "node_modules/core-js/internals/is-null-or-undefined.js"(exports, module) { + "use strict"; + module.exports = function(it) { + return it === null || it === void 0; + }; + } + }); + + // node_modules/core-js/internals/require-object-coercible.js + var require_require_object_coercible = __commonJS({ + "node_modules/core-js/internals/require-object-coercible.js"(exports, module) { + "use strict"; + var isNullOrUndefined = require_is_null_or_undefined(); + var $TypeError = TypeError; + module.exports = function(it) { + if (isNullOrUndefined(it)) + throw new $TypeError("Can't call method on " + it); + return it; + }; + } + }); + + // node_modules/core-js/internals/to-object.js + var require_to_object = __commonJS({ + "node_modules/core-js/internals/to-object.js"(exports, module) { + "use strict"; + var requireObjectCoercible = require_require_object_coercible(); + var $Object = Object; + module.exports = function(argument) { + return $Object(requireObjectCoercible(argument)); + }; + } + }); + + // node_modules/core-js/internals/has-own-property.js + var require_has_own_property = __commonJS({ + "node_modules/core-js/internals/has-own-property.js"(exports, module) { + "use strict"; + var uncurryThis = require_function_uncurry_this(); + var toObject = require_to_object(); + var hasOwnProperty = uncurryThis({}.hasOwnProperty); + module.exports = Object.hasOwn || function hasOwn(it, key) { + return hasOwnProperty(toObject(it), key); + }; + } + }); + + // node_modules/core-js/internals/function-name.js + var require_function_name = __commonJS({ + "node_modules/core-js/internals/function-name.js"(exports, module) { + "use strict"; + var DESCRIPTORS = require_descriptors(); + var hasOwn = require_has_own_property(); + var FunctionPrototype = Function.prototype; + var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; + var EXISTS = hasOwn(FunctionPrototype, "name"); + var PROPER = EXISTS && function something() { + }.name === "something"; + var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable); + module.exports = { + EXISTS, + PROPER, + CONFIGURABLE + }; + } + }); + + // node_modules/core-js/internals/define-global-property.js + var require_define_global_property = __commonJS({ + "node_modules/core-js/internals/define-global-property.js"(exports, module) { + "use strict"; + var global2 = require_global(); + var defineProperty = Object.defineProperty; + module.exports = function(key, value) { + try { + defineProperty(global2, key, { value, configurable: true, writable: true }); + } catch (error) { + global2[key] = value; + } + return value; + }; + } + }); + + // node_modules/core-js/internals/shared-store.js + var require_shared_store = __commonJS({ + "node_modules/core-js/internals/shared-store.js"(exports, module) { + "use strict"; + var global2 = require_global(); + var defineGlobalProperty = require_define_global_property(); + var SHARED = "__core-js_shared__"; + var store = global2[SHARED] || defineGlobalProperty(SHARED, {}); + module.exports = store; + } + }); + + // node_modules/core-js/internals/inspect-source.js + var require_inspect_source = __commonJS({ + "node_modules/core-js/internals/inspect-source.js"(exports, module) { + "use strict"; + var uncurryThis = require_function_uncurry_this(); + var isCallable = require_is_callable(); + var store = require_shared_store(); + var functionToString = uncurryThis(Function.toString); + if (!isCallable(store.inspectSource)) { + store.inspectSource = function(it) { + return functionToString(it); + }; + } + module.exports = store.inspectSource; + } + }); + + // node_modules/core-js/internals/weak-map-basic-detection.js + var require_weak_map_basic_detection = __commonJS({ + "node_modules/core-js/internals/weak-map-basic-detection.js"(exports, module) { + "use strict"; + var global2 = require_global(); + var isCallable = require_is_callable(); + var WeakMap = global2.WeakMap; + module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap)); + } + }); + + // node_modules/core-js/internals/is-object.js + var require_is_object = __commonJS({ + "node_modules/core-js/internals/is-object.js"(exports, module) { + "use strict"; + var isCallable = require_is_callable(); + var $documentAll = require_document_all(); + var documentAll = $documentAll.all; + module.exports = $documentAll.IS_HTMLDDA ? function(it) { + return typeof it == "object" ? it !== null : isCallable(it) || it === documentAll; + } : function(it) { + return typeof it == "object" ? it !== null : isCallable(it); + }; + } + }); + + // node_modules/core-js/internals/document-create-element.js + var require_document_create_element = __commonJS({ + "node_modules/core-js/internals/document-create-element.js"(exports, module) { + "use strict"; + var global2 = require_global(); + var isObject = require_is_object(); + var document2 = global2.document; + var EXISTS = isObject(document2) && isObject(document2.createElement); + module.exports = function(it) { + return EXISTS ? document2.createElement(it) : {}; + }; + } + }); + + // node_modules/core-js/internals/ie8-dom-define.js + var require_ie8_dom_define = __commonJS({ + "node_modules/core-js/internals/ie8-dom-define.js"(exports, module) { + "use strict"; + var DESCRIPTORS = require_descriptors(); + var fails = require_fails(); + var createElement = require_document_create_element(); + module.exports = !DESCRIPTORS && !fails(function() { + return Object.defineProperty(createElement("div"), "a", { + get: function() { + return 7; + } + }).a !== 7; + }); + } + }); + + // node_modules/core-js/internals/v8-prototype-define-bug.js + var require_v8_prototype_define_bug = __commonJS({ + "node_modules/core-js/internals/v8-prototype-define-bug.js"(exports, module) { + "use strict"; + var DESCRIPTORS = require_descriptors(); + var fails = require_fails(); + module.exports = DESCRIPTORS && fails(function() { + return Object.defineProperty(function() { + }, "prototype", { + value: 42, + writable: false + }).prototype !== 42; + }); + } + }); + + // node_modules/core-js/internals/an-object.js + var require_an_object = __commonJS({ + "node_modules/core-js/internals/an-object.js"(exports, module) { + "use strict"; + var isObject = require_is_object(); + var $String = String; + var $TypeError = TypeError; + module.exports = function(argument) { + if (isObject(argument)) + return argument; + throw new $TypeError($String(argument) + " is not an object"); + }; + } + }); + + // node_modules/core-js/internals/function-call.js + var require_function_call = __commonJS({ + "node_modules/core-js/internals/function-call.js"(exports, module) { + "use strict"; + var NATIVE_BIND = require_function_bind_native(); + var call = Function.prototype.call; + module.exports = NATIVE_BIND ? call.bind(call) : function() { + return call.apply(call, arguments); + }; + } + }); + + // node_modules/core-js/internals/get-built-in.js + var require_get_built_in = __commonJS({ + "node_modules/core-js/internals/get-built-in.js"(exports, module) { + "use strict"; + var global2 = require_global(); + var isCallable = require_is_callable(); + var aFunction = function(argument) { + return isCallable(argument) ? argument : void 0; + }; + module.exports = function(namespace, method) { + return arguments.length < 2 ? aFunction(global2[namespace]) : global2[namespace] && global2[namespace][method]; + }; + } + }); + + // node_modules/core-js/internals/object-is-prototype-of.js + var require_object_is_prototype_of = __commonJS({ + "node_modules/core-js/internals/object-is-prototype-of.js"(exports, module) { + "use strict"; + var uncurryThis = require_function_uncurry_this(); + module.exports = uncurryThis({}.isPrototypeOf); + } + }); + + // node_modules/core-js/internals/engine-user-agent.js + var require_engine_user_agent = __commonJS({ + "node_modules/core-js/internals/engine-user-agent.js"(exports, module) { + "use strict"; + module.exports = typeof navigator != "undefined" && String(navigator.userAgent) || ""; + } + }); + + // node_modules/core-js/internals/engine-v8-version.js + var require_engine_v8_version = __commonJS({ + "node_modules/core-js/internals/engine-v8-version.js"(exports, module) { + "use strict"; + var global2 = require_global(); + var userAgent = require_engine_user_agent(); + var process = global2.process; + var Deno = global2.Deno; + var versions = process && process.versions || Deno && Deno.version; + var v8 = versions && versions.v8; + var match; + var version; + if (v8) { + match = v8.split("."); + version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); + } + if (!version && userAgent) { + match = userAgent.match(/Edge\/(\d+)/); + if (!match || match[1] >= 74) { + match = userAgent.match(/Chrome\/(\d+)/); + if (match) + version = +match[1]; + } + } + module.exports = version; + } + }); + + // node_modules/core-js/internals/symbol-constructor-detection.js + var require_symbol_constructor_detection = __commonJS({ + "node_modules/core-js/internals/symbol-constructor-detection.js"(exports, module) { + "use strict"; + var V8_VERSION = require_engine_v8_version(); + var fails = require_fails(); + var global2 = require_global(); + var $String = global2.String; + module.exports = !!Object.getOwnPropertySymbols && !fails(function() { + var symbol = Symbol("symbol detection"); + return !$String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances + !Symbol.sham && V8_VERSION && V8_VERSION < 41; + }); + } + }); + + // node_modules/core-js/internals/use-symbol-as-uid.js + var require_use_symbol_as_uid = __commonJS({ + "node_modules/core-js/internals/use-symbol-as-uid.js"(exports, module) { + "use strict"; + var NATIVE_SYMBOL = require_symbol_constructor_detection(); + module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol"; + } + }); + + // node_modules/core-js/internals/is-symbol.js + var require_is_symbol = __commonJS({ + "node_modules/core-js/internals/is-symbol.js"(exports, module) { + "use strict"; + var getBuiltIn = require_get_built_in(); + var isCallable = require_is_callable(); + var isPrototypeOf = require_object_is_prototype_of(); + var USE_SYMBOL_AS_UID = require_use_symbol_as_uid(); + var $Object = Object; + module.exports = USE_SYMBOL_AS_UID ? function(it) { + return typeof it == "symbol"; + } : function(it) { + var $Symbol = getBuiltIn("Symbol"); + return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it)); + }; + } + }); + + // node_modules/core-js/internals/try-to-string.js + var require_try_to_string = __commonJS({ + "node_modules/core-js/internals/try-to-string.js"(exports, module) { + "use strict"; + var $String = String; + module.exports = function(argument) { + try { + return $String(argument); + } catch (error) { + return "Object"; + } + }; + } + }); + + // node_modules/core-js/internals/a-callable.js + var require_a_callable = __commonJS({ + "node_modules/core-js/internals/a-callable.js"(exports, module) { + "use strict"; + var isCallable = require_is_callable(); + var tryToString = require_try_to_string(); + var $TypeError = TypeError; + module.exports = function(argument) { + if (isCallable(argument)) + return argument; + throw new $TypeError(tryToString(argument) + " is not a function"); + }; + } + }); + + // node_modules/core-js/internals/get-method.js + var require_get_method = __commonJS({ + "node_modules/core-js/internals/get-method.js"(exports, module) { + "use strict"; + var aCallable = require_a_callable(); + var isNullOrUndefined = require_is_null_or_undefined(); + module.exports = function(V, P) { + var func = V[P]; + return isNullOrUndefined(func) ? void 0 : aCallable(func); + }; + } + }); + + // node_modules/core-js/internals/ordinary-to-primitive.js + var require_ordinary_to_primitive = __commonJS({ + "node_modules/core-js/internals/ordinary-to-primitive.js"(exports, module) { + "use strict"; + var call = require_function_call(); + var isCallable = require_is_callable(); + var isObject = require_is_object(); + var $TypeError = TypeError; + module.exports = function(input, pref) { + var fn, val; + if (pref === "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) + return val; + if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) + return val; + if (pref !== "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) + return val; + throw new $TypeError("Can't convert object to primitive value"); + }; + } + }); + + // node_modules/core-js/internals/is-pure.js + var require_is_pure = __commonJS({ + "node_modules/core-js/internals/is-pure.js"(exports, module) { + "use strict"; + module.exports = false; + } + }); + + // node_modules/core-js/internals/shared.js + var require_shared = __commonJS({ + "node_modules/core-js/internals/shared.js"(exports, module) { + "use strict"; + var IS_PURE = require_is_pure(); + var store = require_shared_store(); + (module.exports = function(key, value) { + return store[key] || (store[key] = value !== void 0 ? value : {}); + })("versions", []).push({ + version: "3.33.3", + mode: IS_PURE ? "pure" : "global", + copyright: "\xA9 2014-2023 Denis Pushkarev (zloirock.ru)", + license: "https://github.com/zloirock/core-js/blob/v3.33.3/LICENSE", + source: "https://github.com/zloirock/core-js" + }); + } + }); + + // node_modules/core-js/internals/uid.js + var require_uid = __commonJS({ + "node_modules/core-js/internals/uid.js"(exports, module) { + "use strict"; + var uncurryThis = require_function_uncurry_this(); + var id = 0; + var postfix = Math.random(); + var toString = uncurryThis(1 .toString); + module.exports = function(key) { + return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString(++id + postfix, 36); + }; + } + }); + + // node_modules/core-js/internals/well-known-symbol.js + var require_well_known_symbol = __commonJS({ + "node_modules/core-js/internals/well-known-symbol.js"(exports, module) { + "use strict"; + var global2 = require_global(); + var shared = require_shared(); + var hasOwn = require_has_own_property(); + var uid = require_uid(); + var NATIVE_SYMBOL = require_symbol_constructor_detection(); + var USE_SYMBOL_AS_UID = require_use_symbol_as_uid(); + var Symbol2 = global2.Symbol; + var WellKnownSymbolsStore = shared("wks"); + var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol2["for"] || Symbol2 : Symbol2 && Symbol2.withoutSetter || uid; + module.exports = function(name) { + if (!hasOwn(WellKnownSymbolsStore, name)) { + WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol2, name) ? Symbol2[name] : createWellKnownSymbol("Symbol." + name); + } + return WellKnownSymbolsStore[name]; + }; + } + }); + + // node_modules/core-js/internals/to-primitive.js + var require_to_primitive = __commonJS({ + "node_modules/core-js/internals/to-primitive.js"(exports, module) { + "use strict"; + var call = require_function_call(); + var isObject = require_is_object(); + var isSymbol = require_is_symbol(); + var getMethod = require_get_method(); + var ordinaryToPrimitive = require_ordinary_to_primitive(); + var wellKnownSymbol = require_well_known_symbol(); + var $TypeError = TypeError; + var TO_PRIMITIVE = wellKnownSymbol("toPrimitive"); + module.exports = function(input, pref) { + if (!isObject(input) || isSymbol(input)) + return input; + var exoticToPrim = getMethod(input, TO_PRIMITIVE); + var result; + if (exoticToPrim) { + if (pref === void 0) + pref = "default"; + result = call(exoticToPrim, input, pref); + if (!isObject(result) || isSymbol(result)) + return result; + throw new $TypeError("Can't convert object to primitive value"); + } + if (pref === void 0) + pref = "number"; + return ordinaryToPrimitive(input, pref); + }; + } + }); + + // node_modules/core-js/internals/to-property-key.js + var require_to_property_key = __commonJS({ + "node_modules/core-js/internals/to-property-key.js"(exports, module) { + "use strict"; + var toPrimitive = require_to_primitive(); + var isSymbol = require_is_symbol(); + module.exports = function(argument) { + var key = toPrimitive(argument, "string"); + return isSymbol(key) ? key : key + ""; + }; + } + }); + + // node_modules/core-js/internals/object-define-property.js + var require_object_define_property = __commonJS({ + "node_modules/core-js/internals/object-define-property.js"(exports) { + "use strict"; + var DESCRIPTORS = require_descriptors(); + var IE8_DOM_DEFINE = require_ie8_dom_define(); + var V8_PROTOTYPE_DEFINE_BUG = require_v8_prototype_define_bug(); + var anObject = require_an_object(); + var toPropertyKey = require_to_property_key(); + var $TypeError = TypeError; + var $defineProperty = Object.defineProperty; + var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + var ENUMERABLE = "enumerable"; + var CONFIGURABLE = "configurable"; + var WRITABLE = "writable"; + exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) { + anObject(O); + P = toPropertyKey(P); + anObject(Attributes); + if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { + var current = $getOwnPropertyDescriptor(O, P); + if (current && current[WRITABLE]) { + O[P] = Attributes.value; + Attributes = { + configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], + enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], + writable: false + }; + } + } + return $defineProperty(O, P, Attributes); + } : $defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPropertyKey(P); + anObject(Attributes); + if (IE8_DOM_DEFINE) + try { + return $defineProperty(O, P, Attributes); + } catch (error) { + } + if ("get" in Attributes || "set" in Attributes) + throw new $TypeError("Accessors not supported"); + if ("value" in Attributes) + O[P] = Attributes.value; + return O; + }; + } + }); + + // node_modules/core-js/internals/create-property-descriptor.js + var require_create_property_descriptor = __commonJS({ + "node_modules/core-js/internals/create-property-descriptor.js"(exports, module) { + "use strict"; + module.exports = function(bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value + }; + }; + } + }); + + // node_modules/core-js/internals/create-non-enumerable-property.js + var require_create_non_enumerable_property = __commonJS({ + "node_modules/core-js/internals/create-non-enumerable-property.js"(exports, module) { + "use strict"; + var DESCRIPTORS = require_descriptors(); + var definePropertyModule = require_object_define_property(); + var createPropertyDescriptor = require_create_property_descriptor(); + module.exports = DESCRIPTORS ? function(object, key, value) { + return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); + } : function(object, key, value) { + object[key] = value; + return object; + }; + } + }); + + // node_modules/core-js/internals/shared-key.js + var require_shared_key = __commonJS({ + "node_modules/core-js/internals/shared-key.js"(exports, module) { + "use strict"; + var shared = require_shared(); + var uid = require_uid(); + var keys = shared("keys"); + module.exports = function(key) { + return keys[key] || (keys[key] = uid(key)); + }; + } + }); + + // node_modules/core-js/internals/hidden-keys.js + var require_hidden_keys = __commonJS({ + "node_modules/core-js/internals/hidden-keys.js"(exports, module) { + "use strict"; + module.exports = {}; + } + }); + + // node_modules/core-js/internals/internal-state.js + var require_internal_state = __commonJS({ + "node_modules/core-js/internals/internal-state.js"(exports, module) { + "use strict"; + var NATIVE_WEAK_MAP = require_weak_map_basic_detection(); + var global2 = require_global(); + var isObject = require_is_object(); + var createNonEnumerableProperty = require_create_non_enumerable_property(); + var hasOwn = require_has_own_property(); + var shared = require_shared_store(); + var sharedKey = require_shared_key(); + var hiddenKeys = require_hidden_keys(); + var OBJECT_ALREADY_INITIALIZED = "Object already initialized"; + var TypeError2 = global2.TypeError; + var WeakMap = global2.WeakMap; + var set; + var get; + var has; + var enforce = function(it) { + return has(it) ? get(it) : set(it, {}); + }; + var getterFor = function(TYPE) { + return function(it) { + var state; + if (!isObject(it) || (state = get(it)).type !== TYPE) { + throw new TypeError2("Incompatible receiver, " + TYPE + " required"); + } + return state; + }; + }; + if (NATIVE_WEAK_MAP || shared.state) { + store = shared.state || (shared.state = new WeakMap()); + store.get = store.get; + store.has = store.has; + store.set = store.set; + set = function(it, metadata) { + if (store.has(it)) + throw new TypeError2(OBJECT_ALREADY_INITIALIZED); + metadata.facade = it; + store.set(it, metadata); + return metadata; + }; + get = function(it) { + return store.get(it) || {}; + }; + has = function(it) { + return store.has(it); + }; + } else { + STATE = sharedKey("state"); + hiddenKeys[STATE] = true; + set = function(it, metadata) { + if (hasOwn(it, STATE)) + throw new TypeError2(OBJECT_ALREADY_INITIALIZED); + metadata.facade = it; + createNonEnumerableProperty(it, STATE, metadata); + return metadata; + }; + get = function(it) { + return hasOwn(it, STATE) ? it[STATE] : {}; + }; + has = function(it) { + return hasOwn(it, STATE); + }; + } + var store; + var STATE; + module.exports = { + set, + get, + has, + enforce, + getterFor + }; + } + }); + + // node_modules/core-js/internals/make-built-in.js + var require_make_built_in = __commonJS({ + "node_modules/core-js/internals/make-built-in.js"(exports, module) { + "use strict"; + var uncurryThis = require_function_uncurry_this(); + var fails = require_fails(); + var isCallable = require_is_callable(); + var hasOwn = require_has_own_property(); + var DESCRIPTORS = require_descriptors(); + var CONFIGURABLE_FUNCTION_NAME = require_function_name().CONFIGURABLE; + var inspectSource = require_inspect_source(); + var InternalStateModule = require_internal_state(); + var enforceInternalState = InternalStateModule.enforce; + var getInternalState = InternalStateModule.get; + var $String = String; + var defineProperty = Object.defineProperty; + var stringSlice = uncurryThis("".slice); + var replace = uncurryThis("".replace); + var join = uncurryThis([].join); + var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() { + return defineProperty(function() { + }, "length", { value: 8 }).length !== 8; + }); + var TEMPLATE = String(String).split("String"); + var makeBuiltIn = module.exports = function(value, name, options) { + if (stringSlice($String(name), 0, 7) === "Symbol(") { + name = "[" + replace($String(name), /^Symbol\(([^)]*)\)/, "$1") + "]"; + } + if (options && options.getter) + name = "get " + name; + if (options && options.setter) + name = "set " + name; + if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) { + if (DESCRIPTORS) + defineProperty(value, "name", { value: name, configurable: true }); + else + value.name = name; + } + if (CONFIGURABLE_LENGTH && options && hasOwn(options, "arity") && value.length !== options.arity) { + defineProperty(value, "length", { value: options.arity }); + } + try { + if (options && hasOwn(options, "constructor") && options.constructor) { + if (DESCRIPTORS) + defineProperty(value, "prototype", { writable: false }); + } else if (value.prototype) + value.prototype = void 0; + } catch (error) { + } + var state = enforceInternalState(value); + if (!hasOwn(state, "source")) { + state.source = join(TEMPLATE, typeof name == "string" ? name : ""); + } + return value; + }; + Function.prototype.toString = makeBuiltIn(function toString() { + return isCallable(this) && getInternalState(this).source || inspectSource(this); + }, "toString"); + } + }); + + // node_modules/core-js/internals/define-built-in-accessor.js + var require_define_built_in_accessor = __commonJS({ + "node_modules/core-js/internals/define-built-in-accessor.js"(exports, module) { + "use strict"; + var makeBuiltIn = require_make_built_in(); + var defineProperty = require_object_define_property(); + module.exports = function(target, name, descriptor) { + if (descriptor.get) + makeBuiltIn(descriptor.get, name, { getter: true }); + if (descriptor.set) + makeBuiltIn(descriptor.set, name, { setter: true }); + return defineProperty.f(target, name, descriptor); + }; + } + }); + + // node_modules/core-js/internals/regexp-flags.js + var require_regexp_flags = __commonJS({ + "node_modules/core-js/internals/regexp-flags.js"(exports, module) { + "use strict"; + var anObject = require_an_object(); + module.exports = function() { + var that = anObject(this); + var result = ""; + if (that.hasIndices) + result += "d"; + if (that.global) + result += "g"; + if (that.ignoreCase) + result += "i"; + if (that.multiline) + result += "m"; + if (that.dotAll) + result += "s"; + if (that.unicode) + result += "u"; + if (that.unicodeSets) + result += "v"; + if (that.sticky) + result += "y"; + return result; + }; + } + }); + + // node_modules/core-js/modules/es.regexp.flags.js + var require_es_regexp_flags = __commonJS({ + "node_modules/core-js/modules/es.regexp.flags.js"() { + "use strict"; + var global2 = require_global(); + var DESCRIPTORS = require_descriptors(); + var defineBuiltInAccessor = require_define_built_in_accessor(); + var regExpFlags = require_regexp_flags(); + var fails = require_fails(); + var RegExp2 = global2.RegExp; + var RegExpPrototype = RegExp2.prototype; + var FORCED = DESCRIPTORS && fails(function() { + var INDICES_SUPPORT = true; + try { + RegExp2(".", "d"); + } catch (error) { + INDICES_SUPPORT = false; + } + var O = {}; + var calls = ""; + var expected = INDICES_SUPPORT ? "dgimsy" : "gimsy"; + var addGetter = function(key2, chr) { + Object.defineProperty(O, key2, { get: function() { + calls += chr; + return true; + } }); + }; + var pairs = { + dotAll: "s", + global: "g", + ignoreCase: "i", + multiline: "m", + sticky: "y" + }; + if (INDICES_SUPPORT) + pairs.hasIndices = "d"; + for (var key in pairs) + addGetter(key, pairs[key]); + var result = Object.getOwnPropertyDescriptor(RegExpPrototype, "flags").get.call(O); + return result !== expected || calls !== expected; + }); + if (FORCED) + defineBuiltInAccessor(RegExpPrototype, "flags", { + configurable: true, + get: regExpFlags + }); + } + }); + + // node_modules/tiny-markdown-editor/lib/grammar.js + var require_grammar = __commonJS({ + "node_modules/tiny-markdown-editor/lib/grammar.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.htmlBlockGrammar = exports.commands = void 0; + exports.htmlescape = htmlescape; + exports.punctuationTrailing = exports.punctuationLeading = exports.lineGrammar = exports.inlineGrammar = void 0; + require_es_regexp_flags(); + var replacements = { + ASCIIPunctuation: /[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/, + NotTriggerChar: /[^`_*[\]()<>!~]/, + Scheme: /[A-Za-z][A-Za-z0-9+.-]{1,31}/, + Email: /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*/, + // From CommonMark spec + HTMLOpenTag: //, + HTMLCloseTag: /<\/HTMLTagName\s*>/, + HTMLTagName: /[A-Za-z][A-Za-z0-9-]*/, + HTMLComment: //, + HTMLPI: /<\?(?:|.|(?:[^?]|\?[^>])*)\?>/, + HTMLDeclaration: /]*>/, + HTMLCDATA: //, + HTMLAttribute: /\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:HTMLAttValue)?/, + HTMLAttValue: /\s*=\s*(?:(?:'[^']*')|(?:"[^"]*")|(?:[^\s"'=<>`]+))/, + KnownTag: /address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul/ + }; + var punctuationLeading = exports.punctuationLeading = new RegExp(/^(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])/); + var punctuationTrailing = exports.punctuationTrailing = new RegExp(/(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])$/); + var lineGrammar = exports.lineGrammar = { + TMH1: { + regexp: /^( {0,3}#\s)(.*?)((?:\s+#+\s*)?)$/, + replacement: '$1$$2$3' + }, + TMH2: { + regexp: /^( {0,3}##\s)(.*?)((?:\s+#+\s*)?)$/, + replacement: '$1$$2$3' + }, + TMH3: { + regexp: /^( {0,3}###\s)(.*?)((?:\s+#+\s*)?)$/, + replacement: '$1$$2$3' + }, + TMH4: { + regexp: /^( {0,3}####\s)(.*?)((?:\s+#+\s*)?)$/, + replacement: '$1$$2$3' + }, + TMH5: { + regexp: /^( {0,3}#####\s)(.*?)((?:\s+#+\s*)?)$/, + replacement: '$1$$2$3' + }, + TMH6: { + regexp: /^( {0,3}######\s)(.*?)((?:\s+#+\s*)?)$/, + replacement: '$1$$2$3' + }, + TMBlockquote: { + regexp: /^( {0,3}>[ ]?)(.*)$/, + replacement: '$1$$2' + }, + TMCodeFenceBacktickOpen: { + regexp: /^( {0,3}(?````*)\s*)([^`]*?)(\s*)$/, + replacement: '$1$3$4' + }, + TMCodeFenceTildeOpen: { + regexp: /^( {0,3}(?~~~~*)\s*)(.*?)(\s*)$/, + replacement: '$1$3$4' + }, + TMCodeFenceBacktickClose: { + regexp: /^( {0,3}(?````*))(\s*)$/, + replacement: '$1$3' + }, + TMCodeFenceTildeClose: { + regexp: /^( {0,3}(?~~~~*))(\s*)$/, + replacement: '$1$3' + }, + TMBlankLine: { + regexp: /^([ \t]*)$/, + replacement: "$0" + }, + TMSetextH1Marker: { + regexp: /^ {0,3}=+\s*$/, + replacement: '$0' + }, + TMSetextH2Marker: { + regexp: /^ {0,3}-+\s*$/, + replacement: '$0' + }, + TMHR: { + regexp: /^( {0,3}(\*[ \t]*\*[ \t]*\*[ \t*]*)|(-[ \t]*-[ \t]*-[ \t-]*)|(_[ \t]*_[ \t]*_[ \t_]*))$/, + replacement: '$0' + }, + TMUL: { + regexp: /^( {0,3}[+*-] {1,4})(.*)$/, + replacement: '$1$$2' + }, + TMOL: { + regexp: /^( {0,3}\d{1,9}[.)] {1,4})(.*)$/, + replacement: '$1$$2' + }, + // TODO: This is currently preventing sublists (and any content within list items, really) from working + TMIndentedCode: { + regexp: /^( {4}|\t)(.*)$/, + replacement: '$1$2' + }, + TMLinkReferenceDefinition: { + // TODO: Link destination can't include unbalanced parantheses, but we just ignore that here + regexp: /^( {0,3}\[\s*)([^\s\]](?:[^\]]|\\\])*?)(\s*\]:\s*)((?:[^\s<>]+)|(?:<(?:[^<>\\]|\\.)*>))?(\s*)((?:\((?:[^()\\]|\\.)*\))|(?:"(?:[^"\\]|\\.)*")|(?:'(?:[^'\\]|\\.)*'))?(\s*)$/, + replacement: '$1$2$3$4$5$6$7', + labelPlaceholder: 2 + // this defines which placeholder in the above regex is the link "label" + } + }; + var htmlBlockGrammar = exports.htmlBlockGrammar = [{ + start: /^ {0,3}<(?:script|pre|style)(?:\s|>|$)/i, + end: /(?:<\/script>|<\/pre>|<\/style>)/i, + paraInterrupt: true + }, { + start: /^ {0,3}/, + paraInterrupt: true + }, { + start: /^ {0,3}<\?/, + end: /\?>/, + paraInterrupt: true + }, { + start: /^ {0,3}/, + paraInterrupt: true + }, { + start: /^ {0,3}/, + paraInterrupt: true + }, { + start: /^ {0,3}(?:<|<\/)(?:KnownTag)(?:\s|>|\/>|$)/i, + end: false, + paraInterrupt: true + }, { + start: /^ {0,3}(?:HTMLOpenTag|HTMLCloseTag)\s*$/, + end: false, + paraInterrupt: false + }]; + var inlineGrammar = exports.inlineGrammar = { + escape: { + regexp: /^\\(ASCIIPunctuation)/, + replacement: '\\$1' + }, + code: { + regexp: /^(`+)((?:[^`])|(?:[^`].*?[^`]))(\1)/, + replacement: '$1$2$3' + }, + autolink: { + regexp: /^<((?:Scheme:[^\s<>]*)|(?:Email))>/, + replacement: '<$1>' + }, + html: { + regexp: /^((?:HTMLOpenTag)|(?:HTMLCloseTag)|(?:HTMLComment)|(?:HTMLPI)|(?:HTMLDeclaration)|(?:HTMLCDATA))/, + replacement: '$1' + }, + linkOpen: { + regexp: /^\[/, + replacement: "" + }, + imageOpen: { + regexp: /^!\[/, + replacement: "" + }, + linkLabel: { + regexp: /^(\[\s*)([^\]]*?)(\s*\])/, + replacement: "", + labelPlaceholder: 2 + }, + default: { + regexp: /^(.|(?:NotTriggerChar+))/, + replacement: "$1" + } + }; + var replacementRegexp = new RegExp(Object.keys(replacements).join("|")); + var inlineRules = [...Object.keys(inlineGrammar)]; + for (let rule of inlineRules) { + let re = inlineGrammar[rule].regexp.source; + while (re.match(replacementRegexp)) { + re = re.replace(replacementRegexp, (string) => { + return replacements[string].source; + }); + } + inlineGrammar[rule].regexp = new RegExp(re, inlineGrammar[rule].regexp.flags); + } + for (let rule of htmlBlockGrammar) { + let re = rule.start.source; + while (re.match(replacementRegexp)) { + re = re.replace(replacementRegexp, (string) => { + return replacements[string].source; + }); + } + rule.start = new RegExp(re, rule.start.flags); + } + function htmlescape(string) { + return (string ? string : "").replace(/&/g, "&").replace(//g, ">"); + } + var commands = exports.commands = { + // Replacements for unset for inline commands are '' by default + bold: { + type: "inline", + className: "TMStrong", + set: { + pre: "**", + post: "**" + }, + unset: { + prePattern: /(?:\*\*|__)$/, + postPattern: /^(?:\*\*|__)/ + } + }, + italic: { + type: "inline", + className: "TMEm", + set: { + pre: "*", + post: "*" + }, + unset: { + prePattern: /(?:\*|_)$/, + postPattern: /^(?:\*|_)/ + } + }, + code: { + type: "inline", + className: "TMCode", + set: { + pre: "`", + post: "`" + }, + unset: { + prePattern: /`+$/, + postPattern: /^`+/ + } + // FIXME this doesn't ensure balanced backticks right now + }, + strikethrough: { + type: "inline", + className: "TMStrikethrough", + set: { + pre: "~~", + post: "~~" + }, + unset: { + prePattern: /~~$/, + postPattern: /^~~/ + } + }, + h1: { + type: "line", + className: "TMH1", + set: { + pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, + replacement: "# $2" + }, + unset: { + pattern: /^( {0,3}#\s+)(.*?)((?:\s+#+\s*)?)$/, + replacement: "$2" + } + }, + h2: { + type: "line", + className: "TMH2", + set: { + pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, + replacement: "## $2" + }, + unset: { + pattern: /^( {0,3}##\s+)(.*?)((?:\s+#+\s*)?)$/, + replacement: "$2" + } + }, + h3: { + type: "line", + className: "TMH3", + set: { + pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, + replacement: "### $2" + }, + unset: { + pattern: /^( {0,3}###\s+)(.*?)((?:\s+#+\s*)?)$/, + replacement: "$2" + } + }, + h4: { + type: "line", + className: "TMH4", + set: { + pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, + replacement: "#### $2" + }, + unset: { + pattern: /^( {0,3}####\s+)(.*?)((?:\s+#+\s*)?)$/, + replacement: "$2" + } + }, + h5: { + type: "line", + className: "TMH5", + set: { + pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, + replacement: "##### $2" + }, + unset: { + pattern: /^( {0,3}#####\s+)(.*?)((?:\s+#+\s*)?)$/, + replacement: "$2" + } + }, + h6: { + type: "line", + className: "TMH6", + set: { + pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, + replacement: "###### $2" + }, + unset: { + pattern: /^( {0,3}######\s+)(.*?)((?:\s+#+\s*)?)$/, + replacement: "$2" + } + }, + ul: { + type: "line", + className: "TMUL", + set: { + pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, + replacement: "- $2" + }, + unset: { + pattern: /^( {0,3}[+*-] {1,4})(.*)$/, + replacement: "$2" + } + }, + ol: { + type: "line", + className: "TMOL", + set: { + pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, + replacement: "$#. $2" + }, + unset: { + pattern: /^( {0,3}\d{1,9}[.)] {1,4})(.*)$/, + replacement: "$2" + } + }, + blockquote: { + type: "line", + className: "TMBlockquote", + set: { + pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, + replacement: "> $2" + }, + unset: { + pattern: /^( {0,3}>[ ]?)(.*)$/, + replacement: "$2" + } + } + }; + } + }); + + // node_modules/tiny-markdown-editor/lib/TinyMDE.js + var require_TinyMDE = __commonJS({ + "node_modules/tiny-markdown-editor/lib/TinyMDE.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = void 0; + var _grammar = require_grammar(); + var Editor = class { + constructor() { + let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + this.e = null; + this.textarea = null; + this.lines = []; + this.lineElements = []; + this.lineTypes = []; + this.lineCaptures = []; + this.lineReplacements = []; + this.linkLabels = []; + this.lineDirty = []; + this.lastCommandState = null; + this.listeners = { + change: [], + selection: [] + }; + let element = props.element; + this.textarea = props.textarea; + if (this.textarea && !this.textarea.tagName) { + this.textarea = document.getElementById(this.textarea); + if (!element) + element = this.textarea; + } + if (element && !element.tagName) { + element = document.getElementById(props.element); + } + if (!element) { + element = document.getElementsByTagName("body")[0]; + } + if (element.tagName == "TEXTAREA") { + this.textarea = element; + element = this.textarea.parentNode; + } + if (this.textarea) { + this.textarea.style.display = "none"; + } + this.createEditorElement(element); + this.setContent(props.content || (this.textarea ? this.textarea.value : false) || "# Hello TinyMDE!\nEdit **here**"); + } + /** + * Creates the editor element inside the target element of the DOM tree + * @param element The target element of the DOM tree + */ + createEditorElement(element) { + this.e = document.createElement("div"); + this.e.className = "TinyMDE"; + this.e.contentEditable = true; + this.e.style.whiteSpace = "pre-wrap"; + this.e.style.webkitUserModify = "read-write-plaintext-only"; + if (this.textarea && this.textarea.parentNode == element && this.textarea.nextSibling) { + element.insertBefore(this.e, this.textarea.nextSibling); + } else { + element.appendChild(this.e); + } + this.e.addEventListener("input", (e) => this.handleInputEvent(e)); + document.addEventListener("selectionchange", (e) => this.handleSelectionChangeEvent(e)); + this.e.addEventListener("paste", (e) => this.handlePaste(e)); + this.lineElements = this.e.childNodes; + } + /** + * Sets the editor content. + * @param {string} content The new Markdown content + */ + setContent(content) { + while (this.e.firstChild) { + this.e.removeChild(this.e.firstChild); + } + this.lines = content.split(/(?:\r\n|\r|\n)/); + this.lineDirty = []; + for (let lineNum = 0; lineNum < this.lines.length; lineNum++) { + let le = document.createElement("div"); + this.e.appendChild(le); + this.lineDirty.push(true); + } + this.lineTypes = new Array(this.lines.length); + this.updateFormatting(); + this.fireChange(); + } + /** + * Gets the editor content as a Markdown string. + * @returns {string} The editor content as a markdown string + */ + getContent() { + return this.lines.join("\n"); + } + /** + * This is the main method to update the formatting (from this.lines to HTML output) + */ + updateFormatting() { + this.updateLineTypes(); + this.updateLinkLabels(); + this.applyLineTypes(); + } + /** + * Updates this.linkLabels: For every link reference definition (line type TMLinkReferenceDefinition), we collect the label + */ + updateLinkLabels() { + this.linkLabels = []; + for (let l = 0; l < this.lines.length; l++) { + if (this.lineTypes[l] == "TMLinkReferenceDefinition") { + this.linkLabels.push(this.lineCaptures[l][_grammar.lineGrammar.TMLinkReferenceDefinition.labelPlaceholder]); + } + } + } + /** + * Helper function to replace placeholders from a RegExp capture. The replacement string can contain regular dollar placeholders (e.g., $1), + * which are interpreted like in String.replace(), but also double dollar placeholders ($$1). In the case of double dollar placeholders, + * Markdown inline grammar is applied on the content of the captured subgroup, i.e., $$1 processes inline Markdown grammar in the content of the + * first captured subgroup, and replaces `$$1` with the result. + * + * @param {string} replacement The replacement string, including placeholders. + * @param capture The result of a RegExp.exec() call + * @returns The replacement string, with placeholders replaced from the capture result. + */ + replace(replacement, capture) { + return replacement.replace(/(\${1,2})([0-9])/g, (str, p1, p2) => { + if (p1 == "$") + return (0, _grammar.htmlescape)(capture[p2]); + else + return `${this.processInlineStyles(capture[p2])}`; + }); + } + /** + * Applies the line types (from this.lineTypes as well as the capture result in this.lineReplacements and this.lineCaptures) + * and processes inline formatting for all lines. + */ + applyLineTypes() { + for (let lineNum = 0; lineNum < this.lines.length; lineNum++) { + if (this.lineDirty[lineNum]) { + let contentHTML = this.replace(this.lineReplacements[lineNum], this.lineCaptures[lineNum]); + this.lineElements[lineNum].className = this.lineTypes[lineNum]; + this.lineElements[lineNum].removeAttribute("style"); + this.lineElements[lineNum].innerHTML = contentHTML == "" ? "
" : contentHTML; + } + this.lineElements[lineNum].dataset.lineNum = lineNum; + } + } + /** + * Determines line types for all lines based on the line / block grammar. Captures the results of the respective line + * grammar regular expressions. + * Updates this.lineTypes, this.lineCaptures, and this.lineReplacements. + */ + updateLineTypes() { + let codeBlockType = false; + let codeBlockSeqLength = 0; + let htmlBlock = false; + for (let lineNum = 0; lineNum < this.lines.length; lineNum++) { + let lineType = "TMPara"; + let lineCapture = [this.lines[lineNum]]; + let lineReplacement = "$$0"; + if (codeBlockType == "TMCodeFenceBacktickOpen") { + let capture = _grammar.lineGrammar.TMCodeFenceBacktickClose.regexp.exec(this.lines[lineNum]); + if (capture && capture.groups["seq"].length >= codeBlockSeqLength) { + lineType = "TMCodeFenceBacktickClose"; + lineReplacement = _grammar.lineGrammar.TMCodeFenceBacktickClose.replacement; + lineCapture = capture; + codeBlockType = false; + } else { + lineType = "TMFencedCodeBacktick"; + lineReplacement = "$0"; + lineCapture = [this.lines[lineNum]]; + } + } else if (codeBlockType == "TMCodeFenceTildeOpen") { + let capture = _grammar.lineGrammar.TMCodeFenceTildeClose.regexp.exec(this.lines[lineNum]); + if (capture && capture.groups["seq"].length >= codeBlockSeqLength) { + lineType = "TMCodeFenceTildeClose"; + lineReplacement = _grammar.lineGrammar.TMCodeFenceTildeClose.replacement; + lineCapture = capture; + codeBlockType = false; + } else { + lineType = "TMFencedCodeTilde"; + lineReplacement = "$0"; + lineCapture = [this.lines[lineNum]]; + } + } + if (lineType == "TMPara" && htmlBlock === false) { + for (let htmlBlockType of _grammar.htmlBlockGrammar) { + if (this.lines[lineNum].match(htmlBlockType.start)) { + if (htmlBlockType.paraInterrupt || lineNum == 0 || !(this.lineTypes[lineNum - 1] == "TMPara" || this.lineTypes[lineNum - 1] == "TMUL" || this.lineTypes[lineNum - 1] == "TMOL" || this.lineTypes[lineNum - 1] == "TMBlockquote")) { + htmlBlock = htmlBlockType; + break; + } + } + } + } + if (htmlBlock !== false) { + lineType = "TMHTMLBlock"; + lineReplacement = "$0"; + lineCapture = [this.lines[lineNum]]; + if (htmlBlock.end) { + if (this.lines[lineNum].match(htmlBlock.end)) { + htmlBlock = false; + } + } else { + if (lineNum == this.lines.length - 1 || this.lines[lineNum + 1].match(_grammar.lineGrammar.TMBlankLine.regexp)) { + htmlBlock = false; + } + } + } + if (lineType == "TMPara") { + for (let type in _grammar.lineGrammar) { + if (_grammar.lineGrammar[type].regexp) { + let capture = _grammar.lineGrammar[type].regexp.exec(this.lines[lineNum]); + if (capture) { + lineType = type; + lineReplacement = _grammar.lineGrammar[type].replacement; + lineCapture = capture; + break; + } + } + } + } + if (lineType == "TMCodeFenceBacktickOpen" || lineType == "TMCodeFenceTildeOpen") { + codeBlockType = lineType; + codeBlockSeqLength = lineCapture.groups["seq"].length; + } + if ((lineType == "TMIndentedCode" || lineType == "TMLinkReferenceDefinition") && lineNum > 0 && (this.lineTypes[lineNum - 1] == "TMPara" || this.lineTypes[lineNum - 1] == "TMUL" || this.lineTypes[lineNum - 1] == "TMOL" || this.lineTypes[lineNum - 1] == "TMBlockquote")) { + lineType = "TMPara"; + lineCapture = [this.lines[lineNum]]; + lineReplacement = "$$0"; + } + if (lineType == "TMSetextH2Marker") { + let capture = _grammar.lineGrammar.TMUL.regexp.exec(this.lines[lineNum]); + if (capture) { + lineType = "TMUL"; + lineReplacement = _grammar.lineGrammar.TMUL.replacement; + lineCapture = capture; + } + } + if (lineType == "TMSetextH1Marker" || lineType == "TMSetextH2Marker") { + if (lineNum == 0 || this.lineTypes[lineNum - 1] != "TMPara") { + let capture = _grammar.lineGrammar.TMHR.regexp.exec(this.lines[lineNum]); + if (capture) { + lineType = "TMHR"; + lineCapture = capture; + lineReplacement = _grammar.lineGrammar.TMHR.replacement; + } else { + lineType = "TMPara"; + lineCapture = [this.lines[lineNum]]; + lineReplacement = "$$0"; + } + } else { + let headingLine = lineNum - 1; + const headingLineType = lineType == "TMSetextH1Marker" ? "TMSetextH1" : "TMSetextH2"; + do { + if (this.lineTypes[headingLineType] != headingLineType) { + this.lineTypes[headingLine] = headingLineType; + this.lineDirty[headingLineType] = true; + } + this.lineReplacements[headingLine] = "$$0"; + this.lineCaptures[headingLine] = [this.lines[headingLine]]; + headingLine--; + } while (headingLine >= 0 && this.lineTypes[headingLine] == "TMPara"); + } + } + if (this.lineTypes[lineNum] != lineType) { + this.lineTypes[lineNum] = lineType; + this.lineDirty[lineNum] = true; + } + this.lineReplacements[lineNum] = lineReplacement; + this.lineCaptures[lineNum] = lineCapture; + } + } + /** + * Updates all line contents from the HTML, then re-applies formatting. + */ + updateLineContentsAndFormatting() { + this.clearDirtyFlag(); + this.updateLineContents(); + this.updateFormatting(); + } + /** + * Attempts to parse a link or image at the current position. This assumes that the opening [ or ![ has already been matched. + * Returns false if this is not a valid link, image. See below for more information + * @param {string} originalString The original string, starting at the opening marker ([ or ![) + * @param {boolean} isImage Whether or not this is an image (opener == ![) + * @returns false if not a valid link / image. + * Otherwise returns an object with two properties: output is the string to be included in the processed output, + * charCount is the number of input characters (from originalString) consumed. + */ + parseLinkOrImage(originalString, isImage) { + let textOffset = isImage ? 2 : 1; + let opener = originalString.substr(0, textOffset); + let type = isImage ? "TMImage" : "TMLink"; + let currentOffset = textOffset; + let bracketLevel = 1; + let linkText = false; + let linkRef = false; + let linkLabel = []; + let linkDetails = []; + textOuter: + while (currentOffset < originalString.length && linkText === false) { + let string = originalString.substr(currentOffset); + for (let rule of ["escape", "code", "autolink", "html"]) { + let cap = _grammar.inlineGrammar[rule].regexp.exec(string); + if (cap) { + currentOffset += cap[0].length; + continue textOuter; + } + } + if (string.match(_grammar.inlineGrammar.imageOpen.regexp)) { + bracketLevel++; + currentOffset += 2; + continue textOuter; + } + if (string.match(_grammar.inlineGrammar.linkOpen.regexp)) { + bracketLevel++; + if (!isImage) { + if (this.parseLinkOrImage(string, false)) { + return false; + } + } + currentOffset += 1; + continue textOuter; + } + if (string.match(/^\]/)) { + bracketLevel--; + if (bracketLevel == 0) { + linkText = originalString.substr(textOffset, currentOffset - textOffset); + currentOffset++; + continue textOuter; + } + } + currentOffset++; + } + if (linkText === false) + return false; + let nextChar = currentOffset < originalString.length ? originalString.substr(currentOffset, 1) : ""; + if (nextChar == "[") { + let string = originalString.substr(currentOffset); + let cap = _grammar.inlineGrammar.linkLabel.regexp.exec(string); + if (cap) { + currentOffset += cap[0].length; + linkLabel.push(cap[1], cap[2], cap[3]); + if (cap[_grammar.inlineGrammar.linkLabel.labelPlaceholder]) { + linkRef = cap[_grammar.inlineGrammar.linkLabel.labelPlaceholder]; + } else { + linkRef = linkText.trim(); + } + } else { + return false; + } + } else if (nextChar != "(") { + linkRef = linkText.trim(); + } else { + currentOffset++; + let parenthesisLevel = 1; + inlineOuter: + while (currentOffset < originalString.length && parenthesisLevel > 0) { + let string = originalString.substr(currentOffset); + let cap = /^\s+/.exec(string); + if (cap) { + switch (linkDetails.length) { + case 0: + linkDetails.push(cap[0]); + break; + case 1: + linkDetails.push(cap[0]); + break; + case 2: + if (linkDetails[0].match(//)) { + if (linkDetails.length == 1) + linkDetails.push(""); + linkDetails.push(">"); + currentOffset++; + continue inlineOuter; + } + cap = /^["']/.exec(string); + if (cap && (linkDetails.length == 0 || linkDetails.length == 1 || linkDetails.length == 4)) { + while (linkDetails.length < 4) + linkDetails.push(""); + linkDetails.push(cap[0]); + currentOffset++; + continue inlineOuter; + } + if (cap && (linkDetails.length == 5 || linkDetails.length == 6) && linkDetails[4] == cap[0]) { + if (linkDetails.length == 5) + linkDetails.push(""); + linkDetails.push(cap[0]); + currentOffset++; + continue inlineOuter; + } + if (string.match(/^\(/)) { + switch (linkDetails.length) { + case 0: + linkDetails.push(""); + case 1: + linkDetails.push(""); + case 2: + linkDetails[1] = linkDetails[1].concat("("); + if (!linkDetails[0].match(/<$/)) + parenthesisLevel++; + break; + case 3: + linkDetails.push(""); + case 4: + linkDetails.push("("); + break; + case 5: + linkDetails.push(""); + case 6: + if (linkDetails[4] == "(") + return false; + linkDetails[5] = linkDetails[5].concat("("); + break; + default: + return false; + } + currentOffset++; + continue inlineOuter; + } + if (string.match(/^\)/)) { + if (linkDetails.length <= 2) { + while (linkDetails.length < 2) + linkDetails.push(""); + if (!linkDetails[0].match(/<$/)) + parenthesisLevel--; + if (parenthesisLevel > 0) { + linkDetails[1] = linkDetails[1].concat(")"); + } + } else if (linkDetails.length == 5 || linkDetails.length == 6) { + if (linkDetails[4] == "(") { + if (linkDetails.length == 5) + linkDetails.push(""); + linkDetails.push(")"); + } else { + if (linkDetails.length == 5) + linkDetails.push(")"); + else + linkDetails[5] = linkDetails[5].concat(")"); + } + } else { + parenthesisLevel--; + } + if (parenthesisLevel == 0) { + while (linkDetails.length < 7) + linkDetails.push(""); + } + currentOffset++; + continue inlineOuter; + } + cap = /^./.exec(string); + if (cap) { + switch (linkDetails.length) { + case 0: + linkDetails.push(""); + case 1: + linkDetails.push(cap[0]); + break; + case 2: + linkDetails[1] = linkDetails[1].concat(cap[0]); + break; + case 3: + return false; + case 4: + return false; + case 5: + linkDetails.push(""); + case 6: + linkDetails[5] = linkDetails[5].concat(cap[0]); + break; + default: + return false; + } + currentOffset += cap[0].length; + continue inlineOuter; + } + throw "Infinite loop"; + } + if (parenthesisLevel > 0) + return false; + } + if (linkRef !== false) { + let valid = false; + for (let label2 of this.linkLabels) { + if (label2 == linkRef) { + valid = true; + break; + } + } + let label = valid ? "TMLinkLabel TMLinkLabel_Valid" : "TMLinkLabel TMLinkLabel_Invalid"; + let output = `${opener}${this.processInlineStyles(linkText)}]`; + if (linkLabel.length >= 3) { + output = output.concat(`${linkLabel[0]}`, `${linkLabel[1]}`, `${linkLabel[2]}`); + } + return { + output, + charCount: currentOffset + }; + } else if (linkDetails) { + while (linkDetails.length < 7) { + linkDetails.push(""); + } + return { + output: `${opener}${this.processInlineStyles(linkText)}](${linkDetails[0]}${linkDetails[1]}${linkDetails[2]}${linkDetails[3]}${linkDetails[4]}${linkDetails[5]}${linkDetails[6]})`, + charCount: currentOffset + }; + } + return false; + } + /** + * Formats a markdown string as HTML, using Markdown inline formatting. + * @param {string} originalString The input (markdown inline formatted) string + * @returns {string} The HTML formatted output + */ + processInlineStyles(originalString) { + let processed = ""; + let stack = []; + let offset = 0; + let string = originalString; + outer: + while (string) { + for (let rule of ["escape", "code", "autolink", "html"]) { + let cap2 = _grammar.inlineGrammar[rule].regexp.exec(string); + if (cap2) { + string = string.substr(cap2[0].length); + offset += cap2[0].length; + processed += _grammar.inlineGrammar[rule].replacement.replace(/\$([1-9])/g, (str, p1) => (0, _grammar.htmlescape)(cap2[p1])); + continue outer; + } + } + let potentialLink = string.match(_grammar.inlineGrammar.linkOpen.regexp); + let potentialImage = string.match(_grammar.inlineGrammar.imageOpen.regexp); + if (potentialImage || potentialLink) { + let result = this.parseLinkOrImage(string, potentialImage); + if (result) { + processed = `${processed}${result.output}`; + string = string.substr(result.charCount); + offset += result.charCount; + continue outer; + } + } + let cap = /(^\*+)|(^_+)/.exec(string); + if (cap) { + let delimCount = cap[0].length; + const delimString = cap[0]; + const currentDelimiter = cap[0][0]; + string = string.substr(cap[0].length); + const preceding = offset > 0 ? originalString.substr(0, offset) : " "; + const following = offset + cap[0].length < originalString.length ? string : " "; + const punctuationFollows = following.match(_grammar.punctuationLeading); + const punctuationPrecedes = preceding.match(_grammar.punctuationTrailing); + const whitespaceFollows = following.match(/^\s/); + const whitespacePrecedes = preceding.match(/\s$/); + let canOpen = !whitespaceFollows && (!punctuationFollows || !!whitespacePrecedes || !!punctuationPrecedes); + let canClose = !whitespacePrecedes && (!punctuationPrecedes || !!whitespaceFollows || !!punctuationFollows); + if (currentDelimiter == "_" && canOpen && canClose) { + canOpen = punctuationPrecedes; + canClose = punctuationFollows; + } + if (canClose) { + let stackPointer = stack.length - 1; + while (delimCount && stackPointer >= 0) { + if (stack[stackPointer].delimiter == currentDelimiter) { + while (stackPointer < stack.length - 1) { + const entry = stack.pop(); + processed = `${entry.output}${entry.delimString.substr(0, entry.count)}${processed}`; + } + if (delimCount >= 2 && stack[stackPointer].count >= 2) { + processed = `${currentDelimiter}${currentDelimiter}${processed}${currentDelimiter}${currentDelimiter}`; + delimCount -= 2; + stack[stackPointer].count -= 2; + } else { + processed = `${currentDelimiter}${processed}${currentDelimiter}`; + delimCount -= 1; + stack[stackPointer].count -= 1; + } + if (stack[stackPointer].count == 0) { + let entry = stack.pop(); + processed = `${entry.output}${processed}`; + stackPointer--; + } + } else { + stackPointer--; + } + } + } + if (delimCount && canOpen) { + stack.push({ + delimiter: currentDelimiter, + delimString, + count: delimCount, + output: processed + }); + processed = ""; + delimCount = 0; + } + if (delimCount) { + processed = `${processed}${delimString.substr(0, delimCount)}`; + } + offset += cap[0].length; + continue outer; + } + cap = /^~~/.exec(string); + if (cap) { + let consumed = false; + let stackPointer = stack.length - 1; + while (!consumed && stackPointer >= 0) { + if (stack[stackPointer].delimiter == "~") { + while (stackPointer < stack.length - 1) { + const entry2 = stack.pop(); + processed = `${entry2.output}${entry2.delimString.substr(0, entry2.count)}${processed}`; + } + processed = `~~${processed}~~`; + let entry = stack.pop(); + processed = `${entry.output}${processed}`; + consumed = true; + } else { + stackPointer--; + } + } + if (!consumed) { + stack.push({ + delimiter: "~", + delimString: "~~", + count: 2, + output: processed + }); + processed = ""; + } + offset += cap[0].length; + string = string.substr(cap[0].length); + continue outer; + } + cap = _grammar.inlineGrammar.default.regexp.exec(string); + if (cap) { + string = string.substr(cap[0].length); + offset += cap[0].length; + processed += _grammar.inlineGrammar.default.replacement.replace(/\$([1-9])/g, (str, p1) => (0, _grammar.htmlescape)(cap[p1])); + continue outer; + } + throw "Infinite loop!"; + } + while (stack.length) { + const entry = stack.pop(); + processed = `${entry.output}${entry.delimString.substr(0, entry.count)}${processed}`; + } + return processed; + } + /** + * Clears the line dirty flag (resets it to an array of false) + */ + clearDirtyFlag() { + this.lineDirty = new Array(this.lines.length); + for (let i = 0; i < this.lineDirty.length; i++) { + this.lineDirty[i] = false; + } + } + /** + * Updates the class properties (lines, lineElements) from the DOM. + * @returns true if contents changed + */ + updateLineContents() { + let lineDelta = this.e.childElementCount - this.lines.length; + if (lineDelta) { + let firstChangedLine = 0; + while (firstChangedLine <= this.lines.length && firstChangedLine <= this.lineElements.length && this.lineElements[firstChangedLine] && this.lines[firstChangedLine] == this.lineElements[firstChangedLine].textContent) { + firstChangedLine++; + } + let lastChangedLine = -1; + while (-lastChangedLine < this.lines.length && -lastChangedLine < this.lineElements.length && this.lines[this.lines.length + lastChangedLine] == this.lineElements[this.lineElements.length + lastChangedLine].textContent) { + lastChangedLine--; + } + let linesToDelete = this.lines.length + lastChangedLine + 1 - firstChangedLine; + if (linesToDelete < -lineDelta) + linesToDelete = -lineDelta; + if (linesToDelete < 0) + linesToDelete = 0; + let linesToAdd = []; + for (let l = 0; l < linesToDelete + lineDelta; l++) { + linesToAdd.push(this.lineElements[firstChangedLine + l].textContent); + } + this.spliceLines(firstChangedLine, linesToDelete, linesToAdd, false); + } else { + for (let line = 0; line < this.lineElements.length; line++) { + let e = this.lineElements[line]; + let ct = e.textContent; + if (this.lines[line] !== ct) { + this.lines[line] = ct; + this.lineDirty[line] = true; + } + } + } + } + /** + * Processes a new paragraph. + * @param sel The current selection + */ + processNewParagraph(sel) { + if (!sel) + return; + this.updateLineContents(); + let continuableType = false; + let checkLine = sel.col > 0 ? sel.row : sel.row - 1; + switch (this.lineTypes[checkLine]) { + case "TMUL": + continuableType = "TMUL"; + break; + case "TMOL": + continuableType = "TMOL"; + break; + case "TMIndentedCode": + continuableType = "TMIndentedCode"; + break; + } + let lines = this.lines[sel.row].replace(/\n\n$/, "\n").split(/(?:\r\n|\n|\r)/); + if (lines.length == 1) { + this.updateFormatting(); + return; + } + this.spliceLines(sel.row, 1, lines, true); + sel.row++; + sel.col = 0; + if (continuableType) { + let capture = _grammar.lineGrammar[continuableType].regexp.exec(this.lines[sel.row - 1]); + if (capture) { + if (capture[2]) { + if (continuableType == "TMOL") { + capture[1] = capture[1].replace(/\d{1,9}/, (result) => { + return parseInt(result[0]) + 1; + }); + } + this.lines[sel.row] = `${capture[1]}${this.lines[sel.row]}`; + this.lineDirty[sel.row] = true; + sel.col = capture[1].length; + } else { + this.lines[sel.row - 1] = ""; + this.lineDirty[sel.row - 1] = true; + } + } + } + this.updateFormatting(); + } + // /** + // * Processes a "delete" input action. + // * @param {object} focus The selection + // * @param {boolean} forward If true, performs a forward delete, otherwise performs a backward delete + // */ + // processDelete(focus, forward) { + // if (!focus) return; + // let anchor = this.getSelection(true); + // // Do we have a non-empty selection? + // if (focus.col != anchor.col || focus.row != anchor.row) { + // // non-empty. direction doesn't matter. + // this.paste('', anchor, focus); + // } else { + // if (forward) { + // if (focus.col < this.lines[focus.row].length) this.paste('', {row: focus.row, col: focus.col + 1}, focus); + // else if (focus.col < this.lines.length) this.paste('', {row: focus.row + 1, col: 0}, focus); + // // Otherwise, we're at the very end and can't delete forward + // } else { + // if (focus.col > 0) this.paste('', {row: focus.row, col: focus.col - 1}, focus); + // else if (focus.row > 0) this.paste('', {row: focus.row - 1, col: this.lines[focus.row - 1].length - 1}, focus); + // // Otherwise, we're at the very beginning and can't delete backwards + // } + // } + // } + /** + * Gets the current position of the selection counted by row and column of the editor Markdown content (as opposed to the position in the DOM). + * + * @param {boolean} getAnchor if set to true, gets the selection anchor (start point of the selection), otherwise gets the focus (end point). + * @return {object} An object representing the selection, with properties col and row. + */ + getSelection() { + let getAnchor = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; + const selection = window.getSelection(); + let startNode = getAnchor ? selection.anchorNode : selection.focusNode; + if (!startNode) + return null; + let offset = startNode.nodeType === Node.TEXT_NODE ? getAnchor ? selection.anchorOffset : selection.focusOffset : 0; + if (startNode == this.e) { + return { + row: 0, + col: offset + }; + } + let col = this.computeColumn(startNode, offset); + if (col === null) + return null; + let node = startNode; + while (node.parentElement != this.e) { + node = node.parentElement; + } + let row = 0; + if (node.dataset && node.dataset.lineNum && (!node.previousSibling || node.previousSibling.dataset.lineNum != node.dataset.lineNum)) { + row = parseInt(node.dataset.lineNum); + } else { + while (node.previousSibling) { + row++; + node = node.previousSibling; + } + } + return { + row, + col, + node: startNode + }; + } + /** + * Computes a column within an editor line from a node and offset within that node. + * @param {Node} startNode The node + * @param {int} offset THe selection + * @returns {int} the column, or null if the node is not inside the editor + */ + computeColumn(startNode, offset) { + let node = startNode; + let col = offset; + while (node && node.parentNode != this.e) { + node = node.parentNode; + } + if (node == null) + return null; + node = startNode; + while (node.parentNode != this.e) { + if (node.previousSibling) { + node = node.previousSibling; + col += node.textContent.length; + } else { + node = node.parentNode; + } + } + return col; + } + /** + * Computes DOM node and offset within that node from a position expressed as row and column. + * @param {int} row Row (line number) + * @param {int} col Column + * @returns An object with two properties: node and offset. offset may be null; + */ + computeNodeAndOffset(row, col) { + let bindRight = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; + if (row >= this.lineElements.length) { + row = this.lineElements.length - 1; + col = this.lines[row].length; + } + if (col > this.lines[row].length) { + col = this.lines[row].length; + } + const parentNode = this.lineElements[row]; + let node = parentNode.firstChild; + let childrenComplete = false; + let rv = { + node: parentNode.firstChild ? parentNode.firstChild : parentNode, + offset: 0 + }; + while (node != parentNode) { + if (!childrenComplete && node.nodeType === Node.TEXT_NODE) { + if (node.nodeValue.length >= col) { + if (bindRight && node.nodeValue.length == col) { + rv = { + node, + offset: col + }; + col = 0; + } else { + return { + node, + offset: col + }; + } + } else { + col -= node.nodeValue.length; + } + } + if (!childrenComplete && node.firstChild) { + node = node.firstChild; + } else if (node.nextSibling) { + childrenComplete = false; + node = node.nextSibling; + } else { + childrenComplete = true; + node = node.parentNode; + } + } + return rv; + } + /** + * Sets the selection based on rows and columns within the editor Markdown content. + * @param {object} focus Object representing the selection, needs to have properties row and col. + */ + setSelection(focus) { + let anchor = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; + if (!focus) + return; + let range = document.createRange(); + let { + node: focusNode, + offset: focusOffset + } = this.computeNodeAndOffset(focus.row, focus.col, anchor && anchor.row == focus.row && anchor.col > focus.col); + let anchorNode = null, anchorOffset = null; + if (anchor && (anchor.row != focus.row || anchor.col != focus.col)) { + let { + node, + offset + } = this.computeNodeAndOffset(anchor.row, anchor.col, focus.row == anchor.row && focus.col > anchor.col); + anchorNode = node; + anchorOffset = offset; + } + if (anchorNode) + range.setStart(anchorNode, anchorOffset); + else + range.setStart(focusNode, focusOffset); + range.setEnd(focusNode, focusOffset); + let windowSelection = window.getSelection(); + windowSelection.removeAllRanges(); + windowSelection.addRange(range); + } + /** + * Event handler for input events + */ + handleInputEvent(event) { + let focus = this.getSelection(); + if ((event.inputType == "insertParagraph" || event.inputType == "insertLineBreak") && focus) { + this.clearDirtyFlag(); + this.processNewParagraph(focus); + } else { + if (!this.e.firstChild) { + this.e.innerHTML = '

'; + } else { + for (let childNode = this.e.firstChild; childNode; childNode = childNode.nextSibling) { + if (childNode.nodeType != 3 || childNode.tagName != "DIV") { + let divWrapper = document.createElement("div"); + this.e.insertBefore(divWrapper, childNode); + this.e.removeChild(childNode); + divWrapper.appendChild(childNode); + } + } + } + this.updateLineContentsAndFormatting(); + } + if (focus) + this.setSelection(focus); + this.fireChange(); + } + /** + * Event handler for "selectionchange" events. + */ + handleSelectionChangeEvent() { + this.fireSelection(); + } + /** + * Convenience function to "splice" new lines into the arrays this.lines, this.lineDirty, this.lineTypes, and the DOM elements + * underneath the editor element. + * This method is essentially Array.splice, only that the third parameter takes an un-spread array (and the forth parameter) + * determines whether the DOM should also be adjusted. + * + * @param {int} startLine Position at which to start changing the array of lines + * @param {int} linesToDelete Number of lines to delete + * @param {array} linesToInsert Array of strings representing the lines to be inserted + * @param {boolean} adjustLineElements If true, then
elements are also inserted in the DOM at the respective position + */ + spliceLines(startLine) { + let linesToDelete = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + let linesToInsert = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : []; + let adjustLineElements = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true; + if (adjustLineElements) { + for (let i = 0; i < linesToDelete; i++) { + this.e.removeChild(this.e.childNodes[startLine]); + } + } + let insertedBlank = []; + let insertedDirty = []; + for (let i = 0; i < linesToInsert.length; i++) { + insertedBlank.push(""); + insertedDirty.push(true); + if (adjustLineElements) { + if (this.e.childNodes[startLine]) + this.e.insertBefore(document.createElement("div"), this.e.childNodes[startLine]); + else + this.e.appendChild(document.createElement("div")); + } + } + this.lines.splice(startLine, linesToDelete, ...linesToInsert); + this.lineTypes.splice(startLine, linesToDelete, ...insertedBlank); + this.lineDirty.splice(startLine, linesToDelete, ...insertedDirty); + } + /** + * Event handler for the "paste" event + */ + handlePaste(event) { + event.preventDefault(); + let text = (event.originalEvent || event).clipboardData.getData("text/plain"); + this.paste(text); + } + /** + * Pastes the text at the current selection (or at the end, if no current selection) + * @param {string} text + */ + paste(text) { + let anchor = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; + let focus = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null; + if (!anchor) + anchor = this.getSelection(true); + if (!focus) + focus = this.getSelection(false); + let beginning, end; + if (!focus) { + focus = { + row: this.lines.length - 1, + col: this.lines[this.lines.length - 1].length + }; + } + if (!anchor) { + anchor = focus; + } + if (anchor.row < focus.row || anchor.row == focus.row && anchor.col <= focus.col) { + beginning = anchor; + end = focus; + } else { + beginning = focus; + end = anchor; + } + let insertedLines = text.split(/(?:\r\n|\r|\n)/); + let lineBefore = this.lines[beginning.row].substr(0, beginning.col); + let lineEnd = this.lines[end.row].substr(end.col); + insertedLines[0] = lineBefore.concat(insertedLines[0]); + let endColPos = insertedLines[insertedLines.length - 1].length; + insertedLines[insertedLines.length - 1] = insertedLines[insertedLines.length - 1].concat(lineEnd); + this.spliceLines(beginning.row, 1 + end.row - beginning.row, insertedLines); + focus.row = beginning.row + insertedLines.length - 1; + focus.col = endColPos; + this.updateFormatting(); + this.setSelection(focus); + this.fireChange(); + } + /** + * Computes the (lowest in the DOM tree) common ancestor of two DOM nodes. + * @param {Node} node1 the first node + * @param {Node} node2 the second node + * @returns {Node} The commen ancestor node, or null if there is no common ancestor + */ + computeCommonAncestor(node1, node2) { + if (!node1 || !node2) + return null; + if (node1 == node2) + return node1; + const ancestry = (node) => { + let ancestry3 = []; + while (node) { + ancestry3.unshift(node); + node = node.parentNode; + } + return ancestry3; + }; + const ancestry1 = ancestry(node1); + const ancestry2 = ancestry(node2); + if (ancestry1[0] != ancestry2[0]) + return null; + let i; + for (i = 0; ancestry1[i] == ancestry2[i]; i++) + ; + return ancestry1[i - 1]; + } + /** + * Finds the (lowest in the DOM tree) enclosing DOM node with a given class. + * @param {object} focus The focus selection object + * @param {object} anchor The anchor selection object + * @param {string} className The class name to find + * @returns {Node} The enclosing DOM node with the respective class (inside the editor), if there is one; null otherwise. + */ + computeEnclosingMarkupNode(focus, anchor, className) { + let node = null; + if (!focus) + return null; + if (!anchor) { + node = focus.node; + } else { + if (focus.row != anchor.row) + return null; + node = this.computeCommonAncestor(focus.node, anchor.node); + } + if (!node) + return null; + while (node != this.e) { + if (node.className && node.className.includes(className)) + return node; + node = node.parentNode; + } + return null; + } + /** + * Returns the state (true / false) of all commands. + * @param focus Focus of the selection. If not given, assumes the current focus. + */ + getCommandState() { + let focus = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; + let anchor = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; + let commandState = {}; + if (!focus) + focus = this.getSelection(false); + if (!anchor) + anchor = this.getSelection(true); + if (!focus) { + for (let cmd in _grammar.commands) { + commandState[cmd] = null; + } + return commandState; + } + if (!anchor) + anchor = focus; + let start, end; + if (anchor.row < focus.row || anchor.row == focus.row && anchor.col < focus.col) { + start = anchor; + end = focus; + } else { + start = focus; + end = anchor; + } + if (end.row > start.row && end.col == 0) { + end.row--; + end.col = this.lines[end.row].length; + } + for (let cmd in _grammar.commands) { + if (_grammar.commands[cmd].type == "inline") { + if (!focus || focus.row != anchor.row || !this.isInlineFormattingAllowed(focus, anchor)) { + commandState[cmd] = null; + } else { + commandState[cmd] = !!this.computeEnclosingMarkupNode(focus, anchor, _grammar.commands[cmd].className) || // ... or if it's an empty string preceded by and followed by formatting markers, e.g. **|** where | is the cursor + focus.col == anchor.col && !!this.lines[focus.row].substr(0, focus.col).match(_grammar.commands[cmd].unset.prePattern) && !!this.lines[focus.row].substr(focus.col).match(_grammar.commands[cmd].unset.postPattern); + } + } + if (_grammar.commands[cmd].type == "line") { + if (!focus) { + commandState[cmd] = null; + } else { + let state = this.lineTypes[start.row] == _grammar.commands[cmd].className; + for (let line = start.row; line <= end.row; line++) { + if (this.lineTypes[line] == _grammar.commands[cmd].className != state) { + state = null; + break; + } + } + commandState[cmd] = state; + } + } + } + return commandState; + } + /** + * Sets a command state + * @param {string} command + * @param {boolean} state + */ + setCommandState(command, state) { + if (_grammar.commands[command].type == "inline") { + let anchor = this.getSelection(true); + let focus = this.getSelection(false); + if (!anchor) + anchor = focus; + if (!anchor) + return; + if (anchor.row != focus.row) + return; + if (!this.isInlineFormattingAllowed(focus, anchor)) + return; + let markupNode = this.computeEnclosingMarkupNode(focus, anchor, _grammar.commands[command].className); + this.clearDirtyFlag(); + if (markupNode) { + this.lineDirty[focus.row] = true; + const startCol = this.computeColumn(markupNode, 0); + const len = markupNode.textContent.length; + const left = this.lines[focus.row].substr(0, startCol).replace(_grammar.commands[command].unset.prePattern, ""); + const mid = this.lines[focus.row].substr(startCol, len); + const right = this.lines[focus.row].substr(startCol + len).replace(_grammar.commands[command].unset.postPattern, ""); + this.lines[focus.row] = left.concat(mid, right); + anchor.col = left.length; + focus.col = anchor.col + len; + this.updateFormatting(); + this.setSelection(focus, anchor); + } else if (focus.col == anchor.col && !!this.lines[focus.row].substr(0, focus.col).match(_grammar.commands[command].unset.prePattern) && !!this.lines[focus.row].substr(focus.col).match(_grammar.commands[command].unset.postPattern)) { + this.lineDirty[focus.row] = true; + const left = this.lines[focus.row].substr(0, focus.col).replace(_grammar.commands[command].unset.prePattern, ""); + const right = this.lines[focus.row].substr(focus.col).replace(_grammar.commands[command].unset.postPattern, ""); + this.lines[focus.row] = left.concat(right); + focus.col = anchor.col = left.length; + this.updateFormatting(); + this.setSelection(focus, anchor); + } else { + let { + startCol, + endCol + } = focus.col < anchor.col ? { + startCol: focus.col, + endCol: anchor.col + } : { + startCol: anchor.col, + endCol: focus.col + }; + let match = this.lines[focus.row].substr(startCol, endCol - startCol).match(/^(?\s*).*\S(?\s*)$/); + if (match) { + startCol += match.groups.leading.length; + endCol -= match.groups.trailing.length; + } + focus.col = startCol; + anchor.col = endCol; + this.wrapSelection(_grammar.commands[command].set.pre, _grammar.commands[command].set.post, focus, anchor); + } + } else if (_grammar.commands[command].type == "line") { + let anchor = this.getSelection(true); + let focus = this.getSelection(false); + if (!anchor) + anchor = focus; + if (!focus) + return; + this.clearDirtyFlag(); + let start = anchor.row > focus.row ? focus : anchor; + let end = anchor.row > focus.row ? anchor : focus; + if (end.row > start.row && end.col == 0) { + end.row--; + } + for (let line = start.row; line <= end.row; line++) { + if (state && this.lineTypes[line] != _grammar.commands[command].className) { + this.lines[line] = this.lines[line].replace(_grammar.commands[command].set.pattern, _grammar.commands[command].set.replacement.replace("$#", line - start.row + 1)); + this.lineDirty[line] = true; + } + if (!state && this.lineTypes[line] == _grammar.commands[command].className) { + this.lines[line] = this.lines[line].replace(_grammar.commands[command].unset.pattern, _grammar.commands[command].unset.replacement); + this.lineDirty[line] = true; + } + } + this.updateFormatting(); + this.setSelection({ + row: end.row, + col: this.lines[end.row].length + }, { + row: start.row, + col: 0 + }); + } + } + /** + * Returns whether or not inline formatting is allowed at the current focus + * @param {object} focus The current focus + */ + isInlineFormattingAllowed() { + const sel = window.getSelection(); + if (!sel) + return false; + if (sel.isCollapsed && sel.focusNode.nodeType == 3 && sel.focusOffset == sel.focusNode.nodeValue.length) { + let node; + for (node = sel.focusNode; node && node.nextSibling == null; node = node.parentNode) + ; + if (node && node.nextSibling.className && node.nextSibling.className.includes("TMInlineFormatted")) + return true; + } + let ancestor = this.computeCommonAncestor(sel.focusNode, sel.anchorNode); + if (!ancestor) + return false; + while (ancestor && ancestor != this.e) { + if (ancestor.className && (ancestor.className.includes("TMInlineFormatted") || ancestor.className.includes("TMBlankLine"))) + return true; + ancestor = ancestor.parentNode; + } + return false; + } + /** + * Wraps the current selection in the strings pre and post. If the selection is not on one line, returns. + * @param {string} pre The string to insert before the selection. + * @param {string} post The string to insert after the selection. + * @param {object} focus The current selection focus. If null, selection will be computed. + * @param {object} anchor The current selection focus. If null, selection will be computed. + */ + wrapSelection(pre, post) { + let focus = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null; + let anchor = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; + if (!focus) + focus = this.getSelection(false); + if (!anchor) + anchor = this.getSelection(true); + if (!focus || !anchor || focus.row != anchor.row) + return; + this.lineDirty[focus.row] = true; + const startCol = focus.col < anchor.col ? focus.col : anchor.col; + const endCol = focus.col < anchor.col ? anchor.col : focus.col; + const left = this.lines[focus.row].substr(0, startCol).concat(pre); + const mid = endCol == startCol ? "" : this.lines[focus.row].substr(startCol, endCol - startCol); + const right = post.concat(this.lines[focus.row].substr(endCol)); + this.lines[focus.row] = left.concat(mid, right); + anchor.col = left.length; + focus.col = anchor.col + mid.length; + this.updateFormatting(); + this.setSelection(focus, anchor); + } + /** + * Toggles the command state for a command (true <-> false) + * @param {string} command The editor command + */ + toggleCommandState(command) { + if (!this.lastCommandState) + this.lastCommandState = this.getCommandState(); + this.setCommandState(command, !this.lastCommandState[command]); + } + /** + * Fires a change event. Updates the linked textarea and notifies any event listeners. + */ + fireChange() { + if (!this.textarea && !this.listeners.change.length) + return; + const content = this.getContent(); + if (this.textarea) + this.textarea.value = content; + for (let listener of this.listeners.change) { + listener({ + content, + linesDirty: this.linesDirty + }); + } + } + /** + * Fires a "selection changed" event. + */ + fireSelection() { + if (this.listeners.selection && this.listeners.selection.length) { + let focus = this.getSelection(false); + let anchor = this.getSelection(true); + let commandState = this.getCommandState(focus, anchor); + if (this.lastCommandState) { + Object.assign(this.lastCommandState, commandState); + } else { + this.lastCommandState = Object.assign({}, commandState); + } + for (let listener of this.listeners.selection) { + listener({ + focus, + anchor, + commandState: this.lastCommandState + }); + } + } + } + /** + * Adds an event listener. + * @param {string} type The type of event to listen to. Can be 'change' or 'selection' + * @param {*} listener Function of the type (event) => {} to be called when the event occurs. + */ + addEventListener(type, listener) { + if (type.match(/^(?:change|input)$/i)) { + this.listeners.change.push(listener); + } + if (type.match(/^(?:selection|selectionchange)$/i)) { + this.listeners.selection.push(listener); + } + } + }; + var _default = exports.default = Editor; + } + }); + + // node_modules/tiny-markdown-editor/lib/index.js + var require_lib = __commonJS({ + "node_modules/tiny-markdown-editor/lib/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + Object.defineProperty(exports, "CommandBar", { + enumerable: true, + get: function() { + return _TinyMDECommandBar.default; + } + }); + Object.defineProperty(exports, "Editor", { + enumerable: true, + get: function() { + return _TinyMDE.default; + } + }); + var _TinyMDECommandBar = _interopRequireDefault(require_TinyMDECommandBar()); + var _TinyMDE = _interopRequireDefault(require_TinyMDE()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + } + }); + + // node_modules/@icelab/defo/dist/index.bundle.js + var require_index_bundle = __commonJS({ + "node_modules/@icelab/defo/dist/index.bundle.js"(exports, module) { + !function(e, t) { + "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = e || self).Defo = t(); + }(exports, function() { + "use strict"; + function e(e2, t2) { + return function(e3, t3) { + return Object.keys(e3.dataset).filter((e4) => 0 === e4.indexOf(t3)); + }(e2, t2).length > 0; + } + function t(e2) { + return e2.charAt(0).toUpperCase() + e2.slice(1); + } + function r(e2) { + try { + return JSON.parse(e2); + } catch (e3) { + } + return e2; + } + function o({ prefix: e2, scope: t2, views: r2 }) { + Object.keys(r2).forEach((o2) => { + const a2 = `data-${e2}-${s = o2, s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`; + var s; + let i = Array.prototype.slice.call(t2.querySelectorAll(`[${a2}]`)); + t2.hasAttribute(a2) && (i = [t2].concat(i)), i.forEach((t3) => { + n(t3, e2, r2, o2); + }); + }); + } + function n(e2, o2, n2, a2) { + if (e2._defoUpdate && e2._defoUpdate[a2]) + return; + const s = n2[a2], i = function(e3, r2) { + return `${o3 = e3, o3.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, (e4, t2) => t2.toUpperCase()).replace(/\d+(\w|$)/g, (e4) => e4.toUpperCase())}${t(r2)}`; + var o3; + }(o2, a2); + if (!s || !(i in e2.dataset)) + return; + const c = s(e2, r(e2.dataset[i])); + e2._defoUpdate = e2._defoUpdate || {}, e2._defoDestroy = e2._defoDestroy || {}, e2._defoUpdate[a2] = function(e3) { + return function(t2, o3) { + t2 = t2 ? r(t2) : t2, o3 = o3 ? r(o3) : o3, Promise.resolve(e3).then((e4) => { + e4.update && e4.update(t2, o3); + }); + }; + }(c), e2._defoDestroy[a2] = function(e3, t2, r2) { + return function() { + Promise.resolve(e3).then((e4) => { + e4.destroy && (e4.destroy(), delete t2._defoUpdate[r2], delete t2._defoDestroy[r2]); + }); + }; + }(c, e2, a2); + } + function a({ prefix: r2, scope: a2, views: s }) { + const i = new MutationObserver((a3) => { + a3.forEach((a4) => { + const i2 = a4.target; + if ("attributes" === a4.type && function(e2, t2) { + return 0 === e2.indexOf(`data-${t2}-`); + }(a4.attributeName, r2)) { + const e2 = a4.attributeName.split("-").slice(2).map((e3, r3) => r3 > 0 ? t(e3) : e3).join(""); + i2.hasAttribute(a4.attributeName) ? null !== a4.oldValue ? i2._defoUpdate[e2](i2.getAttribute(a4.attributeName), a4.oldValue) : n(i2, r2, s, e2) : i2._defoDestroy[e2](); + } else + "childList" === a4.type && (Array.prototype.slice.call(a4.removedNodes).filter((e2) => e2.nodeType === e2.ELEMENT_NODE).filter((t2) => e(t2, r2)).forEach((e2) => { + Object.keys(e2._defoDestroy).forEach((t2) => { + e2._defoDestroy[t2](); + }); + }), Array.prototype.slice.call(a4.addedNodes).filter((e2) => e2.nodeType === e2.ELEMENT_NODE).forEach((e2) => { + Promise.resolve(e2).then((e3) => { + o({ prefix: r2, scope: e3, views: s }); + }); + })); + }); + }); + return i.observe(a2, { attributes: true, attributeOldValue: true, childList: true, characterData: false, subtree: true }), o({ prefix: r2, scope: a2, views: s }), i; + } + return function({ prefix: e2 = "defo", scope: t2 = document.documentElement, views: r2 = {} } = {}) { + const o2 = a({ prefix: e2, scope: t2, views: r2 }); + return { destroy: () => { + o2.disconnect(); + } }; + }; + }); + } + }); + + // slices/admin/assets/js/app.js + var import_tiny_markdown_editor = __toESM(require_lib(), 1); + var import_defo = __toESM(require_index_bundle(), 1); + (function() { + document.addEventListener("alpine:init", () => { + Alpine.magic("clipboard", () => { + return (subject) => navigator.clipboard.writeText(subject); + }); + }); + document.addEventListener("DOMContentLoaded", function() { + const views = { + markdown: (el, attrs) => { + var tinyMDE = new import_tiny_markdown_editor.default.Editor({ textarea: attrs.editorId }); + return { + update: (newName, oldName) => { + }, + destroy: () => { + } + }; + } + }; + (0, import_defo.default)({ views }); + }); + })(); +})(); diff --git a/slices/admin/assets/js/app.js b/slices/admin/assets/js/app.js index 6309fe9..6cf671c 100644 --- a/slices/admin/assets/js/app.js +++ b/slices/admin/assets/js/app.js @@ -5,6 +5,12 @@ import TinyMDE from "tiny-markdown-editor"; import defo from "@icelab/defo"; (function() { + document.addEventListener('alpine:init', () => { + Alpine.magic('clipboard', () => { + return subject => navigator.clipboard.writeText(subject) + }) + }) + document.addEventListener("DOMContentLoaded", function () { const views = { markdown: (el, attrs) => { diff --git a/slices/admin/templates/photos/index.html.slim b/slices/admin/templates/photos/index.html.slim index 6f48026..1b998ad 100644 --- a/slices/admin/templates/photos/index.html.slim +++ b/slices/admin/templates/photos/index.html.slim @@ -14,6 +14,9 @@ div class="mb-4 max-w-prose mx-auto prose dark:prose-invert" - photos.each_with_index do |photo, idx| - next if photo.match(/small/) div class="rounded max-w-xs" x-data="" id="photo-#{idx}" - img class="rounded object-cover hover:opacity-80 h-48 w-48" src="/#{photo.gsub("public/", "")}" - button class="hover:text-blue-400 p-2 bg-blue-100 rounded text-blue-600 mr-4 no-underline" @click="$clipboard('#{Hanami.app.settings.micropub_site_url}/#{photo.gsub("public/", "")}')" Copy URL - button class="text-red-600 hover:text-red-400" hx-delete="/admin/media/#{photo}" hx-target="#photo-#{idx}" Delete \ No newline at end of file + img class="rounded object-cover hover:opacity-80 h-48 w-48 mb-2" src="/#{photo.gsub("public/", "")}" + div class="grid grid-cols-2 gap-2" + button class="hover:text-blue-400 p-1 bg-blue-100 rounded text-blue-600 no-underline" @click="$clipboard('#{Hanami.app.settings.micropub_site_url}/#{photo.gsub("public/", "")}')" Copy URL + button class="hover:text-blue-400 p-1 bg-blue-100 rounded text-blue-600 no-underline" @click="$clipboard('![](#{Hanami.app.settings.micropub_site_url}/#{photo.gsub("public/", "")})')" Copy .md + div class="grid grid-cols-1" + button class="text-red-600 p-1 bg-red-50 rounded hover:text-red-400 mt-2" hx-delete="/admin/media/#{photo}" hx-target="#photo-#{idx}" Delete \ No newline at end of file