From 3e41dc6075b0491ea39df31ea2b99f5ada541c62 Mon Sep 17 00:00:00 2001 From: HeuJung Date: Fri, 4 Sep 2026 18:53:31 +0900 Subject: [PATCH] =?UTF-8?q?fix(admin=5Fbasic,basic):=20=EC=83=81=ED=95=9C?= =?UTF-8?q?=20=EC=B4=9D=20=EA=B1=B4=EC=88=98=20=EB=AA=A9=EB=A1=9D=EC=9D=98?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=B2=88=ED=98=B8=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=B5=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 총 건수를 상한까지만 세는 목록(last_page: null)에서 Pagination 이 번호 목록을 통째로 비우고 현재 페이지 숫자 하나만 남겼다. 합의되고 CHANGELOG 에 약속된 동작은 "마지막 페이지 점프만 감춤" 이었으므로, 1..현재 페이지와 (다음이 있으면) 현재+1 까지는 그대로 그리고 그 너머만 계속됨 표시로 둔다. 활동 로그처럼 10,000건을 넘는 화면에서 앞 페이지로 직접 이동할 방법이 없던 것을 되돌린다. 두 템플릿 컴포넌트 회귀 테스트(작성 시 6/7 fail 확인)와 활동 로그 E2E 를 추가하고, pagination.md 의 화면 규약 서술을 실제 동작으로 정정했다. --- docs/backend/pagination.md | 3 +- .../_bundled/sirsoft-admin_basic/AGENTS.md | 2 +- .../_bundled/sirsoft-admin_basic/CHANGELOG.md | 1 + .../dist/js/components.iife.js | 4 +- .../src/components/composite/Pagination.d.ts | 4 +- .../src/components/composite/Pagination.tsx | 33 ++++-- .../PaginationUnboundedNumbers.test.tsx | 110 ++++++++++++++++++ templates/_bundled/sirsoft-basic/AGENTS.md | 2 +- templates/_bundled/sirsoft-basic/CHANGELOG.md | 1 + .../sirsoft-basic/dist/js/components.iife.js | 20 ++-- .../src/components/composite/Pagination.d.ts | 4 +- .../src/components/composite/Pagination.tsx | 33 ++++-- .../PaginationUnboundedNumbers.test.tsx | 110 ++++++++++++++++++ .../activity-log-unbounded-pagination.spec.ts | 72 ++++++++++++ 14 files changed, 356 insertions(+), 43 deletions(-) create mode 100644 templates/_bundled/sirsoft-admin_basic/src/components/composite/__tests__/PaginationUnboundedNumbers.test.tsx create mode 100644 templates/_bundled/sirsoft-basic/src/components/composite/__tests__/PaginationUnboundedNumbers.test.tsx create mode 100644 tests/Playwright/specs/admin/activity-log-unbounded-pagination.spec.ts diff --git a/docs/backend/pagination.md b/docs/backend/pagination.md index 4bb2058a..7559473f 100644 --- a/docs/backend/pagination.md +++ b/docs/backend/pagination.md @@ -87,6 +87,7 @@ FULLTEXT(`MATCH ... AGAINST`) 검색에서 이 차이가 크게 드러난다. | 다음 페이지 이동 | **그대로 가능** — `per_page + 1` 조회로 정확히 판정 | | 이전 페이지 이동 | 그대로 가능 | | 마지막 페이지 점프 | **감춤** — 총 건수를 알아야 계산되는 유일한 값 | +| 페이지 번호 목록 | 그대로 — 1 부터 현재 페이지까지와, 다음이 있으면 현재+1 을 그린다. 그 너머는 존재 여부를 모르므로 계속됨 표시(`...`)만 둔다 | 마지막 페이지 점프를 감추는 것은 기능 축소가 아니라 **계산 불가 사실의 정직한 표시**다. 그 버튼은 대량 매칭에서 초대형 OFFSET 을 실행하므로, 눌러도 정상 응답이 오지 않는 경우가 많다. @@ -318,7 +319,7 @@ HookManager::addFilter('core.pagination.filter_result_cap', function (int $cap, | Prop | 의미 | |---|---| -| `totalPages` | 마지막 페이지. **`null` 이면 페이지 번호 목록과 마지막 페이지 점프가 사라진다** | +| `totalPages` | 마지막 페이지. **`null` 이면 마지막 페이지 점프만 사라진다** — 번호 목록은 1..현재(+다음이 있으면 현재+1)까지 그대로 그린다. 번호 목록까지 비우면 앞 페이지로 직접 뛰어갈 방법이 없어진다 | | `hasMorePages` | 다음 페이지 존재 여부. 총 건수를 몰라도 정확하다 | | `showFirst` / `showLast` | 첫/마지막 버튼을 따로 제어 (미지정 시 `showFirstLast` 를 따름) | diff --git a/templates/_bundled/sirsoft-admin_basic/AGENTS.md b/templates/_bundled/sirsoft-admin_basic/AGENTS.md index b19e69d2..16200137 100644 --- a/templates/_bundled/sirsoft-admin_basic/AGENTS.md +++ b/templates/_bundled/sirsoft-admin_basic/AGENTS.md @@ -122,7 +122,7 @@ admin/`)이 이 템플릿의 베이스(`_admin_base`)를 extends 하고 이 템 | 종류 | 개수 | 위치 | |---|---|---| | PHPUnit | 0개 | — | -| Vitest | 206개 | `vitest.config.ts` | +| Vitest | 207개 | `vitest.config.ts` | | Playwright | 9개 | `tests/Playwright` | | 시나리오 매니페스트 | 2개 | `tests/scenarios` | diff --git a/templates/_bundled/sirsoft-admin_basic/CHANGELOG.md b/templates/_bundled/sirsoft-admin_basic/CHANGELOG.md index e5eb3d8b..dbca89e3 100644 --- a/templates/_bundled/sirsoft-admin_basic/CHANGELOG.md +++ b/templates/_bundled/sirsoft-admin_basic/CHANGELOG.md @@ -26,6 +26,7 @@ ### Fixed +- 기록이 아주 많아 총 건수를 정확히 세지 못한 목록(활동 로그 등)에서 페이지 번호가 전부 사라지고 현재 페이지 숫자 하나만 남던 문제를 수정했습니다. 이제 1 부터 현재 페이지까지의 번호와 다음 페이지 번호가 그대로 표시되어 앞 페이지로 바로 이동할 수 있으며, 감춰지는 것은 마지막 페이지로 뛰는 버튼뿐입니다. - 설정 파일의 자산 항목이 실제 파일 위치와 달랐던 것을 정정했습니다. 존재하지 않는 글꼴·이미지 폴더 항목은 제거했습니다. - 환경설정 > 일반의 「자산 URL 방식 자동 감지」가 감지 결과를 선택 항목과 저장 내용에 반영합니다. 종전에는 버튼을 눌러도 선택이 그대로였고 진행·결과 안내도 표시되지 않았습니다. - 대시보드 알림 중 일부 경고가 일반 안내와 같은 회색으로 표시되어 경고로 보이지 않던 문제를 수정했습니다. 이제 알림의 심각도에 따라 색이 정해집니다. diff --git a/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js b/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js index 0fe0b422..8dbfbd95 100644 --- a/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js +++ b/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js @@ -1,4 +1,4 @@ -var SirsoftAdminBasic=(function(R,h,v,Vn){"use strict";var eD=Object.defineProperty;var tD=(R,h,v)=>h in R?eD(R,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):R[h]=v;var $e=(R,h,v)=>tD(R,typeof h!="symbol"?h+"":h,v);var Xa,Cr;function Wb(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const $=Wb(v),Gb=()=>window.G7Core,le=v.forwardRef(({children:e,variant:t="primary",size:n="md",className:r="",...s},o)=>{const i="button",a=Gb()?.style?.mergeClasses?.(i,r)??`${i} ${r}`;return h.jsx("button",{ref:o,className:a,...s,children:e})});le.displayName="Button";const ou=v.forwardRef(({accept:e,maxSize:t,onChange:n,onError:r,buttonText:s="Browse",placeholder:o="No file selected",className:i="",disabled:a,...l},c)=>{const d=v.useRef(null),u=c||d,[f,g]=v.useState(""),m={},p={};Object.entries(l).forEach(([x,M])=>{x.startsWith("data-editor-")||x==="id"||x==="onMouseMove"||x==="onMouseLeave"?m[x]=M:p[x]=M});const y=v.useCallback(()=>{!a&&u.current&&u.current.click()},[a,u]),b=v.useCallback(x=>{const M=x.target.files?.[0]||null;if(!M){g(""),n?.({target:{value:null,name:""}});return}if(t&&M.size>t*1024*1024){const S=`File size exceeds ${t}MB limit`;r?.(S),u.current&&(u.current.value=""),g("");return}g(M.name),n?.({target:{value:M,name:M.name}})},[t,n,r,u]),_=v.useCallback(x=>{x.stopPropagation(),u.current&&(u.current.value=""),g(""),n?.({target:{value:null,name:""}})},[n,u]);return h.jsxs("div",{className:`flex items-center gap-2 ${i}`,...m,children:[h.jsx("input",{ref:u,type:"file",accept:e,onChange:b,disabled:a,className:"hidden",...p}),h.jsx("button",{type:"button",onClick:y,disabled:a,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:s}),h.jsx("span",{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:f||o}),f&&!a&&h.jsx("button",{type:"button",onClick:_,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:h.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});ou.displayName="FileInput";const Yb=e=>e==="checkbox"?"checkbox":e==="radio"?"radio":"input",Kb=(e,t)=>{const n=Yb(e);return t?t.split(/\s+/).filter(Boolean).includes(n)?t:`${n} ${t}`:n},Et=v.forwardRef(({label:e,error:t,className:n="",onChange:r,onKeyPress:s,value:o,defaultValue:i,type:a="text",checked:l,defaultChecked:c,...d},u)=>{const f=a==="radio"||a==="checkbox",g=Kb(a,n),m=v.useRef(!1),p=v.useRef(null);v.useImperativeHandle(u,()=>p.current);const[y,b]=v.useState(o??i??"");v.useEffect(()=>{if(!f&&!m.current&&o!==void 0){if(p.current&&document.activeElement===p.current)return;b(o)}},[o,f]);const _=v.useCallback(()=>{m.current=!0},[]),x=v.useCallback(E=>{if(m.current=!1,r){const T=E.target.value;b(T);const P=new Event("change",{bubbles:!0});Object.defineProperty(P,"target",{writable:!1,value:{value:T}}),Object.defineProperty(P,"currentTarget",{writable:!1,value:{value:T}}),r(P)}},[r]),M=v.useCallback(E=>{const T=E.target.value;b(T),!m.current&&r&&r(E)},[r]),S=v.useCallback(E=>{m.current||s&&s(E)},[s]),{loadingactions:k,formdata:N,...C}=d;if(f)return h.jsx("input",{ref:p,type:a,className:g,onChange:r,checked:l,defaultChecked:c,value:o,...C});const w=o!==void 0?{value:y}:{defaultValue:i};return h.jsx("input",{ref:p,type:a,className:g,onChange:M,onKeyPress:S,onCompositionStart:_,onCompositionEnd:x,...w,...C})});Et.displayName="Input";const lr=({label:e,error:t,className:n="",onChange:r,value:s,defaultValue:o,...i})=>{const a=v.useRef(!1),l=v.useRef(null),[c,d]=v.useState(s??o??"");v.useEffect(()=>{!a.current&&s!==void 0&&d(s)},[s]);const u=v.useCallback(()=>{a.current=!0},[]),f=v.useCallback(M=>{if(a.current=!1,r){const S=M.target.value;d(S);const k=new Event("change",{bubbles:!0});Object.defineProperty(k,"target",{writable:!1,value:{value:S}}),Object.defineProperty(k,"currentTarget",{writable:!1,value:{value:S}}),r(k)}},[r]),g=v.useCallback(M=>{const S=M.target.value;d(S),!a.current&&r&&r(M)},[r]),{loadingactions:m,formdata:p,...y}=i,b=s!==void 0?{value:c}:{defaultValue:o},x=(n??"").split(/\s+/).filter(Boolean).includes("textarea")?n??"":["textarea",n].filter(Boolean).join(" ");return h.jsx("textarea",{ref:l,className:x,onChange:g,onCompositionStart:u,onCompositionEnd:f,...b,...y})},gn=({children:e,className:t="",...n})=>h.jsx("label",{className:t,...n,children:e}),I=v.forwardRef(({children:e,className:t="",...n},r)=>h.jsx("div",{ref:r,className:t,...n,children:e})),J=({children:e,className:t="",...n})=>h.jsx("span",{className:t,...n,children:e}),kt=({children:e,className:t="",...n})=>h.jsx("p",{className:t,...n,children:e}),Nn=({className:e="",alt:t="",...n})=>h.jsx("img",{className:e,alt:t,...n}),sl=({children:e,className:t="",...n})=>h.jsx("h1",{className:t,...n,children:e}),cr=({children:e,className:t="",...n})=>h.jsx("h2",{className:t,...n,children:e}),Xr=({children:e,className:t="",...n})=>h.jsx("h3",{className:t,...n,children:e}),iu=({children:e,className:t="",...n})=>h.jsx("h4",{className:t,...n,children:e}),ol=({children:e,className:t="",...n})=>h.jsx("ul",{className:t,...n,children:e}),Xb=({children:e,className:t="",...n})=>h.jsx("ol",{className:t,...n,children:e}),il=({children:e,className:t="",...n})=>h.jsx("li",{className:t,...n,children:e}),qr=({children:e,className:t="",...n})=>h.jsx("a",{className:t,...n,children:e}),al=({children:e,className:t="",...n})=>h.jsx("form",{className:t,...n,children:e}),Jn=({children:e,className:t="",...n})=>h.jsx("svg",{className:t,...n,children:e}),qb=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 Zb(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 Zr=({children:e,label:t,error:n,options:r,className:s="",value:o,onChange:i,disabled:a,searchable:l=!1,searchPlaceholder:c,editorAttrs:d,...u})=>{const[f,g]=v.useState(!1),[m,p]=v.useState(""),[y,b]=v.useState(null),_=v.useRef(null),x=v.useRef(null),M=v.useRef(null),S=v.useRef(null),k=v.useMemo(()=>r?Array.isArray(r)?r.length===0?[]:typeof r[0]=="string"?r.map(O=>({value:O,label:Zb(O)})):r:(qb.warn("options prop is not an array:",r),null):null,[r]),N=v.useMemo(()=>k&&k.find(z=>String(z.value)===String(o))?.label||"",[k,o]),C=v.useMemo(()=>{if(!k)return null;if(!l||m.trim()==="")return k;const O=m.trim().toLowerCase();return k.filter(z=>z.label.toLowerCase().includes(O)||String(z.value).toLowerCase().includes(O))},[k,l,m]);v.useEffect(()=>{if(f&&l){p("");const O=setTimeout(()=>M.current?.focus(),0);return()=>clearTimeout(O)}f||p("")},[f,l]);const w=v.useCallback(()=>{if(!x.current)return;const O=x.current.getBoundingClientRect(),z=window.innerHeight-O.bottom,j=z<280&&O.top>z;b(j?{bottom:window.innerHeight-O.top+4,left:O.left,width:O.width}:{top:O.bottom+4,left:O.left,width:O.width})},[]);v.useEffect(()=>{if(!f){b(null);return}return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[f,w]),v.useEffect(()=>{const O=z=>{const U=z.target;_.current&&!_.current.contains(U)&&(!S.current||!S.current.contains(U))&&g(!1)};return f&&document.addEventListener("mousedown",O),()=>{document.removeEventListener("mousedown",O)}},[f]),v.useEffect(()=>{const O=z=>{z.key==="Escape"&&f&&(g(!1),x.current?.focus())};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[f]);const E=()=>{a||g(!f)},T=O=>{i&&i({target:{value:O},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),x.current?.focus()};if(!k){const z=(s??"").split(/\s+/).filter(Boolean).includes("select")?s??"":["select",s].filter(Boolean).join(" ");return h.jsx("select",{className:z,value:o,onChange:i,disabled:a,...d,...u,children:e})}const P=(s??"").split(/\s+/).filter(O=>O&&!O.includes(":")).join(" "),L=P.includes("bg-"),F=/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(P),A=L?`${s}${F?"":" 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-sm text-gray-700 dark:text-gray-200 font-medium focus:ring-2 focus:ring-blue-500 focus:outline-none ${s}`,D={...d,...u};return h.jsxs(I,{ref:_,className:"relative",...D,children:[h.jsxs(le,{ref:x,type:"button",onClick:E,disabled:a,className:`${A} flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(J,{className:"truncate",children:N||" "}),h.jsx(Jn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&y&&Vn.createPortal(h.jsxs(I,{ref:S,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:y.top,bottom:y.bottom,left:y.left,width:y.width},role:"listbox",children:[l&&h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:h.jsx(Et,{ref:M,type:"text",value:m,onChange:O=>p(O.target.value),placeholder:c??"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":c??"Search"})}),h.jsxs(I,{className:"py-2 max-h-60 overflow-auto",children:[C&&C.length===0&&h.jsx(I,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:m?"No results":""}),(C??[]).map(O=>{const z=String(O.value)===String(o);return h.jsxs(le,{type:"button",onClick:()=>!O.disabled&&T(O.value),disabled:O.disabled,className:`w-full px-4 py-3 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${z?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-200"} ${O.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":z,children:[h.jsx(J,{children:O.label}),z&&h.jsx(Jn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},O.value)})]})]}),document.body)]})},Qb=({children:e,className:t="",...n})=>h.jsx("option",{className:t,...n,children:e}),Jb=({children:e,className:t="",...n})=>h.jsx("optgroup",{className:t,...n,children:e}),On=v.forwardRef(({label:e,className:t="",indeterminate:n=!1,...r},s)=>{const o=v.useRef(null),i=a=>{o.current=a,typeof s=="function"?s(a):s&&(s.current=a)};return v.useEffect(()=>{o.current&&(o.current.indeterminate=n)},[n]),h.jsx("input",{ref:i,type:"checkbox",className:t,...r})});On.displayName="Checkbox";const ll=({children:e,className:t="",...n})=>h.jsx("table",{className:t,...n,children:e}),cl=({children:e,className:t="",...n})=>h.jsx("thead",{className:t,...n,children:e}),dl=({children:e,className:t="",...n})=>h.jsx("tbody",{className:t,...n,children:e}),ul=({children:e,className:t="",...n})=>h.jsx("tfoot",{className:t,...n,children:e}),dr=({children:e,className:t="",...n})=>h.jsx("tr",{className:t,...n,children:e}),Qr=({children:e,className:t="",...n})=>h.jsx("th",{className:t,...n,children:e}),rn=({children:e,className:t="",...n})=>h.jsx("td",{className:t,...n,children:e}),Jo=({children:e,className:t="",...n})=>h.jsx("nav",{className:t,...n,children:e}),au=({children:e,className:t="",...n})=>h.jsx("section",{className:t,...n,children:e}),ae=({name:e,iconStyle:t="solid",size:n,color:r,spin:s=!1,pulse:o=!1,fixedWidth:i=!1,ariaLabel:a,className:l="",style:c,...d})=>{const u={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},f={"fa-solid":"solid","fa-regular":"regular","fa-light":"light","fa-duotone":"duotone","fa-brands":"brands"},g=typeof e=="string"?e:String(e);let m=t,p=g;for(const[_,x]of Object.entries(f))if(g.startsWith(_+" ")){m=x,p=g.substring(_.length+1);break}p=p.replace(/^fa-/,"");const y=[u[m],`fa-${p}`,n&&`fa-${n}`,s&&"fa-spin",o&&"fa-pulse",i&&"fa-fw",r,l].filter(Boolean).join(" "),b=a||p.replace(/-/g," ");return h.jsx("i",{className:y,style:c,"aria-label":b,role:"img",...d})},Rb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-8 h-8"},lu={xs:"xs",sm:"sm",md:void 0,lg:"lg",xl:"2x"},ey=({icon:e,size:t="md",className:n="",color:r,ariaLabel:s})=>{const o=e.indexOf(":"),i=e.startsWith("fa-")||e.startsWith("fas ")||e.startsWith("far ")||e.startsWith("fab ")||e.startsWith("fal ")||e.startsWith("fad ");let a,l;i?(a="fa",l=e):o>0?(a=e.substring(0,o),l=e.substring(o+1)):(a="fa",l=e);const c=Rb[t],d=r||"";switch(a){case"fa":return h.jsx(ae,{name:l,size:lu[t],className:n,color:r,ariaLabel:s});case"svg":return h.jsx("img",{src:l,className:`${c} ${d} ${n}`.trim(),alt:s||"","aria-label":s,role:"img"});case"img":return h.jsx("img",{src:l,className:`${c} ${n}`.trim(),alt:s||"",role:"img"});default:return h.jsx(ae,{name:e,size:lu[t],className:n,color:r,ariaLabel:s})}},ty=({children:e,className:t="",...n})=>h.jsx("code",{className:t,...n,children:e}),ny=({children:e,className:t="",...n})=>h.jsx("pre",{className:t,...n,children:e}),ry=({children:e})=>h.jsx(h.Fragment,{children:e}),sy=({className:e="",...t})=>h.jsx("hr",{className:e,...t}),yt=({className:e="",children:t,style:n,...r})=>h.jsx("i",{className:e,style:n,...r,children:t});var he=(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.CaretRight="fa-caret-right",e.CaretDown="fa-caret-down",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.Cube="fa-cube",e.Cubes="fa-cubes",e.Plug="fa-plug",e.PuzzlePiece="fa-puzzle-piece",e.Palette="fa-palette",e))(he||{});const oy=({title:e,content:t,imageUrl:n,imageAlt:r="",className:s="",onClick:o,style:i,id:a,editorAttrs:l})=>h.jsxs(I,{className:`card-clickable ${s}`,onClick:o,style:i,id:a,...l,children:[n&&h.jsx(I,{className:"w-full",children:h.jsx(Nn,{src:n,alt:r,className:"card-image"})}),h.jsxs(I,{className:"p-4",children:[e&&h.jsx(cr,{className:"card-title",children:e}),t&&h.jsx(kt,{className:"card-content",children:t})]})]}),Vs=({items:e,triggerLabel:t="작업",triggerIconName:n=he.EllipsisVertical,position:r="right",className:s="",style:o,children:i,onItemClick:a,id:l,editorAttrs:c})=>{const[d,u]=v.useState(!1),[f,g]=v.useState({top:0,left:0}),m=v.useRef(null),p=v.useRef(null),y=v.useCallback(()=>{if(!m.current)return;const x=m.current.getBoundingClientRect(),M=224;let S=r==="right"?x.right-M:x.left;const k=x.bottom+8;S<8&&(S=8),S+M>window.innerWidth-8&&(S=window.innerWidth-M-8),g({top:k,left:S})},[r]);v.useEffect(()=>{d&&y()},[d,y]),v.useEffect(()=>{if(!d)return;const x=()=>{u(!1)};return window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[d]),v.useEffect(()=>{const x=M=>{const S=M.target,k=m.current?.contains(S),N=p.current?.contains(S);!k&&!N&&u(!1)};return d&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[d]);const b=x=>{x.disabled||(x.onClick&&x.onClick(),a&&a(x.id,x),u(!1))},_=d?Vn.createPortal(h.jsx("div",{ref:p,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:f.top,left:f.left},children:e.filter(x=>x.if!==!1).map(x=>{if(x.divider)return h.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600 my-1"},x.id);const M=x.variant==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",S=x.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer";return h.jsxs("div",{onClick:()=>b(x),className:`flex items-center gap-3 px-4 py-3 transition-colors ${M} ${S}`,children:[x.iconName&&h.jsx(ae,{name:x.iconName,className:"w-4 h-4"}),h.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.id)})}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,id:l,...c,children:[i?h.jsx(I,{ref:m,onClick:()=>u(!d),className:"cursor-pointer",children:i}):h.jsxs(le,{ref:m,onClick:()=>u(!d),className:"flex items-center gap-2 px-2 py-1 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[t&&h.jsx(J,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t}),n&&h.jsx(ae,{name:n,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]}),_]})},Jr=(e,t)=>window.G7Core?.t?.(e,t)??e,Ro=({currentPage:e,totalPages:t,onPageChange:n,maxVisiblePages:r=5,showFirstLast:s=!0,showFirst:o,showLast:i,hasMorePages:a,className:l="",style:c,prevText:d,nextText:u,id:f,editorAttrs:g})=>{const m=t!=null,p=m?t:0,y=m?e{const N=[];if(!m)return N;if(p<=r+2)for(let C=1;C<=p;C++)N.push(C);else{const C=Math.floor(r/2);let w=Math.max(2,e-C),E=Math.min(p-1,e+C);e<=C+1?E=r:e>=p-C&&(w=p-r+1),N.push(1),w>2&&N.push("...");for(let T=w;T<=E;T++)N.push(T);E1&&N.push(p)}return N},[e,p,m,r]),M=N=>{N<1||N===e||m&&N>p||n(N)},S=()=>{e>1&&n(e-1)},k=()=>{y&&n(e+1)};return h.jsxs(I,{className:`pagination ${l}`,style:c,role:"navigation","aria-label":Jr("common.pagination"),id:f,...g,children:[b&&h.jsx(le,{onClick:()=>M(1),disabled:e===1,className:"pagination-btn","aria-label":Jr("common.first_page"),children:"«"}),h.jsx(le,{onClick:S,disabled:e===1,className:"pagination-btn","aria-label":Jr("common.prev_page"),children:d||h.jsx(h.Fragment,{children:"‹"})}),h.jsxs(I,{className:"pagination",children:[!m&&h.jsx(J,{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:e}),x.map((N,C)=>{if(N==="...")return h.jsx(J,{className:"pagination-ellipsis",children:"..."},`ellipsis-${C}`);const w=N,E=w===e;return h.jsx(le,{onClick:()=>M(w),className:E?"pagination-btn-active":"pagination-btn","aria-label":Jr("common.page_n",{n:w}),"aria-current":E?"page":void 0,children:w},w)})]}),h.jsx(le,{onClick:k,disabled:!y,className:"pagination-btn","aria-label":Jr("common.next_page"),children:u||h.jsx(h.Fragment,{children:"›"})}),_&&h.jsx(le,{onClick:()=>M(p),disabled:e===p,className:"pagination-btn","aria-label":Jr("common.last_page"),children:"»"})]})},cu=(e,t)=>window.G7Core?.t?.(e,t)??e,iy=()=>window.G7Core?.locale?.supported?.()??["ko","en"],ay=()=>window.G7Core?.locale?.current?.()??"ko",du=e=>{const t=cu(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},ly=()=>iy().map(t=>({code:t,name:du(t),nativeName:du(t)})),fl=({value:e={},onChange:t,inputType:n="text",layout:r="inline",availableLocales:s,defaultLocale:o,placeholder:i="",required:a=!1,disabled:l=!1,maxLength:c,rows:d=4,className:u="",name:f="multilingual_input",showCodeOnMobile:g=!1,error:m,id:p,editorAttrs:y})=>{const b=!!m,_=v.useMemo(()=>s??ly(),[s]),x=v.useMemo(()=>o??ay(),[o]),M=v.useRef(e),[S,k]=v.useState(e),N=v.useRef(JSON.stringify(e));v.useEffect(()=>{const K=JSON.stringify(e);K!==N.current&&(N.current=K,M.current=e,k(e))},[e]);const C=v.useCallback((K,Q)=>{const ne={target:{name:f,value:K}};Q&&(ne._changedKeys=Q),t?.(ne)},[t,f]),[w,E]=v.useState(()=>{if(r==="tabs"||r==="compact"){const ne=_.map(ue=>ue.code);return[x,...ne.filter(ue=>ue!==x)]}const K=Object.keys(e).filter(ne=>e[ne]!==void 0);if(K.length===0)return[x];const Q=[];return K.includes(x)&&Q.push(x),K.forEach(ne=>{ne!==x&&Q.push(ne)}),Q}),[T,P]=v.useState(x),L=v.useMemo(()=>_.filter(K=>!w.includes(K.code)),[_,w]),[F,A]=v.useState(!1);v.useEffect(()=>{if(r==="tabs"||r==="compact"){const ue=_.map(de=>de.code),ee=[x,...ue.filter(de=>de!==x)],me=w.join(","),ie=ee.join(",");me!==ie&&E(ee);return}const K=Object.keys(e).filter(ue=>e[ue]!==void 0);if(K.length===0){E([x]);return}const Q=[];K.includes(x)&&Q.push(x),K.forEach(ue=>{ue!==x&&Q.push(ue)});const ne=w.join(","),se=Q.join(",");ne!==se&&E(Q)},[e,x,r,_]);const D=v.useCallback((K,Q)=>{const ne={...M.current,[K]:Q};M.current=ne,k(ne),C(ne,[K])},[C]),O=v.useCallback(K=>{E(ne=>[...ne,K]),P(K),A(!1);const Q={...M.current,[K]:""};M.current=Q,k(Q),C(Q)},[C]),z=v.useCallback(K=>{if(K===x)return;E(ne=>ne.filter(se=>se!==K)),T===K&&P(x);const Q={...M.current};delete Q[K],M.current=Q,k(Q),C(Q)},[T,x,C]),U=v.useCallback(K=>{const Q=_.find(ne=>ne.code===K);return Q?.nativeName||Q?.name||K.toUpperCase()},[_]),j=v.useCallback(K=>!!S[K]?.trim(),[S]),Y=v.useCallback(()=>L.length===0?null:h.jsxs(I,{className:"relative",children:[h.jsxs(le,{type:"button",className:"inline-flex items-center gap-1 px-3 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50 rounded-full border border-dashed border-blue-300 dark:border-blue-600 transition-colors",onClick:()=>A(!F),disabled:l,children:[h.jsx(ae,{name:"plus",className:"w-3 h-3"}),h.jsx(J,{children:cu("common.add_language")})]}),F&&h.jsx(I,{className:"absolute top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10 min-w-[120px]",children:L.map(K=>h.jsxs(le,{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 first:rounded-t-lg last:rounded-b-lg transition-colors",onClick:()=>O(K.code),children:[h.jsx(ae,{name:"globe",className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500"}),h.jsx(J,{children:K.nativeName||K.name})]},K.code))})]}),[L,F,l,O]),B=v.useCallback((K,Q=!1)=>{const ne=b?"input input-error":"input",se=b?"textarea input-error":"textarea",ue=K===x,ee=`${i}${i?" (":""}${U(K)}${i?")":""}`;return h.jsxs(I,{className:"space-y-2",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsxs(J,{className:` +var SirsoftAdminBasic=(function(R,h,v,Vn){"use strict";var eD=Object.defineProperty;var tD=(R,h,v)=>h in R?eD(R,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):R[h]=v;var $e=(R,h,v)=>tD(R,typeof h!="symbol"?h+"":h,v);var Xa,Cr;function Wb(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const $=Wb(v),Gb=()=>window.G7Core,le=v.forwardRef(({children:e,variant:t="primary",size:n="md",className:r="",...s},o)=>{const i="button",a=Gb()?.style?.mergeClasses?.(i,r)??`${i} ${r}`;return h.jsx("button",{ref:o,className:a,...s,children:e})});le.displayName="Button";const ou=v.forwardRef(({accept:e,maxSize:t,onChange:n,onError:r,buttonText:s="Browse",placeholder:o="No file selected",className:i="",disabled:a,...l},c)=>{const d=v.useRef(null),u=c||d,[f,g]=v.useState(""),m={},p={};Object.entries(l).forEach(([x,M])=>{x.startsWith("data-editor-")||x==="id"||x==="onMouseMove"||x==="onMouseLeave"?m[x]=M:p[x]=M});const y=v.useCallback(()=>{!a&&u.current&&u.current.click()},[a,u]),b=v.useCallback(x=>{const M=x.target.files?.[0]||null;if(!M){g(""),n?.({target:{value:null,name:""}});return}if(t&&M.size>t*1024*1024){const S=`File size exceeds ${t}MB limit`;r?.(S),u.current&&(u.current.value=""),g("");return}g(M.name),n?.({target:{value:M,name:M.name}})},[t,n,r,u]),_=v.useCallback(x=>{x.stopPropagation(),u.current&&(u.current.value=""),g(""),n?.({target:{value:null,name:""}})},[n,u]);return h.jsxs("div",{className:`flex items-center gap-2 ${i}`,...m,children:[h.jsx("input",{ref:u,type:"file",accept:e,onChange:b,disabled:a,className:"hidden",...p}),h.jsx("button",{type:"button",onClick:y,disabled:a,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:s}),h.jsx("span",{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:f||o}),f&&!a&&h.jsx("button",{type:"button",onClick:_,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:h.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});ou.displayName="FileInput";const Yb=e=>e==="checkbox"?"checkbox":e==="radio"?"radio":"input",Kb=(e,t)=>{const n=Yb(e);return t?t.split(/\s+/).filter(Boolean).includes(n)?t:`${n} ${t}`:n},Et=v.forwardRef(({label:e,error:t,className:n="",onChange:r,onKeyPress:s,value:o,defaultValue:i,type:a="text",checked:l,defaultChecked:c,...d},u)=>{const f=a==="radio"||a==="checkbox",g=Kb(a,n),m=v.useRef(!1),p=v.useRef(null);v.useImperativeHandle(u,()=>p.current);const[y,b]=v.useState(o??i??"");v.useEffect(()=>{if(!f&&!m.current&&o!==void 0){if(p.current&&document.activeElement===p.current)return;b(o)}},[o,f]);const _=v.useCallback(()=>{m.current=!0},[]),x=v.useCallback(E=>{if(m.current=!1,r){const T=E.target.value;b(T);const P=new Event("change",{bubbles:!0});Object.defineProperty(P,"target",{writable:!1,value:{value:T}}),Object.defineProperty(P,"currentTarget",{writable:!1,value:{value:T}}),r(P)}},[r]),M=v.useCallback(E=>{const T=E.target.value;b(T),!m.current&&r&&r(E)},[r]),S=v.useCallback(E=>{m.current||s&&s(E)},[s]),{loadingactions:k,formdata:N,...C}=d;if(f)return h.jsx("input",{ref:p,type:a,className:g,onChange:r,checked:l,defaultChecked:c,value:o,...C});const w=o!==void 0?{value:y}:{defaultValue:i};return h.jsx("input",{ref:p,type:a,className:g,onChange:M,onKeyPress:S,onCompositionStart:_,onCompositionEnd:x,...w,...C})});Et.displayName="Input";const lr=({label:e,error:t,className:n="",onChange:r,value:s,defaultValue:o,...i})=>{const a=v.useRef(!1),l=v.useRef(null),[c,d]=v.useState(s??o??"");v.useEffect(()=>{!a.current&&s!==void 0&&d(s)},[s]);const u=v.useCallback(()=>{a.current=!0},[]),f=v.useCallback(M=>{if(a.current=!1,r){const S=M.target.value;d(S);const k=new Event("change",{bubbles:!0});Object.defineProperty(k,"target",{writable:!1,value:{value:S}}),Object.defineProperty(k,"currentTarget",{writable:!1,value:{value:S}}),r(k)}},[r]),g=v.useCallback(M=>{const S=M.target.value;d(S),!a.current&&r&&r(M)},[r]),{loadingactions:m,formdata:p,...y}=i,b=s!==void 0?{value:c}:{defaultValue:o},x=(n??"").split(/\s+/).filter(Boolean).includes("textarea")?n??"":["textarea",n].filter(Boolean).join(" ");return h.jsx("textarea",{ref:l,className:x,onChange:g,onCompositionStart:u,onCompositionEnd:f,...b,...y})},gn=({children:e,className:t="",...n})=>h.jsx("label",{className:t,...n,children:e}),I=v.forwardRef(({children:e,className:t="",...n},r)=>h.jsx("div",{ref:r,className:t,...n,children:e})),J=({children:e,className:t="",...n})=>h.jsx("span",{className:t,...n,children:e}),kt=({children:e,className:t="",...n})=>h.jsx("p",{className:t,...n,children:e}),Nn=({className:e="",alt:t="",...n})=>h.jsx("img",{className:e,alt:t,...n}),sl=({children:e,className:t="",...n})=>h.jsx("h1",{className:t,...n,children:e}),cr=({children:e,className:t="",...n})=>h.jsx("h2",{className:t,...n,children:e}),Xr=({children:e,className:t="",...n})=>h.jsx("h3",{className:t,...n,children:e}),iu=({children:e,className:t="",...n})=>h.jsx("h4",{className:t,...n,children:e}),ol=({children:e,className:t="",...n})=>h.jsx("ul",{className:t,...n,children:e}),Xb=({children:e,className:t="",...n})=>h.jsx("ol",{className:t,...n,children:e}),il=({children:e,className:t="",...n})=>h.jsx("li",{className:t,...n,children:e}),qr=({children:e,className:t="",...n})=>h.jsx("a",{className:t,...n,children:e}),al=({children:e,className:t="",...n})=>h.jsx("form",{className:t,...n,children:e}),Jn=({children:e,className:t="",...n})=>h.jsx("svg",{className:t,...n,children:e}),qb=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 Zb(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 Zr=({children:e,label:t,error:n,options:r,className:s="",value:o,onChange:i,disabled:a,searchable:l=!1,searchPlaceholder:c,editorAttrs:d,...u})=>{const[f,g]=v.useState(!1),[m,p]=v.useState(""),[y,b]=v.useState(null),_=v.useRef(null),x=v.useRef(null),M=v.useRef(null),S=v.useRef(null),k=v.useMemo(()=>r?Array.isArray(r)?r.length===0?[]:typeof r[0]=="string"?r.map(O=>({value:O,label:Zb(O)})):r:(qb.warn("options prop is not an array:",r),null):null,[r]),N=v.useMemo(()=>k&&k.find(z=>String(z.value)===String(o))?.label||"",[k,o]),C=v.useMemo(()=>{if(!k)return null;if(!l||m.trim()==="")return k;const O=m.trim().toLowerCase();return k.filter(z=>z.label.toLowerCase().includes(O)||String(z.value).toLowerCase().includes(O))},[k,l,m]);v.useEffect(()=>{if(f&&l){p("");const O=setTimeout(()=>M.current?.focus(),0);return()=>clearTimeout(O)}f||p("")},[f,l]);const w=v.useCallback(()=>{if(!x.current)return;const O=x.current.getBoundingClientRect(),z=window.innerHeight-O.bottom,j=z<280&&O.top>z;b(j?{bottom:window.innerHeight-O.top+4,left:O.left,width:O.width}:{top:O.bottom+4,left:O.left,width:O.width})},[]);v.useEffect(()=>{if(!f){b(null);return}return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[f,w]),v.useEffect(()=>{const O=z=>{const U=z.target;_.current&&!_.current.contains(U)&&(!S.current||!S.current.contains(U))&&g(!1)};return f&&document.addEventListener("mousedown",O),()=>{document.removeEventListener("mousedown",O)}},[f]),v.useEffect(()=>{const O=z=>{z.key==="Escape"&&f&&(g(!1),x.current?.focus())};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[f]);const E=()=>{a||g(!f)},T=O=>{i&&i({target:{value:O},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),x.current?.focus()};if(!k){const z=(s??"").split(/\s+/).filter(Boolean).includes("select")?s??"":["select",s].filter(Boolean).join(" ");return h.jsx("select",{className:z,value:o,onChange:i,disabled:a,...d,...u,children:e})}const P=(s??"").split(/\s+/).filter(O=>O&&!O.includes(":")).join(" "),L=P.includes("bg-"),F=/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(P),A=L?`${s}${F?"":" 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-sm text-gray-700 dark:text-gray-200 font-medium focus:ring-2 focus:ring-blue-500 focus:outline-none ${s}`,D={...d,...u};return h.jsxs(I,{ref:_,className:"relative",...D,children:[h.jsxs(le,{ref:x,type:"button",onClick:E,disabled:a,className:`${A} flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(J,{className:"truncate",children:N||" "}),h.jsx(Jn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&y&&Vn.createPortal(h.jsxs(I,{ref:S,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:y.top,bottom:y.bottom,left:y.left,width:y.width},role:"listbox",children:[l&&h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:h.jsx(Et,{ref:M,type:"text",value:m,onChange:O=>p(O.target.value),placeholder:c??"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":c??"Search"})}),h.jsxs(I,{className:"py-2 max-h-60 overflow-auto",children:[C&&C.length===0&&h.jsx(I,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:m?"No results":""}),(C??[]).map(O=>{const z=String(O.value)===String(o);return h.jsxs(le,{type:"button",onClick:()=>!O.disabled&&T(O.value),disabled:O.disabled,className:`w-full px-4 py-3 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${z?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-200"} ${O.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":z,children:[h.jsx(J,{children:O.label}),z&&h.jsx(Jn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},O.value)})]})]}),document.body)]})},Qb=({children:e,className:t="",...n})=>h.jsx("option",{className:t,...n,children:e}),Jb=({children:e,className:t="",...n})=>h.jsx("optgroup",{className:t,...n,children:e}),On=v.forwardRef(({label:e,className:t="",indeterminate:n=!1,...r},s)=>{const o=v.useRef(null),i=a=>{o.current=a,typeof s=="function"?s(a):s&&(s.current=a)};return v.useEffect(()=>{o.current&&(o.current.indeterminate=n)},[n]),h.jsx("input",{ref:i,type:"checkbox",className:t,...r})});On.displayName="Checkbox";const ll=({children:e,className:t="",...n})=>h.jsx("table",{className:t,...n,children:e}),cl=({children:e,className:t="",...n})=>h.jsx("thead",{className:t,...n,children:e}),dl=({children:e,className:t="",...n})=>h.jsx("tbody",{className:t,...n,children:e}),ul=({children:e,className:t="",...n})=>h.jsx("tfoot",{className:t,...n,children:e}),dr=({children:e,className:t="",...n})=>h.jsx("tr",{className:t,...n,children:e}),Qr=({children:e,className:t="",...n})=>h.jsx("th",{className:t,...n,children:e}),rn=({children:e,className:t="",...n})=>h.jsx("td",{className:t,...n,children:e}),Jo=({children:e,className:t="",...n})=>h.jsx("nav",{className:t,...n,children:e}),au=({children:e,className:t="",...n})=>h.jsx("section",{className:t,...n,children:e}),ae=({name:e,iconStyle:t="solid",size:n,color:r,spin:s=!1,pulse:o=!1,fixedWidth:i=!1,ariaLabel:a,className:l="",style:c,...d})=>{const u={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},f={"fa-solid":"solid","fa-regular":"regular","fa-light":"light","fa-duotone":"duotone","fa-brands":"brands"},g=typeof e=="string"?e:String(e);let m=t,p=g;for(const[_,x]of Object.entries(f))if(g.startsWith(_+" ")){m=x,p=g.substring(_.length+1);break}p=p.replace(/^fa-/,"");const y=[u[m],`fa-${p}`,n&&`fa-${n}`,s&&"fa-spin",o&&"fa-pulse",i&&"fa-fw",r,l].filter(Boolean).join(" "),b=a||p.replace(/-/g," ");return h.jsx("i",{className:y,style:c,"aria-label":b,role:"img",...d})},Rb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-8 h-8"},lu={xs:"xs",sm:"sm",md:void 0,lg:"lg",xl:"2x"},ey=({icon:e,size:t="md",className:n="",color:r,ariaLabel:s})=>{const o=e.indexOf(":"),i=e.startsWith("fa-")||e.startsWith("fas ")||e.startsWith("far ")||e.startsWith("fab ")||e.startsWith("fal ")||e.startsWith("fad ");let a,l;i?(a="fa",l=e):o>0?(a=e.substring(0,o),l=e.substring(o+1)):(a="fa",l=e);const c=Rb[t],d=r||"";switch(a){case"fa":return h.jsx(ae,{name:l,size:lu[t],className:n,color:r,ariaLabel:s});case"svg":return h.jsx("img",{src:l,className:`${c} ${d} ${n}`.trim(),alt:s||"","aria-label":s,role:"img"});case"img":return h.jsx("img",{src:l,className:`${c} ${n}`.trim(),alt:s||"",role:"img"});default:return h.jsx(ae,{name:e,size:lu[t],className:n,color:r,ariaLabel:s})}},ty=({children:e,className:t="",...n})=>h.jsx("code",{className:t,...n,children:e}),ny=({children:e,className:t="",...n})=>h.jsx("pre",{className:t,...n,children:e}),ry=({children:e})=>h.jsx(h.Fragment,{children:e}),sy=({className:e="",...t})=>h.jsx("hr",{className:e,...t}),yt=({className:e="",children:t,style:n,...r})=>h.jsx("i",{className:e,style:n,...r,children:t});var he=(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.CaretRight="fa-caret-right",e.CaretDown="fa-caret-down",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.Cube="fa-cube",e.Cubes="fa-cubes",e.Plug="fa-plug",e.PuzzlePiece="fa-puzzle-piece",e.Palette="fa-palette",e))(he||{});const oy=({title:e,content:t,imageUrl:n,imageAlt:r="",className:s="",onClick:o,style:i,id:a,editorAttrs:l})=>h.jsxs(I,{className:`card-clickable ${s}`,onClick:o,style:i,id:a,...l,children:[n&&h.jsx(I,{className:"w-full",children:h.jsx(Nn,{src:n,alt:r,className:"card-image"})}),h.jsxs(I,{className:"p-4",children:[e&&h.jsx(cr,{className:"card-title",children:e}),t&&h.jsx(kt,{className:"card-content",children:t})]})]}),Vs=({items:e,triggerLabel:t="작업",triggerIconName:n=he.EllipsisVertical,position:r="right",className:s="",style:o,children:i,onItemClick:a,id:l,editorAttrs:c})=>{const[d,u]=v.useState(!1),[f,g]=v.useState({top:0,left:0}),m=v.useRef(null),p=v.useRef(null),y=v.useCallback(()=>{if(!m.current)return;const x=m.current.getBoundingClientRect(),M=224;let S=r==="right"?x.right-M:x.left;const k=x.bottom+8;S<8&&(S=8),S+M>window.innerWidth-8&&(S=window.innerWidth-M-8),g({top:k,left:S})},[r]);v.useEffect(()=>{d&&y()},[d,y]),v.useEffect(()=>{if(!d)return;const x=()=>{u(!1)};return window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[d]),v.useEffect(()=>{const x=M=>{const S=M.target,k=m.current?.contains(S),N=p.current?.contains(S);!k&&!N&&u(!1)};return d&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[d]);const b=x=>{x.disabled||(x.onClick&&x.onClick(),a&&a(x.id,x),u(!1))},_=d?Vn.createPortal(h.jsx("div",{ref:p,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:f.top,left:f.left},children:e.filter(x=>x.if!==!1).map(x=>{if(x.divider)return h.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600 my-1"},x.id);const M=x.variant==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",S=x.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer";return h.jsxs("div",{onClick:()=>b(x),className:`flex items-center gap-3 px-4 py-3 transition-colors ${M} ${S}`,children:[x.iconName&&h.jsx(ae,{name:x.iconName,className:"w-4 h-4"}),h.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.id)})}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,id:l,...c,children:[i?h.jsx(I,{ref:m,onClick:()=>u(!d),className:"cursor-pointer",children:i}):h.jsxs(le,{ref:m,onClick:()=>u(!d),className:"flex items-center gap-2 px-2 py-1 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[t&&h.jsx(J,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t}),n&&h.jsx(ae,{name:n,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]}),_]})},Jr=(e,t)=>window.G7Core?.t?.(e,t)??e,Ro=({currentPage:e,totalPages:t,onPageChange:n,maxVisiblePages:r=5,showFirstLast:s=!0,showFirst:o,showLast:i,hasMorePages:a,className:l="",style:c,prevText:d,nextText:u,id:f,editorAttrs:g})=>{const m=t!=null,p=m?t:0,y=m?e{const N=[];if(!m){const C=Math.floor(r/2),w=e<=r?1:e-C;w>1&&(N.push(1),w>2&&N.push("..."));for(let E=w;E<=e;E++)N.push(E);return a&&(N.push(e+1),N.push("...")),N}if(p<=r+2)for(let C=1;C<=p;C++)N.push(C);else{const C=Math.floor(r/2);let w=Math.max(2,e-C),E=Math.min(p-1,e+C);e<=C+1?E=r:e>=p-C&&(w=p-r+1),N.push(1),w>2&&N.push("...");for(let T=w;T<=E;T++)N.push(T);E1&&N.push(p)}return N},[e,p,m,r,a]),M=N=>{N<1||N===e||m&&N>p||n(N)},S=()=>{e>1&&n(e-1)},k=()=>{y&&n(e+1)};return h.jsxs(I,{className:`pagination ${l}`,style:c,role:"navigation","aria-label":Jr("common.pagination"),id:f,...g,children:[b&&h.jsx(le,{onClick:()=>M(1),disabled:e===1,className:"pagination-btn","aria-label":Jr("common.first_page"),children:"«"}),h.jsx(le,{onClick:S,disabled:e===1,className:"pagination-btn","aria-label":Jr("common.prev_page"),children:d||h.jsx(h.Fragment,{children:"‹"})}),h.jsx(I,{className:"pagination",children:x.map((N,C)=>{if(N==="...")return h.jsx(J,{className:"pagination-ellipsis",children:"..."},`ellipsis-${C}`);const w=N,E=w===e;return h.jsx(le,{onClick:()=>M(w),className:E?"pagination-btn-active":"pagination-btn","aria-label":Jr("common.page_n",{n:w}),"aria-current":E?"page":void 0,children:w},w)})}),h.jsx(le,{onClick:k,disabled:!y,className:"pagination-btn","aria-label":Jr("common.next_page"),children:u||h.jsx(h.Fragment,{children:"›"})}),_&&h.jsx(le,{onClick:()=>M(p),disabled:e===p,className:"pagination-btn","aria-label":Jr("common.last_page"),children:"»"})]})},cu=(e,t)=>window.G7Core?.t?.(e,t)??e,iy=()=>window.G7Core?.locale?.supported?.()??["ko","en"],ay=()=>window.G7Core?.locale?.current?.()??"ko",du=e=>{const t=cu(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},ly=()=>iy().map(t=>({code:t,name:du(t),nativeName:du(t)})),fl=({value:e={},onChange:t,inputType:n="text",layout:r="inline",availableLocales:s,defaultLocale:o,placeholder:i="",required:a=!1,disabled:l=!1,maxLength:c,rows:d=4,className:u="",name:f="multilingual_input",showCodeOnMobile:g=!1,error:m,id:p,editorAttrs:y})=>{const b=!!m,_=v.useMemo(()=>s??ly(),[s]),x=v.useMemo(()=>o??ay(),[o]),M=v.useRef(e),[S,k]=v.useState(e),N=v.useRef(JSON.stringify(e));v.useEffect(()=>{const K=JSON.stringify(e);K!==N.current&&(N.current=K,M.current=e,k(e))},[e]);const C=v.useCallback((K,Q)=>{const ne={target:{name:f,value:K}};Q&&(ne._changedKeys=Q),t?.(ne)},[t,f]),[w,E]=v.useState(()=>{if(r==="tabs"||r==="compact"){const ne=_.map(ue=>ue.code);return[x,...ne.filter(ue=>ue!==x)]}const K=Object.keys(e).filter(ne=>e[ne]!==void 0);if(K.length===0)return[x];const Q=[];return K.includes(x)&&Q.push(x),K.forEach(ne=>{ne!==x&&Q.push(ne)}),Q}),[T,P]=v.useState(x),L=v.useMemo(()=>_.filter(K=>!w.includes(K.code)),[_,w]),[F,A]=v.useState(!1);v.useEffect(()=>{if(r==="tabs"||r==="compact"){const ue=_.map(de=>de.code),ee=[x,...ue.filter(de=>de!==x)],me=w.join(","),ie=ee.join(",");me!==ie&&E(ee);return}const K=Object.keys(e).filter(ue=>e[ue]!==void 0);if(K.length===0){E([x]);return}const Q=[];K.includes(x)&&Q.push(x),K.forEach(ue=>{ue!==x&&Q.push(ue)});const ne=w.join(","),se=Q.join(",");ne!==se&&E(Q)},[e,x,r,_]);const D=v.useCallback((K,Q)=>{const ne={...M.current,[K]:Q};M.current=ne,k(ne),C(ne,[K])},[C]),O=v.useCallback(K=>{E(ne=>[...ne,K]),P(K),A(!1);const Q={...M.current,[K]:""};M.current=Q,k(Q),C(Q)},[C]),z=v.useCallback(K=>{if(K===x)return;E(ne=>ne.filter(se=>se!==K)),T===K&&P(x);const Q={...M.current};delete Q[K],M.current=Q,k(Q),C(Q)},[T,x,C]),U=v.useCallback(K=>{const Q=_.find(ne=>ne.code===K);return Q?.nativeName||Q?.name||K.toUpperCase()},[_]),j=v.useCallback(K=>!!S[K]?.trim(),[S]),Y=v.useCallback(()=>L.length===0?null:h.jsxs(I,{className:"relative",children:[h.jsxs(le,{type:"button",className:"inline-flex items-center gap-1 px-3 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50 rounded-full border border-dashed border-blue-300 dark:border-blue-600 transition-colors",onClick:()=>A(!F),disabled:l,children:[h.jsx(ae,{name:"plus",className:"w-3 h-3"}),h.jsx(J,{children:cu("common.add_language")})]}),F&&h.jsx(I,{className:"absolute top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10 min-w-[120px]",children:L.map(K=>h.jsxs(le,{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 first:rounded-t-lg last:rounded-b-lg transition-colors",onClick:()=>O(K.code),children:[h.jsx(ae,{name:"globe",className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500"}),h.jsx(J,{children:K.nativeName||K.name})]},K.code))})]}),[L,F,l,O]),B=v.useCallback((K,Q=!1)=>{const ne=b?"input input-error":"input",se=b?"textarea input-error":"textarea",ue=K===x,ee=`${i}${i?" (":""}${U(K)}${i?")":""}`;return h.jsxs(I,{className:"space-y-2",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsxs(J,{className:` inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium ${ue?"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300"} `,children:[h.jsx(ae,{name:"globe",className:"w-3 h-3"}),U(K),ue&&h.jsx(J,{className:"text-red-500 dark:text-red-400",children:"*"}),!ue&&h.jsx(le,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>z(K),disabled:l,children:h.jsx(ae,{name:"xmark",className:"w-3 h-3"})})]}),ue&&Q&&Y()]}),n==="textarea"?h.jsx(lr,{name:`${f}[${K}]`,value:S[K]||"",onChange:me=>D(K,me.target.value),placeholder:ee,required:a&&ue,disabled:l,maxLength:c,rows:d,className:`${se} resize-vertical`}):h.jsx(Et,{type:"text",name:`${f}[${K}]`,value:S[K]||"",onChange:me=>D(K,me.target.value),placeholder:ee,required:a&&ue,disabled:l,maxLength:c,className:ne})]},K)},[f,S,D,i,a,l,c,d,n,U,x,z,Y,b]),W=v.useCallback(K=>{const Q=b?"input input-error":"input",ne=b?"textarea input-error":"textarea",se=`${i}${i?" (":""}${U(K)}${i?")":""}`;return h.jsx(I,{children:n==="textarea"?h.jsx(lr,{name:`${f}[${K}]`,value:S[K]||"",onChange:ue=>D(K,ue.target.value),placeholder:se,required:a&&K===x,disabled:l,maxLength:c,rows:d,className:`${ne} resize-vertical`}):h.jsx(Et,{type:"text",name:`${f}[${K}]`,value:S[K]||"",onChange:ue=>D(K,ue.target.value),placeholder:se,required:a&&K===x,disabled:l,maxLength:c,className:Q})},K)},[f,S,D,i,a,l,c,d,n,x,U,b]),G=()=>h.jsx(I,{className:u,children:h.jsx(I,{className:"space-y-4",children:w.map((K,Q)=>B(K,Q===0))})}),V=()=>h.jsxs(I,{className:u,children:[h.jsxs(I,{className:"flex flex-wrap items-center gap-2 mb-3",children:[w.map(K=>h.jsxs(le,{type:"button",className:` @@ -280,4 +280,4 @@ self.addEventListener('message', async (e) => { * Released under the MIT License */class AO{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,r,s){const o=n.listeners[s],i=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:i,currentStep:Math.min(r-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=H0.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const o=r.items;let i=o.length-1,a=!1,l;for(;i>=0;--i)l=o[i],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(t),a=!0):(o[i]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,r,t,"progress")),o.length||(r.running=!1,this._notify(s,r,t,"complete"),r.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,s)=>Math.max(r,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var sr=new AO;const dm="transparent",DO={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=G0(e||dm),s=r.valid&&G0(t||dm);return s&&s.valid?s.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class IO{constructor(t,n,r,s){const o=n[r];s=_a([t.to,s,o,t.from]);const i=_a([t.from,o,s]);this._active=!0,this._fn=t.fn||DO[t.type||typeof i],this._easing=Do[t.easing]||Do.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=i,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],o=r-this._start,i=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(i,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=_a([t.to,n,s,t.from]),this._from=_a([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,s=this._prop,o=this._from,i=this._loop,a=this._to;let l;if(this._active=o!==a&&(i||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let s=0;s{const o=t[s];if(!Qe(o))return;const i={};for(const a of n)i[a]=o[a];(Dt(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(t,n){const r=n.options,s=PO(t,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&LO(t.options.$animations,r).then(()=>{t.options=r},()=>{}),o}_createAnimations(t,n){const r=this._properties,s=[],o=t.$animations||(t.$animations={}),i=Object.keys(n),a=Date.now();let l;for(l=i.length-1;l>=0;--l){const c=i[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const d=n[c];let u=o[c];const f=r.get(c);if(u)if(f&&u.active()){u.update(f,d,a);continue}else u.cancel();if(!f||!f.duration){t[c]=d;continue}o[c]=u=new IO(f,t,c,d),s.push(u)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return sr.add(this._chart,r),!0}}function LO(e,t){const n=[],r=Object.keys(t);for(let s=0;s0||!n&&o<0)return s.index}return null}function mm(e,t){const{chart:n,_cachedMeta:r}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=r,l=o.axis,c=i.axis,d=VO(o,i,r),u=t.length;let f;for(let g=0;gn[r].axis===t).shift()}function BO(e,t){return Os(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function jO(e,t,n){return Os(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function Po(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const Id=e=>e==="reset"||e==="none",bm=(e,t)=>t?e:Object.assign({},e),WO=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:hm(n,!0),values:null};class Ds{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ad(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Po(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(u,f,g,m)=>u==="x"?f:u==="r"?m:g,o=n.xAxisID=Je(r.xAxisID,Dd(t,"x")),i=n.yAxisID=Je(r.yAxisID,Dd(t,"y")),a=n.rAxisID=Je(r.rAxisID,Dd(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,i,a),d=n.vAxisID=s(l,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&z0(this._data,this),t._stacked&&Po(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(Qe(n)){const s=this._cachedMeta;this._data=zO(n,s)}else if(r!==n){if(r){z0(r,this);const s=this._cachedMeta;Po(s),s._parsed=[]}n&&Object.isExtensible(n)&&WN(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=Ad(n.vScale,n),n.stack!==r.stack&&(s=!0,Po(n),n.stack=r.stack),this._resyncElements(t),(s||o!==n._stacked)&&(mm(this,n._parsed),n._stacked=Ad(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:i}=r,a=o.axis;let l=t===0&&n===s.length?!0:r._sorted,c=t>0&&r._parsed[t-1],d,u,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{Dt(s[t])?f=this.parseArrayData(r,s,t,n):Qe(s[t])?f=this.parseObjectData(r,s,t,n):f=this.parsePrimitiveData(r,s,t,n);const g=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!m()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let s,o,i;for(s=0,o=n.length;s=0&&tthis.getContext(r,s,n),p=c.resolveNamedOptions(f,g,m,u);return p.$shared&&(p.$shared=l,o[i]=Object.freeze(bm(p,l))),p}_resolveAnimations(t,n,r){const s=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let l;if(s.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,n),f=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(f,this.getContext(t,r,n))}const c=new um(s,l&&l.animations);return l&&l._cacheable&&(o[i]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Id(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(r),i=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:i}}updateElement(t,n,r,s){Id(s)?Object.assign(t,r):this._resolveAnimations(n,s).update(t,r)}updateSharedOptions(t,n,r){t&&!Id(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=r.length,o=n.length,i=Math.min(o,s);i&&this.parse(0,i),o>s?this._insertElements(s,o-s,t):o{for(c.length+=n,a=c.length-1;a>=i;a--)c[a]=c[a-n]};for(l(o),a=t;as-o))}return e._cache.$bar}function YO(e){const t=e.iScale,n=GO(t,e.type);let r=t._length,s,o,i,a;const l=()=>{i===32767||i===-32768||(Ao(a)&&(r=Math.min(r,Math.abs(i-a)||r)),a=i)};for(s=0,o=n.length;s0?s[e-1]:null,a=eMath.abs(a)&&(l=a,c=i),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:i,max:a}}function ym(e,t,n,r){return Dt(e)?qO(e,t,n,r):t[n.axis]=n.parse(e,r),t}function vm(e,t,n,r){const s=e.iScale,o=e.vScale,i=s.getLabels(),a=s===o,l=[];let c,d,u,f;for(c=n,d=n+r;c=n?1:-1)}function QO(e){let t,n,r,s,o;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.based.controller.options.grouped),o=r.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=d=>{const u=d._parsed.find(g=>g[r.axis]===l),f=u&&u[d.vScale.axis];if(ft(f)||isNaN(f))return!0};for(const d of s)if(!(n!==void 0&&c(d))&&((o===!1||i.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&i.push(d.stack),d.index===t))break;return i.length||i.push(void 0),i}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(r=>t[r].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)t[Je(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,r){const s=this._getStacks(t,r),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,r=n.iScale,s=[];let o,i;for(o=0,i=n.data.length;oka(x,a,l,!0)?1:Math.max(M,M*n,S,S*n),m=(x,M,S)=>ka(x,a,l,!0)?-1:Math.min(M,M*n,S,S*n),p=g(0,c,u),y=g(It,d,f),b=m(ht,c,u),_=m(ht+It,d,f);r=(p-b)/2,s=(y-_)/2,o=-(p+b)/2,i=-(y+_)/2}return{ratioX:r,ratioY:s,offsetX:o,offsetY:i}}class $o extends Ds{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=l=>+r[l];if(Qe(r[t])){const{key:l="value"}=this._parsing;o=c=>+zr(r[c],l)}let i,a;for(i=t,a=t+n;i0&&!isNaN(t)?Ot*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=xd(n._parsed[t],r.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const r=this.chart;let s,o,i,a,l;if(!t){for(s=0,o=r.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),$e($o,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const u=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:u.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:s,pointStyle:r,borderRadius:i&&(a||u.borderRadius),index:c}}):[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});function Gr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Pd{constructor(t){$e(this,"options");this.options=t||{}}static override(t){Object.assign(Pd.prototype,t)}init(){}formats(){return Gr()}parse(){return Gr()}format(){return Gr()}add(){return Gr()}diff(){return Gr()}startOf(){return Gr()}endOf(){return Gr()}}var nT={_date:Pd};function rT(e,t,n,r){const{controller:s,data:o,_sorted:i}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&i&&o.length){const c=a._reversePixels?BN:bd;if(r){if(s._sharedOptions){const d=o[0],u=typeof d.getRange=="function"&&d.getRange(t);if(u){const f=c(o,t,n-u),g=c(o,t,n+u);return{lo:f.lo,hi:g.hi}}}}else{const d=c(o,t,n);if(l){const{vScale:u}=s._cachedMeta,{_parsed:f}=e,g=f.slice(0,d.lo+1).reverse().findIndex(p=>!ft(p[u.axis]));d.lo-=Math.max(0,g);const m=f.slice(d.hi).findIndex(p=>!ft(p[u.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:o.length-1}}function Ta(e,t,n,r,s){const o=e.getSortedVisibleDatasetMetas(),i=n[t];for(let a=0,l=o.length;a{l[i]&&l[i](t[n],s)&&(o.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(t.x,t.y,s))}),r&&!a?[]:o}var aT={modes:{index(e,t,n,r){const s=Wr(t,e),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?$d(e,s,o,r,i):Fd(e,s,o,!1,r,i),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(e,t,n,r){const s=Wr(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?$d(e,s,o,r,i):Fd(e,s,o,!1,r,i);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let d=0;dn.pos===t)}function Sm(e,t){return e.filter(n=>Cm.indexOf(n.pos)===-1&&n.box.axis===t)}function zo(e,t){return e.sort((n,r)=>{const s=t?r:n,o=t?n:r;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function lT(e){const t=[];let n,r,s,o,i,a;for(n=0,r=(e||[]).length;nc.box.fullSize),!0),r=zo(Fo(t,"left"),!0),s=zo(Fo(t,"right")),o=zo(Fo(t,"top"),!0),i=zo(Fo(t,"bottom")),a=Sm(t,"x"),l=Sm(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(l).concat(i).concat(a),chartArea:Fo(t,"chartArea"),vertical:r.concat(s).concat(l),horizontal:o.concat(i).concat(a)}}function _m(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function Em(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function fT(e,t,n,r){const{pos:s,box:o}=n,i=e.maxPadding;if(!Qe(s)){n.size&&(e[s]-=n.size);const u=r[n.stack]||{size:0,count:1};u.size=Math.max(u.size,n.horizontal?o.height:o.width),n.size=u.size/u.count,e[s]+=n.size}o.getPadding&&Em(i,o.getPadding());const a=Math.max(0,t.outerWidth-_m(i,e,"left","right")),l=Math.max(0,t.outerHeight-_m(i,e,"top","bottom")),c=a!==e.w,d=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function hT(e){const t=e.maxPadding;function n(r){const s=Math.max(t[r]-e[r],0);return e[r]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function gT(e,t){const n=t.maxPadding;function r(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(i=>{o[i]=Math.max(t[i],n[i])}),o}return r(e?["left","right"]:["top","bottom"])}function Vo(e,t,n,r){const s=[];let o,i,a,l,c,d;for(o=0,i=e.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const d=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/d,hBoxMaxHeight:i/2}),f=Object.assign({},s);Em(f,_n(r));const g=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),m=dT(l.concat(c),u);Vo(a.fullSize,g,u,m),Vo(l,g,u,m),Vo(c,g,u,m)&&Vo(l,g,u,m),hT(g),Mm(a.leftAndTop,g,u,m),g.x+=g.w,g.y+=g.h,Mm(a.rightAndBottom,g,u,m),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},at(a.chartArea,p=>{const y=p.box;Object.assign(y,e.chartArea),y.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Nm{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,s){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(t){return!0}updateConfig(t){}}class pT extends Nm{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Da="$chartjs",mT={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Om=e=>e===null||e==="";function bT(e,t){const n=e.style,r=e.getAttribute("height"),s=e.getAttribute("width");if(e[Da]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Om(s)){const o=am(e,"width");o!==void 0&&(e.width=o)}if(Om(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=am(e,"height");o!==void 0&&(e.height=o)}return e}const Tm=EO?{passive:!0}:!1;function yT(e,t,n){e&&e.addEventListener(t,n,Tm)}function vT(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,Tm)}function xT(e,t){const n=mT[e.type]||e.type,{x:r,y:s}=Wr(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:s!==void 0?s:null}}function Ia(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function wT(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Ia(a.addedNodes,r),i=i&&!Ia(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function kT(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Ia(a.removedNodes,r),i=i&&!Ia(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ho=new Map;let Am=0;function Dm(){const e=window.devicePixelRatio;e!==Am&&(Am=e,Ho.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function CT(e,t){Ho.size||window.addEventListener("resize",Dm),Ho.set(e,t)}function ST(e){Ho.delete(e),Ho.size||window.removeEventListener("resize",Dm)}function _T(e,t,n){const r=e.canvas,s=r&&Td(r);if(!s)return;const o=U0((a,l)=>{const c=s.clientWidth;n(a,l),c{const l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return i.observe(s),CT(e,o),i}function zd(e,t,n){n&&n.disconnect(),t==="resize"&&ST(e)}function ET(e,t,n){const r=e.canvas,s=U0(o=>{e.ctx!==null&&n(xT(o,e))},e);return yT(r,t,s),s}class MT extends Nm{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(bT(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[Da])return!1;const r=n[Da].initial;["height","width"].forEach(o=>{const i=r[o];ft(i)?n.removeAttribute(o):n.setAttribute(o,i)});const s=r.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[Da],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),i={attach:wT,detach:kT,resize:_T}[n]||ET;s[n]=i(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),s=r[n];if(!s)return;({attach:zd,detach:zd,resize:zd}[n]||vT)(t,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,s){return _O(t,n,r,s)}isAttached(t){const n=t&&Td(t);return!!(n&&n.isConnected)}}function NT(e){return!Od()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?pT:MT}let Yr=(Xa=class{constructor(){$e(this,"x");$e(this,"y");$e(this,"active",!1);$e(this,"options");$e(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return wa(this.x)&&wa(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const s={};return t.forEach(o=>{s[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),s}},$e(Xa,"defaults",{}),$e(Xa,"defaultRoutes"),Xa);function OT(e,t){const n=e.options.ticks,r=TT(e),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?DT(t):[],i=o.length,a=o[0],l=o[i-1],c=[];if(i>s)return IT(t,c,o,i/s),c;const d=AT(o,t,s);if(i>0){let u,f;const g=i>1?Math.round((l-a)/(i-1)):null;for(La(t,c,d,ft(g)?0:a-g,a),u=0,f=i-1;us)return l}return Math.max(s,1)}function DT(e){const t=[];let n,r;for(n=0,r=e.length;ne==="left"?"right":e==="right"?"left":e,Im=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Lm=(e,t)=>Math.min(t||e,e);function Pm(e,t){const n=[],r=e.length/t,s=e.length;let o=0;for(;oi+a)))return l}function FT(e,t){at(e,n=>{const r=n.gc,s=r.length/2;let o;if(s>t){for(o=0;or?r:n,r=s&&n>r?n:r,{min:Yn(n,Yn(r,n)),max:Yn(r,Yn(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){bt(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:s,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=dO(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),u=d.widest.width,f=d.highest.height,g=cn(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/r:g/(r-1),u+6>a&&(a=g/(r-(t.offset?.5:1)),l=this.maxHeight-Uo(t.grid)-n.padding-$m(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),i=VN(Math.min(Math.asin(cn((d.highest.height+6)/a,-1,1)),Math.asin(cn(l/c,-1,1))-Math.asin(cn(f/c,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){bt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){bt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const l=$m(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=Uo(o)+l):(t.height=this.maxHeight,t.width=Uo(o)+l),r.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:f}=this._getLabelSizes(),g=r.padding*2,m=rr(this.labelRotation),p=Math.cos(m),y=Math.sin(m);if(a){const b=r.mirror?0:y*u.width+p*f.height;t.height=Math.min(this.maxHeight,t.height+b+g)}else{const b=r.mirror?0:p*u.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+b+g)}this._calculatePadding(c,d,y,p)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,s){const{ticks:{align:o,padding:i},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,g=0;l?c?(f=s*t.width,g=r*n.height):(f=r*t.height,g=s*n.width):o==="start"?g=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,g=n.width/2),this.paddingLeft=Math.max((f-d+i)*this.width/(this.width-d),0),this.paddingRight=Math.max((g-u+i)*this.width/(this.width-u),0)}else{let d=n.height/2,u=t.height/2;o==="start"?(d=0,u=t.height):o==="end"&&(d=n.height,u=0),this.paddingTop=d+i,this.paddingBottom=u+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){bt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n({width:i[w]||0,height:a[w]||0});return{first:C(0),last:C(n-1),widest:C(k),highest:C(N),widths:i,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return UN(this._alignToPixels?Br(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&ta*s?a/r:l/s:l*s0}_computeGridLineItems(t){const n=this.axis,r=this.chart,s=this.options,{grid:o,position:i,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=Uo(o),g=[],m=a.setContext(this.getContext()),p=m.display?m.width:0,y=p/2,b=function(D){return Br(r,D,p)};let _,x,M,S,k,N,C,w,E,T,P,L;if(i==="top")_=b(this.bottom),N=this.bottom-f,w=_-y,T=b(t.top)+y,L=t.bottom;else if(i==="bottom")_=b(this.top),T=t.top,L=b(t.bottom)-y,N=_+y,w=this.top+f;else if(i==="left")_=b(this.right),k=this.right-f,C=_-y,E=b(t.left)+y,P=t.right;else if(i==="right")_=b(this.left),E=t.left,P=b(t.right)-y,k=_+y,C=this.left+f;else if(n==="x"){if(i==="center")_=b((t.top+t.bottom)/2+.5);else if(Qe(i)){const D=Object.keys(i)[0],O=i[D];_=b(this.chart.scales[D].getPixelForValue(O))}T=t.top,L=t.bottom,N=_+y,w=N+f}else if(n==="y"){if(i==="center")_=b((t.left+t.right)/2);else if(Qe(i)){const D=Object.keys(i)[0],O=i[D];_=b(this.chart.scales[D].getPixelForValue(O))}k=_-y,C=k-f,E=t.left,P=t.right}const F=Je(s.ticks.maxTicksLimit,u),A=Math.max(1,Math.ceil(u/F));for(x=0;x0&&(X-=G/2);break}Y={left:X,top:V,width:G+B.width,height:W+B.height,color:A.backdropColor}}y.push({label:M,font:w,textOffset:P,options:{rotation:p,color:O,strokeColor:z,strokeWidth:U,textAlign:j,textBaseline:L,translation:[S,k],backdrop:Y}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-rr(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:s,padding:o}}=this.options,i=this._getLabelSizes(),a=t+o,l=i.widest.width;let c,d;return n==="left"?s?(d=this.right+o,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?s?(d=this.left+o,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:s,width:o,height:i}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,s,o,i),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,i;const a=(l,c,d)=>{!d.width||!d.color||(r.save(),r.lineWidth=d.width,r.strokeStyle=d.color,r.setLineDash(d.borderDash||[]),r.lineDashOffset=d.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(o=0,i=s.length;o{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let o,i;for(o=0,i=n.length;o{const r=n.split("."),s=r.pop(),o=[e].concat(r).join("."),i=t[n].split("."),a=i.pop(),l=i.join(".");_t.route(o,s,l,a)})}function WT(e){return"id"in e&&"defaults"in e}class GT{constructor(){this.controllers=new Pa(Ds,"datasets",!0),this.elements=new Pa(Yr,"elements"),this.plugins=new Pa(Object,"plugins"),this.scales=new Pa(Is,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(s=>{const o=r||this._getRegistryForType(s);r||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):at(s,i=>{const a=r||this._getRegistryForType(i);this._exec(t,a,i)})})}_exec(t,n,r){const s=pd(t);bt(r["before"+s],[],r),n[t](r),bt(r["after"+s],[],r)}_getRegistryForType(t){for(let n=0;no.filter(a=>!i.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,r),t,"stop"),this._notify(s(r,n),t,"start")}}function KT(e){const t={},n=[],r=Object.keys(Xn.plugins.items);for(let o=0;o1&&Fm(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function zm(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function e5(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return zm(e,"x",n[0])||zm(e,"y",n[0])}return{}}function t5(e,t){const n=Ur[e.type]||{scales:{}},r=t.scales||{},s=Vd(e.type,t),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!Qe(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const l=Hd(i,a,e5(i,e),_t.scales[a.type]),c=JT(l,s),d=n.scales||{};o[i]=To(Object.create(null),[{axis:l},a,d[l],d[c]])}),e.data.datasets.forEach(i=>{const a=i.type||e.type,l=i.indexAxis||Vd(a,t),d=(Ur[a]||{}).scales||{};Object.keys(d).forEach(u=>{const f=QT(u,l),g=i[f+"AxisID"]||f;o[g]=o[g]||Object.create(null),To(o[g],[{axis:f},r[g],d[u]])})}),Object.keys(o).forEach(i=>{const a=o[i];To(a,[_t.scales[a.type],_t.scale])}),o}function Vm(e){const t=e.options||(e.options={});t.plugins=Je(t.plugins,{}),t.scales=t5(e,t)}function Hm(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function n5(e){return e=e||{},e.data=Hm(e.data),Vm(e),e}const Um=new Map,Bm=new Set;function $a(e,t){let n=Um.get(e);return n||(n=t(),Um.set(e,n),Bm.add(n)),n}const Bo=(e,t,n)=>{const r=zr(t,n);r!==void 0&&e.add(r)};class r5{constructor(t){this._config=n5(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Hm(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Vm(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return $a(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return $a(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return $a(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return $a(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let s=r.get(t);return(!s||n)&&(s=new Map,r.set(t,s)),s}getOptionScopes(t,n,r){const{options:s,type:o}=this,i=this._cachedScopes(t,r),a=i.get(n);if(a)return a;const l=new Set;n.forEach(d=>{t&&(l.add(t),d.forEach(u=>Bo(l,t,u))),d.forEach(u=>Bo(l,s,u)),d.forEach(u=>Bo(l,Ur[o]||{},u)),d.forEach(u=>Bo(l,_t,u)),d.forEach(u=>Bo(l,wd,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Bm.has(n)&&i.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ur[n]||{},_t.datasets[n]||{},{type:n},_t,wd]}resolveNamedOptions(t,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=jm(this._resolverCache,t,s);let l=i;if(o5(i,n)){o.$shared=!1,r=vr(r)?r():r;const c=this.createResolver(t,r,a);l=Ts(i,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,r=[""],s){const{resolver:o}=jm(this._resolverCache,t,r);return Qe(n)?Ts(o,n,void 0,s):o}}function jm(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const s=n.join();let o=r.get(s);return o||(o={resolver:Ed(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const s5=e=>Qe(e)&&Object.getOwnPropertyNames(e).some(t=>vr(e[t]));function o5(e,t){const{isScriptable:n,isIndexable:r}=em(e);for(const s of t){const o=n(s),i=r(s),a=(i||o)&&e[s];if(o&&(vr(a)||s5(a))||i&&Dt(a))return!0}return!1}var i5="4.5.1";const a5=["top","bottom","left","right","chartArea"];function Wm(e,t){return e==="top"||e==="bottom"||a5.indexOf(e)===-1&&t==="x"}function Gm(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Ym(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),bt(n&&n.onComplete,[e],t)}function l5(e){const t=e.chart,n=t.options.animation;bt(n&&n.onProgress,[e],t)}function Km(e){return Od()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Fa={},Xm=e=>{const t=Km(e);return Object.values(Fa).filter(n=>n.canvas===t).pop()};function c5(e,t,n){const r=Object.keys(e);for(const s of r){const o=+s;if(o>=t){const i=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=i)}}}function d5(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}let jo=(Cr=class{static register(...t){Xn.add(...t),qm()}static unregister(...t){Xn.remove(...t),qm()}constructor(t,n){const r=this.config=new r5(n),s=Km(t),o=Xm(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||NT(s)),this.platform.updateConfig(r);const a=this.platform.acquireContext(s,i.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=MN(),this.ctx=a,this.canvas=l,this.width=d,this.height=c,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new YT,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=GN(u=>this.update(u),i.resizeDelay||0),this._dataChanges=[],Fa[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}sr.listen(this,"complete",Ym),sr.listen(this,"progress",l5),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return ft(t)?n&&o?o:s?r/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Xn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():im(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return q0(this.canvas,this.ctx),this}stop(){return sr.stop(this),this}resize(t,n){sr.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(s,t,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,im(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),bt(r.onResize,[this,i],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};at(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,s=Object.keys(r).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],l=Hd(i,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),at(o,i=>{const a=i.options,l=a.id,c=Hd(l,a),d=Je(a.type,i.dtype);(a.position===void 0||Wm(a.position,c)!==Wm(i.dposition))&&(a.position=i.dposition),s[l]=!0;let u=null;if(l in r&&r[l].type===d)u=r[l];else{const f=Xn.getScale(d);u=new f({id:l,type:d,ctx:this.ctx,chart:this}),r[u.id]=u}u.init(a,t)}),at(s,(i,a)=>{i||delete r[a]}),at(r,i=>{En.configure(this,i,i.options),En.addBox(this,i)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((s,o)=>s.index-o.index),r>n){for(let s=n;sn.length&&delete this._stacks,t.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let c=0,d=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Gm("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){at(this.scales,t=>{En.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!A0(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:o}of n){const i=r==="_removeElements"?-o:o;c5(t,s,i)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(t.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),s=r(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;En.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],at(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r={meta:t,index:t.index,cancelable:!0},s=TO(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Cd(n,s),t.controller.draw(),s&&Sd(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return J0(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,s){const o=aT.modes[n];return typeof o=="function"?o(this,t,r,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=Os(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const s=r?"show":"hide",o=this.getDatasetMeta(t),i=o.controller._resolveAnimations(void 0,s);Ao(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),i.update(o,{visible:r}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),sr.remove(this),t=0,n=this.data.datasets.length;t{n.addEventListener(this,o,i),t[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};at(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let i;const a=()=>{s("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",i)};i=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){at(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},at(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const s=r?"set":"remove";let o,i,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!ba(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),i=o(n,t),a=r?t:o(t,n);i.length&&this.updateHoverStyle(i,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=i=>(i.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:s=[],options:o}=this,i=n,a=this._getActiveElements(t,s,r,i),l=IN(t),c=d5(t,this._lastEvent,r,l);r&&(this._lastEvent=null,bt(o.onHover,[t,a,this],this),l&&bt(o.onClick,[t,a,this],this));const d=!ba(a,s);return(d||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,d}_getActiveElements(t,n,r,s){if(t.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},$e(Cr,"defaults",_t),$e(Cr,"instances",Fa),$e(Cr,"overrides",Ur),$e(Cr,"registry",Xn),$e(Cr,"version",i5),$e(Cr,"getChart",Xm),Cr);function qm(){return at(jo.instances,e=>e._plugins.invalidate())}function u5(e,t,n){const{startAngle:r,x:s,y:o,outerRadius:i,innerRadius:a,options:l}=t,{borderWidth:c,borderJoinStyle:d}=l,u=Math.min(c/i,Kn(r-n));if(e.beginPath(),e.arc(s,o,i-c/2,r+u/2,n-u/2),a>0){const f=Math.min(c/a,Kn(r-n));e.arc(s,o,a+c/2,n-f/2,r+f/2,!0)}else{const f=Math.min(c/2,i*Kn(r-n));if(d==="round")e.arc(s,o,f,n-ht/2,r+ht/2,!0);else if(d==="bevel"){const g=2*f*f,m=-g*Math.cos(n+ht/2)+s,p=-g*Math.sin(n+ht/2)+o,y=g*Math.cos(r+ht/2)+s,b=g*Math.sin(r+ht/2)+o;e.lineTo(m,p),e.lineTo(y,b)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function f5(e,t,n){const{startAngle:r,pixelMargin:s,x:o,y:i,outerRadius:a,innerRadius:l}=t;let c=s/a;e.beginPath(),e.arc(o,i,a,r-c,n+c),l>s?(c=s/l,e.arc(o,i,l,n+c,r-c,!0)):e.arc(o,i,s,n+It,r-It),e.closePath(),e.clip()}function h5(e){return _d(e,["outerStart","outerEnd","innerStart","innerEnd"])}function g5(e,t,n,r){const s=h5(e.options.borderRadius),o=(n-t)/2,i=Math.min(o,r*t/2),a=l=>{const c=(n-Math.min(o,l))*r/2;return cn(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:cn(s.innerStart,0,i),innerEnd:cn(s.innerEnd,0,i)}}function Ls(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function za(e,t,n,r,s,o){const{x:i,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=t,u=Math.max(t.outerRadius+r+n-c,0),f=d>0?d+r+n+c:0;let g=0;const m=s-l;if(r){const A=d>0?d-r:0,D=u>0?u-r:0,O=(A+D)/2,z=O!==0?m*O/(O+r):m;g=(m-z)/2}const p=Math.max(.001,m*u-n/ht)/u,y=(m-p)/2,b=l+y+g,_=s-y-g,{outerStart:x,outerEnd:M,innerStart:S,innerEnd:k}=g5(t,f,u,_-b),N=u-x,C=u-M,w=b+x/N,E=_-M/C,T=f+S,P=f+k,L=b+S/T,F=_-k/P;if(e.beginPath(),o){const A=(w+E)/2;if(e.arc(i,a,u,w,A),e.arc(i,a,u,A,E),M>0){const U=Ls(C,E,i,a);e.arc(U.x,U.y,M,E,_+It)}const D=Ls(P,_,i,a);if(e.lineTo(D.x,D.y),k>0){const U=Ls(P,F,i,a);e.arc(U.x,U.y,k,_+It,F+Math.PI)}const O=(_-k/f+(b+S/f))/2;if(e.arc(i,a,f,_-k/f,O,!0),e.arc(i,a,f,O,b+S/f,!0),S>0){const U=Ls(T,L,i,a);e.arc(U.x,U.y,S,L+Math.PI,b-It)}const z=Ls(N,b,i,a);if(e.lineTo(z.x,z.y),x>0){const U=Ls(N,w,i,a);e.arc(U.x,U.y,x,b-It,w)}}else{e.moveTo(i,a);const A=Math.cos(w)*u+i,D=Math.sin(w)*u+a;e.lineTo(A,D);const O=Math.cos(E)*u+i,z=Math.sin(E)*u+a;e.lineTo(O,z)}e.closePath()}function p5(e,t,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=t;let l=t.endAngle;if(o){za(e,t,n,r,l,s);for(let c=0;c=ht&&g===0&&d!=="miter"&&u5(e,t,p),o||(za(e,t,n,r,p,s),e.stroke())}class Wo extends Yr{constructor(n){super();$e(this,"circumference");$e(this,"endAngle");$e(this,"fullCircles");$e(this,"innerRadius");$e(this,"outerRadius");$e(this,"pixelMargin");$e(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,s){const o=this.getProps(["x","y"],s),{angle:i,distance:a}=$0(o,{x:n,y:r}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:u,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),g=(this.options.spacing+this.options.borderWidth)/2,m=Je(f,c-l),p=ka(i,l,c)&&l!==c,y=m>=Ot||p,b=Hr(a,d+g,u+g);return y&&b}getCenterPoint(n){const{x:r,y:s,startAngle:o,endAngle:i,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:d}=this.options,u=(o+i)/2,f=(a+l+d+c)/2;return{x:r+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:s}=this,o=(r.offset||0)/4,i=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=s>Ot?Math.floor(s/Ot):0,s===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(ht,s||0)),d=o*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,p5(n,this,d,i,a),m5(n,this,d,i,a),n.restore()}}$e(Wo,"id","arc"),$e(Wo,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),$e(Wo,"defaultRoutes",{backgroundColor:"backgroundColor"}),$e(Wo,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function Zm(e,t){const{x:n,y:r,base:s,width:o,height:i}=e.getProps(["x","y","base","width","height"],t);let a,l,c,d,u;return e.horizontal?(u=i/2,a=Math.min(n,s),l=Math.max(n,s),c=r-u,d=r+u):(u=o/2,a=n-u,l=n+u,c=Math.min(r,s),d=Math.max(r,s)),{left:a,top:c,right:l,bottom:d}}function kr(e,t,n,r){return e?0:cn(t,n,r)}function b5(e,t,n){const r=e.options.borderWidth,s=e.borderSkipped,o=R0(r);return{t:kr(s.top,o.top,0,n),r:kr(s.right,o.right,0,t),b:kr(s.bottom,o.bottom,0,n),l:kr(s.left,o.left,0,t)}}function y5(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=Ns(s),i=Math.min(t,n),a=e.borderSkipped,l=r||Qe(s);return{topLeft:kr(!l||a.top||a.left,o.topLeft,0,i),topRight:kr(!l||a.top||a.right,o.topRight,0,i),bottomLeft:kr(!l||a.bottom||a.left,o.bottomLeft,0,i),bottomRight:kr(!l||a.bottom||a.right,o.bottomRight,0,i)}}function v5(e){const t=Zm(e),n=t.right-t.left,r=t.bottom-t.top,s=b5(e,n/2,r/2),o=y5(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:n-s.l-s.r,h:r-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Ud(e,t,n,r){const s=t===null,o=n===null,a=e&&!(s&&o)&&Zm(e,r);return a&&(s||Hr(t,a.left,a.right))&&(o||Hr(n,a.top,a.bottom))}function x5(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function w5(e,t){e.rect(t.x,t.y,t.w,t.h)}function Bd(e,t,n={}){const r=e.x!==n.x?-t:0,s=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-r,i=(e.y+e.h!==n.y+n.h?t:0)-s;return{x:e.x+r,y:e.y+s,w:e.w+o,h:e.h+i,radius:e.radius}}class Va extends Yr{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:r,backgroundColor:s}}=this,{inner:o,outer:i}=v5(this),a=x5(i.radius)?Sa:w5;t.save(),(i.w!==o.w||i.h!==o.h)&&(t.beginPath(),a(t,Bd(i,n,o)),t.clip(),a(t,Bd(o,-n,i)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),a(t,Bd(o,n)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,n,r){return Ud(this,t,n,r)}inXRange(t,n){return Ud(this,t,null,n)}inYRange(t,n){return Ud(this,null,t,n)}getCenterPoint(t){const{x:n,y:r,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+s)/2:n,y:o?r:(r+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}$e(Va,"id","bar"),$e(Va,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),$e(Va,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const Qm=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},k5=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class Jm extends Yr{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=bt(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,s)=>t.sort(r,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,s=Rt(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Qm(r,o);let c,d;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(i,o,a,l)+10):(d=this.maxHeight,c=this._fitCols(i,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,s){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+a;let u=t;o.textAlign="left",o.textBaseline="middle";let f=-1,g=-d;return this.legendItems.forEach((m,p)=>{const y=r+n/2+o.measureText(m.text).width;(p===0||c[c.length-1]+y+2*a>i)&&(u+=d,c[c.length-(p>0?0:1)]=0,g+=d,f++),l[p]={left:0,top:g,row:f,width:y,height:s},c[c.length-1]+=y+a}),u}_fitCols(t,n,r,s){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=i-t;let u=a,f=0,g=0,m=0,p=0;return this.legendItems.forEach((y,b)=>{const{itemWidth:_,itemHeight:x}=C5(r,n,o,y,s);b>0&&g+x+2*a>d&&(u+=f+a,c.push({width:f,height:g}),m+=f+a,p++,f=g=0),l[b]={left:m,top:g,col:p,width:_,height:x},f=Math.max(f,_),g+=x+a}),u+=f,c.push({width:f,height:g}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:s},rtl:o}}=this,i=As(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Jt(r,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=Jt(r,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=i.leftForLtr(i.x(l),c.width),l+=c.width+s}else{let a=0,l=Jt(r,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=Jt(r,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=i.leftForLtr(i.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Cd(t,this),this._draw(),Sd(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=t,a=_t.color,l=As(t.rtl,this.left,this.width),c=Rt(i.font),{padding:d}=i,u=c.size,f=u/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:p,itemHeight:y}=Qm(i,u),b=function(k,N,C){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();const w=Je(C.lineWidth,1);if(s.fillStyle=Je(C.fillStyle,a),s.lineCap=Je(C.lineCap,"butt"),s.lineDashOffset=Je(C.lineDashOffset,0),s.lineJoin=Je(C.lineJoin,"miter"),s.lineWidth=w,s.strokeStyle=Je(C.strokeStyle,a),s.setLineDash(Je(C.lineDash,[])),i.usePointStyle){const E={radius:p*Math.SQRT2/2,pointStyle:C.pointStyle,rotation:C.rotation,borderWidth:w},T=l.xPlus(k,m/2),P=N+f;Q0(s,E,T,P,i.pointStyleWidth&&m)}else{const E=N+Math.max((u-p)/2,0),T=l.leftForLtr(k,m),P=Ns(C.borderRadius);s.beginPath(),Object.values(P).some(L=>L!==0)?Sa(s,{x:T,y:E,w:m,h:p,radius:P}):s.rect(T,E,m,p),s.fill(),w!==0&&s.stroke()}s.restore()},_=function(k,N,C){Lo(s,C.text,k,N+y/2,c,{strikethrough:C.hidden,textAlign:l.textAlign(C.textAlign)})},x=this.isHorizontal(),M=this._computeTitleHeight();x?g={x:Jt(o,this.left+d,this.right-r[0]),y:this.top+d+M,line:0}:g={x:this.left+d,y:Jt(o,this.top+M+d,this.bottom-n[0].height),line:0},lm(this.ctx,t.textDirection);const S=y+d;this.legendItems.forEach((k,N)=>{s.strokeStyle=k.fontColor,s.fillStyle=k.fontColor;const C=s.measureText(k.text).width,w=l.textAlign(k.textAlign||(k.textAlign=i.textAlign)),E=m+f+C;let T=g.x,P=g.y;l.setWidth(this.width),x?N>0&&T+E+d>this.right&&(P=g.y+=S,g.line++,T=g.x=Jt(o,this.left+d,this.right-r[g.line])):N>0&&P+S>this.bottom&&(T=g.x=T+n[g.line].width+d,g.line++,P=g.y=Jt(o,this.top+M+d,this.bottom-n[g.line].height));const L=l.x(T);if(b(L,P,k),T=YN(w,T+m+f,x?T+E:this.right,t.rtl),_(l.x(T),P,k),x)g.x+=E+d;else if(typeof k.text!="string"){const F=c.lineHeight;g.y+=Rm(k,F)+d}else g.y+=S}),cm(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=Rt(n.font),s=_n(n.padding);if(!n.display)return;const o=As(t.rtl,this.left,this.width),i=this.ctx,a=n.position,l=r.size/2,c=s.top+l;let d,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,u=Jt(t.align,u,this.right-f);else{const m=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);d=c+Jt(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const g=Jt(a,u,u+f);i.textAlign=o.textAlign(yd(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,Lo(i,n.text,g,d,r)}_computeTitleHeight(){const t=this.options.title,n=Rt(t.font),r=_n(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,s,o;if(Hr(t,this.left,this.right)&&Hr(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;ro.length>i.length?o:i)),t+n.size/2+r.measureText(s).width}function _5(e,t,n){let r=e;return typeof t.text!="string"&&(r=Rm(t,n)),r}function Rm(e,t){const n=e.text?e.text.length:0;return t*n}function E5(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var eb={id:"legend",_element:Jm,start(e,t,n){const r=e.legend=new Jm({ctx:e.ctx,options:n,chart:e});En.configure(e,r,n),En.addBox(e,r)},stop(e){En.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;En.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,s=n.chart;s.isDatasetVisible(r)?(s.hide(r),t.hidden=!0):(s.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),d=_n(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:i&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class tb extends Yr{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=Dt(r.text)?r.text.length:1;this._padding=_n(r.padding);const o=s*Rt(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:r,bottom:s,right:o,options:i}=this,a=i.align;let l=0,c,d,u;return this.isHorizontal()?(d=Jt(a,r,o),u=n+t,c=o-r):(i.position==="left"?(d=r+t,u=Jt(a,s,n),l=ht*-.5):(d=o-t,u=Jt(a,n,s),l=ht*.5),c=s-n),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const r=Rt(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);Lo(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:yd(n.align),textBaseline:"middle",translation:[i,a]})}}function M5(e,t){const n=new tb({ctx:e.ctx,options:t,chart:e});En.configure(e,n,t),En.addBox(e,n),e.titleBlock=n}var N5={id:"title",_element:tb,start(e,t,n){M5(e,n)},stop(e){const t=e.titleBlock;En.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;En.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Go={average(e){if(!e.length)return!1;let t,n,r=new Set,s=0,o=0;for(t=0,n=e.length;ta+l)/r.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,s=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=e.length;o-1?e.split(` -`):e}function O5(e,t){const{element:n,datasetIndex:r,index:s}=t,o=e.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:e,label:i,parsed:o.getParsed(s),raw:e.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function nb(e,t){const n=e.chart.ctx,{body:r,footer:s,title:o}=e,{boxWidth:i,boxHeight:a}=t,l=Rt(t.bodyFont),c=Rt(t.titleFont),d=Rt(t.footerFont),u=o.length,f=s.length,g=r.length,m=_n(t.padding);let p=m.height,y=0,b=r.reduce((M,S)=>M+S.before.length+S.lines.length+S.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),b){const M=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=g*M+(b-g)*l.lineHeight+(b-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*d.lineHeight+(f-1)*t.footerSpacing);let _=0;const x=function(M){y=Math.max(y,n.measureText(M).width+_)};return n.save(),n.font=c.string,at(e.title,x),n.font=l.string,at(e.beforeBody.concat(e.afterBody),x),_=t.displayColors?i+2+t.boxPadding:0,at(r,M=>{at(M.before,x),at(M.lines,x),at(M.after,x)}),_=0,n.font=d.string,at(e.footer,x),n.restore(),y+=m.width,{width:y,height:p}}function T5(e,t){const{y:n,height:r}=t;return ne.height-r/2?"bottom":"center"}function A5(e,t,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(e==="left"&&s+o+i>t.width||e==="right"&&s-o-i<0)return!0}function D5(e,t,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:l}}=e;let c="center";return r==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=i-o/2&&(c="right"),A5(c,e,t,n)&&(c="center"),c}function rb(e,t,n){const r=n.yAlign||t.yAlign||T5(e,n);return{xAlign:n.xAlign||t.xAlign||D5(e,t,n,r),yAlign:r}}function I5(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function L5(e,t,n){let{y:r,height:s}=e;return t==="top"?r+=n:t==="bottom"?r-=s+n:r-=s/2,r}function sb(e,t,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=Ns(i);let m=I5(t,a);const p=L5(t,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(d,f)+s:a==="right"&&(m+=Math.max(u,g)+s),{x:cn(m,0,r.width-t.width),y:cn(p,0,r.height-t.height)}}function Ha(e,t,n){const r=_n(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function ob(e){return qn([],or(e))}function P5(e,t,n){return Os(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function ib(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const ab={beforeTitle:nr,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex"u"?ab[t].call(n,r):s}class jd extends Yr{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new um(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=P5(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,s=dn(r,"beforeTitle",this,t),o=dn(r,"title",this,t),i=dn(r,"afterTitle",this,t);let a=[];return a=qn(a,or(s)),a=qn(a,or(o)),a=qn(a,or(i)),a}getBeforeBody(t,n){return ob(dn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,s=[];return at(t,o=>{const i={before:[],lines:[],after:[]},a=ib(r,o);qn(i.before,or(dn(a,"beforeLabel",this,o))),qn(i.lines,dn(a,"label",this,o)),qn(i.after,or(dn(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(t,n){return ob(dn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,s=dn(r,"beforeFooter",this,t),o=dn(r,"footer",this,t),i=dn(r,"afterFooter",this,t);let a=[];return a=qn(a,or(s)),a=qn(a,or(o)),a=qn(a,or(i)),a}_createItems(t){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],l,c;for(l=0,c=n.length;lt.filter(d,u,f,r))),t.itemSort&&(a=a.sort((d,u)=>t.itemSort(d,u,r))),at(a,d=>{const u=ib(t.callbacks,d);s.push(dn(u,"labelColor",this,d)),o.push(dn(u,"labelPointStyle",this,d)),i.push(dn(u,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Go[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const l=this._size=nb(this,r),c=Object.assign({},a,l),d=rb(this.chart,r,c),u=sb(r,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,s){const o=this.getCaretPosition(t,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=Ns(a),{x:f,y:g}=t,{width:m,height:p}=n;let y,b,_,x,M,S;return o==="center"?(M=g+p/2,s==="left"?(y=f,b=y-i,x=M+i,S=M-i):(y=f+m,b=y+i,x=M-i,S=M+i),_=y):(s==="left"?b=f+Math.max(l,d)+i:s==="right"?b=f+m-Math.max(c,u)-i:b=this.caretX,o==="top"?(x=g,M=x-i,y=b-i,_=b+i):(x=g+p,M=x+i,y=b+i,_=b-i),S=x),{x1:y,x2:b,x3:_,y1:x,y2:M,y3:S}}drawTitle(t,n,r){const s=this.title,o=s.length;let i,a,l;if(o){const c=As(r.rtl,this.x,this.width);for(t.x=Ha(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",i=Rt(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;l_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Sa(t,{x:p,y:m,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),Sa(t,{x:y,y:m+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,m,c,l),t.strokeRect(p,m,c,l),t.fillStyle=i.backgroundColor,t.fillRect(y,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=r,u=Rt(r.bodyFont);let f=u.lineHeight,g=0;const m=As(r.rtl,this.x,this.width),p=function(C){n.fillText(C,m.x(t.x+g),t.y+f/2),t.y+=f+o},y=m.textAlign(i);let b,_,x,M,S,k,N;for(n.textAlign=i,n.textBaseline="middle",n.font=u.string,t.x=Ha(this,y,r),n.fillStyle=r.bodyColor,at(this.beforeBody,p),g=a&&y!=="right"?i==="center"?c/2+d:c+2+d:0,M=0,k=s.length;M0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Go[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=nb(this,t),l=Object.assign({},i,this._size),c=rb(n,t,l),d=sb(t,l,c,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=_n(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,s,n),lm(t,n.textDirection),o.y+=i.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),cm(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!ba(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(t,o,n,r),a=this._positionChanged(i,t),l=n||!ba(i,o)||a;return l&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(t,n){const{caretX:r,caretY:s,options:o}=this,i=Go[o.position].call(this,t,n);return i!==!1&&(r!==i.x||s!==i.y)}}$e(jd,"positioners",Go);var lb={id:"tooltip",_element:jd,positioners:Go,afterInit(e,t,n){n&&(e.tooltip=new jd({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:ab},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const $5=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function F5(e,t,n,r){const s=e.indexOf(t);if(s===-1)return $5(e,t,n,r);const o=e.lastIndexOf(t);return s!==o?n:s}const z5=(e,t)=>e===null?null:cn(Math.round(e),0,t);function cb(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}$e(Wd,"id","category"),$e(Wd,"defaults",{ticks:{callback:cb}});function V5(e,t){const n=[],{bounds:s,step:o,min:i,max:a,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:f}=e,g=o||1,m=d-1,{min:p,max:y}=t,b=!ft(i),_=!ft(a),x=!ft(c),M=(y-p)/(u+1);let S=L0((y-p)/m/g)*g,k,N,C,w;if(S<1e-14&&!b&&!_)return[{value:p},{value:y}];w=Math.ceil(y/S)-Math.floor(p/S),w>m&&(S=L0(w*S/m/g)*g),ft(l)||(k=Math.pow(10,l),S=Math.ceil(S*k)/k),s==="ticks"?(N=Math.floor(p/S)*S,C=Math.ceil(y/S)*S):(N=p,C=y),b&&_&&o&&FN((a-i)/o,S/1e3)?(w=Math.round(Math.min((a-i)/S,d)),S=(a-i)/w,N=i,C=a):x?(N=b?i:N,C=_?a:C,w=c-1,S=(C-N)/w):(w=(C-N)/S,xa(w,Math.round(w),S/1e3)?w=Math.round(w):w=Math.ceil(w));const E=Math.max(P0(S),P0(N));k=Math.pow(10,ft(l)?E:l),N=Math.round(N*k)/k,C=Math.round(C*k)/k;let T=0;for(b&&(f&&N!==i?(n.push({value:i}),Na)break;n.push({value:P})}return _&&f&&C!==a?n.length&&xa(n[n.length-1].value,a,db(a,M,e))?n[n.length-1].value=a:n.push({value:a}):(!_||C===a)&&n.push({value:C}),n}function db(e,t,{horizontal:n,minRotation:r}){const s=rr(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class H5 extends Is{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return ft(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=l=>s=n?s:l,a=l=>o=r?o:l;if(t){const l=xr(s),c=xr(o);l<0&&c<0?a(0):l>0&&c>0&&i(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||i(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=V5(s,o);return t.bounds==="ticks"&&zN(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const s=(r-n)/Math.max(t.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return xd(t,this.chart.options.locale,this.options.ticks.format)}}class Gd extends H5{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Sn(t)?t:0,this.max=Sn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=rr(this.options.ticks.minRotation),s=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}$e(Gd,"id","linear"),$e(Gd,"defaults",{ticks:{callback:K0.formatters.numeric}});const Ua={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},un=Object.keys(Ua);function ub(e,t){return e-t}function fb(e,t){if(ft(t))return null;const n=e._adapter,{parser:r,round:s,isoWeekday:o}=e._parseOpts;let i=t;return typeof r=="function"&&(i=r(i)),Sn(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(wa(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function hb(e,t,n,r){const s=un.length;for(let o=un.indexOf(e);o=un.indexOf(n);o--){const i=un[o];if(Ua[i].common&&e._adapter.diff(s,r,i)>=t-1)return i}return un[n?un.indexOf(n):0]}function B5(e){for(let t=un.indexOf(e)+1,n=un.length;t=t?n[r]:n[s];e[o]=!0}}function j5(e,t,n,r){const s=e._adapter,o=+s.startOf(t[0].value,r),i=t[t.length-1].value;let a,l;for(a=o;a<=i;a=+s.add(a,1,r))l=n[a],l>=0&&(t[l].major=!0);return t}function pb(e,t,n){const r=[],s={},o=t.length;let i,a;for(i=0;i+t.value))}initOffsets(t=[]){let n=0,r=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const i=t.length<3?.5:.25;n=cn(n,0,i),r=cn(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||hb(o.minUnit,n,r,this._getLabelCapacity(n)),a=Je(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,c=wa(l)||l===!0,d={};let u=n,f,g;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":i),t.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,g=0;f+p)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(t,i)}_tickFormatFunction(t,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return bt(i,[t,n,r],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],u=c&&a[c],f=r[n],g=c&&u&&f&&f.major;return this._adapter.format(t,s||(g?u:d))}generateTickLabels(t){let n,r,s;for(n=0,r=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n=e[r].pos&&t<=e[s].pos&&({lo:r,hi:s}=bd(e,"pos",t)),{pos:o,time:a}=e[r],{pos:i,time:l}=e[s]):(t>=e[r].time&&t<=e[s].time&&({lo:r,hi:s}=bd(e,"time",t)),{time:o,pos:a}=e[r],{time:i,pos:l}=e[s]);const c=i-o;return c?a+(l-a)*(t-o)/c:a}class mb extends Ba{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=ja(n,this.min),this._tableRange=ja(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,s=[],o=[];let i,a,l,c,d;for(i=0,a=t.length;i=n&&c<=r&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;is-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(ja(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return ja(this._table,r*this._tableRange+this._minPos,!0)}}$e(mb,"id","timeseries"),$e(mb,"defaults",Ba.defaults);const bb="label";function yb(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function W5(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function vb(e,t){e.labels=t}function xb(e,t,n=bb){const r=[];e.datasets=t.map(s=>{const o=e.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function G5(e,t=bb){const n={labels:[],datasets:[]};return vb(n,e.labels),xb(n,e.datasets,t),n}function Y5(e,t){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:u,...f}=e,g=v.useRef(null),m=v.useRef(null),p=()=>{g.current&&(m.current=new jo(g.current,{type:i,data:G5(a,o),options:l&&{...l},plugins:c}),yb(t,m.current))},y=()=>{yb(t,null),m.current&&(m.current.destroy(),m.current=null)};return v.useEffect(()=>{!s&&m.current&&l&&W5(m.current,l)},[s,l]),v.useEffect(()=>{!s&&m.current&&vb(m.current.config.data,a.labels)},[s,a.labels]),v.useEffect(()=>{!s&&m.current&&a.datasets&&xb(m.current.config.data,a.datasets,o)},[s,a.datasets]),v.useEffect(()=>{m.current&&(s?(y(),setTimeout(p)):m.current.update(u))},[s,l,a.labels,a.datasets,u]),v.useEffect(()=>{m.current&&(y(),setTimeout(p))},[i]),v.useEffect(()=>(p(),()=>y()),[]),h.jsx("canvas",{ref:g,role:"img",height:n,width:r,...f,children:d})}const K5=v.forwardRef(Y5);function wb(e,t){return jo.register(t),v.forwardRef((n,r)=>h.jsx(K5,{...n,ref:r,type:e}))}const X5=wb("bar",Oa),q5=wb("doughnut",$o);jo.register(Wd,Gd,Va,N5,lb,eb);const Z5=({labels:e,datasets:t,height:n=200,showLegend:r=!1,showGrid:s=!1,showYGrid:o=!1,showYAxis:i=!1,className:a="",id:l,editorAttrs:c})=>{const d=v.useMemo(()=>({labels:e??[],datasets:(t??[]).map((m,p)=>({label:m.label,data:m.data,backgroundColor:m.backgroundColor||(p===0?"#7C3AED":"#DDD6FE"),borderRadius:m.borderRadius??4,barThickness:16,maxBarThickness:20,yAxisID:m.yAxisID??"y"}))}),[e,t]),u=v.useMemo(()=>(t??[]).some(m=>m.yAxisID==="y1"),[t]),f=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:{duration:750,easing:"easeOutQuart"},animations:{x:{duration:0},y:{from:m=>{if(m.type==="data")return m.chart.scales.y.getPixelForValue(0)}}},transitions:{active:{animation:{duration:200}},resize:{animation:{duration:0}}},plugins:{legend:{display:r,position:"top"},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8}},scales:{x:{grid:{display:s},border:{display:!1},ticks:{color:"#94a3b8",font:{size:11}}},y:{type:"linear",position:"left",grid:{display:o,color:"#e2e8f0"},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"},...u?{y1:{type:"linear",position:"right",grid:{display:!1},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"}}:{}}}),[r,s,o,i,u]),g=typeof n=="number"?n:/^\d+$/.test(String(n))?`${n}px`:n;return h.jsx("div",{className:`bar-chart-container ${a}`,style:{height:g},id:l,...c,children:h.jsx(X5,{data:d,options:f})})},Q5=v.memo(Z5,(e,t)=>JSON.stringify(e.labels)===JSON.stringify(t.labels)&&JSON.stringify(e.datasets)===JSON.stringify(t.datasets)&&e.height===t.height&&e.showLegend===t.showLegend&&e.showGrid===t.showGrid&&e.showYGrid===t.showYGrid&&e.showYAxis===t.showYAxis&&e.className===t.className&&e.id===t.id&&e.editorAttrs===t.editorAttrs);jo.register(Wo,lb,eb);const J5=({data:e,centerLabel:t,centerValue:n,size:r=200,cutout:s="70%",showLegend:o=!1,className:i="",id:a,editorAttrs:l})=>{const c=v.useMemo(()=>({labels:(e??[]).map(f=>f.name),datasets:[{data:(e??[]).map(f=>f.value),backgroundColor:(e??[]).map(f=>f.color),borderWidth:0,hoverOffset:4}]}),[e]),d=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,cutout:s,plugins:{legend:{display:o},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,callbacks:{label:f=>` $${f.parsed.toLocaleString()}`}}}}),[s,o]),u=typeof r=="number"?r:/^\d+$/.test(String(r))?`${r}px`:r;return h.jsx("div",{className:`donut-chart-wrapper ${i}`,id:a,...l,children:h.jsxs("div",{className:"relative",style:{width:u,height:u},children:[h.jsx(q5,{data:c,options:d}),(t||n)&&h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[t&&h.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:t}),n&&h.jsx("span",{className:"text-lg font-bold text-slate-900 dark:text-white",children:n})]})]})})},R5=({id:e,className:t,style:n,children:r,editorAttrs:s})=>h.jsx("div",{id:e,className:t,style:n,...s,children:r}),eA=({children:e,cols:t=1,responsive:n,gap:r,rowGap:s,colGap:o,autoRows:i,autoCols:a,flow:l="row",className:c="",style:d,onClick:u,id:f,editorAttrs:g})=>{const m=["grid"];if(t&&m.push(`grid-cols-${t}`),n&&(n.sm&&m.push(`sm:grid-cols-${n.sm}`),n.md&&m.push(`md:grid-cols-${n.md}`),n.lg&&m.push(`lg:grid-cols-${n.lg}`),n.xl&&m.push(`xl:grid-cols-${n.xl}`),n["2xl"]&&m.push(`2xl:grid-cols-${n["2xl"]}`)),r!==void 0&&r>0&&m.push(`gap-${r}`),s!==void 0&&s>0&&m.push(`gap-y-${s}`),o!==void 0&&o>0&&m.push(`gap-x-${o}`),i){const y={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};m.push(y[i])}if(a){const y={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};m.push(y[a])}const p={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 m.push(p[l]),c&&m.push(c),h.jsx(I,{className:m.join(" "),style:d,onClick:u,id:f,...g,children:e})},tA=({children:e,direction:t="row",justify:n="start",align:r="stretch",wrap:s="nowrap",gap:o=0,grow:i=!1,shrink:a=!0,className:l="",style:c,onClick:d,id:u,editorAttrs:f})=>{const g=["flex"],m={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};g.push(m[t]);const p={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};g.push(p[s]);const y={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(y[n]);const b={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(b[r]),o>0&&g.push(`gap-${o}`),i===!0?g.push("flex-grow"):typeof i=="number"&&i>0&&g.push(`flex-grow-${i}`),a===!1?g.push("shrink-0"):a===!0?g.push("flex-shrink"):typeof a=="number"&&a>0&&g.push(`flex-shrink-${a}`),l&&g.push(l),h.jsx(I,{className:g.join(" "),style:c,onClick:d,id:u,...f,children:e})},nA=({title:e,subtitle:t,children:n,padding:r="none",background:s="none",maxWidth:o,centered:i=!1,border:a=!1,shadow:l="none",rounded:c=!1,className:d="",style:u,onClick:f,id:g,editorAttrs:m})=>{const p=[],y={none:"",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};y[r]&&p.push(y[r]);const b={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(s!=="none"&&p.push(b[s]),o){const x={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"};p.push(x[o])}i&&p.push("mx-auto"),a&&p.push("border","border-gray-200","dark:border-gray-700");const _={none:"",sm:"shadow-sm",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"};return l!=="none"&&p.push(_[l]),c&&p.push("rounded-lg"),d&&p.push(d),h.jsxs(au,{className:p.join(" "),style:u,onClick:f,id:g,...m,children:[(e||t)&&h.jsxs("div",{className:"mb-4",children:[e&&h.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:e}),t&&h.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:t})]}),n]})},rA=({leftWidth:e="250px",rightWidth:t="300px",leftSlot:n,centerSlot:r,rightSlot:s,className:o="",style:i,id:a,editorAttrs:l})=>{const c=`flex flex-row w-full h-full ${o}`.trim(),d={width:e,flexShrink:0},u={flex:1,minWidth:0},f={width:t,flexShrink:0};return h.jsxs(I,{className:c,style:i,id:a,...l,children:[h.jsx(I,{className:"flex flex-col",style:d,children:n}),h.jsx(I,{className:"flex flex-col",style:u,children:r}),h.jsx(I,{className:"flex flex-col",style:f,children:s})]})},sA={identifier:"sirsoft-admin_basic",vendor:"sirsoft",name:{ko:"Admin Basic",en:"Admin Basic"},version:"1.0.8",license:"MIT",description:{ko:"그누보드7 기본 관리자 템플릿",en:"Gnuboard7 default admin template"},type:"admin",locales:["ko","en"],author:{name:"sirsoft",email:"contact@sirsoft.com",url:"https://sirsoft.com"},release_date:"2026-05-15",g7_version:">=7.0.10",dependencies:{modules:{},plugins:{}},assets:{css:["assets/css/main.css","assets/css/ui-system.css"],js:["dist/components.js"],fonts:["assets/fonts/"],images:["assets/images/"]},components:{basic:["a","button","checkbox","div","form","h1","h2","h3","hr","icon","img","input","label","li","nav","p","section","select","span","svg","table","tbody","td","textarea","th","thead","tr","ul"],composite:["action-menu","admin-footer","admin-header","admin-sidebar","alert-dialog","breadcrumb","card","confirm-dialog","data-grid","dialog","dropdown","empty-state","filter-group","icon-button","loading-spinner","modal","page-header","pagination","product-card","search-bar","stat-card","status-badge","tab-navigation","template-card","toast"],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"}},github_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic",github_changelog_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic/blob/main/CHANGELOG.md",externals:[{id:"fontawesome",type:"style",asset:"vendor/font-awesome/6.4.0/css/all.inlined.css"},{id:"pretendard",type:"webfont",asset:"vendor/pretendard/1.3.9/pretendard-variable.css"},{id:"flag-icons",type:"style",asset:"vendor/flag-icons/7.2.3/css/flag-icons.min.css"}]},ir=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)},Yd=["auto","light","dark"],kb="g7_color_scheme",oA=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,Wa=e=>{const t=oA(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function iA(){try{const e=localStorage.getItem(kb),t=e&&Yd.includes(e)?e:"auto";Wa(t);try{window.G7Core?.state?.setGlobal?.({theme:t})}catch(n){ir.warn("Failed to set global theme state:",n)}ir.log("Initial theme applied:",t)}catch(e){ir.warn("Failed to load initial theme:",e),Wa("auto")}}async function aA(e,t){const n=e?.target;if(n&&typeof n=="string"&&Yd.includes(n)){Wa(n);try{window.G7Core?.state?.setGlobal?.({theme:n})}catch(r){ir.warn("Failed to set global theme state:",r)}return}iA()}async function lA(e,t){let n;if(e?.target&&typeof e.target=="string"&&!e.target.includes("{{")&&(n=e.target),!n||typeof n!="string"){ir.warn("Invalid theme:",n);return}if(!Yd.includes(n)){ir.warn("Unsupported theme:",n);return}const r=n;try{localStorage.setItem(kb,r)}catch(s){ir.error("Failed to save theme to localStorage:",s);return}Wa(r);try{window.G7Core?.state?.setGlobal?.({theme:r})}catch(s){ir.warn("Failed to set global theme state:",s)}ir.log("Theme changed to:",r)}const Ps=window.G7Core?.createLogger?.("Handler:InitMenu")??{log:(...e)=>console.log("[Handler:InitMenu]",...e),warn:(...e)=>console.warn("[Handler:InitMenu]",...e),error:(...e)=>console.error("[Handler:InitMenu]",...e)};function Cb(e,t){for(const n of e){if(n.slug===t)return n;if(n.children&&n.children.length>0){const r=Cb(n.children,t);if(r)return r}}return null}function Sb(e){return new URLSearchParams(window.location.search).get(e)}function cA(e){return window.G7Core?.state?.getDataSource?.(e)}function dA(e){const t=[e,e?.data,e?.data?.data];for(const n of t)if(Array.isArray(n)&&n.length>0)return n;return null}async function uA(e,t=30,n=100){for(let r=0;rsetTimeout(o,n))}return null}async function fA(e){const t=window.G7Core;try{const r=(await t?.api?.get?.(`/api/admin/menus/${e.id}`))?.data;if(r&&typeof r=="object"&&r.id===e.id)return r}catch(n){Ps.warn("[initMenuFromUrl] Failed to hydrate menu detail:",n)}return e}async function hA(e,t){const n=window.G7Core,r=Sb("menu"),s=Sb("mode");if(!r){Ps.log("[initMenuFromUrl] No menu parameter in URL");return}if(!n?.state?.set){Ps.warn("[initMenuFromUrl] G7Core.state.set not available");return}const o=await uA("menus");if(!o){Ps.warn("[initMenuFromUrl] menus data not available after waiting");return}const i=Cb(o,r);if(!i){Ps.warn("[initMenuFromUrl] Menu not found with slug:",r);return}const a=await fA(i),l=s==="edit"?"edit":"view";n.state.set({selectedMenuId:a.id,selectedMenu:a,panelMode:l}),l==="edit"&&n.state.set({formData:{name:a.name,slug:a.slug,url:a.url,icon:a.icon,parent_id:a.parent_id,extension_type:a.extension_type,extension_identifier:a.extension_identifier,is_active:a.is_active,roles:(a.roles??[]).map(c=>c.id)}}),Ps.log("[initMenuFromUrl] Menu initialized from URL:",{slug:r,mode:l,menuId:i.id})}const tn=window.G7Core?.createLogger?.("Handler:FilterVisibility")??{log:(...e)=>console.log("[Handler:FilterVisibility]",...e),warn:(...e)=>console.warn("[Handler:FilterVisibility]",...e),error:(...e)=>console.error("[Handler:FilterVisibility]",...e)},Ga="g7_filter_visibility_";async function gA(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){tn.warn("[initFilterVisibility] storageKey is required");return}const o=`${Ga}${n}`;try{const i=localStorage.getItem(o);let a;if(i){const l=JSON.parse(i);Array.isArray(l)?(a=l,tn.log(`[initFilterVisibility] Loaded from localStorage: ${a.join(", ")}`)):(a=r,tn.warn("[initFilterVisibility] Invalid saved data format, using defaults"))}else a=r,tn.log(`[initFilterVisibility] No saved data, using defaults: ${r.join(", ")}`);t?.setState&&t.setState({[s]:a})}catch(i){tn.error("[initFilterVisibility] Failed to load filter visibility:",i),t?.setState&&t.setState({[s]:r})}}async function pA(e,t){const{storageKey:n,filters:r}=e?.params||{};if(!n){tn.warn("[saveFilterVisibility] storageKey is required");return}if(!Array.isArray(r)){tn.warn("[saveFilterVisibility] filters must be an array");return}const s=`${Ga}${n}`;try{localStorage.setItem(s,JSON.stringify(r)),tn.log(`[saveFilterVisibility] Saved to localStorage: ${r.join(", ")}`)}catch(o){tn.error("[saveFilterVisibility] Failed to save filter visibility:",o)}}async function mA(e,t){const{storageKey:n,filterId:r,stateKey:s="visibleFilters"}=e?.params||{};if(!n||!r){tn.warn("[toggleFilterVisibility] storageKey and filterId are required");return}const o=t?.state?.[s]||[];let i;o.includes(r)?i=o.filter(l=>l!==r):i=[...o,r],t?.setState&&t.setState({[s]:i});const a=`${Ga}${n}`;try{localStorage.setItem(a,JSON.stringify(i)),tn.log(`[toggleFilterVisibility] Toggled ${r}: ${i.join(", ")}`)}catch(l){tn.error("[toggleFilterVisibility] Failed to save:",l)}}async function bA(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){tn.warn("[resetFilterVisibility] storageKey is required");return}const o=`${Ga}${n}`;try{localStorage.setItem(o,JSON.stringify(r)),t?.setState&&t.setState({[s]:r}),tn.log(`[resetFilterVisibility] Reset to defaults: ${r.join(", ")}`)}catch(i){tn.error("[resetFilterVisibility] Failed to reset:",i)}}const $s=window.G7Core?.createLogger?.("Handler:MultilingualTag")??{log:(...e)=>console.log("[Handler:MultilingualTag]",...e),warn:(...e)=>console.warn("[Handler:MultilingualTag]",...e),error:(...e)=>console.error("[Handler:MultilingualTag]",...e)};async function yA(e,t){const n=window.G7Core;if(!n){$s.error("G7Core not available");return}const r=n.state?.getGlobal?.()?.multilingualTagEdit;if(!r){$s.warn("No multilingualTagEdit state found"),n.modal?.close?.();return}const{fieldName:s,editingIndex:o,values:i,statePath:a,currentTags:l}=r;if(!Object.values(i||{}).some(g=>typeof g=="string"&&g.trim()!=="")){$s.warn("No values to save"),n.modal?.close?.(),Kd(n);return}const d=Array.isArray(l)?l:[];let u;o==null?u=[...d,i]:u=d.map((g,m)=>m===o?i:g);const f=a||(s?.startsWith("form.")?s:`form.${s}`);n.state?.setParentLocal?.({[f]:u}),n.modal?.close?.(),Kd(n)}async function vA(e,t){const n=window.G7Core;if(!n){$s.error("G7Core not available");return}n.modal?.close?.(),Kd(n)}async function xA(e,t){const n=window.G7Core;if(!n){$s.error("G7Core not available");return}const r=e?.params?.locale;if(!r){$s.warn("No locale specified");return}const s=t?.event;let o="";s?.target?.value!==void 0?o=s.target.value:s?.value!==void 0&&(o=s.value);const a=(n.state?.getGlobal?.()||{}).multilingualTagEdit||{},l={...a.values||{},[r]:o};n.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:{...a,values:l}}})}function Kd(e){e.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:null}})}function _b(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0");return`${t}-${n}-${r}T${s}:${o}:${i}`}function wA(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59),r=_b(n),s=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0);switch(e){case"today":break;case"week":s.setDate(s.getDate()-6);break;case"month":s.setMonth(s.getMonth()-1);break;case"3months":s.setMonth(s.getMonth()-3);break;case"6months":s.setMonth(s.getMonth()-6);break;case"1year":s.setFullYear(s.getFullYear()-1);break}return{startDate:_b(s),endDate:r}}function kA(e){const{preset:t}=e.params||{preset:"today"},{startDate:n,endDate:r}=wA(t);return{startDate:n,endDate:r,preset:t}}const Yo=window.G7Core?.createLogger?.("Handler:Sidebar")??{log:(...e)=>console.log("[Handler:Sidebar]",...e),warn:(...e)=>console.warn("[Handler:Sidebar]",...e),error:(...e)=>console.error("[Handler:Sidebar]",...e)},Eb="g7_admin_sidebar_collapsed";function Mb(){try{return localStorage.getItem(Eb)==="1"}catch{return!1}}function CA(e){try{localStorage.setItem(Eb,e?"1":"0")}catch(t){Yo.error("Failed to save sidebar state to localStorage:",t)}try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Yo.warn("Failed to set global sidebar state:",t)}}function Nb(){const e=Mb();try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Yo.warn("Failed to restore sidebar state:",t)}Yo.log("Initial sidebar collapsed state restored:",e)}async function SA(e,t){Nb()}async function _A(e,t){const r=!(()=>{try{return!!window.G7Core?.state?.getGlobal?.()?.sidebarCollapsed}catch{return Mb()}})();CA(r),Yo.log("Sidebar collapsed toggled to:",r)}const Xd=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 EA(e,t){const n=window.G7Core,{url:r,filename:s}=e?.params||{};if(!r){Xd.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!n?.api?.get){Xd.error("G7Core.api.get 이 초기화되지 않아 다운로드를 실행할 수 없습니다.");return}try{const o=await n.api.get(r,{responseType:"blob"});if(o){const i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=s||"",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}}catch(o){Xd.error("첨부파일 다운로드 실패",o),n?.toast?.error?.(n?.t?.("common.download_failed")??"Download failed")}}const Ya=window.G7Core?.createLogger?.("Handler:DetectAssetUrlMode")??{log:(...e)=>console.log("[Handler:DetectAssetUrlMode]",...e),warn:(...e)=>console.warn("[Handler:DetectAssetUrlMode]",...e),error:(...e)=>console.error("[Handler:DetectAssetUrlMode]",...e)},MA="G7_ASSET_PROBE_OK";async function Ob(e){try{const t=await fetch(e,{cache:"no-store",credentials:"omit"});if(!t.ok)return!1;const n=t.headers.get("content-type")??"";return/javascript|ecmascript/i.test(n)?(await t.text()).includes(MA):!1}catch{return!1}}async function Tb(){const[e,t]=await Promise.all([Ob("/api/system/asset-probe.js"),Ob("/api/system/asset-probe")]);return e&&t?"extension":!e&&t?"extensionless":"unavailable"}function NA(){return window.G7Config?.settings?.general?.asset_url_mode??"extension"}async function OA(e){try{const t=await Tb();if(t==="unavailable")return;const n=NA();if(t===n)return;window.G7Core?.state?.setGlobal?.({assetUrlModeDrift:{detected:t,stored:n}})}catch(t){Ya.warn("자산 URL 방식 대조 실패 (대시보드 동작에는 영향 없음):",t)}}async function TA(e,t){const n=window.G7Core,r=t?.setState??n?.state?.setLocal,s=o=>{typeof r=="function"?r({asset_url_mode_detect_status:o}):Ya.warn("setState 를 찾지 못해 감지 상태를 폼에 반영하지 못했습니다")};try{s("detecting");const o=await Tb();if(o==="unavailable"){s("unavailable");return}typeof r=="function"?r({"form.general.asset_url_mode":o,asset_url_mode_detect_status:o}):Ya.warn("setState 를 찾지 못해 감지 결과를 폼에 반영하지 못했습니다")}catch(o){Ya.error("자산 URL 방식 감지 실패:",o),s("unavailable")}}const Ka={detectAssetUrlMode:TA,checkAssetUrlModeDrift:OA,setTheme:lA,initTheme:aA,scrollToSection:Vu,initMenuFromUrl:hA,initFilterVisibility:gA,saveFilterVisibility:pA,toggleFilterVisibility:mA,resetFilterVisibility:bA,saveMultilingualTag:yA,cancelMultilingualTag:vA,updateMultilingualTagValue:xA,setDateRange:kA,toggleSidebar:_A,initSidebar:SA,downloadAttachment:EA},Ko=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:IdentityLauncher")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic:IdentityLauncher]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic:IdentityLauncher]",...e),error:(...e)=>console.error("[Template:sirsoft-admin_basic:IdentityLauncher]",...e)};function AA(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function DA(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function IA(e,t=null){const n={purpose:e.purpose};e.provider_id&&(n.provider_id=e.provider_id),t&&(n.target=t);const r=e.challenge_start_url||"/api/identity/challenges",s=await fetch(r,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...DA(),...AA()},body:JSON.stringify(n)}),o=await s.json().catch(()=>null);if(!s.ok||!o?.success){const a=o?.message??`Challenge 시작 실패 (HTTP ${s.status})`;throw new Error(a)}const i=o.data??o;return{id:i.id,expires_at:i.expires_at,render_hint:i.render_hint??e.render_hint??"text_code",public_payload:i.public_payload,redirect_url:i.redirect_url,max_attempts:typeof i.max_attempts=="number"?i.max_attempts:void 0}}async function LA(e){const t=window.G7Core,n=t?.identity;if(!t?.dispatch||!t?.state||!n)return Ko.error("G7Core 또는 G7Core.identity 가 초기화되지 않아 launcher 를 실행할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};if(e.render_hint==="external_redirect"||e.redirect_url)return n.redirectExternally(e);const r=e.target&&(e.target.email||e.target.phone)?e.target:null;let s;try{s=await IA(e,r)}catch(m){Ko.error("Challenge 시작 실패:",m);try{await t.dispatch({handler:"toast",params:{type:"error",message:m instanceof Error?m.message:"본인인증 시작에 실패했습니다."}})}catch{}return{status:"failed",failureCode:"CHALLENGE_START_FAILED",reason:m instanceof Error?m.message:String(m)}}if(s.redirect_url)return n.redirectExternally({...e,render_hint:"external_redirect",redirect_url:s.redirect_url});const o=s.expires_at?new Date(s.expires_at).getTime():0,i=o>0?Math.max(0,Math.floor((o-Date.now())/1e3)):0,a=typeof s.max_attempts=="number"?s.max_attempts:0;t.state.set({identityChallenge:{policy_key:e.policy_key,purpose:e.purpose,provider_id:e.provider_id??null,render_hint:s.render_hint,challenge_id:s.id,expires_at:s.expires_at,public_payload:s.public_payload??{},target:r,code:"",error:null,attempts:0,maxAttempts:a,remainingSeconds:i,resendCooldown:0}});let l=o,c=0;const d=window.setInterval(()=>{const m=l>0?Math.max(0,Math.floor((l-Date.now())/1e3)):0;c=Math.max(0,c-1),t.state.set({identityChallenge:{remainingSeconds:m,resendCooldown:c}})},1e3);let u=null;try{u=t.state.subscribe?.(m=>{const p=m?.identityChallenge?.expires_at;if(typeof p=="string"){const b=new Date(p).getTime();Number.isFinite(b)&&b!==l&&(l=b)}const y=m?.identityChallenge?.resendCooldown;typeof y=="number"&&y>c&&(c=y)})??null}catch{}const f=n.createDeferred();try{await t.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(m){return Ko.error("openModal 실패 — 풀페이지로 폴백:",m),window.clearInterval(d),u?.(),n.redirectExternally({...e,render_hint:"external_redirect",redirect_url:`/admin/identity/challenge?challenge_id=${encodeURIComponent(s.id)}&return=${encodeURIComponent(window.location.href)}`})}const g=await f;return window.clearInterval(d),u?.(),g}function PA(){const e=window.G7Core?.identity;if(!e?.setLauncher){Ko.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(LA),Ko.log("IDV launcher registered (sirsoft-admin_basic)")}function $A(e){const t=e.icons;return Array.isArray(t)?t.filter(n=>!!n&&typeof n=="object"&&typeof n.value=="string"):[]}function FA(e,t){const n=e.label;return typeof n=="string"?n.startsWith("$t:")?t(n.slice(3)):n:e.value}function zA(e,t,n){if(n==="")return!0;const r=n.toLowerCase();return e.value.toLowerCase().includes(r)||t.toLowerCase().includes(r)?!0:(e.keywords??[]).some(s=>s.toLowerCase().includes(r))}function VA({entry:e}){const t=e.preview;return t?.html?h.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:Zd}):t?.className?h.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:Zd}):h.jsx("i",{className:`fas fa-${e.value}`,style:Zd,"aria-hidden":"true"})}function HA({control:e,value:t,onChange:n,t:r}){const s=$A(e),o=t==null?"":String(t),i=typeof e.iconColumns=="number"?e.iconColumns:6,a=e.iconSearchPlaceholder,l=typeof a=="string"&&a.startsWith("$t:")?r(a.slice(3)):r("layout_editor.icon_picker.search_placeholder"),[c,d]=v.useState("");if(s.length===0)return h.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Ab,children:h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-free","data-testid":"g7le-widget-icon-picker-free",value:o,placeholder:r("layout_editor.icon_picker.free_input_hint"),onChange:g=>n(g.target.value===""?void 0:g.target.value),style:Db})});const u=g=>FA(g,r),f=s.filter(g=>zA(g,u(g),c));return h.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Ab,children:[h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:c,placeholder:l,onChange:g=>d(g.target.value),style:Db}),h.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...UA,gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:[h.jsx("button",{type:"button","data-testid":"g7le-icon-cell-none",title:r("layout_editor.icon_picker.none"),onClick:()=>n(void 0),"aria-pressed":o==="",style:o===""?Ib:qd,children:h.jsx("span",{style:BA,children:"—"})}),f.map(g=>{const m=g.value===o;return h.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:u(g),"aria-pressed":m,onClick:()=>n(g.value),style:m?Ib:qd,children:h.jsx(VA,{entry:g})},g.value)})]}),f.length===0&&h.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:jA,children:r("layout_editor.icon_picker.no_results")})]})}const Ab={display:"flex",flexDirection:"column",gap:6,width:"100%"},Db={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},UA={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},qd={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},Ib={...qd,border:"2px solid #2563eb",background:"#eff6ff"},Zd={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},BA={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},jA={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},Lb=130,Fn=20;function WA(e){const t=e?.arrayProp;return typeof t=="string"&&t?t:"tabs"}function GA(e){let t=0;for(const n of e){const r=typeof n.id=="number"?n.id:Number(n.id);Number.isFinite(r)&&r>t&&(t=r)}return t+1}function YA({node:e,params:t,cellBoxes:n,t:r,onPatchNode:s}){const o=WA(t),i=v.useMemo(()=>{const g=(e.props??{})[o];return typeof g=="string"||!Array.isArray(g)?null:g},[e,o]),a=v.useMemo(()=>{const g=new Map,m=`props.${o}.`;for(const p of n??[]){if(!p.path.startsWith(m))continue;const y=Number(p.path.slice(m.length));Number.isInteger(y)&&g.set(y,{top:p.top,left:p.left,width:p.width,height:p.height})}return g},[n,o]),l=v.useCallback(g=>{const m=e.props??{};s({...e,props:{...m,[o]:g}})},[e,o,s]),c=v.useCallback(g=>{if(!i)return;const p={id:GA(i),label:r("editor.tabnav_inplace.new_tab")},y=i.slice();y.splice(g,0,p),l(y)},[i,l,r]),d=v.useCallback(g=>{if(!i)return;const m=i.slice();m.splice(g,1),l(m)},[i,l]),u=v.useCallback((g,m)=>{if(!i)return;const p=g+m;if(p<0||p>=i.length)return;const y=i.slice(),[b]=y.splice(g,1);y.splice(p,0,b),l(y)},[i,l]);if(!i||a.size===0)return null;const f={position:"absolute",width:Fn,height:Fn,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,lineHeight:1,border:"1px solid rgba(0,0,0,0.15)",borderRadius:4,background:"#ffffff",color:"#1f2937",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.18)",pointerEvents:"auto",padding:0,zIndex:Lb};return h.jsx("div",{className:"g7le-tabnav-inplace","data-testid":"g7le-tabnav-inplace",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Lb},children:i.map((g,m)=>{const p=a.get(m);if(!p)return null;const y=p.left+p.width;return h.jsxs("div",{"data-testid":`g7le-tabnav-aff-${m}`,children:[h.jsx("button",{type:"button","data-testid":`g7le-tabnav-remove-${m}`,title:r("editor.tabnav_inplace.remove"),"aria-label":r("editor.tabnav_inplace.remove"),style:{...f,left:y-Fn/2,top:p.top-Fn/2,color:"#b91c1c"},onClick:b=>{b.preventDefault(),b.stopPropagation(),d(m)},children:"✕"}),m>0&&h.jsx("button",{type:"button","data-testid":`g7le-tabnav-move-left-${m}`,title:r("editor.tabnav_inplace.move_left"),"aria-label":r("editor.tabnav_inplace.move_left"),style:{...f,left:p.left,top:p.top+p.height-Fn/2},onClick:b=>{b.preventDefault(),b.stopPropagation(),u(m,-1)},children:"◀"}),m{b.preventDefault(),b.stopPropagation(),u(m,1)},children:"▶"}),m===0&&h.jsx("button",{type:"button","data-testid":"g7le-tabnav-add-0",title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:p.left-Fn,top:p.top+p.height/2-Fn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(0)},children:"+"}),h.jsx("button",{type:"button","data-testid":`g7le-tabnav-add-${m+1}`,title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:y-Fn/2,top:p.top+p.height/2-Fn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(m+1)},children:"+"})]},`tab-aff-${g.id}-${m}`)})})}const Qd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:EditorWidgets")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic:EditorWidgets]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic:EditorWidgets]",...e)};function KA(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){Qd.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",HA),Qd.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)"),e.registerCanvasOverlay&&(e.registerCanvasOverlay("tabnav",YA),Qd.log("편집기 캔버스 오버레이 'tabnav' 등록됨(TabNavigation 탭 인플레이스)"))}const Jd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic]",...e),error:(...e)=>console.error("[Template:sirsoft-admin_basic]",...e)};typeof window<"u"&&(window.G7TemplateHandlers=Ka);function Pb(){if(typeof window<"u"){let e=0;const t=50,n=()=>{const r=window.G7Core?.getActionDispatcher?.();r?(Object.entries(Ka).forEach(([s,o])=>{r.registerHandler(s,o)}),Jd.log(`${Object.keys(Ka).length} custom handler(s) registered:`,Object.keys(Ka)),PA(),Nb()):(e++,e<=t?(Jd.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(n,100)):Jd.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?n():window.addEventListener("load",n)}}return KA(),Pb(),R.A=qr,R.Accordion=Oc,R.ActionMenu=Vs,R.AdminFooter=Tv,R.AdminHeader=Ev,R.AdminSidebar=_v,R.Alert=Xu,R.AlertDialog=mv,R.Badge=hu,R.BarChart=Q5,R.Breadcrumb=Wu,R.Button=le,R.Card=oy,R.CardGrid=Ry,R.CategoryTree=t2,R.Checkbox=On,R.ChipCheckbox=UM,R.Code=ty,R.CodeEditor=Qx,R.ColumnSelector=sw,R.ConfirmDialog=Bu,R.Container=R5,R.DataGrid=Ky,R.Dialog=Uu,R.Div=I,R.DonutChart=J5,R.Dropdown=tv,R.DropdownButton=BM,R.DropdownMenuItem=jM,R.DynamicFieldList=RM,R.EmptyState=kv,R.ExtensionBadge=jh,R.FileInput=ou,R.FileUploader=u0,R.FilterGroup=ov,R.FilterVisibilitySelector=PM,R.Flex=tA,R.Form=al,R.FormField=sN,R.Fragment=ry,R.Grid=eA,R.H1=sl,R.H2=cr,R.H3=Xr,R.H4=iu,R.Hr=sy,R.HtmlContent=kl,R.HtmlEditor=AM,R.I=yt,R.Icon=ae,R.IconButton=hv,R.IconName=he,R.IconSelect=q_,R.ImageGallery=ia,R.Img=Nn,R.Input=Et,R.Label=gn,R.LanguageSelector=Ov,R.LayoutEditorHeader=Pv,R.LayoutFileList=$v,R.LayoutHistoryPanel=Rx,R.LayoutWarnings=LM,R.Li=il,R.LoadingSpinner=Sv,R.LoginForm=ew,R.Modal=ri,R.MultilingualInput=fl,R.MultilingualLocaleContext=ld,R.MultilingualTabPanel=rN,R.MultilingualTagInput=rS,R.Nav=Jo,R.NotificationCenter=Mv,R.Ol=Xb,R.Optgroup=Jb,R.Option=Qb,R.P=kt,R.PageHeader=Av,R.PageLoading=lw,R.PageTransitionIndicator=iw,R.Pagination=Ro,R.PermissionTree=R_,R.Pre=ny,R.ProductCard=nv,R.RadioGroup=NM,R.RichSelect=VM,R.SearchBar=sv,R.SearchableDropdown=sS,R.Section=au,R.SectionHeader=Iv,R.SectionLayout=nA,R.Select=Zr,R.SlotContainer=zM,R.SortableMenuItem=Dg,R.SortableMenuList=K_,R.Span=J,R.StatCard=rv,R.StatusBadge=ei,R.Svg=Jn,R.TabNavigation=iv,R.TabNavigationScroll=uv,R.Table=ll,R.TagInput=eS,R.TagSelect=oS,R.Tbody=dl,R.Td=rn,R.TemplateCard=Lv,R.Textarea=lr,R.Tfoot=ul,R.Th=Qr,R.Thead=cl,R.ThemeToggle=nw,R.ThreeColumnLayout=rA,R.Toast=xv,R.Toggle=hl,R.Tr=dr,R.Ul=ol,R.UnifiedIcon=ey,R.UserProfile=Nv,R.VersionList=hf,R.configureJSONLanguageService=Xx,R.defaultJSONSchemas=cf,R.executeImageDownload=rd,R.getJSONLanguageDefaults=Ll,R.initTemplate=Pb,R.jsonEditorDefaults=Yx,R.monacoInitOptions=Kx,R.templateMetadata=sA,R.useCurrentMultilingualLocale=y0,R.useImageGallery=Qp,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R})({},ReactJSXRuntime,React,ReactDOM); +`):e}function O5(e,t){const{element:n,datasetIndex:r,index:s}=t,o=e.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:e,label:i,parsed:o.getParsed(s),raw:e.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function nb(e,t){const n=e.chart.ctx,{body:r,footer:s,title:o}=e,{boxWidth:i,boxHeight:a}=t,l=Rt(t.bodyFont),c=Rt(t.titleFont),d=Rt(t.footerFont),u=o.length,f=s.length,g=r.length,m=_n(t.padding);let p=m.height,y=0,b=r.reduce((M,S)=>M+S.before.length+S.lines.length+S.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),b){const M=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=g*M+(b-g)*l.lineHeight+(b-1)*t.bodySpacing}f&&(p+=t.footerMarginTop+f*d.lineHeight+(f-1)*t.footerSpacing);let _=0;const x=function(M){y=Math.max(y,n.measureText(M).width+_)};return n.save(),n.font=c.string,at(e.title,x),n.font=l.string,at(e.beforeBody.concat(e.afterBody),x),_=t.displayColors?i+2+t.boxPadding:0,at(r,M=>{at(M.before,x),at(M.lines,x),at(M.after,x)}),_=0,n.font=d.string,at(e.footer,x),n.restore(),y+=m.width,{width:y,height:p}}function T5(e,t){const{y:n,height:r}=t;return ne.height-r/2?"bottom":"center"}function A5(e,t,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(e==="left"&&s+o+i>t.width||e==="right"&&s-o-i<0)return!0}function D5(e,t,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:l}}=e;let c="center";return r==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=i-o/2&&(c="right"),A5(c,e,t,n)&&(c="center"),c}function rb(e,t,n){const r=n.yAlign||t.yAlign||T5(e,n);return{xAlign:n.xAlign||t.xAlign||D5(e,t,n,r),yAlign:r}}function I5(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function L5(e,t,n){let{y:r,height:s}=e;return t==="top"?r+=n:t==="bottom"?r-=s+n:r-=s/2,r}function sb(e,t,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=Ns(i);let m=I5(t,a);const p=L5(t,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(d,f)+s:a==="right"&&(m+=Math.max(u,g)+s),{x:cn(m,0,r.width-t.width),y:cn(p,0,r.height-t.height)}}function Ha(e,t,n){const r=_n(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function ob(e){return qn([],or(e))}function P5(e,t,n){return Os(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function ib(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const ab={beforeTitle:nr,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex"u"?ab[t].call(n,r):s}class jd extends Yr{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new um(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=P5(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,s=dn(r,"beforeTitle",this,t),o=dn(r,"title",this,t),i=dn(r,"afterTitle",this,t);let a=[];return a=qn(a,or(s)),a=qn(a,or(o)),a=qn(a,or(i)),a}getBeforeBody(t,n){return ob(dn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,s=[];return at(t,o=>{const i={before:[],lines:[],after:[]},a=ib(r,o);qn(i.before,or(dn(a,"beforeLabel",this,o))),qn(i.lines,dn(a,"label",this,o)),qn(i.after,or(dn(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(t,n){return ob(dn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,s=dn(r,"beforeFooter",this,t),o=dn(r,"footer",this,t),i=dn(r,"afterFooter",this,t);let a=[];return a=qn(a,or(s)),a=qn(a,or(o)),a=qn(a,or(i)),a}_createItems(t){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],l,c;for(l=0,c=n.length;lt.filter(d,u,f,r))),t.itemSort&&(a=a.sort((d,u)=>t.itemSort(d,u,r))),at(a,d=>{const u=ib(t.callbacks,d);s.push(dn(u,"labelColor",this,d)),o.push(dn(u,"labelPointStyle",this,d)),i.push(dn(u,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Go[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const l=this._size=nb(this,r),c=Object.assign({},a,l),d=rb(this.chart,r,c),u=sb(r,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,s){const o=this.getCaretPosition(t,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=Ns(a),{x:f,y:g}=t,{width:m,height:p}=n;let y,b,_,x,M,S;return o==="center"?(M=g+p/2,s==="left"?(y=f,b=y-i,x=M+i,S=M-i):(y=f+m,b=y+i,x=M-i,S=M+i),_=y):(s==="left"?b=f+Math.max(l,d)+i:s==="right"?b=f+m-Math.max(c,u)-i:b=this.caretX,o==="top"?(x=g,M=x-i,y=b-i,_=b+i):(x=g+p,M=x+i,y=b+i,_=b-i),S=x),{x1:y,x2:b,x3:_,y1:x,y2:M,y3:S}}drawTitle(t,n,r){const s=this.title,o=s.length;let i,a,l;if(o){const c=As(r.rtl,this.x,this.width);for(t.x=Ha(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",i=Rt(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;l_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Sa(t,{x:p,y:m,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),Sa(t,{x:y,y:m+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,m,c,l),t.strokeRect(p,m,c,l),t.fillStyle=i.backgroundColor,t.fillRect(y,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=r,u=Rt(r.bodyFont);let f=u.lineHeight,g=0;const m=As(r.rtl,this.x,this.width),p=function(C){n.fillText(C,m.x(t.x+g),t.y+f/2),t.y+=f+o},y=m.textAlign(i);let b,_,x,M,S,k,N;for(n.textAlign=i,n.textBaseline="middle",n.font=u.string,t.x=Ha(this,y,r),n.fillStyle=r.bodyColor,at(this.beforeBody,p),g=a&&y!=="right"?i==="center"?c/2+d:c+2+d:0,M=0,k=s.length;M0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Go[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=nb(this,t),l=Object.assign({},i,this._size),c=rb(n,t,l),d=sb(t,l,c,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=_n(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,s,n),lm(t,n.textDirection),o.y+=i.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),cm(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!ba(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(t,o,n,r),a=this._positionChanged(i,t),l=n||!ba(i,o)||a;return l&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(t,n){const{caretX:r,caretY:s,options:o}=this,i=Go[o.position].call(this,t,n);return i!==!1&&(r!==i.x||s!==i.y)}}$e(jd,"positioners",Go);var lb={id:"tooltip",_element:jd,positioners:Go,afterInit(e,t,n){n&&(e.tooltip=new jd({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:ab},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const $5=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function F5(e,t,n,r){const s=e.indexOf(t);if(s===-1)return $5(e,t,n,r);const o=e.lastIndexOf(t);return s!==o?n:s}const z5=(e,t)=>e===null?null:cn(Math.round(e),0,t);function cb(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}$e(Wd,"id","category"),$e(Wd,"defaults",{ticks:{callback:cb}});function V5(e,t){const n=[],{bounds:s,step:o,min:i,max:a,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:f}=e,g=o||1,m=d-1,{min:p,max:y}=t,b=!ft(i),_=!ft(a),x=!ft(c),M=(y-p)/(u+1);let S=L0((y-p)/m/g)*g,k,N,C,w;if(S<1e-14&&!b&&!_)return[{value:p},{value:y}];w=Math.ceil(y/S)-Math.floor(p/S),w>m&&(S=L0(w*S/m/g)*g),ft(l)||(k=Math.pow(10,l),S=Math.ceil(S*k)/k),s==="ticks"?(N=Math.floor(p/S)*S,C=Math.ceil(y/S)*S):(N=p,C=y),b&&_&&o&&FN((a-i)/o,S/1e3)?(w=Math.round(Math.min((a-i)/S,d)),S=(a-i)/w,N=i,C=a):x?(N=b?i:N,C=_?a:C,w=c-1,S=(C-N)/w):(w=(C-N)/S,xa(w,Math.round(w),S/1e3)?w=Math.round(w):w=Math.ceil(w));const E=Math.max(P0(S),P0(N));k=Math.pow(10,ft(l)?E:l),N=Math.round(N*k)/k,C=Math.round(C*k)/k;let T=0;for(b&&(f&&N!==i?(n.push({value:i}),Na)break;n.push({value:P})}return _&&f&&C!==a?n.length&&xa(n[n.length-1].value,a,db(a,M,e))?n[n.length-1].value=a:n.push({value:a}):(!_||C===a)&&n.push({value:C}),n}function db(e,t,{horizontal:n,minRotation:r}){const s=rr(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class H5 extends Is{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return ft(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=l=>s=n?s:l,a=l=>o=r?o:l;if(t){const l=xr(s),c=xr(o);l<0&&c<0?a(0):l>0&&c>0&&i(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||i(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=V5(s,o);return t.bounds==="ticks"&&zN(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const s=(r-n)/Math.max(t.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return xd(t,this.chart.options.locale,this.options.ticks.format)}}class Gd extends H5{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Sn(t)?t:0,this.max=Sn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=rr(this.options.ticks.minRotation),s=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}$e(Gd,"id","linear"),$e(Gd,"defaults",{ticks:{callback:K0.formatters.numeric}});const Ua={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},un=Object.keys(Ua);function ub(e,t){return e-t}function fb(e,t){if(ft(t))return null;const n=e._adapter,{parser:r,round:s,isoWeekday:o}=e._parseOpts;let i=t;return typeof r=="function"&&(i=r(i)),Sn(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(wa(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function hb(e,t,n,r){const s=un.length;for(let o=un.indexOf(e);o=un.indexOf(n);o--){const i=un[o];if(Ua[i].common&&e._adapter.diff(s,r,i)>=t-1)return i}return un[n?un.indexOf(n):0]}function B5(e){for(let t=un.indexOf(e)+1,n=un.length;t=t?n[r]:n[s];e[o]=!0}}function j5(e,t,n,r){const s=e._adapter,o=+s.startOf(t[0].value,r),i=t[t.length-1].value;let a,l;for(a=o;a<=i;a=+s.add(a,1,r))l=n[a],l>=0&&(t[l].major=!0);return t}function pb(e,t,n){const r=[],s={},o=t.length;let i,a;for(i=0;i+t.value))}initOffsets(t=[]){let n=0,r=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const i=t.length<3?.5:.25;n=cn(n,0,i),r=cn(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||hb(o.minUnit,n,r,this._getLabelCapacity(n)),a=Je(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,c=wa(l)||l===!0,d={};let u=n,f,g;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":i),t.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,g=0;f+p)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(t,i)}_tickFormatFunction(t,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return bt(i,[t,n,r],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],u=c&&a[c],f=r[n],g=c&&u&&f&&f.major;return this._adapter.format(t,s||(g?u:d))}generateTickLabels(t){let n,r,s;for(n=0,r=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n=e[r].pos&&t<=e[s].pos&&({lo:r,hi:s}=bd(e,"pos",t)),{pos:o,time:a}=e[r],{pos:i,time:l}=e[s]):(t>=e[r].time&&t<=e[s].time&&({lo:r,hi:s}=bd(e,"time",t)),{time:o,pos:a}=e[r],{time:i,pos:l}=e[s]);const c=i-o;return c?a+(l-a)*(t-o)/c:a}class mb extends Ba{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=ja(n,this.min),this._tableRange=ja(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,s=[],o=[];let i,a,l,c,d;for(i=0,a=t.length;i=n&&c<=r&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;is-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(ja(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return ja(this._table,r*this._tableRange+this._minPos,!0)}}$e(mb,"id","timeseries"),$e(mb,"defaults",Ba.defaults);const bb="label";function yb(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function W5(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function vb(e,t){e.labels=t}function xb(e,t,n=bb){const r=[];e.datasets=t.map(s=>{const o=e.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function G5(e,t=bb){const n={labels:[],datasets:[]};return vb(n,e.labels),xb(n,e.datasets,t),n}function Y5(e,t){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:u,...f}=e,g=v.useRef(null),m=v.useRef(null),p=()=>{g.current&&(m.current=new jo(g.current,{type:i,data:G5(a,o),options:l&&{...l},plugins:c}),yb(t,m.current))},y=()=>{yb(t,null),m.current&&(m.current.destroy(),m.current=null)};return v.useEffect(()=>{!s&&m.current&&l&&W5(m.current,l)},[s,l]),v.useEffect(()=>{!s&&m.current&&vb(m.current.config.data,a.labels)},[s,a.labels]),v.useEffect(()=>{!s&&m.current&&a.datasets&&xb(m.current.config.data,a.datasets,o)},[s,a.datasets]),v.useEffect(()=>{m.current&&(s?(y(),setTimeout(p)):m.current.update(u))},[s,l,a.labels,a.datasets,u]),v.useEffect(()=>{m.current&&(y(),setTimeout(p))},[i]),v.useEffect(()=>(p(),()=>y()),[]),h.jsx("canvas",{ref:g,role:"img",height:n,width:r,...f,children:d})}const K5=v.forwardRef(Y5);function wb(e,t){return jo.register(t),v.forwardRef((n,r)=>h.jsx(K5,{...n,ref:r,type:e}))}const X5=wb("bar",Oa),q5=wb("doughnut",$o);jo.register(Wd,Gd,Va,N5,lb,eb);const Z5=({labels:e,datasets:t,height:n=200,showLegend:r=!1,showGrid:s=!1,showYGrid:o=!1,showYAxis:i=!1,className:a="",id:l,editorAttrs:c})=>{const d=v.useMemo(()=>({labels:e??[],datasets:(t??[]).map((m,p)=>({label:m.label,data:m.data,backgroundColor:m.backgroundColor||(p===0?"#7C3AED":"#DDD6FE"),borderRadius:m.borderRadius??4,barThickness:16,maxBarThickness:20,yAxisID:m.yAxisID??"y"}))}),[e,t]),u=v.useMemo(()=>(t??[]).some(m=>m.yAxisID==="y1"),[t]),f=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:{duration:750,easing:"easeOutQuart"},animations:{x:{duration:0},y:{from:m=>{if(m.type==="data")return m.chart.scales.y.getPixelForValue(0)}}},transitions:{active:{animation:{duration:200}},resize:{animation:{duration:0}}},plugins:{legend:{display:r,position:"top"},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8}},scales:{x:{grid:{display:s},border:{display:!1},ticks:{color:"#94a3b8",font:{size:11}}},y:{type:"linear",position:"left",grid:{display:o,color:"#e2e8f0"},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"},...u?{y1:{type:"linear",position:"right",grid:{display:!1},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"}}:{}}}),[r,s,o,i,u]),g=typeof n=="number"?n:/^\d+$/.test(String(n))?`${n}px`:n;return h.jsx("div",{className:`bar-chart-container ${a}`,style:{height:g},id:l,...c,children:h.jsx(X5,{data:d,options:f})})},Q5=v.memo(Z5,(e,t)=>JSON.stringify(e.labels)===JSON.stringify(t.labels)&&JSON.stringify(e.datasets)===JSON.stringify(t.datasets)&&e.height===t.height&&e.showLegend===t.showLegend&&e.showGrid===t.showGrid&&e.showYGrid===t.showYGrid&&e.showYAxis===t.showYAxis&&e.className===t.className&&e.id===t.id&&e.editorAttrs===t.editorAttrs);jo.register(Wo,lb,eb);const J5=({data:e,centerLabel:t,centerValue:n,size:r=200,cutout:s="70%",showLegend:o=!1,className:i="",id:a,editorAttrs:l})=>{const c=v.useMemo(()=>({labels:(e??[]).map(f=>f.name),datasets:[{data:(e??[]).map(f=>f.value),backgroundColor:(e??[]).map(f=>f.color),borderWidth:0,hoverOffset:4}]}),[e]),d=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,cutout:s,plugins:{legend:{display:o},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,callbacks:{label:f=>` $${f.parsed.toLocaleString()}`}}}}),[s,o]),u=typeof r=="number"?r:/^\d+$/.test(String(r))?`${r}px`:r;return h.jsx("div",{className:`donut-chart-wrapper ${i}`,id:a,...l,children:h.jsxs("div",{className:"relative",style:{width:u,height:u},children:[h.jsx(q5,{data:c,options:d}),(t||n)&&h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[t&&h.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:t}),n&&h.jsx("span",{className:"text-lg font-bold text-slate-900 dark:text-white",children:n})]})]})})},R5=({id:e,className:t,style:n,children:r,editorAttrs:s})=>h.jsx("div",{id:e,className:t,style:n,...s,children:r}),eA=({children:e,cols:t=1,responsive:n,gap:r,rowGap:s,colGap:o,autoRows:i,autoCols:a,flow:l="row",className:c="",style:d,onClick:u,id:f,editorAttrs:g})=>{const m=["grid"];if(t&&m.push(`grid-cols-${t}`),n&&(n.sm&&m.push(`sm:grid-cols-${n.sm}`),n.md&&m.push(`md:grid-cols-${n.md}`),n.lg&&m.push(`lg:grid-cols-${n.lg}`),n.xl&&m.push(`xl:grid-cols-${n.xl}`),n["2xl"]&&m.push(`2xl:grid-cols-${n["2xl"]}`)),r!==void 0&&r>0&&m.push(`gap-${r}`),s!==void 0&&s>0&&m.push(`gap-y-${s}`),o!==void 0&&o>0&&m.push(`gap-x-${o}`),i){const y={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};m.push(y[i])}if(a){const y={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};m.push(y[a])}const p={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 m.push(p[l]),c&&m.push(c),h.jsx(I,{className:m.join(" "),style:d,onClick:u,id:f,...g,children:e})},tA=({children:e,direction:t="row",justify:n="start",align:r="stretch",wrap:s="nowrap",gap:o=0,grow:i=!1,shrink:a=!0,className:l="",style:c,onClick:d,id:u,editorAttrs:f})=>{const g=["flex"],m={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};g.push(m[t]);const p={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};g.push(p[s]);const y={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(y[n]);const b={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(b[r]),o>0&&g.push(`gap-${o}`),i===!0?g.push("flex-grow"):typeof i=="number"&&i>0&&g.push(`flex-grow-${i}`),a===!1?g.push("shrink-0"):a===!0?g.push("flex-shrink"):typeof a=="number"&&a>0&&g.push(`flex-shrink-${a}`),l&&g.push(l),h.jsx(I,{className:g.join(" "),style:c,onClick:d,id:u,...f,children:e})},nA=({title:e,subtitle:t,children:n,padding:r="none",background:s="none",maxWidth:o,centered:i=!1,border:a=!1,shadow:l="none",rounded:c=!1,className:d="",style:u,onClick:f,id:g,editorAttrs:m})=>{const p=[],y={none:"",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};y[r]&&p.push(y[r]);const b={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(s!=="none"&&p.push(b[s]),o){const x={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"};p.push(x[o])}i&&p.push("mx-auto"),a&&p.push("border","border-gray-200","dark:border-gray-700");const _={none:"",sm:"shadow-sm",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"};return l!=="none"&&p.push(_[l]),c&&p.push("rounded-lg"),d&&p.push(d),h.jsxs(au,{className:p.join(" "),style:u,onClick:f,id:g,...m,children:[(e||t)&&h.jsxs("div",{className:"mb-4",children:[e&&h.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:e}),t&&h.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:t})]}),n]})},rA=({leftWidth:e="250px",rightWidth:t="300px",leftSlot:n,centerSlot:r,rightSlot:s,className:o="",style:i,id:a,editorAttrs:l})=>{const c=`flex flex-row w-full h-full ${o}`.trim(),d={width:e,flexShrink:0},u={flex:1,minWidth:0},f={width:t,flexShrink:0};return h.jsxs(I,{className:c,style:i,id:a,...l,children:[h.jsx(I,{className:"flex flex-col",style:d,children:n}),h.jsx(I,{className:"flex flex-col",style:u,children:r}),h.jsx(I,{className:"flex flex-col",style:f,children:s})]})},sA={identifier:"sirsoft-admin_basic",vendor:"sirsoft",name:{ko:"Admin Basic",en:"Admin Basic"},version:"1.0.8",license:"MIT",description:{ko:"그누보드7 기본 관리자 템플릿",en:"Gnuboard7 default admin template"},type:"admin",locales:["ko","en"],author:{name:"sirsoft",email:"contact@sirsoft.com",url:"https://sirsoft.com"},release_date:"2026-05-15",g7_version:">=7.0.10",dependencies:{modules:{},plugins:{}},assets:{css:["dist/css/components.css"],js:["dist/js/components.iife.js"],fonts:[],images:[]},components:{basic:["a","button","checkbox","div","form","h1","h2","h3","hr","icon","img","input","label","li","nav","p","section","select","span","svg","table","tbody","td","textarea","th","thead","tr","ul"],composite:["action-menu","admin-footer","admin-header","admin-sidebar","alert-dialog","breadcrumb","card","confirm-dialog","data-grid","dialog","dropdown","empty-state","filter-group","icon-button","loading-spinner","modal","page-header","pagination","product-card","search-bar","stat-card","status-badge","tab-navigation","template-card","toast"],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"}},github_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic",github_changelog_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic/blob/main/CHANGELOG.md",externals:[{id:"fontawesome",type:"style",asset:"vendor/font-awesome/6.4.0/css/all.inlined.css"},{id:"pretendard",type:"webfont",asset:"vendor/pretendard/1.3.9/pretendard-variable.css"},{id:"flag-icons",type:"style",asset:"vendor/flag-icons/7.2.3/css/flag-icons.min.css"}]},ir=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)},Yd=["auto","light","dark"],kb="g7_color_scheme",oA=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,Wa=e=>{const t=oA(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function iA(){try{const e=localStorage.getItem(kb),t=e&&Yd.includes(e)?e:"auto";Wa(t);try{window.G7Core?.state?.setGlobal?.({theme:t})}catch(n){ir.warn("Failed to set global theme state:",n)}ir.log("Initial theme applied:",t)}catch(e){ir.warn("Failed to load initial theme:",e),Wa("auto")}}async function aA(e,t){const n=e?.target;if(n&&typeof n=="string"&&Yd.includes(n)){Wa(n);try{window.G7Core?.state?.setGlobal?.({theme:n})}catch(r){ir.warn("Failed to set global theme state:",r)}return}iA()}async function lA(e,t){let n;if(e?.target&&typeof e.target=="string"&&!e.target.includes("{{")&&(n=e.target),!n||typeof n!="string"){ir.warn("Invalid theme:",n);return}if(!Yd.includes(n)){ir.warn("Unsupported theme:",n);return}const r=n;try{localStorage.setItem(kb,r)}catch(s){ir.error("Failed to save theme to localStorage:",s);return}Wa(r);try{window.G7Core?.state?.setGlobal?.({theme:r})}catch(s){ir.warn("Failed to set global theme state:",s)}ir.log("Theme changed to:",r)}const Ps=window.G7Core?.createLogger?.("Handler:InitMenu")??{log:(...e)=>console.log("[Handler:InitMenu]",...e),warn:(...e)=>console.warn("[Handler:InitMenu]",...e),error:(...e)=>console.error("[Handler:InitMenu]",...e)};function Cb(e,t){for(const n of e){if(n.slug===t)return n;if(n.children&&n.children.length>0){const r=Cb(n.children,t);if(r)return r}}return null}function Sb(e){return new URLSearchParams(window.location.search).get(e)}function cA(e){return window.G7Core?.state?.getDataSource?.(e)}function dA(e){const t=[e,e?.data,e?.data?.data];for(const n of t)if(Array.isArray(n)&&n.length>0)return n;return null}async function uA(e,t=30,n=100){for(let r=0;rsetTimeout(o,n))}return null}async function fA(e){const t=window.G7Core;try{const r=(await t?.api?.get?.(`/api/admin/menus/${e.id}`))?.data;if(r&&typeof r=="object"&&r.id===e.id)return r}catch(n){Ps.warn("[initMenuFromUrl] Failed to hydrate menu detail:",n)}return e}async function hA(e,t){const n=window.G7Core,r=Sb("menu"),s=Sb("mode");if(!r){Ps.log("[initMenuFromUrl] No menu parameter in URL");return}if(!n?.state?.set){Ps.warn("[initMenuFromUrl] G7Core.state.set not available");return}const o=await uA("menus");if(!o){Ps.warn("[initMenuFromUrl] menus data not available after waiting");return}const i=Cb(o,r);if(!i){Ps.warn("[initMenuFromUrl] Menu not found with slug:",r);return}const a=await fA(i),l=s==="edit"?"edit":"view";n.state.set({selectedMenuId:a.id,selectedMenu:a,panelMode:l}),l==="edit"&&n.state.set({formData:{name:a.name,slug:a.slug,url:a.url,icon:a.icon,parent_id:a.parent_id,extension_type:a.extension_type,extension_identifier:a.extension_identifier,is_active:a.is_active,roles:(a.roles??[]).map(c=>c.id)}}),Ps.log("[initMenuFromUrl] Menu initialized from URL:",{slug:r,mode:l,menuId:i.id})}const tn=window.G7Core?.createLogger?.("Handler:FilterVisibility")??{log:(...e)=>console.log("[Handler:FilterVisibility]",...e),warn:(...e)=>console.warn("[Handler:FilterVisibility]",...e),error:(...e)=>console.error("[Handler:FilterVisibility]",...e)},Ga="g7_filter_visibility_";async function gA(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){tn.warn("[initFilterVisibility] storageKey is required");return}const o=`${Ga}${n}`;try{const i=localStorage.getItem(o);let a;if(i){const l=JSON.parse(i);Array.isArray(l)?(a=l,tn.log(`[initFilterVisibility] Loaded from localStorage: ${a.join(", ")}`)):(a=r,tn.warn("[initFilterVisibility] Invalid saved data format, using defaults"))}else a=r,tn.log(`[initFilterVisibility] No saved data, using defaults: ${r.join(", ")}`);t?.setState&&t.setState({[s]:a})}catch(i){tn.error("[initFilterVisibility] Failed to load filter visibility:",i),t?.setState&&t.setState({[s]:r})}}async function pA(e,t){const{storageKey:n,filters:r}=e?.params||{};if(!n){tn.warn("[saveFilterVisibility] storageKey is required");return}if(!Array.isArray(r)){tn.warn("[saveFilterVisibility] filters must be an array");return}const s=`${Ga}${n}`;try{localStorage.setItem(s,JSON.stringify(r)),tn.log(`[saveFilterVisibility] Saved to localStorage: ${r.join(", ")}`)}catch(o){tn.error("[saveFilterVisibility] Failed to save filter visibility:",o)}}async function mA(e,t){const{storageKey:n,filterId:r,stateKey:s="visibleFilters"}=e?.params||{};if(!n||!r){tn.warn("[toggleFilterVisibility] storageKey and filterId are required");return}const o=t?.state?.[s]||[];let i;o.includes(r)?i=o.filter(l=>l!==r):i=[...o,r],t?.setState&&t.setState({[s]:i});const a=`${Ga}${n}`;try{localStorage.setItem(a,JSON.stringify(i)),tn.log(`[toggleFilterVisibility] Toggled ${r}: ${i.join(", ")}`)}catch(l){tn.error("[toggleFilterVisibility] Failed to save:",l)}}async function bA(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){tn.warn("[resetFilterVisibility] storageKey is required");return}const o=`${Ga}${n}`;try{localStorage.setItem(o,JSON.stringify(r)),t?.setState&&t.setState({[s]:r}),tn.log(`[resetFilterVisibility] Reset to defaults: ${r.join(", ")}`)}catch(i){tn.error("[resetFilterVisibility] Failed to reset:",i)}}const $s=window.G7Core?.createLogger?.("Handler:MultilingualTag")??{log:(...e)=>console.log("[Handler:MultilingualTag]",...e),warn:(...e)=>console.warn("[Handler:MultilingualTag]",...e),error:(...e)=>console.error("[Handler:MultilingualTag]",...e)};async function yA(e,t){const n=window.G7Core;if(!n){$s.error("G7Core not available");return}const r=n.state?.getGlobal?.()?.multilingualTagEdit;if(!r){$s.warn("No multilingualTagEdit state found"),n.modal?.close?.();return}const{fieldName:s,editingIndex:o,values:i,statePath:a,currentTags:l}=r;if(!Object.values(i||{}).some(g=>typeof g=="string"&&g.trim()!=="")){$s.warn("No values to save"),n.modal?.close?.(),Kd(n);return}const d=Array.isArray(l)?l:[];let u;o==null?u=[...d,i]:u=d.map((g,m)=>m===o?i:g);const f=a||(s?.startsWith("form.")?s:`form.${s}`);n.state?.setParentLocal?.({[f]:u}),n.modal?.close?.(),Kd(n)}async function vA(e,t){const n=window.G7Core;if(!n){$s.error("G7Core not available");return}n.modal?.close?.(),Kd(n)}async function xA(e,t){const n=window.G7Core;if(!n){$s.error("G7Core not available");return}const r=e?.params?.locale;if(!r){$s.warn("No locale specified");return}const s=t?.event;let o="";s?.target?.value!==void 0?o=s.target.value:s?.value!==void 0&&(o=s.value);const a=(n.state?.getGlobal?.()||{}).multilingualTagEdit||{},l={...a.values||{},[r]:o};n.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:{...a,values:l}}})}function Kd(e){e.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:null}})}function _b(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0");return`${t}-${n}-${r}T${s}:${o}:${i}`}function wA(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59),r=_b(n),s=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0);switch(e){case"today":break;case"week":s.setDate(s.getDate()-6);break;case"month":s.setMonth(s.getMonth()-1);break;case"3months":s.setMonth(s.getMonth()-3);break;case"6months":s.setMonth(s.getMonth()-6);break;case"1year":s.setFullYear(s.getFullYear()-1);break}return{startDate:_b(s),endDate:r}}function kA(e){const{preset:t}=e.params||{preset:"today"},{startDate:n,endDate:r}=wA(t);return{startDate:n,endDate:r,preset:t}}const Yo=window.G7Core?.createLogger?.("Handler:Sidebar")??{log:(...e)=>console.log("[Handler:Sidebar]",...e),warn:(...e)=>console.warn("[Handler:Sidebar]",...e),error:(...e)=>console.error("[Handler:Sidebar]",...e)},Eb="g7_admin_sidebar_collapsed";function Mb(){try{return localStorage.getItem(Eb)==="1"}catch{return!1}}function CA(e){try{localStorage.setItem(Eb,e?"1":"0")}catch(t){Yo.error("Failed to save sidebar state to localStorage:",t)}try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Yo.warn("Failed to set global sidebar state:",t)}}function Nb(){const e=Mb();try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Yo.warn("Failed to restore sidebar state:",t)}Yo.log("Initial sidebar collapsed state restored:",e)}async function SA(e,t){Nb()}async function _A(e,t){const r=!(()=>{try{return!!window.G7Core?.state?.getGlobal?.()?.sidebarCollapsed}catch{return Mb()}})();CA(r),Yo.log("Sidebar collapsed toggled to:",r)}const Xd=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 EA(e,t){const n=window.G7Core,{url:r,filename:s}=e?.params||{};if(!r){Xd.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!n?.api?.get){Xd.error("G7Core.api.get 이 초기화되지 않아 다운로드를 실행할 수 없습니다.");return}try{const o=await n.api.get(r,{responseType:"blob"});if(o){const i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=s||"",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}}catch(o){Xd.error("첨부파일 다운로드 실패",o),n?.toast?.error?.(n?.t?.("common.download_failed")??"Download failed")}}const Ya=window.G7Core?.createLogger?.("Handler:DetectAssetUrlMode")??{log:(...e)=>console.log("[Handler:DetectAssetUrlMode]",...e),warn:(...e)=>console.warn("[Handler:DetectAssetUrlMode]",...e),error:(...e)=>console.error("[Handler:DetectAssetUrlMode]",...e)},MA="G7_ASSET_PROBE_OK";async function Ob(e){try{const t=await fetch(e,{cache:"no-store",credentials:"omit"});if(!t.ok)return!1;const n=t.headers.get("content-type")??"";return/javascript|ecmascript/i.test(n)?(await t.text()).includes(MA):!1}catch{return!1}}async function Tb(){const[e,t]=await Promise.all([Ob("/api/system/asset-probe.js"),Ob("/api/system/asset-probe")]);return e&&t?"extension":!e&&t?"extensionless":"unavailable"}function NA(){return window.G7Config?.settings?.general?.asset_url_mode??"extension"}async function OA(e){try{const t=await Tb();if(t==="unavailable")return;const n=NA();if(t===n)return;window.G7Core?.state?.setGlobal?.({assetUrlModeDrift:{detected:t,stored:n}})}catch(t){Ya.warn("자산 URL 방식 대조 실패 (대시보드 동작에는 영향 없음):",t)}}async function TA(e,t){const n=window.G7Core,r=t?.setState??n?.state?.setLocal,s=o=>{typeof r=="function"?r({asset_url_mode_detect_status:o}):Ya.warn("setState 를 찾지 못해 감지 상태를 폼에 반영하지 못했습니다")};try{s("detecting");const o=await Tb();if(o==="unavailable"){s("unavailable");return}typeof r=="function"?r({"form.general.asset_url_mode":o,asset_url_mode_detect_status:o}):Ya.warn("setState 를 찾지 못해 감지 결과를 폼에 반영하지 못했습니다")}catch(o){Ya.error("자산 URL 방식 감지 실패:",o),s("unavailable")}}const Ka={detectAssetUrlMode:TA,checkAssetUrlModeDrift:OA,setTheme:lA,initTheme:aA,scrollToSection:Vu,initMenuFromUrl:hA,initFilterVisibility:gA,saveFilterVisibility:pA,toggleFilterVisibility:mA,resetFilterVisibility:bA,saveMultilingualTag:yA,cancelMultilingualTag:vA,updateMultilingualTagValue:xA,setDateRange:kA,toggleSidebar:_A,initSidebar:SA,downloadAttachment:EA},Ko=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:IdentityLauncher")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic:IdentityLauncher]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic:IdentityLauncher]",...e),error:(...e)=>console.error("[Template:sirsoft-admin_basic:IdentityLauncher]",...e)};function AA(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function DA(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function IA(e,t=null){const n={purpose:e.purpose};e.provider_id&&(n.provider_id=e.provider_id),t&&(n.target=t);const r=e.challenge_start_url||"/api/identity/challenges",s=await fetch(r,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...DA(),...AA()},body:JSON.stringify(n)}),o=await s.json().catch(()=>null);if(!s.ok||!o?.success){const a=o?.message??`Challenge 시작 실패 (HTTP ${s.status})`;throw new Error(a)}const i=o.data??o;return{id:i.id,expires_at:i.expires_at,render_hint:i.render_hint??e.render_hint??"text_code",public_payload:i.public_payload,redirect_url:i.redirect_url,max_attempts:typeof i.max_attempts=="number"?i.max_attempts:void 0}}async function LA(e){const t=window.G7Core,n=t?.identity;if(!t?.dispatch||!t?.state||!n)return Ko.error("G7Core 또는 G7Core.identity 가 초기화되지 않아 launcher 를 실행할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};if(e.render_hint==="external_redirect"||e.redirect_url)return n.redirectExternally(e);const r=e.target&&(e.target.email||e.target.phone)?e.target:null;let s;try{s=await IA(e,r)}catch(m){Ko.error("Challenge 시작 실패:",m);try{await t.dispatch({handler:"toast",params:{type:"error",message:m instanceof Error?m.message:"본인인증 시작에 실패했습니다."}})}catch{}return{status:"failed",failureCode:"CHALLENGE_START_FAILED",reason:m instanceof Error?m.message:String(m)}}if(s.redirect_url)return n.redirectExternally({...e,render_hint:"external_redirect",redirect_url:s.redirect_url});const o=s.expires_at?new Date(s.expires_at).getTime():0,i=o>0?Math.max(0,Math.floor((o-Date.now())/1e3)):0,a=typeof s.max_attempts=="number"?s.max_attempts:0;t.state.set({identityChallenge:{policy_key:e.policy_key,purpose:e.purpose,provider_id:e.provider_id??null,render_hint:s.render_hint,challenge_id:s.id,expires_at:s.expires_at,public_payload:s.public_payload??{},target:r,code:"",error:null,attempts:0,maxAttempts:a,remainingSeconds:i,resendCooldown:0}});let l=o,c=0;const d=window.setInterval(()=>{const m=l>0?Math.max(0,Math.floor((l-Date.now())/1e3)):0;c=Math.max(0,c-1),t.state.set({identityChallenge:{remainingSeconds:m,resendCooldown:c}})},1e3);let u=null;try{u=t.state.subscribe?.(m=>{const p=m?.identityChallenge?.expires_at;if(typeof p=="string"){const b=new Date(p).getTime();Number.isFinite(b)&&b!==l&&(l=b)}const y=m?.identityChallenge?.resendCooldown;typeof y=="number"&&y>c&&(c=y)})??null}catch{}const f=n.createDeferred();try{await t.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(m){return Ko.error("openModal 실패 — 풀페이지로 폴백:",m),window.clearInterval(d),u?.(),n.redirectExternally({...e,render_hint:"external_redirect",redirect_url:`/admin/identity/challenge?challenge_id=${encodeURIComponent(s.id)}&return=${encodeURIComponent(window.location.href)}`})}const g=await f;return window.clearInterval(d),u?.(),g}function PA(){const e=window.G7Core?.identity;if(!e?.setLauncher){Ko.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(LA),Ko.log("IDV launcher registered (sirsoft-admin_basic)")}function $A(e){const t=e.icons;return Array.isArray(t)?t.filter(n=>!!n&&typeof n=="object"&&typeof n.value=="string"):[]}function FA(e,t){const n=e.label;return typeof n=="string"?n.startsWith("$t:")?t(n.slice(3)):n:e.value}function zA(e,t,n){if(n==="")return!0;const r=n.toLowerCase();return e.value.toLowerCase().includes(r)||t.toLowerCase().includes(r)?!0:(e.keywords??[]).some(s=>s.toLowerCase().includes(r))}function VA({entry:e}){const t=e.preview;return t?.html?h.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:Zd}):t?.className?h.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:Zd}):h.jsx("i",{className:`fas fa-${e.value}`,style:Zd,"aria-hidden":"true"})}function HA({control:e,value:t,onChange:n,t:r}){const s=$A(e),o=t==null?"":String(t),i=typeof e.iconColumns=="number"?e.iconColumns:6,a=e.iconSearchPlaceholder,l=typeof a=="string"&&a.startsWith("$t:")?r(a.slice(3)):r("layout_editor.icon_picker.search_placeholder"),[c,d]=v.useState("");if(s.length===0)return h.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Ab,children:h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-free","data-testid":"g7le-widget-icon-picker-free",value:o,placeholder:r("layout_editor.icon_picker.free_input_hint"),onChange:g=>n(g.target.value===""?void 0:g.target.value),style:Db})});const u=g=>FA(g,r),f=s.filter(g=>zA(g,u(g),c));return h.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Ab,children:[h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:c,placeholder:l,onChange:g=>d(g.target.value),style:Db}),h.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...UA,gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:[h.jsx("button",{type:"button","data-testid":"g7le-icon-cell-none",title:r("layout_editor.icon_picker.none"),onClick:()=>n(void 0),"aria-pressed":o==="",style:o===""?Ib:qd,children:h.jsx("span",{style:BA,children:"—"})}),f.map(g=>{const m=g.value===o;return h.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:u(g),"aria-pressed":m,onClick:()=>n(g.value),style:m?Ib:qd,children:h.jsx(VA,{entry:g})},g.value)})]}),f.length===0&&h.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:jA,children:r("layout_editor.icon_picker.no_results")})]})}const Ab={display:"flex",flexDirection:"column",gap:6,width:"100%"},Db={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},UA={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},qd={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},Ib={...qd,border:"2px solid #2563eb",background:"#eff6ff"},Zd={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},BA={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},jA={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},Lb=130,Fn=20;function WA(e){const t=e?.arrayProp;return typeof t=="string"&&t?t:"tabs"}function GA(e){let t=0;for(const n of e){const r=typeof n.id=="number"?n.id:Number(n.id);Number.isFinite(r)&&r>t&&(t=r)}return t+1}function YA({node:e,params:t,cellBoxes:n,t:r,onPatchNode:s}){const o=WA(t),i=v.useMemo(()=>{const g=(e.props??{})[o];return typeof g=="string"||!Array.isArray(g)?null:g},[e,o]),a=v.useMemo(()=>{const g=new Map,m=`props.${o}.`;for(const p of n??[]){if(!p.path.startsWith(m))continue;const y=Number(p.path.slice(m.length));Number.isInteger(y)&&g.set(y,{top:p.top,left:p.left,width:p.width,height:p.height})}return g},[n,o]),l=v.useCallback(g=>{const m=e.props??{};s({...e,props:{...m,[o]:g}})},[e,o,s]),c=v.useCallback(g=>{if(!i)return;const p={id:GA(i),label:r("editor.tabnav_inplace.new_tab")},y=i.slice();y.splice(g,0,p),l(y)},[i,l,r]),d=v.useCallback(g=>{if(!i)return;const m=i.slice();m.splice(g,1),l(m)},[i,l]),u=v.useCallback((g,m)=>{if(!i)return;const p=g+m;if(p<0||p>=i.length)return;const y=i.slice(),[b]=y.splice(g,1);y.splice(p,0,b),l(y)},[i,l]);if(!i||a.size===0)return null;const f={position:"absolute",width:Fn,height:Fn,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,lineHeight:1,border:"1px solid rgba(0,0,0,0.15)",borderRadius:4,background:"#ffffff",color:"#1f2937",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.18)",pointerEvents:"auto",padding:0,zIndex:Lb};return h.jsx("div",{className:"g7le-tabnav-inplace","data-testid":"g7le-tabnav-inplace",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Lb},children:i.map((g,m)=>{const p=a.get(m);if(!p)return null;const y=p.left+p.width;return h.jsxs("div",{"data-testid":`g7le-tabnav-aff-${m}`,children:[h.jsx("button",{type:"button","data-testid":`g7le-tabnav-remove-${m}`,title:r("editor.tabnav_inplace.remove"),"aria-label":r("editor.tabnav_inplace.remove"),style:{...f,left:y-Fn/2,top:p.top-Fn/2,color:"#b91c1c"},onClick:b=>{b.preventDefault(),b.stopPropagation(),d(m)},children:"✕"}),m>0&&h.jsx("button",{type:"button","data-testid":`g7le-tabnav-move-left-${m}`,title:r("editor.tabnav_inplace.move_left"),"aria-label":r("editor.tabnav_inplace.move_left"),style:{...f,left:p.left,top:p.top+p.height-Fn/2},onClick:b=>{b.preventDefault(),b.stopPropagation(),u(m,-1)},children:"◀"}),m{b.preventDefault(),b.stopPropagation(),u(m,1)},children:"▶"}),m===0&&h.jsx("button",{type:"button","data-testid":"g7le-tabnav-add-0",title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:p.left-Fn,top:p.top+p.height/2-Fn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(0)},children:"+"}),h.jsx("button",{type:"button","data-testid":`g7le-tabnav-add-${m+1}`,title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:y-Fn/2,top:p.top+p.height/2-Fn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(m+1)},children:"+"})]},`tab-aff-${g.id}-${m}`)})})}const Qd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:EditorWidgets")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic:EditorWidgets]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic:EditorWidgets]",...e)};function KA(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){Qd.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",HA),Qd.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)"),e.registerCanvasOverlay&&(e.registerCanvasOverlay("tabnav",YA),Qd.log("편집기 캔버스 오버레이 'tabnav' 등록됨(TabNavigation 탭 인플레이스)"))}const Jd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic")??{log:(...e)=>console.log("[Template:sirsoft-admin_basic]",...e),warn:(...e)=>console.warn("[Template:sirsoft-admin_basic]",...e),error:(...e)=>console.error("[Template:sirsoft-admin_basic]",...e)};typeof window<"u"&&(window.G7TemplateHandlers=Ka);function Pb(){if(typeof window<"u"){let e=0;const t=50,n=()=>{const r=window.G7Core?.getActionDispatcher?.();r?(Object.entries(Ka).forEach(([s,o])=>{r.registerHandler(s,o)}),Jd.log(`${Object.keys(Ka).length} custom handler(s) registered:`,Object.keys(Ka)),PA(),Nb()):(e++,e<=t?(Jd.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(n,100)):Jd.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?n():window.addEventListener("load",n)}}return KA(),Pb(),R.A=qr,R.Accordion=Oc,R.ActionMenu=Vs,R.AdminFooter=Tv,R.AdminHeader=Ev,R.AdminSidebar=_v,R.Alert=Xu,R.AlertDialog=mv,R.Badge=hu,R.BarChart=Q5,R.Breadcrumb=Wu,R.Button=le,R.Card=oy,R.CardGrid=Ry,R.CategoryTree=t2,R.Checkbox=On,R.ChipCheckbox=UM,R.Code=ty,R.CodeEditor=Qx,R.ColumnSelector=sw,R.ConfirmDialog=Bu,R.Container=R5,R.DataGrid=Ky,R.Dialog=Uu,R.Div=I,R.DonutChart=J5,R.Dropdown=tv,R.DropdownButton=BM,R.DropdownMenuItem=jM,R.DynamicFieldList=RM,R.EmptyState=kv,R.ExtensionBadge=jh,R.FileInput=ou,R.FileUploader=u0,R.FilterGroup=ov,R.FilterVisibilitySelector=PM,R.Flex=tA,R.Form=al,R.FormField=sN,R.Fragment=ry,R.Grid=eA,R.H1=sl,R.H2=cr,R.H3=Xr,R.H4=iu,R.Hr=sy,R.HtmlContent=kl,R.HtmlEditor=AM,R.I=yt,R.Icon=ae,R.IconButton=hv,R.IconName=he,R.IconSelect=q_,R.ImageGallery=ia,R.Img=Nn,R.Input=Et,R.Label=gn,R.LanguageSelector=Ov,R.LayoutEditorHeader=Pv,R.LayoutFileList=$v,R.LayoutHistoryPanel=Rx,R.LayoutWarnings=LM,R.Li=il,R.LoadingSpinner=Sv,R.LoginForm=ew,R.Modal=ri,R.MultilingualInput=fl,R.MultilingualLocaleContext=ld,R.MultilingualTabPanel=rN,R.MultilingualTagInput=rS,R.Nav=Jo,R.NotificationCenter=Mv,R.Ol=Xb,R.Optgroup=Jb,R.Option=Qb,R.P=kt,R.PageHeader=Av,R.PageLoading=lw,R.PageTransitionIndicator=iw,R.Pagination=Ro,R.PermissionTree=R_,R.Pre=ny,R.ProductCard=nv,R.RadioGroup=NM,R.RichSelect=VM,R.SearchBar=sv,R.SearchableDropdown=sS,R.Section=au,R.SectionHeader=Iv,R.SectionLayout=nA,R.Select=Zr,R.SlotContainer=zM,R.SortableMenuItem=Dg,R.SortableMenuList=K_,R.Span=J,R.StatCard=rv,R.StatusBadge=ei,R.Svg=Jn,R.TabNavigation=iv,R.TabNavigationScroll=uv,R.Table=ll,R.TagInput=eS,R.TagSelect=oS,R.Tbody=dl,R.Td=rn,R.TemplateCard=Lv,R.Textarea=lr,R.Tfoot=ul,R.Th=Qr,R.Thead=cl,R.ThemeToggle=nw,R.ThreeColumnLayout=rA,R.Toast=xv,R.Toggle=hl,R.Tr=dr,R.Ul=ol,R.UnifiedIcon=ey,R.UserProfile=Nv,R.VersionList=hf,R.configureJSONLanguageService=Xx,R.defaultJSONSchemas=cf,R.executeImageDownload=rd,R.getJSONLanguageDefaults=Ll,R.initTemplate=Pb,R.jsonEditorDefaults=Yx,R.monacoInitOptions=Kx,R.templateMetadata=sA,R.useCurrentMultilingualLocale=y0,R.useImageGallery=Qp,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R})({},ReactJSXRuntime,React,ReactDOM); diff --git a/templates/_bundled/sirsoft-admin_basic/dist/src/components/composite/Pagination.d.ts b/templates/_bundled/sirsoft-admin_basic/dist/src/components/composite/Pagination.d.ts index 223574fc..19898325 100644 --- a/templates/_bundled/sirsoft-admin_basic/dist/src/components/composite/Pagination.d.ts +++ b/templates/_bundled/sirsoft-admin_basic/dist/src/components/composite/Pagination.d.ts @@ -6,8 +6,8 @@ export interface PaginationProps { * 마지막 페이지 번호 * * 총 건수가 상한을 넘겨 정확히 세지 않은 목록은 마지막 페이지를 계산할 수 없다. - * 그 경우 서버가 `null` 을 보내며, 페이지 번호 목록과 마지막 페이지 점프가 사라지고 - * 이전/다음 이동만 남는다. 0 이나 1 로 채우면 화면이 "1페이지뿐" 이라고 잘못 말하게 된다. + * 그 경우 서버가 `null` 을 보내며, 마지막 페이지 점프만 사라진다. 1 부터 현재 페이지까지와 + * (`hasMorePages` 가 참이면) 다음 페이지 번호는 그대로 그린다. 0 이나 1 로 채우면 화면이 "1페이지뿐" 이라고 잘못 말하게 된다. */ totalPages: number | null; onPageChange: (page: number) => void; diff --git a/templates/_bundled/sirsoft-admin_basic/src/components/composite/Pagination.tsx b/templates/_bundled/sirsoft-admin_basic/src/components/composite/Pagination.tsx index 3a0435e1..fa9d0e6a 100644 --- a/templates/_bundled/sirsoft-admin_basic/src/components/composite/Pagination.tsx +++ b/templates/_bundled/sirsoft-admin_basic/src/components/composite/Pagination.tsx @@ -14,8 +14,8 @@ export interface PaginationProps { * 마지막 페이지 번호 * * 총 건수가 상한을 넘겨 정확히 세지 않은 목록은 마지막 페이지를 계산할 수 없다. - * 그 경우 서버가 `null` 을 보내며, 페이지 번호 목록과 마지막 페이지 점프가 사라지고 - * 이전/다음 이동만 남는다. 0 이나 1 로 채우면 화면이 "1페이지뿐" 이라고 잘못 말하게 된다. + * 그 경우 서버가 `null` 을 보내며, 마지막 페이지 점프만 사라진다. 1 부터 현재 페이지까지와 + * (`hasMorePages` 가 참이면) 다음 페이지 번호는 그대로 그린다. 0 이나 1 로 채우면 화면이 "1페이지뿐" 이라고 잘못 말하게 된다. */ totalPages: number | null; onPageChange: (page: number) => void; @@ -91,8 +91,8 @@ export const Pagination: React.FC = ({ editorAttrs, }) => { // 총 건수를 정확히 세지 못한 목록은 마지막 페이지를 계산할 수 없다. - // 이때는 페이지 번호 목록과 마지막 페이지 점프를 감추고 이전/다음 이동만 남긴다 — - // 끝까지 넘겨 보는 것은 그대로 가능하다. + // 계산 불가한 값은 마지막 페이지 번호 하나뿐이므로 그 점프만 감춘다. 1 부터 현재 + // 페이지까지는 확실히 존재하고, 다음 페이지 존재 여부는 서버가 `hasMorePages` 로 알린다. const isBounded = totalPages !== null && totalPages !== undefined; const resolvedTotalPages = isBounded ? (totalPages as number) : 0; @@ -112,7 +112,21 @@ export const Pagination: React.FC = ({ const pages: (number | string)[] = []; if (!isBounded) { - // 마지막 페이지를 모르면 번호 목록을 만들 수 없다 (현재 페이지만 별도로 표시) + // 마지막 페이지를 모르면 아는 범위(1..현재, 다음이 있으면 현재+1)만 그린다. + // 현재+1 너머는 존재 여부를 모르므로 번호 대신 계속됨 표시만 둔다. + const halfVisible = Math.floor(maxVisiblePages / 2); + const startPage = currentPage <= maxVisiblePages ? 1 : currentPage - halfVisible; + if (startPage > 1) { + pages.push(1); + if (startPage > 2) pages.push('...'); + } + for (let i = startPage; i <= currentPage; i++) { + pages.push(i); + } + if (hasMorePages) { + pages.push(currentPage + 1); + pages.push('...'); + } return pages; } @@ -160,7 +174,7 @@ export const Pagination: React.FC = ({ } return pages; - }, [currentPage, resolvedTotalPages, isBounded, maxVisiblePages]); + }, [currentPage, resolvedTotalPages, isBounded, maxVisiblePages, hasMorePages]); const handlePageClick = (page: number) => { if (page < 1 || page === currentPage) return; @@ -210,13 +224,8 @@ export const Pagination: React.FC = ({ {prevText || <>‹} - {/* Page Numbers — 마지막 페이지를 모르면 현재 페이지만 표시 */} + {/* Page Numbers — 마지막 페이지를 모르면 아는 범위까지만 표시 */}
- {!isBounded && ( - - {currentPage} - - )} {pageNumbers.map((page, index) => { if (page === '...') { return ( diff --git a/templates/_bundled/sirsoft-admin_basic/src/components/composite/__tests__/PaginationUnboundedNumbers.test.tsx b/templates/_bundled/sirsoft-admin_basic/src/components/composite/__tests__/PaginationUnboundedNumbers.test.tsx new file mode 100644 index 00000000..e8a8973f --- /dev/null +++ b/templates/_bundled/sirsoft-admin_basic/src/components/composite/__tests__/PaginationUnboundedNumbers.test.tsx @@ -0,0 +1,110 @@ +import { describe, it, expect, vi } from 'vitest'; +import { render, screen, fireEvent } from '@testing-library/react'; +import { Pagination } from '../Pagination'; + +/** + * 마지막 페이지를 모르는 목록의 페이지 번호 목록 회귀 + * + * 총 건수가 상한을 넘겨 `last_page` 가 `null` 이면 계산할 수 없는 값은 마지막 페이지 + * 번호 하나뿐이다. 1 부터 현재 페이지까지는 확실히 존재하고, 다음 페이지 존재 여부는 + * 서버가 `has_more_pages` 로 알린다. 그런데 종전 구현은 번호 목록을 통째로 비우고 + * 현재 페이지 숫자 하나만 남겨, 운영자가 앞 페이지로 직접 뛰어갈 방법을 잃었다 + * (활동 로그 화면 실측: "총 10000건 이상" 인데 페이저에 "1" 하나). + * + * 합의된 동작(CHANGELOG 7.0.10): 마지막 페이지로 바로 뛰는 버튼만 감춘다. + */ +describe('Pagination — last_page 를 모를 때의 페이지 번호 목록', () => { + // 접근성 이름은 「N페이지」 라벨이므로 번호 버튼은 표시 텍스트로 찾는다 + const pageButton = (n: number) => + screen.queryAllByRole('button').find((b) => b.textContent?.trim() === String(n)) ?? null; + + it('1 부터 현재 페이지까지의 번호가 그대로 그려진다', () => { + render( + + ); + + for (let n = 1; n <= 5; n++) { + expect(pageButton(n)).toBeInTheDocument(); + } + expect(pageButton(5)).toHaveAttribute('aria-current', 'page'); + }); + + it('다음 페이지가 있으면 그 번호 하나와 계속됨 표시가 붙고, 그 너머는 그리지 않는다', () => { + render( + + ); + + expect(pageButton(6)).toBeInTheDocument(); + expect(pageButton(7)).not.toBeInTheDocument(); + expect(screen.getByText('...')).toBeInTheDocument(); + }); + + it('다음 페이지가 없으면 현재 페이지가 끝이다 — 계속됨 표시도 없다', () => { + render( + + ); + + expect(pageButton(3)).toBeInTheDocument(); + expect(pageButton(4)).not.toBeInTheDocument(); + expect(screen.queryByText('...')).not.toBeInTheDocument(); + }); + + it('첫 페이지에서도 번호가 버튼으로 그려진다', () => { + render( + + ); + + expect(pageButton(1)).toBeInTheDocument(); + expect(pageButton(2)).toBeInTheDocument(); + }); + + it('깊은 페이지에서는 앞쪽을 접고 현재 페이지 주변만 남긴다', () => { + render( + + ); + + expect(pageButton(1)).toBeInTheDocument(); + expect(pageButton(2)).not.toBeInTheDocument(); + expect(pageButton(10)).toBeInTheDocument(); + expect(pageButton(11)).toBeInTheDocument(); + expect(pageButton(12)).toBeInTheDocument(); + expect(pageButton(13)).toBeInTheDocument(); + expect(pageButton(14)).not.toBeInTheDocument(); + expect(screen.getAllByText('...')).toHaveLength(2); + }); + + it('앞 페이지 번호와 다음 페이지 번호를 클릭하면 그 페이지로 이동한다', () => { + const onPageChange = vi.fn(); + render( + + ); + + fireEvent.click(pageButton(3)!); + expect(onPageChange).toHaveBeenCalledWith(3); + + fireEvent.click(pageButton(6)!); + expect(onPageChange).toHaveBeenCalledWith(6); + }); + + it('마지막 페이지 점프 버튼만 감춰진다', () => { + render( + + ); + + expect(screen.queryByLabelText('마지막 페이지')).not.toBeInTheDocument(); + expect(screen.getByLabelText('이전 페이지')).toBeInTheDocument(); + expect(screen.getByLabelText('다음 페이지')).toBeInTheDocument(); + }); +}); diff --git a/templates/_bundled/sirsoft-basic/AGENTS.md b/templates/_bundled/sirsoft-basic/AGENTS.md index bf30aa5c..331f4e48 100644 --- a/templates/_bundled/sirsoft-basic/AGENTS.md +++ b/templates/_bundled/sirsoft-basic/AGENTS.md @@ -158,7 +158,7 @@ API 까지만 소유하고, 그 API 를 소비해 실제로 그리는 것은 이 | 종류 | 개수 | 위치 | |---|---|---| | PHPUnit | 0개 | — | -| Vitest | 142개 | `vitest.config.ts` | +| Vitest | 143개 | `vitest.config.ts` | | Playwright | 8개 | `tests/Playwright` | | 시나리오 매니페스트 | 3개 | `tests/scenarios` | diff --git a/templates/_bundled/sirsoft-basic/CHANGELOG.md b/templates/_bundled/sirsoft-basic/CHANGELOG.md index 3405c288..a48b82cc 100644 --- a/templates/_bundled/sirsoft-basic/CHANGELOG.md +++ b/templates/_bundled/sirsoft-basic/CHANGELOG.md @@ -17,6 +17,7 @@ ### Fixed +- 총 건수를 정확히 세지 못한 목록(대량 검색 결과, 게시글이 아주 많은 게시판 등)에서 페이지 번호가 전부 사라지고 현재 페이지 숫자 하나만 남던 문제를 수정했습니다. 이제 1 부터 현재 페이지까지의 번호와 다음 페이지 번호가 그대로 표시되며, 감춰지는 것은 마지막 페이지로 뛰는 버튼뿐입니다. - 게시글·페이지 본문을 표시할 때 쓰는 HTML 정화 라이브러리가 구버전에 머물러 있던 문제를 고쳤습니다. 관리자 템플릿과 동일한 최신 버전으로 맞췄습니다. (#126 @jiwonpapa 님께서 제보해주셨습니다.) - 통화 표시·선호 통화 저장 관련 화면 동작 함수 4종이 실제 호출 규약과 다른 형태로 작성돼 있어, 호출되면 값이 전달되지 않고 상태가 잘못 기록되던 문제를 고쳤습니다. - 주소 검색을 불러오지 못한 상태에서 주문서의 우편번호·주소를 직접 입력해도 값이 주문에 반영되지 않아 결제 버튼이 계속 눌리지 않던 문제를 고쳤습니다. 이제 직접 입력한 주소로 주문을 끝까지 진행할 수 있습니다. diff --git a/templates/_bundled/sirsoft-basic/dist/js/components.iife.js b/templates/_bundled/sirsoft-basic/dist/js/components.iife.js index d883f920..3b63c472 100644 --- a/templates/_bundled/sirsoft-basic/dist/js/components.iife.js +++ b/templates/_bundled/sirsoft-basic/dist/js/components.iife.js @@ -1,4 +1,4 @@ -var SirsoftBasic=(function(ee,d,C,tr){"use strict";function md(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 A=md(C),bd=()=>window.G7Core,R=C.forwardRef(({children:e,variant:t="primary",size:r="md",className:n="",...o},a)=>{const s="inline-flex items-center justify-center",l=bd()?.style?.mergeClasses?.(s,n)??`${s} ${n}`;return d.jsx("button",{ref:a,className:l,...o,children:e})});R.displayName="Button";const j=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("div",{ref:n,className:t,...r,children:e})),te=({children:e,className:t="",...r})=>d.jsx("span",{className:t,...r,children:e}),En=({children:e,className:t="",...r})=>d.jsx("svg",{className:t,...r,children:e}),At=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,w]=C.useState(a??s??"");C.useEffect(()=>{!u&&!g.current&&a!==void 0&&w(a)},[a,u]);const k=C.useCallback(()=>{g.current=!0},[]),M=C.useCallback(y=>{if(g.current=!1,n){const E=y.target.value;w(E);const O=new Event("change",{bubbles:!0});Object.defineProperty(O,"target",{writable:!1,value:{value:E}}),Object.defineProperty(O,"currentTarget",{writable:!1,value:{value:E}}),n(O)}},[n]),v=C.useCallback(y=>{const E=y.target.value;w(E),!g.current&&n&&n(y)},[n]),T=C.useCallback(y=>{g.current||o&&o(y)},[o]),{loadingactions:I,formdata:S,...N}=c;if(u)return d.jsx("input",{ref:p,type:l,className:r,onChange:n,checked:f,defaultChecked:h,value:a,...N});const x=a!==void 0?{value:m}:{defaultValue:s};return d.jsx("input",{ref:p,type:l,className:r,onChange:v,onKeyPress:T,onCompositionStart:k,onCompositionEnd:M,...x,...N})});At.displayName="Input";const cs=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(([v,T])=>{v.startsWith("data-editor-")||v==="id"||v==="onMouseMove"||v==="onMouseLeave"?p[v]=T:m[v]=T});const w=C.useCallback(()=>{!l&&i.current&&i.current.click()},[l,i]),k=C.useCallback(v=>{const T=v.target.files?.[0]||null;if(!T){g(""),r?.(null);return}if(t&&T.size>t*1024*1024){const I=`File size exceeds ${t}MB limit`;n?.(I),i.current&&(i.current.value=""),g("");return}g(T.name),r?.(T)},[t,r,n,i]),M=C.useCallback(v=>{v.stopPropagation(),i.current&&(i.current.value=""),g(""),r?.(null)},[r,i]);return d.jsxs(j,{className:`flex items-center gap-2 ${s}`,...p,children:[d.jsx(At,{ref:i,type:"file",accept:e,onChange:k,disabled:l,className:"hidden",...m}),d.jsx(R,{type:"button",onClick:w,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(te,{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:u||a}),u&&!l&&d.jsx(R,{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(En,{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"})})})]})});cs.displayName="FileInput";var nt=(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))(nt||{});const yd={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=yd[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(" "),w=l||p.replace(/-/g," ");return d.jsx("i",{className:m,style:h,"aria-label":w,role:"img",...c})},Tr=(e,t)=>window.G7Core?.t?.(e,t)??e,xo={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}}},ds=[xo.minLength];function vd(e){const[t,r]=e.split(":"),n=xo[t];if(!n)return null;const o=r?parseInt(r,10):n.defaultParam;return{rule:n,param:isNaN(o)?n.defaultParam:o}}const us=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:w,disabled:k,...M},v)=>{const T=C.useRef(null);C.useImperativeHandle(v,()=>T.current);const[I,S]=C.useState(!1),[N,x]=C.useState(!1),[y,E]=C.useState(m??w??"");C.useEffect(()=>{m!==void 0&&E(m)},[m]);const O=C.useMemo(()=>f&&f.length>0?f.map(H=>({rule:H,param:H.defaultParam})):h&&h.length>0?h.map(H=>vd(H)).filter(H=>H!==null):ds.map(H=>({rule:H,param:H.defaultParam})),[f,h]),$=C.useMemo(()=>!c||c.length===0?O:O.filter(H=>c.includes(H.rule.key)),[O,c]),D=C.useMemo(()=>!n||o?{}:$.reduce((H,{rule:W,param:Q})=>(H[W.key]=W.validate(y,Q),H),{}),[y,$,n,o]),L=C.useMemo(()=>!o||a===void 0?!0:y===a&&y.length>0,[o,y,a]),U=C.useMemo(()=>n?Object.values(D).every(H=>H):!0,[D,n]);C.useEffect(()=>{if(l&&n&&!o){const H=Object.entries(D).filter(([,W])=>!W).map(([W])=>W);l(U,H)}},[U,D,l,n,o]),C.useEffect(()=>{s&&o&&s(L)},[L,s,o]);const _=C.useCallback(()=>{S(H=>!H)},[]),b=C.useCallback(H=>{const W=H.target.value;E(W),p&&p(H)},[p]),z=C.useCallback(H=>{x(H.getModifierState("CapsLock"))},[]),{loadingactions:F,formdata:G,...X}=M,B={},Y={};for(const[H,W]of Object.entries(X))H.startsWith("data-editor-")||H==="onMouseMove"||H==="onMouseLeave"?B[H]=W:Y[H]=W;return d.jsxs("div",{className:`relative ${i}`,...B,children:[d.jsxs("div",{className:"relative",children:[d.jsx("input",{ref:T,type:I?"text":"password",className:`${g} ${r?"pr-10":""}`,value:m!==void 0?m:void 0,defaultValue:m===void 0?w:void 0,onChange:b,onKeyDown:z,onKeyUp:z,disabled:k,...Y}),r&&d.jsx("button",{type:"button",onClick:_,disabled:k,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":Tr(I?"auth.password_input.hide":"auth.password_input.show"),children:d.jsx(fe,{name:I?"eye-slash":"eye",className:"w-5 h-5"})})]}),N&&!I&&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:Tr("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:Tr(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:$.map(({rule:H,param:W})=>{const Q=D[H.key],be=W!==void 0?{count:W}: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:Tr(H.labelKey,be)})]},H.key)})}),t&&d.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:t})]})});us.displayName="PasswordInput";const ko=({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 v=M.target.value;c(v);const T=new Event("change",{bubbles:!0});Object.defineProperty(T,"target",{writable:!1,value:{value:v}}),Object.defineProperty(T,"currentTarget",{writable:!1,value:{value:v}}),n(T)}},[n]),g=C.useCallback(M=>{const v=M.target.value;c(v),!l.current&&n&&n(M)},[n]),{loadingactions:p,formdata:m,...w}=s,k=o!==void 0?{value:h}:{defaultValue:a};return d.jsx("textarea",{ref:f,className:r,onChange:g,onCompositionStart:i,onCompositionEnd:u,...k,...w})},Ar=({children:e,className:t="",...r})=>d.jsx("label",{className:t,...r,children:e}),Gt=({children:e,className:t="",...r})=>d.jsx("p",{className:t,...r,children:e}),jt=({className:e="",alt:t="",...r})=>d.jsx("img",{className:e,alt:t,...r}),wd=({children:e,className:t="",...r})=>d.jsx("h1",{className:t,...r,children:e}),fs=({children:e,className:t="",...r})=>d.jsx("h2",{className:t,...r,children:e}),Tn=({children:e,className:t="",...r})=>d.jsx("h3",{className:t,...r,children:e}),gs=({children:e,className:t="",...r})=>d.jsx("h4",{className:t,...r,children:e}),Co=({children:e,className:t="",...r})=>d.jsx("ul",{className:t,...r,children:e}),xd=({children:e,className:t="",...r})=>d.jsx("ol",{className:t,...r,children:e}),er=({children:e,className:t="",...r})=>d.jsx("li",{className:t,...r,children:e}),_o=({children:e,className:t="",...r})=>d.jsx("a",{className:t,...r,children:e}),So=({children:e,className:t="",...r})=>d.jsx("form",{className:t,...r,children:e}),kd=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 Cd(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 hs=({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(""),[w,k]=C.useState(null),M=C.useRef(null),v=C.useRef(null),T=C.useRef(null),I=C.useRef(null),S=C.useMemo(()=>n?Array.isArray(n)?n.length===0?[]:typeof n[0]=="string"?n.map(_=>({value:_,label:Cd(_)})):n:(kd.warn("options prop is not an array:",n),null):null,[n]),N=C.useMemo(()=>S&&S.find(b=>String(b.value)===String(a))?.label||"",[S,a]),x=C.useMemo(()=>{if(!S)return null;if(!f||p.trim()==="")return S;const _=p.trim().toLowerCase();return S.filter(b=>b.label.toLowerCase().includes(_)||String(b.value).toLowerCase().includes(_))},[S,f,p]);C.useEffect(()=>{if(u&&f){m("");const _=setTimeout(()=>T.current?.focus(),0);return()=>clearTimeout(_)}u||m("")},[u,f]);const y=C.useCallback(()=>{if(!v.current)return;const _=v.current.getBoundingClientRect(),b=window.innerHeight-_.bottom,F=b<280&&_.top>b;k(F?{bottom:window.innerHeight-_.top+4,left:_.left,width:_.width}:{top:_.bottom+4,left:_.left,width:_.width})},[]);C.useEffect(()=>{if(!u){k(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 _=b=>{const z=b.target;M.current&&!M.current.contains(z)&&(!I.current||!I.current.contains(z))&&g(!1)};return u&&document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},[u]),C.useEffect(()=>{const _=b=>{b.key==="Escape"&&u&&(g(!1),v.current?.focus())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const E=()=>{l||g(!u)},O=_=>{s&&s({target:{value:_},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),v.current?.focus()};if(!S)return d.jsx("select",{className:o,value:a,onChange:s,disabled:l,...c,...i,children:e});const $=o&&o.includes("bg-"),D=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=$?`${o}${D?"":" 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}`,U={...c,...i};return d.jsxs(j,{ref:M,className:"relative",...U,children:[d.jsxs(R,{ref:v,type:"button",onClick:E,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(te,{className:"truncate",children:N||" "}),d.jsx(En,{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&&w&&tr.createPortal(d.jsxs(j,{ref:I,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:w.top,bottom:w.bottom,left:w.left,width:w.width},role:"listbox",children:[f&&d.jsx(j,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:d.jsx(At,{ref:T,type:"text",value:p,onChange:_=>m(_.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(j,{className:"py-2 max-h-60 overflow-auto",children:[x&&x.length===0&&d.jsx(j,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:p?"No results":""}),(x??[]).map(_=>{const b=String(_.value)===String(a);return d.jsxs(R,{type:"button",onClick:()=>!_.disabled&&O(_.value),disabled:_.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"} ${_.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":b,children:[d.jsx(te,{children:_.label}),b&&d.jsx(En,{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"})})]},_.value)})]})]}),document.body)]})},_d=({children:e,className:t="",...r})=>d.jsx("option",{className:t,...r,children:e}),Sd=({children:e,className:t="",...r})=>d.jsx("optgroup",{className:t,...r,children:e}),ps=C.forwardRef(({label:e,className:t="",...r},n)=>d.jsx("input",{ref:n,type:"checkbox",className:t,...r}));ps.displayName="Checkbox";const Ed=({children:e,className:t="",...r})=>d.jsx("table",{className:t,...r,children:e}),Td=({children:e,className:t="",...r})=>d.jsx("thead",{className:t,...r,children:e}),Ad=({children:e,className:t="",...r})=>d.jsx("tbody",{className:t,...r,children:e}),Nd=({children:e,className:t="",...r})=>d.jsx("tr",{className:t,...r,children:e}),Od=({children:e,className:t="",...r})=>d.jsx("th",{className:t,...r,children:e}),Md=({children:e,className:t="",...r})=>d.jsx("td",{className:t,...r,children:e}),Zr=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("nav",{ref:n,className:t,...r,children:e}));Zr.displayName="Nav";const ms=({children:e,className:t="",...r})=>d.jsx("section",{className:t,...r,children:e}),Id=({children:e,className:t="",...r})=>d.jsx("code",{className:t,...r,children:e}),Eo=C.forwardRef(({className:e="",...t},r)=>d.jsx("hr",{ref:r,className:e,...t})),Pd=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("header",{ref:n,className:t,...r,children:e})),bs=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,To=e=>{const t=bs(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},Dd=()=>{const e=localStorage.getItem("g7_color_scheme");return e&&["auto","light","dark"].includes(e)?e:"auto"},An=({onThemeChange:e,className:t="",autoText:r="System",lightText:n="Light",darkText:o="Dark",id:a,editorAttrs:s})=>{const l=Dd(),[f,h]=C.useState(l),[c,i]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{To(f)},[]),C.useEffect(()=>{if(f!=="auto")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),w=()=>{To("auto")};return m.addEventListener("change",w),()=>m.removeEventListener("change",w)},[f]),C.useEffect(()=>{const m=w=>{u.current&&!u.current.contains(w.target)&&i(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const g=m=>{h(m),localStorage.setItem("g7_color_scheme",m),To(m),i(!1),e?.(m)},p=()=>bs(f)==="dark"?nt.Moon:nt.Sun;return d.jsxs(j,{ref:u,className:`relative ${t}`,id:a,...s,children:[d.jsx(R,{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(j,{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(j,{className:"py-2",children:[d.jsxs(R,{onClick:()=>g("auto"),className:` +var SirsoftBasic=(function(ee,d,C,tr){"use strict";function md(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 A=md(C),bd=()=>window.G7Core,R=C.forwardRef(({children:e,variant:t="primary",size:r="md",className:n="",...o},a)=>{const s="inline-flex items-center justify-center",l=bd()?.style?.mergeClasses?.(s,n)??`${s} ${n}`;return d.jsx("button",{ref:a,className:l,...o,children:e})});R.displayName="Button";const j=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("div",{ref:n,className:t,...r,children:e})),te=({children:e,className:t="",...r})=>d.jsx("span",{className:t,...r,children:e}),En=({children:e,className:t="",...r})=>d.jsx("svg",{className:t,...r,children:e}),At=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,x]=C.useState(a??s??"");C.useEffect(()=>{!u&&!g.current&&a!==void 0&&x(a)},[a,u]);const k=C.useCallback(()=>{g.current=!0},[]),M=C.useCallback(y=>{if(g.current=!1,n){const E=y.target.value;x(E);const O=new Event("change",{bubbles:!0});Object.defineProperty(O,"target",{writable:!1,value:{value:E}}),Object.defineProperty(O,"currentTarget",{writable:!1,value:{value:E}}),n(O)}},[n]),v=C.useCallback(y=>{const E=y.target.value;x(E),!g.current&&n&&n(y)},[n]),T=C.useCallback(y=>{g.current||o&&o(y)},[o]),{loadingactions:I,formdata:S,...N}=c;if(u)return d.jsx("input",{ref:p,type:l,className:r,onChange:n,checked:f,defaultChecked:h,value:a,...N});const w=a!==void 0?{value:m}:{defaultValue:s};return d.jsx("input",{ref:p,type:l,className:r,onChange:v,onKeyPress:T,onCompositionStart:k,onCompositionEnd:M,...w,...N})});At.displayName="Input";const cs=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(([v,T])=>{v.startsWith("data-editor-")||v==="id"||v==="onMouseMove"||v==="onMouseLeave"?p[v]=T:m[v]=T});const x=C.useCallback(()=>{!l&&i.current&&i.current.click()},[l,i]),k=C.useCallback(v=>{const T=v.target.files?.[0]||null;if(!T){g(""),r?.(null);return}if(t&&T.size>t*1024*1024){const I=`File size exceeds ${t}MB limit`;n?.(I),i.current&&(i.current.value=""),g("");return}g(T.name),r?.(T)},[t,r,n,i]),M=C.useCallback(v=>{v.stopPropagation(),i.current&&(i.current.value=""),g(""),r?.(null)},[r,i]);return d.jsxs(j,{className:`flex items-center gap-2 ${s}`,...p,children:[d.jsx(At,{ref:i,type:"file",accept:e,onChange:k,disabled:l,className:"hidden",...m}),d.jsx(R,{type:"button",onClick:x,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(te,{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:u||a}),u&&!l&&d.jsx(R,{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(En,{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"})})})]})});cs.displayName="FileInput";var nt=(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))(nt||{});const yd={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=yd[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(" "),x=l||p.replace(/-/g," ");return d.jsx("i",{className:m,style:h,"aria-label":x,role:"img",...c})},Tr=(e,t)=>window.G7Core?.t?.(e,t)??e,xo={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}}},ds=[xo.minLength];function vd(e){const[t,r]=e.split(":"),n=xo[t];if(!n)return null;const o=r?parseInt(r,10):n.defaultParam;return{rule:n,param:isNaN(o)?n.defaultParam:o}}const us=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:x,disabled:k,...M},v)=>{const T=C.useRef(null);C.useImperativeHandle(v,()=>T.current);const[I,S]=C.useState(!1),[N,w]=C.useState(!1),[y,E]=C.useState(m??x??"");C.useEffect(()=>{m!==void 0&&E(m)},[m]);const O=C.useMemo(()=>f&&f.length>0?f.map(H=>({rule:H,param:H.defaultParam})):h&&h.length>0?h.map(H=>vd(H)).filter(H=>H!==null):ds.map(H=>({rule:H,param:H.defaultParam})),[f,h]),$=C.useMemo(()=>!c||c.length===0?O:O.filter(H=>c.includes(H.rule.key)),[O,c]),P=C.useMemo(()=>!n||o?{}:$.reduce((H,{rule:W,param:Q})=>(H[W.key]=W.validate(y,Q),H),{}),[y,$,n,o]),L=C.useMemo(()=>!o||a===void 0?!0:y===a&&y.length>0,[o,y,a]),U=C.useMemo(()=>n?Object.values(P).every(H=>H):!0,[P,n]);C.useEffect(()=>{if(l&&n&&!o){const H=Object.entries(P).filter(([,W])=>!W).map(([W])=>W);l(U,H)}},[U,P,l,n,o]),C.useEffect(()=>{s&&o&&s(L)},[L,s,o]);const _=C.useCallback(()=>{S(H=>!H)},[]),b=C.useCallback(H=>{const W=H.target.value;E(W),p&&p(H)},[p]),z=C.useCallback(H=>{w(H.getModifierState("CapsLock"))},[]),{loadingactions:F,formdata:G,...X}=M,B={},Y={};for(const[H,W]of Object.entries(X))H.startsWith("data-editor-")||H==="onMouseMove"||H==="onMouseLeave"?B[H]=W:Y[H]=W;return d.jsxs("div",{className:`relative ${i}`,...B,children:[d.jsxs("div",{className:"relative",children:[d.jsx("input",{ref:T,type:I?"text":"password",className:`${g} ${r?"pr-10":""}`,value:m!==void 0?m:void 0,defaultValue:m===void 0?x:void 0,onChange:b,onKeyDown:z,onKeyUp:z,disabled:k,...Y}),r&&d.jsx("button",{type:"button",onClick:_,disabled:k,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":Tr(I?"auth.password_input.hide":"auth.password_input.show"),children:d.jsx(fe,{name:I?"eye-slash":"eye",className:"w-5 h-5"})})]}),N&&!I&&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:Tr("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:Tr(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:$.map(({rule:H,param:W})=>{const Q=P[H.key],be=W!==void 0?{count:W}: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:Tr(H.labelKey,be)})]},H.key)})}),t&&d.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:t})]})});us.displayName="PasswordInput";const ko=({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 v=M.target.value;c(v);const T=new Event("change",{bubbles:!0});Object.defineProperty(T,"target",{writable:!1,value:{value:v}}),Object.defineProperty(T,"currentTarget",{writable:!1,value:{value:v}}),n(T)}},[n]),g=C.useCallback(M=>{const v=M.target.value;c(v),!l.current&&n&&n(M)},[n]),{loadingactions:p,formdata:m,...x}=s,k=o!==void 0?{value:h}:{defaultValue:a};return d.jsx("textarea",{ref:f,className:r,onChange:g,onCompositionStart:i,onCompositionEnd:u,...k,...x})},Ar=({children:e,className:t="",...r})=>d.jsx("label",{className:t,...r,children:e}),Gt=({children:e,className:t="",...r})=>d.jsx("p",{className:t,...r,children:e}),jt=({className:e="",alt:t="",...r})=>d.jsx("img",{className:e,alt:t,...r}),wd=({children:e,className:t="",...r})=>d.jsx("h1",{className:t,...r,children:e}),fs=({children:e,className:t="",...r})=>d.jsx("h2",{className:t,...r,children:e}),Tn=({children:e,className:t="",...r})=>d.jsx("h3",{className:t,...r,children:e}),gs=({children:e,className:t="",...r})=>d.jsx("h4",{className:t,...r,children:e}),Co=({children:e,className:t="",...r})=>d.jsx("ul",{className:t,...r,children:e}),xd=({children:e,className:t="",...r})=>d.jsx("ol",{className:t,...r,children:e}),er=({children:e,className:t="",...r})=>d.jsx("li",{className:t,...r,children:e}),_o=({children:e,className:t="",...r})=>d.jsx("a",{className:t,...r,children:e}),So=({children:e,className:t="",...r})=>d.jsx("form",{className:t,...r,children:e}),kd=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 Cd(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 hs=({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(""),[x,k]=C.useState(null),M=C.useRef(null),v=C.useRef(null),T=C.useRef(null),I=C.useRef(null),S=C.useMemo(()=>n?Array.isArray(n)?n.length===0?[]:typeof n[0]=="string"?n.map(_=>({value:_,label:Cd(_)})):n:(kd.warn("options prop is not an array:",n),null):null,[n]),N=C.useMemo(()=>S&&S.find(b=>String(b.value)===String(a))?.label||"",[S,a]),w=C.useMemo(()=>{if(!S)return null;if(!f||p.trim()==="")return S;const _=p.trim().toLowerCase();return S.filter(b=>b.label.toLowerCase().includes(_)||String(b.value).toLowerCase().includes(_))},[S,f,p]);C.useEffect(()=>{if(u&&f){m("");const _=setTimeout(()=>T.current?.focus(),0);return()=>clearTimeout(_)}u||m("")},[u,f]);const y=C.useCallback(()=>{if(!v.current)return;const _=v.current.getBoundingClientRect(),b=window.innerHeight-_.bottom,F=b<280&&_.top>b;k(F?{bottom:window.innerHeight-_.top+4,left:_.left,width:_.width}:{top:_.bottom+4,left:_.left,width:_.width})},[]);C.useEffect(()=>{if(!u){k(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 _=b=>{const z=b.target;M.current&&!M.current.contains(z)&&(!I.current||!I.current.contains(z))&&g(!1)};return u&&document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},[u]),C.useEffect(()=>{const _=b=>{b.key==="Escape"&&u&&(g(!1),v.current?.focus())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const E=()=>{l||g(!u)},O=_=>{s&&s({target:{value:_},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),v.current?.focus()};if(!S)return d.jsx("select",{className:o,value:a,onChange:s,disabled:l,...c,...i,children:e});const $=o&&o.includes("bg-"),P=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=$?`${o}${P?"":" 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}`,U={...c,...i};return d.jsxs(j,{ref:M,className:"relative",...U,children:[d.jsxs(R,{ref:v,type:"button",onClick:E,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(te,{className:"truncate",children:N||" "}),d.jsx(En,{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&&x&&tr.createPortal(d.jsxs(j,{ref:I,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:x.top,bottom:x.bottom,left:x.left,width:x.width},role:"listbox",children:[f&&d.jsx(j,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:d.jsx(At,{ref:T,type:"text",value:p,onChange:_=>m(_.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(j,{className:"py-2 max-h-60 overflow-auto",children:[w&&w.length===0&&d.jsx(j,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:p?"No results":""}),(w??[]).map(_=>{const b=String(_.value)===String(a);return d.jsxs(R,{type:"button",onClick:()=>!_.disabled&&O(_.value),disabled:_.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"} ${_.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":b,children:[d.jsx(te,{children:_.label}),b&&d.jsx(En,{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"})})]},_.value)})]})]}),document.body)]})},_d=({children:e,className:t="",...r})=>d.jsx("option",{className:t,...r,children:e}),Sd=({children:e,className:t="",...r})=>d.jsx("optgroup",{className:t,...r,children:e}),ps=C.forwardRef(({label:e,className:t="",...r},n)=>d.jsx("input",{ref:n,type:"checkbox",className:t,...r}));ps.displayName="Checkbox";const Ed=({children:e,className:t="",...r})=>d.jsx("table",{className:t,...r,children:e}),Td=({children:e,className:t="",...r})=>d.jsx("thead",{className:t,...r,children:e}),Ad=({children:e,className:t="",...r})=>d.jsx("tbody",{className:t,...r,children:e}),Nd=({children:e,className:t="",...r})=>d.jsx("tr",{className:t,...r,children:e}),Od=({children:e,className:t="",...r})=>d.jsx("th",{className:t,...r,children:e}),Md=({children:e,className:t="",...r})=>d.jsx("td",{className:t,...r,children:e}),Zr=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("nav",{ref:n,className:t,...r,children:e}));Zr.displayName="Nav";const ms=({children:e,className:t="",...r})=>d.jsx("section",{className:t,...r,children:e}),Id=({children:e,className:t="",...r})=>d.jsx("code",{className:t,...r,children:e}),Eo=C.forwardRef(({className:e="",...t},r)=>d.jsx("hr",{ref:r,className:e,...t})),Dd=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("header",{ref:n,className:t,...r,children:e})),bs=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,To=e=>{const t=bs(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},Pd=()=>{const e=localStorage.getItem("g7_color_scheme");return e&&["auto","light","dark"].includes(e)?e:"auto"},An=({onThemeChange:e,className:t="",autoText:r="System",lightText:n="Light",darkText:o="Dark",id:a,editorAttrs:s})=>{const l=Pd(),[f,h]=C.useState(l),[c,i]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{To(f)},[]),C.useEffect(()=>{if(f!=="auto")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>{To("auto")};return m.addEventListener("change",x),()=>m.removeEventListener("change",x)},[f]),C.useEffect(()=>{const m=x=>{u.current&&!u.current.contains(x.target)&&i(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const g=m=>{h(m),localStorage.setItem("g7_color_scheme",m),To(m),i(!1),e?.(m)},p=()=>bs(f)==="dark"?nt.Moon:nt.Sun;return d.jsxs(j,{ref:u,className:`relative ${t}`,id:a,...s,children:[d.jsx(R,{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(j,{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(j,{className:"py-2",children:[d.jsxs(R,{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:nt.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(te,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),f==="auto"&&d.jsx(fe,{name:nt.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),d.jsxs(R,{onClick:()=>g("light"),className:` @@ -7,18 +7,18 @@ var SirsoftBasic=(function(ee,d,C,tr){"use strict";function md(e){const t=Object `,children:[d.jsx(fe,{name:nt.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(te,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),f==="light"&&d.jsx(fe,{name:nt.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),d.jsxs(R,{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:nt.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(te,{className:"flex-1 text-left text-gray-900 dark:text-white",children:o}),f==="dark"&&d.jsx(fe,{name:nt.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Ld=Object.freeze(Object.defineProperty({__proto__:null,ThemeToggle:An,default:An},Symbol.toStringTag,{value:"Module"})),ys={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"},$d="rounded-full overflow-hidden flex-shrink-0 border border-gray-200 dark:border-gray-700",Fd="grayscale opacity-50",Ao={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"},Qr=({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(()=>[ys[n]||ys.md,$d,u?Fd:"",o].filter(Boolean).join(" "),[n,u,o]),m=g?Ao.guest:u?Ao.withdrawn:Ao.normal,w=()=>g?d.jsx(j,{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(j,{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(j,{className:`w-full h-full flex items-center justify-center text-white font-semibold ${m}`,children:i.charAt(0).toUpperCase()});return d.jsx(j,{className:p,id:f,...h,children:c&&!g&&!u?d.jsx(jt,{src:c,alt:i,className:"w-full h-full object-cover"}):w()})},Ud=Object.freeze(Object.defineProperty({__proto__:null,Avatar:Qr},Symbol.toStringTag,{value:"Module"})),zd=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 vs(e,t){return t&&e&&typeof e.id=="string"&&e.id.length>0?{...e,id:`${e.id}__${t}`}:e}const Nn=({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(j,{className:t,style:n,id:o,children:r}):a?d.jsx(j,{className:t,style:n,id:o,children:a}):null;const u=i(),g=window.G7Core;return!u||!g?(zd.error("G7Core or DynamicRenderer not available"),null):d.jsxs(j,{className:t,style:n,id:o,children:[s.map(p=>{const{componentDef:m,dataContext:w,parentFormContext:k,getParentComponentContext:M,translationContext:v}=p,T=vs(m,o);return d.jsx(u,{componentDef:T,dataContext:w,translationContext:v,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:M?.(),parentFormContextProp:k,isRootRenderer:!1},T.id||`slot-${e}-${p.order}`)}),a]})},Hd=Object.freeze(Object.defineProperty({__proto__:null,SlotContainer:Nn,default:Nn,scopeSlotChildDef:vs},Symbol.toStringTag,{value:"Module"})),On=({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:w,dropdownAlign:k="right",className:M="",id:v,editorAttrs:T})=>{const[I,S]=C.useState(!1),N=C.useRef(null),x=C.useRef(null),y=C.useRef(null),E=C.useRef(null),O=C.useRef(new Set),$=C.useRef(u),D=C.useRef(r),L=C.useRef(n),U=C.useRef(e.length),_=C.useRef(-1);C.useEffect(()=>{$.current=u,D.current=r,L.current=n,U.current=e.length}),C.useEffect(()=>{if(!E.current||!y.current||!I)return;_.current=-1;const G=new IntersectionObserver(([X])=>{X.isIntersecting&&(L.current||!D.current||_.current!==U.current&&(_.current=U.current,$.current?.()))},{root:y.current,threshold:.1});return G.observe(E.current),()=>G.disconnect()},[I]),C.useEffect(()=>{if(!y.current||!I)return;const G=new IntersectionObserver(B=>{B.forEach(Y=>{const H=Y.target.getAttribute("data-notification-id"),W=Y.target.getAttribute("data-unread")==="true";H&&W&&Y.isIntersecting&&O.current.add(H)})},{root:y.current,threshold:.5});return y.current.querySelectorAll("[data-notification-id]").forEach(B=>G.observe(B)),()=>G.disconnect()},[I,e]);const b=t>0?t:e.filter(G=>!G.read).length,z=C.useCallback(()=>{if(I){if(b>0){const G=Array.from(O.current).filter(X=>{const B=e.find(Y=>String(Y.id)===String(X));return B&&!B.read});G.length>0&&i?.(G)}O.current.clear(),S(!1)}},[I,i,b,e]);C.useEffect(()=>{if(!I)return;const G=X=>{N.current&&!N.current.contains(X.target)&&z()};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[I,z]);const F=C.useCallback(()=>{I?z():S(!0)},[I,z]);return C.useLayoutEffect(()=>{const G=x.current;if(!I||!G)return;G.style.transform="";const X=G.getBoundingClientRect(),B=typeof window<"u"?window.innerWidth:0;if(X.width===0&&X.height===0)return;const Y=8;let H=0;X.right>B-Y?H=-(X.right-(B-Y)):X.left0&&d.jsx(te,{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})]}),I&&d.jsxs(j,{ref:x,className:`absolute ${k==="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(j,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[d.jsxs(j,{className:"flex items-center gap-3 min-w-0",children:[d.jsx(te,{className:"font-semibold text-gray-900 dark:text-white",children:o}),w&&d.jsxs(j,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>w(!h),children:[d.jsx(At,{type:"checkbox",checked:h,onChange:G=>{G.stopPropagation(),w(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(te,{className:"text-xs text-gray-600 dark:text-gray-400",children:f})]})]}),d.jsxs(j,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&b>0&&d.jsx(R,{onClick:()=>{g(),O.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(R,{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(j,{ref:y,className:"max-h-96 overflow-y-auto",children:e.length===0&&!n?d.jsx(j,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:d.jsx(te,{children:a})}):d.jsxs(d.Fragment,{children:[e.map(G=>{const X=!G.read;return d.jsxs(j,{"data-notification-id":G.id,"data-unread":X?"true":"false",onClick:()=>{G.onClick?.(),c?.(G),S(!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 ${X?"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 ${X?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),d.jsxs(j,{className:"flex-1 min-w-0",children:[d.jsx(j,{className:`text-sm truncate ${X?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:G.title}),d.jsx(j,{className:`text-sm mt-1 line-clamp-2 ${X?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:G.message}),d.jsx(j,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:G.time})]}),d.jsxs(j,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[X&&d.jsx(te,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),m&&d.jsx(R,{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:nt.Trash,className:"w-4 h-4"})})]})]},G.id)}),r&&d.jsx(j,{ref:E,className:"px-4 py-3 text-center",children:n?d.jsx(te,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):d.jsx(te,{className:"text-sm text-gray-400 dark:text-gray-500"})}),n&&!r&&e.length>0&&d.jsx(j,{className:"px-4 py-2 text-center",children:d.jsx(te,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},Gd=Object.freeze(Object.defineProperty({__proto__:null,NotificationCenter:On,default:On},Symbol.toStringTag,{value:"Module"})),Qe=(e,t)=>window.G7Core?.t?.(e,t)??e,vt=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ws=({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:w=!1,notificationTitleText:k,notificationEmptyText:M,notificationMarkAllReadText:v,notificationDeleteAllText:T,notificationUnreadOnlyText:I,onNotificationClose:S,onNotificationClick:N,onNotificationLoadMore:x,onNotificationMarkAllRead:y,onNotificationDeleteAll:E,onNotificationDelete:O,onNotificationUnreadOnlyToggle:$})=>{const[D,L]=C.useState(""),[U,_]=C.useState(!1),[b,z]=C.useState(!1),[F,G]=C.useState(!1),[X,B]=C.useState({top:0,left:0}),[Y,H]=C.useState(window.location.pathname),W=C.useRef(null),Q=C.useRef(null),be=C.useRef(null),pe=window.G7Core?.useResponsive,ne=pe?.(),Ae=ne?ne.width<768:typeof window<"u"&&window.innerWidth<768;C.useEffect(()=>{const K=()=>H(window.location.pathname);window.addEventListener("popstate",K);const oe=history.pushState;return history.pushState=function(...ae){oe.apply(this,ae),H(window.location.pathname)},()=>{window.removeEventListener("popstate",K),history.pushState=oe}},[]);const ve=(K,oe=!1)=>oe?Y===K:Y===K||Y.startsWith(K+"/"),We=()=>{const K=c==="/"?"":c;return Y.startsWith(`${K}/products`)||Y.startsWith(`${K}/cart`)||Y.startsWith(`${K}/checkout`)||Y.startsWith(`${K}/category`)},me=K=>{const oe="px-3 py-2 text-sm font-medium whitespace-nowrap cursor-pointer rounded-lg transition-colors";return K?`${oe} bg-gray-900 text-white dark:bg-white dark:text-gray-900`:`${oe} 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=oe=>{W.current&&!W.current.contains(oe.target)&&_(!1),Q.current&&!Q.current.contains(oe.target)&&z(!1),be.current&&!be.current.contains(oe.target)&&G(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const Te=a.slice(0,s),ge=a.slice(s),Oe=K=>{K.preventDefault(),D.trim()&&vt(`/search?q=${encodeURIComponent(D)}`)},we=async()=>{window.G7Core?.dispatch?.({handler:"logout"})},$e=K=>{window.G7Core?.dispatch?.({handler:"setLocale",target:K}),G(!1)},ze=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(Pd,{...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(j,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs(j,{className:"flex items-center justify-between h-16",children:[d.jsx(R,{onClick:()=>vt("/"),className:"flex items-center gap-2 flex-shrink-0 cursor-pointer",children:e?d.jsx(jt,{src:e,alt:t,className:"h-8"}):d.jsx(te,{className:"text-xl font-bold text-gray-900 dark:text-white",children:t})}),!Ae&&d.jsx(So,{onSubmit:Oe,className:"flex flex-1 max-w-lg mx-8",children:d.jsxs(j,{className:"relative w-full",children:[d.jsx(At,{type:"text",value:D,onChange:K=>L(K.target.value),placeholder:Qe("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(j,{className:"flex items-center gap-2",children:[d.jsx(An,{autoText:Qe("common.theme.auto"),lightText:Qe("common.theme.light"),darkText:Qe("common.theme.dark")}),r?.uuid&&d.jsx(On,{notifications:g,unreadCount:o,hasMore:p,loading:m,unreadOnly:w,titleText:k??Qe("mypage.notifications.title"),emptyText:M??Qe("mypage.notifications.empty"),markAllReadText:v??Qe("mypage.notifications.mark_all_read"),deleteAllText:T??Qe("mypage.notifications.delete_all"),unreadOnlyText:I??Qe("mypage.notifications.unread_only"),onClose:S,onNotificationClick:N,onLoadMore:x,onMarkAllRead:y,onDeleteAll:E,onDelete:O,onUnreadOnlyToggle:$,dropdownAlign:"right"}),d.jsxs(R,{onClick:()=>vt(`${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(te,{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(j,{ref:be,className:"relative",children:[d.jsxs(R,{onClick:()=>G(!F),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":F,"aria-label":Qe("common.language"),children:[d.jsx(fe,{name:"globe",className:"w-4 h-4"}),d.jsx(te,{className:"font-medium uppercase",children:h}),d.jsx(fe,{name:"chevron-down",className:"w-3 h-3"})]}),F&&d.jsx(j,{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 oe=K===h;return d.jsxs(R,{role:"option","aria-selected":oe,onClick:()=>$e(K),className:`w-full px-4 py-2.5 text-left text-sm flex items-center gap-3 cursor-pointer transition-colors ${oe?"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(te,{className:"flex-1 font-medium",children:ze(K)}),oe&&d.jsx(fe,{name:"check",className:"w-4 h-4"})]},K)})})]}),d.jsx(Nn,{slotId:"header_currency",id:"header_currency_slot_desktop",className:"flex items-center"}),r?.uuid?d.jsxs(j,{ref:W,className:"relative",children:[d.jsxs(R,{onClick:()=>_(!U),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(Qr,{avatar:r.avatar,name:r.name,size:"sm"}),d.jsx(te,{className:"hidden sm:inline text-sm font-medium",children:r.name}),d.jsx(fe,{name:"chevron-down",className:"w-4 h-4"})]}),U&&d.jsxs(j,{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(j,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:d.jsxs(j,{className:"flex items-center gap-3",children:[d.jsx(Qr,{avatar:r.avatar,name:r.name,size:"md"}),d.jsxs(j,{children:[d.jsx(j,{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.name}),d.jsx(j,{className:"text-xs text-gray-500 dark:text-gray-400",children:Qe("common.member")})]})]})}),d.jsxs(j,{className:"py-1",children:[r.is_admin&&d.jsxs(d.Fragment,{children:[d.jsxs(_o,{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"}),Qe("common.admin_menu")]}),d.jsx(Eo,{className:"my-1 border-gray-200 dark:border-gray-700"})]}),d.jsxs(R,{onClick:()=>{vt("/mypage"),_(!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"}),Qe("common.mypage")]}),d.jsxs(R,{onClick:()=>{vt("/mypage/orders"),_(!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"}),Qe("mypage.tabs.orders")]}),d.jsxs(R,{onClick:()=>{vt("/mypage/wishlist"),_(!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"}),Qe("mypage.tabs.wishlist")]})]}),d.jsx(Eo,{className:"my-1 border-gray-200 dark:border-gray-700"}),d.jsxs(R,{onClick:we,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"}),Qe("auth.logout")]})]})]}):d.jsxs(j,{className:"flex items-center gap-1.5",children:[d.jsx(R,{onClick:()=>vt("/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:Qe("shop.guest_order_form.nav_link")}),d.jsx(R,{onClick:()=>vt("/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:Qe("auth.login")}),d.jsx(R,{onClick:()=>vt("/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:Qe("auth.register_link")})]}),Ae&&d.jsx(R,{onClick:l,className:"p-2 text-gray-600 dark:text-gray-400",children:d.jsx(fe,{name:"menu",className:"w-6 h-6"})})]})]})}),!Ae&&d.jsx(Zr,{className:"border-t border-gray-200 dark:border-gray-800",children:d.jsx(j,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs(j,{className:"flex items-center gap-1 h-12 overflow-x-auto",children:[d.jsx(R,{onClick:()=>vt("/"),className:me(ve("/",!0)),"data-testid":"nav-home",children:Qe("nav.home")}),d.jsxs(R,{onClick:()=>vt("/boards/popular"),className:`flex items-center gap-1 ${me(ve("/boards/popular"))}`,"data-testid":"nav-popular",children:[d.jsx(te,{className:"text-orange-500",children:"🔥"}),Qe("nav.popular")]}),d.jsxs(R,{onClick:()=>vt(`${c==="/"?"":c}/products`),className:`flex items-center gap-1 ${me(We())}`,"data-testid":"nav-shop",children:[d.jsx(te,{children:"🛒"}),Qe("nav.shop")]}),Te.map(K=>d.jsxs(R,{onClick:()=>vt(`/board/${K.slug}`),className:me(ve(`/board/${K.slug}`)),children:[K.icon&&d.jsx(te,{className:"mr-1",children:K.icon}),K.name]},K.id)),ge.length>0&&d.jsxs(j,{ref:Q,className:"relative",children:[d.jsxs(R,{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:[Qe("nav.more"),d.jsx(fe,{name:"chevron-down",className:"w-4 h-4"})]}),b&&d.jsx(j,{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:`${X.top}px`,left:`${X.left}px`},children:ge.map(K=>{const oe=ve(`/board/${K.slug}`);return d.jsxs(R,{onClick:()=>{vt(`/board/${K.slug}`),z(!1)},className:`block w-full text-left px-4 py-2 text-sm cursor-pointer ${oe?"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(te,{className:"mr-1",children:K.icon}),K.name]},K.id)})})]})]})})})]})},jd=Object.freeze(Object.defineProperty({__proto__:null,default:ws},Symbol.toStringTag,{value:"Module"})),Bd=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("footer",{ref:n,className:t,...r,children:e})),Nt=(e,t)=>window.G7Core?.t?.(e,t)??e,Wd=768,xs=1024,Vd=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ks=({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:xs),u=i=xs,p=u?1:g?5:2,m=[{title:Nt("footer.community"),links:[{label:Nt("nav.home"),href:"/"},{label:Nt("nav.popular"),href:"/boards/popular"},{label:Nt("footer.all_boards"),href:"/boards"}]},{title:Nt("footer.info"),links:[{label:Nt("footer.about"),href:"/page/about"},{label:Nt("footer.faq"),href:"/page/faq"},{label:Nt("footer.contact"),href:"/page/contact"}]},{title:Nt("footer.policy"),links:[{label:Nt("footer.terms"),href:"/page/terms"},{label:Nt("footer.privacy"),href:"/page/privacy"},{label:Nt("footer.refund"),href:"/page/refund"}]}],w=o||m,k={github:"github",twitter:"twitter",discord:"discord",facebook:"facebook",instagram:"instagram"};return d.jsx(Bd,{...s??{},className:`bg-gray-50 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-800 ${a}`,children:d.jsxs(j,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[d.jsxs(j,{className:"grid gap-8",style:{gridTemplateColumns:`repeat(${p}, minmax(0, 1fr))`},children:[d.jsxs(j,{style:g?{gridColumn:"span 2 / span 2"}:void 0,children:[d.jsx(Tn,{className:"text-lg font-bold text-gray-900 dark:text-white",children:e}),t&&d.jsx(Gt,{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:t}),d.jsx(j,{className:"mt-4 flex items-center gap-4",children:Object.entries(n).map(([M,v])=>v?d.jsx(_o,{href:v,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:k[M],className:"w-5 h-5"})},M):null)})]}),w.map((M,v)=>d.jsxs(j,{children:[d.jsx(gs,{className:"text-sm font-semibold text-gray-900 dark:text-white uppercase tracking-wider",children:M.title}),d.jsx(Co,{className:"mt-4 space-y-2",children:M.links.map((T,I)=>d.jsx(er,{children:d.jsx(R,{onClick:()=>Vd(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})},I))})]},v))]}),d.jsxs(j,{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(Gt,{className:"text-sm text-gray-500 dark:text-gray-400",children:r||`© ${l} ${e}. All rights reserved.`}),d.jsx(Gt,{className:"text-sm text-gray-500 dark:text-gray-400",children:Nt("footer.powered_by")})]})]})})},Kd=Object.freeze(Object.defineProperty({__proto__:null,default:ks},Symbol.toStringTag,{value:"Module"})),Bt=(e,t)=>window.G7Core?.t?.(e,t)??e,Lt=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},Cs=({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(j,{className:"fixed inset-0 z-50",onClick:u,children:[d.jsx(j,{className:"fixed inset-0 bg-black/50 transition-opacity"}),d.jsxs(j,{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(j,{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[d.jsx(R,{onClick:()=>{t(),Lt("/")},className:"flex items-center gap-2 cursor-pointer",children:r?d.jsx(jt,{src:r,alt:n,className:"h-8"}):d.jsx(te,{className:"text-xl font-bold text-gray-900 dark:text-white",children:n})}),d.jsx(R,{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(j,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:d.jsxs(j,{className:"flex items-center gap-3",children:[o.avatar?d.jsx(jt,{src:o.avatar,alt:o.name,className:"w-12 h-12 rounded-full"}):d.jsx(j,{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(j,{children:[d.jsx(Gt,{className:"font-medium text-gray-900 dark:text-white",children:o.name}),d.jsx(R,{onClick:()=>{t(),Lt("/mypage")},className:"text-sm text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:Bt("common.mypage")})]})]})}):d.jsx(j,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:d.jsxs(j,{className:"flex gap-2",children:[d.jsx(R,{onClick:()=>{t(),Lt("/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:Bt("auth.login")}),d.jsx(R,{onClick:()=>{t(),Lt("/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:Bt("auth.register")})]})}),d.jsx(Zr,{className:"p-4 overflow-y-auto max-h-[calc(100vh-200px)]",children:d.jsxs(Co,{className:"space-y-1",children:[d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt("/")},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"}),Bt("nav.home")]})}),d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt("/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(te,{className:"text-orange-500",children:"🔥"}),Bt("nav.popular")]})}),d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt("/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(te,{children:"🛒"}),Bt("nav.shop")]})}),d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt("/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"}),Bt("nav.cart"),s>0&&d.jsx(te,{className:"ml-auto px-2 py-0.5 text-xs bg-blue-500 text-white rounded-full",children:s})]})}),d.jsx(er,{className:"my-4 border-t border-gray-200 dark:border-gray-800"}),d.jsx(er,{className:"px-3 py-2 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:Bt("nav.boards")}),a.map(g=>d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt(`/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(te,{children:g.icon}),g.name]})},g.id))]})}),d.jsx(j,{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(j,{className:"flex items-center justify-between text-sm text-gray-500 dark:text-gray-400",children:[d.jsx(R,{onClick:()=>{t(),Lt("/about")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Bt("footer.about")}),d.jsx(R,{onClick:()=>{t(),Lt("/terms")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Bt("footer.terms")}),d.jsx(R,{onClick:()=>{t(),Lt("/privacy")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Bt("footer.privacy")})]})})]})]})},Yd=Object.freeze(Object.defineProperty({__proto__:null,default:Cs},Symbol.toStringTag,{value:"Module"}));function _s(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r2?n-2:0),a=2;a1?r-1:0),o=1;o"u"?null:tt(BigInt.prototype.toString),Is=typeof Symbol>"u"?null:tt(Symbol.prototype.toString),wt=tt(Object.prototype.hasOwnProperty),tn=tt(Object.prototype.toString),gt=tt(RegExp.prototype.test),ur=lu(TypeError);function tt(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;o2&&arguments[2]!==void 0?arguments[2]:Rr;if(Es&&Es(e,null),!Or(t))return e;let n=t.length;for(;n--;){let o=t[n];if(typeof o=="string"){const a=r(o);a!==o&&(Rd(t)||(t[n]=a),o=a)}e[o]=!0}return e}function iu(e){for(let t=0;t/g),pu=lt(/\${[\w\W]*/g),mu=lt(/^data-[\-\w.\u00B7-\uFFFF]+$/),bu=lt(/^aria-[\-\w]+$/),Fs=lt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yu=lt(/^(?:\w+script|data):/i),vu=lt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wu=lt(/^html$/i),xu=lt(/^[a-z][.\w]*(-[.\w]+)+$/i),Us=lt(/<[/\w!]/g),zs=lt(/<[/\w]/g),ku=lt(/<\/no(script|embed|frames)/i),Cu=lt(/\/>/i),Mt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Hs=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],_u=ot(Ge({},Hs)),Su=(function(){const e={};return dr(Hs,t=>{e[t]=lt(new RegExp("])","i"))}),ot(e)})(),Eu=function(){return typeof window>"u"?null:window},Tu=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}},Gs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},rr=function(t,r,n,o){return wt(t,r)&&Or(t[r])?Ge(o.base?Ot(o.base):{},t[r],o.transform):n},$o=function(t,r,n){const o=wt(t,r)?t[r]:void 0;return o&&typeof o=="object"?Ot(o):n()};function js(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Eu();const t=J=>js(J);if(t.version="3.4.14",t.removed=[],!e||!e.document||e.document.nodeType!==Mt.document||!e.Element)return t.isSupported=!1,t;let r=e.document;const n=r,o=n.currentScript;e.DocumentFragment;const a=e.HTMLTemplateElement,s=e.Node,l=e.Element,f=e.NodeFilter,h=e.NamedNodeMap;h===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const c=e.DOMParser,i=e.trustedTypes,u=l.prototype,g=Wt(u,"cloneNode"),p=Wt(u,"remove"),m=Wt(u,"nextSibling"),w=Wt(u,"childNodes"),k=Wt(u,"parentNode"),M=Wt(u,"shadowRoot"),v=Wt(u,"attributes"),T=s&&s.prototype?Wt(s.prototype,"nodeType"):null,I=s&&s.prototype?Wt(s.prototype,"nodeName"):null,S=s&&s.prototype?Wt(s.prototype,"ownerDocument"):null,N=function(P){return T?T(P):P.nodeType},x=function(P){return I?I(P):P.nodeName};if(typeof a=="function"){const J=r.createElement("template");J.content&&J.content.ownerDocument&&(r=J.content.ownerDocument)}let y,E="",O,$=!1,D=0;const L=function(){if(D>0)throw ur('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},U=function(P){L(),D++;try{return y.createHTML(P)}finally{D--}},_=function(P){L(),D++;try{return y.createScriptURL(P)}finally{D--}},b=function(){return $||(O=Tu(i,o),$=!0),O},z=r,F=z.implementation,G=z.createNodeIterator,X=z.createDocumentFragment,B=z.getElementsByTagName,Y=n.importNode;let H=Gs();t.isSupported=typeof Ss=="function"&&typeof k=="function"&&F&&F.createHTMLDocument!==void 0;const W=gu,Q=hu,be=pu,se=mu,pe=bu,ne=yu,Ae=vu,ve=xu;let We=Fs,me=null;const Te=Ge({},[...Ps,...Io,...Po,...Do,...Ds]);let ge=null;const Oe=Ge({},[...Ls,...Lo,...$s,...Mn]);let we=Object.seal(Nr(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}})),$e=null,ze=null;const K=Object.seal(Nr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let oe=!0,ae=!0,ce=!1,ke=!0,Ee=!1,Be=!0,Me=!1,Ke=!1,De=null,q=null,le=!1,de=!1,ue=!1,ie=!1,Fe=!0,Ce=!1;const Ie="user-content-";let Ne=!0,He=!1,je={},_e=null;const xe=Ge({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Pe=null;const Ye=Ge({},["audio","video","img","source","image","track"]);let rt=null;const qe=Ge({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Je="http://www.w3.org/1998/Math/MathML",Zt="http://www.w3.org/2000/svg",Ve="http://www.w3.org/1999/xhtml";let bt=Ve,St=!1,Dt=null;const _r=Ge({},[Je,Zt,Ve],Mo),lr=ot(["mi","mo","mn","ms","mtext"]);let Ht=Ge({},lr);const ir=ot(["annotation-xml"]);let Sr=Ge({},ir);const Bm=Ge({},["title","style","font","a","script"]);let _n=null;const Wm=["application/xhtml+xml","text/html"],Vm="text/html";let et=null,Xr=null;const Km=r.createElement("form"),nd=function(P){return P instanceof RegExp||P instanceof Function},as=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xr&&Xr===P)return;(!P||typeof P!="object")&&(P={}),P=Ot(P),_n=Wm.indexOf(P.PARSER_MEDIA_TYPE)===-1?Vm:P.PARSER_MEDIA_TYPE,et=_n==="application/xhtml+xml"?Mo:Rr,me=rr(P,"ALLOWED_TAGS",Te,{transform:et}),ge=rr(P,"ALLOWED_ATTR",Oe,{transform:et}),Dt=rr(P,"ALLOWED_NAMESPACES",_r,{transform:Mo}),rt=rr(P,"ADD_URI_SAFE_ATTR",qe,{transform:et,base:qe}),Pe=rr(P,"ADD_DATA_URI_TAGS",Ye,{transform:et,base:Ye}),_e=rr(P,"FORBID_CONTENTS",xe,{transform:et}),$e=rr(P,"FORBID_TAGS",Ot({}),{transform:et}),ze=rr(P,"FORBID_ATTR",Ot({}),{transform:et}),je=wt(P,"USE_PROFILES")?P.USE_PROFILES&&typeof P.USE_PROFILES=="object"?Ot(P.USE_PROFILES):P.USE_PROFILES:!1,oe=P.ALLOW_ARIA_ATTR!==!1,ae=P.ALLOW_DATA_ATTR!==!1,ce=P.ALLOW_UNKNOWN_PROTOCOLS||!1,ke=P.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ee=P.SAFE_FOR_TEMPLATES||!1,Be=P.SAFE_FOR_XML!==!1,Me=P.WHOLE_DOCUMENT||!1,de=P.RETURN_DOM||!1,ue=P.RETURN_DOM_FRAGMENT||!1,ie=P.RETURN_TRUSTED_TYPE||!1,le=P.FORCE_BODY||!1,Fe=P.SANITIZE_DOM!==!1,Ce=P.SANITIZE_NAMED_PROPS||!1,Ne=P.KEEP_CONTENT!==!1,He=P.IN_PLACE||!1,We=du(P.ALLOWED_URI_REGEXP)?P.ALLOWED_URI_REGEXP:Fs,bt=typeof P.NAMESPACE=="string"?P.NAMESPACE:Ve,Ht=$o(P,"MATHML_TEXT_INTEGRATION_POINTS",()=>Ge({},lr)),Sr=$o(P,"HTML_INTEGRATION_POINTS",()=>Ge({},ir));const V=$o(P,"CUSTOM_ELEMENT_HANDLING",()=>Nr(null));if(we=Nr(null),wt(V,"tagNameCheck")&&nd(V.tagNameCheck)&&(we.tagNameCheck=V.tagNameCheck),wt(V,"attributeNameCheck")&&nd(V.attributeNameCheck)&&(we.attributeNameCheck=V.attributeNameCheck),wt(V,"allowCustomizedBuiltInElements")&&typeof V.allowCustomizedBuiltInElements=="boolean"&&(we.allowCustomizedBuiltInElements=V.allowCustomizedBuiltInElements),lt(we),Ee&&(ae=!1),ue&&(de=!0),je&&(me=Ge({},Ds),ge=Nr(null),je.html===!0&&(Ge(me,Ps),Ge(ge,Ls)),je.svg===!0&&(Ge(me,Io),Ge(ge,Lo),Ge(ge,Mn)),je.svgFilters===!0&&(Ge(me,Po),Ge(ge,Lo),Ge(ge,Mn)),je.mathMl===!0&&(Ge(me,Do),Ge(ge,$s),Ge(ge,Mn))),K.tagCheck=null,K.attributeCheck=null,wt(P,"ADD_TAGS")&&(typeof P.ADD_TAGS=="function"?K.tagCheck=P.ADD_TAGS:Or(P.ADD_TAGS)&&(me===Te&&(me=Ot(me)),Ge(me,P.ADD_TAGS,et))),wt(P,"ADD_ATTR")&&(typeof P.ADD_ATTR=="function"?K.attributeCheck=P.ADD_ATTR:Or(P.ADD_ATTR)&&(ge===Oe&&(ge=Ot(ge)),Ge(ge,P.ADD_ATTR,et))),wt(P,"ADD_FORBID_CONTENTS")&&Or(P.ADD_FORBID_CONTENTS)&&(_e===xe&&(_e=Ot(_e)),Ge(_e,P.ADD_FORBID_CONTENTS,et)),Ne&&(me["#text"]=!0),Me&&Ge(me,["html","head","body"]),me.table&&(Ge(me,["tbody"]),delete $e.tbody),P.TRUSTED_TYPES_POLICY){if(typeof P.TRUSTED_TYPES_POLICY.createHTML!="function")throw ur('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof P.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ur('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Z=y;y=P.TRUSTED_TYPES_POLICY;try{E=U("")}catch(re){throw y=Z,re}}else P.TRUSTED_TYPES_POLICY===null?(y=void 0,E=""):(y===void 0&&(y=b()),y&&typeof E=="string"&&(E=U("")));ot&&ot(P),Xr=P},od=Ge({},[...Io,...Po,...uu]),ad=Ge({},[...Do,...fu]),Ym=function(P,V,Z){return V.namespaceURI===Ve?P==="svg":V.namespaceURI===Je?P==="svg"&&(Z==="annotation-xml"||Ht[Z]):!!od[P]},Xm=function(P,V,Z){return V.namespaceURI===Ve?P==="math":V.namespaceURI===Zt?P==="math"&&Sr[Z]:!!ad[P]},qm=function(P,V,Z){return V.namespaceURI===Zt&&!Sr[Z]||V.namespaceURI===Je&&!Ht[Z]?!1:!ad[P]&&(Bm[P]||!od[P])},Zm=function(P){let V=k(P);(!V||!V.tagName)&&(V={namespaceURI:bt,tagName:"template"});const Z=Rr(P.tagName),re=Rr(V.tagName);return Dt[P.namespaceURI]?P.namespaceURI===Zt?Ym(Z,V,re):P.namespaceURI===Je?Xm(Z,V,re):P.namespaceURI===Ve?qm(Z,V,re):!!(_n==="application/xhtml+xml"&&Dt[P.namespaceURI]):!1},cr=function(P){Jr(t.removed,{element:P});try{k(P).removeChild(P)}catch{if(p(P),!k(P))throw ur("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},sd=function(P,V,Z){try{P.removeAttributeNode(V)}catch{try{P.removeAttribute(Z)}catch{}}},po=function(P){mo(P);const V=w(P);if(V){const re=[];dr(V,he=>{Jr(re,he)}),dr(re,he=>{try{p(he)}catch{}})}const Z=v(P);if(Z)for(let re=Z.length-1;re>=0;--re){const he=Z[re],Se=he&&he.name;typeof Se=="string"&&sd(P,he,Se)}},Er=function(P,V,Z){if(!Z)try{Z=V.getAttributeNode(P)}catch{Z=null}Jr(t.removed,{attribute:Z||null,from:V});try{Z?V.removeAttributeNode(Z):V.removeAttribute(P)}catch{try{V.removeAttribute(P)}catch{}}if(P==="is")if(de||ue)try{cr(V)}catch{}else try{V.setAttribute(P,"")}catch{}},Qm=function(P){const V=v(P);if(V)for(let Z=V.length-1;Z>=0;--Z){const re=V[Z],he=re&&re.name;typeof he!="string"||ge[et(he)]||sd(P,re,he)}},mo=function(P){const V=[P];for(;V.length>0;){const Z=V.pop();N(Z)===Mt.element&&Qm(Z);const he=w(Z);if(he)for(let Se=he.length-1;Se>=0;--Se)V.push(he[Se])}},ld=function(P,V){return Be?P==="patchsrc"?!0:P==="for"&&V!=="label"&&V!=="output":!1},Jm=function(P){if(!Be)return;const V=[P];for(;V.length>0;){const Z=V.pop(),re=N(Z);if(re===Mt.processingInstruction||re===Mt.comment&>(zs,Z.data)){try{p(Z)}catch{}continue}if(re===Mt.element){const Se=Z,Ze=et(x(Z));try{Se.hasAttribute&&Se.hasAttribute("patchsrc")&&Se.removeAttribute("patchsrc"),Se.hasAttribute&&Se.hasAttribute("for")&&ld("for",Ze)&&Se.removeAttribute("for")}catch{}}const he=w(Z);if(he)for(let Se=he.length-1;Se>=0;--Se)V.push(he[Se])}},id=function(P){let V=null,Z=null;if(le)P=""+P;else{const Se=Ns(P,/^[\r\n\t ]+/);Z=Se&&Se[0]}_n==="application/xhtml+xml"&&bt===Ve&&(P=''+P+"");const re=y?U(P):P;if(bt===Ve)try{V=new c().parseFromString(re,_n)}catch{}if(!V||!V.documentElement){V=F.createDocument(bt,"template",null);try{V.documentElement.innerHTML=St?E:re}catch{}}const he=V.body||V.documentElement;return P&&Z&&he.insertBefore(r.createTextNode(Z),he.childNodes[0]||null),bt===Ve?B.call(V,Me?"html":"body")[0]:Me?V.documentElement:he},cd=function(P){const V=S?S(P):P.ownerDocument;return G.call(V||P,P,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},bo=function(P){return P=en(P,W," "),P=en(P,Q," "),P=en(P,be," "),P},ss=function(P){var V;P.normalize();const Z=S?S(P):P.ownerDocument,re=G.call(Z||P,P,f.SHOW_TEXT|f.SHOW_COMMENT|f.SHOW_CDATA_SECTION|f.SHOW_PROCESSING_INSTRUCTION,null);let he=re.nextNode();for(;he;)he.data=bo(he.data),he=re.nextNode();const Se=(V=P.querySelectorAll)===null||V===void 0?void 0:V.call(P,"template");Se&&dr(Se,Ze=>{qr(Ze.content)&&ss(Ze.content)})},yo=function(P){const V=I?I(P):null;return typeof V!="string"||et(V)!=="form"?!1:typeof P.nodeName!="string"||typeof P.textContent!="string"||typeof P.removeChild!="function"||P.attributes!==v(P)||typeof P.removeAttribute!="function"||typeof P.setAttribute!="function"||typeof P.namespaceURI!="string"||typeof P.insertBefore!="function"||typeof P.hasChildNodes!="function"||P.nodeType!==T(P)||P.childNodes!==w(P)},qr=function(P){if(!T||typeof P!="object"||P===null)return!1;try{return T(P)===Mt.documentFragment}catch{return!1}},Sn=function(P){if(!T||typeof P!="object"||P===null)return!1;try{return typeof T(P)=="number"}catch{return!1}};function Rt(J,P,V){J.length!==0&&dr(J,Z=>{Z.call(t,P,V,Xr)})}const Rm=function(P,V){return!!(Be&&P.hasChildNodes()&&!Sn(P.firstElementChild)&>(Us,P.textContent)&>(Us,P.innerHTML)||Be&&P.namespaceURI===Ve&&_u[V]&&(Sn(P.firstElementChild)||typeof P.textContent=="string"&>(Su[V],P.textContent))||P.nodeType===Mt.processingInstruction||Be&&P.nodeType===Mt.comment&>(zs,P.data))},vo=function(P,V){if(P instanceof RegExp)return gt(P,V);if(P instanceof Function){for(var Z=arguments.length,re=new Array(Z>2?Z-2:0),he=2;he=0;--Ze){const Re=P===Z?g(he[Ze],!0):he[Ze];re.insertBefore(Re,m(P))}}}return cr(P),!0},dd=function(P,V,Z,re){return P.length===0?V:V===Z||V===re?Ot(V):V},ud=function(P,V){return P===V||k(P)!==null?!1:(He&&mo(P),!0)},fd=function(P,V){if(Rt(H.beforeSanitizeElements,P,null),ud(P,V))return!0;if(yo(P))return cr(P),!0;const Z=et(x(P));if(me=dd(H.uponSanitizeElement,me,Te,De),Rt(H.uponSanitizeElement,P,{tagName:Z,allowedTags:me}),ud(P,V))return!0;if(Rm(P,Z))return cr(P),!0;if($e[Z]||!(K.tagCheck instanceof Function&&K.tagCheck(Z))&&!me[Z]){const he=eb(P,Z,V);return he===!1&&Rt(H.afterSanitizeElements,P,null),he}if(N(P)===Mt.element&&!Zm(P)||(Z==="noscript"||Z==="noembed"||Z==="noframes")&>(ku,P.innerHTML))return cr(P),!0;if(Ee&&P.nodeType===Mt.text){const he=bo(P.textContent);P.textContent!==he&&(Jr(t.removed,{element:P.cloneNode()}),P.textContent=he)}return Rt(H.afterSanitizeElements,P,null),!1},gd=function(P,V,Z){if(ze[V]||ld(V,P)||Fe&&(V==="id"||V==="name")&&(Z in r||Z in Km))return!1;const re=ge[V]||K.attributeCheck instanceof Function&&K.attributeCheck(V,P);return ae&>(se,V)||oe&>(pe,V)?!0:re?rt[V]||gt(We,en(Z,Ae,""))||(V==="src"||V==="xlink:href"||V==="href")&&P!=="script"&&Os(Z,"data:")===0&&Pe[P]||ce&&!gt(ne,en(Z,Ae,""))?!0:!Z:hd(P)&&vo(we.tagNameCheck,P)&&vo(we.attributeNameCheck,V,P)||V==="is"&&we.allowCustomizedBuiltInElements&&vo(we.tagNameCheck,Z)},tb=Ge({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),hd=function(P){return!tb[Rr(P)]&>(ve,P)},rb=function(P,V,Z,re){if(y&&typeof i=="object"&&typeof i.getAttributeType=="function"&&!Z)switch(i.getAttributeType(P,V)){case"TrustedHTML":return U(re);case"TrustedScriptURL":return _(re)}return re},nb=function(P,V,Z,re){try{Z?P.setAttributeNS(Z,V,re):P.setAttribute(V,re),yo(P)?cr(P):As(t.removed)}catch{Er(V,P)}},pd=function(P){Rt(H.beforeSanitizeAttributes,P,null);const V=P.attributes;if(!V||yo(P))return;ge=dd(H.uponSanitizeAttribute,ge,Oe,q);const Z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ge,forceKeepAttr:void 0};let re=V.length;const he=et(P.nodeName);for(;re--;){const Se=V[re],Ze=Se.name,Re=Se.namespaceURI,Et=Se.value,Tt=et(Ze),is=Et;let yt=Ze==="value"?is:ou(is);if(Z.attrName=Tt,Z.attrValue=yt,Z.keepAttr=!0,Z.forceKeepAttr=void 0,Rt(H.uponSanitizeAttribute,P,Z),yt=Z.attrValue,Ce&&(Tt==="id"||Tt==="name")&&Os(yt,Ie)!==0&&(Er(Ze,P,Se),yt=Ie+yt),Be&>(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,yt)){Er(Ze,P,Se);continue}if(Tt==="attributename"&&Ns(yt,"href")){Er(Ze,P,Se);continue}if(!Z.forceKeepAttr){if(!Z.keepAttr){Er(Ze,P,Se);continue}if(!ke&>(Cu,yt)){Er(Ze,P,Se);continue}if(Ee&&(yt=bo(yt)),!gd(he,Tt,yt)){Er(Ze,P,Se);continue}yt=rb(he,Tt,Re,yt),yt!==is&&nb(P,Ze,Re,yt)}}Rt(H.afterSanitizeAttributes,P,null)},wo=function(P){let V=null;const Z=cd(P);for(Rt(H.beforeSanitizeShadowDOM,P,null);V=Z.nextNode();)if(Rt(H.uponSanitizeShadowNode,V,null),fd(V,P),pd(V),qr(V.content)&&wo(V.content),N(V)===Mt.element){const re=M(V);qr(re)&&(ls(re),wo(re))}Rt(H.afterSanitizeShadowDOM,P,null)},ls=function(P){const V=[{node:P,shadow:null}];for(;V.length>0;){const Z=V.pop();if(Z.shadow){wo(Z.shadow);continue}const re=Z.node,Se=N(re)===Mt.element,Ze=w(re);if(Ze)for(let Re=Ze.length-1;Re>=0;--Re)V.push({node:Ze[Re],shadow:null});if(Se){const Re=I?I(re):null;if(typeof Re=="string"&&et(Re)==="template"){const Et=re.content;qr(Et)&&V.push({node:Et,shadow:null})}}if(Se){const Re=M(re);qr(Re)&&V.push({node:null,shadow:Re},{node:Re,shadow:null})}}};return t.sanitize=function(J){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},V=null,Z=null,re=null,he=null;if(St=!J,St&&(J=""),typeof J!="string"&&!Sn(J)&&(J=cu(J),typeof J!="string"))throw ur("dirty is not a string, aborting");if(!t.isSupported)return J;Ke?(me=De,ge=q):as(P),(H.uponSanitizeElement.length>0||H.uponSanitizeAttribute.length>0)&&(me=Ot(me)),H.uponSanitizeAttribute.length>0&&(ge=Ot(ge)),t.removed=[];const Se=He&&typeof J!="string"&&Sn(J);if(Se){Jm(J);const Et=x(J);if(typeof Et=="string"){const Tt=et(Et);if(!me[Tt]||$e[Tt])throw po(J),ur("root node is forbidden and cannot be sanitized in-place")}if(yo(J))throw po(J),ur("root node is clobbered and cannot be sanitized in-place");try{ls(J)}catch(Tt){throw po(J),Tt}}else if(Sn(J))V=id(""),Z=V.ownerDocument.importNode(J,!0),Z.nodeType===Mt.element&&Z.nodeName==="BODY"||Z.nodeName==="HTML"?V=Z:V.appendChild(Z),ls(Z);else{if(!de&&!Ee&&!Me&&J.indexOf("<")===-1)return y&&ie?U(J):J;if(V=id(J),!V)return de?null:ie?E:""}V&&le&&cr(V.firstChild);const Ze=Se?J:V;try{const Et=cd(Ze);for(;re=Et.nextNode();)fd(re,Ze),pd(re),qr(re.content)&&wo(re.content)}catch(Et){throw Se&&(po(J),dr(t.removed,Tt=>{Tt.element&&mo(Tt.element)})),Et}if(Se)return dr(t.removed,Et=>{Et.element&&mo(Et.element)}),Ee&&ss(J),J;if(de){if(Ee&&ss(V),ue)for(he=X.call(V.ownerDocument);V.firstChild;)he.appendChild(V.firstChild);else he=V;return(ge.shadowroot||ge.shadowrootmode)&&(he=Y.call(n,he,!0)),he}let Re=Me?V.outerHTML:V.innerHTML;return Me&&me["!doctype"]&&V.ownerDocument&&V.ownerDocument.doctype&&V.ownerDocument.doctype.name&>(wu,V.ownerDocument.doctype.name)&&(Re=" -`+Re),Ee&&(Re=bo(Re)),y&&ie?U(Re):Re},t.setConfig=function(){let J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};as(J),Ke=!0,De=me,q=ge},t.clearConfig=function(){Xr=null,Ke=!1,De=null,q=null,y=O,E=""},t.isValidAttribute=function(J,P,V){Xr||as({});const Z=et(J),re=et(P);return gd(Z,re,V)},t.addHook=function(J,P){typeof P=="function"&&wt(H,J)&&Jr(H[J],P)},t.removeHook=function(J,P){if(wt(H,J)){if(P!==void 0){const V=ru(H[J],P);return V===-1?void 0:nu(H[J],V,1)[0]}return As(H[J])}},t.removeHooks=function(J){wt(H,J)&&(H[J]=[])},t.removeAllHooks=function(){H=Gs()},t}var Fo=js();const Au=()=>{const e=()=>{const n=window.G7Core?.state?.get?.();return n&&(n.preferredCurrency||n.defaultCurrency)||""},[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||a.defaultCurrency)||"")});return typeof o=="function"?o:void 0},[]),t},Nu=(e,t=!1)=>{window.G7Core?.dispatch?.({handler:"navigate",params:t?{path:e,mergeQuery:!0,query:{}}:{path:e}})},Ou=e=>{const t=Math.round(e*2)/2;return[1,2,3,4,5].map(r=>t>=r?"full":t>=r-.5?"half":"empty")},Bs=({product:e,onClick:t,shopBase:r="/shop",preserveListQuery:n=!1,className:o="",id:a,editorAttrs:s})=>{const l=Au(),f=v=>{const T=`multi_currency_${v}`,I=e[T];if(I&&I[l])return I[l].formatted;const S=`${v}_formatted`;return e[S]},h=e.name_localized??(typeof e.name=="string"?e.name:"")??"",c=f("selling_price"),i=f("list_price"),u=e.discount_rate&&e.discount_rate>0,g=e.sales_status&&e.sales_status!=="on_sale",p=e.labels??[],m=v=>Fo.sanitize(v,{ALLOWED_TAGS:["mark"],ALLOWED_ATTR:[]}),w=e.name_highlighted,k=e.description_highlighted??e.short_description,M=()=>{if(t)t(e.id);else{const v=r==="/"?"":r,T=e.product_code??e.id;Nu(`${v}/products/${T}`,n)}};return d.jsxs(R,{onClick:M,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 ${o}`,id:a,...s,children:[d.jsxs(j,{className:"relative aspect-square overflow-hidden bg-gray-100 dark:bg-gray-700",children:[d.jsx(jt,{src:e.thumbnail_url,alt:h,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200",loading:"lazy"}),g&&d.jsx(j,{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:d.jsx(te,{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})}),u&&e.sales_status!=="sold_out"&&e.sales_status!=="suspended"&&d.jsxs(te,{className:"absolute top-2 left-2 px-2 py-1 bg-red-500 text-white text-xs font-bold rounded",children:[e.discount_rate,"%"]}),p.length>0&&d.jsx(j,{className:"absolute bottom-2 right-2 flex gap-1 flex-wrap justify-end",children:p.map((v,T)=>d.jsx(te,{className:"text-xs text-white font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:v.color||"#6b7280"},children:v.name},T))})]}),d.jsxs(j,{className:"p-4",children:[d.jsxs(j,{className:"flex items-center gap-1.5 flex-wrap",children:[e.primary_category&&d.jsx(te,{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(te,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.brand_name})]}),w?d.jsx(j,{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:m(w)}}):d.jsx(Tn,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1",children:h}),k&&d.jsx(j,{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:m(k)}}),d.jsxs(j,{className:"mt-1.5 flex items-center gap-1",children:[Ou(e.rating_avg??0).map((v,T)=>d.jsxs(te,{className:`text-xs ${v==="empty"?"text-gray-300 dark:text-gray-600":"text-yellow-400"}`,children:[v==="full"&&d.jsx("i",{className:"fa-solid fa-star"}),v==="half"&&d.jsx("i",{className:"fa-solid fa-star-half-stroke"}),v==="empty"&&d.jsx("i",{className:"fa-regular fa-star"})]},T)),d.jsx(te,{className:"text-xs text-gray-600 dark:text-gray-400 ml-0.5",children:(e.rating_avg??0).toFixed(1)}),d.jsxs(te,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",e.review_count??0,")"]})]}),d.jsxs(j,{className:"mt-2 flex items-baseline gap-2",children:[d.jsx(te,{className:"font-bold text-gray-900 dark:text-white",children:c}),i&&u&&d.jsx(te,{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:i})]})]})]})},Mu=Object.freeze(Object.defineProperty({__proto__:null,default:Bs},Symbol.toStringTag,{value:"Module"})),Iu={ALLOWED_TAGS:["svg","g","defs","title","desc","rect","circle","ellipse","line","polyline","polygon","path","text","tspan","linearGradient","radialGradient","stop","clipPath"],ALLOWED_ATTR:["xmlns","width","height","viewBox","role","aria-label","aria-hidden","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","opacity","transform","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","d","points","width","height","text-anchor","dominant-baseline","font-family","font-size","font-weight","offset","stop-color","stop-opacity","gradientUnits","id","clip-path"],FORBID_TAGS:["script","foreignObject","image","use","a","style"],FORBID_ATTR:["onload","onerror","onclick","onmouseover","onfocus","onblur","href","xlink:href"]},Uo=({brandMark:e,size:t=32,className:r="",id:n,editorAttrs:o})=>{const a=e?.svg,s=e?.text,l=C.useMemo(()=>!a||a.trim()===""?"":Fo.sanitize(a,Iu),[a]),f={width:`${t}px`,height:`${t}px`,flex:`0 0 ${t}px`};if(l)return d.jsx(j,{id:n,"aria-hidden":"true",className:`inline-flex items-center justify-center ${r}`.trim(),style:f,dangerouslySetInnerHTML:{__html:l},...o});if(s&&s.trim()!==""){const h=e?.class??"bg-gray-500 text-white";return d.jsx(te,{id:n,"aria-hidden":"true",className:`inline-flex items-center justify-center rounded-lg text-xs font-bold ${h} ${r}`.trim(),style:f,...o,children:s})}return null},Pu=Object.freeze(Object.defineProperty({__proto__:null,BrandMark:Uo,default:Uo},Symbol.toStringTag,{value:"Module"})),Ws="carousel",rn="controller",Du="navigation",Lu="no-scroll",zo="portal",$u="root",Vs="toolbar",Fu="counter",nn="fullscreen",Ks="slideshow",on="thumbnails",Ys="zoom",Mr="loading",Ho="playing",an="error",sn="complete",Uu="placeholder",ln=e=>`active-slide-${e}`,zu=ln(Mr),Hu=ln(Ho),Gu=ln(an),ju=ln(sn),Xs="fullsize",Ir="flex_center",Bu="no_scroll",qs="no_scroll_padding",Go="slide",Zs="slide_wrapper",Wu="slide_wrapper_interactive",nr="prev",or="next",jo="swipe",Pr="close",Qs="onPointerDown",Js="onPointerMove",Rs="onPointerUp",el="onPointerLeave",tl="onPointerCancel",Bo="onKeyDown",Vu="onKeyUp",Wo="onWheel",Ku="Escape",Yu="ArrowLeft",Xu="ArrowRight",qu="button",In="icon",rl="contain",nl="cover",ol="Unknown action type",al="yarl__";function ht(...e){return[...e].filter(Boolean).join(" ")}function ye(e){return`${al}${e}`}function Xe(e){return`--${al}${e}`}function fr(e,t){return`${e}${t?`_${t}`:""}`}function gr(e){return t=>fr(e,t)}function hr(e,t){var r;return(r=e?.[t])!==null&&r!==void 0?r:t}function sl(e,t,r){return hr(e,"{index} of {total}").replace(/\{index}/g,`${Xo(r,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function Dr(...e){return()=>{e.forEach(t=>{t()})}}function $t(e,t,r){return()=>{const n=A.useContext(r);if(!n)throw new Error(`${e} must be used within a ${t}.Provider`);return n}}function Vo(){return typeof window<"u"}function Ko(e,t=0){const r=10**t;return Math.round((e+Number.EPSILON)*r)/r}function pr(e){return e.type===void 0||e.type==="image"}function Yo(e,t){return e.imageFit===nl||e.imageFit!==rl&&t===nl}function Pn(e){return typeof e=="string"?Number.parseInt(e,10):e}function Dn(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=Pn(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function Zu(e,t){const r=Dn(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 Qu(){return(Vo()?window?.devicePixelRatio:void 0)||1}function Xo(e,t){return t>0?(e%t+t)%t:0}function qo(e){return e.length>0}function Zo(e,t){return e[Xo(t,e.length)]}function Qo(e,t){return qo(e)?Zo(e,t):void 0}function ll(e){return pr(e)?e.src:void 0}function Ln(e,t,r){if(!r)return e;const{buttons:n,...o}=e,a=n.findIndex(l=>l===t),s=A.isValidElement(r)?A.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 il(e,t,r=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),r))}const Ju=Number(A.version.split(".")[0])>=19;function Ru(e){return{inert:Ju?e:e?"":void 0}}function ef(e){e.scrollTop}const Jo={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[Pr]},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:rl,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function Ft(e,t){return{name:e,component:t}}function it(e,t){return{module:e,children:t}}function cl(e,t,r){return e.module.name===t?r(e):e.children?[it(e.module,e.children.flatMap(n=>{var o;return(o=cl(n,t,r))!==null&&o!==void 0?o:[]}))]:[e]}function Lr(e,t,r){return e.flatMap(n=>{var o;return(o=cl(n,t,r))!==null&&o!==void 0?o:[]})}function tf(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=[it(p,n)];return}n=Lr(n,g,m=>[it(p,[m])])},s=(g,p)=>{n=Lr(n,g,m=>[it(m.module,[it(p,m.children)])])},l=(g,p,m)=>{n=Lr(n,g,w=>{var k;return[it(w.module,[...m?[it(p)]:[],...(k=w.children)!==null&&k!==void 0?k:[],...m?[]:[it(p)]])]})},f=(g,p,m)=>{n=Lr(n,g,w=>[...m?[it(p)]:[],w,...m?[]:[it(p)]])},h=g=>{s(rn,g)},c=(g,p)=>{n=Lr(n,g,m=>[it(p,m.children)])},i=g=>{n=Lr(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 dl=A.createContext(null),Ro=$t("useA11yContext","A11yContext",dl);function rf({children:e}){const[t,r]=A.useState(!1),[n,o]=A.useState(!1),a=A.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 A.createElement(dl.Provider,{value:a},e)}const ul=A.createContext(null),$r=$t("useDocument","DocumentContext",ul);function nf({nodeRef:e,children:t}){const r=A.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 A.createElement(ul.Provider,{value:r},t)}const fl=A.createContext(null),Fr=$t("useEvents","EventsContext",fl);function of({children:e}){const[t]=A.useState({});A.useEffect(()=>()=>{Object.keys(t).forEach(n=>delete t[n])},[t]);const r=A.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 A.createElement(fl.Provider,{value:r},e)}const gl=A.createContext(null),ct=$t("useLightboxProps","LightboxPropsContext",gl);function hl({children:e,...t}){return A.createElement(gl.Provider,{value:t},e)}const pl=A.createContext(null),Ut=$t("useLightboxState","LightboxStateContext",pl),ml=A.createContext(null),af=$t("useLightboxDispatch","LightboxDispatchContext",ml);function sf(e,t){switch(t.type){case"swipe":{const{slides:r}=e,n=t?.increment||0,o=e.globalIndex+n,a=Xo(o,r.length),s=Qo(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:Qo(t.slides,t.index)}:e;default:throw new Error(ol)}}function lf({slides:e,index:t,children:r}){const[n,o]=A.useReducer(sf,{slides:e,currentIndex:t,globalIndex:t,currentSlide:Qo(e,t)});A.useEffect(()=>{o({type:"update",slides:e,index:t})},[e,t]);const a=A.useMemo(()=>({...n,state:n,dispatch:o}),[n,o]);return A.createElement(ml.Provider,{value:o},A.createElement(pl.Provider,{value:a},r))}const bl=A.createContext(null),cn=$t("useTimeouts","TimeoutsContext",bl);function cf({children:e}){const[t]=A.useState([]);A.useEffect(()=>()=>{t.forEach(n=>window.clearTimeout(n)),t.splice(0,t.length)},[t]);const r=A.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 A.createElement(bl.Provider,{value:r},e)}const Ur=A.forwardRef(function({label:t,className:r,icon:n,renderIcon:o,onClick:a,style:s,...l},f){const{styles:h,labels:c}=ct(),i=hr(c,t);return A.createElement("button",{ref:f,type:"button",title:i,"aria-label":i,className:ht(ye(qu),r),onClick:a,style:{...s,...h.button},...l},o?o():A.createElement(n,{className:ye(In),style:h.icon}))});function yl(e,t){const r=n=>A.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 xt(e,t){return yl(e,A.createElement("g",{fill:"currentColor"},A.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}function df(e,t){return yl(e,A.createElement(A.Fragment,null,A.createElement("defs",null,A.createElement("mask",{id:"strike"},A.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),A.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),A.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),A.createElement("g",{fill:"currentColor",mask:"url(#strike)"},A.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t)))}const uf=xt("Close",A.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"})),ff=xt("Previous",A.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),gf=xt("Next",A.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),hf=xt("Loading",A.createElement(A.Fragment,null,Array.from({length:8}).map((e,t,r)=>A.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)`})))),pf=xt("Error",A.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"})),Vt=Vo()?A.useLayoutEffect:A.useEffect;function ea(){const[e,t]=A.useState(!1);return A.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 mf(e){let t=0,r=0,n=0;const a=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(a){const s=a[1].split(",").map(Pn);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 ta(e,t){const r=A.useRef(void 0),n=A.useRef(void 0),o=ea();return Vt(()=>{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(),mf(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 vl(){const e=A.useRef(null),t=A.useRef(void 0),[r,n]=A.useState();return{setContainerRef:A.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 $n(){const e=A.useRef(void 0),{setTimeout:t,clearTimeout:r}=cn();return A.useCallback((n,o)=>{r(e.current),e.current=t(n,o>0?o:0)},[t,r])}function Le(e){const t=A.useRef(e);return Vt(()=>{t.current=e}),A.useCallback((...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}function wl(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function ra(e,t){return A.useMemo(()=>e==null&&t==null?null:r=>{wl(e,r),wl(t,r)},[e,t])}function xl(e,t=!1){const r=A.useRef(!1);Vt(()=>{t&&r.current&&(r.current=!1,e())},[t,e]);const n=A.useCallback(()=>{r.current=!0},[]),o=A.useCallback(()=>{r.current=!1},[]);return{onFocus:n,onBlur:o}}function Fn(){const[e,t]=A.useState(!1);return Vt(()=>{t(window.getComputedStyle(window.document.documentElement).direction==="rtl")},[]),e}function kl(){const[e]=A.useState({}),t=A.useCallback((o,a)=>{var s;(s=e[o])===null||s===void 0||s.forEach(l=>{a.isPropagationStopped()||l(a)})},[e]),r=A.useMemo(()=>({onPointerDown:o=>t(Qs,o),onPointerMove:o=>t(Js,o),onPointerUp:o=>t(Rs,o),onPointerLeave:o=>t(el,o),onPointerCancel:o=>t(tl,o),onKeyDown:o=>t(Bo,o),onKeyUp:o=>t(Vu,o),onWheel:o=>t(Wo,o)}),[t]),n=A.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 Cl(e,t){const r=A.useRef(0),n=$n(),o=Le((...a)=>{r.current=Date.now(),e(a)});return A.useCallback((...a)=>{n(()=>{o(a)},t-(Date.now()-r.current))},[t,o,n])}const na=gr("slide"),oa=gr("slide_image");function mr({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,w,k;const[M,v]=A.useState(Mr),{publish:T}=Fr(),{setTimeout:I}=cn(),S=A.useRef(null);A.useEffect(()=>{t===0&&T(ln(M))},[t,M,T]);const N=Le(B=>{("decode"in B?B.decode():Promise.resolve()).catch(()=>{}).then(()=>{B.parentNode&&(v(sn),I(()=>{l?.(B)},0))})}),x=A.useCallback(B=>{S.current=B,B?.complete&&N(B)},[N]),y=A.useCallback(B=>{N(B.currentTarget)},[N]),E=Le(()=>{v(an),f?.()}),O=Yo(e,o),$=(B,Y)=>Number.isFinite(B)?B:Y,D=$(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=S.current)===null||u===void 0?void 0:u.naturalWidth)||0),L=$(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=S.current)===null||m===void 0?void 0:m.naturalHeight)||0),U=D&&L?{maxWidth:`min(${D}px, 100%)`,maxHeight:`min(${L}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},_=(w=e.srcSet)===null||w===void 0?void 0:w.sort((B,Y)=>B.width-Y.width).map(B=>`${B.src} ${B.width}w`).join(", "),b=()=>n&&!O&&e.width&&e.height?n.height/e.height*e.width:Number.MAX_VALUE,z=_&&n&&Vo()?`${Math.round(Math.min(b(),n.width))}px`:void 0,{style:F,className:G,...X}=a||{};return A.createElement(A.Fragment,null,A.createElement("img",{ref:x,onLoad:y,onError:E,onClick:s,draggable:!1,className:ht(ye(oa()),O&&ye(oa("cover")),M!==sn&&ye(oa("loading")),G),style:{...U,...h,...F},...X,alt:(k=e.alt)!==null&&k!==void 0?k:"",sizes:z,srcSet:_,src:e.src}),M!==sn&&A.createElement("div",{className:ye(na(Uu))},M===Mr&&(r?.iconLoading?r.iconLoading():A.createElement(hf,{className:ht(ye(In),ye(na(Mr)))})),M===an&&(r?.iconError?r.iconError():A.createElement(pf,{className:ht(ye(In),ye(na(an)))}))))}const bf=A.forwardRef(function({className:t,children:r,onFocus:n,onBlur:o,...a},s){const l=A.useRef(null),{trackFocusWithin:f}=Ro();return A.createElement(nf,{nodeRef:l},A.createElement("div",{ref:ra(s,l),className:ht(ye("root"),t),...f(n,o),...a},r))});var pt;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"})(pt||(pt={}));function _l(e,t,r,n,o){A.useEffect(()=>o?()=>{}:Dr(e(Qs,t),e(Js,r),e(Rs,n),e(el,n),e(tl,n)),[e,t,r,n,o])}var Kt;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"})(Kt||(Kt={}));const aa=30;function yf({disableSwipeNavigation:e,closeOnBackdropClick:t},r,n,o,a,s,l,f,h,c,i,u,g,p,m,w){const k=A.useRef(0),M=A.useRef([]),v=A.useRef(void 0),T=A.useRef(0),I=A.useRef(Kt.NONE),S=A.useCallback(D=>{v.current===D.pointerId&&(v.current=void 0,I.current=Kt.NONE);const L=M.current;L.splice(0,L.length,...L.filter(U=>U.pointerId!==D.pointerId))},[]),N=A.useCallback(D=>{S(D),D.persist(),M.current.push(D)},[S]),x=A.useCallback(D=>M.current.find(({pointerId:L})=>D.pointerId===L),[]),y=Le(D=>{N(D)}),E=(D,L)=>i&&D>L||c&&D<-L,O=Le(D=>{const L=x(D);if(L)if(v.current===D.pointerId){const U=Date.now()-T.current,_=k.current;I.current===Kt.SWIPE?Math.abs(_)>.3*o||Math.abs(_)>5&&U{const L=x(D);if(L){const U=v.current===D.pointerId;if(D.buttons===0){U&&k.current!==0?O(D):S(L);return}const _=D.clientX-L.clientX,b=D.clientY-L.clientY;if(v.current===void 0){const z=F=>{N(D),v.current=D.pointerId,T.current=Date.now(),I.current=F};Math.abs(_)>Math.abs(b)&&Math.abs(_)>aa&&n(_)?e||(z(Kt.SWIPE),s()):Math.abs(b)>Math.abs(_)&&E(b,aa)&&(z(Kt.PULL),u())}else U&&(I.current===Kt.SWIPE?(k.current=_,l(_)):I.current===Kt.PULL&&(k.current=b,g(b)))}});_l(r,y,$,O)}function vf({preventDefaultWheelX:e,preventDefaultWheelY:t}){const r=A.useRef(null),n=Le(o=>{const a=Math.abs(o.deltaX)>Math.abs(o.deltaY);(a&&e||!a&&t||o.ctrlKey)&&o.preventDefault()});return A.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 wf(e,t,r,n,o,a,s,l,f){const h=A.useRef(0),c=A.useRef(0),i=A.useRef(void 0),u=A.useRef(void 0),g=A.useRef(0),p=A.useRef(void 0),m=A.useRef(0),{setTimeout:w,clearTimeout:k}=cn(),M=A.useCallback(()=>{i.current&&(k(i.current),i.current=void 0)},[k]),v=A.useCallback(()=>{u.current&&(k(u.current),u.current=void 0)},[k]),T=Le(()=>{e!==pt.SWIPE&&(h.current=0,m.current=0,M(),v())});A.useEffect(T,[e,T]);const I=Le(N=>{u.current=void 0,h.current===N&&f(h.current)}),S=Le(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const x=y=>{g.current=y,k(p.current),p.current=y>0?w(()=>{g.current=0,p.current=void 0},300):void 0};if(e===pt.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){x(N.deltaX);return}if(!r(-N.deltaX))return;if(c.current+=N.deltaX,M(),Math.abs(c.current)>30)c.current=0,x(0),m.current=Date.now(),a();else{const y=c.current;i.current=w(()=>{i.current=void 0,y===c.current&&(c.current=0)},o)}}else if(e===pt.SWIPE){let y=h.current-N.deltaX;if(y=Math.min(Math.abs(y),n)*Math.sign(y),h.current=y,s(y),v(),Math.abs(y)>.2*n){x(N.deltaX),l(y,Date.now()-m.current);return}u.current=w(()=>I(y),2*o)}else x(N.deltaX)});A.useEffect(()=>t(Wo,S),[t,S])}const Sl=gr("container"),El=A.createContext(null),Yt=$t("useController","ControllerContext",El);function xf({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]=A.useState(),m=Ut(),w=af(),[k,M]=A.useState(pt.NONE),v=A.useRef(0),T=A.useRef(0),I=A.useRef(1),{registerSensors:S,subscribeSensors:N}=kl(),{subscribe:x,publish:y}=Fr(),E=$n(),O=$n(),$=$n(),{containerRef:D,setContainerRef:L,containerRect:U}=vl(),_=ra(vf({preventDefaultWheelX:i,preventDefaultWheelY:u}),L),b=A.useRef(null),z=ra(b,void 0),{getOwnerDocument:F}=$r(),G=Fn(),X=K=>(G?-1:1)*(typeof K=="number"?K:1),B=Le(()=>{var K;return(K=D.current)===null||K===void 0?void 0:K.focus()}),Y=Le(()=>t),H=Le(()=>m),W=A.useCallback(K=>y(nr,K),[y]),Q=A.useCallback(K=>y(or,K),[y]),be=A.useCallback(()=>y(Pr),[y]),se=K=>!(n.finite&&(X(K)>0&&m.currentIndex===0||X(K)<0&&m.currentIndex===m.slides.length-1)),pe=K=>{var oe;v.current=K,(oe=D.current)===null||oe===void 0||oe.style.setProperty(Xe("swipe_offset"),`${Math.round(K)}px`)},ne=K=>{var oe,ae;T.current=K,I.current=(()=>{const Ee=c&&K>0?K:h&&K<0?-K:0;return Math.min(Math.max(Ko(1-Ee/60*(1-.5),2),.5),1)})(),(oe=D.current)===null||oe===void 0||oe.style.setProperty(Xe("pull_offset"),`${Math.round(K)}px`),(ae=D.current)===null||ae===void 0||ae.style.setProperty(Xe("pull_opacity"),`${I.current}`)},{prepareAnimation:Ae}=ta(b,(K,oe,ae)=>{if(b.current&&U)return{keyframes:[{transform:`translate(0, ${K.rect.y-oe.y+ae.y}px)`,opacity:K.opacity},{transform:"translate(0, 0)",opacity:1}],duration:K.duration,easing:o.easing.fade}}),ve=(K,oe)=>{if(h||c){ne(K);let ae=0;b.current&&(ae=o.fade*(oe?2:1),Ae({rect:b.current.getBoundingClientRect(),opacity:I.current,duration:ae})),$(()=>{ne(0),M(pt.NONE)},ae),M(pt.ANIMATION),oe||be()}},{prepareAnimation:We,isAnimationPlaying:me}=ta(b,(K,oe,ae)=>{var ce;if(b.current&&U&&(!((ce=m.animation)===null||ce===void 0)&&ce.duration)){const ke=Dn(n.spacing),Ee=(ke.percent?ke.percent*U.width/100:ke.pixel)||0;return{keyframes:[{transform:`translate(${X(m.globalIndex-K.index)*(U.width+Ee)+K.rect.x-oe.x+ae.x}px, 0)`},{transform:"translate(0, 0)"}],duration:m.animation.duration,easing:m.animation.easing}}}),Te=Le(K=>{var oe,ae;const ce=K.offset||0,ke=ce?o.swipe:(oe=o.navigation)!==null&&oe!==void 0?oe:o.swipe,Ee=!ce&&!me()?o.easing.navigation:o.easing.swipe;let{direction:Be}=K;const Me=(ae=K.count)!==null&&ae!==void 0?ae:1;let Ke=pt.ANIMATION,De=ke*Me;if(!Be){const le=U?.width,de=K.duration||0,ue=le?ke/le*Math.abs(ce):ke;Me!==0?(de0?nr:or):De=ke/2}let q=0;Be===nr?se(X(1))?q=-Me:(Ke=pt.NONE,De=ke):Be===or&&(se(X(-1))?q=Me:(Ke=pt.NONE,De=ke)),De=Math.round(De),O(()=>{pe(0),M(pt.NONE)},De),b.current&&We({rect:b.current.getBoundingClientRect(),index:m.globalIndex}),M(Ke),y(jo,{type:"swipe",increment:q,duration:De,easing:Ee})});A.useEffect(()=>{var K,oe;!((K=m.animation)===null||K===void 0)&&K.increment&&(!((oe=m.animation)===null||oe===void 0)&&oe.duration)&&E(()=>w({type:"swipe",increment:0}),m.animation.duration)},[m.animation,w,E]);const ge=[N,se,U?.width||0,o.swipe,()=>M(pt.SWIPE),K=>pe(K),(K,oe)=>Te({offset:K,duration:oe,count:1}),K=>Te({offset:K,count:0})],Oe=[()=>{c&&M(pt.PULL)},K=>ne(K),K=>ve(K),K=>ve(K,!0)];yf(a,...ge,h,c,...Oe,be),wf(k,...ge);const we=Le(()=>{a.focus&&F().querySelector(`.${ye(zo)} .${ye(Sl())}`)&&B()});A.useEffect(we,[we]);const $e=Le(()=>{var K;(K=s.view)===null||K===void 0||K.call(s,{index:m.currentIndex})});A.useEffect($e,[m.globalIndex,$e]),A.useEffect(()=>Dr(x(nr,K=>Te({direction:nr,...K})),x(or,K=>Te({direction:or,...K})),x(jo,K=>w(K))),[x,Te,w]);const ze=A.useMemo(()=>({prev:W,next:Q,close:be,focus:B,slideRect:U?Zu(U,n.padding):{width:0,height:0},containerRect:U||{width:0,height:0},subscribeSensors:N,containerRef:D,setCarouselRef:z,toolbarWidth:g,setToolbarWidth:p}),[W,Q,be,B,N,U,D,z,g,p,n.padding]);return A.useImperativeHandle(a.ref,()=>({prev:W,next:Q,close:be,focus:B,getLightboxProps:Y,getLightboxState:H}),[W,Q,be,B,Y,H]),A.createElement("div",{ref:_,className:ht(ye(Sl()),ye(Ir)),style:{...k===pt.SWIPE?{[Xe("swipe_offset")]:`${Math.round(v.current)}px`}:null,...k===pt.PULL?{[Xe("pull_offset")]:`${Math.round(T.current)}px`,[Xe("pull_opacity")]:`${I.current}`}:null,...a.touchAction!=="none"?{[Xe("controller_touch_action")]:a.touchAction}:null,...l.container},tabIndex:-1,...S},U&&A.createElement(El.Provider,{value:ze},e,(r=f.controls)===null||r===void 0?void 0:r.call(f)))}const kf=Ft(rn,xf);function br(e){return fr(Ws,e)}function Tl(e){return fr(Go,e)}function Cf({slide:e,offset:t}){const r=A.useRef(null),{currentIndex:n,slides:o}=Ut(),{slideRect:a,focus:s}=Yt(),{render:l,carousel:{imageFit:f,imageProps:h},on:{click:c},styles:{slide:i},labels:u}=ct(),{getOwnerDocument:g}=$r(),p=t!==0;A.useEffect(()=>{var w;p&&(!((w=r.current)===null||w===void 0)&&w.contains(g().activeElement))&&s()},[p,s,g]);const m=()=>{var w,k,M,v;let T=(w=l.slide)===null||w===void 0?void 0:w.call(l,{slide:e,offset:t,rect:a});return!T&&pr(e)&&(T=A.createElement(mr,{slide:e,offset:t,render:l,rect:a,imageFit:f,imageProps:h,onClick:p?void 0:()=>c?.({index:n})})),T?A.createElement(A.Fragment,null,(k=l.slideHeader)===null||k===void 0?void 0:k.call(l,{slide:e}),((M=l.slideContainer)!==null&&M!==void 0?M:(({children:I})=>I))({slide:e,children:T}),(v=l.slideFooter)===null||v===void 0?void 0:v.call(l,{slide:e})):null};return A.createElement("div",{ref:r,className:ht(ye(Tl()),!p&&ye(Tl("current")),ye(Ir)),...Ru(p),style:i,role:"group","aria-roledescription":hr(u,"Slide"),"aria-label":sl(u,o,n+t)},m())}function _f(){const e=ct().styles.slide;return A.createElement("div",{className:ye(Go),style:e})}function Sf({carousel:e,labels:t}){const{slides:r,currentIndex:n,globalIndex:o}=Ut(),{setCarouselRef:a}=Yt(),{autoPlaying:s,focusWithin:l}=Ro(),f=Dn(e.spacing),h=Dn(e.padding),c=il(e,r,1),i=[];if(qo(r))for(let u=n-c;u<=n+c;u+=1){const g=Zo(r,u),p=o-n+u,m=e.finite&&(u<0||u>r.length-1);i.push(m?{key:p}:{key:[`${p}`,ll(g)].filter(Boolean).join("|"),offset:u-n,slide:g})}return A.createElement("div",{ref:a,className:ht(ye(br()),i.length>0&&ye(br("with_slides"))),style:{[`${Xe(br("slides_count"))}`]:i.length,[`${Xe(br("spacing_px"))}`]:f.pixel||0,[`${Xe(br("spacing_percent"))}`]:f.percent||0,[`${Xe(br("padding_px"))}`]:h.pixel||0,[`${Xe(br("padding_percent"))}`]:h.percent||0},role:"region","aria-live":s&&!l?"off":"polite","aria-roledescription":hr(t,"Carousel"),"aria-label":hr(t,"Photo gallery")},i.map(({key:u,slide:g,offset:p})=>g?A.createElement(Cf,{key:u,slide:g,offset:p}):A.createElement(_f,{key:u})))}const Ef=Ft(Ws,Sf);function Al(){const{carousel:e}=ct(),{slides:t,currentIndex:r}=Ut(),n=t.length===0||e.finite&&r===0,o=t.length===0||e.finite&&r===t.length-1;return{prevDisabled:n,nextDisabled:o}}function Nl(e){var t;const r=Fn(),{publish:n}=Fr(),{animation:o}=ct(),{prevDisabled:a,nextDisabled:s}=Al(),l=((t=o.navigation)!==null&&t!==void 0?t:o.swipe)/2,f=Cl(()=>n(nr),l),h=Cl(()=>n(or),l),c=Le(i=>{switch(i.key){case Ku:n(Pr);break;case Yu:(r?s:a)||(r?h:f)();break;case Xu:(r?a:s)||(r?f:h)();break}});A.useEffect(()=>e(Bo,c),[e,c])}function Ol({label:e,icon:t,renderIcon:r,action:n,onClick:o,disabled:a,style:s}){return A.createElement(Ur,{label:e,icon:t,renderIcon:r,className:ye(`navigation_${n}`),disabled:a,onClick:o,style:s,...xl(Yt().focus,a)})}function Tf({render:{buttonPrev:e,buttonNext:t,iconPrev:r,iconNext:n},styles:o}){const{prev:a,next:s,subscribeSensors:l}=Yt(),{prevDisabled:f,nextDisabled:h}=Al();return Nl(l),A.createElement(A.Fragment,null,e?e():A.createElement(Ol,{label:"Previous",action:nr,icon:ff,renderIcon:r,style:o.navigationPrev,disabled:f,onClick:a}),t?t():A.createElement(Ol,{label:"Next",action:or,icon:gf,renderIcon:n,style:o.navigationNext,disabled:h,onClick:s}))}const Af=Ft(Du,Tf),Ml=ye(Bu),Nf=ye(qs);function Of(e){return"style"in e}function Il(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,`${(Pn(a)||0)+t}px`),()=>{s?e.style.setProperty(o,s):e.style.removeProperty(o)}}function Mf({noScroll:{disabled:e},children:t}){const r=Fn(),{getOwnerDocument:n,getOwnerWindow:o}=$r();return A.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(Il(l,h,r));const c=l.getElementsByTagName("*");for(let i=0;i{l.classList.remove(Ml),a.forEach(c=>c())}},[r,e,n,o]),A.createElement(A.Fragment,null,t)}const If=Ft(Lu,Mf);function Pl(e){return fr(zo,e)}function Dl(e,t,r){const n=e.getAttribute(t);return e.setAttribute(t,r),()=>{n?e.setAttribute(t,n):e.removeAttribute(t)}}function Pf({children:e,animation:t,styles:r,className:n,on:o,portal:a,close:s,labels:l}){const[f,h]=A.useState(!1),[c,i]=A.useState(!1),u=A.useRef([]),g=A.useRef(null),{setTimeout:p}=cn(),{subscribe:m}=Fr(),k=ea()?0:t.fade;A.useEffect(()=>(h(!0),()=>{h(!1),i(!1)}),[]);const M=Le(()=>{u.current.forEach(S=>S()),u.current=[]}),v=Le(()=>{var S;i(!1),M(),(S=o.exiting)===null||S===void 0||S.call(o),p(()=>{var N;(N=o.exited)===null||N===void 0||N.call(o),s()},k)});A.useEffect(()=>m(Pr,v),[m,v]);const T=Le(S=>{var N,x,y;ef(S),i(!0),(N=o.entering)===null||N===void 0||N.call(o);const E=(y=(x=S.parentNode)===null||x===void 0?void 0:x.children)!==null&&y!==void 0?y:[];for(let O=0;O{var O,$;($=(O=g.current)===null||O===void 0?void 0:O.focus)===null||$===void 0||$.call(O)}),p(()=>{var O;(O=o.entered)===null||O===void 0||O.call(o)},k)}),I=A.useCallback(S=>{S?T(S):M()},[T,M]);return f?tr.createPortal(A.createElement(bf,{ref:I,className:ht(n,ye(Pl()),ye(qs),c&&ye(Pl("open"))),"aria-modal":!0,role:"dialog","aria-label":hr(l,"Lightbox"),style:{...t.fade!==Jo.animation.fade?{[Xe("fade_animation_duration")]:`${k}ms`}:null,...t.easing.fade!==Jo.animation.easing.fade?{[Xe("fade_animation_timing_function")]:t.easing.fade}:null,...r.root},onFocus:S=>{g.current||(g.current=S.relatedTarget)}},e),a.root||document.body):null}const Df=Ft(zo,Pf);function Lf({children:e}){return A.createElement(A.Fragment,null,e)}const $f=Ft($u,Lf);function Ff(e){return fr(Vs,e)}function Uf({toolbar:{buttons:e},render:{buttonClose:t,iconClose:r},styles:n}){const{close:o,setToolbarWidth:a}=Yt(),{setContainerRef:s,containerRect:l}=vl();Vt(()=>{a(l?.width)},[a,l?.width]);const f=()=>t?t():A.createElement(Ur,{key:Pr,label:"Close",icon:uf,renderIcon:r,onClick:o});return A.createElement("div",{ref:s,style:n.toolbar,className:ye(Ff())},e?.map(h=>h===Pr?f():h))}const zf=Ft(Vs,Uf);function Ll(e,t){var r;return A.createElement(e.module.component,{key:e.module.name,...t},(r=e.children)===null||r===void 0?void 0:r.map(n=>Ll(n,t)))}function Hf(e,t={}){const{easing:r,...n}=e,{easing:o,...a}=t;return{easing:{...r,...o},...n,...a}}function Gf({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:w,on:k,slides:M,index:v,plugins:T,...I}=Jo,{config:S,augmentation:N}=tf([it(Df,[it(If,[it(kf,[it(Ef),it(zf),it(Af)])])])],l||T),x=N({animation:Hf(i,t),carousel:{...u,...e},render:{...g,...r},toolbar:{...p,...n},controller:{...m,...o},noScroll:{...w,...a},on:{...k,...s},...I,...c});return x.open?A.createElement(hl,{...x},A.createElement(lf,{slides:f||M,index:Pn(h||v)},A.createElement(cf,null,A.createElement(of,null,A.createElement(rf,null,Ll(it($f,S),x)))))):null}const jf={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1};function Bf(e){return Math.min(Math.max(e,Number.EPSILON),1)}function $l(e){const{minZoom:t,...r}={...jf,...e};return{minZoom:Bf(t),...r}}function Wf(e,t,r,n){const o=A.useRef(void 0),a=A.useRef(void 0),{zoom:s}=ct().animation,l=ea(),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 Vt(f,[e,t,r,f]),A.useCallback(()=>{a.current=n?.current?window.getComputedStyle(n.current).transform:void 0},[n])}function Vf(e,t){const{on:r}=ct(),n=Le(()=>{var o;t||(o=r.zoom)===null||o===void 0||o.call(r,{zoom:e})});A.useEffect(n,[e,n])}function Un(){const{zoom:e}=ct();return $l(e)}function Kf(e,t){var r,n;let o={width:0,height:0},a={width:0,height:0};const{currentSlide:s}=Ut(),{imageFit:l}=ct().carousel,{maxZoomPixelRatio:f}=Un();if(e&&s){const c={...s,...t};if(pr(c)){const i=Yo(c,l),u=Math.max(...(((r=c.srcSet)===null||r===void 0?void 0:r.map(p=>p.width))||[]).concat(c.width?[c.width]:[])),g=Math.max(...(((n=c.srcSet)===null||n===void 0?void 0:n.map(p=>p.height))||[]).concat(c.height?[c.height]:[]));u>0&&g>0&&e.width>0&&e.height>0&&(a=i?{width:Math.round(Math.min(u,e.width/e.height*g)),height:Math.round(Math.min(g,e.height/e.width*u))}:{width:u,height:g},a={width:a.width*f,height:a.height*f},o=i?{width:Math.min(e.width,a.width,u),height:Math.min(e.height,a.height,g)}:{width:Math.round(Math.min(e.width,e.height/g*u,u)),height:Math.round(Math.min(e.height,e.width/u*g,g))})}}const h=o.width?Math.max(Ko(a.width/o.width,5),1):1;return{imageRect:o,maxZoom:h}}function Fl(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function Ul(e,t,r=100,n=2){return e*Math.min(1+Math.abs(t/r),n)**Math.sign(t)}function Yf(e,t,r,n,o,a,s,l,f){const h=A.useRef([]),c=A.useRef(0),i=A.useRef(void 0),{globalIndex:u}=Ut(),{getOwnerWindow:g}=$r(),{containerRef:p,subscribeSensors:m}=Yt(),{keyboardMoveDistance:w,zoomInMultiplier:k,wheelZoomDistanceFactor:M,scrollToZoom:v,doubleTapDelay:T,doubleClickDelay:I,doubleClickMaxStops:S,pinchZoomDistanceFactor:N,pinchZoomV4:x}=Un(),y=A.useCallback(z=>{if(p.current){const{pageX:F,pageY:G}=z,{scrollX:X,scrollY:B}=g(),{left:Y,top:H,width:W,height:Q}=p.current.getBoundingClientRect();return[F-Y-X-W/2,G-H-B-Q/2]}return[]},[p,g]),E=Le(z=>{const{key:F,metaKey:G,ctrlKey:X}=z,B=G||X,Y=()=>{z.preventDefault(),z.stopPropagation()};if(e>1){const H=(W,Q)=>{Y(),l(W,Q)};F==="ArrowDown"?H(0,w):F==="ArrowUp"?H(0,-w):F==="ArrowLeft"?H(-w,0):F==="ArrowRight"&&H(w,0)}F==="+"||B&&F==="="?(Y(),o()):F==="-"||B&&F==="_"?(Y(),a()):B&&F==="0"&&(Y(),s(1))}),O=Le(z=>{if((z.ctrlKey||v)&&Math.abs(z.deltaY)>Math.abs(z.deltaX)){z.stopPropagation(),s(Ul(e,-z.deltaY,M),!0,...y(z));return}e>1&&(z.stopPropagation(),v||l(z.deltaX,z.deltaY))}),$=A.useCallback(z=>{const F=h.current;F.splice(0,F.length,...F.filter(G=>G.pointerId!==z.pointerId))},[]),D=A.useCallback(z=>{$(z),z.persist(),h.current.push(z)},[$]),L=Le(z=>{var F;const G=h.current;if(z.pointerType==="mouse"&&z.buttons>1||!(!((F=f?.current)===null||F===void 0)&&F.contains(z.target)))return;e>1&&z.stopPropagation();const{timeStamp:X}=z;if(G.length===0&&X-c.current<(z.pointerType==="touch"?T:I)){c.current=0;const B=e>=1?e!==r?e*Math.max(r**(1/S),k):1:e!==t?e/Math.max(t**(-1/S),k):1;s(B,!1,...y(z))}else c.current=X;if(D(z),G.length===2){const B=Fl(G[0],G[1]);i.current={previousDistance:B,initialDistance:Math.max(B,1),initialZoom:e}}}),U=Le(z=>{const F=h.current,G=F.find(X=>X.pointerId===z.pointerId);if(F.length===2&&i.current){z.stopPropagation(),D(z);const X=Fl(F[0],F[1]),B=x?i.current.initialZoom/i.current.initialDistance*X:Ul(e,X-i.current.previousDistance,N);s(B,!0,...F.map(Y=>y(Y)).reduce((Y,H)=>H.map((W,Q)=>Y[Q]+W/2))),i.current.previousDistance=X;return}e>1&&(z.stopPropagation(),G&&(F.length===1&&l((G.clientX-z.clientX)/e,(G.clientY-z.clientY)/e),D(z)))}),_=A.useCallback(z=>{const F=h.current;F.length===2&&F.find(G=>G.pointerId===z.pointerId)&&(i.current=void 0),$(z)},[$]),b=A.useCallback(()=>{const z=h.current;z.splice(0,z.length),c.current=0,i.current=void 0},[]);_l(m,L,U,_,n),A.useEffect(b,[u,b]),A.useEffect(()=>n?()=>{}:Dr(b,m(Bo,E),m(Wo,O)),[n,m,b,E,O])}function Xf(e,t,r){const[n,o]=A.useState(1),[a,s]=A.useState(0),[l,f]=A.useState(0),h=Wf(n,a,l,r),{currentSlide:c,globalIndex:i}=Ut(),{containerRect:u,slideRect:g}=Yt(),{minZoom:p,zoomInMultiplier:m}=Un(),w=c&&pr(c)?c.src:void 0,k=!w||!r?.current;Vt(()=>{o(1),s(0),f(0)},[i,w]);const M=A.useCallback((N,x,y)=>{const E=y||n,O=a-(N||0),$=l-(x||0),D=(e.width*E-g.width)/2/E,L=(e.height*E-g.height)/2/E;s(Math.min(Math.abs(O),Math.max(D,0))*Math.sign(O)),f(Math.min(Math.abs($),Math.max(L,0))*Math.sign($))},[n,a,l,g,e.width,e.height]),v=A.useCallback((N,x,y,E)=>{const O=Ko(N+.01p?N:p:t,5);x||h(),M(y?y*(1/n-1/O):0,E?E*(1/n-1/O):0,O),o(O)},[n,p,t,M,h]),T=Le(()=>{n>1&&(n>t&&v(t,!0),M())});Vt(T,[u.width,u.height,T]);const I=A.useCallback(()=>{const N=n*m;v(n<1&&N>1?1:N)},[n,m,v]),S=A.useCallback(()=>{const N=n/m;v(n>1&&N<1?1:N)},[n,m,v]);return{zoom:n,offsetX:a,offsetY:l,disabled:k,changeOffsets:M,changeZoom:v,zoomIn:I,zoomOut:S}}const zl=A.createContext(null),sa=$t("useZoom","ZoomControllerContext",zl);function qf({children:e}){const[t,r]=A.useState(),{slideRect:n}=Yt(),{ref:o,minZoom:a}=Un(),{imageRect:s,maxZoom:l}=Kf(n,t?.imageDimensions),{zoom:f,offsetX:h,offsetY:c,disabled:i,changeZoom:u,changeOffsets:g,zoomIn:p,zoomOut:m}=Xf(s,l,t?.zoomWrapperRef);Vf(f,i),Yf(f,a,l,i,p,m,u,g,t?.zoomWrapperRef);const w=A.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]);A.useImperativeHandle(o,()=>w,[w]);const k=A.useMemo(()=>({...w,setZoomWrapper:r}),[w,r]);return A.createElement(zl.Provider,{value:k},e)}const Zf=xt("ZoomIn",A.createElement(A.Fragment,null,A.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"}),A.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),Qf=xt("ZoomOut",A.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"})),Hl=A.forwardRef(function({zoomIn:t,onLoseFocus:r},n){const o=A.useRef(!1),a=A.useRef(!1),{zoom:s,minZoom:l,maxZoom:f,zoomIn:h,zoomOut:c,disabled:i}=sa(),{render:u}=ct(),g=i||(t?s>=f:s<=l);return A.useEffect(()=>{g&&o.current&&a.current&&r(),g||(o.current=!0)},[g,r]),A.createElement(Ur,{ref:n,disabled:g,label:t?"Zoom in":"Zoom out",icon:t?Zf:Qf,renderIcon:t?u.iconZoomIn:u.iconZoomOut,onClick:t?h:c,onFocus:()=>{a.current=!0},onBlur:()=>{a.current=!1}})});function Jf(){const e=A.useRef(null),t=A.useRef(null),{focus:r}=Yt(),n=A.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=A.useCallback(()=>n(e),[n]),a=A.useCallback(()=>n(t),[n]);return A.createElement(A.Fragment,null,A.createElement(Hl,{zoomIn:!0,ref:e,onLoseFocus:a}),A.createElement(Hl,{ref:t,onLoseFocus:o}))}function Rf(){const{render:e}=ct(),t=sa();return e.buttonZoom?A.createElement(A.Fragment,null,e.buttonZoom(t)):A.createElement(Jf,null)}function eg(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function tg({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(ol)}}function rg(e){var t,r;const[{current:n,preload:o},a]=A.useReducer(tg,{}),{slide:s,rect:l,imageFit:f,render:h,interactive:c}=e,i=s.srcSet.sort((I,S)=>I.width-S.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=Yo(s,f),m=Math.max(...i.map(I=>I.width)),w=Math.min((p?Math.max:Math.min)(l.width,u*(l.height/g)),m),k=Qu(),M=Le(()=>{var I;const S=(I=i.find(N=>N.width>=w*k))!==null&&I!==void 0?I:i[i.length-1];(!n||i.findIndex(N=>N.src===n)N===S))&&a({type:"fetch",source:S.src})});Vt(M,[l.width,l.height,k,M]);const v=Le(I=>a({type:"done",source:I})),T={WebkitTransform:c?"initial":"translateZ(0)"};return p||Object.assign(T,l.width/l.heightv(o),render:{...h,iconLoading:()=>null,iconError:()=>null}}),n&&A.createElement(mr,{key:"current",...e,slide:{...s,src:n,srcSet:void 0},style:T}))}function ng({render:e,slide:t,offset:r,rect:n}){var o;const[a,s]=A.useState(),l=A.useRef(null),{zoom:f,maxZoom:h,offsetX:c,offsetY:i,setZoomWrapper:u}=sa(),g=f>1,{carousel:p,on:m}=ct(),{currentIndex:w}=Ut();Vt(()=>r===0?(u({zoomWrapperRef:l,imageDimensions:a}),()=>u(void 0)):()=>{},[r,a,u]);let k=(o=e.slide)===null||o===void 0?void 0:o.call(e,{slide:t,offset:r,rect:n,zoom:f,maxZoom:h});if(!k&&pr(t)){const M={slide:t,offset:r,rect:n,render:e,imageFit:p.imageFit,imageProps:p.imageProps,onClick:r===0?()=>{var v;return(v=m.click)===null||v===void 0?void 0:v.call(m,{index:w})}:void 0};k=eg(t)?A.createElement(rg,{...M,slide:t,interactive:g,rect:r===0?{width:n.width*f,height:n.height*f}:n}):A.createElement(mr,{onLoad:v=>s({width:v.naturalWidth,height:v.naturalHeight}),...M})}return k?A.createElement("div",{ref:l,className:ht(ye(Xs),ye(Ir),ye(Zs),g&&ye(Wu)),style:r===0?{transform:`scale(${f}) translateX(${c}px) translateY(${i}px)`}:void 0},k):null}const og=({augment:e,addModule:t})=>{e(({zoom:r,toolbar:n,render:o,controller:a,...s})=>{const l=$l(r);return{zoom:l,toolbar:Ln(n,Ys,A.createElement(Rf,null)),render:{...o,slide:f=>{var h;return pr(f.slide)?A.createElement(ng,{render:o,...f}):(h=o.slide)===null||h===void 0?void 0:h.call(o,f)}},controller:{...a,preventDefaultWheelY:l.scrollToZoom},...s}}),t(Ft(Ys,qf))},ag={separator:"/",container:{}},Gl=e=>({...ag,...e});function sg({counter:e}){const{slides:t,currentIndex:r}=Ut(),{separator:n,container:{className:o,...a},className:s,...l}=Gl(e);return t.length===0?null:A.createElement("div",{className:ht(ye("counter"),o||s),...l,...a,"aria-hidden":!0},r+1," ",n," ",t.length)}function lg({augment:e,addChild:t}){e(({counter:r,...n})=>({counter:Gl(r),...n})),t(rn,Ft(Fu,sg))}const ig={autoplay:!1,delay:3e3,ref:null},jl=e=>({...ig,...e}),Bl=A.createContext(null),cg=$t("useSlideshow","SlideshowContext",Bl);function dg({slideshow:e,carousel:{finite:t},on:r,children:n}){const{autoplay:o,delay:a,ref:s}=jl(e),l=A.useRef(o),[f,h]=A.useState(o),c=A.useRef(void 0),i=A.useRef(void 0),{slides:u,currentIndex:g}=Ut(),{setTimeout:p,clearTimeout:m}=cn(),{subscribe:w}=Fr(),{next:k}=Yt(),{setAutoPlaying:M}=Ro();A.useEffect(()=>M(f),[f,M]);const v=u.length===0||t&&g===u.length-1,T=A.useCallback(()=>{!f&&!v&&h(!0)},[f,v]),I=A.useCallback(()=>{f&&h(!1)},[f]),S=A.useCallback(()=>{m(c.current),c.current=void 0},[m]),N=Le(()=>{S(),!(!f||v||i.current===Mr||i.current===Ho)&&(c.current=p(()=>{f&&(i.current=void 0,k())},a))});A.useEffect(N,[g,f,N]),A.useEffect(()=>{f&&v&&h(!1)},[g,f,v]);const x=Le(()=>{var O;return(O=r.slideshowStart)===null||O===void 0?void 0:O.call(r)}),y=Le(()=>{var O;return(O=r.slideshowStop)===null||O===void 0?void 0:O.call(r)});A.useEffect(()=>{f?x():l.current&&y(),l.current=f},[f,x,y]),A.useEffect(()=>Dr(S,w(zu,()=>{i.current=Mr,S()}),w(Hu,()=>{i.current=Ho,S()}),w(Gu,()=>{i.current=an,N()}),w(ju,()=>{i.current=sn,N()})),[w,S,N]);const E=A.useMemo(()=>({playing:f,disabled:v,play:T,pause:I}),[f,v,T,I]);return A.useImperativeHandle(s,()=>E,[E]),A.createElement(Bl.Provider,{value:E},n)}const ug=xt("Play",A.createElement("path",{d:"M8 5v14l11-7z"})),fg=xt("Pause",A.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function gg(){const{playing:e,disabled:t,play:r,pause:n}=cg(),{render:o}=ct(),a=xl(Yt().focus,t);return o.buttonSlideshow?A.createElement(A.Fragment,null,o.buttonSlideshow({playing:e,disabled:t,play:r,pause:n})):A.createElement(Ur,{label:e?"Pause":"Play",icon:e?fg:ug,renderIcon:e?o.iconSlideshowPause:o.iconSlideshowPlay,onClick:e?n:r,disabled:t,...a})}function hg({augment:e,addModule:t}){e(({slideshow:r,toolbar:n,...o})=>({toolbar:Ln(n,Ks,A.createElement(gg,null)),slideshow:jl(r),...o})),t(Ft(Ks,dg))}const pg={auto:!1,ref:null},Wl=e=>({...pg,...e}),Vl=A.createContext(null),mg=$t("useFullscreen","FullscreenContext",Vl);function bg({fullscreen:e,on:t,children:r}){const{auto:n,ref:o}=Wl(e),a=A.useRef(null),[s,l]=A.useState(),[f,h]=A.useState(!1),c=A.useRef(!1),{getOwnerDocument:i}=$r();Vt(()=>{var v,T,I,S;const N=i();l(!((S=(I=(T=(v=N.fullscreenEnabled)!==null&&v!==void 0?v:N.webkitFullscreenEnabled)!==null&&T!==void 0?T:N.mozFullScreenEnabled)!==null&&I!==void 0?I:N.msFullscreenEnabled)!==null&&S!==void 0&&S))},[i]);const u=A.useCallback(()=>{var v;const T=i(),I=T.fullscreenElement||T.webkitFullscreenElement||T.mozFullScreenElement||T.msFullscreenElement;return((v=I?.shadowRoot)===null||v===void 0?void 0:v.fullscreenElement)||I},[i]),g=A.useCallback(()=>{const v=a.current;try{v.requestFullscreen?v.requestFullscreen().catch(()=>{}):v.webkitRequestFullscreen?v.webkitRequestFullscreen():v.mozRequestFullScreen?v.mozRequestFullScreen():v.msRequestFullscreen&&v.msRequestFullscreen()}catch{}},[]),p=A.useCallback(()=>{if(!u())return;const v=i();try{v.exitFullscreen?v.exitFullscreen().catch(()=>{}):v.webkitExitFullscreen?v.webkitExitFullscreen():v.mozCancelFullScreen?v.mozCancelFullScreen():v.msExitFullscreen&&v.msExitFullscreen()}catch{}},[u,i]);A.useEffect(()=>{const v=i(),T=()=>{h(u()===a.current)};return Dr(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(I=>(v.addEventListener(I,T),()=>v.removeEventListener(I,T))))},[u,i]);const m=Le(()=>{var v;return(v=t.enterFullscreen)===null||v===void 0?void 0:v.call(t)}),w=Le(()=>{var v;return(v=t.exitFullscreen)===null||v===void 0?void 0:v.call(t)});A.useEffect(()=>{f&&(c.current=!0),c.current&&(f?m:w)()},[f,m,w]);const k=Le(()=>{var v;return(v=n?g:null)===null||v===void 0||v(),p});A.useEffect(k,[k]);const M=A.useMemo(()=>({fullscreen:f,disabled:s,enter:g,exit:p}),[f,s,g,p]);return A.useImperativeHandle(o,()=>M,[M]),A.createElement("div",{ref:a,className:ht(ye(nn),ye(Xs))},A.createElement(Vl.Provider,{value:M},r))}const yg=xt("EnterFullscreen",A.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),vg=xt("ExitFullscreen",A.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function wg(){var e;const{fullscreen:t,disabled:r,enter:n,exit:o}=mg(),{render:a}=ct();return r?null:a.buttonFullscreen?A.createElement(A.Fragment,null,(e=a.buttonFullscreen)===null||e===void 0?void 0:e.call(a,{fullscreen:t,disabled:r,enter:n,exit:o})):A.createElement(Ur,{disabled:r,label:t?"Exit Fullscreen":"Enter Fullscreen",icon:t?vg:yg,renderIcon:t?a.iconExitFullscreen:a.iconEnterFullscreen,onClick:t?o:n})}function xg({augment:e,contains:t,addParent:r}){e(({fullscreen:n,toolbar:o,...a})=>({toolbar:Ln(o,nn,A.createElement(wg,null)),fullscreen:Wl(n),...a})),r(t(on)?on:rn,Ft(nn,bg))}const yr={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},la=e=>({...yr,...e});function Kl(){const{thumbnails:e}=ct();return la(e)}const vr=e=>fr(on,e),dt=e=>vr(fr("thumbnail",e)),kg=xt("VideoThumbnail",A.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"})),Cg=xt("UnknownThumbnail",A.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 _g({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 A.createElement(mr,{slide:{src:e.thumbnail},...s});if(pr(e))return A.createElement(mr,{slide:e,...s});const l=ye(dt(In));return e.type==="video"?A.createElement(A.Fragment,null,e.poster&&A.createElement(mr,{slide:{src:e.poster},...s}),A.createElement(kg,{className:l})):A.createElement(Cg,{className:l})}const Sg=gr("active"),ia=gr("fadein"),ca=gr("fadeout"),Eg=gr("placeholder"),Yl="delay",Xl="duration";function Tg({slide:e,index:t,onClick:r,fadeIn:n,fadeOut:o,placeholder:a,onLoseFocus:s}){const l=A.useRef(null),{render:f,styles:h,labels:c}=ct(),{slides:i,globalIndex:u}=Ut(),{getOwnerDocument:g}=$r(),{width:p,height:m,imageFit:w}=Kl(),k={width:p,height:m},M=t===u,v=Le(s);return A.useEffect(()=>{o&&g().activeElement===l.current&&v()},[o,v,g]),A.createElement("button",{ref:l,type:"button",className:ht(ye(Ir),ye(dt()),M&&ye(dt(Sg())),n&&ye(dt(ia())),o&&ye(dt(ca())),a&&ye(dt(Eg()))),style:{...n?{[Xe(dt(ia(Xl)))]:`${n.duration}ms`,[Xe(dt(ia(Yl)))]:`${n.delay}ms`}:null,...o?{[Xe(dt(ca(Xl)))]:`${o.duration}ms`,[Xe(dt(ca(Yl)))]:`${o.delay}ms`}:null,...h.thumbnail},onClick:r,"aria-current":M?!0:void 0,"aria-label":sl(c,i,t)},e&&_g({slide:e,render:f,rect:k,imageFit:w}))}function ql(e){return["top","bottom"].includes(e)}function Zl(e,t){return t+2*(e.border+e.padding)+e.gap}function Ag(e){const{thumbnail:t,poster:r}=e||{thumbnail:"placeholder"};return typeof t=="string"&&t||typeof r=="string"&&r||e&&ll(e)||void 0}function Ql({visible:e,containerRef:t}){const r=A.useRef(null),n=Fn(),{publish:o,subscribe:a}=Fr(),{carousel:s,styles:l,labels:f}=ct(),{slides:h,globalIndex:c,animation:i}=Ut(),{registerSensors:u,subscribeSensors:g}=kl();Nl(g);const p=Kl(),{position:m,width:w,height:k,border:M,borderStyle:v,borderColor:T,borderRadius:I,padding:S,gap:N,vignette:x}=p,y=i?.duration!==void 0&&i?.increment||0,E=i?.duration||0,{prepareAnimation:O}=ta(r,_=>({keyframes:ql(m)?[{transform:`translateX(${(n?-1:1)*Zl(p,w)*y+_}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${Zl(p,k)*y+_}px)`},{transform:"translateY(0)"}],duration:E,easing:i?.easing})),$=Le(()=>{let _=0;if(t.current&&r.current){const b=t.current.getBoundingClientRect(),z=r.current.getBoundingClientRect();_=ql(m)?z.left-b.left-(b.width-z.width)/2:z.top-b.top-(b.height-z.height)/2}O(_)});A.useEffect(()=>Dr(a(jo,$)),[a,$]);const D=il(s,h),L=[];if(qo(h))for(let _=c-D-Math.abs(y);_<=c+D+Math.abs(y);_+=1){const z=s.finite&&(_<0||_>h.length-1)||y<0&&_0&&_>c+D?null:Zo(h,_),F=[`${_}`,Ag(z)].filter(Boolean).join("|");L.push({key:F,index:_,slide:z})}const U=_=>()=>{_>c?o(or,{count:_-c}):_{const F=E/Math.abs(y||1),G=y>0&&b>c+D-y&&b<=c+D||y<0&&b=c-D?{duration:F,delay:((y>0?b-(c+D-y):c-D-y-b)-1)*F}:void 0,X=y>0&&bc+D?{duration:F,delay:(y>0?y-(c-D-b):-y-(b-(c+D)))*F}:void 0;return A.createElement(Tg,{key:_,index:b,slide:z,fadeIn:G,fadeOut:X,placeholder:!z,onClick:U(b),onLoseFocus:()=>{var B;return(B=r.current)===null||B===void 0?void 0:B.focus()}})})),x&&A.createElement("div",{className:ye(vr("vignette"))}))}const Jl=A.createContext(null),Ng=$t("useThumbnails","ThumbnailsContext",Jl);function Og({children:e,...t}){const{ref:r,position:n,hidden:o}=la(t.thumbnails),[a,s]=A.useState(!o),l=A.useRef(null),f=A.useMemo(()=>({visible:a,show:()=>s(!0),hide:()=>s(!1)}),[a]);return A.useImperativeHandle(r,()=>f,[f]),A.createElement(hl,{...t},A.createElement(Jl.Provider,{value:f},A.createElement("div",{ref:l,className:ht(ye(vr()),ye(vr(`${n}`)))},["start","top"].includes(n)&&A.createElement(Ql,{containerRef:l,visible:a}),A.createElement("div",{className:ye(vr("wrapper"))},e),["end","bottom"].includes(n)&&A.createElement(Ql,{containerRef:l,visible:a}))))}const Rl=()=>A.createElement(A.Fragment,null,A.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),A.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),Mg=xt("ThumbnailsVisible",Rl()),Ig=df("ThumbnailsHidden",Rl());function Pg(){const{visible:e,show:t,hide:r}=Ng(),{render:n}=ct();return n.buttonThumbnails?A.createElement(A.Fragment,null,n.buttonThumbnails({visible:e,show:t,hide:r})):A.createElement(Ur,{label:e?"Hide thumbnails":"Show thumbnails",icon:e?Mg:Ig,renderIcon:e?n.iconThumbnailsVisible:n.iconThumbnailsHidden,onClick:e?r:t})}function Dg({augment:e,contains:t,append:r,addParent:n}){e(({thumbnails:a,toolbar:s,...l})=>{const f=la(a);return{toolbar:Ln(s,on,f.showToggle?A.createElement(Pg,null):null),thumbnails:f,...l}});const o=Ft(on,Og);t(nn)?r(nn,o):n(rn,o)}const It=({className:e="",children:t,style:r,...n})=>d.jsx("i",{className:e,style:r,...n,children:t}),da=e=>{if(!e||typeof window>"u"||!window.location||!/^(https?:)?\/\//i.test(e))return!1;try{return new URL(e,window.location.href).origin!==window.location.origin}catch{return!1}},ua=window.G7Core,zn=(e,t)=>ua?.t?.(e,t)??e,Lg=async(e,t)=>{try{const r=await ua.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),ua?.toast?.error?.(zn("common.download_failed"))}},$g=(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)},ei=async e=>{const t=e.downloadUrl||e.src,r=e.filename||e.title||"image";e.downloadRequiresAuth&&!da(t)?await Lg(t,r):$g(t,r)},Fg=({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 ei(e)}finally{o(!1)}};return d.jsx(R,{type:"button",onClick:a,disabled:n,className:"yarl__button flex items-center justify-center","aria-label":zn("common.download"),title:zn("common.download"),children:n?d.jsx(It,{className:"fa-solid fa-spinner fa-spin text-white"}):d.jsx(It,{className:"fa-solid fa-download text-white"})})},zr=({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),w=e.map(v=>({src:v.src,title:v.title,description:v.description})),k=[];o&&k.push(og),a&&k.push(hg),s&&k.push(xg),l&&k.push(lg),h&&k.push(Dg);const M=e[g];if(C.useEffect(()=>{m.current=g},[g]),i){const v=(e??[]).slice(0,4);return d.jsx(j,{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:v.length>0?v.map((T,I)=>d.jsx(jt,{src:T.thumbnail||T.src,alt:T.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},I)):d.jsxs(j,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[d.jsx(It,{className:"fa-regular fa-images mr-2"}),zn("editor.component.image_gallery")]})})}return d.jsx(Gf,{open:t,close:r,slides:w,index:g,plugins:k,on:{view:({index:v})=>{v!==m.current&&p(v)}},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(Fg,{image:M,index:g,onDownload:c},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},ti=()=>{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}}};zr.displayName="ImageGallery";const ri=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:zr,default:zr,executeImageDownload:ei,useImageGallery:ti},Symbol.toStringTag,{value:"Module"})),Ug=window.G7Core,fa=(e,t)=>Ug?.t?.(e,t)??e,Hn=e=>e.url??e.download_url,Gn=({images:e=[],className:t="",id:r,editorAttrs:n})=>{const[o,a]=C.useState(0),{openGallery:s,galleryProps:l}=ti(),f=C.useMemo(()=>e.map(c=>({src:Hn(c),title:c.alt_text_current??"",thumbnail:Hn(c),downloadUrl:c.download_url,filename:c.alt_text_current??`image-${c.id}`})),[e]);if(!e||e.length===0)return d.jsx(j,{className:`flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-lg aspect-square ${t}`,id:r,...n,children:d.jsxs(j,{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(j,{className:"text-sm",children:fa("shop.no_image")})]})});const h=e[o]??e[0];return d.jsxs(j,{id:r,className:t,...n,children:[d.jsx(j,{className:"relative overflow-hidden rounded-lg bg-gray-100 dark:bg-gray-700 aspect-square mb-3",children:d.jsx(R,{type:"button",className:"w-full h-full cursor-zoom-in block",onClick:()=>s(f,o),"aria-label":fa("shop.view_image"),children:d.jsx(jt,{src:Hn(h),alt:h.alt_text_current??"",className:"w-full h-full object-contain"})})}),e.length>1&&d.jsx(j,{className:"flex gap-2 overflow-x-auto pb-1",children:e.map((c,i)=>d.jsx(R,{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??`${fa("shop.image")} ${i+1}`,children:d.jsx(jt,{src:Hn(c),alt:c.alt_text_current??"",className:"w-full h-full object-cover"})},c.id))}),d.jsx(zr,{...l})]})};Gn.displayName="ProductImageViewer";const zg=Object.freeze(Object.defineProperty({__proto__:null,ProductImageViewer:Gn,default:Gn},Symbol.toStringTag,{value:"Module"})),ni=({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{const M=parseInt(k.target.value,10);if(!isNaN(M)){const v=Math.max(t,Math.min(r,M));n(v)}},p=k=>{const M=parseInt(k.target.value,10);isNaN(M)||Mr&&n(r)},m=a||e<=t,w=a||e>=r;return d.jsxs(j,{className:`inline-flex items-center border border-gray-300 dark:border-gray-600 rounded-lg ${c.container} ${s}`,id:l,...f,children:[d.jsx(R,{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(At,{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(R,{type:"button",onClick:u,disabled:w,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"})})]})},Hg=Object.freeze(Object.defineProperty({__proto__:null,default:ni},Symbol.toStringTag,{value:"Module"})),Gg=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)},oi=(e,t)=>window.G7Core?.t?.(e,t)??e,jg=[{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"}],ai=({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){Gg.error("리액션 오류:",g)}};return d.jsx(j,{className:`flex flex-wrap gap-2 ${a}`,id:s,...l,children:jg.map(u=>{const g=c(u.type),p=t===u.type;return d.jsxs(R,{onClick:()=>i(u.type),className:` + `,children:[d.jsx(fe,{name:nt.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(te,{className:"flex-1 text-left text-gray-900 dark:text-white",children:o}),f==="dark"&&d.jsx(fe,{name:nt.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Ld=Object.freeze(Object.defineProperty({__proto__:null,ThemeToggle:An,default:An},Symbol.toStringTag,{value:"Module"})),ys={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"},$d="rounded-full overflow-hidden flex-shrink-0 border border-gray-200 dark:border-gray-700",Fd="grayscale opacity-50",Ao={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"},Qr=({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(()=>[ys[n]||ys.md,$d,u?Fd:"",o].filter(Boolean).join(" "),[n,u,o]),m=g?Ao.guest:u?Ao.withdrawn:Ao.normal,x=()=>g?d.jsx(j,{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(j,{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(j,{className:`w-full h-full flex items-center justify-center text-white font-semibold ${m}`,children:i.charAt(0).toUpperCase()});return d.jsx(j,{className:p,id:f,...h,children:c&&!g&&!u?d.jsx(jt,{src:c,alt:i,className:"w-full h-full object-cover"}):x()})},Ud=Object.freeze(Object.defineProperty({__proto__:null,Avatar:Qr},Symbol.toStringTag,{value:"Module"})),zd=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 vs(e,t){return t&&e&&typeof e.id=="string"&&e.id.length>0?{...e,id:`${e.id}__${t}`}:e}const Nn=({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(j,{className:t,style:n,id:o,children:r}):a?d.jsx(j,{className:t,style:n,id:o,children:a}):null;const u=i(),g=window.G7Core;return!u||!g?(zd.error("G7Core or DynamicRenderer not available"),null):d.jsxs(j,{className:t,style:n,id:o,children:[s.map(p=>{const{componentDef:m,dataContext:x,parentFormContext:k,getParentComponentContext:M,translationContext:v}=p,T=vs(m,o);return d.jsx(u,{componentDef:T,dataContext:x,translationContext:v,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:M?.(),parentFormContextProp:k,isRootRenderer:!1},T.id||`slot-${e}-${p.order}`)}),a]})},Hd=Object.freeze(Object.defineProperty({__proto__:null,SlotContainer:Nn,default:Nn,scopeSlotChildDef:vs},Symbol.toStringTag,{value:"Module"})),On=({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:x,dropdownAlign:k="right",className:M="",id:v,editorAttrs:T})=>{const[I,S]=C.useState(!1),N=C.useRef(null),w=C.useRef(null),y=C.useRef(null),E=C.useRef(null),O=C.useRef(new Set),$=C.useRef(u),P=C.useRef(r),L=C.useRef(n),U=C.useRef(e.length),_=C.useRef(-1);C.useEffect(()=>{$.current=u,P.current=r,L.current=n,U.current=e.length}),C.useEffect(()=>{if(!E.current||!y.current||!I)return;_.current=-1;const G=new IntersectionObserver(([X])=>{X.isIntersecting&&(L.current||!P.current||_.current!==U.current&&(_.current=U.current,$.current?.()))},{root:y.current,threshold:.1});return G.observe(E.current),()=>G.disconnect()},[I]),C.useEffect(()=>{if(!y.current||!I)return;const G=new IntersectionObserver(B=>{B.forEach(Y=>{const H=Y.target.getAttribute("data-notification-id"),W=Y.target.getAttribute("data-unread")==="true";H&&W&&Y.isIntersecting&&O.current.add(H)})},{root:y.current,threshold:.5});return y.current.querySelectorAll("[data-notification-id]").forEach(B=>G.observe(B)),()=>G.disconnect()},[I,e]);const b=t>0?t:e.filter(G=>!G.read).length,z=C.useCallback(()=>{if(I){if(b>0){const G=Array.from(O.current).filter(X=>{const B=e.find(Y=>String(Y.id)===String(X));return B&&!B.read});G.length>0&&i?.(G)}O.current.clear(),S(!1)}},[I,i,b,e]);C.useEffect(()=>{if(!I)return;const G=X=>{N.current&&!N.current.contains(X.target)&&z()};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[I,z]);const F=C.useCallback(()=>{I?z():S(!0)},[I,z]);return C.useLayoutEffect(()=>{const G=w.current;if(!I||!G)return;G.style.transform="";const X=G.getBoundingClientRect(),B=typeof window<"u"?window.innerWidth:0;if(X.width===0&&X.height===0)return;const Y=8;let H=0;X.right>B-Y?H=-(X.right-(B-Y)):X.left0&&d.jsx(te,{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})]}),I&&d.jsxs(j,{ref:w,className:`absolute ${k==="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(j,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[d.jsxs(j,{className:"flex items-center gap-3 min-w-0",children:[d.jsx(te,{className:"font-semibold text-gray-900 dark:text-white",children:o}),x&&d.jsxs(j,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>x(!h),children:[d.jsx(At,{type:"checkbox",checked:h,onChange:G=>{G.stopPropagation(),x(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(te,{className:"text-xs text-gray-600 dark:text-gray-400",children:f})]})]}),d.jsxs(j,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&b>0&&d.jsx(R,{onClick:()=>{g(),O.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(R,{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(j,{ref:y,className:"max-h-96 overflow-y-auto",children:e.length===0&&!n?d.jsx(j,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:d.jsx(te,{children:a})}):d.jsxs(d.Fragment,{children:[e.map(G=>{const X=!G.read;return d.jsxs(j,{"data-notification-id":G.id,"data-unread":X?"true":"false",onClick:()=>{G.onClick?.(),c?.(G),S(!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 ${X?"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 ${X?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),d.jsxs(j,{className:"flex-1 min-w-0",children:[d.jsx(j,{className:`text-sm truncate ${X?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:G.title}),d.jsx(j,{className:`text-sm mt-1 line-clamp-2 ${X?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:G.message}),d.jsx(j,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:G.time})]}),d.jsxs(j,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[X&&d.jsx(te,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),m&&d.jsx(R,{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:nt.Trash,className:"w-4 h-4"})})]})]},G.id)}),r&&d.jsx(j,{ref:E,className:"px-4 py-3 text-center",children:n?d.jsx(te,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):d.jsx(te,{className:"text-sm text-gray-400 dark:text-gray-500"})}),n&&!r&&e.length>0&&d.jsx(j,{className:"px-4 py-2 text-center",children:d.jsx(te,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},Gd=Object.freeze(Object.defineProperty({__proto__:null,NotificationCenter:On,default:On},Symbol.toStringTag,{value:"Module"})),Qe=(e,t)=>window.G7Core?.t?.(e,t)??e,vt=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ws=({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:x=!1,notificationTitleText:k,notificationEmptyText:M,notificationMarkAllReadText:v,notificationDeleteAllText:T,notificationUnreadOnlyText:I,onNotificationClose:S,onNotificationClick:N,onNotificationLoadMore:w,onNotificationMarkAllRead:y,onNotificationDeleteAll:E,onNotificationDelete:O,onNotificationUnreadOnlyToggle:$})=>{const[P,L]=C.useState(""),[U,_]=C.useState(!1),[b,z]=C.useState(!1),[F,G]=C.useState(!1),[X,B]=C.useState({top:0,left:0}),[Y,H]=C.useState(window.location.pathname),W=C.useRef(null),Q=C.useRef(null),be=C.useRef(null),pe=window.G7Core?.useResponsive,ne=pe?.(),Ae=ne?ne.width<768:typeof window<"u"&&window.innerWidth<768;C.useEffect(()=>{const K=()=>H(window.location.pathname);window.addEventListener("popstate",K);const oe=history.pushState;return history.pushState=function(...ae){oe.apply(this,ae),H(window.location.pathname)},()=>{window.removeEventListener("popstate",K),history.pushState=oe}},[]);const ve=(K,oe=!1)=>oe?Y===K:Y===K||Y.startsWith(K+"/"),We=()=>{const K=c==="/"?"":c;return Y.startsWith(`${K}/products`)||Y.startsWith(`${K}/cart`)||Y.startsWith(`${K}/checkout`)||Y.startsWith(`${K}/category`)},me=K=>{const oe="px-3 py-2 text-sm font-medium whitespace-nowrap cursor-pointer rounded-lg transition-colors";return K?`${oe} bg-gray-900 text-white dark:bg-white dark:text-gray-900`:`${oe} 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=oe=>{W.current&&!W.current.contains(oe.target)&&_(!1),Q.current&&!Q.current.contains(oe.target)&&z(!1),be.current&&!be.current.contains(oe.target)&&G(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const Te=a.slice(0,s),ge=a.slice(s),Oe=K=>{K.preventDefault(),P.trim()&&vt(`/search?q=${encodeURIComponent(P)}`)},we=async()=>{window.G7Core?.dispatch?.({handler:"logout"})},$e=K=>{window.G7Core?.dispatch?.({handler:"setLocale",target:K}),G(!1)},ze=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(Dd,{...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(j,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs(j,{className:"flex items-center justify-between h-16",children:[d.jsx(R,{onClick:()=>vt("/"),className:"flex items-center gap-2 flex-shrink-0 cursor-pointer",children:e?d.jsx(jt,{src:e,alt:t,className:"h-8"}):d.jsx(te,{className:"text-xl font-bold text-gray-900 dark:text-white",children:t})}),!Ae&&d.jsx(So,{onSubmit:Oe,className:"flex flex-1 max-w-lg mx-8",children:d.jsxs(j,{className:"relative w-full",children:[d.jsx(At,{type:"text",value:P,onChange:K=>L(K.target.value),placeholder:Qe("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(j,{className:"flex items-center gap-2",children:[d.jsx(An,{autoText:Qe("common.theme.auto"),lightText:Qe("common.theme.light"),darkText:Qe("common.theme.dark")}),r?.uuid&&d.jsx(On,{notifications:g,unreadCount:o,hasMore:p,loading:m,unreadOnly:x,titleText:k??Qe("mypage.notifications.title"),emptyText:M??Qe("mypage.notifications.empty"),markAllReadText:v??Qe("mypage.notifications.mark_all_read"),deleteAllText:T??Qe("mypage.notifications.delete_all"),unreadOnlyText:I??Qe("mypage.notifications.unread_only"),onClose:S,onNotificationClick:N,onLoadMore:w,onMarkAllRead:y,onDeleteAll:E,onDelete:O,onUnreadOnlyToggle:$,dropdownAlign:"right"}),d.jsxs(R,{onClick:()=>vt(`${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(te,{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(j,{ref:be,className:"relative",children:[d.jsxs(R,{onClick:()=>G(!F),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":F,"aria-label":Qe("common.language"),children:[d.jsx(fe,{name:"globe",className:"w-4 h-4"}),d.jsx(te,{className:"font-medium uppercase",children:h}),d.jsx(fe,{name:"chevron-down",className:"w-3 h-3"})]}),F&&d.jsx(j,{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 oe=K===h;return d.jsxs(R,{role:"option","aria-selected":oe,onClick:()=>$e(K),className:`w-full px-4 py-2.5 text-left text-sm flex items-center gap-3 cursor-pointer transition-colors ${oe?"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(te,{className:"flex-1 font-medium",children:ze(K)}),oe&&d.jsx(fe,{name:"check",className:"w-4 h-4"})]},K)})})]}),d.jsx(Nn,{slotId:"header_currency",id:"header_currency_slot_desktop",className:"flex items-center"}),r?.uuid?d.jsxs(j,{ref:W,className:"relative",children:[d.jsxs(R,{onClick:()=>_(!U),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(Qr,{avatar:r.avatar,name:r.name,size:"sm"}),d.jsx(te,{className:"hidden sm:inline text-sm font-medium",children:r.name}),d.jsx(fe,{name:"chevron-down",className:"w-4 h-4"})]}),U&&d.jsxs(j,{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(j,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:d.jsxs(j,{className:"flex items-center gap-3",children:[d.jsx(Qr,{avatar:r.avatar,name:r.name,size:"md"}),d.jsxs(j,{children:[d.jsx(j,{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.name}),d.jsx(j,{className:"text-xs text-gray-500 dark:text-gray-400",children:Qe("common.member")})]})]})}),d.jsxs(j,{className:"py-1",children:[r.is_admin&&d.jsxs(d.Fragment,{children:[d.jsxs(_o,{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"}),Qe("common.admin_menu")]}),d.jsx(Eo,{className:"my-1 border-gray-200 dark:border-gray-700"})]}),d.jsxs(R,{onClick:()=>{vt("/mypage"),_(!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"}),Qe("common.mypage")]}),d.jsxs(R,{onClick:()=>{vt("/mypage/orders"),_(!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"}),Qe("mypage.tabs.orders")]}),d.jsxs(R,{onClick:()=>{vt("/mypage/wishlist"),_(!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"}),Qe("mypage.tabs.wishlist")]})]}),d.jsx(Eo,{className:"my-1 border-gray-200 dark:border-gray-700"}),d.jsxs(R,{onClick:we,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"}),Qe("auth.logout")]})]})]}):d.jsxs(j,{className:"flex items-center gap-1.5",children:[d.jsx(R,{onClick:()=>vt("/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:Qe("shop.guest_order_form.nav_link")}),d.jsx(R,{onClick:()=>vt("/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:Qe("auth.login")}),d.jsx(R,{onClick:()=>vt("/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:Qe("auth.register_link")})]}),Ae&&d.jsx(R,{onClick:l,className:"p-2 text-gray-600 dark:text-gray-400",children:d.jsx(fe,{name:"menu",className:"w-6 h-6"})})]})]})}),!Ae&&d.jsx(Zr,{className:"border-t border-gray-200 dark:border-gray-800",children:d.jsx(j,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs(j,{className:"flex items-center gap-1 h-12 overflow-x-auto",children:[d.jsx(R,{onClick:()=>vt("/"),className:me(ve("/",!0)),"data-testid":"nav-home",children:Qe("nav.home")}),d.jsxs(R,{onClick:()=>vt("/boards/popular"),className:`flex items-center gap-1 ${me(ve("/boards/popular"))}`,"data-testid":"nav-popular",children:[d.jsx(te,{className:"text-orange-500",children:"🔥"}),Qe("nav.popular")]}),d.jsxs(R,{onClick:()=>vt(`${c==="/"?"":c}/products`),className:`flex items-center gap-1 ${me(We())}`,"data-testid":"nav-shop",children:[d.jsx(te,{children:"🛒"}),Qe("nav.shop")]}),Te.map(K=>d.jsxs(R,{onClick:()=>vt(`/board/${K.slug}`),className:me(ve(`/board/${K.slug}`)),children:[K.icon&&d.jsx(te,{className:"mr-1",children:K.icon}),K.name]},K.id)),ge.length>0&&d.jsxs(j,{ref:Q,className:"relative",children:[d.jsxs(R,{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:[Qe("nav.more"),d.jsx(fe,{name:"chevron-down",className:"w-4 h-4"})]}),b&&d.jsx(j,{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:`${X.top}px`,left:`${X.left}px`},children:ge.map(K=>{const oe=ve(`/board/${K.slug}`);return d.jsxs(R,{onClick:()=>{vt(`/board/${K.slug}`),z(!1)},className:`block w-full text-left px-4 py-2 text-sm cursor-pointer ${oe?"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(te,{className:"mr-1",children:K.icon}),K.name]},K.id)})})]})]})})})]})},jd=Object.freeze(Object.defineProperty({__proto__:null,default:ws},Symbol.toStringTag,{value:"Module"})),Bd=C.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("footer",{ref:n,className:t,...r,children:e})),Nt=(e,t)=>window.G7Core?.t?.(e,t)??e,Wd=768,xs=1024,Vd=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ks=({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:xs),u=i=xs,p=u?1:g?5:2,m=[{title:Nt("footer.community"),links:[{label:Nt("nav.home"),href:"/"},{label:Nt("nav.popular"),href:"/boards/popular"},{label:Nt("footer.all_boards"),href:"/boards"}]},{title:Nt("footer.info"),links:[{label:Nt("footer.about"),href:"/page/about"},{label:Nt("footer.faq"),href:"/page/faq"},{label:Nt("footer.contact"),href:"/page/contact"}]},{title:Nt("footer.policy"),links:[{label:Nt("footer.terms"),href:"/page/terms"},{label:Nt("footer.privacy"),href:"/page/privacy"},{label:Nt("footer.refund"),href:"/page/refund"}]}],x=o||m,k={github:"github",twitter:"twitter",discord:"discord",facebook:"facebook",instagram:"instagram"};return d.jsx(Bd,{...s??{},className:`bg-gray-50 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-800 ${a}`,children:d.jsxs(j,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[d.jsxs(j,{className:"grid gap-8",style:{gridTemplateColumns:`repeat(${p}, minmax(0, 1fr))`},children:[d.jsxs(j,{style:g?{gridColumn:"span 2 / span 2"}:void 0,children:[d.jsx(Tn,{className:"text-lg font-bold text-gray-900 dark:text-white",children:e}),t&&d.jsx(Gt,{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:t}),d.jsx(j,{className:"mt-4 flex items-center gap-4",children:Object.entries(n).map(([M,v])=>v?d.jsx(_o,{href:v,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:k[M],className:"w-5 h-5"})},M):null)})]}),x.map((M,v)=>d.jsxs(j,{children:[d.jsx(gs,{className:"text-sm font-semibold text-gray-900 dark:text-white uppercase tracking-wider",children:M.title}),d.jsx(Co,{className:"mt-4 space-y-2",children:M.links.map((T,I)=>d.jsx(er,{children:d.jsx(R,{onClick:()=>Vd(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})},I))})]},v))]}),d.jsxs(j,{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(Gt,{className:"text-sm text-gray-500 dark:text-gray-400",children:r||`© ${l} ${e}. All rights reserved.`}),d.jsx(Gt,{className:"text-sm text-gray-500 dark:text-gray-400",children:Nt("footer.powered_by")})]})]})})},Kd=Object.freeze(Object.defineProperty({__proto__:null,default:ks},Symbol.toStringTag,{value:"Module"})),Bt=(e,t)=>window.G7Core?.t?.(e,t)??e,Lt=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},Cs=({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(j,{className:"fixed inset-0 z-50",onClick:u,children:[d.jsx(j,{className:"fixed inset-0 bg-black/50 transition-opacity"}),d.jsxs(j,{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(j,{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[d.jsx(R,{onClick:()=>{t(),Lt("/")},className:"flex items-center gap-2 cursor-pointer",children:r?d.jsx(jt,{src:r,alt:n,className:"h-8"}):d.jsx(te,{className:"text-xl font-bold text-gray-900 dark:text-white",children:n})}),d.jsx(R,{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(j,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:d.jsxs(j,{className:"flex items-center gap-3",children:[o.avatar?d.jsx(jt,{src:o.avatar,alt:o.name,className:"w-12 h-12 rounded-full"}):d.jsx(j,{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(j,{children:[d.jsx(Gt,{className:"font-medium text-gray-900 dark:text-white",children:o.name}),d.jsx(R,{onClick:()=>{t(),Lt("/mypage")},className:"text-sm text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:Bt("common.mypage")})]})]})}):d.jsx(j,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:d.jsxs(j,{className:"flex gap-2",children:[d.jsx(R,{onClick:()=>{t(),Lt("/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:Bt("auth.login")}),d.jsx(R,{onClick:()=>{t(),Lt("/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:Bt("auth.register")})]})}),d.jsx(Zr,{className:"p-4 overflow-y-auto max-h-[calc(100vh-200px)]",children:d.jsxs(Co,{className:"space-y-1",children:[d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt("/")},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"}),Bt("nav.home")]})}),d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt("/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(te,{className:"text-orange-500",children:"🔥"}),Bt("nav.popular")]})}),d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt("/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(te,{children:"🛒"}),Bt("nav.shop")]})}),d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt("/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"}),Bt("nav.cart"),s>0&&d.jsx(te,{className:"ml-auto px-2 py-0.5 text-xs bg-blue-500 text-white rounded-full",children:s})]})}),d.jsx(er,{className:"my-4 border-t border-gray-200 dark:border-gray-800"}),d.jsx(er,{className:"px-3 py-2 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:Bt("nav.boards")}),a.map(g=>d.jsx(er,{children:d.jsxs(R,{onClick:()=>{t(),Lt(`/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(te,{children:g.icon}),g.name]})},g.id))]})}),d.jsx(j,{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(j,{className:"flex items-center justify-between text-sm text-gray-500 dark:text-gray-400",children:[d.jsx(R,{onClick:()=>{t(),Lt("/about")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Bt("footer.about")}),d.jsx(R,{onClick:()=>{t(),Lt("/terms")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Bt("footer.terms")}),d.jsx(R,{onClick:()=>{t(),Lt("/privacy")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Bt("footer.privacy")})]})})]})]})},Yd=Object.freeze(Object.defineProperty({__proto__:null,default:Cs},Symbol.toStringTag,{value:"Module"}));function _s(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r2?n-2:0),a=2;a1?r-1:0),o=1;o"u"?null:tt(BigInt.prototype.toString),Is=typeof Symbol>"u"?null:tt(Symbol.prototype.toString),wt=tt(Object.prototype.hasOwnProperty),tn=tt(Object.prototype.toString),gt=tt(RegExp.prototype.test),ur=lu(TypeError);function tt(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;o2&&arguments[2]!==void 0?arguments[2]:Rr;if(Es&&Es(e,null),!Or(t))return e;let n=t.length;for(;n--;){let o=t[n];if(typeof o=="string"){const a=r(o);a!==o&&(Rd(t)||(t[n]=a),o=a)}e[o]=!0}return e}function iu(e){for(let t=0;t/g),pu=lt(/\${[\w\W]*/g),mu=lt(/^data-[\-\w.\u00B7-\uFFFF]+$/),bu=lt(/^aria-[\-\w]+$/),Fs=lt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yu=lt(/^(?:\w+script|data):/i),vu=lt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wu=lt(/^html$/i),xu=lt(/^[a-z][.\w]*(-[.\w]+)+$/i),Us=lt(/<[/\w!]/g),zs=lt(/<[/\w]/g),ku=lt(/<\/no(script|embed|frames)/i),Cu=lt(/\/>/i),Mt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Hs=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],_u=ot(Ge({},Hs)),Su=(function(){const e={};return dr(Hs,t=>{e[t]=lt(new RegExp("])","i"))}),ot(e)})(),Eu=function(){return typeof window>"u"?null:window},Tu=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}},Gs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},rr=function(t,r,n,o){return wt(t,r)&&Or(t[r])?Ge(o.base?Ot(o.base):{},t[r],o.transform):n},$o=function(t,r,n){const o=wt(t,r)?t[r]:void 0;return o&&typeof o=="object"?Ot(o):n()};function js(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Eu();const t=J=>js(J);if(t.version="3.4.14",t.removed=[],!e||!e.document||e.document.nodeType!==Mt.document||!e.Element)return t.isSupported=!1,t;let r=e.document;const n=r,o=n.currentScript;e.DocumentFragment;const a=e.HTMLTemplateElement,s=e.Node,l=e.Element,f=e.NodeFilter,h=e.NamedNodeMap;h===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const c=e.DOMParser,i=e.trustedTypes,u=l.prototype,g=Wt(u,"cloneNode"),p=Wt(u,"remove"),m=Wt(u,"nextSibling"),x=Wt(u,"childNodes"),k=Wt(u,"parentNode"),M=Wt(u,"shadowRoot"),v=Wt(u,"attributes"),T=s&&s.prototype?Wt(s.prototype,"nodeType"):null,I=s&&s.prototype?Wt(s.prototype,"nodeName"):null,S=s&&s.prototype?Wt(s.prototype,"ownerDocument"):null,N=function(D){return T?T(D):D.nodeType},w=function(D){return I?I(D):D.nodeName};if(typeof a=="function"){const J=r.createElement("template");J.content&&J.content.ownerDocument&&(r=J.content.ownerDocument)}let y,E="",O,$=!1,P=0;const L=function(){if(P>0)throw ur('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},U=function(D){L(),P++;try{return y.createHTML(D)}finally{P--}},_=function(D){L(),P++;try{return y.createScriptURL(D)}finally{P--}},b=function(){return $||(O=Tu(i,o),$=!0),O},z=r,F=z.implementation,G=z.createNodeIterator,X=z.createDocumentFragment,B=z.getElementsByTagName,Y=n.importNode;let H=Gs();t.isSupported=typeof Ss=="function"&&typeof k=="function"&&F&&F.createHTMLDocument!==void 0;const W=gu,Q=hu,be=pu,se=mu,pe=bu,ne=yu,Ae=vu,ve=xu;let We=Fs,me=null;const Te=Ge({},[...Ds,...Io,...Do,...Po,...Ps]);let ge=null;const Oe=Ge({},[...Ls,...Lo,...$s,...Mn]);let we=Object.seal(Nr(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}})),$e=null,ze=null;const K=Object.seal(Nr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let oe=!0,ae=!0,ce=!1,ke=!0,Ee=!1,Be=!0,Me=!1,Ke=!1,Pe=null,q=null,le=!1,de=!1,ue=!1,ie=!1,Fe=!0,Ce=!1;const Ie="user-content-";let Ne=!0,He=!1,je={},_e=null;const xe=Ge({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let De=null;const Ye=Ge({},["audio","video","img","source","image","track"]);let rt=null;const qe=Ge({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Je="http://www.w3.org/1998/Math/MathML",Zt="http://www.w3.org/2000/svg",Ve="http://www.w3.org/1999/xhtml";let bt=Ve,St=!1,Pt=null;const _r=Ge({},[Je,Zt,Ve],Mo),lr=ot(["mi","mo","mn","ms","mtext"]);let Ht=Ge({},lr);const ir=ot(["annotation-xml"]);let Sr=Ge({},ir);const Bm=Ge({},["title","style","font","a","script"]);let _n=null;const Wm=["application/xhtml+xml","text/html"],Vm="text/html";let et=null,Xr=null;const Km=r.createElement("form"),nd=function(D){return D instanceof RegExp||D instanceof Function},as=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xr&&Xr===D)return;(!D||typeof D!="object")&&(D={}),D=Ot(D),_n=Wm.indexOf(D.PARSER_MEDIA_TYPE)===-1?Vm:D.PARSER_MEDIA_TYPE,et=_n==="application/xhtml+xml"?Mo:Rr,me=rr(D,"ALLOWED_TAGS",Te,{transform:et}),ge=rr(D,"ALLOWED_ATTR",Oe,{transform:et}),Pt=rr(D,"ALLOWED_NAMESPACES",_r,{transform:Mo}),rt=rr(D,"ADD_URI_SAFE_ATTR",qe,{transform:et,base:qe}),De=rr(D,"ADD_DATA_URI_TAGS",Ye,{transform:et,base:Ye}),_e=rr(D,"FORBID_CONTENTS",xe,{transform:et}),$e=rr(D,"FORBID_TAGS",Ot({}),{transform:et}),ze=rr(D,"FORBID_ATTR",Ot({}),{transform:et}),je=wt(D,"USE_PROFILES")?D.USE_PROFILES&&typeof D.USE_PROFILES=="object"?Ot(D.USE_PROFILES):D.USE_PROFILES:!1,oe=D.ALLOW_ARIA_ATTR!==!1,ae=D.ALLOW_DATA_ATTR!==!1,ce=D.ALLOW_UNKNOWN_PROTOCOLS||!1,ke=D.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ee=D.SAFE_FOR_TEMPLATES||!1,Be=D.SAFE_FOR_XML!==!1,Me=D.WHOLE_DOCUMENT||!1,de=D.RETURN_DOM||!1,ue=D.RETURN_DOM_FRAGMENT||!1,ie=D.RETURN_TRUSTED_TYPE||!1,le=D.FORCE_BODY||!1,Fe=D.SANITIZE_DOM!==!1,Ce=D.SANITIZE_NAMED_PROPS||!1,Ne=D.KEEP_CONTENT!==!1,He=D.IN_PLACE||!1,We=du(D.ALLOWED_URI_REGEXP)?D.ALLOWED_URI_REGEXP:Fs,bt=typeof D.NAMESPACE=="string"?D.NAMESPACE:Ve,Ht=$o(D,"MATHML_TEXT_INTEGRATION_POINTS",()=>Ge({},lr)),Sr=$o(D,"HTML_INTEGRATION_POINTS",()=>Ge({},ir));const V=$o(D,"CUSTOM_ELEMENT_HANDLING",()=>Nr(null));if(we=Nr(null),wt(V,"tagNameCheck")&&nd(V.tagNameCheck)&&(we.tagNameCheck=V.tagNameCheck),wt(V,"attributeNameCheck")&&nd(V.attributeNameCheck)&&(we.attributeNameCheck=V.attributeNameCheck),wt(V,"allowCustomizedBuiltInElements")&&typeof V.allowCustomizedBuiltInElements=="boolean"&&(we.allowCustomizedBuiltInElements=V.allowCustomizedBuiltInElements),lt(we),Ee&&(ae=!1),ue&&(de=!0),je&&(me=Ge({},Ps),ge=Nr(null),je.html===!0&&(Ge(me,Ds),Ge(ge,Ls)),je.svg===!0&&(Ge(me,Io),Ge(ge,Lo),Ge(ge,Mn)),je.svgFilters===!0&&(Ge(me,Do),Ge(ge,Lo),Ge(ge,Mn)),je.mathMl===!0&&(Ge(me,Po),Ge(ge,$s),Ge(ge,Mn))),K.tagCheck=null,K.attributeCheck=null,wt(D,"ADD_TAGS")&&(typeof D.ADD_TAGS=="function"?K.tagCheck=D.ADD_TAGS:Or(D.ADD_TAGS)&&(me===Te&&(me=Ot(me)),Ge(me,D.ADD_TAGS,et))),wt(D,"ADD_ATTR")&&(typeof D.ADD_ATTR=="function"?K.attributeCheck=D.ADD_ATTR:Or(D.ADD_ATTR)&&(ge===Oe&&(ge=Ot(ge)),Ge(ge,D.ADD_ATTR,et))),wt(D,"ADD_FORBID_CONTENTS")&&Or(D.ADD_FORBID_CONTENTS)&&(_e===xe&&(_e=Ot(_e)),Ge(_e,D.ADD_FORBID_CONTENTS,et)),Ne&&(me["#text"]=!0),Me&&Ge(me,["html","head","body"]),me.table&&(Ge(me,["tbody"]),delete $e.tbody),D.TRUSTED_TYPES_POLICY){if(typeof D.TRUSTED_TYPES_POLICY.createHTML!="function")throw ur('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof D.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ur('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Z=y;y=D.TRUSTED_TYPES_POLICY;try{E=U("")}catch(re){throw y=Z,re}}else D.TRUSTED_TYPES_POLICY===null?(y=void 0,E=""):(y===void 0&&(y=b()),y&&typeof E=="string"&&(E=U("")));ot&&ot(D),Xr=D},od=Ge({},[...Io,...Do,...uu]),ad=Ge({},[...Po,...fu]),Ym=function(D,V,Z){return V.namespaceURI===Ve?D==="svg":V.namespaceURI===Je?D==="svg"&&(Z==="annotation-xml"||Ht[Z]):!!od[D]},Xm=function(D,V,Z){return V.namespaceURI===Ve?D==="math":V.namespaceURI===Zt?D==="math"&&Sr[Z]:!!ad[D]},qm=function(D,V,Z){return V.namespaceURI===Zt&&!Sr[Z]||V.namespaceURI===Je&&!Ht[Z]?!1:!ad[D]&&(Bm[D]||!od[D])},Zm=function(D){let V=k(D);(!V||!V.tagName)&&(V={namespaceURI:bt,tagName:"template"});const Z=Rr(D.tagName),re=Rr(V.tagName);return Pt[D.namespaceURI]?D.namespaceURI===Zt?Ym(Z,V,re):D.namespaceURI===Je?Xm(Z,V,re):D.namespaceURI===Ve?qm(Z,V,re):!!(_n==="application/xhtml+xml"&&Pt[D.namespaceURI]):!1},cr=function(D){Jr(t.removed,{element:D});try{k(D).removeChild(D)}catch{if(p(D),!k(D))throw ur("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},sd=function(D,V,Z){try{D.removeAttributeNode(V)}catch{try{D.removeAttribute(Z)}catch{}}},po=function(D){mo(D);const V=x(D);if(V){const re=[];dr(V,he=>{Jr(re,he)}),dr(re,he=>{try{p(he)}catch{}})}const Z=v(D);if(Z)for(let re=Z.length-1;re>=0;--re){const he=Z[re],Se=he&&he.name;typeof Se=="string"&&sd(D,he,Se)}},Er=function(D,V,Z){if(!Z)try{Z=V.getAttributeNode(D)}catch{Z=null}Jr(t.removed,{attribute:Z||null,from:V});try{Z?V.removeAttributeNode(Z):V.removeAttribute(D)}catch{try{V.removeAttribute(D)}catch{}}if(D==="is")if(de||ue)try{cr(V)}catch{}else try{V.setAttribute(D,"")}catch{}},Qm=function(D){const V=v(D);if(V)for(let Z=V.length-1;Z>=0;--Z){const re=V[Z],he=re&&re.name;typeof he!="string"||ge[et(he)]||sd(D,re,he)}},mo=function(D){const V=[D];for(;V.length>0;){const Z=V.pop();N(Z)===Mt.element&&Qm(Z);const he=x(Z);if(he)for(let Se=he.length-1;Se>=0;--Se)V.push(he[Se])}},ld=function(D,V){return Be?D==="patchsrc"?!0:D==="for"&&V!=="label"&&V!=="output":!1},Jm=function(D){if(!Be)return;const V=[D];for(;V.length>0;){const Z=V.pop(),re=N(Z);if(re===Mt.processingInstruction||re===Mt.comment&>(zs,Z.data)){try{p(Z)}catch{}continue}if(re===Mt.element){const Se=Z,Ze=et(w(Z));try{Se.hasAttribute&&Se.hasAttribute("patchsrc")&&Se.removeAttribute("patchsrc"),Se.hasAttribute&&Se.hasAttribute("for")&&ld("for",Ze)&&Se.removeAttribute("for")}catch{}}const he=x(Z);if(he)for(let Se=he.length-1;Se>=0;--Se)V.push(he[Se])}},id=function(D){let V=null,Z=null;if(le)D=""+D;else{const Se=Ns(D,/^[\r\n\t ]+/);Z=Se&&Se[0]}_n==="application/xhtml+xml"&&bt===Ve&&(D=''+D+"");const re=y?U(D):D;if(bt===Ve)try{V=new c().parseFromString(re,_n)}catch{}if(!V||!V.documentElement){V=F.createDocument(bt,"template",null);try{V.documentElement.innerHTML=St?E:re}catch{}}const he=V.body||V.documentElement;return D&&Z&&he.insertBefore(r.createTextNode(Z),he.childNodes[0]||null),bt===Ve?B.call(V,Me?"html":"body")[0]:Me?V.documentElement:he},cd=function(D){const V=S?S(D):D.ownerDocument;return G.call(V||D,D,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},bo=function(D){return D=en(D,W," "),D=en(D,Q," "),D=en(D,be," "),D},ss=function(D){var V;D.normalize();const Z=S?S(D):D.ownerDocument,re=G.call(Z||D,D,f.SHOW_TEXT|f.SHOW_COMMENT|f.SHOW_CDATA_SECTION|f.SHOW_PROCESSING_INSTRUCTION,null);let he=re.nextNode();for(;he;)he.data=bo(he.data),he=re.nextNode();const Se=(V=D.querySelectorAll)===null||V===void 0?void 0:V.call(D,"template");Se&&dr(Se,Ze=>{qr(Ze.content)&&ss(Ze.content)})},yo=function(D){const V=I?I(D):null;return typeof V!="string"||et(V)!=="form"?!1:typeof D.nodeName!="string"||typeof D.textContent!="string"||typeof D.removeChild!="function"||D.attributes!==v(D)||typeof D.removeAttribute!="function"||typeof D.setAttribute!="function"||typeof D.namespaceURI!="string"||typeof D.insertBefore!="function"||typeof D.hasChildNodes!="function"||D.nodeType!==T(D)||D.childNodes!==x(D)},qr=function(D){if(!T||typeof D!="object"||D===null)return!1;try{return T(D)===Mt.documentFragment}catch{return!1}},Sn=function(D){if(!T||typeof D!="object"||D===null)return!1;try{return typeof T(D)=="number"}catch{return!1}};function Rt(J,D,V){J.length!==0&&dr(J,Z=>{Z.call(t,D,V,Xr)})}const Rm=function(D,V){return!!(Be&&D.hasChildNodes()&&!Sn(D.firstElementChild)&>(Us,D.textContent)&>(Us,D.innerHTML)||Be&&D.namespaceURI===Ve&&_u[V]&&(Sn(D.firstElementChild)||typeof D.textContent=="string"&>(Su[V],D.textContent))||D.nodeType===Mt.processingInstruction||Be&&D.nodeType===Mt.comment&>(zs,D.data))},vo=function(D,V){if(D instanceof RegExp)return gt(D,V);if(D instanceof Function){for(var Z=arguments.length,re=new Array(Z>2?Z-2:0),he=2;he=0;--Ze){const Re=D===Z?g(he[Ze],!0):he[Ze];re.insertBefore(Re,m(D))}}}return cr(D),!0},dd=function(D,V,Z,re){return D.length===0?V:V===Z||V===re?Ot(V):V},ud=function(D,V){return D===V||k(D)!==null?!1:(He&&mo(D),!0)},fd=function(D,V){if(Rt(H.beforeSanitizeElements,D,null),ud(D,V))return!0;if(yo(D))return cr(D),!0;const Z=et(w(D));if(me=dd(H.uponSanitizeElement,me,Te,Pe),Rt(H.uponSanitizeElement,D,{tagName:Z,allowedTags:me}),ud(D,V))return!0;if(Rm(D,Z))return cr(D),!0;if($e[Z]||!(K.tagCheck instanceof Function&&K.tagCheck(Z))&&!me[Z]){const he=eb(D,Z,V);return he===!1&&Rt(H.afterSanitizeElements,D,null),he}if(N(D)===Mt.element&&!Zm(D)||(Z==="noscript"||Z==="noembed"||Z==="noframes")&>(ku,D.innerHTML))return cr(D),!0;if(Ee&&D.nodeType===Mt.text){const he=bo(D.textContent);D.textContent!==he&&(Jr(t.removed,{element:D.cloneNode()}),D.textContent=he)}return Rt(H.afterSanitizeElements,D,null),!1},gd=function(D,V,Z){if(ze[V]||ld(V,D)||Fe&&(V==="id"||V==="name")&&(Z in r||Z in Km))return!1;const re=ge[V]||K.attributeCheck instanceof Function&&K.attributeCheck(V,D);return ae&>(se,V)||oe&>(pe,V)?!0:re?rt[V]||gt(We,en(Z,Ae,""))||(V==="src"||V==="xlink:href"||V==="href")&&D!=="script"&&Os(Z,"data:")===0&&De[D]||ce&&!gt(ne,en(Z,Ae,""))?!0:!Z:hd(D)&&vo(we.tagNameCheck,D)&&vo(we.attributeNameCheck,V,D)||V==="is"&&we.allowCustomizedBuiltInElements&&vo(we.tagNameCheck,Z)},tb=Ge({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),hd=function(D){return!tb[Rr(D)]&>(ve,D)},rb=function(D,V,Z,re){if(y&&typeof i=="object"&&typeof i.getAttributeType=="function"&&!Z)switch(i.getAttributeType(D,V)){case"TrustedHTML":return U(re);case"TrustedScriptURL":return _(re)}return re},nb=function(D,V,Z,re){try{Z?D.setAttributeNS(Z,V,re):D.setAttribute(V,re),yo(D)?cr(D):As(t.removed)}catch{Er(V,D)}},pd=function(D){Rt(H.beforeSanitizeAttributes,D,null);const V=D.attributes;if(!V||yo(D))return;ge=dd(H.uponSanitizeAttribute,ge,Oe,q);const Z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ge,forceKeepAttr:void 0};let re=V.length;const he=et(D.nodeName);for(;re--;){const Se=V[re],Ze=Se.name,Re=Se.namespaceURI,Et=Se.value,Tt=et(Ze),is=Et;let yt=Ze==="value"?is:ou(is);if(Z.attrName=Tt,Z.attrValue=yt,Z.keepAttr=!0,Z.forceKeepAttr=void 0,Rt(H.uponSanitizeAttribute,D,Z),yt=Z.attrValue,Ce&&(Tt==="id"||Tt==="name")&&Os(yt,Ie)!==0&&(Er(Ze,D,Se),yt=Ie+yt),Be&>(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,yt)){Er(Ze,D,Se);continue}if(Tt==="attributename"&&Ns(yt,"href")){Er(Ze,D,Se);continue}if(!Z.forceKeepAttr){if(!Z.keepAttr){Er(Ze,D,Se);continue}if(!ke&>(Cu,yt)){Er(Ze,D,Se);continue}if(Ee&&(yt=bo(yt)),!gd(he,Tt,yt)){Er(Ze,D,Se);continue}yt=rb(he,Tt,Re,yt),yt!==is&&nb(D,Ze,Re,yt)}}Rt(H.afterSanitizeAttributes,D,null)},wo=function(D){let V=null;const Z=cd(D);for(Rt(H.beforeSanitizeShadowDOM,D,null);V=Z.nextNode();)if(Rt(H.uponSanitizeShadowNode,V,null),fd(V,D),pd(V),qr(V.content)&&wo(V.content),N(V)===Mt.element){const re=M(V);qr(re)&&(ls(re),wo(re))}Rt(H.afterSanitizeShadowDOM,D,null)},ls=function(D){const V=[{node:D,shadow:null}];for(;V.length>0;){const Z=V.pop();if(Z.shadow){wo(Z.shadow);continue}const re=Z.node,Se=N(re)===Mt.element,Ze=x(re);if(Ze)for(let Re=Ze.length-1;Re>=0;--Re)V.push({node:Ze[Re],shadow:null});if(Se){const Re=I?I(re):null;if(typeof Re=="string"&&et(Re)==="template"){const Et=re.content;qr(Et)&&V.push({node:Et,shadow:null})}}if(Se){const Re=M(re);qr(Re)&&V.push({node:null,shadow:Re},{node:Re,shadow:null})}}};return t.sanitize=function(J){let D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},V=null,Z=null,re=null,he=null;if(St=!J,St&&(J=""),typeof J!="string"&&!Sn(J)&&(J=cu(J),typeof J!="string"))throw ur("dirty is not a string, aborting");if(!t.isSupported)return J;Ke?(me=Pe,ge=q):as(D),(H.uponSanitizeElement.length>0||H.uponSanitizeAttribute.length>0)&&(me=Ot(me)),H.uponSanitizeAttribute.length>0&&(ge=Ot(ge)),t.removed=[];const Se=He&&typeof J!="string"&&Sn(J);if(Se){Jm(J);const Et=w(J);if(typeof Et=="string"){const Tt=et(Et);if(!me[Tt]||$e[Tt])throw po(J),ur("root node is forbidden and cannot be sanitized in-place")}if(yo(J))throw po(J),ur("root node is clobbered and cannot be sanitized in-place");try{ls(J)}catch(Tt){throw po(J),Tt}}else if(Sn(J))V=id(""),Z=V.ownerDocument.importNode(J,!0),Z.nodeType===Mt.element&&Z.nodeName==="BODY"||Z.nodeName==="HTML"?V=Z:V.appendChild(Z),ls(Z);else{if(!de&&!Ee&&!Me&&J.indexOf("<")===-1)return y&&ie?U(J):J;if(V=id(J),!V)return de?null:ie?E:""}V&&le&&cr(V.firstChild);const Ze=Se?J:V;try{const Et=cd(Ze);for(;re=Et.nextNode();)fd(re,Ze),pd(re),qr(re.content)&&wo(re.content)}catch(Et){throw Se&&(po(J),dr(t.removed,Tt=>{Tt.element&&mo(Tt.element)})),Et}if(Se)return dr(t.removed,Et=>{Et.element&&mo(Et.element)}),Ee&&ss(J),J;if(de){if(Ee&&ss(V),ue)for(he=X.call(V.ownerDocument);V.firstChild;)he.appendChild(V.firstChild);else he=V;return(ge.shadowroot||ge.shadowrootmode)&&(he=Y.call(n,he,!0)),he}let Re=Me?V.outerHTML:V.innerHTML;return Me&&me["!doctype"]&&V.ownerDocument&&V.ownerDocument.doctype&&V.ownerDocument.doctype.name&>(wu,V.ownerDocument.doctype.name)&&(Re=" +`+Re),Ee&&(Re=bo(Re)),y&&ie?U(Re):Re},t.setConfig=function(){let J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};as(J),Ke=!0,Pe=me,q=ge},t.clearConfig=function(){Xr=null,Ke=!1,Pe=null,q=null,y=O,E=""},t.isValidAttribute=function(J,D,V){Xr||as({});const Z=et(J),re=et(D);return gd(Z,re,V)},t.addHook=function(J,D){typeof D=="function"&&wt(H,J)&&Jr(H[J],D)},t.removeHook=function(J,D){if(wt(H,J)){if(D!==void 0){const V=ru(H[J],D);return V===-1?void 0:nu(H[J],V,1)[0]}return As(H[J])}},t.removeHooks=function(J){wt(H,J)&&(H[J]=[])},t.removeAllHooks=function(){H=Gs()},t}var Fo=js();const Au=()=>{const e=()=>{const n=window.G7Core?.state?.get?.();return n&&(n.preferredCurrency||n.defaultCurrency)||""},[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||a.defaultCurrency)||"")});return typeof o=="function"?o:void 0},[]),t},Nu=(e,t=!1)=>{window.G7Core?.dispatch?.({handler:"navigate",params:t?{path:e,mergeQuery:!0,query:{}}:{path:e}})},Ou=e=>{const t=Math.round(e*2)/2;return[1,2,3,4,5].map(r=>t>=r?"full":t>=r-.5?"half":"empty")},Bs=({product:e,onClick:t,shopBase:r="/shop",preserveListQuery:n=!1,className:o="",id:a,editorAttrs:s})=>{const l=Au(),f=v=>{const T=`multi_currency_${v}`,I=e[T];if(I&&I[l])return I[l].formatted;const S=`${v}_formatted`;return e[S]},h=e.name_localized??(typeof e.name=="string"?e.name:"")??"",c=f("selling_price"),i=f("list_price"),u=e.discount_rate&&e.discount_rate>0,g=e.sales_status&&e.sales_status!=="on_sale",p=e.labels??[],m=v=>Fo.sanitize(v,{ALLOWED_TAGS:["mark"],ALLOWED_ATTR:[]}),x=e.name_highlighted,k=e.description_highlighted??e.short_description,M=()=>{if(t)t(e.id);else{const v=r==="/"?"":r,T=e.product_code??e.id;Nu(`${v}/products/${T}`,n)}};return d.jsxs(R,{onClick:M,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 ${o}`,id:a,...s,children:[d.jsxs(j,{className:"relative aspect-square overflow-hidden bg-gray-100 dark:bg-gray-700",children:[d.jsx(jt,{src:e.thumbnail_url,alt:h,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200",loading:"lazy"}),g&&d.jsx(j,{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:d.jsx(te,{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})}),u&&e.sales_status!=="sold_out"&&e.sales_status!=="suspended"&&d.jsxs(te,{className:"absolute top-2 left-2 px-2 py-1 bg-red-500 text-white text-xs font-bold rounded",children:[e.discount_rate,"%"]}),p.length>0&&d.jsx(j,{className:"absolute bottom-2 right-2 flex gap-1 flex-wrap justify-end",children:p.map((v,T)=>d.jsx(te,{className:"text-xs text-white font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:v.color||"#6b7280"},children:v.name},T))})]}),d.jsxs(j,{className:"p-4",children:[d.jsxs(j,{className:"flex items-center gap-1.5 flex-wrap",children:[e.primary_category&&d.jsx(te,{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(te,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.brand_name})]}),x?d.jsx(j,{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:m(x)}}):d.jsx(Tn,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1",children:h}),k&&d.jsx(j,{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:m(k)}}),d.jsxs(j,{className:"mt-1.5 flex items-center gap-1",children:[Ou(e.rating_avg??0).map((v,T)=>d.jsxs(te,{className:`text-xs ${v==="empty"?"text-gray-300 dark:text-gray-600":"text-yellow-400"}`,children:[v==="full"&&d.jsx("i",{className:"fa-solid fa-star"}),v==="half"&&d.jsx("i",{className:"fa-solid fa-star-half-stroke"}),v==="empty"&&d.jsx("i",{className:"fa-regular fa-star"})]},T)),d.jsx(te,{className:"text-xs text-gray-600 dark:text-gray-400 ml-0.5",children:(e.rating_avg??0).toFixed(1)}),d.jsxs(te,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",e.review_count??0,")"]})]}),d.jsxs(j,{className:"mt-2 flex items-baseline gap-2",children:[d.jsx(te,{className:"font-bold text-gray-900 dark:text-white",children:c}),i&&u&&d.jsx(te,{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:i})]})]})]})},Mu=Object.freeze(Object.defineProperty({__proto__:null,default:Bs},Symbol.toStringTag,{value:"Module"})),Iu={ALLOWED_TAGS:["svg","g","defs","title","desc","rect","circle","ellipse","line","polyline","polygon","path","text","tspan","linearGradient","radialGradient","stop","clipPath"],ALLOWED_ATTR:["xmlns","width","height","viewBox","role","aria-label","aria-hidden","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","opacity","transform","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","d","points","width","height","text-anchor","dominant-baseline","font-family","font-size","font-weight","offset","stop-color","stop-opacity","gradientUnits","id","clip-path"],FORBID_TAGS:["script","foreignObject","image","use","a","style"],FORBID_ATTR:["onload","onerror","onclick","onmouseover","onfocus","onblur","href","xlink:href"]},Uo=({brandMark:e,size:t=32,className:r="",id:n,editorAttrs:o})=>{const a=e?.svg,s=e?.text,l=C.useMemo(()=>!a||a.trim()===""?"":Fo.sanitize(a,Iu),[a]),f={width:`${t}px`,height:`${t}px`,flex:`0 0 ${t}px`};if(l)return d.jsx(j,{id:n,"aria-hidden":"true",className:`inline-flex items-center justify-center ${r}`.trim(),style:f,dangerouslySetInnerHTML:{__html:l},...o});if(s&&s.trim()!==""){const h=e?.class??"bg-gray-500 text-white";return d.jsx(te,{id:n,"aria-hidden":"true",className:`inline-flex items-center justify-center rounded-lg text-xs font-bold ${h} ${r}`.trim(),style:f,...o,children:s})}return null},Du=Object.freeze(Object.defineProperty({__proto__:null,BrandMark:Uo,default:Uo},Symbol.toStringTag,{value:"Module"})),Ws="carousel",rn="controller",Pu="navigation",Lu="no-scroll",zo="portal",$u="root",Vs="toolbar",Fu="counter",nn="fullscreen",Ks="slideshow",on="thumbnails",Ys="zoom",Mr="loading",Ho="playing",an="error",sn="complete",Uu="placeholder",ln=e=>`active-slide-${e}`,zu=ln(Mr),Hu=ln(Ho),Gu=ln(an),ju=ln(sn),Xs="fullsize",Ir="flex_center",Bu="no_scroll",qs="no_scroll_padding",Go="slide",Zs="slide_wrapper",Wu="slide_wrapper_interactive",nr="prev",or="next",jo="swipe",Dr="close",Qs="onPointerDown",Js="onPointerMove",Rs="onPointerUp",el="onPointerLeave",tl="onPointerCancel",Bo="onKeyDown",Vu="onKeyUp",Wo="onWheel",Ku="Escape",Yu="ArrowLeft",Xu="ArrowRight",qu="button",In="icon",rl="contain",nl="cover",ol="Unknown action type",al="yarl__";function ht(...e){return[...e].filter(Boolean).join(" ")}function ye(e){return`${al}${e}`}function Xe(e){return`--${al}${e}`}function fr(e,t){return`${e}${t?`_${t}`:""}`}function gr(e){return t=>fr(e,t)}function hr(e,t){var r;return(r=e?.[t])!==null&&r!==void 0?r:t}function sl(e,t,r){return hr(e,"{index} of {total}").replace(/\{index}/g,`${Xo(r,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function Pr(...e){return()=>{e.forEach(t=>{t()})}}function $t(e,t,r){return()=>{const n=A.useContext(r);if(!n)throw new Error(`${e} must be used within a ${t}.Provider`);return n}}function Vo(){return typeof window<"u"}function Ko(e,t=0){const r=10**t;return Math.round((e+Number.EPSILON)*r)/r}function pr(e){return e.type===void 0||e.type==="image"}function Yo(e,t){return e.imageFit===nl||e.imageFit!==rl&&t===nl}function Dn(e){return typeof e=="string"?Number.parseInt(e,10):e}function Pn(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=Dn(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function Zu(e,t){const r=Pn(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 Qu(){return(Vo()?window?.devicePixelRatio:void 0)||1}function Xo(e,t){return t>0?(e%t+t)%t:0}function qo(e){return e.length>0}function Zo(e,t){return e[Xo(t,e.length)]}function Qo(e,t){return qo(e)?Zo(e,t):void 0}function ll(e){return pr(e)?e.src:void 0}function Ln(e,t,r){if(!r)return e;const{buttons:n,...o}=e,a=n.findIndex(l=>l===t),s=A.isValidElement(r)?A.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 il(e,t,r=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),r))}const Ju=Number(A.version.split(".")[0])>=19;function Ru(e){return{inert:Ju?e:e?"":void 0}}function ef(e){e.scrollTop}const Jo={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[Dr]},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:rl,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function Ft(e,t){return{name:e,component:t}}function it(e,t){return{module:e,children:t}}function cl(e,t,r){return e.module.name===t?r(e):e.children?[it(e.module,e.children.flatMap(n=>{var o;return(o=cl(n,t,r))!==null&&o!==void 0?o:[]}))]:[e]}function Lr(e,t,r){return e.flatMap(n=>{var o;return(o=cl(n,t,r))!==null&&o!==void 0?o:[]})}function tf(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=[it(p,n)];return}n=Lr(n,g,m=>[it(p,[m])])},s=(g,p)=>{n=Lr(n,g,m=>[it(m.module,[it(p,m.children)])])},l=(g,p,m)=>{n=Lr(n,g,x=>{var k;return[it(x.module,[...m?[it(p)]:[],...(k=x.children)!==null&&k!==void 0?k:[],...m?[]:[it(p)]])]})},f=(g,p,m)=>{n=Lr(n,g,x=>[...m?[it(p)]:[],x,...m?[]:[it(p)]])},h=g=>{s(rn,g)},c=(g,p)=>{n=Lr(n,g,m=>[it(p,m.children)])},i=g=>{n=Lr(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 dl=A.createContext(null),Ro=$t("useA11yContext","A11yContext",dl);function rf({children:e}){const[t,r]=A.useState(!1),[n,o]=A.useState(!1),a=A.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 A.createElement(dl.Provider,{value:a},e)}const ul=A.createContext(null),$r=$t("useDocument","DocumentContext",ul);function nf({nodeRef:e,children:t}){const r=A.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 A.createElement(ul.Provider,{value:r},t)}const fl=A.createContext(null),Fr=$t("useEvents","EventsContext",fl);function of({children:e}){const[t]=A.useState({});A.useEffect(()=>()=>{Object.keys(t).forEach(n=>delete t[n])},[t]);const r=A.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 A.createElement(fl.Provider,{value:r},e)}const gl=A.createContext(null),ct=$t("useLightboxProps","LightboxPropsContext",gl);function hl({children:e,...t}){return A.createElement(gl.Provider,{value:t},e)}const pl=A.createContext(null),Ut=$t("useLightboxState","LightboxStateContext",pl),ml=A.createContext(null),af=$t("useLightboxDispatch","LightboxDispatchContext",ml);function sf(e,t){switch(t.type){case"swipe":{const{slides:r}=e,n=t?.increment||0,o=e.globalIndex+n,a=Xo(o,r.length),s=Qo(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:Qo(t.slides,t.index)}:e;default:throw new Error(ol)}}function lf({slides:e,index:t,children:r}){const[n,o]=A.useReducer(sf,{slides:e,currentIndex:t,globalIndex:t,currentSlide:Qo(e,t)});A.useEffect(()=>{o({type:"update",slides:e,index:t})},[e,t]);const a=A.useMemo(()=>({...n,state:n,dispatch:o}),[n,o]);return A.createElement(ml.Provider,{value:o},A.createElement(pl.Provider,{value:a},r))}const bl=A.createContext(null),cn=$t("useTimeouts","TimeoutsContext",bl);function cf({children:e}){const[t]=A.useState([]);A.useEffect(()=>()=>{t.forEach(n=>window.clearTimeout(n)),t.splice(0,t.length)},[t]);const r=A.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 A.createElement(bl.Provider,{value:r},e)}const Ur=A.forwardRef(function({label:t,className:r,icon:n,renderIcon:o,onClick:a,style:s,...l},f){const{styles:h,labels:c}=ct(),i=hr(c,t);return A.createElement("button",{ref:f,type:"button",title:i,"aria-label":i,className:ht(ye(qu),r),onClick:a,style:{...s,...h.button},...l},o?o():A.createElement(n,{className:ye(In),style:h.icon}))});function yl(e,t){const r=n=>A.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 xt(e,t){return yl(e,A.createElement("g",{fill:"currentColor"},A.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}function df(e,t){return yl(e,A.createElement(A.Fragment,null,A.createElement("defs",null,A.createElement("mask",{id:"strike"},A.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),A.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),A.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),A.createElement("g",{fill:"currentColor",mask:"url(#strike)"},A.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t)))}const uf=xt("Close",A.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"})),ff=xt("Previous",A.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),gf=xt("Next",A.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),hf=xt("Loading",A.createElement(A.Fragment,null,Array.from({length:8}).map((e,t,r)=>A.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)`})))),pf=xt("Error",A.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"})),Vt=Vo()?A.useLayoutEffect:A.useEffect;function ea(){const[e,t]=A.useState(!1);return A.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 mf(e){let t=0,r=0,n=0;const a=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(a){const s=a[1].split(",").map(Dn);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 ta(e,t){const r=A.useRef(void 0),n=A.useRef(void 0),o=ea();return Vt(()=>{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(),mf(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 vl(){const e=A.useRef(null),t=A.useRef(void 0),[r,n]=A.useState();return{setContainerRef:A.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 $n(){const e=A.useRef(void 0),{setTimeout:t,clearTimeout:r}=cn();return A.useCallback((n,o)=>{r(e.current),e.current=t(n,o>0?o:0)},[t,r])}function Le(e){const t=A.useRef(e);return Vt(()=>{t.current=e}),A.useCallback((...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}function wl(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function ra(e,t){return A.useMemo(()=>e==null&&t==null?null:r=>{wl(e,r),wl(t,r)},[e,t])}function xl(e,t=!1){const r=A.useRef(!1);Vt(()=>{t&&r.current&&(r.current=!1,e())},[t,e]);const n=A.useCallback(()=>{r.current=!0},[]),o=A.useCallback(()=>{r.current=!1},[]);return{onFocus:n,onBlur:o}}function Fn(){const[e,t]=A.useState(!1);return Vt(()=>{t(window.getComputedStyle(window.document.documentElement).direction==="rtl")},[]),e}function kl(){const[e]=A.useState({}),t=A.useCallback((o,a)=>{var s;(s=e[o])===null||s===void 0||s.forEach(l=>{a.isPropagationStopped()||l(a)})},[e]),r=A.useMemo(()=>({onPointerDown:o=>t(Qs,o),onPointerMove:o=>t(Js,o),onPointerUp:o=>t(Rs,o),onPointerLeave:o=>t(el,o),onPointerCancel:o=>t(tl,o),onKeyDown:o=>t(Bo,o),onKeyUp:o=>t(Vu,o),onWheel:o=>t(Wo,o)}),[t]),n=A.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 Cl(e,t){const r=A.useRef(0),n=$n(),o=Le((...a)=>{r.current=Date.now(),e(a)});return A.useCallback((...a)=>{n(()=>{o(a)},t-(Date.now()-r.current))},[t,o,n])}const na=gr("slide"),oa=gr("slide_image");function mr({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,x,k;const[M,v]=A.useState(Mr),{publish:T}=Fr(),{setTimeout:I}=cn(),S=A.useRef(null);A.useEffect(()=>{t===0&&T(ln(M))},[t,M,T]);const N=Le(B=>{("decode"in B?B.decode():Promise.resolve()).catch(()=>{}).then(()=>{B.parentNode&&(v(sn),I(()=>{l?.(B)},0))})}),w=A.useCallback(B=>{S.current=B,B?.complete&&N(B)},[N]),y=A.useCallback(B=>{N(B.currentTarget)},[N]),E=Le(()=>{v(an),f?.()}),O=Yo(e,o),$=(B,Y)=>Number.isFinite(B)?B:Y,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=S.current)===null||u===void 0?void 0:u.naturalWidth)||0),L=$(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=S.current)===null||m===void 0?void 0:m.naturalHeight)||0),U=P&&L?{maxWidth:`min(${P}px, 100%)`,maxHeight:`min(${L}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},_=(x=e.srcSet)===null||x===void 0?void 0:x.sort((B,Y)=>B.width-Y.width).map(B=>`${B.src} ${B.width}w`).join(", "),b=()=>n&&!O&&e.width&&e.height?n.height/e.height*e.width:Number.MAX_VALUE,z=_&&n&&Vo()?`${Math.round(Math.min(b(),n.width))}px`:void 0,{style:F,className:G,...X}=a||{};return A.createElement(A.Fragment,null,A.createElement("img",{ref:w,onLoad:y,onError:E,onClick:s,draggable:!1,className:ht(ye(oa()),O&&ye(oa("cover")),M!==sn&&ye(oa("loading")),G),style:{...U,...h,...F},...X,alt:(k=e.alt)!==null&&k!==void 0?k:"",sizes:z,srcSet:_,src:e.src}),M!==sn&&A.createElement("div",{className:ye(na(Uu))},M===Mr&&(r?.iconLoading?r.iconLoading():A.createElement(hf,{className:ht(ye(In),ye(na(Mr)))})),M===an&&(r?.iconError?r.iconError():A.createElement(pf,{className:ht(ye(In),ye(na(an)))}))))}const bf=A.forwardRef(function({className:t,children:r,onFocus:n,onBlur:o,...a},s){const l=A.useRef(null),{trackFocusWithin:f}=Ro();return A.createElement(nf,{nodeRef:l},A.createElement("div",{ref:ra(s,l),className:ht(ye("root"),t),...f(n,o),...a},r))});var pt;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"})(pt||(pt={}));function _l(e,t,r,n,o){A.useEffect(()=>o?()=>{}:Pr(e(Qs,t),e(Js,r),e(Rs,n),e(el,n),e(tl,n)),[e,t,r,n,o])}var Kt;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"})(Kt||(Kt={}));const aa=30;function yf({disableSwipeNavigation:e,closeOnBackdropClick:t},r,n,o,a,s,l,f,h,c,i,u,g,p,m,x){const k=A.useRef(0),M=A.useRef([]),v=A.useRef(void 0),T=A.useRef(0),I=A.useRef(Kt.NONE),S=A.useCallback(P=>{v.current===P.pointerId&&(v.current=void 0,I.current=Kt.NONE);const L=M.current;L.splice(0,L.length,...L.filter(U=>U.pointerId!==P.pointerId))},[]),N=A.useCallback(P=>{S(P),P.persist(),M.current.push(P)},[S]),w=A.useCallback(P=>M.current.find(({pointerId:L})=>P.pointerId===L),[]),y=Le(P=>{N(P)}),E=(P,L)=>i&&P>L||c&&P<-L,O=Le(P=>{const L=w(P);if(L)if(v.current===P.pointerId){const U=Date.now()-T.current,_=k.current;I.current===Kt.SWIPE?Math.abs(_)>.3*o||Math.abs(_)>5&&U{const L=w(P);if(L){const U=v.current===P.pointerId;if(P.buttons===0){U&&k.current!==0?O(P):S(L);return}const _=P.clientX-L.clientX,b=P.clientY-L.clientY;if(v.current===void 0){const z=F=>{N(P),v.current=P.pointerId,T.current=Date.now(),I.current=F};Math.abs(_)>Math.abs(b)&&Math.abs(_)>aa&&n(_)?e||(z(Kt.SWIPE),s()):Math.abs(b)>Math.abs(_)&&E(b,aa)&&(z(Kt.PULL),u())}else U&&(I.current===Kt.SWIPE?(k.current=_,l(_)):I.current===Kt.PULL&&(k.current=b,g(b)))}});_l(r,y,$,O)}function vf({preventDefaultWheelX:e,preventDefaultWheelY:t}){const r=A.useRef(null),n=Le(o=>{const a=Math.abs(o.deltaX)>Math.abs(o.deltaY);(a&&e||!a&&t||o.ctrlKey)&&o.preventDefault()});return A.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 wf(e,t,r,n,o,a,s,l,f){const h=A.useRef(0),c=A.useRef(0),i=A.useRef(void 0),u=A.useRef(void 0),g=A.useRef(0),p=A.useRef(void 0),m=A.useRef(0),{setTimeout:x,clearTimeout:k}=cn(),M=A.useCallback(()=>{i.current&&(k(i.current),i.current=void 0)},[k]),v=A.useCallback(()=>{u.current&&(k(u.current),u.current=void 0)},[k]),T=Le(()=>{e!==pt.SWIPE&&(h.current=0,m.current=0,M(),v())});A.useEffect(T,[e,T]);const I=Le(N=>{u.current=void 0,h.current===N&&f(h.current)}),S=Le(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const w=y=>{g.current=y,k(p.current),p.current=y>0?x(()=>{g.current=0,p.current=void 0},300):void 0};if(e===pt.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){w(N.deltaX);return}if(!r(-N.deltaX))return;if(c.current+=N.deltaX,M(),Math.abs(c.current)>30)c.current=0,w(0),m.current=Date.now(),a();else{const y=c.current;i.current=x(()=>{i.current=void 0,y===c.current&&(c.current=0)},o)}}else if(e===pt.SWIPE){let y=h.current-N.deltaX;if(y=Math.min(Math.abs(y),n)*Math.sign(y),h.current=y,s(y),v(),Math.abs(y)>.2*n){w(N.deltaX),l(y,Date.now()-m.current);return}u.current=x(()=>I(y),2*o)}else w(N.deltaX)});A.useEffect(()=>t(Wo,S),[t,S])}const Sl=gr("container"),El=A.createContext(null),Yt=$t("useController","ControllerContext",El);function xf({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]=A.useState(),m=Ut(),x=af(),[k,M]=A.useState(pt.NONE),v=A.useRef(0),T=A.useRef(0),I=A.useRef(1),{registerSensors:S,subscribeSensors:N}=kl(),{subscribe:w,publish:y}=Fr(),E=$n(),O=$n(),$=$n(),{containerRef:P,setContainerRef:L,containerRect:U}=vl(),_=ra(vf({preventDefaultWheelX:i,preventDefaultWheelY:u}),L),b=A.useRef(null),z=ra(b,void 0),{getOwnerDocument:F}=$r(),G=Fn(),X=K=>(G?-1:1)*(typeof K=="number"?K:1),B=Le(()=>{var K;return(K=P.current)===null||K===void 0?void 0:K.focus()}),Y=Le(()=>t),H=Le(()=>m),W=A.useCallback(K=>y(nr,K),[y]),Q=A.useCallback(K=>y(or,K),[y]),be=A.useCallback(()=>y(Dr),[y]),se=K=>!(n.finite&&(X(K)>0&&m.currentIndex===0||X(K)<0&&m.currentIndex===m.slides.length-1)),pe=K=>{var oe;v.current=K,(oe=P.current)===null||oe===void 0||oe.style.setProperty(Xe("swipe_offset"),`${Math.round(K)}px`)},ne=K=>{var oe,ae;T.current=K,I.current=(()=>{const Ee=c&&K>0?K:h&&K<0?-K:0;return Math.min(Math.max(Ko(1-Ee/60*(1-.5),2),.5),1)})(),(oe=P.current)===null||oe===void 0||oe.style.setProperty(Xe("pull_offset"),`${Math.round(K)}px`),(ae=P.current)===null||ae===void 0||ae.style.setProperty(Xe("pull_opacity"),`${I.current}`)},{prepareAnimation:Ae}=ta(b,(K,oe,ae)=>{if(b.current&&U)return{keyframes:[{transform:`translate(0, ${K.rect.y-oe.y+ae.y}px)`,opacity:K.opacity},{transform:"translate(0, 0)",opacity:1}],duration:K.duration,easing:o.easing.fade}}),ve=(K,oe)=>{if(h||c){ne(K);let ae=0;b.current&&(ae=o.fade*(oe?2:1),Ae({rect:b.current.getBoundingClientRect(),opacity:I.current,duration:ae})),$(()=>{ne(0),M(pt.NONE)},ae),M(pt.ANIMATION),oe||be()}},{prepareAnimation:We,isAnimationPlaying:me}=ta(b,(K,oe,ae)=>{var ce;if(b.current&&U&&(!((ce=m.animation)===null||ce===void 0)&&ce.duration)){const ke=Pn(n.spacing),Ee=(ke.percent?ke.percent*U.width/100:ke.pixel)||0;return{keyframes:[{transform:`translate(${X(m.globalIndex-K.index)*(U.width+Ee)+K.rect.x-oe.x+ae.x}px, 0)`},{transform:"translate(0, 0)"}],duration:m.animation.duration,easing:m.animation.easing}}}),Te=Le(K=>{var oe,ae;const ce=K.offset||0,ke=ce?o.swipe:(oe=o.navigation)!==null&&oe!==void 0?oe:o.swipe,Ee=!ce&&!me()?o.easing.navigation:o.easing.swipe;let{direction:Be}=K;const Me=(ae=K.count)!==null&&ae!==void 0?ae:1;let Ke=pt.ANIMATION,Pe=ke*Me;if(!Be){const le=U?.width,de=K.duration||0,ue=le?ke/le*Math.abs(ce):ke;Me!==0?(de0?nr:or):Pe=ke/2}let q=0;Be===nr?se(X(1))?q=-Me:(Ke=pt.NONE,Pe=ke):Be===or&&(se(X(-1))?q=Me:(Ke=pt.NONE,Pe=ke)),Pe=Math.round(Pe),O(()=>{pe(0),M(pt.NONE)},Pe),b.current&&We({rect:b.current.getBoundingClientRect(),index:m.globalIndex}),M(Ke),y(jo,{type:"swipe",increment:q,duration:Pe,easing:Ee})});A.useEffect(()=>{var K,oe;!((K=m.animation)===null||K===void 0)&&K.increment&&(!((oe=m.animation)===null||oe===void 0)&&oe.duration)&&E(()=>x({type:"swipe",increment:0}),m.animation.duration)},[m.animation,x,E]);const ge=[N,se,U?.width||0,o.swipe,()=>M(pt.SWIPE),K=>pe(K),(K,oe)=>Te({offset:K,duration:oe,count:1}),K=>Te({offset:K,count:0})],Oe=[()=>{c&&M(pt.PULL)},K=>ne(K),K=>ve(K),K=>ve(K,!0)];yf(a,...ge,h,c,...Oe,be),wf(k,...ge);const we=Le(()=>{a.focus&&F().querySelector(`.${ye(zo)} .${ye(Sl())}`)&&B()});A.useEffect(we,[we]);const $e=Le(()=>{var K;(K=s.view)===null||K===void 0||K.call(s,{index:m.currentIndex})});A.useEffect($e,[m.globalIndex,$e]),A.useEffect(()=>Pr(w(nr,K=>Te({direction:nr,...K})),w(or,K=>Te({direction:or,...K})),w(jo,K=>x(K))),[w,Te,x]);const ze=A.useMemo(()=>({prev:W,next:Q,close:be,focus:B,slideRect:U?Zu(U,n.padding):{width:0,height:0},containerRect:U||{width:0,height:0},subscribeSensors:N,containerRef:P,setCarouselRef:z,toolbarWidth:g,setToolbarWidth:p}),[W,Q,be,B,N,U,P,z,g,p,n.padding]);return A.useImperativeHandle(a.ref,()=>({prev:W,next:Q,close:be,focus:B,getLightboxProps:Y,getLightboxState:H}),[W,Q,be,B,Y,H]),A.createElement("div",{ref:_,className:ht(ye(Sl()),ye(Ir)),style:{...k===pt.SWIPE?{[Xe("swipe_offset")]:`${Math.round(v.current)}px`}:null,...k===pt.PULL?{[Xe("pull_offset")]:`${Math.round(T.current)}px`,[Xe("pull_opacity")]:`${I.current}`}:null,...a.touchAction!=="none"?{[Xe("controller_touch_action")]:a.touchAction}:null,...l.container},tabIndex:-1,...S},U&&A.createElement(El.Provider,{value:ze},e,(r=f.controls)===null||r===void 0?void 0:r.call(f)))}const kf=Ft(rn,xf);function br(e){return fr(Ws,e)}function Tl(e){return fr(Go,e)}function Cf({slide:e,offset:t}){const r=A.useRef(null),{currentIndex:n,slides:o}=Ut(),{slideRect:a,focus:s}=Yt(),{render:l,carousel:{imageFit:f,imageProps:h},on:{click:c},styles:{slide:i},labels:u}=ct(),{getOwnerDocument:g}=$r(),p=t!==0;A.useEffect(()=>{var x;p&&(!((x=r.current)===null||x===void 0)&&x.contains(g().activeElement))&&s()},[p,s,g]);const m=()=>{var x,k,M,v;let T=(x=l.slide)===null||x===void 0?void 0:x.call(l,{slide:e,offset:t,rect:a});return!T&&pr(e)&&(T=A.createElement(mr,{slide:e,offset:t,render:l,rect:a,imageFit:f,imageProps:h,onClick:p?void 0:()=>c?.({index:n})})),T?A.createElement(A.Fragment,null,(k=l.slideHeader)===null||k===void 0?void 0:k.call(l,{slide:e}),((M=l.slideContainer)!==null&&M!==void 0?M:(({children:I})=>I))({slide:e,children:T}),(v=l.slideFooter)===null||v===void 0?void 0:v.call(l,{slide:e})):null};return A.createElement("div",{ref:r,className:ht(ye(Tl()),!p&&ye(Tl("current")),ye(Ir)),...Ru(p),style:i,role:"group","aria-roledescription":hr(u,"Slide"),"aria-label":sl(u,o,n+t)},m())}function _f(){const e=ct().styles.slide;return A.createElement("div",{className:ye(Go),style:e})}function Sf({carousel:e,labels:t}){const{slides:r,currentIndex:n,globalIndex:o}=Ut(),{setCarouselRef:a}=Yt(),{autoPlaying:s,focusWithin:l}=Ro(),f=Pn(e.spacing),h=Pn(e.padding),c=il(e,r,1),i=[];if(qo(r))for(let u=n-c;u<=n+c;u+=1){const g=Zo(r,u),p=o-n+u,m=e.finite&&(u<0||u>r.length-1);i.push(m?{key:p}:{key:[`${p}`,ll(g)].filter(Boolean).join("|"),offset:u-n,slide:g})}return A.createElement("div",{ref:a,className:ht(ye(br()),i.length>0&&ye(br("with_slides"))),style:{[`${Xe(br("slides_count"))}`]:i.length,[`${Xe(br("spacing_px"))}`]:f.pixel||0,[`${Xe(br("spacing_percent"))}`]:f.percent||0,[`${Xe(br("padding_px"))}`]:h.pixel||0,[`${Xe(br("padding_percent"))}`]:h.percent||0},role:"region","aria-live":s&&!l?"off":"polite","aria-roledescription":hr(t,"Carousel"),"aria-label":hr(t,"Photo gallery")},i.map(({key:u,slide:g,offset:p})=>g?A.createElement(Cf,{key:u,slide:g,offset:p}):A.createElement(_f,{key:u})))}const Ef=Ft(Ws,Sf);function Al(){const{carousel:e}=ct(),{slides:t,currentIndex:r}=Ut(),n=t.length===0||e.finite&&r===0,o=t.length===0||e.finite&&r===t.length-1;return{prevDisabled:n,nextDisabled:o}}function Nl(e){var t;const r=Fn(),{publish:n}=Fr(),{animation:o}=ct(),{prevDisabled:a,nextDisabled:s}=Al(),l=((t=o.navigation)!==null&&t!==void 0?t:o.swipe)/2,f=Cl(()=>n(nr),l),h=Cl(()=>n(or),l),c=Le(i=>{switch(i.key){case Ku:n(Dr);break;case Yu:(r?s:a)||(r?h:f)();break;case Xu:(r?a:s)||(r?f:h)();break}});A.useEffect(()=>e(Bo,c),[e,c])}function Ol({label:e,icon:t,renderIcon:r,action:n,onClick:o,disabled:a,style:s}){return A.createElement(Ur,{label:e,icon:t,renderIcon:r,className:ye(`navigation_${n}`),disabled:a,onClick:o,style:s,...xl(Yt().focus,a)})}function Tf({render:{buttonPrev:e,buttonNext:t,iconPrev:r,iconNext:n},styles:o}){const{prev:a,next:s,subscribeSensors:l}=Yt(),{prevDisabled:f,nextDisabled:h}=Al();return Nl(l),A.createElement(A.Fragment,null,e?e():A.createElement(Ol,{label:"Previous",action:nr,icon:ff,renderIcon:r,style:o.navigationPrev,disabled:f,onClick:a}),t?t():A.createElement(Ol,{label:"Next",action:or,icon:gf,renderIcon:n,style:o.navigationNext,disabled:h,onClick:s}))}const Af=Ft(Pu,Tf),Ml=ye(Bu),Nf=ye(qs);function Of(e){return"style"in e}function Il(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,`${(Dn(a)||0)+t}px`),()=>{s?e.style.setProperty(o,s):e.style.removeProperty(o)}}function Mf({noScroll:{disabled:e},children:t}){const r=Fn(),{getOwnerDocument:n,getOwnerWindow:o}=$r();return A.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(Il(l,h,r));const c=l.getElementsByTagName("*");for(let i=0;i{l.classList.remove(Ml),a.forEach(c=>c())}},[r,e,n,o]),A.createElement(A.Fragment,null,t)}const If=Ft(Lu,Mf);function Dl(e){return fr(zo,e)}function Pl(e,t,r){const n=e.getAttribute(t);return e.setAttribute(t,r),()=>{n?e.setAttribute(t,n):e.removeAttribute(t)}}function Df({children:e,animation:t,styles:r,className:n,on:o,portal:a,close:s,labels:l}){const[f,h]=A.useState(!1),[c,i]=A.useState(!1),u=A.useRef([]),g=A.useRef(null),{setTimeout:p}=cn(),{subscribe:m}=Fr(),k=ea()?0:t.fade;A.useEffect(()=>(h(!0),()=>{h(!1),i(!1)}),[]);const M=Le(()=>{u.current.forEach(S=>S()),u.current=[]}),v=Le(()=>{var S;i(!1),M(),(S=o.exiting)===null||S===void 0||S.call(o),p(()=>{var N;(N=o.exited)===null||N===void 0||N.call(o),s()},k)});A.useEffect(()=>m(Dr,v),[m,v]);const T=Le(S=>{var N,w,y;ef(S),i(!0),(N=o.entering)===null||N===void 0||N.call(o);const E=(y=(w=S.parentNode)===null||w===void 0?void 0:w.children)!==null&&y!==void 0?y:[];for(let O=0;O{var O,$;($=(O=g.current)===null||O===void 0?void 0:O.focus)===null||$===void 0||$.call(O)}),p(()=>{var O;(O=o.entered)===null||O===void 0||O.call(o)},k)}),I=A.useCallback(S=>{S?T(S):M()},[T,M]);return f?tr.createPortal(A.createElement(bf,{ref:I,className:ht(n,ye(Dl()),ye(qs),c&&ye(Dl("open"))),"aria-modal":!0,role:"dialog","aria-label":hr(l,"Lightbox"),style:{...t.fade!==Jo.animation.fade?{[Xe("fade_animation_duration")]:`${k}ms`}:null,...t.easing.fade!==Jo.animation.easing.fade?{[Xe("fade_animation_timing_function")]:t.easing.fade}:null,...r.root},onFocus:S=>{g.current||(g.current=S.relatedTarget)}},e),a.root||document.body):null}const Pf=Ft(zo,Df);function Lf({children:e}){return A.createElement(A.Fragment,null,e)}const $f=Ft($u,Lf);function Ff(e){return fr(Vs,e)}function Uf({toolbar:{buttons:e},render:{buttonClose:t,iconClose:r},styles:n}){const{close:o,setToolbarWidth:a}=Yt(),{setContainerRef:s,containerRect:l}=vl();Vt(()=>{a(l?.width)},[a,l?.width]);const f=()=>t?t():A.createElement(Ur,{key:Dr,label:"Close",icon:uf,renderIcon:r,onClick:o});return A.createElement("div",{ref:s,style:n.toolbar,className:ye(Ff())},e?.map(h=>h===Dr?f():h))}const zf=Ft(Vs,Uf);function Ll(e,t){var r;return A.createElement(e.module.component,{key:e.module.name,...t},(r=e.children)===null||r===void 0?void 0:r.map(n=>Ll(n,t)))}function Hf(e,t={}){const{easing:r,...n}=e,{easing:o,...a}=t;return{easing:{...r,...o},...n,...a}}function Gf({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:x,on:k,slides:M,index:v,plugins:T,...I}=Jo,{config:S,augmentation:N}=tf([it(Pf,[it(If,[it(kf,[it(Ef),it(zf),it(Af)])])])],l||T),w=N({animation:Hf(i,t),carousel:{...u,...e},render:{...g,...r},toolbar:{...p,...n},controller:{...m,...o},noScroll:{...x,...a},on:{...k,...s},...I,...c});return w.open?A.createElement(hl,{...w},A.createElement(lf,{slides:f||M,index:Dn(h||v)},A.createElement(cf,null,A.createElement(of,null,A.createElement(rf,null,Ll(it($f,S),w)))))):null}const jf={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1};function Bf(e){return Math.min(Math.max(e,Number.EPSILON),1)}function $l(e){const{minZoom:t,...r}={...jf,...e};return{minZoom:Bf(t),...r}}function Wf(e,t,r,n){const o=A.useRef(void 0),a=A.useRef(void 0),{zoom:s}=ct().animation,l=ea(),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 Vt(f,[e,t,r,f]),A.useCallback(()=>{a.current=n?.current?window.getComputedStyle(n.current).transform:void 0},[n])}function Vf(e,t){const{on:r}=ct(),n=Le(()=>{var o;t||(o=r.zoom)===null||o===void 0||o.call(r,{zoom:e})});A.useEffect(n,[e,n])}function Un(){const{zoom:e}=ct();return $l(e)}function Kf(e,t){var r,n;let o={width:0,height:0},a={width:0,height:0};const{currentSlide:s}=Ut(),{imageFit:l}=ct().carousel,{maxZoomPixelRatio:f}=Un();if(e&&s){const c={...s,...t};if(pr(c)){const i=Yo(c,l),u=Math.max(...(((r=c.srcSet)===null||r===void 0?void 0:r.map(p=>p.width))||[]).concat(c.width?[c.width]:[])),g=Math.max(...(((n=c.srcSet)===null||n===void 0?void 0:n.map(p=>p.height))||[]).concat(c.height?[c.height]:[]));u>0&&g>0&&e.width>0&&e.height>0&&(a=i?{width:Math.round(Math.min(u,e.width/e.height*g)),height:Math.round(Math.min(g,e.height/e.width*u))}:{width:u,height:g},a={width:a.width*f,height:a.height*f},o=i?{width:Math.min(e.width,a.width,u),height:Math.min(e.height,a.height,g)}:{width:Math.round(Math.min(e.width,e.height/g*u,u)),height:Math.round(Math.min(e.height,e.width/u*g,g))})}}const h=o.width?Math.max(Ko(a.width/o.width,5),1):1;return{imageRect:o,maxZoom:h}}function Fl(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function Ul(e,t,r=100,n=2){return e*Math.min(1+Math.abs(t/r),n)**Math.sign(t)}function Yf(e,t,r,n,o,a,s,l,f){const h=A.useRef([]),c=A.useRef(0),i=A.useRef(void 0),{globalIndex:u}=Ut(),{getOwnerWindow:g}=$r(),{containerRef:p,subscribeSensors:m}=Yt(),{keyboardMoveDistance:x,zoomInMultiplier:k,wheelZoomDistanceFactor:M,scrollToZoom:v,doubleTapDelay:T,doubleClickDelay:I,doubleClickMaxStops:S,pinchZoomDistanceFactor:N,pinchZoomV4:w}=Un(),y=A.useCallback(z=>{if(p.current){const{pageX:F,pageY:G}=z,{scrollX:X,scrollY:B}=g(),{left:Y,top:H,width:W,height:Q}=p.current.getBoundingClientRect();return[F-Y-X-W/2,G-H-B-Q/2]}return[]},[p,g]),E=Le(z=>{const{key:F,metaKey:G,ctrlKey:X}=z,B=G||X,Y=()=>{z.preventDefault(),z.stopPropagation()};if(e>1){const H=(W,Q)=>{Y(),l(W,Q)};F==="ArrowDown"?H(0,x):F==="ArrowUp"?H(0,-x):F==="ArrowLeft"?H(-x,0):F==="ArrowRight"&&H(x,0)}F==="+"||B&&F==="="?(Y(),o()):F==="-"||B&&F==="_"?(Y(),a()):B&&F==="0"&&(Y(),s(1))}),O=Le(z=>{if((z.ctrlKey||v)&&Math.abs(z.deltaY)>Math.abs(z.deltaX)){z.stopPropagation(),s(Ul(e,-z.deltaY,M),!0,...y(z));return}e>1&&(z.stopPropagation(),v||l(z.deltaX,z.deltaY))}),$=A.useCallback(z=>{const F=h.current;F.splice(0,F.length,...F.filter(G=>G.pointerId!==z.pointerId))},[]),P=A.useCallback(z=>{$(z),z.persist(),h.current.push(z)},[$]),L=Le(z=>{var F;const G=h.current;if(z.pointerType==="mouse"&&z.buttons>1||!(!((F=f?.current)===null||F===void 0)&&F.contains(z.target)))return;e>1&&z.stopPropagation();const{timeStamp:X}=z;if(G.length===0&&X-c.current<(z.pointerType==="touch"?T:I)){c.current=0;const B=e>=1?e!==r?e*Math.max(r**(1/S),k):1:e!==t?e/Math.max(t**(-1/S),k):1;s(B,!1,...y(z))}else c.current=X;if(P(z),G.length===2){const B=Fl(G[0],G[1]);i.current={previousDistance:B,initialDistance:Math.max(B,1),initialZoom:e}}}),U=Le(z=>{const F=h.current,G=F.find(X=>X.pointerId===z.pointerId);if(F.length===2&&i.current){z.stopPropagation(),P(z);const X=Fl(F[0],F[1]),B=w?i.current.initialZoom/i.current.initialDistance*X:Ul(e,X-i.current.previousDistance,N);s(B,!0,...F.map(Y=>y(Y)).reduce((Y,H)=>H.map((W,Q)=>Y[Q]+W/2))),i.current.previousDistance=X;return}e>1&&(z.stopPropagation(),G&&(F.length===1&&l((G.clientX-z.clientX)/e,(G.clientY-z.clientY)/e),P(z)))}),_=A.useCallback(z=>{const F=h.current;F.length===2&&F.find(G=>G.pointerId===z.pointerId)&&(i.current=void 0),$(z)},[$]),b=A.useCallback(()=>{const z=h.current;z.splice(0,z.length),c.current=0,i.current=void 0},[]);_l(m,L,U,_,n),A.useEffect(b,[u,b]),A.useEffect(()=>n?()=>{}:Pr(b,m(Bo,E),m(Wo,O)),[n,m,b,E,O])}function Xf(e,t,r){const[n,o]=A.useState(1),[a,s]=A.useState(0),[l,f]=A.useState(0),h=Wf(n,a,l,r),{currentSlide:c,globalIndex:i}=Ut(),{containerRect:u,slideRect:g}=Yt(),{minZoom:p,zoomInMultiplier:m}=Un(),x=c&&pr(c)?c.src:void 0,k=!x||!r?.current;Vt(()=>{o(1),s(0),f(0)},[i,x]);const M=A.useCallback((N,w,y)=>{const E=y||n,O=a-(N||0),$=l-(w||0),P=(e.width*E-g.width)/2/E,L=(e.height*E-g.height)/2/E;s(Math.min(Math.abs(O),Math.max(P,0))*Math.sign(O)),f(Math.min(Math.abs($),Math.max(L,0))*Math.sign($))},[n,a,l,g,e.width,e.height]),v=A.useCallback((N,w,y,E)=>{const O=Ko(N+.01p?N:p:t,5);w||h(),M(y?y*(1/n-1/O):0,E?E*(1/n-1/O):0,O),o(O)},[n,p,t,M,h]),T=Le(()=>{n>1&&(n>t&&v(t,!0),M())});Vt(T,[u.width,u.height,T]);const I=A.useCallback(()=>{const N=n*m;v(n<1&&N>1?1:N)},[n,m,v]),S=A.useCallback(()=>{const N=n/m;v(n>1&&N<1?1:N)},[n,m,v]);return{zoom:n,offsetX:a,offsetY:l,disabled:k,changeOffsets:M,changeZoom:v,zoomIn:I,zoomOut:S}}const zl=A.createContext(null),sa=$t("useZoom","ZoomControllerContext",zl);function qf({children:e}){const[t,r]=A.useState(),{slideRect:n}=Yt(),{ref:o,minZoom:a}=Un(),{imageRect:s,maxZoom:l}=Kf(n,t?.imageDimensions),{zoom:f,offsetX:h,offsetY:c,disabled:i,changeZoom:u,changeOffsets:g,zoomIn:p,zoomOut:m}=Xf(s,l,t?.zoomWrapperRef);Vf(f,i),Yf(f,a,l,i,p,m,u,g,t?.zoomWrapperRef);const x=A.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]);A.useImperativeHandle(o,()=>x,[x]);const k=A.useMemo(()=>({...x,setZoomWrapper:r}),[x,r]);return A.createElement(zl.Provider,{value:k},e)}const Zf=xt("ZoomIn",A.createElement(A.Fragment,null,A.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"}),A.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),Qf=xt("ZoomOut",A.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"})),Hl=A.forwardRef(function({zoomIn:t,onLoseFocus:r},n){const o=A.useRef(!1),a=A.useRef(!1),{zoom:s,minZoom:l,maxZoom:f,zoomIn:h,zoomOut:c,disabled:i}=sa(),{render:u}=ct(),g=i||(t?s>=f:s<=l);return A.useEffect(()=>{g&&o.current&&a.current&&r(),g||(o.current=!0)},[g,r]),A.createElement(Ur,{ref:n,disabled:g,label:t?"Zoom in":"Zoom out",icon:t?Zf:Qf,renderIcon:t?u.iconZoomIn:u.iconZoomOut,onClick:t?h:c,onFocus:()=>{a.current=!0},onBlur:()=>{a.current=!1}})});function Jf(){const e=A.useRef(null),t=A.useRef(null),{focus:r}=Yt(),n=A.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=A.useCallback(()=>n(e),[n]),a=A.useCallback(()=>n(t),[n]);return A.createElement(A.Fragment,null,A.createElement(Hl,{zoomIn:!0,ref:e,onLoseFocus:a}),A.createElement(Hl,{ref:t,onLoseFocus:o}))}function Rf(){const{render:e}=ct(),t=sa();return e.buttonZoom?A.createElement(A.Fragment,null,e.buttonZoom(t)):A.createElement(Jf,null)}function eg(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function tg({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(ol)}}function rg(e){var t,r;const[{current:n,preload:o},a]=A.useReducer(tg,{}),{slide:s,rect:l,imageFit:f,render:h,interactive:c}=e,i=s.srcSet.sort((I,S)=>I.width-S.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=Yo(s,f),m=Math.max(...i.map(I=>I.width)),x=Math.min((p?Math.max:Math.min)(l.width,u*(l.height/g)),m),k=Qu(),M=Le(()=>{var I;const S=(I=i.find(N=>N.width>=x*k))!==null&&I!==void 0?I:i[i.length-1];(!n||i.findIndex(N=>N.src===n)N===S))&&a({type:"fetch",source:S.src})});Vt(M,[l.width,l.height,k,M]);const v=Le(I=>a({type:"done",source:I})),T={WebkitTransform:c?"initial":"translateZ(0)"};return p||Object.assign(T,l.width/l.heightv(o),render:{...h,iconLoading:()=>null,iconError:()=>null}}),n&&A.createElement(mr,{key:"current",...e,slide:{...s,src:n,srcSet:void 0},style:T}))}function ng({render:e,slide:t,offset:r,rect:n}){var o;const[a,s]=A.useState(),l=A.useRef(null),{zoom:f,maxZoom:h,offsetX:c,offsetY:i,setZoomWrapper:u}=sa(),g=f>1,{carousel:p,on:m}=ct(),{currentIndex:x}=Ut();Vt(()=>r===0?(u({zoomWrapperRef:l,imageDimensions:a}),()=>u(void 0)):()=>{},[r,a,u]);let k=(o=e.slide)===null||o===void 0?void 0:o.call(e,{slide:t,offset:r,rect:n,zoom:f,maxZoom:h});if(!k&&pr(t)){const M={slide:t,offset:r,rect:n,render:e,imageFit:p.imageFit,imageProps:p.imageProps,onClick:r===0?()=>{var v;return(v=m.click)===null||v===void 0?void 0:v.call(m,{index:x})}:void 0};k=eg(t)?A.createElement(rg,{...M,slide:t,interactive:g,rect:r===0?{width:n.width*f,height:n.height*f}:n}):A.createElement(mr,{onLoad:v=>s({width:v.naturalWidth,height:v.naturalHeight}),...M})}return k?A.createElement("div",{ref:l,className:ht(ye(Xs),ye(Ir),ye(Zs),g&&ye(Wu)),style:r===0?{transform:`scale(${f}) translateX(${c}px) translateY(${i}px)`}:void 0},k):null}const og=({augment:e,addModule:t})=>{e(({zoom:r,toolbar:n,render:o,controller:a,...s})=>{const l=$l(r);return{zoom:l,toolbar:Ln(n,Ys,A.createElement(Rf,null)),render:{...o,slide:f=>{var h;return pr(f.slide)?A.createElement(ng,{render:o,...f}):(h=o.slide)===null||h===void 0?void 0:h.call(o,f)}},controller:{...a,preventDefaultWheelY:l.scrollToZoom},...s}}),t(Ft(Ys,qf))},ag={separator:"/",container:{}},Gl=e=>({...ag,...e});function sg({counter:e}){const{slides:t,currentIndex:r}=Ut(),{separator:n,container:{className:o,...a},className:s,...l}=Gl(e);return t.length===0?null:A.createElement("div",{className:ht(ye("counter"),o||s),...l,...a,"aria-hidden":!0},r+1," ",n," ",t.length)}function lg({augment:e,addChild:t}){e(({counter:r,...n})=>({counter:Gl(r),...n})),t(rn,Ft(Fu,sg))}const ig={autoplay:!1,delay:3e3,ref:null},jl=e=>({...ig,...e}),Bl=A.createContext(null),cg=$t("useSlideshow","SlideshowContext",Bl);function dg({slideshow:e,carousel:{finite:t},on:r,children:n}){const{autoplay:o,delay:a,ref:s}=jl(e),l=A.useRef(o),[f,h]=A.useState(o),c=A.useRef(void 0),i=A.useRef(void 0),{slides:u,currentIndex:g}=Ut(),{setTimeout:p,clearTimeout:m}=cn(),{subscribe:x}=Fr(),{next:k}=Yt(),{setAutoPlaying:M}=Ro();A.useEffect(()=>M(f),[f,M]);const v=u.length===0||t&&g===u.length-1,T=A.useCallback(()=>{!f&&!v&&h(!0)},[f,v]),I=A.useCallback(()=>{f&&h(!1)},[f]),S=A.useCallback(()=>{m(c.current),c.current=void 0},[m]),N=Le(()=>{S(),!(!f||v||i.current===Mr||i.current===Ho)&&(c.current=p(()=>{f&&(i.current=void 0,k())},a))});A.useEffect(N,[g,f,N]),A.useEffect(()=>{f&&v&&h(!1)},[g,f,v]);const w=Le(()=>{var O;return(O=r.slideshowStart)===null||O===void 0?void 0:O.call(r)}),y=Le(()=>{var O;return(O=r.slideshowStop)===null||O===void 0?void 0:O.call(r)});A.useEffect(()=>{f?w():l.current&&y(),l.current=f},[f,w,y]),A.useEffect(()=>Pr(S,x(zu,()=>{i.current=Mr,S()}),x(Hu,()=>{i.current=Ho,S()}),x(Gu,()=>{i.current=an,N()}),x(ju,()=>{i.current=sn,N()})),[x,S,N]);const E=A.useMemo(()=>({playing:f,disabled:v,play:T,pause:I}),[f,v,T,I]);return A.useImperativeHandle(s,()=>E,[E]),A.createElement(Bl.Provider,{value:E},n)}const ug=xt("Play",A.createElement("path",{d:"M8 5v14l11-7z"})),fg=xt("Pause",A.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function gg(){const{playing:e,disabled:t,play:r,pause:n}=cg(),{render:o}=ct(),a=xl(Yt().focus,t);return o.buttonSlideshow?A.createElement(A.Fragment,null,o.buttonSlideshow({playing:e,disabled:t,play:r,pause:n})):A.createElement(Ur,{label:e?"Pause":"Play",icon:e?fg:ug,renderIcon:e?o.iconSlideshowPause:o.iconSlideshowPlay,onClick:e?n:r,disabled:t,...a})}function hg({augment:e,addModule:t}){e(({slideshow:r,toolbar:n,...o})=>({toolbar:Ln(n,Ks,A.createElement(gg,null)),slideshow:jl(r),...o})),t(Ft(Ks,dg))}const pg={auto:!1,ref:null},Wl=e=>({...pg,...e}),Vl=A.createContext(null),mg=$t("useFullscreen","FullscreenContext",Vl);function bg({fullscreen:e,on:t,children:r}){const{auto:n,ref:o}=Wl(e),a=A.useRef(null),[s,l]=A.useState(),[f,h]=A.useState(!1),c=A.useRef(!1),{getOwnerDocument:i}=$r();Vt(()=>{var v,T,I,S;const N=i();l(!((S=(I=(T=(v=N.fullscreenEnabled)!==null&&v!==void 0?v:N.webkitFullscreenEnabled)!==null&&T!==void 0?T:N.mozFullScreenEnabled)!==null&&I!==void 0?I:N.msFullscreenEnabled)!==null&&S!==void 0&&S))},[i]);const u=A.useCallback(()=>{var v;const T=i(),I=T.fullscreenElement||T.webkitFullscreenElement||T.mozFullScreenElement||T.msFullscreenElement;return((v=I?.shadowRoot)===null||v===void 0?void 0:v.fullscreenElement)||I},[i]),g=A.useCallback(()=>{const v=a.current;try{v.requestFullscreen?v.requestFullscreen().catch(()=>{}):v.webkitRequestFullscreen?v.webkitRequestFullscreen():v.mozRequestFullScreen?v.mozRequestFullScreen():v.msRequestFullscreen&&v.msRequestFullscreen()}catch{}},[]),p=A.useCallback(()=>{if(!u())return;const v=i();try{v.exitFullscreen?v.exitFullscreen().catch(()=>{}):v.webkitExitFullscreen?v.webkitExitFullscreen():v.mozCancelFullScreen?v.mozCancelFullScreen():v.msExitFullscreen&&v.msExitFullscreen()}catch{}},[u,i]);A.useEffect(()=>{const v=i(),T=()=>{h(u()===a.current)};return Pr(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(I=>(v.addEventListener(I,T),()=>v.removeEventListener(I,T))))},[u,i]);const m=Le(()=>{var v;return(v=t.enterFullscreen)===null||v===void 0?void 0:v.call(t)}),x=Le(()=>{var v;return(v=t.exitFullscreen)===null||v===void 0?void 0:v.call(t)});A.useEffect(()=>{f&&(c.current=!0),c.current&&(f?m:x)()},[f,m,x]);const k=Le(()=>{var v;return(v=n?g:null)===null||v===void 0||v(),p});A.useEffect(k,[k]);const M=A.useMemo(()=>({fullscreen:f,disabled:s,enter:g,exit:p}),[f,s,g,p]);return A.useImperativeHandle(o,()=>M,[M]),A.createElement("div",{ref:a,className:ht(ye(nn),ye(Xs))},A.createElement(Vl.Provider,{value:M},r))}const yg=xt("EnterFullscreen",A.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),vg=xt("ExitFullscreen",A.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function wg(){var e;const{fullscreen:t,disabled:r,enter:n,exit:o}=mg(),{render:a}=ct();return r?null:a.buttonFullscreen?A.createElement(A.Fragment,null,(e=a.buttonFullscreen)===null||e===void 0?void 0:e.call(a,{fullscreen:t,disabled:r,enter:n,exit:o})):A.createElement(Ur,{disabled:r,label:t?"Exit Fullscreen":"Enter Fullscreen",icon:t?vg:yg,renderIcon:t?a.iconExitFullscreen:a.iconEnterFullscreen,onClick:t?o:n})}function xg({augment:e,contains:t,addParent:r}){e(({fullscreen:n,toolbar:o,...a})=>({toolbar:Ln(o,nn,A.createElement(wg,null)),fullscreen:Wl(n),...a})),r(t(on)?on:rn,Ft(nn,bg))}const yr={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},la=e=>({...yr,...e});function Kl(){const{thumbnails:e}=ct();return la(e)}const vr=e=>fr(on,e),dt=e=>vr(fr("thumbnail",e)),kg=xt("VideoThumbnail",A.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"})),Cg=xt("UnknownThumbnail",A.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 _g({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 A.createElement(mr,{slide:{src:e.thumbnail},...s});if(pr(e))return A.createElement(mr,{slide:e,...s});const l=ye(dt(In));return e.type==="video"?A.createElement(A.Fragment,null,e.poster&&A.createElement(mr,{slide:{src:e.poster},...s}),A.createElement(kg,{className:l})):A.createElement(Cg,{className:l})}const Sg=gr("active"),ia=gr("fadein"),ca=gr("fadeout"),Eg=gr("placeholder"),Yl="delay",Xl="duration";function Tg({slide:e,index:t,onClick:r,fadeIn:n,fadeOut:o,placeholder:a,onLoseFocus:s}){const l=A.useRef(null),{render:f,styles:h,labels:c}=ct(),{slides:i,globalIndex:u}=Ut(),{getOwnerDocument:g}=$r(),{width:p,height:m,imageFit:x}=Kl(),k={width:p,height:m},M=t===u,v=Le(s);return A.useEffect(()=>{o&&g().activeElement===l.current&&v()},[o,v,g]),A.createElement("button",{ref:l,type:"button",className:ht(ye(Ir),ye(dt()),M&&ye(dt(Sg())),n&&ye(dt(ia())),o&&ye(dt(ca())),a&&ye(dt(Eg()))),style:{...n?{[Xe(dt(ia(Xl)))]:`${n.duration}ms`,[Xe(dt(ia(Yl)))]:`${n.delay}ms`}:null,...o?{[Xe(dt(ca(Xl)))]:`${o.duration}ms`,[Xe(dt(ca(Yl)))]:`${o.delay}ms`}:null,...h.thumbnail},onClick:r,"aria-current":M?!0:void 0,"aria-label":sl(c,i,t)},e&&_g({slide:e,render:f,rect:k,imageFit:x}))}function ql(e){return["top","bottom"].includes(e)}function Zl(e,t){return t+2*(e.border+e.padding)+e.gap}function Ag(e){const{thumbnail:t,poster:r}=e||{thumbnail:"placeholder"};return typeof t=="string"&&t||typeof r=="string"&&r||e&&ll(e)||void 0}function Ql({visible:e,containerRef:t}){const r=A.useRef(null),n=Fn(),{publish:o,subscribe:a}=Fr(),{carousel:s,styles:l,labels:f}=ct(),{slides:h,globalIndex:c,animation:i}=Ut(),{registerSensors:u,subscribeSensors:g}=kl();Nl(g);const p=Kl(),{position:m,width:x,height:k,border:M,borderStyle:v,borderColor:T,borderRadius:I,padding:S,gap:N,vignette:w}=p,y=i?.duration!==void 0&&i?.increment||0,E=i?.duration||0,{prepareAnimation:O}=ta(r,_=>({keyframes:ql(m)?[{transform:`translateX(${(n?-1:1)*Zl(p,x)*y+_}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${Zl(p,k)*y+_}px)`},{transform:"translateY(0)"}],duration:E,easing:i?.easing})),$=Le(()=>{let _=0;if(t.current&&r.current){const b=t.current.getBoundingClientRect(),z=r.current.getBoundingClientRect();_=ql(m)?z.left-b.left-(b.width-z.width)/2:z.top-b.top-(b.height-z.height)/2}O(_)});A.useEffect(()=>Pr(a(jo,$)),[a,$]);const P=il(s,h),L=[];if(qo(h))for(let _=c-P-Math.abs(y);_<=c+P+Math.abs(y);_+=1){const z=s.finite&&(_<0||_>h.length-1)||y<0&&_0&&_>c+P?null:Zo(h,_),F=[`${_}`,Ag(z)].filter(Boolean).join("|");L.push({key:F,index:_,slide:z})}const U=_=>()=>{_>c?o(or,{count:_-c}):_{const F=E/Math.abs(y||1),G=y>0&&b>c+P-y&&b<=c+P||y<0&&b=c-P?{duration:F,delay:((y>0?b-(c+P-y):c-P-y-b)-1)*F}:void 0,X=y>0&&bc+P?{duration:F,delay:(y>0?y-(c-P-b):-y-(b-(c+P)))*F}:void 0;return A.createElement(Tg,{key:_,index:b,slide:z,fadeIn:G,fadeOut:X,placeholder:!z,onClick:U(b),onLoseFocus:()=>{var B;return(B=r.current)===null||B===void 0?void 0:B.focus()}})})),w&&A.createElement("div",{className:ye(vr("vignette"))}))}const Jl=A.createContext(null),Ng=$t("useThumbnails","ThumbnailsContext",Jl);function Og({children:e,...t}){const{ref:r,position:n,hidden:o}=la(t.thumbnails),[a,s]=A.useState(!o),l=A.useRef(null),f=A.useMemo(()=>({visible:a,show:()=>s(!0),hide:()=>s(!1)}),[a]);return A.useImperativeHandle(r,()=>f,[f]),A.createElement(hl,{...t},A.createElement(Jl.Provider,{value:f},A.createElement("div",{ref:l,className:ht(ye(vr()),ye(vr(`${n}`)))},["start","top"].includes(n)&&A.createElement(Ql,{containerRef:l,visible:a}),A.createElement("div",{className:ye(vr("wrapper"))},e),["end","bottom"].includes(n)&&A.createElement(Ql,{containerRef:l,visible:a}))))}const Rl=()=>A.createElement(A.Fragment,null,A.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),A.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),Mg=xt("ThumbnailsVisible",Rl()),Ig=df("ThumbnailsHidden",Rl());function Dg(){const{visible:e,show:t,hide:r}=Ng(),{render:n}=ct();return n.buttonThumbnails?A.createElement(A.Fragment,null,n.buttonThumbnails({visible:e,show:t,hide:r})):A.createElement(Ur,{label:e?"Hide thumbnails":"Show thumbnails",icon:e?Mg:Ig,renderIcon:e?n.iconThumbnailsVisible:n.iconThumbnailsHidden,onClick:e?r:t})}function Pg({augment:e,contains:t,append:r,addParent:n}){e(({thumbnails:a,toolbar:s,...l})=>{const f=la(a);return{toolbar:Ln(s,on,f.showToggle?A.createElement(Dg,null):null),thumbnails:f,...l}});const o=Ft(on,Og);t(nn)?r(nn,o):n(rn,o)}const It=({className:e="",children:t,style:r,...n})=>d.jsx("i",{className:e,style:r,...n,children:t}),da=e=>{if(!e||typeof window>"u"||!window.location||!/^(https?:)?\/\//i.test(e))return!1;try{return new URL(e,window.location.href).origin!==window.location.origin}catch{return!1}},ua=window.G7Core,zn=(e,t)=>ua?.t?.(e,t)??e,Lg=async(e,t)=>{try{const r=await ua.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),ua?.toast?.error?.(zn("common.download_failed"))}},$g=(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)},ei=async e=>{const t=e.downloadUrl||e.src,r=e.filename||e.title||"image";e.downloadRequiresAuth&&!da(t)?await Lg(t,r):$g(t,r)},Fg=({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 ei(e)}finally{o(!1)}};return d.jsx(R,{type:"button",onClick:a,disabled:n,className:"yarl__button flex items-center justify-center","aria-label":zn("common.download"),title:zn("common.download"),children:n?d.jsx(It,{className:"fa-solid fa-spinner fa-spin text-white"}):d.jsx(It,{className:"fa-solid fa-download text-white"})})},zr=({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),x=e.map(v=>({src:v.src,title:v.title,description:v.description})),k=[];o&&k.push(og),a&&k.push(hg),s&&k.push(xg),l&&k.push(lg),h&&k.push(Pg);const M=e[g];if(C.useEffect(()=>{m.current=g},[g]),i){const v=(e??[]).slice(0,4);return d.jsx(j,{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:v.length>0?v.map((T,I)=>d.jsx(jt,{src:T.thumbnail||T.src,alt:T.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},I)):d.jsxs(j,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[d.jsx(It,{className:"fa-regular fa-images mr-2"}),zn("editor.component.image_gallery")]})})}return d.jsx(Gf,{open:t,close:r,slides:x,index:g,plugins:k,on:{view:({index:v})=>{v!==m.current&&p(v)}},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(Fg,{image:M,index:g,onDownload:c},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},ti=()=>{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}}};zr.displayName="ImageGallery";const ri=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:zr,default:zr,executeImageDownload:ei,useImageGallery:ti},Symbol.toStringTag,{value:"Module"})),Ug=window.G7Core,fa=(e,t)=>Ug?.t?.(e,t)??e,Hn=e=>e.url??e.download_url,Gn=({images:e=[],className:t="",id:r,editorAttrs:n})=>{const[o,a]=C.useState(0),{openGallery:s,galleryProps:l}=ti(),f=C.useMemo(()=>e.map(c=>({src:Hn(c),title:c.alt_text_current??"",thumbnail:Hn(c),downloadUrl:c.download_url,filename:c.alt_text_current??`image-${c.id}`})),[e]);if(!e||e.length===0)return d.jsx(j,{className:`flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-lg aspect-square ${t}`,id:r,...n,children:d.jsxs(j,{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(j,{className:"text-sm",children:fa("shop.no_image")})]})});const h=e[o]??e[0];return d.jsxs(j,{id:r,className:t,...n,children:[d.jsx(j,{className:"relative overflow-hidden rounded-lg bg-gray-100 dark:bg-gray-700 aspect-square mb-3",children:d.jsx(R,{type:"button",className:"w-full h-full cursor-zoom-in block",onClick:()=>s(f,o),"aria-label":fa("shop.view_image"),children:d.jsx(jt,{src:Hn(h),alt:h.alt_text_current??"",className:"w-full h-full object-contain"})})}),e.length>1&&d.jsx(j,{className:"flex gap-2 overflow-x-auto pb-1",children:e.map((c,i)=>d.jsx(R,{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??`${fa("shop.image")} ${i+1}`,children:d.jsx(jt,{src:Hn(c),alt:c.alt_text_current??"",className:"w-full h-full object-cover"})},c.id))}),d.jsx(zr,{...l})]})};Gn.displayName="ProductImageViewer";const zg=Object.freeze(Object.defineProperty({__proto__:null,ProductImageViewer:Gn,default:Gn},Symbol.toStringTag,{value:"Module"})),ni=({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{const M=parseInt(k.target.value,10);if(!isNaN(M)){const v=Math.max(t,Math.min(r,M));n(v)}},p=k=>{const M=parseInt(k.target.value,10);isNaN(M)||Mr&&n(r)},m=a||e<=t,x=a||e>=r;return d.jsxs(j,{className:`inline-flex items-center border border-gray-300 dark:border-gray-600 rounded-lg ${c.container} ${s}`,id:l,...f,children:[d.jsx(R,{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(At,{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(R,{type:"button",onClick:u,disabled:x,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"})})]})},Hg=Object.freeze(Object.defineProperty({__proto__:null,default:ni},Symbol.toStringTag,{value:"Module"})),Gg=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)},oi=(e,t)=>window.G7Core?.t?.(e,t)??e,jg=[{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"}],ai=({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){Gg.error("리액션 오류:",g)}};return d.jsx(j,{className:`flex flex-wrap gap-2 ${a}`,id:s,...l,children:jg.map(u=>{const g=c(u.type),p=t===u.type;return d.jsxs(R,{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:oi(u.labelKey),children:[d.jsx(te,{className:h[o],children:u.emoji}),d.jsx(te,{children:oi(u.labelKey)}),g>0&&d.jsx(te,{className:"font-medium",children:g})]},u.type)})})},Bg=Object.freeze(Object.defineProperty({__proto__:null,default:ai},Symbol.toStringTag,{value:"Module"})),jn=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)},Pt=(e,t)=>window.G7Core?.t?.(e,t)??e,si=({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,w]=C.useState(!1),[k,M]=C.useState("");C.useEffect(()=>{c.current&&!c.current.innerHTML&&(c.current.innerHTML=t)},[t]),C.useEffect(()=>{n&&n(i)},[i,n]);const v=E=>{jn.log("Apply format:",E)},T=async E=>{const O=new FormData;O.append("file",E);try{const $=await fetch(o,{method:"POST",body:O,credentials:"include"});if(!$.ok)throw new Error("업로드 실패");const D=await $.json();jn.log("Image uploaded:",D.url)}catch($){jn.error("이미지 업로드 오류:",$)}},I=E=>{const O=E.target.files?.[0];O&&T(O)},S=()=>{k&&(jn.log("Insert link:",k),w(!1),M(""))},N=[{format:"bold",icon:"B",title:Pt("editor.toolbar.bold")},{format:"italic",icon:"I",title:Pt("editor.toolbar.italic")},{format:"underline",icon:"U",title:Pt("editor.toolbar.underline")},{format:"strike",icon:"S",title:Pt("editor.toolbar.strike")},{format:"code",icon:"",title:Pt("editor.toolbar.code")}],x=[{format:"h1",label:"H1"},{format:"h2",label:"H2"},{format:"h3",label:"H3"}],y=[{format:"bulletList",icon:"•",title:Pt("editor.toolbar.bullet_list")},{format:"orderedList",icon:"1.",title:Pt("editor.toolbar.ordered_list")},{format:"blockquote",icon:"❝",title:Pt("editor.toolbar.blockquote")}];return d.jsxs(j,{className:`border border-gray-300 dark:border-gray-600 rounded-lg overflow-hidden ${l}`,id:f,...h,children:[d.jsxs(j,{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(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:N.map(E=>d.jsx(R,{type:"button",onClick:()=>v(E.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:E.title,children:E.icon},E.format))}),d.jsx(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:x.map(E=>d.jsx(R,{type:"button",onClick:()=>v(E.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:E.label},E.format))}),d.jsx(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:y.map(E=>d.jsx(R,{type:"button",onClick:()=>v(E.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:E.title,children:E.icon},E.format))}),d.jsxs(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:[d.jsx(R,{type:"button",onClick:()=>w(!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:Pt("editor.toolbar.link"),children:"🔗"}),d.jsxs(Ar,{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(At,{type:"file",accept:"image/*",onChange:I,disabled:s,className:"hidden"})]})]}),d.jsxs(R,{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:["",Pt("editor.toolbar.code_view")]})]}),g?d.jsx(ko,{value:i,onChange:E=>u(E.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(j,{ref:c,contentEditable:!s,onInput:E=>u(E.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(At,{type:"hidden",name:e,value:i}),m&&d.jsx(j,{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:d.jsxs(j,{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-96",children:[d.jsx(Tn,{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:Pt("editor.link_modal.title")}),d.jsx(At,{type:"url",value:k,onChange:E=>M(E.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(j,{className:"flex justify-end gap-2",children:[d.jsx(R,{type:"button",onClick:()=>{w(!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:Pt("common.cancel")}),d.jsx(R,{type:"button",onClick:S,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:Pt("editor.link_modal.insert")})]})]})})]})},Wg=Object.freeze(Object.defineProperty({__proto__:null,default:si},Symbol.toStringTag,{value:"Module"})),ga=({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=` + `,title:oi(u.labelKey),children:[d.jsx(te,{className:h[o],children:u.emoji}),d.jsx(te,{children:oi(u.labelKey)}),g>0&&d.jsx(te,{className:"font-medium",children:g})]},u.type)})})},Bg=Object.freeze(Object.defineProperty({__proto__:null,default:ai},Symbol.toStringTag,{value:"Module"})),jn=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)},Dt=(e,t)=>window.G7Core?.t?.(e,t)??e,si=({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,x]=C.useState(!1),[k,M]=C.useState("");C.useEffect(()=>{c.current&&!c.current.innerHTML&&(c.current.innerHTML=t)},[t]),C.useEffect(()=>{n&&n(i)},[i,n]);const v=E=>{jn.log("Apply format:",E)},T=async E=>{const O=new FormData;O.append("file",E);try{const $=await fetch(o,{method:"POST",body:O,credentials:"include"});if(!$.ok)throw new Error("업로드 실패");const P=await $.json();jn.log("Image uploaded:",P.url)}catch($){jn.error("이미지 업로드 오류:",$)}},I=E=>{const O=E.target.files?.[0];O&&T(O)},S=()=>{k&&(jn.log("Insert link:",k),x(!1),M(""))},N=[{format:"bold",icon:"B",title:Dt("editor.toolbar.bold")},{format:"italic",icon:"I",title:Dt("editor.toolbar.italic")},{format:"underline",icon:"U",title:Dt("editor.toolbar.underline")},{format:"strike",icon:"S",title:Dt("editor.toolbar.strike")},{format:"code",icon:"",title:Dt("editor.toolbar.code")}],w=[{format:"h1",label:"H1"},{format:"h2",label:"H2"},{format:"h3",label:"H3"}],y=[{format:"bulletList",icon:"•",title:Dt("editor.toolbar.bullet_list")},{format:"orderedList",icon:"1.",title:Dt("editor.toolbar.ordered_list")},{format:"blockquote",icon:"❝",title:Dt("editor.toolbar.blockquote")}];return d.jsxs(j,{className:`border border-gray-300 dark:border-gray-600 rounded-lg overflow-hidden ${l}`,id:f,...h,children:[d.jsxs(j,{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(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:N.map(E=>d.jsx(R,{type:"button",onClick:()=>v(E.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:E.title,children:E.icon},E.format))}),d.jsx(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:w.map(E=>d.jsx(R,{type:"button",onClick:()=>v(E.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:E.label},E.format))}),d.jsx(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:y.map(E=>d.jsx(R,{type:"button",onClick:()=>v(E.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:E.title,children:E.icon},E.format))}),d.jsxs(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:[d.jsx(R,{type:"button",onClick:()=>x(!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:Dt("editor.toolbar.link"),children:"🔗"}),d.jsxs(Ar,{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(At,{type:"file",accept:"image/*",onChange:I,disabled:s,className:"hidden"})]})]}),d.jsxs(R,{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:["",Dt("editor.toolbar.code_view")]})]}),g?d.jsx(ko,{value:i,onChange:E=>u(E.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(j,{ref:c,contentEditable:!s,onInput:E=>u(E.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(At,{type:"hidden",name:e,value:i}),m&&d.jsx(j,{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:d.jsxs(j,{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-96",children:[d.jsx(Tn,{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:Dt("editor.link_modal.title")}),d.jsx(At,{type:"url",value:k,onChange:E=>M(E.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(j,{className:"flex justify-end gap-2",children:[d.jsx(R,{type:"button",onClick:()=>{x(!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:Dt("common.cancel")}),d.jsx(R,{type:"button",onClick:S,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:Dt("editor.link_modal.insert")})]})]})})]})},Wg=Object.freeze(Object.defineProperty({__proto__:null,default:si},Symbol.toStringTag,{value:"Module"})),ga=({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(j,{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 Fo.sanitize(l,i).replace(/]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,p,m,w)=>(m.startsWith("http://")||m.startsWith("https://"))&&!g.includes("rel=")?``:g)},[l,o]),c=` + `.trim().replace(/\s+/g," ");return d.jsx(j,{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 Fo.sanitize(l,i).replace(/]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,p,m,x)=>(m.startsWith("http://")||m.startsWith("https://"))&&!g.includes("rel=")?``: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 @@ -40,7 +40,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho [&_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(j,{id:a,className:c,dangerouslySetInnerHTML:{__html:h},...s})},Vg=Object.freeze(Object.defineProperty({__proto__:null,HtmlContent:ga},Symbol.toStringTag,{value:"Module"})),ha=()=>window.G7Core,pa=(e,t)=>ha()?.t?.(e,t)??e,li=({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[w,k]=C.useState(r),[M,v]=C.useState(e),[T,I]=C.useState(!1);C.useEffect(()=>{k(r)},[r]),C.useEffect(()=>{v(e)},[e]);const S=C.useCallback(y=>{const E=y.target.value;if(v(E),t){const O=ha()?.createChangeEvent?.({value:E,name:i,type:"textarea"})??{target:{name:i,value:E}};t(O)}},[t,i]),N=C.useCallback(y=>{const E=y.target.checked;if(k(E),E||I(!1),n){const O=ha()?.createChangeEvent?.({checked:E,name:u,type:"checkbox"})??{target:{name:u,checked:E}};n(O)}},[n,u]),x=C.useCallback(()=>{I(y=>!y)},[]);return d.jsxs(j,{className:`space-y-2 ${c}`,id:p,...m,children:[d.jsxs(j,{className:"flex items-center justify-between",children:[s&&d.jsx(Ar,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:s}),d.jsxs(j,{className:"flex items-center gap-3",children:[w&&!g&&d.jsx(R,{type:"button",onClick:x,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:pa(T?"common.preview_off":"common.preview")}),l&&d.jsxs(Ar,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[d.jsx(At,{type:"checkbox",name:u,checked:w,onChange:N,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(j,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:pa("common.html_mode")})]})]})]}),!T&&d.jsx(ko,{name:i,value:M,onChange:S,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 ${w?"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(j,{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(ga,{content:M,isHtml:!0,className:f||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:h})})]})},Kg=Object.freeze(Object.defineProperty({__proto__:null,HtmlEditor:li},Symbol.toStringTag,{value:"Module"})),ii=e=>window.G7Core?.t?.(e)??e,ma=({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 w=i.current.scrollHeight;c(w>e)}},[e]);C.useEffect(()=>{u();const w=i.current;if(!w)return;const k=w.querySelectorAll("img");k.forEach(v=>{v.complete||v.addEventListener("load",u)});let M=null;return typeof ResizeObserver<"u"&&(M=new ResizeObserver(u),M.observe(w)),()=>{k.forEach(v=>{v.removeEventListener("load",u)}),M?.disconnect()}},[u,o]);const g=()=>{f(w=>!w)},p=t||ii("sirsoft-ecommerce.shop.product.expand_detail"),m=r||ii("sirsoft-ecommerce.shop.product.collapse_detail");return d.jsxs(j,{className:n,id:a,...s,children:[d.jsxs(j,{className:"relative",children:[d.jsx(j,{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(j,{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(R,{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(te,{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"})]})]})},Yg=Object.freeze(Object.defineProperty({__proto__:null,ExpandableContent:ma,default:ma},Symbol.toStringTag,{value:"Module"})),Xg=(e,t)=>window.G7Core?.t?.(e,t)??e,ba=({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 k=M=>{M.key==="Escape"&&e&&f&&t()};if(e&&f)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[e,t,f]),C.useEffect(()=>{if(e&&p.current){m.current=document.activeElement;const k=p.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),M=k[0],v=k[k.length-1];M?.focus();const T=I=>{I.key==="Tab"&&(I.shiftKey?document.activeElement===M&&(I.preventDefault(),v?.focus()):document.activeElement===v&&(I.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 w=u?.zIndex??50;return d.jsxs(j,{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:w},onClick:g?t:void 0,children:[d.jsx(j,{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),d.jsxs(j,{ref:p,className:`relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-h-[90vh] max-w-[calc(100vw-2rem)] overflow-hidden ${i}`,style:{width:c,...u?{...u,zIndex:void 0}:{}},onClick:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,children:[(r||n||l)&&d.jsxs(j,{className:"flex items-center justify-between p-4",children:[(r||n)&&d.jsxs(j,{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(R,{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":Xg("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(j,{className:"px-6 py-4 overflow-y-auto max-h-[calc(90vh-140px)]",children:h})]})]})},qg=Object.freeze(Object.defineProperty({__proto__:null,Modal:ba},Symbol.toStringTag,{value:"Module"})),ya=(e,t)=>window.G7Core?.t?.(e,t)??e,va=({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??ya("common.confirm"),m=a??ya("common.cancel"),w=g??ya("common.loading"),k=()=>{s()},M=()=>{u||(l?.(),t())},v=()=>{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(ba,{isOpen:e,onClose:v,title:r,width:c,children:[d.jsx(j,{className:"py-2",children:typeof n=="string"?d.jsx(Gt,{className:"text-gray-700 dark:text-gray-300",children:n}):n}),d.jsxs(j,{className:"flex justify-end gap-3 mt-6",children:[d.jsx(R,{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(te,{children:m})}),d.jsxs(R,{onClick:k,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(It,{className:"fa-solid fa-spinner w-4 h-4 animate-spin"}),d.jsx(te,{children:u?w:p})]})]})]})},Zg=Object.freeze(Object.defineProperty({__proto__:null,ConfirmDialog:va},Symbol.toStringTag,{value:"Module"})),ci=C.createContext(null),di=({value:e,children:t})=>d.jsx(ci.Provider,{value:e,children:t}),Qg=()=>{const e=C.useContext(ci);if(!e)throw new Error("useFileUploaderContext must be used within FileUploaderProvider");return e};function Jg(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 ui(e,t){return new Promise((function(r,n){let o;return Rg(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 Rg=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>>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,w=[];for(var c in h){var k=h[c];w.push(m),m=n._writeHeader(p,m,c,k,0)}var M=0,v=m;for(var c in h)k=h[c],w.push(m),m=n._writeHeader(p,m,c,k,1,w[M++]);var T=m-v;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,v),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>>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>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>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>>3}var w=h.lits,k=h.strt,M=h.prev,v=0,T=0,I=0,S=0,N=0,x=0;for(m>2&&(k[x=n.F._hash(o,0)]=0),u=0;u14e3||T>26697)&&m-u>100&&(p>>16,$=65535&E;if(E!=0){$=65535&E;var D=c(O=E>>>16,h.of0);h.lhst[257+D]++;var L=c($,h.df0);h.dhst[L]++,S+=h.exb[D]+h.dxb[L],w[v]=O<<23|u-p,w[v+1]=$<<16|D<<8|L,v+=2,p=u+O}else h.lhst[o[u]]++;T++}}for(I==u&&o.length!=0||(p>>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 w=n.F._howLong(o,a,u);if(w>g){if(p=u,(g=w)>=f)break;u+2k&&(k=T,i=v)}}}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>>23,X=b+(8388607&F);b>16,H=B>>8&255,W=255&B;x(i,u=n.F._writeLit(257+H,L,i,u),G-S.of0[H]),u+=S.exb[H],N(i,u=n.F._writeLit(W,U,i,u),Y-S.df0[W]),u+=S.dxb[W],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;i4&&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>1)+",");return a},n.F.contSize=function(o,a){for(var s=0,l=0;l15&&(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>>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>>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;cs&&(n.F.restrictDepth(u,s,v),v=s),c=0;ca;l++){var c=o[l].d;o[l].d=a,h+=f-(1<>>=s-a;h>0;)(c=o[l].d)=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 w,k,M=0,v=0,T=0,I=0,S=0,N=0,x=0,y=0,E=0;M==0;)if(M=f(o,E,1),v=f(o,E+1,2),E+=3,v!=0){if(m&&(a=n.F._check(a,y+131072)),v==1&&(w=p.flmap,k=p.fdmap,N=511,x=31),v==2){T=h(o,E,5)+257,I=h(o,E+5,5)+1,S=h(o,E+10,4)+4,E+=14;for(var O=0;O<38;O+=2)p.itree[O]=0,p.itree[O+1]=0;var $=1;for(O=0;O$&&($=D)}E+=3*S,i(p.itree,$),u(p.itree,$,p.imap),w=p.lmap,k=p.dmap,E=c(p.imap,(1<<$)-1,T+I,o,E,p.ttree);var L=l._copyOut(p.ttree,0,T,p.ltree);N=(1<>>4;if(!(b>>>8))a[y++]=b;else{if(b==256)break;var z=y+b-254;if(b>264){var F=p.ldef[b-257];z=y+(F>>>3)+h(o,E,7&F),E+=7&F}var G=k[g(o,E)&x];E+=15&G;var X=G>>>4,B=p.ddef[X],Y=(B>>>4)+f(o,E,15&B);for(E+=15&B,m&&(a=n.F._check(a,y+131072));y>>3),W=o[H-4]|o[H-3]<<8;m&&(a=n.F._check(a,y+W)),a.set(new s(o.buffer,o.byteOffset+H,W),y),E=H+W<<3,y+=W}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>>4;if(p<=15)h[u]=p,u++;else{var m=0,w=0;p==16?(w=3+c(l,f,2),f+=2,m=h[u-1]):p==17?(w=3+c(l,f,3),f+=3):p==18&&(w=11+c(l,f,7),f+=7);for(var k=u+w;u>>1;hf&&(f=i),h++}for(;h>1,i=o[h+1],u=c<<4|i,g=a-i,p=o[h]<>>15-a]=u,p++},n.F.revCodes=function(o,a){for(var s=n.F.U.rev15,l=15-a,f=0;f>>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<>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)&(1<>>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 th=Jg({__proto__:null,default:Bn},[Bn]);const Xt=(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;pc.length<2?`0${c}`:c,readUTF8(c,i,u){let g,p="";for(let m=0;m>3)]>>7-((7&S)<<0)&1);k[y]=F[D],k[y+1]=F[D+1],k[y+2]=F[D+2],k[y+3]=L>2)]>>6-((3&S)<<1)&3),k[y]=F[D],k[y+1]=F[D+1],k[y+2]=F[D+2],k[y+3]=L>1)]>>4-((1&S)<<2)&15),k[y]=F[D],k[y+1]=F[D+1],k[y+2]=F[D+2],k[y+3]=L>>3)]>>>7-(7&b)&1))==255*x?0:255;M[G+b]=z<<24|U<<16|U<<8|U}else if(T==2)for(b=0;b>>2)]>>>6-((3&b)<<1)&3))==85*x?0:255,M[G+b]=z<<24|U<<16|U<<8|U;else if(T==4)for(b=0;b>>1)]>>>4-((1&b)<<2)&15))==17*x?0:255,M[G+b]=z<<24|U<<16|U<<8|U;else if(T==8)for(b=0;b>3,x=Math.ceil(T*S/8),y=new Uint8Array(I*x);let E=0;const O=[0,0,4,0,2,0,1],$=[0,4,0,2,0,1,0],D=[8,8,8,4,4,2,2],L=[8,8,4,4,2,2,1];let U=0;for(;U<7;){const b=D[U],z=L[U];let F=0,G=0,X=O[U];for(;X>3])>>7-(7&be)&1,y[W*x+(Q>>3)]|=_<<7-((7&Q)<<0)),S==2&&(_=(_=M[be>>3])>>6-(7&be)&3,y[W*x+(Q>>2)]|=_<<6-((3&Q)<<1)),S==4&&(_=(_=M[be>>3])>>4-(7&be)&15,y[W*x+(Q>>1)]|=_<<4-((1&Q)<<2)),S>=8){const se=W*x+Q*N;for(let pe=0;pe>3)+pe]}be+=S,Q+=z}H++,W+=b}F*G!=0&&(E+=G*(1+Y)),U+=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,w=0,k=0,M=0,v=0,T=0,I=0,S=0,N=0,x=0;if(i[0]==3&&i[1]==0)return u||new g(0);const y=c.H,E=y.b,O=y.e,$=y.R,D=y.n,L=y.A,U=y.Z,_=y.m,b=u==null;for(b&&(u=new g(i.length>>>2<<5));w==0;)if(w=E(i,x,1),k=E(i,x+1,2),x+=3,k!=0){if(b&&(u=c.H.W(u,N+(1<<17))),k==1&&(p=_.J,m=_.h,I=511,S=31),k==2){M=O(i,x,5)+257,v=O(i,x+5,5)+1,T=O(i,x+10,4)+4,x+=14;let F=1;for(var z=0;z<38;z+=2)_.Q[z]=0,_.Q[z+1]=0;for(z=0;zF&&(F=B)}x+=3*T,D(_.Q,F),L(_.Q,F,_.u),p=_.w,m=_.d,x=$(_.u,(1<>>4;if(!(G>>>8))u[N++]=G;else{if(G==256)break;{let X=N+G-254;if(G>264){const Q=_.q[G-257];X=N+(Q>>>3)+O(i,x,7&Q),x+=7&Q}const B=m[U(i,x)&S];x+=15&B;const Y=B>>>4,H=_.c[Y],W=(H>>>4)+E(i,x,15&H);for(x+=15&H;N>>3),G=i[F-4]|i[F-3]<<8;b&&(u=c.H.W(u,N+G)),u.set(new g(i.buffer,i.byteOffset+F,G),N),x=F+G<<3,N+=G}return u.length==N?u:u.slice(0,N)},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,w){const k=c.H.e,M=c.H.Z;let v=0;for(;v>>4;if(I<=15)w[v]=I,v++;else{let S=0,N=0;I==16?(N=3+k(p,m,2),m+=2,S=w[v-1]):I==17?(N=3+k(p,m,3),m+=3):I==18&&(N=11+k(p,m,7),m+=7);const x=v+N;for(;v>>1;for(;wm&&(m=M),w++}for(;w>1,M=i[w+1],v=k<<4|M,T=u-M;let I=i[w]<>>15-u]=v,I++}},c.H.l=function(i,u){const g=c.H.m.r,p=15-u;for(let m=0;m>>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<>>3]|i[1+(u>>>3)]<<8|i[2+(u>>>3)]<<16)>>>(7&u)&(1<>>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,w){for(;m--!=0;)p.push(0,w)}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 w=Math.ceil(g*m/8);let k,M;m=Math.ceil(m/8);let v=c[u],T=0;if(v>1&&(c[u]=[0,0,1][v-2]),v==3)for(T=m;T>>1)&255;for(let I=0;I>>1);for(;T>>1)}else{for(;T=0&&k>=0?(I=U*i+_<<2,S=(k+U)*p+w+_<<2):(I=(-k+U)*i-w+_<<2,S=U*p+_<<2),M==0)g[S]=c[I],g[S+1]=c[I+1],g[S+2]=c[I+2],g[S+3]=c[I+3];else if(M==1){var N=c[I+3]*.00392156862745098,x=c[I]*N,y=c[I+1]*N,E=c[I+2]*N,O=g[S+3]*(1/255),$=g[S]*O,D=g[S+1]*O,L=g[S+2]*O;const b=1-N,z=N+O*b,F=z==0?0:1/z;g[S+3]=255*z,g[S+0]=(x+$*b)*F,g[S+1]=(y+D*b)*F,g[S+2]=(E+L*b)*F}else if(M==2)N=c[I+3],x=c[I],y=c[I+1],E=c[I+2],O=g[S+3],$=g[S],D=g[S+1],L=g[S+2],N==O&&x==$&&y==D&&E==L?(g[S]=0,g[S+1]=0,g[S+2]=0,g[S+3]=0):(g[S]=x,g[S+1]=y,g[S+2]=E,g[S+3]=N);else if(M==3){if(N=c[I+3],x=c[I],y=c[I+1],E=c[I+2],O=g[S+3],$=g[S],D=g[S+1],L=g[S+2],N==O&&x==$&&y==D&&E==L)continue;if(N<220&&O>20)return!1}return!0}return{decode:function(i){const u=new Uint8Array(i);let g=8;const p=e,m=p.readUshort,w=p.readUint,k={tabs:{},frames:[]},M=new Uint8Array(u.length);let v,T=0,I=0;const S=[137,80,78,71,13,10,26,10];for(var N=0;N<8;N++)if(u[N]!=S[N])throw"The input is not a PNG file!";for(;g>>1:E>>>=1;x[y]=E}return x})(),update(x,y,E,O){for(let $=0;$>>8;return x},crc:(x,y,E)=>4294967295^n.update(4294967295,x,y,E)};function o(x,y,E,O){y[E]+=x[0]*O>>4,y[E+1]+=x[1]*O>>4,y[E+2]+=x[2]*O>>4,y[E+3]+=x[3]*O>>4}function a(x){return Math.max(0,Math.min(255,x))}function s(x,y){const E=x[0]-y[0],O=x[1]-y[1],$=x[2]-y[2],D=x[3]-y[3];return E*E+O*O+$*$+D*D}function l(x,y,E,O,$,D,L){L==null&&(L=1);const U=O.length,_=[];for(var b=0;b>>0&255,W>>>8&255,W>>>16&255,W>>>24&255])}for(b=0;b>2]=z,X[b>>2]=O[z]}}function f(x,y,E,O,$){$==null&&($={});const{crc:D}=n,L=t.writeUint,U=t.writeUshort,_=t.writeASCII;let b=8;const z=x.frames.length>1;let F,G=!1,X=33+(z?20:0);if($.sRGB!=null&&(X+=13),$.pHYs!=null&&(X+=21),$.iCCP!=null&&(F=pako.deflate($.iCCP),X+=21+F.length+4),x.ctype==3){for(var B=x.plte.length,Y=0;Y>>24!=255&&(G=!0);X+=8+3*B+4+(G?8+1*B+4:0)}for(var H=0;H>>8&255,We=ne>>>16&255;W[b+pe+0]=Ae,W[b+pe+1]=ve,W[b+pe+2]=We}if(b+=3*B,L(W,b,D(W,b-3*B-4,3*B+4)),b+=4,G){for(L(W,b,B),b+=4,_(W,b,"tRNS"),b+=4,Y=0;Y>>24&255;b+=B,L(W,b,D(W,b-B-4,B+4)),b+=4}}let be=0;for(H=0;HPe&&(Pe=Je),qeYe&&(Ye=qe));Pe==-1&&(_e=xe=Pe=Ye=0),K&&((1&_e)==1&&_e--,(1&xe)==1&&xe--);const rt=(Pe-_e+1)*(Ye-xe+1);rt>2,ze>>2);pe.push(ne);const K=new Uint8Array(we.abuf,$e,ze);z&&l(Ae.img,Ae.rect.width,Ae.rect.height,se,K,ne),Ae.img.set(K),$e+=ze}}else for(B=0;Bve&&Oe==ge[H-ve])ne[H]=ne[H-ve];else{let we=be[Oe];if(we==null&&(be[Oe]=we=se.length,se.push(Oe),se.length>=300))break;ne[H]=we}}}const We=se.length;for(We<=256&&b==0&&(G=We<=2?1:We<=4?2:We<=16?4:8,G=Math.max(G,_)),B=0;B>1)]|=ze[oe+Te]<<4-4*(1&Te);else if(G==2)for(Te=0;Te>2)]|=ze[oe+Te]<<6-2*(3&Te);else if(G==1)for(Te=0;Te>3)]|=ze[oe+Te]<<7-1*(7&Te)}Oe=me,F=3,$e=1}else if(W==0&&Q.length==1){me=new Uint8Array(ve*ge*3);const ze=ve*ge;for(H=0;HH&&(H=pe),neW&&(W=ne))}H==-1&&(B=Y=H=W=0),L&&((1&B)==1&&B--,(1&Y)==1&&Y--),D={x:B,y:Y,width:H-B+1,height:W-Y+1};const Q=O[$];Q.rect=D,Q.blend=1,Q.img=new Uint8Array(D.width*D.height*4),O[$-1].dispose==0?(e(b,y,E,Q.img,D.width,D.height,-D.x,-D.y,0),u(G,y,E,Q.img,D)):e(G,y,E,Q.img,D.width,D.height,-D.x,-D.y,0)}function u(x,y,E,O,$){e(x,y,E,O,$.width,$.height,-$.x,-$.y,2)}function g(x,y,E,O,$,D,L){const U=[];let _,b=[0,1,2,3,4];D!=-1?b=[D]:(y*O>5e5||E==1)&&(b=[0]),L&&(_={level:0});const z=th;for(var F=0;F>1)+256&255;if(D==4)for(_=$;_>1)&255;for(_=$;_>1)&255}if(D==4){for(_=0;_<$;_++)x[U+_]=y[L+_]+256-r(0,y[L+_-O],0)&255;for(_=$;_>2);let z;if(E.length<2e7)for(var F=0;F<_;F+=4)z=k(L,G=E[F]*.00392156862745098,X=E[F+1]*.00392156862745098,B=E[F+2]*.00392156862745098,Y=E[F+3]*.00392156862745098),b[F>>2]=z.ind,$[F>>2]=z.est.rgba;else for(F=0;F<_;F+=4){var G=E[F]*.00392156862745098,X=E[F+1]*(1/255),B=E[F+2]*(1/255),Y=E[F+3]*(1/255);for(z=L;z.left;)z=M(z.est,G,X,B,Y)<=0?z.left:z.right;b[F>>2]=z.ind,$[F>>2]=z.est.rgba}return{abuf:O.buffer,inds:b,plte:U}}function w(x,y,E){E==null&&(E=1e-4);const O=new Uint32Array(x.buffer),$={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};$.bst=I(x,$.i0,$.i1),$.est=S($.bst);const D=[$];for(;D.lengthU&&(U=D[L].est.L,_=L);if(U=z||b.i1<=z){b.est.L=0;continue}const F={i0:b.i0,i1:z,bst:null,est:null,tdst:0,left:null,right:null};F.bst=I(x,F.i0,F.i1),F.est=S(F.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-F.bst.N},L=0;L<16;L++)G.bst.R[L]=b.bst.R[L]-F.bst.R[L];for(L=0;L<4;L++)G.bst.m[L]=b.bst.m[L]-F.bst.m[L];G.est=S(G.bst),b.left=F,b.right=G,D[_]=F,D.push(G)}for(D.sort(((U,_)=>_.bst.N-U.bst.N)),L=0;L0&&(L=x.right,U=x.left);const _=k(L,y,E,O,$);if(_.tdst<=D*D)return _;const b=k(U,y,E,O,$);return b.tdst<_.tdst?b:_}function M(x,y,E,O,$){const{e:D}=x;return D[0]*y+D[1]*E+D[2]*O+D[3]*$-x.eMq}function v(x,y,E,O,$,D){for(O-=4;ED;)O-=4;if(E>=O)break;const L=y[E>>2];y[E>>2]=y[O>>2],y[O>>2]=L,E+=4,O-=4}for(;T(x,E,$)>D;)E-=4;return E+4}function T(x,y,E){return x[y]*E[0]+x[y+1]*E[1]+x[y+2]*E[2]+x[y+3]*E[3]}function I(x,y,E){const O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],$=[0,0,0,0],D=E-y>>2;for(let L=y;L>>0}}var N={multVec:(x,y)=>[x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],x[4]*y[0]+x[5]*y[1]+x[6]*y[2]+x[7]*y[3],x[8]*y[0]+x[9]*y[1]+x[10]*y[2]+x[11]*y[3],x[12]*y[0]+x[13]*y[1]+x[14]*y[2]+x[15]*y[3]],dot:(x,y)=>x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],sml:(x,y)=>[x*y[0],x*y[1],x*y[2],x*y[3]]};Xt.encode=function(y,E,O,$,D,L,U){$==null&&($=0),U==null&&(U=!1);const _=c(y,E,O,$,[!1,!1,!1,0,U,!1]);return h(_,-1),f(_,E,O,D,L)},Xt.encodeLL=function(y,E,O,$,D,L,U,_){const b={ctype:0+($==1?0:2)+(D==0?0:4),depth:L,frames:[]},z=($+D)*L,F=z*E;for(let G=0;G>>0),I(1),I(32),S(3),S(f),S(2835),S(2835),N(8),S(16711680),S(65280),S(255),S(4278190080),S(1466527264),(function x(){for(;M0;){for(w=122+M*l,g=0;g>>24,i.setUint32(w+g,p<<8|m),g+=4;M++}T{t(new Blob([r],{type:"image/bmp"}))}))},_dly:9};var kt={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},rh={[kt.CHROME]:16384,[kt.FIREFOX]:11180,[kt.DESKTOP_SAFARI]:16384,[kt.IE]:8192,[kt.IOS]:4096,[kt.ETC]:8192};const wa=typeof window<"u",gi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Wn=wa&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),nh=(wa||gi)&&(Wn&&Wn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),hi=(wa||gi)&&(Wn&&Wn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function xa(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 pi(e){return new Promise(((t,r)=>{const n=new hi;n.onload=()=>t(n.result),n.onerror=o=>r(o),n.readAsDataURL(e)}))}function mi(e){return new Promise(((t,r)=>{const n=new Image;n.onload=()=>t(n),n.onerror=o=>r(o),n.src=e}))}function wr(){if(wr.cachedResult!==void 0)return wr.cachedResult;let e=kt.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=kt.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=kt.IOS:/Safari/i.test(t)?e=kt.DESKTOP_SAFARI:/Firefox/i.test(t)?e=kt.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=kt.IE),wr.cachedResult=e,wr.cachedResult}function bi(e,t){const r=wr(),n=rh[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;ffi.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),xa(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 Qt(e){e.width=0,e.height=0}function Hr(){return new Promise((function(e,t){let r,n,o,a;return Hr.cachedResult!==void 0?e(Hr.cachedResult):xa("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(s){try{return r=s,Yn(r).then((function(l){try{return n=l[1],Xn(n,r.type,r.name,r.lastModified).then((function(f){try{return o=f,Qt(n),Yn(o).then((function(h){try{return a=h[0],Hr.cachedResult=a.width===1&&a.height===2,e(Hr.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 vi(e){return new Promise(((t,r)=>{const n=new hi;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(;lr(o),n.readAsArrayBuffer(e)}))}function wi(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]=Vn(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),Qt(e)),s}function xi(e,t){const{width:r}=e,{height:n}=e,[o,a]=Vn(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),Qt(e),o}function ki(e,t,r=0){return new Promise((function(n,o){let a,s,l,f,h,c,i,u,g,p,m,w,k,M,v,T,I,S,N,x;function y(O=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=O,t.onProgress(Math.min(a,100))}function E(O){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(O,a),100),t.onProgress(a)}return a=r,s=t.maxIteration||10,l=1024*t.maxSizeMB*1024,y(),Yn(e,t).then(function(O){try{return[,f]=O,y(),h=wi(f,t),y(),new Promise((function($,D){var L;if(!(L=t.exifOrientation))return vi(e).then(function(_){try{return L=_,U.call(this)}catch(b){return D(b)}}.bind(this),D);function U(){return $(L)}return U.call(this)})).then(function($){try{return c=$,y(),Hr().then(function(D){try{return i=D?h:xi(h,c),y(),u=t.initialQuality||1,g=t.fileType||e.type,Xn(i,g,e.name,e.lastModified,u).then(function(L){try{{let _=function(){if(s--&&(v>l||v>k)){let z,F;return z=x?.95*N.width:N.width,F=x?.95*N.height:N.height,[I,S]=Vn(z,F),S.drawImage(N,0,0,z,F),u*=g==="image/png"?.85:.95,Xn(I,g,e.name,e.lastModified,u).then((function(G){try{return T=G,Qt(N),N=I,v=T.size,E(Math.min(99,Math.floor((M-v)/(M-l)*100))),_}catch(X){return o(X)}}),o)}return[1]},b=function(){return Qt(N),Qt(I),Qt(h),Qt(i),Qt(f),E(100),n(T)};if(p=L,y(),m=p.size>l,w=p.size>e.size,!m&&!w)return E(100),n(p);var U;return k=e.size,M=p.size,v=M,N=i,x=!t.alwaysKeepResolution&&m,(U=function(z){for(;z;){if(z.then)return void z.then(U,o);try{if(z.pop){if(z.length)return z.pop()?b.call(this):z;z=_}else z=z.call(this)}catch(F){return o(F)}}}.bind(this))(_)}}catch(_){return o(_)}}.bind(this),o)}catch(L){return o(L)}}.bind(this),o)}catch(D){return o(D)}}.bind(this),o)}catch($){return o($)}}.bind(this),o)}))}const oh=` + `.trim().replace(/\s+/g," ");return d.jsx(j,{id:a,className:c,dangerouslySetInnerHTML:{__html:h},...s})},Vg=Object.freeze(Object.defineProperty({__proto__:null,HtmlContent:ga},Symbol.toStringTag,{value:"Module"})),ha=()=>window.G7Core,pa=(e,t)=>ha()?.t?.(e,t)??e,li=({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[x,k]=C.useState(r),[M,v]=C.useState(e),[T,I]=C.useState(!1);C.useEffect(()=>{k(r)},[r]),C.useEffect(()=>{v(e)},[e]);const S=C.useCallback(y=>{const E=y.target.value;if(v(E),t){const O=ha()?.createChangeEvent?.({value:E,name:i,type:"textarea"})??{target:{name:i,value:E}};t(O)}},[t,i]),N=C.useCallback(y=>{const E=y.target.checked;if(k(E),E||I(!1),n){const O=ha()?.createChangeEvent?.({checked:E,name:u,type:"checkbox"})??{target:{name:u,checked:E}};n(O)}},[n,u]),w=C.useCallback(()=>{I(y=>!y)},[]);return d.jsxs(j,{className:`space-y-2 ${c}`,id:p,...m,children:[d.jsxs(j,{className:"flex items-center justify-between",children:[s&&d.jsx(Ar,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:s}),d.jsxs(j,{className:"flex items-center gap-3",children:[x&&!g&&d.jsx(R,{type:"button",onClick:w,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:pa(T?"common.preview_off":"common.preview")}),l&&d.jsxs(Ar,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[d.jsx(At,{type:"checkbox",name:u,checked:x,onChange:N,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(j,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:pa("common.html_mode")})]})]})]}),!T&&d.jsx(ko,{name:i,value:M,onChange:S,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 ${x?"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(j,{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(ga,{content:M,isHtml:!0,className:f||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:h})})]})},Kg=Object.freeze(Object.defineProperty({__proto__:null,HtmlEditor:li},Symbol.toStringTag,{value:"Module"})),ii=e=>window.G7Core?.t?.(e)??e,ma=({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 x=i.current.scrollHeight;c(x>e)}},[e]);C.useEffect(()=>{u();const x=i.current;if(!x)return;const k=x.querySelectorAll("img");k.forEach(v=>{v.complete||v.addEventListener("load",u)});let M=null;return typeof ResizeObserver<"u"&&(M=new ResizeObserver(u),M.observe(x)),()=>{k.forEach(v=>{v.removeEventListener("load",u)}),M?.disconnect()}},[u,o]);const g=()=>{f(x=>!x)},p=t||ii("sirsoft-ecommerce.shop.product.expand_detail"),m=r||ii("sirsoft-ecommerce.shop.product.collapse_detail");return d.jsxs(j,{className:n,id:a,...s,children:[d.jsxs(j,{className:"relative",children:[d.jsx(j,{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(j,{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(R,{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(te,{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"})]})]})},Yg=Object.freeze(Object.defineProperty({__proto__:null,ExpandableContent:ma,default:ma},Symbol.toStringTag,{value:"Module"})),Xg=(e,t)=>window.G7Core?.t?.(e,t)??e,ba=({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 k=M=>{M.key==="Escape"&&e&&f&&t()};if(e&&f)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[e,t,f]),C.useEffect(()=>{if(e&&p.current){m.current=document.activeElement;const k=p.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),M=k[0],v=k[k.length-1];M?.focus();const T=I=>{I.key==="Tab"&&(I.shiftKey?document.activeElement===M&&(I.preventDefault(),v?.focus()):document.activeElement===v&&(I.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 x=u?.zIndex??50;return d.jsxs(j,{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:x},onClick:g?t:void 0,children:[d.jsx(j,{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),d.jsxs(j,{ref:p,className:`relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-h-[90vh] max-w-[calc(100vw-2rem)] overflow-hidden ${i}`,style:{width:c,...u?{...u,zIndex:void 0}:{}},onClick:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,children:[(r||n||l)&&d.jsxs(j,{className:"flex items-center justify-between p-4",children:[(r||n)&&d.jsxs(j,{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(R,{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":Xg("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(j,{className:"px-6 py-4 overflow-y-auto max-h-[calc(90vh-140px)]",children:h})]})]})},qg=Object.freeze(Object.defineProperty({__proto__:null,Modal:ba},Symbol.toStringTag,{value:"Module"})),ya=(e,t)=>window.G7Core?.t?.(e,t)??e,va=({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??ya("common.confirm"),m=a??ya("common.cancel"),x=g??ya("common.loading"),k=()=>{s()},M=()=>{u||(l?.(),t())},v=()=>{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(ba,{isOpen:e,onClose:v,title:r,width:c,children:[d.jsx(j,{className:"py-2",children:typeof n=="string"?d.jsx(Gt,{className:"text-gray-700 dark:text-gray-300",children:n}):n}),d.jsxs(j,{className:"flex justify-end gap-3 mt-6",children:[d.jsx(R,{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(te,{children:m})}),d.jsxs(R,{onClick:k,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(It,{className:"fa-solid fa-spinner w-4 h-4 animate-spin"}),d.jsx(te,{children:u?x:p})]})]})]})},Zg=Object.freeze(Object.defineProperty({__proto__:null,ConfirmDialog:va},Symbol.toStringTag,{value:"Module"})),ci=C.createContext(null),di=({value:e,children:t})=>d.jsx(ci.Provider,{value:e,children:t}),Qg=()=>{const e=C.useContext(ci);if(!e)throw new Error("useFileUploaderContext must be used within FileUploaderProvider");return e};function Jg(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 ui(e,t){return new Promise((function(r,n){let o;return Rg(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 Rg=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>>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,x=[];for(var c in h){var k=h[c];x.push(m),m=n._writeHeader(p,m,c,k,0)}var M=0,v=m;for(var c in h)k=h[c],x.push(m),m=n._writeHeader(p,m,c,k,1,x[M++]);var T=m-v;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,v),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>>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>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>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>>3}var x=h.lits,k=h.strt,M=h.prev,v=0,T=0,I=0,S=0,N=0,w=0;for(m>2&&(k[w=n.F._hash(o,0)]=0),u=0;u14e3||T>26697)&&m-u>100&&(p>>16,$=65535&E;if(E!=0){$=65535&E;var P=c(O=E>>>16,h.of0);h.lhst[257+P]++;var L=c($,h.df0);h.dhst[L]++,S+=h.exb[P]+h.dxb[L],x[v]=O<<23|u-p,x[v+1]=$<<16|P<<8|L,v+=2,p=u+O}else h.lhst[o[u]]++;T++}}for(I==u&&o.length!=0||(p>>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 x=n.F._howLong(o,a,u);if(x>g){if(p=u,(g=x)>=f)break;u+2k&&(k=T,i=v)}}}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>>23,X=b+(8388607&F);b>16,H=B>>8&255,W=255&B;w(i,u=n.F._writeLit(257+H,L,i,u),G-S.of0[H]),u+=S.exb[H],N(i,u=n.F._writeLit(W,U,i,u),Y-S.df0[W]),u+=S.dxb[W],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;i4&&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>1)+",");return a},n.F.contSize=function(o,a){for(var s=0,l=0;l15&&(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>>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>>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;cs&&(n.F.restrictDepth(u,s,v),v=s),c=0;ca;l++){var c=o[l].d;o[l].d=a,h+=f-(1<>>=s-a;h>0;)(c=o[l].d)=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 x,k,M=0,v=0,T=0,I=0,S=0,N=0,w=0,y=0,E=0;M==0;)if(M=f(o,E,1),v=f(o,E+1,2),E+=3,v!=0){if(m&&(a=n.F._check(a,y+131072)),v==1&&(x=p.flmap,k=p.fdmap,N=511,w=31),v==2){T=h(o,E,5)+257,I=h(o,E+5,5)+1,S=h(o,E+10,4)+4,E+=14;for(var O=0;O<38;O+=2)p.itree[O]=0,p.itree[O+1]=0;var $=1;for(O=0;O$&&($=P)}E+=3*S,i(p.itree,$),u(p.itree,$,p.imap),x=p.lmap,k=p.dmap,E=c(p.imap,(1<<$)-1,T+I,o,E,p.ttree);var L=l._copyOut(p.ttree,0,T,p.ltree);N=(1<>>4;if(!(b>>>8))a[y++]=b;else{if(b==256)break;var z=y+b-254;if(b>264){var F=p.ldef[b-257];z=y+(F>>>3)+h(o,E,7&F),E+=7&F}var G=k[g(o,E)&w];E+=15&G;var X=G>>>4,B=p.ddef[X],Y=(B>>>4)+f(o,E,15&B);for(E+=15&B,m&&(a=n.F._check(a,y+131072));y>>3),W=o[H-4]|o[H-3]<<8;m&&(a=n.F._check(a,y+W)),a.set(new s(o.buffer,o.byteOffset+H,W),y),E=H+W<<3,y+=W}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>>4;if(p<=15)h[u]=p,u++;else{var m=0,x=0;p==16?(x=3+c(l,f,2),f+=2,m=h[u-1]):p==17?(x=3+c(l,f,3),f+=3):p==18&&(x=11+c(l,f,7),f+=7);for(var k=u+x;u>>1;hf&&(f=i),h++}for(;h>1,i=o[h+1],u=c<<4|i,g=a-i,p=o[h]<>>15-a]=u,p++},n.F.revCodes=function(o,a){for(var s=n.F.U.rev15,l=15-a,f=0;f>>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<>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)&(1<>>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 th=Jg({__proto__:null,default:Bn},[Bn]);const Xt=(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;pc.length<2?`0${c}`:c,readUTF8(c,i,u){let g,p="";for(let m=0;m>3)]>>7-((7&S)<<0)&1);k[y]=F[P],k[y+1]=F[P+1],k[y+2]=F[P+2],k[y+3]=L>2)]>>6-((3&S)<<1)&3),k[y]=F[P],k[y+1]=F[P+1],k[y+2]=F[P+2],k[y+3]=L>1)]>>4-((1&S)<<2)&15),k[y]=F[P],k[y+1]=F[P+1],k[y+2]=F[P+2],k[y+3]=L>>3)]>>>7-(7&b)&1))==255*w?0:255;M[G+b]=z<<24|U<<16|U<<8|U}else if(T==2)for(b=0;b>>2)]>>>6-((3&b)<<1)&3))==85*w?0:255,M[G+b]=z<<24|U<<16|U<<8|U;else if(T==4)for(b=0;b>>1)]>>>4-((1&b)<<2)&15))==17*w?0:255,M[G+b]=z<<24|U<<16|U<<8|U;else if(T==8)for(b=0;b>3,w=Math.ceil(T*S/8),y=new Uint8Array(I*w);let E=0;const O=[0,0,4,0,2,0,1],$=[0,4,0,2,0,1,0],P=[8,8,8,4,4,2,2],L=[8,8,4,4,2,2,1];let U=0;for(;U<7;){const b=P[U],z=L[U];let F=0,G=0,X=O[U];for(;X>3])>>7-(7&be)&1,y[W*w+(Q>>3)]|=_<<7-((7&Q)<<0)),S==2&&(_=(_=M[be>>3])>>6-(7&be)&3,y[W*w+(Q>>2)]|=_<<6-((3&Q)<<1)),S==4&&(_=(_=M[be>>3])>>4-(7&be)&15,y[W*w+(Q>>1)]|=_<<4-((1&Q)<<2)),S>=8){const se=W*w+Q*N;for(let pe=0;pe>3)+pe]}be+=S,Q+=z}H++,W+=b}F*G!=0&&(E+=G*(1+Y)),U+=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,x=0,k=0,M=0,v=0,T=0,I=0,S=0,N=0,w=0;if(i[0]==3&&i[1]==0)return u||new g(0);const y=c.H,E=y.b,O=y.e,$=y.R,P=y.n,L=y.A,U=y.Z,_=y.m,b=u==null;for(b&&(u=new g(i.length>>>2<<5));x==0;)if(x=E(i,w,1),k=E(i,w+1,2),w+=3,k!=0){if(b&&(u=c.H.W(u,N+(1<<17))),k==1&&(p=_.J,m=_.h,I=511,S=31),k==2){M=O(i,w,5)+257,v=O(i,w+5,5)+1,T=O(i,w+10,4)+4,w+=14;let F=1;for(var z=0;z<38;z+=2)_.Q[z]=0,_.Q[z+1]=0;for(z=0;zF&&(F=B)}w+=3*T,P(_.Q,F),L(_.Q,F,_.u),p=_.w,m=_.d,w=$(_.u,(1<>>4;if(!(G>>>8))u[N++]=G;else{if(G==256)break;{let X=N+G-254;if(G>264){const Q=_.q[G-257];X=N+(Q>>>3)+O(i,w,7&Q),w+=7&Q}const B=m[U(i,w)&S];w+=15&B;const Y=B>>>4,H=_.c[Y],W=(H>>>4)+E(i,w,15&H);for(w+=15&H;N>>3),G=i[F-4]|i[F-3]<<8;b&&(u=c.H.W(u,N+G)),u.set(new g(i.buffer,i.byteOffset+F,G),N),w=F+G<<3,N+=G}return u.length==N?u:u.slice(0,N)},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,x){const k=c.H.e,M=c.H.Z;let v=0;for(;v>>4;if(I<=15)x[v]=I,v++;else{let S=0,N=0;I==16?(N=3+k(p,m,2),m+=2,S=x[v-1]):I==17?(N=3+k(p,m,3),m+=3):I==18&&(N=11+k(p,m,7),m+=7);const w=v+N;for(;v>>1;for(;xm&&(m=M),x++}for(;x>1,M=i[x+1],v=k<<4|M,T=u-M;let I=i[x]<>>15-u]=v,I++}},c.H.l=function(i,u){const g=c.H.m.r,p=15-u;for(let m=0;m>>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<>>3]|i[1+(u>>>3)]<<8|i[2+(u>>>3)]<<16)>>>(7&u)&(1<>>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,x){for(;m--!=0;)p.push(0,x)}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 x=Math.ceil(g*m/8);let k,M;m=Math.ceil(m/8);let v=c[u],T=0;if(v>1&&(c[u]=[0,0,1][v-2]),v==3)for(T=m;T>>1)&255;for(let I=0;I>>1);for(;T>>1)}else{for(;T=0&&k>=0?(I=U*i+_<<2,S=(k+U)*p+x+_<<2):(I=(-k+U)*i-x+_<<2,S=U*p+_<<2),M==0)g[S]=c[I],g[S+1]=c[I+1],g[S+2]=c[I+2],g[S+3]=c[I+3];else if(M==1){var N=c[I+3]*.00392156862745098,w=c[I]*N,y=c[I+1]*N,E=c[I+2]*N,O=g[S+3]*(1/255),$=g[S]*O,P=g[S+1]*O,L=g[S+2]*O;const b=1-N,z=N+O*b,F=z==0?0:1/z;g[S+3]=255*z,g[S+0]=(w+$*b)*F,g[S+1]=(y+P*b)*F,g[S+2]=(E+L*b)*F}else if(M==2)N=c[I+3],w=c[I],y=c[I+1],E=c[I+2],O=g[S+3],$=g[S],P=g[S+1],L=g[S+2],N==O&&w==$&&y==P&&E==L?(g[S]=0,g[S+1]=0,g[S+2]=0,g[S+3]=0):(g[S]=w,g[S+1]=y,g[S+2]=E,g[S+3]=N);else if(M==3){if(N=c[I+3],w=c[I],y=c[I+1],E=c[I+2],O=g[S+3],$=g[S],P=g[S+1],L=g[S+2],N==O&&w==$&&y==P&&E==L)continue;if(N<220&&O>20)return!1}return!0}return{decode:function(i){const u=new Uint8Array(i);let g=8;const p=e,m=p.readUshort,x=p.readUint,k={tabs:{},frames:[]},M=new Uint8Array(u.length);let v,T=0,I=0;const S=[137,80,78,71,13,10,26,10];for(var N=0;N<8;N++)if(u[N]!=S[N])throw"The input is not a PNG file!";for(;g>>1:E>>>=1;w[y]=E}return w})(),update(w,y,E,O){for(let $=0;$>>8;return w},crc:(w,y,E)=>4294967295^n.update(4294967295,w,y,E)};function o(w,y,E,O){y[E]+=w[0]*O>>4,y[E+1]+=w[1]*O>>4,y[E+2]+=w[2]*O>>4,y[E+3]+=w[3]*O>>4}function a(w){return Math.max(0,Math.min(255,w))}function s(w,y){const E=w[0]-y[0],O=w[1]-y[1],$=w[2]-y[2],P=w[3]-y[3];return E*E+O*O+$*$+P*P}function l(w,y,E,O,$,P,L){L==null&&(L=1);const U=O.length,_=[];for(var b=0;b>>0&255,W>>>8&255,W>>>16&255,W>>>24&255])}for(b=0;b>2]=z,X[b>>2]=O[z]}}function f(w,y,E,O,$){$==null&&($={});const{crc:P}=n,L=t.writeUint,U=t.writeUshort,_=t.writeASCII;let b=8;const z=w.frames.length>1;let F,G=!1,X=33+(z?20:0);if($.sRGB!=null&&(X+=13),$.pHYs!=null&&(X+=21),$.iCCP!=null&&(F=pako.deflate($.iCCP),X+=21+F.length+4),w.ctype==3){for(var B=w.plte.length,Y=0;Y>>24!=255&&(G=!0);X+=8+3*B+4+(G?8+1*B+4:0)}for(var H=0;H>>8&255,We=ne>>>16&255;W[b+pe+0]=Ae,W[b+pe+1]=ve,W[b+pe+2]=We}if(b+=3*B,L(W,b,P(W,b-3*B-4,3*B+4)),b+=4,G){for(L(W,b,B),b+=4,_(W,b,"tRNS"),b+=4,Y=0;Y>>24&255;b+=B,L(W,b,P(W,b-B-4,B+4)),b+=4}}let be=0;for(H=0;HDe&&(De=Je),qeYe&&(Ye=qe));De==-1&&(_e=xe=De=Ye=0),K&&((1&_e)==1&&_e--,(1&xe)==1&&xe--);const rt=(De-_e+1)*(Ye-xe+1);rt>2,ze>>2);pe.push(ne);const K=new Uint8Array(we.abuf,$e,ze);z&&l(Ae.img,Ae.rect.width,Ae.rect.height,se,K,ne),Ae.img.set(K),$e+=ze}}else for(B=0;Bve&&Oe==ge[H-ve])ne[H]=ne[H-ve];else{let we=be[Oe];if(we==null&&(be[Oe]=we=se.length,se.push(Oe),se.length>=300))break;ne[H]=we}}}const We=se.length;for(We<=256&&b==0&&(G=We<=2?1:We<=4?2:We<=16?4:8,G=Math.max(G,_)),B=0;B>1)]|=ze[oe+Te]<<4-4*(1&Te);else if(G==2)for(Te=0;Te>2)]|=ze[oe+Te]<<6-2*(3&Te);else if(G==1)for(Te=0;Te>3)]|=ze[oe+Te]<<7-1*(7&Te)}Oe=me,F=3,$e=1}else if(W==0&&Q.length==1){me=new Uint8Array(ve*ge*3);const ze=ve*ge;for(H=0;HH&&(H=pe),neW&&(W=ne))}H==-1&&(B=Y=H=W=0),L&&((1&B)==1&&B--,(1&Y)==1&&Y--),P={x:B,y:Y,width:H-B+1,height:W-Y+1};const Q=O[$];Q.rect=P,Q.blend=1,Q.img=new Uint8Array(P.width*P.height*4),O[$-1].dispose==0?(e(b,y,E,Q.img,P.width,P.height,-P.x,-P.y,0),u(G,y,E,Q.img,P)):e(G,y,E,Q.img,P.width,P.height,-P.x,-P.y,0)}function u(w,y,E,O,$){e(w,y,E,O,$.width,$.height,-$.x,-$.y,2)}function g(w,y,E,O,$,P,L){const U=[];let _,b=[0,1,2,3,4];P!=-1?b=[P]:(y*O>5e5||E==1)&&(b=[0]),L&&(_={level:0});const z=th;for(var F=0;F>1)+256&255;if(P==4)for(_=$;_>1)&255;for(_=$;_>1)&255}if(P==4){for(_=0;_<$;_++)w[U+_]=y[L+_]+256-r(0,y[L+_-O],0)&255;for(_=$;_>2);let z;if(E.length<2e7)for(var F=0;F<_;F+=4)z=k(L,G=E[F]*.00392156862745098,X=E[F+1]*.00392156862745098,B=E[F+2]*.00392156862745098,Y=E[F+3]*.00392156862745098),b[F>>2]=z.ind,$[F>>2]=z.est.rgba;else for(F=0;F<_;F+=4){var G=E[F]*.00392156862745098,X=E[F+1]*(1/255),B=E[F+2]*(1/255),Y=E[F+3]*(1/255);for(z=L;z.left;)z=M(z.est,G,X,B,Y)<=0?z.left:z.right;b[F>>2]=z.ind,$[F>>2]=z.est.rgba}return{abuf:O.buffer,inds:b,plte:U}}function x(w,y,E){E==null&&(E=1e-4);const O=new Uint32Array(w.buffer),$={i0:0,i1:w.length,bst:null,est:null,tdst:0,left:null,right:null};$.bst=I(w,$.i0,$.i1),$.est=S($.bst);const P=[$];for(;P.lengthU&&(U=P[L].est.L,_=L);if(U=z||b.i1<=z){b.est.L=0;continue}const F={i0:b.i0,i1:z,bst:null,est:null,tdst:0,left:null,right:null};F.bst=I(w,F.i0,F.i1),F.est=S(F.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-F.bst.N},L=0;L<16;L++)G.bst.R[L]=b.bst.R[L]-F.bst.R[L];for(L=0;L<4;L++)G.bst.m[L]=b.bst.m[L]-F.bst.m[L];G.est=S(G.bst),b.left=F,b.right=G,P[_]=F,P.push(G)}for(P.sort(((U,_)=>_.bst.N-U.bst.N)),L=0;L0&&(L=w.right,U=w.left);const _=k(L,y,E,O,$);if(_.tdst<=P*P)return _;const b=k(U,y,E,O,$);return b.tdst<_.tdst?b:_}function M(w,y,E,O,$){const{e:P}=w;return P[0]*y+P[1]*E+P[2]*O+P[3]*$-w.eMq}function v(w,y,E,O,$,P){for(O-=4;EP;)O-=4;if(E>=O)break;const L=y[E>>2];y[E>>2]=y[O>>2],y[O>>2]=L,E+=4,O-=4}for(;T(w,E,$)>P;)E-=4;return E+4}function T(w,y,E){return w[y]*E[0]+w[y+1]*E[1]+w[y+2]*E[2]+w[y+3]*E[3]}function I(w,y,E){const O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],$=[0,0,0,0],P=E-y>>2;for(let L=y;L>>0}}var N={multVec:(w,y)=>[w[0]*y[0]+w[1]*y[1]+w[2]*y[2]+w[3]*y[3],w[4]*y[0]+w[5]*y[1]+w[6]*y[2]+w[7]*y[3],w[8]*y[0]+w[9]*y[1]+w[10]*y[2]+w[11]*y[3],w[12]*y[0]+w[13]*y[1]+w[14]*y[2]+w[15]*y[3]],dot:(w,y)=>w[0]*y[0]+w[1]*y[1]+w[2]*y[2]+w[3]*y[3],sml:(w,y)=>[w*y[0],w*y[1],w*y[2],w*y[3]]};Xt.encode=function(y,E,O,$,P,L,U){$==null&&($=0),U==null&&(U=!1);const _=c(y,E,O,$,[!1,!1,!1,0,U,!1]);return h(_,-1),f(_,E,O,P,L)},Xt.encodeLL=function(y,E,O,$,P,L,U,_){const b={ctype:0+($==1?0:2)+(P==0?0:4),depth:L,frames:[]},z=($+P)*L,F=z*E;for(let G=0;G>>0),I(1),I(32),S(3),S(f),S(2835),S(2835),N(8),S(16711680),S(65280),S(255),S(4278190080),S(1466527264),(function w(){for(;M0;){for(x=122+M*l,g=0;g>>24,i.setUint32(x+g,p<<8|m),g+=4;M++}T{t(new Blob([r],{type:"image/bmp"}))}))},_dly:9};var kt={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},rh={[kt.CHROME]:16384,[kt.FIREFOX]:11180,[kt.DESKTOP_SAFARI]:16384,[kt.IE]:8192,[kt.IOS]:4096,[kt.ETC]:8192};const wa=typeof window<"u",gi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Wn=wa&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),nh=(wa||gi)&&(Wn&&Wn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),hi=(wa||gi)&&(Wn&&Wn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function xa(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 pi(e){return new Promise(((t,r)=>{const n=new hi;n.onload=()=>t(n.result),n.onerror=o=>r(o),n.readAsDataURL(e)}))}function mi(e){return new Promise(((t,r)=>{const n=new Image;n.onload=()=>t(n),n.onerror=o=>r(o),n.src=e}))}function wr(){if(wr.cachedResult!==void 0)return wr.cachedResult;let e=kt.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=kt.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=kt.IOS:/Safari/i.test(t)?e=kt.DESKTOP_SAFARI:/Firefox/i.test(t)?e=kt.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=kt.IE),wr.cachedResult=e,wr.cachedResult}function bi(e,t){const r=wr(),n=rh[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;ffi.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),xa(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 Qt(e){e.width=0,e.height=0}function Hr(){return new Promise((function(e,t){let r,n,o,a;return Hr.cachedResult!==void 0?e(Hr.cachedResult):xa("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(s){try{return r=s,Yn(r).then((function(l){try{return n=l[1],Xn(n,r.type,r.name,r.lastModified).then((function(f){try{return o=f,Qt(n),Yn(o).then((function(h){try{return a=h[0],Hr.cachedResult=a.width===1&&a.height===2,e(Hr.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 vi(e){return new Promise(((t,r)=>{const n=new hi;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(;lr(o),n.readAsArrayBuffer(e)}))}function wi(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]=Vn(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),Qt(e)),s}function xi(e,t){const{width:r}=e,{height:n}=e,[o,a]=Vn(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),Qt(e),o}function ki(e,t,r=0){return new Promise((function(n,o){let a,s,l,f,h,c,i,u,g,p,m,x,k,M,v,T,I,S,N,w;function y(O=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=O,t.onProgress(Math.min(a,100))}function E(O){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(O,a),100),t.onProgress(a)}return a=r,s=t.maxIteration||10,l=1024*t.maxSizeMB*1024,y(),Yn(e,t).then(function(O){try{return[,f]=O,y(),h=wi(f,t),y(),new Promise((function($,P){var L;if(!(L=t.exifOrientation))return vi(e).then(function(_){try{return L=_,U.call(this)}catch(b){return P(b)}}.bind(this),P);function U(){return $(L)}return U.call(this)})).then(function($){try{return c=$,y(),Hr().then(function(P){try{return i=P?h:xi(h,c),y(),u=t.initialQuality||1,g=t.fileType||e.type,Xn(i,g,e.name,e.lastModified,u).then(function(L){try{{let _=function(){if(s--&&(v>l||v>k)){let z,F;return z=w?.95*N.width:N.width,F=w?.95*N.height:N.height,[I,S]=Vn(z,F),S.drawImage(N,0,0,z,F),u*=g==="image/png"?.85:.95,Xn(I,g,e.name,e.lastModified,u).then((function(G){try{return T=G,Qt(N),N=I,v=T.size,E(Math.min(99,Math.floor((M-v)/(M-l)*100))),_}catch(X){return o(X)}}),o)}return[1]},b=function(){return Qt(N),Qt(I),Qt(h),Qt(i),Qt(f),E(100),n(T)};if(p=L,y(),m=p.size>l,x=p.size>e.size,!m&&!x)return E(100),n(p);var U;return k=e.size,M=p.size,v=M,N=i,w=!t.alwaysKeepResolution&&m,(U=function(z){for(;z;){if(z.then)return void z.then(U,o);try{if(z.pop){if(z.length)return z.pop()?b.call(this):z;z=_}else z=z.call(this)}catch(F){return o(F)}}}.bind(this))(_)}}catch(_){return o(_)}}.bind(this),o)}catch(L){return o(L)}}.bind(this),o)}catch(P){return o(P)}}.bind(this),o)}catch($){return o($)}}.bind(this),o)}))}const oh=` let scriptImported = false self.addEventListener('message', async (e) => { const { file, id, imageCompressionLibUrl, options } = e.data @@ -59,14 +59,14 @@ self.addEventListener('message', async (e) => { self.postMessage({ error: e.message + '\\n' + e.stack, id }) } }) -`;let ka;function ah(e,t){return new Promise(((r,n)=>{ka||(ka=(function(s){const l=[];return l.push(s),URL.createObjectURL(new Blob(l))})(oh));const o=new Worker(ka);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 mt(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 nh))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 ki(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 ki(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",ah(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=ui(e,a))}catch{}return r(a)}}))}mt.getDataUrlFromFile=pi,mt.getFilefromDataUrl=xa,mt.loadImage=mi,mt.drawImageInCanvas=yi,mt.drawFileInCanvas=Yn,mt.canvasToFile=Xn,mt.getExifOrientation=vi,mt.handleMaxWidthOrHeight=wi,mt.followExifOrientation=xi,mt.cleanupCanvasMemory=Qt,mt.isAutoOrientationInBrowser=Hr,mt.approximateBelowMaximumCanvasSizeOfBrowser=bi,mt.copyExifWithoutOrientation=ui,mt.getBrowserName=wr,mt.version="2.0.2";const sh=window.G7Core,qn=e=>{const t=["B","KB","MB","GB"];let r=0,n=e;for(;n>=1024&&r{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:"업로드 실패"},_i=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",at=(e,t)=>sh?.t?.(e,t)??e,lh="2.0.2";function ih(){const e=window?.G7Core?.asset;if(typeof e?.template=="function")return e.template("sirsoft-basic",`vendor/browser-image-compression/${lh}/browser-image-compression.js`)}const xr=window.G7Core;function Si(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:w,onReorder:k,uploadTriggerEvent:M,confirmBeforeRemove:v,uploadParams:T}=e,[I,S]=C.useState(i),[N,x]=C.useState([]),[y,E]=C.useState(!1),O=C.useRef(null),$=C.useRef(0),D=C.useRef(new Set),L=C.useRef(new Map),[U,_]=C.useState(!1),[b,z]=C.useState(null),[F,G]=C.useState(!1),X=C.useRef(!1),[B,Y]=C.useState([]),H=C.useRef(i),[W,Q]=C.useState(!1),[be,se]=C.useState(0),pe=C.useRef(0),[ne,Ae]=C.useState(new Map),ve=C.useRef(new Map);C.useEffect(()=>{g?.(N)},[N,g]);const We=C.useMemo(()=>{const q=H.current;return q===i?q:q.length!==i.length?(H.current=i,i):q.length===0&&i.length===0?q:i.some((de,ue)=>de.id!==q[ue]?.id)?(H.current=i,i):q},[i]);C.useEffect(()=>{if(X.current)return;const q=We.filter(ue=>!D.current.has(ue.id)&&(!ue.hash||!D.current.has(ue.hash))),le=new Set(q.map(ue=>ue.id)),de=Array.from(L.current.values()).filter(ue=>!le.has(ue.id)&&!D.current.has(ue.id));S([...q,...de])},[We]);const me=C.useCallback(async q=>{const le={maxSizeMB:f?.maxSizeMB??1,maxWidthOrHeight:f?.maxWidthOrHeight??1920,useWebWorker:!0,libURL:ih()};return await mt(q,le)},[f]),Te=C.useCallback(async q=>{const le=I.length+N.length,de=Math.max(0,o-le),ue=Array.from(q).slice(0,de);if(q.length>de){const ie=Array.from(q).slice(de),Fe=at("attachment.upload_limit_exceeded",{max:o});m?.(Fe,ie[0]??q[0])}for(const ie of ue){if(ie.size>a*1024*1024){m?.(`[${ie.name}] 파일 크기(${qn(ie.size)})가 최대 허용 크기(${a}MB)를 초과합니다.`,ie);continue}if(l){const Ce="."+ie.name.split(".").pop()?.toLowerCase();if(!l.split(",").map(He=>He.trim().toLowerCase()).some(He=>{if(He.includes("/")){if(He.endsWith("/*")){const je=He.slice(0,-2);return ie.type.toLowerCase().startsWith(je+"/")}return ie.type.toLowerCase()===He}return Ce===He})){m?.(`[${ie.name}] 허용되지 않는 파일 형식입니다. (허용: ${l})`,ie);continue}}const Fe={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:qn(ie.size),status:"pending",progress:0};if(ie.type.startsWith("image/")&&(Fe.preview=URL.createObjectURL(ie)),x(Ce=>[...Ce,Fe]),ie.type.startsWith("image/")&&f){x(Ce=>Ce.map(Ie=>Ie.id===Fe.id?{...Ie,status:"compressing"}:Ie));try{const Ce=await me(ie);x(Ie=>Ie.map(Ne=>Ne.id===Fe.id?{...Ne,compressedBlob:Ce,size:Ce.size,size_formatted:qn(Ce.size),status:"pending",progress:0}:Ne))}catch{x(Ce=>Ce.map(Ie=>Ie.id===Fe.id?{...Ie,status:"error",error:"이미지 압축 실패"}:Ie))}}}},[I.length,N.length,o,a,l,f,me,m]),ge=C.useCallback(async q=>{const le=new FormData,de=q.compressedBlob?new File([q.compressedBlob],q.original_filename,{type:q.mime_type}):q.file;le.append("file",de),t&&le.append("attachmentable_type",t),r&&le.append("attachmentable_id",String(r)),le.append("collection",n),h.forEach(ue=>{le.append("role_ids[]",String(ue))}),T&&Object.entries(T).forEach(([ue,ie])=>{le.append(ue,ie)});try{const ue=await xr.api.post(u.upload,le,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:Fe=>{const Ce=Math.round(Fe.loaded*100/(Fe.total??1));x(Ie=>Ie.map(Ne=>Ne.id===q.id?{...Ne,progress:Ce}:Ne))}});return ue?.data?.data??ue?.data}catch(ue){const ie=Ci(ue);throw new Error(ie)}},[t,r,n,h,u.upload]),Oe=C.useCallback(async()=>{const q=N.filter(Ce=>Ce.status==="pending"||Ce.status==="error");if(q.length===0)return[];const le=[],de=new Map,ue=[...q],ie=async()=>{for(;ue.length>0&&$.currentIe.map(Ne=>Ne.id===Ce.id?{...Ne,status:"uploading",progress:0}:Ne));try{const Ie=await ge(Ce);if(Ie)le.push(Ie),de.set(String(Ce.id),String(Ie.hash)),L.current.set(Ie.id,Ie),x(Ne=>Ne.filter(He=>He.id!==Ce.id)),S(Ne=>[...Ne,Ie]),Y(Ne=>{if(Ne.length===0)return Ne;const He=String(Ce.id);return Ne.some(_e=>String(_e)===He)?Ne.map(_e=>String(_e)===He?String(Ie.hash):_e):Ne}),Ce.preview&&URL.revokeObjectURL(Ce.preview);else{const Ne=at("attachment.upload_response_invalid");x(He=>He.map(je=>je.id===Ce.id?{...je,status:"error",error:Ne}:je)),m?.(`[${Ce.original_filename}] ${Ne}`,Ce.file)}}catch(Ie){const Ne=Ie instanceof Error?Ie.message:"업로드 실패";x(He=>He.map(je=>je.id===Ce.id?{...je,status:"error",error:Ne}:je)),m?.(`[${Ce.original_filename}] ${Ne}`,Ce.file)}finally{$.current--}}},Fe=Array(Math.min(s,q.length)).fill(null).map(()=>ie());if(await Promise.all(Fe),le.length>0&&(p?.(le),u.reorder&&B.length>0&&k)){const Ce=[...I,...le],Ie=B.map(je=>de.get(String(je))??je),Ne=new Map(Ie.map((je,_e)=>[String(je),_e])),He=[...Ce].sort((je,_e)=>{const xe=Ne.get(String(je.hash))??Ce.length,Pe=Ne.get(String(_e.hash))??Ce.length;return xe-Pe}).map((je,_e)=>({...je,sort_order:_e,order:_e+1}));k(He)}return le},[N,s,ge,p,m,B,I,k,u.reorder]);C.useEffect(()=>{if(!M)return;const q=xr.componentEvent.on(M,async()=>{const le=await Oe();return{uploadedAttachments:le,existingFiles:I,allFiles:[...I,...le]}});return()=>{q()}},[M,Oe,I]),C.useEffect(()=>{c&&N.some(q=>q.status==="pending")&&Oe()},[c,N,Oe]);const we=C.useCallback(async q=>{G(!0);try{if(q.id&&u.delete){const de=u.delete.replace(":id",String(q.id));await xr.api.delete(de)}const le=q.hash||q.id;q.id&&(D.current.add(q.id),L.current.delete(q.id)),q.hash&&D.current.add(q.hash),S(de=>de.filter(ue=>(ue.hash||ue.id)!==le)),w?.(q.hash||q.id),_(!1),z(null)}catch{console.error("첨부파일 삭제 실패")}finally{G(!1)}},[w,u.delete]),$e=C.useCallback(async q=>{"hash"in q?v?(z(q),_(!0)):await we(q):(q.preview&&URL.revokeObjectURL(q.preview),x(le=>le.filter(de=>de.id!==q.id)))},[v,we]),ze=C.useCallback(q=>{x(le=>le.map(de=>de.id===q.id?{...de,status:"pending",error:void 0}:de))},[]),K=C.useCallback(async q=>{const{arrayMove:le}=await Promise.resolve().then(()=>B0),{active:de,over:ue}=q;if(!ue||de.id===ue.id)return;const ie=[...I,...N];let Fe;if(B.length===0)Fe=ie;else{const xe=new Map(B.map((Pe,Ye)=>[String(Pe),Ye]));Fe=[...ie].sort((Pe,Ye)=>{const rt="hash"in Pe?String(Pe.hash):String(Pe.id),qe="hash"in Ye?String(Ye.hash):String(Ye.id);return(xe.get(rt)??ie.length)-(xe.get(qe)??ie.length)})}const Ce=Fe.findIndex(xe=>"hash"in xe?xe.hash===de.id:xe.id===de.id),Ie=Fe.findIndex(xe=>"hash"in xe?xe.hash===ue.id:xe.id===ue.id),Ne=le(Fe,Ce,Ie);Y(Ne.map(xe=>"hash"in xe?xe.hash:xe.id));const He=Ne.filter(xe=>"hash"in xe),je=Ne.filter(xe=>!("hash"in xe));X.current=!0,S(He),x(je);const _e=He.map((xe,Pe)=>({...xe,sort_order:Pe,order:Pe+1}));if(He.length>0&&u.reorder){const xe=He.map((Pe,Ye)=>({id:Pe.id,order:Ye+1}));try{const Pe=await xr.api.patch(u.reorder,{order:xe});xr.toast.success(Pe.message)}catch(Pe){const Ye=Pe instanceof Error?Pe.message:at("attachment.reorder_failed");xr.toast.error(Ye)}}k?.(_e)},[I,N,B,u.reorder,k]),oe=C.useMemo(()=>[...I,...N].filter(q=>"is_image"in q?q.is_image:q.mime_type?.startsWith("image/")??!1),[I,N]),ae=C.useCallback(q=>{const le=oe.findIndex(de=>"hash"in q&&"hash"in de?de.hash===q.hash:"id"in q&&"id"in de&&!("hash"in q)&&!("hash"in de)?de.id===q.id:!1);le!==-1&&(pe.current+=1,se(le),Q(!0))},[oe]);C.useEffect(()=>{let q=!1;return(async()=>{const de=I.filter(ie=>ie.is_image),ue=new Set(de.map(ie=>ie.id));for(const[ie,Fe]of ve.current)ue.has(ie)||(URL.revokeObjectURL(Fe),ve.current.delete(ie));for(const ie of de){if(q)break;if(!ve.current.has(ie.id)){if(da(ie.download_url)){ve.current.set(ie.id,ie.download_url),Ae(new Map(ve.current));continue}try{const Fe=await xr.api.get(ie.download_url,{responseType:"blob"});if(!q&&Fe){const Ce=URL.createObjectURL(Fe);ve.current.set(ie.id,Ce),Ae(new Map(ve.current))}}catch(Fe){console.error("Failed to load authenticated image:",Fe)}}}})(),()=>{q=!0}},[I]),C.useEffect(()=>()=>{ve.current.forEach(q=>URL.revokeObjectURL(q)),ve.current.clear()},[]);const ce=C.useCallback(async q=>{const{executeImageDownload:le}=await Promise.resolve().then(()=>ri);await le({src:q.download_url,downloadUrl:q.download_url,filename:q.original_filename,downloadRequiresAuth:!0})},[]),ke=C.useMemo(()=>{const q=[...I,...N];if(B.length===0)return q;const le=new Map(B.map((de,ue)=>[String(de),ue]));return[...q].sort((de,ue)=>{const ie="hash"in de?String(de.hash):String(de.id),Fe="hash"in ue?String(ue.hash):String(ue.id),Ce=le.get(ie)??q.length,Ie=le.get(Fe)??q.length;return Ce-Ie})},[I,N,B]),Ee=ke.length,Be=Ee>0,Me=Eex([]),[]),De=C.useCallback(()=>N,[N]);return{existingFiles:I,pendingFiles:N,isDragOver:y,setIsDragOver:E,isDeleting:F,totalCount:Ee,hasFiles:Be,canAddMore:Me,allItems:ke,imageFiles:oe,handleFiles:Te,handleRemove:$e,handleRetry:ze,handleUploadAll:Oe,handleOpenGallery:ae,handleDownload:ce,handleDragEnd:K,inputRef:O,galleryOpen:W,setGalleryOpen:Q,galleryStartIndex:be,galleryKeyRef:pe,confirmDialogOpen:U,setConfirmDialogOpen:_,itemToDelete:b,executeRemoveAttachment:we,authenticatedImageUrls:ne,clear:Ke,getPendingFiles:De}}const Ei=({isDragOver:e,canAddMore:t,onFiles:r,setIsDragOver:n,inputRef:o,accept:a,maxFiles:s,maxSize:l,children:f})=>d.jsxs(j,{className:` +`;let ka;function ah(e,t){return new Promise(((r,n)=>{ka||(ka=(function(s){const l=[];return l.push(s),URL.createObjectURL(new Blob(l))})(oh));const o=new Worker(ka);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 mt(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 nh))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 ki(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 ki(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",ah(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=ui(e,a))}catch{}return r(a)}}))}mt.getDataUrlFromFile=pi,mt.getFilefromDataUrl=xa,mt.loadImage=mi,mt.drawImageInCanvas=yi,mt.drawFileInCanvas=Yn,mt.canvasToFile=Xn,mt.getExifOrientation=vi,mt.handleMaxWidthOrHeight=wi,mt.followExifOrientation=xi,mt.cleanupCanvasMemory=Qt,mt.isAutoOrientationInBrowser=Hr,mt.approximateBelowMaximumCanvasSizeOfBrowser=bi,mt.copyExifWithoutOrientation=ui,mt.getBrowserName=wr,mt.version="2.0.2";const sh=window.G7Core,qn=e=>{const t=["B","KB","MB","GB"];let r=0,n=e;for(;n>=1024&&r{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:"업로드 실패"},_i=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",at=(e,t)=>sh?.t?.(e,t)??e,lh="2.0.2";function ih(){const e=window?.G7Core?.asset;if(typeof e?.template=="function")return e.template("sirsoft-basic",`vendor/browser-image-compression/${lh}/browser-image-compression.js`)}const xr=window.G7Core;function Si(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:x,onReorder:k,uploadTriggerEvent:M,confirmBeforeRemove:v,uploadParams:T}=e,[I,S]=C.useState(i),[N,w]=C.useState([]),[y,E]=C.useState(!1),O=C.useRef(null),$=C.useRef(0),P=C.useRef(new Set),L=C.useRef(new Map),[U,_]=C.useState(!1),[b,z]=C.useState(null),[F,G]=C.useState(!1),X=C.useRef(!1),[B,Y]=C.useState([]),H=C.useRef(i),[W,Q]=C.useState(!1),[be,se]=C.useState(0),pe=C.useRef(0),[ne,Ae]=C.useState(new Map),ve=C.useRef(new Map);C.useEffect(()=>{g?.(N)},[N,g]);const We=C.useMemo(()=>{const q=H.current;return q===i?q:q.length!==i.length?(H.current=i,i):q.length===0&&i.length===0?q:i.some((de,ue)=>de.id!==q[ue]?.id)?(H.current=i,i):q},[i]);C.useEffect(()=>{if(X.current)return;const q=We.filter(ue=>!P.current.has(ue.id)&&(!ue.hash||!P.current.has(ue.hash))),le=new Set(q.map(ue=>ue.id)),de=Array.from(L.current.values()).filter(ue=>!le.has(ue.id)&&!P.current.has(ue.id));S([...q,...de])},[We]);const me=C.useCallback(async q=>{const le={maxSizeMB:f?.maxSizeMB??1,maxWidthOrHeight:f?.maxWidthOrHeight??1920,useWebWorker:!0,libURL:ih()};return await mt(q,le)},[f]),Te=C.useCallback(async q=>{const le=I.length+N.length,de=Math.max(0,o-le),ue=Array.from(q).slice(0,de);if(q.length>de){const ie=Array.from(q).slice(de),Fe=at("attachment.upload_limit_exceeded",{max:o});m?.(Fe,ie[0]??q[0])}for(const ie of ue){if(ie.size>a*1024*1024){m?.(`[${ie.name}] 파일 크기(${qn(ie.size)})가 최대 허용 크기(${a}MB)를 초과합니다.`,ie);continue}if(l){const Ce="."+ie.name.split(".").pop()?.toLowerCase();if(!l.split(",").map(He=>He.trim().toLowerCase()).some(He=>{if(He.includes("/")){if(He.endsWith("/*")){const je=He.slice(0,-2);return ie.type.toLowerCase().startsWith(je+"/")}return ie.type.toLowerCase()===He}return Ce===He})){m?.(`[${ie.name}] 허용되지 않는 파일 형식입니다. (허용: ${l})`,ie);continue}}const Fe={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:qn(ie.size),status:"pending",progress:0};if(ie.type.startsWith("image/")&&(Fe.preview=URL.createObjectURL(ie)),w(Ce=>[...Ce,Fe]),ie.type.startsWith("image/")&&f){w(Ce=>Ce.map(Ie=>Ie.id===Fe.id?{...Ie,status:"compressing"}:Ie));try{const Ce=await me(ie);w(Ie=>Ie.map(Ne=>Ne.id===Fe.id?{...Ne,compressedBlob:Ce,size:Ce.size,size_formatted:qn(Ce.size),status:"pending",progress:0}:Ne))}catch{w(Ce=>Ce.map(Ie=>Ie.id===Fe.id?{...Ie,status:"error",error:"이미지 압축 실패"}:Ie))}}}},[I.length,N.length,o,a,l,f,me,m]),ge=C.useCallback(async q=>{const le=new FormData,de=q.compressedBlob?new File([q.compressedBlob],q.original_filename,{type:q.mime_type}):q.file;le.append("file",de),t&&le.append("attachmentable_type",t),r&&le.append("attachmentable_id",String(r)),le.append("collection",n),h.forEach(ue=>{le.append("role_ids[]",String(ue))}),T&&Object.entries(T).forEach(([ue,ie])=>{le.append(ue,ie)});try{const ue=await xr.api.post(u.upload,le,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:Fe=>{const Ce=Math.round(Fe.loaded*100/(Fe.total??1));w(Ie=>Ie.map(Ne=>Ne.id===q.id?{...Ne,progress:Ce}:Ne))}});return ue?.data?.data??ue?.data}catch(ue){const ie=Ci(ue);throw new Error(ie)}},[t,r,n,h,u.upload]),Oe=C.useCallback(async()=>{const q=N.filter(Ce=>Ce.status==="pending"||Ce.status==="error");if(q.length===0)return[];const le=[],de=new Map,ue=[...q],ie=async()=>{for(;ue.length>0&&$.currentIe.map(Ne=>Ne.id===Ce.id?{...Ne,status:"uploading",progress:0}:Ne));try{const Ie=await ge(Ce);if(Ie)le.push(Ie),de.set(String(Ce.id),String(Ie.hash)),L.current.set(Ie.id,Ie),w(Ne=>Ne.filter(He=>He.id!==Ce.id)),S(Ne=>[...Ne,Ie]),Y(Ne=>{if(Ne.length===0)return Ne;const He=String(Ce.id);return Ne.some(_e=>String(_e)===He)?Ne.map(_e=>String(_e)===He?String(Ie.hash):_e):Ne}),Ce.preview&&URL.revokeObjectURL(Ce.preview);else{const Ne=at("attachment.upload_response_invalid");w(He=>He.map(je=>je.id===Ce.id?{...je,status:"error",error:Ne}:je)),m?.(`[${Ce.original_filename}] ${Ne}`,Ce.file)}}catch(Ie){const Ne=Ie instanceof Error?Ie.message:"업로드 실패";w(He=>He.map(je=>je.id===Ce.id?{...je,status:"error",error:Ne}:je)),m?.(`[${Ce.original_filename}] ${Ne}`,Ce.file)}finally{$.current--}}},Fe=Array(Math.min(s,q.length)).fill(null).map(()=>ie());if(await Promise.all(Fe),le.length>0&&(p?.(le),u.reorder&&B.length>0&&k)){const Ce=[...I,...le],Ie=B.map(je=>de.get(String(je))??je),Ne=new Map(Ie.map((je,_e)=>[String(je),_e])),He=[...Ce].sort((je,_e)=>{const xe=Ne.get(String(je.hash))??Ce.length,De=Ne.get(String(_e.hash))??Ce.length;return xe-De}).map((je,_e)=>({...je,sort_order:_e,order:_e+1}));k(He)}return le},[N,s,ge,p,m,B,I,k,u.reorder]);C.useEffect(()=>{if(!M)return;const q=xr.componentEvent.on(M,async()=>{const le=await Oe();return{uploadedAttachments:le,existingFiles:I,allFiles:[...I,...le]}});return()=>{q()}},[M,Oe,I]),C.useEffect(()=>{c&&N.some(q=>q.status==="pending")&&Oe()},[c,N,Oe]);const we=C.useCallback(async q=>{G(!0);try{if(q.id&&u.delete){const de=u.delete.replace(":id",String(q.id));await xr.api.delete(de)}const le=q.hash||q.id;q.id&&(P.current.add(q.id),L.current.delete(q.id)),q.hash&&P.current.add(q.hash),S(de=>de.filter(ue=>(ue.hash||ue.id)!==le)),x?.(q.hash||q.id),_(!1),z(null)}catch{console.error("첨부파일 삭제 실패")}finally{G(!1)}},[x,u.delete]),$e=C.useCallback(async q=>{"hash"in q?v?(z(q),_(!0)):await we(q):(q.preview&&URL.revokeObjectURL(q.preview),w(le=>le.filter(de=>de.id!==q.id)))},[v,we]),ze=C.useCallback(q=>{w(le=>le.map(de=>de.id===q.id?{...de,status:"pending",error:void 0}:de))},[]),K=C.useCallback(async q=>{const{arrayMove:le}=await Promise.resolve().then(()=>B0),{active:de,over:ue}=q;if(!ue||de.id===ue.id)return;const ie=[...I,...N];let Fe;if(B.length===0)Fe=ie;else{const xe=new Map(B.map((De,Ye)=>[String(De),Ye]));Fe=[...ie].sort((De,Ye)=>{const rt="hash"in De?String(De.hash):String(De.id),qe="hash"in Ye?String(Ye.hash):String(Ye.id);return(xe.get(rt)??ie.length)-(xe.get(qe)??ie.length)})}const Ce=Fe.findIndex(xe=>"hash"in xe?xe.hash===de.id:xe.id===de.id),Ie=Fe.findIndex(xe=>"hash"in xe?xe.hash===ue.id:xe.id===ue.id),Ne=le(Fe,Ce,Ie);Y(Ne.map(xe=>"hash"in xe?xe.hash:xe.id));const He=Ne.filter(xe=>"hash"in xe),je=Ne.filter(xe=>!("hash"in xe));X.current=!0,S(He),w(je);const _e=He.map((xe,De)=>({...xe,sort_order:De,order:De+1}));if(He.length>0&&u.reorder){const xe=He.map((De,Ye)=>({id:De.id,order:Ye+1}));try{const De=await xr.api.patch(u.reorder,{order:xe});xr.toast.success(De.message)}catch(De){const Ye=De instanceof Error?De.message:at("attachment.reorder_failed");xr.toast.error(Ye)}}k?.(_e)},[I,N,B,u.reorder,k]),oe=C.useMemo(()=>[...I,...N].filter(q=>"is_image"in q?q.is_image:q.mime_type?.startsWith("image/")??!1),[I,N]),ae=C.useCallback(q=>{const le=oe.findIndex(de=>"hash"in q&&"hash"in de?de.hash===q.hash:"id"in q&&"id"in de&&!("hash"in q)&&!("hash"in de)?de.id===q.id:!1);le!==-1&&(pe.current+=1,se(le),Q(!0))},[oe]);C.useEffect(()=>{let q=!1;return(async()=>{const de=I.filter(ie=>ie.is_image),ue=new Set(de.map(ie=>ie.id));for(const[ie,Fe]of ve.current)ue.has(ie)||(URL.revokeObjectURL(Fe),ve.current.delete(ie));for(const ie of de){if(q)break;if(!ve.current.has(ie.id)){if(da(ie.download_url)){ve.current.set(ie.id,ie.download_url),Ae(new Map(ve.current));continue}try{const Fe=await xr.api.get(ie.download_url,{responseType:"blob"});if(!q&&Fe){const Ce=URL.createObjectURL(Fe);ve.current.set(ie.id,Ce),Ae(new Map(ve.current))}}catch(Fe){console.error("Failed to load authenticated image:",Fe)}}}})(),()=>{q=!0}},[I]),C.useEffect(()=>()=>{ve.current.forEach(q=>URL.revokeObjectURL(q)),ve.current.clear()},[]);const ce=C.useCallback(async q=>{const{executeImageDownload:le}=await Promise.resolve().then(()=>ri);await le({src:q.download_url,downloadUrl:q.download_url,filename:q.original_filename,downloadRequiresAuth:!0})},[]),ke=C.useMemo(()=>{const q=[...I,...N];if(B.length===0)return q;const le=new Map(B.map((de,ue)=>[String(de),ue]));return[...q].sort((de,ue)=>{const ie="hash"in de?String(de.hash):String(de.id),Fe="hash"in ue?String(ue.hash):String(ue.id),Ce=le.get(ie)??q.length,Ie=le.get(Fe)??q.length;return Ce-Ie})},[I,N,B]),Ee=ke.length,Be=Ee>0,Me=Eew([]),[]),Pe=C.useCallback(()=>N,[N]);return{existingFiles:I,pendingFiles:N,isDragOver:y,setIsDragOver:E,isDeleting:F,totalCount:Ee,hasFiles:Be,canAddMore:Me,allItems:ke,imageFiles:oe,handleFiles:Te,handleRemove:$e,handleRetry:ze,handleUploadAll:Oe,handleOpenGallery:ae,handleDownload:ce,handleDragEnd:K,inputRef:O,galleryOpen:W,setGalleryOpen:Q,galleryStartIndex:be,galleryKeyRef:pe,confirmDialogOpen:U,setConfirmDialogOpen:_,itemToDelete:b,executeRemoveAttachment:we,authenticatedImageUrls:ne,clear:Ke,getPendingFiles:Pe}}const Ei=({isDragOver:e,canAddMore:t,onFiles:r,setIsDragOver:n,inputRef:o,accept:a,maxFiles:s,maxSize:l,children:f})=>d.jsxs(j,{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(j,{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(It,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),d.jsx(Gt,{className:"text-sm text-gray-600 dark:text-gray-400",children:at("attachment.drop_or_click")}),d.jsxs(Gt,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[at("attachment.upload_limit",{maxFiles:s,maxSize:l}),a&&` (${a})`]})]}),f]});function ch(){for(var e=arguments.length,t=new Array(e),r=0;rn=>{t.forEach(o=>o(n))},t)}const Zn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ca(e){return"nodeType"in e}function Ct(e){var t,r;return e?Gr(e)?e:Ca(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function _a(e){const{Document:t}=Ct(e);return e instanceof t}function dn(e){return Gr(e)?!1:e instanceof Ct(e).HTMLElement}function Ti(e){return e instanceof Ct(e).SVGElement}function jr(e){return e?Gr(e)?e.document:Ca(e)?_a(e)?e:dn(e)||Ti(e)?e.ownerDocument:document:document:document}const Jt=Zn?C.useLayoutEffect:C.useEffect;function Sa(e){const t=C.useRef(e);return Jt(()=>{t.current=e}),C.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o{e.current=setInterval(n,o)},[]),r=C.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function un(e,t){t===void 0&&(t=[e]);const r=C.useRef(e);return Jt(()=>{r.current!==e&&(r.current=e)},t),r}function fn(e,t){const r=C.useRef();return C.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Qn(e){const t=Sa(e),r=C.useRef(null),n=C.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Ea(e){const t=C.useRef();return C.useEffect(()=>{t.current=e},[e]),t.current}let Ta={};function gn(e,t){return C.useMemo(()=>{if(t)return t;const r=Ta[e]==null?0:Ta[e]+1;return Ta[e]=r,e+"-"+r},[e,t])}function Ai(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o{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 Br=Ai(1),hn=Ai(-1);function uh(e){return"clientX"in e&&"clientY"in e}function Aa(e){if(!e)return!1;const{KeyboardEvent:t}=Ct(e.target);return t&&e instanceof t}function fh(e){if(!e)return!1;const{TouchEvent:t}=Ct(e.target);return t&&e instanceof t}function Na(e){if(fh(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 uh(e)?{x:e.clientX,y:e.clientY}:null}const pn=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[pn.Translate.toString(e),pn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Ni="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function gh(e){return e.matches(Ni)?e:e.querySelector(Ni)}const hh={display:"none"};function ph(e){let{id:t,value:r}=e;return C.createElement("div",{id:t,style:hh},r)}function mh(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 bh(){const[e,t]=C.useState("");return{announce:C.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Oi=C.createContext(null);function yh(e){const t=C.useContext(Oi);C.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function vh(){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 wh={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. - `},xh={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 kh(e){let{announcements:t=xh,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=wh}=e;const{announce:a,announcement:s}=bh(),l=gn("DndLiveRegion"),[f,h]=C.useState(!1);if(C.useEffect(()=>{h(!0)},[]),yh(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(ph,{id:n,value:o.draggable}),C.createElement(mh,{id:l,announcement:s}));return r?tr.createPortal(c,r):c}var st;(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"})(st||(st={}));function Jn(){}function Mi(e,t){return C.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Ch(){for(var e=arguments.length,t=new Array(e),r=0;r[...t].filter(n=>n!=null),[...t])}const qt=Object.freeze({x:0,y:0});function Ii(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Pi(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function _h(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Di(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 Li(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function $i(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 Sh=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=$i(t,t.left,t.top),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=Ii($i(f),o);a.push({id:l,data:{droppableContainer:s,value:h}})}}return a.sort(Pi)},Eh=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=Di(t),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=Di(f),c=o.reduce((u,g,p)=>u+Ii(h[p],g),0),i=Number((c/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:i}})}}return a.sort(Pi)};function Th(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{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=Th(l,t);f>0&&o.push({id:s,data:{droppableContainer:a,value:f}})}}return o.sort(_h)};function Nh(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Fi(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:qt}function Oh(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a({...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 Mh=Oh(1);function Ih(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 Ph(e,t,r){const n=Ih(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 Dh={ignoreTransform:!1};function Wr(e,t){t===void 0&&(t=Dh);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:h,transformOrigin:c}=Ct(e).getComputedStyle(e);h&&(r=Ph(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 Ui(e){return Wr(e,{ignoreTransform:!0})}function Lh(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function $h(e,t){return t===void 0&&(t=Ct(e).getComputedStyle(e)),t.position==="fixed"}function Fh(e,t){t===void 0&&(t=Ct(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 Rn(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(_a(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!dn(o)||Ti(o)||r.includes(o))return r;const a=Ct(e).getComputedStyle(o);return o!==e&&Fh(o,a)&&r.push(o),$h(o,a)?r:n(o.parentNode)}return e?n(e):r}function zi(e){const[t]=Rn(e,1);return t??null}function Oa(e){return!Zn||!e?null:Gr(e)?e:Ca(e)?_a(e)||e===jr(e).scrollingElement?window:dn(e)?e:null:null}function Hi(e){return Gr(e)?e.scrollX:e.scrollLeft}function Gi(e){return Gr(e)?e.scrollY:e.scrollTop}function Ma(e){return{x:Hi(e),y:Gi(e)}}var ut;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ut||(ut={}));function ji(e){return!Zn||!e?!1:e===document.scrollingElement}function Bi(e){const t={x:0,y:0},r=ji(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 Uh={x:.2,y:.2};function zh(e,t,r,n,o){let{top:a,left:s,right:l,bottom:f}=r;n===void 0&&(n=10),o===void 0&&(o=Uh);const{isTop:h,isBottom:c,isLeft:i,isRight:u}=Bi(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=ut.Backward,p.y=n*Math.abs((t.top+m.height-a)/m.height)):!c&&f>=t.bottom-m.height&&(g.y=ut.Forward,p.y=n*Math.abs((t.bottom-m.height-f)/m.height)),!u&&l>=t.right-m.width?(g.x=ut.Forward,p.x=n*Math.abs((t.right-m.width-l)/m.width)):!i&&s<=t.left+m.width&&(g.x=ut.Backward,p.x=n*Math.abs((t.left+m.width-s)/m.width)),{direction:g,speed:p}}function Hh(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 Wi(e){return e.reduce((t,r)=>Br(t,Ma(r)),qt)}function Gh(e){return e.reduce((t,r)=>t+Hi(r),0)}function jh(e){return e.reduce((t,r)=>t+Gi(r),0)}function Bh(e,t){if(t===void 0&&(t=Wr),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);zi(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Wh=[["x",["left","right"],Gh],["y",["top","bottom"],jh]];class Ia{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=Rn(r),o=Wi(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,l]of Wh)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 mn{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 Vh(e){const{EventTarget:t}=Ct(e);return e instanceof t?e:jr(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 zt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(zt||(zt={}));function Vi(e){e.preventDefault()}function Kh(e){e.stopPropagation()}var Ue;(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"})(Ue||(Ue={}));const Ki={start:[Ue.Space,Ue.Enter],cancel:[Ue.Esc],end:[Ue.Space,Ue.Enter,Ue.Tab]},Yh=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ue.Right:return{...r,x:r.x+25};case Ue.Left:return{...r,x:r.x-25};case Ue.Down:return{...r,y:r.y+25};case Ue.Up:return{...r,y:r.y-25}}};class Da{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 mn(jr(r)),this.windowListeners=new mn(Ct(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(zt.Resize,this.handleCancel),this.windowListeners.add(zt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(zt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Bh(n),r(qt)}handleKeyDown(t){if(Aa(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=Ki,coordinateGetter:s=Yh,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}:qt;this.referenceCoordinates||(this.referenceCoordinates=c);const i=s(t,{active:r,context:n.current,currentCoordinates:c});if(i){const u=hn(i,c),g={x:0,y:0},{scrollableAncestors:p}=n.current;for(const m of p){const w=t.code,{isTop:k,isRight:M,isLeft:v,isBottom:T,maxScroll:I,minScroll:S}=Bi(m),N=Hh(m),x={x:Math.min(w===Ue.Right?N.right-N.width/2:N.right,Math.max(w===Ue.Right?N.left:N.left+N.width/2,i.x)),y:Math.min(w===Ue.Down?N.bottom-N.height/2:N.bottom,Math.max(w===Ue.Down?N.top:N.top+N.height/2,i.y))},y=w===Ue.Right&&!M||w===Ue.Left&&!v,E=w===Ue.Down&&!T||w===Ue.Up&&!k;if(y&&x.x!==i.x){const O=m.scrollLeft+u.x,$=w===Ue.Right&&O<=I.x||w===Ue.Left&&O>=S.x;if($&&!u.y){m.scrollTo({left:O,behavior:l});return}$?g.x=m.scrollLeft-O:g.x=w===Ue.Right?m.scrollLeft-I.x:m.scrollLeft-S.x,g.x&&m.scrollBy({left:-g.x,behavior:l});break}else if(E&&x.y!==i.y){const O=m.scrollTop+u.y,$=w===Ue.Down&&O<=I.y||w===Ue.Up&&O>=S.y;if($&&!u.x){m.scrollTo({top:O,behavior:l});return}$?g.y=m.scrollTop-O:g.y=w===Ue.Down?m.scrollTop-I.y:m.scrollTop-S.y,g.y&&m.scrollBy({top:-g.y,behavior:l});break}}this.handleMove(t,Br(hn(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()}}Da.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Ki,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 Yi(e){return!!(e&&"distance"in e)}function Xi(e){return!!(e&&"delay"in e)}class La{constructor(t,r,n){var o;n===void 0&&(n=Vh(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=jr(s),this.documentListeners=new mn(this.document),this.listeners=new mn(n),this.windowListeners=new mn(Ct(s)),this.initialCoordinates=(o=Na(a))!=null?o:qt,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(zt.Resize,this.handleCancel),this.windowListeners.add(zt.DragStart,Vi),this.windowListeners.add(zt.VisibilityChange,this.handleCancel),this.windowListeners.add(zt.ContextMenu,Vi),this.documentListeners.add(zt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Xi(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Yi(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(zt.Click,Kh,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(zt.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=Na(t))!=null?r:qt,h=hn(o,f);if(!n&&l){if(Yi(l)){if(l.tolerance!=null&&Pa(h,l.tolerance))return this.handleCancel();if(Pa(h,l.distance))return this.handleStart()}if(Xi(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===Ue.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Xh={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $a extends La{constructor(t){const{event:r}=t,n=jr(r.target);super(t,Xh,n)}}$a.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 qh={move:{name:"mousemove"},end:{name:"mouseup"}};var Fa;(function(e){e[e.RightClick=2]="RightClick"})(Fa||(Fa={}));class Zh extends La{constructor(t){super(t,qh,jr(t.event.target))}}Zh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Fa.RightClick?!1:(n?.({event:r}),!0)}}];const Ua={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Qh extends La{constructor(t){super(t,Ua)}static setup(){return window.addEventListener(Ua.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ua.move.name,t)};function t(){}}}Qh.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 bn;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(bn||(bn={}));var eo;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(eo||(eo={}));function Jh(e){let{acceleration:t,activator:r=bn.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:l=eo.TreeOrder,pointerCoordinates:f,scrollableAncestors:h,scrollableAncestorRects:c,delta:i,threshold:u}=e;const g=e0({delta:i,disabled:!a}),[p,m]=dh(),w=C.useRef({x:0,y:0}),k=C.useRef({x:0,y:0}),M=C.useMemo(()=>{switch(r){case bn.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case bn.DraggableRect:return o}},[r,o,f]),v=C.useRef(null),T=C.useCallback(()=>{const S=v.current;if(!S)return;const N=w.current.x*k.current.x,x=w.current.y*k.current.y;S.scrollBy(N,x)},[]),I=C.useMemo(()=>l===eo.TreeOrder?[...h].reverse():h,[l,h]);C.useEffect(()=>{if(!a||!h.length||!M){m();return}for(const S of I){if(n?.(S)===!1)continue;const N=h.indexOf(S),x=c[N];if(!x)continue;const{direction:y,speed:E}=zh(S,x,M,t,u);for(const O of["x","y"])g[O][y[O]]||(E[O]=0,y[O]=0);if(E.x>0||E.y>0){m(),v.current=S,p(T,s),w.current=E,k.current=y;return}}w.current={x:0,y:0},k.current={x:0,y:0},m()},[t,T,n,m,a,s,JSON.stringify(M),JSON.stringify(g),p,h,I,c,JSON.stringify(u)])}const Rh={x:{[ut.Backward]:!1,[ut.Forward]:!1},y:{[ut.Backward]:!1,[ut.Forward]:!1}};function e0(e){let{delta:t,disabled:r}=e;const n=Ea(t);return fn(o=>{if(r||!n||!o)return Rh;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[ut.Backward]:o.x[ut.Backward]||a.x===-1,[ut.Forward]:o.x[ut.Forward]||a.x===1},y:{[ut.Backward]:o.y[ut.Backward]||a.y===-1,[ut.Forward]:o.y[ut.Forward]||a.y===1}}},[r,t,n])}function t0(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return fn(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function r0(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 yn;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(yn||(yn={}));var za;(function(e){e.Optimized="optimized"})(za||(za={}));const qi=new Map;function n0(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=w(),u=un(i),g=C.useCallback(function(k){k===void 0&&(k=[]),!u.current&&s(M=>M===null?k:M.concat(k.filter(v=>!M.includes(v))))},[u]),p=C.useRef(null),m=fn(k=>{if(i&&!r)return qi;if(!k||k===qi||c.current!==e||a!=null){const M=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){M.set(v.id,v.rect.current);continue}const T=v.node.current,I=T?new Ia(f(T),T):null;v.rect.current=I,I&&M.set(v.id,I)}return M}return k},[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 w(){switch(h){case yn.Always:return!1;case yn.BeforeDragging:return r;default:return!r}}}function Zi(e,t){return fn(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function o0(e,t){return Zi(e,t)}function a0(e){let{callback:t,disabled:r}=e;const n=Sa(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 to(e){let{callback:t,disabled:r}=e;const n=Sa(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 s0(e){return new Ia(Wr(e),e)}function Qi(e,t,r){t===void 0&&(t=s0);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=a0({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=to({callback:a});return Jt(()=>{a(),e?(l?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),s?.disconnect())},[e]),n}function l0(e){const t=Zi(e);return Fi(e,t)}const Ji=[];function i0(e){const t=C.useRef(e),r=fn(n=>e?n&&n!==Ji&&e&&t.current&&e.parentNode===t.current.parentNode?n:Rn(e):Ji,[e]);return C.useEffect(()=>{t.current=e},[e]),r}function c0(e){const[t,r]=C.useState(null),n=C.useRef(e),o=C.useCallback(a=>{const s=Oa(a.target);s&&r(l=>l?(l.set(s,Ma(s)),new Map(l)):null)},[]);return C.useEffect(()=>{const a=n.current;if(e!==a){s(a);const l=e.map(f=>{const h=Oa(f);return h?(h.addEventListener("scroll",o,{passive:!0}),[h,Ma(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=Oa(f);h?.removeEventListener("scroll",o)})}},[o,e]),C.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>Br(a,s),qt):Wi(e):qt,[e,t])}function Ri(e,t){t===void 0&&(t=[]);const r=C.useRef(null);return C.useEffect(()=>{r.current=null},t),C.useEffect(()=>{const n=e!==qt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?hn(e,r.current):qt}function d0(e){C.useEffect(()=>{if(!Zn)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 u0(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 ec(e){return C.useMemo(()=>e?Lh(e):null,[e])}const tc=[];function f0(e,t){t===void 0&&(t=Wr);const[r]=e,n=ec(r?Ct(r):null),[o,a]=C.useState(tc);function s(){a(()=>e.length?e.map(f=>ji(f)?n:new Ia(t(f),f)):tc)}const l=to({callback:s});return Jt(()=>{l?.disconnect(),s(),e.forEach(f=>l?.observe(f))},[e]),o}function g0(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return dn(t)?t:e}function h0(e){let{measure:t}=e;const[r,n]=C.useState(null),o=C.useCallback(h=>{for(const{target:c}of h)if(dn(c)){n(i=>{const u=t(c);return i?{...i,width:u.width,height:u.height}:u});break}},[t]),a=to({callback:o}),s=C.useCallback(h=>{const c=g0(h);a?.disconnect(),c&&a?.observe(c),n(c?t(c):null)},[t,a]),[l,f]=Qn(s);return C.useMemo(()=>({nodeRef:l,rect:r,setRef:f}),[r,l,f])}const p0=[{sensor:$a,options:{}},{sensor:Da,options:{}}],m0={current:{}},ro={draggable:{measure:Ui},droppable:{measure:Ui,strategy:yn.WhileDragging,frequency:za.Optimized},dragOverlay:{measure:Wr}};class vn 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 b0={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new vn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Jn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ro,measureDroppableContainers:Jn,windowRect:null,measuringScheduled:!1},y0={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Jn,draggableNodes:new Map,over:null,measureDroppableContainers:Jn},no=C.createContext(y0),rc=C.createContext(b0);function v0(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vn}}}function w0(e,t){switch(t.type){case st.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case st.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 st.DragEnd:case st.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case st.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new vn(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case st.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 vn(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case st.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new vn(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function x0(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=C.useContext(no),a=Ea(n),s=Ea(r?.id);return C.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!Aa(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=gh(c);if(i){i.focus();break}}})}},[n,t,o,s,a]),null}function k0(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function C0(e){return C.useMemo(()=>({draggable:{...ro.draggable,...e?.draggable},droppable:{...ro.droppable,...e?.droppable},dragOverlay:{...ro.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _0(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;Jt(()=>{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=Fi(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=zi(h);u&&u.scrollBy({top:i.y,left:i.x})}},[t,s,l,n,r])}const nc=C.createContext({...qt,scaleX:1,scaleY:1});var ar;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ar||(ar={}));const S0=C.memo(function(t){var r,n,o,a;let{id:s,accessibility:l,autoScroll:f=!0,children:h,sensors:c=p0,collisionDetection:i=Ah,measuring:u,modifiers:g,...p}=t;const m=C.useReducer(w0,void 0,v0),[w,k]=m,[M,v]=vh(),[T,I]=C.useState(ar.Uninitialized),S=T===ar.Initialized,{draggable:{active:N,nodes:x,translate:y},droppable:{containers:E}}=w,O=N!=null?x.get(N):null,$=C.useRef({initial:null,translated:null}),D=C.useMemo(()=>{var _e;return N!=null?{id:N,data:(_e=O?.data)!=null?_e:m0,rect:$}:null},[N,O]),L=C.useRef(null),[U,_]=C.useState(null),[b,z]=C.useState(null),F=un(p,Object.values(p)),G=gn("DndDescribedBy",s),X=C.useMemo(()=>E.getEnabled(),[E]),B=C0(u),{droppableRects:Y,measureDroppableContainers:H,measuringScheduled:W}=n0(X,{dragging:S,dependencies:[y.x,y.y],config:B.droppable}),Q=t0(x,N),be=C.useMemo(()=>b?Na(b):null,[b]),se=je(),pe=o0(Q,B.draggable.measure);_0({activeNode:N!=null?x.get(N):null,config:se.layoutShiftCompensation,initialRect:pe,measure:B.draggable.measure});const ne=Qi(Q,B.draggable.measure,pe),Ae=Qi(Q?Q.parentElement:null),ve=C.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:x,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),We=E.getNodeFor((r=ve.current.over)==null?void 0:r.id),me=h0({measure:B.dragOverlay.measure}),Te=(n=me.nodeRef.current)!=null?n:Q,ge=S?(o=me.rect)!=null?o:ne:null,Oe=!!(me.nodeRef.current&&me.rect),we=l0(Oe?null:ne),$e=ec(Te?Ct(Te):null),ze=i0(S?We??Q:null),K=f0(ze),oe=k0(g,{transform:{x:y.x-we.x,y:y.y-we.y,scaleX:1,scaleY:1},activatorEvent:b,active:D,activeNodeRect:ne,containerNodeRect:Ae,draggingNodeRect:ge,over:ve.current.over,overlayNodeRect:me.rect,scrollableAncestors:ze,scrollableAncestorRects:K,windowRect:$e}),ae=be?Br(be,y):null,ce=c0(ze),ke=Ri(ce),Ee=Ri(ce,[ne]),Be=Br(oe,ke),Me=ge?Mh(ge,oe):null,Ke=D&&Me?i({active:D,collisionRect:Me,droppableRects:Y,droppableContainers:X,pointerCoordinates:ae}):null,De=Li(Ke,"id"),[q,le]=C.useState(null),de=Oe?oe:Br(oe,Ee),ue=Nh(de,(a=q?.rect)!=null?a:null,ne),ie=C.useRef(null),Fe=C.useCallback((_e,xe)=>{let{sensor:Pe,options:Ye}=xe;if(L.current==null)return;const rt=x.get(L.current);if(!rt)return;const qe=_e.nativeEvent,Je=new Pe({active:L.current,activeNode:rt,event:qe,options:Ye,context:ve,onAbort(Ve){if(!x.get(Ve))return;const{onDragAbort:St}=F.current,Dt={id:Ve};St?.(Dt),M({type:"onDragAbort",event:Dt})},onPending(Ve,bt,St,Dt){if(!x.get(Ve))return;const{onDragPending:lr}=F.current,Ht={id:Ve,constraint:bt,initialCoordinates:St,offset:Dt};lr?.(Ht),M({type:"onDragPending",event:Ht})},onStart(Ve){const bt=L.current;if(bt==null)return;const St=x.get(bt);if(!St)return;const{onDragStart:Dt}=F.current,_r={activatorEvent:qe,active:{id:bt,data:St.data,rect:$}};tr.unstable_batchedUpdates(()=>{Dt?.(_r),I(ar.Initializing),k({type:st.DragStart,initialCoordinates:Ve,active:bt}),M({type:"onDragStart",event:_r}),_(ie.current),z(qe)})},onMove(Ve){k({type:st.DragMove,coordinates:Ve})},onEnd:Zt(st.DragEnd),onCancel:Zt(st.DragCancel)});ie.current=Je;function Zt(Ve){return async function(){const{active:St,collisions:Dt,over:_r,scrollAdjustedTranslate:lr}=ve.current;let Ht=null;if(St&&lr){const{cancelDrop:ir}=F.current;Ht={activatorEvent:qe,active:St,collisions:Dt,delta:lr,over:_r},Ve===st.DragEnd&&typeof ir=="function"&&await Promise.resolve(ir(Ht))&&(Ve=st.DragCancel)}L.current=null,tr.unstable_batchedUpdates(()=>{k({type:Ve}),I(ar.Uninitialized),le(null),_(null),z(null),ie.current=null;const ir=Ve===st.DragEnd?"onDragEnd":"onDragCancel";if(Ht){const Sr=F.current[ir];Sr?.(Ht),M({type:ir,event:Ht})}})}}},[x]),Ce=C.useCallback((_e,xe)=>(Pe,Ye)=>{const rt=Pe.nativeEvent,qe=x.get(Ye);if(L.current!==null||!qe||rt.dndKit||rt.defaultPrevented)return;const Je={active:qe};_e(Pe,xe.options,Je)===!0&&(rt.dndKit={capturedBy:xe.sensor},L.current=Ye,Fe(Pe,xe))},[x,Fe]),Ie=r0(c,Ce);d0(c),Jt(()=>{ne&&T===ar.Initializing&&I(ar.Initialized)},[ne,T]),C.useEffect(()=>{const{onDragMove:_e}=F.current,{active:xe,activatorEvent:Pe,collisions:Ye,over:rt}=ve.current;if(!xe||!Pe)return;const qe={active:xe,activatorEvent:Pe,collisions:Ye,delta:{x:Be.x,y:Be.y},over:rt};tr.unstable_batchedUpdates(()=>{_e?.(qe),M({type:"onDragMove",event:qe})})},[Be.x,Be.y]),C.useEffect(()=>{const{active:_e,activatorEvent:xe,collisions:Pe,droppableContainers:Ye,scrollAdjustedTranslate:rt}=ve.current;if(!_e||L.current==null||!xe||!rt)return;const{onDragOver:qe}=F.current,Je=Ye.get(De),Zt=Je&&Je.rect.current?{id:Je.id,rect:Je.rect.current,data:Je.data,disabled:Je.disabled}:null,Ve={active:_e,activatorEvent:xe,collisions:Pe,delta:{x:rt.x,y:rt.y},over:Zt};tr.unstable_batchedUpdates(()=>{le(Zt),qe?.(Ve),M({type:"onDragOver",event:Ve})})},[De]),Jt(()=>{ve.current={activatorEvent:b,active:D,activeNode:Q,collisionRect:Me,collisions:Ke,droppableRects:Y,draggableNodes:x,draggingNode:Te,draggingNodeRect:ge,droppableContainers:E,over:q,scrollableAncestors:ze,scrollAdjustedTranslate:Be},$.current={initial:ge,translated:Me}},[D,Q,Ke,Me,x,Te,ge,Y,E,q,ze,Be]),Jh({...se,delta:y,draggingRect:Me,pointerCoordinates:ae,scrollableAncestors:ze,scrollableAncestorRects:K});const Ne=C.useMemo(()=>({active:D,activeNode:Q,activeNodeRect:ne,activatorEvent:b,collisions:Ke,containerNodeRect:Ae,dragOverlay:me,draggableNodes:x,droppableContainers:E,droppableRects:Y,over:q,measureDroppableContainers:H,scrollableAncestors:ze,scrollableAncestorRects:K,measuringConfiguration:B,measuringScheduled:W,windowRect:$e}),[D,Q,ne,b,Ke,Ae,me,x,E,Y,q,H,ze,K,B,W,$e]),He=C.useMemo(()=>({activatorEvent:b,activators:Ie,active:D,activeNodeRect:ne,ariaDescribedById:{draggable:G},dispatch:k,draggableNodes:x,over:q,measureDroppableContainers:H}),[b,Ie,D,ne,k,G,x,q,H]);return C.createElement(Oi.Provider,{value:v},C.createElement(no.Provider,{value:He},C.createElement(rc.Provider,{value:Ne},C.createElement(nc.Provider,{value:ue},h)),C.createElement(x0,{disabled:l?.restoreFocus===!1})),C.createElement(kh,{...l,hiddenTextDescribedById:G}));function je(){const _e=U?.autoScrollEnabled===!1,xe=typeof f=="object"?f.enabled===!1:f===!1,Pe=S&&!_e&&!xe;return typeof f=="object"?{...f,enabled:Pe}:{enabled:Pe}}}),E0=C.createContext(null),oc="button",T0="Draggable";function A0(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=gn(T0),{activators:s,activatorEvent:l,active:f,activeNodeRect:h,ariaDescribedById:c,draggableNodes:i,over:u}=C.useContext(no),{role:g=oc,roleDescription:p="draggable",tabIndex:m=0}=o??{},w=f?.id===t,k=C.useContext(w?nc:E0),[M,v]=Qn(),[T,I]=Qn(),S=u0(s,t),N=un(r);Jt(()=>(i.set(t,{id:t,key:a,node:M,activatorNode:T,data:N}),()=>{const y=i.get(t);y&&y.key===a&&i.delete(t)}),[i,t]);const x=C.useMemo(()=>({role:g,tabIndex:m,"aria-disabled":n,"aria-pressed":w&&g===oc?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[n,g,m,w,p,c.draggable]);return{active:f,activatorEvent:l,activeNodeRect:h,attributes:x,isDragging:w,listeners:n?void 0:S,node:M,over:u,setNodeRef:v,setActivatorNodeRef:I,transform:k}}function N0(){return C.useContext(rc)}const O0="Droppable",M0={timeout:25};function I0(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=gn(O0),{active:s,dispatch:l,over:f,measureDroppableContainers:h}=C.useContext(no),c=C.useRef({disabled:r}),i=C.useRef(!1),u=C.useRef(null),g=C.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:w}={...M0,...o},k=un(m??n),M=C.useCallback(()=>{if(!i.current){i.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{h(Array.isArray(k.current)?k.current:[k.current]),g.current=null},w)},[w]),v=to({callback:M,disabled:p||!s}),T=C.useCallback((x,y)=>{v&&(y&&(v.unobserve(y),i.current=!1),x&&v.observe(x))},[v]),[I,S]=Qn(T),N=un(t);return C.useEffect(()=>{!v||!I.current||(v.disconnect(),i.current=!1,v.observe(I.current))},[I,v]),C.useEffect(()=>(l({type:st.RegisterDroppable,element:{id:n,key:a,disabled:r,node:I,rect:u,data:N}}),()=>l({type:st.UnregisterDroppable,key:a,id:n})),[n]),C.useEffect(()=>{r!==c.current.disabled&&(l({type:st.SetDroppableDisabled,id:n,key:a,disabled:r}),c.current.disabled=r)},[n,a,r,l]),{active:s,rect:u,isOver:f?.id===n,node:I,over:f,setNodeRef:S}}function Ha(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function P0(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function oo(e){return e!==null&&e>=0}function D0(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=Ha(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}},ac="Sortable",sc=C.createContext({activeIndex:-1,containerId:ac,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ao,disabled:{draggable:!1,droppable:!1}});function lc(e){let{children:t,id:r,items:n,strategy:o=ao,disabled:a=!1}=e;const{active:s,dragOverlay:l,droppableRects:f,over:h,measureDroppableContainers:c}=N0(),i=gn(ac,r),u=l.rect!==null,g=C.useMemo(()=>n.map(S=>typeof S=="object"&&"id"in S?S.id:S),[n]),p=s!=null,m=s?g.indexOf(s.id):-1,w=h?g.indexOf(h.id):-1,k=C.useRef(g),M=!D0(g,k.current),v=w!==-1&&m===-1||M,T=L0(a);Jt(()=>{M&&p&&c(g)},[M,g,p,c]),C.useEffect(()=>{k.current=g},[g]);const I=C.useMemo(()=>({activeIndex:m,containerId:i,disabled:T,disableTransforms:v,items:g,overIndex:w,useDragOverlay:u,sortedRects:P0(g,f),strategy:o}),[m,i,T.draggable,T.droppable,v,g,w,f,u,o]);return C.createElement(sc.Provider,{value:I},t)}const ic=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return Ha(r,n,o).indexOf(t)},cc=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},$0={duration:200,easing:"ease"},dc="transform",F0=pn.Transition.toString({property:dc,duration:0,easing:"linear"}),U0={roleDescription:"sortable"};function z0(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=C.useState(null),l=C.useRef(r);return Jt(()=>{if(!t&&r!==l.current&&n.current){const f=o.current;if(f){const h=Wr(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 uc(e){let{animateLayoutChanges:t=cc,attributes:r,disabled:n,data:o,getNewIndex:a=ic,id:s,strategy:l,resizeObserverConfig:f,transition:h=$0}=e;const{items:c,containerId:i,activeIndex:u,disabled:g,disableTransforms:p,sortedRects:m,overIndex:w,useDragOverlay:k,strategy:M}=C.useContext(sc),v=H0(n,g),T=c.indexOf(s),I=C.useMemo(()=>({sortable:{containerId:i,index:T,items:c},...o}),[i,o,T,c]),S=C.useMemo(()=>c.slice(c.indexOf(s)),[c,s]),{rect:N,node:x,isOver:y,setNodeRef:E}=I0({id:s,data:I,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...f}}),{active:O,activatorEvent:$,activeNodeRect:D,attributes:L,setNodeRef:U,listeners:_,isDragging:b,over:z,setActivatorNodeRef:F,transform:G}=A0({id:s,data:I,attributes:{...U0,...r},disabled:v.draggable}),X=ch(E,U),B=!!O,Y=B&&!p&&oo(u)&&oo(w),H=!k&&b,W=H&&Y?G:null,be=Y?W??(l??M)({rects:m,activeNodeRect:D,activeIndex:u,overIndex:w,index:T}):null,se=oo(u)&&oo(w)?a({id:s,items:c,activeIndex:u,overIndex:w}):T,pe=O?.id,ne=C.useRef({activeId:pe,items:c,newIndex:se,containerId:i}),Ae=c!==ne.current.items,ve=t({active:O,containerId:i,isDragging:b,isSorting:B,id:s,index:T,items:c,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:h,wasDragging:ne.current.activeId!=null}),We=z0({disabled:!ve,index:T,node:x,rect:N});return C.useEffect(()=>{B&&ne.current.newIndex!==se&&(ne.current.newIndex=se),i!==ne.current.containerId&&(ne.current.containerId=i),c!==ne.current.items&&(ne.current.items=c)},[B,se,i,c]),C.useEffect(()=>{if(pe===ne.current.activeId)return;if(pe!=null&&ne.current.activeId==null){ne.current.activeId=pe;return}const Te=setTimeout(()=>{ne.current.activeId=pe},50);return()=>clearTimeout(Te)},[pe]),{active:O,activeIndex:u,attributes:L,data:I,rect:N,index:T,newIndex:se,items:c,isOver:y,isSorting:B,isDragging:b,listeners:_,node:x,overIndex:w,over:z,setNodeRef:X,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:U,transform:We??be,transition:me()};function me(){if(We||Ae&&ne.current.newIndex===T)return F0;if(!(H&&!Aa($)||!h)&&(B||ve))return pn.Transition.toString({...h,property:dc})}}function H0(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 wn(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 G0=[Ue.Down,Ue.Right,Ue.Up,Ue.Left],fc=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:l}}=t;if(G0.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 Ue.Down:n.topu.top&&f.push(i);break;case Ue.Left:n.left>u.left&&f.push(i);break;case Ue.Right:n.left1&&(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 w=Rn(p).some((S,N)=>l[N]!==S),k=gc(i,u),M=j0(i,u),v=w||!k?{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 v.x&&v.y?T:hn(T,v)}}}};function gc(e,t){return!wn(e)||!wn(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function j0(e,t){return!wn(e)||!wn(t)||!gc(e,t)?!1:e.data.current.sortable.index{const{attributes:l,listeners:f,setNodeRef:h,transform:c,transition:i,isDragging:u}=uc({id:"hash"in e?e.hash:e.id}),g={transform:pn.Transform.toString(c),transition:i,opacity:u?.5:1},p="status"in e&&e.status!==void 0,m=p?e.status:"done",w=m==="uploading",k=m==="compressing",M=m==="error",v=p?e.progress:100,T=p?e.preview:void 0,I=p?e.mime_type?.startsWith("image/")??!1:e.is_image,[S,N]=C.useState(void 0),x=!p&&I?e.download_url:void 0;C.useEffect(()=>{if(!x){N(void 0);return}if(da(x)){N(x);return}let E=!0,O;return(async()=>{try{const D=await W0.api.get(x,{responseType:"blob"});E&&D&&(O=URL.createObjectURL(D),N(O))}catch(D){console.error("Failed to load authenticated image:",D)}})(),()=>{E=!1,O&&URL.revokeObjectURL(O)}},[x]);const y=S;return d.jsxs(j,{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(j,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${I||!p?"cursor-pointer":""}`,onClick:()=>{w||k||(I&&n?n():!p&&o&&o())},children:[T||y?d.jsx(jt,{src:T||y,alt:e.original_filename,className:"w-full h-full object-cover"}):d.jsx(It,{className:`fa-solid ${_i(e.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(w||k)&&d.jsxs(j,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[d.jsx(j,{className:"w-3/4 h-2 bg-gray-700 dark:bg-gray-600 rounded-full overflow-hidden",children:d.jsx(j,{className:"h-full bg-blue-500 dark:bg-blue-400 transition-all",style:{width:`${v}%`}})}),d.jsxs(te,{className:"text-white text-xs mt-1",children:[v,"%"]})]}),M&&d.jsx(j,{className:"absolute inset-0 bg-red-500/50 dark:bg-red-600/50 flex items-center justify-center",children:d.jsx(It,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),s&&d.jsx(R,{type:"button",onClick:E=>{E.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:at(a?"attachment.primary_image":"attachment.set_as_primary"),children:d.jsx(It,{className:"fa-solid fa-star text-xs"})}),d.jsxs(j,{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(R,{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:at("attachment.drag_to_reorder"),onClick:E=>E.stopPropagation(),children:d.jsx(It,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&o&&d.jsx(R,{type:"button",onClick:E=>{E.stopPropagation(),o()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:at("common.download"),children:d.jsx(It,{className:"fa-solid fa-download text-sm"})}),M&&r&&d.jsx(R,{type:"button",onClick:E=>{E.stopPropagation(),r()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:at("common.retry"),children:d.jsx(It,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),d.jsx(R,{type:"button",onClick:E=>{E.stopPropagation(),t()},disabled:w||k,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:at("common.delete"),children:d.jsx(It,{className:"fa-solid fa-times text-sm"})})]})]}),d.jsxs(j,{className:`p-2 ${!p&&o?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&o&&o()},children:[d.jsx(Gt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:e.original_filename,children:e.original_filename}),d.jsx(Gt,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.size_formatted})]})]})},pc=({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=Ch(Mi($a,{activationConstraint:{distance:8}}),Mi(Da,{coordinateGetter:fc}));return d.jsxs(j,{className:"p-3",children:[d.jsx(S0,{sensors:m,collisionDetection:Sh,onDragEnd:c,children:d.jsx(lc,{items:e.map(w=>"hash"in w?w.hash:w.id),strategy:ao,children:d.jsxs(j,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[e.map(w=>{const k="hash"in w,M=k?w.is_image:w.mime_type?.startsWith("image/")??!1;return d.jsx(hc,{file:w,onRemove:()=>s(w),onRetry:"status"in w&&w.status==="error"?()=>l(w):void 0,onImageClick:M?()=>f(w):void 0,onDownload:k?()=>h(w):void 0,isPrimary:u&&k&&(w.hash||w.id)===g,onPrimaryClick:u&&k?()=>p?.(w.hash||w.id):void 0},k?w.hash:w.id)}),t&&d.jsxs(j,{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(It,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),d.jsx(te,{className:"text-xs text-gray-500 dark:text-gray-400",children:at("common.add")})]})]})})}),d.jsxs(j,{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(te,{children:at("attachment.attached_count",{count:r,max:n})}),d.jsxs(te,{children:[at("attachment.max_size",{size:o}),a&&` (${a})`]})]})]})},V0=[],K0=[],so=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=K0,autoUpload:c=!0,onFilesChange:i,onChange:u,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:w,initialFiles:k=V0,className:M="",confirmBeforeRemove:v=!1,confirmRemoveTitle:T,confirmRemoveMessage:I,apiEndpoints:S,uploadParams:N,enablePrimarySelection:x=!1,primaryFileId:y,onPrimaryChange:E,id:O,editorAttrs:$},D)=>{const L={upload:S?.upload??"/api/attachments",delete:S?.delete??"/api/attachments/:id",reorder:S?.reorder??"/api/attachments/reorder"},U=C.useRef(u??i);U.current=u??i;const _=C.useCallback(G=>{const X=U.current;if(!X)return;X({target:{value:G,files:G},preventDefault:()=>{},stopPropagation:()=>{}})},[]),b=Si({attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:h,autoUpload:c,initialFiles:k,endpoints:L,onFilesChange:_,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:w,uploadTriggerEvent:e,confirmBeforeRemove:v,uploadParams:N});C.useImperativeHandle(D,()=>({uploadAll:b.handleUploadAll,clear:b.clear,getPendingFiles:b.getPendingFiles}));const z=C.useMemo(()=>b.imageFiles.map(G=>{const X=!("hash"in G),B=G,Y=G;return X?{src:B.preview||"",filename:B.original_filename,title:B.original_filename,downloadRequiresAuth:!1}:{src:b.authenticatedImageUrls.get(Y.id)||Y.download_url,downloadUrl:Y.download_url,filename:Y.original_filename,title:Y.original_filename,downloadRequiresAuth:!0}}),[b.imageFiles,b.authenticatedImageUrls]),F=C.useMemo(()=>({existingFiles:b.existingFiles,pendingFiles:b.pendingFiles,isDragOver:b.isDragOver,isDeleting:b.isDeleting,maxFiles:o,maxSize:a,accept:l,endpoints:L,confirmBeforeRemove:v,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,v]);return d.jsx(di,{value:F,children:d.jsxs(j,{id:O,className:M,...$,children:[d.jsx(Ei,{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(pc,{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:x,primaryFileId:y,onPrimaryChange:E})}),v&&d.jsx(va,{isOpen:b.confirmDialogOpen,onClose:()=>{b.isDeleting||b.setConfirmDialogOpen(!1)},title:T??at("attachment.delete_confirm_title"),message:I??at("attachment.delete_confirm_message"),confirmText:at("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{b.itemToDelete&&b.executeRemoveAttachment(b.itemToDelete)},isLoading:b.isDeleting,loadingText:at("attachment.deleting")}),z.length>0&&b.galleryOpen&&d.jsx(zr,{images:z,isOpen:!0,onClose:()=>b.setGalleryOpen(!1),startIndex:b.galleryStartIndex,showDownload:!0},`gallery-${b.galleryKeyRef.current}`)]})})});so.displayName="FileUploader";const Y0=Object.freeze(Object.defineProperty({__proto__:null,FileDropZone:Ei,FileList:pc,FileUploader:so,FileUploaderProvider:di,SortableThumbnailItem:hc,default:so,extractErrorMessage:Ci,fileUploaderT:at,formatFileSize:qn,getFileIcon:_i,useFileUploader:Si,useFileUploaderContext:Qg},Symbol.toStringTag,{value:"Module"})),mc=({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}},bc=(e,t)=>window.G7Core?.t?.(e,t)??e,X0=[{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"}],yc=({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"?bc("auth.social.register_with",{provider:h}):bc("auth.social.login_with",{provider:h}),f=X0.filter(h=>e.includes(h.id));return r==="icon"?d.jsx(j,{className:`flex justify-center gap-4 ${n}`,id:o,...a,children:f.map(h=>d.jsx(R,{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(mc,{provider:h.id,className:"w-5 h-5"})},h.id))}):d.jsx(j,{className:`space-y-3 ${n}`,id:o,...a,children:f.map(h=>d.jsxs(R,{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(mc,{provider:h.id,className:"w-5 h-5"}),d.jsx(te,{children:l(h.name)})]},h.id))})},q0=Object.freeze(Object.defineProperty({__proto__:null,default:yc},Symbol.toStringTag,{value:"Module"})),Z0=(e,t)=>window.G7Core?.t?.(e,t)??e,Q0={success:nt.CheckCircle,error:nt.XCircle,warning:nt.ExclamationTriangle,info:nt.InfoCircle},vc={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"}},J0={"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"},Ga=({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(j,{className:`fixed z-[9999] flex flex-col gap-2 ${J0[t]}`,"aria-live":"polite","aria-atomic":"true",children:e.map(l=>d.jsx(R0,{toast:l,position:t,isVisible:o.get(l.id)??!0,onClose:()=>s(l.id)},l.id))})},R0=({toast:e,position:t,isVisible:r,onClose:n})=>{const o=vc[e.type]||vc.info,a=e.icon?e.icon:Q0[e.type],s=t.startsWith("bottom")?"translate-y-2":"-translate-y-2";return d.jsxs(j,{className:` + `},xh={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 kh(e){let{announcements:t=xh,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=wh}=e;const{announce:a,announcement:s}=bh(),l=gn("DndLiveRegion"),[f,h]=C.useState(!1);if(C.useEffect(()=>{h(!0)},[]),yh(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(ph,{id:n,value:o.draggable}),C.createElement(mh,{id:l,announcement:s}));return r?tr.createPortal(c,r):c}var st;(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"})(st||(st={}));function Jn(){}function Mi(e,t){return C.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Ch(){for(var e=arguments.length,t=new Array(e),r=0;r[...t].filter(n=>n!=null),[...t])}const qt=Object.freeze({x:0,y:0});function Ii(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Di(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function _h(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Pi(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 Li(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function $i(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 Sh=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=$i(t,t.left,t.top),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=Ii($i(f),o);a.push({id:l,data:{droppableContainer:s,value:h}})}}return a.sort(Di)},Eh=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=Pi(t),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=Pi(f),c=o.reduce((u,g,p)=>u+Ii(h[p],g),0),i=Number((c/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:i}})}}return a.sort(Di)};function Th(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{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=Th(l,t);f>0&&o.push({id:s,data:{droppableContainer:a,value:f}})}}return o.sort(_h)};function Nh(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Fi(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:qt}function Oh(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a({...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 Mh=Oh(1);function Ih(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 Dh(e,t,r){const n=Ih(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 Ph={ignoreTransform:!1};function Wr(e,t){t===void 0&&(t=Ph);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:h,transformOrigin:c}=Ct(e).getComputedStyle(e);h&&(r=Dh(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 Ui(e){return Wr(e,{ignoreTransform:!0})}function Lh(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function $h(e,t){return t===void 0&&(t=Ct(e).getComputedStyle(e)),t.position==="fixed"}function Fh(e,t){t===void 0&&(t=Ct(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 Rn(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(_a(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!dn(o)||Ti(o)||r.includes(o))return r;const a=Ct(e).getComputedStyle(o);return o!==e&&Fh(o,a)&&r.push(o),$h(o,a)?r:n(o.parentNode)}return e?n(e):r}function zi(e){const[t]=Rn(e,1);return t??null}function Oa(e){return!Zn||!e?null:Gr(e)?e:Ca(e)?_a(e)||e===jr(e).scrollingElement?window:dn(e)?e:null:null}function Hi(e){return Gr(e)?e.scrollX:e.scrollLeft}function Gi(e){return Gr(e)?e.scrollY:e.scrollTop}function Ma(e){return{x:Hi(e),y:Gi(e)}}var ut;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ut||(ut={}));function ji(e){return!Zn||!e?!1:e===document.scrollingElement}function Bi(e){const t={x:0,y:0},r=ji(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 Uh={x:.2,y:.2};function zh(e,t,r,n,o){let{top:a,left:s,right:l,bottom:f}=r;n===void 0&&(n=10),o===void 0&&(o=Uh);const{isTop:h,isBottom:c,isLeft:i,isRight:u}=Bi(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=ut.Backward,p.y=n*Math.abs((t.top+m.height-a)/m.height)):!c&&f>=t.bottom-m.height&&(g.y=ut.Forward,p.y=n*Math.abs((t.bottom-m.height-f)/m.height)),!u&&l>=t.right-m.width?(g.x=ut.Forward,p.x=n*Math.abs((t.right-m.width-l)/m.width)):!i&&s<=t.left+m.width&&(g.x=ut.Backward,p.x=n*Math.abs((t.left+m.width-s)/m.width)),{direction:g,speed:p}}function Hh(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 Wi(e){return e.reduce((t,r)=>Br(t,Ma(r)),qt)}function Gh(e){return e.reduce((t,r)=>t+Hi(r),0)}function jh(e){return e.reduce((t,r)=>t+Gi(r),0)}function Bh(e,t){if(t===void 0&&(t=Wr),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);zi(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Wh=[["x",["left","right"],Gh],["y",["top","bottom"],jh]];class Ia{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=Rn(r),o=Wi(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,l]of Wh)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 mn{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 Vh(e){const{EventTarget:t}=Ct(e);return e instanceof t?e:jr(e)}function Da(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 zt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(zt||(zt={}));function Vi(e){e.preventDefault()}function Kh(e){e.stopPropagation()}var Ue;(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"})(Ue||(Ue={}));const Ki={start:[Ue.Space,Ue.Enter],cancel:[Ue.Esc],end:[Ue.Space,Ue.Enter,Ue.Tab]},Yh=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ue.Right:return{...r,x:r.x+25};case Ue.Left:return{...r,x:r.x-25};case Ue.Down:return{...r,y:r.y+25};case Ue.Up:return{...r,y:r.y-25}}};class Pa{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 mn(jr(r)),this.windowListeners=new mn(Ct(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(zt.Resize,this.handleCancel),this.windowListeners.add(zt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(zt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Bh(n),r(qt)}handleKeyDown(t){if(Aa(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=Ki,coordinateGetter:s=Yh,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}:qt;this.referenceCoordinates||(this.referenceCoordinates=c);const i=s(t,{active:r,context:n.current,currentCoordinates:c});if(i){const u=hn(i,c),g={x:0,y:0},{scrollableAncestors:p}=n.current;for(const m of p){const x=t.code,{isTop:k,isRight:M,isLeft:v,isBottom:T,maxScroll:I,minScroll:S}=Bi(m),N=Hh(m),w={x:Math.min(x===Ue.Right?N.right-N.width/2:N.right,Math.max(x===Ue.Right?N.left:N.left+N.width/2,i.x)),y:Math.min(x===Ue.Down?N.bottom-N.height/2:N.bottom,Math.max(x===Ue.Down?N.top:N.top+N.height/2,i.y))},y=x===Ue.Right&&!M||x===Ue.Left&&!v,E=x===Ue.Down&&!T||x===Ue.Up&&!k;if(y&&w.x!==i.x){const O=m.scrollLeft+u.x,$=x===Ue.Right&&O<=I.x||x===Ue.Left&&O>=S.x;if($&&!u.y){m.scrollTo({left:O,behavior:l});return}$?g.x=m.scrollLeft-O:g.x=x===Ue.Right?m.scrollLeft-I.x:m.scrollLeft-S.x,g.x&&m.scrollBy({left:-g.x,behavior:l});break}else if(E&&w.y!==i.y){const O=m.scrollTop+u.y,$=x===Ue.Down&&O<=I.y||x===Ue.Up&&O>=S.y;if($&&!u.x){m.scrollTo({top:O,behavior:l});return}$?g.y=m.scrollTop-O:g.y=x===Ue.Down?m.scrollTop-I.y:m.scrollTop-S.y,g.y&&m.scrollBy({top:-g.y,behavior:l});break}}this.handleMove(t,Br(hn(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()}}Pa.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Ki,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 Yi(e){return!!(e&&"distance"in e)}function Xi(e){return!!(e&&"delay"in e)}class La{constructor(t,r,n){var o;n===void 0&&(n=Vh(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=jr(s),this.documentListeners=new mn(this.document),this.listeners=new mn(n),this.windowListeners=new mn(Ct(s)),this.initialCoordinates=(o=Na(a))!=null?o:qt,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(zt.Resize,this.handleCancel),this.windowListeners.add(zt.DragStart,Vi),this.windowListeners.add(zt.VisibilityChange,this.handleCancel),this.windowListeners.add(zt.ContextMenu,Vi),this.documentListeners.add(zt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Xi(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Yi(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(zt.Click,Kh,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(zt.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=Na(t))!=null?r:qt,h=hn(o,f);if(!n&&l){if(Yi(l)){if(l.tolerance!=null&&Da(h,l.tolerance))return this.handleCancel();if(Da(h,l.distance))return this.handleStart()}if(Xi(l)&&Da(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===Ue.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Xh={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $a extends La{constructor(t){const{event:r}=t,n=jr(r.target);super(t,Xh,n)}}$a.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 qh={move:{name:"mousemove"},end:{name:"mouseup"}};var Fa;(function(e){e[e.RightClick=2]="RightClick"})(Fa||(Fa={}));class Zh extends La{constructor(t){super(t,qh,jr(t.event.target))}}Zh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Fa.RightClick?!1:(n?.({event:r}),!0)}}];const Ua={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Qh extends La{constructor(t){super(t,Ua)}static setup(){return window.addEventListener(Ua.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ua.move.name,t)};function t(){}}}Qh.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 bn;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(bn||(bn={}));var eo;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(eo||(eo={}));function Jh(e){let{acceleration:t,activator:r=bn.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:l=eo.TreeOrder,pointerCoordinates:f,scrollableAncestors:h,scrollableAncestorRects:c,delta:i,threshold:u}=e;const g=e0({delta:i,disabled:!a}),[p,m]=dh(),x=C.useRef({x:0,y:0}),k=C.useRef({x:0,y:0}),M=C.useMemo(()=>{switch(r){case bn.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case bn.DraggableRect:return o}},[r,o,f]),v=C.useRef(null),T=C.useCallback(()=>{const S=v.current;if(!S)return;const N=x.current.x*k.current.x,w=x.current.y*k.current.y;S.scrollBy(N,w)},[]),I=C.useMemo(()=>l===eo.TreeOrder?[...h].reverse():h,[l,h]);C.useEffect(()=>{if(!a||!h.length||!M){m();return}for(const S of I){if(n?.(S)===!1)continue;const N=h.indexOf(S),w=c[N];if(!w)continue;const{direction:y,speed:E}=zh(S,w,M,t,u);for(const O of["x","y"])g[O][y[O]]||(E[O]=0,y[O]=0);if(E.x>0||E.y>0){m(),v.current=S,p(T,s),x.current=E,k.current=y;return}}x.current={x:0,y:0},k.current={x:0,y:0},m()},[t,T,n,m,a,s,JSON.stringify(M),JSON.stringify(g),p,h,I,c,JSON.stringify(u)])}const Rh={x:{[ut.Backward]:!1,[ut.Forward]:!1},y:{[ut.Backward]:!1,[ut.Forward]:!1}};function e0(e){let{delta:t,disabled:r}=e;const n=Ea(t);return fn(o=>{if(r||!n||!o)return Rh;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[ut.Backward]:o.x[ut.Backward]||a.x===-1,[ut.Forward]:o.x[ut.Forward]||a.x===1},y:{[ut.Backward]:o.y[ut.Backward]||a.y===-1,[ut.Forward]:o.y[ut.Forward]||a.y===1}}},[r,t,n])}function t0(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return fn(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function r0(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 yn;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(yn||(yn={}));var za;(function(e){e.Optimized="optimized"})(za||(za={}));const qi=new Map;function n0(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=x(),u=un(i),g=C.useCallback(function(k){k===void 0&&(k=[]),!u.current&&s(M=>M===null?k:M.concat(k.filter(v=>!M.includes(v))))},[u]),p=C.useRef(null),m=fn(k=>{if(i&&!r)return qi;if(!k||k===qi||c.current!==e||a!=null){const M=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){M.set(v.id,v.rect.current);continue}const T=v.node.current,I=T?new Ia(f(T),T):null;v.rect.current=I,I&&M.set(v.id,I)}return M}return k},[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 x(){switch(h){case yn.Always:return!1;case yn.BeforeDragging:return r;default:return!r}}}function Zi(e,t){return fn(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function o0(e,t){return Zi(e,t)}function a0(e){let{callback:t,disabled:r}=e;const n=Sa(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 to(e){let{callback:t,disabled:r}=e;const n=Sa(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 s0(e){return new Ia(Wr(e),e)}function Qi(e,t,r){t===void 0&&(t=s0);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=a0({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=to({callback:a});return Jt(()=>{a(),e?(l?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),s?.disconnect())},[e]),n}function l0(e){const t=Zi(e);return Fi(e,t)}const Ji=[];function i0(e){const t=C.useRef(e),r=fn(n=>e?n&&n!==Ji&&e&&t.current&&e.parentNode===t.current.parentNode?n:Rn(e):Ji,[e]);return C.useEffect(()=>{t.current=e},[e]),r}function c0(e){const[t,r]=C.useState(null),n=C.useRef(e),o=C.useCallback(a=>{const s=Oa(a.target);s&&r(l=>l?(l.set(s,Ma(s)),new Map(l)):null)},[]);return C.useEffect(()=>{const a=n.current;if(e!==a){s(a);const l=e.map(f=>{const h=Oa(f);return h?(h.addEventListener("scroll",o,{passive:!0}),[h,Ma(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=Oa(f);h?.removeEventListener("scroll",o)})}},[o,e]),C.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>Br(a,s),qt):Wi(e):qt,[e,t])}function Ri(e,t){t===void 0&&(t=[]);const r=C.useRef(null);return C.useEffect(()=>{r.current=null},t),C.useEffect(()=>{const n=e!==qt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?hn(e,r.current):qt}function d0(e){C.useEffect(()=>{if(!Zn)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 u0(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 ec(e){return C.useMemo(()=>e?Lh(e):null,[e])}const tc=[];function f0(e,t){t===void 0&&(t=Wr);const[r]=e,n=ec(r?Ct(r):null),[o,a]=C.useState(tc);function s(){a(()=>e.length?e.map(f=>ji(f)?n:new Ia(t(f),f)):tc)}const l=to({callback:s});return Jt(()=>{l?.disconnect(),s(),e.forEach(f=>l?.observe(f))},[e]),o}function g0(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return dn(t)?t:e}function h0(e){let{measure:t}=e;const[r,n]=C.useState(null),o=C.useCallback(h=>{for(const{target:c}of h)if(dn(c)){n(i=>{const u=t(c);return i?{...i,width:u.width,height:u.height}:u});break}},[t]),a=to({callback:o}),s=C.useCallback(h=>{const c=g0(h);a?.disconnect(),c&&a?.observe(c),n(c?t(c):null)},[t,a]),[l,f]=Qn(s);return C.useMemo(()=>({nodeRef:l,rect:r,setRef:f}),[r,l,f])}const p0=[{sensor:$a,options:{}},{sensor:Pa,options:{}}],m0={current:{}},ro={draggable:{measure:Ui},droppable:{measure:Ui,strategy:yn.WhileDragging,frequency:za.Optimized},dragOverlay:{measure:Wr}};class vn 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 b0={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new vn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Jn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ro,measureDroppableContainers:Jn,windowRect:null,measuringScheduled:!1},y0={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Jn,draggableNodes:new Map,over:null,measureDroppableContainers:Jn},no=C.createContext(y0),rc=C.createContext(b0);function v0(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vn}}}function w0(e,t){switch(t.type){case st.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case st.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 st.DragEnd:case st.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case st.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new vn(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case st.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 vn(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case st.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new vn(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function x0(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=C.useContext(no),a=Ea(n),s=Ea(r?.id);return C.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!Aa(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=gh(c);if(i){i.focus();break}}})}},[n,t,o,s,a]),null}function k0(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function C0(e){return C.useMemo(()=>({draggable:{...ro.draggable,...e?.draggable},droppable:{...ro.droppable,...e?.droppable},dragOverlay:{...ro.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _0(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;Jt(()=>{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=Fi(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=zi(h);u&&u.scrollBy({top:i.y,left:i.x})}},[t,s,l,n,r])}const nc=C.createContext({...qt,scaleX:1,scaleY:1});var ar;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ar||(ar={}));const S0=C.memo(function(t){var r,n,o,a;let{id:s,accessibility:l,autoScroll:f=!0,children:h,sensors:c=p0,collisionDetection:i=Ah,measuring:u,modifiers:g,...p}=t;const m=C.useReducer(w0,void 0,v0),[x,k]=m,[M,v]=vh(),[T,I]=C.useState(ar.Uninitialized),S=T===ar.Initialized,{draggable:{active:N,nodes:w,translate:y},droppable:{containers:E}}=x,O=N!=null?w.get(N):null,$=C.useRef({initial:null,translated:null}),P=C.useMemo(()=>{var _e;return N!=null?{id:N,data:(_e=O?.data)!=null?_e:m0,rect:$}:null},[N,O]),L=C.useRef(null),[U,_]=C.useState(null),[b,z]=C.useState(null),F=un(p,Object.values(p)),G=gn("DndDescribedBy",s),X=C.useMemo(()=>E.getEnabled(),[E]),B=C0(u),{droppableRects:Y,measureDroppableContainers:H,measuringScheduled:W}=n0(X,{dragging:S,dependencies:[y.x,y.y],config:B.droppable}),Q=t0(w,N),be=C.useMemo(()=>b?Na(b):null,[b]),se=je(),pe=o0(Q,B.draggable.measure);_0({activeNode:N!=null?w.get(N):null,config:se.layoutShiftCompensation,initialRect:pe,measure:B.draggable.measure});const ne=Qi(Q,B.draggable.measure,pe),Ae=Qi(Q?Q.parentElement:null),ve=C.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:w,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),We=E.getNodeFor((r=ve.current.over)==null?void 0:r.id),me=h0({measure:B.dragOverlay.measure}),Te=(n=me.nodeRef.current)!=null?n:Q,ge=S?(o=me.rect)!=null?o:ne:null,Oe=!!(me.nodeRef.current&&me.rect),we=l0(Oe?null:ne),$e=ec(Te?Ct(Te):null),ze=i0(S?We??Q:null),K=f0(ze),oe=k0(g,{transform:{x:y.x-we.x,y:y.y-we.y,scaleX:1,scaleY:1},activatorEvent:b,active:P,activeNodeRect:ne,containerNodeRect:Ae,draggingNodeRect:ge,over:ve.current.over,overlayNodeRect:me.rect,scrollableAncestors:ze,scrollableAncestorRects:K,windowRect:$e}),ae=be?Br(be,y):null,ce=c0(ze),ke=Ri(ce),Ee=Ri(ce,[ne]),Be=Br(oe,ke),Me=ge?Mh(ge,oe):null,Ke=P&&Me?i({active:P,collisionRect:Me,droppableRects:Y,droppableContainers:X,pointerCoordinates:ae}):null,Pe=Li(Ke,"id"),[q,le]=C.useState(null),de=Oe?oe:Br(oe,Ee),ue=Nh(de,(a=q?.rect)!=null?a:null,ne),ie=C.useRef(null),Fe=C.useCallback((_e,xe)=>{let{sensor:De,options:Ye}=xe;if(L.current==null)return;const rt=w.get(L.current);if(!rt)return;const qe=_e.nativeEvent,Je=new De({active:L.current,activeNode:rt,event:qe,options:Ye,context:ve,onAbort(Ve){if(!w.get(Ve))return;const{onDragAbort:St}=F.current,Pt={id:Ve};St?.(Pt),M({type:"onDragAbort",event:Pt})},onPending(Ve,bt,St,Pt){if(!w.get(Ve))return;const{onDragPending:lr}=F.current,Ht={id:Ve,constraint:bt,initialCoordinates:St,offset:Pt};lr?.(Ht),M({type:"onDragPending",event:Ht})},onStart(Ve){const bt=L.current;if(bt==null)return;const St=w.get(bt);if(!St)return;const{onDragStart:Pt}=F.current,_r={activatorEvent:qe,active:{id:bt,data:St.data,rect:$}};tr.unstable_batchedUpdates(()=>{Pt?.(_r),I(ar.Initializing),k({type:st.DragStart,initialCoordinates:Ve,active:bt}),M({type:"onDragStart",event:_r}),_(ie.current),z(qe)})},onMove(Ve){k({type:st.DragMove,coordinates:Ve})},onEnd:Zt(st.DragEnd),onCancel:Zt(st.DragCancel)});ie.current=Je;function Zt(Ve){return async function(){const{active:St,collisions:Pt,over:_r,scrollAdjustedTranslate:lr}=ve.current;let Ht=null;if(St&&lr){const{cancelDrop:ir}=F.current;Ht={activatorEvent:qe,active:St,collisions:Pt,delta:lr,over:_r},Ve===st.DragEnd&&typeof ir=="function"&&await Promise.resolve(ir(Ht))&&(Ve=st.DragCancel)}L.current=null,tr.unstable_batchedUpdates(()=>{k({type:Ve}),I(ar.Uninitialized),le(null),_(null),z(null),ie.current=null;const ir=Ve===st.DragEnd?"onDragEnd":"onDragCancel";if(Ht){const Sr=F.current[ir];Sr?.(Ht),M({type:ir,event:Ht})}})}}},[w]),Ce=C.useCallback((_e,xe)=>(De,Ye)=>{const rt=De.nativeEvent,qe=w.get(Ye);if(L.current!==null||!qe||rt.dndKit||rt.defaultPrevented)return;const Je={active:qe};_e(De,xe.options,Je)===!0&&(rt.dndKit={capturedBy:xe.sensor},L.current=Ye,Fe(De,xe))},[w,Fe]),Ie=r0(c,Ce);d0(c),Jt(()=>{ne&&T===ar.Initializing&&I(ar.Initialized)},[ne,T]),C.useEffect(()=>{const{onDragMove:_e}=F.current,{active:xe,activatorEvent:De,collisions:Ye,over:rt}=ve.current;if(!xe||!De)return;const qe={active:xe,activatorEvent:De,collisions:Ye,delta:{x:Be.x,y:Be.y},over:rt};tr.unstable_batchedUpdates(()=>{_e?.(qe),M({type:"onDragMove",event:qe})})},[Be.x,Be.y]),C.useEffect(()=>{const{active:_e,activatorEvent:xe,collisions:De,droppableContainers:Ye,scrollAdjustedTranslate:rt}=ve.current;if(!_e||L.current==null||!xe||!rt)return;const{onDragOver:qe}=F.current,Je=Ye.get(Pe),Zt=Je&&Je.rect.current?{id:Je.id,rect:Je.rect.current,data:Je.data,disabled:Je.disabled}:null,Ve={active:_e,activatorEvent:xe,collisions:De,delta:{x:rt.x,y:rt.y},over:Zt};tr.unstable_batchedUpdates(()=>{le(Zt),qe?.(Ve),M({type:"onDragOver",event:Ve})})},[Pe]),Jt(()=>{ve.current={activatorEvent:b,active:P,activeNode:Q,collisionRect:Me,collisions:Ke,droppableRects:Y,draggableNodes:w,draggingNode:Te,draggingNodeRect:ge,droppableContainers:E,over:q,scrollableAncestors:ze,scrollAdjustedTranslate:Be},$.current={initial:ge,translated:Me}},[P,Q,Ke,Me,w,Te,ge,Y,E,q,ze,Be]),Jh({...se,delta:y,draggingRect:Me,pointerCoordinates:ae,scrollableAncestors:ze,scrollableAncestorRects:K});const Ne=C.useMemo(()=>({active:P,activeNode:Q,activeNodeRect:ne,activatorEvent:b,collisions:Ke,containerNodeRect:Ae,dragOverlay:me,draggableNodes:w,droppableContainers:E,droppableRects:Y,over:q,measureDroppableContainers:H,scrollableAncestors:ze,scrollableAncestorRects:K,measuringConfiguration:B,measuringScheduled:W,windowRect:$e}),[P,Q,ne,b,Ke,Ae,me,w,E,Y,q,H,ze,K,B,W,$e]),He=C.useMemo(()=>({activatorEvent:b,activators:Ie,active:P,activeNodeRect:ne,ariaDescribedById:{draggable:G},dispatch:k,draggableNodes:w,over:q,measureDroppableContainers:H}),[b,Ie,P,ne,k,G,w,q,H]);return C.createElement(Oi.Provider,{value:v},C.createElement(no.Provider,{value:He},C.createElement(rc.Provider,{value:Ne},C.createElement(nc.Provider,{value:ue},h)),C.createElement(x0,{disabled:l?.restoreFocus===!1})),C.createElement(kh,{...l,hiddenTextDescribedById:G}));function je(){const _e=U?.autoScrollEnabled===!1,xe=typeof f=="object"?f.enabled===!1:f===!1,De=S&&!_e&&!xe;return typeof f=="object"?{...f,enabled:De}:{enabled:De}}}),E0=C.createContext(null),oc="button",T0="Draggable";function A0(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=gn(T0),{activators:s,activatorEvent:l,active:f,activeNodeRect:h,ariaDescribedById:c,draggableNodes:i,over:u}=C.useContext(no),{role:g=oc,roleDescription:p="draggable",tabIndex:m=0}=o??{},x=f?.id===t,k=C.useContext(x?nc:E0),[M,v]=Qn(),[T,I]=Qn(),S=u0(s,t),N=un(r);Jt(()=>(i.set(t,{id:t,key:a,node:M,activatorNode:T,data:N}),()=>{const y=i.get(t);y&&y.key===a&&i.delete(t)}),[i,t]);const w=C.useMemo(()=>({role:g,tabIndex:m,"aria-disabled":n,"aria-pressed":x&&g===oc?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[n,g,m,x,p,c.draggable]);return{active:f,activatorEvent:l,activeNodeRect:h,attributes:w,isDragging:x,listeners:n?void 0:S,node:M,over:u,setNodeRef:v,setActivatorNodeRef:I,transform:k}}function N0(){return C.useContext(rc)}const O0="Droppable",M0={timeout:25};function I0(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=gn(O0),{active:s,dispatch:l,over:f,measureDroppableContainers:h}=C.useContext(no),c=C.useRef({disabled:r}),i=C.useRef(!1),u=C.useRef(null),g=C.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:x}={...M0,...o},k=un(m??n),M=C.useCallback(()=>{if(!i.current){i.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{h(Array.isArray(k.current)?k.current:[k.current]),g.current=null},x)},[x]),v=to({callback:M,disabled:p||!s}),T=C.useCallback((w,y)=>{v&&(y&&(v.unobserve(y),i.current=!1),w&&v.observe(w))},[v]),[I,S]=Qn(T),N=un(t);return C.useEffect(()=>{!v||!I.current||(v.disconnect(),i.current=!1,v.observe(I.current))},[I,v]),C.useEffect(()=>(l({type:st.RegisterDroppable,element:{id:n,key:a,disabled:r,node:I,rect:u,data:N}}),()=>l({type:st.UnregisterDroppable,key:a,id:n})),[n]),C.useEffect(()=>{r!==c.current.disabled&&(l({type:st.SetDroppableDisabled,id:n,key:a,disabled:r}),c.current.disabled=r)},[n,a,r,l]),{active:s,rect:u,isOver:f?.id===n,node:I,over:f,setNodeRef:S}}function Ha(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function D0(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function oo(e){return e!==null&&e>=0}function P0(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=Ha(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}},ac="Sortable",sc=C.createContext({activeIndex:-1,containerId:ac,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ao,disabled:{draggable:!1,droppable:!1}});function lc(e){let{children:t,id:r,items:n,strategy:o=ao,disabled:a=!1}=e;const{active:s,dragOverlay:l,droppableRects:f,over:h,measureDroppableContainers:c}=N0(),i=gn(ac,r),u=l.rect!==null,g=C.useMemo(()=>n.map(S=>typeof S=="object"&&"id"in S?S.id:S),[n]),p=s!=null,m=s?g.indexOf(s.id):-1,x=h?g.indexOf(h.id):-1,k=C.useRef(g),M=!P0(g,k.current),v=x!==-1&&m===-1||M,T=L0(a);Jt(()=>{M&&p&&c(g)},[M,g,p,c]),C.useEffect(()=>{k.current=g},[g]);const I=C.useMemo(()=>({activeIndex:m,containerId:i,disabled:T,disableTransforms:v,items:g,overIndex:x,useDragOverlay:u,sortedRects:D0(g,f),strategy:o}),[m,i,T.draggable,T.droppable,v,g,x,f,u,o]);return C.createElement(sc.Provider,{value:I},t)}const ic=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return Ha(r,n,o).indexOf(t)},cc=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},$0={duration:200,easing:"ease"},dc="transform",F0=pn.Transition.toString({property:dc,duration:0,easing:"linear"}),U0={roleDescription:"sortable"};function z0(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=C.useState(null),l=C.useRef(r);return Jt(()=>{if(!t&&r!==l.current&&n.current){const f=o.current;if(f){const h=Wr(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 uc(e){let{animateLayoutChanges:t=cc,attributes:r,disabled:n,data:o,getNewIndex:a=ic,id:s,strategy:l,resizeObserverConfig:f,transition:h=$0}=e;const{items:c,containerId:i,activeIndex:u,disabled:g,disableTransforms:p,sortedRects:m,overIndex:x,useDragOverlay:k,strategy:M}=C.useContext(sc),v=H0(n,g),T=c.indexOf(s),I=C.useMemo(()=>({sortable:{containerId:i,index:T,items:c},...o}),[i,o,T,c]),S=C.useMemo(()=>c.slice(c.indexOf(s)),[c,s]),{rect:N,node:w,isOver:y,setNodeRef:E}=I0({id:s,data:I,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...f}}),{active:O,activatorEvent:$,activeNodeRect:P,attributes:L,setNodeRef:U,listeners:_,isDragging:b,over:z,setActivatorNodeRef:F,transform:G}=A0({id:s,data:I,attributes:{...U0,...r},disabled:v.draggable}),X=ch(E,U),B=!!O,Y=B&&!p&&oo(u)&&oo(x),H=!k&&b,W=H&&Y?G:null,be=Y?W??(l??M)({rects:m,activeNodeRect:P,activeIndex:u,overIndex:x,index:T}):null,se=oo(u)&&oo(x)?a({id:s,items:c,activeIndex:u,overIndex:x}):T,pe=O?.id,ne=C.useRef({activeId:pe,items:c,newIndex:se,containerId:i}),Ae=c!==ne.current.items,ve=t({active:O,containerId:i,isDragging:b,isSorting:B,id:s,index:T,items:c,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:h,wasDragging:ne.current.activeId!=null}),We=z0({disabled:!ve,index:T,node:w,rect:N});return C.useEffect(()=>{B&&ne.current.newIndex!==se&&(ne.current.newIndex=se),i!==ne.current.containerId&&(ne.current.containerId=i),c!==ne.current.items&&(ne.current.items=c)},[B,se,i,c]),C.useEffect(()=>{if(pe===ne.current.activeId)return;if(pe!=null&&ne.current.activeId==null){ne.current.activeId=pe;return}const Te=setTimeout(()=>{ne.current.activeId=pe},50);return()=>clearTimeout(Te)},[pe]),{active:O,activeIndex:u,attributes:L,data:I,rect:N,index:T,newIndex:se,items:c,isOver:y,isSorting:B,isDragging:b,listeners:_,node:w,overIndex:x,over:z,setNodeRef:X,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:U,transform:We??be,transition:me()};function me(){if(We||Ae&&ne.current.newIndex===T)return F0;if(!(H&&!Aa($)||!h)&&(B||ve))return pn.Transition.toString({...h,property:dc})}}function H0(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 wn(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 G0=[Ue.Down,Ue.Right,Ue.Up,Ue.Left],fc=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:l}}=t;if(G0.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 Ue.Down:n.topu.top&&f.push(i);break;case Ue.Left:n.left>u.left&&f.push(i);break;case Ue.Right:n.left1&&(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 x=Rn(p).some((S,N)=>l[N]!==S),k=gc(i,u),M=j0(i,u),v=x||!k?{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 v.x&&v.y?T:hn(T,v)}}}};function gc(e,t){return!wn(e)||!wn(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function j0(e,t){return!wn(e)||!wn(t)||!gc(e,t)?!1:e.data.current.sortable.index{const{attributes:l,listeners:f,setNodeRef:h,transform:c,transition:i,isDragging:u}=uc({id:"hash"in e?e.hash:e.id}),g={transform:pn.Transform.toString(c),transition:i,opacity:u?.5:1},p="status"in e&&e.status!==void 0,m=p?e.status:"done",x=m==="uploading",k=m==="compressing",M=m==="error",v=p?e.progress:100,T=p?e.preview:void 0,I=p?e.mime_type?.startsWith("image/")??!1:e.is_image,[S,N]=C.useState(void 0),w=!p&&I?e.download_url:void 0;C.useEffect(()=>{if(!w){N(void 0);return}if(da(w)){N(w);return}let E=!0,O;return(async()=>{try{const P=await W0.api.get(w,{responseType:"blob"});E&&P&&(O=URL.createObjectURL(P),N(O))}catch(P){console.error("Failed to load authenticated image:",P)}})(),()=>{E=!1,O&&URL.revokeObjectURL(O)}},[w]);const y=S;return d.jsxs(j,{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(j,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${I||!p?"cursor-pointer":""}`,onClick:()=>{x||k||(I&&n?n():!p&&o&&o())},children:[T||y?d.jsx(jt,{src:T||y,alt:e.original_filename,className:"w-full h-full object-cover"}):d.jsx(It,{className:`fa-solid ${_i(e.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(x||k)&&d.jsxs(j,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[d.jsx(j,{className:"w-3/4 h-2 bg-gray-700 dark:bg-gray-600 rounded-full overflow-hidden",children:d.jsx(j,{className:"h-full bg-blue-500 dark:bg-blue-400 transition-all",style:{width:`${v}%`}})}),d.jsxs(te,{className:"text-white text-xs mt-1",children:[v,"%"]})]}),M&&d.jsx(j,{className:"absolute inset-0 bg-red-500/50 dark:bg-red-600/50 flex items-center justify-center",children:d.jsx(It,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),s&&d.jsx(R,{type:"button",onClick:E=>{E.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:at(a?"attachment.primary_image":"attachment.set_as_primary"),children:d.jsx(It,{className:"fa-solid fa-star text-xs"})}),d.jsxs(j,{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(R,{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:at("attachment.drag_to_reorder"),onClick:E=>E.stopPropagation(),children:d.jsx(It,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&o&&d.jsx(R,{type:"button",onClick:E=>{E.stopPropagation(),o()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:at("common.download"),children:d.jsx(It,{className:"fa-solid fa-download text-sm"})}),M&&r&&d.jsx(R,{type:"button",onClick:E=>{E.stopPropagation(),r()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:at("common.retry"),children:d.jsx(It,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),d.jsx(R,{type:"button",onClick:E=>{E.stopPropagation(),t()},disabled:x||k,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:at("common.delete"),children:d.jsx(It,{className:"fa-solid fa-times text-sm"})})]})]}),d.jsxs(j,{className:`p-2 ${!p&&o?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&o&&o()},children:[d.jsx(Gt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:e.original_filename,children:e.original_filename}),d.jsx(Gt,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.size_formatted})]})]})},pc=({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=Ch(Mi($a,{activationConstraint:{distance:8}}),Mi(Pa,{coordinateGetter:fc}));return d.jsxs(j,{className:"p-3",children:[d.jsx(S0,{sensors:m,collisionDetection:Sh,onDragEnd:c,children:d.jsx(lc,{items:e.map(x=>"hash"in x?x.hash:x.id),strategy:ao,children:d.jsxs(j,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[e.map(x=>{const k="hash"in x,M=k?x.is_image:x.mime_type?.startsWith("image/")??!1;return d.jsx(hc,{file:x,onRemove:()=>s(x),onRetry:"status"in x&&x.status==="error"?()=>l(x):void 0,onImageClick:M?()=>f(x):void 0,onDownload:k?()=>h(x):void 0,isPrimary:u&&k&&(x.hash||x.id)===g,onPrimaryClick:u&&k?()=>p?.(x.hash||x.id):void 0},k?x.hash:x.id)}),t&&d.jsxs(j,{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(It,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),d.jsx(te,{className:"text-xs text-gray-500 dark:text-gray-400",children:at("common.add")})]})]})})}),d.jsxs(j,{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(te,{children:at("attachment.attached_count",{count:r,max:n})}),d.jsxs(te,{children:[at("attachment.max_size",{size:o}),a&&` (${a})`]})]})]})},V0=[],K0=[],so=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=K0,autoUpload:c=!0,onFilesChange:i,onChange:u,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:x,initialFiles:k=V0,className:M="",confirmBeforeRemove:v=!1,confirmRemoveTitle:T,confirmRemoveMessage:I,apiEndpoints:S,uploadParams:N,enablePrimarySelection:w=!1,primaryFileId:y,onPrimaryChange:E,id:O,editorAttrs:$},P)=>{const L={upload:S?.upload??"/api/attachments",delete:S?.delete??"/api/attachments/:id",reorder:S?.reorder??"/api/attachments/reorder"},U=C.useRef(u??i);U.current=u??i;const _=C.useCallback(G=>{const X=U.current;if(!X)return;X({target:{value:G,files:G},preventDefault:()=>{},stopPropagation:()=>{}})},[]),b=Si({attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:h,autoUpload:c,initialFiles:k,endpoints:L,onFilesChange:_,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:x,uploadTriggerEvent:e,confirmBeforeRemove:v,uploadParams:N});C.useImperativeHandle(P,()=>({uploadAll:b.handleUploadAll,clear:b.clear,getPendingFiles:b.getPendingFiles}));const z=C.useMemo(()=>b.imageFiles.map(G=>{const X=!("hash"in G),B=G,Y=G;return X?{src:B.preview||"",filename:B.original_filename,title:B.original_filename,downloadRequiresAuth:!1}:{src:b.authenticatedImageUrls.get(Y.id)||Y.download_url,downloadUrl:Y.download_url,filename:Y.original_filename,title:Y.original_filename,downloadRequiresAuth:!0}}),[b.imageFiles,b.authenticatedImageUrls]),F=C.useMemo(()=>({existingFiles:b.existingFiles,pendingFiles:b.pendingFiles,isDragOver:b.isDragOver,isDeleting:b.isDeleting,maxFiles:o,maxSize:a,accept:l,endpoints:L,confirmBeforeRemove:v,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,v]);return d.jsx(di,{value:F,children:d.jsxs(j,{id:O,className:M,...$,children:[d.jsx(Ei,{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(pc,{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:w,primaryFileId:y,onPrimaryChange:E})}),v&&d.jsx(va,{isOpen:b.confirmDialogOpen,onClose:()=>{b.isDeleting||b.setConfirmDialogOpen(!1)},title:T??at("attachment.delete_confirm_title"),message:I??at("attachment.delete_confirm_message"),confirmText:at("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{b.itemToDelete&&b.executeRemoveAttachment(b.itemToDelete)},isLoading:b.isDeleting,loadingText:at("attachment.deleting")}),z.length>0&&b.galleryOpen&&d.jsx(zr,{images:z,isOpen:!0,onClose:()=>b.setGalleryOpen(!1),startIndex:b.galleryStartIndex,showDownload:!0},`gallery-${b.galleryKeyRef.current}`)]})})});so.displayName="FileUploader";const Y0=Object.freeze(Object.defineProperty({__proto__:null,FileDropZone:Ei,FileList:pc,FileUploader:so,FileUploaderProvider:di,SortableThumbnailItem:hc,default:so,extractErrorMessage:Ci,fileUploaderT:at,formatFileSize:qn,getFileIcon:_i,useFileUploader:Si,useFileUploaderContext:Qg},Symbol.toStringTag,{value:"Module"})),mc=({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}},bc=(e,t)=>window.G7Core?.t?.(e,t)??e,X0=[{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"}],yc=({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"?bc("auth.social.register_with",{provider:h}):bc("auth.social.login_with",{provider:h}),f=X0.filter(h=>e.includes(h.id));return r==="icon"?d.jsx(j,{className:`flex justify-center gap-4 ${n}`,id:o,...a,children:f.map(h=>d.jsx(R,{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(mc,{provider:h.id,className:"w-5 h-5"})},h.id))}):d.jsx(j,{className:`space-y-3 ${n}`,id:o,...a,children:f.map(h=>d.jsxs(R,{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(mc,{provider:h.id,className:"w-5 h-5"}),d.jsx(te,{children:l(h.name)})]},h.id))})},q0=Object.freeze(Object.defineProperty({__proto__:null,default:yc},Symbol.toStringTag,{value:"Module"})),Z0=(e,t)=>window.G7Core?.t?.(e,t)??e,Q0={success:nt.CheckCircle,error:nt.XCircle,warning:nt.ExclamationTriangle,info:nt.InfoCircle},vc={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"}},J0={"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"},Ga=({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(j,{className:`fixed z-[9999] flex flex-col gap-2 ${J0[t]}`,"aria-live":"polite","aria-atomic":"true",children:e.map(l=>d.jsx(R0,{toast:l,position:t,isVisible:o.get(l.id)??!0,onClose:()=>s(l.id)},l.id))})},R0=({toast:e,position:t,isVisible:r,onClose:n})=>{const o=vc[e.type]||vc.info,a=e.icon?e.icon:Q0[e.type],s=t.startsWith("bottom")?"translate-y-2":"-translate-y-2";return d.jsxs(j,{className:` flex items-center gap-3 p-4 rounded-lg border shadow-lg min-w-[300px] max-w-md transition-all duration-300 @@ -84,4 +84,4 @@ self.addEventListener('message', async (e) => { transform: translateX(-100%); } } - `})]}):null},rp=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionIndicator:ja,default:ja},Symbol.toStringTag,{value:"Module"})),wc=window.G7Core?.createLogger?.("Comp:PageTransitionBlur")??{log:(...e)=>console.log("[Comp:PageTransitionBlur]",...e),warn:(...e)=>console.warn("[Comp:PageTransitionBlur]",...e)},Ba=({className:e="",style:t})=>{const[r,n]=C.useState(!1);return C.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){wc.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{wc.log("isPending changed:",s),n(s)})},[]),r?d.jsx(j,{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},np=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionBlur:Ba,default:Ba},Symbol.toStringTag,{value:"Module"})),xc={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},kc=new Set(["hidden","block","inline-block","inline","flex","inline-flex","grid","inline-grid","table","table-row","table-cell","contents","list-item","flow-root"]),op=new Set(["Div","Flex","Grid","Section","Article","Nav","Aside","Main","Header","Footer","Fragment","Form","Container"]),ap=new Set(["H1","H2","H3","H4","H5","H6","P","Span","Label","A","Strong","Em","Small","Badge"]),sp=new Set(["Input","Textarea","Select","Checkbox","Radio","Toggle","DatePicker","TagInput","SearchBar"]),lp=new Set(["Img","Image","Avatar","AvatarUploader","ImageGallery","ProductImageViewer","FileUploader"]),Cc={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 ip(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=>!_c(o.if));return n.length>1&&cp(n)?[...r,Sc(n)]:[...r,...n]}if(t.length>1&&r.length===0){const n=t.filter(o=>!_c(o.if));return n.length===0?[]:n.length===1?n:[Sc(n)]}return e}function _c(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 cp(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 Sc(e){return e.reduce((t,r)=>Wa(r)>Wa(t)?r:t)}function Wa(e){return e.children?e.children.length+e.children.reduce((t,r)=>t+Wa(r),0):0}function dp(e){return e.includes("{{")?e.replace(/\{\{([^}]+)\}\}/g,(t,r)=>{const n=r.match(/\?[\s]*['"]([^'"]*)['"]\s*:\s*['"]/);return n?n[1]:""}):e}function Va(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 up(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 fp(e){switch(e){case"pulse":return"animate-pulse";case"wave":return"animate-pulse";case"none":return"";default:return"animate-pulse"}}function lo(e,t,r,n){return!e||e.length===0?[]:ip(e).map((a,s)=>Ec(a,t,r,s,n))}function gp(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 hp(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(kc.has(i)){n.push({breakpoint:xc[c]||0,display:i});continue}(xc[c]||0)<=t&&o.push(i);continue}if(kc.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 pp(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 Ec(e,t,r,n,o){const{name:a,children:s,iteration:l}=e,f=gp(e,o),h=up(e),c=h?`${h} ${f}`.trim():f,i=dp(c),u=hp(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,w)=>Ec({...e,iteration:void 0},t,r,w,o))},n);if(Cc[a])return d.jsx("div",{className:g,children:Cc[a](t,r)},n);if(op.has(a)){const m=Va(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 w=lo(s,t,r,o);if(!(w.length>0&&w.some(v=>v!==null)))return null;const M=pp(m);return d.jsx("div",{className:M.className,style:M.style,children:w},n)}const p=Va(g,a);if(ap.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"},w={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"},k=m[a]||"h-3.5",M=w[a]||"w-full",v=a.startsWith("H")?"mb-2 mt-1":"mb-1.5";return d.jsx("div",{className:`${k} ${M} bg-gray-200 dark:bg-gray-700 rounded ${t} ${v} ${p}`.trim()},n)}if(sp.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(lp.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=Va(g,a),w=lo(s,t,r,o);if(!(w.length>0&&w.some(T=>T!==null)))return null;const v=/\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} ${v}`.trim(),children:w},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:lo(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 Ka=({components:e,options:t})=>{const r=fp(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:lo(e,r,t.iteration_count,s)})},mp=Object.freeze(Object.defineProperty({__proto__:null,PageSkeleton:Ka,default:Ka},Symbol.toStringTag,{value:"Module"})),bp=(e,t)=>window.G7Core?.t?.(e,t)??e,Tc=({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||bp("nav.loading")})]})},yp=Object.freeze(Object.defineProperty({__proto__:null,default:Tc},Symbol.toStringTag,{value:"Module"})),Vr=(e,t)=>window.G7Core?.t?.(e,t)??e,Ac=({currentPage:e,totalPages:t,onPageChange:r,maxVisiblePages:n=5,showFirstLast:o=!0,showFirst:a,showLast:s,hasMorePages:l,className:f="",style:h,prevText:c,nextText:i,id:u,editorAttrs:g})=>{const p=t!=null,m=p?t:0,w=p?e{const N=[];if(!p)return N;if(m<=n+2)for(let x=1;x<=m;x++)N.push(x);else{const x=Math.floor(n/2);let y=Math.max(2,e-x),E=Math.min(m-1,e+x);e<=x+1?E=n:e>=m-x&&(y=m-n+1),N.push(1),y>2&&N.push("...");for(let O=y;O<=E;O++)N.push(O);E1&&N.push(m)}return N},[e,m,p,n]),T=N=>{N<1||N===e||p&&N>m||r(N)},I=()=>{e>1&&r(e-1)},S=()=>{w&&r(e+1)};return d.jsxs(j,{className:`flex items-center gap-2 ${f}`,style:h,role:"navigation","aria-label":Vr("common.pagination"),id:u,...g,children:[k&&d.jsx(R,{onClick:()=>T(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":Vr("common.first_page"),children:"«"}),d.jsx(R,{onClick:I,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":Vr("common.prev_page"),children:c||d.jsx(d.Fragment,{children:"‹"})}),d.jsxs(j,{className:"flex items-center gap-1",children:[!p&&d.jsx(te,{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:e}),v.map((N,x)=>{if(N==="...")return d.jsx(te,{className:"px-3 py-1 text-sm text-gray-500 dark:text-gray-400",children:"..."},`ellipsis-${x}`);const y=N,E=y===e;return d.jsx(R,{onClick:()=>T(y),className:`px-3 py-1 text-sm border rounded ${E?"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":Vr("common.page_n",{n:y}),"aria-current":E?"page":void 0,children:y},y)})]}),d.jsx(R,{onClick:S,disabled:!w,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":Vr("common.next_page"),children:i||d.jsx(d.Fragment,{children:"›"})}),M&&d.jsx(R,{onClick:()=>T(m),disabled:e===m,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":Vr("common.last_page"),children:"»"})]})},vp=Object.freeze(Object.defineProperty({__proto__:null,Pagination:Ac},Symbol.toStringTag,{value:"Module"})),Nc=(e,t)=>window.G7Core?.t?.(e,t)??e,Oc=({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??Nc("common.search_placeholder"),[p,m]=C.useState(""),[w,k]=C.useState(!1),M=C.useRef(null),v=C.useRef(""),T=r!==void 0?r:p,I=f&&w&&s.length>0&&T.length>0;C.useEffect(()=>{r!==void 0&&(v.current=r)},[r]);const S=y=>{const E=y.target.value;m(E),n?.(y),v.current!==""&&E===""&&!y.nativeEvent.inputType&&setTimeout(()=>{const O=M.current?.querySelector("form");O&&O.requestSubmit()},0),v.current=E},N=y=>{m(y.text);const E={target:{value:y.text,name:e}};n?.(E),l?.(y),k(!1)},x=y=>{y.preventDefault(),o?.(y)};return d.jsxs(j,{ref:M,className:`relative ${h}`,style:c,id:i,...u,children:[d.jsx(So,{onSubmit:x,className:"relative",children:d.jsxs(j,{className:`relative flex items-center ${a?"gap-2":""}`,children:[d.jsxs(j,{className:"relative flex-1",children:[d.jsx(j,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:d.jsx(fe,{name:nt.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),d.jsx(At,{type:"search",name:e,value:T,onChange:S,onFocus:()=>k(!0),onBlur:()=>setTimeout(()=>k(!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(R,{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:Nc("common.search")})]})}),I&&d.jsx(j,{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(j,{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:()=>N(y),children:d.jsxs(j,{className:"flex items-center gap-2",children:[d.jsx(fe,{name:nt.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),d.jsx(te,{className:"text-sm text-gray-700 dark:text-gray-300",children:y.text})]})},y.id))})]})},wp=Object.freeze(Object.defineProperty({__proto__:null,SearchBar:Oc},Symbol.toStringTag,{value:"Module"})),_t=window.G7Core,xp={sm:"md",md:"lg",lg:"xl",xl:"2xl","2xl":"3xl"};function Ya({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:w=!0,deleteConfirmMessage:k,confirmUpload:M=!0,uploadConfirmMessage:v,uploadSuccessActions:T,uploadErrorActions:I,deleteSuccessActions:S,deleteErrorActions:N,id:x,editorAttrs:y}){const E=C.useRef(null),[O,$]=C.useState(!1),[D,L]=C.useState(!1),[U,_]=C.useState(void 0),[b,z]=C.useState(null),[F,G]=C.useState(!1),[X,B]=C.useState(!1),[Y,H]=C.useState(null),[W,Q]=C.useState(null),be=C.useRef(`avatar-upload-${Math.random().toString(36).slice(2,11)}`).current;C.useEffect(()=>{if(Y){const ae=URL.createObjectURL(Y);return Q(ae),()=>URL.revokeObjectURL(ae)}else Q(null)},[Y]);const se=C.useCallback(ae=>_t?.t?.(ae)??ae,[]),pe=C.useCallback(()=>{const ae=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return ae?decodeURIComponent(ae[1]):null},[]),ne=C.useCallback(()=>_t?.api?.getToken?.()??null,[]),Ae=C.useCallback(async ae=>{B(!1),H(null),$(!0),z(null);try{const ce=new FormData;ce.append("avatar",ae);const ke=pe(),Ee=ne(),Be=await fetch(n,{method:"POST",headers:{Accept:"application/json",...ke&&{"X-XSRF-TOKEN":ke},...Ee&&{Authorization:`Bearer ${Ee}`}},credentials:"include",body:ce});if(!Be.ok){const De=await Be.json().catch(()=>({}));throw new Error(De.message||se("attachment.upload_failed"))}const Me=await Be.json(),Ke=Me.data||Me;Ke.avatar&&_(Ke.avatar),a?.(Ke),_t?.toast?.success?.(se("mypage.profile.avatar_uploaded")),T?.length?T.forEach(De=>_t?.dispatch?.(De)):_t?.refetchDataSource?.("user")}catch(ce){const ke=ce instanceof Error?ce:new Error(String(ce));z(ke.message),s?.(ke),_t?.toast?.error?.(ke.message),I?.length&&I.forEach(Ee=>_t?.dispatch?.(Ee))}finally{$(!1),E.current&&(E.current.value="")}},[n,a,s,pe,ne,se]),ve=C.useCallback(async ae=>{const ce=ae.target.files?.[0];if(!ce)return;z(null);const ke=i*1024*1024;if(ce.size>ke){const Ee=new Error(se("attachment.file_too_large").replace(":max",`${i}MB`));z(Ee.message),s?.(Ee),_t?.toast?.error?.(Ee.message);return}if(c&&!ce.type.match(c.replace("*",".*"))){const Ee=new Error(se("attachment.invalid_file_type"));z(Ee.message),s?.(Ee),_t?.toast?.error?.(Ee.message);return}M?(H(ce),B(!0)):Ae(ce)},[i,c,s,M,Ae,se]),We=C.useCallback(async()=>{G(!1),L(!0),z(null);try{const ae=pe(),ce=ne(),ke=await fetch(o,{method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json",...ae&&{"X-XSRF-TOKEN":ae},...ce&&{Authorization:`Bearer ${ce}`}},credentials:"include"});if(!ke.ok){const Ee=await ke.json().catch(()=>({}));throw new Error(Ee.message||se("attachment.delete_failed"))}_(null),l?.(),_t?.toast?.success?.(se("mypage.profile.avatar_deleted")),S?.length?S.forEach(Ee=>_t?.dispatch?.(Ee)):_t?.refetchDataSource?.("user")}catch(ae){const ce=ae instanceof Error?ae:new Error(String(ae));z(ce.message),f?.(ce),_t?.toast?.error?.(ce.message),N?.length&&N.forEach(ke=>_t?.dispatch?.(ke))}finally{L(!1)}},[o,l,f,pe,ne,se]),me=C.useCallback(()=>{w?G(!0):We()},[w,We]),Te=C.useCallback(()=>{G(!1)},[]),ge=C.useCallback(()=>{B(!1),H(null),E.current&&(E.current.value="")},[]),Oe=C.useCallback(()=>{Y&&Ae(Y)},[Y,Ae]),we=U===void 0?e:U,$e=!!we,ze=xp[r]||"lg",K=F||X,oe=()=>d.jsxs(j,{className:"flex items-center justify-center gap-2",children:[d.jsx(At,{ref:E,id:be,type:"file",accept:c,className:"hidden",onChange:ve,disabled:O}),!$e&&d.jsxs(Ar,{htmlFor:be,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 ${O?"opacity-50 cursor-not-allowed":""}`,children:[O?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"image",size:"sm"}),d.jsx(te,{children:g||se("mypage.profile.register_avatar")})]}),$e&&d.jsxs(d.Fragment,{children:[d.jsxs(Ar,{htmlFor:be,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 ${O?"opacity-50 cursor-not-allowed":""}`,children:[O?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"upload",size:"sm"}),d.jsx(te,{children:g||se("common.change")})]}),h&&d.jsxs(R,{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:me,disabled:D,children:[D?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"trash-2",size:"sm"}),d.jsx(te,{children:p||se("common.delete")})]})]})]});return d.jsxs(j,{className:`flex flex-col items-center gap-3 ${u}`,id:x,...y,children:[X&&W?d.jsxs(j,{className:"relative",children:[d.jsx(jt,{src:W,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(j,{className:"absolute inset-0 rounded-full bg-blue-500/20 border-2 border-blue-500 border-dashed"})]}):d.jsx(Qr,{avatar:we||void 0,name:t,size:ze}),!m&&d.jsxs(j,{className:"w-[220px] flex flex-col items-center gap-2",children:[X&&Y&&d.jsxs(j,{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(j,{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(te,{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:v||se("mypage.profile.upload_avatar_confirm")})]}),d.jsxs(j,{className:"text-xs text-blue-600 dark:text-blue-400 truncate mb-3",title:Y.name,children:[Y.name," (",(Y.size/1024/1024).toFixed(2),"MB)"]}),d.jsxs(j,{className:"grid grid-cols-2 gap-2",children:[d.jsxs(R,{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:Oe,disabled:O,children:[O?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"check",size:"sm"}),d.jsx(te,{children:se("common.confirm")})]}),d.jsx(R,{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:ge,children:d.jsx(te,{children:se("common.cancel")})})]})]}),F&&d.jsxs(j,{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(j,{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(te,{className:"text-sm font-medium text-red-800 dark:text-red-300",children:k||se("mypage.profile.delete_avatar_confirm")})]}),d.jsxs(j,{className:"grid grid-cols-2 gap-2",children:[d.jsxs(R,{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:We,disabled:D,children:[D?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"trash-2",size:"sm"}),d.jsx(te,{children:se("common.delete")})]}),d.jsx(R,{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:Te,children:d.jsx(te,{children:se("common.cancel")})})]})]}),!K&&oe()]}),b&&!K&&d.jsxs(j,{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(te,{children:b})]})]})}const kp=Object.freeze(Object.defineProperty({__proto__:null,AvatarUploader:Ya,default:Ya},Symbol.toStringTag,{value:"Module"})),Mc=()=>window.G7Core,io=(e,t)=>window.G7Core?.t?.(e,t)??e,Ic={horizontal:"flex items-center gap-1.5",vertical:"flex flex-col items-start"},Cp=()=>[{key:"view_profile",label:io("userinfo.view_profile"),icon:"user",path:"/users/{{userId}}"},{key:"view_posts",label:io("userinfo.view_posts"),icon:"file-lines",path:"/users/{{userId}}/posts"}],Xa=({text:e,title:t})=>e?d.jsx(te,{className:"text-sm text-gray-500 dark:text-gray-400",title:t,children:e}):null,Pc=({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:w=[],id:k,editorAttrs:M})=>{const v=r??e?.uuid,T=a||e?.is_guest||!1,I=s||e?.status==="withdrawn",S=I?io("userinfo.withdrawn_user"):u??t??e?.name??"",[N,x]=C.useState(!1),[y,E]=C.useState({top:0,left:0}),O=C.useRef(null),$=C.useRef(null),D=C.useRef(null),L=h.replace("{userId}",String(v??"")),U=`${Ic[i]} ${c}`;C.useEffect(()=>{if(!N)return;const H=Q=>{const be=Q.target,se=O.current?.contains(be),pe=$.current?.contains(be);!se&&!pe&&x(!1)},W=()=>x(!1);return document.addEventListener("mousedown",H),window.addEventListener("scroll",W,!0),window.addEventListener("resize",W),()=>{document.removeEventListener("mousedown",H),window.removeEventListener("scroll",W,!0),window.removeEventListener("resize",W)}},[N]);const _=C.useCallback(()=>{if(p&&p.length>0)return p.filter(Q=>Q.show!==!1);let W=Cp().filter(Q=>!m.includes(Q.key)&&Q.show!==!1);return w&&w.length>0&&(W=[...W,...w.filter(Q=>Q.show!==!1)]),W},[p,m,w]),b=C.useCallback(()=>{if(D.current){const H=D.current.getBoundingClientRect();E({top:H.bottom+4,left:H.left})}},[]),z=C.useCallback((H,W)=>{if(W.stopPropagation(),W.preventDefault(),x(!1),H.onClick)H.onClick();else if(H.path){const Q=H.path.replace(/\{\{userId\}\}/g,String(v??"")),be=Mc();be?.navigate?be.navigate(Q):window.location.href=Q}},[v]),F=C.useCallback(H=>{H.preventDefault(),g&&H.stopPropagation(),!(T||!v)&&(l?(N||b(),x(W=>!W)):f&&Mc()?.navigate?.(L))},[g,T,v,l,N,b,f,L]);if(T||!v)return d.jsxs(j,{className:U,id:k,...M,children:[d.jsxs(j,{className:"flex items-center gap-1.5 text-gray-400 dark:text-gray-500",children:[d.jsx(te,{children:S}),d.jsx(te,{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:io("userinfo.guest_badge")})]}),d.jsx(Xa,{text:n,title:o})]});if(I)return d.jsxs(j,{className:U,id:k,...M,children:[d.jsx(te,{className:"text-gray-400 dark:text-gray-500 line-through",children:S}),d.jsx(Xa,{text:n,title:o})]});const G=_(),B=/\btext-\S+/.test(c)?"":"text-gray-900 dark:text-white",Y=l||f?`${B} hover:text-blue-600 dark:hover:text-blue-400 cursor-pointer font-medium`.trim():`${B} font-medium`.trim();return d.jsxs(j,{ref:O,className:`relative inline-block ${c}`,id:k,...M,children:[d.jsxs(j,{className:Ic[i],children:[d.jsx(R,{ref:D,onClick:F,className:Y,children:S}),d.jsx(Xa,{text:n,title:o})]}),l&&N&&G.length>0&&tr.createPortal(d.jsx(j,{ref:$,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(H=>d.jsxs(R,{onClick:W=>z(H,W),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-${H.key}`,children:[H.icon&&d.jsx(fe,{name:H.icon,className:"w-4 h-4"}),d.jsx(te,{children:H.label})]},H.key))}),document.body)]})},_p=Object.freeze(Object.defineProperty({__proto__:null,UserInfo:Pc},Symbol.toStringTag,{value:"Module"})),Dc=({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{!v.disabled&&v.id!==t&&r?.(v.id)},m=v=>{const T=v.target.value,I=Number(T),S=typeof T=="string"&&T!==""&&!Number.isNaN(I)?I:T,N=e.find(x=>String(x.id)===String(S));N&&p(N)},w=s.length>0?e.filter(v=>!s.includes(v.id)):e;if(g)return d.jsx(j,{className:`relative ${o}`,style:a,id:f,...h,children:d.jsx(hs,{value:t!==void 0?String(t):"",onChange:m,options:w.map(v=>({value:String(v.id),label:v.badge!==void 0?`${v.label} (${v.badge})`:v.label,disabled:v.disabled})),className:"w-full"})});const k=v=>{const T=v.id===t,I="flex items-center gap-2 px-3 py-2 font-medium text-sm transition-all shrink-0 whitespace-nowrap";if(v.disabled)return`${I} opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-600`;switch(n){case"pills":return T?`${I} bg-blue-600 dark:bg-blue-500 text-white rounded-lg`:`${I} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`;case"underline":return T?`${I} text-gray-900 dark:text-white border-b-2 border-gray-900 dark:border-white`:`${I} 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?`${I} 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`:`${I} 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(j,{className:`relative ${o}`,style:a,id:f,...h,children:d.jsx(Zr,{className:M,children:w.map(v=>d.jsxs(R,{type:"button",onClick:()=>p(v),disabled:v.disabled,className:k(v),children:[v.iconName&&d.jsx(fe,{name:v.iconName,size:"sm"}),d.jsx(te,{children:v.label}),v.badge!==void 0&&d.jsx(j,{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(te,{children:v.badge})})]},v.id))})})},Sp=Object.freeze(Object.defineProperty({__proto__:null,TabNavigation:Dc},Symbol.toStringTag,{value:"Module"})),Ep={Header:()=>Promise.resolve().then(()=>jd),Footer:()=>Promise.resolve().then(()=>Kd),MobileNav:()=>Promise.resolve().then(()=>Yd),SlotContainer:()=>Promise.resolve().then(()=>Hd),NotificationCenter:()=>Promise.resolve().then(()=>Gd),ProductCard:()=>Promise.resolve().then(()=>Mu),BrandMark:()=>Promise.resolve().then(()=>Pu),ImageGallery:()=>Promise.resolve().then(()=>ri),ProductImageViewer:()=>Promise.resolve().then(()=>zg),QuantitySelector:()=>Promise.resolve().then(()=>Hg),PostReactions:()=>Promise.resolve().then(()=>Bg),RichTextEditor:()=>Promise.resolve().then(()=>Wg),HtmlContent:()=>Promise.resolve().then(()=>Vg),HtmlEditor:()=>Promise.resolve().then(()=>Kg),ExpandableContent:()=>Promise.resolve().then(()=>Yg),FileUploader:()=>Promise.resolve().then(()=>Y0),ConfirmDialog:()=>Promise.resolve().then(()=>Zg),SocialLoginButtons:()=>Promise.resolve().then(()=>q0),Toast:()=>Promise.resolve().then(()=>ep),PageTransitionIndicator:()=>Promise.resolve().then(()=>rp),PageTransitionBlur:()=>Promise.resolve().then(()=>np),PageSkeleton:()=>Promise.resolve().then(()=>mp),PageLoading:()=>Promise.resolve().then(()=>yp),ThemeToggle:()=>Promise.resolve().then(()=>Ld),Pagination:()=>Promise.resolve().then(()=>vp),SearchBar:()=>Promise.resolve().then(()=>wp),Avatar:()=>Promise.resolve().then(()=>Ud),AvatarUploader:()=>Promise.resolve().then(()=>kp),UserInfo:()=>Promise.resolve().then(()=>_p),Modal:()=>Promise.resolve().then(()=>qg),TabNavigation:()=>Promise.resolve().then(()=>Sp)},Tp=({id:e,className:t,style:r,children:n,editorAttrs:o})=>d.jsx(j,{id:e,className:t,style:r,...o,children:n}),Ap=({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 w={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};p.push(w[l])}if(f){const w={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};p.push(w[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(j,{id:e,className:p.join(" "),style:i,onClick:u,...g,children:t})},Np=({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 w={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(w[n]);const k={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(k[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(j,{id:e,className:g.join(" "),style:c,onClick:i,...u,children:t})},Op=({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=[],w={none:"p-0",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};m.push(w[o]);const k={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(k[a]),s){const v={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(v[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(ms,{id:e,className:m.join(" "),style:u,onClick:g,...p,children:[(t||r)&&d.jsxs(j,{className:"mb-4",children:[t&&d.jsx(fs,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t}),r&&d.jsx(Gt,{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:r})]}),n]})},Mp=({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(j,{id:e,className:h,style:l,...f,children:[d.jsx(j,{className:"flex flex-col",style:c,children:n}),d.jsx(j,{className:"flex flex-col",style:i,children:o}),d.jsx(j,{className:"flex flex-col",style:u,children:a})]})},Ip={identifier:"sirsoft-basic",vendor:"sirsoft",name:{ko:"Basic",en:"Basic"},version:"1.1.3",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.10",dependencies:{modules:{"sirsoft-board":">=1.0.0","sirsoft-ecommerce":">=1.1.0","sirsoft-page":">=1.1.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",asset:"vendor/font-awesome/6.4.0/css/all.inlined.css"},{id:"pretendard",type:"webfont",asset:"vendor/pretendard/1.3.9/pretendard-variable.css"}]},Pp={KRW:0,JPY:0};function Dp(){try{const t=(window.G7Core?.state?.get?.()||{})?.modules?.["sirsoft-ecommerce"]?.language_currency;return Array.isArray(t?.currencies)?t.currencies:[]}catch{return[]}}function Kr(e,t){if(!Number.isFinite(e))return"0";const r=Dp(),n=t||r.find(a=>a.is_default)?.code;if(!n)return e.toLocaleString();const o=r.find(a=>a.code===n)?.decimal_places??Pp[n]??2;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:n,minimumFractionDigits:o,maximumFractionDigits:o}).format(e)}catch{return`${e.toLocaleString(void 0,{minimumFractionDigits:o,maximumFractionDigits:o})} ${n}`}}function co(e,t,r,n=0){if(!e)return;const o=f=>f?.value??f?.price??0;let a;for(const[f,h]of Object.entries(e))if(h?.is_default){a=f;break}a=a??(e.KRW?"KRW":void 0);const s=a?o(e[a]):0,l={};for(const[f,h]of Object.entries(e)){const c=o(h);let i;r?i=r[f]?.value??0:n>0&&f===a?i=n:n>0&&s>0?i=n*c/s:i=0;const u=(c+i)*t;l[f]={value:u,formatted:Kr(u,f)}}return l}function uo(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:Kr(o,n)};return r}function Lc(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 $c(e,t){if(!e||!t?.length)return;const r={};let n=!1;for(const a of t){const s=e[a.id];if(s==null)continue;const f=a.values?.find(h=>h.id===Number(s))?.multi_currency_price_adjustment;if(f){n=!0;for(const[h,c]of Object.entries(f)){const i=c?.value??c?.price??0;r[h]=(r[h]??0)+i}}}if(!n)return;const o={};for(const[a,s]of Object.entries(r))o[a]={value:s};return o}function fo(e){return e.name_localized?e.name_localized:typeof e.name=="string"?e.name:e.name?.ko??""}function Lp(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 $p(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 Fp(e,t,r){return r.find(n=>!n?.option_values||!n?.is_active?!1:e.every(o=>{const a=fo(o),s=t?.[a];return Lp(n.option_values,n.option_values_localized,a)===s}))}function Up(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(S=>{const N=fo(S);return l?.[N]}))return;const h=Fp(n,l,o??[]);if(!h){t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const c=n.map(S=>l[fo(S)]).join("_"),i=a??[];if(i.find(S=>S.id===c)){const S=window.G7Core;S?.toast?.warning?.(S?.t?.("sirsoft-ecommerce.shop.already_added_option")??"이미 추가된 옵션입니다."),t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const g=h.selling_price??0,p={};n.forEach(S=>{const N=fo(S);p[N]=l[N]});const m=r.additionalOptionGroups??[],w={};for(const S of m){if(!S.is_required)continue;const N=S.values?.find(x=>x.is_default);N&&(w[S.id]=N.id)}const k=Lc(w,m),M=$c(w,m),v=g+k,T={id:c,optionId:h.id,options:p,optionValues:$p(h.option_values,h.option_values_localized),quantity:1,stock:h.stock_quantity??999,unitPrice:g,unitPriceFormatted:Kr(g,s),totalPrice:v,totalPriceFormatted:Kr(v,s),multiCurrencyUnitPrice:h.multi_currency_selling_price,multiCurrencyTotalPrice:co(h.multi_currency_selling_price,1,M,k),additionalOptionSelections:w,additionalOptionsTotal:k,additionalOptionsMultiCurrencyTotal:M},I=[...i,T];t.setState?.({selectedOptionItems:I,selectedTotalMultiCurrency:uo(I),currentSelection:{},__mergeMode:"shallow"})}function zp(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:Kr(u,o),multiCurrencyTotalPrice:co(f?.multiCurrencyUnitPrice,s,f?.additionalOptionsMultiCurrencyTotal,i)}});t.setState?.({selectedOptionItems:l,selectedTotalMultiCurrency:uo(l)})}function Hp(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 T=String(r.customText??"");T.trim()===""?delete p[l]:p[l]=T}else h==null?(delete g[l],delete p[l]):(g[l]=h,(o??[]).find(S=>S.id===l)?.values?.find(S=>S.id===h)?.allow_custom_text||delete p[l]);const m=Lc(g,o),w=$c(g,o),k=i?.unitPrice??0,M=i?.quantity??1,v=(k+m)*M;return{...i,additionalOptionSelections:g,additionalOptionCustomTexts:p,additionalOptionsTotal:m,additionalOptionsMultiCurrencyTotal:w,totalPrice:v,totalPriceFormatted:Kr(v,a),multiCurrencyTotalPrice:co(i?.multiCurrencyUnitPrice,M,w,m)}});t.setState?.({selectedOptionItems:c,selectedTotalMultiCurrency:uo(c)})}function Gp(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:uo(o)})}function jp(e,t){const r=e.params;if(!r)return;const n=Math.max(1,Number(r.newQuantity)||1);t.setState?.({noOptionQuantity:n,noOptionTotalMultiCurrency:co(r.multiCurrencyUnitPrice,n)})}const xn=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 kr(e){const t=window.G7Core;t?.state?.setLocal?(t.state.setLocal(e),xn.log("Local state updated:",e)):xn.warn("G7Core.state.setLocal not available")}function Fc(){return window.G7Core?.state?.getLocal?.()||{}}function Bp(){return window.G7Core?.state?.get?.()||{}}function Wp(e,t="info"){const r=window.G7Core;r?.toast?.show?r.toast.show(e,t):xn.warn("G7Core.toast.show not available, message:",e)}function Vp(e){const t=window.G7Core;return t?.t?t.t(e):e}function Uc(){const e=window.G7Core;if(e?.dispatch){const r=Fc().selectedItems||[];e.dispatch({handler:"refetchDataSource",params:{dataSourceId:"cartItems"}}),xn.log("Refetching cartItems with selected_ids:",r)}else xn.warn("G7Core.dispatch not available")}function Kp(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=Bp().cartItems?.data?.items||[],f=l.length>0&&a.length===l.length;kr({selectedItems:a,allSelected:f}),Uc()}function Yp(e,t){const{allItemIds:r,isSelected:n}=e?.params||{};kr({selectedItems:n?r:[],allSelected:n}),Uc()}function Xp(e,t){const{optionName:r,optionValue:n}=e?.params||{},a=Fc().selectedOptions||{};kr({selectedOptions:{...a,[r]:n}})}function qp(e,t){const{targetIds:r}=e?.params||{};if(!r||r.length===0){Wp(Vp("shop.cart.select_items_to_delete"),"warning");return}kr({deleteModal:{visible:!0,targetIds:r}})}function Zp(e,t){const{targetItem:r}=e?.params||{};kr({optionModal:{visible:!0,targetItem:r},selectedOptions:r?.options||{},selectedQuantity:r?.quantity})}function Qp(e,t){const{selectedItems:r}=e?.params||{};if(!r||r.length===0){kr({isCalculating:!1});return}kr({isCalculating:!0})}const Cr=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 qa(e){return e.name_localized?e.name_localized:typeof e.name=="string"?e.name:e.name?.ko??""}function Jp(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 zc(e,t,r){return!e||!t?.length?null:t.every(a=>{const s=qa(a);return e[s]})?r?.find(a=>t.every(s=>{const l=qa(s);return Jp(a.option_values,a.option_values_localized,l)===e[l]}))||null:(Cr.log("Not all options selected yet"),null)}function Rp(e,t){const{selectedOptions:r,optionGroups:n,options:o}=e?.params||{};Cr.log("findMatchingOption called:",{selectedOptions:r,optionGroups:n,optionsCount:o?.length});const a=zc(r,n,o);return Cr.log("Matched option:",a),{matchedOption:a}}function em(e,t){const{currentOptionValues:r,optionGroups:n,options:o}=e?.params||{};if(Cr.log("initCartOptionSelection called:",{currentOptionValues:r,optionGroups:n,optionsCount:o?.length}),!n?.length||!r)return Cr.log("No option groups or current values, returning empty"),{selectedOptions:{},matchedOption:null};const a={};for(const l of n){const f=qa(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)}Cr.log("Initial selectedOptions:",a);const s=zc(a,n,o||[]);return Cr.log("Matched option:",s),{selectedOptions:a,matchedOption:s}}const kn="g7_cart_key",tm="/api/modules/sirsoft-ecommerce/cart/key",Za="g7_guest_order_token",Hc="g7_guest_order_number",Qa="g7_guest_order_expires_at",ft=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 Gc(){try{const e=await fetch(tm,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"}});return e.ok?(await e.json()).data?.cart_key||null:(ft.error("Failed to issue cartKey from API:",e.status),null)}catch(e){return ft.error("Error issuing cartKey from API:",e),null}}function sr(e){const t=window.G7Core;t?.state?.set?(t.state.set(e),ft.log("Global state updated:",e)):ft.warn("G7Core.state.set not available")}function rm(){try{const e=window.G7Config;return e?.user?e.user:(window.G7Core?.state?.get?.()||{}).currentUser||null}catch{return null}}async function nm(e,t){let r=null;try{r=localStorage.getItem(kn)}catch{}if(r)ft.log("Existing cartKey loaded:",r);else if(r=await Gc(),r)try{localStorage.setItem(kn,r),ft.log("New cartKey issued from API:",r)}catch{}else ft.error("Failed to issue cartKey from API");sr({cartKey:r})}function om(e,t){try{return localStorage.getItem(kn)}catch{return null}}function jc(e,t){try{localStorage.removeItem(kn),ft.log("cartKey removed from localStorage")}catch{}sr({cartKey:null})}async function am(e,t){if(rm()){jc();return}const n=await Gc();if(n){try{localStorage.setItem(kn,n),ft.log("New cartKey regenerated from API:",n)}catch{}sr({cartKey:n})}else ft.error("Failed to regenerate cartKey from API")}function sm(e,t){const{key:r,value:n}=e?.params||{};if(!r){ft.warn("saveToStorage: key is required");return}try{localStorage.setItem(r,n),ft.log("Saved to storage:",r,n)}catch{}}function lm(e,t){const{key:r,defaultValue:n}=e?.params||{};if(!r)return ft.warn("loadFromStorage: key is required"),n||null;try{return localStorage.getItem(r)||n||null}catch{return n||null}}function Ja(){try{sessionStorage.removeItem(Za),sessionStorage.removeItem(Hc),sessionStorage.removeItem(Qa)}catch{}}function im(e,t){let r=null,n=null;try{r=sessionStorage.getItem(Za),n=sessionStorage.getItem(Qa)}catch{}let o=!1;if(r){const a=n?new Date(n).getTime():NaN;(isNaN(a)||a<=Date.now())&&(Ja(),r=null,o=!0)}if(r){sr({guestOrderToken:r}),ft.log("Guest order token loaded from sessionStorage");return}if(!o){const s=window.G7Core?.state?.get?.("_global")?.guestOrderToken;if(typeof s=="string"&&s!==""){ft.log("Guest order token preserved from in-memory _global (sessionStorage empty)");return}}sr({guestOrderToken:null}),ft.log("No guest order token (visitor not authenticated)")}function cm(e,t){const{token:r,orderNumber:n,expiresAt:o}=e?.params||{};if(!r||!n||!o){ft.warn("saveGuestOrderToken: token, orderNumber, expiresAt are required");return}try{sessionStorage.setItem(Za,r),sessionStorage.setItem(Hc,n),sessionStorage.setItem(Qa,o)}catch{}sr({guestOrderToken:r})}function dm(e,t){Ja(),sr({guestOrderToken:null})}function um(e,t){Ja(),sr({guestOrderToken:null})}function Bc(e){const t=window.G7Core?.state?.get?.()?.[e];return typeof t=="string"&&t.length>0?t:void 0}function fm(e,t){const r=e?.params??{},{product:n,priceField:o,currencyCode:a}=r,s=a||Bc("preferredCurrency")||Bc("defaultCurrency")||"",l=`multi_currency_${o}`,f=n[l];if(f&&f[s])return f[s].formatted;const h=`${o}_formatted`;return n[h]||String(n[o])}const Wc={KRW:"₩",USD:"$",JPY:"¥",CNY:"元",EUR:"€",GBP:"£"},gm={KRW:0,JPY:0};function Vc(){try{const t=(window.G7Core?.state?.get?.()||{})?.modules?.["sirsoft-ecommerce"]?.language_currency;return Array.isArray(t?.currencies)?t.currencies:[]}catch{return[]}}function Kc(e){const t=window.G7Core?.state?.get?.()?.[e];return typeof t=="string"&&t.length>0?t:void 0}function hm(e,t){const r=e?.params??{},{value:n,currencyCode:o,locale:a}=r,s=Vc(),l=o||Kc("preferredCurrency")||Kc("defaultCurrency")||s.find(u=>u.is_default)?.code;if(!l)return n.toLocaleString(a);const f=s.find(u=>u.code===l),h=f?.symbol&&f.symbol.length>0?f.symbol:Wc[l]??"",c=f?.decimal_places??gm[l]??2,i=n.toLocaleString(a,{minimumFractionDigits:c,maximumFractionDigits:c});return h?l==="KRW"||h==="₩"||h==="원"?`${i}원`:`${h}${i}`:`${i} ${l}`}function pm(e){const t=Vc().find(r=>r.code===e);return t?.symbol&&t.symbol.length>0?t.symbol:Wc[e]||e}const Ra=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)},Yc="g7_preferred_currency";function mm(){try{const e=window.G7Core?.state?.get?.()||{};return e.defaultCurrency||e?.modules?.["sirsoft-ecommerce"]?.language_currency?.default_currency||""}catch{return""}}function Xc(e){window.G7Core?.state?.set?.({preferredCurrency:e})}function bm(e,t){const r=e?.params??{},{defaultCurrency:n=mm()}=r;let o=n;try{if(typeof window<"u"&&window.localStorage){const a=localStorage.getItem(Yc);a&&qc(a)&&(o=a)}}catch{Ra.warn("localStorage 접근 불가, 기본 통화 사용:",n)}return Xc(o),o}function ym(e,t){const{currencyCode:r}=e?.params??{};if(!qc(r)){Ra.warn("유효하지 않은 통화 코드:",r);return}try{typeof window<"u"&&window.localStorage&&localStorage.setItem(Yc,r)}catch{Ra.warn("localStorage 저장 실패")}Xc(r)}function qc(e){return typeof e=="string"&&/^[A-Z]{3}$/.test(e)}const Yr=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)},es=["auto","light","dark"],Zc="g7_color_scheme",vm=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,go=e=>{const t=vm(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function wm(){try{const e=localStorage.getItem(Zc),t=e&&es.includes(e)?e:"auto";go(t),Yr.log("Initial theme applied:",t)}catch(e){Yr.warn("Failed to load initial theme:",e),go("auto")}}async function xm(e,t){const r=e?.target;if(r&&typeof r=="string"&&es.includes(r)){go(r);return}wm()}async function km(e,t){let r;if(e?.target&&typeof e.target=="string"&&!e.target.includes("{{")&&(r=e.target),!r||typeof r!="string"){Yr.warn("Invalid theme:",r);return}if(!es.includes(r)){Yr.warn("Unsupported theme:",r);return}const n=r;try{localStorage.setItem(Zc,n)}catch(o){Yr.error("Failed to save theme to localStorage:",o);return}go(n),Yr.log("Theme changed to:",n)}const Cm=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 _m(e,t){const r=window.G7Core;if(!r?.dispatch){Cm.error("G7Core.dispatch 가 초기화되지 않아 로그인 리다이렉트를 실행할 수 없습니다.");return}const n=window.location.pathname+window.location.search;await r.dispatch({handler:"navigate",params:{path:"/login",query:{redirect:n}}})}const ts=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 Sm(e,t){const r=window.G7Core,{url:n,filename:o}=e?.params||{};if(!n){ts.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!r?.api?.get){ts.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){ts.error("첨부파일 다운로드 실패",a),r?.toast?.error?.(r?.t?.("common.download_failed")??"Download failed")}}const ho={"sirsoft-basic.addSelectedItemIfComplete":Up,"sirsoft-basic.updateSelectedItemQuantity":zp,"sirsoft-basic.removeSelectedItem":Gp,"sirsoft-basic.updateNoOptionQuantity":jp,"sirsoft-basic.setBlockAdditionalOption":Hp,"sirsoft-basic.getDisplayPrice":fm,"sirsoft-basic.formatCurrency":hm,"sirsoft-basic.getCurrencySymbol":pm,"sirsoft-basic.loadPreferredCurrency":bm,"sirsoft-basic.savePreferredCurrency":ym,setTheme:km,initTheme:xm,redirectToLoginWithReturn:_m,downloadAttachment:Sm,toggleCartItemSelection:Kp,selectAllCartItems:Yp,setCartOption:Xp,openCartDeleteModal:qp,openCartOptionModal:Zp,recalculateCart:Qp,findMatchingOption:Rp,initCartOptionSelection:em,initCartKey:nm,getCartKey:om,clearCartKey:jc,regenerateCartKey:am,saveToStorage:sm,loadFromStorage:lm,initGuestOrderToken:im,saveGuestOrderToken:cm,clearGuestOrderToken:dm,clearGuestTokenOnEntry:um},Cn=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 Em(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 Tm(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function Am(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function Nm(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",...Am(),...Tm()},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 Om(e){const t=window.G7Core,r=t?.identity;if(!t?.dispatch||!t?.state||!r)return Cn.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=Em(e);let o;try{o=await Nm(e,n)}catch(p){Cn.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 k=new Date(m).getTime();Number.isFinite(k)&&k!==f&&(f=k)}const w=p?.identityChallenge?.resendCooldown;typeof w=="number"&&w>h&&(h=w)})??null}catch{}const u=r.createDeferred();try{await t.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(p){return Cn.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 Mm(){const e=window.G7Core?.identity;if(!e?.setLauncher){Cn.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(Om),Cn.log("IDV launcher registered (sirsoft-basic)")}const Qc=window.G7Core?.createLogger?.("Template:sirsoft-basic:device")??{log:(...e)=>console.log("[Template:sirsoft-basic:device]",...e),warn:(...e)=>console.warn("[Template:sirsoft-basic:device]",...e)};function Im(){if(typeof navigator>"u")return!1;const e=navigator,t=(e.userAgent||"").toLowerCase(),r=((e.userAgentData?.platform??e.platform)||"").toLowerCase(),n=e.maxTouchPoints??0;return/iphone|ipad|ipod/.test(t)||/iphone|ipad|ipod|ios/.test(r)?!0:/macintosh|mac os x/.test(t)&&n>1}function Pm(){const e=window.G7Core;if(!e?.state?.get||!e?.state?.set){Qc.warn("G7Core.state not available; skip iOS device correction");return}if(!Im())return;const r=(e.state.get()||{}).appConfig||{};r.isIos!==!0&&(e.state.set({appConfig:{...r,isIos:!0}}),Qc.log("appConfig.isIos corrected to true by client signals (iPadOS desktop-UA)"))}function Dm(e){const t=e.icons;return Array.isArray(t)?t.filter(r=>!!r&&typeof r=="object"&&typeof r.value=="string"):[]}function Lm(e,t){const r=e.label;return typeof r=="string"?r.startsWith("$t:")?t(r.slice(3)):r:e.value}function $m(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 Fm({entry:e}){const t=e.preview;return t?.html?d.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:ns}):t?.className?d.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:ns}):d.jsx("i",{className:`fas fa-${e.value}`,style:ns,"aria-hidden":"true"})}function Um({control:e,value:t,onChange:r,t:n}){const o=Dm(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:Jc,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:Rc})});const i=g=>Lm(g,n),u=o.filter(g=>$m(g,i(g),h));return d.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Jc,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:Rc}),d.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...zm,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===""?ed:rs,children:d.jsx("span",{style:Hm,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?ed:rs,children:d.jsx(Fm,{entry:g})},g.value)})]}),u.length===0&&d.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:Gm,children:n("layout_editor.icon_picker.no_results")})]})}const Jc={display:"flex",flexDirection:"column",gap:6,width:"100%"},Rc={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},zm={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},rs={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},ed={...rs,border:"2px solid #2563eb",background:"#eff6ff"},ns={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},Hm={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},Gm={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},td=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 jm(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){td.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",Um),td.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)")}const os=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=ho);function rd(){if(typeof window<"u"){let e=0;const t=50,r=()=>{const n=window.G7Core?.getActionDispatcher?.();n?(Object.entries(ho).forEach(([o,a])=>{n.registerHandler(o,a)}),os.log(`${Object.keys(ho).length} custom handler(s) registered:`,Object.keys(ho)),Mm(),Pm()):(e++,e<=t?(os.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(r,100)):os.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?r():window.addEventListener("load",r)}}return jm(),rd(),ee.A=_o,ee.Avatar=Qr,ee.AvatarUploader=Ya,ee.BrandMark=Uo,ee.Button=R,ee.Checkbox=ps,ee.Code=Id,ee.ConfirmDialog=va,ee.Container=Tp,ee.Div=j,ee.ExpandableContent=ma,ee.FileInput=cs,ee.FileUploader=so,ee.Flex=Np,ee.Footer=ks,ee.Form=So,ee.Grid=Ap,ee.H1=wd,ee.H2=fs,ee.H3=Tn,ee.H4=gs,ee.Header=ws,ee.Hr=Eo,ee.HtmlContent=ga,ee.HtmlEditor=li,ee.Icon=fe,ee.IconName=nt,ee.ImageGallery=zr,ee.Img=jt,ee.Input=At,ee.Label=Ar,ee.Li=er,ee.MobileNav=Cs,ee.Modal=ba,ee.Nav=Zr,ee.NotificationCenter=On,ee.Ol=xd,ee.Optgroup=Sd,ee.Option=_d,ee.P=Gt,ee.PageLoading=Tc,ee.PageSkeleton=Ka,ee.PageTransitionBlur=Ba,ee.PageTransitionIndicator=ja,ee.Pagination=Ac,ee.PasswordInput=us,ee.PostReactions=ai,ee.ProductCard=Bs,ee.ProductImageViewer=Gn,ee.QuantitySelector=ni,ee.RichTextEditor=si,ee.SearchBar=Oc,ee.Section=ms,ee.SectionLayout=Op,ee.Select=hs,ee.SlotContainer=Nn,ee.SocialLoginButtons=yc,ee.Span=te,ee.Svg=En,ee.TabNavigation=Dc,ee.Table=Ed,ee.Tbody=Ad,ee.Td=Md,ee.Textarea=ko,ee.Th=Od,ee.Thead=Td,ee.ThemeToggle=An,ee.ThreeColumnLayout=Mp,ee.Toast=Ga,ee.Tr=Nd,ee.Ul=Co,ee.UserInfo=Pc,ee.availablePasswordRules=xo,ee.compositeComponents=Ep,ee.defaultPasswordRules=ds,ee.initTemplate=rd,ee.templateMetadata=Ip,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"}),ee})({},ReactJSXRuntime,React,ReactDOM); + `})]}):null},rp=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionIndicator:ja,default:ja},Symbol.toStringTag,{value:"Module"})),wc=window.G7Core?.createLogger?.("Comp:PageTransitionBlur")??{log:(...e)=>console.log("[Comp:PageTransitionBlur]",...e),warn:(...e)=>console.warn("[Comp:PageTransitionBlur]",...e)},Ba=({className:e="",style:t})=>{const[r,n]=C.useState(!1);return C.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){wc.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{wc.log("isPending changed:",s),n(s)})},[]),r?d.jsx(j,{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},np=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionBlur:Ba,default:Ba},Symbol.toStringTag,{value:"Module"})),xc={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},kc=new Set(["hidden","block","inline-block","inline","flex","inline-flex","grid","inline-grid","table","table-row","table-cell","contents","list-item","flow-root"]),op=new Set(["Div","Flex","Grid","Section","Article","Nav","Aside","Main","Header","Footer","Fragment","Form","Container"]),ap=new Set(["H1","H2","H3","H4","H5","H6","P","Span","Label","A","Strong","Em","Small","Badge"]),sp=new Set(["Input","Textarea","Select","Checkbox","Radio","Toggle","DatePicker","TagInput","SearchBar"]),lp=new Set(["Img","Image","Avatar","AvatarUploader","ImageGallery","ProductImageViewer","FileUploader"]),Cc={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 ip(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=>!_c(o.if));return n.length>1&&cp(n)?[...r,Sc(n)]:[...r,...n]}if(t.length>1&&r.length===0){const n=t.filter(o=>!_c(o.if));return n.length===0?[]:n.length===1?n:[Sc(n)]}return e}function _c(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 cp(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 Sc(e){return e.reduce((t,r)=>Wa(r)>Wa(t)?r:t)}function Wa(e){return e.children?e.children.length+e.children.reduce((t,r)=>t+Wa(r),0):0}function dp(e){return e.includes("{{")?e.replace(/\{\{([^}]+)\}\}/g,(t,r)=>{const n=r.match(/\?[\s]*['"]([^'"]*)['"]\s*:\s*['"]/);return n?n[1]:""}):e}function Va(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 up(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 fp(e){switch(e){case"pulse":return"animate-pulse";case"wave":return"animate-pulse";case"none":return"";default:return"animate-pulse"}}function lo(e,t,r,n){return!e||e.length===0?[]:ip(e).map((a,s)=>Ec(a,t,r,s,n))}function gp(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 hp(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(kc.has(i)){n.push({breakpoint:xc[c]||0,display:i});continue}(xc[c]||0)<=t&&o.push(i);continue}if(kc.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 pp(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 Ec(e,t,r,n,o){const{name:a,children:s,iteration:l}=e,f=gp(e,o),h=up(e),c=h?`${h} ${f}`.trim():f,i=dp(c),u=hp(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,x)=>Ec({...e,iteration:void 0},t,r,x,o))},n);if(Cc[a])return d.jsx("div",{className:g,children:Cc[a](t,r)},n);if(op.has(a)){const m=Va(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 x=lo(s,t,r,o);if(!(x.length>0&&x.some(v=>v!==null)))return null;const M=pp(m);return d.jsx("div",{className:M.className,style:M.style,children:x},n)}const p=Va(g,a);if(ap.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"},x={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"},k=m[a]||"h-3.5",M=x[a]||"w-full",v=a.startsWith("H")?"mb-2 mt-1":"mb-1.5";return d.jsx("div",{className:`${k} ${M} bg-gray-200 dark:bg-gray-700 rounded ${t} ${v} ${p}`.trim()},n)}if(sp.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(lp.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=Va(g,a),x=lo(s,t,r,o);if(!(x.length>0&&x.some(T=>T!==null)))return null;const v=/\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} ${v}`.trim(),children:x},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:lo(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 Ka=({components:e,options:t})=>{const r=fp(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:lo(e,r,t.iteration_count,s)})},mp=Object.freeze(Object.defineProperty({__proto__:null,PageSkeleton:Ka,default:Ka},Symbol.toStringTag,{value:"Module"})),bp=(e,t)=>window.G7Core?.t?.(e,t)??e,Tc=({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||bp("nav.loading")})]})},yp=Object.freeze(Object.defineProperty({__proto__:null,default:Tc},Symbol.toStringTag,{value:"Module"})),Vr=(e,t)=>window.G7Core?.t?.(e,t)??e,Ac=({currentPage:e,totalPages:t,onPageChange:r,maxVisiblePages:n=5,showFirstLast:o=!0,showFirst:a,showLast:s,hasMorePages:l,className:f="",style:h,prevText:c,nextText:i,id:u,editorAttrs:g})=>{const p=t!=null,m=p?t:0,x=p?e{const N=[];if(!p){const w=Math.floor(n/2),y=e<=n?1:e-w;y>1&&(N.push(1),y>2&&N.push("..."));for(let E=y;E<=e;E++)N.push(E);return l&&(N.push(e+1),N.push("...")),N}if(m<=n+2)for(let w=1;w<=m;w++)N.push(w);else{const w=Math.floor(n/2);let y=Math.max(2,e-w),E=Math.min(m-1,e+w);e<=w+1?E=n:e>=m-w&&(y=m-n+1),N.push(1),y>2&&N.push("...");for(let O=y;O<=E;O++)N.push(O);E1&&N.push(m)}return N},[e,m,p,n,l]),T=N=>{N<1||N===e||p&&N>m||r(N)},I=()=>{e>1&&r(e-1)},S=()=>{x&&r(e+1)};return d.jsxs(j,{className:`flex items-center gap-2 ${f}`,style:h,role:"navigation","aria-label":Vr("common.pagination"),id:u,...g,children:[k&&d.jsx(R,{onClick:()=>T(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":Vr("common.first_page"),children:"«"}),d.jsx(R,{onClick:I,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":Vr("common.prev_page"),children:c||d.jsx(d.Fragment,{children:"‹"})}),d.jsx(j,{className:"flex items-center gap-1",children:v.map((N,w)=>{if(N==="...")return d.jsx(te,{className:"px-3 py-1 text-sm text-gray-500 dark:text-gray-400",children:"..."},`ellipsis-${w}`);const y=N,E=y===e;return d.jsx(R,{onClick:()=>T(y),className:`px-3 py-1 text-sm border rounded ${E?"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":Vr("common.page_n",{n:y}),"aria-current":E?"page":void 0,children:y},y)})}),d.jsx(R,{onClick:S,disabled:!x,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":Vr("common.next_page"),children:i||d.jsx(d.Fragment,{children:"›"})}),M&&d.jsx(R,{onClick:()=>T(m),disabled:e===m,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":Vr("common.last_page"),children:"»"})]})},vp=Object.freeze(Object.defineProperty({__proto__:null,Pagination:Ac},Symbol.toStringTag,{value:"Module"})),Nc=(e,t)=>window.G7Core?.t?.(e,t)??e,Oc=({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??Nc("common.search_placeholder"),[p,m]=C.useState(""),[x,k]=C.useState(!1),M=C.useRef(null),v=C.useRef(""),T=r!==void 0?r:p,I=f&&x&&s.length>0&&T.length>0;C.useEffect(()=>{r!==void 0&&(v.current=r)},[r]);const S=y=>{const E=y.target.value;m(E),n?.(y),v.current!==""&&E===""&&!y.nativeEvent.inputType&&setTimeout(()=>{const O=M.current?.querySelector("form");O&&O.requestSubmit()},0),v.current=E},N=y=>{m(y.text);const E={target:{value:y.text,name:e}};n?.(E),l?.(y),k(!1)},w=y=>{y.preventDefault(),o?.(y)};return d.jsxs(j,{ref:M,className:`relative ${h}`,style:c,id:i,...u,children:[d.jsx(So,{onSubmit:w,className:"relative",children:d.jsxs(j,{className:`relative flex items-center ${a?"gap-2":""}`,children:[d.jsxs(j,{className:"relative flex-1",children:[d.jsx(j,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:d.jsx(fe,{name:nt.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),d.jsx(At,{type:"search",name:e,value:T,onChange:S,onFocus:()=>k(!0),onBlur:()=>setTimeout(()=>k(!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(R,{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:Nc("common.search")})]})}),I&&d.jsx(j,{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(j,{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:()=>N(y),children:d.jsxs(j,{className:"flex items-center gap-2",children:[d.jsx(fe,{name:nt.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),d.jsx(te,{className:"text-sm text-gray-700 dark:text-gray-300",children:y.text})]})},y.id))})]})},wp=Object.freeze(Object.defineProperty({__proto__:null,SearchBar:Oc},Symbol.toStringTag,{value:"Module"})),_t=window.G7Core,xp={sm:"md",md:"lg",lg:"xl",xl:"2xl","2xl":"3xl"};function Ya({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:x=!0,deleteConfirmMessage:k,confirmUpload:M=!0,uploadConfirmMessage:v,uploadSuccessActions:T,uploadErrorActions:I,deleteSuccessActions:S,deleteErrorActions:N,id:w,editorAttrs:y}){const E=C.useRef(null),[O,$]=C.useState(!1),[P,L]=C.useState(!1),[U,_]=C.useState(void 0),[b,z]=C.useState(null),[F,G]=C.useState(!1),[X,B]=C.useState(!1),[Y,H]=C.useState(null),[W,Q]=C.useState(null),be=C.useRef(`avatar-upload-${Math.random().toString(36).slice(2,11)}`).current;C.useEffect(()=>{if(Y){const ae=URL.createObjectURL(Y);return Q(ae),()=>URL.revokeObjectURL(ae)}else Q(null)},[Y]);const se=C.useCallback(ae=>_t?.t?.(ae)??ae,[]),pe=C.useCallback(()=>{const ae=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return ae?decodeURIComponent(ae[1]):null},[]),ne=C.useCallback(()=>_t?.api?.getToken?.()??null,[]),Ae=C.useCallback(async ae=>{B(!1),H(null),$(!0),z(null);try{const ce=new FormData;ce.append("avatar",ae);const ke=pe(),Ee=ne(),Be=await fetch(n,{method:"POST",headers:{Accept:"application/json",...ke&&{"X-XSRF-TOKEN":ke},...Ee&&{Authorization:`Bearer ${Ee}`}},credentials:"include",body:ce});if(!Be.ok){const Pe=await Be.json().catch(()=>({}));throw new Error(Pe.message||se("attachment.upload_failed"))}const Me=await Be.json(),Ke=Me.data||Me;Ke.avatar&&_(Ke.avatar),a?.(Ke),_t?.toast?.success?.(se("mypage.profile.avatar_uploaded")),T?.length?T.forEach(Pe=>_t?.dispatch?.(Pe)):_t?.refetchDataSource?.("user")}catch(ce){const ke=ce instanceof Error?ce:new Error(String(ce));z(ke.message),s?.(ke),_t?.toast?.error?.(ke.message),I?.length&&I.forEach(Ee=>_t?.dispatch?.(Ee))}finally{$(!1),E.current&&(E.current.value="")}},[n,a,s,pe,ne,se]),ve=C.useCallback(async ae=>{const ce=ae.target.files?.[0];if(!ce)return;z(null);const ke=i*1024*1024;if(ce.size>ke){const Ee=new Error(se("attachment.file_too_large").replace(":max",`${i}MB`));z(Ee.message),s?.(Ee),_t?.toast?.error?.(Ee.message);return}if(c&&!ce.type.match(c.replace("*",".*"))){const Ee=new Error(se("attachment.invalid_file_type"));z(Ee.message),s?.(Ee),_t?.toast?.error?.(Ee.message);return}M?(H(ce),B(!0)):Ae(ce)},[i,c,s,M,Ae,se]),We=C.useCallback(async()=>{G(!1),L(!0),z(null);try{const ae=pe(),ce=ne(),ke=await fetch(o,{method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json",...ae&&{"X-XSRF-TOKEN":ae},...ce&&{Authorization:`Bearer ${ce}`}},credentials:"include"});if(!ke.ok){const Ee=await ke.json().catch(()=>({}));throw new Error(Ee.message||se("attachment.delete_failed"))}_(null),l?.(),_t?.toast?.success?.(se("mypage.profile.avatar_deleted")),S?.length?S.forEach(Ee=>_t?.dispatch?.(Ee)):_t?.refetchDataSource?.("user")}catch(ae){const ce=ae instanceof Error?ae:new Error(String(ae));z(ce.message),f?.(ce),_t?.toast?.error?.(ce.message),N?.length&&N.forEach(ke=>_t?.dispatch?.(ke))}finally{L(!1)}},[o,l,f,pe,ne,se]),me=C.useCallback(()=>{x?G(!0):We()},[x,We]),Te=C.useCallback(()=>{G(!1)},[]),ge=C.useCallback(()=>{B(!1),H(null),E.current&&(E.current.value="")},[]),Oe=C.useCallback(()=>{Y&&Ae(Y)},[Y,Ae]),we=U===void 0?e:U,$e=!!we,ze=xp[r]||"lg",K=F||X,oe=()=>d.jsxs(j,{className:"flex items-center justify-center gap-2",children:[d.jsx(At,{ref:E,id:be,type:"file",accept:c,className:"hidden",onChange:ve,disabled:O}),!$e&&d.jsxs(Ar,{htmlFor:be,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 ${O?"opacity-50 cursor-not-allowed":""}`,children:[O?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"image",size:"sm"}),d.jsx(te,{children:g||se("mypage.profile.register_avatar")})]}),$e&&d.jsxs(d.Fragment,{children:[d.jsxs(Ar,{htmlFor:be,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 ${O?"opacity-50 cursor-not-allowed":""}`,children:[O?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"upload",size:"sm"}),d.jsx(te,{children:g||se("common.change")})]}),h&&d.jsxs(R,{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:me,disabled:P,children:[P?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"trash-2",size:"sm"}),d.jsx(te,{children:p||se("common.delete")})]})]})]});return d.jsxs(j,{className:`flex flex-col items-center gap-3 ${u}`,id:w,...y,children:[X&&W?d.jsxs(j,{className:"relative",children:[d.jsx(jt,{src:W,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(j,{className:"absolute inset-0 rounded-full bg-blue-500/20 border-2 border-blue-500 border-dashed"})]}):d.jsx(Qr,{avatar:we||void 0,name:t,size:ze}),!m&&d.jsxs(j,{className:"w-[220px] flex flex-col items-center gap-2",children:[X&&Y&&d.jsxs(j,{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(j,{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(te,{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:v||se("mypage.profile.upload_avatar_confirm")})]}),d.jsxs(j,{className:"text-xs text-blue-600 dark:text-blue-400 truncate mb-3",title:Y.name,children:[Y.name," (",(Y.size/1024/1024).toFixed(2),"MB)"]}),d.jsxs(j,{className:"grid grid-cols-2 gap-2",children:[d.jsxs(R,{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:Oe,disabled:O,children:[O?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"check",size:"sm"}),d.jsx(te,{children:se("common.confirm")})]}),d.jsx(R,{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:ge,children:d.jsx(te,{children:se("common.cancel")})})]})]}),F&&d.jsxs(j,{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(j,{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(te,{className:"text-sm font-medium text-red-800 dark:text-red-300",children:k||se("mypage.profile.delete_avatar_confirm")})]}),d.jsxs(j,{className:"grid grid-cols-2 gap-2",children:[d.jsxs(R,{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:We,disabled:P,children:[P?d.jsx(fe,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(fe,{name:"trash-2",size:"sm"}),d.jsx(te,{children:se("common.delete")})]}),d.jsx(R,{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:Te,children:d.jsx(te,{children:se("common.cancel")})})]})]}),!K&&oe()]}),b&&!K&&d.jsxs(j,{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(te,{children:b})]})]})}const kp=Object.freeze(Object.defineProperty({__proto__:null,AvatarUploader:Ya,default:Ya},Symbol.toStringTag,{value:"Module"})),Mc=()=>window.G7Core,io=(e,t)=>window.G7Core?.t?.(e,t)??e,Ic={horizontal:"flex items-center gap-1.5",vertical:"flex flex-col items-start"},Cp=()=>[{key:"view_profile",label:io("userinfo.view_profile"),icon:"user",path:"/users/{{userId}}"},{key:"view_posts",label:io("userinfo.view_posts"),icon:"file-lines",path:"/users/{{userId}}/posts"}],Xa=({text:e,title:t})=>e?d.jsx(te,{className:"text-sm text-gray-500 dark:text-gray-400",title:t,children:e}):null,Dc=({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:x=[],id:k,editorAttrs:M})=>{const v=r??e?.uuid,T=a||e?.is_guest||!1,I=s||e?.status==="withdrawn",S=I?io("userinfo.withdrawn_user"):u??t??e?.name??"",[N,w]=C.useState(!1),[y,E]=C.useState({top:0,left:0}),O=C.useRef(null),$=C.useRef(null),P=C.useRef(null),L=h.replace("{userId}",String(v??"")),U=`${Ic[i]} ${c}`;C.useEffect(()=>{if(!N)return;const H=Q=>{const be=Q.target,se=O.current?.contains(be),pe=$.current?.contains(be);!se&&!pe&&w(!1)},W=()=>w(!1);return document.addEventListener("mousedown",H),window.addEventListener("scroll",W,!0),window.addEventListener("resize",W),()=>{document.removeEventListener("mousedown",H),window.removeEventListener("scroll",W,!0),window.removeEventListener("resize",W)}},[N]);const _=C.useCallback(()=>{if(p&&p.length>0)return p.filter(Q=>Q.show!==!1);let W=Cp().filter(Q=>!m.includes(Q.key)&&Q.show!==!1);return x&&x.length>0&&(W=[...W,...x.filter(Q=>Q.show!==!1)]),W},[p,m,x]),b=C.useCallback(()=>{if(P.current){const H=P.current.getBoundingClientRect();E({top:H.bottom+4,left:H.left})}},[]),z=C.useCallback((H,W)=>{if(W.stopPropagation(),W.preventDefault(),w(!1),H.onClick)H.onClick();else if(H.path){const Q=H.path.replace(/\{\{userId\}\}/g,String(v??"")),be=Mc();be?.navigate?be.navigate(Q):window.location.href=Q}},[v]),F=C.useCallback(H=>{H.preventDefault(),g&&H.stopPropagation(),!(T||!v)&&(l?(N||b(),w(W=>!W)):f&&Mc()?.navigate?.(L))},[g,T,v,l,N,b,f,L]);if(T||!v)return d.jsxs(j,{className:U,id:k,...M,children:[d.jsxs(j,{className:"flex items-center gap-1.5 text-gray-400 dark:text-gray-500",children:[d.jsx(te,{children:S}),d.jsx(te,{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:io("userinfo.guest_badge")})]}),d.jsx(Xa,{text:n,title:o})]});if(I)return d.jsxs(j,{className:U,id:k,...M,children:[d.jsx(te,{className:"text-gray-400 dark:text-gray-500 line-through",children:S}),d.jsx(Xa,{text:n,title:o})]});const G=_(),B=/\btext-\S+/.test(c)?"":"text-gray-900 dark:text-white",Y=l||f?`${B} hover:text-blue-600 dark:hover:text-blue-400 cursor-pointer font-medium`.trim():`${B} font-medium`.trim();return d.jsxs(j,{ref:O,className:`relative inline-block ${c}`,id:k,...M,children:[d.jsxs(j,{className:Ic[i],children:[d.jsx(R,{ref:P,onClick:F,className:Y,children:S}),d.jsx(Xa,{text:n,title:o})]}),l&&N&&G.length>0&&tr.createPortal(d.jsx(j,{ref:$,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(H=>d.jsxs(R,{onClick:W=>z(H,W),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-${H.key}`,children:[H.icon&&d.jsx(fe,{name:H.icon,className:"w-4 h-4"}),d.jsx(te,{children:H.label})]},H.key))}),document.body)]})},_p=Object.freeze(Object.defineProperty({__proto__:null,UserInfo:Dc},Symbol.toStringTag,{value:"Module"})),Pc=({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{!v.disabled&&v.id!==t&&r?.(v.id)},m=v=>{const T=v.target.value,I=Number(T),S=typeof T=="string"&&T!==""&&!Number.isNaN(I)?I:T,N=e.find(w=>String(w.id)===String(S));N&&p(N)},x=s.length>0?e.filter(v=>!s.includes(v.id)):e;if(g)return d.jsx(j,{className:`relative ${o}`,style:a,id:f,...h,children:d.jsx(hs,{value:t!==void 0?String(t):"",onChange:m,options:x.map(v=>({value:String(v.id),label:v.badge!==void 0?`${v.label} (${v.badge})`:v.label,disabled:v.disabled})),className:"w-full"})});const k=v=>{const T=v.id===t,I="flex items-center gap-2 px-3 py-2 font-medium text-sm transition-all shrink-0 whitespace-nowrap";if(v.disabled)return`${I} opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-600`;switch(n){case"pills":return T?`${I} bg-blue-600 dark:bg-blue-500 text-white rounded-lg`:`${I} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`;case"underline":return T?`${I} text-gray-900 dark:text-white border-b-2 border-gray-900 dark:border-white`:`${I} 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?`${I} 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`:`${I} 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(j,{className:`relative ${o}`,style:a,id:f,...h,children:d.jsx(Zr,{className:M,children:x.map(v=>d.jsxs(R,{type:"button",onClick:()=>p(v),disabled:v.disabled,className:k(v),children:[v.iconName&&d.jsx(fe,{name:v.iconName,size:"sm"}),d.jsx(te,{children:v.label}),v.badge!==void 0&&d.jsx(j,{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(te,{children:v.badge})})]},v.id))})})},Sp=Object.freeze(Object.defineProperty({__proto__:null,TabNavigation:Pc},Symbol.toStringTag,{value:"Module"})),Ep={Header:()=>Promise.resolve().then(()=>jd),Footer:()=>Promise.resolve().then(()=>Kd),MobileNav:()=>Promise.resolve().then(()=>Yd),SlotContainer:()=>Promise.resolve().then(()=>Hd),NotificationCenter:()=>Promise.resolve().then(()=>Gd),ProductCard:()=>Promise.resolve().then(()=>Mu),BrandMark:()=>Promise.resolve().then(()=>Du),ImageGallery:()=>Promise.resolve().then(()=>ri),ProductImageViewer:()=>Promise.resolve().then(()=>zg),QuantitySelector:()=>Promise.resolve().then(()=>Hg),PostReactions:()=>Promise.resolve().then(()=>Bg),RichTextEditor:()=>Promise.resolve().then(()=>Wg),HtmlContent:()=>Promise.resolve().then(()=>Vg),HtmlEditor:()=>Promise.resolve().then(()=>Kg),ExpandableContent:()=>Promise.resolve().then(()=>Yg),FileUploader:()=>Promise.resolve().then(()=>Y0),ConfirmDialog:()=>Promise.resolve().then(()=>Zg),SocialLoginButtons:()=>Promise.resolve().then(()=>q0),Toast:()=>Promise.resolve().then(()=>ep),PageTransitionIndicator:()=>Promise.resolve().then(()=>rp),PageTransitionBlur:()=>Promise.resolve().then(()=>np),PageSkeleton:()=>Promise.resolve().then(()=>mp),PageLoading:()=>Promise.resolve().then(()=>yp),ThemeToggle:()=>Promise.resolve().then(()=>Ld),Pagination:()=>Promise.resolve().then(()=>vp),SearchBar:()=>Promise.resolve().then(()=>wp),Avatar:()=>Promise.resolve().then(()=>Ud),AvatarUploader:()=>Promise.resolve().then(()=>kp),UserInfo:()=>Promise.resolve().then(()=>_p),Modal:()=>Promise.resolve().then(()=>qg),TabNavigation:()=>Promise.resolve().then(()=>Sp)},Tp=({id:e,className:t,style:r,children:n,editorAttrs:o})=>d.jsx(j,{id:e,className:t,style:r,...o,children:n}),Ap=({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 x={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};p.push(x[l])}if(f){const x={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};p.push(x[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(j,{id:e,className:p.join(" "),style:i,onClick:u,...g,children:t})},Np=({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 x={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(x[n]);const k={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(k[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(j,{id:e,className:g.join(" "),style:c,onClick:i,...u,children:t})},Op=({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=[],x={none:"p-0",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};m.push(x[o]);const k={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(k[a]),s){const v={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(v[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(ms,{id:e,className:m.join(" "),style:u,onClick:g,...p,children:[(t||r)&&d.jsxs(j,{className:"mb-4",children:[t&&d.jsx(fs,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t}),r&&d.jsx(Gt,{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:r})]}),n]})},Mp=({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(j,{id:e,className:h,style:l,...f,children:[d.jsx(j,{className:"flex flex-col",style:c,children:n}),d.jsx(j,{className:"flex flex-col",style:i,children:o}),d.jsx(j,{className:"flex flex-col",style:u,children:a})]})},Ip={identifier:"sirsoft-basic",vendor:"sirsoft",name:{ko:"Basic",en:"Basic"},version:"1.1.3",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.10",dependencies:{modules:{"sirsoft-board":">=1.0.0","sirsoft-ecommerce":">=1.1.0","sirsoft-page":">=1.1.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",asset:"vendor/font-awesome/6.4.0/css/all.inlined.css"},{id:"pretendard",type:"webfont",asset:"vendor/pretendard/1.3.9/pretendard-variable.css"}]},Dp={KRW:0,JPY:0};function Pp(){try{const t=(window.G7Core?.state?.get?.()||{})?.modules?.["sirsoft-ecommerce"]?.language_currency;return Array.isArray(t?.currencies)?t.currencies:[]}catch{return[]}}function Kr(e,t){if(!Number.isFinite(e))return"0";const r=Pp(),n=t||r.find(a=>a.is_default)?.code;if(!n)return e.toLocaleString();const o=r.find(a=>a.code===n)?.decimal_places??Dp[n]??2;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:n,minimumFractionDigits:o,maximumFractionDigits:o}).format(e)}catch{return`${e.toLocaleString(void 0,{minimumFractionDigits:o,maximumFractionDigits:o})} ${n}`}}function co(e,t,r,n=0){if(!e)return;const o=f=>f?.value??f?.price??0;let a;for(const[f,h]of Object.entries(e))if(h?.is_default){a=f;break}a=a??(e.KRW?"KRW":void 0);const s=a?o(e[a]):0,l={};for(const[f,h]of Object.entries(e)){const c=o(h);let i;r?i=r[f]?.value??0:n>0&&f===a?i=n:n>0&&s>0?i=n*c/s:i=0;const u=(c+i)*t;l[f]={value:u,formatted:Kr(u,f)}}return l}function uo(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:Kr(o,n)};return r}function Lc(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 $c(e,t){if(!e||!t?.length)return;const r={};let n=!1;for(const a of t){const s=e[a.id];if(s==null)continue;const f=a.values?.find(h=>h.id===Number(s))?.multi_currency_price_adjustment;if(f){n=!0;for(const[h,c]of Object.entries(f)){const i=c?.value??c?.price??0;r[h]=(r[h]??0)+i}}}if(!n)return;const o={};for(const[a,s]of Object.entries(r))o[a]={value:s};return o}function fo(e){return e.name_localized?e.name_localized:typeof e.name=="string"?e.name:e.name?.ko??""}function Lp(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 $p(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 Fp(e,t,r){return r.find(n=>!n?.option_values||!n?.is_active?!1:e.every(o=>{const a=fo(o),s=t?.[a];return Lp(n.option_values,n.option_values_localized,a)===s}))}function Up(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(S=>{const N=fo(S);return l?.[N]}))return;const h=Fp(n,l,o??[]);if(!h){t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const c=n.map(S=>l[fo(S)]).join("_"),i=a??[];if(i.find(S=>S.id===c)){const S=window.G7Core;S?.toast?.warning?.(S?.t?.("sirsoft-ecommerce.shop.already_added_option")??"이미 추가된 옵션입니다."),t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const g=h.selling_price??0,p={};n.forEach(S=>{const N=fo(S);p[N]=l[N]});const m=r.additionalOptionGroups??[],x={};for(const S of m){if(!S.is_required)continue;const N=S.values?.find(w=>w.is_default);N&&(x[S.id]=N.id)}const k=Lc(x,m),M=$c(x,m),v=g+k,T={id:c,optionId:h.id,options:p,optionValues:$p(h.option_values,h.option_values_localized),quantity:1,stock:h.stock_quantity??999,unitPrice:g,unitPriceFormatted:Kr(g,s),totalPrice:v,totalPriceFormatted:Kr(v,s),multiCurrencyUnitPrice:h.multi_currency_selling_price,multiCurrencyTotalPrice:co(h.multi_currency_selling_price,1,M,k),additionalOptionSelections:x,additionalOptionsTotal:k,additionalOptionsMultiCurrencyTotal:M},I=[...i,T];t.setState?.({selectedOptionItems:I,selectedTotalMultiCurrency:uo(I),currentSelection:{},__mergeMode:"shallow"})}function zp(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:Kr(u,o),multiCurrencyTotalPrice:co(f?.multiCurrencyUnitPrice,s,f?.additionalOptionsMultiCurrencyTotal,i)}});t.setState?.({selectedOptionItems:l,selectedTotalMultiCurrency:uo(l)})}function Hp(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 T=String(r.customText??"");T.trim()===""?delete p[l]:p[l]=T}else h==null?(delete g[l],delete p[l]):(g[l]=h,(o??[]).find(S=>S.id===l)?.values?.find(S=>S.id===h)?.allow_custom_text||delete p[l]);const m=Lc(g,o),x=$c(g,o),k=i?.unitPrice??0,M=i?.quantity??1,v=(k+m)*M;return{...i,additionalOptionSelections:g,additionalOptionCustomTexts:p,additionalOptionsTotal:m,additionalOptionsMultiCurrencyTotal:x,totalPrice:v,totalPriceFormatted:Kr(v,a),multiCurrencyTotalPrice:co(i?.multiCurrencyUnitPrice,M,x,m)}});t.setState?.({selectedOptionItems:c,selectedTotalMultiCurrency:uo(c)})}function Gp(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:uo(o)})}function jp(e,t){const r=e.params;if(!r)return;const n=Math.max(1,Number(r.newQuantity)||1);t.setState?.({noOptionQuantity:n,noOptionTotalMultiCurrency:co(r.multiCurrencyUnitPrice,n)})}const xn=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 kr(e){const t=window.G7Core;t?.state?.setLocal?(t.state.setLocal(e),xn.log("Local state updated:",e)):xn.warn("G7Core.state.setLocal not available")}function Fc(){return window.G7Core?.state?.getLocal?.()||{}}function Bp(){return window.G7Core?.state?.get?.()||{}}function Wp(e,t="info"){const r=window.G7Core;r?.toast?.show?r.toast.show(e,t):xn.warn("G7Core.toast.show not available, message:",e)}function Vp(e){const t=window.G7Core;return t?.t?t.t(e):e}function Uc(){const e=window.G7Core;if(e?.dispatch){const r=Fc().selectedItems||[];e.dispatch({handler:"refetchDataSource",params:{dataSourceId:"cartItems"}}),xn.log("Refetching cartItems with selected_ids:",r)}else xn.warn("G7Core.dispatch not available")}function Kp(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=Bp().cartItems?.data?.items||[],f=l.length>0&&a.length===l.length;kr({selectedItems:a,allSelected:f}),Uc()}function Yp(e,t){const{allItemIds:r,isSelected:n}=e?.params||{};kr({selectedItems:n?r:[],allSelected:n}),Uc()}function Xp(e,t){const{optionName:r,optionValue:n}=e?.params||{},a=Fc().selectedOptions||{};kr({selectedOptions:{...a,[r]:n}})}function qp(e,t){const{targetIds:r}=e?.params||{};if(!r||r.length===0){Wp(Vp("shop.cart.select_items_to_delete"),"warning");return}kr({deleteModal:{visible:!0,targetIds:r}})}function Zp(e,t){const{targetItem:r}=e?.params||{};kr({optionModal:{visible:!0,targetItem:r},selectedOptions:r?.options||{},selectedQuantity:r?.quantity})}function Qp(e,t){const{selectedItems:r}=e?.params||{};if(!r||r.length===0){kr({isCalculating:!1});return}kr({isCalculating:!0})}const Cr=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 qa(e){return e.name_localized?e.name_localized:typeof e.name=="string"?e.name:e.name?.ko??""}function Jp(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 zc(e,t,r){return!e||!t?.length?null:t.every(a=>{const s=qa(a);return e[s]})?r?.find(a=>t.every(s=>{const l=qa(s);return Jp(a.option_values,a.option_values_localized,l)===e[l]}))||null:(Cr.log("Not all options selected yet"),null)}function Rp(e,t){const{selectedOptions:r,optionGroups:n,options:o}=e?.params||{};Cr.log("findMatchingOption called:",{selectedOptions:r,optionGroups:n,optionsCount:o?.length});const a=zc(r,n,o);return Cr.log("Matched option:",a),{matchedOption:a}}function em(e,t){const{currentOptionValues:r,optionGroups:n,options:o}=e?.params||{};if(Cr.log("initCartOptionSelection called:",{currentOptionValues:r,optionGroups:n,optionsCount:o?.length}),!n?.length||!r)return Cr.log("No option groups or current values, returning empty"),{selectedOptions:{},matchedOption:null};const a={};for(const l of n){const f=qa(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)}Cr.log("Initial selectedOptions:",a);const s=zc(a,n,o||[]);return Cr.log("Matched option:",s),{selectedOptions:a,matchedOption:s}}const kn="g7_cart_key",tm="/api/modules/sirsoft-ecommerce/cart/key",Za="g7_guest_order_token",Hc="g7_guest_order_number",Qa="g7_guest_order_expires_at",ft=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 Gc(){try{const e=await fetch(tm,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"}});return e.ok?(await e.json()).data?.cart_key||null:(ft.error("Failed to issue cartKey from API:",e.status),null)}catch(e){return ft.error("Error issuing cartKey from API:",e),null}}function sr(e){const t=window.G7Core;t?.state?.set?(t.state.set(e),ft.log("Global state updated:",e)):ft.warn("G7Core.state.set not available")}function rm(){try{const e=window.G7Config;return e?.user?e.user:(window.G7Core?.state?.get?.()||{}).currentUser||null}catch{return null}}async function nm(e,t){let r=null;try{r=localStorage.getItem(kn)}catch{}if(r)ft.log("Existing cartKey loaded:",r);else if(r=await Gc(),r)try{localStorage.setItem(kn,r),ft.log("New cartKey issued from API:",r)}catch{}else ft.error("Failed to issue cartKey from API");sr({cartKey:r})}function om(e,t){try{return localStorage.getItem(kn)}catch{return null}}function jc(e,t){try{localStorage.removeItem(kn),ft.log("cartKey removed from localStorage")}catch{}sr({cartKey:null})}async function am(e,t){if(rm()){jc();return}const n=await Gc();if(n){try{localStorage.setItem(kn,n),ft.log("New cartKey regenerated from API:",n)}catch{}sr({cartKey:n})}else ft.error("Failed to regenerate cartKey from API")}function sm(e,t){const{key:r,value:n}=e?.params||{};if(!r){ft.warn("saveToStorage: key is required");return}try{localStorage.setItem(r,n),ft.log("Saved to storage:",r,n)}catch{}}function lm(e,t){const{key:r,defaultValue:n}=e?.params||{};if(!r)return ft.warn("loadFromStorage: key is required"),n||null;try{return localStorage.getItem(r)||n||null}catch{return n||null}}function Ja(){try{sessionStorage.removeItem(Za),sessionStorage.removeItem(Hc),sessionStorage.removeItem(Qa)}catch{}}function im(e,t){let r=null,n=null;try{r=sessionStorage.getItem(Za),n=sessionStorage.getItem(Qa)}catch{}let o=!1;if(r){const a=n?new Date(n).getTime():NaN;(isNaN(a)||a<=Date.now())&&(Ja(),r=null,o=!0)}if(r){sr({guestOrderToken:r}),ft.log("Guest order token loaded from sessionStorage");return}if(!o){const s=window.G7Core?.state?.get?.("_global")?.guestOrderToken;if(typeof s=="string"&&s!==""){ft.log("Guest order token preserved from in-memory _global (sessionStorage empty)");return}}sr({guestOrderToken:null}),ft.log("No guest order token (visitor not authenticated)")}function cm(e,t){const{token:r,orderNumber:n,expiresAt:o}=e?.params||{};if(!r||!n||!o){ft.warn("saveGuestOrderToken: token, orderNumber, expiresAt are required");return}try{sessionStorage.setItem(Za,r),sessionStorage.setItem(Hc,n),sessionStorage.setItem(Qa,o)}catch{}sr({guestOrderToken:r})}function dm(e,t){Ja(),sr({guestOrderToken:null})}function um(e,t){Ja(),sr({guestOrderToken:null})}function Bc(e){const t=window.G7Core?.state?.get?.()?.[e];return typeof t=="string"&&t.length>0?t:void 0}function fm(e,t){const r=e?.params??{},{product:n,priceField:o,currencyCode:a}=r,s=a||Bc("preferredCurrency")||Bc("defaultCurrency")||"",l=`multi_currency_${o}`,f=n[l];if(f&&f[s])return f[s].formatted;const h=`${o}_formatted`;return n[h]||String(n[o])}const Wc={KRW:"₩",USD:"$",JPY:"¥",CNY:"元",EUR:"€",GBP:"£"},gm={KRW:0,JPY:0};function Vc(){try{const t=(window.G7Core?.state?.get?.()||{})?.modules?.["sirsoft-ecommerce"]?.language_currency;return Array.isArray(t?.currencies)?t.currencies:[]}catch{return[]}}function Kc(e){const t=window.G7Core?.state?.get?.()?.[e];return typeof t=="string"&&t.length>0?t:void 0}function hm(e,t){const r=e?.params??{},{value:n,currencyCode:o,locale:a}=r,s=Vc(),l=o||Kc("preferredCurrency")||Kc("defaultCurrency")||s.find(u=>u.is_default)?.code;if(!l)return n.toLocaleString(a);const f=s.find(u=>u.code===l),h=f?.symbol&&f.symbol.length>0?f.symbol:Wc[l]??"",c=f?.decimal_places??gm[l]??2,i=n.toLocaleString(a,{minimumFractionDigits:c,maximumFractionDigits:c});return h?l==="KRW"||h==="₩"||h==="원"?`${i}원`:`${h}${i}`:`${i} ${l}`}function pm(e){const t=Vc().find(r=>r.code===e);return t?.symbol&&t.symbol.length>0?t.symbol:Wc[e]||e}const Ra=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)},Yc="g7_preferred_currency";function mm(){try{const e=window.G7Core?.state?.get?.()||{};return e.defaultCurrency||e?.modules?.["sirsoft-ecommerce"]?.language_currency?.default_currency||""}catch{return""}}function Xc(e){window.G7Core?.state?.set?.({preferredCurrency:e})}function bm(e,t){const r=e?.params??{},{defaultCurrency:n=mm()}=r;let o=n;try{if(typeof window<"u"&&window.localStorage){const a=localStorage.getItem(Yc);a&&qc(a)&&(o=a)}}catch{Ra.warn("localStorage 접근 불가, 기본 통화 사용:",n)}return Xc(o),o}function ym(e,t){const{currencyCode:r}=e?.params??{};if(!qc(r)){Ra.warn("유효하지 않은 통화 코드:",r);return}try{typeof window<"u"&&window.localStorage&&localStorage.setItem(Yc,r)}catch{Ra.warn("localStorage 저장 실패")}Xc(r)}function qc(e){return typeof e=="string"&&/^[A-Z]{3}$/.test(e)}const Yr=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)},es=["auto","light","dark"],Zc="g7_color_scheme",vm=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,go=e=>{const t=vm(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function wm(){try{const e=localStorage.getItem(Zc),t=e&&es.includes(e)?e:"auto";go(t),Yr.log("Initial theme applied:",t)}catch(e){Yr.warn("Failed to load initial theme:",e),go("auto")}}async function xm(e,t){const r=e?.target;if(r&&typeof r=="string"&&es.includes(r)){go(r);return}wm()}async function km(e,t){let r;if(e?.target&&typeof e.target=="string"&&!e.target.includes("{{")&&(r=e.target),!r||typeof r!="string"){Yr.warn("Invalid theme:",r);return}if(!es.includes(r)){Yr.warn("Unsupported theme:",r);return}const n=r;try{localStorage.setItem(Zc,n)}catch(o){Yr.error("Failed to save theme to localStorage:",o);return}go(n),Yr.log("Theme changed to:",n)}const Cm=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 _m(e,t){const r=window.G7Core;if(!r?.dispatch){Cm.error("G7Core.dispatch 가 초기화되지 않아 로그인 리다이렉트를 실행할 수 없습니다.");return}const n=window.location.pathname+window.location.search;await r.dispatch({handler:"navigate",params:{path:"/login",query:{redirect:n}}})}const ts=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 Sm(e,t){const r=window.G7Core,{url:n,filename:o}=e?.params||{};if(!n){ts.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!r?.api?.get){ts.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){ts.error("첨부파일 다운로드 실패",a),r?.toast?.error?.(r?.t?.("common.download_failed")??"Download failed")}}const ho={"sirsoft-basic.addSelectedItemIfComplete":Up,"sirsoft-basic.updateSelectedItemQuantity":zp,"sirsoft-basic.removeSelectedItem":Gp,"sirsoft-basic.updateNoOptionQuantity":jp,"sirsoft-basic.setBlockAdditionalOption":Hp,"sirsoft-basic.getDisplayPrice":fm,"sirsoft-basic.formatCurrency":hm,"sirsoft-basic.getCurrencySymbol":pm,"sirsoft-basic.loadPreferredCurrency":bm,"sirsoft-basic.savePreferredCurrency":ym,setTheme:km,initTheme:xm,redirectToLoginWithReturn:_m,downloadAttachment:Sm,toggleCartItemSelection:Kp,selectAllCartItems:Yp,setCartOption:Xp,openCartDeleteModal:qp,openCartOptionModal:Zp,recalculateCart:Qp,findMatchingOption:Rp,initCartOptionSelection:em,initCartKey:nm,getCartKey:om,clearCartKey:jc,regenerateCartKey:am,saveToStorage:sm,loadFromStorage:lm,initGuestOrderToken:im,saveGuestOrderToken:cm,clearGuestOrderToken:dm,clearGuestTokenOnEntry:um},Cn=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 Em(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 Tm(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function Am(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function Nm(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",...Am(),...Tm()},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 Om(e){const t=window.G7Core,r=t?.identity;if(!t?.dispatch||!t?.state||!r)return Cn.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=Em(e);let o;try{o=await Nm(e,n)}catch(p){Cn.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 k=new Date(m).getTime();Number.isFinite(k)&&k!==f&&(f=k)}const x=p?.identityChallenge?.resendCooldown;typeof x=="number"&&x>h&&(h=x)})??null}catch{}const u=r.createDeferred();try{await t.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(p){return Cn.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 Mm(){const e=window.G7Core?.identity;if(!e?.setLauncher){Cn.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(Om),Cn.log("IDV launcher registered (sirsoft-basic)")}const Qc=window.G7Core?.createLogger?.("Template:sirsoft-basic:device")??{log:(...e)=>console.log("[Template:sirsoft-basic:device]",...e),warn:(...e)=>console.warn("[Template:sirsoft-basic:device]",...e)};function Im(){if(typeof navigator>"u")return!1;const e=navigator,t=(e.userAgent||"").toLowerCase(),r=((e.userAgentData?.platform??e.platform)||"").toLowerCase(),n=e.maxTouchPoints??0;return/iphone|ipad|ipod/.test(t)||/iphone|ipad|ipod|ios/.test(r)?!0:/macintosh|mac os x/.test(t)&&n>1}function Dm(){const e=window.G7Core;if(!e?.state?.get||!e?.state?.set){Qc.warn("G7Core.state not available; skip iOS device correction");return}if(!Im())return;const r=(e.state.get()||{}).appConfig||{};r.isIos!==!0&&(e.state.set({appConfig:{...r,isIos:!0}}),Qc.log("appConfig.isIos corrected to true by client signals (iPadOS desktop-UA)"))}function Pm(e){const t=e.icons;return Array.isArray(t)?t.filter(r=>!!r&&typeof r=="object"&&typeof r.value=="string"):[]}function Lm(e,t){const r=e.label;return typeof r=="string"?r.startsWith("$t:")?t(r.slice(3)):r:e.value}function $m(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 Fm({entry:e}){const t=e.preview;return t?.html?d.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:ns}):t?.className?d.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:ns}):d.jsx("i",{className:`fas fa-${e.value}`,style:ns,"aria-hidden":"true"})}function Um({control:e,value:t,onChange:r,t:n}){const o=Pm(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:Jc,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:Rc})});const i=g=>Lm(g,n),u=o.filter(g=>$m(g,i(g),h));return d.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Jc,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:Rc}),d.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...zm,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===""?ed:rs,children:d.jsx("span",{style:Hm,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?ed:rs,children:d.jsx(Fm,{entry:g})},g.value)})]}),u.length===0&&d.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:Gm,children:n("layout_editor.icon_picker.no_results")})]})}const Jc={display:"flex",flexDirection:"column",gap:6,width:"100%"},Rc={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},zm={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},rs={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},ed={...rs,border:"2px solid #2563eb",background:"#eff6ff"},ns={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},Hm={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},Gm={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},td=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 jm(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){td.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",Um),td.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)")}const os=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=ho);function rd(){if(typeof window<"u"){let e=0;const t=50,r=()=>{const n=window.G7Core?.getActionDispatcher?.();n?(Object.entries(ho).forEach(([o,a])=>{n.registerHandler(o,a)}),os.log(`${Object.keys(ho).length} custom handler(s) registered:`,Object.keys(ho)),Mm(),Dm()):(e++,e<=t?(os.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(r,100)):os.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?r():window.addEventListener("load",r)}}return jm(),rd(),ee.A=_o,ee.Avatar=Qr,ee.AvatarUploader=Ya,ee.BrandMark=Uo,ee.Button=R,ee.Checkbox=ps,ee.Code=Id,ee.ConfirmDialog=va,ee.Container=Tp,ee.Div=j,ee.ExpandableContent=ma,ee.FileInput=cs,ee.FileUploader=so,ee.Flex=Np,ee.Footer=ks,ee.Form=So,ee.Grid=Ap,ee.H1=wd,ee.H2=fs,ee.H3=Tn,ee.H4=gs,ee.Header=ws,ee.Hr=Eo,ee.HtmlContent=ga,ee.HtmlEditor=li,ee.Icon=fe,ee.IconName=nt,ee.ImageGallery=zr,ee.Img=jt,ee.Input=At,ee.Label=Ar,ee.Li=er,ee.MobileNav=Cs,ee.Modal=ba,ee.Nav=Zr,ee.NotificationCenter=On,ee.Ol=xd,ee.Optgroup=Sd,ee.Option=_d,ee.P=Gt,ee.PageLoading=Tc,ee.PageSkeleton=Ka,ee.PageTransitionBlur=Ba,ee.PageTransitionIndicator=ja,ee.Pagination=Ac,ee.PasswordInput=us,ee.PostReactions=ai,ee.ProductCard=Bs,ee.ProductImageViewer=Gn,ee.QuantitySelector=ni,ee.RichTextEditor=si,ee.SearchBar=Oc,ee.Section=ms,ee.SectionLayout=Op,ee.Select=hs,ee.SlotContainer=Nn,ee.SocialLoginButtons=yc,ee.Span=te,ee.Svg=En,ee.TabNavigation=Pc,ee.Table=Ed,ee.Tbody=Ad,ee.Td=Md,ee.Textarea=ko,ee.Th=Od,ee.Thead=Td,ee.ThemeToggle=An,ee.ThreeColumnLayout=Mp,ee.Toast=Ga,ee.Tr=Nd,ee.Ul=Co,ee.UserInfo=Dc,ee.availablePasswordRules=xo,ee.compositeComponents=Ep,ee.defaultPasswordRules=ds,ee.initTemplate=rd,ee.templateMetadata=Ip,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"}),ee})({},ReactJSXRuntime,React,ReactDOM); diff --git a/templates/_bundled/sirsoft-basic/dist/src/components/composite/Pagination.d.ts b/templates/_bundled/sirsoft-basic/dist/src/components/composite/Pagination.d.ts index 8632d604..ae9ea817 100644 --- a/templates/_bundled/sirsoft-basic/dist/src/components/composite/Pagination.d.ts +++ b/templates/_bundled/sirsoft-basic/dist/src/components/composite/Pagination.d.ts @@ -6,8 +6,8 @@ export interface PaginationProps { * 마지막 페이지 번호 * * 총 건수가 상한을 넘겨 정확히 세지 않은 목록은 마지막 페이지를 계산할 수 없다. - * 그 경우 서버가 `null` 을 보내며, 페이지 번호 목록과 마지막 페이지 점프가 사라지고 - * 이전/다음 이동만 남는다. 0 이나 1 로 채우면 화면이 "1페이지뿐" 이라고 잘못 말하게 된다. + * 그 경우 서버가 `null` 을 보내며, 마지막 페이지 점프만 사라진다. 1 부터 현재 페이지까지와 + * (`hasMorePages` 가 참이면) 다음 페이지 번호는 그대로 그린다. 0 이나 1 로 채우면 화면이 "1페이지뿐" 이라고 잘못 말하게 된다. */ totalPages: number | null; onPageChange: (page: number) => void; diff --git a/templates/_bundled/sirsoft-basic/src/components/composite/Pagination.tsx b/templates/_bundled/sirsoft-basic/src/components/composite/Pagination.tsx index 3f933aaf..f09338ff 100644 --- a/templates/_bundled/sirsoft-basic/src/components/composite/Pagination.tsx +++ b/templates/_bundled/sirsoft-basic/src/components/composite/Pagination.tsx @@ -14,8 +14,8 @@ export interface PaginationProps { * 마지막 페이지 번호 * * 총 건수가 상한을 넘겨 정확히 세지 않은 목록은 마지막 페이지를 계산할 수 없다. - * 그 경우 서버가 `null` 을 보내며, 페이지 번호 목록과 마지막 페이지 점프가 사라지고 - * 이전/다음 이동만 남는다. 0 이나 1 로 채우면 화면이 "1페이지뿐" 이라고 잘못 말하게 된다. + * 그 경우 서버가 `null` 을 보내며, 마지막 페이지 점프만 사라진다. 1 부터 현재 페이지까지와 + * (`hasMorePages` 가 참이면) 다음 페이지 번호는 그대로 그린다. 0 이나 1 로 채우면 화면이 "1페이지뿐" 이라고 잘못 말하게 된다. */ totalPages: number | null; onPageChange: (page: number) => void; @@ -93,8 +93,8 @@ export const Pagination: React.FC = ({ editorAttrs, }) => { // 총 건수를 정확히 세지 못한 목록은 마지막 페이지를 계산할 수 없다. - // 이때는 페이지 번호 목록과 마지막 페이지 점프를 감추고 이전/다음 이동만 남긴다 — - // 끝까지 넘겨 보는 것은 그대로 가능하다. + // 계산 불가한 값은 마지막 페이지 번호 하나뿐이므로 그 점프만 감춘다. 1 부터 현재 + // 페이지까지는 확실히 존재하고, 다음 페이지 존재 여부는 서버가 `hasMorePages` 로 알린다. const isBounded = totalPages !== null && totalPages !== undefined; const resolvedTotalPages = isBounded ? (totalPages as number) : 0; @@ -114,7 +114,21 @@ export const Pagination: React.FC = ({ const pages: (number | string)[] = []; if (!isBounded) { - // 마지막 페이지를 모르면 번호 목록을 만들 수 없다 (현재 페이지만 별도로 표시) + // 마지막 페이지를 모르면 아는 범위(1..현재, 다음이 있으면 현재+1)만 그린다. + // 현재+1 너머는 존재 여부를 모르므로 번호 대신 계속됨 표시만 둔다. + const halfVisible = Math.floor(maxVisiblePages / 2); + const startPage = currentPage <= maxVisiblePages ? 1 : currentPage - halfVisible; + if (startPage > 1) { + pages.push(1); + if (startPage > 2) pages.push('...'); + } + for (let i = startPage; i <= currentPage; i++) { + pages.push(i); + } + if (hasMorePages) { + pages.push(currentPage + 1); + pages.push('...'); + } return pages; } @@ -162,7 +176,7 @@ export const Pagination: React.FC = ({ } return pages; - }, [currentPage, resolvedTotalPages, isBounded, maxVisiblePages]); + }, [currentPage, resolvedTotalPages, isBounded, maxVisiblePages, hasMorePages]); const handlePageClick = (page: number) => { if (page < 1 || page === currentPage) return; @@ -212,13 +226,8 @@ export const Pagination: React.FC = ({ {prevText || <>‹} - {/* Page Numbers — 마지막 페이지를 모르면 현재 페이지만 표시 */} + {/* Page Numbers — 마지막 페이지를 모르면 아는 범위까지만 표시 */}
- {!isBounded && ( - - {currentPage} - - )} {pageNumbers.map((page, index) => { if (page === '...') { return ( diff --git a/templates/_bundled/sirsoft-basic/src/components/composite/__tests__/PaginationUnboundedNumbers.test.tsx b/templates/_bundled/sirsoft-basic/src/components/composite/__tests__/PaginationUnboundedNumbers.test.tsx new file mode 100644 index 00000000..e8a8973f --- /dev/null +++ b/templates/_bundled/sirsoft-basic/src/components/composite/__tests__/PaginationUnboundedNumbers.test.tsx @@ -0,0 +1,110 @@ +import { describe, it, expect, vi } from 'vitest'; +import { render, screen, fireEvent } from '@testing-library/react'; +import { Pagination } from '../Pagination'; + +/** + * 마지막 페이지를 모르는 목록의 페이지 번호 목록 회귀 + * + * 총 건수가 상한을 넘겨 `last_page` 가 `null` 이면 계산할 수 없는 값은 마지막 페이지 + * 번호 하나뿐이다. 1 부터 현재 페이지까지는 확실히 존재하고, 다음 페이지 존재 여부는 + * 서버가 `has_more_pages` 로 알린다. 그런데 종전 구현은 번호 목록을 통째로 비우고 + * 현재 페이지 숫자 하나만 남겨, 운영자가 앞 페이지로 직접 뛰어갈 방법을 잃었다 + * (활동 로그 화면 실측: "총 10000건 이상" 인데 페이저에 "1" 하나). + * + * 합의된 동작(CHANGELOG 7.0.10): 마지막 페이지로 바로 뛰는 버튼만 감춘다. + */ +describe('Pagination — last_page 를 모를 때의 페이지 번호 목록', () => { + // 접근성 이름은 「N페이지」 라벨이므로 번호 버튼은 표시 텍스트로 찾는다 + const pageButton = (n: number) => + screen.queryAllByRole('button').find((b) => b.textContent?.trim() === String(n)) ?? null; + + it('1 부터 현재 페이지까지의 번호가 그대로 그려진다', () => { + render( + + ); + + for (let n = 1; n <= 5; n++) { + expect(pageButton(n)).toBeInTheDocument(); + } + expect(pageButton(5)).toHaveAttribute('aria-current', 'page'); + }); + + it('다음 페이지가 있으면 그 번호 하나와 계속됨 표시가 붙고, 그 너머는 그리지 않는다', () => { + render( + + ); + + expect(pageButton(6)).toBeInTheDocument(); + expect(pageButton(7)).not.toBeInTheDocument(); + expect(screen.getByText('...')).toBeInTheDocument(); + }); + + it('다음 페이지가 없으면 현재 페이지가 끝이다 — 계속됨 표시도 없다', () => { + render( + + ); + + expect(pageButton(3)).toBeInTheDocument(); + expect(pageButton(4)).not.toBeInTheDocument(); + expect(screen.queryByText('...')).not.toBeInTheDocument(); + }); + + it('첫 페이지에서도 번호가 버튼으로 그려진다', () => { + render( + + ); + + expect(pageButton(1)).toBeInTheDocument(); + expect(pageButton(2)).toBeInTheDocument(); + }); + + it('깊은 페이지에서는 앞쪽을 접고 현재 페이지 주변만 남긴다', () => { + render( + + ); + + expect(pageButton(1)).toBeInTheDocument(); + expect(pageButton(2)).not.toBeInTheDocument(); + expect(pageButton(10)).toBeInTheDocument(); + expect(pageButton(11)).toBeInTheDocument(); + expect(pageButton(12)).toBeInTheDocument(); + expect(pageButton(13)).toBeInTheDocument(); + expect(pageButton(14)).not.toBeInTheDocument(); + expect(screen.getAllByText('...')).toHaveLength(2); + }); + + it('앞 페이지 번호와 다음 페이지 번호를 클릭하면 그 페이지로 이동한다', () => { + const onPageChange = vi.fn(); + render( + + ); + + fireEvent.click(pageButton(3)!); + expect(onPageChange).toHaveBeenCalledWith(3); + + fireEvent.click(pageButton(6)!); + expect(onPageChange).toHaveBeenCalledWith(6); + }); + + it('마지막 페이지 점프 버튼만 감춰진다', () => { + render( + + ); + + expect(screen.queryByLabelText('마지막 페이지')).not.toBeInTheDocument(); + expect(screen.getByLabelText('이전 페이지')).toBeInTheDocument(); + expect(screen.getByLabelText('다음 페이지')).toBeInTheDocument(); + }); +}); diff --git a/tests/Playwright/specs/admin/activity-log-unbounded-pagination.spec.ts b/tests/Playwright/specs/admin/activity-log-unbounded-pagination.spec.ts new file mode 100644 index 00000000..61c67ead --- /dev/null +++ b/tests/Playwright/specs/admin/activity-log-unbounded-pagination.spec.ts @@ -0,0 +1,72 @@ +/** + * E2E: 총 건수를 정확히 세지 못한 목록의 페이지 번호 목록 + * + * @scenario activity_log_unbounded_pager_numbers, activity_log_unbounded_pager_no_last + * @effects page_numbers_visible, last_page_jump_hidden + * + * 총 건수 집계 상한(관리자 > 환경설정 > 고급)을 활동 로그 건수보다 작게 낮춰 + * `last_page: null` 응답을 실제 서버에서 만들고, 활동 로그 화면의 페이저가 + * 1. 1 페이지 번호 버튼과 다음 페이지(2) 번호 버튼을 그리고 + * 2. 마지막 페이지 점프 버튼은 그리지 않으며 + * 3. 번호 버튼을 눌러 그 페이지로 이동하는지 + * 를 확인한다. 종전에는 현재 페이지 숫자 하나만 남아 앞 페이지로 뛸 방법이 없었다. + * 테스트가 끝나면 상한을 원래 값으로 되돌린다. + */ +import { test, expect, issueToken, authenticatePage } from '../../fixtures/auth'; + +const SETTINGS_URL = '/api/admin/settings'; + +async function readResultCap(page: import('@playwright/test').Page, token: string): Promise { + const res = await page.request.get(SETTINGS_URL, { headers: { Authorization: `Bearer ${token}` } }); + expect(res.ok()).toBeTruthy(); + const body = await res.json(); + return Number(body?.data?.advanced?.pagination_result_cap ?? 10000); +} + +async function writeResultCap(page: import('@playwright/test').Page, token: string, cap: number): Promise { + const res = await page.request.post(SETTINGS_URL, { + headers: { Authorization: `Bearer ${token}` }, + data: { advanced: { pagination_result_cap: cap } }, + }); + expect(res.ok(), `설정 저장 실패: ${res.status()}`).toBeTruthy(); +} + +// @scenario link=activity_log_unbounded_pager_numbers, permitted=na +// @effects page_numbers_visible, last_page_jump_hidden +test('#519 후속 - 총 건수를 모르는 활동 로그에서도 페이지 번호가 그려지고 마지막 페이지 버튼만 감춰진다', async ({ page }) => { + const token = issueToken('core.settings.update'); + await authenticatePage(page, token); + + const originalCap = await readResultCap(page, token); + await writeResultCap(page, token, 5); + + try { + await page.goto('/admin/activity-logs?per_page=5'); + await page.waitForLoadState('domcontentloaded', { timeout: 30_000 }); + + const list = await page.request.get('/api/admin/activity-logs?per_page=5', { + headers: { Authorization: `Bearer ${token}` }, + }); + const listBody = await list.json(); + const meta = listBody?.data?.pagination ?? listBody?.meta; + test.skip(!meta || meta.last_page !== null, '활동 로그가 상한(5건) 이하라 last_page 가 계산된다 — 이 시나리오의 전제가 성립하지 않는다'); + + // 페이저 루트는 Div(role=navigation) 이라 태그가 아니라 역할·이름으로 찾는다 + const nav = page.getByRole('navigation', { name: '페이지네이션' }).first(); + await expect(nav).toBeVisible({ timeout: 15_000 }); + + const pageButton = (n: number) => nav.locator('button', { hasText: new RegExp(`^${n}$`) }); + await expect(pageButton(1)).toBeVisible(); + await expect(pageButton(1)).toHaveAttribute('aria-current', 'page'); + await expect(pageButton(2)).toBeVisible(); + await expect(nav.locator('button[aria-label="마지막 페이지"]')).toHaveCount(0); + await expect(nav.locator('button[aria-label="다음 페이지"]')).toBeEnabled(); + + await pageButton(2).click(); + await expect(pageButton(2)).toHaveAttribute('aria-current', 'page', { timeout: 15_000 }); + await expect(pageButton(1)).toBeVisible(); + await expect(pageButton(3)).toBeVisible(); + } finally { + await writeResultCap(page, token, originalCap); + } +});