@jungherz-de/notionkit-elements 1.8.0 โ 1.9.0
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 +12 -12
- package/dist/components/nk-calendar-view.js +138 -0
- package/dist/components/nk-calendar.js +356 -0
- package/dist/components/nk-menu.js +2 -14
- package/dist/components/nk-table-view.js +9 -3
- package/dist/components/shared/dates-a32DcW1l.js +67 -0
- package/dist/components/shared/floating-B8CwbXnV.js +22 -0
- package/dist/notionkit-elements.esm.js +582 -20
- package/dist/notionkit-elements.js +583 -19
- package/dist/notionkit-elements.min.js +1 -1
- package/package.json +3 -3
- package/src/components/data/nk-calendar-view.js +136 -0
- package/src/components/data/nk-table-view.js +9 -3
- package/src/components/forms/nk-calendar.js +354 -0
- package/src/components/overlays/nk-menu.js +2 -14
- package/src/index.js +2 -0
- package/src/util/dates.js +65 -0
- package/src/util/floating.js +20 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
var NotionKitElements=function(t){"use strict";const e=':root{color-scheme:light;--nk-bg: #ffffff;--nk-bg-sidebar: #f9f8f7;--nk-bg-hover: rgba(55,53,47,.06);--nk-bg-active: rgba(55,53,47,.08);--nk-bg-callout: #f0efed;--nk-bg-code: #f7f6f3;--nk-bg-card: #ffffff;--nk-bg-input: rgba(242,241,238,.6);--nk-text: #2c2c2b;--nk-text-secondary: #7d7a75;--nk-text-tertiary: #91918e;--nk-text-sidebar: #5f5e5b;--nk-border: rgba(28,19,1,.11);--nk-border-strong: rgba(27,21,0,.19);--nk-accent: #2383e2;--nk-on-accent: #ffffff;--nk-danger: #cd3c3a;--nk-tag-gray-bg: #e3e2e0;--nk-tag-gray-text: #32302c;--nk-tag-brown-bg: #eee0da;--nk-tag-brown-text: #442a1e;--nk-tag-orange-bg: #fadec9;--nk-tag-orange-text: #49290e;--nk-tag-yellow-bg: #fdecc8;--nk-tag-yellow-text: #402c1b;--nk-tag-green-bg: #dbeddb;--nk-tag-green-text: #1c3829;--nk-tag-blue-bg: #d3e5ef;--nk-tag-blue-text: #183347;--nk-tag-purple-bg: #e8deee;--nk-tag-purple-text: #412454;--nk-tag-pink-bg: #f5e0e9;--nk-tag-pink-text: #4c2337;--nk-tag-red-bg: #ffe2dd;--nk-tag-red-text: #5d1715;--nk-tint-gray: #f1f1ef;--nk-color-gray: #787774;--nk-tint-brown: #f4eeee;--nk-color-brown: #9f6b53;--nk-tint-orange: #fbecdd;--nk-color-orange: #d9730d;--nk-tint-yellow: #fbf3db;--nk-color-yellow: #cb912f;--nk-tint-green: #edf3ec;--nk-color-green: #448361;--nk-tint-blue: #e7f3f8;--nk-color-blue: #337ea9;--nk-tint-purple: #f8f3fc;--nk-color-purple: #9065b0;--nk-tint-pink: #fcf1f6;--nk-color-pink: #c14c8a;--nk-tint-red: #fdebec;--nk-color-red: #cd3c3a;--nk-decor-purple: #9065b0;--nk-decor-blue: #529cca;--nk-decor-orange: #d9730d;--nk-scrim: rgba(15,15,15,.6);--nk-scrim-soft: rgba(15,15,15,.5);--nk-sidebar-width: 260px;--nk-tab-bar-height: 58px;--nk-radius: 6px;--nk-font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Helvetica, Arial, sans-serif;--nk-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--nk-shadow-menu: rgba(15,15,15,.05) 0px 0px 0px 1px, rgba(15,15,15,.1) 0px 3px 6px, rgba(15,15,15,.2) 0px 9px 24px;--nk-shadow-card: 0 1px 2px rgba(0,0,0,.04);--nk-shadow-btn: inset 0 0 0 1px rgba(15,15,15,.1), 0 1px 2px rgba(15,15,15,.1);--nk-shadow-knob: 0 1px 2px rgba(0,0,0,.2);--nk-shadow-segment: 0 1px 2px rgba(0,0,0,.08)}[data-theme=dark]{color-scheme:dark;--nk-bg: #191919;--nk-bg-sidebar: #202020;--nk-bg-hover: rgba(255,255,255,.055);--nk-bg-active: rgba(255,255,255,.08);--nk-bg-callout: #252525;--nk-bg-code: #202020;--nk-bg-card: #202020;--nk-bg-input: rgba(255,255,255,.055);--nk-text: rgba(255,255,255,.81);--nk-text-secondary: rgba(255,255,255,.46);--nk-text-tertiary: rgba(255,255,255,.32);--nk-text-sidebar: rgba(255,255,255,.62);--nk-border: rgba(255,255,255,.094);--nk-border-strong: rgba(255,255,255,.16);--nk-accent: #529CCA;--nk-danger: #df5452;--nk-tag-gray-bg: #373737;--nk-tag-gray-text: rgba(255,255,255,.85);--nk-tag-brown-bg: #603b2c;--nk-tag-brown-text: rgba(255,255,255,.85);--nk-tag-orange-bg: #854c1d;--nk-tag-orange-text: rgba(255,255,255,.85);--nk-tag-yellow-bg: #89632a;--nk-tag-yellow-text: rgba(255,255,255,.85);--nk-tag-green-bg: #2b593f;--nk-tag-green-text: rgba(255,255,255,.85);--nk-tag-blue-bg: #28456c;--nk-tag-blue-text: rgba(255,255,255,.85);--nk-tag-purple-bg: #492f64;--nk-tag-purple-text: rgba(255,255,255,.85);--nk-tag-pink-bg: #69314c;--nk-tag-pink-text: rgba(255,255,255,.85);--nk-tag-red-bg: #6e3630;--nk-tag-red-text: rgba(255,255,255,.85);--nk-tint-gray: #252525;--nk-color-gray: #9b9b9b;--nk-tint-brown: #2e2724;--nk-color-brown: #ba856f;--nk-tint-orange: #36291f;--nk-color-orange: #c77d48;--nk-tint-yellow: #372e20;--nk-color-yellow: #ca8f3d;--nk-tint-green: #242b26;--nk-color-green: #529e72;--nk-tint-blue: #1f282d;--nk-color-blue: #5e87c9;--nk-tint-purple: #2a2430;--nk-color-purple: #9d68d3;--nk-tint-pink: #2e2328;--nk-color-pink: #d15796;--nk-tint-red: #332523;--nk-color-red: #df5452;--nk-shadow-menu: rgba(15,15,15,.2) 0px 0px 0px 1px, rgba(15,15,15,.4) 0px 3px 6px, rgba(15,15,15,.6) 0px 9px 24px;--nk-shadow-card: none;--nk-shadow-btn: inset 0 0 0 1px rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.3)}',n='[class*=nk-],[class*=nk-] *,[class*=nk-]:before,[class*=nk-]:after,[class*=nk-] *:before,[class*=nk-] *:after{box-sizing:border-box}[class*=nk-] :where(h1,h2,h3,h4,h5,h6,p,figure,blockquote,dl,dd,pre,ul,ol,li){margin:0;padding:0}[class*=nk-] :where(ul,ol){list-style:none}[class*=nk-] :where(button,input,select,textarea,option,optgroup,fieldset,legend),:where(button,input,select,textarea)[class*=nk-]{margin:0;padding:0}[class*=nk-][hidden]:not([hidden=until-found i]){display:none!important}::slotted([hidden]:not([hidden="until-found" i])){display:none!important}',i='.nk-body{margin:0;min-height:100vh;min-height:100dvh;font-family:var(--nk-font);font-size:14px;background:var(--nk-bg);color:var(--nk-text);-webkit-font-smoothing:auto;transition:background .25s ease,color .25s ease}.nk-app{display:flex;height:100vh;height:100dvh;overflow:hidden}.nk-sidebar{width:calc(var(--nk-sidebar-width) + env(safe-area-inset-left,0px));min-width:calc(var(--nk-sidebar-width) + env(safe-area-inset-left,0px));padding-left:env(safe-area-inset-left,0px);background:var(--nk-bg-sidebar);display:flex;flex-direction:column;border-right:1px solid var(--nk-border);transition:background .25s ease}.nk-workspace{display:flex;align-items:center;gap:8px;padding:10px 12px;margin:6px 8px 2px;border-radius:var(--nk-radius);cursor:pointer;font-weight:500;user-select:none}.nk-workspace:hover{background:var(--nk-bg-hover)}.nk-workspace .avatar,.nk-workspace ::slotted(.avatar),.nk-workspace ::slotted([slot="avatar"]){width:22px;height:22px;border-radius:4px;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:11px;font-weight:600;display:flex;align-items:center;justify-content:center}.nk-workspace .chev{margin-left:auto;color:var(--nk-text-tertiary);font-size:11px}.nk-sidebar-scroll{flex:1;overflow-y:auto;padding:4px 8px 16px}.nk-sidebar-scroll::-webkit-scrollbar{width:8px}.nk-sidebar-scroll::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:4px}.nk-section-label{font-size:12px;font-weight:500;letter-spacing:.01em;color:var(--nk-text-tertiary);padding:14px 10px 4px;display:flex;justify-content:space-between;align-items:center}.nk-section-label .plus{cursor:pointer;border-radius:4px;padding:0 4px;font-size:13px;opacity:0;transition:opacity .15s}.nk-section-label:hover .plus{opacity:1}.nk-section-label .plus:hover{background:var(--nk-bg-hover)}.nk-sidebar-footer{padding:8px;border-top:1px solid var(--nk-border);color:var(--nk-text-sidebar);font-size:14px}.nk-sidebar-footer .nk-tree-item{min-height:26px}.nk-sidebar-backdrop{display:none;position:fixed;inset:0;z-index:59;background:var(--nk-scrim-soft)}.nk-sidebar-toggle{display:none}.nk-main{flex:1;display:flex;flex-direction:column;min-width:0}.nk-topbar{height:44px;display:flex;align-items:center;padding:0 max(12px,env(safe-area-inset-right,0px)) 0 max(12px,env(safe-area-inset-left,0px));gap:8px;flex-shrink:0}.nk-breadcrumb{display:flex;align-items:center;gap:4px;font-size:14px}.nk-breadcrumb .crumb,.nk-breadcrumb ::slotted(.crumb){padding:2px 6px;border-radius:4px;cursor:pointer;color:var(--nk-text-sidebar);display:flex;align-items:center;gap:5px}.nk-breadcrumb .crumb:hover{background:var(--nk-bg-hover)}a.crumb{text-decoration:none}.nk-breadcrumb .crumb.current,.nk-breadcrumb ::slotted(.crumb.current){color:var(--nk-text)}.nk-breadcrumb .sep{color:var(--nk-text-tertiary);font-size:12px}.nk-topbar-actions{margin-left:auto;display:flex;align-items:center;gap:4px}.nk-topbar-btn{padding:4px 8px;border-radius:var(--nk-radius);cursor:pointer;color:var(--nk-text-sidebar);font-size:14px;user-select:none;border:none;background:transparent;font-family:inherit}.nk-topbar-btn:hover{background:var(--nk-bg-hover)}.nk-topbar-btn svg,.nk-topbar-btn ::slotted(svg){width:16px;height:16px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-share-btn{font-size:14px;padding:4px 8px}.nk-topbar-meta,.nk-topbar-actions ::slotted(.nk-topbar-meta){padding:4px 8px;font-size:12px;color:var(--nk-text-tertiary);white-space:nowrap}.nk-theme-toggle{font-size:15px;width:30px;height:28px;padding:0}.nk-tab-bar{display:none;flex:none;align-items:stretch;gap:2px;position:sticky;bottom:0;z-index:30;box-sizing:border-box;height:calc(var(--nk-tab-bar-height) - 6px + max(6px,env(safe-area-inset-bottom,0px)));padding:6px max(4px,env(safe-area-inset-right,0px)) max(6px,env(safe-area-inset-bottom,0px)) max(4px,env(safe-area-inset-left,0px));background:var(--nk-bg-sidebar);border-top:1px solid var(--nk-border)}.nk-tab-bar.always{display:flex}.nk-tab-bar.fixed{position:fixed;left:0;right:0;bottom:0}.nk-tab-bar-spacer{display:none;flex:none;height:calc(var(--nk-tab-bar-height) - 6px + max(6px,env(safe-area-inset-bottom,0px)))}.nk-tab-bar.always.fixed+.nk-tab-bar-spacer{display:block}.nk-tab-bar.floating{position:fixed;left:max(12px,env(safe-area-inset-left,0px));right:max(12px,env(safe-area-inset-right,0px));bottom:calc(12px + env(safe-area-inset-bottom,0px));height:var(--nk-tab-bar-height);padding:6px;border:1px solid var(--nk-border);border-radius:16px;box-shadow:var(--nk-shadow-menu)}.nk-tab-bar-item{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:4px 2px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:10.5px;line-height:1.2;color:var(--nk-text-secondary);text-decoration:none;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}.nk-tab-bar-item:hover{color:var(--nk-text);background:var(--nk-bg-hover)}.nk-tab-bar-item.active{color:var(--nk-accent)}.nk-tab-bar-item:disabled{opacity:.5;cursor:not-allowed}.nk-tab-bar-item .icon,.nk-tab-bar-item ::slotted([slot="icon"]){font-size:20px;line-height:1}.nk-tab-bar-item .label,.nk-tab-bar-item ::slotted(.label){max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-tree-item{display:flex;align-items:center;gap:6px;padding:3px 8px 3px 10px;border-radius:var(--nk-radius);cursor:pointer;user-select:none;color:var(--nk-text-sidebar);position:relative;min-height:var(--_nk-row, 28px)}.nk-tree-item:hover{background:var(--nk-bg-hover)}.nk-tree-item.active{background:var(--nk-bg-active);color:var(--nk-text);font-weight:500}.nk-tree-item.compact{min-height:26px}.nk-tree-item .icon,.nk-tree-item ::slotted(.icon),.nk-tree-item ::slotted([slot="icon"]){font-size:15px;width:20px;text-align:center;flex-shrink:0}.nk-tree-item .label,.nk-tree-item ::slotted(.label){white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-tree-item .actions{margin-left:auto;display:none;gap:2px;color:var(--nk-text-tertiary)}.nk-tree-item:hover .actions{display:flex}.nk-tree-item .actions span{padding:0 3px;border-radius:3px;font-size:12px}.nk-tree-item .actions span:hover{background:var(--nk-bg-active)}.nk-tree-children{margin-left:14px;border-left:1px solid var(--nk-border);padding-left:4px;overflow:hidden}.nk-tree-children.collapsed{display:none}.nk-toggle-arrow{width:16px;height:16px;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-size:9px;color:var(--nk-text-tertiary);border-radius:3px;transition:transform .15s}.nk-toggle-arrow.open{transform:rotate(90deg)}.nk-kbd-hint{margin-left:auto;display:flex;gap:3px;align-items:center}.nk-kbd{font-family:inherit;font-size:10.5px;background:var(--nk-bg-callout);border:1px solid var(--nk-border-strong);border-bottom-width:2px;border-radius:4px;padding:0 4px}.nk-page-scroll{flex:1;overflow-y:auto}.nk-page-scroll::-webkit-scrollbar{width:10px}.nk-page-scroll::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:5px;border:2px solid var(--nk-bg)}.nk-cover{height:200px;background:radial-gradient(ellipse at 20% 40%,color-mix(in srgb,var(--nk-decor-purple) 35%,transparent),transparent 55%),radial-gradient(ellipse at 80% 20%,color-mix(in srgb,var(--nk-decor-blue) 35%,transparent),transparent 55%),radial-gradient(ellipse at 60% 90%,color-mix(in srgb,var(--nk-decor-orange) 25%,transparent),transparent 55%),var(--nk-bg-callout)}.nk-cover>img,.nk-cover ::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.nk-page{max-width:760px;margin:0 auto;padding:24px max(64px,env(safe-area-inset-right,0px)) 120px max(64px,env(safe-area-inset-left,0px));font-size:16px;line-height:1.5}.nk-page.full{max-width:none}.nk-page.small{font-size:14px}.nk-cover+.nk-page,.nk-page.covered{padding-top:0}.nk-page-icon,.nk-page ::slotted(.nk-page-icon),.nk-page ::slotted([slot="icon"]){font-size:64px;line-height:1;margin-top:0;cursor:pointer;user-select:none;display:inline-block}.nk-cover+.nk-page .nk-page-icon,.nk-cover+.nk-page ::slotted(.nk-page-icon),.nk-cover+.nk-page ::slotted([slot="icon"]),.nk-page.covered .nk-page-icon,.nk-page.covered ::slotted(.nk-page-icon),.nk-page.covered ::slotted([slot="icon"]){margin-top:-42px}.nk-page-title{font-size:var(--_nk-title, 40px);font-weight:700;line-height:1.2;margin:8px 0 4px;outline:none;letter-spacing:0}.nk-page-meta{color:var(--nk-text-tertiary);font-size:13px;margin-bottom:24px;display:flex;gap:16px}.nk-props{display:flex;flex-direction:column;margin:0 0 20px;font-size:14px;line-height:1.5}.nk-prop{display:flex;align-items:flex-start;min-width:0}.nk-prop .p-name{flex:0 0 160px;min-width:0;min-height:34px;padding:0 6px;display:flex;align-items:center;gap:6px;overflow:hidden;border-radius:var(--nk-radius);color:var(--nk-text-secondary);white-space:nowrap;user-select:none}.nk-prop .p-icon,.nk-prop ::slotted([slot="icon"]){width:16px;flex-shrink:0;text-align:center;font-size:13px}.nk-prop .p-value{flex:1 1 auto;min-width:0;min-height:34px;padding:5px 8px;display:flex;align-items:center;flex-wrap:wrap;gap:4px 6px;border-radius:var(--nk-radius);overflow-wrap:anywhere}.nk-prop .p-name:hover,.nk-prop .p-value:hover{background:var(--nk-bg-hover)}.nk-page p.lead{font-size:1em;line-height:1.6;color:var(--nk-text-secondary);margin-bottom:20px}.nk-page ::slotted(p.lead){font-size:1em;line-height:1.6;color:var(--nk-text-secondary);margin-bottom:20px!important}.nk-heading{font-size:1.5em;font-weight:600;line-height:1.3;margin:32px 0 10px;display:flex;align-items:center;gap:8px}.nk-callout{display:flex;gap:10px;align-items:flex-start;background:var(--nk-bg-callout);border-radius:var(--nk-radius);padding:16px 16px 16px 12px;margin:16px 0;line-height:1.5}.nk-callout .c-icon,.nk-callout ::slotted(.c-icon),.nk-callout ::slotted([slot="icon"]){font-size:17px}.nk-bookmark{display:flex;min-width:0;margin:8px 0;overflow:hidden;border:1px solid var(--nk-border);border-radius:var(--nk-radius);color:var(--nk-text);text-decoration:none;transition:background .12s ease}.nk-bookmark:hover{background:var(--nk-bg-hover)}.nk-bookmark .bm-text{flex:1 1 0;min-width:0;padding:12px 14px 14px;font-size:14px;line-height:20px}.nk-bookmark .bm-title{display:block;min-height:24px;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-bookmark .bm-desc{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;max-height:32px;font-size:12px;line-height:16px;color:var(--nk-text-secondary)}.nk-bookmark .bm-url{display:flex;align-items:center;gap:6px;margin-top:6px;font-size:12px;line-height:16px;white-space:nowrap}.nk-bookmark .bm-url>span{min-width:0;overflow:hidden;text-overflow:ellipsis}.nk-bookmark .bm-favicon{flex:none;width:16px;height:16px}.nk-bookmark .bm-cover{position:relative;flex:0 0 33%;max-width:240px}.nk-bookmark .bm-cover>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.nk-todo{display:flex;align-items:flex-start;gap:8px;padding:4px 0}.nk-todo input[type=checkbox]{appearance:none;width:16px;height:16px;margin-top:3px;border:1.4px solid var(--nk-border-strong);border-radius:2px;cursor:pointer;flex-shrink:0;position:relative;background:var(--nk-bg)}.nk-todo input[type=checkbox]:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-todo input[type=checkbox]:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:11px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-todo input:checked+span{text-decoration:line-through;color:var(--nk-text-tertiary)}.nk-todo input:disabled{opacity:.5;cursor:not-allowed}.nk-toggle{margin:6px 0}.nk-toggle summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:6px;padding:4px 6px;border-radius:var(--nk-radius);font-weight:500;user-select:none}.nk-toggle summary::-webkit-details-marker{display:none}.nk-toggle summary:hover{background:var(--nk-bg-hover)}.nk-toggle summary:before{content:"\\25b8";color:var(--nk-text-tertiary);font-size:11px;transition:transform .15s;display:inline-block}.nk-toggle[open] summary:before{transform:rotate(90deg)}.nk-toggle .toggle-body,.nk-toggle ::slotted(.toggle-body){padding:4px 0 8px 26px;color:var(--nk-text-secondary);line-height:1.55}.nk-divider{border:none;border-top:1px solid var(--nk-border);margin:24px 0}.nk-quote{border-left:3px solid var(--nk-text);padding:2px 0 2px 14px;margin:16px 0;color:var(--nk-text-secondary);line-height:1.5}.nk-quote .q-cite{display:block;margin-top:6px;font-size:12.5px;color:var(--nk-text-tertiary)}.nk-mention{display:inline-flex;align-items:center;gap:4px;padding:0 4px;border-radius:4px;font-weight:500;cursor:pointer;white-space:nowrap}.nk-mention:hover{background:var(--nk-bg-hover)}.nk-mention.person{color:var(--nk-text)}.nk-mention.person .mini-avatar,.nk-mention.person .nk-avatar,.nk-mention.person ::slotted(.mini-avatar),.nk-mention.person ::slotted([slot="avatar"]){width:16px;height:16px;border-radius:50%;color:var(--nk-on-accent);font-size:8.5px;font-weight:600;display:inline-flex;align-items:center;justify-content:center}.nk-mention.page{color:var(--nk-text-secondary);text-decoration:underline;text-decoration-color:var(--nk-border-strong);text-underline-offset:2px}.nk-mention.date{color:var(--nk-color-orange)}.nk-inline-code{font-family:var(--nk-font-mono);font-size:85%;color:var(--nk-danger);background:color-mix(in srgb,var(--nk-danger) 8%,transparent);border-radius:4px;padding:1px 5px}.nk-code{background:var(--nk-bg-code);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:20px 24px;font-family:var(--nk-font-mono);font-size:13px;line-height:1.6;margin:14px 0;overflow-x:auto;color:var(--nk-text-secondary);white-space:pre;position:relative}.nk-code .lang{position:absolute;top:6px;right:10px;font-size:11px;color:var(--nk-text-tertiary);font-family:var(--nk-font)}.nk-code .tag,.nk-code ::slotted(.tag){color:var(--nk-accent)}.nk-code .attr,.nk-code ::slotted(.attr){color:var(--nk-color-orange)}.nk-database{margin:12px 0 8px}.nk-db-tabs{display:flex;gap:2px;align-items:center;padding:0 0 6px;margin-bottom:0;font-size:14px}.nk-db-tab{padding:4px 8px;cursor:pointer;color:var(--nk-text-secondary);border-radius:var(--nk-radius);user-select:none;line-height:20px;display:flex;align-items:center;gap:6px;flex-shrink:0;white-space:nowrap}.nk-db-tab:hover{color:var(--nk-text);background:var(--nk-bg-hover)}.nk-db-tab.active{color:var(--nk-text);background:var(--nk-bg-active);font-weight:500}.nk-db-tab.add{color:var(--nk-text-tertiary)}.nk-db-tab .badge,.nk-db-tab ::slotted(.badge){background:var(--nk-bg-callout);border-radius:8px;font-size:11px;padding:0 6px;color:var(--nk-text-tertiary)}.nk-db-toolbar{display:flex;align-items:center;gap:8px;min-width:0;padding-bottom:6px}.nk-db-toolbar>.nk-db-tabs{flex:1 1 auto;min-width:0;padding-bottom:0;overflow-x:auto;scrollbar-width:none}.nk-db-toolbar>.nk-db-tabs::-webkit-scrollbar{display:none}.nk-db-toolbar .tools{flex:none;display:flex;align-items:center;gap:4px;margin-left:auto}.nk-db-tool{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 8px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.nk-db-tool:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-db-tool.active{color:var(--nk-accent)}.nk-filter-row{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:2px 0 8px}.nk-filter-pill{display:inline-flex;align-items:center;gap:4px;height:24px;padding:0 8px;border:1px solid var(--nk-border-strong);border-radius:12px;background:transparent;font-family:inherit;font-size:13px;line-height:1;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.nk-filter-pill:hover{background:var(--nk-bg-hover)}.nk-filter-pill.active{color:var(--nk-accent);border-color:color-mix(in srgb,var(--nk-accent) 35%,transparent);background:color-mix(in srgb,var(--nk-accent) 6%,transparent)}.nk-filter-pill.add{border-color:transparent;color:var(--nk-text-tertiary)}.nk-filter-pill.add:hover{color:var(--nk-text-secondary)}.nk-filter-pill button{padding:0;border:none;background:none;font:inherit;color:inherit;cursor:pointer}.nk-filter-pill .fp-remove{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:-4px;border-radius:50%;font-size:13px}.nk-filter-pill .fp-remove:hover{background:color-mix(in srgb,currentColor 15%,transparent)}.nk-table-wrap{overflow-x:auto}.nk-table{width:100%;border-collapse:collapse;font-size:14px}.nk-table th{text-align:left;font-weight:400;color:var(--nk-text-secondary);height:36px;padding:0 8px;border-bottom:1px solid var(--nk-border);border-right:1px solid var(--nk-border);font-size:14px;white-space:nowrap;user-select:none;cursor:pointer}.nk-table th:hover{background:var(--nk-bg-hover)}.nk-table th .th-icon,.nk-table th ::slotted(.th-icon){margin-right:6px;font-size:13px;color:var(--nk-text-tertiary)}.nk-table td{height:36px;padding:6px 8px;line-height:1.5;border-bottom:1px solid var(--nk-border);border-right:1px solid var(--nk-border);white-space:nowrap;vertical-align:middle}.nk-table th:last-child,.nk-table td:last-child{border-right:none}.nk-table.wrap td,.nk-table td.wrap{white-space:normal;vertical-align:top}.nk-table tbody tr:hover{background:var(--nk-bg-hover)}.nk-table .row-title{display:flex;align-items:center;gap:7px;font-weight:500;cursor:pointer}.nk-table .row-title:hover{text-decoration:underline;text-decoration-color:var(--nk-text-tertiary)}.nk-table .date-cell{color:var(--nk-text-secondary)}.nk-table .num{text-align:right;font-variant-numeric:tabular-nums}.nk-table .person-cell{display:flex;align-items:center;gap:6px;color:var(--nk-text-secondary)}.nk-table .person-cell .mini-avatar,.nk-table .person-cell ::slotted(.mini-avatar){width:20px;height:20px;border-radius:50%;font-size:10px;color:var(--nk-on-accent);display:inline-flex;align-items:center;justify-content:center;font-weight:600}.nk-new-row,.nk-table .new-row{color:var(--nk-text-tertiary);cursor:pointer;padding:8px;display:flex;align-items:center;gap:7px;font-size:14px}.nk-new-row:hover,.nk-table .new-row:hover{background:var(--nk-bg-hover)}.nk-tag{display:inline-flex;align-items:center;max-width:100%;height:20px;padding:0 6px;border-radius:3px;font-size:14px;font-weight:400;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;background:var(--nk-tag-gray-bg);color:var(--nk-tag-gray-text)}.nk-tag.gray{background:var(--nk-tag-gray-bg);color:var(--nk-tag-gray-text)}.nk-tag.brown{background:var(--nk-tag-brown-bg);color:var(--nk-tag-brown-text)}.nk-tag.orange{background:var(--nk-tag-orange-bg);color:var(--nk-tag-orange-text)}.nk-tag.yellow{background:var(--nk-tag-yellow-bg);color:var(--nk-tag-yellow-text)}.nk-tag.green{background:var(--nk-tag-green-bg);color:var(--nk-tag-green-text)}.nk-tag.blue{background:var(--nk-tag-blue-bg);color:var(--nk-tag-blue-text)}.nk-tag.purple{background:var(--nk-tag-purple-bg);color:var(--nk-tag-purple-text)}.nk-tag.pink{background:var(--nk-tag-pink-bg);color:var(--nk-tag-pink-text)}.nk-tag.red{background:var(--nk-tag-red-bg);color:var(--nk-tag-red-text)}.nk-progress{width:110px;height:6px;border-radius:3px;background:var(--nk-tint-blue);overflow:hidden;display:inline-block}.nk-progress>i{display:block;height:100%;background:var(--nk-color-blue);border-radius:3px}.nk-progress.wide{width:100%;flex:1 1 60px}.nk-progress-label{font-size:12px;color:var(--nk-text-tertiary);margin-left:7px;white-space:nowrap}.nk-list{display:flex;flex-direction:column;font-size:14px}.nk-list-item{display:flex;align-items:center;gap:8px;min-width:0;overflow:hidden;min-height:36px;padding:4px 6px;border-bottom:1px solid var(--nk-border);color:inherit;text-decoration:none;cursor:pointer}.nk-list-item:hover{background:var(--nk-bg-hover)}.nk-list>.nk-list-item:last-child,.nk-list ::slotted(.nk-list-item:last-child),.nk-list-item.last{border-bottom:none}.nk-list-item .l-icon,.nk-list-item ::slotted([slot="icon"]){width:20px;flex-shrink:0;text-align:center;font-size:15px}.nk-list-item .l-title,.nk-list-item ::slotted(.l-title){flex:1 1 auto;min-width:0;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-list-item .l-meta,.nk-list-item ::slotted(.l-meta){flex:none;display:flex;align-items:center;gap:8px;margin-left:auto;font-size:12px;color:var(--nk-text-secondary);white-space:nowrap}.nk-board{display:none;gap:12px;padding:14px 2px;overflow-x:auto}.nk-board.active{display:flex}.nk-board-col{min-width:220px;width:220px;flex-shrink:0}.nk-board-col-header{display:flex;align-items:center;gap:7px;margin-bottom:8px;font-size:13.5px;font-weight:500}.nk-board-col-header .count{color:var(--nk-text-tertiary);font-weight:400}.nk-card{background:var(--nk-bg-card);border:1px solid var(--nk-border);border-radius:8px;padding:10px 12px;margin-bottom:8px;cursor:grab;box-shadow:var(--nk-shadow-card);transition:border-color .15s}.nk-card:hover{border-color:var(--nk-border-strong)}.nk-card .card-title,.nk-card ::slotted(.card-title){font-weight:500;margin-bottom:7px;display:flex;gap:6px;align-items:center}.nk-card .card-meta,.nk-card ::slotted(.card-meta){display:flex;gap:6px;flex-wrap:wrap;align-items:center;font-size:12px;color:var(--nk-text-secondary)}.nk-field{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:9px 0}.nk-field .f-label,.nk-field ::slotted(.f-label),.nk-field ::slotted([slot="label"]){font-size:14px}.nk-field .f-desc,.nk-field ::slotted(.f-desc),.nk-field ::slotted([slot="desc"]){font-size:12px;color:var(--nk-text-secondary);margin-top:2px;line-height:1.45}.nk-field .f-control,.nk-field ::slotted(.f-control){flex-shrink:0}.nk-field.stacked,.nk-fields>.nk-field{flex-direction:column;align-items:stretch;gap:6px;min-width:0}.nk-field.stacked .f-control,.nk-fields>.nk-field .f-control{width:100%;min-width:0}.nk-field.stacked .nk-input,.nk-field.stacked .nk-textarea,.nk-field.stacked .nk-select,.nk-fields>.nk-field .nk-input,.nk-fields>.nk-field .nk-textarea,.nk-fields>.nk-field .nk-select{width:100%;min-width:0}.nk-field.compact,.nk-fields>.nk-field{padding:0;gap:4px;min-width:0}.nk-field.compact .f-label,.nk-field.compact ::slotted([slot="label"]),.nk-fields>.nk-field .f-label,.nk-fields>.nk-field ::slotted([slot="label"]){font-size:12px;color:var(--nk-text-tertiary)}.nk-fields{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px 12px;padding:9px 0}.nk-fields>.nk-field{min-width:0}.nk-input,.nk-select,.nk-textarea{font-family:inherit;font-size:14px;line-height:20px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:5px 10px;outline:none;transition:border-color .15s,box-shadow .15s;min-width:210px}.nk-input:hover,.nk-select:hover,.nk-textarea:hover{border-color:var(--nk-border-strong)}.nk-input:focus,.nk-select:focus,.nk-textarea:focus{border-color:color-mix(in srgb,var(--nk-accent) 60%,transparent);box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 30%,transparent)}.nk-input::placeholder,.nk-textarea::placeholder{color:var(--nk-text-tertiary)}.nk-input.wide,.nk-textarea.wide,.nk-select.wide{width:100%;min-width:0}.nk-input[type=date],.nk-input[type=time],.nk-input[type=datetime-local],.nk-input[type=month]{appearance:none}.nk-input::-webkit-date-and-time-value{text-align:start;min-height:1lh}.nk-select.compact{min-width:120px}.nk-textarea{resize:vertical;min-height:70px;line-height:1.5}.nk-select{appearance:none;cursor:pointer;padding-right:26px;background-image:linear-gradient(45deg,transparent 50%,var(--nk-text-tertiary) 50%),linear-gradient(135deg,var(--nk-text-tertiary) 50%,transparent 50%);background-position:calc(100% - 14px) 55%,calc(100% - 10px) 55%;background-size:4px 4px;background-repeat:no-repeat}.nk-copy-field{display:flex;align-items:center;gap:2px;min-width:210px;max-width:100%;padding:0 3px 0 10px;font-size:14px;line-height:20px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius)}.nk-copy-field.wide{width:100%;min-width:0}.nk-copy-field.wrap{align-items:flex-start}.nk-copy-field .cf-value{flex:1 1 auto;min-width:0;padding:5px 6px 5px 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.nk-copy-field.mono .cf-value{font-family:var(--nk-font-mono);font-size:13px}.nk-copy-field.wrap .cf-value{white-space:pre-wrap;overflow-wrap:anywhere}.nk-copy-field .cf-btn{flex:none;height:24px;margin:3px 0;padding:0 8px;border:none;border-radius:4px;background:transparent;font-family:inherit;font-size:13px;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer}.nk-copy-field .cf-btn:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-copy-field .cf-btn.copied{color:var(--nk-color-green)}.nk-btn{font-family:inherit;font-size:14px;line-height:20px;font-weight:500;border-radius:var(--nk-radius);cursor:pointer;padding:3px 12px;border:1px solid transparent;transition:background .15s,border-color .15s,box-shadow .15s,opacity .15s;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.nk-btn svg,.nk-btn ::slotted(svg){width:15px;height:15px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-btn.primary{background:var(--nk-accent);color:var(--nk-on-accent)}.nk-btn.primary:hover{opacity:.88}.nk-btn.secondary{background:var(--nk-bg-card);color:var(--nk-text);box-shadow:var(--nk-shadow-btn)}.nk-btn.secondary:hover{background:color-mix(in srgb,var(--nk-bg-card),var(--nk-text) 6%)}.nk-btn.danger{background:var(--nk-bg-card);color:var(--nk-danger);box-shadow:var(--nk-shadow-btn)}.nk-btn.danger:hover{background:color-mix(in srgb,var(--nk-danger) 8%,var(--nk-bg-card))}.nk-btn.danger-solid{background:var(--nk-danger);color:var(--nk-on-accent)}.nk-btn.danger-solid:hover{opacity:.88}.nk-btn.small{padding:1px 8px;font-size:13px;line-height:20px}a.nk-btn{text-decoration:none}.nk-btn:disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.nk-switch{position:relative;width:34px;height:20px;flex-shrink:0;appearance:none;border:none;cursor:pointer;border-radius:20px;background:var(--nk-border-strong);transition:background .2s}.nk-switch:after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--nk-on-accent);transition:transform .2s;box-shadow:var(--nk-shadow-knob)}.nk-switch:checked,.nk-switch[aria-checked=true]{background:var(--nk-accent)}.nk-switch:checked:after,.nk-switch[aria-checked=true]:after{transform:translate(14px)}.nk-switch:disabled{opacity:.5;cursor:not-allowed}.nk-switch-label{display:inline-flex;align-items:flex-start;gap:8px;font-size:14px;cursor:pointer}.nk-switch-label>.nk-switch{font-size:inherit;line-height:inherit;margin-top:max(0px,calc((1lh - 20px)/2))}.nk-switch-label>span{padding-top:max(0px,calc((20px - 1lh)/2))}.nk-switch-label:has(.nk-switch:disabled){cursor:not-allowed;color:var(--nk-text-tertiary)}.nk-check{display:flex;align-items:flex-start;gap:8px;padding:4px 0;font-size:14px;cursor:pointer}.nk-check input{appearance:none;width:16px;height:16px;flex-shrink:0;border:1.4px solid var(--nk-border-strong);border-radius:3px;cursor:pointer;position:relative;background:var(--nk-bg);font-size:inherit;line-height:inherit;margin-top:max(0px,calc((1lh - 16px)/2))}.nk-check input[type=radio]{border-radius:50%}.nk-check input:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-check input:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:10.5px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-check input[type=radio]:checked:after{content:"\\25cf";font-size:7px}.nk-check input:disabled{opacity:.5;cursor:not-allowed}.nk-check input:disabled+*{opacity:.6}.nk-slider{width:210px;accent-color:var(--nk-accent);cursor:pointer}.nk-slider-value{font-size:12.5px;color:var(--nk-text-tertiary);margin-top:3px}.nk-profile-row{display:flex;align-items:center;gap:14px;padding:8px 0}.nk-profile-row .big-avatar,.nk-profile-row ::slotted(.big-avatar),.nk-profile-row ::slotted([slot="avatar"]){width:56px;height:56px;border-radius:50%;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:20px;font-weight:600;display:flex;align-items:center;justify-content:center;overflow:hidden;flex-shrink:0}.nk-profile-row .big-avatar>img{display:block;width:100%;height:100%;object-fit:cover}.nk-profile-row .big-avatar.square,.nk-profile-row ::slotted(.big-avatar.square){border-radius:8px}.nk-profile-row .pr-actions{display:flex;flex-direction:column;gap:6px}.nk-profile-row .pr-remove{color:var(--nk-text-tertiary)}.nk-model-card{border:1px solid var(--nk-border-strong);border-radius:8px;padding:12px 14px;margin-bottom:10px;cursor:pointer;display:flex;align-items:flex-start;gap:11px;transition:border-color .15s,background .15s}.nk-model-card:hover{background:var(--nk-bg-hover)}.nk-model-card.selected{border-color:var(--nk-accent);background:color-mix(in srgb,var(--nk-accent) 6%,transparent)}.nk-model-card .m-radio{width:15px;height:15px;border-radius:50%;flex-shrink:0;margin-top:2px;border:1.4px solid var(--nk-border-strong);position:relative}.nk-model-card.selected .m-radio{border-color:var(--nk-accent)}.nk-model-card.selected .m-radio:after{content:"";position:absolute;inset:3px;border-radius:50%;background:var(--nk-accent)}.nk-model-card .m-name,.nk-model-card ::slotted(.m-name),.nk-model-card ::slotted([slot="title"]){font-weight:500;font-size:14px;display:flex;align-items:center;gap:7px}.nk-model-card .m-desc,.nk-model-card ::slotted(.m-desc),.nk-model-card ::slotted([slot="desc"]){font-size:12px;color:var(--nk-text-secondary);margin-top:2px;line-height:1.45}.nk-danger-zone{border:1px solid color-mix(in srgb,var(--nk-danger) 40%,transparent);border-radius:8px;padding:14px 16px;margin-top:26px}.nk-danger-zone .dz-title{color:var(--nk-danger);font-weight:600;font-size:13px;margin-bottom:8px}.nk-member-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--nk-border)}.nk-member-list>.nk-member-row:last-child,.nk-member-list ::slotted(.nk-member-row:last-child),.nk-member-row.last{border-bottom:none}.nk-member-row .mini-avatar,.nk-member-row .nk-avatar,.nk-member-row ::slotted(.mini-avatar),.nk-member-row ::slotted([slot="avatar"]){width:28px;height:28px;border-radius:50%;color:var(--nk-on-accent);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;flex-shrink:0}.nk-member-row>:has(>.m-mail){min-width:0}.nk-member-row .m-mail{font-size:12px;color:var(--nk-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-member-row .nk-select{min-width:120px;margin-left:auto}.nk-member-row ::slotted([slot="role"]){margin-left:auto}.nk-modal-backdrop{position:fixed;inset:0;background:var(--nk-scrim);padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);display:flex;align-items:center;justify-content:center;z-index:100;opacity:0;pointer-events:none;transition:opacity .2s ease}.nk-modal-backdrop.open{opacity:1;pointer-events:auto}.nk-modal{width:min(1150px,92vw);height:min(715px,86vh);max-width:100%;max-height:100%;background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);display:flex;overflow:hidden;transform:scale(.98) translateY(6px);transition:transform .2s ease}.nk-modal-backdrop.open .nk-modal{transform:scale(1) translateY(0)}.nk-settings-nav{width:240px;min-width:240px;background:var(--nk-bg-sidebar);border-right:1px solid var(--nk-border);padding:10px 8px;overflow-y:auto;flex-shrink:0}.nk-settings-user{display:flex;align-items:center;gap:9px;padding:6px 10px 12px;margin-bottom:4px}.nk-settings-user .avatar,.nk-settings-user ::slotted(.avatar),.nk-settings-user ::slotted([slot="avatar"]){width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-weight:600;font-size:13px;display:flex;align-items:center;justify-content:center}.nk-settings-user .name{font-weight:500;font-size:14px}.nk-settings-user .mail{font-size:12px;color:var(--nk-text-secondary)}.nk-settings-nav .nk-tree-item{min-height:28px}.nk-settings-nav .nk-tree-item.active{background:var(--nk-bg-active);color:var(--nk-text);font-weight:500}.nk-settings-content{flex:1;overflow-y:auto;padding:36px 60px 80px;min-width:0}.nk-settings-content::-webkit-scrollbar{width:10px}.nk-settings-content::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:5px;border:2px solid var(--nk-bg)}.nk-settings-pane{display:none;max-width:800px}.nk-settings-pane.active{display:block}.nk-settings-pane>h2{font-size:22px;font-weight:600;line-height:1.3;margin-bottom:20px}.nk-settings-pane>h3{font-size:16px;font-weight:500;padding-bottom:8px;border-bottom:1px solid var(--nk-border);margin:30px 0 12px}.nk-settings-pane ::slotted(h2){font-size:22px;font-weight:600;line-height:1.3;padding:0!important;margin:0 0 20px!important}.nk-settings-pane ::slotted(h3){font-size:16px;font-weight:500;border:0;border-bottom:1px solid var(--nk-border);padding:0 0 8px!important;margin:30px 0 12px!important}.nk-pop{background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);padding:10px;width:296px}.nk-emoji-search{width:100%;font-family:inherit;font-size:14px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:6px 10px;outline:none;margin-bottom:8px}.nk-emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:2px}.nk-emoji-grid span,.nk-emoji-grid ::slotted(span){font-size:18px;text-align:center;padding:4px 0;border-radius:5px;cursor:pointer;user-select:none}.nk-emoji-grid span:hover{background:var(--nk-bg-hover)}.nk-emoji-cats{display:flex;gap:2px;margin-top:8px;padding-top:8px;border-top:1px solid var(--nk-border)}.nk-emoji-cats span{font-size:14px;padding:3px 7px;border-radius:5px;cursor:pointer;color:var(--nk-text-tertiary);filter:grayscale(1);opacity:.6}.nk-emoji-cats span.active,.nk-emoji-cats span:hover{filter:none;opacity:1;background:var(--nk-bg-hover)}.nk-menu{padding:5px;width:230px}.nk-menu-item{display:flex;align-items:center;gap:9px;padding:4px 8px;min-height:var(--_nk-row, 28px);border-radius:5px;cursor:pointer;font-size:14px;user-select:none}.nk-menu-item:hover{background:var(--nk-bg-hover)}.nk-menu-item .m-icon,.nk-menu-item ::slotted(.m-icon),.nk-menu-item ::slotted([slot="icon"]){width:17px;text-align:center;font-size:14px}.nk-menu-item .m-shortcut,.nk-menu-item ::slotted(.m-shortcut){margin-left:auto;font-size:12px;color:var(--nk-text-tertiary)}.nk-menu-item.danger{color:var(--nk-danger)}.nk-menu-item>.nk-switch{margin-left:auto}.nk-menu-sep{border-top:1px solid var(--nk-border);margin:5px 4px}.nk-menu-label{font-size:12px;color:var(--nk-text-tertiary);padding:5px 8px 2px}.nk-pop.floating{z-index:60;opacity:0;visibility:hidden;pointer-events:none;transform:translateY(-4px) scale(.98);transform-origin:top;transition:opacity .15s ease,transform .15s ease,visibility 0s linear .15s}.nk-pop.floating.open{opacity:1;visibility:visible;pointer-events:auto;transform:none;transition:opacity .15s ease,transform .15s ease,visibility 0s}.nk-cmdk-backdrop{position:fixed;inset:0;background:var(--nk-scrim-soft);display:flex;justify-content:center;align-items:flex-start;padding:max(14vh,env(safe-area-inset-top,0px)) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);z-index:110;opacity:0;pointer-events:none;transition:opacity .18s ease}.nk-cmdk-backdrop.open{opacity:1;pointer-events:auto}.nk-cmdk{max-width:100%;width:min(560px,92vw);background:var(--nk-bg);border-radius:12px;box-shadow:var(--nk-shadow-menu);overflow:hidden;transform:scale(.98);transition:transform .18s ease}.nk-cmdk-backdrop.open .nk-cmdk{transform:scale(1)}.nk-cmdk-input-row{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--nk-border)}.nk-cmdk-input-row input{flex:1;border:none;outline:none;background:transparent;font-family:inherit;font-size:16px;color:var(--nk-text)}.nk-cmdk-input-row input::placeholder{color:var(--nk-text-tertiary)}.nk-cmdk-list{max-height:320px;overflow-y:auto;padding:6px}.nk-cmdk-group{font-size:12px;color:var(--nk-text-tertiary);padding:8px 10px 3px}.nk-cmdk-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:6px;cursor:pointer;font-size:14px;user-select:none}.nk-cmdk-item.selected{background:var(--nk-bg-active)}.nk-cmdk-item .m-icon,.nk-cmdk-item ::slotted(.m-icon),.nk-cmdk-item ::slotted([slot="icon"]){width:17px;text-align:center;font-size:14px}.nk-cmdk-item .m-shortcut,.nk-cmdk-item ::slotted(.m-shortcut){margin-left:auto;font-size:12px;color:var(--nk-text-tertiary)}.nk-cmdk-empty{padding:30px;text-align:center;color:var(--nk-text-tertiary);font-size:13.5px}.nk-cmdk-footer{display:flex;gap:14px;padding:8px 16px;border-top:1px solid var(--nk-border);font-size:11.5px;color:var(--nk-text-tertiary)}.nk-sheet-backdrop{position:fixed;inset:0;z-index:100;display:none;flex-direction:column;align-items:center;justify-content:flex-end;padding-top:max(24px,env(safe-area-inset-top,0px));background:var(--nk-scrim-soft);opacity:0;transition:opacity .2s ease,display .25s allow-discrete}.nk-sheet-backdrop.open{display:flex;opacity:1}@starting-style{.nk-sheet-backdrop.open{opacity:0}}.nk-sheet{--_nk-row: 40px;width:100%;max-width:640px;max-height:100%;overflow-y:auto;overscroll-behavior:contain;padding:6px max(10px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px));background:var(--nk-bg);color:var(--nk-text);border-radius:14px 14px 0 0;box-shadow:var(--nk-shadow-menu);translate:0 100%;transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-sheet-backdrop.open .nk-sheet{translate:0 0}@starting-style{.nk-sheet-backdrop.open .nk-sheet{translate:0 100%}}.nk-sheet .sh-grabber,.nk-sheet ::slotted(.sh-grabber){width:36px;height:4px;margin:4px auto 10px;border-radius:2px;background:var(--nk-border-strong)}.nk-sheet .sh-title,.nk-sheet ::slotted(.sh-title){font-size:14px;font-weight:600;text-align:center;padding:0 8px 10px}.nk-peek-backdrop{position:fixed;inset:0;z-index:50;display:none;pointer-events:none;transition:background-color .2s ease,display .25s allow-discrete}.nk-peek-backdrop.open{display:block}.nk-peek{--_nk-title: 32px;position:absolute;top:0;right:0;bottom:0;width:min(560px,100%);display:flex;flex-direction:column;pointer-events:auto;outline:none;background:var(--nk-bg);color:var(--nk-text);box-shadow:var(--nk-shadow-menu);translate:100% 0;transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-peek-backdrop.open .nk-peek{translate:0 0}@starting-style{.nk-peek-backdrop.open .nk-peek{translate:100% 0}}.nk-peek .pk-bar{flex:none;display:flex;align-items:center;gap:2px;height:44px;padding:0 12px}.nk-peek .pk-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 48px 64px;font-size:16px;line-height:1.5}.nk-toast{position:fixed;bottom:max(20px,calc(env(safe-area-inset-bottom,0px) + 12px));left:50%;transform:translate(-50%) translateY(80px);z-index:120;width:max-content;max-width:calc(100% - 32px);background:var(--nk-text);color:var(--nk-bg);padding:8px 16px;border-radius:8px;font-size:14px;opacity:0;transition:all .3s ease;pointer-events:none;box-shadow:var(--nk-shadow-menu);display:flex;gap:8px;align-items:center}.nk-toast.show{opacity:1;transform:translate(-50%) translateY(0)}.nk-gallery-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr));gap:20px 32px;margin:12px 0}.nk-g-item>h4{font-size:12px;font-weight:500;color:var(--nk-text-tertiary);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px}.nk-g-item ::slotted(h4){font-size:12px;font-weight:500;color:var(--nk-text-tertiary);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px!important}.nk-tabs{display:flex;gap:2px;border-bottom:1px solid var(--nk-border);font-size:14px}.nk-tab{padding:7px 11px;cursor:pointer;color:var(--nk-text-secondary);border-bottom:2px solid transparent;margin-bottom:-1px;user-select:none}.nk-tab:hover{color:var(--nk-text)}.nk-tab.active{color:var(--nk-text);border-bottom-color:var(--nk-text);font-weight:500}.nk-tab-panel{padding:12px 2px;color:var(--nk-text-secondary);line-height:1.55;font-size:14px}.nk-template-btn{display:flex;align-items:center;gap:8px;width:100%;font-family:inherit;font-size:14px;color:var(--nk-text-secondary);background:var(--nk-bg-callout);border:none;border-radius:var(--nk-radius);padding:8px 12px;cursor:pointer;margin-bottom:6px;text-align:left}.nk-template-btn:hover{background:var(--nk-bg-hover)}.nk-stats{display:flex;gap:10px}.nk-stat{flex:1;border:1px solid var(--nk-border);border-radius:8px;padding:12px 14px}.nk-stat .s-label,.nk-stat ::slotted(.s-label),.nk-stat ::slotted([slot="label"]){font-size:12px;color:var(--nk-text-secondary);margin-bottom:4px}.nk-stat .s-value,.nk-stat ::slotted(.s-value),.nk-stat ::slotted([slot="value"]){font-size:22px;font-weight:600;letter-spacing:-.01em}.nk-stat .s-delta,.nk-stat ::slotted(.s-delta),.nk-stat ::slotted([slot="delta"]){font-size:12px;margin-top:3px}.nk-stat .s-delta.up,.nk-stat ::slotted(.s-delta.up),.nk-stat ::slotted([slot="delta"].up){color:var(--nk-color-green)}.nk-stat .s-delta.down,.nk-stat ::slotted(.s-delta.down),.nk-stat ::slotted([slot="delta"].down){color:var(--nk-danger)}.nk-synced{border:1.5px solid color-mix(in srgb,var(--nk-danger) 55%,transparent);border-radius:8px;padding:12px 14px;position:relative;margin:8px 0}.nk-synced .synced-badge{position:absolute;top:-9px;right:10px;font-size:11px;background:var(--nk-danger);color:var(--nk-on-accent);border-radius:8px;padding:1px 8px}.nk-segmented{display:inline-flex;background:var(--nk-bg-callout);border-radius:7px;padding:2px}.nk-segmented button{font-family:inherit;font-size:14px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 12px;border-radius:5px;cursor:pointer}.nk-segmented ::slotted(button){font-family:inherit;font-size:14px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 12px!important;border-radius:5px;cursor:pointer}.nk-segmented button.active,.nk-segmented ::slotted(button.active){background:var(--nk-bg);color:var(--nk-text);font-weight:500;box-shadow:var(--nk-shadow-segment)}.nk-segmented.wrap{flex-wrap:wrap}.nk-segmented.scroll{max-width:100%;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}.nk-segmented.scroll::-webkit-scrollbar{display:none}.nk-segmented.scroll button,.nk-segmented.scroll ::slotted(button){flex-shrink:0;white-space:nowrap}.nk-banner{display:flex;align-items:center;gap:10px;font-size:14px;border-radius:8px;padding:10px 14px;margin-bottom:8px;color:var(--nk-text)}.nk-banner.info{background:var(--nk-tint-blue)}.nk-banner.success{background:var(--nk-tint-green)}.nk-banner.warning{background:var(--nk-tint-yellow)}.nk-banner.danger{background:var(--nk-tint-red)}.nk-banner .b-action,.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){margin-left:auto;font-weight:500;cursor:pointer;text-decoration:underline;text-underline-offset:2px}.nk-avatar-group{display:flex}.nk-avatar-group .mini-avatar,.nk-avatar-group .nk-avatar,.nk-avatar-group ::slotted(.mini-avatar),.nk-avatar-group ::slotted(.nk-avatar){width:26px;height:26px;border-radius:50%;color:var(--nk-on-accent);font-size:10.5px;font-weight:600;border:2px solid var(--nk-bg);display:flex;align-items:center;justify-content:center;margin-left:-7px}.nk-avatar-group .mini-avatar:first-child,.nk-avatar-group .nk-avatar:first-child,.nk-avatar-group ::slotted(.mini-avatar:first-child),.nk-avatar-group ::slotted(.nk-avatar:first-child){margin-left:0}.nk-avatar-group .more,.nk-avatar-group ::slotted(.more){background:var(--nk-bg-callout);color:var(--nk-text-secondary)}.nk-avatar{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:24px;border-radius:50%;overflow:hidden;vertical-align:middle;font-size:10px;font-weight:600;line-height:1;color:var(--nk-on-accent);user-select:none;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));object-fit:cover}.nk-avatar.small{width:20px;height:20px;font-size:9px}.nk-avatar.large{width:32px;height:32px;font-size:12px}.nk-avatar.xlarge{width:56px;height:56px;font-size:20px}.nk-avatar.square{border-radius:4px}.nk-avatar>img,.nk-avatar ::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.nk-avatar.gray{background:var(--nk-color-gray)}.nk-avatar.brown{background:var(--nk-color-brown)}.nk-avatar.orange{background:var(--nk-color-orange)}.nk-avatar.yellow{background:var(--nk-color-yellow)}.nk-avatar.green{background:var(--nk-color-green)}.nk-avatar.blue{background:var(--nk-color-blue)}.nk-avatar.purple{background:var(--nk-color-purple)}.nk-avatar.pink{background:var(--nk-color-pink)}.nk-avatar.red{background:var(--nk-color-red)}.nk-panels{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));gap:12px;margin:12px 0}.nk-panel{display:flex;flex-direction:column;gap:6px;min-width:0;padding:14px 16px;border:1px solid var(--nk-border);border-radius:10px;background:var(--nk-bg-card);box-shadow:var(--nk-shadow-card);font-size:14px;line-height:1.5;color:inherit;text-decoration:none;text-align:left}:is(a,button).nk-panel{cursor:pointer;font-family:inherit;transition:border-color .15s,background .15s}:is(a,button).nk-panel:hover{border-color:var(--nk-border-strong)}.nk-panel>h3{font-size:14px;font-weight:600;line-height:1.4}.nk-panel ::slotted(h3){font-size:14px;font-weight:600;line-height:1.4;margin:0!important}.nk-panel>p{font-size:13px;color:var(--nk-text-secondary)}.nk-panel ::slotted(p){font-size:13px;color:var(--nk-text-secondary);margin:0!important}.nk-panel>.nk-cover{flex:none;height:64px;margin:-14px -16px 2px;border-radius:9px 9px 0 0}.nk-panel>.nk-page-icon{font-size:28px}.nk-panel>.nk-cover+.nk-page-icon{margin-top:-24px}.nk-skeleton{border-radius:5px;margin-bottom:10px;background:linear-gradient(90deg,var(--nk-bg-callout) 25%,var(--nk-bg-hover) 50%,var(--nk-bg-callout) 75%);background-size:200% 100%;animation:nk-shimmer 1.6s infinite}@keyframes nk-shimmer{to{background-position:-200% 0}}.nk-empty{text-align:center;padding:36px 20px;border:1.5px dashed var(--nk-border-strong);border-radius:10px;color:var(--nk-text-tertiary)}.nk-empty .e-icon,.nk-empty ::slotted(.e-icon),.nk-empty ::slotted([slot="icon"]){font-size:30px;margin-bottom:8px}.nk-empty .e-title,.nk-empty ::slotted(.e-title),.nk-empty ::slotted([slot="title"]){font-weight:500;color:var(--nk-text-secondary);margin-bottom:3px;font-size:14px}.nk-empty .e-desc,.nk-empty ::slotted(.e-desc),.nk-empty ::slotted([slot="desc"]){font-size:13px;margin-bottom:12px}.nk-empty .e-actions,.nk-empty ::slotted(.e-actions){display:flex;flex-wrap:wrap;justify-content:center;gap:8px}.nk-steps{display:flex;flex-direction:column;margin:8px 0;padding:0;list-style:none;font-size:14px}.nk-step{position:relative;display:flex;align-items:flex-start;gap:10px;padding-bottom:14px;line-height:20px;color:var(--nk-text-tertiary)}.nk-step:last-child{padding-bottom:0}.nk-step:not(:last-child):after{content:"";position:absolute;left:10px;top:24px;bottom:4px;width:1px;background:var(--nk-border)}.nk-step .st-mark{flex:none;width:20px;height:20px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--nk-border-strong);background:var(--nk-bg);font-size:11px;font-weight:600;line-height:1}.nk-step .st-desc{display:block;font-size:12px;line-height:18px;color:var(--nk-text-tertiary);font-weight:400}.nk-step.done{color:var(--nk-text-secondary)}.nk-step.done .st-mark{background:var(--nk-tag-green-bg);color:var(--nk-tag-green-text);border-color:transparent}.nk-step.current{color:var(--nk-text);font-weight:500}.nk-step.current .st-mark{border-color:var(--nk-accent);color:var(--nk-accent)}.nk-comments{border-left:1px solid var(--nk-border);padding:4px 0 4px 18px;margin:8px 0 8px 8px}.nk-comment{display:flex;gap:9px;margin-bottom:14px}.nk-comment .mini-avatar,.nk-comment ::slotted(.mini-avatar),.nk-comment ::slotted([slot="avatar"]){width:24px;height:24px;border-radius:50%;color:var(--nk-on-accent);flex-shrink:0;font-size:10px;font-weight:600;display:flex;align-items:center;justify-content:center}.nk-comment .c-head,.nk-comment ::slotted(.c-head){font-size:12px;color:var(--nk-text-tertiary);margin-bottom:2px}.nk-comment .c-head b{color:var(--nk-text);font-weight:600}.nk-comment .c-body,.nk-comment ::slotted(.c-body){font-size:14px;line-height:1.5}.nk-comment-input{display:flex;gap:8px;align-items:center;margin-top:4px}.nk-comment-input input{min-width:0;flex:1}.nk-ai-thread{display:flex;flex-direction:column;gap:14px}.nk-ai-msg{display:flex;gap:9px}.nk-ai-msg .mini-avatar,.nk-ai-msg ::slotted(.mini-avatar),.nk-ai-msg ::slotted([slot="avatar"]){width:24px;height:24px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:12px;background:var(--nk-bg-callout)}.nk-ai-msg.user .mini-avatar,.nk-ai-msg.user ::slotted(.mini-avatar),.nk-ai-msg.user ::slotted([slot="avatar"]){background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:9.5px;font-weight:600}.nk-ai-msg .a-body,.nk-ai-msg ::slotted(.a-body){font-size:14px;line-height:1.55;padding-top:2px}.nk-ai-msg .a-name,.nk-ai-msg ::slotted(.a-name){font-size:12px;font-weight:600;margin-bottom:2px}.nk-ai-msg .a-name span{color:var(--nk-text-tertiary);font-weight:400}.nk-ai-msg.user.bubble{justify-content:flex-end}.nk-ai-msg.bubble .a-body,.nk-ai-msg.bubble ::slotted(.a-body){max-width:85%;padding:6px 12px;border-radius:16px;background:var(--nk-bg-callout)}.nk-ai-actions{display:flex;gap:4px;margin-top:6px}.nk-ai-actions button{font-family:inherit;font-size:12px;color:var(--nk-text-secondary);background:transparent;border:1px solid var(--nk-border);border-radius:5px;padding:2px 8px;cursor:pointer}.nk-ai-actions ::slotted(button){font-family:inherit;font-size:12px;color:var(--nk-text-secondary);background:transparent;border:1px solid var(--nk-border);border-radius:5px;padding:2px 8px!important;cursor:pointer}.nk-ai-actions button:hover,.nk-ai-actions ::slotted(button:hover){background:var(--nk-bg-hover);color:var(--nk-text)}.nk-ai-input-row{display:flex;align-items:center;gap:8px;margin-top:14px;border:1px solid var(--nk-border-strong);border-radius:10px;padding:8px 12px}.nk-ai-input-row:focus-within{border-color:var(--nk-accent)}.nk-ai-input-row input{flex:1;border:none;outline:none;background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text);min-width:0}.nk-ai-input-row input::placeholder{color:var(--nk-text-tertiary)}.nk-ai-send{border:none;background:var(--nk-accent);color:var(--nk-on-accent);border-radius:6px;width:26px;height:26px;cursor:pointer;font-size:13px;flex-shrink:0}.nk-block-host{position:relative;border-radius:var(--nk-radius);margin:8px 0;padding:2px 0 2px 2px;transition:background .15s,box-shadow .15s}.nk-block-host:hover{background:var(--nk-bg-hover)}.nk-block-host:focus-within{background:transparent;box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 25%,transparent)}.nk-block-host.nk-drop-target{box-shadow:0 -2px 0 0 var(--nk-accent);background:transparent}.nk-block-host .nk-block-handle,.nk-block-host ::slotted(.nk-block-handle){position:absolute;left:-26px;top:4px;width:18px;height:20px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:var(--nk-text-tertiary);font-size:13px;cursor:grab;opacity:0;transition:opacity .15s;user-select:none}.nk-block-host:hover .nk-block-handle{opacity:1}.nk-block-host .nk-block-actions{position:absolute;display:flex;gap:1px;z-index:2;opacity:0;transition:opacity .15s;pointer-events:none}.nk-block-host .nk-block-actions.show{opacity:1;pointer-events:auto}.nk-block-host .nk-block-actions button,.nk-block-host .nk-block-actions ::slotted(button){width:20px;height:22px;padding:0;border:none;border-radius:4px;background:transparent;color:var(--nk-text-tertiary);font-family:inherit;font-size:14px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center}.nk-block-host .nk-block-actions button:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-block-host .nk-block-actions .drag{cursor:grab}.nk-block-host .nk-block-actions .drag:active{cursor:grabbing}.nk-prose,.nk-block-host .ProseMirror{font-family:var(--nk-font);line-height:1.5;color:var(--nk-text);overflow-wrap:break-word}.nk-block-host .ProseMirror{outline:none;min-height:60px;padding:4px 2px}.nk-prose>*+*,.nk-block-host .ProseMirror>*+*{margin-top:6px}.nk-prose h1,.nk-block-host .ProseMirror h1{font-size:1.875em;font-weight:600;line-height:1.3;letter-spacing:-.01em;margin:32px 0 4px}.nk-prose h2,.nk-block-host .ProseMirror h2{font-size:1.5em;font-weight:600;line-height:1.3;margin:24px 0 4px}.nk-prose h3,.nk-block-host .ProseMirror h3{font-size:1.25em;font-weight:600;line-height:1.3;margin:16px 0 2px}.nk-prose :is(h4,h5,h6),.nk-block-host .ProseMirror :is(h4,h5,h6){font-size:1em;font-weight:600;margin:12px 0 0}.nk-prose>:first-child,.nk-block-host .ProseMirror>:first-child{margin-top:0}.nk-prose>:last-child,.nk-block-host .ProseMirror>:last-child{margin-bottom:0}.nk-prose p:empty:before{content:"";display:inline-block}.nk-prose :is(strong,b),.nk-block-host .ProseMirror :is(strong,b){font-weight:600}.nk-prose :is(ul,ol),.nk-block-host .ProseMirror :is(ul,ol){padding-left:24px;margin:4px 0}.nk-prose ul,.nk-block-host .ProseMirror ul{list-style:disc}.nk-prose ol,.nk-block-host .ProseMirror ol{list-style:decimal}.nk-prose li,.nk-block-host .ProseMirror li{margin:2px 0}.nk-prose li::marker,.nk-block-host .ProseMirror li::marker{color:var(--nk-text-tertiary)}.nk-prose ul[data-type=taskList],.nk-block-host .ProseMirror ul[data-type=taskList]{list-style:none;padding-left:2px}.nk-prose ul[data-type=taskList] li,.nk-block-host .ProseMirror ul[data-type=taskList] li{display:flex;gap:8px;align-items:flex-start}.nk-prose ul[data-type=taskList] li>label,.nk-block-host .ProseMirror ul[data-type=taskList] li>label{flex-shrink:0;margin-top:max(0px,calc((1lh - 16px)/2));user-select:none}.nk-prose ul[data-type=taskList] li>div,.nk-block-host .ProseMirror ul[data-type=taskList] li>div{flex:1;min-width:0}.nk-prose ul[data-type=taskList] input[type=checkbox],.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]{appearance:none;width:16px;height:16px;margin:0;border:1.4px solid var(--nk-border-strong);border-radius:2px;cursor:pointer;position:relative;background:var(--nk-bg);display:block}.nk-prose ul[data-type=taskList] input[type=checkbox]:checked,.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-prose ul[data-type=taskList] input[type=checkbox]:checked:after,.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:11px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-prose li[data-checked=true]>div,.nk-block-host .ProseMirror li[data-checked=true]>div{text-decoration:line-through;color:var(--nk-text-tertiary)}.nk-prose blockquote,.nk-block-host .ProseMirror blockquote{border-left:3px solid var(--nk-text);padding:2px 0 2px 14px;margin:12px 0;color:var(--nk-text-secondary)}.nk-prose code,.nk-block-host .ProseMirror code{font-family:var(--nk-font-mono);font-size:85%;color:var(--nk-danger);background:color-mix(in srgb,var(--nk-danger) 8%,transparent);border-radius:4px;padding:1px 5px}.nk-prose pre,.nk-block-host .ProseMirror pre{background:var(--nk-bg-code);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:16px 20px;margin:12px 0;font-family:var(--nk-font-mono);font-size:13px;line-height:1.6;color:var(--nk-text-secondary);overflow-x:auto}.nk-prose pre code,.nk-block-host .ProseMirror pre code{background:none;color:inherit;padding:0;font-size:inherit}.nk-prose hr,.nk-block-host .ProseMirror hr{border:none;border-top:1px solid var(--nk-border);margin:20px 0}.nk-prose a,.nk-block-host .ProseMirror a{color:var(--nk-accent);text-decoration:underline;text-underline-offset:2px}.nk-prose img{max-width:100%;height:auto}.nk-prose table{display:block;width:max-content;max-width:100%;overflow-x:auto;border-collapse:collapse;font-size:14px;margin:12px 0}.nk-prose :is(th,td){padding:6px 10px;border:1px solid var(--nk-border);text-align:left;vertical-align:top}.nk-prose th{font-weight:600}.nk-block-host .ProseMirror-gapcursor:after{border-top-color:var(--nk-text)}.nk-block-host .ProseMirror .ProseMirror-selectednode{background:color-mix(in srgb,var(--nk-accent) 8%,transparent)}.nk-block-host .ProseMirror-selectednode{box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 35%,transparent);border-radius:3px}.nk-block-host .ProseMirror ::selection{background:color-mix(in srgb,var(--nk-accent) 25%,transparent)}.nk-block-host .ProseMirror p.is-editor-empty:first-child:before,.nk-block-host .ProseMirror .is-empty:before{content:attr(data-placeholder);color:var(--nk-text-tertiary);float:left;height:0;pointer-events:none}.nk-block-host .bn-container{font-family:var(--nk-font);color:var(--nk-text);background:transparent}.nk-block-host .bn-editor{padding:4px 2px}.nk-block-host .bn-block-content{font-size:14px;line-height:1.6}.nk-block-host .bn-side-menu{color:var(--nk-text-tertiary)}.nk-block-host .bn-drag-handle{border-radius:4px}.nk-block-host .bn-drag-handle:hover{background:var(--nk-bg-hover)}.nk-block-host .novel-editor{font-family:var(--nk-font);color:var(--nk-text)}.nk-block-host .novel-prose{max-width:none}.nk-slash-menu,.nk-block-host .bn-suggestion-menu,.nk-block-host .tippy-box{background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);padding:6px;width:280px;max-height:320px;overflow-y:auto;font-family:var(--nk-font);font-size:14px;color:var(--nk-text)}.nk-slash-menu-label{font-size:12px;color:var(--nk-text-tertiary);padding:6px 9px 2px}.nk-slash-item{display:flex;align-items:center;gap:10px;padding:6px 9px;border-radius:5px;cursor:pointer;user-select:none}.nk-slash-item:hover,.nk-slash-item.selected{background:var(--nk-bg-hover)}.nk-slash-item .m-icon,.nk-slash-item ::slotted(.m-icon){width:28px;height:28px;flex-shrink:0;border-radius:4px;background:var(--nk-bg-callout);border:1px solid var(--nk-border);display:flex;align-items:center;justify-content:center;font-size:15px}.nk-slash-item .m-desc{font-size:12px;color:var(--nk-text-tertiary)}.nk-bubble-menu{display:flex;align-items:center;gap:2px;background:var(--nk-bg);border-radius:8px;box-shadow:var(--nk-shadow-menu);padding:4px}.nk-bubble-menu button{font-family:inherit;font-size:13px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 8px;border-radius:5px;cursor:pointer}.nk-bubble-menu ::slotted(button){font-family:inherit;font-size:13px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 8px!important;border-radius:5px;cursor:pointer}.nk-bubble-menu button:hover,.nk-bubble-menu ::slotted(button:hover){background:var(--nk-bg-hover);color:var(--nk-text)}.nk-bubble-menu button.active,.nk-bubble-menu ::slotted(button.active){color:var(--nk-accent)}@media(max-width:860px){.nk-sidebar{display:none;position:fixed;inset:0 auto 0 0;z-index:60;transform:translate(-100%);transition:background .25s ease,transform .24s cubic-bezier(.2,.8,.25,1),display .24s allow-discrete}.nk-sidebar.open{display:flex;transform:none}@starting-style{.nk-sidebar.open{transform:translate(-100%)}}.nk-sidebar-backdrop{opacity:0;transition:opacity .24s ease,display .24s allow-discrete}.nk-sidebar-backdrop.open{display:block;opacity:1}@starting-style{.nk-sidebar-backdrop.open{opacity:0}}.nk-sidebar-toggle{display:inline-flex}.nk-tab-bar{display:flex}.nk-tab-bar.fixed+.nk-tab-bar-spacer{display:block}.nk-page{padding-left:max(24px,env(safe-area-inset-left,0px));padding-right:max(24px,env(safe-area-inset-right,0px));padding-bottom:80px}.nk-settings-nav{width:60px;min-width:60px}.nk-settings-nav .label,.nk-settings-nav .nk-section-label,.nk-settings-user .u-text{display:none}.nk-settings-content{padding:24px}.nk-cmdk-backdrop{padding-top:max(6vh,env(safe-area-inset-top,0px))}.nk-cmdk{width:min(560px,96vw)}.nk-stats{flex-wrap:wrap}.nk-breadcrumb{min-width:0}.nk-breadcrumb>.crumb:not(:last-child),.nk-breadcrumb ::slotted(.crumb:not(:last-child)),.nk-breadcrumb>.sep,.nk-breadcrumb ::slotted(.sep),.nk-topbar-meta,.nk-topbar-actions ::slotted(.nk-topbar-meta){display:none}.nk-breadcrumb>.crumb:last-child,.nk-breadcrumb ::slotted(.crumb:last-child){display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-topbar-actions{flex-shrink:0}.nk-field{flex-wrap:wrap;row-gap:6px}.nk-field .f-control,.nk-field ::slotted(.f-control){max-width:100%;min-width:0}.nk-input,.nk-select,.nk-textarea,.nk-slider{max-width:100%}.nk-prop{flex-direction:column;align-items:stretch}.nk-prop .p-name{flex:none;min-height:26px}.nk-prop .p-value{min-height:30px;padding:3px 6px 7px}.nk-pop.sheet{position:fixed!important;inset:auto 0 0!important;width:auto!important;transform:none!important;z-index:100;--_nk-row: 40px;max-height:85dvh;overflow-y:auto;overscroll-behavior:contain;border-radius:14px 14px 0 0;padding:6px max(8px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));box-shadow:0 0 0 100vmax var(--nk-scrim-soft),var(--nk-shadow-menu)}.nk-pop.sheet:before{content:"";display:block;width:36px;height:4px;margin:4px auto 8px;border-radius:2px;background:var(--nk-border-strong)}.nk-pop.sheet.floating{translate:0 100%;transition:opacity .2s ease,translate .25s cubic-bezier(.2,.8,.2,1),visibility 0s linear .25s}.nk-pop.sheet.floating.open{translate:0 0;transition:opacity .2s ease,translate .25s cubic-bezier(.2,.8,.2,1),visibility 0s}.nk-peek-backdrop{pointer-events:auto}.nk-peek-backdrop.open{background-color:var(--nk-scrim-soft)}@starting-style{.nk-peek-backdrop.open{background-color:transparent}}.nk-peek{--_nk-title: 28px;top:auto;left:0;width:auto;max-height:92dvh;border-radius:14px 14px 0 0;translate:0 100%}.nk-peek-backdrop.open .nk-peek{translate:0 0}@starting-style{.nk-peek-backdrop.open .nk-peek{translate:0 100%}}.nk-peek:before{content:"";flex:none;width:36px;height:4px;margin:10px auto 0;border-radius:2px;background:var(--nk-border-strong)}.nk-peek .pk-bar{height:40px;padding:0 max(8px,env(safe-area-inset-right,0px)) 0 max(8px,env(safe-area-inset-left,0px))}.nk-peek .pk-body{padding:0 max(20px,env(safe-area-inset-right,0px)) max(24px,env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px))}:root:has(.nk-tab-bar:not([hidden])) .nk-toast{bottom:calc(var(--nk-tab-bar-height) + max(6px,env(safe-area-inset-bottom,0px)) + 6px)}:root:has(.nk-tab-bar.floating:not([hidden])) .nk-toast{bottom:calc(var(--nk-tab-bar-height) + 24px + env(safe-area-inset-bottom,0px))}}@media(prefers-reduced-motion:reduce){.nk-skeleton{animation:none;background:var(--nk-bg-callout)}[class*=nk-],[class*=nk-]:before,[class*=nk-]:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}\n/*# sourceMappingURL=notionkit.min.css.map */\n',s=n+i,r=n+e+i;(new CSSStyleSheet).replaceSync(r);(new CSSStyleSheet).replaceSync(e);const o=new CSSStyleSheet;o.replaceSync(s);const a="__nkDefaultTokensInjected";!function(){if("undefined"==typeof document)return;if(globalThis[a])return;globalThis[a]=!0;const t=new CSSStyleSheet;t.replaceSync(`@layer notionkit-defaults { ${e} }`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}();const l=new Set;function h(){return document.documentElement.getAttribute("data-theme")||"light"}"undefined"!=typeof window&&"undefined"!=typeof MutationObserver&&new MutationObserver(function(){const t=h();for(const e of l)e._syncTheme(t)}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});const c=new Map;function d(t){let e=c.get(t);return e||(e=new CSSStyleSheet,e.replaceSync(`\n :host { display: ${t}; }\n :host([hidden]) { display: none; }\n .nk-wrapper { display: contents; }\n `),c.set(t,e)),e}class p extends HTMLElement{static get display(){return"contents"}static get hostStyles(){return null}static get observesLightDom(){return!1}static get lightDomObserverInit(){return{childList:!0,subtree:!0,characterData:!0,attributes:!0}}static get slotAssignment(){return"named"}static get observedAttributes(){return[]}constructor(){super(),this._initialized=!1,this._shadow=this.attachShadow({mode:"open",slotAssignment:this.constructor.slotAssignment});const t=[o,d(this.constructor.display)],e=this.constructor.hostStyles;e&&t.push(e),this._shadow.adoptedStyleSheets=t}connectedCallback(){this._initialized?this._wrapper.setAttribute("data-theme",h()):(this._upgradeOwnProperties(),this._initialized=!0,this._wrapper=document.createElement("div"),this._wrapper.className="nk-wrapper",this._wrapper.setAttribute("data-theme",h()),this._shadow.appendChild(this._wrapper),this.render()),this.setupEvents(),l.add(this),this.constructor.observesLightDom&&(this._lightDomObserver??=new MutationObserver(t=>this.projectLightDom(t)),this._lightDomObserver.observe(this,this.constructor.lightDomObserverInit)),"manual"===this.constructor.slotAssignment&&(this.assignSlots(),this._slotObserver??=new MutationObserver(()=>this.assignSlots()),this._slotObserver.observe(this,{childList:!0}))}disconnectedCallback(){l.delete(this),this._lightDomObserver?.disconnect(),this._slotObserver?.disconnect(),this.teardownEvents()}attributeChangedCallback(t,e,n){this._initialized&&e!==n&&this.onAttributeChanged(t,e,n)}_syncTheme(t){this._wrapper?.setAttribute("data-theme",t)}_upgradeOwnProperties(){for(const t of Object.keys(this)){if(t.startsWith("_"))continue;let e,n=Object.getPrototypeOf(this);for(;n&&n!==HTMLElement.prototype&&!(e=Object.getOwnPropertyDescriptor(n,t));)n=Object.getPrototypeOf(n);if(!e?.set)continue;const i=this[t];delete this[t],this[t]=i}}render(){}setupEvents(){}teardownEvents(){}onAttributeChanged(t,e,n){}projectLightDom(){}assignSlots(){}refresh(){this.projectLightDom(),"manual"===this.constructor.slotAssignment&&this.assignSlots()}takeTitle(t=this.getAttribute("title")){return null!==t&&(this._titleText=t,this.removeAttribute("title"),!0)}getBoolAttr(t){return this.hasAttribute(t)}setBoolAttr(t,e){e?this.setAttribute(t,""):this.removeAttribute(t)}createElement(t,e=[],n={}){const i=document.createElement(t);e.length&&i.classList.add(...e);for(const[t,e]of Object.entries(n))null!=e&&!1!==e&&i.setAttribute(t,!0===e?"":e);return i}emit(t,e=null){return this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,cancelable:!0,detail:e}))}}class u extends p{static formAssociated=!0;constructor(){super(),this._internals=this.attachInternals()}get form(){return this._internals.form}get validationMessage(){return this._internals.validationMessage}get validity(){return this._internals.validity}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}connectedCallback(){const t=!this._initialized;super.connectedCallback(),t&&this._formDisabled&&this.onFormDisabled(!0)}formResetCallback(){this.resetValue()}formStateRestoreCallback(t,e){this.restoreValue(t,e)}formDisabledCallback(t){this._formDisabled=t,this._initialized&&this.onFormDisabled(t)}resetValue(){}restoreValue(t,e){}onFormDisabled(t){}setFormValue(t,e){this._internals.setFormValue(t,e)}setValidity(t,e,n){this._internals.setValidity(t,e,n)}syncValidityFrom(t){t&&(t.validity.valid?this._internals.setValidity({}):this._internals.setValidity(t.validity,t.validationMessage,t))}}const b=["primary","secondary","danger","danger-solid","topbar","share"];class g extends p{static get observedAttributes(){return["variant","small","disabled","type","href","title","aria-label","aria-haspopup","active"]}render(){this._build()}_build(){const t=this.getAttribute("href"),e=t?this.createElement("a",[],{href:t}):this.createElement("button",[],{type:this.getAttribute("type")||"button"});e.className=this._computeClasses().join(" "),e.appendChild(document.createElement("slot")),this._applyState(e),this._btn?(this._btn.removeEventListener("click",this._onClick),this._btn.replaceWith(e)):this._wrapper.appendChild(e),this._btn=e,this._onClick&&e.addEventListener("click",this._onClick)}_applyState(t){const e=this.getBoolAttr("disabled");"BUTTON"===t.tagName?t.disabled=e:t.setAttribute("aria-disabled",e?"true":"false");const n=this.getAttribute("title");n?t.setAttribute("title",n):t.removeAttribute("title");for(const e of["aria-label","aria-haspopup"]){const n=this.getAttribute(e);n?t.setAttribute(e,n):t.removeAttribute(e)}"sidebar"===this.getAttribute("variant")?t.setAttribute("aria-expanded",this._sidebar()?.open?"true":"false"):t.removeAttribute("aria-expanded")}_sidebar(){return this.closest("nk-app")?.querySelector("nk-sidebar")??document.querySelector("nk-sidebar")}setupEvents(){this._onClick=t=>{if(this.getBoolAttr("disabled"))return t.preventDefault(),void t.stopPropagation();if("sidebar"===this.getAttribute("variant"))return void this._sidebar()?.toggle?.();const e=this.getAttribute("type");if("submit"===e||"reset"===e){const t=this.closest("form");t&&("submit"===e?t.requestSubmit():t.reset())}},this._onToggle=t=>{"sidebar"===this.getAttribute("variant")&&t.target===this._sidebar()&&this._btn.setAttribute("aria-expanded",t.detail.open?"true":"false")},this._btn.addEventListener("click",this._onClick),document.addEventListener("nk-toggle",this._onToggle)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),document.removeEventListener("nk-toggle",this._onToggle)}onAttributeChanged(t){if(this._btn)switch(t){case"href":this._build();break;case"variant":this._btn.className=this._computeClasses().join(" "),this._applyState(this._btn);break;case"small":case"active":this._btn.className=this._computeClasses().join(" ");break;case"type":"BUTTON"===this._btn.tagName&&this._btn.setAttribute("type",this.getAttribute("type")||"button");break;default:this._applyState(this._btn)}}_computeClasses(){const t=this.getAttribute("variant");if("topbar"===t)return["nk-topbar-btn"];if("share"===t)return["nk-topbar-btn","nk-share-btn"];if("sidebar"===t)return["nk-topbar-btn","nk-sidebar-toggle"];if("tool"===t)return this.getBoolAttr("active")?["nk-db-tool","active"]:["nk-db-tool"];const e=["nk-btn"];return b.includes(t)&&e.push(t),this.getBoolAttr("small")&&e.push("small"),e}focus(t){this._btn?.focus(t)}click(){this._btn?.click()}get variant(){return this.getAttribute("variant")}set variant(t){t?this.setAttribute("variant",t):this.removeAttribute("variant")}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get small(){return this.getBoolAttr("small")}set small(t){this.setBoolAttr("small",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get type(){return this.getAttribute("type")||"button"}set type(t){this.setAttribute("type",t)}get href(){return this.getAttribute("href")}set href(t){t?this.setAttribute("href",t):this.removeAttribute("href")}}customElements.define("nk-btn",g);const m=["type","placeholder","name","min","max","step","autocomplete","pattern","maxlength","minlength","inputmode","list","aria-label"],k=["required","disabled","readonly"];class _ extends u{static get observedAttributes(){return["value","wide",...m,...k]}render(){this._input=this.createElement("input",["nk-input"]);for(const t of m)this._forward(t);for(const t of k)this._forward(t);this._input.value=this.getAttribute("value")??"",this._defaultValue=this._input.value,this._syncWide(),this._wrapper.appendChild(this._input),this._syncFormValue()}_forward(t){if(k.includes(t))return void(this._input["readonly"===t?"readOnly":t]=this.getBoolAttr(t)||"disabled"===t&&!!this._formDisabled);const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}_syncWide(){this._input.classList.toggle("wide",this.getBoolAttr("wide"))}setupEvents(){this._onInput=()=>{this._syncFormValue(),this.emit("nk-input",{value:this._input.value,name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._input)return"value"===t?(this._input.value=this.getAttribute("value")??"",void this._syncFormValue()):void("wide"!==t?(this._forward(t),this._syncFormValue()):this._syncWide())}_syncFormValue(){this.setFormValue(this._input.value),this.syncValidityFrom(this._input)}resetValue(){this._input.value=this.getAttribute("value")??"",this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncFormValue())}onFormDisabled(t){this._input.disabled=t||this.getBoolAttr("disabled")}focus(t){this._input?.focus(t)}blur(){this._input?.blur()}select(){this._input?.select()}get value(){return this._input?.value??this.getAttribute("value")??""}set value(t){this._input?(this._input.value=t??"",this._syncFormValue()):this.setAttribute("value",t??"")}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get type(){return this.getAttribute("type")||"text"}set type(t){this.setAttribute("type",t)}get placeholder(){return this.getAttribute("placeholder")}set placeholder(t){this.setAttribute("placeholder",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get readonly(){return this.getBoolAttr("readonly")}set readonly(t){this.setBoolAttr("readonly",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-input",_);const v=["placeholder","name","rows","maxlength","minlength","autocomplete","aria-label"],x=["required","disabled","readonly"];class f extends u{static get observedAttributes(){return["value","wide",...v,...x]}render(){this._input=this.createElement("textarea",["nk-textarea"]);for(const t of[...v,...x])this._forward(t);this._input.value=this.getAttribute("value")??this.textContent.trim(),this._syncWide(),this._wrapper.appendChild(this._input),this._syncFormValue()}_forward(t){if(x.includes(t))return void(this._input["readonly"===t?"readOnly":t]=this.getBoolAttr(t)||"disabled"===t&&!!this._formDisabled);const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}_syncWide(){this._input.classList.toggle("wide",this.getBoolAttr("wide"))}setupEvents(){this._onInput=()=>{this._syncFormValue(),this.emit("nk-input",{value:this._input.value,name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._input)return"value"===t?(this._input.value=this.getAttribute("value")??"",void this._syncFormValue()):void("wide"!==t?(this._forward(t),this._syncFormValue()):this._syncWide())}_syncFormValue(){this.setFormValue(this._input.value),this.syncValidityFrom(this._input)}resetValue(){this._input.value=this.getAttribute("value")??this.textContent.trim(),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncFormValue())}onFormDisabled(t){this._input.disabled=t||this.getBoolAttr("disabled")}focus(t){this._input?.focus(t)}blur(){this._input?.blur()}get value(){return this._input?.value??this.getAttribute("value")??""}set value(t){this._input?(this._input.value=t??"",this._syncFormValue()):this.setAttribute("value",t??"")}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-textarea",f);class y extends u{static get observedAttributes(){return["value","name","disabled","required","compact","wide","aria-label"]}static get observesLightDom(){return!0}render(){this._select=this.createElement("select",["nk-select"]),this._forwardAll(),this._wrapper.appendChild(this._select),this._defaultValue=this.getAttribute("value"),this.projectLightDom(),requestAnimationFrame(()=>this.projectLightDom())}_forwardAll(){const t=this.getAttribute("name");t?this._select.setAttribute("name",t):this._select.removeAttribute("name");const e=this.getAttribute("aria-label");e?this._select.setAttribute("aria-label",e):this._select.removeAttribute("aria-label"),this._select.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._select.required=this.getBoolAttr("required"),this._select.classList.toggle("compact",this.getBoolAttr("compact")),this._select.classList.toggle("wide",this.getBoolAttr("wide"))}projectLightDom(){if(!this._select)return;const t=[...this.children].filter(t=>t.matches("option, optgroup")),e=t.map(t=>t.outerHTML).join("");if(e===this._optionSignature)return;this._optionSignature=e;const n=this._select.selectedIndex>=0?this._select.value:null;this._select.innerHTML="";for(const e of t)this._select.appendChild(e.cloneNode(!0));this._applyValue(n)||this._applyValue(this.getAttribute("value")),this._syncFormValue()}_applyValue(t){return null!==t&&(!![...this._select.options].some(e=>e.value===t)&&(this._select.value=t,!0))}setupEvents(){this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._select.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._select.addEventListener("change",this._onChange)}teardownEvents(){this._select?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._select){if("value"===t)return this._applyValue(this.getAttribute("value")),void this._syncFormValue();this._forwardAll(),this._syncFormValue()}}_syncFormValue(){this.setFormValue(this._select.value),this.syncValidityFrom(this._select)}resetValue(){this._applyValue(this._defaultValue)||(this._select.selectedIndex=0),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._applyValue(t),this._syncFormValue())}onFormDisabled(t){this._select.disabled=t||this.getBoolAttr("disabled")}focus(t){this._select?.focus(t)}get value(){return this._select?.value??""}set value(t){this._select?(this._select.value=t,this._syncFormValue()):this.setAttribute("value",t)}get selectedIndex(){return this._select?.selectedIndex??-1}get options(){return this._select?.options??[]}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get compact(){return this.getBoolAttr("compact")}set compact(t){this.setBoolAttr("compact",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-select",y);class w extends u{static get observedAttributes(){return["checked","disabled","name","value","label","text"]}render(){this._row=this.createElement("label",["nk-switch-label"]),this._btn=this.createElement("button",["nk-switch"],{type:"button",role:"switch"}),this._text=document.createElement("span"),this._slot=document.createElement("slot"),this._textNode=document.createTextNode(""),this._slot.appendChild(this._textNode),this._text.appendChild(this._slot),this._row.append(this._btn,this._text),this._defaultChecked=this.getBoolAttr("checked"),this._apply(),this._syncText(),this._wrapper.appendChild(this._row),this._syncFormValue()}_apply(){this._btn.setAttribute("aria-checked",this.getBoolAttr("checked")?"true":"false"),this._btn.disabled=this.getBoolAttr("disabled")||!!this._formDisabled;const t=this.getAttribute("label");t?this._btn.setAttribute("aria-label",t):this._btn.removeAttribute("aria-label")}_syncText(){this._textNode.data=this.getAttribute("text")??"";const t=!(!this.getAttribute("text")&&!this._slot.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.data.trim()));this._text.hidden=!t,this._row.style.display=t?"":"contents"}setupEvents(){this._onClick=()=>this.toggle(),this._onSlot=()=>this._syncText(),this._btn.addEventListener("click",this._onClick),this._slot.addEventListener("slotchange",this._onSlot),this._syncText()}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),this._slot?.removeEventListener("slotchange",this._onSlot)}toggle(){this.getBoolAttr("disabled")||this._formDisabled||(this.checked=!this.checked,this.emit("nk-change",{checked:this.checked,value:this.getAttribute("value")||"on",name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t){this._btn&&("text"!==t?(this._apply(),this._syncFormValue()):this._syncText())}_syncFormValue(){const t=this.getAttribute("value")||"on";this.setFormValue(this.getBoolAttr("checked")?t:null,this.getBoolAttr("checked")?"checked":"unchecked")}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._btn?.focus(t)}get checked(){return this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}}customElements.define("nk-switch",w);class A extends u{static get observedAttributes(){return["checked","disabled","name","value","text","indeterminate","required"]}render(){const t=this.createElement("label",["nk-check"]);this._input=this.createElement("input",[],{type:"checkbox"});const e=document.createElement("slot");this._text=document.createTextNode(""),e.appendChild(this._text),this._apply(),this._defaultChecked=this.getBoolAttr("checked"),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue()}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.indeterminate=this.getBoolAttr("indeterminate"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._input.required=this.getBoolAttr("required");const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"on",this._text&&(this._text.data=this.getAttribute("text")??"")}setupEvents(){this._onChange=()=>{this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this.removeAttribute("indeterminate"),this._syncing=!1,this._syncFormValue(),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(){!this._syncing&&this._input&&(this._apply(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.checked?this._input.value:null,this._input.checked?"checked":"unchecked"),this.syncValidityFrom(this._input)}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._input?.focus(t)}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get indeterminate(){return this.getBoolAttr("indeterminate")}set indeterminate(t){this.setBoolAttr("indeterminate",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}}customElements.define("nk-check",A);const E={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function C(t){return(void 0!==t.form?t.form:t.closest("form"))??null}function B(t){const e=t.filter(t=>!t.disabled);if(!e.length)return;const n=e.find(t=>t.checked)||e[0];for(const e of t)e._input&&(e._input.tabIndex=e===n?0:-1)}class L extends u{static get observedAttributes(){return["checked","disabled","name","value","text","required"]}render(){const t=this.createElement("label",["nk-check"]);this._input=this.createElement("input",[],{type:"radio"});const e=document.createElement("slot");this._text=document.createTextNode(""),e.appendChild(this._text),this._apply(),this._defaultChecked=this.getBoolAttr("checked"),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue(),this._input.checked&&this._uncheckPeers(),B(this._group())}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._input.required=this.getBoolAttr("required");const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"",this._text&&(this._text.data=this.getAttribute("text")??"")}setupEvents(){this._onChange=()=>this._applyChange(),this._onKeyDown=t=>{const e=E[t.key];if(!e||t.ctrlKey||t.metaKey||t.altKey)return;const n=this._group().filter(t=>!t.disabled);if(n.length<2)return;t.preventDefault();const i=n[(n.indexOf(this)+e+n.length)%n.length];i._input.focus(),i._input.checked=!0,i._applyChange()},this._input.addEventListener("change",this._onChange),this._input.addEventListener("keydown",this._onKeyDown),B(this._group())}teardownEvents(){this._input?.removeEventListener("change",this._onChange),this._input?.removeEventListener("keydown",this._onKeyDown)}_applyChange(){this._input.checked&&this._uncheckPeers(),this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this._syncing=!1,this._syncFormValue(),B(this._group()),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))}_group(){const t=this.getAttribute("name"),e=this.getRootNode();if(!t||"function"!=typeof e?.querySelectorAll)return[this];const n=C(this);return[...e.querySelectorAll("nk-radio")].filter(e=>e.getAttribute("name")===t&&C(e)===n)}_uncheckPeers(){for(const t of this._group())t!==this&&t.checked&&(t.checked=!1)}onAttributeChanged(t){!this._syncing&&this._input&&(this._apply(),"checked"===t&&this._input.checked&&this._uncheckPeers(),this._syncFormValue(),B(this._group()))}_syncFormValue(){const t=this.getAttribute("value")||"";this.setFormValue(this._input.checked?t:null,this._input.checked?"checked":"unchecked"),this.syncValidityFrom(this._input)}resetValue(){this._input.checked=this._defaultChecked,this.setBoolAttr("checked",this._defaultChecked),this._syncFormValue(),B(this._group())}restoreValue(t){"checked"===t&&(this.checked=!0)}onFormDisabled(t){this._formDisabled=t,this._apply(),B(this._group())}focus(t){this._input?.focus(t)}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this._input&&(this._input.checked=t),t&&this._uncheckPeers(),this.setBoolAttr("checked",t),this._input&&(this._syncFormValue(),B(this._group()))}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}customElements.define("nk-radio",L);const S=["name","min","max","step","aria-label"];class z extends u{static get observedAttributes(){return["value","disabled","show-value","unit",...S]}render(){this._input=this.createElement("input",["nk-slider"],{type:"range"}),this._out=this.createElement("div",["nk-slider-value"]),this._apply(),this._input.value=this.getAttribute("value")??this._input.value,this._defaultValue=this._input.value,this._wrapper.appendChild(this._input),this._wrapper.appendChild(this._out),this._syncOut(),this._syncFormValue()}_apply(){for(const t of S){const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._out.style.display=this.getBoolAttr("show-value")?"":"none"}_syncOut(){this._out.textContent=`${this._input.value}${this.getAttribute("unit")||""}`}setupEvents(){this._onInput=()=>{this._syncOut(),this._syncFormValue(),this.emit("nk-input",{value:Number(this._input.value),name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:Number(this._input.value),name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){this._input&&("value"===t?this._input.value=this.getAttribute("value")??"":this._apply(),this._syncOut(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.value)}resetValue(){this._input.value=this._defaultValue,this._syncOut(),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncOut(),this._syncFormValue())}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._input?.focus(t)}get value(){return Number(this._input?.value??this.getAttribute("value"))}set value(t){this._input?(this._input.value=t,this._syncOut(),this._syncFormValue()):this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get showValue(){return this.getBoolAttr("show-value")}set showValue(t){this.setBoolAttr("show-value",t)}}customElements.define("nk-slider",z);const N=["nk-input","nk-textarea","nk-select"];class T extends p{static get observedAttributes(){return["label","desc","stacked","compact"]}render(){this._field=this.createElement("div",["nk-field"]);const t=document.createElement("div");this._label=this.createElement("div",["f-label"]);const e=this.createElement("slot",[],{name:"label"});e.appendChild(this._label),this._desc=this.createElement("div",["f-desc"]);const n=this.createElement("slot",[],{name:"desc"});n.appendChild(this._desc),t.appendChild(e),t.appendChild(n);const i=this.createElement("div",["f-control"]);this._slot=document.createElement("slot"),i.appendChild(this._slot),this._field.appendChild(t),this._field.appendChild(i),this._wrapper.appendChild(this._field),this._widened=new Set,this._sync()}setupEvents(){this._onSlot=()=>this._syncWide(),this._slot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(){this._sync()}get stacked(){return this.getBoolAttr("stacked")||!!this.closest("nk-fields")}set stacked(t){this.setBoolAttr("stacked",t)}get compact(){return this.getBoolAttr("compact")||!!this.closest("nk-fields")}set compact(t){this.setBoolAttr("compact",t)}_sync(){if(!this._label)return;this._label.textContent=this.getAttribute("label")||"";const t=this.getAttribute("desc");this._desc.textContent=t||"",this._desc.style.display=t?"":"none",this._field.classList.toggle("stacked",this.stacked),this._field.classList.toggle("compact",this.compact),this._syncWide()}_syncWide(){if(!this._slot)return;const t=this.stacked;for(const e of this._slot.assignedElements())N.includes(e.localName)&&(t&&!e.hasAttribute("wide")?(e.setAttribute("wide",""),this._widened.add(e)):!t&&this._widened.has(e)&&(e.removeAttribute("wide"),this._widened.delete(e)))}get label(){return this.getAttribute("label")}set label(t){this.setAttribute("label",t)}get desc(){return this.getAttribute("desc")}set desc(t){null==t?this.removeAttribute("desc"):this.setAttribute("desc",t)}}customElements.define("nk-field",T);class D extends p{render(){const t=this.createElement("div",["nk-fields"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-fields",D);const V=["gray","brown","orange","yellow","green","blue","purple","pink","red"];class F extends p{static get observedAttributes(){return["color"]}render(){this._tag=this.createElement("span",this._computeClasses()),this._tag.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._tag)}onAttributeChanged(){this._tag&&(this._tag.className=this._computeClasses().join(" "))}_computeClasses(){const t=["nk-tag"],e=this.getAttribute("color");return V.includes(e)&&t.push(e),t}get color(){return this.getAttribute("color")}set color(t){t?this.setAttribute("color",t):this.removeAttribute("color")}}customElements.define("nk-tag",F);class M extends p{static get observedAttributes(){return["value","max","label","wide"]}render(){this._bar=this.createElement("span",["nk-progress"],{role:"progressbar"}),this._fill=document.createElement("i"),this._bar.appendChild(this._fill),this._label=this.createElement("span",["nk-progress-label"]),this._wrapper.appendChild(this._bar),this._wrapper.appendChild(this._label),this._sync()}onAttributeChanged(){this._sync()}_sync(){if(!this._bar)return;const t=Number(this.getAttribute("max"))||100,e=Math.min(t,Math.max(0,Number(this.getAttribute("value"))||0));this._fill.style.width=e/t*100+"%",this._bar.classList.toggle("wide",this.getBoolAttr("wide")),this._bar.setAttribute("aria-valuenow",e),this._bar.setAttribute("aria-valuemin",0),this._bar.setAttribute("aria-valuemax",t);const n=this.getAttribute("label");this._label.textContent=n??"",this._label.style.display=null===n?"none":""}get value(){return Number(this.getAttribute("value"))||0}set value(t){this.setAttribute("value",t)}get max(){return Number(this.getAttribute("max"))||100}set max(t){this.setAttribute("max",t)}get label(){return this.getAttribute("label")}set label(t){null==t?this.removeAttribute("label"):this.setAttribute("label",t)}}customElements.define("nk-progress",M);class q extends p{static get observedAttributes(){return["icon"]}render(){this._box=this.createElement("div",["nk-callout"]),this._icon=this.createElement("span",["c-icon"]);const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon);const e=document.createElement("div");e.appendChild(document.createElement("slot")),this._box.appendChild(t),this._box.appendChild(e),this._wrapper.appendChild(this._box),this._syncIcon()}onAttributeChanged(){this._syncIcon()}_syncIcon(){this._icon&&(this._icon.textContent=this.getAttribute("icon")||"๐ก")}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}}customElements.define("nk-callout",q);class j extends p{render(){this._wrapper.appendChild(this.createElement("hr",["nk-divider"]))}}customElements.define("nk-divider",j);class I extends p{static get observedAttributes(){return["level"]}render(){this._build()}_build(){const t=Math.min(4,Math.max(1,Number(this.getAttribute("level"))||2)),e=this.createElement(`h${t}`,["nk-heading"]);e.appendChild(document.createElement("slot")),this._heading?this._heading.replaceWith(e):this._wrapper.appendChild(e),this._heading=e}onAttributeChanged(){this._build()}get level(){return Number(this.getAttribute("level"))||2}set level(t){this.setAttribute("level",t)}}customElements.define("nk-heading",I);class O extends p{static get observedAttributes(){return["label","open"]}render(){this._details=this.createElement("details",["nk-toggle"]);const t=document.createElement("summary");this._label=document.createElement("span");const e=this.createElement("slot",[],{name:"label"});e.appendChild(this._label),t.appendChild(e);const n=this.createElement("div",["toggle-body"]);n.appendChild(document.createElement("slot")),this._details.appendChild(t),this._details.appendChild(n),this._details.open=this.getBoolAttr("open"),this._wrapper.appendChild(this._details),this._sync()}setupEvents(){this._onToggle=()=>{this._syncing=!0,this.setBoolAttr("open",this._details.open),this._syncing=!1,this.emit("nk-toggle",{open:this._details.open})},this._details.addEventListener("toggle",this._onToggle)}teardownEvents(){this._details?.removeEventListener("toggle",this._onToggle)}onAttributeChanged(t){this._details&&("open"!==t?this._sync():this._syncing||(this._details.open=this.getBoolAttr("open")))}_sync(){this._label.textContent=this.getAttribute("label")||""}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get label(){return this.getAttribute("label")}set label(t){this.setAttribute("label",t)}}customElements.define("nk-toggle",O);class K extends u{static get observedAttributes(){return["checked","disabled","name","value"]}render(){const t=this.createElement("label",["nk-todo"]);this._input=this.createElement("input",[],{type:"checkbox"}),this._apply(),this._defaultChecked=this.getBoolAttr("checked");const e=document.createElement("span");e.appendChild(document.createElement("slot")),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue()}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled;const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"on"}setupEvents(){this._onChange=()=>{this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this._syncing=!1,this._syncFormValue(),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(){!this._syncing&&this._input&&(this._apply(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.checked?this._input.value:null,this._input.checked?"checked":"unchecked")}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}}customElements.define("nk-todo",K);class P extends p{render(){const t=this.createElement("kbd",["nk-kbd"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-kbd",P);class R extends p{static get observedAttributes(){return["lang","highlight"]}static get observesLightDom(){return!0}render(){this._box=this.createElement("div",["nk-code"]),this._lang=this.createElement("span",["lang"]),this._slot=document.createElement("slot"),this._pre=this.createElement("span",["hl"]),this._box.appendChild(this._lang),this._box.appendChild(this._slot),this._box.appendChild(this._pre),this._wrapper.appendChild(this._box),this._sync(),this.projectLightDom()}onAttributeChanged(){this._sync(),this.projectLightDom()}_sync(){if(!this._lang)return;const t=this.getAttribute("lang");this._lang.textContent=t||"",this._lang.style.display=t?"":"none"}projectLightDom(){if(!this._pre)return;const t=this.hasAttribute("highlight");if(this._slot.style.display=t?"none":"",this._pre.style.display=t?"":"none",!t)return;const e=this.textContent.replace(/^\n/,"");var n;e!==this._lastText&&(this._lastText=e,this._pre.innerHTML=(n=e,n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")).replace(/<(\/?)([a-zA-Z][\w-]*)([^&]*?)(\/?)>/g,(t,e,n,i,s)=>`<${e}<span class="tag">${n}</span>${i.replace(/([\w-]+)(=)("[^"]*"|'[^']*')?/g,(t,e,n,i)=>`<span class="attr">${e}</span>${n}${i??""}`)}${s}>`))}get lang(){return this.getAttribute("lang")}set lang(t){null==t?this.removeAttribute("lang"):this.setAttribute("lang",t)}}customElements.define("nk-code",R);class $ extends p{static get observedAttributes(){return["cite"]}render(){this._quote=this.createElement("blockquote",["nk-quote"]),this._quote.appendChild(document.createElement("slot")),this._cite=this.createElement("cite",["q-cite"]),this._quote.appendChild(this._cite),this._wrapper.appendChild(this._quote),this._sync()}onAttributeChanged(){this._sync()}_sync(){if(!this._cite)return;const t=this.getAttribute("cite");this._cite.textContent=t||"",this._cite.style.display=t?"":"none"}get cite(){return this.getAttribute("cite")}set cite(t){null==t?this.removeAttribute("cite"):this.setAttribute("cite",t)}}customElements.define("nk-quote",$);class U extends p{render(){const t=this.createElement("div",["nk-app"]);t.appendChild(this.createElement("slot",[],{name:"sidebar"}));const e=this.createElement("main",["nk-main"]);e.appendChild(document.createElement("slot")),t.appendChild(e),this._wrapper.appendChild(t)}}customElements.define("nk-app",U);class W extends p{static get observedAttributes(){return["open"]}render(){this._backdrop=this.createElement("div",["nk-sidebar-backdrop"]),this._aside=this.createElement("aside",["nk-sidebar"]),this._aside.appendChild(this.createElement("slot",[],{name:"workspace"}));const t=this.createElement("div",["nk-sidebar-scroll"]);t.appendChild(document.createElement("slot")),this._aside.appendChild(t),this._footer=this.createElement("div",["nk-sidebar-footer"]),this._footerSlot=this.createElement("slot",[],{name:"footer"}),this._footer.appendChild(this._footerSlot),this._aside.appendChild(this._footer),this._wrapper.appendChild(this._backdrop),this._wrapper.appendChild(this._aside),this._syncFooter(),this._syncOpen()}_syncOpen(){const t=this.getBoolAttr("open");this._aside.classList.toggle("open",t),this._backdrop.classList.toggle("open",t)}_syncFooter(){const t=this._footerSlot.assignedElements();this._footer.style.display=t.length?"":"none";for(const e of t)"nk-tree-item"===e.localName&&e.setAttribute("compact","")}setupEvents(){this._onSlot=()=>this._syncFooter(),this._onBackdrop=()=>this.close(),this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._footerSlot.addEventListener("slotchange",this._onSlot),this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey)}teardownEvents(){this._footerSlot?.removeEventListener("slotchange",this._onSlot),this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey)}onAttributeChanged(t){"open"===t&&(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")}))}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}}customElements.define("nk-sidebar",W);const H=new CSSStyleSheet;H.replaceSync("\n .nk-ws-anchor { position: relative; }\n .nk-ws-menu { display: none; position: absolute; left: 8px; top: calc(100% - 2px); z-index: 50; }\n :host([open]) .nk-ws-menu { display: block; }\n");class G extends p{static get hostStyles(){return H}static get observedAttributes(){return["name","avatar","open"]}render(){this._row=this.createElement("div",["nk-workspace"],{role:"button",tabindex:"0","aria-haspopup":"menu"}),this._avatar=this.createElement("div",["avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar),this._name=document.createElement("span");const e=this.createElement("span",["chev"]);e.textContent="โ",this._row.append(t,this._name,e),this._menu=this.createElement("div",["nk-ws-menu"]),this._menu.appendChild(this.createElement("slot",[],{name:"menu"}));const n=this.createElement("div",["nk-ws-anchor"]);n.append(this._row,this._menu),this._wrapper.appendChild(n),this._sync()}_sync(){const t=this.getAttribute("name")||"";this._name.textContent=t,this._avatar.textContent=this.getAttribute("avatar")||t.trim().charAt(0).toUpperCase(),this._row.setAttribute("aria-expanded",this.getBoolAttr("open")?"true":"false")}setupEvents(){this._onClick=()=>this.toggle(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.toggle())},this._onDocClick=t=>{this.getBoolAttr("open")&&!t.composedPath().includes(this)&&this.close()},this._onDocKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onMenuSelect=()=>this.close(),this._row.addEventListener("click",this._onClick),this._row.addEventListener("keydown",this._onKey),this._menu.addEventListener("nk-select",this._onMenuSelect),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onDocKey)}teardownEvents(){this._row?.removeEventListener("click",this._onClick),this._row?.removeEventListener("keydown",this._onKey),this._menu?.removeEventListener("nk-select",this._onMenuSelect),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onDocKey)}onAttributeChanged(t){this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open")})}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}}customElements.define("nk-workspace-switcher",G);class Q extends p{static get observedAttributes(){return["label","addable"]}render(){this._box=this.createElement("div",["nk-section-label"]),this._text=document.createElement("span"),this._text.appendChild(document.createElement("slot")),this._plus=this.createElement("span",["plus"],{role:"button",title:"+"}),this._plus.textContent="๏ผ",this._box.append(this._text,this._plus),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t=this.getAttribute("label");null!==t&&(this._text.textContent=t),this._plus.style.display=this.getBoolAttr("addable")?"":"none"}setupEvents(){this._onPlus=t=>{t.stopPropagation(),this.emit("nk-action",{action:"add"})},this._plus.addEventListener("click",this._onPlus)}teardownEvents(){this._plus?.removeEventListener("click",this._onPlus)}onAttributeChanged(){this._sync()}get addable(){return this.getBoolAttr("addable")}set addable(t){this.setBoolAttr("addable",t)}}customElements.define("nk-section-label",Q);const Y=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]);class Z extends p{static get observedAttributes(){return["manual"]}render(){const t=this.createElement("div",[],{role:"tree"});t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._box=t}setActive(t){if(!this.getBoolAttr("manual")){for(const e of this.querySelectorAll("nk-tree-item[active]"))e!==t&&e.removeAttribute("active");t.setAttribute("active",""),this._syncTabIndex(t)}}setupEvents(){this._onKey=t=>{if(!Y.has(t.key)||t.ctrlKey||t.metaKey||t.altKey)return;const e=t.target.closest?.("nk-tree-item");if(!e)return;const n=this.visibleItems(),i=n.indexOf(e);if(i<0)return;let s=null;switch(t.key){case"ArrowDown":s=n[i+1];break;case"ArrowUp":s=n[i-1];break;case"Home":s=n[0];break;case"End":s=n[n.length-1];break;case"ArrowRight":e.hasChildren&&!e.open?e.open=!0:e.hasChildren&&(s=e.querySelector("nk-tree-item"));break;case"ArrowLeft":e.hasChildren&&e.open?e.open=!1:s=e.parentElement?.closest("nk-tree-item")}t.preventDefault(),s&&(this._syncTabIndex(s),s.focus())},this._onSlot=()=>this._syncTabIndex(),this.addEventListener("keydown",this._onKey),this._box.querySelector("slot").addEventListener("slotchange",this._onSlot),this._syncTabIndex()}teardownEvents(){this.removeEventListener("keydown",this._onKey),this._box?.querySelector("slot").removeEventListener("slotchange",this._onSlot)}visibleItems(){return[...this.querySelectorAll("nk-tree-item")].filter(t=>{for(let e=t.parentElement?.closest("nk-tree-item");e&&this.contains(e);e=e.parentElement?.closest("nk-tree-item"))if(!e.open)return!1;return!0})}requestSync(){this._syncQueued||(this._syncQueued=!0,queueMicrotask(()=>{this._syncQueued=!1,this._syncTabIndex()}))}_syncTabIndex(t){const e=[...this.querySelectorAll("nk-tree-item")];if(!e.length)return;const n=this.visibleItems(),i=t||n.find(t=>t.active)||n[0];for(const t of e)t.setTabbable?.(t===i)}set data(t){this._data=t;const e=t=>t.map(t=>{const n=document.createElement("nk-tree-item");return t.icon&&n.setAttribute("icon",t.icon),null!=t.value&&n.setAttribute("value",t.value),t.href&&n.setAttribute("href",t.href),t.open&&n.setAttribute("open",""),t.active&&n.setAttribute("active",""),n.append(document.createTextNode(t.label??""),...e(t.children||[])),n});for(const t of this.querySelectorAll(":scope > nk-tree-item"))t.remove();this.append(...e(t||[]))}get data(){return this._data}get activeItem(){return this.querySelector("nk-tree-item[active]")}get value(){return this.activeItem?.value??null}}customElements.define("nk-tree",Z);class X extends p{static get slotAssignment(){return"manual"}static get observedAttributes(){return["label","icon","value","href","active","open","compact","no-actions"]}render(){this._row=this.createElement("div",["nk-tree-item"],{role:"treeitem",tabindex:"-1"}),this._arrow=this.createElement("span",["nk-toggle-arrow"],{"aria-hidden":"true"}),this._arrow.textContent="โธ",this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._icon=this.createElement("span",["icon"]),this._iconSlot.appendChild(this._icon),this._label=this.createElement("span",["label"]),this._labelSlot=this.createElement("slot",[],{name:"label"}),this._labelText=document.createTextNode(""),this._labelSlot.appendChild(this._labelText),this._label.appendChild(this._labelSlot),this._actions=this.createElement("span",["actions"]);for(const[t,e,n]of[["add","๏ผ","Add"],["more","โฏ","More"]]){const i=this.createElement("span",[],{"data-action":t,role:"button",title:n});i.textContent=e,this._actions.appendChild(i)}this._endSlot=this.createElement("slot",[],{name:"end"}),this._row.append(this._arrow,this._iconSlot,this._label,this._actions,this._endSlot),this._children=this.createElement("div",["nk-tree-children"],{role:"group"}),this._childSlot=this.createElement("slot",[],{name:"children"}),this._children.appendChild(this._childSlot),this._wrapper.append(this._row,this._children),this._sync(),this.closest("nk-tree")?.requestSync?.()}assignSlots(){if(!this._row)return;const t=[],e=[],n=[],i=[];for(const s of this.childNodes)if(s.nodeType===Node.ELEMENT_NODE){const r=s.getAttribute("slot");"icon"===r?t.push(s):"end"===r?e.push(s):"nk-tree-item"===s.localName?n.push(s):i.push(s)}else s.nodeType===Node.TEXT_NODE&&s.data.trim()&&i.push(s);this._iconSlot.assign(...t),this._endSlot.assign(...e),this._childSlot.assign(...n),this._labelSlot.assign(...this.hasAttribute("label")?[]:i),this._hasChildren=n.length>0,this._hasEnd=e.length>0,this._sync()}_sync(){const t=this.getBoolAttr("active"),e=this.getBoolAttr("open");this._row.classList.toggle("active",t),this._row.classList.toggle("compact",this.getBoolAttr("compact")),this._row.setAttribute("aria-selected",t?"true":"false"),this._arrow.classList.toggle("open",e),this._arrow.style.display=this._hasChildren?"":"none",this._hasChildren?this._row.setAttribute("aria-expanded",e?"true":"false"):this._row.removeAttribute("aria-expanded"),this._children.classList.toggle("collapsed",!e||!this._hasChildren),this._icon.textContent=this.getAttribute("icon")||"",this._icon.style.display=this.getAttribute("icon")?"":"none",this._labelText.data=this.getAttribute("label")||"";const n=!this.getBoolAttr("no-actions")&&!this._hasEnd;n&&!this._actions.isConnected&&this._row.insertBefore(this._actions,this._endSlot),!n&&this._actions.isConnected&&this._actions.remove();const i=this.getAttribute("href");i?this._row.setAttribute("data-href",i):this._row.removeAttribute("data-href")}setupEvents(){this._onRowClick=t=>{const e=t.target.closest?.("[data-action]");return e?(t.stopPropagation(),void this.emit("nk-action",{action:e.dataset.action,value:this.value,label:this.label})):t.target===this._arrow||this._arrow.contains(t.target)?(t.stopPropagation(),void this.toggle()):void this.select()},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._row.addEventListener("click",this._onRowClick),this._row.addEventListener("keydown",this._onKey)}teardownEvents(){this._row?.removeEventListener("click",this._onRowClick),this._row?.removeEventListener("keydown",this._onKey)}onAttributeChanged(t){"label"===t?this.assignSlots():this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open"),value:this.value})}select(){if(!this.emit("nk-select",{value:this.value,label:this.label,href:this.getAttribute("href"),item:this}))return;const t=this.closest("nk-tree");t?t.setActive(this):this.setBoolAttr("active",!0),this.getAttribute("href")&&location.assign(this.getAttribute("href"))}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}focus(t){this._row?.focus(t)}setTabbable(t){this._row&&(this._row.tabIndex=t?0:-1)}get tabbable(){return 0===this._row?.tabIndex}get hasChildren(){return!!this._hasChildren}get label(){return this.getAttribute("label")??this._labelSlot?.assignedNodes().map(t=>t.textContent).join("").trim()??""}set label(t){this.setAttribute("label",t)}get value(){return this.getAttribute("value")??this.label}set value(t){this.setAttribute("value",t)}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get compact(){return this.getBoolAttr("compact")}set compact(t){this.setBoolAttr("compact",t)}}customElements.define("nk-tree-item",X);class J extends p{render(){const t=this.createElement("div",["nk-topbar"]);t.appendChild(document.createElement("slot"));const e=this.createElement("div",["nk-topbar-actions"]);e.appendChild(this.createElement("slot",[],{name:"actions"})),t.appendChild(e),this._wrapper.appendChild(t)}}customElements.define("nk-topbar",J);class tt extends p{static get observedAttributes(){return["separator"]}static get observesLightDom(){return!0}render(){this._nav=this.createElement("nav",["nk-breadcrumb"],{"aria-label":"Breadcrumb"}),this._wrapper.appendChild(this._nav),this.projectLightDom()}projectLightDom(){if(!this._nav)return;const t=[...this.children],e=this.getAttribute("separator")??"/",n=t.map(t=>t.outerHTML).join("")+e;if(n===this._signature)return;this._signature=n,this._nav.innerHTML="";const i=t.some(t=>t.hasAttribute("current")||t.classList.contains("current"));t.forEach((n,s)=>{if(s>0){const t=this.createElement("span",["sep"],{"aria-hidden":"true"});t.textContent=e,this._nav.appendChild(t)}const r=n.cloneNode(!0);r.removeAttribute("slot"),r.classList.add("crumb");const o=i?n.hasAttribute("current")||n.classList.contains("current"):s===t.length-1;r.classList.toggle("current",o),o&&r.setAttribute("aria-current","page"),r.dataset.index=s,this._nav.appendChild(r)})}setupEvents(){this._onClick=t=>{const e=t.target.closest(".crumb");if(!e)return;t.preventDefault();const n=Number(e.dataset.index),i=this.children[n];this.emit("nk-select",{index:n,label:e.textContent.trim(),href:i?.getAttribute("href")??null,value:i?.dataset.value??i?.getAttribute("href")??e.textContent.trim(),current:e.classList.contains("current")})&&i?.click()},this._nav.addEventListener("click",this._onClick)}teardownEvents(){this._nav?.removeEventListener("click",this._onClick)}onAttributeChanged(){this.projectLightDom()}get separator(){return this.getAttribute("separator")??"/"}set separator(t){this.setAttribute("separator",t)}}customElements.define("nk-breadcrumb",tt);class et extends p{static get observedAttributes(){return["storage-key","title"]}render(){this._btn=this.createElement("button",["nk-topbar-btn","nk-theme-toggle"],{type:"button"}),this._btn.title=this.getAttribute("title")||"Toggle light / dark",this._wrapper.appendChild(this._btn);const t=document.documentElement;let e=null;try{e=localStorage.getItem(this.storageKey)}catch{}"light"===e||"dark"===e?t.setAttribute("data-theme",e):t.hasAttribute("data-theme")||t.setAttribute("data-theme",matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),this._syncGlyph()}_syncGlyph(){this._btn&&(this._btn.textContent="dark"===h()?"โ๏ธ":"๐")}_syncTheme(t){super._syncTheme(t),this._syncGlyph()}setupEvents(){this._onClick=()=>this.apply("dark"===h()?"light":"dark"),this._onMessage=t=>{const e=t.data?.nkTheme;"light"!==e&&"dark"!==e||this.apply(e)},this._btn.addEventListener("click",this._onClick),window.addEventListener("message",this._onMessage)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),window.removeEventListener("message",this._onMessage)}onAttributeChanged(t){"title"===t&&this._btn&&(this._btn.title=this.getAttribute("title")||"Toggle light / dark")}apply(t){document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem(this.storageKey,t)}catch{}this._syncGlyph(),this.emit("nk-change",{value:t})}get storageKey(){return this.getAttribute("storage-key")||"nk-theme"}get value(){return h()}set value(t){this.apply(t)}}customElements.define("nk-theme-toggle",et);class nt extends p{static get observedAttributes(){return["value","always","fixed","floating","label"]}render(){this._bar=this.createElement("nav",["nk-tab-bar"]),this._slot=document.createElement("slot"),this._bar.appendChild(this._slot),this._spacer=this.createElement("div",["nk-tab-bar-spacer"]),this._wrapper.append(this._bar,this._spacer),this._syncBar(),this._sync()}get items(){return[...this.querySelectorAll(":scope > nk-tab-bar-item")]}_valueOf(t){return t.getAttribute("value")??t.getAttribute("label")??t.textContent.trim()}_syncBar(){this._bar.classList.toggle("always",this.getBoolAttr("always")),this._bar.classList.toggle("fixed",this.getBoolAttr("fixed")),this._bar.classList.toggle("floating",this.getBoolAttr("floating"));const t=this.getAttribute("label");t?this._bar.setAttribute("aria-label",t):this._bar.removeAttribute("aria-label")}_sync(){const t=this.items.filter(t=>!t.hasAttribute("drawer"));if(!t.length)return;let e=this.getAttribute("value");if(null===e||!t.some(t=>this._valueOf(t)===e)){const n=t.find(t=>t.hasAttribute("active"))||t[0];e=this._valueOf(n)}for(const n of t)this._valueOf(n)===e?n.setAttribute("active",""):n.removeAttribute("active");this._value=e}setupEvents(){this._onSlot=()=>this._sync(),this._slot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){if("value"!==t)return void this._syncBar();const e=this._value;this._sync(),this._value!==e&&this.emit("nk-change",{value:this._value})}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get always(){return this.getBoolAttr("always")}set always(t){this.setBoolAttr("always",t)}get fixed(){return this.getBoolAttr("fixed")}set fixed(t){this.setBoolAttr("fixed",t)}get floating(){return this.getBoolAttr("floating")}set floating(t){this.setBoolAttr("floating",t)}}customElements.define("nk-tab-bar",nt);class it extends p{static get observedAttributes(){return["icon","label","value","href","active","disabled","drawer"]}render(){this._btn=this.createElement("button",["nk-tab-bar-item"],{type:"button"}),this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._icon=this.createElement("span",["icon"],{"aria-hidden":"true"}),this._iconSlot.appendChild(this._icon),this._label=this.createElement("span",["label"]),this._labelSlot=document.createElement("slot"),this._labelText=document.createTextNode(""),this._labelSlot.appendChild(this._labelText),this._label.appendChild(this._labelSlot),this._btn.append(this._iconSlot,this._label),this._wrapper.appendChild(this._btn),this._sync()}_sync(){this._icon.textContent=this.getAttribute("icon")??"",this._labelText.data=this.getAttribute("label")??"";const t=this.getBoolAttr("active");this._btn.classList.toggle("active",t),t?this._btn.setAttribute("aria-current","page"):this._btn.removeAttribute("aria-current"),this._btn.disabled=this.getBoolAttr("disabled");const e=this.getAttribute("href");e?this._btn.setAttribute("data-href",e):this._btn.removeAttribute("data-href")}setupEvents(){this._onClick=()=>this.select(),this._btn.addEventListener("click",this._onClick)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick)}select(){if(this.getBoolAttr("disabled"))return;const t=this.getAttribute("href");if(!this.emit("nk-select",{value:this.value,label:this.label,href:t,item:this,drawer:this.getBoolAttr("drawer")}))return;if(this.getBoolAttr("drawer")){const t=this.closest("nk-app")?.querySelector("nk-sidebar")??document.querySelector("nk-sidebar");return void t?.toggle?.()}const e=this.closest("nk-tab-bar");e?e.value=this.value:this.setBoolAttr("active",!0),t&&location.assign(t)}onAttributeChanged(){this._sync()}focus(t){this._btn?.focus(t)}get value(){return this.getAttribute("value")??this.label}set value(t){this.setAttribute("value",t)}get label(){return this.getAttribute("label")??this.textContent.trim()}set label(t){this.setAttribute("label",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get drawer(){return this.getBoolAttr("drawer")}set drawer(t){this.setBoolAttr("drawer",t)}}customElements.define("nk-tab-bar-item",it);class st extends p{static get observedAttributes(){return["icon","cover","narrow","full","small"]}render(){this._page=this.createElement("div",["nk-page"]),this._icon=this.createElement("div",["nk-page-icon"],{role:"button",title:"Change icon"});const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon),this._page.appendChild(t),this._page.appendChild(document.createElement("slot")),this._cover=this.createElement("div",["nk-cover"]),this._coverSlot=this.createElement("slot",[],{name:"cover"}),this._coverSlot.appendChild(this._cover),this._build()}_build(){if(this._wrapper.replaceChildren(),this.getBoolAttr("narrow"))this._wrapper.append(this._coverSlot,this._page);else{const t=this.createElement("div",["nk-page-scroll"]);t.append(this._coverSlot,this._page),this._wrapper.appendChild(t)}this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none",this._cover.style.display=this.getBoolAttr("cover")?"":"none";const e=this._coverSlot.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.data.trim());this._page.classList.toggle("covered",this.getBoolAttr("cover")||e),this._page.classList.toggle("full",this.getBoolAttr("full")),this._page.classList.toggle("small",this.getBoolAttr("small"))}setupEvents(){this._onIcon=()=>this.emit("nk-action",{action:"icon",value:this.getAttribute("icon")}),this._onCover=()=>this._sync(),this._icon.addEventListener("click",this._onIcon),this._coverSlot.addEventListener("slotchange",this._onCover),this._sync()}teardownEvents(){this._icon?.removeEventListener("click",this._onIcon),this._coverSlot?.removeEventListener("slotchange",this._onCover)}onAttributeChanged(t){"narrow"===t?this._build():this._sync()}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get cover(){return this.getBoolAttr("cover")}set cover(t){this.setBoolAttr("cover",t)}get full(){return this.getBoolAttr("full")}set full(t){this.setBoolAttr("full",t)}get small(){return this.getBoolAttr("small")}set small(t){this.setBoolAttr("small",t)}}customElements.define("nk-page",st);class rt extends p{static get observedAttributes(){return["src","position"]}render(){this._cover=this.createElement("div",["nk-cover"]),this._img=this.createElement("img",[],{alt:""}),this._wrapper.appendChild(this._cover),this._sync()}_sync(){const t=this.getAttribute("src");t?(this._img.src=t,this._img.style.objectPosition=this.getAttribute("position")||"",this._img.isConnected||this._cover.appendChild(this._img)):this._img.remove()}onAttributeChanged(){this._sync()}get src(){return this.getAttribute("src")}set src(t){null==t?this.removeAttribute("src"):this.setAttribute("src",t)}}customElements.define("nk-page-cover",rt);class ot extends p{static get observedAttributes(){return["editable","placeholder","value"]}static get observesLightDom(){return!0}render(){this._h1=this.createElement("h1",["nk-page-title"]),this._slot=document.createElement("slot"),this._h1.appendChild(this._slot),this._wrapper.appendChild(this._h1),this._sync()}_sync(){if(this.getBoolAttr("editable")){this._slot.isConnected&&this._slot.remove(),this._h1.setAttribute("contenteditable","plaintext-only"),this._h1.setAttribute("spellcheck","false"),this._h1.setAttribute("role","textbox"),this._h1.setAttribute("aria-label","Title");const t=this.getAttribute("value")??this.textContent.trim();this._h1.textContent!==t&&document.activeElement!==this&&(this._h1.textContent=t),this._h1.setAttribute("data-placeholder",this.getAttribute("placeholder")||"")}else this._h1.removeAttribute("contenteditable"),this._h1.removeAttribute("role"),this.hasAttribute("value")?(this._slot.isConnected&&this._slot.remove(),this._h1.textContent=this.getAttribute("value")):this._slot.isConnected||(this._h1.textContent="",this._h1.appendChild(this._slot))}projectLightDom(){this._h1&&!this.hasAttribute("value")&&this._sync()}setupEvents(){this._committed=this.value,this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this._h1.blur())},this._onBlur=()=>this._commit(),this._h1.addEventListener("keydown",this._onKey),this._h1.addEventListener("blur",this._onBlur)}teardownEvents(){this._h1?.removeEventListener("keydown",this._onKey),this._h1?.removeEventListener("blur",this._onBlur)}_commit(){const t=this._h1.textContent.trim();t!==this._committed&&(this._committed=t,this.emit("nk-change",{value:t}))}onAttributeChanged(){this._sync()}get value(){return this.getBoolAttr("editable")?this._h1?.textContent.trim()??"":this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}get editable(){return this.getBoolAttr("editable")}set editable(t){this.setBoolAttr("editable",t)}focus(t){this._h1?.focus(t)}}customElements.define("nk-page-title",ot);class at extends p{render(){const t=this.createElement("div",["nk-page-meta"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-page-actions",at);class lt extends p{static get observedAttributes(){return["handle","drop-target"]}render(){this._box=this.createElement("div",["nk-block-host"]),this._handle=this.createElement("span",["nk-block-handle"],{"aria-hidden":"true"}),this._handle.textContent="โ ฟ",this._box.appendChild(this._handle),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box),this._sync()}_sync(){this._handle.style.display=this.getBoolAttr("handle")?"":"none",this._box.classList.toggle("nk-drop-target",this.getBoolAttr("drop-target"))}onAttributeChanged(){this._sync()}get handle(){return this.getBoolAttr("handle")}set handle(t){this.setBoolAttr("handle",t)}get dropTarget(){return this.getBoolAttr("drop-target")}set dropTarget(t){this.setBoolAttr("drop-target",t)}}customElements.define("nk-block-host",lt);const ht=["info","success","warning","danger"];class ct extends p{static get observedAttributes(){return["variant"]}render(){this._box=this.createElement("div",this._classes(),{role:"status"}),this._box.appendChild(document.createElement("slot")),this._box.appendChild(this.createElement("slot",[],{name:"action"})),this._wrapper.appendChild(this._box)}_classes(){const t=this.getAttribute("variant");return["nk-banner",...ht.includes(t)?[t]:[]]}onAttributeChanged(){this._box&&(this._box.className=this._classes().join(" "))}get variant(){return this.getAttribute("variant")}set variant(t){t?this.setAttribute("variant",t):this.removeAttribute("variant")}}customElements.define("nk-banner",ct);class dt extends p{static get observedAttributes(){return["icon","title","desc"]}render(){const t=this.createElement("div",["nk-empty"]);this._parts={};for(const[e,n]of[["icon","e-icon"],["title","e-title"],["desc","e-desc"]]){const i=this.createElement("div",[n]),s=this.createElement("slot",[],{name:e});s.appendChild(i),t.appendChild(s),this._parts[e]=i}const e=this.createElement("div",["e-actions"]);e.appendChild(document.createElement("slot")),t.appendChild(e),this._wrapper.appendChild(t),this.takeTitle(),this._sync()}_sync(){for(const[t,e]of Object.entries(this._parts)){const n="title"===t?this._titleText:this.getAttribute(t);e.textContent=n||"",e.style.display=n?"":"none"}}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&this._sync()}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}}customElements.define("nk-empty",dt);class pt extends p{static get observedAttributes(){return["lines","height","width","widths"]}render(){this._build()}_build(){this._wrapper.replaceChildren();const t=Math.max(1,Number(this.getAttribute("lines"))||1),e=this.getAttribute("height")||"13",n=(this.getAttribute("widths")||"").split(",").map(t=>t.trim()).filter(Boolean),i=this.getAttribute("width");for(let s=0;s<t;s++){const t=this.createElement("div",["nk-skeleton"],{"aria-hidden":"true"});t.style.height=/^\d+(\.\d+)?$/.test(e)?`${e}px`:e;const r=n[s]??i;r&&(t.style.width=r),this._wrapper.appendChild(t)}}onAttributeChanged(){this._build()}}customElements.define("nk-skeleton",pt);class ut extends p{static get observedAttributes(){return["badge"]}render(){const t=this.createElement("div",["nk-synced"]);this._badge=this.createElement("span",["synced-badge"]),t.appendChild(this._badge),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._sync()}_sync(){this._badge.textContent=this.getAttribute("badge")??"โณ synced"}onAttributeChanged(){this._sync()}get badge(){return this.getAttribute("badge")}set badge(t){this.setAttribute("badge",t)}}customElements.define("nk-synced",ut);const bt={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};class gt extends p{static get observedAttributes(){return["value"]}render(){this._strip=this.createElement("div",["nk-tabs"],{role:"tablist"}),this._tabSlot=document.createElement("slot"),this._strip.appendChild(this._tabSlot),this._panelSlot=this.createElement("slot",[],{name:"panel"}),this._wrapper.append(this._strip,this._panelSlot),this._sync()}get tabs(){return[...this.querySelectorAll(":scope > nk-tab")]}get panels(){return[...this.querySelectorAll(':scope > [slot="panel"]')]}_sync(){const t=this.tabs;if(!t.length)return;let e=this.getAttribute("value");if(null===e||!t.some(t=>t.getAttribute("value")===e||null===t.getAttribute("value")&&t.textContent.trim()===e)){const n=t.find(t=>t.hasAttribute("active"))||t[0];e=n.getAttribute("value")??n.textContent.trim()}for(const n of t){(n.getAttribute("value")??n.textContent.trim())===e?n.setAttribute("active",""):n.removeAttribute("active")}for(const t of this.panels)t.hidden=t.dataset.tab!==e;this._value=e}setupEvents(){this._onSlot=()=>this._sync(),this._onKey=t=>{const e=bt[t.key];if(!e)return;const n=this.tabs.filter(t=>!t.hasAttribute("disabled")),i=n.indexOf(t.target.closest?.("nk-tab"));if(i<0||n.length<2)return;t.preventDefault();const s=n[(i+e+n.length)%n.length];s.select(),s.focus()},this._tabSlot.addEventListener("slotchange",this._onSlot),this._panelSlot.addEventListener("slotchange",this._onSlot),this.addEventListener("keydown",this._onKey),this._sync()}teardownEvents(){this._tabSlot?.removeEventListener("slotchange",this._onSlot),this._panelSlot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("keydown",this._onKey)}onAttributeChanged(){const t=this._value;this._sync(),this._value!==t&&this.emit("nk-change",{value:this._value})}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-tabs",gt);class mt extends p{static get observedAttributes(){return["active","value","disabled"]}render(){this._tab=this.createElement("span",["nk-tab"],{role:"tab"}),this._tab.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._tab),this._sync()}_sync(){const t=this.getBoolAttr("active");this._tab.classList.toggle("active",t),this._tab.setAttribute("aria-selected",t?"true":"false"),this._tab.tabIndex=t?0:-1,this._tab.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false")}setupEvents(){this._onClick=()=>this.select(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._tab.addEventListener("click",this._onClick),this._tab.addEventListener("keydown",this._onKey)}teardownEvents(){this._tab?.removeEventListener("click",this._onClick),this._tab?.removeEventListener("keydown",this._onKey)}select(){if(this.getBoolAttr("disabled"))return;if(!this.emit("nk-select",{value:this.value,label:this.textContent.trim(),item:this}))return;const t=this.closest("nk-tabs");t?t.value=this.value:this.setBoolAttr("active",!0)}onAttributeChanged(){this._sync()}focus(t){this._tab?.focus(t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}}customElements.define("nk-tab",mt);const kt={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};class _t extends u{static get observedAttributes(){return["value","name","disabled","scroll","wrap"]}render(){this._box=this.createElement("div",["nk-segmented"],{role:"radiogroup"}),this._slot=document.createElement("slot"),this._box.appendChild(this._slot),this._wrapper.appendChild(this._box),this._syncBox(),this._sync()}_syncBox(){this._box.classList.toggle("scroll",this.getBoolAttr("scroll")),this._box.classList.toggle("wrap",this.getBoolAttr("wrap"))}get buttons(){return this._slot?.assignedElements().filter(t=>"button"===t.localName)??[]}_valueOf(t){return t.getAttribute("value")??t.textContent.trim()}_sync(){const t=this.buttons;if(!t.length)return;let e=this.getAttribute("value");null!==e&&t.some(t=>this._valueOf(t)===e)||(e=this._valueOf(t.find(t=>t.classList.contains("active"))||t[0])),void 0===this._defaultValue&&(this._defaultValue=e);const n=this.getBoolAttr("disabled")||!!this._formDisabled;for(const i of t){const t=this._valueOf(i)===e;i.type="button",i.setAttribute("role","radio"),i.setAttribute("aria-checked",t?"true":"false"),i.classList.toggle("active",t),i.tabIndex=t?0:-1,i.disabled=n}this._value=e,this.setFormValue(e),this._reveal(this._revealed?"smooth":"instant")}_reveal(t){if(!this.getBoolAttr("scroll")||!this._box?.clientWidth)return;const e=this.buttons.find(t=>t.classList.contains("active"));if(!e)return;const n=this._box.getBoundingClientRect(),i=e.getBoundingClientRect(),s=i.left<n.left?i.left-n.left-8:i.right>n.right?i.right-n.right+8:0,r="smooth"===t&&!matchMedia("(prefers-reduced-motion: reduce)").matches;s&&this._box.scrollBy({left:s,behavior:r?"smooth":"instant"}),this._revealed=!0}setupEvents(){this._onSlot=()=>this._sync(),this._onClick=t=>{const e=t.target.closest?.("button");e&&this.buttons.includes(e)&&!e.disabled&&this._choose(this._valueOf(e))},this._onKey=t=>{const e=kt[t.key];if(!e)return;const n=this.buttons,i=n.indexOf(t.target.closest?.("button"));if(i<0||n.length<2)return;t.preventDefault();const s=n[(i+e+n.length)%n.length];this._choose(this._valueOf(s)),s.focus()},this._slot.addEventListener("slotchange",this._onSlot),this.addEventListener("click",this._onClick),this.addEventListener("keydown",this._onKey),this._resize=new ResizeObserver(()=>this._reveal("instant")),this._resize.observe(this._box),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("click",this._onClick),this.removeEventListener("keydown",this._onKey),this._resize?.disconnect()}_choose(t){t!==this._value&&(this._syncing=!0,this.setAttribute("value",t),this._syncing=!1,this._sync(),this.emit("nk-change",{value:t,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t){"scroll"!==t&&"wrap"!==t?this._syncing||this._sync():this._syncBox()}resetValue(){void 0!==this._defaultValue&&this.setAttribute("value",this._defaultValue)}onFormDisabled(t){this._formDisabled=t,this._sync()}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get scroll(){return this.getBoolAttr("scroll")}set scroll(t){this.setBoolAttr("scroll",t)}get wrap(){return this.getBoolAttr("wrap")}set wrap(t){this.setBoolAttr("wrap",t)}}customElements.define("nk-segmented",_t);class vt extends p{render(){const t=this.createElement("div",["nk-stats"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-stats",vt);class xt extends p{static get observedAttributes(){return["label","value","delta","trend"]}render(){const t=this.createElement("div",["nk-stat"]);this._parts={};for(const[e,n]of[["label","s-label"],["value","s-value"],["delta","s-delta"]]){const i=this.createElement("div",[n]),s=this.createElement("slot",[],{name:e});s.appendChild(i),t.appendChild(s),this._parts[e]=i}this._wrapper.appendChild(t),this._sync()}_sync(){for(const[t,e]of Object.entries(this._parts)){const n=this.getAttribute(t);e.textContent=n??"",e.style.display=null===n?"none":""}const t=this.getAttribute("trend");this._parts.delta.className="s-delta"+("up"===t||"down"===t?` ${t}`:"")}onAttributeChanged(){this._sync()}get value(){return this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-stat",xt);class ft extends p{static get observedAttributes(){return["more"]}render(){const t=this.createElement("div",["nk-avatar-group"]);t.appendChild(document.createElement("slot")),this._more=this.createElement("span",["mini-avatar","more"]),t.appendChild(this._more),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("more");this._more.textContent=t||"",this._more.style.display=t?"":"none"}onAttributeChanged(){this._sync()}get more(){return this.getAttribute("more")}set more(t){null==t?this.removeAttribute("more"):this.setAttribute("more",t)}}customElements.define("nk-avatar-group",ft);const yt=["gray","brown","orange","yellow","green","blue","purple","pink","red"];function wt(t,e){for(const n of yt)t.classList.toggle(n,n===e);t.style.background=e&&!yt.includes(e)?e:""}const At=t=>String(t||"").split(/\s+/).map(t=>t[0]).filter(Boolean).join("").slice(0,2).toUpperCase();class Et extends p{static get observedAttributes(){return["size","color","square","src","name"]}render(){this._box=this.createElement("span",["nk-avatar"]),this._slot=document.createElement("slot"),this._initials=document.createTextNode(""),this._slot.appendChild(this._initials),this._img=this.createElement("img",[],{alt:""}),this._box.appendChild(this._slot),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t=this.getAttribute("size");for(const e of["small","large","xlarge"])this._box.classList.toggle(e,e===t);this._box.classList.toggle("square",this.getBoolAttr("square")),wt(this._box,this.getAttribute("color"));const e=this.getAttribute("name");this._initials.data=At(e);const n=this.getAttribute("src");n?(this._img.src=n,this._img.alt=e||"",this._slot.isConnected&&this._slot.replaceWith(this._img)):this._img.isConnected&&this._img.replaceWith(this._slot),e&&!n?(this._box.setAttribute("role","img"),this._box.setAttribute("aria-label",e)):(this._box.removeAttribute("role"),this._box.removeAttribute("aria-label"))}onAttributeChanged(){this._sync()}get size(){return this.getAttribute("size")}set size(t){null==t?this.removeAttribute("size"):this.setAttribute("size",t)}get color(){return this.getAttribute("color")}set color(t){null==t?this.removeAttribute("color"):this.setAttribute("color",t)}get src(){return this.getAttribute("src")}set src(t){null==t?this.removeAttribute("src"):this.setAttribute("src",t)}}customElements.define("nk-avatar",Et);const Ct=["person","page","date"];class Bt extends p{static get observedAttributes(){return["type"]}render(){this._box=this.createElement("span",this._classes()),this._box.appendChild(this.createElement("slot",[],{name:"avatar"})),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box)}_classes(){const t=this.getAttribute("type");return["nk-mention",...Ct.includes(t)?[t]:[]]}onAttributeChanged(){this._box&&(this._box.className=this._classes().join(" "))}get type(){return this.getAttribute("type")}set type(t){t?this.setAttribute("type",t):this.removeAttribute("type")}}customElements.define("nk-mention",Bt);class Lt extends p{static get observedAttributes(){return["icon","value","disabled"]}render(){this._btn=this.createElement("button",["nk-template-btn"],{type:"button"});const t=document.createElement("span");this._icon=document.createElement("span"),this._space=document.createTextNode(" "),t.append(this._icon,this._space,document.createElement("slot")),this._btn.appendChild(t),this._wrapper.appendChild(this._btn),this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._space.data=t?" ":"",this._btn.disabled=this.getBoolAttr("disabled")}setupEvents(){this._onClick=()=>this.emit("nk-select",{value:this.value,label:this.textContent.trim()}),this._btn.addEventListener("click",this._onClick)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}focus(t){this._btn?.focus(t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}}customElements.define("nk-template-btn",Lt);class St extends u{static get observedAttributes(){return["name","value","title","desc","selected","disabled"]}render(){this._card=this.createElement("div",["nk-model-card"],{role:"radio",tabindex:"0"}),this._card.appendChild(this.createElement("div",["m-radio"]));const t=document.createElement("div");this._name=this.createElement("div",["m-name"]);const e=this.createElement("slot",[],{name:"title"});e.appendChild(this._name),this._desc=this.createElement("div",["m-desc"]);const n=this.createElement("slot",[],{name:"desc"});n.appendChild(this._desc),t.append(e,n),this._card.appendChild(t),this._wrapper.appendChild(this._card),this._defaultSelected=this.getBoolAttr("selected"),this.takeTitle(),this._sync(),this.getBoolAttr("selected")&&this._unselectPeers()}_sync(){const t=this.getBoolAttr("selected");this._card.classList.toggle("selected",t),this._card.setAttribute("aria-checked",t?"true":"false"),this._card.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false"),this._name.textContent=this._titleText||"";const e=this.getAttribute("desc");this._desc.textContent=e||"",this._desc.style.display=e?"":"none",this.setFormValue(t?this.getAttribute("value")||"on":null,t?"selected":"unselected")}_group(){const t=this.getAttribute("name"),e=this.getRootNode();return t&&"function"==typeof e?.querySelectorAll?[...e.querySelectorAll("nk-model-card")].filter(e=>e.getAttribute("name")===t):[this]}_unselectPeers(){for(const t of this._group())t!==this&&t.hasAttribute("selected")&&t.removeAttribute("selected")}setupEvents(){this._onClick=()=>this.select(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._card.addEventListener("click",this._onClick),this._card.addEventListener("keydown",this._onKey)}teardownEvents(){this._card?.removeEventListener("click",this._onClick),this._card?.removeEventListener("keydown",this._onKey)}select(){this.getBoolAttr("disabled")||this.getBoolAttr("selected")||(this.setBoolAttr("selected",!0),this.emit("nk-change",{value:this.value,name:this.name,checked:!0}),this.emit("nk-select",{value:this.value,label:this.title}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&(this._sync(),"selected"===t&&this.getBoolAttr("selected")&&this._unselectPeers())}resetValue(){this.setBoolAttr("selected",this._defaultSelected)}focus(t){this._card?.focus(t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get selected(){return this.getBoolAttr("selected")}set selected(t){this.setBoolAttr("selected",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}}customElements.define("nk-model-card",St);class zt extends p{static get observedAttributes(){return["avatar"]}render(){const t=this.createElement("div",["nk-profile-row"]);this._avatar=this.createElement("div",["big-avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar),t.appendChild(e),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._sync()}_sync(){this._avatar.textContent=this.getAttribute("avatar")||""}onAttributeChanged(){this._sync()}}customElements.define("nk-profile-row",zt);class Nt extends p{static get observedAttributes(){return["title"]}render(){const t=this.createElement("div",["nk-danger-zone"]);this._titleEl=this.createElement("div",["dz-title"]),t.appendChild(this._titleEl),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this.takeTitle(),this._sync()}_sync(){const t=this._titleText;this._titleEl.textContent=t||"",this._titleEl.style.display=t?"":"none"}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&this._sync()}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}}customElements.define("nk-danger-zone",Nt);class Tt extends p{render(){const t=this.createElement("div",["nk-member-list"]);this._slot=document.createElement("slot"),t.appendChild(this._slot),this._wrapper.appendChild(t),this._mark()}_mark(){const t=this._slot.assignedElements().filter(t=>"nk-member-row"===t.localName);t.forEach((e,n)=>{n===t.length-1?e.setAttribute("last",""):e.removeAttribute("last")})}setupEvents(){this._onSlot=()=>this._mark(),this._slot.addEventListener("slotchange",this._onSlot),this._mark()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}}customElements.define("nk-member-list",Tt);class Dt extends p{static get observedAttributes(){return["name","mail","avatar","color","last"]}render(){this._row=this.createElement("div",["nk-member-row"]),this._avatar=this.createElement("span",["nk-avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar);const e=document.createElement("div");this._name=document.createTextNode(""),this._mail=this.createElement("div",["m-mail"]),e.append(this._name,this._mail);const n=document.createElement("div");n.style.marginLeft="auto",n.appendChild(this.createElement("slot",[],{name:"role"})),this._row.append(t,e,n,document.createElement("slot")),this._wrapper.appendChild(this._row),this._sync()}_sync(){this._name.data=this.getAttribute("name")||"";const t=this.getAttribute("mail");this._mail.textContent=t||"",this._mail.style.display=t?"":"none";const e=this.getAttribute("avatar");this._avatar.textContent=e||At(this.getAttribute("name")),wt(this._avatar,this.getAttribute("color")),this._row.classList.toggle("last",this.getBoolAttr("last"))}onAttributeChanged(){this._sync()}}customElements.define("nk-member-row",Dt);class Vt extends p{render(){const t=this.createElement("dl",["nk-props"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-props",Vt);class Ft extends p{static get observedAttributes(){return["label","icon"]}render(){this._row=this.createElement("div",["nk-prop"]),this._name=this.createElement("dt",["p-name"]),this._icon=this.createElement("span",["p-icon"]);const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon),this._label=document.createTextNode(""),this._name.append(t,this._label),this._value=this.createElement("dd",["p-value"]),this._value.appendChild(document.createElement("slot")),this._row.append(this._name,this._value),this._wrapper.appendChild(this._row),this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none",this._label.data=this.getAttribute("label")||""}setupEvents(){this._onClick=t=>{const e=t.composedPath().includes(this._name)?"name":"value";this.emit("nk-action",{action:e,label:this.label})},this._row.addEventListener("click",this._onClick)}teardownEvents(){this._row?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}get label(){return this.getAttribute("label")||""}set label(t){this.setAttribute("label",t)}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}}customElements.define("nk-prop",Ft);class Mt extends p{render(){const t=this.createElement("div",["nk-panels"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-panels",Mt);class qt extends p{static get observedAttributes(){return["title","icon","cover","href","target"]}render(){this._cover=this.createElement("div",["nk-cover"]),this._img=this.createElement("img",[],{alt:""}),this._icon=this.createElement("div",["nk-page-icon"]),this._heading=document.createElement("h3"),this._slot=document.createElement("slot"),this.takeTitle(),this._build()}_build(){const t=this.getAttribute("href"),e=this.createElement(t?"a":"div",["nk-panel"]);e.append(this._cover,this._icon,this._heading,this._slot),this._wrapper.replaceChildren(e),this._box=e,this._sync()}_sync(){const t=this.getAttribute("href");t&&(this._box.setAttribute("href",t),this._box.target=this.getAttribute("target")||"");const e=this.getAttribute("cover");this._cover.style.display=null===e?"none":"",e?(this._img.src=e,this._img.isConnected||this._cover.appendChild(this._img)):this._img.remove();const n=this.getAttribute("icon");this._icon.textContent=n||"",this._icon.style.display=n?"":"none",this._heading.textContent=this._titleText||"",this._heading.style.display=this._titleText?"":"none"}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&("href"!==t||null===n==("div"===this._box.localName)?this._sync():this._build())}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get href(){return this.getAttribute("href")}set href(t){null==t?this.removeAttribute("href"):this.setAttribute("href",t)}}customElements.define("nk-panel",qt);let jt=0,It="";function Ot(){0===jt++&&(It=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function Kt(){jt>0&&0===--jt&&(document.documentElement.style.overflow=It)}function Pt(t){const e=[];let n=t;for(;n&&n!==document.body;){const t=(n.parentNode,ShadowRoot,n.parentNode);if(!t)break;for(const i of t.children)i===n||i.inert||/^(SCRIPT|STYLE|LINK|TEMPLATE)$/.test(i.tagName)||(i.inert=!0,e.push(i));n=t instanceof ShadowRoot?t.host:t}return()=>{for(const t of e)t.inert=!1}}function Rt(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function $t(t){const e=t=>{for(const n of t.querySelectorAll("*")){if(n.matches('a[href], button:not([disabled]), input:not([disabled]):not([type=hidden]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable="true"], [contenteditable="plaintext-only"]')&&n.getClientRects().length)return n;if(n.shadowRoot){const t=e(n.shadowRoot);if(t)return t}}return null};return e(t)}class Ut extends p{static get observedAttributes(){return["open","title"]}render(){this.takeTitle(),this._backdrop=this.createElement("div",["nk-sheet-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-sheet"],{role:"dialog","aria-modal":"true",tabindex:"-1"}),this._heading=this.createElement("div",["sh-title"],{id:"title"}),this._box.append(this.createElement("div",["sh-grabber"]),this._heading,document.createElement("slot")),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncTitle(),this._syncOpen()}_syncTitle(){const t=this._titleText||"";this._heading.textContent=t,this._heading.hidden=!t,t?this._box.setAttribute("aria-labelledby","title"):this._box.removeAttribute("aria-labelledby")}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=Rt(),Ot(),this._undoInert=Pt(this),requestAnimationFrame(()=>($t(this)||this._box).focus({preventScroll:!0}));else{Kt(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey)}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey),this._wasOpen&&(Kt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t,e,n){"title"!==t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this.takeTitle(n)&&this._syncTitle()}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._syncTitle()}}customElements.define("nk-sheet",Ut);class Wt extends p{static get observedAttributes(){return["steps","current","label"]}render(){this._list=this.createElement("ol",["nk-steps"]),this._wrapper.appendChild(this._list),this._sync()}_items(){return this._steps?this._steps:(this.getAttribute("steps")||"").split(",").map(t=>t.trim()).filter(Boolean)}_sync(){const t=this.getAttribute("label");t?this._list.setAttribute("aria-label",t):this._list.removeAttribute("aria-label");const e=this.current;this._list.replaceChildren(...this._items().map((t,n)=>{const i=n+1,{label:s,desc:r}="object"==typeof t&&t?t:{label:String(t)},o=this.createElement("li",["nk-step"]);o.classList.toggle("done",i<e),o.classList.toggle("current",i===e),i===e&&o.setAttribute("aria-current","step");const a=this.createElement("span",["st-mark"],{"aria-hidden":"true"});a.textContent=i<e?"โ":String(i);const l=document.createElement("span");if(l.textContent=s??"",r){const t=this.createElement("span",["st-desc"]);t.textContent=r,l.appendChild(t)}return o.append(a,l),o}))}onAttributeChanged(){this._sync()}get steps(){return this._items()}set steps(t){this._steps=Array.isArray(t)?t:null,this._list&&this._sync()}get current(){const t=parseInt(this.getAttribute("current"),10);return Number.isFinite(t)?t:1}set current(t){this.setAttribute("current",String(t))}next(){return this.current=Math.min(this.current+1,this._items().length+1),this.current}}customElements.define("nk-steps",Wt);class Ht extends p{static get observedAttributes(){return["href","title","desc","favicon","cover","target","url"]}render(){this.takeTitle(),this._a=this.createElement("a",["nk-bookmark"]),this._wrapper.appendChild(this._a),this._sync()}_sync(){if(!this._a)return;const t=this.getAttribute("href")||"";this._a.setAttribute("href",t);const e=this.getAttribute("target")||"_blank";this._a.setAttribute("target",e),"_blank"===e?this._a.setAttribute("rel","noopener"):this._a.removeAttribute("rel");let n=t;try{n=new URL(t,location.href).host}catch{}const i=this.createElement("span",["bm-text"]),s=this.createElement("span",["bm-title"]);s.textContent=this._titleText||n,i.appendChild(s);const r=this.getAttribute("desc");if(r){const t=this.createElement("span",["bm-desc"]);t.textContent=r,i.appendChild(t)}const o=this.createElement("span",["bm-url"]),a=this.getAttribute("favicon");a&&o.appendChild(this.createElement("img",["bm-favicon"],{src:a,alt:""}));const l=document.createElement("span");l.textContent=this.getAttribute("url")||t,o.appendChild(l),i.appendChild(o);const h=[i],c=this.getAttribute("cover");if(c){const t=this.createElement("span",["bm-cover"]);t.appendChild(this.createElement("img",[],{src:c,alt:""})),h.push(t)}this._a.replaceChildren(...h)}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&this._sync()}focus(t){this._a?.focus(t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._sync()}get href(){return this.getAttribute("href")||""}set href(t){this.setAttribute("href",t)}}customElements.define("nk-bookmark",Ht);class Gt extends p{static get observedAttributes(){return["value","mono","wrap","wide","secret","copy-label","copied-label","show-label","hide-label"]}render(){this._val??=this.getAttribute("value")??"",this._box=this.createElement("div",["nk-copy-field"]),this._text=this.createElement("span",["cf-value"]),this._show=this.createElement("button",["cf-btn"],{type:"button"}),this._copy=this.createElement("button",["cf-btn"],{type:"button"}),this._box.append(this._text,this._copy),this._wrapper.appendChild(this._box),this._sync()}_sync(){if(!this._box)return;for(const t of["mono","wrap","wide"])this._box.classList.toggle(t,this.getBoolAttr(t));const t=this.getBoolAttr("secret");this._text.textContent=t&&!this._revealed?"โข".repeat(Math.min(this._val.length,24)):this._val,t&&!this._show.isConnected&&this._copy.before(this._show),t||this._show.remove(),this._show.textContent=this._revealed?this.getAttribute("hide-label")||"Hide":this.getAttribute("show-label")||"Show",this._show.setAttribute("aria-pressed",String(!!this._revealed)),this._copy.textContent=this._copied?this.getAttribute("copied-label")||"Copied":this.getAttribute("copy-label")||"Copy",this._copy.classList.toggle("copied",!!this._copied)}setupEvents(){this._onCopy=()=>this.copy(),this._onShow=()=>{this._revealed=!this._revealed,this._sync()},this._copy.addEventListener("click",this._onCopy),this._show.addEventListener("click",this._onShow)}teardownEvents(){this._copy?.removeEventListener("click",this._onCopy),this._show?.removeEventListener("click",this._onShow),clearTimeout(this._timer)}onAttributeChanged(t,e,n){"value"===t&&(this._val=n??""),this._sync()}async copy(){const t=this._val;let e=!0;try{await navigator.clipboard.writeText(t)}catch{e=!1}return e?(this._copied=!0,clearTimeout(this._timer),this._timer=setTimeout(()=>{this._copied=!1,this._sync()},1500)):this._revealed=!0,this._sync(),e||getSelection()?.selectAllChildren(this._text),this.emit("nk-action",{action:"copy",value:t,ok:e}),e}get value(){return this._val??this.getAttribute("value")??""}set value(t){this._val=null==t?"":String(t),this._sync()}get secret(){return this.getBoolAttr("secret")}set secret(t){this.setBoolAttr("secret",t)}}function Qt(t){const e=t.slice(t.indexOf(",")+1),n=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(3*e.length/4)-n}customElements.define("nk-copy-field",Gt);class Yt extends p{static get observedAttributes(){return["src","initials","square","label","max","type","quality","accept","choose-label","change-label","remove-label"]}render(){this._src??=this.getAttribute("src")||"",this._row=this.createElement("div",["nk-profile-row"],{role:"group"}),this._avatar=this.createElement("div",["big-avatar"]);const t=this.createElement("div",["pr-actions"]);this._choose=this.createElement("button",["nk-btn","secondary","small"],{type:"button"}),this._remove=this.createElement("button",["nk-btn","secondary","small","pr-remove"],{type:"button"}),this._input=this.createElement("input",[],{type:"file",tabindex:"-1"}),this._input.hidden=!0,t.append(this._choose,this._remove,this._input),this._row.append(this._avatar,t),this._wrapper.appendChild(this._row),this._sync()}get _max(){return Math.max(1,Math.floor(Number(this.getAttribute("max")))||512)}get _type(){return this.getAttribute("type")||"image/jpeg"}get _quality(){const t=Number(this.getAttribute("quality"));return this.hasAttribute("quality")&&t>=0&&t<=1?t:.82}_sync(){if(!this._row)return;this._avatar.classList.toggle("square",this.getBoolAttr("square")),this._src?this._img&&this._img.getAttribute("src")===this._src||(this._img=this.createElement("img",[],{src:this._src,alt:""}),this._avatar.replaceChildren(this._img)):(this._img=null,this._avatar.textContent=this.getAttribute("initials")||"");const t=this.getAttribute("label");t?this._row.setAttribute("aria-label",t):this._row.removeAttribute("aria-label"),this._choose.textContent=this._src?this.getAttribute("change-label")||"Change image":this.getAttribute("choose-label")||"Upload image",this._remove.textContent=this.getAttribute("remove-label")||"Remove",this._remove.hidden=!this._src,this._input.accept=this.getAttribute("accept")||"image/*"}async _pick(t){if(t)try{const e=await createImageBitmap(t,{imageOrientation:"from-image"}),n=Math.min(1,this._max/Math.max(e.width,e.height)),i=document.createElement("canvas");i.width=Math.max(1,Math.round(e.width*n)),i.height=Math.max(1,Math.round(e.height*n));const s=i.getContext("2d");"image/jpeg"===this._type&&(s.fillStyle="#fff",s.fillRect(0,0,i.width,i.height)),s.drawImage(e,0,0,i.width,i.height),e.close();const r=i.toDataURL(this._type,this._quality);this.src=r,this.emit("nk-change",{dataUrl:r,width:i.width,height:i.height,size:Qt(r)})}catch(e){this.emit("nk-error",{message:e?.message||String(e),name:t.name})}}setupEvents(){this._onChoose=()=>this._input.click(),this._onChange=t=>{const e=t.target.files?.[0];t.target.value="",this._pick(e)},this._onRemove=()=>{this.src="",this._choose.focus(),this.emit("nk-change",{dataUrl:"",width:0,height:0,size:0})},this._choose.addEventListener("click",this._onChoose),this._input.addEventListener("change",this._onChange),this._remove.addEventListener("click",this._onRemove)}teardownEvents(){this._choose?.removeEventListener("click",this._onChoose),this._input?.removeEventListener("change",this._onChange),this._remove?.removeEventListener("click",this._onRemove)}onAttributeChanged(t,e,n){"src"===t&&(this._src=n||""),this._sync()}choose(){this._input?.click()}get src(){return this._src??this.getAttribute("src")??""}set src(t){this._src=t||"",this._sync()}get square(){return this.getBoolAttr("square")}set square(t){this.setBoolAttr("square",t)}}customElements.define("nk-image-picker",Yt);const Zt=new Set(["nk-menu","nk-pop","nk-modal","nk-sheet","nk-cmdk","nk-toast"]),Xt=["nk-pop","nk-modal-backdrop","nk-sheet-backdrop","nk-cmdk-backdrop"];class Jt extends p{static get observedAttributes(){return["open","label","close-label"]}render(){this._backdrop=this.createElement("div",["nk-peek-backdrop"]),this._box=this.createElement("aside",["nk-peek"],{role:"dialog",tabindex:"-1"});const t=this.createElement("div",["pk-bar"]);this._close=this.createElement("button",["nk-topbar-btn"],{type:"button"}),this._close.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 17 5-5-5-5M13 17l5-5-5-5"/></svg>',t.append(this._close,this.createElement("slot",[],{name:"actions"}));const e=this.createElement("div",["pk-body"]);e.appendChild(document.createElement("slot")),this._box.append(t,e),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncLabels(),this._syncOpen()}_syncLabels(){const t=this.getAttribute("label");t?this._box.setAttribute("aria-label",t):this._box.removeAttribute("aria-label"),this._close.setAttribute("aria-label",this.getAttribute("close-label")||"Close")}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=Rt(),matchMedia("(max-width: 860px)").matches&&(this._modal=!0,this._box.setAttribute("aria-modal","true"),Ot(),this._undoInert=Pt(this)),requestAnimationFrame(()=>this._box.focus({preventScroll:!0}));else{this._modal&&(this._modal=!1,this._box.removeAttribute("aria-modal"),Kt(),this._undoInert?.(),this._undoInert=null);const t=Rt(),e=t&&(this.contains(t)||this._shadow.contains(t)||t===document.body),n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&"function"==typeof n.focus&&n.focus({preventScroll:!0})}}setupEvents(){this._onClose=()=>this.close(),this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onOutside=t=>{if(!this.getBoolAttr("open")||this._shownAt>=t.timeStamp)return;const e=t.composedPath();e.includes(this)||e.some(t=>1===t.nodeType&&(Zt.has(t.localName)||Xt.some(e=>t.classList.contains(e))))||this.close()},this._close.addEventListener("click",this._onClose),this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey),document.addEventListener("click",this._onOutside)}teardownEvents(){this._close?.removeEventListener("click",this._onClose),this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey),document.removeEventListener("click",this._onOutside),this._modal&&(this._modal=!1,Kt(),this._undoInert?.(),this._undoInert=null),this._wasOpen=!1}onAttributeChanged(t){"open"===t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this._syncLabels()}show(){this._shownAt=performance.now(),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.getBoolAttr("open")?this.close():this.show()}get open(){return this.getBoolAttr("open")}set open(t){t?this.show():this.close()}}customElements.define("nk-peek",Jt);class te extends p{static get observedAttributes(){return["open","pane"]}render(){this._backdrop=this.createElement("div",["nk-modal-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-modal"],{role:"dialog","aria-modal":"true",tabindex:"-1"}),this._nav=this.createElement("nav",["nk-settings-nav"],{"aria-label":"Settings"}),this._nav.appendChild(this.createElement("slot",[],{name:"user"})),this._rows=document.createElement("div"),this._nav.appendChild(this._rows),this._nav.appendChild(this.createElement("slot",[],{name:"nav"})),this._content=this.createElement("div",["nk-settings-content"]),this._slot=document.createElement("slot"),this._content.appendChild(this._slot),this._box.append(this._nav,this._content),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncOpen(),this.requestNav()}get panes(){return[...this.querySelectorAll(":scope > nk-settings-pane")]}requestNav(){this._navQueued||(this._navQueued=!0,queueMicrotask(()=>{this._navQueued=!1,this._buildNav()}))}_buildNav(){if(!this._rows)return;const t=this.panes.filter(t=>t.getAttribute("label"));this._rows.replaceChildren(),this._nav.style.display=t.length||this.querySelector(':scope > [slot="nav"], :scope > [slot="user"]')?"":"none";let e=null;for(const n of t){const t=n.getAttribute("group");if(t&&t!==e){const n=this.createElement("div",["nk-section-label"]);n.textContent=t,this._rows.appendChild(n),e=t}const i=this.createElement("div",["nk-tree-item"],{role:"tab",tabindex:"0","data-pane":n.name}),s=this.createElement("span",["icon"]);s.textContent=n.getAttribute("icon")||"";const r=this.createElement("span",["label"]);r.textContent=n.getAttribute("label"),i.append(s,r),this._rows.appendChild(i)}this._syncActive()}_syncActive(){const t=this.panes;let e=this.getAttribute("pane");t.some(t=>t.name===e)||(e=(t.find(t=>t.hasAttribute("active"))||t[0])?.name??null);for(const t of this._rows.querySelectorAll("[data-pane]")){const n=t.dataset.pane===e;t.classList.toggle("active",n),t.setAttribute("aria-selected",n?"true":"false")}for(const n of t)n.active=n.name===e;this._current=e}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=document.activeElement,Ot(),this._undoInert=Pt(this),requestAnimationFrame(()=>{(this._rows.querySelector(".nk-tree-item.active")||$t(this)||this._box).focus({preventScroll:!0})});else{Kt(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._onNavClick=t=>{const e=t.target.closest("[data-pane]");e&&(e.focus(),this.pane=e.dataset.pane)},this._onNavKey=t=>{const e=t.target.closest?.("[data-pane]");if(!e)return;if("Enter"===t.key||" "===t.key)return t.preventDefault(),void(this.pane=e.dataset.pane);const n={ArrowDown:1,ArrowUp:-1}[t.key];if(!n)return;const i=[...this._rows.querySelectorAll("[data-pane]")],s=i[(i.indexOf(e)+n+i.length)%i.length];t.preventDefault(),s.focus(),this.pane=s.dataset.pane},this._onSlot=()=>this.requestNav(),this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey),this._rows.addEventListener("click",this._onNavClick),this._rows.addEventListener("keydown",this._onNavKey),this._slot.addEventListener("slotchange",this._onSlot)}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey),this._rows?.removeEventListener("click",this._onNavClick),this._rows?.removeEventListener("keydown",this._onNavKey),this._slot?.removeEventListener("slotchange",this._onSlot),this._wasOpen&&(Kt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t){if("open"===t)this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")});else if("pane"===t){const t=this._current;this._syncActive(),this._current!==t&&this.emit("nk-select",{value:this._current,label:this.panes.find(t=>t.name===this._current)?.getAttribute("label")??this._current})}}show(t){t&&this.setAttribute("pane",t),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get pane(){return this._current??this.getAttribute("pane")}set pane(t){this.setAttribute("pane",t)}}customElements.define("nk-modal",te);class ee extends p{static get observedAttributes(){return["name","label","icon","group","title","active"]}render(){this._section=this.createElement("section",["nk-settings-pane"],{role:"tabpanel"}),this._h2=document.createElement("h2"),this._section.appendChild(this._h2),this._section.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._section),this.takeTitle(),this._sync()}_sync(){const t=this._titleText;this._h2.textContent=t||"",this._h2.style.display=t?"":"none",this._section.classList.toggle("active",this.getBoolAttr("active")),this._section.setAttribute("aria-label",this.getAttribute("label")||t||this.getAttribute("name")||"")}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&(this._sync(),["label","icon","group","name"].includes(t)&&this.closest("nk-modal")?.requestNav?.())}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get name(){return this.getAttribute("name")??this.getAttribute("label")??""}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}}customElements.define("nk-settings-pane",ee);class ne extends p{static get observedAttributes(){return["name","mail","avatar"]}render(){const t=this.createElement("div",["nk-settings-user"]);this._avatar=this.createElement("div",["avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar);const n=this.createElement("div",["u-text"]);this._name=this.createElement("div",["name"]),this._mail=this.createElement("div",["mail"]),n.append(this._name,this._mail),t.append(e,n),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("name")||"";this._name.textContent=t;const e=this.getAttribute("mail");this._mail.textContent=e||"",this._mail.style.display=e?"":"none",this._avatar.textContent=this.getAttribute("avatar")||t.split(/\s+/).map(t=>t[0]).join("").slice(0,2).toUpperCase()}onAttributeChanged(){this._sync()}}function ie(t,e){const n=t.trim().toLowerCase();if(!n)return 1;const i=e.toLowerCase();let s=0,r=0,o=0;for(let t=0;t<n.length;t++){const e=i.indexOf(n[t],s);if(e<0)return 0;o=e===s?o+1:0,r+=1+2*o+(0===e||/[\s\-_/.]/.test(i[e-1])?3:0)-Math.min(3,.25*(e-s)),s=e+1}return i.startsWith(n)&&(r+=10),Math.max(.01,r/(1+i.length/40))}customElements.define("nk-settings-user",ne);class se extends p{static get observedAttributes(){return["open","hotkey","placeholder"]}render(){this._backdrop=this.createElement("div",["nk-cmdk-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-cmdk"],{role:"dialog","aria-modal":"true","aria-label":"Command palette"});const t=this.createElement("div",["nk-cmdk-input-row"]),e=document.createElement("span");e.style.fontSize="15px",e.textContent="๐",this._input=this.createElement("input",[],{type:"text",autocomplete:"off",role:"combobox","aria-expanded":"true","aria-autocomplete":"list"});const n=this.createElement("kbd",["nk-kbd"]);n.textContent="esc",t.append(e,this._input,n),this._list=this.createElement("div",["nk-cmdk-list"],{role:"listbox",id:"list"}),this._input.setAttribute("aria-controls","list"),this._footer=this.createElement("div",["nk-cmdk-footer"]);const i=this.createElement("slot",[],{name:"footer"});i.innerHTML='<span><kbd class="nk-kbd">โ</kbd><kbd class="nk-kbd">โ</kbd> navigate</span><span><kbd class="nk-kbd">โต</kbd> open</span><span><kbd class="nk-kbd">โ</kbd><kbd class="nk-kbd">K</kbd> toggle</span>',this._footer.appendChild(i),this._box.append(t,this._list,this._footer),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._commands=[],this._index=0,this._syncAttrs(),this._renderList(),this._syncOpen()}_syncAttrs(){this._input.placeholder=this.getAttribute("placeholder")||"Search or type a command โฆ"}results(){const t=this._input?.value??"",e=[];for(const n of this._commands){const i=(n.items||[]).map(e=>({item:e,group:n.group,score:ie(t,`${e.label} ${e.keywords||""}`)})).filter(t=>t.score>0);i.sort((t,e)=>e.score-t.score),e.push(...i)}return e}_renderList(){if(!this._list)return;const t=this.results();if(this._index=Math.min(this._index,Math.max(0,t.length-1)),this._list.replaceChildren(),!t.length){const t=this.createElement("div",["nk-cmdk-empty"]);return t.textContent=`No results for โ${this._input.value}โ`,this._list.appendChild(t),void this._input.removeAttribute("aria-activedescendant")}let e=null;t.forEach((t,n)=>{if(t.group&&t.group!==e){const n=this.createElement("div",["nk-cmdk-group"]);n.textContent=t.group,this._list.appendChild(n),e=t.group}const i=this.createElement("div",["nk-cmdk-item"],{role:"option",id:`opt-${n}`,"data-index":n});i.classList.toggle("selected",n===this._index),i.setAttribute("aria-selected",n===this._index?"true":"false");const s=this.createElement("span",["m-icon"]);s.textContent=t.item.icon||"";const r=document.createElement("span");if(r.textContent=t.item.label,i.append(s,r),t.item.shortcut){const e=this.createElement("span",["m-shortcut"]);e.textContent=t.item.shortcut,i.appendChild(e)}this._list.appendChild(i)}),this._input.setAttribute("aria-activedescendant",`opt-${this._index}`)}_move(t){const e=this.results().length;if(e){this._index=(this._index+t+e)%e;for(const t of this._list.querySelectorAll(".nk-cmdk-item")){const e=Number(t.dataset.index)===this._index;t.classList.toggle("selected",e),t.setAttribute("aria-selected",e?"true":"false"),e&&t.scrollIntoView({block:"nearest"})}this._input.setAttribute("aria-activedescendant",`opt-${this._index}`)}}pick(t=this._index){const e=this.results()[t];if(!e)return;const n=this._input.value;this.close();this.emit("nk-command",{id:e.item.id??e.item.label,item:e.item,query:n})&&"function"==typeof e.item.action&&e.item.action(e.item)}_matchesHotkey(t){const e=(this.getAttribute("hotkey")||"mod+k").toLowerCase().split("+"),n=e.pop(),i=!e.includes("mod")||(t.metaKey||t.ctrlKey),s=e.includes("shift")?t.shiftKey:!t.shiftKey,r=e.includes("alt")?t.altKey:!t.altKey;return i&&s&&r&&t.key.toLowerCase()===n}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=document.activeElement,this._input.value="",this._index=0,this._renderList(),Ot(),this._undoInert=Pt(this),requestAnimationFrame(()=>this._input.focus({preventScroll:!0}));else{Kt(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onDocKey=t=>{if(this._matchesHotkey(t))return t.preventDefault(),void this.toggle();"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._onInput=()=>{this._index=0,this._renderList()},this._onInputKey=t=>{"ArrowDown"===t.key?(t.preventDefault(),this._move(1)):"ArrowUp"===t.key?(t.preventDefault(),this._move(-1)):"Enter"===t.key&&(t.preventDefault(),this.pick())},this._onListClick=t=>{const e=t.target.closest(".nk-cmdk-item");e&&this.pick(Number(e.dataset.index))},this._onListMove=t=>{const e=t.target.closest(".nk-cmdk-item");e&&Number(e.dataset.index)!==this._index&&(this._index=Number(e.dataset.index),this._move(0))},this._onListDown=t=>t.preventDefault(),this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},document.addEventListener("keydown",this._onDocKey),this._input.addEventListener("input",this._onInput),this._input.addEventListener("keydown",this._onInputKey),this._list.addEventListener("click",this._onListClick),this._list.addEventListener("mousemove",this._onListMove),this._list.addEventListener("mousedown",this._onListDown),this._backdrop.addEventListener("click",this._onBackdrop)}teardownEvents(){document.removeEventListener("keydown",this._onDocKey),this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("keydown",this._onInputKey),this._list?.removeEventListener("click",this._onListClick),this._list?.removeEventListener("mousemove",this._onListMove),this._list?.removeEventListener("mousedown",this._onListDown),this._backdrop?.removeEventListener("click",this._onBackdrop),this._wasOpen&&(Kt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t){"open"===t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this._syncAttrs()}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get commands(){return this._commands}set commands(t){this._commands=Array.isArray(t)?t:[],this._index=0,this._renderList()}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get query(){return this._input?.value??""}set query(t){this._input&&(this._input.value=t,this._index=0,this._renderList())}}customElements.define("nk-cmdk",se);const re=new CSSStyleSheet;function oe(t){if(t.getClientRects().length)return t.getBoundingClientRect();for(const e of[...t.shadowRoot?.children??[],...t.children]){const t=oe(e);if(t.width||t.height)return t}return t.getBoundingClientRect()}re.replaceSync(":host([floating]) { display: block; position: fixed; z-index: 60; pointer-events: none; }");class ae extends p{static get hostStyles(){return re}static get observedAttributes(){return["floating","sheet","open","align"]}render(){this._box=this.createElement("div",["nk-pop","nk-menu"],{role:"menu"}),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box),this._syncMode()}_syncMode(){this._box.classList.toggle("floating",this.getBoolAttr("floating")),this._box.classList.toggle("sheet",this.getBoolAttr("sheet")),this._box.classList.toggle("open",this.getBoolAttr("open"))}onAttributeChanged(t){if(this._syncMode(),"open"!==t)return;const e=this.getBoolAttr("open");if(this._anchor&&(this._anchor.shadowRoot?.querySelector("button, a[href]")??this._anchor).setAttribute("aria-expanded",String(e)),e)this._returnFocus=Rt(),this._returnFocus?.matches(":focus-visible")&&requestAnimationFrame(()=>this.focusFirst()),document.addEventListener("click",this._onOutside,!0);else{document.removeEventListener("click",this._onOutside,!0);const t=this._returnFocus;this._returnFocus=null,t?.isConnected&&this.contains(document.activeElement)&&t.focus({preventScroll:!0})}this.emit("nk-toggle",{open:e})}show(t){if(t){this._anchor=t;const e=oe(t);this.style.top=`${e.bottom+6}px`,"start"===this.getAttribute("align")?(this.style.left=`${e.left}px`,this.style.right=""):(this.style.right=`${Math.max(8,innerWidth-e.right)}px`,this.style.left="")}this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(t){this.getBoolAttr("open")?this.close():this.show(t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get items(){return[...this.querySelectorAll(":scope > nk-menu-item")].filter(t=>t.selectable)}setupEvents(){this._onKey=t=>{const e={ArrowDown:1,ArrowUp:-1}[t.key],n=t.target.closest?.("nk-menu-item"),i=this.items;if(i.length)if(e){t.preventDefault();const s=i.indexOf(n);i[(s+e+i.length)%i.length].focus()}else"Enter"!==t.key&&" "!==t.key||!n||(t.preventDefault(),n.select())},this.addEventListener("keydown",this._onKey),this._onOutside=t=>{const e=t.composedPath();e.includes(this)||this._anchor&&e.includes(this._anchor)||(t.preventDefault(),t.stopPropagation(),this.close())},this._onEscape=t=>{"Escape"===t.key&&this.getBoolAttr("floating")&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._onSelect=()=>{this.getBoolAttr("floating")&&this.close()},document.addEventListener("keydown",this._onEscape,!0),this.addEventListener("nk-select",this._onSelect),this.getBoolAttr("open")&&document.addEventListener("click",this._onOutside,!0)}teardownEvents(){this.removeEventListener("keydown",this._onKey),document.removeEventListener("keydown",this._onEscape,!0),this.removeEventListener("nk-select",this._onSelect),document.removeEventListener("click",this._onOutside,!0)}focusFirst(){this.items[0]?.focus()}}customElements.define("nk-menu",ae);class le extends p{static get observedAttributes(){return["icon","shortcut","danger","value","type","disabled","checked"]}render(){this._build()}_build(){const t=this.getAttribute("type");let e;if("separator"===t)e=this.createElement("div",["nk-menu-sep"],{role:"separator"});else if("label"===t)e=this.createElement("div",["nk-menu-label"]),e.appendChild(document.createElement("slot"));else{const n="switch"===t;this._check="check"===t,e=this.createElement("div",["nk-menu-item"],{role:n||this._check?"menuitemcheckbox":"menuitem",tabindex:"-1"}),this._icon=this.createElement("span",["m-icon"]);const i=this.createElement("slot",[],{name:"icon"});i.appendChild(this._icon),this._shortcut=this.createElement("span",["m-shortcut"]),e.append(i,document.createElement("slot"),this._shortcut),this._switch=n?this.createElement("span",["nk-switch"],{"aria-hidden":"true"}):null,this._switch&&e.appendChild(this._switch)}this._el?(this._el.removeEventListener("click",this._onClick),this._el.replaceWith(e)):this._wrapper.appendChild(e),this._el=e,this._onClick&&e.addEventListener("click",this._onClick),this._sync()}_sync(){if(!this._el.classList.contains("nk-menu-item"))return;const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none";const e=this.getAttribute("shortcut");if(this._shortcut.textContent=e||"",this._shortcut.style.display=e?"":"none",this._el.classList.toggle("danger",this.getBoolAttr("danger")),this._el.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false"),this._switch||this._check){const t=this.getBoolAttr("checked")?"true":"false";this._el.setAttribute("aria-checked",t),this._switch&&this._switch.setAttribute("aria-checked",t),this._check&&(this._shortcut.textContent="true"===t?"โ":"",this._shortcut.style.display="")}}setupEvents(){this._onClick=()=>this.select(),this._el.addEventListener("click",this._onClick)}teardownEvents(){this._el?.removeEventListener("click",this._onClick)}select(){if(this._el.classList.contains("nk-menu-item")&&!this.getBoolAttr("disabled"))return this._switch||this._check?(this.checked=!this.checked,void this.emit("nk-change",{value:this.value,checked:this.checked,item:this})):void this.emit("nk-select",{value:this.value,label:this.textContent.trim(),item:this})}onAttributeChanged(t){"type"===t?this._build():this._sync()}focus(t){this._el?.focus(t)}get selectable(){return this._el?.classList.contains("nk-menu-item")&&!this.getBoolAttr("disabled")}get checked(){return this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}}customElements.define("nk-menu-item",le);const he=new CSSStyleSheet;he.replaceSync('\n .nk-pop-anchor { position: relative; display: inline-block; }\n .nk-pop-float { display: none; position: absolute; z-index: 50; top: 100%; left: 0; margin-top: 4px; }\n :host([open]) .nk-pop-float { display: block; }\n :host([placement="bottom-end"]) .nk-pop-float { left: auto; right: 0; }\n :host([placement="top-start"]) .nk-pop-float { top: auto; bottom: 100%; margin: 0 0 4px; }\n :host([placement="top-end"]) .nk-pop-float { top: auto; bottom: 100%; left: auto; right: 0; margin: 0 0 4px; }\n');const ce=new Set(["nk-menu","nk-emoji-picker"]);class de extends p{static get hostStyles(){return he}static get observedAttributes(){return["open","placement","bare"]}render(){const t=this.createElement("div",["nk-pop-anchor"]);this._triggerSlot=this.createElement("slot",[],{name:"trigger"}),this._float=this.createElement("div",["nk-pop-float"]),this._surface=this.createElement("div",["nk-pop"]),this._slot=document.createElement("slot"),this._surface.appendChild(this._slot),this._float.appendChild(this._surface),t.append(this._triggerSlot,this._float),this._wrapper.appendChild(t),this._syncSurface()}_syncSurface(){const t=this.getBoolAttr("bare")||this._slot.assignedElements().some(t=>ce.has(t.localName));this._surface.className=t?"":"nk-pop"}setupEvents(){this._onTrigger=t=>{t.composedPath().some(t=>t instanceof Element&&"trigger"===t.getAttribute?.("slot"))&&(t.stopPropagation(),this.toggle())},this._onDocClick=t=>{this.getBoolAttr("open")&&!t.composedPath().includes(this)&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onSelect=t=>{t.target!==this&&this.close()},this._onSlot=()=>this._syncSurface(),this.addEventListener("click",this._onTrigger),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onKey),this._float.addEventListener("nk-select",this._onSelect),this._slot.addEventListener("slotchange",this._onSlot)}teardownEvents(){this.removeEventListener("click",this._onTrigger),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onKey),this._float?.removeEventListener("nk-select",this._onSelect),this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){if("bare"===t&&this._syncSurface(),"open"===t){const t=this.getBoolAttr("open");for(const e of this._triggerSlot.assignedElements())e.setAttribute("aria-expanded",t?"true":"false");this.emit("nk-toggle",{open:t})}}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get placement(){return this.getAttribute("placement")||"bottom-start"}set placement(t){this.setAttribute("placement",t)}}customElements.define("nk-pop",de);const pe=(t,e,n)=>n.map(([n,i])=>({char:n,name:i,cat:t,icon:e})),ue=[{id:"smileys",icon:"๐"},{id:"people",icon:"๐"},{id:"nature",icon:"๐ฟ"},{id:"food",icon:"โ"},{id:"activity",icon:"๐ฏ"},{id:"travel",icon:"๐"},{id:"objects",icon:"๐ก"},{id:"symbols",icon:"โ
"}],be=[...pe("smileys","๐",[["๐","grinning"],["๐","smile blush"],["๐","joy laugh"],["๐","slight smile"],["๐","wink"],["๐","heart eyes love"],["๐ค","thinking"],["๐","cool sunglasses"],["๐ฅณ","party"],["๐ด","sleep"],["๐คฏ","mind blown"],["๐
","sweat smile"],["๐","upside down"],["๐","angel halo"],["๐ค","hug"],["๐ข","cry sad"]]),...pe("people","๐",[["๐","wave hello"],["๐","thumbs up"],["๐","thumbs down"],["๐","pray thanks"],["๐","clap"],["๐ค","handshake deal"],["๐ช","strong"],["๐","eyes look"],["๐ง ","brain knowledge"],["โค๏ธ","heart love"],["๐ค","person user"],["๐ฅ","people team members"],["๐งโ๐ป","developer"],["๐","raise hand"],["โ๏ธ","writing"],["๐ซถ","heart hands"]]),...pe("nature","๐ฟ",[["๐ฟ","leaf herb"],["๐ฑ","seedling"],["๐ณ","tree"],["๐ธ","blossom flower"],["๐","sun"],["๐","moon night"],["โญ","star"],["๐ฅ","fire hot"],["๐","rainbow"],["๐","wave water"],["๐","clover luck"],["๐","bee"],["๐ฆ","butterfly"],["๐ข","turtle"],["๐","earth globe"],["โ๏ธ","snow"]]),...pe("food","โ",[["โ","coffee"],["๐ต","tea"],["๐","apple"],["๐","pizza"],["๐ฐ","cake"],["๐ช","cookie"],["๐ฅ","croissant"],["๐","burger"],["๐","noodles"],["๐บ","beer"],["๐ท","wine"],["๐ฅ","salad"],["๐ซ","chocolate"],["๐","strawberry"],["๐ฅ","avocado"],["๐ฉ","donut"]]),...pe("activity","๐ฏ",[["๐ฏ","target goal"],["๐","trophy win"],["๐","tada celebration"],["๐จ","art palette design"],["๐๏ธ","microphone podcast voice"],["๐ฌ","clapper movie"],["๐ฎ","game"],["โฝ","football"],["๐","run"],["๐ง","yoga calm"],["๐ต","music"],["๐ฒ","dice"],["๐","finish flag"],["๐","graduation learn"],["๐งฉ","puzzle piece"],["๐","repeat retro"]]),...pe("travel","๐",[["๐","rocket launch"],["โ๏ธ","plane travel"],["๐","car"],["๐ฒ","bike"],["๐ ","house home"],["๐ข","office building"],["๐บ๏ธ","map"],["๐งญ","compass"],["โฐ๏ธ","mountain"],["๐๏ธ","beach"],["๐","station"],["๐ฐ๏ธ","satellite"],["๐","city"],["๐๏ธ","camping"],["โต","sailboat"],["๐ซ","departure"]]),...pe("objects","๐ก",[["๐ก","idea bulb"],["๐","chart bar"],["๐","chart up"],["๐
","calendar date"],["๐","page document"],["๐","folder"],["๐๏ธ","card box database"],["๐","pin"],["๐","search"],["๐ ๏ธ","tools"],["โ๏ธ","gear settings"],["๐","bell notification"],["๐","gem diamond"],["๐","memo notes"],["๐","paperclip files"],["๐","lock secure"],["๐ฌ","speech comment"],["๐ค","export outbox"],["๐ฅ","inbox"],["๐๏ธ","trash bin"],["๐ฅ๏ธ","desktop"],["๐ฑ","phone"],["๐ป","laptop"],["๐งพ","receipt"]]),...pe("symbols","โ
",[["โ
","check done"],["โจ","sparkles ai magic"],["โ","cross no"],["โ ๏ธ","warning"],["โน๏ธ","info"],["โ","question"],["โ","plus add"],["โก๏ธ","arrow right"],["๐ด","red circle"],["๐ข","green circle"],["๐ก","yellow circle"],["๐ต","blue circle"],["โณ","hourglass wait"],["โป๏ธ","recycle"],["๐","new"],["๐ฏ","hundred"]])];class ge extends p{static get observedAttributes(){return["placeholder","value"]}render(){this._box=this.createElement("div",["nk-pop"]),this._search=this.createElement("input",["nk-emoji-search"],{type:"search",autocomplete:"off","aria-label":"Search emoji"}),this._grid=this.createElement("div",["nk-emoji-grid"],{role:"listbox"}),this._cats=this.createElement("div",["nk-emoji-cats"],{role:"tablist"}),this._box.append(this._search,this._grid,this._cats),this._wrapper.appendChild(this._box),this._emojis=be,this._cat=ue[0].id,this._renderCats(),this._renderGrid(),this._syncAttrs()}_syncAttrs(){this._search.placeholder=this.getAttribute("placeholder")||"Searchโฆ"}_renderCats(){this._cats.replaceChildren();const t=this._categories();for(const e of t){const t=this.createElement("span",[],{role:"tab","data-cat":e.id,title:e.id});t.textContent=e.icon,t.classList.toggle("active",e.id===this._cat),this._cats.appendChild(t)}this._cats.style.display=t.length>1?"":"none"}_categories(){if(this._catList)return this._catList;const t=new Map;for(const e of this._emojis)e.cat&&!t.has(e.cat)&&t.set(e.cat,{id:e.cat,icon:e.icon||ue.find(t=>t.id===e.cat)?.icon||e.char});return[...t.values()]}_renderGrid(){const t=this._search.value.trim().toLowerCase(),e=t?this._emojis.filter(e=>(e.name||"").toLowerCase().includes(t)||e.char===t):this._emojis.filter(t=>!t.cat||t.cat===this._cat);this._grid.replaceChildren();for(const t of e.slice(0,64)){const e=this.createElement("span",[],{role:"option",title:t.name||"","data-emoji":t.char});e.textContent=t.char,this._grid.appendChild(e)}for(const e of this._cats.children)e.classList.toggle("active",!t&&e.dataset.cat===this._cat)}setupEvents(){this._onInput=()=>this._renderGrid(),this._onGrid=t=>{const e=t.target.closest("[data-emoji]");e&&this.select(e.dataset.emoji)},this._onCats=t=>{const e=t.target.closest("[data-cat]");e&&(this._cat=e.dataset.cat,this._search.value="",this._renderGrid())},this._onKey=t=>{if("Enter"===t.key){const t=this._grid.querySelector("[data-emoji]");t&&this.select(t.dataset.emoji)}},this._search.addEventListener("input",this._onInput),this._search.addEventListener("keydown",this._onKey),this._grid.addEventListener("click",this._onGrid),this._cats.addEventListener("click",this._onCats)}teardownEvents(){this._search?.removeEventListener("input",this._onInput),this._search?.removeEventListener("keydown",this._onKey),this._grid?.removeEventListener("click",this._onGrid),this._cats?.removeEventListener("click",this._onCats)}select(t){this.setAttribute("value",t),this.emit("nk-select",{emoji:t,value:t})}onAttributeChanged(){this._syncAttrs()}focus(t){this._search?.focus(t)}get categories(){return this._categories()}set categories(t){this._catList=Array.isArray(t)&&t.length?t:null,this._cat=this._categories()[0]?.id,this._renderCats(),this._renderGrid()}get emojis(){return this._emojis}set emojis(t){this._emojis=Array.isArray(t)?t:be,this._cat=this._categories()[0]?.id,this._renderCats(),this._renderGrid()}get value(){return this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-emoji-picker",ge);class me extends p{static get observedAttributes(){return["open","duration","icon"]}render(){this._box=this.createElement("div",["nk-toast"],{role:"status","aria-live":"polite"}),this._icon=document.createElement("span"),this._msg=document.createElement("span"),this._box.append(this._icon,this._msg,document.createElement("slot")),this._wrapper.appendChild(this._box),this._sync()}_sync(){this.getBoolAttr("open")&&this._lift(),this._box.classList.toggle("show",this.getBoolAttr("open"));const t=this.getAttribute("icon")??"โ";this._icon.textContent=t,this._icon.style.display=t?"":"none"}_lift(){const t=[...document.querySelectorAll(".nk-tab-bar")];for(const e of document.querySelectorAll("nk-tab-bar")){const n=e.shadowRoot?.querySelector(".nk-tab-bar");n&&t.push(n)}const e=t.map(t=>t.getBoundingClientRect()).find(t=>t.height>0&&t.top<innerHeight&&t.bottom>innerHeight-60);this._box.style.bottom=e?`${Math.round(innerHeight-e.top+12)}px`:""}show(t,{duration:e}={}){void 0!==t&&(this._msg.textContent=t),clearTimeout(this._timer),this.setBoolAttr("open",!0);const n=e??Number(this.getAttribute("duration"))??2200;n>0&&(this._timer=setTimeout(()=>this.close(),n||2200))}close(){clearTimeout(this._timer),this.setBoolAttr("open",!1)}onAttributeChanged(t){this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open")})}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._timer)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get message(){return this._msg?.textContent??""}set message(t){this._msg&&(this._msg.textContent=t)}}customElements.define("nk-toast",me);class ke extends p{static get observedAttributes(){return["view","add-view"]}render(){this._box=this.createElement("div",["nk-database"]),this._toolbar=this.createElement("div",["nk-db-toolbar"]),this._tabs=this.createElement("div",["nk-db-tabs"],{role:"tablist"});const t=this.createElement("div",["tools"]);this._toolsSlot=this.createElement("slot",[],{name:"tools"}),t.appendChild(this._toolsSlot),this._toolbar.append(this._tabs,t),this._slot=document.createElement("slot"),this._box.append(this._toolbar,this.createElement("slot",[],{name:"filters"}),this._slot),this._wrapper.appendChild(this._box),this._columns=[],this._rows=[],this._sync()}get views(){return this._slot?.assignedElements().filter(t=>/^nk-[a-z]+-view$/.test(t.localName))??[]}_sync(){if(!this._tabs)return;const t=this.views;let e=this.getAttribute("view");t.some(t=>t.name===e)||(e=t[0]?.name??null),this._tabs.replaceChildren();for(const n of t){const t=this.createElement("span",["nk-db-tab"],{role:"tab","data-view":n.name,tabindex:"0"});t.classList.toggle("active",n.name===e),t.setAttribute("aria-selected",n.name===e?"true":"false"),t.append(document.createTextNode(n.getAttribute("label")||n.name));const i=n.hasAttribute("count")?String(this._rows.length):n.getAttribute("badge");if(i){const e=this.createElement("span",["badge"]);e.textContent=i,t.appendChild(e)}this._tabs.appendChild(t),n.hidden=n.name!==e,n.setData?.(this._columns,this._rows)}if(this.getBoolAttr("add-view")){const t=this.createElement("span",["nk-db-tab","add"],{role:"button","data-add":"",tabindex:"0"});t.textContent="๏ผ",this._tabs.appendChild(t)}this._toolbar.hidden=!t.length&&!this._toolsSlot.assignedElements().length,this._current=e}requestSync(){this._syncQueued||(this._syncQueued=!0,queueMicrotask(()=>{this._syncQueued=!1,this._sync()}))}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-view]");e?this.view=e.dataset.view:t.target.closest("[data-add]")&&this.emit("nk-action",{action:"add-view"})},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||!t.target.closest("[data-view],[data-add]")||(t.preventDefault(),t.target.click())},this._onSlot=()=>this._sync(),this._tabs.addEventListener("click",this._onClick),this._tabs.addEventListener("keydown",this._onKey),this._slot.addEventListener("slotchange",this._onSlot),this._toolsSlot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._tabs?.removeEventListener("click",this._onClick),this._tabs?.removeEventListener("keydown",this._onKey),this._slot?.removeEventListener("slotchange",this._onSlot),this._toolsSlot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){const e=this._current;this._sync(),"view"===t&&this._current!==e&&this.emit("nk-view-change",{view:this._current})}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._sync()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._sync()}get view(){return this._current??this.getAttribute("view")}set view(t){this.setAttribute("view",t)}refresh(){this._sync()}}customElements.define("nk-database",ke);const _e=(t,e,n)=>{const i=document.createElement(t);return e&&(i.className=e),null!=n&&(i.textContent=n),i},ve=["gray","brown","orange","yellow","green","blue","purple","pink","red"];function xe(t,e){const n=function(t,e){const n=t.options||[];return n.find(t=>t.value===e)||n.find(t=>t.label===e)||null}(t,e),i=n?.color&&ve.includes(n.color)?n.color:"gray";return _e("span",`nk-tag ${i}`,n?.label??String(e))}function fe(t,e,n={}){const i=t.type||"text";if(null==e||""===e)return"checkbox"===i?ye(t,!1,n):"progress"===i?we(0):_e("span","person"===i?"person-cell":null,"text"===i&&t.title?"":"โ");switch(i){case"select":return xe(t,e);case"multi-select":{const n=_e("span");n.style.display="inline-flex",n.style.gap="4px",n.style.flexWrap="wrap";for(const i of Array.isArray(e)?e:String(e).split(",").map(t=>t.trim()).filter(Boolean))n.appendChild(xe(t,i));return n}case"date":return _e("span","date-cell",String(e));case"person":{const t=_e("span","person-cell"),n="string"==typeof e?{name:e}:e,i=_e("span","nk-avatar small",n.initials||n.avatar||At(n.name));return wt(i,n.color),t.append(i,document.createTextNode(" "+(n.name||""))),t}case"checkbox":return ye(t,!!e,n);case"url":{const t=_e("a",null,String(e).replace(/^https?:\/\//,""));return t.href=String(e),t.target="_blank",t.rel="noopener",t}case"number":return _e("span",null,"number"==typeof e?e.toLocaleString(t.locale,t.format):String(e));case"progress":return we(Number(e)||0);default:if(t.title){const t=_e("span","row-title");return n.icon&&t.append(document.createTextNode(n.icon+" ")),t.append(document.createTextNode(String(e))),t}return _e("span",null,String(e))}}function ye(t,e,n){const i=_e("label","nk-check"),s=_e("input");return s.type="checkbox",s.checked=e,s.dataset.key=t.key,null!=n.id&&(s.dataset.rowId=n.id),i.appendChild(s),i}function we(t){const e=document.createDocumentFragment(),n=_e("span","nk-progress"),i=_e("i");return i.style.width=`${Math.max(0,Math.min(100,t))}%`,n.appendChild(i),e.append(n,_e("span","nk-progress-label",`${Math.round(t)}%`)),e}function Ae(t,e=1){const n=t.type||"text";return(i,s)=>{let r=i[t.key],o=s[t.key];return"person"===n&&(r=r?.name??r??"",o=o?.name??o??""),"number"===n||"progress"===n||"checkbox"===n?((Number(r)||0)-(Number(o)||0))*e:String(r??"").localeCompare(String(o??""),void 0,{numeric:!0})*e}}class Ee extends p{static get observedAttributes(){return["name","label","badge","count","new-row","new-row-label","sortable","sort-key","sort-dir","wrap"]}render(){this._wrap=this.createElement("div",["nk-table-wrap"]),this._table=this.createElement("table",["nk-table"]),this._thead=document.createElement("thead"),this._tbody=document.createElement("tbody"),this._table.append(this._thead,this._tbody),this._newRow=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0"}),this._wrap.append(this._table,this._newRow),this._wrapper.appendChild(this._wrap),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_sortedRows(){const t=this.getAttribute("sort-key"),e=this._columns.find(e=>e.key===t);return e?[...this._rows].sort(Ae(e,"desc"===this.getAttribute("sort-dir")?-1:1)):this._rows}_render(){if(!this._thead)return;this._table.classList.toggle("wrap",this.getBoolAttr("wrap"));const t=document.createElement("tr");for(const e of this._columns){const n=this.createElement("th",[],{"data-key":e.key,scope:"col"});if(e.icon){const t=this.createElement("span",["th-icon"]);t.textContent=e.icon,n.appendChild(t)}n.appendChild(document.createTextNode(e.label??e.key)),e.key===this.getAttribute("sort-key")&&n.appendChild(document.createTextNode("desc"===this.getAttribute("sort-dir")?" โ":" โ")),e.width&&(n.style.width=e.width),t.appendChild(n)}this._thead.replaceChildren(t),this._tbody.replaceChildren();for(const t of this._sortedRows()){const e=this.createElement("tr",[],{"data-id":t.id??""});for(const n of this._columns){const i=document.createElement("td");"number"===n.type&&(i.className="num"),i.appendChild(fe(n,t[n.key],t)),e.appendChild(i)}this._tbody.appendChild(e)}this._newRow.textContent=this.getAttribute("new-row-label")||"๏ผ New page",this._newRow.style.display=this.getBoolAttr("new-row")?"":"none"}setupEvents(){this._onClick=t=>{if(this._newRow.contains(t.target))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest("th[data-key]");if(e){const t=e.dataset.key,n=this.getAttribute("sort-key")===t&&"desc"!==this.getAttribute("sort-dir")?"desc":"asc";return void(this.emit("nk-action",{action:"sort",key:t,value:n})&&this.getBoolAttr("sortable")&&(this.setAttribute("sort-key",t),this.setAttribute("sort-dir",n)))}if(t.target.closest("input[type=checkbox], a"))return;const n=t.target.closest("tr[data-id]");if(n){const t=this._rowById(n.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._onChange=t=>{const e=t.target;if("checkbox"!==e.type)return;const n=this._rowById(e.dataset.rowId);n&&(n[e.dataset.key]=e.checked),this.emit("nk-change",{row:n,key:e.dataset.key,value:e.checked})},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||t.target!==this._newRow||(t.preventDefault(),this.emit("nk-action",{action:"new-row"}))},this._wrap.addEventListener("click",this._onClick),this._wrap.addEventListener("change",this._onChange),this._wrap.addEventListener("keydown",this._onKey)}teardownEvents(){this._wrap?.removeEventListener("click",this._onClick),this._wrap?.removeEventListener("change",this._onChange),this._wrap?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}get name(){return this.getAttribute("name")||"table"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-table-view",Ee);class Ce extends p{static get observedAttributes(){return["name","label","badge","count","group-by","title-key","meta-keys","new-row"]}render(){this._board=this.createElement("div",["nk-board","active"]),this._wrapper.appendChild(this._board),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_groupColumn(){const t=this.getAttribute("group-by");return this._columns.find(e=>e.key===t)||this._columns.find(t=>"select"===t.type)||null}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"date"===t.type||"progress"===t.type)}_render(){if(!this._board)return;this._board.replaceChildren();const t=this._groupColumn(),e=this._titleColumn();if(!t)return;const n=t.options?.length?t.options:[...new Set(this._rows.map(e=>e[t.key]))].map(t=>({value:t,label:String(t)}));for(const i of n){const n=this.createElement("div",["nk-board-col"],{"data-value":i.value}),s=this.createElement("div",["nk-board-col-header"]),r=this._rows.filter(e=>e[t.key]===i.value||e[t.key]===i.label),o=this.createElement("span",["count"]);o.textContent=String(r.length),s.append(xe(t,i.value),o),n.appendChild(s);for(const t of r){const i=this.createElement("div",["nk-card"],{draggable:"true","data-id":t.id??"",tabindex:"0"}),s=this.createElement("div",["card-title"]);s.textContent=`${t.icon?t.icon+" ":""}${e?t[e.key]??"":""}`;const r=this.createElement("div",["card-meta"]);for(const e of this._metaColumns()){const n=t[e.key];if(null==n||""===n)continue;const i=document.createElement("span");"progress"===e.type?i.textContent=`โฐ ${n}%`:"date"===e.type?i.textContent=`๐
${n}`:i.appendChild(fe(e,n,t)),r.appendChild(i)}i.append(s,r),n.appendChild(i)}if(this.getBoolAttr("new-row")){const t=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0","data-add":i.value});t.style.padding="6px 10px",t.textContent="๏ผ",n.appendChild(t)}this._board.appendChild(n)}}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-add]");if(e)return void this.emit("nk-action",{action:"new-row",value:e.dataset.add});const n=t.target.closest(".nk-card");if(n){const t=this._rowById(n.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._onDragStart=t=>{const e=t.target.closest?.(".nk-card");if(e){this._dragId=e.dataset.id,t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",e.dataset.id)}catch{}}},this._onDragOver=t=>{null!=this._dragId&&t.target.closest(".nk-board-col")&&(t.preventDefault(),t.dataTransfer.dropEffect="move")},this._onDrop=t=>{const e=t.target.closest(".nk-board-col");e&&null!=this._dragId&&(t.preventDefault(),this.move(this._dragId,e.dataset.value),this._dragId=null)},this._board.addEventListener("click",this._onClick),this._board.addEventListener("dragstart",this._onDragStart),this._board.addEventListener("dragover",this._onDragOver),this._board.addEventListener("drop",this._onDrop)}teardownEvents(){this._board?.removeEventListener("click",this._onClick),this._board?.removeEventListener("dragstart",this._onDragStart),this._board?.removeEventListener("dragover",this._onDragOver),this._board?.removeEventListener("drop",this._onDrop)}move(t,e){const n=this._rowById(t),i=this._groupColumn();n&&i&&n[i.key]!==e&&(n[i.key]=e,this._render(),this.emit("nk-change",{row:n,key:i.key,value:e}))}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}get name(){return this.getAttribute("name")||"board"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-board-view",Ce);class Be extends p{static get observedAttributes(){return["name","label","badge","count","title-key","meta-keys","new-row","new-row-label"]}render(){this._box=document.createElement("div"),this._list=this.createElement("div",["nk-list"],{role:"list"}),this._newRow=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0"}),this._box.append(this._list,this._newRow),this._wrapper.appendChild(this._box),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"select"===t.type||"date"===t.type)}_render(){if(!this._list)return;const t=this._titleColumn(),e=this._metaColumns();this._list.replaceChildren();for(const n of this._rows){const i=this.createElement("div",["nk-list-item"],{role:"listitem",tabindex:"0","data-id":n.id??""}),s=this.createElement("span",["l-icon"]);s.textContent=n.icon||"",n.icon||(s.style.display="none");const r=this.createElement("span",["l-title"]);r.textContent=t?String(n[t.key]??""):"";const o=this.createElement("span",["l-meta"]);for(const t of e){const e=n[t.key];null!=e&&""!==e&&o.appendChild("date"!==t.type&&"text"!==t.type&&t.type?fe(t,e,n):document.createTextNode(String(e)))}i.append(s,r,o),this._list.appendChild(i)}this._newRow.textContent=this.getAttribute("new-row-label")||"๏ผ New page",this._newRow.style.display=this.getBoolAttr("new-row")?"":"none"}setupEvents(){this._onClick=t=>{if(this._newRow.contains(t.target))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest(".nk-list-item");if(e){const t=this._rowById(e.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.target===this._newRow||t.target.classList?.contains("nk-list-item"))&&(t.preventDefault(),t.target.click())},this._box.addEventListener("click",this._onClick),this._box.addEventListener("keydown",this._onKey)}teardownEvents(){this._box?.removeEventListener("click",this._onClick),this._box?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}get name(){return this.getAttribute("name")||"list"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-list-view",Be);class Le extends p{static get observedAttributes(){return["search","placeholder","no-filter","no-sort","value","add","add-label","filter-label","sort-label","remove-label"]}render(){this._row=this.createElement("div",["nk-filter-row"]),this._filterBtn=this.createElement("button",["nk-db-tool"],{type:"button","data-action":"filter"}),this._sortBtn=this.createElement("button",["nk-db-tool"],{type:"button","data-action":"sort"}),this._pillStart=document.createComment("pills"),this._addBtn=this.createElement("button",["nk-filter-pill","add"],{type:"button","data-action":"add"}),this._input=this.createElement("input",["nk-input"],{type:"search",autocomplete:"off"}),this._row.append(this._filterBtn,this._sortBtn,this._pillStart,this._addBtn,document.createElement("slot"),this._input),this._wrapper.appendChild(this._row),this._filters=[],this._sync()}_sync(){this._filterBtn.textContent=this.getAttribute("filter-label")||"Filter",this._filterBtn.hidden=this.getBoolAttr("no-filter"),this._filterBtn.classList.toggle("active",this._filters.length>0),this._sortBtn.textContent=this.getAttribute("sort-label")||"Sort",this._sortBtn.hidden=this.getBoolAttr("no-sort"),this._addBtn.textContent=this.getAttribute("add-label")||"๏ผ Filter",this._addBtn.hidden=!this.getBoolAttr("add"),this._input.hidden=!this.getBoolAttr("search"),this._input.placeholder=this.getAttribute("placeholder")||"Search โฆ",this.hasAttribute("value")&&this._input.value!==this.getAttribute("value")&&(this._input.value=this.getAttribute("value"));for(const t of this._row.querySelectorAll("[data-pill]"))t.remove();const t=this.getAttribute("remove-label")||"Remove filter";this._pillStart.after(...this._filters.map((e,n)=>{const i=this.createElement("span",["nk-filter-pill","active"],{"data-pill":n}),s=this.createElement("button",[],{type:"button","data-edit":n});s.textContent=e.label??`${e.key}: ${e.value}`;const r=this.createElement("button",["fp-remove"],{type:"button","data-remove":n,"aria-label":`${t}: ${s.textContent}`});return r.textContent="ร",i.append(s,r),i}))}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-remove]");if(e)return this._filters.splice(Number(e.dataset.remove),1),this._sync(),void this._emitChange();const n=t.target.closest("[data-edit]");if(n){const t=Number(n.dataset.edit);return void this.emit("nk-action",{action:"edit",index:t,filter:this._filters[t],anchor:n})}const i=t.target.closest("[data-action]");i&&this.emit("nk-action",{action:i.dataset.action,anchor:i})},this._onInput=()=>{clearTimeout(this._debounce),this._debounce=setTimeout(()=>this._emitChange(),150)},this._row.addEventListener("click",this._onClick),this._input.addEventListener("input",this._onInput)}teardownEvents(){this._row?.removeEventListener("click",this._onClick),this._input?.removeEventListener("input",this._onInput),clearTimeout(this._debounce)}_emitChange(){this.emit("nk-change",{filters:[...this._filters],search:this._input.value})}onAttributeChanged(){this._sync()}get filters(){return this._filters}set filters(t){this._filters=Array.isArray(t)?t:[],this._row&&this._sync()}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}apply(t){const e=this.value.trim().toLowerCase();return t.filter(t=>this._filters.every(e=>"is-not"===e.op?t[e.key]!==e.value:t[e.key]===e.value)&&(!e||Object.values(t).some(t=>String("object"==typeof t&&t?t.name??"":t??"").toLowerCase().includes(e))))}}customElements.define("nk-filter-bar",Le);class Se extends p{static get observedAttributes(){return["placeholder","send-label","no-input","disabled"]}render(){const t=this.createElement("div",["nk-comments"]);t.appendChild(document.createElement("slot")),this._row=this.createElement("div",["nk-comment-input"]),this._input=this.createElement("input",["nk-input"],{type:"text","aria-label":"Comment"}),this._btn=this.createElement("button",["nk-btn","primary","small"],{type:"button"}),this._row.append(this._input,this._btn),t.appendChild(this._row),this._wrapper.appendChild(t),this._sync()}_sync(){this._input.placeholder=this.getAttribute("placeholder")||"Comment โฆ",this._btn.textContent=this.getAttribute("send-label")||"Send",this._row.style.display=this.getBoolAttr("no-input")?"none":"",this._input.disabled=this._btn.disabled=this.getBoolAttr("disabled")}setupEvents(){this._onSend=()=>this.submit(),this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this.submit())},this._btn.addEventListener("click",this._onSend),this._input.addEventListener("keydown",this._onKey)}teardownEvents(){this._btn?.removeEventListener("click",this._onSend),this._input?.removeEventListener("keydown",this._onKey)}submit(){const t=this._input.value.trim();if(!t)return;this.emit("nk-submit",{text:t})&&(this._input.value="")}onAttributeChanged(){this._sync()}focus(t){this._input?.focus(t)}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}}customElements.define("nk-comments",Se);class ze extends p{static get observedAttributes(){return["author","time","avatar","color"]}render(){const t=this.createElement("div",["nk-comment"]);this._avatar=this.createElement("span",["nk-avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar);const n=document.createElement("div");this._head=this.createElement("div",["c-head"]),this._author=document.createElement("b"),this._time=document.createTextNode(""),this._head.append(this._author,this.createElement("slot",[],{name:"head"}),this._time);const i=this.createElement("div",["c-body"]);i.appendChild(document.createElement("slot")),n.append(this._head,i),t.append(e,n),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("author")||"";this._author.textContent=t;const e=this.getAttribute("time");this._time.data=e?` ยท ${e}`:"",this._avatar.textContent=this.getAttribute("avatar")||At(t),wt(this._avatar,this.getAttribute("color"))}onAttributeChanged(){this._sync()}}customElements.define("nk-comment",ze);class Ne extends p{render(){const t=this.createElement("div",["nk-ai-thread"],{role:"log","aria-live":"polite"});t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-ai-thread",Ne);class Te extends p{static get observedAttributes(){return["role","name","badge","avatar","color","bubble"]}render(){this._box=this.createElement("div",["nk-ai-msg"]),this._avatar=this.createElement("span",["mini-avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar),this._avatarSlot=t;const e=this.createElement("div",["a-body"]);this._name=this.createElement("div",["a-name"]),this._nameText=document.createTextNode(""),this._badge=document.createElement("span"),this._name.append(this._nameText,this._badge),this._actions=this.createElement("div",["nk-ai-actions"]),this._actionSlot=this.createElement("slot",[],{name:"actions"}),this._actions.appendChild(this._actionSlot),e.append(this._name,document.createElement("slot"),this._actions),this._box.append(t,e),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t="user"===this.getAttribute("role"),e=this.getBoolAttr("bubble");this._box.classList.toggle("user",t),this._box.classList.toggle("bubble",e);const n=this.getAttribute("name");this._nameText.data=n||"";const i=this.getAttribute("badge");this._badge.textContent=i?` ${i}`:"",this._name.style.display=n&&!e?"":"none",this._avatarSlot.style.display=e?"none":"",this._avatar.textContent=this.getAttribute("avatar")||(t?(n||"U").slice(0,2).toUpperCase():"โจ");const s=this.getAttribute("color");this._avatar.style.background=s||"",this._actions.style.display=this._actionSlot.assignedElements().length?"":"none"}setupEvents(){this._onSlot=()=>this._sync(),this._onClick=t=>{const e=t.target.closest?.("button");e&&this._actionSlot.assignedElements().includes(e)&&this.emit("nk-action",{action:e.value||e.textContent.trim(),value:e.value||e.textContent.trim()})},this._actionSlot.addEventListener("slotchange",this._onSlot),this.addEventListener("click",this._onClick),this._sync()}teardownEvents(){this._actionSlot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}}customElements.define("nk-ai-msg",Te);class De extends p{static get observedAttributes(){return["placeholder","value","disabled","icon"]}render(){this._row=this.createElement("div",["nk-ai-input-row"]),this._icon=document.createElement("span"),this._icon.style.fontSize="14px",this._input=this.createElement("input",[],{type:"text","aria-label":"Message"}),this._btn=this.createElement("button",["nk-ai-send"],{type:"button","aria-label":"Send"}),this._btn.textContent="โ",this._row.append(this._icon,this._input,this._btn),this._wrapper.appendChild(this._row),this._sync()}_sync(){this._input.placeholder=this.getAttribute("placeholder")||"Ask something โฆ",this.hasAttribute("value")&&this._input.value!==this.getAttribute("value")&&(this._input.value=this.getAttribute("value")),this._input.disabled=this._btn.disabled=this.getBoolAttr("disabled");const t=this.getAttribute("icon")??"โจ";this._icon.textContent=t,this._icon.style.display=t?"":"none"}setupEvents(){this._onSend=()=>this.submit(),this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this.submit())},this._btn.addEventListener("click",this._onSend),this._input.addEventListener("keydown",this._onKey)}teardownEvents(){this._btn?.removeEventListener("click",this._onSend),this._input?.removeEventListener("keydown",this._onKey)}submit(){const t=this._input.value.trim();if(!t||this.getBoolAttr("disabled"))return;this.emit("nk-submit",{text:t})&&(this._input.value="")}onAttributeChanged(){this._sync()}focus(t){this._input?.focus(t)}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}}return customElements.define("nk-ai-input-row",De),t.NkAiInputRow=De,t.NkAiMsg=Te,t.NkAiThread=Ne,t.NkApp=U,t.NkAvatar=Et,t.NkAvatarGroup=ft,t.NkBanner=ct,t.NkBlockHost=lt,t.NkBoardView=Ce,t.NkBookmark=Ht,t.NkBreadcrumb=tt,t.NkBtn=g,t.NkCallout=q,t.NkCheck=A,t.NkCmdk=se,t.NkCode=R,t.NkComment=ze,t.NkComments=Se,t.NkCopyField=Gt,t.NkDangerZone=Nt,t.NkDatabase=ke,t.NkDivider=j,t.NkElement=p,t.NkEmojiPicker=ge,t.NkEmpty=dt,t.NkField=T,t.NkFields=D,t.NkFilterBar=Le,t.NkFormElement=u,t.NkHeading=I,t.NkImagePicker=Yt,t.NkInput=_,t.NkKbd=P,t.NkListView=Be,t.NkMemberList=Tt,t.NkMemberRow=Dt,t.NkMention=Bt,t.NkMenu=ae,t.NkMenuItem=le,t.NkModal=te,t.NkModelCard=St,t.NkPage=st,t.NkPageActions=at,t.NkPageCover=rt,t.NkPageTitle=ot,t.NkPanel=qt,t.NkPanels=Mt,t.NkPeek=Jt,t.NkPop=de,t.NkProfileRow=zt,t.NkProgress=M,t.NkProp=Ft,t.NkProps=Vt,t.NkQuote=$,t.NkRadio=L,t.NkSectionLabel=Q,t.NkSegmented=_t,t.NkSelect=y,t.NkSettingsPane=ee,t.NkSettingsUser=ne,t.NkSheet=Ut,t.NkSidebar=W,t.NkSkeleton=pt,t.NkSlider=z,t.NkStat=xt,t.NkStats=vt,t.NkSteps=Wt,t.NkSwitch=w,t.NkSynced=ut,t.NkTab=mt,t.NkTabBar=nt,t.NkTabBarItem=it,t.NkTableView=Ee,t.NkTabs=gt,t.NkTag=F,t.NkTemplateBtn=Lt,t.NkTextarea=f,t.NkThemeToggle=et,t.NkToast=me,t.NkTodo=K,t.NkToggle=O,t.NkTopbar=J,t.NkTree=Z,t.NkTreeItem=X,t.NkWorkspaceSwitcher=G,t.compareBy=Ae,t.componentsSheet=o,t.renderPropertyCell=fe,t.tagFor=xe,t}({});
|
|
1
|
+
var NotionKitElements=function(t){"use strict";const e=':root{color-scheme:light;--nk-bg: #ffffff;--nk-bg-sidebar: #f9f8f7;--nk-bg-hover: rgba(55,53,47,.06);--nk-bg-active: rgba(55,53,47,.08);--nk-bg-callout: #f0efed;--nk-bg-code: #f7f6f3;--nk-bg-card: #ffffff;--nk-bg-input: rgba(242,241,238,.6);--nk-text: #2c2c2b;--nk-text-secondary: #7d7a75;--nk-text-tertiary: #91918e;--nk-text-sidebar: #5f5e5b;--nk-border: rgba(28,19,1,.11);--nk-border-strong: rgba(27,21,0,.19);--nk-accent: #2383e2;--nk-on-accent: #ffffff;--nk-danger: #cd3c3a;--nk-tag-gray-bg: #e3e2e0;--nk-tag-gray-text: #32302c;--nk-tag-brown-bg: #eee0da;--nk-tag-brown-text: #442a1e;--nk-tag-orange-bg: #fadec9;--nk-tag-orange-text: #49290e;--nk-tag-yellow-bg: #fdecc8;--nk-tag-yellow-text: #402c1b;--nk-tag-green-bg: #dbeddb;--nk-tag-green-text: #1c3829;--nk-tag-blue-bg: #d3e5ef;--nk-tag-blue-text: #183347;--nk-tag-purple-bg: #e8deee;--nk-tag-purple-text: #412454;--nk-tag-pink-bg: #f5e0e9;--nk-tag-pink-text: #4c2337;--nk-tag-red-bg: #ffe2dd;--nk-tag-red-text: #5d1715;--nk-tint-gray: #f1f1ef;--nk-color-gray: #787774;--nk-tint-brown: #f4eeee;--nk-color-brown: #9f6b53;--nk-tint-orange: #fbecdd;--nk-color-orange: #d9730d;--nk-tint-yellow: #fbf3db;--nk-color-yellow: #cb912f;--nk-tint-green: #edf3ec;--nk-color-green: #448361;--nk-tint-blue: #e7f3f8;--nk-color-blue: #337ea9;--nk-tint-purple: #f8f3fc;--nk-color-purple: #9065b0;--nk-tint-pink: #fcf1f6;--nk-color-pink: #c14c8a;--nk-tint-red: #fdebec;--nk-color-red: #cd3c3a;--nk-decor-purple: #9065b0;--nk-decor-blue: #529cca;--nk-decor-orange: #d9730d;--nk-scrim: rgba(15,15,15,.6);--nk-scrim-soft: rgba(15,15,15,.5);--nk-sidebar-width: 260px;--nk-tab-bar-height: 58px;--nk-radius: 6px;--nk-font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Helvetica, Arial, sans-serif;--nk-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--nk-shadow-menu: rgba(15,15,15,.05) 0px 0px 0px 1px, rgba(15,15,15,.1) 0px 3px 6px, rgba(15,15,15,.2) 0px 9px 24px;--nk-shadow-card: 0 1px 2px rgba(0,0,0,.04);--nk-shadow-btn: inset 0 0 0 1px rgba(15,15,15,.1), 0 1px 2px rgba(15,15,15,.1);--nk-shadow-knob: 0 1px 2px rgba(0,0,0,.2);--nk-shadow-segment: 0 1px 2px rgba(0,0,0,.08)}[data-theme=dark]{color-scheme:dark;--nk-bg: #191919;--nk-bg-sidebar: #202020;--nk-bg-hover: rgba(255,255,255,.055);--nk-bg-active: rgba(255,255,255,.08);--nk-bg-callout: #252525;--nk-bg-code: #202020;--nk-bg-card: #202020;--nk-bg-input: rgba(255,255,255,.055);--nk-text: rgba(255,255,255,.81);--nk-text-secondary: rgba(255,255,255,.46);--nk-text-tertiary: rgba(255,255,255,.32);--nk-text-sidebar: rgba(255,255,255,.62);--nk-border: rgba(255,255,255,.094);--nk-border-strong: rgba(255,255,255,.16);--nk-accent: #529CCA;--nk-danger: #df5452;--nk-tag-gray-bg: #373737;--nk-tag-gray-text: rgba(255,255,255,.85);--nk-tag-brown-bg: #603b2c;--nk-tag-brown-text: rgba(255,255,255,.85);--nk-tag-orange-bg: #854c1d;--nk-tag-orange-text: rgba(255,255,255,.85);--nk-tag-yellow-bg: #89632a;--nk-tag-yellow-text: rgba(255,255,255,.85);--nk-tag-green-bg: #2b593f;--nk-tag-green-text: rgba(255,255,255,.85);--nk-tag-blue-bg: #28456c;--nk-tag-blue-text: rgba(255,255,255,.85);--nk-tag-purple-bg: #492f64;--nk-tag-purple-text: rgba(255,255,255,.85);--nk-tag-pink-bg: #69314c;--nk-tag-pink-text: rgba(255,255,255,.85);--nk-tag-red-bg: #6e3630;--nk-tag-red-text: rgba(255,255,255,.85);--nk-tint-gray: #252525;--nk-color-gray: #9b9b9b;--nk-tint-brown: #2e2724;--nk-color-brown: #ba856f;--nk-tint-orange: #36291f;--nk-color-orange: #c77d48;--nk-tint-yellow: #372e20;--nk-color-yellow: #ca8f3d;--nk-tint-green: #242b26;--nk-color-green: #529e72;--nk-tint-blue: #1f282d;--nk-color-blue: #5e87c9;--nk-tint-purple: #2a2430;--nk-color-purple: #9d68d3;--nk-tint-pink: #2e2328;--nk-color-pink: #d15796;--nk-tint-red: #332523;--nk-color-red: #df5452;--nk-shadow-menu: rgba(15,15,15,.2) 0px 0px 0px 1px, rgba(15,15,15,.4) 0px 3px 6px, rgba(15,15,15,.6) 0px 9px 24px;--nk-shadow-card: none;--nk-shadow-btn: inset 0 0 0 1px rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.3)}',n='[class*=nk-],[class*=nk-] *,[class*=nk-]:before,[class*=nk-]:after,[class*=nk-] *:before,[class*=nk-] *:after{box-sizing:border-box}[class*=nk-] :where(h1,h2,h3,h4,h5,h6,p,figure,blockquote,dl,dd,pre,ul,ol,li){margin:0;padding:0}[class*=nk-] :where(ul,ol){list-style:none}[class*=nk-] :where(button,input,select,textarea,option,optgroup,fieldset,legend),:where(button,input,select,textarea)[class*=nk-]{margin:0;padding:0}[class*=nk-][hidden]:not([hidden=until-found i]){display:none!important}::slotted([hidden]:not([hidden="until-found" i])){display:none!important}',i='.nk-body{margin:0;min-height:100vh;min-height:100dvh;font-family:var(--nk-font);font-size:14px;background:var(--nk-bg);color:var(--nk-text);-webkit-font-smoothing:auto;transition:background .25s ease,color .25s ease}.nk-app{display:flex;height:100vh;height:100dvh;overflow:hidden}.nk-sidebar{width:calc(var(--nk-sidebar-width) + env(safe-area-inset-left,0px));min-width:calc(var(--nk-sidebar-width) + env(safe-area-inset-left,0px));padding-left:env(safe-area-inset-left,0px);background:var(--nk-bg-sidebar);display:flex;flex-direction:column;border-right:1px solid var(--nk-border);transition:background .25s ease}.nk-workspace{display:flex;align-items:center;gap:8px;padding:10px 12px;margin:6px 8px 2px;border-radius:var(--nk-radius);cursor:pointer;font-weight:500;user-select:none}.nk-workspace:hover{background:var(--nk-bg-hover)}.nk-workspace .avatar,.nk-workspace ::slotted(.avatar),.nk-workspace ::slotted([slot="avatar"]){width:22px;height:22px;border-radius:4px;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:11px;font-weight:600;display:flex;align-items:center;justify-content:center}.nk-workspace .chev{margin-left:auto;color:var(--nk-text-tertiary);font-size:11px}.nk-sidebar-scroll{flex:1;overflow-y:auto;padding:4px 8px 16px}.nk-sidebar-scroll::-webkit-scrollbar{width:8px}.nk-sidebar-scroll::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:4px}.nk-section-label{font-size:12px;font-weight:500;letter-spacing:.01em;color:var(--nk-text-tertiary);padding:14px 10px 4px;display:flex;justify-content:space-between;align-items:center}.nk-section-label .plus{cursor:pointer;border-radius:4px;padding:0 4px;font-size:13px;opacity:0;transition:opacity .15s}.nk-section-label:hover .plus{opacity:1}.nk-section-label .plus:hover{background:var(--nk-bg-hover)}.nk-sidebar-footer{padding:8px;border-top:1px solid var(--nk-border);color:var(--nk-text-sidebar);font-size:14px}.nk-sidebar-footer .nk-tree-item{min-height:26px}.nk-sidebar-backdrop{display:none;position:fixed;inset:0;z-index:59;background:var(--nk-scrim-soft)}.nk-sidebar-toggle{display:none}.nk-main{flex:1;display:flex;flex-direction:column;min-width:0}.nk-topbar{height:44px;display:flex;align-items:center;padding:0 max(12px,env(safe-area-inset-right,0px)) 0 max(12px,env(safe-area-inset-left,0px));gap:8px;flex-shrink:0}.nk-breadcrumb{display:flex;align-items:center;gap:4px;font-size:14px}.nk-breadcrumb .crumb,.nk-breadcrumb ::slotted(.crumb){padding:2px 6px;border-radius:4px;cursor:pointer;color:var(--nk-text-sidebar);display:flex;align-items:center;gap:5px}.nk-breadcrumb .crumb:hover{background:var(--nk-bg-hover)}a.crumb{text-decoration:none}.nk-breadcrumb .crumb.current,.nk-breadcrumb ::slotted(.crumb.current){color:var(--nk-text)}.nk-breadcrumb .sep{color:var(--nk-text-tertiary);font-size:12px}.nk-topbar-actions{margin-left:auto;display:flex;align-items:center;gap:4px}.nk-topbar-btn{padding:4px 8px;border-radius:var(--nk-radius);cursor:pointer;color:var(--nk-text-sidebar);font-size:14px;user-select:none;border:none;background:transparent;font-family:inherit}.nk-topbar-btn:hover{background:var(--nk-bg-hover)}.nk-topbar-btn svg,.nk-topbar-btn ::slotted(svg){width:16px;height:16px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-share-btn{font-size:14px;padding:4px 8px}.nk-topbar-meta,.nk-topbar-actions ::slotted(.nk-topbar-meta){padding:4px 8px;font-size:12px;color:var(--nk-text-tertiary);white-space:nowrap}.nk-theme-toggle{font-size:15px;width:30px;height:28px;padding:0}.nk-tab-bar{display:none;flex:none;align-items:stretch;gap:2px;position:sticky;bottom:0;z-index:30;box-sizing:border-box;height:calc(var(--nk-tab-bar-height) - 6px + max(6px,env(safe-area-inset-bottom,0px)));padding:6px max(4px,env(safe-area-inset-right,0px)) max(6px,env(safe-area-inset-bottom,0px)) max(4px,env(safe-area-inset-left,0px));background:var(--nk-bg-sidebar);border-top:1px solid var(--nk-border)}.nk-tab-bar.always{display:flex}.nk-tab-bar.fixed{position:fixed;left:0;right:0;bottom:0}.nk-tab-bar-spacer{display:none;flex:none;height:calc(var(--nk-tab-bar-height) - 6px + max(6px,env(safe-area-inset-bottom,0px)))}.nk-tab-bar.always.fixed+.nk-tab-bar-spacer{display:block}.nk-tab-bar.floating{position:fixed;left:max(12px,env(safe-area-inset-left,0px));right:max(12px,env(safe-area-inset-right,0px));bottom:calc(12px + env(safe-area-inset-bottom,0px));height:var(--nk-tab-bar-height);padding:6px;border:1px solid var(--nk-border);border-radius:16px;box-shadow:var(--nk-shadow-menu)}.nk-tab-bar-item{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:4px 2px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:10.5px;line-height:1.2;color:var(--nk-text-secondary);text-decoration:none;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}.nk-tab-bar-item:hover{color:var(--nk-text);background:var(--nk-bg-hover)}.nk-tab-bar-item.active{color:var(--nk-accent)}.nk-tab-bar-item:disabled{opacity:.5;cursor:not-allowed}.nk-tab-bar-item .icon,.nk-tab-bar-item ::slotted([slot="icon"]){font-size:20px;line-height:1}.nk-tab-bar-item .label,.nk-tab-bar-item ::slotted(.label){max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-tree-item{display:flex;align-items:center;gap:6px;padding:3px 8px 3px 10px;border-radius:var(--nk-radius);cursor:pointer;user-select:none;color:var(--nk-text-sidebar);position:relative;min-height:var(--_nk-row, 28px)}.nk-tree-item:hover{background:var(--nk-bg-hover)}.nk-tree-item.active{background:var(--nk-bg-active);color:var(--nk-text);font-weight:500}.nk-tree-item.compact{min-height:26px}.nk-tree-item .icon,.nk-tree-item ::slotted(.icon),.nk-tree-item ::slotted([slot="icon"]){font-size:15px;width:20px;text-align:center;flex-shrink:0}.nk-tree-item .label,.nk-tree-item ::slotted(.label){white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-tree-item .actions{margin-left:auto;display:none;gap:2px;color:var(--nk-text-tertiary)}.nk-tree-item:hover .actions{display:flex}.nk-tree-item .actions span{padding:0 3px;border-radius:3px;font-size:12px}.nk-tree-item .actions span:hover{background:var(--nk-bg-active)}.nk-tree-children{margin-left:14px;border-left:1px solid var(--nk-border);padding-left:4px;overflow:hidden}.nk-tree-children.collapsed{display:none}.nk-toggle-arrow{width:16px;height:16px;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-size:9px;color:var(--nk-text-tertiary);border-radius:3px;transition:transform .15s}.nk-toggle-arrow.open{transform:rotate(90deg)}.nk-kbd-hint{margin-left:auto;display:flex;gap:3px;align-items:center}.nk-kbd{font-family:inherit;font-size:10.5px;background:var(--nk-bg-callout);border:1px solid var(--nk-border-strong);border-bottom-width:2px;border-radius:4px;padding:0 4px}.nk-page-scroll{flex:1;overflow-y:auto}.nk-page-scroll::-webkit-scrollbar{width:10px}.nk-page-scroll::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:5px;border:2px solid var(--nk-bg)}.nk-cover{height:200px;background:radial-gradient(ellipse at 20% 40%,color-mix(in srgb,var(--nk-decor-purple) 35%,transparent),transparent 55%),radial-gradient(ellipse at 80% 20%,color-mix(in srgb,var(--nk-decor-blue) 35%,transparent),transparent 55%),radial-gradient(ellipse at 60% 90%,color-mix(in srgb,var(--nk-decor-orange) 25%,transparent),transparent 55%),var(--nk-bg-callout)}.nk-cover>img,.nk-cover ::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.nk-page{max-width:760px;margin:0 auto;padding:24px max(64px,env(safe-area-inset-right,0px)) 120px max(64px,env(safe-area-inset-left,0px));font-size:16px;line-height:1.5}.nk-page.full{max-width:none}.nk-page.small{font-size:14px}.nk-cover+.nk-page,.nk-page.covered{padding-top:0}.nk-page-icon,.nk-page ::slotted(.nk-page-icon),.nk-page ::slotted([slot="icon"]){font-size:64px;line-height:1;margin-top:0;cursor:pointer;user-select:none;display:inline-block}.nk-cover+.nk-page .nk-page-icon,.nk-cover+.nk-page ::slotted(.nk-page-icon),.nk-cover+.nk-page ::slotted([slot="icon"]),.nk-page.covered .nk-page-icon,.nk-page.covered ::slotted(.nk-page-icon),.nk-page.covered ::slotted([slot="icon"]){margin-top:-42px}.nk-page-title{font-size:var(--_nk-title, 40px);font-weight:700;line-height:1.2;margin:8px 0 4px;outline:none;letter-spacing:0}.nk-page-meta{color:var(--nk-text-tertiary);font-size:13px;margin-bottom:24px;display:flex;gap:16px}.nk-props{display:flex;flex-direction:column;margin:0 0 20px;font-size:14px;line-height:1.5}.nk-prop{display:flex;align-items:flex-start;min-width:0}.nk-prop .p-name{flex:0 0 160px;min-width:0;min-height:34px;padding:0 6px;display:flex;align-items:center;gap:6px;overflow:hidden;border-radius:var(--nk-radius);color:var(--nk-text-secondary);white-space:nowrap;user-select:none}.nk-prop .p-icon,.nk-prop ::slotted([slot="icon"]){width:16px;flex-shrink:0;text-align:center;font-size:13px}.nk-prop .p-value{flex:1 1 auto;min-width:0;min-height:34px;padding:5px 8px;display:flex;align-items:center;flex-wrap:wrap;gap:4px 6px;border-radius:var(--nk-radius);overflow-wrap:anywhere}.nk-prop .p-name:hover,.nk-prop .p-value:hover{background:var(--nk-bg-hover)}.nk-page p.lead{font-size:1em;line-height:1.6;color:var(--nk-text-secondary);margin-bottom:20px}.nk-page ::slotted(p.lead){font-size:1em;line-height:1.6;color:var(--nk-text-secondary);margin-bottom:20px!important}.nk-heading{font-size:1.5em;font-weight:600;line-height:1.3;margin:32px 0 10px;display:flex;align-items:center;gap:8px}.nk-callout{display:flex;gap:10px;align-items:flex-start;background:var(--nk-bg-callout);border-radius:var(--nk-radius);padding:16px 16px 16px 12px;margin:16px 0;line-height:1.5}.nk-callout .c-icon,.nk-callout ::slotted(.c-icon),.nk-callout ::slotted([slot="icon"]){font-size:17px}.nk-bookmark{display:flex;min-width:0;margin:8px 0;overflow:hidden;border:1px solid var(--nk-border);border-radius:var(--nk-radius);color:var(--nk-text);text-decoration:none;transition:background .12s ease}.nk-bookmark:hover{background:var(--nk-bg-hover)}.nk-bookmark .bm-text{flex:1 1 0;min-width:0;padding:12px 14px 14px;font-size:14px;line-height:20px}.nk-bookmark .bm-title{display:block;min-height:24px;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-bookmark .bm-desc{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;max-height:32px;font-size:12px;line-height:16px;color:var(--nk-text-secondary)}.nk-bookmark .bm-url{display:flex;align-items:center;gap:6px;margin-top:6px;font-size:12px;line-height:16px;white-space:nowrap}.nk-bookmark .bm-url>span{min-width:0;overflow:hidden;text-overflow:ellipsis}.nk-bookmark .bm-favicon{flex:none;width:16px;height:16px}.nk-bookmark .bm-cover{position:relative;flex:0 0 33%;max-width:240px}.nk-bookmark .bm-cover>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.nk-todo{display:flex;align-items:flex-start;gap:8px;padding:4px 0}.nk-todo input[type=checkbox]{appearance:none;width:16px;height:16px;margin-top:3px;border:1.4px solid var(--nk-border-strong);border-radius:2px;cursor:pointer;flex-shrink:0;position:relative;background:var(--nk-bg)}.nk-todo input[type=checkbox]:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-todo input[type=checkbox]:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:11px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-todo input:checked+span{text-decoration:line-through;color:var(--nk-text-tertiary)}.nk-todo input:disabled{opacity:.5;cursor:not-allowed}.nk-toggle{margin:6px 0}.nk-toggle summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:6px;padding:4px 6px;border-radius:var(--nk-radius);font-weight:500;user-select:none}.nk-toggle summary::-webkit-details-marker{display:none}.nk-toggle summary:hover{background:var(--nk-bg-hover)}.nk-toggle summary:before{content:"\\25b8";color:var(--nk-text-tertiary);font-size:11px;transition:transform .15s;display:inline-block}.nk-toggle[open] summary:before{transform:rotate(90deg)}.nk-toggle .toggle-body,.nk-toggle ::slotted(.toggle-body){padding:4px 0 8px 26px;color:var(--nk-text-secondary);line-height:1.55}.nk-divider{border:none;border-top:1px solid var(--nk-border);margin:24px 0}.nk-quote{border-left:3px solid var(--nk-text);padding:2px 0 2px 14px;margin:16px 0;color:var(--nk-text-secondary);line-height:1.5}.nk-quote .q-cite{display:block;margin-top:6px;font-size:12.5px;color:var(--nk-text-tertiary)}.nk-mention{display:inline-flex;align-items:center;gap:4px;padding:0 4px;border-radius:4px;font-weight:500;cursor:pointer;white-space:nowrap}.nk-mention:hover{background:var(--nk-bg-hover)}.nk-mention.person{color:var(--nk-text)}.nk-mention.person .mini-avatar,.nk-mention.person .nk-avatar,.nk-mention.person ::slotted(.mini-avatar),.nk-mention.person ::slotted([slot="avatar"]){width:16px;height:16px;border-radius:50%;color:var(--nk-on-accent);font-size:8.5px;font-weight:600;display:inline-flex;align-items:center;justify-content:center}.nk-mention.page{color:var(--nk-text-secondary);text-decoration:underline;text-decoration-color:var(--nk-border-strong);text-underline-offset:2px}.nk-mention.date{color:var(--nk-color-orange)}.nk-inline-code{font-family:var(--nk-font-mono);font-size:85%;color:var(--nk-danger);background:color-mix(in srgb,var(--nk-danger) 8%,transparent);border-radius:4px;padding:1px 5px}.nk-code{background:var(--nk-bg-code);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:20px 24px;font-family:var(--nk-font-mono);font-size:13px;line-height:1.6;margin:14px 0;overflow-x:auto;color:var(--nk-text-secondary);white-space:pre;position:relative}.nk-code .lang{position:absolute;top:6px;right:10px;font-size:11px;color:var(--nk-text-tertiary);font-family:var(--nk-font)}.nk-code .tag,.nk-code ::slotted(.tag){color:var(--nk-accent)}.nk-code .attr,.nk-code ::slotted(.attr){color:var(--nk-color-orange)}.nk-database{margin:12px 0 8px}.nk-db-tabs{display:flex;gap:2px;align-items:center;padding:0 0 6px;margin-bottom:0;font-size:14px}.nk-db-tab{padding:4px 8px;cursor:pointer;color:var(--nk-text-secondary);border-radius:var(--nk-radius);user-select:none;line-height:20px;display:flex;align-items:center;gap:6px;flex-shrink:0;white-space:nowrap}.nk-db-tab:hover{color:var(--nk-text);background:var(--nk-bg-hover)}.nk-db-tab.active{color:var(--nk-text);background:var(--nk-bg-active);font-weight:500}.nk-db-tab.add{color:var(--nk-text-tertiary)}.nk-db-tab .badge,.nk-db-tab ::slotted(.badge){background:var(--nk-bg-callout);border-radius:8px;font-size:11px;padding:0 6px;color:var(--nk-text-tertiary)}.nk-db-toolbar{display:flex;align-items:center;gap:8px;min-width:0;padding-bottom:6px}.nk-db-toolbar>.nk-db-tabs{flex:1 1 auto;min-width:0;padding-bottom:0;overflow-x:auto;scrollbar-width:none}.nk-db-toolbar>.nk-db-tabs::-webkit-scrollbar{display:none}.nk-db-toolbar .tools{flex:none;display:flex;align-items:center;gap:4px;margin-left:auto}.nk-db-tool{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 8px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.nk-db-tool:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-db-tool.active{color:var(--nk-accent)}.nk-filter-row{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:2px 0 8px}.nk-filter-pill{display:inline-flex;align-items:center;gap:4px;height:24px;padding:0 8px;border:1px solid var(--nk-border-strong);border-radius:12px;background:transparent;font-family:inherit;font-size:13px;line-height:1;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.nk-filter-pill:hover{background:var(--nk-bg-hover)}.nk-filter-pill.active{color:var(--nk-accent);border-color:color-mix(in srgb,var(--nk-accent) 35%,transparent);background:color-mix(in srgb,var(--nk-accent) 6%,transparent)}.nk-filter-pill.add{border-color:transparent;color:var(--nk-text-tertiary)}.nk-filter-pill.add:hover{color:var(--nk-text-secondary)}.nk-filter-pill button{padding:0;border:none;background:none;font:inherit;color:inherit;cursor:pointer}.nk-filter-pill .fp-remove{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:-4px;border-radius:50%;font-size:13px}.nk-filter-pill .fp-remove:hover{background:color-mix(in srgb,currentColor 15%,transparent)}.nk-table-wrap{overflow-x:auto}.nk-table{width:100%;border-collapse:collapse;font-size:14px}.nk-table th{text-align:left;font-weight:400;color:var(--nk-text-secondary);height:36px;padding:0 8px;border-bottom:1px solid var(--nk-border);border-right:1px solid var(--nk-border);font-size:14px;white-space:nowrap;user-select:none;cursor:pointer}.nk-table th:hover{background:var(--nk-bg-hover)}.nk-table th .th-icon,.nk-table th ::slotted(.th-icon){margin-right:6px;font-size:13px;color:var(--nk-text-tertiary)}.nk-table td{height:36px;padding:6px 8px;line-height:1.5;border-bottom:1px solid var(--nk-border);border-right:1px solid var(--nk-border);white-space:nowrap;vertical-align:middle}.nk-table th:last-child,.nk-table td:last-child{border-right:none}.nk-table.wrap td,.nk-table td.wrap{white-space:normal;vertical-align:top}.nk-table tbody tr:hover{background:var(--nk-bg-hover)}.nk-table .row-title{display:flex;align-items:center;gap:7px;font-weight:500;cursor:pointer}.nk-table .row-title:hover{text-decoration:underline;text-decoration-color:var(--nk-text-tertiary)}.nk-table .date-cell{color:var(--nk-text-secondary)}.nk-table .num{text-align:right;font-variant-numeric:tabular-nums}.nk-table .person-cell{display:flex;align-items:center;gap:6px;color:var(--nk-text-secondary)}.nk-table .person-cell .mini-avatar,.nk-table .person-cell ::slotted(.mini-avatar){width:20px;height:20px;border-radius:50%;font-size:10px;color:var(--nk-on-accent);display:inline-flex;align-items:center;justify-content:center;font-weight:600}.nk-new-row,.nk-table .new-row{color:var(--nk-text-tertiary);cursor:pointer;padding:8px;display:flex;align-items:center;gap:7px;font-size:14px}.nk-new-row:hover,.nk-table .new-row:hover{background:var(--nk-bg-hover)}.nk-tag{display:inline-flex;align-items:center;max-width:100%;height:20px;padding:0 6px;border-radius:3px;font-size:14px;font-weight:400;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;background:var(--nk-tag-gray-bg);color:var(--nk-tag-gray-text)}.nk-tag.gray{background:var(--nk-tag-gray-bg);color:var(--nk-tag-gray-text)}.nk-tag.brown{background:var(--nk-tag-brown-bg);color:var(--nk-tag-brown-text)}.nk-tag.orange{background:var(--nk-tag-orange-bg);color:var(--nk-tag-orange-text)}.nk-tag.yellow{background:var(--nk-tag-yellow-bg);color:var(--nk-tag-yellow-text)}.nk-tag.green{background:var(--nk-tag-green-bg);color:var(--nk-tag-green-text)}.nk-tag.blue{background:var(--nk-tag-blue-bg);color:var(--nk-tag-blue-text)}.nk-tag.purple{background:var(--nk-tag-purple-bg);color:var(--nk-tag-purple-text)}.nk-tag.pink{background:var(--nk-tag-pink-bg);color:var(--nk-tag-pink-text)}.nk-tag.red{background:var(--nk-tag-red-bg);color:var(--nk-tag-red-text)}.nk-progress{width:110px;height:6px;border-radius:3px;background:var(--nk-tint-blue);overflow:hidden;display:inline-block}.nk-progress>i{display:block;height:100%;background:var(--nk-color-blue);border-radius:3px}.nk-progress.wide{width:100%;flex:1 1 60px}.nk-progress-label{font-size:12px;color:var(--nk-text-tertiary);margin-left:7px;white-space:nowrap}.nk-list{display:flex;flex-direction:column;font-size:14px}.nk-list-item{display:flex;align-items:center;gap:8px;min-width:0;overflow:hidden;min-height:36px;padding:4px 6px;border-bottom:1px solid var(--nk-border);color:inherit;text-decoration:none;cursor:pointer}.nk-list-item:hover{background:var(--nk-bg-hover)}.nk-list>.nk-list-item:last-child,.nk-list ::slotted(.nk-list-item:last-child),.nk-list-item.last{border-bottom:none}.nk-list-item .l-icon,.nk-list-item ::slotted([slot="icon"]){width:20px;flex-shrink:0;text-align:center;font-size:15px}.nk-list-item .l-title,.nk-list-item ::slotted(.l-title){flex:1 1 auto;min-width:0;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-list-item .l-meta,.nk-list-item ::slotted(.l-meta){flex:none;display:flex;align-items:center;gap:8px;margin-left:auto;font-size:12px;color:var(--nk-text-secondary);white-space:nowrap}.nk-calendar-view{font-size:14px}.nk-calendar-view .cv-head{display:flex;align-items:center;gap:4px;padding:2px 0 8px}.nk-calendar-view .cv-title{flex:1;font-weight:600;white-space:nowrap}.nk-calendar-view .cv-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border-top:1px solid var(--nk-border);border-left:1px solid var(--nk-border)}.nk-calendar-view.weeks .cv-grid{grid-template-columns:32px repeat(7,minmax(0,1fr))}.nk-calendar-view :is(.cv-wd,.cv-week,.cv-day){min-width:0;border-right:1px solid var(--nk-border);border-bottom:1px solid var(--nk-border)}.nk-calendar-view .cv-wd{padding:4px 8px;font-size:12px;color:var(--nk-text-secondary);text-align:center}.nk-calendar-view .cv-week{padding:6px 0;font-size:11px;color:var(--nk-text-tertiary);text-align:center;font-variant-numeric:tabular-nums}.nk-calendar-view .cv-day{display:flex;flex-direction:column;gap:3px;min-height:112px;padding:4px 4px 6px}.nk-calendar-view .cv-day:is(.out,.off){background:var(--nk-bg-sidebar)}.nk-calendar-view .cv-num{align-self:flex-end;min-width:22px;height:22px;padding:0 6px;border-radius:11px;font-size:13px;line-height:22px;text-align:center;color:var(--nk-text-secondary);font-variant-numeric:tabular-nums}.nk-calendar-view .cv-day.out .cv-num{color:var(--nk-text-tertiary)}.nk-calendar-view .cv-day.today .cv-num{background:var(--nk-danger);color:var(--nk-on-accent)}.nk-calendar-view .cv-item{display:block;min-width:0;padding:3px 6px;border-radius:4px;background:var(--nk-bg-card);border:1px solid var(--nk-border);box-shadow:var(--nk-shadow-card);font-size:12.5px;line-height:18px;color:var(--nk-text);text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.nk-calendar-view .cv-item:hover{background:var(--nk-bg-hover)}.nk-board{display:none;gap:12px;padding:14px 2px;overflow-x:auto}.nk-board.active{display:flex}.nk-board-col{min-width:220px;width:220px;flex-shrink:0}.nk-board-col-header{display:flex;align-items:center;gap:7px;margin-bottom:8px;font-size:13.5px;font-weight:500}.nk-board-col-header .count{color:var(--nk-text-tertiary);font-weight:400}.nk-card{background:var(--nk-bg-card);border:1px solid var(--nk-border);border-radius:8px;padding:10px 12px;margin-bottom:8px;cursor:grab;box-shadow:var(--nk-shadow-card);transition:border-color .15s}.nk-card:hover{border-color:var(--nk-border-strong)}.nk-card .card-title,.nk-card ::slotted(.card-title){font-weight:500;margin-bottom:7px;display:flex;gap:6px;align-items:center}.nk-card .card-meta,.nk-card ::slotted(.card-meta){display:flex;gap:6px;flex-wrap:wrap;align-items:center;font-size:12px;color:var(--nk-text-secondary)}.nk-field{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:9px 0}.nk-field .f-label,.nk-field ::slotted(.f-label),.nk-field ::slotted([slot="label"]){font-size:14px}.nk-field .f-desc,.nk-field ::slotted(.f-desc),.nk-field ::slotted([slot="desc"]){font-size:12px;color:var(--nk-text-secondary);margin-top:2px;line-height:1.45}.nk-field .f-control,.nk-field ::slotted(.f-control){flex-shrink:0}.nk-field.stacked,.nk-fields>.nk-field{flex-direction:column;align-items:stretch;gap:6px;min-width:0}.nk-field.stacked .f-control,.nk-fields>.nk-field .f-control{width:100%;min-width:0}.nk-field.stacked .nk-input,.nk-field.stacked .nk-textarea,.nk-field.stacked .nk-select,.nk-fields>.nk-field .nk-input,.nk-fields>.nk-field .nk-textarea,.nk-fields>.nk-field .nk-select{width:100%;min-width:0}.nk-field.compact,.nk-fields>.nk-field{padding:0;gap:4px;min-width:0}.nk-field.compact .f-label,.nk-field.compact ::slotted([slot="label"]),.nk-fields>.nk-field .f-label,.nk-fields>.nk-field ::slotted([slot="label"]){font-size:12px;color:var(--nk-text-tertiary)}.nk-fields{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px 12px;padding:9px 0}.nk-fields>.nk-field{min-width:0}.nk-input,.nk-select,.nk-textarea{font-family:inherit;font-size:14px;line-height:20px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:5px 10px;outline:none;transition:border-color .15s,box-shadow .15s;min-width:210px}.nk-input:hover,.nk-select:hover,.nk-textarea:hover{border-color:var(--nk-border-strong)}.nk-input:focus,.nk-select:focus,.nk-textarea:focus{border-color:color-mix(in srgb,var(--nk-accent) 60%,transparent);box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 30%,transparent)}.nk-input::placeholder,.nk-textarea::placeholder{color:var(--nk-text-tertiary)}.nk-input.wide,.nk-textarea.wide,.nk-select.wide{width:100%;min-width:0}.nk-input[type=date],.nk-input[type=time],.nk-input[type=datetime-local],.nk-input[type=month]{appearance:none}.nk-input::-webkit-date-and-time-value{text-align:start;min-height:1lh}.nk-select.compact{min-width:120px}.nk-textarea{resize:vertical;min-height:70px;line-height:1.5}.nk-select{appearance:none;cursor:pointer;padding-right:26px;background-image:linear-gradient(45deg,transparent 50%,var(--nk-text-tertiary) 50%),linear-gradient(135deg,var(--nk-text-tertiary) 50%,transparent 50%);background-position:calc(100% - 14px) 55%,calc(100% - 10px) 55%;background-size:4px 4px;background-repeat:no-repeat}.nk-copy-field{display:flex;align-items:center;gap:2px;min-width:210px;max-width:100%;padding:0 3px 0 10px;font-size:14px;line-height:20px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius)}.nk-copy-field.wide{width:100%;min-width:0}.nk-copy-field.wrap{align-items:flex-start}.nk-copy-field .cf-value{flex:1 1 auto;min-width:0;padding:5px 6px 5px 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.nk-copy-field.mono .cf-value{font-family:var(--nk-font-mono);font-size:13px}.nk-copy-field.wrap .cf-value{white-space:pre-wrap;overflow-wrap:anywhere}.nk-copy-field .cf-btn{flex:none;height:24px;margin:3px 0;padding:0 8px;border:none;border-radius:4px;background:transparent;font-family:inherit;font-size:13px;color:var(--nk-text-secondary);white-space:nowrap;cursor:pointer}.nk-copy-field .cf-btn:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-copy-field .cf-btn.copied{color:var(--nk-color-green)}.nk-calendar{display:block;width:max-content;max-width:100%;margin-inline:auto;font-size:14px;user-select:none;-webkit-user-select:none}.nk-calendar .cal-head{display:flex;align-items:center;gap:2px;padding:0 0 6px 6px}.nk-calendar .cal-title{flex:1;font-weight:600;white-space:nowrap}.nk-calendar .cal-nav,.nk-calendar-view .cal-nav{display:inline-flex;align-items:center;justify-content:center;height:28px;min-width:28px;padding:0 6px;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:13px;color:var(--nk-text-secondary);cursor:pointer}.nk-calendar .cal-nav:hover,.nk-calendar-view .cal-nav:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-calendar .cal-nav svg,.nk-calendar-view .cal-nav svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-calendar .cal-grid{display:grid;grid-template-columns:repeat(7,var(--_nk-cell, 36px));row-gap:2px}.nk-calendar.weeks .cal-grid{grid-template-columns:24px repeat(7,var(--_nk-cell, 36px))}.nk-calendar .cal-wd,.nk-calendar .cal-week{display:flex;align-items:center;justify-content:center;font-size:12px;color:var(--nk-text-tertiary);font-variant-numeric:tabular-nums}.nk-calendar .cal-wd{height:24px}.nk-calendar .cal-week{font-size:11px}.nk-calendar .cal-day{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--_nk-cell, 36px);height:var(--_nk-cell, 36px);padding:0;border:none;border-radius:var(--nk-radius);background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text);font-variant-numeric:tabular-nums;cursor:pointer}.nk-calendar .cal-day:hover{background:var(--nk-bg-hover)}.nk-calendar .cal-day:focus-visible{outline:2px solid color-mix(in srgb,var(--nk-accent) 60%,transparent);outline-offset:-2px}.nk-calendar .cal-day.out,.nk-calendar .cal-day.off{color:var(--nk-text-tertiary)}.nk-calendar .cal-day.today{color:var(--nk-danger);font-weight:600}.nk-calendar .cal-day.in-range{border-radius:0;background:color-mix(in srgb,var(--nk-accent) 12%,transparent)}.nk-calendar .cal-day:is(.selected,.start,.end){background:var(--nk-accent);color:var(--nk-on-accent);font-weight:500}.nk-calendar .cal-day.start:not(.end){border-radius:var(--nk-radius) 0 0 var(--nk-radius)}.nk-calendar .cal-day.end:not(.start){border-radius:0 var(--nk-radius) var(--nk-radius) 0}.nk-calendar .cal-day[aria-disabled=true]{color:var(--nk-text-tertiary);background:none;opacity:.5;cursor:default}.nk-calendar .cal-marks{position:absolute;left:0;right:0;bottom:3px;display:flex;justify-content:center;gap:2px;pointer-events:none}.nk-calendar .cal-marks i{width:4px;height:4px;border-radius:50%;background:var(--nk-color-gray)}.nk-calendar .cal-day:is(.selected,.start,.end) .cal-marks i{background:var(--nk-on-accent)}.nk-calendar .cal-foot{display:flex;align-items:center;gap:8px;margin-top:8px;padding:8px 2px 0;border-top:1px solid var(--nk-border)}.nk-calendar .cal-foot .nk-input{min-width:0;flex:1 1 auto}.nk-btn{font-family:inherit;font-size:14px;line-height:20px;font-weight:500;border-radius:var(--nk-radius);cursor:pointer;padding:3px 12px;border:1px solid transparent;transition:background .15s,border-color .15s,box-shadow .15s,opacity .15s;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}.nk-btn svg,.nk-btn ::slotted(svg){width:15px;height:15px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.nk-btn.primary{background:var(--nk-accent);color:var(--nk-on-accent)}.nk-btn.primary:hover{opacity:.88}.nk-btn.secondary{background:var(--nk-bg-card);color:var(--nk-text);box-shadow:var(--nk-shadow-btn)}.nk-btn.secondary:hover{background:color-mix(in srgb,var(--nk-bg-card),var(--nk-text) 6%)}.nk-btn.danger{background:var(--nk-bg-card);color:var(--nk-danger);box-shadow:var(--nk-shadow-btn)}.nk-btn.danger:hover{background:color-mix(in srgb,var(--nk-danger) 8%,var(--nk-bg-card))}.nk-btn.danger-solid{background:var(--nk-danger);color:var(--nk-on-accent)}.nk-btn.danger-solid:hover{opacity:.88}.nk-btn.small{padding:1px 8px;font-size:13px;line-height:20px}a.nk-btn{text-decoration:none}.nk-btn:disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.nk-switch{position:relative;width:34px;height:20px;flex-shrink:0;appearance:none;border:none;cursor:pointer;border-radius:20px;background:var(--nk-border-strong);transition:background .2s}.nk-switch:after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--nk-on-accent);transition:transform .2s;box-shadow:var(--nk-shadow-knob)}.nk-switch:checked,.nk-switch[aria-checked=true]{background:var(--nk-accent)}.nk-switch:checked:after,.nk-switch[aria-checked=true]:after{transform:translate(14px)}.nk-switch:disabled{opacity:.5;cursor:not-allowed}.nk-switch-label{display:inline-flex;align-items:flex-start;gap:8px;font-size:14px;cursor:pointer}.nk-switch-label>.nk-switch{font-size:inherit;line-height:inherit;margin-top:max(0px,calc((1lh - 20px)/2))}.nk-switch-label>span{padding-top:max(0px,calc((20px - 1lh)/2))}.nk-switch-label:has(.nk-switch:disabled){cursor:not-allowed;color:var(--nk-text-tertiary)}.nk-check{display:flex;align-items:flex-start;gap:8px;padding:4px 0;font-size:14px;cursor:pointer}.nk-check input{appearance:none;width:16px;height:16px;flex-shrink:0;border:1.4px solid var(--nk-border-strong);border-radius:3px;cursor:pointer;position:relative;background:var(--nk-bg);font-size:inherit;line-height:inherit;margin-top:max(0px,calc((1lh - 16px)/2))}.nk-check input[type=radio]{border-radius:50%}.nk-check input:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-check input:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:10.5px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-check input[type=radio]:checked:after{content:"\\25cf";font-size:7px}.nk-check input:disabled{opacity:.5;cursor:not-allowed}.nk-check input:disabled+*{opacity:.6}.nk-slider{width:210px;accent-color:var(--nk-accent);cursor:pointer}.nk-slider-value{font-size:12.5px;color:var(--nk-text-tertiary);margin-top:3px}.nk-profile-row{display:flex;align-items:center;gap:14px;padding:8px 0}.nk-profile-row .big-avatar,.nk-profile-row ::slotted(.big-avatar),.nk-profile-row ::slotted([slot="avatar"]){width:56px;height:56px;border-radius:50%;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:20px;font-weight:600;display:flex;align-items:center;justify-content:center;overflow:hidden;flex-shrink:0}.nk-profile-row .big-avatar>img{display:block;width:100%;height:100%;object-fit:cover}.nk-profile-row .big-avatar.square,.nk-profile-row ::slotted(.big-avatar.square){border-radius:8px}.nk-profile-row .pr-actions{display:flex;flex-direction:column;gap:6px}.nk-profile-row .pr-remove{color:var(--nk-text-tertiary)}.nk-model-card{border:1px solid var(--nk-border-strong);border-radius:8px;padding:12px 14px;margin-bottom:10px;cursor:pointer;display:flex;align-items:flex-start;gap:11px;transition:border-color .15s,background .15s}.nk-model-card:hover{background:var(--nk-bg-hover)}.nk-model-card.selected{border-color:var(--nk-accent);background:color-mix(in srgb,var(--nk-accent) 6%,transparent)}.nk-model-card .m-radio{width:15px;height:15px;border-radius:50%;flex-shrink:0;margin-top:2px;border:1.4px solid var(--nk-border-strong);position:relative}.nk-model-card.selected .m-radio{border-color:var(--nk-accent)}.nk-model-card.selected .m-radio:after{content:"";position:absolute;inset:3px;border-radius:50%;background:var(--nk-accent)}.nk-model-card .m-name,.nk-model-card ::slotted(.m-name),.nk-model-card ::slotted([slot="title"]){font-weight:500;font-size:14px;display:flex;align-items:center;gap:7px}.nk-model-card .m-desc,.nk-model-card ::slotted(.m-desc),.nk-model-card ::slotted([slot="desc"]){font-size:12px;color:var(--nk-text-secondary);margin-top:2px;line-height:1.45}.nk-danger-zone{border:1px solid color-mix(in srgb,var(--nk-danger) 40%,transparent);border-radius:8px;padding:14px 16px;margin-top:26px}.nk-danger-zone .dz-title{color:var(--nk-danger);font-weight:600;font-size:13px;margin-bottom:8px}.nk-member-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--nk-border)}.nk-member-list>.nk-member-row:last-child,.nk-member-list ::slotted(.nk-member-row:last-child),.nk-member-row.last{border-bottom:none}.nk-member-row .mini-avatar,.nk-member-row .nk-avatar,.nk-member-row ::slotted(.mini-avatar),.nk-member-row ::slotted([slot="avatar"]){width:28px;height:28px;border-radius:50%;color:var(--nk-on-accent);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;flex-shrink:0}.nk-member-row>:has(>.m-mail){min-width:0}.nk-member-row .m-mail{font-size:12px;color:var(--nk-text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nk-member-row .nk-select{min-width:120px;margin-left:auto}.nk-member-row ::slotted([slot="role"]){margin-left:auto}.nk-modal-backdrop{position:fixed;inset:0;background:var(--nk-scrim);padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);display:flex;align-items:center;justify-content:center;z-index:100;opacity:0;pointer-events:none;transition:opacity .2s ease}.nk-modal-backdrop.open{opacity:1;pointer-events:auto}.nk-modal{width:min(1150px,92vw);height:min(715px,86vh);max-width:100%;max-height:100%;background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);display:flex;overflow:hidden;transform:scale(.98) translateY(6px);transition:transform .2s ease}.nk-modal-backdrop.open .nk-modal{transform:scale(1) translateY(0)}.nk-settings-nav{width:240px;min-width:240px;background:var(--nk-bg-sidebar);border-right:1px solid var(--nk-border);padding:10px 8px;overflow-y:auto;flex-shrink:0}.nk-settings-user{display:flex;align-items:center;gap:9px;padding:6px 10px 12px;margin-bottom:4px}.nk-settings-user .avatar,.nk-settings-user ::slotted(.avatar),.nk-settings-user ::slotted([slot="avatar"]){width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-weight:600;font-size:13px;display:flex;align-items:center;justify-content:center}.nk-settings-user .name{font-weight:500;font-size:14px}.nk-settings-user .mail{font-size:12px;color:var(--nk-text-secondary)}.nk-settings-nav .nk-tree-item{min-height:28px}.nk-settings-nav .nk-tree-item.active{background:var(--nk-bg-active);color:var(--nk-text);font-weight:500}.nk-settings-content{flex:1;overflow-y:auto;padding:36px 60px 80px;min-width:0}.nk-settings-content::-webkit-scrollbar{width:10px}.nk-settings-content::-webkit-scrollbar-thumb{background:var(--nk-border-strong);border-radius:5px;border:2px solid var(--nk-bg)}.nk-settings-pane{display:none;max-width:800px}.nk-settings-pane.active{display:block}.nk-settings-pane>h2{font-size:22px;font-weight:600;line-height:1.3;margin-bottom:20px}.nk-settings-pane>h3{font-size:16px;font-weight:500;padding-bottom:8px;border-bottom:1px solid var(--nk-border);margin:30px 0 12px}.nk-settings-pane ::slotted(h2){font-size:22px;font-weight:600;line-height:1.3;padding:0!important;margin:0 0 20px!important}.nk-settings-pane ::slotted(h3){font-size:16px;font-weight:500;border:0;border-bottom:1px solid var(--nk-border);padding:0 0 8px!important;margin:30px 0 12px!important}.nk-pop{background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);padding:10px;width:296px}.nk-emoji-search{width:100%;font-family:inherit;font-size:14px;color:var(--nk-text);background:var(--nk-bg-input);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:6px 10px;outline:none;margin-bottom:8px}.nk-emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:2px}.nk-emoji-grid span,.nk-emoji-grid ::slotted(span){font-size:18px;text-align:center;padding:4px 0;border-radius:5px;cursor:pointer;user-select:none}.nk-emoji-grid span:hover{background:var(--nk-bg-hover)}.nk-emoji-cats{display:flex;gap:2px;margin-top:8px;padding-top:8px;border-top:1px solid var(--nk-border)}.nk-emoji-cats span{font-size:14px;padding:3px 7px;border-radius:5px;cursor:pointer;color:var(--nk-text-tertiary);filter:grayscale(1);opacity:.6}.nk-emoji-cats span.active,.nk-emoji-cats span:hover{filter:none;opacity:1;background:var(--nk-bg-hover)}.nk-menu{padding:5px;width:230px}.nk-menu-item{display:flex;align-items:center;gap:9px;padding:4px 8px;min-height:var(--_nk-row, 28px);border-radius:5px;cursor:pointer;font-size:14px;user-select:none}.nk-menu-item:hover{background:var(--nk-bg-hover)}.nk-menu-item .m-icon,.nk-menu-item ::slotted(.m-icon),.nk-menu-item ::slotted([slot="icon"]){width:17px;text-align:center;font-size:14px}.nk-menu-item .m-shortcut,.nk-menu-item ::slotted(.m-shortcut){margin-left:auto;font-size:12px;color:var(--nk-text-tertiary)}.nk-menu-item.danger{color:var(--nk-danger)}.nk-menu-item>.nk-switch{margin-left:auto}.nk-menu-sep{border-top:1px solid var(--nk-border);margin:5px 4px}.nk-menu-label{font-size:12px;color:var(--nk-text-tertiary);padding:5px 8px 2px}.nk-pop.floating{z-index:60;opacity:0;visibility:hidden;pointer-events:none;transform:translateY(-4px) scale(.98);transform-origin:top;transition:opacity .15s ease,transform .15s ease,visibility 0s linear .15s}.nk-pop.floating.open{opacity:1;visibility:visible;pointer-events:auto;transform:none;transition:opacity .15s ease,transform .15s ease,visibility 0s}.nk-cmdk-backdrop{position:fixed;inset:0;background:var(--nk-scrim-soft);display:flex;justify-content:center;align-items:flex-start;padding:max(14vh,env(safe-area-inset-top,0px)) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);z-index:110;opacity:0;pointer-events:none;transition:opacity .18s ease}.nk-cmdk-backdrop.open{opacity:1;pointer-events:auto}.nk-cmdk{max-width:100%;width:min(560px,92vw);background:var(--nk-bg);border-radius:12px;box-shadow:var(--nk-shadow-menu);overflow:hidden;transform:scale(.98);transition:transform .18s ease}.nk-cmdk-backdrop.open .nk-cmdk{transform:scale(1)}.nk-cmdk-input-row{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--nk-border)}.nk-cmdk-input-row input{flex:1;border:none;outline:none;background:transparent;font-family:inherit;font-size:16px;color:var(--nk-text)}.nk-cmdk-input-row input::placeholder{color:var(--nk-text-tertiary)}.nk-cmdk-list{max-height:320px;overflow-y:auto;padding:6px}.nk-cmdk-group{font-size:12px;color:var(--nk-text-tertiary);padding:8px 10px 3px}.nk-cmdk-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:6px;cursor:pointer;font-size:14px;user-select:none}.nk-cmdk-item.selected{background:var(--nk-bg-active)}.nk-cmdk-item .m-icon,.nk-cmdk-item ::slotted(.m-icon),.nk-cmdk-item ::slotted([slot="icon"]){width:17px;text-align:center;font-size:14px}.nk-cmdk-item .m-shortcut,.nk-cmdk-item ::slotted(.m-shortcut){margin-left:auto;font-size:12px;color:var(--nk-text-tertiary)}.nk-cmdk-empty{padding:30px;text-align:center;color:var(--nk-text-tertiary);font-size:13.5px}.nk-cmdk-footer{display:flex;gap:14px;padding:8px 16px;border-top:1px solid var(--nk-border);font-size:11.5px;color:var(--nk-text-tertiary)}.nk-sheet-backdrop{position:fixed;inset:0;z-index:100;display:none;flex-direction:column;align-items:center;justify-content:flex-end;padding-top:max(24px,env(safe-area-inset-top,0px));background:var(--nk-scrim-soft);opacity:0;transition:opacity .2s ease,display .25s allow-discrete}.nk-sheet-backdrop.open{display:flex;opacity:1}@starting-style{.nk-sheet-backdrop.open{opacity:0}}.nk-sheet{--_nk-row: 40px;width:100%;max-width:640px;max-height:100%;overflow-y:auto;overscroll-behavior:contain;padding:6px max(10px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px));background:var(--nk-bg);color:var(--nk-text);border-radius:14px 14px 0 0;box-shadow:var(--nk-shadow-menu);translate:0 100%;transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-sheet-backdrop.open .nk-sheet{translate:0 0}@starting-style{.nk-sheet-backdrop.open .nk-sheet{translate:0 100%}}.nk-sheet .sh-grabber,.nk-sheet ::slotted(.sh-grabber){width:36px;height:4px;margin:4px auto 10px;border-radius:2px;background:var(--nk-border-strong)}.nk-sheet .sh-title,.nk-sheet ::slotted(.sh-title){font-size:14px;font-weight:600;text-align:center;padding:0 8px 10px}.nk-peek-backdrop{position:fixed;inset:0;z-index:50;display:none;pointer-events:none;transition:background-color .2s ease,display .25s allow-discrete}.nk-peek-backdrop.open{display:block}.nk-peek{--_nk-title: 32px;position:absolute;top:0;right:0;bottom:0;width:min(560px,100%);display:flex;flex-direction:column;pointer-events:auto;outline:none;background:var(--nk-bg);color:var(--nk-text);box-shadow:var(--nk-shadow-menu);translate:100% 0;transition:translate .25s cubic-bezier(.2,.8,.2,1)}.nk-peek-backdrop.open .nk-peek{translate:0 0}@starting-style{.nk-peek-backdrop.open .nk-peek{translate:100% 0}}.nk-peek .pk-bar{flex:none;display:flex;align-items:center;gap:2px;height:44px;padding:0 12px}.nk-peek .pk-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 48px 64px;font-size:16px;line-height:1.5}.nk-toast{position:fixed;bottom:max(20px,calc(env(safe-area-inset-bottom,0px) + 12px));left:50%;transform:translate(-50%) translateY(80px);z-index:120;width:max-content;max-width:calc(100% - 32px);background:var(--nk-text);color:var(--nk-bg);padding:8px 16px;border-radius:8px;font-size:14px;opacity:0;transition:all .3s ease;pointer-events:none;box-shadow:var(--nk-shadow-menu);display:flex;gap:8px;align-items:center}.nk-toast.show{opacity:1;transform:translate(-50%) translateY(0)}.nk-gallery-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr));gap:20px 32px;margin:12px 0}.nk-g-item>h4{font-size:12px;font-weight:500;color:var(--nk-text-tertiary);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px}.nk-g-item ::slotted(h4){font-size:12px;font-weight:500;color:var(--nk-text-tertiary);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px!important}.nk-tabs{display:flex;gap:2px;border-bottom:1px solid var(--nk-border);font-size:14px}.nk-tab{padding:7px 11px;cursor:pointer;color:var(--nk-text-secondary);border-bottom:2px solid transparent;margin-bottom:-1px;user-select:none}.nk-tab:hover{color:var(--nk-text)}.nk-tab.active{color:var(--nk-text);border-bottom-color:var(--nk-text);font-weight:500}.nk-tab-panel{padding:12px 2px;color:var(--nk-text-secondary);line-height:1.55;font-size:14px}.nk-template-btn{display:flex;align-items:center;gap:8px;width:100%;font-family:inherit;font-size:14px;color:var(--nk-text-secondary);background:var(--nk-bg-callout);border:none;border-radius:var(--nk-radius);padding:8px 12px;cursor:pointer;margin-bottom:6px;text-align:left}.nk-template-btn:hover{background:var(--nk-bg-hover)}.nk-stats{display:flex;gap:10px}.nk-stat{flex:1;border:1px solid var(--nk-border);border-radius:8px;padding:12px 14px}.nk-stat .s-label,.nk-stat ::slotted(.s-label),.nk-stat ::slotted([slot="label"]){font-size:12px;color:var(--nk-text-secondary);margin-bottom:4px}.nk-stat .s-value,.nk-stat ::slotted(.s-value),.nk-stat ::slotted([slot="value"]){font-size:22px;font-weight:600;letter-spacing:-.01em}.nk-stat .s-delta,.nk-stat ::slotted(.s-delta),.nk-stat ::slotted([slot="delta"]){font-size:12px;margin-top:3px}.nk-stat .s-delta.up,.nk-stat ::slotted(.s-delta.up),.nk-stat ::slotted([slot="delta"].up){color:var(--nk-color-green)}.nk-stat .s-delta.down,.nk-stat ::slotted(.s-delta.down),.nk-stat ::slotted([slot="delta"].down){color:var(--nk-danger)}.nk-synced{border:1.5px solid color-mix(in srgb,var(--nk-danger) 55%,transparent);border-radius:8px;padding:12px 14px;position:relative;margin:8px 0}.nk-synced .synced-badge{position:absolute;top:-9px;right:10px;font-size:11px;background:var(--nk-danger);color:var(--nk-on-accent);border-radius:8px;padding:1px 8px}.nk-segmented{display:inline-flex;background:var(--nk-bg-callout);border-radius:7px;padding:2px}.nk-segmented button{font-family:inherit;font-size:14px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 12px;border-radius:5px;cursor:pointer}.nk-segmented ::slotted(button){font-family:inherit;font-size:14px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 12px!important;border-radius:5px;cursor:pointer}.nk-segmented button.active,.nk-segmented ::slotted(button.active){background:var(--nk-bg);color:var(--nk-text);font-weight:500;box-shadow:var(--nk-shadow-segment)}.nk-segmented.wrap{flex-wrap:wrap}.nk-segmented.scroll{max-width:100%;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}.nk-segmented.scroll::-webkit-scrollbar{display:none}.nk-segmented.scroll button,.nk-segmented.scroll ::slotted(button){flex-shrink:0;white-space:nowrap}.nk-banner{display:flex;align-items:center;gap:10px;font-size:14px;border-radius:8px;padding:10px 14px;margin-bottom:8px;color:var(--nk-text)}.nk-banner.info{background:var(--nk-tint-blue)}.nk-banner.success{background:var(--nk-tint-green)}.nk-banner.warning{background:var(--nk-tint-yellow)}.nk-banner.danger{background:var(--nk-tint-red)}.nk-banner .b-action,.nk-banner ::slotted(.b-action),.nk-banner ::slotted([slot="action"]){margin-left:auto;font-weight:500;cursor:pointer;text-decoration:underline;text-underline-offset:2px}.nk-avatar-group{display:flex}.nk-avatar-group .mini-avatar,.nk-avatar-group .nk-avatar,.nk-avatar-group ::slotted(.mini-avatar),.nk-avatar-group ::slotted(.nk-avatar){width:26px;height:26px;border-radius:50%;color:var(--nk-on-accent);font-size:10.5px;font-weight:600;border:2px solid var(--nk-bg);display:flex;align-items:center;justify-content:center;margin-left:-7px}.nk-avatar-group .mini-avatar:first-child,.nk-avatar-group .nk-avatar:first-child,.nk-avatar-group ::slotted(.mini-avatar:first-child),.nk-avatar-group ::slotted(.nk-avatar:first-child){margin-left:0}.nk-avatar-group .more,.nk-avatar-group ::slotted(.more){background:var(--nk-bg-callout);color:var(--nk-text-secondary)}.nk-avatar{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:24px;border-radius:50%;overflow:hidden;vertical-align:middle;font-size:10px;font-weight:600;line-height:1;color:var(--nk-on-accent);user-select:none;background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));object-fit:cover}.nk-avatar.small{width:20px;height:20px;font-size:9px}.nk-avatar.large{width:32px;height:32px;font-size:12px}.nk-avatar.xlarge{width:56px;height:56px;font-size:20px}.nk-avatar.square{border-radius:4px}.nk-avatar>img,.nk-avatar ::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.nk-avatar.gray,.nk-calendar .cal-marks i.gray{background:var(--nk-color-gray)}.nk-avatar.brown,.nk-calendar .cal-marks i.brown{background:var(--nk-color-brown)}.nk-avatar.orange,.nk-calendar .cal-marks i.orange{background:var(--nk-color-orange)}.nk-avatar.yellow,.nk-calendar .cal-marks i.yellow{background:var(--nk-color-yellow)}.nk-avatar.green,.nk-calendar .cal-marks i.green{background:var(--nk-color-green)}.nk-avatar.blue,.nk-calendar .cal-marks i.blue{background:var(--nk-color-blue)}.nk-avatar.purple,.nk-calendar .cal-marks i.purple{background:var(--nk-color-purple)}.nk-avatar.pink,.nk-calendar .cal-marks i.pink{background:var(--nk-color-pink)}.nk-avatar.red,.nk-calendar .cal-marks i.red{background:var(--nk-color-red)}.nk-panels{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));gap:12px;margin:12px 0}.nk-panel{display:flex;flex-direction:column;gap:6px;min-width:0;padding:14px 16px;border:1px solid var(--nk-border);border-radius:10px;background:var(--nk-bg-card);box-shadow:var(--nk-shadow-card);font-size:14px;line-height:1.5;color:inherit;text-decoration:none;text-align:left}:is(a,button).nk-panel{cursor:pointer;font-family:inherit;transition:border-color .15s,background .15s}:is(a,button).nk-panel:hover{border-color:var(--nk-border-strong)}.nk-panel>h3{font-size:14px;font-weight:600;line-height:1.4}.nk-panel ::slotted(h3){font-size:14px;font-weight:600;line-height:1.4;margin:0!important}.nk-panel>p{font-size:13px;color:var(--nk-text-secondary)}.nk-panel ::slotted(p){font-size:13px;color:var(--nk-text-secondary);margin:0!important}.nk-panel>.nk-cover{flex:none;height:64px;margin:-14px -16px 2px;border-radius:9px 9px 0 0}.nk-panel>.nk-page-icon{font-size:28px}.nk-panel>.nk-cover+.nk-page-icon{margin-top:-24px}.nk-skeleton{border-radius:5px;margin-bottom:10px;background:linear-gradient(90deg,var(--nk-bg-callout) 25%,var(--nk-bg-hover) 50%,var(--nk-bg-callout) 75%);background-size:200% 100%;animation:nk-shimmer 1.6s infinite}@keyframes nk-shimmer{to{background-position:-200% 0}}.nk-empty{text-align:center;padding:36px 20px;border:1.5px dashed var(--nk-border-strong);border-radius:10px;color:var(--nk-text-tertiary)}.nk-empty .e-icon,.nk-empty ::slotted(.e-icon),.nk-empty ::slotted([slot="icon"]){font-size:30px;margin-bottom:8px}.nk-empty .e-title,.nk-empty ::slotted(.e-title),.nk-empty ::slotted([slot="title"]){font-weight:500;color:var(--nk-text-secondary);margin-bottom:3px;font-size:14px}.nk-empty .e-desc,.nk-empty ::slotted(.e-desc),.nk-empty ::slotted([slot="desc"]){font-size:13px;margin-bottom:12px}.nk-empty .e-actions,.nk-empty ::slotted(.e-actions){display:flex;flex-wrap:wrap;justify-content:center;gap:8px}.nk-steps{display:flex;flex-direction:column;margin:8px 0;padding:0;list-style:none;font-size:14px}.nk-step{position:relative;display:flex;align-items:flex-start;gap:10px;padding-bottom:14px;line-height:20px;color:var(--nk-text-tertiary)}.nk-step:last-child{padding-bottom:0}.nk-step:not(:last-child):after{content:"";position:absolute;left:10px;top:24px;bottom:4px;width:1px;background:var(--nk-border)}.nk-step .st-mark{flex:none;width:20px;height:20px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--nk-border-strong);background:var(--nk-bg);font-size:11px;font-weight:600;line-height:1}.nk-step .st-desc{display:block;font-size:12px;line-height:18px;color:var(--nk-text-tertiary);font-weight:400}.nk-step.done{color:var(--nk-text-secondary)}.nk-step.done .st-mark{background:var(--nk-tag-green-bg);color:var(--nk-tag-green-text);border-color:transparent}.nk-step.current{color:var(--nk-text);font-weight:500}.nk-step.current .st-mark{border-color:var(--nk-accent);color:var(--nk-accent)}.nk-comments{border-left:1px solid var(--nk-border);padding:4px 0 4px 18px;margin:8px 0 8px 8px}.nk-comment{display:flex;gap:9px;margin-bottom:14px}.nk-comment .mini-avatar,.nk-comment ::slotted(.mini-avatar),.nk-comment ::slotted([slot="avatar"]){width:24px;height:24px;border-radius:50%;color:var(--nk-on-accent);flex-shrink:0;font-size:10px;font-weight:600;display:flex;align-items:center;justify-content:center}.nk-comment .c-head,.nk-comment ::slotted(.c-head){font-size:12px;color:var(--nk-text-tertiary);margin-bottom:2px}.nk-comment .c-head b{color:var(--nk-text);font-weight:600}.nk-comment .c-body,.nk-comment ::slotted(.c-body){font-size:14px;line-height:1.5}.nk-comment-input{display:flex;gap:8px;align-items:center;margin-top:4px}.nk-comment-input input{min-width:0;flex:1}.nk-ai-thread{display:flex;flex-direction:column;gap:14px}.nk-ai-msg{display:flex;gap:9px}.nk-ai-msg .mini-avatar,.nk-ai-msg ::slotted(.mini-avatar),.nk-ai-msg ::slotted([slot="avatar"]){width:24px;height:24px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:12px;background:var(--nk-bg-callout)}.nk-ai-msg.user .mini-avatar,.nk-ai-msg.user ::slotted(.mini-avatar),.nk-ai-msg.user ::slotted([slot="avatar"]){background:linear-gradient(135deg,var(--nk-decor-purple),var(--nk-decor-blue));color:var(--nk-on-accent);font-size:9.5px;font-weight:600}.nk-ai-msg .a-body,.nk-ai-msg ::slotted(.a-body){font-size:14px;line-height:1.55;padding-top:2px}.nk-ai-msg .a-name,.nk-ai-msg ::slotted(.a-name){font-size:12px;font-weight:600;margin-bottom:2px}.nk-ai-msg .a-name span{color:var(--nk-text-tertiary);font-weight:400}.nk-ai-msg.user.bubble{justify-content:flex-end}.nk-ai-msg.bubble .a-body,.nk-ai-msg.bubble ::slotted(.a-body){max-width:85%;padding:6px 12px;border-radius:16px;background:var(--nk-bg-callout)}.nk-ai-actions{display:flex;gap:4px;margin-top:6px}.nk-ai-actions button{font-family:inherit;font-size:12px;color:var(--nk-text-secondary);background:transparent;border:1px solid var(--nk-border);border-radius:5px;padding:2px 8px;cursor:pointer}.nk-ai-actions ::slotted(button){font-family:inherit;font-size:12px;color:var(--nk-text-secondary);background:transparent;border:1px solid var(--nk-border);border-radius:5px;padding:2px 8px!important;cursor:pointer}.nk-ai-actions button:hover,.nk-ai-actions ::slotted(button:hover){background:var(--nk-bg-hover);color:var(--nk-text)}.nk-ai-input-row{display:flex;align-items:center;gap:8px;margin-top:14px;border:1px solid var(--nk-border-strong);border-radius:10px;padding:8px 12px}.nk-ai-input-row:focus-within{border-color:var(--nk-accent)}.nk-ai-input-row input{flex:1;border:none;outline:none;background:transparent;font-family:inherit;font-size:14px;color:var(--nk-text);min-width:0}.nk-ai-input-row input::placeholder{color:var(--nk-text-tertiary)}.nk-ai-send{border:none;background:var(--nk-accent);color:var(--nk-on-accent);border-radius:6px;width:26px;height:26px;cursor:pointer;font-size:13px;flex-shrink:0}.nk-block-host{position:relative;border-radius:var(--nk-radius);margin:8px 0;padding:2px 0 2px 2px;transition:background .15s,box-shadow .15s}.nk-block-host:hover{background:var(--nk-bg-hover)}.nk-block-host:focus-within{background:transparent;box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 25%,transparent)}.nk-block-host.nk-drop-target{box-shadow:0 -2px 0 0 var(--nk-accent);background:transparent}.nk-block-host .nk-block-handle,.nk-block-host ::slotted(.nk-block-handle){position:absolute;left:-26px;top:4px;width:18px;height:20px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:var(--nk-text-tertiary);font-size:13px;cursor:grab;opacity:0;transition:opacity .15s;user-select:none}.nk-block-host:hover .nk-block-handle{opacity:1}.nk-block-host .nk-block-actions{position:absolute;display:flex;gap:1px;z-index:2;opacity:0;transition:opacity .15s;pointer-events:none}.nk-block-host .nk-block-actions.show{opacity:1;pointer-events:auto}.nk-block-host .nk-block-actions button,.nk-block-host .nk-block-actions ::slotted(button){width:20px;height:22px;padding:0;border:none;border-radius:4px;background:transparent;color:var(--nk-text-tertiary);font-family:inherit;font-size:14px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center}.nk-block-host .nk-block-actions button:hover{background:var(--nk-bg-hover);color:var(--nk-text)}.nk-block-host .nk-block-actions .drag{cursor:grab}.nk-block-host .nk-block-actions .drag:active{cursor:grabbing}.nk-prose,.nk-block-host .ProseMirror{font-family:var(--nk-font);line-height:1.5;color:var(--nk-text);overflow-wrap:break-word}.nk-block-host .ProseMirror{outline:none;min-height:60px;padding:4px 2px}.nk-prose>*+*,.nk-block-host .ProseMirror>*+*{margin-top:6px}.nk-prose h1,.nk-block-host .ProseMirror h1{font-size:1.875em;font-weight:600;line-height:1.3;letter-spacing:-.01em;margin:32px 0 4px}.nk-prose h2,.nk-block-host .ProseMirror h2{font-size:1.5em;font-weight:600;line-height:1.3;margin:24px 0 4px}.nk-prose h3,.nk-block-host .ProseMirror h3{font-size:1.25em;font-weight:600;line-height:1.3;margin:16px 0 2px}.nk-prose :is(h4,h5,h6),.nk-block-host .ProseMirror :is(h4,h5,h6){font-size:1em;font-weight:600;margin:12px 0 0}.nk-prose>:first-child,.nk-block-host .ProseMirror>:first-child{margin-top:0}.nk-prose>:last-child,.nk-block-host .ProseMirror>:last-child{margin-bottom:0}.nk-prose p:empty:before{content:"";display:inline-block}.nk-prose :is(strong,b),.nk-block-host .ProseMirror :is(strong,b){font-weight:600}.nk-prose :is(ul,ol),.nk-block-host .ProseMirror :is(ul,ol){padding-left:24px;margin:4px 0}.nk-prose ul,.nk-block-host .ProseMirror ul{list-style:disc}.nk-prose ol,.nk-block-host .ProseMirror ol{list-style:decimal}.nk-prose li,.nk-block-host .ProseMirror li{margin:2px 0}.nk-prose li::marker,.nk-block-host .ProseMirror li::marker{color:var(--nk-text-tertiary)}.nk-prose ul[data-type=taskList],.nk-block-host .ProseMirror ul[data-type=taskList]{list-style:none;padding-left:2px}.nk-prose ul[data-type=taskList] li,.nk-block-host .ProseMirror ul[data-type=taskList] li{display:flex;gap:8px;align-items:flex-start}.nk-prose ul[data-type=taskList] li>label,.nk-block-host .ProseMirror ul[data-type=taskList] li>label{flex-shrink:0;margin-top:max(0px,calc((1lh - 16px)/2));user-select:none}.nk-prose ul[data-type=taskList] li>div,.nk-block-host .ProseMirror ul[data-type=taskList] li>div{flex:1;min-width:0}.nk-prose ul[data-type=taskList] input[type=checkbox],.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]{appearance:none;width:16px;height:16px;margin:0;border:1.4px solid var(--nk-border-strong);border-radius:2px;cursor:pointer;position:relative;background:var(--nk-bg);display:block}.nk-prose ul[data-type=taskList] input[type=checkbox]:checked,.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]:checked{background:var(--nk-accent);border-color:var(--nk-accent)}.nk-prose ul[data-type=taskList] input[type=checkbox]:checked:after,.nk-block-host .ProseMirror ul[data-type=taskList] input[type=checkbox]:checked:after{content:"\\2713";color:var(--nk-on-accent);font-size:11px;position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.nk-prose li[data-checked=true]>div,.nk-block-host .ProseMirror li[data-checked=true]>div{text-decoration:line-through;color:var(--nk-text-tertiary)}.nk-prose blockquote,.nk-block-host .ProseMirror blockquote{border-left:3px solid var(--nk-text);padding:2px 0 2px 14px;margin:12px 0;color:var(--nk-text-secondary)}.nk-prose code,.nk-block-host .ProseMirror code{font-family:var(--nk-font-mono);font-size:85%;color:var(--nk-danger);background:color-mix(in srgb,var(--nk-danger) 8%,transparent);border-radius:4px;padding:1px 5px}.nk-prose pre,.nk-block-host .ProseMirror pre{background:var(--nk-bg-code);border:1px solid var(--nk-border);border-radius:var(--nk-radius);padding:16px 20px;margin:12px 0;font-family:var(--nk-font-mono);font-size:13px;line-height:1.6;color:var(--nk-text-secondary);overflow-x:auto}.nk-prose pre code,.nk-block-host .ProseMirror pre code{background:none;color:inherit;padding:0;font-size:inherit}.nk-prose hr,.nk-block-host .ProseMirror hr{border:none;border-top:1px solid var(--nk-border);margin:20px 0}.nk-prose a,.nk-block-host .ProseMirror a{color:var(--nk-accent);text-decoration:underline;text-underline-offset:2px}.nk-prose img{max-width:100%;height:auto}.nk-prose table{display:block;width:max-content;max-width:100%;overflow-x:auto;border-collapse:collapse;font-size:14px;margin:12px 0}.nk-prose :is(th,td){padding:6px 10px;border:1px solid var(--nk-border);text-align:left;vertical-align:top}.nk-prose th{font-weight:600}.nk-block-host .ProseMirror-gapcursor:after{border-top-color:var(--nk-text)}.nk-block-host .ProseMirror .ProseMirror-selectednode{background:color-mix(in srgb,var(--nk-accent) 8%,transparent)}.nk-block-host .ProseMirror-selectednode{box-shadow:0 0 0 2px color-mix(in srgb,var(--nk-accent) 35%,transparent);border-radius:3px}.nk-block-host .ProseMirror ::selection{background:color-mix(in srgb,var(--nk-accent) 25%,transparent)}.nk-block-host .ProseMirror p.is-editor-empty:first-child:before,.nk-block-host .ProseMirror .is-empty:before{content:attr(data-placeholder);color:var(--nk-text-tertiary);float:left;height:0;pointer-events:none}.nk-block-host .bn-container{font-family:var(--nk-font);color:var(--nk-text);background:transparent}.nk-block-host .bn-editor{padding:4px 2px}.nk-block-host .bn-block-content{font-size:14px;line-height:1.6}.nk-block-host .bn-side-menu{color:var(--nk-text-tertiary)}.nk-block-host .bn-drag-handle{border-radius:4px}.nk-block-host .bn-drag-handle:hover{background:var(--nk-bg-hover)}.nk-block-host .novel-editor{font-family:var(--nk-font);color:var(--nk-text)}.nk-block-host .novel-prose{max-width:none}.nk-slash-menu,.nk-block-host .bn-suggestion-menu,.nk-block-host .tippy-box{background:var(--nk-bg);border-radius:10px;box-shadow:var(--nk-shadow-menu);padding:6px;width:280px;max-height:320px;overflow-y:auto;font-family:var(--nk-font);font-size:14px;color:var(--nk-text)}.nk-slash-menu-label{font-size:12px;color:var(--nk-text-tertiary);padding:6px 9px 2px}.nk-slash-item{display:flex;align-items:center;gap:10px;padding:6px 9px;border-radius:5px;cursor:pointer;user-select:none}.nk-slash-item:hover,.nk-slash-item.selected{background:var(--nk-bg-hover)}.nk-slash-item .m-icon,.nk-slash-item ::slotted(.m-icon){width:28px;height:28px;flex-shrink:0;border-radius:4px;background:var(--nk-bg-callout);border:1px solid var(--nk-border);display:flex;align-items:center;justify-content:center;font-size:15px}.nk-slash-item .m-desc{font-size:12px;color:var(--nk-text-tertiary)}.nk-bubble-menu{display:flex;align-items:center;gap:2px;background:var(--nk-bg);border-radius:8px;box-shadow:var(--nk-shadow-menu);padding:4px}.nk-bubble-menu button{font-family:inherit;font-size:13px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 8px;border-radius:5px;cursor:pointer}.nk-bubble-menu ::slotted(button){font-family:inherit;font-size:13px;border:none;background:transparent;color:var(--nk-text-secondary);padding:4px 8px!important;border-radius:5px;cursor:pointer}.nk-bubble-menu button:hover,.nk-bubble-menu ::slotted(button:hover){background:var(--nk-bg-hover);color:var(--nk-text)}.nk-bubble-menu button.active,.nk-bubble-menu ::slotted(button.active){color:var(--nk-accent)}@media(max-width:860px){.nk-sidebar{display:none;position:fixed;inset:0 auto 0 0;z-index:60;transform:translate(-100%);transition:background .25s ease,transform .24s cubic-bezier(.2,.8,.25,1),display .24s allow-discrete}.nk-sidebar.open{display:flex;transform:none}@starting-style{.nk-sidebar.open{transform:translate(-100%)}}.nk-sidebar-backdrop{opacity:0;transition:opacity .24s ease,display .24s allow-discrete}.nk-sidebar-backdrop.open{display:block;opacity:1}@starting-style{.nk-sidebar-backdrop.open{opacity:0}}.nk-sidebar-toggle{display:inline-flex}.nk-tab-bar{display:flex}.nk-tab-bar.fixed+.nk-tab-bar-spacer{display:block}.nk-page{padding-left:max(24px,env(safe-area-inset-left,0px));padding-right:max(24px,env(safe-area-inset-right,0px));padding-bottom:80px}.nk-settings-nav{width:60px;min-width:60px}.nk-settings-nav .label,.nk-settings-nav .nk-section-label,.nk-settings-user .u-text{display:none}.nk-settings-content{padding:24px}.nk-cmdk-backdrop{padding-top:max(6vh,env(safe-area-inset-top,0px))}.nk-cmdk{width:min(560px,96vw)}.nk-stats{flex-wrap:wrap}.nk-breadcrumb{min-width:0}.nk-breadcrumb>.crumb:not(:last-child),.nk-breadcrumb ::slotted(.crumb:not(:last-child)),.nk-breadcrumb>.sep,.nk-breadcrumb ::slotted(.sep),.nk-topbar-meta,.nk-topbar-actions ::slotted(.nk-topbar-meta){display:none}.nk-breadcrumb>.crumb:last-child,.nk-breadcrumb ::slotted(.crumb:last-child){display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nk-topbar-actions{flex-shrink:0}.nk-field{flex-wrap:wrap;row-gap:6px}.nk-field .f-control,.nk-field ::slotted(.f-control){max-width:100%;min-width:0}.nk-input,.nk-select,.nk-textarea,.nk-slider{max-width:100%}.nk-prop{flex-direction:column;align-items:stretch}.nk-prop .p-name{flex:none;min-height:26px}.nk-prop .p-value{min-height:30px;padding:3px 6px 7px}.nk-pop.sheet{position:fixed!important;inset:auto 0 0!important;width:auto!important;transform:none!important;z-index:100;--_nk-row: 40px;max-height:85dvh;overflow-y:auto;overscroll-behavior:contain;border-radius:14px 14px 0 0;padding:6px max(8px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));box-shadow:0 0 0 100vmax var(--nk-scrim-soft),var(--nk-shadow-menu)}.nk-pop.sheet:before{content:"";display:block;width:36px;height:4px;margin:4px auto 8px;border-radius:2px;background:var(--nk-border-strong)}.nk-pop.sheet.floating{translate:0 100%;transition:opacity .2s ease,translate .25s cubic-bezier(.2,.8,.2,1),visibility 0s linear .25s}.nk-pop.sheet.floating.open{translate:0 0;transition:opacity .2s ease,translate .25s cubic-bezier(.2,.8,.2,1),visibility 0s}.nk-pop.sheet,.nk-sheet{--_nk-cell: 44px}.nk-calendar-view .cv-day{min-height:64px;padding:2px 2px 4px}.nk-calendar-view .cv-item{padding:1px 4px;font-size:11px;line-height:16px}.nk-peek-backdrop{pointer-events:auto}.nk-peek-backdrop.open{background-color:var(--nk-scrim-soft)}@starting-style{.nk-peek-backdrop.open{background-color:transparent}}.nk-peek{--_nk-title: 28px;top:auto;left:0;width:auto;max-height:92dvh;border-radius:14px 14px 0 0;translate:0 100%}.nk-peek-backdrop.open .nk-peek{translate:0 0}@starting-style{.nk-peek-backdrop.open .nk-peek{translate:0 100%}}.nk-peek:before{content:"";flex:none;width:36px;height:4px;margin:10px auto 0;border-radius:2px;background:var(--nk-border-strong)}.nk-peek .pk-bar{height:40px;padding:0 max(8px,env(safe-area-inset-right,0px)) 0 max(8px,env(safe-area-inset-left,0px))}.nk-peek .pk-body{padding:0 max(20px,env(safe-area-inset-right,0px)) max(24px,env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px))}:root:has(.nk-tab-bar:not([hidden])) .nk-toast{bottom:calc(var(--nk-tab-bar-height) + max(6px,env(safe-area-inset-bottom,0px)) + 6px)}:root:has(.nk-tab-bar.floating:not([hidden])) .nk-toast{bottom:calc(var(--nk-tab-bar-height) + 24px + env(safe-area-inset-bottom,0px))}}@media(prefers-reduced-motion:reduce){.nk-skeleton{animation:none;background:var(--nk-bg-callout)}[class*=nk-],[class*=nk-]:before,[class*=nk-]:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}\n/*# sourceMappingURL=notionkit.min.css.map */\n',s=n+i,r=n+e+i;(new CSSStyleSheet).replaceSync(r);(new CSSStyleSheet).replaceSync(e);const o=new CSSStyleSheet;o.replaceSync(s);const a="__nkDefaultTokensInjected";!function(){if("undefined"==typeof document)return;if(globalThis[a])return;globalThis[a]=!0;const t=new CSSStyleSheet;t.replaceSync(`@layer notionkit-defaults { ${e} }`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}();const l=new Set;function h(){return document.documentElement.getAttribute("data-theme")||"light"}"undefined"!=typeof window&&"undefined"!=typeof MutationObserver&&new MutationObserver(function(){const t=h();for(const e of l)e._syncTheme(t)}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});const c=new Map;function d(t){let e=c.get(t);return e||(e=new CSSStyleSheet,e.replaceSync(`\n :host { display: ${t}; }\n :host([hidden]) { display: none; }\n .nk-wrapper { display: contents; }\n `),c.set(t,e)),e}class p extends HTMLElement{static get display(){return"contents"}static get hostStyles(){return null}static get observesLightDom(){return!1}static get lightDomObserverInit(){return{childList:!0,subtree:!0,characterData:!0,attributes:!0}}static get slotAssignment(){return"named"}static get observedAttributes(){return[]}constructor(){super(),this._initialized=!1,this._shadow=this.attachShadow({mode:"open",slotAssignment:this.constructor.slotAssignment});const t=[o,d(this.constructor.display)],e=this.constructor.hostStyles;e&&t.push(e),this._shadow.adoptedStyleSheets=t}connectedCallback(){this._initialized?this._wrapper.setAttribute("data-theme",h()):(this._upgradeOwnProperties(),this._initialized=!0,this._wrapper=document.createElement("div"),this._wrapper.className="nk-wrapper",this._wrapper.setAttribute("data-theme",h()),this._shadow.appendChild(this._wrapper),this.render()),this.setupEvents(),l.add(this),this.constructor.observesLightDom&&(this._lightDomObserver??=new MutationObserver(t=>this.projectLightDom(t)),this._lightDomObserver.observe(this,this.constructor.lightDomObserverInit)),"manual"===this.constructor.slotAssignment&&(this.assignSlots(),this._slotObserver??=new MutationObserver(()=>this.assignSlots()),this._slotObserver.observe(this,{childList:!0}))}disconnectedCallback(){l.delete(this),this._lightDomObserver?.disconnect(),this._slotObserver?.disconnect(),this.teardownEvents()}attributeChangedCallback(t,e,n){this._initialized&&e!==n&&this.onAttributeChanged(t,e,n)}_syncTheme(t){this._wrapper?.setAttribute("data-theme",t)}_upgradeOwnProperties(){for(const t of Object.keys(this)){if(t.startsWith("_"))continue;let e,n=Object.getPrototypeOf(this);for(;n&&n!==HTMLElement.prototype&&!(e=Object.getOwnPropertyDescriptor(n,t));)n=Object.getPrototypeOf(n);if(!e?.set)continue;const i=this[t];delete this[t],this[t]=i}}render(){}setupEvents(){}teardownEvents(){}onAttributeChanged(t,e,n){}projectLightDom(){}assignSlots(){}refresh(){this.projectLightDom(),"manual"===this.constructor.slotAssignment&&this.assignSlots()}takeTitle(t=this.getAttribute("title")){return null!==t&&(this._titleText=t,this.removeAttribute("title"),!0)}getBoolAttr(t){return this.hasAttribute(t)}setBoolAttr(t,e){e?this.setAttribute(t,""):this.removeAttribute(t)}createElement(t,e=[],n={}){const i=document.createElement(t);e.length&&i.classList.add(...e);for(const[t,e]of Object.entries(n))null!=e&&!1!==e&&i.setAttribute(t,!0===e?"":e);return i}emit(t,e=null){return this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,cancelable:!0,detail:e}))}}class u extends p{static formAssociated=!0;constructor(){super(),this._internals=this.attachInternals()}get form(){return this._internals.form}get validationMessage(){return this._internals.validationMessage}get validity(){return this._internals.validity}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}connectedCallback(){const t=!this._initialized;super.connectedCallback(),t&&this._formDisabled&&this.onFormDisabled(!0)}formResetCallback(){this.resetValue()}formStateRestoreCallback(t,e){this.restoreValue(t,e)}formDisabledCallback(t){this._formDisabled=t,this._initialized&&this.onFormDisabled(t)}resetValue(){}restoreValue(t,e){}onFormDisabled(t){}setFormValue(t,e){this._internals.setFormValue(t,e)}setValidity(t,e,n){this._internals.setValidity(t,e,n)}syncValidityFrom(t){t&&(t.validity.valid?this._internals.setValidity({}):this._internals.setValidity(t.validity,t.validationMessage,t))}}const g=["primary","secondary","danger","danger-solid","topbar","share"];class b extends p{static get observedAttributes(){return["variant","small","disabled","type","href","title","aria-label","aria-haspopup","active"]}render(){this._build()}_build(){const t=this.getAttribute("href"),e=t?this.createElement("a",[],{href:t}):this.createElement("button",[],{type:this.getAttribute("type")||"button"});e.className=this._computeClasses().join(" "),e.appendChild(document.createElement("slot")),this._applyState(e),this._btn?(this._btn.removeEventListener("click",this._onClick),this._btn.replaceWith(e)):this._wrapper.appendChild(e),this._btn=e,this._onClick&&e.addEventListener("click",this._onClick)}_applyState(t){const e=this.getBoolAttr("disabled");"BUTTON"===t.tagName?t.disabled=e:t.setAttribute("aria-disabled",e?"true":"false");const n=this.getAttribute("title");n?t.setAttribute("title",n):t.removeAttribute("title");for(const e of["aria-label","aria-haspopup"]){const n=this.getAttribute(e);n?t.setAttribute(e,n):t.removeAttribute(e)}"sidebar"===this.getAttribute("variant")?t.setAttribute("aria-expanded",this._sidebar()?.open?"true":"false"):t.removeAttribute("aria-expanded")}_sidebar(){return this.closest("nk-app")?.querySelector("nk-sidebar")??document.querySelector("nk-sidebar")}setupEvents(){this._onClick=t=>{if(this.getBoolAttr("disabled"))return t.preventDefault(),void t.stopPropagation();if("sidebar"===this.getAttribute("variant"))return void this._sidebar()?.toggle?.();const e=this.getAttribute("type");if("submit"===e||"reset"===e){const t=this.closest("form");t&&("submit"===e?t.requestSubmit():t.reset())}},this._onToggle=t=>{"sidebar"===this.getAttribute("variant")&&t.target===this._sidebar()&&this._btn.setAttribute("aria-expanded",t.detail.open?"true":"false")},this._btn.addEventListener("click",this._onClick),document.addEventListener("nk-toggle",this._onToggle)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),document.removeEventListener("nk-toggle",this._onToggle)}onAttributeChanged(t){if(this._btn)switch(t){case"href":this._build();break;case"variant":this._btn.className=this._computeClasses().join(" "),this._applyState(this._btn);break;case"small":case"active":this._btn.className=this._computeClasses().join(" ");break;case"type":"BUTTON"===this._btn.tagName&&this._btn.setAttribute("type",this.getAttribute("type")||"button");break;default:this._applyState(this._btn)}}_computeClasses(){const t=this.getAttribute("variant");if("topbar"===t)return["nk-topbar-btn"];if("share"===t)return["nk-topbar-btn","nk-share-btn"];if("sidebar"===t)return["nk-topbar-btn","nk-sidebar-toggle"];if("tool"===t)return this.getBoolAttr("active")?["nk-db-tool","active"]:["nk-db-tool"];const e=["nk-btn"];return g.includes(t)&&e.push(t),this.getBoolAttr("small")&&e.push("small"),e}focus(t){this._btn?.focus(t)}click(){this._btn?.click()}get variant(){return this.getAttribute("variant")}set variant(t){t?this.setAttribute("variant",t):this.removeAttribute("variant")}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get small(){return this.getBoolAttr("small")}set small(t){this.setBoolAttr("small",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get type(){return this.getAttribute("type")||"button"}set type(t){this.setAttribute("type",t)}get href(){return this.getAttribute("href")}set href(t){t?this.setAttribute("href",t):this.removeAttribute("href")}}customElements.define("nk-btn",b);const m=["type","placeholder","name","min","max","step","autocomplete","pattern","maxlength","minlength","inputmode","list","aria-label"],k=["required","disabled","readonly"];class _ extends u{static get observedAttributes(){return["value","wide",...m,...k]}render(){this._input=this.createElement("input",["nk-input"]);for(const t of m)this._forward(t);for(const t of k)this._forward(t);this._input.value=this.getAttribute("value")??"",this._defaultValue=this._input.value,this._syncWide(),this._wrapper.appendChild(this._input),this._syncFormValue()}_forward(t){if(k.includes(t))return void(this._input["readonly"===t?"readOnly":t]=this.getBoolAttr(t)||"disabled"===t&&!!this._formDisabled);const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}_syncWide(){this._input.classList.toggle("wide",this.getBoolAttr("wide"))}setupEvents(){this._onInput=()=>{this._syncFormValue(),this.emit("nk-input",{value:this._input.value,name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._input)return"value"===t?(this._input.value=this.getAttribute("value")??"",void this._syncFormValue()):void("wide"!==t?(this._forward(t),this._syncFormValue()):this._syncWide())}_syncFormValue(){this.setFormValue(this._input.value),this.syncValidityFrom(this._input)}resetValue(){this._input.value=this.getAttribute("value")??"",this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncFormValue())}onFormDisabled(t){this._input.disabled=t||this.getBoolAttr("disabled")}focus(t){this._input?.focus(t)}blur(){this._input?.blur()}select(){this._input?.select()}get value(){return this._input?.value??this.getAttribute("value")??""}set value(t){this._input?(this._input.value=t??"",this._syncFormValue()):this.setAttribute("value",t??"")}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get type(){return this.getAttribute("type")||"text"}set type(t){this.setAttribute("type",t)}get placeholder(){return this.getAttribute("placeholder")}set placeholder(t){this.setAttribute("placeholder",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get readonly(){return this.getBoolAttr("readonly")}set readonly(t){this.setBoolAttr("readonly",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-input",_);const v=["placeholder","name","rows","maxlength","minlength","autocomplete","aria-label"],x=["required","disabled","readonly"];class f extends u{static get observedAttributes(){return["value","wide",...v,...x]}render(){this._input=this.createElement("textarea",["nk-textarea"]);for(const t of[...v,...x])this._forward(t);this._input.value=this.getAttribute("value")??this.textContent.trim(),this._syncWide(),this._wrapper.appendChild(this._input),this._syncFormValue()}_forward(t){if(x.includes(t))return void(this._input["readonly"===t?"readOnly":t]=this.getBoolAttr(t)||"disabled"===t&&!!this._formDisabled);const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}_syncWide(){this._input.classList.toggle("wide",this.getBoolAttr("wide"))}setupEvents(){this._onInput=()=>{this._syncFormValue(),this.emit("nk-input",{value:this._input.value,name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._input)return"value"===t?(this._input.value=this.getAttribute("value")??"",void this._syncFormValue()):void("wide"!==t?(this._forward(t),this._syncFormValue()):this._syncWide())}_syncFormValue(){this.setFormValue(this._input.value),this.syncValidityFrom(this._input)}resetValue(){this._input.value=this.getAttribute("value")??this.textContent.trim(),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncFormValue())}onFormDisabled(t){this._input.disabled=t||this.getBoolAttr("disabled")}focus(t){this._input?.focus(t)}blur(){this._input?.blur()}get value(){return this._input?.value??this.getAttribute("value")??""}set value(t){this._input?(this._input.value=t??"",this._syncFormValue()):this.setAttribute("value",t??"")}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-textarea",f);class y extends u{static get observedAttributes(){return["value","name","disabled","required","compact","wide","aria-label"]}static get observesLightDom(){return!0}render(){this._select=this.createElement("select",["nk-select"]),this._forwardAll(),this._wrapper.appendChild(this._select),this._defaultValue=this.getAttribute("value"),this.projectLightDom(),requestAnimationFrame(()=>this.projectLightDom())}_forwardAll(){const t=this.getAttribute("name");t?this._select.setAttribute("name",t):this._select.removeAttribute("name");const e=this.getAttribute("aria-label");e?this._select.setAttribute("aria-label",e):this._select.removeAttribute("aria-label"),this._select.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._select.required=this.getBoolAttr("required"),this._select.classList.toggle("compact",this.getBoolAttr("compact")),this._select.classList.toggle("wide",this.getBoolAttr("wide"))}projectLightDom(){if(!this._select)return;const t=[...this.children].filter(t=>t.matches("option, optgroup")),e=t.map(t=>t.outerHTML).join("");if(e===this._optionSignature)return;this._optionSignature=e;const n=this._select.selectedIndex>=0?this._select.value:null;this._select.innerHTML="";for(const e of t)this._select.appendChild(e.cloneNode(!0));this._applyValue(n)||this._applyValue(this.getAttribute("value")),this._syncFormValue()}_applyValue(t){return null!==t&&(!![...this._select.options].some(e=>e.value===t)&&(this._select.value=t,!0))}setupEvents(){this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:this._select.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._select.addEventListener("change",this._onChange)}teardownEvents(){this._select?.removeEventListener("change",this._onChange)}onAttributeChanged(t){if(this._select){if("value"===t)return this._applyValue(this.getAttribute("value")),void this._syncFormValue();this._forwardAll(),this._syncFormValue()}}_syncFormValue(){this.setFormValue(this._select.value),this.syncValidityFrom(this._select)}resetValue(){this._applyValue(this._defaultValue)||(this._select.selectedIndex=0),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._applyValue(t),this._syncFormValue())}onFormDisabled(t){this._select.disabled=t||this.getBoolAttr("disabled")}focus(t){this._select?.focus(t)}get value(){return this._select?.value??""}set value(t){this._select?(this._select.value=t,this._syncFormValue()):this.setAttribute("value",t)}get selectedIndex(){return this._select?.selectedIndex??-1}get options(){return this._select?.options??[]}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get required(){return this.getBoolAttr("required")}set required(t){this.setBoolAttr("required",t)}get compact(){return this.getBoolAttr("compact")}set compact(t){this.setBoolAttr("compact",t)}get wide(){return this.getBoolAttr("wide")}set wide(t){this.setBoolAttr("wide",t)}}customElements.define("nk-select",y);class w extends u{static get observedAttributes(){return["checked","disabled","name","value","label","text"]}render(){this._row=this.createElement("label",["nk-switch-label"]),this._btn=this.createElement("button",["nk-switch"],{type:"button",role:"switch"}),this._text=document.createElement("span"),this._slot=document.createElement("slot"),this._textNode=document.createTextNode(""),this._slot.appendChild(this._textNode),this._text.appendChild(this._slot),this._row.append(this._btn,this._text),this._defaultChecked=this.getBoolAttr("checked"),this._apply(),this._syncText(),this._wrapper.appendChild(this._row),this._syncFormValue()}_apply(){this._btn.setAttribute("aria-checked",this.getBoolAttr("checked")?"true":"false"),this._btn.disabled=this.getBoolAttr("disabled")||!!this._formDisabled;const t=this.getAttribute("label");t?this._btn.setAttribute("aria-label",t):this._btn.removeAttribute("aria-label")}_syncText(){this._textNode.data=this.getAttribute("text")??"";const t=!(!this.getAttribute("text")&&!this._slot.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.data.trim()));this._text.hidden=!t,this._row.style.display=t?"":"contents"}setupEvents(){this._onClick=()=>this.toggle(),this._onSlot=()=>this._syncText(),this._btn.addEventListener("click",this._onClick),this._slot.addEventListener("slotchange",this._onSlot),this._syncText()}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),this._slot?.removeEventListener("slotchange",this._onSlot)}toggle(){this.getBoolAttr("disabled")||this._formDisabled||(this.checked=!this.checked,this.emit("nk-change",{checked:this.checked,value:this.getAttribute("value")||"on",name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t){this._btn&&("text"!==t?(this._apply(),this._syncFormValue()):this._syncText())}_syncFormValue(){const t=this.getAttribute("value")||"on";this.setFormValue(this.getBoolAttr("checked")?t:null,this.getBoolAttr("checked")?"checked":"unchecked")}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._btn?.focus(t)}get checked(){return this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}}customElements.define("nk-switch",w);class A extends u{static get observedAttributes(){return["checked","disabled","name","value","text","indeterminate","required"]}render(){const t=this.createElement("label",["nk-check"]);this._input=this.createElement("input",[],{type:"checkbox"});const e=document.createElement("slot");this._text=document.createTextNode(""),e.appendChild(this._text),this._apply(),this._defaultChecked=this.getBoolAttr("checked"),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue()}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.indeterminate=this.getBoolAttr("indeterminate"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._input.required=this.getBoolAttr("required");const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"on",this._text&&(this._text.data=this.getAttribute("text")??"")}setupEvents(){this._onChange=()=>{this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this.removeAttribute("indeterminate"),this._syncing=!1,this._syncFormValue(),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(){!this._syncing&&this._input&&(this._apply(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.checked?this._input.value:null,this._input.checked?"checked":"unchecked"),this.syncValidityFrom(this._input)}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._input?.focus(t)}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get indeterminate(){return this.getBoolAttr("indeterminate")}set indeterminate(t){this.setBoolAttr("indeterminate",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}}customElements.define("nk-check",A);const E={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function C(t){return(void 0!==t.form?t.form:t.closest("form"))??null}function B(t){const e=t.filter(t=>!t.disabled);if(!e.length)return;const n=e.find(t=>t.checked)||e[0];for(const e of t)e._input&&(e._input.tabIndex=e===n?0:-1)}class L extends u{static get observedAttributes(){return["checked","disabled","name","value","text","required"]}render(){const t=this.createElement("label",["nk-check"]);this._input=this.createElement("input",[],{type:"radio"});const e=document.createElement("slot");this._text=document.createTextNode(""),e.appendChild(this._text),this._apply(),this._defaultChecked=this.getBoolAttr("checked"),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue(),this._input.checked&&this._uncheckPeers(),B(this._group())}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._input.required=this.getBoolAttr("required");const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"",this._text&&(this._text.data=this.getAttribute("text")??"")}setupEvents(){this._onChange=()=>this._applyChange(),this._onKeyDown=t=>{const e=E[t.key];if(!e||t.ctrlKey||t.metaKey||t.altKey)return;const n=this._group().filter(t=>!t.disabled);if(n.length<2)return;t.preventDefault();const i=n[(n.indexOf(this)+e+n.length)%n.length];i._input.focus(),i._input.checked=!0,i._applyChange()},this._input.addEventListener("change",this._onChange),this._input.addEventListener("keydown",this._onKeyDown),B(this._group())}teardownEvents(){this._input?.removeEventListener("change",this._onChange),this._input?.removeEventListener("keydown",this._onKeyDown)}_applyChange(){this._input.checked&&this._uncheckPeers(),this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this._syncing=!1,this._syncFormValue(),B(this._group()),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))}_group(){const t=this.getAttribute("name"),e=this.getRootNode();if(!t||"function"!=typeof e?.querySelectorAll)return[this];const n=C(this);return[...e.querySelectorAll("nk-radio")].filter(e=>e.getAttribute("name")===t&&C(e)===n)}_uncheckPeers(){for(const t of this._group())t!==this&&t.checked&&(t.checked=!1)}onAttributeChanged(t){!this._syncing&&this._input&&(this._apply(),"checked"===t&&this._input.checked&&this._uncheckPeers(),this._syncFormValue(),B(this._group()))}_syncFormValue(){const t=this.getAttribute("value")||"";this.setFormValue(this._input.checked?t:null,this._input.checked?"checked":"unchecked"),this.syncValidityFrom(this._input)}resetValue(){this._input.checked=this._defaultChecked,this.setBoolAttr("checked",this._defaultChecked),this._syncFormValue(),B(this._group())}restoreValue(t){"checked"===t&&(this.checked=!0)}onFormDisabled(t){this._formDisabled=t,this._apply(),B(this._group())}focus(t){this._input?.focus(t)}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this._input&&(this._input.checked=t),t&&this._uncheckPeers(),this.setBoolAttr("checked",t),this._input&&(this._syncFormValue(),B(this._group()))}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get text(){return this.getAttribute("text")}set text(t){null==t?this.removeAttribute("text"):this.setAttribute("text",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}customElements.define("nk-radio",L);const S=["name","min","max","step","aria-label"];class z extends u{static get observedAttributes(){return["value","disabled","show-value","unit",...S]}render(){this._input=this.createElement("input",["nk-slider"],{type:"range"}),this._out=this.createElement("div",["nk-slider-value"]),this._apply(),this._input.value=this.getAttribute("value")??this._input.value,this._defaultValue=this._input.value,this._wrapper.appendChild(this._input),this._wrapper.appendChild(this._out),this._syncOut(),this._syncFormValue()}_apply(){for(const t of S){const e=this.getAttribute(t);null===e?this._input.removeAttribute(t):this._input.setAttribute(t,e)}this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled,this._out.style.display=this.getBoolAttr("show-value")?"":"none"}_syncOut(){this._out.textContent=`${this._input.value}${this.getAttribute("unit")||""}`}setupEvents(){this._onInput=()=>{this._syncOut(),this._syncFormValue(),this.emit("nk-input",{value:Number(this._input.value),name:this.name})},this._onChange=()=>{this._syncFormValue(),this.emit("nk-change",{value:Number(this._input.value),name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("input",this._onInput),this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(t){this._input&&("value"===t?this._input.value=this.getAttribute("value")??"":this._apply(),this._syncOut(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.value)}resetValue(){this._input.value=this._defaultValue,this._syncOut(),this._syncFormValue()}restoreValue(t){"string"==typeof t&&(this._input.value=t,this._syncOut(),this._syncFormValue())}onFormDisabled(t){this._formDisabled=t,this._apply()}focus(t){this._input?.focus(t)}get value(){return Number(this._input?.value??this.getAttribute("value"))}set value(t){this._input?(this._input.value=t,this._syncOut(),this._syncFormValue()):this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get showValue(){return this.getBoolAttr("show-value")}set showValue(t){this.setBoolAttr("show-value",t)}}customElements.define("nk-slider",z);const N=["nk-input","nk-textarea","nk-select"];class T extends p{static get observedAttributes(){return["label","desc","stacked","compact"]}render(){this._field=this.createElement("div",["nk-field"]);const t=document.createElement("div");this._label=this.createElement("div",["f-label"]);const e=this.createElement("slot",[],{name:"label"});e.appendChild(this._label),this._desc=this.createElement("div",["f-desc"]);const n=this.createElement("slot",[],{name:"desc"});n.appendChild(this._desc),t.appendChild(e),t.appendChild(n);const i=this.createElement("div",["f-control"]);this._slot=document.createElement("slot"),i.appendChild(this._slot),this._field.appendChild(t),this._field.appendChild(i),this._wrapper.appendChild(this._field),this._widened=new Set,this._sync()}setupEvents(){this._onSlot=()=>this._syncWide(),this._slot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(){this._sync()}get stacked(){return this.getBoolAttr("stacked")||!!this.closest("nk-fields")}set stacked(t){this.setBoolAttr("stacked",t)}get compact(){return this.getBoolAttr("compact")||!!this.closest("nk-fields")}set compact(t){this.setBoolAttr("compact",t)}_sync(){if(!this._label)return;this._label.textContent=this.getAttribute("label")||"";const t=this.getAttribute("desc");this._desc.textContent=t||"",this._desc.style.display=t?"":"none",this._field.classList.toggle("stacked",this.stacked),this._field.classList.toggle("compact",this.compact),this._syncWide()}_syncWide(){if(!this._slot)return;const t=this.stacked;for(const e of this._slot.assignedElements())N.includes(e.localName)&&(t&&!e.hasAttribute("wide")?(e.setAttribute("wide",""),this._widened.add(e)):!t&&this._widened.has(e)&&(e.removeAttribute("wide"),this._widened.delete(e)))}get label(){return this.getAttribute("label")}set label(t){this.setAttribute("label",t)}get desc(){return this.getAttribute("desc")}set desc(t){null==t?this.removeAttribute("desc"):this.setAttribute("desc",t)}}customElements.define("nk-field",T);class D extends p{render(){const t=this.createElement("div",["nk-fields"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-fields",D);const M=["gray","brown","orange","yellow","green","blue","purple","pink","red"];class F extends p{static get observedAttributes(){return["color"]}render(){this._tag=this.createElement("span",this._computeClasses()),this._tag.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._tag)}onAttributeChanged(){this._tag&&(this._tag.className=this._computeClasses().join(" "))}_computeClasses(){const t=["nk-tag"],e=this.getAttribute("color");return M.includes(e)&&t.push(e),t}get color(){return this.getAttribute("color")}set color(t){t?this.setAttribute("color",t):this.removeAttribute("color")}}customElements.define("nk-tag",F);class V extends p{static get observedAttributes(){return["value","max","label","wide"]}render(){this._bar=this.createElement("span",["nk-progress"],{role:"progressbar"}),this._fill=document.createElement("i"),this._bar.appendChild(this._fill),this._label=this.createElement("span",["nk-progress-label"]),this._wrapper.appendChild(this._bar),this._wrapper.appendChild(this._label),this._sync()}onAttributeChanged(){this._sync()}_sync(){if(!this._bar)return;const t=Number(this.getAttribute("max"))||100,e=Math.min(t,Math.max(0,Number(this.getAttribute("value"))||0));this._fill.style.width=e/t*100+"%",this._bar.classList.toggle("wide",this.getBoolAttr("wide")),this._bar.setAttribute("aria-valuenow",e),this._bar.setAttribute("aria-valuemin",0),this._bar.setAttribute("aria-valuemax",t);const n=this.getAttribute("label");this._label.textContent=n??"",this._label.style.display=null===n?"none":""}get value(){return Number(this.getAttribute("value"))||0}set value(t){this.setAttribute("value",t)}get max(){return Number(this.getAttribute("max"))||100}set max(t){this.setAttribute("max",t)}get label(){return this.getAttribute("label")}set label(t){null==t?this.removeAttribute("label"):this.setAttribute("label",t)}}customElements.define("nk-progress",V);class I extends p{static get observedAttributes(){return["icon"]}render(){this._box=this.createElement("div",["nk-callout"]),this._icon=this.createElement("span",["c-icon"]);const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon);const e=document.createElement("div");e.appendChild(document.createElement("slot")),this._box.appendChild(t),this._box.appendChild(e),this._wrapper.appendChild(this._box),this._syncIcon()}onAttributeChanged(){this._syncIcon()}_syncIcon(){this._icon&&(this._icon.textContent=this.getAttribute("icon")||"๐ก")}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}}customElements.define("nk-callout",I);class q extends p{render(){this._wrapper.appendChild(this.createElement("hr",["nk-divider"]))}}customElements.define("nk-divider",q);class j extends p{static get observedAttributes(){return["level"]}render(){this._build()}_build(){const t=Math.min(4,Math.max(1,Number(this.getAttribute("level"))||2)),e=this.createElement(`h${t}`,["nk-heading"]);e.appendChild(document.createElement("slot")),this._heading?this._heading.replaceWith(e):this._wrapper.appendChild(e),this._heading=e}onAttributeChanged(){this._build()}get level(){return Number(this.getAttribute("level"))||2}set level(t){this.setAttribute("level",t)}}customElements.define("nk-heading",j);class O extends p{static get observedAttributes(){return["label","open"]}render(){this._details=this.createElement("details",["nk-toggle"]);const t=document.createElement("summary");this._label=document.createElement("span");const e=this.createElement("slot",[],{name:"label"});e.appendChild(this._label),t.appendChild(e);const n=this.createElement("div",["toggle-body"]);n.appendChild(document.createElement("slot")),this._details.appendChild(t),this._details.appendChild(n),this._details.open=this.getBoolAttr("open"),this._wrapper.appendChild(this._details),this._sync()}setupEvents(){this._onToggle=()=>{this._syncing=!0,this.setBoolAttr("open",this._details.open),this._syncing=!1,this.emit("nk-toggle",{open:this._details.open})},this._details.addEventListener("toggle",this._onToggle)}teardownEvents(){this._details?.removeEventListener("toggle",this._onToggle)}onAttributeChanged(t){this._details&&("open"!==t?this._sync():this._syncing||(this._details.open=this.getBoolAttr("open")))}_sync(){this._label.textContent=this.getAttribute("label")||""}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get label(){return this.getAttribute("label")}set label(t){this.setAttribute("label",t)}}customElements.define("nk-toggle",O);class P extends u{static get observedAttributes(){return["checked","disabled","name","value"]}render(){const t=this.createElement("label",["nk-todo"]);this._input=this.createElement("input",[],{type:"checkbox"}),this._apply(),this._defaultChecked=this.getBoolAttr("checked");const e=document.createElement("span");e.appendChild(document.createElement("slot")),t.appendChild(this._input),t.appendChild(e),this._wrapper.appendChild(t),this._syncFormValue()}_apply(){this._input.checked=this.getBoolAttr("checked"),this._input.disabled=this.getBoolAttr("disabled")||!!this._formDisabled;const t=this.getAttribute("name");t?this._input.setAttribute("name",t):this._input.removeAttribute("name"),this._input.value=this.getAttribute("value")||"on"}setupEvents(){this._onChange=()=>{this._syncing=!0,this.setBoolAttr("checked",this._input.checked),this._syncing=!1,this._syncFormValue(),this.emit("nk-change",{checked:this._input.checked,value:this._input.value,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0}))},this._input.addEventListener("change",this._onChange)}teardownEvents(){this._input?.removeEventListener("change",this._onChange)}onAttributeChanged(){!this._syncing&&this._input&&(this._apply(),this._syncFormValue())}_syncFormValue(){this.setFormValue(this._input.checked?this._input.value:null,this._input.checked?"checked":"unchecked")}resetValue(){this.setBoolAttr("checked",this._defaultChecked)}restoreValue(t){"checked"!==t&&"unchecked"!==t||this.setBoolAttr("checked","checked"===t)}onFormDisabled(t){this._formDisabled=t,this._apply()}get checked(){return this._input?.checked??this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}}customElements.define("nk-todo",P);class K extends p{render(){const t=this.createElement("kbd",["nk-kbd"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-kbd",K);class $ extends p{static get observedAttributes(){return["lang","highlight"]}static get observesLightDom(){return!0}render(){this._box=this.createElement("div",["nk-code"]),this._lang=this.createElement("span",["lang"]),this._slot=document.createElement("slot"),this._pre=this.createElement("span",["hl"]),this._box.appendChild(this._lang),this._box.appendChild(this._slot),this._box.appendChild(this._pre),this._wrapper.appendChild(this._box),this._sync(),this.projectLightDom()}onAttributeChanged(){this._sync(),this.projectLightDom()}_sync(){if(!this._lang)return;const t=this.getAttribute("lang");this._lang.textContent=t||"",this._lang.style.display=t?"":"none"}projectLightDom(){if(!this._pre)return;const t=this.hasAttribute("highlight");if(this._slot.style.display=t?"none":"",this._pre.style.display=t?"":"none",!t)return;const e=this.textContent.replace(/^\n/,"");var n;e!==this._lastText&&(this._lastText=e,this._pre.innerHTML=(n=e,n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")).replace(/<(\/?)([a-zA-Z][\w-]*)([^&]*?)(\/?)>/g,(t,e,n,i,s)=>`<${e}<span class="tag">${n}</span>${i.replace(/([\w-]+)(=)("[^"]*"|'[^']*')?/g,(t,e,n,i)=>`<span class="attr">${e}</span>${n}${i??""}`)}${s}>`))}get lang(){return this.getAttribute("lang")}set lang(t){null==t?this.removeAttribute("lang"):this.setAttribute("lang",t)}}customElements.define("nk-code",$);class R extends p{static get observedAttributes(){return["cite"]}render(){this._quote=this.createElement("blockquote",["nk-quote"]),this._quote.appendChild(document.createElement("slot")),this._cite=this.createElement("cite",["q-cite"]),this._quote.appendChild(this._cite),this._wrapper.appendChild(this._quote),this._sync()}onAttributeChanged(){this._sync()}_sync(){if(!this._cite)return;const t=this.getAttribute("cite");this._cite.textContent=t||"",this._cite.style.display=t?"":"none"}get cite(){return this.getAttribute("cite")}set cite(t){null==t?this.removeAttribute("cite"):this.setAttribute("cite",t)}}customElements.define("nk-quote",R);class U extends p{render(){const t=this.createElement("div",["nk-app"]);t.appendChild(this.createElement("slot",[],{name:"sidebar"}));const e=this.createElement("main",["nk-main"]);e.appendChild(document.createElement("slot")),t.appendChild(e),this._wrapper.appendChild(t)}}customElements.define("nk-app",U);class H extends p{static get observedAttributes(){return["open"]}render(){this._backdrop=this.createElement("div",["nk-sidebar-backdrop"]),this._aside=this.createElement("aside",["nk-sidebar"]),this._aside.appendChild(this.createElement("slot",[],{name:"workspace"}));const t=this.createElement("div",["nk-sidebar-scroll"]);t.appendChild(document.createElement("slot")),this._aside.appendChild(t),this._footer=this.createElement("div",["nk-sidebar-footer"]),this._footerSlot=this.createElement("slot",[],{name:"footer"}),this._footer.appendChild(this._footerSlot),this._aside.appendChild(this._footer),this._wrapper.appendChild(this._backdrop),this._wrapper.appendChild(this._aside),this._syncFooter(),this._syncOpen()}_syncOpen(){const t=this.getBoolAttr("open");this._aside.classList.toggle("open",t),this._backdrop.classList.toggle("open",t)}_syncFooter(){const t=this._footerSlot.assignedElements();this._footer.style.display=t.length?"":"none";for(const e of t)"nk-tree-item"===e.localName&&e.setAttribute("compact","")}setupEvents(){this._onSlot=()=>this._syncFooter(),this._onBackdrop=()=>this.close(),this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._footerSlot.addEventListener("slotchange",this._onSlot),this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey)}teardownEvents(){this._footerSlot?.removeEventListener("slotchange",this._onSlot),this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey)}onAttributeChanged(t){"open"===t&&(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")}))}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}}customElements.define("nk-sidebar",H);const W=new CSSStyleSheet;W.replaceSync("\n .nk-ws-anchor { position: relative; }\n .nk-ws-menu { display: none; position: absolute; left: 8px; top: calc(100% - 2px); z-index: 50; }\n :host([open]) .nk-ws-menu { display: block; }\n");class G extends p{static get hostStyles(){return W}static get observedAttributes(){return["name","avatar","open"]}render(){this._row=this.createElement("div",["nk-workspace"],{role:"button",tabindex:"0","aria-haspopup":"menu"}),this._avatar=this.createElement("div",["avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar),this._name=document.createElement("span");const e=this.createElement("span",["chev"]);e.textContent="โ",this._row.append(t,this._name,e),this._menu=this.createElement("div",["nk-ws-menu"]),this._menu.appendChild(this.createElement("slot",[],{name:"menu"}));const n=this.createElement("div",["nk-ws-anchor"]);n.append(this._row,this._menu),this._wrapper.appendChild(n),this._sync()}_sync(){const t=this.getAttribute("name")||"";this._name.textContent=t,this._avatar.textContent=this.getAttribute("avatar")||t.trim().charAt(0).toUpperCase(),this._row.setAttribute("aria-expanded",this.getBoolAttr("open")?"true":"false")}setupEvents(){this._onClick=()=>this.toggle(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.toggle())},this._onDocClick=t=>{this.getBoolAttr("open")&&!t.composedPath().includes(this)&&this.close()},this._onDocKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onMenuSelect=()=>this.close(),this._row.addEventListener("click",this._onClick),this._row.addEventListener("keydown",this._onKey),this._menu.addEventListener("nk-select",this._onMenuSelect),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onDocKey)}teardownEvents(){this._row?.removeEventListener("click",this._onClick),this._row?.removeEventListener("keydown",this._onKey),this._menu?.removeEventListener("nk-select",this._onMenuSelect),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onDocKey)}onAttributeChanged(t){this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open")})}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}}customElements.define("nk-workspace-switcher",G);class Y extends p{static get observedAttributes(){return["label","addable"]}render(){this._box=this.createElement("div",["nk-section-label"]),this._text=document.createElement("span"),this._text.appendChild(document.createElement("slot")),this._plus=this.createElement("span",["plus"],{role:"button",title:"+"}),this._plus.textContent="๏ผ",this._box.append(this._text,this._plus),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t=this.getAttribute("label");null!==t&&(this._text.textContent=t),this._plus.style.display=this.getBoolAttr("addable")?"":"none"}setupEvents(){this._onPlus=t=>{t.stopPropagation(),this.emit("nk-action",{action:"add"})},this._plus.addEventListener("click",this._onPlus)}teardownEvents(){this._plus?.removeEventListener("click",this._onPlus)}onAttributeChanged(){this._sync()}get addable(){return this.getBoolAttr("addable")}set addable(t){this.setBoolAttr("addable",t)}}customElements.define("nk-section-label",Y);const Q=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]);class Z extends p{static get observedAttributes(){return["manual"]}render(){const t=this.createElement("div",[],{role:"tree"});t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._box=t}setActive(t){if(!this.getBoolAttr("manual")){for(const e of this.querySelectorAll("nk-tree-item[active]"))e!==t&&e.removeAttribute("active");t.setAttribute("active",""),this._syncTabIndex(t)}}setupEvents(){this._onKey=t=>{if(!Q.has(t.key)||t.ctrlKey||t.metaKey||t.altKey)return;const e=t.target.closest?.("nk-tree-item");if(!e)return;const n=this.visibleItems(),i=n.indexOf(e);if(i<0)return;let s=null;switch(t.key){case"ArrowDown":s=n[i+1];break;case"ArrowUp":s=n[i-1];break;case"Home":s=n[0];break;case"End":s=n[n.length-1];break;case"ArrowRight":e.hasChildren&&!e.open?e.open=!0:e.hasChildren&&(s=e.querySelector("nk-tree-item"));break;case"ArrowLeft":e.hasChildren&&e.open?e.open=!1:s=e.parentElement?.closest("nk-tree-item")}t.preventDefault(),s&&(this._syncTabIndex(s),s.focus())},this._onSlot=()=>this._syncTabIndex(),this.addEventListener("keydown",this._onKey),this._box.querySelector("slot").addEventListener("slotchange",this._onSlot),this._syncTabIndex()}teardownEvents(){this.removeEventListener("keydown",this._onKey),this._box?.querySelector("slot").removeEventListener("slotchange",this._onSlot)}visibleItems(){return[...this.querySelectorAll("nk-tree-item")].filter(t=>{for(let e=t.parentElement?.closest("nk-tree-item");e&&this.contains(e);e=e.parentElement?.closest("nk-tree-item"))if(!e.open)return!1;return!0})}requestSync(){this._syncQueued||(this._syncQueued=!0,queueMicrotask(()=>{this._syncQueued=!1,this._syncTabIndex()}))}_syncTabIndex(t){const e=[...this.querySelectorAll("nk-tree-item")];if(!e.length)return;const n=this.visibleItems(),i=t||n.find(t=>t.active)||n[0];for(const t of e)t.setTabbable?.(t===i)}set data(t){this._data=t;const e=t=>t.map(t=>{const n=document.createElement("nk-tree-item");return t.icon&&n.setAttribute("icon",t.icon),null!=t.value&&n.setAttribute("value",t.value),t.href&&n.setAttribute("href",t.href),t.open&&n.setAttribute("open",""),t.active&&n.setAttribute("active",""),n.append(document.createTextNode(t.label??""),...e(t.children||[])),n});for(const t of this.querySelectorAll(":scope > nk-tree-item"))t.remove();this.append(...e(t||[]))}get data(){return this._data}get activeItem(){return this.querySelector("nk-tree-item[active]")}get value(){return this.activeItem?.value??null}}customElements.define("nk-tree",Z);class J extends p{static get slotAssignment(){return"manual"}static get observedAttributes(){return["label","icon","value","href","active","open","compact","no-actions"]}render(){this._row=this.createElement("div",["nk-tree-item"],{role:"treeitem",tabindex:"-1"}),this._arrow=this.createElement("span",["nk-toggle-arrow"],{"aria-hidden":"true"}),this._arrow.textContent="โธ",this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._icon=this.createElement("span",["icon"]),this._iconSlot.appendChild(this._icon),this._label=this.createElement("span",["label"]),this._labelSlot=this.createElement("slot",[],{name:"label"}),this._labelText=document.createTextNode(""),this._labelSlot.appendChild(this._labelText),this._label.appendChild(this._labelSlot),this._actions=this.createElement("span",["actions"]);for(const[t,e,n]of[["add","๏ผ","Add"],["more","โฏ","More"]]){const i=this.createElement("span",[],{"data-action":t,role:"button",title:n});i.textContent=e,this._actions.appendChild(i)}this._endSlot=this.createElement("slot",[],{name:"end"}),this._row.append(this._arrow,this._iconSlot,this._label,this._actions,this._endSlot),this._children=this.createElement("div",["nk-tree-children"],{role:"group"}),this._childSlot=this.createElement("slot",[],{name:"children"}),this._children.appendChild(this._childSlot),this._wrapper.append(this._row,this._children),this._sync(),this.closest("nk-tree")?.requestSync?.()}assignSlots(){if(!this._row)return;const t=[],e=[],n=[],i=[];for(const s of this.childNodes)if(s.nodeType===Node.ELEMENT_NODE){const r=s.getAttribute("slot");"icon"===r?t.push(s):"end"===r?e.push(s):"nk-tree-item"===s.localName?n.push(s):i.push(s)}else s.nodeType===Node.TEXT_NODE&&s.data.trim()&&i.push(s);this._iconSlot.assign(...t),this._endSlot.assign(...e),this._childSlot.assign(...n),this._labelSlot.assign(...this.hasAttribute("label")?[]:i),this._hasChildren=n.length>0,this._hasEnd=e.length>0,this._sync()}_sync(){const t=this.getBoolAttr("active"),e=this.getBoolAttr("open");this._row.classList.toggle("active",t),this._row.classList.toggle("compact",this.getBoolAttr("compact")),this._row.setAttribute("aria-selected",t?"true":"false"),this._arrow.classList.toggle("open",e),this._arrow.style.display=this._hasChildren?"":"none",this._hasChildren?this._row.setAttribute("aria-expanded",e?"true":"false"):this._row.removeAttribute("aria-expanded"),this._children.classList.toggle("collapsed",!e||!this._hasChildren),this._icon.textContent=this.getAttribute("icon")||"",this._icon.style.display=this.getAttribute("icon")?"":"none",this._labelText.data=this.getAttribute("label")||"";const n=!this.getBoolAttr("no-actions")&&!this._hasEnd;n&&!this._actions.isConnected&&this._row.insertBefore(this._actions,this._endSlot),!n&&this._actions.isConnected&&this._actions.remove();const i=this.getAttribute("href");i?this._row.setAttribute("data-href",i):this._row.removeAttribute("data-href")}setupEvents(){this._onRowClick=t=>{const e=t.target.closest?.("[data-action]");return e?(t.stopPropagation(),void this.emit("nk-action",{action:e.dataset.action,value:this.value,label:this.label})):t.target===this._arrow||this._arrow.contains(t.target)?(t.stopPropagation(),void this.toggle()):void this.select()},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._row.addEventListener("click",this._onRowClick),this._row.addEventListener("keydown",this._onKey)}teardownEvents(){this._row?.removeEventListener("click",this._onRowClick),this._row?.removeEventListener("keydown",this._onKey)}onAttributeChanged(t){"label"===t?this.assignSlots():this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open"),value:this.value})}select(){if(!this.emit("nk-select",{value:this.value,label:this.label,href:this.getAttribute("href"),item:this}))return;const t=this.closest("nk-tree");t?t.setActive(this):this.setBoolAttr("active",!0),this.getAttribute("href")&&location.assign(this.getAttribute("href"))}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}focus(t){this._row?.focus(t)}setTabbable(t){this._row&&(this._row.tabIndex=t?0:-1)}get tabbable(){return 0===this._row?.tabIndex}get hasChildren(){return!!this._hasChildren}get label(){return this.getAttribute("label")??this._labelSlot?.assignedNodes().map(t=>t.textContent).join("").trim()??""}set label(t){this.setAttribute("label",t)}get value(){return this.getAttribute("value")??this.label}set value(t){this.setAttribute("value",t)}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get compact(){return this.getBoolAttr("compact")}set compact(t){this.setBoolAttr("compact",t)}}customElements.define("nk-tree-item",J);class X extends p{render(){const t=this.createElement("div",["nk-topbar"]);t.appendChild(document.createElement("slot"));const e=this.createElement("div",["nk-topbar-actions"]);e.appendChild(this.createElement("slot",[],{name:"actions"})),t.appendChild(e),this._wrapper.appendChild(t)}}customElements.define("nk-topbar",X);class tt extends p{static get observedAttributes(){return["separator"]}static get observesLightDom(){return!0}render(){this._nav=this.createElement("nav",["nk-breadcrumb"],{"aria-label":"Breadcrumb"}),this._wrapper.appendChild(this._nav),this.projectLightDom()}projectLightDom(){if(!this._nav)return;const t=[...this.children],e=this.getAttribute("separator")??"/",n=t.map(t=>t.outerHTML).join("")+e;if(n===this._signature)return;this._signature=n,this._nav.innerHTML="";const i=t.some(t=>t.hasAttribute("current")||t.classList.contains("current"));t.forEach((n,s)=>{if(s>0){const t=this.createElement("span",["sep"],{"aria-hidden":"true"});t.textContent=e,this._nav.appendChild(t)}const r=n.cloneNode(!0);r.removeAttribute("slot"),r.classList.add("crumb");const o=i?n.hasAttribute("current")||n.classList.contains("current"):s===t.length-1;r.classList.toggle("current",o),o&&r.setAttribute("aria-current","page"),r.dataset.index=s,this._nav.appendChild(r)})}setupEvents(){this._onClick=t=>{const e=t.target.closest(".crumb");if(!e)return;t.preventDefault();const n=Number(e.dataset.index),i=this.children[n];this.emit("nk-select",{index:n,label:e.textContent.trim(),href:i?.getAttribute("href")??null,value:i?.dataset.value??i?.getAttribute("href")??e.textContent.trim(),current:e.classList.contains("current")})&&i?.click()},this._nav.addEventListener("click",this._onClick)}teardownEvents(){this._nav?.removeEventListener("click",this._onClick)}onAttributeChanged(){this.projectLightDom()}get separator(){return this.getAttribute("separator")??"/"}set separator(t){this.setAttribute("separator",t)}}customElements.define("nk-breadcrumb",tt);class et extends p{static get observedAttributes(){return["storage-key","title"]}render(){this._btn=this.createElement("button",["nk-topbar-btn","nk-theme-toggle"],{type:"button"}),this._btn.title=this.getAttribute("title")||"Toggle light / dark",this._wrapper.appendChild(this._btn);const t=document.documentElement;let e=null;try{e=localStorage.getItem(this.storageKey)}catch{}"light"===e||"dark"===e?t.setAttribute("data-theme",e):t.hasAttribute("data-theme")||t.setAttribute("data-theme",matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),this._syncGlyph()}_syncGlyph(){this._btn&&(this._btn.textContent="dark"===h()?"โ๏ธ":"๐")}_syncTheme(t){super._syncTheme(t),this._syncGlyph()}setupEvents(){this._onClick=()=>this.apply("dark"===h()?"light":"dark"),this._onMessage=t=>{const e=t.data?.nkTheme;"light"!==e&&"dark"!==e||this.apply(e)},this._btn.addEventListener("click",this._onClick),window.addEventListener("message",this._onMessage)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick),window.removeEventListener("message",this._onMessage)}onAttributeChanged(t){"title"===t&&this._btn&&(this._btn.title=this.getAttribute("title")||"Toggle light / dark")}apply(t){document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem(this.storageKey,t)}catch{}this._syncGlyph(),this.emit("nk-change",{value:t})}get storageKey(){return this.getAttribute("storage-key")||"nk-theme"}get value(){return h()}set value(t){this.apply(t)}}customElements.define("nk-theme-toggle",et);class nt extends p{static get observedAttributes(){return["value","always","fixed","floating","label"]}render(){this._bar=this.createElement("nav",["nk-tab-bar"]),this._slot=document.createElement("slot"),this._bar.appendChild(this._slot),this._spacer=this.createElement("div",["nk-tab-bar-spacer"]),this._wrapper.append(this._bar,this._spacer),this._syncBar(),this._sync()}get items(){return[...this.querySelectorAll(":scope > nk-tab-bar-item")]}_valueOf(t){return t.getAttribute("value")??t.getAttribute("label")??t.textContent.trim()}_syncBar(){this._bar.classList.toggle("always",this.getBoolAttr("always")),this._bar.classList.toggle("fixed",this.getBoolAttr("fixed")),this._bar.classList.toggle("floating",this.getBoolAttr("floating"));const t=this.getAttribute("label");t?this._bar.setAttribute("aria-label",t):this._bar.removeAttribute("aria-label")}_sync(){const t=this.items.filter(t=>!t.hasAttribute("drawer"));if(!t.length)return;let e=this.getAttribute("value");if(null===e||!t.some(t=>this._valueOf(t)===e)){const n=t.find(t=>t.hasAttribute("active"))||t[0];e=this._valueOf(n)}for(const n of t)this._valueOf(n)===e?n.setAttribute("active",""):n.removeAttribute("active");this._value=e}setupEvents(){this._onSlot=()=>this._sync(),this._slot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){if("value"!==t)return void this._syncBar();const e=this._value;this._sync(),this._value!==e&&this.emit("nk-change",{value:this._value})}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get always(){return this.getBoolAttr("always")}set always(t){this.setBoolAttr("always",t)}get fixed(){return this.getBoolAttr("fixed")}set fixed(t){this.setBoolAttr("fixed",t)}get floating(){return this.getBoolAttr("floating")}set floating(t){this.setBoolAttr("floating",t)}}customElements.define("nk-tab-bar",nt);class it extends p{static get observedAttributes(){return["icon","label","value","href","active","disabled","drawer"]}render(){this._btn=this.createElement("button",["nk-tab-bar-item"],{type:"button"}),this._iconSlot=this.createElement("slot",[],{name:"icon"}),this._icon=this.createElement("span",["icon"],{"aria-hidden":"true"}),this._iconSlot.appendChild(this._icon),this._label=this.createElement("span",["label"]),this._labelSlot=document.createElement("slot"),this._labelText=document.createTextNode(""),this._labelSlot.appendChild(this._labelText),this._label.appendChild(this._labelSlot),this._btn.append(this._iconSlot,this._label),this._wrapper.appendChild(this._btn),this._sync()}_sync(){this._icon.textContent=this.getAttribute("icon")??"",this._labelText.data=this.getAttribute("label")??"";const t=this.getBoolAttr("active");this._btn.classList.toggle("active",t),t?this._btn.setAttribute("aria-current","page"):this._btn.removeAttribute("aria-current"),this._btn.disabled=this.getBoolAttr("disabled");const e=this.getAttribute("href");e?this._btn.setAttribute("data-href",e):this._btn.removeAttribute("data-href")}setupEvents(){this._onClick=()=>this.select(),this._btn.addEventListener("click",this._onClick)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick)}select(){if(this.getBoolAttr("disabled"))return;const t=this.getAttribute("href");if(!this.emit("nk-select",{value:this.value,label:this.label,href:t,item:this,drawer:this.getBoolAttr("drawer")}))return;if(this.getBoolAttr("drawer")){const t=this.closest("nk-app")?.querySelector("nk-sidebar")??document.querySelector("nk-sidebar");return void t?.toggle?.()}const e=this.closest("nk-tab-bar");e?e.value=this.value:this.setBoolAttr("active",!0),t&&location.assign(t)}onAttributeChanged(){this._sync()}focus(t){this._btn?.focus(t)}get value(){return this.getAttribute("value")??this.label}set value(t){this.setAttribute("value",t)}get label(){return this.getAttribute("label")??this.textContent.trim()}set label(t){this.setAttribute("label",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}get disabled(){return this.getBoolAttr("disabled")}set disabled(t){this.setBoolAttr("disabled",t)}get drawer(){return this.getBoolAttr("drawer")}set drawer(t){this.setBoolAttr("drawer",t)}}customElements.define("nk-tab-bar-item",it);class st extends p{static get observedAttributes(){return["icon","cover","narrow","full","small"]}render(){this._page=this.createElement("div",["nk-page"]),this._icon=this.createElement("div",["nk-page-icon"],{role:"button",title:"Change icon"});const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon),this._page.appendChild(t),this._page.appendChild(document.createElement("slot")),this._cover=this.createElement("div",["nk-cover"]),this._coverSlot=this.createElement("slot",[],{name:"cover"}),this._coverSlot.appendChild(this._cover),this._build()}_build(){if(this._wrapper.replaceChildren(),this.getBoolAttr("narrow"))this._wrapper.append(this._coverSlot,this._page);else{const t=this.createElement("div",["nk-page-scroll"]);t.append(this._coverSlot,this._page),this._wrapper.appendChild(t)}this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none",this._cover.style.display=this.getBoolAttr("cover")?"":"none";const e=this._coverSlot.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.data.trim());this._page.classList.toggle("covered",this.getBoolAttr("cover")||e),this._page.classList.toggle("full",this.getBoolAttr("full")),this._page.classList.toggle("small",this.getBoolAttr("small"))}setupEvents(){this._onIcon=()=>this.emit("nk-action",{action:"icon",value:this.getAttribute("icon")}),this._onCover=()=>this._sync(),this._icon.addEventListener("click",this._onIcon),this._coverSlot.addEventListener("slotchange",this._onCover),this._sync()}teardownEvents(){this._icon?.removeEventListener("click",this._onIcon),this._coverSlot?.removeEventListener("slotchange",this._onCover)}onAttributeChanged(t){"narrow"===t?this._build():this._sync()}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}get cover(){return this.getBoolAttr("cover")}set cover(t){this.setBoolAttr("cover",t)}get full(){return this.getBoolAttr("full")}set full(t){this.setBoolAttr("full",t)}get small(){return this.getBoolAttr("small")}set small(t){this.setBoolAttr("small",t)}}customElements.define("nk-page",st);class rt extends p{static get observedAttributes(){return["src","position"]}render(){this._cover=this.createElement("div",["nk-cover"]),this._img=this.createElement("img",[],{alt:""}),this._wrapper.appendChild(this._cover),this._sync()}_sync(){const t=this.getAttribute("src");t?(this._img.src=t,this._img.style.objectPosition=this.getAttribute("position")||"",this._img.isConnected||this._cover.appendChild(this._img)):this._img.remove()}onAttributeChanged(){this._sync()}get src(){return this.getAttribute("src")}set src(t){null==t?this.removeAttribute("src"):this.setAttribute("src",t)}}customElements.define("nk-page-cover",rt);class ot extends p{static get observedAttributes(){return["editable","placeholder","value"]}static get observesLightDom(){return!0}render(){this._h1=this.createElement("h1",["nk-page-title"]),this._slot=document.createElement("slot"),this._h1.appendChild(this._slot),this._wrapper.appendChild(this._h1),this._sync()}_sync(){if(this.getBoolAttr("editable")){this._slot.isConnected&&this._slot.remove(),this._h1.setAttribute("contenteditable","plaintext-only"),this._h1.setAttribute("spellcheck","false"),this._h1.setAttribute("role","textbox"),this._h1.setAttribute("aria-label","Title");const t=this.getAttribute("value")??this.textContent.trim();this._h1.textContent!==t&&document.activeElement!==this&&(this._h1.textContent=t),this._h1.setAttribute("data-placeholder",this.getAttribute("placeholder")||"")}else this._h1.removeAttribute("contenteditable"),this._h1.removeAttribute("role"),this.hasAttribute("value")?(this._slot.isConnected&&this._slot.remove(),this._h1.textContent=this.getAttribute("value")):this._slot.isConnected||(this._h1.textContent="",this._h1.appendChild(this._slot))}projectLightDom(){this._h1&&!this.hasAttribute("value")&&this._sync()}setupEvents(){this._committed=this.value,this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this._h1.blur())},this._onBlur=()=>this._commit(),this._h1.addEventListener("keydown",this._onKey),this._h1.addEventListener("blur",this._onBlur)}teardownEvents(){this._h1?.removeEventListener("keydown",this._onKey),this._h1?.removeEventListener("blur",this._onBlur)}_commit(){const t=this._h1.textContent.trim();t!==this._committed&&(this._committed=t,this.emit("nk-change",{value:t}))}onAttributeChanged(){this._sync()}get value(){return this.getBoolAttr("editable")?this._h1?.textContent.trim()??"":this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}get editable(){return this.getBoolAttr("editable")}set editable(t){this.setBoolAttr("editable",t)}focus(t){this._h1?.focus(t)}}customElements.define("nk-page-title",ot);class at extends p{render(){const t=this.createElement("div",["nk-page-meta"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-page-actions",at);class lt extends p{static get observedAttributes(){return["handle","drop-target"]}render(){this._box=this.createElement("div",["nk-block-host"]),this._handle=this.createElement("span",["nk-block-handle"],{"aria-hidden":"true"}),this._handle.textContent="โ ฟ",this._box.appendChild(this._handle),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box),this._sync()}_sync(){this._handle.style.display=this.getBoolAttr("handle")?"":"none",this._box.classList.toggle("nk-drop-target",this.getBoolAttr("drop-target"))}onAttributeChanged(){this._sync()}get handle(){return this.getBoolAttr("handle")}set handle(t){this.setBoolAttr("handle",t)}get dropTarget(){return this.getBoolAttr("drop-target")}set dropTarget(t){this.setBoolAttr("drop-target",t)}}customElements.define("nk-block-host",lt);const ht=["info","success","warning","danger"];class ct extends p{static get observedAttributes(){return["variant"]}render(){this._box=this.createElement("div",this._classes(),{role:"status"}),this._box.appendChild(document.createElement("slot")),this._box.appendChild(this.createElement("slot",[],{name:"action"})),this._wrapper.appendChild(this._box)}_classes(){const t=this.getAttribute("variant");return["nk-banner",...ht.includes(t)?[t]:[]]}onAttributeChanged(){this._box&&(this._box.className=this._classes().join(" "))}get variant(){return this.getAttribute("variant")}set variant(t){t?this.setAttribute("variant",t):this.removeAttribute("variant")}}customElements.define("nk-banner",ct);class dt extends p{static get observedAttributes(){return["icon","title","desc"]}render(){const t=this.createElement("div",["nk-empty"]);this._parts={};for(const[e,n]of[["icon","e-icon"],["title","e-title"],["desc","e-desc"]]){const i=this.createElement("div",[n]),s=this.createElement("slot",[],{name:e});s.appendChild(i),t.appendChild(s),this._parts[e]=i}const e=this.createElement("div",["e-actions"]);e.appendChild(document.createElement("slot")),t.appendChild(e),this._wrapper.appendChild(t),this.takeTitle(),this._sync()}_sync(){for(const[t,e]of Object.entries(this._parts)){const n="title"===t?this._titleText:this.getAttribute(t);e.textContent=n||"",e.style.display=n?"":"none"}}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&this._sync()}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}}customElements.define("nk-empty",dt);class pt extends p{static get observedAttributes(){return["lines","height","width","widths"]}render(){this._build()}_build(){this._wrapper.replaceChildren();const t=Math.max(1,Number(this.getAttribute("lines"))||1),e=this.getAttribute("height")||"13",n=(this.getAttribute("widths")||"").split(",").map(t=>t.trim()).filter(Boolean),i=this.getAttribute("width");for(let s=0;s<t;s++){const t=this.createElement("div",["nk-skeleton"],{"aria-hidden":"true"});t.style.height=/^\d+(\.\d+)?$/.test(e)?`${e}px`:e;const r=n[s]??i;r&&(t.style.width=r),this._wrapper.appendChild(t)}}onAttributeChanged(){this._build()}}customElements.define("nk-skeleton",pt);class ut extends p{static get observedAttributes(){return["badge"]}render(){const t=this.createElement("div",["nk-synced"]);this._badge=this.createElement("span",["synced-badge"]),t.appendChild(this._badge),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._sync()}_sync(){this._badge.textContent=this.getAttribute("badge")??"โณ synced"}onAttributeChanged(){this._sync()}get badge(){return this.getAttribute("badge")}set badge(t){this.setAttribute("badge",t)}}customElements.define("nk-synced",ut);const gt={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};class bt extends p{static get observedAttributes(){return["value"]}render(){this._strip=this.createElement("div",["nk-tabs"],{role:"tablist"}),this._tabSlot=document.createElement("slot"),this._strip.appendChild(this._tabSlot),this._panelSlot=this.createElement("slot",[],{name:"panel"}),this._wrapper.append(this._strip,this._panelSlot),this._sync()}get tabs(){return[...this.querySelectorAll(":scope > nk-tab")]}get panels(){return[...this.querySelectorAll(':scope > [slot="panel"]')]}_sync(){const t=this.tabs;if(!t.length)return;let e=this.getAttribute("value");if(null===e||!t.some(t=>t.getAttribute("value")===e||null===t.getAttribute("value")&&t.textContent.trim()===e)){const n=t.find(t=>t.hasAttribute("active"))||t[0];e=n.getAttribute("value")??n.textContent.trim()}for(const n of t){(n.getAttribute("value")??n.textContent.trim())===e?n.setAttribute("active",""):n.removeAttribute("active")}for(const t of this.panels)t.hidden=t.dataset.tab!==e;this._value=e}setupEvents(){this._onSlot=()=>this._sync(),this._onKey=t=>{const e=gt[t.key];if(!e)return;const n=this.tabs.filter(t=>!t.hasAttribute("disabled")),i=n.indexOf(t.target.closest?.("nk-tab"));if(i<0||n.length<2)return;t.preventDefault();const s=n[(i+e+n.length)%n.length];s.select(),s.focus()},this._tabSlot.addEventListener("slotchange",this._onSlot),this._panelSlot.addEventListener("slotchange",this._onSlot),this.addEventListener("keydown",this._onKey),this._sync()}teardownEvents(){this._tabSlot?.removeEventListener("slotchange",this._onSlot),this._panelSlot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("keydown",this._onKey)}onAttributeChanged(){const t=this._value;this._sync(),this._value!==t&&this.emit("nk-change",{value:this._value})}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-tabs",bt);class mt extends p{static get observedAttributes(){return["active","value","disabled"]}render(){this._tab=this.createElement("span",["nk-tab"],{role:"tab"}),this._tab.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._tab),this._sync()}_sync(){const t=this.getBoolAttr("active");this._tab.classList.toggle("active",t),this._tab.setAttribute("aria-selected",t?"true":"false"),this._tab.tabIndex=t?0:-1,this._tab.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false")}setupEvents(){this._onClick=()=>this.select(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._tab.addEventListener("click",this._onClick),this._tab.addEventListener("keydown",this._onKey)}teardownEvents(){this._tab?.removeEventListener("click",this._onClick),this._tab?.removeEventListener("keydown",this._onKey)}select(){if(this.getBoolAttr("disabled"))return;if(!this.emit("nk-select",{value:this.value,label:this.textContent.trim(),item:this}))return;const t=this.closest("nk-tabs");t?t.value=this.value:this.setBoolAttr("active",!0)}onAttributeChanged(){this._sync()}focus(t){this._tab?.focus(t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}}customElements.define("nk-tab",mt);const kt={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};class _t extends u{static get observedAttributes(){return["value","name","disabled","scroll","wrap"]}render(){this._box=this.createElement("div",["nk-segmented"],{role:"radiogroup"}),this._slot=document.createElement("slot"),this._box.appendChild(this._slot),this._wrapper.appendChild(this._box),this._syncBox(),this._sync()}_syncBox(){this._box.classList.toggle("scroll",this.getBoolAttr("scroll")),this._box.classList.toggle("wrap",this.getBoolAttr("wrap"))}get buttons(){return this._slot?.assignedElements().filter(t=>"button"===t.localName)??[]}_valueOf(t){return t.getAttribute("value")??t.textContent.trim()}_sync(){const t=this.buttons;if(!t.length)return;let e=this.getAttribute("value");null!==e&&t.some(t=>this._valueOf(t)===e)||(e=this._valueOf(t.find(t=>t.classList.contains("active"))||t[0])),void 0===this._defaultValue&&(this._defaultValue=e);const n=this.getBoolAttr("disabled")||!!this._formDisabled;for(const i of t){const t=this._valueOf(i)===e;i.type="button",i.setAttribute("role","radio"),i.setAttribute("aria-checked",t?"true":"false"),i.classList.toggle("active",t),i.tabIndex=t?0:-1,i.disabled=n}this._value=e,this.setFormValue(e),this._reveal(this._revealed?"smooth":"instant")}_reveal(t){if(!this.getBoolAttr("scroll")||!this._box?.clientWidth)return;const e=this.buttons.find(t=>t.classList.contains("active"));if(!e)return;const n=this._box.getBoundingClientRect(),i=e.getBoundingClientRect(),s=i.left<n.left?i.left-n.left-8:i.right>n.right?i.right-n.right+8:0,r="smooth"===t&&!matchMedia("(prefers-reduced-motion: reduce)").matches;s&&this._box.scrollBy({left:s,behavior:r?"smooth":"instant"}),this._revealed=!0}setupEvents(){this._onSlot=()=>this._sync(),this._onClick=t=>{const e=t.target.closest?.("button");e&&this.buttons.includes(e)&&!e.disabled&&this._choose(this._valueOf(e))},this._onKey=t=>{const e=kt[t.key];if(!e)return;const n=this.buttons,i=n.indexOf(t.target.closest?.("button"));if(i<0||n.length<2)return;t.preventDefault();const s=n[(i+e+n.length)%n.length];this._choose(this._valueOf(s)),s.focus()},this._slot.addEventListener("slotchange",this._onSlot),this.addEventListener("click",this._onClick),this.addEventListener("keydown",this._onKey),this._resize=new ResizeObserver(()=>this._reveal("instant")),this._resize.observe(this._box),this._sync()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("click",this._onClick),this.removeEventListener("keydown",this._onKey),this._resize?.disconnect()}_choose(t){t!==this._value&&(this._syncing=!0,this.setAttribute("value",t),this._syncing=!1,this._sync(),this.emit("nk-change",{value:t,name:this.name}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t){"scroll"!==t&&"wrap"!==t?this._syncing||this._sync():this._syncBox()}resetValue(){void 0!==this._defaultValue&&this.setAttribute("value",this._defaultValue)}onFormDisabled(t){this._formDisabled=t,this._sync()}get value(){return this._value??this.getAttribute("value")}set value(t){this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get scroll(){return this.getBoolAttr("scroll")}set scroll(t){this.setBoolAttr("scroll",t)}get wrap(){return this.getBoolAttr("wrap")}set wrap(t){this.setBoolAttr("wrap",t)}}customElements.define("nk-segmented",_t);class vt extends p{render(){const t=this.createElement("div",["nk-stats"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-stats",vt);class xt extends p{static get observedAttributes(){return["label","value","delta","trend"]}render(){const t=this.createElement("div",["nk-stat"]);this._parts={};for(const[e,n]of[["label","s-label"],["value","s-value"],["delta","s-delta"]]){const i=this.createElement("div",[n]),s=this.createElement("slot",[],{name:e});s.appendChild(i),t.appendChild(s),this._parts[e]=i}this._wrapper.appendChild(t),this._sync()}_sync(){for(const[t,e]of Object.entries(this._parts)){const n=this.getAttribute(t);e.textContent=n??"",e.style.display=null===n?"none":""}const t=this.getAttribute("trend");this._parts.delta.className="s-delta"+("up"===t||"down"===t?` ${t}`:"")}onAttributeChanged(){this._sync()}get value(){return this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-stat",xt);class ft extends p{static get observedAttributes(){return["more"]}render(){const t=this.createElement("div",["nk-avatar-group"]);t.appendChild(document.createElement("slot")),this._more=this.createElement("span",["mini-avatar","more"]),t.appendChild(this._more),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("more");this._more.textContent=t||"",this._more.style.display=t?"":"none"}onAttributeChanged(){this._sync()}get more(){return this.getAttribute("more")}set more(t){null==t?this.removeAttribute("more"):this.setAttribute("more",t)}}customElements.define("nk-avatar-group",ft);const yt=["gray","brown","orange","yellow","green","blue","purple","pink","red"];function wt(t,e){for(const n of yt)t.classList.toggle(n,n===e);t.style.background=e&&!yt.includes(e)?e:""}const At=t=>String(t||"").split(/\s+/).map(t=>t[0]).filter(Boolean).join("").slice(0,2).toUpperCase();class Et extends p{static get observedAttributes(){return["size","color","square","src","name"]}render(){this._box=this.createElement("span",["nk-avatar"]),this._slot=document.createElement("slot"),this._initials=document.createTextNode(""),this._slot.appendChild(this._initials),this._img=this.createElement("img",[],{alt:""}),this._box.appendChild(this._slot),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t=this.getAttribute("size");for(const e of["small","large","xlarge"])this._box.classList.toggle(e,e===t);this._box.classList.toggle("square",this.getBoolAttr("square")),wt(this._box,this.getAttribute("color"));const e=this.getAttribute("name");this._initials.data=At(e);const n=this.getAttribute("src");n?(this._img.src=n,this._img.alt=e||"",this._slot.isConnected&&this._slot.replaceWith(this._img)):this._img.isConnected&&this._img.replaceWith(this._slot),e&&!n?(this._box.setAttribute("role","img"),this._box.setAttribute("aria-label",e)):(this._box.removeAttribute("role"),this._box.removeAttribute("aria-label"))}onAttributeChanged(){this._sync()}get size(){return this.getAttribute("size")}set size(t){null==t?this.removeAttribute("size"):this.setAttribute("size",t)}get color(){return this.getAttribute("color")}set color(t){null==t?this.removeAttribute("color"):this.setAttribute("color",t)}get src(){return this.getAttribute("src")}set src(t){null==t?this.removeAttribute("src"):this.setAttribute("src",t)}}customElements.define("nk-avatar",Et);const Ct=["person","page","date"];class Bt extends p{static get observedAttributes(){return["type"]}render(){this._box=this.createElement("span",this._classes()),this._box.appendChild(this.createElement("slot",[],{name:"avatar"})),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box)}_classes(){const t=this.getAttribute("type");return["nk-mention",...Ct.includes(t)?[t]:[]]}onAttributeChanged(){this._box&&(this._box.className=this._classes().join(" "))}get type(){return this.getAttribute("type")}set type(t){t?this.setAttribute("type",t):this.removeAttribute("type")}}customElements.define("nk-mention",Bt);class Lt extends p{static get observedAttributes(){return["icon","value","disabled"]}render(){this._btn=this.createElement("button",["nk-template-btn"],{type:"button"});const t=document.createElement("span");this._icon=document.createElement("span"),this._space=document.createTextNode(" "),t.append(this._icon,this._space,document.createElement("slot")),this._btn.appendChild(t),this._wrapper.appendChild(this._btn),this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._space.data=t?" ":"",this._btn.disabled=this.getBoolAttr("disabled")}setupEvents(){this._onClick=()=>this.emit("nk-select",{value:this.value,label:this.textContent.trim()}),this._btn.addEventListener("click",this._onClick)}teardownEvents(){this._btn?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}focus(t){this._btn?.focus(t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}}customElements.define("nk-template-btn",Lt);class St extends u{static get observedAttributes(){return["name","value","title","desc","selected","disabled"]}render(){this._card=this.createElement("div",["nk-model-card"],{role:"radio",tabindex:"0"}),this._card.appendChild(this.createElement("div",["m-radio"]));const t=document.createElement("div");this._name=this.createElement("div",["m-name"]);const e=this.createElement("slot",[],{name:"title"});e.appendChild(this._name),this._desc=this.createElement("div",["m-desc"]);const n=this.createElement("slot",[],{name:"desc"});n.appendChild(this._desc),t.append(e,n),this._card.appendChild(t),this._wrapper.appendChild(this._card),this._defaultSelected=this.getBoolAttr("selected"),this.takeTitle(),this._sync(),this.getBoolAttr("selected")&&this._unselectPeers()}_sync(){const t=this.getBoolAttr("selected");this._card.classList.toggle("selected",t),this._card.setAttribute("aria-checked",t?"true":"false"),this._card.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false"),this._name.textContent=this._titleText||"";const e=this.getAttribute("desc");this._desc.textContent=e||"",this._desc.style.display=e?"":"none",this.setFormValue(t?this.getAttribute("value")||"on":null,t?"selected":"unselected")}_group(){const t=this.getAttribute("name"),e=this.getRootNode();return t&&"function"==typeof e?.querySelectorAll?[...e.querySelectorAll("nk-model-card")].filter(e=>e.getAttribute("name")===t):[this]}_unselectPeers(){for(const t of this._group())t!==this&&t.hasAttribute("selected")&&t.removeAttribute("selected")}setupEvents(){this._onClick=()=>this.select(),this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.select())},this._card.addEventListener("click",this._onClick),this._card.addEventListener("keydown",this._onKey)}teardownEvents(){this._card?.removeEventListener("click",this._onClick),this._card?.removeEventListener("keydown",this._onKey)}select(){this.getBoolAttr("disabled")||this.getBoolAttr("selected")||(this.setBoolAttr("selected",!0),this.emit("nk-change",{value:this.value,name:this.name,checked:!0}),this.emit("nk-select",{value:this.value,label:this.title}),this.dispatchEvent(new Event("change",{bubbles:!0})))}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&(this._sync(),"selected"===t&&this.getBoolAttr("selected")&&this._unselectPeers())}resetValue(){this.setBoolAttr("selected",this._defaultSelected)}focus(t){this._card?.focus(t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get selected(){return this.getBoolAttr("selected")}set selected(t){this.setBoolAttr("selected",t)}get value(){return this.getAttribute("value")||"on"}set value(t){this.setAttribute("value",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}}customElements.define("nk-model-card",St);class zt extends p{static get observedAttributes(){return["avatar"]}render(){const t=this.createElement("div",["nk-profile-row"]);this._avatar=this.createElement("div",["big-avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar),t.appendChild(e),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this._sync()}_sync(){this._avatar.textContent=this.getAttribute("avatar")||""}onAttributeChanged(){this._sync()}}customElements.define("nk-profile-row",zt);class Nt extends p{static get observedAttributes(){return["title"]}render(){const t=this.createElement("div",["nk-danger-zone"]);this._titleEl=this.createElement("div",["dz-title"]),t.appendChild(this._titleEl),t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t),this.takeTitle(),this._sync()}_sync(){const t=this._titleText;this._titleEl.textContent=t||"",this._titleEl.style.display=t?"":"none"}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&this._sync()}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}}customElements.define("nk-danger-zone",Nt);class Tt extends p{render(){const t=this.createElement("div",["nk-member-list"]);this._slot=document.createElement("slot"),t.appendChild(this._slot),this._wrapper.appendChild(t),this._mark()}_mark(){const t=this._slot.assignedElements().filter(t=>"nk-member-row"===t.localName);t.forEach((e,n)=>{n===t.length-1?e.setAttribute("last",""):e.removeAttribute("last")})}setupEvents(){this._onSlot=()=>this._mark(),this._slot.addEventListener("slotchange",this._onSlot),this._mark()}teardownEvents(){this._slot?.removeEventListener("slotchange",this._onSlot)}}customElements.define("nk-member-list",Tt);class Dt extends p{static get observedAttributes(){return["name","mail","avatar","color","last"]}render(){this._row=this.createElement("div",["nk-member-row"]),this._avatar=this.createElement("span",["nk-avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar);const e=document.createElement("div");this._name=document.createTextNode(""),this._mail=this.createElement("div",["m-mail"]),e.append(this._name,this._mail);const n=document.createElement("div");n.style.marginLeft="auto",n.appendChild(this.createElement("slot",[],{name:"role"})),this._row.append(t,e,n,document.createElement("slot")),this._wrapper.appendChild(this._row),this._sync()}_sync(){this._name.data=this.getAttribute("name")||"";const t=this.getAttribute("mail");this._mail.textContent=t||"",this._mail.style.display=t?"":"none";const e=this.getAttribute("avatar");this._avatar.textContent=e||At(this.getAttribute("name")),wt(this._avatar,this.getAttribute("color")),this._row.classList.toggle("last",this.getBoolAttr("last"))}onAttributeChanged(){this._sync()}}customElements.define("nk-member-row",Dt);class Mt extends p{render(){const t=this.createElement("dl",["nk-props"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-props",Mt);class Ft extends p{static get observedAttributes(){return["label","icon"]}render(){this._row=this.createElement("div",["nk-prop"]),this._name=this.createElement("dt",["p-name"]),this._icon=this.createElement("span",["p-icon"]);const t=this.createElement("slot",[],{name:"icon"});t.appendChild(this._icon),this._label=document.createTextNode(""),this._name.append(t,this._label),this._value=this.createElement("dd",["p-value"]),this._value.appendChild(document.createElement("slot")),this._row.append(this._name,this._value),this._wrapper.appendChild(this._row),this._sync()}_sync(){const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none",this._label.data=this.getAttribute("label")||""}setupEvents(){this._onClick=t=>{const e=t.composedPath().includes(this._name)?"name":"value";this.emit("nk-action",{action:e,label:this.label})},this._row.addEventListener("click",this._onClick)}teardownEvents(){this._row?.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}get label(){return this.getAttribute("label")||""}set label(t){this.setAttribute("label",t)}get icon(){return this.getAttribute("icon")}set icon(t){null==t?this.removeAttribute("icon"):this.setAttribute("icon",t)}}customElements.define("nk-prop",Ft);class Vt extends p{render(){const t=this.createElement("div",["nk-panels"]);t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-panels",Vt);class It extends p{static get observedAttributes(){return["title","icon","cover","href","target"]}render(){this._cover=this.createElement("div",["nk-cover"]),this._img=this.createElement("img",[],{alt:""}),this._icon=this.createElement("div",["nk-page-icon"]),this._heading=document.createElement("h3"),this._slot=document.createElement("slot"),this.takeTitle(),this._build()}_build(){const t=this.getAttribute("href"),e=this.createElement(t?"a":"div",["nk-panel"]);e.append(this._cover,this._icon,this._heading,this._slot),this._wrapper.replaceChildren(e),this._box=e,this._sync()}_sync(){const t=this.getAttribute("href");t&&(this._box.setAttribute("href",t),this._box.target=this.getAttribute("target")||"");const e=this.getAttribute("cover");this._cover.style.display=null===e?"none":"",e?(this._img.src=e,this._img.isConnected||this._cover.appendChild(this._img)):this._img.remove();const n=this.getAttribute("icon");this._icon.textContent=n||"",this._icon.style.display=n?"":"none",this._heading.textContent=this._titleText||"",this._heading.style.display=this._titleText?"":"none"}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&("href"!==t||null===n==("div"===this._box.localName)?this._sync():this._build())}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get href(){return this.getAttribute("href")}set href(t){null==t?this.removeAttribute("href"):this.setAttribute("href",t)}}customElements.define("nk-panel",It);let qt=0,jt="";function Ot(){0===qt++&&(jt=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function Pt(){qt>0&&0===--qt&&(document.documentElement.style.overflow=jt)}function Kt(t){const e=[];let n=t;for(;n&&n!==document.body;){const t=(n.parentNode,ShadowRoot,n.parentNode);if(!t)break;for(const i of t.children)i===n||i.inert||/^(SCRIPT|STYLE|LINK|TEMPLATE)$/.test(i.tagName)||(i.inert=!0,e.push(i));n=t instanceof ShadowRoot?t.host:t}return()=>{for(const t of e)t.inert=!1}}function $t(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function Rt(t){const e=t=>{for(const n of t.querySelectorAll("*")){if(n.matches('a[href], button:not([disabled]), input:not([disabled]):not([type=hidden]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable="true"], [contenteditable="plaintext-only"]')&&n.getClientRects().length)return n;if(n.shadowRoot){const t=e(n.shadowRoot);if(t)return t}}return null};return e(t)}class Ut extends p{static get observedAttributes(){return["open","title"]}render(){this.takeTitle(),this._backdrop=this.createElement("div",["nk-sheet-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-sheet"],{role:"dialog","aria-modal":"true",tabindex:"-1"}),this._heading=this.createElement("div",["sh-title"],{id:"title"}),this._box.append(this.createElement("div",["sh-grabber"]),this._heading,document.createElement("slot")),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncTitle(),this._syncOpen()}_syncTitle(){const t=this._titleText||"";this._heading.textContent=t,this._heading.hidden=!t,t?this._box.setAttribute("aria-labelledby","title"):this._box.removeAttribute("aria-labelledby")}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=$t(),Ot(),this._undoInert=Kt(this),requestAnimationFrame(()=>(Rt(this)||this._box).focus({preventScroll:!0}));else{Pt(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey)}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey),this._wasOpen&&(Pt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t,e,n){"title"!==t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this.takeTitle(n)&&this._syncTitle()}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._syncTitle()}}customElements.define("nk-sheet",Ut);class Ht extends p{static get observedAttributes(){return["steps","current","label"]}render(){this._list=this.createElement("ol",["nk-steps"]),this._wrapper.appendChild(this._list),this._sync()}_items(){return this._steps?this._steps:(this.getAttribute("steps")||"").split(",").map(t=>t.trim()).filter(Boolean)}_sync(){const t=this.getAttribute("label");t?this._list.setAttribute("aria-label",t):this._list.removeAttribute("aria-label");const e=this.current;this._list.replaceChildren(...this._items().map((t,n)=>{const i=n+1,{label:s,desc:r}="object"==typeof t&&t?t:{label:String(t)},o=this.createElement("li",["nk-step"]);o.classList.toggle("done",i<e),o.classList.toggle("current",i===e),i===e&&o.setAttribute("aria-current","step");const a=this.createElement("span",["st-mark"],{"aria-hidden":"true"});a.textContent=i<e?"โ":String(i);const l=document.createElement("span");if(l.textContent=s??"",r){const t=this.createElement("span",["st-desc"]);t.textContent=r,l.appendChild(t)}return o.append(a,l),o}))}onAttributeChanged(){this._sync()}get steps(){return this._items()}set steps(t){this._steps=Array.isArray(t)?t:null,this._list&&this._sync()}get current(){const t=parseInt(this.getAttribute("current"),10);return Number.isFinite(t)?t:1}set current(t){this.setAttribute("current",String(t))}next(){return this.current=Math.min(this.current+1,this._items().length+1),this.current}}customElements.define("nk-steps",Ht);class Wt extends p{static get observedAttributes(){return["href","title","desc","favicon","cover","target","url"]}render(){this.takeTitle(),this._a=this.createElement("a",["nk-bookmark"]),this._wrapper.appendChild(this._a),this._sync()}_sync(){if(!this._a)return;const t=this.getAttribute("href")||"";this._a.setAttribute("href",t);const e=this.getAttribute("target")||"_blank";this._a.setAttribute("target",e),"_blank"===e?this._a.setAttribute("rel","noopener"):this._a.removeAttribute("rel");let n=t;try{n=new URL(t,location.href).host}catch{}const i=this.createElement("span",["bm-text"]),s=this.createElement("span",["bm-title"]);s.textContent=this._titleText||n,i.appendChild(s);const r=this.getAttribute("desc");if(r){const t=this.createElement("span",["bm-desc"]);t.textContent=r,i.appendChild(t)}const o=this.createElement("span",["bm-url"]),a=this.getAttribute("favicon");a&&o.appendChild(this.createElement("img",["bm-favicon"],{src:a,alt:""}));const l=document.createElement("span");l.textContent=this.getAttribute("url")||t,o.appendChild(l),i.appendChild(o);const h=[i],c=this.getAttribute("cover");if(c){const t=this.createElement("span",["bm-cover"]);t.appendChild(this.createElement("img",[],{src:c,alt:""})),h.push(t)}this._a.replaceChildren(...h)}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&this._sync()}focus(t){this._a?.focus(t)}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._sync()}get href(){return this.getAttribute("href")||""}set href(t){this.setAttribute("href",t)}}customElements.define("nk-bookmark",Wt);class Gt extends p{static get observedAttributes(){return["value","mono","wrap","wide","secret","copy-label","copied-label","show-label","hide-label"]}render(){this._val??=this.getAttribute("value")??"",this._box=this.createElement("div",["nk-copy-field"]),this._text=this.createElement("span",["cf-value"]),this._show=this.createElement("button",["cf-btn"],{type:"button"}),this._copy=this.createElement("button",["cf-btn"],{type:"button"}),this._box.append(this._text,this._copy),this._wrapper.appendChild(this._box),this._sync()}_sync(){if(!this._box)return;for(const t of["mono","wrap","wide"])this._box.classList.toggle(t,this.getBoolAttr(t));const t=this.getBoolAttr("secret");this._text.textContent=t&&!this._revealed?"โข".repeat(Math.min(this._val.length,24)):this._val,t&&!this._show.isConnected&&this._copy.before(this._show),t||this._show.remove(),this._show.textContent=this._revealed?this.getAttribute("hide-label")||"Hide":this.getAttribute("show-label")||"Show",this._show.setAttribute("aria-pressed",String(!!this._revealed)),this._copy.textContent=this._copied?this.getAttribute("copied-label")||"Copied":this.getAttribute("copy-label")||"Copy",this._copy.classList.toggle("copied",!!this._copied)}setupEvents(){this._onCopy=()=>this.copy(),this._onShow=()=>{this._revealed=!this._revealed,this._sync()},this._copy.addEventListener("click",this._onCopy),this._show.addEventListener("click",this._onShow)}teardownEvents(){this._copy?.removeEventListener("click",this._onCopy),this._show?.removeEventListener("click",this._onShow),clearTimeout(this._timer)}onAttributeChanged(t,e,n){"value"===t&&(this._val=n??""),this._sync()}async copy(){const t=this._val;let e=!0;try{await navigator.clipboard.writeText(t)}catch{e=!1}return e?(this._copied=!0,clearTimeout(this._timer),this._timer=setTimeout(()=>{this._copied=!1,this._sync()},1500)):this._revealed=!0,this._sync(),e||getSelection()?.selectAllChildren(this._text),this.emit("nk-action",{action:"copy",value:t,ok:e}),e}get value(){return this._val??this.getAttribute("value")??""}set value(t){this._val=null==t?"":String(t),this._sync()}get secret(){return this.getBoolAttr("secret")}set secret(t){this.setBoolAttr("secret",t)}}function Yt(t){const e=t.slice(t.indexOf(",")+1),n=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(3*e.length/4)-n}customElements.define("nk-copy-field",Gt);class Qt extends p{static get observedAttributes(){return["src","initials","square","label","max","type","quality","accept","choose-label","change-label","remove-label"]}render(){this._src??=this.getAttribute("src")||"",this._row=this.createElement("div",["nk-profile-row"],{role:"group"}),this._avatar=this.createElement("div",["big-avatar"]);const t=this.createElement("div",["pr-actions"]);this._choose=this.createElement("button",["nk-btn","secondary","small"],{type:"button"}),this._remove=this.createElement("button",["nk-btn","secondary","small","pr-remove"],{type:"button"}),this._input=this.createElement("input",[],{type:"file",tabindex:"-1"}),this._input.hidden=!0,t.append(this._choose,this._remove,this._input),this._row.append(this._avatar,t),this._wrapper.appendChild(this._row),this._sync()}get _max(){return Math.max(1,Math.floor(Number(this.getAttribute("max")))||512)}get _type(){return this.getAttribute("type")||"image/jpeg"}get _quality(){const t=Number(this.getAttribute("quality"));return this.hasAttribute("quality")&&t>=0&&t<=1?t:.82}_sync(){if(!this._row)return;this._avatar.classList.toggle("square",this.getBoolAttr("square")),this._src?this._img&&this._img.getAttribute("src")===this._src||(this._img=this.createElement("img",[],{src:this._src,alt:""}),this._avatar.replaceChildren(this._img)):(this._img=null,this._avatar.textContent=this.getAttribute("initials")||"");const t=this.getAttribute("label");t?this._row.setAttribute("aria-label",t):this._row.removeAttribute("aria-label"),this._choose.textContent=this._src?this.getAttribute("change-label")||"Change image":this.getAttribute("choose-label")||"Upload image",this._remove.textContent=this.getAttribute("remove-label")||"Remove",this._remove.hidden=!this._src,this._input.accept=this.getAttribute("accept")||"image/*"}async _pick(t){if(t)try{const e=await createImageBitmap(t,{imageOrientation:"from-image"}),n=Math.min(1,this._max/Math.max(e.width,e.height)),i=document.createElement("canvas");i.width=Math.max(1,Math.round(e.width*n)),i.height=Math.max(1,Math.round(e.height*n));const s=i.getContext("2d");"image/jpeg"===this._type&&(s.fillStyle="#fff",s.fillRect(0,0,i.width,i.height)),s.drawImage(e,0,0,i.width,i.height),e.close();const r=i.toDataURL(this._type,this._quality);this.src=r,this.emit("nk-change",{dataUrl:r,width:i.width,height:i.height,size:Yt(r)})}catch(e){this.emit("nk-error",{message:e?.message||String(e),name:t.name})}}setupEvents(){this._onChoose=()=>this._input.click(),this._onChange=t=>{const e=t.target.files?.[0];t.target.value="",this._pick(e)},this._onRemove=()=>{this.src="",this._choose.focus(),this.emit("nk-change",{dataUrl:"",width:0,height:0,size:0})},this._choose.addEventListener("click",this._onChoose),this._input.addEventListener("change",this._onChange),this._remove.addEventListener("click",this._onRemove)}teardownEvents(){this._choose?.removeEventListener("click",this._onChoose),this._input?.removeEventListener("change",this._onChange),this._remove?.removeEventListener("click",this._onRemove)}onAttributeChanged(t,e,n){"src"===t&&(this._src=n||""),this._sync()}choose(){this._input?.click()}get src(){return this._src??this.getAttribute("src")??""}set src(t){this._src=t||"",this._sync()}get square(){return this.getBoolAttr("square")}set square(t){this.setBoolAttr("square",t)}}customElements.define("nk-image-picker",Qt);const Zt=t=>String(t).padStart(2,"0"),Jt=t=>`${t.getFullYear()}-${Zt(t.getMonth()+1)}-${Zt(t.getDate())}`,Xt=(t,e)=>new Date(t.getFullYear(),t.getMonth(),t.getDate()+e);function te(t){if(t instanceof Date)return Number.isNaN(t.getTime())?null:new Date(t.getFullYear(),t.getMonth(),t.getDate());if(t&&"object"==typeof t)return t.start?te(t.start):null;const e=String(t??"").trim();let n=e.match(/^(\d{4})-(\d{2})-(\d{2})/);return n?new Date(+n[1],+n[2]-1,+n[3]):(n=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/),n?new Date(+n[3],+n[2]-1,+n[1]):null)}function ee(t){const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()));return e.setUTCDate(e.getUTCDate()+4-(e.getUTCDay()||7)),Math.ceil(((e-Date.UTC(e.getUTCFullYear(),0,1))/864e5+1)/7)}const ne=t=>t||document.documentElement.lang||navigator.language||"en";function ie(t){try{const e=new Intl.Locale(t),n=e.getWeekInfo?.()??e.weekInfo;if(n?.firstDay)return n.firstDay%7}catch{}return 1}function se(t,e,n=0){const i=new Intl.DateTimeFormat(t,{weekday:"short"});return Array.from({length:7},(t,s)=>{const r=i.format(new Date(2026,5,7+(e+s)%7)).replace(".","");return n?r.slice(0,n):r})}function re(t,e){const[n,i]=t.split("-").map(Number),s=new Date(n,i-1,1),r=(s.getDay()-e+7)%7;return{m:i,first:s,day:t=>new Date(n,i-1,1-r+t),rows:Math.ceil((r+new Date(n,i,0).getDate())/7)}}function oe(t,e){const[n,i]=t.split("-").map(Number);return Jt(new Date(n,i-1+e,1)).slice(0,7)}const ae=t=>/^de\b/i.test(t)?"KW":"W",le='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 6l-6 6 6 6"/></svg>',he='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>';function ce(t){if(t.getClientRects().length)return t.getBoundingClientRect();for(const e of[...t.shadowRoot?.children??[],...t.children]){const t=ce(e);if(t.width||t.height)return t}return t.getBoundingClientRect()}function de(t,e,n){const i=ce(e);t.style.top=`${i.bottom+6}px`,"start"===n?(t.style.left=`${i.left}px`,t.style.right=""):(t.style.right=`${Math.max(8,innerWidth-i.right)}px`,t.style.left="")}const pe={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7},ue=new CSSStyleSheet;ue.replaceSync(":host([floating]) { display: block; position: fixed; z-index: 60; pointer-events: none; }");class ge extends u{static get hostStyles(){return ue}static get observedAttributes(){return["value","month","min","max","today","locale","week-start","weeks","weekend","range","time","clearable","days","label","today-label","prev-label","next-label","week-label","time-label","clear-label","floating","sheet","open","align","required"]}render(){this._readValue(this._pendingValue??this.getAttribute("value"));const t=this._pendingMonth||this._attrMonth();t&&(this._month=t),this._initialValue=this.getAttribute("value")??"",this._build()}_readValue(t){const e=String(t??"");if(this._start=this._end=this._day=null,this._time="",this.getBoolAttr("range")){const[t,n]=e.split("/");this._start=te(t)?Jt(te(t)):null,this._end=te(n)?Jt(te(n)):null}else te(e)&&(this._day=Jt(te(e)),this._time=e.match(/T(\d{2}:\d{2})/)?.[1]??"");const n=this._day||this._start;this._month=n?n.slice(0,7):this._month||this._attrMonth()||this._todayIso().slice(0,7),this._focus=null}_attrMonth(){const t=this.getAttribute("month");return/^\d{4}-\d{2}$/.test(t||"")?t:null}_todayIso(){return this.getAttribute("today")||Jt(new Date)}get value(){return this.getBoolAttr("range")?this._start?`${this._start}${this._end?`/${this._end}`:""}`:"":this._day?`${this._day}${this.getBoolAttr("time")&&this._time?`T${this._time}`:""}`:""}set value(t){this._readValue(t),this._grid?this._draw():this._pendingValue=String(t??"")}get start(){return this.getBoolAttr("range")?this._start:this._day}get end(){return this.getBoolAttr("range")?this._end:this._day}get month(){return this._month}set month(t){/^\d{4}-\d{2}$/.test(t)&&(this._month=t,this._focus=null,this._grid?this._draw():this._pendingMonth=t)}get days(){return this._days??{}}set days(t){this._days=t&&"object"==typeof t?t:{},this._grid&&this._draw()}_build(){const t=this.getBoolAttr("floating");this._cal=this.createElement("div",["nk-calendar"],{role:"group"});const e=this.createElement("div",["cal-head"]);this._title=this.createElement("div",["cal-title"],{"aria-live":"polite"}),this._todayBtn=this.createElement("button",["cal-nav"],{type:"button"}),this._prev=this.createElement("button",["cal-nav"],{type:"button"}),this._prev.innerHTML=le,this._next=this.createElement("button",["cal-nav"],{type:"button"}),this._next.innerHTML=he,e.append(this._title,this._todayBtn,this._prev,this._next),this._grid=this.createElement("div",["cal-grid"]),this._foot=this.createElement("div",["cal-foot"]),this._timeInput=this.createElement("input",["nk-input"],{type:"time"}),this._clear=this.createElement("button",["cal-nav"],{type:"button"}),this._cal.append(e,this._grid),this._pop=t?this.createElement("div",["nk-pop","floating"]):null,this._pop&&this._pop.appendChild(this._cal),this._wrapper.replaceChildren(this._pop??this._cal),this._draw()}get _hasTime(){return this.getBoolAttr("time")&&!this.getBoolAttr("range")}get _locale(){return ne(this.getAttribute("locale"))}get _weekStart(){const t=Number(this.getAttribute("week-start"));return this.hasAttribute("week-start")&&Number.isInteger(t)&&t>=0&&t<=6?t:ie(this._locale)}_syncPop(){this._pop?.classList.toggle("sheet",this.getBoolAttr("sheet")),this._pop?.classList.toggle("open",this.getBoolAttr("open"))}_draw(){const t=this._locale,e=this._weekStart,n=this.getBoolAttr("weeks"),i=this.getBoolAttr("range"),s=re(this._month,e),r=this._todayIso(),o=this.getAttribute("min")||"",a=this.getAttribute("max")||"",l=new Set((this.getAttribute("weekend")||"").split(",").map(t=>t.trim()).filter(Boolean).map(Number));let h=this._days;if(!h&&this.hasAttribute("days"))try{h=JSON.parse(this.getAttribute("days"))}catch{h={}}h??={};const c=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long",year:"numeric"});this._cal.classList.toggle("weeks",n),this._syncPop();const d=this.getAttribute("label");d?this._cal.setAttribute("aria-label",d):this._cal.removeAttribute("aria-label"),this._title.textContent=new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(s.first),this._todayBtn.textContent=this.getAttribute("today-label")||"Today",this._prev.setAttribute("aria-label",this.getAttribute("prev-label")||"Previous month"),this._next.setAttribute("aria-label",this.getAttribute("next-label")||"Next month");const p=Array.from({length:42},(t,e)=>Jt(s.day(e))),u=i?this._start:this._day;this._focus&&p.includes(this._focus)||(this._focus=p.includes(u)?u:`${this._month}-01`);const g=[];n&&g.push(this._head(this.getAttribute("week-label")||ae(t)));for(const n of se(t,e,2))g.push(this._head(n));for(let t=0;t<42;t++){const e=s.day(t),d=p[t],u=h[d]||{};if(n&&t%7==0){const t=this.createElement("span",["cal-week"],{"aria-hidden":"true"});t.textContent=ee(e),g.push(t)}const b=i&&this._start&&this._end&&d>this._start&&d<this._end,m=["cal-day",e.getMonth()!==s.m-1&&"out",(l.has(e.getDay())||u.off)&&"off",d===r&&"today",!i&&d===this._day&&"selected",i&&d===this._start&&"start",i&&d===(this._end||this._start)&&this._start&&"end",b&&"in-range"].filter(Boolean),k=this.createElement("button",m,{type:"button","data-date":d,tabindex:d===this._focus?"0":"-1","aria-pressed":String(m.includes("selected")||m.includes("start")||m.includes("end")),"aria-label":`${c.format(e)}${u.label?`, ${u.label}`:""}`});u.label&&(k.title=u.label),(o&&d<o||a&&d>a)&&k.setAttribute("aria-disabled","true"),k.textContent=e.getDate();const _=(u.marks||[]).slice(0,3);if(_.length){const t=this.createElement("span",["cal-marks"]);for(const e of _)t.appendChild(this.createElement("i",[e]));k.appendChild(t)}g.push(k)}const b=this._grid.contains(this._shadow.activeElement);this._grid.replaceChildren(...g),b&&this.focusDay();const m=this._hasTime,k=this.getBoolAttr("clearable");this._timeInput.value=this._time,this._timeInput.setAttribute("aria-label",this.getAttribute("time-label")||"Time"),this._clear.textContent=this.getAttribute("clear-label")||"Clear",this._foot.replaceChildren(...[m&&this._timeInput,k&&this._clear].filter(Boolean)),m||k?this._cal.appendChild(this._foot):this._foot.remove(),this._syncForm()}_syncForm(){this.setFormValue(this.value),this.getBoolAttr("required")&&!this.value?this.setValidity({valueMissing:!0},"Please choose a date.",this._grid?.querySelector('[tabindex="0"]')??void 0):this.setValidity({})}_head(t){const e=this.createElement("span",["cal-wd"],{"aria-hidden":"true"});return e.textContent=t,e}_goMonth(t,e){t!==this._month&&(this._month=t,this.emit("nk-month",{month:t})),this._focus=e??null,this._draw()}_pick(t){const e=this._grid.querySelector(`[data-date="${t}"]`);if("true"===e?.getAttribute("aria-disabled"))return;const n=this.value;let i=!0;this.getBoolAttr("range")?!this._start||this._end?(this._start=t,this._end=null,i=!1):t<this._start?(this._end=this._start,this._start=t):this._end=t:this._day=t,this._focus=t,t.slice(0,7)!==this._month?this._goMonth(t.slice(0,7),t):this._draw(),i&&(this.value!==n&&this.emit("nk-change",{value:this.value,start:this.start,end:this.end,time:this._time||null}),this.getBoolAttr("floating")&&!this._hasTime&&this.close())}setupEvents(){this._onGrid=t=>{const e=t.target.closest(".cal-day");e&&this._pick(e.dataset.date)},this._onToday=()=>{const t=this._todayIso();this._goMonth(t.slice(0,7),t)},this._onPrev=()=>this._goMonth(oe(this._month,-1)),this._onNext=()=>this._goMonth(oe(this._month,1)),this._onKey=t=>{const e=t.target.closest?.(".cal-day");if(!e)return;const n=te(e.dataset.date),i=this._weekStart,s=(n.getDay()-i+7)%7;let r=null;if(pe[t.key])r=Xt(n,pe[t.key]);else if("Home"===t.key)r=Xt(n,-s);else if("End"===t.key)r=Xt(n,6-s);else if("PageUp"===t.key||"PageDown"===t.key){const e=("PageUp"===t.key?-1:1)*(t.shiftKey?12:1),i=new Date(n.getFullYear(),n.getMonth()+e+1,0).getDate();r=new Date(n.getFullYear(),n.getMonth()+e,Math.min(n.getDate(),i))}if(!r)return;t.preventDefault();const o=Jt(r);o.slice(0,7)!==this._month?this._goMonth(o.slice(0,7),o):(this._focus=o,this._draw())},this._onTime=()=>{this._time=this._timeInput.value,this._syncForm(),this._day&&this.emit("nk-change",{value:this.value,start:this.start,end:this.end,time:this._time||null})},this._onClear=()=>{this.value&&(this._day=this._start=this._end=null,this._time="",this._draw(),this.emit("nk-change",{value:"",start:null,end:null,time:null}))},this._onOutside=t=>{const e=t.composedPath();e.includes(this)||this._anchor&&e.includes(this._anchor)||(t.preventDefault(),t.stopPropagation(),this.close())},this._onEscape=t=>{"Escape"===t.key&&this.getBoolAttr("floating")&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._grid.addEventListener("click",this._onGrid),this._grid.addEventListener("keydown",this._onKey),this._todayBtn.addEventListener("click",this._onToday),this._prev.addEventListener("click",this._onPrev),this._next.addEventListener("click",this._onNext),this._timeInput.addEventListener("change",this._onTime),this._clear.addEventListener("click",this._onClear),document.addEventListener("keydown",this._onEscape,!0),this.getBoolAttr("open")&&document.addEventListener("click",this._onOutside,!0)}teardownEvents(){this._grid?.removeEventListener("click",this._onGrid),this._grid?.removeEventListener("keydown",this._onKey),this._todayBtn?.removeEventListener("click",this._onToday),this._prev?.removeEventListener("click",this._onPrev),this._next?.removeEventListener("click",this._onNext),this._timeInput?.removeEventListener("change",this._onTime),this._clear?.removeEventListener("click",this._onClear),document.removeEventListener("keydown",this._onEscape,!0),document.removeEventListener("click",this._onOutside,!0)}onAttributeChanged(t,e,n){if("value"===t)return this._readValue(n),void this._draw();if("month"!==t){if("open"===t||"sheet"===t)return this._syncPop(),void("open"===t&&this._syncOpen());if("align"!==t){if("floating"===t)return this.teardownEvents(),this._build(),void(this.isConnected&&this.setupEvents());"range"===t&&this._readValue(this.getAttribute("value")),"days"===t&&(this._days=null),this._draw()}}else this.month=n}_syncOpen(){const t=this.getBoolAttr("open");if(this._anchor&&(this._anchor.shadowRoot?.querySelector("button, a[href]")??this._anchor).setAttribute("aria-expanded",String(t)),t)this._returnFocus=$t(),this._returnFocus?.matches(":focus-visible")&&requestAnimationFrame(()=>this.focusDay()),document.addEventListener("click",this._onOutside,!0);else{document.removeEventListener("click",this._onOutside,!0);const t=this._returnFocus;this._returnFocus=null;const e=$t();t?.isConnected&&e&&this._shadow.contains(e)&&t.focus({preventScroll:!0})}this.emit("nk-toggle",{open:t})}resetValue(){this._readValue(this._initialValue),this._draw()}restoreValue(t){this._readValue(t),this._draw()}onFormDisabled(t){this._cal?.toggleAttribute("inert",t)}show(t){t&&(this._anchor=t,de(this,t,this.getAttribute("align")));const e=this.start;e&&e.slice(0,7)!==this._month&&(this._month=e.slice(0,7),this._focus=null,this._draw()),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(t){this.getBoolAttr("open")?this.close():this.show(t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}focusDay(){this._grid?.querySelector('[tabindex="0"]')?.focus()}}customElements.define("nk-calendar",ge);const be=new Set(["nk-menu","nk-pop","nk-modal","nk-sheet","nk-cmdk","nk-toast"]),me=["nk-pop","nk-modal-backdrop","nk-sheet-backdrop","nk-cmdk-backdrop"];class ke extends p{static get observedAttributes(){return["open","label","close-label"]}render(){this._backdrop=this.createElement("div",["nk-peek-backdrop"]),this._box=this.createElement("aside",["nk-peek"],{role:"dialog",tabindex:"-1"});const t=this.createElement("div",["pk-bar"]);this._close=this.createElement("button",["nk-topbar-btn"],{type:"button"}),this._close.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 17 5-5-5-5M13 17l5-5-5-5"/></svg>',t.append(this._close,this.createElement("slot",[],{name:"actions"}));const e=this.createElement("div",["pk-body"]);e.appendChild(document.createElement("slot")),this._box.append(t,e),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncLabels(),this._syncOpen()}_syncLabels(){const t=this.getAttribute("label");t?this._box.setAttribute("aria-label",t):this._box.removeAttribute("aria-label"),this._close.setAttribute("aria-label",this.getAttribute("close-label")||"Close")}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=$t(),matchMedia("(max-width: 860px)").matches&&(this._modal=!0,this._box.setAttribute("aria-modal","true"),Ot(),this._undoInert=Kt(this)),requestAnimationFrame(()=>this._box.focus({preventScroll:!0}));else{this._modal&&(this._modal=!1,this._box.removeAttribute("aria-modal"),Pt(),this._undoInert?.(),this._undoInert=null);const t=$t(),e=t&&(this.contains(t)||this._shadow.contains(t)||t===document.body),n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&"function"==typeof n.focus&&n.focus({preventScroll:!0})}}setupEvents(){this._onClose=()=>this.close(),this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onOutside=t=>{if(!this.getBoolAttr("open")||this._shownAt>=t.timeStamp)return;const e=t.composedPath();e.includes(this)||e.some(t=>1===t.nodeType&&(be.has(t.localName)||me.some(e=>t.classList.contains(e))))||this.close()},this._close.addEventListener("click",this._onClose),this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey),document.addEventListener("click",this._onOutside)}teardownEvents(){this._close?.removeEventListener("click",this._onClose),this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey),document.removeEventListener("click",this._onOutside),this._modal&&(this._modal=!1,Pt(),this._undoInert?.(),this._undoInert=null),this._wasOpen=!1}onAttributeChanged(t){"open"===t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this._syncLabels()}show(){this._shownAt=performance.now(),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.getBoolAttr("open")?this.close():this.show()}get open(){return this.getBoolAttr("open")}set open(t){t?this.show():this.close()}}customElements.define("nk-peek",ke);class _e extends p{static get observedAttributes(){return["open","pane"]}render(){this._backdrop=this.createElement("div",["nk-modal-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-modal"],{role:"dialog","aria-modal":"true",tabindex:"-1"}),this._nav=this.createElement("nav",["nk-settings-nav"],{"aria-label":"Settings"}),this._nav.appendChild(this.createElement("slot",[],{name:"user"})),this._rows=document.createElement("div"),this._nav.appendChild(this._rows),this._nav.appendChild(this.createElement("slot",[],{name:"nav"})),this._content=this.createElement("div",["nk-settings-content"]),this._slot=document.createElement("slot"),this._content.appendChild(this._slot),this._box.append(this._nav,this._content),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._syncOpen(),this.requestNav()}get panes(){return[...this.querySelectorAll(":scope > nk-settings-pane")]}requestNav(){this._navQueued||(this._navQueued=!0,queueMicrotask(()=>{this._navQueued=!1,this._buildNav()}))}_buildNav(){if(!this._rows)return;const t=this.panes.filter(t=>t.getAttribute("label"));this._rows.replaceChildren(),this._nav.style.display=t.length||this.querySelector(':scope > [slot="nav"], :scope > [slot="user"]')?"":"none";let e=null;for(const n of t){const t=n.getAttribute("group");if(t&&t!==e){const n=this.createElement("div",["nk-section-label"]);n.textContent=t,this._rows.appendChild(n),e=t}const i=this.createElement("div",["nk-tree-item"],{role:"tab",tabindex:"0","data-pane":n.name}),s=this.createElement("span",["icon"]);s.textContent=n.getAttribute("icon")||"";const r=this.createElement("span",["label"]);r.textContent=n.getAttribute("label"),i.append(s,r),this._rows.appendChild(i)}this._syncActive()}_syncActive(){const t=this.panes;let e=this.getAttribute("pane");t.some(t=>t.name===e)||(e=(t.find(t=>t.hasAttribute("active"))||t[0])?.name??null);for(const t of this._rows.querySelectorAll("[data-pane]")){const n=t.dataset.pane===e;t.classList.toggle("active",n),t.setAttribute("aria-selected",n?"true":"false")}for(const n of t)n.active=n.name===e;this._current=e}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=document.activeElement,Ot(),this._undoInert=Kt(this),requestAnimationFrame(()=>{(this._rows.querySelector(".nk-tree-item.active")||Rt(this)||this._box).focus({preventScroll:!0})});else{Pt(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._onNavClick=t=>{const e=t.target.closest("[data-pane]");e&&(e.focus(),this.pane=e.dataset.pane)},this._onNavKey=t=>{const e=t.target.closest?.("[data-pane]");if(!e)return;if("Enter"===t.key||" "===t.key)return t.preventDefault(),void(this.pane=e.dataset.pane);const n={ArrowDown:1,ArrowUp:-1}[t.key];if(!n)return;const i=[...this._rows.querySelectorAll("[data-pane]")],s=i[(i.indexOf(e)+n+i.length)%i.length];t.preventDefault(),s.focus(),this.pane=s.dataset.pane},this._onSlot=()=>this.requestNav(),this._backdrop.addEventListener("click",this._onBackdrop),document.addEventListener("keydown",this._onKey),this._rows.addEventListener("click",this._onNavClick),this._rows.addEventListener("keydown",this._onNavKey),this._slot.addEventListener("slotchange",this._onSlot)}teardownEvents(){this._backdrop?.removeEventListener("click",this._onBackdrop),document.removeEventListener("keydown",this._onKey),this._rows?.removeEventListener("click",this._onNavClick),this._rows?.removeEventListener("keydown",this._onNavKey),this._slot?.removeEventListener("slotchange",this._onSlot),this._wasOpen&&(Pt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t){if("open"===t)this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")});else if("pane"===t){const t=this._current;this._syncActive(),this._current!==t&&this.emit("nk-select",{value:this._current,label:this.panes.find(t=>t.name===this._current)?.getAttribute("label")??this._current})}}show(t){t&&this.setAttribute("pane",t),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get pane(){return this._current??this.getAttribute("pane")}set pane(t){this.setAttribute("pane",t)}}customElements.define("nk-modal",_e);class ve extends p{static get observedAttributes(){return["name","label","icon","group","title","active"]}render(){this._section=this.createElement("section",["nk-settings-pane"],{role:"tabpanel"}),this._h2=document.createElement("h2"),this._section.appendChild(this._h2),this._section.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._section),this.takeTitle(),this._sync()}_sync(){const t=this._titleText;this._h2.textContent=t||"",this._h2.style.display=t?"":"none",this._section.classList.toggle("active",this.getBoolAttr("active")),this._section.setAttribute("aria-label",this.getAttribute("label")||t||this.getAttribute("name")||"")}onAttributeChanged(t,e,n){("title"!==t||this.takeTitle(n))&&(this._sync(),["label","icon","group","name"].includes(t)&&this.closest("nk-modal")?.requestNav?.())}get title(){return this._titleText??""}set title(t){this._titleText=null==t?"":String(t),this._initialized&&this._sync()}get name(){return this.getAttribute("name")??this.getAttribute("label")??""}get active(){return this.getBoolAttr("active")}set active(t){this.setBoolAttr("active",t)}}customElements.define("nk-settings-pane",ve);class xe extends p{static get observedAttributes(){return["name","mail","avatar"]}render(){const t=this.createElement("div",["nk-settings-user"]);this._avatar=this.createElement("div",["avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar);const n=this.createElement("div",["u-text"]);this._name=this.createElement("div",["name"]),this._mail=this.createElement("div",["mail"]),n.append(this._name,this._mail),t.append(e,n),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("name")||"";this._name.textContent=t;const e=this.getAttribute("mail");this._mail.textContent=e||"",this._mail.style.display=e?"":"none",this._avatar.textContent=this.getAttribute("avatar")||t.split(/\s+/).map(t=>t[0]).join("").slice(0,2).toUpperCase()}onAttributeChanged(){this._sync()}}function fe(t,e){const n=t.trim().toLowerCase();if(!n)return 1;const i=e.toLowerCase();let s=0,r=0,o=0;for(let t=0;t<n.length;t++){const e=i.indexOf(n[t],s);if(e<0)return 0;o=e===s?o+1:0,r+=1+2*o+(0===e||/[\s\-_/.]/.test(i[e-1])?3:0)-Math.min(3,.25*(e-s)),s=e+1}return i.startsWith(n)&&(r+=10),Math.max(.01,r/(1+i.length/40))}customElements.define("nk-settings-user",xe);class ye extends p{static get observedAttributes(){return["open","hotkey","placeholder"]}render(){this._backdrop=this.createElement("div",["nk-cmdk-backdrop"]),this._backdrop.inert=!0,this._box=this.createElement("div",["nk-cmdk"],{role:"dialog","aria-modal":"true","aria-label":"Command palette"});const t=this.createElement("div",["nk-cmdk-input-row"]),e=document.createElement("span");e.style.fontSize="15px",e.textContent="๐",this._input=this.createElement("input",[],{type:"text",autocomplete:"off",role:"combobox","aria-expanded":"true","aria-autocomplete":"list"});const n=this.createElement("kbd",["nk-kbd"]);n.textContent="esc",t.append(e,this._input,n),this._list=this.createElement("div",["nk-cmdk-list"],{role:"listbox",id:"list"}),this._input.setAttribute("aria-controls","list"),this._footer=this.createElement("div",["nk-cmdk-footer"]);const i=this.createElement("slot",[],{name:"footer"});i.innerHTML='<span><kbd class="nk-kbd">โ</kbd><kbd class="nk-kbd">โ</kbd> navigate</span><span><kbd class="nk-kbd">โต</kbd> open</span><span><kbd class="nk-kbd">โ</kbd><kbd class="nk-kbd">K</kbd> toggle</span>',this._footer.appendChild(i),this._box.append(t,this._list,this._footer),this._backdrop.appendChild(this._box),this._wrapper.appendChild(this._backdrop),this._commands=[],this._index=0,this._syncAttrs(),this._renderList(),this._syncOpen()}_syncAttrs(){this._input.placeholder=this.getAttribute("placeholder")||"Search or type a command โฆ"}results(){const t=this._input?.value??"",e=[];for(const n of this._commands){const i=(n.items||[]).map(e=>({item:e,group:n.group,score:fe(t,`${e.label} ${e.keywords||""}`)})).filter(t=>t.score>0);i.sort((t,e)=>e.score-t.score),e.push(...i)}return e}_renderList(){if(!this._list)return;const t=this.results();if(this._index=Math.min(this._index,Math.max(0,t.length-1)),this._list.replaceChildren(),!t.length){const t=this.createElement("div",["nk-cmdk-empty"]);return t.textContent=`No results for โ${this._input.value}โ`,this._list.appendChild(t),void this._input.removeAttribute("aria-activedescendant")}let e=null;t.forEach((t,n)=>{if(t.group&&t.group!==e){const n=this.createElement("div",["nk-cmdk-group"]);n.textContent=t.group,this._list.appendChild(n),e=t.group}const i=this.createElement("div",["nk-cmdk-item"],{role:"option",id:`opt-${n}`,"data-index":n});i.classList.toggle("selected",n===this._index),i.setAttribute("aria-selected",n===this._index?"true":"false");const s=this.createElement("span",["m-icon"]);s.textContent=t.item.icon||"";const r=document.createElement("span");if(r.textContent=t.item.label,i.append(s,r),t.item.shortcut){const e=this.createElement("span",["m-shortcut"]);e.textContent=t.item.shortcut,i.appendChild(e)}this._list.appendChild(i)}),this._input.setAttribute("aria-activedescendant",`opt-${this._index}`)}_move(t){const e=this.results().length;if(e){this._index=(this._index+t+e)%e;for(const t of this._list.querySelectorAll(".nk-cmdk-item")){const e=Number(t.dataset.index)===this._index;t.classList.toggle("selected",e),t.setAttribute("aria-selected",e?"true":"false"),e&&t.scrollIntoView({block:"nearest"})}this._input.setAttribute("aria-activedescendant",`opt-${this._index}`)}}pick(t=this._index){const e=this.results()[t];if(!e)return;const n=this._input.value;this.close();this.emit("nk-command",{id:e.item.id??e.item.label,item:e.item,query:n})&&"function"==typeof e.item.action&&e.item.action(e.item)}_matchesHotkey(t){const e=(this.getAttribute("hotkey")||"mod+k").toLowerCase().split("+"),n=e.pop(),i=!e.includes("mod")||(t.metaKey||t.ctrlKey),s=e.includes("shift")?t.shiftKey:!t.shiftKey,r=e.includes("alt")?t.altKey:!t.altKey;return i&&s&&r&&t.key.toLowerCase()===n}_syncOpen(){const t=this.getBoolAttr("open");if(this._backdrop.classList.toggle("open",t),this._backdrop.inert=!t,t!==this._wasOpen)if(this._wasOpen=t,t)this._returnFocus=document.activeElement,this._input.value="",this._index=0,this._renderList(),Ot(),this._undoInert=Kt(this),requestAnimationFrame(()=>this._input.focus({preventScroll:!0}));else{Pt(),this._undoInert?.(),this._undoInert=null;const t=this._returnFocus;t&&"function"==typeof t.focus&&t.isConnected&&t.focus({preventScroll:!0}),this._returnFocus=null}}setupEvents(){this._onDocKey=t=>{if(this._matchesHotkey(t))return t.preventDefault(),void this.toggle();"Escape"===t.key&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._onInput=()=>{this._index=0,this._renderList()},this._onInputKey=t=>{"ArrowDown"===t.key?(t.preventDefault(),this._move(1)):"ArrowUp"===t.key?(t.preventDefault(),this._move(-1)):"Enter"===t.key&&(t.preventDefault(),this.pick())},this._onListClick=t=>{const e=t.target.closest(".nk-cmdk-item");e&&this.pick(Number(e.dataset.index))},this._onListMove=t=>{const e=t.target.closest(".nk-cmdk-item");e&&Number(e.dataset.index)!==this._index&&(this._index=Number(e.dataset.index),this._move(0))},this._onListDown=t=>t.preventDefault(),this._onBackdrop=t=>{t.target===this._backdrop&&this.close()},document.addEventListener("keydown",this._onDocKey),this._input.addEventListener("input",this._onInput),this._input.addEventListener("keydown",this._onInputKey),this._list.addEventListener("click",this._onListClick),this._list.addEventListener("mousemove",this._onListMove),this._list.addEventListener("mousedown",this._onListDown),this._backdrop.addEventListener("click",this._onBackdrop)}teardownEvents(){document.removeEventListener("keydown",this._onDocKey),this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("keydown",this._onInputKey),this._list?.removeEventListener("click",this._onListClick),this._list?.removeEventListener("mousemove",this._onListMove),this._list?.removeEventListener("mousedown",this._onListDown),this._backdrop?.removeEventListener("click",this._onBackdrop),this._wasOpen&&(Pt(),this._undoInert?.(),this._undoInert=null,this._wasOpen=!1)}onAttributeChanged(t){"open"===t?(this._syncOpen(),this.emit("nk-toggle",{open:this.getBoolAttr("open")})):this._syncAttrs()}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get commands(){return this._commands}set commands(t){this._commands=Array.isArray(t)?t:[],this._index=0,this._renderList()}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get query(){return this._input?.value??""}set query(t){this._input&&(this._input.value=t,this._index=0,this._renderList())}}customElements.define("nk-cmdk",ye);const we=new CSSStyleSheet;we.replaceSync(":host([floating]) { display: block; position: fixed; z-index: 60; pointer-events: none; }");class Ae extends p{static get hostStyles(){return we}static get observedAttributes(){return["floating","sheet","open","align"]}render(){this._box=this.createElement("div",["nk-pop","nk-menu"],{role:"menu"}),this._box.appendChild(document.createElement("slot")),this._wrapper.appendChild(this._box),this._syncMode()}_syncMode(){this._box.classList.toggle("floating",this.getBoolAttr("floating")),this._box.classList.toggle("sheet",this.getBoolAttr("sheet")),this._box.classList.toggle("open",this.getBoolAttr("open"))}onAttributeChanged(t){if(this._syncMode(),"open"!==t)return;const e=this.getBoolAttr("open");if(this._anchor&&(this._anchor.shadowRoot?.querySelector("button, a[href]")??this._anchor).setAttribute("aria-expanded",String(e)),e)this._returnFocus=$t(),this._returnFocus?.matches(":focus-visible")&&requestAnimationFrame(()=>this.focusFirst()),document.addEventListener("click",this._onOutside,!0);else{document.removeEventListener("click",this._onOutside,!0);const t=this._returnFocus;this._returnFocus=null,t?.isConnected&&this.contains(document.activeElement)&&t.focus({preventScroll:!0})}this.emit("nk-toggle",{open:e})}show(t){t&&(this._anchor=t,de(this,t,this.getAttribute("align"))),this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(t){this.getBoolAttr("open")?this.close():this.show(t)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get items(){return[...this.querySelectorAll(":scope > nk-menu-item")].filter(t=>t.selectable)}setupEvents(){this._onKey=t=>{const e={ArrowDown:1,ArrowUp:-1}[t.key],n=t.target.closest?.("nk-menu-item"),i=this.items;if(i.length)if(e){t.preventDefault();const s=i.indexOf(n);i[(s+e+i.length)%i.length].focus()}else"Enter"!==t.key&&" "!==t.key||!n||(t.preventDefault(),n.select())},this.addEventListener("keydown",this._onKey),this._onOutside=t=>{const e=t.composedPath();e.includes(this)||this._anchor&&e.includes(this._anchor)||(t.preventDefault(),t.stopPropagation(),this.close())},this._onEscape=t=>{"Escape"===t.key&&this.getBoolAttr("floating")&&this.getBoolAttr("open")&&(t.stopPropagation(),this.close())},this._onSelect=()=>{this.getBoolAttr("floating")&&this.close()},document.addEventListener("keydown",this._onEscape,!0),this.addEventListener("nk-select",this._onSelect),this.getBoolAttr("open")&&document.addEventListener("click",this._onOutside,!0)}teardownEvents(){this.removeEventListener("keydown",this._onKey),document.removeEventListener("keydown",this._onEscape,!0),this.removeEventListener("nk-select",this._onSelect),document.removeEventListener("click",this._onOutside,!0)}focusFirst(){this.items[0]?.focus()}}customElements.define("nk-menu",Ae);class Ee extends p{static get observedAttributes(){return["icon","shortcut","danger","value","type","disabled","checked"]}render(){this._build()}_build(){const t=this.getAttribute("type");let e;if("separator"===t)e=this.createElement("div",["nk-menu-sep"],{role:"separator"});else if("label"===t)e=this.createElement("div",["nk-menu-label"]),e.appendChild(document.createElement("slot"));else{const n="switch"===t;this._check="check"===t,e=this.createElement("div",["nk-menu-item"],{role:n||this._check?"menuitemcheckbox":"menuitem",tabindex:"-1"}),this._icon=this.createElement("span",["m-icon"]);const i=this.createElement("slot",[],{name:"icon"});i.appendChild(this._icon),this._shortcut=this.createElement("span",["m-shortcut"]),e.append(i,document.createElement("slot"),this._shortcut),this._switch=n?this.createElement("span",["nk-switch"],{"aria-hidden":"true"}):null,this._switch&&e.appendChild(this._switch)}this._el?(this._el.removeEventListener("click",this._onClick),this._el.replaceWith(e)):this._wrapper.appendChild(e),this._el=e,this._onClick&&e.addEventListener("click",this._onClick),this._sync()}_sync(){if(!this._el.classList.contains("nk-menu-item"))return;const t=this.getAttribute("icon");this._icon.textContent=t||"",this._icon.style.display=t?"":"none";const e=this.getAttribute("shortcut");if(this._shortcut.textContent=e||"",this._shortcut.style.display=e?"":"none",this._el.classList.toggle("danger",this.getBoolAttr("danger")),this._el.setAttribute("aria-disabled",this.getBoolAttr("disabled")?"true":"false"),this._switch||this._check){const t=this.getBoolAttr("checked")?"true":"false";this._el.setAttribute("aria-checked",t),this._switch&&this._switch.setAttribute("aria-checked",t),this._check&&(this._shortcut.textContent="true"===t?"โ":"",this._shortcut.style.display="")}}setupEvents(){this._onClick=()=>this.select(),this._el.addEventListener("click",this._onClick)}teardownEvents(){this._el?.removeEventListener("click",this._onClick)}select(){if(this._el.classList.contains("nk-menu-item")&&!this.getBoolAttr("disabled"))return this._switch||this._check?(this.checked=!this.checked,void this.emit("nk-change",{value:this.value,checked:this.checked,item:this})):void this.emit("nk-select",{value:this.value,label:this.textContent.trim(),item:this})}onAttributeChanged(t){"type"===t?this._build():this._sync()}focus(t){this._el?.focus(t)}get selectable(){return this._el?.classList.contains("nk-menu-item")&&!this.getBoolAttr("disabled")}get checked(){return this.getBoolAttr("checked")}set checked(t){this.setBoolAttr("checked",t)}get value(){return this.getAttribute("value")??this.textContent.trim()}set value(t){this.setAttribute("value",t)}}customElements.define("nk-menu-item",Ee);const Ce=new CSSStyleSheet;Ce.replaceSync('\n .nk-pop-anchor { position: relative; display: inline-block; }\n .nk-pop-float { display: none; position: absolute; z-index: 50; top: 100%; left: 0; margin-top: 4px; }\n :host([open]) .nk-pop-float { display: block; }\n :host([placement="bottom-end"]) .nk-pop-float { left: auto; right: 0; }\n :host([placement="top-start"]) .nk-pop-float { top: auto; bottom: 100%; margin: 0 0 4px; }\n :host([placement="top-end"]) .nk-pop-float { top: auto; bottom: 100%; left: auto; right: 0; margin: 0 0 4px; }\n');const Be=new Set(["nk-menu","nk-emoji-picker"]);class Le extends p{static get hostStyles(){return Ce}static get observedAttributes(){return["open","placement","bare"]}render(){const t=this.createElement("div",["nk-pop-anchor"]);this._triggerSlot=this.createElement("slot",[],{name:"trigger"}),this._float=this.createElement("div",["nk-pop-float"]),this._surface=this.createElement("div",["nk-pop"]),this._slot=document.createElement("slot"),this._surface.appendChild(this._slot),this._float.appendChild(this._surface),t.append(this._triggerSlot,this._float),this._wrapper.appendChild(t),this._syncSurface()}_syncSurface(){const t=this.getBoolAttr("bare")||this._slot.assignedElements().some(t=>Be.has(t.localName));this._surface.className=t?"":"nk-pop"}setupEvents(){this._onTrigger=t=>{t.composedPath().some(t=>t instanceof Element&&"trigger"===t.getAttribute?.("slot"))&&(t.stopPropagation(),this.toggle())},this._onDocClick=t=>{this.getBoolAttr("open")&&!t.composedPath().includes(this)&&this.close()},this._onKey=t=>{"Escape"===t.key&&this.getBoolAttr("open")&&this.close()},this._onSelect=t=>{t.target!==this&&this.close()},this._onSlot=()=>this._syncSurface(),this.addEventListener("click",this._onTrigger),document.addEventListener("click",this._onDocClick),document.addEventListener("keydown",this._onKey),this._float.addEventListener("nk-select",this._onSelect),this._slot.addEventListener("slotchange",this._onSlot)}teardownEvents(){this.removeEventListener("click",this._onTrigger),document.removeEventListener("click",this._onDocClick),document.removeEventListener("keydown",this._onKey),this._float?.removeEventListener("nk-select",this._onSelect),this._slot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){if("bare"===t&&this._syncSurface(),"open"===t){const t=this.getBoolAttr("open");for(const e of this._triggerSlot.assignedElements())e.setAttribute("aria-expanded",t?"true":"false");this.emit("nk-toggle",{open:t})}}show(){this.setBoolAttr("open",!0)}close(){this.setBoolAttr("open",!1)}toggle(){this.setBoolAttr("open",!this.getBoolAttr("open"))}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get placement(){return this.getAttribute("placement")||"bottom-start"}set placement(t){this.setAttribute("placement",t)}}customElements.define("nk-pop",Le);const Se=(t,e,n)=>n.map(([n,i])=>({char:n,name:i,cat:t,icon:e})),ze=[{id:"smileys",icon:"๐"},{id:"people",icon:"๐"},{id:"nature",icon:"๐ฟ"},{id:"food",icon:"โ"},{id:"activity",icon:"๐ฏ"},{id:"travel",icon:"๐"},{id:"objects",icon:"๐ก"},{id:"symbols",icon:"โ
"}],Ne=[...Se("smileys","๐",[["๐","grinning"],["๐","smile blush"],["๐","joy laugh"],["๐","slight smile"],["๐","wink"],["๐","heart eyes love"],["๐ค","thinking"],["๐","cool sunglasses"],["๐ฅณ","party"],["๐ด","sleep"],["๐คฏ","mind blown"],["๐
","sweat smile"],["๐","upside down"],["๐","angel halo"],["๐ค","hug"],["๐ข","cry sad"]]),...Se("people","๐",[["๐","wave hello"],["๐","thumbs up"],["๐","thumbs down"],["๐","pray thanks"],["๐","clap"],["๐ค","handshake deal"],["๐ช","strong"],["๐","eyes look"],["๐ง ","brain knowledge"],["โค๏ธ","heart love"],["๐ค","person user"],["๐ฅ","people team members"],["๐งโ๐ป","developer"],["๐","raise hand"],["โ๏ธ","writing"],["๐ซถ","heart hands"]]),...Se("nature","๐ฟ",[["๐ฟ","leaf herb"],["๐ฑ","seedling"],["๐ณ","tree"],["๐ธ","blossom flower"],["๐","sun"],["๐","moon night"],["โญ","star"],["๐ฅ","fire hot"],["๐","rainbow"],["๐","wave water"],["๐","clover luck"],["๐","bee"],["๐ฆ","butterfly"],["๐ข","turtle"],["๐","earth globe"],["โ๏ธ","snow"]]),...Se("food","โ",[["โ","coffee"],["๐ต","tea"],["๐","apple"],["๐","pizza"],["๐ฐ","cake"],["๐ช","cookie"],["๐ฅ","croissant"],["๐","burger"],["๐","noodles"],["๐บ","beer"],["๐ท","wine"],["๐ฅ","salad"],["๐ซ","chocolate"],["๐","strawberry"],["๐ฅ","avocado"],["๐ฉ","donut"]]),...Se("activity","๐ฏ",[["๐ฏ","target goal"],["๐","trophy win"],["๐","tada celebration"],["๐จ","art palette design"],["๐๏ธ","microphone podcast voice"],["๐ฌ","clapper movie"],["๐ฎ","game"],["โฝ","football"],["๐","run"],["๐ง","yoga calm"],["๐ต","music"],["๐ฒ","dice"],["๐","finish flag"],["๐","graduation learn"],["๐งฉ","puzzle piece"],["๐","repeat retro"]]),...Se("travel","๐",[["๐","rocket launch"],["โ๏ธ","plane travel"],["๐","car"],["๐ฒ","bike"],["๐ ","house home"],["๐ข","office building"],["๐บ๏ธ","map"],["๐งญ","compass"],["โฐ๏ธ","mountain"],["๐๏ธ","beach"],["๐","station"],["๐ฐ๏ธ","satellite"],["๐","city"],["๐๏ธ","camping"],["โต","sailboat"],["๐ซ","departure"]]),...Se("objects","๐ก",[["๐ก","idea bulb"],["๐","chart bar"],["๐","chart up"],["๐
","calendar date"],["๐","page document"],["๐","folder"],["๐๏ธ","card box database"],["๐","pin"],["๐","search"],["๐ ๏ธ","tools"],["โ๏ธ","gear settings"],["๐","bell notification"],["๐","gem diamond"],["๐","memo notes"],["๐","paperclip files"],["๐","lock secure"],["๐ฌ","speech comment"],["๐ค","export outbox"],["๐ฅ","inbox"],["๐๏ธ","trash bin"],["๐ฅ๏ธ","desktop"],["๐ฑ","phone"],["๐ป","laptop"],["๐งพ","receipt"]]),...Se("symbols","โ
",[["โ
","check done"],["โจ","sparkles ai magic"],["โ","cross no"],["โ ๏ธ","warning"],["โน๏ธ","info"],["โ","question"],["โ","plus add"],["โก๏ธ","arrow right"],["๐ด","red circle"],["๐ข","green circle"],["๐ก","yellow circle"],["๐ต","blue circle"],["โณ","hourglass wait"],["โป๏ธ","recycle"],["๐","new"],["๐ฏ","hundred"]])];class Te extends p{static get observedAttributes(){return["placeholder","value"]}render(){this._box=this.createElement("div",["nk-pop"]),this._search=this.createElement("input",["nk-emoji-search"],{type:"search",autocomplete:"off","aria-label":"Search emoji"}),this._grid=this.createElement("div",["nk-emoji-grid"],{role:"listbox"}),this._cats=this.createElement("div",["nk-emoji-cats"],{role:"tablist"}),this._box.append(this._search,this._grid,this._cats),this._wrapper.appendChild(this._box),this._emojis=Ne,this._cat=ze[0].id,this._renderCats(),this._renderGrid(),this._syncAttrs()}_syncAttrs(){this._search.placeholder=this.getAttribute("placeholder")||"Searchโฆ"}_renderCats(){this._cats.replaceChildren();const t=this._categories();for(const e of t){const t=this.createElement("span",[],{role:"tab","data-cat":e.id,title:e.id});t.textContent=e.icon,t.classList.toggle("active",e.id===this._cat),this._cats.appendChild(t)}this._cats.style.display=t.length>1?"":"none"}_categories(){if(this._catList)return this._catList;const t=new Map;for(const e of this._emojis)e.cat&&!t.has(e.cat)&&t.set(e.cat,{id:e.cat,icon:e.icon||ze.find(t=>t.id===e.cat)?.icon||e.char});return[...t.values()]}_renderGrid(){const t=this._search.value.trim().toLowerCase(),e=t?this._emojis.filter(e=>(e.name||"").toLowerCase().includes(t)||e.char===t):this._emojis.filter(t=>!t.cat||t.cat===this._cat);this._grid.replaceChildren();for(const t of e.slice(0,64)){const e=this.createElement("span",[],{role:"option",title:t.name||"","data-emoji":t.char});e.textContent=t.char,this._grid.appendChild(e)}for(const e of this._cats.children)e.classList.toggle("active",!t&&e.dataset.cat===this._cat)}setupEvents(){this._onInput=()=>this._renderGrid(),this._onGrid=t=>{const e=t.target.closest("[data-emoji]");e&&this.select(e.dataset.emoji)},this._onCats=t=>{const e=t.target.closest("[data-cat]");e&&(this._cat=e.dataset.cat,this._search.value="",this._renderGrid())},this._onKey=t=>{if("Enter"===t.key){const t=this._grid.querySelector("[data-emoji]");t&&this.select(t.dataset.emoji)}},this._search.addEventListener("input",this._onInput),this._search.addEventListener("keydown",this._onKey),this._grid.addEventListener("click",this._onGrid),this._cats.addEventListener("click",this._onCats)}teardownEvents(){this._search?.removeEventListener("input",this._onInput),this._search?.removeEventListener("keydown",this._onKey),this._grid?.removeEventListener("click",this._onGrid),this._cats?.removeEventListener("click",this._onCats)}select(t){this.setAttribute("value",t),this.emit("nk-select",{emoji:t,value:t})}onAttributeChanged(){this._syncAttrs()}focus(t){this._search?.focus(t)}get categories(){return this._categories()}set categories(t){this._catList=Array.isArray(t)&&t.length?t:null,this._cat=this._categories()[0]?.id,this._renderCats(),this._renderGrid()}get emojis(){return this._emojis}set emojis(t){this._emojis=Array.isArray(t)?t:Ne,this._cat=this._categories()[0]?.id,this._renderCats(),this._renderGrid()}get value(){return this.getAttribute("value")}set value(t){this.setAttribute("value",t)}}customElements.define("nk-emoji-picker",Te);class De extends p{static get observedAttributes(){return["open","duration","icon"]}render(){this._box=this.createElement("div",["nk-toast"],{role:"status","aria-live":"polite"}),this._icon=document.createElement("span"),this._msg=document.createElement("span"),this._box.append(this._icon,this._msg,document.createElement("slot")),this._wrapper.appendChild(this._box),this._sync()}_sync(){this.getBoolAttr("open")&&this._lift(),this._box.classList.toggle("show",this.getBoolAttr("open"));const t=this.getAttribute("icon")??"โ";this._icon.textContent=t,this._icon.style.display=t?"":"none"}_lift(){const t=[...document.querySelectorAll(".nk-tab-bar")];for(const e of document.querySelectorAll("nk-tab-bar")){const n=e.shadowRoot?.querySelector(".nk-tab-bar");n&&t.push(n)}const e=t.map(t=>t.getBoundingClientRect()).find(t=>t.height>0&&t.top<innerHeight&&t.bottom>innerHeight-60);this._box.style.bottom=e?`${Math.round(innerHeight-e.top+12)}px`:""}show(t,{duration:e}={}){void 0!==t&&(this._msg.textContent=t),clearTimeout(this._timer),this.setBoolAttr("open",!0);const n=e??Number(this.getAttribute("duration"))??2200;n>0&&(this._timer=setTimeout(()=>this.close(),n||2200))}close(){clearTimeout(this._timer),this.setBoolAttr("open",!1)}onAttributeChanged(t){this._sync(),"open"===t&&this.emit("nk-toggle",{open:this.getBoolAttr("open")})}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._timer)}get open(){return this.getBoolAttr("open")}set open(t){this.setBoolAttr("open",t)}get message(){return this._msg?.textContent??""}set message(t){this._msg&&(this._msg.textContent=t)}}customElements.define("nk-toast",De);class Me extends p{static get observedAttributes(){return["view","add-view"]}render(){this._box=this.createElement("div",["nk-database"]),this._toolbar=this.createElement("div",["nk-db-toolbar"]),this._tabs=this.createElement("div",["nk-db-tabs"],{role:"tablist"});const t=this.createElement("div",["tools"]);this._toolsSlot=this.createElement("slot",[],{name:"tools"}),t.appendChild(this._toolsSlot),this._toolbar.append(this._tabs,t),this._slot=document.createElement("slot"),this._box.append(this._toolbar,this.createElement("slot",[],{name:"filters"}),this._slot),this._wrapper.appendChild(this._box),this._columns=[],this._rows=[],this._sync()}get views(){return this._slot?.assignedElements().filter(t=>/^nk-[a-z]+-view$/.test(t.localName))??[]}_sync(){if(!this._tabs)return;const t=this.views;let e=this.getAttribute("view");t.some(t=>t.name===e)||(e=t[0]?.name??null),this._tabs.replaceChildren();for(const n of t){const t=this.createElement("span",["nk-db-tab"],{role:"tab","data-view":n.name,tabindex:"0"});t.classList.toggle("active",n.name===e),t.setAttribute("aria-selected",n.name===e?"true":"false"),t.append(document.createTextNode(n.getAttribute("label")||n.name));const i=n.hasAttribute("count")?String(this._rows.length):n.getAttribute("badge");if(i){const e=this.createElement("span",["badge"]);e.textContent=i,t.appendChild(e)}this._tabs.appendChild(t),n.hidden=n.name!==e,n.setData?.(this._columns,this._rows)}if(this.getBoolAttr("add-view")){const t=this.createElement("span",["nk-db-tab","add"],{role:"button","data-add":"",tabindex:"0"});t.textContent="๏ผ",this._tabs.appendChild(t)}this._toolbar.hidden=!t.length&&!this._toolsSlot.assignedElements().length,this._current=e}requestSync(){this._syncQueued||(this._syncQueued=!0,queueMicrotask(()=>{this._syncQueued=!1,this._sync()}))}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-view]");e?this.view=e.dataset.view:t.target.closest("[data-add]")&&this.emit("nk-action",{action:"add-view"})},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||!t.target.closest("[data-view],[data-add]")||(t.preventDefault(),t.target.click())},this._onSlot=()=>this._sync(),this._tabs.addEventListener("click",this._onClick),this._tabs.addEventListener("keydown",this._onKey),this._slot.addEventListener("slotchange",this._onSlot),this._toolsSlot.addEventListener("slotchange",this._onSlot),this._sync()}teardownEvents(){this._tabs?.removeEventListener("click",this._onClick),this._tabs?.removeEventListener("keydown",this._onKey),this._slot?.removeEventListener("slotchange",this._onSlot),this._toolsSlot?.removeEventListener("slotchange",this._onSlot)}onAttributeChanged(t){const e=this._current;this._sync(),"view"===t&&this._current!==e&&this.emit("nk-view-change",{view:this._current})}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._sync()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._sync()}get view(){return this._current??this.getAttribute("view")}set view(t){this.setAttribute("view",t)}refresh(){this._sync()}}customElements.define("nk-database",Me);const Fe=(t,e,n)=>{const i=document.createElement(t);return e&&(i.className=e),null!=n&&(i.textContent=n),i},Ve=["gray","brown","orange","yellow","green","blue","purple","pink","red"];function Ie(t,e){const n=function(t,e){const n=t.options||[];return n.find(t=>t.value===e)||n.find(t=>t.label===e)||null}(t,e),i=n?.color&&Ve.includes(n.color)?n.color:"gray";return Fe("span",`nk-tag ${i}`,n?.label??String(e))}function qe(t,e,n={}){const i=t.type||"text";if(null==e||""===e)return"checkbox"===i?je(t,!1,n):"progress"===i?Oe(0):Fe("span","person"===i?"person-cell":null,"text"===i&&t.title?"":"โ");switch(i){case"select":return Ie(t,e);case"multi-select":{const n=Fe("span");n.style.display="inline-flex",n.style.gap="4px",n.style.flexWrap="wrap";for(const i of Array.isArray(e)?e:String(e).split(",").map(t=>t.trim()).filter(Boolean))n.appendChild(Ie(t,i));return n}case"date":return Fe("span","date-cell",String(e));case"person":{const t=Fe("span","person-cell"),n="string"==typeof e?{name:e}:e,i=Fe("span","nk-avatar small",n.initials||n.avatar||At(n.name));return wt(i,n.color),t.append(i,document.createTextNode(" "+(n.name||""))),t}case"checkbox":return je(t,!!e,n);case"url":{const t=Fe("a",null,String(e).replace(/^https?:\/\//,""));return t.href=String(e),t.target="_blank",t.rel="noopener",t}case"number":return Fe("span",null,"number"==typeof e?e.toLocaleString(t.locale,t.format):String(e));case"progress":return Oe(Number(e)||0);default:if(t.title){const t=Fe("span","row-title");return n.icon&&t.append(document.createTextNode(n.icon+" ")),t.append(document.createTextNode(String(e))),t}return Fe("span",null,String(e))}}function je(t,e,n){const i=Fe("label","nk-check"),s=Fe("input");return s.type="checkbox",s.checked=e,s.dataset.key=t.key,null!=n.id&&(s.dataset.rowId=n.id),i.appendChild(s),i}function Oe(t){const e=document.createDocumentFragment(),n=Fe("span","nk-progress"),i=Fe("i");return i.style.width=`${Math.max(0,Math.min(100,t))}%`,n.appendChild(i),e.append(n,Fe("span","nk-progress-label",`${Math.round(t)}%`)),e}function Pe(t,e=1){const n=t.type||"text";return(i,s)=>{let r=i[t.key],o=s[t.key];return"person"===n&&(r=r?.name??r??"",o=o?.name??o??""),"number"===n||"progress"===n||"checkbox"===n?((Number(r)||0)-(Number(o)||0))*e:String(r??"").localeCompare(String(o??""),void 0,{numeric:!0})*e}}class Ke extends p{static get observedAttributes(){return["name","label","badge","count","new-row","new-row-label","sortable","sort-key","sort-dir","wrap"]}render(){this._wrap=this.createElement("div",["nk-table-wrap"]),this._table=this.createElement("table",["nk-table"]),this._thead=document.createElement("thead"),this._tbody=document.createElement("tbody"),this._table.append(this._thead,this._tbody),this._newRow=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0"}),this._wrap.append(this._table,this._newRow),this._wrapper.appendChild(this._wrap),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_sortedRows(){const t=this.getAttribute("sort-key"),e=this._columns.find(e=>e.key===t);return e?[...this._rows].sort(Pe(e,"desc"===this.getAttribute("sort-dir")?-1:1)):this._rows}_render(){if(!this._thead)return;this._table.classList.toggle("wrap",this.getBoolAttr("wrap"));const t=document.createElement("tr");for(const e of this._columns){const n=this.createElement("th",[],{"data-key":e.key,scope:"col"});if(e.icon){const t=this.createElement("span",["th-icon"]);t.textContent=e.icon,n.appendChild(t)}n.appendChild(document.createTextNode(e.label??e.key)),e.key===this.getAttribute("sort-key")&&n.appendChild(document.createTextNode("desc"===this.getAttribute("sort-dir")?" โ":" โ")),e.width&&(n.style.width=e.width),t.appendChild(n)}this._thead.replaceChildren(t),this._tbody.replaceChildren();for(const t of this._sortedRows()){const e=this.createElement("tr",[],{"data-id":t.id??""});for(const n of this._columns){const i=document.createElement("td");"number"===n.type&&(i.className="num"),i.appendChild(qe(n,t[n.key],t)),e.appendChild(i)}this._tbody.appendChild(e)}this._newRow.textContent=this.getAttribute("new-row-label")||"๏ผ New page",this._newRow.style.display=this.getBoolAttr("new-row")?"":"none"}setupEvents(){this._onClick=t=>{if(this._newRow.contains(t.target))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest("th[data-key]");if(e){const t=e.dataset.key,n=this.getAttribute("sort-key")===t&&"desc"!==this.getAttribute("sort-dir")?"desc":"asc";return void(this.emit("nk-action",{action:"sort",key:t,value:n})&&this.getBoolAttr("sortable")&&(this.setAttribute("sort-key",t),this.setAttribute("sort-dir",n)))}if(t.target.closest("input[type=checkbox], a"))return;const n=t.target.closest("tr[data-id]");if(!n)return;const i=t.target.closest("td"),s=this._rowById(n.dataset.id);this.emit("nk-select",{row:s,id:s?.id,value:s?.id,key:i?this._columns[i.cellIndex]?.key:void 0,cell:i})},this._onChange=t=>{const e=t.target;if("checkbox"!==e.type)return;const n=this._rowById(e.dataset.rowId);n&&(n[e.dataset.key]=e.checked),this.emit("nk-change",{row:n,key:e.dataset.key,value:e.checked})},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||t.target!==this._newRow||(t.preventDefault(),this.emit("nk-action",{action:"new-row"}))},this._wrap.addEventListener("click",this._onClick),this._wrap.addEventListener("change",this._onChange),this._wrap.addEventListener("keydown",this._onKey)}teardownEvents(){this._wrap?.removeEventListener("click",this._onClick),this._wrap?.removeEventListener("change",this._onChange),this._wrap?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}get name(){return this.getAttribute("name")||"table"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-table-view",Ke);class $e extends p{static get observedAttributes(){return["name","label","badge","count","group-by","title-key","meta-keys","new-row"]}render(){this._board=this.createElement("div",["nk-board","active"]),this._wrapper.appendChild(this._board),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_groupColumn(){const t=this.getAttribute("group-by");return this._columns.find(e=>e.key===t)||this._columns.find(t=>"select"===t.type)||null}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"date"===t.type||"progress"===t.type)}_render(){if(!this._board)return;this._board.replaceChildren();const t=this._groupColumn(),e=this._titleColumn();if(!t)return;const n=t.options?.length?t.options:[...new Set(this._rows.map(e=>e[t.key]))].map(t=>({value:t,label:String(t)}));for(const i of n){const n=this.createElement("div",["nk-board-col"],{"data-value":i.value}),s=this.createElement("div",["nk-board-col-header"]),r=this._rows.filter(e=>e[t.key]===i.value||e[t.key]===i.label),o=this.createElement("span",["count"]);o.textContent=String(r.length),s.append(Ie(t,i.value),o),n.appendChild(s);for(const t of r){const i=this.createElement("div",["nk-card"],{draggable:"true","data-id":t.id??"",tabindex:"0"}),s=this.createElement("div",["card-title"]);s.textContent=`${t.icon?t.icon+" ":""}${e?t[e.key]??"":""}`;const r=this.createElement("div",["card-meta"]);for(const e of this._metaColumns()){const n=t[e.key];if(null==n||""===n)continue;const i=document.createElement("span");"progress"===e.type?i.textContent=`โฐ ${n}%`:"date"===e.type?i.textContent=`๐
${n}`:i.appendChild(qe(e,n,t)),r.appendChild(i)}i.append(s,r),n.appendChild(i)}if(this.getBoolAttr("new-row")){const t=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0","data-add":i.value});t.style.padding="6px 10px",t.textContent="๏ผ",n.appendChild(t)}this._board.appendChild(n)}}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-add]");if(e)return void this.emit("nk-action",{action:"new-row",value:e.dataset.add});const n=t.target.closest(".nk-card");if(n){const t=this._rowById(n.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._onDragStart=t=>{const e=t.target.closest?.(".nk-card");if(e){this._dragId=e.dataset.id,t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",e.dataset.id)}catch{}}},this._onDragOver=t=>{null!=this._dragId&&t.target.closest(".nk-board-col")&&(t.preventDefault(),t.dataTransfer.dropEffect="move")},this._onDrop=t=>{const e=t.target.closest(".nk-board-col");e&&null!=this._dragId&&(t.preventDefault(),this.move(this._dragId,e.dataset.value),this._dragId=null)},this._board.addEventListener("click",this._onClick),this._board.addEventListener("dragstart",this._onDragStart),this._board.addEventListener("dragover",this._onDragOver),this._board.addEventListener("drop",this._onDrop)}teardownEvents(){this._board?.removeEventListener("click",this._onClick),this._board?.removeEventListener("dragstart",this._onDragStart),this._board?.removeEventListener("dragover",this._onDragOver),this._board?.removeEventListener("drop",this._onDrop)}move(t,e){const n=this._rowById(t),i=this._groupColumn();n&&i&&n[i.key]!==e&&(n[i.key]=e,this._render(),this.emit("nk-change",{row:n,key:i.key,value:e}))}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}get name(){return this.getAttribute("name")||"board"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-board-view",$e);class Re extends p{static get observedAttributes(){return["name","label","badge","count","title-key","meta-keys","new-row","new-row-label"]}render(){this._box=document.createElement("div"),this._list=this.createElement("div",["nk-list"],{role:"list"}),this._newRow=this.createElement("div",["nk-new-row"],{role:"button",tabindex:"0"}),this._box.append(this._list,this._newRow),this._wrapper.appendChild(this._box),this._columns??=[],this._rows??=[],this._render(),this.closest("nk-database")?.requestSync?.()}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_metaColumns(){const t=(this.getAttribute("meta-keys")||"").split(",").map(t=>t.trim()).filter(Boolean);return t.length?t.map(t=>this._columns.find(e=>e.key===t)).filter(Boolean):this._columns.filter(t=>"select"===t.type||"date"===t.type)}_render(){if(!this._list)return;const t=this._titleColumn(),e=this._metaColumns();this._list.replaceChildren();for(const n of this._rows){const i=this.createElement("div",["nk-list-item"],{role:"listitem",tabindex:"0","data-id":n.id??""}),s=this.createElement("span",["l-icon"]);s.textContent=n.icon||"",n.icon||(s.style.display="none");const r=this.createElement("span",["l-title"]);r.textContent=t?String(n[t.key]??""):"";const o=this.createElement("span",["l-meta"]);for(const t of e){const e=n[t.key];null!=e&&""!==e&&o.appendChild("date"!==t.type&&"text"!==t.type&&t.type?qe(t,e,n):document.createTextNode(String(e)))}i.append(s,r,o),this._list.appendChild(i)}this._newRow.textContent=this.getAttribute("new-row-label")||"๏ผ New page",this._newRow.style.display=this.getBoolAttr("new-row")?"":"none"}setupEvents(){this._onClick=t=>{if(this._newRow.contains(t.target))return void this.emit("nk-action",{action:"new-row"});const e=t.target.closest(".nk-list-item");if(e){const t=this._rowById(e.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._onKey=t=>{"Enter"!==t.key&&" "!==t.key||(t.target===this._newRow||t.target.classList?.contains("nk-list-item"))&&(t.preventDefault(),t.target.click())},this._box.addEventListener("click",this._onClick),this._box.addEventListener("keydown",this._onKey)}teardownEvents(){this._box?.removeEventListener("click",this._onClick),this._box?.removeEventListener("keydown",this._onKey)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(){this._render()}get name(){return this.getAttribute("name")||"list"}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-list-view",Re);class Ue extends p{static get observedAttributes(){return["name","label","badge","count","date-key","title-key","month","weeks","week-start","weekend","today","locale","today-label","prev-label","next-label","week-label"]}render(){this._box=this.createElement("div",["nk-calendar-view"]);const t=this.createElement("div",["cv-head"]);this._title=this.createElement("div",["cv-title"]),this._todayBtn=this.createElement("button",["cal-nav"],{type:"button"}),this._prev=this.createElement("button",["cal-nav"],{type:"button"}),this._prev.innerHTML=le,this._next=this.createElement("button",["cal-nav"],{type:"button"}),this._next.innerHTML=he,t.append(this._title,this._todayBtn,this._prev,this._next),this._grid=this.createElement("div",["cv-grid"]),this._box.append(t,this._grid),this._wrapper.appendChild(this._box),this._columns??=[],this._rows??=[],this._month??=this._attrMonth()??this._todayIso().slice(0,7),this._render(),this.closest("nk-database")?.requestSync?.()}_attrMonth(){const t=this.getAttribute("month");return/^\d{4}-\d{2}$/.test(t||"")?t:null}_todayIso(){return this.getAttribute("today")||Jt(new Date)}_dateColumn(){const t=this.getAttribute("date-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>"date"===t.type)||null}_titleColumn(){const t=this.getAttribute("title-key");return this._columns.find(e=>e.key===t)||this._columns.find(t=>t.title)||this._columns[0]||null}_render(){if(!this._grid)return;const t=ne(this.getAttribute("locale")),e=this.getBoolAttr("weeks"),n=Number(this.getAttribute("week-start")),i=this.hasAttribute("week-start")&&Number.isInteger(n)&&n>=0&&n<=6?n:ie(t),s=re(this._month,i),r=this._todayIso(),o=new Set((this.getAttribute("weekend")||"").split(",").map(t=>t.trim()).filter(Boolean).map(Number)),a=this._dateColumn(),l=this._titleColumn(),h={};if(a)for(const t of this._rows){const e=te(t[a.key]);e&&(h[Jt(e)]||=[]).push(t)}this._box.classList.toggle("weeks",e),this._title.textContent=new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(s.first),this._todayBtn.textContent=this.getAttribute("today-label")||"Today",this._prev.setAttribute("aria-label",this.getAttribute("prev-label")||"Previous month"),this._next.setAttribute("aria-label",this.getAttribute("next-label")||"Next month");const c=(t,e)=>{const n=this.createElement("div",[t]);return n.textContent=e,n},d=[];e&&d.push(c("cv-wd",this.getAttribute("week-label")||ae(t)));for(const e of se(t,i))d.push(c("cv-wd",e));for(let t=0;t<7*s.rows;t++){const n=s.day(t),i=Jt(n);e&&t%7==0&&d.push(c("cv-week",ee(n)));const a=this.createElement("div",["cv-day",n.getMonth()!==s.m-1&&"out",o.has(n.getDay())&&"off",i===r&&"today"].filter(Boolean)),p=this.createElement("span",["cv-num"]);p.textContent=n.getDate(),a.appendChild(p);for(const t of h[i]||[]){const e=this.createElement("button",["cv-item"],{type:"button","data-id":t.id??""}),n=l?String(t[l.key]??""):"";e.textContent=t.icon?`${t.icon} ${n}`:n,a.appendChild(e)}d.push(a)}this._grid.replaceChildren(...d)}_goMonth(t){t!==this._month&&(this._month=t,this._render(),this.emit("nk-month",{month:t}))}setupEvents(){this._onClick=t=>{if(t.target.closest(".cal-nav")===this._todayBtn)return void this._goMonth(this._todayIso().slice(0,7));if(t.target.closest(".cal-nav")===this._prev)return void this._goMonth(oe(this._month,-1));if(t.target.closest(".cal-nav")===this._next)return void this._goMonth(oe(this._month,1));const e=t.target.closest(".cv-item");if(e){const t=this._rowById(e.dataset.id);this.emit("nk-select",{row:t,id:t?.id,value:t?.id})}},this._box.addEventListener("click",this._onClick)}teardownEvents(){this._box?.removeEventListener("click",this._onClick)}_rowById(t){return this._rows.find(e=>String(e.id)===String(t))}onAttributeChanged(t){"month"===t&&(this._month=this._attrMonth()??this._month),this._render(),"label"!==t&&"badge"!==t&&"count"!==t||this.closest("nk-database")?.requestSync?.()}get name(){return this.getAttribute("name")||"calendar"}get month(){return this._month}set month(t){/^\d{4}-\d{2}$/.test(t)&&(this._grid?this._goMonth(t):this._month=t)}get columns(){return this._columns}set columns(t){this._columns=Array.isArray(t)?t:[],this._render()}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._render()}set data({columns:t,rows:e}){this.setData(t,e)}setData(t,e){this._columns=t||[],this._rows=e||[],this._render()}refresh(){this._render()}}customElements.define("nk-calendar-view",Ue);class He extends p{static get observedAttributes(){return["search","placeholder","no-filter","no-sort","value","add","add-label","filter-label","sort-label","remove-label"]}render(){this._row=this.createElement("div",["nk-filter-row"]),this._filterBtn=this.createElement("button",["nk-db-tool"],{type:"button","data-action":"filter"}),this._sortBtn=this.createElement("button",["nk-db-tool"],{type:"button","data-action":"sort"}),this._pillStart=document.createComment("pills"),this._addBtn=this.createElement("button",["nk-filter-pill","add"],{type:"button","data-action":"add"}),this._input=this.createElement("input",["nk-input"],{type:"search",autocomplete:"off"}),this._row.append(this._filterBtn,this._sortBtn,this._pillStart,this._addBtn,document.createElement("slot"),this._input),this._wrapper.appendChild(this._row),this._filters=[],this._sync()}_sync(){this._filterBtn.textContent=this.getAttribute("filter-label")||"Filter",this._filterBtn.hidden=this.getBoolAttr("no-filter"),this._filterBtn.classList.toggle("active",this._filters.length>0),this._sortBtn.textContent=this.getAttribute("sort-label")||"Sort",this._sortBtn.hidden=this.getBoolAttr("no-sort"),this._addBtn.textContent=this.getAttribute("add-label")||"๏ผ Filter",this._addBtn.hidden=!this.getBoolAttr("add"),this._input.hidden=!this.getBoolAttr("search"),this._input.placeholder=this.getAttribute("placeholder")||"Search โฆ",this.hasAttribute("value")&&this._input.value!==this.getAttribute("value")&&(this._input.value=this.getAttribute("value"));for(const t of this._row.querySelectorAll("[data-pill]"))t.remove();const t=this.getAttribute("remove-label")||"Remove filter";this._pillStart.after(...this._filters.map((e,n)=>{const i=this.createElement("span",["nk-filter-pill","active"],{"data-pill":n}),s=this.createElement("button",[],{type:"button","data-edit":n});s.textContent=e.label??`${e.key}: ${e.value}`;const r=this.createElement("button",["fp-remove"],{type:"button","data-remove":n,"aria-label":`${t}: ${s.textContent}`});return r.textContent="ร",i.append(s,r),i}))}setupEvents(){this._onClick=t=>{const e=t.target.closest("[data-remove]");if(e)return this._filters.splice(Number(e.dataset.remove),1),this._sync(),void this._emitChange();const n=t.target.closest("[data-edit]");if(n){const t=Number(n.dataset.edit);return void this.emit("nk-action",{action:"edit",index:t,filter:this._filters[t],anchor:n})}const i=t.target.closest("[data-action]");i&&this.emit("nk-action",{action:i.dataset.action,anchor:i})},this._onInput=()=>{clearTimeout(this._debounce),this._debounce=setTimeout(()=>this._emitChange(),150)},this._row.addEventListener("click",this._onClick),this._input.addEventListener("input",this._onInput)}teardownEvents(){this._row?.removeEventListener("click",this._onClick),this._input?.removeEventListener("input",this._onInput),clearTimeout(this._debounce)}_emitChange(){this.emit("nk-change",{filters:[...this._filters],search:this._input.value})}onAttributeChanged(){this._sync()}get filters(){return this._filters}set filters(t){this._filters=Array.isArray(t)?t:[],this._row&&this._sync()}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}apply(t){const e=this.value.trim().toLowerCase();return t.filter(t=>this._filters.every(e=>"is-not"===e.op?t[e.key]!==e.value:t[e.key]===e.value)&&(!e||Object.values(t).some(t=>String("object"==typeof t&&t?t.name??"":t??"").toLowerCase().includes(e))))}}customElements.define("nk-filter-bar",He);class We extends p{static get observedAttributes(){return["placeholder","send-label","no-input","disabled"]}render(){const t=this.createElement("div",["nk-comments"]);t.appendChild(document.createElement("slot")),this._row=this.createElement("div",["nk-comment-input"]),this._input=this.createElement("input",["nk-input"],{type:"text","aria-label":"Comment"}),this._btn=this.createElement("button",["nk-btn","primary","small"],{type:"button"}),this._row.append(this._input,this._btn),t.appendChild(this._row),this._wrapper.appendChild(t),this._sync()}_sync(){this._input.placeholder=this.getAttribute("placeholder")||"Comment โฆ",this._btn.textContent=this.getAttribute("send-label")||"Send",this._row.style.display=this.getBoolAttr("no-input")?"none":"",this._input.disabled=this._btn.disabled=this.getBoolAttr("disabled")}setupEvents(){this._onSend=()=>this.submit(),this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this.submit())},this._btn.addEventListener("click",this._onSend),this._input.addEventListener("keydown",this._onKey)}teardownEvents(){this._btn?.removeEventListener("click",this._onSend),this._input?.removeEventListener("keydown",this._onKey)}submit(){const t=this._input.value.trim();if(!t)return;this.emit("nk-submit",{text:t})&&(this._input.value="")}onAttributeChanged(){this._sync()}focus(t){this._input?.focus(t)}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}}customElements.define("nk-comments",We);class Ge extends p{static get observedAttributes(){return["author","time","avatar","color"]}render(){const t=this.createElement("div",["nk-comment"]);this._avatar=this.createElement("span",["nk-avatar"]);const e=this.createElement("slot",[],{name:"avatar"});e.appendChild(this._avatar);const n=document.createElement("div");this._head=this.createElement("div",["c-head"]),this._author=document.createElement("b"),this._time=document.createTextNode(""),this._head.append(this._author,this.createElement("slot",[],{name:"head"}),this._time);const i=this.createElement("div",["c-body"]);i.appendChild(document.createElement("slot")),n.append(this._head,i),t.append(e,n),this._wrapper.appendChild(t),this._sync()}_sync(){const t=this.getAttribute("author")||"";this._author.textContent=t;const e=this.getAttribute("time");this._time.data=e?` ยท ${e}`:"",this._avatar.textContent=this.getAttribute("avatar")||At(t),wt(this._avatar,this.getAttribute("color"))}onAttributeChanged(){this._sync()}}customElements.define("nk-comment",Ge);class Ye extends p{render(){const t=this.createElement("div",["nk-ai-thread"],{role:"log","aria-live":"polite"});t.appendChild(document.createElement("slot")),this._wrapper.appendChild(t)}}customElements.define("nk-ai-thread",Ye);class Qe extends p{static get observedAttributes(){return["role","name","badge","avatar","color","bubble"]}render(){this._box=this.createElement("div",["nk-ai-msg"]),this._avatar=this.createElement("span",["mini-avatar"]);const t=this.createElement("slot",[],{name:"avatar"});t.appendChild(this._avatar),this._avatarSlot=t;const e=this.createElement("div",["a-body"]);this._name=this.createElement("div",["a-name"]),this._nameText=document.createTextNode(""),this._badge=document.createElement("span"),this._name.append(this._nameText,this._badge),this._actions=this.createElement("div",["nk-ai-actions"]),this._actionSlot=this.createElement("slot",[],{name:"actions"}),this._actions.appendChild(this._actionSlot),e.append(this._name,document.createElement("slot"),this._actions),this._box.append(t,e),this._wrapper.appendChild(this._box),this._sync()}_sync(){const t="user"===this.getAttribute("role"),e=this.getBoolAttr("bubble");this._box.classList.toggle("user",t),this._box.classList.toggle("bubble",e);const n=this.getAttribute("name");this._nameText.data=n||"";const i=this.getAttribute("badge");this._badge.textContent=i?` ${i}`:"",this._name.style.display=n&&!e?"":"none",this._avatarSlot.style.display=e?"none":"",this._avatar.textContent=this.getAttribute("avatar")||(t?(n||"U").slice(0,2).toUpperCase():"โจ");const s=this.getAttribute("color");this._avatar.style.background=s||"",this._actions.style.display=this._actionSlot.assignedElements().length?"":"none"}setupEvents(){this._onSlot=()=>this._sync(),this._onClick=t=>{const e=t.target.closest?.("button");e&&this._actionSlot.assignedElements().includes(e)&&this.emit("nk-action",{action:e.value||e.textContent.trim(),value:e.value||e.textContent.trim()})},this._actionSlot.addEventListener("slotchange",this._onSlot),this.addEventListener("click",this._onClick),this._sync()}teardownEvents(){this._actionSlot?.removeEventListener("slotchange",this._onSlot),this.removeEventListener("click",this._onClick)}onAttributeChanged(){this._sync()}}customElements.define("nk-ai-msg",Qe);class Ze extends p{static get observedAttributes(){return["placeholder","value","disabled","icon"]}render(){this._row=this.createElement("div",["nk-ai-input-row"]),this._icon=document.createElement("span"),this._icon.style.fontSize="14px",this._input=this.createElement("input",[],{type:"text","aria-label":"Message"}),this._btn=this.createElement("button",["nk-ai-send"],{type:"button","aria-label":"Send"}),this._btn.textContent="โ",this._row.append(this._icon,this._input,this._btn),this._wrapper.appendChild(this._row),this._sync()}_sync(){this._input.placeholder=this.getAttribute("placeholder")||"Ask something โฆ",this.hasAttribute("value")&&this._input.value!==this.getAttribute("value")&&(this._input.value=this.getAttribute("value")),this._input.disabled=this._btn.disabled=this.getBoolAttr("disabled");const t=this.getAttribute("icon")??"โจ";this._icon.textContent=t,this._icon.style.display=t?"":"none"}setupEvents(){this._onSend=()=>this.submit(),this._onKey=t=>{"Enter"===t.key&&(t.preventDefault(),this.submit())},this._btn.addEventListener("click",this._onSend),this._input.addEventListener("keydown",this._onKey)}teardownEvents(){this._btn?.removeEventListener("click",this._onSend),this._input?.removeEventListener("keydown",this._onKey)}submit(){const t=this._input.value.trim();if(!t||this.getBoolAttr("disabled"))return;this.emit("nk-submit",{text:t})&&(this._input.value="")}onAttributeChanged(){this._sync()}focus(t){this._input?.focus(t)}get value(){return this._input?.value??""}set value(t){this._input&&(this._input.value=t??"")}}return customElements.define("nk-ai-input-row",Ze),t.NkAiInputRow=Ze,t.NkAiMsg=Qe,t.NkAiThread=Ye,t.NkApp=U,t.NkAvatar=Et,t.NkAvatarGroup=ft,t.NkBanner=ct,t.NkBlockHost=lt,t.NkBoardView=$e,t.NkBookmark=Wt,t.NkBreadcrumb=tt,t.NkBtn=b,t.NkCalendar=ge,t.NkCalendarView=Ue,t.NkCallout=I,t.NkCheck=A,t.NkCmdk=ye,t.NkCode=$,t.NkComment=Ge,t.NkComments=We,t.NkCopyField=Gt,t.NkDangerZone=Nt,t.NkDatabase=Me,t.NkDivider=q,t.NkElement=p,t.NkEmojiPicker=Te,t.NkEmpty=dt,t.NkField=T,t.NkFields=D,t.NkFilterBar=He,t.NkFormElement=u,t.NkHeading=j,t.NkImagePicker=Qt,t.NkInput=_,t.NkKbd=K,t.NkListView=Re,t.NkMemberList=Tt,t.NkMemberRow=Dt,t.NkMention=Bt,t.NkMenu=Ae,t.NkMenuItem=Ee,t.NkModal=_e,t.NkModelCard=St,t.NkPage=st,t.NkPageActions=at,t.NkPageCover=rt,t.NkPageTitle=ot,t.NkPanel=It,t.NkPanels=Vt,t.NkPeek=ke,t.NkPop=Le,t.NkProfileRow=zt,t.NkProgress=V,t.NkProp=Ft,t.NkProps=Mt,t.NkQuote=R,t.NkRadio=L,t.NkSectionLabel=Y,t.NkSegmented=_t,t.NkSelect=y,t.NkSettingsPane=ve,t.NkSettingsUser=xe,t.NkSheet=Ut,t.NkSidebar=H,t.NkSkeleton=pt,t.NkSlider=z,t.NkStat=xt,t.NkStats=vt,t.NkSteps=Ht,t.NkSwitch=w,t.NkSynced=ut,t.NkTab=mt,t.NkTabBar=nt,t.NkTabBarItem=it,t.NkTableView=Ke,t.NkTabs=bt,t.NkTag=F,t.NkTemplateBtn=Lt,t.NkTextarea=f,t.NkThemeToggle=et,t.NkToast=De,t.NkTodo=P,t.NkToggle=O,t.NkTopbar=X,t.NkTree=Z,t.NkTreeItem=J,t.NkWorkspaceSwitcher=G,t.compareBy=Pe,t.componentsSheet=o,t.renderPropertyCell=qe,t.tagFor=Ie,t}({});
|