(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,261484,e=>{"use strict";var t=e.i(942347),a={SVG:"image/svg+xml",ICO:"image/x-icon",GIF:"image/gif",PNG:"image/png"};let s=function(e){(0,t.useEffect)(function(){if(e){var t=e.split("."),s=t[t.length-1].toLocaleUpperCase(),n=document.querySelector("link[rel*='icon']")||document.createElement("link");n.type=a[s],n.href=e,n.rel="shortcut icon",document.getElementsByTagName("head")[0].appendChild(n)}},[e])};var n=e.i(221317),o=e.i(742404),r={restoreOnUnmount:!1};let i=function(e,a){void 0===a&&(a=r);var s=(0,t.useRef)(o.default?document.title:"");(0,t.useEffect)(function(){document.title=e},[e]),(0,n.default)(function(){a.restoreOnUnmount&&(document.title=s.current)})};var l=e.i(494268),c=e.i(168014);function d(e){let a=(0,l.useIsSystemFeaturesPending)(),n=(0,l.useGlobalPublicStore)(e=>e.systemFeatures),o=e?`${e} - `:"",r="",d="";!1===a&&(n.branding.enabled?(r=`${o}${n.branding.application_title}`,d=n.branding.favicon):(r=`${o}Dify`,d=`${c.basePath}/favicon.ico`)),i(r),(0,t.useEffect)(()=>{let e=null;return n.branding.favicon&&(document.querySelectorAll("link[rel='icon'], link[rel='shortcut icon'], link[rel='apple-touch-icon'], link[rel='mask-icon']").forEach(e=>e.parentNode?.removeChild(e)),(e=document.createElement("link")).rel="apple-touch-icon",e.href=n.branding.favicon,document.head.appendChild(e)),()=>{e?.remove()}},[n.branding.favicon]),s(d)}e.s(["default",()=>d],261484)},927897,e=>{"use strict";var t=e.i(688271),a=e.i(890564),s=e.i(868729),n=e.i(830616),o=e.i(494268),r=e.i(367916),i=e.i(447301);let l="access-control";e.s(["useAppWhiteListSubjects",0,(e,t)=>(0,s.useQuery)({queryKey:[l,"app-whitelist-subjects",e],queryFn:()=>(0,r.get)(`/enterprise/webapp/app/subjects?appId=${e}`),enabled:!!e&&t,staleTime:0,gcTime:0}),"useGetUserCanAccessApp",0,e=>{let{appId:t,isInstalledApp:a=!0,enabled:n}=e,r=(0,o.useGlobalPublicStore)(e=>e.systemFeatures);return(0,s.useQuery)({queryKey:[l,"user-can-access-app",t,r.webapp_auth.enabled,a],queryFn:()=>r.webapp_auth.enabled?(0,i.getUserCanAccess)(t,a):{result:!0},enabled:void 0!==n?n:!!t,staleTime:0,gcTime:0})},"useSearchForWhiteListCandidates",0,(e,a)=>(0,t.useInfiniteQuery)({queryKey:[l,"app-whitelist-candidates",e],queryFn:t=>{let{pageParam:a}=t,s=new URLSearchParams;return Object.keys(e).forEach(t=>{e[t]&&s.append(t,`${e[t]}`)}),s.append("pageNumber",`${a}`),(0,r.get)(`/enterprise/webapp/app/subject/search?${new URLSearchParams(s).toString()}`)},initialPageParam:1,getNextPageParam:e=>{if(e.hasMore)return e.currPage+1},gcTime:0,staleTime:0,enabled:a}),"useUpdateAccessMode",0,()=>{let e=(0,n.useQueryClient)();return(0,a.useMutation)({mutationKey:[l,"update-access-mode"],mutationFn:e=>(0,r.post)("/enterprise/webapp/app/access-mode",{body:e}),onSuccess:()=>{e.invalidateQueries({queryKey:[l,"app-whitelist-subjects"]})}})}])},199947,e=>{"use strict";var t=e.i(339548),a=e.i(167362);class s{chatColorTheme;chatColorThemeInverted;primaryColor="#1C64F2";backgroundHeaderColorStyle="backgroundImage: linear-gradient(to right, #2563eb, #0ea5e9)";headerBorderBottomStyle="";colorFontOnHeaderStyle="color: white";colorPathOnHeader="text-text-primary-on-surface";backgroundButtonDefaultColorStyle="backgroundColor: #1C64F2";roundedBackgroundColorStyle="backgroundColor: rgb(245 248 255)";chatBubbleColorStyle="";constructor(e=null,t=!1){this.chatColorTheme=e,this.chatColorThemeInverted=t,this.configCustomColor(),this.configInvertedColor()}configCustomColor(){null!==this.chatColorTheme&&""!==this.chatColorTheme&&(this.primaryColor=this.chatColorTheme??"#1C64F2",this.backgroundHeaderColorStyle=`backgroundColor: ${this.primaryColor}`,this.backgroundButtonDefaultColorStyle=`backgroundColor: ${this.primaryColor}; color: ${this.colorFontOnHeaderStyle};`,this.roundedBackgroundColorStyle=`backgroundColor: ${(0,a.hexToRGBA)(this.primaryColor,.05)}`,this.chatBubbleColorStyle=`backgroundColor: ${(0,a.hexToRGBA)(this.primaryColor,.15)}`)}configInvertedColor(){this.chatColorThemeInverted&&(this.backgroundHeaderColorStyle="backgroundColor: #ffffff",this.colorFontOnHeaderStyle=`color: ${this.primaryColor}`,this.headerBorderBottomStyle="borderBottom: 1px solid #ccc",this.colorPathOnHeader=this.primaryColor)}}let n=(0,t.createContext)(new class{_theme;buildChecker=!1;get theme(){return void 0===this._theme&&(this._theme=new s),this._theme}buildTheme(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.buildChecker?(this.theme?.chatColorTheme!==e||this.theme?.chatColorThemeInverted!==t)&&(this._theme=new s(e,t),this.buildChecker=!0):(this._theme=new s(e,t),this.buildChecker=!0)}});e.s(["useThemeContext",0,()=>(0,t.useContext)(n)])},142410,e=>{"use strict";var t=e.i(942347);e.s(["useAsyncWindowOpen",0,()=>(0,t.useCallback)(async(e,t)=>{let{immediateUrl:a,target:s="_blank",features:n,onError:o}=t??{},r=n?`${n},noopener,noreferrer`:"noopener,noreferrer";if(a){let e=window.open(a,s,r);if(!e)return void o?.(Error("Failed to open new window"));try{e.opener=null}catch{}return}let i=window.open("about:blank",s,n);if(!i)return void o?.(Error("Failed to open new window"));try{i.opener=null}catch{}try{let t=await e();if(t){i.location.href=t;return}i.close(),o?.(Error("No url resolved for new window"))}catch(e){i.close(),o?.(e instanceof Error?e:Error(String(e)))}},[])])},216425,e=>{"use strict";var t=e.i(942347);e.i(816688);var a=e.i(675066);e.s(["useKnowledge",0,()=>{let{t:e}=(0,a.useTranslation)(),s=(0,t.useCallback)(t=>e(`indexingTechnique.${t}`,{ns:"dataset"}),[e]),n=(0,t.useCallback)((t,a)=>a?e("indexingMethod.invertedIndex",{ns:"dataset"}):e(`indexingMethod.${t}`,{ns:"dataset"}),[e]),o=(0,t.useCallback)((e,t)=>{let a=s(e);return t&&(a+=` \xb7 ${n(t,"economy"===e)}`),a},[s,n]);return{formatIndexingTechnique:s,formatIndexingMethod:n,formatIndexingTechniqueAndMethod:o}}])},3599,e=>{"use strict";var t=e.i(942347),a=e.i(183683),s=e.i(543289);e.s(["default",0,function(e){s.default&&!(0,a.isFunction)(e)&&console.error('useMount: parameter `fn` expected to be a function, but got "'.concat(typeof e,'".')),(0,t.useEffect)(function(){var t=null==e?void 0:e();if(!t||"object"!=typeof t||"function"!=typeof t.then)return t},[])}])},167574,e=>{"use strict";var t=e.i(676315),a=e.i(751625);t.default.extend(a.default),e.s(["formatTime",0,e=>{let{date:a,dateFormat:s}=e;return(0,t.default)(a).format(s)},"getDaysUntilEndOfMonth",0,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,t.default)(),a=(0,t.default)(e).startOf("day");return Math.max((0,t.default)(e).endOf("month").startOf("day").diff(a,"day"),0)},"isAfter",0,(e,a)=>(0,t.default)(e).isAfter((0,t.default)(a))])},198269,e=>{"use strict";var t=e.i(162115),a=e.i(942347),s=e.i(324935),n=e.i(421001),o=e.i(935139);let r=a.memo(e=>{let{className:a="",isChecked:r,onChange:i,label:l,labelClassName:c,tooltip:d,testId:u}=e;return(0,t.jsxs)("label",{className:(0,o.cn)(a,"flex h-7 items-center space-x-2"),children:[(0,t.jsx)(s.default,{checked:r,onCheck:()=>i(!r),id:u}),(0,t.jsx)("div",{className:(0,o.cn)("text-sm font-normal text-text-secondary",c),children:l}),d&&(0,t.jsx)(n.default,{popupContent:(0,t.jsx)("div",{className:"w-[200px]",children:d}),triggerClassName:"ml-0.5 w-4 h-4"})]})});e.s(["default",0,r])},23651,e=>{"use strict";var t=e.i(343050);e.s(["Tag01",()=>t.default])},207853,e=>{"use strict";var t=e.i(162115),a=e.i(935139);e.s(["default",0,e=>{let{className:s,value:n,onChange:o,options:r}=e;return(0,t.jsx)("div",{"data-testid":"tab-slider-new",className:(0,a.cn)(s,"relative flex"),children:r.map(e=>(0,t.jsxs)("div",{"data-testid":`tab-item-${e.value}`,onClick:()=>o(e.value),className:(0,a.cn)("mr-1 flex h-[32px] cursor-pointer items-center rounded-lg border-[0.5px] border-transparent px-3 py-[7px] text-[13px] font-medium leading-[18px] text-text-tertiary hover:bg-state-base-hover",n===e.value&&"border-components-main-nav-nav-button-border bg-state-base-hover text-components-main-nav-nav-button-text-active shadow-xs"),children:[e.icon,e.text]},e.value))})}])},246913,e=>{"use strict";var t=e.i(429279),a=e.i(291381),s=e.i(676315),n=e.i(630367),o=e.i(751625),r=e.i(893936),i=e.i(942347),l=e.i(59375),c=e.i(751992),d=e.i(421850),u=e.i(327069),p=e.i(218631),m=e.i(948124);s.default.extend(o.default),s.default.extend(n.default);let g=(e,t)=>{if(!e||!t)return!1;let a=(0,s.default)().tz(t).startOf("day"),n=s.default.unix(e).tz(t).startOf("day");return a.isSame(n)||a.isAfter(n)};e.s(["useEducation",0,()=>{let{mutateAsync:e,isPending:a,data:s}=(0,p.useEducationAutocomplete)(),[n,o]=(0,i.useState)([]),r=(0,i.useCallback)(t=>{t.keywords&&e(t).then(e=>{let a=t.page||0,s=e.data;a>0?o(e=>[...e||[],...s]):o(s)})},[e]),{run:l}=(0,t.useDebounceFn)(e=>{r(e)},{wait:300});return{schools:n,setSchools:o,querySchoolsWithDebounced:l,handleUpdateSchools:r,isLoading:a,hasNext:s?.has_next}},"useEducationInit",0,()=>{let e=(0,d.useModalContextSelector)(e=>e.setShowAccountSettingModal),t=(0,d.useModalContextSelector)(e=>e.setShowEducationExpireNoticeModal),s=localStorage.getItem(m.EDUCATION_VERIFYING_LOCALSTORAGE_ITEM),n=(0,r.useSearchParams)().get("action");(e=>{let{onNotice:t}=e,{userProfile:{timezone:s}}=(0,c.useAppContext)(),{educationAccountExpireAt:n,allowRefreshEducationVerify:o,isLoadingEducationAccountInfo:r}=(0,u.useProviderContext)(),[l,d]=(0,a.useLocalStorageState)("education-reverify-prev-expire-at",{defaultValue:0}),[p,m]=(0,a.useLocalStorageState)("education-reverify-has-noticed",{defaultValue:!1}),[h,x]=(0,a.useLocalStorageState)("education-expired-has-noticed",{defaultValue:!1});return(0,i.useEffect)(()=>{if(!r&&s&&o){let e=g(n,s),a=l!==n;a&&(d(n),m(!1),x(!1)),!a&&(e?h:p)||(t({expireAt:n,expired:e}),e?x(!0):m(!0))}},[o,s]),g(n,s)})({onNotice:e=>{t({payload:e})}});let o=(0,r.useRouter)(),{mutateAsync:h}=(0,p.useEducationVerify)(),x=async()=>{let{token:e}=await h();e&&o.push(`/education-apply?token=${e}`)};(0,i.useEffect)(()=>{("yes"===s||n===m.EDUCATION_VERIFY_URL_SEARCHPARAMS_ACTION)&&(e({payload:l.ACCOUNT_SETTING_TAB.BILLING}),n===m.EDUCATION_VERIFY_URL_SEARCHPARAMS_ACTION&&localStorage.setItem(m.EDUCATION_VERIFYING_LOCALSTORAGE_ITEM,"yes")),n===m.EDUCATION_RE_VERIFY_ACTION&&x()},[e,s,n])}])},364203,e=>{"use strict";let t=(0,e.i(534011).create)(e=>({tagList:[],setTagList:t=>e(()=>({tagList:t})),showTagManagementModal:!1,setShowTagManagementModal:t=>e(()=>({showTagManagementModal:t}))}));e.s(["useStore",0,t])},807801,e=>{"use strict";var t=e.i(367916);e.s(["bindTag",0,(e,a,s)=>(0,t.post)("/tag-bindings/create",{body:{tag_ids:e,target_id:a,type:s}}),"createTag",0,(e,a)=>(0,t.post)("/tags",{body:{name:e,type:a}}),"deleteTag",0,e=>(0,t.del)(`/tags/${e}`),"fetchTagList",0,e=>(0,t.get)("/tags",{params:{type:e}}),"unBindTag",0,(e,a,s)=>(0,t.post)("/tag-bindings/remove",{body:{tag_id:e,target_id:a,type:s}}),"updateTag",0,(e,a)=>(0,t.patch)(`/tags/${e}`,{body:{name:a}})])},549770,e=>{"use strict";var t=e.i(3599);e.s(["useMount",()=>t.default])},860053,747271,e=>{"use strict";var t=e.i(162115),a=e.i(429279),s=e.i(549770),n=e.i(942347);e.i(816688);var o=e.i(675066);e.i(77445);var r=e.i(23651),i=e.i(360052),l=e.i(291631),c=e.i(391185),d=e.i(807801),u=e.i(935139),p=e.i(364203);e.s(["default",0,e=>{let{type:m,value:g,onChange:h}=e,{t:x}=(0,o.useTranslation)(),[f,v]=(0,n.useState)(!1),b=(0,p.useStore)(e=>e.tagList),C=(0,p.useStore)(e=>e.setTagList),y=(0,p.useStore)(e=>e.setShowTagManagementModal),[S,w]=(0,n.useState)(""),[N,E]=(0,n.useState)(""),{run:T}=(0,a.useDebounceFn)(()=>{E(S)},{wait:500}),j=e=>{w(e),T()},k=(0,n.useMemo)(()=>b.filter(e=>e.type===m&&e.name.includes(N)),[m,b,N]),D=(0,n.useMemo)(()=>b.find(e=>e.id===g[0]),[g,b]);return(0,s.useMount)(()=>{(0,d.fetchTagList)(m).then(e=>{C(e)})}),(0,t.jsx)(c.PortalToFollowElem,{open:f,onOpenChange:v,placement:"bottom-start",offset:4,children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(c.PortalToFollowElemTrigger,{onClick:()=>v(e=>!e),className:"block",children:(0,t.jsxs)("div",{className:(0,u.cn)("flex h-8 cursor-pointer select-none items-center gap-1 rounded-lg border-[0.5px] border-transparent bg-components-input-bg-normal px-2",!f&&!!g.length&&"shadow-xs",f&&!!g.length&&"shadow-xs"),children:[(0,t.jsx)("div",{className:"p-[1px]",children:(0,t.jsx)(r.Tag01,{className:"h-3.5 w-3.5 text-text-tertiary","data-testid":"tag-filter-trigger-icon"})}),(0,t.jsxs)("div",{className:"text-[13px] leading-[18px] text-text-secondary",children:[!g.length&&x("tag.placeholder",{ns:"common"}),!!g.length&&D?.name]}),g.length>1&&(0,t.jsx)("div",{className:"text-xs font-medium leading-[18px] text-text-tertiary",children:`+${g.length-1}`}),!g.length&&(0,t.jsx)("div",{className:"p-[1px]",children:(0,t.jsx)("span",{className:"i-ri-arrow-down-s-line h-3.5 w-3.5 text-text-tertiary","data-testid":"tag-filter-arrow-down-icon"})}),!!g.length&&(0,t.jsx)("div",{className:"group/clear cursor-pointer p-[1px]",onClick:e=>{e.stopPropagation(),h([])},"data-testid":"tag-filter-clear-button",children:(0,t.jsx)("span",{className:"i-custom-vender-solid-general-x-circle h-3.5 w-3.5 text-text-tertiary group-hover/clear:text-text-secondary"})})]})}),(0,t.jsx)(c.PortalToFollowElemContent,{className:"z-[1002]",children:(0,t.jsxs)("div",{className:"relative w-[240px] rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg backdrop-blur-[5px]",children:[(0,t.jsx)("div",{className:"p-2",children:(0,t.jsx)(l.default,{showLeftIcon:!0,showClearIcon:!0,value:S,onChange:e=>j(e.target.value),onClear:()=>j("")})}),(0,t.jsxs)("div",{className:"max-h-72 overflow-auto p-1",children:[k.map(e=>(0,t.jsxs)("div",{className:"flex cursor-pointer select-none items-center gap-2 rounded-lg py-[6px] pl-3 pr-2 hover:bg-state-base-hover",onClick:()=>{g.includes(e.id)?h(g.filter(t=>t!==e.id)):h([...g,e.id])},children:[(0,t.jsx)("div",{title:e.name,className:"grow truncate text-sm leading-5 text-text-tertiary",children:e.name}),g.includes(e.id)&&(0,t.jsx)("span",{className:"i-custom-vender-line-general-check h-4 w-4 shrink-0 text-text-secondary","data-testid":"tag-filter-selected-icon"})]},e.id)),!k.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1 p-3",children:[(0,t.jsx)(i.Tag03,{className:"h-6 w-6 text-text-tertiary"}),(0,t.jsx)("div",{className:"text-xs leading-[14px] text-text-tertiary",children:x("tag.noTag",{ns:"common"})})]})]}),(0,t.jsx)("div",{className:"border-t-[0.5px] border-divider-regular"}),(0,t.jsx)("div",{className:"p-1",children:(0,t.jsxs)("div",{className:"flex cursor-pointer select-none items-center gap-2 rounded-lg py-[6px] pl-3 pr-2 hover:bg-state-base-hover",onClick:()=>{y(!0),v(!1)},children:[(0,t.jsx)(i.Tag03,{className:"h-4 w-4 text-text-tertiary"}),(0,t.jsx)("div",{className:"grow truncate text-sm leading-5 text-text-secondary",children:x("tag.manageTags",{ns:"common"})})]})})]})})]})})}],860053);var m=e.i(964596),g=e.i(831958),h=e.i(220365),x=e.i(339548),f=e.i(324935),v=e.i(757198),b=e.i(734962);let C=n.memo(e=>{let{t:a}=(0,o.useTranslation)(),{notify:s}=(0,x.useContext)(b.ToastContext),{targetID:r,type:i,value:c,selectedTags:u,onCacheUpdate:m,onChange:C,onCreate:y}=e,S=(0,p.useStore)(e=>e.tagList),w=(0,p.useStore)(e=>e.setTagList),N=(0,p.useStore)(e=>e.setShowTagManagementModal),[E,T]=(0,n.useState)(c),[j,k]=(0,n.useState)(""),D=e=>{k(e)},R=(0,n.useMemo)(()=>S.every(e=>e.type===i&&e.name!==j),[i,S,j]),O=(0,n.useMemo)(()=>u.filter(e=>e.name.includes(j)),[j,u]),I=(0,n.useMemo)(()=>S.filter(e=>e.type===i&&!c.includes(e.id)&&e.name.includes(j)),[i,S,c,j]),[P,A]=(0,n.useState)(!1),M=async()=>{if(j&&!P)try{A(!0);let e=await (0,d.createTag)(j,i);s({type:"success",message:a("tag.created",{ns:"common"})}),w([...S,e]),k(""),A(!1),y()}catch{s({type:"error",message:a("tag.failed",{ns:"common"})}),A(!1)}},F=async e=>{try{await (0,d.bindTag)(e,r,i),s({type:"success",message:a("actionMsg.modifiedSuccessfully",{ns:"common"})})}catch{s({type:"error",message:a("actionMsg.modifiedUnsuccessfully",{ns:"common"})})}},_=async e=>{try{await (0,d.unBindTag)(e,r,i),s({type:"success",message:a("actionMsg.modifiedSuccessfully",{ns:"common"})})}catch{s({type:"error",message:a("actionMsg.modifiedUnsuccessfully",{ns:"common"})})}},B=e=>{E.includes(e.id)?T(E.filter(t=>t!==e.id)):T([...E,e.id])},L=(0,n.useMemo)(()=>c.length===E.length&&c.every(e=>E.includes(e))&&E.every(e=>c.includes(e)),[c,E]);return(0,g.useUnmount)(()=>{if(!L){let e,t,a;e=E.filter(e=>!c.includes(e)),t=c.filter(e=>!E.includes(e)),m(S.filter(e=>E.includes(e.id))),a=[],e.length&&a.push(F(e)),t.length&&a.push(...t.map(e=>_(e))),Promise.all(a).finally(()=>{C&&C()})}}),(0,t.jsxs)("div",{className:"relative w-full rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-bg-blur",children:[(0,t.jsx)("div",{className:"p-2 pb-1",children:(0,t.jsx)(l.default,{showLeftIcon:!0,showClearIcon:!0,value:j,placeholder:a("tag.selectorPlaceholder",{ns:"common"})||"",onChange:e=>D(e.target.value),onClear:()=>D("")})}),j&&R&&(0,t.jsx)("div",{className:"p-1",children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-x-1 rounded-lg px-2 py-1.5 hover:bg-state-base-hover","data-testid":"create-tag-option",onClick:M,children:[(0,t.jsx)("span",{className:"i-ri-add-line h-4 w-4 text-text-tertiary"}),(0,t.jsxs)("div",{className:"grow truncate px-1 text-text-secondary system-md-regular",children:[`${a("tag.create",{ns:"common"})} `,(0,t.jsx)("span",{className:"system-md-medium",children:`'${j}'`})]})]})}),j&&R&&I.length>0&&(0,t.jsx)(v.default,{type:"horizontal",className:"my-0 h-px bg-divider-subtle"}),(I.length>0||O.length>0)&&(0,t.jsxs)("div",{className:"max-h-[232px] overflow-y-auto p-1",children:[O.map(e=>(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-x-1 rounded-lg px-2 py-1.5 hover:bg-state-base-hover",onClick:()=>B(e),"data-testid":"tag-row",children:[(0,t.jsx)(f.default,{className:"shrink-0",checked:E.includes(e.id),onCheck:h.noop,id:e.id}),(0,t.jsx)("div",{title:e.name,className:"grow truncate px-1 text-text-secondary system-md-regular",children:e.name})]},e.id)),I.map(e=>(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-x-1 rounded-lg px-2 py-1.5 hover:bg-state-base-hover",onClick:()=>B(e),"data-testid":"tag-row",children:[(0,t.jsx)(f.default,{className:"shrink-0",checked:E.includes(e.id),onCheck:h.noop,id:e.id}),(0,t.jsx)("div",{title:e.name,className:"grow truncate px-1 text-text-secondary system-md-regular",children:e.name})]},e.id))]}),!j&&!I.length&&!O.length&&(0,t.jsx)("div",{className:"p-1",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-y-1 p-3",children:[(0,t.jsx)("span",{className:"i-ri-price-tag-3-line h-6 w-6 text-text-quaternary"}),(0,t.jsx)("div",{className:"text-text-tertiary system-xs-regular",children:a("tag.noTag",{ns:"common"})})]})}),(0,t.jsx)(v.default,{type:"horizontal",className:"my-0 h-px bg-divider-subtle"}),(0,t.jsx)("div",{className:"p-1",children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-x-1 rounded-lg px-2 py-1.5 hover:bg-state-base-hover",onClick:()=>N(!0),children:[(0,t.jsx)("span",{className:"i-ri-price-tag-3-line h-4 w-4 text-text-tertiary"}),(0,t.jsx)("div",{className:"grow truncate px-1 text-text-secondary system-md-regular",children:a("tag.manageTags",{ns:"common"})})]})})]})}),y=n.memo(e=>{let{tags:a}=e,{t:s}=(0,o.useTranslation)();return(0,t.jsx)("div",{className:"flex w-full cursor-pointer items-center gap-1 overflow-hidden rounded-lg p-1 hover:bg-state-base-hover",children:a.length?(0,t.jsx)(t.Fragment,{children:a.map((e,a)=>(0,t.jsxs)("div",{className:"flex items-center gap-x-0.5 rounded-[5px] border border-divider-deep bg-components-badge-bg-dimm px-[5px] py-[3px]","data-testid":`tag-badge-${a}`,children:[(0,t.jsx)("span",{className:"i-ri-price-tag-3-line h-3 w-3 shrink-0 text-text-quaternary"}),(0,t.jsx)("div",{className:"text-nowrap text-text-tertiary system-2xs-medium-uppercase",children:e})]},a))}):(0,t.jsxs)("div",{className:"flex items-center gap-x-0.5 rounded-[5px] border border-dashed border-divider-deep bg-components-badge-bg-dimm px-[5px] py-[3px]",children:[(0,t.jsx)("span",{className:"i-ri-price-tag-3-line h-3 w-3 shrink-0 text-text-quaternary"}),(0,t.jsx)("div",{className:"text-nowrap text-text-tertiary system-2xs-medium-uppercase",children:s("tag.addTag",{ns:"common"})})]})})});e.s(["default",0,e=>{let{targetID:a,isPopover:s=!0,position:o,type:r,value:i,selectedTags:l,onCacheUpdate:c,onChange:g,minWidth:h}=e,x=(0,p.useStore)(e=>e.tagList),f=(0,p.useStore)(e=>e.setTagList),v=(0,n.useCallback)(async()=>{f(await (0,d.fetchTagList)(r))},[f,r]),b=(0,n.useMemo)(()=>l?.length?l.filter(e=>x.find(t=>t.id===e.id)).map(e=>e.name):[],[l,x]);return(0,t.jsx)(t.Fragment,{children:s&&(0,t.jsx)(m.default,{htmlContent:(0,t.jsx)(C,{type:r,targetID:a,value:i,selectedTags:l,onCacheUpdate:c,onChange:g,onCreate:v}),position:o,trigger:"click",btnElement:(0,t.jsx)(y,{tags:b}),btnClassName:e=>(0,u.cn)(e?"!bg-state-base-hover !text-text-secondary":"!bg-transparent","!w-full !border-0 !p-0 !text-text-tertiary hover:!bg-state-base-hover hover:!text-text-secondary"),popupClassName:(0,u.cn)("!w-full !ring-0",h&&"!min-w-80"),className:"!z-20 h-fit !w-full"})})}],747271)},911641,e=>{"use strict";var t=e.i(942347),a=e.i(887642),s=e.i(620163),n=e.i(594640),o=e.i(306296),r=e.i(344478),i=e.i(611008),l=e.i(682354),c=e.i(892069),d=e.i(67077),u=e.i(586622),p=e.i(894621);function m(e){let{store:m,parentContext:g,actionsRef:h}=e,x=m.useState("open"),f=m.useState("disablePointerDismissal"),v=m.useState("modal"),b=m.useState("popupElement"),{openMethod:C,triggerProps:y}=(0,c.useOpenInteractionType)(x);(0,p.useImplicitActiveTrigger)(m);let{forceUnmount:S}=(0,p.useOpenStateTransitions)(x,m),w=(0,a.useStableCallback)(e=>{let t=(0,d.createChangeEventDetails)(e);return t.preventUnmountOnClose=()=>{m.set("preventUnmountingOnClose",!0)},t}),N=t.useCallback(()=>{m.setOpen(!1,w(u.REASONS.imperativeAction))},[m,w]);t.useImperativeHandle(h,()=>({unmount:S,close:N}),[S,N]);let E=(0,i.useSyncedFloatingRootContext)({popupStore:m,onOpenChange:m.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[T,j]=t.useState(0),k=0===T,D=(0,r.useRole)(E),R=(0,n.useDismiss)(E,{outsidePressEvent:()=>m.context.internalBackdropRef.current||m.context.backdropRef.current?"intentional":{mouse:"trap-focus"===v?"sloppy":"intentional",touch:"sloppy"},outsidePress(e){if(!m.context.outsidePressEnabledRef.current||"button"in e&&0!==e.button||"touches"in e&&1!==e.touches.length)return!1;let t=(0,l.getTarget)(e);return!!k&&!f&&(!v||!m.context.internalBackdropRef.current&&!m.context.backdropRef.current||m.context.internalBackdropRef.current===t||m.context.backdropRef.current===t||(0,l.contains)(t,b)&&!t?.hasAttribute("data-base-ui-portal"))},escapeKey:k});(0,s.useScrollLock)(x&&!0===v,b);let{getReferenceProps:O,getFloatingProps:I,getTriggerProps:P}=(0,o.useInteractions)([D,R]);m.useContextCallback("onNestedDialogOpen",e=>{j(e+1)}),m.useContextCallback("onNestedDialogClose",()=>{j(0)}),t.useEffect(()=>(g?.onNestedDialogOpen&&x&&g.onNestedDialogOpen(T),g?.onNestedDialogClose&&!x&&g.onNestedDialogClose(),()=>{g?.onNestedDialogClose&&x&&g.onNestedDialogClose()}),[x,g,T]);let A=t.useMemo(()=>O(y),[O,y]),M=t.useMemo(()=>P(y),[P,y]),F=t.useMemo(()=>I(),[I]);m.useSyncedValues({openMethod:C,activeTriggerProps:A,inactiveTriggerProps:M,popupProps:F,floatingRootContext:E,nestedOpenDialogCount:T})}e.s(["useDialogRoot",()=>m])},773451,e=>{"use strict";var t=e.i(462902),a=e.i(942347);let s=a.createContext(void 0);function n(e){let n=a.useContext(s);if(!1===e&&void 0===n)throw Error((0,t.default)(27));return n}e.s(["DialogRootContext",0,s,"useDialogRootContext",()=>n])},841943,e=>{"use strict";var t=e.i(942347),a=e.i(596290),s=e.i(370161),n=e.i(771326),o=e.i(87396);let r={...n.popupStoreSelectors,modal:(0,a.createSelector)(e=>e.modal),nested:(0,a.createSelector)(e=>e.nested),nestedOpenDialogCount:(0,a.createSelector)(e=>e.nestedOpenDialogCount),disablePointerDismissal:(0,a.createSelector)(e=>e.disablePointerDismissal),openMethod:(0,a.createSelector)(e=>e.openMethod),descriptionElementId:(0,a.createSelector)(e=>e.descriptionElementId),titleElementId:(0,a.createSelector)(e=>e.titleElementId),viewportElement:(0,a.createSelector)(e=>e.viewportElement),role:(0,a.createSelector)(e=>e.role)};class i extends s.ReactStore{constructor(e){super(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...(0,n.createInitialPopupStoreState)(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}(e),{popupRef:t.createRef(),backdropRef:t.createRef(),internalBackdropRef:t.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new o.PopupTriggerMap,onOpenChange:void 0,onOpenChangeComplete:void 0},r)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||null==this.state.activeTriggerId||(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let a={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",a);let s={open:e},n=t.trigger?.id??null;(n||e)&&(s.activeTriggerId=n,s.activeTriggerElement=t.trigger??null),this.update(s)}}e.s(["DialogStore",()=>i])},136135,160701,232608,969683,892097,385420,e=>{"use strict";e.i(722428);var t,a,s=e.i(942347),n=e.i(773451),o=e.i(581263),r=e.i(845756),i=e.i(809058);let l={...r.popupStateMapping,...i.transitionStatusMapping},c=s.forwardRef(function(e,t){let{render:a,className:s,forceRender:r=!1,...i}=e,{store:c}=(0,n.useDialogRootContext)(),d=c.useState("open"),u=c.useState("nested"),p=c.useState("mounted"),m=c.useState("transitionStatus");return(0,o.useRenderElement)("div",e,{state:{open:d,transitionStatus:m},ref:[c.context.backdropRef,t],stateAttributesMapping:l,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:r||!u})});e.s(["DialogBackdrop",0,c],136135);var d=e.i(282109),u=e.i(67077),p=e.i(586622);let m=s.forwardRef(function(e,t){let{render:a,className:s,disabled:r=!1,nativeButton:i=!0,...l}=e,{store:c}=(0,n.useDialogRootContext)(),m=c.useState("open"),{getButtonProps:g,buttonRef:h}=(0,d.useButton)({disabled:r,native:i});return(0,o.useRenderElement)("button",e,{state:{disabled:r},ref:[t,h],props:[{onClick:function(e){m&&c.setOpen(!1,(0,u.createChangeEventDetails)(p.REASONS.closePress,e.nativeEvent))}},l,g]})});e.s(["DialogClose",0,m],160701);var g=e.i(207516);let h=s.forwardRef(function(e,t){let{render:a,className:s,id:r,...i}=e,{store:l}=(0,n.useDialogRootContext)(),c=(0,g.useBaseUiId)(r);return l.useSyncedValueWithCleanup("descriptionElementId",c),(0,o.useRenderElement)("p",e,{ref:t,props:[{id:c},i]})});e.s(["DialogDescription",0,h],232608);var x=e.i(11931);let f=((t={}).nestedDialogs="--nested-dialogs",t),v=((a={})[a.open=r.CommonPopupDataAttributes.open]="open",a[a.closed=r.CommonPopupDataAttributes.closed]="closed",a[a.startingStyle=r.CommonPopupDataAttributes.startingStyle]="startingStyle",a[a.endingStyle=r.CommonPopupDataAttributes.endingStyle]="endingStyle",a.nested="data-nested",a.nestedDialogOpen="data-nested-dialog-open",a);var b=e.i(462902);let C=s.createContext(void 0);function y(){let e=s.useContext(C);if(void 0===e)throw Error((0,b.default)(26));return e}e.s(["DialogPortalContext",0,C,"useDialogPortalContext",()=>y],969683);var S=e.i(504068),w=e.i(197920),N=e.i(162115);let E={...r.popupStateMapping,...i.transitionStatusMapping,nestedDialogOpen:e=>e?{[v.nestedDialogOpen]:""}:null},T=s.forwardRef(function(e,t){let{className:a,finalFocus:s,initialFocus:r,render:i,...l}=e,{store:c}=(0,n.useDialogRootContext)(),d=c.useState("descriptionElementId"),u=c.useState("disablePointerDismissal"),p=c.useState("floatingRootContext"),m=c.useState("popupProps"),g=c.useState("modal"),h=c.useState("mounted"),v=c.useState("nested"),b=c.useState("nestedOpenDialogCount"),C=c.useState("open"),T=c.useState("openMethod"),j=c.useState("titleElementId"),k=c.useState("transitionStatus"),D=c.useState("role");y(),(0,S.useOpenChangeComplete)({open:C,ref:c.context.popupRef,onComplete(){C&&c.context.onOpenChangeComplete?.(!0)}});let R=void 0===r?function(e){return"touch"!==e||c.context.popupRef.current}:r,O=(0,o.useRenderElement)("div",e,{state:{open:C,nested:v,transitionStatus:k,nestedDialogOpen:b>0},props:[m,{"aria-labelledby":j??void 0,"aria-describedby":d??void 0,role:D,tabIndex:-1,hidden:!h,onKeyDown(e){w.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation()},style:{[f.nestedDialogs]:b}},l],ref:[t,c.context.popupRef,c.useStateSetter("popupElement")],stateAttributesMapping:E});return(0,N.jsx)(x.FloatingFocusManager,{context:p,openInteractionType:T,disabled:!h,closeOnFocusOut:!u,initialFocus:R,returnFocus:s,modal:!1!==g,restoreFocus:"popup",children:O})});e.s(["DialogPopup",0,T],892097);var j=e.i(831766),k=e.i(888393),D=e.i(72287);let R=s.forwardRef(function(e,t){let{keepMounted:a=!1,...s}=e,{store:o}=(0,n.useDialogRootContext)(),r=o.useState("mounted"),i=o.useState("modal"),l=o.useState("open");return r||a?(0,N.jsx)(C.Provider,{value:a,children:(0,N.jsxs)(k.FloatingPortal,{ref:t,...s,children:[r&&!0===i&&(0,N.jsx)(D.InternalBackdrop,{ref:o.context.internalBackdropRef,inert:(0,j.inertValue)(!l)}),e.children]})}):null});e.s(["DialogPortal",0,R],385420)},179046,168868,e=>{"use strict";e.i(722428);var t=e.i(942347),a=e.i(773451),s=e.i(581263),n=e.i(207516);let o=t.forwardRef(function(e,t){let{render:o,className:r,id:i,...l}=e,{store:c}=(0,a.useDialogRootContext)(),d=(0,n.useBaseUiId)(i);return c.useSyncedValueWithCleanup("titleElementId",d),(0,s.useRenderElement)("h2",e,{ref:t,props:[{id:d},l]})});e.s(["DialogTitle",0,o],179046);var r=e.i(462902),i=e.i(282109),l=e.i(845756),c=e.i(693354),d=e.i(894621),u=e.i(430557),p=e.i(306296);let m=t.forwardRef(function(e,o){let{render:m,className:g,disabled:h=!1,nativeButton:x=!0,id:f,payload:v,handle:b,...C}=e,y=(0,a.useDialogRootContext)(!0),S=b?.store??y?.store;if(!S)throw Error((0,r.default)(79));let w=(0,n.useBaseUiId)(f),N=S.useState("floatingRootContext"),E=S.useState("isOpenedByTrigger",w),T=t.useRef(null),{registerTrigger:j,isMountedByThisTrigger:k}=(0,d.useTriggerDataForwarding)(w,T,S,{payload:v}),{getButtonProps:D,buttonRef:R}=(0,i.useButton)({disabled:h,native:x}),O=(0,u.useClick)(N,{enabled:null!=N}),I=(0,p.useInteractions)([O]),P=S.useState("triggerProps",k);return(0,s.useRenderElement)("button",e,{state:{disabled:h,open:E},ref:[R,o,j,T],props:[I.getReferenceProps(),P,{[c.CLICK_TRIGGER_IDENTIFIER]:"",id:w},C,D],stateAttributesMapping:l.triggerOpenStateMapping})});e.s(["DialogTrigger",0,m],168868)},578564,e=>{"use strict";e.i(722428);var t,a=e.i(942347),s=e.i(581263),n=e.i(845756),o=e.i(809058),r=e.i(773451),i=e.i(969683);let l=((t={})[t.open=n.CommonPopupDataAttributes.open]="open",t[t.closed=n.CommonPopupDataAttributes.closed]="closed",t[t.startingStyle=n.CommonPopupDataAttributes.startingStyle]="startingStyle",t[t.endingStyle=n.CommonPopupDataAttributes.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t),c={...n.popupStateMapping,...o.transitionStatusMapping,nested:e=>e?{[l.nested]:""}:null,nestedDialogOpen:e=>e?{[l.nestedDialogOpen]:""}:null},d=a.forwardRef(function(e,t){let{className:a,render:n,children:o,...l}=e,d=(0,i.useDialogPortalContext)(),{store:u}=(0,r.useDialogRootContext)(),p=u.useState("open"),m=u.useState("nested"),g=u.useState("transitionStatus"),h=u.useState("nestedOpenDialogCount"),x=u.useState("mounted");return(0,s.useRenderElement)("div",e,{enabled:d||x,state:{open:p,nested:m,transitionStatus:g,nestedDialogOpen:h>0},ref:[t,u.useStateSetter("viewportElement")],stateAttributesMapping:c,props:[{role:"presentation",hidden:!x,style:{pointerEvents:p?void 0:"none"},children:o},l]})});e.s(["DialogViewport",0,d],578564)},176112,e=>{"use strict";var t=e.i(841943),a=e.i(67077),s=e.i(586622);class n{constructor(e){this.store=e??new t.DialogStore}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;this.store.setOpen(!0,(0,a.createChangeEventDetails)(s.REASONS.imperativeAction,void 0,t))}openWithPayload(e){this.store.set("payload",e),this.store.setOpen(!0,(0,a.createChangeEventDetails)(s.REASONS.imperativeAction,void 0,void 0))}close(){this.store.setOpen(!1,(0,a.createChangeEventDetails)(s.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}function o(){return new n}e.s(["DialogHandle",()=>n,"createDialogHandle",()=>o])},201201,e=>{e.v(t=>Promise.all(["static/chunks/91fcab9a46f25ea7.js","static/chunks/2c4cd9a3d8d54dd7.js","static/chunks/093735e21ea40753.css"].map(t=>e.l(t))).then(()=>t(661305)))},170830,e=>{e.v(e=>Promise.resolve().then(()=>e(81828)))},977869,e=>{e.v(t=>Promise.all(["static/chunks/dc0aa229d9b1b1f5.js"].map(t=>e.l(t))).then(()=>t(23120)))},274156,e=>{e.v(t=>Promise.all(["static/chunks/8a495df5416cb465.js"].map(t=>e.l(t))).then(()=>t(823278)))},778712,e=>{e.v(t=>Promise.all(["static/chunks/a5b09bd482ef487d.js"].map(t=>e.l(t))).then(()=>t(339556)))},606117,e=>{e.v(t=>Promise.all(["static/chunks/c336de58e02d8268.js"].map(t=>e.l(t))).then(()=>t(356881)))},675420,e=>{e.v(t=>Promise.all(["static/chunks/d6e6d934ab3fb2f3.js"].map(t=>e.l(t))).then(()=>t(351332)))},181127,e=>{e.v(t=>Promise.all(["static/chunks/b7513bb004cd89b8.js"].map(t=>e.l(t))).then(()=>t(239024)))},219345,e=>{e.v(t=>Promise.all(["static/chunks/fc3fb89fc2bca26a.js"].map(t=>e.l(t))).then(()=>t(457094)))},622467,e=>{e.v(t=>Promise.all(["static/chunks/d5feea30daaad843.js"].map(t=>e.l(t))).then(()=>t(512728)))},64459,e=>{e.v(t=>Promise.all(["static/chunks/d39632249135fb9b.js"].map(t=>e.l(t))).then(()=>t(903565)))}]);