공개 (S3 드라이버) × (공개 자산 CDN) 병합 결과를 실 AWS S3 로 교차 실측하다 발견한 결함과, 그 과정에서 드러난 설정 화면의 사각을 함께 처리한다. ## 교차 출처 공개 자산 요청 공개 자산 디스크를 켜면 첨부·이미지의 download_url 이 외부 origin 절대 URL 이 되는데, API 클라이언트가 URL 출처를 보지 않고 Authorization 을 붙이고 있었다. 그 결과 ① 세션 토큰이 제3자 origin 으로 전송되고(응답을 허용하는 CDN 에서는 접근 로그에 남는다) ② 안전목록 밖 헤더라 preflight 가 발생해 CORS 미설정 버킷에서는 이미지가 통째로 실패했다. 상점 화면은 <img> 라 무증상이고 관리자 화면에서만 발현해 발견이 늦었다. - 코어: 동일 출처 요청에만 Authorization 첨부 (상대 경로는 항상 동일 출처로 간주) - 템플릿 2종: 교차 출처 URL 은 인증 XHR 없이 그대로 사용 (썸네일·갤러리·다운로드 3지점씩) 로컬 public 디스크나 허용적 CORS 를 주는 오브젝트 스토리지에서는 재현되지 않는다 — 외부 origin 과 CORS 미제공이 겹쳐야 드러나므로 회귀 테스트는 두 조건을 모두 고정한다. ## S3 접속 필드 노출 조건 파일 스토리지는 로컬로 두고 공개 자산만 S3 로 보내는 구성에서 접속 정보를 넣을 화면이 없었다(도움말이 보이지 않는 필드를 가리켰다). 두 축 중 하나라도 s3 면 블록을 노출하고, 연결 테스트 게이트의 적용 대상도 같은 조건으로 넓힌다. 재검증 트리거는 S3 접속 설정 변경으로 한정한다 — 트리거까지 넓히면 "파일 스토리지=s3 에서 공개 자산만 변경" 하는 기존 흐름이 저장 불가가 된다.
262 lines
708 KiB
JavaScript
262 lines
708 KiB
JavaScript
var SirsoftAdminBasic=(function(R,h,v,Ln){"use strict";var aA=Object.defineProperty;var lA=(R,h,v)=>h in R?aA(R,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):R[h]=v;var Pe=(R,h,v)=>lA(R,typeof h!="symbol"?h+"":h,v);var za,vr;function hb(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 F=hb(v),gb=()=>window.G7Core,ae=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})});ae.displayName="Button";const $d=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"})})})]})});$d.displayName="FileInput";const pb=e=>e==="checkbox"?"checkbox":e==="radio"?"radio":"input",mb=(e,t)=>{const n=pb(e);return t?t.split(/\s+/).filter(Boolean).includes(n)?t:`${n} ${t}`:n},kt=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=mb(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 A=E.target.value;b(A);const P=new Event("change",{bubbles:!0});Object.defineProperty(P,"target",{writable:!1,value:{value:A}}),Object.defineProperty(P,"currentTarget",{writable:!1,value:{value:A}}),r(P)}},[r]),M=v.useCallback(E=>{const A=E.target.value;b(A),!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})});kt.displayName="Input";const sr=({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})},ln=({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}),yt=({children:e,className:t="",...n})=>h.jsx("p",{className:t,...n,children:e}),Sn=({className:e="",alt:t="",...n})=>h.jsx("img",{className:e,alt:t,...n}),Ba=({children:e,className:t="",...n})=>h.jsx("h1",{className:t,...n,children:e}),or=({children:e,className:t="",...n})=>h.jsx("h2",{className:t,...n,children:e}),jr=({children:e,className:t="",...n})=>h.jsx("h3",{className:t,...n,children:e}),Fd=({children:e,className:t="",...n})=>h.jsx("h4",{className:t,...n,children:e}),ja=({children:e,className:t="",...n})=>h.jsx("ul",{className:t,...n,children:e}),bb=({children:e,className:t="",...n})=>h.jsx("ol",{className:t,...n,children:e}),Wa=({children:e,className:t="",...n})=>h.jsx("li",{className:t,...n,children:e}),Wr=({children:e,className:t="",...n})=>h.jsx("a",{className:t,...n,children:e}),Ga=({children:e,className:t="",...n})=>h.jsx("form",{className:t,...n,children:e}),Xn=({children:e,className:t="",...n})=>h.jsx("svg",{className:t,...n,children:e}),yb=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 vb(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 Gr=({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(T=>({value:T,label:vb(T)})):r:(yb.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 T=m.trim().toLowerCase();return k.filter(z=>z.label.toLowerCase().includes(T)||String(z.value).toLowerCase().includes(T))},[k,l,m]);v.useEffect(()=>{if(f&&l){p("");const T=setTimeout(()=>M.current?.focus(),0);return()=>clearTimeout(T)}f||p("")},[f,l]);const w=v.useCallback(()=>{if(!x.current)return;const T=x.current.getBoundingClientRect(),z=window.innerHeight-T.bottom,W=z<280&&T.top>z;b(W?{bottom:window.innerHeight-T.top+4,left:T.left,width:T.width}:{top:T.bottom+4,left:T.left,width:T.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 T=z=>{const U=z.target;_.current&&!_.current.contains(U)&&(!S.current||!S.current.contains(U))&&g(!1)};return f&&document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[f]),v.useEffect(()=>{const T=z=>{z.key==="Escape"&&f&&(g(!1),x.current?.focus())};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f]);const E=()=>{a||g(!f)},A=T=>{i&&i({target:{value:T},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(T=>T&&!T.includes(":")).join(" "),L=P.includes("bg-"),$=/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(P),D=L?`${s}${$?"":" 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}`,O={...d,...u};return h.jsxs(I,{ref:_,className:"relative",...O,children:[h.jsxs(ae,{ref:x,type:"button",onClick:E,disabled:a,className:`${D} 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(Xn,{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&&Ln.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(kt,{ref:M,type:"text",value:m,onChange:T=>p(T.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(T=>{const z=String(T.value)===String(o);return h.jsxs(ae,{type:"button",onClick:()=>!T.disabled&&A(T.value),disabled:T.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"} ${T.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":z,children:[h.jsx(J,{children:T.label}),z&&h.jsx(Xn,{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"})})]},T.value)})]})]}),document.body)]})},xb=({children:e,className:t="",...n})=>h.jsx("option",{className:t,...n,children:e}),wb=({children:e,className:t="",...n})=>h.jsx("optgroup",{className:t,...n,children:e}),_n=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})});_n.displayName="Checkbox";const Ya=({children:e,className:t="",...n})=>h.jsx("table",{className:t,...n,children:e}),Xa=({children:e,className:t="",...n})=>h.jsx("thead",{className:t,...n,children:e}),Ka=({children:e,className:t="",...n})=>h.jsx("tbody",{className:t,...n,children:e}),qa=({children:e,className:t="",...n})=>h.jsx("tfoot",{className:t,...n,children:e}),ir=({children:e,className:t="",...n})=>h.jsx("tr",{className:t,...n,children:e}),Yr=({children:e,className:t="",...n})=>h.jsx("th",{className:t,...n,children:e}),Jt=({children:e,className:t="",...n})=>h.jsx("td",{className:t,...n,children:e}),Go=({children:e,className:t="",...n})=>h.jsx("nav",{className:t,...n,children:e}),zd=({children:e,className:t="",...n})=>h.jsx("section",{className:t,...n,children:e}),oe=({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})},kb={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"},Vd={xs:"xs",sm:"sm",md:void 0,lg:"lg",xl:"2x"},Cb=({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=kb[t],d=r||"";switch(a){case"fa":return h.jsx(oe,{name:l,size:Vd[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(oe,{name:e,size:Vd[t],className:n,color:r,ariaLabel:s})}},Sb=({children:e,className:t="",...n})=>h.jsx("code",{className:t,...n,children:e}),_b=({children:e,className:t="",...n})=>h.jsx("pre",{className:t,...n,children:e}),Eb=({children:e})=>h.jsx(h.Fragment,{children:e}),Mb=({className:e="",...t})=>h.jsx("hr",{className:e,...t}),pt=({className:e="",children:t,style:n,...r})=>h.jsx("i",{className:e,style:n,...r,children:t});var ue=(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))(ue||{});const Nb=({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(Sn,{src:n,alt:r,className:"card-image"})}),h.jsxs(I,{className:"p-4",children:[e&&h.jsx(or,{className:"card-title",children:e}),t&&h.jsx(yt,{className:"card-content",children:t})]})]}),Ls=({items:e,triggerLabel:t="작업",triggerIconName:n=ue.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?Ln.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(oe,{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(ae,{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(oe,{name:n,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]}),_]})},Xr=(e,t)=>window.G7Core?.t?.(e,t)??e,Yo=({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<p:a??!1,b=(o??s)&&m,_=(i??s)&&m,x=v.useMemo(()=>{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 A=w;A<=E;A++)N.push(A);E<p-1&&N.push("..."),p>1&&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":Xr("common.pagination"),id:f,...g,children:[b&&h.jsx(ae,{onClick:()=>M(1),disabled:e===1,className:"pagination-btn","aria-label":Xr("common.first_page"),children:"«"}),h.jsx(ae,{onClick:S,disabled:e===1,className:"pagination-btn","aria-label":Xr("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(ae,{onClick:()=>M(w),className:E?"pagination-btn-active":"pagination-btn","aria-label":Xr("common.page_n",{n:w}),"aria-current":E?"page":void 0,children:w},w)})]}),h.jsx(ae,{onClick:k,disabled:!y,className:"pagination-btn","aria-label":Xr("common.next_page"),children:u||h.jsx(h.Fragment,{children:"›"})}),_&&h.jsx(ae,{onClick:()=>M(p),disabled:e===p,className:"pagination-btn","aria-label":Xr("common.last_page"),children:"»"})]})},Hd=(e,t)=>window.G7Core?.t?.(e,t)??e,Tb=()=>window.G7Core?.locale?.supported?.()??["ko","en"],Ob=()=>window.G7Core?.locale?.current?.()??"ko",Ud=e=>{const t=Hd(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},Ab=()=>Tb().map(t=>({code:t,name:Ud(t),nativeName:Ud(t)})),Za=({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??Ab(),[s]),x=v.useMemo(()=>o??Ob(),[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(fe=>fe.code);return[x,...ne.filter(fe=>fe!==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}),[A,P]=v.useState(x),L=v.useMemo(()=>_.filter(K=>!w.includes(K.code)),[_,w]),[$,D]=v.useState(!1);v.useEffect(()=>{if(r==="tabs"||r==="compact"){const fe=_.map(ce=>ce.code),ee=[x,...fe.filter(ce=>ce!==x)],le=w.join(","),ge=ee.join(",");le!==ge&&E(ee);return}const K=Object.keys(e).filter(fe=>e[fe]!==void 0);if(K.length===0){E([x]);return}const q=[];K.includes(x)&&q.push(x),K.forEach(fe=>{fe!==x&&q.push(fe)});const ne=w.join(","),te=q.join(",");ne!==te&&E(q)},[e,x,r,_]);const O=v.useCallback((K,q)=>{const ne={...M.current,[K]:q};M.current=ne,k(ne),C(ne,[K])},[C]),T=v.useCallback(K=>{E(ne=>[...ne,K]),P(K),D(!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(te=>te!==K)),A===K&&P(x);const q={...M.current};delete q[K],M.current=q,k(q),C(q)},[A,x,C]),U=v.useCallback(K=>{const q=_.find(ne=>ne.code===K);return q?.nativeName||q?.name||K.toUpperCase()},[_]),W=v.useCallback(K=>!!S[K]?.trim(),[S]),G=v.useCallback(()=>L.length===0?null:h.jsxs(I,{className:"relative",children:[h.jsxs(ae,{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:()=>D(!$),disabled:l,children:[h.jsx(oe,{name:"plus",className:"w-3 h-3"}),h.jsx(J,{children:Hd("common.add_language")})]}),$&&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(ae,{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:()=>T(K.code),children:[h.jsx(oe,{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,$,l,T]),B=v.useCallback((K,q=!1)=>{const ne=b?"input input-error":"input",te=b?"textarea input-error":"textarea",fe=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
|
||
${fe?"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(oe,{name:"globe",className:"w-3 h-3"}),U(K),fe&&h.jsx(J,{className:"text-red-500 dark:text-red-400",children:"*"}),!fe&&h.jsx(ae,{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(oe,{name:"xmark",className:"w-3 h-3"})})]}),fe&&q&&G()]}),n==="textarea"?h.jsx(sr,{name:`${f}[${K}]`,value:S[K]||"",onChange:le=>O(K,le.target.value),placeholder:ee,required:a&&fe,disabled:l,maxLength:c,rows:d,className:`${te} resize-vertical`}):h.jsx(kt,{type:"text",name:`${f}[${K}]`,value:S[K]||"",onChange:le=>O(K,le.target.value),placeholder:ee,required:a&&fe,disabled:l,maxLength:c,className:ne})]},K)},[f,S,O,i,a,l,c,d,n,U,x,z,G,b]),j=v.useCallback(K=>{const q=b?"input input-error":"input",ne=b?"textarea input-error":"textarea",te=`${i}${i?" (":""}${U(K)}${i?")":""}`;return h.jsx(I,{children:n==="textarea"?h.jsx(sr,{name:`${f}[${K}]`,value:S[K]||"",onChange:fe=>O(K,fe.target.value),placeholder:te,required:a&&K===x,disabled:l,maxLength:c,rows:d,className:`${ne} resize-vertical`}):h.jsx(kt,{type:"text",name:`${f}[${K}]`,value:S[K]||"",onChange:fe=>O(K,fe.target.value),placeholder:te,required:a&&K===x,disabled:l,maxLength:c,className:q})},K)},[f,S,O,i,a,l,c,d,n,x,U,b]),Y=()=>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(ae,{type:"button",className:`
|
||
inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold transition-all
|
||
${A===K?K===x?"bg-blue-500 text-white dark:bg-blue-600 dark:text-white shadow-md scale-105":"bg-gray-500 text-white dark:bg-gray-600 dark:text-white shadow-md scale-105":K===x?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}
|
||
`,onClick:()=>P(K),children:[h.jsx(oe,{name:"globe",className:"w-3 h-3"}),g?h.jsxs(h.Fragment,{children:[h.jsx(J,{className:"hidden md:inline",children:U(K)}),h.jsx(J,{className:"inline md:hidden",children:K.toUpperCase()})]}):U(K),K===x&&h.jsx(J,{className:"text-red-500 dark:text-red-400",children:"*"}),W(K)&&A!==K&&h.jsx(oe,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"}),K!==x&&h.jsx(ae,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-300 dark:hover:bg-gray-500 transition-colors",onClick:q=>{q.stopPropagation(),z(K)},disabled:l,children:h.jsx(oe,{name:"xmark",className:"w-3 h-3"})})]},K)),G()]}),w.map(K=>h.jsx(I,{className:A===K?"block":"hidden",children:j(K)},K))]}),X=()=>{const K=b?"input input-error":"input",q=b?"textarea input-error":"textarea";return h.jsx(I,{className:u,children:h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(I,{className:"flex items-center shrink-0",children:w.map(ne=>h.jsxs(ae,{type:"button",className:`
|
||
px-2 py-1.5 text-xs font-medium border-y border-l first:rounded-l last:rounded-r last:border-r transition-colors
|
||
${A===ne?"bg-blue-500 text-white border-blue-500 dark:bg-blue-600 dark:border-blue-600":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700"}
|
||
`,onClick:()=>P(ne),title:U(ne),children:[ne.toUpperCase(),ne===x&&h.jsx(J,{className:"text-red-400 ml-0.5",children:"*"})]},ne))}),h.jsx(I,{className:"flex-1 min-w-0",children:n==="textarea"?h.jsx(sr,{name:`${f}[${A}]`,value:S[A]||"",onChange:ne=>O(A,ne.target.value),placeholder:i,required:a&&A===x,disabled:l,maxLength:c,rows:d,className:q}):h.jsx(kt,{type:"text",name:`${f}[${A}]`,value:S[A]||"",onChange:ne=>O(A,ne.target.value),placeholder:i,required:a&&A===x,disabled:l,maxLength:c,className:K})})]})})};return h.jsxs(I,{className:l?"opacity-50 cursor-not-allowed":void 0,id:p,...y,children:[r==="compact"?X():r==="tabs"?V():Y(),b&&m&&h.jsx(J,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:m})]})};Za.displayName="MultilingualInput";const Db=()=>window.G7Core,Qa=({checked:e,value:t,onChange:n,disabled:r=!1,label:s,description:o,size:i="md",className:a="",name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(()=>e??t??!1);v.useEffect(()=>{f(e??t??!1)},[e,t]);const g=_=>{const x=_.target.checked;f(x),n&&!r&&n(_)},p={sm:{track:"w-9 h-5",thumb:"after:h-4 after:w-4"},md:{track:"w-11 h-6",thumb:"after:h-5 after:w-5"},lg:{track:"w-14 h-7",thumb:"after:h-6 after:w-6"}}[i],y=()=>{if(!r){const _=!u;if(f(_),n){const x=Db();x?.createChangeEvent&&n(x.createChangeEvent({checked:_,name:l}))}}},b=_=>{r||_.key!==" "&&_.key!=="Enter"&&_.key!=="Spacebar"||(_.preventDefault(),y())};return h.jsxs("div",{className:`toggle-container ${a}`,id:c,...d,children:[h.jsxs("div",{className:`toggle-switch-wrapper ${r?"cursor-not-allowed opacity-50":"cursor-pointer"}`,role:"switch","aria-checked":u,"aria-disabled":r||void 0,"aria-label":s??l,tabIndex:r?-1:0,onKeyDown:b,onClick:_=>{_.preventDefault(),_.stopPropagation(),y()},children:[h.jsx("input",{type:"checkbox",id:l,name:l,checked:u,onChange:g,disabled:r,className:"sr-only peer",tabIndex:-1}),h.jsx("div",{className:`toggle-switch-track ${p.track} ${p.thumb}`})]}),s&&h.jsx("span",{className:`toggle-label ${r?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:y,children:s}),o&&h.jsx("p",{className:"toggle-description",children:o})]})},Xo=({status:e,label:t,showIcon:n=!0,iconName:r,className:s="",style:o,id:i,editorAttrs:a})=>{const l={success:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800",warning:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800",error:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border-red-200 dark:border-red-800",info:"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800",pending:"bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-200 dark:border-gray-600",default:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600"},c={success:ue.CheckCircle,warning:ue.ExclamationTriangle,error:ue.XCircle,info:ue.InfoCircle,pending:ue.Clock,default:ue.QuestionCircle},d={success:"성공",warning:"경고",error:"오류",info:"정보",pending:"대기 중",default:"기본"},u=r||c[e],f=t||d[e],g=l[e];return h.jsxs(J,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border ${g} ${s}`,style:o,id:i,...a,children:[n&&h.jsx(oe,{name:u,className:"w-4 h-4"}),h.jsx(J,{children:f})]})},Bd={blue:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",green:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",red:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",gray:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",yellow:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",purple:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",orange:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300",teal:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",cyan:"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-300"},Ib={success:"green",warning:"yellow",danger:"red",error:"red",info:"blue",primary:"blue",secondary:"gray",text:"gray",default:"gray"},jd={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs",lg:"px-2.5 py-1 text-sm"},Wd=({color:e,variant:t,text:n,size:r="md",className:s="",style:o,children:i,id:a,editorAttrs:l})=>{const c=e||(t?Ib[t]:void 0)||"gray",d=Bd[c]||Bd.gray,u=jd[r]||jd.md;return h.jsxs(J,{className:`inline-flex items-center rounded-full font-medium ${u} ${d} ${s}`,style:o,id:a,...l,children:[n,i]})};function Gd(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Lb(e){if(Array.isArray(e))return e}function Pb(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,a=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(d){c=!0,s=d}finally{try{if(!l&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw s}}return a}}function $b(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fb(e,t){return Lb(e)||Pb(e,t)||zb(e,t)||$b()}function zb(e,t){if(e){if(typeof e=="string")return Gd(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gd(e,t):void 0}}const Yd=Object.entries,Xd=Object.setPrototypeOf,Vb=Object.isFrozen,Hb=Object.getPrototypeOf,Ub=Object.getOwnPropertyDescriptor;let Yt=Object.freeze,fn=Object.seal,Kr=Object.create,Kd=typeof Reflect<"u"&&Reflect,Ja=Kd.apply,Ra=Kd.construct;Yt||(Yt=function(t){return t}),fn||(fn=function(t){return t}),Ja||(Ja=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),o=2;o<r;o++)s[o-2]=arguments[o];return t.apply(n,s)}),Ra||(Ra=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new t(...r)});const wr=Ct(Array.prototype.forEach),Bb=Ct(Array.prototype.lastIndexOf),qd=Ct(Array.prototype.pop),qr=Ct(Array.prototype.push),jb=Ct(Array.prototype.splice),Xt=Array.isArray,Ps=Ct(String.prototype.toLowerCase),el=Ct(String.prototype.toString),Zd=Ct(String.prototype.match),Zr=Ct(String.prototype.replace),Qd=Ct(String.prototype.indexOf),Wb=Ct(String.prototype.trim),Gb=Ct(Number.prototype.toString),Yb=Ct(Boolean.prototype.toString),Jd=typeof BigInt>"u"?null:Ct(BigInt.prototype.toString),Rd=typeof Symbol>"u"?null:Ct(Symbol.prototype.toString),vt=Ct(Object.prototype.hasOwnProperty),$s=Ct(Object.prototype.toString),$t=Ct(RegExp.prototype.test),Qr=Xb(TypeError);function Ct(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return Ja(e,t,r)}}function Xb(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ra(e,n)}}function Ue(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ps;if(Xd&&Xd(e,null),!Xt(t))return e;let r=t.length;for(;r--;){let s=t[r];if(typeof s=="string"){const o=n(s);o!==s&&(Vb(t)||(t[r]=o),s=o)}e[s]=!0}return e}function Kb(e){for(let t=0;t<e.length;t++)vt(e,t)||(e[t]=null);return e}function Vt(e){const t=Kr(null);for(const r of Yd(e)){var n=Fb(r,2);const s=n[0],o=n[1];vt(e,s)&&(Xt(o)?t[s]=Kb(o):o&&typeof o=="object"&&o.constructor===Object?t[s]=Vt(o):t[s]=o)}return t}function qb(e){switch(typeof e){case"string":return e;case"number":return Gb(e);case"boolean":return Yb(e);case"bigint":return Jd?Jd(e):"0";case"symbol":return Rd?Rd(e):"Symbol()";case"undefined":return $s(e);case"function":case"object":{if(e===null)return $s(e);const t=e,n=Pn(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:$s(r)}return $s(e)}default:return $s(e)}}function Pn(e,t){for(;e!==null;){const r=Ub(e,t);if(r){if(r.get)return Ct(r.get);if(typeof r.value=="function")return Ct(r.value)}e=Hb(e)}function n(){return null}return n}function Zb(e){try{return $t(e,""),!0}catch{return!1}}const eu=Yt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),tl=Yt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),nl=Yt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Qb=Yt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),rl=Yt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Jb=Yt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),tu=Yt(["#text"]),nu=Yt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),sl=Yt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ru=Yt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ko=Yt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Rb=fn(/{{[\w\W]*|^[\w\W]*}}/g),ey=fn(/<%[\w\W]*|^[\w\W]*%>/g),ty=fn(/\${[\w\W]*/g),ny=fn(/^data-[\-\w.\u00B7-\uFFFF]+$/),ry=fn(/^aria-[\-\w]+$/),su=fn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sy=fn(/^(?:\w+script|data):/i),oy=fn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),iy=fn(/^html$/i),ay=fn(/^[a-z][.\w]*(-[.\w]+)+$/i),$n={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ly=function(){return typeof window>"u"?null:window},cy=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ou=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function iu(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ly();const t=se=>iu(se);if(t.version="3.4.8",t.removed=[],!e||!e.document||e.document.nodeType!==$n.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,s=r.currentScript;e.DocumentFragment;const o=e.HTMLTemplateElement,i=e.Node,a=e.Element,l=e.NodeFilter,c=e.NamedNodeMap;c===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,u=e.trustedTypes,f=a.prototype,g=Pn(f,"cloneNode"),m=Pn(f,"remove"),p=Pn(f,"nextSibling"),y=Pn(f,"childNodes"),b=Pn(f,"parentNode"),_=Pn(f,"shadowRoot"),x=Pn(f,"attributes"),M=i&&i.prototype?Pn(i.prototype,"nodeType"):null,S=i&&i.prototype?Pn(i.prototype,"nodeName"):null;if(typeof o=="function"){const se=n.createElement("template");se.content&&se.content.ownerDocument&&(n=se.content.ownerDocument)}let k,N="",C=0;const w=function(H){if(C>0)throw Qr('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');C++;try{return k.createHTML(H)}finally{C--}},E=n,A=E.implementation,P=E.createNodeIterator,L=E.createDocumentFragment,$=E.getElementsByTagName,D=r.importNode;let O=ou();t.isSupported=typeof Yd=="function"&&typeof b=="function"&&A&&A.createHTMLDocument!==void 0;const T=Rb,z=ey,U=ty,W=ny,G=ry,B=sy,j=oy,Y=ay;let V=su,X=null;const K=Ue({},[...eu,...tl,...nl,...rl,...tu]);let q=null;const ne=Ue({},[...nu,...sl,...ru,...Ko]);let te=Object.seal(Kr(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}})),fe=null,ee=null;const le=Object.seal(Kr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ge=!0,ce=!0,ye=!1,me=!0,pe=!1,ke=!0,$e=!1,ie=!1,_e=!1,Ae=!1,Ie=!1,Be=!1,gt=!0,mt=!1;const Ge="user-content-";let ot=!0,Fe=!1,re={},de=null;const we=Ue({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ve=null;const xe=Ue({},["audio","video","img","source","image","track"]);let Ve=null;const De=Ue({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ne="http://www.w3.org/1998/Math/MathML",Te="http://www.w3.org/2000/svg",He="http://www.w3.org/1999/xhtml";let Ke=He,Le=!1,Ee=null;const ze=Ue({},[Ne,Te,He],el);let rt=Ue({},["mi","mo","mn","ms","mtext"]),it=Ue({},["annotation-xml"]);const Ye=Ue({},["title","style","font","a","script"]);let at=null;const xn=["application/xhtml+xml","text/html"],bt="text/html";let qe=null,dt=null;const Zt=n.createElement("form"),on=function(H){return H instanceof RegExp||H instanceof Function},Je=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(dt&&dt===H)return;(!H||typeof H!="object")&&(H={}),H=Vt(H),at=xn.indexOf(H.PARSER_MEDIA_TYPE)===-1?bt:H.PARSER_MEDIA_TYPE,qe=at==="application/xhtml+xml"?el:Ps,X=vt(H,"ALLOWED_TAGS")&&Xt(H.ALLOWED_TAGS)?Ue({},H.ALLOWED_TAGS,qe):K,q=vt(H,"ALLOWED_ATTR")&&Xt(H.ALLOWED_ATTR)?Ue({},H.ALLOWED_ATTR,qe):ne,Ee=vt(H,"ALLOWED_NAMESPACES")&&Xt(H.ALLOWED_NAMESPACES)?Ue({},H.ALLOWED_NAMESPACES,el):ze,Ve=vt(H,"ADD_URI_SAFE_ATTR")&&Xt(H.ADD_URI_SAFE_ATTR)?Ue(Vt(De),H.ADD_URI_SAFE_ATTR,qe):De,ve=vt(H,"ADD_DATA_URI_TAGS")&&Xt(H.ADD_DATA_URI_TAGS)?Ue(Vt(xe),H.ADD_DATA_URI_TAGS,qe):xe,de=vt(H,"FORBID_CONTENTS")&&Xt(H.FORBID_CONTENTS)?Ue({},H.FORBID_CONTENTS,qe):we,fe=vt(H,"FORBID_TAGS")&&Xt(H.FORBID_TAGS)?Ue({},H.FORBID_TAGS,qe):Vt({}),ee=vt(H,"FORBID_ATTR")&&Xt(H.FORBID_ATTR)?Ue({},H.FORBID_ATTR,qe):Vt({}),re=vt(H,"USE_PROFILES")?H.USE_PROFILES&&typeof H.USE_PROFILES=="object"?Vt(H.USE_PROFILES):H.USE_PROFILES:!1,ge=H.ALLOW_ARIA_ATTR!==!1,ce=H.ALLOW_DATA_ATTR!==!1,ye=H.ALLOW_UNKNOWN_PROTOCOLS||!1,me=H.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=H.SAFE_FOR_TEMPLATES||!1,ke=H.SAFE_FOR_XML!==!1,$e=H.WHOLE_DOCUMENT||!1,Ae=H.RETURN_DOM||!1,Ie=H.RETURN_DOM_FRAGMENT||!1,Be=H.RETURN_TRUSTED_TYPE||!1,_e=H.FORCE_BODY||!1,gt=H.SANITIZE_DOM!==!1,mt=H.SANITIZE_NAMED_PROPS||!1,ot=H.KEEP_CONTENT!==!1,Fe=H.IN_PLACE||!1,V=Zb(H.ALLOWED_URI_REGEXP)?H.ALLOWED_URI_REGEXP:su,Ke=typeof H.NAMESPACE=="string"?H.NAMESPACE:He,rt=vt(H,"MATHML_TEXT_INTEGRATION_POINTS")&&H.MATHML_TEXT_INTEGRATION_POINTS&&typeof H.MATHML_TEXT_INTEGRATION_POINTS=="object"?Vt(H.MATHML_TEXT_INTEGRATION_POINTS):Ue({},["mi","mo","mn","ms","mtext"]),it=vt(H,"HTML_INTEGRATION_POINTS")&&H.HTML_INTEGRATION_POINTS&&typeof H.HTML_INTEGRATION_POINTS=="object"?Vt(H.HTML_INTEGRATION_POINTS):Ue({},["annotation-xml"]);const Z=vt(H,"CUSTOM_ELEMENT_HANDLING")&&H.CUSTOM_ELEMENT_HANDLING&&typeof H.CUSTOM_ELEMENT_HANDLING=="object"?Vt(H.CUSTOM_ELEMENT_HANDLING):Kr(null);if(te=Kr(null),vt(Z,"tagNameCheck")&&on(Z.tagNameCheck)&&(te.tagNameCheck=Z.tagNameCheck),vt(Z,"attributeNameCheck")&&on(Z.attributeNameCheck)&&(te.attributeNameCheck=Z.attributeNameCheck),vt(Z,"allowCustomizedBuiltInElements")&&typeof Z.allowCustomizedBuiltInElements=="boolean"&&(te.allowCustomizedBuiltInElements=Z.allowCustomizedBuiltInElements),pe&&(ce=!1),Ie&&(Ae=!0),re&&(X=Ue({},tu),q=Kr(null),re.html===!0&&(Ue(X,eu),Ue(q,nu)),re.svg===!0&&(Ue(X,tl),Ue(q,sl),Ue(q,Ko)),re.svgFilters===!0&&(Ue(X,nl),Ue(q,sl),Ue(q,Ko)),re.mathMl===!0&&(Ue(X,rl),Ue(q,ru),Ue(q,Ko))),le.tagCheck=null,le.attributeCheck=null,vt(H,"ADD_TAGS")&&(typeof H.ADD_TAGS=="function"?le.tagCheck=H.ADD_TAGS:Xt(H.ADD_TAGS)&&(X===K&&(X=Vt(X)),Ue(X,H.ADD_TAGS,qe))),vt(H,"ADD_ATTR")&&(typeof H.ADD_ATTR=="function"?le.attributeCheck=H.ADD_ATTR:Xt(H.ADD_ATTR)&&(q===ne&&(q=Vt(q)),Ue(q,H.ADD_ATTR,qe))),vt(H,"ADD_URI_SAFE_ATTR")&&Xt(H.ADD_URI_SAFE_ATTR)&&Ue(Ve,H.ADD_URI_SAFE_ATTR,qe),vt(H,"FORBID_CONTENTS")&&Xt(H.FORBID_CONTENTS)&&(de===we&&(de=Vt(de)),Ue(de,H.FORBID_CONTENTS,qe)),vt(H,"ADD_FORBID_CONTENTS")&&Xt(H.ADD_FORBID_CONTENTS)&&(de===we&&(de=Vt(de)),Ue(de,H.ADD_FORBID_CONTENTS,qe)),ot&&(X["#text"]=!0),$e&&Ue(X,["html","head","body"]),X.table&&(Ue(X,["tbody"]),delete fe.tbody),H.TRUSTED_TYPES_POLICY){if(typeof H.TRUSTED_TYPES_POLICY.createHTML!="function")throw Qr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof H.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Qr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const he=k;k=H.TRUSTED_TYPES_POLICY;try{N=w("")}catch(tt){throw k=he,tt}}else k===void 0&&H.TRUSTED_TYPES_POLICY!==null&&(k=cy(u,s)),k&&typeof N=="string"&&(N=w(""));(O.uponSanitizeElement.length>0||O.uponSanitizeAttribute.length>0)&&X===K&&(X=Vt(X)),O.uponSanitizeAttribute.length>0&&q===ne&&(q=Vt(q)),Yt&&Yt(H),dt=H},Qt=Ue({},[...tl,...nl,...Qb]),wn=Ue({},[...rl,...Jb]),xr=function(H){let Z=b(H);(!Z||!Z.tagName)&&(Z={namespaceURI:Ke,tagName:"template"});const he=Ps(H.tagName),tt=Ps(Z.tagName);return Ee[H.namespaceURI]?H.namespaceURI===Te?Z.namespaceURI===He?he==="svg":Z.namespaceURI===Ne?he==="svg"&&(tt==="annotation-xml"||rt[tt]):!!Qt[he]:H.namespaceURI===Ne?Z.namespaceURI===He?he==="math":Z.namespaceURI===Te?he==="math"&&it[tt]:!!wn[he]:H.namespaceURI===He?Z.namespaceURI===Te&&!it[tt]||Z.namespaceURI===Ne&&!rt[tt]?!1:!wn[he]&&(Ye[he]||!Qt[he]):!!(at==="application/xhtml+xml"&&Ee[H.namespaceURI]):!1},an=function(H){qr(t.removed,{element:H});try{b(H).removeChild(H)}catch{m(H)}},tr=function(H,Z){try{qr(t.removed,{attribute:Z.getAttributeNode(H),from:Z})}catch{qr(t.removed,{attribute:null,from:Z})}if(Z.removeAttribute(H),H==="is")if(Ae||Ie)try{an(Z)}catch{}else try{Z.setAttribute(H,"")}catch{}},Va=function(H){let Z=null,he=null;if(_e)H="<remove></remove>"+H;else{const ut=Zd(H,/^[\r\n\t ]+/);he=ut&&ut[0]}at==="application/xhtml+xml"&&Ke===He&&(H='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+H+"</body></html>");const tt=k?w(H):H;if(Ke===He)try{Z=new d().parseFromString(tt,at)}catch{}if(!Z||!Z.documentElement){Z=A.createDocument(Ke,"template",null);try{Z.documentElement.innerHTML=Le?N:tt}catch{}}const je=Z.body||Z.documentElement;return H&&he&&je.insertBefore(n.createTextNode(he),je.childNodes[0]||null),Ke===He?$.call(Z,$e?"html":"body")[0]:$e?Z.documentElement:je},Bo=function(H){return P.call(H.ownerDocument||H,H,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Is=function(H){var Z,he;H.normalize();const tt=P.call(H.ownerDocument||H,H,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let je=tt.nextNode();for(;je;){let Tt=je.data;wr([T,z,U],Cn=>{Tt=Zr(Tt,Cn," ")}),je.data=Tt,je=tt.nextNode()}const ut=(Z=(he=H.querySelectorAll)===null||he===void 0?void 0:he.call(H,"template"))!==null&&Z!==void 0?Z:[];wr(Array.from(ut),Tt=>{nr(Tt.content)&&Is(Tt.content)})},Br=function(H){const Z=S?S(H):null;return typeof Z!="string"||qe(Z)!=="form"?!1:typeof H.nodeName!="string"||typeof H.textContent!="string"||typeof H.removeChild!="function"||H.attributes!==x(H)||typeof H.removeAttribute!="function"||typeof H.setAttribute!="function"||typeof H.namespaceURI!="string"||typeof H.insertBefore!="function"||typeof H.hasChildNodes!="function"||H.nodeType!==M(H)||H.childNodes!==y(H)},nr=function(H){if(!M||typeof H!="object"||H===null)return!1;try{return M(H)===$n.documentFragment}catch{return!1}},rr=function(H){if(!M||typeof H!="object"||H===null)return!1;try{return typeof M(H)=="number"}catch{return!1}};function kn(se,H,Z){wr(se,he=>{he.call(t,H,Z,dt)})}const jo=function(H){let Z=null;if(kn(O.beforeSanitizeElements,H,null),Br(H))return an(H),!0;const he=qe(S?S(H):H.nodeName);if(kn(O.uponSanitizeElement,H,{tagName:he,allowedTags:X}),ke&&H.hasChildNodes()&&!rr(H.firstElementChild)&&$t(/<[/\w!]/g,H.innerHTML)&&$t(/<[/\w!]/g,H.textContent)||ke&&H.namespaceURI===He&&he==="style"&&rr(H.firstElementChild)||H.nodeType===$n.progressingInstruction||ke&&H.nodeType===$n.comment&&$t(/<[/\w]/g,H.data))return an(H),!0;if(fe[he]||!(le.tagCheck instanceof Function&&le.tagCheck(he))&&!X[he]){if(!fe[he]&&Ha(he)&&(te.tagNameCheck instanceof RegExp&&$t(te.tagNameCheck,he)||te.tagNameCheck instanceof Function&&te.tagNameCheck(he)))return!1;if(ot&&!de[he]){const je=b(H),ut=y(H);if(ut&&je){const Tt=ut.length;for(let Cn=Tt-1;Cn>=0;--Cn){const In=g(ut[Cn],!0);je.insertBefore(In,p(H))}}}return an(H),!0}return(M?M(H):H.nodeType)===$n.element&&!xr(H)||(he==="noscript"||he==="noembed"||he==="noframes")&&$t(/<\/no(script|embed|frames)/i,H.innerHTML)?(an(H),!0):(pe&&H.nodeType===$n.text&&(Z=H.textContent,wr([T,z,U],je=>{Z=Zr(Z,je," ")}),H.textContent!==Z&&(qr(t.removed,{element:H.cloneNode()}),H.textContent=Z)),kn(O.afterSanitizeElements,H,null),!1)},Wo=function(H,Z,he){if(ee[Z]||gt&&(Z==="id"||Z==="name")&&(he in n||he in Zt))return!1;const tt=q[Z]||le.attributeCheck instanceof Function&&le.attributeCheck(Z,H);if(!(ce&&!ee[Z]&&$t(W,Z))){if(!(ge&&$t(G,Z))){if(!tt||ee[Z]){if(!(Ha(H)&&(te.tagNameCheck instanceof RegExp&&$t(te.tagNameCheck,H)||te.tagNameCheck instanceof Function&&te.tagNameCheck(H))&&(te.attributeNameCheck instanceof RegExp&&$t(te.attributeNameCheck,Z)||te.attributeNameCheck instanceof Function&&te.attributeNameCheck(Z,H))||Z==="is"&&te.allowCustomizedBuiltInElements&&(te.tagNameCheck instanceof RegExp&&$t(te.tagNameCheck,he)||te.tagNameCheck instanceof Function&&te.tagNameCheck(he))))return!1}else if(!Ve[Z]){if(!$t(V,Zr(he,j,""))){if(!((Z==="src"||Z==="xlink:href"||Z==="href")&&H!=="script"&&Qd(he,"data:")===0&&ve[H])){if(!(ye&&!$t(B,Zr(he,j,"")))){if(he)return!1}}}}}}return!0},Ld=Ue({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ha=function(H){return!Ld[Ps(H)]&&$t(Y,H)},Ua=function(H){kn(O.beforeSanitizeAttributes,H,null);const Z=H.attributes;if(!Z||Br(H))return;const he={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let tt=Z.length;for(;tt--;){const je=Z[tt],ut=je.name,Tt=je.namespaceURI,Cn=je.value,In=qe(ut),Pd=Cn;let Pt=ut==="value"?Pd:Wb(Pd);if(he.attrName=In,he.attrValue=Pt,he.keepAttr=!0,he.forceKeepAttr=void 0,kn(O.uponSanitizeAttribute,H,he),Pt=he.attrValue,mt&&(In==="id"||In==="name")&&Qd(Pt,Ge)!==0&&(tr(ut,H),Pt=Ge+Pt),ke&&$t(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pt)){tr(ut,H);continue}if(In==="attributename"&&Zd(Pt,"href")){tr(ut,H);continue}if(he.forceKeepAttr)continue;if(!he.keepAttr){tr(ut,H);continue}if(!me&&$t(/\/>/i,Pt)){tr(ut,H);continue}pe&&wr([T,z,U],fb=>{Pt=Zr(Pt,fb," ")});const ub=qe(H.nodeName);if(!Wo(ub,In,Pt)){tr(ut,H);continue}if(k&&typeof u=="object"&&typeof u.getAttributeType=="function"&&!Tt)switch(u.getAttributeType(ub,In)){case"TrustedHTML":{Pt=w(Pt);break}case"TrustedScriptURL":{Pt=k.createScriptURL(Pt);break}}if(Pt!==Pd)try{Tt?H.setAttributeNS(Tt,ut,Pt):H.setAttribute(ut,Pt),Br(H)?an(H):qd(t.removed)}catch{tr(ut,H)}}kn(O.afterSanitizeAttributes,H,null)},Q=function(H){let Z=null;const he=Bo(H);for(kn(O.beforeSanitizeShadowDOM,H,null);Z=he.nextNode();)if(kn(O.uponSanitizeShadowNode,Z,null),jo(Z),Ua(Z),nr(Z.content)&&Q(Z.content),(M?M(Z):Z.nodeType)===$n.element){const je=_?_(Z):Z.shadowRoot;nr(je)&&(be(je),Q(je))}kn(O.afterSanitizeShadowDOM,H,null)},be=function(H){const Z=M?M(H):H.nodeType;if(Z===$n.element){const je=_?_(H):H.shadowRoot;nr(je)&&(be(je),Q(je))}const he=y?y(H):H.childNodes;if(!he)return;const tt=[];wr(he,je=>{qr(tt,je)});for(const je of tt)be(je);if(Z===$n.element){const je=S?S(H):null;if(typeof je=="string"&&qe(je)==="template"){const ut=H.content;nr(ut)&&be(ut)}}};return t.sanitize=function(se){let H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Z=null,he=null,tt=null,je=null;if(Le=!se,Le&&(se="<!-->"),typeof se!="string"&&!rr(se)&&(se=qb(se),typeof se!="string"))throw Qr("dirty is not a string, aborting");if(!t.isSupported)return se;if(ie||Je(H),t.removed=[],typeof se=="string"&&(Fe=!1),Fe){const Cn=S?S(se):se.nodeName;if(typeof Cn=="string"){const In=qe(Cn);if(!X[In]||fe[In])throw Qr("root node is forbidden and cannot be sanitized in-place")}if(Br(se))throw Qr("root node is clobbered and cannot be sanitized in-place");be(se)}else if(rr(se))Z=Va("<!---->"),he=Z.ownerDocument.importNode(se,!0),he.nodeType===$n.element&&he.nodeName==="BODY"||he.nodeName==="HTML"?Z=he:Z.appendChild(he),be(he);else{if(!Ae&&!pe&&!$e&&se.indexOf("<")===-1)return k&&Be?w(se):se;if(Z=Va(se),!Z)return Ae?null:Be?N:""}Z&&_e&&an(Z.firstChild);const ut=Bo(Fe?se:Z);for(;tt=ut.nextNode();)jo(tt),Ua(tt),nr(tt.content)&&Q(tt.content);if(Fe)return pe&&Is(se),se;if(Ae){if(pe&&Is(Z),Ie)for(je=L.call(Z.ownerDocument);Z.firstChild;)je.appendChild(Z.firstChild);else je=Z;return(q.shadowroot||q.shadowrootmode)&&(je=D.call(r,je,!0)),je}let Tt=$e?Z.outerHTML:Z.innerHTML;return $e&&X["!doctype"]&&Z.ownerDocument&&Z.ownerDocument.doctype&&Z.ownerDocument.doctype.name&&$t(iy,Z.ownerDocument.doctype.name)&&(Tt="<!DOCTYPE "+Z.ownerDocument.doctype.name+`>
|
||
`+Tt),pe&&wr([T,z,U],Cn=>{Tt=Zr(Tt,Cn," ")}),k&&Be?w(Tt):Tt},t.setConfig=function(){let se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Je(se),ie=!0},t.clearConfig=function(){dt=null,ie=!1},t.isValidAttribute=function(se,H,Z){dt||Je({});const he=qe(se),tt=qe(H);return Wo(he,tt,Z)},t.addHook=function(se,H){typeof H=="function"&&qr(O[se],H)},t.removeHook=function(se,H){if(H!==void 0){const Z=Bb(O[se],H);return Z===-1?void 0:jb(O[se],Z,1)[0]}return qd(O[se])},t.removeHooks=function(se){O[se]=[]},t.removeAllHooks=function(){O=ou()},t}var dy=iu();const ol=({content:e,text:t,isHtml:n=!0,className:r="",purifyConfig:s,id:o,editorAttrs:i})=>{const a=t??e??"";if(!a||a.trim()==="")return null;if(!n){const u=`
|
||
whitespace-pre-wrap
|
||
text-gray-900 dark:text-gray-100
|
||
font-sans
|
||
${r}
|
||
`.trim().replace(/\s+/g," ");return h.jsx(I,{className:u,id:o,...i,children:a})}const l={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"]},c=v.useMemo(()=>{const u=s?{...l,...s,FORBID_TAGS:[...l.FORBID_TAGS,...s.FORBID_TAGS||[]],FORBID_ATTR:[...l.FORBID_ATTR,...s.FORBID_ATTR||[]]}:l;return dy.sanitize(a,u).replace(/<a\s+([^>]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,m,p,y)=>(p.startsWith("http://")||p.startsWith("https://"))&&!g.includes("rel=")?`<a ${m}href="${p}"${y} rel="noopener noreferrer">`:g)},[a,s]),d=`
|
||
prose dark:prose-invert max-w-none
|
||
prose-p:my-2
|
||
prose-headings:font-bold prose-headings:mt-6 prose-headings:mb-4
|
||
prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg
|
||
prose-a:text-blue-600 dark:prose-a:text-blue-400
|
||
prose-a:no-underline hover:prose-a:underline
|
||
prose-blockquote:border-l-4 prose-blockquote:border-gray-300 dark:prose-blockquote:border-gray-600
|
||
prose-blockquote:pl-4 prose-blockquote:italic
|
||
prose-code:bg-gray-100 dark:prose-code:bg-gray-800
|
||
prose-code:px-1 prose-code:py-0.5 prose-code:rounded
|
||
prose-pre:bg-gray-100 dark:prose-pre:bg-gray-800
|
||
prose-pre:p-4 prose-pre:rounded-lg prose-pre:overflow-x-auto
|
||
[&_table]:w-full [&_table]:border-collapse [&_table]:border [&_table]:border-gray-300
|
||
dark:[&_table]:border-gray-600
|
||
[&_th]:border [&_th]:border-gray-300 [&_th]:px-4 [&_th]:py-2 [&_th]:bg-gray-100 [&_th]:text-left
|
||
dark:[&_th]:border-gray-600 dark:[&_th]:bg-gray-800
|
||
[&_td]:border [&_td]:border-gray-300 [&_td]:px-4 [&_td]:py-2
|
||
dark:[&_td]:border-gray-600
|
||
[&_tr:hover]:bg-gray-50 dark:[&_tr:hover]:bg-gray-700/50
|
||
after:content-[''] after:block after:clear-both
|
||
${r}
|
||
`.trim().replace(/\s+/g," ");return h.jsx(I,{className:d,dangerouslySetInnerHTML:{__html:c},id:o,...i})},qo=window.G7Core?.createLogger?.("Comp:DataGrid")??{log:(...e)=>console.log("[Comp:DataGrid]",...e),warn:(...e)=>console.warn("[Comp:DataGrid]",...e),error:(...e)=>console.error("[Comp:DataGrid]",...e)},Fs=(e,t)=>window.G7Core?.t?.(e,t)??e,uy={Div:I,Span:J,Button:ae,Icon:oe,Checkbox:_n,P:yt,A:Wr,Label:ln,Input:kt,H1:Ba,H2:or,H3:jr,H4:Fd,Img:Sn,Select:Gr,Textarea:sr,Table:Ya,Thead:Xa,Tbody:Ka,Tfoot:qa,Tr:ir,Th:Yr,Td:Jt,MultilingualInput:Za,Toggle:Qa,StatusBadge:Xo,Badge:Wd,HtmlContent:ol,ActionMenu:Ls},il=()=>{const e=window.G7Core?.getComponentMap?.();return e&&Object.keys(e).length>0?e:uy},al=e=>{if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>al(t)).join(", ");if(typeof e=="object"){if(v.isValidElement(e))return e;if(Object.keys(e).length===0)return"";try{return JSON.stringify(e)}catch{return qo.warn("객체를 문자열로 변환할 수 없습니다:",e),"[Object]"}}return String(e)},au=(e,t)=>{if(!e)return!0;const n=window.G7Core;return typeof n?.evaluateCondition=="function"?n.evaluateCondition(e,{row:t,item:t,$item:t}):(qo.warn("G7Core.evaluateCondition 미노출 — subRow 조건을 평가할 수 없습니다:",e),!0)},Jr=(e,t,n,r="",s)=>{const o=window.G7Core;if(o?.renderItemChildren){const i={row:t,value:n,$value:n};return o.renderItemChildren(e,i,il(),r,s?{componentContext:s}:void 0)}return qo.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},lu=(e,t,n)=>e?!e.includes("{{")&&!e.includes("$t:")?e:Jr([{type:"basic",name:"Span",text:e}],{},null,t,n):"",ll=(e,t,n="",r)=>{const s=window.G7Core;if(s?.renderItemChildren){const o={row:t,$value:t};return s.renderItemChildren(e,o,il(),n,r?{componentContext:r}:void 0)}return qo.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},fy=({id:e,columns:t,data:n,sortable:r=!0,pagination:s=!1,pageSize:o=10,onRowClick:i,className:a="",style:l,sortField:c,sortDirection:d,onSortChange:u,selectable:f=!1,selectedIds:g=[],onSelectionChange:m,idField:p="id",showColumnSelector:y=!1,visibleColumns:b,onColumnVisibilityChange:_,responsiveBreakpoint:x=768,cardRenderer:M,rowActions:S,onRowAction:k,alwaysShowPagination:N=!1,serverSidePagination:C=!1,serverCurrentPage:w,serverTotalPages:E,serverHasMorePages:A,onPageChange:P,prevText:L,nextText:$,columnSelectorText:D,emptyMessage:O,actionsColumnHeader:T,requiredText:z,selectedCountText:U,showFirstLast:W=!0,expandable:G=!1,expandedRowIds:B,onExpandChange:j,expandChildren:Y,expandedRowRender:V,expandColumnWidth:X="48px",expandIconExpanded:K=ue.ChevronDown,expandIconCollapsed:q=ue.ChevronRight,expandConditionField:ne,dynamicColumns:te,dynamicColumnsInsertAfter:fe,expandContext:ee,__componentContext:le,subRowChildren:ge,subRowCondition:ce,subRowClassName:ye="px-6 py-2 bg-gray-50 dark:bg-gray-900",subRowRender:me,footerCells:pe,footerClassName:ke="bg-gray-50 dark:bg-gray-800/50 font-medium",footerCardChildren:$e,editorAttrs:ie})=>{const _e=L||void 0,Ae=$||void 0,Ie=D??Fs("common.column_selector"),Be=O??Fs("common.no_data"),gt=T??Fs("common.actions"),mt=z??Fs("common.required"),Ge=U??Fs("common.selected_count"),ot=window.G7Core,Fe=ot?.useControllableState,re=ot?.shallowArrayEqual,[de,we]=Fe?Fe(c,null):[c??null,()=>{}],[ve,xe]=Fe?Fe(d,"asc"):[d??"asc",()=>{}],[Ve,De]=v.useState(1),[Ne,Te]=Fe?Fe(B,[],j,{isEqual:re}):[B??[],()=>{}],[He,Ke]=v.useState(!1),Le=v.useRef(null),Ee=ot?.useResponsive,ze=Ee?.(),rt=ze?ze.width<x:typeof window<"u"&&window.innerWidth<x,it=v.useMemo(()=>{if(!te||!Array.isArray(te)||te.length===0)return t;if(fe){const Q=t.findIndex(be=>be.field===fe);if(Q!==-1)return[...t.slice(0,Q+1),...te,...t.slice(Q+1)]}return[...t,...te]},[t,te,fe]),[Ye,at]=v.useState(()=>b&&b.length>0?b:t.filter(Q=>!Q.hidden).map(Q=>Q.field));v.useEffect(()=>{b&&b.length>0&&at(b)},[b]);const xn=v.useRef("");v.useEffect(()=>{const Q=t.map(be=>be.field).join(",");xn.current&&Q!==xn.current&&(!b||b.length===0)&&at(t.filter(be=>!be.hidden).map(be=>be.field)),xn.current=Q},[t,b]);const bt=v.useRef([]),qe=v.useRef(null);v.useEffect(()=>{if(te&&te.length>0){const Q=te.map(H=>H.field);if(qe.current===null&&(qe.current=b!==void 0&&b.length>0,qe.current)){bt.current=Q;return}const be=bt.current,se=Q.filter(H=>!be.includes(H));if(se.length>0){const H=se.filter(Z=>!Ye.includes(Z));if(H.length>0){const Z=[...Ye,...H];at(Z),_?.(Z)}}bt.current=Q}},[te]),v.useEffect(()=>{C||De(1)},[n,C]),v.useEffect(()=>{const Q=be=>{Le.current&&!Le.current.contains(be.target)&&Ke(!1)};return He&&document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[He]);const dt=v.useMemo(()=>!y&&(!b||b.length===0)?it.filter(Q=>!Q.hidden):it.filter(Q=>Ye.includes(Q.field)),[it,Ye,y,b]),Zt=r&&!(C&&!u),on=v.useMemo(()=>!de||!r||!n?n||[]:u||C?n:[...n].sort((Q,be)=>{const se=Q[de],H=be[de];if(se===H)return 0;const Z=se>H?1:-1;return ve==="asc"?Z:-Z}),[n,de,ve,r,u,C]),Je=v.useMemo(()=>{if(C||!s)return on;const Q=(Ve-1)*o,be=Q+o;return on.slice(Q,be)},[on,Ve,o,s,C]),Qt=C?w||1:Ve,wn=C?E??null:Math.ceil((on?.length||0)/o),xr=N||(wn??0)>1||A===!0||Qt>1,an=v.useCallback(Q=>{C&&P?P(Q):De(Q)},[C,P]),tr=Q=>{if(!Zt||t.find(H=>H.field===Q)?.sortable===!1)return;const se=de===Q&&ve==="asc"?"desc":"asc";we(Q),xe(se),u?.(Q,se)},Va=v.useCallback(()=>{if(!m||!Je)return;const Q=Je.map(se=>se[p]);if(Q.every(se=>g.includes(se)))m(g.filter(se=>!Q.includes(se)));else{const se=[...new Set([...g,...Q])];m(se)}},[Je,g,m,p]),Bo=v.useCallback(Q=>{m&&(g.includes(Q)?m(g.filter(be=>be!==Q)):m([...g,Q]))},[g,m]),Is=v.useCallback(Q=>{if(it.find(H=>H.field===Q)?.required)return;const se=Ye.includes(Q)?Ye.filter(H=>H!==Q):[...Ye,Q];at(se),_?.(se)},[it,Ye,_]),Br=v.useCallback((Q,be)=>{k?.(Q,be)},[k]),nr=v.useCallback(Q=>S?S.map(be=>{let se=be.disabled??!1;if(be.disabledField&&!se){const H=be.disabledField.split(".");let Z=Q;for(const he of H)Z=Z?.[he];Z||(se=!0)}return{...be,disabled:se,onClick:()=>Br(be.id,Q)}}):[],[S,Br]),rr=v.useCallback(Q=>{if(!ne)return!0;const be=Q[ne];return Array.isArray(be)?be.length>0:!!be},[ne]),kn=v.useCallback(Q=>{const be=Ne.includes(Q)?Ne.filter(se=>se!==Q):[...Ne,Q];Fe?Te(be):j&&j(be)},[Ne,j,Fe,Te]),jo=v.useCallback(Q=>Ne.includes(Q),[Ne]),Wo=v.useCallback(Q=>V?V(Q):Y&&Y.length>0&&ot?.renderExpandContent?ot.renderExpandContent({children:Y,row:Q,expandContext:ee,componentContext:le,componentMap:il(),keyPrefix:`expand-${Q[p]}`}):null,[V,Y,p,ee,le,le?.state]),Ld=v.useMemo(()=>!Je||Je.length===0?!1:Je.every(Q=>g.includes(Q[p])),[Je,g,p]),Ha=v.useMemo(()=>{if(!Je||Je.length===0)return!1;const Q=Je.filter(be=>g.includes(be[p])).length;return Q>0&&Q<Je.length},[Je,g,p]),Ua=(Q,be)=>{const se=Q[p],H=jo(se);return h.jsxs(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-4",children:[h.jsxs(I,{className:"flex items-start justify-between",children:[G&&rr(Q)&&h.jsx(ae,{onClick:()=>kn(se),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors mr-2","aria-label":H?"Collapse card":"Expand card",children:h.jsx(oe,{name:H?K:q,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}),f&&h.jsx(_n,{checked:g.includes(Q[p]),onChange:()=>Bo(Q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded mr-3 mt-1"}),h.jsx(I,{className:"flex-1",children:h.jsx(I,{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:be.map(Z=>h.jsxs(I,{className:"min-w-0",children:[h.jsx(J,{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:Z.header}),h.jsx(I,{className:"text-sm text-gray-900 dark:text-gray-200 mt-0.5 break-words",children:Z.cellChildren&&Z.cellChildren.length>0?Jr(Z.cellChildren,Q,Q[Z.field],`card-${Q[p]}-${Z.field}`,le):Z.render?Z.render(Q[Z.field],Q):al(Q[Z.field])})]},Z.field))})}),S&&S.length>0&&h.jsx(I,{className:"ml-2",children:h.jsx(Ls,{items:nr(Q),triggerLabel:"",triggerIconName:ue.EllipsisHorizontal})})]}),G&&H&&rr(Q)&&h.jsx(I,{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:Wo(Q)}),(ge&&ge.length>0||me)&&au(ce,Q)&&h.jsx(I,{className:ye?`mt-3 ${ye}`:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-700",children:me?me(Q):ll(ge,Q,`card-subrow-${se}`,le)})]})};return rt?h.jsxs(I,{id:e,className:`w-full ${a}`,style:l,...ie,children:[y&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:Le,className:"relative",children:[h.jsxs(ae,{onClick:()=>Ke(!He),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(oe,{name:ue.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:Ie})]}),He&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:it.map(Q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${Q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!Q.required&&Is(Q.field),children:[h.jsx(_n,{checked:Ye.includes(Q.field),disabled:Q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:[Q.header,Q.required&&h.jsxs(J,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",mt,")"]})]})]},Q.field))})})]})}),f&&g.length>0&&Ge&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:Ge.replace("{count}",String(g.length))}),h.jsx(I,{id:e?`${e}__body`:void 0,children:Je&&Je.length>0?Je.map((Q,be)=>h.jsx(I,{children:M?M(Q,dt):Ua(Q,dt)},Q[p]||be)):h.jsx(I,{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:Be})}),pe&&pe.length>0&&Je&&Je.length>0&&h.jsx(I,{className:`rounded-lg p-4 mt-2 ${ke}`,children:$e&&$e.length>0?Jr($e,{},null,"footer-card",le):h.jsx(I,{className:"space-y-1",children:pe.filter(Q=>Q.text||Q.children&&Q.children.length>0).map((Q,be)=>{const se=dt.find(H=>H.field===Q.field);return h.jsxs(I,{className:"flex justify-between text-sm",children:[h.jsx(J,{className:"text-gray-500 dark:text-gray-400",children:se?.header||""}),h.jsx(J,{className:Q.className||"text-gray-900 dark:text-gray-100",children:Q.children&&Q.children.length>0?Jr(Q.children,{},null,`footer-mobile-${be}`,le):lu(Q.text,`footer-mobile-text-${be}`,le)})]},`footer-mobile-${be}`)})})}),s&&xr&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Yo,{currentPage:Qt,totalPages:wn,hasMorePages:C?A:void 0,onPageChange:an,showFirstLast:W,maxVisiblePages:5,prevText:_e,nextText:Ae})})]}):h.jsxs(I,{id:e,className:`w-full ${a}`,style:l,...ie,children:[y&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:Le,className:"relative",children:[h.jsxs(ae,{onClick:()=>Ke(!He),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(oe,{name:ue.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:Ie})]}),He&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:it.map(Q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${Q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!Q.required&&Is(Q.field),children:[h.jsx(_n,{checked:Ye.includes(Q.field),disabled:Q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:[Q.header,Q.required&&h.jsxs(J,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",mt,")"]})]})]},Q.field))})})]})}),f&&g.length>0&&Ge&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:Ge.replace("{count}",String(g.length))}),h.jsx(I,{id:e?`${e}__body`:void 0,className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:h.jsxs(Ya,{className:"w-full",children:[h.jsx(Xa,{className:"bg-gray-50 dark:bg-gray-700",children:h.jsxs(ir,{children:[G&&h.jsx(Yr,{className:"px-2 py-3",style:{width:X}}),f&&h.jsx(Yr,{className:"px-4 py-3 w-10",children:h.jsx(_n,{checked:Ld,ref:Q=>{Q&&(Q.indeterminate=Ha)},onChange:Va,className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),dt.map(Q=>h.jsxs(Yr,{className:`px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider ${Zt&&Q.sortable!==!1?"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600":""}`,style:{width:Q.width,minWidth:Q.width},onClick:Zt?()=>tr(Q.field):void 0,children:[Q.header,de===Q.field&&h.jsx(J,{className:"ml-1",children:ve==="asc"?"↑":"↓"})]},Q.field)),S&&S.length>0&&h.jsx(Yr,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider w-24",children:gt})]})}),h.jsx(Ka,{className:`bg-white dark:bg-gray-800 ${ye?"":"divide-y divide-gray-200 dark:divide-gray-700"}`,children:Je&&Je.length>0?Je.map((Q,be)=>{const se=Q[p]||be,H=jo(se);return h.jsxs(v.Fragment,{children:[h.jsxs(ir,{className:`${i?"cursor-pointer":""} hover:bg-gray-50 dark:hover:bg-gray-700 ${g.includes(Q[p])?"bg-blue-50 dark:bg-blue-900/20":""} ${ye&&be>0?"border-t border-gray-200 dark:border-gray-700":""}`,onClick:()=>i?.(Q),children:[G&&h.jsx(Jt,{className:"px-2 py-4 text-center",onClick:Z=>Z.stopPropagation(),children:rr(Q)?h.jsx(ae,{onClick:()=>kn(se),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors","aria-label":H?"Collapse row":"Expand row",children:h.jsx(oe,{name:H?K:q,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}):null}),f&&h.jsx(Jt,{className:"px-4 py-4",onClick:Z=>Z.stopPropagation(),children:h.jsx(_n,{checked:g.includes(Q[p]),onChange:()=>Bo(Q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),dt.map(Z=>h.jsx(Jt,{className:"px-6 py-4 align-top whitespace-nowrap text-sm text-gray-900 dark:text-gray-200",style:{width:Z.width,minWidth:Z.width},children:Z.cellChildren&&Z.cellChildren.length>0?Jr(Z.cellChildren,Q,Q[Z.field],`${Q[p]}-${Z.field}`,le):Z.render?Z.render(Q[Z.field],Q):al(Q[Z.field])},Z.field)),S&&S.length>0&&h.jsx(Jt,{className:"px-6 py-4 text-right",onClick:Z=>Z.stopPropagation(),children:h.jsx(Ls,{items:nr(Q),triggerLabel:"",triggerIconName:ue.EllipsisHorizontal,position:"right"})})]}),G&&H&&rr(Q)&&h.jsx(ir,{className:"bg-gray-50 dark:bg-gray-900",children:h.jsx(Jt,{colSpan:dt.length+1+(f?1:0)+(S&&S.length>0?1:0),className:"px-6 py-4",children:Wo(Q)})}),(ge&&ge.length>0||me)&&au(ce,Q)&&h.jsx(ir,{className:ye?"!border-t-0":"",children:h.jsx(Jt,{colSpan:dt.length+(G?1:0)+(f?1:0)+(S&&S.length>0?1:0),className:ye?"p-2":ye||"px-6 py-2 bg-gray-50 dark:bg-gray-900",children:ye?h.jsx(I,{className:ye,children:me?me(Q):ll(ge,Q,`subrow-${se}`,le)}):me?me(Q):ll(ge,Q,`subrow-${se}`,le)})})]},se)}):h.jsx(ir,{children:h.jsx(Jt,{colSpan:dt.length+(G?1:0)+(f?1:0)+(S&&S.length>0?1:0),className:"px-6 py-8 text-center text-gray-500 dark:text-gray-400",children:Be})})}),pe&&pe.length>0&&Je&&Je.length>0&&h.jsx(qa,{children:h.jsxs(ir,{className:ke,children:[G&&h.jsx(Jt,{className:"px-2 py-4"}),f&&h.jsx(Jt,{className:"px-4 py-4"}),(()=>{const Q=new Map(pe.filter(be=>be.field).map(be=>[be.field,be]));return dt.map(be=>{const se=Q.get(be.field);return se?h.jsx(Jt,{className:`px-6 py-4 text-sm text-gray-900 dark:text-gray-200 ${se.className||""}`,colSpan:se.colSpan,style:{width:be.width,minWidth:be.width},children:se.children&&se.children.length>0?Jr(se.children,{},null,`footer-${be.field}`,le):lu(se.text,`footer-text-${be.field}`,le)},`footer-${be.field}`):h.jsx(Jt,{className:"px-6 py-4",style:{width:be.width,minWidth:be.width}},`footer-${be.field}`)})})(),S&&S.length>0&&h.jsx(Jt,{className:"px-6 py-4"})]})})]})}),s&&xr&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Yo,{currentPage:Qt,totalPages:wn,hasMorePages:C?A:void 0,onPageChange:an,showFirstLast:W,maxVisiblePages:5,prevText:_e,nextText:Ae})})]})},hy=window.G7Core?.createLogger?.("Comp:CardGrid")??{log:(...e)=>console.log("[Comp:CardGrid]",...e),warn:(...e)=>console.warn("[Comp:CardGrid]",...e),error:(...e)=>console.error("[Comp:CardGrid]",...e)},gy=(e,t)=>window.G7Core?.t?.(e,t)??e,py=()=>window.G7Core?.getComponentMap?.()||{},my=(e,t)=>{if(!e)return!0;const n=window.G7Core;return typeof n?.evaluateCondition=="function"?n.evaluateCondition(e,{row:t,item:t,$item:t}):(hy.warn("G7Core.evaluateCondition 미노출 — 조건을 평가할 수 없습니다:",e),!0)},cu=(e,t,n,r,s)=>{const o=window.G7Core;if(e.name==="ActionMenu"){if(r&&r.length>0&&s)return{...e,props:{...e.props,items:r.map(i=>({...i,onClick:()=>s(i.id,t)}))}};if(e.actions&&Array.isArray(e.actions)){const i=e.props?.items||[],a=new Map(e.actions.map(c=>[c.id,c])),l=i.map(c=>{if(typeof c.onClick=="string"){const d=c.onClick,u=a.get(d);if(u&&o?.ActionDispatcher)return{...c,onClick:()=>{const f={...n};o.ActionDispatcher.dispatch(u,f)}}}return c});return{...e,props:{...e.props,items:l}}}}return e.children&&Array.isArray(e.children)?{...e,children:e.children.map(i=>cu(i,t,n,r,s))}:e},by=(e,t,n,r="",s,o)=>{const i=window.G7Core;if(i?.renderItemChildren){const a=e.filter(d=>{const u=d.condition||d.if;return u?my(u,t):!0}),l={row:t,$value:t,index:n},c=a.map(d=>cu(d,t,l,s,o));try{const d=py();return i.renderItemChildren(c,l,d,r)}catch{return h.jsxs(I,{className:"text-red-600 dark:text-red-400 p-4",children:[h.jsx(yt,{children:"컴포넌트 로드 실패"}),h.jsx(yt,{className:"text-sm",children:"[CardGrid] 데이터를 표시할 수 없습니다."})]})}}return null},cl=(e,t)=>{if(e.name==="Div"&&e.children&&e.children.length>0){const n=e.children.map((r,s)=>cl(r,`${t}-child-${s}`)).filter(Boolean);return h.jsx(I,{className:e.props?.className||"",children:n},t)}return h.jsx(I,{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-full animate-pulse"},t)},du=(e,t="skeleton")=>!e||e.length===0?null:e.map((n,r)=>{const s=`${t}-${n.id||n.name}-${r}`;return n.condition||n.if?null:(n.iteration,cl(n,s))}).filter(Boolean),yy=({data:e,cardColumns:t=[],gridColumns:n=3,gap:r=4,responsiveColumns:s,cardClassName:o="",idField:i="id",pagination:a=!0,pageSize:l=12,serverSidePagination:c=!1,serverCurrentPage:d,serverTotalPages:u,alwaysShowPagination:f=!1,onPageChange:g,paginationInfoText:m,rowActions:p,onRowAction:y,className:b="",style:_,emptyMessage:x,prevText:M,nextText:S,showSkeleton:k=!0,skeletonCount:N,skeletonCellChildren:C,id:w,editorAttrs:E})=>{const A=x??gy("common.no_data"),P=t[0]?.cellChildren||[],[L,$]=v.useState(1);window.G7Core?.useResponsive?.();const O=c?d??1:L,T=c?u??1:Math.ceil((e?.length??0)/l),z=Y=>{c?g?.(Y):$(Y)},U=v.useCallback((Y,V)=>{y?.(Y,V)},[y]),W=v.useMemo(()=>{if(!e)return[];if(!a||c)return e;const Y=(L-1)*l,V=Y+l;return e.slice(Y,V)},[e,a,c,L,l]),G=v.useMemo(()=>{const Y=[],V=s?.sm??1;Y.push(`grid-cols-${V}`),s?.sm&&Y.push(`sm:grid-cols-${s.sm}`);const X=s?.md??Math.min(n,2);Y.push(`md:grid-cols-${X}`);const K=s?.lg??n;return Y.push(`lg:grid-cols-${K}`),s?.xl&&Y.push(`xl:grid-cols-${s.xl}`),Y.join(" ")},[n,s]),B=v.useMemo(()=>k?C&&C.length>0?du(C,"custom-skeleton"):P&&P.length>0?du(P,"auto-skeleton"):null:null,[k,C,P]);if(!e){if(!k)return null;const Y=N??n;return h.jsx(I,{className:`grid ${G} gap-${r} ${b}`,style:_,id:w,...E,children:Array.from({length:Y}).map((V,X)=>h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6 space-y-4",children:B},`skeleton-${X}`))})}if(W.length===0)return h.jsx(I,{className:b,style:_,id:w,...E,children:h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-12",children:h.jsx(yt,{className:"text-center text-gray-600 dark:text-gray-400",children:A})})});const j=a&&(f||T>1);return h.jsxs(I,{className:b,style:_,id:w,...E,children:[h.jsx(I,{className:`grid ${G} gap-${r}`,children:W.map((Y,V)=>h.jsx(I,{className:o,children:by(P,Y,V,`card-${V}`,p,U)},Y[i]||V))}),j&&h.jsxs(I,{className:"mt-6 space-y-4 flex flex-col items-center",children:[h.jsx(Yo,{currentPage:O,totalPages:T,onPageChange:z,showFirstLast:!1,maxVisiblePages:5,prevText:M,nextText:S}),m&&h.jsx(I,{className:"text-sm text-gray-600 dark:text-gray-400 text-center",children:m})]})]})},vy=(e,t)=>window.G7Core?.t?.(e,t)??e,Zo=({isOpen:e,onClose:t,title:n,titlePrefix:r,titleSuffix:s,closeOnBackdropClick:o=!0,closeOnOverlayClick:i,showCloseButton:a=!0,closeOnEscape:l=!0,children:c,width:d="500px",className:u="",style:f,__dataContext:g,__translationContext:m})=>{const p=i!==void 0?i:o,y=v.useRef(null),b=v.useRef(null);if(v.useEffect(()=>{const M=S=>{S.key==="Escape"&&e&&l&&t()};if(e&&l)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,t,l]),v.useEffect(()=>{if(e&&y.current){b.current=document.activeElement;const M=y.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),S=M[0],k=M[M.length-1];S?.focus();const N=C=>{C.key==="Tab"&&(C.shiftKey?document.activeElement===S&&(C.preventDefault(),k?.focus()):document.activeElement===k&&(C.preventDefault(),S?.focus()))};return document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N),b.current?.focus()}}},[e]),v.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const _=f?.zIndex??50,x=(M,S)=>{if(!M||M.length===0)return null;const k=window.G7Core;if(!k)return null;const N=k.getDynamicRenderer?.();return N?M.map((C,w)=>h.jsx(N,{componentDef:C,dataContext:g||{},translationContext:m,registry:k.getComponentRegistry(),bindingEngine:k.getDataBindingEngine(),translationEngine:k.getTranslationEngine(),actionDispatcher:k.getActionDispatcher(),isRootRenderer:!1},`${S}-${w}`)):null};return h.jsxs(I,{className:"modal-wrapper",style:{zIndex:_},onClick:p?t:void 0,children:[h.jsx(I,{className:"modal-backdrop","aria-hidden":"true"}),h.jsxs(I,{ref:y,className:`modal-container ${u}`,style:{width:d,...f?{...f,zIndex:void 0}:{}},onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":n?"modal-title":void 0,children:[(n||r||s||a)&&h.jsxs(I,{className:"modal-header-row",children:[h.jsxs(I,{className:"flex-center gap-sm",children:[x(r,"title-prefix"),n&&h.jsx(I,{id:"modal-title",className:"modal-title",children:n}),x(s,"title-suffix")]}),a&&h.jsx(ae,{onClick:t,className:"modal-close-btn","aria-label":vy("common.close_modal"),children:h.jsx("svg",{className:"icon-lg",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"})})})]}),h.jsx(I,{className:"modal-body-content",children:c})]})]})},xy=({label:e,items:t,onItemClick:n,position:r="bottom-left",variant:s="default",className:o="",style:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(-1),g=v.useRef(null),m=v.useRef(null),[p,y]=v.useState(r);v.useEffect(()=>{const x=M=>{g.current&&!g.current.contains(M.target)&&(d(!1),f(-1))};if(c)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]),v.useEffect(()=>{const x=M=>{if(!c)return;const S=t.map((k,N)=>k.disabled?-1:N).filter(k=>k!==-1);switch(M.key){case"ArrowDown":M.preventDefault(),f(k=>{const C=(S.indexOf(k)+1)%S.length;return S[C]});break;case"ArrowUp":M.preventDefault(),f(k=>{const N=S.indexOf(k),C=N<=0?S.length-1:N-1;return S[C]});break;case"Enter":M.preventDefault(),u>=0&&!t[u].disabled&&b(t[u]);break;case"Escape":M.preventDefault(),d(!1),f(-1);break}};if(c)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[c,u,t]),v.useEffect(()=>{if(c&&m.current&&g.current){const x=m.current.getBoundingClientRect(),M=g.current.getBoundingClientRect(),S=window.innerWidth,k=window.innerHeight,N=x.width||224,C=x.height||200;let w=r;r.includes("left")?M.left+N>S&&(w=w.replace("left","right")):M.right-N<0&&(w=w.replace("right","left")),r.includes("top")?M.top-C<0&&(w=w.replace("top","bottom")):M.bottom+C>k&&(w=w.replace("bottom","top")),y(w)}},[c,r]);const b=x=>{x.disabled||(x.onClick?.(),n?.(x.value,x),d(!1),f(-1))},_={"bottom-left":"dropdown-menu-bottom-left","bottom-right":"dropdown-menu-bottom-right","top-left":"dropdown-menu-top-left","top-right":"dropdown-menu-top-right"};return h.jsxs(I,{ref:g,className:`dropdown ${o}`,style:i,id:a,...l,children:[h.jsxs(ae,{onClick:()=>d(!c),className:s==="text"?"dropdown-trigger-text":"dropdown-trigger","aria-haspopup":"true","aria-expanded":c,children:[e,s!=="text"&&h.jsx("svg",{className:`inline-block ml-2 w-4 h-4 transition-transform ${c?"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"})})]}),c&&h.jsx(I,{ref:m,className:`dropdown-menu ${_[p]}`,role:"menu","aria-orientation":"vertical",children:h.jsx(I,{className:"py-1",children:t.map((x,M)=>h.jsx(I,{className:`${x.disabled?"dropdown-item-disabled":"dropdown-item"} ${u===M?"dropdown-item-focused":""}`,onClick:()=>b(x),onMouseEnter:()=>!x.disabled&&f(M),role:"menuitem","aria-disabled":x.disabled,tabIndex:x.disabled?-1:0,children:x.label},x.value))})})]})},wy=({imageUrl:e,imageAlt:t="",title:n,subtitle:r,description:s,price:o,originalPrice:i,discountRate:a,currency:l="₩",buttonText:c="자세히 보기",onButtonClick:d,className:u="",style:f,id:g,editorAttrs:m})=>{const p=a&&a>0,y=(o??0).toLocaleString(),b=i?.toLocaleString();return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md hover:shadow-xl transition-shadow border border-gray-200 dark:border-gray-700 overflow-hidden ${u}`,style:f,id:g,...m,children:[e&&h.jsxs(I,{className:"relative w-full",children:[h.jsx(Sn,{src:e,alt:t||n,className:"w-full h-64 object-cover"}),p&&h.jsx(I,{className:"absolute top-2 right-2 bg-red-500 text-white px-2 py-1 rounded-md",children:h.jsxs(J,{className:"text-sm font-bold",children:["-",a,"%"]})})]}),h.jsxs(I,{className:"p-4",children:[r&&h.jsx(jr,{className:"text-xs font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wider mb-2",children:r}),h.jsx(or,{className:"text-xl font-bold text-gray-900 dark:text-white mb-2 line-clamp-2",children:n}),s&&h.jsx(yt,{className:"text-sm text-gray-600 dark:text-gray-400 mb-4 line-clamp-3",children:s}),h.jsxs(I,{className:"flex items-center gap-2 mb-4",children:[h.jsxs(J,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[l,y]}),i&&h.jsxs(J,{className:"text-sm text-gray-400 dark:text-gray-500 line-through",children:[l,b]})]}),c&&h.jsx(ae,{onClick:d,className:"w-full bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition-colors",children:c})]})]})},ky=({value:e,label:t,change:n,changeLabel:r="전월 대비",iconName:s,trend:o="neutral",className:i="",style:a,id:l,editorAttrs:c})=>{const d=o==="up",u=o==="down",f=n!==void 0?Math.abs(n):0,g=d?"stats-trend-up":u?"stats-trend-down":"stats-trend-neutral",m=d?ue.ArrowUp:u?ue.ArrowDown:void 0;return h.jsxs(I,{className:`stat-card ${i}`,style:a,id:l,...c,children:[h.jsxs(I,{className:"flex-between mb-md",children:[s&&h.jsx(I,{className:"stats-icon stats-icon-blue",children:h.jsx(oe,{name:s,className:"icon-lg"})}),n!==void 0&&h.jsxs(I,{className:`stats-change ${g}`,children:[m&&h.jsx(oe,{name:m,className:"icon-sm"}),h.jsxs(J,{className:"text-sm font-semibold",children:[f,"%"]})]})]}),h.jsx(jr,{className:"stats-value-lg",children:typeof e=="number"?e.toLocaleString():e}),h.jsx(yt,{className:"stats-label",children:t}),n!==void 0&&r&&h.jsx(I,{className:"stats-sublabel",children:h.jsx(J,{children:r})})]})},uu=()=>window.G7Core,fu=(e,t)=>uu()?.t?.(e,t)??e,Cy=({name:e="search",placeholder:t,value:n,onChange:r,onSubmit:s,showButton:o=!1,suggestions:i=[],onSuggestionClick:a,showSuggestions:l=!1,className:c="",style:d,id:u,editorAttrs:f})=>{const g=t??fu("common.search_placeholder"),[m,p]=v.useState(""),[y,b]=v.useState(!1),_=v.useRef(null),x=v.useRef(""),M=n!==void 0?n:m,S=l&&y&&i.length>0&&M.length>0,k="w-64 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",N=uu()?.style?.mergeClasses?.(k,c)??`${k} ${c}`;v.useEffect(()=>{n!==void 0&&(x.current=n)},[n]);const C=A=>{const P=A.target.value;p(P),r?.(A),x.current!==""&&P===""&&!A.nativeEvent.inputType&&setTimeout(()=>{const L=_.current?.querySelector("form");L&&L.requestSubmit()},0),x.current=P},w=A=>{p(A.text);const P={target:{value:A.text,name:e}};r?.(P),a?.(A),b(!1)},E=A=>{A.preventDefault(),s?.(A)};return h.jsxs(I,{ref:_,className:"relative",style:d,id:u,...f,children:[h.jsx(Ga,{onSubmit:E,className:"relative",children:h.jsxs(I,{className:`relative flex items-center ${o?"gap-2":""}`,children:[h.jsxs(I,{className:"relative flex-1",children:[h.jsx(I,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:h.jsx(oe,{name:ue.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),h.jsx(kt,{type:"search",name:e,value:M,onChange:C,onFocus:()=>b(!0),onBlur:()=>setTimeout(()=>b(!1),200),placeholder:g,className:N})]}),o&&h.jsx(ae,{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:fu("common.search")})]})}),S&&h.jsx(I,{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:i.map(A=>h.jsx(I,{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:()=>w(A),children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(oe,{name:ue.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:A.text})]})},A.id))})]})},dl=(e,t)=>window.G7Core?.t?.(e,t)??e,Sy=({title:e,filters:t,onChange:n,onReset:r,showResetButton:s=!0,className:o="",style:i,id:a,editorAttrs:l})=>{const c=e??dl("common.filter"),d=(f,g)=>{n?.(f,g)},u=(f,g,m)=>{const p=t.find(b=>b.id===f);if(!p)return;const y=Array.isArray(p.value)?p.value:[];if(typeof g=="string"){const b=y.filter(x=>typeof x=="string"),_=m?[...b,g]:b.filter(x=>x!==g);n?.(f,_)}else{const b=y.filter(x=>typeof x=="number"),_=m?[...b,g]:b.filter(x=>x!==g);n?.(f,_)}};return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md border border-gray-200 dark:border-gray-700 p-4 ${o}`,style:i,id:a,...l,children:[h.jsxs(I,{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(J,{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c}),s&&r&&h.jsx(ae,{onClick:r,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:dl("common.reset")})]}),h.jsx(I,{className:"space-y-4",children:t.map(f=>h.jsxs(I,{className:"space-y-2",children:[h.jsx(ln,{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:f.label}),f.type==="select"&&h.jsxs(Gr,{value:f.value,onChange:g=>d(f.id,g.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[h.jsx("option",{value:"",children:dl("common.select_placeholder")}),f.options.map(g=>h.jsx("option",{value:g.value,children:g.label},g.id))]}),f.type==="checkbox"&&h.jsx(I,{className:"space-y-2",children:f.options.map(g=>{const m=Array.isArray(f.value)?f.value.some(p=>p===g.value):!1;return h.jsxs(ln,{className:"flex items-center gap-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 p-2 rounded-md transition-colors",children:[h.jsx(_n,{checked:m,onChange:p=>u(f.id,g.value,p.target.checked),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:g.label})]},g.id)})})]},f.id))})]})},_y=({tabs:e,activeTabId:t,onTabChange:n,variant:r="default",className:s="",style:o,mobileBreakpoint:i=768,id:a,editorAttrs:l})=>{const d=window.G7Core?.useResponsive,u=d?.(),f=u?u.width<i:typeof window<"u"&&window.innerWidth<i,g=v.useRef([]),m=k=>{!k.disabled&&k.id!==t&&n?.(k.id)},p=(k,N)=>{const C=k.key==="ArrowRight"?1:k.key==="ArrowLeft"?-1:0;let w=null;if(C!==0)for(let E=1;E<=e.length;E+=1){const A=(N+C*E+e.length*E)%e.length;if(!e[A]?.disabled){w=A;break}}else if(k.key==="Home")w=e.findIndex(E=>!E.disabled);else if(k.key==="End"){for(let E=e.length-1;E>=0;E-=1)if(!e[E]?.disabled){w=E;break}}w===null||w<0||(k.preventDefault(),g.current[w]?.focus(),m(e[w]))},y=k=>{const N=k.target.value,C=Number(N),w=typeof N=="string"&&N!==""&&!Number.isNaN(C)?C:N,E=e.find(A=>String(A.id)===String(w));E&&m(E)};if(f)return h.jsx(I,{className:s,style:o,id:a,...l,children:h.jsx(Gr,{value:t!==void 0?String(t):"",onChange:y,options:e.map(k=>({value:String(k.id),label:k.badge!==void 0?`${k.label} (${k.badge})`:k.label,disabled:k.disabled})),className:"w-full"})});const b=k=>{const N=k.id===t;if(k.disabled)return"tab-btn-base tab-btn-disabled";switch(r){case"pills":return N?"tab-btn-base tab-btn-pills-active":"tab-btn-base tab-btn-pills";case"underline":return N?"tab-btn-base tab-btn-underline-active":"tab-btn-base tab-btn-underline";default:return N?"tab-btn-base tab-btn-default-active":"tab-btn-base tab-btn-default"}},_=r==="underline"?"tab-nav-underline":"tab-nav-default",x=l?.["data-editor-path"],M=e.findIndex(k=>k.id===t),S=M>=0?M:e.findIndex(k=>!k.disabled);return h.jsx(Go,{className:`${_} ${s}`,style:o,role:"tablist","aria-orientation":"horizontal",id:a,...l,children:e.map((k,N)=>h.jsxs(ae,{ref:C=>{g.current[N]=C},type:"button",role:"tab","aria-selected":k.id===t,tabIndex:N===S?0:-1,onClick:()=>m(k),onKeyDown:C=>p(C,N),disabled:k.disabled,className:b(k),...x?{"data-editor-item-path":`${x}.props.tabs.${N}`}:{},children:[k.iconName&&h.jsx(oe,{name:k.iconName,className:"w-4 h-4"}),h.jsx(J,{children:k.label}),k.badge!==void 0&&h.jsx(I,{className:"flex items-center justify-center min-w-[20px] h-5 px-1.5 bg-red-500 dark:bg-red-600 text-white dark:text-white text-xs font-bold rounded-full",children:h.jsx(J,{children:k.badge})})]},k.id))})},ul=window.G7Core?.createLogger?.("Handler:ScrollToSection")??{log:(...e)=>console.log("[Handler:ScrollToSection]",...e),warn:(...e)=>console.warn("[Handler:ScrollToSection]",...e),error:(...e)=>console.error("[Handler:ScrollToSection]",...e)};async function hu(e,t){const n=e.params||{},{targetId:r,offset:s=120,delay:o=100,scrollContainerId:i}=n;if(!r){ul.warn("targetId is required");return}const a=await Ey(r,o);if(!a){ul.warn(`Element not found: ${r}`);return}const l=My(a,i),c=Ny(a,l,s);Ty(l,c)}async function Ey(e,t){await new Promise(s=>setTimeout(s,t));const n=10,r=50;for(let s=0;s<n;s++){const o=document.getElementById(e);if(o)return await new Promise(i=>setTimeout(i,50)),o;await new Promise(i=>setTimeout(i,r))}return null}function My(e,t){if(t){const o=document.getElementById(t);if(o&&gu(o))return o;ul.warn(`Container '${t}' ${o?"has no scroll":"not found"}, trying auto-detect`)}let n=e.parentElement,r=0;const s=10;for(;n&&n!==document.body&&r<s;){if(gu(n))return n;n=n.parentElement,r++}return window}function gu(e){const t=window.getComputedStyle(e);return(t.overflowY==="auto"||t.overflowY==="scroll")&&e.scrollHeight>e.clientHeight}function Ny(e,t,n){if(t===window||!("getBoundingClientRect"in t))return e.getBoundingClientRect().top+window.pageYOffset-n;{const r=t.getBoundingClientRect(),s=e.getBoundingClientRect();return t.scrollTop+(s.top-r.top)-n}}function Ty(e,t){e===window||!("scrollTo"in e)?window.scrollTo({top:t,behavior:"smooth"}):e.scrollTo({top:t,behavior:"smooth"})}window.G7Core?.createLogger?.("Comp:TabNavigation");const Oy=({tabs:e,activeTabId:t,className:n="bg-white dark:bg-gray-800 flex gap-2 border-b border-gray-200 dark:border-gray-700 px-6",style:r,activeClassName:s="tab-btn-base tab-btn-default-active",inactiveClassName:o="tab-btn-base tab-btn-default",sectionIdPrefix:i="tab_content_",scrollOffset:a=120,scrollDelay:l=100,onTabChange:c,enableScrollSpy:d=!1,scrollSpyOffset:u=80,scrollContainerId:f,id:g,editorAttrs:m})=>{const[p,y]=v.useState(t??(e.length>0?e[0].id:"")),_=window.G7Core?.useResponsive,x=_?.(),M=x?x.width<768:typeof window<"u"&&window.innerWidth<768,S=v.useRef(!1),k=v.useRef(null),N=v.useRef([]),C=L=>{if(d&&(S.current=!0,k.current&&clearTimeout(k.current)),L.onClick){if(L.onClick(L.id),!d)return}else if(c){if(c(L.id),!d)return}else y(L.id);const $=L.scrollOffset??a,D=L.scrollDelay??l;hu({params:{targetId:`${i}${L.id}`,offset:$,delay:D,scrollContainerId:f}}),d&&(k.current=setTimeout(()=>{S.current=!1},D+500))},w=(L,$)=>{const D=L.key==="ArrowRight"?1:L.key==="ArrowLeft"?-1:0;let O=null;if(D!==0)for(let T=1;T<=e.length;T+=1){const z=($+D*T+e.length*T)%e.length;if(!e[z]?.disabled){O=z;break}}else if(L.key==="Home")O=e.findIndex(T=>!T.disabled);else if(L.key==="End"){for(let T=e.length-1;T>=0;T-=1)if(!e[T]?.disabled){O=T;break}}O===null||O<0||(L.preventDefault(),N.current[O]?.focus(),C(e[O]))};v.useEffect(()=>{if(!d)return;const L=f?document.getElementById(f):null,$={root:L??null,rootMargin:`-${u}px 0px -30% 0px`,threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]},D=new Map,O=()=>{const W=L,G=W?W.scrollTop:window.pageYOffset||document.documentElement.scrollTop,B=W?W.scrollHeight:document.documentElement.scrollHeight,j=W?W.clientHeight:document.documentElement.clientHeight;return G+j>=B-10},T=W=>{if(S.current)return;W.forEach(X=>{const K=X.target.id;X.isIntersecting?D.set(K,X.intersectionRatio):D.delete(K)});let G=0,B="";D.forEach((X,K)=>{X>G&&(G=X,B=K)});const j=e[e.length-1],Y=`${i}${j?.id}`,V=D.has(Y);if(O()&&V&&j){y(j.id);return}if(B){const X=B.replace(i,""),K=Number(X),q=isNaN(K)?X:K;e.some(te=>te.id===q)&&y(q)}},z=()=>{},U=new IntersectionObserver(T,$);return e.forEach(W=>{const G=document.getElementById(`${i}${W.id}`);G&&U.observe(G)}),window.addEventListener("scroll",z,{passive:!0}),()=>{U.disconnect(),window.removeEventListener("scroll",z),k.current&&clearTimeout(k.current)}},[d,e,i,u,f]);const E=L=>{const $=L.target.value,D=Number($),O=isNaN(D)?$:D,T=e.find(z=>z.id===O);T&&C(T)};if(M)return h.jsx(I,{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3",id:g,...m,children:h.jsx(Gr,{value:String(p),onChange:E,options:e.map(L=>({value:String(L.id),label:L.label,disabled:L.disabled})),className:"w-full"})});const A=e.findIndex(L=>L.id===p),P=A>=0?A:e.findIndex(L=>!L.disabled);return h.jsx(I,{className:n,style:r,role:"tablist","aria-orientation":"horizontal",id:g,...m,children:e.map((L,$)=>h.jsxs(ae,{ref:D=>{N.current[$]=D},type:"button",role:"tab","aria-selected":p===L.id,tabIndex:$===P?0:-1,className:p===L.id?s:o,disabled:L.disabled,onClick:()=>C(L),onKeyDown:D=>w(D,$),children:[L.iconName&&h.jsx(oe,{name:L.iconName,size:"sm"}),h.jsx(J,{children:L.label})]},L.id))})},Ay=()=>window.G7Core,Dy=({iconName:e,label:t,onClick:n,variant:r="primary",size:s="md",disabled:o=!1,className:i="",style:a,id:l,editorAttrs:c})=>{const d={sm:t?"px-3 py-1.5 text-sm":"w-8 h-8",md:t?"px-4 py-2 text-base":"w-10 h-10",lg:t?"px-5 py-2.5 text-lg":"w-12 h-12"},u={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},f={primary:"bg-blue-600 hover:bg-blue-700 text-white border-transparent",secondary:"bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600",danger:"bg-red-600 hover:bg-red-700 text-white border-transparent",ghost:"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-transparent",outline:"bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600"},g="inline-flex items-center justify-center gap-2 font-medium rounded-lg border transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-blue-400",m=o?"opacity-50 cursor-not-allowed":"",p=`${g} ${d[s]} ${f[r]} ${m}`,y=Ay()?.style?.mergeClasses?.(p,i)??`${p} ${i}`;return h.jsxs(ae,{onClick:n,disabled:o,className:y,style:a,id:l,...c,children:[h.jsx(oe,{name:e,className:u[s]}),t]})},Iy=(e,t)=>window.G7Core?.t?.(e,t)??e,pu=({isOpen:e,onClose:t,title:n,content:r,actions:s=[],width:o="500px",closeOnOverlay:i=!0,showCloseButton:a=!0,className:l="",style:c})=>{const d=()=>{i&&t()},u={primary:"dialog-btn-primary",secondary:"dialog-btn-secondary",danger:"dialog-btn-danger",ghost:"dialog-btn-ghost"};return h.jsxs(Zo,{isOpen:e,onClose:d,width:o,className:l,style:c,children:[h.jsxs(I,{className:"dialog-header",children:[h.jsx(or,{className:"dialog-title",children:n}),a&&h.jsx(ae,{onClick:t,className:"dialog-close","aria-label":Iy("common.close_dialog"),children:h.jsx(oe,{name:ue.Times,className:"icon-md"})})]}),h.jsx(I,{className:"dialog-body",children:r}),s.length>0&&h.jsx(I,{className:"dialog-footer",children:s.map((f,g)=>h.jsxs(ae,{onClick:f.onClick,disabled:f.disabled,className:u[f.variant||"primary"],children:[f.iconName&&h.jsx(oe,{name:f.iconName,className:"icon-sm mr-2 inline-block"}),f.label]},g))})]})},fl=(e,t)=>window.G7Core?.t?.(e,t)??e,mu=({isOpen:e,onClose:t,title:n,message:r,confirmText:s,cancelText:o,onConfirm:i,onCancel:a,confirmButtonVariant:l="primary",cancelButtonVariant:c="secondary",width:d="500px",closeOnOverlay:u=!0,isLoading:f=!1,loadingText:g})=>{const m=s??fl("common.confirm"),p=o??fl("common.cancel"),y=g??fl("common.loading"),b=()=>{i()},_=()=>{f||(a?.(),t())},x=()=>{f||t()},M={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 h.jsxs(Zo,{isOpen:e,onClose:x,title:n,width:d,children:[h.jsx(I,{className:"py-2",children:typeof r=="string"?h.jsx(yt,{className:"text-gray-700 dark:text-gray-300",children:r}):r}),h.jsxs(I,{className:"flex justify-end gap-3 mt-6",children:[h.jsx(ae,{onClick:_,disabled:f,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:h.jsx(J,{children:p})}),h.jsxs(ae,{onClick:b,disabled:f,className:`flex items-center gap-2 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed ${M[l]}`,children:[f&&h.jsx(oe,{name:ue.Spinner,className:"w-4 h-4 animate-spin"}),h.jsx(J,{children:f?y:m})]})]})]})},Ly=(e,t)=>window.G7Core?.t?.(e,t)??e,Py=({isOpen:e,onClose:t,title:n,message:r,confirmText:s,onConfirm:o,confirmButtonVariant:i="primary",width:a="500px",closeOnOverlay:l=!0})=>{const u=[{label:s??Ly("common.confirm"),onClick:()=>{o?.(),t()},variant:i}],f=typeof r=="string"?h.jsx(yt,{className:"text-gray-700 dark:text-gray-300",children:r}):r;return h.jsx(pu,{isOpen:e,onClose:t,title:n,content:f,actions:u,width:a,closeOnOverlay:l})},$y=(e,t)=>window.G7Core?.t?.(e,t)??e,Fy={success:ue.CheckCircle,error:ue.XCircle,warning:ue.ExclamationTriangle,info:ue.InfoCircle},bu={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"}},zy={"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"},Vy=({toasts:e,position:t="bottom-center",duration:n=3e3,onRemove:r})=>{const[s,o]=v.useState(new Map),i=v.useCallback(a=>{o(l=>{const c=new Map(l);return c.set(a,!1),c}),setTimeout(()=>{if(r)r(a);else{const l=window.G7Core;l?.state?.update&&l.state.update(c=>({toasts:(Array.isArray(c.toasts)?c.toasts:[]).filter(u=>u.id!==a)}))}},300)},[r]);return v.useEffect(()=>{!e||e.length===0||e.forEach(a=>{if(s.has(a.id))return;o(c=>{const d=new Map(c);return d.set(a.id,!0),d});const l=a.duration||n;l>0&&setTimeout(()=>{i(a.id)},l)})},[e,n,i,s]),!e||e.length===0?null:h.jsx(I,{className:`fixed z-[9999] flex flex-col gap-2 ${zy[t]}`,"aria-live":"polite","aria-atomic":"true",children:e.map(a=>h.jsx(Hy,{toast:a,position:t,isVisible:s.get(a.id)??!0,onClose:()=>i(a.id)},a.id))})},Hy=({toast:e,position:t,isVisible:n,onClose:r})=>{const s=bu[e.type]||bu.info,o=e.icon?e.icon:Fy[e.type],i=t.startsWith("bottom")?"translate-y-2":"-translate-y-2";return h.jsxs(I,{className:`
|
||
flex items-center gap-3 p-4 rounded-lg border shadow-lg
|
||
min-w-[300px] max-w-md
|
||
transition-all duration-300
|
||
${s.bg}
|
||
${n?"opacity-100 translate-y-0":`opacity-0 ${i}`}
|
||
`,role:"alert",children:[h.jsx(oe,{name:o,className:`w-5 h-5 flex-shrink-0 ${s.text}`}),h.jsx(J,{className:`flex-1 text-sm font-medium ${s.text}`,children:e.message}),h.jsx(ae,{onClick:r,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${s.text} focus:outline-none`,"aria-label":$y("common.close_notification"),children:h.jsx(oe,{name:ue.Times,className:"w-4 h-4"})})]})},yu=({items:e,separator:t=h.jsx(oe,{name:ue.ChevronRight,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),showHome:n=!1,homeHref:r="/",maxItems:s,className:o="",id:i,editorAttrs:a})=>{let c=n?[{label:"Home",href:r},...e]:e,d=c,u=!1;if(s&&c.length>s){u=!0;const f=c.slice(0,1),g=c.slice(-(s-2));d=[...f,...g]}return h.jsx(Go,{className:`flex items-center space-x-2 text-sm ${o}`,"aria-label":"Breadcrumb",id:i,...a,children:h.jsx(I,{className:"flex items-center space-x-2",children:d.map((f,g)=>{const m=g===d.length-1,p=g===0;return h.jsxs(v.Fragment,{children:[u&&p&&h.jsxs(h.Fragment,{children:[h.jsx(vu,{item:f,isLast:!1}),h.jsx(J,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:t}),h.jsx(J,{className:"text-gray-500 dark:text-gray-400",children:"..."}),d.length>1&&h.jsx(J,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:t})]}),(!u||!p)&&h.jsxs(h.Fragment,{children:[h.jsx(vu,{item:f,isLast:m}),!m&&h.jsx(J,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:t})]})]},g)})})})},vu=({item:e,isLast:t})=>t||!e.href&&!e.onClick?h.jsx(J,{className:"font-medium text-gray-900 dark:text-white","aria-current":t?"page":void 0,children:e.label}):e.onClick?h.jsx(Wr,{href:"#",onClick:n=>{n.preventDefault(),e.onClick?.()},className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:e.label}):h.jsx(Wr,{href:e.href,className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:e.label}),Uy=({title:e,description:t,iconName:n,illustrationSrc:r,illustrationAlt:s="Empty state illustration",actions:o=[],className:i="",id:a,editorAttrs:l})=>{const c={primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 focus:ring-gray-500",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-gray-500"};return h.jsxs(I,{className:`flex flex-col items-center justify-center p-8 text-center ${i}`,role:"status","aria-live":"polite",id:a,...l,children:[r?h.jsx(Sn,{src:r,alt:s,className:"w-48 h-48 mb-6 object-contain"}):n?h.jsx(I,{className:"mb-6 p-4 rounded-full bg-gray-100 dark:bg-gray-700",children:h.jsx(oe,{name:n,className:"w-12 h-12 text-gray-400 dark:text-gray-500"})}):null,h.jsx(or,{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:e}),t&&h.jsx(yt,{className:"text-gray-600 dark:text-gray-400 mb-6 max-w-md",children:t}),o.length>0&&h.jsx(I,{className:"flex flex-wrap gap-3 justify-center",children:o.map((d,u)=>h.jsxs(ae,{onClick:d.onClick,className:`
|
||
px-4 py-2 rounded-md font-medium transition-colors
|
||
focus:outline-none focus:ring-2 focus:ring-offset-2
|
||
${c[d.variant||"primary"]}
|
||
`,children:[d.iconName&&h.jsx(oe,{name:d.iconName,className:"w-4 h-4 mr-2 inline-block"}),d.label]},u))})]})},By=(e,t)=>window.G7Core?.t?.(e,t)??e,jy=({id:e,size:t="md",color:n="text-blue-600",fullscreen:r=!1,text:s,className:o="",editorAttrs:i})=>{const a={sm:"w-4 h-4 border-2",md:"w-8 h-8 border-2",lg:"w-12 h-12 border-3",xl:"w-16 h-16 border-4"},l={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg"},c=h.jsxs(I,{className:`flex flex-col items-center justify-center gap-3 ${o}`,children:[h.jsx(I,{className:`
|
||
${a[t]}
|
||
border-gray-200 dark:border-gray-700 border-t-current
|
||
rounded-full animate-spin
|
||
${n}
|
||
`,role:"status","aria-label":By("common.loading")}),s&&h.jsx(J,{className:`${l[t]} ${n} font-medium`,children:s})]});return r?h.jsx(I,{id:e,className:"fixed inset-0 z-50 flex items-center justify-center bg-white dark:bg-gray-900 bg-opacity-90 dark:bg-opacity-90","aria-live":"polite","aria-busy":"true",...i,children:c}):h.jsx(I,{id:e,className:"flex items-center justify-center p-4","aria-live":"polite","aria-busy":"true",...i,children:c})},Rr=()=>window.G7Core,hl=(e,t)=>window.G7Core?.t?.(e,t)??e,Wy=({logo:e,logoAlt:t="Logo",menu:n=[],collapsed:r=!1,onToggleCollapse:s,className:o="",currentLocale:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(new Set),[u,f]=v.useState(i||Rr()?.locale?.current?.()||"ko"),[g,m]=v.useState(window.location.pathname),p=v.useMemo(()=>{const w=[],E=A=>{for(const P of A)P.url&&w.push(P.url),P.children&&E(P.children)};return E(n),w},[n]),y=v.useCallback(w=>{let E=null;for(const A of p)(w===A||w.startsWith(A+"/"))&&(!E||A.length>E.length)&&(E=A);return E},[p]);v.useEffect(()=>{const w=Rr();return w?.state?.subscribe?w.state.subscribe(A=>{const P=A?._global?.locale||w?.locale?.current?.()||"ko";f(P);const L=A?._global?.currentPath||window.location.pathname;m(L)}):void 0},[]),v.useEffect(()=>{const w=()=>{m(window.location.pathname)};return window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)},[]),v.useEffect(()=>{i&&f(i)},[i]);const b=(w,E)=>!w||typeof E!="string"?!1:E===w?!0:E.startsWith(w+"/")?y(E)===w:!1,_=(w,E)=>{const A=new Set,P=L=>{for(const $ of L)if($.children&&$.children.length>0){if(P($.children)||b($.url,E))return A.add($.id),!0}else if(b($.url,E))return!0;return!1};return P(w),A};v.useEffect(()=>{if(n.length>0&&g){const w=_(n,g);w.size>0&&d(E=>new Set([...E,...w]))}},[g,n]);const x=w=>b(w,g),M=w=>w.children?w.children.some(E=>x(E.url)||M(E)):!1,S=w=>{d(E=>{const A=new Set(E);return A.has(w)?A.delete(w):A.add(w),A})},k=w=>typeof w=="string"?w:w[u]||w.en||Object.values(w)[0]||"",N=(w,E)=>{Rr()?.dispatch?(w.preventDefault(),Rr().navigation?.onComplete(()=>{Rr().dispatch({handler:"setState",params:{target:"global",sidebarOpen:!1}})}),Rr().dispatch({handler:"navigate",params:{path:E}})):window.location.href=E},C=(w,E=0,A=!1)=>{const P=w.children&&w.children.length>0,L=c.has(w.id),$=k(w.name),D=E>0,O=x(w.url),T=M(w),z=D?"admin-sidebar-subitem":"admin-sidebar-item",U="admin-sidebar-item-active",W="admin-sidebar-item-active-parent",G="admin-sidebar-item-default";return h.jsxs(I,{className:D?"relative group":"",children:[D&&h.jsxs(h.Fragment,{children:[!A&&h.jsx(I,{className:"admin-sidebar-tree-line-vertical"}),h.jsx(I,{className:"admin-sidebar-tree-line-curve"})]}),P&&w.url?h.jsxs(I,{className:`
|
||
${z}
|
||
${O?U:T?W:G}
|
||
${r?"justify-center":""}
|
||
`,children:[h.jsxs(ae,{onClick:j=>N(j,w.url),className:"flex items-center justify-start flex-1 min-w-0",children:[w.icon&&h.jsx(pt,{className:`${w.icon} ${r?"":"mr-3"} w-5 h-5 flex items-center justify-center`}),!r&&h.jsx(J,{className:"truncate",children:$})]}),!r&&h.jsxs(I,{className:"admin-sidebar-chevron-trail",children:[w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"}),h.jsx(ae,{onClick:()=>S(w.id),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600","aria-label":hl(L?"common.collapse":"common.expand"),children:h.jsx(pt,{className:`fas fa-chevron-down w-4 h-4 transition-transform ${L?"rotate-180":""}`})})]})]}):P?h.jsxs(ae,{onClick:()=>S(w.id),className:`
|
||
${z}
|
||
${T?W:G}
|
||
${r?"justify-center":""}
|
||
`,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(pt,{className:w.icon})}),!r&&h.jsx(J,{children:$})]}),!r&&h.jsxs(I,{className:"admin-sidebar-chevron-trail",children:[w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"}),h.jsx(pt,{className:`fas fa-chevron-right w-4 h-4 text-slate-400 transition-transform duration-200 ${L?"rotate-90":""}`})]})]}):w.url?h.jsxs(ae,{onClick:j=>N(j,w.url),className:`
|
||
${z}
|
||
${O?U:G}
|
||
${r?"justify-center":""}
|
||
text-left
|
||
`,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(pt,{className:w.icon})}),!r&&h.jsx(J,{children:$})]}),!r&&w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}):h.jsxs(ae,{className:`
|
||
${z}
|
||
admin-sidebar-item-disabled
|
||
${r?"justify-center":""}
|
||
text-left
|
||
`,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(pt,{className:w.icon})}),!r&&h.jsx(J,{children:$})]}),!r&&w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}),P&&!r&&L&&h.jsx(I,{className:"relative ml-2",children:w.children.map((j,Y)=>C(j,E+1,Y===w.children.length-1))})]},w.id)};return h.jsxs(I,{className:o,id:a,...l,children:[(e||s)&&h.jsxs(I,{className:"admin-sidebar-header",children:[e&&!r&&h.jsx(Sn,{src:e,alt:t,className:"h-8"}),s&&h.jsx(ae,{onClick:s,className:"admin-sidebar-collapse-btn","aria-label":hl(r?"common.expand_sidebar":"common.collapse_sidebar"),children:h.jsx(pt,{className:`${r?"fas fa-chevron-right":"fas fa-chevron-left"} w-5 h-5 text-slate-600 dark:text-slate-400`})})]}),h.jsx(I,{className:"admin-sidebar-menu-list",children:n.map((w,E)=>C(w,0,E===n.length-1))})]})},zs=(e,t)=>window.G7Core?.t?.(e,t)??e,Gy=({user:e={name:"",email:""},notifications:t=[],onNotificationClick:n,onProfileClick:r,onLogoutClick:s,className:o=""})=>{const[i,a]=v.useState(!1),[l,c]=v.useState(!1),d=v.useRef(null),u=v.useRef(null),f=t.filter(g=>!g.read).length;return v.useEffect(()=>{const g=m=>{d.current&&!d.current.contains(m.target)&&a(!1),u.current&&!u.current.contains(m.target)&&c(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),h.jsxs(I,{className:`
|
||
bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-6 py-4 flex items-center justify-end gap-4
|
||
${o}
|
||
`,children:[h.jsxs(I,{ref:d,className:"relative",children:[h.jsxs(ae,{onClick:()=>a(!i),className:"relative p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors","aria-label":zs("common.notifications"),children:[h.jsx(oe,{name:ue.Bell,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),f>0&&h.jsx(J,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 rounded-full",children:f>9?"9+":f})]}),i&&h.jsxs(I,{className:"absolute right-0 mt-2 w-80 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsx(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:h.jsx(J,{className:"font-semibold text-gray-900 dark:text-white",children:zs("common.notifications")})}),h.jsx(I,{className:"max-h-96 overflow-y-auto",children:t.length===0?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(J,{children:zs("common.no_notifications")})}):t.map(g=>h.jsx(ae,{onClick:()=>{g.onClick?.(),n?.(g.id),a(!1)},className:`
|
||
w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700 border-b border-gray-100 dark:border-gray-700 transition-colors
|
||
${g.read?"":"bg-blue-50 dark:bg-blue-900/20"}
|
||
`,children:h.jsxs(I,{className:"flex items-start gap-3",children:[g.iconName&&h.jsx(oe,{name:g.iconName,className:"w-5 h-5 text-gray-600 dark:text-gray-400 mt-0.5"}),h.jsxs(I,{className:"flex-1",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:g.title}),h.jsx(I,{className:"text-gray-600 dark:text-gray-400 text-sm mt-1",children:g.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1",children:g.time})]}),!g.read&&h.jsx(J,{className:"w-2 h-2 bg-blue-500 rounded-full mt-1.5"})]})},g.id))})]})]}),h.jsxs(I,{ref:u,className:"relative",children:[h.jsxs(ae,{onClick:()=>c(!l),className:"flex items-center gap-3 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e.avatar?h.jsx(Sn,{src:e.avatar,alt:e.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(oe,{name:ue.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"hidden md:block text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:e.name}),e.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:e.role})]}),h.jsx(oe,{name:ue.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]}),l&&h.jsxs(I,{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 z-50",children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:e.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:e.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(ae,{onClick:()=>{r?.(),c(!1)},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 text-gray-900 dark:text-white",children:[h.jsx(oe,{name:ue.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{children:zs("common.profile_settings")})]}),h.jsxs(ae,{onClick:()=>{s?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 text-red-600 dark:text-red-400 transition-colors",children:[h.jsx(oe,{name:ue.ArrowRight,className:"w-5 h-5"}),h.jsx(J,{children:zs("common.logout")})]})]})]})]})]})},Yy=({notifications:e=[],unreadCount:t=0,hasMore:n=!1,loading:r=!1,titleText:s="Notifications",emptyText:o="No notifications",markAllReadText:i="Mark all as read",deleteAllText:a="Delete all",unreadOnlyText:l="Unread only",unreadOnly:c=!1,onNotificationClick:d,onClose:u,onLoadMore:f,onMarkAllRead:g,onDeleteAll:m,onDelete:p,onUnreadOnlyToggle:y,dropdownAlign:b="right",className:_="",id:x,editorAttrs:M})=>{const[S,k]=v.useState(!1),N=v.useRef(null),C=v.useRef(null),w=v.useRef(null),E=v.useRef(null),A=v.useRef(new Set),P=v.useRef(f),L=v.useRef(n),$=v.useRef(r),D=v.useRef(e.length),O=v.useRef(-1);v.useEffect(()=>{P.current=f,L.current=n,$.current=r,D.current=e.length}),v.useEffect(()=>{if(!E.current||!w.current||!S)return;O.current=-1;const W=new IntersectionObserver(([G])=>{G.isIntersecting&&($.current||!L.current||O.current!==D.current&&(O.current=D.current,P.current?.()))},{root:w.current,threshold:.1});return W.observe(E.current),()=>W.disconnect()},[S]),v.useEffect(()=>{if(!w.current||!S)return;const W=new IntersectionObserver(B=>{B.forEach(j=>{const Y=j.target.getAttribute("data-notification-id"),V=j.target.getAttribute("data-unread")==="true";Y&&V&&j.isIntersecting&&A.current.add(Y)})},{root:w.current,threshold:.5});return w.current.querySelectorAll("[data-notification-id]").forEach(B=>W.observe(B)),()=>W.disconnect()},[S,e]);const T=t>0?t:e.filter(W=>!W.read).length,z=v.useCallback(()=>{if(S){if(T>0){const W=Array.from(A.current).filter(G=>{const B=e.find(j=>String(j.id)===String(G));return B&&!B.read});W.length>0&&u?.(W)}A.current.clear(),k(!1)}},[S,u,T,e]);v.useEffect(()=>{if(!S)return;const W=G=>{N.current&&!N.current.contains(G.target)&&z()};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[S,z]);const U=v.useCallback(()=>{S?z():k(!0)},[S,z]);return v.useLayoutEffect(()=>{const W=C.current;if(!S||!W)return;W.style.transform="";const G=W.getBoundingClientRect(),B=typeof window<"u"?window.innerWidth:0;if(G.width===0&&G.height===0)return;const j=8;let Y=0;G.right>B-j?Y=-(G.right-(B-j)):G.left<j&&(Y=j-G.left),Y!==0&&(W.style.transform=`translateX(${Y}px)`)},[S,b,e.length]),h.jsxs(I,{ref:N,className:`relative ${_}`,id:x,...M,children:[h.jsxs(ae,{onClick:U,className:"relative w-9 h-9 flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-full transition-colors cursor-pointer","aria-label":s,children:[h.jsx(oe,{name:ue.Bell,className:"text-sm text-slate-500 dark:text-slate-400"}),T>0&&h.jsx(J,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 dark:bg-red-600 rounded-full",children:T>99?"99+":T})]}),S&&h.jsxs(I,{ref:C,className:`absolute ${b==="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:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[h.jsxs(I,{className:"flex items-center gap-3 min-w-0",children:[h.jsx(J,{className:"font-semibold text-gray-900 dark:text-white",children:s}),y&&h.jsxs(I,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>y(!c),children:[h.jsx(kt,{type:"checkbox",checked:c,onChange:W=>{W.stopPropagation(),y(W.target.checked)},onClick:W=>W.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"}),h.jsx(J,{className:"text-xs text-gray-600 dark:text-gray-400",children:l})]})]}),h.jsxs(I,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&T>0&&h.jsx(ae,{onClick:()=>{g(),A.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:i}),m&&e.length>0&&h.jsx(ae,{onClick:()=>{m()},className:"text-xs text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 hover:underline cursor-pointer",children:a})]})]}),h.jsx(I,{ref:w,className:"max-h-96 overflow-y-auto",children:e.length===0&&!r?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(J,{children:o})}):h.jsxs(h.Fragment,{children:[e.map(W=>{const G=!W.read;return h.jsxs(I,{"data-notification-id":W.id,"data-unread":G?"true":"false",onClick:()=>{W.onClick?.(),d?.(W),k(!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 ${G?"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:[W.iconName&&h.jsx(oe,{name:W.iconName,className:`w-5 h-5 mt-0.5 flex-shrink-0 ${G?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`text-sm truncate ${G?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:W.title}),h.jsx(I,{className:`text-sm mt-1 line-clamp-2 ${G?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:W.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:W.time})]}),h.jsxs(I,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[G&&h.jsx(J,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),p&&h.jsx(ae,{onClick:B=>{B.stopPropagation(),p(W)},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:h.jsx(oe,{name:ue.Trash,className:"w-4 h-4"})})]})]},W.id)}),n&&h.jsx(I,{ref:E,className:"px-4 py-3 text-center",children:r?h.jsx(J,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):h.jsx(J,{className:"text-sm text-gray-400 dark:text-gray-500"})}),r&&!n&&e.length>0&&h.jsx(I,{className:"px-4 py-2 text-center",children:h.jsx(J,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},xu=window.G7Core?.createLogger?.("Comp:UserProfile")??{log:(...e)=>console.log("[Comp:UserProfile]",...e),warn:(...e)=>console.warn("[Comp:UserProfile]",...e),error:(...e)=>console.error("[Comp:UserProfile]",...e)},Xy=({user:e={name:"",email:""},profileText:t="Profile Settings",logoutText:n="Logout",onProfileClick:r,onLogoutClick:s,className:o="",logoutEndpoint:i="/api/admin/auth/logout",redirectPath:a="/admin/login",showChevron:l=!0,dropdownDirection:c="up",dropdownOnly:d=!1,id:u,editorAttrs:f})=>{const[g,m]=v.useState(!1),[p,y]=v.useState(!1),b=v.useRef(null);v.useEffect(()=>{const S=k=>{b.current&&!b.current.contains(k.target)&&m(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);const _=()=>{const k=`; ${document.cookie}`.split("; XSRF-TOKEN=");return k.length===2?decodeURIComponent(k.pop()?.split(";").shift()||""):null},x=()=>localStorage.getItem("auth_token"),M=async()=>{if(!p)try{if(y(!0),m(!1),s){s();return}const S=_(),k=x(),N=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...S&&{"X-XSRF-TOKEN":S},...k&&{Authorization:`Bearer ${k}`}},credentials:"include"});N.ok?(localStorage.removeItem("auth_token"),window.location.href=a):(xu.error("로그아웃 실패:",N.statusText),localStorage.removeItem("auth_token"),window.location.href=a)}catch(S){xu.error("로그아웃 오류:",S),localStorage.removeItem("auth_token"),window.location.href=a}finally{y(!1)}};return h.jsxs(I,{ref:b,className:d?`absolute inset-0 ${o}`:`relative ${o}`,id:u,...f,children:[h.jsx(ae,{onClick:()=>m(!g),className:d?"w-full h-full opacity-0 cursor-pointer":"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors w-full",children:!d&&h.jsxs(h.Fragment,{children:[e.avatar?h.jsx(Sn,{src:e.avatar,alt:e.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(oe,{name:ue.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"flex-1 text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:e.name}),e.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:e.role})]}),l&&h.jsx(oe,{name:ue.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]})}),g&&h.jsxs(I,{className:`absolute ${c==="down"?"top-full mt-2":"bottom-full mb-2"} ${d?"right-0 w-72":"left-0 w-full"} bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:()=>{m(!1),window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${e.uuid}`}})},children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:e.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:e.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(ae,{onClick:()=>{m(!1),r?r():window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${e.uuid}/edit`}})},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 transition-colors",children:[h.jsx(oe,{name:ue.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"text-gray-900 dark:text-white",children:t})]}),h.jsxs(ae,{onClick:M,disabled:p,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 text-red-600 dark:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx(oe,{name:ue.ArrowRight,className:"w-5 h-5"}),h.jsx(J,{children:p?"Logging out...":n})]})]})]})]})},Qo=window.G7Core?.createLogger?.("Comp:LanguageSelector")??{log:(...e)=>console.log("[Comp:LanguageSelector]",...e),warn:(...e)=>console.warn("[Comp:LanguageSelector]",...e),error:(...e)=>console.error("[Comp:LanguageSelector]",...e)},wu=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},Ky=({availableLocales:e=["ko","en"],languageText:t="Language",apiEndpoint:n="/api/admin/users/me/language",onLanguageChange:r,className:s="",inline:o=!1,showCode:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(!1),[g,m]=v.useState(()=>localStorage.getItem("g7_locale")||"ko"),p=v.useRef(null);v.useEffect(()=>{if(o)return;const x=M=>{p.current&&!p.current.contains(M.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]);const y=()=>{const M=`; ${document.cookie}`.split("; XSRF-TOKEN=");return M.length===2?decodeURIComponent(M.pop()?.split(";").shift()||""):null},b=()=>localStorage.getItem("auth_token"),_=async x=>{if(!(u||x===g))try{f(!0);const M=y(),S=b();try{const k=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json",...M&&{"X-XSRF-TOKEN":M},...S&&{Authorization:`Bearer ${S}`}},credentials:"include",body:JSON.stringify({language:x})});k.ok||Qo.warn("언어 설정 저장 실패 (UI는 변경됨):",k.statusText)}catch(k){Qo.warn("언어 설정 API 호출 실패 (UI는 변경됨):",k)}m(x),d(!1),r?.(x),window.__templateApp?await window.__templateApp.changeLocale(x):(Qo.warn("TemplateApp not found, reloading page"),window.location.reload())}catch(M){Qo.error("언어 변경 오류:",M)}finally{f(!1)}};return o?h.jsxs(I,{className:`${s}`,id:a,...l,children:[h.jsxs(ae,{onClick:()=>d(!c),disabled:u,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",children:[h.jsx(oe,{name:ue.Globe,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"text-gray-900 dark:text-white flex-1",children:t}),h.jsx(J,{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded",children:g.toUpperCase()}),h.jsx(oe,{name:ue.ChevronDown,className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${c?"rotate-180":""}`})]}),c&&h.jsx(I,{className:"px-4 py-2 flex flex-wrap gap-2",children:e.map(x=>h.jsx(ae,{onClick:()=>_(x),disabled:u,className:`
|
||
px-3 py-1.5 text-sm font-medium rounded-md transition-colors
|
||
${g===x?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}
|
||
${u?"opacity-50 cursor-not-allowed":""}
|
||
`,children:wu(x)},x))})]}):h.jsxs(I,{ref:p,className:`relative ${s}`,id:a,...l,children:[h.jsxs(ae,{onClick:()=>d(!c),className:i?"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 transition-colors cursor-pointer":"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors","aria-haspopup":"listbox","aria-expanded":c,"aria-label":t,children:[h.jsx(oe,{name:ue.Globe,className:i?"w-4 h-4":"w-5 h-5 text-gray-600 dark:text-gray-400"}),i&&h.jsx(J,{className:"font-medium uppercase",children:g}),i&&h.jsx(oe,{name:ue.ChevronDown,className:"w-3 h-3"})]}),c&&h.jsx(I,{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:h.jsx(I,{className:"py-2",children:e.map(x=>h.jsxs(ae,{onClick:()=>_(x),disabled:u,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
|
||
${g===x?"bg-gray-50 dark:bg-gray-700":""}
|
||
${u?"opacity-50 cursor-not-allowed":""}
|
||
`,children:[h.jsx(J,{className:"text-gray-900 dark:text-white flex-1",children:wu(x)}),g===x&&h.jsx(oe,{name:ue.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400"})]},x))})})]})},qy=({copyright:e="© 2026 G7",version:t,quickLinks:n=[],className:r="",changelogModalId:s,copyrightModalId:o,id:i,editorAttrs:a})=>{const l=v.useCallback(()=>{s&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/changelog",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreChangelogContent:"{{response.data.content}}"}},{handler:"openModal",target:s}],onError:[{handler:"openModal",target:s}]}]})},[s]),c=v.useCallback(()=>{o&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/license",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreLicenseContent:"{{response.data.content}}"}},{handler:"openModal",target:o}],onError:[{handler:"openModal",target:o}]}]})},[o]);return h.jsx(I,{className:`admin-footer ${r}`,id:i,...a,children:h.jsxs(I,{className:"admin-footer-row",children:[h.jsxs(I,{className:"admin-footer-group",children:[h.jsx(J,{className:o?"admin-footer-link-hover":"",onClick:o?c:void 0,children:e}),t&&h.jsxs(h.Fragment,{children:[h.jsx(J,{className:"hidden md:inline",children:"•"}),h.jsxs(J,{className:`flex-center gap-2 ${s?"admin-footer-link-hover":""}`,onClick:s?l:void 0,children:[h.jsx(oe,{name:ue.Tag,className:"w-4 h-4"}),h.jsxs(J,{children:["v",t]})]})]})]}),n.length>0&&h.jsx(I,{className:"flex-center gap-4",children:n.map(d=>h.jsxs(Wr,{href:d.url,className:"admin-footer-link",children:[d.iconName&&h.jsx(oe,{name:d.iconName,className:"w-4 h-4"}),h.jsx(J,{children:d.label})]},d.id))})]})})},Zy=({title:e,description:t,breadcrumbItems:n,tabs:r,onTabChange:s,actions:o,className:i="",children:a,id:l,editorAttrs:c})=>{const d=(u="secondary")=>({primary:"page-action-primary",secondary:"page-action-secondary",danger:"page-action-danger",ghost:"page-action-ghost"})[u];return h.jsxs(I,{className:i,id:l,...c,children:[n&&n.length>0&&h.jsx(I,{className:"mb-md",children:h.jsx(yu,{items:n})}),h.jsxs(I,{className:"flex-between mb-lg",children:[h.jsxs(I,{children:[h.jsx(Ba,{className:"page-title",children:e}),t&&h.jsx(yt,{className:"page-description",children:t})]}),a?h.jsx(I,{className:"flex-center page-actions",children:a}):o&&o.length>0?h.jsx(I,{className:"page-actions",children:o.map(u=>h.jsxs(ae,{onClick:u.onClick,disabled:u.disabled,className:d(u.variant),children:[u.iconName&&h.jsx(oe,{name:u.iconName,className:"icon-md"}),u.variant!=="ghost"&&u.label&&h.jsx(I,{children:u.label})]},u.id))}):null]}),r&&r.length>0&&h.jsx(I,{className:"tab-container",children:r.map(u=>h.jsxs(ae,{onClick:()=>s?.(u.value),className:u.active?"tab-btn-active":"tab-btn",children:[h.jsx(I,{children:u.label}),u.badge!==void 0&&h.jsx(I,{className:u.active?"tab-badge-active":"tab-badge",children:u.badge})]},u.id))})]})},Qy=()=>window.G7Core,Jy=({title:e,description:t,className:n="",style:r,children:s,id:o,editorAttrs:i})=>{const a="flex items-center justify-between",l=Qy()?.style?.mergeClasses?.(a,n)??`${a} ${n}`;return h.jsxs(I,{className:l,style:r,id:o,...i,children:[h.jsxs(I,{children:[e&&h.jsx(or,{className:"text-base font-semibold text-gray-900 dark:text-white",children:e}),t&&h.jsx(yt,{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:t})]}),s&&h.jsx(I,{className:"flex items-center gap-2",children:s})]})},ar=(e,t)=>window.G7Core?.t?.(e,t)??e,Ry=({image:e,imageAlt:t,vendor:n,name:r,version:s,status:o,updateAvailable:i=!1,latestVersion:a,dependencies:l=[],showLayoutEditButton:c=!1,actions:d=[],onLayoutEditClick:u,className:f="",id:g,editorAttrs:m})=>{const p=b=>({active:"success",inactive:"default",pending:"pending",error:"error"})[b],y=b=>({active:ar("common.status_active"),inactive:ar("common.status_inactive"),pending:ar("common.status_pending"),error:ar("common.status_error")})[b];return h.jsxs(I,{className:`
|
||
bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden hover:shadow-lg transition-shadow
|
||
${f}
|
||
`,id:g,...m,children:[e&&h.jsxs(I,{className:"relative",children:[h.jsx(Sn,{src:e,alt:t||ar("common.template_preview",{vendor:n,name:r}),className:"w-full h-48 object-cover"}),h.jsx(I,{className:"absolute top-3 right-3",children:h.jsx(Xo,{status:p(o),label:y(o),showIcon:!0})}),i&&h.jsx(I,{className:"absolute top-3 left-3",children:h.jsxs(J,{className:"flex items-center gap-1 px-2 py-1 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border border-yellow-200 dark:border-yellow-800 rounded-md text-xs font-semibold",children:[h.jsx(oe,{name:ue.ExclamationTriangle,className:"w-3 h-3"}),h.jsx(J,{children:ar("common.update_available")})]})})]}),h.jsxs(I,{className:"p-4",children:[h.jsxs(I,{className:"flex items-start justify-between mb-3",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(jr,{className:"text-lg font-bold text-gray-900 dark:text-white",children:[n,"/",r]}),h.jsxs(I,{className:"flex items-center gap-2 mt-1 text-sm text-gray-600 dark:text-gray-400",children:[h.jsxs(J,{children:["v",s]}),i&&a&&h.jsxs(h.Fragment,{children:[h.jsx(J,{children:"→"}),h.jsxs(J,{className:"text-yellow-600 dark:text-yellow-400 font-semibold",children:["v",a]})]})]}),!e&&h.jsx(I,{className:"mt-2",children:h.jsx(Xo,{status:p(o),label:y(o),showIcon:!0})})]}),d.length>0&&h.jsx(Ls,{items:d,triggerIconName:ue.EllipsisVertical,position:"left"})]}),l.length>0&&h.jsxs(I,{className:"mb-3",children:[h.jsxs(yt,{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:[ar("common.dependencies"),":"]}),h.jsx(I,{className:"flex flex-wrap gap-1",children:l.map((b,_)=>h.jsx(J,{className:"px-2 py-0.5 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:b},_))})]}),c&&u&&h.jsxs(ae,{onClick:u,className:"w-full px-4 py-2 bg-blue-600 dark:bg-blue-500 text-white rounded-md hover:bg-blue-700 dark:hover:bg-blue-600 transition-colors flex items-center justify-center gap-2 font-medium",children:[h.jsx(oe,{name:ue.Edit,className:"w-4 h-4"}),h.jsx(J,{children:ar("common.edit_layout")})]})]})]})},ku=({type:e,message:t,dismissible:n=!1,onDismiss:r,className:s="",id:o,editorAttrs:i})=>{const a={info:{containerClass:"alert-info",iconClass:"alert-icon-info",textClass:"alert-text-info",icon:ue.InfoCircle},success:{containerClass:"alert-success",iconClass:"alert-icon-success",textClass:"alert-text-success",icon:ue.CheckCircle},warning:{containerClass:"alert-warning",iconClass:"alert-icon-warning",textClass:"alert-text-warning",icon:ue.ExclamationTriangle},error:{containerClass:"alert-error",iconClass:"alert-icon-error",textClass:"alert-text-error",icon:ue.TimesCircle}},l=a[e]??a.info;return h.jsxs(I,{className:`${l.containerClass} ${s}`,role:"alert","aria-live":"polite",id:o,...i,children:[h.jsx(oe,{name:l.icon,className:l.iconClass,ariaLabel:`${e} icon`}),h.jsx(yt,{className:l.textClass,children:t}),n&&h.jsx(ae,{onClick:r,className:`alert-dismiss ${l.textClass}`,"aria-label":"Close alert",children:h.jsx(oe,{name:ue.Times,className:l.iconClass,ariaLabel:"Close"})})]})},ev=({layoutName:e,onBack:t,onPreview:n,onSave:r,isSaving:s=!1,className:o=""})=>{const i=`
|
||
flex items-center justify-between gap-4 p-4 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700
|
||
${o}
|
||
`.trim().replace(/\s+/g," ");return h.jsxs(I,{className:i,children:[h.jsxs(I,{className:"flex items-center gap-3",children:[h.jsx(ae,{onClick:t,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors bg-transparent border-0 cursor-pointer","aria-label":"뒤로가기",children:h.jsx(oe,{name:ue.ArrowLeft,className:"text-gray-700 dark:text-gray-300",ariaLabel:"뒤로가기"})}),h.jsx(or,{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:e})]}),h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(ae,{onClick:n,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors border-0 cursor-pointer","aria-label":"미리보기",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(oe,{name:ue.Eye,className:"text-gray-700 dark:text-gray-300",ariaLabel:"미리보기 아이콘"}),h.jsx("span",{children:"미리보기"})]})}),h.jsx(ae,{onClick:r,disabled:s,className:`
|
||
px-4 py-2 rounded-lg transition-colors border-0 cursor-pointer
|
||
${s?"bg-blue-400 dark:bg-blue-600 cursor-not-allowed":"bg-blue-600 dark:bg-blue-500 hover:bg-blue-700 dark:hover:bg-blue-600"}
|
||
text-white
|
||
`.trim().replace(/\s+/g," "),"aria-label":s?"저장 중...":"저장",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(oe,{name:s?ue.Spinner:ue.Save,className:`text-white ${s?"animate-spin":""}`,ariaLabel:s?"저장 중 아이콘":"저장 아이콘"}),h.jsx("span",{children:s?"저장 중...":"저장"})]})})]})]})},tv=({files:e,selectedId:t,onSelect:n,className:r=""})=>{const s=a=>{try{const l=new Date(a);if(isNaN(l.getTime()))return a;const c=l.getFullYear(),d=String(l.getMonth()+1).padStart(2,"0"),u=String(l.getDate()).padStart(2,"0"),f=String(l.getHours()).padStart(2,"0"),g=String(l.getMinutes()).padStart(2,"0");return`${c}-${d}-${u} ${f}:${g}`}catch{return a}},o=a=>{n(a)},i=`
|
||
w-full
|
||
${r}
|
||
`.trim().replace(/\s+/g," ");return h.jsx(I,{className:i,children:e.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"파일이 없습니다."}):h.jsx(ja,{className:"divide-y divide-gray-200 dark:divide-gray-700",role:"listbox","aria-label":"레이아웃 파일 목록",children:e.map(a=>{const l=a.id===t,c=`
|
||
flex items-center justify-between p-4 cursor-pointer
|
||
transition-colors duration-150
|
||
${l?"bg-blue-100 dark:bg-blue-900 border-l-4 border-blue-500":"hover:bg-gray-100 dark:hover:bg-gray-800"}
|
||
`.trim().replace(/\s+/g," "),d=`
|
||
font-medium
|
||
${l?"text-blue-900 dark:text-blue-100":"text-gray-900 dark:text-gray-100"}
|
||
`.trim().replace(/\s+/g," "),u=`
|
||
text-sm
|
||
${l?"text-blue-700 dark:text-blue-300":"text-gray-500 dark:text-gray-400"}
|
||
`.trim().replace(/\s+/g," ");return h.jsx(Wa,{className:c,onClick:()=>o(a.id),role:"option","aria-selected":l,tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o(a.id))},children:h.jsxs(I,{className:"flex flex-col gap-1",children:[h.jsx(J,{className:d,children:a.name}),h.jsx(J,{className:u,children:s(a.updated_at)})]})},a.id)})})})};function Cu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nv(e){if(Array.isArray(e))return e}function rv(e,t,n){return(t=dv(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sv(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,a=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(d){c=!0,s=d}finally{try{if(!l&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw s}}return a}}function ov(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function _u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Su(Object(n),!0).forEach(function(r){rv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function iv(e,t){if(e==null)return{};var n,r,s=av(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function av(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function lv(e,t){return nv(e)||sv(e,t)||uv(e,t)||ov()}function cv(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dv(e){var t=cv(e,"string");return typeof t=="symbol"?t:t+""}function uv(e,t){if(e){if(typeof e=="string")return Cu(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cu(e,t):void 0}}function fv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Mu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Eu(Object(n),!0).forEach(function(r){fv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hv(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(s,o){return o(s)},r)}}function Vs(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return s.length>=e.length?e.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return t.apply(n,[].concat(s,a))}}}function Jo(e){return{}.toString.call(e).includes("Object")}function gv(e){return!Object.keys(e).length}function Hs(e){return typeof e=="function"}function pv(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function mv(e,t){return Jo(t)||lr("changeType"),Object.keys(t).some(function(n){return!pv(e,n)})&&lr("changeField"),t}function bv(e){Hs(e)||lr("selectorType")}function yv(e){Hs(e)||Jo(e)||lr("handlerType"),Jo(e)&&Object.values(e).some(function(t){return!Hs(t)})&&lr("handlersType")}function vv(e){e||lr("initialIsRequired"),Jo(e)||lr("initialType"),gv(e)&&lr("initialContent")}function xv(e,t){throw new Error(e[t]||e.default)}var wv={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},lr=Vs(xv)(wv),Ro={changes:mv,selector:bv,handler:yv,initial:vv};function kv(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ro.initial(e),Ro.handler(t);var n={current:e},r=Vs(_v)(n,t),s=Vs(Sv)(n),o=Vs(Ro.changes)(e),i=Vs(Cv)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Ro.selector(c),c(n.current)}function l(c){hv(r,s,o,i)(c)}return[a,l]}function Cv(e,t){return Hs(t)?t(e.current):t}function Sv(e,t){return e.current=Mu(Mu({},e.current),t),t}function _v(e,t,n){return Hs(t)?t(e.current):Object.keys(n).forEach(function(r){var s;return(s=t[r])===null||s===void 0?void 0:s.call(t,e.current[r])}),n}var Ev={create:kv},Mv={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Nv(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return s.length>=e.length?e.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return t.apply(n,[].concat(s,a))}}}function Tv(e){return{}.toString.call(e).includes("Object")}function Ov(e){return e||Tu("configIsRequired"),Tv(e)||Tu("configType"),e.urls?(Av(),{paths:{vs:e.urls.monacoBase}}):e}function Av(){console.warn(Nu.deprecation)}function Dv(e,t){throw new Error(e[t]||e.default)}var Nu={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
||
You are using deprecated way of configuration.
|
||
|
||
Instead of using
|
||
monaco.config({ urls: { monacoBase: '...' } })
|
||
use
|
||
monaco.config({ paths: { vs: '...' } })
|
||
|
||
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
||
`},Tu=Nv(Dv)(Nu),Iv={config:Ov},Lv=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(s){return n.reduceRight(function(o,i){return i(o)},s)}};function Ou(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],Ou(e[n],t[n]))}),_u(_u({},e),t)}var Pv={type:"cancelation",msg:"operation is manually canceled"};function gl(e){var t=!1,n=new Promise(function(r,s){e.then(function(o){return t?s(Pv):r(o)}),e.catch(s)});return n.cancel=function(){return t=!0},n}var $v=["monaco"],Fv=Ev.create({config:Mv,isInitialized:!1,resolve:null,reject:null,monaco:null}),Au=lv(Fv,2),Us=Au[0],ei=Au[1];function zv(e){var t=Iv.config(e),n=t.monaco,r=iv(t,$v);ei(function(s){return{config:Ou(s.config,r),monaco:n}})}function Vv(){var e=Us(function(t){var n=t.monaco,r=t.isInitialized,s=t.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!e.isInitialized){if(ei({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),gl(pl);if(window.monaco&&window.monaco.editor)return Du(window.monaco),e.resolve(window.monaco),gl(pl);Lv(Hv,Bv)(jv)}return gl(pl)}function Hv(e){return document.body.appendChild(e)}function Uv(e){var t=document.createElement("script");return e&&(t.src=e),t}function Bv(e){var t=Us(function(r){var s=r.config,o=r.reject;return{config:s,reject:o}}),n=Uv("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function jv(){var e=Us(function(n){var r=n.config,s=n.resolve,o=n.reject;return{config:r,resolve:s,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;Du(r),e.resolve(r)},function(n){e.reject(n)})}function Du(e){Us().monaco||ei({monaco:e})}function Wv(){return Us(function(e){var t=e.monaco;return t})}var pl=new Promise(function(e,t){return ei({resolve:e,reject:t})}),Iu={config:zv,init:Vv,__getMonacoInstance:Wv},Gv={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ml=Gv,Yv={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Xv=Yv;function Kv({children:e}){return v.createElement("div",{style:Xv.container},e)}var qv=Kv,Zv=qv;function Qv({width:e,height:t,isEditorReady:n,loading:r,_ref:s,className:o,wrapperProps:i}){return v.createElement("section",{style:{...ml.wrapper,width:e,height:t},...i},!n&&v.createElement(Zv,null,r),v.createElement("div",{ref:s,style:{...ml.fullWidth,...!n&&ml.hide},className:o}))}var Jv=Qv,Lu=v.memo(Jv);function Rv(e){v.useEffect(e,[])}var Pu=Rv;function ex(e,t,n=!0){let r=v.useRef(!0);v.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var cn=ex;function Bs(){}function es(e,t,n,r){return tx(e,r)||nx(e,t,n,r)}function tx(e,t){return e.editor.getModel($u(e,t))}function nx(e,t,n,r){return e.editor.createModel(t,n,r?$u(e,r):void 0)}function $u(e,t){return e.Uri.parse(t)}function rx({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:u={},height:f="100%",width:g="100%",className:m,wrapperProps:p={},beforeMount:y=Bs,onMount:b=Bs}){let[_,x]=v.useState(!1),[M,S]=v.useState(!0),k=v.useRef(null),N=v.useRef(null),C=v.useRef(null),w=v.useRef(b),E=v.useRef(y),A=v.useRef(!1);Pu(()=>{let D=Iu.init();return D.then(O=>(N.current=O)&&S(!1)).catch(O=>O?.type!=="cancelation"&&console.error("Monaco initialization: error:",O)),()=>k.current?$():D.cancel()}),cn(()=>{if(k.current&&N.current){let D=k.current.getOriginalEditor(),O=es(N.current,e||"",r||n||"text",o||"");O!==D.getModel()&&D.setModel(O)}},[o],_),cn(()=>{if(k.current&&N.current){let D=k.current.getModifiedEditor(),O=es(N.current,t||"",s||n||"text",i||"");O!==D.getModel()&&D.setModel(O)}},[i],_),cn(()=>{let D=k.current.getModifiedEditor();D.getOption(N.current.editor.EditorOption.readOnly)?D.setValue(t||""):t!==D.getValue()&&(D.executeEdits("",[{range:D.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),D.pushUndoStop())},[t],_),cn(()=>{k.current?.getModel()?.original.setValue(e||"")},[e],_),cn(()=>{let{original:D,modified:O}=k.current.getModel();N.current.editor.setModelLanguage(D,r||n||"text"),N.current.editor.setModelLanguage(O,s||n||"text")},[n,r,s],_),cn(()=>{N.current?.editor.setTheme(c)},[c],_),cn(()=>{k.current?.updateOptions(u)},[u],_);let P=v.useCallback(()=>{if(!N.current)return;E.current(N.current);let D=es(N.current,e||"",r||n||"text",o||""),O=es(N.current,t||"",s||n||"text",i||"");k.current?.setModel({original:D,modified:O})},[n,t,s,e,r,o,i]),L=v.useCallback(()=>{!A.current&&C.current&&(k.current=N.current.editor.createDiffEditor(C.current,{automaticLayout:!0,...u}),P(),N.current?.editor.setTheme(c),x(!0),A.current=!0)},[u,c,P]);v.useEffect(()=>{_&&w.current(k.current,N.current)},[_]),v.useEffect(()=>{!M&&!_&&L()},[M,_,L]);function $(){let D=k.current?.getModel();a||D?.original?.dispose(),l||D?.modified?.dispose(),k.current?.dispose()}return v.createElement(Lu,{width:g,height:f,isEditorReady:_,loading:d,_ref:C,className:m,wrapperProps:p})}var sx=rx;v.memo(sx);function ox(e){let t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}var ix=ox,ti=new Map;function ax({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:s,path:o,theme:i="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:u=!0,keepCurrentModel:f=!1,width:g="100%",height:m="100%",className:p,wrapperProps:y={},beforeMount:b=Bs,onMount:_=Bs,onChange:x,onValidate:M=Bs}){let[S,k]=v.useState(!1),[N,C]=v.useState(!0),w=v.useRef(null),E=v.useRef(null),A=v.useRef(null),P=v.useRef(_),L=v.useRef(b),$=v.useRef(),D=v.useRef(r),O=ix(o),T=v.useRef(!1),z=v.useRef(!1);Pu(()=>{let G=Iu.init();return G.then(B=>(w.current=B)&&C(!1)).catch(B=>B?.type!=="cancelation"&&console.error("Monaco initialization: error:",B)),()=>E.current?W():G.cancel()}),cn(()=>{let G=es(w.current,e||r||"",t||s||"",o||n||"");G!==E.current?.getModel()&&(u&&ti.set(O,E.current?.saveViewState()),E.current?.setModel(G),u&&E.current?.restoreViewState(ti.get(o)))},[o],S),cn(()=>{E.current?.updateOptions(c)},[c],S),cn(()=>{!E.current||r===void 0||(E.current.getOption(w.current.editor.EditorOption.readOnly)?E.current.setValue(r):r!==E.current.getValue()&&(z.current=!0,E.current.executeEdits("",[{range:E.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),E.current.pushUndoStop(),z.current=!1))},[r],S),cn(()=>{let G=E.current?.getModel();G&&s&&w.current?.editor.setModelLanguage(G,s)},[s],S),cn(()=>{a!==void 0&&E.current?.revealLine(a)},[a],S),cn(()=>{w.current?.editor.setTheme(i)},[i],S);let U=v.useCallback(()=>{if(!(!A.current||!w.current)&&!T.current){L.current(w.current);let G=o||n,B=es(w.current,r||e||"",t||s||"",G||"");E.current=w.current?.editor.create(A.current,{model:B,automaticLayout:!0,...c},d),u&&E.current.restoreViewState(ti.get(G)),w.current.editor.setTheme(i),a!==void 0&&E.current.revealLine(a),k(!0),T.current=!0}},[e,t,n,r,s,o,c,d,u,i,a]);v.useEffect(()=>{S&&P.current(E.current,w.current)},[S]),v.useEffect(()=>{!N&&!S&&U()},[N,S,U]),D.current=r,v.useEffect(()=>{S&&x&&($.current?.dispose(),$.current=E.current?.onDidChangeModelContent(G=>{z.current||x(E.current.getValue(),G)}))},[S,x]),v.useEffect(()=>{if(S){let G=w.current.editor.onDidChangeMarkers(B=>{let j=E.current.getModel()?.uri;if(j&&B.find(Y=>Y.path===j.path)){let Y=w.current.editor.getModelMarkers({resource:j});M?.(Y)}});return()=>{G?.dispose()}}return()=>{}},[S,M]);function W(){$.current?.dispose(),f?u&&ti.set(o,E.current.saveViewState()):E.current.getModel()?.dispose(),E.current.dispose()}return v.createElement(Lu,{width:g,height:m,isEditorReady:S,loading:l,_ref:A,className:p,wrapperProps:y})}var lx=ax,cx=v.memo(lx),dx=cx;const ux=({value:e,onChange:t,language:n="json",height:r="100%",readOnly:s=!1,theme:o="vs-dark"})=>{const i=v.useRef(null),a=(c,d)=>{i.current=c,n==="json"&&d.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemaValidation:"error",allowComments:!1}),c.updateOptions({readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0})},l=c=>{t&&c!==void 0&&t({target:{value:c}})};return v.useEffect(()=>{i.current&&i.current.updateOptions({readOnly:s})},[s]),h.jsx("div",{className:"border border-gray-300 dark:border-gray-700 rounded-lg overflow-hidden",children:h.jsx(dx,{height:r,language:n,value:e,theme:o,onChange:l,onMount:a,options:{readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0}})})},fx=e=>{const t=new Date(e);return new Intl.DateTimeFormat("ko-KR",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)},Fu=v.memo(({version:e,isSelected:t,onSelect:n})=>{const r=v.useCallback(()=>{n?.(e.id)},[n,e.id]);return h.jsx(Wa,{role:"listitem","aria-selected":t,className:`
|
||
p-3 rounded-lg border cursor-pointer transition-colors
|
||
${t?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 hover:border-gray-400 dark:border-gray-600 dark:hover:border-gray-500"}
|
||
`,onClick:r,children:h.jsxs(I,{className:"flex justify-between items-start",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(J,{className:"font-semibold text-gray-900 dark:text-gray-100",children:["버전 ",e.version]}),h.jsx(J,{className:"ml-2 text-sm text-gray-500 dark:text-gray-400",children:fx(e.created_at)})]}),h.jsxs(I,{className:"flex gap-3 text-sm",children:[h.jsxs(J,{className:"text-green-600 dark:text-green-400",children:["+",e.changes_summary.added]}),h.jsxs(J,{className:"text-red-600 dark:text-red-400",children:["-",e.changes_summary.removed]})]})]})})});Fu.displayName="VersionListItem";const zu=({versions:e,selectedId:t,onSelect:n})=>e.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"버전이 없습니다."}):h.jsx(ja,{role:"list",className:"space-y-2",children:e.map(r=>h.jsx(Fu,{version:r,isSelected:t===r.id,onSelect:n},r.id))}),hx=({layoutId:e,versions:t,onRestore:n})=>{const[r,s]=v.useState(),o=l=>{s(l)},i=()=>{r!==void 0&&n(r)},a=r===void 0;return h.jsxs(I,{className:"space-y-4",role:"region","aria-label":"레이아웃 히스토리 패널",children:[h.jsx(I,{className:"border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:h.jsx(zu,{versions:t,selectedId:r,onSelect:o})}),h.jsx(I,{className:"flex justify-end",children:h.jsx(ae,{variant:"primary",disabled:a,onClick:i,"aria-label":"선택한 버전으로 복원",children:"복원"})})]})},gx=({emailLabel:e="Email",passwordLabel:t="Password",submitButtonText:n="Sign In",processingText:r="Processing...",emailPlaceholder:s="Email",passwordPlaceholder:o="Password",forgotPasswordText:i="Forgot your password?",forgotPasswordUrl:a="/admin/password/reset",emailRequiredError:l="Please enter your email.",emailInvalidError:c="Please enter a valid email address.",passwordRequiredError:d="Please enter your password.",onSubmit:u,loadingActions:f={},isLoading:g=!1,disabled:m=!1,apiError:p="",className:y="",style:b})=>{const[_,x]=v.useState(""),[M,S]=v.useState(""),[k,N]=v.useState({}),C=p,w=Object.values(f).some($=>$===!0),E=g||w,A=m||E,P=()=>{const $={},D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!_||_.trim()===""?$.email=l:D.test(_)||($.email=c),(!M||M.trim()==="")&&($.password=d),N($),Object.keys($).length===0},L=async $=>{if(!P()){$.preventDefault();return}N({}),u?await u($):$.preventDefault()};return h.jsx(I,{className:`w-full ${y}`,style:b,children:h.jsxs(Ga,{onSubmit:L,className:"space-y-6",noValidate:!0,children:[C&&h.jsx(I,{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:h.jsx(yt,{className:"text-sm text-red-600 dark:text-red-400",children:C})}),h.jsxs(I,{children:[h.jsx(ln,{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:e}),h.jsx(kt,{id:"email",name:"email",type:"email",value:_,onChange:$=>x($.target.value),placeholder:s,disabled:A,className:`
|
||
w-full px-4 py-3 rounded-lg border
|
||
${k.email?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"}
|
||
bg-white dark:bg-gray-800
|
||
text-gray-900 dark:text-white
|
||
placeholder-gray-400 dark:placeholder-gray-500
|
||
focus:outline-none focus:ring-2
|
||
disabled:opacity-50 disabled:cursor-not-allowed
|
||
transition-colors duration-200
|
||
`}),k.email&&h.jsx(yt,{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:k.email})]}),h.jsxs(I,{children:[h.jsx(ln,{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t}),h.jsx(kt,{id:"password",name:"password",type:"password",value:M,onChange:$=>S($.target.value),placeholder:o,disabled:A,className:`
|
||
w-full px-4 py-3 rounded-lg border
|
||
${k.password?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"}
|
||
bg-white dark:bg-gray-800
|
||
text-gray-900 dark:text-white
|
||
placeholder-gray-400 dark:placeholder-gray-500
|
||
focus:outline-none focus:ring-2
|
||
disabled:opacity-50 disabled:cursor-not-allowed
|
||
transition-colors duration-200
|
||
`}),k.password&&h.jsx(yt,{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:k.password})]}),a&&h.jsx(I,{className:"flex items-center justify-end",children:h.jsx(Wr,{href:a,className:"text-sm text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300 transition-colors duration-200",children:i})}),h.jsx(ae,{type:"submit",disabled:A,className:`
|
||
w-full px-4 py-3 rounded-lg font-medium
|
||
bg-blue-600 hover:bg-blue-700
|
||
dark:bg-blue-500 dark:hover:bg-blue-600
|
||
text-white
|
||
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
|
||
dark:focus:ring-offset-gray-900
|
||
disabled:opacity-50 disabled:cursor-not-allowed
|
||
transition-colors duration-200
|
||
flex items-center justify-center
|
||
`,children:E?h.jsxs(h.Fragment,{children:[h.jsxs(Xn,{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r]}):n})]})})},Vu=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,bl=e=>{const t=Vu(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},px=()=>{const e=localStorage.getItem("g7_color_scheme");return e&&["auto","light","dark"].includes(e)?e:"auto"},mx=({onThemeChange:e,className:t="",autoText:n="System",lightText:r="Light",darkText:s="Dark",id:o,editorAttrs:i})=>{const a=px(),[l,c]=v.useState(a),[d,u]=v.useState(!1),f=v.useRef(null);v.useEffect(()=>{bl(l)},[]),v.useEffect(()=>{if(l!=="auto")return;const p=window.matchMedia("(prefers-color-scheme: dark)"),y=()=>{bl("auto")};return p.addEventListener("change",y),()=>p.removeEventListener("change",y)},[l]),v.useEffect(()=>{const p=y=>{f.current&&!f.current.contains(y.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const g=p=>{c(p),localStorage.setItem("g7_color_scheme",p),bl(p),u(!1),e?.(p)},m=()=>Vu(l)==="dark"?ue.Moon:ue.Sun;return h.jsxs(I,{ref:f,className:`relative ${t}`,id:o,...i,children:[h.jsx(ae,{onClick:()=>u(!d),className:"w-9 h-9 flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-full transition-colors","aria-label":"Toggle theme",children:h.jsx(oe,{name:m(),className:"text-sm text-slate-500 dark:text-slate-400"})}),d&&h.jsx(I,{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:h.jsxs(I,{className:"py-2",children:[h.jsxs(ae,{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
|
||
${l==="auto"?"bg-gray-50 dark:bg-gray-700":""}
|
||
`,children:[h.jsx(oe,{name:ue.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),l==="auto"&&h.jsx(oe,{name:ue.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(ae,{onClick:()=>g("light"),className:`
|
||
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
|
||
${l==="light"?"bg-gray-50 dark:bg-gray-700":""}
|
||
`,children:[h.jsx(oe,{name:ue.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),l==="light"&&h.jsx(oe,{name:ue.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(ae,{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
|
||
${l==="dark"?"bg-gray-50 dark:bg-gray-700":""}
|
||
`,children:[h.jsx(oe,{name:ue.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"flex-1 text-left text-gray-900 dark:text-white",children:s}),l==="dark"&&h.jsx(oe,{name:ue.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Hu=window.G7Core?.createLogger?.("Comp:ColumnSelector")??{log:(...e)=>console.log("[Comp:ColumnSelector]",...e),warn:(...e)=>console.warn("[Comp:ColumnSelector]",...e),error:(...e)=>console.error("[Comp:ColumnSelector]",...e)},Uu=(e,t)=>window.G7Core?.t?.(e,t)??e,bx=()=>window.G7Core,yx=({id:e,columns:t,visibleColumns:n,onColumnVisibilityChange:r,triggerLabel:s,triggerIconName:o=ue.Sliders,position:i="right",className:a="",style:l,requiredText:c,menuTitle:d,menuDescription:u,defaultColumns:f,triggerClassName:g,labelClassName:m,dynamicColumns:p,dynamicColumnsInsertAfter:y,editorAttrs:b})=>{const _=s??Uu("common.column_selector"),x=c??Uu("common.required"),M=v.useMemo(()=>{if(!p||!Array.isArray(p)||p.length===0)return t;if(y){const V=t.findIndex(X=>X.field===y);if(V!==-1)return[...t.slice(0,V+1),...p,...t.slice(V+1)]}return[...t,...p]},[t,p,y]),[S,k]=v.useState(!1),N=v.useRef(null),C=v.useRef(null),[w,E]=v.useState(!1),[A,P]=v.useState(i),L=v.useMemo(()=>{try{const V=window.G7Core?.AuthManager?.getInstance();return V?V.getUser()?.uuid:void 0}catch{return}},[]),$=e?`g7_columns_${e}${L!==void 0?`_${L}`:""}`:null,D=()=>{if(!$)return null;try{const V=localStorage.getItem($);if(V){const X=JSON.parse(V);if(Array.isArray(X)&&X.length>0)return X}}catch(V){Hu.warn("Failed to load from localStorage:",V)}return null},O=V=>{if($)try{localStorage.setItem($,JSON.stringify(V))}catch(X){Hu.warn("Failed to save to localStorage:",X)}},T=()=>{const V=D();return V||(n&&n.length>0?n:f&&f.length>0?f:M.filter(X=>X.visible!==!1).map(X=>X.field))},[z,U]=v.useState(T);v.useEffect(()=>{w||(r&&z.length>0&&r(z),E(!0))},[w,r,z]),v.useEffect(()=>{w&&n&&n.length>0&&(D()||U(n))},[n,w]);const W=v.useRef([]),G=v.useRef(null);v.useEffect(()=>{if(w&&p&&p.length>0){const V=p.map(q=>q.field);if(G.current===null){const q=D();if(G.current=q!==null,q!==null){W.current=V;return}}const X=W.current,K=V.filter(q=>!X.includes(q));if(K.length>0){const q=n&&n.length>0?n:z,ne=K.filter(te=>!q.includes(te));if(ne.length>0){const te=[...q,...ne];U(te),O(te),r?.(te)}}W.current=V}},[p,w]);const B=n&&n.length>0?n:z;v.useEffect(()=>{const V=X=>{N.current&&!N.current.contains(X.target)&&k(!1)};return S&&document.addEventListener("mousedown",V),()=>{document.removeEventListener("mousedown",V)}},[S]),v.useEffect(()=>{if(S&&C.current&&N.current){const V=C.current.getBoundingClientRect(),X=N.current.getBoundingClientRect(),K=window.innerWidth,q=V.width||256;i==="right"?X.right-q<0?P("left"):P("right"):X.left+q>K?P("right"):P("left")}},[S,i]);const j=V=>{if(M.find(q=>q.field===V)?.required)return;const K=B.includes(V)?B.filter(q=>q!==V):[...B,V];U(K),O(K),r?.(K)},Y=A==="left"?"left-0":"right-0";return h.jsxs(I,{ref:N,className:`relative inline-block ${a}`,style:l,id:e,...b,children:[h.jsxs(ae,{onClick:()=>k(!S),className:bx()?.style?.mergeClasses?.("flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",g)??`flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors ${g??""}`,children:[h.jsx(oe,{name:o,className:"w-5 h-5"}),_&&h.jsx(J,{className:`${m||"hidden sm:inline"} text-sm`,children:_})]}),S&&h.jsxs(I,{ref:C,className:`absolute ${Y} z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg`,children:[(d||u)&&h.jsxs(I,{className:"px-4 pt-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:[d&&h.jsx(J,{className:"block text-sm font-medium text-gray-900 dark:text-white",children:d}),u&&h.jsx(J,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-1",children:u})]}),h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:M.map(V=>{const X=B.includes(V.field),K=V.required===!0;return h.jsxs(I,{onClick:()=>!K&&j(V.field),className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${K?"cursor-default":"cursor-pointer"}`,children:[h.jsx(_n,{checked:X,disabled:K,readOnly:!0,className:"h-4 w-4 text-blue-600 rounded border-gray-300 dark:border-gray-600 pointer-events-none"}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300",children:V.header}),K&&x&&h.jsx(J,{className:"ml-auto text-xs text-gray-400 dark:text-gray-500",children:x})]},V.field)})})]})]})},vx=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...e)=>console.log("[Comp:PageTransition]",...e),warn:(...e)=>console.warn("[Comp:PageTransition]",...e),error:(...e)=>console.error("[Comp:PageTransition]",...e)},xx=({className:e="",style:t})=>{const[n,r]=v.useState(!1);return v.useEffect(()=>{const s=window.G7Core?.TransitionManager;if(!s){vx.warn("TransitionManager를 찾을 수 없습니다.");return}return r(s.getIsPending()),s.subscribe(i=>{r(i)})},[]),n?h.jsxs(I,{className:`fixed top-0 left-0 right-0 z-[999] ${e}`,style:t,role:"progressbar","aria-label":"페이지 로딩 중",children:[h.jsx(I,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:h.jsx(I,{className:"h-full bg-blue-700 animate-[loading_1.5s_ease-in-out_infinite]",style:{width:"30%",animation:"loading 1.5s ease-in-out infinite"}})}),h.jsx("style",{children:`
|
||
@keyframes loading {
|
||
0% {
|
||
transform: translateX(-100%);
|
||
}
|
||
50% {
|
||
transform: translateX(300%);
|
||
}
|
||
100% {
|
||
transform: translateX(-100%);
|
||
}
|
||
}
|
||
`})]}):null},wx=(e,t)=>window.G7Core?.t?.(e,t)??e,kx=({options:e})=>{const t=document.documentElement.classList.contains("dark"),n=t?"rgb(17,24,39)":"rgb(249,250,251)",r=t?"#6b7280":"#9ca3af",s=t?"#9ca3af":"#6b7280";return h.jsxs("div",{style:{position:"absolute",inset:0,zIndex:2147483647,overflow:"hidden",background:n,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",paddingTop:"15%",gap:"12px"},children:[h.jsx("div",{style:{width:"32px",height:"32px",border:`3px solid ${r}`,borderTopColor:"transparent",borderRadius:"50%",animation:"g7-spin 0.8s linear infinite"}}),h.jsx("span",{style:{color:s,fontSize:"14px"},children:e?.text||wx("nav.loading")})]})};function kr(e){"@babel/helpers - typeof";return kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(e)}function Cx(e,t){if(kr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(kr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bu(e){var t=Cx(e,"string");return kr(t)=="symbol"?t:t+""}function js(e,t,n){return(t=Bu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Se(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ju(Object(n),!0).forEach(function(r){js(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Sx(e){if(Array.isArray(e))return e}function _x(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,a=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(d){c=!0,s=d}finally{try{if(!l&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw s}}return a}}function yl(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Wu(e,t){if(e){if(typeof e=="string")return yl(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yl(e,t):void 0}}function Ex(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kn(e,t){return Sx(e)||_x(e,t)||Wu(e,t)||Ex()}function Mx(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Fn(e,t){if(e==null)return{};var n,r,s=Mx(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var Nx=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function Gu(e){var t=e.defaultInputValue,n=t===void 0?"":t,r=e.defaultMenuIsOpen,s=r===void 0?!1:r,o=e.defaultValue,i=o===void 0?null:o,a=e.inputValue,l=e.menuIsOpen,c=e.onChange,d=e.onInputChange,u=e.onMenuClose,f=e.onMenuOpen,g=e.value,m=Fn(e,Nx),p=v.useState(a!==void 0?a:n),y=Kn(p,2),b=y[0],_=y[1],x=v.useState(l!==void 0?l:s),M=Kn(x,2),S=M[0],k=M[1],N=v.useState(g!==void 0?g:i),C=Kn(N,2),w=C[0],E=C[1],A=v.useCallback(function(z,U){typeof c=="function"&&c(z,U),E(z)},[c]),P=v.useCallback(function(z,U){var W;typeof d=="function"&&(W=d(z,U)),_(W!==void 0?W:z)},[d]),L=v.useCallback(function(){typeof f=="function"&&f(),k(!0)},[f]),$=v.useCallback(function(){typeof u=="function"&&u(),k(!1)},[u]),D=a!==void 0?a:b,O=l!==void 0?l:S,T=g!==void 0?g:w;return Se(Se({},m),{},{inputValue:D,menuIsOpen:O,onChange:A,onInputChange:P,onMenuClose:$,onMenuOpen:L,value:T})}function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Oe.apply(null,arguments)}function Tx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Bu(r.key),r)}}function Ox(e,t,n){return t&&Yu(e.prototype,t),n&&Yu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function vl(e,t){return vl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},vl(e,t)}function Ax(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&vl(e,t)}function ni(e){return ni=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ni(e)}function Xu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xu=function(){return!!e})()}function Dx(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ix(e,t){if(t&&(kr(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Dx(e)}function Lx(e){var t=Xu();return function(){var n,r=ni(e);if(t){var s=ni(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return Ix(this,n)}}function Px(e){if(Array.isArray(e))return yl(e)}function $x(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Fx(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ts(e){return Px(e)||$x(e)||Wu(e)||Fx()}function zx(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function Vx(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var Hx=(function(){function e(n){var r=this;this._insertTag=function(s){var o;r.tags.length===0?r.insertionPoint?o=r.insertionPoint.nextSibling:r.prepend?o=r.container.firstChild:o=r.before:o=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(s,o),r.tags.push(s)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Vx(this));var s=this.tags[this.tags.length-1];if(this.isSpeedy){var o=zx(s);try{o.insertRule(r,o.cssRules.length)}catch{}}else s.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var s;return(s=r.parentNode)==null?void 0:s.removeChild(r)}),this.tags=[],this.ctr=0},e})(),Ht="-ms-",ri="-moz-",Re="-webkit-",Ku="comm",xl="rule",wl="decl",Ux="@import",qu="@keyframes",Bx="@layer",jx=Math.abs,si=String.fromCharCode,Wx=Object.assign;function Gx(e,t){return Ft(e,0)^45?(((t<<2^Ft(e,0))<<2^Ft(e,1))<<2^Ft(e,2))<<2^Ft(e,3):0}function Zu(e){return e.trim()}function Yx(e,t){return(e=t.exec(e))?e[0]:e}function et(e,t,n){return e.replace(t,n)}function kl(e,t){return e.indexOf(t)}function Ft(e,t){return e.charCodeAt(t)|0}function Ws(e,t,n){return e.slice(t,n)}function zn(e){return e.length}function Cl(e){return e.length}function oi(e,t){return t.push(e),e}function Xx(e,t){return e.map(t).join("")}var ii=1,ns=1,Qu=0,Rt=0,St=0,rs="";function ai(e,t,n,r,s,o,i){return{value:e,root:t,parent:n,type:r,props:s,children:o,line:ii,column:ns,length:i,return:""}}function Gs(e,t){return Wx(ai("",null,null,"",null,null,0),e,{length:-e.length},t)}function Kx(){return St}function qx(){return St=Rt>0?Ft(rs,--Rt):0,ns--,St===10&&(ns=1,ii--),St}function dn(){return St=Rt<Qu?Ft(rs,Rt++):0,ns++,St===10&&(ns=1,ii++),St}function Vn(){return Ft(rs,Rt)}function li(){return Rt}function Ys(e,t){return Ws(rs,e,t)}function Xs(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Ju(e){return ii=ns=1,Qu=zn(rs=e),Rt=0,[]}function Ru(e){return rs="",e}function ci(e){return Zu(Ys(Rt-1,Sl(e===91?e+2:e===40?e+1:e)))}function Zx(e){for(;(St=Vn())&&St<33;)dn();return Xs(e)>2||Xs(St)>3?"":" "}function Qx(e,t){for(;--t&&dn()&&!(St<48||St>102||St>57&&St<65||St>70&&St<97););return Ys(e,li()+(t<6&&Vn()==32&&dn()==32))}function Sl(e){for(;dn();)switch(St){case e:return Rt;case 34:case 39:e!==34&&e!==39&&Sl(St);break;case 40:e===41&&Sl(e);break;case 92:dn();break}return Rt}function Jx(e,t){for(;dn()&&e+St!==57;)if(e+St===84&&Vn()===47)break;return"/*"+Ys(t,Rt-1)+"*"+si(e===47?e:dn())}function Rx(e){for(;!Xs(Vn());)dn();return Ys(e,Rt)}function ew(e){return Ru(di("",null,null,null,[""],e=Ju(e),0,[0],e))}function di(e,t,n,r,s,o,i,a,l){for(var c=0,d=0,u=i,f=0,g=0,m=0,p=1,y=1,b=1,_=0,x="",M=s,S=o,k=r,N=x;y;)switch(m=_,_=dn()){case 40:if(m!=108&&Ft(N,u-1)==58){kl(N+=et(ci(_),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:N+=ci(_);break;case 9:case 10:case 13:case 32:N+=Zx(m);break;case 92:N+=Qx(li()-1,7);continue;case 47:switch(Vn()){case 42:case 47:oi(tw(Jx(dn(),li()),t,n),l);break;default:N+="/"}break;case 123*p:a[c++]=zn(N)*b;case 125*p:case 59:case 0:switch(_){case 0:case 125:y=0;case 59+d:b==-1&&(N=et(N,/\f/g,"")),g>0&&zn(N)-u&&oi(g>32?tf(N+";",r,n,u-1):tf(et(N," ","")+";",r,n,u-2),l);break;case 59:N+=";";default:if(oi(k=ef(N,t,n,c,d,s,a,x,M=[],S=[],u),o),_===123)if(d===0)di(N,t,k,k,M,o,u,a,S);else switch(f===99&&Ft(N,3)===110?100:f){case 100:case 108:case 109:case 115:di(e,k,k,r&&oi(ef(e,k,k,0,0,s,a,x,s,M=[],u),S),s,S,u,a,r?M:S);break;default:di(N,k,k,k,[""],S,0,a,S)}}c=d=g=0,p=b=1,x=N="",u=i;break;case 58:u=1+zn(N),g=m;default:if(p<1){if(_==123)--p;else if(_==125&&p++==0&&qx()==125)continue}switch(N+=si(_),_*p){case 38:b=d>0?1:(N+="\f",-1);break;case 44:a[c++]=(zn(N)-1)*b,b=1;break;case 64:Vn()===45&&(N+=ci(dn())),f=Vn(),d=u=zn(x=N+=Rx(li())),_++;break;case 45:m===45&&zn(N)==2&&(p=0)}}return o}function ef(e,t,n,r,s,o,i,a,l,c,d){for(var u=s-1,f=s===0?o:[""],g=Cl(f),m=0,p=0,y=0;m<r;++m)for(var b=0,_=Ws(e,u+1,u=jx(p=i[m])),x=e;b<g;++b)(x=Zu(p>0?f[b]+" "+_:et(_,/&\f/g,f[b])))&&(l[y++]=x);return ai(e,t,n,s===0?xl:a,l,c,d)}function tw(e,t,n){return ai(e,t,n,Ku,si(Kx()),Ws(e,2,-2),0)}function tf(e,t,n,r){return ai(e,t,n,wl,Ws(e,0,r),Ws(e,r+1,-1),r)}function ss(e,t){for(var n="",r=Cl(e),s=0;s<r;s++)n+=t(e[s],s,e,t)||"";return n}function nw(e,t,n,r){switch(e.type){case Bx:if(e.children.length)break;case Ux:case wl:return e.return=e.return||e.value;case Ku:return"";case qu:return e.return=e.value+"{"+ss(e.children,r)+"}";case xl:e.value=e.props.join(",")}return zn(n=ss(e.children,r))?e.return=e.value+"{"+n+"}":""}function rw(e){var t=Cl(e);return function(n,r,s,o){for(var i="",a=0;a<t;a++)i+=e[a](n,r,s,o)||"";return i}}function sw(e){return function(t){t.root||(t=t.return)&&e(t)}}function ow(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var iw=function(t,n,r){for(var s=0,o=0;s=o,o=Vn(),s===38&&o===12&&(n[r]=1),!Xs(o);)dn();return Ys(t,Rt)},aw=function(t,n){var r=-1,s=44;do switch(Xs(s)){case 0:s===38&&Vn()===12&&(n[r]=1),t[r]+=iw(Rt-1,n,r);break;case 2:t[r]+=ci(s);break;case 4:if(s===44){t[++r]=Vn()===58?"&\f":"",n[r]=t[r].length;break}default:t[r]+=si(s)}while(s=dn());return t},lw=function(t,n){return Ru(aw(Ju(t),n))},nf=new WeakMap,cw=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,r=t.parent,s=t.column===r.column&&t.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!nf.get(r))&&!s){nf.set(t,!0);for(var o=[],i=lw(n,o),a=r.props,l=0,c=0;l<i.length;l++)for(var d=0;d<a.length;d++,c++)t.props[c]=o[l]?i[l].replace(/&\f/g,a[d]):a[d]+" "+i[l]}}},dw=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function rf(e,t){switch(Gx(e,t)){case 5103:return Re+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Re+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Re+e+ri+e+Ht+e+e;case 6828:case 4268:return Re+e+Ht+e+e;case 6165:return Re+e+Ht+"flex-"+e+e;case 5187:return Re+e+et(e,/(\w+).+(:[^]+)/,Re+"box-$1$2"+Ht+"flex-$1$2")+e;case 5443:return Re+e+Ht+"flex-item-"+et(e,/flex-|-self/,"")+e;case 4675:return Re+e+Ht+"flex-line-pack"+et(e,/align-content|flex-|-self/,"")+e;case 5548:return Re+e+Ht+et(e,"shrink","negative")+e;case 5292:return Re+e+Ht+et(e,"basis","preferred-size")+e;case 6060:return Re+"box-"+et(e,"-grow","")+Re+e+Ht+et(e,"grow","positive")+e;case 4554:return Re+et(e,/([^-])(transform)/g,"$1"+Re+"$2")+e;case 6187:return et(et(et(e,/(zoom-|grab)/,Re+"$1"),/(image-set)/,Re+"$1"),e,"")+e;case 5495:case 3959:return et(e,/(image-set\([^]*)/,Re+"$1$`$1");case 4968:return et(et(e,/(.+:)(flex-)?(.*)/,Re+"box-pack:$3"+Ht+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Re+e+e;case 4095:case 3583:case 4068:case 2532:return et(e,/(.+)-inline(.+)/,Re+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(zn(e)-1-t>6)switch(Ft(e,t+1)){case 109:if(Ft(e,t+4)!==45)break;case 102:return et(e,/(.+:)(.+)-([^]+)/,"$1"+Re+"$2-$3$1"+ri+(Ft(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~kl(e,"stretch")?rf(et(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ft(e,t+1)!==115)break;case 6444:switch(Ft(e,zn(e)-3-(~kl(e,"!important")&&10))){case 107:return et(e,":",":"+Re)+e;case 101:return et(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Re+(Ft(e,14)===45?"inline-":"")+"box$3$1"+Re+"$2$3$1"+Ht+"$2box$3")+e}break;case 5936:switch(Ft(e,t+11)){case 114:return Re+e+Ht+et(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Re+e+Ht+et(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Re+e+Ht+et(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Re+e+Ht+e+e}return e}var uw=function(t,n,r,s){if(t.length>-1&&!t.return)switch(t.type){case wl:t.return=rf(t.value,t.length);break;case qu:return ss([Gs(t,{value:et(t.value,"@","@"+Re)})],s);case xl:if(t.length)return Xx(t.props,function(o){switch(Yx(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ss([Gs(t,{props:[et(o,/:(read-\w+)/,":"+ri+"$1")]})],s);case"::placeholder":return ss([Gs(t,{props:[et(o,/:(plac\w+)/,":"+Re+"input-$1")]}),Gs(t,{props:[et(o,/:(plac\w+)/,":"+ri+"$1")]}),Gs(t,{props:[et(o,/:(plac\w+)/,Ht+"input-$1")]})],s)}return""})}},fw=[uw],hw=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(p){var y=p.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var s=t.stylisPlugins||fw,o={},i,a=[];i=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(p){for(var y=p.getAttribute("data-emotion").split(" "),b=1;b<y.length;b++)o[y[b]]=!0;a.push(p)});var l,c=[cw,dw];{var d,u=[nw,sw(function(p){d.insert(p)})],f=rw(c.concat(s,u)),g=function(y){return ss(ew(y),f)};l=function(y,b,_,x){d=_,g(y?y+"{"+b.styles+"}":b.styles),x&&(m.inserted[b.name]=!0)}}var m={key:n,sheet:new Hx({key:n,container:i,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return m.sheet.hydrate(a),m},_l={exports:{}},nt={};var sf;function gw(){if(sf)return nt;sf=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,s=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,p=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,_=e?Symbol.for("react.scope"):60119;function x(S){if(typeof S=="object"&&S!==null){var k=S.$$typeof;switch(k){case t:switch(S=S.type,S){case l:case c:case r:case o:case s:case u:return S;default:switch(S=S&&S.$$typeof,S){case a:case d:case m:case g:case i:return S;default:return k}}case n:return k}}}function M(S){return x(S)===c}return nt.AsyncMode=l,nt.ConcurrentMode=c,nt.ContextConsumer=a,nt.ContextProvider=i,nt.Element=t,nt.ForwardRef=d,nt.Fragment=r,nt.Lazy=m,nt.Memo=g,nt.Portal=n,nt.Profiler=o,nt.StrictMode=s,nt.Suspense=u,nt.isAsyncMode=function(S){return M(S)||x(S)===l},nt.isConcurrentMode=M,nt.isContextConsumer=function(S){return x(S)===a},nt.isContextProvider=function(S){return x(S)===i},nt.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===t},nt.isForwardRef=function(S){return x(S)===d},nt.isFragment=function(S){return x(S)===r},nt.isLazy=function(S){return x(S)===m},nt.isMemo=function(S){return x(S)===g},nt.isPortal=function(S){return x(S)===n},nt.isProfiler=function(S){return x(S)===o},nt.isStrictMode=function(S){return x(S)===s},nt.isSuspense=function(S){return x(S)===u},nt.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===c||S===o||S===s||S===u||S===f||typeof S=="object"&&S!==null&&(S.$$typeof===m||S.$$typeof===g||S.$$typeof===i||S.$$typeof===a||S.$$typeof===d||S.$$typeof===y||S.$$typeof===b||S.$$typeof===_||S.$$typeof===p)},nt.typeOf=x,nt}var of;function pw(){return of||(of=1,_l.exports=gw()),_l.exports}var El,af;function mw(){if(af)return El;af=1;var e=pw(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};o[e.ForwardRef]=r,o[e.Memo]=s;function i(m){return e.isMemo(m)?s:o[m.$$typeof]||t}var a=Object.defineProperty,l=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,u=Object.getPrototypeOf,f=Object.prototype;function g(m,p,y){if(typeof p!="string"){if(f){var b=u(p);b&&b!==f&&g(m,b,y)}var _=l(p);c&&(_=_.concat(c(p)));for(var x=i(m),M=i(p),S=0;S<_.length;++S){var k=_[S];if(!n[k]&&!(y&&y[k])&&!(M&&M[k])&&!(x&&x[k])){var N=d(p,k);try{a(m,k,N)}catch{}}}}return m}return El=g,El}mw();var bw=!0;function yw(e,t,n){var r="";return n.split(" ").forEach(function(s){e[s]!==void 0?t.push(e[s]+";"):s&&(r+=s+" ")}),r}var lf=function(t,n,r){var s=t.key+"-"+n.name;(r===!1||bw===!1)&&t.registered[s]===void 0&&(t.registered[s]=n.styles)},vw=function(t,n,r){lf(t,n,r);var s=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+s:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function xw(e){for(var t=0,n,r=0,s=e.length;s>=4;++r,s-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(s){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var ww={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},kw=/[A-Z]|^ms/g,Cw=/_EMO_([^_]+?)_([^]*?)_EMO_/g,cf=function(t){return t.charCodeAt(1)===45},df=function(t){return t!=null&&typeof t!="boolean"},Ml=ow(function(e){return cf(e)?e:e.replace(kw,"-$&").toLowerCase()}),uf=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(Cw,function(r,s,o){return Hn={name:s,styles:o,next:Hn},s})}return ww[t]!==1&&!cf(t)&&typeof n=="number"&&n!==0?n+"px":n};function Ks(e,t,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var s=n;if(s.anim===1)return Hn={name:s.name,styles:s.styles,next:Hn},s.name;var o=n;if(o.styles!==void 0){var i=o.next;if(i!==void 0)for(;i!==void 0;)Hn={name:i.name,styles:i.styles,next:Hn},i=i.next;var a=o.styles+";";return a}return Sw(e,t,n)}case"function":{if(e!==void 0){var l=Hn,c=n(e);return Hn=l,Ks(e,t,c)}break}}var d=n;return d}function Sw(e,t,n){var r="";if(Array.isArray(n))for(var s=0;s<n.length;s++)r+=Ks(e,t,n[s])+";";else for(var o in n){var i=n[o];if(typeof i!="object"){var a=i;df(a)&&(r+=Ml(o)+":"+uf(o,a)+";")}else if(Array.isArray(i)&&typeof i[0]=="string"&&t==null)for(var l=0;l<i.length;l++)df(i[l])&&(r+=Ml(o)+":"+uf(o,i[l])+";");else{var c=Ks(e,t,i);switch(o){case"animation":case"animationName":{r+=Ml(o)+":"+c+";";break}default:r+=o+"{"+c+"}"}}}return r}var ff=/label:\s*([^\s;{]+)\s*(;|$)/g,Hn;function hf(e,t,n){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var r=!0,s="";Hn=void 0;var o=e[0];if(o==null||o.raw===void 0)r=!1,s+=Ks(n,t,o);else{var i=o;s+=i[0]}for(var a=1;a<e.length;a++)if(s+=Ks(n,t,e[a]),r){var l=o;s+=l[a]}ff.lastIndex=0;for(var c="",d;(d=ff.exec(s))!==null;)c+="-"+d[1];var u=xw(s)+c;return{name:u,styles:s,next:Hn}}var _w=function(t){return t()},Ew=F.useInsertionEffect?F.useInsertionEffect:!1,Mw=Ew||_w,gf=F.createContext(typeof HTMLElement<"u"?hw({key:"css"}):null);gf.Provider;var Nw=function(t){return v.forwardRef(function(n,r){var s=v.useContext(gf);return t(n,s,r)})},Tw=F.createContext({}),Nl={}.hasOwnProperty,Tl="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Ow=function(t,n){var r={};for(var s in n)Nl.call(n,s)&&(r[s]=n[s]);return r[Tl]=t,r},Aw=function(t){var n=t.cache,r=t.serialized,s=t.isStringTag;return lf(n,r,s),Mw(function(){return vw(n,r,s)}),null},Dw=Nw(function(e,t,n){var r=e.css;typeof r=="string"&&t.registered[r]!==void 0&&(r=t.registered[r]);var s=e[Tl],o=[r],i="";typeof e.className=="string"?i=yw(t.registered,o,e.className):e.className!=null&&(i=e.className+" ");var a=hf(o,void 0,F.useContext(Tw));i+=t.key+"-"+a.name;var l={};for(var c in e)Nl.call(e,c)&&c!=="css"&&c!==Tl&&(l[c]=e[c]);return l.className=i,n&&(l.ref=n),F.createElement(F.Fragment,null,F.createElement(Aw,{cache:t,serialized:a,isStringTag:typeof s=="string"}),F.createElement(s,l))}),Iw=Dw,Ce=function(t,n){var r=arguments;if(n==null||!Nl.call(n,"css"))return F.createElement.apply(void 0,r);var s=r.length,o=new Array(s);o[0]=Iw,o[1]=Ow(t,n);for(var i=2;i<s;i++)o[i]=r[i];return F.createElement.apply(null,o)};(function(e){var t;t||(t=e.JSX||(e.JSX={}))})(Ce||(Ce={}));function Ol(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return hf(t)}function Lw(){var e=Ol.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}function Pw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const $w=Math.min,Fw=Math.max,ui=Math.round,fi=Math.floor,Al=e=>({x:e,y:e});function zw(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function hi(){return typeof window<"u"}function pf(e){return bf(e)?(e.nodeName||"").toLowerCase():"#document"}function Cr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mf(e){var t;return(t=(bf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bf(e){return hi()?e instanceof Node||e instanceof Cr(e).Node:!1}function Vw(e){return hi()?e instanceof Element||e instanceof Cr(e).Element:!1}function Dl(e){return hi()?e instanceof HTMLElement||e instanceof Cr(e).HTMLElement:!1}function yf(e){return!hi()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Cr(e).ShadowRoot}function vf(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=xf(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Hw(e){return/^(html|body|#document)$/.test(pf(e))}function xf(e){return Cr(e).getComputedStyle(e)}function Uw(e){if(pf(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yf(e)&&e.host||mf(e);return yf(t)?t.host:t}function wf(e){const t=Uw(e);return Hw(t)?(e.ownerDocument||e).body:Dl(t)&&vf(t)?t:wf(t)}function gi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=wf(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Cr(s);if(o){const a=Bw(i);return t.concat(i,i.visualViewport||[],vf(s)?s:[],a&&n?gi(a):[])}else return t.concat(s,gi(s,[],n))}function Bw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jw(e){const t=xf(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Dl(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=ui(n)!==o||ui(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function Il(e){return Vw(e)?e:e.contextElement}function Ww(e){const t=Il(e);if(!Dl(t))return Al(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=jw(t);let i=(o?ui(n.width):n.width)/r,a=(o?ui(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}function kf(e,t,n,r){t===void 0&&(t=!1);const s=e.getBoundingClientRect();Il(e);let o=Al(1);t&&(o=Ww(e));const i=Al(0);let a=(s.left+i.x)/o.x,l=(s.top+i.y)/o.y,c=s.width/o.x,d=s.height/o.y;return zw({width:c,height:d,x:a,y:l})}function Cf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Gw(e,t,n){let r=null,s;const o=mf(e);function i(){var d;clearTimeout(s),(d=r)==null||d.disconnect(),r=null}function a(d,u){d===void 0&&(d=!1),u===void 0&&(u=1),i();const f=e.getBoundingClientRect(),{left:g,top:m,width:p,height:y}=f;if(d||t(),!p||!y)return;const b=fi(m),_=fi(o.clientWidth-(g+p)),x=fi(o.clientHeight-(m+y)),M=fi(g),k={rootMargin:-b+"px "+-_+"px "+-x+"px "+-M+"px",threshold:Fw(0,$w(1,u))||1};let N=!0;function C(w){const E=w[0].intersectionRatio;if(!Cf(f,e.getBoundingClientRect()))return a();if(E!==u){if(!N)return a();E?a(!1,E):s=setTimeout(()=>{a(!1,1e-7)},1e3)}N=!1}try{r=new IntersectionObserver(C,{...k,root:o.ownerDocument})}catch{r=new IntersectionObserver(C,k)}r.observe(e)}const l=Cr(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),i()}}function Yw(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Il(e),d=s||o?[...c?gi(c):[],...t?gi(t):[]]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n),o&&b.addEventListener("resize",n)});const u=c&&a?Gw(c,n,o):null;let f=-1,g=null;i&&(g=new ResizeObserver(b=>{let[_]=b;_&&_.target===c&&g&&t&&(g.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(t)})),n()}),c&&!l&&g.observe(c),t&&g.observe(t));let m,p=l?kf(e):null;l&&y();function y(){const b=kf(e);p&&!Cf(p,b)&&n(),p=b,m=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(_=>{s&&_.removeEventListener("scroll",n),o&&_.removeEventListener("resize",n)}),u?.(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(m)}}var Ll=v.useLayoutEffect,Xw=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],pi=function(){};function Kw(e,t){return t?t[0]==="-"?e+t:e+"__"+t:e}function qw(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];var o=[].concat(r);if(t&&e)for(var i in t)t.hasOwnProperty(i)&&t[i]&&o.push("".concat(Kw(e,i)));return o.filter(function(a){return a}).map(function(a){return String(a).trim()}).join(" ")}var mi=function(t){return s1(t)?t.filter(Boolean):kr(t)==="object"&&t!==null?[t]:[]},Sf=function(t){t.className,t.clearValue,t.cx,t.getStyles,t.getClassNames,t.getValue,t.hasValue,t.isMulti,t.isRtl,t.options,t.selectOption,t.selectProps,t.setValue,t.theme;var n=Fn(t,Xw);return Se({},n)},xt=function(t,n,r){var s=t.cx,o=t.getStyles,i=t.getClassNames,a=t.className;return{css:o(n,t),className:s(r??{},i(n,t),a)}};function bi(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function Zw(e){return bi(e)?window.innerHeight:e.clientHeight}function _f(e){return bi(e)?window.pageYOffset:e.scrollTop}function yi(e,t){if(bi(e)){window.scrollTo(0,t);return}e.scrollTop=t}function Qw(e){var t=getComputedStyle(e),n=t.position==="absolute",r=/(auto|scroll)/;if(t.position==="fixed")return document.documentElement;for(var s=e;s=s.parentElement;)if(t=getComputedStyle(s),!(n&&t.position==="static")&&r.test(t.overflow+t.overflowY+t.overflowX))return s;return document.documentElement}function Jw(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function vi(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:pi,s=_f(e),o=t-s,i=10,a=0;function l(){a+=i;var c=Jw(a,s,o,n);yi(e,c),a<n?window.requestAnimationFrame(l):r(e)}l()}function Ef(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=t.offsetHeight/3;r.bottom+s>n.bottom?yi(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+s,e.scrollHeight)):r.top-s<n.top&&yi(e,Math.max(t.offsetTop-s,0))}function Rw(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}function Mf(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function e1(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var Nf=!1,t1={get passive(){return Nf=!0}},xi=typeof window<"u"?window:{};xi.addEventListener&&xi.removeEventListener&&(xi.addEventListener("p",pi,t1),xi.removeEventListener("p",pi,!1));var n1=Nf;function r1(e){return e!=null}function s1(e){return Array.isArray(e)}function qs(e,t,n){return e?t:n}function cA(e){return e}function dA(e){return e}var o1=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=Object.entries(t).filter(function(i){var a=Kn(i,1),l=a[0];return!r.includes(l)});return o.reduce(function(i,a){var l=Kn(a,2),c=l[0],d=l[1];return i[c]=d,i},{})},i1=["children","innerProps"],a1=["children","innerProps"];function l1(e){var t=e.maxHeight,n=e.menuEl,r=e.minHeight,s=e.placement,o=e.shouldScroll,i=e.isFixedPosition,a=e.controlHeight,l=Qw(n),c={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return c;var d=l.getBoundingClientRect(),u=d.height,f=n.getBoundingClientRect(),g=f.bottom,m=f.height,p=f.top,y=n.offsetParent.getBoundingClientRect(),b=y.top,_=i?window.innerHeight:Zw(l),x=_f(l),M=parseInt(getComputedStyle(n).marginBottom,10),S=parseInt(getComputedStyle(n).marginTop,10),k=b-S,N=_-p,C=k+x,w=u-x-p,E=g-_+x+M,A=x+p-S,P=160;switch(s){case"auto":case"bottom":if(N>=m)return{placement:"bottom",maxHeight:t};if(w>=m&&!i)return o&&vi(l,E,P),{placement:"bottom",maxHeight:t};if(!i&&w>=r||i&&N>=r){o&&vi(l,E,P);var L=i?N-M:w-M;return{placement:"bottom",maxHeight:L}}if(s==="auto"||i){var $=t,D=i?k:C;return D>=r&&($=Math.min(D-M-a,t)),{placement:"top",maxHeight:$}}if(s==="bottom")return o&&yi(l,E),{placement:"bottom",maxHeight:t};break;case"top":if(k>=m)return{placement:"top",maxHeight:t};if(C>=m&&!i)return o&&vi(l,A,P),{placement:"top",maxHeight:t};if(!i&&C>=r||i&&k>=r){var O=t;return(!i&&C>=r||i&&k>=r)&&(O=i?k-S:C-S),o&&vi(l,A,P),{placement:"top",maxHeight:O}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(s,'".'))}return c}function c1(e){var t={bottom:"top",top:"bottom"};return e?t[e]:"bottom"}var Tf=function(t){return t==="auto"?"bottom":t},d1=function(t,n){var r,s=t.placement,o=t.theme,i=o.borderRadius,a=o.spacing,l=o.colors;return Se((r={label:"menu"},js(r,c1(s),"100%"),js(r,"position","absolute"),js(r,"width","100%"),js(r,"zIndex",1),r),n?{}:{backgroundColor:l.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:a.menuGutter,marginTop:a.menuGutter})},Of=v.createContext(null),u1=function(t){var n=t.children,r=t.minMenuHeight,s=t.maxMenuHeight,o=t.menuPlacement,i=t.menuPosition,a=t.menuShouldScrollIntoView,l=t.theme,c=v.useContext(Of)||{},d=c.setPortalPlacement,u=v.useRef(null),f=v.useState(s),g=Kn(f,2),m=g[0],p=g[1],y=v.useState(null),b=Kn(y,2),_=b[0],x=b[1],M=l.spacing.controlHeight;return Ll(function(){var S=u.current;if(S){var k=i==="fixed",N=a&&!k,C=l1({maxHeight:s,menuEl:S,minHeight:r,placement:o,shouldScroll:N,isFixedPosition:k,controlHeight:M});p(C.maxHeight),x(C.placement),d?.(C.placement)}},[s,o,i,a,r,d,M]),n({ref:u,placerProps:Se(Se({},t),{},{placement:_||Tf(o),maxHeight:m})})},f1=function(t){var n=t.children,r=t.innerRef,s=t.innerProps;return Ce("div",Oe({},xt(t,"menu",{menu:!0}),{ref:r},s),n)},h1=f1,g1=function(t,n){var r=t.maxHeight,s=t.theme.spacing.baseUnit;return Se({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},p1=function(t){var n=t.children,r=t.innerProps,s=t.innerRef,o=t.isMulti;return Ce("div",Oe({},xt(t,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:s},r),n)},Af=function(t,n){var r=t.theme,s=r.spacing.baseUnit,o=r.colors;return Se({textAlign:"center"},n?{}:{color:o.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},m1=Af,b1=Af,y1=function(t){var n=t.children,r=n===void 0?"No options":n,s=t.innerProps,o=Fn(t,i1);return Ce("div",Oe({},xt(Se(Se({},o),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},v1=function(t){var n=t.children,r=n===void 0?"Loading...":n,s=t.innerProps,o=Fn(t,a1);return Ce("div",Oe({},xt(Se(Se({},o),{},{children:r,innerProps:s}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),s),r)},x1=function(t){var n=t.rect,r=t.offset,s=t.position;return{left:n.left,position:s,top:r,width:n.width,zIndex:1}},w1=function(t){var n=t.appendTo,r=t.children,s=t.controlElement,o=t.innerProps,i=t.menuPlacement,a=t.menuPosition,l=v.useRef(null),c=v.useRef(null),d=v.useState(Tf(i)),u=Kn(d,2),f=u[0],g=u[1],m=v.useMemo(function(){return{setPortalPlacement:g}},[]),p=v.useState(null),y=Kn(p,2),b=y[0],_=y[1],x=v.useCallback(function(){if(s){var N=Rw(s),C=a==="fixed"?0:window.pageYOffset,w=N[f]+C;(w!==b?.offset||N.left!==b?.rect.left||N.width!==b?.rect.width)&&_({offset:w,rect:N})}},[s,a,f,b?.offset,b?.rect.left,b?.rect.width]);Ll(function(){x()},[x]);var M=v.useCallback(function(){typeof c.current=="function"&&(c.current(),c.current=null),s&&l.current&&(c.current=Yw(s,l.current,x,{elementResize:"ResizeObserver"in window}))},[s,x]);Ll(function(){M()},[M]);var S=v.useCallback(function(N){l.current=N,M()},[M]);if(!n&&a!=="fixed"||!b)return null;var k=Ce("div",Oe({ref:S},xt(Se(Se({},t),{},{offset:b.offset,position:a,rect:b.rect}),"menuPortal",{"menu-portal":!0}),o),r);return Ce(Of.Provider,{value:m},n?Ln.createPortal(k,n):k)},k1=function(t){var n=t.isDisabled,r=t.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},C1=function(t){var n=t.children,r=t.innerProps,s=t.isDisabled,o=t.isRtl;return Ce("div",Oe({},xt(t,"container",{"--is-disabled":s,"--is-rtl":o}),r),n)},S1=function(t,n){var r=t.theme.spacing,s=t.isMulti,o=t.hasValue,i=t.selectProps.controlShouldRenderValue;return Se({alignItems:"center",display:s&&o&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},_1=function(t){var n=t.children,r=t.innerProps,s=t.isMulti,o=t.hasValue;return Ce("div",Oe({},xt(t,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":o}),r),n)},E1=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},M1=function(t){var n=t.children,r=t.innerProps;return Ce("div",Oe({},xt(t,"indicatorsContainer",{indicators:!0}),r),n)},Df,N1=["size"],T1=["innerProps","isRtl","size"],O1={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},If=function(t){var n=t.size,r=Fn(t,N1);return Ce("svg",Oe({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:O1},r))},Pl=function(t){return Ce(If,Oe({size:20},t),Ce("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},Lf=function(t){return Ce(If,Oe({size:20},t),Ce("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},Pf=function(t,n){var r=t.isFocused,s=t.theme,o=s.spacing.baseUnit,i=s.colors;return Se({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?i.neutral60:i.neutral20,padding:o*2,":hover":{color:r?i.neutral80:i.neutral40}})},A1=Pf,D1=function(t){var n=t.children,r=t.innerProps;return Ce("div",Oe({},xt(t,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||Ce(Lf,null))},I1=Pf,L1=function(t){var n=t.children,r=t.innerProps;return Ce("div",Oe({},xt(t,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||Ce(Pl,null))},P1=function(t,n){var r=t.isDisabled,s=t.theme,o=s.spacing.baseUnit,i=s.colors;return Se({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?i.neutral10:i.neutral20,marginBottom:o*2,marginTop:o*2})},$1=function(t){var n=t.innerProps;return Ce("span",Oe({},n,xt(t,"indicatorSeparator",{"indicator-separator":!0})))},F1=Lw(Df||(Df=Pw([`
|
||
0%, 80%, 100% { opacity: 0; }
|
||
40% { opacity: 1; }
|
||
`]))),z1=function(t,n){var r=t.isFocused,s=t.size,o=t.theme,i=o.colors,a=o.spacing.baseUnit;return Se({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:s,lineHeight:1,marginRight:s,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:a*2})},$l=function(t){var n=t.delay,r=t.offset;return Ce("span",{css:Ol({animation:"".concat(F1," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},V1=function(t){var n=t.innerProps,r=t.isRtl,s=t.size,o=s===void 0?4:s,i=Fn(t,T1);return Ce("div",Oe({},xt(Se(Se({},i),{},{innerProps:n,isRtl:r,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),Ce($l,{delay:0,offset:r}),Ce($l,{delay:160,offset:!0}),Ce($l,{delay:320,offset:!r}))},H1=function(t,n){var r=t.isDisabled,s=t.isFocused,o=t.theme,i=o.colors,a=o.borderRadius,l=o.spacing;return Se({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:s?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:s?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:s?i.primary:i.neutral30}})},U1=function(t){var n=t.children,r=t.isDisabled,s=t.isFocused,o=t.innerRef,i=t.innerProps,a=t.menuIsOpen;return Ce("div",Oe({ref:o},xt(t,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":a}),i,{"aria-disabled":r||void 0}),n)},B1=U1,j1=["data"],W1=function(t,n){var r=t.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},G1=function(t){var n=t.children,r=t.cx,s=t.getStyles,o=t.getClassNames,i=t.Heading,a=t.headingProps,l=t.innerProps,c=t.label,d=t.theme,u=t.selectProps;return Ce("div",Oe({},xt(t,"group",{group:!0}),l),Ce(i,Oe({},a,{selectProps:u,theme:d,getStyles:s,getClassNames:o,cx:r}),c),Ce("div",null,n))},Y1=function(t,n){var r=t.theme,s=r.colors,o=r.spacing;return Se({label:"group",cursor:"default",display:"block"},n?{}:{color:s.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:o.baseUnit*3,paddingRight:o.baseUnit*3,textTransform:"uppercase"})},X1=function(t){var n=Sf(t);n.data;var r=Fn(n,j1);return Ce("div",Oe({},xt(t,"groupHeading",{"group-heading":!0}),r))},K1=G1,q1=["innerRef","isDisabled","isHidden","inputClassName"],Z1=function(t,n){var r=t.isDisabled,s=t.value,o=t.theme,i=o.spacing,a=o.colors;return Se(Se({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},Q1),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:a.neutral80})},$f={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},Q1={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Se({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},$f)},J1=function(t){return Se({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},$f)},R1=function(t){var n=t.cx,r=t.value,s=Sf(t),o=s.innerRef,i=s.isDisabled,a=s.isHidden,l=s.inputClassName,c=Fn(s,q1);return Ce("div",Oe({},xt(t,"input",{"input-container":!0}),{"data-value":r||""}),Ce("input",Oe({className:n({input:!0},l),ref:o,style:J1(a),disabled:i},c)))},ek=R1,tk=function(t,n){var r=t.theme,s=r.spacing,o=r.borderRadius,i=r.colors;return Se({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:o/2,margin:s.baseUnit/2})},nk=function(t,n){var r=t.theme,s=r.borderRadius,o=r.colors,i=t.cropWithEllipsis;return Se({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:s/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},rk=function(t,n){var r=t.theme,s=r.spacing,o=r.borderRadius,i=r.colors,a=t.isFocused;return Se({alignItems:"center",display:"flex"},n?{}:{borderRadius:o/2,backgroundColor:a?i.dangerLight:void 0,paddingLeft:s.baseUnit,paddingRight:s.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},Ff=function(t){var n=t.children,r=t.innerProps;return Ce("div",r,n)},sk=Ff,ok=Ff;function ik(e){var t=e.children,n=e.innerProps;return Ce("div",Oe({role:"button"},n),t||Ce(Pl,{size:14}))}var ak=function(t){var n=t.children,r=t.components,s=t.data,o=t.innerProps,i=t.isDisabled,a=t.removeProps,l=t.selectProps,c=r.Container,d=r.Label,u=r.Remove;return Ce(c,{data:s,innerProps:Se(Se({},xt(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),o),selectProps:l},Ce(d,{data:s,innerProps:Se({},xt(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},n),Ce(u,{data:s,innerProps:Se(Se({},xt(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},a),selectProps:l}))},lk=ak,ck=function(t,n){var r=t.isDisabled,s=t.isFocused,o=t.isSelected,i=t.theme,a=i.spacing,l=i.colors;return Se({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:o?l.primary:s?l.primary25:"transparent",color:r?l.neutral20:o?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:o?l.primary:l.primary50}})},dk=function(t){var n=t.children,r=t.isDisabled,s=t.isFocused,o=t.isSelected,i=t.innerRef,a=t.innerProps;return Ce("div",Oe({},xt(t,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":o}),{ref:i,"aria-disabled":r},a),n)},uk=dk,fk=function(t,n){var r=t.theme,s=r.spacing,o=r.colors;return Se({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:o.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},hk=function(t){var n=t.children,r=t.innerProps;return Ce("div",Oe({},xt(t,"placeholder",{placeholder:!0}),r),n)},gk=hk,pk=function(t,n){var r=t.isDisabled,s=t.theme,o=s.spacing,i=s.colors;return Se({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},mk=function(t){var n=t.children,r=t.isDisabled,s=t.innerProps;return Ce("div",Oe({},xt(t,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},bk=mk,wi={ClearIndicator:L1,Control:B1,DropdownIndicator:D1,DownChevron:Lf,CrossIcon:Pl,Group:K1,GroupHeading:X1,IndicatorsContainer:M1,IndicatorSeparator:$1,Input:ek,LoadingIndicator:V1,Menu:h1,MenuList:p1,MenuPortal:w1,LoadingMessage:v1,NoOptionsMessage:y1,MultiValue:lk,MultiValueContainer:sk,MultiValueLabel:ok,MultiValueRemove:ik,Option:uk,Placeholder:gk,SelectContainer:C1,SingleValue:bk,ValueContainer:_1},yk=function(t){return Se(Se({},wi),t.components)},zf=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function vk(e,t){return!!(e===t||zf(e)&&zf(t))}function xk(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!vk(e[n],t[n]))return!1;return!0}function wk(e,t){t===void 0&&(t=xk);var n=null;function r(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];if(n&&n.lastThis===this&&t(s,n.lastArgs))return n.lastResult;var i=e.apply(this,s);return n={lastResult:i,lastArgs:s,lastThis:this},i}return r.clear=function(){n=null},r}for(var kk={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},Ck=function(t){return Ce("span",Oe({css:kk},t))},Vf=Ck,Sk={guidance:function(t){var n=t.isSearchable,r=t.isMulti,s=t.tabSelectsValue,o=t.context,i=t.isInitialFocus;switch(o){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(s?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(t["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(t){var n=t.action,r=t.label,s=r===void 0?"":r,o=t.labels,i=t.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(s,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(o.length>1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return i?"option ".concat(s," is disabled. Select another option."):"option ".concat(s,", selected.");default:return""}},onFocus:function(t){var n=t.context,r=t.focused,s=t.options,o=t.label,i=o===void 0?"":o,a=t.selectValue,l=t.isDisabled,c=t.isSelected,d=t.isAppleDevice,u=function(p,y){return p&&p.length?"".concat(p.indexOf(y)+1," of ").concat(p.length):""};if(n==="value"&&a)return"value ".concat(i," focused, ").concat(u(a,r),".");if(n==="menu"&&d){var f=l?" disabled":"",g="".concat(c?" selected":"").concat(f);return"".concat(i).concat(g,", ").concat(u(s,r),".")}return""},onFilter:function(t){var n=t.inputValue,r=t.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},_k=function(t){var n=t.ariaSelection,r=t.focusedOption,s=t.focusedValue,o=t.focusableOptions,i=t.isFocused,a=t.selectValue,l=t.selectProps,c=t.id,d=t.isAppleDevice,u=l.ariaLiveMessages,f=l.getOptionLabel,g=l.inputValue,m=l.isMulti,p=l.isOptionDisabled,y=l.isSearchable,b=l.menuIsOpen,_=l.options,x=l.screenReaderStatus,M=l.tabSelectsValue,S=l.isLoading,k=l["aria-label"],N=l["aria-live"],C=v.useMemo(function(){return Se(Se({},Sk),u||{})},[u]),w=v.useMemo(function(){var D="";if(n&&C.onChange){var O=n.option,T=n.options,z=n.removedValue,U=n.removedValues,W=n.value,G=function(q){return Array.isArray(q)?null:q},B=z||O||G(W),j=B?f(B):"",Y=T||U||void 0,V=Y?Y.map(f):[],X=Se({isDisabled:B&&p(B,a),label:j,labels:V},n);D=C.onChange(X)}return D},[n,C,p,a,f]),E=v.useMemo(function(){var D="",O=r||s,T=!!(r&&a&&a.includes(r));if(O&&C.onFocus){var z={focused:O,label:f(O),isDisabled:p(O,a),isSelected:T,options:o,context:O===r?"menu":"value",selectValue:a,isAppleDevice:d};D=C.onFocus(z)}return D},[r,s,f,p,C,o,a,d]),A=v.useMemo(function(){var D="";if(b&&_.length&&!S&&C.onFilter){var O=x({count:o.length});D=C.onFilter({inputValue:g,resultsMessage:O})}return D},[o,g,b,C,_,x,S]),P=n?.action==="initial-input-focus",L=v.useMemo(function(){var D="";if(C.guidance){var O=s?"value":b?"menu":"input";D=C.guidance({"aria-label":k,context:O,isDisabled:r&&p(r,a),isMulti:m,isSearchable:y,tabSelectsValue:M,isInitialFocus:P})}return D},[k,r,s,m,p,y,b,C,a,M,P]),$=Ce(v.Fragment,null,Ce("span",{id:"aria-selection"},w),Ce("span",{id:"aria-focused"},E),Ce("span",{id:"aria-results"},A),Ce("span",{id:"aria-guidance"},L));return Ce(v.Fragment,null,Ce(Vf,{id:c},P&&$),Ce(Vf,{"aria-live":N,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!P&&$))},Ek=_k,Fl=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],Mk=new RegExp("["+Fl.map(function(e){return e.letters}).join("")+"]","g"),Hf={},zl=0;zl<Fl.length;zl++)for(var Vl=Fl[zl],Hl=0;Hl<Vl.letters.length;Hl++)Hf[Vl.letters[Hl]]=Vl.base;var Uf=function(t){return t.replace(Mk,function(n){return Hf[n]})},Nk=wk(Uf),Bf=function(t){return t.replace(/^\s+|\s+$/g,"")},Tk=function(t){return"".concat(t.label," ").concat(t.value)},Ok=function(t){return function(n,r){if(n.data.__isNew__)return!0;var s=Se({ignoreCase:!0,ignoreAccents:!0,stringify:Tk,trim:!0,matchFrom:"any"},t),o=s.ignoreCase,i=s.ignoreAccents,a=s.stringify,l=s.trim,c=s.matchFrom,d=l?Bf(r):r,u=l?Bf(a(n)):a(n);return o&&(d=d.toLowerCase(),u=u.toLowerCase()),i&&(d=Nk(d),u=Uf(u)),c==="start"?u.substr(0,d.length)===d:u.indexOf(d)>-1}},Ak=["innerRef"];function Dk(e){var t=e.innerRef,n=Fn(e,Ak),r=o1(n,"onExited","in","enter","exit","appear");return Ce("input",Oe({ref:t},r,{css:Ol({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var Ik=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function Lk(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,s=e.onTopArrive,o=e.onTopLeave,i=v.useRef(!1),a=v.useRef(!1),l=v.useRef(0),c=v.useRef(null),d=v.useCallback(function(y,b){if(c.current!==null){var _=c.current,x=_.scrollTop,M=_.scrollHeight,S=_.clientHeight,k=c.current,N=b>0,C=M-S-x,w=!1;C>b&&i.current&&(r&&r(y),i.current=!1),N&&a.current&&(o&&o(y),a.current=!1),N&&b>C?(n&&!i.current&&n(y),k.scrollTop=M,w=!0,i.current=!0):!N&&-b>x&&(s&&!a.current&&s(y),k.scrollTop=0,w=!0,a.current=!0),w&&Ik(y)}},[n,r,s,o]),u=v.useCallback(function(y){d(y,y.deltaY)},[d]),f=v.useCallback(function(y){l.current=y.changedTouches[0].clientY},[]),g=v.useCallback(function(y){var b=l.current-y.changedTouches[0].clientY;d(y,b)},[d]),m=v.useCallback(function(y){if(y){var b=n1?{passive:!1}:!1;y.addEventListener("wheel",u,b),y.addEventListener("touchstart",f,b),y.addEventListener("touchmove",g,b)}},[g,f,u]),p=v.useCallback(function(y){y&&(y.removeEventListener("wheel",u,!1),y.removeEventListener("touchstart",f,!1),y.removeEventListener("touchmove",g,!1))},[g,f,u]);return v.useEffect(function(){if(t){var y=c.current;return m(y),function(){p(y)}}},[t,m,p]),function(y){c.current=y}}var jf=["boxSizing","height","overflow","paddingRight","position"],Wf={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Gf(e){e.cancelable&&e.preventDefault()}function Yf(e){e.stopPropagation()}function Xf(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function Kf(){return"ontouchstart"in window||navigator.maxTouchPoints}var qf=!!(typeof window<"u"&&window.document&&window.document.createElement),Zs=0,os={capture:!1,passive:!1};function Pk(e){var t=e.isEnabled,n=e.accountForScrollbars,r=n===void 0?!0:n,s=v.useRef({}),o=v.useRef(null),i=v.useCallback(function(l){if(qf){var c=document.body,d=c&&c.style;if(r&&jf.forEach(function(m){var p=d&&d[m];s.current[m]=p}),r&&Zs<1){var u=parseInt(s.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,g=window.innerWidth-f+u||0;Object.keys(Wf).forEach(function(m){var p=Wf[m];d&&(d[m]=p)}),d&&(d.paddingRight="".concat(g,"px"))}c&&Kf()&&(c.addEventListener("touchmove",Gf,os),l&&(l.addEventListener("touchstart",Xf,os),l.addEventListener("touchmove",Yf,os))),Zs+=1}},[r]),a=v.useCallback(function(l){if(qf){var c=document.body,d=c&&c.style;Zs=Math.max(Zs-1,0),r&&Zs<1&&jf.forEach(function(u){var f=s.current[u];d&&(d[u]=f)}),c&&Kf()&&(c.removeEventListener("touchmove",Gf,os),l&&(l.removeEventListener("touchstart",Xf,os),l.removeEventListener("touchmove",Yf,os)))}},[r]);return v.useEffect(function(){if(t){var l=o.current;return i(l),function(){a(l)}}},[t,i,a]),function(l){o.current=l}}var $k=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},Fk={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function zk(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,s=r===void 0?!0:r,o=e.onBottomArrive,i=e.onBottomLeave,a=e.onTopArrive,l=e.onTopLeave,c=Lk({isEnabled:s,onBottomArrive:o,onBottomLeave:i,onTopArrive:a,onTopLeave:l}),d=Pk({isEnabled:n}),u=function(g){c(g),d(g)};return Ce(v.Fragment,null,n&&Ce("div",{onClick:$k,css:Fk}),t(u))}var Vk={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},Hk=function(t){var n=t.name,r=t.onFocus;return Ce("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:Vk,value:"",onChange:function(){}})},Uk=Hk;function Ul(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Bk(){return Ul(/^iPhone/i)}function Zf(){return Ul(/^Mac/i)}function jk(){return Ul(/^iPad/i)||Zf()&&navigator.maxTouchPoints>1}function Wk(){return Bk()||jk()}function Gk(){return Zf()||Wk()}var Yk=function(t){return t.label},Qf=function(t){return t.label},Jf=function(t){return t.value},Xk=function(t){return!!t.isDisabled},Kk={clearIndicator:I1,container:k1,control:H1,dropdownIndicator:A1,group:W1,groupHeading:Y1,indicatorsContainer:E1,indicatorSeparator:P1,input:Z1,loadingIndicator:z1,loadingMessage:b1,menu:d1,menuList:g1,menuPortal:x1,multiValue:tk,multiValueLabel:nk,multiValueRemove:rk,noOptionsMessage:m1,option:ck,placeholder:fk,singleValue:pk,valueContainer:S1},qk={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},Zk=4,Rf=4,Qk=38,Jk=Rf*2,Rk={baseUnit:Rf,controlHeight:Qk,menuGutter:Jk},Bl={borderRadius:Zk,colors:qk,spacing:Rk},eC={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Mf(),captureMenuScroll:!Mf(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:Ok(),formatGroupLabel:Yk,getOptionLabel:Qf,getOptionValue:Jf,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:Xk,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!e1(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var n=t.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function eh(e,t,n,r){var s=oh(e,t,n),o=ih(e,t,n),i=sh(e,t),a=Ci(e,t);return{type:"option",data:t,isDisabled:s,isSelected:o,label:i,value:a,index:r}}function ki(e,t){return e.options.map(function(n,r){if("options"in n){var s=n.options.map(function(i,a){return eh(e,i,t,a)}).filter(function(i){return rh(e,i)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var o=eh(e,n,t,r);return rh(e,o)?o:void 0}).filter(r1)}function th(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,ts(n.options.map(function(r){return r.data}))):t.push(n.data),t},[])}function nh(e,t){return e.reduce(function(n,r){return r.type==="group"?n.push.apply(n,ts(r.options.map(function(s){return{data:s.data,id:"".concat(t,"-").concat(r.index,"-").concat(s.index)}}))):n.push({data:r.data,id:"".concat(t,"-").concat(r.index)}),n},[])}function tC(e,t){return th(ki(e,t))}function rh(e,t){var n=e.inputValue,r=n===void 0?"":n,s=t.data,o=t.isSelected,i=t.label,a=t.value;return(!lh(e)||!o)&&ah(e,{label:i,value:a,data:s},r)}function nC(e,t){var n=e.focusedValue,r=e.selectValue,s=r.indexOf(n);if(s>-1){var o=t.indexOf(n);if(o>-1)return n;if(s<t.length)return t[s]}return null}function rC(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}var jl=function(t,n){var r,s=(r=t.find(function(o){return o.data===n}))===null||r===void 0?void 0:r.id;return s||null},sh=function(t,n){return t.getOptionLabel(n)},Ci=function(t,n){return t.getOptionValue(n)};function oh(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function ih(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var r=Ci(e,t);return n.some(function(s){return Ci(e,s)===r})}function ah(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var lh=function(t){var n=t.hideSelectedOptions,r=t.isMulti;return n===void 0?r:n},sC=1,Wl=(function(e){Ax(n,e);var t=Lx(n);function n(r){var s;if(Tx(this,n),s=t.call(this,r),s.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},s.blockOptionHover=!1,s.isComposing=!1,s.commonProps=void 0,s.initialTouchX=0,s.initialTouchY=0,s.openAfterFocus=!1,s.scrollToFocusedOptionOnUpdate=!1,s.userIsDragging=void 0,s.controlRef=null,s.getControlRef=function(l){s.controlRef=l},s.focusedOptionRef=null,s.getFocusedOptionRef=function(l){s.focusedOptionRef=l},s.menuListRef=null,s.getMenuListRef=function(l){s.menuListRef=l},s.inputRef=null,s.getInputRef=function(l){s.inputRef=l},s.focus=s.focusInput,s.blur=s.blurInput,s.onChange=function(l,c){var d=s.props,u=d.onChange,f=d.name;c.name=f,s.ariaOnChange(l,c),u(l,c)},s.setValue=function(l,c,d){var u=s.props,f=u.closeMenuOnSelect,g=u.isMulti,m=u.inputValue;s.onInputChange("",{action:"set-value",prevInputValue:m}),f&&(s.setState({inputIsHiddenAfterUpdate:!g}),s.onMenuClose()),s.setState({clearFocusValueOnUpdate:!0}),s.onChange(l,{action:c,option:d})},s.selectOption=function(l){var c=s.props,d=c.blurInputOnSelect,u=c.isMulti,f=c.name,g=s.state.selectValue,m=u&&s.isOptionSelected(l,g),p=s.isOptionDisabled(l,g);if(m){var y=s.getOptionValue(l);s.setValue(g.filter(function(b){return s.getOptionValue(b)!==y}),"deselect-option",l)}else if(!p)u?s.setValue([].concat(ts(g),[l]),"select-option",l):s.setValue(l,"select-option");else{s.ariaOnChange(l,{action:"select-option",option:l,name:f});return}d&&s.blurInput()},s.removeValue=function(l){var c=s.props.isMulti,d=s.state.selectValue,u=s.getOptionValue(l),f=d.filter(function(m){return s.getOptionValue(m)!==u}),g=qs(c,f,f[0]||null);s.onChange(g,{action:"remove-value",removedValue:l}),s.focusInput()},s.clearValue=function(){var l=s.state.selectValue;s.onChange(qs(s.props.isMulti,[],null),{action:"clear",removedValues:l})},s.popValue=function(){var l=s.props.isMulti,c=s.state.selectValue,d=c[c.length-1],u=c.slice(0,c.length-1),f=qs(l,u,u[0]||null);d&&s.onChange(f,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(l){return jl(s.state.focusableOptionsWithIds,l)},s.getFocusableOptionsWithIds=function(){return nh(ki(s.props,s.state.selectValue),s.getElementId("option"))},s.getValue=function(){return s.state.selectValue},s.cx=function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];return qw.apply(void 0,[s.props.classNamePrefix].concat(c))},s.getOptionLabel=function(l){return sh(s.props,l)},s.getOptionValue=function(l){return Ci(s.props,l)},s.getStyles=function(l,c){var d=s.props.unstyled,u=Kk[l](c,d);u.boxSizing="border-box";var f=s.props.styles[l];return f?f(u,c):u},s.getClassNames=function(l,c){var d,u;return(d=(u=s.props.classNames)[l])===null||d===void 0?void 0:d.call(u,c)},s.getElementId=function(l){return"".concat(s.state.instancePrefix,"-").concat(l)},s.getComponents=function(){return yk(s.props)},s.buildCategorizedOptions=function(){return ki(s.props,s.state.selectValue)},s.getCategorizedOptions=function(){return s.props.menuIsOpen?s.buildCategorizedOptions():[]},s.buildFocusableOptions=function(){return th(s.buildCategorizedOptions())},s.getFocusableOptions=function(){return s.props.menuIsOpen?s.buildFocusableOptions():[]},s.ariaOnChange=function(l,c){s.setState({ariaSelection:Se({value:l},c)})},s.onMenuMouseDown=function(l){l.button===0&&(l.stopPropagation(),l.preventDefault(),s.focusInput())},s.onMenuMouseMove=function(l){s.blockOptionHover=!1},s.onControlMouseDown=function(l){if(!l.defaultPrevented){var c=s.props.openMenuOnClick;s.state.isFocused?s.props.menuIsOpen?l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&s.onMenuClose():c&&s.openMenu("first"):(c&&(s.openAfterFocus=!0),s.focusInput()),l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&l.preventDefault()}},s.onDropdownIndicatorMouseDown=function(l){if(!(l&&l.type==="mousedown"&&l.button!==0)&&!s.props.isDisabled){var c=s.props,d=c.isMulti,u=c.menuIsOpen;s.focusInput(),u?(s.setState({inputIsHiddenAfterUpdate:!d}),s.onMenuClose()):s.openMenu("first"),l.preventDefault()}},s.onClearIndicatorMouseDown=function(l){l&&l.type==="mousedown"&&l.button!==0||(s.clearValue(),l.preventDefault(),s.openAfterFocus=!1,l.type==="touchend"?s.focusInput():setTimeout(function(){return s.focusInput()}))},s.onScroll=function(l){typeof s.props.closeMenuOnScroll=="boolean"?l.target instanceof HTMLElement&&bi(l.target)&&s.props.onMenuClose():typeof s.props.closeMenuOnScroll=="function"&&s.props.closeMenuOnScroll(l)&&s.props.onMenuClose()},s.onCompositionStart=function(){s.isComposing=!0},s.onCompositionEnd=function(){s.isComposing=!1},s.onTouchStart=function(l){var c=l.touches,d=c&&c.item(0);d&&(s.initialTouchX=d.clientX,s.initialTouchY=d.clientY,s.userIsDragging=!1)},s.onTouchMove=function(l){var c=l.touches,d=c&&c.item(0);if(d){var u=Math.abs(d.clientX-s.initialTouchX),f=Math.abs(d.clientY-s.initialTouchY),g=5;s.userIsDragging=u>g||f>g}},s.onTouchEnd=function(l){s.userIsDragging||(s.controlRef&&!s.controlRef.contains(l.target)&&s.menuListRef&&!s.menuListRef.contains(l.target)&&s.blurInput(),s.initialTouchX=0,s.initialTouchY=0)},s.onControlTouchEnd=function(l){s.userIsDragging||s.onControlMouseDown(l)},s.onClearIndicatorTouchEnd=function(l){s.userIsDragging||s.onClearIndicatorMouseDown(l)},s.onDropdownIndicatorTouchEnd=function(l){s.userIsDragging||s.onDropdownIndicatorMouseDown(l)},s.handleInputChange=function(l){var c=s.props.inputValue,d=l.currentTarget.value;s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange(d,{action:"input-change",prevInputValue:c}),s.props.menuIsOpen||s.onMenuOpen()},s.onInputFocus=function(l){s.props.onFocus&&s.props.onFocus(l),s.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(s.openAfterFocus||s.props.openMenuOnFocus)&&s.openMenu("first"),s.openAfterFocus=!1},s.onInputBlur=function(l){var c=s.props.inputValue;if(s.menuListRef&&s.menuListRef.contains(document.activeElement)){s.inputRef.focus();return}s.props.onBlur&&s.props.onBlur(l),s.onInputChange("",{action:"input-blur",prevInputValue:c}),s.onMenuClose(),s.setState({focusedValue:null,isFocused:!1})},s.onOptionHover=function(l){if(!(s.blockOptionHover||s.state.focusedOption===l)){var c=s.getFocusableOptions(),d=c.indexOf(l);s.setState({focusedOption:l,focusedOptionId:d>-1?s.getFocusedOptionId(l):null})}},s.shouldHideSelectedOptions=function(){return lh(s.props)},s.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),s.focus()},s.onKeyDown=function(l){var c=s.props,d=c.isMulti,u=c.backspaceRemovesValue,f=c.escapeClearsValue,g=c.inputValue,m=c.isClearable,p=c.isDisabled,y=c.menuIsOpen,b=c.onKeyDown,_=c.tabSelectsValue,x=c.openMenuOnFocus,M=s.state,S=M.focusedOption,k=M.focusedValue,N=M.selectValue;if(!p&&!(typeof b=="function"&&(b(l),l.defaultPrevented))){switch(s.blockOptionHover=!0,l.key){case"ArrowLeft":if(!d||g)return;s.focusValue("previous");break;case"ArrowRight":if(!d||g)return;s.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if(k)s.removeValue(k);else{if(!u)return;d?s.popValue():m&&s.clearValue()}break;case"Tab":if(s.isComposing||l.shiftKey||!y||!_||!S||x&&s.isOptionSelected(S,N))return;s.selectOption(S);break;case"Enter":if(l.keyCode===229)break;if(y){if(!S||s.isComposing)return;s.selectOption(S);break}return;case"Escape":y?(s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange("",{action:"menu-close",prevInputValue:g}),s.onMenuClose()):m&&f&&s.clearValue();break;case" ":if(g)return;if(!y){s.openMenu("first");break}if(!S)return;s.selectOption(S);break;case"ArrowUp":y?s.focusOption("up"):s.openMenu("last");break;case"ArrowDown":y?s.focusOption("down"):s.openMenu("first");break;case"PageUp":if(!y)return;s.focusOption("pageup");break;case"PageDown":if(!y)return;s.focusOption("pagedown");break;case"Home":if(!y)return;s.focusOption("first");break;case"End":if(!y)return;s.focusOption("last");break;default:return}l.preventDefault()}},s.state.instancePrefix="react-select-"+(s.props.instanceId||++sC),s.state.selectValue=mi(r.value),r.menuIsOpen&&s.state.selectValue.length){var o=s.getFocusableOptionsWithIds(),i=s.buildFocusableOptions(),a=i.indexOf(s.state.selectValue[0]);s.state.focusableOptionsWithIds=o,s.state.focusedOption=i[a],s.state.focusedOptionId=jl(o,i[a])}return s}return Ox(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&Ef(this.menuListRef,this.focusedOptionRef),Gk()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(s){var o=this.props,i=o.isDisabled,a=o.menuIsOpen,l=this.state.isFocused;(l&&!i&&s.isDisabled||l&&a&&!s.menuIsOpen)&&this.focusInput(),l&&i&&!s.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!i&&s.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Ef(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(s,o){this.props.onInputChange(s,o)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(s){var o=this,i=this.state,a=i.selectValue,l=i.isFocused,c=this.buildFocusableOptions(),d=s==="first"?0:c.length-1;if(!this.props.isMulti){var u=c.indexOf(a[0]);u>-1&&(d=u)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[d],focusedOptionId:this.getFocusedOptionId(c[d])},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(s){var o=this.state,i=o.selectValue,a=o.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=i.indexOf(a);a||(l=-1);var c=i.length-1,d=-1;if(i.length){switch(s){case"previous":l===0?d=0:l===-1?d=c:d=l-1;break;case"next":l>-1&&l<c&&(d=l+1);break}this.setState({inputIsHidden:d!==-1,focusedValue:i[d]})}}}},{key:"focusOption",value:function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,i=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,c=a.indexOf(i);i||(c=-1),s==="up"?l=c>0?c-1:a.length-1:s==="down"?l=(c+1)%a.length:s==="pageup"?(l=c-o,l<0&&(l=0)):s==="pagedown"?(l=c+o,l>a.length-1&&(l=a.length-1)):s==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Bl):Se(Se({},Bl),this.props.theme):Bl})},{key:"getCommonProps",value:function(){var s=this.clearValue,o=this.cx,i=this.getStyles,a=this.getClassNames,l=this.getValue,c=this.selectOption,d=this.setValue,u=this.props,f=u.isMulti,g=u.isRtl,m=u.options,p=this.hasValue();return{clearValue:s,cx:o,getStyles:i,getClassNames:a,getValue:l,hasValue:p,isMulti:f,isRtl:g,options:m,selectOption:c,selectProps:u,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var s=this.state.selectValue;return s.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var s=this.props,o=s.isClearable,i=s.isMulti;return o===void 0?i:o}},{key:"isOptionDisabled",value:function(s,o){return oh(this.props,s,o)}},{key:"isOptionSelected",value:function(s,o){return ih(this.props,s,o)}},{key:"filterOption",value:function(s,o){return ah(this.props,s,o)}},{key:"formatOptionLabel",value:function(s,o){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(s,{context:o,inputValue:i,selectValue:a})}else return this.getOptionLabel(s)}},{key:"formatGroupLabel",value:function(s){return this.props.formatGroupLabel(s)}},{key:"startListeningComposition",value:(function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))})},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:(function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))})},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:(function(){var s=this.props,o=s.isDisabled,i=s.isSearchable,a=s.inputId,l=s.inputValue,c=s.tabIndex,d=s.form,u=s.menuIsOpen,f=s.required,g=this.getComponents(),m=g.Input,p=this.state,y=p.inputIsHidden,b=p.ariaSelection,_=this.commonProps,x=a||this.getElementId("input"),M=Se(Se(Se({"aria-autocomplete":"list","aria-expanded":u,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},u&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?b?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?F.createElement(m,Oe({},_,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:x,innerRef:this.getInputRef,isDisabled:o,isHidden:y,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:d,type:"text",value:l},M)):F.createElement(Dk,Oe({id:x,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:pi,onFocus:this.onInputFocus,disabled:o,tabIndex:c,inputMode:"none",form:d,value:""},M))})},{key:"renderPlaceholderOrValue",value:function(){var s=this,o=this.getComponents(),i=o.MultiValue,a=o.MultiValueContainer,l=o.MultiValueLabel,c=o.MultiValueRemove,d=o.SingleValue,u=o.Placeholder,f=this.commonProps,g=this.props,m=g.controlShouldRenderValue,p=g.isDisabled,y=g.isMulti,b=g.inputValue,_=g.placeholder,x=this.state,M=x.selectValue,S=x.focusedValue,k=x.isFocused;if(!this.hasValue()||!m)return b?null:F.createElement(u,Oe({},f,{key:"placeholder",isDisabled:p,isFocused:k,innerProps:{id:this.getElementId("placeholder")}}),_);if(y)return M.map(function(C,w){var E=C===S,A="".concat(s.getOptionLabel(C),"-").concat(s.getOptionValue(C));return F.createElement(i,Oe({},f,{components:{Container:a,Label:l,Remove:c},isFocused:E,isDisabled:p,key:A,index:w,removeProps:{onClick:function(){return s.removeValue(C)},onTouchEnd:function(){return s.removeValue(C)},onMouseDown:function(L){L.preventDefault()}},data:C}),s.formatOptionLabel(C,"value"))});if(b)return null;var N=M[0];return F.createElement(d,Oe({},f,{data:N,isDisabled:p}),this.formatOptionLabel(N,"value"))}},{key:"renderClearIndicator",value:function(){var s=this.getComponents(),o=s.ClearIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!this.isClearable()||!o||l||!this.hasValue()||c)return null;var u={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return F.createElement(o,Oe({},i,{innerProps:u,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var s=this.getComponents(),o=s.LoadingIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!o||!c)return null;var u={"aria-hidden":"true"};return F.createElement(o,Oe({},i,{innerProps:u,isDisabled:l,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator,i=s.IndicatorSeparator;if(!o||!i)return null;var a=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused;return F.createElement(i,Oe({},a,{isDisabled:l,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator;if(!o)return null;var i=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return F.createElement(o,Oe({},i,{innerProps:c,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var s=this,o=this.getComponents(),i=o.Group,a=o.GroupHeading,l=o.Menu,c=o.MenuList,d=o.MenuPortal,u=o.LoadingMessage,f=o.NoOptionsMessage,g=o.Option,m=this.commonProps,p=this.state.focusedOption,y=this.props,b=y.captureMenuScroll,_=y.inputValue,x=y.isLoading,M=y.loadingMessage,S=y.minMenuHeight,k=y.maxMenuHeight,N=y.menuIsOpen,C=y.menuPlacement,w=y.menuPosition,E=y.menuPortalTarget,A=y.menuShouldBlockScroll,P=y.menuShouldScrollIntoView,L=y.noOptionsMessage,$=y.onMenuScrollToTop,D=y.onMenuScrollToBottom;if(!N)return null;var O=function(j,Y){var V=j.type,X=j.data,K=j.isDisabled,q=j.isSelected,ne=j.label,te=j.value,fe=p===X,ee=K?void 0:function(){return s.onOptionHover(X)},le=K?void 0:function(){return s.selectOption(X)},ge="".concat(s.getElementId("option"),"-").concat(Y),ce={id:ge,onClick:le,onMouseMove:ee,onMouseOver:ee,tabIndex:-1,role:"option","aria-selected":s.state.isAppleDevice?void 0:q};return F.createElement(g,Oe({},m,{innerProps:ce,data:X,isDisabled:K,isSelected:q,key:ge,label:ne,type:V,value:te,isFocused:fe,innerRef:fe?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(j.data,"menu"))},T;if(this.hasOptions())T=this.getCategorizedOptions().map(function(B){if(B.type==="group"){var j=B.data,Y=B.options,V=B.index,X="".concat(s.getElementId("group"),"-").concat(V),K="".concat(X,"-heading");return F.createElement(i,Oe({},m,{key:X,data:j,options:Y,Heading:a,headingProps:{id:K,data:B.data},label:s.formatGroupLabel(B.data)}),B.options.map(function(q){return O(q,"".concat(V,"-").concat(q.index))}))}else if(B.type==="option")return O(B,"".concat(B.index))});else if(x){var z=M({inputValue:_});if(z===null)return null;T=F.createElement(u,m,z)}else{var U=L({inputValue:_});if(U===null)return null;T=F.createElement(f,m,U)}var W={minMenuHeight:S,maxMenuHeight:k,menuPlacement:C,menuPosition:w,menuShouldScrollIntoView:P},G=F.createElement(u1,Oe({},m,W),function(B){var j=B.ref,Y=B.placerProps,V=Y.placement,X=Y.maxHeight;return F.createElement(l,Oe({},m,W,{innerRef:j,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:x,placement:V}),F.createElement(zk,{captureEnabled:b,onTopArrive:$,onBottomArrive:D,lockEnabled:A},function(K){return F.createElement(c,Oe({},m,{innerRef:function(ne){s.getMenuListRef(ne),K(ne)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:s.getElementId("listbox")},isLoading:x,maxHeight:X,focusedOption:p}),T)}))});return E||w==="fixed"?F.createElement(d,Oe({},m,{appendTo:E,controlElement:this.controlRef,menuPlacement:C,menuPosition:w}),G):G}},{key:"renderFormField",value:function(){var s=this,o=this.props,i=o.delimiter,a=o.isDisabled,l=o.isMulti,c=o.name,d=o.required,u=this.state.selectValue;if(d&&!this.hasValue()&&!a)return F.createElement(Uk,{name:c,onFocus:this.onValueInputFocus});if(!(!c||a))if(l)if(i){var f=u.map(function(p){return s.getOptionValue(p)}).join(i);return F.createElement("input",{name:c,type:"hidden",value:f})}else{var g=u.length>0?u.map(function(p,y){return F.createElement("input",{key:"i-".concat(y),name:c,type:"hidden",value:s.getOptionValue(p)})}):F.createElement("input",{name:c,type:"hidden",value:""});return F.createElement("div",null,g)}else{var m=u[0]?this.getOptionValue(u[0]):"";return F.createElement("input",{name:c,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var s=this.commonProps,o=this.state,i=o.ariaSelection,a=o.focusedOption,l=o.focusedValue,c=o.isFocused,d=o.selectValue,u=this.getFocusableOptions();return F.createElement(Ek,Oe({},s,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:a,focusedValue:l,isFocused:c,selectValue:d,focusableOptions:u,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var s=this.getComponents(),o=s.Control,i=s.IndicatorsContainer,a=s.SelectContainer,l=s.ValueContainer,c=this.props,d=c.className,u=c.id,f=c.isDisabled,g=c.menuIsOpen,m=this.state.isFocused,p=this.commonProps=this.getCommonProps();return F.createElement(a,Oe({},p,{className:d,innerProps:{id:u,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:m}),this.renderLiveRegion(),F.createElement(o,Oe({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:m,menuIsOpen:g}),F.createElement(l,Oe({},p,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),F.createElement(i,Oe({},p,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(s,o){var i=o.prevProps,a=o.clearFocusValueOnUpdate,l=o.inputIsHiddenAfterUpdate,c=o.ariaSelection,d=o.isFocused,u=o.prevWasFocused,f=o.instancePrefix,g=s.options,m=s.value,p=s.menuIsOpen,y=s.inputValue,b=s.isMulti,_=mi(m),x={};if(i&&(m!==i.value||g!==i.options||p!==i.menuIsOpen||y!==i.inputValue)){var M=p?tC(s,_):[],S=p?nh(ki(s,_),"".concat(f,"-option")):[],k=a?nC(o,_):null,N=rC(o,M),C=jl(S,N);x={selectValue:_,focusedOption:N,focusedOptionId:C,focusableOptionsWithIds:S,focusedValue:k,clearFocusValueOnUpdate:!1}}var w=l!=null&&s!==i?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},E=c,A=d&&u;return d&&!A&&(E={value:qs(b,_,_[0]||null),options:_,action:"initial-input-focus"},A=!u),c?.action==="initial-input-focus"&&(E=null),Se(Se(Se({},x),w),{},{prevProps:s,ariaSelection:E,prevWasFocused:A})}}]),n})(v.Component);Wl.defaultProps=eC;var oC=v.forwardRef(function(e,t){var n=Gu(e);return F.createElement(Wl,Oe({ref:t},n))}),ch=oC,iC=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],dh=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,s=String(t).toLowerCase(),o=String(r.getOptionValue(n)).toLowerCase(),i=String(r.getOptionLabel(n)).toLowerCase();return o===s||i===s},Gl={formatCreateLabel:function(t){return'Create "'.concat(t,'"')},isValidNewOption:function(t,n,r,s){return!(!t||n.some(function(o){return dh(t,o,s)})||r.some(function(o){return dh(t,o,s)}))},getNewOptionData:function(t,n){return{label:n,value:t,__isNew__:!0}}};function aC(e){var t=e.allowCreateWhileLoading,n=t===void 0?!1:t,r=e.createOptionPosition,s=r===void 0?"last":r,o=e.formatCreateLabel,i=o===void 0?Gl.formatCreateLabel:o,a=e.isValidNewOption,l=a===void 0?Gl.isValidNewOption:a,c=e.getNewOptionData,d=c===void 0?Gl.getNewOptionData:c,u=e.onCreateOption,f=e.options,g=f===void 0?[]:f,m=e.onChange,p=Fn(e,iC),y=p.getOptionValue,b=y===void 0?Jf:y,_=p.getOptionLabel,x=_===void 0?Qf:_,M=p.inputValue,S=p.isLoading,k=p.isMulti,N=p.value,C=p.name,w=v.useMemo(function(){return l(M,mi(N),g,{getOptionValue:b,getOptionLabel:x})?d(M,i(M)):void 0},[i,d,x,b,M,l,g,N]),E=v.useMemo(function(){return(n||!S)&&w?s==="first"?[w].concat(ts(g)):[].concat(ts(g),[w]):g},[n,s,S,w,g]),A=v.useCallback(function(P,L){if(L.action!=="select-option")return m(P,L);var $=Array.isArray(P)?P:[P];if($[$.length-1]===w){if(u)u(M);else{var D=d(M,M),O={action:"create-option",name:C,option:D};m(qs(k,[].concat(ts(mi(N)),[D]),D),O)}return}m(P,L)},[d,M,k,C,w,u,m,N]);return Se(Se({},p),{},{options:E,onChange:A})}var lC=v.forwardRef(function(e,t){var n=Gu(e),r=aC(n);return F.createElement(Wl,Oe({ref:t},r))}),uh=lC;const zt={control:"input-tag",valueContainer:"gap-1 flex flex-wrap",multiValue:{blue:"bg-blue-100 dark:bg-blue-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",green:"bg-green-100 dark:bg-green-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",amber:"bg-amber-100 dark:bg-amber-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",red:"bg-red-100 dark:bg-red-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",purple:"bg-purple-100 dark:bg-purple-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",gray:"bg-gray-100 dark:bg-gray-700/50 rounded px-1.5 py-0.5 flex items-center gap-1"},multiValueLabel:{blue:"text-blue-700 dark:text-blue-300 text-xs",green:"text-green-700 dark:text-green-300 text-xs font-semibold",amber:"text-amber-700 dark:text-amber-300 text-xs font-semibold",red:"text-red-700 dark:text-red-300 text-xs font-semibold",purple:"text-purple-700 dark:text-purple-300 text-xs font-semibold",gray:"text-gray-700 dark:text-gray-300 text-xs"},multiValueRemove:{blue:"text-blue-700 dark:text-blue-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",green:"text-green-700 dark:text-green-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",amber:"text-amber-700 dark:text-amber-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",red:"text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",purple:"text-purple-700 dark:text-purple-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",gray:"text-gray-700 dark:text-gray-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1"},input:"text-gray-900 dark:text-white text-sm",placeholder:"text-gray-400 dark:text-gray-500 text-sm",menu:"mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",menuList:"py-1",option:{base:"px-3 py-2 cursor-pointer text-gray-900 dark:text-white text-[13px]",selected:"bg-blue-100 dark:bg-blue-900/20",focused:"bg-gray-100 dark:bg-gray-700",default:"bg-white dark:bg-gray-800"},noOptionsMessage:"px-3 py-2 text-gray-500 dark:text-gray-400 text-[13px]",checkbox:{base:"w-4 h-4 rounded border flex items-center justify-center text-white text-[10px] shrink-0",selected:"bg-blue-500 border-blue-500",unselected:"border-gray-400 dark:border-gray-500"}},fh=e=>{const{data:t,isSelected:n}=e;return h.jsx(wi.Option,{...e,children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`${zt.checkbox.base} ${n?zt.checkbox.selected:zt.checkbox.unselected}`,children:n?"✓":""}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[13px]",children:t.label}),t.count!==void 0&&t.count>0&&h.jsxs("span",{className:"text-gray-500 dark:text-gray-400 text-[10px]",children:["(",t.count,")"]})]}),t.description&&h.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:t.description})]})]})})},hh=e=>h.jsx(wi.GroupHeading,{...e,children:h.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 border-b border-gray-200 dark:border-gray-700",children:e.data.label})}),cC=e=>{const{data:t}=e;return h.jsxs(wi.MultiValueLabel,{...e,children:[h.jsx("span",{children:t.label}),t.count!==void 0&&t.count>0&&h.jsxs("span",{className:"text-xs opacity-60 ml-1",children:["(",t.count,")"]})]})},dC=({value:e,options:t=[],onChange:n,creatable:r=!1,placeholder:s="검색 또는 입력...",noOptionsMessage:o="검색 결과가 없습니다",formatCreateLabel:i,createLabelSuffix:a="추가",maxItems:l,disabled:c=!1,onBeforeRemove:d,onCreateOption:u,className:f="",tagVariants:g,defaultVariant:m="blue",name:p,isMulti:y=!0,isClearable:b=!0,isSearchable:_=!0,delimiters:x=[","],splitOnPaste:M=!0,onInputChange:S,id:k,editorAttrs:N})=>{const C=c===!0||c==="true",w=v.useCallback(ee=>ee==null?[]:Array.isArray(ee)?ee:[ee],[]),[E,A]=v.useState(()=>w(e)),[P,L]=v.useState(""),$=v.useRef(void 0);v.useEffect(()=>{const ee=(ge,ce)=>!ge&&!ce?!0:!ge||!ce||ge.length!==ce.length?!1:ge.every((ye,me)=>ye===ce[me]),le=w(e);ee(le,$.current)||(A(le),$.current=le)},[e,w]);const D=v.useMemo(()=>i?typeof i=="string"?ee=>`${i} "${ee}"`:i:ee=>h.jsxs("span",{className:"text-[13px]",children:[h.jsx("strong",{children:ee})," ",a]}),[i,a]),O=v.useMemo(()=>!E||!Array.isArray(E)?[]:E.map(ee=>t.find(ge=>ge.value===ee)||{value:ee,label:String(ee)}).filter(ee=>ee!==void 0),[E,t]),T=v.useMemo(()=>{const ee=new Set(t.map(ke=>ke.value)),le=E?E.filter(ke=>!ee.has(ke)).map(ke=>({value:ke,label:String(ke)})):[],ge=[...t,...le];if(!ge.some(ke=>ke.group))return ge;const ye=new Map,me=[];ge.forEach(ke=>{if(ke.group){const $e=ye.get(ke.group)||[];$e.push(ke),ye.set(ke.group,$e)}else me.push(ke)});const pe=[];return ye.forEach((ke,$e)=>{pe.push({label:$e,options:ke})}),me.length>0&&pe.push({label:"",options:me}),pe},[t,E]),z=v.useCallback(ee=>({target:{value:ee},currentTarget:{value:ee},preventDefault:()=>{},stopPropagation:()=>{}}),[]),U=v.useCallback(ee=>{if(!x?.length)return[ee.trim()].filter(Boolean);const le=x.map(ce=>ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ge=new RegExp(`[${le.join("")}]`);return ee.split(ge).map(ce=>ce.trim()).filter(Boolean)},[x]),W=v.useCallback((ee,le)=>{if(le.action!=="input-change"){L(ee);return}if(S&&S(z(ee)),!x?.some(me=>ee.includes(me))||!r||!y){L(ee);return}const ye=U(ee).filter(me=>me&&!E.includes(me));if(ye.length>0){const me=l?l-E.length:1/0,pe=ye.slice(0,me);if(pe.length>0){const ke=[...E,...pe];A(ke),n(z(ke))}}L("")},[x,r,y,U,E,l,n,z,S]),G=v.useCallback(ee=>{if(!M||!r||!y)return;const le=ee.clipboardData.getData("text"),ge=U(le);if(ge.length<=1)return;ee.preventDefault();const ce=ge.filter(ye=>ye&&!E.includes(ye));if(ce.length>0){const ye=l?l-E.length:1/0,me=ce.slice(0,ye);if(me.length>0){const pe=[...E,...me];A(pe),n(z(pe))}}},[M,r,y,U,E,l,n,z]),B=v.useCallback((ee,le)=>{if((le.action==="remove-value"||le.action==="pop-value")&&le.removedValue&&d){const ce=d(le.removedValue);if(ce!==!0){const ye=typeof ce=="string"?ce:`"${le.removedValue.label}"은(는) 제거할 수 없습니다.`;alert(ye);return}}if(l&&ee.length>l)return;const ge=ee.map(ce=>ce.value);A(ge),n(z(ge))},[n,d,l,z]),j=v.useCallback((ee,le)=>{if(le.action==="clear"&&E.length>0&&d){const ye=t.find(pe=>pe.value===E[0])||{value:E[0],label:String(E[0])},me=d(ye);if(me!==!0){const pe=typeof me=="string"?me:`"${ye.label}"은(는) 제거할 수 없습니다.`;alert(pe);return}}const ge=ee?ee.value:null,ce=ee?[ee.value]:[];A(ce),n(z(ge))},[n,d,E,t,z]),Y=v.useCallback(ee=>{u&&u(ee);const le=[...E||[],ee];A(le),n(z(le))},[n,u,E,z]),V=v.useCallback(ee=>!ee||!ee.trim()?!1:!E?.includes(ee.trim()),[E]),X=v.useCallback(ee=>{const le=P.trim();if(ee.key==="Tab"&&r&&y&&le){if(E.includes(le))ee.preventDefault(),L("");else if(!l||E.length<l){ee.preventDefault();const ge=[...E,le];A(ge),n(z(ge)),L("")}return}ee.key==="Enter"&&(!le||E&&E.includes(le))&&(ee.preventDefault(),ee.stopPropagation())},[E,P,r,y,l,n,z]),K=v.useCallback(ee=>g&&g[ee]?g[ee]:m,[g,m]),q={control:()=>`${zt.control} ${f} ${C?"opacity-60 cursor-not-allowed":""}`,valueContainer:()=>zt.valueContainer,multiValue:ee=>{const le=K(ee.data.value);return zt.multiValue[le]},multiValueLabel:ee=>{const le=K(ee.data.value);return zt.multiValueLabel[le]},multiValueRemove:ee=>{const le=K(ee.data.value);return`${zt.multiValueRemove[le]} ${C?"pointer-events-none":""}`},singleValue:()=>"text-gray-900 dark:text-white text-sm",input:()=>zt.input,placeholder:()=>zt.placeholder,menu:()=>zt.menu,menuList:()=>zt.menuList,menuPortal:()=>"z-[9999]",option:ee=>`${zt.option.base} ${ee.isSelected?zt.option.selected:ee.isFocused?zt.option.focused:zt.option.default}`,noOptionsMessage:()=>zt.noOptionsMessage,clearIndicator:()=>"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer px-1",dropdownIndicator:()=>"text-gray-400 dark:text-gray-500 px-1"},ne={options:T,onKeyDown:X,placeholder:s,noOptionsMessage:()=>o,isDisabled:C,isSearchable:_,menuIsOpen:void 0,openMenuOnClick:!0,openMenuOnFocus:!0,menuPortalTarget:typeof document<"u"?document.body:null,menuPosition:"fixed",classNamePrefix:"tag-input",unstyled:!0,classNames:q,styles:{menuPortal:ee=>({...ee,zIndex:9999})},...r&&y||S?{inputValue:P,onInputChange:W}:{}},te=y?E.join(","):E[0]??"";if(!y){const ee={...ne,isMulti:!1,value:O[0]||null,onChange:j,isClearable:b,closeMenuOnSelect:!0,components:{Option:fh,GroupHeading:hh,IndicatorSeparator:()=>null,...b?{}:{ClearIndicator:()=>null}}};return r?h.jsxs(I,{id:k,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:te}),h.jsx(uh,{...ee,onCreateOption:Y,formatCreateLabel:D,isValidNewOption:V,createOptionPosition:"first"})]}):h.jsxs(I,{id:k,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:te}),h.jsx(ch,{...ee})]})}const fe={...ne,isMulti:!0,value:O,onChange:B,closeMenuOnSelect:!1,hideSelectedOptions:!1,backspaceRemovesValue:!1,isClearable:!1,components:{Option:fh,GroupHeading:hh,MultiValueLabel:cC,ClearIndicator:()=>null,DropdownIndicator:()=>null,IndicatorSeparator:()=>null}};return r?h.jsxs(I,{id:k,...N,onPaste:G,children:[p&&h.jsx("input",{type:"hidden",name:p,value:te}),h.jsx(uh,{...fe,onCreateOption:Y,formatCreateLabel:D,isValidNewOption:V,createOptionPosition:"first"})]}):h.jsxs(I,{id:k,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:te}),h.jsx(ch,{...fe})]})},is=(e,t)=>window.G7Core?.t?.(e,t)??e,uC=()=>window.G7Core?.locale?.supported?.()??["ko","en"],fC=()=>window.G7Core?.locale?.current?.()??"ko",Yl=e=>{const t=is(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},hC=({value:e=[],onChange:t,placeholder:n="입력 후 Enter",disabled:r=!1,creatable:s=!0,delimiters:o=[","],className:i="",name:a,error:l,maxItems:c,modalId:d,statePath:u,__componentContext:f,id:g,editorAttrs:m})=>{const p=v.useMemo(()=>uC(),[]),y=v.useMemo(()=>fC(),[]),[b,_]=v.useState(()=>e||[]),[x,M]=v.useState(""),[S,k]=v.useState(!1),[N,C]=v.useState(null),[w,E]=v.useState({}),A=v.useRef(null),P=v.useRef(void 0);v.useEffect(()=>{const V=(K,q)=>!K&&!q?!0:!K||!q||K.length!==q.length?!1:JSON.stringify(K)===JSON.stringify(q),X=e||[];V(X,P.current)||(_(X),P.current=X)},[e]);const L=v.useCallback(V=>({target:{name:a,value:V},currentTarget:{name:a,value:V},preventDefault:()=>{},stopPropagation:()=>{}}),[a]),$=v.useCallback(V=>{const X=[];for(const K of p){const q=V[K];q?.trim()&&X.push(`${K.toUpperCase()}: ${q}`)}return X.length>0?X.join(" / "):""},[p]),D=v.useCallback(V=>{const X=b.filter((K,q)=>q!==V);_(X),t?.(L(X))},[b,t,L]),O=v.useCallback((V,X,K)=>{const q=window.G7Core;if(!q?.dispatch)return;const ne=p.map(te=>({code:te,label:Yl(te)}));q.dispatch({handler:"setState",params:{target:"global",multilingualTagEdit:{fieldName:a,editingIndex:V,values:X,supportedLocales:ne,defaultLocale:y,statePath:u,currentTags:K}}}),q.dispatch({handler:"openModal",target:d},{componentContext:f})},[a,p,y,d,u,f]),T=v.useCallback(V=>{r||(d?O(V,{...b[V]},b):(C(V),E({...b[V]}),k(!0)))},[r,b,d,O]),z=v.useCallback((V="")=>{const X={};p.forEach(K=>{X[K]=K===y?V:""}),d?(O(null,X,b),M("")):(C(null),E(X),k(!0),M(""))},[p,y,d,O,b]),U=v.useCallback(()=>{if(!Object.values(w).some(K=>K.trim()!=="")){k(!1);return}let X;N!==null?X=b.map((K,q)=>q===N?w:K):X=[...b,w],_(X),t?.(L(X)),k(!1),E({}),C(null)},[w,N,b,t,L]),W=v.useCallback(()=>{k(!1),E({}),C(null)},[]),G=v.useCallback(V=>{const X=V.target.value;if(o.some(q=>X.includes(q))&&s){const q=o.map(fe=>fe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ne=new RegExp(`[${q.join("")}]`),te=X.split(ne).map(fe=>fe.trim()).filter(Boolean);if(te.length>0){z(te[0]);return}}M(X)},[o,s,z]),B=v.useCallback(V=>{if(V.key==="Enter"&&x.trim()&&s){if(V.preventDefault(),c&&b.length>=c)return;z(x.trim())}},[x,s,c,b.length,z]),j=v.useCallback((V,X)=>{E(K=>({...K,[V]:X}))},[]),Y=!!l;return h.jsxs(I,{className:i,id:g,...m,children:[h.jsxs(I,{className:`flex flex-wrap gap-1.5 p-2 border rounded-lg bg-white dark:bg-gray-700 min-h-[42px] ${Y?"border-red-500 dark:border-red-400":"border-gray-300 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500"} ${r?"opacity-60 bg-gray-100 dark:bg-gray-800 cursor-not-allowed":""}`,children:[b.map((V,X)=>h.jsxs(I,{className:"flex items-center gap-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded px-2 py-0.5 text-sm",children:[h.jsx(J,{className:`cursor-pointer hover:underline ${r?"cursor-not-allowed":""}`,onClick:()=>T(X),children:$(V)}),!r&&h.jsx(ae,{type:"button",className:"p-0 h-4 w-4 min-w-0 border-0 bg-transparent text-blue-600 dark:text-blue-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-transparent",onClick:K=>{K.stopPropagation(),D(X)},children:h.jsx(oe,{name:"times",className:"text-xs"})})]},X)),s&&!r&&(!c||b.length<c)&&h.jsx("input",{ref:A,type:"text",value:x,onChange:G,onKeyDown:B,placeholder:b.length===0?n:"",disabled:r,className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"})]}),l&&h.jsx(J,{className:"text-xs text-red-500 dark:text-red-400 mt-1",children:l}),!d&&h.jsx(Zo,{isOpen:S,onClose:W,title:is(N!==null?"common.edit":"common.add"),width:"400px",children:h.jsxs(I,{className:"space-y-4 p-4",children:[p.map(V=>h.jsxs(I,{className:"space-y-1",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(J,{className:"text-sm font-medium text-gray-700 dark:text-gray-300 w-16",children:Yl(V)}),h.jsxs(J,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",V.toUpperCase(),")"]})]}),h.jsx(kt,{type:"text",value:w[V]??"",onChange:X=>j(V,X.target.value),placeholder:`${Yl(V)} 값 입력`,className:"w-full",autoFocus:V===y})]},V)),h.jsxs(I,{className:"flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700",children:[h.jsx(ae,{type:"button",variant:"secondary",onClick:W,children:is("common.cancel")}),h.jsx(ae,{type:"button",variant:"primary",onClick:U,children:is(N!==null?"common.save":"common.add")})]})]})}),a&&h.jsx("input",{type:"hidden",name:a,value:JSON.stringify(b)})]})},gh=(e,t)=>window.G7Core?.t?.(e,t)??e,ph=({type:e,identifier:t,name:n,installedModules:r=[],installedPlugins:s=[],className:o="",style:i,id:a,editorAttrs:l})=>{const c={module:ue.Cubes,plugin:ue.PuzzlePiece},d={module:gh("common.module"),plugin:gh("common.plugin")},u=v.useMemo(()=>{if(n)return n;if(t){const p=(e==="module"?r:s)?.find(y=>y.identifier===t);if(p)return p.name}},[n,t,e,r,s]),f=c[e],g=u?`${u} ${d[e]}`:d[e];return h.jsxs(J,{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium text-gray-400 dark:text-gray-500 ${o}`,style:i,id:a,...l,children:[h.jsx(oe,{name:f,className:"w-3.5 h-3.5"}),h.jsx(J,{children:g})]})},gC=({options:e=[],value:t,onChange:n,multiple:r=!1,searchPlaceholder:s="Search...",onSearch:o,noResultsText:i="No results found",initialText:a="Type to search",triggerLabel:l="Select",triggerIcon:c,disabled:d=!1,className:u="",id:f,editorAttrs:g})=>{const[m,p]=v.useState(!1),[y,b]=v.useState(""),_=v.useRef(null),x=v.useRef(null),M=v.useRef(`searchable-dropdown-input-${Math.random().toString(36).slice(2,9)}`).current,S=v.useMemo(()=>t==null?[]:Array.isArray(t)?t:[t],[t]),k=v.useMemo(()=>{if(!y.trim())return e;const D=y.toLowerCase();return e.filter(O=>O.label.toLowerCase().includes(D)||O.description?.toLowerCase().includes(D))},[e,y]),N=v.useMemo(()=>{if(S.length===0)return l;if(r){const O=S.length;return O===1?e.find(z=>String(z.value)===String(S[0]))?.label||l:`${O} selected`}return e.find(O=>String(O.value)===String(S[0]))?.label||l},[S,e,r,l]);v.useEffect(()=>{const D=O=>{_.current&&!_.current.contains(O.target)&&p(!1)};return m&&document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[m]),v.useEffect(()=>{const D=O=>{O.key==="Escape"&&m&&(p(!1),x.current?.focus())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[m]),v.useEffect(()=>{if(!m){b("");return}const D=setTimeout(()=>{document.getElementById(M)?.focus()},50);return()=>{clearTimeout(D)}},[m,M]);const C=v.useCallback(()=>{d||p(D=>!D)},[d]),w=v.useCallback(D=>{const O=D.target.value;b(O),o?.(O)},[o]),E=v.useCallback(D=>{if(r){const T=S.some(z=>String(z)===String(D))?S.filter(z=>String(z)!==String(D)):[...S,D];n?.(T)}else n?.(D),p(!1),x.current?.focus()},[r,S,n]),A=D=>S.some(O=>String(O)===String(D)),P=y.length===0&&e.length===0,L=y.length>0&&k.length===0,$=k.length>0;return h.jsxs(I,{ref:_,className:`relative inline-block ${u}`,id:f,...g,children:[h.jsxs(ae,{ref:x,type:"button",onClick:C,disabled:d,className:`
|
||
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
|
||
flex items-center justify-between gap-2
|
||
text-left cursor-pointer
|
||
disabled:opacity-50 disabled:cursor-not-allowed
|
||
min-w-[200px]
|
||
`,"aria-haspopup":"listbox","aria-expanded":m,children:[h.jsxs(I,{className:"flex items-center gap-2",children:[c,h.jsx(J,{className:"truncate",children:N})]}),h.jsx(Xn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${m?"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"})})]}),m&&h.jsxs(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden min-w-[280px]",role:"listbox",children:[h.jsx(I,{className:"p-3 border-b border-gray-200 dark:border-gray-700",children:h.jsx("input",{id:M,type:"text",value:y,onChange:w,placeholder:s,className:"w-full px-3 py-2 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent focus:outline-none"})}),h.jsxs(I,{className:"max-h-80 overflow-auto",children:[P&&h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:a}),L&&h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:i}),$&&h.jsx(I,{className:"py-2",children:k.map(D=>{const O=A(D.value);return h.jsxs(ae,{type:"button",onClick:()=>!D.disabled&&E(D.value),disabled:D.disabled,className:`
|
||
w-full px-4 py-3 text-left
|
||
flex items-start gap-3
|
||
hover:bg-gray-100 dark:hover:bg-gray-700
|
||
transition-colors
|
||
${D.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}
|
||
`,role:"option","aria-selected":O,children:[h.jsx(I,{className:"w-5 h-5 flex-shrink-0 mt-0.5",children:O&&h.jsx(Xn,{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"})})}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`font-medium ${O?"text-blue-600 dark:text-blue-400":"text-gray-900 dark:text-white"}`,children:D.label}),D.description&&h.jsx(I,{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:D.description})]})]},D.value)})})]})]})]})},Qs={container:{base:"tag-select",disabled:"opacity-50 cursor-not-allowed"},tag:"tag",tagRemove:"tag-remove",placeholder:"tag-select-placeholder"},pC=({options:e=[],value:t=[],onChange:n,placeholder:r="No items selected",disabled:s=!1,className:o="",id:i,editorAttrs:a})=>{const l=v.useCallback(f=>e.find(m=>String(m.value)===String(f))?.label||String(f),[e]),c=v.useCallback(f=>{if(s)return;const g=t.filter(m=>String(m)!==String(f));n?.(g)},[t,n,s]),d=v.useMemo(()=>t.map(f=>({value:f,label:l(f)})),[t,l]),u=`${Qs.container.base} ${s?Qs.container.disabled:""} ${o}`.trim();return h.jsx(I,{className:u,id:i,...a,children:d.length===0?h.jsx(J,{className:Qs.placeholder,children:r}):d.map(f=>h.jsxs(J,{className:Qs.tag,children:[f.label,!s&&h.jsx(J,{className:Qs.tagRemove,onClick:()=>c(f.value),role:"button","aria-label":`Remove ${f.label}`,children:h.jsx(Xn,{className:"w-3 h-3",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"})})})]},f.value))})};function mC(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const Si=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function as(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Xl(e){return"nodeType"in e}function Kt(e){var t,n;return e?as(e)?e:Xl(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Kl(e){const{Document:t}=Kt(e);return e instanceof t}function Js(e){return as(e)?!1:e instanceof Kt(e).HTMLElement}function mh(e){return e instanceof Kt(e).SVGElement}function ls(e){return e?as(e)?e.document:Xl(e)?Kl(e)?e:Js(e)||mh(e)?e.ownerDocument:document:document:document}const En=Si?v.useLayoutEffect:v.useEffect;function _i(e){const t=v.useRef(e);return En(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function bC(){const e=v.useRef(null),t=v.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Rs(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return En(()=>{n.current!==e&&(n.current=e)},t),n}function eo(e,t){const n=v.useRef();return v.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ei(e){const t=_i(e),n=v.useRef(null),r=v.useCallback(s=>{s!==n.current&&t?.(s,n.current),n.current=s},[]);return[n,r]}function Mi(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let ql={};function to(e,t){return v.useMemo(()=>{if(t)return t;const n=ql[e]==null?0:ql[e]+1;return ql[e]=n,e+"-"+n},[e,t])}function bh(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((o,i)=>{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+e*c)}return o},{...t})}}const cs=bh(1),no=bh(-1);function yC(e){return"clientX"in e&&"clientY"in e}function Ni(e){if(!e)return!1;const{KeyboardEvent:t}=Kt(e.target);return t&&e instanceof t}function vC(e){if(!e)return!1;const{TouchEvent:t}=Kt(e.target);return t&&e instanceof t}function Ti(e){if(vC(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return yC(e)?{x:e.clientX,y:e.clientY}:null}const Un=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Un.Translate.toString(e),Un.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),yh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function xC(e){return e.matches(yh)?e:e.querySelector(yh)}const wC={display:"none"};function kC(e){let{id:t,value:n}=e;return v.createElement("div",{id:t,style:wC},n)}function CC(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={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 v.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function SC(){const[e,t]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const vh=v.createContext(null);function _C(e){const t=v.useContext(vh);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function EC(){const[e]=v.useState(()=>new Set),t=v.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[v.useCallback(r=>{let{type:s,event:o}=r;e.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[e]),t]}const MC={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.
|
||
`},NC={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function TC(e){let{announcements:t=NC,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=MC}=e;const{announce:o,announcement:i}=SC(),a=to("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),_C(v.useMemo(()=>({onDragStart(u){let{active:f}=u;o(t.onDragStart({active:f}))},onDragMove(u){let{active:f,over:g}=u;t.onDragMove&&o(t.onDragMove({active:f,over:g}))},onDragOver(u){let{active:f,over:g}=u;o(t.onDragOver({active:f,over:g}))},onDragEnd(u){let{active:f,over:g}=u;o(t.onDragEnd({active:f,over:g}))},onDragCancel(u){let{active:f,over:g}=u;o(t.onDragCancel({active:f,over:g}))}}),[o,t])),!l)return null;const d=v.createElement(v.Fragment,null,v.createElement(kC,{id:r,value:s.draggable}),v.createElement(CC,{id:a,announcement:i}));return n?Ln.createPortal(d,n):d}var Et;(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"})(Et||(Et={}));function Oi(){}function ds(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Zl(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Mn=Object.freeze({x:0,y:0});function xh(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function OC(e,t){const n=Ti(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function wh(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function AC(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function kh(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function Ch(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Sh(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Ql=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=Sh(t,t.left,t.top),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=xh(Sh(l),s);o.push({id:a,data:{droppableContainer:i,value:c}})}}return o.sort(wh)},DC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=kh(t),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=kh(l),d=s.reduce((f,g,m)=>f+xh(c[m],g),0),u=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(wh)};function IC(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),i=s-r,a=o-n;if(r<s&&n<o){const l=t.width*t.height,c=e.width*e.height,d=i*a,u=d/(l+c-d);return Number(u.toFixed(4))}return 0}const LC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const o of r){const{id:i}=o,a=n.get(i);if(a){const l=IC(a,t);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(AC)};function PC(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function _h(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Mn}function $C(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return s.reduce((i,a)=>({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...n})}}const FC=$C(1);function Eh(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 zC(e,t,n){const r=Eh(t);if(!r)return e;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=e.left-i-(1-s)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?e.width/s:e.width,u=o?e.height/o:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}const VC={ignoreTransform:!1};function us(e,t){t===void 0&&(t=VC);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:d}=Kt(e).getComputedStyle(e);c&&(n=zC(n,c,d))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=n;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function Mh(e){return us(e,{ignoreTransform:!0})}function HC(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function UC(e,t){return t===void 0&&(t=Kt(e).getComputedStyle(e)),t.position==="fixed"}function BC(e,t){t===void 0&&(t=Kt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=t[s];return typeof o=="string"?n.test(o):!1})}function Ai(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(Kl(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Js(s)||mh(s)||n.includes(s))return n;const o=Kt(e).getComputedStyle(s);return s!==e&&BC(s,o)&&n.push(s),UC(s,o)?n:r(s.parentNode)}return e?r(e):n}function Nh(e){const[t]=Ai(e,1);return t??null}function Jl(e){return!Si||!e?null:as(e)?e:Xl(e)?Kl(e)||e===ls(e).scrollingElement?window:Js(e)?e:null:null}function Th(e){return as(e)?e.scrollX:e.scrollLeft}function Oh(e){return as(e)?e.scrollY:e.scrollTop}function Rl(e){return{x:Th(e),y:Oh(e)}}var Ot;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ot||(Ot={}));function Ah(e){return!Si||!e?!1:e===document.scrollingElement}function Dh(e){const t={x:0,y:0},n=Ah(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:t}}const jC={x:.2,y:.2};function WC(e,t,n,r,s){let{top:o,left:i,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=jC);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=Dh(e),g={x:0,y:0},m={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!c&&o<=t.top+p.height?(g.y=Ot.Backward,m.y=r*Math.abs((t.top+p.height-o)/p.height)):!d&&l>=t.bottom-p.height&&(g.y=Ot.Forward,m.y=r*Math.abs((t.bottom-p.height-l)/p.height)),!f&&a>=t.right-p.width?(g.x=Ot.Forward,m.x=r*Math.abs((t.right-p.width-a)/p.width)):!u&&i<=t.left+p.width&&(g.x=Ot.Backward,m.x=r*Math.abs((t.left+p.width-i)/p.width)),{direction:g,speed:m}}function GC(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Ih(e){return e.reduce((t,n)=>cs(t,Rl(n)),Mn)}function YC(e){return e.reduce((t,n)=>t+Th(n),0)}function XC(e){return e.reduce((t,n)=>t+Oh(n),0)}function Lh(e,t){if(t===void 0&&(t=us),!e)return;const{top:n,left:r,bottom:s,right:o}=t(e);Nh(e)&&(s<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const KC=[["x",["left","right"],YC],["y",["top","bottom"],XC]];class ec{constructor(t,n){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 r=Ai(n),s=Ih(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,i,a]of KC)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=s[o]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ro{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function qC(e){const{EventTarget:t}=Kt(e);return e instanceof t?e:ls(e)}function tc(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var hn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(hn||(hn={}));function Ph(e){e.preventDefault()}function ZC(e){e.stopPropagation()}var Xe;(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"})(Xe||(Xe={}));const $h={start:[Xe.Space,Xe.Enter],cancel:[Xe.Esc],end:[Xe.Space,Xe.Enter,Xe.Tab]},QC=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Xe.Right:return{...n,x:n.x+25};case Xe.Left:return{...n,x:n.x-25};case Xe.Down:return{...n,y:n.y+25};case Xe.Up:return{...n,y:n.y-25}}};class so{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:n}}=t;this.props=t,this.listeners=new ro(ls(n)),this.windowListeners=new ro(Kt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(hn.Resize,this.handleCancel),this.windowListeners.add(hn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(hn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Lh(r),n(Mn)}handleKeyDown(t){if(Ni(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:o=$h,coordinateGetter:i=QC,scrollBehavior:a="smooth"}=s,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:Mn;this.referenceCoordinates||(this.referenceCoordinates=d);const u=i(t,{active:n,context:r.current,currentCoordinates:d});if(u){const f=no(u,d),g={x:0,y:0},{scrollableAncestors:m}=r.current;for(const p of m){const y=t.code,{isTop:b,isRight:_,isLeft:x,isBottom:M,maxScroll:S,minScroll:k}=Dh(p),N=GC(p),C={x:Math.min(y===Xe.Right?N.right-N.width/2:N.right,Math.max(y===Xe.Right?N.left:N.left+N.width/2,u.x)),y:Math.min(y===Xe.Down?N.bottom-N.height/2:N.bottom,Math.max(y===Xe.Down?N.top:N.top+N.height/2,u.y))},w=y===Xe.Right&&!_||y===Xe.Left&&!x,E=y===Xe.Down&&!M||y===Xe.Up&&!b;if(w&&C.x!==u.x){const A=p.scrollLeft+f.x,P=y===Xe.Right&&A<=S.x||y===Xe.Left&&A>=k.x;if(P&&!f.y){p.scrollTo({left:A,behavior:a});return}P?g.x=p.scrollLeft-A:g.x=y===Xe.Right?p.scrollLeft-S.x:p.scrollLeft-k.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(E&&C.y!==u.y){const A=p.scrollTop+f.y,P=y===Xe.Down&&A<=S.y||y===Xe.Up&&A>=k.y;if(P&&!f.x){p.scrollTo({top:A,behavior:a});return}P?g.y=p.scrollTop-A:g.y=y===Xe.Down?p.scrollTop-S.y:p.scrollTop-k.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,cs(no(u,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}so.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=$h,onActivation:s}=t,{active:o}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function Fh(e){return!!(e&&"distance"in e)}function zh(e){return!!(e&&"delay"in e)}class nc{constructor(t,n,r){var s;r===void 0&&(r=qC(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=n;const{event:o}=t,{target:i}=o;this.props=t,this.events=n,this.document=ls(i),this.documentListeners=new ro(this.document),this.listeners=new ro(r),this.windowListeners=new ro(Kt(i)),this.initialCoordinates=(s=Ti(o))!=null?s:Mn,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:n,bypassActivationConstraint:r}}}=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(hn.Resize,this.handleCancel),this.windowListeners.add(hn.DragStart,Ph),this.windowListeners.add(hn.VisibilityChange,this.handleCancel),this.windowListeners.add(hn.ContextMenu,Ph),this.documentListeners.add(hn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zh(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Fh(n)){this.handlePending(n);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,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(hn.Click,ZC,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(hn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(n=Ti(t))!=null?n:Mn,c=no(s,l);if(!r&&a){if(Fh(a)){if(a.tolerance!=null&&tc(c,a.tolerance))return this.handleCancel();if(tc(c,a.distance))return this.handleStart()}if(zh(a)&&tc(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Xe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const JC={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class oo extends nc{constructor(t){const{event:n}=t,r=ls(n.target);super(t,JC,r)}}oo.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const RC={move:{name:"mousemove"},end:{name:"mouseup"}};var rc;(function(e){e[e.RightClick=2]="RightClick"})(rc||(rc={}));class eS extends nc{constructor(t){super(t,RC,ls(t.event.target))}}eS.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===rc.RightClick?!1:(r?.({event:n}),!0)}}];const sc={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class tS extends nc{constructor(t){super(t,sc)}static setup(){return window.addEventListener(sc.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(sc.move.name,t)};function t(){}}}tS.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var io;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(io||(io={}));var Di;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Di||(Di={}));function nS(e){let{acceleration:t,activator:n=io.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=Di.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:f}=e;const g=sS({delta:u,disabled:!o}),[m,p]=bC(),y=v.useRef({x:0,y:0}),b=v.useRef({x:0,y:0}),_=v.useMemo(()=>{switch(n){case io.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case io.DraggableRect:return s}},[n,s,l]),x=v.useRef(null),M=v.useCallback(()=>{const k=x.current;if(!k)return;const N=y.current.x*b.current.x,C=y.current.y*b.current.y;k.scrollBy(N,C)},[]),S=v.useMemo(()=>a===Di.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!_){p();return}for(const k of S){if(r?.(k)===!1)continue;const N=c.indexOf(k),C=d[N];if(!C)continue;const{direction:w,speed:E}=WC(k,C,_,t,f);for(const A of["x","y"])g[A][w[A]]||(E[A]=0,w[A]=0);if(E.x>0||E.y>0){p(),x.current=k,m(M,i),y.current=E,b.current=w;return}}y.current={x:0,y:0},b.current={x:0,y:0},p()},[t,M,r,p,o,i,JSON.stringify(_),JSON.stringify(g),m,c,S,d,JSON.stringify(f)])}const rS={x:{[Ot.Backward]:!1,[Ot.Forward]:!1},y:{[Ot.Backward]:!1,[Ot.Forward]:!1}};function sS(e){let{delta:t,disabled:n}=e;const r=Mi(t);return eo(s=>{if(n||!r||!s)return rS;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Ot.Backward]:s.x[Ot.Backward]||o.x===-1,[Ot.Forward]:s.x[Ot.Forward]||o.x===1},y:{[Ot.Backward]:s.y[Ot.Backward]||o.y===-1,[Ot.Forward]:s.y[Ot.Forward]||o.y===1}}},[n,t,r])}function oS(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return eo(s=>{var o;return t==null?null:(o=r??s)!=null?o:null},[r,t])}function iS(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...o]},[]),[e,t])}var ao;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ao||(ao={}));var oc;(function(e){e.Optimized="optimized"})(oc||(oc={}));const Vh=new Map;function aS(e,t){let{dragging:n,dependencies:r,config:s}=t;const[o,i]=v.useState(null),{frequency:a,measure:l,strategy:c}=s,d=v.useRef(e),u=y(),f=Rs(u),g=v.useCallback(function(b){b===void 0&&(b=[]),!f.current&&i(_=>_===null?b:_.concat(b.filter(x=>!_.includes(x))))},[f]),m=v.useRef(null),p=eo(b=>{if(u&&!n)return Vh;if(!b||b===Vh||d.current!==e||o!=null){const _=new Map;for(let x of e){if(!x)continue;if(o&&o.length>0&&!o.includes(x.id)&&x.rect.current){_.set(x.id,x.rect.current);continue}const M=x.node.current,S=M?new ec(l(M),M):null;x.rect.current=S,S&&_.set(x.id,S)}return _}return b},[e,o,n,u,l]);return v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>{u||g()},[n,u]),v.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),v.useEffect(()=>{u||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},a))},[a,u,g,...r]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:o!=null};function y(){switch(c){case ao.Always:return!1;case ao.BeforeDragging:return n;default:return!n}}}function ic(e,t){return eo(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lS(e,t){return ic(e,t)}function cS(e){let{callback:t,disabled:n}=e;const r=_i(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function Ii(e){let{callback:t,disabled:n}=e;const r=_i(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function dS(e){return new ec(us(e),e)}function Hh(e,t,n){t===void 0&&(t=dS);const[r,s]=v.useState(null);function o(){s(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=t(e);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=cS({callback(l){if(e)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(e)){o();break}}}}),a=Ii({callback:o});return En(()=>{o(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function uS(e){const t=ic(e);return _h(e,t)}const Uh=[];function fS(e){const t=v.useRef(e),n=eo(r=>e?r&&r!==Uh&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ai(e):Uh,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function hS(e){const[t,n]=v.useState(null),r=v.useRef(e),s=v.useCallback(o=>{const i=Jl(o.target);i&&n(a=>a?(a.set(i,Rl(i)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(e!==o){i(o);const a=e.map(l=>{const c=Jl(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,Rl(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const c=Jl(l);c?.removeEventListener("scroll",s)})}},[s,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>cs(o,i),Mn):Ih(e):Mn,[e,t])}function Bh(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==Mn;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?no(e,n.current):Mn}function gS(e){v.useEffect(()=>{if(!Si)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function pS(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:o}=r;return n[s]=i=>{o(i,t)},n},{}),[e,t])}function jh(e){return v.useMemo(()=>e?HC(e):null,[e])}const Wh=[];function mS(e,t){t===void 0&&(t=us);const[n]=e,r=jh(n?Kt(n):null),[s,o]=v.useState(Wh);function i(){o(()=>e.length?e.map(l=>Ah(l)?r:new ec(t(l),l)):Wh)}const a=Ii({callback:i});return En(()=>{a?.disconnect(),i(),e.forEach(l=>a?.observe(l))},[e]),s}function Gh(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Js(t)?t:e}function bS(e){let{measure:t}=e;const[n,r]=v.useState(null),s=v.useCallback(c=>{for(const{target:d}of c)if(Js(d)){r(u=>{const f=t(d);return u?{...u,width:f.width,height:f.height}:f});break}},[t]),o=Ii({callback:s}),i=v.useCallback(c=>{const d=Gh(c);o?.disconnect(),d&&o?.observe(d),r(d?t(d):null)},[t,o]),[a,l]=Ei(i);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const yS=[{sensor:oo,options:{}},{sensor:so,options:{}}],vS={current:{}},Li={draggable:{measure:Mh},droppable:{measure:Mh,strategy:ao.WhileDragging,frequency:oc.Optimized},dragOverlay:{measure:us}};class lo extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const xS={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new lo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Oi},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Li,measureDroppableContainers:Oi,windowRect:null,measuringScheduled:!1},Yh={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Oi,draggableNodes:new Map,over:null,measureDroppableContainers:Oi},co=v.createContext(Yh),Xh=v.createContext(xS);function wS(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new lo}}}function kS(e,t){switch(t.type){case Et.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Et.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 Et.DragEnd:case Et.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Et.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new lo(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case Et.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new lo(e.droppable.containers);return i.set(n,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case Et.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new lo(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function CS(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=v.useContext(co),o=Mi(r),i=Mi(n?.id);return v.useEffect(()=>{if(!t&&!r&&o&&i!=null){if(!Ni(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=xC(d);if(u){u.focus();break}}})}},[r,t,s,i,o]),null}function Kh(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,o)=>o({transform:s,...r}),n):n}function SS(e){return v.useMemo(()=>({draggable:{...Li.draggable,...e?.draggable},droppable:{...Li.droppable,...e?.droppable},dragOverlay:{...Li.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _S(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const o=v.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;En(()=>{if(!i&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const d=n(c),u=_h(d,r);if(i||(u.x=0),a||(u.y=0),o.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=Nh(c);f&&f.scrollBy({top:u.y,left:u.x})}},[t,i,a,r,n])}const Pi=v.createContext({...Mn,scaleX:1,scaleY:1});var cr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(cr||(cr={}));const ac=v.memo(function(t){var n,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:d=yS,collisionDetection:u=LC,measuring:f,modifiers:g,...m}=t;const p=v.useReducer(kS,void 0,wS),[y,b]=p,[_,x]=EC(),[M,S]=v.useState(cr.Uninitialized),k=M===cr.Initialized,{draggable:{active:N,nodes:C,translate:w},droppable:{containers:E}}=y,A=N!=null?C.get(N):null,P=v.useRef({initial:null,translated:null}),L=v.useMemo(()=>{var Le;return N!=null?{id:N,data:(Le=A?.data)!=null?Le:vS,rect:P}:null},[N,A]),$=v.useRef(null),[D,O]=v.useState(null),[T,z]=v.useState(null),U=Rs(m,Object.values(m)),W=to("DndDescribedBy",i),G=v.useMemo(()=>E.getEnabled(),[E]),B=SS(f),{droppableRects:j,measureDroppableContainers:Y,measuringScheduled:V}=aS(G,{dragging:k,dependencies:[w.x,w.y],config:B.droppable}),X=oS(C,N),K=v.useMemo(()=>T?Ti(T):null,[T]),q=Ke(),ne=lS(X,B.draggable.measure);_S({activeNode:N!=null?C.get(N):null,config:q.layoutShiftCompensation,initialRect:ne,measure:B.draggable.measure});const te=Hh(X,B.draggable.measure,ne),fe=Hh(X?X.parentElement:null),ee=v.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),le=E.getNodeFor((n=ee.current.over)==null?void 0:n.id),ge=bS({measure:B.dragOverlay.measure}),ce=(r=ge.nodeRef.current)!=null?r:X,ye=k?(s=ge.rect)!=null?s:te:null,me=!!(ge.nodeRef.current&&ge.rect),pe=uS(me?null:te),ke=jh(ce?Kt(ce):null),$e=fS(k?le??X:null),ie=mS($e),_e=Kh(g,{transform:{x:w.x-pe.x,y:w.y-pe.y,scaleX:1,scaleY:1},activatorEvent:T,active:L,activeNodeRect:te,containerNodeRect:fe,draggingNodeRect:ye,over:ee.current.over,overlayNodeRect:ge.rect,scrollableAncestors:$e,scrollableAncestorRects:ie,windowRect:ke}),Ae=K?cs(K,w):null,Ie=hS($e),Be=Bh(Ie),gt=Bh(Ie,[te]),mt=cs(_e,Be),Ge=ye?FC(ye,_e):null,ot=L&&Ge?u({active:L,collisionRect:Ge,droppableRects:j,droppableContainers:G,pointerCoordinates:Ae}):null,Fe=Ch(ot,"id"),[re,de]=v.useState(null),we=me?_e:cs(_e,gt),ve=PC(we,(o=re?.rect)!=null?o:null,te),xe=v.useRef(null),Ve=v.useCallback((Le,Ee)=>{let{sensor:ze,options:rt}=Ee;if($.current==null)return;const it=C.get($.current);if(!it)return;const Ye=Le.nativeEvent,at=new ze({active:$.current,activeNode:it,event:Ye,options:rt,context:ee,onAbort(bt){if(!C.get(bt))return;const{onDragAbort:dt}=U.current,Zt={id:bt};dt?.(Zt),_({type:"onDragAbort",event:Zt})},onPending(bt,qe,dt,Zt){if(!C.get(bt))return;const{onDragPending:Je}=U.current,Qt={id:bt,constraint:qe,initialCoordinates:dt,offset:Zt};Je?.(Qt),_({type:"onDragPending",event:Qt})},onStart(bt){const qe=$.current;if(qe==null)return;const dt=C.get(qe);if(!dt)return;const{onDragStart:Zt}=U.current,on={activatorEvent:Ye,active:{id:qe,data:dt.data,rect:P}};Ln.unstable_batchedUpdates(()=>{Zt?.(on),S(cr.Initializing),b({type:Et.DragStart,initialCoordinates:bt,active:qe}),_({type:"onDragStart",event:on}),O(xe.current),z(Ye)})},onMove(bt){b({type:Et.DragMove,coordinates:bt})},onEnd:xn(Et.DragEnd),onCancel:xn(Et.DragCancel)});xe.current=at;function xn(bt){return async function(){const{active:dt,collisions:Zt,over:on,scrollAdjustedTranslate:Je}=ee.current;let Qt=null;if(dt&&Je){const{cancelDrop:wn}=U.current;Qt={activatorEvent:Ye,active:dt,collisions:Zt,delta:Je,over:on},bt===Et.DragEnd&&typeof wn=="function"&&await Promise.resolve(wn(Qt))&&(bt=Et.DragCancel)}$.current=null,Ln.unstable_batchedUpdates(()=>{b({type:bt}),S(cr.Uninitialized),de(null),O(null),z(null),xe.current=null;const wn=bt===Et.DragEnd?"onDragEnd":"onDragCancel";if(Qt){const xr=U.current[wn];xr?.(Qt),_({type:wn,event:Qt})}})}}},[C]),De=v.useCallback((Le,Ee)=>(ze,rt)=>{const it=ze.nativeEvent,Ye=C.get(rt);if($.current!==null||!Ye||it.dndKit||it.defaultPrevented)return;const at={active:Ye};Le(ze,Ee.options,at)===!0&&(it.dndKit={capturedBy:Ee.sensor},$.current=rt,Ve(ze,Ee))},[C,Ve]),Ne=iS(d,De);gS(d),En(()=>{te&&M===cr.Initializing&&S(cr.Initialized)},[te,M]),v.useEffect(()=>{const{onDragMove:Le}=U.current,{active:Ee,activatorEvent:ze,collisions:rt,over:it}=ee.current;if(!Ee||!ze)return;const Ye={active:Ee,activatorEvent:ze,collisions:rt,delta:{x:mt.x,y:mt.y},over:it};Ln.unstable_batchedUpdates(()=>{Le?.(Ye),_({type:"onDragMove",event:Ye})})},[mt.x,mt.y]),v.useEffect(()=>{const{active:Le,activatorEvent:Ee,collisions:ze,droppableContainers:rt,scrollAdjustedTranslate:it}=ee.current;if(!Le||$.current==null||!Ee||!it)return;const{onDragOver:Ye}=U.current,at=rt.get(Fe),xn=at&&at.rect.current?{id:at.id,rect:at.rect.current,data:at.data,disabled:at.disabled}:null,bt={active:Le,activatorEvent:Ee,collisions:ze,delta:{x:it.x,y:it.y},over:xn};Ln.unstable_batchedUpdates(()=>{de(xn),Ye?.(bt),_({type:"onDragOver",event:bt})})},[Fe]),En(()=>{ee.current={activatorEvent:T,active:L,activeNode:X,collisionRect:Ge,collisions:ot,droppableRects:j,draggableNodes:C,draggingNode:ce,draggingNodeRect:ye,droppableContainers:E,over:re,scrollableAncestors:$e,scrollAdjustedTranslate:mt},P.current={initial:ye,translated:Ge}},[L,X,ot,Ge,C,ce,ye,j,E,re,$e,mt]),nS({...q,delta:w,draggingRect:Ge,pointerCoordinates:Ae,scrollableAncestors:$e,scrollableAncestorRects:ie});const Te=v.useMemo(()=>({active:L,activeNode:X,activeNodeRect:te,activatorEvent:T,collisions:ot,containerNodeRect:fe,dragOverlay:ge,draggableNodes:C,droppableContainers:E,droppableRects:j,over:re,measureDroppableContainers:Y,scrollableAncestors:$e,scrollableAncestorRects:ie,measuringConfiguration:B,measuringScheduled:V,windowRect:ke}),[L,X,te,T,ot,fe,ge,C,E,j,re,Y,$e,ie,B,V,ke]),He=v.useMemo(()=>({activatorEvent:T,activators:Ne,active:L,activeNodeRect:te,ariaDescribedById:{draggable:W},dispatch:b,draggableNodes:C,over:re,measureDroppableContainers:Y}),[T,Ne,L,te,b,W,C,re,Y]);return v.createElement(vh.Provider,{value:x},v.createElement(co.Provider,{value:He},v.createElement(Xh.Provider,{value:Te},v.createElement(Pi.Provider,{value:ve},c)),v.createElement(CS,{disabled:a?.restoreFocus===!1})),v.createElement(TC,{...a,hiddenTextDescribedById:W}));function Ke(){const Le=D?.autoScrollEnabled===!1,Ee=typeof l=="object"?l.enabled===!1:l===!1,ze=k&&!Le&&!Ee;return typeof l=="object"?{...l,enabled:ze}:{enabled:ze}}}),ES=v.createContext(null),qh="button",MS="Draggable";function NS(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const o=to(MS),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:f}=v.useContext(co),{role:g=qh,roleDescription:m="draggable",tabIndex:p=0}=s??{},y=l?.id===t,b=v.useContext(y?Pi:ES),[_,x]=Ei(),[M,S]=Ei(),k=pS(i,t),N=Rs(n);En(()=>(u.set(t,{id:t,key:o,node:_,activatorNode:M,data:N}),()=>{const w=u.get(t);w&&w.key===o&&u.delete(t)}),[u,t]);const C=v.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":r,"aria-pressed":y&&g===qh?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,g,p,y,m,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:C,isDragging:y,listeners:r?void 0:k,node:_,over:f,setNodeRef:x,setActivatorNodeRef:S,transform:b}}function Zh(){return v.useContext(Xh)}const TS="Droppable",OS={timeout:25};function AS(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const o=to(TS),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(co),d=v.useRef({disabled:n}),u=v.useRef(!1),f=v.useRef(null),g=v.useRef(null),{disabled:m,updateMeasurementsFor:p,timeout:y}={...OS,...s},b=Rs(p??r),_=v.useCallback(()=>{if(!u.current){u.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),g.current=null},y)},[y]),x=Ii({callback:_,disabled:m||!i}),M=v.useCallback((C,w)=>{x&&(w&&(x.unobserve(w),u.current=!1),C&&x.observe(C))},[x]),[S,k]=Ei(M),N=Rs(t);return v.useEffect(()=>{!x||!S.current||(x.disconnect(),u.current=!1,x.observe(S.current))},[S,x]),v.useEffect(()=>(a({type:Et.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:N}}),()=>a({type:Et.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==d.current.disabled&&(a({type:Et.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,a]),{active:i,rect:f,isOver:l?.id===r,node:S,over:l,setNodeRef:k}}function DS(e){let{animation:t,children:n}=e;const[r,s]=v.useState(null),[o,i]=v.useState(null),a=Mi(n);return!n&&!r&&a&&s(a),En(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){s(null);return}Promise.resolve(t(c,o)).then(()=>{s(null)})},[t,r,o]),v.createElement(v.Fragment,null,n,r?v.cloneElement(r,{ref:i}):null)}const IS={x:0,y:0,scaleX:1,scaleY:1};function LS(e){let{children:t}=e;return v.createElement(co.Provider,{value:Yh},v.createElement(Pi.Provider,{value:IS},t))}const PS={position:"fixed",touchAction:"none"},$S=e=>Ni(e)?"transform 250ms ease":void 0,FS=v.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:s,children:o,className:i,rect:a,style:l,transform:c,transition:d=$S}=e;if(!a)return null;const u=s?c:{...c,scaleX:1,scaleY:1},f={...PS,width:a.width,height:a.height,top:a.top,left:a.left,transform:Un.Transform.toString(u),transformOrigin:s&&r?OC(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return v.createElement(n,{className:i,style:f,ref:t},o)}),zS={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Un.Transform.toString(t)},{transform:Un.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t;const s={},{styles:o,className:i}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[l,c]of Object.entries(s))n.node.style.setProperty(l,c);i!=null&&i.active&&n.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function VS(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=e;return _i((o,i)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Gh(i);if(!c)return;const{transform:d}=Kt(i).getComputedStyle(i),u=Eh(d);if(!u)return;const f=typeof t=="function"?t:HS(t);return Lh(l,s.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:i,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:u})})}function HS(e){const{duration:t,easing:n,sideEffects:r,keyframes:s}={...zS,...e};return o=>{let{active:i,dragOverlay:a,transform:l,...c}=o;if(!t)return;const d={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},u={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-d.x,y:l.y-d.y,...u},g=s({...c,active:i,dragOverlay:a,transform:{initial:l,final:f}}),[m]=g,p=g[g.length-1];if(JSON.stringify(m)===JSON.stringify(p))return;const y=r?.({active:i,dragOverlay:a,...c}),b=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(_=>{b.onfinish=()=>{y?.(),_()}})}}let Qh=0;function US(e){return v.useMemo(()=>{if(e!=null)return Qh++,Qh},[e])}const BS=v.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:s,transition:o,modifiers:i,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggableNodes:m,droppableContainers:p,dragOverlay:y,over:b,measuringConfiguration:_,scrollableAncestors:x,scrollableAncestorRects:M,windowRect:S}=Zh(),k=v.useContext(Pi),N=US(u?.id),C=Kh(i,{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggingNodeRect:y.rect,over:b,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:M,transform:k,windowRect:S}),w=ic(f),E=VS({config:r,draggableNodes:m,droppableContainers:p,measuringConfiguration:_}),A=w?y.setRef:void 0;return v.createElement(LS,null,v.createElement(DS,{animation:E},u&&N?v.createElement(FS,{key:N,id:u.id,ref:A,as:a,activatorEvent:d,adjustScale:t,className:l,transition:o,rect:w,style:{zIndex:c,...s},transform:C},n):null))});function fs(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function jS(e,t){return e.reduce((n,r,s)=>{const o=t.get(r);return o&&(n[s]=o),n},Array(e.length))}function $i(e){return e!==null&&e>=0}function WS(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function GS(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Fi=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const o=fs(t,r,n),i=t[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},zi={scaleX:1,scaleY:1},lc=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:o,overIndex:i}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(s===n){const c=o[i];return c?{x:0,y:n<i?c.top+c.height-(a.top+a.height):c.top-a.top,...zi}:null}const l=YS(o,s,n);return s>n&&s<=i?{x:0,y:-a.height-l,...zi}:s<n&&s>=i?{x:0,y:a.height+l,...zi}:{x:0,y:0,...zi}};function YS(e,t,n){const r=e[t],s=e[t-1],o=e[t+1];return r?n<t?s?r.top-(s.top+s.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const Jh="Sortable",Rh=v.createContext({activeIndex:-1,containerId:Jh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fi,disabled:{draggable:!1,droppable:!1}});function Vi(e){let{children:t,id:n,items:r,strategy:s=Fi,disabled:o=!1}=e;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=Zh(),u=to(Jh,n),f=a.rect!==null,g=v.useMemo(()=>r.map(k=>typeof k=="object"&&"id"in k?k.id:k),[r]),m=i!=null,p=i?g.indexOf(i.id):-1,y=c?g.indexOf(c.id):-1,b=v.useRef(g),_=!WS(g,b.current),x=y!==-1&&p===-1||_,M=GS(o);En(()=>{_&&m&&d(g)},[_,g,m,d]),v.useEffect(()=>{b.current=g},[g]);const S=v.useMemo(()=>({activeIndex:p,containerId:u,disabled:M,disableTransforms:x,items:g,overIndex:y,useDragOverlay:f,sortedRects:jS(g,l),strategy:s}),[p,u,M.draggable,M.droppable,x,g,y,l,f,s]);return v.createElement(Rh.Provider,{value:S},t)}const eg=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return fs(n,r,s).indexOf(t)},tg=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&s===i?!1:n?!0:i!==s&&t===l},XS={duration:200,easing:"ease"},ng="transform",KS=Un.Transition.toString({property:ng,duration:0,easing:"linear"}),qS={roleDescription:"sortable"};function ZS(e){let{disabled:t,index:n,node:r,rect:s}=e;const[o,i]=v.useState(null),a=v.useRef(n);return En(()=>{if(!t&&n!==a.current&&r.current){const l=s.current;if(l){const c=us(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&i(d)}}n!==a.current&&(a.current=n)},[t,n,r,s]),v.useEffect(()=>{o&&i(null)},[o]),o}function Hi(e){let{animateLayoutChanges:t=tg,attributes:n,disabled:r,data:s,getNewIndex:o=eg,id:i,strategy:a,resizeObserverConfig:l,transition:c=XS}=e;const{items:d,containerId:u,activeIndex:f,disabled:g,disableTransforms:m,sortedRects:p,overIndex:y,useDragOverlay:b,strategy:_}=v.useContext(Rh),x=QS(r,g),M=d.indexOf(i),S=v.useMemo(()=>({sortable:{containerId:u,index:M,items:d},...s}),[u,s,M,d]),k=v.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:N,node:C,isOver:w,setNodeRef:E}=AS({id:i,data:S,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...l}}),{active:A,activatorEvent:P,activeNodeRect:L,attributes:$,setNodeRef:D,listeners:O,isDragging:T,over:z,setActivatorNodeRef:U,transform:W}=NS({id:i,data:S,attributes:{...qS,...n},disabled:x.draggable}),G=mC(E,D),B=!!A,j=B&&!m&&$i(f)&&$i(y),Y=!b&&T,V=Y&&j?W:null,K=j?V??(a??_)({rects:p,activeNodeRect:L,activeIndex:f,overIndex:y,index:M}):null,q=$i(f)&&$i(y)?o({id:i,items:d,activeIndex:f,overIndex:y}):M,ne=A?.id,te=v.useRef({activeId:ne,items:d,newIndex:q,containerId:u}),fe=d!==te.current.items,ee=t({active:A,containerId:u,isDragging:T,isSorting:B,id:i,index:M,items:d,newIndex:te.current.newIndex,previousItems:te.current.items,previousContainerId:te.current.containerId,transition:c,wasDragging:te.current.activeId!=null}),le=ZS({disabled:!ee,index:M,node:C,rect:N});return v.useEffect(()=>{B&&te.current.newIndex!==q&&(te.current.newIndex=q),u!==te.current.containerId&&(te.current.containerId=u),d!==te.current.items&&(te.current.items=d)},[B,q,u,d]),v.useEffect(()=>{if(ne===te.current.activeId)return;if(ne!=null&&te.current.activeId==null){te.current.activeId=ne;return}const ce=setTimeout(()=>{te.current.activeId=ne},50);return()=>clearTimeout(ce)},[ne]),{active:A,activeIndex:f,attributes:$,data:S,rect:N,index:M,newIndex:q,items:d,isOver:w,isSorting:B,isDragging:T,listeners:O,node:C,overIndex:y,over:z,setNodeRef:G,setActivatorNodeRef:U,setDroppableNodeRef:E,setDraggableNodeRef:D,transform:le??K,transition:ge()};function ge(){if(le||fe&&te.current.newIndex===M)return KS;if(!(Y&&!Ni(P)||!c)&&(B||ee))return Un.Transition.toString({...c,property:ng})}}function QS(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function uo(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 JS=[Xe.Down,Xe.Right,Xe.Up,Xe.Left],Ui=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:o,over:i,scrollableAncestors:a}}=t;if(JS.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=s.get(u.id);if(f)switch(e.code){case Xe.Down:r.top<f.top&&l.push(u);break;case Xe.Up:r.top>f.top&&l.push(u);break;case Xe.Left:r.left>f.left&&l.push(u);break;case Xe.Right:r.left<f.left&&l.push(u);break}});const c=DC({collisionRect:r,droppableRects:s,droppableContainers:l});let d=Ch(c,"id");if(d===i?.id&&c.length>1&&(d=c[1].id),d!=null){const u=o.get(n.id),f=o.get(d),g=f?s.get(f.id):null,m=f?.node.current;if(m&&g&&u&&f){const y=Ai(m).some((k,N)=>a[N]!==k),b=rg(u,f),_=RS(u,f),x=y||!b?{x:0,y:0}:{x:_?r.width-g.width:0,y:_?r.height-g.height:0},M={x:g.left,y:g.top};return x.x&&x.y?M:no(M,x)}}}};function rg(e,t){return!uo(e)||!uo(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function RS(e,t){return!uo(e)||!uo(t)||!rg(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const e_=Object.freeze(Object.defineProperty({__proto__:null,SortableContext:Vi,arrayMove:fs,defaultAnimateLayoutChanges:tg,defaultNewIndexGetter:eg,hasSortableData:uo,rectSortingStrategy:Fi,sortableKeyboardCoordinates:Ui,useSortable:Hi,verticalListSortingStrategy:lc},Symbol.toStringTag,{value:"Module"})),t_=()=>window.G7Core,sg=({item:e,isSelected:t=!1,isExpanded:n=!1,level:r=0,onClick:s,onToggle:o,onExpandToggle:i,className:a="",selectedClassName:l="bg-blue-50 dark:bg-blue-900/30 border-blue-500",defaultClassName:c="bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600",dragHandleClassName:d="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",iconContainerClassName:u="bg-gray-100 dark:bg-gray-700",contentClassName:f="",enableDrag:g=!0,toggleDisabled:m=!1})=>{const{attributes:p,listeners:y,setNodeRef:b,transform:_,transition:x,isDragging:M}=Hi({id:e.id}),S={transform:Un.Transform.toString(_),transition:x,opacity:M?.5:1},k=r*24+12,C=`flex items-center gap-2 cursor-pointer transition-colors ${t?l:c}`,w=t_()?.style?.mergeClasses?.(C,a)??`${C} ${a}`.trim();return h.jsxs(I,{ref:b,style:S,className:w,onClick:s,children:[g&&h.jsx(I,{...p,...y,className:`flex-shrink-0 cursor-grab active:cursor-grabbing p-1 ${d}`,style:{paddingLeft:`${k}px`},children:h.jsx(oe,{name:"grip-vertical",className:"w-4 h-4"})}),!g&&r>0&&h.jsx(I,{style:{paddingLeft:`${k}px`}}),g&&h.jsx(h.Fragment,{children:e.hasChildren?h.jsx(ae,{type:"button",onClick:E=>{E.stopPropagation(),i?.()},className:`flex-shrink-0 p-1 ${d}`,children:h.jsx(oe,{name:n?"chevron-down":"chevron-right",className:"w-4 h-4"})}):h.jsx(I,{className:"flex-shrink-0 w-6"})}),h.jsx(I,{className:`flex-shrink-0 w-8 h-8 flex items-center justify-center rounded ${u}`,children:h.jsx(oe,{name:e.icon||"file",className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:`flex-1 min-w-0 ${f}`,children:[h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(J,{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:e.name}),e.isModuleMenu&&h.jsx(oe,{name:"cube",className:"w-2 h-2 text-gray-300 dark:text-gray-500 ml-2",title:e.moduleName})]}),h.jsx(J,{className:"text-xs text-gray-500 dark:text-gray-400 truncate block",children:e.url})]}),h.jsx(I,{className:"flex-shrink-0",onClick:E=>E.stopPropagation(),children:h.jsx(Qa,{checked:e.isActive,onChange:()=>o?.(new MouseEvent("click")),size:"sm",disabled:m})})]})},n_=()=>window.G7Core;function og(e,t,n=0,r=null){const s=[];for(const o of e)s.push({item:o,depth:n,parentId:r}),o.children?.length>0&&t.has(o.id)&&s.push(...og(o.children,t,n+1,o.id));return s}function cc(e,t){for(const n of e){if(n.id===t)return n;if(n.children){const r=cc(n.children,t);if(r)return r}}return null}function ig(e){const t=[];if(e.children)for(const n of e.children)t.push(n.id),t.push(...ig(n));return t}function ag(e,t){return e.filter(n=>n.id!==t).map(n=>n.children?.length>0?{...n,children:ag(n.children,t)}:n)}function lg(e,t,n,r){if(n===null){const s=[...e];return s.splice(r,0,t),s}return e.map(s=>{if(s.id===n){const o=[...s.children||[]];return o.splice(r,0,t),{...s,children:o}}return s.children?.length>0?{...s,children:lg(s.children,t,n,r)}:s})}function cg(e,t,n,r){if(t===null){const s=e.findIndex(i=>i.id===n),o=e.findIndex(i=>i.id===r);return s===-1||o===-1?e:fs(e,s,o)}return e.map(s=>{if(s.id===t&&s.children){const o=s.children.findIndex(a=>a.id===n),i=s.children.findIndex(a=>a.id===r);return o===-1||i===-1?s:{...s,children:fs(s.children,o,i)}}return s.children?.length>0?{...s,children:cg(s.children,t,n,r)}:s})}function dg(e){const t=e.map((s,o)=>({id:s.id,order:o+1})),n={},r=s=>{s.forEach(o=>{o.children?.length>0&&(n[o.id]=o.children.map((i,a)=>({id:i.id,order:a+1})),r(o.children))})};return r(e),{parent_menus:t,child_menus:n}}const r_=({items:e=[],selectedId:t,onSelect:n,onOrderChange:r,onToggleStatus:s,title:o,className:i="",listClassName:a="",childrenContainerClassName:l="bg-gray-50 dark:bg-gray-900/50",itemClassName:c="py-2.5 px-3 mx-4 my-2 rounded-lg border",itemSelectedClassName:d,itemDefaultClassName:u,titleClassName:f="px-4 py-3 border-b border-gray-200 dark:border-gray-700",enableDrag:g=!0,toggleDisabled:m=!1,id:p,editorAttrs:y})=>{const[b,_]=v.useState(new Set),[x,M]=v.useState(null),[S,k]=v.useState(e),N=v.useRef(!1),C=v.useRef(""),w=v.useRef(""),E=v.useCallback(j=>JSON.stringify(j),[]),A=v.useCallback(j=>j.map(Y=>{const V=Y.children?.map(X=>X.id).join(",")||"";return`${Y.id}:${V}`}).join("|"),[]);v.useEffect(()=>{const j=A(e),Y=E(e);if(N.current){const V=A(S);(j===V||j!==C.current)&&(N.current=!1,C.current=j,w.current=Y,(j!==V||Y!==E(S))&&k(e));return}Y!==w.current&&(C.current=j,w.current=Y,k(e))},[e,A,E,S]);const P=Zl(ds(oo,{activationConstraint:{distance:8}}),ds(so,{coordinateGetter:Ui})),L=v.useCallback(j=>{if(typeof j=="string")return j;const V=n_()?.locale?.current?.()||"ko";return j[V]||j.en||Object.values(j)[0]||""},[]),$=v.useCallback(j=>{_(Y=>{const V=new Set(Y);return V.has(j)?V.delete(j):V.add(j),V})},[]),D=v.useCallback(j=>{n?.(j)},[n]),O=v.useCallback((j,Y,V)=>{V.stopPropagation(),s?.(j,Y)},[s]),T=j=>{M(j.active.id)},z=j=>{const{active:Y,over:V}=j;if(M(null),!V||Y.id===V.id)return;const X=W.find(q=>q.item.id===Number(Y.id)),K=W.find(q=>q.item.id===Number(V.id));if(!(!X||!K))if(X.parentId===K.parentId){const q=cg(S,X.parentId,Number(Y.id),Number(V.id));k(q),N.current=!0,r?.(dg(q))}else{const q=X.item;if(ig(q).includes(Number(V.id)))return;let te=ag(S,q.id);const fe=W.findIndex(pe=>pe.item.id===Number(Y.id)),ee=W.findIndex(pe=>pe.item.id===Number(V.id)),le=fe>ee,ge=K.parentId;let ce;if(ge===null)ce=te.findIndex(pe=>pe.id===Number(V.id)),ce===-1?ce=te.length:le||(ce+=1);else{const ke=cc(te,ge)?.children||[];ce=ke.findIndex($e=>$e.id===Number(V.id)),ce===-1?ce=ke.length:le||(ce+=1)}const ye={...q,parent_id:ge,children:q.children||[]};te=lg(te,ye,ge,ce),k(te),N.current=!0;const me=dg(te);me.moved_items=[{id:q.id,new_parent_id:ge}],r?.(me)}},U=j=>({id:j.id,name:L(j.name),slug:j.slug,url:j.url,icon:j.icon,isActive:j.is_active,isModuleMenu:!!j.module_id,moduleName:j.module?L(j.module.name):void 0,hasChildren:j.children&&j.children.length>0}),W=v.useMemo(()=>og(S,b),[S,b]),G=v.useMemo(()=>W.map(j=>j.item.id),[W]),B=x?cc(S,Number(x)):null;return h.jsxs(I,{className:i,id:p,...y,children:[o&&h.jsx(I,{className:f,children:h.jsx(jr,{className:"text-sm font-medium text-gray-900 dark:text-white",children:o})}),h.jsxs(ac,{sensors:P,collisionDetection:Ql,onDragStart:T,onDragEnd:z,children:[h.jsx(Vi,{items:G,strategy:lc,children:h.jsx(I,{className:a,children:W.map(j=>h.jsx(I,{className:j.depth>0?l:"",children:h.jsx(sg,{item:U(j.item),isSelected:t===j.item.id,isExpanded:b.has(j.item.id),level:j.depth,onClick:()=>D(j.item),onToggle:Y=>O(j.item.id,j.item.is_active,Y),onExpandToggle:()=>$(j.item.id),className:c,selectedClassName:d,defaultClassName:u,enableDrag:g,toggleDisabled:m})},j.item.id))})}),h.jsx(BS,{children:B?h.jsx(I,{className:"bg-white dark:bg-gray-800 shadow-lg rounded-lg border border-blue-500 p-3",children:h.jsx(I,{className:"flex items-center gap-2",children:h.jsx(I,{className:"text-sm font-medium text-gray-900 dark:text-white",children:L(B.name)})})}):null})]})]})},s_=[{value:"LayoutDashboard",label:"LayoutDashboard",faIcon:"tachometer-alt"},{value:"Settings",label:"Settings",faIcon:"cog"},{value:"Menu",label:"Menu",faIcon:"bars"},{value:"Users",label:"Users",faIcon:"users"},{value:"Package",label:"Package",faIcon:"cube"},{value:"Puzzle",label:"Puzzle",faIcon:"puzzle-piece"},{value:"FileText",label:"FileText",faIcon:"file-alt"},{value:"ShoppingCart",label:"ShoppingCart",faIcon:"shopping-cart"},{value:"MessageSquare",label:"MessageSquare",faIcon:"comment"},{value:"Home",label:"Home",faIcon:"home"},{value:"User",label:"User",faIcon:"user"},{value:"Search",label:"Search",faIcon:"search"},{value:"Bell",label:"Bell",faIcon:"bell"},{value:"Mail",label:"Mail",faIcon:"envelope"},{value:"Calendar",label:"Calendar",faIcon:"calendar"},{value:"Chart",label:"Chart",faIcon:"chart-bar"},{value:"Database",label:"Database",faIcon:"database"},{value:"Lock",label:"Lock",faIcon:"lock"},{value:"Globe",label:"Globe",faIcon:"globe"},{value:"Image",label:"Image",faIcon:"image"}],o_=({value:e,onChange:t,options:n=s_,placeholder:r,searchPlaceholder:s,noResultsText:o,className:i="",disabled:a=!1,name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),[g,m]=v.useState(""),p=v.useRef(null),y=n.find(x=>{if(!e)return!1;if(e.includes("fa-")){const M=e.replace(/^(fas|far|fab|fal|fad)\s+fa-/,"");return x.faIcon===M||x.faIcon===e}return x.value===e||x.faIcon===e}),b=n.filter(x=>x.label.toLowerCase().includes(g.toLowerCase()));v.useEffect(()=>{const x=M=>{p.current&&!p.current.contains(M.target)&&(f(!1),m(""))};if(u)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]);const _=x=>{const M=`fas fa-${x.faIcon}`;t?.(M),f(!1),m("")};return h.jsxs(I,{ref:p,className:`relative ${i}`,id:c,...d,children:[h.jsxs(ae,{type:"button",onClick:()=>!a&&f(!u),disabled:a,className:`
|
||
w-full flex items-center justify-between px-3 py-2
|
||
bg-white dark:bg-gray-800
|
||
border border-gray-300 dark:border-gray-600 rounded-lg
|
||
text-left text-sm
|
||
${a?"opacity-50 cursor-not-allowed":"hover:border-gray-400 dark:hover:border-gray-500"}
|
||
focus:outline-none focus:ring-2 focus:ring-blue-500
|
||
`,children:[h.jsx(I,{className:"flex items-center gap-2",children:y?h.jsxs(h.Fragment,{children:[h.jsx(oe,{name:y.faIcon,className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),h.jsx(J,{className:"text-gray-900 dark:text-white",children:y.label})]}):h.jsx(J,{className:"text-gray-500 dark:text-gray-400",children:r})}),h.jsx(oe,{name:"chevron-down",className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${u?"rotate-180":""}`})]}),l&&h.jsx("input",{type:"hidden",name:l,value:e||""}),u&&h.jsxs(I,{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-72 overflow-hidden",children:[h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-700",children:h.jsx(kt,{type:"text",value:g,onChange:x=>m(x.target.value),placeholder:s,className:"w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white",autoFocus:!0})}),h.jsx(I,{className:"max-h-56 overflow-y-auto",children:b.length>0?b.map(x=>h.jsxs(ae,{type:"button",onClick:()=>_(x),className:`
|
||
w-full flex items-center gap-3 px-3 py-2 text-left text-sm
|
||
${y?.faIcon===x.faIcon?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"}
|
||
`,children:[h.jsx(oe,{name:x.faIcon,className:"w-4 h-4"}),h.jsx(J,{children:x.label}),y?.faIcon===x.faIcon&&h.jsx(oe,{name:"check",className:"w-4 h-4 ml-auto text-blue-600"})]},x.value)):h.jsx(I,{className:"px-3 py-4 text-sm text-gray-500 dark:text-gray-400 text-center",children:o})})]})]})},dc=({defaultOpen:e=!1,isOpen:t,onToggle:n,className:r="",style:s,children:o,disabled:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(e),u=t!==void 0,f=u?t:c,g=v.useRef(null),[m,p]=v.useState(e?void 0:0),y=()=>{if(i)return;const _=!f;u||d(_),n?.(_)};v.useEffect(()=>{if(g.current)if(f){p(g.current.scrollHeight);const _=setTimeout(()=>{p(void 0)},300);return()=>clearTimeout(_)}else p(g.current.scrollHeight),requestAnimationFrame(()=>{p(0)})},[f]);const b={};if(v.Children.forEach(o,_=>{if(v.isValidElement(_)){const x=_.props?.slot;x==="trigger"?b.trigger=_:x==="content"&&(b.content=_)}}),!b.trigger&&!b.content){const _=v.Children.toArray(o);_.length>=2?(b.trigger=_[0],b.content=_.slice(1)):_.length===1&&(b.content=_[0])}return h.jsxs(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden ${r}`,style:s,id:a,...l,children:[h.jsxs(ae,{type:"button",onClick:y,disabled:i,className:`w-full flex items-center justify-between p-3 text-left bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${i?"opacity-50 cursor-not-allowed":""} ${f?"border-b border-gray-200 dark:border-gray-700":""}`,"aria-expanded":f,children:[h.jsx(I,{className:"flex-1",children:b.trigger}),!b.trigger&&h.jsx("svg",{className:`w-5 h-5 text-gray-500 dark:text-gray-400 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"})})]}),h.jsx(I,{ref:g,className:"overflow-hidden transition-all duration-300 ease-in-out",style:{height:m!==void 0?`${m}px`:"auto"},children:h.jsx(I,{className:"bg-white dark:bg-gray-800",children:b.content})})]})},fo=window.G7Core,ug=fo?.useControllableState,fg=(e,t)=>window.G7Core?.t?.(e,t)??e,i_={"":"common.scope_type_all_desc",self:"common.scope_type_self_desc",role:"common.scope_type_role_desc"},a_=({options:e,value:t,onChange:n,disabled:r=!1})=>{const[s,o]=v.useState(!1),[i,a]=v.useState({}),l=v.useRef(null),c=e.find(u=>u.value===t)??e[0];v.useEffect(()=>{if(!s)return;const u=g=>{l.current&&!l.current.contains(g.target)&&o(!1)},f=()=>{if(!l.current)return;const g=l.current.getBoundingClientRect();a({position:"fixed",top:g.bottom+4,right:window.innerWidth-g.right,zIndex:9999})};return document.addEventListener("mousedown",u),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s]);const d=v.useCallback(()=>{if(r||!l.current)return;const u=l.current.getBoundingClientRect();a({position:"fixed",top:u.bottom+4,right:window.innerWidth-u.right,zIndex:9999}),o(f=>!f)},[r]);return h.jsxs(I,{ref:l,className:"relative flex-shrink-0",children:[h.jsxs(I,{role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),u.preventDefault(),d()},onMouseDown:u=>u.stopPropagation(),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.stopPropagation(),u.preventDefault(),d()),u.key==="Escape"&&o(!1)},className:`flex items-center gap-1 text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-pointer select-none ${r?"opacity-50 cursor-not-allowed":"hover:border-blue-400 dark:hover:border-blue-500"}`,children:[h.jsx(J,{children:c?.label??""}),h.jsx(oe,{name:ue.ChevronDown,className:"w-3 h-3 text-gray-400 dark:text-gray-500"})]}),s&&h.jsx(I,{style:i,className:"w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg py-1",children:e.map(u=>{const f=u.value??"",g=i_[f],m=g?fg(g):"",p=u.value===t;return h.jsxs(I,{role:"option","aria-selected":p,onClick:y=>{y.stopPropagation(),y.preventDefault(),n(u.value),o(!1)},onMouseDown:y=>y.stopPropagation(),className:`px-3 py-2 cursor-pointer transition-colors ${p?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[h.jsx(J,{className:`text-xs font-medium ${p?"text-blue-700 dark:text-blue-300":"text-gray-900 dark:text-white"}`,children:u.label}),p&&h.jsx(oe,{name:ue.Check,className:"w-3.5 h-3.5 text-blue-600 dark:text-blue-400"})]}),m&&h.jsx(J,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:m})]},f||"__null__")})})]})},l_=(e,t)=>{if(e.length!==t.length)return!1;const n=[...e].sort((s,o)=>s.id-o.id),r=[...t].sort((s,o)=>s.id-o.id);return n.every((s,o)=>s.id===r[o].id&&s.scope_type===r[o].scope_type)},c_=({data:e=[],value:t=[],onChange:n,scopeOptions:r=[],className:s="",disabled:o=!1,desktopColumns:i=2,installedModules:a=[],installedPlugins:l=[],id:c,editorAttrs:d})=>{const u=v.useCallback(E=>{if(n){const A=fo?.createChangeEvent?fo.createChangeEvent({value:E}):{target:{value:E}};n(A)}},[n]),[f,g]=ug?ug(t,[],u,{isEqual:l_}):(()=>{const[E,A]=v.useState(t),P=v.useRef(n);P.current=n;const L=v.useRef(!1);v.useEffect(()=>{if(L.current){L.current=!1;return}A(t)},[t]);const $=v.useCallback(D=>{L.current=!0,A(O=>{const T=typeof D=="function"?D(O):D;if(P.current){const z=fo?.createChangeEvent?fo.createChangeEvent({value:T}):{target:{value:T}};P.current(z)}return T})},[]);return[E,$]})(),m=v.useMemo(()=>new Set(f.map(E=>E.id)),[f]),p=v.useCallback(E=>E.is_assignable?[E.id]:E.children.flatMap(A=>p(A)),[]),y=v.useCallback(E=>{const A=p(E);return A.length>0&&A.every(P=>m.has(P))},[m,p]),b=v.useCallback(E=>{const A=p(E),P=A.filter(L=>m.has(L)).length;return P>0&&P<A.length},[m,p]),_=v.useCallback(E=>p(E).filter(P=>m.has(P)).length,[m,p]),x=v.useCallback((E,A)=>{o||g(P=>A?[...P,{id:E,scope_type:null}]:P.filter(L=>L.id!==E))},[o,g]),M=v.useCallback((E,A)=>{if(o)return;const P=p(E),L=new Set(P);g($=>{if(A){const D=new Set($.map(T=>T.id)),O=P.filter(T=>!D.has(T)).map(T=>({id:T,scope_type:null}));return[...$,...O]}else return $.filter(D=>!L.has(D.id))})},[o,p,g]),S=v.useCallback((E,A)=>{o||g(P=>P.map(L=>L.id===E?{...L,scope_type:A}:L))},[o,g]),k=E=>{const A=m.has(E.id),P=!!E.resource_route_key,L=A&&P&&r.length>0,$=f.find(D=>D.id===E.id)?.scope_type??null;return h.jsxs(ln,{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${A?"border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${o?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx(kt,{type:"checkbox",checked:A,onChange:D=>{D.stopPropagation(),x(E.id,D.target.checked)},disabled:o,className:"w-4 h-4 mt-0.5 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsxs(I,{className:"flex items-center justify-between gap-2",children:[h.jsx(J,{className:"text-sm font-medium text-gray-900 dark:text-white",children:E.name}),L&&h.jsx(a_,{options:r,value:$,onChange:D=>S(E.id,D),disabled:o})]}),E.description&&h.jsx(J,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:E.description})]})]},E.id)},N=(E,A)=>{const P=y(E),L=b(E),$=_(E),D=E.children.filter(z=>z.is_assignable);if(D.length===0&&E.children.length===0)return null;const O=E.children.some(z=>!z.is_assignable),T=i===1?"grid-cols-1":i===3?"grid-cols-1 md:grid-cols-3":"grid-cols-1 md:grid-cols-2";return h.jsxs(dc,{defaultOpen:!1,className:"border-0 rounded-none",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:P,ref:z=>{z&&(z.indeterminate=L)},onChange:z=>{z.stopPropagation(),M(E,z.target.checked)},onClick:z=>z.stopPropagation(),onMouseDown:z=>z.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(oe,{name:ue.Folder,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(J,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:E.name}),h.jsxs(J,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-1",children:[$,"/",E.leaf_count]}),h.jsx(oe,{name:ue.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:`pl-8 grid ${T} gap-2 py-2`,children:O?E.children.map(z=>z.is_assignable?k(z):N(z)):D.map(z=>k(z))})]},E.id)},C=E=>{if(E.extension_type==="core")return"core";if(E.extension_type==="module")return"module";if(E.extension_type==="plugin")return"plugin";const A=E.extension_identifier??E.module??"";return A==="core"||!A?"core":l?.some(L=>L.identifier===A)?"plugin":"module"},w=E=>{const A=y(E),P=b(E),L=_(E),$=C(E);return h.jsxs(dc,{defaultOpen:!1,className:"mb-2",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:A,ref:D=>{D&&(D.indeterminate=P)},onChange:D=>{D.stopPropagation(),M(E,D.target.checked)},onClick:D=>D.stopPropagation(),onMouseDown:D=>D.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(oe,{name:$==="core"?ue.Cog:ue.Cube,className:"w-5 h-5 text-gray-400 dark:text-gray-500"}),h.jsx(J,{className:"font-medium text-gray-900 dark:text-white",children:E.name}),$!=="core"&&h.jsx(ph,{type:$,identifier:E.extension_identifier??E.module,installedModules:a,installedPlugins:l}),h.jsxs(J,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-2",children:[L,"/",E.leaf_count]}),h.jsx(oe,{name:ue.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:"pl-8 space-y-2 pb-2",children:E.children.map(D=>D.is_assignable?k(D):N(D))})]},E.id)};return e.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${s}`,id:c,...d,children:fg("common.no_data")??"데이터가 없습니다."}):h.jsx(I,{className:`space-y-2 ${s}`,id:c,...d,children:e.map(E=>w(E))})};function d_({text:e,keyword:t}){if(!t||!e)return h.jsx(h.Fragment,{children:e});const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=e.split(new RegExp(`(${n})`,"gi"));return h.jsx(h.Fragment,{children:r.map((s,o)=>s.toLowerCase()===t.toLowerCase()?h.jsx(J,{className:"bg-yellow-200 dark:bg-yellow-700 rounded px-0.5",children:s},o):s)})}const u_=({data:e=[],expandedIds:t=[],selectedIds:n=[],searchKeyword:r="",showProductCount:s=!1,selectable:o=!1,className:i="",onToggle:a,onSelectionChange:l,id:c,editorAttrs:d})=>{const u=v.useCallback(y=>{if(!a)return;const b=t.includes(y)?t.filter(_=>_!==y):[...t,y];a(b)},[t,a]),f=v.useCallback((y,b)=>{if(!l)return;const _=b?[...n,y]:n.filter(x=>x!==y);l(_)},[n,l]),g=v.useMemo(()=>{if(!r)return null;const y=new Set,b=_=>{for(const x of _)(x.localized_name||x.name).toLowerCase().includes(r.toLowerCase())&&y.add(x.id),x.children&&b(x.children)};return b(e),y},[e,r]),m=v.useCallback(y=>!g||g.has(y.id)?!0:(y.children??[]).some(b=>m(b)),[g]),p=(y,b=0)=>{const _=(y.children??[]).length>0,x=t.includes(y.id),M=n.includes(y.id),S=y.localized_name||y.name;return r&&!m(y)?null:h.jsxs(I,{"data-testid":`category-node-${y.id}`,children:[h.jsxs(I,{className:`flex items-center gap-2 py-1.5 px-2 rounded cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${b>0?"ml-"+Math.min(b*5,20):""}`,style:b>0?{marginLeft:`${b*20}px`}:void 0,children:[_?h.jsx(I,{className:"flex-shrink-0 w-5 h-5 flex items-center justify-center text-gray-400 dark:text-gray-500",onClick:()=>u(y.id),"data-testid":`toggle-${y.id}`,children:h.jsx(oe,{name:x?ue.CaretDown:ue.CaretRight,className:"text-xs"})}):h.jsx(I,{className:"flex-shrink-0 w-5 h-5"}),o&&h.jsx(_n,{checked:M,onChange:k=>{k.stopPropagation(),f(y.id,k.target.checked)},className:"flex-shrink-0","data-testid":`checkbox-${y.id}`}),h.jsx(oe,{name:ue.Folder,className:`flex-shrink-0 text-sm ${_?"text-yellow-500 dark:text-yellow-400":"text-gray-400 dark:text-gray-500"}`}),h.jsx(J,{className:"text-sm text-gray-700 dark:text-gray-300 select-none",onClick:()=>_&&u(y.id),children:h.jsx(d_,{text:S,keyword:r})}),s&&y.products_count!==void 0&&h.jsx(J,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-500 dark:bg-gray-700 dark:text-gray-400 ml-1",children:y.products_count})]}),_&&x&&h.jsx(I,{"data-testid":`children-${y.id}`,children:(y.children??[]).map(k=>p(k,b+1))})]},y.id)};return e.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${i}`,id:c,...d,children:"데이터가 없습니다."}):h.jsx(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg p-2 max-h-80 overflow-y-auto ${i}`,id:c,...d,children:e.map(y=>p(y,0))})},hg="carousel",ho="controller",f_="navigation",h_="no-scroll",uc="portal",g_="root",gg="toolbar",p_="counter",go="fullscreen",pg="slideshow",po="thumbnails",mg="zoom",hs="loading",fc="playing",mo="error",bo="complete",m_="placeholder",yo=e=>`active-slide-${e}`,b_=yo(hs),y_=yo(fc),v_=yo(mo),x_=yo(bo),bg="fullsize",gs="flex_center",w_="no_scroll",yg="no_scroll_padding",hc="slide",vg="slide_wrapper",k_="slide_wrapper_interactive",dr="prev",ur="next",gc="swipe",ps="close",xg="onPointerDown",wg="onPointerMove",kg="onPointerUp",Cg="onPointerLeave",Sg="onPointerCancel",pc="onKeyDown",C_="onKeyUp",mc="onWheel",S_="Escape",__="ArrowLeft",E_="ArrowRight",M_="button",Bi="icon",_g="contain",Eg="cover",Mg="Unknown action type",Ng="yarl__";function Ut(...e){return e.filter(Boolean).join(" ")}function Me(e){return`${Ng}${e}`}function ft(e){return`--${Ng}${e}`}function Sr(e,t){return`${e}${t?`_${t}`:""}`}function _r(e){return t=>Sr(e,t)}function Er(e,t){var n;return(n=e?.[t])!==null&&n!==void 0?n:t}function Tg(e,t,n){return Er(e,"{index} of {total}").replace(/\{index}/g,`${xc(n,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function ms(...e){return()=>{e.forEach(t=>{t()})}}function un(e,t,n){return()=>{const r=F.useContext(n);if(!r)throw new Error(`${e} must be used within a ${t}.Provider`);return r}}function bc(){return typeof window<"u"}function yc(e,t=0){const n=10**t;return Math.round((e+Number.EPSILON)*n)/n}function fr(e){return e.type===void 0||e.type==="image"}function vc(e,t){return e.imageFit===Eg||e.imageFit!==_g&&t===Eg}function ji(e){return typeof e=="string"?Number.parseInt(e,10):e}function Wi(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=ji(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function N_(e,t){const n=Wi(t),r=n.percent!==void 0?e.width/100*n.percent:n.pixel;return{width:Math.max(e.width-2*r,0),height:Math.max(e.height-2*r,0)}}function T_(){return(bc()?window?.devicePixelRatio:void 0)||1}function xc(e,t){return t>0?(e%t+t)%t:0}function wc(e){return e.length>0}function kc(e,t){return e[xc(t,e.length)]}function Cc(e,t){return wc(e)?kc(e,t):void 0}function Og(e){return fr(e)?e.src:void 0}function Gi(e,t,n){if(!n)return e;const{buttons:r,...s}=e,o=r.findIndex(a=>a===t),i=F.isValidElement(n)?F.cloneElement(n,{key:t},null):n;if(o>=0){const a=[...r];return a.splice(o,1,i),{buttons:a,...s}}return{buttons:[i,...r],...s}}function Ag(e,t,n=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),n))}const O_=Number(F.version.split(".")[0])>=19;function A_(e){return{inert:O_?e:e?"":void 0}}function D_(e){e.scrollTop}const Sc={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[ps]},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:_g,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,closeOnEscape:!0,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function gn(e,t){return{name:e,component:t}}function At(e,t){return{module:e,children:t}}function Dg(e,t,n){return e.module.name===t?n(e):e.children?[At(e.module,e.children.flatMap(r=>{var s;return(s=Dg(r,t,n))!==null&&s!==void 0?s:[]}))]:[e]}function bs(e,t,n){return e.flatMap(r=>{var s;return(s=Dg(r,t,n))!==null&&s!==void 0?s:[]})}function I_(e,t=[],n=[]){let r=e;const s=g=>{const m=[...r];for(;m.length>0;){const p=m.pop();if(p?.module.name===g)return!0;p?.children&&m.push(...p.children)}return!1},o=(g,m)=>{if(g===""){r=[At(m,r)];return}r=bs(r,g,p=>[At(m,[p])])},i=(g,m)=>{r=bs(r,g,p=>[At(p.module,[At(m,p.children)])])},a=(g,m,p)=>{r=bs(r,g,y=>{var b;return[At(y.module,[...p?[At(m)]:[],...(b=y.children)!==null&&b!==void 0?b:[],...p?[]:[At(m)]])]})},l=(g,m,p)=>{r=bs(r,g,y=>[...p?[At(m)]:[],y,...p?[]:[At(m)]])},c=g=>{i(ho,g)},d=(g,m)=>{r=bs(r,g,p=>[At(m,p.children)])},u=g=>{r=bs(r,g,m=>m.children)},f=g=>{n.push(g)};return t.forEach(g=>{g({contains:s,addParent:o,append:i,addChild:a,addSibling:l,addModule:c,replace:d,remove:u,augment:f})}),{config:r,augmentation:g=>n.reduce((m,p)=>p(m),g)}}const Ig=F.createContext(null),_c=un("useA11yContext","A11yContext",Ig);function L_({children:e}){const[t,n]=F.useState(!1),[r,s]=F.useState(!1),o=F.useMemo(()=>({focusWithin:t,trackFocusWithin:(a,l)=>{const c=d=>u=>{var f;u.currentTarget.contains(u.relatedTarget)||n(d),(f=d?a:l)===null||f===void 0||f(u)};return{onFocus:c(!0),onBlur:c(!1)}},autoPlaying:r,setAutoPlaying:s}),[t,r]);return F.createElement(Ig.Provider,{value:o},e)}const Lg=F.createContext(null),ys=un("useDocument","DocumentContext",Lg);function P_({nodeRef:e,children:t}){const n=F.useMemo(()=>{const r=o=>{var i;return((i=o||e.current)===null||i===void 0?void 0:i.ownerDocument)||document};return{getOwnerDocument:r,getOwnerWindow:o=>{var i;return((i=r(o))===null||i===void 0?void 0:i.defaultView)||window}}},[e]);return F.createElement(Lg.Provider,{value:n},t)}const Pg=F.createContext(null),vs=un("useEvents","EventsContext",Pg);function $_({children:e}){const[t]=F.useState({});F.useEffect(()=>()=>{Object.keys(t).forEach(r=>delete t[r])},[t]);const n=F.useMemo(()=>{const r=(i,a)=>{var l;(l=t[i])===null||l===void 0||l.splice(0,t[i].length,...t[i].filter(c=>c!==a))};return{publish:(...[i,a])=>{var l;(l=t[i])===null||l===void 0||l.forEach(c=>c(a))},subscribe:(i,a)=>(t[i]||(t[i]=[]),t[i].push(a),()=>r(i,a)),unsubscribe:r}},[t]);return F.createElement(Pg.Provider,{value:n},e)}const $g=F.createContext(null),Dt=un("useLightboxProps","LightboxPropsContext",$g);function Fg({children:e,...t}){return F.createElement($g.Provider,{value:t},e)}const zg=F.createContext(null),pn=un("useLightboxState","LightboxStateContext",zg),Vg=F.createContext(null),F_=un("useLightboxDispatch","LightboxDispatchContext",Vg);function z_(e,t){switch(t.type){case"swipe":{const{slides:n}=e,r=t?.increment||0,s=e.globalIndex+r,o=xc(s,n.length),i=Cc(n,o),a=r||t.duration!==void 0?{increment:r,duration:t.duration,easing:t.easing}:void 0;return{slides:n,currentIndex:o,globalIndex:s,currentSlide:i,animation:a}}case"update":return t.slides!==e.slides||t.index!==e.currentIndex?{slides:t.slides,currentIndex:t.index,globalIndex:t.index,currentSlide:Cc(t.slides,t.index)}:e;default:throw new Error(Mg)}}function V_({slides:e,index:t,children:n}){const[r,s]=F.useReducer(z_,{slides:e,currentIndex:t,globalIndex:t,currentSlide:Cc(e,t)}),[o,i]=F.useState(e),[a,l]=F.useState(t);(e!==o||t!==a)&&(i(e),l(t),s({type:"update",slides:e,index:t}));const c=F.useMemo(()=>({...r,state:r,dispatch:s}),[r,s]);return F.createElement(Vg.Provider,{value:s},F.createElement(zg.Provider,{value:c},n))}const Hg=F.createContext(null),H_=un("useRTLContext","RTLContext",Hg);function U_({isRTL:e,children:t}){const n=F.useMemo(()=>({isRTL:e}),[e]);return F.createElement(Hg.Provider,{value:n},t)}const Ug=F.createContext(null),vo=un("useTimeouts","TimeoutsContext",Ug);function B_({children:e}){const[t]=F.useState([]);F.useEffect(()=>()=>{t.forEach(r=>window.clearTimeout(r)),t.splice(0,t.length)},[t]);const n=F.useMemo(()=>{const r=i=>{t.splice(0,t.length,...t.filter(a=>a!==i))};return{setTimeout:(i,a)=>{const l=window.setTimeout(()=>{r(l),i()},a);return t.push(l),l},clearTimeout:i=>{i!==void 0&&(r(i),window.clearTimeout(i))}}},[t]);return F.createElement(Ug.Provider,{value:n},e)}const xs=F.forwardRef(function({label:t,className:n,icon:r,renderIcon:s,onClick:o,style:i,...a},l){const{styles:c,labels:d}=Dt(),u=Er(d,t);return F.createElement("button",{ref:l,type:"button",title:u,"aria-label":u,className:Ut(Me(M_),n),onClick:o,style:{...i,...c.button},...a},s?s():F.createElement(r,{className:Me(Bi),style:c.icon}))});function Bg(e,t){const n=r=>F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...r},t);return n.displayName=e,n}function en(e,t){return Bg(e,F.createElement("g",{fill:"currentColor"},F.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}function j_(e,t){return Bg(e,F.createElement(F.Fragment,null,F.createElement("defs",null,F.createElement("mask",{id:"strike"},F.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),F.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),F.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),F.createElement("g",{fill:"currentColor",mask:"url(#strike)"},F.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t)))}const W_=en("Close",F.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"})),G_=en("Previous",F.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),Y_=en("Next",F.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),X_=en("Loading",F.createElement(F.Fragment,null,Array.from({length:8}).map((e,t,n)=>F.createElement("line",{key:t,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/n.length*(t+1),transform:`rotate(${360/n.length*t}, 12, 12)`})))),K_=en("Error",F.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"})),Nn=bc()?F.useLayoutEffect:F.useEffect;function Ec(){const[e,t]=F.useState(!1);return F.useEffect(()=>{var n,r;const s=(n=window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-reduced-motion: reduce)");t(s?.matches);const o=i=>t(i.matches);return(r=s?.addEventListener)===null||r===void 0||r.call(s,"change",o),()=>{var i;return(i=s?.removeEventListener)===null||i===void 0?void 0:i.call(s,"change",o)}},[]),e}function q_(e){let t=0,n=0,r=0;const o=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(o){const i=o[1].split(",").map(ji);i.length===6?(t=i[4],n=i[5]):i.length===16&&(t=i[12],n=i[13],r=i[14])}return{x:t,y:n,z:r}}function Mc(e,t){const n=F.useRef(void 0),r=F.useRef(void 0),s=Ec();return Nn(()=>{var o,i,a;if(e.current&&n.current!==void 0&&!s){const{keyframes:l,duration:c,easing:d,onfinish:u}=t(n.current,e.current.getBoundingClientRect(),q_(e.current))||{};if(l&&c){(o=r.current)===null||o===void 0||o.cancel(),r.current=void 0;try{r.current=(a=(i=e.current).animate)===null||a===void 0?void 0:a.call(i,l,{duration:c,easing:d})}catch(f){console.error(f)}r.current&&(r.current.onfinish=()=>{r.current=void 0,u?.()})}}n.current=void 0}),{prepareAnimation:o=>{n.current=o},isAnimationPlaying:()=>{var o;return((o=r.current)===null||o===void 0?void 0:o.playState)==="running"}}}function jg(){const e=F.useRef(null),t=F.useRef(void 0),[n,r]=F.useState();return{setContainerRef:F.useCallback(o=>{e.current=o,t.current&&(t.current.disconnect(),t.current=void 0);const i=()=>{if(o){const a=window.getComputedStyle(o),l=c=>parseFloat(c)||0;r({width:Math.round(o.clientWidth-l(a.paddingLeft)-l(a.paddingRight)),height:Math.round(o.clientHeight-l(a.paddingTop)-l(a.paddingBottom))})}else r(void 0)};i(),o&&typeof ResizeObserver<"u"&&(t.current=new ResizeObserver(i),t.current.observe(o))},[]),containerRef:e,containerRect:n}}function Yi(){const e=F.useRef(void 0),{setTimeout:t,clearTimeout:n}=vo();return F.useCallback((r,s)=>{n(e.current),e.current=t(r,s>0?s:0)},[t,n])}function We(e){const t=F.useRef(e);return Nn(()=>{t.current=e}),F.useCallback((...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function Wg(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Nc(e,t){return F.useMemo(()=>e==null&&t==null?null:n=>{Wg(e,n),Wg(t,n)},[e,t])}function Gg(e,t=!1){const n=F.useRef(!1);Nn(()=>{t&&n.current&&(n.current=!1,e())},[t,e]);const r=F.useCallback(()=>{n.current=!0},[]),s=F.useCallback(()=>{n.current=!1},[]);return{onFocus:r,onBlur:s}}function Xi(){return H_().isRTL}function Yg(){const[e]=F.useState({}),t=F.useCallback((s,o)=>{var i;(i=e[s])===null||i===void 0||i.forEach(a=>{o.isPropagationStopped()||a(o)})},[e]),n=F.useMemo(()=>({onPointerDown:s=>t(xg,s),onPointerMove:s=>t(wg,s),onPointerUp:s=>t(kg,s),onPointerLeave:s=>t(Cg,s),onPointerCancel:s=>t(Sg,s),onKeyDown:s=>t(pc,s),onKeyUp:s=>t(C_,s),onWheel:s=>t(mc,s)}),[t]),r=F.useCallback((s,o)=>(e[s]||(e[s]=[]),e[s].unshift(o),()=>{const i=e[s];i&&i.splice(0,i.length,...i.filter(a=>a!==o))}),[e]);return{registerSensors:n,subscribeSensors:r}}function Xg(e,t){const n=F.useRef(0),r=Yi(),s=We((...o)=>{n.current=Date.now(),e(o)});return F.useCallback((...o)=>{r(()=>{s(o)},t-(Date.now()-n.current))},[t,s,r])}const Tc=_r("slide"),Oc=_r("slide_image");function Mr({slide:e,offset:t,render:n,rect:r,imageFit:s,imageProps:o,onClick:i,onLoad:a,onError:l,style:c}){var d,u,f,g,m,p,y,b;const[_,x]=F.useState(hs),{publish:M}=vs(),{setTimeout:S}=vo(),k=F.useRef(null);F.useEffect(()=>{t===0&&M(yo(_))},[t,_,M]);const N=We(B=>{("decode"in B?B.decode():Promise.resolve()).catch(()=>{}).then(()=>{B.parentNode&&(x(bo),S(()=>{a?.(B)},0))})}),C=F.useCallback(B=>{k.current=B,B?.complete&&N(B)},[N]),w=F.useCallback(B=>{N(B.currentTarget)},[N]),E=We(()=>{x(mo),l?.()}),A=vc(e,s),P=(B,j)=>Number.isFinite(B)?B:j,L=P(Math.max(...((u=(d=e.srcSet)===null||d===void 0?void 0:d.map(B=>B.width))!==null&&u!==void 0?u:[]).concat(e.width?[e.width]:[]).filter(Boolean)),((f=k.current)===null||f===void 0?void 0:f.naturalWidth)||0),$=P(Math.max(...((m=(g=e.srcSet)===null||g===void 0?void 0:g.map(B=>B.height))!==null&&m!==void 0?m:[]).concat(e.height?[e.height]:[]).filter(Boolean)),((p=k.current)===null||p===void 0?void 0:p.naturalHeight)||0),D=L&&$?{maxWidth:`min(${L}px, 100%)`,maxHeight:`min(${$}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},O=(y=e.srcSet)===null||y===void 0?void 0:y.slice().sort((B,j)=>B.width-j.width).map(B=>`${B.src} ${B.width}w`).join(", "),T=()=>r&&!A&&e.width&&e.height?r.height/e.height*e.width:Number.MAX_VALUE,z=O&&r&&bc()?`${Math.round(Math.min(T(),r.width))}px`:void 0,{style:U,className:W,...G}=(typeof o=="function"?o(e):o)||{};return F.createElement(F.Fragment,null,F.createElement("img",{ref:C,onLoad:w,onError:E,onClick:i,draggable:!1,className:Ut(Me(Oc()),A&&Me(Oc("cover")),_!==bo&&Me(Oc("loading")),W),style:{...D,...c,...U},...G,alt:(b=e.alt)!==null&&b!==void 0?b:"",sizes:z,srcSet:O,src:e.src}),_!==bo&&F.createElement("div",{className:Me(Tc(m_))},_===hs&&(n?.iconLoading?n.iconLoading():F.createElement(X_,{className:Ut(Me(Bi),Me(Tc(hs)))})),_===mo&&(n?.iconError?n.iconError():F.createElement(K_,{className:Ut(Me(Bi),Me(Tc(mo)))}))))}const Z_=F.forwardRef(function({className:t,children:n,onFocus:r,onBlur:s,...o},i){const a=F.useRef(null),[l,c]=F.useState(!1),{trackFocusWithin:d}=_c(),u=We(()=>{if(a.current){const f=window.getComputedStyle(a.current).direction==="rtl";f!==l&&c(f)}});return F.useEffect(u),F.createElement(P_,{nodeRef:a},F.createElement(U_,{isRTL:l},F.createElement("div",{ref:Nc(i,a),className:Ut(Me("root"),t),...d(r,s),...o},n)))});var Bt;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"})(Bt||(Bt={}));function Kg(e,t,n,r,s){F.useEffect(()=>s?()=>{}:ms(e(xg,t),e(wg,n),e(kg,r),e(Cg,r),e(Sg,r)),[e,t,n,r,s])}var Tn;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"})(Tn||(Tn={}));const Ac=30;function Q_({disableSwipeNavigation:e,closeOnBackdropClick:t},n,r,s,o,i,a,l,c,d,u,f,g,m,p,y){const b=F.useRef(0),_=F.useRef([]),x=F.useRef(void 0),M=F.useRef(0),S=F.useRef(Tn.NONE),k=F.useCallback(L=>{x.current===L.pointerId&&(x.current=void 0,S.current=Tn.NONE);const $=_.current;$.splice(0,$.length,...$.filter(D=>D.pointerId!==L.pointerId))},[]),N=F.useCallback(L=>{k(L),L.persist(),_.current.push(L)},[k]),C=F.useCallback(L=>_.current.find(({pointerId:$})=>L.pointerId===$),[]),w=We(L=>{N(L)}),E=(L,$)=>u&&L>$||d&&L<-$,A=We(L=>{const $=C(L);if($)if(x.current===L.pointerId){const D=Date.now()-M.current,O=b.current;S.current===Tn.SWIPE?Math.abs(O)>.3*s||Math.abs(O)>5&&D<o?l(O,D):c(O):S.current===Tn.PULL&&(E(O,2*Ac)?m(O,D):p(O)),b.current=0,S.current=Tn.NONE}else{const{target:D}=L;t&&D instanceof HTMLElement&&D===$.target&&(D.classList.contains(Me(hc))||D.classList.contains(Me(vg)))&&y()}k(L)}),P=We(L=>{const $=C(L);if($){const D=x.current===L.pointerId;if(L.buttons===0){D&&b.current!==0?A(L):k($);return}const O=L.clientX-$.clientX,T=L.clientY-$.clientY;if(x.current===void 0){const z=U=>{N(L),x.current=L.pointerId,M.current=Date.now(),S.current=U};Math.abs(O)>Math.abs(T)&&Math.abs(O)>Ac&&r(O)?e||(z(Tn.SWIPE),i()):Math.abs(T)>Math.abs(O)&&E(T,Ac)&&(z(Tn.PULL),f())}else D&&(S.current===Tn.SWIPE?(b.current=O,a(O)):S.current===Tn.PULL&&(b.current=T,g(T)))}});Kg(n,w,P,A)}function J_({preventDefaultWheelX:e,preventDefaultWheelY:t}){const n=F.useRef(null),r=We(s=>{const o=Math.abs(s.deltaX)>Math.abs(s.deltaY);(o&&e||!o&&t||s.ctrlKey)&&s.preventDefault()});return F.useCallback(s=>{var o;s?s.addEventListener("wheel",r,{passive:!1}):(o=n.current)===null||o===void 0||o.removeEventListener("wheel",r),n.current=s},[r])}function R_(e,t,n,r,s,o,i,a,l){const c=F.useRef(0),d=F.useRef(0),u=F.useRef(void 0),f=F.useRef(void 0),g=F.useRef(0),m=F.useRef(void 0),p=F.useRef(0),{setTimeout:y,clearTimeout:b}=vo(),_=F.useCallback(()=>{u.current&&(b(u.current),u.current=void 0)},[b]),x=F.useCallback(()=>{f.current&&(b(f.current),f.current=void 0)},[b]),M=We(()=>{e!==Bt.SWIPE&&(c.current=0,p.current=0,_(),x())});F.useEffect(M,[e,M]);const S=We(N=>{f.current=void 0,c.current===N&&l(c.current)}),k=We(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const C=w=>{g.current=w,b(m.current),m.current=w>0?y(()=>{g.current=0,m.current=void 0},300):void 0};if(e===Bt.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){C(N.deltaX);return}if(!n(-N.deltaX))return;if(d.current+=N.deltaX,_(),Math.abs(d.current)>30)d.current=0,C(0),p.current=Date.now(),o();else{const w=d.current;u.current=y(()=>{u.current=void 0,w===d.current&&(d.current=0)},s)}}else if(e===Bt.SWIPE){let w=c.current-N.deltaX;if(w=Math.min(Math.abs(w),r)*Math.sign(w),c.current=w,i(w),x(),Math.abs(w)>.2*r){C(N.deltaX),a(w,Date.now()-p.current);return}f.current=y(()=>S(w),2*s)}else C(N.deltaX)});F.useEffect(()=>t(mc,k),[t,k])}const qg=_r("container"),Zg=F.createContext(null),On=un("useController","ControllerContext",Zg);function e2({children:e,...t}){var n;const{carousel:r,animation:s,controller:o,on:i,styles:a,render:l}=t,{closeOnPullUp:c,closeOnPullDown:d,preventDefaultWheelX:u,preventDefaultWheelY:f}=o,[g,m]=F.useState(),p=pn(),y=F_(),[b,_]=F.useState(Bt.NONE),x=F.useRef(0),M=F.useRef(0),S=F.useRef(1),{registerSensors:k,subscribeSensors:N}=Yg(),{subscribe:C,publish:w}=vs(),E=Yi(),A=Yi(),P=Yi(),{containerRef:L,setContainerRef:$,containerRect:D}=jg(),O=Nc(J_({preventDefaultWheelX:u,preventDefaultWheelY:f}),$),T=F.useRef(null),z=Nc(T,void 0),{getOwnerDocument:U}=ys(),W=Xi(),G=ie=>(W?-1:1)*(typeof ie=="number"?ie:1),B=We(()=>{var ie;return(ie=L.current)===null||ie===void 0?void 0:ie.focus()}),j=We(()=>t),Y=We(()=>p),V=F.useCallback(ie=>w(dr,ie),[w]),X=F.useCallback(ie=>w(ur,ie),[w]),K=F.useCallback(()=>w(ps),[w]),q=ie=>!(r.finite&&(G(ie)>0&&p.currentIndex===0||G(ie)<0&&p.currentIndex===p.slides.length-1)),ne=ie=>{var _e;x.current=ie,(_e=L.current)===null||_e===void 0||_e.style.setProperty(ft("swipe_offset"),`${Math.round(ie)}px`)},te=ie=>{var _e,Ae;M.current=ie,S.current=(()=>{const gt=d&&ie>0?ie:c&&ie<0?-ie:0;return Math.min(Math.max(yc(1-gt/60*(1-.5),2),.5),1)})(),(_e=L.current)===null||_e===void 0||_e.style.setProperty(ft("pull_offset"),`${Math.round(ie)}px`),(Ae=L.current)===null||Ae===void 0||Ae.style.setProperty(ft("pull_opacity"),`${S.current}`)},{prepareAnimation:fe}=Mc(T,(ie,_e,Ae)=>{if(T.current&&D)return{keyframes:[{transform:`translate(0, ${ie.rect.y-_e.y+Ae.y}px)`,opacity:ie.opacity},{transform:"translate(0, 0)",opacity:1}],duration:ie.duration,easing:s.easing.fade}}),ee=(ie,_e)=>{if(c||d){te(ie);let Ae=0;T.current&&(Ae=s.fade*(_e?2:1),fe({rect:T.current.getBoundingClientRect(),opacity:S.current,duration:Ae})),P(()=>{te(0),_(Bt.NONE)},Ae),_(Bt.ANIMATION),_e||K()}},{prepareAnimation:le,isAnimationPlaying:ge}=Mc(T,(ie,_e,Ae)=>{var Ie;if(T.current&&D&&(!((Ie=p.animation)===null||Ie===void 0)&&Ie.duration)){const Be=Wi(r.spacing),gt=(Be.percent?Be.percent*D.width/100:Be.pixel)||0;return{keyframes:[{transform:`translate(${G(p.globalIndex-ie.index)*(D.width+gt)+ie.rect.x-_e.x+Ae.x}px, 0)`},{transform:"translate(0, 0)"}],duration:p.animation.duration,easing:p.animation.easing}}}),ce=We(ie=>{var _e,Ae;const Ie=ie.offset||0,Be=Ie?s.swipe:(_e=s.navigation)!==null&&_e!==void 0?_e:s.swipe,gt=!Ie&&!ge()?s.easing.navigation:s.easing.swipe;let{direction:mt}=ie;const Ge=(Ae=ie.count)!==null&&Ae!==void 0?Ae:1;let ot=Bt.ANIMATION,Fe=Be*Ge;if(!mt){const de=D?.width,we=ie.duration||0,ve=de?Be/de*Math.abs(Ie):Be;Ge!==0?(we<ve?Fe=Fe/ve*Math.max(we,ve/5):de&&(Fe=Be/de*(de-Math.abs(Ie))),mt=G(Ie)>0?dr:ur):Fe=Be/2}let re=0;mt===dr?q(G(1))?re=-Ge:(ot=Bt.NONE,Fe=Be):mt===ur&&(q(G(-1))?re=Ge:(ot=Bt.NONE,Fe=Be)),Fe=Math.round(Fe),A(()=>{ne(0),_(Bt.NONE)},Fe),T.current&&le({rect:T.current.getBoundingClientRect(),index:p.globalIndex}),_(ot),w(gc,{type:"swipe",increment:re,duration:Fe,easing:gt})});F.useEffect(()=>{var ie,_e;!((ie=p.animation)===null||ie===void 0)&&ie.increment&&(!((_e=p.animation)===null||_e===void 0)&&_e.duration)&&E(()=>y({type:"swipe",increment:0}),p.animation.duration)},[p.animation,y,E]);const ye=[N,q,D?.width||0,s.swipe,()=>_(Bt.SWIPE),ie=>ne(ie),(ie,_e)=>ce({offset:ie,duration:_e,count:1}),ie=>ce({offset:ie,count:0})],me=[()=>{d&&_(Bt.PULL)},ie=>te(ie),ie=>ee(ie),ie=>ee(ie,!0)];Q_(o,...ye,c,d,...me,K),R_(b,...ye);const pe=We(()=>{o.focus&&U().querySelector(`.${Me(uc)} .${Me(qg())}`)&&B()});F.useEffect(pe,[pe]);const ke=We(()=>{var ie;(ie=i.view)===null||ie===void 0||ie.call(i,{index:p.currentIndex})});F.useEffect(ke,[p.globalIndex,ke]),F.useEffect(()=>ms(C(dr,ie=>ce({direction:dr,...ie})),C(ur,ie=>ce({direction:ur,...ie})),C(gc,ie=>y(ie))),[C,ce,y]);const $e=F.useMemo(()=>({prev:V,next:X,close:K,focus:B,slideRect:D?N_(D,r.padding):{width:0,height:0},containerRect:D||{width:0,height:0},subscribeSensors:N,containerRef:L,setCarouselRef:z,toolbarWidth:g,setToolbarWidth:m}),[V,X,K,B,N,D,L,z,g,m,r.padding]);return F.useImperativeHandle(o.ref,()=>({prev:V,next:X,close:K,focus:B,getLightboxProps:j,getLightboxState:Y}),[V,X,K,B,j,Y]),F.createElement("div",{ref:O,className:Ut(Me(qg()),Me(gs)),style:{...b===Bt.SWIPE?{[ft("swipe_offset")]:`${Math.round(x.current)}px`}:null,...b===Bt.PULL?{[ft("pull_offset")]:`${Math.round(M.current)}px`,[ft("pull_opacity")]:`${S.current}`}:null,...o.touchAction!=="none"?{[ft("controller_touch_action")]:o.touchAction}:null,...a.container},tabIndex:-1,...k},D&&F.createElement(Zg.Provider,{value:$e},e,(n=l.controls)===null||n===void 0?void 0:n.call(l)))}const t2=gn(ho,e2);function Nr(e){return Sr(hg,e)}function Qg(e){return Sr(hc,e)}function n2({slide:e,offset:t}){const n=F.useRef(null),{currentIndex:r,slides:s}=pn(),{slideRect:o,focus:i}=On(),{render:a,carousel:{imageFit:l,imageProps:c},on:{click:d},styles:{slide:u},labels:f}=Dt(),{getOwnerDocument:g}=ys(),m=t!==0;F.useEffect(()=>{var y;m&&(!((y=n.current)===null||y===void 0)&&y.contains(g().activeElement))&&i()},[m,i,g]);const p=()=>{var y,b,_,x;let M=(y=a.slide)===null||y===void 0?void 0:y.call(a,{slide:e,offset:t,rect:o});return!M&&fr(e)&&(M=F.createElement(Mr,{slide:e,offset:t,render:a,rect:o,imageFit:l,imageProps:c,onClick:m?void 0:()=>d?.({index:r})})),M?F.createElement(F.Fragment,null,(b=a.slideHeader)===null||b===void 0?void 0:b.call(a,{slide:e}),((_=a.slideContainer)!==null&&_!==void 0?_:(({children:S})=>S))({slide:e,children:M}),(x=a.slideFooter)===null||x===void 0?void 0:x.call(a,{slide:e})):null};return F.createElement("div",{ref:n,className:Ut(Me(Qg()),!m&&Me(Qg("current")),Me(gs)),...A_(m),style:u,role:"group","aria-roledescription":Er(f,"Slide"),"aria-label":Tg(f,s,r+t)},p())}function r2(){const e=Dt().styles.slide;return F.createElement("div",{className:Me(hc),style:e})}function s2({carousel:e,labels:t}){const{slides:n,currentIndex:r,globalIndex:s}=pn(),{setCarouselRef:o}=On(),{autoPlaying:i,focusWithin:a}=_c(),l=Wi(e.spacing),c=Wi(e.padding),d=Ag(e,n,1),u=[];if(wc(n))for(let f=r-d;f<=r+d;f+=1){const g=kc(n,f),m=s-r+f,p=e.finite&&(f<0||f>n.length-1);u.push(p?{key:m}:{key:[`${m}`,Og(g)].filter(Boolean).join("|"),offset:f-r,slide:g})}return F.createElement("div",{ref:o,className:Ut(Me(Nr()),u.length>0&&Me(Nr("with_slides"))),style:{[`${ft(Nr("slides_count"))}`]:u.length,[`${ft(Nr("spacing_px"))}`]:l.pixel||0,[`${ft(Nr("spacing_percent"))}`]:l.percent||0,[`${ft(Nr("padding_px"))}`]:c.pixel||0,[`${ft(Nr("padding_percent"))}`]:c.percent||0},role:"region","aria-live":i&&!a?"off":"polite","aria-roledescription":Er(t,"Carousel"),"aria-label":Er(t,"Photo gallery")},u.map(({key:f,slide:g,offset:m})=>g?F.createElement(n2,{key:f,slide:g,offset:m}):F.createElement(r2,{key:f})))}const o2=gn(hg,s2);function Jg(){const{carousel:e}=Dt(),{slides:t,currentIndex:n}=pn(),r=t.length===0||e.finite&&n===0,s=t.length===0||e.finite&&n===t.length-1;return{prevDisabled:r,nextDisabled:s}}function Rg(e){var t;const n=Xi(),{publish:r}=vs(),{animation:s,controller:o}=Dt(),{prevDisabled:i,nextDisabled:a}=Jg(),l=((t=s.navigation)!==null&&t!==void 0?t:s.swipe)/2,c=Xg(()=>r(dr),l),d=Xg(()=>r(ur),l),u=We(f=>{switch(f.key){case S_:if(!o.closeOnEscape)return;r(ps);break;case __:(n?a:i)||(n?d:c)();break;case E_:(n?i:a)||(n?c:d)();break;default:return}f.stopPropagation()});F.useEffect(()=>e(pc,u),[e,u])}function ep({label:e,icon:t,renderIcon:n,action:r,onClick:s,disabled:o,style:i}){return F.createElement(xs,{label:e,icon:t,renderIcon:n,className:Me(`navigation_${r}`),disabled:o,onClick:s,style:i,...Gg(On().focus,o)})}function i2({render:{buttonPrev:e,buttonNext:t,iconPrev:n,iconNext:r},styles:s}){const{prev:o,next:i,subscribeSensors:a}=On(),{prevDisabled:l,nextDisabled:c}=Jg();return Rg(a),F.createElement(F.Fragment,null,e?e():F.createElement(ep,{label:"Previous",action:dr,icon:G_,renderIcon:n,style:s.navigationPrev,disabled:l,onClick:o}),t?t():F.createElement(ep,{label:"Next",action:ur,icon:Y_,renderIcon:r,style:s.navigationNext,disabled:c,onClick:i}))}const a2=gn(f_,i2),tp=Me(w_),l2=Me(yg);function c2(e){return"style"in e}function np(e,t,n){const r=window.getComputedStyle(e),s=n?"padding-left":"padding-right",o=n?r.paddingLeft:r.paddingRight,i=e.style.getPropertyValue(s);return e.style.setProperty(s,`${(ji(o)||0)+t}px`),()=>{i?e.style.setProperty(s,i):e.style.removeProperty(s)}}function d2({noScroll:{disabled:e},children:t}){const n=Xi(),{getOwnerDocument:r,getOwnerWindow:s}=ys();return F.useEffect(()=>{if(e)return()=>{};const o=[],i=s(),{body:a,documentElement:l}=r(),c=Math.round(i.innerWidth-l.clientWidth);if(c>0){o.push(np(a,c,n));const d=a.getElementsByTagName("*");for(let u=0;u<d.length;u+=1){const f=d[u];c2(f)&&i.getComputedStyle(f).getPropertyValue("position")==="fixed"&&!f.classList.contains(l2)&&o.push(np(f,c,n))}}return a.classList.add(tp),()=>{a.classList.remove(tp),o.forEach(d=>d())}},[n,e,r,s]),F.createElement(F.Fragment,null,t)}const u2=gn(h_,d2);function rp(e){return Sr(uc,e)}function sp(e,t,n){const r=e.getAttribute(t);return e.setAttribute(t,n),()=>{r?e.setAttribute(t,r):e.removeAttribute(t)}}function f2({portal:{root:e,container:{className:t,style:n,...r}={}},animation:s,styles:o,className:i,on:a,close:l,labels:c,children:d}){const[u,f]=F.useState(!1),[g,m]=F.useState(!1),p=F.useRef([]),y=F.useRef(null),{setTimeout:b}=vo(),{subscribe:_}=vs(),M=Ec()?0:s.fade;F.useEffect(()=>(f(!0),()=>{f(!1),m(!1)}),[]);const S=We(()=>{p.current.forEach(w=>w()),p.current=[]}),k=We(()=>{var w;m(!1),S(),(w=a.exiting)===null||w===void 0||w.call(a),b(()=>{var E;(E=a.exited)===null||E===void 0||E.call(a),l()},M)});F.useEffect(()=>_(ps,k),[_,k]);const N=We(w=>{var E,A,P;D_(w),m(!0),(E=a.entering)===null||E===void 0||E.call(a);const L=(P=(A=w.parentNode)===null||A===void 0?void 0:A.children)!==null&&P!==void 0?P:[];for(let $=0;$<L.length;$+=1){const D=L[$];["TEMPLATE","SCRIPT","STYLE"].indexOf(D.tagName)===-1&&D!==w&&(p.current.push(sp(D,"inert","")),p.current.push(sp(D,"aria-hidden","true")))}p.current.push(()=>{var $,D;(D=($=y.current)===null||$===void 0?void 0:$.focus)===null||D===void 0||D.call($)}),b(()=>{var $;($=a.entered)===null||$===void 0||$.call(a)},M)}),C=F.useCallback(w=>{w?N(w):S()},[N,S]);return u?Ln.createPortal(F.createElement(Z_,{ref:C,className:Ut(i,t,Me(rp()),Me(yg),g&&Me(rp("open"))),"aria-modal":!0,role:"dialog","aria-label":Er(c,"Lightbox"),style:{...s.fade!==Sc.animation.fade?{[ft("fade_animation_duration")]:`${M}ms`}:null,...s.easing.fade!==Sc.animation.easing.fade?{[ft("fade_animation_timing_function")]:s.easing.fade}:null,...o.root,...n},onFocus:w=>{y.current||(y.current=w.relatedTarget)},...r},d),(typeof e=="function"?e():e)||document.body):null}const h2=gn(uc,f2);function g2({children:e}){return F.createElement(F.Fragment,null,e)}const p2=gn(g_,g2);function m2(e){return Sr(gg,e)}function b2({toolbar:{buttons:e},render:{buttonClose:t,iconClose:n},styles:r}){const{close:s,setToolbarWidth:o}=On(),{setContainerRef:i,containerRect:a}=jg();Nn(()=>{o(a?.width)},[o,a?.width]);const l=()=>t?t():F.createElement(xs,{key:ps,label:"Close",icon:W_,renderIcon:n,onClick:s});return F.createElement("div",{ref:i,style:r.toolbar,className:Me(m2())},e?.map(c=>c===ps?l():c))}const y2=gn(gg,b2);function op(e,t){var n;return F.createElement(e.module.component,{key:e.module.name,...t},(n=e.children)===null||n===void 0?void 0:n.map(r=>op(r,t)))}function v2(e,t={}){const{easing:n,...r}=e,{easing:s,...o}=t;return{easing:{...n,...s},...r,...o}}function x2({carousel:e,animation:t,render:n,toolbar:r,controller:s,noScroll:o,on:i,plugins:a,slides:l,index:c,...d}){const{animation:u,carousel:f,render:g,toolbar:m,controller:p,noScroll:y,on:b,slides:_,index:x,plugins:M,...S}=Sc,{config:k,augmentation:N}=I_([At(h2,[At(u2,[At(t2,[At(o2),At(y2),At(a2)])])])],a||M),C=N({animation:v2(u,t),carousel:{...f,...e},render:{...g,...n},toolbar:{...m,...r},controller:{...p,...s},noScroll:{...y,...o},on:{...b,...i},...S,...d});return C.open?F.createElement(Fg,{...C},F.createElement(V_,{slides:l||_,index:ji(c||x)},F.createElement(B_,null,F.createElement($_,null,F.createElement(L_,null,op(At(p2,k),C)))))):null}const ip={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1,maxZoom:8};function w2(e){return Math.min(Math.max(e,Number.EPSILON),1)}function ap(e){const{minZoom:t,...n}={...ip,...e};return{minZoom:w2(t),...n}}function k2(e,t,n,r){const s=F.useRef(void 0),o=F.useRef(void 0),{zoom:i}=Dt().animation,a=Ec(),l=We(()=>{var c,d,u;if((c=s.current)===null||c===void 0||c.cancel(),s.current=void 0,o.current&&r?.current){try{s.current=(u=(d=r.current).animate)===null||u===void 0?void 0:u.call(d,[{transform:o.current},{transform:`scale(${e}) translateX(${t}px) translateY(${n}px)`}],{duration:a?0:i??500,easing:s.current?"ease-out":"ease-in-out"})}catch(f){console.error(f)}o.current=void 0,s.current&&(s.current.onfinish=()=>{s.current=void 0})}});return Nn(l,[e,t,n,l]),F.useCallback(()=>{o.current=r?.current?window.getComputedStyle(r.current).transform:void 0},[r])}function C2(e,t){const{on:n}=Dt(),r=We(()=>{var s;t||(s=n.zoom)===null||s===void 0||s.call(n,{zoom:e})});F.useEffect(r,[e,r])}function Ki(){const{zoom:e}=Dt();return ap(e)}function S2(e,t){var n;const r=typeof e=="function"?(n=e(t))!==null&&n!==void 0?n:ip.maxZoom:e;return Math.max(r,1)}function _2(e,t){var n,r;let s={width:0,height:0},o={width:0,height:0};const{currentSlide:i}=pn(),{imageFit:a}=Dt().carousel,{maxZoomPixelRatio:l,maxZoom:c}=Ki();if(e&&i){const u={...i,...t};if(fr(u)){const f=vc(u,a),g=Math.max(...(((n=u.srcSet)===null||n===void 0?void 0:n.map(p=>p.width))||[]).concat(u.width?[u.width]:[])),m=Math.max(...(((r=u.srcSet)===null||r===void 0?void 0:r.map(p=>p.height))||[]).concat(u.height?[u.height]:[]));g>0&&m>0&&e.width>0&&e.height>0&&(o=f?{width:Math.round(Math.min(g,e.width/e.height*m)),height:Math.round(Math.min(m,e.height/e.width*g))}:{width:g,height:m},o={width:o.width*l,height:o.height*l},s=f?{width:Math.min(e.width,o.width,g),height:Math.min(e.height,o.height,m)}:{width:Math.round(Math.min(e.width,e.height/m*g,g)),height:Math.round(Math.min(e.height,e.width/g*m,m))})}else e.width>0&&e.height>0&&(t&&t.width>0&&t.height>0?s={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}:s={width:e.width,height:e.height})}const d=i&&s.width?fr(i)?Math.max(yc(o.width/s.width,5),1):S2(c,i):1;return{imageRect:s,maxZoom:d}}function lp(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function cp(e,t,n=100,r=2){return e*Math.min(1+Math.abs(t/n),r)**Math.sign(t)}function E2(e,t,n,r,s,o,i,a,l){const c=F.useRef([]),d=F.useRef(0),u=F.useRef(void 0),{globalIndex:f}=pn(),{getOwnerWindow:g}=ys(),{containerRef:m,subscribeSensors:p}=On(),{keyboardMoveDistance:y,zoomInMultiplier:b,wheelZoomDistanceFactor:_,scrollToZoom:x,doubleTapDelay:M,doubleClickDelay:S,doubleClickMaxStops:k,pinchZoomDistanceFactor:N,pinchZoomV4:C}=Ki(),w=F.useCallback(z=>{if(m.current){const{pageX:U,pageY:W}=z,{scrollX:G,scrollY:B}=g(),{left:j,top:Y,width:V,height:X}=m.current.getBoundingClientRect();return[U-j-G-V/2,W-Y-B-X/2]}return[]},[m,g]),E=We(z=>{const{key:U,metaKey:W,ctrlKey:G}=z,B=W||G,j=()=>{z.preventDefault(),z.stopPropagation()};if(e>1){const Y=(V,X)=>{j(),a(V,X)};U==="ArrowDown"?Y(0,y):U==="ArrowUp"?Y(0,-y):U==="ArrowLeft"?Y(-y,0):U==="ArrowRight"&&Y(y,0)}U==="+"||B&&U==="="?(j(),s()):U==="-"||B&&U==="_"?(j(),o()):B&&U==="0"&&(j(),i(1))}),A=We(z=>{if((z.ctrlKey||x)&&Math.abs(z.deltaY)>Math.abs(z.deltaX)){z.stopPropagation(),i(cp(e,-z.deltaY,_),!0,...w(z));return}e>1&&(z.stopPropagation(),x||a(z.deltaX,z.deltaY))}),P=F.useCallback(z=>{const U=c.current;U.splice(0,U.length,...U.filter(W=>W.pointerId!==z.pointerId))},[]),L=F.useCallback(z=>{P(z),z.persist(),c.current.push(z)},[P]),$=We(z=>{var U;const W=c.current;if(z.pointerType==="mouse"&&z.buttons>1||!(!((U=l?.current)===null||U===void 0)&&U.contains(z.target)))return;e>1&&z.stopPropagation();const{timeStamp:G}=z;if(W.length===0&&G-d.current<(z.pointerType==="touch"?M:S)){d.current=0;const B=e>=1?e!==n?e*Math.max(n**(1/k),b):1:e!==t?e/Math.max(t**(-1/k),b):1;i(B,!1,...w(z))}else d.current=G;if(L(z),W.length===2){const B=lp(W[0],W[1]);u.current={previousDistance:B,initialDistance:Math.max(B,1),initialZoom:e}}}),D=We(z=>{const U=c.current,W=U.find(G=>G.pointerId===z.pointerId);if(U.length===2&&u.current){z.stopPropagation(),L(z);const G=lp(U[0],U[1]),B=C?u.current.initialZoom/u.current.initialDistance*G:cp(e,G-u.current.previousDistance,N);i(B,!0,...U.map(j=>w(j)).reduce((j,Y)=>Y.map((V,X)=>j[X]+V/2))),u.current.previousDistance=G;return}e>1&&(z.stopPropagation(),W&&(U.length===1&&a((W.clientX-z.clientX)/e,(W.clientY-z.clientY)/e),L(z)))}),O=F.useCallback(z=>{const U=c.current;U.length===2&&U.find(W=>W.pointerId===z.pointerId)&&(u.current=void 0),P(z)},[P]),T=F.useCallback(()=>{const z=c.current;z.splice(0,z.length),d.current=0,u.current=void 0},[]);Kg(p,$,D,O,r),F.useEffect(T,[f,T]),F.useEffect(()=>r?()=>{}:ms(T,p(pc,E),p(mc,A)),[r,p,T,E,A])}function M2(e,t,n){const[r,s]=F.useState(1),[o,i]=F.useState(0),[a,l]=F.useState(0),c=k2(r,o,a,n),{currentSlide:d,globalIndex:u}=pn(),{containerRect:f,slideRect:g}=On(),{minZoom:m,zoomInMultiplier:p}=Ki(),y=d&&fr(d)?d.src:void 0,b=!n?.current;Nn(()=>{s(1),i(0),l(0)},[u,y]);const _=F.useCallback((N,C,w)=>{const E=w||r,A=o-(N||0),P=a-(C||0),L=(e.width*E-g.width)/2/E,$=(e.height*E-g.height)/2/E;i(Math.min(Math.abs(A),Math.max(L,0))*Math.sign(A)),l(Math.min(Math.abs(P),Math.max($,0))*Math.sign(P))},[r,o,a,g,e.width,e.height]),x=F.useCallback((N,C,w,E)=>{const A=yc(N+.01<t?N-.01>m?N:m:t,5);C||c(),_(w?w*(1/r-1/A):0,E?E*(1/r-1/A):0,A),s(A)},[r,m,t,_,c]),M=We(()=>{r>1&&(r>t&&x(t,!0),_())});Nn(M,[f.width,f.height,M]);const S=F.useCallback(()=>{const N=r*p;x(r<1&&N>1?1:N)},[r,p,x]),k=F.useCallback(()=>{const N=r/p;x(r>1&&N<1?1:N)},[r,p,x]);return{zoom:r,offsetX:o,offsetY:a,disabled:b,changeOffsets:_,changeZoom:x,zoomIn:S,zoomOut:k}}const dp=F.createContext(null),Dc=un("useZoom","ZoomControllerContext",dp);function N2({children:e}){const[t,n]=F.useState(),{slideRect:r}=On(),{ref:s,minZoom:o}=Ki(),{imageRect:i,maxZoom:a}=_2(r,t?.imageDimensions),{zoom:l,offsetX:c,offsetY:d,disabled:u,changeZoom:f,changeOffsets:g,zoomIn:m,zoomOut:p}=M2(i,a,t?.zoomWrapperRef);C2(l,u),E2(l,o,a,u,m,p,f,g,t?.zoomWrapperRef);const y=F.useMemo(()=>({zoom:l,minZoom:o,maxZoom:a,offsetX:c,offsetY:d,disabled:u,zoomIn:m,zoomOut:p,changeZoom:f}),[l,o,a,c,d,u,m,p,f]);F.useImperativeHandle(s,()=>y,[y]);const b=F.useMemo(()=>({...y,setZoomWrapper:n}),[y,n]);return F.createElement(dp.Provider,{value:b},e)}const T2=en("ZoomIn",F.createElement(F.Fragment,null,F.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"}),F.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),O2=en("ZoomOut",F.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"})),up=F.forwardRef(function({zoomIn:t,onLoseFocus:n},r){const s=F.useRef(!1),o=F.useRef(!1),{zoom:i,minZoom:a,maxZoom:l,zoomIn:c,zoomOut:d,disabled:u}=Dc(),{render:f}=Dt(),g=u||(t?i>=l:i<=a);return F.useEffect(()=>{g&&s.current&&o.current&&n(),g||(s.current=!0)},[g,n]),F.createElement(xs,{ref:r,disabled:g,label:t?"Zoom in":"Zoom out",icon:t?T2:O2,renderIcon:t?f.iconZoomIn:f.iconZoomOut,onClick:t?c:d,onFocus:()=>{o.current=!0},onBlur:()=>{o.current=!1}})});function A2(){const e=F.useRef(null),t=F.useRef(null),{focus:n}=On(),r=F.useCallback(i=>{var a,l;!((a=i.current)===null||a===void 0)&&a.disabled?n():(l=i.current)===null||l===void 0||l.focus()},[n]),s=F.useCallback(()=>r(e),[r]),o=F.useCallback(()=>r(t),[r]);return F.createElement(F.Fragment,null,F.createElement(up,{zoomIn:!0,ref:e,onLoseFocus:o}),F.createElement(up,{ref:t,onLoseFocus:s}))}function D2(){const{render:e}=Dt(),t=Dc();return e.buttonZoom?F.createElement(F.Fragment,null,e.buttonZoom(t)):F.createElement(A2,null)}function I2(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function L2({current:e,preload:t},{type:n,source:r}){switch(n){case"fetch":return e?{current:e,preload:r}:{current:r};case"done":return r===t?{current:r}:{current:e,preload:t};default:throw new Error(Mg)}}function P2(e){var t,n;const[{current:r,preload:s},o]=F.useReducer(L2,{}),{slide:i,rect:a,imageFit:l,render:c,interactive:d}=e,u=i.srcSet.sort((S,k)=>S.width-k.width),f=(t=i.width)!==null&&t!==void 0?t:u[u.length-1].width,g=(n=i.height)!==null&&n!==void 0?n:u[u.length-1].height,m=vc(i,l),p=Math.max(...u.map(S=>S.width)),y=Math.min((m?Math.max:Math.min)(a.width,f*(a.height/g)),p),b=T_(),_=We(()=>{var S;const k=(S=u.find(N=>N.width>=y*b))!==null&&S!==void 0?S:u[u.length-1];(!r||u.findIndex(N=>N.src===r)<u.findIndex(N=>N===k))&&o({type:"fetch",source:k.src})});Nn(_,[a.width,a.height,b,_]);const x=We(S=>o({type:"done",source:S})),M={WebkitTransform:d?"initial":"translateZ(0)"};return m||Object.assign(M,a.width/a.height<f/g?{width:"100%",height:"auto"}:{width:"auto",height:"100%"}),F.createElement(F.Fragment,null,s&&s!==r&&F.createElement(Mr,{key:"preload",...e,offset:void 0,slide:{...i,src:s,srcSet:void 0},style:{position:"absolute",visibility:"hidden",...M},onLoad:()=>x(s),render:{...c,iconLoading:()=>null,iconError:()=>null}}),r&&F.createElement(Mr,{key:"current",...e,slide:{...i,src:r,srcSet:void 0},style:M}))}function $2({render:e,slide:t,offset:n,rect:r}){var s;const[o,i]=F.useState(),a=F.useRef(null),l=fr(t),{zoom:c,maxZoom:d,offsetX:u,offsetY:f,setZoomWrapper:g}=Dc(),m=c>1,{carousel:p,on:y}=Dt(),{currentIndex:b}=pn();Nn(()=>{if(n!==0||l||!a.current)return()=>{};const x=()=>{const S=a.current;if(!S)return;let k=0,N=0;for(const C of S.children)C instanceof HTMLElement&&(k=Math.max(k,C.offsetWidth),N=Math.max(N,C.offsetHeight));i(C=>C&&C.width===k&&C.height===N?C:{width:k,height:N})};if(x(),typeof ResizeObserver>"u")return()=>{};const M=new ResizeObserver(x);for(const S of a.current.children)M.observe(S);return()=>M.disconnect()},[n,l,r]),Nn(()=>n===0?(g({zoomWrapperRef:a,imageDimensions:o}),()=>g(void 0)):()=>{},[n,o,g]);let _=(s=e.slide)===null||s===void 0?void 0:s.call(e,{slide:t,offset:n,rect:r,zoom:c,maxZoom:d});if(!_&&l){const x={slide:t,offset:n,rect:r,render:e,imageFit:p.imageFit,imageProps:p.imageProps,onClick:n===0?()=>{var M;return(M=y.click)===null||M===void 0?void 0:M.call(y,{index:b})}:void 0};_=I2(t)?F.createElement(P2,{...x,slide:t,interactive:m,rect:n===0?{width:r.width*c,height:r.height*c}:r}):F.createElement(Mr,{onLoad:M=>i({width:M.naturalWidth,height:M.naturalHeight}),...x})}return _?F.createElement("div",{ref:a,className:Ut(Me(bg),Me(gs),Me(vg),m&&Me(k_)),style:n===0?{transform:`scale(${c}) translateX(${u}px) translateY(${f}px)`}:void 0},_):null}const F2=({augment:e,addModule:t})=>{e(({zoom:n,toolbar:r,render:s,controller:o,...i})=>{const a=ap(n);return{zoom:a,toolbar:Gi(r,mg,F.createElement(D2,null)),render:{...s,slide:l=>{var c,d;return fr(l.slide)||l.slide.type!=null&&(!((c=a.supports)===null||c===void 0)&&c.includes(l.slide.type))?F.createElement($2,{render:s,...l}):(d=s.slide)===null||d===void 0?void 0:d.call(s,l)}},controller:{...o,preventDefaultWheelY:a.scrollToZoom},...i}}),t(gn(mg,N2))},z2={separator:"/",container:{}},fp=e=>({...z2,...e});function V2({counter:e}){const{slides:t,currentIndex:n}=pn(),{separator:r,container:{className:s,...o},className:i,...a}=fp(e);return t.length===0?null:F.createElement("div",{className:Ut(Me("counter"),s||i),...a,...o,"aria-hidden":!0},n+1," ",r," ",t.length)}function H2({augment:e,addChild:t}){e(({counter:n,...r})=>({counter:fp(n),...r})),t(ho,gn(p_,V2))}const U2={autoplay:!1,delay:3e3,ref:null},hp=e=>({...U2,...e}),gp=F.createContext(null),B2=un("useSlideshow","SlideshowContext",gp);function j2({slideshow:e,carousel:{finite:t},on:n,children:r}){const{autoplay:s,delay:o,ref:i}=hp(e),a=F.useRef(s),[l,c]=F.useState(s),d=F.useRef(void 0),u=F.useRef(void 0),{slides:f,currentIndex:g}=pn(),{setTimeout:m,clearTimeout:p}=vo(),{subscribe:y}=vs(),{next:b}=On(),{setAutoPlaying:_}=_c();F.useEffect(()=>_(l),[l,_]);const x=f.length===0||t&&g===f.length-1,M=F.useCallback(()=>{!l&&!x&&c(!0)},[l,x]),S=F.useCallback(()=>{l&&c(!1)},[l]),k=F.useCallback(()=>{p(d.current),d.current=void 0},[p]),N=We(()=>{k(),!(!l||x||u.current===hs||u.current===fc)&&(d.current=m(()=>{l&&(u.current=void 0,b())},o))});F.useEffect(N,[g,l,N]),F.useEffect(()=>{l&&x&&c(!1)},[g,l,x]);const C=We(()=>{var A;return(A=n.slideshowStart)===null||A===void 0?void 0:A.call(n)}),w=We(()=>{var A;return(A=n.slideshowStop)===null||A===void 0?void 0:A.call(n)});F.useEffect(()=>{l?C():a.current&&w(),a.current=l},[l,C,w]),F.useEffect(()=>ms(k,y(b_,()=>{u.current=hs,k()}),y(y_,()=>{u.current=fc,k()}),y(v_,()=>{u.current=mo,N()}),y(x_,()=>{u.current=bo,N()})),[y,k,N]);const E=F.useMemo(()=>({playing:l,disabled:x,play:M,pause:S}),[l,x,M,S]);return F.useImperativeHandle(i,()=>E,[E]),F.createElement(gp.Provider,{value:E},r)}const W2=en("Play",F.createElement("path",{d:"M8 5v14l11-7z"})),G2=en("Pause",F.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function Y2(){const{playing:e,disabled:t,play:n,pause:r}=B2(),{render:s}=Dt(),o=Gg(On().focus,t);return s.buttonSlideshow?F.createElement(F.Fragment,null,s.buttonSlideshow({playing:e,disabled:t,play:n,pause:r})):F.createElement(xs,{label:e?"Pause":"Play",icon:e?G2:W2,renderIcon:e?s.iconSlideshowPause:s.iconSlideshowPlay,onClick:e?r:n,disabled:t,...o})}function X2({augment:e,addModule:t}){e(({slideshow:n,toolbar:r,...s})=>({toolbar:Gi(r,pg,F.createElement(Y2,null)),slideshow:hp(n),...s})),t(gn(pg,j2))}const K2={auto:!1,ref:null},pp=e=>({...K2,...e}),mp=F.createContext(null),q2=un("useFullscreen","FullscreenContext",mp);function Z2({fullscreen:e,on:t,children:n}){const{auto:r,ref:s}=pp(e),o=F.useRef(null),[i,a]=F.useState(),[l,c]=F.useState(!1),d=F.useRef(!1),{getOwnerDocument:u}=ys();Nn(()=>{var x,M,S,k;const N=u();a(!((k=(S=(M=(x=N.fullscreenEnabled)!==null&&x!==void 0?x:N.webkitFullscreenEnabled)!==null&&M!==void 0?M:N.mozFullScreenEnabled)!==null&&S!==void 0?S:N.msFullscreenEnabled)!==null&&k!==void 0&&k))},[u]);const f=F.useCallback(()=>{var x;const M=u(),S=M.fullscreenElement||M.webkitFullscreenElement||M.mozFullScreenElement||M.msFullscreenElement;return((x=S?.shadowRoot)===null||x===void 0?void 0:x.fullscreenElement)||S},[u]),g=F.useCallback(()=>{const x=o.current;try{x.requestFullscreen?x.requestFullscreen().catch(()=>{}):x.webkitRequestFullscreen?x.webkitRequestFullscreen():x.mozRequestFullScreen?x.mozRequestFullScreen():x.msRequestFullscreen&&x.msRequestFullscreen()}catch{}},[]),m=F.useCallback(()=>{if(!f())return;const x=u();try{x.exitFullscreen?x.exitFullscreen().catch(()=>{}):x.webkitExitFullscreen?x.webkitExitFullscreen():x.mozCancelFullScreen?x.mozCancelFullScreen():x.msExitFullscreen&&x.msExitFullscreen()}catch{}},[f,u]);F.useEffect(()=>{const x=u(),M=()=>{c(f()===o.current)};return ms(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(S=>(x.addEventListener(S,M),()=>x.removeEventListener(S,M))))},[f,u]);const p=We(()=>{var x;return(x=t.enterFullscreen)===null||x===void 0?void 0:x.call(t)}),y=We(()=>{var x;return(x=t.exitFullscreen)===null||x===void 0?void 0:x.call(t)});F.useEffect(()=>{l&&(d.current=!0),d.current&&(l?p:y)()},[l,p,y]);const b=We(()=>{var x;return(x=r?g:null)===null||x===void 0||x(),m});F.useEffect(b,[b]);const _=F.useMemo(()=>({fullscreen:l,disabled:i,enter:g,exit:m}),[l,i,g,m]);return F.useImperativeHandle(s,()=>_,[_]),F.createElement("div",{ref:o,className:Ut(Me(go),Me(bg))},F.createElement(mp.Provider,{value:_},n))}const Q2=en("EnterFullscreen",F.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),J2=en("ExitFullscreen",F.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function R2(){var e;const{fullscreen:t,disabled:n,enter:r,exit:s}=q2(),{render:o}=Dt();return n?null:o.buttonFullscreen?F.createElement(F.Fragment,null,(e=o.buttonFullscreen)===null||e===void 0?void 0:e.call(o,{fullscreen:t,disabled:n,enter:r,exit:s})):F.createElement(xs,{disabled:n,label:t?"Exit Fullscreen":"Enter Fullscreen",icon:t?J2:Q2,renderIcon:t?o.iconExitFullscreen:o.iconEnterFullscreen,onClick:t?s:r})}function eE({augment:e,contains:t,addParent:n}){e(({fullscreen:r,toolbar:s,...o})=>({toolbar:Gi(s,go,F.createElement(R2,null)),fullscreen:pp(r),...o})),n(t(po)?po:ho,gn(go,Z2))}const Tr={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},Ic=e=>({...Tr,...e});function bp(){const{thumbnails:e}=Dt();return Ic(e)}const Or=e=>Sr(po,e),It=e=>Or(Sr("thumbnail",e)),tE=en("VideoThumbnail",F.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"})),nE=en("UnknownThumbnail",F.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 rE({slide:e,render:t,rect:n,imageFit:r}){var s;const o=(s=t.thumbnail)===null||s===void 0?void 0:s.call(t,{slide:e,render:t,rect:n,imageFit:r});if(o)return o;const i={render:t,rect:n,imageFit:r};if(e.thumbnail)return F.createElement(Mr,{slide:{src:e.thumbnail},...i});if(fr(e))return F.createElement(Mr,{slide:e,...i});const a=Me(It(Bi));return e.type==="video"?F.createElement(F.Fragment,null,e.poster&&F.createElement(Mr,{slide:{src:e.poster},...i}),F.createElement(tE,{className:a})):F.createElement(nE,{className:a})}const sE=_r("active"),Lc=_r("fadein"),Pc=_r("fadeout"),oE=_r("placeholder"),yp="delay",vp="duration";function iE({slide:e,index:t,onClick:n,fadeIn:r,fadeOut:s,placeholder:o,onLoseFocus:i}){const a=F.useRef(null),{render:l,styles:c,labels:d}=Dt(),{slides:u,globalIndex:f}=pn(),{getOwnerDocument:g}=ys(),{width:m,height:p,imageFit:y}=bp(),b={width:m,height:p},_=t===f,x=We(i);return F.useEffect(()=>{s&&g().activeElement===a.current&&x()},[s,x,g]),F.createElement("button",{ref:a,type:"button",className:Ut(Me(gs),Me(It()),_&&Me(It(sE())),r&&Me(It(Lc())),s&&Me(It(Pc())),o&&Me(It(oE()))),style:{...r?{[ft(It(Lc(vp)))]:`${r.duration}ms`,[ft(It(Lc(yp)))]:`${r.delay}ms`}:null,...s?{[ft(It(Pc(vp)))]:`${s.duration}ms`,[ft(It(Pc(yp)))]:`${s.delay}ms`}:null,...c.thumbnail},onClick:n,"aria-current":_?!0:void 0,"aria-label":Tg(d,u,t)},e&&rE({slide:e,render:l,rect:b,imageFit:y}))}function xp(e){return["top","bottom"].includes(e)}function wp(e,t){return t+2*(e.border+e.padding)+e.gap}function aE(e){const{thumbnail:t,poster:n}=e||{thumbnail:"placeholder"};return typeof t=="string"&&t||typeof n=="string"&&n||e&&Og(e)||void 0}function kp({visible:e,containerRef:t}){const n=F.useRef(null),r=Xi(),{publish:s,subscribe:o}=vs(),{carousel:i,styles:a,labels:l}=Dt(),{slides:c,globalIndex:d,animation:u}=pn(),{registerSensors:f,subscribeSensors:g}=Yg();Rg(g);const m=bp(),{position:p,width:y,height:b,border:_,borderStyle:x,borderColor:M,borderRadius:S,padding:k,gap:N,vignette:C}=m,w=u?.duration!==void 0&&u?.increment||0,E=u?.duration||0,{prepareAnimation:A}=Mc(n,O=>({keyframes:xp(p)?[{transform:`translateX(${(r?-1:1)*wp(m,y)*w+O}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${wp(m,b)*w+O}px)`},{transform:"translateY(0)"}],duration:E,easing:u?.easing})),P=We(()=>{let O=0;if(t.current&&n.current){const T=t.current.getBoundingClientRect(),z=n.current.getBoundingClientRect();O=xp(p)?z.left-T.left-(T.width-z.width)/2:z.top-T.top-(T.height-z.height)/2}A(O)});F.useEffect(()=>ms(o(gc,P)),[o,P]);const L=Ag(i,c),$=[];if(wc(c))for(let O=d-L-Math.abs(w);O<=d+L+Math.abs(w);O+=1){const z=i.finite&&(O<0||O>c.length-1)||w<0&&O<d-L||w>0&&O>d+L?null:kc(c,O),U=[`${O}`,aE(z)].filter(Boolean).join("|");$.push({key:U,index:O,slide:z})}const D=O=>()=>{O>d?s(ur,{count:O-d}):O<d&&s(dr,{count:d-O})};return F.createElement("div",{className:Ut(Me(Or("container")),Me(gs)),style:{...e?null:{display:"none"},...y!==Tr.width?{[ft(It("width"))]:`${y}px`}:null,...b!==Tr.height?{[ft(It("height"))]:`${b}px`}:null,..._!==Tr.border?{[ft(It("border"))]:`${_}px`}:null,...x?{[ft(It("border_style"))]:x}:null,...M?{[ft(It("border_color"))]:M}:null,...S!==Tr.borderRadius?{[ft(It("border_radius"))]:`${S}px`}:null,...k!==Tr.padding?{[ft(It("padding"))]:`${k}px`}:null,...N!==Tr.gap?{[ft(It("gap"))]:`${N}px`}:null,...a.thumbnailsContainer}},F.createElement("nav",{ref:n,style:a.thumbnailsTrack,className:Ut(Me(Or("track")),Me(gs)),"aria-label":Er(l,"Thumbnails"),tabIndex:-1,...f},$.map(({key:O,index:T,slide:z})=>{const U=E/Math.abs(w||1),W=w>0&&T>d+L-w&&T<=d+L||w<0&&T<d-L-w&&T>=d-L?{duration:U,delay:((w>0?T-(d+L-w):d-L-w-T)-1)*U}:void 0,G=w>0&&T<d-L||w<0&&T>d+L?{duration:U,delay:(w>0?w-(d-L-T):-w-(T-(d+L)))*U}:void 0;return F.createElement(iE,{key:O,index:T,slide:z,fadeIn:W,fadeOut:G,placeholder:!z,onClick:D(T),onLoseFocus:()=>{var B;return(B=n.current)===null||B===void 0?void 0:B.focus()}})})),C&&F.createElement("div",{className:Me(Or("vignette"))}))}const Cp=F.createContext(null),lE=un("useThumbnails","ThumbnailsContext",Cp);function cE({children:e,...t}){const{ref:n,position:r,hidden:s}=Ic(t.thumbnails),[o,i]=F.useState(!s),a=F.useRef(null),l=F.useMemo(()=>({visible:o,show:()=>i(!0),hide:()=>i(!1)}),[o]);return F.useImperativeHandle(n,()=>l,[l]),F.createElement(Fg,{...t},F.createElement(Cp.Provider,{value:l},F.createElement("div",{ref:a,className:Ut(Me(Or()),Me(Or(`${r}`)))},["start","top"].includes(r)&&F.createElement(kp,{containerRef:a,visible:o}),F.createElement("div",{className:Me(Or("wrapper"))},e),["end","bottom"].includes(r)&&F.createElement(kp,{containerRef:a,visible:o}))))}const Sp=()=>F.createElement(F.Fragment,null,F.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),F.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),dE=en("ThumbnailsVisible",Sp()),uE=j_("ThumbnailsHidden",Sp());function fE(){const{visible:e,show:t,hide:n}=lE(),{render:r}=Dt();return r.buttonThumbnails?F.createElement(F.Fragment,null,r.buttonThumbnails({visible:e,show:t,hide:n})):F.createElement(xs,{label:e?"Hide thumbnails":"Show thumbnails",icon:e?dE:uE,renderIcon:e?r.iconThumbnailsVisible:r.iconThumbnailsHidden,onClick:e?n:t})}function hE({augment:e,contains:t,append:n,addParent:r}){e(({thumbnails:o,toolbar:i,...a})=>{const l=Ic(o);return{toolbar:Gi(i,po,l.showToggle?F.createElement(fE,null):null),thumbnails:l,...a}});const s=gn(po,cE);t(go)?n(go,s):r(ho,s)}const $c=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}},gE=window.G7Core?.createLogger?.("Comp:ImageGallery")??{log:(...e)=>console.log("[Comp:ImageGallery]",...e),warn:(...e)=>console.warn("[Comp:ImageGallery]",...e),error:(...e)=>console.error("[Comp:ImageGallery]",...e)},Fc=window.G7Core,qi=(e,t)=>Fc?.t?.(e,t)??e,pE=async(e,t)=>{try{const n=await Fc.api.get(e,{responseType:"blob"});if(n){const r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}catch(n){gE.error("Failed to download file:",n),Fc?.toast?.error?.(qi("common.download_failed"))}},mE=(e,t)=>{const n=document.createElement("a");n.href=e,n.download=t,n.target="_blank",document.body.appendChild(n),n.click(),document.body.removeChild(n)},zc=async e=>{const t=e.downloadUrl||e.src,n=e.filename||e.title||"image";e.downloadRequiresAuth&&!$c(t)?await pE(t,n):mE(t,n)},bE=({image:e,index:t,onDownload:n})=>{const[r,s]=v.useState(!1),o=async i=>{if(i.stopPropagation(),n){n(e,t);return}s(!0);try{await zc(e)}finally{s(!1)}};return h.jsx(ae,{type:"button",onClick:o,disabled:r,className:"yarl__button flex items-center justify-center","aria-label":qi("common.download"),title:qi("common.download"),children:r?h.jsx(pt,{className:"fa-solid fa-spinner fa-spin text-white"}):h.jsx(pt,{className:"fa-solid fa-download text-white"})})},Zi=({images:e,isOpen:t,onClose:n,startIndex:r=0,enableZoom:s=!0,enableSlideshow:o=!1,enableFullscreen:i=!0,showCounter:a=!0,showDownload:l=!0,showThumbnails:c=!0,onDownload:d,editorAttrs:u,id:f})=>{const[g,m]=v.useState(r),p=v.useRef(r),y=e.map(x=>({src:x.src,title:x.title,description:x.description})),b=[];s&&b.push(F2),o&&b.push(X2),i&&b.push(eE),a&&b.push(H2),c&&b.push(hE);const _=e[g];if(v.useEffect(()=>{p.current=g},[g]),u){const x=(e??[]).slice(0,4);return h.jsx(I,{id:f,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",...u,children:x.length>0?x.map((M,S)=>h.jsx(Sn,{src:M.thumbnail||M.src,alt:M.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},S)):h.jsxs(I,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[h.jsx(pt,{className:"fa-regular fa-images mr-2"}),qi("editor.component.image_gallery")]})})}return h.jsx(x2,{open:t,close:n,slides:y,index:g,plugins:b,on:{view:({index:x})=>{x!==p.current&&m(x)}},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:[l&&_&&h.jsx(bE,{image:_,index:g,onDownload:d},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},_p=()=>{const[e,t]=v.useState(!1),[n,r]=v.useState([]),[s,o]=v.useState(0),i=v.useCallback((l,c=0)=>{r(l),o(c),t(!0)},[]),a=v.useCallback(()=>{t(!1)},[]);return{isOpen:e,openGallery:i,closeGallery:a,galleryProps:{images:n,isOpen:e,onClose:a,startIndex:s}}};Zi.displayName="ImageGallery";const yE=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:Zi,executeImageDownload:zc,useImageGallery:_p},Symbol.toStringTag,{value:"Module"})),vE=v.createContext(null),xE=({value:e,children:t})=>h.jsx(vE.Provider,{value:e,children:t});function wE(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function Ep(e,t){return new Promise((function(n,r){let s;return kE(e).then((function(o){try{return s=o,n(new Blob([t.slice(0,2),s,t.slice(2)],{type:"image/jpeg"}))}catch(i){return r(i)}}),r)}))}const kE=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:s}})=>{const o=new DataView(s);let i=0;if(o.getUint16(i)!==65496)return n("not a valid JPEG");for(i+=2;;){const a=o.getUint16(i);if(a===65498)break;const l=o.getUint16(i+2);if(a===65505&&o.getUint32(i+4)===1165519206){const c=i+10;let d;switch(o.getUint16(c)){case 18761:d=!0;break;case 19789:d=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(c+2,d)!==42)return n("TIFF header contains invalid version");const u=o.getUint32(c+4,d),f=c+u+2+12*o.getUint16(c+u,d);for(let g=c+u+2;g<f;g+=12)if(o.getUint16(g,d)==274){if(o.getUint16(g+2,d)!==3)return n("Orientation data type is invalid");if(o.getUint32(g+4,d)!==1)return n("Orientation data count is invalid");o.setUint16(g+8,1,d);break}return t(s.slice(i,i+2+l))}i+=2+l}return t(new Blob)})),r.readAsArrayBuffer(e)}));var Qi={},CE={get exports(){return Qi},set exports(e){Qi=e}};(function(e){var t,n,r={};CE.exports=r,r.parse=function(s,o){for(var i=r.bin.readUshort,a=r.bin.readUint,l=0,c={},d=new Uint8Array(s),u=d.length-4;a(d,u)!=101010256;)u--;l=u,l+=4;var f=i(d,l+=4);i(d,l+=2);var g=a(d,l+=2),m=a(d,l+=4);l+=4,l=m;for(var p=0;p<f;p++){a(d,l),l+=4,l+=4,l+=4,a(d,l+=4),g=a(d,l+=4);var y=a(d,l+=4),b=i(d,l+=4),_=i(d,l+2),x=i(d,l+4);l+=6;var M=a(d,l+=8);l+=4,l+=b+_+x,r._readLocal(d,M,c,g,y,o)}return c},r._readLocal=function(s,o,i,a,l,c){var d=r.bin.readUshort,u=r.bin.readUint;u(s,o),d(s,o+=4),d(s,o+=2);var f=d(s,o+=2);u(s,o+=2),u(s,o+=4),o+=4;var g=d(s,o+=8),m=d(s,o+=2);o+=2;var p=r.bin.readUTF8(s,o,g);if(o+=g,o+=m,c)i[p]={size:l,csize:a};else{var y=new Uint8Array(s.buffer,o);if(f==0)i[p]=new Uint8Array(y.buffer.slice(o,o+a));else{if(f!=8)throw"unknown compression method: "+f;var b=new Uint8Array(l);r.inflateRaw(y,b),i[p]=b}}},r.inflateRaw=function(s,o){return r.F.inflate(s,o)},r.inflate=function(s,o){return s[0],s[1],r.inflateRaw(new Uint8Array(s.buffer,s.byteOffset+2,s.length-6),o)},r.deflate=function(s,o){o==null&&(o={level:6});var i=0,a=new Uint8Array(50+Math.floor(1.1*s.length));a[i]=120,a[i+1]=156,i+=2,i=r.F.deflateRaw(s,a,i,o.level);var l=r.adler(s,0,s.length);return a[i+0]=l>>>24&255,a[i+1]=l>>>16&255,a[i+2]=l>>>8&255,a[i+3]=l>>>0&255,new Uint8Array(a.buffer,0,i+4)},r.deflateRaw=function(s,o){o==null&&(o={level:6});var i=new Uint8Array(50+Math.floor(1.1*s.length)),a=r.F.deflateRaw(s,i,a,o.level);return new Uint8Array(i.buffer,0,a)},r.encode=function(s,o){o==null&&(o=!1);var i=0,a=r.bin.writeUint,l=r.bin.writeUshort,c={};for(var d in s){var u=!r._noNeed(d)&&!o,f=s[d],g=r.crc.crc(f,0,f.length);c[d]={cpr:u,usize:f.length,crc:g,file:u?r.deflateRaw(f):f}}for(var d in c)i+=c[d].file.length+30+46+2*r.bin.sizeUTF8(d);i+=22;var m=new Uint8Array(i),p=0,y=[];for(var d in c){var b=c[d];y.push(p),p=r._writeHeader(m,p,d,b,0)}var _=0,x=p;for(var d in c)b=c[d],y.push(p),p=r._writeHeader(m,p,d,b,1,y[_++]);var M=p-x;return a(m,p,101010256),p+=4,l(m,p+=4,_),l(m,p+=2,_),a(m,p+=2,M),a(m,p+=4,x),p+=4,p+=2,m.buffer},r._noNeed=function(s){var o=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},r._writeHeader=function(s,o,i,a,l,c){var d=r.bin.writeUint,u=r.bin.writeUshort,f=a.file;return d(s,o,l==0?67324752:33639248),o+=4,l==1&&(o+=2),u(s,o,20),u(s,o+=2,0),u(s,o+=2,a.cpr?8:0),d(s,o+=2,0),d(s,o+=4,a.crc),d(s,o+=4,f.length),d(s,o+=4,a.usize),u(s,o+=4,r.bin.sizeUTF8(i)),u(s,o+=2,0),o+=2,l==1&&(o+=2,o+=2,d(s,o+=6,c),o+=4),o+=r.bin.writeUTF8(s,o,i),l==0&&(s.set(f,o),o+=f.length),o},r.crc={table:(function(){for(var s=new Uint32Array(256),o=0;o<256;o++){for(var i=o,a=0;a<8;a++)1&i?i=3988292384^i>>>1:i>>>=1;s[o]=i}return s})(),update:function(s,o,i,a){for(var l=0;l<a;l++)s=r.crc.table[255&(s^o[i+l])]^s>>>8;return s},crc:function(s,o,i){return 4294967295^r.crc.update(4294967295,s,o,i)}},r.adler=function(s,o,i){for(var a=1,l=0,c=o,d=o+i;c<d;){for(var u=Math.min(c+5552,d);c<u;)l+=a+=s[c++];a%=65521,l%=65521}return l<<16|a},r.bin={readUshort:function(s,o){return s[o]|s[o+1]<<8},writeUshort:function(s,o,i){s[o]=255&i,s[o+1]=i>>8&255},readUint:function(s,o){return 16777216*s[o+3]+(s[o+2]<<16|s[o+1]<<8|s[o])},writeUint:function(s,o,i){s[o]=255&i,s[o+1]=i>>8&255,s[o+2]=i>>16&255,s[o+3]=i>>24&255},readASCII:function(s,o,i){for(var a="",l=0;l<i;l++)a+=String.fromCharCode(s[o+l]);return a},writeASCII:function(s,o,i){for(var a=0;a<i.length;a++)s[o+a]=i.charCodeAt(a)},pad:function(s){return s.length<2?"0"+s:s},readUTF8:function(s,o,i){for(var a,l="",c=0;c<i;c++)l+="%"+r.bin.pad(s[o+c].toString(16));try{a=decodeURIComponent(l)}catch{return r.bin.readASCII(s,o,i)}return a},writeUTF8:function(s,o,i){for(var a=i.length,l=0,c=0;c<a;c++){var d=i.charCodeAt(c);if((4294967168&d)==0)s[o+l]=d,l++;else if((4294965248&d)==0)s[o+l]=192|d>>6,s[o+l+1]=128|d>>0&63,l+=2;else if((4294901760&d)==0)s[o+l]=224|d>>12,s[o+l+1]=128|d>>6&63,s[o+l+2]=128|d>>0&63,l+=3;else{if((4292870144&d)!=0)throw"e";s[o+l]=240|d>>18,s[o+l+1]=128|d>>12&63,s[o+l+2]=128|d>>6&63,s[o+l+3]=128|d>>0&63,l+=4}}return l},sizeUTF8:function(s){for(var o=s.length,i=0,a=0;a<o;a++){var l=s.charCodeAt(a);if((4294967168&l)==0)i++;else if((4294965248&l)==0)i+=2;else if((4294901760&l)==0)i+=3;else{if((4292870144&l)!=0)throw"e";i+=4}}return i}},r.F={},r.F.deflateRaw=function(s,o,i,a){var l=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][a],c=r.F.U,d=r.F._goodIndex;r.F._hash;var u=r.F._putsE,f=0,g=i<<3,m=0,p=s.length;if(a==0){for(;f<p;)u(o,g,f+(A=Math.min(65535,p-f))==p?1:0),g=r.F._copyExact(s,f,A,o,g+8),f+=A;return g>>>3}var y=c.lits,b=c.strt,_=c.prev,x=0,M=0,S=0,k=0,N=0,C=0;for(p>2&&(b[C=r.F._hash(s,0)]=0),f=0;f<p;f++){if(N=C,f+1<p-2){C=r.F._hash(s,f+1);var w=f+1&32767;_[w]=b[C],b[C]=w}if(m<=f){(x>14e3||M>26697)&&p-f>100&&(m<f&&(y[x]=f-m,x+=2,m=f),g=r.F._writeBlock(f==p-1||m==p?1:0,y,x,k,s,S,f-S,o,g),x=M=k=0,S=f);var E=0;f<p-2&&(E=r.F._bestMatch(s,f,_,N,Math.min(l[2],p-f),l[3]));var A=E>>>16,P=65535&E;if(E!=0){P=65535&E;var L=d(A=E>>>16,c.of0);c.lhst[257+L]++;var $=d(P,c.df0);c.dhst[$]++,k+=c.exb[L]+c.dxb[$],y[x]=A<<23|f-m,y[x+1]=P<<16|L<<8|$,x+=2,m=f+A}else c.lhst[s[f]]++;M++}}for(S==f&&s.length!=0||(m<f&&(y[x]=f-m,x+=2,m=f),g=r.F._writeBlock(1,y,x,k,s,S,f-S,o,g),x=0,M=0,x=M=k=0,S=f);(7&g)!=0;)g++;return g>>>3},r.F._bestMatch=function(s,o,i,a,l,c){var d=32767&o,u=i[d],f=d-u+32768&32767;if(u==d||a!=r.F._hash(s,o-f))return 0;for(var g=0,m=0,p=Math.min(32767,o);f<=p&&--c!=0&&u!=d;){if(g==0||s[o+g]==s[o+g-f]){var y=r.F._howLong(s,o,f);if(y>g){if(m=f,(g=y)>=l)break;f+2<y&&(y=f+2);for(var b=0,_=0;_<y-2;_++){var x=o-f+_+32768&32767,M=x-i[x]+32768&32767;M>b&&(b=M,u=x)}}}f+=(d=u)-(u=i[d])+32768&32767}return g<<16|m},r.F._howLong=function(s,o,i){if(s[o]!=s[o-i]||s[o+1]!=s[o+1-i]||s[o+2]!=s[o+2-i])return 0;var a=o,l=Math.min(s.length,o+258);for(o+=3;o<l&&s[o]==s[o-i];)o++;return o-a},r.F._hash=function(s,o){return(s[o]<<8|s[o+1])+(s[o+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(s,o,i,a,l,c,d,u,f){var g,m,p,y,b,_,x,M,S,k=r.F.U,N=r.F._putsF,C=r.F._putsE;k.lhst[256]++,m=(g=r.F.getTrees())[0],p=g[1],y=g[2],b=g[3],_=g[4],x=g[5],M=g[6],S=g[7];var w=32+((f+3&7)==0?0:8-(f+3&7))+(d<<3),E=a+r.F.contSize(k.fltree,k.lhst)+r.F.contSize(k.fdtree,k.dhst),A=a+r.F.contSize(k.ltree,k.lhst)+r.F.contSize(k.dtree,k.dhst);A+=14+3*x+r.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var P=0;P<286;P++)k.lhst[P]=0;for(P=0;P<30;P++)k.dhst[P]=0;for(P=0;P<19;P++)k.ihst[P]=0;var L=w<E&&w<A?0:E<A?1:2;if(N(u,f,s),N(u,f+1,L),f+=3,L==0){for(;(7&f)!=0;)f++;f=r.F._copyExact(l,c,d,u,f)}else{var $,D;if(L==1&&($=k.fltree,D=k.fdtree),L==2){r.F.makeCodes(k.ltree,m),r.F.revCodes(k.ltree,m),r.F.makeCodes(k.dtree,p),r.F.revCodes(k.dtree,p),r.F.makeCodes(k.itree,y),r.F.revCodes(k.itree,y),$=k.ltree,D=k.dtree,C(u,f,b-257),C(u,f+=5,_-1),C(u,f+=5,x-4),f+=4;for(var O=0;O<x;O++)C(u,f+3*O,k.itree[1+(k.ordr[O]<<1)]);f+=3*x,f=r.F._codeTiny(M,k.itree,u,f),f=r.F._codeTiny(S,k.itree,u,f)}for(var T=c,z=0;z<i;z+=2){for(var U=o[z],W=U>>>23,G=T+(8388607&U);T<G;)f=r.F._writeLit(l[T++],$,u,f);if(W!=0){var B=o[z+1],j=B>>16,Y=B>>8&255,V=255&B;C(u,f=r.F._writeLit(257+Y,$,u,f),W-k.of0[Y]),f+=k.exb[Y],N(u,f=r.F._writeLit(V,D,u,f),j-k.df0[V]),f+=k.dxb[V],T+=W}}f=r.F._writeLit(256,$,u,f)}return f},r.F._copyExact=function(s,o,i,a,l){var c=l>>>3;return a[c]=i,a[c+1]=i>>>8,a[c+2]=255-a[c],a[c+3]=255-a[c+1],c+=4,a.set(new Uint8Array(s.buffer,o,i),c),l+(i+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,o=r.F._hufTree(s.lhst,s.ltree,15),i=r.F._hufTree(s.dhst,s.dtree,15),a=[],l=r.F._lenCodes(s.ltree,a),c=[],d=r.F._lenCodes(s.dtree,c),u=0;u<a.length;u+=2)s.ihst[a[u]]++;for(u=0;u<c.length;u+=2)s.ihst[c[u]]++;for(var f=r.F._hufTree(s.ihst,s.itree,7),g=19;g>4&&s.itree[1+(s.ordr[g-1]<<1)]==0;)g--;return[o,i,f,l,d,g,a,c]},r.F.getSecond=function(s){for(var o=[],i=0;i<s.length;i+=2)o.push(s[i+1]);return o},r.F.nonZero=function(s){for(var o="",i=0;i<s.length;i+=2)s[i+1]!=0&&(o+=(i>>1)+",");return o},r.F.contSize=function(s,o){for(var i=0,a=0;a<o.length;a++)i+=o[a]*s[1+(a<<1)];return i},r.F._codeTiny=function(s,o,i,a){for(var l=0;l<s.length;l+=2){var c=s[l],d=s[l+1];a=r.F._writeLit(c,o,i,a);var u=c==16?2:c==17?3:7;c>15&&(r.F._putsE(i,a,d,u),a+=u)}return a},r.F._lenCodes=function(s,o){for(var i=s.length;i!=2&&s[i-1]==0;)i-=2;for(var a=0;a<i;a+=2){var l=s[a+1],c=a+3<i?s[a+3]:-1,d=a+5<i?s[a+5]:-1,u=a==0?-1:s[a-1];if(l==0&&c==l&&d==l){for(var f=a+5;f+2<i&&s[f+2]==l;)f+=2;(g=Math.min(f+1-a>>>1,138))<11?o.push(17,g-3):o.push(18,g-11),a+=2*g-2}else if(l==u&&c==l&&d==l){for(f=a+5;f+2<i&&s[f+2]==l;)f+=2;var g=Math.min(f+1-a>>>1,6);o.push(16,g-3),a+=2*g-2}else o.push(l,0)}return i>>>1},r.F._hufTree=function(s,o,i){var a=[],l=s.length,c=o.length,d=0;for(d=0;d<c;d+=2)o[d]=0,o[d+1]=0;for(d=0;d<l;d++)s[d]!=0&&a.push({lit:d,f:s[d]});var u=a.length,f=a.slice(0);if(u==0)return 0;if(u==1){var g=a[0].lit;return f=g==0?1:0,o[1+(g<<1)]=1,o[1+(f<<1)]=1,1}a.sort((function(M,S){return M.f-S.f}));var m=a[0],p=a[1],y=0,b=1,_=2;for(a[0]={lit:-1,f:m.f+p.f,l:m,r:p,d:0};b!=u-1;)m=y!=b&&(_==u||a[y].f<a[_].f)?a[y++]:a[_++],p=y!=b&&(_==u||a[y].f<a[_].f)?a[y++]:a[_++],a[b++]={lit:-1,f:m.f+p.f,l:m,r:p};var x=r.F.setDepth(a[b-1],0);for(x>i&&(r.F.restrictDepth(f,i,x),x=i),d=0;d<u;d++)o[1+(f[d].lit<<1)]=f[d].d;return x},r.F.setDepth=function(s,o){return s.lit!=-1?(s.d=o,o):Math.max(r.F.setDepth(s.l,o+1),r.F.setDepth(s.r,o+1))},r.F.restrictDepth=function(s,o,i){var a=0,l=1<<i-o,c=0;for(s.sort((function(u,f){return f.d==u.d?u.f-f.f:f.d-u.d})),a=0;a<s.length&&s[a].d>o;a++){var d=s[a].d;s[a].d=o,c+=l-(1<<i-d)}for(c>>>=i-o;c>0;)(d=s[a].d)<o?(s[a].d++,c-=1<<o-d-1):a++;for(;a>=0;a--)s[a].d==o&&c<0&&(s[a].d--,c++);c!=0&&console.log("debt left")},r.F._goodIndex=function(s,o){var i=0;return o[16|i]<=s&&(i|=16),o[8|i]<=s&&(i|=8),o[4|i]<=s&&(i|=4),o[2|i]<=s&&(i|=2),o[1|i]<=s&&(i|=1),i},r.F._writeLit=function(s,o,i,a){return r.F._putsF(i,a,o[s<<1]),a+o[1+(s<<1)]},r.F.inflate=function(s,o){var i=Uint8Array;if(s[0]==3&&s[1]==0)return o||new i(0);var a=r.F,l=a._bitsF,c=a._bitsE,d=a._decodeTiny,u=a.makeCodes,f=a.codes2map,g=a._get17,m=a.U,p=o==null;p&&(o=new i(s.length>>>2<<3));for(var y,b,_=0,x=0,M=0,S=0,k=0,N=0,C=0,w=0,E=0;_==0;)if(_=l(s,E,1),x=l(s,E+1,2),E+=3,x!=0){if(p&&(o=r.F._check(o,w+131072)),x==1&&(y=m.flmap,b=m.fdmap,N=511,C=31),x==2){M=c(s,E,5)+257,S=c(s,E+5,5)+1,k=c(s,E+10,4)+4,E+=14;for(var A=0;A<38;A+=2)m.itree[A]=0,m.itree[A+1]=0;var P=1;for(A=0;A<k;A++){var L=c(s,E+3*A,3);m.itree[1+(m.ordr[A]<<1)]=L,L>P&&(P=L)}E+=3*k,u(m.itree,P),f(m.itree,P,m.imap),y=m.lmap,b=m.dmap,E=d(m.imap,(1<<P)-1,M+S,s,E,m.ttree);var $=a._copyOut(m.ttree,0,M,m.ltree);N=(1<<$)-1;var D=a._copyOut(m.ttree,M,S,m.dtree);C=(1<<D)-1,u(m.ltree,$),f(m.ltree,$,y),u(m.dtree,D),f(m.dtree,D,b)}for(;;){var O=y[g(s,E)&N];E+=15&O;var T=O>>>4;if(!(T>>>8))o[w++]=T;else{if(T==256)break;var z=w+T-254;if(T>264){var U=m.ldef[T-257];z=w+(U>>>3)+c(s,E,7&U),E+=7&U}var W=b[g(s,E)&C];E+=15&W;var G=W>>>4,B=m.ddef[G],j=(B>>>4)+l(s,E,15&B);for(E+=15&B,p&&(o=r.F._check(o,w+131072));w<z;)o[w]=o[w++-j],o[w]=o[w++-j],o[w]=o[w++-j],o[w]=o[w++-j];w=z}}}else{(7&E)!=0&&(E+=8-(7&E));var Y=4+(E>>>3),V=s[Y-4]|s[Y-3]<<8;p&&(o=r.F._check(o,w+V)),o.set(new i(s.buffer,s.byteOffset+Y,V),w),E=Y+V<<3,w+=V}return o.length==w?o:o.slice(0,w)},r.F._check=function(s,o){var i=s.length;if(o<=i)return s;var a=new Uint8Array(Math.max(i<<1,o));return a.set(s,0),a},r.F._decodeTiny=function(s,o,i,a,l,c){for(var d=r.F._bitsE,u=r.F._get17,f=0;f<i;){var g=s[u(a,l)&o];l+=15&g;var m=g>>>4;if(m<=15)c[f]=m,f++;else{var p=0,y=0;m==16?(y=3+d(a,l,2),l+=2,p=c[f-1]):m==17?(y=3+d(a,l,3),l+=3):m==18&&(y=11+d(a,l,7),l+=7);for(var b=f+y;f<b;)c[f]=p,f++}}return l},r.F._copyOut=function(s,o,i,a){for(var l=0,c=0,d=a.length>>>1;c<i;){var u=s[c+o];a[c<<1]=0,a[1+(c<<1)]=u,u>l&&(l=u),c++}for(;c<d;)a[c<<1]=0,a[1+(c<<1)]=0,c++;return l},r.F.makeCodes=function(s,o){for(var i,a,l,c,d=r.F.U,u=s.length,f=d.bl_count,g=0;g<=o;g++)f[g]=0;for(g=1;g<u;g+=2)f[s[g]]++;var m=d.next_code;for(i=0,f[0]=0,a=1;a<=o;a++)i=i+f[a-1]<<1,m[a]=i;for(l=0;l<u;l+=2)(c=s[l+1])!=0&&(s[l]=m[c],m[c]++)},r.F.codes2map=function(s,o,i){for(var a=s.length,l=r.F.U.rev15,c=0;c<a;c+=2)if(s[c+1]!=0)for(var d=c>>1,u=s[c+1],f=d<<4|u,g=o-u,m=s[c]<<g,p=m+(1<<g);m!=p;)i[l[m]>>>15-o]=f,m++},r.F.revCodes=function(s,o){for(var i=r.F.U.rev15,a=15-o,l=0;l<s.length;l+=2){var c=s[l]<<o-s[l+1];s[l]=i[c]>>>a}},r.F._putsE=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8},r.F._putsF=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8,s[a+2]|=i>>>16},r.F._bitsE=function(s,o,i){return(s[o>>>3]|s[1+(o>>>3)]<<8)>>>(7&o)&(1<<i)-1},r.F._bitsF=function(s,o,i){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)&(1<<i)-1},r.F._get17=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)},r.F._get25=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16|s[3+(o>>>3)]<<24)>>>(7&o)},r.F.U=(t=Uint16Array,n=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 n(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 n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var s=r.F.U,o=0;o<32768;o++){var i=o;i=(4278255360&(i=(4042322160&(i=(3435973836&(i=(2863311530&i)>>>1|(1431655765&i)<<1))>>>2|(858993459&i)<<2))>>>4|(252645135&i)<<4))>>>8|(16711935&i)<<8,s.rev15[o]=(i>>>16|i<<16)>>>17}function a(l,c,d){for(;c--!=0;)l.push(0,d)}for(o=0;o<32;o++)s.ldef[o]=s.of0[o]<<3|s.exb[o],s.ddef[o]=s.df0[o]<<4|s.dxb[o];a(s.fltree,144,8),a(s.fltree,112,9),a(s.fltree,24,7),a(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),a(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),a(s.itree,19,0),a(s.ltree,286,0),a(s.dtree,30,0),a(s.ttree,320,0)})()})();var SE=wE({__proto__:null,default:Qi},[Qi]);const An=(function(){var e={nextZero(d,u){for(;d[u]!=0;)u++;return u},readUshort:(d,u)=>d[u]<<8|d[u+1],writeUshort(d,u,f){d[u]=f>>8&255,d[u+1]=255&f},readUint:(d,u)=>16777216*d[u]+(d[u+1]<<16|d[u+2]<<8|d[u+3]),writeUint(d,u,f){d[u]=f>>24&255,d[u+1]=f>>16&255,d[u+2]=f>>8&255,d[u+3]=255&f},readASCII(d,u,f){let g="";for(let m=0;m<f;m++)g+=String.fromCharCode(d[u+m]);return g},writeASCII(d,u,f){for(let g=0;g<f.length;g++)d[u+g]=f.charCodeAt(g)},readBytes(d,u,f){const g=[];for(let m=0;m<f;m++)g.push(d[u+m]);return g},pad:d=>d.length<2?`0${d}`:d,readUTF8(d,u,f){let g,m="";for(let p=0;p<f;p++)m+=`%${e.pad(d[u+p].toString(16))}`;try{g=decodeURIComponent(m)}catch{return e.readASCII(d,u,f)}return g}};function t(d,u,f,g){const m=u*f,p=o(g),y=Math.ceil(u*p/8),b=new Uint8Array(4*m),_=new Uint32Array(b.buffer),{ctype:x}=g,{depth:M}=g,S=e.readUshort;if(x==6){const U=m<<2;if(M==8)for(var k=0;k<U;k+=4)b[k]=d[k],b[k+1]=d[k+1],b[k+2]=d[k+2],b[k+3]=d[k+3];if(M==16)for(k=0;k<U;k++)b[k]=d[k<<1]}else if(x==2){const U=g.tabs.tRNS;if(U==null){if(M==8)for(k=0;k<m;k++){var N=3*k;_[k]=255<<24|d[N+2]<<16|d[N+1]<<8|d[N]}if(M==16)for(k=0;k<m;k++)N=6*k,_[k]=255<<24|d[N+4]<<16|d[N+2]<<8|d[N]}else{var C=U[0];const W=U[1],G=U[2];if(M==8)for(k=0;k<m;k++){var w=k<<2;N=3*k,_[k]=255<<24|d[N+2]<<16|d[N+1]<<8|d[N],d[N]==C&&d[N+1]==W&&d[N+2]==G&&(b[w+3]=0)}if(M==16)for(k=0;k<m;k++)w=k<<2,N=6*k,_[k]=255<<24|d[N+4]<<16|d[N+2]<<8|d[N],S(d,N)==C&&S(d,N+2)==W&&S(d,N+4)==G&&(b[w+3]=0)}}else if(x==3){const U=g.tabs.PLTE,W=g.tabs.tRNS,G=W?W.length:0;if(M==1)for(var E=0;E<f;E++){var A=E*y,P=E*u;for(k=0;k<u;k++){w=P+k<<2;var L=3*($=d[A+(k>>3)]>>7-((7&k)<<0)&1);b[w]=U[L],b[w+1]=U[L+1],b[w+2]=U[L+2],b[w+3]=$<G?W[$]:255}}if(M==2)for(E=0;E<f;E++)for(A=E*y,P=E*u,k=0;k<u;k++)w=P+k<<2,L=3*($=d[A+(k>>2)]>>6-((3&k)<<1)&3),b[w]=U[L],b[w+1]=U[L+1],b[w+2]=U[L+2],b[w+3]=$<G?W[$]:255;if(M==4)for(E=0;E<f;E++)for(A=E*y,P=E*u,k=0;k<u;k++)w=P+k<<2,L=3*($=d[A+(k>>1)]>>4-((1&k)<<2)&15),b[w]=U[L],b[w+1]=U[L+1],b[w+2]=U[L+2],b[w+3]=$<G?W[$]:255;if(M==8)for(k=0;k<m;k++){var $;w=k<<2,L=3*($=d[k]),b[w]=U[L],b[w+1]=U[L+1],b[w+2]=U[L+2],b[w+3]=$<G?W[$]:255}}else if(x==4){if(M==8)for(k=0;k<m;k++){w=k<<2;var D=d[O=k<<1];b[w]=D,b[w+1]=D,b[w+2]=D,b[w+3]=d[O+1]}if(M==16)for(k=0;k<m;k++){var O;w=k<<2,D=d[O=k<<2],b[w]=D,b[w+1]=D,b[w+2]=D,b[w+3]=d[O+2]}}else if(x==0)for(C=g.tabs.tRNS?g.tabs.tRNS:-1,E=0;E<f;E++){const U=E*y,W=E*u;if(M==1)for(var T=0;T<u;T++){var z=(D=255*(d[U+(T>>>3)]>>>7-(7&T)&1))==255*C?0:255;_[W+T]=z<<24|D<<16|D<<8|D}else if(M==2)for(T=0;T<u;T++)z=(D=85*(d[U+(T>>>2)]>>>6-((3&T)<<1)&3))==85*C?0:255,_[W+T]=z<<24|D<<16|D<<8|D;else if(M==4)for(T=0;T<u;T++)z=(D=17*(d[U+(T>>>1)]>>>4-((1&T)<<2)&15))==17*C?0:255,_[W+T]=z<<24|D<<16|D<<8|D;else if(M==8)for(T=0;T<u;T++)z=(D=d[U+T])==C?0:255,_[W+T]=z<<24|D<<16|D<<8|D;else if(M==16)for(T=0;T<u;T++)D=d[U+(T<<1)],z=S(d,U+(T<<1))==C?0:255,_[W+T]=z<<24|D<<16|D<<8|D}return b}function n(d,u,f,g){const m=o(d),p=Math.ceil(f*m/8),y=new Uint8Array((p+1+d.interlace)*g);return u=d.tabs.CgBI?s(u,y):r(u,y),d.interlace==0?u=i(u,d,0,f,g):d.interlace==1&&(u=(function(_,x){const M=x.width,S=x.height,k=o(x),N=k>>3,C=Math.ceil(M*k/8),w=new Uint8Array(S*C);let E=0;const A=[0,0,4,0,2,0,1],P=[0,4,0,2,0,1,0],L=[8,8,8,4,4,2,2],$=[8,8,4,4,2,2,1];let D=0;for(;D<7;){const T=L[D],z=$[D];let U=0,W=0,G=A[D];for(;G<S;)G+=T,W++;let B=P[D];for(;B<M;)B+=z,U++;const j=Math.ceil(U*k/8);i(_,x,E,U,W);let Y=0,V=A[D];for(;V<S;){let X=P[D],K=E+Y*j<<3;for(;X<M;){var O;if(k==1&&(O=(O=_[K>>3])>>7-(7&K)&1,w[V*C+(X>>3)]|=O<<7-((7&X)<<0)),k==2&&(O=(O=_[K>>3])>>6-(7&K)&3,w[V*C+(X>>2)]|=O<<6-((3&X)<<1)),k==4&&(O=(O=_[K>>3])>>4-(7&K)&15,w[V*C+(X>>1)]|=O<<4-((1&X)<<2)),k>=8){const q=V*C+X*N;for(let ne=0;ne<N;ne++)w[q+ne]=_[(K>>3)+ne]}K+=k,X+=z}Y++,V+=T}U*W!=0&&(E+=W*(1+j)),D+=1}return w})(u,d)),u}function r(d,u){return s(new Uint8Array(d.buffer,2,d.length-6),u)}var s=(function(){const d={H:{}};return d.H.N=function(u,f){const g=Uint8Array;let m,p,y=0,b=0,_=0,x=0,M=0,S=0,k=0,N=0,C=0;if(u[0]==3&&u[1]==0)return f||new g(0);const w=d.H,E=w.b,A=w.e,P=w.R,L=w.n,$=w.A,D=w.Z,O=w.m,T=f==null;for(T&&(f=new g(u.length>>>2<<5));y==0;)if(y=E(u,C,1),b=E(u,C+1,2),C+=3,b!=0){if(T&&(f=d.H.W(f,N+(1<<17))),b==1&&(m=O.J,p=O.h,S=511,k=31),b==2){_=A(u,C,5)+257,x=A(u,C+5,5)+1,M=A(u,C+10,4)+4,C+=14;let U=1;for(var z=0;z<38;z+=2)O.Q[z]=0,O.Q[z+1]=0;for(z=0;z<M;z++){const B=A(u,C+3*z,3);O.Q[1+(O.X[z]<<1)]=B,B>U&&(U=B)}C+=3*M,L(O.Q,U),$(O.Q,U,O.u),m=O.w,p=O.d,C=P(O.u,(1<<U)-1,_+x,u,C,O.v);const W=w.V(O.v,0,_,O.C);S=(1<<W)-1;const G=w.V(O.v,_,x,O.D);k=(1<<G)-1,L(O.C,W),$(O.C,W,m),L(O.D,G),$(O.D,G,p)}for(;;){const U=m[D(u,C)&S];C+=15&U;const W=U>>>4;if(!(W>>>8))f[N++]=W;else{if(W==256)break;{let G=N+W-254;if(W>264){const X=O.q[W-257];G=N+(X>>>3)+A(u,C,7&X),C+=7&X}const B=p[D(u,C)&k];C+=15&B;const j=B>>>4,Y=O.c[j],V=(Y>>>4)+E(u,C,15&Y);for(C+=15&Y;N<G;)f[N]=f[N++-V],f[N]=f[N++-V],f[N]=f[N++-V],f[N]=f[N++-V];N=G}}}}else{(7&C)!=0&&(C+=8-(7&C));const U=4+(C>>>3),W=u[U-4]|u[U-3]<<8;T&&(f=d.H.W(f,N+W)),f.set(new g(u.buffer,u.byteOffset+U,W),N),C=U+W<<3,N+=W}return f.length==N?f:f.slice(0,N)},d.H.W=function(u,f){const g=u.length;if(f<=g)return u;const m=new Uint8Array(g<<1);return m.set(u,0),m},d.H.R=function(u,f,g,m,p,y){const b=d.H.e,_=d.H.Z;let x=0;for(;x<g;){const M=u[_(m,p)&f];p+=15&M;const S=M>>>4;if(S<=15)y[x]=S,x++;else{let k=0,N=0;S==16?(N=3+b(m,p,2),p+=2,k=y[x-1]):S==17?(N=3+b(m,p,3),p+=3):S==18&&(N=11+b(m,p,7),p+=7);const C=x+N;for(;x<C;)y[x]=k,x++}}return p},d.H.V=function(u,f,g,m){let p=0,y=0;const b=m.length>>>1;for(;y<g;){const _=u[y+f];m[y<<1]=0,m[1+(y<<1)]=_,_>p&&(p=_),y++}for(;y<b;)m[y<<1]=0,m[1+(y<<1)]=0,y++;return p},d.H.n=function(u,f){const g=d.H.m,m=u.length;let p,y,b,_;const x=g.j;for(var M=0;M<=f;M++)x[M]=0;for(M=1;M<m;M+=2)x[u[M]]++;const S=g.K;for(p=0,x[0]=0,y=1;y<=f;y++)p=p+x[y-1]<<1,S[y]=p;for(b=0;b<m;b+=2)_=u[b+1],_!=0&&(u[b]=S[_],S[_]++)},d.H.A=function(u,f,g){const m=u.length,p=d.H.m.r;for(let y=0;y<m;y+=2)if(u[y+1]!=0){const b=y>>1,_=u[y+1],x=b<<4|_,M=f-_;let S=u[y]<<M;const k=S+(1<<M);for(;S!=k;)g[p[S]>>>15-f]=x,S++}},d.H.l=function(u,f){const g=d.H.m.r,m=15-f;for(let p=0;p<u.length;p+=2){const y=u[p]<<f-u[p+1];u[p]=g[y]>>>m}},d.H.M=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8},d.H.I=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8,u[m+2]|=g>>>16},d.H.e=function(u,f,g){return(u[f>>>3]|u[1+(f>>>3)]<<8)>>>(7&f)&(1<<g)-1},d.H.b=function(u,f,g){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)&(1<<g)-1},d.H.Z=function(u,f){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)},d.H.i=function(u,f){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16|u[3+(f>>>3)]<<24)>>>(7&f)},d.H.m=(function(){const u=Uint16Array,f=Uint32Array;return{K:new u(16),j:new u(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 u(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 f(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new f(286),Y:new f(30),a:new f(19),t:new f(15e3),k:new u(65536),g:new u(32768)}})(),(function(){const u=d.H.m;for(var f=0;f<32768;f++){let m=f;m=(2863311530&m)>>>1|(1431655765&m)<<1,m=(3435973836&m)>>>2|(858993459&m)<<2,m=(4042322160&m)>>>4|(252645135&m)<<4,m=(4278255360&m)>>>8|(16711935&m)<<8,u.r[f]=(m>>>16|m<<16)>>>17}function g(m,p,y){for(;p--!=0;)m.push(0,y)}for(f=0;f<32;f++)u.q[f]=u.S[f]<<3|u.T[f],u.c[f]=u.p[f]<<4|u.z[f];g(u._,144,8),g(u._,112,9),g(u._,24,7),g(u._,8,8),d.H.n(u._,9),d.H.A(u._,9,u.J),d.H.l(u._,9),g(u.$,32,5),d.H.n(u.$,5),d.H.A(u.$,5,u.h),d.H.l(u.$,5),g(u.Q,19,0),g(u.C,286,0),g(u.D,30,0),g(u.v,320,0)})(),d.H.N})();function o(d){return[1,null,3,1,2,null,4][d.ctype]*d.depth}function i(d,u,f,g,m){let p=o(u);const y=Math.ceil(g*p/8);let b,_;p=Math.ceil(p/8);let x=d[f],M=0;if(x>1&&(d[f]=[0,0,1][x-2]),x==3)for(M=p;M<y;M++)d[M+1]=d[M+1]+(d[M+1-p]>>>1)&255;for(let S=0;S<m;S++)if(b=f+S*y,_=b+S+1,x=d[_-1],M=0,x==0)for(;M<y;M++)d[b+M]=d[_+M];else if(x==1){for(;M<p;M++)d[b+M]=d[_+M];for(;M<y;M++)d[b+M]=d[_+M]+d[b+M-p]}else if(x==2)for(;M<y;M++)d[b+M]=d[_+M]+d[b+M-y];else if(x==3){for(;M<p;M++)d[b+M]=d[_+M]+(d[b+M-y]>>>1);for(;M<y;M++)d[b+M]=d[_+M]+(d[b+M-y]+d[b+M-p]>>>1)}else{for(;M<p;M++)d[b+M]=d[_+M]+a(0,d[b+M-y],0);for(;M<y;M++)d[b+M]=d[_+M]+a(d[b+M-p],d[b+M-y],d[b+M-p-y])}return d}function a(d,u,f){const g=d+u-f,m=g-d,p=g-u,y=g-f;return m*m<=p*p&&m*m<=y*y?d:p*p<=y*y?u:f}function l(d,u,f){f.width=e.readUint(d,u),u+=4,f.height=e.readUint(d,u),u+=4,f.depth=d[u],u++,f.ctype=d[u],u++,f.compress=d[u],u++,f.filter=d[u],u++,f.interlace=d[u],u++}function c(d,u,f,g,m,p,y,b,_){const x=Math.min(u,m),M=Math.min(f,p);let S=0,k=0;for(let D=0;D<M;D++)for(let O=0;O<x;O++)if(y>=0&&b>=0?(S=D*u+O<<2,k=(b+D)*m+y+O<<2):(S=(-b+D)*u-y+O<<2,k=D*m+O<<2),_==0)g[k]=d[S],g[k+1]=d[S+1],g[k+2]=d[S+2],g[k+3]=d[S+3];else if(_==1){var N=d[S+3]*.00392156862745098,C=d[S]*N,w=d[S+1]*N,E=d[S+2]*N,A=g[k+3]*(1/255),P=g[k]*A,L=g[k+1]*A,$=g[k+2]*A;const T=1-N,z=N+A*T,U=z==0?0:1/z;g[k+3]=255*z,g[k+0]=(C+P*T)*U,g[k+1]=(w+L*T)*U,g[k+2]=(E+$*T)*U}else if(_==2)N=d[S+3],C=d[S],w=d[S+1],E=d[S+2],A=g[k+3],P=g[k],L=g[k+1],$=g[k+2],N==A&&C==P&&w==L&&E==$?(g[k]=0,g[k+1]=0,g[k+2]=0,g[k+3]=0):(g[k]=C,g[k+1]=w,g[k+2]=E,g[k+3]=N);else if(_==3){if(N=d[S+3],C=d[S],w=d[S+1],E=d[S+2],A=g[k+3],P=g[k],L=g[k+1],$=g[k+2],N==A&&C==P&&w==L&&E==$)continue;if(N<220&&A>20)return!1}return!0}return{decode:function(u){const f=new Uint8Array(u);let g=8;const m=e,p=m.readUshort,y=m.readUint,b={tabs:{},frames:[]},_=new Uint8Array(f.length);let x,M=0,S=0;const k=[137,80,78,71,13,10,26,10];for(var N=0;N<8;N++)if(f[N]!=k[N])throw"The input is not a PNG file!";for(;g<f.length;){const D=m.readUint(f,g);g+=4;const O=m.readASCII(f,g,4);if(g+=4,O=="IHDR")l(f,g,b);else if(O=="iCCP"){for(var C=g;f[C]!=0;)C++;m.readASCII(f,g,C-g),f[C+1];const T=f.slice(C+2,g+D);let z=null;try{z=r(T)}catch{z=s(T)}b.tabs[O]=z}else if(O=="CgBI")b.tabs[O]=f.slice(g,g+4);else if(O=="IDAT"){for(N=0;N<D;N++)_[M+N]=f[g+N];M+=D}else if(O=="acTL")b.tabs[O]={num_frames:y(f,g),num_plays:y(f,g+4)},x=new Uint8Array(f.length);else if(O=="fcTL"){S!=0&&(($=b.frames[b.frames.length-1]).data=n(b,x.slice(0,S),$.rect.width,$.rect.height),S=0);const T={x:y(f,g+12),y:y(f,g+16),width:y(f,g+4),height:y(f,g+8)};let z=p(f,g+22);z=p(f,g+20)/(z==0?100:z);const U={rect:T,delay:Math.round(1e3*z),dispose:f[g+24],blend:f[g+25]};b.frames.push(U)}else if(O=="fdAT"){for(N=0;N<D-4;N++)x[S+N]=f[g+N+4];S+=D-4}else if(O=="pHYs")b.tabs[O]=[m.readUint(f,g),m.readUint(f,g+4),f[g+8]];else if(O=="cHRM")for(b.tabs[O]=[],N=0;N<8;N++)b.tabs[O].push(m.readUint(f,g+4*N));else if(O=="tEXt"||O=="zTXt"){b.tabs[O]==null&&(b.tabs[O]={});var w=m.nextZero(f,g),E=m.readASCII(f,g,w-g),A=g+D-w-1;if(O=="tEXt")L=m.readASCII(f,w+1,A);else{var P=r(f.slice(w+2,w+2+A));L=m.readUTF8(P,0,P.length)}b.tabs[O][E]=L}else if(O=="iTXt"){b.tabs[O]==null&&(b.tabs[O]={}),w=0,C=g,w=m.nextZero(f,C),E=m.readASCII(f,C,w-C);const T=f[C=w+1];var L;f[C+1],C+=2,w=m.nextZero(f,C),m.readASCII(f,C,w-C),C=w+1,w=m.nextZero(f,C),m.readUTF8(f,C,w-C),A=D-((C=w+1)-g),T==0?L=m.readUTF8(f,C,A):(P=r(f.slice(C,C+A)),L=m.readUTF8(P,0,P.length)),b.tabs[O][E]=L}else if(O=="PLTE")b.tabs[O]=m.readBytes(f,g,D);else if(O=="hIST"){const T=b.tabs.PLTE.length/3;for(b.tabs[O]=[],N=0;N<T;N++)b.tabs[O].push(p(f,g+2*N))}else if(O=="tRNS")b.ctype==3?b.tabs[O]=m.readBytes(f,g,D):b.ctype==0?b.tabs[O]=p(f,g):b.ctype==2&&(b.tabs[O]=[p(f,g),p(f,g+2),p(f,g+4)]);else if(O=="gAMA")b.tabs[O]=m.readUint(f,g)/1e5;else if(O=="sRGB")b.tabs[O]=f[g];else if(O=="bKGD")b.ctype==0||b.ctype==4?b.tabs[O]=[p(f,g)]:b.ctype==2||b.ctype==6?b.tabs[O]=[p(f,g),p(f,g+2),p(f,g+4)]:b.ctype==3&&(b.tabs[O]=f[g]);else if(O=="IEND")break;g+=D,m.readUint(f,g),g+=4}var $;return S!=0&&(($=b.frames[b.frames.length-1]).data=n(b,x.slice(0,S),$.rect.width,$.rect.height)),b.data=n(b,_,b.width,b.height),delete b.compress,delete b.interlace,delete b.filter,b},toRGBA8:function(u){const f=u.width,g=u.height;if(u.tabs.acTL==null)return[t(u.data,f,g,u).buffer];const m=[];u.frames[0].data==null&&(u.frames[0].data=u.data);const p=f*g*4,y=new Uint8Array(p),b=new Uint8Array(p),_=new Uint8Array(p);for(let M=0;M<u.frames.length;M++){const S=u.frames[M],k=S.rect.x,N=S.rect.y,C=S.rect.width,w=S.rect.height,E=t(S.data,C,w,u);if(M!=0)for(var x=0;x<p;x++)_[x]=y[x];if(S.blend==0?c(E,C,w,y,f,g,k,N,0):S.blend==1&&c(E,C,w,y,f,g,k,N,1),m.push(y.buffer.slice(0)),S.dispose!=0){if(S.dispose==1)c(b,C,w,y,f,g,k,N,0);else if(S.dispose==2)for(x=0;x<p;x++)y[x]=_[x]}}return m},_paeth:a,_copyTile:c,_bin:e}})();(function(){const{_copyTile:e}=An,{_bin:t}=An,n=An._paeth;var r={table:(function(){const C=new Uint32Array(256);for(let w=0;w<256;w++){let E=w;for(let A=0;A<8;A++)1&E?E=3988292384^E>>>1:E>>>=1;C[w]=E}return C})(),update(C,w,E,A){for(let P=0;P<A;P++)C=r.table[255&(C^w[E+P])]^C>>>8;return C},crc:(C,w,E)=>4294967295^r.update(4294967295,C,w,E)};function s(C,w,E,A){w[E]+=C[0]*A>>4,w[E+1]+=C[1]*A>>4,w[E+2]+=C[2]*A>>4,w[E+3]+=C[3]*A>>4}function o(C){return Math.max(0,Math.min(255,C))}function i(C,w){const E=C[0]-w[0],A=C[1]-w[1],P=C[2]-w[2],L=C[3]-w[3];return E*E+A*A+P*P+L*L}function a(C,w,E,A,P,L,$){$==null&&($=1);const D=A.length,O=[];for(var T=0;T<D;T++){const V=A[T];O.push([V>>>0&255,V>>>8&255,V>>>16&255,V>>>24&255])}for(T=0;T<D;T++){let V=4294967295;for(var z=0,U=0;U<D;U++){var W=i(O[T],O[U]);U!=T&&W<V&&(V=W,z=U)}}const G=new Uint32Array(P.buffer),B=new Int16Array(w*E*4),j=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(T=0;T<j.length;T++)j[T]=255*((j[T]+.5)/16-.5);for(let V=0;V<E;V++)for(let X=0;X<w;X++){var Y;T=4*(V*w+X),$!=2?Y=[o(C[T]+B[T]),o(C[T+1]+B[T+1]),o(C[T+2]+B[T+2]),o(C[T+3]+B[T+3])]:(W=j[4*(3&V)+(3&X)],Y=[o(C[T]+W),o(C[T+1]+W),o(C[T+2]+W),o(C[T+3]+W)]),z=0;let K=16777215;for(U=0;U<D;U++){const te=i(Y,O[U]);te<K&&(K=te,z=U)}const q=O[z],ne=[Y[0]-q[0],Y[1]-q[1],Y[2]-q[2],Y[3]-q[3]];$==1&&(X!=w-1&&s(ne,B,T+4,7),V!=E-1&&(X!=0&&s(ne,B,T+4*w-4,3),s(ne,B,T+4*w,5),X!=w-1&&s(ne,B,T+4*w+4,1))),L[T>>2]=z,G[T>>2]=A[z]}}function l(C,w,E,A,P){P==null&&(P={});const{crc:L}=r,$=t.writeUint,D=t.writeUshort,O=t.writeASCII;let T=8;const z=C.frames.length>1;let U,W=!1,G=33+(z?20:0);if(P.sRGB!=null&&(G+=13),P.pHYs!=null&&(G+=21),P.iCCP!=null&&(U=pako.deflate(P.iCCP),G+=21+U.length+4),C.ctype==3){for(var B=C.plte.length,j=0;j<B;j++)C.plte[j]>>>24!=255&&(W=!0);G+=8+3*B+4+(W?8+1*B+4:0)}for(var Y=0;Y<C.frames.length;Y++)z&&(G+=38),G+=(q=C.frames[Y]).cimg.length+12,Y!=0&&(G+=4);G+=12;const V=new Uint8Array(G),X=[137,80,78,71,13,10,26,10];for(j=0;j<8;j++)V[j]=X[j];if($(V,T,13),T+=4,O(V,T,"IHDR"),T+=4,$(V,T,w),T+=4,$(V,T,E),T+=4,V[T]=C.depth,T++,V[T]=C.ctype,T++,V[T]=0,T++,V[T]=0,T++,V[T]=0,T++,$(V,T,L(V,T-17,17)),T+=4,P.sRGB!=null&&($(V,T,1),T+=4,O(V,T,"sRGB"),T+=4,V[T]=P.sRGB,T++,$(V,T,L(V,T-5,5)),T+=4),P.iCCP!=null){const ne=13+U.length;$(V,T,ne),T+=4,O(V,T,"iCCP"),T+=4,O(V,T,"ICC profile"),T+=11,T+=2,V.set(U,T),T+=U.length,$(V,T,L(V,T-(ne+4),ne+4)),T+=4}if(P.pHYs!=null&&($(V,T,9),T+=4,O(V,T,"pHYs"),T+=4,$(V,T,P.pHYs[0]),T+=4,$(V,T,P.pHYs[1]),T+=4,V[T]=P.pHYs[2],T++,$(V,T,L(V,T-13,13)),T+=4),z&&($(V,T,8),T+=4,O(V,T,"acTL"),T+=4,$(V,T,C.frames.length),T+=4,$(V,T,P.loop!=null?P.loop:0),T+=4,$(V,T,L(V,T-12,12)),T+=4),C.ctype==3){for($(V,T,3*(B=C.plte.length)),T+=4,O(V,T,"PLTE"),T+=4,j=0;j<B;j++){const ne=3*j,te=C.plte[j],fe=255&te,ee=te>>>8&255,le=te>>>16&255;V[T+ne+0]=fe,V[T+ne+1]=ee,V[T+ne+2]=le}if(T+=3*B,$(V,T,L(V,T-3*B-4,3*B+4)),T+=4,W){for($(V,T,B),T+=4,O(V,T,"tRNS"),T+=4,j=0;j<B;j++)V[T+j]=C.plte[j]>>>24&255;T+=B,$(V,T,L(V,T-B-4,B+4)),T+=4}}let K=0;for(Y=0;Y<C.frames.length;Y++){var q=C.frames[Y];z&&($(V,T,26),T+=4,O(V,T,"fcTL"),T+=4,$(V,T,K++),T+=4,$(V,T,q.rect.width),T+=4,$(V,T,q.rect.height),T+=4,$(V,T,q.rect.x),T+=4,$(V,T,q.rect.y),T+=4,D(V,T,A[Y]),T+=2,D(V,T,1e3),T+=2,V[T]=q.dispose,T++,V[T]=q.blend,T++,$(V,T,L(V,T-30,30)),T+=4);const ne=q.cimg;$(V,T,(B=ne.length)+(Y==0?0:4)),T+=4;const te=T;O(V,T,Y==0?"IDAT":"fdAT"),T+=4,Y!=0&&($(V,T,K++),T+=4),V.set(ne,T),T+=B,$(V,T,L(V,te,T-te)),T+=4}return $(V,T,0),T+=4,O(V,T,"IEND"),T+=4,$(V,T,L(V,T-4,4)),T+=4,V.buffer}function c(C,w,E){for(let A=0;A<C.frames.length;A++){const P=C.frames[A];P.rect.width;const L=P.rect.height,$=new Uint8Array(L*P.bpl+L);P.cimg=g(P.img,L,P.bpp,P.bpl,$,w,E)}}function d(C,w,E,A,P){const L=P[0],$=P[1],D=P[2],O=P[3],T=P[4],z=P[5];let U=6,W=8,G=255;for(var B=0;B<C.length;B++){const ye=new Uint8Array(C[B]);for(var j=ye.length,Y=0;Y<j;Y+=4)G&=ye[Y+3]}const V=G!=255,X=(function(me,pe,ke,$e,ie,_e){const Ae=[];for(var Ie=0;Ie<me.length;Ie++){const Fe=new Uint8Array(me[Ie]),re=new Uint32Array(Fe.buffer);var Be;let de=0,we=0,ve=pe,xe=ke,Ve=$e?1:0;if(Ie!=0){const De=_e||$e||Ie==1||Ae[Ie-2].dispose!=0?1:2;let Ne=0,Te=1e9;for(let He=0;He<De;He++){var gt=new Uint8Array(me[Ie-1-He]);const Ke=new Uint32Array(me[Ie-1-He]);let Le=pe,Ee=ke,ze=-1,rt=-1;for(let Ye=0;Ye<ke;Ye++)for(let at=0;at<pe;at++)re[Ge=Ye*pe+at]!=Ke[Ge]&&(at<Le&&(Le=at),at>ze&&(ze=at),Ye<Ee&&(Ee=Ye),Ye>rt&&(rt=Ye));ze==-1&&(Le=Ee=ze=rt=0),ie&&((1&Le)==1&&Le--,(1&Ee)==1&&Ee--);const it=(ze-Le+1)*(rt-Ee+1);it<Te&&(Te=it,Ne=He,de=Le,we=Ee,ve=ze-Le+1,xe=rt-Ee+1)}gt=new Uint8Array(me[Ie-1-Ne]),Ne==1&&(Ae[Ie-1].dispose=2),Be=new Uint8Array(ve*xe*4),e(gt,pe,ke,Be,ve,xe,-de,-we,0),Ve=e(Fe,pe,ke,Be,ve,xe,-de,-we,3)?1:0,Ve==1?f(Fe,pe,ke,Be,{x:de,y:we,width:ve,height:xe}):e(Fe,pe,ke,Be,ve,xe,-de,-we,0)}else Be=Fe.slice(0);Ae.push({rect:{x:de,y:we,width:ve,height:xe},img:Be,blend:Ve,dispose:0})}if($e)for(Ie=0;Ie<Ae.length;Ie++){if((ot=Ae[Ie]).blend==1)continue;const Fe=ot.rect,re=Ae[Ie-1].rect,de=Math.min(Fe.x,re.x),we=Math.min(Fe.y,re.y),ve={x:de,y:we,width:Math.max(Fe.x+Fe.width,re.x+re.width)-de,height:Math.max(Fe.y+Fe.height,re.y+re.height)-we};Ae[Ie-1].dispose=1,Ie-1!=0&&u(me,pe,ke,Ae,Ie-1,ve,ie),u(me,pe,ke,Ae,Ie,ve,ie)}let mt=0;if(me.length!=1)for(var Ge=0;Ge<Ae.length;Ge++){var ot;mt+=(ot=Ae[Ge]).rect.width*ot.rect.height}return Ae})(C,w,E,L,$,D),K={},q=[],ne=[];if(A!=0){const ye=[];for(Y=0;Y<X.length;Y++)ye.push(X[Y].img.buffer);const me=(function(ie){let _e=0;for(var Ae=0;Ae<ie.length;Ae++)_e+=ie[Ae].byteLength;const Ie=new Uint8Array(_e);let Be=0;for(Ae=0;Ae<ie.length;Ae++){const gt=new Uint8Array(ie[Ae]),mt=gt.length;for(let Ge=0;Ge<mt;Ge+=4){let ot=gt[Ge],Fe=gt[Ge+1],re=gt[Ge+2];const de=gt[Ge+3];de==0&&(ot=Fe=re=0),Ie[Be+Ge]=ot,Ie[Be+Ge+1]=Fe,Ie[Be+Ge+2]=re,Ie[Be+Ge+3]=de}Be+=mt}return Ie.buffer})(ye),pe=p(me,A);for(Y=0;Y<pe.plte.length;Y++)q.push(pe.plte[Y].est.rgba);let ke=0;for(Y=0;Y<X.length;Y++){const $e=(fe=X[Y]).img.length;var te=new Uint8Array(pe.inds.buffer,ke>>2,$e>>2);ne.push(te);const ie=new Uint8Array(pe.abuf,ke,$e);z&&a(fe.img,fe.rect.width,fe.rect.height,q,ie,te),fe.img.set(ie),ke+=$e}}else for(B=0;B<X.length;B++){var fe=X[B];const ye=new Uint32Array(fe.img.buffer);var ee=fe.rect.width;for(j=ye.length,te=new Uint8Array(j),ne.push(te),Y=0;Y<j;Y++){const me=ye[Y];if(Y!=0&&me==ye[Y-1])te[Y]=te[Y-1];else if(Y>ee&&me==ye[Y-ee])te[Y]=te[Y-ee];else{let pe=K[me];if(pe==null&&(K[me]=pe=q.length,q.push(me),q.length>=300))break;te[Y]=pe}}}const le=q.length;for(le<=256&&T==0&&(W=le<=2?1:le<=4?2:le<=16?4:8,W=Math.max(W,O)),B=0;B<X.length;B++){(fe=X[B]).rect.x,fe.rect.y,ee=fe.rect.width;const ye=fe.rect.height;let me=fe.img;new Uint32Array(me.buffer);let pe=4*ee,ke=4;if(le<=256&&T==0){pe=Math.ceil(W*ee/8);var ge=new Uint8Array(pe*ye);const $e=ne[B];for(let ie=0;ie<ye;ie++){Y=ie*pe;const _e=ie*ee;if(W==8)for(var ce=0;ce<ee;ce++)ge[Y+ce]=$e[_e+ce];else if(W==4)for(ce=0;ce<ee;ce++)ge[Y+(ce>>1)]|=$e[_e+ce]<<4-4*(1&ce);else if(W==2)for(ce=0;ce<ee;ce++)ge[Y+(ce>>2)]|=$e[_e+ce]<<6-2*(3&ce);else if(W==1)for(ce=0;ce<ee;ce++)ge[Y+(ce>>3)]|=$e[_e+ce]<<7-1*(7&ce)}me=ge,U=3,ke=1}else if(V==0&&X.length==1){ge=new Uint8Array(ee*ye*3);const $e=ee*ye;for(Y=0;Y<$e;Y++){const ie=3*Y,_e=4*Y;ge[ie]=me[_e],ge[ie+1]=me[_e+1],ge[ie+2]=me[_e+2]}me=ge,U=2,ke=3,pe=3*ee}fe.img=me,fe.bpl=pe,fe.bpp=ke}return{ctype:U,depth:W,plte:q,frames:X}}function u(C,w,E,A,P,L,$){const D=Uint8Array,O=Uint32Array,T=new D(C[P-1]),z=new O(C[P-1]),U=P+1<C.length?new D(C[P+1]):null,W=new D(C[P]),G=new O(W.buffer);let B=w,j=E,Y=-1,V=-1;for(let K=0;K<L.height;K++)for(let q=0;q<L.width;q++){const ne=L.x+q,te=L.y+K,fe=te*w+ne,ee=G[fe];ee==0||A[P-1].dispose==0&&z[fe]==ee&&(U==null||U[4*fe+3]!=0)||(ne<B&&(B=ne),ne>Y&&(Y=ne),te<j&&(j=te),te>V&&(V=te))}Y==-1&&(B=j=Y=V=0),$&&((1&B)==1&&B--,(1&j)==1&&j--),L={x:B,y:j,width:Y-B+1,height:V-j+1};const X=A[P];X.rect=L,X.blend=1,X.img=new Uint8Array(L.width*L.height*4),A[P-1].dispose==0?(e(T,w,E,X.img,L.width,L.height,-L.x,-L.y,0),f(W,w,E,X.img,L)):e(W,w,E,X.img,L.width,L.height,-L.x,-L.y,0)}function f(C,w,E,A,P){e(C,w,E,A,P.width,P.height,-P.x,-P.y,2)}function g(C,w,E,A,P,L,$){const D=[];let O,T=[0,1,2,3,4];L!=-1?T=[L]:(w*A>5e5||E==1)&&(T=[0]),$&&(O={level:0});const z=SE;for(var U=0;U<T.length;U++){for(let B=0;B<w;B++)m(P,C,B,A,E,T[U]);D.push(z.deflate(P,O))}let W,G=1e9;for(U=0;U<D.length;U++)D[U].length<G&&(W=U,G=D[U].length);return D[W]}function m(C,w,E,A,P,L){const $=E*A;let D=$+E;if(C[D]=L,D++,L==0)if(A<500)for(var O=0;O<A;O++)C[D+O]=w[$+O];else C.set(new Uint8Array(w.buffer,$,A),D);else if(L==1){for(O=0;O<P;O++)C[D+O]=w[$+O];for(O=P;O<A;O++)C[D+O]=w[$+O]-w[$+O-P]+256&255}else if(E==0){for(O=0;O<P;O++)C[D+O]=w[$+O];if(L==2)for(O=P;O<A;O++)C[D+O]=w[$+O];if(L==3)for(O=P;O<A;O++)C[D+O]=w[$+O]-(w[$+O-P]>>1)+256&255;if(L==4)for(O=P;O<A;O++)C[D+O]=w[$+O]-n(w[$+O-P],0,0)+256&255}else{if(L==2)for(O=0;O<A;O++)C[D+O]=w[$+O]+256-w[$+O-A]&255;if(L==3){for(O=0;O<P;O++)C[D+O]=w[$+O]+256-(w[$+O-A]>>1)&255;for(O=P;O<A;O++)C[D+O]=w[$+O]+256-(w[$+O-A]+w[$+O-P]>>1)&255}if(L==4){for(O=0;O<P;O++)C[D+O]=w[$+O]+256-n(0,w[$+O-A],0)&255;for(O=P;O<A;O++)C[D+O]=w[$+O]+256-n(w[$+O-P],w[$+O-A],w[$+O-P-A])&255}}}function p(C,w){const E=new Uint8Array(C),A=E.slice(0),P=new Uint32Array(A.buffer),L=y(A,w),$=L[0],D=L[1],O=E.length,T=new Uint8Array(O>>2);let z;if(E.length<2e7)for(var U=0;U<O;U+=4)z=b($,W=E[U]*.00392156862745098,G=E[U+1]*.00392156862745098,B=E[U+2]*.00392156862745098,j=E[U+3]*.00392156862745098),T[U>>2]=z.ind,P[U>>2]=z.est.rgba;else for(U=0;U<O;U+=4){var W=E[U]*.00392156862745098,G=E[U+1]*(1/255),B=E[U+2]*(1/255),j=E[U+3]*(1/255);for(z=$;z.left;)z=_(z.est,W,G,B,j)<=0?z.left:z.right;T[U>>2]=z.ind,P[U>>2]=z.est.rgba}return{abuf:A.buffer,inds:T,plte:D}}function y(C,w,E){E==null&&(E=1e-4);const A=new Uint32Array(C.buffer),P={i0:0,i1:C.length,bst:null,est:null,tdst:0,left:null,right:null};P.bst=S(C,P.i0,P.i1),P.est=k(P.bst);const L=[P];for(;L.length<w;){let D=0,O=0;for(var $=0;$<L.length;$++)L[$].est.L>D&&(D=L[$].est.L,O=$);if(D<E)break;const T=L[O],z=x(C,A,T.i0,T.i1,T.est.e,T.est.eMq255);if(T.i0>=z||T.i1<=z){T.est.L=0;continue}const U={i0:T.i0,i1:z,bst:null,est:null,tdst:0,left:null,right:null};U.bst=S(C,U.i0,U.i1),U.est=k(U.bst);const W={i0:z,i1:T.i1,bst:null,est:null,tdst:0,left:null,right:null};for(W.bst={R:[],m:[],N:T.bst.N-U.bst.N},$=0;$<16;$++)W.bst.R[$]=T.bst.R[$]-U.bst.R[$];for($=0;$<4;$++)W.bst.m[$]=T.bst.m[$]-U.bst.m[$];W.est=k(W.bst),T.left=U,T.right=W,L[O]=U,L.push(W)}for(L.sort(((D,O)=>O.bst.N-D.bst.N)),$=0;$<L.length;$++)L[$].ind=$;return[P,L]}function b(C,w,E,A,P){if(C.left==null)return C.tdst=(function(U,W,G,B,j){const Y=W-U[0],V=G-U[1],X=B-U[2],K=j-U[3];return Y*Y+V*V+X*X+K*K})(C.est.q,w,E,A,P),C;const L=_(C.est,w,E,A,P);let $=C.left,D=C.right;L>0&&($=C.right,D=C.left);const O=b($,w,E,A,P);if(O.tdst<=L*L)return O;const T=b(D,w,E,A,P);return T.tdst<O.tdst?T:O}function _(C,w,E,A,P){const{e:L}=C;return L[0]*w+L[1]*E+L[2]*A+L[3]*P-C.eMq}function x(C,w,E,A,P,L){for(A-=4;E<A;){for(;M(C,E,P)<=L;)E+=4;for(;M(C,A,P)>L;)A-=4;if(E>=A)break;const $=w[E>>2];w[E>>2]=w[A>>2],w[A>>2]=$,E+=4,A-=4}for(;M(C,E,P)>L;)E-=4;return E+4}function M(C,w,E){return C[w]*E[0]+C[w+1]*E[1]+C[w+2]*E[2]+C[w+3]*E[3]}function S(C,w,E){const A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],P=[0,0,0,0],L=E-w>>2;for(let $=w;$<E;$+=4){const D=C[$]*.00392156862745098,O=C[$+1]*(1/255),T=C[$+2]*(1/255),z=C[$+3]*(1/255);P[0]+=D,P[1]+=O,P[2]+=T,P[3]+=z,A[0]+=D*D,A[1]+=D*O,A[2]+=D*T,A[3]+=D*z,A[5]+=O*O,A[6]+=O*T,A[7]+=O*z,A[10]+=T*T,A[11]+=T*z,A[15]+=z*z}return A[4]=A[1],A[8]=A[2],A[9]=A[6],A[12]=A[3],A[13]=A[7],A[14]=A[11],{R:A,m:P,N:L}}function k(C){const{R:w}=C,{m:E}=C,{N:A}=C,P=E[0],L=E[1],$=E[2],D=E[3],O=A==0?0:1/A,T=[w[0]-P*P*O,w[1]-P*L*O,w[2]-P*$*O,w[3]-P*D*O,w[4]-L*P*O,w[5]-L*L*O,w[6]-L*$*O,w[7]-L*D*O,w[8]-$*P*O,w[9]-$*L*O,w[10]-$*$*O,w[11]-$*D*O,w[12]-D*P*O,w[13]-D*L*O,w[14]-D*$*O,w[15]-D*D*O],z=T,U=N;let W=[Math.random(),Math.random(),Math.random(),Math.random()],G=0,B=0;if(A!=0)for(let Y=0;Y<16&&(W=U.multVec(z,W),B=Math.sqrt(U.dot(W,W)),W=U.sml(1/B,W),!(Y!=0&&Math.abs(B-G)<1e-9));Y++)G=B;const j=[P*O,L*O,$*O,D*O];return{Cov:T,q:j,e:W,L:G,eMq255:U.dot(U.sml(255,j),W),eMq:U.dot(W,j),rgba:(Math.round(255*j[3])<<24|Math.round(255*j[2])<<16|Math.round(255*j[1])<<8|Math.round(255*j[0])<<0)>>>0}}var N={multVec:(C,w)=>[C[0]*w[0]+C[1]*w[1]+C[2]*w[2]+C[3]*w[3],C[4]*w[0]+C[5]*w[1]+C[6]*w[2]+C[7]*w[3],C[8]*w[0]+C[9]*w[1]+C[10]*w[2]+C[11]*w[3],C[12]*w[0]+C[13]*w[1]+C[14]*w[2]+C[15]*w[3]],dot:(C,w)=>C[0]*w[0]+C[1]*w[1]+C[2]*w[2]+C[3]*w[3],sml:(C,w)=>[C*w[0],C*w[1],C*w[2],C*w[3]]};An.encode=function(w,E,A,P,L,$,D){P==null&&(P=0),D==null&&(D=!1);const O=d(w,E,A,P,[!1,!1,!1,0,D,!1]);return c(O,-1),l(O,E,A,L,$)},An.encodeLL=function(w,E,A,P,L,$,D,O){const T={ctype:0+(P==1?0:2)+(L==0?0:4),depth:$,frames:[]},z=(P+L)*$,U=z*E;for(let W=0;W<w.length;W++)T.frames.push({rect:{x:0,y:0,width:E,height:A},img:new Uint8Array(w[W]),blend:0,dispose:1,bpp:Math.ceil(z/8),bpl:Math.ceil(U/8)});return c(T,0,!0),l(T,E,A,D,O)},An.encode.compress=d,An.encode.dither=a,An.quantize=p,An.quantize.getKDtree=y,An.quantize.getNearest=b})();const Mp={toArrayBuffer(e,t){const n=e.width,r=e.height,s=n<<2,o=e.getContext("2d").getImageData(0,0,n,r),i=new Uint32Array(o.data.buffer),a=(32*n+31)/32<<2,l=a*r,c=122+l,d=new ArrayBuffer(c),u=new DataView(d),f=1<<20;let g,m,p,y,b=f,_=0,x=0,M=0;function S(C){u.setUint16(x,C,!0),x+=2}function k(C){u.setUint32(x,C,!0),x+=4}function N(C){x+=C}S(19778),k(c),N(4),k(122),k(108),k(n),k(-r>>>0),S(1),S(32),k(3),k(l),k(2835),k(2835),N(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function C(){for(;_<r&&b>0;){for(y=122+_*a,g=0;g<s;)b--,m=i[M++],p=m>>>24,u.setUint32(y+g,m<<8|p),g+=4;_++}M<i.length?(b=f,setTimeout(C,Mp._dly)):t(d)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var tn={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},_E={[tn.CHROME]:16384,[tn.FIREFOX]:11180,[tn.DESKTOP_SAFARI]:16384,[tn.IE]:8192,[tn.IOS]:4096,[tn.ETC]:8192};const Vc=typeof window<"u",Np=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Ji=Vc&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),EE=(Vc||Np)&&(Ji&&Ji.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Tp=(Vc||Np)&&(Ji&&Ji.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Hc(e,t,n=Date.now()){return new Promise((r=>{const s=e.split(","),o=s[0].match(/:(.*?);/)[1],i=globalThis.atob(s[1]);let a=i.length;const l=new Uint8Array(a);for(;a--;)l[a]=i.charCodeAt(a);const c=new Blob([l],{type:o});c.name=t,c.lastModified=n,r(c)}))}function Op(e){return new Promise(((t,n)=>{const r=new Tp;r.onload=()=>t(r.result),r.onerror=s=>n(s),r.readAsDataURL(e)}))}function Ap(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=s=>n(s),r.src=e}))}function Ar(){if(Ar.cachedResult!==void 0)return Ar.cachedResult;let e=tn.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=tn.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=tn.IOS:/Safari/i.test(t)?e=tn.DESKTOP_SAFARI:/Firefox/i.test(t)?e=tn.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=tn.IE),Ar.cachedResult=e,Ar.cachedResult}function Dp(e,t){const n=Ar(),r=_E[n];let s=e,o=t,i=s*o;const a=s>o?o/s:s/o;for(;i>r*r;){const l=(r+s)/2,c=(r+o)/2;l<c?(o=c,s=c*a):(o=l*a,s=l),i=s*o}return{width:s,height:o}}function Ri(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function Ip(e,t){const{width:n,height:r}=Dp(e.width,e.height),[s,o]=Ri(n,r);return t&&/jpe?g/.test(t)&&(o.fillStyle="white",o.fillRect(0,0,s.width,s.height)),o.drawImage(e,0,0,s.width,s.height),s}function ea(){return ea.cachedResult!==void 0||(ea.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),ea.cachedResult}function ta(e,t={}){return new Promise((function(n,r){let s,o;var i=function(){try{return o=Ip(s,t.fileType||e.type),n([s,o])}catch(l){return r(l)}},a=function(l){try{var c=function(d){try{throw d}catch(u){return r(u)}};try{let d;return Op(e).then((function(u){try{return d=u,Ap(d).then((function(f){try{return s=f,(function(){try{return i()}catch(g){return r(g)}})()}catch(g){return c(g)}}),c)}catch(f){return c(f)}}),c)}catch(d){c(d)}}catch(d){return r(d)}};try{if(ea()||[tn.DESKTOP_SAFARI,tn.MOBILE_SAFARI].includes(Ar()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(l){try{return s=l,i()}catch{return a()}}),a)}catch{a()}}))}function na(e,t,n,r,s=1){return new Promise((function(o,i){let a;if(t==="image/png"){let c,d,u;return c=e.getContext("2d"),{data:d}=c.getImageData(0,0,e.width,e.height),u=An.encode([d.buffer],e.width,e.height,4096*s),a=new Blob([u],{type:t}),a.name=n,a.lastModified=r,l.call(this)}{let c=function(){return l.call(this)};if(t==="image/bmp")return new Promise((d=>Mp.toBlob(e,d))).then(function(d){try{return a=d,a.name=n,a.lastModified=r,c.call(this)}catch(u){return i(u)}}.bind(this),i);{let d=function(){return c.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:s}).then(function(u){try{return a=u,a.name=n,a.lastModified=r,d.call(this)}catch(f){return i(f)}}.bind(this),i);{let u;return u=e.toDataURL(t,s),Hc(u,n,r).then(function(f){try{return a=f,d.call(this)}catch(g){return i(g)}}.bind(this),i)}}}function l(){return o(a)}}))}function Bn(e){e.width=0,e.height=0}function ws(){return new Promise((function(e,t){let n,r,s,o;return ws.cachedResult!==void 0?e(ws.cachedResult):Hc("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(i){try{return n=i,ta(n).then((function(a){try{return r=a[1],na(r,n.type,n.name,n.lastModified).then((function(l){try{return s=l,Bn(r),ta(s).then((function(c){try{return o=c[0],ws.cachedResult=o.width===1&&o.height===2,e(ws.cachedResult)}catch(d){return t(d)}}),t)}catch(c){return t(c)}}),t)}catch(l){return t(l)}}),t)}catch(a){return t(a)}}),t)}))}function Lp(e){return new Promise(((t,n)=>{const r=new Tp;r.onload=s=>{const o=new DataView(s.target.result);if(o.getUint16(0,!1)!=65496)return t(-2);const i=o.byteLength;let a=2;for(;a<i;){if(o.getUint16(a+2,!1)<=8)return t(-1);const l=o.getUint16(a,!1);if(a+=2,l==65505){if(o.getUint32(a+=2,!1)!=1165519206)return t(-1);const c=o.getUint16(a+=6,!1)==18761;a+=o.getUint32(a+4,c);const d=o.getUint16(a,c);a+=2;for(let u=0;u<d;u++)if(o.getUint16(a+12*u,c)==274)return t(o.getUint16(a+12*u+8,c))}else{if((65280&l)!=65280)break;a+=o.getUint16(a,!1)}}return t(-1)},r.onerror=s=>n(s),r.readAsArrayBuffer(e)}))}function Pp(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:s}=t;let o,i=e;return isFinite(s)&&(n>s||r>s)&&([i,o]=Ri(n,r),n>r?(i.width=s,i.height=r/n*s):(i.width=n/r*s,i.height=s),o.drawImage(e,0,0,i.width,i.height),Bn(e)),i}function $p(e,t){const{width:n}=e,{height:r}=e,[s,o]=Ri(n,r);switch(t>4&&t<9?(s.width=r,s.height=n):(s.width=n,s.height=r),t){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(e,0,0,n,r),Bn(e),s}function Fp(e,t,n=0){return new Promise((function(r,s){let o,i,a,l,c,d,u,f,g,m,p,y,b,_,x,M,S,k,N,C;function w(A=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=A,t.onProgress(Math.min(o,100))}function E(A){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(A,o),100),t.onProgress(o)}return o=n,i=t.maxIteration||10,a=1024*t.maxSizeMB*1024,w(),ta(e,t).then(function(A){try{return[,l]=A,w(),c=Pp(l,t),w(),new Promise((function(P,L){var $;if(!($=t.exifOrientation))return Lp(e).then(function(O){try{return $=O,D.call(this)}catch(T){return L(T)}}.bind(this),L);function D(){return P($)}return D.call(this)})).then(function(P){try{return d=P,w(),ws().then(function(L){try{return u=L?c:$p(c,d),w(),f=t.initialQuality||1,g=t.fileType||e.type,na(u,g,e.name,e.lastModified,f).then(function($){try{{let O=function(){if(i--&&(x>a||x>b)){let z,U;return z=C?.95*N.width:N.width,U=C?.95*N.height:N.height,[S,k]=Ri(z,U),k.drawImage(N,0,0,z,U),f*=g==="image/png"?.85:.95,na(S,g,e.name,e.lastModified,f).then((function(W){try{return M=W,Bn(N),N=S,x=M.size,E(Math.min(99,Math.floor((_-x)/(_-a)*100))),O}catch(G){return s(G)}}),s)}return[1]},T=function(){return Bn(N),Bn(S),Bn(c),Bn(u),Bn(l),E(100),r(M)};if(m=$,w(),p=m.size>a,y=m.size>e.size,!p&&!y)return E(100),r(m);var D;return b=e.size,_=m.size,x=_,N=u,C=!t.alwaysKeepResolution&&p,(D=function(z){for(;z;){if(z.then)return void z.then(D,s);try{if(z.pop){if(z.length)return z.pop()?T.call(this):z;z=O}else z=z.call(this)}catch(U){return s(U)}}}.bind(this))(O)}}catch(O){return s(O)}}.bind(this),s)}catch($){return s($)}}.bind(this),s)}catch(L){return s(L)}}.bind(this),s)}catch(P){return s(P)}}.bind(this),s)}))}const ME=`
|
||
let scriptImported = false
|
||
self.addEventListener('message', async (e) => {
|
||
const { file, id, imageCompressionLibUrl, options } = e.data
|
||
options.onProgress = (progress) => self.postMessage({ progress, id })
|
||
try {
|
||
if (!scriptImported) {
|
||
// console.log('[worker] importScripts', imageCompressionLibUrl)
|
||
self.importScripts(imageCompressionLibUrl)
|
||
scriptImported = true
|
||
}
|
||
// console.log('[worker] self', self)
|
||
const compressedFile = await imageCompression(file, options)
|
||
self.postMessage({ file: compressedFile, id })
|
||
} catch (e) {
|
||
// console.error('[worker] error', e)
|
||
self.postMessage({ error: e.message + '\\n' + e.stack, id })
|
||
}
|
||
})
|
||
`;let Uc;function NE(e,t){return new Promise(((n,r)=>{Uc||(Uc=(function(i){const a=[];return a.push(i),URL.createObjectURL(new Blob(a))})(ME));const s=new Worker(Uc);s.addEventListener("message",(function(i){if(t.signal&&t.signal.aborted)s.terminate();else if(i.data.progress===void 0){if(i.data.error)return r(new Error(i.data.error)),void s.terminate();n(i.data.file),s.terminate()}else t.onProgress(i.data.progress)})),s.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),s.terminate()})),s.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function jt(e,t){return new Promise((function(n,r){let s,o,i,a,l,c;if(s={...t},i=0,{onProgress:a}=s,s.maxSizeMB=s.maxSizeMB||Number.POSITIVE_INFINITY,l=typeof s.useWebWorker!="boolean"||s.useWebWorker,delete s.useWebWorker,s.onProgress=g=>{i=g,typeof a=="function"&&a(i)},!(e instanceof Blob||e instanceof EE))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(c=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!l||typeof Worker!="function"||c)return Fp(e,s).then(function(g){try{return o=g,f.call(this)}catch(m){return r(m)}}.bind(this),r);var d=function(){try{return f.call(this)}catch(g){return r(g)}}.bind(this),u=function(g){try{return Fp(e,s).then((function(m){try{return o=m,d()}catch(p){return r(p)}}),r)}catch(m){return r(m)}};try{return s.libURL=s.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",NE(e,s).then((function(g){try{return o=g,d()}catch{return u()}}),u)}catch{u()}function f(){try{o.name=e.name,o.lastModified=e.lastModified}catch{}try{s.preserveExif&&e.type==="image/jpeg"&&(!s.fileType||s.fileType&&s.fileType===e.type)&&(o=Ep(e,o))}catch{}return n(o)}}))}jt.getDataUrlFromFile=Op,jt.getFilefromDataUrl=Hc,jt.loadImage=Ap,jt.drawImageInCanvas=Ip,jt.drawFileInCanvas=ta,jt.canvasToFile=na,jt.getExifOrientation=Lp,jt.handleMaxWidthOrHeight=Pp,jt.followExifOrientation=$p,jt.cleanupCanvasMemory=Bn,jt.isAutoOrientationInBrowser=ws,jt.approximateBelowMaximumCanvasSizeOfBrowser=Dp,jt.copyExifWithoutOrientation=Ep,jt.getBrowserName=Ar,jt.version="2.0.2";const TE=window.G7Core,Bc=e=>{const t=["B","KB","MB","GB"];let n=0,r=e;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${r.toFixed(2)} ${t[n]}`},OE=e=>{if(e&&typeof e=="object"){const t=e;if(t.response?.data?.message)return t.response.data.message;if(t.response?.data?.errors){const n=Object.values(t.response.data.errors)[0];if(Array.isArray(n)&&n[0])return n[0]}if(t.message)return t.message}return e instanceof Error?e.message:"업로드 실패"},AE=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",Lt=(e,t)=>TE?.t?.(e,t)??e,zp=window.G7Core?.createLogger?.("Comp:FileUploader")??{log:(...e)=>console.log("[Comp:FileUploader]",...e),warn:(...e)=>console.warn("[Comp:FileUploader]",...e),error:(...e)=>console.error("[Comp:FileUploader]",...e)},Dr=window.G7Core;function DE(e){const{attachmentableType:t,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:u,endpoints:f,onFilesChange:g,onUploadComplete:m,onUploadError:p,onRemove:y,onReorder:b,uploadTriggerEvent:_,confirmBeforeRemove:x,uploadParams:M}=e,[S,k]=v.useState(u),[N,C]=v.useState([]),[w,E]=v.useState(!1),A=v.useRef(null),P=v.useRef(0),L=v.useRef(new Set),$=v.useRef(new Map),D=v.useRef(null),[O,T]=v.useState(!1),[z,U]=v.useState(null),[W,G]=v.useState(!1),B=v.useRef(!1),[j,Y]=v.useState([]),[V,X]=v.useState(!1),[K,q]=v.useState(0),ne=v.useRef(0),[te,fe]=v.useState(new Map),ee=v.useRef(new Map),le=v.useRef(g);le.current=g,v.useEffect(()=>{le.current?.(N)},[N]),v.useEffect(()=>{if(B.current)return;const re=u.filter(ve=>!L.current.has(ve.id)&&(!ve.hash||!L.current.has(ve.hash))),de=new Set(re.map(ve=>ve.id)),we=Array.from($.current.values()).filter(ve=>!de.has(ve.id)&&!L.current.has(ve.id));k([...re,...we])},[u]);const ge=v.useCallback(async re=>{const de={maxSizeMB:l?.maxSizeMB??1,maxWidthOrHeight:l?.maxWidthOrHeight??1920,useWebWorker:!0};return await jt(re,de)},[l]),ce=v.useCallback(async re=>{const de=S.length+N.length,we=Math.max(0,s-de),ve=Array.from(re).slice(0,we);if(re.length>we){const xe=Array.from(re).slice(we),Ve=Lt("attachment.upload_limit_exceeded",{max:s});p?.(Ve,xe[0]??re[0])}for(const xe of ve){if(xe.size>o*1024*1024){p?.(`[${xe.name}] 파일 크기(${Bc(xe.size)})가 최대 허용 크기(${o}MB)를 초과합니다.`,xe);continue}if(a){const De="."+xe.name.split(".").pop()?.toLowerCase();if(!a.split(",").map(Te=>Te.trim().toLowerCase()).includes(De)){p?.(`[${xe.name}] 허용되지 않는 파일 형식입니다. (허용: ${a})`,xe);continue}}const Ve={id:`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:xe,original_filename:xe.name,mime_type:xe.type,size:xe.size,size_formatted:Bc(xe.size),status:"pending",progress:0};if(xe.type.startsWith("image/")&&(Ve.preview=URL.createObjectURL(xe)),C(De=>[...De,Ve]),xe.type.startsWith("image/")&&l){C(De=>De.map(Ne=>Ne.id===Ve.id?{...Ne,status:"compressing"}:Ne));try{const De=await ge(xe);C(Ne=>Ne.map(Te=>Te.id===Ve.id?{...Te,compressedBlob:De,size:De.size,size_formatted:Bc(De.size),status:"pending",progress:0}:Te))}catch{C(De=>De.map(Ne=>Ne.id===Ve.id?{...Ne,status:"error",error:"이미지 압축 실패"}:Ne))}}}},[S.length,N.length,s,o,a,l,ge,p]),ye=v.useCallback(async re=>{const de=new FormData,we=re.compressedBlob?new File([re.compressedBlob],re.original_filename,{type:re.mime_type}):re.file;de.append("file",we),t&&de.append("attachmentable_type",t),n&&de.append("attachmentable_id",String(n)),de.append("collection",r),c.forEach(ve=>{de.append("role_ids[]",String(ve))}),M&&Object.entries(M).forEach(([ve,xe])=>{de.append(ve,xe)});try{const ve=await Dr.api.post(f.upload,de,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:Ve=>{const De=Math.round(Ve.loaded*100/(Ve.total??1));C(Ne=>Ne.map(Te=>Te.id===re.id?{...Te,progress:De}:Te))}});return ve?.data?.data??ve?.data}catch(ve){const xe=OE(ve);throw new Error(xe)}},[t,n,r,c,f.upload]),me=v.useCallback(async()=>{const re=N.filter(De=>De.status==="pending"||De.status==="error");if(re.length===0)return D.current=S,[];const de=[],we=new Map,ve=[...re],xe=async()=>{for(;ve.length>0&&P.current<i;){const De=ve.shift();P.current++,C(Ne=>Ne.map(Te=>Te.id===De.id?{...Te,status:"uploading",progress:0}:Te));try{const Ne=await ye(De);if(Ne)de.push(Ne),we.set(String(De.id),String(Ne.hash)),$.current.set(Ne.id,Ne),C(Te=>Te.filter(He=>He.id!==De.id)),k(Te=>[...Te,Ne]),Y(Te=>{if(Te.length===0)return Te;const He=String(De.id);return Te.some(Le=>String(Le)===He)?Te.map(Le=>String(Le)===He?String(Ne.hash):Le):Te}),De.preview&&URL.revokeObjectURL(De.preview);else{const Te=Lt("attachment.upload_response_invalid");C(He=>He.map(Ke=>Ke.id===De.id?{...Ke,status:"error",error:Te}:Ke)),p?.(`[${De.original_filename}] ${Te}`,De.file)}}catch(Ne){const Te=Ne instanceof Error?Ne.message:"업로드 실패";C(He=>He.map(Ke=>Ke.id===De.id?{...Ke,status:"error",error:Te}:Ke)),p?.(`[${De.original_filename}] ${Te}`,De.file)}finally{P.current--}}},Ve=Array(Math.min(i,re.length)).fill(null).map(()=>xe());if(await Promise.all(Ve),de.length>0){m?.(de);const De=[...S,...de];if(j.length>0){const Ne=j.map(Ke=>we.get(String(Ke))??Ke),Te=new Map(Ne.map((Ke,Le)=>[String(Ke),Le])),He=[...De].sort((Ke,Le)=>{const Ee=Te.get(String(Ke.hash))??De.length,ze=Te.get(String(Le.hash))??De.length;return Ee-ze}).map((Ke,Le)=>({...Ke,sort_order:Le,order:Le+1}));D.current=He,f.reorder&&b&&b(He)}else D.current=De.map((Ne,Te)=>({...Ne,sort_order:Te,order:Te+1}))}else D.current=S;return de},[N,i,ye,m,p,j,S,b,f.reorder]);v.useEffect(()=>{if(!_)return;const re=Dr.componentEvent.on(_,async()=>{const de=await me(),we=D.current??[...S,...de];return{uploadedAttachments:de,existingFiles:S,allFiles:we}});return()=>{re()}},[_,me,S]),v.useEffect(()=>{d&&N.some(re=>re.status==="pending")&&me()},[d,N,me]);const pe=v.useCallback(async re=>{G(!0);try{if(re.id&&f.delete){const we=f.delete.replace(":id",String(re.id));await Dr.api.delete(we)}const de=re.hash||re.id;re.id&&(L.current.add(re.id),$.current.delete(re.id)),re.hash&&L.current.add(re.hash),k(we=>we.filter(ve=>(ve.hash||ve.id)!==de)),y?.(re.hash||re.id),T(!1),U(null)}catch{zp.error("첨부파일 삭제 실패")}finally{G(!1)}},[y,f.delete]),ke=v.useCallback(async re=>{"hash"in re?x?(U(re),T(!0)):await pe(re):(re.preview&&URL.revokeObjectURL(re.preview),C(de=>de.filter(we=>we.id!==re.id)))},[x,pe]),$e=v.useCallback(re=>{C(de=>de.map(we=>we.id===re.id?{...we,status:"pending",error:void 0}:we))},[]),ie=v.useCallback(async re=>{const{arrayMove:de}=await Promise.resolve().then(()=>e_),{active:we,over:ve}=re;if(!ve||we.id===ve.id)return;const xe=[...S,...N];let Ve;if(j.length===0)Ve=xe;else{const Ee=new Map(j.map((ze,rt)=>[String(ze),rt]));Ve=[...xe].sort((ze,rt)=>{const it="hash"in ze?String(ze.hash):String(ze.id),Ye="hash"in rt?String(rt.hash):String(rt.id);return(Ee.get(it)??xe.length)-(Ee.get(Ye)??xe.length)})}const De=Ve.findIndex(Ee=>"hash"in Ee?Ee.hash===we.id:Ee.id===we.id),Ne=Ve.findIndex(Ee=>"hash"in Ee?Ee.hash===ve.id:Ee.id===ve.id),Te=de(Ve,De,Ne);Y(Te.map(Ee=>"hash"in Ee?Ee.hash:Ee.id));const He=Te.filter(Ee=>"hash"in Ee),Ke=Te.filter(Ee=>!("hash"in Ee));B.current=!0,k(He),C(Ke);const Le=He.map((Ee,ze)=>({...Ee,sort_order:ze,order:ze+1}));if(He.length>0&&f.reorder){const Ee=He.map((ze,rt)=>({id:ze.id,order:rt+1}));try{const ze=await Dr.api.patch(f.reorder,{order:Ee});Dr.toast.success(ze.message)}catch(ze){const rt=ze instanceof Error?ze.message:Lt("attachment.reorder_failed");Dr.toast.error(rt)}}b?.(Le)},[S,N,j,f.reorder,b]),_e=v.useMemo(()=>[...S,...N].filter(re=>"is_image"in re?re.is_image:re.mime_type?.startsWith("image/")??!1),[S,N]),Ae=v.useCallback(re=>{const de=_e.findIndex(we=>"hash"in re&&"hash"in we?we.hash===re.hash:"id"in re&&"id"in we&&!("hash"in re)&&!("hash"in we)?we.id===re.id:!1);de!==-1&&(ne.current+=1,q(de),X(!0))},[_e]);v.useEffect(()=>{let re=!1;return(async()=>{const we=S.filter(xe=>xe.is_image),ve=new Set(we.map(xe=>xe.id));for(const[xe,Ve]of ee.current)ve.has(xe)||(URL.revokeObjectURL(Ve),ee.current.delete(xe));for(const xe of we){if(re)break;if(!ee.current.has(xe.id)){if($c(xe.download_url)){ee.current.set(xe.id,xe.download_url),fe(new Map(ee.current));continue}try{const Ve=await Dr.api.get(xe.download_url,{responseType:"blob"});if(!re&&Ve){const De=URL.createObjectURL(Ve);ee.current.set(xe.id,De),fe(new Map(ee.current))}}catch(Ve){zp.error("Failed to load authenticated image:",Ve)}}}})(),()=>{re=!0}},[S]),v.useEffect(()=>()=>{ee.current.forEach(re=>URL.revokeObjectURL(re)),ee.current.clear()},[]);const Ie=v.useCallback(async re=>{const{executeImageDownload:de}=await Promise.resolve().then(()=>yE);await de({src:re.download_url,downloadUrl:re.download_url,filename:re.original_filename,downloadRequiresAuth:!0})},[]),Be=v.useMemo(()=>{const re=[...S,...N];if(j.length===0)return re;const de=new Map(j.map((we,ve)=>[String(we),ve]));return[...re].sort((we,ve)=>{const xe="hash"in we?String(we.hash):String(we.id),Ve="hash"in ve?String(ve.hash):String(ve.id),De=de.get(xe)??re.length,Ne=de.get(Ve)??re.length;return De-Ne})},[S,N,j]),gt=Be.length,mt=gt>0,Ge=gt<s,ot=v.useCallback(()=>C([]),[]),Fe=v.useCallback(()=>N,[N]);return{existingFiles:S,pendingFiles:N,isDragOver:w,setIsDragOver:E,isDeleting:W,totalCount:gt,hasFiles:mt,canAddMore:Ge,allItems:Be,imageFiles:_e,handleFiles:ce,handleRemove:ke,handleRetry:$e,handleUploadAll:me,handleOpenGallery:Ae,handleDownload:Ie,handleDragEnd:ie,inputRef:A,galleryOpen:V,setGalleryOpen:X,galleryStartIndex:K,galleryKeyRef:ne,confirmDialogOpen:O,setConfirmDialogOpen:T,itemToDelete:z,executeRemoveAttachment:pe,authenticatedImageUrls:te,clear:ot,getPendingFiles:Fe}}const IE=({isDragOver:e,canAddMore:t,onFiles:n,setIsDragOver:r,inputRef:s,accept:o,maxFiles:i,maxSize:a,disabled:l,children:c})=>{const d=t&&!l;return h.jsxs(I,{className:`
|
||
relative border-2 border-dashed rounded-lg transition-colors
|
||
${l?"opacity-60 cursor-not-allowed":""}
|
||
${e&&!l?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600"}
|
||
`,onDragOver:u=>{u.preventDefault(),d&&r(!0)},onDragLeave:()=>r(!1),onDrop:u=>{u.preventDefault(),r(!1),d&&n(u.dataTransfer.files)},children:[h.jsx("input",{ref:s,type:"file",multiple:!0,accept:o,onChange:u=>u.target.files&&!l&&n(u.target.files),className:"hidden",disabled:l}),!c&&h.jsxs(I,{className:`p-8 text-center transition-colors ${l?"cursor-not-allowed":"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,onClick:()=>!l&&s.current?.click(),children:[h.jsx(pt,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),h.jsx(yt,{className:"text-sm text-gray-600 dark:text-gray-400",children:Lt("attachment.drop_or_click")}),h.jsxs(yt,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[Lt("attachment.upload_limit",{maxFiles:i,maxSize:a}),o&&` (${o})`]})]}),c]})},LE=window.G7Core,PE=window.G7Core?.createLogger?.("Comp:SortableThumbnail")??{log:(...e)=>console.log("[Comp:SortableThumbnail]",...e),warn:(...e)=>console.warn("[Comp:SortableThumbnail]",...e),error:(...e)=>console.error("[Comp:SortableThumbnail]",...e)},$E=({file:e,onRemove:t,onRetry:n,onImageClick:r,onDownload:s,isPrimary:o,onPrimaryClick:i,disabled:a})=>{const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:g}=Hi({id:"hash"in e?e.hash:e.id}),m={transform:Un.Transform.toString(u),transition:f,opacity:g?.5:1},p="status"in e&&e.status!==void 0,y=p?e.status:"done",b=y==="uploading",_=y==="compressing",x=y==="error",M=p?e.progress:100,S=p?e.preview:void 0,k=p?e.mime_type?.startsWith("image/")??!1:e.is_image,[N,C]=v.useState(void 0),w=!p&&k?e.download_url:void 0;v.useEffect(()=>{if(!w){C(void 0);return}if($c(w)){C(w);return}let A=!0,P;return(async()=>{try{const $=await LE.api.get(w,{responseType:"blob"});A&&$&&(P=URL.createObjectURL($),C(P))}catch($){PE.error("Failed to load authenticated image:",$)}})(),()=>{A=!1,P&&URL.revokeObjectURL(P)}},[w]);const E=N;return h.jsxs(I,{ref:d,style:m,className:"relative group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsxs(I,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${k||!p?"cursor-pointer":""}`,onClick:()=>{b||_||(k&&r?r():!p&&s&&s())},children:[S||E?h.jsx(Sn,{src:S||E,alt:e.original_filename,className:"w-full h-full object-cover"}):h.jsx(pt,{className:`fa-solid ${AE(e.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(b||_)&&h.jsxs(I,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[h.jsx(I,{className:"w-3/4 h-2 bg-gray-700 rounded-full overflow-hidden",children:h.jsx(I,{className:"h-full bg-blue-500 transition-all",style:{width:`${M}%`}})}),h.jsxs(J,{className:"text-white text-xs mt-1",children:[M,"%"]})]}),x&&h.jsx(I,{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:h.jsx(pt,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),i&&h.jsx(ae,{type:"button",onClick:A=>{A.stopPropagation(),i()},className:`absolute top-1.5 left-1.5 z-10 p-1 rounded-full transition-colors ${o?"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:Lt(o?"attachment.primary_image":"attachment.set_as_primary"),children:h.jsx(pt,{className:"fa-solid fa-star text-xs"})}),h.jsxs(I,{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 ${a?"hidden":""}`,children:[h.jsx(ae,{type:"button",...l,...c,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:Lt("attachment.drag_to_reorder"),onClick:A=>A.stopPropagation(),children:h.jsx(pt,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&s&&h.jsx(ae,{type:"button",onClick:A=>{A.stopPropagation(),s()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:Lt("common.download"),children:h.jsx(pt,{className:"fa-solid fa-download text-sm"})}),x&&n&&h.jsx(ae,{type:"button",onClick:A=>{A.stopPropagation(),n()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:Lt("common.retry"),children:h.jsx(pt,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),h.jsx(ae,{type:"button",onClick:A=>{A.stopPropagation(),t()},disabled:b||_,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:Lt("common.delete"),children:h.jsx(pt,{className:"fa-solid fa-times text-sm"})})]})]}),h.jsxs(I,{className:`p-2 ${!p&&s?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&s&&s()},children:[h.jsx(yt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:e.original_filename,children:e.original_filename}),h.jsx(yt,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.size_formatted})]})]})},FE=({allItems:e,canAddMore:t,totalCount:n,maxFiles:r,maxSize:s,accept:o,onRemove:i,onRetry:a,onImageClick:l,onDownload:c,onDragEnd:d,onAddClick:u,enablePrimarySelection:f,primaryFileId:g,onPrimaryChange:m,disabled:p})=>{const y=Zl(ds(oo,{activationConstraint:{distance:8}}),ds(so,{coordinateGetter:Ui}));return h.jsxs(I,{className:"p-3",children:[h.jsx(ac,{sensors:y,collisionDetection:Ql,onDragEnd:d,children:h.jsx(Vi,{items:e.map(b=>"hash"in b?b.hash:b.id),strategy:Fi,children:h.jsxs(I,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[e.map(b=>{const _="hash"in b,x=_?b.is_image:b.mime_type?.startsWith("image/")??!1;return h.jsx($E,{file:b,onRemove:()=>i(b),onRetry:"status"in b&&b.status==="error"?()=>a(b):void 0,onImageClick:x?()=>l(b):void 0,onDownload:_?()=>c(b):void 0,isPrimary:f&&_&&(b.hash||b.id)===g,onPrimaryClick:f&&_?()=>m?.(b.hash||b.id):void 0,disabled:p},_?b.hash:b.id)}),t&&!p&&h.jsxs(I,{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:u,children:[h.jsx(pt,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),h.jsx(J,{className:"text-xs text-gray-500 dark:text-gray-400",children:Lt("common.add")})]})]})})}),h.jsxs(I,{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:[h.jsx(J,{children:Lt("attachment.attached_count",{count:n,max:r})}),h.jsxs(J,{children:[Lt("attachment.max_size",{size:s}),o&&` (${o})`]})]})]})},Vp=v.forwardRef(({uploadTriggerEvent:e,attachmentableType:t,attachmentableId:n,collection:r="default",maxFiles:s=10,maxSize:o=10,maxConcurrentUploads:i=3,accept:a,imageCompression:l,roleIds:c=[],autoUpload:d=!0,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,initialFiles:y=[],disabled:b=!1,className:_="",confirmBeforeRemove:x=!1,confirmRemoveTitle:M,confirmRemoveMessage:S,apiEndpoints:k,uploadParams:N,enablePrimarySelection:C=!1,primaryFileId:w,onPrimaryChange:E,id:A,editorAttrs:P},L)=>{const $={upload:k?.upload??"/api/admin/attachments",delete:k?.delete??"/api/admin/attachments/:id",reorder:k?.reorder??"/api/admin/attachments/reorder"},D=DE({attachmentableType:t,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:y,endpoints:$,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,uploadTriggerEvent:e,confirmBeforeRemove:x,uploadParams:N});v.useImperativeHandle(L,()=>({uploadAll:D.handleUploadAll,clear:D.clear,getPendingFiles:D.getPendingFiles}));const O=v.useMemo(()=>D.imageFiles.map(z=>{const U=!("hash"in z),W=z,G=z;return U?{src:W.preview||"",filename:W.original_filename,title:W.original_filename,downloadRequiresAuth:!1}:{src:D.authenticatedImageUrls.get(G.id)||G.download_url,downloadUrl:G.download_url,filename:G.original_filename,title:G.original_filename,downloadRequiresAuth:!0}}),[D.imageFiles,D.authenticatedImageUrls]),T=v.useMemo(()=>({existingFiles:D.existingFiles,pendingFiles:D.pendingFiles,isDragOver:D.isDragOver,isDeleting:D.isDeleting,maxFiles:s,maxSize:o,accept:a,endpoints:$,confirmBeforeRemove:x,totalCount:D.totalCount,hasFiles:D.hasFiles,canAddMore:D.canAddMore,allItems:D.allItems,imageFiles:D.imageFiles,handleFiles:D.handleFiles,handleRemove:D.handleRemove,handleRetry:D.handleRetry,handleUploadAll:D.handleUploadAll,handleOpenGallery:D.handleOpenGallery,handleDownload:D.handleDownload,handleDragEnd:D.handleDragEnd,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,galleryOpen:D.galleryOpen,setGalleryOpen:D.setGalleryOpen,galleryStartIndex:D.galleryStartIndex,galleryKeyRef:D.galleryKeyRef,confirmDialogOpen:D.confirmDialogOpen,setConfirmDialogOpen:D.setConfirmDialogOpen,itemToDelete:D.itemToDelete,executeRemoveAttachment:D.executeRemoveAttachment,authenticatedImageUrls:D.authenticatedImageUrls}),[D,s,o,a,$,x]);return h.jsx(xE,{value:T,children:h.jsxs(I,{id:A,className:_,...P,children:[h.jsx(IE,{isDragOver:D.isDragOver,canAddMore:D.canAddMore,onFiles:D.handleFiles,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,accept:a,maxFiles:s,maxSize:o,disabled:b,children:D.hasFiles&&h.jsx(FE,{allItems:D.allItems,canAddMore:D.canAddMore,totalCount:D.totalCount,maxFiles:s,maxSize:o,accept:a,onRemove:D.handleRemove,onRetry:D.handleRetry,onImageClick:D.handleOpenGallery,onDownload:D.handleDownload,onDragEnd:D.handleDragEnd,onAddClick:()=>D.inputRef.current?.click(),enablePrimarySelection:C,primaryFileId:w,onPrimaryChange:E,disabled:b})}),x&&h.jsx(mu,{isOpen:D.confirmDialogOpen,onClose:()=>{D.isDeleting||D.setConfirmDialogOpen(!1)},title:M??Lt("attachment.delete_confirm_title"),message:S??Lt("attachment.delete_confirm_message"),confirmText:Lt("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{D.itemToDelete&&D.executeRemoveAttachment(D.itemToDelete)},isLoading:D.isDeleting,loadingText:Lt("attachment.deleting")}),O.length>0&&D.galleryOpen&&h.jsx(Zi,{images:O,isOpen:!0,onClose:()=>D.setGalleryOpen(!1),startIndex:D.galleryStartIndex,showDownload:!0},`gallery-${D.galleryKeyRef.current}`)]})})});Vp.displayName="FileUploader";const zE=({name:e,value:t,options:n,onChange:r,disabled:s=!1,inline:o=!1,className:i="",size:a="md",label:l,error:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(()=>t??"");v.useEffect(()=>{g(t??"")},[t]);const m=_=>{const x=_.target.value;g(x),r&&!s&&r(_)},y={sm:{radio:"w-3.5 h-3.5",label:"text-xs",gap:"gap-1.5"},md:{radio:"w-4 h-4",label:"text-sm",gap:"gap-2"},lg:{radio:"w-5 h-5",label:"text-base",gap:"gap-2.5"}}[a],b=o?"flex flex-wrap items-center gap-4":"flex flex-col gap-2";return h.jsxs(I,{className:i,id:d,...u,children:[l&&h.jsx(J,{className:`block mb-2 font-medium text-gray-700 dark:text-gray-300 ${y.label}`,children:l}),h.jsx(I,{className:b,children:n.map(_=>{const x=String(_.value)===String(f),M=s||_.disabled;return h.jsxs(ln,{className:`inline-flex items-center ${y.gap} ${M?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[h.jsx("input",{type:"radio",name:e,value:_.value,checked:x,onChange:m,disabled:M,className:`
|
||
${y.radio}
|
||
text-blue-600
|
||
bg-gray-100 dark:bg-gray-700
|
||
border-gray-300 dark:border-gray-600
|
||
focus:ring-blue-500 dark:focus:ring-blue-600
|
||
focus:ring-2
|
||
dark:ring-offset-gray-800
|
||
${M?"cursor-not-allowed":"cursor-pointer"}
|
||
`}),h.jsx(J,{className:`
|
||
${y.label}
|
||
font-medium
|
||
text-gray-900 dark:text-gray-300
|
||
`,children:_.label})]},_.value)})}),c&&h.jsx(J,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:c})]})},ks=()=>window.G7Core,ra=(e,t)=>ks()?.t?.(e,t)??e,VE=()=>ks()?.locale?.supported?.()??["ko","en"],HE=()=>ks()?.locale?.current?.()??"ko",Hp=e=>{const t=ra(`common.language_${e}`);return t===`common.language_${e}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[e]||e.toUpperCase():t},UE=({content:e="",value:t,onChange:n,multilingual:r=!1,isHtml:s=!1,onIsHtmlChange:o,rows:i=15,placeholder:a="",label:l,showHtmlModeToggle:c=!0,contentClassName:d="",purifyConfig:u,className:f="",name:g="content",htmlFieldName:m="content_mode",readOnly:p=!1,id:y,editorAttrs:b})=>{const _=v.useMemo(()=>VE(),[]),x=v.useMemo(()=>HE(),[]),[M,S]=v.useState(x),[k,N]=v.useState(s),[C,w]=v.useState(e),[E,A]=v.useState(t??{}),[P,L]=v.useState(!1);v.useEffect(()=>{N(s)},[s]),v.useEffect(()=>{r||w(e)},[e,r]),v.useEffect(()=>{r&&t&&A(t)},[t,r]);const $=v.useCallback(G=>{const B=G.target.value;if(w(B),n){const j=ks()?.createChangeEvent?.({value:B,name:g,type:"textarea"})??{target:{name:g,value:B}};n(j)}},[n,g]),D=v.useCallback((G,B)=>{const j={...E,[G]:B};if(A(j),n){const Y=ks()?.createChangeEvent?.({value:j,name:g,type:"multilingual"})??{target:{name:g,value:j}};n(Y)}},[n,g,E]),O=v.useCallback(G=>{const B=G.target.checked;if(N(B),B||L(!1),o){const j=ks()?.createChangeEvent?.({checked:B,name:m,type:"checkbox"})??{target:{name:m,checked:B}};o(j)}},[o,m]),T=v.useCallback(()=>{L(G=>!G)},[]),z=r?E[M]??"":C,U=v.useCallback(G=>!!E[G]?.trim(),[E]),W=()=>h.jsx(I,{className:"flex flex-wrap items-center gap-2 mb-3",children:_.map(G=>{const B=G===x,j=M===G;return h.jsxs(ae,{type:"button",className:`
|
||
inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold transition-all
|
||
${j?B?"bg-blue-500 text-white dark:bg-blue-600 dark:text-white shadow-md scale-105":"bg-gray-500 text-white dark:bg-gray-600 dark:text-white shadow-md scale-105":B?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}
|
||
`,onClick:()=>S(G),children:[h.jsx(oe,{name:"globe",className:"w-3 h-3"}),h.jsx(J,{children:Hp(G)}),B&&h.jsx(J,{className:"text-red-500",children:"*"}),U(G)&&!j&&h.jsx(oe,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"})]},G)})});return h.jsxs(I,{className:`space-y-2 ${f}`,id:y,...b,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[l&&h.jsx(ln,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:l}),h.jsxs(I,{className:"flex items-center gap-3",children:[k&&!p&&h.jsx(ae,{type:"button",onClick:T,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${P?"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:ra(P?"common.preview_off":"common.preview")}),c&&h.jsxs(ln,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[h.jsx(kt,{type:"checkbox",name:m,checked:k,onChange:O,disabled:p,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"}),h.jsx(I,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:ra("common.html_mode")})]})]})]}),r&&W(),!P&&(r?_.map(G=>h.jsx(I,{className:M===G?"block":"hidden",children:h.jsx(sr,{name:`${g}[${G}]`,value:E[G]??"",onChange:B=>D(G,B.target.value),placeholder:`${a} (${Hp(G)})`,rows:i,readOnly:p,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 ${k?"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"}`})},G)):h.jsx(sr,{name:g,value:C,onChange:$,placeholder:a,rows:i,readOnly:p,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 ${k?"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"}`})),P&&h.jsx(I,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:h.jsx(ol,{content:z,isHtml:!0,className:d||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:u})})]})},Up="g7_dismissed_warnings";function Bp(){try{const e=sessionStorage.getItem(Up);return e?JSON.parse(e):[]}catch{return[]}}function BE(e){try{const t=Bp();t.includes(e)||(t.push(e),sessionStorage.setItem(Up,JSON.stringify(t)))}catch{}}function jE(e){switch(e){case"error":return"error";case"warning":return"warning";default:return"info"}}const WE=({warnings:e,className:t=""})=>{const[n,r]=v.useState([]);v.useEffect(()=>{r(Bp())},[]);const s=v.useCallback(i=>{BE(i),r(a=>[...a,i])},[]);if(!e||e.length===0)return null;const o=e.filter(i=>!n.includes(i.id));return o.length===0?null:h.jsx(I,{className:`space-y-2 ${t}`.trim(),children:o.map(i=>h.jsx(ku,{type:jE(i.level),message:i.message,dismissible:!0,onDismiss:()=>s(i.id)},i.id))})},jp=window.G7Core?.createLogger?.("Comp:FilterVisibility")??{log:(...e)=>console.log("[Comp:FilterVisibility]",...e),warn:(...e)=>console.warn("[Comp:FilterVisibility]",...e),error:(...e)=>console.error("[Comp:FilterVisibility]",...e)},GE=({id:e,visibleFilters:t,defaultFilters:n=[],onFilterVisibilityChange:r})=>{const[s,o]=v.useState(!1),i=v.useRef(!0),a=v.useMemo(()=>{try{const f=window.G7Core?.AuthManager?.getInstance();return f?f.getUser()?.uuid:void 0}catch{return}},[]),l=v.useMemo(()=>`g7_filters_${e}${a!==void 0?`_${a}`:""}`,[e,a]),c=v.useCallback(()=>{try{const f=localStorage.getItem(l);if(f){const g=JSON.parse(f);if(Array.isArray(g))return g}}catch(f){jp.warn("Failed to load from localStorage:",f)}return null},[l]),d=v.useCallback(f=>{try{localStorage.setItem(l,JSON.stringify(f))}catch(g){jp.warn("Failed to save to localStorage:",g)}},[l]),u=v.useCallback(()=>{const f=c();return f||(t&&t.length>0?t:n)},[c,t,n]);return v.useEffect(()=>{if(!s){const f=u();r&&f.length>0&&r(f),o(!0)}},[s,r,u]),v.useEffect(()=>{if(s&&t&&t.length>0){if(i.current){i.current=!1;return}d(t)}},[s,t,d]),null},YE=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 XE(e,t){return t&&e&&typeof e.id=="string"&&e.id.length>0?{...e,id:`${e.id}__${t}`}:e}const KE=({slotId:e,className:t="",emptyContent:n,style:r,id:s,children:o})=>{const[i,a]=v.useState([]),[,l]=v.useState({}),c=v.useCallback(()=>{const m=window.__slotContextValue;if(m)return m;const p=window.G7Core;return p&&p.getSlotContext?.()||null},[]),d=v.useCallback(()=>{const m=c();m&&m.isEnabled&&a(m.getSlotComponents(e))},[e,c]);v.useEffect(()=>{const m=c();return!m||!m.isEnabled?void 0:(d(),m.subscribeToSlot(e,()=>{d(),l({})}))},[e,c,d]);const u=v.useCallback(()=>{const m=window.G7Core;return m?m.getDynamicRenderer?.():null},[]);if(i.length===0)return n?h.jsx(I,{className:t,style:r,id:s,children:n}):o?h.jsx(I,{className:t,style:r,id:s,children:o}):null;const f=u(),g=window.G7Core;return!f||!g?(YE.error("G7Core or DynamicRenderer not available"),null):h.jsxs(I,{className:t,style:r,id:s,children:[i.map(m=>{const{componentDef:p,dataContext:y,parentFormContext:b,getParentComponentContext:_,translationContext:x}=m,M=XE(p,s);return h.jsx(f,{componentDef:M,dataContext:y,translationContext:x,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:_?.(),parentFormContextProp:b,isRootRenderer:!1},M.id||`slot-${e}-${m.order}`)}),o]})},Wp=(e,t)=>window.G7Core?.t?.(e,t)??e,Gp=(e,t,n)=>window.G7Core?.renderComponentLayout?.(e,t,n)??null,qE=({options:e=[],value:t,onChange:n,placeholder:r,disabled:s=!1,className:o="",maxHeight:i="320px",children:a,selectedChildren:l,__componentLayoutDefs:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(!1),m=v.useRef(null),p=v.useRef(null),y=v.useMemo(()=>t==null?null:e.find(k=>String(k.value)===String(t))||null,[e,t]);v.useEffect(()=>{const k=N=>{m.current&&!m.current.contains(N.target)&&g(!1)};return f&&document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}},[f]),v.useEffect(()=>{const k=N=>{N.key==="Escape"&&f&&(g(!1),p.current?.focus())};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[f]);const b=v.useCallback(()=>{s||g(k=>!k)},[s]),_=v.useCallback(k=>{n&&n({target:{value:k},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),p.current?.focus()},[n]),x=r??Wp("common.select"),M=()=>{if(!y)return h.jsx(J,{className:"text-gray-400 dark:text-gray-500",children:x});if(c?.selected){const k=Gp(c.selected,{item:y,isSelected:!0},"selected");if(k)return k}return l||h.jsx(J,{className:"truncate",children:y.label})},S=(k,N)=>h.jsxs(I,{className:"flex items-center justify-between w-full",children:[h.jsx(J,{className:N?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-900 dark:text-white",children:k.label}),N&&h.jsx(Xn,{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"})})]});return h.jsxs(I,{ref:m,className:`relative ${o}`,id:d,...u,children:[h.jsxs(ae,{ref:p,type:"button",onClick:b,disabled:s,className:`
|
||
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
|
||
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(I,{className:"flex-1 min-w-0",children:M()}),h.jsx(Xn,{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&&h.jsx(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",role:"listbox",children:h.jsx(I,{className:"overflow-auto",style:{maxHeight:i},children:e.length===0?h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:Wp("common.no_options")}):e.map((k,N)=>{const C=String(k.value)===String(t);return h.jsx(ae,{type:"button",onClick:()=>!k.disabled&&_(k.value),disabled:k.disabled,className:`
|
||
w-full px-4 py-3 text-left text-sm
|
||
hover:bg-gray-100 dark:hover:bg-gray-700
|
||
transition-colors
|
||
${C?"bg-blue-50 dark:bg-blue-900/20":""}
|
||
${k.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}
|
||
`,role:"option","aria-selected":C,"data-item-value":k.value,"data-item-index":N,"data-item-selected":C,children:c?.item?Gp(c.item,{item:k,index:N,isSelected:C},`item-${N}`):a||S(k,C)},k.value)})})})]})};function ZE(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}const QE=({value:e,checked:t=!1,icon:n,label:r,variant:s="blue",customColor:o,className:i="",style:a,onChange:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),g="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium border cursor-pointer transition-all";if(o){const b=ZE(o),_=document.documentElement.classList.contains("dark");let x;return t?x={backgroundColor:o,color:"#ffffff",borderColor:o,opacity:u?.85:1}:x=b?{backgroundColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${u?_?.25:.12:_?.15:.06})`,color:o,borderColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${_?.3:.2})`}:{},h.jsxs(ln,{className:`${g} ${i}`,style:{...x,...a},onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),id:c,...d,children:[h.jsx(kt,{type:"checkbox",value:e,checked:t,onChange:M=>{l?.(M)},className:"hidden"}),n&&h.jsx(oe,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})}const y=t?{green:"bg-green-600 dark:bg-green-600 text-white dark:text-white border-green-700 dark:border-green-500 hover:bg-green-700 dark:hover:bg-green-500",orange:"bg-orange-600 dark:bg-orange-600 text-white dark:text-white border-orange-700 dark:border-orange-500 hover:bg-orange-700 dark:hover:bg-orange-500",yellow:"bg-yellow-600 dark:bg-yellow-600 text-white dark:text-white border-yellow-700 dark:border-yellow-500 hover:bg-yellow-700 dark:hover:bg-yellow-500",gray:"bg-gray-600 dark:bg-gray-500 text-white dark:text-white border-gray-700 dark:border-gray-400 hover:bg-gray-700 dark:hover:bg-gray-400",blue:"bg-blue-600 dark:bg-blue-600 text-white dark:text-white border-blue-700 dark:border-blue-500 hover:bg-blue-700 dark:hover:bg-blue-500"}[s]:{green:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800 hover:bg-green-100 dark:hover:bg-green-900/30",orange:"bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-800 hover:bg-orange-100 dark:hover:bg-orange-900/30",yellow:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 hover:bg-yellow-100 dark:hover:bg-yellow-900/30",gray:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-300 border-gray-200 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-600",blue:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 hover:bg-blue-100 dark:hover:bg-blue-900/30"}[s];return h.jsxs(ln,{className:`${g} ${y} ${i}`,style:a,id:c,...d,children:[h.jsx(kt,{type:"checkbox",value:e,checked:t,onChange:b=>{l?.(b)},className:"hidden"}),n&&h.jsx(oe,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})},JE=({label:e,icon:t,iconPosition:n="left",position:r="right",className:s="",style:o,children:i})=>{const[a,l]=v.useState(!1),[c,d]=v.useState({top:0,left:0}),u=v.useRef(null),f=v.useRef(null),g=v.useCallback(()=>{if(!u.current)return;const p=u.current.getBoundingClientRect(),y=224;let b=r==="right"?p.right-y:p.left;const _=p.bottom+8;b<8&&(b=8),b+y>window.innerWidth-8&&(b=window.innerWidth-y-8),d({top:_,left:b})},[r]);v.useEffect(()=>{a&&g()},[a,g]),v.useEffect(()=>{if(!a)return;const p=()=>{l(!1)};return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[a]),v.useEffect(()=>{const p=y=>{const b=y.target,_=u.current?.contains(b),x=f.current?.contains(b);!_&&!x&&l(!1)};return a&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[a]);const m=a?Ln.createPortal(h.jsx("div",{ref:f,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:c.top,left:c.left},onClick:()=>l(!1),children:i}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,children:[h.jsxs(ae,{ref:u,onClick:()=>l(!a),className:"flex items-center gap-2",children:[n==="left"&&t&&h.jsx(oe,{name:t,className:"w-4 h-4"}),e&&h.jsx(J,{className:"text-sm font-medium",children:e}),n==="right"&&t&&h.jsx(oe,{name:t,className:"w-4 h-4"})]}),m]})},RE=({label:e,icon:t,variant:n="default",disabled:r=!1,divider:s=!1,className:o="",style:i,onClick:a})=>{if(s)return h.jsx(I,{className:"h-px bg-gray-200 dark:bg-gray-700 my-1",style:i});const l=n==="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",c=r?"opacity-50 cursor-not-allowed":"cursor-pointer",d=()=>{!r&&a&&a()};return h.jsxs(I,{onClick:d,className:`flex items-center gap-3 px-4 py-3 transition-colors ${l} ${c} ${o}`,style:i,children:[t&&h.jsx(oe,{name:t,className:"w-4 h-4"}),e&&h.jsx(J,{className:"text-sm font-medium",children:e})]})},eM=()=>window.G7Core,jc=v.createContext(null),Yp=()=>{const e=v.useContext(jc);if(!e){const t=eM(),n=t?.locale?.current?.()||"ko",r=t?.locale?.supported?.()||["ko","en"];return{activeLocale:n,getActiveLocale:()=>t?.locale?.current?.()||"ko",supportedLocales:r,isInsideMultilingualTabPanel:!1}}return{...e,isInsideMultilingualTabPanel:!0}},tM=()=>window.G7Core,nM=({value:e,onChange:t,placeholder:n,readOnly:r,disabled:s,hasError:o})=>{const{activeLocale:i,getActiveLocale:a}=Yp(),l=typeof e=="string"?{[i]:e}:e||{},c=v.useCallback(u=>{const f=a();t({...l,[f]:u.target.value})},[l,a,t]),d=o?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500";return h.jsx(kt,{type:"text",value:l[i]||"",onChange:c,placeholder:n,readOnly:r,disabled:s,className:`w-full px-3 py-2 text-sm border ${d} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2`})},rM=(e,t)=>{if(!t)return!1;const n=t.startsWith("!"),r=n?t.slice(1):t,s=!!e[r];return n?!s:s},sM=({column:e,item:t,index:n,onValueChange:r,readOnly:s,error:o})=>{const i=t[e.key],a=s||e.readOnly||rM(t,e.readOnlyCondition)||e.disabled,l=!!o,c=l?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500",d=v.useCallback(f=>{r(e.key,f)},[e.key,r]),u=f=>h.jsxs(I,{className:"w-full",children:[f,l&&h.jsx(J,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:o})]});switch(e.type){case"input":return u(h.jsx(kt,{type:"text",value:i||"",onChange:f=>d(f.target.value),placeholder:e.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${e.className||""}`}));case"number":return u(h.jsx(kt,{type:"number",value:i??"",onChange:f=>d(f.target.value?Number(f.target.value):null),placeholder:e.placeholder,min:e.min,max:e.max,step:e.step,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${e.className||""}`}));case"select":return u(h.jsxs(Gr,{value:i??"",onChange:f=>d(f.target.value),disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${e.className||""}`,children:[h.jsx("option",{value:"",children:"선택하세요"}),e.options?.map(f=>h.jsx("option",{value:f.value,disabled:f.disabled,children:f.label},f.value))]}));case"textarea":return u(h.jsx(sr,{value:i||"",onChange:f=>d(f.target.value),placeholder:e.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 resize-none ${e.className||""}`,rows:2}));case"multilingual":return u(h.jsx(nM,{value:i,onChange:f=>d(f),placeholder:e.placeholder,readOnly:a,disabled:a,hasError:l}));case"custom":return e.render?h.jsx(h.Fragment,{children:e.render(t,n,d)}):h.jsx(J,{className:"text-gray-500 dark:text-gray-400",children:"-"});default:return h.jsx(J,{className:"text-gray-900 dark:text-white text-sm",children:String(i??"")})}},oM=(e,t,n)=>{if(!e)return;if(n==="multilingual"){const o=tM()?.locale?.current?.()||"ko",i=`${t}.${o}`;return e[i]?.[0]}return e[t]?.[0]},iM=({item:e,index:t,id:n,columns:r,enableDrag:s=!0,showIndex:o=!0,canRemove:i=!0,rowActions:a,readOnly:l=!1,onValueChange:c,onRemove:d,className:u="",level:f=0,errors:g})=>{const{attributes:m,listeners:p,setNodeRef:y,transform:b,transition:_,isDragging:x}=Hi({id:n,disabled:!s||l}),M={transform:Un.Transform.toString(b),transition:_,opacity:x?.5:1},S=v.useCallback((C,w)=>{c?.(C,w)},[c]),k=v.useCallback(C=>{C.onClick?.(e,t)},[e,t]),N=f>0?{paddingLeft:`${f*24}px`}:{};return h.jsxs(I,{ref:y,style:M,className:`flex items-center gap-2 py-2 px-2 border-b border-gray-100 dark:border-gray-700 last:border-b-0 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors ${x?"bg-blue-50 dark:bg-blue-900/20 shadow-lg rounded-lg z-10":""} ${u}`,children:[s&&!l&&h.jsx(I,{...m,...p,className:"flex-shrink-0 w-6 h-6 flex items-center justify-center cursor-grab active:cursor-grabbing text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400",style:N,children:h.jsx(oe,{name:"grip-vertical",className:"w-4 h-4"})}),o&&h.jsx(I,{className:"flex-shrink-0 w-8 text-center text-sm text-gray-500 dark:text-gray-400 font-medium",children:t+1}),r.map(C=>{const w=oM(g,C.key,C.type);return h.jsx(I,{className:`flex-1 min-w-0 ${C.width||""}`,style:C.width?{flex:"none",width:C.width}:{},children:h.jsx(sM,{column:C,item:e,index:t,onValueChange:S,readOnly:l,error:w})},C.key)}),a&&a.length>0&&!l&&h.jsx(I,{className:"flex-shrink-0 flex items-center gap-1",children:a.map(C=>{const w=typeof C.disabled=="function"?C.disabled(e,t):C.disabled;return h.jsx(ae,{type:"button",onClick:()=>k(C),disabled:w,className:`p-1.5 rounded transition-colors ${C.danger?"text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300"} disabled:opacity-50 disabled:cursor-not-allowed`,title:C.label,children:C.icon?h.jsx(oe,{name:C.icon,className:"w-4 h-4"}):h.jsx(J,{className:"text-xs",children:C.label})},C.key)})}),i&&!a&&!l&&h.jsx(I,{className:"flex-shrink-0",children:h.jsx(ae,{type:"button",onClick:d,className:"p-1.5 text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300 rounded transition-colors",title:"삭제",children:h.jsx(oe,{name:"minus",className:"w-4 h-4"})})})]})},Xp=()=>window.G7Core,Wc=()=>`item_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,aM=e=>{const t={_id:Wc()};return e.forEach(n=>{if(n.type==="multilingual"){const s=Xp()?.locale?.all?.()||["ko","en"],o={};s.forEach(i=>{o[i]=""}),t[n.key]=o}else n.type==="number"?t[n.key]=null:(n.type,t[n.key]="")}),t},lM=(e,t)=>{if(!e)return{};const n=`fields.${t}.`,r={};return Object.keys(e).forEach(s=>{if(s.startsWith(n)){const o=s.substring(n.length);r[o]=e[s]}}),r},cM=({items:e=[],columns:t,onChange:n,onAddItem:r,onRemoveItem:s,onReorder:o,addLabel:i="항목 추가",enableDrag:a=!0,showIndex:l=!0,minItems:c=0,maxItems:d,rowActions:u,emptyMessage:f="항목이 없습니다.",className:g="",headerClassName:m="",rowClassName:p="",name:y,readOnly:b=!1,createDefaultItem:_,childrenKey:x,itemIdKey:M="_id",errors:S,id:k,editorAttrs:N})=>{const C=v.useRef(null),w=v.useRef([]),E=v.useRef(null),A=v.useMemo(()=>{let G=!1;for(const B of e)if(B[M]==null){G=!0;break}return G?e.map(B=>B[M]!=null?B:{...B,[M]:Wc()}):e},[e,M]);w.current=A,v.useEffect(()=>{E.current=null},[A]);const P=v.useCallback(G=>String(G[M]??""),[M]);v.useEffect(()=>{if(y){const G=Xp();G?.form&&(C.current=G.form)}},[y]);const L=Zl(ds(oo,{activationConstraint:{distance:8}}),ds(so,{coordinateGetter:Ui})),$=v.useMemo(()=>A.map(G=>P(G)),[A,P]),D=v.useCallback(G=>{const{active:B,over:j}=G;if(j&&B.id!==j.id){const Y=E.current??w.current,V=Y.map(q=>String(q[M]??"")),X=V.indexOf(String(B.id)),K=V.indexOf(String(j.id));if(X!==-1&&K!==-1){const q=fs([...Y],X,K);E.current=q,n?.(q),o?.(q)}}},[n,o,M]),O=v.useCallback((G,B,j)=>{const V=[...E.current??w.current];V[G]={...V[G],[B]:j},E.current=V,n?.(V)},[n]),T=v.useCallback(()=>{const G=E.current??w.current;if(d&&G.length>=d)return;if(r){r();return}const B=_?_():aM(t);B[M]||(B[M]=Wc());const j=[...G,B];E.current=j,n?.(j)},[d,r,_,t,M,n]),z=v.useCallback(G=>{const B=E.current??w.current;if(B.length<=c)return;const j=B[G];if(s){s(G,j);return}const Y=B.filter((V,X)=>X!==G);E.current=Y,n?.(Y)},[c,s,n]),U=A.length>c,W=!d||A.length<d;return h.jsxs(I,{className:`dynamic-field-list ${g}`,id:k,...N,children:[h.jsxs(I,{className:`flex items-center gap-2 py-2 px-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 rounded-t-lg ${m}`,children:[a&&!b&&h.jsx(I,{className:"flex-shrink-0 w-6"}),l&&h.jsx(I,{className:"flex-shrink-0 w-8 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:"#"}),t.map(G=>h.jsxs(I,{className:`flex-1 min-w-0 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase ${G.width||""}`,style:G.width?{flex:"none",width:G.width}:{},children:[G.label,G.required&&h.jsx(J,{className:"text-red-500 dark:text-red-400 ml-0.5",children:"*"})]},G.key)),(u||!b&&U)&&h.jsx(I,{className:"flex-shrink-0 w-8"})]}),A.length>0?h.jsx(ac,{sensors:L,collisionDetection:Ql,onDragEnd:D,children:h.jsx(Vi,{items:$,strategy:lc,children:h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700",children:A.map((G,B)=>{const j=P(G),Y=lM(S,B);return h.jsx(iM,{id:j,item:G,index:B,columns:t,enableDrag:a,showIndex:l,canRemove:U,rowActions:u,readOnly:b,onValueChange:(V,X)=>O(B,V,X),onRemove:()=>z(B),className:p,errors:Y},j)})})})}):h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700 py-8 text-center text-gray-500 dark:text-gray-400 text-sm",children:f}),!b&&W&&h.jsx(I,{className:"relative border border-gray-200 dark:border-gray-700 border-t-0 rounded-b-lg",children:h.jsx(I,{className:"flex items-center justify-center py-2",children:h.jsxs(ae,{type:"button",onClick:T,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[h.jsx(oe,{name:"plus",className:"w-4 h-4"}),h.jsx(J,{children:i})]})})}),(b||!W)&&A.length>0&&h.jsx(I,{className:"border-x border-b border-gray-200 dark:border-gray-700 rounded-b-lg h-1"})]})},Kp=()=>window.G7Core,dM=()=>Kp()?.locale?.supported?.()??["ko","en"],uM=()=>Kp()?.locale?.current?.()??"ko",fM={ko:"한국어",en:"English",ja:"日本語",zh:"中文"},hM=({children:e,className:t="",style:n,variant:r="default",defaultLocale:s,onLocaleChange:o,locales:i})=>{const a=v.useMemo(()=>i&&i.length>0?i:dM(),[i]),[l,c]=v.useState(s||uM());v.useEffect(()=>{if(a.length>0&&!a.includes(l)){const p=a[0];c(p),o?.(p)}},[a,l,o]);const d=v.useRef(l);d.current=l;const u=v.useCallback(()=>d.current,[]),f=v.useCallback(p=>{c(p),o?.(p)},[o]),g=v.useMemo(()=>({activeLocale:l,getActiveLocale:u,supportedLocales:a}),[l,u,a]),m=p=>{const y=p===l,b="px-4 py-2 text-sm font-medium transition-all";return r==="pills"?y?`${b} bg-blue-600 text-white rounded-lg`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`:r==="underline"?y?`${b} text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400`:`${b} text-gray-600 dark:text-gray-400 border-b-2 border-transparent hover:border-gray-300 dark:hover:border-gray-500`:y?`${b} text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 border-b-2 border-blue-600`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 border-b-2 border-transparent`};return h.jsxs(I,{className:t,style:n,children:[h.jsx(Go,{className:"flex gap-1 border-b border-gray-200 dark:border-gray-700 mb-4",children:a.map(p=>h.jsx(ae,{type:"button",onClick:()=>f(p),className:m(p),children:h.jsx(J,{children:fM[p]||p})},p))}),h.jsx(jc.Provider,{value:g,children:e})]})},gM=({label:e,required:t=!1,error:n,helperText:r,className:s="",labelClassName:o="",children:i,horizontal:a=!1,labelWidth:l="w-1/3",id:c,editorAttrs:d})=>{const u=a?`flex items-start gap-4 ${s}`:`space-y-1 ${s}`,f=a?`${l} flex-shrink-0 pt-2`:"",g=a?"flex-1":"";return h.jsxs(I,{className:u,id:c,...d,children:[e&&h.jsx(I,{className:f,children:h.jsxs(ln,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 ${o}`,children:[e,t&&h.jsx("span",{className:"ml-1 text-red-500 dark:text-red-400",children:"*"})]})}),h.jsxs(I,{className:`${g} ${n?"form-field-error":""}`.trim(),children:[i,r&&!n&&h.jsx(I,{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r}),n&&h.jsx(I,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:n})]})]})};function xo(e){return e+.5|0}const hr=(e,t,n)=>Math.max(Math.min(e,n),t);function wo(e){return hr(xo(e*2.55),0,255)}function gr(e){return hr(xo(e*255),0,255)}function qn(e){return hr(xo(e/2.55)/100,0,1)}function qp(e){return hr(xo(e*100),0,100)}const mn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Gc=[..."0123456789ABCDEF"],pM=e=>Gc[e&15],mM=e=>Gc[(e&240)>>4]+Gc[e&15],sa=e=>(e&240)>>4===(e&15),bM=e=>sa(e.r)&&sa(e.g)&&sa(e.b)&&sa(e.a);function yM(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&mn[e[1]]*17,g:255&mn[e[2]]*17,b:255&mn[e[3]]*17,a:t===5?mn[e[4]]*17:255}:(t===7||t===9)&&(n={r:mn[e[1]]<<4|mn[e[2]],g:mn[e[3]]<<4|mn[e[4]],b:mn[e[5]]<<4|mn[e[6]],a:t===9?mn[e[7]]<<4|mn[e[8]]:255})),n}const vM=(e,t)=>e<255?t(e):"";function xM(e){var t=bM(e)?pM:mM;return e?"#"+t(e.r)+t(e.g)+t(e.b)+vM(e.a,t):void 0}const wM=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Zp(e,t,n){const r=t*Math.min(n,1-n),s=(o,i=(o+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[s(0),s(8),s(4)]}function kM(e,t,n){const r=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function CM(e,t,n){const r=Zp(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)r[s]*=1-t-n,r[s]+=t;return r}function SM(e,t,n,r,s){return e===s?(t-n)/r+(t<n?6:0):t===s?(n-e)/r+2:(e-t)/r+4}function Yc(e){const n=e.r/255,r=e.g/255,s=e.b/255,o=Math.max(n,r,s),i=Math.min(n,r,s),a=(o+i)/2;let l,c,d;return o!==i&&(d=o-i,c=a>.5?d/(2-o-i):d/(o+i),l=SM(n,r,s,d,o),l=l*60+.5),[l|0,c||0,a]}function Xc(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(gr)}function Kc(e,t,n){return Xc(Zp,e,t,n)}function _M(e,t,n){return Xc(CM,e,t,n)}function EM(e,t,n){return Xc(kM,e,t,n)}function Qp(e){return(e%360+360)%360}function MM(e){const t=wM.exec(e);let n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?wo(+t[5]):gr(+t[5]));const s=Qp(+t[2]),o=+t[3]/100,i=+t[4]/100;return t[1]==="hwb"?r=_M(s,o,i):t[1]==="hsv"?r=EM(s,o,i):r=Kc(s,o,i),{r:r[0],g:r[1],b:r[2],a:n}}function NM(e,t){var n=Yc(e);n[0]=Qp(n[0]+t),n=Kc(n),e.r=n[0],e.g=n[1],e.b=n[2]}function TM(e){if(!e)return;const t=Yc(e),n=t[0],r=qp(t[1]),s=qp(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${s}%, ${qn(e.a)})`:`hsl(${n}, ${r}%, ${s}%)`}const Jp={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Rp={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function OM(){const e={},t=Object.keys(Rp),n=Object.keys(Jp);let r,s,o,i,a;for(r=0;r<t.length;r++){for(i=a=t[r],s=0;s<n.length;s++)o=n[s],a=a.replace(o,Jp[o]);o=parseInt(Rp[i],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let oa;function AM(e){oa||(oa=OM(),oa.transparent=[0,0,0,0]);const t=oa[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const DM=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function IM(e){const t=DM.exec(e);let n=255,r,s,o;if(t){if(t[7]!==r){const i=+t[7];n=t[8]?wo(i):hr(i*255,0,255)}return r=+t[1],s=+t[3],o=+t[5],r=255&(t[2]?wo(r):hr(r,0,255)),s=255&(t[4]?wo(s):hr(s,0,255)),o=255&(t[6]?wo(o):hr(o,0,255)),{r,g:s,b:o,a:n}}}function LM(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${qn(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const qc=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Cs=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function PM(e,t,n){const r=Cs(qn(e.r)),s=Cs(qn(e.g)),o=Cs(qn(e.b));return{r:gr(qc(r+n*(Cs(qn(t.r))-r))),g:gr(qc(s+n*(Cs(qn(t.g))-s))),b:gr(qc(o+n*(Cs(qn(t.b))-o))),a:e.a+n*(t.a-e.a)}}function ia(e,t,n){if(e){let r=Yc(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=Kc(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function e0(e,t){return e&&Object.assign(t||{},e)}function t0(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=gr(e[3]))):(t=e0(e,{r:0,g:0,b:0,a:1}),t.a=gr(t.a)),t}function $M(e){return e.charAt(0)==="r"?IM(e):MM(e)}class ko{constructor(t){if(t instanceof ko)return t;const n=typeof t;let r;n==="object"?r=t0(t):n==="string"&&(r=yM(t)||AM(t)||$M(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var t=e0(this._rgb);return t&&(t.a=qn(t.a)),t}set rgb(t){this._rgb=t0(t)}rgbString(){return this._valid?LM(this._rgb):void 0}hexString(){return this._valid?xM(this._rgb):void 0}hslString(){return this._valid?TM(this._rgb):void 0}mix(t,n){if(t){const r=this.rgb,s=t.rgb;let o;const i=n===o?.5:n,a=2*i-1,l=r.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,r.r=255&c*r.r+o*s.r+.5,r.g=255&c*r.g+o*s.g+.5,r.b=255&c*r.b+o*s.b+.5,r.a=i*r.a+(1-i)*s.a,this.rgb=r}return this}interpolate(t,n){return t&&(this._rgb=PM(this._rgb,t._rgb,n)),this}clone(){return new ko(this.rgb)}alpha(t){return this._rgb.a=gr(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=xo(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ia(this._rgb,2,t),this}darken(t){return ia(this._rgb,2,-t),this}saturate(t){return ia(this._rgb,1,t),this}desaturate(t){return ia(this._rgb,1,-t),this}rotate(t){return NM(this._rgb,t),this}}function Zn(){}const FM=(()=>{let e=0;return()=>e++})();function lt(e){return e==null}function Mt(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function Ze(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function bn(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function jn(e,t){return bn(e)?e:t}function Qe(e,t){return typeof e>"u"?t:e}const zM=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,n0=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function ht(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function st(e,t,n,r){let s,o,i;if(Mt(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(Ze(e))for(i=Object.keys(e),o=i.length,s=0;s<o;s++)t.call(n,e[i[s]],i[s])}function aa(e,t){let n,r,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,r=e.length;n<r;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function la(e){if(Mt(e))return e.map(la);if(Ze(e)){const t=Object.create(null),n=Object.keys(e),r=n.length;let s=0;for(;s<r;++s)t[n[s]]=la(e[n[s]]);return t}return e}function r0(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function VM(e,t,n,r){if(!r0(e))return;const s=t[e],o=n[e];Ze(s)&&Ze(o)?Co(s,o,r):t[e]=la(o)}function Co(e,t,n){const r=Mt(t)?t:[t],s=r.length;if(!Ze(e))return e;n=n||{};const o=n.merger||VM;let i;for(let a=0;a<s;++a){if(i=r[a],!Ze(i))continue;const l=Object.keys(i);for(let c=0,d=l.length;c<d;++c)o(l[c],e,i,n)}return e}function So(e,t){return Co(e,t,{merger:HM})}function HM(e,t,n){if(!r0(e))return;const r=t[e],s=n[e];Ze(r)&&Ze(s)?So(r,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=la(s))}const s0={"":e=>e,x:e=>e.x,y:e=>e.y};function UM(e){const t=e.split("."),n=[];let r="";for(const s of t)r+=s,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function BM(e){const t=UM(e);return n=>{for(const r of t){if(r==="")break;n=n&&n[r]}return n}}function Ir(e,t){return(s0[t]||(s0[t]=BM(t)))(e)}function Zc(e){return e.charAt(0).toUpperCase()+e.slice(1)}const _o=e=>typeof e<"u",pr=e=>typeof e=="function",o0=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function jM(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const ct=Math.PI,_t=2*ct,ca=Number.POSITIVE_INFINITY,WM=ct/180,Nt=ct/2,Lr=ct/4,i0=ct*2/3,a0=Math.log10,mr=Math.sign;function da(e,t,n){return Math.abs(e-t)<n}function l0(e){const t=Math.round(e);e=da(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(a0(e))),r=e/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function GM(e){const t=[],n=Math.sqrt(e);let r;for(r=1;r<n;r++)e%r===0&&(t.push(r),t.push(e/r));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function YM(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function ua(e){return!YM(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function XM(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function KM(e,t,n){let r,s,o;for(r=0,s=e.length;r<s;r++)o=e[r][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Qn(e){return e*(ct/180)}function qM(e){return e*(180/ct)}function c0(e){if(!bn(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function d0(e,t){const n=t.x-e.x,r=t.y-e.y,s=Math.sqrt(n*n+r*r);let o=Math.atan2(r,n);return o<-.5*ct&&(o+=_t),{angle:o,distance:s}}function ZM(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Wn(e){return(e%_t+_t)%_t}function fa(e,t,n,r){const s=Wn(e),o=Wn(t),i=Wn(n),a=Wn(o-s),l=Wn(i-s),c=Wn(s-o),d=Wn(s-i);return s===o||s===i||r&&o===i||a>l&&c<d}function nn(e,t,n){return Math.max(t,Math.min(n,e))}function QM(e){return nn(e,-32768,32767)}function Pr(e,t,n,r=1e-6){return e>=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function Qc(e,t,n){n=n||(i=>e[i]<t);let r=e.length-1,s=0,o;for(;r-s>1;)o=s+r>>1,n(o)?s=o:r=o;return{lo:s,hi:r}}const Jc=(e,t,n,r)=>Qc(e,n,r?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),JM=(e,t,n)=>Qc(e,n,r=>e[r][t]>=n);function RM(e,t,n){let r=0,s=e.length;for(;r<s&&e[r]<t;)r++;for(;s>r&&e[s-1]>n;)s--;return r>0||s<e.length?e.slice(r,s):e}const u0=["push","pop","shift","splice","unshift"];function eN(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),u0.forEach(n=>{const r="_onData"+Zc(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const i=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),i}})})}function f0(e,t){const n=e._chartjs;if(!n)return;const r=n.listeners,s=r.indexOf(t);s!==-1&&r.splice(s,1),!(r.length>0)&&(u0.forEach(o=>{delete e[o]}),delete e._chartjs)}function h0(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const g0=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function p0(e,t){let n=[],r=!1;return function(...s){n=s,r||(r=!0,g0.call(window,()=>{r=!1,e.apply(t,n)}))}}function tN(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}const Rc=e=>e==="start"?"left":e==="end"?"right":"center",Wt=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,nN=(e,t,n,r)=>e===(r?"left":"right")?n:e==="center"?(t+n)/2:t,ha=e=>e===0||e===1,m0=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*_t/n)),b0=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*_t/n)+1,Eo={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Nt)+1,easeOutSine:e=>Math.sin(e*Nt),easeInOutSine:e=>-.5*(Math.cos(ct*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>ha(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>ha(e)?e:m0(e,.075,.3),easeOutElastic:e=>ha(e)?e:b0(e,.075,.3),easeInOutElastic(e){return ha(e)?e:e<.5?.5*m0(e*2,.1125,.45):.5+.5*b0(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Eo.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Eo.easeInBounce(e*2)*.5:Eo.easeOutBounce(e*2-1)*.5+.5};function y0(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function v0(e){return y0(e)?e:new ko(e)}function ed(e){return y0(e)?e:new ko(e).saturate(.5).darken(.1).hexString()}const rN=["x","y","borderWidth","radius","tension"],sN=["color","borderColor","backgroundColor"];function oN(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:sN},numbers:{type:"number",properties:rN}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function iN(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const x0=new Map;function aN(e,t){t=t||{};const n=e+JSON.stringify(t);let r=x0.get(n);return r||(r=new Intl.NumberFormat(e,t),x0.set(n,r)),r}function td(e,t,n){return aN(t,n).format(e)}const lN={values(e){return Mt(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const r=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=cN(e,n)}const i=a0(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),td(e,r,l)}};function cN(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var w0={formatters:lN};function dN(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:w0.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const $r=Object.create(null),nd=Object.create(null);function Mo(e,t){if(!t)return e;const n=t.split(".");for(let r=0,s=n.length;r<s;++r){const o=n[r];e=e[o]||(e[o]=Object.create(null))}return e}function rd(e,t,n){return typeof t=="string"?Co(Mo(e,t),n):Co(Mo(e,""),t)}class uN{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=r=>r.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(r,s)=>ed(s.backgroundColor),this.hoverBorderColor=(r,s)=>ed(s.borderColor),this.hoverColor=(r,s)=>ed(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return rd(this,t,n)}get(t){return Mo(this,t)}describe(t,n){return rd(nd,t,n)}override(t,n){return rd($r,t,n)}route(t,n,r,s){const o=Mo(this,t),i=Mo(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=i[s];return Ze(l)?Object.assign({},c,l):Qe(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var wt=new uN({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[oN,iN,dN]);function fN(e){return!e||lt(e.size)||lt(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function k0(e,t,n,r,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>r&&(r=o),r}function Fr(e,t,n){const r=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*r)/r+s}function C0(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function S0(e,t,n,r){_0(e,t,n,r,null)}function _0(e,t,n,r,s){let o,i,a,l,c,d,u,f;const g=t.pointStyle,m=t.rotation,p=t.radius;let y=(m||0)*WM;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,r),e.rotate(y),e.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),e.restore();return}if(!(isNaN(p)||p<=0)){switch(e.beginPath(),g){default:s?e.ellipse(n,r,s/2,p,0,0,_t):e.arc(n,r,p,0,_t),e.closePath();break;case"triangle":d=s?s/2:p,e.moveTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=i0,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=i0,e.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),e.closePath();break;case"rectRounded":c=p*.516,l=p-c,i=Math.cos(y+Lr)*l,u=Math.cos(y+Lr)*(s?s/2-c:l),a=Math.sin(y+Lr)*l,f=Math.sin(y+Lr)*(s?s/2-c:l),e.arc(n-u,r-a,c,y-ct,y-Nt),e.arc(n+f,r-i,c,y-Nt,y),e.arc(n+u,r+a,c,y,y+Nt),e.arc(n-f,r+i,c,y+Nt,y+ct),e.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,d=s?s/2:l,e.rect(n-d,r-l,2*d,2*l);break}y+=Lr;case"rectRot":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+f,r-i),e.lineTo(n+u,r+a),e.lineTo(n-f,r+i),e.closePath();break;case"crossRot":y+=Lr;case"cross":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+u,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"star":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+u,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i),y+=Lr,u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),e.moveTo(n-u,r-a),e.lineTo(n+u,r+a),e.moveTo(n+f,r-i),e.lineTo(n-f,r+i);break;case"line":i=s?s/2:Math.cos(y)*p,a=Math.sin(y)*p,e.moveTo(n-i,r-a),e.lineTo(n+i,r+a);break;case"dash":e.moveTo(n,r),e.lineTo(n+Math.cos(y)*(s?s/2:p),r+Math.sin(y)*p);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function E0(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function sd(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function od(e){e.restore()}function hN(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),lt(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function gN(e,t,n,r,s){if(s.strikethrough||s.underline){const o=e.measureText(r),i=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,d=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(i,d),e.lineTo(a,d),e.stroke()}}function pN(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function No(e,t,n,r,s,o={}){const i=Mt(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,hN(e,o),l=0;l<i.length;++l)c=i[l],o.backdrop&&pN(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),lt(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,r,o.maxWidth)),e.fillText(c,n,r,o.maxWidth),gN(e,n,r,c,o),r+=Number(s.lineHeight);e.restore()}function ga(e,t){const{x:n,y:r,w:s,h:o,radius:i}=t;e.arc(n+i.topLeft,r+i.topLeft,i.topLeft,1.5*ct,ct,!0),e.lineTo(n,r+o-i.bottomLeft),e.arc(n+i.bottomLeft,r+o-i.bottomLeft,i.bottomLeft,ct,Nt,!0),e.lineTo(n+s-i.bottomRight,r+o),e.arc(n+s-i.bottomRight,r+o-i.bottomRight,i.bottomRight,Nt,0,!0),e.lineTo(n+s,r+i.topRight),e.arc(n+s-i.topRight,r+i.topRight,i.topRight,0,-Nt,!0),e.lineTo(n+i.topLeft,r)}const mN=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,bN=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function yN(e,t){const n=(""+e).match(mN);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const vN=e=>+e||0;function id(e,t){const n={},r=Ze(t),s=r?Object.keys(t):t,o=Ze(e)?r?i=>Qe(e[i],e[t[i]]):i=>e[i]:()=>e;for(const i of s)n[i]=vN(o(i));return n}function M0(e){return id(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Ss(e){return id(e,["topLeft","topRight","bottomLeft","bottomRight"])}function yn(e){const t=M0(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Gt(e,t){e=e||{},t=t||wt.font;let n=Qe(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let r=Qe(e.style,t.style);r&&!(""+r).match(bN)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const s={family:Qe(e.family,t.family),lineHeight:yN(Qe(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:Qe(e.weight,t.weight),string:""};return s.string=fN(s),s}function pa(e,t,n,r){let s,o,i;for(s=0,o=e.length;s<o;++s)if(i=e[s],i!==void 0&&i!==void 0)return i}function xN(e,t,n){const{min:r,max:s}=e,o=n0(t,(s-r)/2),i=(a,l)=>n&&a===0?0:a+l;return{min:i(r,-Math.abs(o)),max:i(s,o)}}function _s(e,t){return Object.assign(Object.create(e),t)}function ad(e,t=[""],n,r,s=()=>e[0]){const o=n||e;typeof r>"u"&&(r=D0("_fallback",e));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:r,_getTarget:s,override:a=>ad([a,...e],t,o,r)};return new Proxy(i,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return T0(a,l,()=>NN(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return I0(a).includes(l)},ownKeys(a){return I0(a)},set(a,l,c){const d=a._storage||(a._storage=s());return a[l]=d[l]=c,delete a._keys,!0}})}function Es(e,t,n,r){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:N0(e,r),setContext:o=>Es(e,o,n,r),override:o=>Es(e.override(o),t,n,r)};return new Proxy(s,{deleteProperty(o,i){return delete o[i],delete e[i],!0},get(o,i,a){return T0(o,i,()=>kN(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(e,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,i)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,i){return Reflect.has(e,i)},ownKeys(){return Reflect.ownKeys(e)},set(o,i,a){return e[i]=a,delete o[i],!0}})}function N0(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:r,isScriptable:pr(n)?n:()=>n,isIndexable:pr(r)?r:()=>r}}const wN=(e,t)=>e?e+Zc(t):t,ld=(e,t)=>Ze(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function T0(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const r=n();return e[t]=r,r}function kN(e,t,n){const{_proxy:r,_context:s,_subProxy:o,_descriptors:i}=e;let a=r[t];return pr(a)&&i.isScriptable(t)&&(a=CN(t,a,e,n)),Mt(a)&&a.length&&(a=SN(t,a,e,i.isIndexable)),ld(t,a)&&(a=Es(a,s,o&&o[t],i)),a}function CN(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,i||r);return a.delete(e),ld(e,l)&&(l=cd(s._scopes,s,e,l)),l}function SN(e,t,n,r){const{_proxy:s,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&r(e))return t[o.index%t.length];if(Ze(t[0])){const l=t,c=s._scopes.filter(d=>d!==l);t=[];for(const d of l){const u=cd(c,s,e,d);t.push(Es(u,o,i&&i[e],a))}}return t}function O0(e,t,n){return pr(e)?e(t,n):e}const _N=(e,t)=>e===!0?t:typeof e=="string"?Ir(t,e):void 0;function EN(e,t,n,r,s){for(const o of t){const i=_N(n,o);if(i){e.add(i);const a=O0(i._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(i===!1&&typeof r<"u"&&n!==r)return null}return!1}function cd(e,t,n,r){const s=t._rootScopes,o=O0(t._fallback,n,r),i=[...e,...s],a=new Set;a.add(r);let l=A0(a,i,n,o||n,r);return l===null||typeof o<"u"&&o!==n&&(l=A0(a,i,o,l,r),l===null)?!1:ad(Array.from(a),[""],s,o,()=>MN(t,n,r))}function A0(e,t,n,r,s){for(;n;)n=EN(e,t,n,r,s);return n}function MN(e,t,n){const r=e._getTarget();t in r||(r[t]={});const s=r[t];return Mt(s)&&Ze(n)?n:s||{}}function NN(e,t,n,r){let s;for(const o of t)if(s=D0(wN(o,e),n),typeof s<"u")return ld(e,s)?cd(n,r,e,s):s}function D0(e,t){for(const n of t){if(!n)continue;const r=n[e];if(typeof r<"u")return r}}function I0(e){let t=e._keys;return t||(t=e._keys=TN(e._scopes)),t}function TN(e){const t=new Set;for(const n of e)for(const r of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(r);return Array.from(t)}function dd(){return typeof window<"u"&&typeof document<"u"}function ud(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ma(e,t,n){let r;return typeof e=="string"?(r=parseInt(e,10),e.indexOf("%")!==-1&&(r=r/100*t.parentNode[n])):r=e,r}const ba=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function ON(e,t){return ba(e).getPropertyValue(t)}const AN=["top","right","bottom","left"];function zr(e,t,n){const r={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=AN[s];r[o]=parseFloat(e[t+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const DN=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function IN(e,t){const n=e.touches,r=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=r;let i=!1,a,l;if(DN(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=r.clientX-c.left,l=r.clientY-c.top,i=!0}return{x:a,y:l,box:i}}function Vr(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:r}=t,s=ba(n),o=s.boxSizing==="border-box",i=zr(s,"padding"),a=zr(s,"border","width"),{x:l,y:c,box:d}=IN(e,n),u=i.left+(d&&a.left),f=i.top+(d&&a.top);let{width:g,height:m}=t;return o&&(g-=i.width+a.width,m-=i.height+a.height),{x:Math.round((l-u)/g*n.width/r),y:Math.round((c-f)/m*n.height/r)}}function LN(e,t,n){let r,s;if(t===void 0||n===void 0){const o=e&&ud(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const i=o.getBoundingClientRect(),a=ba(o),l=zr(a,"border","width"),c=zr(a,"padding");t=i.width-c.width-l.width,n=i.height-c.height-l.height,r=ma(a.maxWidth,o,"clientWidth"),s=ma(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:r||ca,maxHeight:s||ca}}const br=e=>Math.round(e*10)/10;function PN(e,t,n,r){const s=ba(e),o=zr(s,"margin"),i=ma(s.maxWidth,e,"clientWidth")||ca,a=ma(s.maxHeight,e,"clientHeight")||ca,l=LN(e,t,n);let{width:c,height:d}=l;if(s.boxSizing==="content-box"){const f=zr(s,"border","width"),g=zr(s,"padding");c-=g.width+f.width,d-=g.height+f.height}return c=Math.max(0,c-o.width),d=Math.max(0,r?c/r:d-o.height),c=br(Math.min(c,i,l.maxWidth)),d=br(Math.min(d,a,l.maxHeight)),c&&!d&&(d=br(c/2)),(t!==void 0||n!==void 0)&&r&&l.height&&d>l.height&&(d=l.height,c=br(Math.floor(d*r))),{width:c,height:d}}function L0(e,t,n){const r=t||1,s=br(e.height*r),o=br(e.width*r);e.height=br(e.height),e.width=br(e.width);const i=e.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${e.height}px`,i.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||i.height!==s||i.width!==o?(e.currentDevicePixelRatio=r,i.height=s,i.width=o,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}const $N=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};dd()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function P0(e,t){const n=ON(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}const FN=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},zN=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Ms(e,t,n){return e?FN(t,n):zN()}function $0(e,t){let n,r;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=r)}function F0(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function ya(e,t,n){return e.options.clip?e[n]:t[n]}function VN(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:ya(n,t,"left"),right:ya(n,t,"right"),top:ya(r,t,"top"),bottom:ya(r,t,"bottom")}:t}function HN(e,t){const n=t._clip;if(n.disabled)return!1;const r=VN(t,e.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:r.bottom+(n.bottom===!0?0:n.bottom)}}class UN{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=g0.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 Jn=new UN;const z0="transparent",BN={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=v0(e||z0),s=r.valid&&v0(t||z0);return s&&s.valid?s.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class jN{constructor(t,n,r,s){const o=n[r];s=pa([t.to,s,o,t.from]);const i=pa([t.from,o,s]);this._active=!0,this._fn=t.fn||BN[t.type||typeof i],this._easing=Eo[t.easing]||Eo.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=pa([t.to,n,s,t.from]),this._from=pa([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||n<r),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}l=n/r%2,l=i&&l>1?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<r.length;s++)r[s][n]()}}class V0{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!Ze(t))return;const n=Object.keys(wt.animation),r=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!Ze(o))return;const i={};for(const a of n)i[a]=o[a];(Mt(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(t,n){const r=n.options,s=GN(t,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&WN(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 jN(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 Jn.add(this._chart,r),!0}}function WN(e,t){const n=[],r=Object.keys(t);for(let s=0;s<r.length;s++){const o=e[r[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function GN(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function H0(e,t){const n=e&&e.options||{},r=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:r?o:s,end:r?s:o}}function YN(e,t,n){if(n===!1)return!1;const r=H0(e,n),s=H0(t,n);return{top:s.end,right:r.end,bottom:s.start,left:r.start}}function XN(e){let t,n,r,s;return Ze(e)?(t=e.top,n=e.right,r=e.bottom,s=e.left):t=n=r=s=e,{top:t,right:n,bottom:r,left:s,disabled:e===!1}}function U0(e,t){const n=[],r=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=r.length;s<o;++s)n.push(r[s].index);return n}function B0(e,t,n,r={}){const s=e.keys,o=r.mode==="single";let i,a,l,c;if(t===null)return;let d=!1;for(i=0,a=s.length;i<a;++i){if(l=+s[i],l===n){if(d=!0,r.all)continue;break}c=e.values[l],bn(c)&&(o||t===0||mr(t)===mr(c))&&(t+=c)}return!d&&!r.all?0:t}function KN(e,t){const{iScale:n,vScale:r}=t,s=n.axis==="x"?"x":"y",o=r.axis==="x"?"x":"y",i=Object.keys(e),a=new Array(i.length);let l,c,d;for(l=0,c=i.length;l<c;++l)d=i[l],a[l]={[s]:d,[o]:e[d]};return a}function fd(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function qN(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function ZN(e){const{min:t,max:n,minDefined:r,maxDefined:s}=e.getUserBounds();return{min:r?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function QN(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function j0(e,t,n,r){for(const s of t.getMatchingVisibleMetas(r).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function W0(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=qN(o,i,r),u=t.length;let f;for(let g=0;g<u;++g){const m=t[g],{[l]:p,[c]:y}=m,b=m._stacks||(m._stacks={});f=b[c]=QN(s,d,p),f[a]=y,f._top=j0(f,i,!0,r.type),f._bottom=j0(f,i,!1,r.type);const _=f._visualValues||(f._visualValues={});_[a]=y}}function hd(e,t){const n=e.scales;return Object.keys(n).filter(r=>n[r].axis===t).shift()}function JN(e,t){return _s(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function RN(e,t,n){return _s(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function To(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 gd=e=>e==="reset"||e==="none",G0=(e,t)=>t?e:Object.assign({},e),eT=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:U0(n,!0),values:null};class Ns{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=fd(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&&To(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=Qe(r.xAxisID,hd(t,"x")),i=n.yAxisID=Qe(r.yAxisID,hd(t,"y")),a=n.rAxisID=Qe(r.rAxisID,hd(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&&f0(this._data,this),t._stacked&&To(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(Ze(n)){const s=this._cachedMeta;this._data=KN(n,s)}else if(r!==n){if(r){f0(r,this);const s=this._cachedMeta;To(s),s._parsed=[]}n&&Object.isExtensible(n)&&eN(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=fd(n.vScale,n),n.stack!==r.stack&&(s=!0,To(n),n.stack=r.stack),this._resyncElements(t),(s||o!==n._stacked)&&(W0(this,n._parsed),n._stacked=fd(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{Mt(s[t])?f=this.parseArrayData(r,s,t,n):Ze(s[t])?f=this.parseObjectData(r,s,t,n):f=this.parsePrimitiveData(r,s,t,n);const g=()=>u[a]===null||c&&u[a]<c[a];for(d=0;d<n;++d)r._parsed[d+t]=u=f[d],l&&(g()&&(l=!1),c=u);r._sorted=l}i&&W0(this,f)}parsePrimitiveData(t,n,r,s){const{iScale:o,vScale:i}=t,a=o.axis,l=i.axis,c=o.getLabels(),d=o===i,u=new Array(s);let f,g,m;for(f=0,g=s;f<g;++f)m=f+r,u[f]={[a]:d||o.parse(c[m],m),[l]:i.parse(n[m],m)};return u}parseArrayData(t,n,r,s){const{xScale:o,yScale:i}=t,a=new Array(s);let l,c,d,u;for(l=0,c=s;l<c;++l)d=l+r,u=n[d],a[l]={x:o.parse(u[0],d),y:i.parse(u[1],d)};return a}parseObjectData(t,n,r,s){const{xScale:o,yScale:i}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let d,u,f,g;for(d=0,u=s;d<u;++d)f=d+r,g=n[f],c[d]={x:o.parse(Ir(g,a),f),y:i.parse(Ir(g,l),f)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,r){const s=this.chart,o=this._cachedMeta,i=n[t.axis],a={keys:U0(s,!0),values:n._stacks[t.axis]._visualValues};return B0(a,i,o.index,{mode:r})}updateRangeFromParsed(t,n,r,s){const o=r[n.axis];let i=o===null?NaN:o;const a=s&&r._stacks[n.axis];s&&a&&(s.values=a,i=B0(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,i),t.max=Math.max(t.max,i)}getMinMax(t,n){const r=this._cachedMeta,s=r._parsed,o=r._sorted&&t===r.iScale,i=s.length,a=this._getOtherScale(t),l=eT(n,r,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:u}=ZN(a);let f,g;function m(){g=s[f];const p=g[a.axis];return!bn(g[t.axis])||d>p||u<p}for(f=0;f<i&&!(!m()&&(this.updateRangeFromParsed(c,t,g,l),o));++f);if(o){for(f=i-1;f>=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<o;++s)i=n[s][t.axis],bn(i)&&r.push(i);return r}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,r=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:r?""+r.getLabelForValue(o[r.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=XN(Qe(this.options.clip,YN(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,r=this._cachedMeta,s=r.data||[],o=n.chartArea,i=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let d;for(r.dataset&&r.dataset.draw(t,o,a,l),d=a;d<a+l;++d){const u=s[d];u.hidden||(u.active&&c?i.push(u):u.draw(t,o))}for(d=0;d<i.length;++d)i[d].draw(t,o)}getStyle(t,n){const r=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(t||0,r)}getContext(t,n,r){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const i=this._cachedMeta.data[t];o=i.$context||(i.$context=RN(this.getContext(),t,i)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=JN(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=r,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",r){const s=n==="active",o=this._cachedDataOpts,i=t+"-"+n,a=o[i],l=this.enableOptionSharing&&_o(r);if(a)return G0(a,l);const c=this.chart.config,d=c.datasetElementScopeKeys(this._type,t),u=s?[`${t}Hover`,"hover",t,""]:[t,""],f=c.getOptionScopes(this.getDataset(),d),g=Object.keys(wt.elements[t]),m=()=>this.getContext(r,s,n),p=c.resolveNamedOptions(f,g,m,u);return p.$shared&&(p.$shared=l,o[i]=Object.freeze(G0(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 V0(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||gd(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){gd(s)?Object.assign(t,r):this._resolveAnimations(n,s).update(t,r)}updateSharedOptions(t,n,r){t&&!gd(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<s&&this._removeElements(o,s-o)}_insertElements(t,n,r=!0){const s=this._cachedMeta,o=s.data,i=t+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=i;a--)c[a]=c[a-n]};for(l(o),a=t;a<i;++a)o[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,n),r&&this.updateElements(o,t,n,"reset")}updateElements(t,n,r,s){}_removeElements(t,n){const r=this._cachedMeta;if(this._parsing){const s=r._parsed.splice(t,n);r._stacked&&To(r,s)}r.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,r,s]=t;this[n](r,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",t,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}Pe(Ns,"defaults",{}),Pe(Ns,"datasetElementType",null),Pe(Ns,"dataElementType",null);function tT(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let r=[];for(let s=0,o=n.length;s<o;s++)r=r.concat(n[s].controller.getAllParsedValues(e));e._cache.$bar=h0(r.sort((s,o)=>s-o))}return e._cache.$bar}function nT(e){const t=e.iScale,n=tT(t,e.type);let r=t._length,s,o,i,a;const l=()=>{i===32767||i===-32768||(_o(a)&&(r=Math.min(r,Math.abs(i-a)||r)),a=i)};for(s=0,o=n.length;s<o;++s)i=t.getPixelForValue(n[s]),l();for(a=void 0,s=0,o=t.ticks.length;s<o;++s)i=t.getPixelForTick(s),l();return r}function rT(e,t,n,r){const s=n.barThickness;let o,i;return lt(s)?(o=t.min*n.categoryPercentage,i=n.barPercentage):(o=s*r,i=1),{chunk:o/r,ratio:i,start:t.pixels[e]-o/2}}function sT(e,t,n,r){const s=t.pixels,o=s[e];let i=e>0?s[e-1]:null,a=e<s.length-1?s[e+1]:null;const l=n.categoryPercentage;i===null&&(i=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-i);const c=o-(o-Math.min(i,a))/2*l;return{chunk:Math.abs(a-i)/2*l/r,ratio:n.barPercentage,start:c}}function oT(e,t,n,r){const s=n.parse(e[0],r),o=n.parse(e[1],r),i=Math.min(s,o),a=Math.max(s,o);let l=i,c=a;Math.abs(i)>Math.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 Y0(e,t,n,r){return Mt(e)?oT(e,t,n,r):t[n.axis]=n.parse(e,r),t}function X0(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<d;++c)f=t[c],u={},u[s.axis]=a||s.parse(i[c],c),l.push(Y0(f,u,o,c));return l}function pd(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function iT(e,t,n){return e!==0?mr(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function aT(e){let t,n,r,s,o;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.base<e.y,n="bottom",r="top"),t?(s="end",o="start"):(s="start",o="end"),{start:n,end:r,reverse:t,top:s,bottom:o}}function lT(e,t,n,r){let s=t.borderSkipped;const o={};if(!s){e.borderSkipped=o;return}if(s===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:i,end:a,reverse:l,top:c,bottom:d}=aT(e);s==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?s=c:(n._bottom||0)===r?s=d:(o[K0(d,i,a,l)]=!0,s=c)),o[K0(s,i,a,l)]=!0,e.borderSkipped=o}function K0(e,t,n,r){return r?(e=cT(e,t,n),e=q0(e,n,t)):e=q0(e,t,n),e}function cT(e,t,n){return e===t?n:e===n?t:e}function q0(e,t,n){return e==="start"?t:e==="end"?n:e}function dT(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class va extends Ns{parsePrimitiveData(t,n,r,s){return X0(t,n,r,s)}parseArrayData(t,n,r,s){return X0(t,n,r,s)}parseObjectData(t,n,r,s){const{iScale:o,vScale:i}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?a:l,d=i.axis==="x"?a:l,u=[];let f,g,m,p;for(f=r,g=r+s;f<g;++f)p=n[f],m={},m[o.axis]=o.parse(Ir(p,c),f),u.push(Y0(Ir(p,d),m,i,f));return u}updateRangeFromParsed(t,n,r,s){super.updateRangeFromParsed(t,n,r,s);const o=r._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:r,vScale:s}=n,o=this.getParsed(t),i=o._custom,a=pd(i)?"["+i.start+", "+i.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+r.getLabelForValue(o[r.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,r,s){const o=s==="reset",{index:i,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),d=this._getRuler(),{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,s);for(let g=n;g<n+r;g++){const m=this.getParsed(g),p=o||lt(m[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(g),y=this._calculateBarIndexPixels(g,d),b=(m._stacks||{})[a.axis],_={horizontal:c,base:p.base,enableBorderRadius:!b||pd(m._custom)||i===b._top||i===b._bottom,x:c?p.head:y.center,y:c?y.center:p.head,height:c?y.size:Math.abs(p.size),width:c?Math.abs(p.size):y.size};f&&(_.options=u||this.resolveDataElementOptions(g,t[g].active?"active":s));const x=_.options||t[g].options;lT(_,x,b,i),dT(_,x,d.ratio),this.updateElement(t[g],g,_,s)}}_getStacks(t,n){const{iScale:r}=this._cachedMeta,s=r.getMatchingVisibleMetas(this._type).filter(d=>d.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(lt(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[Qe(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;o<i;++o)s.push(r.getPixelForValue(this.getParsed(o)[r.axis],o));const a=t.barThickness;return{min:a||nT(n),pixels:s,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:r,index:s},options:{base:o,minBarLength:i}}=this,a=o||0,l=this.getParsed(t),c=l._custom,d=pd(c);let u=l[n.axis],f=0,g=r?this.applyStack(n,l,r):u,m,p;g!==u&&(f=g-u,g=u),d&&(u=c.barStart,g=c.barEnd-c.barStart,u!==0&&mr(u)!==mr(c.barEnd)&&(f=0),f+=u);const y=!lt(o)&&!d?o:f;let b=n.getPixelForValue(y);if(this.chart.getDataVisibility(t)?m=n.getPixelForValue(f+g):m=b,p=m-b,Math.abs(p)<i){p=iT(p,n,a)*i,u===a&&(b-=p/2);const _=n.getPixelForDecimal(0),x=n.getPixelForDecimal(1),M=Math.min(_,x),S=Math.max(_,x);b=Math.max(Math.min(b,S),M),m=b+p,r&&!d&&(l._stacks[n.axis]._visualValues[s]=n.getValueForPixel(m)-n.getValueForPixel(b))}if(b===n.getPixelForValue(a)){const _=mr(p)*n.getLineWidthForValue(a)/2;b+=_,p-=_}return{size:p,base:b,head:m,center:m+p/2}}_calculateBarIndexPixels(t,n){const r=n.scale,s=this.options,o=s.skipNull,i=Qe(s.maxBarThickness,1/0);let a,l;const c=this._getAxisCount();if(n.grouped){const d=o?this._getStackCount(t):n.stackCount,u=s.barThickness==="flex"?sT(t,n,s,d*c):rT(t,n,s,d*c),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,g=this._getAxis().indexOf(Qe(f,this.getFirstScaleIdForIndexAxis())),m=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+g;a=u.start+u.chunk*m+u.chunk/2,l=Math.min(i,u.chunk*u.ratio)}else a=r.getPixelForValue(this.getParsed(t)[r.axis],t),l=Math.min(i,n.min*n.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,n=t.vScale,r=t.data,s=r.length;let o=0;for(;o<s;++o)this.getParsed(o)[n.axis]!==null&&!r[o].hidden&&r[o].draw(this._ctx)}}Pe(va,"id","bar"),Pe(va,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),Pe(va,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function uT(e,t,n){let r=1,s=1,o=0,i=0;if(t<_t){const a=e,l=a+t,c=Math.cos(a),d=Math.sin(a),u=Math.cos(l),f=Math.sin(l),g=(x,M,S)=>fa(x,a,l,!0)?1:Math.max(M,M*n,S,S*n),m=(x,M,S)=>fa(x,a,l,!0)?-1:Math.min(M,M*n,S,S*n),p=g(0,c,u),y=g(Nt,d,f),b=m(ct,c,u),_=m(ct+Nt,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 Oo extends Ns{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(Ze(r[t])){const{key:l="value"}=this._parsing;o=c=>+Ir(r[c],l)}let i,a;for(i=t,a=t+n;i<a;++i)s._parsed[i]=o(i)}}_getRotation(){return Qn(this.options.rotation-90)}_getCircumference(){return Qn(this.options.circumference)}_getRotationExtents(){let t=_t,n=-_t;for(let r=0;r<this.chart.data.datasets.length;++r)if(this.chart.isDatasetVisible(r)&&this.chart.getDatasetMeta(r).type===this._type){const s=this.chart.getDatasetMeta(r).controller,o=s._getRotation(),i=s._getCircumference();t=Math.min(t,o),n=Math.max(n,o+i)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:r}=n,s=this._cachedMeta,o=s.data,i=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(r.width,r.height)-i)/2,0),l=Math.min(zM(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:g,offsetX:m,offsetY:p}=uT(u,d,l),y=(r.width-i)/f,b=(r.height-i)/g,_=Math.max(Math.min(y,b)/2,0),x=n0(this.options.radius,_),M=Math.max(x*l,0),S=(x-M)/this._getVisibleDatasetWeightTotal();this.offsetX=m*x,this.offsetY=p*x,s.total=this.calculateTotal(),this.outerRadius=x-S*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-S*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const r=this.options,s=this._cachedMeta,o=this._getCircumference();return n&&r.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/_t)}updateElements(t,n,r,s){const o=s==="reset",i=this.chart,a=i.chartArea,c=i.options.animation,d=(a.left+a.right)/2,u=(a.top+a.bottom)/2,f=o&&c.animateScale,g=f?0:this.innerRadius,m=f?0:this.outerRadius,{sharedOptions:p,includeOptions:y}=this._getSharedOptions(n,s);let b=this._getRotation(),_;for(_=0;_<n;++_)b+=this._circumference(_,o);for(_=n;_<n+r;++_){const x=this._circumference(_,o),M=t[_],S={x:d+this.offsetX,y:u+this.offsetY,startAngle:b,endAngle:b+x,circumference:x,outerRadius:m,innerRadius:g};y&&(S.options=p||this.resolveDataElementOptions(_,M.active?"active":s)),b+=x,this.updateElement(M,_,S,s)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let r=0,s;for(s=0;s<n.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!n[s].hidden&&(r+=Math.abs(o))}return r}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?_t*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=td(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;s<o;++s)if(r.isDatasetVisible(s)){i=r.getDatasetMeta(s),t=i.data,a=i.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=a.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let r=0,s=t.length;r<s;++r){const o=this.resolveDataElementOptions(r);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let r=0;r<t;++r)this.chart.isDatasetVisible(r)&&(n+=this._getRingWeight(r));return n}_getRingWeight(t){return Math.max(Qe(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}Pe(Oo,"id","doughnut"),Pe(Oo,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),Pe(Oo,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),Pe(Oo,"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 Hr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class md{constructor(t){Pe(this,"options");this.options=t||{}}static override(t){Object.assign(md.prototype,t)}init(){}formats(){return Hr()}parse(){return Hr()}format(){return Hr()}add(){return Hr()}diff(){return Hr()}startOf(){return Hr()}endOf(){return Hr()}}var fT={_date:md};function hT(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?JM:Jc;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=>!lt(p[u.axis]));d.lo-=Math.max(0,g);const m=f.slice(d.hi).findIndex(p=>!lt(p[u.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:o.length-1}}function xa(e,t,n,r,s){const o=e.getSortedVisibleDatasetMetas(),i=n[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:d}=o[a],{lo:u,hi:f}=hT(o[a],t,i,s);for(let g=u;g<=f;++g){const m=d[g];m.skip||r(m,c,g)}}}function gT(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(r,s){const o=t?Math.abs(r.x-s.x):0,i=n?Math.abs(r.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(i,2))}}function bd(e,t,n,r,s){const o=[];return!s&&!e.isPointInArea(t)||xa(e,n,t,function(a,l,c){!s&&!E0(a,e.chartArea,0)||a.inRange(t.x,t.y,r)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function pT(e,t,n,r){let s=[];function o(i,a,l){const{startAngle:c,endAngle:d}=i.getProps(["startAngle","endAngle"],r),{angle:u}=d0(i,{x:t.x,y:t.y});fa(u,c,d)&&s.push({element:i,datasetIndex:a,index:l})}return xa(e,n,t,o),s}function mT(e,t,n,r,s,o){let i=[];const a=gT(n);let l=Number.POSITIVE_INFINITY;function c(d,u,f){const g=d.inRange(t.x,t.y,s);if(r&&!g)return;const m=d.getCenterPoint(s);if(!(!!o||e.isPointInArea(m))&&!g)return;const y=a(t,m);y<l?(i=[{element:d,datasetIndex:u,index:f}],l=y):y===l&&i.push({element:d,datasetIndex:u,index:f})}return xa(e,n,t,c),i}function yd(e,t,n,r,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!r?pT(e,t,n,s):mT(e,t,n,r,s,o)}function Z0(e,t,n,r,s){const o=[],i=n==="x"?"inXRange":"inYRange";let a=!1;return xa(e,n,t,(l,c,d)=>{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 bT={modes:{index(e,t,n,r){const s=Vr(t,e),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?bd(e,s,o,r,i):yd(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=Vr(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?bd(e,s,o,r,i):yd(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;d<c.length;++d)a.push({element:c[d],datasetIndex:l,index:d})}return a},point(e,t,n,r){const s=Vr(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;return bd(e,s,o,r,i)},nearest(e,t,n,r){const s=Vr(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;return yd(e,s,o,n.intersect,r,i)},x(e,t,n,r){const s=Vr(t,e);return Z0(e,s,"x",n.intersect,r)},y(e,t,n,r){const s=Vr(t,e);return Z0(e,s,"y",n.intersect,r)}}};const Q0=["left","top","right","bottom"];function Ao(e,t){return e.filter(n=>n.pos===t)}function J0(e,t){return e.filter(n=>Q0.indexOf(n.pos)===-1&&n.box.axis===t)}function Do(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 yT(e){const t=[];let n,r,s,o,i,a;for(n=0,r=(e||[]).length;n<r;++n)s=e[n],{position:o,options:{stack:i,stackWeight:a=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:i&&o+i,stackWeight:a});return t}function vT(e){const t={};for(const n of e){const{stack:r,pos:s,stackWeight:o}=n;if(!r||!Q0.includes(s))continue;const i=t[r]||(t[r]={count:0,placed:0,weight:0,size:0});i.count++,i.weight+=o}return t}function xT(e,t){const n=vT(e),{vBoxMaxWidth:r,hBoxMaxHeight:s}=t;let o,i,a;for(o=0,i=e.length;o<i;++o){a=e[o];const{fullSize:l}=a.box,c=n[a.stack],d=c&&a.stackWeight/c.weight;a.horizontal?(a.width=d?d*r:l&&t.availableWidth,a.height=s):(a.width=r,a.height=d?d*s:l&&t.availableHeight)}return n}function wT(e){const t=yT(e),n=Do(t.filter(c=>c.box.fullSize),!0),r=Do(Ao(t,"left"),!0),s=Do(Ao(t,"right")),o=Do(Ao(t,"top"),!0),i=Do(Ao(t,"bottom")),a=J0(t,"x"),l=J0(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(l).concat(i).concat(a),chartArea:Ao(t,"chartArea"),vertical:r.concat(s).concat(l),horizontal:o.concat(i).concat(a)}}function R0(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 kT(e,t,n,r){const{pos:s,box:o}=n,i=e.maxPadding;if(!Ze(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-R0(i,e,"left","right")),l=Math.max(0,t.outerHeight-R0(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 CT(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 ST(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 Io(e,t,n,r){const s=[];let o,i,a,l,c,d;for(o=0,i=e.length,c=0;o<i;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,ST(a.horizontal,t));const{same:u,other:f}=kT(t,n,a,r);c|=u&&s.length,d=d||f,l.fullSize||s.push(a)}return c&&Io(s,t,n,r)||d}function wa(e,t,n,r,s){e.top=n,e.left=t,e.right=t+r,e.bottom=n+s,e.width=r,e.height=s}function tm(e,t,n,r){const s=n.padding;let{x:o,y:i}=t;for(const a of e){const l=a.box,c=r[a.stack]||{placed:0,weight:1},d=a.stackWeight/c.weight||1;if(a.horizontal){const u=t.w*d,f=c.size||l.height;_o(c.start)&&(i=c.start),l.fullSize?wa(l,s.left,i,n.outerWidth-s.right-s.left,f):wa(l,t.left+c.placed,i,u,f),c.start=i,c.placed+=u,i=l.bottom}else{const u=t.h*d,f=c.size||l.width;_o(c.start)&&(o=c.start),l.fullSize?wa(l,o,s.top,f,n.outerHeight-s.bottom-s.top):wa(l,o,t.top+c.placed,f,u),c.start=o,c.placed+=u,o=l.right}}t.x=o,t.y=i}var vn={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;const s=yn(e.options.layout.padding),o=Math.max(t-s.width,0),i=Math.max(n-s.height,0),a=wT(e.boxes),l=a.vertical,c=a.horizontal;st(e.boxes,p=>{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,yn(r));const g=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),m=xT(l.concat(c),u);Io(a.fullSize,g,u,m),Io(l,g,u,m),Io(c,g,u,m)&&Io(l,g,u,m),CT(g),tm(a.leftAndTop,g,u,m),g.x+=g.w,g.y+=g.h,tm(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},st(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 _T extends nm{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ka="$chartjs",ET={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},rm=e=>e===null||e==="";function MT(e,t){const n=e.style,r=e.getAttribute("height"),s=e.getAttribute("width");if(e[ka]={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",rm(s)){const o=P0(e,"width");o!==void 0&&(e.width=o)}if(rm(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=P0(e,"height");o!==void 0&&(e.height=o)}return e}const sm=$N?{passive:!0}:!1;function NT(e,t,n){e&&e.addEventListener(t,n,sm)}function TT(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,sm)}function OT(e,t){const n=ET[e.type]||e.type,{x:r,y:s}=Vr(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:s!==void 0?s:null}}function Ca(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function AT(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Ca(a.addedNodes,r),i=i&&!Ca(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function DT(e,t,n){const r=e.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||Ca(a.removedNodes,r),i=i&&!Ca(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Lo=new Map;let om=0;function im(){const e=window.devicePixelRatio;e!==om&&(om=e,Lo.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function IT(e,t){Lo.size||window.addEventListener("resize",im),Lo.set(e,t)}function LT(e){Lo.delete(e),Lo.size||window.removeEventListener("resize",im)}function PT(e,t,n){const r=e.canvas,s=r&&ud(r);if(!s)return;const o=p0((a,l)=>{const c=s.clientWidth;n(a,l),c<s.clientWidth&&n()},window),i=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return i.observe(s),IT(e,o),i}function vd(e,t,n){n&&n.disconnect(),t==="resize"&<(e)}function $T(e,t,n){const r=e.canvas,s=p0(o=>{e.ctx!==null&&n(OT(o,e))},e);return NT(r,t,s),s}class FT extends nm{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(MT(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[ka])return!1;const r=n[ka].initial;["height","width"].forEach(o=>{const i=r[o];lt(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[ka],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),i={attach:AT,detach:DT,resize:PT}[n]||$T;s[n]=i(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),s=r[n];if(!s)return;({attach:vd,detach:vd,resize:vd}[n]||TT)(t,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,s){return PN(t,n,r,s)}isAttached(t){const n=t&&ud(t);return!!(n&&n.isConnected)}}function zT(e){return!dd()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?_T:FT}let Ur=(za=class{constructor(){Pe(this,"x");Pe(this,"y");Pe(this,"active",!1);Pe(this,"options");Pe(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return ua(this.x)&&ua(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}},Pe(za,"defaults",{}),Pe(za,"defaultRoutes"),za);function VT(e,t){const n=e.options.ticks,r=HT(e),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?BT(t):[],i=o.length,a=o[0],l=o[i-1],c=[];if(i>s)return jT(t,c,o,i/s),c;const d=UT(o,t,s);if(i>0){let u,f;const g=i>1?Math.round((l-a)/(i-1)):null;for(Sa(t,c,d,lt(g)?0:a-g,a),u=0,f=i-1;u<f;u++)Sa(t,c,d,o[u],o[u+1]);return Sa(t,c,d,l,lt(g)?t.length:l+g),c}return Sa(t,c,d),c}function HT(e){const t=e.options.offset,n=e._tickSize(),r=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(r,s))}function UT(e,t,n){const r=WT(e),s=t.length/n;if(!r)return Math.max(s,1);const o=GM(r);for(let i=0,a=o.length-1;i<a;i++){const l=o[i];if(l>s)return l}return Math.max(s,1)}function BT(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function jT(e,t,n,r){let s=0,o=n[0],i;for(r=Math.ceil(r),i=0;i<e.length;i++)i===o&&(t.push(e[i]),s++,o=n[s*r])}function Sa(e,t,n,r,s){const o=Qe(r,0),i=Math.min(Qe(s,e.length),e.length);let a=0,l,c,d;for(n=Math.ceil(n),s&&(l=s-r,n=l/Math.floor(l/n)),d=o;d<0;)a++,d=Math.round(o+a*n);for(c=Math.max(o,0);c<i;c++)c===d&&(t.push(e[c]),a++,d=Math.round(o+a*n))}function WT(e){const t=e.length;let n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}const GT=e=>e==="left"?"right":e==="right"?"left":e,am=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,lm=(e,t)=>Math.min(t||e,e);function cm(e,t){const n=[],r=e.length/t,s=e.length;let o=0;for(;o<s;o+=r)n.push(e[Math.floor(o)]);return n}function YT(e,t,n){const r=e.ticks.length,s=Math.min(t,r-1),o=e._startPixel,i=e._endPixel,a=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(r===1?c=Math.max(l-o,i-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-a||l>i+a)))return l}function XT(e,t){st(e,n=>{const r=n.gc,s=r.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[r[o]];r.splice(0,s)}})}function Po(e){return e.drawTicks?e.tickLength:0}function dm(e,t){if(!e.display)return 0;const n=Gt(e.font,t),r=yn(e.padding);return(Mt(e.text)?e.text.length:1)*n.lineHeight+r.height}function KT(e,t){return _s(e,{scale:t,type:"scale"})}function qT(e,t,n){return _s(e,{tick:n,index:t,type:"tick"})}function ZT(e,t,n){let r=Rc(e);return(n&&t!=="right"||!n&&t==="right")&&(r=GT(r)),r}function QT(e,t,n,r){const{top:s,left:o,bottom:i,right:a,chart:l}=e,{chartArea:c,scales:d}=l;let u=0,f,g,m;const p=i-s,y=a-o;if(e.isHorizontal()){if(g=Wt(r,o,a),Ze(n)){const b=Object.keys(n)[0],_=n[b];m=d[b].getPixelForValue(_)+p-t}else n==="center"?m=(c.bottom+c.top)/2+p-t:m=am(e,n,t);f=a-o}else{if(Ze(n)){const b=Object.keys(n)[0],_=n[b];g=d[b].getPixelForValue(_)-y+t}else n==="center"?g=(c.left+c.right)/2-y+t:g=am(e,n,t);m=Wt(r,i,s),u=n==="left"?-Nt:Nt}return{titleX:g,titleY:m,maxWidth:f,rotation:u}}class Ts extends Ur{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,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._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:r,_suggestedMax:s}=this;return t=jn(t,Number.POSITIVE_INFINITY),n=jn(n,Number.NEGATIVE_INFINITY),r=jn(r,Number.POSITIVE_INFINITY),s=jn(s,Number.NEGATIVE_INFINITY),{min:jn(t,r),max:jn(n,s),minDefined:bn(t),maxDefined:bn(n)}}getMinMax(t){let{min:n,max:r,minDefined:s,maxDefined:o}=this.getUserBounds(),i;if(s&&o)return{min:n,max:r};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)i=a[l].controller.getMinMax(this,t),s||(n=Math.min(n,i.min)),o||(r=Math.max(r,i.max));return n=o&&n>r?r:n,r=s&&n>r?n:r,{min:jn(n,jn(r,n)),max:jn(r,jn(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(){ht(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=xN(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?cm(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),i.display&&(i.autoSkip||i.source==="auto")&&(this.ticks=VT(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,t=!t),this._startPixel=n,this._endPixel=r,this._reversePixels=t,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ht(this.options.afterUpdate,[this])}beforeSetDimensions(){ht(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ht(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ht(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ht(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let r,s,o;for(r=0,s=t.length;r<s;r++)o=t[r],o.label=ht(n.callback,[o.value,r,t],this)}afterTickToLabelConversion(){ht(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ht(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,r=lm(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let i=s,a,l,c;if(!this._isVisible()||!n.display||s>=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),u=d.widest.width,f=d.highest.height,g=nn(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-Po(t.grid)-n.padding-dm(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),i=qM(Math.min(Math.asin(nn((d.highest.height+6)/a,-1,1)),Math.asin(nn(l/c,-1,1))-Math.asin(nn(f/c,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){ht(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ht(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=dm(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=Po(o)+l):(t.height=this.maxHeight,t.width=Po(o)+l),r.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:f}=this._getLabelSizes(),g=r.padding*2,m=Qn(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(){ht(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<r;n++)lt(t[n].label)&&(t.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=cm(r,n)),this._labelSizes=t=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,r){const{ctx:s,_longestTextCache:o}=this,i=[],a=[],l=Math.floor(n/lm(n,r));let c=0,d=0,u,f,g,m,p,y,b,_,x,M,S;for(u=0;u<n;u+=l){if(m=t[u].label,p=this._resolveTickFontOptions(u),s.font=y=p.string,b=o[y]=o[y]||{data:{},gc:[]},_=p.lineHeight,x=M=0,!lt(m)&&!Mt(m))x=k0(s,b.data,b.gc,x,m),M=_;else if(Mt(m))for(f=0,g=m.length;f<g;++f)S=m[f],!lt(S)&&!Mt(S)&&(x=k0(s,b.data,b.gc,x,S),M+=_);i.push(x),a.push(M),c=Math.max(x,c),d=Math.max(M,d)}XT(o,n);const k=i.indexOf(c),N=a.indexOf(d),C=w=>({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 QM(this._alignToPixels?Fr(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&&t<n.length){const r=n[t];return r.$context||(r.$context=qT(this.getContext(),t,r))}return this.$context||(this.$context=KT(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Qn(this.labelRotation),r=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),i=t.autoSkipPadding||0,a=o?o.widest.width+i:0,l=o?o.highest.height+i:0;return this.isHorizontal()?l*r>a*s?a/r:l/s:l*s<a*r?l/r:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_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=Po(o),g=[],m=a.setContext(this.getContext()),p=m.display?m.width:0,y=p/2,b=function(O){return Fr(r,O,p)};let _,x,M,S,k,N,C,w,E,A,P,L;if(i==="top")_=b(this.bottom),N=this.bottom-f,w=_-y,A=b(t.top)+y,L=t.bottom;else if(i==="bottom")_=b(this.top),A=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(Ze(i)){const O=Object.keys(i)[0],T=i[O];_=b(this.chart.scales[O].getPixelForValue(T))}A=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(Ze(i)){const O=Object.keys(i)[0],T=i[O];_=b(this.chart.scales[O].getPixelForValue(T))}k=_-y,C=k-f,E=t.left,P=t.right}const $=Qe(s.ticks.maxTicksLimit,u),D=Math.max(1,Math.ceil(u/$));for(x=0;x<u;x+=D){const O=this.getContext(x),T=o.setContext(O),z=a.setContext(O),U=T.lineWidth,W=T.color,G=z.dash||[],B=z.dashOffset,j=T.tickWidth,Y=T.tickColor,V=T.tickBorderDash||[],X=T.tickBorderDashOffset;M=YT(this,x,l),M!==void 0&&(S=Fr(r,M,U),c?k=C=E=P=S:N=w=A=L=S,g.push({tx1:k,ty1:N,tx2:C,ty2:w,x1:E,y1:A,x2:P,y2:L,width:U,color:W,borderDash:G,borderDashOffset:B,tickWidth:j,tickColor:Y,tickBorderDash:V,tickBorderDashOffset:X}))}return this._ticksLength=u,this._borderValue=_,g}_computeLabelItems(t){const n=this.axis,r=this.options,{position:s,ticks:o}=r,i=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:d,mirror:u}=o,f=Po(r.grid),g=f+d,m=u?-d:g,p=-Qn(this.labelRotation),y=[];let b,_,x,M,S,k,N,C,w,E,A,P,L="middle";if(s==="top")k=this.bottom-m,N=this._getXAxisLabelAlignment();else if(s==="bottom")k=this.top+m,N=this._getXAxisLabelAlignment();else if(s==="left"){const D=this._getYAxisLabelAlignment(f);N=D.textAlign,S=D.x}else if(s==="right"){const D=this._getYAxisLabelAlignment(f);N=D.textAlign,S=D.x}else if(n==="x"){if(s==="center")k=(t.top+t.bottom)/2+g;else if(Ze(s)){const D=Object.keys(s)[0],O=s[D];k=this.chart.scales[D].getPixelForValue(O)+g}N=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")S=(t.left+t.right)/2-g;else if(Ze(s)){const D=Object.keys(s)[0],O=s[D];S=this.chart.scales[D].getPixelForValue(O)}N=this._getYAxisLabelAlignment(f).textAlign}n==="y"&&(l==="start"?L="top":l==="end"&&(L="bottom"));const $=this._getLabelSizes();for(b=0,_=a.length;b<_;++b){x=a[b],M=x.label;const D=o.setContext(this.getContext(b));C=this.getPixelForTick(b)+o.labelOffset,w=this._resolveTickFontOptions(b),E=w.lineHeight,A=Mt(M)?M.length:1;const O=A/2,T=D.color,z=D.textStrokeColor,U=D.textStrokeWidth;let W=N;i?(S=C,N==="inner"&&(b===_-1?W=this.options.reverse?"left":"right":b===0?W=this.options.reverse?"right":"left":W="center"),s==="top"?c==="near"||p!==0?P=-A*E+E/2:c==="center"?P=-$.highest.height/2-O*E+E:P=-$.highest.height+E/2:c==="near"||p!==0?P=E/2:c==="center"?P=$.highest.height/2-O*E:P=$.highest.height-A*E,u&&(P*=-1),p!==0&&!D.showLabelBackdrop&&(S+=E/2*Math.sin(p))):(k=C,P=(1-A)*E/2);let G;if(D.showLabelBackdrop){const B=yn(D.backdropPadding),j=$.heights[b],Y=$.widths[b];let V=P-B.top,X=0-B.left;switch(L){case"middle":V-=j/2;break;case"bottom":V-=j;break}switch(N){case"center":X-=Y/2;break;case"right":X-=Y;break;case"inner":b===_-1?X-=Y:b>0&&(X-=Y/2);break}G={left:X,top:V,width:Y+B.width,height:j+B.height,color:D.backdropColor}}y.push({label:M,font:w,textOffset:P,options:{rotation:p,color:T,strokeColor:z,strokeWidth:U,textAlign:W,textBaseline:L,translation:[S,k],backdrop:G}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Qn(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<i;++o){const l=s[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:r,grid:s}}=this,o=r.setContext(this.getContext()),i=r.display?o.width:0;if(!i)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,d,u,f;this.isHorizontal()?(c=Fr(t,this.left,i)-i/2,d=Fr(t,this.right,a)+a/2,u=f=l):(u=Fr(t,this.top,i)-i/2,f=Fr(t,this.bottom,a)+a/2,c=d=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,u),n.lineTo(d,f),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const r=this.ctx,s=this._computeLabelArea();s&&sd(r,s);const o=this.getLabelItems(t);for(const i of o){const a=i.options,l=i.font,c=i.label,d=i.textOffset;No(r,c,0,d,l,a)}s&&od(r)}drawTitle(){const{ctx:t,options:{position:n,title:r,reverse:s}}=this;if(!r.display)return;const o=Gt(r.font),i=yn(r.padding),a=r.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||Ze(n)?(l+=i.bottom,Mt(r.text)&&(l+=o.lineHeight*(r.text.length-1))):l+=i.top;const{titleX:c,titleY:d,maxWidth:u,rotation:f}=QT(this,l,n,a);No(t,r.text,0,0,o,{color:r.color,maxWidth:u,rotation:f,textAlign:ZT(a,n,s),textBaseline:"middle",translation:[c,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,r=Qe(t.grid&&t.grid.z,-1),s=Qe(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Ts.prototype.draw?[{z:n,draw: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<i;++o){const a=n[o];a[r]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return Gt(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class _a{constructor(t,n,r){this.type=t,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let r;eO(n)&&(r=this.register(n));const s=this.items,o=t.id,i=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,JT(t,i,r),this.override&&wt.override(t.id,t.overrides)),i}get(t){return this.items[t]}unregister(t){const n=this.items,r=t.id,s=this.scope;r in n&&delete n[r],s&&r in wt[s]&&(delete wt[s][r],this.override&&delete $r[r])}}function JT(e,t,n){const r=Co(Object.create(null),[n?wt.get(n):{},wt.get(t),e.defaults]);wt.set(t,r),e.defaultRoutes&&RT(t,e.defaultRoutes),e.descriptors&&wt.describe(t,e.descriptors)}function RT(e,t){Object.keys(t).forEach(n=>{const r=n.split("."),s=r.pop(),o=[e].concat(r).join("."),i=t[n].split("."),a=i.pop(),l=i.join(".");wt.route(o,s,l,a)})}function eO(e){return"id"in e&&"defaults"in e}class tO{constructor(){this.controllers=new _a(Ns,"datasets",!0),this.elements=new _a(Ur,"elements"),this.plugins=new _a(Object,"plugins"),this.scales=new _a(Ts,"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):st(s,i=>{const a=r||this._getRegistryForType(i);this._exec(t,a,i)})})}_exec(t,n,r){const s=Zc(t);ht(r["before"+s],[],r),n[t](r),ht(r["after"+s],[],r)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(t))return r}return this.plugins}_get(t,n,r){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+r+".");return s}}var Gn=new tO;class nO{constructor(){this._init=void 0}notify(t,n,r,s){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=s?this._descriptors(t).filter(s):this._descriptors(t),i=this._notify(o,t,n,r);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),i}_notify(t,n,r,s){s=s||{};for(const o of t){const i=o.plugin,a=i[r],l=[n,s,o.options];if(ht(a,l,i)===!1&&s.cancelable)return!1}return!0}invalidate(){lt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const r=t&&t.config,s=Qe(r.options&&r.options.plugins,{}),o=rO(r);return s===!1&&!n?[]:oO(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],r=this._cache,s=(o,i)=>o.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 rO(e){const t={},n=[],r=Object.keys(Gn.plugins.items);for(let o=0;o<r.length;o++)n.push(Gn.getPlugin(r[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const i=s[o];n.indexOf(i)===-1&&(n.push(i),t[i.id]=!0)}return{plugins:n,localIds:t}}function sO(e,t){return!t&&e===!1?null:e===!0?{}:e}function oO(e,{plugins:t,localIds:n},r,s){const o=[],i=e.getContext();for(const a of t){const l=a.id,c=sO(r[l],s);c!==null&&o.push({plugin:a,options:iO(e.config,{plugin:a,local:n[l]},c,i)})}return o}function iO(e,{plugin:t,local:n},r,s){const o=e.pluginScopeKeys(t),i=e.getOptionScopes(r,o);return n&&t.defaults&&i.push(t.defaults),e.createResolver(i,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function xd(e,t){const n=wt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function aO(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function lO(e,t){return e===t?"_index_":"_value_"}function um(e){if(e==="x"||e==="y"||e==="r")return e}function cO(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function wd(e,...t){if(um(e))return e;for(const n of t){const r=n.axis||cO(n.position)||e.length>1&&um(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function fm(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function dO(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 fm(e,"x",n[0])||fm(e,"y",n[0])}return{}}function uO(e,t){const n=$r[e.type]||{scales:{}},r=t.scales||{},s=xd(e.type,t),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!Ze(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=wd(i,a,dO(i,e),wt.scales[a.type]),c=lO(l,s),d=n.scales||{};o[i]=So(Object.create(null),[{axis:l},a,d[l],d[c]])}),e.data.datasets.forEach(i=>{const a=i.type||e.type,l=i.indexAxis||xd(a,t),d=($r[a]||{}).scales||{};Object.keys(d).forEach(u=>{const f=aO(u,l),g=i[f+"AxisID"]||f;o[g]=o[g]||Object.create(null),So(o[g],[{axis:f},r[g],d[u]])})}),Object.keys(o).forEach(i=>{const a=o[i];So(a,[wt.scales[a.type],wt.scale])}),o}function hm(e){const t=e.options||(e.options={});t.plugins=Qe(t.plugins,{}),t.scales=uO(e,t)}function gm(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function fO(e){return e=e||{},e.data=gm(e.data),hm(e),e}const pm=new Map,mm=new Set;function Ea(e,t){let n=pm.get(e);return n||(n=t(),pm.set(e,n),mm.add(n)),n}const $o=(e,t,n)=>{const r=Ir(t,n);r!==void 0&&e.add(r)};class hO{constructor(t){this._config=fO(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=gm(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(),hm(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ea(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Ea(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Ea(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return Ea(`${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=>$o(l,t,u))),d.forEach(u=>$o(l,s,u)),d.forEach(u=>$o(l,$r[o]||{},u)),d.forEach(u=>$o(l,wt,u)),d.forEach(u=>$o(l,nd,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),mm.has(n)&&i.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,$r[n]||{},wt.datasets[n]||{},{type:n},wt,nd]}resolveNamedOptions(t,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=bm(this._resolverCache,t,s);let l=i;if(pO(i,n)){o.$shared=!1,r=pr(r)?r():r;const c=this.createResolver(t,r,a);l=Es(i,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,r=[""],s){const{resolver:o}=bm(this._resolverCache,t,r);return Ze(n)?Es(o,n,void 0,s):o}}function bm(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:ad(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const gO=e=>Ze(e)&&Object.getOwnPropertyNames(e).some(t=>pr(e[t]));function pO(e,t){const{isScriptable:n,isIndexable:r}=N0(e);for(const s of t){const o=n(s),i=r(s),a=(i||o)&&e[s];if(o&&(pr(a)||gO(a))||i&&Mt(a))return!0}return!1}var mO="4.5.1";const bO=["top","bottom","left","right","chartArea"];function ym(e,t){return e==="top"||e==="bottom"||bO.indexOf(e)===-1&&t==="x"}function vm(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function xm(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),ht(n&&n.onComplete,[e],t)}function yO(e){const t=e.chart,n=t.options.animation;ht(n&&n.onProgress,[e],t)}function wm(e){return dd()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Ma={},km=e=>{const t=wm(e);return Object.values(Ma).filter(n=>n.canvas===t).pop()};function vO(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 xO(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}let Fo=(vr=class{static register(...t){Gn.add(...t),Cm()}static unregister(...t){Gn.remove(...t),Cm()}constructor(t,n){const r=this.config=new hO(n),s=wm(t),o=km(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||zT(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=FM(),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 nO,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=tN(u=>this.update(u),i.resizeDelay||0),this._dataChanges=[],Ma[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Jn.listen(this,"complete",xm),Jn.listen(this,"progress",yO),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return lt(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 Gn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():L0(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return C0(this.canvas,this.ctx),this}stop(){return Jn.stop(this),this}resize(t,n){Jn.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,L0(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),ht(r.onResize,[this,i],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};st(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=wd(i,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),st(o,i=>{const a=i.options,l=a.id,c=wd(l,a),d=Qe(a.type,i.dtype);(a.position===void 0||ym(a.position,c)!==ym(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=Gn.getScale(d);u=new f({id:l,type:d,ctx:this.ctx,chart:this}),r[u.id]=u}u.init(a,t)}),st(s,(i,a)=>{i||delete r[a]}),st(r,i=>{vn.configure(this,i,i.options),vn.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;s<r;++s)this._destroyDatasetMeta(s);t.splice(n,r-n)}this._sortedMetasets=t.slice(0).sort(vm("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.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<s;r++){const o=n[r];let i=this.getDatasetMeta(r);const a=o.type||this.config.type;if(i.type&&i.type!==a&&(this._destroyDatasetMeta(r),i=this.getDatasetMeta(r)),i.type=a,i.indexAxis=o.indexAxis||xd(a,this.options),i.order=o.order||0,i.index=r,i.label=""+o.label,i.visible=this.isDatasetVisible(r),i.controller)i.controller.updateIndex(r),i.controller.linkScales();else{const l=Gn.getController(a),{datasetElementType:c,dataElementType:d}=wt.datasets[a];Object.assign(l,{dataElementType:Gn.getElement(d),datasetElementType:c&&Gn.getElement(c)}),i.controller=new l(this,r),t.push(i.controller)}}return this._updateMetasets(),t}_resetElements(){st(this.data.datasets,(t,n)=>{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<d;c++){const{controller:u}=this.getDatasetMeta(c),f=!s&&o.indexOf(u)===-1;u.buildOrUpdateElements(f),i=Math.max(+u.getMaxOverflow(),i)}i=this._minPadding=r.layout.autoPadding?i:0,this._updateLayout(i),s||st(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(vm("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){st(this.scales,t=>{vn.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!o0(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;vO(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;o<n;o++)if(!o0(s,r(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;vn.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],st(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<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,pr(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const r=this.getDatasetMeta(t),s={meta:r,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(r.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Jn.has(this)?this.attached&&!Jn.running(this)&&Jn.start(this):(this.draw(),xm({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:r,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,r=[];let s,o;for(s=0,o=n.length;s<o;++s){const i=n[s];(!t||i.visible)&&r.push(i)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;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=HN(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&sd(n,s),t.controller.draw(),s&&od(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return E0(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,s){const o=bT.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=_s(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);_o(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(),Jn.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),C0(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Ma[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,r=(o,i)=>{n.addEventListener(this,o,i),t[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};st(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(){st(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},st(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<l;++a){i=t[a];const c=i&&this.getDatasetMeta(i.datasetIndex).controller;c&&c[s+"HoverStyle"](i.element,i.datasetIndex,i.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],r=t.map(({datasetIndex:o,index:i})=>{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}});!aa(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=jM(t),c=xO(t,this._lastEvent,r,l);r&&(this._lastEvent=null,ht(o.onHover,[t,a,this],this),l&&ht(o.onClick,[t,a,this],this));const d=!aa(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)}},Pe(vr,"defaults",wt),Pe(vr,"instances",Ma),Pe(vr,"overrides",$r),Pe(vr,"registry",Gn),Pe(vr,"version",mO),Pe(vr,"getChart",km),vr);function Cm(){return st(Fo.instances,e=>e._plugins.invalidate())}function wO(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,Wn(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,Wn(r-n));e.arc(s,o,a+c/2,n-f/2,r+f/2,!0)}else{const f=Math.min(c/2,i*Wn(r-n));if(d==="round")e.arc(s,o,f,n-ct/2,r+ct/2,!0);else if(d==="bevel"){const g=2*f*f,m=-g*Math.cos(n+ct/2)+s,p=-g*Math.sin(n+ct/2)+o,y=g*Math.cos(r+ct/2)+s,b=g*Math.sin(r+ct/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 kO(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+Nt,r-Nt),e.closePath(),e.clip()}function CO(e){return id(e,["outerStart","outerEnd","innerStart","innerEnd"])}function SO(e,t,n,r){const s=CO(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 nn(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:nn(s.innerStart,0,i),innerEnd:nn(s.innerEnd,0,i)}}function Os(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Na(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 D=d>0?d-r:0,O=u>0?u-r:0,T=(D+O)/2,z=T!==0?m*T/(T+r):m;g=(m-z)/2}const p=Math.max(.001,m*u-n/ct)/u,y=(m-p)/2,b=l+y+g,_=s-y-g,{outerStart:x,outerEnd:M,innerStart:S,innerEnd:k}=SO(t,f,u,_-b),N=u-x,C=u-M,w=b+x/N,E=_-M/C,A=f+S,P=f+k,L=b+S/A,$=_-k/P;if(e.beginPath(),o){const D=(w+E)/2;if(e.arc(i,a,u,w,D),e.arc(i,a,u,D,E),M>0){const U=Os(C,E,i,a);e.arc(U.x,U.y,M,E,_+Nt)}const O=Os(P,_,i,a);if(e.lineTo(O.x,O.y),k>0){const U=Os(P,$,i,a);e.arc(U.x,U.y,k,_+Nt,$+Math.PI)}const T=(_-k/f+(b+S/f))/2;if(e.arc(i,a,f,_-k/f,T,!0),e.arc(i,a,f,T,b+S/f,!0),S>0){const U=Os(A,L,i,a);e.arc(U.x,U.y,S,L+Math.PI,b-Nt)}const z=Os(N,b,i,a);if(e.lineTo(z.x,z.y),x>0){const U=Os(N,w,i,a);e.arc(U.x,U.y,x,b-Nt,w)}}else{e.moveTo(i,a);const D=Math.cos(w)*u+i,O=Math.sin(w)*u+a;e.lineTo(D,O);const T=Math.cos(E)*u+i,z=Math.sin(E)*u+a;e.lineTo(T,z)}e.closePath()}function _O(e,t,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=t;let l=t.endAngle;if(o){Na(e,t,n,r,l,s);for(let c=0;c<o;++c)e.fill();isNaN(a)||(l=i+(a%_t||_t))}return Na(e,t,n,r,l,s),e.fill(),l}function EO(e,t,n,r,s){const{fullCircles:o,startAngle:i,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:d,borderDash:u,borderDashOffset:f,borderRadius:g}=l,m=l.borderAlign==="inner";if(!c)return;e.setLineDash(u||[]),e.lineDashOffset=f,m?(e.lineWidth=c*2,e.lineJoin=d||"round"):(e.lineWidth=c,e.lineJoin=d||"bevel");let p=t.endAngle;if(o){Na(e,t,n,r,p,s);for(let y=0;y<o;++y)e.stroke();isNaN(a)||(p=i+(a%_t||_t))}m&&kO(e,t,p),l.selfJoin&&p-i>=ct&&g===0&&d!=="miter"&&wO(e,t,p),o||(Na(e,t,n,r,p,s),e.stroke())}class zo extends Ur{constructor(n){super();Pe(this,"circumference");Pe(this,"endAngle");Pe(this,"fullCircles");Pe(this,"innerRadius");Pe(this,"outerRadius");Pe(this,"pixelMargin");Pe(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}=d0(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=Qe(f,c-l),p=fa(i,l,c)&&l!==c,y=m>=_t||p,b=Pr(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>_t?Math.floor(s/_t):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(ct,s||0)),d=o*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,_O(n,this,d,i,a),EO(n,this,d,i,a),n.restore()}}Pe(zo,"id","arc"),Pe(zo,"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}),Pe(zo,"defaultRoutes",{backgroundColor:"backgroundColor"}),Pe(zo,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function Sm(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 yr(e,t,n,r){return e?0:nn(t,n,r)}function MO(e,t,n){const r=e.options.borderWidth,s=e.borderSkipped,o=M0(r);return{t:yr(s.top,o.top,0,n),r:yr(s.right,o.right,0,t),b:yr(s.bottom,o.bottom,0,n),l:yr(s.left,o.left,0,t)}}function NO(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=Ss(s),i=Math.min(t,n),a=e.borderSkipped,l=r||Ze(s);return{topLeft:yr(!l||a.top||a.left,o.topLeft,0,i),topRight:yr(!l||a.top||a.right,o.topRight,0,i),bottomLeft:yr(!l||a.bottom||a.left,o.bottomLeft,0,i),bottomRight:yr(!l||a.bottom||a.right,o.bottomRight,0,i)}}function TO(e){const t=Sm(e),n=t.right-t.left,r=t.bottom-t.top,s=MO(e,n/2,r/2),o=NO(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 kd(e,t,n,r){const s=t===null,o=n===null,a=e&&!(s&&o)&&Sm(e,r);return a&&(s||Pr(t,a.left,a.right))&&(o||Pr(n,a.top,a.bottom))}function OO(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function AO(e,t){e.rect(t.x,t.y,t.w,t.h)}function Cd(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 Ta extends Ur{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}=TO(this),a=OO(i.radius)?ga:AO;t.save(),(i.w!==o.w||i.h!==o.h)&&(t.beginPath(),a(t,Cd(i,n,o)),t.clip(),a(t,Cd(o,-n,i)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),a(t,Cd(o,n)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,n,r){return kd(this,t,n,r)}inXRange(t,n){return kd(this,t,null,n)}inYRange(t,n){return kd(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}}Pe(Ta,"id","bar"),Pe(Ta,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),Pe(Ta,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const _m=(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)}},DO=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class Em extends Ur{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=ht(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=Gt(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=_m(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}=IO(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=Ms(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Wt(r,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=Wt(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=Wt(r,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=Wt(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;sd(t,this),this._draw(),od(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=t,a=wt.color,l=Ms(t.rtl,this.left,this.width),c=Gt(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}=_m(i,u),b=function(k,N,C){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();const w=Qe(C.lineWidth,1);if(s.fillStyle=Qe(C.fillStyle,a),s.lineCap=Qe(C.lineCap,"butt"),s.lineDashOffset=Qe(C.lineDashOffset,0),s.lineJoin=Qe(C.lineJoin,"miter"),s.lineWidth=w,s.strokeStyle=Qe(C.strokeStyle,a),s.setLineDash(Qe(C.lineDash,[])),i.usePointStyle){const E={radius:p*Math.SQRT2/2,pointStyle:C.pointStyle,rotation:C.rotation,borderWidth:w},A=l.xPlus(k,m/2),P=N+f;_0(s,E,A,P,i.pointStyleWidth&&m)}else{const E=N+Math.max((u-p)/2,0),A=l.leftForLtr(k,m),P=Ss(C.borderRadius);s.beginPath(),Object.values(P).some(L=>L!==0)?ga(s,{x:A,y:E,w:m,h:p,radius:P}):s.rect(A,E,m,p),s.fill(),w!==0&&s.stroke()}s.restore()},_=function(k,N,C){No(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:Wt(o,this.left+d,this.right-r[0]),y:this.top+d+M,line:0}:g={x:this.left+d,y:Wt(o,this.top+M+d,this.bottom-n[0].height),line:0},$0(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 A=g.x,P=g.y;l.setWidth(this.width),x?N>0&&A+E+d>this.right&&(P=g.y+=S,g.line++,A=g.x=Wt(o,this.left+d,this.right-r[g.line])):N>0&&P+S>this.bottom&&(A=g.x=A+n[g.line].width+d,g.line++,P=g.y=Wt(o,this.top+M+d,this.bottom-n[g.line].height));const L=l.x(A);if(b(L,P,k),A=nN(w,A+m+f,x?A+E:this.right,t.rtl),_(l.x(A),P,k),x)g.x+=E+d;else if(typeof k.text!="string"){const $=c.lineHeight;g.y+=Mm(k,$)+d}else g.y+=S}),F0(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=Gt(n.font),s=yn(n.padding);if(!n.display)return;const o=Ms(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=Wt(t.align,u,this.right-f);else{const m=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);d=c+Wt(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const g=Wt(a,u,u+f);i.textAlign=o.textAlign(Rc(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,No(i,n.text,g,d,r)}_computeTitleHeight(){const t=this.options.title,n=Gt(t.font),r=yn(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,s,o;if(Pr(t,this.left,this.right)&&Pr(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;r<o.length;++r)if(s=o[r],Pr(t,s.left,s.left+s.width)&&Pr(n,s.top,s.top+s.height))return this.legendItems[r]}return null}handleEvent(t){const n=this.options;if(!$O(t.type,n))return;const r=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=DO(s,r);s&&!o&&ht(n.onLeave,[t,s,this],this),this._hoveredItem=r,r&&!o&&ht(n.onHover,[t,r,this],this)}else r&&ht(n.onClick,[t,r,this],this)}}function IO(e,t,n,r,s){const o=LO(r,e,t,n),i=PO(s,r,t.lineHeight);return{itemWidth:o,itemHeight:i}}function LO(e,t,n,r){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,i)=>o.length>i.length?o:i)),t+n.size/2+r.measureText(s).width}function PO(e,t,n){let r=e;return typeof t.text!="string"&&(r=Mm(t,n)),r}function Mm(e,t){const n=e.text?e.text.length:0;return t*n}function $O(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Nm={id:"legend",_element:Em,start(e,t,n){const r=e.legend=new Em({ctx:e.ctx,options:n,chart:e});vn.configure(e,r,n),vn.addBox(e,r)},stop(e){vn.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;vn.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=yn(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 Tm extends Ur{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=Mt(r.text)?r.text.length:1;this._padding=yn(r.padding);const o=s*Gt(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=Wt(a,r,o),u=n+t,c=o-r):(i.position==="left"?(d=r+t,u=Wt(a,s,n),l=ct*-.5):(d=o-t,u=Wt(a,n,s),l=ct*.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=Gt(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);No(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:Rc(n.align),textBaseline:"middle",translation:[i,a]})}}function FO(e,t){const n=new Tm({ctx:e.ctx,options:t,chart:e});vn.configure(e,n,t),vn.addBox(e,n),e.titleBlock=n}var zO={id:"title",_element:Tm,start(e,t,n){FO(e,n)},stop(e){const t=e.titleBlock;vn.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;vn.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 Vo={average(e){if(!e.length)return!1;let t,n,r=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();r.add(l.x),s+=l.y,++o}}return o===0||r.size===0?!1:{x:[...r].reduce((a,l)=>a+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<i;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),d=ZM(t,c);d<s&&(s=d,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,r=l.y}return{x:n,y:r}}};function Yn(e,t){return t&&(Mt(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Rn(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
|
||
`)>-1?e.split(`
|
||
`):e}function VO(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 Om(e,t){const n=e.chart.ctx,{body:r,footer:s,title:o}=e,{boxWidth:i,boxHeight:a}=t,l=Gt(t.bodyFont),c=Gt(t.titleFont),d=Gt(t.footerFont),u=o.length,f=s.length,g=r.length,m=yn(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,st(e.title,x),n.font=l.string,st(e.beforeBody.concat(e.afterBody),x),_=t.displayColors?i+2+t.boxPadding:0,st(r,M=>{st(M.before,x),st(M.lines,x),st(M.after,x)}),_=0,n.font=d.string,st(e.footer,x),n.restore(),y+=m.width,{width:y,height:p}}function HO(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function UO(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 BO(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"),UO(c,e,t,n)&&(c="center"),c}function Am(e,t,n){const r=n.yAlign||t.yAlign||HO(e,n);return{xAlign:n.xAlign||t.xAlign||BO(e,t,n,r),yAlign:r}}function jO(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function WO(e,t,n){let{y:r,height:s}=e;return t==="top"?r+=n:t==="bottom"?r-=s+n:r-=s/2,r}function Dm(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}=Ss(i);let m=jO(t,a);const p=WO(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:nn(m,0,r.width-t.width),y:nn(p,0,r.height-t.height)}}function Oa(e,t,n){const r=yn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function Im(e){return Yn([],Rn(e))}function GO(e,t,n){return _s(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Lm(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Pm={beforeTitle:Zn,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<r)return n[t.dataIndex]}return""},afterTitle:Zn,beforeBody:Zn,beforeLabel:Zn,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return lt(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Zn,afterBody:Zn,beforeFooter:Zn,footer:Zn,afterFooter:Zn};function rn(e,t,n,r){const s=e[t].call(n,r);return typeof s>"u"?Pm[t].call(n,r):s}class Sd extends Ur{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 V0(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=GO(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,s=rn(r,"beforeTitle",this,t),o=rn(r,"title",this,t),i=rn(r,"afterTitle",this,t);let a=[];return a=Yn(a,Rn(s)),a=Yn(a,Rn(o)),a=Yn(a,Rn(i)),a}getBeforeBody(t,n){return Im(rn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,s=[];return st(t,o=>{const i={before:[],lines:[],after:[]},a=Lm(r,o);Yn(i.before,Rn(rn(a,"beforeLabel",this,o))),Yn(i.lines,rn(a,"label",this,o)),Yn(i.after,Rn(rn(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(t,n){return Im(rn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,s=rn(r,"beforeFooter",this,t),o=rn(r,"footer",this,t),i=rn(r,"afterFooter",this,t);let a=[];return a=Yn(a,Rn(s)),a=Yn(a,Rn(o)),a=Yn(a,Rn(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;l<c;++l)a.push(VO(this.chart,n[l]));return t.filter&&(a=a.filter((d,u,f)=>t.filter(d,u,f,r))),t.itemSort&&(a=a.sort((d,u)=>t.itemSort(d,u,r))),st(a,d=>{const u=Lm(t.callbacks,d);s.push(rn(u,"labelColor",this,d)),o.push(rn(u,"labelPointStyle",this,d)),i.push(rn(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=Vo[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=Om(this,r),c=Object.assign({},a,l),d=Am(this.chart,r,c),u=Dm(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}=Ss(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=Ms(r.rtl,this.x,this.width);for(t.x=Oa(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",i=Gt(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+i.lineHeight/2),t.y+=i.lineHeight+a,l+1===o&&(t.y+=r.titleMarginBottom-a)}}_drawColorBox(t,n,r,s,o){const i=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:l,boxWidth:c}=o,d=Gt(o.bodyFont),u=Oa(this,"left",o),f=s.x(u),g=l<d.lineHeight?(d.lineHeight-l)/2:0,m=n.y+g;if(o.usePointStyle){const p={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},y=s.leftForLtr(f,c)+c/2,b=m+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,S0(t,p,y,b),t.strokeStyle=i.borderColor,t.fillStyle=i.backgroundColor,S0(t,p,y,b)}else{t.lineWidth=Ze(i.borderWidth)?Math.max(...Object.values(i.borderWidth)):i.borderWidth||1,t.strokeStyle=i.borderColor,t.setLineDash(i.borderDash||[]),t.lineDashOffset=i.borderDashOffset||0;const p=s.leftForLtr(f,c),y=s.leftForLtr(s.xPlus(f,1),c-2),b=Ss(i.borderRadius);Object.values(b).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ga(t,{x:p,y:m,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),ga(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=Gt(r.bodyFont);let f=u.lineHeight,g=0;const m=Ms(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=Oa(this,y,r),n.fillStyle=r.bodyColor,st(this.beforeBody,p),g=a&&y!=="right"?i==="center"?c/2+d:c+2+d:0,M=0,k=s.length;M<k;++M){for(b=s[M],_=this.labelTextColors[M],n.fillStyle=_,st(b.before,p),x=b.lines,a&&x.length&&(this._drawColorBox(n,t,M,m,r),f=Math.max(u.lineHeight,l)),S=0,N=x.length;S<N;++S)p(x[S]),f=u.lineHeight;st(b.after,p)}g=0,f=u.lineHeight,st(this.afterBody,p),t.y-=o}drawFooter(t,n,r){const s=this.footer,o=s.length;let i,a;if(o){const l=Ms(r.rtl,this.x,this.width);for(t.x=Oa(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",i=Gt(r.footerFont),n.fillStyle=r.footerColor,n.font=i.string,a=0;a<o;++a)n.fillText(s[a],l.x(t.x),t.y+i.lineHeight/2),t.y+=i.lineHeight+r.footerSpacing}}drawBackground(t,n,r,s){const{xAlign:o,yAlign:i}=this,{x:a,y:l}=t,{width:c,height:d}=r,{topLeft:u,topRight:f,bottomLeft:g,bottomRight:m}=Ss(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+u,l),i==="top"&&this.drawCaret(t,n,r,s),n.lineTo(a+c-f,l),n.quadraticCurveTo(a+c,l,a+c,l+f),i==="center"&&o==="right"&&this.drawCaret(t,n,r,s),n.lineTo(a+c,l+d-m),n.quadraticCurveTo(a+c,l+d,a+c-m,l+d),i==="bottom"&&this.drawCaret(t,n,r,s),n.lineTo(a+g,l+d),n.quadraticCurveTo(a,l+d,a,l+d-g),i==="center"&&o==="left"&&this.drawCaret(t,n,r,s),n.lineTo(a,l+u),n.quadraticCurveTo(a,l,a+u,l),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Vo[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=Om(this,t),l=Object.assign({},i,this._size),c=Am(n,t,l),d=Dm(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=yn(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),$0(t,n.textDirection),o.y+=i.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),F0(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=!aa(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||!aa(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=Vo[o.position].call(this,t,n);return i!==!1&&(r!==i.x||s!==i.y)}}Pe(Sd,"positioners",Vo);var $m={id:"tooltip",_element:Sd,positioners:Vo,afterInit(e,t,n){n&&(e.tooltip=new Sd({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:Pm},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 YO=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function XO(e,t,n,r){const s=e.indexOf(t);if(s===-1)return YO(e,t,n,r);const o=e.lastIndexOf(t);return s!==o?n:s}const KO=(e,t)=>e===null?null:nn(Math.round(e),0,t);function Fm(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class _d extends Ts{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:s,label:o}of n)r[s]===o&&r.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(lt(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:XO(r,t,Qe(n,t),this._addedLabels),KO(n,r.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(r=0),n||(s=this.getLabels().length-1)),this.min=r,this.max=s}buildTicks(){const t=this.min,n=this.max,r=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let i=t;i<=n;i++)s.push({value:i});return s}getLabelForValue(t){return Fm.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}Pe(_d,"id","category"),Pe(_d,"defaults",{ticks:{callback:Fm}});function qO(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=!lt(i),_=!lt(a),x=!lt(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),lt(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&&XM((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,da(w,Math.round(w),S/1e3)?w=Math.round(w):w=Math.ceil(w));const E=Math.max(c0(S),c0(N));k=Math.pow(10,lt(l)?E:l),N=Math.round(N*k)/k,C=Math.round(C*k)/k;let A=0;for(b&&(f&&N!==i?(n.push({value:i}),N<i&&A++,da(Math.round((N+A*S)*k)/k,i,zm(i,M,e))&&A++):N<i&&A++);A<w;++A){const P=Math.round((N+A*S)*k)/k;if(_&&P>a)break;n.push({value:P})}return _&&f&&C!==a?n.length&&da(n[n.length-1].value,a,zm(a,M,e))?n[n.length-1].value=a:n.push({value:a}):(!_||C===a)&&n.push({value:C}),n}function zm(e,t,{horizontal:n,minRotation:r}){const s=Qn(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class ZO extends Ts{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 lt(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=mr(s),c=mr(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=qO(s,o);return t.bounds==="ticks"&&KM(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 td(t,this.chart.options.locale,this.options.ticks.format)}}class Ed extends ZO{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=bn(t)?t:0,this.max=bn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=Qn(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}}Pe(Ed,"id","linear"),Pe(Ed,"defaults",{ticks:{callback:w0.formatters.numeric}});const Aa={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}},sn=Object.keys(Aa);function Vm(e,t){return e-t}function Hm(e,t){if(lt(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)),bn(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(ua(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function Um(e,t,n,r){const s=sn.length;for(let o=sn.indexOf(e);o<s-1;++o){const i=Aa[sn[o]],a=i.steps?i.steps:Number.MAX_SAFE_INTEGER;if(i.common&&Math.ceil((n-t)/(a*i.size))<=r)return sn[o]}return sn[s-1]}function QO(e,t,n,r,s){for(let o=sn.length-1;o>=sn.indexOf(n);o--){const i=sn[o];if(Aa[i].common&&e._adapter.diff(s,r,i)>=t-1)return i}return sn[n?sn.indexOf(n):0]}function JO(e){for(let t=sn.indexOf(e)+1,n=sn.length;t<n;++t)if(Aa[sn[t]].common)return sn[t]}function Bm(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:s}=Qc(n,t),o=n[r]>=t?n[r]:n[s];e[o]=!0}}function RO(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 jm(e,t,n){const r=[],s={},o=t.length;let i,a;for(i=0;i<o;++i)a=t[i],s[a]=i,r.push({value:a,major:!1});return o===0||!n?r:RO(e,r,s,n)}class Da extends Ts{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const r=t.time||(t.time={}),s=this._adapter=new fT._date(t.adapters.date);s.init(n),So(r.displayFormats,s.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:Hm(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,r=t.time.unit||"day";let{min:s,max:o,minDefined:i,maxDefined:a}=this.getUserBounds();function l(c){!i&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!i||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=bn(s)&&!isNaN(s)?s:+n.startOf(Date.now(),r),o=bn(o)&&!isNaN(o)?o:+n.endOf(Date.now(),r)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],r=t[t.length-1]),{min:n,max:r}}buildTicks(){const t=this.options,n=t.time,r=t.ticks,s=r.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,i=this.max,a=RM(s,o,i);return this._unit=n.unit||(r.autoSkip?Um(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):QO(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:JO(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),jm(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+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=nn(n,0,i),r=nn(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||Um(o.minUnit,n,r,this._getLabelCapacity(n)),a=Qe(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,c=ua(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<r;f=+t.add(f,a,i),g++)Bm(d,f,m);return(f===r||s.bounds==="ticks"||g===1)&&Bm(d,f,m),Object.keys(d).sort(Vm).map(p=>+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 ht(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;n<r;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,r=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,r=this.ctx.measureText(t).width,s=Qn(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),i=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:r*o+a*i,h:r*i+a*o}}_getLabelCapacity(t){const n=this.options.time,r=n.displayFormats,s=r[n.unit]||r.millisecond,o=this._tickFormatFunction(t,0,jm(this,[t],this._majorUnit),s),i=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/i.w:this.height/i.h)-1;return a>0?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<r;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,r;if(t.length)return t;const s=this.getLabels();for(n=0,r=s.length;n<r;++n)t.push(Hm(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return h0(t.sort(Vm))}}Pe(Da,"id","time"),Pe(Da,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ia(e,t,n){let r=0,s=e.length-1,o,i,a,l;n?(t>=e[r].pos&&t<=e[s].pos&&({lo:r,hi:s}=Jc(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}=Jc(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 Wm extends Da{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=Ia(n,this.min),this._tableRange=Ia(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<a;++i)c=t[i],c>=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;i<a;++i)d=s[i+1],l=s[i-1],c=s[i],Math.round((d+l)/2)!==c&&o.push({time:c,pos:i/(a-1)});return o}_generate(){const t=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(t)||!r.length)&&r.splice(0,0,t),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((s,o)=>s-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(Ia(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return Ia(this._table,r*this._tableRange+this._minPos,!0)}}Pe(Wm,"id","timeseries"),Pe(Wm,"defaults",Da.defaults);const Gm="label";function Ym(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function e5(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Xm(e,t){e.labels=t}function Km(e,t,n=Gm){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 t5(e,t=Gm){const n={labels:[],datasets:[]};return Xm(n,e.labels),Km(n,e.datasets,t),n}function n5(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 Fo(g.current,{type:i,data:t5(a,o),options:l&&{...l},plugins:c}),Ym(t,m.current))},y=()=>{Ym(t,null),m.current&&(m.current.destroy(),m.current=null)};return v.useEffect(()=>{!s&&m.current&&l&&e5(m.current,l)},[s,l]),v.useEffect(()=>{!s&&m.current&&Xm(m.current.config.data,a.labels)},[s,a.labels]),v.useEffect(()=>{!s&&m.current&&a.datasets&&Km(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 r5=v.forwardRef(n5);function qm(e,t){return Fo.register(t),v.forwardRef((n,r)=>h.jsx(r5,{...n,ref:r,type:e}))}const s5=qm("bar",va),o5=qm("doughnut",Oo);Fo.register(_d,Ed,Ta,zO,$m,Nm);const i5=({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(s5,{data:d,options:f})})},a5=v.memo(i5,(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);Fo.register(zo,$m,Nm);const l5=({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(o5,{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})]})]})})},c5=({id:e,className:t,style:n,children:r,editorAttrs:s})=>h.jsx("div",{id:e,className:t,style:n,...s,children:r}),d5=({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})},u5=({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})},f5=({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(zd,{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]})},h5=({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})]})},g5={language:"json",theme:"vs-dark",options:{automaticLayout:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,fontSize:14,tabSize:2,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",folding:!0,lineNumbers:"on",renderWhitespace:"selection"}},Zm=[{uri:`${window.location.origin}/schemas/layout.json`,fileMatch:["*layout*.json"],schema:{type:"object",properties:{version:{type:"string"},endpoint:{type:"string"},components:{type:"array"}},required:["version","endpoint","components"]}}],p5={"vs/nls":{availableLanguages:{"*":"ko"}}};function m5(e){e.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:Zm,enableSchemaRequest:!0,schemaValidation:"error",schemaRequest:"error"})}const b5={identifier:"sirsoft-admin_basic",vendor:"sirsoft",name:{ko:"Admin Basic",en:"Admin Basic"},version:"1.0.5",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.7",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",url:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",preconnect:"https://cdnjs.cloudflare.com"},{id:"pretendard",type:"webfont",url:"https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css",preconnect:"https://cdn.jsdelivr.net",crossorigin:"anonymous"},{id:"flag-icons",type:"style",url:"https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/css/flag-icons.min.css"}]},er=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)},Md=["auto","light","dark"],Qm="g7_color_scheme",y5=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,La=e=>{const t=y5(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function v5(){try{const e=localStorage.getItem(Qm),t=e&&Md.includes(e)?e:"auto";La(t);try{window.G7Core?.state?.setGlobal?.({theme:t})}catch(n){er.warn("Failed to set global theme state:",n)}er.log("Initial theme applied:",t)}catch(e){er.warn("Failed to load initial theme:",e),La("auto")}}async function x5(e,t){const n=e?.target;if(n&&typeof n=="string"&&Md.includes(n)){La(n);try{window.G7Core?.state?.setGlobal?.({theme:n})}catch(r){er.warn("Failed to set global theme state:",r)}return}v5()}async function w5(e,t){let n;if(e?.target&&typeof e.target=="string"&&!e.target.includes("{{")&&(n=e.target),!n||typeof n!="string"){er.warn("Invalid theme:",n);return}if(!Md.includes(n)){er.warn("Unsupported theme:",n);return}const r=n;try{localStorage.setItem(Qm,r)}catch(s){er.error("Failed to save theme to localStorage:",s);return}La(r);try{window.G7Core?.state?.setGlobal?.({theme:r})}catch(s){er.warn("Failed to set global theme state:",s)}er.log("Theme changed to:",r)}const As=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 Jm(e,t){for(const n of e){if(n.slug===t)return n;if(n.children&&n.children.length>0){const r=Jm(n.children,t);if(r)return r}}return null}function Rm(e){return new URLSearchParams(window.location.search).get(e)}function k5(e){return window.G7Core?.state?.getDataSource?.(e)}function C5(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 S5(e,t=30,n=100){for(let r=0;r<t;r++){const s=C5(k5(e));if(s)return s;await new Promise(o=>setTimeout(o,n))}return null}async function _5(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){As.warn("[initMenuFromUrl] Failed to hydrate menu detail:",n)}return e}async function E5(e,t){const n=window.G7Core,r=Rm("menu"),s=Rm("mode");if(!r){As.log("[initMenuFromUrl] No menu parameter in URL");return}if(!n?.state?.set){As.warn("[initMenuFromUrl] G7Core.state.set not available");return}const o=await S5("menus");if(!o){As.warn("[initMenuFromUrl] menus data not available after waiting");return}const i=Jm(o,r);if(!i){As.warn("[initMenuFromUrl] Menu not found with slug:",r);return}const a=await _5(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)}}),As.log("[initMenuFromUrl] Menu initialized from URL:",{slug:r,mode:l,menuId:i.id})}const qt=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)},Pa="g7_filter_visibility_";async function M5(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){qt.warn("[initFilterVisibility] storageKey is required");return}const o=`${Pa}${n}`;try{const i=localStorage.getItem(o);let a;if(i){const l=JSON.parse(i);Array.isArray(l)?(a=l,qt.log(`[initFilterVisibility] Loaded from localStorage: ${a.join(", ")}`)):(a=r,qt.warn("[initFilterVisibility] Invalid saved data format, using defaults"))}else a=r,qt.log(`[initFilterVisibility] No saved data, using defaults: ${r.join(", ")}`);t?.setState&&t.setState({[s]:a})}catch(i){qt.error("[initFilterVisibility] Failed to load filter visibility:",i),t?.setState&&t.setState({[s]:r})}}async function N5(e,t){const{storageKey:n,filters:r}=e?.params||{};if(!n){qt.warn("[saveFilterVisibility] storageKey is required");return}if(!Array.isArray(r)){qt.warn("[saveFilterVisibility] filters must be an array");return}const s=`${Pa}${n}`;try{localStorage.setItem(s,JSON.stringify(r)),qt.log(`[saveFilterVisibility] Saved to localStorage: ${r.join(", ")}`)}catch(o){qt.error("[saveFilterVisibility] Failed to save filter visibility:",o)}}async function T5(e,t){const{storageKey:n,filterId:r,stateKey:s="visibleFilters"}=e?.params||{};if(!n||!r){qt.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=`${Pa}${n}`;try{localStorage.setItem(a,JSON.stringify(i)),qt.log(`[toggleFilterVisibility] Toggled ${r}: ${i.join(", ")}`)}catch(l){qt.error("[toggleFilterVisibility] Failed to save:",l)}}async function O5(e,t){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=e?.params||{};if(!n){qt.warn("[resetFilterVisibility] storageKey is required");return}const o=`${Pa}${n}`;try{localStorage.setItem(o,JSON.stringify(r)),t?.setState&&t.setState({[s]:r}),qt.log(`[resetFilterVisibility] Reset to defaults: ${r.join(", ")}`)}catch(i){qt.error("[resetFilterVisibility] Failed to reset:",i)}}const Ds=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 A5(e,t){const n=window.G7Core;if(!n){Ds.error("G7Core not available");return}const r=n.state?.getGlobal?.()?.multilingualTagEdit;if(!r){Ds.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()!=="")){Ds.warn("No values to save"),n.modal?.close?.(),Nd(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?.(),Nd(n)}async function D5(e,t){const n=window.G7Core;if(!n){Ds.error("G7Core not available");return}n.modal?.close?.(),Nd(n)}async function I5(e,t){const n=window.G7Core;if(!n){Ds.error("G7Core not available");return}const r=e?.params?.locale;if(!r){Ds.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 Nd(e){e.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:null}})}function eb(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 L5(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59),r=eb(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:eb(s),endDate:r}}function P5(e){const{preset:t}=e.params||{preset:"today"},{startDate:n,endDate:r}=L5(t);return{startDate:n,endDate:r,preset:t}}const Ho=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)},tb="g7_admin_sidebar_collapsed";function nb(){try{return localStorage.getItem(tb)==="1"}catch{return!1}}function $5(e){try{localStorage.setItem(tb,e?"1":"0")}catch(t){Ho.error("Failed to save sidebar state to localStorage:",t)}try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Ho.warn("Failed to set global sidebar state:",t)}}function rb(){const e=nb();try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:e})}catch(t){Ho.warn("Failed to restore sidebar state:",t)}Ho.log("Initial sidebar collapsed state restored:",e)}async function F5(e,t){rb()}async function z5(e,t){const r=!(()=>{try{return!!window.G7Core?.state?.getGlobal?.()?.sidebarCollapsed}catch{return nb()}})();$5(r),Ho.log("Sidebar collapsed toggled to:",r)}const Td=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 V5(e,t){const n=window.G7Core,{url:r,filename:s}=e?.params||{};if(!r){Td.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!n?.api?.get){Td.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){Td.error("첨부파일 다운로드 실패",o),n?.toast?.error?.(n?.t?.("common.download_failed")??"Download failed")}}const $a=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)},H5="G7_ASSET_PROBE_OK";async function sb(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(H5):!1}catch{return!1}}async function ob(){const[e,t]=await Promise.all([sb("/api/system/asset-probe.js"),sb("/api/system/asset-probe")]);return e&&t?"extension":!e&&t?"extensionless":"unavailable"}function U5(){return window.G7Config?.settings?.general?.asset_url_mode??"extension"}async function B5(e){try{const t=await ob();if(t==="unavailable")return;const n=U5();if(t===n)return;window.G7Core?.state?.setGlobal?.({assetUrlModeDrift:{detected:t,stored:n}})}catch(t){$a.warn("자산 URL 방식 대조 실패 (대시보드 동작에는 영향 없음):",t)}}async function j5(e,t){const n=window.G7Core,r=t?.setState??n?.state?.setLocal,s=o=>{typeof r=="function"?r({asset_url_mode_detect_status:o}):$a.warn("setState 를 찾지 못해 감지 상태를 폼에 반영하지 못했습니다")};try{s("detecting");const o=await ob();if(o==="unavailable"){s("unavailable");return}typeof r=="function"?r({"general.asset_url_mode":o,asset_url_mode_detect_status:o}):$a.warn("setState 를 찾지 못해 감지 결과를 폼에 반영하지 못했습니다")}catch(o){$a.error("자산 URL 방식 감지 실패:",o),s("unavailable")}}const Fa={detectAssetUrlMode:j5,checkAssetUrlModeDrift:B5,setTheme:w5,initTheme:x5,scrollToSection:hu,initMenuFromUrl:E5,initFilterVisibility:M5,saveFilterVisibility:N5,toggleFilterVisibility:T5,resetFilterVisibility:O5,saveMultilingualTag:A5,cancelMultilingualTag:D5,updateMultilingualTagValue:I5,setDateRange:P5,toggleSidebar:z5,initSidebar:F5,downloadAttachment:V5},Uo=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 W5(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function G5(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function Y5(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",...G5(),...W5()},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 X5(e){const t=window.G7Core,n=t?.identity;if(!t?.dispatch||!t?.state||!n)return Uo.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 Y5(e,r)}catch(m){Uo.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 Uo.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 K5(){const e=window.G7Core?.identity;if(!e?.setLauncher){Uo.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(X5),Uo.log("IDV launcher registered (sirsoft-admin_basic)")}function q5(e){const t=e.icons;return Array.isArray(t)?t.filter(n=>!!n&&typeof n=="object"&&typeof n.value=="string"):[]}function Z5(e,t){const n=e.label;return typeof n=="string"?n.startsWith("$t:")?t(n.slice(3)):n:e.value}function Q5(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 J5({entry:e}){const t=e.preview;return t?.html?h.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:Ad}):t?.className?h.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:Ad}):h.jsx("i",{className:`fas fa-${e.value}`,style:Ad,"aria-hidden":"true"})}function R5({control:e,value:t,onChange:n,t:r}){const s=q5(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:ib,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:ab})});const u=g=>Z5(g,r),f=s.filter(g=>Q5(g,u(g),c));return h.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:ib,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:ab}),h.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...eA,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===""?lb:Od,children:h.jsx("span",{style:tA,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?lb:Od,children:h.jsx(J5,{entry:g})},g.value)})]}),f.length===0&&h.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:nA,children:r("layout_editor.icon_picker.no_results")})]})}const ib={display:"flex",flexDirection:"column",gap:6,width:"100%"},ab={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},eA={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},Od={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},lb={...Od,border:"2px solid #2563eb",background:"#eff6ff"},Ad={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},tA={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},nA={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},cb=130,Dn=20;function rA(e){const t=e?.arrayProp;return typeof t=="string"&&t?t:"tabs"}function sA(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 oA({node:e,params:t,cellBoxes:n,t:r,onPatchNode:s}){const o=rA(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:sA(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:Dn,height:Dn,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:cb};return h.jsx("div",{className:"g7le-tabnav-inplace","data-testid":"g7le-tabnav-inplace",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:cb},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-Dn/2,top:p.top-Dn/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-Dn/2},onClick:b=>{b.preventDefault(),b.stopPropagation(),u(m,-1)},children:"◀"}),m<i.length-1&&h.jsx("button",{type:"button","data-testid":`g7le-tabnav-move-right-${m}`,title:r("editor.tabnav_inplace.move_right"),"aria-label":r("editor.tabnav_inplace.move_right"),style:{...f,left:y-Dn,top:p.top+p.height-Dn/2},onClick:b=>{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-Dn,top:p.top+p.height/2-Dn/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-Dn/2,top:p.top+p.height/2-Dn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(m+1)},children:"+"})]},`tab-aff-${g.id}-${m}`)})})}const Dd=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 iA(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){Dd.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",R5),Dd.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)"),e.registerCanvasOverlay&&(e.registerCanvasOverlay("tabnav",oA),Dd.log("편집기 캔버스 오버레이 'tabnav' 등록됨(TabNavigation 탭 인플레이스)"))}const Id=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=Fa);function db(){if(typeof window<"u"){let e=0;const t=50,n=()=>{const r=window.G7Core?.getActionDispatcher?.();r?(Object.entries(Fa).forEach(([s,o])=>{r.registerHandler(s,o)}),Id.log(`${Object.keys(Fa).length} custom handler(s) registered:`,Object.keys(Fa)),K5(),rb()):(e++,e<=t?(Id.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(n,100)):Id.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?n():window.addEventListener("load",n)}}return iA(),db(),R.A=Wr,R.Accordion=dc,R.ActionMenu=Ls,R.AdminFooter=qy,R.AdminHeader=Gy,R.AdminSidebar=Wy,R.Alert=ku,R.AlertDialog=Py,R.Badge=Wd,R.BarChart=a5,R.Breadcrumb=yu,R.Button=ae,R.Card=Nb,R.CardGrid=yy,R.CategoryTree=u_,R.Checkbox=_n,R.ChipCheckbox=QE,R.Code=Sb,R.CodeEditor=ux,R.ColumnSelector=yx,R.ConfirmDialog=mu,R.Container=c5,R.DataGrid=fy,R.Dialog=pu,R.Div=I,R.DonutChart=l5,R.Dropdown=xy,R.DropdownButton=JE,R.DropdownMenuItem=RE,R.DynamicFieldList=cM,R.EmptyState=Uy,R.ExtensionBadge=ph,R.FileInput=$d,R.FileUploader=Vp,R.FilterGroup=Sy,R.FilterVisibilitySelector=GE,R.Flex=u5,R.Form=Ga,R.FormField=gM,R.Fragment=Eb,R.Grid=d5,R.H1=Ba,R.H2=or,R.H3=jr,R.H4=Fd,R.Hr=Mb,R.HtmlContent=ol,R.HtmlEditor=UE,R.I=pt,R.Icon=oe,R.IconButton=Dy,R.IconName=ue,R.IconSelect=o_,R.ImageGallery=Zi,R.Img=Sn,R.Input=kt,R.Label=ln,R.LanguageSelector=Ky,R.LayoutEditorHeader=ev,R.LayoutFileList=tv,R.LayoutHistoryPanel=hx,R.LayoutWarnings=WE,R.Li=Wa,R.LoadingSpinner=jy,R.LoginForm=gx,R.Modal=Zo,R.MultilingualInput=Za,R.MultilingualLocaleContext=jc,R.MultilingualTabPanel=hM,R.MultilingualTagInput=hC,R.Nav=Go,R.NotificationCenter=Yy,R.Ol=bb,R.Optgroup=wb,R.Option=xb,R.P=yt,R.PageHeader=Zy,R.PageLoading=kx,R.PageTransitionIndicator=xx,R.Pagination=Yo,R.PermissionTree=c_,R.Pre=_b,R.ProductCard=wy,R.RadioGroup=zE,R.RichSelect=qE,R.SearchBar=Cy,R.SearchableDropdown=gC,R.Section=zd,R.SectionHeader=Jy,R.SectionLayout=f5,R.Select=Gr,R.SlotContainer=KE,R.SortableMenuItem=sg,R.SortableMenuList=r_,R.Span=J,R.StatCard=ky,R.StatusBadge=Xo,R.Svg=Xn,R.TabNavigation=_y,R.TabNavigationScroll=Oy,R.Table=Ya,R.TagInput=dC,R.TagSelect=pC,R.Tbody=Ka,R.Td=Jt,R.TemplateCard=Ry,R.Textarea=sr,R.Tfoot=qa,R.Th=Yr,R.Thead=Xa,R.ThemeToggle=mx,R.ThreeColumnLayout=h5,R.Toast=Vy,R.Toggle=Qa,R.Tr=ir,R.Ul=ja,R.UnifiedIcon=Cb,R.UserProfile=Xy,R.VersionList=zu,R.configureJSONLanguageService=m5,R.defaultJSONSchemas=Zm,R.executeImageDownload=zc,R.initTemplate=db,R.jsonEditorDefaults=g5,R.monacoInitOptions=p5,R.templateMetadata=b5,R.useCurrentMultilingualLocale=Yp,R.useImageGallery=_p,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R})({},ReactJSXRuntime,React,ReactDOM);
|