UNPKG

htmldocs

Version:

<h1 align="center"> <img src="https://github.com/user-attachments/assets/655fa7f9-98e7-42ee-8cd0-bb9193f100e9" alt="htmldocs" width="100%" /> </h1>

1 lines 43.8 kB
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[554],{9942:function(e,t,r){r.d(t,{_:function(){return a}}),r(8478);var a=(0,r(8649).$)("148282daf28166207a83e9684260c8158e47e646")},2837:function(e,t,r){r.d(t,{v:function(){return a}}),r(8478);var a=(0,r(8649).$)("4a60d0c8b315bcd430b99cd5bbbb3549499a2979")},1554:function(e,t,r){r.d(t,{Shell:function(){return eD}});var a=r(3229),s=r(8355),n=r(3572),o=r(3813);function l(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,o.m6)((0,n.W)(t))}var i=r(3162),d=r(1787),c=r(5502),u=r(5448),m=r(8839);let f=d.fC,x=d.wy,p=d.Fw;var h=r(338),g=r(2273),v=r(6404);v.env.NEXT_PUBLIC_DOCUMENTS_DIR_RELATIVE_PATH,v.env.NEXT_PUBLIC_USER_PROJECT_LOCATION,v.env.NEXT_PUBLIC_OS_PATH_SEPARATOR;let j=v.env.DOCUMENTS_DIR_ABSOLUTE_PATH;var C=r(8394),b=r(989),y=r(6928);let w=s.forwardRef((e,t)=>{let{size:r=20,...s}=e;return(0,a.jsx)("svg",{fill:"none",height:r,ref:t,viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg",...s})});w.displayName="IconBase";let N=s.forwardRef((e,t)=>{let{...r}=e;return(0,a.jsx)(w,{ref:t,...r,children:(0,a.jsx)("path",{d:"M12 16L6 9.85966L6.84 9L12 14.2808L17.16 9L18 9.85966L12 16Z",fill:"currentColor"})})});N.displayName="IconArrowDown";let k=new Set,_=e=>{let{documentsDirectoryMetadata:t,className:r,currentDocumentOpenSlug:n}=e,o=!!n&&n.includes(t.relativePath),i=0===t.documentFilenames.length&&0===t.subDirectories.length,[d,c]=s.useState(k.has(t.absolutePath)||o);return(0,a.jsxs)(f,{className:l(r),onOpenChange:e=>{e?k.add(t.absolutePath):k.delete(t.absolutePath),c(e)},open:d,children:[(0,a.jsxs)(x,{className:l("text-[14px] flex items-center font-medium gap-2 justify-between w-full my-1",{"cursor-pointer":!i}),children:[(0,a.jsxs)("div",{className:"flex gap-2 items-center text-muted-foreground group",children:[d?(0,a.jsx)(b.P,{height:"20",width:"20",className:"transition ease-in-out group-hover:text-foreground"}):(0,a.jsx)(y.g,{height:"20",width:"20",className:"transition ease-in-out group-hover:text-foreground"}),(0,a.jsx)("h3",{className:"transition ease-in-out group-hover:text-foreground",children:t.directoryName})]}),i?null:(0,a.jsx)(N,{className:"data-[open=true]:rotate-180 transition-transform opacity-60 justify-self-end","data-open":d})]}),i?null:(0,a.jsx)(L,{currentDocumentOpenSlug:n,documentsDirectoryMetadata:t,open:d})]})},L=e=>{let t=(0,g.useSearchParams)(),r=e.documentsDirectoryMetadata.absolutePath===j;return(0,a.jsx)(c.M,{initial:!1,children:e.open?(0,a.jsx)(p,{asChild:!0,className:"relative data-[root=true]:mt-2 overflow-y-hidden pl-1",forceMount:!0,children:(0,a.jsxs)(u.E.div,{animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},initial:{opacity:0,height:0},children:[e.isRoot?null:(0,a.jsx)("div",{className:"line absolute left-2.5 w-px h-full bg-border -z-20"}),(0,a.jsx)("div",{className:"data-[root=true]:py-2 flex flex-col truncate",children:(0,a.jsxs)(m.S,{id:"sidebar",children:[e.documentsDirectoryMetadata.subDirectories.map(t=>(0,a.jsx)(_,{className:"pl-4 py-0",currentDocumentOpenSlug:e.currentDocumentOpenSlug,documentsDirectoryMetadata:t},t.absolutePath)),e.documentsDirectoryMetadata.documentFilenames.map((s,o)=>{var i;let d=r?s:"".concat(e.documentsDirectoryMetadata.relativePath,"/").concat(s),c=!!e.currentDocumentOpenSlug&&("tsx"===(i=e.currentDocumentOpenSlug).split(".").pop()||"jsx"===i.split(".").pop()||"js"===i.split(".").pop()?i.split(".").slice(0,-1).join("."):i)===d;return(0,a.jsx)(h.default,{href:{pathname:"/preview/".concat(d),search:t.toString()},children:(0,a.jsxs)(u.E.span,{animate:{x:0,opacity:1},className:l("group text-[14px] flex items-center align-middle pl-3 h-8 max-w-full rounded-md text-slate-11 relative transition-colors",{"text-cyan-11":c,"hover:text-slate-12":e.currentDocumentOpenSlug!==d}),initial:{x:-10+-(1.5*o),opacity:0},transition:{x:{delay:.03*o,duration:.2},opacity:{delay:.03*o,duration:.2}},children:[c?(0,a.jsx)(u.E.span,{animate:{opacity:1},className:"absolute left-0 right-0 top-0 bottom-0 rounded-md bg-emerald-400/10 opacity-0 -z-10",exit:{opacity:0},initial:{opacity:0},children:!e.isRoot&&(0,a.jsx)("div",{className:"rounded-md bg-emerald-400/80 w-px absolute top-1 left-1.5 h-6"})}):null,(0,a.jsx)(C.$,{className:(0,n.Z)("absolute left-4 w-[20px] h-[20px] transition ease-in-out group-hover:text-foreground",c?"text-emerald-600 group-hover:text-emerald-600 dark:text-emerald-500 dark:group-hover:text-emerald-500":"text-muted-foreground"),height:"20",width:"20"}),(0,a.jsx)("span",{className:(0,n.Z)("rounded-md truncate pl-8 font-medium transition ease-in-out group-hover:text-foreground",c?"text-emerald-600 group-hover:text-emerald-600 dark:text-emerald-500 dark:group-hover:text-emerald-500":"text-muted-foreground"),children:s})]})},d)})]})})]})}):null})};var D=r(4604);let S=e=>{let{width:t=107,height:r=28}=e,n=(0,s.useId)();return(0,a.jsxs)("svg",{width:t,height:r,viewBox:"0 0 191 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{d:"M35.8585 44.2627H10.0403C9.65989 44.2627 9.29506 44.1116 9.02607 43.8426C8.75708 43.5736 8.60596 43.2088 8.60596 42.8284V11.2728C8.60596 10.8924 8.75708 10.5275 9.02607 10.2586C9.29506 9.98956 9.65989 9.83844 10.0403 9.83844H27.2524L37.2929 19.8789V42.8284C37.2929 43.2088 37.1418 43.5736 36.8728 43.8426C36.6038 44.1116 36.2389 44.2627 35.8585 44.2627Z",fill:"url(#paint0_linear_2071_2955_".concat(n,")"),stroke:"#01543A",strokeWidth:"1.89275",strokeLinecap:"round",strokeLinejoin:"round"}),(0,a.jsx)("path",{d:"M27.2524 9.83844V19.8789H37.2929",fill:"#006646",stroke:"#006646",strokeWidth:"1.89275",strokeLinecap:"round",strokeLinejoin:"round"}),(0,a.jsxs)("mask",{id:"mask0_2071_2955",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"7",y:"8",width:"32",height:"38",children:[(0,a.jsx)("path",{d:"M35.8585 44.2627H10.0403C9.65989 44.2627 9.29506 44.1116 9.02607 43.8426C8.75708 43.5736 8.60596 43.2088 8.60596 42.8284V11.2728C8.60596 10.8924 8.75708 10.5275 9.02607 10.2586C9.29506 9.98956 9.65989 9.83844 10.0403 9.83844H27.2524L37.2929 19.8789V42.8284C37.2929 43.2088 37.1418 43.5736 36.8728 43.8426C36.6038 44.1116 36.2389 44.2627 35.8585 44.2627Z",fill:"url(#paint1_linear_2071_2955_".concat(n,")"),stroke:"#01543A",strokeWidth:"1.89275",strokeLinecap:"round",strokeLinejoin:"round"}),(0,a.jsx)("path",{d:"M27.2524 9.83844V19.8789H37.2929",fill:"#006646",stroke:"#006646",strokeWidth:"1.89275",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,a.jsx)("g",{mask:"url(#mask0_2071_2955_".concat(n,")"),children:(0,a.jsx)("path",{d:"M41.0622 41.0869H16.5156L41.0622 45.6263V41.0869Z",fill:"#023E2B"})}),(0,a.jsx)("path",{d:"M43.4298 40.1617H17.6116C17.2312 40.1617 16.8663 40.0106 16.5974 39.7416C16.3284 39.4726 16.1772 39.1078 16.1772 38.7274V7.17177C16.1772 6.79136 16.3284 6.42653 16.5974 6.15754C16.8663 5.88855 17.2312 5.73743 17.6116 5.73743H34.8237L44.8642 15.7778V38.7274C44.8642 39.1078 44.713 39.4726 44.444 39.7416C44.1751 40.0106 43.8102 40.1617 43.4298 40.1617Z",fill:"url(#paint2_linear_2071_2955_".concat(n,")"),stroke:"#057A55",strokeWidth:"1.89275",strokeLinecap:"round",strokeLinejoin:"round"}),(0,a.jsx)("path",{d:"M34.8237 5.73743V15.7778H44.8642",fill:"url(#paint3_linear_2071_2955_".concat(n,")"),stroke:"url(#paint4_linear_2071_2955_".concat(n,")"),strokeWidth:"1.89275",strokeLinecap:"round",strokeLinejoin:"round"}),(0,a.jsx)("path",{d:"M29.758 31.0637C29.3799 31.0637 29.1908 30.8746 29.1908 30.4965V29.6232C29.1908 29.2451 29.3799 29.056 29.758 29.056H36.4922C36.8703 29.056 37.0594 29.2451 37.0594 29.6232V30.4965C37.0594 30.8746 36.8703 31.0637 36.4922 31.0637H29.758Z",fill:"white"}),(0,a.jsx)("path",{d:"M23.9351 28.406V28.415C23.737 28.4931 23.575 28.4931 23.4489 28.415C23.3229 28.337 23.2599 28.184 23.2599 27.9559V26.6865C23.2599 26.3804 23.4129 26.1643 23.719 26.0383L27.8873 24.3817V24.2287L23.719 22.5902C23.4129 22.5121 23.2599 22.2991 23.2599 21.9509V20.6725C23.2599 20.4625 23.3229 20.3184 23.4489 20.2404C23.575 20.1624 23.737 20.1624 23.9351 20.2404L29.976 23.0223C30.2521 23.1363 30.3962 23.3584 30.4082 23.6885V24.9759C30.4082 25.282 30.2641 25.5041 29.976 25.6421L23.9351 28.406Z",fill:"white"}),(0,a.jsx)("path",{d:"M67.4541 26.1144V35.3163H63.7529V14.377H67.3723V22.2803H67.5564C67.9244 21.3942 68.4936 20.6956 69.2638 20.1843C70.0409 19.6663 71.0292 19.4073 72.2289 19.4073C73.3194 19.4073 74.2703 19.6356 75.0814 20.0923C75.8926 20.549 76.5196 21.217 76.9627 22.0963C77.4126 22.9756 77.6375 24.0491 77.6375 25.3169V35.3163H73.9363V25.8895C73.9363 24.833 73.6637 24.0116 73.1184 23.4254C72.5799 22.8324 71.8233 22.5359 70.8486 22.5359C70.1942 22.5359 69.608 22.6791 69.09 22.9653C68.5788 23.2448 68.1766 23.6504 67.8835 24.182C67.5973 24.7137 67.4541 25.3578 67.4541 26.1144Z",className:"fill-primary dark:fill-foreground"}),(0,a.jsx)("path",{d:"M89.2523 19.6118V22.4746H80.2242V19.6118H89.2523ZM82.4531 15.8492H86.1543V30.5927C86.1543 31.0902 86.2293 31.4719 86.3793 31.7378C86.536 31.9968 86.7405 32.174 86.9927 32.2694C87.2449 32.3649 87.5244 32.4126 87.8311 32.4126C88.0629 32.4126 88.2742 32.3955 88.465 32.3615C88.6627 32.3274 88.8126 32.2967 88.9149 32.2694L89.5386 35.1629C89.3409 35.2311 89.058 35.306 88.6899 35.3878C88.3287 35.4696 87.8856 35.5174 87.3608 35.531C86.4338 35.5582 85.5988 35.4185 84.8558 35.1118C84.1129 34.7982 83.5233 34.3143 83.087 33.6599C82.6576 33.0056 82.4463 32.1876 82.4531 31.2061V15.8492Z",className:"fill-primary dark:fill-foreground"}),(0,a.jsx)("path",{d:"M92.3477 35.3163V19.6118H95.8853V22.2803H96.0693C96.3965 21.3806 96.9384 20.6785 97.695 20.1741C98.4516 19.6629 99.3547 19.4073 100.404 19.4073C101.468 19.4073 102.364 19.6663 103.093 20.1843C103.83 20.6956 104.348 21.3942 104.647 22.2803H104.811C105.159 21.4078 105.745 20.7126 106.57 20.1946C107.401 19.6697 108.386 19.4073 109.524 19.4073C110.969 19.4073 112.149 19.864 113.062 20.7774C113.975 21.6907 114.432 23.0233 114.432 24.775V35.3163H110.721V25.3476C110.721 24.3729 110.462 23.6606 109.944 23.2107C109.426 22.754 108.792 22.5257 108.042 22.5257C107.149 22.5257 106.45 22.8052 105.946 23.3641C105.448 23.9162 105.2 24.6353 105.2 25.5214V35.3163H101.57V25.1942C101.57 24.3831 101.325 23.7356 100.834 23.2516C100.35 22.7677 99.716 22.5257 98.9321 22.5257C98.4005 22.5257 97.9165 22.662 97.4803 22.9347C97.044 23.2005 96.6964 23.5788 96.4374 24.0696C96.1784 24.5535 96.0489 25.1193 96.0489 25.7668V35.3163H92.3477Z",className:"fill-primary dark:fill-foreground"}),(0,a.jsx)("path",{d:"M121.888 14.377V35.3163H118.187V14.377H121.888Z",className:"fill-primary dark:fill-foreground"}),(0,a.jsx)("path",{d:"M131.522 35.5923C130.288 35.5923 129.184 35.2754 128.209 34.6415C127.235 34.0076 126.464 33.0874 125.899 31.8809C125.333 30.6745 125.05 29.209 125.05 27.4845C125.05 25.7395 125.336 24.2672 125.909 23.0676C126.488 21.8611 127.269 20.9512 128.25 20.3377C129.232 19.7174 130.326 19.4073 131.532 19.4073C132.452 19.4073 133.209 19.5641 133.802 19.8776C134.395 20.1843 134.865 20.5558 135.213 20.9921C135.561 21.4215 135.83 21.827 136.021 22.2088H136.174V14.377H139.885V35.3163H136.246V32.842H136.021C135.83 33.2237 135.554 33.6293 135.193 34.0587C134.831 34.4813 134.354 34.8425 133.761 35.1425C133.168 35.4424 132.422 35.5923 131.522 35.5923ZM132.555 32.5557C133.339 32.5557 134.006 32.3444 134.559 31.9218C135.111 31.4924 135.53 30.896 135.816 30.1326C136.102 29.3692 136.246 28.4796 136.246 27.464C136.246 26.4484 136.102 25.5657 135.816 24.8159C135.537 24.0662 135.121 23.4834 134.569 23.0676C134.024 22.6518 133.352 22.4439 132.555 22.4439C131.73 22.4439 131.041 22.6586 130.489 23.088C129.937 23.5175 129.521 24.1105 129.242 24.8671C128.963 25.6237 128.823 26.4893 128.823 27.464C128.823 28.4456 128.963 29.3214 129.242 30.0917C129.528 30.8551 129.947 31.4583 130.5 31.9014C131.059 32.3376 131.744 32.5557 132.555 32.5557Z",className:"fill-primary dark:fill-foreground"}),(0,a.jsx)("path",{d:"M150.68 35.623C149.146 35.623 147.817 35.2856 146.692 34.6108C145.568 33.936 144.695 32.992 144.075 31.7787C143.461 30.5654 143.155 29.1476 143.155 27.5254C143.155 25.9031 143.461 24.4819 144.075 23.2619C144.695 22.0418 145.568 21.0943 146.692 20.4195C147.817 19.7447 149.146 19.4073 150.68 19.4073C152.213 19.4073 153.543 19.7447 154.667 20.4195C155.792 21.0943 156.661 22.0418 157.274 23.2619C157.895 24.4819 158.205 25.9031 158.205 27.5254C158.205 29.1476 157.895 30.5654 157.274 31.7787C156.661 32.992 155.792 33.936 154.667 34.6108C153.543 35.2856 152.213 35.623 150.68 35.623ZM150.7 32.658C151.532 32.658 152.227 32.4296 152.786 31.9729C153.345 31.5094 153.761 30.8892 154.033 30.1121C154.313 29.3351 154.452 28.4694 154.452 27.5152C154.452 26.5541 154.313 25.685 154.033 24.908C153.761 24.1241 153.345 23.5004 152.786 23.0369C152.227 22.5734 151.532 22.3417 150.7 22.3417C149.848 22.3417 149.139 22.5734 148.574 23.0369C148.015 23.5004 147.595 24.1241 147.316 24.908C147.043 25.685 146.907 26.5541 146.907 27.5152C146.907 28.4694 147.043 29.3351 147.316 30.1121C147.595 30.8892 148.015 31.5094 148.574 31.9729C149.139 32.4296 149.848 32.658 150.7 32.658Z",className:"fill-primary dark:fill-foreground"}),(0,a.jsx)("path",{d:"M168.196 35.623C166.629 35.623 165.283 35.2788 164.158 34.5904C163.04 33.9019 162.178 32.9511 161.571 31.7378C160.971 30.5177 160.671 29.1135 160.671 27.5254C160.671 25.9304 160.978 24.5228 161.592 23.3027C162.205 22.0758 163.071 21.1216 164.189 20.4399C165.313 19.7515 166.642 19.4073 168.176 19.4073C169.451 19.4073 170.579 19.6425 171.56 20.1128C172.549 20.5763 173.336 21.234 173.922 22.0861C174.508 22.9313 174.842 23.9196 174.924 25.0511H171.386C171.243 24.2945 170.903 23.664 170.364 23.1596C169.832 22.6484 169.12 22.3928 168.227 22.3928C167.471 22.3928 166.806 22.5973 166.233 23.0062C165.661 23.4084 165.214 23.9878 164.894 24.7444C164.58 25.501 164.424 26.4075 164.424 27.464C164.424 28.5342 164.58 29.4544 164.894 30.2246C165.208 30.988 165.647 31.5776 166.213 31.9934C166.786 32.4024 167.457 32.6068 168.227 32.6068C168.772 32.6068 169.26 32.5046 169.689 32.3001C170.125 32.0888 170.49 31.7855 170.783 31.3902C171.076 30.9948 171.277 30.5143 171.386 29.9485H174.924C174.835 31.0596 174.508 32.0445 173.943 32.9033C173.377 33.7554 172.607 34.4234 171.632 34.9073C170.657 35.3844 169.512 35.623 168.196 35.623Z",className:"fill-primary dark:fill-foreground"}),(0,a.jsx)("path",{d:"M190.376 23.7628L187.001 24.1309C186.906 23.7901 186.739 23.4697 186.5 23.1698C186.269 22.8699 185.955 22.6279 185.56 22.4439C185.165 22.2599 184.681 22.1679 184.108 22.1679C183.338 22.1679 182.69 22.3348 182.165 22.6688C181.647 23.0028 181.392 23.4357 181.399 23.9673C181.392 24.424 181.559 24.7955 181.9 25.0818C182.247 25.3681 182.82 25.6032 183.617 25.7872L186.296 26.3598C187.782 26.6802 188.886 27.188 189.609 27.8832C190.338 28.5785 190.706 29.4884 190.713 30.6131C190.706 31.6015 190.416 32.4739 189.844 33.2305C189.278 33.9803 188.491 34.5665 187.482 34.9891C186.473 35.4117 185.314 35.623 184.006 35.623C182.084 35.623 180.536 35.2208 179.364 34.4165C178.192 33.6054 177.493 32.4773 177.268 31.0323L180.877 30.6847C181.041 31.3936 181.388 31.9286 181.92 32.2899C182.452 32.6511 183.144 32.8318 183.996 32.8318C184.875 32.8318 185.58 32.6511 186.112 32.2899C186.65 31.9286 186.92 31.4822 186.92 30.9505C186.92 30.5006 186.746 30.1292 186.398 29.8361C186.057 29.543 185.526 29.318 184.803 29.1613L182.125 28.5989C180.618 28.2854 179.504 27.7571 178.781 27.0142C178.059 26.2644 177.701 25.3169 177.708 24.1718C177.701 23.2039 177.963 22.3655 178.495 21.6566C179.033 20.9409 179.78 20.3888 180.734 20.0003C181.695 19.605 182.803 19.4073 184.057 19.4073C185.897 19.4073 187.346 19.7992 188.402 20.5831C189.466 21.367 190.123 22.4269 190.376 23.7628Z",className:"fill-primary dark:fill-foreground"}),(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"paint0_linear_2071_2955_".concat(n),x1:"32.7272",y1:"41.9465",x2:"10.1407",y2:"11.5238",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{stopColor:"#01543A"}),(0,a.jsx)("stop",{offset:"1",stopColor:"#086548"})]}),(0,a.jsxs)("linearGradient",{id:"paint1_linear_2071_2955_".concat(n),x1:"32.7272",y1:"41.9465",x2:"10.1407",y2:"11.5238",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{stopColor:"#01543A"}),(0,a.jsx)("stop",{offset:"1",stopColor:"#086548"})]}),(0,a.jsxs)("linearGradient",{id:"paint2_linear_2071_2955_".concat(n),x1:"41.4856",y1:"40.5635",x2:"21.2038",y2:"3.22669",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{stopColor:"#057A55"}),(0,a.jsx)("stop",{offset:"1",stopColor:"#1D9A72"})]}),(0,a.jsxs)("linearGradient",{id:"paint3_linear_2071_2955_".concat(n),x1:"35.0323",y1:"15.6723",x2:"41.0384",y2:"5.82418",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{stopColor:"#006646"}),(0,a.jsx)("stop",{offset:"1",stopColor:"#20B686"})]}),(0,a.jsxs)("linearGradient",{id:"paint4_linear_2071_2955",x1:"35.0323",y1:"16.1332",x2:"43.3109",y2:"5.82418",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{stopColor:"#006646"}),(0,a.jsx)("stop",{offset:"0.0001",stopColor:"#026445"}),(0,a.jsx)("stop",{offset:"1",stopColor:"#17936C"})]})]})]})};var V=r(3804),R=r(6703),O=r(1659),A=r(7616),H=r(9258);let M=(0,H.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),E=s.forwardRef((e,t)=>{let{className:r,variant:s,size:n,asChild:o=!1,...i}=e,d=o?A.g7:"button";return(0,a.jsx)(d,{className:l(M({variant:s,size:n,className:r})),ref:t,...i})});E.displayName="Button";var U=r(618),P=r(3630);let Z=U.fC,z=U.xz;U.ZA,U.Uv,U.Tr,U.Ee,s.forwardRef((e,t)=>{let{className:r,inset:s,children:n,...o}=e;return(0,a.jsxs)(U.fF,{ref:t,className:l("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",s&&"pl-8",r),...o,children:[n,(0,a.jsx)(P.XCv,{className:"ml-auto h-4 w-4"})]})}).displayName=U.fF.displayName,s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(U.tu,{ref:t,className:l("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...s})}).displayName=U.tu.displayName;let F=s.forwardRef((e,t)=>{let{className:r,sideOffset:s=4,...n}=e;return(0,a.jsx)(U.Uv,{children:(0,a.jsx)(U.VY,{ref:t,sideOffset:s,className:l("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...n})})});F.displayName=U.VY.displayName;let I=s.forwardRef((e,t)=>{let{className:r,inset:s,...n}=e;return(0,a.jsx)(U.ck,{ref:t,className:l("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",r),...n})});I.displayName=U.ck.displayName,s.forwardRef((e,t)=>{let{className:r,children:s,checked:n,...o}=e;return(0,a.jsxs)(U.oC,{ref:t,className:l("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),checked:n,...o,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(U.wU,{children:(0,a.jsx)(P.nQG,{className:"h-4 w-4"})})}),s]})}).displayName=U.oC.displayName,s.forwardRef((e,t)=>{let{className:r,children:s,...n}=e;return(0,a.jsxs)(U.Rk,{ref:t,className:l("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...n,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(U.wU,{children:(0,a.jsx)(P.jXb,{className:"h-4 w-4 fill-current"})})}),s]})}).displayName=U.Rk.displayName,s.forwardRef((e,t)=>{let{className:r,inset:s,...n}=e;return(0,a.jsx)(U.__,{ref:t,className:l("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",r),...n})}).displayName=U.__.displayName,s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(U.Z0,{ref:t,className:l("-mx-1 my-1 h-px bg-muted",r),...s})}).displayName=U.Z0.displayName;var T=()=>{let{setTheme:e}=(0,O.F)();return(0,a.jsxs)(Z,{children:[(0,a.jsx)(z,{asChild:!0,children:(0,a.jsxs)(E,{className:"group",variant:"ghost",size:"icon",children:[(0,a.jsx)(V.k,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 dark:-rotate-90 dark:scale-0 text-muted-foreground group-hover:text-foreground transition-colors duration-150"}),(0,a.jsx)(R.J,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 dark:rotate-0 dark:scale-100 text-muted-foreground group-hover:text-foreground transition-colors duration-150"}),(0,a.jsx)("span",{className:"sr-only",children:"Toggle theme"})]})}),(0,a.jsxs)(F,{align:"end",children:[(0,a.jsx)(I,{onClick:()=>e("light"),children:"Light"}),(0,a.jsx)(I,{onClick:()=>e("dark"),children:"Dark"}),(0,a.jsx)(I,{onClick:()=>e("system"),children:"System"})]})]})},B=r(4054);let G=(e,t)=>{var r,a;let[s,n]=e.split("-"),[o,l]=t.split("-"),i=null!==(r=null==s?void 0:s.split(".").map(Number))&&void 0!==r?r:[],d=null!==(a=null==o?void 0:o.split(".").map(Number))&&void 0!==a?a:[];for(let e=0;e<Math.max(i.length,d.length);e++){let t=i[e]||0,r=d[e]||0;if(t!==r)return t-r}return n&&!l?-1:!n&&l?1:n&&l?n===l?0:n>l?1:-1:0},q=()=>{let[e,t]=s.useState(null);return s.useEffect(()=>{let e=async()=>{try{let e=await fetch("https://registry.npmjs.org/htmldocs/latest"),r=(await e.json()).version;r&&G(r,"0.2.30")>0&&t(r)}catch(e){console.error("Failed to check for new version:",e)}};e();let r=setInterval(e,864e5);return()=>clearInterval(r)},[]),e},W=e=>{let{className:t,currentDocumentOpenSlug:r,style:n}=e,{documentsDirectoryMetadata:o}=(0,D.s)(),i=q(),[c,u]=s.useState(!1);return(0,a.jsxs)("aside",{className:l("border-r flex flex-col border-slate-6",t),style:{...n},children:[(0,a.jsxs)("div",{className:"p-4 h-[70px] w-full flex-shrink items-center justify-between hidden lg:flex",children:[(0,a.jsx)(S,{}),(0,a.jsx)(T,{})]}),(0,a.jsxs)("nav",{className:"p-4 flex-grow lg:pt-0 pl-0 w-screen h-[calc(100vh_-_70px)] lg:w-full lg:min-w-[275px] lg:max-w-[275px] flex flex-col overflow-y-auto justify-between",children:[(0,a.jsx)(d.fC,{children:(0,a.jsx)(s.Suspense,{children:(0,a.jsx)(L,{currentDocumentOpenSlug:r,documentsDirectoryMetadata:o,isRoot:!0,open:!0})})}),i&&!c&&(0,a.jsxs)("div",{className:"ml-4 p-2 bg-secondary flex items-center justify-between border border-border rounded-md",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-xs text-foreground",children:["New version (",(0,a.jsx)("a",{href:"https://www.npmjs.com/package/htmldocs",target:"_blank",rel:"noopener noreferrer",className:"hover:underline",children:i}),") available"]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"npm install -g htmldocs@latest"})]}),(0,a.jsx)(E,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>u(!0),children:(0,a.jsx)(B.X,{className:"h-4 w-4"})})]})]})]})};var $=r(1213),X=r(3768);let Y=X.fC;X.xz;let J=X.h_;X.x8;let Q=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(X.aV,{ref:t,className:l("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...s})});Q.displayName=X.aV.displayName;let K=s.forwardRef((e,t)=>{let{className:r,children:s,...n}=e;return(0,a.jsxs)(J,{children:[(0,a.jsx)(Q,{}),(0,a.jsxs)(X.VY,{ref:t,className:l("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...n,children:[s,(0,a.jsxs)(X.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,a.jsx)(P.Pxu,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});K.displayName=X.VY.displayName;let ee=e=>{let{className:t,...r}=e;return(0,a.jsx)("div",{className:l("flex flex-col space-y-1.5 text-center sm:text-left",t),...r})};ee.displayName="DialogHeader";let et=e=>{let{className:t,...r}=e;return(0,a.jsx)("div",{className:l("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};et.displayName="DialogFooter";let er=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(X.Dx,{ref:t,className:l("text-lg font-semibold leading-none tracking-tight",r),...s})});er.displayName=X.Dx.displayName,s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(X.dk,{ref:t,className:l("text-sm text-muted-foreground",r),...s})}).displayName=X.dk.displayName;var ea=r(6869),es=r(5073),en=r(9279),eo=r(2534),el=r(8213),ei=r(5143);let ed=s.forwardRef((e,t)=>{let{className:r,type:s,...n}=e;return(0,a.jsx)("input",{type:s,className:l("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...n})});ed.displayName="Input";var ec=r(5817);let eu=(0,H.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),em=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(ec.f,{ref:t,className:l(eu(),r),...s})});em.displayName=ec.f.displayName;var ef=r(9084);let ex=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(ef.fC,{className:l("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",r),...s,ref:t,children:(0,a.jsx)(ef.bU,{className:l("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})});ex.displayName=ef.fC.displayName;let ep=(0,H.j)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",success:"border-green-500/50 text-green-600 dark:border-green-900/50 [&>svg]:text-green-600 bg-green-50 dark:bg-green-950/50",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function eh(e){let{className:t,variant:r,...s}=e;return(0,a.jsx)("div",{className:l(ep({variant:r}),t),...s})}var eg=r(9385),ev=r(9427);let ej={string:"",number:0,boolean:!1,array:[],object:{}},eC=e=>{let t={};return e.properties&&Object.entries(e.properties).forEach(e=>{let[r,a]=e;"boolean"!=typeof a&&(t[r]=ej[a.type])}),t},eb=e=>{let{schema:t,path:r,indentLevel:n=0,listIndex:o,onDelete:l,isRequired:i=!1,isLast:d=!1}=e,{documentContext:c,updateDocumentContext:u}=(0,eg.t)(),[m,h]=s.useState(!0),g=e=>{u(r,e)},v=r.split(".").reduce((e,t)=>e&&e[t],c);return(0,a.jsxs)("div",{className:"flex flex-col relative",children:[n>0&&(0,a.jsx)("div",{className:"absolute left-0 top-0 bottom-0 border-l-2 border-muted",style:{left:"".concat((n-1)*1,"rem"),bottom:d?"50%":"0"}}),(0,a.jsxs)(f,{open:m,onOpenChange:h,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between relative py-0.5",children:[n>0&&(0,a.jsx)("div",{className:"absolute left-0 top-1/2 w-2 border-t-2 border-muted",style:{left:"".concat((n-1)*1,"rem")}}),(0,a.jsxs)("div",{className:"flex items-center gap-1",style:{marginLeft:"".concat(1*n,"rem")},children:[("object"===t.type||"array"===t.type)&&(0,a.jsx)(x,{asChild:!0,children:(0,a.jsx)(E,{variant:"ghost",size:"sm",className:"p-0 hover:bg-transparent",children:(0,a.jsx)(el.p,{className:"w-4 h-4 transition-transform duration-200 ".concat(m?"rotate-0":"-rotate-90")})})}),(0,a.jsxs)(em,{className:"text-sm font-medium",children:[r.split(".").pop(),i&&(0,a.jsx)("sup",{children:(0,a.jsx)(ea.d,{className:"inline-block w-2 h-2 ml-0.5 text-muted-foreground"})})]}),(0,a.jsx)(eh,{variant:"secondary",className:"text-xs",children:t.type})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:["object"!==t.type&&"array"!==t.type&&(()=>{switch(t.type){case"string":return(0,a.jsx)(ed,{type:"text",value:v||"",onChange:e=>g(e.target.value),className:"h-8 w-full"});case"number":case"integer":return(0,a.jsx)(ed,{type:"number",value:v||0,onChange:e=>g(Number(e.target.value)),className:"h-8 w-full"});case"boolean":return(0,a.jsx)(ex,{checked:v||!1,onCheckedChange:e=>g(e)});default:return null}})(),void 0!==o&&l&&(0,a.jsx)(E,{size:"icon-sm",variant:"destructive",onClick:l,children:(0,a.jsx)(ei.r,{className:"w-4 h-4"})})]})]}),(0,a.jsx)(p,{className:"overflow-hidden transition-all duration-300 pl-5 relative",children:"object"===t.type?(0,a.jsx)("div",{className:"-ml-2",children:(()=>{if(!t.properties)return null;let e=t.required,s=Object.entries(t.properties).sort((e,t)=>e[0].localeCompare(t[0]));return s.map((t,o)=>{let[l,i]=t;return"boolean"==typeof i?null:(0,a.jsx)(eb,{schema:i,path:"".concat(r,".").concat(l),indentLevel:n+1,isRequired:null==e?void 0:e.includes(l),isLast:o===s.length-1},l)})})()}):"array"===t.type?(0,a.jsx)("div",{className:"-ml-2",children:(()=>{let e;if(!t.items)return null;if(Array.isArray(t.items))e=t.items[0];else{if("object"!=typeof t.items)return null;e=t.items}return(0,a.jsxs)("div",{className:"flex flex-col relative",children:[Array.isArray(v)&&v.map((t,s)=>(0,a.jsx)(eb,{schema:e,path:"".concat(r,".").concat(s),indentLevel:n+1,listIndex:s,onDelete:()=>{let e=[...v];e.splice(s,1),g(e)},isRequired:!0,isLast:!1},s)),(0,a.jsxs)("div",{className:"relative",children:[n>0&&(0,a.jsx)("div",{className:"absolute left-0 top-0 bottom-0 border-l-2 border-muted",style:{left:"".concat(1*n,"rem")}}),(0,a.jsx)("div",{className:"absolute left-0 top-1/2 w-2 border-t-2 border-muted",style:{left:"".concat(1*n,"rem")}}),(0,a.jsx)("div",{className:"absolute left-0 top-0 bottom-1/2 border-l-2 border-muted",style:{left:"".concat(1*n,"rem")}}),(0,a.jsxs)(E,{variant:"ghost",size:"sm",className:"w-fit relative",style:{marginLeft:"".concat((n+1)*1,"rem")},onClick:()=>g([...v||[],eC(e)]),children:[(0,a.jsx)(eo.v,{className:"w-4 h-4 mr-2"}),"Add item"]})]})]})})()}):null})]})]})};var ey=()=>{let{documentSchema:e,documentContext:t}=(0,eg.t)(),r=Object.keys((null==e?void 0:e.properties)||{}).length;return ev.Z.debug({documentSchema:e,documentContext:t}),(0,a.jsx)("div",{className:"flex flex-col gap-2 text-card-foreground",children:r>0?Object.entries((null==e?void 0:e.properties)||{}).sort((e,t)=>{let[r]=e,[a]=t;return r.localeCompare(a)}).map((t,r,s)=>{var n;let[o,l]=t;return"boolean"==typeof l?null:(0,a.jsx)(eb,{schema:l,path:"document.".concat(o),isRequired:null==e?void 0:null===(n=e.required)||void 0===n?void 0:n.includes(o),isLast:r===s.length-1},o)}):(0,a.jsxs)("div",{className:"w-full h-36 flex flex-col items-center justify-center",children:[(0,a.jsx)("div",{className:"text-gray-500 mb-2",children:"No context variables found."}),(0,a.jsxs)("div",{className:"text-gray-500 text-sm text-center",children:["Try adding a variable to your code by",(0,a.jsx)("br",{})," typing ",(0,a.jsx)("code",{children:"{{ message }}"})," and come back here"]})]})})},ew=r(8521),eN=r(9942),ek=r(2837),e_=e=>{let{documentSlug:t,documentPath:r,isOpen:n,onOpenChange:o}=e,{pageConfigs:l}=(0,D.s)(),{documentSchema:i,documentContext:d,resetDocumentContext:c}=(0,eg.t)(),[u,m]=(0,s.useState)(!1);(0,s.useEffect)(()=>{m(!1)},[t]);let f=(0,s.useMemo)(()=>{if(!i||!i.properties)return!0;let e=(t,r)=>{if(!t.properties)return!0;let a=t.required||[];return 0===a.length||a.every(a=>{let s=t.properties[a],n=null==r?void 0:r[a];return"object"===s.type?e(s,n):"array"===s.type&&s.items?Array.isArray(n)&&(0===n.length||n.every(t=>e(s.items,t))):null!=n&&""!==n})};return e(i,d.document)},[i,d]),x=async()=>{m(!0);try{let e=await (0,eN._)(r,d.document);if("error"in e)throw Error("Failed to render document: ".concat(e.error.message));let a=await (0,ek.v)({url:window.location.href,html:e.markup,pageConfig:l[r]});if(a instanceof Error)throw a;let s=new Uint8Array(a),n=new Blob([s],{type:"application/pdf"}),o=window.URL.createObjectURL(n),i=document.createElement("a");i.href=o,i.download="".concat(t||"document",".pdf"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(o),m(!1)}catch(e){console.error("Error generating document:",e),ew.Am.error("Failed to generate the document. Please try again."),m(!1)}},p=(0,s.useCallback)(()=>{window.confirm("Are you sure you want to reset all fields? This action cannot be undone.")&&c()},[c]);return(0,a.jsx)(Y,{open:n,onOpenChange:o,children:(0,a.jsxs)(K,{className:"flex flex-col max-w-4xl max-h-[90vh]",children:[(0,a.jsx)(ee,{children:(0,a.jsx)(er,{children:"Fill Document"})}),(0,a.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 h-full",children:[(0,a.jsx)("div",{className:"flex items-center justify-end bg-muted/50 -mx-6",children:(0,a.jsxs)("div",{className:"px-6 py-2 text-sm text-muted-foreground",children:["Want to generate documents via API?",(0,a.jsx)("a",{href:"https://htmldocs.com/signup",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline ml-1",children:"Sign up for an account"})]})}),(0,a.jsx)("div",{className:"h-px bg-secondary w-full"}),(0,a.jsx)("div",{className:"py-4 overflow-y-auto flex-1 min-h-0 h-full pr-4 w-[calc(100%+1rem)]",children:i?(0,a.jsx)(ey,{}):(0,a.jsx)("p",{children:"Loading schema..."})}),(0,a.jsx)("div",{className:"h-px bg-secondary w-full"})]}),(0,a.jsxs)(et,{className:"flex items-center sm:justify-between w-full",children:[(0,a.jsxs)("div",{className:"flex justify-start items-center text-xs text-muted-foreground mt-2",children:[(0,a.jsx)("sup",{children:(0,a.jsx)(ea.d,{className:"inline-block w-2 h-2 mr-1"})}),"indicates required field"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(E,{variant:"secondary",onClick:p,children:"Reset"}),(0,a.jsx)(E,{onClick:x,disabled:u||!f,children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(es.$,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(en.M,{className:"mr-2 h-4 w-4",weight:"bold"}),"Generate & Download"]})})]})]})]})})};let eL=e=>{let{documentPath:t,currentDocumentOpenSlug:r,pathSeparator:n,markup:o,activeView:l,setActiveView:i,onToggleSidebar:d}=e,{renderDocumentToPDF:c,pageConfigs:u}=(0,D.s)(),[m,f]=s.useState(!1),[x,p]=s.useState(!1),h=async()=>{if(!o){ew.Am.error("No markup available to generate PDF");return}f(!0);try{let e=await c({url:window.location.href,html:o,pageConfig:u[t]});if(e instanceof Error)throw e;let r=new Uint8Array(e),a=new Blob([r],{type:"application/pdf"}),s=window.URL.createObjectURL(a),n=document.createElement("a");n.href=s,n.download="document.pdf",document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(s),ew.Am.success("PDF downloaded successfully")}catch(e){console.error("Error downloading document:",e),ew.Am.error("Failed to generate PDF. Check the CLI logs for more details.")}finally{f(!1)}};return(0,a.jsxs)("header",{className:"flex relative items-center px-4 justify-between h-[70px] hidden lg:flex border-b border-border",children:[(0,a.jsx)(E,{className:"group",variant:"ghost",size:"icon",onClick:()=>{d&&d()},children:(0,a.jsx)($.Y,{height:20,width:20,className:"text-muted-foreground group-hover:text-foreground transition-colors duration-150"})}),(0,a.jsx)("div",{className:"items-center overflow-hidden hidden lg:flex text-center absolute left-1/2 transform -translate-x-1/2 top-1/2 -translate-y-1/2",children:(0,a.jsx)("h2",{className:"truncate text-sm font-medium text-foreground",children:r.split(n).pop()})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(E,{variant:"secondary",onClick:()=>p(!0),children:"Fill & Generate"}),(0,a.jsx)(E,{variant:"default",onClick:h,disabled:m,children:m?"Downloading...":"Download"})]}),(0,a.jsx)(e_,{documentPath:t,documentSlug:r,isOpen:x,onOpenChange:p})]})},eD=e=>{let{documentPath:t,currentDocumentOpenSlug:r,children:n,pathSeparator:o,markup:d,activeView:c,setActiveView:u}=e,[m,f]=s.useState(!1),[x,p]=s.useState(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex bg-background text-foreground flex-col h-screen overflow-x-hidden print-hide",children:[(0,a.jsxs)("div",{className:"flex lg:hidden items-center px-6 justify-between h-[70px] border-b border-slate-6",children:[(0,a.jsx)("div",{className:"h-[70px] flex items-center",children:(0,a.jsx)(S,{})}),(0,a.jsx)(E,{className:"group",variant:"ghost",size:"icon",onClick:()=>{f(e=>!e)},children:(0,a.jsx)(i.a,{height:20,width:20,className:"text-muted-foreground group-hover:text-foreground transition-colors duration-150"})})]}),(0,a.jsxs)("div",{className:"flex bg-slate-2",children:[(0,a.jsx)(W,{className:l("w-screen max-w-full bg-background h-screen lg:h-auto z-50 lg:z-auto lg:max-w-[275px] fixed top-[70px] lg:top-0 left-0",{"translate-x-0 lg:-translate-x-full":m,"-translate-x-full lg:translate-x-0":!m}),currentDocumentOpenSlug:r,style:{transition:x?"transform 0.2s ease-in-out":""}}),(0,a.jsxs)("main",{className:l("absolute flex flex-col will-change-width h-screen w-[100vw] right-0",{"lg:translate-x-0 lg:w-[calc(100vw)]":m,"lg:translate-x-0 lg:w-[calc(100vw-275px)]":!m}),style:{transition:x?"width 0.2s ease-in-out, transform 0.2s ease-in-out":""},children:[r&&t&&o?(0,a.jsx)(eL,{documentPath:t,activeView:c,currentDocumentOpenSlug:r,markup:d,onToggleSidebar:()=>{p(!0),requestAnimationFrame(()=>{f(e=>!e)}),setTimeout(()=>{p(!1)},300)},pathSeparator:o,setActiveView:u}):null,(0,a.jsx)("div",{className:"w-full h-full overflow-auto mx-auto",children:n})]})]})]}),(0,a.jsx)("div",{className:"print-show",children:(0,a.jsx)("div",{className:"h-screen",children:n})})]})}},9385:function(e,t,r){r.d(t,{B:function(){return i},t:function(){return l}});var a=r(3229),s=r(8355),n=r(9427);let o=(0,s.createContext)(void 0),l=()=>{let e=(0,s.useContext)(o);if(!e)throw Error("useDocumentContext must be used within a DocumentContextProvider");return e},i=e=>{let{children:t,initialDocumentPreviewProps:r,initialDocumentSchema:l}=e,[i,d]=(0,s.useState)({document:r||{}});return n.Z.debug("Initial document context:",i),(0,a.jsx)(o.Provider,{value:{documentSchema:l,documentContext:i,setDocumentContext:d,updateDocumentContext:(e,t)=>{let r=e.split("."),a=r.pop(),s={...i},n=s;for(let e of r)n[e]||(n[e]={}),n=n[e];a&&(n[a]=t),d(s)},resetDocumentContext:()=>{d(()=>({document:JSON.parse(JSON.stringify(r||{}))}))}},children:t})}},4604:function(e,t,r){r.d(t,{DocumentsProvider:function(){return h},s:function(){return p}});var a=r(3229),s=r(8355);r(8478);var n=r(8649),o=(0,n.$)("e9cb305fe64d8825c8e6be0754285718293d5097"),l=r(8593),i=r(9942),d=(0,n.$)("1da8ed2f74e58f66d4e2a54aaa973837fede5566"),c=r(2837),u=r(9427),m=(0,n.$)("e6a71b5d8f6fc2d007b17e18511774771d75fb59"),f=r(6404);let x=(0,s.createContext)(void 0),p=()=>{let e=(0,s.useContext)(x);if(void 0===e)throw Error("Cannot call `useDocument()` outside of a DocumentsContext provider!");return e},h=e=>{let[t,r]=(0,s.useState)(e.initialDocumentsDirectoryMetadata),[n,p]=(0,s.useState)({}),[h,g]=(0,s.useState)({}),[v,j]=(0,s.useState)({}),C=async e=>{try{let t=await m(e);t&&j(r=>({...r,[e]:t}))}catch(e){u.Z.warn("Failed to load schema:",e)}};return"true"!==f.env.NEXT_PUBLIC_IS_BUILDING&&(0,l.z)(async t=>{let a=await o(e.initialDocumentsDirectoryMetadata.absolutePath);if(a)r(a);else throw Error("Hot reloading: unable to find the documents directory to update the sidebar");for await(let e of t){if(!e.filename.match(/\.(js|jsx|ts|tsx)$/))return;if("unlink"===e.event)continue;let t=e.filename,r=await d(t);if(void 0!==n[r]){u.Z.debug("pathForChangedDocument",r);let e=await (0,i._)(r);p(t=>({...t,[r]:e})),await C(r)}}}),(0,a.jsx)(x.Provider,{value:{documentsDirectoryMetadata:t,useDocumentRenderingResult:(e,t)=>((0,s.useEffect)(()=>{void 0===n[e]&&p(r=>({...r,[e]:t}))},[t,e]),void 0!==n[e])?n[e]:t,renderDocumentToPDF:c.v,pageConfigs:h,setPageConfig:(e,t)=>{g(r=>({...r,[e]:t}))},documentSchemas:v},children:e.children})}},8593:function(e,t,r){r.d(t,{z:function(){return o}});var a=r(8355),s=r(5497);let n=null,o=e=>{(0,a.useEffect)(()=>(n||(n=(0,s.io)()),n.on("reload",t=>{console.log("Reloading..."),e(t)}),()=>{null==n||n.off("reload")}),[e])}},9427:function(e,t,r){var a=r(6404);let s={debug:0,info:1,warn:2,error:3};class n{static getInstance(){return n.instance||(n.instance=new n),n.instance}setLevel(e){this.currentLevel=e}getLevel(){return this.currentLevel}shouldLog(e){return s[e]>=s[this.currentLevel]}debug(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.shouldLog("debug")&&console.debug(...t)}info(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.shouldLog("info")&&console.info(...t)}warn(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.shouldLog("warn")&&console.warn(...t)}error(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.shouldLog("error")&&console.error(...t)}constructor(){this.currentLevel=a.env.LOG_LEVEL||"info"}}let o=n.getInstance();t.Z=o}}]);