(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,525518,e=>{"use strict";let{entries:t,setPrototypeOf:n,isFrozen:a,getPrototypeOf:r,getOwnPropertyDescriptor:s}=Object,{freeze:i,seal:l,create:o}=Object,{apply:c,construct:u}="u">typeof Reflect&&Reflect;i||(i=function(e){return e}),l||(l=function(e){return e}),c||(c=function(e,t){for(var n=arguments.length,a=Array(n>2?n-2:0),r=2;r1?t-1:0),a=1;a1?n-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:g;n&&n(e,null);let s=t.length;for(;s--;){let n=t[s];if("string"==typeof n){let e=r(n);e!==n&&(a(t)||(t[s]=e),n=e)}e[n]=!0}return e}function I(e){let n=o(null);for(let[a,r]of t(e))E(e,a)&&(Array.isArray(r)?n[a]=function(e){for(let t=0;t/gm),B=l(/\$\{[\w\W]*/gm),G=l(/^data-[\-\w.\u00B7-\uFFFF]+$/),H=l(/^aria-[\-\w]+$/),z=l(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=l(/^(?:\w+script|data):/i),W=l(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Q=l(/^html$/i);var $,Y=Object.freeze({__proto__:null,ARIA_ATTR:H,ATTR_WHITESPACE:W,CUSTOM_ELEMENT:l(/^[a-z][.\w]*(-[.\w]+)+$/i),DATA_ATTR:G,DOCTYPE_NAME:Q,ERB_EXPR:q,IS_ALLOWED_URI:z,IS_SCRIPT_OR_DATA:V,MUSTACHE_EXPR:K,TMPLIT_EXPR:B});let Z=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null,a="data-tt-policy-suffix";t&&t.hasAttribute(a)&&(n=t.getAttribute(a));let r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}},X=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};var J=function e(){let n,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"u"e(t);if(r.version="3.3.3",r.removed=[],!a||!a.document||9!==a.document.nodeType||!a.Element)return r.isSupported=!1,r;let{document:s}=a,l=s,c=l.currentScript,{DocumentFragment:u,HTMLTemplateElement:w,Node:K,Element:q,NodeFilter:B,NamedNodeMap:G=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:H,DOMParser:V,trustedTypes:W}=a,$=q.prototype,J=_($,"cloneNode"),ee=_($,"remove"),et=_($,"nextSibling"),en=_($,"childNodes"),ea=_($,"parentNode");if("function"==typeof w){let e=s.createElement("template");e.content&&e.content.ownerDocument&&(s=e.content.ownerDocument)}let er="",{implementation:es,createNodeIterator:ei,createDocumentFragment:el,getElementsByTagName:eo}=s,{importNode:ec}=l,eu=X();r.isSupported="function"==typeof t&&"function"==typeof ea&&es&&void 0!==es.createHTMLDocument;let{MUSTACHE_EXPR:ed,ERB_EXPR:ep,TMPLIT_EXPR:em,DATA_ATTR:ef,ARIA_ATTR:eh,IS_SCRIPT_OR_DATA:eg,ATTR_WHITESPACE:ev,CUSTOM_ELEMENT:ex}=Y,{IS_ALLOWED_URI:ey}=Y,eb=null,eC=N({},[...k,...T,...j,...D,...O]),eE=null,eA=N({},[...P,...L,...F,...U]),eS=Object.seal(o(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}})),ew=null,eN=null,eI=Object.seal(o(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),e_=!0,ek=!0,eT=!1,ej=!0,eM=!1,eD=!0,eR=!1,eO=!1,eP=!1,eL=!1,eF=!1,eU=!1,eK=!0,eq=!1,eB=!0,eG=!1,eH={},ez=null,eV=N({},["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"]),eW=null,eQ=N({},["audio","video","img","source","image","track"]),e$=null,eY=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),eZ="http://www.w3.org/1998/Math/MathML",eX="http://www.w3.org/2000/svg",eJ="http://www.w3.org/1999/xhtml",e0=eJ,e1=!1,e2=null,e5=N({},[eZ,eX,eJ],v),e7=N({},["mi","mo","mn","ms","mtext"]),e9=N({},["annotation-xml"]),e4=N({},["title","style","font","a","script"]),e3=null,e8=["application/xhtml+xml","text/html"],e6=null,te=null,tt=s.createElement("form"),tn=function(e){return e instanceof RegExp||e instanceof Function},ta=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!te||te!==e){if(e&&"object"==typeof e||(e={}),e=I(e),e6="application/xhtml+xml"===(e3=-1===e8.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE)?v:g,eb=E(e,"ALLOWED_TAGS")?N({},e.ALLOWED_TAGS,e6):eC,eE=E(e,"ALLOWED_ATTR")?N({},e.ALLOWED_ATTR,e6):eA,e2=E(e,"ALLOWED_NAMESPACES")?N({},e.ALLOWED_NAMESPACES,v):e5,e$=E(e,"ADD_URI_SAFE_ATTR")?N(I(eY),e.ADD_URI_SAFE_ATTR,e6):eY,eW=E(e,"ADD_DATA_URI_TAGS")?N(I(eQ),e.ADD_DATA_URI_TAGS,e6):eQ,ez=E(e,"FORBID_CONTENTS")?N({},e.FORBID_CONTENTS,e6):eV,ew=E(e,"FORBID_TAGS")?N({},e.FORBID_TAGS,e6):I({}),eN=E(e,"FORBID_ATTR")?N({},e.FORBID_ATTR,e6):I({}),eH=!!E(e,"USE_PROFILES")&&e.USE_PROFILES,e_=!1!==e.ALLOW_ARIA_ATTR,ek=!1!==e.ALLOW_DATA_ATTR,eT=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ej=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,eM=e.SAFE_FOR_TEMPLATES||!1,eD=!1!==e.SAFE_FOR_XML,eR=e.WHOLE_DOCUMENT||!1,eL=e.RETURN_DOM||!1,eF=e.RETURN_DOM_FRAGMENT||!1,eU=e.RETURN_TRUSTED_TYPE||!1,eP=e.FORCE_BODY||!1,eK=!1!==e.SANITIZE_DOM,eq=e.SANITIZE_NAMED_PROPS||!1,eB=!1!==e.KEEP_CONTENT,eG=e.IN_PLACE||!1,ey=e.ALLOWED_URI_REGEXP||z,e0=e.NAMESPACE||eJ,e7=e.MATHML_TEXT_INTEGRATION_POINTS||e7,e9=e.HTML_INTEGRATION_POINTS||e9,eS=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&tn(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(eS.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&tn(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(eS.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(eS.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),eM&&(ek=!1),eF&&(eL=!0),eH&&(eb=N({},O),eE=o(null),!0===eH.html&&(N(eb,k),N(eE,P)),!0===eH.svg&&(N(eb,T),N(eE,L),N(eE,U)),!0===eH.svgFilters&&(N(eb,j),N(eE,L),N(eE,U)),!0===eH.mathMl&&(N(eb,D),N(eE,F),N(eE,U))),E(e,"ADD_TAGS")||(eI.tagCheck=null),E(e,"ADD_ATTR")||(eI.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?eI.tagCheck=e.ADD_TAGS:(eb===eC&&(eb=I(eb)),N(eb,e.ADD_TAGS,e6))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?eI.attributeCheck=e.ADD_ATTR:(eE===eA&&(eE=I(eE)),N(eE,e.ADD_ATTR,e6))),e.ADD_URI_SAFE_ATTR&&N(e$,e.ADD_URI_SAFE_ATTR,e6),e.FORBID_CONTENTS&&(ez===eV&&(ez=I(ez)),N(ez,e.FORBID_CONTENTS,e6)),e.ADD_FORBID_CONTENTS&&(ez===eV&&(ez=I(ez)),N(ez,e.ADD_FORBID_CONTENTS,e6)),eB&&(eb["#text"]=!0),eR&&N(eb,["html","head","body"]),eb.table&&(N(eb,["tbody"]),delete ew.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw S('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw S('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');er=(n=e.TRUSTED_TYPES_POLICY).createHTML("")}else void 0===n&&(n=Z(W,c)),null!==n&&"string"==typeof er&&(er=n.createHTML(""));i&&i(e),te=e}},tr=N({},[...T,...j,...M]),ts=N({},[...D,...R]),ti=function(e){let t=ea(e);t&&t.tagName||(t={namespaceURI:e0,tagName:"template"});let n=g(e.tagName),a=g(t.tagName);return!!e2[e.namespaceURI]&&(e.namespaceURI===eX?t.namespaceURI===eJ?"svg"===n:t.namespaceURI===eZ?"svg"===n&&("annotation-xml"===a||e7[a]):!!tr[n]:e.namespaceURI===eZ?t.namespaceURI===eJ?"math"===n:t.namespaceURI===eX?"math"===n&&e9[a]:!!ts[n]:e.namespaceURI===eJ?(t.namespaceURI!==eX||!!e9[a])&&(t.namespaceURI!==eZ||!!e7[a])&&!ts[n]&&(e4[n]||!tr[n]):"application/xhtml+xml"===e3&&!!e2[e.namespaceURI])},tl=function(e){f(r.removed,{element:e});try{ea(e).removeChild(e)}catch(t){ee(e)}},to=function(e,t){try{f(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){f(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(eL||eF)try{tl(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},tc=function(e){let t=null,a=null;if(eP)e=""+e;else{let t=x(e,/^[\r\n\t ]+/);a=t&&t[0]}"application/xhtml+xml"===e3&&e0===eJ&&(e=''+e+"");let r=n?n.createHTML(e):e;if(e0===eJ)try{t=new V().parseFromString(r,e3)}catch(e){}if(!t||!t.documentElement){t=es.createDocument(e0,"template",null);try{t.documentElement.innerHTML=e1?er:r}catch(e){}}let i=t.body||t.documentElement;return(e&&a&&i.insertBefore(s.createTextNode(a),i.childNodes[0]||null),e0===eJ)?eo.call(t,eR?"html":"body")[0]:eR?t.documentElement:i},tu=function(e){return ei.call(e.ownerDocument||e,e,B.SHOW_ELEMENT|B.SHOW_COMMENT|B.SHOW_TEXT|B.SHOW_PROCESSING_INSTRUCTION|B.SHOW_CDATA_SECTION,null)},td=function(e){return e instanceof H&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof G)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},tp=function(e){return"function"==typeof K&&e instanceof K};function tm(e,t,n){d(e,e=>{e.call(r,t,n,te)})}let tf=function(e){let t=null;if(tm(eu.beforeSanitizeElements,e,null),td(e))return tl(e),!0;let n=e6(e.nodeName);if(tm(eu.uponSanitizeElement,e,{tagName:n,allowedTags:eb}),eD&&e.hasChildNodes()&&!tp(e.firstElementChild)&&A(/<[/\w!]/g,e.innerHTML)&&A(/<[/\w!]/g,e.textContent)||7===e.nodeType||eD&&8===e.nodeType&&A(/<[/\w]/g,e.data))return tl(e),!0;if(!(eI.tagCheck instanceof Function&&eI.tagCheck(n))&&(!eb[n]||ew[n])){if(!ew[n]&&tg(n)&&(eS.tagNameCheck instanceof RegExp&&A(eS.tagNameCheck,n)||eS.tagNameCheck instanceof Function&&eS.tagNameCheck(n)))return!1;if(eB&&!ez[n]){let t=ea(e)||e.parentNode,n=en(e)||e.childNodes;if(n&&t){let a=n.length;for(let r=a-1;r>=0;--r){let a=J(n[r],!0);a.__removalCount=(e.__removalCount||0)+1,t.insertBefore(a,et(e))}}}return tl(e),!0}return e instanceof q&&!ti(e)||("noscript"===n||"noembed"===n||"noframes"===n)&&A(/<\/no(script|embed|frames)/i,e.innerHTML)?(tl(e),!0):(eM&&3===e.nodeType&&(t=e.textContent,d([ed,ep,em],e=>{t=y(t,e," ")}),e.textContent!==t&&(f(r.removed,{element:e.cloneNode()}),e.textContent=t)),tm(eu.afterSanitizeElements,e,null),!1)},th=function(e,t,n){if(eN[t]||eK&&("id"===t||"name"===t)&&(n in s||n in tt))return!1;if(ek&&!eN[t]&&A(ef,t));else if(e_&&A(eh,t));else if(eI.attributeCheck instanceof Function&&eI.attributeCheck(t,e));else if(!eE[t]||eN[t]){if(!(tg(e)&&(eS.tagNameCheck instanceof RegExp&&A(eS.tagNameCheck,e)||eS.tagNameCheck instanceof Function&&eS.tagNameCheck(e))&&(eS.attributeNameCheck instanceof RegExp&&A(eS.attributeNameCheck,t)||eS.attributeNameCheck instanceof Function&&eS.attributeNameCheck(t,e))||"is"===t&&eS.allowCustomizedBuiltInElements&&(eS.tagNameCheck instanceof RegExp&&A(eS.tagNameCheck,n)||eS.tagNameCheck instanceof Function&&eS.tagNameCheck(n))))return!1}else if(e$[t]);else if(A(ey,y(n,ev,"")));else if(("src"===t||"xlink:href"===t||"href"===t)&&"script"!==e&&0===b(n,"data:")&&eW[e]);else if(eT&&!A(eg,y(n,ev,"")));else if(n)return!1;return!0},tg=function(e){return"annotation-xml"!==e&&x(e,ex)},tv=function(e){tm(eu.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||td(e))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:eE,forceKeepAttr:void 0},s=t.length;for(;s--;){let{name:i,namespaceURI:l,value:o}=t[s],c=e6(i),u="value"===i?o:C(o);if(a.attrName=c,a.attrValue=u,a.keepAttr=!0,a.forceKeepAttr=void 0,tm(eu.uponSanitizeAttribute,e,a),u=a.attrValue,eq&&("id"===c||"name"===c)&&(to(i,e),u="user-content-"+u),eD&&A(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)||"attributename"===c&&x(u,"href")){to(i,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr||!ej&&A(/\/>/i,u)){to(i,e);continue}eM&&d([ed,ep,em],e=>{u=y(u,e," ")});let p=e6(e.nodeName);if(!th(p,c,u)){to(i,e);continue}if(n&&"object"==typeof W&&"function"==typeof W.getAttributeType)if(l);else switch(W.getAttributeType(p,c)){case"TrustedHTML":u=n.createHTML(u);break;case"TrustedScriptURL":u=n.createScriptURL(u)}if(u!==o)try{l?e.setAttributeNS(l,i,u):e.setAttribute(i,u),td(e)?tl(e):m(r.removed)}catch(t){to(i,e)}}tm(eu.afterSanitizeAttributes,e,null)},tx=function e(t){let n=null,a=tu(t);for(tm(eu.beforeSanitizeShadowDOM,t,null);n=a.nextNode();)tm(eu.uponSanitizeShadowNode,n,null),tf(n),tv(n),n.content instanceof u&&e(n.content);tm(eu.afterSanitizeShadowDOM,t,null)};return r.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null,s=null,i=null,o=null;if((e1=!e)&&(e=""),"string"!=typeof e&&!tp(e))if("function"==typeof e.toString){if("string"!=typeof(e=e.toString()))throw S("dirty is not a string, aborting")}else throw S("toString is not a function");if(!r.isSupported)return e;if(eO||ta(t),r.removed=[],"string"==typeof e&&(eG=!1),eG){if(e.nodeName){let t=e6(e.nodeName);if(!eb[t]||ew[t])throw S("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof K)1===(s=(a=tc("")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?a=s:a.appendChild(s);else{if(!eL&&!eM&&!eR&&-1===e.indexOf("<"))return n&&eU?n.createHTML(e):e;if(!(a=tc(e)))return eL?null:eU?er:""}a&&eP&&tl(a.firstChild);let c=tu(eG?e:a);for(;i=c.nextNode();)tf(i),tv(i),i.content instanceof u&&tx(i.content);if(eG)return e;if(eL){if(eF)for(o=el.call(a.ownerDocument);a.firstChild;)o.appendChild(a.firstChild);else o=a;return(eE.shadowroot||eE.shadowrootmode)&&(o=ec.call(l,o,!0)),o}let p=eR?a.outerHTML:a.innerHTML;return eR&&eb["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&A(Q,a.ownerDocument.doctype.name)&&(p="\n"+p),eM&&d([ed,ep,em],e=>{p=y(p,e," ")}),n&&eU?n.createHTML(p):p},r.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ta(e),eO=!0},r.clearConfig=function(){te=null,eO=!1},r.isValidAttribute=function(e,t,n){return te||ta({}),th(e6(e),e6(t),n)},r.addHook=function(e,t){"function"==typeof t&&f(eu[e],t)},r.removeHook=function(e,t){if(void 0!==t){let n=p(eu[e],t);return -1===n?void 0:h(eu[e],n,1)[0]}return m(eu[e])},r.removeHooks=function(e){eu[e]=[]},r.removeAllHooks=function(){eu=X()},r}();e.s(["default",()=>J])},241661,e=>{"use strict";var t=e.i(162115);e.s([],678787),e.i(678787),e.i(722428);var n=e.i(942347),a=e.i(581263),r=e.i(462902);let s=n.createContext(void 0);function i(){let e=n.useContext(s);if(void 0===e)throw Error((0,r.default)(13));return e}let l={imageLoadingStatus:()=>null},o=n.forwardRef(function(e,r){let{className:i,render:o,...c}=e,[u,d]=n.useState("idle"),p=n.useMemo(()=>({imageLoadingStatus:u,setImageLoadingStatus:d}),[u,d]),m=(0,a.useRenderElement)("span",e,{state:{imageLoadingStatus:u},ref:r,props:c,stateAttributesMapping:l});return(0,t.jsx)(s.Provider,{value:p,children:m})});var c=e.i(887642),u=e.i(804849),d=e.i(504068),p=e.i(809058),m=e.i(193214),f=e.i(954588);let h={...l,...p.transitionStatusMapping},g=n.forwardRef(function(e,t){let{className:r,render:s,onLoadingStatusChange:l,referrerPolicy:o,crossOrigin:p,...g}=e,v=i(),x=function(e,t){let{referrerPolicy:a,crossOrigin:r}=t,[s,i]=n.useState("idle");return(0,u.useIsoLayoutEffect)(()=>{if(!e)return i("error"),f.NOOP;let t=!0,n=new window.Image,s=e=>()=>{t&&i(e)};return i("loading"),n.onload=s("loaded"),n.onerror=s("error"),a&&(n.referrerPolicy=a),n.crossOrigin=r??null,n.src=e,()=>{t=!1}},[e,r,a]),s}(e.src,{referrerPolicy:o,crossOrigin:p}),y="loaded"===x,{mounted:b,transitionStatus:C,setMounted:E}=(0,m.useTransitionStatus)(y),A=n.useRef(null),S=(0,c.useStableCallback)(e=>{l?.(e),v.setImageLoadingStatus(e)});(0,u.useIsoLayoutEffect)(()=>{"idle"!==x&&S(x)},[x,S]),(0,d.useOpenChangeComplete)({open:y,ref:A,onComplete(){y||E(!1)}});let w=(0,a.useRenderElement)("img",e,{state:{imageLoadingStatus:x,transitionStatus:C},ref:[t,A],props:g,stateAttributesMapping:h,enabled:b});return b?w:null});var v=e.i(161476);let x=n.forwardRef(function(e,t){let{className:r,render:s,delay:o,...c}=e,{imageLoadingStatus:u}=i(),[d,p]=n.useState(void 0===o),m=(0,v.useTimeout)();return n.useEffect(()=>(void 0!==o&&m.start(o,()=>p(!0)),m.clear),[m,o]),(0,a.useRenderElement)("span",e,{state:{imageLoadingStatus:u},ref:t,props:c,stateAttributesMapping:l,enabled:"loaded"!==u&&d})});e.s(["Fallback",0,x,"Image",0,g,"Root",0,o],129448);var y=e.i(129448),y=y,b=e.i(935139);let C={xxs:{root:"size-4",text:"text-[7px]"},xs:{root:"size-5",text:"text-[8px]"},sm:{root:"size-6",text:"text-[10px]"},md:{root:"size-8",text:"text-xs"},lg:{root:"size-9",text:"text-sm"},xl:{root:"size-10",text:"text-base"},"2xl":{root:"size-12",text:"text-xl"},"3xl":{root:"size-16",text:"text-2xl"}};e.s(["Avatar",0,e=>{let{name:n,avatar:a,size:r="md",className:s,onLoadingStatusChange:i}=e,l=C[r];return(0,t.jsxs)(y.Root,{className:(0,b.cn)("relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden rounded-full bg-primary-600",l.root,s),children:[a&&(0,t.jsx)(y.Image,{src:a,alt:n,className:"absolute inset-0 size-full object-cover",onLoadingStatusChange:i}),(0,t.jsx)(y.Fallback,{className:(0,b.cn)("font-medium text-white",l.text),children:n?.[0]?.toLocaleUpperCase()})]})}],241661)},225244,e=>{"use strict";var t=e.i(766271),n=e.i(688271),a=e.i(890564),r=e.i(868729),s=e.i(830616),i=e.i(464837),l=e.i(367916),o=e.i(722384);let c="dataset",u=[c,"list"],d=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{page:t=1,limit:n,ids:a,tag_ids:r,include_all:s,keyword:i}=e;return{page:t,...n?{limit:n}:{},...a?.length?{ids:a}:{},...r?.length?{tag_ids:r}:{},...void 0!==s?{include_all:s}:{},...i?{keyword:i}:{}}},p=[c,"detail"];e.s(["datasetDetailQueryKeyPrefix",0,p,"useDatasetApiBaseUrl",0,()=>(0,r.useQuery)({queryKey:[c,"api-base-info"],queryFn:()=>(0,l.get)("/datasets/api-base-info")}),"useDatasetApiKeys",0,e=>(0,r.useQuery)({queryKey:[c,"api-keys"],queryFn:()=>(0,l.get)("/datasets/api-keys"),enabled:e?.enabled??!0}),"useDatasetDetail",0,e=>(0,r.useQuery)({queryKey:[...p,e],queryFn:()=>(0,l.get)(`/datasets/${e}`),enabled:!!e}),"useDatasetErrorDocs",0,e=>(0,r.useQuery)({queryKey:[c,"error-docs",e],queryFn:()=>(0,l.get)(`/datasets/${e}/error-docs`),enabled:!!e}),"useDatasetList",0,e=>{let{initialPage:t,tag_ids:a,limit:r,include_all:s,keyword:o}=e;return(0,n.useInfiniteQuery)({queryKey:[...u,t,a,r,s,o],queryFn:e=>{let{pageParam:t=1}=e,n=i.default.stringify({tag_ids:a,limit:r,include_all:s,keyword:o,page:t},{indices:!1});return(0,l.get)(`/datasets?${n}`)},getNextPageParam:e=>e.has_more?e.page+1:null,initialPageParam:t})},"useDatasetRelatedApps",0,e=>(0,r.useQuery)({queryKey:[c,"related-apps",e],queryFn:()=>(0,l.get)(`/datasets/${e}/related-apps`)}),"useDatasetTestingRecords",0,(e,n)=>(0,r.useQuery)({queryKey:[c,"testing-records",e,n],queryFn:()=>(0,l.get)(`/datasets/${e}/queries`,{params:n}),enabled:!!e&&!!n,placeholderData:t.keepPreviousData}),"useDisableDatasetServiceApi",0,()=>(0,a.useMutation)({mutationKey:[c,"disable-api"],mutationFn:e=>(0,l.post)(`/datasets/${e}/api-keys/disable`)}),"useEnableDatasetServiceApi",0,()=>(0,a.useMutation)({mutationKey:[c,"enable-api"],mutationFn:e=>(0,l.post)(`/datasets/${e}/api-keys/enable`)}),"useExternalKnowledgeApiList",0,e=>(0,r.useQuery)({queryKey:[c,"external-knowledge-api"],queryFn:()=>(0,l.get)("/datasets/external-knowledge-api"),enabled:e?.enabled??!0}),"useIndexingStatusBatch",0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{datasetId:n,batchId:r}=e;return(0,a.useMutation)({mutationKey:[c,"indexing-status-batch",n,r],mutationFn:()=>(0,l.get)(`/datasets/${n}/batch/${r}/indexing-status`),...t})},"useInfiniteDatasets",0,(e,t)=>{let a=d(e);return(0,n.useInfiniteQuery)({queryKey:[...u,"infinite",a],queryFn:e=>{let t,{pageParam:n=a.page}=e;return(0,l.get)((t=i.default.stringify({...a,page:n??a.page},{indices:!1}),`/datasets?${t}`))},getNextPageParam:e=>e.has_more?e.page+1:void 0,initialPageParam:a.page,staleTime:0,refetchOnMount:"always",...t})},"useInvalidDatasetList",0,()=>(0,o.useInvalid)([...u]),"useInvalidateDatasetApiKeys",0,()=>{let e=(0,s.useQueryClient)();return()=>{e.invalidateQueries({queryKey:[c,"api-keys"]})}},"useProcessRule",0,e=>(0,r.useQuery)({queryKey:[c,"process-rule",e],queryFn:()=>(0,l.get)("/datasets/process-rule",{params:{document_id:e}}),enabled:!!e,refetchOnWindowFocus:!1})])},751818,e=>{"use strict";var t=function(){var t="ampIntegrationContext";return"u">typeof globalThis&&void 0!==globalThis[t]?globalThis[t]:"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof self?self:e.g};e.s(["getGlobalScope",()=>t])},601217,e=>{"use strict";let t,n,a,r,s=(e,t)=>t.some(t=>e instanceof t),i=new WeakMap,l=new WeakMap,o=new WeakMap,c={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return i.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return u(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function u(e){if(e instanceof IDBRequest){let t;return t=new Promise((t,n)=>{let a=()=>{e.removeEventListener("success",r),e.removeEventListener("error",s)},r=()=>{t(u(e.result)),a()},s=()=>{n(e.error),a()};e.addEventListener("success",r),e.addEventListener("error",s)}),o.set(t,e),t}if(l.has(e))return l.get(e);let t=function(e){if("function"==typeof e)return(r||(r=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(){for(var t=arguments.length,n=Array(t),a=0;a{let a=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",s),e.removeEventListener("abort",s)},r=()=>{t(),a()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),a()};e.addEventListener("complete",r),e.addEventListener("error",s),e.addEventListener("abort",s)});i.set(e,t)}(e),s(e,a||(a=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(e,c):e}(e);return t!==e&&(l.set(e,t),o.set(t,e)),t}let d=e=>o.get(e);function p(e,t){let{blocked:n,upgrade:a,blocking:r,terminated:s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=indexedDB.open(e,t),l=u(i);return a&&i.addEventListener("upgradeneeded",e=>{a(u(i.result),e.oldVersion,e.newVersion,u(i.transaction),e)}),n&&i.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),l.then(e=>{s&&e.addEventListener("close",()=>s()),r&&e.addEventListener("versionchange",e=>r(e.oldVersion,e.newVersion,e))}).catch(()=>{}),l}let m=["get","getKey","getAll","getAllKeys","count"],f=["put","add","delete","clear"],h=new Map;function g(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(h.get(t))return h.get(t);let n=t.replace(/FromIndex$/,""),a=t!==n,r=f.includes(n);if(!(n in(a?IDBIndex:IDBObjectStore).prototype)||!(r||m.includes(n)))return;let s=async function(e){for(var t=arguments.length,s=Array(t>1?t-1:0),i=1;ig(e,n)||t.get(e,n,a),has:(e,n)=>!!g(e,n)||t.has(e,n)};let v=["continue","continuePrimaryKey","advance"],x={},y=new WeakMap,b=new WeakMap,C={get(e,t){if(!v.includes(t))return e[t];let n=x[t];return n||(n=x[t]=function(){for(var e=arguments.length,n=Array(e),a=0;aA(e,t)?E:n.get(e,t,a),has:(e,t)=>A(e,t)||n.has(e,t)},e.s(["openDB",()=>p])},201987,e=>{"use strict";e.i(512006),e.i(207331),e.s([])},465497,e=>{"use strict";var t=e.i(162115),n=e.i(935139);e.s(["SkeletonContainer",0,e=>{let{className:a,children:r,...s}=e;return(0,t.jsx)("div",{className:(0,n.cn)("flex flex-col gap-1",a),...s,children:r})},"SkeletonPoint",0,e=>{let{className:a,...r}=e;return(0,t.jsx)("div",{className:(0,n.cn)("text-xs font-medium text-text-quaternary",a),...r,children:"·"})},"SkeletonRectangle",0,e=>{let{className:a,children:r,...s}=e;return(0,t.jsx)("div",{className:(0,n.cn)("my-1 h-2 rounded-sm bg-text-quaternary opacity-20",a),...s,children:r})},"SkeletonRow",0,e=>{let{className:a,children:r,...s}=e;return(0,t.jsx)("div",{className:(0,n.cn)("flex items-center gap-2",a),...s,children:r})}])},101387,e=>{"use strict";let t,n,a;var r=e.i(508757),s=e.i(502611),i=e.i(942347),l=e.i(939050),o=e.i(511299),c=e.i(704903),u=e.i(255073),d=e.i(88206),p=e.i(84148),m=e.i(767104),f=e.i(637759),h=e.i(918031),g=e.i(602874),v=e.i(22091),x=e.i(791764),y=e.i(627493),b=e.i(479936),C=e.i(749744),E=e.i(983877),A=e.i(318605),S=e.i(259416),w=e.i(775085),N=e.i(617829),I=e.i(644635),_=e.i(324798),k=e.i(242904),T=e.i(154260),j=e.i(566136),M=e.i(273293),D=e.i(314608),R=e.i(278650),O=e.i(621621),P=e.i(64123),L=e.i(360538),F=e.i(134874),U=e.i(470045),K=e.i(282595),q=e.i(872116),B=e.i(857374),G=e.i(77793),H=Object.defineProperty,z=(e,t,n)=>{let a;return(a="symbol"!=typeof t?t+"":t)in e?H(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,n},V=((t=V||{})[t.Open=0]="Open",t[t.Closed=1]="Closed",t),W=((n=W||{})[n.Pointer=0]="Pointer",n[n.Other=1]="Other",n),Q=((a=Q||{})[a.OpenMenu=0]="OpenMenu",a[a.CloseMenu=1]="CloseMenu",a[a.GoToItem=2]="GoToItem",a[a.Search=3]="Search",a[a.ClearSearch=4]="ClearSearch",a[a.RegisterItems=5]="RegisterItems",a[a.UnregisterItems=6]="UnregisterItems",a[a.SetButtonElement=7]="SetButtonElement",a[a.SetItemsElement=8]="SetItemsElement",a[a.SortItems=9]="SortItems",a[a.MarkButtonAsMoved=10]="MarkButtonAsMoved",a);function $(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e,n=null!==e.activeItemIndex?e.items[e.activeItemIndex]:null,a=(0,R.sortByDomNode)(t(e.items.slice()),e=>e.dataRef.current.domRef.current),r=n?a.indexOf(n):null;return -1===r&&(r=null),{items:a,activeItemIndex:r}}let Y={1(e){if(1===e.menuState)return e;let t=e.buttonElement?G.ElementPositionState.Tracked((0,G.computeVisualPosition)(e.buttonElement)):e.buttonPositionState;return{...e,activeItemIndex:null,pendingFocus:{focus:j.Focus.Nothing},menuState:1,buttonPositionState:t}},0:(e,t)=>0===e.menuState?e:{...e,__demoMode:!1,pendingFocus:t.focus,menuState:0,buttonPositionState:G.ElementPositionState.Idle},2:(e,t)=>{var n,a,r,s,i;if(1===e.menuState)return e;let l={...e,searchQuery:"",activationTrigger:null!=(n=t.trigger)?n:1,__demoMode:!1};if(t.focus===j.Focus.Nothing)return{...l,activeItemIndex:null};if(t.focus===j.Focus.Specific)return{...l,activeItemIndex:e.items.findIndex(e=>e.id===t.id)};if(t.focus===j.Focus.Previous){let n=e.activeItemIndex;if(null!==n){let s=e.items[n].dataRef.current.domRef,i=(0,j.calculateActiveIndex)(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});if(null!==i){let t=e.items[i].dataRef.current.domRef;if((null==(a=s.current)?void 0:a.previousElementSibling)===t.current||(null==(r=t.current)?void 0:r.previousElementSibling)===null)return{...l,activeItemIndex:i}}}}else if(t.focus===j.Focus.Next){let n=e.activeItemIndex;if(null!==n){let a=e.items[n].dataRef.current.domRef,r=(0,j.calculateActiveIndex)(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});if(null!==r){let t=e.items[r].dataRef.current.domRef;if((null==(s=a.current)?void 0:s.nextElementSibling)===t.current||(null==(i=t.current)?void 0:i.nextElementSibling)===null)return{...l,activeItemIndex:r}}}}let o=$(e),c=(0,j.calculateActiveIndex)(t,{resolveItems:()=>o.items,resolveActiveIndex:()=>o.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...l,...o,activeItemIndex:c}},3:(e,t)=>{let n=+(""===e.searchQuery),a=e.searchQuery+t.value.toLowerCase(),r=(null!==e.activeItemIndex?e.items.slice(e.activeItemIndex+n).concat(e.items.slice(0,e.activeItemIndex+n)):e.items).find(e=>{var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(a))&&!e.dataRef.current.disabled}),s=r?e.items.indexOf(r):-1;return -1===s||s===e.activeItemIndex?{...e,searchQuery:a}:{...e,searchQuery:a,activeItemIndex:s,activationTrigger:1}},4:e=>""===e.searchQuery?e:{...e,searchQuery:"",searchActiveItemIndex:null},5:(e,t)=>{let n=e.items.concat(t.items.map(e=>e)),a=e.activeItemIndex;return e.pendingFocus.focus!==j.Focus.Nothing&&(a=(0,j.calculateActiveIndex)(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled})),{...e,items:n,activeItemIndex:a,pendingFocus:{focus:j.Focus.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.items,a=[],r=new Set(t.items);for(let[e,t]of n.entries())if(r.has(t.id)&&(a.push(e),r.delete(t.id),0===r.size))break;if(a.length>0)for(let e of(n=n.slice(),a.reverse()))n.splice(e,1);return{...e,items:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.itemsElement===t.element?e:{...e,itemsElement:t.element},9:e=>e.pendingShouldSort?{...e,...$(e),pendingShouldSort:!1}:e,10:e=>"Tracked"!==e.buttonPositionState.kind?e:{...e,buttonPositionState:G.ElementPositionState.Moved}};class Z extends B.Machine{constructor(e){super(e),z(this,"actions",{registerItem:(0,B.batch)(()=>{let e=[],t=new Set;return[(n,a)=>{t.has(a)||(t.add(a),e.push({id:n,dataRef:a}))},()=>(t.clear(),this.send({type:5,items:e.splice(0)}))]}),unregisterItem:(0,B.batch)(()=>{let e=[];return[t=>e.push(t),()=>this.send({type:6,items:e.splice(0)})]})}),z(this,"selectors",{activeDescendantId(e){var t;let n=e.activeItemIndex,a=e.items;return null===n||null==(t=a[n])?void 0:t.id},isActive(e,t){var n;let a=e.activeItemIndex,r=e.items;return null!==a&&(null==(n=r[a])?void 0:n.id)===t},shouldScrollIntoView(e,t){return!e.__demoMode&&0===e.menuState&&0!==e.activationTrigger&&this.isActive(e,t)},didButtonMove:e=>"Moved"===e.buttonPositionState.kind}),this.on(5,()=>{this.disposables.requestAnimationFrame(()=>{this.send({type:9})})});{let e=this.state.id,t=k.stackMachines.get(null);this.disposables.add(t.on(k.ActionTypes.Push,n=>{t.selectors.isTop(n,e)||0!==this.state.menuState||this.send({type:1})})),this.on(0,()=>t.actions.push(e)),this.on(1,()=>t.actions.pop(e))}this.disposables.group(e=>{this.on(1,t=>{t.buttonElement&&(e.dispose(),e.add((0,G.detectMovement)(t.buttonElement,t.buttonPositionState,()=>{this.send({type:10})})))})})}static new(e){let{id:t,__demoMode:n=!1}=e;return new Z({id:t,__demoMode:n,menuState:+!n,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1,pendingShouldSort:!1,pendingFocus:{focus:j.Focus.Nothing},buttonPositionState:G.ElementPositionState.Idle})}reduce(e,t){return(0,O.match)(t.type,Y,e,t)}}var X=e.i(196163);let J=(0,i.createContext)(null);function ee(e){let t=(0,i.useContext)(J);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,et),t}return t}function et(e){let{id:t,__demoMode:n=!1}=e,a=(0,i.useMemo)(()=>Z.new({id:t,__demoMode:n}),[]);return(0,X.useOnUnmount)(()=>a.dispose()),a}let en=i.Fragment,ea=L.RenderFeatures.RenderStrategy|L.RenderFeatures.Static,er=i.Fragment,es=(0,L.forwardRefWithAs)(function(e,t){let n=(0,i.useId)(),{__demoMode:a=!1,...r}=e,s=et({id:n,__demoMode:a}),[l,o,c]=(0,T.useSlice)(s,e=>[e.menuState,e.itemsElement,e.buttonElement]),u=(0,E.useSyncRefs)(t),p=k.stackMachines.get(null),m=(0,T.useSlice)(p,(0,i.useCallback)(e=>p.selectors.isTop(e,n),[p,n]));(0,g.useOutsideClick)(m,[c,o],(e,t)=>{var n;s.send({type:Q.CloseMenu}),(0,R.isFocusableElement)(t,R.FocusableMode.Loose)||(e.preventDefault(),null==(n=s.state.buttonElement)||n.focus())});let f=(0,d.useEvent)(()=>{s.send({type:Q.CloseMenu})}),h=(0,C.useSlot)({open:l===V.Open,close:f}),v=(0,L.useRender)();return i.default.createElement(I.FloatingProvider,null,i.default.createElement(J.Provider,{value:s},i.default.createElement(_.OpenClosedProvider,{value:(0,O.match)(l,{[V.Open]:_.State.Open,[V.Closed]:_.State.Closed})},v({ourProps:{ref:u},theirProps:r,slot:h,defaultTag:en,name:"Menu"}))))}),ei=(0,L.forwardRefWithAs)(function(e,t){let n=ee("Menu.Button"),a=(0,i.useId)(),{id:c=`headlessui-menu-button-${a}`,disabled:u=!1,autoFocus:m=!1,...f}=e,h=(0,i.useRef)(null),g=(0,I.useFloatingReferenceProps)(),v=(0,E.useSyncRefs)(t,h,(0,I.useFloatingReference)(),(0,d.useEvent)(e=>n.send({type:Q.SetButtonElement,element:e}))),b=(0,d.useEvent)(e=>{switch(e.key){case U.Keys.Space:case U.Keys.Enter:case U.Keys.ArrowDown:e.preventDefault(),e.stopPropagation(),n.send({type:Q.OpenMenu,focus:{focus:j.Focus.First}});break;case U.Keys.ArrowUp:e.preventDefault(),e.stopPropagation(),n.send({type:Q.OpenMenu,focus:{focus:j.Focus.Last}})}}),A=(0,d.useEvent)(e=>{e.key===U.Keys.Space&&e.preventDefault()}),[S,w,N]=(0,T.useSlice)(n,e=>[e.menuState,e.buttonElement,e.itemsElement]),_=S===V.Open;(0,x.useQuickRelease)(_,{trigger:w,action:(0,i.useCallback)(e=>{if(null!=w&&w.contains(e.target))return x.Action.Ignore;let t=e.target.closest('[role="menuitem"]:not([data-disabled])');return D.isHTMLElement(t)?x.Action.Select(t):null!=N&&N.contains(e.target)?x.Action.Ignore:x.Action.Close},[w,N]),close:(0,i.useCallback)(()=>n.send({type:Q.CloseMenu}),[]),select:(0,i.useCallback)(e=>e.click(),[])});let k=(0,p.useHandleToggle)(e=>{var t;u||(S===V.Open?((0,l.flushSync)(()=>n.send({type:Q.CloseMenu})),null==(t=h.current)||t.focus({preventScroll:!0})):(e.preventDefault(),n.send({type:Q.OpenMenu,focus:{focus:j.Focus.Nothing},trigger:W.Pointer})))}),{isFocusVisible:M,focusProps:R}=(0,r.useFocusRing)({autoFocus:m}),{isHovered:O,hoverProps:P}=(0,s.useHover)({isDisabled:u}),{pressed:F,pressProps:K}=(0,o.useActivePress)({disabled:u}),q=(0,C.useSlot)({open:S===V.Open,active:F||S===V.Open,disabled:u,hover:O,focus:M,autofocus:m}),B=(0,L.mergeProps)(g(),{ref:v,id:c,type:(0,y.useResolveButtonType)(e,h.current),"aria-haspopup":"menu","aria-controls":null==N?void 0:N.id,"aria-expanded":S===V.Open,disabled:u||void 0,autoFocus:m,onKeyDown:b,onKeyUp:A},k,R,P,K);return(0,L.useRender)()({ourProps:B,theirProps:f,slot:q,defaultTag:"button",name:"Menu.Button"})}),el=(0,L.forwardRefWithAs)(function(e,t){let n=(0,i.useId)(),{id:a=`headlessui-menu-items-${n}`,anchor:r,portal:s=!1,modal:o=!0,transition:p=!1,...f}=e,g=(0,I.useResolvedAnchor)(r),x=ee("Menu.Items"),[y,A]=(0,I.useFloatingPanel)(g),S=(0,I.useFloatingPanelProps)(),[k,M]=(0,i.useState)(null),D=(0,E.useSyncRefs)(t,g?y:null,(0,d.useEvent)(e=>x.send({type:Q.SetItemsElement,element:e})),M),[O,F]=(0,T.useSlice)(x,e=>[e.menuState,e.buttonElement]),K=(0,v.useOwnerDocument)(F),B=(0,v.useOwnerDocument)(k);g&&(s=!0);let G=(0,_.useOpenClosed)(),[H,z]=(0,w.useTransition)(p,k,null!==G?(G&_.State.Open)===_.State.Open:O===V.Open);(0,h.useOnDisappear)(H,F,()=>{x.send({type:Q.CloseMenu})});let W=(0,T.useSlice)(x,e=>e.__demoMode),$=!W&&o&&O===V.Open;(0,b.useScrollLock)($,B);let Y=!W&&o&&O===V.Open;(0,m.useInertOthers)(Y,{allowed:(0,i.useCallback)(()=>[F,k],[F,k])});let Z=!(0,T.useSlice)(x,x.selectors.didButtonMove)&&H;(0,i.useEffect)(()=>{k&&O===V.Open&&((0,P.isActiveElement)(k)||k.focus({preventScroll:!0}))},[O,k]),(0,N.useTreeWalker)(O===V.Open,{container:k,accept:e=>"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let X=(0,c.useDisposables)(),J=(0,d.useEvent)(e=>{var t,n,a;switch(X.dispose(),e.key){case U.Keys.Space:if(""!==x.state.searchQuery)return e.preventDefault(),e.stopPropagation(),x.send({type:Q.Search,value:e.key});case U.Keys.Enter:if(e.preventDefault(),e.stopPropagation(),null!==x.state.activeItemIndex){let{dataRef:e}=x.state.items[x.state.activeItemIndex];null==(n=null==(t=e.current)?void 0:t.domRef.current)||n.click()}x.send({type:Q.CloseMenu}),(0,R.restoreFocusIfNecessary)(x.state.buttonElement);break;case U.Keys.ArrowDown:return e.preventDefault(),e.stopPropagation(),x.send({type:Q.GoToItem,focus:j.Focus.Next});case U.Keys.ArrowUp:return e.preventDefault(),e.stopPropagation(),x.send({type:Q.GoToItem,focus:j.Focus.Previous});case U.Keys.Home:case U.Keys.PageUp:return e.preventDefault(),e.stopPropagation(),x.send({type:Q.GoToItem,focus:j.Focus.First});case U.Keys.End:case U.Keys.PageDown:return e.preventDefault(),e.stopPropagation(),x.send({type:Q.GoToItem,focus:j.Focus.Last});case U.Keys.Escape:e.preventDefault(),e.stopPropagation(),(0,l.flushSync)(()=>x.send({type:Q.CloseMenu})),null==(a=x.state.buttonElement)||a.focus({preventScroll:!0});break;case U.Keys.Tab:e.preventDefault(),e.stopPropagation(),(0,l.flushSync)(()=>x.send({type:Q.CloseMenu})),(0,R.focusFrom)(x.state.buttonElement,e.shiftKey?R.Focus.Previous:R.Focus.Next);break;default:1===e.key.length&&(x.send({type:Q.Search,value:e.key}),X.setTimeout(()=>x.send({type:Q.ClearSearch}),350))}}),et=(0,d.useEvent)(e=>{e.key===U.Keys.Space&&e.preventDefault()}),en=(0,C.useSlot)({open:O===V.Open}),er=(0,L.mergeProps)(g?S():{},{"aria-activedescendant":(0,T.useSlice)(x,x.selectors.activeDescendantId),"aria-labelledby":(0,T.useSlice)(x,e=>{var t;return null==(t=e.buttonElement)?void 0:t.id}),id:a,onKeyDown:J,onKeyUp:et,role:"menu",tabIndex:O===V.Open?0:void 0,ref:D,style:{...f.style,...A,"--button-width":(0,u.useElementSize)(H,F,!0).width},...(0,w.transitionDataAttributes)(z)}),es=(0,L.useRender)();return i.default.createElement(q.Portal,{enabled:!!s&&(e.static||H),ownerDocument:K},es({ourProps:er,theirProps:f,slot:en,defaultTag:"div",features:ea,visible:Z,name:"Menu.Items"}))}),eo=(0,L.forwardRefWithAs)(function(e,t){let n=(0,i.useId)(),{id:a=`headlessui-menu-item-${n}`,disabled:r=!1,...s}=e,l=ee("Menu.Item"),o=(0,T.useSlice)(l,e=>l.selectors.isActive(e,a)),c=(0,i.useRef)(null),u=(0,E.useSyncRefs)(t,c),p=(0,T.useSlice)(l,e=>l.selectors.shouldScrollIntoView(e,a));(0,f.useIsoMorphicEffect)(()=>{if(p)return(0,M.disposables)().requestAnimationFrame(()=>{var e,t;null==(t=null==(e=c.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})},[p,c]);let m=(0,A.useTextValue)(c),h=(0,i.useRef)({disabled:r,domRef:c,get textValue(){return m()}});(0,f.useIsoMorphicEffect)(()=>{h.current.disabled=r},[h,r]),(0,f.useIsoMorphicEffect)(()=>(l.actions.registerItem(a,h),()=>l.actions.unregisterItem(a)),[h,a]);let g=(0,d.useEvent)(()=>{l.send({type:Q.CloseMenu})}),v=(0,d.useEvent)(e=>{if(r)return e.preventDefault();l.send({type:Q.CloseMenu}),(0,R.restoreFocusIfNecessary)(l.state.buttonElement)}),x=(0,d.useEvent)(()=>{if(r)return l.send({type:Q.GoToItem,focus:j.Focus.Nothing});l.send({type:Q.GoToItem,focus:j.Focus.Specific,id:a})}),y=(0,S.useTrackedPointer)(),b=(0,d.useEvent)(e=>y.update(e)),w=(0,d.useEvent)(e=>{y.wasMoved(e)&&(r||o||l.send({type:Q.GoToItem,focus:j.Focus.Specific,id:a,trigger:W.Pointer}))}),N=(0,d.useEvent)(e=>{y.wasMoved(e)&&(r||o&&l.state.activationTrigger===W.Pointer&&l.send({type:Q.GoToItem,focus:j.Focus.Nothing}))}),[I,_]=(0,K.useLabels)(),[k,D]=(0,F.useDescriptions)(),O=(0,C.useSlot)({active:o,focus:o,disabled:r,close:g}),P=(0,L.useRender)();return i.default.createElement(_,null,i.default.createElement(D,null,P({ourProps:{id:a,ref:u,role:"menuitem",tabIndex:!0===r?void 0:-1,"aria-disabled":!0===r||void 0,"aria-labelledby":I,"aria-describedby":k,disabled:void 0,onClick:v,onFocus:x,onPointerEnter:b,onMouseEnter:b,onPointerMove:w,onMouseMove:w,onPointerLeave:N,onMouseLeave:N},theirProps:s,slot:O,defaultTag:er,name:"Menu.Item"})))}),ec=Object.assign(es,{Button:ei,Items:el,Item:eo,Section:(0,L.forwardRefWithAs)(function(e,t){let[n,a]=(0,K.useLabels)(),r=(0,L.useRender)();return i.default.createElement(a,null,r({ourProps:{ref:t,"aria-labelledby":n,role:"group"},theirProps:e,slot:{},defaultTag:"div",name:"Menu.Section"}))}),Heading:(0,L.forwardRefWithAs)(function(e,t){let n=(0,i.useId)(),{id:a=`headlessui-menu-heading-${n}`,...r}=e,s=(0,K.useLabelContext)();(0,f.useIsoMorphicEffect)(()=>s.register(a),[a,s.register]);let l={id:a,ref:t,role:"presentation",...s.props};return(0,L.useRender)()({ourProps:l,theirProps:r,slot:{},defaultTag:"header",name:"Menu.Heading"})}),Separator:(0,L.forwardRefWithAs)(function(e,t){return(0,L.useRender)()({ourProps:{ref:t,role:"separator"},theirProps:e,slot:{},defaultTag:"div",name:"Menu.Separator"})})});e.s(["Menu",()=>ec,"MenuButton",()=>ei,"MenuItem",()=>eo,"MenuItems",()=>el],101387)},124555,e=>{"use strict";var t=e.i(162115),n=e.i(922521),a=e.i(935139),r=e.i(168014);let s={default:"/logo/logo.svg",monochromeWhite:"/logo/logo-monochrome-white.svg"},i={large:"w-16 h-7",medium:"w-12 h-[22px]",small:"w-9 h-4"};e.s(["default",0,e=>{let{style:l="default",size:o="medium",className:c}=e,{theme:u}=(0,n.default)();return(0,t.jsx)("img",{src:`${r.basePath}${s["dark"===u&&"default"===l?"monochromeWhite":l]}`,className:(0,a.cn)("block object-contain",i[o],c),alt:"Dify logo"})},"logoPathMap",0,s,"logoSizeMap",0,i])},742791,e=>{"use strict";var t=e.i(942347);let n=t.forwardRef(function(e,n){let{title:a,titleId:r,...s}=e;return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":r},s),a?t.createElement("title",{id:r},a):null,t.createElement("path",{d:"M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"}))});e.s(["PlusIcon",0,n],742791)},361533,e=>{"use strict";let t=null;e.s(["resolvePostLoginRedirect",0,()=>{if(t){let e=t;return t=null,e}return null},"setPostLoginRedirect",0,e=>{t=e}])},864632,e=>{"use strict";var t=e.i(162115),n=e.i(821957),a=e.i(935139);function r(){let{theme:e,setTheme:r}=(0,n.useTheme)(),s=e=>{r(e)};return(0,t.jsxs)("div",{className:"flex items-center rounded-[10px] bg-components-segmented-control-bg-normal p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,a.cn)("rounded-lg px-2 py-1 text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary","system"===e&&"bg-components-segmented-control-item-active-bg text-text-accent-light-mode-only shadow-sm hover:bg-components-segmented-control-item-active-bg hover:text-text-accent-light-mode-only"),onClick:()=>s("system"),"aria-label":"System theme","data-testid":"system-theme-container",children:(0,t.jsx)("div",{className:"p-0.5",children:(0,t.jsx)("span",{className:"i-ri-computer-line h-4 w-4"})})}),(0,t.jsx)("div",{className:(0,a.cn)("h-[14px] w-px bg-transparent","dark"===e&&"bg-divider-regular"),"data-testid":"divider"}),(0,t.jsx)("button",{type:"button",className:(0,a.cn)("rounded-lg px-2 py-1 text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary","light"===e&&"bg-components-segmented-control-item-active-bg text-text-accent-light-mode-only shadow-sm hover:bg-components-segmented-control-item-active-bg hover:text-text-accent-light-mode-only"),onClick:()=>s("light"),"aria-label":"Light theme","data-testid":"light-theme-container",children:(0,t.jsx)("div",{className:"p-0.5",children:(0,t.jsx)("span",{className:"i-ri-sun-line h-4 w-4"})})}),(0,t.jsx)("div",{className:(0,a.cn)("h-[14px] w-px bg-transparent","system"===e&&"bg-divider-regular"),"data-testid":"divider"}),(0,t.jsx)("button",{type:"button",className:(0,a.cn)("rounded-lg px-2 py-1 text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary","dark"===e&&"bg-components-segmented-control-item-active-bg text-text-accent-light-mode-only shadow-sm hover:bg-components-segmented-control-item-active-bg hover:text-text-accent-light-mode-only"),onClick:()=>s("dark"),"aria-label":"Dark theme","data-testid":"dark-theme-container",children:(0,t.jsx)("div",{className:"p-0.5",children:(0,t.jsx)("span",{className:"i-ri-moon-line h-4 w-4"})})})]})}e.s(["default",()=>r])},752901,e=>{"use strict";var t,n,a=((t={}).GROUP="group",t.ACCOUNT="account",t),r=((n={}).PUBLIC="public",n.SPECIFIC_GROUPS_MEMBERS="private",n.ORGANIZATION="private_all",n.EXTERNAL_MEMBERS="sso_verified",n);e.s(["AccessMode",()=>r,"SubjectType",()=>a])},595009,e=>{"use strict";var t=e.i(10190);let n=async e=>{let n=await t.consoleClient.explore.appDetail({params:{id:e}});if(!n)throw Error("Recommended app not found");return n};e.s(["fetchAppDetail",0,n,"fetchAppList",0,e=>e?t.consoleClient.explore.apps({query:{language:e}}):t.consoleClient.explore.apps({}),"fetchBanners",0,e=>e?t.consoleClient.explore.banners({query:{language:e}}):t.consoleClient.explore.banners({}),"fetchInstalledAppList",0,e=>e?t.consoleClient.explore.installedApps({query:{app_id:e}}):t.consoleClient.explore.installedApps({}),"fetchInstalledAppMeta",0,e=>t.consoleClient.explore.installedAppMeta({params:{appId:e}}),"fetchInstalledAppParams",0,e=>t.consoleClient.explore.installedAppParameters({params:{appId:e}}),"getAppAccessModeByAppId",0,e=>t.consoleClient.explore.appAccessMode({query:{appId:e}}),"uninstallApp",0,e=>t.consoleClient.explore.uninstallInstalledApp({params:{id:e}}),"updatePinStatus",0,(e,n)=>t.consoleClient.explore.updateInstalledApp({params:{id:e},body:{is_pinned:n}})])},356084,e=>{"use strict";var t=e.i(890564),n=e.i(868729),a=e.i(830616),r=e.i(494268),s=e.i(683257),i=e.i(752901),l=e.i(10190),o=e.i(595009);e.s(["useExploreAppList",0,()=>{let e=(0,s.useLocale)(),t=e?{query:{language:e}}:{},a=t?.query?.language;return(0,n.useQuery)({queryKey:[...l.consoleQuery.explore.apps.queryKey({input:t}),a],queryFn:async()=>{let{categories:e,recommended_apps:t}=await (0,o.fetchAppList)(a);return{categories:e,allList:[...t].sort((e,t)=>e.position-t.position)}}})},"useGetBanners",0,e=>{let t=e?{query:{language:e}}:{},a=t?.query?.language;return(0,n.useQuery)({queryKey:[...l.consoleQuery.explore.banners.queryKey({input:t}),a],queryFn:()=>(0,o.fetchBanners)(a)})},"useGetInstalledAppAccessModeByAppId",0,e=>{let t=(0,r.useGlobalPublicStore)(e=>e.systemFeatures),a={query:{appId:e??""}},s=a.query.appId;return(0,n.useQuery)({queryKey:[...l.consoleQuery.explore.appAccessMode.queryKey({input:a}),t.webapp_auth.enabled,s],queryFn:()=>!1===t.webapp_auth.enabled?{accessMode:i.AccessMode.PUBLIC}:s?(0,o.getAppAccessModeByAppId)(s):Promise.reject(Error("App ID is required to get access mode")),enabled:!!s})},"useGetInstalledAppMeta",0,e=>{let t={params:{appId:e??""}},a=t.params.appId;return(0,n.useQuery)({queryKey:[...l.consoleQuery.explore.installedAppMeta.queryKey({input:t}),a],queryFn:()=>a?(0,o.fetchInstalledAppMeta)(a):Promise.reject(Error("App ID is required to get app meta")),enabled:!!a})},"useGetInstalledAppParams",0,e=>{let t={params:{appId:e??""}},a=t.params.appId;return(0,n.useQuery)({queryKey:[...l.consoleQuery.explore.installedAppParameters.queryKey({input:t}),a],queryFn:()=>a?(0,o.fetchInstalledAppParams)(a):Promise.reject(Error("App ID is required to get app params")),enabled:!!a})},"useGetInstalledApps",0,()=>(0,n.useQuery)({queryKey:l.consoleQuery.explore.installedApps.queryKey({input:{}}),queryFn:()=>(0,o.fetchInstalledAppList)()}),"useUninstallApp",0,()=>{let e=(0,a.useQueryClient)();return(0,t.useMutation)({mutationKey:l.consoleQuery.explore.uninstallInstalledApp.mutationKey(),mutationFn:e=>(0,o.uninstallApp)(e),onSuccess:()=>{e.invalidateQueries({queryKey:l.consoleQuery.explore.installedApps.queryKey({input:{}})})}})},"useUpdateAppPinStatus",0,()=>{let e=(0,a.useQueryClient)();return(0,t.useMutation)({mutationKey:l.consoleQuery.explore.updateInstalledApp.mutationKey(),mutationFn:e=>{let{appId:t,isPinned:n}=e;return(0,o.updatePinStatus)(t,n)},onSuccess:()=>{e.invalidateQueries({queryKey:l.consoleQuery.explore.installedApps.queryKey({input:{}})})}})}])},702015,e=>{"use strict";var t=e.i(629807);e.s(["FilePlus02",()=>t.default])},82042,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"beaker-02"},children:[{type:"element",name:"path",attributes:{id:"Solid","fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.13856 0.500003H7.8617C7.92126 0.49998 7.99238 0.499953 8.05504 0.505073C8.12765 0.511005 8.23165 0.526227 8.34062 0.581751C8.48174 0.653656 8.59648 0.768392 8.66838 0.909513C8.72391 1.01849 8.73913 1.12248 8.74506 1.19509C8.75018 1.25775 8.75015 1.32888 8.75013 1.38844V2.61157C8.75015 2.67113 8.75018 2.74226 8.74506 2.80492C8.73913 2.87753 8.72391 2.98153 8.66838 3.0905C8.59648 3.23162 8.48174 3.34636 8.34062 3.41826C8.23165 3.47379 8.12765 3.48901 8.05504 3.49494C8.03725 3.49639 8.01877 3.49743 8.00006 3.49817V5.2506C8.00006 5.55312 8.00408 5.61265 8.01723 5.66153C8.03245 5.71807 8.05747 5.7715 8.09117 5.81939C8.1203 5.86078 8.16346 5.90197 8.39586 6.09564L10.2807 7.66627C10.4566 7.81255 10.6116 7.94145 10.7267 8.10509C10.8278 8.24875 10.9029 8.40904 10.9486 8.57867C11.0005 8.7719 11.0003 8.97351 11.0001 9.2023C11.0001 9.39886 11.0002 9.59542 11.0002 9.79198C11.0003 9.98232 11.0005 10.1463 10.9713 10.2927C10.853 10.8877 10.3878 11.3529 9.7928 11.4712C9.64637 11.5003 9.48246 11.5002 9.29211 11.5001H2.70822C2.51787 11.5002 2.35396 11.5003 2.20753 11.4712C1.98473 11.4269 1.78014 11.334 1.60515 11.2038C1.42854 11.0725 1.28221 10.9034 1.17753 10.7077C1.10892 10.5796 1.05831 10.4401 1.02899 10.2927C0.999862 10.1463 0.999992 9.98233 1.00014 9.79199C1.00014 9.59542 1.00006 9.39886 1.00003 9.20229C0.999794 8.97351 0.999584 8.7719 1.05157 8.57867C1.09721 8.40904 1.17229 8.24875 1.27338 8.10509C1.38855 7.94145 1.54356 7.81255 1.71947 7.66627L3.60427 6.09564C3.83667 5.90197 3.87983 5.86078 3.90896 5.81939C3.94266 5.7715 3.96768 5.71807 3.9829 5.66153C3.99605 5.61265 4.00006 5.55312 4.00006 5.2506V3.49817C3.9814 3.49743 3.96297 3.49639 3.94521 3.49494C3.8726 3.48901 3.76861 3.47379 3.65964 3.41826C3.51851 3.34636 3.40378 3.23162 3.33187 3.0905C3.27635 2.98153 3.26113 2.87753 3.25519 2.80492C3.25008 2.74226 3.2501 2.67113 3.25013 2.61158V1.38844C3.2501 1.32888 3.25008 1.25775 3.25519 1.19509C3.26113 1.12248 3.27635 1.01849 3.33187 0.909513C3.40378 0.768392 3.51851 0.653656 3.65964 0.581751C3.76861 0.526227 3.8726 0.511005 3.94521 0.505073C4.00787 0.499953 4.079 0.49998 4.13856 0.500003ZM9.11909 8.00004H2.88104L4.28066 6.83373C4.45657 6.68745 4.61158 6.55855 4.72675 6.39491C4.82784 6.25125 4.90292 6.09096 4.94856 5.92133C5.00054 5.7281 5.00033 5.52649 5.0001 5.29771L5.00006 3.50001H7.00006L7.00003 5.29771C6.99979 5.52649 6.99958 5.7281 7.05157 5.92133C7.09721 6.09096 7.17229 6.25125 7.27338 6.39491C7.38855 6.55855 7.54356 6.68745 7.71947 6.83373L9.11909 8.00004Z",fill:"currentColor"},children:[]}]}]},name:"Beaker02"})},452898,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"bubble-text"},children:[{type:"element",name:"path",attributes:{id:"vector","fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 9C2 5.68629 4.68629 3 8 3H16C19.3137 3 22 5.68629 22 9V15C22 18.3137 19.3137 21 16 21H3C2.44772 21 2 20.5523 2 20V9ZM9 9C8.44772 9 8 9.44772 8 10C8 10.5523 8.44772 11 9 11H15C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9H9ZM9 13C8.44772 13 8 13.4477 8 14C8 14.5523 8.44772 15 9 15H12C12.5523 15 13 14.5523 13 14C13 13.4477 12.5523 13 12 13H9Z",fill:"currentColor"},children:[]}]}]},name:"BubbleText"})},384047,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"path",attributes:{d:"M12.5836 3.8721C12.3615 3.99329 12.1665 4.11496 12 4.22818C11.8335 4.11496 11.6385 3.99329 11.4164 3.8721C10.6185 3.4369 9.45449 3 8 3C6.48169 3 4.96498 3.60857 3.83296 4.81606C2.69616 6.02865 2 7.78592 2 10C2 13.3448 4.37277 16.1023 6.58187 17.9272C7.71336 18.8619 8.86688 19.6065 9.7917 20.1203C10.2539 20.377 10.6687 20.5816 11.004 20.7253C11.1707 20.7967 11.3289 20.858 11.4705 20.9033C11.5784 20.9378 11.7841 21 12 21C12.2159 21 12.4216 20.9378 12.5295 20.9033C12.6711 20.858 12.8293 20.7967 12.996 20.7253C13.3313 20.5816 13.7461 20.377 14.2083 20.1203C15.1331 19.6065 16.2866 18.8619 17.4181 17.9272C19.6272 16.1023 22 13.3448 22 10C22 7.78592 21.3038 6.02865 20.167 4.81606C19.035 3.60857 17.5183 3 16 3C14.5455 3 13.3815 3.4369 12.5836 3.8721Z",fill:"currentColor"},children:[]}]},name:"Heart02"})},267539,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"unblur"},children:[{type:"element",name:"g",attributes:{id:"vector"},children:[{type:"element",name:"path",attributes:{d:"M9.5 6.25C9.5 6.80228 9.05228 7.25 8.5 7.25C7.94772 7.25 7.5 6.80228 7.5 6.25C7.5 5.69772 7.94772 5.25 8.5 5.25C9.05228 5.25 9.5 5.69772 9.5 6.25Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M6 6.25C6 6.80228 5.55228 7.25 5 7.25C4.44772 7.25 4 6.80228 4 6.25C4 5.69772 4.44772 5.25 5 5.25C5.55228 5.25 6 5.69772 6 6.25Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M9.5 17.75C9.5 18.3023 9.05228 18.75 8.5 18.75C7.94772 18.75 7.5 18.3023 7.5 17.75C7.5 17.1977 7.94772 16.75 8.5 16.75C9.05228 16.75 9.5 17.1977 9.5 17.75Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M9.25 3.25C9.25 3.66421 8.91421 4 8.5 4C8.08579 4 7.75 3.66421 7.75 3.25C7.75 2.83579 8.08579 2.5 8.5 2.5C8.91421 2.5 9.25 2.83579 9.25 3.25Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M3 10C3 10.4142 2.66421 10.75 2.25 10.75C1.83579 10.75 1.5 10.4142 1.5 10C1.5 9.58579 1.83579 9.25 2.25 9.25C2.66421 9.25 3 9.58579 3 10Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M3 14C3 14.4142 2.66421 14.75 2.25 14.75C1.83579 14.75 1.5 14.4142 1.5 14C1.5 13.5858 1.83579 13.25 2.25 13.25C2.66421 13.25 3 13.5858 3 14Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M9.25 20.75C9.25 21.1642 8.91421 21.5 8.5 21.5C8.08579 21.5 7.75 21.1642 7.75 20.75C7.75 20.3358 8.08579 20 8.5 20C8.91421 20 9.25 20.3358 9.25 20.75Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M10 10C10 10.8284 9.32843 11.5 8.5 11.5C7.67157 11.5 7 10.8284 7 10C7 9.17157 7.67157 8.5 8.5 8.5C9.32843 8.5 10 9.17157 10 10Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M10 14C10 14.8284 9.32843 15.5 8.5 15.5C7.67157 15.5 7 14.8284 7 14C7 13.1716 7.67157 12.5 8.5 12.5C9.32843 12.5 10 13.1716 10 14Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M6 10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10C4 9.44772 4.44772 9 5 9C5.55228 9 6 9.44772 6 10Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M6 14C6 14.5523 5.55228 15 5 15C4.44772 15 4 14.5523 4 14C4 13.4477 4.44772 13 5 13C5.55228 13 6 13.4477 6 14Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M6 17.75C6 18.3023 5.55228 18.75 5 18.75C4.44772 18.75 4 18.3023 4 17.75C4 17.1977 4.44772 16.75 5 16.75C5.55228 16.75 6 17.1977 6 17.75Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M12 2C11.4477 2 11 2.44772 11 3V21C11 21.5523 11.4477 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",fill:"currentColor"},children:[]}]}]}]},name:"Unblur"})},930453,e=>{"use strict";var t=e.i(162115),n=e.i(869931),a=e.i(942347);e.i(816688);var r=e.i(675066),s=e.i(339548),i=e.i(654313);e.i(866473);var l=e.i(622024),l=l,o=e.i(734962),c=e.i(935139),u=e.i(128984);let d=a.memo(e=>{let{file:d,updateFile:p,className:m,accept:f=".yaml,.yml",displayName:h="YAML"}=e,{t:g}=(0,r.useTranslation)(),{notify:v}=(0,s.useContext)(o.ToastContext),[x,y]=(0,a.useState)(!1),b=(0,a.useRef)(null),C=(0,a.useRef)(null),E=(0,a.useRef)(null),A=e=>{e.preventDefault(),e.stopPropagation(),e.target!==C.current&&y(!0)},S=e=>{e.preventDefault(),e.stopPropagation()},w=e=>{e.preventDefault(),e.stopPropagation(),e.target===C.current&&y(!1)},N=e=>{if(e.preventDefault(),e.stopPropagation(),y(!1),!e.dataTransfer)return;let t=Array.from(e.dataTransfer.files);t.length>1?v({type:"error",message:g("stepOne.uploader.validation.count",{ns:"datasetCreation"})}):p(t[0])};return(0,a.useEffect)(()=>(b.current?.addEventListener("dragenter",A),b.current?.addEventListener("dragover",S),b.current?.addEventListener("dragleave",w),b.current?.addEventListener("drop",N),()=>{b.current?.removeEventListener("dragenter",A),b.current?.removeEventListener("dragover",S),b.current?.removeEventListener("dragleave",w),b.current?.removeEventListener("drop",N)}),[]),(0,t.jsxs)("div",{className:(0,c.cn)("mt-6",m),children:[(0,t.jsx)("input",{ref:E,style:{display:"none"},type:"file",id:"fileUploader",accept:f,onChange:e=>{p(e.target.files?.[0])}}),(0,t.jsxs)("div",{ref:b,children:[!d&&(0,t.jsxs)("div",{className:(0,c.cn)("flex h-12 items-center rounded-[10px] border border-dashed border-components-dropzone-border bg-components-dropzone-bg text-sm font-normal",x&&"border-components-dropzone-border-accent bg-components-dropzone-bg-accent"),children:[(0,t.jsxs)("div",{className:"flex w-full items-center justify-center space-x-2",children:[(0,t.jsx)(n.RiUploadCloud2Line,{className:"h-6 w-6 text-text-tertiary"}),(0,t.jsxs)("div",{className:"text-text-tertiary",children:[g("dslUploader.button",{ns:"app"}),(0,t.jsx)("span",{className:"cursor-pointer pl-1 text-text-accent",onClick:()=>{E.current&&(E.current.value="",E.current.click(),E.current.oncancel=()=>p(d))},children:g("dslUploader.browse",{ns:"app"})})]})]}),x&&(0,t.jsx)("div",{ref:C,className:"absolute left-0 top-0 h-full w-full"})]}),d&&(0,t.jsxs)("div",{className:(0,c.cn)("group flex items-center rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg shadow-xs"," hover:bg-components-panel-on-panel-item-bg-hover"),children:[(0,t.jsx)("div",{className:"flex items-center justify-center p-3",children:(0,t.jsx)(l.default,{className:"h-6 w-6 shrink-0"})}),(0,t.jsxs)("div",{className:"flex grow flex-col items-start gap-0.5 py-1 pr-2",children:[(0,t.jsx)("span",{className:"font-inter max-w-[calc(100%_-_30px)] overflow-hidden text-ellipsis whitespace-nowrap text-[12px] font-medium leading-4 text-text-secondary",children:d.name}),(0,t.jsxs)("div",{className:"font-inter flex h-3 items-center gap-1 self-stretch text-[10px] font-medium uppercase leading-3 text-text-tertiary",children:[(0,t.jsx)("span",{children:h}),(0,t.jsx)("span",{className:"text-text-quaternary",children:"·"}),(0,t.jsx)("span",{children:(0,u.formatFileSize)(d.size)})]})]}),(0,t.jsx)("div",{className:"hidden items-center pr-3 group-hover:flex",children:(0,t.jsx)(i.default,{onClick:()=>{E.current&&(E.current.value=""),p()},children:(0,t.jsx)(n.RiDeleteBinLine,{className:"h-4 w-4 text-text-tertiary"})})})]})]})]})});e.s(["default",0,d],930453)},725001,e=>{"use strict";var t,n=e.i(162115),a=e.i(869931),r=e.i(429279),s=e.i(335415),i=e.i(220365),l=e.i(893936),o=e.i(942347);e.i(816688);var c=e.i(675066),u=e.i(339548);e.i(201987);var d=e.i(207331),p=e.i(151094),m=e.i(291631),f=e.i(21151),h=e.i(734962),g=e.i(921568),v=e.i(967484),x=e.i(925521),y=e.i(751992),b=e.i(327069),C=e.i(815488),E=e.i(972282),A=e.i(586871),S=e.i(935139),w=e.i(194902),N=e.i(930453),I=((t={}).FROM_FILE="from-file",t.FROM_URL="from-url",t);e.s(["CreateFromDSLModalTab",()=>I,"default",0,e=>{let{show:t,onSuccess:I,onClose:_,activeTab:k="from-file",dslUrl:T="",droppedFile:j}=e,{push:M}=(0,l.useRouter)(),{t:D}=(0,c.useTranslation)(),{notify:R}=(0,u.useContext)(h.ToastContext),[O,P]=(0,o.useState)(j),[L,F]=(0,o.useState)(),[U,K]=(0,o.useState)(k),[q,B]=(0,o.useState)(T),[G,H]=(0,o.useState)(!1),[z,V]=(0,o.useState)(),[W,Q]=(0,o.useState)(),{handleCheckPluginDependencies:$}=(0,v.usePluginDependencies)(),Y=e=>{let t;P(e),e&&((t=new FileReader).onload=function(e){F(e.target?.result)},t.readAsText(e)),e||F("")},{isCurrentWorkspaceEditor:Z}=(0,y.useAppContext)(),{plan:X,enableBilling:J}=(0,b.useProviderContext)(),ee=J&&X.usage.buildApps>=X.total.buildApps,et=(0,o.useRef)(!1);(0,o.useEffect)(()=>{j&&Y(j)},[j]);let en=async e=>{if(("from-file"!==U||O)&&("from-url"!==U||q)&&!et.current){et.current=!0;try{let e;if("from-file"===U&&(e=await (0,E.importDSL)({mode:C.DSLImportMode.YAML_CONTENT,yaml_content:L||""})),"from-url"===U&&(e=await (0,E.importDSL)({mode:C.DSLImportMode.YAML_URL,yaml_url:q||""})),!e)return;let{id:t,status:n,app_id:a,app_mode:r,imported_dsl_version:s,current_dsl_version:i}=e;n===C.DSLImportStatus.COMPLETED||n===C.DSLImportStatus.COMPLETED_WITH_WARNINGS?((0,d.trackEvent)("create_app_with_dsl",{app_mode:r,creation_method:"from-file"===U?"dsl_file":"dsl_url",has_warnings:n===C.DSLImportStatus.COMPLETED_WITH_WARNINGS}),I&&I(),_&&_(),R({type:n===C.DSLImportStatus.COMPLETED?"success":"warning",message:D(n===C.DSLImportStatus.COMPLETED?"newApp.appCreated":"newApp.caution",{ns:"app"}),children:n===C.DSLImportStatus.COMPLETED_WITH_WARNINGS&&D("newApp.appCreateDSLWarning",{ns:"app"})}),localStorage.setItem(x.NEED_REFRESH_APP_LIST_KEY,"1"),a&&await $(a),(0,A.getRedirection)(Z,{id:a,mode:r},M)):n===C.DSLImportStatus.PENDING?(V({importedVersion:s??"",systemVersion:i??""}),setTimeout(()=>{H(!0)},300),Q(t)):R({type:"error",message:D("newApp.appCreateFailed",{ns:"app"})})}catch(e){R({type:"error",message:D("newApp.appCreateFailed",{ns:"app"})})}et.current=!1}},{run:ea}=(0,r.useDebounceFn)(en,{wait:300});(0,s.useKeyPress)(["meta.enter","ctrl.enter"],()=>{t&&!ee&&("from-file"===U&&O||"from-url"===U&&q)&&ea(void 0)}),(0,s.useKeyPress)("esc",()=>{t&&!G&&_()});let er=async()=>{try{if(!W)return;let{status:e,app_id:t,app_mode:n}=await (0,E.importDSLConfirm)({import_id:W});e===C.DSLImportStatus.COMPLETED?(I&&I(),_&&_(),R({type:"success",message:D("newApp.appCreated",{ns:"app"})}),t&&await $(t),localStorage.setItem(x.NEED_REFRESH_APP_LIST_KEY,"1"),(0,A.getRedirection)(Z,{id:t,mode:n},M)):e===C.DSLImportStatus.FAILED&&R({type:"error",message:D("newApp.appCreateFailed",{ns:"app"})})}catch(e){R({type:"error",message:D("newApp.appCreateFailed",{ns:"app"})})}},es=[{key:"from-file",label:D("importFromDSLFile",{ns:"app"})},{key:"from-url",label:D("importFromDSLUrl",{ns:"app"})}],ei=(0,o.useMemo)(()=>!!ee||("from-file"===U?!O:"from-url"===U&&!q),[ee,U,O,q]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(f.default,{className:"w-[520px] rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0 shadow-xl",isShow:t,onClose:i.noop,children:[(0,n.jsxs)("div",{className:"title-2xl-semi-bold flex items-center justify-between pb-3 pl-6 pr-5 pt-6 text-text-primary",children:[D("importFromDSL",{ns:"app"}),(0,n.jsx)("div",{className:"flex h-8 w-8 cursor-pointer items-center",onClick:()=>_(),children:(0,n.jsx)(a.RiCloseLine,{className:"h-5 w-5 text-text-tertiary"})})]}),(0,n.jsx)("div",{className:"system-md-semibold flex h-9 items-center space-x-6 border-b border-divider-subtle px-6 text-text-tertiary",children:es.map(e=>(0,n.jsxs)("div",{className:(0,S.cn)("relative flex h-full cursor-pointer items-center",U===e.key&&"text-text-primary"),onClick:()=>K(e.key),children:[e.label,U===e.key&&(0,n.jsx)("div",{className:"absolute bottom-0 h-[2px] w-full bg-util-colors-blue-brand-blue-brand-600"})]},e.key))}),(0,n.jsxs)("div",{className:"px-6 py-4",children:["from-file"===U&&(0,n.jsx)(N.default,{className:"mt-0",file:O,updateFile:Y}),"from-url"===U&&(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"system-md-semibold mb-1 text-text-secondary",children:"DSL URL"}),(0,n.jsx)(m.default,{placeholder:D("importFromDSLUrlPlaceholder",{ns:"app"})||"",value:q,onChange:e=>B(e.target.value)})]})]}),ee&&(0,n.jsx)("div",{className:"px-6",children:(0,n.jsx)(g.default,{className:"mt-0",loc:"app-create-dsl"})}),(0,n.jsxs)("div",{className:"flex justify-end px-6 py-5",children:[(0,n.jsx)(p.default,{className:"mr-2",onClick:_,children:D("newApp.Cancel",{ns:"app"})}),(0,n.jsxs)(p.default,{disabled:ei,variant:"primary",onClick:ea,className:"gap-1",children:[(0,n.jsx)("span",{children:D("newApp.Create",{ns:"app"})}),(0,n.jsx)(w.default,{keys:["ctrl","↵"],bgColor:"white"})]})]})]}),(0,n.jsxs)(f.default,{isShow:G,onClose:()=>H(!1),className:"w-[480px]",children:[(0,n.jsxs)("div",{className:"flex flex-col items-start gap-2 self-stretch pb-4",children:[(0,n.jsx)("div",{className:"title-2xl-semi-bold text-text-primary",children:D("newApp.appCreateDSLErrorTitle",{ns:"app"})}),(0,n.jsxs)("div",{className:"system-md-regular flex grow flex-col text-text-secondary",children:[(0,n.jsx)("div",{children:D("newApp.appCreateDSLErrorPart1",{ns:"app"})}),(0,n.jsx)("div",{children:D("newApp.appCreateDSLErrorPart2",{ns:"app"})}),(0,n.jsx)("br",{}),(0,n.jsxs)("div",{children:[D("newApp.appCreateDSLErrorPart3",{ns:"app"}),(0,n.jsx)("span",{className:"system-md-medium",children:z?.importedVersion})]}),(0,n.jsxs)("div",{children:[D("newApp.appCreateDSLErrorPart4",{ns:"app"}),(0,n.jsx)("span",{className:"system-md-medium",children:z?.systemVersion})]})]})]}),(0,n.jsxs)("div",{className:"flex items-start justify-end gap-2 self-stretch pt-6",children:[(0,n.jsx)(p.default,{variant:"secondary",onClick:()=>H(!1),children:D("newApp.Cancel",{ns:"app"})}),(0,n.jsx)(p.default,{variant:"primary",destructive:!0,onClick:er,children:D("newApp.Confirm",{ns:"app"})})]})]})]})}])},834467,e=>{"use strict";var t=e.i(890564),n=e.i(868729),a=e.i(10190);e.s(["useBillingUrl",0,e=>(0,n.useQuery)({queryKey:a.consoleQuery.billing.invoices.queryKey(),enabled:e,queryFn:async()=>(await a.consoleClient.billing.invoices()).url}),"useBindPartnerStackInfo",0,()=>(0,t.useMutation)({mutationKey:a.consoleQuery.billing.bindPartnerStack.mutationKey(),mutationFn:e=>a.consoleClient.billing.bindPartnerStack({params:{partnerKey:e.partnerKey},body:{click_id:e.clickId}})})])},891299,e=>{"use strict";var t=e.i(676315),n=e.i(623244);let a=e=>0===e?n.NUM_INFINITE:e;e.s(["getPlanVectorSpaceLimitMB",0,e=>{let t=n.ALL_PLANS[e];if(!t)return 0;var a=t.vectorSpace;let r=/^(\d+)(MB|GB)$/i.exec(a);if(!r)return 0;let s=Number.parseInt(r[1],10);return"GB"===r[2].toUpperCase()?1024*s:s},"parseCurrentPlan",0,e=>{let r=e.billing.subscription.plan,s=n.ALL_PLANS[r],i=(e,t)=>{var a;return 0===(a=e??t??0)||-1===a?n.NUM_INFINITE:a},l=e=>e?.usage??0,o=e=>{if(!e)return null;let n=(e=>{if("number"!=typeof e||e<=0)return null;if(e>=1e12)return(0,t.default)(e);if(e>=1e9)return(0,t.default)(1e3*e);let n=e.toString();if(8===n.length){let e=n.slice(0,4),a=n.slice(4,6),r=n.slice(6,8),s=(0,t.default)(`${e}-${a}-${r}`);return s.isValid()?s:null}return null})(e.reset_date);if(!n)return null;let a=n.startOf("day").diff((0,t.default)().startOf("day"),"day");return Number.isNaN(a)||a<0?null:a};return{type:r,usage:{vectorSpace:e.vector_space.size,buildApps:e.apps?.size||0,teamMembers:e.members.size,annotatedResponse:e.annotation_quota_limit.size,documentsUploadQuota:e.documents_upload_quota.size,apiRateLimit:l(e.api_rate_limit),triggerEvents:l(e.trigger_event)},total:{vectorSpace:a(e.vector_space.limit),buildApps:a(e.apps?.limit)||0,teamMembers:a(e.members.limit),annotatedResponse:a(e.annotation_quota_limit.limit),documentsUploadQuota:a(e.documents_upload_quota.limit),apiRateLimit:i(e.api_rate_limit?.limit,s?.apiRateLimit??n.NUM_INFINITE),triggerEvents:i(e.trigger_event?.limit,s?.triggerEvents)},reset:{apiRateLimit:o(e.api_rate_limit),triggerEvents:o(e.trigger_event)}}}])},762870,e=>{"use strict";var t=e.i(169508),n=e.i(406205),a=e.i(942347);function r(e,t,a){try{return e(t)}catch(e){return(0,n.l)("[nuqs] Error while parsing value `%s`: %O"+(a?" (for key `%s`)":""),t,e,a),null}}function s(e){function t(t){if(void 0===t)return null;let n="";if(Array.isArray(t)){if(void 0===t[0])return null;n=t[0]}return"string"==typeof t&&(n=t),r(e.parse,n)}return{type:"single",eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide:n=>t(n)??e}},withOptions(e){return{...this,...e}}}}let i=s({parse:e=>e,serialize:String});s({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)}),s({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)}),s({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(1&t.length?"0":"")+t}}),s({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String});let l=s({parse:e=>"true"===e.toLowerCase(),serialize:String});function o(e,t){return e.valueOf()===t.valueOf()}function c(e){return u(e)}function u(e){return s({parse:t=>e.includes(t)?t:null,serialize:String})}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",",n=e.eq??((e,t)=>e===t),a=encodeURIComponent(t);return s({parse:n=>""===n?[]:n.split(t).map((n,s)=>r(e.parse,n.replaceAll(a,t),`[${s}]`)).filter(e=>null!=e),serialize:n=>n.map(n=>(e.serialize?e.serialize(n):String(n)).replaceAll(t,a)).join(t),eq:(e,t)=>e===t||e.length===t.length&&e.every((e,a)=>n(e,t[a]))})}s({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:o}),s({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:o}),s({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:o});let p=(0,t.r)(),m={};function f(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=(0,a.useId)(),i=(0,n.i)(),l=(0,n.a)(),{history:o="replace",scroll:c=i?.scroll??!1,shallow:u=i?.shallow??!0,throttleMs:d=t.s.timeMs,limitUrlUpdates:f=i?.limitUrlUpdates,clearOnDefault:v=i?.clearOnDefault??!0,startTransition:x,urlKeys:y=m}=r,b=Object.keys(e).join(","),C=(0,a.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,y[e]??e])),[b,JSON.stringify(y)]),E=(0,n.r)(Object.values(C)),A=E.searchParams,S=(0,a.useRef)({}),w=(0,a.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(e=>{let{defaultValue:t}=e;return t}).join(",")]),N=t.t.useQueuedQueries(Object.values(C)),[I,_]=(0,a.useState)(()=>h(e,y,A??new URLSearchParams,N).state),k=(0,a.useRef)(I);if((0,n.c)("[nuq+ %s `%s`] render - state: %O, iSP: %s",s,b,I,A),Object.keys(S.current).join("&")!==Object.values(C).join("&")){let{state:t,hasChanged:a}=h(e,y,A,N,S.current,k.current);a&&((0,n.c)("[nuq+ %s `%s`] State changed: %O",s,b,{state:t,initialSearchParams:A,queuedQueries:N,queryRef:S.current,stateRef:k.current}),k.current=t,_(t)),S.current=Object.fromEntries(Object.entries(C).map(t=>{let[n,a]=t;return[a,e[n]?.type==="multi"?A?.getAll(a):A?.get(a)??null]}))}(0,a.useEffect)(()=>{let{state:t,hasChanged:a}=h(e,y,A,N,S.current,k.current);a&&((0,n.c)("[nuq+ %s `%s`] State changed: %O",s,b,{state:t,initialSearchParams:A,queuedQueries:N,queryRef:S.current,stateRef:k.current}),k.current=t,_(t))},[Object.values(C).map(e=>`${e}=${A?.getAll(e)}`).join("&"),JSON.stringify(N)]),(0,a.useEffect)(()=>{let t=Object.keys(e).reduce((t,a)=>(t[a]=t=>{let{state:r,query:i}=t;_(t=>{let{defaultValue:l}=e[a],o=C[a],c=r??l??null;return Object.is(t[a]??l??null,c)?((0,n.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",s,b,o,r,l,k.current),t):(k.current={...k.current,[a]:c},S.current[o]=i,(0,n.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",s,b,o,r,l,k.current),k.current)})},t),{});for(let a of Object.keys(e)){let e=C[a];(0,n.c)("[nuq+ %s `%s`] Subscribing to sync for `%s`",s,e,b),p.on(e,t[a])}return()=>{for(let a of Object.keys(e)){let e=C[a];(0,n.c)("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",s,e,b),p.off(e,t[a])}}},[b,C]);let T=(0,a.useCallback)(function(a){let r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},m=Object.fromEntries(Object.keys(e).map(e=>[e,null])),h="function"==typeof a?a(g(k.current,w))??m:a??m;(0,n.c)("[nuq+ %s `%s`] setState: %O",s,b,h);let y=0,A=!1,S=[];for(let[a,s]of Object.entries(h)){let m=e[a],h=C[a];if(!m||void 0===s)continue;(i.clearOnDefault??m.clearOnDefault??v)&&null!==s&&void 0!==m.defaultValue&&(m.eq??((e,t)=>e===t))(s,m.defaultValue)&&(s=null);let g=null===s?null:(m.serialize??String)(s);p.emit(h,{state:s,query:g});let b={key:h,query:g,options:{history:i.history??m.history??o,shallow:i.shallow??m.shallow??u,scroll:i.scroll??m.scroll??c,startTransition:i.startTransition??m.startTransition??x}};if(i?.limitUrlUpdates?.method==="debounce"||f?.method==="debounce"||m.limitUrlUpdates?.method==="debounce"){!0===b.options.shallow&&console.warn((0,n.s)(422));let e=i?.limitUrlUpdates?.timeMs??f?.timeMs??m.limitUrlUpdates?.timeMs??t.s.timeMs,a=t.t.push(b,e,E,l);yt(e),A?t.n.flush(E,l):t.n.getPendingPromise(E));return r??N},[b,o,u,c,d,f?.method,f?.timeMs,x,C,E.updateUrl,E.getSearchParamsSnapshot,E.rateLimitFactor,l,w]);return[(0,a.useMemo)(()=>g(I,w),[I,w]),T]}function h(e,n,a,s,i,l){let o=!1,c=Object.entries(e).reduce((e,c)=>{var u;let[d,p]=c,m=n?.[d]??d,f=s[m],h="multi"===p.type?[]:null,g=void 0===f?("multi"===p.type?a?.getAll(m):a?.get(m))??h:f;return i&&l&&((u=i[m]??h)===g||null!==u&&null!==g&&"string"!=typeof u&&"string"!=typeof g&&u.length===g.length&&u.every((e,t)=>e===g[t]))?e[d]=l[d]??null:(o=!0,e[d]=((0,t.i)(g)?null:r(p.parse,g,m))??null,i&&(i[m]=g)),e},{});if(!o){let t=Object.keys(e),n=Object.keys(l??{});o=t.length!==n.length||t.some(e=>!n.includes(e))}return{state:c,hasChanged:o}}function g(e,t){return Object.fromEntries(Object.keys(e).map(n=>[n,e[n]??t[n]??null]))}function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{parse:n,type:r,serialize:s,eq:i,defaultValue:l,...o}=t,[{[e]:c},u]=f({[e]:{parse:n??(e=>e),type:r,serialize:s,eq:i,defaultValue:l}},o);return[c,(0,a.useCallback)(function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u(n=>({[e]:"function"==typeof t?t(n[e]):t}),n)},[e,u])]}e.s(["createParser",()=>s,"parseAsArrayOf",()=>d,"parseAsBoolean",()=>l,"parseAsString",()=>i,"parseAsStringEnum",()=>c,"parseAsStringLiteral",()=>u,"useQueryState",()=>v,"useQueryStates",()=>f],762870)},218631,e=>{"use strict";var t=e.i(890564),n=e.i(868729),a=e.i(367916),r=e.i(722384);let s="education";e.s(["useEducationAdd",0,e=>{let{onSuccess:n}=e;return(0,t.useMutation)({mutationKey:[s,"education-add"],mutationFn:e=>(0,a.post)("/account/education",{body:e}),onSuccess:n})},"useEducationAutocomplete",0,()=>(0,t.useMutation)({mutationFn:e=>{let{keywords:t="",page:n=0,limit:r=40}=e;return(0,a.get)(`/account/education/autocomplete?keywords=${t}&page=${n}&limit=${r}`)}}),"useEducationStatus",0,e=>(0,n.useQuery)({enabled:!e,queryKey:[s,"education-status"],queryFn:()=>(0,a.get)("/account/education"),retry:!1,staleTime:0}),"useEducationVerify",0,()=>(0,t.useMutation)({mutationKey:[s,"education-verify"],mutationFn:()=>(0,a.get)("/account/education/verify",{},{silent:!0})}),"useInvalidateEducationStatus",0,()=>(0,r.useInvalid)([s,"education-status"])])},948124,e=>{"use strict";e.s(["EDUCATION_RE_VERIFY_ACTION",0,"educationReVerify","EDUCATION_VERIFYING_LOCALSTORAGE_ITEM",0,"educationVerifying","EDUCATION_VERIFY_URL_SEARCHPARAMS_ACTION",0,"getEducationVerify"])},14383,e=>{"use strict";var t=e.i(910151);e.s(["FilePlus01",()=>t.default])},914189,378146,922507,e=>{"use strict";var t=e.i(443355);e.s([],914189),e.s(["defaultRehypePlugins",()=>t.y],378146),e.s(["Streamdown",()=>t.C],922507)},447362,e=>{"use strict";let t={key:"@node",shortcut:"@node",title:"Search RAG Pipeline Nodes",description:"Find and jump to nodes in the current RAG pipeline by name or type",searchFn:void 0,search:async function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";arguments.length>2&&arguments[2];try{if(t.searchFn)return t.searchFn(n);return[]}catch(e){return console.warn("RAG pipeline nodes search failed:",e),[]}}};e.s(["ragPipelineNodesAction",0,t])},25339,296557,580759,e=>{"use strict";var t=e.i(162115),n=e.i(807324),a=e.i(82042);let r=e=>{let{ref:r,...s}=e;return(0,t.jsx)(n.default,{...s,ref:r,data:a.default})};r.displayName="Beaker02",e.s(["default",0,r],296557),e.i(452898),e.i(384047);var s=e.i(267539);let i=e=>{let{ref:a,...r}=e;return(0,t.jsx)(n.default,{...r,ref:a,data:s.default})};i.displayName="Unblur",e.s(["default",0,i],580759),e.s([],25339)},852171,e=>{"use strict";var t=e.i(666023),n=e.i(464143),a=e.i(893936),r=e.i(942347),s=e.i(925521),i=e.i(834467);e.s(["default",0,()=>{let e=(0,a.useSearchParams)(),l=(()=>{try{return JSON.parse(n.default.get(s.PARTNER_STACK_CONFIG.cookieName)||"{}")}catch(e){return console.error("Failed to parse partner stack info from cookie:",e),{}}})(),o=e.get("ps_partner_key")||l?.partnerKey,c=e.get("ps_xid")||l?.clickId,u=l?.partnerKey!==o||l?.clickId!==c,[d,{setTrue:p}]=(0,t.useBoolean)(!1),{mutateAsync:m}=(0,i.useBindPartnerStackInfo)(),f=globalThis.location.hostname.replace("cloud",""),h=(0,r.useCallback)(()=>{o&&c&&u&&n.default.set(s.PARTNER_STACK_CONFIG.cookieName,JSON.stringify({partnerKey:o,clickId:c}),{expires:s.PARTNER_STACK_CONFIG.saveCookieDays,path:"/",domain:f})},[o,c,u]),g=(0,r.useCallback)(async()=>{if(o&&c&&!d){let e=!1;try{await m({partnerKey:o,clickId:c}),e=!0}catch(t){t?.status===400&&(e=!0)}e&&n.default.remove(s.PARTNER_STACK_CONFIG.cookieName,{path:"/",domain:f}),p()}},[o,c,m,d,p]);return{psPartnerKey:o,psClickId:c,saveOrUpdate:h,bind:g}}])},799725,e=>{"use strict";var t,n=e.i(162115),a=e.i(335415),r=e.i(942347),s=e.i(420874),i=e.i(869931),l=e.i(429279),o=e.i(893936);e.i(816688);var c=e.i(675066),u=e.i(446717);e.i(201987);var d=e.i(207331),p=e.i(757198),m=e.i(291631),f=e.i(449980),h=e.i(137667),g=e.i(201656),v=e.i(967484),x=e.i(925521),y=e.i(751992),b=e.i(815488),C=e.i(972282),E=e.i(595009),A=e.i(356084),S=e.i(648404),w=e.i(586871),N=e.i(935139),I=e.i(742791),_=e.i(339548),k=e.i(257899),T=e.i(151094),j=e.i(766182),M=e.i(494268);let D=e=>{let{app:t,canCreate:a,onCreate:s}=e,{t:l}=(0,c.useTranslation)(),{app:o}=t,{systemFeatures:d}=(0,M.useGlobalPublicStore)(),p=t.can_trial&&d.enable_trial_app,m=(0,_.useContextSelector)(j.default,e=>e.setShowTryAppPanel),f=(0,r.useCallback)(e=>()=>{m?.(!0,{appId:e,app:t})},[m,t.category]);return(0,n.jsxs)("div",{className:(0,N.cn)("group relative flex h-[132px] cursor-pointer flex-col overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg p-4 shadow-xs hover:shadow-lg"),children:[(0,n.jsxs)("div",{className:"flex shrink-0 grow-0 items-center gap-3 pb-2",children:[(0,n.jsxs)("div",{className:"relative shrink-0",children:[(0,n.jsx)(k.default,{size:"large",iconType:o.icon_type,icon:o.icon,background:o.icon_background,imageUrl:o.icon_url}),(0,n.jsx)(u.AppTypeIcon,{wrapperClassName:"absolute -bottom-0.5 -right-0.5 w-4 h-4 rounded-[4px] border border-divider-regular outline outline-components-panel-on-panel-item-bg",className:"h-3 w-3",type:o.mode})]}),(0,n.jsxs)("div",{className:"flex grow flex-col gap-1",children:[(0,n.jsx)("div",{className:"line-clamp-1",children:(0,n.jsx)("span",{className:"system-md-semibold text-text-secondary",title:o.name,children:o.name})}),(0,n.jsx)(u.AppTypeLabel,{className:"system-2xs-medium-uppercase text-text-tertiary",type:t.app.mode})]})]}),(0,n.jsx)("div",{className:"system-xs-regular py-1 text-text-tertiary",children:(0,n.jsx)("div",{className:"line-clamp-3",children:t.description})}),(a||p)&&(0,n.jsx)("div",{className:(0,N.cn)("absolute bottom-0 left-0 right-0 hidden bg-gradient-to-t from-components-panel-gradient-2 from-[60.27%] to-transparent p-4 pt-8 group-hover:flex"),children:(0,n.jsxs)("div",{className:(0,N.cn)("grid h-8 w-full grid-cols-1 items-center space-x-2",a&&"grid-cols-2"),children:[a&&(0,n.jsxs)(T.default,{variant:"primary",onClick:()=>s(),children:[(0,n.jsx)(I.PlusIcon,{className:"mr-1 h-4 w-4"}),(0,n.jsx)("span",{className:"text-xs",children:l("newApp.useTemplate",{ns:"app"})})]}),(0,n.jsxs)(T.default,{onClick:f(t.app_id),children:[(0,n.jsx)(i.RiInformation2Line,{className:"mr-1 size-4"}),(0,n.jsx)("span",{children:l("appCard.try",{ns:"explore"})})]})]})})]})};var R=((t={}).RECOMMENDED="Recommended",t);function O(e){let{current:t,categories:a,onClick:r,onCreateFromBlank:s}=e,{t:l}=(0,c.useTranslation)();return(0,n.jsxs)("div",{className:"flex h-full w-full flex-col",children:[(0,n.jsx)("ul",{className:"pt-0.5",children:(0,n.jsx)(P,{category:"Recommended",active:"Recommended"===t,onClick:r})}),(0,n.jsx)("div",{className:"system-xs-medium-uppercase mb-0.5 mt-3 px-3 pb-1 pt-2 text-text-tertiary",children:l("newAppFromTemplate.byCategories",{ns:"app"})}),(0,n.jsx)("ul",{className:"flex grow flex-col gap-0.5",children:a.map(e=>(0,n.jsx)(P,{category:e,active:t===e,onClick:r},e))}),(0,n.jsx)(p.default,{bgStyle:"gradient"}),(0,n.jsxs)("div",{className:"flex cursor-pointer items-center gap-1 px-3 py-1 text-text-tertiary",onClick:s,children:[(0,n.jsx)(i.RiStickyNoteAddLine,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{className:"system-xs-regular",children:l("newApp.startFromBlank",{ns:"app"})})]})]})}function P(e){let{category:t,active:a,onClick:r}=e;return(0,n.jsxs)("li",{className:(0,N.cn)("group flex h-8 cursor-pointer items-center gap-2 rounded-lg p-1 pl-3 hover:bg-state-base-hover [&.active]:bg-state-base-active",a&&"active"),onClick:()=>{r?.(t)},children:["Recommended"===t&&(0,n.jsx)("div",{className:"inline-flex h-5 w-5 items-center justify-center rounded-md",children:(0,n.jsx)(i.RiThumbUpLine,{className:"h-4 w-4 text-components-menu-item-text group-[.active]:text-components-menu-item-text-active"})}),(0,n.jsx)(L,{category:t,className:(0,N.cn)("system-sm-medium text-components-menu-item-text group-hover:text-components-menu-item-text-hover group-[.active]:text-components-menu-item-text-active",a&&"system-sm-semibold")})]})}function L(e){let{category:t,className:a}=e,{t:r}=(0,c.useTranslation)();return(0,n.jsx)("span",{className:a,children:"Recommended"===t?r("newAppFromTemplate.sidebar.Recommended",{ns:"app"}):t})}let F=r.memo(e=>{let{onSuccess:t,onCreateFromBlank:a}=e,{t:s}=(0,c.useTranslation)(),{isCurrentWorkspaceEditor:i}=(0,y.useAppContext)(),{push:I}=(0,o.useRouter)(),_=R.RECOMMENDED,[k,T]=(0,r.useState)(""),[j,M]=(0,r.useState)(""),{run:P}=(0,l.useDebounceFn)(()=>{M(k)},{wait:500}),F=e=>{T(e),P()},[K,q]=(0,r.useState)([]),[B,G]=(0,r.useState)(_),{data:H,isLoading:z}=(0,A.useExploreAppList)(),V=(0,r.useMemo)(()=>{if(!H)return[];let{allList:e}=H,t=e.filter(e=>B===_||e.category===B);return 0===K.length?t:t.filter(e=>!!(K.includes(S.AppModeEnum.CHAT)&&e.app.mode===S.AppModeEnum.CHAT||K.includes(S.AppModeEnum.ADVANCED_CHAT)&&e.app.mode===S.AppModeEnum.ADVANCED_CHAT||K.includes(S.AppModeEnum.AGENT_CHAT)&&e.app.mode===S.AppModeEnum.AGENT_CHAT||K.includes(S.AppModeEnum.COMPLETION)&&e.app.mode===S.AppModeEnum.COMPLETION||K.includes(S.AppModeEnum.WORKFLOW)&&e.app.mode===S.AppModeEnum.WORKFLOW))},[K,B,_,H]),W=(0,r.useMemo)(()=>{if(!j||!V||0===V.length)return V;let e=j.toLowerCase();return V.filter(t=>t.app&&t.app.name&&t.app.name.toLowerCase().includes(e))},[j,V]),[Q,$]=r.useState(null),[Y,Z]=r.useState(!1),{handleCheckPluginDependencies:X}=(0,v.usePluginDependencies)(),J=async e=>{let{name:n,icon_type:a,icon:r,icon_background:l,description:o}=e,{export_data:c,mode:u}=await (0,E.fetchAppDetail)(Q?.app.id);try{let e=await (0,C.importDSL)({mode:b.DSLImportMode.YAML_CONTENT,yaml_content:c,name:n,icon_type:a,icon:r,icon_background:l,description:o});(0,d.trackEvent)("create_app_with_template",{app_mode:u,template_id:Q?.app.id,template_name:Q?.app.name,description:o}),Z(!1),h.default.notify({type:"success",message:s("newApp.appCreated",{ns:"app"})}),t&&t(),e.app_id&&await X(e.app_id),localStorage.setItem(x.NEED_REFRESH_APP_LIST_KEY,"1"),(0,w.getRedirection)(i,{id:e.app_id,mode:u},I)}catch{h.default.notify({type:"error",message:s("newApp.appCreateFailed",{ns:"app"})})}};return z?(0,n.jsx)("div",{className:"flex h-full items-center",children:(0,n.jsx)(f.default,{type:"area"})}):(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-divider-burn py-3",children:[(0,n.jsx)("div",{className:"min-w-[180px] pl-5",children:(0,n.jsx)("span",{className:"title-xl-semi-bold text-text-primary",children:s("newApp.startFromTemplate",{ns:"app"})})}),(0,n.jsxs)("div",{className:"flex max-w-[548px] flex-1 items-center rounded-xl border border-components-panel-border bg-components-panel-bg-blur p-1.5 shadow-md",children:[(0,n.jsx)(u.default,{value:K,onChange:q}),(0,n.jsx)("div",{className:"h-[14px]",children:(0,n.jsx)(p.default,{type:"vertical"})}),(0,n.jsx)(m.default,{showClearIcon:!0,wrapperClassName:"w-full flex-1",className:"bg-transparent hover:border-transparent hover:bg-transparent focus:border-transparent focus:bg-transparent focus:shadow-none",placeholder:s("newAppFromTemplate.searchAllTemplate",{ns:"app"}),value:k,onChange:e=>F(e.target.value),onClear:()=>F("")})]}),(0,n.jsx)("div",{className:"h-8 w-[180px]"})]}),(0,n.jsxs)("div",{className:"relative flex flex-1 overflow-y-auto",children:[!j&&(0,n.jsx)("div",{className:"h-full w-[200px] p-4",children:(0,n.jsx)(O,{current:B,categories:H?.categories||[],onClick:e=>{G(e)},onCreateFromBlank:a})}),(0,n.jsxs)("div",{className:"h-full flex-1 shrink-0 grow overflow-auto border-l border-divider-burn p-6 pt-2",children:[W&&W.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"pb-1 pt-4",children:j?(0,n.jsx)("p",{className:"title-md-semi-bold text-text-tertiary",children:W.length>1?s("newApp.foundResults",{ns:"app",count:W.length}):s("newApp.foundResult",{ns:"app",count:W.length})}):(0,n.jsx)("div",{className:"flex h-[22px] items-center",children:(0,n.jsx)(L,{category:B,className:"title-md-semi-bold text-text-primary"})})}),(0,n.jsx)("div",{className:(0,N.cn)("grid shrink-0 grid-cols-1 content-start gap-3 sm:grid-cols-1 md:grid-cols-2 xl:grid-cols-4 2xl:grid-cols-5 2k:grid-cols-6"),children:W.map(e=>(0,n.jsx)(D,{app:e,canCreate:i,onCreate:()=>{$(e),Z(!0)}},e.app_id))})]}),(!W||0===W.length)&&(0,n.jsx)(U,{})]})]}),Y&&(0,n.jsx)(g.default,{appIconType:Q?.app.icon_type||"emoji",appIcon:Q?.app.icon||"",appIconBackground:Q?.app.icon_background||"",appIconUrl:Q?.app.icon_url,appName:Q?.app.name||"",appDescription:Q?.app.description||"",show:Y,onConfirm:J,onHide:()=>Z(!1)})]})});function U(){let{t:e}=(0,c.useTranslation)();return(0,n.jsxs)("div",{className:"w-full rounded-lg bg-workflow-process-bg p-4",children:[(0,n.jsx)("div",{className:"mb-2 inline-flex h-8 w-8 items-center justify-center rounded-lg bg-components-card-bg shadow-lg",children:(0,n.jsx)(i.RiRobot2Line,{className:"h-5 w-5 text-text-tertiary"})}),(0,n.jsx)("p",{className:"title-md-semi-bold text-text-primary",children:e("newApp.noTemplateFound",{ns:"app"})}),(0,n.jsx)("p",{className:"system-sm-regular text-text-tertiary",children:e("newApp.noTemplateFoundTip",{ns:"app"})})]})}e.s(["default",0,e=>{let{show:t,onSuccess:i,onClose:l,onCreateFromBlank:o}=e,c=(0,r.useCallback)(()=>{t&&l()},[t,l]);return(0,a.useKeyPress)("esc",c),(0,n.jsx)(s.default,{open:t,closable:!0,onClose:l,children:(0,n.jsx)(F,{onCreateFromBlank:o,onSuccess:()=>{i(),l()}})})}],799725)},420874,e=>{"use strict";var t=e.i(162115),n=e.i(490106),a=e.i(434362),r=e.i(869931),s=e.i(220365),i=e.i(935139);function l(e){let{className:l,wrapperClassName:o,open:c,onClose:u=s.noop,children:d,closable:p=!1,overflowVisible:m=!1}=e;return(0,t.jsx)(a.Transition,{show:c,appear:!0,children:(0,t.jsxs)(n.Dialog,{as:"div",className:(0,i.cn)("modal-dialog",o),onClose:u,children:[(0,t.jsx)(a.TransitionChild,{children:(0,t.jsx)("div",{className:(0,i.cn)("fixed inset-0 bg-background-overlay-backdrop backdrop-blur-[6px]","duration-300 ease-in data-[closed]:opacity-0","data-[enter]:opacity-100","data-[leave]:opacity-0")})}),(0,t.jsx)("div",{className:"fixed inset-0 h-screen w-screen p-4",onClick:e=>{e.preventDefault(),e.stopPropagation()},children:(0,t.jsx)("div",{className:"relative h-full w-full rounded-2xl border border-effects-highlight bg-background-default-subtle",children:(0,t.jsx)(a.TransitionChild,{children:(0,t.jsxs)(n.DialogPanel,{className:(0,i.cn)("h-full",m?"overflow-visible":"overflow-hidden","duration-100 ease-in data-[closed]:scale-95 data-[closed]:opacity-0","data-[enter]:scale-100 data-[enter]:opacity-100","data-[enter]:scale-95 data-[leave]:opacity-0",l),children:[p&&(0,t.jsx)("div",{className:"absolute right-3 top-3 z-50 flex h-9 w-9 cursor-pointer items-center justify-center rounded-[10px] bg-components-button-tertiary-bg hover:bg-components-button-tertiary-bg-hover",onClick:e=>{e.stopPropagation(),u()},children:(0,t.jsx)(r.RiCloseLargeLine,{className:"h-3.5 w-3.5 text-components-button-tertiary-text"})}),d]})})})})]})})}e.s(["default",()=>l])},222024,e=>{"use strict";var t=e.i(162115),n=e.i(869931),a=e.i(429279),r=e.i(335415),s=e.i(893936),i=e.i(942347);e.i(816688);var l=e.i(675066),o=e.i(339548);e.i(201987);var c=e.i(207331),u=e.i(257899),d=e.i(151094),p=e.i(757198),m=e.i(420874);e.i(417885);var f=e.i(192791),h=e.i(963303),g=e.i(803264),v=e.i(483253),x=e.i(291631),y=e.i(873517),b=e.i(734962),C=e.i(921568),E=e.i(925521),A=e.i(751992),S=e.i(327069),w=e.i(922521),N=e.i(972282),I=e.i(648404),_=e.i(586871),k=e.i(935139),T=e.i(168014),j=e.i(360972),M=e.i(194902);function D(e){let{onClose:m,onSuccess:w,onCreateFromTemplate:k,defaultAppMode:T}=e,{t:D}=(0,l.useTranslation)(),{push:L}=(0,s.useRouter)(),{notify:F}=(0,o.useContext)(b.ToastContext),[U,K]=(0,i.useState)(T||I.AppModeEnum.ADVANCED_CHAT),[q,B]=(0,i.useState)({type:"emoji",icon:"🤖",background:"#FFEAD5"}),[G,H]=(0,i.useState)(!1),[z,V]=(0,i.useState)(""),[W,Q]=(0,i.useState)(""),[$,Y]=(0,i.useState)(!1),{plan:Z,enableBilling:X}=(0,S.useProviderContext)(),J=X&&Z.usage.buildApps>=Z.total.buildApps,{isCurrentWorkspaceEditor:ee}=(0,A.useAppContext)(),et=(0,i.useRef)(!1);(0,i.useEffect)(()=>{(U===I.AppModeEnum.CHAT||U===I.AppModeEnum.AGENT_CHAT||U===I.AppModeEnum.COMPLETION)&&Y(!0)},[U]);let en=(0,i.useCallback)(async()=>{if(!U)return void F({type:"error",message:D("newApp.appTypeRequired",{ns:"app"})});if(!z.trim())return void F({type:"error",message:D("newApp.nameNotEmpty",{ns:"app"})});if(!et.current){et.current=!0;try{let e=await (0,N.createApp)({name:z,description:W,icon_type:q.type,icon:"emoji"===q.type?q.icon:q.fileId,icon_background:"emoji"===q.type?q.background:void 0,mode:U});(0,c.trackEvent)("create_app",{app_mode:U,description:W}),F({type:"success",message:D("newApp.appCreated",{ns:"app"})}),w(),m(),localStorage.setItem(E.NEED_REFRESH_APP_LIST_KEY,"1"),(0,_.getRedirection)(ee,e,L)}catch(e){F({type:"error",message:e.message||D("newApp.appCreateFailed",{ns:"app"})})}et.current=!1}},[z,F,D,U,q,W,w,m,L,ee]),{run:ea}=(0,a.useDebounceFn)(en,{wait:300});return(0,r.useKeyPress)(["meta.enter","ctrl.enter"],()=>{J||ea()}),(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"flex h-full justify-center overflow-y-auto overflow-x-hidden",children:[(0,t.jsx)("div",{className:"flex flex-1 shrink-0 justify-end",children:(0,t.jsxs)("div",{className:"px-10",children:[(0,t.jsx)("div",{className:"h-6 w-full 2xl:h-[139px]"}),(0,t.jsx)("div",{className:"pb-6 pt-1",children:(0,t.jsx)("span",{className:"text-text-primary title-2xl-semi-bold",children:D("newApp.startFromBlank",{ns:"app"})})}),(0,t.jsx)("div",{className:"mb-2 leading-6",children:(0,t.jsx)("span",{className:"text-text-secondary system-sm-semibold",children:D("newApp.chooseAppType",{ns:"app"})})}),(0,t.jsxs)("div",{className:"flex w-[660px] flex-col gap-4",children:[(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:"flex flex-row gap-2",children:[(0,t.jsx)(R,{active:U===I.AppModeEnum.WORKFLOW,title:D("types.workflow",{ns:"app"}),description:D("newApp.workflowShortDescription",{ns:"app"}),icon:(0,t.jsx)("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-components-icon-bg-indigo-solid",children:(0,t.jsx)(n.RiExchange2Fill,{className:"h-4 w-4 text-components-avatar-shape-fill-stop-100"})}),onClick:()=>{K(I.AppModeEnum.WORKFLOW)}}),(0,t.jsx)(R,{active:U===I.AppModeEnum.ADVANCED_CHAT,title:D("types.advanced",{ns:"app"}),description:D("newApp.advancedShortDescription",{ns:"app"}),icon:(0,t.jsx)("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-components-icon-bg-blue-light-solid",children:(0,t.jsx)(f.BubbleTextMod,{className:"h-4 w-4 text-components-avatar-shape-fill-stop-100"})}),onClick:()=>{K(I.AppModeEnum.ADVANCED_CHAT)}})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"mb-2 flex items-center",children:(0,t.jsxs)("button",{type:"button",className:"flex cursor-pointer items-center border-0 bg-transparent p-0",onClick:()=>Y(!$),children:[(0,t.jsx)("span",{className:"text-text-tertiary system-2xs-medium-uppercase",children:D("newApp.forBeginners",{ns:"app"})}),(0,t.jsx)(n.RiArrowRightSLine,{className:`ml-1 h-4 w-4 text-text-tertiary transition-transform ${$?"rotate-90":""}`})]})}),$&&(0,t.jsxs)("div",{className:"flex flex-row gap-2",children:[(0,t.jsx)(R,{active:U===I.AppModeEnum.CHAT,title:D("types.chatbot",{ns:"app"}),description:D("newApp.chatbotShortDescription",{ns:"app"}),icon:(0,t.jsx)("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-components-icon-bg-blue-solid",children:(0,t.jsx)(h.ChatBot,{className:"h-4 w-4 text-components-avatar-shape-fill-stop-100"})}),onClick:()=>{K(I.AppModeEnum.CHAT)}}),(0,t.jsx)(R,{active:U===I.AppModeEnum.AGENT_CHAT,title:D("types.agent",{ns:"app"}),description:D("newApp.agentShortDescription",{ns:"app"}),icon:(0,t.jsx)("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-components-icon-bg-violet-solid",children:(0,t.jsx)(v.Logic,{className:"h-4 w-4 text-components-avatar-shape-fill-stop-100"})}),onClick:()=>{K(I.AppModeEnum.AGENT_CHAT)}}),(0,t.jsx)(R,{active:U===I.AppModeEnum.COMPLETION,title:D("newApp.completeApp",{ns:"app"}),description:D("newApp.completionShortDescription",{ns:"app"}),icon:(0,t.jsx)("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-components-icon-bg-teal-solid",children:(0,t.jsx)(g.ListSparkle,{className:"h-4 w-4 text-components-avatar-shape-fill-stop-100"})}),onClick:()=>{K(I.AppModeEnum.COMPLETION)}})]})]}),(0,t.jsx)(p.default,{style:{margin:0}}),(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("div",{className:"mb-1 flex h-6 items-center",children:(0,t.jsx)("label",{className:"text-text-secondary system-sm-semibold",children:D("newApp.captionName",{ns:"app"})})}),(0,t.jsx)(x.default,{value:z,onChange:e=>V(e.target.value),placeholder:D("newApp.appNamePlaceholder",{ns:"app"})||""})]}),(0,t.jsx)(u.default,{iconType:q.type,icon:"emoji"===q.type?q.icon:q.fileId,background:"emoji"===q.type?q.background:void 0,imageUrl:"image"===q.type?q.url:void 0,size:"xxl",className:"cursor-pointer rounded-2xl",onClick:()=>{H(!0)}}),G&&(0,t.jsx)(j.default,{onSelect:e=>{B(e),H(!1)},onClose:()=>{H(!1)}})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-1 flex h-6 items-center",children:[(0,t.jsx)("label",{className:"text-text-secondary system-sm-semibold",children:D("newApp.captionDescription",{ns:"app"})}),(0,t.jsxs)("span",{className:"ml-1 text-text-tertiary system-xs-regular",children:["(",D("newApp.optional",{ns:"app"}),")"]})]}),(0,t.jsx)(y.default,{className:"resize-none",placeholder:D("newApp.appDescriptionPlaceholder",{ns:"app"})||"",value:W,onChange:e=>Q(e.target.value)})]})]}),J&&(0,t.jsx)(C.default,{className:"mt-4",loc:"app-create"}),(0,t.jsxs)("div",{className:"flex items-center justify-between pb-10 pt-5",children:[(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1 text-text-tertiary system-xs-regular",onClick:k,children:[(0,t.jsx)("span",{children:D("newApp.noIdeaTip",{ns:"app"})}),(0,t.jsx)("div",{className:"p-[1px]",children:(0,t.jsx)(n.RiArrowRightLine,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(d.default,{onClick:m,children:D("newApp.Cancel",{ns:"app"})}),(0,t.jsxs)(d.default,{disabled:J||!z,className:"gap-1",variant:"primary",onClick:ea,children:[(0,t.jsx)("span",{children:D("newApp.Create",{ns:"app"})}),(0,t.jsx)(M.default,{keys:["ctrl","↵"],bgColor:"white"})]})]})]})]})}),(0,t.jsxs)("div",{className:"relative flex h-full flex-1 shrink justify-start overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute left-0 right-0 top-0 h-6 border-b border-b-divider-subtle 2xl:h-[139px]"}),(0,t.jsxs)("div",{className:"max-w-[760px] border-x border-x-divider-subtle",children:[(0,t.jsx)("div",{className:"h-6 2xl:h-[139px]"}),(0,t.jsx)(O,{mode:U}),(0,t.jsx)("div",{className:"absolute left-0 right-0 border-b border-b-divider-subtle"}),(0,t.jsxs)("div",{className:"flex h-[448px] w-[664px] items-center justify-center",style:{background:"repeating-linear-gradient(135deg, transparent, transparent 2px, rgba(16,24,40,0.04) 4px,transparent 3px, transparent 6px)"},children:[(0,t.jsx)(P,{show:U===I.AppModeEnum.CHAT,mode:I.AppModeEnum.CHAT}),(0,t.jsx)(P,{show:U===I.AppModeEnum.ADVANCED_CHAT,mode:I.AppModeEnum.ADVANCED_CHAT}),(0,t.jsx)(P,{show:U===I.AppModeEnum.AGENT_CHAT,mode:I.AppModeEnum.AGENT_CHAT}),(0,t.jsx)(P,{show:U===I.AppModeEnum.COMPLETION,mode:I.AppModeEnum.COMPLETION}),(0,t.jsx)(P,{show:U===I.AppModeEnum.WORKFLOW,mode:I.AppModeEnum.WORKFLOW})]}),(0,t.jsx)("div",{className:"absolute left-0 right-0 border-b border-b-divider-subtle"})]})]})]})})}function R(e){let{icon:n,title:a,description:r,active:s,onClick:i}=e;return(0,t.jsxs)("div",{className:(0,k.cn)(`relative box-content h-[84px] w-[191px] cursor-pointer rounded-xl border-[0.5px] border-components-option-card-option-border bg-components-panel-on-panel-item-bg p-3 shadow-xs hover:shadow-md`,s?"shadow-md outline outline-[1.5px] outline-components-option-card-option-selected-border":""),onClick:i,children:[n,(0,t.jsx)("div",{className:"mb-0.5 mt-2 text-text-secondary system-sm-semibold",children:a}),(0,t.jsx)("div",{className:"line-clamp-2 text-text-tertiary system-xs-regular",title:r,children:r})]})}function O(e){let{mode:n}=e,{t:a}=(0,l.useTranslation)(),r={[I.AppModeEnum.CHAT]:{title:a("types.chatbot",{ns:"app"}),description:a("newApp.chatbotUserDescription",{ns:"app"})},[I.AppModeEnum.ADVANCED_CHAT]:{title:a("types.advanced",{ns:"app"}),description:a("newApp.advancedUserDescription",{ns:"app"})},[I.AppModeEnum.AGENT_CHAT]:{title:a("types.agent",{ns:"app"}),description:a("newApp.agentUserDescription",{ns:"app"})},[I.AppModeEnum.COMPLETION]:{title:a("newApp.completeApp",{ns:"app"}),description:a("newApp.completionUserDescription",{ns:"app"})},[I.AppModeEnum.WORKFLOW]:{title:a("types.workflow",{ns:"app"}),description:a("newApp.workflowUserDescription",{ns:"app"})}}[n];return(0,t.jsxs)("div",{className:"px-8 py-4",children:[(0,t.jsx)("h4",{className:"text-text-secondary system-sm-semibold-uppercase",children:r.title}),(0,t.jsx)("div",{className:"mt-1 min-h-8 max-w-96 text-text-tertiary system-xs-regular",children:(0,t.jsx)("span",{children:r.description})})]})}function P(e){let{mode:n,show:a}=e,{theme:r}=(0,w.default)(),s={[I.AppModeEnum.CHAT]:"Chatbot",[I.AppModeEnum.ADVANCED_CHAT]:"Chatflow",[I.AppModeEnum.AGENT_CHAT]:"Agent",[I.AppModeEnum.COMPLETION]:"TextGenerator",[I.AppModeEnum.WORKFLOW]:"Workflow"};return(0,t.jsxs)("picture",{children:[(0,t.jsx)("source",{media:"(resolution: 1x)",srcSet:`${T.basePath}/screenshots/${r}/${s[n]}.png`}),(0,t.jsx)("source",{media:"(resolution: 2x)",srcSet:`${T.basePath}/screenshots/${r}/${s[n]}@2x.png`}),(0,t.jsx)("source",{media:"(resolution: 3x)",srcSet:`${T.basePath}/screenshots/${r}/${s[n]}@3x.png`}),(0,t.jsx)("img",{className:a?"":"hidden",src:`${T.basePath}/screenshots/${r}/${s[n]}.png`,alt:"App Screen Shot",width:664,height:448})]})}e.s(["default",0,e=>{let{show:n,onClose:a,onSuccess:r,onCreateFromTemplate:s,defaultAppMode:i}=e;return(0,t.jsx)(m.default,{overflowVisible:!0,closable:!0,open:n,onClose:a,children:(0,t.jsx)(D,{onClose:a,onSuccess:r,onCreateFromTemplate:s,defaultAppMode:i})})}])},182915,e=>{"use strict";var t=e.i(925521);e.s(["setZendeskConversationFields",0,(e,n)=>{!t.IS_CE_EDITION&&window.zE&&window.zE("messenger:set","conversationFields",e,n)},"toggleZendeskWindow",0,e=>{!t.IS_CE_EDITION&&window.zE&&window.zE("messenger",e?"open":"close")}])},559906,e=>{"use strict";var t=e.i(162115),n=e.i(830616),a=e.i(942347);e.i(201987);var r=e.i(207331),s=e.i(182915);e.i(47690);var i=e.i(773961),i=i,l=e.i(225162),o=e.i(491234);let c=()=>{let e=(0,l.useLanguage)(),[n,r]=(0,a.useState)(()=>"1"!==localStorage.getItem("hide-maintenance-notice")),s=o.NOTICE_I18N.title,c=o.NOTICE_I18N.desc;return n?(0,t.jsxs)("div",{className:"z-20 flex h-[38px] shrink-0 items-center border-[0.5px] border-b border-b-[#FEF0C7] bg-[#FFFAEB] px-4",children:[(0,t.jsx)("div",{className:"mr-2 flex h-[22px] shrink-0 items-center rounded-xl bg-[#F79009] px-2 text-[11px] font-medium text-white",children:s[e]}),o.NOTICE_I18N.href&&"#"!==o.NOTICE_I18N.href?(0,t.jsx)("div",{className:"grow cursor-pointer text-xs font-medium text-gray-700",onClick:()=>{window.open(o.NOTICE_I18N.href,"_blank")},children:c[e]}):(0,t.jsx)("div",{className:"grow text-xs font-medium text-gray-700",children:c[e]}),(0,t.jsx)(i.default,{className:"h-4 w-4 shrink-0 cursor-pointer text-gray-500",onClick:()=>{localStorage.setItem("hide-maintenance-notice","1"),r(!1)}})]}):null};var u=e.i(925521),d=e.i(751992),p=e.i(831082),m=e.i(652669),f=e.i(494268);e.s(["AppContextProvider",0,e=>{let{children:i}=e,l=(0,n.useQueryClient)(),o=(0,f.useGlobalPublicStore)(e=>e.systemFeatures),{data:h}=(0,m.useUserProfile)(),{data:g,isPending:v,isFetching:x}=(0,m.useCurrentWorkspace)(),y=(0,m.useLangGeniusVersion)(h?.meta.currentVersion,!o.branding.enabled),b=(0,a.useMemo)(()=>h?.profile||d.userProfilePlaceholder,[h?.profile]),C=(0,a.useMemo)(()=>g||d.initialWorkspaceInfo,[g]),E=(0,a.useMemo)(()=>{if(!h?.meta?.currentVersion||!y.data)return d.initialLangGeniusVersionInfo;let e=h.meta.currentVersion,t=h.meta.currentEnv||"",n=y.data;return{...n,current_version:e,latest_version:n.version,current_env:t}},[y.data,h?.meta]),A=(0,a.useMemo)(()=>["owner","admin"].includes(C.role),[C.role]),S=(0,a.useMemo)(()=>"owner"===C.role,[C.role]),w=(0,a.useMemo)(()=>["owner","admin","editor"].includes(C.role),[C.role]),N=(0,a.useMemo)(()=>"dataset_operator"===C.role,[C.role]),I=(0,a.useCallback)(()=>{l.invalidateQueries({queryKey:["common","user-profile"]})},[l]),_=(0,a.useCallback)(()=>{l.invalidateQueries({queryKey:["common","current-workspace"]})},[l]);return(0,a.useEffect)(()=>{u.ZENDESK_FIELD_IDS.ENVIRONMENT&&E?.current_env&&(0,s.setZendeskConversationFields)([{id:u.ZENDESK_FIELD_IDS.ENVIRONMENT,value:E.current_env.toLowerCase()}])},[E?.current_env]),(0,a.useEffect)(()=>{u.ZENDESK_FIELD_IDS.VERSION&&E?.version&&(0,s.setZendeskConversationFields)([{id:u.ZENDESK_FIELD_IDS.VERSION,value:E.version}])},[E?.version]),(0,a.useEffect)(()=>{u.ZENDESK_FIELD_IDS.EMAIL&&b?.email&&(0,s.setZendeskConversationFields)([{id:u.ZENDESK_FIELD_IDS.EMAIL,value:b.email}])},[b?.email]),(0,a.useEffect)(()=>{u.ZENDESK_FIELD_IDS.WORKSPACE_ID&&C?.id&&(0,s.setZendeskConversationFields)([{id:u.ZENDESK_FIELD_IDS.WORKSPACE_ID,value:C.id}])},[C?.id]),(0,a.useEffect)(()=>{if(b?.id){(0,r.setUserId)(b.email);let e={email:b.email,name:b.name,has_password:b.is_password_set};C?.id&&(e.workspace_id=C.id,e.workspace_name=C.name,e.workspace_plan=C.plan,e.workspace_status=C.status,e.workspace_role=C.role),(0,r.setUserProperties)(e)}},[b,C]),(0,t.jsx)(d.AppContext.Provider,{value:{userProfile:b,mutateUserProfile:I,langGeniusVersionInfo:E,useSelector:d.useSelector,currentWorkspace:C,isCurrentWorkspaceManager:A,isCurrentWorkspaceOwner:S,isCurrentWorkspaceEditor:w,isCurrentWorkspaceDatasetOperator:N,mutateCurrentWorkspace:_,isLoadingCurrentWorkspace:v,isValidatingCurrentWorkspace:x},children:(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-y-auto",children:[p.env.NEXT_PUBLIC_MAINTENANCE_NOTICE&&(0,t.jsx)(c,{}),(0,t.jsx)("div",{className:"relative flex grow flex-col overflow-y-auto overflow-x-hidden bg-background-body",children:i})]})})}],559906)},250732,e=>{"use strict";var t=e.i(367916);e.s(["fetchCurrentPlanInfo",0,()=>(0,t.get)("/features"),"fetchSubscriptionUrls",0,(e,n)=>(0,t.get)(`/billing/subscription?plan=${e}&interval=${n}`)])},203836,e=>{"use strict";var t=e.i(772870);e.s(["sendGAEvent",0,(e,n)=>{t.isServer||"function"!=typeof window.gtag||window.gtag("event",e,n)}])},568484,e=>{"use strict";var t=e.i(464143),n=e.i(893936),a=e.i(762870),r=e.i(942347),s=e.i(948124),i=e.i(203836),l=e.i(130119),o=e.i(361533);e.i(201987);var c=e.i(207331);e.s(["AppInitializer",0,e=>{let{children:u}=e,d=(0,n.useRouter)(),p=(0,n.useSearchParams)(),m=(0,n.usePathname)(),[f,h]=(0,r.useState)(!1),[g]=(0,a.useQueryState)("oauth_new_user",a.parseAsBoolean.withOptions({history:"replace"})),v=(0,r.useCallback)(async()=>{try{let e=await (0,l.fetchSetupStatusWithCache)();return"finished"===e.step}catch(e){return console.error(e),!1}},[]);return(0,r.useEffect)(()=>{(async()=>{let e=p.get("action");if(g){let e=null,n=t.default.get("utm_info");if(n)try{e=JSON.parse(n)}catch(e){console.error("Failed to parse utm_info cookie:",e)}(0,c.trackEvent)(e?"user_registration_success_with_utm":"user_registration_success",{method:"oauth",...e}),(0,i.sendGAEvent)(e?"user_registration_success_with_utm":"user_registration_success",{method:"oauth",...e}),t.default.remove("utm_info")}null!==g&&d.replace(m),e===s.EDUCATION_VERIFY_URL_SEARCHPARAMS_ACTION&&localStorage.setItem(s.EDUCATION_VERIFYING_LOCALSTORAGE_ITEM,"yes");try{if(!await v())return void d.replace("/install");let e=(0,o.resolvePostLoginRedirect)();if(e)return void location.replace(e);h(!0)}catch{d.replace("/signin")}})()},[v,d,m,p,g]),f?u:null}])},782420,e=>{e.v({alpha:"index-module__iq-hpG__alpha","header-DEVELOPMENT":"index-module__iq-hpG__header-DEVELOPMENT","header-TESTING":"index-module__iq-hpG__header-TESTING"})},793872,e=>{"use strict";var t=e.i(162115),n=e.i(893936),a=e.i(942347),r=e.i(698094),s=e.i(935139),i=e.i(782420);e.s(["default",0,e=>{let{children:l}=e,o=(0,n.usePathname)(),c=["/apps","/datasets/create","/tools"].includes(o),u=o.endsWith("/workflow"),d=o.endsWith("/pipeline"),p="true"===localStorage.getItem("workflow-canvas-maximize"),[m,f]=(0,a.useState)(p),{eventEmitter:h}=(0,r.useEventEmitterContextContext)();return h?.useSubscription(e=>{e?.type==="workflow-canvas-maximize"&&f(e.payload)}),(0,t.jsx)("div",{className:(0,s.cn)("sticky left-0 right-0 top-0 z-[30] flex min-h-[56px] shrink-0 grow-0 basis-auto flex-col",i.default.header,c?"border-b border-divider-regular":"",m&&(u||d)&&"hidden"),children:l})}])},769388,e=>{"use strict";var t=e.i(162115),n=e.i(824627),a=e.i(942347),r=function(){var e=this;this.subscriptions=new Set,this.emit=function(t){var a,r;try{for(var s=(0,n.__values)(e.subscriptions),i=s.next();!i.done;i=s.next())(0,i.value)(t)}catch(e){a={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}},this.useSubscription=function(t){var n=(0,a.useRef)(void 0);n.current=t,(0,a.useEffect)(function(){function t(e){n.current&&n.current(e)}return e.subscriptions.add(t),function(){e.subscriptions.delete(t)}},[])}};let s=function(){var e=(0,a.useRef)(void 0);return e.current||(e.current=new r),e.current};var i=e.i(698094);e.s(["EventEmitterContextProvider",0,e=>{let{children:n}=e,a=s();return(0,t.jsx)(i.EventEmitterContext.Provider,{value:{eventEmitter:a},children:n})}],769388)},974203,e=>{"use strict";var t=e.i(162115),n=e.i(266557),a=e.i(942347),r=e.i(59375),s=e.i(948124),i=e.i(751992),l=e.i(327069),o=e.i(549213),c=e.i(676315),u=e.i(623244),d=e.i(342687),p=e.i(925521),m=e.i(772870),f=e.i(421850);let h=(0,n.default)(()=>e.A(731569),{loadableGenerated:{modules:[924697]},ssr:!1}),g=(0,n.default)(()=>e.A(165508),{loadableGenerated:{modules:[117658]},ssr:!1}),v=(0,n.default)(()=>e.A(533206),{loadableGenerated:{modules:[157154]},ssr:!1}),x=(0,n.default)(()=>e.A(419015),{loadableGenerated:{modules:[668887]},ssr:!1}),y=(0,n.default)(()=>e.A(139499),{loadableGenerated:{modules:[812340]},ssr:!1}),b=(0,n.default)(()=>e.A(384251),{loadableGenerated:{modules:[535952]},ssr:!1}),C=(0,n.default)(()=>e.A(271777),{loadableGenerated:{modules:[359540]},ssr:!1}),E=(0,n.default)(()=>e.A(295276),{loadableGenerated:{modules:[955852]},ssr:!1}),A=(0,n.default)(()=>e.A(347789),{loadableGenerated:{modules:[100550]},ssr:!1}),S=(0,n.default)(()=>e.A(710986),{loadableGenerated:{modules:[553791]},ssr:!1}),w=(0,n.default)(()=>e.A(511009),{loadableGenerated:{modules:[43994]},ssr:!1}),N=(0,n.default)(()=>e.A(110135),{loadableGenerated:{modules:[834473]},ssr:!1}),I=(0,n.default)(()=>e.A(69654),{loadableGenerated:{modules:[672545]},ssr:!1}),_=f.ModalContext;e.s(["ModalContextProvider",0,e=>{let{children:n}=e,[_,k]=(0,o.usePricingModal)(),[T,j]=(0,o.useAccountSettingModal)(),M=(0,a.useRef)(null),D=T.isOpen?(0,r.isValidAccountSettingTab)(T.payload)?T.payload:r.DEFAULT_ACCOUNT_SETTING_TAB:null,[R,O]=(0,a.useState)(null),[P,L]=(0,a.useState)(null),[F,U]=(0,a.useState)(null),[K,q]=(0,a.useState)(null),[B,G]=(0,a.useState)(null),[H,z]=(0,a.useState)(null),[V,W]=(0,a.useState)(null),[Q,$]=(0,a.useState)(null),[Y,Z]=(0,a.useState)(null),{currentWorkspace:X}=(0,i.useAppContext)(),[J,ee]=(0,a.useState)(!1),et=(0,a.useCallback)(e=>{j({payload:e})},[j]),en=(0,a.useCallback)(e=>{let t=D?{payload:D,...M.current??{}}:null,n="function"==typeof e?e(t):e;if(!n){M.current=null,j(null);return}let{payload:a,...r}=n;M.current=r,j({payload:a})},[D,j]);(0,a.useEffect)(()=>{T.isOpen||(M.current=null)},[T.isOpen]);let{plan:ea,isFetchedPlan:er}=(0,l.useProviderContext)(),{showTriggerEventsLimitModal:es,setShowTriggerEventsLimitModal:ei,persistTriggerEventsLimitModalDismiss:el}=(e=>{let{plan:t,isFetchedPlan:n,currentWorkspaceId:r}=e,[s,i]=(0,a.useState)(null),l=(0,a.useRef)({});(0,a.useEffect)(()=>{if(!p.IS_CLOUD_EDITION||m.isServer||!r)return;if(!n)return void i(null);let{type:e,usage:a,total:o,reset:f}=t,h=o.triggerEvents===u.NUM_INFINITE,g=o.triggerEvents>0&&a.triggerEvents>=o.triggerEvents;if(e===d.Plan.team||h||!g){s&&i(null);return}let v=e===d.Plan.professional&&o.triggerEvents!==u.NUM_INFINITE?f.triggerEvents??void 0:void 0,x="number"==typeof f.triggerEvents?(0,c.default)().startOf("day").add(f.triggerEvents,"day").format("YYYY-MM-DD"):e===d.Plan.sandbox?(0,c.default)().endOf("month").format("YYYY-MM-DD"):"none",y=`trigger-events-limit-dismissed-${r}-${e}-${o.triggerEvents}-${x}`;if(l.current[y])return;let b=!0,C=!1;try{"1"===localStorage.getItem(y)&&(C=!0)}catch{b=!1}C||s?.payload.storageKey!==y&&i({payload:{usage:a.triggerEvents,total:o.triggerEvents,resetInDays:v,storageKey:y,persistDismiss:b}})},[t,n,s,r]);let o=(0,a.useCallback)(()=>{let e=s?.payload.storageKey;if(e){if(s?.payload.persistDismiss)try{localStorage.setItem(e,"1");return}catch{}l.current[e]=!0}},[s]);return{showTriggerEventsLimitModal:s,setShowTriggerEventsLimitModal:i,persistTriggerEventsLimitModalDismiss:o}})({plan:ea,isFetchedPlan:er,currentWorkspaceId:X?.id}),eo=(0,a.useCallback)(()=>{q(null),K?.onCancelCallback&&K.onCancelCallback()},[K]),ec=(0,a.useCallback)(e=>{K?.onSaveCallback&&K.onSaveCallback(K.payload,e),q(null)},[K]),eu=(0,a.useCallback)(e=>{K?.onRemoveCallback&&K.onRemoveCallback(K.payload,e),q(null)},[K]),ed=(0,a.useCallback)(()=>{G(null),B?.onCancelCallback&&B.onCancelCallback()},[B]),ep=(0,a.useCallback)(async e=>{B?.onSaveCallback&&B.onSaveCallback(e),G(null)},[B]),em=(0,a.useCallback)(async e=>{B?.onEditCallback&&B.onEditCallback(e),G(null)},[B]),ef=(0,a.useCallback)(()=>{W(null),V?.onCancelCallback&&V.onCancelCallback()},[V]),eh=(0,a.useCallback)(()=>{k(!0)},[k]),eg=(0,a.useCallback)(()=>{k(!1)},[k]);return(0,t.jsx)(f.ModalContext.Provider,{value:{setShowAccountSettingModal:en,setShowApiBasedExtensionModal:O,setShowModerationSettingModal:L,setShowExternalDataToolModal:U,setShowPricingModal:eh,setShowAnnotationFullModal:()=>ee(!0),setShowModelModal:q,setShowExternalKnowledgeAPIModal:G,setShowModelLoadBalancingModal:z,setShowOpeningModal:W,setShowUpdatePluginModal:$,setShowEducationExpireNoticeModal:Z,setShowTriggerEventsLimitModal:ei},children:(0,t.jsxs)(t.Fragment,{children:[n,D&&(0,t.jsx)(h,{activeTab:D,onCancel:()=>{"yes"===localStorage.getItem(s.EDUCATION_VERIFYING_LOCALSTORAGE_ITEM)&&localStorage.removeItem(s.EDUCATION_VERIFYING_LOCALSTORAGE_ITEM),M.current?.onCancelCallback?.(),M.current=null,j(null)},onTabChange:et}),!!R&&(0,t.jsx)(g,{data:R.payload,onCancel:()=>O(null),onSave:e=>{R?.onSaveCallback&&R.onSaveCallback(e),O(null)}}),!!P&&(0,t.jsx)(v,{data:P.payload,onCancel:()=>{L(null),P?.onCancelCallback&&P.onCancelCallback()},onSave:e=>{P?.onSaveCallback&&P.onSaveCallback(e),L(null)}}),!!F&&(0,t.jsx)(x,{data:F.payload,onCancel:()=>{U(null),F?.onCancelCallback&&F.onCancelCallback()},onSave:e=>{F?.onSaveCallback&&F.onSaveCallback(e),U(null)},onValidateBeforeSave:e=>!F?.onValidateBeforeSaveCallback||F?.onValidateBeforeSaveCallback(e)}),!!_&&(0,t.jsx)(y,{onCancel:eg}),J&&(0,t.jsx)(b,{show:J,onHide:()=>ee(!1)}),!!K&&(0,t.jsx)(C,{provider:K.payload.currentProvider,configurateMethod:K.payload.currentConfigurationMethod,currentCustomConfigurationModelFixedFields:K.payload.currentCustomConfigurationModelFixedFields,isModelCredential:K.payload.isModelCredential,credential:K.payload.credential,model:K.payload.model,mode:K.payload.mode,onCancel:eo,onSave:ec,onRemove:eu}),!!B&&(0,t.jsx)(E,{data:B.payload,datasetBindings:B.datasetBindings??[],onSave:ep,onCancel:ed,onEdit:em,isEditMode:B.isEditMode??!1}),!!H&&(0,t.jsx)(A,{...H}),V&&(0,t.jsx)(S,{data:V.payload,onSave:e=>{V?.onSaveCallback&&V.onSaveCallback(e),W(null)},onCancel:ef,promptVariables:V.payload.promptVariables,workflowVariables:V.payload.workflowVariables,onAutoAddPromptVariable:V.payload.onAutoAddPromptVariable}),!!Q&&(0,t.jsx)(w,{...Q.payload,onCancel:()=>{$(null),Q.onCancelCallback?.()},onSave:()=>{$(null),Q.onSaveCallback?.({})}}),!!Y&&(0,t.jsx)(N,{...Y.payload,onClose:()=>Z(null)}),!!es&&(0,t.jsx)(I,{show:!0,usage:es.payload.usage,total:es.payload.total,resetInDays:es.payload.resetInDays,onClose:()=>{el(),ei(null)},onUpgrade:()=>{el(),ei(null),eh()}})]})})},"default",0,_],974203)},878531,e=>{"use strict";var t=e.i(162115),n=e.i(830616),a=e.i(676315),r=e.i(942347);e.i(816688);var s=e.i(675066),i=e.i(137667),l=e.i(182915),o=e.i(623244),c=e.i(891299),u=e.i(739255),d=e.i(925521),p=e.i(250732),m=e.i(652669),f=e.i(218631),h=e.i(327069);e.s(["ProviderContextProvider",0,e=>{let{children:g}=e,v=(0,n.useQueryClient)(),{data:x}=(0,m.useModelProviders)(),{data:y}=(0,m.useModelListByType)(u.ModelTypeEnum.textGeneration),{data:b}=(0,m.useSupportRetrievalMethods)(),[C,E]=(0,r.useState)(o.defaultPlan),[A,S]=(0,r.useState)(!1),[w,N]=(0,r.useState)(!0),[I,_]=(0,r.useState)(!1),[k,T]=(0,r.useState)(!1),[j,M]=(0,r.useState)(!1),[D,R]=(0,r.useState)(!1),[O,P]=(0,r.useState)({workspace_members:{size:0,limit:0}}),[L,F]=(0,r.useState)(!1),[U,K]=(0,r.useState)(!1),{data:q,isLoading:B,isFetching:G,isFetchedAfterMount:H}=(0,f.useEducationStatus)(!L),[z,V]=(0,r.useState)(!1),[W,Q]=(0,r.useState)(!1),[$,Y]=(0,r.useState)(!1),Z=async()=>{try{let e=await (0,p.fetchCurrentPlanInfo)();if(!e)return void console.error("Failed to fetch plan info: data is undefined");N(e.billing?.enabled??!1),F(e.education?.enabled??!1),K(e.education?.activated??!1),_(e.can_replace_logo??!1),e.billing?.enabled&&(E((0,c.parseCurrentPlan)(e)),S(!0)),e.model_load_balancing_enabled&&T(!0),e.dataset_operator_enabled&&M(!0),e.webapp_copyright_enabled&&R(!0),e.workspace_members&&P({workspace_members:e.workspace_members}),e.is_allow_transfer_workspace&&V(e.is_allow_transfer_workspace),e.knowledge_pipeline?.publish_enabled&&Q(e.knowledge_pipeline?.publish_enabled),e.human_input_email_delivery_enabled&&Y(e.human_input_email_delivery_enabled)}catch(e){console.error("Failed to fetch plan info:",e),N(!1),F(!1),K(!1),_(!1)}};(0,r.useEffect)(()=>{Z()},[]),(0,r.useEffect)(()=>{d.ZENDESK_FIELD_IDS.PLAN&&C.type&&(0,l.setZendeskConversationFields)([{id:d.ZENDESK_FIELD_IDS.PLAN,value:`${C.type}-plan`}])},[C.type]);let{t:X}=(0,s.useTranslation)();return(0,r.useEffect)(()=>{if("true"!==localStorage.getItem("anthropic_quota_notice")&&!(0,a.default)().isAfter((0,a.default)("2025-03-17"))&&x?.data&&x.data.length>0){let e=x.data.find(e=>"anthropic"===e.provider);if(e&&e.system_configuration.current_quota_type===u.CurrentSystemQuotaTypeEnum.trial){let t=e.system_configuration.quota_configurations.find(t=>t.quota_type===e.system_configuration.current_quota_type);t&&t.is_valid&&t.quota_used{localStorage.setItem("anthropic_quota_notice","true")}})}}},[x,X]),(0,t.jsx)(h.ProviderContext.Provider,{value:{modelProviders:x?.data||[],refreshModelProviders:()=>{v.invalidateQueries({queryKey:["common","model-providers"]})},textGenerationModelList:y?.data||[],isAPIKeySet:!!y?.data?.some(e=>e.status===u.ModelStatusEnum.active),supportRetrievalMethods:b?.retrieval_method||[],plan:C,isFetchedPlan:A,enableBilling:w,onPlanInfoChanged:Z,enableReplaceWebAppLogo:I,modelLoadBalancingEnabled:k,datasetOperatorEnabled:j,enableEducationPlan:L,isEducationWorkspace:U,isEducationAccount:!!H&&(q?.is_student??!1),allowRefreshEducationVerify:!!H&&(q?.allow_refresh??!1),educationAccountExpireAt:H?q?.expire_at??null:null,isLoadingEducationAccountInfo:B,isFetchingEducationAccountInfo:G,webappCopyrightEnabled:D,licenseLimit:O,refreshLicenseLimit:Z,isAllowTransferWorkspace:z,isAllowPublishAsCustomKnowledgePipelineTemplate:W,humanInputEmailDeliveryEnabled:$},children:g})}])},18737,e=>{e.v(t=>Promise.all(["static/chunks/eab3c6d4a29b01af.js"].map(t=>e.l(t))).then(()=>t(962027)))},557776,e=>{e.v(t=>Promise.all(["static/chunks/d72a83c06a6d754c.js"].map(t=>e.l(t))).then(()=>t(372119)))},580680,e=>{e.v(t=>Promise.all(["static/chunks/47e8531e0c62d343.js"].map(t=>e.l(t))).then(()=>t(813443)))},355074,e=>{e.v(t=>Promise.all(["static/chunks/013269642693939e.js"].map(t=>e.l(t))).then(()=>t(570215)))},835465,e=>{e.v(t=>Promise.all(["static/chunks/d93faad8815ed75e.js"].map(t=>e.l(t))).then(()=>t(601208)))},140642,e=>{e.v(t=>Promise.all(["static/chunks/7389a67c9ad4ef09.js"].map(t=>e.l(t))).then(()=>t(171905)))},612844,e=>{e.v(t=>Promise.all(["static/chunks/022017f6f4fea052.js"].map(t=>e.l(t))).then(()=>t(35559)))},872773,e=>{e.v(t=>Promise.all(["static/chunks/3fa44455b3fd5492.js","static/chunks/ea4904747ba9ac24.js","static/chunks/542135dbb6812888.js","static/chunks/9a0b279a0b458379.js","static/chunks/391f908739ec573e.js","static/chunks/3382a6406be800a2.js","static/chunks/ec699e3a47517f01.css","static/chunks/8a294a1ccded8c72.css","static/chunks/ace03e086b9dd59d.css"].map(t=>e.l(t))).then(()=>t(244099)))},731569,e=>{e.v(t=>Promise.all(["static/chunks/7128064c38e2d4bc.js","static/chunks/be115dd14df4ecc7.js","static/chunks/cedc4db697a01891.js","static/chunks/1ba27f798f4a702a.js","static/chunks/cbb2860958a78a18.js","static/chunks/7faee93fa3dde682.js","static/chunks/8a294a1ccded8c72.css","static/chunks/18d3c6cefc4a2dba.css"].map(t=>e.l(t))).then(()=>t(924697)))},165508,e=>{e.v(t=>Promise.all(["static/chunks/03daee7c26b27119.js"].map(t=>e.l(t))).then(()=>t(117658)))},533206,e=>{e.v(t=>Promise.all(["static/chunks/cfa8a4500f696273.js","static/chunks/cedc4db697a01891.js"].map(t=>e.l(t))).then(()=>t(157154)))},419015,e=>{e.v(t=>Promise.all(["static/chunks/544191b585006c1f.js","static/chunks/cedc4db697a01891.js"].map(t=>e.l(t))).then(()=>t(668887)))},139499,e=>{e.v(t=>Promise.all(["static/chunks/af31c268f589a95d.css","static/chunks/f1f8eee261b12737.js","static/chunks/a1443d00d7a67714.js"].map(t=>e.l(t))).then(()=>t(812340)))},384251,e=>{e.v(t=>Promise.all(["static/chunks/8a294a1ccded8c72.css","static/chunks/e3f642dda7849918.js"].map(t=>e.l(t))).then(()=>t(535952)))},271777,e=>{e.v(t=>Promise.all(["static/chunks/f4bc2aece33dff69.js"].map(t=>e.l(t))).then(()=>t(359540)))},295276,e=>{e.v(t=>Promise.all(["static/chunks/a98397222a062579.js"].map(t=>e.l(t))).then(()=>t(955852)))},347789,e=>{e.v(t=>Promise.all(["static/chunks/8a294a1ccded8c72.css","static/chunks/910342956553e407.js","static/chunks/9a0b279a0b458379.js"].map(t=>e.l(t))).then(()=>t(100550)))},710986,e=>{e.v(t=>Promise.all(["static/chunks/42c70181db909964.js","static/chunks/148188772dd9ea41.js","static/chunks/e066cfa57dc85a85.js","static/chunks/56090751147bb5f8.js","static/chunks/cbb2860958a78a18.js","static/chunks/cedc4db697a01891.js","static/chunks/8275528a6d756388.js","static/chunks/e992d66233aefa7a.js","static/chunks/a26bf62e86136915.js","static/chunks/c5d58234fcbb81fd.js","static/chunks/01abee34dc66b3af.js","static/chunks/bcac7abff29d9f7e.js","static/chunks/8a294a1ccded8c72.css"].map(t=>e.l(t))).then(()=>t(553791)))},511009,e=>{e.v(t=>Promise.all(["static/chunks/852fac4a5dcc6420.js","static/chunks/cedc4db697a01891.js"].map(t=>e.l(t))).then(()=>t(43994)))},110135,e=>{e.v(t=>Promise.all(["static/chunks/2ecde45b239bc825.js"].map(t=>e.l(t))).then(()=>t(834473)))},69654,e=>{e.v(t=>Promise.all(["static/chunks/d5082c456d5cc885.js","static/chunks/cbb2860958a78a18.js","static/chunks/8a294a1ccded8c72.css"].map(t=>e.l(t))).then(()=>t(672545)))}]);