1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[99029],{491:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ImageUploader:()=>N});var n=r(76471),a=r(87639),s=r(32812),i=r(20857),o=r(57505),l=r(17727),c=r(3395),u=r(69140),d=r(20792),f=r(34448),m=r(8483),h=r(22122),p=r(42477),v=r(70682),g=r(41156),x=r(5029),b=r(42803),w=function(e){if(!e)return"";if(e<1024)return"".concat(e," B");var t=e/1024;if(t<1024)return"".concat(t.toFixed(2)," KB");var r=t/1024;return"".concat(r.toFixed(2)," MB")},j=function(e){return(0,n._)(function(){var t,r,n,a,s;return(0,c.YH)(this,function(i){switch(i.label){case 0:return n=new FormData,e.forEach(function(e){n.append("files",e)}),[4,fetch("/api/storage/upload-image",{method:"POST",body:n})];case 1:if(!(a=i.sent()).ok)throw Error("Upload failed with status ".concat(a.status));return[4,a.json()];case 2:if(0!==(s=i.sent()).code||!(null==(r=s.data)||null==(t=r.urls)?void 0:t.length))throw Error(s.message||"Upload failed");return[2,s.data.urls]}})})()};function N(e){var t=e.allowMultiple,r=void 0!==t&&t,N=e.maxImages,y=e.maxSizeMB,_=void 0===y?10:y,k=e.accept,S=e.title,z=e.emptyHint,A=e.className,C=e.defaultPreviews,R=e.displayMode,E=void 0===R?"grid":R,L=e.requireAuth,U=void 0!==L&&L,P=e.onAuthRequired,M=e.onChange,T=(0,d.useRef)(null),I=(0,d.useRef)(null),D=(0,d.useRef)(!1),O=(0,d.useRef)(M),B=(0,d.useRef)(!1),F=(0,d.useRef)(null),W=(0,d.useRef)(0),H=(0,o._)((0,d.useState)(!1),2),q=H[0],$=H[1],K=(0,o._)((0,d.useState)(!1),2),V=K[0],G=K[1],Y=(0,o._)((0,d.useState)(function(){return(null==C?void 0:C.length)?C.map(function(e,t){return{id:"preset-".concat(e,"-").concat(t),preview:e,url:e,status:"uploaded"}}):[]}),2),J=Y[0],Q=Y[1],X=r?void 0===N?1:N:1,Z=1024*_*1024,ee=function(){return!U||(null==P||P(),!1)};(0,d.useEffect)(function(){O.current=M},[M]),(0,d.useEffect)(function(){if(V){var e=function(e){var t,r=e.target;(0,a._)(r,Node)&&(null==(t=I.current)?void 0:t.contains(r))||G(!1)};return document.addEventListener("pointerdown",e),function(){document.removeEventListener("pointerdown",e)}}},[V]),(0,d.useEffect)(function(){if(D.current){if(B.current){B.current=!1;return}var e=C||[];Q(function(t){var r=t.filter(function(e){return"uploaded"===e.status&&e.url}).map(function(e){return e.url});return e.length===r.length&&e.every(function(e,t){return e===r[t]})?t:e.map(function(e,t){return{id:"preset-".concat(e,"-").concat(t),preview:e,url:e,status:"uploaded"}})})}},[C]),(0,d.useEffect)(function(){return function(){J.forEach(function(e){e.preview.startsWith("blob:")&&URL.revokeObjectURL(e.preview)})}},[J]),(0,d.useEffect)(function(){var e;if(!D.current){D.current=!0;return}B.current=!0,null==(e=O.current)||e.call(O,J.map(function(e){return{id:e.id,preview:e.preview,url:e.url,status:e.status,size:e.size}}))},[J]);var et=function(e){e.forEach(function(e){var t=e.id,r=e.file,a="".concat(Date.now(),"-").concat(Math.random()),o=URL.createObjectURL(r);Q(function(e){return e.map(function(e){return e.id!==t?e:(e.preview.startsWith("blob:")&&URL.revokeObjectURL(e.preview),(0,i._)((0,s._)({},e),{preview:o,file:r,size:r.size,url:void 0,status:"uploading",uploadKey:a}))})}),(0,n._)(function(){var e;return(0,c.YH)(this,function(t){switch(t.label){case 0:return[4,j([r])];case 1:if(!(e=t.sent()[0]))throw Error("Upload failed");return[2,e]}})})().then(function(e){Q(function(r){return r.map(function(r){return r.id!==t||r.uploadKey!==a?r:(r.preview.startsWith("blob:")&&URL.revokeObjectURL(r.preview),(0,i._)((0,s._)({},r),{preview:e,url:e,status:"uploaded",file:void 0}))})})}).catch(function(e){console.error("Upload failed:",e),v.oR.error((null==e?void 0:e.message)?"Upload failed: ".concat(e.message):"Upload failed",{description:"Please try again or contact [email protected]"}),Q(function(e){return e.map(function(e){return e.id!==t||e.uploadKey!==a?e:(0,i._)((0,s._)({},e),{status:"error"})})})}).finally(function(){T.current&&(T.current.value="")}
1)})},er=function(e){if(!ee()){T.current&&(T.current.value="");return}var t=F.current;if(t){F.current=null;var r,n=e[0];if(!n)return;if(!(null==(r=n.type)?void 0:r.startsWith("image/"))){v.oR.error("Only image files are supported",{description:"Contact [email protected] if you need help."}),T.current&&(T.current.value="");return}if(n.size>Z){v.oR.error('"'.concat(n.name,'" exceeds the ').concat(_,"MB limit"),{description:"Contact [email protected] if you need help."}),T.current&&(T.current.value="");return}et([{id:t,file:n}]);return}var a=X-J.length,o=e.filter(function(e){var t;return(null==(t=e.type)?void 0:t.startsWith("image/"))?!(e.size>Z)||(v.oR.error('"'.concat(e.name,'" exceeds the ').concat(_,"MB limit"),{description:"Contact [email protected] if you need help."}),!1):(v.oR.error('"'.concat(e.name,'" is not an image'),{description:"Contact [email protected] if you need help."}),!1)}).slice(0,Math.max(a,0));if(!o.length){if(J.length){var c=e.filter(function(e){var t;return null==(t=e.type)?void 0:t.startsWith("image/")});if(!c.length)return;for(var u=Math.min(c.length,J.length),d=J.slice(-u),f=[],m=0;m<u;m+=1){var h,p=null==(h=d[d.length-1-m])?void 0:h.id,g=c[m];p&&g&&f.push({id:p,file:g})}f.length&&et(f)}T.current&&(T.current.value="");return}a<e.length&&v.oR.message("Only the first ".concat(o.length," image(s) will be added"));var b=o.map(function(e){return{id:"".concat(e.name,"-").concat(e.lastModified,"-").concat(Math.random()),preview:URL.createObjectURL(e),file:e,size:e.size,status:"uploading",uploadKey:"".concat(Date.now(),"-").concat(Math.random())}});(0,x.sx)("image_upload_start",{file_count:b.length,total_size_kb:Math.round(b.reduce(function(e,t){return e+(t.size||0)},0)/1024)}),Q(function(e){return(0,l._)(e).concat((0,l._)(b))}),j(b.map(function(e){return e.file})).then(function(e){if(e.length!==b.length)throw Error("Upload result count mismatch");(0,x.sx)("image_upload_success",{file_count:e.length}),Q(function(t){return t.map(function(t){var r=b.findIndex(function(e){return e.id===t.id});if(-1===r)return t;var n=b[r],a=e[r];return!a||t.uploadKey&&(null==n?void 0:n.uploadKey)&&t.uploadKey!==n.uploadKey?t:(t.preview.startsWith("blob:")&&URL.revokeObjectURL(t.preview),(0,i._)((0,s._)({},t),{preview:a,url:a,status:"uploaded",file:void 0}))})})}).catch(function(e){(0,x.sx)("image_upload_error",{error:(null==e?void 0:e.message)||"unknown"}),console.error("Upload failed:",e),v.oR.error((null==e?void 0:e.message)?"Upload failed: ".concat(e.message):"Upload failed",{description:"Please try again or contact [email protected]"}),Q(function(e){return e.map(function(e){var t=b.find(function(t){return t.id===e.id});return!t||e.uploadKey&&t.uploadKey&&e.uploadKey!==t.uploadKey?e:(0,i._)((0,s._)({},e),{status:"error"})})})}),T.current&&(T.current.value="")},en=function(e){Q(function(t){var r=t.filter(function(t){return t.id!==e}),n=t.find(function(t){return t.id===e});return(null==n?void 0:n.preview.startsWith("blob:"))&&URL.revokeObjectURL(n.preview),r})},ea=function(){var e;ee()&&(null==(e=T.current)||e.click())},es=function(e){F.current=e,ea()},ei=(0,d.useMemo)(function(){return"".concat(J.length,"/").concat(X)},[J.length,X]),eo="stack"===E&&r,el="composer"===E,ec=J.some(function(e){return"uploading"===e.status}),eu=J.some(function(e){return"error"===e.status}),ed=J.slice(0,3),ef=["translate-x-0 translate-y-0 rotate-0","translate-x-3 translate-y-2 rotate-[5deg]","translate-x-6 translate-y-4 rotate-[10deg]"];return(0,u.jsxs)("div",{ref:I,className:(0,b.cn)("relative focus:outline-none",q&&"ring-primary/70 ring-offset-background ring-2 ring-offset-2",A),tabIndex:0,onPaste:function(e){if(!ee())return void e.preventDefault();var t,r=Array.from((null==(t=e.clipboardData)?void 0:t.items)||[]).filter(function(e){return"file"===e.kind&&e.type.startsWith("image/")}).map(function(e){return e.getAsFile()}).filter(Boolean);r.length&&(e.preventDefault(),er(r))},onDragEnter:function(e){e.preventDefault(),e.stopPropagation(),W.current+=1,$(!0)},onDragOver:function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",q||$(!0)},onDragLeave:function(e){e.preventDefault(),e.stopPropagation(),W.current-=1,W.current<=0&&(W.current=0,$(!1))},onDrop:function(e){if(e.preventDefault(),e.stopPropagation(),W.current=0,$(!1),ee()){var t,r=Array.from((null==(t=e.dataTransfer)?void 0:t.files)||[]).filter(function(e){var t;return null==(t=e.type)?void 0:t.startsWith("image/")});r.length&&er(r)}},children:[q&&(0,u.jsx)("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center bg-black/10 backdrop-blur-sm",children:(0,u.jsx)("div",{className:"bg-background/80 text-foreground rounded-full px-4 py-2 text-sm font-medium shadow-sm",children:"Drop to upload"})}),(0,u.jsx)("input",{ref:T,type:"file",accept:void 0===k?"image/*":k,multiple:r,onChange:function(e){var t=Array.from(e.target.files||[]);t.length&&er(t)},className:"hidden"}),S&&(0,u.jsx)("div",{className:"text-foreground flex items-center justify-between text-sm font-medium",children:(0,u.jsxs)("div",{className:"flex items-center gap-2",children:[(0,u.jsx)(p.A,{className:"text-primary h-4 w-4"}),(0,u.jsx)("span",{children:S}),(0,u.jsxs)("span",{className:"text-primary text-xs",children:["(",ei,")"]})]})}),eo&&!V&&(0,u.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,u.jsx)("button",{type:"button",onClick:J.length?function(){return G(!0)}:ea,className:"group focus-visible:ring-primary/70 relative h-36 w-40 rounded-2xl focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","aria-label":J.length?"Expand reference images":"Upload reference image",children:J.length>0?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:"absolute inset-x-4 top-2 h-[120px]",children:(0,l._)(ed).reverse().map(function(e,t){var r=ed.length-1-t;return(0,u.jsxs)("div",{className:(0,b.cn)("border-border bg-background absolute top-0 left-0 h-28 w-28 overflow-hidden rounded-xl border p-1 shadow-md transition-shadow group-hover:shadow-lg",ef[r]),children:[(0,u.jsx)("img",{src:e.preview,alt:"Reference",className:"h-full w-full rounded-lg object-cover"}),"uploading"===e.status&&(0,u.jsx)("div",{className:"absolute inset-1 flex items-center justify-center rounded-lg bg-black/60 text-[11px] font-medium text-white",children:"Uploading..."}),"error"===e.status&&(0,u.jsx)("div",{className:"absolute inset-1 flex items-center justify-center rounded-lg bg-red-500/75 text-[11px] font-medium text-white",children:"Failed"})]},e.id)})}),(0,u.jsx)("span",{className:"bg-primary text-primary-foreground absolute top-0 right-0 rounded-full px-2 py-1 text-[11px] font-semibold shadow-sm",children:ei}),(0,u.jsx)("span",{className:"bg-background/90 text-muted-foreground absolute right-1 bottom-2 left-1 rounded-full px-3 py-1 text-xs font-medium shadow-sm backdrop-blur",children:ec?"Uploading...":eu?"Check failed upload":"Click to manage"})]}):(0,u.jsxs)("div",{className:"border-border bg-muted/50 hover:bg-muted flex h-full w-full flex-col items-center justify-center gap-2 rounded-2xl border border-dashed transition-colors",children:[(0,u.jsx)("div",{className:"border-border flex h-10 w-10 items-center justify-center rounded-full border border-dashed",children:(0,u.jsx)(f.A,{className:"h-5 w-5"})}),(0,u.jsx)("span",{className:"text-sm font-medium",children:"Upload"}),(0,u.jsxs)("span",{className:"text-primary text-xs",children:["Max ",_,"MB"]})]})}),J.length>0&&J.length<X&&(0,u.jsxs)(g.$,{type:"button",size:"sm",variant:"outline",className:"h-8 rounded-lg px-3 text-xs",onClick:ea,children:[(0,u.jsx)(f.A,{className:"mr-1.5 h-4 w-4"}),"Add image"]})]}),eo&&V&&(0,u.jsxs)("div",{className:"bg-popover text-popover-foreground border-border absolute top-1/2 left-full z-50 ml-3 w-[360px] -translate-y-1/2 roun
1ded-xl border p-3 shadow-xl max-[900px]:top-full max-[900px]:right-0 max-[900px]:left-auto max-[900px]:mt-3 max-[900px]:ml-0 max-[900px]:w-[min(360px,calc(100vw-2rem))] max-[900px]:translate-y-0",children:[(0,u.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,u.jsxs)("div",{className:"min-w-0",children:[(0,u.jsx)("div",{className:"text-sm font-semibold",children:"Reference Images"}),(0,u.jsx)("div",{className:"text-muted-foreground text-xs",children:ei})]}),(0,u.jsx)(g.$,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 shrink-0 rounded-full",onClick:function(){return G(!1)},"aria-label":"Close reference image manager",children:(0,u.jsx)(m.A,{className:"h-4 w-4"})})]}),(0,u.jsxs)("div",{className:"grid max-h-[360px] grid-cols-3 gap-2 overflow-y-auto pr-1",children:[J.map(function(e){return(0,u.jsx)("div",{className:"group border-border bg-muted/50 hover:border-border hover:bg-muted relative overflow-hidden rounded-xl border p-1 shadow-sm transition",children:(0,u.jsxs)("div",{className:"relative overflow-hidden rounded-lg",children:[(0,u.jsx)("img",{src:e.preview,alt:"Reference",className:"h-24 w-full rounded-lg object-cover"}),e.size&&(0,u.jsx)("span",{className:"bg-background/90 text-muted-foreground absolute bottom-1.5 left-1.5 rounded-md px-1.5 py-0.5 text-[10px] font-medium shadow-sm",children:w(e.size)}),"uploading"!==e.status&&(0,u.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/35 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",children:(0,u.jsx)(g.$,{type:"button",size:"icon",variant:"secondary",className:"bg-background/60 text-foreground hover:bg-background/70 h-8 w-8 rounded-full shadow-sm backdrop-blur focus-visible:ring-2 focus-visible:ring-white/70",onClick:function(){return es(e.id)},"aria-label":"Upload a new image to replace",children:(0,u.jsx)(h.A,{className:"h-4 w-4"})})}),"uploading"===e.status&&(0,u.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/60 text-xs font-medium text-white",children:"Uploading..."}),"error"===e.status&&(0,u.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-red-500/70 text-xs font-medium text-white",children:"Failed"}),(0,u.jsx)(g.$,{size:"icon",variant:"destructive",className:"absolute top-1.5 right-1.5 z-20 h-6 w-6",onClick:function(){return en(e.id)},"aria-label":"Remove image",children:(0,u.jsx)(m.A,{className:"h-4 w-4"})})]})},e.id)}),J.length<X&&(0,u.jsx)("div",{className:"group border-border bg-muted/50 hover:border-border hover:bg-muted relative overflow-hidden rounded-xl border border-dashed p-1 shadow-sm transition",children:(0,u.jsx)("div",{className:"relative overflow-hidden rounded-lg",children:(0,u.jsxs)("button",{type:"button",className:"flex h-24 w-full flex-col items-center justify-center gap-2",onClick:ea,children:[(0,u.jsx)("div",{className:"border-border flex h-8 w-8 items-center justify-center rounded-full border border-dashed",children:(0,u.jsx)(f.A,{className:"h-4 w-4"})}),(0,u.jsx)("span",{className:"text-xs font-medium",children:"Add"})]})})})]})]}),el&&(0,u.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[J.map(function(e){return(0,u.jsxs)("div",{className:"group border-border bg-muted/50 relative h-16 w-16 overflow-hidden rounded-xl border p-0.5 shadow-sm",children:[(0,u.jsx)("img",{src:e.preview,alt:"Reference",className:"h-full w-full rounded-[10px] object-cover"}),"uploading"===e.status&&(0,u.jsx)("div",{className:"absolute inset-0 flex items-center justify-center rounded-xl bg-black/60 text-[10px] font-medium text-white",children:"Uploading"}),"error"===e.status&&(0,u.jsx)("div",{className:"absolute inset-0 flex items-center justify-center rounded-xl bg-red-500/75 text-[10px] font-medium text-white",children:"Failed"}),(0,u.jsx)(g.$,{size:"icon",variant:"destructive",className:"absolute -top-1 -right-1 z-20 h-5 w-5 opacity-100 shadow-sm sm:opacity-0 sm:transition-opacity sm:group-hover:opacity-100",onClick:function(){return en(e.id)},"aria-label":"Remove image",children:(0,u.jsx)(m.A,{className:"h-3.5 w-3.5"})})]},e.id)}),J.length<X&&(0,u.jsxs)("button",{type:"button",className:"border-border bg-muted/40 hover:bg-muted text-muted-foreground hover:text-foreground flex h-16 w-16 flex-col items-center justify-center gap-1 rounded-xl border border-dashed text-xs font-medium transition-colors",onClick:ea,children:[(0,u.jsx)(f.A,{className:"h-4 w-4"}),"Add"]})]}),!eo&&!el&&(0,u.jsxs)("div",{className:(0,b.cn)("flex flex-wrap gap-4",r?"flex-wrap":"flex-nowrap"),children:[J.map(function(e){return(0,u.jsx)("div",{className:"group border-border bg-muted/50 hover:border-border hover:bg-muted relative overflow-hidden rounded-xl border p-1 shadow-sm transition",children:(0,u.jsxs)("div",{className:"relative overflow-hidden rounded-lg",children:[(0,u.jsx)("img",{src:e.preview,alt:"Reference",className:"h-32 w-32 rounded-lg object-cover"}),e.size&&(0,u.jsx)("span",{className:"bg-background text-muted-foreground absolute bottom-2 left-2 rounded-md px-2 py-1 text-[10px] font-medium",children:w(e.size)}),"uploading"!==e.status&&(0,u.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/35 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",children:(0,u.jsx)(g.$,{type:"button",size:"icon",variant:"secondary",className:"bg-background/50 text-foreground hover:bg-background/50 h-10 w-10 rounded-full shadow-sm backdrop-blur focus-visible:ring-2 focus-visible:ring-white/70",onClick:function(){return es(e.id)},"aria-label":"Upload a new image to replace",children:(0,u.jsx)(h.A,{className:"h-5 w-5"})})}),"uploading"===e.status&&(0,u.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/60 text-xs font-medium text-white",children:"Uploading..."}),"error"===e.status&&(0,u.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-red-500/70 text-xs font-medium text-white",children:"Failed"}),(0,u.jsx)(g.$,{size:"icon",variant:"destructive",className:"absolute top-2 right-2 z-20 h-7 w-7",onClick:function(){return en(e.id)},"aria-label":"Remove image",children:(0,u.jsx)(m.A,{className:"h-4 w-4"})})]})},e.id)}),J.length<X&&(0,u.jsx)("div",{className:"group border-border bg-muted/50 hover:border-border hover:bg-muted relative overflow-hidden rounded-xl border border-dashed p-1 shadow-sm transition",children:(0,u.jsx)("div",{className:"relative overflow-hidden rounded-lg",children:(0,u.jsxs)("button",{type:"button",className:"flex h-32 w-32 flex-col items-center justify-center gap-2",onClick:ea,children:[(0,u.jsx)("div",{className:"border-border flex h-10 w-10 items-center justify-center rounded-full border border-dashed",children:(0,u.jsx)(f.A,{className:"h-5 w-5"})}),(0,u.jsx)("span",{className:"text-xs font-medium",children:"Upload"}),(0,u.jsxs)("span",{className:"text-primary text-xs",children:["Max ",_,"MB"]})]})})})]}),!S&&z&&(0,u.jsx)("div",{className:"text-muted-foreground text-xs",children:z})]})}},1632:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Pagination:()=>y});var n=r(69140),a=r(31951),s=r(32812),i=r(20857),o=r(7907),l=r(20792),c=r(17619),u=r(80316),d=r(31959),f=r(42803),m=r(41156),h=function(e){var t=e.className,r=(0,o._)(e,["className"]);return(0,n.jsx)("nav",(0,s._)({role:"navigation","aria-label":"pagination",className:(0,f.cn)("mx-auto flex w-full",t)},r))};h.displayName="Pagination";var p=l.forwardRef(function(e,t){var r=e.className,a=(0,o._)(e,["className"]);return(0,n.jsx)("ul",(0,s._)({ref:t,className:(0,f.cn)("flex flex-row items-center gap-1",r)},a))});p.displayName="PaginationContent";var v=l.forwardRef(function(e,t){var r=e.className,a=(0,o._)(e,["className"]);return(0,n.jsx)("li",(0,s._)({ref:t,className:(0,f.cn)("",r)},a))});v.displayName="PaginationItem";var g=function(e){var t=e.className,r=e.isActive,a=e.size,i=(0,o._)(e,["className","isActive","size"]);return(0,n.jsx)("a",(0,s._)({"aria-current":r?"page":void 0,className:(0,f.cn)((0,m.r)({variant:r?"outline":"ghost",size:void 0===a?"icon":a}),t)},i))};g.displayName="PaginationLink";var x=function(e){var t=e.className,r=(0,o._)(e,["className"]);return(0,n.jsx)(g,(0,i._)((0,s._)({"aria-label":"Go to previous page",size:"default",className:(0,f.cn)("gap-1 pl-2.5",t)},r),{children:(0,n.jsx)(c.A,{className:"h-4 w-4"})}))};x.displayName="PaginationPrevious";var b=function(e){var t=e.className,r=(0,o._)(e,["className"]);return(0,n.jsx)(g,(0,i._)((0,s._)({"aria-label":"Go to next page",size:"default",className:(0,f.cn)("gap-1 pr-2.5",t)},r),{children:(0,n.jsx)(u.A,{className:"h-4 w-4"})}))};b.displayName="PaginationNext";var w=function(e){var t=e.className,r=(0,o._)(e,["className"]);
1return(0,n.jsxs)("span",(0,i._)((0,s._)({"aria-hidden":!0,className:(0,f.cn)("flex h-9 w-9 items-center justify-center",t)},r),{children:[(0,n.jsx)(d.A,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"More pages"})]}))};function j(e){var t=e.total,r=(e.perPage,e.currentPage),a=e.totalPages,s=e.onPageChange,i=e.showPreviousNext,o=e.className;return(0,n.jsx)(h,{className:o,children:(0,n.jsxs)(p,{className:"flex w-full justify-center",children:[(0,n.jsxs)("div",{className:"text-muted-foreground text-sm",children:["Total: ",t,", Page: ",r," / ",a]}),(0,n.jsx)("div",{className:"flex-1"}),i&&a&&r-1>=1?(0,n.jsx)(v,{className:"cursor-pointer",children:(0,n.jsx)(x,{onClick:function(){r-1>=1&&s(r-1)},className:"cursor-pointer"})},"prev"):null,N(r,a,s),i&&a&&r+1<=a?(0,n.jsx)(v,{className:"cursor-pointer",children:(0,n.jsx)(b,{onClick:function(){r+1<=a&&s(r+1)}})},"next"):null]})})}w.displayName="PaginationEllipsis";var N=function(e,t,r){var a=[];if(t<=6)for(var s=function(t){a.push((0,n.jsx)(v,{className:"cursor-pointer",children:(0,n.jsx)(g,{onClick:function(){return t!==e&&r(t)},isActive:t==e,className:"cursor-pointer",children:t})},"page-".concat(t)))},i=1;i<=t;i++)s(i);else{for(var o=function(t){a.push((0,n.jsx)(v,{children:(0,n.jsx)(g,{onClick:function(){return t!==e&&r(t)},isActive:t===e,className:"cursor-pointer",children:t})},"page-".concat(t)))},l=function(t){a.push((0,n.jsx)(v,{children:(0,n.jsx)(g,{onClick:function(){return t!==e&&r(t)},isActive:t===e,className:"cursor-pointer",children:t})},"page-".concat(t)))},c=1;c<=2;c++)o(c);2<e&&e<t-1&&(a.push((0,n.jsx)(w,{},"ellipsis-1")),a.push((0,n.jsx)(v,{children:(0,n.jsx)(g,{onClick:function(){return r(e)},isActive:!0,className:"cursor-pointer",children:e})},"page-current"))),a.push((0,n.jsx)(w,{},"ellipsis-2"));for(var u=t-1;u<=t;u++)l(u)}return a};function y(e){var t=e.total,r=e.limit,s=e.page,i=(e.url,e.className);r<=0&&(r=30);var o=Math.ceil(t/r),l=(0,a.usePathname)(),c=(0,a.useSearchParams)(),u=(0,a.useRouter)();return o<=1?null:(0,n.jsx)(j,{total:Number(t),perPage:Number(r),currentPage:Number(void 0===s?1:s),totalPages:Number(o),onPageChange:function(e){var t=new URLSearchParams(c);t.set("page",e.toString()),u.push("".concat(l,"?").concat(t.toString()))},showPreviousNext:!0,className:i})}},9017:(e,t,r)=>{"use strict";r.r(t),r.d(t,{MarkdownPreview:()=>l,getTocItems:()=>i});var n=r(69140),a=r(20792),s=r(82387);function i(e){if(!e)return[];for(var t,r=/^(#{1,6})\s+(.+)$/gm,n=[];null!==(t=r.exec(e));){var a=t[1].length,s=t[2].trim(),i=s.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fff]+/g,"-").replace(/(^-|-$)/g,"");n.push({id:i,text:s,level:a})}return n}r(70076),r(64147);var o=new s.A({html:!0,linkify:!0,breaks:!0});function l(e){var t=e.content,r=(0,a.useMemo)(function(){return t?o.render(t):""},[t]);return(0,n.jsx)("div",{className:"markdown-body",dangerouslySetInnerHTML:{__html:r}})}o.renderer.rules.heading_open=function(e,t){var r=e[t].markup.length,n=e[t+1];if(n&&"inline"===n.type){var a=n.content.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fff]+/g,"-").replace(/(^-|-$)/g,"");return"<h".concat(r,' id="').concat(a,'">')}return"<h".concat(r,">")},o.renderer.rules.link_open=function(e,t,r,n,a){var s=e[t];if(s.attrIndex("href")>=0){var i=s.attrGet("href");s.attrSet("rel","nofollow"),i&&(i.startsWith("http://")||i.startsWith("https://"))&&s.attrSet("target","_blank")}return a.renderToken(e,t,r)}},10938:(e,t,r)=>{"use strict";r.d(t,{GB:()=>l,IB:()=>s,L$:()=>a,b:()=>o,q:()=>i});var n=r(82570),a={en:"English"},s=["en"],i=n.b.locale,o="as-needed",l=!1},18572:(e,t,r)=>{"use strict";r.d(t,{PW:()=>s,pr:()=>a});var n=r(23927),a=function(e){var t=localStorage.getItem(e);if(!t)return null;var r=t.split(":");if(!r||r.length<2)return t;var a=Number(r[0]),s=(0,n.lg)();if(a>0&&a<s)return i(e),null;var o=r[0]+":";return t.replace(o,"")},s=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!r)return void localStorage.setItem(e,t);localStorage.setItem(e,r+":"+t)},i=function(e){localStorage.removeItem(e)}},18617:(e,t,r)=>{"use strict";r.d(t,{I:()=>p,SQ:()=>h,_2:()=>v,hO:()=>g,lp:()=>x,mB:()=>b,rI:()=>f,ty:()=>m});var n=r(86706),a=r(56480),s=r(32812),i=r(20857),o=r(7907),l=r(69140);r(20792);var c=r(7687),u=r(65484),d=r(42803);function f(e){var t=e.modal,r=(0,o._)(e,["modal"]);return(0,l.jsx)(c.bL,(0,s._)({"data-slot":"dropdown-menu",modal:void 0!==t&&t},r))}function m(e){var t=(0,n._)({},(0,a._)(e));return(0,l.jsx)(c.l9,(0,s._)({"data-slot":"dropdown-menu-trigger"},t))}function h(e){var t=e.className,r=e.sideOffset,n=(0,o._)(e,["className","sideOffset"]);return(0,l.jsx)(c.ZL,{children:(0,l.jsx)(c.UC,(0,s._)({"data-slot":"dropdown-menu-content",sideOffset:void 0===r?4:r,className:(0,d.cn)("bg-popover text-popover-foreground 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]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t)},n))})}function p(e){var t=(0,n._)({},(0,a._)(e));return(0,l.jsx)(c.YJ,(0,s._)({"data-slot":"dropdown-menu-group"},t))}function v(e){var t=e.className,r=e.inset,n=e.variant,a=(0,o._)(e,["className","inset","variant"]);return(0,l.jsx)(c.q7,(0,s._)({"data-slot":"dropdown-menu-item","data-inset":r,"data-variant":void 0===n?"default":n,className:(0,d.cn)("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t)},a))}function g(e){var t=e.className,r=e.children,n=e.checked,a=(0,o._)(e,["className","children","checked"]);return(0,l.jsxs)(c.H_,(0,i._)((0,s._)({"data-slot":"dropdown-menu-checkbox-item",className:(0,d.cn)("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),checked:n},a),{children:[(0,l.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,l.jsx)(c.VF,{children:(0,l.jsx)(u.A,{className:"size-4"})})}),r]}))}function x(e){var t=e.className,r=e.inset,n=(0,o._)(e,["className","inset"]);return(0,l.jsx)(c.JU,(0,s._)({"data-slot":"dropdown-menu-label","data-inset":r,className:(0,d.cn)("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t)},n))}function b(e){var t=e.className,r=(0,o._)(e,["className"]);return(0,l.jsx)(c.wv,(0,s._)({"data-slot":"dropdown-menu-separator",className:(0,d.cn)("bg-border -mx-1 my-1 h-px",t)},r))}},19238:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LocaleDetector:()=>g});var n=r(57505),a=r(69140),s=r(20792),i=r(31951),o=r(41936),l=r(45951),c=r(28632),u=r(82570),d=r(10938),f=r(41156),m=r(18572),h=r(23927),p="locale-suggestion-dismissed",v="locale";function g(){if("true"!==u.b.locale_detect_enabled)return null;var e=(0,l.Ym)(),t=(0,c.rd)(),r=(0,c.a8)(),g=(0,i.useSearchParams)(),x=(0,n._)((0,s.useState)(!1),2),b=x[0],w=x[1],j=(0,n._)((0,s.useState)(null),2),N=j[0],y=j[1],_=(0,n._)((0,s.useState)(0),2),k=_[0],S=_[1],z=(0,s.useRef)(null),A=(0,s.useRef)(!1),C=function(){var e=(navigator.language||navigator.userLanguage).split("-")[0].toLowerCase();return d.IB.includes(e)?e:null},R=function(){var e=(0,h.lg)()+86400;(0,m.PW)(p,"true",e)},E=(0,s.useCallback)(function(e){var n,a,s=null!=(a=null==g||null==(n=g.toString)?void 0:n.call(g))?a:"",i=s?"".concat(r,"?").concat(s):r;t.replace(i,{locale:e}),(0,m.PW)(v,e),w(!1)},[t,r,g]);(0,s.useEffect)(function(){if(!A.current){A.current=!0;var t=C();y(t);var r=!!(0,m.pr)(p),n=(0,m.pr)(v);if(n&&n!==e&&d.IB.includes(n))return void E(n);!t||t===e||r||n||w(!0)}},[e,E]),(0,s.useEffect)(function(){if(b&&z.current){var e=z.current.offsetHeight;S(e);var t=document.querySelector("header");t&&(t.style.top="".concat(e,"px"));var r=document.querySelector('[data-slot="sidebar-container"]');r&&(r.style.top="".concat(e,"px"),r.style.height="calc(100vh - ".concat(e,"px)"));var n=document.querySelector('[data-slot="sidebar-wrapper"]');n&&(n.style.paddingTop="".concat(e,"px"))}else S(0);return function(){var e=document.querySelector("header");e&&(e.style.top="0px");var t=document.querySelector('[data-slot="sidebar-container"]');t&&(t.style.top="0px",t.style.height="100vh");var r=document.querySelector('[data-slot="sidebar-wrapper"]');r&&(r.style.paddingTop="0px")}},[b]),(0,s.useEffect)(function(){if(b&&z.current){var e=function(){z.current&&S(z.current.offsetHeight)};e();var t=new ResizeObserver(e);return t.observe(z.current),window.addEventListener("resize",e),function(){t.disconnect(),window.removeEventListener("resize",e)}}},[b]);var L=d.L$[N]||N;return b&&N?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{ref:z,className:"from-primary to-primary/80 text-primary-foreground fixed top-0 right-0 left-0 z-[51] hidden bg-gradient-to-r shadow-lg md:block",children:(0,a.jsx)("div",{className:"container py-2.5",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("div",{className:"flex flex-1 items-center gap-3",children:(0,a.jsx)("span",{className:"text-sm",children:"zh"===N?"æ£æµå°æµè§å¨è¯è¨æ¯: ".concat(L,"ï¼æ¯å¦åæ¢ï¼"):"We detected your browser language is ".concat(L,". Switch to it?")})}),(0,a.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-2",children:[(0,a.jsx)(f.$,{onClick:function(){N&&E(N)},variant:"secondary",size:"sm",className:"bg-background text-xs",children:"zh"===N?"忢å°ä¸æ":"Switch"}),(0,a.jsx)("button",{onClick:function(){R(),w(!1),S(0);var e=document.querySelector("header");e&&(e.style.top="0px");var t=document.querySelector('[data-slot="sidebar-container"]');t&&(t.style.top="0px",t.style.height="100vh");var r=document.querySelector('[data-slot="sidebar-wrapper"]');r&&(r.style.paddingTop="0px")},className:"bg-primary/10 flex-shrink-0 rounded p-1 transition-colors","aria-label":"Close",children:(0,a.jsx)(o.A,{className:"h-4 w-4"})})]})]})})}),(0,a.jsx)("div",{"aria-hidden":"true",style:{height:k},className:"pointer-events-none"})]}):null}},19565:(e,t,r)=>{"use strict";r.r(t),r.d(t,{VideoUploader:()=>v});var n=r(76471),a=r(57505),s=r(3395),i=r(69140),o=r(20792),l=r(8483),c=r(34448),u=r(83659),d=r(70682),f=r(41156),m=r(5029),h=r(42803),p=function(e){if(!e)return"";if(e<1024)return"".concat(e," B");var t=e/1024;if(t<1024)return"".concat(t.toFixed(1)," KB");var r=t/1024;return"".concat(r.toFixed(1)," MB")};function v(e){var t=e.maxSizeMB,r=void 0===t?100:t,v=e.accept,g=e.title,x=e.emptyHint,b=e.className,w=e.onCh
1ange,j=(0,o.useRef)(null),N=(0,o.useRef)(w),y=(0,o.useRef)(0),_=(0,o.useRef)(null),k=(0,a._)((0,o.useState)(!1),2),S=k[0],z=k[1],A=(0,a._)((0,o.useState)({status:"idle"}),2),C=A[0],R=A[1],E=(0,a._)((0,o.useState)(null),2),L=E[0],U=E[1],P=1024*r*1024;(0,o.useEffect)(function(){N.current=w},[w]),(0,o.useEffect)(function(){var e;null==(e=N.current)||e.call(N,C)},[C]),(0,o.useEffect)(function(){return function(){(null==L?void 0:L.startsWith("blob:"))&&URL.revokeObjectURL(L)}},[L]);var M=function(e){if(!e.type.startsWith("video/"))return void d.oR.error("Only video files are supported (MP4, MOV)",{description:"Contact [email protected] if you need help."});if(e.size>P)return void d.oR.error('"'.concat(e.name,'" exceeds the ').concat(r,"MB limit"),{description:"Contact [email protected] if you need help."});(null==L?void 0:L.startsWith("blob:"))&&URL.revokeObjectURL(L),(0,m.sx)("video_upload_start",{file_size_kb:Math.round(e.size/1024)}),U(URL.createObjectURL(e));var t="".concat(Date.now(),"-").concat(Math.random());_.current=t,R({status:"uploading",filename:e.name,size:e.size}),(0,n._)(function(){var t,r,n,a;return(0,s.YH)(this,function(s){switch(s.label){case 0:return(r=new FormData).append("file",e),[4,fetch("/api/storage/upload-video",{method:"POST",body:r})];case 1:if(!(n=s.sent()).ok)throw Error("Upload failed with status ".concat(n.status));return[4,n.json()];case 2:if(0!==(a=s.sent()).code||!(null==(t=a.data)?void 0:t.url))throw Error(a.message||"Upload failed");return[2,a.data.url]}})})().then(function(r){_.current===t&&((0,m.sx)("video_upload_success"),(null==L?void 0:L.startsWith("blob:"))&&URL.revokeObjectURL(L),U(r),R({url:r,status:"uploaded",filename:e.name,size:e.size}))}).catch(function(r){_.current===t&&((0,m.sx)("video_upload_error",{error:(null==r?void 0:r.message)||"unknown"}),console.error("Video upload failed:",r),d.oR.error((null==r?void 0:r.message)?"Upload failed: ".concat(r.message):"Video upload failed",{description:"Please try again or contact [email protected]"}),R({status:"error",filename:e.name,size:e.size}))}).finally(function(){j.current&&(j.current.value="")}
1)},T="idle"!==C.status;return(0,i.jsxs)("div",{className:(0,h.cn)("relative focus:outline-none",S&&"ring-primary/70 ring-offset-background ring-2 ring-offset-2",b),tabIndex:0,onDragEnter:function(e){e.preventDefault(),e.stopPropagation(),y.current+=1,z(!0)},onDragOver:function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",S||z(!0)},onDragLeave:function(e){e.preventDefault(),e.stopPropagation(),y.current-=1,y.current<=0&&(y.current=0,z(!1))},onDrop:function(e){e.preventDefault(),e.stopPropagation(),y.current=0,z(!1);var t,r=Array.from((null==(t=e.dataTransfer)?void 0:t.files)||[]).find(function(e){return e.type.startsWith("video/")});r&&M(r)},children:[S&&(0,i.jsx)("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center bg-black/10 backdrop-blur-sm",children:(0,i.jsx)("div",{className:"bg-background/80 text-foreground rounded-full px-4 py-2 text-sm font-medium shadow-sm",children:"Drop to upload"})}),(0,i.jsx)("input",{ref:j,type:"file",accept:void 0===v?"video/mp4,video/quicktime":v,onChange:function(e){var t,r=null==(t=e.target.files)?void 0:t[0];r&&M(r)},className:"hidden"}),g&&(0,i.jsxs)("div",{className:"text-foreground mb-2 flex items-center gap-2 text-sm font-medium",children:[(0,i.jsx)(u.A,{className:"text-primary h-4 w-4"}),(0,i.jsx)("span",{children:g})]}),T?(0,i.jsx)("div",{className:"border-border bg-muted/50 relative overflow-hidden rounded-xl border p-3",children:(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[L&&"uploaded"===C.status?(0,i.jsx)("video",{src:L,className:"h-20 w-28 rounded-lg object-cover",muted:!0,preload:"metadata"}):(0,i.jsx)("div",{className:"bg-muted flex h-20 w-28 items-center justify-center rounded-lg",children:(0,i.jsx)(u.A,{className:"text-muted-foreground h-8 w-8"})}),(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsx)("p",{className:"truncate text-sm font-medium",children:C.filename||"Video"}),C.size&&(0,i.jsx)("p",{className:"text-muted-foreground text-xs",children:p(C.size)}),"uploading"===C.status&&(0,i.jsx)("p",{className:"text-primary mt-1 text-xs font-medium",children:"Uploading..."}),"uploaded"===C.status&&(0,i.jsx)("p",{className:"mt-1 text-xs font-medium text-green-600",children:"Uploaded"}),"error"===C.status&&(0,i.jsx)("p",{className:"text-destructive mt-1 text-xs font-medium",children:"Upload failed"})]}),(0,i.jsx)(f.$,{size:"icon",variant:"ghost",className:"h-8 w-8 shrink-0",onClick:function(){(null==L?void 0:L.startsWith("blob:"))&&URL.revokeObjectURL(L),U(null),_.current=null,R({status:"idle"}),j.current&&(j.current.value="")},"aria-label":"Remove video",children:(0,i.jsx)(l.A,{className:"h-4 w-4"})})]})}):(0,i.jsxs)("button",{type:"button",className:"border-border bg-muted/30 hover:border-primary/50 hover:bg-muted/50 flex w-full flex-col items-center justify-center gap-2 rounded-xl border border-dashed px-4 py-6 transition-colors",onClick:function(){var e;null==(e=j.current)||e.click()},children:[(0,i.jsx)("div",{className:"border-border flex h-10 w-10 items-center justify-center rounded-full border border-dashed",children:(0,i.jsx)(c.A,{className:"h-5 w-5"})}),(0,i.jsx)("span",{className:"text-xs font-medium",children:x||"Upload video"}),(0,i.jsxs)("span",{className:"text-primary text-xs",children:["MP4 / MOV, max ",r,"MB"]})]})]})}},19796:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ThemeToggler:()=>k});var n=r(57505),a=r(69140),s=r(20792),i=r(44801),o=r(32741),l=r(5394),c=r(91442),u=r(76471),d=r(3395),f=r(90745),m=r(42803),h=function(e){var t=e.className,r=(0,c.D)(),l=r.theme,h=r.setTheme,p=(0,n._)((0,s.useState)(!1),2),v=p[0],g=p[1],x=(0,n._)((0,s.useState)(!1),2),b=x[0],w=x[1];(0,s.useEffect)(function(){w(!0),g("dark"===l)},[l]);var j=(0,s.useRef)(null);return b?(0,a.jsx)("button",{ref:j,onClick:function(){return(0,u._)(function(){var e,t,r,n,a,s,i,o,l;return(0,d.YH)(this,function(c){switch(c.label){case 0:if(!j.current)return[2];return[4,document.startViewTransition(function(){(0,f.flushSync)(function(){var e=document.documentElement.classList.toggle("dark");h(e?"dark":"light"),g(e)})}).ready];case 1:return c.sent(),t=(e=j.current.getBoundingClientRect()).top,r=e.left,n=e.width,a=t+e.height/2,s=r+n/2,i=window.innerWidth-r,o=window.innerHeight-t,l=Math.hypot(Math.max(r,
1i),Math.max(t,o)),document.documentElement.animate({clipPath:["circle(0px at ".concat(s,"px ").concat(a,"px)"),"circle(".concat(l,"px at ").concat(s,"px ").concat(a,"px)")]},{duration:700,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"}),[2]}})})()},className:(0,m.cn)(t),"aria-label":v?"Switch to light mode":"Switch to dark mode",children:v?(0,a.jsx)(i.A,{}):(0,a.jsx)(o.A,{})}):null},p=r(41156),v=r(32812),g=r(20857),x=r(7907),b=r(97419),w=(0,r(69231).F)("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),j=s.createContext({size:"default",variant:"default"});function N(e){var t=e.className,r=e.variant,n=e.size,s=e.children,i=(0,x._)(e,["className","variant","size","children"]);return(0,a.jsx)(b.bL,(0,g._)((0,v._)({"data-slot":"toggle-group","data-variant":r,"data-size":n,className:(0,m.cn)("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",t)},i),{children:(0,a.jsx)(j.Provider,{value:{variant:r,size:n},children:s})}))}function y(e){var t=e.className,r=e.children,n=e.variant,i=e.size,o=(0,x._)(e,["className","children","variant","size"]),l=s.useContext(j);return(0,a.jsx)(b.q7,(0,g._)((0,v._)({"data-slot":"toggle-group-item","data-variant":l.variant||n,"data-size":l.size||i,className:(0,m.cn)(w({variant:l.variant||n,size:l.size||i}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",t)},o),{children:r}))}var _=r(5029);function k(e){var t=e.type,r=void 0===t?"icon":t,u=e.className,d=e.source,f=void 0===d?"common":d,m=(0,c.D)(),v=m.theme,g=m.setTheme,x=(0,n._)((0,s.useState)(!1),2),b=x[0],w=x[1];return((0,s.useEffect)(function(){w(!0)},[]),b)?"button"===r?(0,a.jsx)(p.$,{variant:"outline",size:"sm",className:"hover:bg-primary/10",children:(0,a.jsx)(i.A,{})}):"toggle"===r?(0,a.jsxs)(N,{type:"single",className:" ".concat(u),value:v,onValueChange:function(e){e&&e!==v&&((0,_.sx)("theme_changed",{from_theme:v,to_theme:e,source:f,page_path:window.location.pathname}),g(e))},variant:"outline",children:[(0,a.jsx)(y,{value:"light","aria-label":"Switch to light mode",children:(0,a.jsx)(i.A,{})}),(0,a.jsx)(y,{value:"dark","aria-label":"Switch to dark mode",children:(0,a.jsx)(o.A,{})}),(0,a.jsx)(y,{value:"system","aria-label":"Switch to system mode",children:(0,a.jsx)(l.A,{})})]}):(0,a.jsx)(h,{className:u}):null}},23927:(e,t,r)=>{"use strict";r.d(t,{lg:()=>n});var n=function(){return Date.parse(new Date().toUTCString())/1e3}},28632:(e,t,r)=>{"use strict";r.d(t,{N_:()=>l,a8:()=>c,rd:()=>u});var n=r(46215),a=r(55055),s=r(10938),i=(0,a.A)({locales:s.IB,defaultLocale:s.q,localePrefix:s.b,localeDetection:s.GB}),o=(0,n.A)(i),l=o.Link,c=(o.redirect,o.usePathname),u=o.useRouter;o.getPathname},32859:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LocaleSelector:()=>g});var n=r(57505),a=r(69140),s=r(20792),i=r(31951),o=r(65083),l=r(42389),c=r(65484),u=r(45951),d=r(28632),f=r(10938),m=r(41156),h=r(18617),p=r(18572),v=r(5029);function g(e){var t,r,g=e.type,x=void 0===g?"icon":g,b=e.source,w=void 0===b?"common":b,j=(0,u.Ym)(),N=(0,d.rd)(),y=(0,d.a8)(),_=(0,i.useSearchParams)(),k=(0,n._)((0,s.useState)(!1),2),S=k[0],z=k[1],A=f.L$;(0,s.useEffect)(function(){z(!0)},[]);var C=function(e){if(e!==j){(0,v.sx)("locale_changed",{from_locale:j,to_locale:e,source:w,page_path:y}),(0,p.PW)("locale",e);var t,r,n=null!=(r=null==_||null==(t=_.toString)?void 0:t.call(_))?r:"",a=n?"".concat(y,"?").concat(n):y;N.push(a,{locale:e})}};return S?(0,a.jsxs)(h.rI,{children:[(0,a.jsx)(h.ty,{asChild:!0,children:"icon"===x?(0,a.jsx)(m.$,{variant:"ghost",size:"icon",className:"h-auto w-auto p-0","aria-label":"Switch language",children:(0,a.jsx)(o.A,{size:18})}):(0,a.jsxs)(m.$,{variant:"outline",size:"sm",className:"hover:bg-primary/10",children:[(0,a.jsx)(l.A,{size:16}
1),null!=(r=A[j])?r:j]})}),(0,a.jsx)(h.SQ,{children:Object.keys(f.L$).map(function(e){var t;return(0,a.jsxs)(h._2,{onClick:function(){return C(e)},children:[(0,a.jsx)("span",{children:null!=(t=A[e])?t:e}),e===j&&(0,a.jsx)(c.A,{size:16,className:"text-primary"})]},e)})})]}):(0,a.jsx)(m.$,{variant:"icon"===x?"ghost":"outline",size:"icon"===x?"icon":"sm",className:"icon"===x?"h-auto w-auto p-0":"hover:bg-primary/10","aria-label":"icon"===x?"Switch language":void 0,disabled:!0,children:"icon"===x?(0,a.jsx)(o.A,{size:18}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.A,{size:16}),null!=(t=A[j])?t:j]})})}},36651:(e,t,r)=>{"use strict";r.d(t,{Avatar:()=>l,AvatarFallback:()=>u,AvatarImage:()=>c});var n=r(32812),a=r(7907),s=r(69140);r(20792);var i=r(36156),o=r(42803);function l(e){var t=e.className,r=(0,a._)(e,["className"]);return(0,s.jsx)(i.bL,(0,n._)({"data-slot":"avatar",className:(0,o.cn)("relative flex size-8 shrink-0 overflow-hidden rounded-full",t)},r))}function c(e){var t=e.className,r=(0,a._)(e,["className"]);return(0,s.jsx)(i._V,(0,n._)({"data-slot":"avatar-image",className:(0,o.cn)("aspect-square size-full",t)},r))}function u(e){var t=e.className,r=(0,a._)(e,["className"]);return(0,s.jsx)(i.H4,(0,n._)({"data-slot":"avatar-fallback",className:(0,o.cn)("bg-muted flex size-full items-center justify-center rounded-full",t)},r))}},39118:(e,t,r)=>{"use strict";r.d(t,{L:()=>ee});
1var n=r(32812),a=r(7907),s=r(69140),i=r(3282),o=r(21309),l=r(88107),c=r(28891),u=r(6681),d=r(90094),f=r(74226),m=r(86892),h=r(21107),p=r(20810),v=r(21875),g=r(34888),x=r(38124),b=r(42477),w=r(67434),j=r(55042),N=r(41837),y=r(75774),_=r(9453),k=r(21115),S=r(5394),z=r(93838),A=r(58963),C=r(39891),R=r(40608),E=r(47431),L=r(97064),U=r(58141),P=r(86672),M=r(23405),T=r(23508),I=r(46452),D=r(472),O=r(98257),B=r(50815),F=r(96057),W=r(71089),H=r(1500),q=r(66221),$=r(4607),K=r(88236),V=r(72659),G=r(59310),Y=r(6546),J=r(80209),Q=r(15802),X={RiAddLine:Q.Ld_,RiDeleteBinLine:Q.WFf,RiEditLine:Q.Ics,RiEyeLine:Q.tLq,RiLockPasswordLine:Q.EhT,RiQuestionLine:Q.Kt4},Z={BadgeCheck:i.A,CheckCircle2:o.A,CircleHelp:l.A,Clapperboard:c.A,Code2:u.A,Coins:d.A,CreditCard:f.A,Download:m.A,Drama:h.A,Film:p.A,Gauge:v.A,Heart:g.A,HelpCircle:l.A,History:x.A,ImageIcon:b.A,Images:w.A,Layers:j.A,LayoutGrid:N.A,Maximize:y.A,Maximize2:_.A,MessageSquareText:k.A,Monitor:S.A,MousePointerClick:z.A,Move3D:A.A,Music:C.A,Paintbrush:R.A,Palette:E.A,PanelTop:L.A,Pencil:U.A,RefreshCw:P.A,ScanFace:M.A,Search:T.A,Share2:I.A,ShieldCheck:D.A,SlidersHorizontal:O.A,Sparkles:B.A,Tags:F.A,Target:W.A,Type:H.A,Upload:q.A,User:$.A,Users:K.A,WalletCards:V.A,Wand:G.A,WandSparkles:Y.A,Workflow:J.A};function ee(e){var t,r=e.name,i=e.size,o=e.className,c=(0,a._)(e,["name","size","className"]);return t="ri"==(r&&r.startsWith("Ri")?"ri":"lucide")?X[r]||Q.Kt4:Z[r]||l.A,(0,s.jsx)(t,(0,n._)({size:void 0===i?24:i,className:o},c))}},41156:(e,t,r)=>{"use strict";r.d(t,{$:()=>u,r:()=>c});
1var n=r(32812),a=r(7907),s=r(69140);r(20792);var i=r(15887),o=r(69231),l=r(42803),c=(0,o.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-7"}},defaultVariants:{variant:"default",size:"default"}});function u(e){var t=e.className,r=e.variant,o=e.size,u=e.asChild,d=(0,a._)(e,["className","variant","size","asChild"]),f=void 0!==u&&u?i.DX:"button";return(0,s.jsx)(f,(0,n._)({"data-slot":"button",className:(0,l.cn)(c({variant:r,size:o,className:t}))},d))}},41696:(e,t,r)=>{"use strict";r.r(t),r.d(t,{MarkdownEditor:()=>o});var n=r(57505),a=r(69140),s=r(20792),i=r(35811);function o(e){var t=e.value,r=e.onChange,o=e.placeholder,l=e.minHeight,c=void 0===l?400:l,u=e.showToolbar,d=(0,s.useRef)(null),f=(0,s.useRef)(null);return(0,s.useEffect)(function(){return f.current=(0,n._)(i.d.init(d.current,{value:t,onChange:r,placeholder:o,minHeight:c,showToolbar:u}),1)[0],function(){var e;return null==(e=f.current)?void 0:e.destroy()}},[]),(0,s.useEffect)(function(){f.current&&t!==f.current.getValue()&&f.current.setValue(t)},[t]),(0,a.jsx)("div",{className:"overflow-hidden rounded-md border",ref:d,style:{height:"400px"}})}},42140:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ErrorBoundary:()=>m});var n=r(57574),a=r(98111),s=r(16893),i=r(69140),o=r(20792),l=r(45530),c=r.n(l),u=r(41156),d=r(69177),f=r(39118),m=function(e){function t(){var e;return(0,a._)(this,t),e=(0,n._)(this,t,arguments),e.state={hasError:!1},e}(0,s._)(t,e);var r=t.prototype;return r.componentDidCatch=function(e,t){console.error("Uncaught error:",e,t)},r.render=function(){return(console.log("ErrorBoundary render",this.state),this.state.hasError)?this.props.fallback?this.props.fallback:(0,i.jsxs)("div",{className:"flex h-screen flex-col items-center justify-center gap-4",children:[(0,i.jsx)(d.ThemeLogo,{width:80,height:80}),(0,i.jsx)("h1",{className:"text-2xl font-normal",children:"Something went wrong"}),(0,i.jsx)("p",{className:"text-muted-foreground",children:"Please try refreshing the page or contact support if the problem persists."}),(0,i.jsx)(u.$,{asChild:!0,children:(0,i.jsxs)(c(),{href:"/",className:"mt-4",children:[(0,i.jsx)(f.L,{name:"ArrowLeft"}),(0,i.jsx)("span",{children:"Back to Home"})]})})]}):this.props.children},t.getDerivedStateFromError=function(e){return"NEXT_NOT_FOUND"===e.digest?{hasError:!1}:{hasError:!0}},t}(o.Component)},45037:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AudioPlayer:()=>c});var n=r(57505),a=r(69140),s=r(20792),i=r(29250),o=r(61402),l=r(42803);function c(e){var t=e.src,r=e.title,c=e.className,u=(0,s.useRef)(null),d=(0,n._)((0,s.useState)(!1),2),f=d[0],m=d[1],h=(0,n._)((0,s.useState)(0),2),p=h[0],v=h[1],g=(0,n._)((0,s.useState)(0),2),x=g[0],b=g[1],w=(0,n._)((0,s.useState)(1),2);w[0],w[1];var j=(0,n._)((0,s.useState)(!1),2);j[0],j[1],(0,s.useEffect)(function(){var e=u.current;if(e){var t=function(){return v(e.currentTime)},r=function(){return b(e.duration)},n=function(){return m(!1)};return e.addEventListener("timeupdate",t),e.addEventListener("loadedmetadata",r),e.addEventListener("ended",n),function(){e.removeEventListener("timeupdate",t),e.removeEventListener("loadedmetadata",r),e.removeEventListener("ended",n)}}},[]);var N=function(e){if(isNaN(e))return"0:00";var t=Math.floor(e/60),r=Math.floor(e%60);return"".concat(t,":").concat(r.toString().padStart(2,"0"))};return(0,a.jsxs)("div",{className:(0,l.cn)("bg-card text-card-foreground flex items-center gap-3 rounded-lg border p-3 shadow-sm",c),children:[(0,a.jsx)("audio",{ref:u,src:t,preload:"metadata"}),(0,a.jsx)("button",{onClick:function(){var e=u.current;e&&(f?e.pause():e.play(),m(!f))},className:"bg-primary text-primary-foreground hover:bg-primary/90 flex h-10 w-10 items-center justify-center rounded-full transition-colors","aria-label":f?"Pause":"Play",children:f?(0,a.jsx)(i.A,{className:"h-5 w-5"}):(0,a.jsx)(o.A,{className:"ml-0.5 h-5 w-5"})}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[r&&(0,a.jsx)("div",{className:"truncate text-sm font-medium",children:r}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-muted-foreground w-10 text-right text-xs",children:N(p)}),(0,a.jsx)("input",{type:"range",min:0,max:x||0,value:p,onChange:function(e){var t=u.current;if(t){var r=parseFloat(e.target.value);t.currentTime=r,v(r)}},className:"bg-secondary [&::-webkit-slider-thumb]:bg-primary [&::-moz-range-thumb]:bg-primary h-1 flex-1 cursor-pointer appearance-none rounded-lg [&::-moz-range-thumb]:h-3 [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full"}),(0,a.jsx)("span",{className:"text-muted-foreground w-10 text-xs",children:N(x)})]})]})]})}},45509:(e,t,r)=>{"use strict";r.d(t,{AppContextProvider:()=>w,U:()=>b});var n=r(76471),a=r(32812),s=r(20857),i=r(57505),o=r(3395),l=r(69140),c=r(20792),u=r(99156),d=r(82570),f=r(49835),m="shipany:account-snapsh
1ot:v1";function h(){try{var e,t=window.localStorage.getItem(m);if(!t)return null;var r=JSON.parse(t);if(1!==r.version||!(null==(e=r.user)?void 0:e.id))return p(),null;return{version:1,updatedAt:"number"==typeof r.updatedAt?r.updatedAt:Date.now(),user:v(r.user),isPaid:!0===r.isPaid,hasSubscription:!0===r.hasSubscription}}catch(e){return p(),null}}function p(){try{window.localStorage.removeItem(m)}catch(e){}}function v(e){var t,r,n=e.name||e.email||"User",a={id:String(e.id),name:n,email:null!=(t=e.email)?t:null,image:null!=(r=e.image)?r:null},s=g(e.credits);return s&&(a.credits=s),("free"===e.tier||"pro"===e.tier||"business"===e.tier||"lifetime"===e.tier)&&(a.tier=e.tier),a}function g(e){var t;if(e&&(void 0===e?"undefined":(0,f._)(e))==="object"&&"number"==typeof e.remainingCredits)return{remainingCredits:e.remainingCredits,isUnlimited:!0===e.isUnlimited,expiresAt:null!=(t=e.expiresAt)?t:null}}var x=(0,c.createContext)({}),b=function(){return(0,c.useContext)(x)},w=function(e){var t=e.children,r=(0,i._)((0,c.useState)({}),2),f=r[0],b=r[1],w=(0,i._)((0,c.useState)(null),2),j=w[0],N=w[1],y=(0,c.useRef)(null),_=(0,i._)((0,c.useState)(!0),2),k=_[0],S=_[1],z=(0,i._)((0,c.useState)(!1),2),A=z[0],C=z[1],R=(0,i._)((0,c.useState)(!1),2),E=R[0],L=R[1],U=(0,i._)((0,c.useState)(!1),2),P=U[0],M=U[1],T=(0,i._)((0,c.useState)(!1),2),I=T[0],D=T[1],O=(0,c.useCallback)(function(e){if(!(null==e?void 0:e.id))return void p();!function(e){var t=e.user,r=e.isPaid,n=e.hasSubscription;if(null==t?void 0:t.id)try{var i,o,l=h(),c=(null==l||null==(i=l.user)?void 0:i.id)===t.id?l.user:void 0,u=v((0,s._)((0,a._)({},c,t),{credits:null!=(o=g(t.credits))?o:null==c?void 0:c.credits})),d={version:1,updatedAt:Date.now(),user:u,isPaid:r,hasSubscription:n};window.localStorage.setItem(m,JSON.stringify(d))}catch(e){}}({user:e,isPaid:!1,hasSubscription:!1})},[]),B=(0,c.useCallback)(function(){y.current=null,N(null),C(!1),L(!1),p()},[]),F=(0,c.useCallback)(function(e){if(!e)return void B();y.current=e,N(e),C(!1),O(e)},[B,O]),W=(0,c.useCallback)(function(){return(0,n._)(function(){var e,t,r,n,a;return(0,o.YH)(this,function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),[4,fetch("/api/config/get-configs",{method:"POST"})];case 1:if(!(e=s.sent()).ok)throw Error("fetch failed with status: ".concat(e.status));return[4,e.json()];case 2:if(r=(t=s.sent()).code,n=t.message,a=t.data,0!==r)throw Error(n);return b(a),[3,4];case 3:return s.sent(),[3,4];case 4:return[2]}})})()},[]),H=(0,c.useCallback)(function(){return(0,n._)(function(){var e,t,r,n,i,l,c;return(0,o.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,3,,4]),!(e=y.current))return[2];return[4,fetch("/api/user/get-user-credits",{method:"POST"})];case 1:if(!(t=o.sent()).ok)throw Error("fetch failed with status: ".concat(t.status));return[4,t.json()];case 2:if(n=(r=o.sent()).code,i=r.message,l=r.data,0!==n){if(/no auth/i.test(i||""))return B(),[2];throw Error(i)}return y.current=c=(0,s._)((0,a._)({},e),{credits:l}),N(c),C(!1),O(c),[3,4];case 3:return o.sent(),[3,4];case 4:return[2]}})})()},[B,O]),q=(0,c.useCallback)(function(){return(0,n._)(function(){var e,t,r,n,a;return(0,o.YH)(this,function(s){switch(s.label){case 0:L(!0),s.label=1;case 1:return s.trys.push([1,4,5,6]),[4,fetch("/api/user/get-user-info",{method:"POST"})];case 2:if(!(e=s.sent()).ok)throw Error("fetch failed with status: ".concat(e.status));return[4,e.json()];case 3:if(r=(t=s.sent()).code,n=t.message,a=t.data,0!==r){if(/no auth/i.test(n||""))return B(),[2];throw Error(n)}if(!(null==a?void 0:a.id))return B(),[2];return y.current=a,N(a),C(!1),S(!1),[3,6];case 4:return s.sent(),y.current||B(),[3,6];case 5:return L(!1),S(!1),[7];case 6:return[2]}})})()},[B,O]),$=(0,c.useCallback)(function(e){return(0,n._)(function(){return(0,o.YH)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,u.ep)(e).oneTap({callbackURL:"/",onPromptNotification:function(e){}})];case 1:case 2:return t.sent(),[3,3];case 3:return[2]}})})()},[]);(0,c.useEffect)(function(){y.current=j},[j]),(0,c.useEffect)(function(){W()},[W]),(0,c.useEffect)(function(){d.b.auth_secret||S(!1);var e,t=h();if(null==t||null==(e=t.user)?void 0:e.id){var r=t.user;y.current=r,N(r),C(!0),S(!1)}q()},[q]);var K=(0,c.useMemo)(function(){return{user:j,setUser:F,isCheckSign:k,setIsCheckSign:S,accountFromSnapshot:A,accountRefreshing:E,isShowSignModal:P,setIsShowSignModal:M,isShowPaymentModal:I,setIsShowPaymentModal:D,c
1onfigs:f,fetchConfigs:W,fetchUserCredits:H,fetchUserInfo:q,showOneTap:$}},[j,k,A,E,P,I,f,W,H,q,$]);return(0,l.jsx)(x.Provider,{value:K,children:t})}},47472:(e,t,r)=>{"use strict";r.r(t),r.d(t,{BrandLogo:()=>l});var n=r(69140),a=r(13998),s=r(28632),i=r(82570),o=r(86681);function l(e){var t,r=e.brand,l=(null==(t=r.logo)?void 0:t.src)||i.b.app_logo;return(0,n.jsxs)(s.N_,{href:r.url||"",target:r.target||"_self",className:"flex items-center space-x-3 ".concat(r.className),children:[r.logo&&(0,n.jsx)(a.default,{src:l,alt:(0,o.WN)(r.logo.alt,(0,o.sE)(r.title)),width:r.logo.width||32,height:r.logo.height||32,className:"h-8 w-auto rounded-lg",unoptimized:!0}),r.title&&(0,n.jsx)("span",{className:"text-lg font-medium",children:r.title})]})}},58617:(e,t,r)=>{"use strict";r.r(t),r.d(t,{TopBanner:()=>f});var n=r(57505),a=r(69140),s=r(20792),i=r(41936),o=r(28632),l=r(41156),c=r(18572),u=r(23927),d=r(42803);function f(e){var t=e.enabled,r=void 0===t||t,f=e.id,m=void 0===f?"default":f,h=e.text,p=e.buttonText,v=e.href,g=e.target,x=void 0===g?"_self":g,b=e.closable,w=e.rememberDismiss,j=void 0===w||w,N=e.dismissedExpiryDays,y=void 0===N?7:N,_=e.className,k=e.onAction,S=(0,s.useMemo)(function(){return"top-banner-dismissed:".concat(m)},[m]),z=(0,n._)((0,s.useState)(!1),2),A=z[0],C=z[1],R=(0,n._)((0,s.useState)(0),2),E=R[0],L=R[1],U=(0,s.useRef)(null),P=(0,s.useRef)(!1),M=function(){if(j){var e=(0,u.lg)()+24*y*3600;(0,c.PW)(S,"true",e)}};if((0,s.useEffect)(function(){if(!P.current)P.current=!0,r&&(j&&(0,c.pr)(S)||C(!0))},[r]),(0,s.useEffect)(function(){if(A&&U.current){var e=U.current.offsetHeight;L(e);var t=document.querySelector("header");t&&(t.style.top="".concat(e,"px"));var r=document.querySelector('[data-slot="sidebar-container"]');r&&(r.style.top="".concat(e,"px"),r.style.height="calc(100vh - ".concat(e,"px)"));var n=document.querySelector('[data-slot="sidebar-wrapper"]');n&&(n.style.paddingTop="".concat(e,"px"))}else L(0);return function(){var e=document.querySelector("header");e&&(e.style.top="0px");var t=document.querySelector('[data-slot="sidebar-container"]');t&&(t.style.top="0px",t.style.height="100vh");var r=document.querySelector('[data-slot="sidebar-wrapper"]');r&&(r.style.paddingTop="0px")}},[A]),(0,s.useEffect)(function(){if(A&&U.current){var e=function(){U.current&&L(U.current.offsetHeight)};e();var t=new ResizeObserver(e);return t.observe(U.current),window.addEventListener("resize",e),function(){t.disconnect(),window.removeEventListener("resize",e)}}},[A]),!r||!A)return null;var T=!!p&&(!!v||!!k);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{ref:U,className:(0,d.cn)("from-primary to-primary text-primary-foreground fixed top-0 right-0 left-0 z-[51] hidden min-h-12 bg-gradient-to-r py-1 shadow-lg md:block",_),children:(0,a.jsx)("div",{className:"container py-2.5",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("div",{className:"flex flex-1 items-center justify-center gap-3",children:(0,a.jsx)("div",{className:"text-sm",dangerouslySetInnerHTML:{__html:String(null!=h?h:"")}})}),(0,a.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-2",children:[T?v?/^https?:\/\//i.test(v)||/^mailto:/i.test(v)||/^tel:/i.test(v)?(0,a.jsx)(l.$,{asChild:!0,variant:"secondary",size:"sm",className:"bg-background text-xs",children:(0,a.jsx)("a",{href:v,target:x,rel:"_blank"===x?"noreferrer noopener":void 0,children:p})}):(0,a.jsx)(l.$,{asChild:!0,variant:"secondary",size:"sm",className:"bg-background text-xs",children:(0,a.jsx)(o.N_,{href:v,children:p})}):(0,a.jsx)(l.$,{onClick:k,variant:"secondary",size:"sm",className:"bg-background text-xs",children:p}):null,void 0===b||b?(0,a.jsx)("button",{onClick:function(){M(),C(!1),L(0);var e=document.querySelector("header");e&&(e.style.top="0px");var t=document.querySelector('[data-slot="sidebar-container"]');t&&(t.style.top="0px",t.style.height="100vh");var r=document.querySelector('[data-slot="sidebar-wrapper"]');r&&(r.style.paddingTop="0px")},className:"bg-primary/10 flex-shrink-0 rounded p-1 transition-colors","aria-label":"Close",children:(0,a.jsx)(i.A,{className:"h-4 w-4"})}):null]})]})})}),(0,a.jsx)("div",{"aria-hidden":"true",style:{height:E},className:"pointer-events-none"})]})}},61960:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Copyright:()=>
1o});var n=r(57505),a=r(69140),s=r(20792),i=r(82570);function o(e){var t=e.brand,r=(0,n._)((0,s.useState)(null),2),o=r[0],l=r[1];return(0,s.useEffect)(function(){l(new Date().getFullYear())},[]),(0,a.jsxs)("div",{className:"text-muted-foreground text-sm",children:["\xa9 ",o||2024," ",(0,a.jsx)("a",{href:(null==t?void 0:t.url)||i.b.app_url,target:(null==t?void 0:t.target)||"",className:"text-primary hover:text-primary/80 cursor-pointer",children:(null==t?void 0:t.title)||i.b.app_name}),", All rights reserved"]})}},64147:()=>{},68843:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LazyImage:()=>s});var n=r(69140),a=r(86473);function s(e){var t=e.src,r=e.alt,s=e.className,i=e.width,o=e.height,l=e.placeholderSrc;return e.title,e.fill,e.priority,e.sizes,(0,n.jsx)(a.LazyLoadImage,{src:t,alt:r,width:i,height:o,effect:"blur",placeholderSrc:l,className:s,wrapperClassName:"!block h-full w-full"})}r(13112)},69177:(e,t,r)=>{"use strict";r.d(t,{ThemeLogo:()=>l});var n=r(32812),a=r(7907),s=r(69140),i=r(13998),o=r(82570);function l(e){var t=e.className,r=e.width,l=e.height,c=(0,a._)(e,["className","width","height"]),u=o.b.app_logo;return(0,s.jsx)(i.default,(0,n._)({src:u,alt:o.b.app_name,width:void 0===r?32:r,height:void 0===l?32:l,className:t,unoptimized:!0},c))}},70682:(e,t,r)=>{"use strict";r.d(t,{oR:()=>n.oR});var n=r(95973)},86681:(e,t,r)=>{"use strict";function n(e,t){var r=null==e?void 0:e.trim();return r&&r.length>0?r:t}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"feature preview image",r=null==e?void 0:e.trim();return r&&r.length>0?"".concat(r," ").concat(t):"Illustrative ".concat(t)}function s(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"profile photo",n=null==e?void 0:e.trim(),a=null==t?void 0:t.trim();return n&&a?"".concat(n,", ").concat(a,", ").concat(r):n?"".concat(n," ").concat(r):"Person ".concat(r)}function i(e){var t=null==e?void 0:e.trim();return t&&t.length>0?"".concat(t," brand logo"):"Brand logo"}r.d(t,{GI:()=>s,WN:()=>n,hu:()=>a,sE:()=>i})},94838:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SignUser:()=>_});var n=r(57505),a=r(69140),s=r(20792),i=r(20340),o=r(18066),l=r(4607),c=r(90094),u=r(89239),d=r(53171),f=r(48169),m=r(99156),h=r(28632),p=r(36651),v=r(41156),g=r(18617),x=r(45509),b=r(86681),w=r(5029),j=r(42803),N=r(39118),y=(0,i.default)(function(){return Promise.all([r.e(38243),r.e(47235)]).then(r.bind(r,47235)).then(function(e){return{default:e.SignModal}})},{loadableGenerated:{webpack:function(){return[47235]}},ssr:!1});function _(e){var t,r,i=e.isScrolled,_=e.signButtonSize,k=e.userNav,S=(0,f.c)("common.sign"),z=(0,h.rd)(),A=(0,n._)((0,s.useState)(!1),2),C=A[0],R=A[1];(0,s.useEffect)(function(){R(!0)},[]);var E=(0,x.U)(),L=E.configs,U=E.fetchConfigs,P=E.setIsShowSignModal,M=E.isCheckSign,T=E.user,I=E.setUser,D=E.showOneTap,O=(0,s.useRef)(null),B=(0,s.useRef)(!1);return(0,s.useEffect)(function(){U()},[]),(0,s.useEffect)(function(){if(L&&L.google_client_id&&"true"===L.google_one_tap_enabled&&!T&&!M&&!B.current){B.current=!0;var e=setTimeout(function(){return D(L)},4e3);return function(){return clearTimeout(e)}}},[L,T,M,D]),(0,s.useEffect)(function(){var e,t;(null==T?void 0:T.id)&&O.current&&void 0!==T.credits&&(0,w.Fi)({user_plan:(null==(e=T.credits)?void 0:e.isUnlimited)?"unlimited":(null==(t=T.credits)?void 0:t.remainingCredits)>0?"active":"free",is_admin:T.isAdmin?"true":"false"})},[null==T?void 0:T.id,null==T?void 0:T.credits,null==T?void 0:T.isAdmin]),(0,a.jsx)(a.Fragment,{children:M||!C?(0,a.jsx)("div",{children:(0,a.jsx)(o.A,{className:"size-4 animate-spin"})}):T?(0,a.jsxs)(g.rI,{children:[(0,a.jsx)(g.ty,{asChild:!0,children:(0,a.jsx)(v.$,{variant:"ghost",className:"relative h-10 w-10 rounded-full p-0",children:(0,a.jsxs)(p.Avatar,{children:[(0,a.jsx)(p.AvatarImage,{src:T.image||"",alt:(0,b.GI)(T.name,void 0,"user profile photo")}),(0,a.jsx)(p.AvatarFallback,{children:(null==(t=T.name)?void 0:t.charAt(0))||"U"})]})})}),(0,a.jsxs)(g.SQ,{children:[(null==k?void 0:k.show_name)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g._2,{asChild:!0,children:(0,a.jsxs)(h.N_,{className:"w-full cursor-pointer",href:"/settings/profile",children:[(0,a.jsx)(l.A,{}),T.name]})}),(0,a.jsx)(g.mB,{})]}),(null==k?void 0:k.show_credits)&&T.credits&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g._2,{asChild:!0,children:(0,a.jsxs)(h.N_,{className:"w-full cursor-pointer",href:"/settings/credits",children:[(0,a.jsx)(c.A,{}),S("credits_title",{credits:T.credits.isUnlimited?"â":T.credits.remainingCredits})]})}),(0,a.jsx)(g.mB,{})]}),null==k||null==(r=k.items)?void 0:r.map(function(e,t){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g._2,{asChild:!0,children:(0,a.jsxs)(h.N_,{className:"w-full cursor-pointer",href:e.url||"",target:e.target||"_self",children:[e.icon&&(0,a.jsx)(N.L,{name:e.icon,className:"h-4 w-4"}),e.title]})}),(0,a.jsx)(g.mB,{})]},t)}),T.isAdmin&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g._2,{asChild:!0,children:(0,a.jsxs)(h.N_,{className:"w-full cursor-pointer",href:"/admin",children:[(0,a.jsx)(u.A,{}),S("admin_title")]})}),(0,a.jsx)(g.mB,{})]}),(null==k?void 0:k.show_sign_out)&&(0,a.jsxs)(g._2,{className:"w-full cursor-pointer",onClick:function(){return(0,m.CI)({fetchOptions:{onSuccess:function(){I(null),z.push("/")}}})},children:[(0,a.jsx)(d.A,{}),(0,a.jsx)("span",{children:S("sign_out_title")})]})]})]}):(0,a.jsxs)("div",{className:"flex w-full flex-col space-y-3 sm:flex-row sm:gap-3 sm:space-y-0 md:w-fit",children:[(0,a.jsx)(v.$,{asChild:!0,size:void 0===_?"sm":_,className:(0,j.cn)("border-foreground
1/10 ml-4 cursor-pointer ring-0",i&&"lg:hidden"),onClick:function(){return P(!0)},children:(0,a.jsx)("span",{children:S("sign_in_title")})}),(0,a.jsx)(y,{})]})})}},99156:(e,t,r)=>{"use strict";r.d(t,{CI:()=>v,Hh:()=>p,Jv:()=>h,ep:()=>g,wV:()=>m,yK:()=>f});var n=r(76471),a=r(87639),s=r(3395),i=r(15476),o=r(68684),l=r(82570);function c(){return window.location.origin?window.location.origin:l.b.auth_url}function u(e){var t=e.minIntervalMs,r=new Map,i=0;return function(e,o){return(0,n._)(function(){var l,c,u,d,f;return(0,s.YH)(this,function(m){var h,p;return t&&function(e,t){if("GET"!==(null!=(i=null==(n=null!=(s=null==t?void 0:t.method)?s:(0,a._)(e,Request)?e.method:"GET")||null==(r=n.toUpperCase)?void 0:r.call(n))?i:"GET"))return!1;var r,n,s,i,o="string"==typeof e?e:(0,a._)(e,URL)?e.toString():e.url;return new URL(o,window.location.origin).pathname.endsWith("/get-session")}(e,o)?(h="string"==typeof e?e:(0,a._)(e,URL)?e.toString():e.url,p=new URL(h,window.location.origin),l="GET ".concat(p.origin).concat(p.pathname),c=r.get(l))?[2,c]:(u=Date.now(),d=Math.max(0,i+t-u),f=(0,n._)(function(){return(0,s.YH)(this,function(t){switch(t.label){case 0:if(!(d>0))return[3,2];return[4,new Promise(function(e){return setTimeout(e,d)})];case 1:t.sent(),t.label=2;case 2:return i=Date.now(),[2,fetch(e,o)]}})})().finally(function(){r.delete(l)}),r.set(l,f),[2,f]):[2,fetch(e,o)]})})()}}var d=Number(r(55036).env.NEXT_PUBLIC_AUTH_GET_SESSION_MIN_INTERVAL_MS)||2e3,f=(0,o.M)({baseURL:c(),fetchOptions:{retry:0,customFetchImpl:u({minIntervalMs:d})}}),m=f.useSession,h=f.signIn,p=f.signUp,v=f.signOut;function g(e){var t,r;return(0,o.M)({baseURL:c(),plugins:(r=[],(t=e).google_client_id&&"true"===t.google_one_tap_enabled&&r.push((0,i.ll)({clientId:t.google_client_id,autoSelect:!1,cancelOnTapOutside:!1,context:"signin",additionalOptions:{},promptOptions:{baseDelay:1e3,maxAttempts:1}})),r),fetchOptions:{retry:0,customFetchImpl:u({minIntervalMs:d})}})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.