@eutobias/serenojs 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -6
- package/admin-dist/assets/index-CEMJnHOP.js +22 -0
- package/admin-dist/assets/index-Di8sAvwO.css +2 -0
- package/admin-dist/assets/marked.esm-BBttRptN.js +77 -0
- package/admin-dist/assets/purify.es-Bz-uQoIK.js +3 -0
- package/admin-dist/index.html +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/core/backup.server.js +71 -4
- package/dist/core/db.server.js +29 -1
- package/dist/core/schema.js +8 -1
- package/dist/core/types.d.ts +15 -4
- package/dist/core/validation.js +61 -0
- package/dist/ui/admin/collection-manager.js +1 -1
- package/dist/ui/admin/display.js +7 -0
- package/dist/ui/admin/field-control.d.ts +3 -1
- package/dist/ui/admin/field-control.js +10 -2
- package/dist/ui/admin/i18n.js +26 -0
- package/dist/ui/admin/object-list-control.d.ts +15 -0
- package/dist/ui/admin/object-list-control.js +42 -0
- package/dist/ui/admin/rich-text-control.d.ts +15 -0
- package/dist/ui/admin/rich-text-control.js +62 -0
- package/dist/ui/admin/rich-text-icons.d.ts +8 -0
- package/dist/ui/admin/rich-text-icons.js +18 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/markdown-preview.d.ts +10 -0
- package/dist/ui/markdown-preview.js +34 -0
- package/package.json +4 -1
- package/src/admin/styles.css +152 -0
- package/src/config.ts +2 -1
- package/src/core/backup.server.ts +81 -4
- package/src/core/db.server.ts +34 -1
- package/src/core/schema.ts +8 -1
- package/src/core/types.ts +18 -3
- package/src/core/validation.ts +71 -0
- package/src/ui/admin/collection-manager.tsx +1 -0
- package/src/ui/admin/display.tsx +13 -1
- package/src/ui/admin/field-control.tsx +43 -2
- package/src/ui/admin/i18n.tsx +28 -0
- package/src/ui/admin/object-list-control.tsx +154 -0
- package/src/ui/admin/rich-text-control.tsx +173 -0
- package/src/ui/admin/rich-text-icons.tsx +125 -0
- package/src/ui/index.ts +1 -0
- package/src/ui/markdown-preview.tsx +42 -0
- package/admin-dist/assets/index-D2m0Eb4k.css +0 -2
- package/admin-dist/assets/index-Ddgw58Iy.js +0 -9
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial}::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, -apple-system, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, monospace;--color-red-50:#fef2f2;--color-red-100:#ffe2e2;--color-red-200:#ffcaca;--color-red-400:#ff6568;--color-red-500:#fb2c36;--color-red-600:#e40014;--color-red-700:#bf000f;--color-amber-100:#fef3c6;--color-amber-500:#f99c00;--color-amber-700:#b75000;--color-emerald-100:#d0fae5;--color-emerald-200:#a4f4cf;--color-emerald-700:#007956;--color-blue-100:#dbeafe;--color-blue-700:#1447e6;--color-purple-100:#f3e8ff;--color-purple-700:#8200da;--color-gray-50:#f9fafb;--color-gray-100:#f3f4f6;--color-gray-200:#e5e7eb;--color-gray-300:#d1d5dc;--color-gray-400:#99a1af;--color-gray-500:#6a7282;--color-gray-600:#4a5565;--color-gray-700:#364153;--color-gray-800:#1e2939;--color-gray-900:#101828;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-widest:.1em;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}@supports (color:lab(0% 0 0)){:root,:host{--color-red-50:lab(96.5005% 4.18508 1.52328);--color-red-100:lab(92.243% 10.2865 3.83865);--color-red-200:lab(86.017% 19.8815 7.75869);--color-red-400:lab(63.7053% 60.745 31.3109);--color-red-500:lab(55.4814% 75.0732 48.8528);--color-red-600:lab(48.4493% 77.4328 61.5452);--color-red-700:lab(40.4273% 67.2623 53.7441);--color-amber-100:lab(95.916% -1.21653 23.111);--color-amber-500:lab(72.7183% 31.8672 97.9407);--color-amber-700:lab(47.2709% 42.9082 69.2966);--color-emerald-100:lab(94.9004% -17.0769 5.63836);--color-emerald-200:lab(90.2247% -31.039 9.47084);--color-emerald-700:lab(44.4871% -41.0396 11.0361);--color-blue-100:lab(92.0301% -2.24757 -11.6453);--color-blue-700:lab(36.9089% 35.0961 -85.6872);--color-purple-100:lab(93.3333% 6.97437 -9.83434);--color-purple-700:lab(36.1758% 69.8525 -80.0381);--color-gray-50:lab(98.2596% -.247031 -.706708);--color-gray-100:lab(96.1596% -.0823438 -1.13575);--color-gray-200:lab(91.6229% -.159115 -2.26791);--color-gray-300:lab(85.1236% -.612259 -3.7138);--color-gray-400:lab(65.9269% -.832707 -8.17473);--color-gray-500:lab(47.7841% -.393182 -10.0268);--color-gray-600:lab(35.6337% -1.58697 -10.8425);--color-gray-700:lab(27.1134% -.956401 -12.3224);--color-gray-800:lab(16.1051% -1.18239 -11.7533);--color-gray-900:lab(8.11897% .811279 -12.254)}}}@layer base{*,:after,:before{box-sizing:border-box;border:0 solid;margin:0;padding:0}::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}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;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-2{top:calc(var(--spacing) * 2)}.right-0{right:0}.left-0{left:0}.left-2{left:calc(var(--spacing) * 2)}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[60\]{z-index:60}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-flex{display:inline-flex}.aspect-\[4\/3\]{aspect-ratio:4/3}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-32{height:calc(var(--spacing) * 32)}.h-full{height:100%}.h-screen{height:100vh}.max-h-44{max-height:calc(var(--spacing) * 44)}.min-h-\[15rem\]{min-height:15rem}.min-h-screen{min-height:100vh}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-16{width:calc(var(--spacing) * 16)}.w-64{width:calc(var(--spacing) * 64)}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[240px\]{max-width:240px}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-full{--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.resize-y{resize:vertical}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-900{border-color:var(--color-gray-900)}.border-red-200{border-color:var(--color-red-200)}.border-red-400{border-color:var(--color-red-400)}.border-red-600{border-color:var(--color-red-600)}.border-transparent{border-color:#0000}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-gray-900\/40{background-color:#10182866}@supports (color:color-mix(in lab, red, red)){.bg-gray-900\/40{background-color:color-mix(in oklab, var(--color-gray-900) 40%, transparent)}}.bg-purple-100{background-color:var(--color-purple-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-600{background-color:var(--color-red-600)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:0}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-10{padding:calc(var(--spacing) * 10)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-10{padding-block:calc(var(--spacing) * 10)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pb-1{padding-bottom:var(--spacing)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[16px\]{font-size:16px}.text-\[18px\]{font-size:18px}.text-\[20px\]{font-size:20px}.text-\[24px\]{font-size:24px}.text-\[28px\]{font-size:28px}.text-\[30px\]{font-size:30px}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-\[1\.2\]{--tw-leading:1.2;line-height:1.2}.leading-\[1\.3\]{--tw-leading:1.3;line-height:1.3}.leading-\[1\.4\]{--tw-leading:1.4;line-height:1.4}.leading-\[1\.5\]{--tw-leading:1.5;line-height:1.5}.leading-\[1\.6\]{--tw-leading:1.6;line-height:1.6}.leading-none{--tw-leading:1;line-height:1}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[-0\.01em\]{--tw-tracking:-.01em;letter-spacing:-.01em}.tracking-\[-0\.02em\]{--tw-tracking:-.02em;letter-spacing:-.02em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.whitespace-nowrap{white-space:nowrap}.text-amber-500{color:var(--color-amber-500)}.text-amber-700{color:var(--color-amber-700)}.text-blue-700{color:var(--color-blue-700)}.text-emerald-700{color:var(--color-emerald-700)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-purple-700{color:var(--color-purple-700)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-gray-900{accent-color:var(--color-gray-900)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.opacity-100{opacity:1}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-gray-900{--tw-ring-color:var(--color-gray-900)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.group-hover\:text-gray-900:is(:where(.group):hover *){color:var(--color-gray-900)}}.placeholder\:text-gray-400::placeholder{color:var(--color-gray-400)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.focus-within\:border-gray-900:focus-within{border-color:var(--color-gray-900)}.focus-within\:ring-1:focus-within{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-within\:ring-gray-900:focus-within{--tw-ring-color:var(--color-gray-900)}@media (hover:hover){.hover\:border-gray-400:hover{border-color:var(--color-gray-400)}.hover\:border-gray-800:hover{border-color:var(--color-gray-800)}.hover\:border-gray-900:hover{border-color:var(--color-gray-900)}.hover\:border-red-500:hover{border-color:var(--color-red-500)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-500:hover{background-color:var(--color-red-500)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-red-700:hover{color:var(--color-red-700)}}.focus\:border-gray-900:focus{border-color:var(--color-gray-900)}.focus\:border-red-500:focus{border-color:var(--color-red-500)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-gray-900:focus{--tw-ring-color:var(--color-gray-900)}.focus\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-50:disabled{background-color:var(--color-gray-50)}.disabled\:text-gray-500:disabled{color:var(--color-gray-500)}.disabled\:opacity-50:disabled{opacity:.5}@media (min-width:40rem){.sm\:inset-x-auto{inset-inline:auto}.sm\:right-0{right:0}.sm\:w-64{width:calc(var(--spacing) * 64)}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:items-end{align-items:flex-end}.sm\:gap-4{gap:calc(var(--spacing) * 4)}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:p-8{padding:calc(var(--spacing) * 8)}.sm\:text-\[28px\]{font-size:28px}.sm\:text-\[36px\]{font-size:36px}.sm\:text-\[48px\]{font-size:48px}}@media (min-width:48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:64rem){.lg\:static{position:static}.lg\:z-auto{z-index:auto}.lg\:hidden{display:none}.lg\:translate-x-0{--tw-translate-x:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.lg\:flex-row{flex-direction:row}.lg\:p-8{padding:calc(var(--spacing) * 8)}}@media (min-width:80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}}markdown-toolbar{flex-wrap:wrap;gap:2px;display:flex}markdown-toolbar md-bold,markdown-toolbar md-header,markdown-toolbar md-italic,markdown-toolbar md-quote,markdown-toolbar md-link,markdown-toolbar md-unordered-list,markdown-toolbar md-ordered-list,markdown-toolbar md-task-list{color:#4b5563;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:6px;align-items:center;padding:2px;line-height:0;display:inline-flex}markdown-toolbar md-bold svg,markdown-toolbar md-header svg,markdown-toolbar md-italic svg,markdown-toolbar md-quote svg,markdown-toolbar md-link svg,markdown-toolbar md-unordered-list svg,markdown-toolbar md-ordered-list svg,markdown-toolbar md-task-list svg{width:24px;height:24px;display:block}markdown-toolbar md-bold:hover,markdown-toolbar md-header:hover,markdown-toolbar md-italic:hover,markdown-toolbar md-quote:hover,markdown-toolbar md-link:hover,markdown-toolbar md-unordered-list:hover,markdown-toolbar md-ordered-list:hover,markdown-toolbar md-task-list:hover,markdown-toolbar md-bold:focus-visible,markdown-toolbar md-header:focus-visible,markdown-toolbar md-italic:focus-visible,markdown-toolbar md-quote:focus-visible,markdown-toolbar md-link:focus-visible,markdown-toolbar md-unordered-list:focus-visible,markdown-toolbar md-ordered-list:focus-visible,markdown-toolbar md-task-list:focus-visible{color:#111827;background:#e5e7eb}markdown-toolbar md-bold:focus-visible,markdown-toolbar md-header:focus-visible,markdown-toolbar md-italic:focus-visible,markdown-toolbar md-quote:focus-visible,markdown-toolbar md-link:focus-visible,markdown-toolbar md-unordered-list:focus-visible,markdown-toolbar md-ordered-list:focus-visible,markdown-toolbar md-task-list:focus-visible{outline-offset:1px;outline:2px solid #6b7280}.serenojs-markdown{overflow-wrap:anywhere;line-height:1.6}.serenojs-markdown>:first-child{margin-top:0}.serenojs-markdown>:last-child{margin-bottom:0}.serenojs-markdown h1,.serenojs-markdown h2,.serenojs-markdown h3{margin:.9em 0 .35em;font-weight:650;line-height:1.25}.serenojs-markdown h1{font-size:1.35em}.serenojs-markdown h2{font-size:1.2em}.serenojs-markdown h3{font-size:1.05em}.serenojs-markdown p,.serenojs-markdown ul,.serenojs-markdown ol,.serenojs-markdown blockquote,.serenojs-markdown pre{margin:.55em 0}.serenojs-markdown ul,.serenojs-markdown ol{padding-left:1.35em}.serenojs-markdown blockquote{color:#4b5563;border-left:3px solid #d1d5db;padding-left:.9em}.serenojs-markdown code{font-family:var(--font-mono);background:#f3f4f6;border-radius:4px;padding:.1em .3em;font-size:.9em}.serenojs-markdown pre{color:#f9fafb;background:#111827;border-radius:6px;padding:.8em;overflow-x:auto}.serenojs-markdown pre code{color:inherit;background:0 0;padding:0}.serenojs-markdown a{color:#047857;text-decoration:underline}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var t=e();function n(e){t=e}var r={exec:()=>null};function i(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function a(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(c.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var o=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),s=`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)`,c={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,listInterruptsParagraph:/^ {0,3}(?:[*+-]|0{0,8}1[.)])[ \t]+[^ \t\n]/,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^( {1,3})(?:`{3}|~{3})/,beginningSpace:/^[ \t]{1,3}/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,multipleSpaceTabGlobal:/[ \t\r\n]+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,textIndentedContinuation:/^(?:\n(?: {4}| {0,3}\t)[ \t]*[^ \t\n][^\n]*)+/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)(\t[ \t]*)/gm,blockquoteFenceOpen:/^ {0,3}(`{3,}(?=[^`]*$)|~{3,})/,blockquoteFenceClose:/^ {0,3}(`{3,}|~{3,})[ \t]*$/,blockquoteListItemStart:/^ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|$)/,nestedBlockMarker:/^ {0,3}(?:(?:[*+-]|\d{1,9}[.)])(?: |$)|> ?)/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableHeader:RegExp(s+`(?:\\n|$)`),tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:i(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:i(e=>RegExp(`^ {0,${e}}(?:\`{3,}(?=[^\`\\n]*(?:\\n|$))|~~~)`)),headingBeginRegex:i(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:i(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:i(e=>RegExp(`^ {0,${e}}(?:</?(?:${h})(?:[ \\t]+|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:i(e=>RegExp(`^ {0,${e}}>`)),nestedContainerMarkers:/^(?: {0,3}(?:(?:[*+-]|\d{1,9}[.)])[ \t]+|>[ \t]?))+/},l=/^(?:[ \t]*(?:\n|$))+/,u=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,d=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*)[ \t]*(?=\n|$)|$)/,f=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,p=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,m=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,h=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,g=a(` {0,3}(?:</?(?:tag)(?:[ \\t]+|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,h).getRegex(),_=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?![ \t]*\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,v=a(_).replace(/bull/g,m).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}(?=[^`\n]*(?:\n|$))|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/\|table/g,``).replace(/html/g,g).getRegex(),y=a(_).replace(/bull/g,m).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}(?=[^`\n]*(?:\n|$))|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).replace(/html/g,g).getRegex(),b=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ee=/^[^\n]+/,x=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,te=a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<(?:\\.|[^\n<>\\])*>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,x).replace(`title`,/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),ne=a(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,m).getRegex(),S=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,re=a(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*?[ \\t]*/?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,S).replace(`tag`,h).replace(`attribute`,/[ \t]+[a-zA-Z:_][\w.:-]*(?:[ \t]*=[ \t]*"[^"\n]*"|[ \t]*=[ \t]*'[^'\n]*'|[ \t]*=[ \t]*[^\s"'=<>`]+)?/).getRegex(),ie=e=>a(b).replace(`hr`,f).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,g).getRegex(),ae=ie(c.listInterruptsParagraph),oe=ie(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),se=/ {0,3}> ?(?:(?!blank)(paragraph)|[^\n]*)(?:\n|$)/,C={blockquote:a(/^(first)(?:next)*/).replace(`first`,a(se).replace(`blank`,/[ \t]*(?:\n|$)| {4}/).getRegex()).replace(`next`,a(se).replace(`blank`,/[ \t]*(?:\n|$)/).getRegex()).replace(/paragraph/g,oe).getRegex(),code:u,def:te,fences:d,heading:p,hr:f,html:re,lheading:v,list:ne,newline:l,paragraph:ae,table:r,text:ee},ce=a(s+`(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,f).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|0{0,8}1[.)])[ \\t]`).replace(`html`,g).getRegex(),le={...C,lheading:y,table:ce,paragraph:a(b).replace(`hr`,f).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,c.tableHeader).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,c.listInterruptsParagraph).replace(`html`,g).getRegex()},ue={...C,html:a(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace(`comment`,S).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:r,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:a(b).replace(`hr`,f).replace(`heading`,` *#{1,6} *[^
|
|
2
|
+
]`).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).replace(`lheading`,v).getRegex()},de=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,fe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pe=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,me=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,w=/[\p{P}\p{S}]/u,T=/[\s\p{P}\p{S}]/u,E=/[^\s\p{P}\p{S}]/u,he=a(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,T).getRegex(),ge=/[\p{Pi}\p{Ps}"']/u,D=/(?!~)[\p{P}\p{S}]/u,_e=/(?!~)[\s\p{P}\p{S}]/u,ve=/(?:[^\s\p{P}\p{S}]|~)/u,ye=a(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,o?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),O=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,be=a(O,`u`).replace(/punct/g,w).getRegex(),xe=a(O,`u`).replace(/punct/g,D).getRegex(),Se=a(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,ge).replace(/punct/g,w).getRegex(),k=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Ce=a(k,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),we=a(k,`gu`).replace(/notPunctSpace/g,ve).replace(/punctSpace/g,_e).replace(/punct/g,D).getRegex(),Te=a(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),Ee=a(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),De=a(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),Oe=a(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,w).getRegex(),ke=a(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),Ae=a(/\\(punct)/,`gu`).replace(/punct/g,w).getRegex(),je=a(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,w).getRegex(),Me=a(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`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])?)+(?![-_])/).getRegex(),Ne=a(S).replace(`(?:-->|$)`,`-->`).getRegex(),Pe=a(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Ne).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Fe=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,A=a(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Fe).getRegex(),j=/\\[^ \t\n\x00-\x1f]|\\(?=[ \t\n])|[^ \t\n\x00-\x1f\\()]/,Ie=a(/\((?:char)*\)/).replace(`char`,j).getRegex(),Le=a(/\((?:char|p1)*\)/).replace(`char`,j).replace(`p1`,Ie).getRegex(),Re=a(/\((?:char|p2)*\)/).replace(`char`,j).replace(`p2`,Le).getRegex(),ze=a(/(?!<)(?:char|p3)+/).replace(`char`,j).replace(`p3`,Re).getRegex(),Be=a(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,A).replace(`href`,a(/<(?:\\.|[^\n<>\\])*>|bareHref|(?=\))/).replace(`bareHref`,ze).getRegex()).replace(`title`,/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),Ve=a(/^!?\[(label)\]\[(ref)\]/).replace(`label`,A).replace(`ref`,x).getRegex(),He=a(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,x).getRegex(),Ue=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,We=a(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Fe).getRegex(),Ge=a(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,a(/^!?\[(label)\]\[(ref)\]/).replace(`label`,We).replace(`ref`,Ue).getRegex()).replace(`nolink`,a(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ue).getRegex()).getRegex(),Ke=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,qe=a(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),M={_backpedal:r,anyPunctuation:Ae,anyPunctuationOutsideCode:je,autolink:Me,blockSkip:ye,br:pe,code:fe,del:r,delLDelim:r,delRDelim:r,emStrongLDelim:be,emStrongRDelimAst:Ce,emStrongRDelimUnd:Ee,escape:de,link:Be,nolink:He,punctuation:he,reflink:Ve,reflinkSearch:Ge,tag:Pe,text:me,url:r},Je={...M,emStrongLDelim:Se,emStrongRDelimAst:Te,emStrongRDelimUnd:De,link:a(/^!?\[(label)\]\((.*?)\)/).replace(`label`,A).getRegex(),reflink:a(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,A).getRegex()},N={...M,emStrongRDelimAst:we,emStrongLDelim:xe,delLDelim:Oe,delRDelim:ke,url:a(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,qe).replace(`protocol`,Ke).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:a(/^(?:[A-Za-z0-9.+-]+(?=@)|[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,Ke).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace(`wwwStart`,o?`(?<![^\\s*_~(])www\\.`:`www\\.`).getRegex()},Ye={...N,br:a(pe).replace(`{2,}`,`*`).getRegex(),text:a(N.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},P={normal:C,gfm:le,pedantic:ue},F={normal:M,gfm:N,breaks:Ye,pedantic:Je},Xe={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Ze=e=>Xe[e];function I(e,t){if(t){if(c.escapeTest.test(e))return e.replace(c.escapeReplace,Ze)}else if(c.escapeTestNoEncode.test(e))return e.replace(c.escapeReplaceNoEncode,Ze);return e}function Qe(e){return c.numericCharacterReference.test(e)?e.replace(c.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&`:String.fromCodePoint(r)}):e}function $e(e){try{e=encodeURI(e).replace(c.percentDecode,`%`)}catch{return null}return e}function L(e,t){let n=e.replace(c.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(c.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(c.slashPipe,`|`);return n}function R(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function et(e){let t=e.split(`
|
|
3
|
+
`),n=t.length-1;for(;n>=0&&c.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
4
|
+
`)}function z(e,t=!1){let n=t?c.multipleSpaceGlobal:c.multipleSpaceTabGlobal;return e.trim().replace(n,` `).toLowerCase().toUpperCase().toLowerCase()}function tt(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}var B=new WeakMap;function V(e){let t={"*":-1,_:-1},n=-1,r=e.length;for(let i=0;i<r;i++){let a=e[i];if(a!==`*`&&a!==`_`&&a!==`~`)continue;let o=i===0?`
|
|
5
|
+
`:e[i-1],s=i+1;for(;s<r&&e[s]===a;)s++;o!==` `&&o!==` `&&o!==`
|
|
6
|
+
`&&o!==`\r`&&o!==`\f`&&(a===`~`?n=i:t[a]=i),i=s-1}return{maskedSrc:e,lastPossibleEmStrongCloserIndex:t,lastPossibleDelCloserIndex:n}}function nt(e,t){let n=V(t),r=B.get(e);r?r.push(n):B.set(e,[n])}function rt(e){let t=B.get(e);t&&(t.pop(),t.length===0&&B.delete(e))}function it(e,t,n){let r=B.get(e)?.at(-1);return r&&r.maskedSrc===t?r.lastPossibleEmStrongCloserIndex[n]:V(t).lastPossibleEmStrongCloserIndex[n]}function at(e,t){let n=B.get(e)?.at(-1);return n&&n.maskedSrc===t?n.lastPossibleDelCloserIndex:V(t).lastPossibleDelCloserIndex}function H(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function ot(e){let t,n=!1;return e.map(e=>{if(n)return e;let{depth:r,expanded:i,keptIndent:a,content:o}=st(e,t?.depth??1/0);if(t?.depth!==r&&(t=void 0),t){let e=c.blockquoteFenceClose.exec(o)?.[1];return!e||e[0]!==t.marker[0]||e.length<t.marker.length?a:(t=void 0,i)}if(n=c.blockquoteListItemStart.test(o),n)return e;let s=c.blockquoteFenceOpen.exec(o)?.[1];return s&&(t={marker:s,depth:r}),i}).join(`
|
|
7
|
+
`)}function st(e,t){let n=0,r=0,i=0,a=0,o=``;for(;i<t;){let t=n,s=r;for(;e[t]===` `||e[t]===` `;)s+=ct(e[t],s),t++;if(e[t]!==`>`||s-a>3)break;o+=` `.repeat(s-r)+`>`,i++,n=t+1,r=s+1,a=e[n]===` `||e[n]===` `?r+1:r}if(i===0)return{depth:i,expanded:e,keptIndent:e,content:e};let s=``,c=``;for(;(e[n]===` `||e[n]===` `)&&r<a+4;){let t=ct(e[n],r);s+=` `.repeat(t),c+=r<a&&t>1?` `.repeat(t):e[n],r+=t,n++}let l=e.slice(n);return{depth:i,expanded:o+s+l,keptIndent:o+c+l,content:` `.repeat(Math.max(0,r-a))+l}}function ct(e,t){return e===` `?4-t%4:1}function lt(e,t){let n=``;for(let r=0;r<e.length;r++){if(e[r]==="`"){let i=t.inline.code.exec(e.slice(r));if(i){n+=i[0],r+=i[0].length-1;continue}}if(e[r]===`\\`&&(e[r+1]===`[`||e[r+1]===`]`)){n+=e[r+1],r++;continue}n+=e[r]}return n}function ut(e,t,n,r,i){let a=t.href,o=t.title||null,s=lt(e[1],i),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function dt(e,t,n,r){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let a=i[1].length;return t.split(`
|
|
8
|
+
`).map(t=>{let i=t.match(n.other.beginningSpace);if(i===null)return t;let[o]=i,s=o.indexOf(` `);if(s!==-1&&s<a){if(r)return` `.repeat(4-a)+t.slice(s+1);if(e[a]===`~`)return t}return t.slice(Math.min(o.length,a))}).join(`
|
|
9
|
+
`)}function ft(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var U=class{options;rules;lexer;constructor(e){this.options=e||t}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:et(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=dt(e,t[3]||``,this.rules,this.lexer.state.top&&!this.lexer.state.inBlockquote);t[3]!==void 0&&(n===``||n.endsWith(`
|
|
10
|
+
`))&&(n+=`
|
|
11
|
+
`);let r=t[2];if(r){let e=0,t=r.length;for(;e<t&&(r[e]===` `||r[e]===` `);)e++;for(;t>e&&(r[t-1]===` `||r[t-1]===` `);)t--;r=r.slice(e,t).replace(this.rules.inline.anyPunctuation,`$1`)}return{type:`code`,raw:e,lang:r,text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=R(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:R(t[0],`
|
|
12
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:R(t[0],`
|
|
13
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=R(t[0],`
|
|
14
|
+
`).split(`
|
|
15
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
16
|
+
`),c=(this.lexer.state.top&&!this.lexer.state.inBlockquote&&s.includes(` `)?ot(a):s).replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>n.startsWith(` `)?t+` `+n.slice(1):t+H(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`
|
|
17
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
18
|
+
${s}`:s,r=r?`${r}
|
|
19
|
+
${c}`:c;let l=this.lexer.state.top,u=this.lexer.state.inBlockquote,d=this.lexer.state.lastToken;if(this.lexer.state.top=!0,this.lexer.state.inBlockquote=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,this.lexer.state.inBlockquote=u,e.length===0)break;let f=i.at(-1);if(f?.type===`code`||f?.type===`heading`||f?.type===`hr`||f?.type===`html`||f?.type===`table`)break;if(f?.type===`blockquote`){let t=f,a=e.join(`
|
|
20
|
+
`),o=t.raw+`
|
|
21
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``);this.lexer.state.inBlockquote=!0,this.lexer.state.lastToken=i.at(-2);let s=this.blockquote(o);this.lexer.state.inBlockquote=u,this.lexer.state.lastToken=d,i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
22
|
+
`).length:0,p=l?e.slice(0,-l):e;if(p.length>0&&(n=`${n}
|
|
23
|
+
${p.join(`
|
|
24
|
+
`)}`),r=r.substring(0,r.length-t.text.length)+s.text,e=e.slice(p.length),e.length>0&&this.rules.other.blockquoteStart.test(e[0]))continue;break}if(f?.type===`list`){let t=f,a=t.raw+`
|
|
25
|
+
`+e.join(`
|
|
26
|
+
`);this.lexer.state.inBlockquote=!0,this.lexer.state.lastToken=i.at(-2);let o=this.list(a);this.lexer.state.top=l,this.lexer.state.inBlockquote=u,this.lexer.state.lastToken=d,i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`
|
|
27
|
+
`).length:0;if(s>0){let t=e.slice(0,s).join(`
|
|
28
|
+
`);n=`${n}
|
|
29
|
+
${t}`,r=`${r}
|
|
30
|
+
${t}`}if(e=e.slice(s),e.length>0&&!this.rules.other.blockquoteStart.test(e[0]))break;continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){if(!this.options.pedantic&&this.lexer.state.lastToken?.type===`text`&&!this.rules.other.listInterruptsParagraph.test(e))return;let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
|
|
31
|
+
`,1)[0],d=t[1].length,f=this.options.pedantic?H(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>H(e,d)),p=e.split(`
|
|
32
|
+
`,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),f=a,h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h),c=!1;for(;e;){let l=e.split(`
|
|
33
|
+
`,1)[0],u;if(p=l,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),u=p):u=p.replace(this.rules.other.leadingSpaceTab,e=>H(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(u.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
|
|
34
|
+
`+u.slice(h),c=!1;else{if(m)break;let e=f;if(!this.options.pedantic&&!a.includes(`
|
|
35
|
+
`)&&!f.includes(` `)){let t;for(;!n.test(e)&&(t=this.rules.other.nestedBlockMarker.exec(e));)e=e.slice(t[0].length);if(!e.trim())break}if(e.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(e)||i.test(e)||o.test(e)||n.test(e))break;if(!this.options.pedantic&&!c){let e=f.replace(this.rules.other.nestedContainerMarkers,``);if(this.rules.block.fences.test(e)||this.rules.block.heading.test(e)||this.rules.block.hr.test(e))break}let t=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}
|
|
36
|
+
${p}`)?` ${u.replace(/^ {0,3}/,``)}`:p,s=!this.options.pedantic&&!c&&u.startsWith(` `)?this.rules.block.list.exec(f):null;if(s?.[2]){let e=s[1].length,n=s[2].replace(this.rules.other.leadingSpaceTab,t=>H(t,e)),r=n.search(this.rules.other.nonSpaceChar);r>0&&r<=4&&!this.rules.other.nestedBlockMarker.test(n.slice(r))&&u.search(this.rules.other.nonSpaceChar)>=e+r&&this.rules.other.listInterruptsParagraph.test(u.slice(e+r))&&(t=` ${u}`)}a+=`
|
|
37
|
+
`+t,c=!0}m=!p.trim(),e=e.substring(l.length+1),f=u.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();let u=[],d=this.lexer.state.top;for(let e of o.items)if(this.lexer.state.top=!1,u.push(this.lexer.inlineQueue.length),e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}this.lexer.state.top=d;for(let e=0;e<o.items.length;e++){let t=o.items[e],n=t.tokens[0];if(t.task&&(n?.type===`text`||n?.type===`paragraph`)){t.text=t.text.replace(this.rules.other.listReplaceTask,``),n.raw=n.raw.replace(this.rules.other.listReplaceTask,``),n.text=n.text.replace(this.rules.other.listReplaceTask,``);let r=this.lexer.inlineQueue;for(let t=u[e];t<r.length;t++)if(r[t].tokens===n.tokens){r[t].src=r[t].src.replace(this.rules.other.listReplaceTask,``);break}let i=this.rules.other.listTaskCheckbox.exec(t.raw);if(i){let e={type:`checkbox`,raw:i[0]+` `,checked:i[0]!==`[ ]`};t.checked=e.checked,o.loose?t.tokens[0]&&[`paragraph`,`text`].includes(t.tokens[0].type)&&`tokens`in t.tokens[0]&&t.tokens[0].tokens?(t.tokens[0].raw=e.raw+t.tokens[0].raw,t.tokens[0].text=e.raw+t.tokens[0].text,t.tokens[0].tokens.unshift(e)):t.tokens.unshift({type:`paragraph`,raw:e.raw,text:e.raw,tokens:[e]}):t.tokens.unshift(e)}}else t.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){if(this.lexer.state.lastToken?.type===`paragraph`&&!this.rules.other.htmlBeginRegex(4).test(e))return;let n=et(t[0]);return{type:`html`,block:!0,raw:n,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&tt(t[2],`()`)!==-1)return;let e=z(t[1],this.options.pedantic),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:R(t[0],`
|
|
38
|
+
`),href:n,title:r}}}table(e){let t,n;if(this.options.gfm&&!this.options.pedantic){let r=this.rules.other.tableHeader.exec(e);if(!r||!this.rules.other.tableDelimiter.test(r[2])||(t=L(r[1]),n=r[2].replace(this.rules.other.tableAlignChars,``).split(`|`),t.length!==n.length))return}let r=this.rules.block.table.exec(e);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;t??=L(r[1]),n??=r[2].replace(this.rules.other.tableAlignChars,``).split(`|`);let i=r[3]?.trim()?r[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
39
|
+
`):[],a={type:`table`,raw:R(r[0],`
|
|
40
|
+
`),header:[],align:[],rows:[]};if(t.length===n.length){for(let e of n)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<t.length;e++)a.header.push({text:t[e],tokens:this.lexer.inline(t[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(L(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:R(t[0],`
|
|
41
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
42
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t){let n=t[0],r=t[0],i=this.rules.other.textIndentedContinuation.exec(e.slice(n.length));return i&&(n+=i[0],r+=i[0].replace(this.rules.other.codeRemoveIndent,``)),{type:`text`,raw:n,text:r,tokens:this.lexer.inline(r)}}}escape(e){if(e.charCodeAt(0)!==92)return;let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){if(e.charCodeAt(0)!==60)return;let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=e.charCodeAt(0);if(t!==91&&t!==33)return;let n=this.rules.inline.link.exec(e);if(n){let t=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&ft(e,n[1],t,this.rules))return;let r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=R(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=tt(n[2],`()`);if(e===-2)return;if(e>-1){let t=(n[0].indexOf(`!`)===0?5:4)+n[1].length+e;n[2]=n[2].substring(0,e),n[0]=n[0].substring(0,t).trim(),n[3]=``}}let i=R(n[0].slice(0,-1),`\\`);if((n[0].length-i.length)%2==0)return;let a=n[2],o=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(a);e&&(a=e[1],o=e[3])}else o=n[3]?n[3].slice(1,-1):``;return this.options.pedantic&&(a=a.trim()),this.rules.other.startAngleBracket.test(a)&&(a=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a.slice(1):a.slice(1,-1)),ut(n,{href:a&&a.replace(this.rules.inline.anyPunctuation,`$1`),title:o&&o.replace(this.rules.inline.anyPunctuation,`$1`)},n[0],this.lexer,this.rules)}}reflink(e,t){let n=e.charCodeAt(0);if(n!==91&&n!==33)return;let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let n=r[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&ft(e,r[1],n,this.rules))return;let i=t[z(r[2]||r[1],this.options.pedantic)];if(!i){let e=r[0].charAt(0);return{type:`text`,raw:e,text:e}}return ut(r,i,r[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:n===`*`||n===`_`||!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l);if(i!==`*`&&i!==`_`)return;let _=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,v=it(this,t,i),y=t.length-e.length+n;if(v<y)return;t=t.slice(-1*e.length+n);let b=v-y;for(_.lastIndex=0;(r=_.exec(t))!==null&&!(r.index>b);){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;f=[...u].length;let t=f>p-n;if(r[3]||r[4]){p+=f;continue}if((r[5]||r[6]||g&&t)&&h%3&&!((h+f)%3)){if(a&&(r[5]||r[6]))break;m+=f;continue}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let i=[...r[0]][0].length,o=e.slice(0,n+r.index+i+f);if(Math.min(n,f)%2){let e=o.slice(1,-1);return{type:`em`,raw:o,text:e,tokens:this.lexer.inlineTokens(e)}}let s=o.slice(2,-2);return{type:`strong`,raw:o,text:s,tokens:this.lexer.inlineTokens(s)}}}}codespan(e){if(e.charCodeAt(0)!==96)return;let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=e.charCodeAt(0);if(t!==32&&t!==92&&t!==10)return;let n=this.rules.inline.br.exec(e);if(n)return{type:`br`,raw:n[0]}}del(e,t,n=``){if(e.charCodeAt(0)!==126)return;let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim,c=at(this,t),l=t.length-e.length+n;if(c<l)return;t=t.slice(-1*e.length+n);let u=c-l;for(s.lastIndex=0;(r=s.exec(t))!==null&&!(r.index>u);){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){if(e.charCodeAt(0)!==60)return;let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:Qe(t[0]),escaped:e}}}},W=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t,this.options.tokenizer=this.options.tokenizer||new U,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0,inBlockquote:!1};let n={other:c,block:P.normal,inline:F.normal};this.options.pedantic?(n.block=P.pedantic,n.inline=F.pedantic):this.options.gfm&&(n.block=P.gfm,n.inline=this.options.breaks?F.breaks:F.gfm),this.tokenizer.rules=n}static get rules(){return{block:P,inline:F}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){let r=new e(n);return t.includes(`\r`)&&(t=t.replace(c.carriageReturn,`
|
|
43
|
+
`)),r.inlineTokens(t)}lex(e){e=e.replace(c.carriageReturn,`
|
|
44
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this;let r=this.state.lastToken;this.options.pedantic&&(e=e.replace(c.tabCharGlobal,` `).replace(c.spaceLine,``));let i=1/0,a,o=this.options.gfm&&!this.options.pedantic&&this.tokenizer.paragraph===U.prototype.paragraph;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}this.state.lastToken=t.at(-1);let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
45
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
46
|
+
`)?``:`
|
|
47
|
+
`)+r.raw,n.text+=`
|
|
48
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
49
|
+
`)?``:`
|
|
50
|
+
`)+r.raw,n.text+=`
|
|
51
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):(this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title}),t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let s=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(s))){let i=t.at(-1);(n||i===a&&o)&&i?.type===`paragraph`?(i.raw+=(i.raw.endsWith(`
|
|
52
|
+
`)?``:`
|
|
53
|
+
`)+r.raw,i.text+=`
|
|
54
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text,a=i):(t.push(r),a=r),n=s.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
55
|
+
`)?``:`
|
|
56
|
+
`)+r.raw,n.text+=`
|
|
57
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,this.state.lastToken=r,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,z(e.slice(n+1,-1),this.options.pedantic))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e.includes(`*`)||e.includes(`_`)||e.includes(`~`),r=n||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==U.prototype.emStrong||this.tokenizer.del!==U.prototype.del?this.#r(e):e;if(!n)return this.#t(e,r,t);nt(this.tokenizer,r);try{return this.#t(e,r,t)}finally{rt(this.tokenizer)}}#t(e,t,n){let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(t=>(o=t.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let t=n.at(-1);o.type===`text`&&t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o);continue}let s=e[0];if(s===`*`||s===`_`){let a=t.length-e.length;if(it(this.tokenizer,t,s)<=a){let t=1;for(;t<e.length&&e.charCodeAt(t)===s.charCodeAt(0);)t++;let a=e.substring(0,t),o=n.at(-1);o?.type===`text`&&!o.escaped?(o.raw+=a,o.text+=a):n.push({type:`text`,raw:a,text:a,escaped:!1}),e=e.substring(t),i=s,r=!0;continue}}else if(s===`~`){let a=t.length-e.length;if(at(this.tokenizer,t)<=a){let t=1;for(;t<e.length&&e.charCodeAt(t)===126;)t++;let a=e.substring(0,t),o=n.at(-1);o?.type===`text`&&!o.escaped?(o.raw+=a,o.text+=a):n.push({type:`text`,raw:a,text:a,escaped:!1}),e=e.substring(t),i=s,r=!0;continue}}if(o=this.tokenizer.emStrong(e,t,i)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.del(e,t,i)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),n.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),n.push(o);continue}let c=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(c=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(c)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let t=n.at(-1);t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#n(e){let{blockSkip:t,tag:n,autolink:r}=this.tokenizer.rules.inline,i=``,a=0,o;for(t.lastIndex=0;o=t.exec(e);){let s=o.index+(o[2]?o[2].length:0),c=o.index+o[0].length;if(e.charAt(s)===`<`){let i=e.slice(s),a=n.exec(i)||r.exec(i);if(!a){t.lastIndex=s+1;continue}c=s+a[0].length,t.lastIndex=c}i+=e.slice(a,s)+`[`+`a`.repeat(c-s-2)+`]`,a=c}return i+e.slice(a)}#r(e){let t=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,n=t=>{let r=t.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,z(t.slice(r+1,-1),this.options.pedantic)))return t;if(r>1&&t.charAt(0)!==`!`){let i=t.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,n)+`][`+`a`.repeat(t.length-r-2)+`]`}return`[`+`a`.repeat(t.length-2)+`]`};t=t.replace(e,n)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),t=this.#n(t),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}};function G(e,t=!1){let n;for(let r=0;r<e.length;r++){let i=e[r],a=i;if(i.type===`codespan`||i.type===`escape`||t&&i.type===`text`){let e=I(i.text,!0);e!==i.text&&(a={...i,text:e})}else if(i.type===`link`&&i.autolink){let e=I(i.text,!0),t=i.tokens,n=t&&(t.length===1&&t[0].type===`text`&&t[0].text===i.text?e===i.text?t:[{...t[0],text:e}]:G(t,!0));(e!==i.text||n!==t)&&(a=n===t?{...i,text:e}:{...i,text:e,tokens:n})}else if(`tokens`in i&&i.tokens){let e=G(i.tokens,t);e!==i.tokens&&(a={...i,tokens:e})}a===i?n&&n.push(i):(n||=e.slice(0,r),n.push(a))}return n||e}var K=class{options;parser;constructor(e){this.options=e||t}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).trim().match(c.notSpaceStart)?.[0],i=e?e.replace(c.endingNewline,``)+`
|
|
58
|
+
`:``;return r?`<pre><code class="language-`+I(r)+`">`+(n?i:I(i,!0))+`</code></pre>
|
|
59
|
+
`:`<pre><code>`+(n?i:I(i,!0))+`</code></pre>
|
|
60
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
61
|
+
${this.parser.parse(e)}</blockquote>
|
|
62
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
63
|
+
`}hr(e){return`<hr>
|
|
64
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
65
|
+
`+r+`</`+i+`>
|
|
66
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
67
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
68
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
69
|
+
<thead>
|
|
70
|
+
`+t+`</thead>
|
|
71
|
+
`+r+`</table>
|
|
72
|
+
`}tablerow({text:e}){return`<tr>
|
|
73
|
+
${e}</tr>
|
|
74
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
75
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${I(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?I(n,!0):this.parser.parseInline(r),o=$e(e);if(o===null)return a;e=I(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+I(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(G(r),this.parser.textRenderer));let i=$e(e);if(i===null)return I(n);e=i;let a=`<img src="${I(e)}" alt="${I(n)}"`;return t&&(a+=` title="${I(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:I(e.text)}},q=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return`
|
|
76
|
+
`}checkbox({raw:e}){return e}},J=class e{options;renderer;textRenderer;constructor(e){this.options=e||t,this.options.renderer=this.options.renderer||new K,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new q,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n],i=this.options.extensions?.renderers;if(i&&Object.hasOwn(i,r.type)&&i[r.type]){let e=r,n=i[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n===!1?``:n??``;continue}}let a=r;switch(a.type){case`space`:t+=this.renderer.space(a);break;case`hr`:t+=this.renderer.hr(a);break;case`heading`:t+=this.renderer.heading(a);break;case`code`:t+=this.renderer.code(a);break;case`table`:t+=this.renderer.table(a);break;case`blockquote`:t+=this.renderer.blockquote(a);break;case`list`:t+=this.renderer.list(a);break;case`checkbox`:t+=this.renderer.checkbox(a);break;case`html`:t+=this.renderer.html(a);break;case`def`:t+=this.renderer.def(a);break;case`paragraph`:t+=this.renderer.paragraph(a);break;case`text`:t+=this.renderer.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r],a=this.options.extensions?.renderers;if(a&&Object.hasOwn(a,i.type)&&a[i.type]){let e=a[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e===!1?``:e??``;continue}}let o=i;switch(o.type){case`escape`:n+=t.text(o);break;case`html`:n+=t.html(o);break;case`link`:n+=t.link(o);break;case`image`:n+=t.image(o);break;case`checkbox`:n+=t.checkbox(o);break;case`strong`:n+=t.strong(o);break;case`em`:n+=t.em(o);break;case`codespan`:n+=t.codespan(o);break;case`br`:n+=t.br(o);break;case`del`:n+=t.del(o);break;case`text`:n+=t.text(o);break;default:{let e=`Token with "`+o.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Y=class{options;block;constructor(e){this.options=e||t}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?W.lex:W.lexInline}provideParser(e=this.block){return e?J.parse:J.parseInline}};function X(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var pt=class{defaults=e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=J;Renderer=K;TextRenderer=q;Lexer=W;Tokenizer=U;Hooks=Y;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(X(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)X(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)X(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;X(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{if(e[r]){let i=e[r].flat(1/0);X(n,this.walkTokens(i,t))}}):e.tokens&&X(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e&&e.renderer){let n=e.renderer,r=t.renderers[e.name];r?t.renderers[e.name]=function(...e){let t=n.apply(this,e);return t===!1&&(t=r.apply(this,e)),t}:t.renderers[e.name]=n}if(`tokenizer`in e&&e.tokenizer){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new K(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r];if(i===void 0)continue;let a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n===!1?``:n??``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new U(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r];if(i===void 0)continue;let a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Y;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r];if(i===void 0)continue;let a=t[r];t[r]=Y.passThroughHooks.has(n)?e=>{if(t.options.async&&Y.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return X(n,r.call(this,e)),t&&X(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return W.lex(e,t??this.defaults)}parser(e,t){return J.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?W.lex:W.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?J.parse:J.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?W.lex:W.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?J.parse:J.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{let r=n instanceof Error?n:Error(String(n));if(r.message+=`
|
|
77
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+I(r.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}},Z=new pt;function Q(e,t){return Z.parse(e,t)}function mt(e,t){return Z.parseInline(e,t)}Q.options=Q.setOptions=function(e){return Z.setOptions(e),Q.defaults=Z.defaults,n(Q.defaults),Q},Q.getDefaults=e,Q.defaults=t;function $(...e){return Z.use(...e),Q.defaults=Z.defaults,n(Q.defaults),Q}Q.use=$,Q.walkTokens=function(e,t){return Z.walkTokens(e,t)},Q.parseInline=mt,Q.Parser=J,Q.parser=J.parse,Q.Renderer=K,Q.TextRenderer=q,Q.Lexer=W,Q.lexer=W.lex,Q.Tokenizer=U,Q.Hooks=Y,Q.parse=Q;var ht=Q.options,gt=Q.setOptions,_t=Q.walkTokens,vt=Q.parseInline,yt=Q,bt=J.parse,xt=W.lex;export{Y as Hooks,W as Lexer,pt as Marked,J as Parser,K as Renderer,q as TextRenderer,U as Tokenizer,t as defaults,e as getDefaults,xt as lexer,Q as marked,ht as options,yt as parse,vt as parseInline,bt as parser,gt as setOptions,$ as use,_t as walkTokens};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
function e(e,t){this.v=e,this.k=t}function t(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(Array.isArray(e)&&(n==null||n===(typeof Symbol<`u`&&[][Symbol.iterator])||n===[][`@@iterator`]))return e;if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function r(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i(e,t){return n(e,t)||a(e,t)||r()}function a(e,n){if(e){if(typeof e==`string`)return t(e,n);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function o(t){var n,r;function i(n,r){try{var o=t[n](r),s=o.value,c=s instanceof e;Promise.resolve(c?s.v:s).then(function(e){if(c){var r=n===`return`&&s.k?n:`next`;if(!s.k||e.done)return i(r,e);e=t[r](e).value}a(!!o.done,e)},function(e){i(`throw`,e)})}catch(e){a(2,e)}}function a(e,t){e===2?n.reject(t):n.resolve({value:t,done:e}),(n=n.next)?i(n.key,n.arg):r=null}this._invoke=function(e,t){return new Promise(function(a,o){var s={key:e,arg:t,resolve:a,reject:o,next:null};r?r=r.next=s:(n=r=s,i(e,t))})},typeof t.return!=`function`&&(this.return=void 0)}o.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},o.prototype.next=function(e){return this._invoke(`next`,e)},o.prototype.throw=function(e){return this._invoke(`throw`,e)},o.prototype.return=function(e){return this._invoke(`return`,e)};var s=Object.entries,c=Object.keys,l=Object.setPrototypeOf,u=Object.isFrozen,d=Object.getPrototypeOf,f=Object.getOwnPropertyDescriptor,p=Object.freeze,m=Object.seal,h=Object.create,g=typeof Reflect<`u`&&Reflect,ee=g.apply,te=g.construct;p||=function(e){return e},m||=function(e){return e},ee||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},te||=function(e){return new e(...[...arguments].slice(1))};var _=E(Array.prototype.forEach),ne=E(Array.prototype.lastIndexOf),re=E(Array.prototype.pop),ie=E(Array.prototype.push),ae=E(Array.prototype.slice),oe=E(Array.prototype.splice),v=Array.isArray,se=D(Set),ce=E(Set.prototype.add),le=E(Set.prototype.has),ue=E(Set.prototype.delete),de=D(Map),fe=E(Map.prototype.get),pe=E(Map.prototype.set),y=E(String.prototype.toLowerCase),me=E(String.prototype.toString),he=E(String.prototype.match),ge=E(String.prototype.replace),_e=E(String.prototype.indexOf),ve=E(String.prototype.trim),ye=E(Number.prototype.toString),be=E(Boolean.prototype.toString),b=typeof BigInt>`u`?null:E(BigInt.prototype.toString),x=typeof Symbol>`u`?null:E(Symbol.prototype.toString),S=E(Object.prototype.hasOwnProperty),C=E(Object.prototype.toString),xe=RegExp.prototype.test,w=function(e,t){return e instanceof RegExp&&(e.lastIndex=0),ee(xe,e,[t])},T=D(TypeError);function E(e){return function(t){var n=[...arguments].slice(1);return ee(e,t,n)}}function D(e){return function(){return te(e,[...arguments])}}function O(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y;if(l&&l(e,null),!v(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(u(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Se(e){for(let t=0;t<e.length;t++)S(e,t)||(e[t]=null);return e}function Ce(e){let t=h(null);for(let r of s(e)){var n=i(r,2);let a=n[0],o=n[1];S(e,a)&&(t[a]=v(o)?Se(o):o&&typeof o==`object`&&o.constructor===Object?Ce(o):o)}return t}function we(e){let t=h(null),n=c(e),r=n.length;for(;r--;)t[n[r]]=e[n[r]];return t}function Te(e){switch(typeof e){case`string`:return e;case`number`:return ye(e);case`boolean`:return be(e);case`bigint`:return b?b(e):`0`;case`symbol`:return x?x(e):`Symbol()`;case`undefined`:return C(e);case`function`:case`object`:{if(e===null)return C(e);let t=e,n=k(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:C(e)}return C(e)}default:return C(e)}}function k(e,t){for(;e!==null;){let n=f(e,t);if(n){if(n.get)return E(n.get);if(typeof n.value==`function`)return E(n.value)}e=d(e)}function n(){return null}return n}function Ee(e,t){for(;e!==null;){let n=f(e,t);if(n)return n.get?E(n.get):null;e=d(e)}return null}function De(e){if(!e)return!1;try{return w(e,``),!0}catch{return!1}}var Oe=p(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),ke=p(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.filter.font.g.glyph.glyphref.hkern.image.line.lineargradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Ae=p([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),je=p([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Me=p(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Ne=p([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Pe=p([`#text`]),Fe=p(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Ie=p(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Le=p(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Re=p([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ze=m(/{{[\w\W]*|^[\w\W]*}}/g),Be=m(/<%[\w\W]*|^[\w\W]*%>/g),Ve=m(/\${[\w\W]*/g),He=m(/{{|}}|\${|<%|%>/),Ue=m(/[^\t\n\f\r ]/),We=m(/\u0000/g),Ge=m(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ke=m(/^aria-[\-\w]+$/),qe=m(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Je=m(/^(?:\w+script|data):/i),Ye=m(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xe=m(/^html$/i),Ze=m(/^[a-z][.\w]*(-[.\w]+)+$/i),Qe=m(/<[/\w!]/g),$e=m(/<[/\w]/g),et=m(/<[/\w]|^-?>|--!?>|<!-$/g),tt=m(/<\/no(script|embed|frames)/i),nt=m(/\/>/i),rt=m(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),it=m(/^[\r\n\t ]+/),A={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},at=p(O({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),ot=p(O({},[`textarea`,`title`])),st=p(O({},[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`embed`,`frame`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`])),ct=function(){return typeof window>`u`?null:window},lt=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ut=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},j=function(e,t,n,r){return S(e,t)&&v(e[t])?O(r.base?we(r.base):{},e[t],r.transform):n},dt=function(e,t,n){let r=S(e,t)?e[t]:void 0;return r&&typeof r==`object`?Ce(r):n};function ft(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ct(),t=e=>ft(e);if(t.version=`3.5.1`,t.removed=[],!e||!e.document||e.document.nodeType!==A.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript,a=e.HTMLTemplateElement,o=e.Node,c=e.Element,l=e.NodeFilter,u=e.DOMParser,d=e.MutationObserver,f=e.trustedTypes,g=c.prototype,ee=k(g,`remove`),te=k(g,`removeChild`),ye=k(g,`removeAttributeNode`),be=k(g,`nextSibling`),b=k(g,`childNodes`),x=k(g,`parentNode`),C=k(g,`shadowRoot`),xe=k(g,`attributes`),E=o&&o.prototype?k(o.prototype,`nodeType`):null,D=o&&o.prototype?k(o.prototype,`nodeName`):null,Se=o&&o.prototype?k(o.prototype,`ownerDocument`):null,M=function(e){return E?E(e):e.nodeType},N=function(e){return D?D(e):e.nodeName},pt=Ee(g,`namespaceURI`),mt=function(e){return pt?pt(e):e.namespaceURI},ht=function(e){return M(e)===A.element?xe(e):null};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let P,F=``,gt,_t=!1,vt=0,yt=function(){if(vt>0)throw T(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},bt=function(e){yt(),vt++;try{return P.createHTML(e)}finally{vt--}},xt=function(e){return P&&Qt?bt(e):e},St=function(e){yt(),vt++;try{return P.createScriptURL(e)}finally{vt--}},Ct=function(){return _t||=(gt=lt(f,i),!0),gt},wt=n,Tt=wt.implementation,Et=wt.createNodeIterator,Dt=wt.createDocumentFragment,Ot=wt.getElementsByTagName,kt=r.importNode,I=ut();t.isSupported=typeof s==`function`&&typeof x==`function`&&Tt&&Tt.createHTMLDocument!==void 0;let At=ze,jt=Be,Mt=Ve,Nt=Ge,Pt=Ke,Ft=Je,It=Ye,Lt=Ze,Rt=qe,L=null,zt=O({},[...Oe,...ke,...Ae,...Me,...Pe]),R=null,Bt=O({},[...Fe,...Ie,...Le,...Re]),z=null,Vt=null,Ht=null,B=Object.seal(h(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ut=!0,Wt=!0,Gt=!1,Kt=!0,V=!1,H=!0,U=!1,qt=!1,Jt=null,Yt=null,Xt=!1,W=!1,Zt=!1,Qt=!1,$t=!0,en=!1,tn=`user-content-`,nn=!0,rn=!1,G=null,K=null,q=!1,J=null,an=O({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),on=null,sn=O({},[`audio`,`video`,`img`,`source`,`image`,`track`]),cn=null,ln=O({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),un=`http://www.w3.org/1998/Math/MathML`,dn=`http://www.w3.org/2000/svg`,Y=`http://www.w3.org/1999/xhtml`,X=Y,fn=!1,pn=null,mn=O({},[un,dn,Y],me),hn=p(O({},[`mi`,`mo`,`mn`,`ms`,`mtext`])),gn=null,_n=p(O({},[`annotation-xml`])),vn=null,yn=p(h(null)),bn=O({},[`title`,`style`,`font`,`a`,`script`]),xn=null,Sn=[`application/xhtml+xml`,`text/html`],Z=null,Cn=null,wn=null,Tn=n.createElement(`form`),En=function(e){return e instanceof RegExp||e instanceof Function},Dn=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(!e||typeof e!=`object`)&&(e={}),e=Ce(e),xn=Sn.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Z=xn===`application/xhtml+xml`?me:y,L=j(e,`ALLOWED_TAGS`,zt,{transform:Z}),R=j(e,`ALLOWED_ATTR`,Bt,{transform:Z}),pn=j(e,`ALLOWED_NAMESPACES`,mn,{transform:me}),cn=j(e,`ADD_URI_SAFE_ATTR`,ln,{transform:Z,base:ln}),on=j(e,`ADD_DATA_URI_TAGS`,sn,{transform:Z,base:sn}),J=j(e,`FORBID_CONTENTS`,an,{transform:Z}),Vt=j(e,`FORBID_TAGS`,h(null),{transform:Z}),Ht=j(e,`FORBID_ATTR`,h(null),{transform:Z}),q=S(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Ce(e.USE_PROFILES):e.USE_PROFILES:!1,Ut=e.ALLOW_ARIA_ATTR!==!1,Wt=e.ALLOW_DATA_ATTR!==!1,Gt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Kt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=e.SAFE_FOR_TEMPLATES||!1,H=e.SAFE_FOR_XML!==!1,U=e.WHOLE_DOCUMENT||!1,W=e.RETURN_DOM||!1,Zt=e.RETURN_DOM_FRAGMENT||!1,Qt=e.RETURN_TRUSTED_TYPE||!1,Xt=e.FORCE_BODY||!1,$t=e.SANITIZE_DOM!==!1,en=e.SANITIZE_NAMED_PROPS||!1,nn=e.KEEP_CONTENT!==!1,rn=e.IN_PLACE||!1,Rt=De(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:qe,X=typeof e.NAMESPACE==`string`?e.NAMESPACE:Y,gn=dt(e,`MATHML_TEXT_INTEGRATION_POINTS`,hn),vn=dt(e,`HTML_INTEGRATION_POINTS`,_n);let t=dt(e,`CUSTOM_ELEMENT_HANDLING`,yn);if(z=h(null),S(t,`tagNameCheck`)&&En(t.tagNameCheck)&&(z.tagNameCheck=t.tagNameCheck),S(t,`attributeNameCheck`)&&En(t.attributeNameCheck)&&(z.attributeNameCheck=t.attributeNameCheck),S(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(z.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),m(z),V&&(Wt=!1),Zt&&(W=!0),q&&((S(e,`ALLOWED_TAGS`)||S(e,`ALLOWED_ATTR`))&&typeof console<`u`&&typeof console.warn==`function`&&console.warn(`DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together.`),L=O({},Pe),R=h(null),q.html===!0&&(O(L,Oe),O(R,Fe)),q.svg===!0&&(O(L,ke),O(R,Ie),O(R,Re)),q.svgFilters===!0&&(O(L,Ae),O(R,Ie),O(R,Re)),q.mathMl===!0&&(O(L,Me),O(R,Le),O(R,Re))),B.tagCheck=null,B.attributeCheck=null,S(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?B.tagCheck=e.ADD_TAGS:v(e.ADD_TAGS)&&(L===zt&&(L=we(L)),O(L,e.ADD_TAGS,Z))),S(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?B.attributeCheck=e.ADD_ATTR:v(e.ADD_ATTR)&&(R===Bt&&(R=we(R)),O(R,e.ADD_ATTR,Z))),S(e,`ADD_FORBID_CONTENTS`)&&v(e.ADD_FORBID_CONTENTS)&&(J===an&&(J=we(J)),O(J,e.ADD_FORBID_CONTENTS,Z)),nn&&(L[`#text`]=!0),U&&O(L,[`html`,`head`,`body`]),L.table&&(L.tbody=!0,delete Vt.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw T(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw T(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=P;P=e.TRUSTED_TYPES_POLICY;try{F=bt(``)}catch(e){throw P=t,e}}else e.TRUSTED_TYPES_POLICY===null?(P=void 0,F=``):(P===void 0&&(P=Ct()),P&&typeof F==`string`&&(F=bt(``)));Cn=p(e)},On=O({},[...ke,...Ae,...je]),kn=O({},[...Me,...Ne]),An=function(e,t,n){return t===Y?e===`svg`:t===un?e===`svg`&&(n===`annotation-xml`||gn[n]):!!On[e]},jn=function(e,t,n){return t===Y?e===`math`:t===dn?e===`math`&&vn[n]:!!kn[e]},Mn=function(e,t,n){return t===dn&&!vn[n]||t===un&&!gn[n]?!1:!kn[e]&&(bn[e]||!On[e])},Nn=function(e){let t=mt(e),n=y(N(e)),r=x(e),i=X,a=`template`;return r&&M(r)===A.element&&(i=mt(r),a=y(N(r))),pn[t]?t===dn?An(n,i,a):t===un?jn(n,i,a):t===Y?Mn(n,i,a):xn===`application/xhtml+xml`:!1},Q=function(e){ie(t.removed,{element:e}),Yn(e);try{x(e).removeChild(e)}catch{if(ee(e),!x(e))throw T(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Pn=function(e,t,n){try{ye(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Fn=function(e){zn(e);let t=b(e);t&&_(ae(t),t=>{try{te(e,t)}catch{}}),M(e)===A.element&&Ln(e,!1)},In=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}if(ie(t.removed,{attribute:r||null,from:n}),r)Pn(n,r,e);else try{n.removeAttribute(e)}catch{}if(e===`is`){if(W||Zt)try{Q(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},Ln=function(e,t){let n=xe(e);if(n)for(let r=n.length-1;r>=0;--r){let i=n[r],a=i&&i.name;typeof a==`string`&&!(t&&R[Z(a)])&&Pn(e,i,a)}},Rn=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&M(e)===A.element){let t=C(e);sr(t)&&r.push(t)}let i=b(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},zn=function(e){Rn(e,e=>{M(e)===A.element&&Ln(e,!0)})},Bn=function(e){let t=[];return Rn(e,e=>{t.push(e)},!0),t},Vn=function(e){let t=null;return d&&_(e,e=>{M(e)===A.element&&Z(N(e))===`selectedcontent`&&(t||=new d(()=>void 0),t.observe(e,{childList:!0}))}),t},Hn=function(e){_(e.takeRecords(),e=>{_(e.addedNodes,zn),_(e.removedNodes,zn)}),e.disconnect()},Un=function(e,t){let n=se();_(Bn(e),e=>{M(e)===A.element&&ce(n,e)}),_(t,e=>{M(e)===A.element&&!le(n,e)&&Ln(e,!0)})},Wn=function(e,n){let r=!1;return _(t.removed,t=>{t.element&&(r||=t.element===e,zn(t.element))}),Un(e,n),r},Gn=function(e,t){Fn(e),Wn(e,t)},Kn=function(e,t){let n=G,r=null,i=()=>(r||(r=se(),_(t,e=>{ce(r,e)})),r);for(let t=0;;t++){let r=Bn(e),a=[e],o=!1;if(_(r,e=>{M(e)===A.documentFragment?ie(a,e):!o&&!le(n,e)&&(o=le(i(),e))}),!o)return;if(t>=8)throw T(`the tree kept changing during in-place sanitization; refusing to return it`);_(a,(t,n)=>{qn(t,n>0,e,i())})}},qn=function(e,t,n,r){let i=$n(e),a;for(;a=i.nextNode();)le(r,a)&&!le(G,a)&&(t&&$(I.uponSanitizeShadowNode,a,null),Cr(a,n))},Jn=function(e){if(!G)return;ce(G,e);let t=fe(K,e);if(t!==void 0){if(t>=8)throw T(`the tree kept changing during in-place sanitization; refusing to return it`);pe(K,e,t+1)}},Yn=function(e){G&&(ue(G,e),fe(K,e)===void 0&&pe(K,e,0))},Xn=function(e,t){return H?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Zn=function(e){H&&Rn(e,e=>{let t=M(e);if(t===A.processingInstruction||t===A.comment&&w($e,e.data)){try{ee(e)}catch{}return!1}if(t===A.element){let t=e,n=Z(N(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Xn(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Qn=function(e){let t=null,r=null;if(Xt)e=`<remove></remove>`+e;else{let t=he(e,it);r=t&&t[0]}xn===`application/xhtml+xml`&&X===Y&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=P?bt(e):e;if(X===Y)try{t=new u().parseFromString(i,xn)}catch{}if(!t||!t.documentElement){t=Tt.createDocument(X,`template`,null);try{t.documentElement.innerHTML=fn?F:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),X===Y?Ot.call(t,U?`html`:`body`)[0]:U?t.documentElement:a},$n=function(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],n=Se?Se(e):e.ownerDocument;return Et.call(n||e,e,(t?0:l.SHOW_ELEMENT)|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},er=function(e){return e=ge(e,At,` `),e=ge(e,jt,` `),e=ge(e,Mt,` `),e},tr=function(e){ir(e);let t=e.querySelectorAll?.call(e,`template`);t&&_(t,e=>{sr(e.content)&&tr(e.content)})},nr=O({},[`caption`,`colgroup`,`col`,`thead`,`tbody`,`tfoot`,`tr`,`td`,`th`,`style`,`script`,`template`]),rr=function(e){if(xn===`application/xhtml+xml`)return;let t=e.querySelectorAll?.call(e,`table,tbody,thead,tfoot,tr,colgroup`);t&&t.length!==0&&_(t,t=>{_(ae(b(t)),n=>{let r=M(n);if(!(r===A.text?w(Ue,n.data):r===A.element&&!nr[y(N(n))]))return;let i=t;for(;i&&y(N(i))!==`table`;)i=i===e?null:x(i);let a=i&&i!==e?x(i):null;if(a)try{a.insertBefore(n,i)}catch{}})})},ir=function(e){rr(e),e.normalize();let t=$n(e,!0),n=null,r=t.nextNode();for(;r;){let e=r.data;if(w(We,e)&&(e=ge(e,We,``),r.data=e),w(He,e)&&(e=er(e),r.data=e),e&&M(r)===A.text){if(n){let t=n.data;w(He,t[t.length-1]+e[0])&&(n.data=er(t+e[0]))}n=r}r=t.nextNode()}},ar=function(e){let t=D?D(e):null;return typeof t!=`string`||Z(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==xe(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==E(e)||e.childNodes!==b(e)},or=function(e){if(!E||typeof e!=`object`||!e)return null;try{let t=E(e);return typeof t==`number`?t:null}catch{return null}},sr=function(e){return or(e)===A.documentFragment},cr=function(e){return or(e)!==null};function $(e,n,r){e.length!==0&&_(e,e=>{e.call(t,n,r,Cn)})}let lr=function(e,t){let n=!!st[t],r=!!at[t];return!n&&!r&&!ot[t]||mt(e)!==Y?!1:n?e.hasChildNodes():cr(e.firstElementChild)?!0:r&&typeof e.textContent==`string`&&w(Qe,e.textContent)},ur=function(e,t,n,r){return!!(H&&n===A.element&&(t!==`body`||x(e)!==r)&&e.hasChildNodes()&&!cr(e.firstElementChild)&&w(Qe,e.textContent)&&w(Qe,e.innerHTML)||H&&n===A.element&&lr(e,t)||n===A.processingInstruction||H&&n===A.comment&&w(et,e.data))},dr=function(e,t){return e instanceof RegExp?w(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},fr=function(e,t,n){if(!Vt[t]&&vr(t)&&dr(z.tagNameCheck,t))return!1;if(nn&&!J[t]&&!J[y(t)]){let t=x(e),r=b(e);if(r&&t&&e!==n){let n=r.length;for(let i=n-1;i>=0;--i)t.insertBefore(r[i],be(e))}}return Q(e),!0},pr=function(e,t,n,r){return e.length===0?t:t===n||t===r?we(t):t},mr=function(e,t){return e===t||x(e)!==null?!1:(rn&&zn(e),Yn(e),!0)},hr=function(e,n){if(Jn(e),$(I.beforeSanitizeElements,e,null),mr(e,n))return!0;if(ar(e))return Q(e),!0;let r=Z(N(e)),i=M(e);if(L=pr(I.uponSanitizeElement,L,zt,Jt),$(I.uponSanitizeElement,e,{tagName:r,allowedTags:L}),mr(e,n))return!0;if(ur(e,r,i,n))return Q(e),!0;if((Vt[r]||!(B.tagCheck instanceof Function&&B.tagCheck(r))&&!L[r])&&fr(e,r,n))return!0;if(i===A.element&&!Nn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&w(tt,e.innerHTML))return Q(e),!0;if(V&&i===A.text){let n=e.textContent,r=er(n);n!==r&&(ie(t.removed,{element:e.cloneNode()}),e.textContent=r)}return $(I.afterSanitizeElements,e,null),mr(e,n)},gr=function(e,t,r){if(Ht[t]||Xn(t,e)||$t&&(t===`id`||t===`name`)&&(r in n||r in Tn))return!1;let i=R[t]||B.attributeCheck instanceof Function&&B.attributeCheck(t,e);if(Wt&&w(Nt,t)||Ut&&w(Pt,t))return!0;if(!i)return vr(e)&&dr(z.tagNameCheck,e)&&dr(z.attributeNameCheck,t,e)||t===`is`&&z.allowCustomizedBuiltInElements&&dr(z.tagNameCheck,r);if(cn[t])return!0;let a=ge(r,It,``);return w(Rt,a)||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&_e(r,`data:`)===0&&on[e]||Gt&&!w(Ft,a)?!0:!r},_r=O({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),vr=function(e){return!_r[y(e)]&&w(Lt,e)},yr=function(e,t,n,r){if(P&&typeof f==`object`&&typeof f.getAttributeType==`function`&&!n)switch(f.getAttributeType(e,t)){case`TrustedHTML`:return bt(r);case`TrustedScriptURL`:return St(r)}return r},br=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!ar(e)||(Q(e),!1)}catch{return In(t,e),!1}},xr=function(e,t){return H&&w(rt,t)?!0:y(e)===`attributename`&&_e(t,`href`)!==-1},Sr=function(e,n){if($(I.beforeSanitizeAttributes,e,null),mr(e,n))return;let r=ht(e);if(!r||ar(e))return;R=pr(I.uponSanitizeAttribute,R,Bt,Yt);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},a=r.length,o=Z(N(e));for(;a--;){let n=r[a];if(!n)continue;let s=n.name,c=n.namespaceURI,l=n.value,u=Z(s),d=l,f=s===`value`?d:ve(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,$(I.uponSanitizeAttribute,e,i),f=i.attrValue,en&&(u===`id`||u===`name`)&&_e(f,tn)!==0&&(In(s,e,n),f=tn+f,p=!0),xr(s,f)){In(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){In(s,e,n);continue}if(!Kt&&w(nt,f)){In(s,e,n);continue}if(V&&(f=er(f)),!gr(o,u,f)){In(s,e,n);continue}f=yr(o,u,c,f),f!==d&&br(e,s,c,f)&&p&&re(t.removed)}}$(I.afterSanitizeAttributes,e,null),mr(e,n)},Cr=function(e,t){hr(e,t),Sr(e,t),sr(e.content)&&wr(e.content)},wr=function(e){let t=null,n=$n(e);for($(I.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(I.uponSanitizeShadowNode,t,null),Cr(t,e),M(t)===A.element){let e=C(t);sr(e)&&(Tr(e),wr(e))}V&&ir(e),$(I.afterSanitizeShadowDOM,e,null)},Tr=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){wr(e.shadow);continue}let n=e.node,r=M(n)===A.element,i=b(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=D?D(n):null;if(typeof e==`string`&&Z(e)===`template`){let e=n.content;sr(e)&&t.push({node:e,shadow:null})}}if(r){let e=C(n);sr(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}},Er=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(fn=!e,fn&&(e=`<!-->`),typeof e!=`string`&&!cr(e)&&(e=Te(e),typeof e!=`string`))throw T(`dirty is not a string, aborting`);if(!t.isSupported)return e;qt?(L=Jt,R=Yt):Dn(n),wn=Cn,t.removed=[];let c=rn&&typeof e!=`string`&&cr(e),l=[],u=G,d=K;if(c){Zn(e),l=Bn(e);let t=N(e);if(typeof t==`string`){let n=Z(t);if(!L[n]||Vt[n])throw Gn(e,l),T(`root node is forbidden and cannot be sanitized in-place`)}if(ar(e))throw Gn(e,l),T(`root node is clobbered and cannot be sanitized in-place`);G=se(),K=de()}else if(cr(e)){i=Qn(`<!---->`);let t=i.ownerDocument;a=t.importNode(e,!0);let n=a.nodeType===A.element&&mt(a)===Y;n&&t.body&&a.nodeName===`BODY`?(t.documentElement.replaceChild(a,t.body),i=a):n&&a.nodeName===`HTML`?(t.replaceChild(a,t.documentElement),i=a):i.appendChild(a),Tr(i)}else{if(!W&&!V&&!U&&e.indexOf(`<`)===-1)return xt(e);if(i=Qn(e),!i)return W?null:Qt?F:``}i&&Xt&&Q(i.firstChild);let f=c?e:i,p=null;try{c&&(p=Vn(l),Tr(e));let t=$n(f);for(;o=t.nextNode();)Cr(o,f);c&&Kn(e,l)}catch(t){throw c&&Gn(e,l),t}finally{p&&Hn(p),G=u,K=d}if(c){if(Wn(e,l))throw T(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return V&&tr(e),e}if(W){if(V&&tr(i),Zt)for(s=Dt.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(R.shadowroot||R.shadowrootmode)&&(s=kt.call(r,s,!0)),s}V&&ir(i);let m=U?i.outerHTML:i.innerHTML;return U&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&w(Xe,i.ownerDocument.doctype.name)&&(m=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
3
|
+
`+m),xt(m)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=wn,i=L,a=R,o=t.removed;wn=null;try{return Er(e,n)}finally{wn=r,r&&(qt||Dn(r),L=i,R=a,t.removed=o)}},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Dn(e),qt=!0,Jt=L,Yt=R},t.clearConfig=function(){Cn=null,qt=!1,Jt=null,Yt=null,P=gt,F=``},t.isValidAttribute=function(e,t,n){Cn||Dn({});let r=Z(e),i=Z(t);return typeof n==`string`&&(xr(t,n)||!Kt&&w(nt,n))?!1:gr(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&S(I,e)&&ie(I[e],t)},t.removeHook=function(e,t){if(S(I,e)){if(t!==void 0){let n=ne(I[e],t);return n===-1?void 0:oe(I[e],n,1)[0]}return re(I[e])}},t.removeHooks=function(e){S(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=ut()},t}var M=ft();export{M as default};
|
package/admin-dist/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="robots" content="noindex, nofollow" />
|
|
7
7
|
<title>%SERENOJS_TITLE%</title>
|
|
8
|
-
<script type="module" crossorigin src="/_serenojs/admin/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/_serenojs/admin/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/_serenojs/admin/assets/index-CEMJnHOP.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/_serenojs/admin/assets/index-Di8sAvwO.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-gray-50 text-gray-900 antialiased">
|
|
12
12
|
<div id="root"></div>
|
package/dist/config.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* import host code (`@/schemas`) directly — everything is read through
|
|
7
7
|
* `runtime.ts`, configured once by `createCmsMiddleware`.
|
|
8
8
|
*/
|
|
9
|
-
import type { CollectionDef, CollectionIconName, FieldDef, FieldValue, Item, ListResult, MediaItem, RelationOptionsMap } from "./core/types.js";
|
|
10
|
-
export type { CollectionDef, CollectionIconName, FieldDef, FieldValue, Item, ListResult, MediaItem, RelationOptionsMap };
|
|
9
|
+
import type { CollectionDef, CollectionIconName, FieldDef, FieldValue, Item, ListResult, MediaItem, ObjectItem, RelationOptionsMap } from "./core/types.js";
|
|
10
|
+
export type { CollectionDef, CollectionIconName, FieldDef, FieldValue, Item, ListResult, MediaItem, ObjectItem, RelationOptionsMap };
|
|
11
11
|
/** A locale known to the admin UI. */
|
|
12
12
|
export type LocaleDef = {
|
|
13
13
|
code: string;
|
|
@@ -20,6 +20,7 @@ import { gunzipSync, gzipSync } from "node:zlib";
|
|
|
20
20
|
import { getDb } from "./db.server.js";
|
|
21
21
|
import { writeSchemaFiles, } from "./schema-codegen.server.js";
|
|
22
22
|
import { configureCms, getCmsConfig } from "../runtime.js";
|
|
23
|
+
import { isMediaUrl } from "./media.js";
|
|
23
24
|
export const BACKUP_FORMAT = "serenojs-backup";
|
|
24
25
|
export const BACKUP_VERSION = 2;
|
|
25
26
|
export const BACKUP_EXTENSION = ".serenojs";
|
|
@@ -346,9 +347,17 @@ function inferFieldType(sqlType, samples) {
|
|
|
346
347
|
if (Array.isArray(parsed) && parsed.length > 0) {
|
|
347
348
|
if (parsed.every((entry) => Boolean(entry) &&
|
|
348
349
|
typeof entry === "object" &&
|
|
349
|
-
|
|
350
|
+
!Array.isArray(entry) &&
|
|
351
|
+
typeof entry.url === "string" &&
|
|
352
|
+
isMediaUrl(entry.url) &&
|
|
353
|
+
Object.keys(entry).every((key) => ["url", "alt", "primary"].includes(key)))) {
|
|
350
354
|
return "media-list";
|
|
351
355
|
}
|
|
356
|
+
if (parsed.every((entry) => Boolean(entry) &&
|
|
357
|
+
typeof entry === "object" &&
|
|
358
|
+
!Array.isArray(entry))) {
|
|
359
|
+
return "object-list";
|
|
360
|
+
}
|
|
352
361
|
if (parsed.every((entry) => typeof entry === "string")) {
|
|
353
362
|
return "list";
|
|
354
363
|
}
|
|
@@ -361,6 +370,53 @@ function inferFieldType(sqlType, samples) {
|
|
|
361
370
|
}
|
|
362
371
|
return "text";
|
|
363
372
|
}
|
|
373
|
+
/** Approximate type of a value found inside an inferred `object-list`. */
|
|
374
|
+
function inferScalarType(samples) {
|
|
375
|
+
if (samples.length > 0 && samples.every((value) => typeof value === "boolean")) {
|
|
376
|
+
return "boolean";
|
|
377
|
+
}
|
|
378
|
+
if (samples.length > 0 && samples.every((value) => typeof value === "number")) {
|
|
379
|
+
return "number";
|
|
380
|
+
}
|
|
381
|
+
if (samples.length > 0 &&
|
|
382
|
+
samples.every((value) => Array.isArray(value) &&
|
|
383
|
+
value.every((entry) => typeof entry === "string"))) {
|
|
384
|
+
return "list";
|
|
385
|
+
}
|
|
386
|
+
return "text";
|
|
387
|
+
}
|
|
388
|
+
/** Reconstruct the subfields of an inferred `object-list` from raw samples. */
|
|
389
|
+
function inferObjectFields(samples) {
|
|
390
|
+
const values = new Map();
|
|
391
|
+
for (const sample of samples) {
|
|
392
|
+
if (typeof sample !== "string")
|
|
393
|
+
continue;
|
|
394
|
+
try {
|
|
395
|
+
const parsed = JSON.parse(sample);
|
|
396
|
+
if (!Array.isArray(parsed))
|
|
397
|
+
continue;
|
|
398
|
+
for (const entry of parsed) {
|
|
399
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
400
|
+
continue;
|
|
401
|
+
for (const [key, value] of Object.entries(entry)) {
|
|
402
|
+
const list = values.get(key) ?? [];
|
|
403
|
+
if (value !== null && value !== undefined)
|
|
404
|
+
list.push(value);
|
|
405
|
+
values.set(key, list);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
catch {
|
|
410
|
+
// Not JSON; ignore this sample.
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return [...values.entries()].map(([name, entries]) => ({
|
|
414
|
+
name,
|
|
415
|
+
label: humanize(name),
|
|
416
|
+
type: inferScalarType(entries),
|
|
417
|
+
localized: false,
|
|
418
|
+
}));
|
|
419
|
+
}
|
|
364
420
|
/**
|
|
365
421
|
* Reconstruct descriptors from the backup database for archives created before
|
|
366
422
|
* schemas were embedded. Types are inferred from SQLite columns and samples.
|
|
@@ -414,12 +470,23 @@ function inferSchemas(db, schema, fallback) {
|
|
|
414
470
|
const fields = [];
|
|
415
471
|
const usedLocales = new Set();
|
|
416
472
|
for (const group of groups.values()) {
|
|
417
|
-
|
|
473
|
+
const type = inferFieldType(group.sqlType, group.samples.slice(0, 50));
|
|
474
|
+
const field = {
|
|
418
475
|
name: group.base,
|
|
419
476
|
label: humanize(group.base),
|
|
420
|
-
type
|
|
477
|
+
type,
|
|
421
478
|
localized: group.localized,
|
|
422
|
-
}
|
|
479
|
+
};
|
|
480
|
+
if (type === "object-list") {
|
|
481
|
+
const inferred = inferObjectFields(group.samples.slice(0, 50));
|
|
482
|
+
if (inferred.length > 0) {
|
|
483
|
+
field.fields = inferred;
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
field.type = "text";
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
fields.push(field);
|
|
423
490
|
for (const code of group.locales)
|
|
424
491
|
usedLocales.add(code);
|
|
425
492
|
}
|
package/dist/core/db.server.js
CHANGED
|
@@ -207,6 +207,12 @@ function serialize(field, value) {
|
|
|
207
207
|
.filter(Boolean);
|
|
208
208
|
return entries.length > 0 ? JSON.stringify(entries) : null;
|
|
209
209
|
}
|
|
210
|
+
case "object-list": {
|
|
211
|
+
const items = Array.isArray(value)
|
|
212
|
+
? value.filter((entry) => Boolean(entry) && typeof entry === "object" && !Array.isArray(entry))
|
|
213
|
+
: [];
|
|
214
|
+
return items.length > 0 ? JSON.stringify(items) : null;
|
|
215
|
+
}
|
|
210
216
|
default:
|
|
211
217
|
return String(value);
|
|
212
218
|
}
|
|
@@ -251,6 +257,19 @@ function parseStringList(raw) {
|
|
|
251
257
|
return [];
|
|
252
258
|
}
|
|
253
259
|
}
|
|
260
|
+
function parseObjectList(raw) {
|
|
261
|
+
if (typeof raw !== "string" || !raw.trim())
|
|
262
|
+
return [];
|
|
263
|
+
try {
|
|
264
|
+
const parsed = JSON.parse(raw);
|
|
265
|
+
if (!Array.isArray(parsed))
|
|
266
|
+
return [];
|
|
267
|
+
return parsed.filter((entry) => Boolean(entry) && typeof entry === "object" && !Array.isArray(entry));
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
return [];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
254
273
|
/** Decode a single raw column value into a field value. */
|
|
255
274
|
function decodeFieldValue(field, raw) {
|
|
256
275
|
switch (field.type) {
|
|
@@ -268,6 +287,8 @@ function decodeFieldValue(field, raw) {
|
|
|
268
287
|
return parseMediaList(raw);
|
|
269
288
|
case "list":
|
|
270
289
|
return parseStringList(raw);
|
|
290
|
+
case "object-list":
|
|
291
|
+
return parseObjectList(raw);
|
|
271
292
|
default:
|
|
272
293
|
return raw === null || raw === undefined ? "" : String(raw);
|
|
273
294
|
}
|
|
@@ -324,7 +345,14 @@ export function listItems(collection, { page = 1, limit = 10, q = "", } = {}) {
|
|
|
324
345
|
let where = "";
|
|
325
346
|
const search = q.trim();
|
|
326
347
|
if (search) {
|
|
327
|
-
const searchColumns = storedColumns(collection).filter((entry) => [
|
|
348
|
+
const searchColumns = storedColumns(collection).filter((entry) => [
|
|
349
|
+
"text",
|
|
350
|
+
"email",
|
|
351
|
+
"textarea",
|
|
352
|
+
"richtext",
|
|
353
|
+
"select",
|
|
354
|
+
"date",
|
|
355
|
+
].includes(entry.field.type));
|
|
328
356
|
if (searchColumns.length > 0) {
|
|
329
357
|
where =
|
|
330
358
|
" WHERE " +
|
package/dist/core/schema.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { getDefaultLocale } from "../locale.js";
|
|
2
2
|
import { getCmsConfig, getCollection as runtimeGetCollection, getCollections as runtimeGetCollections, localeLabel as runtimeLocaleLabel, } from "../runtime.js";
|
|
3
3
|
/** Field types that are localized by default. */
|
|
4
|
-
const LOCALIZED_TYPES = new Set([
|
|
4
|
+
const LOCALIZED_TYPES = new Set([
|
|
5
|
+
"text",
|
|
6
|
+
"textarea",
|
|
7
|
+
"richtext",
|
|
8
|
+
"email",
|
|
9
|
+
"list",
|
|
10
|
+
]);
|
|
5
11
|
/** Locales stored by a collection (falls back to the global default). */
|
|
6
12
|
export function collectionLocales(collection) {
|
|
7
13
|
return collection.locales && collection.locales.length > 0
|
|
@@ -67,6 +73,7 @@ export function fieldDefault(field) {
|
|
|
67
73
|
case "media-list":
|
|
68
74
|
return [];
|
|
69
75
|
case "list":
|
|
76
|
+
case "object-list":
|
|
70
77
|
return [];
|
|
71
78
|
case "select":
|
|
72
79
|
return field.options?.[0]?.value ?? "";
|
package/dist/core/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type CollectionIconName = "archive" | "box" | "fileText" | "folder" | "gr
|
|
|
6
6
|
* The whole admin panel is generated from the collection descriptors in
|
|
7
7
|
* `src/schemas`. These types describe those descriptors.
|
|
8
8
|
*/
|
|
9
|
-
export type FieldType = "text" | "email" | "textarea" | "number" | "boolean" | "select" | "date" | "relation" | "media" | "media-list" | "list";
|
|
9
|
+
export type FieldType = "text" | "email" | "textarea" | "richtext" | "number" | "boolean" | "select" | "date" | "relation" | "media" | "media-list" | "list" | "object-list";
|
|
10
10
|
export type SelectOption = {
|
|
11
11
|
label: string;
|
|
12
12
|
value: string;
|
|
@@ -40,11 +40,18 @@ export type FieldDef = {
|
|
|
40
40
|
accept?: string[];
|
|
41
41
|
/** Only for `media` fields. Maximum upload size in bytes. */
|
|
42
42
|
maxSize?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Only for `object-list` fields. Subfields of each stored object. Supported
|
|
45
|
+
* types: `text`, `email`, `textarea`, `number`, `boolean`, `select`,
|
|
46
|
+
* `date` and `list`. Subfields are never localized individually.
|
|
47
|
+
*/
|
|
48
|
+
fields?: FieldDef[];
|
|
43
49
|
/**
|
|
44
50
|
* Whether the field is stored per locale (`name_pt`, `name_en`). When
|
|
45
51
|
* omitted it defaults to `true` for editorial types (`text`, `textarea`,
|
|
46
|
-
* `email`, `list`) and `false` for structural ones. Set
|
|
47
|
-
* a text field (e.g. `slug`, `icon`) to stay
|
|
52
|
+
* `richtext`, `email`, `list`) and `false` for structural ones. Set
|
|
53
|
+
* explicitly to force a text field (e.g. `slug`, `icon`) to stay
|
|
54
|
+
* language-independent.
|
|
48
55
|
*/
|
|
49
56
|
localized?: boolean;
|
|
50
57
|
defaultValue?: string | number | boolean;
|
|
@@ -110,12 +117,16 @@ export type MediaItem = {
|
|
|
110
117
|
/** At most one item per list is the principal (cover/highlight). */
|
|
111
118
|
primary?: boolean;
|
|
112
119
|
};
|
|
120
|
+
/** A single entry of an `object-list` field, keyed by subfield name. */
|
|
121
|
+
export type ObjectItem = {
|
|
122
|
+
[field: string]: FieldValue;
|
|
123
|
+
};
|
|
113
124
|
/** An ordered list of translated values, keyed by locale code. */
|
|
114
125
|
export type LocalizedValue = {
|
|
115
126
|
[locale: string]: FieldValue;
|
|
116
127
|
};
|
|
117
128
|
/** Primitive value a field can hold. Relation values are numeric ids. */
|
|
118
|
-
export type FieldValue = string | number | boolean | null | number[] | string[] | MediaItem[] | LocalizedValue;
|
|
129
|
+
export type FieldValue = string | number | boolean | null | number[] | string[] | MediaItem[] | ObjectItem[] | LocalizedValue;
|
|
119
130
|
/** An option shown by a relation control and used to render labels. */
|
|
120
131
|
export type RelationOption = {
|
|
121
132
|
id: number;
|