neatkit 0.15.0 → 0.15.1

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/dist/Markdown.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),M=require("react"),G=require("react-markdown"),W=require("rehype-raw"),H=require("rehype-sanitize"),V=require("rehype-slug"),J=require("remark-gfm"),Y=require("./Alert-LJDkNUqH.cjs"),X=require("./Code-f0GWveGp.cjs"),Q=require("./Divider-C7XGlr26.cjs"),_=require("./Table-GlG5aITK.cjs"),k=require("./Text-DWYlIcPj.cjs"),Z={bash:"Shell",c:"C","c++":"C++",cpp:"C++",css:"CSS",go:"Go",golang:"Go",html:"HTML",js:"JavaScript",javascript:"JavaScript",jsx:"JavaScript",json:"JSON",markdown:"Markdown",md:"Markdown",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",rs:"Rust",rust:"Rust",sh:"Shell",shell:"Shell",sql:"SQL",ts:"TypeScript",tsx:"TypeScript",typescript:"TypeScript",xml:"HTML",yaml:"YAML",yml:"YAML"};function ee(e){var a;const o=(a=e==null?void 0:e.split(/\s+/).find(f=>f.startsWith("language-")))==null?void 0:a.slice(9).toLowerCase();return o?Z[o]:void 0}const A="md-",B=["a","blockquote","br","code","del","em","h1","h2","h3","h4","h5","h6","hr","img","input","li","ol","p","picture","pre","section","source","strong","sup","table","tbody","td","th","thead","tr","ul"],ne={...H.defaultSchema,allowComments:!1,allowDoctypes:!1,ancestors:{...H.defaultSchema.ancestors,source:["picture"]},attributes:{"*":["dir","id","lang","title"],a:["ariaDescribedBy","ariaLabel","dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href","hrefLang"],code:[["className",/^language-[\w+-]+$/]],h2:[["className","sr-only"]],img:["alt","height","src","srcSet","width"],input:["checked",["disabled",!0],"readOnly",["type","checkbox"]],li:[["className","task-list-item"]],ol:["start",["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],source:["media","srcSet","type"],td:["align","colSpan","rowSpan"],th:["align","colSpan","rowSpan","scope"],ul:[["className","contains-task-list"]]},clobber:H.defaultSchema.clobber,clobberPrefix:A,strip:["script","style"],tagNames:[...B]};function re(e,o){const a=o.flags.replace(/[gy]/g,"");return new RegExp(o.source,a).test(e)}function te(e){if(!e)return null;try{const o=new URL(e);return o.protocol!=="http:"&&o.protocol!=="https:"||o.username||o.password?null:o}catch{return null}}function R(e,o,a){if(e.includes("\\")||/[\u0000-\u0020\u007f]/.test(e)||o===void 0)return;const f=/^[a-z][a-z\d+.-]*:/i.test(e),m=e.startsWith("//");if(o==="*")return!f&&!m||/^https?:/i.test(e)||m?e:void 0;const s=Array.isArray(o)?o:[o],t=te(a);try{let n=null;if(f?n=new URL(e):t&&(n=new URL(e,t)),!n||n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password)return;const r=n.href;return s.some(c=>re(r,c))?r:void 0}catch{return}}function v(e,o,a){if(!e)return;const m=e.split(",").map(s=>{const t=s.trim().split(/\s+/),[n,r]=t,u=r===void 0||/^(?:\d+w|(?:\d+(?:\.\d+)?|\.\d+)x)$/.test(r);if(t.length>2||!u||n===void 0||n.length===0)return null;const c=R(n,o,a);return c?`${c}${r?` ${r}`:""}`:null});if(!m.some(s=>s===null))return m.join(", ")}function oe(){function e(o){o.children=o.children.filter(a=>a.type!=="element"||a.tagName!=="input"||a.position===void 0),o.children.forEach(a=>{a.type==="element"&&e(a)})}return o=>e(o)}function S(e,o){return Array.isArray(e)?e.map(a=>typeof a=="string"?`${o}${a}`:a):typeof e=="string"?e.split(/\s+/).map(a=>`${o}${a}`).join(" "):e}function se(e){const{clobberPrefix:o,prefix:a}=e;function f(m){if(m.type==="element"){const{properties:s}=m;s.id=S(s.id,a),s.name=S(s.name,a),s.ariaDescribedBy=S(s.ariaDescribedBy,a),s.ariaLabelledBy=S(s.ariaLabelledBy,a),typeof s.href=="string"&&s.href.startsWith("#")&&(s.href=`#${o}${a}${s.href.slice(1)}`)}"children"in m&&m.children.forEach(f)}return m=>f(m)}function C(e){return e==="center"||e==="left"||e==="right"?e:void 0}function E(e){return e.type==="text"?e.value:"children"in e?e.children.map(E).join(""):""}function T(e){return typeof e=="string"?e:void 0}function ie(e){if(!e)return null;const o=e.children.find(n=>n.type==="element"&&n.tagName==="code");if(!o||e.children.some(n=>n!==o&&(n.type!=="text"||n.value.trim().length>0)))return null;const f=o.properties.className;let m;Array.isArray(f)?m=f.join(" "):typeof f=="string"&&(m=f);const s=o.children.map(E).join("").replace(/\n$/,"");return{codeProps:{className:m,dir:T(o.properties.dir),id:T(o.properties.id),lang:T(o.properties.lang),title:T(o.properties.title)},content:s}}function ae(e,o,a,f,m){return{a:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("a",{...i,className:["nk-markdown__link",r].filter(Boolean).join(" "),onClick:m,children:n})},blockquote:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx("blockquote",{...c,className:"nk-markdown__blockquote",children:n})},code:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("code",{...i,className:["nk-markdown__inline-code",r].filter(Boolean).join(" "),children:n})},h1:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h1",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"heading",weight:"semibold",children:n})},h2:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h2",className:["nk-markdown__heading",r!=null&&r.split(/\s+/).includes("sr-only")?"nk-markdown__visually-hidden":void 0].filter(Boolean).join(" "),size:"title",weight:"semibold",children:n})},h3:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h3",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"subtitle",weight:"semibold",children:n})},h4:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h4",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h5:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h5",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h6:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h6",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"medium",children:n})},hr:function(t){const{dangerouslySetInnerHTML:n,node:r,...u}=t;return d.jsx(Q.Divider,{...u})},img:function(t){const{alt:n,className:r,dangerouslySetInnerHTML:u,node:c,src:i,srcSet:l,...b}=t,x=R(typeof i=="string"?i:"",e,o),L=v(l,e,o);return x?d.jsx("img",{...b,alt:n??"",className:["nk-markdown__image",r].filter(Boolean).join(" "),decoding:"async",loading:"lazy",src:x,srcSet:L}):n?d.jsx("span",{className:"nk-markdown__blocked-image",children:n}):null},input:function(t){const{checked:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsxs(d.Fragment,{children:[d.jsx("input",{...i,"aria-label":n?"Completed task":"Incomplete task",checked:n,className:["nk-markdown__task-control","nk-markdown__visually-hidden",r].filter(Boolean).join(" "),disabled:!0,readOnly:!0,type:"checkbox"}),d.jsx("span",{"aria-hidden":"true",className:"nk-markdown__task",children:n?"☒":"☐"})]})},li:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("task-list-item"))??!1;return d.jsx("li",{...i,className:["nk-markdown__list-item",l?"nk-markdown__list-item--task":void 0].filter(Boolean).join(" "),children:n})},ol:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ol",{...i,className:["nk-markdown__list","nk-markdown__list--ordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})},p:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,className:["nk-markdown__paragraph",r].filter(Boolean).join(" "),children:n})},picture:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("picture",{...i,className:["nk-markdown__picture",r].filter(Boolean).join(" "),children:n})},pre:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,ref:c,...i}=t,l=ie(u);return l?d.jsx(X.Code,{code:l.content,codeProps:l.codeProps,language:ee(l.codeProps.className),maxHighlightLength:a,maxLineCount:f,preProps:i}):d.jsx("pre",{...i,children:n})},source:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,srcSet:c,...i}=t,l=v(c,e,o);return l?d.jsx("source",{...i,srcSet:l}):null},table:function(t){const{children:n,dangerouslySetInnerHTML:r,frame:u,node:c,...i}=t;return d.jsx(_.Table,{...i,children:n})},tbody:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Body,{...c,children:n})},td:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.Cell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},th:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.HeaderCell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},thead:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Head,{...c,children:n})},tr:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,onClick:c,...i}=t;return d.jsx(_.Table.Row,{...i,children:n})},ul:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ul",{...i,className:["nk-markdown__list","nk-markdown__list--unordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})}}}const le={clobberPrefix:""},ce=25e3,de="Markdown content exceeds the rendering limit.";function ue(e,o){if(!e.startsWith("#")||e.length===1)return null;let a=e.slice(1);try{a=decodeURIComponent(a)}catch{return null}return o.getElementById(a)}function me(e){const o=e.tabIndex<0&&!e.hasAttribute("tabindex");if(o&&e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),!!o){if(e.ownerDocument.activeElement!==e){e.removeAttribute("tabindex");return}e.addEventListener("blur",()=>e.removeAttribute("tabindex"),{once:!0})}}function fe(e,o){const a=e,f=new a.HashChangeEvent("hashchange",{newURL:e.location.href,oldURL:o});e.dispatchEvent(f)}function he(e){return e===null?null:Number.isFinite(e)?Math.max(0,Math.floor(e)):0}const pe=M.forwardRef(function(o,a){const{allowedImageSources:f,anchorPrefix:m="",className:s,content:t,dangerouslySetInnerHTML:n,imageBaseUrl:r,maxCodeHighlightLength:u,maxCodeLineCount:c,maxContentLength:i=ce,rehypePlugins:l,remarkPlugins:b,scrollOffset:g=128,style:x,...L}=o,P=he(i),D=P!==null&&t.length>P,j=M.useCallback(h=>{var N;if(h.defaultPrevented||h.button!==0||h.metaKey||h.ctrlKey||h.shiftKey||h.altKey)return;const y=h.currentTarget.getAttribute("href");if(!y)return;const w=ue(y,h.currentTarget.ownerDocument);if(!w||typeof w.scrollIntoView!="function")return;const p=w.ownerDocument.defaultView;if(!p)return;h.preventDefault();const z=((N=p.matchMedia)==null?void 0:N.call(p,"(prefers-reduced-motion: reduce)").matches)??!1,F=g===null||z?"auto":"smooth",U=p.location.href,K=p.location.hash!==y;p.location.hash!==y&&p.history.pushState(p.history.state,"",y),me(w),w.scrollIntoView({behavior:F,block:"start"}),K&&fe(p,U)},[g]),O=M.useMemo(()=>ae(f,r,u,c,j),[f,j,r,u,c]),q=M.useMemo(()=>[J,...b??[]],[b]),$=M.useMemo(()=>[W,...l??[],oe,V,[se,{clobberPrefix:A,prefix:m}],[H,ne]],[m,l]),I={...x};if(g!==null){const h=Number.isFinite(g)?Math.max(0,g):0;I["--nk-markdown-scroll-offset"]=`${h}px`}return d.jsx("div",{...L,ref:a,className:["nk-markdown",s].filter(Boolean).join(" "),style:I,children:D?d.jsx(Y.Alert,{role:"alert",tone:"warning",children:de}):d.jsx(G,{allowedElements:B,components:O,rehypePlugins:$,remarkPlugins:q,remarkRehypeOptions:le,children:t})})});exports.default=pe;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),M=require("react"),G=require("react-markdown"),W=require("rehype-raw"),H=require("rehype-sanitize"),V=require("rehype-slug"),J=require("remark-gfm"),Y=require("./Alert-LJDkNUqH.cjs"),X=require("./Code-f0GWveGp.cjs"),Q=require("./Divider-C7XGlr26.cjs"),_=require("./Table-DBkiHOd0.cjs"),k=require("./Text-DWYlIcPj.cjs"),Z={bash:"Shell",c:"C","c++":"C++",cpp:"C++",css:"CSS",go:"Go",golang:"Go",html:"HTML",js:"JavaScript",javascript:"JavaScript",jsx:"JavaScript",json:"JSON",markdown:"Markdown",md:"Markdown",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",rs:"Rust",rust:"Rust",sh:"Shell",shell:"Shell",sql:"SQL",ts:"TypeScript",tsx:"TypeScript",typescript:"TypeScript",xml:"HTML",yaml:"YAML",yml:"YAML"};function ee(e){var a;const o=(a=e==null?void 0:e.split(/\s+/).find(f=>f.startsWith("language-")))==null?void 0:a.slice(9).toLowerCase();return o?Z[o]:void 0}const A="md-",B=["a","blockquote","br","code","del","em","h1","h2","h3","h4","h5","h6","hr","img","input","li","ol","p","picture","pre","section","source","strong","sup","table","tbody","td","th","thead","tr","ul"],ne={...H.defaultSchema,allowComments:!1,allowDoctypes:!1,ancestors:{...H.defaultSchema.ancestors,source:["picture"]},attributes:{"*":["dir","id","lang","title"],a:["ariaDescribedBy","ariaLabel","dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href","hrefLang"],code:[["className",/^language-[\w+-]+$/]],h2:[["className","sr-only"]],img:["alt","height","src","srcSet","width"],input:["checked",["disabled",!0],"readOnly",["type","checkbox"]],li:[["className","task-list-item"]],ol:["start",["className","contains-task-list"]],section:["dataFootnotes",["className","footnotes"]],source:["media","srcSet","type"],td:["align","colSpan","rowSpan"],th:["align","colSpan","rowSpan","scope"],ul:[["className","contains-task-list"]]},clobber:H.defaultSchema.clobber,clobberPrefix:A,strip:["script","style"],tagNames:[...B]};function re(e,o){const a=o.flags.replace(/[gy]/g,"");return new RegExp(o.source,a).test(e)}function te(e){if(!e)return null;try{const o=new URL(e);return o.protocol!=="http:"&&o.protocol!=="https:"||o.username||o.password?null:o}catch{return null}}function R(e,o,a){if(e.includes("\\")||/[\u0000-\u0020\u007f]/.test(e)||o===void 0)return;const f=/^[a-z][a-z\d+.-]*:/i.test(e),m=e.startsWith("//");if(o==="*")return!f&&!m||/^https?:/i.test(e)||m?e:void 0;const s=Array.isArray(o)?o:[o],t=te(a);try{let n=null;if(f?n=new URL(e):t&&(n=new URL(e,t)),!n||n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password)return;const r=n.href;return s.some(c=>re(r,c))?r:void 0}catch{return}}function v(e,o,a){if(!e)return;const m=e.split(",").map(s=>{const t=s.trim().split(/\s+/),[n,r]=t,u=r===void 0||/^(?:\d+w|(?:\d+(?:\.\d+)?|\.\d+)x)$/.test(r);if(t.length>2||!u||n===void 0||n.length===0)return null;const c=R(n,o,a);return c?`${c}${r?` ${r}`:""}`:null});if(!m.some(s=>s===null))return m.join(", ")}function oe(){function e(o){o.children=o.children.filter(a=>a.type!=="element"||a.tagName!=="input"||a.position===void 0),o.children.forEach(a=>{a.type==="element"&&e(a)})}return o=>e(o)}function S(e,o){return Array.isArray(e)?e.map(a=>typeof a=="string"?`${o}${a}`:a):typeof e=="string"?e.split(/\s+/).map(a=>`${o}${a}`).join(" "):e}function se(e){const{clobberPrefix:o,prefix:a}=e;function f(m){if(m.type==="element"){const{properties:s}=m;s.id=S(s.id,a),s.name=S(s.name,a),s.ariaDescribedBy=S(s.ariaDescribedBy,a),s.ariaLabelledBy=S(s.ariaLabelledBy,a),typeof s.href=="string"&&s.href.startsWith("#")&&(s.href=`#${o}${a}${s.href.slice(1)}`)}"children"in m&&m.children.forEach(f)}return m=>f(m)}function C(e){return e==="center"||e==="left"||e==="right"?e:void 0}function E(e){return e.type==="text"?e.value:"children"in e?e.children.map(E).join(""):""}function T(e){return typeof e=="string"?e:void 0}function ie(e){if(!e)return null;const o=e.children.find(n=>n.type==="element"&&n.tagName==="code");if(!o||e.children.some(n=>n!==o&&(n.type!=="text"||n.value.trim().length>0)))return null;const f=o.properties.className;let m;Array.isArray(f)?m=f.join(" "):typeof f=="string"&&(m=f);const s=o.children.map(E).join("").replace(/\n$/,"");return{codeProps:{className:m,dir:T(o.properties.dir),id:T(o.properties.id),lang:T(o.properties.lang),title:T(o.properties.title)},content:s}}function ae(e,o,a,f,m){return{a:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("a",{...i,className:["nk-markdown__link",r].filter(Boolean).join(" "),onClick:m,children:n})},blockquote:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx("blockquote",{...c,className:"nk-markdown__blockquote",children:n})},code:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("code",{...i,className:["nk-markdown__inline-code",r].filter(Boolean).join(" "),children:n})},h1:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h1",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"heading",weight:"semibold",children:n})},h2:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h2",className:["nk-markdown__heading",r!=null&&r.split(/\s+/).includes("sr-only")?"nk-markdown__visually-hidden":void 0].filter(Boolean).join(" "),size:"title",weight:"semibold",children:n})},h3:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h3",className:["nk-markdown__heading",r].filter(Boolean).join(" "),size:"subtitle",weight:"semibold",children:n})},h4:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h4",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h5:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h5",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"semibold",children:n})},h6:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,as:"h6",className:["nk-markdown__heading",r].filter(Boolean).join(" "),weight:"medium",children:n})},hr:function(t){const{dangerouslySetInnerHTML:n,node:r,...u}=t;return d.jsx(Q.Divider,{...u})},img:function(t){const{alt:n,className:r,dangerouslySetInnerHTML:u,node:c,src:i,srcSet:l,...b}=t,x=R(typeof i=="string"?i:"",e,o),L=v(l,e,o);return x?d.jsx("img",{...b,alt:n??"",className:["nk-markdown__image",r].filter(Boolean).join(" "),decoding:"async",loading:"lazy",src:x,srcSet:L}):n?d.jsx("span",{className:"nk-markdown__blocked-image",children:n}):null},input:function(t){const{checked:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsxs(d.Fragment,{children:[d.jsx("input",{...i,"aria-label":n?"Completed task":"Incomplete task",checked:n,className:["nk-markdown__task-control","nk-markdown__visually-hidden",r].filter(Boolean).join(" "),disabled:!0,readOnly:!0,type:"checkbox"}),d.jsx("span",{"aria-hidden":"true",className:"nk-markdown__task",children:n?"☒":"☐"})]})},li:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("task-list-item"))??!1;return d.jsx("li",{...i,className:["nk-markdown__list-item",l?"nk-markdown__list-item--task":void 0].filter(Boolean).join(" "),children:n})},ol:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ol",{...i,className:["nk-markdown__list","nk-markdown__list--ordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})},p:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,ref:i,...l}=t;return d.jsx(k.Text,{...l,className:["nk-markdown__paragraph",r].filter(Boolean).join(" "),children:n})},picture:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t;return d.jsx("picture",{...i,className:["nk-markdown__picture",r].filter(Boolean).join(" "),children:n})},pre:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,ref:c,...i}=t,l=ie(u);return l?d.jsx(X.Code,{code:l.content,codeProps:l.codeProps,language:ee(l.codeProps.className),maxHighlightLength:a,maxLineCount:f,preProps:i}):d.jsx("pre",{...i,children:n})},source:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,srcSet:c,...i}=t,l=v(c,e,o);return l?d.jsx("source",{...i,srcSet:l}):null},table:function(t){const{children:n,dangerouslySetInnerHTML:r,frame:u,node:c,...i}=t;return d.jsx(_.Table,{...i,children:n})},tbody:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Body,{...c,children:n})},td:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.Cell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},th:function(t){const{align:n,children:r,dangerouslySetInnerHTML:u,node:c,style:i,...l}=t;return d.jsx(_.Table.HeaderCell,{...l,align:C((i==null?void 0:i.textAlign)??n),children:r})},thead:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,...c}=t;return d.jsx(_.Table.Head,{...c,children:n})},tr:function(t){const{children:n,dangerouslySetInnerHTML:r,node:u,onClick:c,...i}=t;return d.jsx(_.Table.Row,{...i,children:n})},ul:function(t){const{children:n,className:r,dangerouslySetInnerHTML:u,node:c,...i}=t,l=(r==null?void 0:r.split(/\s+/).includes("contains-task-list"))??!1;return d.jsx("ul",{...i,className:["nk-markdown__list","nk-markdown__list--unordered",l?"nk-markdown__list--tasks":void 0].filter(Boolean).join(" "),children:n})}}}const le={clobberPrefix:""},ce=25e3,de="Markdown content exceeds the rendering limit.";function ue(e,o){if(!e.startsWith("#")||e.length===1)return null;let a=e.slice(1);try{a=decodeURIComponent(a)}catch{return null}return o.getElementById(a)}function me(e){const o=e.tabIndex<0&&!e.hasAttribute("tabindex");if(o&&e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),!!o){if(e.ownerDocument.activeElement!==e){e.removeAttribute("tabindex");return}e.addEventListener("blur",()=>e.removeAttribute("tabindex"),{once:!0})}}function fe(e,o){const a=e,f=new a.HashChangeEvent("hashchange",{newURL:e.location.href,oldURL:o});e.dispatchEvent(f)}function he(e){return e===null?null:Number.isFinite(e)?Math.max(0,Math.floor(e)):0}const pe=M.forwardRef(function(o,a){const{allowedImageSources:f,anchorPrefix:m="",className:s,content:t,dangerouslySetInnerHTML:n,imageBaseUrl:r,maxCodeHighlightLength:u,maxCodeLineCount:c,maxContentLength:i=ce,rehypePlugins:l,remarkPlugins:b,scrollOffset:g=128,style:x,...L}=o,P=he(i),D=P!==null&&t.length>P,j=M.useCallback(h=>{var N;if(h.defaultPrevented||h.button!==0||h.metaKey||h.ctrlKey||h.shiftKey||h.altKey)return;const y=h.currentTarget.getAttribute("href");if(!y)return;const w=ue(y,h.currentTarget.ownerDocument);if(!w||typeof w.scrollIntoView!="function")return;const p=w.ownerDocument.defaultView;if(!p)return;h.preventDefault();const z=((N=p.matchMedia)==null?void 0:N.call(p,"(prefers-reduced-motion: reduce)").matches)??!1,F=g===null||z?"auto":"smooth",U=p.location.href,K=p.location.hash!==y;p.location.hash!==y&&p.history.pushState(p.history.state,"",y),me(w),w.scrollIntoView({behavior:F,block:"start"}),K&&fe(p,U)},[g]),O=M.useMemo(()=>ae(f,r,u,c,j),[f,j,r,u,c]),q=M.useMemo(()=>[J,...b??[]],[b]),$=M.useMemo(()=>[W,...l??[],oe,V,[se,{clobberPrefix:A,prefix:m}],[H,ne]],[m,l]),I={...x};if(g!==null){const h=Number.isFinite(g)?Math.max(0,g):0;I["--nk-markdown-scroll-offset"]=`${h}px`}return d.jsx("div",{...L,ref:a,className:["nk-markdown",s].filter(Boolean).join(" "),style:I,children:D?d.jsx(Y.Alert,{role:"alert",tone:"warning",children:de}):d.jsx(G,{allowedElements:B,components:O,rehypePlugins:$,remarkPlugins:q,remarkRehypeOptions:le,children:t})})});exports.default=pe;
package/dist/Markdown.js CHANGED
@@ -9,7 +9,7 @@ import ee from "remark-gfm";
9
9
  import { A as ne } from "./Alert-DQ5CCE0N.js";
10
10
  import { C as re } from "./Code-pROJjsiG.js";
11
11
  import { D as te } from "./Divider-DZgpYpr-.js";
12
- import { T as _ } from "./Table-Dvi-4XA7.js";
12
+ import { T as _ } from "./Table-DdTjtnRE.js";
13
13
  import { T as k } from "./Text-rN6iDo0V.js";
14
14
  const oe = {
15
15
  bash: "Shell",
package/dist/Popover.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),r=require("react"),je=require("./aria-DM-xYEHQ.cjs"),se=require("./effects-D98vUn6N.cjs"),B=require("./reference-C2guRuR0.cjs"),ne=require("./useFloatingPosition-8_GSpDjw.cjs"),h=require("./usePresence-Dm0mls5p.cjs"),De=require("./useFocusTrap-CrMcAu8s.cjs"),Le=require("./Surface-BttJYSDt.cjs");function Ne(n){const{inert:i,panelElement:c}=n;return se.useIsomorphicLayoutEffect(()=>{c&&(c.inert=i)},[i,c]),null}function _e(n,i,c){i.current=n,B.assignElementReference(c,n)}function Me(n,i,c){i.current=n,B.assignElementReference(c,n)}function Be(n){const i=n.tagName.toLowerCase();return n.getAttribute("role")==="button"&&i!=="button"?!1:["button","input","select","summary","textarea"].includes(i)?!0:i==="a"&&n.hasAttribute("href")}function ze(n){return n==="grid"||n==="listbox"||n==="menu"||n==="tree"?n:"dialog"}const Ae=r.forwardRef(function(i,c){const{"aria-label":z,"aria-labelledby":oe,align:A="center",autoFocus:w=!0,children:ae,className:ie,closeOnEscape:ce=!0,closeOnOutsideInteraction:ue=!0,defaultOpen:le=!1,disabled:x=!1,initialFocusReference:E,onEscapeKeyDown:de,onOpenChange:k,onPointerDownOutside:I,open:H,placement:K="bottom",restoreFocus:j=!0,role:V="dialog",style:$,tabIndex:fe,trapFocus:b=!1,trigger:d,...pe}=i;if(d.type===r.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const U=r.useId(),ge=r.useContext(h.FocusScopeContext),G=`${U}-popover`,o=d.props,J=B.getElementReference(d),Q=o.id??`${U}-trigger`,v=x||o.disabled===!0||o["aria-disabled"]===!0||o["aria-disabled"]==="true",R=H!==void 0,[me,be]=r.useState(le),t=R?H:me,C=h.usePresence(t),W=r.useRef(null),X=r.useRef(null),D=r.useRef("programmatic"),L=r.useRef(null),Y=r.useRef(t),T=r.useRef(null),[ve,ye]=r.useReducer(e=>e+1,0),[u,Pe]=r.useState(null),[f,he]=r.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),O=se.useBoundary("Popover").boundaryElement,S=h.useOverlayLayer(C.present,O),Ee=r.useMemo(()=>[W,X],[]),p=ne.useFloatingPosition(C.present,K,u,f,O,A),Re=r.useCallback(e=>{Me(e,W,J),Pe(e)},[J]),Te=r.useCallback(e=>{_e(e,X,c),he(e)},[c]),g=r.useCallback((e,s)=>{t!==e&&(R?(L.current={open:e,reason:s},ye()):(D.current=s,be(e)),k==null||k(e,s))},[R,k,t]),xe=r.useCallback(()=>{g(!1,"escape")},[g]),ke=r.useCallback(()=>{g(!1,"outside")},[g]),Ie=r.useCallback(e=>{var m;if(I==null||I(e),e.defaultPrevented)return;const s=(m=a==null?void 0:a.defaultView)==null?void 0:m.HTMLElement;s?T.current=e.composedPath().find(P=>P instanceof s&&P.tabIndex>=0)??e.target:T.current=e.target},[I,a]);h.useDismissableLayer({boundary:O,active:t,boundaries:Ee,dismissOnEscape:ce,dismissOnPointerDownOutside:ue,layerId:S.id,onEscapeDismiss:xe,onEscapeKeyDown:de,onPointerDownOutside:Ie,onPointerDownOutsideDismiss:ke,ownerDocument:a});const Ce=De.useFocusTrap({boundary:O,active:t&&b,autoFocus:w,container:f,initialFocusReference:E,layerId:S.id,restoreFocus:j});r.useEffect(()=>{if(!t||b||!w||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const s=E==null?void 0:E.current;(s&&f.contains(s)?s:f).focus({preventScroll:!0})}),()=>{e=!1}},[w,E,t,f,b]),r.useEffect(()=>{var te;const e=Y.current;Y.current=t;const s=L.current;let m=D.current;if(R&&(m="programmatic",e!==t&&(s==null?void 0:s.open)===t&&(m=s.reason)),L.current=null,t){D.current="programmatic",T.current=null;return}const P=a==null?void 0:a.activeElement,_=T.current,M=(te=a==null?void 0:a.defaultView)==null?void 0:te.HTMLElement,we=m==="outside"&&M&&_ instanceof M&&P instanceof M&&(_===P||_.contains(P));e&&!b&&j&&!we&&(u==null||u.focus({preventScroll:!0})),T.current=null},[ve,R,t,a,j,b,u]),r.useEffect(()=>{x&&t&&g(!1,"programmatic")},[x,t,g]);function Oe(e){if(v){e.preventDefault(),e.stopPropagation();return}e.defaultPrevented||g(!t,"trigger")}function Se(e){e.defaultPrevented||v||Be(e.currentTarget)||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),e.currentTarget.click())}if(x)return d;const N=typeof d.type=="string",y=N?d.type:null,Z=y==="a"&&typeof o.href=="string",ee=N&&!(y==="button"||y==="input"||y==="select"||y==="summary"||y==="textarea"||Z),re=Z&&v;let q=o.role;q===void 0&&(re?q="link":ee&&(q="button"));let F=o.tabIndex;F===void 0&&ee&&(F=0),v&&(F=-1);const qe=v?{...o,onClick:void 0}:o,Fe=r.cloneElement(d,ne.resolveTriggerOverrides(qe,{"aria-controls":t?je.mergeIdentifiers(o["aria-controls"],G):o["aria-controls"],"aria-expanded":t,"aria-haspopup":o["aria-haspopup"]??ze(V),"aria-disabled":v?!0:o["aria-disabled"],className:"nk-popover__trigger",href:re?void 0:o.href,id:Q,onClick:Oe,onKeyDown:N?Se:void 0,ref:Re,role:q,tabIndex:F}));return l.jsxs(l.Fragment,{children:[Fe,l.jsx(h.FocusScopeContext.Provider,{value:t&&b?Ce:ge,children:C.present&&a?l.jsx(h.Portal,{children:l.jsxs(Le.Surface,{...pe,ref:Te,"aria-hidden":t?void 0:!0,"aria-label":t?z:void 0,"aria-labelledby":t?oe??(z===void 0?Q:void 0):void 0,className:["nk-popover",ie].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??K,"data-align":A,"data-state":C.state==="closing"?"closing":"open",id:G,role:t?V:void 0,style:p?{...$,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:S.zIndex}:{...$,visibility:"hidden",zIndex:S.zIndex},tabIndex:fe??-1,children:[l.jsx(Ne,{inert:!t,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:ae})]})}):null})]})});exports.default=Ae;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),r=require("react"),je=require("./aria-DM-xYEHQ.cjs"),se=require("./effects-D98vUn6N.cjs"),B=require("./reference-C2guRuR0.cjs"),ne=require("./useFloatingPosition-DPVO2E8O.cjs"),h=require("./usePresence-Dm0mls5p.cjs"),De=require("./useFocusTrap-CrMcAu8s.cjs"),Le=require("./Surface-BttJYSDt.cjs");function Ne(n){const{inert:i,panelElement:c}=n;return se.useIsomorphicLayoutEffect(()=>{c&&(c.inert=i)},[i,c]),null}function _e(n,i,c){i.current=n,B.assignElementReference(c,n)}function Me(n,i,c){i.current=n,B.assignElementReference(c,n)}function Be(n){const i=n.tagName.toLowerCase();return n.getAttribute("role")==="button"&&i!=="button"?!1:["button","input","select","summary","textarea"].includes(i)?!0:i==="a"&&n.hasAttribute("href")}function ze(n){return n==="grid"||n==="listbox"||n==="menu"||n==="tree"?n:"dialog"}const Ae=r.forwardRef(function(i,c){const{"aria-label":z,"aria-labelledby":oe,align:A="center",autoFocus:w=!0,children:ae,className:ie,closeOnEscape:ce=!0,closeOnOutsideInteraction:ue=!0,defaultOpen:le=!1,disabled:x=!1,initialFocusReference:E,onEscapeKeyDown:de,onOpenChange:k,onPointerDownOutside:I,open:H,placement:K="bottom",restoreFocus:j=!0,role:V="dialog",style:$,tabIndex:fe,trapFocus:b=!1,trigger:d,...pe}=i;if(d.type===r.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const U=r.useId(),ge=r.useContext(h.FocusScopeContext),G=`${U}-popover`,o=d.props,J=B.getElementReference(d),Q=o.id??`${U}-trigger`,v=x||o.disabled===!0||o["aria-disabled"]===!0||o["aria-disabled"]==="true",R=H!==void 0,[me,be]=r.useState(le),t=R?H:me,C=h.usePresence(t),W=r.useRef(null),X=r.useRef(null),D=r.useRef("programmatic"),L=r.useRef(null),Y=r.useRef(t),T=r.useRef(null),[ve,ye]=r.useReducer(e=>e+1,0),[u,Pe]=r.useState(null),[f,he]=r.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),O=se.useBoundary("Popover").boundaryElement,S=h.useOverlayLayer(C.present,O),Ee=r.useMemo(()=>[W,X],[]),p=ne.useFloatingPosition(C.present,K,u,f,O,A),Re=r.useCallback(e=>{Me(e,W,J),Pe(e)},[J]),Te=r.useCallback(e=>{_e(e,X,c),he(e)},[c]),g=r.useCallback((e,s)=>{t!==e&&(R?(L.current={open:e,reason:s},ye()):(D.current=s,be(e)),k==null||k(e,s))},[R,k,t]),xe=r.useCallback(()=>{g(!1,"escape")},[g]),ke=r.useCallback(()=>{g(!1,"outside")},[g]),Ie=r.useCallback(e=>{var m;if(I==null||I(e),e.defaultPrevented)return;const s=(m=a==null?void 0:a.defaultView)==null?void 0:m.HTMLElement;s?T.current=e.composedPath().find(P=>P instanceof s&&P.tabIndex>=0)??e.target:T.current=e.target},[I,a]);h.useDismissableLayer({boundary:O,active:t,boundaries:Ee,dismissOnEscape:ce,dismissOnPointerDownOutside:ue,layerId:S.id,onEscapeDismiss:xe,onEscapeKeyDown:de,onPointerDownOutside:Ie,onPointerDownOutsideDismiss:ke,ownerDocument:a});const Ce=De.useFocusTrap({boundary:O,active:t&&b,autoFocus:w,container:f,initialFocusReference:E,layerId:S.id,restoreFocus:j});r.useEffect(()=>{if(!t||b||!w||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const s=E==null?void 0:E.current;(s&&f.contains(s)?s:f).focus({preventScroll:!0})}),()=>{e=!1}},[w,E,t,f,b]),r.useEffect(()=>{var te;const e=Y.current;Y.current=t;const s=L.current;let m=D.current;if(R&&(m="programmatic",e!==t&&(s==null?void 0:s.open)===t&&(m=s.reason)),L.current=null,t){D.current="programmatic",T.current=null;return}const P=a==null?void 0:a.activeElement,_=T.current,M=(te=a==null?void 0:a.defaultView)==null?void 0:te.HTMLElement,we=m==="outside"&&M&&_ instanceof M&&P instanceof M&&(_===P||_.contains(P));e&&!b&&j&&!we&&(u==null||u.focus({preventScroll:!0})),T.current=null},[ve,R,t,a,j,b,u]),r.useEffect(()=>{x&&t&&g(!1,"programmatic")},[x,t,g]);function Oe(e){if(v){e.preventDefault(),e.stopPropagation();return}e.defaultPrevented||g(!t,"trigger")}function Se(e){e.defaultPrevented||v||Be(e.currentTarget)||e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),e.currentTarget.click())}if(x)return d;const N=typeof d.type=="string",y=N?d.type:null,Z=y==="a"&&typeof o.href=="string",ee=N&&!(y==="button"||y==="input"||y==="select"||y==="summary"||y==="textarea"||Z),re=Z&&v;let q=o.role;q===void 0&&(re?q="link":ee&&(q="button"));let F=o.tabIndex;F===void 0&&ee&&(F=0),v&&(F=-1);const qe=v?{...o,onClick:void 0}:o,Fe=r.cloneElement(d,ne.resolveTriggerOverrides(qe,{"aria-controls":t?je.mergeIdentifiers(o["aria-controls"],G):o["aria-controls"],"aria-expanded":t,"aria-haspopup":o["aria-haspopup"]??ze(V),"aria-disabled":v?!0:o["aria-disabled"],className:"nk-popover__trigger",href:re?void 0:o.href,id:Q,onClick:Oe,onKeyDown:N?Se:void 0,ref:Re,role:q,tabIndex:F}));return l.jsxs(l.Fragment,{children:[Fe,l.jsx(h.FocusScopeContext.Provider,{value:t&&b?Ce:ge,children:C.present&&a?l.jsx(h.Portal,{children:l.jsxs(Le.Surface,{...pe,ref:Te,"aria-hidden":t?void 0:!0,"aria-label":t?z:void 0,"aria-labelledby":t?oe??(z===void 0?Q:void 0):void 0,className:["nk-popover",ie].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??K,"data-align":A,"data-state":C.state==="closing"?"closing":"open",id:G,role:t?V:void 0,style:p?{...$,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:S.zIndex}:{...$,visibility:"hidden",zIndex:S.zIndex},tabIndex:fe??-1,children:[l.jsx(Ne,{inert:!t,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:ae})]})}):null})]})});exports.default=Ae;
package/dist/Popover.js CHANGED
@@ -4,7 +4,7 @@ import { forwardRef as Be, Fragment as qe, useId as ze, useContext as Ae, useSta
4
4
  import { m as He } from "./aria-Bv-xVREf.js";
5
5
  import { u as Ke, a as Ve } from "./effects-DGbA6Q2O.js";
6
6
  import { g as Ue, a as ae } from "./reference-CXMr27nM.js";
7
- import { u as Ge, r as Je } from "./useFloatingPosition-Cizey9UN.js";
7
+ import { u as Ge, r as Je } from "./useFloatingPosition-DktY7k-t.js";
8
8
  import { F as se, b as Qe, c as We, d as Xe, P as Ye } from "./usePresence-BTRY1_l-.js";
9
9
  import { u as Ze } from "./useFocusTrap-BxPazAL6.js";
10
10
  import { S as er } from "./Surface-vEFsZC12.js";
package/dist/Select.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),l=require("react"),Z=require("./effects-D98vUn6N.cjs"),U=require("./aria-DM-xYEHQ.cjs"),ge=require("./reference-C2guRuR0.cjs"),q=require("./Icon-CgQ62bgw.cjs"),X=require("./usePresence-Dm0mls5p.cjs"),se=require("./useAnchoredPosition-BEzN03Oi.cjs");function ke(t){const{form:n,onReset:s,resetValue:o,triggerReference:a}=t,d=l.useRef(null);return l.useEffect(()=>{var f;const u=(f=a.current)==null?void 0:f.form;if(!u)return;function i(){const m=d.current;if(m){const y=Array.from(m.options),I=y.find(x=>x.value===o)??y[0];y.forEach(x=>{x.defaultSelected=x===I})}s()}return u.addEventListener("reset",i),()=>u.removeEventListener("reset",i)},[n,s,o,a]),d}const H=8,z=4,we=160,Ee=72;function Re(t,n,s,o="start"){const a=s.bottom-t.bottom-z-H,d=t.top-s.top-z-H,u=a<we&&d>a,i=Math.max(Ee,u?d:a),f=Math.max(t.width,(n==null?void 0:n.width)??t.width),m=s.left+H,y=se.calculateAlignedPosition(o,t.left,t.width,f),I=Math.min(Math.max(m,y),Math.max(m,s.right-H-f)),x=u?Math.max(s.top+H,t.top-z-Math.min((n==null?void 0:n.height)??i,i)):t.bottom+z;return{left:I,maxHeight:i,minWidth:t.width,top:x}}function _e(t,n,s,o,a="start"){const d=l.useCallback(u=>{const{panelBounds:i,triggerBounds:f,visibleBounds:m}=u;return Re(f,i,m,a)},[a]);return se.useAnchoredPosition({active:t,boundary:o,fit:d,panel:s,trigger:n})}const Oe=500;function Se(t){const n=l.useRef(""),s=l.useRef(null),o=l.useRef(null);return l.useEffect(()=>()=>{const a=o.current;a&&s.current!==null&&a.clearTimeout(s.current)},[]),l.useCallback(a=>{var f;const d=(f=t.current)==null?void 0:f.ownerDocument.defaultView;if(!d)return null;o.current=d;const u=n.current+a,i=Array.from(u).every(m=>m===a);return n.current=i?a:u,s.current!==null&&d.clearTimeout(s.current),s.current=d.setTimeout(()=>{n.current="",s.current=null},Oe),n.current},[t])}function J(t,n,s){if(t.length===0)return-1;for(let o=1;o<=t.length;o+=1){const a=(n+s*o+t.length)%t.length;if(!t[a].disabled)return a}return-1}function De(t,n,s){for(let o=1;o<=t.length;o+=1){const a=(s+o+t.length)%t.length,d=t[a];if(!d.disabled&&d.label.toLocaleLowerCase().startsWith(n))return a}return-1}function je(t){const n=new Set;t.forEach(s=>{if(n.has(s.value))throw new Error("Select option values must be unique");n.add(s.value)})}function Le(t){const{active:n,align:s,closeOnEscape:o,closeOnOutsideInteraction:a,highlightedIndex:d,id:u,listboxReference:i,onEscapeDismiss:f,onEscapeKeyDown:m,onHighlight:y,onOutsideDismiss:I,onPointerDownOutside:x,onSelect:O,options:S,ownerDocument:A,position:E,selectedValue:R,state:D,triggerReference:V}=t,v=l.useRef(null),W=Z.useBoundary("Select").boundaryElement,_=X.useOverlayLayer(!0,W),$=l.useMemo(()=>[V,v],[V]),G=l.useCallback(h=>{v.current=h,i(h)},[i]);return X.useDismissableLayer({active:n,boundaries:$,boundary:W,dismissOnEscape:o,dismissOnPointerDownOutside:a,layerId:_.id,onEscapeDismiss:f,onEscapeKeyDown:m,onPointerDownOutside:x,onPointerDownOutsideDismiss:I,ownerDocument:A}),c.jsx("div",{"aria-hidden":n?void 0:!0,"aria-labelledby":u,className:"nk-select__listbox","data-align":s,"data-state":D,id:`${u}-listbox`,ref:G,role:"listbox",style:E?{left:E.left,maxHeight:E.maxHeight,minWidth:E.minWidth,top:E.top,zIndex:_.zIndex}:{visibility:"hidden",zIndex:_.zIndex},children:S.map((h,C)=>c.jsxs("div",{"aria-disabled":h.disabled||void 0,"aria-selected":h.value===R,className:"nk-select__option","data-highlighted":C===d||void 0,"data-selected":h.value===R||void 0,id:`${u}-option-${C}`,onPointerDown:Y=>{Y.preventDefault(),h.disabled||O(h)},onPointerMove:()=>{h.disabled||y(C)},role:"option",children:[h.icon?c.jsx(q.Icon,{type:h.icon}):null,c.jsx("span",{className:"nk-select__option-label",children:h.label}),h.value===R?c.jsx(q.Icon,{className:"nk-select__check",type:"checkmark"}):null]},h.value))})}function Pe(t,n,s){n.current=t,ge.assignElementReference(s,t)}function Ae(t){var te;const{"aria-invalid":n,align:s="start",className:o,closeOnEscape:a=!0,closeOnOutsideInteraction:d=!0,defaultValue:u="",disabled:i=!1,displayOverride:f,form:m,forwardedReference:y,id:I,invalid:x=!1,name:O,onChange:S,onClick:A,onEscapeKeyDown:E,onKeyDown:R,onOpenChange:D,onPointerDownOutside:V,options:v,placeholder:W,required:_=!1,style:$,value:G,width:h,...C}=t;je(v);const Y=l.useId(),j=I??Y,g=l.useRef(null),[N,ae]=l.useState(null),[p,le]=l.useState(!1),[k,T]=l.useState(-1),[ie,B]=l.useState(u),L=G!==void 0,P=L?G:ie,re=v.find(e=>e.value===P),oe=x||U.hasInvalidState(n),ce=U.resolveAriaInvalid(x,n),Q=X.usePresence(p),M=((te=g.current)==null?void 0:te.ownerDocument)??(typeof document>"u"?null:document),de=Z.useBoundary("Select").boundaryElement,ue=_e(Q.present,g.current,N,de,s),fe=Se(g),me=h===void 0?$:{...$,width:h},K=f??re,he=l.useCallback(e=>Pe(e,g,y),[y]),b=l.useCallback(e=>{p!==e&&(le(e),D==null||D(e))},[D,p]),ve=l.useCallback(()=>{L||B(u),b(!1)},[u,L,b]),pe=ke({form:m,onReset:ve,resetValue:L?P:u,triggerReference:g}),F=l.useCallback((e=1)=>{const r=v.findIndex(ne=>ne.value===P&&!ne.disabled),w=e===1?-1:v.length;T(r>=0?r:J(v,w,e)),b(!0)},[v,P,b]),ee=l.useCallback(e=>{var r;i||e.disabled||(L||B(e.value),b(!1),(r=g.current)==null||r.focus(),S==null||S(e.value))},[i,L,S,b]),be=l.useCallback(()=>{var e;b(!1),(e=g.current)==null||e.focus()},[b]),ye=l.useCallback(()=>{b(!1)},[b]);function xe(e){A==null||A(e),!(e.defaultPrevented||i)&&(p?b(!1):F())}function Ie(e){if(R==null||R(e),!(e.defaultPrevented||i)){if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const r=e.key==="ArrowDown"?1:-1;p?T(w=>J(v,w,r)):F(r);return}if(e.key==="Home"||e.key==="End"){if(e.preventDefault(),!p)F(e.key==="Home"?1:-1);else{const r=e.key==="Home"?1:-1,w=r===1?-1:v.length;T(J(v,w,r))}return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const r=v[k];p&&r?ee(r):p||F();return}if(e.key==="Tab"){b(!1);return}if(e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey){const r=fe(e.key.toLocaleLowerCase());if(r===null)return;const w=De(v,r,k);w>=0&&(e.preventDefault(),p||b(!0),T(w))}}}return l.useEffect(()=>{i&&b(!1)},[i,b]),l.useEffect(()=>{var e;if(p&&k>=0){const r=M==null?void 0:M.getElementById(`${j}-option-${k}`);r&&(N!=null&&N.contains(r))&&((e=r.scrollIntoView)==null||e.call(r,{block:"nearest"}))}},[k,j,N,p]),c.jsxs("span",{className:["nk-select",o].filter(Boolean).join(" "),"data-disabled":i||void 0,"data-invalid":oe||void 0,"data-mode":"custom","data-open":p||void 0,style:me,children:[c.jsxs("button",{...C,ref:he,"aria-activedescendant":p&&k>=0?`${j}-option-${k}`:void 0,"aria-controls":`${j}-listbox`,"aria-expanded":p,"aria-haspopup":"listbox","aria-invalid":ce,"aria-required":_||void 0,"aria-autocomplete":"none",className:"nk-select__trigger",disabled:i,form:m,id:j,onClick:xe,onKeyDown:Ie,role:"combobox",type:"button",children:[K?c.jsxs("span",{className:"nk-select__value",children:[K.icon?c.jsx(q.Icon,{type:K.icon}):null,c.jsx("span",{className:"nk-select__value-label",children:K.label})]}):c.jsx("span",{className:"nk-select__placeholder",children:W}),c.jsx(q.Icon,{className:"nk-select__icon",type:"chevron-down"})]}),O||_?c.jsxs("select",{ref:pe,"aria-hidden":"true",className:"nk-select__form-control",disabled:i,form:m,name:O,onChange:()=>{},onInvalid:e=>{var r;e.preventDefault(),(r=g.current)==null||r.focus()},required:_,tabIndex:-1,value:P,children:[c.jsx("option",{value:""}),v.map(e=>c.jsx("option",{disabled:e.disabled,value:e.value,children:e.label},e.value))]}):null,Q.present&&M?c.jsx(X.Portal,{children:c.jsx(Le,{active:p,align:s,closeOnEscape:a,closeOnOutsideInteraction:d,highlightedIndex:k,id:j,listboxReference:ae,onEscapeDismiss:be,onEscapeKeyDown:E,onHighlight:T,onOutsideDismiss:ye,onPointerDownOutside:V,onSelect:ee,options:v,ownerDocument:M,position:ue,selectedValue:P,state:Q.state==="closing"?"closing":"open",triggerReference:g})}):null]})}function Ce(t){const{"aria-invalid":n,children:s,className:o,defaultValue:a,disabled:d=!1,forwardedReference:u,invalid:i=!1,placeholder:f,style:m,value:y,...I}=t,x=U.resolveAriaInvalid(i,n),O=i||U.hasInvalidState(n);return c.jsxs("span",{className:["nk-select",o].filter(Boolean).join(" "),"data-disabled":d||void 0,"data-invalid":O||void 0,"data-mode":"native",style:m,children:[c.jsxs("select",{...I,ref:u,"aria-invalid":x,className:"nk-select__control",defaultValue:y===void 0?a??(f!==void 0?"":void 0):void 0,disabled:d,value:y,children:[f!==void 0?c.jsx("option",{disabled:!0,value:"",children:f}):null,s]}),c.jsx(q.Icon,{className:"nk-select__icon",type:"chevron-down"})]})}const Ne=l.forwardRef(function(n,s){const{options:o}=n;return Z.useBoundary("Select"),o!==void 0?c.jsx(Ae,{...n,forwardedReference:s}):c.jsx(Ce,{...n,forwardedReference:s})});exports.default=Ne;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),l=require("react"),Z=require("./effects-D98vUn6N.cjs"),U=require("./aria-DM-xYEHQ.cjs"),ge=require("./reference-C2guRuR0.cjs"),q=require("./Icon-CgQ62bgw.cjs"),X=require("./usePresence-Dm0mls5p.cjs"),se=require("./useAnchoredPosition-CrdY2Eat.cjs");function ke(t){const{form:n,onReset:s,resetValue:r,triggerReference:a}=t,d=l.useRef(null);return l.useEffect(()=>{var f;const u=(f=a.current)==null?void 0:f.form;if(!u)return;function o(){const m=d.current;if(m){const y=Array.from(m.options),I=y.find(x=>x.value===r)??y[0];y.forEach(x=>{x.defaultSelected=x===I})}s()}return u.addEventListener("reset",o),()=>u.removeEventListener("reset",o)},[n,s,r,a]),d}const H=8,B=4,we=160,Ee=72;function Re(t,n,s,r="start"){const a=s.bottom-t.bottom-B-H,d=t.top-s.top-B-H,u=a<we&&d>a,o=Math.max(Ee,u?d:a),f=Math.max(t.width,(n==null?void 0:n.width)??t.width),m=s.left+H,y=se.calculateAlignedPosition(r,t.left,t.width,f),I=Math.min(Math.max(m,y),Math.max(m,s.right-H-f)),x=u?Math.max(s.top+H,t.top-B-Math.min((n==null?void 0:n.height)??o,o)):t.bottom+B;return{left:I,maxHeight:o,minWidth:t.width,top:x}}function _e(t,n,s,r,a="start"){const d=l.useCallback(u=>{const{panelSize:o,triggerBounds:f,visibleBounds:m}=u;return Re(f,o,m,a)},[a]);return se.useAnchoredPosition({active:t,boundary:r,fit:d,panel:s,trigger:n})}const Oe=500;function De(t){const n=l.useRef(""),s=l.useRef(null),r=l.useRef(null);return l.useEffect(()=>()=>{const a=r.current;a&&s.current!==null&&a.clearTimeout(s.current)},[]),l.useCallback(a=>{var f;const d=(f=t.current)==null?void 0:f.ownerDocument.defaultView;if(!d)return null;r.current=d;const u=n.current+a,o=Array.from(u).every(m=>m===a);return n.current=o?a:u,s.current!==null&&d.clearTimeout(s.current),s.current=d.setTimeout(()=>{n.current="",s.current=null},Oe),n.current},[t])}function J(t,n,s){if(t.length===0)return-1;for(let r=1;r<=t.length;r+=1){const a=(n+s*r+t.length)%t.length;if(!t[a].disabled)return a}return-1}function je(t,n,s){for(let r=1;r<=t.length;r+=1){const a=(s+r+t.length)%t.length,d=t[a];if(!d.disabled&&d.label.toLocaleLowerCase().startsWith(n))return a}return-1}function Se(t){const n=new Set;t.forEach(s=>{if(n.has(s.value))throw new Error("Select option values must be unique");n.add(s.value)})}function Le(t){const{active:n,align:s,closeOnEscape:r,closeOnOutsideInteraction:a,highlightedIndex:d,id:u,listboxReference:o,onEscapeDismiss:f,onEscapeKeyDown:m,onHighlight:y,onOutsideDismiss:I,onPointerDownOutside:x,onSelect:O,options:D,ownerDocument:A,position:E,selectedValue:R,state:j,triggerReference:V}=t,v=l.useRef(null),W=Z.useBoundary("Select").boundaryElement,_=X.useOverlayLayer(!0,W),$=l.useMemo(()=>[V,v],[V]),G=l.useCallback(h=>{v.current=h,o(h)},[o]);return X.useDismissableLayer({active:n,boundaries:$,boundary:W,dismissOnEscape:r,dismissOnPointerDownOutside:a,layerId:_.id,onEscapeDismiss:f,onEscapeKeyDown:m,onPointerDownOutside:x,onPointerDownOutsideDismiss:I,ownerDocument:A}),c.jsx("div",{"aria-hidden":n?void 0:!0,"aria-labelledby":u,className:"nk-select__listbox","data-align":s,"data-state":j,id:`${u}-listbox`,ref:G,role:"listbox",style:E?{left:E.left,maxHeight:E.maxHeight,minWidth:E.minWidth,top:E.top,zIndex:_.zIndex}:{visibility:"hidden",zIndex:_.zIndex},children:D.map((h,C)=>c.jsxs("div",{"aria-disabled":h.disabled||void 0,"aria-selected":h.value===R,className:"nk-select__option","data-highlighted":C===d||void 0,"data-selected":h.value===R||void 0,id:`${u}-option-${C}`,onPointerDown:Y=>{Y.preventDefault(),h.disabled||O(h)},onPointerMove:()=>{h.disabled||y(C)},role:"option",children:[h.icon?c.jsx(q.Icon,{type:h.icon}):null,c.jsx("span",{className:"nk-select__option-label",children:h.label}),h.value===R?c.jsx(q.Icon,{className:"nk-select__check",type:"checkmark"}):null]},h.value))})}function Pe(t,n,s){n.current=t,ge.assignElementReference(s,t)}function Ae(t){var te;const{"aria-invalid":n,align:s="start",className:r,closeOnEscape:a=!0,closeOnOutsideInteraction:d=!0,defaultValue:u="",disabled:o=!1,displayOverride:f,form:m,forwardedReference:y,id:I,invalid:x=!1,name:O,onChange:D,onClick:A,onEscapeKeyDown:E,onKeyDown:R,onOpenChange:j,onPointerDownOutside:V,options:v,placeholder:W,required:_=!1,style:$,value:G,width:h,...C}=t;Se(v);const Y=l.useId(),S=I??Y,g=l.useRef(null),[N,ae]=l.useState(null),[p,le]=l.useState(!1),[k,T]=l.useState(-1),[oe,z]=l.useState(u),L=G!==void 0,P=L?G:oe,ie=v.find(e=>e.value===P),re=x||U.hasInvalidState(n),ce=U.resolveAriaInvalid(x,n),Q=X.usePresence(p),M=((te=g.current)==null?void 0:te.ownerDocument)??(typeof document>"u"?null:document),de=Z.useBoundary("Select").boundaryElement,ue=_e(Q.present,g.current,N,de,s),fe=De(g),me=h===void 0?$:{...$,width:h},K=f??ie,he=l.useCallback(e=>Pe(e,g,y),[y]),b=l.useCallback(e=>{p!==e&&(le(e),j==null||j(e))},[j,p]),ve=l.useCallback(()=>{L||z(u),b(!1)},[u,L,b]),pe=ke({form:m,onReset:ve,resetValue:L?P:u,triggerReference:g}),F=l.useCallback((e=1)=>{const i=v.findIndex(ne=>ne.value===P&&!ne.disabled),w=e===1?-1:v.length;T(i>=0?i:J(v,w,e)),b(!0)},[v,P,b]),ee=l.useCallback(e=>{var i;o||e.disabled||(L||z(e.value),b(!1),(i=g.current)==null||i.focus(),D==null||D(e.value))},[o,L,D,b]),be=l.useCallback(()=>{var e;b(!1),(e=g.current)==null||e.focus()},[b]),ye=l.useCallback(()=>{b(!1)},[b]);function xe(e){A==null||A(e),!(e.defaultPrevented||o)&&(p?b(!1):F())}function Ie(e){if(R==null||R(e),!(e.defaultPrevented||o)){if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const i=e.key==="ArrowDown"?1:-1;p?T(w=>J(v,w,i)):F(i);return}if(e.key==="Home"||e.key==="End"){if(e.preventDefault(),!p)F(e.key==="Home"?1:-1);else{const i=e.key==="Home"?1:-1,w=i===1?-1:v.length;T(J(v,w,i))}return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const i=v[k];p&&i?ee(i):p||F();return}if(e.key==="Tab"){b(!1);return}if(e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey){const i=fe(e.key.toLocaleLowerCase());if(i===null)return;const w=je(v,i,k);w>=0&&(e.preventDefault(),p||b(!0),T(w))}}}return l.useEffect(()=>{o&&b(!1)},[o,b]),l.useEffect(()=>{var e;if(p&&k>=0){const i=M==null?void 0:M.getElementById(`${S}-option-${k}`);i&&(N!=null&&N.contains(i))&&((e=i.scrollIntoView)==null||e.call(i,{block:"nearest"}))}},[k,S,N,p]),c.jsxs("span",{className:["nk-select",r].filter(Boolean).join(" "),"data-disabled":o||void 0,"data-invalid":re||void 0,"data-mode":"custom","data-open":p||void 0,style:me,children:[c.jsxs("button",{...C,ref:he,"aria-activedescendant":p&&k>=0?`${S}-option-${k}`:void 0,"aria-controls":`${S}-listbox`,"aria-expanded":p,"aria-haspopup":"listbox","aria-invalid":ce,"aria-required":_||void 0,"aria-autocomplete":"none",className:"nk-select__trigger",disabled:o,form:m,id:S,onClick:xe,onKeyDown:Ie,role:"combobox",type:"button",children:[K?c.jsxs("span",{className:"nk-select__value",children:[K.icon?c.jsx(q.Icon,{type:K.icon}):null,c.jsx("span",{className:"nk-select__value-label",children:K.label})]}):c.jsx("span",{className:"nk-select__placeholder",children:W}),c.jsx(q.Icon,{className:"nk-select__icon",type:"chevron-down"})]}),O||_?c.jsxs("select",{ref:pe,"aria-hidden":"true",className:"nk-select__form-control",disabled:o,form:m,name:O,onChange:()=>{},onInvalid:e=>{var i;e.preventDefault(),(i=g.current)==null||i.focus()},required:_,tabIndex:-1,value:P,children:[c.jsx("option",{value:""}),v.map(e=>c.jsx("option",{disabled:e.disabled,value:e.value,children:e.label},e.value))]}):null,Q.present&&M?c.jsx(X.Portal,{children:c.jsx(Le,{active:p,align:s,closeOnEscape:a,closeOnOutsideInteraction:d,highlightedIndex:k,id:S,listboxReference:ae,onEscapeDismiss:be,onEscapeKeyDown:E,onHighlight:T,onOutsideDismiss:ye,onPointerDownOutside:V,onSelect:ee,options:v,ownerDocument:M,position:ue,selectedValue:P,state:Q.state==="closing"?"closing":"open",triggerReference:g})}):null]})}function Ce(t){const{"aria-invalid":n,children:s,className:r,defaultValue:a,disabled:d=!1,forwardedReference:u,invalid:o=!1,placeholder:f,style:m,value:y,...I}=t,x=U.resolveAriaInvalid(o,n),O=o||U.hasInvalidState(n);return c.jsxs("span",{className:["nk-select",r].filter(Boolean).join(" "),"data-disabled":d||void 0,"data-invalid":O||void 0,"data-mode":"native",style:m,children:[c.jsxs("select",{...I,ref:u,"aria-invalid":x,className:"nk-select__control",defaultValue:y===void 0?a??(f!==void 0?"":void 0):void 0,disabled:d,value:y,children:[f!==void 0?c.jsx("option",{disabled:!0,value:"",children:f}):null,s]}),c.jsx(q.Icon,{className:"nk-select__icon",type:"chevron-down"})]})}const Ne=l.forwardRef(function(n,s){const{options:r}=n;return Z.useBoundary("Select"),r!==void 0?c.jsx(Ae,{...n,forwardedReference:s}):c.jsx(Ce,{...n,forwardedReference:s})});exports.default=Ne;