Files
Gnuboard7/templates/_bundled/sirsoft-basic/dist/js/components.iife.js
T
chym1217 98989e3c2c fix(page): 첨부 업로드 검증 실패 시 사용자 안내 토스트 노출
- 페이지 폼 FileUploader 에 onUploadError→toast 연결 (용량/확장자 초과 안내)
- 사용자 템플릿(sirsoft-basic) 개수 초과 시 onUploadError 발화 추가 (silent 무시 방지)
- 개수 초과 문구를 이미지 전용에서 일반 파일 범용 공통 메시지로 통일 (ko/en/ja)
2026-07-06 09:37:06 +09:00

89 lines
352 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var SirsoftBasic=(function(J,d,C,Rt){"use strict";function Gc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const E=Gc(C),jc=()=>window.G7Core,Q=C.forwardRef(({children:e,variant:t="primary",size:r="md",className:n="",...o},a)=>{const s="inline-flex items-center justify-center",l=jc()?.style?.mergeClasses?.(s,n)??`${s} ${n}`;return d.jsx("button",{ref:a,className:l,...o,children:e})});Q.displayName="Button";const W=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("div",{ref:n,className:t,...r,children:e})),re=({children:e,className:t="",...r})=>d.jsx("span",{className:t,...r,children:e}),mn=({children:e,className:t="",...r})=>d.jsx("svg",{className:t,...r,children:e}),_t=C.forwardRef(({label:e,error:t,className:r="",onChange:n,onKeyPress:o,value:a,defaultValue:s,type:l="text",checked:f,defaultChecked:h,...c},i)=>{const u=l==="radio"||l==="checkbox",g=C.useRef(!1),p=C.useRef(null);C.useImperativeHandle(i,()=>p.current);const[m,v]=C.useState(a??s??"");C.useEffect(()=>{!u&&!g.current&&a!==void 0&&v(a)},[a,u]);const x=C.useCallback(()=>{g.current=!0},[]),M=C.useCallback(y=>{if(g.current=!1,n){const N=y.target.value;v(N);const D=new Event("change",{bubbles:!0});Object.defineProperty(D,"target",{writable:!1,value:{value:N}}),Object.defineProperty(D,"currentTarget",{writable:!1,value:{value:N}}),n(D)}},[n]),w=C.useCallback(y=>{const N=y.target.value;v(N),!g.current&&n&&n(y)},[n]),T=C.useCallback(y=>{g.current||o&&o(y)},[o]),{loadingactions:A,formdata:_,...I}=c;if(u)return d.jsx("input",{ref:p,type:l,className:r,onChange:n,checked:f,defaultChecked:h,value:a,...I});const k=a!==void 0?{value:m}:{defaultValue:s};return d.jsx("input",{ref:p,type:l,className:r,onChange:w,onKeyPress:T,onCompositionStart:x,onCompositionEnd:M,...k,...I})});_t.displayName="Input";const Va=C.forwardRef(({accept:e,maxSize:t,onChange:r,onError:n,buttonText:o="Browse",placeholder:a="No file selected",className:s="",disabled:l,...f},h)=>{const c=C.useRef(null),i=h||c,[u,g]=C.useState(""),p={},m={};Object.entries(f).forEach(([w,T])=>{w.startsWith("data-editor-")||w==="id"||w==="onMouseMove"||w==="onMouseLeave"?p[w]=T:m[w]=T});const v=C.useCallback(()=>{!l&&i.current&&i.current.click()},[l,i]),x=C.useCallback(w=>{const T=w.target.files?.[0]||null;if(!T){g(""),r?.(null);return}if(t&&T.size>t*1024*1024){const A=`File size exceeds ${t}MB limit`;n?.(A),i.current&&(i.current.value=""),g("");return}g(T.name),r?.(T)},[t,r,n,i]),M=C.useCallback(w=>{w.stopPropagation(),i.current&&(i.current.value=""),g(""),r?.(null)},[r,i]);return d.jsxs(W,{className:`flex items-center gap-2 ${s}`,...p,children:[d.jsx(_t,{ref:i,type:"file",accept:e,onChange:x,disabled:l,className:"hidden",...m}),d.jsx(Q,{type:"button",onClick:v,disabled:l,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:o}),d.jsx(re,{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:u||a}),u&&!l&&d.jsx(Q,{type:"button",onClick:M,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:d.jsx(mn,{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});Va.displayName="FileInput";var Re=(e=>(e.User="fa-user",e.Users="fa-users",e.UserCircle="fa-user-circle",e.UserPlus="fa-user-plus",e.UserMinus="fa-user-minus",e.UserShield="fa-user-shield",e.Search="fa-search",e.Edit="fa-edit",e.Pencil="fa-pencil-alt",e.Trash="fa-trash",e.Save="fa-save",e.Plus="fa-plus",e.Minus="fa-minus",e.Check="fa-check",e.Times="fa-times",e.Download="fa-download",e.Upload="fa-upload",e.Copy="fa-copy",e.ExternalLink="fa-external-link-alt",e.Home="fa-home",e.ChevronLeft="fa-chevron-left",e.ChevronRight="fa-chevron-right",e.ChevronUp="fa-chevron-up",e.ChevronDown="fa-chevron-down",e.AngleLeft="fa-angle-left",e.AngleRight="fa-angle-right",e.AngleUp="fa-angle-up",e.AngleDown="fa-angle-down",e.ArrowUp="fa-arrow-up",e.ArrowDown="fa-arrow-down",e.ArrowLeft="fa-arrow-left",e.ArrowRight="fa-arrow-right",e.Bars="fa-bars",e.EllipsisVertical="fa-ellipsis-v",e.EllipsisHorizontal="fa-ellipsis-h",e.CheckCircle="fa-check-circle",e.TimesCircle="fa-times-circle",e.ExclamationCircle="fa-exclamation-circle",e.ExclamationTriangle="fa-exclamation-triangle",e.InfoCircle="fa-info-circle",e.QuestionCircle="fa-question-circle",e.XCircle="fa-times-circle",e.ShoppingCart="fa-shopping-cart",e.ShoppingBag="fa-shopping-bag",e.CreditCard="fa-credit-card",e.Tag="fa-tag",e.Tags="fa-tags",e.File="fa-file",e.FileAlt="fa-file-alt",e.Folder="fa-folder",e.FolderOpen="fa-folder-open",e.Envelope="fa-envelope",e.Phone="fa-phone",e.Comment="fa-comment",e.Comments="fa-comments",e.Cog="fa-cog",e.Cogs="fa-cogs",e.Settings="fa-cog",e.Wrench="fa-wrench",e.Sliders="fa-sliders-h",e.Image="fa-image",e.Images="fa-images",e.Video="fa-video",e.Camera="fa-camera",e.Heart="fa-heart",e.Star="fa-star",e.ThumbsUp="fa-thumbs-up",e.ThumbsDown="fa-thumbs-down",e.Share="fa-share",e.Clock="fa-clock",e.Calendar="fa-calendar",e.CalendarAlt="fa-calendar-alt",e.Lock="fa-lock",e.Unlock="fa-unlock",e.Eye="fa-eye",e.EyeSlash="fa-eye-slash",e.Bell="fa-bell",e.Flag="fa-flag",e.Map="fa-map",e.MapMarker="fa-map-marker-alt",e.Globe="fa-globe",e.Link="fa-link",e.Unlink="fa-unlink",e.Sun="fa-sun",e.Moon="fa-moon",e.ChartBar="fa-chart-bar",e.ChartLine="fa-chart-line",e.ChartPie="fa-chart-pie",e.ChartArea="fa-chart-area",e.Spinner="fa-spinner",e.CircleNotch="fa-circle-notch",e.CheckBadge="fa-badge-check",e.BellSlash="fa-bell-slash",e.BookOpen="fa-book-open",e.Building="fa-building",e.FileCircleCheck="fa-file-circle-check",e.WandMagicSparkles="fa-wand-magic-sparkles",e.UserXmark="fa-user-xmark",e.Cube="fa-cube",e.Cubes="fa-cubes",e.Plug="fa-plug",e.PuzzlePiece="fa-puzzle-piece",e.Fire="fa-fire",e.CommentDots="fa-comment-dots",e.DollarSign="fa-dollar-sign",e.Bars2="fa-bars",e.X="fa-times",e.List="fa-list",e.ThLarge="fa-th-large",e.Inbox="fa-inbox",e.Box="fa-box",e.PaperPlane="fa-paper-plane",e.FileText="fa-file-alt",e.Paperclip="fa-paperclip",e.Truck="fa-truck",e.Sync="fa-sync",e.RotateLeft="fa-rotate-left",e.MapPin="fa-map-marker-alt",e.HelpCircle="fa-question-circle",e))(Re||{});const Bc={user:"fa-user",users:"fa-users","user-circle":"fa-user-circle","user-plus":"fa-user-plus","user-minus":"fa-user-minus","user-shield":"fa-user-shield",search:"fa-search",edit:"fa-edit",pencil:"fa-pencil-alt",trash:"fa-trash",save:"fa-save",plus:"fa-plus",minus:"fa-minus",check:"fa-check",times:"fa-times",download:"fa-download",upload:"fa-upload",copy:"fa-copy","external-link":"fa-external-link-alt",home:"fa-home","chevron-left":"fa-chevron-left","chevron-right":"fa-chevron-right","chevron-up":"fa-chevron-up","chevron-down":"fa-chevron-down","angle-left":"fa-angle-left","angle-right":"fa-angle-right","angle-up":"fa-angle-up","angle-down":"fa-angle-down","arrow-up":"fa-arrow-up","arrow-down":"fa-arrow-down","arrow-left":"fa-arrow-left","arrow-right":"fa-arrow-right",bars:"fa-bars","ellipsis-vertical":"fa-ellipsis-v","ellipsis-v":"fa-ellipsis-v","ellipsis-horizontal":"fa-ellipsis-h","ellipsis-h":"fa-ellipsis-h","check-circle":"fa-check-circle","times-circle":"fa-times-circle","x-circle":"fa-times-circle","exclamation-circle":"fa-exclamation-circle","exclamation-triangle":"fa-exclamation-triangle","info-circle":"fa-info-circle","question-circle":"fa-question-circle","shopping-cart":"fa-shopping-cart","shopping-bag":"fa-shopping-bag","credit-card":"fa-credit-card",tag:"fa-tag",tags:"fa-tags",file:"fa-file","file-alt":"fa-file-alt",folder:"fa-folder","folder-open":"fa-folder-open",envelope:"fa-envelope",phone:"fa-phone",comment:"fa-comment",comments:"fa-comments",cog:"fa-cog",cogs:"fa-cogs",settings:"fa-cog",wrench:"fa-wrench",sliders:"fa-sliders-h",image:"fa-image",images:"fa-images",video:"fa-video",camera:"fa-camera",heart:"fa-heart",star:"fa-star","thumbs-up":"fa-thumbs-up","thumbs-down":"fa-thumbs-down",share:"fa-share",clock:"fa-clock",calendar:"fa-calendar","calendar-alt":"fa-calendar-alt",lock:"fa-lock",unlock:"fa-unlock",eye:"fa-eye","eye-slash":"fa-eye-slash",bell:"fa-bell",flag:"fa-flag",map:"fa-map","map-marker":"fa-map-marker-alt",globe:"fa-globe",link:"fa-link",unlink:"fa-unlink",sun:"fa-sun",moon:"fa-moon","chart-bar":"fa-chart-bar","chart-line":"fa-chart-line","chart-pie":"fa-chart-pie","chart-area":"fa-chart-area",spinner:"fa-spinner","circle-notch":"fa-circle-notch","check-badge":"fa-badge-check","badge-check":"fa-badge-check",cube:"fa-cube",cubes:"fa-cubes",plug:"fa-plug","puzzle-piece":"fa-puzzle-piece",flame:"fa-fire",fire:"fa-fire","message-square":"fa-comment-dots","dollar-sign":"fa-dollar-sign",menu:"fa-bars",x:"fa-times",list:"fa-list","layout-grid":"fa-th-large","th-large":"fa-th-large",grid:"fa-th-large",inbox:"fa-inbox",package:"fa-box",box:"fa-box",send:"fa-paper-plane","paper-plane":"fa-paper-plane","file-text":"fa-file-alt",paperclip:"fa-paperclip",truck:"fa-truck","refresh-cw":"fa-sync",sync:"fa-sync","undo-2":"fa-rotate-left","rotate-left":"fa-rotate-left","map-pin":"fa-map-marker-alt","help-circle":"fa-question-circle","alert-triangle":"fa-exclamation-triangle","bell-off":"fa-bell-slash","book-open":"fa-book-open",building:"fa-building","edit-2":"fa-edit","edit-3":"fa-edit","file-check":"fa-file-circle-check",mail:"fa-envelope",sparkles:"fa-wand-magic-sparkles","trash-2":"fa-trash","user-x":"fa-user-xmark"},fe=({name:e,iconStyle:t="solid",size:r,color:n,spin:o=!1,pulse:a=!1,fixedWidth:s=!1,ariaLabel:l,className:f="",style:h,...c})=>{const i={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},u=typeof e=="string"?e:String(e),g=Bc[u],p=g?String(g).replace(/^fa-/,""):u.replace(/^fa-/,""),m=[i[t],`fa-${p}`,r&&`fa-${r}`,o&&"fa-spin",a&&"fa-pulse",s&&"fa-fw",n,f].filter(Boolean).join(" "),v=l||p.replace(/-/g," ");return d.jsx("i",{className:m,style:h,"aria-label":v,role:"img",...c})},yr=(e,t)=>window.G7Core?.t?.(e,t)??e,so={minLength:{key:"minLength",labelKey:"auth.password_input.rules.minLength",defaultParam:6,validate:(e,t=6)=>e.length>=t},maxLength:{key:"maxLength",labelKey:"auth.password_input.rules.maxLength",defaultParam:20,validate:(e,t=20)=>e.length<=t},hasUppercase:{key:"hasUppercase",labelKey:"auth.password_input.rules.hasUppercase",validate:e=>/[A-Z]/.test(e)},hasLowercase:{key:"hasLowercase",labelKey:"auth.password_input.rules.hasLowercase",validate:e=>/[a-z]/.test(e)},hasNumber:{key:"hasNumber",labelKey:"auth.password_input.rules.hasNumber",validate:e=>/[0-9]/.test(e)},hasSpecial:{key:"hasSpecial",labelKey:"auth.password_input.rules.hasSpecial",validate:e=>/[!@#$%^&*(),.?":{}|<>]/.test(e)},noSpaces:{key:"noSpaces",labelKey:"auth.password_input.rules.noSpaces",validate:e=>!/\s/.test(e)},minTypes:{key:"minTypes",labelKey:"auth.password_input.rules.minTypes",defaultParam:3,validate:(e,t=3)=>{let r=0;return/[A-Z]/.test(e)&&r++,/[a-z]/.test(e)&&r++,/[0-9]/.test(e)&&r++,/[!@#$%^&*(),.?":{}|<>]/.test(e)&&r++,r>=t}}},Ya=[so.minLength];function Wc(e){const[t,r]=e.split(":"),n=so[t];if(!n)return null;const o=r?parseInt(r,10):n.defaultParam;return{rule:n,param:isNaN(o)?n.defaultParam:o}}const Xa=C.forwardRef(({label:e,error:t,showToggle:r=!0,showValidation:n=!1,isConfirmField:o=!1,confirmTarget:a,onMatchChange:s,onValidityChange:l,rules:f,enableRules:h,showRules:c,wrapperClassName:i="",validationClassName:u="",className:g="",onChange:p,value:m,defaultValue:v,disabled:x,...M},w)=>{const T=C.useRef(null);C.useImperativeHandle(w,()=>T.current);const[A,_]=C.useState(!1),[I,k]=C.useState(!1),[y,N]=C.useState(m??v??"");C.useEffect(()=>{m!==void 0&&N(m)},[m]);const D=C.useMemo(()=>f&&f.length>0?f.map(j=>({rule:j,param:j.defaultParam})):h&&h.length>0?h.map(j=>Wc(j)).filter(j=>j!==null):Ya.map(j=>({rule:j,param:j.defaultParam})),[f,h]),P=C.useMemo(()=>!c||c.length===0?D:D.filter(j=>c.includes(j.rule.key)),[D,c]),O=C.useMemo(()=>!n||o?{}:P.reduce((j,{rule:H,param:q})=>(j[H.key]=H.validate(y,q),j),{}),[y,P,n,o]),L=C.useMemo(()=>!o||a===void 0?!0:y===a&&y.length>0,[o,y,a]),$=C.useMemo(()=>n?Object.values(O).every(j=>j):!0,[O,n]);C.useEffect(()=>{if(l&&n&&!o){const j=Object.entries(O).filter(([,H])=>!H).map(([H])=>H);l($,j)}},[$,O,l,n,o]),C.useEffect(()=>{s&&o&&s(L)},[L,s,o]);const S=C.useCallback(()=>{_(j=>!j)},[]),b=C.useCallback(j=>{const H=j.target.value;N(H),p&&p(j)},[p]),z=C.useCallback(j=>{k(j.getModifierState("CapsLock"))},[]),{loadingactions:U,formdata:G,...Y}=M,B={},V={};for(const[j,H]of Object.entries(Y))j.startsWith("data-editor-")||j==="onMouseMove"||j==="onMouseLeave"?B[j]=H:V[j]=H;return d.jsxs("div",{className:`relative ${i}`,...B,children:[d.jsxs("div",{className:"relative",children:[d.jsx("input",{ref:T,type:A?"text":"password",className:`${g} ${r?"pr-10":""}`,value:m!==void 0?m:void 0,defaultValue:m===void 0?v:void 0,onChange:b,onKeyDown:z,onKeyUp:z,disabled:x,...V}),r&&d.jsx("button",{type:"button",onClick:S,disabled:x,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed dark:disabled:opacity-50","aria-label":yr(A?"auth.password_input.hide":"auth.password_input.show"),children:d.jsx(fe,{name:A?"eye-slash":"eye",className:"w-5 h-5"})})]}),I&&!A&&d.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-sm text-yellow-600 dark:text-yellow-400",children:[d.jsx(fe,{name:"triangle-exclamation",className:"w-4 h-4"}),d.jsx("span",{children:yr("auth.password_input.caps_lock_on")})]}),o&&a!==void 0&&y.length>0&&d.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-sm ${L?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[d.jsx(fe,{name:L?"check-circle":"xmark-circle",className:"w-4 h-4"}),d.jsx("span",{children:yr(L?"auth.password_input.match":"auth.password_input.mismatch")})]}),n&&!o&&y.length>0&&d.jsx("div",{className:`mt-2 space-y-1 ${u}`,children:P.map(({rule:j,param:H})=>{const q=O[j.key],ee=H!==void 0?{count:H}:void 0;return d.jsxs("div",{className:`flex items-center gap-1.5 text-sm ${q?"text-green-600 dark:text-green-400":"text-gray-500 dark:text-gray-400"}`,children:[d.jsx(fe,{name:q?"check-circle":"circle",className:"w-4 h-4"}),d.jsx("span",{children:yr(j.labelKey,ee)})]},j.key)})}),t&&d.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:t})]})});Xa.displayName="PasswordInput";const lo=({label:e,error:t,className:r="",onChange:n,value:o,defaultValue:a,...s})=>{const l=C.useRef(!1),f=C.useRef(null),[h,c]=C.useState(o??a??"");C.useEffect(()=>{!l.current&&o!==void 0&&c(o)},[o]);const i=C.useCallback(()=>{l.current=!0},[]),u=C.useCallback(M=>{if(l.current=!1,n){const w=M.target.value;c(w);const T=new Event("change",{bubbles:!0});Object.defineProperty(T,"target",{writable:!1,value:{value:w}}),Object.defineProperty(T,"currentTarget",{writable:!1,value:{value:w}}),n(T)}},[n]),g=C.useCallback(M=>{const w=M.target.value;c(w),!l.current&&n&&n(M)},[n]),{loadingactions:p,formdata:m,...v}=s,x=o!==void 0?{value:h}:{defaultValue:a};return d.jsx("textarea",{ref:f,className:r,onChange:g,onCompositionStart:i,onCompositionEnd:u,...x,...v})},vr=({children:e,className:t="",...r})=>d.jsx("label",{className:t,...r,children:e}),zt=({children:e,className:t="",...r})=>d.jsx("p",{className:t,...r,children:e}),Ht=({className:e="",alt:t="",...r})=>d.jsx("img",{className:e,alt:t,...r}),Kc=({children:e,className:t="",...r})=>d.jsx("h1",{className:t,...r,children:e}),Za=({children:e,className:t="",...r})=>d.jsx("h2",{className:t,...r,children:e}),bn=({children:e,className:t="",...r})=>d.jsx("h3",{className:t,...r,children:e}),qa=({children:e,className:t="",...r})=>d.jsx("h4",{className:t,...r,children:e}),io=({children:e,className:t="",...r})=>d.jsx("ul",{className:t,...r,children:e}),Vc=({children:e,className:t="",...r})=>d.jsx("ol",{className:t,...r,children:e}),Qt=({children:e,className:t="",...r})=>d.jsx("li",{className:t,...r,children:e}),co=({children:e,className:t="",...r})=>d.jsx("a",{className:t,...r,children:e}),uo=({children:e,className:t="",...r})=>d.jsx("form",{className:t,...r,children:e}),Yc=window.G7Core?.createLogger?.("Comp:Select")??{log:(...e)=>console.log("[Comp:Select]",...e),warn:(...e)=>console.warn("[Comp:Select]",...e),error:(...e)=>console.error("[Comp:Select]",...e)};function Xc(e){const t=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[e];return t||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[e]||e}const Qa=({children:e,label:t,error:r,options:n,className:o="",value:a,onChange:s,disabled:l,searchable:f=!1,searchPlaceholder:h,editorAttrs:c,...i})=>{const[u,g]=C.useState(!1),[p,m]=C.useState(""),[v,x]=C.useState(null),M=C.useRef(null),w=C.useRef(null),T=C.useRef(null),A=C.useRef(null),_=C.useMemo(()=>n?Array.isArray(n)?n.length===0?[]:typeof n[0]=="string"?n.map(S=>({value:S,label:Xc(S)})):n:(Yc.warn("options prop is not an array:",n),null):null,[n]),I=C.useMemo(()=>_&&_.find(b=>String(b.value)===String(a))?.label||"",[_,a]),k=C.useMemo(()=>{if(!_)return null;if(!f||p.trim()==="")return _;const S=p.trim().toLowerCase();return _.filter(b=>b.label.toLowerCase().includes(S)||String(b.value).toLowerCase().includes(S))},[_,f,p]);C.useEffect(()=>{if(u&&f){m("");const S=setTimeout(()=>T.current?.focus(),0);return()=>clearTimeout(S)}u||m("")},[u,f]);const y=C.useCallback(()=>{if(!w.current)return;const S=w.current.getBoundingClientRect(),b=window.innerHeight-S.bottom,U=b<280&&S.top>b;x(U?{bottom:window.innerHeight-S.top+4,left:S.left,width:S.width}:{top:S.bottom+4,left:S.left,width:S.width})},[]);C.useEffect(()=>{if(!u){x(null);return}return y(),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),()=>{window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y)}},[u,y]),C.useEffect(()=>{const S=b=>{const z=b.target;M.current&&!M.current.contains(z)&&(!A.current||!A.current.contains(z))&&g(!1)};return u&&document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[u]),C.useEffect(()=>{const S=b=>{b.key==="Escape"&&u&&(g(!1),w.current?.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[u]);const N=()=>{l||g(!u)},D=S=>{s&&s({target:{value:S},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),w.current?.focus()};if(!_)return d.jsx("select",{className:o,value:a,onChange:s,disabled:l,...c,...i,children:e});const P=o&&o.includes("bg-"),O=o&&/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(o),L=P?`${o}${O?"":" text-gray-700 dark:text-gray-200"}`:`w-full px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl text-gray-700 dark:text-gray-200 font-medium focus:ring-2 focus:ring-blue-500 focus:outline-none ${o}`,$={...c,...i};return d.jsxs(W,{ref:M,className:"relative",...$,children:[d.jsxs(Q,{ref:w,type:"button",onClick:N,disabled:l,className:`${L} flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,"aria-haspopup":"listbox","aria-expanded":u,children:[d.jsx(re,{className:"truncate",children:I||" "}),d.jsx(mn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${u?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),u&&v&&Rt.createPortal(d.jsxs(W,{ref:A,className:"fixed z-[9999] bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",style:{top:v.top,bottom:v.bottom,left:v.left,width:v.width},role:"listbox",children:[f&&d.jsx(W,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:d.jsx(_t,{ref:T,type:"text",value:p,onChange:S=>m(S.target.value),placeholder:h??"Search...",className:"w-full px-3 py-2 bg-gray-100 dark:bg-gray-700 border-0 rounded-lg text-sm text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:outline-none",role:"searchbox","aria-label":h??"Search"})}),d.jsxs(W,{className:"py-2 max-h-60 overflow-auto",children:[k&&k.length===0&&d.jsx(W,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:p?"No results":""}),(k??[]).map(S=>{const b=String(S.value)===String(a);return d.jsxs(Q,{type:"button",onClick:()=>!S.disabled&&D(S.value),disabled:S.disabled,className:`w-full px-4 py-3 text-left flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${b?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-200"} ${S.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":b,children:[d.jsx(re,{children:S.label}),b&&d.jsx(mn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},S.value)})]})]}),document.body)]})},Zc=({children:e,className:t="",...r})=>d.jsx("option",{className:t,...r,children:e}),qc=({children:e,className:t="",...r})=>d.jsx("optgroup",{className:t,...r,children:e}),Ja=C.forwardRef(({label:e,className:t="",...r},n)=>d.jsx("input",{ref:n,type:"checkbox",className:t,...r}));Ja.displayName="Checkbox";const Qc=({children:e,className:t="",...r})=>d.jsx("table",{className:t,...r,children:e}),Jc=({children:e,className:t="",...r})=>d.jsx("thead",{className:t,...r,children:e}),Rc=({children:e,className:t="",...r})=>d.jsx("tbody",{className:t,...r,children:e}),ed=({children:e,className:t="",...r})=>d.jsx("tr",{className:t,...r,children:e}),td=({children:e,className:t="",...r})=>d.jsx("th",{className:t,...r,children:e}),rd=({children:e,className:t="",...r})=>d.jsx("td",{className:t,...r,children:e}),Wr=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("nav",{ref:n,className:t,...r,children:e}));Wr.displayName="Nav";const Ra=({children:e,className:t="",...r})=>d.jsx("section",{className:t,...r,children:e}),nd=({children:e,className:t="",...r})=>d.jsx("code",{className:t,...r,children:e}),fo=C.forwardRef(({className:e="",...t},r)=>d.jsx("hr",{ref:r,className:e,...t})),od=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("header",{ref:n,className:t,...r,children:e})),es=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,go=e=>{const t=es(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},ad=()=>{const e=localStorage.getItem("g7_color_scheme");return e&&["auto","light","dark"].includes(e)?e:"auto"},yn=({onThemeChange:e,className:t="",autoText:r="System",lightText:n="Light",darkText:o="Dark",id:a,editorAttrs:s})=>{const l=ad(),[f,h]=C.useState(l),[c,i]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{go(f)},[]),C.useEffect(()=>{if(f!=="auto")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),v=()=>{go("auto")};return m.addEventListener("change",v),()=>m.removeEventListener("change",v)},[f]),C.useEffect(()=>{const m=v=>{u.current&&!u.current.contains(v.target)&&i(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const g=m=>{h(m),localStorage.setItem("g7_color_scheme",m),go(m),i(!1),e?.(m)},p=()=>es(f)==="dark"?Re.Moon:Re.Sun;return d.jsxs(W,{ref:u,className:`relative ${t}`,id:a,...s,children:[d.jsx(Q,{onClick:()=>i(!c),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors text-gray-600 dark:text-gray-400","aria-label":"Toggle theme",children:d.jsx(fe,{name:p(),className:"w-5 h-5"})}),c&&d.jsx(W,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:d.jsxs(W,{className:"py-2",children:[d.jsxs(Q,{onClick:()=>g("auto"),className:`
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
${f==="auto"?"bg-gray-50 dark:bg-gray-700":""}
`,children:[d.jsx(fe,{name:Re.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(re,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),f==="auto"&&d.jsx(fe,{name:Re.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),d.jsxs(Q,{onClick:()=>g("light"),className:`
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
${f==="light"?"bg-gray-50 dark:bg-gray-700":""}
`,children:[d.jsx(fe,{name:Re.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(re,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),f==="light"&&d.jsx(fe,{name:Re.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),d.jsxs(Q,{onClick:()=>g("dark"),className:`
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
${f==="dark"?"bg-gray-50 dark:bg-gray-700":""}
`,children:[d.jsx(fe,{name:Re.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(re,{className:"flex-1 text-left text-gray-900 dark:text-white",children:o}),f==="dark"&&d.jsx(fe,{name:Re.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},sd=Object.freeze(Object.defineProperty({__proto__:null,ThemeToggle:yn,default:yn},Symbol.toStringTag,{value:"Module"})),ts={xs:"w-6 h-6 text-xs",sm:"w-8 h-8 text-sm",md:"w-10 h-10 text-base",lg:"w-12 h-12 text-lg",xl:"w-16 h-16 text-xl","2xl":"w-24 h-24 text-2xl","3xl":"w-32 h-32 text-3xl","4xl":"w-40 h-40 text-4xl","5xl":"w-48 h-48 text-5xl"},ld="rounded-full overflow-hidden flex-shrink-0 border border-gray-200 dark:border-gray-700",id="grayscale opacity-50",ho={normal:"bg-gradient-to-br from-blue-500 to-purple-600",withdrawn:"bg-gray-300 dark:bg-gray-600",guest:"bg-gray-200 dark:bg-gray-700"},Kr=({author:e,name:t,avatar:r,size:n="md",className:o="",text:a,isWithdrawn:s=!1,isGuest:l=!1,id:f,editorAttrs:h})=>{const c=r??e?.avatar,i=a??t??e?.name??"?",u=s||e?.status==="withdrawn",g=l||e?.is_guest||!1,p=C.useMemo(()=>[ts[n]||ts.md,ld,u?id:"",o].filter(Boolean).join(" "),[n,u,o]),m=g?ho.guest:u?ho.withdrawn:ho.normal,v=()=>g?d.jsx(W,{className:`w-full h-full flex items-center justify-center ${m}`,children:d.jsx(fe,{name:"user",className:"text-gray-400 dark:text-gray-500"})}):u?d.jsx(W,{className:`w-full h-full flex items-center justify-center ${m}`,children:d.jsx(fe,{name:"user",className:"text-gray-500 dark:text-gray-400"})}):d.jsx(W,{className:`w-full h-full flex items-center justify-center text-white font-semibold ${m}`,children:i.charAt(0).toUpperCase()});return d.jsx(W,{className:p,id:f,...h,children:c&&!g&&!u?d.jsx(Ht,{src:c,alt:i,className:"w-full h-full object-cover"}):v()})},cd=Object.freeze(Object.defineProperty({__proto__:null,Avatar:Kr},Symbol.toStringTag,{value:"Module"})),dd=window.G7Core?.createLogger?.("Comp:SlotContainer")??{log:(...e)=>console.log("[Comp:SlotContainer]",...e),warn:(...e)=>console.warn("[Comp:SlotContainer]",...e),error:(...e)=>console.error("[Comp:SlotContainer]",...e)};function rs(e,t){return t&&e&&typeof e.id=="string"&&e.id.length>0?{...e,id:`${e.id}__${t}`}:e}const vn=({slotId:e,className:t="",emptyContent:r,style:n,id:o,children:a})=>{const[s,l]=C.useState([]),[,f]=C.useState({}),h=C.useCallback(()=>{const p=window.__slotContextValue;if(p)return p;const m=window.G7Core;return m&&m.getSlotContext?.()||null},[]),c=C.useCallback(()=>{const p=h();p&&p.isEnabled&&l(p.getSlotComponents(e))},[e,h]);C.useEffect(()=>{const p=h();return!p||!p.isEnabled?void 0:(c(),p.subscribeToSlot(e,()=>{c(),f({})}))},[e,h,c]);const i=C.useCallback(()=>{const p=window.G7Core;return p?p.getDynamicRenderer?.():null},[]);if(s.length===0)return r?d.jsx(W,{className:t,style:n,id:o,children:r}):a?d.jsx(W,{className:t,style:n,id:o,children:a}):null;const u=i(),g=window.G7Core;return!u||!g?(dd.error("G7Core or DynamicRenderer not available"),null):d.jsxs(W,{className:t,style:n,id:o,children:[s.map(p=>{const{componentDef:m,dataContext:v,parentFormContext:x,getParentComponentContext:M,translationContext:w}=p,T=rs(m,o);return d.jsx(u,{componentDef:T,dataContext:v,translationContext:w,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:M?.(),parentFormContextProp:x,isRootRenderer:!1},T.id||`slot-${e}-${p.order}`)}),a]})},ud=Object.freeze(Object.defineProperty({__proto__:null,SlotContainer:vn,default:vn,scopeSlotChildDef:rs},Symbol.toStringTag,{value:"Module"})),wn=({notifications:e=[],unreadCount:t=0,hasMore:r=!1,loading:n=!1,titleText:o="알림",emptyText:a="알림이 없습니다.",markAllReadText:s="모두 읽음",deleteAllText:l="모두 삭제",unreadOnlyText:f="안 읽은 알림만",unreadOnly:h=!1,onNotificationClick:c,onClose:i,onLoadMore:u,onMarkAllRead:g,onDeleteAll:p,onDelete:m,onUnreadOnlyToggle:v,dropdownAlign:x="right",className:M="",id:w,editorAttrs:T})=>{const[A,_]=C.useState(!1),I=C.useRef(null),k=C.useRef(null),y=C.useRef(null),N=C.useRef(null),D=C.useRef(new Set),P=C.useRef(u),O=C.useRef(r),L=C.useRef(n),$=C.useRef(e.length),S=C.useRef(-1);C.useEffect(()=>{P.current=u,O.current=r,L.current=n,$.current=e.length}),C.useEffect(()=>{if(!N.current||!y.current||!A)return;S.current=-1;const G=new IntersectionObserver(([Y])=>{Y.isIntersecting&&(L.current||!O.current||S.current!==$.current&&(S.current=$.current,P.current?.()))},{root:y.current,threshold:.1});return G.observe(N.current),()=>G.disconnect()},[A]),C.useEffect(()=>{if(!y.current||!A)return;const G=new IntersectionObserver(B=>{B.forEach(V=>{const j=V.target.getAttribute("data-notification-id"),H=V.target.getAttribute("data-unread")==="true";j&&H&&V.isIntersecting&&D.current.add(j)})},{root:y.current,threshold:.5});return y.current.querySelectorAll("[data-notification-id]").forEach(B=>G.observe(B)),()=>G.disconnect()},[A,e]);const b=t>0?t:e.filter(G=>!G.read).length,z=C.useCallback(()=>{if(A){if(b>0){const G=Array.from(D.current).filter(Y=>{const B=e.find(V=>String(V.id)===String(Y));return B&&!B.read});G.length>0&&i?.(G)}D.current.clear(),_(!1)}},[A,i,b,e]);C.useEffect(()=>{if(!A)return;const G=Y=>{I.current&&!I.current.contains(Y.target)&&z()};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[A,z]);const U=C.useCallback(()=>{A?z():_(!0)},[A,z]);return C.useLayoutEffect(()=>{const G=k.current;if(!A||!G)return;G.style.transform="";const Y=G.getBoundingClientRect(),B=typeof window<"u"?window.innerWidth:0;if(Y.width===0&&Y.height===0)return;const V=8;let j=0;Y.right>B-V?j=-(Y.right-(B-V)):Y.left<V&&(j=V-Y.left),j!==0&&(G.style.transform=`translateX(${j}px)`)},[A,x,e.length]),d.jsxs(W,{ref:I,className:`relative ${M}`,id:w,...T,children:[d.jsxs(Q,{onClick:U,className:"relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors cursor-pointer","aria-label":o,children:[d.jsx(fe,{name:Re.Bell,className:"w-5 h-5"}),b>0&&d.jsx(re,{className:"absolute -top-1 -right-1 w-5 h-5 flex items-center justify-center text-xs font-bold text-white bg-red-500 dark:bg-red-600 rounded-full",children:b>99?"99+":b})]}),A&&d.jsxs(W,{ref:k,className:`absolute ${x==="left"?"left-0":"right-0"} mt-2 w-80 max-w-[calc(100vw-1rem)] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[d.jsxs(W,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[d.jsxs(W,{className:"flex items-center gap-3 min-w-0",children:[d.jsx(re,{className:"font-semibold text-gray-900 dark:text-white",children:o}),v&&d.jsxs(W,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>v(!h),children:[d.jsx(_t,{type:"checkbox",checked:h,onChange:G=>{G.stopPropagation(),v(G.target.checked)},onClick:G=>G.stopPropagation(),className:"w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-400 focus:ring-blue-500 dark:focus:ring-blue-400 cursor-pointer"}),d.jsx(re,{className:"text-xs text-gray-600 dark:text-gray-400",children:f})]})]}),d.jsxs(W,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&b>0&&d.jsx(Q,{onClick:()=>{g(),D.current.clear()},className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline cursor-pointer",children:s}),p&&e.length>0&&d.jsx(Q,{onClick:()=>{p()},className:"text-xs text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 hover:underline cursor-pointer",children:l})]})]}),d.jsx(W,{ref:y,className:"max-h-96 overflow-y-auto",children:e.length===0&&!n?d.jsx(W,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:d.jsx(re,{children:a})}):d.jsxs(d.Fragment,{children:[e.map(G=>{const Y=!G.read;return d.jsxs(W,{"data-notification-id":G.id,"data-unread":Y?"true":"false",onClick:()=>{G.onClick?.(),c?.(G),_(!1)},className:`group flex items-start gap-3 px-4 py-3 text-left border-b border-gray-100 dark:border-gray-700 transition-colors cursor-pointer ${Y?"bg-blue-50/70 dark:bg-blue-900/20 hover:bg-blue-50 dark:hover:bg-blue-900/30":"bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700/50 opacity-70"}`,children:[G.iconName&&d.jsx(fe,{name:G.iconName,className:`w-5 h-5 mt-0.5 flex-shrink-0 ${Y?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),d.jsxs(W,{className:"flex-1 min-w-0",children:[d.jsx(W,{className:`text-sm truncate ${Y?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:G.title}),d.jsx(W,{className:`text-sm mt-1 line-clamp-2 ${Y?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:G.message}),d.jsx(W,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:G.time})]}),d.jsxs(W,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[Y&&d.jsx(re,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),m&&d.jsx(Q,{onClick:B=>{B.stopPropagation(),m(G)},className:"p-1 text-gray-400 dark:text-gray-500 hover:text-red-600 dark:hover:text-red-400 rounded hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Delete notification",children:d.jsx(fe,{name:Re.Trash,className:"w-4 h-4"})})]})]},G.id)}),r&&d.jsx(W,{ref:N,className:"px-4 py-3 text-center",children:n?d.jsx(re,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):d.jsx(re,{className:"text-sm text-gray-400 dark:text-gray-500"})}),n&&!r&&e.length>0&&d.jsx(W,{className:"px-4 py-2 text-center",children:d.jsx(re,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},fd=Object.freeze(Object.defineProperty({__proto__:null,NotificationCenter:wn,default:wn},Symbol.toStringTag,{value:"Module"})),Xe=(e,t)=>window.G7Core?.t?.(e,t)??e,bt=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ns=({logo:e,siteName:t="그누보드7",user:r,cartCount:n=0,notificationCount:o=0,boards:a=[],maxVisibleBoards:s=5,onMobileMenuOpen:l,availableLocales:f=[],currentLocale:h="ko",shopBase:c="/shop",className:i="",editorAttrs:u,notifications:g=[],notificationHasMore:p=!1,notificationLoading:m=!1,notificationUnreadOnly:v=!1,notificationTitleText:x,notificationEmptyText:M,notificationMarkAllReadText:w,notificationDeleteAllText:T,notificationUnreadOnlyText:A,onNotificationClose:_,onNotificationClick:I,onNotificationLoadMore:k,onNotificationMarkAllRead:y,onNotificationDeleteAll:N,onNotificationDelete:D,onNotificationUnreadOnlyToggle:P})=>{const[O,L]=C.useState(""),[$,S]=C.useState(!1),[b,z]=C.useState(!1),[U,G]=C.useState(!1),[Y,B]=C.useState({top:0,left:0}),[V,j]=C.useState(window.location.pathname),H=C.useRef(null),q=C.useRef(null),ee=C.useRef(null),ce=window.G7Core?.useResponsive,R=ce?.(),_e=R?R.width<768:typeof window<"u"&&window.innerWidth<768;C.useEffect(()=>{const K=()=>j(window.location.pathname);window.addEventListener("popstate",K);const te=history.pushState;return history.pushState=function(...oe){te.apply(this,oe),j(window.location.pathname)},()=>{window.removeEventListener("popstate",K),history.pushState=te}},[]);const me=(K,te=!1)=>te?V===K:V===K||V.startsWith(K+"/"),Be=()=>{const K=c==="/"?"":c;return V.startsWith(`${K}/products`)||V.startsWith(`${K}/cart`)||V.startsWith(`${K}/checkout`)||V.startsWith(`${K}/category`)},$e=K=>{const te="px-3 py-2 text-sm font-medium whitespace-nowrap cursor-pointer rounded-lg transition-colors";return K?`${te} bg-gray-900 text-white dark:bg-white dark:text-gray-900`:`${te} text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800`};C.useEffect(()=>{const K=te=>{H.current&&!H.current.contains(te.target)&&S(!1),q.current&&!q.current.contains(te.target)&&z(!1),ee.current&&!ee.current.contains(te.target)&&G(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const ye=a.slice(0,s),Ne=a.slice(s),we=K=>{K.preventDefault(),O.trim()&&bt(`/search?q=${encodeURIComponent(O)}`)},ke=async()=>{window.G7Core?.dispatch?.({handler:"logout"})},Ue=K=>{window.G7Core?.dispatch?.({handler:"setLocale",target:K}),G(!1)},Oe=K=>window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[K]??(K==="ko"?"한국어":K==="en"?"English":K==="ja"?"日本語":K==="zh"?"中文":K==="es"?"Español":K==="fr"?"Français":K==="de"?"Deutsch":K.toUpperCase());return d.jsxs(od,{...u??{},className:`sticky top-0 z-50 bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 ${i}`,children:[d.jsx(W,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs(W,{className:"flex items-center justify-between h-16",children:[d.jsx(Q,{onClick:()=>bt("/"),className:"flex items-center gap-2 flex-shrink-0 cursor-pointer",children:e?d.jsx(Ht,{src:e,alt:t,className:"h-8"}):d.jsx(re,{className:"text-xl font-bold text-gray-900 dark:text-white",children:t})}),!_e&&d.jsx(uo,{onSubmit:we,className:"flex flex-1 max-w-lg mx-8",children:d.jsxs(W,{className:"relative w-full",children:[d.jsx(_t,{type:"text",value:O,onChange:K=>L(K.target.value),placeholder:Xe("common.search_placeholder"),className:"w-full px-4 py-2 pl-10 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),d.jsx(fe,{name:"search",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500"})]})}),d.jsxs(W,{className:"flex items-center gap-2",children:[d.jsx(yn,{autoText:Xe("common.theme.auto"),lightText:Xe("common.theme.light"),darkText:Xe("common.theme.dark")}),r?.uuid&&d.jsx(wn,{notifications:g,unreadCount:o,hasMore:p,loading:m,unreadOnly:v,titleText:x??Xe("mypage.notifications.title"),emptyText:M??Xe("mypage.notifications.empty"),markAllReadText:w??Xe("mypage.notifications.mark_all_read"),deleteAllText:T??Xe("mypage.notifications.delete_all"),unreadOnlyText:A??Xe("mypage.notifications.unread_only"),onClose:_,onNotificationClick:I,onLoadMore:k,onMarkAllRead:y,onDeleteAll:N,onDelete:D,onUnreadOnlyToggle:P,dropdownAlign:"right"}),d.jsxs(Q,{onClick:()=>bt(`${c}/cart`),className:"relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white cursor-pointer",children:[d.jsx(fe,{name:"shopping-cart",className:"w-5 h-5"}),n>0&&d.jsx(re,{className:"absolute -top-1 -right-1 w-5 h-5 flex items-center justify-center text-xs bg-blue-500 text-white rounded-full",children:n>99?"99+":n})]}),f&&f.length>1&&d.jsxs(W,{ref:ee,className:"relative",children:[d.jsxs(Q,{onClick:()=>G(!U),className:"flex items-center gap-1.5 px-2.5 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg cursor-pointer transition-colors","aria-haspopup":"listbox","aria-expanded":U,"aria-label":Xe("common.language"),children:[d.jsx(fe,{name:"globe",className:"w-4 h-4"}),d.jsx(re,{className:"font-medium uppercase",children:h}),d.jsx(fe,{name:"chevron-down",className:"w-3 h-3"})]}),U&&d.jsx(W,{role:"listbox",className:"absolute right-0 mt-2 w-44 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-50 overflow-hidden",children:f.map(K=>{const te=K===h;return d.jsxs(Q,{role:"option","aria-selected":te,onClick:()=>Ue(K),className:`w-full px-4 py-2.5 text-left text-sm flex items-center gap-3 cursor-pointer transition-colors ${te?"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[d.jsx(fe,{name:"globe",className:"w-4 h-4"}),d.jsx(re,{className:"flex-1 font-medium",children:Oe(K)}),te&&d.jsx(fe,{name:"check",className:"w-4 h-4"})]},K)})})]}),d.jsx(vn,{slotId:"header_currency",id:"header_currency_slot_desktop",className:"flex items-center"}),r?.uuid?d.jsxs(W,{ref:H,className:"relative",children:[d.jsxs(Q,{onClick:()=>S(!$),className:"flex items-center gap-2 p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:[d.jsx(Kr,{avatar:r.avatar,name:r.name,size:"sm"}),d.jsx(re,{className:"hidden sm:inline text-sm font-medium",children:r.name}),d.jsx(fe,{name:"chevron-down",className:"w-4 h-4"})]}),$&&d.jsxs(W,{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-50",children:[d.jsx(W,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:d.jsxs(W,{className:"flex items-center gap-3",children:[d.jsx(Kr,{avatar:r.avatar,name:r.name,size:"md"}),d.jsxs(W,{children:[d.jsx(W,{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.name}),d.jsx(W,{className:"text-xs text-gray-500 dark:text-gray-400",children:Xe("common.member")})]})]})}),d.jsxs(W,{className:"py-1",children:[r.is_admin&&d.jsxs(d.Fragment,{children:[d.jsxs(co,{href:"/admin",className:"block w-full text-left px-4 py-2 text-sm text-blue-600 dark:text-blue-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer font-medium",children:[d.jsx(fe,{name:"settings",className:"inline w-4 h-4 mr-2"}),Xe("common.admin_menu")]}),d.jsx(fo,{className:"my-1 border-gray-200 dark:border-gray-700"})]}),d.jsxs(Q,{onClick:()=>{bt("/mypage"),S(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[d.jsx(fe,{name:"user",className:"inline w-4 h-4 mr-2"}),Xe("common.mypage")]}),d.jsxs(Q,{onClick:()=>{bt("/mypage/orders"),S(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[d.jsx(fe,{name:"shopping-bag",className:"inline w-4 h-4 mr-2"}),Xe("mypage.tabs.orders")]}),d.jsxs(Q,{onClick:()=>{bt("/mypage/wishlist"),S(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[d.jsx(fe,{name:"heart",className:"inline w-4 h-4 mr-2"}),Xe("mypage.tabs.wishlist")]})]}),d.jsx(fo,{className:"my-1 border-gray-200 dark:border-gray-700"}),d.jsxs(Q,{onClick:ke,className:"block w-full text-left px-4 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[d.jsx(fe,{name:"log-out",className:"inline w-4 h-4 mr-2"}),Xe("auth.logout")]})]})]}):d.jsxs(W,{className:"flex items-center gap-1.5",children:[d.jsx(Q,{onClick:()=>bt("/login?redirect=/mypage/orders"),className:"px-2.5 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white cursor-pointer",children:Xe("shop.guest_order_form.nav_link")}),d.jsx(Q,{onClick:()=>bt("/login"),className:"px-2.5 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white cursor-pointer",children:Xe("auth.login")}),d.jsx(Q,{onClick:()=>bt("/register"),className:"ml-1 px-3 py-2 text-sm font-medium text-white bg-emerald-500 rounded-lg hover:bg-emerald-600 cursor-pointer",children:Xe("auth.register_link")})]}),_e&&d.jsx(Q,{onClick:l,className:"p-2 text-gray-600 dark:text-gray-400",children:d.jsx(fe,{name:"menu",className:"w-6 h-6"})})]})]})}),!_e&&d.jsx(Wr,{className:"border-t border-gray-200 dark:border-gray-800",children:d.jsx(W,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs(W,{className:"flex items-center gap-1 h-12 overflow-x-auto",children:[d.jsx(Q,{onClick:()=>bt("/"),className:$e(me("/",!0)),"data-testid":"nav-home",children:Xe("nav.home")}),d.jsxs(Q,{onClick:()=>bt("/boards/popular"),className:`flex items-center gap-1 ${$e(me("/boards/popular"))}`,"data-testid":"nav-popular",children:[d.jsx(re,{className:"text-orange-500",children:"🔥"}),Xe("nav.popular")]}),d.jsxs(Q,{onClick:()=>bt(`${c==="/"?"":c}/products`),className:`flex items-center gap-1 ${$e(Be())}`,"data-testid":"nav-shop",children:[d.jsx(re,{children:"🛒"}),Xe("nav.shop")]}),ye.map(K=>d.jsxs(Q,{onClick:()=>bt(`/board/${K.slug}`),className:$e(me(`/board/${K.slug}`)),children:[K.icon&&d.jsx(re,{className:"mr-1",children:K.icon}),K.name]},K.id)),Ne.length>0&&d.jsxs(W,{ref:q,className:"relative",children:[d.jsxs(Q,{onClick:()=>{if(!b&&q.current){const K=q.current.getBoundingClientRect();B({top:K.bottom+4,left:K.left})}z(!b)},className:"flex items-center gap-1 px-3 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white",children:[Xe("nav.more"),d.jsx(fe,{name:"chevron-down",className:"w-4 h-4"})]}),b&&d.jsx(W,{className:"fixed w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-50",style:{top:`${Y.top}px`,left:`${Y.left}px`},children:Ne.map(K=>{const te=me(`/board/${K.slug}`);return d.jsxs(Q,{onClick:()=>{bt(`/board/${K.slug}`),z(!1)},className:`block w-full text-left px-4 py-2 text-sm cursor-pointer ${te?"bg-gray-900 text-white dark:bg-white dark:text-gray-900":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[K.icon&&d.jsx(re,{className:"mr-1",children:K.icon}),K.name]},K.id)})})]})]})})})]})},gd=Object.freeze(Object.defineProperty({__proto__:null,default:ns},Symbol.toStringTag,{value:"Module"})),hd=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("footer",{ref:n,className:t,...r,children:e})),Et=(e,t)=>window.G7Core?.t?.(e,t)??e,pd=768,os=1024,md=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},as=({siteName:e="그누보드7",siteDescription:t,copyrightText:r,socialLinks:n={},linkGroups:o,className:a="",editorAttrs:s})=>{const l=new Date().getFullYear(),h=window.G7Core?.useResponsive,i=h?.()?.width??(typeof window<"u"?window.innerWidth:os),u=i<pd,g=i>=os,p=u?1:g?5:2,m=[{title:Et("footer.community"),links:[{label:Et("nav.home"),href:"/"},{label:Et("nav.popular"),href:"/boards/popular"},{label:Et("footer.all_boards"),href:"/boards"}]},{title:Et("footer.info"),links:[{label:Et("footer.about"),href:"/page/about"},{label:Et("footer.faq"),href:"/page/faq"},{label:Et("footer.contact"),href:"/page/contact"}]},{title:Et("footer.policy"),links:[{label:Et("footer.terms"),href:"/page/terms"},{label:Et("footer.privacy"),href:"/page/privacy"},{label:Et("footer.refund"),href:"/page/refund"}]}],v=o||m,x={github:"github",twitter:"twitter",discord:"discord",facebook:"facebook",instagram:"instagram"};return d.jsx(hd,{...s??{},className:`bg-gray-50 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-800 ${a}`,children:d.jsxs(W,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[d.jsxs(W,{className:"grid gap-8",style:{gridTemplateColumns:`repeat(${p}, minmax(0, 1fr))`},children:[d.jsxs(W,{style:g?{gridColumn:"span 2 / span 2"}:void 0,children:[d.jsx(bn,{className:"text-lg font-bold text-gray-900 dark:text-white",children:e}),t&&d.jsx(zt,{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:t}),d.jsx(W,{className:"mt-4 flex items-center gap-4",children:Object.entries(n).map(([M,w])=>w?d.jsx(co,{href:w,target:"_blank",rel:"noopener noreferrer",className:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","aria-label":M,children:d.jsx(fe,{name:x[M],className:"w-5 h-5"})},M):null)})]}),v.map((M,w)=>d.jsxs(W,{children:[d.jsx(qa,{className:"text-sm font-semibold text-gray-900 dark:text-white uppercase tracking-wider",children:M.title}),d.jsx(io,{className:"mt-4 space-y-2",children:M.links.map((T,A)=>d.jsx(Qt,{children:d.jsx(Q,{onClick:()=>md(T.href),className:"text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white cursor-pointer",children:T.label})},A))})]},w))]}),d.jsxs(W,{className:"mt-8 pt-8 border-t border-gray-200 dark:border-gray-800 flex justify-between items-center gap-4",style:{flexDirection:u?"column":"row"},children:[d.jsx(zt,{className:"text-sm text-gray-500 dark:text-gray-400",children:r||`© ${l} ${e}. All rights reserved.`}),d.jsx(zt,{className:"text-sm text-gray-500 dark:text-gray-400",children:Et("footer.powered_by")})]})]})})},bd=Object.freeze(Object.defineProperty({__proto__:null,default:as},Symbol.toStringTag,{value:"Module"})),Gt=(e,t)=>window.G7Core?.t?.(e,t)??e,It=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ss=({isOpen:e,onClose:t,logo:r,siteName:n="그누보드7",user:o,boards:a=[],cartCount:s=0})=>{const l=C.useRef(null),h=window.G7Core?.useResponsive,c=h?.(),i=c?c.width<1024:typeof window<"u"&&window.innerWidth<1024;C.useEffect(()=>{const g=p=>{p.key==="Escape"&&t()};return e&&(document.addEventListener("keydown",g),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",g),document.body.style.overflow=""}},[e,t]);const u=g=>{g.target===g.currentTarget&&t()};return!e||!i?null:d.jsxs(W,{className:"fixed inset-0 z-50",onClick:u,children:[d.jsx(W,{className:"fixed inset-0 bg-black/50 transition-opacity"}),d.jsxs(W,{ref:l,className:`fixed inset-y-0 left-0 w-80 max-w-[85vw] bg-white dark:bg-gray-900 shadow-xl transform transition-transform duration-300 ${e?"translate-x-0":"-translate-x-full"}`,children:[d.jsxs(W,{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[d.jsx(Q,{onClick:()=>{t(),It("/")},className:"flex items-center gap-2 cursor-pointer",children:r?d.jsx(Ht,{src:r,alt:n,className:"h-8"}):d.jsx(re,{className:"text-xl font-bold text-gray-900 dark:text-white",children:n})}),d.jsx(Q,{onClick:t,className:"p-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","aria-label":"메뉴 닫기",children:d.jsx(fe,{name:"x",className:"w-6 h-6"})})]}),o?d.jsx(W,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:d.jsxs(W,{className:"flex items-center gap-3",children:[o.avatar?d.jsx(Ht,{src:o.avatar,alt:o.name,className:"w-12 h-12 rounded-full"}):d.jsx(W,{className:"w-12 h-12 rounded-full bg-blue-500 flex items-center justify-center text-white text-lg font-medium",children:(o.name||"U").charAt(0).toUpperCase()}),d.jsxs(W,{children:[d.jsx(zt,{className:"font-medium text-gray-900 dark:text-white",children:o.name}),d.jsx(Q,{onClick:()=>{t(),It("/mypage")},className:"text-sm text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:Gt("common.mypage")})]})]})}):d.jsx(W,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:d.jsxs(W,{className:"flex gap-2",children:[d.jsx(Q,{onClick:()=>{t(),It("/login")},className:"flex-1 py-2 text-center text-sm font-medium text-white bg-gray-900 dark:bg-white dark:text-gray-900 rounded-lg cursor-pointer",children:Gt("auth.login")}),d.jsx(Q,{onClick:()=>{t(),It("/register")},className:"flex-1 py-2 text-center text-sm font-medium text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer",children:Gt("auth.register")})]})}),d.jsx(Wr,{className:"p-4 overflow-y-auto max-h-[calc(100vh-200px)]",children:d.jsxs(io,{className:"space-y-1",children:[d.jsx(Qt,{children:d.jsxs(Q,{onClick:()=>{t(),It("/")},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[d.jsx(fe,{name:"home",className:"w-5 h-5"}),Gt("nav.home")]})}),d.jsx(Qt,{children:d.jsxs(Q,{onClick:()=>{t(),It("/popular")},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[d.jsx(re,{className:"text-orange-500",children:"🔥"}),Gt("nav.popular")]})}),d.jsx(Qt,{children:d.jsxs(Q,{onClick:()=>{t(),It("/shop")},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[d.jsx(re,{children:"🛒"}),Gt("nav.shop")]})}),d.jsx(Qt,{children:d.jsxs(Q,{onClick:()=>{t(),It("/cart")},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[d.jsx(fe,{name:"shopping-cart",className:"w-5 h-5"}),Gt("nav.cart"),s>0&&d.jsx(re,{className:"ml-auto px-2 py-0.5 text-xs bg-blue-500 text-white rounded-full",children:s})]})}),d.jsx(Qt,{className:"my-4 border-t border-gray-200 dark:border-gray-800"}),d.jsx(Qt,{className:"px-3 py-2 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:Gt("nav.boards")}),a.map(g=>d.jsx(Qt,{children:d.jsxs(Q,{onClick:()=>{t(),It(`/board/${g.slug}`)},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[g.icon&&d.jsx(re,{children:g.icon}),g.name]})},g.id))]})}),d.jsx(W,{className:"absolute bottom-0 left-0 right-0 p-4 border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900",children:d.jsxs(W,{className:"flex items-center justify-between text-sm text-gray-500 dark:text-gray-400",children:[d.jsx(Q,{onClick:()=>{t(),It("/about")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Gt("footer.about")}),d.jsx(Q,{onClick:()=>{t(),It("/terms")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Gt("footer.terms")}),d.jsx(Q,{onClick:()=>{t(),It("/privacy")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Gt("footer.privacy")})]})})]})]})},yd=Object.freeze(Object.defineProperty({__proto__:null,default:ss},Symbol.toStringTag,{value:"Module"}));function ls(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function vd(e){if(Array.isArray(e))return e}function wd(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],f=!0,h=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(f=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);f=!0);}catch(c){h=!0,o=c}finally{try{if(!f&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(h)throw o}}return l}}function xd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kd(e,t){return vd(e)||wd(e,t)||Cd(e,t)||xd()}function Cd(e,t){if(e){if(typeof e=="string")return ls(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ls(e,t):void 0}}const is=Object.entries,cs=Object.setPrototypeOf,Sd=Object.isFrozen,_d=Object.getPrototypeOf,Ed=Object.getOwnPropertyDescriptor;let pt=Object.freeze,Dt=Object.seal,wr=Object.create,ds=typeof Reflect<"u"&&Reflect,po=ds.apply,mo=ds.construct;pt||(pt=function(t){return t}),Dt||(Dt=function(t){return t}),po||(po=function(t,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),a=2;a<n;a++)o[a-2]=arguments[a];return t.apply(r,o)}),mo||(mo=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return new t(...n)});const xr=qe(Array.prototype.forEach),Td=qe(Array.prototype.lastIndexOf),us=qe(Array.prototype.pop),kr=qe(Array.prototype.push),Nd=qe(Array.prototype.splice),mt=Array.isArray,Vr=qe(String.prototype.toLowerCase),bo=qe(String.prototype.toString),fs=qe(String.prototype.match),Cr=qe(String.prototype.replace),gs=qe(String.prototype.indexOf),Ad=qe(String.prototype.trim),Md=qe(Number.prototype.toString),Od=qe(Boolean.prototype.toString),hs=typeof BigInt>"u"?null:qe(BigInt.prototype.toString),ps=typeof Symbol>"u"?null:qe(Symbol.prototype.toString),Ze=qe(Object.prototype.hasOwnProperty),Yr=qe(Object.prototype.toString),dt=qe(RegExp.prototype.test),xn=Id(TypeError);function qe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return po(e,t,n)}}function Id(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return mo(e,r)}}function Ee(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Vr;if(cs&&cs(e,null),!mt(t))return e;let n=t.length;for(;n--;){let o=t[n];if(typeof o=="string"){const a=r(o);a!==o&&(Sd(t)||(t[n]=a),o=a)}e[o]=!0}return e}function Dd(e){for(let t=0;t<e.length;t++)Ze(e,t)||(e[t]=null);return e}function yt(e){const t=wr(null);for(const n of is(e)){var r=kd(n,2);const o=r[0],a=r[1];Ze(e,o)&&(mt(a)?t[o]=Dd(a):a&&typeof a=="object"&&a.constructor===Object?t[o]=yt(a):t[o]=a)}return t}function Ld(e){switch(typeof e){case"string":return e;case"number":return Md(e);case"boolean":return Od(e);case"bigint":return hs?hs(e):"0";case"symbol":return ps?ps(e):"Symbol()";case"undefined":return Yr(e);case"function":case"object":{if(e===null)return Yr(e);const t=e,r=Sr(t,"toString");if(typeof r=="function"){const n=r(t);return typeof n=="string"?n:Yr(n)}return Yr(e)}default:return Yr(e)}}function Sr(e,t){for(;e!==null;){const n=Ed(e,t);if(n){if(n.get)return qe(n.get);if(typeof n.value=="function")return qe(n.value)}e=_d(e)}function r(){return null}return r}function Pd(e){try{return dt(e,""),!0}catch{return!1}}const ms=pt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),yo=pt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),vo=pt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Fd=pt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),wo=pt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),$d=pt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bs=pt(["#text"]),ys=pt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),xo=pt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),vs=pt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),kn=pt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ud=Dt(/{{[\w\W]*|^[\w\W]*}}/g),zd=Dt(/<%[\w\W]*|^[\w\W]*%>/g),Hd=Dt(/\${[\w\W]*/g),Gd=Dt(/^data-[\-\w.\u00B7-\uFFFF]+$/),jd=Dt(/^aria-[\-\w]+$/),ws=Dt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Bd=Dt(/^(?:\w+script|data):/i),Wd=Dt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Kd=Dt(/^html$/i),Vd=Dt(/^[a-z][.\w]*(-[.\w]+)+$/i),_r={element:1,text:3,progressingInstruction:7,comment:8,document:9},Yd=function(){return typeof window>"u"?null:window},Xd=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(n=r.getAttribute(o));const a="dompurify"+(n?"#"+n:"");try{return t.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},xs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ks(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Yd();const t=he=>ks(he);if(t.version="3.4.3",t.removed=[],!e||!e.document||e.document.nodeType!==_r.document||!e.Element)return t.isSupported=!1,t;let r=e.document;const n=r,o=n.currentScript,a=e.DocumentFragment,s=e.HTMLTemplateElement,l=e.Node,f=e.Element,h=e.NodeFilter,c=e.NamedNodeMap,i=c===void 0?e.NamedNodeMap||e.MozNamedAttrMap:c,u=e.HTMLFormElement,g=e.DOMParser,p=e.trustedTypes,m=f.prototype,v=Sr(m,"cloneNode"),x=Sr(m,"remove"),M=Sr(m,"nextSibling"),w=Sr(m,"childNodes"),T=Sr(m,"parentNode");if(typeof s=="function"){const he=r.createElement("template");he.content&&he.content.ownerDocument&&(r=he.content.ownerDocument)}let A,_="";const I=r,k=I.implementation,y=I.createNodeIterator,N=I.createDocumentFragment,D=I.getElementsByTagName,P=n.importNode;let O=xs();t.isSupported=typeof is=="function"&&typeof T=="function"&&k&&k.createHTMLDocument!==void 0;const L=Ud,$=zd,S=Hd,b=Gd,z=jd,U=Bd,G=Wd,Y=Vd;let B=ws,V=null;const j=Ee({},[...ms,...yo,...vo,...wo,...bs]);let H=null;const q=Ee({},[...ys,...xo,...vs,...kn]);let ee=Object.seal(wr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ne=null,ce=null;const R=Object.seal(wr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let _e=!0,me=!0,Be=!1,$e=!0,ye=!1,Ne=!0,we=!1,ke=!1,Ue=!1,Oe=!1,K=!1,te=!1,oe=!0,le=!1;const ve="user-content-";let Te=!0,We=!1,Ae={},He=null;const Ie=Ee({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let X=null;const se=Ee({},["audio","video","img","source","image","track"]);let de=null;const ue=Ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ie="http://www.w3.org/1998/Math/MathML",De="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let xe=ge,Ce=!1,ze=null;const Ke=Ee({},[ie,De,ge],bo);let Se=Ee({},["mi","mo","mn","ms","mtext"]),be=Ee({},["annotation-xml"]);const Me=Ee({},["title","style","font","a","script"]);let je=null;const rt=["application/xhtml+xml","text/html"],Ye="text/html";let Pe=null,Mt=null;const nt=r.createElement("form"),Yt=function(F){return F instanceof RegExp||F instanceof Function},Ct=function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Mt&&Mt===F)return;(!F||typeof F!="object")&&(F={}),F=yt(F),je=rt.indexOf(F.PARSER_MEDIA_TYPE)===-1?Ye:F.PARSER_MEDIA_TYPE,Pe=je==="application/xhtml+xml"?bo:Vr,V=Ze(F,"ALLOWED_TAGS")&&mt(F.ALLOWED_TAGS)?Ee({},F.ALLOWED_TAGS,Pe):j,H=Ze(F,"ALLOWED_ATTR")&&mt(F.ALLOWED_ATTR)?Ee({},F.ALLOWED_ATTR,Pe):q,ze=Ze(F,"ALLOWED_NAMESPACES")&&mt(F.ALLOWED_NAMESPACES)?Ee({},F.ALLOWED_NAMESPACES,bo):Ke,de=Ze(F,"ADD_URI_SAFE_ATTR")&&mt(F.ADD_URI_SAFE_ATTR)?Ee(yt(ue),F.ADD_URI_SAFE_ATTR,Pe):ue,X=Ze(F,"ADD_DATA_URI_TAGS")&&mt(F.ADD_DATA_URI_TAGS)?Ee(yt(se),F.ADD_DATA_URI_TAGS,Pe):se,He=Ze(F,"FORBID_CONTENTS")&&mt(F.FORBID_CONTENTS)?Ee({},F.FORBID_CONTENTS,Pe):Ie,ne=Ze(F,"FORBID_TAGS")&&mt(F.FORBID_TAGS)?Ee({},F.FORBID_TAGS,Pe):yt({}),ce=Ze(F,"FORBID_ATTR")&&mt(F.FORBID_ATTR)?Ee({},F.FORBID_ATTR,Pe):yt({}),Ae=Ze(F,"USE_PROFILES")?F.USE_PROFILES&&typeof F.USE_PROFILES=="object"?yt(F.USE_PROFILES):F.USE_PROFILES:!1,_e=F.ALLOW_ARIA_ATTR!==!1,me=F.ALLOW_DATA_ATTR!==!1,Be=F.ALLOW_UNKNOWN_PROTOCOLS||!1,$e=F.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ye=F.SAFE_FOR_TEMPLATES||!1,Ne=F.SAFE_FOR_XML!==!1,we=F.WHOLE_DOCUMENT||!1,Oe=F.RETURN_DOM||!1,K=F.RETURN_DOM_FRAGMENT||!1,te=F.RETURN_TRUSTED_TYPE||!1,Ue=F.FORCE_BODY||!1,oe=F.SANITIZE_DOM!==!1,le=F.SANITIZE_NAMED_PROPS||!1,Te=F.KEEP_CONTENT!==!1,We=F.IN_PLACE||!1,B=Pd(F.ALLOWED_URI_REGEXP)?F.ALLOWED_URI_REGEXP:ws,xe=typeof F.NAMESPACE=="string"?F.NAMESPACE:ge,Se=Ze(F,"MATHML_TEXT_INTEGRATION_POINTS")&&F.MATHML_TEXT_INTEGRATION_POINTS&&typeof F.MATHML_TEXT_INTEGRATION_POINTS=="object"?yt(F.MATHML_TEXT_INTEGRATION_POINTS):Ee({},["mi","mo","mn","ms","mtext"]),be=Ze(F,"HTML_INTEGRATION_POINTS")&&F.HTML_INTEGRATION_POINTS&&typeof F.HTML_INTEGRATION_POINTS=="object"?yt(F.HTML_INTEGRATION_POINTS):Ee({},["annotation-xml"]);const Z=Ze(F,"CUSTOM_ELEMENT_HANDLING")&&F.CUSTOM_ELEMENT_HANDLING&&typeof F.CUSTOM_ELEMENT_HANDLING=="object"?yt(F.CUSTOM_ELEMENT_HANDLING):wr(null);if(ee=wr(null),Ze(Z,"tagNameCheck")&&Yt(Z.tagNameCheck)&&(ee.tagNameCheck=Z.tagNameCheck),Ze(Z,"attributeNameCheck")&&Yt(Z.attributeNameCheck)&&(ee.attributeNameCheck=Z.attributeNameCheck),Ze(Z,"allowCustomizedBuiltInElements")&&typeof Z.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=Z.allowCustomizedBuiltInElements),ye&&(me=!1),K&&(Oe=!0),Ae&&(V=Ee({},bs),H=wr(null),Ae.html===!0&&(Ee(V,ms),Ee(H,ys)),Ae.svg===!0&&(Ee(V,yo),Ee(H,xo),Ee(H,kn)),Ae.svgFilters===!0&&(Ee(V,vo),Ee(H,xo),Ee(H,kn)),Ae.mathMl===!0&&(Ee(V,wo),Ee(H,vs),Ee(H,kn))),R.tagCheck=null,R.attributeCheck=null,Ze(F,"ADD_TAGS")&&(typeof F.ADD_TAGS=="function"?R.tagCheck=F.ADD_TAGS:mt(F.ADD_TAGS)&&(V===j&&(V=yt(V)),Ee(V,F.ADD_TAGS,Pe))),Ze(F,"ADD_ATTR")&&(typeof F.ADD_ATTR=="function"?R.attributeCheck=F.ADD_ATTR:mt(F.ADD_ATTR)&&(H===q&&(H=yt(H)),Ee(H,F.ADD_ATTR,Pe))),Ze(F,"ADD_URI_SAFE_ATTR")&&mt(F.ADD_URI_SAFE_ATTR)&&Ee(de,F.ADD_URI_SAFE_ATTR,Pe),Ze(F,"FORBID_CONTENTS")&&mt(F.FORBID_CONTENTS)&&(He===Ie&&(He=yt(He)),Ee(He,F.FORBID_CONTENTS,Pe)),Ze(F,"ADD_FORBID_CONTENTS")&&mt(F.ADD_FORBID_CONTENTS)&&(He===Ie&&(He=yt(He)),Ee(He,F.ADD_FORBID_CONTENTS,Pe)),Te&&(V["#text"]=!0),we&&Ee(V,["html","head","body"]),V.table&&(Ee(V,["tbody"]),delete ne.tbody),F.TRUSTED_TYPES_POLICY){if(typeof F.TRUSTED_TYPES_POLICY.createHTML!="function")throw xn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof F.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=F.TRUSTED_TYPES_POLICY,_=A.createHTML("")}else A===void 0&&(A=Xd(p,o)),A!==null&&typeof _=="string"&&(_=A.createHTML(""));pt&&pt(F),Mt=F},$t=Ee({},[...yo,...vo,...Fd]),ar=Ee({},[...wo,...$d]),br=function(F){let Z=T(F);(!Z||!Z.tagName)&&(Z={namespaceURI:xe,tagName:"template"});const ae=Vr(F.tagName),Ge=Vr(Z.tagName);return ze[F.namespaceURI]?F.namespaceURI===De?Z.namespaceURI===ge?ae==="svg":Z.namespaceURI===ie?ae==="svg"&&(Ge==="annotation-xml"||Se[Ge]):!!$t[ae]:F.namespaceURI===ie?Z.namespaceURI===ge?ae==="math":Z.namespaceURI===De?ae==="math"&&be[Ge]:!!ar[ae]:F.namespaceURI===ge?Z.namespaceURI===De&&!be[Ge]||Z.namespaceURI===ie&&!Se[Ge]?!1:!ar[ae]&&(Me[ae]||!$t[ae]):!!(je==="application/xhtml+xml"&&ze[F.namespaceURI]):!1},Qe=function(F){kr(t.removed,{element:F});try{T(F).removeChild(F)}catch{x(F)}},Ot=function(F,Z){try{kr(t.removed,{attribute:Z.getAttributeNode(F),from:Z})}catch{kr(t.removed,{attribute:null,from:Z})}if(Z.removeAttribute(F),F==="is")if(Oe||K)try{Qe(Z)}catch{}else try{Z.setAttribute(F,"")}catch{}},Br=function(F){let Z=null,ae=null;if(Ue)F="<remove></remove>"+F;else{const Je=fs(F,/^[\r\n\t ]+/);ae=Je&&Je[0]}je==="application/xhtml+xml"&&xe===ge&&(F='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+F+"</body></html>");const Ge=A?A.createHTML(F):F;if(xe===ge)try{Z=new g().parseFromString(Ge,je)}catch{}if(!Z||!Z.documentElement){Z=k.createDocument(xe,"template",null);try{Z.documentElement.innerHTML=Ce?_:Ge}catch{}}const it=Z.body||Z.documentElement;return F&&ae&&it.insertBefore(r.createTextNode(ae),it.childNodes[0]||null),xe===ge?D.call(Z,we?"html":"body")[0]:we?Z.documentElement:it},Lc=function(F){return y.call(F.ownerDocument||F,F,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},ja=function(F){return F instanceof u&&(typeof F.nodeName!="string"||typeof F.textContent!="string"||typeof F.removeChild!="function"||!(F.attributes instanceof i)||typeof F.removeAttribute!="function"||typeof F.setAttribute!="function"||typeof F.namespaceURI!="string"||typeof F.insertBefore!="function"||typeof F.hasChildNodes!="function")},Ba=function(F){return typeof l=="function"&&F instanceof l};function Jt(he,F,Z){xr(he,ae=>{ae.call(t,F,Z,Mt)})}const Pc=function(F){let Z=null;if(Jt(O.beforeSanitizeElements,F,null),ja(F))return Qe(F),!0;const ae=Pe(F.nodeName);if(Jt(O.uponSanitizeElement,F,{tagName:ae,allowedTags:V}),Ne&&F.hasChildNodes()&&!Ba(F.firstElementChild)&&dt(/<[/\w!]/g,F.innerHTML)&&dt(/<[/\w!]/g,F.textContent)||Ne&&F.namespaceURI===ge&&ae==="style"&&Ba(F.firstElementChild)||F.nodeType===_r.progressingInstruction||Ne&&F.nodeType===_r.comment&&dt(/<[/\w]/g,F.data))return Qe(F),!0;if(ne[ae]||!(R.tagCheck instanceof Function&&R.tagCheck(ae))&&!V[ae]){if(!ne[ae]&&$c(ae)&&(ee.tagNameCheck instanceof RegExp&&dt(ee.tagNameCheck,ae)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(ae)))return!1;if(Te&&!He[ae]){const Ge=T(F)||F.parentNode,it=w(F)||F.childNodes;if(it&&Ge){const Je=it.length;for(let St=Je-1;St>=0;--St){const Ut=v(it[St],!0);Ge.insertBefore(Ut,M(F))}}}return Qe(F),!0}return F instanceof f&&!br(F)||(ae==="noscript"||ae==="noembed"||ae==="noframes")&&dt(/<\/no(script|embed|frames)/i,F.innerHTML)?(Qe(F),!0):(ye&&F.nodeType===_r.text&&(Z=F.textContent,xr([L,$,S],Ge=>{Z=Cr(Z,Ge," ")}),F.textContent!==Z&&(kr(t.removed,{element:F.cloneNode()}),F.textContent=Z)),Jt(O.afterSanitizeElements,F,null),!1)},Fc=function(F,Z,ae){if(ce[Z]||oe&&(Z==="id"||Z==="name")&&(ae in r||ae in nt))return!1;const Ge=H[Z]||R.attributeCheck instanceof Function&&R.attributeCheck(Z,F);if(!(me&&!ce[Z]&&dt(b,Z))){if(!(_e&&dt(z,Z))){if(!Ge||ce[Z]){if(!($c(F)&&(ee.tagNameCheck instanceof RegExp&&dt(ee.tagNameCheck,F)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(F))&&(ee.attributeNameCheck instanceof RegExp&&dt(ee.attributeNameCheck,Z)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(Z,F))||Z==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&dt(ee.tagNameCheck,ae)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(ae))))return!1}else if(!de[Z]){if(!dt(B,Cr(ae,G,""))){if(!((Z==="src"||Z==="xlink:href"||Z==="href")&&F!=="script"&&gs(ae,"data:")===0&&X[F])){if(!(Be&&!dt(U,Cr(ae,G,"")))){if(ae)return!1}}}}}}return!0},nm=Ee({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),$c=function(F){return!nm[Vr(F)]&&dt(Y,F)},Uc=function(F){Jt(O.beforeSanitizeAttributes,F,null);const Z=F.attributes;if(!Z||ja(F))return;const ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let Ge=Z.length;for(;Ge--;){const it=Z[Ge],Je=it.name,St=it.namespaceURI,Ut=it.value,Xt=Pe(Je),Ka=Ut;let ct=Je==="value"?Ka:Ad(Ka);if(ae.attrName=Xt,ae.attrValue=ct,ae.keepAttr=!0,ae.forceKeepAttr=void 0,Jt(O.uponSanitizeAttribute,F,ae),ct=ae.attrValue,le&&(Xt==="id"||Xt==="name")&&gs(ct,ve)!==0&&(Ot(Je,F),ct=ve+ct),Ne&&dt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ct)){Ot(Je,F);continue}if(Xt==="attributename"&&fs(ct,"href")){Ot(Je,F);continue}if(ae.forceKeepAttr)continue;if(!ae.keepAttr){Ot(Je,F);continue}if(!$e&&dt(/\/>/i,ct)){Ot(Je,F);continue}ye&&xr([L,$,S],Hc=>{ct=Cr(ct,Hc," ")});const zc=Pe(F.nodeName);if(!Fc(zc,Xt,ct)){Ot(Je,F);continue}if(A&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!St)switch(p.getAttributeType(zc,Xt)){case"TrustedHTML":{ct=A.createHTML(ct);break}case"TrustedScriptURL":{ct=A.createScriptURL(ct);break}}if(ct!==Ka)try{St?F.setAttributeNS(St,Je,ct):F.setAttribute(Je,ct),ja(F)?Qe(F):us(t.removed)}catch{Ot(Je,F)}}Jt(O.afterSanitizeAttributes,F,null)},Wa=function(F){let Z=null;const ae=Lc(F);for(Jt(O.beforeSanitizeShadowDOM,F,null);Z=ae.nextNode();)Jt(O.uponSanitizeShadowNode,Z,null),Pc(Z),Uc(Z),Z.content instanceof a&&Wa(Z.content);Jt(O.afterSanitizeShadowDOM,F,null)},ao=function(F){if(F.nodeType===_r.element&&F.shadowRoot instanceof a){const Ge=F.shadowRoot;ao(Ge),Wa(Ge)}const Z=F.childNodes;if(!Z)return;const ae=[];xr(Z,Ge=>{kr(ae,Ge)});for(const Ge of ae)ao(Ge)};return t.sanitize=function(he){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Z=null,ae=null,Ge=null,it=null;if(Ce=!he,Ce&&(he="<!-->"),typeof he!="string"&&!Ba(he)&&(he=Ld(he),typeof he!="string"))throw xn("dirty is not a string, aborting");if(!t.isSupported)return he;if(ke||Ct(F),t.removed=[],typeof he=="string"&&(We=!1),We){const Ut=he.nodeName;if(typeof Ut=="string"){const Xt=Pe(Ut);if(!V[Xt]||ne[Xt])throw xn("root node is forbidden and cannot be sanitized in-place")}ao(he)}else if(he instanceof l)Z=Br("<!---->"),ae=Z.ownerDocument.importNode(he,!0),ae.nodeType===_r.element&&ae.nodeName==="BODY"||ae.nodeName==="HTML"?Z=ae:Z.appendChild(ae),ao(ae);else{if(!Oe&&!ye&&!we&&he.indexOf("<")===-1)return A&&te?A.createHTML(he):he;if(Z=Br(he),!Z)return Oe?null:te?_:""}Z&&Ue&&Qe(Z.firstChild);const Je=Lc(We?he:Z);for(;Ge=Je.nextNode();)Pc(Ge),Uc(Ge),Ge.content instanceof a&&Wa(Ge.content);if(We)return he;if(Oe){if(ye){Z.normalize();let Ut=Z.innerHTML;xr([L,$,S],Xt=>{Ut=Cr(Ut,Xt," ")}),Z.innerHTML=Ut}if(K)for(it=N.call(Z.ownerDocument);Z.firstChild;)it.appendChild(Z.firstChild);else it=Z;return(H.shadowroot||H.shadowrootmode)&&(it=P.call(n,it,!0)),it}let St=we?Z.outerHTML:Z.innerHTML;return we&&V["!doctype"]&&Z.ownerDocument&&Z.ownerDocument.doctype&&Z.ownerDocument.doctype.name&&dt(Kd,Z.ownerDocument.doctype.name)&&(St="<!DOCTYPE "+Z.ownerDocument.doctype.name+`>
`+St),ye&&xr([L,$,S],Ut=>{St=Cr(St,Ut," ")}),A&&te?A.createHTML(St):St},t.setConfig=function(){let he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ct(he),ke=!0},t.clearConfig=function(){Mt=null,ke=!1},t.isValidAttribute=function(he,F,Z){Mt||Ct({});const ae=Pe(he),Ge=Pe(F);return Fc(ae,Ge,Z)},t.addHook=function(he,F){typeof F=="function"&&kr(O[he],F)},t.removeHook=function(he,F){if(F!==void 0){const Z=Td(O[he],F);return Z===-1?void 0:Nd(O[he],Z,1)[0]}return us(O[he])},t.removeHooks=function(he){O[he]=[]},t.removeAllHooks=function(){O=xs()},t}var Cs=ks();const Zd=()=>{const e=()=>{const n=window.G7Core?.state?.get?.();return n&&n.preferredCurrency||"KRW"},[t,r]=C.useState(e);return C.useEffect(()=>{const n=window.G7Core?.state?.subscribe;if(r(e()),typeof n!="function")return;const o=n(a=>{r(a&&a.preferredCurrency||"KRW")});return typeof o=="function"?o:void 0},[]),t},qd=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},Qd=e=>{const t=Math.round(e*2)/2;return[1,2,3,4,5].map(r=>t>=r?"full":t>=r-.5?"half":"empty")},Ss=({product:e,onClick:t,shopBase:r="/shop",className:n="",id:o,editorAttrs:a})=>{const s=Zd(),l=M=>{const w=`multi_currency_${M}`,T=e[w];if(T&&T[s])return T[s].formatted;const A=`${M}_formatted`;return e[A]},f=e.name_localized??(typeof e.name=="string"?e.name:"")??"",h=l("selling_price"),c=l("list_price"),i=e.discount_rate&&e.discount_rate>0,u=e.sales_status&&e.sales_status!=="on_sale",g=e.labels??[],p=M=>Cs.sanitize(M,{ALLOWED_TAGS:["mark"],ALLOWED_ATTR:[]}),m=e.name_highlighted,v=e.description_highlighted??e.short_description,x=()=>{t?t(e.id):qd(`${r==="/"?"":r}/products/${e.id}`)};return d.jsxs(Q,{onClick:x,className:`block w-full text-left group bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden hover:shadow-lg transition-shadow cursor-pointer ${n}`,id:o,...a,children:[d.jsxs(W,{className:"relative aspect-square overflow-hidden bg-gray-100 dark:bg-gray-700",children:[d.jsx(Ht,{src:e.thumbnail_url,alt:f,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200",loading:"lazy"}),u&&d.jsx(W,{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:d.jsx(re,{className:`text-lg font-bold ${e.sales_status==="sold_out"?"text-red-300":e.sales_status==="suspended"?"text-amber-300":"text-blue-300"}`,style:{textShadow:"0 1px 4px rgba(0,0,0,0.6)"},children:e.sales_status_label??e.sales_status})}),i&&e.sales_status!=="sold_out"&&e.sales_status!=="suspended"&&d.jsxs(re,{className:"absolute top-2 left-2 px-2 py-1 bg-red-500 text-white text-xs font-bold rounded",children:[e.discount_rate,"%"]}),g.length>0&&d.jsx(W,{className:"absolute bottom-2 right-2 flex gap-1 flex-wrap justify-end",children:g.map((M,w)=>d.jsx(re,{className:"text-xs text-white font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:M.color||"#6b7280"},children:M.name},w))})]}),d.jsxs(W,{className:"p-4",children:[d.jsxs(W,{className:"flex items-center gap-1.5 flex-wrap",children:[e.primary_category&&d.jsx(re,{className:"inline-block text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-2 py-0.5 rounded",children:e.primary_category}),e.brand_name&&d.jsx(re,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.brand_name})]}),m?d.jsx(W,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1 [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-500/40 [&_mark]:px-0.5 [&_mark]:rounded",dangerouslySetInnerHTML:{__html:p(m)}}):d.jsx(bn,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1",children:f}),v&&d.jsx(W,{className:"mt-1 text-sm text-gray-600 dark:text-gray-400 line-clamp-2 [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-500/40 [&_mark]:px-0.5 [&_mark]:rounded",dangerouslySetInnerHTML:{__html:p(v)}}),d.jsxs(W,{className:"mt-1.5 flex items-center gap-1",children:[Qd(e.rating_avg??0).map((M,w)=>d.jsxs(re,{className:`text-xs ${M==="empty"?"text-gray-300 dark:text-gray-600":"text-yellow-400"}`,children:[M==="full"&&d.jsx("i",{className:"fa-solid fa-star"}),M==="half"&&d.jsx("i",{className:"fa-solid fa-star-half-stroke"}),M==="empty"&&d.jsx("i",{className:"fa-regular fa-star"})]},w)),d.jsx(re,{className:"text-xs text-gray-600 dark:text-gray-400 ml-0.5",children:(e.rating_avg??0).toFixed(1)}),d.jsxs(re,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",e.review_count??0,")"]})]}),d.jsxs(W,{className:"mt-2 flex items-baseline gap-2",children:[d.jsx(re,{className:"font-bold text-gray-900 dark:text-white",children:h}),c&&i&&d.jsx(re,{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:c})]})]})]})},Jd=Object.freeze(Object.defineProperty({__proto__:null,default:Ss},Symbol.toStringTag,{value:"Module"})),_s="carousel",Xr="controller",Rd="navigation",eu="no-scroll",ko="portal",tu="root",Es="toolbar",ru="counter",Zr="fullscreen",Ts="slideshow",qr="thumbnails",Ns="zoom",Er="loading",Co="playing",Qr="error",Jr="complete",nu="placeholder",Rr=e=>`active-slide-${e}`,ou=Rr(Er),au=Rr(Co),su=Rr(Qr),lu=Rr(Jr),As="fullsize",Tr="flex_center",iu="no_scroll",Ms="no_scroll_padding",So="slide",Os="slide_wrapper",cu="slide_wrapper_interactive",er="prev",tr="next",_o="swipe",Nr="close",Is="onPointerDown",Ds="onPointerMove",Ls="onPointerUp",Ps="onPointerLeave",Fs="onPointerCancel",Eo="onKeyDown",du="onKeyUp",To="onWheel",uu="Escape",fu="ArrowLeft",gu="ArrowRight",hu="button",Cn="icon",$s="contain",Us="cover",zs="Unknown action type",Hs="yarl__";function ft(...e){return e.filter(Boolean).join(" ")}function pe(e){return`${Hs}${e}`}function Ve(e){return`--${Hs}${e}`}function sr(e,t){return`${e}${t?`_${t}`:""}`}function lr(e){return t=>sr(e,t)}function ir(e,t){var r;return(r=e?.[t])!==null&&r!==void 0?r:t}function Gs(e,t,r){return ir(e,"{index} of {total}").replace(/\{index}/g,`${Oo(r,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function Ar(...e){return()=>{e.forEach(t=>{t()})}}function Tt(e,t,r){return()=>{const n=E.useContext(r);if(!n)throw new Error(`${e} must be used within a ${t}.Provider`);return n}}function No(){return typeof window<"u"}function Ao(e,t=0){const r=10**t;return Math.round((e+Number.EPSILON)*r)/r}function rr(e){return e.type===void 0||e.type==="image"}function Mo(e,t){return e.imageFit===Us||e.imageFit!==$s&&t===Us}function Sn(e){return typeof e=="string"?Number.parseInt(e,10):e}function _n(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=Sn(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function pu(e,t){const r=_n(t),n=r.percent!==void 0?e.width/100*r.percent:r.pixel;return{width:Math.max(e.width-2*n,0),height:Math.max(e.height-2*n,0)}}function mu(){return(No()?window?.devicePixelRatio:void 0)||1}function Oo(e,t){return t>0?(e%t+t)%t:0}function Io(e){return e.length>0}function Do(e,t){return e[Oo(t,e.length)]}function Lo(e,t){return Io(e)?Do(e,t):void 0}function js(e){return rr(e)?e.src:void 0}function En(e,t,r){if(!r)return e;const{buttons:n,...o}=e,a=n.findIndex(l=>l===t),s=E.isValidElement(r)?E.cloneElement(r,{key:t},null):r;if(a>=0){const l=[...n];return l.splice(a,1,s),{buttons:l,...o}}return{buttons:[s,...n],...o}}function Bs(e,t,r=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),r))}const bu=Number(E.version.split(".")[0])>=19;function yu(e){return{inert:bu?e:e?"":void 0}}function vu(e){e.scrollTop}const Po={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[Nr]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:$s,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,closeOnEscape:!0,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function Lt(e,t){return{name:e,component:t}}function ot(e,t){return{module:e,children:t}}function Ws(e,t,r){return e.module.name===t?r(e):e.children?[ot(e.module,e.children.flatMap(n=>{var o;return(o=Ws(n,t,r))!==null&&o!==void 0?o:[]}))]:[e]}function Mr(e,t,r){return e.flatMap(n=>{var o;return(o=Ws(n,t,r))!==null&&o!==void 0?o:[]})}function wu(e,t=[],r=[]){let n=e;const o=g=>{const p=[...n];for(;p.length>0;){const m=p.pop();if(m?.module.name===g)return!0;m?.children&&p.push(...m.children)}return!1},a=(g,p)=>{if(g===""){n=[ot(p,n)];return}n=Mr(n,g,m=>[ot(p,[m])])},s=(g,p)=>{n=Mr(n,g,m=>[ot(m.module,[ot(p,m.children)])])},l=(g,p,m)=>{n=Mr(n,g,v=>{var x;return[ot(v.module,[...m?[ot(p)]:[],...(x=v.children)!==null&&x!==void 0?x:[],...m?[]:[ot(p)]])]})},f=(g,p,m)=>{n=Mr(n,g,v=>[...m?[ot(p)]:[],v,...m?[]:[ot(p)]])},h=g=>{s(Xr,g)},c=(g,p)=>{n=Mr(n,g,m=>[ot(p,m.children)])},i=g=>{n=Mr(n,g,p=>p.children)},u=g=>{r.push(g)};return t.forEach(g=>{g({contains:o,addParent:a,append:s,addChild:l,addSibling:f,addModule:h,replace:c,remove:i,augment:u})}),{config:n,augmentation:g=>r.reduce((p,m)=>m(p),g)}}const Ks=E.createContext(null),Fo=Tt("useA11yContext","A11yContext",Ks);function xu({children:e}){const[t,r]=E.useState(!1),[n,o]=E.useState(!1),a=E.useMemo(()=>({focusWithin:t,trackFocusWithin:(l,f)=>{const h=c=>i=>{var u;i.currentTarget.contains(i.relatedTarget)||r(c),(u=c?l:f)===null||u===void 0||u(i)};return{onFocus:h(!0),onBlur:h(!1)}},autoPlaying:n,setAutoPlaying:o}),[t,n]);return E.createElement(Ks.Provider,{value:a},e)}const Vs=E.createContext(null),Or=Tt("useDocument","DocumentContext",Vs);function ku({nodeRef:e,children:t}){const r=E.useMemo(()=>{const n=a=>{var s;return((s=a||e.current)===null||s===void 0?void 0:s.ownerDocument)||document};return{getOwnerDocument:n,getOwnerWindow:a=>{var s;return((s=n(a))===null||s===void 0?void 0:s.defaultView)||window}}},[e]);return E.createElement(Vs.Provider,{value:r},t)}const Ys=E.createContext(null),Ir=Tt("useEvents","EventsContext",Ys);function Cu({children:e}){const[t]=E.useState({});E.useEffect(()=>()=>{Object.keys(t).forEach(n=>delete t[n])},[t]);const r=E.useMemo(()=>{const n=(s,l)=>{var f;(f=t[s])===null||f===void 0||f.splice(0,t[s].length,...t[s].filter(h=>h!==l))};return{publish:(...[s,l])=>{var f;(f=t[s])===null||f===void 0||f.forEach(h=>h(l))},subscribe:(s,l)=>(t[s]||(t[s]=[]),t[s].push(l),()=>n(s,l)),unsubscribe:n}},[t]);return E.createElement(Ys.Provider,{value:r},e)}const Xs=E.createContext(null),at=Tt("useLightboxProps","LightboxPropsContext",Xs);function Zs({children:e,...t}){return E.createElement(Xs.Provider,{value:t},e)}const qs=E.createContext(null),Pt=Tt("useLightboxState","LightboxStateContext",qs),Qs=E.createContext(null),Su=Tt("useLightboxDispatch","LightboxDispatchContext",Qs);function _u(e,t){switch(t.type){case"swipe":{const{slides:r}=e,n=t?.increment||0,o=e.globalIndex+n,a=Oo(o,r.length),s=Lo(r,a),l=n||t.duration!==void 0?{increment:n,duration:t.duration,easing:t.easing}:void 0;return{slides:r,currentIndex:a,globalIndex:o,currentSlide:s,animation:l}}case"update":return t.slides!==e.slides||t.index!==e.currentIndex?{slides:t.slides,currentIndex:t.index,globalIndex:t.index,currentSlide:Lo(t.slides,t.index)}:e;default:throw new Error(zs)}}function Eu({slides:e,index:t,children:r}){const[n,o]=E.useReducer(_u,{slides:e,currentIndex:t,globalIndex:t,currentSlide:Lo(e,t)}),[a,s]=E.useState(e),[l,f]=E.useState(t);(e!==a||t!==l)&&(s(e),f(t),o({type:"update",slides:e,index:t}));const h=E.useMemo(()=>({...n,state:n,dispatch:o}),[n,o]);return E.createElement(Qs.Provider,{value:o},E.createElement(qs.Provider,{value:h},r))}const Js=E.createContext(null),Tu=Tt("useRTLContext","RTLContext",Js);function Nu({isRTL:e,children:t}){const r=E.useMemo(()=>({isRTL:e}),[e]);return E.createElement(Js.Provider,{value:r},t)}const Rs=E.createContext(null),en=Tt("useTimeouts","TimeoutsContext",Rs);function Au({children:e}){const[t]=E.useState([]);E.useEffect(()=>()=>{t.forEach(n=>window.clearTimeout(n)),t.splice(0,t.length)},[t]);const r=E.useMemo(()=>{const n=s=>{t.splice(0,t.length,...t.filter(l=>l!==s))};return{setTimeout:(s,l)=>{const f=window.setTimeout(()=>{n(f),s()},l);return t.push(f),f},clearTimeout:s=>{s!==void 0&&(n(s),window.clearTimeout(s))}}},[t]);return E.createElement(Rs.Provider,{value:r},e)}const Dr=E.forwardRef(function({label:t,className:r,icon:n,renderIcon:o,onClick:a,style:s,...l},f){const{styles:h,labels:c}=at(),i=ir(c,t);return E.createElement("button",{ref:f,type:"button",title:i,"aria-label":i,className:ft(pe(hu),r),onClick:a,style:{...s,...h.button},...l},o?o():E.createElement(n,{className:pe(Cn),style:h.icon}))});function el(e,t){const r=n=>E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...n},t);return r.displayName=e,r}function vt(e,t){return el(e,E.createElement("g",{fill:"currentColor"},E.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}function Mu(e,t){return el(e,E.createElement(E.Fragment,null,E.createElement("defs",null,E.createElement("mask",{id:"strike"},E.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),E.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),E.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),E.createElement("g",{fill:"currentColor",mask:"url(#strike)"},E.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t)))}const Ou=vt("Close",E.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),Iu=vt("Previous",E.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),Du=vt("Next",E.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),Lu=vt("Loading",E.createElement(E.Fragment,null,Array.from({length:8}).map((e,t,r)=>E.createElement("line",{key:t,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/r.length*(t+1),transform:`rotate(${360/r.length*t}, 12, 12)`})))),Pu=vt("Error",E.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),jt=No()?E.useLayoutEffect:E.useEffect;function $o(){const[e,t]=E.useState(!1);return E.useEffect(()=>{var r,n;const o=(r=window.matchMedia)===null||r===void 0?void 0:r.call(window,"(prefers-reduced-motion: reduce)");t(o?.matches);const a=s=>t(s.matches);return(n=o?.addEventListener)===null||n===void 0||n.call(o,"change",a),()=>{var s;return(s=o?.removeEventListener)===null||s===void 0?void 0:s.call(o,"change",a)}},[]),e}function Fu(e){let t=0,r=0,n=0;const a=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(a){const s=a[1].split(",").map(Sn);s.length===6?(t=s[4],r=s[5]):s.length===16&&(t=s[12],r=s[13],n=s[14])}return{x:t,y:r,z:n}}function Uo(e,t){const r=E.useRef(void 0),n=E.useRef(void 0),o=$o();return jt(()=>{var a,s,l;if(e.current&&r.current!==void 0&&!o){const{keyframes:f,duration:h,easing:c,onfinish:i}=t(r.current,e.current.getBoundingClientRect(),Fu(e.current))||{};if(f&&h){(a=n.current)===null||a===void 0||a.cancel(),n.current=void 0;try{n.current=(l=(s=e.current).animate)===null||l===void 0?void 0:l.call(s,f,{duration:h,easing:c})}catch(u){console.error(u)}n.current&&(n.current.onfinish=()=>{n.current=void 0,i?.()})}}r.current=void 0}),{prepareAnimation:a=>{r.current=a},isAnimationPlaying:()=>{var a;return((a=n.current)===null||a===void 0?void 0:a.playState)==="running"}}}function tl(){const e=E.useRef(null),t=E.useRef(void 0),[r,n]=E.useState();return{setContainerRef:E.useCallback(a=>{e.current=a,t.current&&(t.current.disconnect(),t.current=void 0);const s=()=>{if(a){const l=window.getComputedStyle(a),f=h=>parseFloat(h)||0;n({width:Math.round(a.clientWidth-f(l.paddingLeft)-f(l.paddingRight)),height:Math.round(a.clientHeight-f(l.paddingTop)-f(l.paddingBottom))})}else n(void 0)};s(),a&&typeof ResizeObserver<"u"&&(t.current=new ResizeObserver(s),t.current.observe(a))},[]),containerRef:e,containerRect:r}}function Tn(){const e=E.useRef(void 0),{setTimeout:t,clearTimeout:r}=en();return E.useCallback((n,o)=>{r(e.current),e.current=t(n,o>0?o:0)},[t,r])}function Le(e){const t=E.useRef(e);return jt(()=>{t.current=e}),E.useCallback((...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}function rl(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function zo(e,t){return E.useMemo(()=>e==null&&t==null?null:r=>{rl(e,r),rl(t,r)},[e,t])}function nl(e,t=!1){const r=E.useRef(!1);jt(()=>{t&&r.current&&(r.current=!1,e())},[t,e]);const n=E.useCallback(()=>{r.current=!0},[]),o=E.useCallback(()=>{r.current=!1},[]);return{onFocus:n,onBlur:o}}function Nn(){return Tu().isRTL}function ol(){const[e]=E.useState({}),t=E.useCallback((o,a)=>{var s;(s=e[o])===null||s===void 0||s.forEach(l=>{a.isPropagationStopped()||l(a)})},[e]),r=E.useMemo(()=>({onPointerDown:o=>t(Is,o),onPointerMove:o=>t(Ds,o),onPointerUp:o=>t(Ls,o),onPointerLeave:o=>t(Ps,o),onPointerCancel:o=>t(Fs,o),onKeyDown:o=>t(Eo,o),onKeyUp:o=>t(du,o),onWheel:o=>t(To,o)}),[t]),n=E.useCallback((o,a)=>(e[o]||(e[o]=[]),e[o].unshift(a),()=>{const s=e[o];s&&s.splice(0,s.length,...s.filter(l=>l!==a))}),[e]);return{registerSensors:r,subscribeSensors:n}}function al(e,t){const r=E.useRef(0),n=Tn(),o=Le((...a)=>{r.current=Date.now(),e(a)});return E.useCallback((...a)=>{n(()=>{o(a)},t-(Date.now()-r.current))},[t,o,n])}const Ho=lr("slide"),Go=lr("slide_image");function cr({slide:e,offset:t,render:r,rect:n,imageFit:o,imageProps:a,onClick:s,onLoad:l,onError:f,style:h}){var c,i,u,g,p,m,v,x;const[M,w]=E.useState(Er),{publish:T}=Ir(),{setTimeout:A}=en(),_=E.useRef(null);E.useEffect(()=>{t===0&&T(Rr(M))},[t,M,T]);const I=Le(B=>{("decode"in B?B.decode():Promise.resolve()).catch(()=>{}).then(()=>{B.parentNode&&(w(Jr),A(()=>{l?.(B)},0))})}),k=E.useCallback(B=>{_.current=B,B?.complete&&I(B)},[I]),y=E.useCallback(B=>{I(B.currentTarget)},[I]),N=Le(()=>{w(Qr),f?.()}),D=Mo(e,o),P=(B,V)=>Number.isFinite(B)?B:V,O=P(Math.max(...((i=(c=e.srcSet)===null||c===void 0?void 0:c.map(B=>B.width))!==null&&i!==void 0?i:[]).concat(e.width?[e.width]:[]).filter(Boolean)),((u=_.current)===null||u===void 0?void 0:u.naturalWidth)||0),L=P(Math.max(...((p=(g=e.srcSet)===null||g===void 0?void 0:g.map(B=>B.height))!==null&&p!==void 0?p:[]).concat(e.height?[e.height]:[]).filter(Boolean)),((m=_.current)===null||m===void 0?void 0:m.naturalHeight)||0),$=O&&L?{maxWidth:`min(${O}px, 100%)`,maxHeight:`min(${L}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},S=(v=e.srcSet)===null||v===void 0?void 0:v.slice().sort((B,V)=>B.width-V.width).map(B=>`${B.src} ${B.width}w`).join(", "),b=()=>n&&!D&&e.width&&e.height?n.height/e.height*e.width:Number.MAX_VALUE,z=S&&n&&No()?`${Math.round(Math.min(b(),n.width))}px`:void 0,{style:U,className:G,...Y}=(typeof a=="function"?a(e):a)||{};return E.createElement(E.Fragment,null,E.createElement("img",{ref:k,onLoad:y,onError:N,onClick:s,draggable:!1,className:ft(pe(Go()),D&&pe(Go("cover")),M!==Jr&&pe(Go("loading")),G),style:{...$,...h,...U},...Y,alt:(x=e.alt)!==null&&x!==void 0?x:"",sizes:z,srcSet:S,src:e.src}),M!==Jr&&E.createElement("div",{className:pe(Ho(nu))},M===Er&&(r?.iconLoading?r.iconLoading():E.createElement(Lu,{className:ft(pe(Cn),pe(Ho(Er)))})),M===Qr&&(r?.iconError?r.iconError():E.createElement(Pu,{className:ft(pe(Cn),pe(Ho(Qr)))}))))}const $u=E.forwardRef(function({className:t,children:r,onFocus:n,onBlur:o,...a},s){const l=E.useRef(null),[f,h]=E.useState(!1),{trackFocusWithin:c}=Fo(),i=Le(()=>{if(l.current){const u=window.getComputedStyle(l.current).direction==="rtl";u!==f&&h(u)}});return E.useEffect(i),E.createElement(ku,{nodeRef:l},E.createElement(Nu,{isRTL:f},E.createElement("div",{ref:zo(s,l),className:ft(pe("root"),t),...c(n,o),...a},r)))});var gt;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"})(gt||(gt={}));function sl(e,t,r,n,o){E.useEffect(()=>o?()=>{}:Ar(e(Is,t),e(Ds,r),e(Ls,n),e(Ps,n),e(Fs,n)),[e,t,r,n,o])}var Bt;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"})(Bt||(Bt={}));const jo=30;function Uu({disableSwipeNavigation:e,closeOnBackdropClick:t},r,n,o,a,s,l,f,h,c,i,u,g,p,m,v){const x=E.useRef(0),M=E.useRef([]),w=E.useRef(void 0),T=E.useRef(0),A=E.useRef(Bt.NONE),_=E.useCallback(O=>{w.current===O.pointerId&&(w.current=void 0,A.current=Bt.NONE);const L=M.current;L.splice(0,L.length,...L.filter($=>$.pointerId!==O.pointerId))},[]),I=E.useCallback(O=>{_(O),O.persist(),M.current.push(O)},[_]),k=E.useCallback(O=>M.current.find(({pointerId:L})=>O.pointerId===L),[]),y=Le(O=>{I(O)}),N=(O,L)=>i&&O>L||c&&O<-L,D=Le(O=>{const L=k(O);if(L)if(w.current===O.pointerId){const $=Date.now()-T.current,S=x.current;A.current===Bt.SWIPE?Math.abs(S)>.3*o||Math.abs(S)>5&&$<a?f(S,$):h(S):A.current===Bt.PULL&&(N(S,2*jo)?p(S,$):m(S)),x.current=0,A.current=Bt.NONE}else{const{target:$}=O;t&&$ instanceof HTMLElement&&$===L.target&&($.classList.contains(pe(So))||$.classList.contains(pe(Os)))&&v()}_(O)}),P=Le(O=>{const L=k(O);if(L){const $=w.current===O.pointerId;if(O.buttons===0){$&&x.current!==0?D(O):_(L);return}const S=O.clientX-L.clientX,b=O.clientY-L.clientY;if(w.current===void 0){const z=U=>{I(O),w.current=O.pointerId,T.current=Date.now(),A.current=U};Math.abs(S)>Math.abs(b)&&Math.abs(S)>jo&&n(S)?e||(z(Bt.SWIPE),s()):Math.abs(b)>Math.abs(S)&&N(b,jo)&&(z(Bt.PULL),u())}else $&&(A.current===Bt.SWIPE?(x.current=S,l(S)):A.current===Bt.PULL&&(x.current=b,g(b)))}});sl(r,y,P,D)}function zu({preventDefaultWheelX:e,preventDefaultWheelY:t}){const r=E.useRef(null),n=Le(o=>{const a=Math.abs(o.deltaX)>Math.abs(o.deltaY);(a&&e||!a&&t||o.ctrlKey)&&o.preventDefault()});return E.useCallback(o=>{var a;o?o.addEventListener("wheel",n,{passive:!1}):(a=r.current)===null||a===void 0||a.removeEventListener("wheel",n),r.current=o},[n])}function Hu(e,t,r,n,o,a,s,l,f){const h=E.useRef(0),c=E.useRef(0),i=E.useRef(void 0),u=E.useRef(void 0),g=E.useRef(0),p=E.useRef(void 0),m=E.useRef(0),{setTimeout:v,clearTimeout:x}=en(),M=E.useCallback(()=>{i.current&&(x(i.current),i.current=void 0)},[x]),w=E.useCallback(()=>{u.current&&(x(u.current),u.current=void 0)},[x]),T=Le(()=>{e!==gt.SWIPE&&(h.current=0,m.current=0,M(),w())});E.useEffect(T,[e,T]);const A=Le(I=>{u.current=void 0,h.current===I&&f(h.current)}),_=Le(I=>{if(I.ctrlKey||Math.abs(I.deltaY)>Math.abs(I.deltaX))return;const k=y=>{g.current=y,x(p.current),p.current=y>0?v(()=>{g.current=0,p.current=void 0},300):void 0};if(e===gt.NONE){if(Math.abs(I.deltaX)<=1.2*Math.abs(g.current)){k(I.deltaX);return}if(!r(-I.deltaX))return;if(c.current+=I.deltaX,M(),Math.abs(c.current)>30)c.current=0,k(0),m.current=Date.now(),a();else{const y=c.current;i.current=v(()=>{i.current=void 0,y===c.current&&(c.current=0)},o)}}else if(e===gt.SWIPE){let y=h.current-I.deltaX;if(y=Math.min(Math.abs(y),n)*Math.sign(y),h.current=y,s(y),w(),Math.abs(y)>.2*n){k(I.deltaX),l(y,Date.now()-m.current);return}u.current=v(()=>A(y),2*o)}else k(I.deltaX)});E.useEffect(()=>t(To,_),[t,_])}const ll=lr("container"),il=E.createContext(null),Wt=Tt("useController","ControllerContext",il);function Gu({children:e,...t}){var r;const{carousel:n,animation:o,controller:a,on:s,styles:l,render:f}=t,{closeOnPullUp:h,closeOnPullDown:c,preventDefaultWheelX:i,preventDefaultWheelY:u}=a,[g,p]=E.useState(),m=Pt(),v=Su(),[x,M]=E.useState(gt.NONE),w=E.useRef(0),T=E.useRef(0),A=E.useRef(1),{registerSensors:_,subscribeSensors:I}=ol(),{subscribe:k,publish:y}=Ir(),N=Tn(),D=Tn(),P=Tn(),{containerRef:O,setContainerRef:L,containerRect:$}=tl(),S=zo(zu({preventDefaultWheelX:i,preventDefaultWheelY:u}),L),b=E.useRef(null),z=zo(b,void 0),{getOwnerDocument:U}=Or(),G=Nn(),Y=K=>(G?-1:1)*(typeof K=="number"?K:1),B=Le(()=>{var K;return(K=O.current)===null||K===void 0?void 0:K.focus()}),V=Le(()=>t),j=Le(()=>m),H=E.useCallback(K=>y(er,K),[y]),q=E.useCallback(K=>y(tr,K),[y]),ee=E.useCallback(()=>y(Nr),[y]),ne=K=>!(n.finite&&(Y(K)>0&&m.currentIndex===0||Y(K)<0&&m.currentIndex===m.slides.length-1)),ce=K=>{var te;w.current=K,(te=O.current)===null||te===void 0||te.style.setProperty(Ve("swipe_offset"),`${Math.round(K)}px`)},R=K=>{var te,oe;T.current=K,A.current=(()=>{const Te=c&&K>0?K:h&&K<0?-K:0;return Math.min(Math.max(Ao(1-Te/60*(1-.5),2),.5),1)})(),(te=O.current)===null||te===void 0||te.style.setProperty(Ve("pull_offset"),`${Math.round(K)}px`),(oe=O.current)===null||oe===void 0||oe.style.setProperty(Ve("pull_opacity"),`${A.current}`)},{prepareAnimation:_e}=Uo(b,(K,te,oe)=>{if(b.current&&$)return{keyframes:[{transform:`translate(0, ${K.rect.y-te.y+oe.y}px)`,opacity:K.opacity},{transform:"translate(0, 0)",opacity:1}],duration:K.duration,easing:o.easing.fade}}),me=(K,te)=>{if(h||c){R(K);let oe=0;b.current&&(oe=o.fade*(te?2:1),_e({rect:b.current.getBoundingClientRect(),opacity:A.current,duration:oe})),P(()=>{R(0),M(gt.NONE)},oe),M(gt.ANIMATION),te||ee()}},{prepareAnimation:Be,isAnimationPlaying:$e}=Uo(b,(K,te,oe)=>{var le;if(b.current&&$&&(!((le=m.animation)===null||le===void 0)&&le.duration)){const ve=_n(n.spacing),Te=(ve.percent?ve.percent*$.width/100:ve.pixel)||0;return{keyframes:[{transform:`translate(${Y(m.globalIndex-K.index)*($.width+Te)+K.rect.x-te.x+oe.x}px, 0)`},{transform:"translate(0, 0)"}],duration:m.animation.duration,easing:m.animation.easing}}}),ye=Le(K=>{var te,oe;const le=K.offset||0,ve=le?o.swipe:(te=o.navigation)!==null&&te!==void 0?te:o.swipe,Te=!le&&!$e()?o.easing.navigation:o.easing.swipe;let{direction:We}=K;const Ae=(oe=K.count)!==null&&oe!==void 0?oe:1;let He=gt.ANIMATION,Ie=ve*Ae;if(!We){const se=$?.width,de=K.duration||0,ue=se?ve/se*Math.abs(le):ve;Ae!==0?(de<ue?Ie=Ie/ue*Math.max(de,ue/5):se&&(Ie=ve/se*(se-Math.abs(le))),We=Y(le)>0?er:tr):Ie=ve/2}let X=0;We===er?ne(Y(1))?X=-Ae:(He=gt.NONE,Ie=ve):We===tr&&(ne(Y(-1))?X=Ae:(He=gt.NONE,Ie=ve)),Ie=Math.round(Ie),D(()=>{ce(0),M(gt.NONE)},Ie),b.current&&Be({rect:b.current.getBoundingClientRect(),index:m.globalIndex}),M(He),y(_o,{type:"swipe",increment:X,duration:Ie,easing:Te})});E.useEffect(()=>{var K,te;!((K=m.animation)===null||K===void 0)&&K.increment&&(!((te=m.animation)===null||te===void 0)&&te.duration)&&N(()=>v({type:"swipe",increment:0}),m.animation.duration)},[m.animation,v,N]);const Ne=[I,ne,$?.width||0,o.swipe,()=>M(gt.SWIPE),K=>ce(K),(K,te)=>ye({offset:K,duration:te,count:1}),K=>ye({offset:K,count:0})],we=[()=>{c&&M(gt.PULL)},K=>R(K),K=>me(K),K=>me(K,!0)];Uu(a,...Ne,h,c,...we,ee),Hu(x,...Ne);const ke=Le(()=>{a.focus&&U().querySelector(`.${pe(ko)} .${pe(ll())}`)&&B()});E.useEffect(ke,[ke]);const Ue=Le(()=>{var K;(K=s.view)===null||K===void 0||K.call(s,{index:m.currentIndex})});E.useEffect(Ue,[m.globalIndex,Ue]),E.useEffect(()=>Ar(k(er,K=>ye({direction:er,...K})),k(tr,K=>ye({direction:tr,...K})),k(_o,K=>v(K))),[k,ye,v]);const Oe=E.useMemo(()=>({prev:H,next:q,close:ee,focus:B,slideRect:$?pu($,n.padding):{width:0,height:0},containerRect:$||{width:0,height:0},subscribeSensors:I,containerRef:O,setCarouselRef:z,toolbarWidth:g,setToolbarWidth:p}),[H,q,ee,B,I,$,O,z,g,p,n.padding]);return E.useImperativeHandle(a.ref,()=>({prev:H,next:q,close:ee,focus:B,getLightboxProps:V,getLightboxState:j}),[H,q,ee,B,V,j]),E.createElement("div",{ref:S,className:ft(pe(ll()),pe(Tr)),style:{...x===gt.SWIPE?{[Ve("swipe_offset")]:`${Math.round(w.current)}px`}:null,...x===gt.PULL?{[Ve("pull_offset")]:`${Math.round(T.current)}px`,[Ve("pull_opacity")]:`${A.current}`}:null,...a.touchAction!=="none"?{[Ve("controller_touch_action")]:a.touchAction}:null,...l.container},tabIndex:-1,..._},$&&E.createElement(il.Provider,{value:Oe},e,(r=f.controls)===null||r===void 0?void 0:r.call(f)))}const ju=Lt(Xr,Gu);function dr(e){return sr(_s,e)}function cl(e){return sr(So,e)}function Bu({slide:e,offset:t}){const r=E.useRef(null),{currentIndex:n,slides:o}=Pt(),{slideRect:a,focus:s}=Wt(),{render:l,carousel:{imageFit:f,imageProps:h},on:{click:c},styles:{slide:i},labels:u}=at(),{getOwnerDocument:g}=Or(),p=t!==0;E.useEffect(()=>{var v;p&&(!((v=r.current)===null||v===void 0)&&v.contains(g().activeElement))&&s()},[p,s,g]);const m=()=>{var v,x,M,w;let T=(v=l.slide)===null||v===void 0?void 0:v.call(l,{slide:e,offset:t,rect:a});return!T&&rr(e)&&(T=E.createElement(cr,{slide:e,offset:t,render:l,rect:a,imageFit:f,imageProps:h,onClick:p?void 0:()=>c?.({index:n})})),T?E.createElement(E.Fragment,null,(x=l.slideHeader)===null||x===void 0?void 0:x.call(l,{slide:e}),((M=l.slideContainer)!==null&&M!==void 0?M:(({children:A})=>A))({slide:e,children:T}),(w=l.slideFooter)===null||w===void 0?void 0:w.call(l,{slide:e})):null};return E.createElement("div",{ref:r,className:ft(pe(cl()),!p&&pe(cl("current")),pe(Tr)),...yu(p),style:i,role:"group","aria-roledescription":ir(u,"Slide"),"aria-label":Gs(u,o,n+t)},m())}function Wu(){const e=at().styles.slide;return E.createElement("div",{className:pe(So),style:e})}function Ku({carousel:e,labels:t}){const{slides:r,currentIndex:n,globalIndex:o}=Pt(),{setCarouselRef:a}=Wt(),{autoPlaying:s,focusWithin:l}=Fo(),f=_n(e.spacing),h=_n(e.padding),c=Bs(e,r,1),i=[];if(Io(r))for(let u=n-c;u<=n+c;u+=1){const g=Do(r,u),p=o-n+u,m=e.finite&&(u<0||u>r.length-1);i.push(m?{key:p}:{key:[`${p}`,js(g)].filter(Boolean).join("|"),offset:u-n,slide:g})}return E.createElement("div",{ref:a,className:ft(pe(dr()),i.length>0&&pe(dr("with_slides"))),style:{[`${Ve(dr("slides_count"))}`]:i.length,[`${Ve(dr("spacing_px"))}`]:f.pixel||0,[`${Ve(dr("spacing_percent"))}`]:f.percent||0,[`${Ve(dr("padding_px"))}`]:h.pixel||0,[`${Ve(dr("padding_percent"))}`]:h.percent||0},role:"region","aria-live":s&&!l?"off":"polite","aria-roledescription":ir(t,"Carousel"),"aria-label":ir(t,"Photo gallery")},i.map(({key:u,slide:g,offset:p})=>g?E.createElement(Bu,{key:u,slide:g,offset:p}):E.createElement(Wu,{key:u})))}const Vu=Lt(_s,Ku);function dl(){const{carousel:e}=at(),{slides:t,currentIndex:r}=Pt(),n=t.length===0||e.finite&&r===0,o=t.length===0||e.finite&&r===t.length-1;return{prevDisabled:n,nextDisabled:o}}function ul(e){var t;const r=Nn(),{publish:n}=Ir(),{animation:o,controller:a}=at(),{prevDisabled:s,nextDisabled:l}=dl(),f=((t=o.navigation)!==null&&t!==void 0?t:o.swipe)/2,h=al(()=>n(er),f),c=al(()=>n(tr),f),i=Le(u=>{switch(u.key){case uu:if(!a.closeOnEscape)return;n(Nr);break;case fu:(r?l:s)||(r?c:h)();break;case gu:(r?s:l)||(r?h:c)();break;default:return}u.stopPropagation()});E.useEffect(()=>e(Eo,i),[e,i])}function fl({label:e,icon:t,renderIcon:r,action:n,onClick:o,disabled:a,style:s}){return E.createElement(Dr,{label:e,icon:t,renderIcon:r,className:pe(`navigation_${n}`),disabled:a,onClick:o,style:s,...nl(Wt().focus,a)})}function Yu({render:{buttonPrev:e,buttonNext:t,iconPrev:r,iconNext:n},styles:o}){const{prev:a,next:s,subscribeSensors:l}=Wt(),{prevDisabled:f,nextDisabled:h}=dl();return ul(l),E.createElement(E.Fragment,null,e?e():E.createElement(fl,{label:"Previous",action:er,icon:Iu,renderIcon:r,style:o.navigationPrev,disabled:f,onClick:a}),t?t():E.createElement(fl,{label:"Next",action:tr,icon:Du,renderIcon:n,style:o.navigationNext,disabled:h,onClick:s}))}const Xu=Lt(Rd,Yu),gl=pe(iu),Zu=pe(Ms);function qu(e){return"style"in e}function hl(e,t,r){const n=window.getComputedStyle(e),o=r?"padding-left":"padding-right",a=r?n.paddingLeft:n.paddingRight,s=e.style.getPropertyValue(o);return e.style.setProperty(o,`${(Sn(a)||0)+t}px`),()=>{s?e.style.setProperty(o,s):e.style.removeProperty(o)}}function Qu({noScroll:{disabled:e},children:t}){const r=Nn(),{getOwnerDocument:n,getOwnerWindow:o}=Or();return E.useEffect(()=>{if(e)return()=>{};const a=[],s=o(),{body:l,documentElement:f}=n(),h=Math.round(s.innerWidth-f.clientWidth);if(h>0){a.push(hl(l,h,r));const c=l.getElementsByTagName("*");for(let i=0;i<c.length;i+=1){const u=c[i];qu(u)&&s.getComputedStyle(u).getPropertyValue("position")==="fixed"&&!u.classList.contains(Zu)&&a.push(hl(u,h,r))}}return l.classList.add(gl),()=>{l.classList.remove(gl),a.forEach(c=>c())}},[r,e,n,o]),E.createElement(E.Fragment,null,t)}const Ju=Lt(eu,Qu);function pl(e){return sr(ko,e)}function ml(e,t,r){const n=e.getAttribute(t);return e.setAttribute(t,r),()=>{n?e.setAttribute(t,n):e.removeAttribute(t)}}function Ru({portal:{root:e,container:{className:t,style:r,...n}={}},animation:o,styles:a,className:s,on:l,close:f,labels:h,children:c}){const[i,u]=E.useState(!1),[g,p]=E.useState(!1),m=E.useRef([]),v=E.useRef(null),{setTimeout:x}=en(),{subscribe:M}=Ir(),T=$o()?0:o.fade;E.useEffect(()=>(u(!0),()=>{u(!1),p(!1)}),[]);const A=Le(()=>{m.current.forEach(y=>y()),m.current=[]}),_=Le(()=>{var y;p(!1),A(),(y=l.exiting)===null||y===void 0||y.call(l),x(()=>{var N;(N=l.exited)===null||N===void 0||N.call(l),f()},T)});E.useEffect(()=>M(Nr,_),[M,_]);const I=Le(y=>{var N,D,P;vu(y),p(!0),(N=l.entering)===null||N===void 0||N.call(l);const O=(P=(D=y.parentNode)===null||D===void 0?void 0:D.children)!==null&&P!==void 0?P:[];for(let L=0;L<O.length;L+=1){const $=O[L];["TEMPLATE","SCRIPT","STYLE"].indexOf($.tagName)===-1&&$!==y&&(m.current.push(ml($,"inert","")),m.current.push(ml($,"aria-hidden","true")))}m.current.push(()=>{var L,$;($=(L=v.current)===null||L===void 0?void 0:L.focus)===null||$===void 0||$.call(L)}),x(()=>{var L;(L=l.entered)===null||L===void 0||L.call(l)},T)}),k=E.useCallback(y=>{y?I(y):A()},[I,A]);return i?Rt.createPortal(E.createElement($u,{ref:k,className:ft(s,t,pe(pl()),pe(Ms),g&&pe(pl("open"))),"aria-modal":!0,role:"dialog","aria-label":ir(h,"Lightbox"),style:{...o.fade!==Po.animation.fade?{[Ve("fade_animation_duration")]:`${T}ms`}:null,...o.easing.fade!==Po.animation.easing.fade?{[Ve("fade_animation_timing_function")]:o.easing.fade}:null,...a.root,...r},onFocus:y=>{v.current||(v.current=y.relatedTarget)},...n},c),(typeof e=="function"?e():e)||document.body):null}const ef=Lt(ko,Ru);function tf({children:e}){return E.createElement(E.Fragment,null,e)}const rf=Lt(tu,tf);function nf(e){return sr(Es,e)}function of({toolbar:{buttons:e},render:{buttonClose:t,iconClose:r},styles:n}){const{close:o,setToolbarWidth:a}=Wt(),{setContainerRef:s,containerRect:l}=tl();jt(()=>{a(l?.width)},[a,l?.width]);const f=()=>t?t():E.createElement(Dr,{key:Nr,label:"Close",icon:Ou,renderIcon:r,onClick:o});return E.createElement("div",{ref:s,style:n.toolbar,className:pe(nf())},e?.map(h=>h===Nr?f():h))}const af=Lt(Es,of);function bl(e,t){var r;return E.createElement(e.module.component,{key:e.module.name,...t},(r=e.children)===null||r===void 0?void 0:r.map(n=>bl(n,t)))}function sf(e,t={}){const{easing:r,...n}=e,{easing:o,...a}=t;return{easing:{...r,...o},...n,...a}}function lf({carousel:e,animation:t,render:r,toolbar:n,controller:o,noScroll:a,on:s,plugins:l,slides:f,index:h,...c}){const{animation:i,carousel:u,render:g,toolbar:p,controller:m,noScroll:v,on:x,slides:M,index:w,plugins:T,...A}=Po,{config:_,augmentation:I}=wu([ot(ef,[ot(Ju,[ot(ju,[ot(Vu),ot(af),ot(Xu)])])])],l||T),k=I({animation:sf(i,t),carousel:{...u,...e},render:{...g,...r},toolbar:{...p,...n},controller:{...m,...o},noScroll:{...v,...a},on:{...x,...s},...A,...c});return k.open?E.createElement(Zs,{...k},E.createElement(Eu,{slides:f||M,index:Sn(h||w)},E.createElement(Au,null,E.createElement(Cu,null,E.createElement(xu,null,bl(ot(rf,_),k)))))):null}const yl={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1,maxZoom:8};function cf(e){return Math.min(Math.max(e,Number.EPSILON),1)}function vl(e){const{minZoom:t,...r}={...yl,...e};return{minZoom:cf(t),...r}}function df(e,t,r,n){const o=E.useRef(void 0),a=E.useRef(void 0),{zoom:s}=at().animation,l=$o(),f=Le(()=>{var h,c,i;if((h=o.current)===null||h===void 0||h.cancel(),o.current=void 0,a.current&&n?.current){try{o.current=(i=(c=n.current).animate)===null||i===void 0?void 0:i.call(c,[{transform:a.current},{transform:`scale(${e}) translateX(${t}px) translateY(${r}px)`}],{duration:l?0:s??500,easing:o.current?"ease-out":"ease-in-out"})}catch(u){console.error(u)}a.current=void 0,o.current&&(o.current.onfinish=()=>{o.current=void 0})}});return jt(f,[e,t,r,f]),E.useCallback(()=>{a.current=n?.current?window.getComputedStyle(n.current).transform:void 0},[n])}function uf(e,t){const{on:r}=at(),n=Le(()=>{var o;t||(o=r.zoom)===null||o===void 0||o.call(r,{zoom:e})});E.useEffect(n,[e,n])}function An(){const{zoom:e}=at();return vl(e)}function ff(e,t){var r;const n=typeof e=="function"?(r=e(t))!==null&&r!==void 0?r:yl.maxZoom:e;return Math.max(n,1)}function gf(e,t){var r,n;let o={width:0,height:0},a={width:0,height:0};const{currentSlide:s}=Pt(),{imageFit:l}=at().carousel,{maxZoomPixelRatio:f,maxZoom:h}=An();if(e&&s){const i={...s,...t};if(rr(i)){const u=Mo(i,l),g=Math.max(...(((r=i.srcSet)===null||r===void 0?void 0:r.map(m=>m.width))||[]).concat(i.width?[i.width]:[])),p=Math.max(...(((n=i.srcSet)===null||n===void 0?void 0:n.map(m=>m.height))||[]).concat(i.height?[i.height]:[]));g>0&&p>0&&e.width>0&&e.height>0&&(a=u?{width:Math.round(Math.min(g,e.width/e.height*p)),height:Math.round(Math.min(p,e.height/e.width*g))}:{width:g,height:p},a={width:a.width*f,height:a.height*f},o=u?{width:Math.min(e.width,a.width,g),height:Math.min(e.height,a.height,p)}:{width:Math.round(Math.min(e.width,e.height/p*g,g)),height:Math.round(Math.min(e.height,e.width/g*p,p))})}else e.width>0&&e.height>0&&(t&&t.width>0&&t.height>0?o={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}:o={width:e.width,height:e.height})}const c=s&&o.width?rr(s)?Math.max(Ao(a.width/o.width,5),1):ff(h,s):1;return{imageRect:o,maxZoom:c}}function wl(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function xl(e,t,r=100,n=2){return e*Math.min(1+Math.abs(t/r),n)**Math.sign(t)}function hf(e,t,r,n,o,a,s,l,f){const h=E.useRef([]),c=E.useRef(0),i=E.useRef(void 0),{globalIndex:u}=Pt(),{getOwnerWindow:g}=Or(),{containerRef:p,subscribeSensors:m}=Wt(),{keyboardMoveDistance:v,zoomInMultiplier:x,wheelZoomDistanceFactor:M,scrollToZoom:w,doubleTapDelay:T,doubleClickDelay:A,doubleClickMaxStops:_,pinchZoomDistanceFactor:I,pinchZoomV4:k}=An(),y=E.useCallback(z=>{if(p.current){const{pageX:U,pageY:G}=z,{scrollX:Y,scrollY:B}=g(),{left:V,top:j,width:H,height:q}=p.current.getBoundingClientRect();return[U-V-Y-H/2,G-j-B-q/2]}return[]},[p,g]),N=Le(z=>{const{key:U,metaKey:G,ctrlKey:Y}=z,B=G||Y,V=()=>{z.preventDefault(),z.stopPropagation()};if(e>1){const j=(H,q)=>{V(),l(H,q)};U==="ArrowDown"?j(0,v):U==="ArrowUp"?j(0,-v):U==="ArrowLeft"?j(-v,0):U==="ArrowRight"&&j(v,0)}U==="+"||B&&U==="="?(V(),o()):U==="-"||B&&U==="_"?(V(),a()):B&&U==="0"&&(V(),s(1))}),D=Le(z=>{if((z.ctrlKey||w)&&Math.abs(z.deltaY)>Math.abs(z.deltaX)){z.stopPropagation(),s(xl(e,-z.deltaY,M),!0,...y(z));return}e>1&&(z.stopPropagation(),w||l(z.deltaX,z.deltaY))}),P=E.useCallback(z=>{const U=h.current;U.splice(0,U.length,...U.filter(G=>G.pointerId!==z.pointerId))},[]),O=E.useCallback(z=>{P(z),z.persist(),h.current.push(z)},[P]),L=Le(z=>{var U;const G=h.current;if(z.pointerType==="mouse"&&z.buttons>1||!(!((U=f?.current)===null||U===void 0)&&U.contains(z.target)))return;e>1&&z.stopPropagation();const{timeStamp:Y}=z;if(G.length===0&&Y-c.current<(z.pointerType==="touch"?T:A)){c.current=0;const B=e>=1?e!==r?e*Math.max(r**(1/_),x):1:e!==t?e/Math.max(t**(-1/_),x):1;s(B,!1,...y(z))}else c.current=Y;if(O(z),G.length===2){const B=wl(G[0],G[1]);i.current={previousDistance:B,initialDistance:Math.max(B,1),initialZoom:e}}}),$=Le(z=>{const U=h.current,G=U.find(Y=>Y.pointerId===z.pointerId);if(U.length===2&&i.current){z.stopPropagation(),O(z);const Y=wl(U[0],U[1]),B=k?i.current.initialZoom/i.current.initialDistance*Y:xl(e,Y-i.current.previousDistance,I);s(B,!0,...U.map(V=>y(V)).reduce((V,j)=>j.map((H,q)=>V[q]+H/2))),i.current.previousDistance=Y;return}e>1&&(z.stopPropagation(),G&&(U.length===1&&l((G.clientX-z.clientX)/e,(G.clientY-z.clientY)/e),O(z)))}),S=E.useCallback(z=>{const U=h.current;U.length===2&&U.find(G=>G.pointerId===z.pointerId)&&(i.current=void 0),P(z)},[P]),b=E.useCallback(()=>{const z=h.current;z.splice(0,z.length),c.current=0,i.current=void 0},[]);sl(m,L,$,S,n),E.useEffect(b,[u,b]),E.useEffect(()=>n?()=>{}:Ar(b,m(Eo,N),m(To,D)),[n,m,b,N,D])}function pf(e,t,r){const[n,o]=E.useState(1),[a,s]=E.useState(0),[l,f]=E.useState(0),h=df(n,a,l,r),{currentSlide:c,globalIndex:i}=Pt(),{containerRect:u,slideRect:g}=Wt(),{minZoom:p,zoomInMultiplier:m}=An(),v=c&&rr(c)?c.src:void 0,x=!r?.current;jt(()=>{o(1),s(0),f(0)},[i,v]);const M=E.useCallback((I,k,y)=>{const N=y||n,D=a-(I||0),P=l-(k||0),O=(e.width*N-g.width)/2/N,L=(e.height*N-g.height)/2/N;s(Math.min(Math.abs(D),Math.max(O,0))*Math.sign(D)),f(Math.min(Math.abs(P),Math.max(L,0))*Math.sign(P))},[n,a,l,g,e.width,e.height]),w=E.useCallback((I,k,y,N)=>{const D=Ao(I+.01<t?I-.01>p?I:p:t,5);k||h(),M(y?y*(1/n-1/D):0,N?N*(1/n-1/D):0,D),o(D)},[n,p,t,M,h]),T=Le(()=>{n>1&&(n>t&&w(t,!0),M())});jt(T,[u.width,u.height,T]);const A=E.useCallback(()=>{const I=n*m;w(n<1&&I>1?1:I)},[n,m,w]),_=E.useCallback(()=>{const I=n/m;w(n>1&&I<1?1:I)},[n,m,w]);return{zoom:n,offsetX:a,offsetY:l,disabled:x,changeOffsets:M,changeZoom:w,zoomIn:A,zoomOut:_}}const kl=E.createContext(null),Bo=Tt("useZoom","ZoomControllerContext",kl);function mf({children:e}){const[t,r]=E.useState(),{slideRect:n}=Wt(),{ref:o,minZoom:a}=An(),{imageRect:s,maxZoom:l}=gf(n,t?.imageDimensions),{zoom:f,offsetX:h,offsetY:c,disabled:i,changeZoom:u,changeOffsets:g,zoomIn:p,zoomOut:m}=pf(s,l,t?.zoomWrapperRef);uf(f,i),hf(f,a,l,i,p,m,u,g,t?.zoomWrapperRef);const v=E.useMemo(()=>({zoom:f,minZoom:a,maxZoom:l,offsetX:h,offsetY:c,disabled:i,zoomIn:p,zoomOut:m,changeZoom:u}),[f,a,l,h,c,i,p,m,u]);E.useImperativeHandle(o,()=>v,[v]);const x=E.useMemo(()=>({...v,setZoomWrapper:r}),[v,r]);return E.createElement(kl.Provider,{value:x},e)}const bf=vt("ZoomIn",E.createElement(E.Fragment,null,E.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),E.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),yf=vt("ZoomOut",E.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})),Cl=E.forwardRef(function({zoomIn:t,onLoseFocus:r},n){const o=E.useRef(!1),a=E.useRef(!1),{zoom:s,minZoom:l,maxZoom:f,zoomIn:h,zoomOut:c,disabled:i}=Bo(),{render:u}=at(),g=i||(t?s>=f:s<=l);return E.useEffect(()=>{g&&o.current&&a.current&&r(),g||(o.current=!0)},[g,r]),E.createElement(Dr,{ref:n,disabled:g,label:t?"Zoom in":"Zoom out",icon:t?bf:yf,renderIcon:t?u.iconZoomIn:u.iconZoomOut,onClick:t?h:c,onFocus:()=>{a.current=!0},onBlur:()=>{a.current=!1}})});function vf(){const e=E.useRef(null),t=E.useRef(null),{focus:r}=Wt(),n=E.useCallback(s=>{var l,f;!((l=s.current)===null||l===void 0)&&l.disabled?r():(f=s.current)===null||f===void 0||f.focus()},[r]),o=E.useCallback(()=>n(e),[n]),a=E.useCallback(()=>n(t),[n]);return E.createElement(E.Fragment,null,E.createElement(Cl,{zoomIn:!0,ref:e,onLoseFocus:a}),E.createElement(Cl,{ref:t,onLoseFocus:o}))}function wf(){const{render:e}=at(),t=Bo();return e.buttonZoom?E.createElement(E.Fragment,null,e.buttonZoom(t)):E.createElement(vf,null)}function xf(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function kf({current:e,preload:t},{type:r,source:n}){switch(r){case"fetch":return e?{current:e,preload:n}:{current:n};case"done":return n===t?{current:n}:{current:e,preload:t};default:throw new Error(zs)}}function Cf(e){var t,r;const[{current:n,preload:o},a]=E.useReducer(kf,{}),{slide:s,rect:l,imageFit:f,render:h,interactive:c}=e,i=s.srcSet.sort((A,_)=>A.width-_.width),u=(t=s.width)!==null&&t!==void 0?t:i[i.length-1].width,g=(r=s.height)!==null&&r!==void 0?r:i[i.length-1].height,p=Mo(s,f),m=Math.max(...i.map(A=>A.width)),v=Math.min((p?Math.max:Math.min)(l.width,u*(l.height/g)),m),x=mu(),M=Le(()=>{var A;const _=(A=i.find(I=>I.width>=v*x))!==null&&A!==void 0?A:i[i.length-1];(!n||i.findIndex(I=>I.src===n)<i.findIndex(I=>I===_))&&a({type:"fetch",source:_.src})});jt(M,[l.width,l.height,x,M]);const w=Le(A=>a({type:"done",source:A})),T={WebkitTransform:c?"initial":"translateZ(0)"};return p||Object.assign(T,l.width/l.height<u/g?{width:"100%",height:"auto"}:{width:"auto",height:"100%"}),E.createElement(E.Fragment,null,o&&o!==n&&E.createElement(cr,{key:"preload",...e,offset:void 0,slide:{...s,src:o,srcSet:void 0},style:{position:"absolute",visibility:"hidden",...T},onLoad:()=>w(o),render:{...h,iconLoading:()=>null,iconError:()=>null}}),n&&E.createElement(cr,{key:"current",...e,slide:{...s,src:n,srcSet:void 0},style:T}))}function Sf({render:e,slide:t,offset:r,rect:n}){var o;const[a,s]=E.useState(),l=E.useRef(null),f=rr(t),{zoom:h,maxZoom:c,offsetX:i,offsetY:u,setZoomWrapper:g}=Bo(),p=h>1,{carousel:m,on:v}=at(),{currentIndex:x}=Pt();jt(()=>{if(r!==0||f||!l.current)return()=>{};const w=()=>{const A=l.current;if(!A)return;let _=0,I=0;for(const k of A.children)k instanceof HTMLElement&&(_=Math.max(_,k.offsetWidth),I=Math.max(I,k.offsetHeight));s(k=>k&&k.width===_&&k.height===I?k:{width:_,height:I})};if(w(),typeof ResizeObserver>"u")return()=>{};const T=new ResizeObserver(w);for(const A of l.current.children)T.observe(A);return()=>T.disconnect()},[r,f,n]),jt(()=>r===0?(g({zoomWrapperRef:l,imageDimensions:a}),()=>g(void 0)):()=>{},[r,a,g]);let M=(o=e.slide)===null||o===void 0?void 0:o.call(e,{slide:t,offset:r,rect:n,zoom:h,maxZoom:c});if(!M&&f){const w={slide:t,offset:r,rect:n,render:e,imageFit:m.imageFit,imageProps:m.imageProps,onClick:r===0?()=>{var T;return(T=v.click)===null||T===void 0?void 0:T.call(v,{index:x})}:void 0};M=xf(t)?E.createElement(Cf,{...w,slide:t,interactive:p,rect:r===0?{width:n.width*h,height:n.height*h}:n}):E.createElement(cr,{onLoad:T=>s({width:T.naturalWidth,height:T.naturalHeight}),...w})}return M?E.createElement("div",{ref:l,className:ft(pe(As),pe(Tr),pe(Os),p&&pe(cu)),style:r===0?{transform:`scale(${h}) translateX(${i}px) translateY(${u}px)`}:void 0},M):null}const _f=({augment:e,addModule:t})=>{e(({zoom:r,toolbar:n,render:o,controller:a,...s})=>{const l=vl(r);return{zoom:l,toolbar:En(n,Ns,E.createElement(wf,null)),render:{...o,slide:f=>{var h,c;return rr(f.slide)||f.slide.type!=null&&(!((h=l.supports)===null||h===void 0)&&h.includes(f.slide.type))?E.createElement(Sf,{render:o,...f}):(c=o.slide)===null||c===void 0?void 0:c.call(o,f)}},controller:{...a,preventDefaultWheelY:l.scrollToZoom},...s}}),t(Lt(Ns,mf))},Ef={separator:"/",container:{}},Sl=e=>({...Ef,...e});function Tf({counter:e}){const{slides:t,currentIndex:r}=Pt(),{separator:n,container:{className:o,...a},className:s,...l}=Sl(e);return t.length===0?null:E.createElement("div",{className:ft(pe("counter"),o||s),...l,...a,"aria-hidden":!0},r+1," ",n," ",t.length)}function Nf({augment:e,addChild:t}){e(({counter:r,...n})=>({counter:Sl(r),...n})),t(Xr,Lt(ru,Tf))}const Af={autoplay:!1,delay:3e3,ref:null},_l=e=>({...Af,...e}),El=E.createContext(null),Mf=Tt("useSlideshow","SlideshowContext",El);function Of({slideshow:e,carousel:{finite:t},on:r,children:n}){const{autoplay:o,delay:a,ref:s}=_l(e),l=E.useRef(o),[f,h]=E.useState(o),c=E.useRef(void 0),i=E.useRef(void 0),{slides:u,currentIndex:g}=Pt(),{setTimeout:p,clearTimeout:m}=en(),{subscribe:v}=Ir(),{next:x}=Wt(),{setAutoPlaying:M}=Fo();E.useEffect(()=>M(f),[f,M]);const w=u.length===0||t&&g===u.length-1,T=E.useCallback(()=>{!f&&!w&&h(!0)},[f,w]),A=E.useCallback(()=>{f&&h(!1)},[f]),_=E.useCallback(()=>{m(c.current),c.current=void 0},[m]),I=Le(()=>{_(),!(!f||w||i.current===Er||i.current===Co)&&(c.current=p(()=>{f&&(i.current=void 0,x())},a))});E.useEffect(I,[g,f,I]),E.useEffect(()=>{f&&w&&h(!1)},[g,f,w]);const k=Le(()=>{var D;return(D=r.slideshowStart)===null||D===void 0?void 0:D.call(r)}),y=Le(()=>{var D;return(D=r.slideshowStop)===null||D===void 0?void 0:D.call(r)});E.useEffect(()=>{f?k():l.current&&y(),l.current=f},[f,k,y]),E.useEffect(()=>Ar(_,v(ou,()=>{i.current=Er,_()}),v(au,()=>{i.current=Co,_()}),v(su,()=>{i.current=Qr,I()}),v(lu,()=>{i.current=Jr,I()})),[v,_,I]);const N=E.useMemo(()=>({playing:f,disabled:w,play:T,pause:A}),[f,w,T,A]);return E.useImperativeHandle(s,()=>N,[N]),E.createElement(El.Provider,{value:N},n)}const If=vt("Play",E.createElement("path",{d:"M8 5v14l11-7z"})),Df=vt("Pause",E.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function Lf(){const{playing:e,disabled:t,play:r,pause:n}=Mf(),{render:o}=at(),a=nl(Wt().focus,t);return o.buttonSlideshow?E.createElement(E.Fragment,null,o.buttonSlideshow({playing:e,disabled:t,play:r,pause:n})):E.createElement(Dr,{label:e?"Pause":"Play",icon:e?Df:If,renderIcon:e?o.iconSlideshowPause:o.iconSlideshowPlay,onClick:e?n:r,disabled:t,...a})}function Pf({augment:e,addModule:t}){e(({slideshow:r,toolbar:n,...o})=>({toolbar:En(n,Ts,E.createElement(Lf,null)),slideshow:_l(r),...o})),t(Lt(Ts,Of))}const Ff={auto:!1,ref:null},Tl=e=>({...Ff,...e}),Nl=E.createContext(null),$f=Tt("useFullscreen","FullscreenContext",Nl);function Uf({fullscreen:e,on:t,children:r}){const{auto:n,ref:o}=Tl(e),a=E.useRef(null),[s,l]=E.useState(),[f,h]=E.useState(!1),c=E.useRef(!1),{getOwnerDocument:i}=Or();jt(()=>{var w,T,A,_;const I=i();l(!((_=(A=(T=(w=I.fullscreenEnabled)!==null&&w!==void 0?w:I.webkitFullscreenEnabled)!==null&&T!==void 0?T:I.mozFullScreenEnabled)!==null&&A!==void 0?A:I.msFullscreenEnabled)!==null&&_!==void 0&&_))},[i]);const u=E.useCallback(()=>{var w;const T=i(),A=T.fullscreenElement||T.webkitFullscreenElement||T.mozFullScreenElement||T.msFullscreenElement;return((w=A?.shadowRoot)===null||w===void 0?void 0:w.fullscreenElement)||A},[i]),g=E.useCallback(()=>{const w=a.current;try{w.requestFullscreen?w.requestFullscreen().catch(()=>{}):w.webkitRequestFullscreen?w.webkitRequestFullscreen():w.mozRequestFullScreen?w.mozRequestFullScreen():w.msRequestFullscreen&&w.msRequestFullscreen()}catch{}},[]),p=E.useCallback(()=>{if(!u())return;const w=i();try{w.exitFullscreen?w.exitFullscreen().catch(()=>{}):w.webkitExitFullscreen?w.webkitExitFullscreen():w.mozCancelFullScreen?w.mozCancelFullScreen():w.msExitFullscreen&&w.msExitFullscreen()}catch{}},[u,i]);E.useEffect(()=>{const w=i(),T=()=>{h(u()===a.current)};return Ar(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(A=>(w.addEventListener(A,T),()=>w.removeEventListener(A,T))))},[u,i]);const m=Le(()=>{var w;return(w=t.enterFullscreen)===null||w===void 0?void 0:w.call(t)}),v=Le(()=>{var w;return(w=t.exitFullscreen)===null||w===void 0?void 0:w.call(t)});E.useEffect(()=>{f&&(c.current=!0),c.current&&(f?m:v)()},[f,m,v]);const x=Le(()=>{var w;return(w=n?g:null)===null||w===void 0||w(),p});E.useEffect(x,[x]);const M=E.useMemo(()=>({fullscreen:f,disabled:s,enter:g,exit:p}),[f,s,g,p]);return E.useImperativeHandle(o,()=>M,[M]),E.createElement("div",{ref:a,className:ft(pe(Zr),pe(As))},E.createElement(Nl.Provider,{value:M},r))}const zf=vt("EnterFullscreen",E.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),Hf=vt("ExitFullscreen",E.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function Gf(){var e;const{fullscreen:t,disabled:r,enter:n,exit:o}=$f(),{render:a}=at();return r?null:a.buttonFullscreen?E.createElement(E.Fragment,null,(e=a.buttonFullscreen)===null||e===void 0?void 0:e.call(a,{fullscreen:t,disabled:r,enter:n,exit:o})):E.createElement(Dr,{disabled:r,label:t?"Exit Fullscreen":"Enter Fullscreen",icon:t?Hf:zf,renderIcon:t?a.iconExitFullscreen:a.iconEnterFullscreen,onClick:t?o:n})}function jf({augment:e,contains:t,addParent:r}){e(({fullscreen:n,toolbar:o,...a})=>({toolbar:En(o,Zr,E.createElement(Gf,null)),fullscreen:Tl(n),...a})),r(t(qr)?qr:Xr,Lt(Zr,Uf))}const ur={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},Wo=e=>({...ur,...e});function Al(){const{thumbnails:e}=at();return Wo(e)}const fr=e=>sr(qr,e),st=e=>fr(sr("thumbnail",e)),Bf=vt("VideoThumbnail",E.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"})),Wf=vt("UnknownThumbnail",E.createElement("path",{d:"M23 18V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zM8.5 12.5l2.5 3.01L14.5 11l4.5 6H5l3.5-4.5z"}));function Kf({slide:e,render:t,rect:r,imageFit:n}){var o;const a=(o=t.thumbnail)===null||o===void 0?void 0:o.call(t,{slide:e,render:t,rect:r,imageFit:n});if(a)return a;const s={render:t,rect:r,imageFit:n};if(e.thumbnail)return E.createElement(cr,{slide:{src:e.thumbnail},...s});if(rr(e))return E.createElement(cr,{slide:e,...s});const l=pe(st(Cn));return e.type==="video"?E.createElement(E.Fragment,null,e.poster&&E.createElement(cr,{slide:{src:e.poster},...s}),E.createElement(Bf,{className:l})):E.createElement(Wf,{className:l})}const Vf=lr("active"),Ko=lr("fadein"),Vo=lr("fadeout"),Yf=lr("placeholder"),Ml="delay",Ol="duration";function Xf({slide:e,index:t,onClick:r,fadeIn:n,fadeOut:o,placeholder:a,onLoseFocus:s}){const l=E.useRef(null),{render:f,styles:h,labels:c}=at(),{slides:i,globalIndex:u}=Pt(),{getOwnerDocument:g}=Or(),{width:p,height:m,imageFit:v}=Al(),x={width:p,height:m},M=t===u,w=Le(s);return E.useEffect(()=>{o&&g().activeElement===l.current&&w()},[o,w,g]),E.createElement("button",{ref:l,type:"button",className:ft(pe(Tr),pe(st()),M&&pe(st(Vf())),n&&pe(st(Ko())),o&&pe(st(Vo())),a&&pe(st(Yf()))),style:{...n?{[Ve(st(Ko(Ol)))]:`${n.duration}ms`,[Ve(st(Ko(Ml)))]:`${n.delay}ms`}:null,...o?{[Ve(st(Vo(Ol)))]:`${o.duration}ms`,[Ve(st(Vo(Ml)))]:`${o.delay}ms`}:null,...h.thumbnail},onClick:r,"aria-current":M?!0:void 0,"aria-label":Gs(c,i,t)},e&&Kf({slide:e,render:f,rect:x,imageFit:v}))}function Il(e){return["top","bottom"].includes(e)}function Dl(e,t){return t+2*(e.border+e.padding)+e.gap}function Zf(e){const{thumbnail:t,poster:r}=e||{thumbnail:"placeholder"};return typeof t=="string"&&t||typeof r=="string"&&r||e&&js(e)||void 0}function Ll({visible:e,containerRef:t}){const r=E.useRef(null),n=Nn(),{publish:o,subscribe:a}=Ir(),{carousel:s,styles:l,labels:f}=at(),{slides:h,globalIndex:c,animation:i}=Pt(),{registerSensors:u,subscribeSensors:g}=ol();ul(g);const p=Al(),{position:m,width:v,height:x,border:M,borderStyle:w,borderColor:T,borderRadius:A,padding:_,gap:I,vignette:k}=p,y=i?.duration!==void 0&&i?.increment||0,N=i?.duration||0,{prepareAnimation:D}=Uo(r,S=>({keyframes:Il(m)?[{transform:`translateX(${(n?-1:1)*Dl(p,v)*y+S}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${Dl(p,x)*y+S}px)`},{transform:"translateY(0)"}],duration:N,easing:i?.easing})),P=Le(()=>{let S=0;if(t.current&&r.current){const b=t.current.getBoundingClientRect(),z=r.current.getBoundingClientRect();S=Il(m)?z.left-b.left-(b.width-z.width)/2:z.top-b.top-(b.height-z.height)/2}D(S)});E.useEffect(()=>Ar(a(_o,P)),[a,P]);const O=Bs(s,h),L=[];if(Io(h))for(let S=c-O-Math.abs(y);S<=c+O+Math.abs(y);S+=1){const z=s.finite&&(S<0||S>h.length-1)||y<0&&S<c-O||y>0&&S>c+O?null:Do(h,S),U=[`${S}`,Zf(z)].filter(Boolean).join("|");L.push({key:U,index:S,slide:z})}const $=S=>()=>{S>c?o(tr,{count:S-c}):S<c&&o(er,{count:c-S})};return E.createElement("div",{className:ft(pe(fr("container")),pe(Tr)),style:{...e?null:{display:"none"},...v!==ur.width?{[Ve(st("width"))]:`${v}px`}:null,...x!==ur.height?{[Ve(st("height"))]:`${x}px`}:null,...M!==ur.border?{[Ve(st("border"))]:`${M}px`}:null,...w?{[Ve(st("border_style"))]:w}:null,...T?{[Ve(st("border_color"))]:T}:null,...A!==ur.borderRadius?{[Ve(st("border_radius"))]:`${A}px`}:null,..._!==ur.padding?{[Ve(st("padding"))]:`${_}px`}:null,...I!==ur.gap?{[Ve(st("gap"))]:`${I}px`}:null,...l.thumbnailsContainer}},E.createElement("nav",{ref:r,style:l.thumbnailsTrack,className:ft(pe(fr("track")),pe(Tr)),"aria-label":ir(f,"Thumbnails"),tabIndex:-1,...u},L.map(({key:S,index:b,slide:z})=>{const U=N/Math.abs(y||1),G=y>0&&b>c+O-y&&b<=c+O||y<0&&b<c-O-y&&b>=c-O?{duration:U,delay:((y>0?b-(c+O-y):c-O-y-b)-1)*U}:void 0,Y=y>0&&b<c-O||y<0&&b>c+O?{duration:U,delay:(y>0?y-(c-O-b):-y-(b-(c+O)))*U}:void 0;return E.createElement(Xf,{key:S,index:b,slide:z,fadeIn:G,fadeOut:Y,placeholder:!z,onClick:$(b),onLoseFocus:()=>{var B;return(B=r.current)===null||B===void 0?void 0:B.focus()}})})),k&&E.createElement("div",{className:pe(fr("vignette"))}))}const Pl=E.createContext(null),qf=Tt("useThumbnails","ThumbnailsContext",Pl);function Qf({children:e,...t}){const{ref:r,position:n,hidden:o}=Wo(t.thumbnails),[a,s]=E.useState(!o),l=E.useRef(null),f=E.useMemo(()=>({visible:a,show:()=>s(!0),hide:()=>s(!1)}),[a]);return E.useImperativeHandle(r,()=>f,[f]),E.createElement(Zs,{...t},E.createElement(Pl.Provider,{value:f},E.createElement("div",{ref:l,className:ft(pe(fr()),pe(fr(`${n}`)))},["start","top"].includes(n)&&E.createElement(Ll,{containerRef:l,visible:a}),E.createElement("div",{className:pe(fr("wrapper"))},e),["end","bottom"].includes(n)&&E.createElement(Ll,{containerRef:l,visible:a}))))}const Fl=()=>E.createElement(E.Fragment,null,E.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),E.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),Jf=vt("ThumbnailsVisible",Fl()),Rf=Mu("ThumbnailsHidden",Fl());function eg(){const{visible:e,show:t,hide:r}=qf(),{render:n}=at();return n.buttonThumbnails?E.createElement(E.Fragment,null,n.buttonThumbnails({visible:e,show:t,hide:r})):E.createElement(Dr,{label:e?"Hide thumbnails":"Show thumbnails",icon:e?Jf:Rf,renderIcon:e?n.iconThumbnailsVisible:n.iconThumbnailsHidden,onClick:e?r:t})}function tg({augment:e,contains:t,append:r,addParent:n}){e(({thumbnails:a,toolbar:s,...l})=>{const f=Wo(a);return{toolbar:En(s,qr,f.showToggle?E.createElement(eg,null):null),thumbnails:f,...l}});const o=Lt(qr,Qf);t(Zr)?r(Zr,o):n(Xr,o)}const Nt=({className:e="",children:t,style:r,...n})=>d.jsx("i",{className:e,style:r,...n,children:t}),Yo=window.G7Core,Mn=(e,t)=>Yo?.t?.(e,t)??e,rg=async(e,t)=>{try{const r=await Yo.api.get(e,{responseType:"blob"});if(r){const n=URL.createObjectURL(r),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}}catch(r){console.error("Failed to download file:",r),Yo?.toast?.error?.(Mn("common.download_failed"))}},ng=(e,t)=>{const r=document.createElement("a");r.href=e,r.download=t,r.target="_blank",document.body.appendChild(r),r.click(),document.body.removeChild(r)},$l=async e=>{const t=e.downloadUrl||e.src,r=e.filename||e.title||"image";e.downloadRequiresAuth?await rg(t,r):ng(t,r)},og=({image:e,index:t,onDownload:r})=>{const[n,o]=C.useState(!1),a=async s=>{if(s.stopPropagation(),r){r(e,t);return}o(!0);try{await $l(e)}finally{o(!1)}};return d.jsx(Q,{type:"button",onClick:a,disabled:n,className:"yarl__button flex items-center justify-center","aria-label":Mn("common.download"),title:Mn("common.download"),children:n?d.jsx(Nt,{className:"fa-solid fa-spinner fa-spin text-white"}):d.jsx(Nt,{className:"fa-solid fa-download text-white"})})},Lr=({images:e,isOpen:t,onClose:r,startIndex:n=0,enableZoom:o=!0,enableSlideshow:a=!1,enableFullscreen:s=!0,showCounter:l=!0,showDownload:f=!0,showThumbnails:h=!0,onDownload:c,editorAttrs:i,id:u})=>{const[g,p]=C.useState(n),m=C.useRef(n),v=e.map(w=>({src:w.src,title:w.title,description:w.description})),x=[];o&&x.push(_f),a&&x.push(Pf),s&&x.push(jf),l&&x.push(Nf),h&&x.push(tg);const M=e[g];if(C.useEffect(()=>{m.current=g},[g]),i){const w=(e??[]).slice(0,4);return d.jsx(W,{id:u,className:"grid grid-cols-2 gap-2 p-3 rounded-lg border border-dashed border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",...i,children:w.length>0?w.map((T,A)=>d.jsx(Ht,{src:T.thumbnail||T.src,alt:T.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},A)):d.jsxs(W,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[d.jsx(Nt,{className:"fa-regular fa-images mr-2"}),Mn("editor.component.image_gallery")]})})}return d.jsx(lf,{open:t,close:r,slides:v,index:g,plugins:x,on:{view:({index:w})=>{w!==m.current&&p(w)}},zoom:{maxZoomPixelRatio:3,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:300,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,scrollToZoom:!0},carousel:{finite:!0,preload:2,padding:"16px",spacing:"30%"},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},controller:{closeOnBackdropClick:!0,closeOnPullDown:!0,closeOnPullUp:!0},thumbnails:{position:"bottom",width:120,height:80,border:2,borderRadius:4,padding:4,gap:16,showToggle:!1,vignette:!0},toolbar:{buttons:[f&&M&&d.jsx(og,{image:M,index:g,onDownload:c},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},Ul=()=>{const[e,t]=C.useState(!1),[r,n]=C.useState([]),[o,a]=C.useState(0),s=C.useCallback((f,h=0)=>{n(f),a(h),t(!0)},[]),l=C.useCallback(()=>{t(!1)},[]);return{isOpen:e,openGallery:s,closeGallery:l,galleryProps:{images:r,isOpen:e,onClose:l,startIndex:o}}};Lr.displayName="ImageGallery";const zl=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:Lr,default:Lr,executeImageDownload:$l,useImageGallery:Ul},Symbol.toStringTag,{value:"Module"})),ag=window.G7Core,Xo=(e,t)=>ag?.t?.(e,t)??e,On=e=>e.url??e.download_url,In=({images:e=[],className:t="",id:r,editorAttrs:n})=>{const[o,a]=C.useState(0),{openGallery:s,galleryProps:l}=Ul(),f=C.useMemo(()=>e.map(c=>({src:On(c),title:c.alt_text_current??"",thumbnail:On(c),downloadUrl:c.download_url,filename:c.alt_text_current??`image-${c.id}`})),[e]);if(!e||e.length===0)return d.jsx(W,{className:`flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-lg aspect-square ${t}`,id:r,...n,children:d.jsxs(W,{className:"text-center text-gray-400 dark:text-gray-500",children:[d.jsx(fe,{name:"image",size:"3x",className:"mb-3 opacity-50"}),d.jsx(W,{className:"text-sm",children:Xo("shop.no_image")})]})});const h=e[o]??e[0];return d.jsxs(W,{id:r,className:t,...n,children:[d.jsx(W,{className:"relative overflow-hidden rounded-lg bg-gray-100 dark:bg-gray-700 aspect-square mb-3",children:d.jsx(Q,{type:"button",className:"w-full h-full cursor-zoom-in block",onClick:()=>s(f,o),"aria-label":Xo("shop.view_image"),children:d.jsx(Ht,{src:On(h),alt:h.alt_text_current??"",className:"w-full h-full object-contain"})})}),e.length>1&&d.jsx(W,{className:"flex gap-2 overflow-x-auto pb-1",children:e.map((c,i)=>d.jsx(Q,{type:"button",className:`flex-shrink-0 w-16 h-16 rounded-md overflow-hidden border-2 transition-colors cursor-pointer ${i===o?"border-gray-900 dark:border-white":"border-gray-200 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-400"}`,onClick:()=>a(i),"aria-label":c.alt_text_current??`${Xo("shop.image")} ${i+1}`,children:d.jsx(Ht,{src:On(c),alt:c.alt_text_current??"",className:"w-full h-full object-cover"})},c.id))}),d.jsx(Lr,{...l})]})};In.displayName="ProductImageViewer";const sg=Object.freeze(Object.defineProperty({__proto__:null,ProductImageViewer:In,default:In},Symbol.toStringTag,{value:"Module"})),Hl=({value:e,min:t=1,max:r=999,onChange:n,size:o="md",disabled:a=!1,className:s="",id:l,editorAttrs:f})=>{const c={sm:{container:"h-8",button:"w-8 h-8 text-sm",input:"w-10 text-sm"},md:{container:"h-10",button:"w-10 h-10",input:"w-14"},lg:{container:"h-12",button:"w-12 h-12 text-lg",input:"w-16 text-lg"}}[o],i=()=>{e>t&&!a&&n(e-1)},u=()=>{e<r&&!a&&n(e+1)},g=x=>{const M=parseInt(x.target.value,10);if(!isNaN(M)){const w=Math.max(t,Math.min(r,M));n(w)}},p=x=>{const M=parseInt(x.target.value,10);isNaN(M)||M<t?n(t):M>r&&n(r)},m=a||e<=t,v=a||e>=r;return d.jsxs(W,{className:`inline-flex items-center border border-gray-300 dark:border-gray-600 rounded-lg ${c.container} ${s}`,id:l,...f,children:[d.jsx(Q,{type:"button",onClick:i,disabled:m,className:`${c.button} flex items-center justify-center text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-l-lg transition-colors`,"aria-label":"수량 감소",children:d.jsx(fe,{name:"minus",className:"w-4 h-4"})}),d.jsx(_t,{type:"number",value:e,onChange:g,onBlur:p,min:t,max:r,disabled:a,className:`${c.input} text-center border-x border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`,"aria-label":"수량"}),d.jsx(Q,{type:"button",onClick:u,disabled:v,className:`${c.button} flex items-center justify-center text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-r-lg transition-colors`,"aria-label":"수량 증가",children:d.jsx(fe,{name:"plus",className:"w-4 h-4"})})]})},lg=Object.freeze(Object.defineProperty({__proto__:null,default:Hl},Symbol.toStringTag,{value:"Module"})),ig=window.G7Core?.createLogger?.("Comp:PostReactions")??{log:(...e)=>console.log("[Comp:PostReactions]",...e),warn:(...e)=>console.warn("[Comp:PostReactions]",...e),error:(...e)=>console.error("[Comp:PostReactions]",...e)},Gl=(e,t)=>window.G7Core?.t?.(e,t)??e,cg=[{type:"like",emoji:"👍",labelKey:"board.reactions.like",activeColor:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400"},{type:"funny",emoji:"😂",labelKey:"board.reactions.funny",activeColor:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-600 dark:text-yellow-400"},{type:"agree",emoji:"👌",labelKey:"board.reactions.agree",activeColor:"bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400"},{type:"thanks",emoji:"🙏",labelKey:"board.reactions.thanks",activeColor:"bg-purple-100 dark:bg-purple-900/30 text-purple-600 dark:text-purple-400"},{type:"wow",emoji:"😮",labelKey:"board.reactions.wow",activeColor:"bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400"}],jl=({reactions:e,userReaction:t,postId:r,onReact:n,size:o="md",className:a="",id:s,editorAttrs:l})=>{const f={sm:"px-2 py-1 text-xs gap-1",md:"px-3 py-1.5 text-sm gap-1.5",lg:"px-4 py-2 text-base gap-2"},h={sm:"text-sm",md:"text-base",lg:"text-lg"},c=u=>e.find(p=>p.type===u)?.count??0,i=async u=>{if(n){n(u);return}try{if(!(await fetch(`/api/posts/${r}/reactions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:u}),credentials:"include"})).ok)throw new Error("리액션 처리 실패");window.location.reload()}catch(g){ig.error("리액션 오류:",g)}};return d.jsx(W,{className:`flex flex-wrap gap-2 ${a}`,id:s,...l,children:cg.map(u=>{const g=c(u.type),p=t===u.type;return d.jsxs(Q,{onClick:()=>i(u.type),className:`
inline-flex items-center rounded-full border transition-colors
${f[o]}
${p?`${u.activeColor} border-transparent`:"border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}
`,title:Gl(u.labelKey),children:[d.jsx(re,{className:h[o],children:u.emoji}),d.jsx(re,{children:Gl(u.labelKey)}),g>0&&d.jsx(re,{className:"font-medium",children:g})]},u.type)})})},dg=Object.freeze(Object.defineProperty({__proto__:null,default:jl},Symbol.toStringTag,{value:"Module"})),Dn=window.G7Core?.createLogger?.("Comp:RichTextEditor")??{log:(...e)=>console.log("[Comp:RichTextEditor]",...e),warn:(...e)=>console.warn("[Comp:RichTextEditor]",...e),error:(...e)=>console.error("[Comp:RichTextEditor]",...e)},At=(e,t)=>window.G7Core?.t?.(e,t)??e,Bl=({name:e,initialValue:t="",placeholder:r,onChange:n,imageUploadUrl:o="/api/upload/image",minHeight:a="300px",disabled:s=!1,className:l="",id:f,editorAttrs:h})=>{const c=C.useRef(null),[i,u]=C.useState(t),[g,p]=C.useState(!1),[m,v]=C.useState(!1),[x,M]=C.useState("");C.useEffect(()=>{c.current&&!c.current.innerHTML&&(c.current.innerHTML=t)},[t]),C.useEffect(()=>{n&&n(i)},[i,n]);const w=N=>{Dn.log("Apply format:",N)},T=async N=>{const D=new FormData;D.append("file",N);try{const P=await fetch(o,{method:"POST",body:D,credentials:"include"});if(!P.ok)throw new Error("업로드 실패");const O=await P.json();Dn.log("Image uploaded:",O.url)}catch(P){Dn.error("이미지 업로드 오류:",P)}},A=N=>{const D=N.target.files?.[0];D&&T(D)},_=()=>{x&&(Dn.log("Insert link:",x),v(!1),M(""))},I=[{format:"bold",icon:"B",title:At("editor.toolbar.bold")},{format:"italic",icon:"I",title:At("editor.toolbar.italic")},{format:"underline",icon:"U",title:At("editor.toolbar.underline")},{format:"strike",icon:"S",title:At("editor.toolbar.strike")},{format:"code",icon:"</>",title:At("editor.toolbar.code")}],k=[{format:"h1",label:"H1"},{format:"h2",label:"H2"},{format:"h3",label:"H3"}],y=[{format:"bulletList",icon:"•",title:At("editor.toolbar.bullet_list")},{format:"orderedList",icon:"1.",title:At("editor.toolbar.ordered_list")},{format:"blockquote",icon:"❝",title:At("editor.toolbar.blockquote")}];return d.jsxs(W,{className:`border border-gray-300 dark:border-gray-600 rounded-lg overflow-hidden ${l}`,id:f,...h,children:[d.jsxs(W,{className:"flex flex-wrap items-center gap-1 p-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[d.jsx(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:I.map(N=>d.jsx(Q,{type:"button",onClick:()=>w(N.format),disabled:s,className:"w-8 h-8 flex items-center justify-center text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:N.title,children:N.icon},N.format))}),d.jsx(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:k.map(N=>d.jsx(Q,{type:"button",onClick:()=>w(N.format),disabled:s,className:"px-2 h-8 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",children:N.label},N.format))}),d.jsx(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:y.map(N=>d.jsx(Q,{type:"button",onClick:()=>w(N.format),disabled:s,className:"w-8 h-8 flex items-center justify-center text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:N.title,children:N.icon},N.format))}),d.jsxs(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:[d.jsx(Q,{type:"button",onClick:()=>v(!0),disabled:s,className:"w-8 h-8 flex items-center justify-center text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:At("editor.toolbar.link"),children:"🔗"}),d.jsxs(vr,{className:"w-8 h-8 flex items-center justify-center text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded cursor-pointer",children:["🖼",d.jsx(_t,{type:"file",accept:"image/*",onChange:A,disabled:s,className:"hidden"})]})]}),d.jsxs(Q,{type:"button",onClick:()=>p(!g),disabled:s,className:`px-2 h-8 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50 ${g?"bg-gray-200 dark:bg-gray-700":""}`,children:["</>",At("editor.toolbar.code_view")]})]}),g?d.jsx(lo,{value:i,onChange:N=>u(N.target.value),placeholder:r,disabled:s,className:"w-full p-4 bg-gray-900 text-gray-100 font-mono text-sm focus:outline-none resize-none",style:{minHeight:a}}):d.jsx(W,{ref:c,contentEditable:!s,onInput:N=>u(N.currentTarget.innerHTML),className:"p-4 bg-white dark:bg-gray-900 text-gray-900 dark:text-white focus:outline-none prose dark:prose-invert max-w-none",style:{minHeight:a},"data-placeholder":r}),d.jsx(_t,{type:"hidden",name:e,value:i}),m&&d.jsx(W,{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:d.jsxs(W,{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-96",children:[d.jsx(bn,{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:At("editor.link_modal.title")}),d.jsx(_t,{type:"url",value:x,onChange:N=>M(N.target.value),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4"}),d.jsxs(W,{className:"flex justify-end gap-2",children:[d.jsx(Q,{type:"button",onClick:()=>{v(!1),M("")},className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:At("common.cancel")}),d.jsx(Q,{type:"button",onClick:_,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:At("editor.link_modal.insert")})]})]})})]})},ug=Object.freeze(Object.defineProperty({__proto__:null,default:Bl},Symbol.toStringTag,{value:"Module"})),Zo=({content:e,text:t,isHtml:r=!0,className:n="",purifyConfig:o,id:a,editorAttrs:s})=>{const l=t??e??"";if(!l||l.trim()==="")return null;if(!r){const i=`
whitespace-pre-wrap
text-gray-900 dark:text-gray-100
font-sans
${n}
`.trim().replace(/\s+/g," ");return d.jsx(W,{className:i,id:a,...s,children:l})}const f={FORBID_TAGS:["script","noscript","iframe","frame","frameset","object","embed","applet","portal","form","input","textarea","select","button","style","link","meta","base","body","head","html","title","svg","math","audio","video","source","track","canvas","details","dialog","plaintext","xmp","listing","marquee","noframes","noembed","template","slot"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","ontoggle","oncanplay","onloadstart","formaction","xlink:href","action"],ALLOW_DATA_ATTR:!0,ADD_ATTR:["target"]},h=C.useMemo(()=>{const i=o?{...f,...o,FORBID_TAGS:[...f.FORBID_TAGS,...o.FORBID_TAGS||[]],FORBID_ATTR:[...f.FORBID_ATTR,...o.FORBID_ATTR||[]]}:f;return Cs.sanitize(l,i).replace(/<a\s+([^>]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,p,m,v)=>(m.startsWith("http://")||m.startsWith("https://"))&&!g.includes("rel=")?`<a ${p}href="${m}"${v} rel="noopener noreferrer">`:g)},[l,o]),c=`
prose dark:prose-invert max-w-none
prose-p:my-2
prose-headings:font-bold prose-headings:mt-6 prose-headings:mb-4
prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg
prose-a:text-blue-600 dark:prose-a:text-blue-400
prose-a:no-underline hover:prose-a:underline
prose-blockquote:border-l-4 prose-blockquote:border-gray-300 dark:prose-blockquote:border-gray-600
prose-blockquote:pl-4 prose-blockquote:italic
prose-code:bg-gray-100 dark:prose-code:bg-gray-800
prose-code:px-1 prose-code:py-0.5 prose-code:rounded
prose-pre:bg-gray-100 dark:prose-pre:bg-gray-800
prose-pre:p-4 prose-pre:rounded-lg prose-pre:overflow-x-auto
[&_table]:w-full [&_table]:border-collapse [&_table]:border [&_table]:border-gray-300
dark:[&_table]:border-gray-600
[&_th]:border [&_th]:border-gray-300 [&_th]:px-4 [&_th]:py-2 [&_th]:bg-gray-100 [&_th]:text-left
dark:[&_th]:border-gray-600 dark:[&_th]:bg-gray-800
[&_td]:border [&_td]:border-gray-300 [&_td]:px-4 [&_td]:py-2
dark:[&_td]:border-gray-600
[&_tr:hover]:bg-gray-50 dark:[&_tr:hover]:bg-gray-700/50
after:content-[''] after:block after:clear-both
${n}
`.trim().replace(/\s+/g," ");return d.jsx(W,{id:a,className:c,dangerouslySetInnerHTML:{__html:h},...s})},fg=Object.freeze(Object.defineProperty({__proto__:null,HtmlContent:Zo},Symbol.toStringTag,{value:"Module"})),qo=()=>window.G7Core,Qo=(e,t)=>qo()?.t?.(e,t)??e,Wl=({content:e="",onChange:t,isHtml:r=!1,onIsHtmlChange:n,rows:o=15,placeholder:a="",label:s,showHtmlModeToggle:l=!0,contentClassName:f="",purifyConfig:h,className:c="",name:i="content",htmlFieldName:u="content_mode",readOnly:g=!1,id:p,editorAttrs:m})=>{const[v,x]=C.useState(r),[M,w]=C.useState(e),[T,A]=C.useState(!1);C.useEffect(()=>{x(r)},[r]),C.useEffect(()=>{w(e)},[e]);const _=C.useCallback(y=>{const N=y.target.value;if(w(N),t){const D=qo()?.createChangeEvent?.({value:N,name:i,type:"textarea"})??{target:{name:i,value:N}};t(D)}},[t,i]),I=C.useCallback(y=>{const N=y.target.checked;if(x(N),N||A(!1),n){const D=qo()?.createChangeEvent?.({checked:N,name:u,type:"checkbox"})??{target:{name:u,checked:N}};n(D)}},[n,u]),k=C.useCallback(()=>{A(y=>!y)},[]);return d.jsxs(W,{className:`space-y-2 ${c}`,id:p,...m,children:[d.jsxs(W,{className:"flex items-center justify-between",children:[s&&d.jsx(vr,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:s}),d.jsxs(W,{className:"flex items-center gap-3",children:[v&&!g&&d.jsx(Q,{type:"button",onClick:k,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${T?"text-gray-700 dark:text-gray-200 bg-gray-200 dark:bg-gray-600 border border-gray-300 dark:border-gray-500 hover:bg-gray-300 dark:hover:bg-gray-500 focus:ring-gray-400 dark:focus:ring-gray-500":"text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-700 border border-blue-300 dark:border-blue-600 hover:bg-blue-50 dark:hover:bg-gray-600 focus:ring-blue-500 dark:focus:ring-blue-600"}`,children:Qo(T?"common.preview_off":"common.preview")}),l&&d.jsxs(vr,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[d.jsx(_t,{type:"checkbox",name:u,checked:v,onChange:I,disabled:g,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),d.jsx(W,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:Qo("common.html_mode")})]})]})]}),!T&&d.jsx(lo,{name:i,value:M,onChange:_,placeholder:a,rows:o,readOnly:g,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${v?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`}),T&&d.jsx(W,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:d.jsx(Zo,{content:M,isHtml:!0,className:f||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:h})})]})},gg=Object.freeze(Object.defineProperty({__proto__:null,HtmlEditor:Wl},Symbol.toStringTag,{value:"Module"})),Kl=e=>window.G7Core?.t?.(e)??e,Jo=({maxHeight:e=500,expandText:t,collapseText:r,className:n="",children:o,id:a,editorAttrs:s})=>{const[l,f]=C.useState(!1),[h,c]=C.useState(!1),i=C.useRef(null),u=C.useCallback(()=>{if(i.current){const v=i.current.scrollHeight;c(v>e)}},[e]);C.useEffect(()=>{u();const v=i.current;if(!v)return;const x=v.querySelectorAll("img");x.forEach(w=>{w.complete||w.addEventListener("load",u)});let M=null;return typeof ResizeObserver<"u"&&(M=new ResizeObserver(u),M.observe(v)),()=>{x.forEach(w=>{w.removeEventListener("load",u)}),M?.disconnect()}},[u,o]);const g=()=>{f(v=>!v)},p=t||Kl("sirsoft-ecommerce.shop.product.expand_detail"),m=r||Kl("sirsoft-ecommerce.shop.product.collapse_detail");return d.jsxs(W,{className:n,id:a,...s,children:[d.jsxs(W,{className:"relative",children:[d.jsx(W,{ref:i,className:!l&&h?"overflow-hidden transition-[max-height] duration-300 ease-in-out":"transition-[max-height] duration-300 ease-in-out",style:!l&&h?{maxHeight:`${e}px`}:void 0,children:o}),!l&&h&&d.jsx(W,{className:"absolute bottom-0 left-0 right-0 h-24 bg-gradient-to-t from-white dark:from-gray-900 to-transparent pointer-events-none"})]}),h&&d.jsxs(Q,{type:"button",onClick:g,className:"flex items-center justify-center w-full py-3.5 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors cursor-pointer gap-1.5",children:[d.jsx(re,{className:"text-sm font-semibold text-gray-600 dark:text-gray-400",children:l?m:p}),d.jsx(fe,{name:l?"chevron-up":"chevron-down",size:"sm"})]})]})},hg=Object.freeze(Object.defineProperty({__proto__:null,ExpandableContent:Jo,default:Jo},Symbol.toStringTag,{value:"Module"})),pg=(e,t)=>window.G7Core?.t?.(e,t)??e,Ro=({isOpen:e,onClose:t,title:r,icon:n,iconClassName:o="text-gray-500 dark:text-gray-400",closeOnBackdropClick:a=!0,closeOnOverlayClick:s,showCloseButton:l=!0,closeOnEscape:f=!0,children:h,width:c="500px",className:i="",style:u})=>{const g=s!==void 0?s:a,p=C.useRef(null),m=C.useRef(null);if(C.useEffect(()=>{const x=M=>{M.key==="Escape"&&e&&f&&t()};if(e&&f)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,t,f]),C.useEffect(()=>{if(e&&p.current){m.current=document.activeElement;const x=p.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),M=x[0],w=x[x.length-1];M?.focus();const T=A=>{A.key==="Tab"&&(A.shiftKey?document.activeElement===M&&(A.preventDefault(),w?.focus()):document.activeElement===w&&(A.preventDefault(),M?.focus()))};return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T),m.current?.focus()}}},[e]),C.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const v=u?.zIndex??50;return d.jsxs(W,{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:v},onClick:g?t:void 0,children:[d.jsx(W,{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),d.jsxs(W,{ref:p,className:`relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-h-[90vh] overflow-hidden ${i}`,style:{width:c,...u?{...u,zIndex:void 0}:{}},onClick:x=>x.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,children:[(r||n||l)&&d.jsxs(W,{className:"flex items-center justify-between p-4",children:[(r||n)&&d.jsxs(W,{id:"modal-title",className:"flex items-center gap-3 text-lg font-semibold text-gray-900 dark:text-white",children:[n&&d.jsx(fe,{name:n,size:"md",className:o}),r]}),l&&d.jsx(Q,{onClick:t,className:"ml-auto text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 focus:outline-none","aria-label":pg("common.close_modal"),children:d.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),d.jsx(W,{className:"px-6 py-4 overflow-y-auto max-h-[calc(90vh-140px)]",children:h})]})]})},mg=Object.freeze(Object.defineProperty({__proto__:null,Modal:Ro},Symbol.toStringTag,{value:"Module"})),ea=(e,t)=>window.G7Core?.t?.(e,t)??e,ta=({isOpen:e,onClose:t,title:r,message:n,confirmText:o,cancelText:a,onConfirm:s,onCancel:l,confirmButtonVariant:f="primary",cancelButtonVariant:h="secondary",width:c="500px",closeOnOverlay:i=!0,isLoading:u=!1,loadingText:g})=>{const p=o??ea("common.confirm"),m=a??ea("common.cancel"),v=g??ea("common.loading"),x=()=>{s()},M=()=>{u||(l?.(),t())},w=()=>{u||t()},T={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600",danger:"bg-red-600 text-white hover:bg-red-700",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"};return d.jsxs(Ro,{isOpen:e,onClose:w,title:r,width:c,children:[d.jsx(W,{className:"py-2",children:typeof n=="string"?d.jsx(zt,{className:"text-gray-700 dark:text-gray-300",children:n}):n}),d.jsxs(W,{className:"flex justify-end gap-3 mt-6",children:[d.jsx(Q,{onClick:M,disabled:u,className:"px-4 py-2 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:d.jsx(re,{children:m})}),d.jsxs(Q,{onClick:x,disabled:u,className:`flex items-center gap-2 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed ${T[f]}`,children:[u&&d.jsx(Nt,{className:"fa-solid fa-spinner w-4 h-4 animate-spin"}),d.jsx(re,{children:u?v:p})]})]})]})},bg=Object.freeze(Object.defineProperty({__proto__:null,ConfirmDialog:ta},Symbol.toStringTag,{value:"Module"})),Vl=C.createContext(null),Yl=({value:e,children:t})=>d.jsx(Vl.Provider,{value:e,children:t}),yg=()=>{const e=C.useContext(Vl);if(!e)throw new Error("useFileUploaderContext must be used within FileUploaderProvider");return e};function vg(e,t){return t.forEach((function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach((function(n){if(n!=="default"&&!(n in e)){var o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return r[n]}})}}))})),Object.freeze(e)}function Xl(e,t){return new Promise((function(r,n){let o;return wg(e).then((function(a){try{return o=a,r(new Blob([t.slice(0,2),o,t.slice(2)],{type:"image/jpeg"}))}catch(s){return n(s)}}),n)}))}const wg=e=>new Promise(((t,r)=>{const n=new FileReader;n.addEventListener("load",(({target:{result:o}})=>{const a=new DataView(o);let s=0;if(a.getUint16(s)!==65496)return r("not a valid JPEG");for(s+=2;;){const l=a.getUint16(s);if(l===65498)break;const f=a.getUint16(s+2);if(l===65505&&a.getUint32(s+4)===1165519206){const h=s+10;let c;switch(a.getUint16(h)){case 18761:c=!0;break;case 19789:c=!1;break;default:return r("TIFF header contains invalid endian")}if(a.getUint16(h+2,c)!==42)return r("TIFF header contains invalid version");const i=a.getUint32(h+4,c),u=h+i+2+12*a.getUint16(h+i,c);for(let g=h+i+2;g<u;g+=12)if(a.getUint16(g,c)==274){if(a.getUint16(g+2,c)!==3)return r("Orientation data type is invalid");if(a.getUint32(g+4,c)!==1)return r("Orientation data count is invalid");a.setUint16(g+8,1,c);break}return t(o.slice(s,s+2+f))}s+=2+f}return t(new Blob)})),n.readAsArrayBuffer(e)}));var Ln={},xg={get exports(){return Ln},set exports(e){Ln=e}};(function(e){var t,r,n={};xg.exports=n,n.parse=function(o,a){for(var s=n.bin.readUshort,l=n.bin.readUint,f=0,h={},c=new Uint8Array(o),i=c.length-4;l(c,i)!=101010256;)i--;f=i,f+=4;var u=s(c,f+=4);s(c,f+=2);var g=l(c,f+=2),p=l(c,f+=4);f+=4,f=p;for(var m=0;m<u;m++){l(c,f),f+=4,f+=4,f+=4,l(c,f+=4),g=l(c,f+=4);var v=l(c,f+=4),x=s(c,f+=4),M=s(c,f+2),w=s(c,f+4);f+=6;var T=l(c,f+=8);f+=4,f+=x+M+w,n._readLocal(c,T,h,g,v,a)}return h},n._readLocal=function(o,a,s,l,f,h){var c=n.bin.readUshort,i=n.bin.readUint;i(o,a),c(o,a+=4),c(o,a+=2);var u=c(o,a+=2);i(o,a+=2),i(o,a+=4),a+=4;var g=c(o,a+=8),p=c(o,a+=2);a+=2;var m=n.bin.readUTF8(o,a,g);if(a+=g,a+=p,h)s[m]={size:f,csize:l};else{var v=new Uint8Array(o.buffer,a);if(u==0)s[m]=new Uint8Array(v.buffer.slice(a,a+l));else{if(u!=8)throw"unknown compression method: "+u;var x=new Uint8Array(f);n.inflateRaw(v,x),s[m]=x}}},n.inflateRaw=function(o,a){return n.F.inflate(o,a)},n.inflate=function(o,a){return o[0],o[1],n.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),a)},n.deflate=function(o,a){a==null&&(a={level:6});var s=0,l=new Uint8Array(50+Math.floor(1.1*o.length));l[s]=120,l[s+1]=156,s+=2,s=n.F.deflateRaw(o,l,s,a.level);var f=n.adler(o,0,o.length);return l[s+0]=f>>>24&255,l[s+1]=f>>>16&255,l[s+2]=f>>>8&255,l[s+3]=f>>>0&255,new Uint8Array(l.buffer,0,s+4)},n.deflateRaw=function(o,a){a==null&&(a={level:6});var s=new Uint8Array(50+Math.floor(1.1*o.length)),l=n.F.deflateRaw(o,s,l,a.level);return new Uint8Array(s.buffer,0,l)},n.encode=function(o,a){a==null&&(a=!1);var s=0,l=n.bin.writeUint,f=n.bin.writeUshort,h={};for(var c in o){var i=!n._noNeed(c)&&!a,u=o[c],g=n.crc.crc(u,0,u.length);h[c]={cpr:i,usize:u.length,crc:g,file:i?n.deflateRaw(u):u}}for(var c in h)s+=h[c].file.length+30+46+2*n.bin.sizeUTF8(c);s+=22;var p=new Uint8Array(s),m=0,v=[];for(var c in h){var x=h[c];v.push(m),m=n._writeHeader(p,m,c,x,0)}var M=0,w=m;for(var c in h)x=h[c],v.push(m),m=n._writeHeader(p,m,c,x,1,v[M++]);var T=m-w;return l(p,m,101010256),m+=4,f(p,m+=4,M),f(p,m+=2,M),l(p,m+=2,T),l(p,m+=4,w),m+=4,m+=2,p.buffer},n._noNeed=function(o){var a=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(a)!=-1},n._writeHeader=function(o,a,s,l,f,h){var c=n.bin.writeUint,i=n.bin.writeUshort,u=l.file;return c(o,a,f==0?67324752:33639248),a+=4,f==1&&(a+=2),i(o,a,20),i(o,a+=2,0),i(o,a+=2,l.cpr?8:0),c(o,a+=2,0),c(o,a+=4,l.crc),c(o,a+=4,u.length),c(o,a+=4,l.usize),i(o,a+=4,n.bin.sizeUTF8(s)),i(o,a+=2,0),a+=2,f==1&&(a+=2,a+=2,c(o,a+=6,h),a+=4),a+=n.bin.writeUTF8(o,a,s),f==0&&(o.set(u,a),a+=u.length),a},n.crc={table:(function(){for(var o=new Uint32Array(256),a=0;a<256;a++){for(var s=a,l=0;l<8;l++)1&s?s=3988292384^s>>>1:s>>>=1;o[a]=s}return o})(),update:function(o,a,s,l){for(var f=0;f<l;f++)o=n.crc.table[255&(o^a[s+f])]^o>>>8;return o},crc:function(o,a,s){return 4294967295^n.crc.update(4294967295,o,a,s)}},n.adler=function(o,a,s){for(var l=1,f=0,h=a,c=a+s;h<c;){for(var i=Math.min(h+5552,c);h<i;)f+=l+=o[h++];l%=65521,f%=65521}return f<<16|l},n.bin={readUshort:function(o,a){return o[a]|o[a+1]<<8},writeUshort:function(o,a,s){o[a]=255&s,o[a+1]=s>>8&255},readUint:function(o,a){return 16777216*o[a+3]+(o[a+2]<<16|o[a+1]<<8|o[a])},writeUint:function(o,a,s){o[a]=255&s,o[a+1]=s>>8&255,o[a+2]=s>>16&255,o[a+3]=s>>24&255},readASCII:function(o,a,s){for(var l="",f=0;f<s;f++)l+=String.fromCharCode(o[a+f]);return l},writeASCII:function(o,a,s){for(var l=0;l<s.length;l++)o[a+l]=s.charCodeAt(l)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,a,s){for(var l,f="",h=0;h<s;h++)f+="%"+n.bin.pad(o[a+h].toString(16));try{l=decodeURIComponent(f)}catch{return n.bin.readASCII(o,a,s)}return l},writeUTF8:function(o,a,s){for(var l=s.length,f=0,h=0;h<l;h++){var c=s.charCodeAt(h);if((4294967168&c)==0)o[a+f]=c,f++;else if((4294965248&c)==0)o[a+f]=192|c>>6,o[a+f+1]=128|c>>0&63,f+=2;else if((4294901760&c)==0)o[a+f]=224|c>>12,o[a+f+1]=128|c>>6&63,o[a+f+2]=128|c>>0&63,f+=3;else{if((4292870144&c)!=0)throw"e";o[a+f]=240|c>>18,o[a+f+1]=128|c>>12&63,o[a+f+2]=128|c>>6&63,o[a+f+3]=128|c>>0&63,f+=4}}return f},sizeUTF8:function(o){for(var a=o.length,s=0,l=0;l<a;l++){var f=o.charCodeAt(l);if((4294967168&f)==0)s++;else if((4294965248&f)==0)s+=2;else if((4294901760&f)==0)s+=3;else{if((4292870144&f)!=0)throw"e";s+=4}}return s}},n.F={},n.F.deflateRaw=function(o,a,s,l){var f=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][l],h=n.F.U,c=n.F._goodIndex;n.F._hash;var i=n.F._putsE,u=0,g=s<<3,p=0,m=o.length;if(l==0){for(;u<m;)i(a,g,u+(D=Math.min(65535,m-u))==m?1:0),g=n.F._copyExact(o,u,D,a,g+8),u+=D;return g>>>3}var v=h.lits,x=h.strt,M=h.prev,w=0,T=0,A=0,_=0,I=0,k=0;for(m>2&&(x[k=n.F._hash(o,0)]=0),u=0;u<m;u++){if(I=k,u+1<m-2){k=n.F._hash(o,u+1);var y=u+1&32767;M[y]=x[k],x[k]=y}if(p<=u){(w>14e3||T>26697)&&m-u>100&&(p<u&&(v[w]=u-p,w+=2,p=u),g=n.F._writeBlock(u==m-1||p==m?1:0,v,w,_,o,A,u-A,a,g),w=T=_=0,A=u);var N=0;u<m-2&&(N=n.F._bestMatch(o,u,M,I,Math.min(f[2],m-u),f[3]));var D=N>>>16,P=65535&N;if(N!=0){P=65535&N;var O=c(D=N>>>16,h.of0);h.lhst[257+O]++;var L=c(P,h.df0);h.dhst[L]++,_+=h.exb[O]+h.dxb[L],v[w]=D<<23|u-p,v[w+1]=P<<16|O<<8|L,w+=2,p=u+D}else h.lhst[o[u]]++;T++}}for(A==u&&o.length!=0||(p<u&&(v[w]=u-p,w+=2,p=u),g=n.F._writeBlock(1,v,w,_,o,A,u-A,a,g),w=0,T=0,w=T=_=0,A=u);(7&g)!=0;)g++;return g>>>3},n.F._bestMatch=function(o,a,s,l,f,h){var c=32767&a,i=s[c],u=c-i+32768&32767;if(i==c||l!=n.F._hash(o,a-u))return 0;for(var g=0,p=0,m=Math.min(32767,a);u<=m&&--h!=0&&i!=c;){if(g==0||o[a+g]==o[a+g-u]){var v=n.F._howLong(o,a,u);if(v>g){if(p=u,(g=v)>=f)break;u+2<v&&(v=u+2);for(var x=0,M=0;M<v-2;M++){var w=a-u+M+32768&32767,T=w-s[w]+32768&32767;T>x&&(x=T,i=w)}}}u+=(c=i)-(i=s[c])+32768&32767}return g<<16|p},n.F._howLong=function(o,a,s){if(o[a]!=o[a-s]||o[a+1]!=o[a+1-s]||o[a+2]!=o[a+2-s])return 0;var l=a,f=Math.min(o.length,a+258);for(a+=3;a<f&&o[a]==o[a-s];)a++;return a-l},n.F._hash=function(o,a){return(o[a]<<8|o[a+1])+(o[a+2]<<4)&65535},n.saved=0,n.F._writeBlock=function(o,a,s,l,f,h,c,i,u){var g,p,m,v,x,M,w,T,A,_=n.F.U,I=n.F._putsF,k=n.F._putsE;_.lhst[256]++,p=(g=n.F.getTrees())[0],m=g[1],v=g[2],x=g[3],M=g[4],w=g[5],T=g[6],A=g[7];var y=32+((u+3&7)==0?0:8-(u+3&7))+(c<<3),N=l+n.F.contSize(_.fltree,_.lhst)+n.F.contSize(_.fdtree,_.dhst),D=l+n.F.contSize(_.ltree,_.lhst)+n.F.contSize(_.dtree,_.dhst);D+=14+3*w+n.F.contSize(_.itree,_.ihst)+(2*_.ihst[16]+3*_.ihst[17]+7*_.ihst[18]);for(var P=0;P<286;P++)_.lhst[P]=0;for(P=0;P<30;P++)_.dhst[P]=0;for(P=0;P<19;P++)_.ihst[P]=0;var O=y<N&&y<D?0:N<D?1:2;if(I(i,u,o),I(i,u+1,O),u+=3,O==0){for(;(7&u)!=0;)u++;u=n.F._copyExact(f,h,c,i,u)}else{var L,$;if(O==1&&(L=_.fltree,$=_.fdtree),O==2){n.F.makeCodes(_.ltree,p),n.F.revCodes(_.ltree,p),n.F.makeCodes(_.dtree,m),n.F.revCodes(_.dtree,m),n.F.makeCodes(_.itree,v),n.F.revCodes(_.itree,v),L=_.ltree,$=_.dtree,k(i,u,x-257),k(i,u+=5,M-1),k(i,u+=5,w-4),u+=4;for(var S=0;S<w;S++)k(i,u+3*S,_.itree[1+(_.ordr[S]<<1)]);u+=3*w,u=n.F._codeTiny(T,_.itree,i,u),u=n.F._codeTiny(A,_.itree,i,u)}for(var b=h,z=0;z<s;z+=2){for(var U=a[z],G=U>>>23,Y=b+(8388607&U);b<Y;)u=n.F._writeLit(f[b++],L,i,u);if(G!=0){var B=a[z+1],V=B>>16,j=B>>8&255,H=255&B;k(i,u=n.F._writeLit(257+j,L,i,u),G-_.of0[j]),u+=_.exb[j],I(i,u=n.F._writeLit(H,$,i,u),V-_.df0[H]),u+=_.dxb[H],b+=G}}u=n.F._writeLit(256,L,i,u)}return u},n.F._copyExact=function(o,a,s,l,f){var h=f>>>3;return l[h]=s,l[h+1]=s>>>8,l[h+2]=255-l[h],l[h+3]=255-l[h+1],h+=4,l.set(new Uint8Array(o.buffer,a,s),h),f+(s+4<<3)},n.F.getTrees=function(){for(var o=n.F.U,a=n.F._hufTree(o.lhst,o.ltree,15),s=n.F._hufTree(o.dhst,o.dtree,15),l=[],f=n.F._lenCodes(o.ltree,l),h=[],c=n.F._lenCodes(o.dtree,h),i=0;i<l.length;i+=2)o.ihst[l[i]]++;for(i=0;i<h.length;i+=2)o.ihst[h[i]]++;for(var u=n.F._hufTree(o.ihst,o.itree,7),g=19;g>4&&o.itree[1+(o.ordr[g-1]<<1)]==0;)g--;return[a,s,u,f,c,g,l,h]},n.F.getSecond=function(o){for(var a=[],s=0;s<o.length;s+=2)a.push(o[s+1]);return a},n.F.nonZero=function(o){for(var a="",s=0;s<o.length;s+=2)o[s+1]!=0&&(a+=(s>>1)+",");return a},n.F.contSize=function(o,a){for(var s=0,l=0;l<a.length;l++)s+=a[l]*o[1+(l<<1)];return s},n.F._codeTiny=function(o,a,s,l){for(var f=0;f<o.length;f+=2){var h=o[f],c=o[f+1];l=n.F._writeLit(h,a,s,l);var i=h==16?2:h==17?3:7;h>15&&(n.F._putsE(s,l,c,i),l+=i)}return l},n.F._lenCodes=function(o,a){for(var s=o.length;s!=2&&o[s-1]==0;)s-=2;for(var l=0;l<s;l+=2){var f=o[l+1],h=l+3<s?o[l+3]:-1,c=l+5<s?o[l+5]:-1,i=l==0?-1:o[l-1];if(f==0&&h==f&&c==f){for(var u=l+5;u+2<s&&o[u+2]==f;)u+=2;(g=Math.min(u+1-l>>>1,138))<11?a.push(17,g-3):a.push(18,g-11),l+=2*g-2}else if(f==i&&h==f&&c==f){for(u=l+5;u+2<s&&o[u+2]==f;)u+=2;var g=Math.min(u+1-l>>>1,6);a.push(16,g-3),l+=2*g-2}else a.push(f,0)}return s>>>1},n.F._hufTree=function(o,a,s){var l=[],f=o.length,h=a.length,c=0;for(c=0;c<h;c+=2)a[c]=0,a[c+1]=0;for(c=0;c<f;c++)o[c]!=0&&l.push({lit:c,f:o[c]});var i=l.length,u=l.slice(0);if(i==0)return 0;if(i==1){var g=l[0].lit;return u=g==0?1:0,a[1+(g<<1)]=1,a[1+(u<<1)]=1,1}l.sort((function(T,A){return T.f-A.f}));var p=l[0],m=l[1],v=0,x=1,M=2;for(l[0]={lit:-1,f:p.f+m.f,l:p,r:m,d:0};x!=i-1;)p=v!=x&&(M==i||l[v].f<l[M].f)?l[v++]:l[M++],m=v!=x&&(M==i||l[v].f<l[M].f)?l[v++]:l[M++],l[x++]={lit:-1,f:p.f+m.f,l:p,r:m};var w=n.F.setDepth(l[x-1],0);for(w>s&&(n.F.restrictDepth(u,s,w),w=s),c=0;c<i;c++)a[1+(u[c].lit<<1)]=u[c].d;return w},n.F.setDepth=function(o,a){return o.lit!=-1?(o.d=a,a):Math.max(n.F.setDepth(o.l,a+1),n.F.setDepth(o.r,a+1))},n.F.restrictDepth=function(o,a,s){var l=0,f=1<<s-a,h=0;for(o.sort((function(i,u){return u.d==i.d?i.f-u.f:u.d-i.d})),l=0;l<o.length&&o[l].d>a;l++){var c=o[l].d;o[l].d=a,h+=f-(1<<s-c)}for(h>>>=s-a;h>0;)(c=o[l].d)<a?(o[l].d++,h-=1<<a-c-1):l++;for(;l>=0;l--)o[l].d==a&&h<0&&(o[l].d--,h++);h!=0&&console.log("debt left")},n.F._goodIndex=function(o,a){var s=0;return a[16|s]<=o&&(s|=16),a[8|s]<=o&&(s|=8),a[4|s]<=o&&(s|=4),a[2|s]<=o&&(s|=2),a[1|s]<=o&&(s|=1),s},n.F._writeLit=function(o,a,s,l){return n.F._putsF(s,l,a[o<<1]),l+a[1+(o<<1)]},n.F.inflate=function(o,a){var s=Uint8Array;if(o[0]==3&&o[1]==0)return a||new s(0);var l=n.F,f=l._bitsF,h=l._bitsE,c=l._decodeTiny,i=l.makeCodes,u=l.codes2map,g=l._get17,p=l.U,m=a==null;m&&(a=new s(o.length>>>2<<3));for(var v,x,M=0,w=0,T=0,A=0,_=0,I=0,k=0,y=0,N=0;M==0;)if(M=f(o,N,1),w=f(o,N+1,2),N+=3,w!=0){if(m&&(a=n.F._check(a,y+131072)),w==1&&(v=p.flmap,x=p.fdmap,I=511,k=31),w==2){T=h(o,N,5)+257,A=h(o,N+5,5)+1,_=h(o,N+10,4)+4,N+=14;for(var D=0;D<38;D+=2)p.itree[D]=0,p.itree[D+1]=0;var P=1;for(D=0;D<_;D++){var O=h(o,N+3*D,3);p.itree[1+(p.ordr[D]<<1)]=O,O>P&&(P=O)}N+=3*_,i(p.itree,P),u(p.itree,P,p.imap),v=p.lmap,x=p.dmap,N=c(p.imap,(1<<P)-1,T+A,o,N,p.ttree);var L=l._copyOut(p.ttree,0,T,p.ltree);I=(1<<L)-1;var $=l._copyOut(p.ttree,T,A,p.dtree);k=(1<<$)-1,i(p.ltree,L),u(p.ltree,L,v),i(p.dtree,$),u(p.dtree,$,x)}for(;;){var S=v[g(o,N)&I];N+=15&S;var b=S>>>4;if(!(b>>>8))a[y++]=b;else{if(b==256)break;var z=y+b-254;if(b>264){var U=p.ldef[b-257];z=y+(U>>>3)+h(o,N,7&U),N+=7&U}var G=x[g(o,N)&k];N+=15&G;var Y=G>>>4,B=p.ddef[Y],V=(B>>>4)+f(o,N,15&B);for(N+=15&B,m&&(a=n.F._check(a,y+131072));y<z;)a[y]=a[y++-V],a[y]=a[y++-V],a[y]=a[y++-V],a[y]=a[y++-V];y=z}}}else{(7&N)!=0&&(N+=8-(7&N));var j=4+(N>>>3),H=o[j-4]|o[j-3]<<8;m&&(a=n.F._check(a,y+H)),a.set(new s(o.buffer,o.byteOffset+j,H),y),N=j+H<<3,y+=H}return a.length==y?a:a.slice(0,y)},n.F._check=function(o,a){var s=o.length;if(a<=s)return o;var l=new Uint8Array(Math.max(s<<1,a));return l.set(o,0),l},n.F._decodeTiny=function(o,a,s,l,f,h){for(var c=n.F._bitsE,i=n.F._get17,u=0;u<s;){var g=o[i(l,f)&a];f+=15&g;var p=g>>>4;if(p<=15)h[u]=p,u++;else{var m=0,v=0;p==16?(v=3+c(l,f,2),f+=2,m=h[u-1]):p==17?(v=3+c(l,f,3),f+=3):p==18&&(v=11+c(l,f,7),f+=7);for(var x=u+v;u<x;)h[u]=m,u++}}return f},n.F._copyOut=function(o,a,s,l){for(var f=0,h=0,c=l.length>>>1;h<s;){var i=o[h+a];l[h<<1]=0,l[1+(h<<1)]=i,i>f&&(f=i),h++}for(;h<c;)l[h<<1]=0,l[1+(h<<1)]=0,h++;return f},n.F.makeCodes=function(o,a){for(var s,l,f,h,c=n.F.U,i=o.length,u=c.bl_count,g=0;g<=a;g++)u[g]=0;for(g=1;g<i;g+=2)u[o[g]]++;var p=c.next_code;for(s=0,u[0]=0,l=1;l<=a;l++)s=s+u[l-1]<<1,p[l]=s;for(f=0;f<i;f+=2)(h=o[f+1])!=0&&(o[f]=p[h],p[h]++)},n.F.codes2map=function(o,a,s){for(var l=o.length,f=n.F.U.rev15,h=0;h<l;h+=2)if(o[h+1]!=0)for(var c=h>>1,i=o[h+1],u=c<<4|i,g=a-i,p=o[h]<<g,m=p+(1<<g);p!=m;)s[f[p]>>>15-a]=u,p++},n.F.revCodes=function(o,a){for(var s=n.F.U.rev15,l=15-a,f=0;f<o.length;f+=2){var h=o[f]<<a-o[f+1];o[f]=s[h]>>>l}},n.F._putsE=function(o,a,s){s<<=7&a;var l=a>>>3;o[l]|=s,o[l+1]|=s>>>8},n.F._putsF=function(o,a,s){s<<=7&a;var l=a>>>3;o[l]|=s,o[l+1]|=s>>>8,o[l+2]|=s>>>16},n.F._bitsE=function(o,a,s){return(o[a>>>3]|o[1+(a>>>3)]<<8)>>>(7&a)&(1<<s)-1},n.F._bitsF=function(o,a,s){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)&(1<<s)-1},n.F._get17=function(o,a){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)},n.F._get25=function(o,a){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16|o[3+(a>>>3)]<<24)>>>(7&a)},n.F.U=(t=Uint16Array,r=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new r(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new r(286),dhst:new r(30),ihst:new r(19),lits:new r(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var o=n.F.U,a=0;a<32768;a++){var s=a;s=(4278255360&(s=(4042322160&(s=(3435973836&(s=(2863311530&s)>>>1|(1431655765&s)<<1))>>>2|(858993459&s)<<2))>>>4|(252645135&s)<<4))>>>8|(16711935&s)<<8,o.rev15[a]=(s>>>16|s<<16)>>>17}function l(f,h,c){for(;h--!=0;)f.push(0,c)}for(a=0;a<32;a++)o.ldef[a]=o.of0[a]<<3|o.exb[a],o.ddef[a]=o.df0[a]<<4|o.dxb[a];l(o.fltree,144,8),l(o.fltree,112,9),l(o.fltree,24,7),l(o.fltree,8,8),n.F.makeCodes(o.fltree,9),n.F.codes2map(o.fltree,9,o.flmap),n.F.revCodes(o.fltree,9),l(o.fdtree,32,5),n.F.makeCodes(o.fdtree,5),n.F.codes2map(o.fdtree,5,o.fdmap),n.F.revCodes(o.fdtree,5),l(o.itree,19,0),l(o.ltree,286,0),l(o.dtree,30,0),l(o.ttree,320,0)})()})();var kg=vg({__proto__:null,default:Ln},[Ln]);const Kt=(function(){var e={nextZero(c,i){for(;c[i]!=0;)i++;return i},readUshort:(c,i)=>c[i]<<8|c[i+1],writeUshort(c,i,u){c[i]=u>>8&255,c[i+1]=255&u},readUint:(c,i)=>16777216*c[i]+(c[i+1]<<16|c[i+2]<<8|c[i+3]),writeUint(c,i,u){c[i]=u>>24&255,c[i+1]=u>>16&255,c[i+2]=u>>8&255,c[i+3]=255&u},readASCII(c,i,u){let g="";for(let p=0;p<u;p++)g+=String.fromCharCode(c[i+p]);return g},writeASCII(c,i,u){for(let g=0;g<u.length;g++)c[i+g]=u.charCodeAt(g)},readBytes(c,i,u){const g=[];for(let p=0;p<u;p++)g.push(c[i+p]);return g},pad:c=>c.length<2?`0${c}`:c,readUTF8(c,i,u){let g,p="";for(let m=0;m<u;m++)p+=`%${e.pad(c[i+m].toString(16))}`;try{g=decodeURIComponent(p)}catch{return e.readASCII(c,i,u)}return g}};function t(c,i,u,g){const p=i*u,m=a(g),v=Math.ceil(i*m/8),x=new Uint8Array(4*p),M=new Uint32Array(x.buffer),{ctype:w}=g,{depth:T}=g,A=e.readUshort;if(w==6){const U=p<<2;if(T==8)for(var _=0;_<U;_+=4)x[_]=c[_],x[_+1]=c[_+1],x[_+2]=c[_+2],x[_+3]=c[_+3];if(T==16)for(_=0;_<U;_++)x[_]=c[_<<1]}else if(w==2){const U=g.tabs.tRNS;if(U==null){if(T==8)for(_=0;_<p;_++){var I=3*_;M[_]=255<<24|c[I+2]<<16|c[I+1]<<8|c[I]}if(T==16)for(_=0;_<p;_++)I=6*_,M[_]=255<<24|c[I+4]<<16|c[I+2]<<8|c[I]}else{var k=U[0];const G=U[1],Y=U[2];if(T==8)for(_=0;_<p;_++){var y=_<<2;I=3*_,M[_]=255<<24|c[I+2]<<16|c[I+1]<<8|c[I],c[I]==k&&c[I+1]==G&&c[I+2]==Y&&(x[y+3]=0)}if(T==16)for(_=0;_<p;_++)y=_<<2,I=6*_,M[_]=255<<24|c[I+4]<<16|c[I+2]<<8|c[I],A(c,I)==k&&A(c,I+2)==G&&A(c,I+4)==Y&&(x[y+3]=0)}}else if(w==3){const U=g.tabs.PLTE,G=g.tabs.tRNS,Y=G?G.length:0;if(T==1)for(var N=0;N<u;N++){var D=N*v,P=N*i;for(_=0;_<i;_++){y=P+_<<2;var O=3*(L=c[D+(_>>3)]>>7-((7&_)<<0)&1);x[y]=U[O],x[y+1]=U[O+1],x[y+2]=U[O+2],x[y+3]=L<Y?G[L]:255}}if(T==2)for(N=0;N<u;N++)for(D=N*v,P=N*i,_=0;_<i;_++)y=P+_<<2,O=3*(L=c[D+(_>>2)]>>6-((3&_)<<1)&3),x[y]=U[O],x[y+1]=U[O+1],x[y+2]=U[O+2],x[y+3]=L<Y?G[L]:255;if(T==4)for(N=0;N<u;N++)for(D=N*v,P=N*i,_=0;_<i;_++)y=P+_<<2,O=3*(L=c[D+(_>>1)]>>4-((1&_)<<2)&15),x[y]=U[O],x[y+1]=U[O+1],x[y+2]=U[O+2],x[y+3]=L<Y?G[L]:255;if(T==8)for(_=0;_<p;_++){var L;y=_<<2,O=3*(L=c[_]),x[y]=U[O],x[y+1]=U[O+1],x[y+2]=U[O+2],x[y+3]=L<Y?G[L]:255}}else if(w==4){if(T==8)for(_=0;_<p;_++){y=_<<2;var $=c[S=_<<1];x[y]=$,x[y+1]=$,x[y+2]=$,x[y+3]=c[S+1]}if(T==16)for(_=0;_<p;_++){var S;y=_<<2,$=c[S=_<<2],x[y]=$,x[y+1]=$,x[y+2]=$,x[y+3]=c[S+2]}}else if(w==0)for(k=g.tabs.tRNS?g.tabs.tRNS:-1,N=0;N<u;N++){const U=N*v,G=N*i;if(T==1)for(var b=0;b<i;b++){var z=($=255*(c[U+(b>>>3)]>>>7-(7&b)&1))==255*k?0:255;M[G+b]=z<<24|$<<16|$<<8|$}else if(T==2)for(b=0;b<i;b++)z=($=85*(c[U+(b>>>2)]>>>6-((3&b)<<1)&3))==85*k?0:255,M[G+b]=z<<24|$<<16|$<<8|$;else if(T==4)for(b=0;b<i;b++)z=($=17*(c[U+(b>>>1)]>>>4-((1&b)<<2)&15))==17*k?0:255,M[G+b]=z<<24|$<<16|$<<8|$;else if(T==8)for(b=0;b<i;b++)z=($=c[U+b])==k?0:255,M[G+b]=z<<24|$<<16|$<<8|$;else if(T==16)for(b=0;b<i;b++)$=c[U+(b<<1)],z=A(c,U+(b<<1))==k?0:255,M[G+b]=z<<24|$<<16|$<<8|$}return x}function r(c,i,u,g){const p=a(c),m=Math.ceil(u*p/8),v=new Uint8Array((m+1+c.interlace)*g);return i=c.tabs.CgBI?o(i,v):n(i,v),c.interlace==0?i=s(i,c,0,u,g):c.interlace==1&&(i=(function(M,w){const T=w.width,A=w.height,_=a(w),I=_>>3,k=Math.ceil(T*_/8),y=new Uint8Array(A*k);let N=0;const D=[0,0,4,0,2,0,1],P=[0,4,0,2,0,1,0],O=[8,8,8,4,4,2,2],L=[8,8,4,4,2,2,1];let $=0;for(;$<7;){const b=O[$],z=L[$];let U=0,G=0,Y=D[$];for(;Y<A;)Y+=b,G++;let B=P[$];for(;B<T;)B+=z,U++;const V=Math.ceil(U*_/8);s(M,w,N,U,G);let j=0,H=D[$];for(;H<A;){let q=P[$],ee=N+j*V<<3;for(;q<T;){var S;if(_==1&&(S=(S=M[ee>>3])>>7-(7&ee)&1,y[H*k+(q>>3)]|=S<<7-((7&q)<<0)),_==2&&(S=(S=M[ee>>3])>>6-(7&ee)&3,y[H*k+(q>>2)]|=S<<6-((3&q)<<1)),_==4&&(S=(S=M[ee>>3])>>4-(7&ee)&15,y[H*k+(q>>1)]|=S<<4-((1&q)<<2)),_>=8){const ne=H*k+q*I;for(let ce=0;ce<I;ce++)y[ne+ce]=M[(ee>>3)+ce]}ee+=_,q+=z}j++,H+=b}U*G!=0&&(N+=G*(1+V)),$+=1}return y})(i,c)),i}function n(c,i){return o(new Uint8Array(c.buffer,2,c.length-6),i)}var o=(function(){const c={H:{}};return c.H.N=function(i,u){const g=Uint8Array;let p,m,v=0,x=0,M=0,w=0,T=0,A=0,_=0,I=0,k=0;if(i[0]==3&&i[1]==0)return u||new g(0);const y=c.H,N=y.b,D=y.e,P=y.R,O=y.n,L=y.A,$=y.Z,S=y.m,b=u==null;for(b&&(u=new g(i.length>>>2<<5));v==0;)if(v=N(i,k,1),x=N(i,k+1,2),k+=3,x!=0){if(b&&(u=c.H.W(u,I+(1<<17))),x==1&&(p=S.J,m=S.h,A=511,_=31),x==2){M=D(i,k,5)+257,w=D(i,k+5,5)+1,T=D(i,k+10,4)+4,k+=14;let U=1;for(var z=0;z<38;z+=2)S.Q[z]=0,S.Q[z+1]=0;for(z=0;z<T;z++){const B=D(i,k+3*z,3);S.Q[1+(S.X[z]<<1)]=B,B>U&&(U=B)}k+=3*T,O(S.Q,U),L(S.Q,U,S.u),p=S.w,m=S.d,k=P(S.u,(1<<U)-1,M+w,i,k,S.v);const G=y.V(S.v,0,M,S.C);A=(1<<G)-1;const Y=y.V(S.v,M,w,S.D);_=(1<<Y)-1,O(S.C,G),L(S.C,G,p),O(S.D,Y),L(S.D,Y,m)}for(;;){const U=p[$(i,k)&A];k+=15&U;const G=U>>>4;if(!(G>>>8))u[I++]=G;else{if(G==256)break;{let Y=I+G-254;if(G>264){const q=S.q[G-257];Y=I+(q>>>3)+D(i,k,7&q),k+=7&q}const B=m[$(i,k)&_];k+=15&B;const V=B>>>4,j=S.c[V],H=(j>>>4)+N(i,k,15&j);for(k+=15&j;I<Y;)u[I]=u[I++-H],u[I]=u[I++-H],u[I]=u[I++-H],u[I]=u[I++-H];I=Y}}}}else{(7&k)!=0&&(k+=8-(7&k));const U=4+(k>>>3),G=i[U-4]|i[U-3]<<8;b&&(u=c.H.W(u,I+G)),u.set(new g(i.buffer,i.byteOffset+U,G),I),k=U+G<<3,I+=G}return u.length==I?u:u.slice(0,I)},c.H.W=function(i,u){const g=i.length;if(u<=g)return i;const p=new Uint8Array(g<<1);return p.set(i,0),p},c.H.R=function(i,u,g,p,m,v){const x=c.H.e,M=c.H.Z;let w=0;for(;w<g;){const T=i[M(p,m)&u];m+=15&T;const A=T>>>4;if(A<=15)v[w]=A,w++;else{let _=0,I=0;A==16?(I=3+x(p,m,2),m+=2,_=v[w-1]):A==17?(I=3+x(p,m,3),m+=3):A==18&&(I=11+x(p,m,7),m+=7);const k=w+I;for(;w<k;)v[w]=_,w++}}return m},c.H.V=function(i,u,g,p){let m=0,v=0;const x=p.length>>>1;for(;v<g;){const M=i[v+u];p[v<<1]=0,p[1+(v<<1)]=M,M>m&&(m=M),v++}for(;v<x;)p[v<<1]=0,p[1+(v<<1)]=0,v++;return m},c.H.n=function(i,u){const g=c.H.m,p=i.length;let m,v,x,M;const w=g.j;for(var T=0;T<=u;T++)w[T]=0;for(T=1;T<p;T+=2)w[i[T]]++;const A=g.K;for(m=0,w[0]=0,v=1;v<=u;v++)m=m+w[v-1]<<1,A[v]=m;for(x=0;x<p;x+=2)M=i[x+1],M!=0&&(i[x]=A[M],A[M]++)},c.H.A=function(i,u,g){const p=i.length,m=c.H.m.r;for(let v=0;v<p;v+=2)if(i[v+1]!=0){const x=v>>1,M=i[v+1],w=x<<4|M,T=u-M;let A=i[v]<<T;const _=A+(1<<T);for(;A!=_;)g[m[A]>>>15-u]=w,A++}},c.H.l=function(i,u){const g=c.H.m.r,p=15-u;for(let m=0;m<i.length;m+=2){const v=i[m]<<u-i[m+1];i[m]=g[v]>>>p}},c.H.M=function(i,u,g){g<<=7&u;const p=u>>>3;i[p]|=g,i[p+1]|=g>>>8},c.H.I=function(i,u,g){g<<=7&u;const p=u>>>3;i[p]|=g,i[p+1]|=g>>>8,i[p+2]|=g>>>16},c.H.e=function(i,u,g){return(i[u>>>3]|i[1+(u>>>3)]<<8)>>>(7&u)&(1<<g)-1},c.H.b=function(i,u,g){return(i[u>>>3]|i[1+(u>>>3)]<<8|i[2+(u>>>3)]<<16)>>>(7&u)&(1<<g)-1},c.H.Z=function(i,u){return(i[u>>>3]|i[1+(u>>>3)]<<8|i[2+(u>>>3)]<<16)>>>(7&u)},c.H.i=function(i,u){return(i[u>>>3]|i[1+(u>>>3)]<<8|i[2+(u>>>3)]<<16|i[3+(u>>>3)]<<24)>>>(7&u)},c.H.m=(function(){const i=Uint16Array,u=Uint32Array;return{K:new i(16),j:new i(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new i(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new u(32),J:new i(512),_:[],h:new i(32),$:[],w:new i(32768),C:[],v:[],d:new i(32768),D:[],u:new i(512),Q:[],r:new i(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new i(65536),g:new i(32768)}})(),(function(){const i=c.H.m;for(var u=0;u<32768;u++){let p=u;p=(2863311530&p)>>>1|(1431655765&p)<<1,p=(3435973836&p)>>>2|(858993459&p)<<2,p=(4042322160&p)>>>4|(252645135&p)<<4,p=(4278255360&p)>>>8|(16711935&p)<<8,i.r[u]=(p>>>16|p<<16)>>>17}function g(p,m,v){for(;m--!=0;)p.push(0,v)}for(u=0;u<32;u++)i.q[u]=i.S[u]<<3|i.T[u],i.c[u]=i.p[u]<<4|i.z[u];g(i._,144,8),g(i._,112,9),g(i._,24,7),g(i._,8,8),c.H.n(i._,9),c.H.A(i._,9,i.J),c.H.l(i._,9),g(i.$,32,5),c.H.n(i.$,5),c.H.A(i.$,5,i.h),c.H.l(i.$,5),g(i.Q,19,0),g(i.C,286,0),g(i.D,30,0),g(i.v,320,0)})(),c.H.N})();function a(c){return[1,null,3,1,2,null,4][c.ctype]*c.depth}function s(c,i,u,g,p){let m=a(i);const v=Math.ceil(g*m/8);let x,M;m=Math.ceil(m/8);let w=c[u],T=0;if(w>1&&(c[u]=[0,0,1][w-2]),w==3)for(T=m;T<v;T++)c[T+1]=c[T+1]+(c[T+1-m]>>>1)&255;for(let A=0;A<p;A++)if(x=u+A*v,M=x+A+1,w=c[M-1],T=0,w==0)for(;T<v;T++)c[x+T]=c[M+T];else if(w==1){for(;T<m;T++)c[x+T]=c[M+T];for(;T<v;T++)c[x+T]=c[M+T]+c[x+T-m]}else if(w==2)for(;T<v;T++)c[x+T]=c[M+T]+c[x+T-v];else if(w==3){for(;T<m;T++)c[x+T]=c[M+T]+(c[x+T-v]>>>1);for(;T<v;T++)c[x+T]=c[M+T]+(c[x+T-v]+c[x+T-m]>>>1)}else{for(;T<m;T++)c[x+T]=c[M+T]+l(0,c[x+T-v],0);for(;T<v;T++)c[x+T]=c[M+T]+l(c[x+T-m],c[x+T-v],c[x+T-m-v])}return c}function l(c,i,u){const g=c+i-u,p=g-c,m=g-i,v=g-u;return p*p<=m*m&&p*p<=v*v?c:m*m<=v*v?i:u}function f(c,i,u){u.width=e.readUint(c,i),i+=4,u.height=e.readUint(c,i),i+=4,u.depth=c[i],i++,u.ctype=c[i],i++,u.compress=c[i],i++,u.filter=c[i],i++,u.interlace=c[i],i++}function h(c,i,u,g,p,m,v,x,M){const w=Math.min(i,p),T=Math.min(u,m);let A=0,_=0;for(let $=0;$<T;$++)for(let S=0;S<w;S++)if(v>=0&&x>=0?(A=$*i+S<<2,_=(x+$)*p+v+S<<2):(A=(-x+$)*i-v+S<<2,_=$*p+S<<2),M==0)g[_]=c[A],g[_+1]=c[A+1],g[_+2]=c[A+2],g[_+3]=c[A+3];else if(M==1){var I=c[A+3]*.00392156862745098,k=c[A]*I,y=c[A+1]*I,N=c[A+2]*I,D=g[_+3]*(1/255),P=g[_]*D,O=g[_+1]*D,L=g[_+2]*D;const b=1-I,z=I+D*b,U=z==0?0:1/z;g[_+3]=255*z,g[_+0]=(k+P*b)*U,g[_+1]=(y+O*b)*U,g[_+2]=(N+L*b)*U}else if(M==2)I=c[A+3],k=c[A],y=c[A+1],N=c[A+2],D=g[_+3],P=g[_],O=g[_+1],L=g[_+2],I==D&&k==P&&y==O&&N==L?(g[_]=0,g[_+1]=0,g[_+2]=0,g[_+3]=0):(g[_]=k,g[_+1]=y,g[_+2]=N,g[_+3]=I);else if(M==3){if(I=c[A+3],k=c[A],y=c[A+1],N=c[A+2],D=g[_+3],P=g[_],O=g[_+1],L=g[_+2],I==D&&k==P&&y==O&&N==L)continue;if(I<220&&D>20)return!1}return!0}return{decode:function(i){const u=new Uint8Array(i);let g=8;const p=e,m=p.readUshort,v=p.readUint,x={tabs:{},frames:[]},M=new Uint8Array(u.length);let w,T=0,A=0;const _=[137,80,78,71,13,10,26,10];for(var I=0;I<8;I++)if(u[I]!=_[I])throw"The input is not a PNG file!";for(;g<u.length;){const $=p.readUint(u,g);g+=4;const S=p.readASCII(u,g,4);if(g+=4,S=="IHDR")f(u,g,x);else if(S=="iCCP"){for(var k=g;u[k]!=0;)k++;p.readASCII(u,g,k-g),u[k+1];const b=u.slice(k+2,g+$);let z=null;try{z=n(b)}catch{z=o(b)}x.tabs[S]=z}else if(S=="CgBI")x.tabs[S]=u.slice(g,g+4);else if(S=="IDAT"){for(I=0;I<$;I++)M[T+I]=u[g+I];T+=$}else if(S=="acTL")x.tabs[S]={num_frames:v(u,g),num_plays:v(u,g+4)},w=new Uint8Array(u.length);else if(S=="fcTL"){A!=0&&((L=x.frames[x.frames.length-1]).data=r(x,w.slice(0,A),L.rect.width,L.rect.height),A=0);const b={x:v(u,g+12),y:v(u,g+16),width:v(u,g+4),height:v(u,g+8)};let z=m(u,g+22);z=m(u,g+20)/(z==0?100:z);const U={rect:b,delay:Math.round(1e3*z),dispose:u[g+24],blend:u[g+25]};x.frames.push(U)}else if(S=="fdAT"){for(I=0;I<$-4;I++)w[A+I]=u[g+I+4];A+=$-4}else if(S=="pHYs")x.tabs[S]=[p.readUint(u,g),p.readUint(u,g+4),u[g+8]];else if(S=="cHRM")for(x.tabs[S]=[],I=0;I<8;I++)x.tabs[S].push(p.readUint(u,g+4*I));else if(S=="tEXt"||S=="zTXt"){x.tabs[S]==null&&(x.tabs[S]={});var y=p.nextZero(u,g),N=p.readASCII(u,g,y-g),D=g+$-y-1;if(S=="tEXt")O=p.readASCII(u,y+1,D);else{var P=n(u.slice(y+2,y+2+D));O=p.readUTF8(P,0,P.length)}x.tabs[S][N]=O}else if(S=="iTXt"){x.tabs[S]==null&&(x.tabs[S]={}),y=0,k=g,y=p.nextZero(u,k),N=p.readASCII(u,k,y-k);const b=u[k=y+1];var O;u[k+1],k+=2,y=p.nextZero(u,k),p.readASCII(u,k,y-k),k=y+1,y=p.nextZero(u,k),p.readUTF8(u,k,y-k),D=$-((k=y+1)-g),b==0?O=p.readUTF8(u,k,D):(P=n(u.slice(k,k+D)),O=p.readUTF8(P,0,P.length)),x.tabs[S][N]=O}else if(S=="PLTE")x.tabs[S]=p.readBytes(u,g,$);else if(S=="hIST"){const b=x.tabs.PLTE.length/3;for(x.tabs[S]=[],I=0;I<b;I++)x.tabs[S].push(m(u,g+2*I))}else if(S=="tRNS")x.ctype==3?x.tabs[S]=p.readBytes(u,g,$):x.ctype==0?x.tabs[S]=m(u,g):x.ctype==2&&(x.tabs[S]=[m(u,g),m(u,g+2),m(u,g+4)]);else if(S=="gAMA")x.tabs[S]=p.readUint(u,g)/1e5;else if(S=="sRGB")x.tabs[S]=u[g];else if(S=="bKGD")x.ctype==0||x.ctype==4?x.tabs[S]=[m(u,g)]:x.ctype==2||x.ctype==6?x.tabs[S]=[m(u,g),m(u,g+2),m(u,g+4)]:x.ctype==3&&(x.tabs[S]=u[g]);else if(S=="IEND")break;g+=$,p.readUint(u,g),g+=4}var L;return A!=0&&((L=x.frames[x.frames.length-1]).data=r(x,w.slice(0,A),L.rect.width,L.rect.height)),x.data=r(x,M,x.width,x.height),delete x.compress,delete x.interlace,delete x.filter,x},toRGBA8:function(i){const u=i.width,g=i.height;if(i.tabs.acTL==null)return[t(i.data,u,g,i).buffer];const p=[];i.frames[0].data==null&&(i.frames[0].data=i.data);const m=u*g*4,v=new Uint8Array(m),x=new Uint8Array(m),M=new Uint8Array(m);for(let T=0;T<i.frames.length;T++){const A=i.frames[T],_=A.rect.x,I=A.rect.y,k=A.rect.width,y=A.rect.height,N=t(A.data,k,y,i);if(T!=0)for(var w=0;w<m;w++)M[w]=v[w];if(A.blend==0?h(N,k,y,v,u,g,_,I,0):A.blend==1&&h(N,k,y,v,u,g,_,I,1),p.push(v.buffer.slice(0)),A.dispose!=0){if(A.dispose==1)h(x,k,y,v,u,g,_,I,0);else if(A.dispose==2)for(w=0;w<m;w++)v[w]=M[w]}}return p},_paeth:l,_copyTile:h,_bin:e}})();(function(){const{_copyTile:e}=Kt,{_bin:t}=Kt,r=Kt._paeth;var n={table:(function(){const k=new Uint32Array(256);for(let y=0;y<256;y++){let N=y;for(let D=0;D<8;D++)1&N?N=3988292384^N>>>1:N>>>=1;k[y]=N}return k})(),update(k,y,N,D){for(let P=0;P<D;P++)k=n.table[255&(k^y[N+P])]^k>>>8;return k},crc:(k,y,N)=>4294967295^n.update(4294967295,k,y,N)};function o(k,y,N,D){y[N]+=k[0]*D>>4,y[N+1]+=k[1]*D>>4,y[N+2]+=k[2]*D>>4,y[N+3]+=k[3]*D>>4}function a(k){return Math.max(0,Math.min(255,k))}function s(k,y){const N=k[0]-y[0],D=k[1]-y[1],P=k[2]-y[2],O=k[3]-y[3];return N*N+D*D+P*P+O*O}function l(k,y,N,D,P,O,L){L==null&&(L=1);const $=D.length,S=[];for(var b=0;b<$;b++){const H=D[b];S.push([H>>>0&255,H>>>8&255,H>>>16&255,H>>>24&255])}for(b=0;b<$;b++){let H=4294967295;for(var z=0,U=0;U<$;U++){var G=s(S[b],S[U]);U!=b&&G<H&&(H=G,z=U)}}const Y=new Uint32Array(P.buffer),B=new Int16Array(y*N*4),V=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(b=0;b<V.length;b++)V[b]=255*((V[b]+.5)/16-.5);for(let H=0;H<N;H++)for(let q=0;q<y;q++){var j;b=4*(H*y+q),L!=2?j=[a(k[b]+B[b]),a(k[b+1]+B[b+1]),a(k[b+2]+B[b+2]),a(k[b+3]+B[b+3])]:(G=V[4*(3&H)+(3&q)],j=[a(k[b]+G),a(k[b+1]+G),a(k[b+2]+G),a(k[b+3]+G)]),z=0;let ee=16777215;for(U=0;U<$;U++){const R=s(j,S[U]);R<ee&&(ee=R,z=U)}const ne=S[z],ce=[j[0]-ne[0],j[1]-ne[1],j[2]-ne[2],j[3]-ne[3]];L==1&&(q!=y-1&&o(ce,B,b+4,7),H!=N-1&&(q!=0&&o(ce,B,b+4*y-4,3),o(ce,B,b+4*y,5),q!=y-1&&o(ce,B,b+4*y+4,1))),O[b>>2]=z,Y[b>>2]=D[z]}}function f(k,y,N,D,P){P==null&&(P={});const{crc:O}=n,L=t.writeUint,$=t.writeUshort,S=t.writeASCII;let b=8;const z=k.frames.length>1;let U,G=!1,Y=33+(z?20:0);if(P.sRGB!=null&&(Y+=13),P.pHYs!=null&&(Y+=21),P.iCCP!=null&&(U=pako.deflate(P.iCCP),Y+=21+U.length+4),k.ctype==3){for(var B=k.plte.length,V=0;V<B;V++)k.plte[V]>>>24!=255&&(G=!0);Y+=8+3*B+4+(G?8+1*B+4:0)}for(var j=0;j<k.frames.length;j++)z&&(Y+=38),Y+=(ne=k.frames[j]).cimg.length+12,j!=0&&(Y+=4);Y+=12;const H=new Uint8Array(Y),q=[137,80,78,71,13,10,26,10];for(V=0;V<8;V++)H[V]=q[V];if(L(H,b,13),b+=4,S(H,b,"IHDR"),b+=4,L(H,b,y),b+=4,L(H,b,N),b+=4,H[b]=k.depth,b++,H[b]=k.ctype,b++,H[b]=0,b++,H[b]=0,b++,H[b]=0,b++,L(H,b,O(H,b-17,17)),b+=4,P.sRGB!=null&&(L(H,b,1),b+=4,S(H,b,"sRGB"),b+=4,H[b]=P.sRGB,b++,L(H,b,O(H,b-5,5)),b+=4),P.iCCP!=null){const ce=13+U.length;L(H,b,ce),b+=4,S(H,b,"iCCP"),b+=4,S(H,b,"ICC profile"),b+=11,b+=2,H.set(U,b),b+=U.length,L(H,b,O(H,b-(ce+4),ce+4)),b+=4}if(P.pHYs!=null&&(L(H,b,9),b+=4,S(H,b,"pHYs"),b+=4,L(H,b,P.pHYs[0]),b+=4,L(H,b,P.pHYs[1]),b+=4,H[b]=P.pHYs[2],b++,L(H,b,O(H,b-13,13)),b+=4),z&&(L(H,b,8),b+=4,S(H,b,"acTL"),b+=4,L(H,b,k.frames.length),b+=4,L(H,b,P.loop!=null?P.loop:0),b+=4,L(H,b,O(H,b-12,12)),b+=4),k.ctype==3){for(L(H,b,3*(B=k.plte.length)),b+=4,S(H,b,"PLTE"),b+=4,V=0;V<B;V++){const ce=3*V,R=k.plte[V],_e=255&R,me=R>>>8&255,Be=R>>>16&255;H[b+ce+0]=_e,H[b+ce+1]=me,H[b+ce+2]=Be}if(b+=3*B,L(H,b,O(H,b-3*B-4,3*B+4)),b+=4,G){for(L(H,b,B),b+=4,S(H,b,"tRNS"),b+=4,V=0;V<B;V++)H[b+V]=k.plte[V]>>>24&255;b+=B,L(H,b,O(H,b-B-4,B+4)),b+=4}}let ee=0;for(j=0;j<k.frames.length;j++){var ne=k.frames[j];z&&(L(H,b,26),b+=4,S(H,b,"fcTL"),b+=4,L(H,b,ee++),b+=4,L(H,b,ne.rect.width),b+=4,L(H,b,ne.rect.height),b+=4,L(H,b,ne.rect.x),b+=4,L(H,b,ne.rect.y),b+=4,$(H,b,D[j]),b+=2,$(H,b,1e3),b+=2,H[b]=ne.dispose,b++,H[b]=ne.blend,b++,L(H,b,O(H,b-30,30)),b+=4);const ce=ne.cimg;L(H,b,(B=ce.length)+(j==0?0:4)),b+=4;const R=b;S(H,b,j==0?"IDAT":"fdAT"),b+=4,j!=0&&(L(H,b,ee++),b+=4),H.set(ce,b),b+=B,L(H,b,O(H,R,b-R)),b+=4}return L(H,b,0),b+=4,S(H,b,"IEND"),b+=4,L(H,b,O(H,b-4,4)),b+=4,H.buffer}function h(k,y,N){for(let D=0;D<k.frames.length;D++){const P=k.frames[D];P.rect.width;const O=P.rect.height,L=new Uint8Array(O*P.bpl+O);P.cimg=g(P.img,O,P.bpp,P.bpl,L,y,N)}}function c(k,y,N,D,P){const O=P[0],L=P[1],$=P[2],S=P[3],b=P[4],z=P[5];let U=6,G=8,Y=255;for(var B=0;B<k.length;B++){const Ne=new Uint8Array(k[B]);for(var V=Ne.length,j=0;j<V;j+=4)Y&=Ne[j+3]}const H=Y!=255,q=(function(we,ke,Ue,Oe,K,te){const oe=[];for(var le=0;le<we.length;le++){const Ie=new Uint8Array(we[le]),X=new Uint32Array(Ie.buffer);var ve;let se=0,de=0,ue=ke,ie=Ue,De=Oe?1:0;if(le!=0){const ge=te||Oe||le==1||oe[le-2].dispose!=0?1:2;let xe=0,Ce=1e9;for(let ze=0;ze<ge;ze++){var Te=new Uint8Array(we[le-1-ze]);const Ke=new Uint32Array(we[le-1-ze]);let Se=ke,be=Ue,Me=-1,je=-1;for(let Ye=0;Ye<Ue;Ye++)for(let Pe=0;Pe<ke;Pe++)X[Ae=Ye*ke+Pe]!=Ke[Ae]&&(Pe<Se&&(Se=Pe),Pe>Me&&(Me=Pe),Ye<be&&(be=Ye),Ye>je&&(je=Ye));Me==-1&&(Se=be=Me=je=0),K&&((1&Se)==1&&Se--,(1&be)==1&&be--);const rt=(Me-Se+1)*(je-be+1);rt<Ce&&(Ce=rt,xe=ze,se=Se,de=be,ue=Me-Se+1,ie=je-be+1)}Te=new Uint8Array(we[le-1-xe]),xe==1&&(oe[le-1].dispose=2),ve=new Uint8Array(ue*ie*4),e(Te,ke,Ue,ve,ue,ie,-se,-de,0),De=e(Ie,ke,Ue,ve,ue,ie,-se,-de,3)?1:0,De==1?u(Ie,ke,Ue,ve,{x:se,y:de,width:ue,height:ie}):e(Ie,ke,Ue,ve,ue,ie,-se,-de,0)}else ve=Ie.slice(0);oe.push({rect:{x:se,y:de,width:ue,height:ie},img:ve,blend:De,dispose:0})}if(Oe)for(le=0;le<oe.length;le++){if((He=oe[le]).blend==1)continue;const Ie=He.rect,X=oe[le-1].rect,se=Math.min(Ie.x,X.x),de=Math.min(Ie.y,X.y),ue={x:se,y:de,width:Math.max(Ie.x+Ie.width,X.x+X.width)-se,height:Math.max(Ie.y+Ie.height,X.y+X.height)-de};oe[le-1].dispose=1,le-1!=0&&i(we,ke,Ue,oe,le-1,ue,K),i(we,ke,Ue,oe,le,ue,K)}let We=0;if(we.length!=1)for(var Ae=0;Ae<oe.length;Ae++){var He;We+=(He=oe[Ae]).rect.width*He.rect.height}return oe})(k,y,N,O,L,$),ee={},ne=[],ce=[];if(D!=0){const Ne=[];for(j=0;j<q.length;j++)Ne.push(q[j].img.buffer);const we=(function(K){let te=0;for(var oe=0;oe<K.length;oe++)te+=K[oe].byteLength;const le=new Uint8Array(te);let ve=0;for(oe=0;oe<K.length;oe++){const Te=new Uint8Array(K[oe]),We=Te.length;for(let Ae=0;Ae<We;Ae+=4){let He=Te[Ae],Ie=Te[Ae+1],X=Te[Ae+2];const se=Te[Ae+3];se==0&&(He=Ie=X=0),le[ve+Ae]=He,le[ve+Ae+1]=Ie,le[ve+Ae+2]=X,le[ve+Ae+3]=se}ve+=We}return le.buffer})(Ne),ke=m(we,D);for(j=0;j<ke.plte.length;j++)ne.push(ke.plte[j].est.rgba);let Ue=0;for(j=0;j<q.length;j++){const Oe=(_e=q[j]).img.length;var R=new Uint8Array(ke.inds.buffer,Ue>>2,Oe>>2);ce.push(R);const K=new Uint8Array(ke.abuf,Ue,Oe);z&&l(_e.img,_e.rect.width,_e.rect.height,ne,K,R),_e.img.set(K),Ue+=Oe}}else for(B=0;B<q.length;B++){var _e=q[B];const Ne=new Uint32Array(_e.img.buffer);var me=_e.rect.width;for(V=Ne.length,R=new Uint8Array(V),ce.push(R),j=0;j<V;j++){const we=Ne[j];if(j!=0&&we==Ne[j-1])R[j]=R[j-1];else if(j>me&&we==Ne[j-me])R[j]=R[j-me];else{let ke=ee[we];if(ke==null&&(ee[we]=ke=ne.length,ne.push(we),ne.length>=300))break;R[j]=ke}}}const Be=ne.length;for(Be<=256&&b==0&&(G=Be<=2?1:Be<=4?2:Be<=16?4:8,G=Math.max(G,S)),B=0;B<q.length;B++){(_e=q[B]).rect.x,_e.rect.y,me=_e.rect.width;const Ne=_e.rect.height;let we=_e.img;new Uint32Array(we.buffer);let ke=4*me,Ue=4;if(Be<=256&&b==0){ke=Math.ceil(G*me/8);var $e=new Uint8Array(ke*Ne);const Oe=ce[B];for(let K=0;K<Ne;K++){j=K*ke;const te=K*me;if(G==8)for(var ye=0;ye<me;ye++)$e[j+ye]=Oe[te+ye];else if(G==4)for(ye=0;ye<me;ye++)$e[j+(ye>>1)]|=Oe[te+ye]<<4-4*(1&ye);else if(G==2)for(ye=0;ye<me;ye++)$e[j+(ye>>2)]|=Oe[te+ye]<<6-2*(3&ye);else if(G==1)for(ye=0;ye<me;ye++)$e[j+(ye>>3)]|=Oe[te+ye]<<7-1*(7&ye)}we=$e,U=3,Ue=1}else if(H==0&&q.length==1){$e=new Uint8Array(me*Ne*3);const Oe=me*Ne;for(j=0;j<Oe;j++){const K=3*j,te=4*j;$e[K]=we[te],$e[K+1]=we[te+1],$e[K+2]=we[te+2]}we=$e,U=2,Ue=3,ke=3*me}_e.img=we,_e.bpl=ke,_e.bpp=Ue}return{ctype:U,depth:G,plte:ne,frames:q}}function i(k,y,N,D,P,O,L){const $=Uint8Array,S=Uint32Array,b=new $(k[P-1]),z=new S(k[P-1]),U=P+1<k.length?new $(k[P+1]):null,G=new $(k[P]),Y=new S(G.buffer);let B=y,V=N,j=-1,H=-1;for(let ee=0;ee<O.height;ee++)for(let ne=0;ne<O.width;ne++){const ce=O.x+ne,R=O.y+ee,_e=R*y+ce,me=Y[_e];me==0||D[P-1].dispose==0&&z[_e]==me&&(U==null||U[4*_e+3]!=0)||(ce<B&&(B=ce),ce>j&&(j=ce),R<V&&(V=R),R>H&&(H=R))}j==-1&&(B=V=j=H=0),L&&((1&B)==1&&B--,(1&V)==1&&V--),O={x:B,y:V,width:j-B+1,height:H-V+1};const q=D[P];q.rect=O,q.blend=1,q.img=new Uint8Array(O.width*O.height*4),D[P-1].dispose==0?(e(b,y,N,q.img,O.width,O.height,-O.x,-O.y,0),u(G,y,N,q.img,O)):e(G,y,N,q.img,O.width,O.height,-O.x,-O.y,0)}function u(k,y,N,D,P){e(k,y,N,D,P.width,P.height,-P.x,-P.y,2)}function g(k,y,N,D,P,O,L){const $=[];let S,b=[0,1,2,3,4];O!=-1?b=[O]:(y*D>5e5||N==1)&&(b=[0]),L&&(S={level:0});const z=kg;for(var U=0;U<b.length;U++){for(let B=0;B<y;B++)p(P,k,B,D,N,b[U]);$.push(z.deflate(P,S))}let G,Y=1e9;for(U=0;U<$.length;U++)$[U].length<Y&&(G=U,Y=$[U].length);return $[G]}function p(k,y,N,D,P,O){const L=N*D;let $=L+N;if(k[$]=O,$++,O==0)if(D<500)for(var S=0;S<D;S++)k[$+S]=y[L+S];else k.set(new Uint8Array(y.buffer,L,D),$);else if(O==1){for(S=0;S<P;S++)k[$+S]=y[L+S];for(S=P;S<D;S++)k[$+S]=y[L+S]-y[L+S-P]+256&255}else if(N==0){for(S=0;S<P;S++)k[$+S]=y[L+S];if(O==2)for(S=P;S<D;S++)k[$+S]=y[L+S];if(O==3)for(S=P;S<D;S++)k[$+S]=y[L+S]-(y[L+S-P]>>1)+256&255;if(O==4)for(S=P;S<D;S++)k[$+S]=y[L+S]-r(y[L+S-P],0,0)+256&255}else{if(O==2)for(S=0;S<D;S++)k[$+S]=y[L+S]+256-y[L+S-D]&255;if(O==3){for(S=0;S<P;S++)k[$+S]=y[L+S]+256-(y[L+S-D]>>1)&255;for(S=P;S<D;S++)k[$+S]=y[L+S]+256-(y[L+S-D]+y[L+S-P]>>1)&255}if(O==4){for(S=0;S<P;S++)k[$+S]=y[L+S]+256-r(0,y[L+S-D],0)&255;for(S=P;S<D;S++)k[$+S]=y[L+S]+256-r(y[L+S-P],y[L+S-D],y[L+S-P-D])&255}}}function m(k,y){const N=new Uint8Array(k),D=N.slice(0),P=new Uint32Array(D.buffer),O=v(D,y),L=O[0],$=O[1],S=N.length,b=new Uint8Array(S>>2);let z;if(N.length<2e7)for(var U=0;U<S;U+=4)z=x(L,G=N[U]*.00392156862745098,Y=N[U+1]*.00392156862745098,B=N[U+2]*.00392156862745098,V=N[U+3]*.00392156862745098),b[U>>2]=z.ind,P[U>>2]=z.est.rgba;else for(U=0;U<S;U+=4){var G=N[U]*.00392156862745098,Y=N[U+1]*(1/255),B=N[U+2]*(1/255),V=N[U+3]*(1/255);for(z=L;z.left;)z=M(z.est,G,Y,B,V)<=0?z.left:z.right;b[U>>2]=z.ind,P[U>>2]=z.est.rgba}return{abuf:D.buffer,inds:b,plte:$}}function v(k,y,N){N==null&&(N=1e-4);const D=new Uint32Array(k.buffer),P={i0:0,i1:k.length,bst:null,est:null,tdst:0,left:null,right:null};P.bst=A(k,P.i0,P.i1),P.est=_(P.bst);const O=[P];for(;O.length<y;){let $=0,S=0;for(var L=0;L<O.length;L++)O[L].est.L>$&&($=O[L].est.L,S=L);if($<N)break;const b=O[S],z=w(k,D,b.i0,b.i1,b.est.e,b.est.eMq255);if(b.i0>=z||b.i1<=z){b.est.L=0;continue}const U={i0:b.i0,i1:z,bst:null,est:null,tdst:0,left:null,right:null};U.bst=A(k,U.i0,U.i1),U.est=_(U.bst);const G={i0:z,i1:b.i1,bst:null,est:null,tdst:0,left:null,right:null};for(G.bst={R:[],m:[],N:b.bst.N-U.bst.N},L=0;L<16;L++)G.bst.R[L]=b.bst.R[L]-U.bst.R[L];for(L=0;L<4;L++)G.bst.m[L]=b.bst.m[L]-U.bst.m[L];G.est=_(G.bst),b.left=U,b.right=G,O[S]=U,O.push(G)}for(O.sort((($,S)=>S.bst.N-$.bst.N)),L=0;L<O.length;L++)O[L].ind=L;return[P,O]}function x(k,y,N,D,P){if(k.left==null)return k.tdst=(function(U,G,Y,B,V){const j=G-U[0],H=Y-U[1],q=B-U[2],ee=V-U[3];return j*j+H*H+q*q+ee*ee})(k.est.q,y,N,D,P),k;const O=M(k.est,y,N,D,P);let L=k.left,$=k.right;O>0&&(L=k.right,$=k.left);const S=x(L,y,N,D,P);if(S.tdst<=O*O)return S;const b=x($,y,N,D,P);return b.tdst<S.tdst?b:S}function M(k,y,N,D,P){const{e:O}=k;return O[0]*y+O[1]*N+O[2]*D+O[3]*P-k.eMq}function w(k,y,N,D,P,O){for(D-=4;N<D;){for(;T(k,N,P)<=O;)N+=4;for(;T(k,D,P)>O;)D-=4;if(N>=D)break;const L=y[N>>2];y[N>>2]=y[D>>2],y[D>>2]=L,N+=4,D-=4}for(;T(k,N,P)>O;)N-=4;return N+4}function T(k,y,N){return k[y]*N[0]+k[y+1]*N[1]+k[y+2]*N[2]+k[y+3]*N[3]}function A(k,y,N){const D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],P=[0,0,0,0],O=N-y>>2;for(let L=y;L<N;L+=4){const $=k[L]*.00392156862745098,S=k[L+1]*(1/255),b=k[L+2]*(1/255),z=k[L+3]*(1/255);P[0]+=$,P[1]+=S,P[2]+=b,P[3]+=z,D[0]+=$*$,D[1]+=$*S,D[2]+=$*b,D[3]+=$*z,D[5]+=S*S,D[6]+=S*b,D[7]+=S*z,D[10]+=b*b,D[11]+=b*z,D[15]+=z*z}return D[4]=D[1],D[8]=D[2],D[9]=D[6],D[12]=D[3],D[13]=D[7],D[14]=D[11],{R:D,m:P,N:O}}function _(k){const{R:y}=k,{m:N}=k,{N:D}=k,P=N[0],O=N[1],L=N[2],$=N[3],S=D==0?0:1/D,b=[y[0]-P*P*S,y[1]-P*O*S,y[2]-P*L*S,y[3]-P*$*S,y[4]-O*P*S,y[5]-O*O*S,y[6]-O*L*S,y[7]-O*$*S,y[8]-L*P*S,y[9]-L*O*S,y[10]-L*L*S,y[11]-L*$*S,y[12]-$*P*S,y[13]-$*O*S,y[14]-$*L*S,y[15]-$*$*S],z=b,U=I;let G=[Math.random(),Math.random(),Math.random(),Math.random()],Y=0,B=0;if(D!=0)for(let j=0;j<16&&(G=U.multVec(z,G),B=Math.sqrt(U.dot(G,G)),G=U.sml(1/B,G),!(j!=0&&Math.abs(B-Y)<1e-9));j++)Y=B;const V=[P*S,O*S,L*S,$*S];return{Cov:b,q:V,e:G,L:Y,eMq255:U.dot(U.sml(255,V),G),eMq:U.dot(G,V),rgba:(Math.round(255*V[3])<<24|Math.round(255*V[2])<<16|Math.round(255*V[1])<<8|Math.round(255*V[0])<<0)>>>0}}var I={multVec:(k,y)=>[k[0]*y[0]+k[1]*y[1]+k[2]*y[2]+k[3]*y[3],k[4]*y[0]+k[5]*y[1]+k[6]*y[2]+k[7]*y[3],k[8]*y[0]+k[9]*y[1]+k[10]*y[2]+k[11]*y[3],k[12]*y[0]+k[13]*y[1]+k[14]*y[2]+k[15]*y[3]],dot:(k,y)=>k[0]*y[0]+k[1]*y[1]+k[2]*y[2]+k[3]*y[3],sml:(k,y)=>[k*y[0],k*y[1],k*y[2],k*y[3]]};Kt.encode=function(y,N,D,P,O,L,$){P==null&&(P=0),$==null&&($=!1);const S=c(y,N,D,P,[!1,!1,!1,0,$,!1]);return h(S,-1),f(S,N,D,O,L)},Kt.encodeLL=function(y,N,D,P,O,L,$,S){const b={ctype:0+(P==1?0:2)+(O==0?0:4),depth:L,frames:[]},z=(P+O)*L,U=z*N;for(let G=0;G<y.length;G++)b.frames.push({rect:{x:0,y:0,width:N,height:D},img:new Uint8Array(y[G]),blend:0,dispose:1,bpp:Math.ceil(z/8),bpl:Math.ceil(U/8)});return h(b,0,!0),f(b,N,D,$,S)},Kt.encode.compress=c,Kt.encode.dither=l,Kt.quantize=m,Kt.quantize.getKDtree=v,Kt.quantize.getNearest=x})();const Zl={toArrayBuffer(e,t){const r=e.width,n=e.height,o=r<<2,a=e.getContext("2d").getImageData(0,0,r,n),s=new Uint32Array(a.data.buffer),l=(32*r+31)/32<<2,f=l*n,h=122+f,c=new ArrayBuffer(h),i=new DataView(c),u=1<<20;let g,p,m,v,x=u,M=0,w=0,T=0;function A(k){i.setUint16(w,k,!0),w+=2}function _(k){i.setUint32(w,k,!0),w+=4}function I(k){w+=k}A(19778),_(h),I(4),_(122),_(108),_(r),_(-n>>>0),A(1),A(32),_(3),_(f),_(2835),_(2835),I(8),_(16711680),_(65280),_(255),_(4278190080),_(1466527264),(function k(){for(;M<n&&x>0;){for(v=122+M*l,g=0;g<o;)x--,p=s[T++],m=p>>>24,i.setUint32(v+g,p<<8|m),g+=4;M++}T<s.length?(x=u,setTimeout(k,Zl._dly)):t(c)})()},toBlob(e,t){this.toArrayBuffer(e,(r=>{t(new Blob([r],{type:"image/bmp"}))}))},_dly:9};var wt={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Cg={[wt.CHROME]:16384,[wt.FIREFOX]:11180,[wt.DESKTOP_SAFARI]:16384,[wt.IE]:8192,[wt.IOS]:4096,[wt.ETC]:8192};const ra=typeof window<"u",ql=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Pn=ra&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Sg=(ra||ql)&&(Pn&&Pn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Ql=(ra||ql)&&(Pn&&Pn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function na(e,t,r=Date.now()){return new Promise((n=>{const o=e.split(","),a=o[0].match(/:(.*?);/)[1],s=globalThis.atob(o[1]);let l=s.length;const f=new Uint8Array(l);for(;l--;)f[l]=s.charCodeAt(l);const h=new Blob([f],{type:a});h.name=t,h.lastModified=r,n(h)}))}function Jl(e){return new Promise(((t,r)=>{const n=new Ql;n.onload=()=>t(n.result),n.onerror=o=>r(o),n.readAsDataURL(e)}))}function Rl(e){return new Promise(((t,r)=>{const n=new Image;n.onload=()=>t(n),n.onerror=o=>r(o),n.src=e}))}function gr(){if(gr.cachedResult!==void 0)return gr.cachedResult;let e=wt.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=wt.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=wt.IOS:/Safari/i.test(t)?e=wt.DESKTOP_SAFARI:/Firefox/i.test(t)?e=wt.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=wt.IE),gr.cachedResult=e,gr.cachedResult}function ei(e,t){const r=gr(),n=Cg[r];let o=e,a=t,s=o*a;const l=o>a?a/o:o/a;for(;s>n*n;){const f=(n+o)/2,h=(n+a)/2;f<h?(a=h,o=h*l):(a=f*l,o=f),s=o*a}return{width:o,height:a}}function Fn(e,t){let r,n;try{if(r=new OffscreenCanvas(e,t),n=r.getContext("2d"),n===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{r=document.createElement("canvas"),n=r.getContext("2d")}return r.width=e,r.height=t,[r,n]}function ti(e,t){const{width:r,height:n}=ei(e.width,e.height),[o,a]=Fn(r,n);return t&&/jpe?g/.test(t)&&(a.fillStyle="white",a.fillRect(0,0,o.width,o.height)),a.drawImage(e,0,0,o.width,o.height),o}function $n(){return $n.cachedResult!==void 0||($n.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),$n.cachedResult}function Un(e,t={}){return new Promise((function(r,n){let o,a;var s=function(){try{return a=ti(o,t.fileType||e.type),r([o,a])}catch(f){return n(f)}},l=function(f){try{var h=function(c){try{throw c}catch(i){return n(i)}};try{let c;return Jl(e).then((function(i){try{return c=i,Rl(c).then((function(u){try{return o=u,(function(){try{return s()}catch(g){return n(g)}})()}catch(g){return h(g)}}),h)}catch(u){return h(u)}}),h)}catch(c){h(c)}}catch(c){return n(c)}};try{if($n()||[wt.DESKTOP_SAFARI,wt.MOBILE_SAFARI].includes(gr()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(f){try{return o=f,s()}catch{return l()}}),l)}catch{l()}}))}function zn(e,t,r,n,o=1){return new Promise((function(a,s){let l;if(t==="image/png"){let h,c,i;return h=e.getContext("2d"),{data:c}=h.getImageData(0,0,e.width,e.height),i=Kt.encode([c.buffer],e.width,e.height,4096*o),l=new Blob([i],{type:t}),l.name=r,l.lastModified=n,f.call(this)}{let h=function(){return f.call(this)};if(t==="image/bmp")return new Promise((c=>Zl.toBlob(e,c))).then(function(c){try{return l=c,l.name=r,l.lastModified=n,h.call(this)}catch(i){return s(i)}}.bind(this),s);{let c=function(){return h.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:o}).then(function(i){try{return l=i,l.name=r,l.lastModified=n,c.call(this)}catch(u){return s(u)}}.bind(this),s);{let i;return i=e.toDataURL(t,o),na(i,r,n).then(function(u){try{return l=u,c.call(this)}catch(g){return s(g)}}.bind(this),s)}}}function f(){return a(l)}}))}function Zt(e){e.width=0,e.height=0}function Pr(){return new Promise((function(e,t){let r,n,o,a;return Pr.cachedResult!==void 0?e(Pr.cachedResult):na("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(s){try{return r=s,Un(r).then((function(l){try{return n=l[1],zn(n,r.type,r.name,r.lastModified).then((function(f){try{return o=f,Zt(n),Un(o).then((function(h){try{return a=h[0],Pr.cachedResult=a.width===1&&a.height===2,e(Pr.cachedResult)}catch(c){return t(c)}}),t)}catch(h){return t(h)}}),t)}catch(f){return t(f)}}),t)}catch(l){return t(l)}}),t)}))}function ri(e){return new Promise(((t,r)=>{const n=new Ql;n.onload=o=>{const a=new DataView(o.target.result);if(a.getUint16(0,!1)!=65496)return t(-2);const s=a.byteLength;let l=2;for(;l<s;){if(a.getUint16(l+2,!1)<=8)return t(-1);const f=a.getUint16(l,!1);if(l+=2,f==65505){if(a.getUint32(l+=2,!1)!=1165519206)return t(-1);const h=a.getUint16(l+=6,!1)==18761;l+=a.getUint32(l+4,h);const c=a.getUint16(l,h);l+=2;for(let i=0;i<c;i++)if(a.getUint16(l+12*i,h)==274)return t(a.getUint16(l+12*i+8,h))}else{if((65280&f)!=65280)break;l+=a.getUint16(l,!1)}}return t(-1)},n.onerror=o=>r(o),n.readAsArrayBuffer(e)}))}function ni(e,t){const{width:r}=e,{height:n}=e,{maxWidthOrHeight:o}=t;let a,s=e;return isFinite(o)&&(r>o||n>o)&&([s,a]=Fn(r,n),r>n?(s.width=o,s.height=n/r*o):(s.width=r/n*o,s.height=o),a.drawImage(e,0,0,s.width,s.height),Zt(e)),s}function oi(e,t){const{width:r}=e,{height:n}=e,[o,a]=Fn(r,n);switch(t>4&&t<9?(o.width=n,o.height=r):(o.width=r,o.height=n),t){case 2:a.transform(-1,0,0,1,r,0);break;case 3:a.transform(-1,0,0,-1,r,n);break;case 4:a.transform(1,0,0,-1,0,n);break;case 5:a.transform(0,1,1,0,0,0);break;case 6:a.transform(0,1,-1,0,n,0);break;case 7:a.transform(0,-1,-1,0,n,r);break;case 8:a.transform(0,-1,1,0,0,r)}return a.drawImage(e,0,0,r,n),Zt(e),o}function ai(e,t,r=0){return new Promise((function(n,o){let a,s,l,f,h,c,i,u,g,p,m,v,x,M,w,T,A,_,I,k;function y(D=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=D,t.onProgress(Math.min(a,100))}function N(D){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(D,a),100),t.onProgress(a)}return a=r,s=t.maxIteration||10,l=1024*t.maxSizeMB*1024,y(),Un(e,t).then(function(D){try{return[,f]=D,y(),h=ni(f,t),y(),new Promise((function(P,O){var L;if(!(L=t.exifOrientation))return ri(e).then(function(S){try{return L=S,$.call(this)}catch(b){return O(b)}}.bind(this),O);function $(){return P(L)}return $.call(this)})).then(function(P){try{return c=P,y(),Pr().then(function(O){try{return i=O?h:oi(h,c),y(),u=t.initialQuality||1,g=t.fileType||e.type,zn(i,g,e.name,e.lastModified,u).then(function(L){try{{let S=function(){if(s--&&(w>l||w>x)){let z,U;return z=k?.95*I.width:I.width,U=k?.95*I.height:I.height,[A,_]=Fn(z,U),_.drawImage(I,0,0,z,U),u*=g==="image/png"?.85:.95,zn(A,g,e.name,e.lastModified,u).then((function(G){try{return T=G,Zt(I),I=A,w=T.size,N(Math.min(99,Math.floor((M-w)/(M-l)*100))),S}catch(Y){return o(Y)}}),o)}return[1]},b=function(){return Zt(I),Zt(A),Zt(h),Zt(i),Zt(f),N(100),n(T)};if(p=L,y(),m=p.size>l,v=p.size>e.size,!m&&!v)return N(100),n(p);var $;return x=e.size,M=p.size,w=M,I=i,k=!t.alwaysKeepResolution&&m,($=function(z){for(;z;){if(z.then)return void z.then($,o);try{if(z.pop){if(z.length)return z.pop()?b.call(this):z;z=S}else z=z.call(this)}catch(U){return o(U)}}}.bind(this))(S)}}catch(S){return o(S)}}.bind(this),o)}catch(L){return o(L)}}.bind(this),o)}catch(O){return o(O)}}.bind(this),o)}catch(P){return o(P)}}.bind(this),o)}))}const _g=`
let scriptImported = false
self.addEventListener('message', async (e) => {
const { file, id, imageCompressionLibUrl, options } = e.data
options.onProgress = (progress) => self.postMessage({ progress, id })
try {
if (!scriptImported) {
// console.log('[worker] importScripts', imageCompressionLibUrl)
self.importScripts(imageCompressionLibUrl)
scriptImported = true
}
// console.log('[worker] self', self)
const compressedFile = await imageCompression(file, options)
self.postMessage({ file: compressedFile, id })
} catch (e) {
// console.error('[worker] error', e)
self.postMessage({ error: e.message + '\\n' + e.stack, id })
}
})
`;let oa;function Eg(e,t){return new Promise(((r,n)=>{oa||(oa=(function(s){const l=[];return l.push(s),URL.createObjectURL(new Blob(l))})(_g));const o=new Worker(oa);o.addEventListener("message",(function(s){if(t.signal&&t.signal.aborted)o.terminate();else if(s.data.progress===void 0){if(s.data.error)return n(new Error(s.data.error)),void o.terminate();r(s.data.file),o.terminate()}else t.onProgress(s.data.progress)})),o.addEventListener("error",n),t.signal&&t.signal.addEventListener("abort",(()=>{n(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function ht(e,t){return new Promise((function(r,n){let o,a,s,l,f,h;if(o={...t},s=0,{onProgress:l}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,f=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=g=>{s=g,typeof l=="function"&&l(s)},!(e instanceof Blob||e instanceof Sg))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return n(new Error("The file given is not an image"));if(h=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!f||typeof Worker!="function"||h)return ai(e,o).then(function(g){try{return a=g,u.call(this)}catch(p){return n(p)}}.bind(this),n);var c=function(){try{return u.call(this)}catch(g){return n(g)}}.bind(this),i=function(g){try{return ai(e,o).then((function(p){try{return a=p,c()}catch(m){return n(m)}}),n)}catch(p){return n(p)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Eg(e,o).then((function(g){try{return a=g,c()}catch{return i()}}),i)}catch{i()}function u(){try{a.name=e.name,a.lastModified=e.lastModified}catch{}try{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(a=Xl(e,a))}catch{}return r(a)}}))}ht.getDataUrlFromFile=Jl,ht.getFilefromDataUrl=na,ht.loadImage=Rl,ht.drawImageInCanvas=ti,ht.drawFileInCanvas=Un,ht.canvasToFile=zn,ht.getExifOrientation=ri,ht.handleMaxWidthOrHeight=ni,ht.followExifOrientation=oi,ht.cleanupCanvasMemory=Zt,ht.isAutoOrientationInBrowser=Pr,ht.approximateBelowMaximumCanvasSizeOfBrowser=ei,ht.copyExifWithoutOrientation=Xl,ht.getBrowserName=gr,ht.version="2.0.2";const Tg=window.G7Core,Hn=e=>{const t=["B","KB","MB","GB"];let r=0,n=e;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(2)} ${t[r]}`},si=e=>{if(e&&typeof e=="object"){const t=e;if(t.response?.data?.message)return t.response.data.message;if(t.response?.data?.errors){const r=Object.values(t.response.data.errors)[0];if(Array.isArray(r)&&r[0])return r[0]}if(t.message)return t.message}return e instanceof Error?e.message:"업로드 실패"},li=e=>e?e.startsWith("image/")?"fa-file-image":e.startsWith("video/")?"fa-file-video":e.startsWith("audio/")?"fa-file-audio":e==="application/pdf"?"fa-file-pdf":e.includes("word")||e.includes("document")?"fa-file-word":e.includes("excel")||e.includes("spreadsheet")?"fa-file-excel":e.includes("zip")||e.includes("compressed")?"fa-file-zipper":"fa-file":"fa-file",et=(e,t)=>Tg?.t?.(e,t)??e,hr=window.G7Core;function ii(e){const{attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:h,autoUpload:c,initialFiles:i,endpoints:u,onFilesChange:g,onUploadComplete:p,onUploadError:m,onRemove:v,onReorder:x,uploadTriggerEvent:M,confirmBeforeRemove:w,uploadParams:T}=e,[A,_]=C.useState(i),[I,k]=C.useState([]),[y,N]=C.useState(!1),D=C.useRef(null),P=C.useRef(0),O=C.useRef(new Set),L=C.useRef(new Map),[$,S]=C.useState(!1),[b,z]=C.useState(null),[U,G]=C.useState(!1),Y=C.useRef(!1),[B,V]=C.useState([]),j=C.useRef(i),[H,q]=C.useState(!1),[ee,ne]=C.useState(0),ce=C.useRef(0),[R,_e]=C.useState(new Map),me=C.useRef(new Map);C.useEffect(()=>{g?.(I)},[I,g]);const Be=C.useMemo(()=>{const X=j.current;return X===i?X:X.length!==i.length?(j.current=i,i):X.length===0&&i.length===0?X:i.some((de,ue)=>de.id!==X[ue]?.id)?(j.current=i,i):X},[i]);C.useEffect(()=>{if(Y.current)return;const X=Be.filter(ue=>!O.current.has(ue.id)&&(!ue.hash||!O.current.has(ue.hash))),se=new Set(X.map(ue=>ue.id)),de=Array.from(L.current.values()).filter(ue=>!se.has(ue.id)&&!O.current.has(ue.id));_([...X,...de])},[Be]);const $e=C.useCallback(async X=>{const se={maxSizeMB:f?.maxSizeMB??1,maxWidthOrHeight:f?.maxWidthOrHeight??1920,useWebWorker:!0};return await ht(X,se)},[f]),ye=C.useCallback(async X=>{const se=A.length+I.length,de=Math.max(0,o-se),ue=Array.from(X).slice(0,de);if(X.length>de){const ie=Array.from(X).slice(de),De=et("attachment.upload_limit_exceeded",{max:o});m?.(De,ie[0]??X[0])}for(const ie of ue){if(ie.size>a*1024*1024){m?.(`[${ie.name}] 파일 크기(${Hn(ie.size)})가 최대 허용 크기(${a}MB)를 초과합니다.`,ie);continue}if(l){const ge="."+ie.name.split(".").pop()?.toLowerCase();if(!l.split(",").map(ze=>ze.trim().toLowerCase()).some(ze=>{if(ze.includes("/")){if(ze.endsWith("/*")){const Ke=ze.slice(0,-2);return ie.type.toLowerCase().startsWith(Ke+"/")}return ie.type.toLowerCase()===ze}return ge===ze})){m?.(`[${ie.name}] 허용되지 않는 파일 형식입니다. (허용: ${l})`,ie);continue}}const De={id:`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:ie,original_filename:ie.name,mime_type:ie.type,size:ie.size,size_formatted:Hn(ie.size),status:"pending",progress:0};if(ie.type.startsWith("image/")&&(De.preview=URL.createObjectURL(ie)),k(ge=>[...ge,De]),ie.type.startsWith("image/")&&f){k(ge=>ge.map(xe=>xe.id===De.id?{...xe,status:"compressing"}:xe));try{const ge=await $e(ie);k(xe=>xe.map(Ce=>Ce.id===De.id?{...Ce,compressedBlob:ge,size:ge.size,size_formatted:Hn(ge.size),status:"pending",progress:0}:Ce))}catch{k(ge=>ge.map(xe=>xe.id===De.id?{...xe,status:"error",error:"이미지 압축 실패"}:xe))}}}},[A.length,I.length,o,a,l,f,$e,m]),Ne=C.useCallback(async X=>{const se=new FormData,de=X.compressedBlob?new File([X.compressedBlob],X.original_filename,{type:X.mime_type}):X.file;se.append("file",de),t&&se.append("attachmentable_type",t),r&&se.append("attachmentable_id",String(r)),se.append("collection",n),h.forEach(ue=>{se.append("role_ids[]",String(ue))}),T&&Object.entries(T).forEach(([ue,ie])=>{se.append(ue,ie)});try{const ue=await hr.api.post(u.upload,se,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:De=>{const ge=Math.round(De.loaded*100/(De.total??1));k(xe=>xe.map(Ce=>Ce.id===X.id?{...Ce,progress:ge}:Ce))}});return ue?.data?.data??ue?.data}catch(ue){const ie=si(ue);throw new Error(ie)}},[t,r,n,h,u.upload]),we=C.useCallback(async()=>{const X=I.filter(ge=>ge.status==="pending"||ge.status==="error");if(X.length===0)return[];const se=[],de=new Map,ue=[...X],ie=async()=>{for(;ue.length>0&&P.current<s;){const ge=ue.shift();P.current++,k(xe=>xe.map(Ce=>Ce.id===ge.id?{...Ce,status:"uploading",progress:0}:Ce));try{const xe=await Ne(ge);if(xe)se.push(xe),de.set(String(ge.id),String(xe.hash)),L.current.set(xe.id,xe),k(Ce=>Ce.filter(ze=>ze.id!==ge.id)),_(Ce=>[...Ce,xe]),V(Ce=>{if(Ce.length===0)return Ce;const ze=String(ge.id);return Ce.some(Se=>String(Se)===ze)?Ce.map(Se=>String(Se)===ze?String(xe.hash):Se):Ce}),ge.preview&&URL.revokeObjectURL(ge.preview);else{const Ce=et("attachment.upload_response_invalid");k(ze=>ze.map(Ke=>Ke.id===ge.id?{...Ke,status:"error",error:Ce}:Ke)),m?.(`[${ge.original_filename}] ${Ce}`,ge.file)}}catch(xe){const Ce=xe instanceof Error?xe.message:"업로드 실패";k(ze=>ze.map(Ke=>Ke.id===ge.id?{...Ke,status:"error",error:Ce}:Ke)),m?.(`[${ge.original_filename}] ${Ce}`,ge.file)}finally{P.current--}}},De=Array(Math.min(s,X.length)).fill(null).map(()=>ie());if(await Promise.all(De),se.length>0&&(p?.(se),u.reorder&&B.length>0&&x)){const ge=[...A,...se],xe=B.map(Ke=>de.get(String(Ke))??Ke),Ce=new Map(xe.map((Ke,Se)=>[String(Ke),Se])),ze=[...ge].sort((Ke,Se)=>{const be=Ce.get(String(Ke.hash))??ge.length,Me=Ce.get(String(Se.hash))??ge.length;return be-Me}).map((Ke,Se)=>({...Ke,sort_order:Se,order:Se+1}));x(ze)}return se},[I,s,Ne,p,m,B,A,x,u.reorder]);C.useEffect(()=>{if(!M)return;const X=hr.componentEvent.on(M,async()=>{const se=await we();return{uploadedAttachments:se,existingFiles:A,allFiles:[...A,...se]}});return()=>{X()}},[M,we,A]),C.useEffect(()=>{c&&I.some(X=>X.status==="pending")&&we()},[c,I,we]);const ke=C.useCallback(async X=>{G(!0);try{if(X.id&&u.delete){const de=u.delete.replace(":id",String(X.id));await hr.api.delete(de)}const se=X.hash||X.id;X.id&&(O.current.add(X.id),L.current.delete(X.id)),X.hash&&O.current.add(X.hash),_(de=>de.filter(ue=>(ue.hash||ue.id)!==se)),v?.(X.hash||X.id),S(!1),z(null)}catch{console.error("첨부파일 삭제 실패")}finally{G(!1)}},[v,u.delete]),Ue=C.useCallback(async X=>{"hash"in X?w?(z(X),S(!0)):await ke(X):(X.preview&&URL.revokeObjectURL(X.preview),k(se=>se.filter(de=>de.id!==X.id)))},[w,ke]),Oe=C.useCallback(X=>{k(se=>se.map(de=>de.id===X.id?{...de,status:"pending",error:void 0}:de))},[]),K=C.useCallback(async X=>{const{arrayMove:se}=await Promise.resolve().then(()=>i0),{active:de,over:ue}=X;if(!ue||de.id===ue.id)return;const ie=[...A,...I];let De;if(B.length===0)De=ie;else{const be=new Map(B.map((Me,je)=>[String(Me),je]));De=[...ie].sort((Me,je)=>{const rt="hash"in Me?String(Me.hash):String(Me.id),Ye="hash"in je?String(je.hash):String(je.id);return(be.get(rt)??ie.length)-(be.get(Ye)??ie.length)})}const ge=De.findIndex(be=>"hash"in be?be.hash===de.id:be.id===de.id),xe=De.findIndex(be=>"hash"in be?be.hash===ue.id:be.id===ue.id),Ce=se(De,ge,xe);V(Ce.map(be=>"hash"in be?be.hash:be.id));const ze=Ce.filter(be=>"hash"in be),Ke=Ce.filter(be=>!("hash"in be));Y.current=!0,_(ze),k(Ke);const Se=ze.map((be,Me)=>({...be,sort_order:Me,order:Me+1}));if(ze.length>0&&u.reorder){const be=ze.map((Me,je)=>({id:Me.id,order:je+1}));try{const Me=await hr.api.patch(u.reorder,{order:be});hr.toast.success(Me.message)}catch(Me){const je=Me instanceof Error?Me.message:et("attachment.reorder_failed");hr.toast.error(je)}}x?.(Se)},[A,I,B,u.reorder,x]),te=C.useMemo(()=>[...A,...I].filter(X=>"is_image"in X?X.is_image:X.mime_type?.startsWith("image/")??!1),[A,I]),oe=C.useCallback(X=>{const se=te.findIndex(de=>"hash"in X&&"hash"in de?de.hash===X.hash:"id"in X&&"id"in de&&!("hash"in X)&&!("hash"in de)?de.id===X.id:!1);se!==-1&&(ce.current+=1,ne(se),q(!0))},[te]);C.useEffect(()=>{let X=!1;return(async()=>{const de=A.filter(ie=>ie.is_image),ue=new Set(de.map(ie=>ie.id));for(const[ie,De]of me.current)ue.has(ie)||(URL.revokeObjectURL(De),me.current.delete(ie));for(const ie of de){if(X)break;if(!me.current.has(ie.id))try{const De=await hr.api.get(ie.download_url,{responseType:"blob"});if(!X&&De){const ge=URL.createObjectURL(De);me.current.set(ie.id,ge),_e(new Map(me.current))}}catch(De){console.error("Failed to load authenticated image:",De)}}})(),()=>{X=!0}},[A]),C.useEffect(()=>()=>{me.current.forEach(X=>URL.revokeObjectURL(X)),me.current.clear()},[]);const le=C.useCallback(async X=>{const{executeImageDownload:se}=await Promise.resolve().then(()=>zl);await se({src:X.download_url,downloadUrl:X.download_url,filename:X.original_filename,downloadRequiresAuth:!0})},[]),ve=C.useMemo(()=>{const X=[...A,...I];if(B.length===0)return X;const se=new Map(B.map((de,ue)=>[String(de),ue]));return[...X].sort((de,ue)=>{const ie="hash"in de?String(de.hash):String(de.id),De="hash"in ue?String(ue.hash):String(ue.id),ge=se.get(ie)??X.length,xe=se.get(De)??X.length;return ge-xe})},[A,I,B]),Te=ve.length,We=Te>0,Ae=Te<o,He=C.useCallback(()=>k([]),[]),Ie=C.useCallback(()=>I,[I]);return{existingFiles:A,pendingFiles:I,isDragOver:y,setIsDragOver:N,isDeleting:U,totalCount:Te,hasFiles:We,canAddMore:Ae,allItems:ve,imageFiles:te,handleFiles:ye,handleRemove:Ue,handleRetry:Oe,handleUploadAll:we,handleOpenGallery:oe,handleDownload:le,handleDragEnd:K,inputRef:D,galleryOpen:H,setGalleryOpen:q,galleryStartIndex:ee,galleryKeyRef:ce,confirmDialogOpen:$,setConfirmDialogOpen:S,itemToDelete:b,executeRemoveAttachment:ke,authenticatedImageUrls:R,clear:He,getPendingFiles:Ie}}const ci=({isDragOver:e,canAddMore:t,onFiles:r,setIsDragOver:n,inputRef:o,accept:a,maxFiles:s,maxSize:l,children:f})=>d.jsxs(W,{className:`
relative border-2 border-dashed rounded-lg transition-colors
${e?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600"}
`,onDragOver:h=>{h.preventDefault(),t&&n(!0)},onDragLeave:()=>n(!1),onDrop:h=>{h.preventDefault(),n(!1),t&&r(h.dataTransfer.files)},children:[d.jsx("input",{ref:o,type:"file",multiple:!0,accept:a,onChange:h=>h.target.files&&r(h.target.files),className:"hidden"}),!f&&d.jsxs(W,{className:"p-8 text-center cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:()=>o.current?.click(),children:[d.jsx(Nt,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),d.jsx(zt,{className:"text-sm text-gray-600 dark:text-gray-400",children:et("attachment.drop_or_click")}),d.jsxs(zt,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[et("attachment.upload_limit",{maxFiles:s,maxSize:l}),a&&` (${a})`]})]}),f]});function Ng(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return C.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const Gn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function aa(e){return"nodeType"in e}function xt(e){var t,r;return e?Fr(e)?e:aa(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function sa(e){const{Document:t}=xt(e);return e instanceof t}function tn(e){return Fr(e)?!1:e instanceof xt(e).HTMLElement}function di(e){return e instanceof xt(e).SVGElement}function $r(e){return e?Fr(e)?e.document:aa(e)?sa(e)?e:tn(e)||di(e)?e.ownerDocument:document:document:document}const qt=Gn?C.useLayoutEffect:C.useEffect;function la(e){const t=C.useRef(e);return qt(()=>{t.current=e}),C.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function Ag(){const e=C.useRef(null),t=C.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=C.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function rn(e,t){t===void 0&&(t=[e]);const r=C.useRef(e);return qt(()=>{r.current!==e&&(r.current=e)},t),r}function nn(e,t){const r=C.useRef();return C.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function jn(e){const t=la(e),r=C.useRef(null),n=C.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function ia(e){const t=C.useRef();return C.useEffect(()=>{t.current=e},[e]),t.current}let ca={};function on(e,t){return C.useMemo(()=>{if(t)return t;const r=ca[e]==null?0:ca[e]+1;return ca[e]=r,e+"-"+r},[e,t])}function ui(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,s)=>{const l=Object.entries(s);for(const[f,h]of l){const c=a[f];c!=null&&(a[f]=c+e*h)}return a},{...t})}}const Ur=ui(1),an=ui(-1);function Mg(e){return"clientX"in e&&"clientY"in e}function da(e){if(!e)return!1;const{KeyboardEvent:t}=xt(e.target);return t&&e instanceof t}function Og(e){if(!e)return!1;const{TouchEvent:t}=xt(e.target);return t&&e instanceof t}function ua(e){if(Og(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Mg(e)?{x:e.clientX,y:e.clientY}:null}const sn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[sn.Translate.toString(e),sn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),fi="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ig(e){return e.matches(fi)?e:e.querySelector(fi)}const Dg={display:"none"};function Lg(e){let{id:t,value:r}=e;return C.createElement("div",{id:t,style:Dg},r)}function Pg(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Fg(){const[e,t]=C.useState("");return{announce:C.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const gi=C.createContext(null);function $g(e){const t=C.useContext(gi);C.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ug(){const[e]=C.useState(()=>new Set),t=C.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[C.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var l;return(l=s[o])==null?void 0:l.call(s,a)})},[e]),t]}const zg={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},Hg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Gg(e){let{announcements:t=Hg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=zg}=e;const{announce:a,announcement:s}=Fg(),l=on("DndLiveRegion"),[f,h]=C.useState(!1);if(C.useEffect(()=>{h(!0)},[]),$g(C.useMemo(()=>({onDragStart(i){let{active:u}=i;a(t.onDragStart({active:u}))},onDragMove(i){let{active:u,over:g}=i;t.onDragMove&&a(t.onDragMove({active:u,over:g}))},onDragOver(i){let{active:u,over:g}=i;a(t.onDragOver({active:u,over:g}))},onDragEnd(i){let{active:u,over:g}=i;a(t.onDragEnd({active:u,over:g}))},onDragCancel(i){let{active:u,over:g}=i;a(t.onDragCancel({active:u,over:g}))}}),[a,t])),!f)return null;const c=C.createElement(C.Fragment,null,C.createElement(Lg,{id:n,value:o.draggable}),C.createElement(Pg,{id:l,announcement:s}));return r?Rt.createPortal(c,r):c}var tt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(tt||(tt={}));function Bn(){}function hi(e,t){return C.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function jg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return C.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Vt=Object.freeze({x:0,y:0});function pi(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mi(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Bg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function bi(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function yi(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function vi(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Wg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=vi(t,t.left,t.top),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=pi(vi(f),o);a.push({id:l,data:{droppableContainer:s,value:h}})}}return a.sort(mi)},Kg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=bi(t),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=bi(f),c=o.reduce((u,g,p)=>u+pi(h[p],g),0),i=Number((c/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:i}})}}return a.sort(mi)};function Vg(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=o-n,l=a-r;if(n<o&&r<a){const f=t.width*t.height,h=e.width*e.height,c=s*l,i=c/(f+h-c);return Number(i.toFixed(4))}return 0}const Yg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,l=r.get(s);if(l){const f=Vg(l,t);f>0&&o.push({id:s,data:{droppableContainer:a,value:f}})}}return o.sort(Bg)};function Xg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function wi(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Vt}function Zg(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((s,l)=>({...s,top:s.top+e*l.y,bottom:s.bottom+e*l.y,left:s.left+e*l.x,right:s.right+e*l.x}),{...r})}}const qg=Zg(1);function Qg(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Jg(e,t,r){const n=Qg(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:l}=n,f=e.left-s-(1-o)*parseFloat(r),h=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),c=o?e.width/o:e.width,i=a?e.height/a:e.height;return{width:c,height:i,top:h,right:f+c,bottom:h+i,left:f}}const Rg={ignoreTransform:!1};function zr(e,t){t===void 0&&(t=Rg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:h,transformOrigin:c}=xt(e).getComputedStyle(e);h&&(r=Jg(r,h,c))}const{top:n,left:o,width:a,height:s,bottom:l,right:f}=r;return{top:n,left:o,width:a,height:s,bottom:l,right:f}}function xi(e){return zr(e,{ignoreTransform:!0})}function eh(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function th(e,t){return t===void 0&&(t=xt(e).getComputedStyle(e)),t.position==="fixed"}function rh(e,t){t===void 0&&(t=xt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?r.test(a):!1})}function Wn(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(sa(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!tn(o)||di(o)||r.includes(o))return r;const a=xt(e).getComputedStyle(o);return o!==e&&rh(o,a)&&r.push(o),th(o,a)?r:n(o.parentNode)}return e?n(e):r}function ki(e){const[t]=Wn(e,1);return t??null}function fa(e){return!Gn||!e?null:Fr(e)?e:aa(e)?sa(e)||e===$r(e).scrollingElement?window:tn(e)?e:null:null}function Ci(e){return Fr(e)?e.scrollX:e.scrollLeft}function Si(e){return Fr(e)?e.scrollY:e.scrollTop}function ga(e){return{x:Ci(e),y:Si(e)}}var lt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(lt||(lt={}));function _i(e){return!Gn||!e?!1:e===document.scrollingElement}function Ei(e){const t={x:0,y:0},r=_i(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,l=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:s,isRight:l,maxScroll:n,minScroll:t}}const nh={x:.2,y:.2};function oh(e,t,r,n,o){let{top:a,left:s,right:l,bottom:f}=r;n===void 0&&(n=10),o===void 0&&(o=nh);const{isTop:h,isBottom:c,isLeft:i,isRight:u}=Ei(e),g={x:0,y:0},p={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!h&&a<=t.top+m.height?(g.y=lt.Backward,p.y=n*Math.abs((t.top+m.height-a)/m.height)):!c&&f>=t.bottom-m.height&&(g.y=lt.Forward,p.y=n*Math.abs((t.bottom-m.height-f)/m.height)),!u&&l>=t.right-m.width?(g.x=lt.Forward,p.x=n*Math.abs((t.right-m.width-l)/m.width)):!i&&s<=t.left+m.width&&(g.x=lt.Backward,p.x=n*Math.abs((t.left+m.width-s)/m.width)),{direction:g,speed:p}}function ah(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Ti(e){return e.reduce((t,r)=>Ur(t,ga(r)),Vt)}function sh(e){return e.reduce((t,r)=>t+Ci(r),0)}function lh(e){return e.reduce((t,r)=>t+Si(r),0)}function ih(e,t){if(t===void 0&&(t=zr),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);ki(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ch=[["x",["left","right"],sh],["y",["top","bottom"],lh]];class ha{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Wn(r),o=Ti(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,l]of ch)for(const f of s)Object.defineProperty(this,f,{get:()=>{const h=l(n),c=o[a]-h;return this.rect[f]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ln{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function dh(e){const{EventTarget:t}=xt(e);return e instanceof t?e:$r(e)}function pa(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Ft;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ft||(Ft={}));function Ni(e){e.preventDefault()}function uh(e){e.stopPropagation()}var Fe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Fe||(Fe={}));const Ai={start:[Fe.Space,Fe.Enter],cancel:[Fe.Esc],end:[Fe.Space,Fe.Enter,Fe.Tab]},fh=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Fe.Right:return{...r,x:r.x+25};case Fe.Left:return{...r,x:r.x-25};case Fe.Down:return{...r,y:r.y+25};case Fe.Up:return{...r,y:r.y-25}}};class ma{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new ln($r(r)),this.windowListeners=new ln(xt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ft.Resize,this.handleCancel),this.windowListeners.add(Ft.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ft.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&ih(n),r(Vt)}handleKeyDown(t){if(da(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=Ai,coordinateGetter:s=fh,scrollBehavior:l="smooth"}=o,{code:f}=t;if(a.end.includes(f)){this.handleEnd(t);return}if(a.cancel.includes(f)){this.handleCancel(t);return}const{collisionRect:h}=n.current,c=h?{x:h.left,y:h.top}:Vt;this.referenceCoordinates||(this.referenceCoordinates=c);const i=s(t,{active:r,context:n.current,currentCoordinates:c});if(i){const u=an(i,c),g={x:0,y:0},{scrollableAncestors:p}=n.current;for(const m of p){const v=t.code,{isTop:x,isRight:M,isLeft:w,isBottom:T,maxScroll:A,minScroll:_}=Ei(m),I=ah(m),k={x:Math.min(v===Fe.Right?I.right-I.width/2:I.right,Math.max(v===Fe.Right?I.left:I.left+I.width/2,i.x)),y:Math.min(v===Fe.Down?I.bottom-I.height/2:I.bottom,Math.max(v===Fe.Down?I.top:I.top+I.height/2,i.y))},y=v===Fe.Right&&!M||v===Fe.Left&&!w,N=v===Fe.Down&&!T||v===Fe.Up&&!x;if(y&&k.x!==i.x){const D=m.scrollLeft+u.x,P=v===Fe.Right&&D<=A.x||v===Fe.Left&&D>=_.x;if(P&&!u.y){m.scrollTo({left:D,behavior:l});return}P?g.x=m.scrollLeft-D:g.x=v===Fe.Right?m.scrollLeft-A.x:m.scrollLeft-_.x,g.x&&m.scrollBy({left:-g.x,behavior:l});break}else if(N&&k.y!==i.y){const D=m.scrollTop+u.y,P=v===Fe.Down&&D<=A.y||v===Fe.Up&&D>=_.y;if(P&&!u.x){m.scrollTo({top:D,behavior:l});return}P?g.y=m.scrollTop-D:g.y=v===Fe.Down?m.scrollTop-A.y:m.scrollTop-_.y,g.y&&m.scrollBy({top:-g.y,behavior:l});break}}this.handleMove(t,Ur(an(i,this.referenceCoordinates),g))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ma.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Ai,onActivation:o}=t,{active:a}=r;const{code:s}=e.nativeEvent;if(n.start.includes(s)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Mi(e){return!!(e&&"distance"in e)}function Oi(e){return!!(e&&"delay"in e)}class ba{constructor(t,r,n){var o;n===void 0&&(n=dh(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:s}=a;this.props=t,this.events=r,this.document=$r(s),this.documentListeners=new ln(this.document),this.listeners=new ln(n),this.windowListeners=new ln(xt(s)),this.initialCoordinates=(o=ua(a))!=null?o:Vt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ft.Resize,this.handleCancel),this.windowListeners.add(Ft.DragStart,Ni),this.windowListeners.add(Ft.VisibilityChange,this.handleCancel),this.windowListeners.add(Ft.ContextMenu,Ni),this.documentListeners.add(Ft.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Oi(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Mi(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ft.Click,uh,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ft.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:l}}=a;if(!o)return;const f=(r=ua(t))!=null?r:Vt,h=an(o,f);if(!n&&l){if(Mi(l)){if(l.tolerance!=null&&pa(h,l.tolerance))return this.handleCancel();if(pa(h,l.distance))return this.handleStart()}if(Oi(l)&&pa(h,l.tolerance))return this.handleCancel();this.handlePending(l,h);return}t.cancelable&&t.preventDefault(),s(f)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Fe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const gh={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ya extends ba{constructor(t){const{event:r}=t,n=$r(r.target);super(t,gh,n)}}ya.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];const hh={move:{name:"mousemove"},end:{name:"mouseup"}};var va;(function(e){e[e.RightClick=2]="RightClick"})(va||(va={}));class ph extends ba{constructor(t){super(t,hh,$r(t.event.target))}}ph.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===va.RightClick?!1:(n?.({event:r}),!0)}}];const wa={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class mh extends ba{constructor(t){super(t,wa)}static setup(){return window.addEventListener(wa.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wa.move.name,t)};function t(){}}}mh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var cn;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(cn||(cn={}));var Kn;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Kn||(Kn={}));function bh(e){let{acceleration:t,activator:r=cn.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:l=Kn.TreeOrder,pointerCoordinates:f,scrollableAncestors:h,scrollableAncestorRects:c,delta:i,threshold:u}=e;const g=vh({delta:i,disabled:!a}),[p,m]=Ag(),v=C.useRef({x:0,y:0}),x=C.useRef({x:0,y:0}),M=C.useMemo(()=>{switch(r){case cn.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case cn.DraggableRect:return o}},[r,o,f]),w=C.useRef(null),T=C.useCallback(()=>{const _=w.current;if(!_)return;const I=v.current.x*x.current.x,k=v.current.y*x.current.y;_.scrollBy(I,k)},[]),A=C.useMemo(()=>l===Kn.TreeOrder?[...h].reverse():h,[l,h]);C.useEffect(()=>{if(!a||!h.length||!M){m();return}for(const _ of A){if(n?.(_)===!1)continue;const I=h.indexOf(_),k=c[I];if(!k)continue;const{direction:y,speed:N}=oh(_,k,M,t,u);for(const D of["x","y"])g[D][y[D]]||(N[D]=0,y[D]=0);if(N.x>0||N.y>0){m(),w.current=_,p(T,s),v.current=N,x.current=y;return}}v.current={x:0,y:0},x.current={x:0,y:0},m()},[t,T,n,m,a,s,JSON.stringify(M),JSON.stringify(g),p,h,A,c,JSON.stringify(u)])}const yh={x:{[lt.Backward]:!1,[lt.Forward]:!1},y:{[lt.Backward]:!1,[lt.Forward]:!1}};function vh(e){let{delta:t,disabled:r}=e;const n=ia(t);return nn(o=>{if(r||!n||!o)return yh;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[lt.Backward]:o.x[lt.Backward]||a.x===-1,[lt.Forward]:o.x[lt.Forward]||a.x===1},y:{[lt.Backward]:o.y[lt.Backward]||a.y===-1,[lt.Forward]:o.y[lt.Forward]||a.y===1}}},[r,t,n])}function wh(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return nn(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function xh(e,t){return C.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...r,...a]},[]),[e,t])}var dn;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(dn||(dn={}));var xa;(function(e){e.Optimized="optimized"})(xa||(xa={}));const Ii=new Map;function kh(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,s]=C.useState(null),{frequency:l,measure:f,strategy:h}=o,c=C.useRef(e),i=v(),u=rn(i),g=C.useCallback(function(x){x===void 0&&(x=[]),!u.current&&s(M=>M===null?x:M.concat(x.filter(w=>!M.includes(w))))},[u]),p=C.useRef(null),m=nn(x=>{if(i&&!r)return Ii;if(!x||x===Ii||c.current!==e||a!=null){const M=new Map;for(let w of e){if(!w)continue;if(a&&a.length>0&&!a.includes(w.id)&&w.rect.current){M.set(w.id,w.rect.current);continue}const T=w.node.current,A=T?new ha(f(T),T):null;w.rect.current=A,A&&M.set(w.id,A)}return M}return x},[e,a,r,i,f]);return C.useEffect(()=>{c.current=e},[e]),C.useEffect(()=>{i||g()},[r,i]),C.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),C.useEffect(()=>{i||typeof l!="number"||p.current!==null||(p.current=setTimeout(()=>{g(),p.current=null},l))},[l,i,g,...n]),{droppableRects:m,measureDroppableContainers:g,measuringScheduled:a!=null};function v(){switch(h){case dn.Always:return!1;case dn.BeforeDragging:return r;default:return!r}}}function Di(e,t){return nn(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function Ch(e,t){return Di(e,t)}function Sh(e){let{callback:t,disabled:r}=e;const n=la(t),o=C.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return C.useEffect(()=>()=>o?.disconnect(),[o]),o}function Vn(e){let{callback:t,disabled:r}=e;const n=la(t),o=C.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return C.useEffect(()=>()=>o?.disconnect(),[o]),o}function _h(e){return new ha(zr(e),e)}function Li(e,t,r){t===void 0&&(t=_h);const[n,o]=C.useState(null);function a(){o(f=>{if(!e)return null;if(e.isConnected===!1){var h;return(h=f??r)!=null?h:null}const c=t(e);return JSON.stringify(f)===JSON.stringify(c)?f:c})}const s=Sh({callback(f){if(e)for(const h of f){const{type:c,target:i}=h;if(c==="childList"&&i instanceof HTMLElement&&i.contains(e)){a();break}}}}),l=Vn({callback:a});return qt(()=>{a(),e?(l?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),s?.disconnect())},[e]),n}function Eh(e){const t=Di(e);return wi(e,t)}const Pi=[];function Th(e){const t=C.useRef(e),r=nn(n=>e?n&&n!==Pi&&e&&t.current&&e.parentNode===t.current.parentNode?n:Wn(e):Pi,[e]);return C.useEffect(()=>{t.current=e},[e]),r}function Nh(e){const[t,r]=C.useState(null),n=C.useRef(e),o=C.useCallback(a=>{const s=fa(a.target);s&&r(l=>l?(l.set(s,ga(s)),new Map(l)):null)},[]);return C.useEffect(()=>{const a=n.current;if(e!==a){s(a);const l=e.map(f=>{const h=fa(f);return h?(h.addEventListener("scroll",o,{passive:!0}),[h,ga(h)]):null}).filter(f=>f!=null);r(l.length?new Map(l):null),n.current=e}return()=>{s(e),s(a)};function s(l){l.forEach(f=>{const h=fa(f);h?.removeEventListener("scroll",o)})}},[o,e]),C.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>Ur(a,s),Vt):Ti(e):Vt,[e,t])}function Fi(e,t){t===void 0&&(t=[]);const r=C.useRef(null);return C.useEffect(()=>{r.current=null},t),C.useEffect(()=>{const n=e!==Vt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?an(e,r.current):Vt}function Ah(e){C.useEffect(()=>{if(!Gn)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function Mh(e,t){return C.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=s=>{a(s,t)},r},{}),[e,t])}function $i(e){return C.useMemo(()=>e?eh(e):null,[e])}const Ui=[];function Oh(e,t){t===void 0&&(t=zr);const[r]=e,n=$i(r?xt(r):null),[o,a]=C.useState(Ui);function s(){a(()=>e.length?e.map(f=>_i(f)?n:new ha(t(f),f)):Ui)}const l=Vn({callback:s});return qt(()=>{l?.disconnect(),s(),e.forEach(f=>l?.observe(f))},[e]),o}function Ih(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return tn(t)?t:e}function Dh(e){let{measure:t}=e;const[r,n]=C.useState(null),o=C.useCallback(h=>{for(const{target:c}of h)if(tn(c)){n(i=>{const u=t(c);return i?{...i,width:u.width,height:u.height}:u});break}},[t]),a=Vn({callback:o}),s=C.useCallback(h=>{const c=Ih(h);a?.disconnect(),c&&a?.observe(c),n(c?t(c):null)},[t,a]),[l,f]=jn(s);return C.useMemo(()=>({nodeRef:l,rect:r,setRef:f}),[r,l,f])}const Lh=[{sensor:ya,options:{}},{sensor:ma,options:{}}],Ph={current:{}},Yn={draggable:{measure:xi},droppable:{measure:xi,strategy:dn.WhileDragging,frequency:xa.Optimized},dragOverlay:{measure:zr}};class un extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const Fh={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new un,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Bn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Yn,measureDroppableContainers:Bn,windowRect:null,measuringScheduled:!1},$h={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Bn,draggableNodes:new Map,over:null,measureDroppableContainers:Bn},Xn=C.createContext($h),zi=C.createContext(Fh);function Uh(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new un}}}function zh(e,t){switch(t.type){case tt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case tt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case tt.DragEnd:case tt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case tt.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new un(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case tt.SetDroppableDisabled:{const{id:r,key:n,disabled:o}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const s=new un(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case tt.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new un(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Hh(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=C.useContext(Xn),a=ia(n),s=ia(r?.id);return C.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!da(a)||document.activeElement===a.target)return;const l=o.get(s);if(!l)return;const{activatorNode:f,node:h}=l;if(!f.current&&!h.current)return;requestAnimationFrame(()=>{for(const c of[f.current,h.current]){if(!c)continue;const i=Ig(c);if(i){i.focus();break}}})}},[n,t,o,s,a]),null}function Gh(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function jh(e){return C.useMemo(()=>({draggable:{...Yn.draggable,...e?.draggable},droppable:{...Yn.droppable,...e?.droppable},dragOverlay:{...Yn.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Bh(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=C.useRef(!1),{x:s,y:l}=typeof o=="boolean"?{x:o,y:o}:o;qt(()=>{if(!s&&!l||!t){a.current=!1;return}if(a.current||!n)return;const h=t?.node.current;if(!h||h.isConnected===!1)return;const c=r(h),i=wi(c,n);if(s||(i.x=0),l||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){const u=ki(h);u&&u.scrollBy({top:i.y,left:i.x})}},[t,s,l,n,r])}const Hi=C.createContext({...Vt,scaleX:1,scaleY:1});var nr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(nr||(nr={}));const Wh=C.memo(function(t){var r,n,o,a;let{id:s,accessibility:l,autoScroll:f=!0,children:h,sensors:c=Lh,collisionDetection:i=Yg,measuring:u,modifiers:g,...p}=t;const m=C.useReducer(zh,void 0,Uh),[v,x]=m,[M,w]=Ug(),[T,A]=C.useState(nr.Uninitialized),_=T===nr.Initialized,{draggable:{active:I,nodes:k,translate:y},droppable:{containers:N}}=v,D=I!=null?k.get(I):null,P=C.useRef({initial:null,translated:null}),O=C.useMemo(()=>{var Se;return I!=null?{id:I,data:(Se=D?.data)!=null?Se:Ph,rect:P}:null},[I,D]),L=C.useRef(null),[$,S]=C.useState(null),[b,z]=C.useState(null),U=rn(p,Object.values(p)),G=on("DndDescribedBy",s),Y=C.useMemo(()=>N.getEnabled(),[N]),B=jh(u),{droppableRects:V,measureDroppableContainers:j,measuringScheduled:H}=kh(Y,{dragging:_,dependencies:[y.x,y.y],config:B.droppable}),q=wh(k,I),ee=C.useMemo(()=>b?ua(b):null,[b]),ne=Ke(),ce=Ch(q,B.draggable.measure);Bh({activeNode:I!=null?k.get(I):null,config:ne.layoutShiftCompensation,initialRect:ce,measure:B.draggable.measure});const R=Li(q,B.draggable.measure,ce),_e=Li(q?q.parentElement:null),me=C.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:V,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Be=N.getNodeFor((r=me.current.over)==null?void 0:r.id),$e=Dh({measure:B.dragOverlay.measure}),ye=(n=$e.nodeRef.current)!=null?n:q,Ne=_?(o=$e.rect)!=null?o:R:null,we=!!($e.nodeRef.current&&$e.rect),ke=Eh(we?null:R),Ue=$i(ye?xt(ye):null),Oe=Th(_?Be??q:null),K=Oh(Oe),te=Gh(g,{transform:{x:y.x-ke.x,y:y.y-ke.y,scaleX:1,scaleY:1},activatorEvent:b,active:O,activeNodeRect:R,containerNodeRect:_e,draggingNodeRect:Ne,over:me.current.over,overlayNodeRect:$e.rect,scrollableAncestors:Oe,scrollableAncestorRects:K,windowRect:Ue}),oe=ee?Ur(ee,y):null,le=Nh(Oe),ve=Fi(le),Te=Fi(le,[R]),We=Ur(te,ve),Ae=Ne?qg(Ne,te):null,He=O&&Ae?i({active:O,collisionRect:Ae,droppableRects:V,droppableContainers:Y,pointerCoordinates:oe}):null,Ie=yi(He,"id"),[X,se]=C.useState(null),de=we?te:Ur(te,Te),ue=Xg(de,(a=X?.rect)!=null?a:null,R),ie=C.useRef(null),De=C.useCallback((Se,be)=>{let{sensor:Me,options:je}=be;if(L.current==null)return;const rt=k.get(L.current);if(!rt)return;const Ye=Se.nativeEvent,Pe=new Me({active:L.current,activeNode:rt,event:Ye,options:je,context:me,onAbort(nt){if(!k.get(nt))return;const{onDragAbort:Ct}=U.current,$t={id:nt};Ct?.($t),M({type:"onDragAbort",event:$t})},onPending(nt,Yt,Ct,$t){if(!k.get(nt))return;const{onDragPending:br}=U.current,Qe={id:nt,constraint:Yt,initialCoordinates:Ct,offset:$t};br?.(Qe),M({type:"onDragPending",event:Qe})},onStart(nt){const Yt=L.current;if(Yt==null)return;const Ct=k.get(Yt);if(!Ct)return;const{onDragStart:$t}=U.current,ar={activatorEvent:Ye,active:{id:Yt,data:Ct.data,rect:P}};Rt.unstable_batchedUpdates(()=>{$t?.(ar),A(nr.Initializing),x({type:tt.DragStart,initialCoordinates:nt,active:Yt}),M({type:"onDragStart",event:ar}),S(ie.current),z(Ye)})},onMove(nt){x({type:tt.DragMove,coordinates:nt})},onEnd:Mt(tt.DragEnd),onCancel:Mt(tt.DragCancel)});ie.current=Pe;function Mt(nt){return async function(){const{active:Ct,collisions:$t,over:ar,scrollAdjustedTranslate:br}=me.current;let Qe=null;if(Ct&&br){const{cancelDrop:Ot}=U.current;Qe={activatorEvent:Ye,active:Ct,collisions:$t,delta:br,over:ar},nt===tt.DragEnd&&typeof Ot=="function"&&await Promise.resolve(Ot(Qe))&&(nt=tt.DragCancel)}L.current=null,Rt.unstable_batchedUpdates(()=>{x({type:nt}),A(nr.Uninitialized),se(null),S(null),z(null),ie.current=null;const Ot=nt===tt.DragEnd?"onDragEnd":"onDragCancel";if(Qe){const Br=U.current[Ot];Br?.(Qe),M({type:Ot,event:Qe})}})}}},[k]),ge=C.useCallback((Se,be)=>(Me,je)=>{const rt=Me.nativeEvent,Ye=k.get(je);if(L.current!==null||!Ye||rt.dndKit||rt.defaultPrevented)return;const Pe={active:Ye};Se(Me,be.options,Pe)===!0&&(rt.dndKit={capturedBy:be.sensor},L.current=je,De(Me,be))},[k,De]),xe=xh(c,ge);Ah(c),qt(()=>{R&&T===nr.Initializing&&A(nr.Initialized)},[R,T]),C.useEffect(()=>{const{onDragMove:Se}=U.current,{active:be,activatorEvent:Me,collisions:je,over:rt}=me.current;if(!be||!Me)return;const Ye={active:be,activatorEvent:Me,collisions:je,delta:{x:We.x,y:We.y},over:rt};Rt.unstable_batchedUpdates(()=>{Se?.(Ye),M({type:"onDragMove",event:Ye})})},[We.x,We.y]),C.useEffect(()=>{const{active:Se,activatorEvent:be,collisions:Me,droppableContainers:je,scrollAdjustedTranslate:rt}=me.current;if(!Se||L.current==null||!be||!rt)return;const{onDragOver:Ye}=U.current,Pe=je.get(Ie),Mt=Pe&&Pe.rect.current?{id:Pe.id,rect:Pe.rect.current,data:Pe.data,disabled:Pe.disabled}:null,nt={active:Se,activatorEvent:be,collisions:Me,delta:{x:rt.x,y:rt.y},over:Mt};Rt.unstable_batchedUpdates(()=>{se(Mt),Ye?.(nt),M({type:"onDragOver",event:nt})})},[Ie]),qt(()=>{me.current={activatorEvent:b,active:O,activeNode:q,collisionRect:Ae,collisions:He,droppableRects:V,draggableNodes:k,draggingNode:ye,draggingNodeRect:Ne,droppableContainers:N,over:X,scrollableAncestors:Oe,scrollAdjustedTranslate:We},P.current={initial:Ne,translated:Ae}},[O,q,He,Ae,k,ye,Ne,V,N,X,Oe,We]),bh({...ne,delta:y,draggingRect:Ae,pointerCoordinates:oe,scrollableAncestors:Oe,scrollableAncestorRects:K});const Ce=C.useMemo(()=>({active:O,activeNode:q,activeNodeRect:R,activatorEvent:b,collisions:He,containerNodeRect:_e,dragOverlay:$e,draggableNodes:k,droppableContainers:N,droppableRects:V,over:X,measureDroppableContainers:j,scrollableAncestors:Oe,scrollableAncestorRects:K,measuringConfiguration:B,measuringScheduled:H,windowRect:Ue}),[O,q,R,b,He,_e,$e,k,N,V,X,j,Oe,K,B,H,Ue]),ze=C.useMemo(()=>({activatorEvent:b,activators:xe,active:O,activeNodeRect:R,ariaDescribedById:{draggable:G},dispatch:x,draggableNodes:k,over:X,measureDroppableContainers:j}),[b,xe,O,R,x,G,k,X,j]);return C.createElement(gi.Provider,{value:w},C.createElement(Xn.Provider,{value:ze},C.createElement(zi.Provider,{value:Ce},C.createElement(Hi.Provider,{value:ue},h)),C.createElement(Hh,{disabled:l?.restoreFocus===!1})),C.createElement(Gg,{...l,hiddenTextDescribedById:G}));function Ke(){const Se=$?.autoScrollEnabled===!1,be=typeof f=="object"?f.enabled===!1:f===!1,Me=_&&!Se&&!be;return typeof f=="object"?{...f,enabled:Me}:{enabled:Me}}}),Kh=C.createContext(null),Gi="button",Vh="Draggable";function Yh(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=on(Vh),{activators:s,activatorEvent:l,active:f,activeNodeRect:h,ariaDescribedById:c,draggableNodes:i,over:u}=C.useContext(Xn),{role:g=Gi,roleDescription:p="draggable",tabIndex:m=0}=o??{},v=f?.id===t,x=C.useContext(v?Hi:Kh),[M,w]=jn(),[T,A]=jn(),_=Mh(s,t),I=rn(r);qt(()=>(i.set(t,{id:t,key:a,node:M,activatorNode:T,data:I}),()=>{const y=i.get(t);y&&y.key===a&&i.delete(t)}),[i,t]);const k=C.useMemo(()=>({role:g,tabIndex:m,"aria-disabled":n,"aria-pressed":v&&g===Gi?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[n,g,m,v,p,c.draggable]);return{active:f,activatorEvent:l,activeNodeRect:h,attributes:k,isDragging:v,listeners:n?void 0:_,node:M,over:u,setNodeRef:w,setActivatorNodeRef:A,transform:x}}function Xh(){return C.useContext(zi)}const Zh="Droppable",qh={timeout:25};function Qh(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=on(Zh),{active:s,dispatch:l,over:f,measureDroppableContainers:h}=C.useContext(Xn),c=C.useRef({disabled:r}),i=C.useRef(!1),u=C.useRef(null),g=C.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:v}={...qh,...o},x=rn(m??n),M=C.useCallback(()=>{if(!i.current){i.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{h(Array.isArray(x.current)?x.current:[x.current]),g.current=null},v)},[v]),w=Vn({callback:M,disabled:p||!s}),T=C.useCallback((k,y)=>{w&&(y&&(w.unobserve(y),i.current=!1),k&&w.observe(k))},[w]),[A,_]=jn(T),I=rn(t);return C.useEffect(()=>{!w||!A.current||(w.disconnect(),i.current=!1,w.observe(A.current))},[A,w]),C.useEffect(()=>(l({type:tt.RegisterDroppable,element:{id:n,key:a,disabled:r,node:A,rect:u,data:I}}),()=>l({type:tt.UnregisterDroppable,key:a,id:n})),[n]),C.useEffect(()=>{r!==c.current.disabled&&(l({type:tt.SetDroppableDisabled,id:n,key:a,disabled:r}),c.current.disabled=r)},[n,a,r,l]),{active:s,rect:u,isOver:f?.id===n,node:A,over:f,setNodeRef:_}}function ka(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Jh(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function Zn(e){return e!==null&&e>=0}function Rh(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function e0(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const qn=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=ka(t,n,r),s=t[o],l=a[o];return!l||!s?null:{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}},ji="Sortable",Bi=C.createContext({activeIndex:-1,containerId:ji,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:qn,disabled:{draggable:!1,droppable:!1}});function Wi(e){let{children:t,id:r,items:n,strategy:o=qn,disabled:a=!1}=e;const{active:s,dragOverlay:l,droppableRects:f,over:h,measureDroppableContainers:c}=Xh(),i=on(ji,r),u=l.rect!==null,g=C.useMemo(()=>n.map(_=>typeof _=="object"&&"id"in _?_.id:_),[n]),p=s!=null,m=s?g.indexOf(s.id):-1,v=h?g.indexOf(h.id):-1,x=C.useRef(g),M=!Rh(g,x.current),w=v!==-1&&m===-1||M,T=e0(a);qt(()=>{M&&p&&c(g)},[M,g,p,c]),C.useEffect(()=>{x.current=g},[g]);const A=C.useMemo(()=>({activeIndex:m,containerId:i,disabled:T,disableTransforms:w,items:g,overIndex:v,useDragOverlay:u,sortedRects:Jh(g,f),strategy:o}),[m,i,T.draggable,T.droppable,w,g,v,f,u,o]);return C.createElement(Bi.Provider,{value:A},t)}const Ki=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return ka(r,n,o).indexOf(t)},Vi=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:s,previousItems:l,previousContainerId:f,transition:h}=e;return!h||!n||l!==a&&o===s?!1:r?!0:s!==o&&t===f},t0={duration:200,easing:"ease"},Yi="transform",r0=sn.Transition.toString({property:Yi,duration:0,easing:"linear"}),n0={roleDescription:"sortable"};function o0(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=C.useState(null),l=C.useRef(r);return qt(()=>{if(!t&&r!==l.current&&n.current){const f=o.current;if(f){const h=zr(n.current,{ignoreTransform:!0}),c={x:f.left-h.left,y:f.top-h.top,scaleX:f.width/h.width,scaleY:f.height/h.height};(c.x||c.y)&&s(c)}}r!==l.current&&(l.current=r)},[t,r,n,o]),C.useEffect(()=>{a&&s(null)},[a]),a}function Xi(e){let{animateLayoutChanges:t=Vi,attributes:r,disabled:n,data:o,getNewIndex:a=Ki,id:s,strategy:l,resizeObserverConfig:f,transition:h=t0}=e;const{items:c,containerId:i,activeIndex:u,disabled:g,disableTransforms:p,sortedRects:m,overIndex:v,useDragOverlay:x,strategy:M}=C.useContext(Bi),w=a0(n,g),T=c.indexOf(s),A=C.useMemo(()=>({sortable:{containerId:i,index:T,items:c},...o}),[i,o,T,c]),_=C.useMemo(()=>c.slice(c.indexOf(s)),[c,s]),{rect:I,node:k,isOver:y,setNodeRef:N}=Qh({id:s,data:A,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...f}}),{active:D,activatorEvent:P,activeNodeRect:O,attributes:L,setNodeRef:$,listeners:S,isDragging:b,over:z,setActivatorNodeRef:U,transform:G}=Yh({id:s,data:A,attributes:{...n0,...r},disabled:w.draggable}),Y=Ng(N,$),B=!!D,V=B&&!p&&Zn(u)&&Zn(v),j=!x&&b,H=j&&V?G:null,ee=V?H??(l??M)({rects:m,activeNodeRect:O,activeIndex:u,overIndex:v,index:T}):null,ne=Zn(u)&&Zn(v)?a({id:s,items:c,activeIndex:u,overIndex:v}):T,ce=D?.id,R=C.useRef({activeId:ce,items:c,newIndex:ne,containerId:i}),_e=c!==R.current.items,me=t({active:D,containerId:i,isDragging:b,isSorting:B,id:s,index:T,items:c,newIndex:R.current.newIndex,previousItems:R.current.items,previousContainerId:R.current.containerId,transition:h,wasDragging:R.current.activeId!=null}),Be=o0({disabled:!me,index:T,node:k,rect:I});return C.useEffect(()=>{B&&R.current.newIndex!==ne&&(R.current.newIndex=ne),i!==R.current.containerId&&(R.current.containerId=i),c!==R.current.items&&(R.current.items=c)},[B,ne,i,c]),C.useEffect(()=>{if(ce===R.current.activeId)return;if(ce!=null&&R.current.activeId==null){R.current.activeId=ce;return}const ye=setTimeout(()=>{R.current.activeId=ce},50);return()=>clearTimeout(ye)},[ce]),{active:D,activeIndex:u,attributes:L,data:A,rect:I,index:T,newIndex:ne,items:c,isOver:y,isSorting:B,isDragging:b,listeners:S,node:k,overIndex:v,over:z,setNodeRef:Y,setActivatorNodeRef:U,setDroppableNodeRef:N,setDraggableNodeRef:$,transform:Be??ee,transition:$e()};function $e(){if(Be||_e&&R.current.newIndex===T)return r0;if(!(j&&!da(P)||!h)&&(B||me))return sn.Transition.toString({...h,property:Yi})}}function a0(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function fn(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const s0=[Fe.Down,Fe.Right,Fe.Up,Fe.Left],Zi=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:l}}=t;if(s0.includes(e.code)){if(e.preventDefault(),!r||!n)return;const f=[];a.getEnabled().forEach(i=>{if(!i||i!=null&&i.disabled)return;const u=o.get(i.id);if(u)switch(e.code){case Fe.Down:n.top<u.top&&f.push(i);break;case Fe.Up:n.top>u.top&&f.push(i);break;case Fe.Left:n.left>u.left&&f.push(i);break;case Fe.Right:n.left<u.left&&f.push(i);break}});const h=Kg({collisionRect:n,droppableRects:o,droppableContainers:f});let c=yi(h,"id");if(c===s?.id&&h.length>1&&(c=h[1].id),c!=null){const i=a.get(r.id),u=a.get(c),g=u?o.get(u.id):null,p=u?.node.current;if(p&&g&&i&&u){const v=Wn(p).some((_,I)=>l[I]!==_),x=qi(i,u),M=l0(i,u),w=v||!x?{x:0,y:0}:{x:M?n.width-g.width:0,y:M?n.height-g.height:0},T={x:g.left,y:g.top};return w.x&&w.y?T:an(T,w)}}}};function qi(e,t){return!fn(e)||!fn(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function l0(e,t){return!fn(e)||!fn(t)||!qi(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const i0=Object.freeze(Object.defineProperty({__proto__:null,SortableContext:Wi,arrayMove:ka,defaultAnimateLayoutChanges:Vi,defaultNewIndexGetter:Ki,hasSortableData:fn,rectSortingStrategy:qn,sortableKeyboardCoordinates:Zi,useSortable:Xi},Symbol.toStringTag,{value:"Module"})),c0=window.G7Core,Qi=({file:e,onRemove:t,onRetry:r,onImageClick:n,onDownload:o,isPrimary:a,onPrimaryClick:s})=>{const{attributes:l,listeners:f,setNodeRef:h,transform:c,transition:i,isDragging:u}=Xi({id:"hash"in e?e.hash:e.id}),g={transform:sn.Transform.toString(c),transition:i,opacity:u?.5:1},p="status"in e&&e.status!==void 0,m=p?e.status:"done",v=m==="uploading",x=m==="compressing",M=m==="error",w=p?e.progress:100,T=p?e.preview:void 0,A=p?e.mime_type?.startsWith("image/")??!1:e.is_image,[_,I]=C.useState(void 0),k=!p&&A?e.download_url:void 0;C.useEffect(()=>{if(!k){I(void 0);return}let N=!0,D;return(async()=>{try{const O=await c0.api.get(k,{responseType:"blob"});N&&O&&(D=URL.createObjectURL(O),I(D))}catch(O){console.error("Failed to load authenticated image:",O)}})(),()=>{N=!1,D&&URL.revokeObjectURL(D)}},[k]);const y=_;return d.jsxs(W,{ref:h,style:g,className:"relative group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs(W,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${A||!p?"cursor-pointer":""}`,onClick:()=>{v||x||(A&&n?n():!p&&o&&o())},children:[T||y?d.jsx(Ht,{src:T||y,alt:e.original_filename,className:"w-full h-full object-cover"}):d.jsx(Nt,{className:`fa-solid ${li(e.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(v||x)&&d.jsxs(W,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[d.jsx(W,{className:"w-3/4 h-2 bg-gray-700 rounded-full overflow-hidden",children:d.jsx(W,{className:"h-full bg-blue-500 transition-all",style:{width:`${w}%`}})}),d.jsxs(re,{className:"text-white text-xs mt-1",children:[w,"%"]})]}),M&&d.jsx(W,{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:d.jsx(Nt,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),s&&d.jsx(Q,{type:"button",onClick:N=>{N.stopPropagation(),s()},className:`absolute top-1.5 left-1.5 z-10 p-1 rounded-full transition-colors ${a?"bg-yellow-500 text-white":"bg-gray-800/50 text-gray-300 hover:bg-yellow-500 hover:text-white opacity-0 group-hover:opacity-100"}`,title:et(a?"attachment.primary_image":"attachment.set_as_primary"),children:d.jsx(Nt,{className:"fa-solid fa-star text-xs"})}),d.jsxs(W,{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex items-start justify-end p-1 gap-1 opacity-0 group-hover:opacity-100",children:[d.jsx(Q,{type:"button",...l,...f,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-gray-600 dark:text-gray-300 hover:bg-white cursor-grab active:cursor-grabbing",title:et("attachment.drag_to_reorder"),onClick:N=>N.stopPropagation(),children:d.jsx(Nt,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&o&&d.jsx(Q,{type:"button",onClick:N=>{N.stopPropagation(),o()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:et("common.download"),children:d.jsx(Nt,{className:"fa-solid fa-download text-sm"})}),M&&r&&d.jsx(Q,{type:"button",onClick:N=>{N.stopPropagation(),r()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:et("common.retry"),children:d.jsx(Nt,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),d.jsx(Q,{type:"button",onClick:N=>{N.stopPropagation(),t()},disabled:v||x,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:et("common.delete"),children:d.jsx(Nt,{className:"fa-solid fa-times text-sm"})})]})]}),d.jsxs(W,{className:`p-2 ${!p&&o?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&o&&o()},children:[d.jsx(zt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:e.original_filename,children:e.original_filename}),d.jsx(zt,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.size_formatted})]})]})},Ji=({allItems:e,canAddMore:t,totalCount:r,maxFiles:n,maxSize:o,accept:a,onRemove:s,onRetry:l,onImageClick:f,onDownload:h,onDragEnd:c,onAddClick:i,enablePrimarySelection:u,primaryFileId:g,onPrimaryChange:p})=>{const m=jg(hi(ya,{activationConstraint:{distance:8}}),hi(ma,{coordinateGetter:Zi}));return d.jsxs(W,{className:"p-3",children:[d.jsx(Wh,{sensors:m,collisionDetection:Wg,onDragEnd:c,children:d.jsx(Wi,{items:e.map(v=>"hash"in v?v.hash:v.id),strategy:qn,children:d.jsxs(W,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[e.map(v=>{const x="hash"in v,M=x?v.is_image:v.mime_type?.startsWith("image/")??!1;return d.jsx(Qi,{file:v,onRemove:()=>s(v),onRetry:"status"in v&&v.status==="error"?()=>l(v):void 0,onImageClick:M?()=>f(v):void 0,onDownload:x?()=>h(v):void 0,isPrimary:u&&x&&(v.hash||v.id)===g,onPrimaryClick:u&&x?()=>p?.(v.hash||v.id):void 0},x?v.hash:v.id)}),t&&d.jsxs(W,{className:"aspect-square flex flex-col items-center justify-center border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:border-gray-400 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:i,children:[d.jsx(Nt,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),d.jsx(re,{className:"text-xs text-gray-500 dark:text-gray-400",children:et("common.add")})]})]})})}),d.jsxs(W,{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center text-xs text-gray-500 dark:text-gray-400",children:[d.jsx(re,{children:et("attachment.attached_count",{count:r,max:n})}),d.jsxs(re,{children:[et("attachment.max_size",{size:o}),a&&` (${a})`]})]})]})},d0=[],u0=[],Qn=C.forwardRef(({uploadTriggerEvent:e,attachmentableType:t,attachmentableId:r,collection:n="default",maxFiles:o=10,maxSize:a=10,maxConcurrentUploads:s=3,accept:l,imageCompression:f,roleIds:h=u0,autoUpload:c=!0,onFilesChange:i,onChange:u,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:v,initialFiles:x=d0,className:M="",confirmBeforeRemove:w=!1,confirmRemoveTitle:T,confirmRemoveMessage:A,apiEndpoints:_,uploadParams:I,enablePrimarySelection:k=!1,primaryFileId:y,onPrimaryChange:N,id:D,editorAttrs:P},O)=>{const L={upload:_?.upload??"/api/attachments",delete:_?.delete??"/api/attachments/:id",reorder:_?.reorder??"/api/attachments/reorder"},$=C.useRef(u??i);$.current=u??i;const S=C.useCallback(G=>{const Y=$.current;if(!Y)return;Y({target:{value:G,files:G},preventDefault:()=>{},stopPropagation:()=>{}})},[]),b=ii({attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:h,autoUpload:c,initialFiles:x,endpoints:L,onFilesChange:S,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:v,uploadTriggerEvent:e,confirmBeforeRemove:w,uploadParams:I});C.useImperativeHandle(O,()=>({uploadAll:b.handleUploadAll,clear:b.clear,getPendingFiles:b.getPendingFiles}));const z=C.useMemo(()=>b.imageFiles.map(G=>{const Y=!("hash"in G),B=G,V=G;return Y?{src:B.preview||"",filename:B.original_filename,title:B.original_filename,downloadRequiresAuth:!1}:{src:b.authenticatedImageUrls.get(V.id)||V.download_url,downloadUrl:V.download_url,filename:V.original_filename,title:V.original_filename,downloadRequiresAuth:!0}}),[b.imageFiles,b.authenticatedImageUrls]),U=C.useMemo(()=>({existingFiles:b.existingFiles,pendingFiles:b.pendingFiles,isDragOver:b.isDragOver,isDeleting:b.isDeleting,maxFiles:o,maxSize:a,accept:l,endpoints:L,confirmBeforeRemove:w,totalCount:b.totalCount,hasFiles:b.hasFiles,canAddMore:b.canAddMore,allItems:b.allItems,imageFiles:b.imageFiles,handleFiles:b.handleFiles,handleRemove:b.handleRemove,handleRetry:b.handleRetry,handleUploadAll:b.handleUploadAll,handleOpenGallery:b.handleOpenGallery,handleDownload:b.handleDownload,handleDragEnd:b.handleDragEnd,setIsDragOver:b.setIsDragOver,inputRef:b.inputRef,galleryOpen:b.galleryOpen,setGalleryOpen:b.setGalleryOpen,galleryStartIndex:b.galleryStartIndex,galleryKeyRef:b.galleryKeyRef,confirmDialogOpen:b.confirmDialogOpen,setConfirmDialogOpen:b.setConfirmDialogOpen,itemToDelete:b.itemToDelete,executeRemoveAttachment:b.executeRemoveAttachment,authenticatedImageUrls:b.authenticatedImageUrls}),[b,o,a,l,L,w]);return d.jsx(Yl,{value:U,children:d.jsxs(W,{id:D,className:M,...P,children:[d.jsx(ci,{isDragOver:b.isDragOver,canAddMore:b.canAddMore,onFiles:b.handleFiles,setIsDragOver:b.setIsDragOver,inputRef:b.inputRef,accept:l,maxFiles:o,maxSize:a,children:b.hasFiles&&d.jsx(Ji,{allItems:b.allItems,canAddMore:b.canAddMore,totalCount:b.totalCount,maxFiles:o,maxSize:a,accept:l,onRemove:b.handleRemove,onRetry:b.handleRetry,onImageClick:b.handleOpenGallery,onDownload:b.handleDownload,onDragEnd:b.handleDragEnd,onAddClick:()=>b.inputRef.current?.click(),enablePrimarySelection:k,primaryFileId:y,onPrimaryChange:N})}),w&&d.jsx(ta,{isOpen:b.confirmDialogOpen,onClose:()=>{b.isDeleting||b.setConfirmDialogOpen(!1)},title:T??et("attachment.delete_confirm_title"),message:A??et("attachment.delete_confirm_message"),confirmText:et("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{b.itemToDelete&&b.executeRemoveAttachment(b.itemToDelete)},isLoading:b.isDeleting,loadingText:et("attachment.deleting")}),z.length>0&&b.galleryOpen&&d.jsx(Lr,{images:z,isOpen:!0,onClose:()=>b.setGalleryOpen(!1),startIndex:b.galleryStartIndex,showDownload:!0},`gallery-${b.galleryKeyRef.current}`)]})})});Qn.displayName="FileUploader";const f0=Object.freeze(Object.defineProperty({__proto__:null,FileDropZone:ci,FileList:Ji,FileUploader:Qn,FileUploaderProvider:Yl,SortableThumbnailItem:Qi,default:Qn,extractErrorMessage:si,fileUploaderT:et,formatFileSize:Hn,getFileIcon:li,useFileUploader:ii,useFileUploaderContext:yg},Symbol.toStringTag,{value:"Module"})),Ri=({provider:e,className:t="w-5 h-5"})=>{switch(e){case"google":return d.jsxs("svg",{className:t,viewBox:"0 0 24 24",children:[d.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),d.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),d.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),d.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]});case"naver":return d.jsx("svg",{className:t,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"currentColor",d:"M16.273 12.845L7.376 0H0v24h7.727V11.155L16.624 24H24V0h-7.727z"})});case"kakao":return d.jsx("svg",{className:t,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"currentColor",d:"M12 3c5.799 0 10.5 3.664 10.5 8.185 0 4.52-4.701 8.184-10.5 8.184a13.5 13.5 0 0 1-1.727-.11l-4.408 2.883c-.501.265-.678.236-.472-.413l.892-3.678c-2.88-1.46-4.785-3.99-4.785-6.866C1.5 6.665 6.201 3 12 3zm5.519 8.625h-.634v2.916h-.97v-2.916h-.633v-.848h2.237v.848zm-3.294 2.916h-.97V10.77h.97v3.771zm-1.97 0h-.97v-2.77l-.658 1.53h-.629l-.665-1.53v2.77h-.97V10.77h1.13l.822 1.912.814-1.912h1.126v3.771zm-4.49 0h-.97V10.77h.97v3.771z"})});case"facebook":return d.jsx("svg",{className:t,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"currentColor",d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})});case"apple":return d.jsx("svg",{className:t,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"currentColor",d:"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"})});default:return null}},ec=(e,t)=>window.G7Core?.t?.(e,t)??e,g0=[{id:"google",name:"Google",color:"bg-white dark:bg-gray-800",textColor:"text-gray-700 dark:text-gray-300"},{id:"naver",name:"네이버",color:"bg-[#03C75A]",textColor:"text-white"},{id:"kakao",name:"카카오",color:"bg-[#FEE500]",textColor:"text-[#000000]/85"},{id:"facebook",name:"Facebook",color:"bg-[#1877F2]",textColor:"text-white"},{id:"apple",name:"Apple",color:"bg-black dark:bg-white",textColor:"text-white dark:text-black"}],tc=({providers:e=["google","naver","kakao"],mode:t="login",variant:r="full",className:n="",id:o,editorAttrs:a})=>{const s=h=>{const c=encodeURIComponent(window.location.href);window.location.href=`/api/auth/${h}?redirect=${c}`},l=h=>t==="register"?ec("auth.social.register_with",{provider:h}):ec("auth.social.login_with",{provider:h}),f=g0.filter(h=>e.includes(h.id));return r==="icon"?d.jsx(W,{className:`flex justify-center gap-4 ${n}`,id:o,...a,children:f.map(h=>d.jsx(Q,{onClick:()=>s(h.id),className:`w-12 h-12 flex items-center justify-center rounded-full ${h.color} ${h.textColor} border border-gray-200 dark:border-gray-700 hover:opacity-90 transition-opacity`,"aria-label":l(h.name),children:d.jsx(Ri,{provider:h.id,className:"w-5 h-5"})},h.id))}):d.jsx(W,{className:`space-y-3 ${n}`,id:o,...a,children:f.map(h=>d.jsxs(Q,{onClick:()=>s(h.id),className:`w-full flex items-center justify-center gap-3 px-4 py-3 rounded-lg font-medium border border-gray-200 dark:border-gray-700 ${h.color} ${h.textColor} hover:opacity-90 transition-opacity`,children:[d.jsx(Ri,{provider:h.id,className:"w-5 h-5"}),d.jsx(re,{children:l(h.name)})]},h.id))})},h0=Object.freeze(Object.defineProperty({__proto__:null,default:tc},Symbol.toStringTag,{value:"Module"})),p0=(e,t)=>window.G7Core?.t?.(e,t)??e,m0={success:Re.CheckCircle,error:Re.XCircle,warning:Re.ExclamationTriangle,info:Re.InfoCircle},rc={success:{bg:"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800",text:"text-green-800 dark:text-green-300"},error:{bg:"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800",text:"text-red-800 dark:text-red-300"},warning:{bg:"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800",text:"text-yellow-800 dark:text-yellow-300"},info:{bg:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",text:"text-blue-800 dark:text-blue-300"}},b0={"top-left":"top-4 left-4","top-center":"top-4 left-1/2 -translate-x-1/2","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-center":"bottom-4 left-1/2 -translate-x-1/2","bottom-right":"bottom-4 right-4"},Ca=({toasts:e,position:t="bottom-center",duration:r=3e3,onRemove:n})=>{const[o,a]=C.useState(new Map),s=C.useCallback(l=>{a(f=>{const h=new Map(f);return h.set(l,!1),h}),setTimeout(()=>{if(n)n(l);else{const f=window.G7Core;f?.state?.update&&f.state.update(h=>({toasts:(Array.isArray(h.toasts)?h.toasts:[]).filter(i=>i.id!==l)}))}},300)},[n]);return C.useEffect(()=>{!e||e.length===0||e.forEach(l=>{if(o.has(l.id))return;a(h=>{const c=new Map(h);return c.set(l.id,!0),c});const f=l.duration||r;f>0&&setTimeout(()=>{s(l.id)},f)})},[e,r,s,o]),!e||e.length===0?null:d.jsx(W,{className:`fixed z-[9999] flex flex-col gap-2 ${b0[t]}`,"aria-live":"polite","aria-atomic":"true",children:e.map(l=>d.jsx(y0,{toast:l,position:t,isVisible:o.get(l.id)??!0,onClose:()=>s(l.id)},l.id))})},y0=({toast:e,position:t,isVisible:r,onClose:n})=>{const o=rc[e.type]||rc.info,a=e.icon?e.icon:m0[e.type],s=t.startsWith("bottom")?"translate-y-2":"-translate-y-2";return d.jsxs(W,{className:`
flex items-center gap-3 p-4 rounded-lg border shadow-lg
min-w-[300px] max-w-md
transition-all duration-300
${o.bg}
${r?"opacity-100 translate-y-0":`opacity-0 ${s}`}
`,role:"alert",children:[d.jsx(fe,{name:a,className:`w-5 h-5 flex-shrink-0 ${o.text}`}),d.jsx(re,{className:`flex-1 text-sm font-medium ${o.text}`,children:e.message}),d.jsx(Q,{onClick:n,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${o.text} focus:outline-none`,"aria-label":p0("common.close"),children:d.jsx(fe,{name:Re.Times,className:"w-4 h-4"})})]})},v0=Object.freeze(Object.defineProperty({__proto__:null,Toast:Ca,default:Ca},Symbol.toStringTag,{value:"Module"})),w0=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...e)=>console.log("[Comp:PageTransition]",...e),warn:(...e)=>console.warn("[Comp:PageTransition]",...e),error:(...e)=>console.error("[Comp:PageTransition]",...e)},Sa=({className:e="",style:t})=>{const[r,n]=C.useState(!1);return C.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){w0.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{n(s)})},[]),r?d.jsxs(W,{className:`fixed top-0 left-0 right-0 z-50 ${e}`,style:t,role:"progressbar","aria-label":"페이지 로딩 중",children:[d.jsx(W,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:d.jsx(W,{className:"h-full bg-blue-700 animate-[loading_1.5s_ease-in-out_infinite]",style:{width:"30%",animation:"loading 1.5s ease-in-out infinite"}})}),d.jsx("style",{children:`
@keyframes loading {
0% {
transform: translateX(-100%);
}
50% {
transform: translateX(300%);
}
100% {
transform: translateX(-100%);
}
}
`})]}):null},x0=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionIndicator:Sa,default:Sa},Symbol.toStringTag,{value:"Module"})),nc=window.G7Core?.createLogger?.("Comp:PageTransitionBlur")??{log:(...e)=>console.log("[Comp:PageTransitionBlur]",...e),warn:(...e)=>console.warn("[Comp:PageTransitionBlur]",...e)},_a=({className:e="",style:t})=>{const[r,n]=C.useState(!1);return C.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){nc.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{nc.log("isPending changed:",s),n(s)})},[]),r?d.jsx(W,{className:`fixed inset-0 z-40 bg-white/30 dark:bg-gray-900/30 backdrop-blur-sm transition-opacity duration-150 pointer-events-none ${e}`,style:t,role:"status","aria-label":"페이지 전환 중","data-testid":"page-transition-blur"}):null},k0=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionBlur:_a,default:_a},Symbol.toStringTag,{value:"Module"})),oc={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},ac=new Set(["hidden","block","inline-block","inline","flex","inline-flex","grid","inline-grid","table","table-row","table-cell","contents","list-item","flow-root"]),C0=new Set(["Div","Flex","Grid","Section","Article","Nav","Aside","Main","Header","Footer","Fragment","Form","Container"]),S0=new Set(["H1","H2","H3","H4","H5","H6","P","Span","Label","A","Strong","Em","Small","Badge"]),_0=new Set(["Input","Textarea","Select","Checkbox","Radio","Toggle","DatePicker","TagInput","SearchBar"]),E0=new Set(["Img","Image","Avatar","AvatarUploader","ImageGallery","ProductImageViewer","FileUploader"]),sc={DataGrid:(e,t)=>d.jsxs("div",{className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsx("div",{className:`h-10 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 ${e}`,children:d.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[d.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"}),d.jsx("div",{className:"h-3 w-24 bg-gray-300 dark:bg-gray-600 rounded"}),d.jsx("div",{className:"h-3 w-20 bg-gray-300 dark:bg-gray-600 rounded"}),d.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"})]})}),Array.from({length:t},(r,n)=>d.jsx("div",{className:`h-12 border-b border-gray-100 dark:border-gray-800 ${e}`,style:{animationDelay:`${n*75}ms`},children:d.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[d.jsx("div",{className:"h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded"}),d.jsx("div",{className:"h-3 flex-1 bg-gray-200 dark:bg-gray-700 rounded"}),d.jsx("div",{className:"h-3 w-16 bg-gray-100 dark:bg-gray-800 rounded"}),d.jsx("div",{className:"h-3 w-14 bg-gray-100 dark:bg-gray-800 rounded"})]})},n))]}),Pagination:e=>d.jsx("div",{className:"flex justify-center gap-1.5 py-3",children:Array.from({length:5},(t,r)=>d.jsx("div",{className:`w-8 h-8 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),Tabs:e=>d.jsxs("div",{children:[d.jsx("div",{className:"flex gap-4 border-b border-gray-200 dark:border-gray-700 pb-2 mb-3",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),d.jsx("div",{className:`h-32 bg-gray-100 dark:bg-gray-800 rounded ${e}`})]}),TabNavigation:e=>d.jsx("div",{className:"flex gap-4 border-b border-gray-200 dark:border-gray-700 pb-2",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),ProductCard:e=>d.jsxs("div",{className:"rounded-lg overflow-hidden",children:[d.jsx("div",{className:`h-48 w-full bg-gray-200 dark:bg-gray-700 ${e}`}),d.jsxs("div",{className:"p-3 space-y-2",children:[d.jsx("div",{className:`h-3.5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),d.jsx("div",{className:`h-4 w-1/3 bg-gray-300 dark:bg-gray-600 rounded ${e}`})]})]}),UserInfo:e=>d.jsx("div",{className:`h-3 w-14 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),QuantitySelector:e=>d.jsx("div",{className:`h-9 w-28 bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 ${e}`}),Header:e=>d.jsx("header",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs("div",{className:"flex items-center justify-between h-16",children:[d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("div",{className:`h-8 w-24 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),d.jsx("div",{className:"hidden lg:flex items-center gap-6",children:Array.from({length:4},(t,r)=>d.jsx("div",{className:`h-3.5 w-16 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))})]}),d.jsx("div",{className:"flex items-center gap-4",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-8 w-8 bg-gray-200 dark:bg-gray-700 rounded-full ${e}`},r))})]})})}),Footer:e=>d.jsx("footer",{className:"bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 mt-auto",children:d.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:d.jsxs("div",{className:"flex flex-col items-center gap-4",children:[d.jsx("div",{className:`h-4 w-32 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),d.jsx("div",{className:`h-3 w-48 bg-gray-100 dark:bg-gray-800 rounded ${e}`}),d.jsx("div",{className:"flex gap-3",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-6 w-6 bg-gray-200 dark:bg-gray-700 rounded-full ${e}`},r))}),d.jsx("div",{className:`h-3 w-40 bg-gray-100 dark:bg-gray-800 rounded ${e}`})]})})}),Modal:()=>d.jsx(d.Fragment,{}),Toast:()=>d.jsx(d.Fragment,{}),ConfirmDialog:()=>d.jsx(d.Fragment,{})};function T0(e){if(!e||e.length===0)return[];const t=e.filter(n=>n.if),r=e.filter(n=>!n.if);if(r.length>0&&t.length>0){const n=t.filter(o=>!lc(o.if));return n.length>1&&N0(n)?[...r,ic(n)]:[...r,...n]}if(t.length>1&&r.length===0){const n=t.filter(o=>!lc(o.if));return n.length===0?[]:n.length===1?n:[ic(n)]}return e}function lc(e){const t=e.replace(/^\{\{|\}\}$/g,"").trim();return t.startsWith("!")||/\b(hasError|isError|isLoading|error|Error)\b/.test(t)||/===\s*0\s*(\)|\}|$)/.test(t)}function N0(e){if(e.length<2)return!1;const t=[];for(const n of e){const o=(n.if||"").replace(/^\{\{|\}\}$/g,"").trim(),a=o.match(/^(.+?)\s*===\s*['"]/);if(a)t.push(a[1].trim());else{const s=o.match(/(.+?)\s*===\s*['"]/);if(!s)return!1;t.push(s[1].trim())}}const r=t[0];return t.every(n=>n===r)}function ic(e){return e.reduce((t,r)=>Ea(r)>Ea(t)?r:t)}function Ea(e){return e.children?e.children.length+e.children.reduce((t,r)=>t+Ea(r),0):0}function A0(e){return e.includes("{{")?e.replace(/\{\{([^}]+)\}\}/g,(t,r)=>{const n=r.match(/\?[\s]*['"]([^'"]*)['"]\s*:\s*['"]/);return n?n[1]:""}):e}function Ta(e,t){if(!e)return"";let r=e;return r=r.replace(/\b(bg-\S+|text-\S+|border\b|border-\S+|shadow\S*|ring-\S+|outline-\S+|divide-\S+|opacity-\S+|font-\S+|tracking-\S+|leading-\S+|whitespace-\S+|truncate|line-clamp-\S+|underline|no-underline|decoration-\S+|cursor-\S+|hover:\S+|focus:\S+|active:\S+|group-hover:\S+|transition\S*|duration-\S+|ease-\S+|animate-\S+|dark:\S+)\b/g,"").replace(/\s{2,}/g," ").trim(),(t==="Grid"||/\bgrid-cols-\d/.test(r))&&(r=r.replace(/\bgrid-cols-(\d+)/g,(n,o)=>{const a=parseInt(o);return a>4?`grid-cols-${Math.ceil(a/2)}`:`grid-cols-${a}`})),r}function M0(e){const{name:t,props:r}=e;if(!r||!t)return"";const n=[];if(t==="Flex"){n.push("flex");const o=r.direction||"row",a={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};a[o]&&n.push(a[o]);const s=r.justify||"start",l={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};l[s]&&n.push(l[s]);const f=r.align||"stretch",h={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};h[f]&&n.push(h[f]);const c=r.wrap||"nowrap",i={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};i[c]&&n.push(i[c]),r.gap&&r.gap>0&&n.push(`gap-${r.gap}`)}if(t==="Grid"){n.push("grid");const o=r.cols||1;if(n.push(`grid-cols-${o}`),r.responsive){const a=r.responsive;a.sm&&n.push(`sm:grid-cols-${a.sm}`),a.md&&n.push(`md:grid-cols-${a.md}`),a.lg&&n.push(`lg:grid-cols-${a.lg}`),a.xl&&n.push(`xl:grid-cols-${a.xl}`),a["2xl"]&&n.push(`2xl:grid-cols-${a["2xl"]}`)}r.gap!==void 0&&r.gap>0&&n.push(`gap-${r.gap}`),r.rowGap!==void 0&&r.rowGap>0&&n.push(`gap-y-${r.rowGap}`),r.colGap!==void 0&&r.colGap>0&&n.push(`gap-x-${r.colGap}`)}return n.join(" ")}function O0(e){switch(e){case"pulse":return"animate-pulse";case"wave":return"animate-pulse";case"none":return"";default:return"animate-pulse"}}function Jn(e,t,r,n){return!e||e.length===0?[]:T0(e).map((a,s)=>cc(a,t,r,s,n))}function I0(e,t){const r=e.props?.className||e.className||"";return e.responsive?t>=1024&&e.responsive.desktop?.props?.className?e.responsive.desktop.props.className:t>=768&&e.responsive.tablet?.props?.className?e.responsive.tablet.props.className:r:r}function D0(e,t){const r=e.split(/\s+/).filter(Boolean),n=[],o=[];for(const f of r){const h=f.match(/^(sm|md|lg|xl|2xl):(.+)$/);if(h){const[,c,i]=h;if(ac.has(i)){n.push({breakpoint:oc[c]||0,display:i});continue}(oc[c]||0)<=t&&o.push(i);continue}if(ac.has(f)){n.push({breakpoint:0,display:f});continue}o.push(f)}if(n.length===0)return{visible:!0,className:e};n.sort((f,h)=>f.breakpoint-h.breakpoint);let a="";for(const f of n)f.breakpoint<=t&&(a=f.display);a||(a=n[0].display);const s=a!=="hidden",l=s?[a,...o].join(" "):"";return{visible:s,className:l}}function L0(e){const t=e.match(/\bgrid-cols-\[([^\]]+)\]/);if(!t)return{className:e};const r=t[1].replace(/_/g," ");return{className:e.replace(/\bgrid-cols-\[([^\]]+)\]/,"").replace(/\s{2,}/g," ").trim(),style:{gridTemplateColumns:r}}}function cc(e,t,r,n,o){const{name:a,children:s,iteration:l}=e,f=I0(e,o),h=M0(e),c=h?`${h} ${f}`.trim():f,i=A0(c),u=D0(i,o);if(!a||!u.visible)return null;const g=u.className;if(l)return d.jsx(C.Fragment,{children:Array.from({length:r},(m,v)=>cc({...e,iteration:void 0},t,r,v,o))},n);if(sc[a])return d.jsx("div",{className:g,children:sc[a](t,r)},n);if(C0.has(a)){const m=Ta(g,a);if(!s||s.length===0){const T=/\b(h-\S|w-\S)/.test(m)?`${m} bg-gray-200 dark:bg-gray-700 rounded ${t}`:`${m} h-3.5 w-full bg-gray-200 dark:bg-gray-700 rounded ${t}`.trim();return d.jsx("div",{className:T},n)}const v=Jn(s,t,r,o);if(!(v.length>0&&v.some(w=>w!==null)))return null;const M=L0(m);return d.jsx("div",{className:M.className,style:M.style,children:v},n)}const p=Ta(g,a);if(S0.has(a)){const m={H1:"h-7",H2:"h-6",H3:"h-5",H4:"h-5",H5:"h-4",H6:"h-4",P:"h-3.5",Span:"h-3",Label:"h-3",A:"h-3.5",Badge:"h-5 w-16"},v={H1:"w-3/5",H2:"w-2/5",H3:"w-1/3",H4:"w-1/3",H5:"w-1/4",H6:"w-1/4",P:"w-full",Span:"w-1/4",Label:"w-1/4",A:"w-1/3",Strong:"w-1/5",Em:"w-1/4",Small:"w-1/5",Badge:"w-16"},x=m[a]||"h-3.5",M=v[a]||"w-full",w=a.startsWith("H")?"mb-2 mt-1":"mb-1.5";return d.jsx("div",{className:`${x} ${M} bg-gray-200 dark:bg-gray-700 rounded ${t} ${w} ${p}`.trim()},n)}if(_0.has(a))return a==="Textarea"?d.jsx("div",{className:`h-20 w-full bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 mb-2 ${t}`},n):a==="Checkbox"||a==="Radio"||a==="Toggle"?d.jsx("div",{className:`h-5 w-5 bg-gray-200 dark:bg-gray-700 rounded mb-1.5 ${t}`},n):d.jsx("div",{className:`h-9 w-full bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 mb-2 ${t}`},n);if(E0.has(a))return a==="Avatar"||a==="AvatarUploader"?d.jsx("div",{className:`h-10 w-10 bg-gray-200 dark:bg-gray-700 rounded-full ${t}`},n):a==="ProductImageViewer"?d.jsx("div",{className:`h-80 w-full bg-gray-200 dark:bg-gray-700 rounded ${t}`},n):d.jsx("div",{className:`h-40 w-full bg-gray-200 dark:bg-gray-700 rounded mb-2 ${t}`},n);if(a==="Button"){if(s&&s.length>0){const m=Ta(g,a),v=Jn(s,t,r,o);if(!(v.length>0&&v.some(T=>T!==null)))return null;const w=/\b(border|rounded|px-\d|py-\d)/.test(f)?"border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 rounded-lg":"";return d.jsx("div",{className:`${m} ${w}`.trim(),children:v},n)}return d.jsx("div",{className:`h-9 w-24 bg-gray-200 dark:bg-gray-700 rounded ${t}`},n)}return a==="Icon"?d.jsx("div",{className:`h-5 w-5 bg-gray-200 dark:bg-gray-700 rounded ${t}`},n):s&&s.length>0?d.jsx("div",{className:p,children:Jn(s,t,r,o)},n):d.jsx("div",{className:`h-3.5 w-full bg-gray-200 dark:bg-gray-700 rounded mb-1.5 ${t}`},n)}const Na=({components:e,options:t})=>{const r=O0(t.animation),o=window.G7Core?.useResponsive,a=o?.(),s=a?a.width:typeof window<"u"?window.innerWidth:1024;return d.jsx("div",{className:"w-full",role:"status","aria-busy":"true","aria-label":"Loading...",children:Jn(e,r,t.iteration_count,s)})},P0=Object.freeze(Object.defineProperty({__proto__:null,PageSkeleton:Na,default:Na},Symbol.toStringTag,{value:"Module"})),F0=(e,t)=>window.G7Core?.t?.(e,t)??e,dc=({options:e})=>{const t=document.documentElement.classList.contains("dark"),r=t?"rgb(17,24,39)":"rgb(249,250,251)",n=t?"#6b7280":"#9ca3af",o=t?"#9ca3af":"#6b7280";return d.jsxs("div",{style:{position:"absolute",inset:0,zIndex:2147483647,overflow:"hidden",background:r,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",paddingTop:"15%",gap:"12px"},children:[d.jsx("div",{style:{width:"32px",height:"32px",border:`3px solid ${n}`,borderTopColor:"transparent",borderRadius:"50%",animation:"g7-spin 0.8s linear infinite"}}),d.jsx("span",{style:{color:o,fontSize:"14px"},children:e?.text||F0("nav.loading")})]})},$0=Object.freeze(Object.defineProperty({__proto__:null,default:dc},Symbol.toStringTag,{value:"Module"})),Hr=(e,t)=>window.G7Core?.t?.(e,t)??e,uc=({currentPage:e,totalPages:t,onPageChange:r,maxVisiblePages:n=5,showFirstLast:o=!0,className:a="",style:s,prevText:l,nextText:f,id:h,editorAttrs:c})=>{const i=C.useMemo(()=>{const m=[];if(t<=n+2)for(let v=1;v<=t;v++)m.push(v);else{const v=Math.floor(n/2);let x=Math.max(2,e-v),M=Math.min(t-1,e+v);e<=v+1?M=n:e>=t-v&&(x=t-n+1),m.push(1),x>2&&m.push("...");for(let w=x;w<=M;w++)m.push(w);M<t-1&&m.push("..."),t>1&&m.push(t)}return m},[e,t,n]),u=m=>{m<1||m>t||m===e||r(m)},g=()=>{e>1&&r(e-1)},p=()=>{e<t&&r(e+1)};return d.jsxs(W,{className:`flex items-center gap-2 ${a}`,style:s,role:"navigation","aria-label":Hr("common.pagination"),id:h,...c,children:[o&&d.jsx(Q,{onClick:()=>u(1),disabled:e===1,className:"px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800","aria-label":Hr("common.first_page"),children:"«"}),d.jsx(Q,{onClick:g,disabled:e===1,className:"px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800","aria-label":Hr("common.prev_page"),children:l||d.jsx(d.Fragment,{children:"‹"})}),d.jsx(W,{className:"flex items-center gap-1",children:i.map((m,v)=>{if(m==="...")return d.jsx(re,{className:"px-3 py-1 text-sm text-gray-500 dark:text-gray-400",children:"..."},`ellipsis-${v}`);const x=m,M=x===e;return d.jsx(Q,{onClick:()=>u(x),className:`px-3 py-1 text-sm border rounded ${M?"bg-blue-500 dark:bg-blue-600 text-white border-blue-500 dark:border-blue-600":"border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800"}`,"aria-label":Hr("common.page_n",{n:x}),"aria-current":M?"page":void 0,children:x},x)})}),d.jsx(Q,{onClick:p,disabled:e===t,className:"px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800","aria-label":Hr("common.next_page"),children:f||d.jsx(d.Fragment,{children:"›"})}),o&&d.jsx(Q,{onClick:()=>u(t),disabled:e===t,className:"px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800","aria-label":Hr("common.last_page"),children:"»"})]})},U0=Object.freeze(Object.defineProperty({__proto__:null,Pagination:uc},Symbol.toStringTag,{value:"Module"})),fc=(e,t)=>window.G7Core?.t?.(e,t)??e,gc=({name:e="search",placeholder:t,value:r,onChange:n,onSubmit:o,showButton:a=!1,suggestions:s=[],onSuggestionClick:l,showSuggestions:f=!1,className:h="",style:c,id:i,editorAttrs:u})=>{const g=t??fc("common.search_placeholder"),[p,m]=C.useState(""),[v,x]=C.useState(!1),M=C.useRef(null),w=C.useRef(""),T=r!==void 0?r:p,A=f&&v&&s.length>0&&T.length>0;C.useEffect(()=>{r!==void 0&&(w.current=r)},[r]);const _=y=>{const N=y.target.value;m(N),n?.(y),w.current!==""&&N===""&&!y.nativeEvent.inputType&&setTimeout(()=>{const D=M.current?.querySelector("form");D&&D.requestSubmit()},0),w.current=N},I=y=>{m(y.text);const N={target:{value:y.text,name:e}};n?.(N),l?.(y),x(!1)},k=y=>{y.preventDefault(),o?.(y)};return d.jsxs(W,{ref:M,className:`relative ${h}`,style:c,id:i,...u,children:[d.jsx(uo,{onSubmit:k,className:"relative",children:d.jsxs(W,{className:`relative flex items-center ${a?"gap-2":""}`,children:[d.jsxs(W,{className:"relative flex-1",children:[d.jsx(W,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:d.jsx(fe,{name:Re.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),d.jsx(_t,{type:"search",name:e,value:T,onChange:_,onFocus:()=>x(!0),onBlur:()=>setTimeout(()=>x(!1),200),placeholder:g,className:"w-full pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-sm"})]}),a&&d.jsx(Q,{type:"submit",className:"px-4 py-2 bg-gray-800 dark:bg-gray-600 text-white rounded-lg hover:bg-gray-900 dark:hover:bg-gray-500 transition-colors text-sm font-medium cursor-pointer h-[42px]",children:fc("common.search")})]})}),A&&d.jsx(W,{className:"absolute z-10 w-full mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-64 overflow-y-auto",children:s.map(y=>d.jsx(W,{className:"px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 transition-colors",onClick:()=>I(y),children:d.jsxs(W,{className:"flex items-center gap-2",children:[d.jsx(fe,{name:Re.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),d.jsx(re,{className:"text-sm text-gray-700 dark:text-gray-300",children:y.text})]})},y.id))})]})},z0=Object.freeze(Object.defineProperty({__proto__:null,SearchBar:gc},Symbol.toStringTag,{value:"Module"})),kt=window.G7Core,H0={sm:"md",md:"lg",lg:"xl",xl:"2xl","2xl":"3xl"};function Aa({src:e,fallbackText:t="U",size:r="lg",uploadEndpoint:n="/api/me/avatar",deleteEndpoint:o="/api/me/avatar",onUploadSuccess:a,onUploadError:s,onDeleteSuccess:l,onDeleteError:f,showDeleteButton:h=!0,accept:c="image/*",maxSize:i=5,className:u="",uploadButtonText:g,deleteButtonText:p,readOnly:m=!1,confirmDelete:v=!0,deleteConfirmMessage:x,confirmUpload:M=!0,uploadConfirmMessage:w,uploadSuccessActions:T,uploadErrorActions:A,deleteSuccessActions:_,deleteErrorActions:I,id:k,editorAttrs:y}){const N=C.useRef(null),[D,P]=C.useState(!1),[O,L]=C.useState(!1),[$,S]=C.useState(void 0),[b,z]=C.useState(null),[U,G]=C.useState(!1),[Y,B]=C.useState(!1),[V,j]=C.useState(null),[H,q]=C.useState(null),ee=C.useRef(`avatar-upload-${Math.random().toString(36).slice(2,11)}`).current;C.useEffect(()=>{if(V){const oe=URL.createObjectURL(V);return q(oe),()=>URL.revokeObjectURL(oe)}else q(null)},[V]);const ne=C.useCallback(oe=>kt?.t?.(oe)??oe,[]),ce=C.useCallback(()=>{const oe=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return oe?decodeURIComponent(oe[1]):null},[]),R=C.useCallback(()=>kt?.api?.getToken?.()??null,[]),_e=C.useCallback(async oe=>{B(!1),j(null),P(!0),z(null);try{const le=new FormData;le.append("avatar",oe);const ve=ce(),Te=R(),We=await fetch(n,{method:"POST",headers:{Accept:"application/json",...ve&&{"X-XSRF-TOKEN":ve},...Te&&{Authorization:`Bearer ${Te}`}},credentials:"include",body:le});if(!We.ok){const Ie=await We.json().catch(()=>({}));throw new Error(Ie.message||ne("attachment.upload_failed"))}const Ae=await We.json(),He=Ae.data||Ae;He.avatar&&S(He.avatar),a?.(He),kt?.toast?.success?.(ne("mypage.profile.avatar_uploaded")),T?.length?T.forEach(Ie=>kt?.dispatch?.(Ie)):kt?.refetchDataSource?.("user")}catch(le){const ve=le instanceof Error?le:new Error(String(le));z(ve.message),s?.(ve),kt?.toast?.error?.(ve.message),A?.length&&A.forEach(Te=>kt?.dispatch?.(Te))}finally{P(!1),N.current&&(N.current.value="")}},[n,a,s,ce,R,ne]),me=C.useCallback(async oe=>{const le=oe.target.files?.[0];if(!le)return;z(null);const ve=i*1024*1024;if(le.size>ve){const Te=new Error(ne("attachment.file_too_large").replace(":max",`${i}MB`));z(Te.message),s?.(Te),kt?.toast?.error?.(Te.message);return}if(c&&!le.type.match(c.replace("*",".*"))){const Te=new Error(ne("attachment.invalid_file_type"));z(Te.message),s?.(Te),kt?.toast?.error?.(Te.message);return}M?(j(le),B(!0)):_e(le)},[i,c,s,M,_e,ne]),Be=C.useCallback(async()=>{G(!1),L(!0),z(null);try{const oe=ce(),le=R(),ve=await fetch(o,{method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json",...oe&&{"X-XSRF-TOKEN":oe},...le&&{Authorization:`Bearer ${le}`}},credentials:"include"});if(!ve.ok){const Te=await ve.json().catch(()=>({}));throw new Error(Te.message||ne("attachment.delete_failed"))}S(null),l?.(),kt?.toast?.success?.(ne("mypage.profile.avatar_deleted")),_?.length?_.forEach(Te=>kt?.dispatch?.(Te)):kt?.refetchDataSource?.("user")}catch(oe){const le=oe instanceof Error?oe:new Error(String(oe));z(le.message),f?.(le),kt?.toast?.error?.(le.message),I?.length&&I.forEach(ve=>kt?.dispatch?.(ve))}finally{L(!1)}},[o,l,f,ce,R,ne]),$e=C.useCallback(()=>{v?G(!0):Be()},[v,Be]),ye=C.useCallback(()=>{G(!1)},[]),Ne=C.useCallback(()=>{B(!1),j(null),N.current&&(N.current.value="")},[]),we=C.useCallback(()=>{V&&_e(V)},[V,_e]),ke=$===void 0?e:$,Ue=!!ke,Oe=H0[r]||"lg",K=U||Y,te=()=>d.jsxs(W,{className:"flex items-center justify-center gap-2",children:[d.jsx(_t,{ref:N,id:ee,type:"file",accept:c,className:"hidden",onChange:me,disabled:D}),!Ue&&d.jsxs(vr,{htmlFor:ee,className:`inline-flex items-center gap-2 px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${D?"opacity-50 cursor-not-allowed":""}`,children:[D?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"image",size:"sm"}),d.jsx(re,{children:g||ne("mypage.profile.register_avatar")})]}),Ue&&d.jsxs(d.Fragment,{children:[d.jsxs(vr,{htmlFor:ee,className:`inline-flex items-center gap-2 px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${D?"opacity-50 cursor-not-allowed":""}`,children:[D?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"upload",size:"sm"}),d.jsx(re,{children:g||ne("common.change")})]}),h&&d.jsxs(Q,{type:"button",className:"inline-flex items-center gap-2 px-4 py-2 border border-red-300 dark:border-red-600 text-red-600 dark:text-red-400 rounded-lg text-sm font-medium hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:$e,disabled:O,children:[O?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"trash-2",size:"sm"}),d.jsx(re,{children:p||ne("common.delete")})]})]})]});return d.jsxs(W,{className:`flex flex-col items-center gap-3 ${u}`,id:k,...y,children:[Y&&H?d.jsxs(W,{className:"relative",children:[d.jsx(Ht,{src:H,alt:"Preview",className:`rounded-full object-cover ${r==="sm"?"w-10 h-10":r==="md"?"w-12 h-12":r==="lg"?"w-16 h-16":r==="xl"?"w-24 h-24":"w-32 h-32"}`}),d.jsx(W,{className:"absolute inset-0 rounded-full bg-blue-500/20 border-2 border-blue-500 border-dashed"})]}):d.jsx(Kr,{avatar:ke||void 0,name:t,size:Oe}),!m&&d.jsxs(W,{className:"w-[220px] flex flex-col items-center gap-2",children:[Y&&V&&d.jsxs(W,{className:"w-full p-3 bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-lg",children:[d.jsxs(W,{className:"flex items-center gap-2 mb-2",children:[d.jsx(fe,{name:"upload",size:"sm",className:"text-blue-600 dark:text-blue-400 shrink-0"}),d.jsx(re,{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:w||ne("mypage.profile.upload_avatar_confirm")})]}),d.jsxs(W,{className:"text-xs text-blue-600 dark:text-blue-400 truncate mb-3",title:V.name,children:[V.name," (",(V.size/1024/1024).toFixed(2),"MB)"]}),d.jsxs(W,{className:"grid grid-cols-2 gap-2",children:[d.jsxs(Q,{type:"button",className:"inline-flex items-center justify-center gap-1.5 px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium transition-colors disabled:opacity-50",onClick:we,disabled:D,children:[D?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"check",size:"sm"}),d.jsx(re,{children:ne("common.confirm")})]}),d.jsx(Q,{type:"button",className:"inline-flex items-center justify-center gap-1.5 px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-md text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:Ne,children:d.jsx(re,{children:ne("common.cancel")})})]})]}),U&&d.jsxs(W,{className:"w-full p-3 bg-red-50 dark:bg-red-950/50 border border-red-200 dark:border-red-800 rounded-lg",children:[d.jsxs(W,{className:"flex items-center gap-2 mb-2",children:[d.jsx(fe,{name:"alert-triangle",size:"sm",className:"text-red-600 dark:text-red-400 shrink-0"}),d.jsx(re,{className:"text-sm font-medium text-red-800 dark:text-red-300",children:x||ne("mypage.profile.delete_avatar_confirm")})]}),d.jsxs(W,{className:"grid grid-cols-2 gap-2",children:[d.jsxs(Q,{type:"button",className:"inline-flex items-center justify-center gap-1.5 px-3 py-2 bg-red-600 hover:bg-red-700 text-white rounded-md text-sm font-medium transition-colors disabled:opacity-50",onClick:Be,disabled:O,children:[O?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"trash-2",size:"sm"}),d.jsx(re,{children:ne("common.delete")})]}),d.jsx(Q,{type:"button",className:"inline-flex items-center justify-center gap-1.5 px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-md text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:ye,children:d.jsx(re,{children:ne("common.cancel")})})]})]}),!K&&te()]}),b&&!K&&d.jsxs(W,{className:"flex items-center gap-2 text-sm text-red-600 dark:text-red-400",children:[d.jsx(fe,{name:"alert-circle",size:"sm"}),d.jsx(re,{children:b})]})]})}const G0=Object.freeze(Object.defineProperty({__proto__:null,AvatarUploader:Aa,default:Aa},Symbol.toStringTag,{value:"Module"})),hc=()=>window.G7Core,Rn=(e,t)=>window.G7Core?.t?.(e,t)??e,pc={horizontal:"flex items-center gap-1.5",vertical:"flex flex-col items-start"},j0=()=>[{key:"view_profile",label:Rn("userinfo.view_profile"),icon:"user",path:"/users/{{userId}}"},{key:"view_posts",label:Rn("userinfo.view_posts"),icon:"file-lines",path:"/users/{{userId}}/posts"}],Ma=({text:e,title:t})=>e?d.jsx(re,{className:"text-sm text-gray-500 dark:text-gray-400",title:t,children:e}):null,mc=({author:e,name:t,userId:r,subText:n,subTextTitle:o,isGuest:a=!1,isWithdrawn:s=!1,showDropdown:l=!0,clickable:f=!0,profilePath:h="/users/{userId}",className:c="",layout:i="vertical",text:u,stopPropagation:g=!1,menuItems:p,hideMenuItems:m=[],appendMenuItems:v=[],id:x,editorAttrs:M})=>{const w=r??e?.uuid,T=a||e?.is_guest||!1,A=s||e?.status==="withdrawn",_=A?Rn("userinfo.withdrawn_user"):u??t??e?.name??"",[I,k]=C.useState(!1),[y,N]=C.useState({top:0,left:0}),D=C.useRef(null),P=C.useRef(null),O=C.useRef(null),L=h.replace("{userId}",String(w??"")),$=`${pc[i]} ${c}`;C.useEffect(()=>{if(!I)return;const j=q=>{const ee=q.target,ne=D.current?.contains(ee),ce=P.current?.contains(ee);!ne&&!ce&&k(!1)},H=()=>k(!1);return document.addEventListener("mousedown",j),window.addEventListener("scroll",H,!0),window.addEventListener("resize",H),()=>{document.removeEventListener("mousedown",j),window.removeEventListener("scroll",H,!0),window.removeEventListener("resize",H)}},[I]);const S=C.useCallback(()=>{if(p&&p.length>0)return p.filter(q=>q.show!==!1);let H=j0().filter(q=>!m.includes(q.key)&&q.show!==!1);return v&&v.length>0&&(H=[...H,...v.filter(q=>q.show!==!1)]),H},[p,m,v]),b=C.useCallback(()=>{if(O.current){const j=O.current.getBoundingClientRect();N({top:j.bottom+4,left:j.left})}},[]),z=C.useCallback((j,H)=>{if(H.stopPropagation(),H.preventDefault(),k(!1),j.onClick)j.onClick();else if(j.path){const q=j.path.replace(/\{\{userId\}\}/g,String(w??"")),ee=hc();ee?.navigate?ee.navigate(q):window.location.href=q}},[w]),U=C.useCallback(j=>{j.preventDefault(),g&&j.stopPropagation(),!(T||!w)&&(l?(I||b(),k(H=>!H)):f&&hc()?.navigate?.(L))},[g,T,w,l,I,b,f,L]);if(T||!w)return d.jsxs(W,{className:$,id:x,...M,children:[d.jsxs(W,{className:"flex items-center gap-1.5 text-gray-400 dark:text-gray-500",children:[d.jsx(re,{children:_}),d.jsx(re,{className:"text-xs px-1.5 py-0.5 bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 rounded",children:Rn("userinfo.guest_badge")})]}),d.jsx(Ma,{text:n,title:o})]});if(A)return d.jsxs(W,{className:$,id:x,...M,children:[d.jsx(re,{className:"text-gray-400 dark:text-gray-500 line-through",children:_}),d.jsx(Ma,{text:n,title:o})]});const G=S(),B=/\btext-\S+/.test(c)?"":"text-gray-900 dark:text-white",V=l||f?`${B} hover:text-blue-600 dark:hover:text-blue-400 cursor-pointer font-medium`.trim():`${B} font-medium`.trim();return d.jsxs(W,{ref:D,className:`relative inline-block ${c}`,id:x,...M,children:[d.jsxs(W,{className:pc[i],children:[d.jsx(Q,{ref:O,onClick:U,className:V,children:_}),d.jsx(Ma,{text:n,title:o})]}),l&&I&&G.length>0&&Rt.createPortal(d.jsx(W,{ref:P,className:"fixed w-40 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-[9999]",style:{top:y.top,left:y.left},"data-testid":"author-dropdown-menu",children:G.map(j=>d.jsxs(Q,{onClick:H=>z(j,H),className:"flex items-center justify-start gap-2 w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","data-testid":`menu-item-${j.key}`,children:[j.icon&&d.jsx(fe,{name:j.icon,className:"w-4 h-4"}),d.jsx(re,{children:j.label})]},j.key))}),document.body)]})},B0=Object.freeze(Object.defineProperty({__proto__:null,UserInfo:mc},Symbol.toStringTag,{value:"Module"})),bc=({tabs:e,activeTabId:t,onTabChange:r,variant:n="underline",className:o="",style:a,hiddenTabIds:s=[],mobileBreakpoint:l=768,id:f,editorAttrs:h})=>{const i=window.G7Core?.useResponsive,u=i?.(),g=u?u.width<l:typeof window<"u"&&window.innerWidth<l,p=w=>{!w.disabled&&w.id!==t&&r?.(w.id)},m=w=>{const T=w.target.value,A=Number(T),_=typeof T=="string"&&T!==""&&!Number.isNaN(A)?A:T,I=e.find(k=>String(k.id)===String(_));I&&p(I)},v=s.length>0?e.filter(w=>!s.includes(w.id)):e;if(g)return d.jsx(W,{className:`relative ${o}`,style:a,id:f,...h,children:d.jsx(Qa,{value:t!==void 0?String(t):"",onChange:m,options:v.map(w=>({value:String(w.id),label:w.badge!==void 0?`${w.label} (${w.badge})`:w.label,disabled:w.disabled})),className:"w-full"})});const x=w=>{const T=w.id===t,A="flex items-center gap-2 px-3 py-2 font-medium text-sm transition-all shrink-0 whitespace-nowrap";if(w.disabled)return`${A} opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-600`;switch(n){case"pills":return T?`${A} bg-blue-600 dark:bg-blue-500 text-white rounded-lg`:`${A} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`;case"underline":return T?`${A} text-gray-900 dark:text-white border-b-2 border-gray-900 dark:border-white`:`${A} text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 border-b-2 border-transparent hover:border-gray-300 dark:hover:border-gray-600`;default:return T?`${A} text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 border-b-2 border-blue-600 dark:border-blue-400`:`${A} text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 border-b-2 border-transparent`}},M=n==="underline"?"flex gap-0 border-b border-gray-200 dark:border-gray-700":"flex gap-2";return d.jsx(W,{className:`relative ${o}`,style:a,id:f,...h,children:d.jsx(Wr,{className:M,children:v.map(w=>d.jsxs(Q,{type:"button",onClick:()=>p(w),disabled:w.disabled,className:x(w),children:[w.iconName&&d.jsx(fe,{name:w.iconName,size:"sm"}),d.jsx(re,{children:w.label}),w.badge!==void 0&&d.jsx(W,{className:"flex items-center justify-center min-w-5 h-5 px-1.5 bg-red-500 text-white text-xs font-bold rounded-full",children:d.jsx(re,{children:w.badge})})]},w.id))})})},W0=Object.freeze(Object.defineProperty({__proto__:null,TabNavigation:bc},Symbol.toStringTag,{value:"Module"})),K0={Header:()=>Promise.resolve().then(()=>gd),Footer:()=>Promise.resolve().then(()=>bd),MobileNav:()=>Promise.resolve().then(()=>yd),SlotContainer:()=>Promise.resolve().then(()=>ud),NotificationCenter:()=>Promise.resolve().then(()=>fd),ProductCard:()=>Promise.resolve().then(()=>Jd),ImageGallery:()=>Promise.resolve().then(()=>zl),ProductImageViewer:()=>Promise.resolve().then(()=>sg),QuantitySelector:()=>Promise.resolve().then(()=>lg),PostReactions:()=>Promise.resolve().then(()=>dg),RichTextEditor:()=>Promise.resolve().then(()=>ug),HtmlContent:()=>Promise.resolve().then(()=>fg),HtmlEditor:()=>Promise.resolve().then(()=>gg),ExpandableContent:()=>Promise.resolve().then(()=>hg),FileUploader:()=>Promise.resolve().then(()=>f0),ConfirmDialog:()=>Promise.resolve().then(()=>bg),SocialLoginButtons:()=>Promise.resolve().then(()=>h0),Toast:()=>Promise.resolve().then(()=>v0),PageTransitionIndicator:()=>Promise.resolve().then(()=>x0),PageTransitionBlur:()=>Promise.resolve().then(()=>k0),PageSkeleton:()=>Promise.resolve().then(()=>P0),PageLoading:()=>Promise.resolve().then(()=>$0),ThemeToggle:()=>Promise.resolve().then(()=>sd),Pagination:()=>Promise.resolve().then(()=>U0),SearchBar:()=>Promise.resolve().then(()=>z0),Avatar:()=>Promise.resolve().then(()=>cd),AvatarUploader:()=>Promise.resolve().then(()=>G0),UserInfo:()=>Promise.resolve().then(()=>B0),Modal:()=>Promise.resolve().then(()=>mg),TabNavigation:()=>Promise.resolve().then(()=>W0)},V0=({id:e,className:t,style:r,children:n,editorAttrs:o})=>d.jsx(W,{id:e,className:t,style:r,...o,children:n}),Y0=({id:e,children:t,cols:r=1,responsive:n,gap:o,rowGap:a,colGap:s,autoRows:l,autoCols:f,flow:h="row",className:c="",style:i,onClick:u,editorAttrs:g})=>{const p=["grid"];if(r&&p.push(`grid-cols-${r}`),n&&(n.sm&&p.push(`sm:grid-cols-${n.sm}`),n.md&&p.push(`md:grid-cols-${n.md}`),n.lg&&p.push(`lg:grid-cols-${n.lg}`),n.xl&&p.push(`xl:grid-cols-${n.xl}`),n["2xl"]&&p.push(`2xl:grid-cols-${n["2xl"]}`)),o!==void 0&&o>0&&p.push(`gap-${o}`),a!==void 0&&a>0&&p.push(`gap-y-${a}`),s!==void 0&&s>0&&p.push(`gap-x-${s}`),l){const v={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};p.push(v[l])}if(f){const v={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};p.push(v[f])}const m={row:"grid-flow-row",col:"grid-flow-col",dense:"grid-flow-dense","row-dense":"grid-flow-row-dense","col-dense":"grid-flow-col-dense"};return p.push(m[h]),c&&p.push(c),d.jsx(W,{id:e,className:p.join(" "),style:i,onClick:u,...g,children:t})},X0=({id:e,children:t,direction:r="row",justify:n="start",align:o="stretch",wrap:a="nowrap",gap:s=0,grow:l=!1,shrink:f=!0,className:h="",style:c,onClick:i,editorAttrs:u})=>{const g=["flex"],p={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};g.push(p[r]);const m={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};g.push(m[a]);const v={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(v[n]);const x={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(x[o]),s>0&&g.push(`gap-${s}`),l===!0?g.push("flex-grow"):typeof l=="number"&&l>0&&g.push(`flex-grow-${l}`),f===!1?g.push("shrink-0"):f===!0?g.push("flex-shrink"):typeof f=="number"&&f>0&&g.push(`flex-shrink-${f}`),h&&g.push(h),d.jsx(W,{id:e,className:g.join(" "),style:c,onClick:i,...u,children:t})},Z0=({id:e,title:t,subtitle:r,children:n,padding:o="md",background:a="none",maxWidth:s,centered:l=!1,border:f=!1,shadow:h="none",rounded:c=!1,className:i="",style:u,onClick:g,editorAttrs:p})=>{const m=[],v={none:"p-0",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};m.push(v[o]);const x={none:"",white:"bg-white dark:bg-gray-700",gray:"bg-gray-50 dark:bg-gray-800",primary:"bg-blue-50 dark:bg-blue-900/20",secondary:"bg-gray-50 dark:bg-gray-800"};if(a!=="none"&&m.push(x[a]),s){const w={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl","4xl":"max-w-4xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};m.push(w[s])}l&&m.push("mx-auto"),f&&m.push("border","border-gray-200","dark:border-gray-700");const M={none:"",sm:"shadow-sm",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"};return h!=="none"&&m.push(M[h]),c&&m.push("rounded-lg"),i&&m.push(i),d.jsxs(Ra,{id:e,className:m.join(" "),style:u,onClick:g,...p,children:[(t||r)&&d.jsxs(W,{className:"mb-4",children:[t&&d.jsx(Za,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t}),r&&d.jsx(zt,{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:r})]}),n]})},q0=({id:e,leftWidth:t="250px",rightWidth:r="300px",leftSlot:n,centerSlot:o,rightSlot:a,className:s="",style:l,editorAttrs:f})=>{const h=`flex flex-row w-full h-full ${s}`.trim(),c={width:t,flexShrink:0},i={flex:1,minWidth:0},u={width:r,flexShrink:0};return d.jsxs(W,{id:e,className:h,style:l,...f,children:[d.jsx(W,{className:"flex flex-col",style:c,children:n}),d.jsx(W,{className:"flex flex-col",style:i,children:o}),d.jsx(W,{className:"flex flex-col",style:u,children:a})]})},Q0={identifier:"sirsoft-basic",vendor:"sirsoft",name:{ko:"Basic",en:"Basic"},version:"1.0.1",license:"MIT",description:{ko:"그누보드7 기본 사용자 템플릿",en:"Gnuboard7 default user template"},type:"user",locales:["ko","en"],author:{name:"sirsoft",email:"contact@sirsoft.com",url:"https://sirsoft.com"},release_date:"2026-01-07",g7_version:">=7.0.0",dependencies:{modules:{"sirsoft-board":">=1.0.0","sirsoft-ecommerce":">=1.0.0","sirsoft-page":">=1.0.0"},plugins:{"sirsoft-daum_postcode":">=1.0.0"}},assets:{css:["dist/css/components.css"],js:["dist/js/components.iife.js"],fonts:[],images:[]},components:{basic:["a","button","checkbox","div","form","h1","h2","h3","h4","hr","icon","img","input","label","li","nav","p","section","select","span","svg","table","tbody","td","textarea","th","thead","tr","ul"],composite:["header","footer","mobile-nav","product-card","rich-text-editor","image-gallery","quantity-selector","post-reactions","social-login-buttons","file-uploader","card","modal","toast","pagination","stat-card","status-badge","tab-navigation","empty-state","loading-spinner","breadcrumb","search-bar","dropdown"],layout:["container","flex","grid","section"]},preview:{thumbnail:"preview/thumbnail.png",screenshots:["preview/screenshot1.png","preview/screenshot2.png"]},error_config:{layouts:{401:"errors/401",403:"errors/403",404:"errors/404",500:"errors/500",503:"errors/503",maintenance:"errors/maintenance"}},features:{dark_mode:!0,responsive:!0,multi_language:!0,multi_currency:!0},github_url:"https://github.com/gnuboard/g7-template-sirsoft-basic",github_changelog_url:"https://github.com/gnuboard/g7-template-sirsoft-basic/blob/main/CHANGELOG.md",externals:[{id:"fontawesome",type:"style",url:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",preconnect:"https://cdnjs.cloudflare.com"},{id:"pretendard",type:"webfont",url:"https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css",preconnect:"https://cdn.jsdelivr.net",crossorigin:"anonymous"}]},yc={KRW:{locale:"ko-KR",decimals:0},USD:{locale:"en-US",decimals:2},JPY:{locale:"ja-JP",decimals:0},CNY:{locale:"zh-CN",decimals:2},EUR:{locale:"de-DE",decimals:2}};function Gr(e,t="KRW"){if(!Number.isFinite(e))return"0";const r=yc[t]||yc.KRW;try{return new Intl.NumberFormat(r.locale,{style:"currency",currency:t,minimumFractionDigits:r.decimals,maximumFractionDigits:r.decimals}).format(e)}catch{return e.toLocaleString()+(t==="KRW"?"원":"")}}function eo(e,t,r=0){if(!e)return;const n=e.KRW?.value??e.KRW?.price??0,o={};for(const[a,s]of Object.entries(e)){const l=s?.value??s?.price??0;let f=0;r>0&&(a==="KRW"?f=r:n>0&&(f=r*l/n));const h=(l+f)*t;o[a]={value:h,formatted:Gr(h,a)}}return o}function to(e){const t={};for(const n of e){const o=n?.multiCurrencyTotalPrice;if(o)for(const[a,s]of Object.entries(o)){const l=s?.value??s?.price??0;t[a]=(t[a]??0)+l}}const r={};for(const[n,o]of Object.entries(t))r[n]={value:o,formatted:Gr(o,n)};return r}function vc(e,t){if(!e||!t?.length)return 0;let r=0;for(const n of t){const o=e[n.id];if(o==null)continue;const a=n.values?.find(s=>s.id===Number(o));a&&(r+=a.price_adjustment??0)}return r}function ro(e){return e.name_localized?e.name_localized:typeof e.name=="string"?e.name:e.name?.ko??""}function J0(e,t,r){if(t&&r in t)return t[r];if(Array.isArray(e)){const n=e.find(o=>typeof o.key=="string"?o.key===r:o.key?.ko===r||Object.values(o.key).includes(r));return n?typeof n.value=="string"?n.value:n.value?.ko??Object.values(n.value)[0]:void 0}return e[r]}function R0(e,t){if(t)return t;if(!Array.isArray(e))return e;const r={};for(const n of e){const o=typeof n.key=="string"?n.key:n.key?.ko??Object.values(n.key)[0]??"",a=typeof n.value=="string"?n.value:n.value?.ko??Object.values(n.value)[0]??"";o&&(r[o]=a)}return r}function ep(e,t,r){return r.find(n=>!n?.option_values||!n?.is_active?!1:e.every(o=>{const a=ro(o),s=t?.[a];return J0(n.option_values,n.option_values_localized,a)===s}))}function tp(e,t){const r=e.params;if(!r)return;const{optionGroups:n,options:o,selectedOptionItems:a,preferredCurrency:s}=r;let l;if(r.newGroupName&&r.newValue?l={...r.currentSelection??{},[r.newGroupName]:r.newValue}:l=r.currentSelection??{},!n?.every(A=>{const _=ro(A);return l?.[_]}))return;const h=ep(n,l,o??[]);if(!h){t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const c=n.map(A=>l[ro(A)]).join("_"),i=a??[];if(i.find(A=>A.id===c)){const A=window.G7Core;A?.toast?.warning?.(A?.t?.("sirsoft-ecommerce.shop.already_added_option")??"이미 추가된 옵션입니다."),t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const g=h.selling_price??0,p={};n.forEach(A=>{const _=ro(A);p[_]=l[_]});const m=r.additionalOptionGroups??[],v={};for(const A of m){if(!A.is_required)continue;const _=A.values?.find(I=>I.is_default);_&&(v[A.id]=_.id)}const x=vc(v,m),M=g+x,w={id:c,optionId:h.id,options:p,optionValues:R0(h.option_values,h.option_values_localized),quantity:1,stock:h.stock_quantity??999,unitPrice:g,unitPriceFormatted:Gr(g,s),totalPrice:M,totalPriceFormatted:Gr(M,s),multiCurrencyUnitPrice:h.multi_currency_selling_price,multiCurrencyTotalPrice:eo(h.multi_currency_selling_price,1,x),additionalOptionSelections:v,additionalOptionsTotal:x},T=[...i,w];t.setState?.({selectedOptionItems:T,selectedTotalMultiCurrency:to(T),currentSelection:{},__mergeMode:"shallow"})}function rp(e,t){const r=e.params;if(!r)return;const{selectedOptionItems:n,preferredCurrency:o}=r,a=Number(r.itemIndex)||0,s=Number(r.newQuantity)||1,l=(n??[]).map((f,h)=>{if(h!==a)return f;const c=f?.unitPrice??0,i=f?.additionalOptionsTotal??0,u=(c+i)*s;return{...f,quantity:s,totalPrice:u,totalPriceFormatted:Gr(u,o),multiCurrencyTotalPrice:eo(f?.multiCurrencyUnitPrice,s,i)}});t.setState?.({selectedOptionItems:l,selectedTotalMultiCurrency:to(l)})}function np(e,t){const r=e.params;if(!r)return;const{selectedOptionItems:n,additionalOptionGroups:o,preferredCurrency:a}=r,s=Number(r.itemIndex)||0,l=Number(r.additionalOptionId),f=Object.prototype.hasOwnProperty.call(r,"customText"),h=r.valueId===""||r.valueId==null?null:Number(r.valueId),c=(n??[]).map((i,u)=>{if(u!==s)return i;const g={...i.additionalOptionSelections??{}},p={...i.additionalOptionCustomTexts??{}};if(f){const w=String(r.customText??"");w.trim()===""?delete p[l]:p[l]=w}else h==null?(delete g[l],delete p[l]):(g[l]=h,(o??[]).find(A=>A.id===l)?.values?.find(A=>A.id===h)?.allow_custom_text||delete p[l]);const m=vc(g,o),v=i?.unitPrice??0,x=i?.quantity??1,M=(v+m)*x;return{...i,additionalOptionSelections:g,additionalOptionCustomTexts:p,additionalOptionsTotal:m,totalPrice:M,totalPriceFormatted:Gr(M,a),multiCurrencyTotalPrice:eo(i?.multiCurrencyUnitPrice,x,m)}});t.setState?.({selectedOptionItems:c,selectedTotalMultiCurrency:to(c)})}function op(e,t){const r=e.params;if(!r)return;const n=Number(r.itemIndex)||0,o=(r.selectedOptionItems??[]).filter((a,s)=>s!==n);t.setState?.({selectedOptionItems:o,selectedTotalMultiCurrency:to(o)})}function ap(e,t){const r=e.params;if(!r)return;const n=Math.max(1,Number(r.newQuantity)||1);t.setState?.({noOptionQuantity:n,noOptionTotalMultiCurrency:eo(r.multiCurrencyUnitPrice,n)})}const gn=window.G7Core?.createLogger?.("Handler:Cart")??{log:(...e)=>console.log("[Handler:Cart]",...e),warn:(...e)=>console.warn("[Handler:Cart]",...e),error:(...e)=>console.error("[Handler:Cart]",...e)};function pr(e){const t=window.G7Core;t?.state?.setLocal?(t.state.setLocal(e),gn.log("Local state updated:",e)):gn.warn("G7Core.state.setLocal not available")}function wc(){return window.G7Core?.state?.getLocal?.()||{}}function sp(){return window.G7Core?.state?.get?.()||{}}function lp(e,t="info"){const r=window.G7Core;r?.toast?.show?r.toast.show(e,t):gn.warn("G7Core.toast.show not available, message:",e)}function ip(e){const t=window.G7Core;return t?.t?t.t(e):e}function xc(){const e=window.G7Core;if(e?.dispatch){const r=wc().selectedItems||[];e.dispatch({handler:"refetchDataSource",params:{dataSourceId:"cartItems"}}),gn.log("Refetching cartItems with selected_ids:",r)}else gn.warn("G7Core.dispatch not available")}function cp(e,t){const{itemId:r,selectedItems:n}=e?.params||{},o=n||[];let a;o.includes(r)?a=o.filter(h=>h!==r):a=[...o,r];const l=sp().cartItems?.data?.items||[],f=l.length>0&&a.length===l.length;pr({selectedItems:a,allSelected:f,selectedCount:a.length}),xc()}function dp(e,t){const{allItemIds:r,isSelected:n}=e?.params||{};pr({selectedItems:n?r:[],allSelected:n,selectedCount:n?r.length:0}),xc()}function up(e,t){const{optionName:r,optionValue:n}=e?.params||{},a=wc().selectedOptions||{};pr({selectedOptions:{...a,[r]:n}})}function fp(e,t){const{targetIds:r}=e?.params||{};if(!r||r.length===0){lp(ip("shop.cart.select_items_to_delete"),"warning");return}pr({deleteModal:{visible:!0,targetIds:r}})}function gp(e,t){const{targetItem:r}=e?.params||{};pr({optionModal:{visible:!0,targetItem:r},selectedOptions:r?.options||{},selectedQuantity:r?.quantity})}function hp(e,t){const{selectedItems:r}=e?.params||{};if(!r||r.length===0){pr({isCalculating:!1});return}pr({isCalculating:!0})}const mr=window.G7Core?.createLogger?.("Handler:CartOptionChange")??{log:(...e)=>console.log("[Handler:CartOptionChange]",...e),warn:(...e)=>console.warn("[Handler:CartOptionChange]",...e),error:(...e)=>console.error("[Handler:CartOptionChange]",...e)};function Oa(e){return e.name_localized?e.name_localized:typeof e.name=="string"?e.name:e.name?.ko??""}function pp(e,t,r){if(t&&r in t)return t[r];if(Array.isArray(e)){const n=e.find(o=>typeof o.key=="string"?o.key===r:o.key?.ko===r||Object.values(o.key).includes(r));return n?typeof n.value=="string"?n.value:n.value?.ko??Object.values(n.value)[0]:void 0}return e[r]}function kc(e,t,r){return!e||!t?.length?null:t.every(a=>{const s=Oa(a);return e[s]})?r?.find(a=>t.every(s=>{const l=Oa(s);return pp(a.option_values,a.option_values_localized,l)===e[l]}))||null:(mr.log("Not all options selected yet"),null)}function mp(e,t){const{selectedOptions:r,optionGroups:n,options:o}=e?.params||{};mr.log("findMatchingOption called:",{selectedOptions:r,optionGroups:n,optionsCount:o?.length});const a=kc(r,n,o);return mr.log("Matched option:",a),{matchedOption:a}}function bp(e,t){const{currentOptionValues:r,optionGroups:n,options:o}=e?.params||{};if(mr.log("initCartOptionSelection called:",{currentOptionValues:r,optionGroups:n,optionsCount:o?.length}),!n?.length||!r)return mr.log("No option groups or current values, returning empty"),{selectedOptions:{},matchedOption:null};const a={};for(const l of n){const f=Oa(l),h=r[f],c=l.values_localized??(Array.isArray(l.values)?l.values.map(i=>typeof i=="string"?i:i?.ko??""):[]);h&&c.includes(h)&&(a[f]=h)}mr.log("Initial selectedOptions:",a);const s=kc(a,n,o||[]);return mr.log("Matched option:",s),{selectedOptions:a,matchedOption:s}}const hn="g7_cart_key",yp="/api/modules/sirsoft-ecommerce/cart/key",Ia="g7_guest_order_token",Cc="g7_guest_order_number",Da="g7_guest_order_expires_at",ut=window.G7Core?.createLogger?.("Handler:Storage")??{log:(...e)=>console.log("[Handler:Storage]",...e),warn:(...e)=>console.warn("[Handler:Storage]",...e),error:(...e)=>console.error("[Handler:Storage]",...e)};async function Sc(){try{const e=await fetch(yp,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"}});return e.ok?(await e.json()).data?.cart_key||null:(ut.error("Failed to issue cartKey from API:",e.status),null)}catch(e){return ut.error("Error issuing cartKey from API:",e),null}}function or(e){const t=window.G7Core;t?.state?.set?(t.state.set(e),ut.log("Global state updated:",e)):ut.warn("G7Core.state.set not available")}function vp(){try{const e=window.G7Config;return e?.user?e.user:(window.G7Core?.state?.get?.()||{}).currentUser||null}catch{return null}}async function wp(e,t){let r=null;try{r=localStorage.getItem(hn)}catch{}if(r)ut.log("Existing cartKey loaded:",r);else if(r=await Sc(),r)try{localStorage.setItem(hn,r),ut.log("New cartKey issued from API:",r)}catch{}else ut.error("Failed to issue cartKey from API");or({cartKey:r})}function xp(e,t){try{return localStorage.getItem(hn)}catch{return null}}function _c(e,t){try{localStorage.removeItem(hn),ut.log("cartKey removed from localStorage")}catch{}or({cartKey:null})}async function kp(e,t){if(vp()){_c();return}const n=await Sc();if(n){try{localStorage.setItem(hn,n),ut.log("New cartKey regenerated from API:",n)}catch{}or({cartKey:n})}else ut.error("Failed to regenerate cartKey from API")}function Cp(e,t){const{key:r,value:n}=e?.params||{};if(!r){ut.warn("saveToStorage: key is required");return}try{localStorage.setItem(r,n),ut.log("Saved to storage:",r,n)}catch{}}function Sp(e,t){const{key:r,defaultValue:n}=e?.params||{};if(!r)return ut.warn("loadFromStorage: key is required"),n||null;try{return localStorage.getItem(r)||n||null}catch{return n||null}}function La(){try{sessionStorage.removeItem(Ia),sessionStorage.removeItem(Cc),sessionStorage.removeItem(Da)}catch{}}function _p(e,t){let r=null,n=null;try{r=sessionStorage.getItem(Ia),n=sessionStorage.getItem(Da)}catch{}let o=!1;if(r){const a=n?new Date(n).getTime():NaN;(isNaN(a)||a<=Date.now())&&(La(),r=null,o=!0)}if(r){or({guestOrderToken:r}),ut.log("Guest order token loaded from sessionStorage");return}if(!o){const s=window.G7Core?.state?.get?.("_global")?.guestOrderToken;if(typeof s=="string"&&s!==""){ut.log("Guest order token preserved from in-memory _global (sessionStorage empty)");return}}or({guestOrderToken:null}),ut.log("No guest order token (visitor not authenticated)")}function Ep(e,t){const{token:r,orderNumber:n,expiresAt:o}=e?.params||{};if(!r||!n||!o){ut.warn("saveGuestOrderToken: token, orderNumber, expiresAt are required");return}try{sessionStorage.setItem(Ia,r),sessionStorage.setItem(Cc,n),sessionStorage.setItem(Da,o)}catch{}or({guestOrderToken:r})}function Tp(e,t){La(),or({guestOrderToken:null})}function Np(e,t){La(),or({guestOrderToken:null})}function Ap(e,t){const{product:r,priceField:n,currencyCode:o}=e,a=o||t.getState("_global.preferredCurrency")||"KRW",s=`multi_currency_${n}`,l=r[s];if(l&&l[a])return l[a].formatted;const f=`${n}_formatted`;return r[f]||String(r[n])}const Pa={KRW:{code:"KRW",symbol:"₩",locale:"ko-KR",decimals:0},USD:{code:"USD",symbol:"$",locale:"en-US",decimals:2},JPY:{code:"JPY",symbol:"¥",locale:"ja-JP",decimals:0},CNY:{code:"CNY",symbol:"¥",locale:"zh-CN",decimals:2},EUR:{code:"EUR",symbol:"€",locale:"de-DE",decimals:2}};function Mp(e,t){const{value:r,currencyCode:n,locale:o}=e,a=n||t.getState("_global.preferredCurrency")||"KRW",s=Pa[a]||Pa.KRW,l=o||s.locale;try{return new Intl.NumberFormat(l,{style:"currency",currency:s.code,minimumFractionDigits:s.decimals,maximumFractionDigits:s.decimals}).format(r)}catch{const f=r.toLocaleString(void 0,{minimumFractionDigits:s.decimals,maximumFractionDigits:s.decimals});return`${s.symbol}${f}`}}function Op(e){return Pa[e]?.symbol||e}const Fa=window.G7Core?.createLogger?.("Handler:Currency")??{log:(...e)=>console.log("[Handler:Currency]",...e),warn:(...e)=>console.warn("[Handler:Currency]",...e),error:(...e)=>console.error("[Handler:Currency]",...e)},Ec="g7_preferred_currency",Ip="KRW";function Dp(e,t){const{defaultCurrency:r=Ip}=e;let n=r;try{if(typeof window<"u"&&window.localStorage){const o=localStorage.getItem(Ec);o&&Tc(o)&&(n=o)}}catch{Fa.warn("localStorage 접근 불가, 기본 통화 사용:",r)}return t.setState("global",{preferredCurrency:n}),n}function Lp(e,t){const{currencyCode:r}=e;if(!Tc(r)){Fa.warn("유효하지 않은 통화 코드:",r);return}try{typeof window<"u"&&window.localStorage&&localStorage.setItem(Ec,r)}catch{Fa.warn("localStorage 저장 실패")}t.setState("global",{preferredCurrency:r})}function Tc(e){return typeof e=="string"&&/^[A-Z]{3}$/.test(e)}const jr=window.G7Core?.createLogger?.("Handler:SetTheme")??{log:(...e)=>console.log("[Handler:SetTheme]",...e),warn:(...e)=>console.warn("[Handler:SetTheme]",...e),error:(...e)=>console.error("[Handler:SetTheme]",...e)},$a=["auto","light","dark"],Nc="g7_color_scheme",Pp=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,no=e=>{const t=Pp(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function Fp(){try{const e=localStorage.getItem(Nc),t=e&&$a.includes(e)?e:"auto";no(t),jr.log("Initial theme applied:",t)}catch(e){jr.warn("Failed to load initial theme:",e),no("auto")}}async function $p(e,t){const r=e?.target;if(r&&typeof r=="string"&&$a.includes(r)){no(r);return}Fp()}async function Up(e,t){let r;if(e?.target&&typeof e.target=="string"&&!e.target.includes("{{")&&(r=e.target),!r||typeof r!="string"){jr.warn("Invalid theme:",r);return}if(!$a.includes(r)){jr.warn("Unsupported theme:",r);return}const n=r;try{localStorage.setItem(Nc,n)}catch(o){jr.error("Failed to save theme to localStorage:",o);return}no(n),jr.log("Theme changed to:",n)}const zp=window.G7Core?.createLogger?.("Handler:RedirectToLoginWithReturn")??{log:(...e)=>console.log("[Handler:RedirectToLoginWithReturn]",...e),warn:(...e)=>console.warn("[Handler:RedirectToLoginWithReturn]",...e),error:(...e)=>console.error("[Handler:RedirectToLoginWithReturn]",...e)};async function Hp(e,t){const r=window.G7Core;if(!r?.dispatch){zp.error("G7Core.dispatch 가 초기화되지 않아 로그인 리다이렉트를 실행할 수 없습니다.");return}const n=window.location.pathname+window.location.search;await r.dispatch({handler:"navigate",params:{path:"/login",query:{redirect:n}}})}const Ua=window.G7Core?.createLogger?.("Handler:DownloadAttachment")??{log:(...e)=>console.log("[Handler:DownloadAttachment]",...e),warn:(...e)=>console.warn("[Handler:DownloadAttachment]",...e),error:(...e)=>console.error("[Handler:DownloadAttachment]",...e)};async function Gp(e,t){const r=window.G7Core,{url:n,filename:o}=e?.params||{};if(!n){Ua.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!r?.api?.get){Ua.error("G7Core.api.get 이 초기화되지 않아 다운로드를 실행할 수 없습니다.");return}try{const a=await r.api.get(n,{responseType:"blob"});if(a){const s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=o||"",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(s)}}catch(a){Ua.error("첨부파일 다운로드 실패",a),r?.toast?.error?.(r?.t?.("common.download_failed")??"Download failed")}}const oo={"sirsoft-basic.addSelectedItemIfComplete":tp,"sirsoft-basic.updateSelectedItemQuantity":rp,"sirsoft-basic.removeSelectedItem":op,"sirsoft-basic.updateNoOptionQuantity":ap,"sirsoft-basic.setBlockAdditionalOption":np,"sirsoft-basic.getDisplayPrice":Ap,"sirsoft-basic.formatCurrency":Mp,"sirsoft-basic.getCurrencySymbol":Op,"sirsoft-basic.loadPreferredCurrency":Dp,"sirsoft-basic.savePreferredCurrency":Lp,setTheme:Up,initTheme:$p,redirectToLoginWithReturn:Hp,downloadAttachment:Gp,toggleCartItemSelection:cp,selectAllCartItems:dp,setCartOption:up,openCartDeleteModal:fp,openCartOptionModal:gp,recalculateCart:hp,findMatchingOption:mp,initCartOptionSelection:bp,initCartKey:wp,getCartKey:xp,clearCartKey:_c,regenerateCartKey:kp,saveToStorage:Cp,loadFromStorage:Sp,initGuestOrderToken:_p,saveGuestOrderToken:Ep,clearGuestOrderToken:Tp,clearGuestTokenOnEntry:Np},pn=window.G7Core?.createLogger?.("Template:sirsoft-basic:IdentityLauncher")??{log:(...e)=>console.log("[Template:sirsoft-basic:IdentityLauncher]",...e),warn:(...e)=>console.warn("[Template:sirsoft-basic:IdentityLauncher]",...e),error:(...e)=>console.error("[Template:sirsoft-basic:IdentityLauncher]",...e)};function jp(e){const t=window.G7Core,r=t?.state?.getLocal?.()??{},n=t?.state?.getGlobal?.()??t?.state?.get?.()??{},o=(...f)=>f.find(h=>typeof h=="string"&&h.length>0),a=o(e.target?.email,n?.currentUser?.email,n?.user?.email,n?.auth?.user?.email,e.purpose==="signup"?r?.registerForm?.email:void 0,e.purpose==="password_reset"?r?.passwordResetForm?.email:void 0,e.purpose==="password_reset"?r?.email:void 0),s=o(e.target?.phone,n?.currentUser?.phone,n?.user?.phone,n?.auth?.user?.phone);if(!a&&!s)return null;const l={};return a&&(l.email=a),s&&(l.phone=s),l}function Bp(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function Wp(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function Kp(e,t){const r={purpose:e.purpose};e.provider_id&&(r.provider_id=e.provider_id),t&&(r.target=t);const n=e.challenge_start_url||"/api/identity/challenges",o=await fetch(n,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...Wp(),...Bp()},body:JSON.stringify(r)}),a=await o.json().catch(()=>null);if(!o.ok||!a?.success){const l=a?.message??`Challenge 시작 실패 (HTTP ${o.status})`;throw new Error(l)}const s=a.data??a;return{id:s.id,expires_at:s.expires_at,render_hint:s.render_hint??e.render_hint??"text_code",public_payload:s.public_payload,redirect_url:s.redirect_url,max_attempts:typeof s.max_attempts=="number"?s.max_attempts:void 0}}async function Vp(e){const t=window.G7Core,r=t?.identity;if(!t?.dispatch||!t?.state||!r)return pn.error("G7Core 또는 G7Core.identity 가 초기화되지 않아 launcher 를 실행할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};if(e.render_hint==="external_redirect"||e.redirect_url)return r.redirectExternally(e);const n=jp(e);let o;try{o=await Kp(e,n)}catch(p){pn.error("Challenge 시작 실패:",p);try{await t.dispatch({handler:"toast",params:{type:"error",message:p instanceof Error?p.message:"본인인증 시작에 실패했습니다."}})}catch{}return{status:"failed",failureCode:"CHALLENGE_START_FAILED",reason:p instanceof Error?p.message:String(p)}}if(o.redirect_url)return r.redirectExternally({...e,render_hint:"external_redirect",redirect_url:o.redirect_url});const a=o.expires_at?new Date(o.expires_at).getTime():0,s=a>0?Math.max(0,Math.floor((a-Date.now())/1e3)):0,l=typeof o.max_attempts=="number"?o.max_attempts:0;t.state.set({identityChallenge:{policy_key:e.policy_key,purpose:e.purpose,provider_id:e.provider_id??null,render_hint:o.render_hint,challenge_id:o.id,expires_at:o.expires_at,public_payload:o.public_payload??{},target:n??null,code:"",error:null,attempts:0,maxAttempts:l,remainingSeconds:s,resendCooldown:0}});let f=a,h=0;const c=window.setInterval(()=>{const p=f>0?Math.max(0,Math.floor((f-Date.now())/1e3)):0;h=Math.max(0,h-1),t.state.set({identityChallenge:{remainingSeconds:p,resendCooldown:h}})},1e3);let i=null;try{i=t.state.subscribe?.(p=>{const m=p?.identityChallenge?.expires_at;if(typeof m=="string"){const x=new Date(m).getTime();Number.isFinite(x)&&x!==f&&(f=x)}const v=p?.identityChallenge?.resendCooldown;typeof v=="number"&&v>h&&(h=v)})??null}catch{}const u=r.createDeferred();try{await t.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(p){return pn.error("openModal 실패 — 풀페이지로 폴백:",p),window.clearInterval(c),i?.(),r.redirectExternally({...e,render_hint:"external_redirect",redirect_url:`/identity/challenge?challenge_id=${encodeURIComponent(o.id)}&return=${encodeURIComponent(window.location.href)}`})}const g=await u;return window.clearInterval(c),i?.(),g}function Yp(){const e=window.G7Core?.identity;if(!e?.setLauncher){pn.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(Vp),pn.log("IDV launcher registered (sirsoft-basic)")}function Xp(e){const t=e.icons;return Array.isArray(t)?t.filter(r=>!!r&&typeof r=="object"&&typeof r.value=="string"):[]}function Zp(e,t){const r=e.label;return typeof r=="string"?r.startsWith("$t:")?t(r.slice(3)):r:e.value}function qp(e,t,r){if(r==="")return!0;const n=r.toLowerCase();return e.value.toLowerCase().includes(n)||t.toLowerCase().includes(n)?!0:(e.keywords??[]).some(o=>o.toLowerCase().includes(n))}function Qp({entry:e}){const t=e.preview;return t?.html?d.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:Ha}):t?.className?d.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:Ha}):d.jsx("i",{className:`fas fa-${e.value}`,style:Ha,"aria-hidden":"true"})}function Jp({control:e,value:t,onChange:r,t:n}){const o=Xp(e),a=t==null?"":String(t),s=typeof e.iconColumns=="number"?e.iconColumns:6,l=e.iconSearchPlaceholder,f=typeof l=="string"&&l.startsWith("$t:")?n(l.slice(3)):n("layout_editor.icon_picker.search_placeholder"),[h,c]=C.useState("");if(o.length===0)return d.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Ac,children:d.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-free","data-testid":"g7le-widget-icon-picker-free",value:a,placeholder:n("layout_editor.icon_picker.free_input_hint"),onChange:g=>r(g.target.value===""?void 0:g.target.value),style:Mc})});const i=g=>Zp(g,n),u=o.filter(g=>qp(g,i(g),h));return d.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Ac,children:[d.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:h,placeholder:f,onChange:g=>c(g.target.value),style:Mc}),d.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...Rp,gridTemplateColumns:`repeat(${s}, minmax(0, 1fr))`},children:[d.jsx("button",{type:"button","data-testid":"g7le-icon-cell-none",title:n("layout_editor.icon_picker.none"),onClick:()=>r(void 0),"aria-pressed":a==="",style:a===""?Oc:za,children:d.jsx("span",{style:em,children:"—"})}),u.map(g=>{const p=g.value===a;return d.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:i(g),"aria-pressed":p,onClick:()=>r(g.value),style:p?Oc:za,children:d.jsx(Qp,{entry:g})},g.value)})]}),u.length===0&&d.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:tm,children:n("layout_editor.icon_picker.no_results")})]})}const Ac={display:"flex",flexDirection:"column",gap:6,width:"100%"},Mc={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},Rp={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},za={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},Oc={...za,border:"2px solid #2563eb",background:"#eff6ff"},Ha={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},em={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},tm={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},Ic=window.G7Core?.createLogger?.("Template:sirsoft-basic:EditorWidgets")??{log:(...e)=>console.log("[Template:sirsoft-basic:EditorWidgets]",...e),warn:(...e)=>console.warn("[Template:sirsoft-basic:EditorWidgets]",...e)};function rm(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){Ic.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",Jp),Ic.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)")}const Ga=window.G7Core?.createLogger?.("Template:sirsoft-basic")??{log:(...e)=>console.log("[Template:sirsoft-basic]",...e),warn:(...e)=>console.warn("[Template:sirsoft-basic]",...e),error:(...e)=>console.error("[Template:sirsoft-basic]",...e)};typeof window<"u"&&(window.G7TemplateHandlers=oo);function Dc(){if(typeof window<"u"){let e=0;const t=50,r=()=>{const n=window.G7Core?.getActionDispatcher?.();n?(Object.entries(oo).forEach(([o,a])=>{n.registerHandler(o,a)}),Ga.log(`${Object.keys(oo).length} custom handler(s) registered:`,Object.keys(oo)),Yp()):(e++,e<=t?(Ga.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(r,100)):Ga.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?r():window.addEventListener("load",r)}}return rm(),Dc(),J.A=co,J.Avatar=Kr,J.AvatarUploader=Aa,J.Button=Q,J.Checkbox=Ja,J.Code=nd,J.ConfirmDialog=ta,J.Container=V0,J.Div=W,J.ExpandableContent=Jo,J.FileInput=Va,J.FileUploader=Qn,J.Flex=X0,J.Footer=as,J.Form=uo,J.Grid=Y0,J.H1=Kc,J.H2=Za,J.H3=bn,J.H4=qa,J.Header=ns,J.Hr=fo,J.HtmlContent=Zo,J.HtmlEditor=Wl,J.Icon=fe,J.IconName=Re,J.ImageGallery=Lr,J.Img=Ht,J.Input=_t,J.Label=vr,J.Li=Qt,J.MobileNav=ss,J.Modal=Ro,J.Nav=Wr,J.NotificationCenter=wn,J.Ol=Vc,J.Optgroup=qc,J.Option=Zc,J.P=zt,J.PageLoading=dc,J.PageSkeleton=Na,J.PageTransitionBlur=_a,J.PageTransitionIndicator=Sa,J.Pagination=uc,J.PasswordInput=Xa,J.PostReactions=jl,J.ProductCard=Ss,J.ProductImageViewer=In,J.QuantitySelector=Hl,J.RichTextEditor=Bl,J.SearchBar=gc,J.Section=Ra,J.SectionLayout=Z0,J.Select=Qa,J.SlotContainer=vn,J.SocialLoginButtons=tc,J.Span=re,J.Svg=mn,J.TabNavigation=bc,J.Table=Qc,J.Tbody=Rc,J.Td=rd,J.Textarea=lo,J.Th=td,J.Thead=Jc,J.ThemeToggle=yn,J.ThreeColumnLayout=q0,J.Toast=Ca,J.Tr=ed,J.Ul=io,J.UserInfo=mc,J.availablePasswordRules=so,J.compositeComponents=K0,J.defaultPasswordRules=Ya,J.initTemplate=Dc,J.templateMetadata=Q0,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),J})({},ReactJSXRuntime,React,ReactDOM);
//# sourceMappingURL=components.iife.js.map