maudocs 1.0.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 ADDED
@@ -0,0 +1,99 @@
1
+ # Create Tailwind Docs CLI 🚀
2
+
3
+ Công cụ dòng lệnh (CLI) giúp khởi tạo nhanh một file template tài liệu (Documentation Template) tuyệt đẹp, hiện đại bằng **HTML** và **Tailwind CSS CDN**. Template này được thiết kế tối ưu, có sẵn chế độ Sáng/Tối (Light/Dark mode), mục lục động (Table of Contents), responsive đầy đủ và có các block mẫu kèm thẻ chú thích giúp **AI Agent** dễ dàng điền dữ liệu tự động.
4
+
5
+ ---
6
+
7
+ ## 💻 Cách sử dụng
8
+
9
+ ### 1. Sử dụng tức thì qua NPX (Không cần cài đặt)
10
+
11
+ Di chuyển đến thư mục dự án của bạn và chạy lệnh sau:
12
+
13
+ ```bash
14
+ npx create-tailwind-docs
15
+ ```
16
+
17
+ Lệnh này sẽ tạo ra một file `index.html` trong thư mục hiện tại của bạn.
18
+
19
+ ### 2. Tạo với tên file tùy chỉnh
20
+
21
+ Nếu bạn muốn đặt tên file khác thay vì `index.html`:
22
+
23
+ ```bash
24
+ npx create-tailwind-docs my-docs.html
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 🤖 Hướng dẫn tích hợp với AI Agent
30
+
31
+ Template này được chèn sẵn các comment mốc định danh (Anchor Comments). Bạn có thể cấu hình Prompt cho AI Agent của mình tìm các mốc này để điền dữ liệu tự động:
32
+
33
+ ### 1. Thêm liên kết vào Sidebar (Menu bên trái)
34
+ AI sẽ chèn các liên kết điều hướng vào giữa hai thẻ comment sau:
35
+ ```html
36
+ <!-- AI_AGENT:SIDEBAR_NAVIGATION_START -->
37
+ <!-- Nội dung sidebar do AI tự tạo sẽ nằm ở đây -->
38
+ <!-- AI_AGENT:SIDEBAR_NAVIGATION_END -->
39
+ ```
40
+
41
+ ### 2. Thêm nội dung chi tiết (Cột giữa)
42
+ AI sẽ chèn các thẻ `<section id="id-cua-ban">` vào bên dưới thẻ:
43
+ ```html
44
+ <!-- AI_AGENT:MAIN_CONTENT_START -->
45
+ <!-- Các khối tài liệu, bảng biểu, code do AI tự tạo nằm ở đây -->
46
+ <!-- AI_AGENT:MAIN_CONTENT_END -->
47
+ ```
48
+
49
+ *Lưu ý:* Các AI agent có thể tham khảo trực tiếp cấu trúc HTML của các **Block UI mẫu** (Alert, Code block, Table, Steps, Cards) đã được viết sẵn trong file để sao chép chuẩn class Tailwind CSS.
50
+
51
+ ---
52
+
53
+ ## 📦 Hướng dẫn đẩy lên GitHub & Publish NPM OSS
54
+
55
+ ### 1. Đưa lên GitHub & Bật Web chạy thử (GitHub Pages)
56
+
57
+ 1. Tạo một Repository mới trên GitHub.
58
+ 2. Khởi tạo Git cục bộ trong thư mục chứa code và đẩy lên GitHub:
59
+ ```bash
60
+ git init
61
+ git add .
62
+ git commit -m "Initial commit"
63
+ git branch -M main
64
+ git remote add origin <URL-REPO-CUA-BAN>
65
+ git push -u origin main
66
+ ```
67
+ 3. Truy cập vào GitHub Repo của bạn trên trình duyệt -> Chọn **Settings** -> **Pages**.
68
+ 4. Tại mục **Build and deployment** -> **Source**: Chọn `Deploy from a branch`.
69
+ 5. Tại mục **Branch**: Chọn `main` (hoặc `/root`) -> Nhấn **Save**.
70
+ 6. Sau 1-2 phút, GitHub sẽ cấp cho bạn một đường link HTTPS để mọi người có thể xem giao diện trực tuyến.
71
+
72
+ ### 2. Phát hành lên NPM dưới dạng Package mã nguồn mở (OSS)
73
+
74
+ Để bất cứ ai cũng có thể chạy lệnh `npx <ten-package-cua-ban>` để cài đặt, bạn làm như sau:
75
+
76
+ 1. Đăng ký tài khoản trên trang chủ [npmjs.com](https://www.npmjs.com/).
77
+ 2. Mở terminal tại thư mục dự án và đăng nhập:
78
+ ```bash
79
+ npm login
80
+ ```
81
+ *(Làm theo hướng dẫn trên màn hình để nhập tài khoản/mật khẩu/OTP)*
82
+ 3. Đổi tên package trong file `package.json` ở trường `"name"` thành tên độc nhất (ví dụ: `create-yourname-docs`).
83
+ 4. Xuất bản package lên NPM:
84
+ ```bash
85
+ npm publish --access public
86
+ ```
87
+ 5. Kể từ lúc này, mọi người đã có thể khởi tạo file docs bằng lệnh:
88
+ ```bash
89
+ npx <ten-package-cua-ban>
90
+ ```
91
+
92
+ ---
93
+
94
+ ## 🎨 Các tính năng giao diện có sẵn
95
+
96
+ - **Dark Mode**: Nhớ trạng thái lựa chọn qua `localStorage`.
97
+ - **Responsive Navigation**: Menu Hamburger trên mobile, tự động ẩn cột TOC bên phải ở màn hình nhỏ.
98
+ - **Copy Code**: Nút copy hoạt động mượt mà cho mọi khối code.
99
+ - **Table of Contents (TOC)**: Tự động quét các thẻ tiêu đề của bài viết để sinh mục lục bên phải, tự động highlight link khi cuộn trang (ScrollSpy).
package/bin/cli.js ADDED
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ // ANSI escape codes for styling console output
7
+ const styles = {
8
+ reset: '\x1b[0m',
9
+ bold: '\x1b[1m',
10
+ green: '\x1b[32m',
11
+ yellow: '\x1b[33m',
12
+ blue: '\x1b[34m',
13
+ cyan: '\x1b[36m',
14
+ red: '\x1b[31m',
15
+ };
16
+
17
+ console.log(`\n${styles.bold}${styles.blue}=== Create MauDocs CLI ===${styles.reset}\n`);
18
+
19
+ // Default parameters
20
+ let fileName = 'index.html';
21
+ let folderName = 'docs';
22
+
23
+ // Parse arguments
24
+ const args = process.argv.slice(2);
25
+ args.forEach(arg => {
26
+ if (arg.startsWith('--')) {
27
+ // Flag specifies the folder name, e.g. --my-guide
28
+ folderName = arg.slice(2);
29
+ } else if (!arg.startsWith('-')) {
30
+ // Positional argument specifies the file name, e.g. test.html
31
+ fileName = arg;
32
+ }
33
+ });
34
+
35
+ // Resolve paths
36
+ const destDir = path.resolve(process.cwd(), folderName);
37
+ const destFilePath = path.join(destDir, fileName);
38
+ const templatePath = path.join(__dirname, '../template/index.html');
39
+
40
+ // Verify template exists
41
+ if (!fs.existsSync(templatePath)) {
42
+ console.error(`${styles.red}❌ Error: Template file not found at ${templatePath}${styles.reset}`);
43
+ process.exit(1);
44
+ }
45
+
46
+ // Create destination directory if it doesn't exist
47
+ if (!fs.existsSync(destDir)) {
48
+ fs.mkdirSync(destDir, { recursive: true });
49
+ }
50
+
51
+ // Check if destination file already exists
52
+ if (fs.existsSync(destFilePath)) {
53
+ console.log(`${styles.yellow}⚠️ Warning: File "${fileName}" already exists in the directory "${folderName}".${styles.reset}`);
54
+ console.log(`If you want to overwrite it, please delete or rename it first.`);
55
+ console.log(`Or run: ${styles.cyan}npx create-maudocs custom-name.html --custom-folder${styles.reset} to use different names.\n`);
56
+ process.exit(0);
57
+ }
58
+
59
+ try {
60
+ console.log(`Reading template source...`);
61
+ let htmlContent = fs.readFileSync(templatePath, 'utf8');
62
+
63
+ // Replace local script reference with the jsDelivr CDN link pointing to your repository
64
+ const cdnUrl = 'https://cdn.jsdelivr.net/gh/mankhb2k/maudocs@main/template/components.js';
65
+ console.log(`Injecting CDN script: ${styles.cyan}${cdnUrl}${styles.reset}...`);
66
+ htmlContent = htmlContent.replace(
67
+ '<script src="components.js"></script>',
68
+ `<script src="${cdnUrl}"></script>`
69
+ );
70
+
71
+ console.log(`Writing template file to: ${styles.cyan}${destFilePath}${styles.reset}...`);
72
+ fs.writeFileSync(destFilePath, htmlContent, 'utf8');
73
+
74
+ console.log(`\n${styles.green}✨ Success! Beautiful MauDocs template created successfully in "${folderName}/"!${styles.reset}`);
75
+ console.log(`\n${styles.bold}How to use:${styles.reset}`);
76
+ console.log(` 1. Open ${styles.cyan}${folderName}/${fileName}${styles.reset} directly in your browser to view.`);
77
+ console.log(` 2. Share the file or push it to GitHub Pages.`);
78
+ console.log(` 3. Have your AI agent insert content between the comment tags:\n`);
79
+ console.log(` - ${styles.bold}Sidebar Links:${styles.reset} between ${styles.cyan}<!-- AI_AGENT:SIDEBAR_NAVIGATION_START -->${styles.reset} and ${styles.cyan}<!-- ..._END -->${styles.reset}`);
80
+ console.log(` - ${styles.bold}Main Content:${styles.reset} between ${styles.cyan}<!-- AI_AGENT:MAIN_CONTENT_START -->${styles.reset} and ${styles.cyan}<!-- ..._END -->${styles.reset}`);
81
+ console.log(`\nEnjoy building! 🚀\n`);
82
+ } catch (error) {
83
+ console.error(`${styles.red}❌ Error writing files: ${error.message}${styles.reset}`);
84
+ process.exit(1);
85
+ }
Binary file
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "maudocs",
3
+ "version": "1.0.0",
4
+ "description": "A CLI tool to scaffold a beautiful, responsive HTML documentation template using Tailwind CSS CDN.",
5
+ "main": "bin/cli.js",
6
+ "bin": {
7
+ "create-maudocs": "./bin/cli.js"
8
+ },
9
+ "scripts": {
10
+ "build": "vite build",
11
+ "test": "echo \"Error: no test specified\" && exit 0"
12
+ },
13
+ "keywords": [
14
+ "tailwind",
15
+ "docs",
16
+ "template",
17
+ "cli",
18
+ "scaffold",
19
+ "documentation",
20
+ "ai-agent"
21
+ ],
22
+ "author": "",
23
+ "license": "MIT",
24
+ "engines": {
25
+ "node": ">=12.0.0"
26
+ },
27
+ "dependencies": {
28
+ "preact": "^10.29.2",
29
+ "preact-custom-element": "^4.6.0"
30
+ },
31
+ "devDependencies": {
32
+ "@preact/preset-vite": "^2.10.5",
33
+ "vite": "^8.0.14"
34
+ }
35
+ }
@@ -0,0 +1 @@
1
+ var DevDocs=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(e,n,r){var i,a,o,s={};for(o in n)o==`key`?i=n[o]:o==`ref`?a=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?t.call(arguments,2):r),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return S(e,s,i,a,null)}function S(e,t,i,a,o){var s={type:e,props:t,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++r,__i:-1,__u:0};return o==null&&n.vnode!=null&&n.vnode(s),s}function C(e){return e.children}function w(e,t){this.props=e,this.context=t}function T(e,t){if(t==null)return e.__?T(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?T(e):null}function E(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],a=[],o=y({},t);o.__v=t.__v+1,n.vnode&&n.vnode(o),P(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,i,r??T(t),!!(32&t.__u),a),o.__v=t.__v,o.__.__k[o.__i]=o,re(i,o,a),t.__e=t.__=null,o.__e!=r&&D(o)}}function D(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),D(e)}function O(e){(!e.__d&&(e.__d=!0)&&i.push(e)&&!k.__r++||a!=n.debounceRendering)&&((a=n.debounceRendering)||o)(k)}function k(){try{for(var e,t=1;i.length;)i.length>t&&i.sort(s),e=i.shift(),t=i.length,E(e)}finally{i.length=k.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y,b=r&&r.__k||g,x=t.length;for(c=A(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||h,p.__i=d,v=P(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&I(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_==null&&m!=null&&(_=m),(y=!!(4&p.__u))||f.__k===p.__k?(c=j(p,c,e,y),y&&f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=S(null,o,null,null,null):v(o)?o=e.__k[a]=S(C,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=S(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=M(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=T(s)),oe(s,s));return r}function j(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=j(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=T(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function te(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||_.test(t)?n:n+`px`}function N(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||te(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||te(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[u]=r[u]:(n[u]=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ne(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t[l]==null)t[l]=f++;else if(t[l]<r[u])return;return r(n.event?n.event(t):t)}}}function P(e,t,r,i,a,o,s,c,l,u){var d,f,p,m,h,_,x,S,T,E,D,O,k,A,j,M=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[c=t.__e=r.__e]),(d=n.__b)&&d(t);n:if(typeof M==`function`)try{if(S=t.props,T=M.prototype&&M.prototype.render,E=(d=M.contextType)&&i[d.__c],D=d?E?E.props.value:d.__:i,r.__c?x=(f=t.__c=r.__c).__=f.__E:(T?t.__c=f=new M(S,D):(t.__c=f=new w(S,D),f.constructor=M,f.render=se),E&&E.sub(f),f.state||={},f.__n=i,p=f.__d=!0,f.__h=[],f._sb=[]),T&&f.__s==null&&(f.__s=f.state),T&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=y({},f.__s)),y(f.__s,M.getDerivedStateFromProps(S,f.__s))),m=f.props,h=f.state,f.__v=t,p)T&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),T&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(T&&M.getDerivedStateFromProps==null&&S!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(S,D),t.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(S,f.__s,D)){t.__v!=r.__v&&(f.props=S,f.state=f.__s,f.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(S,f.__s,D),T&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,_)})}if(f.context=D,f.props=S,f.__P=e,f.__e=!1,O=n.__r,k=0,T)f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),g.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(i=y(y({},i),f.getChildContext())),T&&!p&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(m,h)),A=d!=null&&d.type===C&&d.key==null?ie(d.props.children):d,c=ee(e,v(A)?A:[A],t,r,i,a,o,s,c,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&s.push(f),x&&(f.__E=f.__=null)}catch(e){if(t.__v=null,l||o!=null)if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else{for(j=o.length;j--;)b(o[j]);F(t)}else t.__e=r.__e,t.__k=r.__k,e.then||F(t);n.__e(e,t,r)}else o==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):c=t.__e=ae(r.__e,t,r,i,a,o,s,l,u);return(d=n.diffed)&&d(t),128&t.__u?void 0:c}function F(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(F))}function re(e,t,r){for(var i=0;i<r.length;i++)I(r[i],r[++i],r[++i]);n.__c&&n.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n.__e(e,t.__v)}})}function ie(e){return typeof e!=`object`||!e||e.__b>0?e:v(e)?e.map(ie):e.constructor===void 0?y({},e):null}function ae(e,r,i,a,o,s,c,l,u){var d,f,p,m,g,_,y,x=i.props||h,S=r.props,C=r.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){e=g,s[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(S);e=document.createElementNS(o,C,S.is&&S),l&&=(n.__m&&n.__m(r,s),!1),s=null}if(C==null)x===S||l&&e.data==S||(e.data=S);else{if(s=C==`textarea`&&S.defaultValue!=null?null:s&&t.call(e.childNodes),!l&&s!=null)for(x={},d=0;d<e.attributes.length;d++)x[(g=e.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||N(e,d,null,g,o);for(d in S)g=S[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?_=g:d==`checked`?y=g:l&&typeof g!=`function`||x[d]===g||N(e,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),r.__k=[];else if(p&&(e.innerHTML=``),ee(r.type==`template`?e.content:e,v(m)?m:[m],r,i,a,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:i.__k&&T(i,0),l,u),s!=null)for(d=s.length;d--;)b(s[d]);l&&C!=`textarea`||(d=`value`,C==`progress`&&_==null?e.removeAttribute(`value`):_!=null&&(_!==e[d]||C==`progress`&&!_||C==`option`&&_!=x[d])&&N(e,d,_,x[d],o),d=`checked`,y!=null&&y!=e[d]&&N(e,d,y,x[d],o))}return e}function I(e,t,r){try{if(typeof e==`function`){var i=typeof e.__u==`function`;i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(e){n.__e(e,r)}}function oe(e,t,r){var i,a;if(n.unmount&&n.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||I(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&oe(i[a],t,r||typeof e.type!=`function`);r||b(e.__e),e.__c=e.__=e.__e=void 0}function se(e,t,n){return this.constructor(e,n)}function L(e,r,i){var a,o,s,c;r==document&&(r=document.documentElement),n.__&&n.__(e,r),o=(a=typeof i==`function`)?null:i&&i.__k||r.__k,s=[],c=[],P(r,e=(!a&&i||r).__k=x(C,null,[e]),o||h,h,r.namespaceURI,!a&&i?[i]:o?null:r.firstChild?t.call(r.childNodes):null,s,!a&&i?i:o?o.__e:r.firstChild,a,c),re(s,e,c)}function ce(e,t){L(e,t,ce)}function le(e,n,r){var i,a,o,s,c=y({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),n)o==`key`?i=n[o]:o==`ref`?a=n[o]:c[o]=n[o]===void 0&&s!=null?s[o]:n[o];return arguments.length>2&&(c.children=arguments.length>3?t.call(arguments,2):r),S(e.type,c,i||e.key,a||e.ref,null)}t=g.slice,n={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},r=0,w.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=y({},this.state);typeof e==`function`&&(e=e(y({},n),this.props)),e&&y(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),O(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),O(this))},w.prototype.render=C,i=[],o=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,s=function(e,t){return e.__v.__b-t.__v.__b},k.__r=0,c=Math.random().toString(8),l=`__d`+c,u=`__a`+c,d=/(PointerCapture)$|Capture$/i,f=0,p=ne(!1),m=ne(!0);function R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},R.apply(this,arguments)}function ue(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var de=[`context`,`children`],fe=[`useFragment`];function z(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){me.call(this,r)},i.prototype.attributeChangedCallback=ge,i.prototype.disconnectedCallback=_e,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function pe(e){this.getChildContext=function(){return e.context};var t=e.children;return le(t,ue(e,de))}function me(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=x(pe,R({},this._props,{context:t.detail.context}),ye(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?ce:L)(this._vdom,this._root)}function he(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function ge(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[he(e)]=n,this._vdom=le(this._vdom,r),L(this._vdom,this._root)}}function _e(){L(this._vdom=null,this._root)}function ve(e,t){var n=this,r=e.useFragment,i=ue(e,fe);return x(r?C:`slot`,R({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function ye(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[he(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=ye(s[a],null,n),l=s[a].slot;l?i[l]=x(ve,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?x(ve,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),x(t||e.nodeName.toLowerCase(),i,d)}var B,V,H,be,U=0,xe=[],W=n,Se=W.__b,Ce=W.__r,we=W.diffed,Te=W.__c,Ee=W.unmount,De=W.__;function Oe(e,t){W.__h&&W.__h(V,e,U||t),U=0;var n=V.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function G(e){return U=1,ke(Fe,e)}function ke(e,t,n){var r=Oe(B++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Fe(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=V,!V.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};V.__f=!0;var a=V.shouldComponentUpdate,o=V.componentWillUpdate;V.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},V.shouldComponentUpdate=i}return r.__N||r.__}function Ae(e,t){var n=Oe(B++,3);!W.__s&&Pe(n.__H,t)&&(n.__=e,n.u=t,V.__H.__h.push(n))}function je(){for(var e;e=xe.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(K),t.__h.some(q),t.__h=[]}catch(n){t.__h=[],W.__e(n,e.__v)}}}W.__b=function(e){V=null,Se&&Se(e)},W.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),De&&De(e,t)},W.__r=function(e){Ce&&Ce(e),B=0;var t=(V=e.__c).__H;t&&(H===V?(t.__h=[],V.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(K),t.__h.some(q),t.__h=[],B=0)),H=V},W.diffed=function(e){we&&we(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(xe.push(t)!==1&&be===W.requestAnimationFrame||((be=W.requestAnimationFrame)||Ne)(je)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),H=V=null},W.__c=function(e,t){t.some(function(e){try{e.__h.some(K),e.__h=e.__h.filter(function(e){return!e.__||q(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],W.__e(n,e.__v)}}),Te&&Te(e,t)},W.unmount=function(e){Ee&&Ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{K(e)}catch(e){t=e}}),n.__H=void 0,t&&W.__e(t,n.__v))};var Me=typeof requestAnimationFrame==`function`;function Ne(e){var t,n=function(){clearTimeout(r),Me&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Me&&(t=requestAnimationFrame(n))}function K(e){var t=V,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),V=t}function q(e){var t=V;e.__c=e.__(),V=t}function Pe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Fe(e,t){return typeof t==`function`?t(e):t}var Ie=0;Array.isArray;function J(e,t,r,i,a,o){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ie,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return n.vnode&&n.vnode(u),u}function Y({type:e=`info`,title:t=``,dismissible:n=!1,className:r=``,icon:i=null,children:a}){let[o,s]=G(!0);if(!o)return null;let c=`border-blue-100 dark:border-blue-900/30`,l=`bg-blue-50/40 dark:bg-blue-950/10`,u=`text-blue-900 dark:text-blue-200`,d=`text-blue-600 dark:text-blue-400`,f=`info`,p=n===!0||n===`true`||n===``;switch(e){case`warning`:c=`border-amber-100 dark:border-amber-900/30`,l=`bg-amber-50/40 dark:bg-amber-950/10`,u=`text-amber-900 dark:text-amber-200`,d=`text-amber-600 dark:text-amber-400`,f=`alert-triangle`;break;case`success`:c=`border-emerald-100 dark:border-emerald-900/30`,l=`bg-emerald-50/40 dark:bg-emerald-950/10`,u=`text-emerald-900 dark:text-emerald-200`,d=`text-emerald-600 dark:text-emerald-400`,f=`check-circle-2`;break;case`danger`:case`error`:c=`border-red-100 dark:border-red-900/30`,l=`bg-red-50/40 dark:bg-red-950/10`,u=`text-red-900 dark:text-red-200`,d=`text-red-600 dark:text-red-400`,f=`x-circle`;break}let m=i||f;return window.lucide&&typeof window.lucide.createIcons==`function`&&setTimeout(()=>window.lucide.createIcons(),0),J(`div`,{className:`block my-4 transition-all duration-300 ${r}`,children:J(`div`,{className:`relative flex gap-3 p-4 rounded-xl border ${c} ${l} ${u}`,children:[J(`i`,{"data-lucide":m,className:`w-5 h-5 ${d} shrink-0 mt-0.5`}),J(`div`,{className:`text-sm flex-1`,children:[t&&J(`span`,{className:`font-semibold block mb-0.5`,children:t}),J(`div`,{className:`leading-relaxed content-area`,children:typeof a==`string`?J(`span`,{dangerouslySetInnerHTML:{__html:a}}):a})]}),p&&J(`button`,{onClick:()=>s(!1),className:`close-btn p-1 -mt-1 -mr-1 rounded-lg text-current hover:bg-black/5 dark:hover:bg-white/5 opacity-60 hover:opacity-100 self-start transition-all`,"aria-label":`Close Alert`,children:J(`i`,{"data-lucide":`x`,className:`w-4 h-4`})})]})})}function X({title:e=``,open:t=!1,children:n}){let[r,i]=G(t===!0||t===`true`||t===``);return window.lucide&&typeof window.lucide.createIcons==`function`&&setTimeout(()=>window.lucide.createIcons(),0),J(`div`,{className:`border border-slate-200 dark:border-slate-800/80 rounded-xl overflow-hidden bg-white dark:bg-slate-900 transition-all duration-300 my-2`,children:[J(`button`,{onClick:()=>i(!r),className:`w-full flex items-center justify-between p-4 text-left font-semibold text-sm text-slate-900 dark:text-white hover:bg-slate-50 dark:hover:bg-slate-800/40 transition-colors focus:outline-none`,"aria-expanded":r,children:[J(`span`,{children:e}),J(`i`,{"data-lucide":`chevron-down`,className:`w-4 h-4 text-slate-500 dark:text-slate-400 transition-transform duration-300 shrink-0 ${r?`rotate-180`:``}`})]}),J(`div`,{className:`transition-all duration-350 ease-in-out overflow-hidden ${r?`max-h-[1000px] border-t border-slate-100 dark:border-slate-800/40`:`max-h-0`}`,children:J(`div`,{className:`p-4 text-sm text-slate-600 dark:text-slate-400 leading-relaxed content-area`,children:typeof n==`string`?J(`span`,{dangerouslySetInnerHTML:{__html:n}}):n})})]})}function Z({language:e=`plaintext`,code:t=``}){let[n,r]=G(!1);return window.lucide&&typeof window.lucide.createIcons==`function`&&setTimeout(()=>window.lucide.createIcons(),0),J(`div`,{className:`relative group my-4 rounded-xl overflow-hidden border border-slate-800 bg-slate-950 text-slate-200 font-mono text-sm shadow-md`,children:[J(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-slate-900 bg-slate-900/60 text-xs text-slate-400 select-none`,children:[J(`span`,{className:`font-semibold uppercase tracking-wider`,children:e}),J(`button`,{onClick:async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){console.error(`Failed to copy text: `,e)}},className:`flex items-center gap-1.5 px-2 py-1 rounded bg-slate-800 hover:bg-slate-700 active:bg-slate-800 text-slate-350 hover:text-white transition-all focus:outline-none`,children:[J(`i`,{"data-lucide":n?`check`:`copy`,className:`w-3.5 h-3.5`}),J(`span`,{children:n?`Copied!`:`Copy`})]})]}),J(`pre`,{className:`p-4 overflow-x-auto m-0 leading-relaxed font-mono text-xs sm:text-sm`,children:J(`code`,{children:t})})]})}function Q({logoText:e=`Dev`,logoHighlight:t=`Docs`,logoHref:n=`#`,githubUrl:r=`https://github.com`,searchPlaceholder:i=`Tìm kiếm tài liệu...`}){let[a,o]=G(!1);return Ae(()=>{o(document.documentElement.classList.contains(`dark`))},[]),window.lucide&&typeof window.lucide.createIcons==`function`&&setTimeout(()=>window.lucide.createIcons(),0),J(`header`,{className:`sticky top-0 z-40 w-full border-b border-slate-200/80 bg-white/80 backdrop-blur-md dark:border-slate-800/80 dark:bg-slate-900/80 transition-colors duration-200`,children:J(`div`,{className:`max-w-[90rem] mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between gap-4`,children:[J(`div`,{className:`flex items-center gap-3`,children:[J(`button`,{onClick:()=>{let e=document.getElementById(`sidebar`),t=document.getElementById(`sidebar-backdrop`);e&&e.classList.remove(`-translate-x-full`),t&&t.classList.remove(`hidden`)},id:`mobile-sidebar-toggle`,className:`p-2 -ml-2 rounded-lg text-slate-500 hover:text-slate-800 hover:bg-slate-100 dark:text-slate-400 dark:hover:text-slate-200 dark:hover:bg-slate-800 md:hidden transition-colors`,"aria-label":`Toggle navigation`,children:J(`i`,{"data-lucide":`menu`,className:`w-6 h-6`})}),J(`a`,{href:n,className:`flex items-center gap-2.5 font-bold text-lg tracking-tight text-slate-900 dark:text-white`,children:[J(`div`,{className:`w-8 h-8 rounded-lg bg-gradient-to-tr from-brand-600 to-indigo-500 flex items-center justify-center text-white shadow-md shadow-brand-500/20`,children:J(`i`,{"data-lucide":`book-open`,className:`w-4.5 h-4.5`})}),J(`span`,{children:[e,J(`span`,{className:`text-brand-600 dark:text-brand-400`,children:t})]})]})]}),J(`div`,{className:`hidden sm:flex flex-1 max-w-md relative`,children:[J(`div`,{className:`pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3`,children:J(`i`,{"data-lucide":`search`,className:`h-4 w-4 text-slate-400`})}),J(`input`,{type:`text`,id:`search-input`,placeholder:i,className:`w-full rounded-full border border-slate-200 bg-slate-50/50 py-1.5 pl-9 pr-4 text-sm text-slate-900 placeholder-slate-400 focus:border-brand-500 focus:bg-white focus:outline-none focus:ring-2 focus:ring-brand-500/20 dark:border-slate-800 dark:bg-slate-900/50 dark:text-slate-100 dark:placeholder-slate-500 dark:focus:bg-slate-900 transition-all`}),J(`div`,{className:`absolute inset-y-0 right-0 flex items-center pr-3`,children:J(`kbd`,{className:`hidden md:inline-block rounded border border-slate-200 bg-white px-1.5 font-mono text-[10px] font-medium text-slate-400 dark:border-slate-800 dark:bg-slate-900`,children:`Ctrl K`})})]}),J(`div`,{className:`flex items-center gap-2`,children:[J(`button`,{onClick:()=>{let e=!a;o(e),e?(document.documentElement.classList.add(`dark`),localStorage.setItem(`color-theme`,`dark`)):(document.documentElement.classList.remove(`dark`),localStorage.setItem(`color-theme`,`light`)),window.myChart&&(window.myChart.options.plugins.legend.labels.color=e?`#cbd5e1`:`#334155`,window.myChart.options.scales.y.grid.color=e?`#334155`:`#e2e8f0`,window.myChart.options.scales.y.ticks.color=e?`#cbd5e1`:`#334155`,window.myChart.options.scales.x.ticks.color=e?`#cbd5e1`:`#334155`,window.myChart.update()),window.mermaid!==void 0&&typeof window.renderMermaid==`function`&&window.renderMermaid()},className:`p-2.5 rounded-full text-slate-500 hover:text-slate-800 hover:bg-slate-100 dark:text-slate-400 dark:hover:text-slate-200 dark:hover:bg-slate-800 transition-all`,"aria-label":`Toggle dark mode`,children:a?J(`i`,{"data-lucide":`sun`,className:`w-5 h-5`}):J(`i`,{"data-lucide":`moon`,className:`w-5 h-5`})}),J(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 rounded-full text-slate-500 hover:text-slate-800 hover:bg-slate-100 dark:text-slate-400 dark:hover:text-slate-200 dark:hover:bg-slate-800 transition-all`,"aria-label":`GitHub`,children:J(`i`,{"data-lucide":`github`,className:`w-5 h-5`})})]})]})})}function $({mobileTitle:e=`Điều hướng`,searchPlaceholder:t=`Tìm kiếm...`,children:n}){window.lucide&&typeof window.lucide.createIcons==`function`&&setTimeout(()=>window.lucide.createIcons(),0);let r=()=>{let e=document.getElementById(`sidebar`),t=document.getElementById(`sidebar-backdrop`);e&&e.classList.add(`-translate-x-full`),t&&t.classList.add(`hidden`)};return Ae(()=>{let e=e=>{e.target.closest(`.nav-link`)&&r()};return document.addEventListener(`click`,e),()=>{document.removeEventListener(`click`,e)}},[]),J(C,{children:[J(`div`,{id:`sidebar-backdrop`,onClick:r,className:`fixed inset-0 z-30 bg-slate-900/40 backdrop-blur-sm hidden md:hidden`}),J(`aside`,{id:`sidebar`,className:`fixed inset-y-0 left-0 z-30 w-64 bg-white border-r border-slate-200 dark:bg-slate-900 dark:border-slate-800 transform -translate-x-full md:translate-x-0 md:static md:z-0 md:h-[calc(100vh-4rem)] md:sticky md:top-16 transition-all duration-200 overflow-y-auto p-6 flex flex-col gap-6`,children:[J(`div`,{className:`flex items-center justify-between md:hidden pb-2 border-b border-slate-100 dark:border-slate-800`,children:[J(`span`,{className:`font-bold text-slate-900 dark:text-white`,children:e}),J(`button`,{onClick:r,id:`mobile-sidebar-close`,className:`p-1 rounded-lg text-slate-500 hover:bg-slate-100 dark:hover:bg-slate-800`,children:J(`i`,{"data-lucide":`x`,className:`w-5 h-5`})})]}),J(`div`,{className:`sm:hidden relative`,children:[J(`i`,{"data-lucide":`search`,className:`absolute left-3 top-2.5 h-4 w-4 text-slate-400`}),J(`input`,{type:`text`,placeholder:t,className:`w-full rounded-lg border border-slate-200 bg-slate-50/50 py-2 pl-9 pr-4 text-sm focus:outline-none dark:border-slate-800 dark:bg-slate-900`})]}),J(`nav`,{className:`flex-1 flex flex-col gap-6 text-sm`,children:typeof n==`string`?J(`div`,{dangerouslySetInnerHTML:{__html:n},className:`contents`}):n})]})]})}return z(Y,`mau-alert`,[`type`,`title`,`dismissible`,`className`,`icon`],{shadow:!1}),z(X,`mau-accordion`,[`title`,`open`],{shadow:!1}),z(Z,`mau-code-block`,[`language`,`code`],{shadow:!1}),z(Q,`mau-header`,[`logoText`,`logoHighlight`,`logoHref`,`githubUrl`,`searchPlaceholder`],{shadow:!1}),z($,`mau-sidebar`,[`mobileTitle`,`searchPlaceholder`],{shadow:!1}),window.DevDocs={Alert:e=>{let t=document.createElement(`div`);return L(x(Y,{...e}),t),t.firstElementChild||t},Accordion:e=>{let t=document.createElement(`div`);return L(x(X,e),t),t.firstElementChild||t},CodeBlock:e=>{let t=document.createElement(`div`);return L(x(Z,e),t),t.firstElementChild||t},Header:e=>{let t=document.createElement(`div`);return L(x(Q,e),t),t.firstElementChild||t},Sidebar:e=>{let t=document.createElement(`div`);return L(x($,e),t),t.firstElementChild||t}},e.Accordion=X,e.Alert=Y,e.CodeBlock=Z,e.Header=Q,e.Sidebar=$,e})({});