"use strict";(self.webpackChunk_coze_studio_app=self.webpackChunk_coze_studio_app||[]).push([["1663"],{916672:function(e,t,i){i.d(t,{D:()=>A});var o=function(e,t){return(o=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var n=i("252237"),a=i.n(n),l=i("455069"),s=0,d=1,c=2,u=3,p=4,g={NONE:"none",PRIMARY:"primary",SUCCESS:"success",WARNING:"warning",DANGER:"danger"},m="bottom",h="left",f="right",b="top",v="bp5";"undefined"!=typeof BLUEPRINT_NAMESPACE?v=BLUEPRINT_NAMESPACE:"undefined"!=typeof REACT_APP_BLUEPRINT_NAMESPACE&&(v=REACT_APP_BLUEPRINT_NAMESPACE),k(b),k(m),k(h),k(f),y(s),y(d),y(c),y(u),y(p),w(g.PRIMARY),w(g.SUCCESS),w(g.WARNING),w(g.DANGER);var x="".concat(v,"-overflow-list"),_="".concat(x,"-spacer");function y(e){if(void 0!==e)return"".concat(v,"-elevation-").concat(e)}function w(e){if(null!=e&&e!==g.NONE)return"".concat(v,"-intent-").concat(e.toLowerCase())}function k(e){if(void 0!==e)return"".concat(v,"-position-").concat(e)}var j={START:"start",END:"end"},M="Blueprint5",I="[Blueprint] does not support changing observeParents after mounting.";function N(e,t,i){if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;else{if(null!=i)return T(e,t,i);var o=Object.keys(e),r=Object.keys(t);return T(e,t,{include:o})&&T(e,t,{include:r})}}function T(e,t,i){return(function(e,t,i){if(function(e){return null!=e&&null!=e.include}(i))return i.include;if(function(e){return null!=e&&null!=e.exclude}(i)){var o=Object.keys(e),r=Object.keys(t),n=function(e){return e.reduce(function(e,t){return e[t]=!0,e},{})}(o.concat(r));return i.exclude.forEach(function(e){return delete n[e]}),Object.keys(n)}return[]})(e,t,i).every(function(i){return e.hasOwnProperty(i)===t.hasOwnProperty(i)&&e[i]===t[i]})}function z(e){return"production"===e}var D=function(e){function t(){var t,i=e.apply(this,arguments)||this;return i.targetRef=null!==(t=i.props.targetRef)&&void 0!==t?t:l.createRef(),i.prevElement=void 0,i}return r(t,e),t.prototype.render=function(){var e=l.Children.only(this.props.children);return void 0!==this.props.targetRef?e:l.cloneElement(e,{ref:this.targetRef})},t.prototype.componentDidMount=function(){var e=this;this.observer=null!=globalThis.ResizeObserver?new ResizeObserver(function(t){var i,o;return null===(o=(i=e.props).onResize)||void 0===o?void 0:o.call(i,t)}):void 0,this.observeElement()},t.prototype.componentDidUpdate=function(e){this.observeElement(this.props.observeParents!==e.observeParents)},t.prototype.componentWillUnmount=function(){var e;null===(e=this.observer)||void 0===e||e.disconnect(),this.prevElement=void 0},t.prototype.observeElement=function(e){if(void 0===e&&(e=!1),void 0===this.observer)return;if(!(this.targetRef.current instanceof Element)){this.observer.disconnect();return}if(this.targetRef.current!==this.prevElement||!!e){this.observer.disconnect(),this.prevElement=this.targetRef.current;if(this.observer.observe(this.targetRef.current),this.props.observeParents){for(var t=this.targetRef.current.parentElement;null!=t;)this.observer.observe(t),t=t.parentElement}}},t.displayName="".concat(M,".ResizeSensor"),t}(function(e){function t(t){var i=e.call(this,t)||this;return i.timeoutIds=[],i.requestIds=[],i.clearTimeouts=function(){if(i.timeoutIds.length>0){for(var e=0,t=i.timeoutIds;e0){for(var e=0,t=i.requestIds;eo,n=(this.spacer.offsetWidth>=1||this.state.visible.length0&&!i;r||n?this.setState(function(e){if(t.props.collapseFrom===j.END){var i,o,n=E(e.visible,e.overflow,t.state.chopSize*(r?1:-1));i=n[0],o=n[1]}else{var n=E(e.overflow,e.visible,t.state.chopSize*(r?-1:1));o=n[0],i=n[1]}return{chopSize:S(e.chopSize),lastChopSize:e.chopSize,lastOverflowCount:t.isFirstPartitionCycle(e.chopSize)?e.overflow.length:e.lastOverflowCount,overflow:o,repartitioning:!0,visible:i}}):this.setState({chopSize:this.defaultChopSize(),lastChopSize:null,repartitioning:!1})}},t.prototype.defaultChopSize=function(){return S(this.props.items.length)},t.prototype.isFirstPartitionCycle=function(e){return e===this.defaultChopSize()},t.displayName="".concat(M,".OverflowList"),t.defaultProps={alwaysRenderOverflow:!1,collapseFrom:j.START,minVisibleItems:0},t}(l.Component);function S(e){return Math.ceil(e/2)}function E(e,t,i){var o=e.concat(t),r=e.length-i;if(r<=0)return[[],o];if(r>=o.length)return[o,[]];var n=o.length-r;return[o.slice(0,-n),o.slice(-n)]}},481655:function(e,t,i){i.d(t,{DL:function(){return o}}),i(745304);let o=e=>{let{transform:t}=e;return{...t,x:0}}},49695:function(e,t,i){var o=i(455069),r=i(805366);let n=(0,r.A)(function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M23 12a11 11 0 1 1-22 0 11 11 0 0 1 22 0Zm-9.5 5.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0ZM12 5a1.9 1.9 0 0 0-1.89 2l.3 5.5a1.59 1.59 0 0 0 3.17 0l.3-5.5c.07-1.09-.8-2-1.88-2Z",fill:"currentColor"}))},"alert_circle");t.Z=n},938382:function(e,t,i){var o=i(455069),r=i(805366);let n=(0,r.A)(function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.08 7.6a1.5 1.5 0 0 1 2.12 0l5.66 5.65 5.66-5.65a1.5 1.5 0 1 1 2.12 2.12l-6.72 6.72a1.5 1.5 0 0 1-2.12 0L4.08 9.72a1.5 1.5 0 0 1 0-2.12Z",fill:"currentColor"}))},"chevron_down");t.Z=n},309673:function(e,t,i){var o=i(455069),r=i(805366);let n=(0,r.A)(function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.44 19.8a1.5 1.5 0 0 1 0-2.13l5.66-5.65-5.66-5.66a1.5 1.5 0 1 1 2.12-2.12l6.72 6.72a1.5 1.5 0 0 1 0 2.12L9.56 19.8a1.5 1.5 0 0 1-2.12 0Z",fill:"currentColor"}))},"chevron_right");t.Z=n},610382:function(e,t,i){i.d(t,{Hv:()=>P,rm:()=>o.rm,qz:()=>F.q});var o=i("910376");i("786406");var r=i("825955"),n=i("808549"),a=i("120454"),l=i("151064"),s=i("455069"),d=i("626389"),c=i.n(d),u=i("252237"),p=i.n(u),g=i("287487"),m=i("336205"),h=i("707107"),f=i("214942"),b=i("775699"),v=i("966219"),x=i("458949"),_=i("178385"),y=i("382534"),w=i("407821"),k=i.n(w),j=i("472772"),M=i.n(j),I=i("395245"),N=i.n(I),T=i("297998"),z=i.n(T),D=i("646576"),A=i.n(D),S=i("606121"),E=i.n(S),C=i("376756"),O={};O.styleTagTransform=E(),O.setAttributes=z(),O.insert=N().bind(null,"head"),O.domAPI=M(),O.insertStyleElement=A(),k()(C.Z,O);var L=C.Z&&C.Z.locals?C.Z.locals:void 0,Z=[{label:"cURL",value:x.gR.Curl},{label:"Wget",value:x.gR.Wget},{label:"Node.js",value:x.gR.NodeJS},{label:"Python",value:x.gR.Python},{label:"Golang",value:x.gR.Golang}],P=e=>{var{onCancel:t,visible:i,pluginAPIInfo:o}=e,[d,u]=(0,s.useState)(x.gR.Curl),[w,k]=(0,s.useState)(""),{id:j,space_type:M}=(0,f.rY)(e=>e.space),I=M===_.Sn.Personal,N=g.Z.useUserInfo();return(0,s.useEffect)(()=>{u(x.gR.Curl),k("")},[i]),(0,s.useEffect)(()=>{if(o){var e;(e=(0,r._)(function*(){k("");var e=yield y.Js.PluginAPI2Code({plugin_id:o.plugin_id||"",api_id:o.api_id||"",space_id:j||"",dev_id:(null==N?void 0:N.user_id_str)||"",program_lang:d});k((null==e?void 0:e.program_code)||"")}),function(){return e.apply(this,arguments)})()}},[d,o]),(0,l.jsx)(b.M5,{type:"base-composition",title:m.o.t("code_snippet"),visible:i,onCancel:t,footer:(0,l.jsx)(b.T,{children:(0,l.jsx)(b.y3,{theme:"solid",type:"primary",onClick:()=>{var e=c()(w),t={environment:"cn-boe",workspace_id:j||"",workspace_type:I?"personal_workspace":"team_workspace",tool_id:(null==o?void 0:o.api_id)||"",code_type:function(e){switch(e){case x.gR.Curl:return"curl";case x.gR.Wget:return"wget";case x.gR.NodeJS:return"javascript";case x.gR.Python:return"python";case x.gR.Golang:return"golang";default:return""}}(d)||"",status:1};e?(b.O$.success({content:m.o.t("copy_success")}),(0,h.Gg)(h.Kg.code_snippet_front,(0,a._)((0,n._)({},t),{status:0}))):(b.O$.warning({content:m.o.t("copy_failed")}),(0,h.Gg)(h.Kg.code_snippet_front,(0,a._)((0,n._)({},t),{status:1,error_message:"copy_failed"})))},children:m.o.t("copy")})}),maskClosable:!1,children:(0,l.jsxs)("div",{className:"h-[100%] flex flex-col min-h-0",children:[(0,l.jsx)("div",{children:(0,l.jsx)(b.FX,{type:"card",options:Z,defaultValue:d,className:"mb-[16px]",value:d,onChange:e=>u(e.target.value)})}),(0,l.jsx)("div",{className:p()(L["editor-container"],"flex-1 min-h-0"),children:(0,l.jsx)(v.Editor,{className:L.editor,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1},language:function(e){switch(e){case x.gR.Curl:case x.gR.Wget:case x.gR.NodeJS:return"javascript";case x.gR.Python:return"python";case x.gR.Golang:return"go";default:return"javascript"}}(d),theme:"tomorrow",width:"100%",value:w})})]})})};i("3779"),i("512421");var F=i("317612")},317612:function(e,t,i){i.d(t,{q:()=>w});var o=i("808549"),r=i("473980"),n=i("151064"),a=i("455069"),l=i("550655"),s=i("120454"),d=i("664319"),c=i("252237"),u=i.n(c),p=i("277194"),g=i("336205"),m=i("775699"),h=i("30961"),f=i("458949");i("382534");var{Select:b,TextArea:v}=i("659596").l0;f.nw.NotFoundPlugin,g.o.t("plugin_feedback_modal_request_type_official_plugins_not_found"),f.nw.OfficialPlugin,g.o.t("plugin_feedback_modal_request_type_feedback_to_existing_plugin"),i("398778");var x=i("770131"),_=i("719894"),y=e=>{var{type:t,openMode:i,from:a,openModeCallback:l,showButton:c,showCopyPlugin:f,onCopyPluginCallback:b,pluginApiList:v,projectId:y,clickProjectPluginCallback:w,hideCreateBtn:k,initQuery:j}=e,M=(0,r._)(e,["type","openMode","from","openModeCallback","showButton","showCopyPlugin","onCopyPluginCallback","pluginApiList","projectId","clickProjectPluginCallback","hideCreateBtn","initQuery"]),{pluginApis:I,updateSkillPluginApis:N}=(0,p.Ee)((0,d.N)(e=>({pluginApis:e.pluginApis,updateSkillPluginApis:e.updateSkillPluginApis}))),{sider:T,filter:z,content:D}=(0,x.A)({pluginApiList:v?v:i===h.jG.OnlyOnceAdd?[]:I,onPluginApiListChange:N,openMode:i,from:a,openModeCallback:l,showButton:c,showCopyPlugin:f,onCopyPluginCallback:b,projectId:y,clickProjectPluginCallback:w,onCreateSuccess:null==M?void 0:M.onCreateSuccess,isShowStorePlugin:null==M?void 0:M.isShowStorePlugin,hideCreateBtn:k,initQuery:j});return(0,n.jsx)(m.FS,(0,s._)((0,o._)({"data-testid":"plugin-modal"},M),{header:g.o.t("bot_edit_plugin_select_title"),className:u()(_.Z["plugin-modal"],M.className),sider:T,extra:null,filter:z,content:D}))},w=e=>{var t=e||{},{closeCallback:i}=t,s=(0,r._)(t,["closeCallback"]),[d,c]=(0,a.useState)(!1),[u,p]=(0,a.useState)(1),[g,m]=(0,a.useState)();return{node:d?(0,n.jsx)(y,(0,o._)({type:u,visible:d,onCancel:()=>{c(!1),null==i||i()},initQuery:g,footer:null},s)):null,open:e=>{var t=(0,l.Z)(e)?e:null==e?void 0:e.openType,i=(0,l.Z)(e)?void 0:null==e?void 0:e.initQuery;c(!0),m(i),(0,l.Z)(t)&&p(t)},close:()=>{c(!1),m(void 0),null==i||i()}}}},381677:function(e,t,i){i.d(t,{Tj:function(){return o.Tj},_u:function(){return o._u},cC:function(){return o.cC},e2:function(){return o.e2}});var o=i(910376)},179164:function(e,t,i){i.d(t,{DT:()=>tJ,zU:()=>tW,sp:()=>eJ,sU:()=>iv});var o,r,n=i("825955"),a=i("808549"),l=i("120454"),s=i("151064"),d=i("157728"),c=i("455069"),u=i("664319"),p=i("735114"),g=i("136515"),m=i("252237"),h=i.n(m),f=i("336205"),b=i("298203"),v=i("775699"),x=i("189284"),_=i("458949"),y=i("382534"),w=i("581259"),k=i("228962"),j=i("44172"),M=i("407821"),I=i.n(M),N=i("472772"),T=i.n(N),z=i("395245"),D=i.n(z),A=i("297998"),S=i.n(A),E=i("646576"),C=i.n(E),O=i("606121"),L=i.n(O),Z=i("746509"),P={};P.styleTagTransform=L(),P.setAttributes=S(),P.insert=D().bind(null,"head"),P.domAPI=T(),P.insertStyleElement=C(),I()(Z.Z,P);var F=Z.Z&&Z.Z.locals?Z.Z.locals:void 0,{Text:B,Paragraph:R}=v.ZT,U=e=>{e.stopPropagation()},Q={[_.ji.Disable]:(0,s.jsx)(j.A$t,{}),[_.ji.Enable]:(0,s.jsx)(j.YOo,{}),[_.ji.Default]:(0,s.jsx)(j.$5C,{})},Y=e=>{var t,i=(0,k.av)(),{checkPluginIsLockedByOthers:o,wrapWithCheckLock:r}=(0,k.RQ)((0,u.N)(e=>({checkPluginIsLockedByOthers:e.checkPluginIsLockedByOthers,wrapWithCheckLock:e.wrapWithCheckLock}))),[a]=(0,x.V)(),{targetSwitchId:l,setTargetSwitchId:d,loading:c,canEdit:p,refreshPage:g,plugin_id:m,pluginInfo:M,updatedInfo:I,handleIdeJump:N,showDropdownItem:T,setShowDropDownItem:z,setCurAPIInfo:D,openExample:A,projectId:S,customRender:E}=null!=e?e:{};var C=(t=(0,n._)(function*(e){var{apiId:t,disabled:i}=e;(yield y.Js.UpdateAPI({plugin_id:m||"",api_id:t,edit_version:null==M?void 0:M.edit_version,disabled:i}))&&g()}),function(e){return t.apply(this,arguments)});return{getColumns:()=>[{title:f.o.t("plugin_api_list_table_toolname"),dataIndex:"name",className:F["min-width-200"],render:(e,t)=>(0,s.jsxs)("div",{children:[(0,s.jsx)(R,{strong:!0,ellipsis:{showTooltip:{opts:{style:{wordBreak:"break-word"}}}},children:t.name}),(0,s.jsx)(R,{className:F["tool-table-desc"],ellipsis:{showTooltip:{opts:{style:{wordBreak:"break-word",maxWidth:"560px"},stopPropagation:!0}}},children:t.desc})]})},{title:f.o.t("plugin_api_list_table_Parameter"),dataIndex:"request_params",width:200,render:(e,t)=>{if(!t.request_params||(null===(i=t.request_params)||void 0===i?void 0:i.length)===0)return"-";var i,o,r,n=null===(o=t.request_params)||void 0===o?void 0:o.map(e=>({tagName:e.name,key:e.id})),a=null===(r=t.request_params)||void 0===r?void 0:r.map(e=>e.name);return(0,s.jsx)(v.Dj,{items:n,overflowRenderer:e=>e.length?(0,s.jsx)(v.u,{style:{wordBreak:"break-word"},content:null==a?void 0:a.join("、"),children:(0,s.jsxs)(v.fS,{color:"grey",size:"small",style:{fontVariantNumeric:"tabular-nums"},children:["+",e.length]})}):null,visibleItemRenderer:e=>(0,s.jsx)(v.fS,{color:"grey",size:"small",style:{marginRight:"8px",width:"fit-content",minWidth:"fit-content"},children:e.tagName},e.key),collapseFrom:"end"})}},{title:f.o.t("plugin_service_status"),dataIndex:"online_status",width:130,render:(e,t)=>{if(!("online_status"in t)||void 0===t.online_status)return"-";var i=w._5.get(t.online_status);return(0,s.jsxs)(v.T,{spacing:4,children:[(0,s.jsx)("span",{className:F["circle-point"],style:{background:null==i?void 0:i.color}}),null==i?void 0:i.label]})}},{title:f.o.t("plugin_api_list_table_status"),dataIndex:"plugin_type",width:130,render:(e,t)=>{if(!("debug_status"in t))return"-";var i=w.CG.get(t.debug_status||_.vw.DebugWaiting);return(0,s.jsx)(v.fS,{color:null==i?void 0:i.color,children:null==i?void 0:i.label})}},{title:f.o.t("plugin_api_list_table_botUsing"),dataIndex:"statistic_data",width:100,render:(e,t)=>{var i;return(null===(i=t.statistic_data)||void 0===i?void 0:i.bot_quote)?(0,s.jsx)(B,{style:{color:"rgba(28, 29, 35, 0.60)"},ellipsis:{showTooltip:!0},children:(0,b.uf)(t.statistic_data.bot_quote)}):"-"}},{title:f.o.t("plugin_api_list_table_Create_time"),dataIndex:"create_time",width:150,sorter:!0,render:(e,t)=>t.create_time?(0,s.jsx)("div",{children:(0,b.p6)(Number(t.create_time),"YYYY-MM-DD HH:mm")}):"-"},{title:f.o.t("dataset_detail_tableTitle_enable"),dataIndex:"disabled",width:80,render:(e,t)=>{var i;return(0,s.jsx)("div",{style:{display:"flex"},onClick:e=>{U(e)},children:(0,s.jsx)(v.rs,{loading:l===t.api_id&&c,disabled:!p,checked:!(null==t?void 0:t.disabled),onChange:(i=(0,n._)(function*(e,i){if(z(void 0),i.stopPropagation(),!(yield o()))d(t.api_id||""),C({apiId:t.api_id||"",disabled:!e})}),function(e,t){return i.apply(this,arguments)})})})}},{title:f.o.t("plugin_api_list_table_action"),dataIndex:"action",width:215,render:(e,t)=>{var o,l,d=(null==t?void 0:null===(o=t.response_params)||void 0===o?void 0:o.length)===0||!(null==M?void 0:M.published)||(null==M?void 0:M.status)&&(null==I?void 0:I.created_api_names)&&!!I.created_api_names.includes((null==t?void 0:t.name)||"");return(0,s.jsx)("div",{onClick:e=>{U(e)},children:(0,s.jsxs)(v.T,{spacing:16,children:[(0,s.jsx)(v.u,{content:f.o.t("Edit"),children:(0,s.jsx)(v._3,{type:"secondary",disabled:!p,icon:(0,s.jsx)(j.pV2,{}),className:h()(!p&&F["icon-btn-disable"]),onClick:r(()=>{z(void 0),N(w.jG.SELECT_TOOL,t.api_id)})})}),null==E?void 0:E({pluginInfo:M,pluginApiInfo:t,canEdit:p,setShowDropDownItem:z}),(null==M?void 0:M.creation_method)!==_.x9.IDE&&(0,s.jsx)(v.u,{content:f.o.t("plugin_api_list_table_debugicon_tooltip"),children:(0,s.jsx)(v._3,{type:"secondary",disabled:!p,icon:(0,s.jsx)(j.OlV,{}),className:h()(!p&&F["debug-btn-disable"]),onClick:r(()=>{if(z(void 0),null==t?void 0:t.api_id){var e;null===(e=i.tool)||void 0===e||e.call(i,t.api_id,{toStep:"3"})}})})}),"debug_example_status"in t?(0,s.jsx)(v.u,{content:f.o.t("plugin_edit_tool_test_run_example_tip"),children:(0,s.jsx)(v._3,{type:"secondary",disabled:!p,icon:Q[null!==(l=null==t?void 0:t.debug_example_status)&&void 0!==l?l:""],className:h()(!p&&F["icon-example-disabled"]),onClick:r(()=>{z(void 0),(null==t?void 0:t.api_id)&&A(t)})})}):null,(0,s.jsx)(v.Lt,{position:"bottomRight",zIndex:1010,trigger:S?"hover":"custom",visible:t.api_id===(null==T?void 0:T.api_id),render:(0,s.jsxs)(v.Lt.Menu,{className:"px-[4px]",children:[a["bot.devops.plugin_import_export"]?(0,s.jsx)(v.Lt.Item,{disabled:(null==M?void 0:M.plugin_type)===_.zV.LOCAL||(null==M?void 0:M.creation_method)===_.x9.IDE,className:"rounded-[4px]",onClick:()=>{z(void 0),D(t)},children:f.o.t("code_snippet")}):null,a["bot.devops.plugin_mockset"]?(0,s.jsx)(v.Lt.Item,{className:"rounded-[4px]",disabled:d,onClick:()=>{if(z(void 0),null==t?void 0:t.api_id){var e;null===(e=i.mocksetList)||void 0===e||e.call(i,t.api_id)}},children:(0,s.jsx)(v.u,{position:"left",style:{display:d?"block":"none"},content:f.o.t("cannot_enable_mock_set_due_empty_return"),children:(0,s.jsx)("span",{children:f.o.t("manage_mockset")})})}):null,(0,s.jsx)(v.Lt.Item,{className:"rounded-[4px]",disabled:!p||(null==M?void 0:M.plugin_product_status)===_.Pt.Listed||(null==M?void 0:M.creation_method)===_.x9.IDE,children:(0,s.jsx)(v.u,{position:"left",style:{display:(null==M?void 0:M.plugin_product_status)===_.Pt.Listed?"block":"none"},content:f.o.t("mkpl_plugin_disable_delete"),children:(0,s.jsx)(v.gn,{style:{width:400},okType:"danger",trigger:"click",onVisibleChange:e=>{e?z(t):z(void 0)},onConfirm:r((0,n._)(function*(){yield y.Js.DeleteAPI({plugin_id:t.plugin_id||"",api_id:t.api_id||"",edit_version:null==M?void 0:M.edit_version}),g()})),title:f.o.t("project_plugin_delete_modal_title",{pluginName:t.name}),content:f.o.t("project_plugin_delete_modal_description"),okText:f.o.t("Remove"),cancelText:f.o.t("Cancel"),disabled:!p||(null==M?void 0:M.plugin_product_status)===_.Pt.Listed||(null==M?void 0:M.creation_method)===_.x9.IDE,children:f.o.t("delete_tool")})})})]}),children:(0,s.jsx)(v._3,{theme:"borderless",className:F["icon-more"],icon:(0,s.jsx)(j.NKR,{}),onClick:()=>{T&&(null==T?void 0:T.api_id)===(null==t?void 0:t.api_id)?z(void 0):z(t)}})})]})})}}]}},V=e=>{var{getColumns:t}=Y(e);return{getColumns:t}},W=i("297158"),G=i("659596"),H=i("335740"),q="version_desc",K="version_name",J=e=>(0,s.jsxs)(G.l0,(0,l._)((0,a._)({},e),{children:[(0,s.jsx)(G.l0.Input,{noErrorMessage:!0,field:K,label:f.o.t("plugin_publish_form_version"),rules:[{required:!0}],maxLength:40}),(0,s.jsx)(G.l0.TextArea,{noErrorMessage:!0,field:q,label:f.o.t("plugin_publish_form_version_desc"),rules:[{required:!0}],maxLength:800})]})),X=e=>{var t,i;return!e||!(null===(t=e.version_desc)||void 0===t?void 0:t.trim())||!(null===(i=e.version_name)||void 0===i?void 0:i.trim())},$=e=>{var{onClickPublish:t,className:i,style:o,publishButtonProps:r,initialVersionName:n}=e,d=(0,c.useRef)(),[u,p]=(0,c.useState)();return(0,s.jsxs)("div",{className:i,style:o,children:[(0,s.jsx)(J,{onValueChange:e=>{p((0,H.Z)(e))},getFormApi:e=>{d.current=e},initValues:{version_name:n}}),(0,s.jsx)(G.zx,(0,l._)((0,a._)({className:"w-full mt-16px",disabled:X(u),onClick:()=>{var e,i=null===(e=d.current)||void 0===e?void 0:e.getValues();if(!!i)t({versionDescValue:i})}},r),{children:"发布"}))]})},ee=e=>{var t,{children:i,pluginId:o,spaceId:r,isPluginHasPublished:l,visible:d,onClickOutside:c,onPublishSuccess:u,pluginInfo:g,isInLibraryScope:m}=e,h=(0,k.av)(),{data:b,refresh:v}=(0,p.Z)((0,n._)(function*(){if(!!r)return(yield y.Js.GetPluginNextVersion({space_id:r,plugin_id:o})).next_version_name}),{ready:m});var{run:x,loading:_}=(0,p.Z)((t=(0,n._)(function*(e){var{versionDescValue:t}=e;return yield y.Js.PublishPlugin((0,a._)({plugin_id:o},t))}),function(e){return t.apply(this,arguments)}),{manual:!0,onSuccess:()=>{var e;u(),G.FN.success({content:f.o.t("Plugin_publish_update_toast_success"),showClose:!1}),null===(e=h.toResource)||void 0===e||e.call(h,"plugin"),v()},onError:(e,t)=>{var[i]=t;W.kg.persist.error({eventName:"fail_to_publish_plugin",error:e})}});return(0,s.jsx)(G.J2,{visible:d,onClickOutSide:c,trigger:"custom",content:(0,s.jsx)($,{onClickPublish:x,className:"w-[400px] px-20px pt-16px pb-20px",publishButtonProps:{loading:_},initialVersionName:b}),children:i})},et=i("824113"),ei=i("487377"),eo=i("458620"),er=i("214942"),en=i("727914"),ea=i("577413"),el=i("900021"),es=i("364112"),ed=i("818373"),ec={};ec.styleTagTransform=L(),ec.setAttributes=S(),ec.insert=D().bind(null,"head"),ec.domAPI=T(),ec.insertStyleElement=C(),I()(ed.Z,ec);var eu=ed.Z&&ed.Z.locals?ed.Z.locals:void 0,ep=e=>{var{value:t,onValueChange:i}=e,[o,r]=(0,c.useState)(!1);return(0,s.jsxs)("div",{className:eu.checkbox,children:[(0,s.jsxs)("div",{className:eu.content,children:[(0,s.jsx)(v.u,{content:f.o.t("plugin_edit_tool_test_run_cancel_example"),visible:o,trigger:"custom",children:(0,s.jsx)(v.XZ,{onChange:e=>{i(e.target.checked),!e.target.checked&&r(!1)},checked:t,onMouseEnter:()=>t&&r(!0),onMouseLeave:()=>r(!1)})}),(0,s.jsx)("div",{className:eu.label,children:f.o.t("plugin_edit_tool_test_run_save_results_as_example")})]}),(0,s.jsx)("div",{className:eu.line})]})},eg=e=>{var t,{btnLoading:i,apiInfo:o,dugStatus:r,loading:a,nextStep:l,editVersion:d}=e,[u,g]=(0,c.useState)((null==o?void 0:o.debug_example_status)===_.ji.Enable),[m,h]=(0,c.useState)(),{loading:b,runAsync:x}=(0,p.Z)(e=>y.Js.UpdateAPI(e),{manual:!0}),{pluginInfo:w}=(0,k.RQ)(e=>({pluginInfo:e.pluginInfo}));var j=(t=(0,n._)(function*(e){var t,i;e.stopPropagation(),yield x({plugin_id:null!==(t=null==w?void 0:w.plugin_id)&&void 0!==t?t:"",api_id:null!==(i=null==o?void 0:o.api_id)&&void 0!==i?i:"",edit_version:null!=d?d:null==w?void 0:w.edit_version,save_example:u,debug_example:m}),v.O$.success(f.o.t("Save_success")),l()}),function(e){return t.apply(this,arguments)});return(0,c.useEffect)(()=>{g((null==o?void 0:o.debug_example_status)===_.ji.Enable),h((null==o?void 0:o.debug_example_status)===_.ji.Enable?null==o?void 0:o.debug_example:void 0)},[o]),{debugFooterNode:(0,s.jsxs)(v.T,{spacing:12,children:[(0,s.jsx)(ep,{value:u,onValueChange:g}),(0,s.jsx)(v.y3,{disabled:a||r!==el.Q.PASS&&(null==w?void 0:w.plugin_type)!==_.zV.LOCAL,style:{minWidth:98,margin:0},loading:i||b,type:"primary",theme:"solid",onClick:j,children:f.o.t("Create_newtool_s4_done")})]}),debugExample:m,setDebugExample:h}},em=e=>{var t,{visible:i,onCancel:o,apiInfo:r,pluginId:n,pluginName:a,onSave:l}=e,[d,u]=(0,c.useState)(el.Q.FAIL),{debugFooterNode:p,setDebugExample:g,debugExample:m}=eg({apiInfo:r,loading:!1,dugStatus:d,btnLoading:!1,nextStep:()=>{null==l||l(),u(void 0)}});return(0,s.jsx)(v.M5,{title:f.o.t("plugin_edit_tool_edit_example"),visible:i,width:1280,style:{height:"calc(100vh - 140px)",minWidth:"1040px"},centered:!0,onCancel:()=>{o(),u(void 0)},footer:(0,s.jsx)("div",{children:p}),children:r?(0,s.jsx)(es.Debug,{disabled:!1,isViewExample:!0,setDebugStatus:u,pluginId:n,apiId:null!==(t=null==r?void 0:r.api_id)&&void 0!==t?t:"",apiInfo:r,pluginName:a,setDebugExample:g,debugExample:m}):null})},eh=i("849201"),ef=e=>{var t,i,o,{onUpdate:r}=e,[n,d]=(0,c.useState)(!1),[u,p]=(0,c.useState)(),{pluginInfo:g}=(0,k.RQ)(e=>({pluginInfo:e.pluginInfo})),m=()=>{d(!1)};return(0,c.useEffect)(()=>{!n&&p(void 0)},[n]),{exampleNode:(0,s.jsx)(em,{visible:n,onCancel:m,pluginId:null!==(i=null==g?void 0:g.plugin_id)&&void 0!==i?i:"",apiInfo:u,pluginName:null!==(o=null==g?void 0:null===(t=g.meta_info)||void 0===t?void 0:t.name)&&void 0!==o?o:"",onSave:()=>{null==r||r(),m()}}),openExample:e=>{var t;if(d(!0),(null==e?void 0:null===(t=e.debug_example)||void 0===t?void 0:t.req_example)&&(null==e?void 0:e.debug_example_status)===_.ji.Enable){var i,o,r=(0,H.Z)(null!==(o=null==e?void 0:e.request_params)&&void 0!==o?o:[]);(0,eh.C$)(r,JSON.parse(null==e?void 0:null===(i=e.debug_example)||void 0===i?void 0:i.req_example)),(0,ea.eO)(r),p((0,l._)((0,a._)({},e),{request_params:r}))}else(0,ea.eO)(e.request_params),p(e)}}},eb=i("805366");let ev=(0,eb.A)(function(e){return c.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),c.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm5.88-13.18-6.2 7.6a1.5 1.5 0 0 1-2.37 0l-3.5-4a1.5 1.5 0 1 1 2.37-1.84l2.3 2.46L15.5 8a1.5 1.5 0 1 1 2.38 1.82Z",fill:"currentColor"}))},"tick_circle"),ex=(0,eb.A)(function(e){return c.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),c.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm1.5-16.5v4.88l3.56 3.56a1.5 1.5 0 0 1-2.12 2.12l-4-4A1.5 1.5 0 0 1 10.5 12V6.5a1.5 1.5 0 0 1 3 0Z",fill:"currentColor"}))},"clock");var e_=i("873183"),ey=i("537845"),ew=()=>{var{pluginInfo:e,canEdit:t}=(0,k.RQ)((0,u.N)(e=>({pluginInfo:e.pluginInfo,canEdit:e.canEdit}))),{data:i,refresh:o}=(0,p.Z)((0,n._)(function*(){return yield y.Js.GetOAuthStatus({plugin_id:(null==e?void 0:e.plugin_id)||""})}),{refreshDeps:[e],ready:(null==e?void 0:e.plugin_id)!==void 0&&t,refreshOnWindowFocus:!0}),{run:r,loading:a}=(0,p.Z)((0,n._)(function*(){try{yield y.Js.RevokeAuthToken({plugin_id:(null==e?void 0:e.plugin_id)||""}),o()}catch(e){W.kg.error(e)}}),{manual:!0,ready:t}),l=(0,c.useMemo)(()=>null==i?void 0:i.is_oauth,[i]),s=(0,c.useMemo)(()=>(null==i?void 0:i.status)===_.OZ.Authorized,[i]),d=(0,c.useMemo)(()=>null==i?void 0:i.content,[i]),g=(0,ey.Z)((0,n._)(function*(){yield r()}));return{canEdit:t,needAuth:l,isHasAuth:s,doCancelOauth:g,isUpdateLoading:a,doOauth:(0,ey.Z)(()=>{window.open(d,"_blank")})}},ek=e=>{v.u_.info({title:f.o.t("plugin_tool_config_auth_modal_auth_required"),content:f.o.t("plugin_tool_config_auth_modal_auth_required_desc"),onOk:e,okText:f.o.t("Confirm"),cancelText:f.o.t("Cancel")})},ej=e=>{v.u_.warning({title:f.o.t("plugin_tool_config_auth_modal_cancel_confirmation"),content:f.o.t("plugin_tool_config_auth_modal_cancel_confirmation_desc"),onOk:e,okText:f.o.t("Confirm"),cancelText:f.o.t("Cancel")})},eM=()=>{var{needAuth:e,isHasAuth:t,doCancelOauth:i,isUpdateLoading:o,doOauth:r,canEdit:n}=ew();if(!n)return(0,s.jsx)(s.Fragment,{});var a=e&&t,l=e&&!t;return(0,s.jsxs)(G.T,{spacing:8,children:[e?(0,s.jsx)("span",{className:"rounded-[4px] bg-[#EDD5FC] px-[8px] py-[2px] text-[#6C2CC6] text-[12px] font-medium leading-[16px]",children:f.o.t("plugin_mark_created_by_existing_services")}):null,e?(0,s.jsx)(G.ZT.Text,{disabled:o,onClick:()=>{if(l){ek(r);return}a&&ej(i)},icon:t?(0,s.jsx)(e_.P03,{}):void 0,className:h()("overflow-hidden text-[#4C54F0] overflow-ellipsis text-[14px] font-normal leading-[20px]",(l||a)&&"cursor-pointer"),children:t?f.o.t("plugin_tool_config_status_authorized"):f.o.t("plugin_tool_config_status_unauthorized")}):null,!t&&e?(0,s.jsx)(e_.x5d,{className:"w-[12px] h-[12px] ml-[-6px]"}):null]})},eI=e=>{var{className:t}=e,{needAuth:i,isHasAuth:o,doCancelOauth:r,isUpdateLoading:n,doOauth:a,canEdit:l}=ew();return l?i?(0,s.jsx)(G.ZT.Text,{disabled:n,onClick:e=>{e.preventDefault(),e.stopPropagation(),console.log("click"),o?ej(r):ek(a)},icon:o?(0,s.jsx)(e_.P03,{}):void 0,className:"overflow-hidden text-[#4C54F0] overflow-ellipsis text-[14px] font-normal leading-[20px] cursor-pointer px-[12px] py-[0] items-center ".concat(t),children:o?f.o.t("plugin_tool_config_status_authorized"):f.o.t("plugin_tool_config_status_unauthorized")}):null:(0,s.jsx)(s.Fragment,{})};_.zV.APP,f.o.t("plugin_type_app"),_.zV.PLUGIN,f.o.t("plugin_type_plugin"),_.zV.FUNC,f.o.t("plugin_type_func"),_.zV.WORKFLOW,f.o.t("plugin_type_workflow");var eN=new Map([[!1,{label:f.o.t("Unpublished_1"),color:"var(--coz-fg-secondary)"}],[!0,{label:f.o.t("Published_1"),color:"var(--coz-fg-hglt-green)"}]]),eT=i("84089"),ez={};ez.styleTagTransform=L(),ez.setAttributes=S(),ez.insert=D().bind(null,"head"),ez.domAPI=T(),ez.insertStyleElement=C(),I()(eT.Z,ez);var eD=eT.Z&&eT.Z.locals?eT.Z.locals:void 0,{Text:eA}=G.ZT,eS=e=>{var t,i,o,r,n,a,l,{pluginInfo:d,loading:c,canEdit:u,extraRight:p,onClickEdit:g}=e;return(0,s.jsxs)(G.T,{className:h()(eD["plugin-detail-info"],"w-full","px-[16px]","py-[16px]","shrink-0","grow-0"),spacing:20,children:[(0,s.jsxs)(G.T,{style:{flex:1},spacing:12,children:[(0,s.jsx)(G.qE,{className:h()(eD["plugin-detail-avatar"]),size:"medium",shape:"square",src:null==d?void 0:null===(i=d.meta_info)||void 0===i?void 0:null===(t=i.icon)||void 0===t?void 0:t.url}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{children:(0,s.jsxs)(G.T,{spacing:4,className:"mb-1",children:[(0,s.jsx)(eA,{ellipsis:{showTooltip:{opts:{style:{wordBreak:"break-word"}}}},className:h()(eD["plugin-detail-title"]),children:null==d?void 0:null===(o=d.meta_info)||void 0===o?void 0:o.name}),c?null:(0,s.jsx)(G.hU,{icon:u?(0,s.jsx)(j.yl5,{}):(0,s.jsx)(j.ia5,{}),size:"small",color:"secondary",className:h()(eD["edit-plugin-btn"],{[eD.edit]:u}),onClick:g})]})}),(0,s.jsxs)(G.T,{spacing:4,children:[(0,s.jsx)(G.Vp,{size:"mini",color:"primary",children:(0,s.jsxs)(G.T,{spacing:2,children:[(null==d?void 0:d.published)?(0,s.jsx)(ev,{size:"small",style:{color:null===(r=eN.get(!!d.published))||void 0===r?void 0:r.color}}):(0,s.jsx)(ex,{size:"small",style:{color:null===(n=eN.get(!!(null==d?void 0:d.published)))||void 0===n?void 0:n.color}}),null===(a=eN.get(!!(null==d?void 0:d.published)))||void 0===a?void 0:a.label]})}),(null==d?void 0:d.creation_method)===_.x9.IDE&&(0,s.jsx)(G.Vp,{size:"mini",color:"purple",children:f.o.t("plugin_mark_created_by_ide")}),(0,s.jsx)(eA,{ellipsis:{showTooltip:{opts:{style:{wordBreak:"break-word",maxWidth:"560px"}}}},className:h()(eD["plugin-detail-desc"]),children:null==d?void 0:null===(l=d.meta_info)||void 0===l?void 0:l.desc}),(0,s.jsx)(eM,{})]})]})]}),p?(0,s.jsx)(G.T,{spacing:12,children:p}):null]})},eE=i("381677"),eC=i("610382"),eO=i("156133"),eL=i("947578"),eZ=i("252793"),eP=e=>{var t,{space_id:i,pluginId:o,apiId:r="",baseInfo:d={},setApiId:u,showModal:p,disabled:g,showSecurityCheckFailedMsg:m,setShowSecurityCheckFailedMsg:h,editVersion:b,showFunctionName:x=!1,pluginType:w,onSuccess:k,renderEnhancedComponent:j}=e,M=(0,c.useRef)(null),[I,N]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{var e;N(null==d?void 0:d.desc),null===(e=M.current)||void 0===e||e.formApi.setValues({name:d.name,desc:d.desc})},[d.name,d.desc,p,g]);var T=(0,ey.Z)(e=>{var t;null===(t=M.current)||void 0===t||t.formApi.setValue("desc",e)});var z=(t=(0,n._)(function*(){if(!(yield null===(e=M.current)||void 0===e?void 0:e.formApi.validate().then(()=>!0).catch(()=>!1)))return!1;var e,t,i,n=null===(t=M.current)||void 0===t?void 0:t.formApi.getValues(),s={plugin_id:o,name:n.name,desc:n.desc,edit_version:b,function_name:n.function_name};try{return r?i=yield y.Js.UpdateAPI((0,l._)((0,a._)({},s),{api_id:r}),{__disableErrorToast:!0}):(i=yield y.Js.CreateAPI((0,l._)((0,a._)({},s),{method:_.fM.POST,path:"/".concat(s.name)}),{__disableErrorToast:!0}),null==u||u(i.api_id||"")),null==k||k(i),!0}catch(e){var{code:d,msg:c}=e;return Number(d)===el.B.SAFE_CHECK?null==h||h(!0):v.FN.error({content:(0,eL.u)(c)}),!1}}),function(){return t.apply(this,arguments)}),D=()=>{m&&(null==h||h(!1))};return{submitBaseInfo:z,baseInfoNode:(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(v.l0,{showValidateIcon:!1,ref:M,disabled:g,className:eZ.Z["base-info-form"],children:()=>g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.l0.Slot,{label:{text:f.o.t("Create_newtool_s1_name"),required:!0},children:d.name}),(0,s.jsx)(v.l0.Slot,{label:{text:f.o.t("Create_newtool_s1_dercribe"),required:!0},children:d.desc})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.P6,{"data-testid":"plugin-create-tool-base-info-name",className:eZ.Z["textarea-single-line"],field:"name",label:f.o.t("Create_newtool_s1_name"),placeholder:f.o.t("Create_newtool_s1_title_empty"),trigger:["blur","change"],maxCount:30,maxLength:30,rows:1,onKeyDown:e=>{var t=window.event||e;if("Enter"===t.key||"Enter"===t.code||13===t.keyCode)return t.returnValue=!1,!1},onChange:D,rules:[{required:!0,message:f.o.t("Create_newtool_s1_title_empty")},{pattern:/^[a-zA-Z0-9_]+$/,message:f.o.t("Create_newtool_s1_title_error1")}]}),(0,s.jsxs)("div",{className:"relative",children:[null==j?void 0:j({disabled:!I,originDesc:I,className:"absolute right-[0] top-[12px]",plugin_id:o,space_id:i,onSetDescription:T}),(0,s.jsx)(v.P6,{"data-testid":"plugin-create-tool-base-info-desc",field:"desc",label:f.o.t("Create_newtool_s1_dercribe"),placeholder:f.o.t("Create_newtool_s1_dercribe_error"),rows:2,trigger:["blur","change"],maxCount:600,maxLength:600,rules:[{required:!0,message:f.o.t("Create_newtool_s1_dercribe_empty")},!1],onChange:e=>{D(),N(e)}}),x&&w===_.zV.LOCAL?(0,s.jsx)(v.P6,{className:eZ.Z["textarea-single-line"],field:"function_name",label:f.o.t("create_local_plugin_basic_tool_function"),placeholder:f.o.t("create_local_plugin_basic_tool_function_input_placeholder"),rows:1,trigger:["blur","change"],maxCount:30,maxLength:30,rules:[{required:!0,message:f.o.t("create_local_plugin_basic_warning_no_tool_function_entered")}],onChange:D}):null]})]})})})}},eF=i("827666"),eB=i("3779"),eR=i("966171"),eU={};eU.styleTagTransform=L(),eU.setAttributes=S(),eU.insert=D().bind(null,"head"),eU.domAPI=T(),eU.insertStyleElement=C(),I()(eR.Z,eU);var eQ=eR.Z&&eR.Z.locals?eR.Z.locals:void 0,eY=e=>{var{step:t}=e;return(0,s.jsxs)("div",{className:eQ["error-msg"],children:[t!==eF.dT?f.o.t("plugin_parameter_create_modal_safe_error"):f.o.t("plugin_tool_create_modal_safe_error"),(0,s.jsx)(eB.v,{})]})},eV=e=>{let t;var{text:i,plugin_id:o,onClickWrapper:r,onBeforeClick:d,disabled:p,isShowBtn:g=!0,space_id:m}=e,h=(0,k.av)(),[f,b]=(0,c.useState)(!1),[x,_]=(0,c.useState)(!1),[y,w]=(0,c.useState)(!1),[j,M]=(0,c.useState)(!1),{pluginInfo:I,unlockPlugin:N,setPluginInfo:T}=(0,k.RQ)((0,u.N)(e=>({pluginInfo:e.pluginInfo,unlockPlugin:e.unlockPlugin,setPluginInfo:e.setPluginInfo}))),{baseInfoNode:z,submitBaseInfo:D}=eP({pluginId:o||"",setApiId:e=>{var t;b(!1),null===(t=h.tool)||void 0===t||t.call(h,e,{toStep:"1"},{replace:!0})},showModal:!1,disabled:p,showSecurityCheckFailedMsg:j,setShowSecurityCheckFailedMsg:M,editVersion:null==I?void 0:I.edit_version,space_id:m||"",pluginType:null==I?void 0:I.plugin_type,showFunctionName:!0,onSuccess:e=>{T((0,l._)((0,a._)({},I),{edit_version:null==e?void 0:e.edit_version}))}}),A=()=>{var e=null==d?void 0:d();if(!(0,eO.Z)(e)||!!e)w(!0),_(!1)};return{content:(0,s.jsxs)(s.Fragment,{children:[g?(0,s.jsx)(G.zx,{disabled:p,loading:x,color:"primary",onClick:(t=r?r(A):A,()=>{_(!0),t()}),children:i}):null,(0,s.jsxs)(v.u_,{title:i,loading:f,visible:y,onOk:(0,n._)(function*(){b(!0),yield D(),N(),b(!1)}),onCancel:()=>{N(),w(!1)},closeOnEsc:!0,children:[z,j?(0,s.jsx)(eY,{step:eF.dT}):null]})]}),openModal:()=>{r?r(A)():A()},closeModal:()=>{N(),w(!1)}}},eW=e=>{var{content:t}=eV((0,a._)({},e));return(0,s.jsx)(s.Fragment,{children:t})},eG=i("452058"),eH={};eH.styleTagTransform=L(),eH.setAttributes=S(),eH.insert=D().bind(null,"head"),eH.domAPI=T(),eH.insertStyleElement=C(),I()(eG.Z,eH);var eq=eG.Z&&eG.Z.locals?eG.Z.locals:void 0,eK={[_.x9.COZE]:f.o.t("create_tool"),[_.x9.IDE]:f.o.t("plugin_creation_create_tool_in_ide")},eJ=e=>{var t,i,o,r,m,h,x,M,{projectId:I,keepDocTitle:N,renderHeaderSlot:T,usePreloadIDE:z}=e,D=(0,er.rY)(e=>e.space.id),{wrapWithCheckLock:A,checkPluginIsLockedByOthers:S,updatedInfo:E,pluginInfo:C,canEdit:O,initPlugin:L,unlockPlugin:Z,initSuccessed:P,pluginID:F,version:B,updatePluginInfoByImmer:R}=(0,k.RQ)((0,u.N)(e=>({wrapWithCheckLock:e.wrapWithCheckLock,checkPluginIsLockedByOthers:e.checkPluginIsLockedByOthers,updatedInfo:e.updatedInfo,pluginInfo:e.pluginInfo,canEdit:e.canEdit,initPlugin:e.initPlugin,unlockPlugin:e.unlockPlugin,initSuccessed:e.initSuccessed,pluginID:e.pluginId,version:e.version,updatePluginInfoByImmer:e.updatePluginInfoByImmer}))),U=(null==C?void 0:C.creation_method)===_.x9.IDE,Q=(null==C?void 0:C.creation_method)===_.x9.COZE,Y=void 0===I,H=(0,k.Np)(),{onStatusChange:q,onUpdateDisplayName:K}=(0,k.sF)(),J=(0,k.av)(),X=(0,d.useNavigate)(),$=(0,W.UQ)(),[ea]=(0,d.useSearchParams)(),[el,es]=(0,c.useState)(),[ed,ec]=(0,c.useState)(!1),[eu,ep]=(0,c.useState)(!1),[eg,em]=(0,c.useState)({}),[eh,eb]=(0,c.useState)({page:1,size:10,plugin_id:F,preview_version_ts:B}),[ev,ex]=(0,c.useState)(""),[e_,ey]=(0,c.useState)(),{modal:ew,setShowCodePluginModel:ek}=(0,eE.Tj)({modalProps:{onSuccess:()=>eL()}}),{modal:ej,setShowFormPluginModel:eM}=(0,eE.e2)({modalProps:{onSuccess:()=>eL()}}),{modal:eI,setShowImportToolModal:eN}=(0,eE.cC)({modalProps:{onSuccess:()=>eL()}});(0,k.A2)(F);var{data:eT,loading:ez}=(0,p.Z)(()=>y.Js.GetPluginAPIs(eh),{refreshDeps:[eh],onError:e=>{$(new en.sH(eo.b.PluginGetApis,"get Plugin Detail Error: ".concat(e.message)))}});(0,c.useEffect)(()=>{var e,t=ea.get("edit_example_id"),i=ea.get("edit_plugin"),o=null==eT?void 0:null===(e=eT.api_info)||void 0===e?void 0:e.find(e=>e.api_id===t);o&&t&&(eB(o),ea.delete("edit_example_id"),X({search:ea.toString()},{replace:!0})),eT&&i&&(eX(),ea.delete("edit_plugin"),X({search:ea.toString()},{replace:!0}))},[eT,ea]),(0,c.useEffect)(()=>{var e,t;null==K||K(null!==(t=null==C?void 0:null===(e=C.meta_info)||void 0===e?void 0:e.name)&&void 0!==t?t:"")},[null==C?void 0:null===(m=C.meta_info)||void 0===m?void 0:m.name]),(0,ei.a)({isLive:!!eT&&!ez,extra:{renderSize:"".concat(null==eT?void 0:null===(h=eT.api_info)||void 0===h?void 0:h.length)}});var eD=null==eT?void 0:eT.api_info;var eA=(t=(0,n._)(function*(){(yield y.Js.NoUpdatedPrompt({plugin_id:F}))&&eL()}),function(){return t.apply(this,arguments)});var eO=(i=(0,n._)(function*(){if(!(null==C?void 0:C.published)){ec(!0);return}var e=yield y.Js.GetUpdatedAPIs({plugin_id:F});e.created_api_names&&e.created_api_names.length>0||e.deleted_api_names&&e.deleted_api_names.length>0||e.updated_api_names&&e.updated_api_names.length>0?(em(e),ep(!0)):ec(!0)}),function(){return i.apply(this,arguments)}),eL=()=>{var e;null===(e=eY.current)||void 0===e||e.reset(),L(),eb(e=>(0,l._)((0,a._)({},e),{page:1,size:10}))},eZ=null==z?void 0:z({onBack:eL,pluginID:F});(0,g.Z)(()=>{P?(null==q||q("normal"),U&&(null==eZ||eZ.handleInitIde(!O))):null==q||q("error")},[P]);var eP=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:w.jG.DEFAULT,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";U?null==eZ||eZ.handleShowIde({initialAction:t,toolId:i}):i&&(null===(e=J.tool)||void 0===e||e.call(J,i))},{exampleNode:eF,openExample:eB}=ef({onUpdate:eL}),{getColumns:eR,reactNode:eU}=V({targetSwitchId:ev,setTargetSwitchId:ex,loading:ez,canEdit:O,refreshPage:eL,plugin_id:F,pluginInfo:C,updatedInfo:E,showDropdownItem:e_,setShowDropDownItem:ey,handleIdeJump:eP,setCurAPIInfo:es,openExample:eB,projectId:I,unlockPlugin:Z}),eQ=eR(),eY=(0,c.useRef)(null),eG=eK[null==C?void 0:C.creation_method]||"",{openModal:eH,content:eJ}=eV({text:eG,isShowBtn:!1,disabled:!O,onClickWrapper:A,onBeforeClick:()=>{ey(void 0)},plugin_id:F,space_id:D});var eX=(o=(0,n._)(function*(){if(ey(void 0),!(O&&(yield S())))eM(!0)}),function(){return o.apply(this,arguments)}),e$=!U,e0=O&&!!(null==eT?void 0:eT.total),e1=O&&!U,e2=e0&&Y,e4=e2&&U;return(0,s.jsxs)("div",{className:eq["tool-wrapper"],children:[ew,ej,eI,eU,eF,(0,s.jsxs)(G.Ar,{className:"flex",title:(0,b.Z$)(f.o.t("tab_plugin_detail",{plugin_name:null!==(M=null==C?void 0:null===(x=C.meta_info)||void 0===x?void 0:x.name)&&void 0!==M?M:""})),keepDocTitle:N,children:[Y?(0,s.jsx)(G.Ar.Header,{className:eq["layout-header"],breadcrumb:(0,s.jsx)(et.g3,{showTooltip:{width:"300px"},pluginInfo:null==C?void 0:C.meta_info,compact:!1})}):null,(0,s.jsxs)(G.Ar.Content,{className:eq["layout-content"],children:[(null==C?void 0:C.status)&&(null==C?void 0:C.published)&&O&&Y?(0,s.jsx)(G.jL,{className:eq.banner,type:"info",bordered:!0,fullMode:!1,description:(0,s.jsxs)("div",{children:[f.o.t("plugin_update_tip"),(0,s.jsx)(G.ZT.Text,{className:eq.notips,onClick:()=>{eA()},children:f.o.t("not_show_again")})]})}):null,C?(0,s.jsx)(eS,{pluginInfo:C,loading:ez,canEdit:O,onClickEdit:eX,extraRight:(0,s.jsxs)(s.Fragment,{children:[null==T?void 0:T({pluginInfo:C}),e$?(0,s.jsx)(G.u,{position:"left",content:f.o.t("Plugin_button_code_tooltip"),children:(0,s.jsx)(G.hU,{icon:(0,s.jsx)(j.WTs,{}),onClick:()=>{ey(void 0),ek(!0)}})}):null,e0?(0,s.jsx)(eW,{text:eG,disabled:!O,onClickWrapper:A,onBeforeClick:()=>(ey(void 0),!U||(null==eZ||eZ.handleShowIde({initialAction:w.jG.CREATE_TOOL,toolId:""}),!1)),plugin_id:F,space_id:D}):null,e1?(0,s.jsx)(G.zx,{color:"primary",disabled:!O||(null==C?void 0:C.plugin_type)===_.zV.LOCAL,onClick:A(()=>{ey(void 0),eN(!0)}),children:f.o.t("import")}):null,e4?(0,s.jsx)(G.u,{position:"left",content:f.o.t("Plugin_button_publish_tooltip"),children:(0,s.jsx)(G.zx,{disabled:!(null==eT?void 0:eT.total),theme:"solid",onClick:()=>{ey(void 0),eP()},children:f.o.t("Publish")})}):null,e2&&Q?(0,s.jsx)(G.gn,{visible:eu,onCancel:()=>ep(!1),onClickOutSide:()=>{ep(!1)},style:{width:400},trigger:"custom",onConfirm:()=>{ep(!1),ec(!0)},title:f.o.t("Plugin_update_info_title"),content:(0,s.jsx)(s.Fragment,{children:(r=[...eg.created_api_names||[],...eg.deleted_api_names||[],...eg.updated_api_names||[]],f.o.t("Plugin_update_info_text",{number:r.length,array:r.join("、")}))}),okText:f.o.t("Confirm"),cancelText:f.o.t("Cancel"),children:(0,s.jsx)("span",{children:(0,s.jsx)(ee,{spaceId:D,pluginInfo:C,pluginId:F,isInLibraryScope:Y,isPluginHasPublished:!!C.published,visible:ed,onClickOutside:()=>ec(!1),onPublishSuccess:()=>{var e;null===(e=H.current)||void 0===e||e.reload(),ec(!1),R(e=>{if(!!e)e.published=!0})},children:(0,s.jsx)("span",{children:(0,s.jsx)(G.u,{position:"left",content:f.o.t("Plugin_button_publish_tooltip"),children:(0,s.jsx)(G.zx,{disabled:!(null==eT?void 0:eT.total),theme:"solid",onClick:eO,children:f.o.t("Publish")})})})})})}):null]})}):null,!!(null==eD?void 0:eD.length)&&(0,s.jsx)("div",{className:"mb-[24px] mt-[36px] text-[18px] weight-[600]",children:f.o.t("plugin_api_list_table_name")}),(0,s.jsx)(G.iA,{ref:eY,offsetY:390,tableProps:{rowKey:"api_id",loading:ez,dataSource:eD,columns:eQ,onRow:e=>({onClick:()=>{if(null==e?void 0:e.api_id){var t;if(ey(void 0),U){eP(w.jG.SELECT_TOOL,null==e?void 0:e.api_id);return}null===(t=J.tool)||void 0===t||t.call(J,e.api_id,O?{mode:"preview"}:{})}}}),onChange:e=>{var t;(null===(t=e.sorter)||void 0===t?void 0:t.sortOrder)&&eb(t=>{var i;return(0,l._)((0,a._)({},t),{page:1,size:10,order:{desc:(null===(i=e.sorter)||void 0===i?void 0:i.sortOrder)==="descend"}})})}},empty:(0,s.jsx)(v.YZ,{empty:{title:f.o.t("plugin_empty_desc"),btnText:O?eG:void 0,btnOnClick:()=>{if(U){null==eZ||eZ.handleShowIde({initialAction:w.jG.CREATE_TOOL,toolId:""});return}eH()}}}),enableLoad:!0,total:Number((null==eT?void 0:eT.total)||0),onLoad:()=>{eb(e=>{var t;return(0,l._)((0,a._)({},e),{page:(null!==(t=eh.page)&&void 0!==t?t:0)+1})})}}),eJ]})]}),(0,s.jsx)(eC.Hv,{visible:!!el,onCancel:()=>{es(void 0)},pluginAPIInfo:el})]})},eX=i("716069"),e$=i("287487"),e0=i("378925"),e1=i("707107"),e2=i("178385"),e4=i("824833"),e5=i("583193"),e3=i("30961"),e6=i("11869"),e8=i("345822"),e9=i("473980"),e7=i("428468"),te={};te.styleTagTransform=L(),te.setAttributes=S(),te.insert=D().bind(null,"head"),te.domAPI=T(),te.insertStyleElement=C(),I()(e7.Z,te);var tt=e7.Z&&e7.Z.locals?e7.Z.locals:void 0;function ti(e){var{children:t,ellipsis:i,tooltipText:o}=e,r=(0,e9._)(e,["children","ellipsis","tooltipText"]),n=!1===i?i:(0,a._)({showTooltip:{opts:{content:(0,s.jsx)(v.ZT.Text,{className:h()(tt["long-text-tooltip"],tt["long-text"]),onClick:e=>e.stopPropagation(),ellipsis:{showTooltip:!1,rows:16},children:o||e.children})}}},"object"!=typeof i?{}:i);return(0,s.jsx)(v.ZT.Text,(0,l._)((0,a._)({ellipsis:n},r),{children:e.children}))}var to=i("972588"),tr={};tr.styleTagTransform=L(),tr.setAttributes=S(),tr.insert=D().bind(null,"head"),tr.domAPI=T(),tr.insertStyleElement=C(),I()(to.Z,tr);var tn=to.Z&&to.Z.locals?to.Z.locals:void 0;function ta(e){var{isFullHeader:t=!0,readOnly:i=!0,mockSetInfo:o,onUpdateMockSetInfo:r,bizCtx:n}=e,[a,l]=(0,c.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(v.T,{spacing:t?2:4,className:h()(tn["mock-set-intro-title"],t?tn["mock-set-intro-title_full"]:""),children:[(0,s.jsx)(ti,{className:h()(tn["mock-set-intro-name"],t?tn["mock-set-intro-name_full"]:""),children:o.name}),!i&&o.name?(0,s.jsx)(v._3,{icon:(0,s.jsx)(j.mGJ,{className:h()(tn["mock-set-intro-edit"],t?tn["mock-set-intro-edit_full"]:"")}),size:"small",theme:"borderless",onClick:()=>l(!0)}):null,(0,s.jsx)(e8.a,{visible:a,initialInfo:{bindSubjectInfo:o.mockSubject||{},bizCtx:n,id:String(o.id),name:o.name,desc:o.description},onSuccess:e=>{null==r||r(e),l(!1)},onCancel:()=>l(!1)})]}),o.description?(0,s.jsx)(ti,{className:h()(tn["mock-set-intro-desc"],tn["mock-set-intro-desc_priority"],t?tn["mock-set-intro-desc_full"]:""),children:o.description}):null]})}var tl=i("746278");function ts(e){var t,{pluginId:i,apiInfo:o,mockSetInfo:r}=e,a=(0,e3.fR)(e3.GV.PLUGIN_MOCK_DATA),[l,d]=(0,c.useState)({name:null==a?void 0:a.pluginName});var u=(t=(0,n._)(function*(){try{var e=yield y.nA.GetPluginInfo({plugin_id:i||""},{__disableErrorToast:!0});(null==e?void 0:e.code)===0&&d(e.meta_info||{})}catch(e){W.kg.error({error:e,eventName:"get_plugin_info_fail"})}}),function(){return t.apply(this,arguments)});return(0,c.useEffect)(()=>{u()},[i]),(0,s.jsx)(v._n.Header,{className:tn["layout-header"],breadcrumb:(0,s.jsx)(et.g3,{showTooltip:{width:"300px"},pluginInfo:l,pluginToolInfo:o,mockSetInfo:r,compact:!1})})}var td=i("763055"),tc=i("49695");function tu(e){var{height:t,width:i}=e;return(0,s.jsx)("div",{style:{width:i,height:t,display:i?"inline-block":"block"}})}var tp=i("286518"),tg=i("177625"),tm=i("998600"),th=i("966219"),tf=i("937373"),tb={};tb.styleTagTransform=L(),tb.setAttributes=S(),tb.insert=D().bind(null,"head"),tb.domAPI=T(),tb.insertStyleElement=C(),I()(tf.Z,tb);var tv=tf.Z&&tf.Z.locals?tf.Z.locals:void 0,tx=i("792795"),t_={};t_.styleTagTransform=L(),t_.setAttributes=S(),t_.insert=D().bind(null,"head"),t_.domAPI=T(),t_.insertStyleElement=C(),I()(tx.Z,t_);var ty=tx.Z&&tx.Z.locals?tx.Z.locals:void 0,tw=(0,c.forwardRef)((e,t)=>{var i,o,r,{mockInfo:n,readOnly:a,className:l,onValidate:d,onEditorPaste:u,onEditorReady:p}=e,{mock:g,mergedResultExample:m,schema:f,incompatible:b}=n,[x,_]=(0,c.useState)(!1),y=(0,c.useRef)(null),w=(0,c.useRef)(null),k=(0,c.useCallback)(e=>{var t,i=e.map(e=>({message:e.message}));(null===(t=y.current)||void 0===t?void 0:t.getValue().trim().length)===0&&i.push({message:"no data"}),null==d||d(i)},[d]),{run:j}=(0,tm.Z)(()=>{var e,t,i=null===(e=y.current)||void 0===e?void 0:e.getModel();if(null==i?void 0:i.id){;k((null===(t=w.current)||void 0===t?void 0:t.editor.getModelMarkers)(i.id).filter(e=>e.resource.path===i.id.replace("$model","/"))||[])}},{wait:200}),M=(0,c.useCallback)(()=>{var e;null===(e=y.current)||void 0===e||e.trigger("editor","editor.action.formatDocument",{})},[]),I=(e,t)=>{y.current=e,w.current=t;var i,o=f?(0,e5.KD)(f):void 0,r=e.getModel(),n=null==r?void 0:r.uri.toString();o&&n&&t.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemaValidation:"error",schemas:[{uri:"https://plugin-mock-set/tool_schema_".concat(null==r?void 0:r.id),fileMatch:[n],schema:o}]}),e.onDidBlurEditorText(M),e.onDidPaste(()=>{!1!==(null==u?void 0:u())&&M()}),e.onDidChangeModelDecorations(j),null===(i=e.getModel())||void 0===i||i.updateOptions({tabSize:tg.S9}),null==p||p(),setTimeout(()=>{_(!0)})};return(0,c.useImperativeHandle)(t,()=>({getValue:()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.getValue()}})),(0,c.useEffect)(()=>{M()},[null==g?void 0:null===(i=g.responseExpect)||void 0===i?void 0:i.responseExpectRule,m]),(0,s.jsxs)("div",{className:h()(ty["editor-container"],a?ty["editor-container_disabled"]:"",tv.light,l),children:[x?null:(0,s.jsx)(v.Od,{className:ty.skeleton,placeholder:(0,s.jsx)(v.Od.Image,{})}),b&&!a?(0,s.jsx)(th.DiffEditor,{className:h()(ty.editor,x?"":ty.editor_hidden),theme:"vs-dark",original:null==g?void 0:null===(o=g.responseExpect)||void 0===o?void 0:o.responseExpectRule,modified:m,language:"json",options:{unicodeHighlight:{ambiguousCharacters:!1},wordWrap:"on",readOnly:a,formatOnPaste:!0,formatOnType:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,contextmenu:!1},onMount:(e,t)=>{I(e.getModifiedEditor(),t)},loading:null}):(0,s.jsx)(th.Editor,{className:h()(ty.editor,x?"":ty.editor_hidden),theme:"vs-dark",language:"json",options:{unicodeHighlight:{ambiguousCharacters:!1},wordWrap:"on",readOnly:a,formatOnPaste:!0,formatOnType:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,scrollbar:{alwaysConsumeMouseWheel:!a},contextmenu:!1},value:(null==g?void 0:null===(r=g.responseExpect)||void 0===r?void 0:r.responseExpectRule)||m,onMount:I,loading:null})]})}),tk=i("209684"),tj={};tj.styleTagTransform=L(),tj.setAttributes=S(),tj.insert=D().bind(null,"head"),tj.domAPI=T(),tj.insertStyleElement=C(),I()(tk.Z,tj);var tM=tk.Z&&tk.Z.locals?tk.Z.locals:void 0,tI=(0,c.forwardRef)((e,t)=>{var{onValidate:i,mockInfo:o,environment:r,isCreateScene:n,className:d}=e,u=(0,e9._)(e,["onValidate","mockInfo","environment","isCreateScene","className"]),p=(0,c.useRef)([]),[g,m]=(0,c.useState)({current:0,valid:[!0],data:o.mergedResultExample?[o.mergedResultExample]:[]}),b=(e,t)=>{var o=g.valid.slice();o[t]=!e.length,m((0,l._)((0,a._)({},g),{valid:o})),null==i||i(o)},x=e=>{var t,i=null===(t=p.current[e])||void 0===t?void 0:t.getValue();if((i?(0,e5.Vv)(i):0)>tg.Fc)return v.FN.error(f.o.t("mockset_toast_data_size_limit")),!1},_=()=>{var e;return null===(e=p.current)||void 0===e?void 0:e.slice(0,g.data.length).map(e=>(null==e?void 0:e.getValue())||"")};return(0,c.useImperativeHandle)(t,()=>({getValue:_})),(0,s.jsx)("div",{className:h()(d,tM["mock-tab-container"]),children:(0,s.jsx)("div",{className:tM["mock-tab-panels"],children:g.data.map((e,t)=>(0,s.jsx)(tw,(0,a._)({className:h()(t===g.current?tM["mock-tab-panel_visible"]:tM["mock-tab-panel_invisible"],0===t?tM["mock-tab-panel_static"]:tM["mock-tab-panel_absolute"]),mockInfo:(0,l._)((0,a._)({},o),{mergedResultExample:e}),ref:e=>p.current[t]=e,onValidate:e=>b(e,t),onEditorPaste:()=>x(t)},u),t))})})}),tN=i("939619"),tT=i("450599"),tz={schema:"",result:void 0},tD="response_for_model";function tA(e,t){var i,o=(i=e,(0,c.useMemo)(()=>{if(i&&tz.schema===i)return tz.result;if(i){tz.schema=i;var e=(0,e5.KD)(i),t=(0,e5.Zg)(tg.dz,e);return tz.result=t,t}},[i])),{result:r,merged:n,incompatible:a,formatted:l}=(0,c.useMemo)(()=>{var{result:e,incompatible:i}=(0,tT.Lt)(o,t);if(!e)return{incompatible:i};var r,n=null===(r=(0,e5.Cu)(e,void 0!==t))||void 0===r?void 0:r[tg.dz];return{merged:e,result:n,formatted:(0,e5._v)(n),incompatible:i}},[o,t]),s=(0,c.useCallback)(e=>{var t;if(null==o?void 0:null===(t=o.children)||void 0===t?void 0:t.some(e=>e.label===tD&&e.type===tN.U.STRING)){var i=(0,b.dj)(e);if("object"==typeof i&&("string"!=typeof i[tD]||0===i[tD].length))return!1}return!0},[o]);return{result:o,mergedResult:n,mergedResultExample:r,formattedResultExample:l,incompatible:a,isInit:void 0===t,testValueValid:s}}var tS=i("936721");var tE=((o={}).MODAL="modal",o.CARD="card",o);function tC(e){var{mode:t,mockInfo:i,visible:o,onCancel:r,onSuccess:u,bizCtx:g,forceGenerate:m}=e,{schema:h}=i||{},b=(0,c.useRef)(null),[x,_]=(0,c.useState)(!1),[w,k]=(0,c.useState)(!1),{testValueValid:j,formattedResultExample:M}=tA(h),{mock_set_id:I,tool_id:N}=(0,d.useParams)(),T=(0,er.rY)(e=>e.space.space_type)===tp.Sn.Personal,z={environment:(0,e5.zj)(),workspace_id:g.bizSpaceID||"",workspace_type:T?"personal_workspace":"team_workspace",tool_id:N||"",mock_set_id:I||""},{save:D,loading:A}=function(e){var t,{mockSetId:i,basicParams:o,bizCtx:r,onSuccess:s,onError:d}=e;var{runAsync:c,loading:u}=(0,p.Z)((t=(0,n._)(function*(e,t){var c,u,p,g,m=e.map((c=(0,n._)(function*(e){var o={id:t,mocksetID:i,responseExpect:{responseExpectType:tS.K7.JSON,responseExpectRule:e}};try{var{id:n}=yield y.xd.SaveMockRule((0,a._)({bizCtx:r},o),{__disableErrorToast:!0});return(0,l._)((0,a._)({status:"success"},o),{id:n||t})}catch(e){return W.kg.error({error:e,eventName:"save_mock_info_fail"}),{status:"fail",error:e}}}),function(e){return c.apply(this,arguments)})),h=yield Promise.all(m),b=h.filter(e=>"success"===e.status),x=h.filter(e=>"success"!==e.status);b.length&&(0,e1.Gg)(e1.Kg.create_mock_front,(0,l._)((0,a._)({},o),{mock_counts:b.length,status:0})),x.length&&(0,e1.Gg)(e1.Kg.create_mock_front,(0,l._)((0,a._)({},o),{mock_counts:x.length,status:1,error:null===(u=x[0].error)||void 0===u?void 0:u.message})),0===b.length?(v.FN.error({content:(0,eL.u)((null===(g=x[0])||void 0===g?void 0:null===(p=g.error)||void 0===p?void 0:p.message)||f.o.t("error")),showClose:!1}),null==d||d()):null==s||s(b)}),function(e,i){return t.apply(this,arguments)}),{manual:!0});return{save:c,loading:u}}({mockSetId:I,basicParams:z,bizCtx:g,onSuccess:u}),S=()=>{var e,t,o=null===(e=b.current)||void 0===e?void 0:e.getValue();if(!!o){for(var r of o){if(!r){v.FN.error("no data");return}if((0,e5.Vv)(r)>tg.Fc){v.FN.error({content:f.o.t("mockset_toast_data_size_limit"),showClose:!1});return}if(!j(r)){v.FN.error({content:f.o.t("mockdata_field_empty",{fieldName:tD}),showClose:!1});return}}D(o,String((null==i?void 0:null===(t=i.mock)||void 0===t?void 0:t.id)||0))}},E=e=>{_(e.some(e=>!e))};return(0,c.useEffect)(()=>{var e=e=>{var t=f.o.t("mockset_tip_data_will_lose");return e.preventDefault(),e.returnValue=t,t};return("modal"===t&&o||"card"===t)&&window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[t,o]),(0,c.useEffect)(()=>{if(m){var e,t;null===(t=b.current)||void 0===t||null===(e=t.forceStartGenerate)||void 0===e||e.call(t,m.mode,m.count)}},[]),"modal"===t?(0,s.jsx)(v.M5,{visible:o,title:(null==i?void 0:i.mock)?f.o.t("edit_mock_data"):f.o.t("add_mock_data"),className:tn["mock-creation-modal"],keepDOM:!1,footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"mr-[8px]",children:f.o.t("mockset_save_description")}),(0,s.jsx)(v.iz,{layout:"vertical",margin:"0px"}),(0,s.jsx)(v.y3,{type:"tertiary",onClick:r,children:f.o.t("cancel")},"Cancel"),(0,s.jsx)(v.y3,{type:"primary",theme:"solid",onClick:S,loading:A,disabled:x||w,children:f.o.t("confirm")},"Confirm")]}),width:1e3,maskClosable:!1,onCancel:r,children:(0,s.jsx)(tI,{className:tn["mock-creation-modal-editor"],mockInfo:(0,a._)({mergedResultExample:M},i),readOnly:!1,ref:b,onValidate:E,environment:{spaceId:g.bizSpaceID,mockSetId:I,basicParams:z},isCreateScene:!(null==i?void 0:i.mock),onGenerationStatusChange:e=>k(e)})}):(0,s.jsxs)("div",{className:tn["mock-creation-card"],children:[(0,s.jsx)("div",{className:tn["mock-creation-card-editor"],children:(0,s.jsx)(tI,{mockInfo:(0,a._)({mergedResultExample:M},i),ref:b,onValidate:E,environment:{spaceId:g.bizSpaceID,mockSetId:I,basicParams:z},isCreateScene:!(null==i?void 0:i.mock),onGenerationStatusChange:e=>k(e)})}),(0,s.jsx)("div",{className:tn["mock-creation-card-operation"],children:(0,s.jsxs)(v.T,{children:[(0,s.jsx)(v.ZT.Text,{children:f.o.t("mockset_save_description")}),(0,s.jsx)(v.iz,{layout:"vertical",margin:"0px"}),(0,s.jsx)(v.y3,{type:"primary",theme:"solid",onClick:S,loading:A,disabled:x||w,children:f.o.t("mockset_save")})]})})]})}var tO=i("773568");var tL=((r={})[r.NONE=0]="NONE",r[r.VISIBLE=1]="VISIBLE",r[r.HALF=2]="HALF",r),tZ=i("393288"),tP={};tP.styleTagTransform=L(),tP.setAttributes=S(),tP.insert=D().bind(null,"head"),tP.domAPI=T(),tP.insertStyleElement=C(),I()(tZ.Z,tP);var tF=tZ.Z&&tZ.Z.locals?tZ.Z.locals:void 0;function tB(e){var t,i,{mock:o,readOnly:r,schema:n,onEdit:d,onRemove:u}=e,{formattedResultExample:p,incompatible:g,mergedResult:m}=tA(n,null==o?void 0:null===(t=o.responseExpect)||void 0===t?void 0:t.responseExpectRule),{branchInfo:b,prunedData:x}=function(e){var[t,i]=(0,c.useState)({}),[o,r]=(0,c.useState)(),n=e=>{if(!!(null==e?void 0:e.children)){var t=e.children.map(e=>e.type!==tO.U.ARRAY&&e.type!==tO.U.OBJECT?(0,a._)({},e):!1===e.isRequired&&e.status===tO.M.ADDED?(0,l._)((0,a._)({},e),{children:void 0}):n(e));return(0,l._)((0,a._)({},e),{children:t})}},s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i={};if(null==e?void 0:e.children){var{length:o}=e.children;null==e||e.children.forEach((e,r)=>{var n=r===o-1;i[e.key]={isLast:n,v:n&&t.length>0?[...t.slice(0,-1),2]:t},Object.assign(i,s(e,n&&t.length>0?[...t.slice(0,-1),0,1]:[...t,1]))})}return i};return(0,c.useEffect)(()=>{var t=n(e),o=s(t);r(t),i(o)},[e]),{branchInfo:t,prunedData:o}}(m),_=(e,t)=>{var i=(null==e?void 0:e.key)?b[e.key]:void 0;return(0,s.jsxs)("span",{className:tF["card-branches"],children:[null==i?void 0:i.v.map((e,t)=>(0,s.jsx)("span",{className:h()(tF["card-branch-v"],e!==tL.NONE?tF["card-branch-v_visible"]:"",e===tL.HALF?tF["card-branch-v_half"]:"")},t)),t?"":(0,s.jsx)("span",{className:h()(tF["card-branch-h"],(null==e?void 0:e.children)?"":tF["card-branch-h_long"])})]})},y=e=>{var t=(null==e?void 0:e.status)===tO.M.REMOVED;return(null==e?void 0:e.status)===tO.M.ADDED?(0,s.jsx)(tR,{val:e.isRequired?f.o.t("mockset_field_is_required",{field:null==e?void 0:e.label}):void 0,className:h()("ms-[8px]",e.isRequired?tF["card-item-text_highlighted"]:"")}):((null==e?void 0:e.type)===tO.U.ARRAY||(null==e?void 0:e.type)===tO.U.OBJECT)&&(null==e?void 0:e.children)?"":(0,s.jsx)(tR,{val:null==e?void 0:e.displayValue,className:h()("ms-[8px]",t?tF["card-item-text_highlighted"]:"")})},w=(e,t)=>{var i="".concat(tg.dz,"-").concat(null==t?void 0:t.label)===(null==t?void 0:t.key),o=(null==t?void 0:t.status)===tO.M.REMOVED,r=(null==t?void 0:t.status)===tO.M.ADDED&&t.isRequired;return t?(0,s.jsxs)(s.Fragment,{children:[_(t,i),(0,s.jsxs)("span",{className:h()(tF["card-item"],o||r?tF["card-item-text_highlighted"]:"",o?tF["card-item_deleted"]:""),children:[(0,s.jsx)("span",{className:h()(tF["card-item-text"],i?tF["card-item-text_primary"]:"",o||r?tF["card-item-text_highlighted"]:""),children:null==t?void 0:t.label}),(null==t?void 0:t.isRequired)?(0,s.jsx)("span",{className:h()(tF["card-item-text"],tF["card-item-text_required"]),children:"*"}):null,o||r?null:(0,s.jsxs)("span",{className:h()(tF["card-item-tag"],"ms-[8px]"),children:[(0,tT.jy)(null==t?void 0:t.type),(null==t?void 0:t.type)===tO.U.ARRAY?"<".concat((0,tT.jy)(null==t?void 0:t.childrenType),">"):""]}),y(t)]})]}):""};return(null==o?void 0:null===(i=o.responseExpect)||void 0===i?void 0:i.responseExpectRule)?(0,s.jsxs)("div",{className:tF["mock-data-card"],children:[(0,s.jsx)("div",{className:tF["mock-data-content"],children:(()=>{var e;if((null==x?void 0:x.type)!==tO.U.ARRAY&&(null==x?void 0:x.type)!==tO.U.OBJECT)return(0,s.jsx)("div",{className:tF["card-non-tree-container"],children:(0,s.jsx)(tR,{val:null==x?void 0:x.displayValue})});return(null===(e=x.children)||void 0===e?void 0:e.length)?(0,s.jsx)(v.mp,{defaultExpandAll:!0,treeData:x.children,renderLabel:w}):(0,s.jsx)("div",{className:tF["card-non-tree-container"],children:(0,s.jsx)("span",{className:h()(tF["card-item-text"],tF["card-item-text_invalid"]),children:"Empty"})})})()}),r?null:(0,s.jsxs)(v.T,{className:tF["mock-data-card-operations"],spacing:12,children:[(0,s.jsx)(v._3,{icon:(0,s.jsx)(j.mGJ,{className:tF["mock-data-card-edit"]}),size:"small",theme:"borderless",onClick:()=>{null==d||d({schema:n,mock:o,mergedResultExample:p,incompatible:g})}}),(0,s.jsx)(v._3,{icon:(0,s.jsx)(j.WDf,{className:tF["mock-data-card-edit"]}),size:"small",theme:"borderless",onClick:()=>{null==u||u({schema:n,mock:o})}})]})]}):null}var tR=e=>e.val?(0,s.jsx)("span",{className:h()(e.className,tF["card-item-text"]),children:e.val}):(0,s.jsx)("span",{className:h()(e.className,tF["card-item-text"],tF["card-item-text_invalid"]),children:"Undefined"}),tU=(0,c.forwardRef)((e,t)=>{var i,o,{mockSetID:r,perm:u,toolSchema:p,bizCtx:g,onListUpdate:m}=e,[b,x]=(0,c.useState)(!1),[_,w]=(0,c.useState)([]),[k,j]=(0,c.useState)(!1),[M,I]=(0,c.useState)(!1),[N,T]=(0,c.useState)(!1),[z,D]=(0,c.useState)(),A=(0,e3.fR)(e3.GV.PLUGIN_MOCK_DATA),{mock_set_id:S,space_id:E,tool_id:C}=(0,d.useParams)(),O=(0,er.rY)(e=>e.space.space_type)===e2.Sn.Personal,L=e=>{D(e),j(!0)},Z=e=>{D(e),I(!0)};var P=(i=(0,n._)(function*(e){try{x(!0);var t,i=yield y.xd.MGetMockRule({bizCtx:g,mockSetID:S,orderBy:e4.d$.UpdateTime,desc:!0});w(i.mockRules||[]),null==m||m((null===(t=i.mockRules)||void 0===t?void 0:t.length)||0,e)}catch(e){W.kg.error({error:e,eventName:"get_mock_data_fail"})}finally{x(!1)}}),function(e){return i.apply(this,arguments)});var F=(o=(0,n._)(function*(){var{mock:e}=z||{};if(!!e){var t={environment:(0,e5.zj)(),workspace_id:E||"",workspace_type:O?"personal_workspace":"team_workspace",tool_id:C||"",mock_set_id:S||"",mock_counts:1};try{T(!0),yield y.xd.DeleteMockRule({bizCtx:g,id:String(e.id)}),B(e,2),D(void 0),I(!1),(0,e1.Gg)(e1.Kg.del_mock_front,(0,l._)((0,a._)({},t),{status:0}))}catch(e){W.kg.error({error:e,eventName:"delete_mock_fail"}),(0,e1.Gg)(e1.Kg.del_mock_front,(0,l._)((0,a._)({},t),{status:1,error:e}))}finally{T(!1)}}}),function(){return o.apply(this,arguments)}),B=(e,t)=>{var i=0;0===t?P(!0):2===t?(i=_.length-1,w(t=>{var o=t.findIndex(t=>t.id===(null==e?void 0:e.id));return -1!==o&&t.splice(o,1),i=t.length,[...t]}),null==m||m(i)):(i=_.length,w(t=>{var o=t.findIndex(t=>t.id===(null==e?void 0:e.id));return -1!==o&&(t.splice(o,1),t.unshift(e)),i=t.length,[...t]}),null==m||m(i,!0))};return(0,c.useImperativeHandle)(t,()=>({update:P,create:()=>{D(void 0),j(!0)}})),(0,c.useEffect)(()=>{P()},[r]),(0,c.useEffect)(()=>{if(null==A?void 0:A.generationMode){var e=(0,l._)((0,a._)({},history.state),{usr:(0,l._)((0,a._)({},history.state.usr||{}),{generationMode:void 0})});history.replaceState(e,"")}},[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tu,{height:24}),b||u.uninitialized?(0,s.jsx)("div",{className:tn["list-container-no-header_flexible"],children:(0,s.jsx)(v.yC,{size:"large",spinning:!0,style:{height:"80%",width:"100%"}})}):u.readOnly&&0===_.length?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h1",{className:h()(tn["content-title"]),children:f.o.t("mockset_data")}),(0,s.jsx)("div",{className:tn["list-container_flexible"],children:(0,s.jsx)(v.HY,{className:tn.empty,image:(0,s.jsx)(td.ts,{}),darkModeImage:(0,s.jsx)(td.Id,{}),description:f.o.t("no_mock_yet")})})]}):u.readOnly||0!==_.length?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h1",{className:h()(tn["content-title"]),children:f.o.t("mockset_data")}),(0,s.jsx)("div",{className:tn["list-container_scroll"],children:_.map(e=>(0,s.jsx)(tB,{readOnly:u.readOnly,mock:e,schema:p,onEdit:e=>L(e),onRemove:e=>Z(e),bizCtx:g},e.id))})]}):(0,s.jsx)("div",{className:tn["list-container-no-header_flexible"],children:(0,s.jsx)(tC,{mode:tE.CARD,mockInfo:{schema:p},onSuccess:e=>{e&&B(e[0],0)},bizCtx:g,forceGenerate:(null==A?void 0:A.generationMode)?{mode:A.generationMode,count:1}:void 0})}),(0,s.jsx)(tC,{mode:tE.MODAL,mockInfo:z||{schema:p},visible:k,onCancel:()=>{D(void 0),j(!1)},onSuccess:e=>{D(void 0),j(!1),(null==e?void 0:e[0])&&B(e[0],z?1:0)},bizCtx:g}),(0,s.jsx)(v.M5,{type:"info",icon:(0,s.jsx)(tc.Z,{size:"extra-large",className:"inline-flex text-[#FF2710]"}),title:f.o.t("delete_mock_data"),visible:M,onCancel:()=>{D(void 0),I(!1)},okText:f.o.t("confirm"),cancelText:f.o.t("cancel"),confirmLoading:N,onOk:()=>F(),okType:"danger",children:f.o.t("operation_cannot_be_reversed")})]})}),tQ=i("928002"),tY={};tY.styleTagTransform=L(),tY.setAttributes=S(),tY.insert=D().bind(null,"head"),tY.domAPI=T(),tY.insertStyleElement=C(),I()(tQ.Z,tY);var tV=tQ.Z&&tQ.Z.locals?tQ.Z.locals:void 0,tW=e=>{var t,i,o,r,{toolID:u,mocksetID:p,pluginID:g,spaceID:m,version:x}=e,_=(0,c.useMemo)(()=>eX.Z.parse(location.search),[]),w=(0,e3.fR)(e3.GV.PLUGIN_MOCK_DATA),[k,M]=(0,c.useState)({name:null==w?void 0:w.toolName}),[I,N]=(0,c.useState)({id:p,name:null==w?void 0:w.mockSetName}),[T,z]=(0,c.useState)(""),[D,A]=(0,c.useState)({readOnly:!0,uninitialized:!0}),S=(0,c.useRef)(null),E=(0,c.useRef)(null),C=_.hideMenu?"full_page":"embed",O=(null==w?void 0:w.fromSource)?w.fromSource:"mock_set",[L,Z]=(0,c.useState)(0),P=e$.Z.useUserInfo(),F=(0,e0.$_)(m),B=(null==F?void 0:F.space_type)===e2.Sn.Personal,R=(0,d.useNavigate)(),U=(0,c.useMemo)(()=>({connectorID:tl.FQ,connectorUID:null==P?void 0:P.user_id_str,bizSpaceID:m}),[tl.FQ,P,m]),Q=(0,c.useMemo)(()=>({componentType:e4.re.CozeTool,componentID:u,parentComponentType:e4.re.CozePlugin,parentComponentID:g}),[u,g]);var Y=(t=(0,n._)(function*(){try{var{api_info:e=[]}=yield y.Js.GetPluginAPIs({plugin_id:g,api_ids:[u],preview_version_ts:x},{__disableErrorToast:!0});if(e.length>0){var t=e.length>0?e[0]:{};M(t)}}catch(e){W.kg.error({error:e,eventName:"get_tool_info_fail"})}}),function(){return t.apply(this,arguments)});var V=(i=(0,n._)(function*(){if(!!p)try{var e,t,i,o,r=yield y.xd.MGetMockSet({bizCtx:U,mockSubject:Q,ids:[p],pageLimit:1});(null===(e=r.mockSets)||void 0===e?void 0:e[0])&&N(r.mockSets[0]),r.schema&&z(r.schema),A({readOnly:(null==P?void 0:P.user_id_str)!==(null===(o=r.mockSets)||void 0===o?void 0:null===(i=o[0])||void 0===i?void 0:null===(t=i.creator)||void 0===t?void 0:t.ID),uninitialized:!1})}catch(e){W.kg.error({error:e,eventName:"get_mockset_info_fail"})}}),function(){return i.apply(this,arguments)}),G=()=>{var e;null===(e=S.current)||void 0===e||e.create()};var H=(o=(0,n._)(function*(){var e=(0,e6.dj)((null==w?void 0:w.bizCtx)||""),t={environment:(0,e5.zj)(),workspace_id:m,workspace_type:B?"personal_workspace":"team_workspace",tool_id:u,status:1,mock_set_id:p,where:(0,e6.G)(null==e?void 0:e.trafficScene)};try{yield y.xd.BindMockSet({mockSetID:p,bizCtx:e,mockSubject:(0,e6.dj)((null==w?void 0:w.bindSubjectInfo)||"")}),(0,e1.Gg)(e1.Kg.use_mockset_front,(0,l._)((0,a._)({},t),{status:0})),R(-1);var i=f.o.t("toolname_used_mockset_mocksetname",{toolName:(null==w?void 0:w.toolName)||"",mockSetName:I.name||""});i&&v.FN.success({content:i,showClose:!1})}catch(e){W.kg.error({error:e,eventName:"change_mockset_fail"}),(0,e1.Gg)(e1.Kg.use_mockset_front,(0,l._)((0,a._)({},t),{status:1,error:null==e?void 0:e.msg}))}}),function(){return o.apply(this,arguments)});return(0,c.useEffect)(()=>{V()},[]),(0,c.useEffect)(()=>{Y()},[g,u]),(0,s.jsxs)(v._n,{title:(0,b.Z$)(I.name||f.o.t("mockset")),children:["embed"===C?(0,s.jsx)(ts,{pluginId:g,apiInfo:k,mockSetInfo:I}):null,(0,s.jsxs)("div",{className:h()(tV["page-header"],"full_page"===C?tV["page-header_full"]:""),children:["full_page"===C?(0,s.jsx)(v.y3,{className:h()(tV["page-header-back"]),icon:(0,s.jsx)(j.s3j,{}),onClick:()=>{R(-1)},theme:"borderless"}):null,(0,s.jsx)("div",{className:h()(tV["page-header-intro"],"full_page"===C?tV["page-header-intro_center"]:tV["page-header-intro_top"]),children:(0,s.jsx)(ta,{isFullHeader:"full_page"===C,mockSetInfo:(0,a._)({mockSubject:Q},I),bizCtx:U,readOnly:D.readOnly,onUpdateMockSetInfo:e=>{e&&N(t=>(0,a._)({},t,e))}})}),(0,s.jsx)(v.T,{className:h()(tV["page-header-operations"]),spacing:12,children:(r=[],!D.readOnly&&0!==L&&r.push({label:f.o.t("add_mock_data"),handler:G}),("bot"===O||"workflow"===O)&&r.push({label:f.o.t("bot"===O?"use_in_bot":"use_in_workflow"),handler:H,disabled:0===L}),r.map((e,t)=>(0,s.jsx)(v.y3,{type:t===r.length-1?"primary":"tertiary",theme:t===r.length-1?"solid":void 0,onClick:e.handler,disabled:e.disabled,children:e.label},e.label)))})]}),(0,s.jsx)(v._n.Content,{className:h()(tV["layout-content"]),ref:E,children:(0,s.jsx)(tU,{mockSetID:p,toolSchema:T,perm:D,ref:S,bizCtx:U,onListUpdate:(e,t)=>{if(Z(e),t){var i;null===(i=E.current)||void 0===i||i.scrollTo({top:0,behavior:"smooth"})}}})})]})},tG=e=>{var t,{visible:i,mockSetInfo:o,onSuccess:r,onCancel:d,zIndex:u,needResetPopoverContainer:g}=e,{detail:{id:m},ctx:h}=o||{},[b,x]=(0,c.useState)(-1),_=(0,er.rY)(e=>e.space.space_type)===e2.Sn.Personal,{run:w}=(0,p.Z)((0,n._)(function*(){try{var{spaceID:e}=(0,e5.MX)((null==h?void 0:h.bizCtx)||{},(null==h?void 0:h.mockSubjectInfo)||{}),{usersUsageCount:t}=yield y.xd.GetMockSetUsageInfo({mockSetID:m,spaceID:e});x(Number(null!=t?t:0))}catch(e){W.kg.error({error:e,eventName:"fetch_mockset_ref_fail"}),x(0)}}),{manual:!0});(0,c.useEffect)(()=>{w()},[o]);var k=b>0?f.o.t("people_using_mockset_delete",{num:b}):f.o.t("delete_the_mockset");var j=(t=(0,n._)(function*(){var{toolID:e,spaceID:t}=(0,e5.MX)((null==h?void 0:h.bizCtx)||{},(null==h?void 0:h.mockSubjectInfo)||{}),i={environment:(0,e5.zj)(),workspace_id:t||"",workspace_type:_?"personal_workspace":"team_workspace",tool_id:e||"",mock_set_id:String(m)||"",status:1};try{m&&(yield y.xd.DeleteMockSet({id:m,bizCtx:null==h?void 0:h.bizCtx})),null==r||r(),(0,e1.Gg)(e1.Kg.del_mockset_front,(0,l._)((0,a._)({},i),{status:0}))}catch(e){(0,e1.Gg)(e1.Kg.del_mockset_front,(0,l._)((0,a._)({},i),{status:1,error:null==e?void 0:e.message}))}}),function(){return t.apply(this,arguments)});return(0,s.jsx)(v.M5,{type:"info",zIndex:u,icon:(0,s.jsx)(tc.Z,{size:"extra-large",className:"inline-flex text-[#FF2710]"}),title:k,visible:b>=0&&i,onCancel:d,onOk:j,getPopupContainer:g?()=>document.body:void 0,okType:"danger",children:f.o.t("operation_cannot_be_reversed")})},tH=i("751238"),tq={};tq.styleTagTransform=L(),tq.setAttributes=S(),tq.insert=D().bind(null,"head"),tq.domAPI=T(),tq.insertStyleElement=C(),I()(tH.Z,tq);var tK=tH.Z&&tH.Z.locals?tH.Z.locals:void 0,tJ=e=>{var t,i,o,r,d,g,{toolID:m}=e,x=(0,k.av)(),_=e$.Z.useUserInfo(),[w,M]=(0,c.useState)({pageSize:10,pageNo:1}),{pluginInfo:I,initPlugin:N,pluginID:T,spaceID:z,version:D}=(0,k.RQ)((0,u.N)(e=>({pluginInfo:e.pluginInfo,initPlugin:e.initPlugin,pluginID:e.pluginId,spaceID:e.spaceID,version:e.version}))),A=(0,e0.$_)(z),S=(null==A?void 0:A.space_type)===e2.Sn.Personal,[E,C]=(0,c.useState)(),[O,L]=(0,c.useState)(!1),[Z,P]=(0,c.useState)(),F=(0,c.useRef)(),B=(0,c.useRef)(null),[R,U]=(0,c.useState)(!1),Q={bizCtx:{trafficScene:e4.zE.Undefined,connectorID:tl.FQ,bizSpaceID:z,connectorUID:null==_?void 0:_.user_id_str},mockSubject:{componentType:e4.re.CozeTool,componentID:m,parentComponentType:e4.re.CozePlugin,parentComponentID:T}};var Y=[...(t=S,i=[{title:f.o.t("mockset_name"),dataIndex:"name",className:"min-w-[200px]",render:(e,t)=>(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(v.ZT.Text,{strong:!0,ellipsis:{showTooltip:{opts:{style:{wordBreak:"break-word"}}}},className:"min-w-[0px]",children:t.name||"-"}),(null==t?void 0:t.schemaIncompatible)?(0,s.jsx)(v.fS,{className:"ml-[10px]",shape:"circle",color:"orange",children:f.o.t("update_required")}):null]}),t.description?(0,s.jsx)(ti,{children:t.description}):"-"]})},{title:f.o.t("mock_data_counts"),dataIndex:"mockRuleQuantity",width:116,render:(e,t)=>void 0===t.mockRuleQuantity?"-":(0,s.jsx)(v.ZT.Text,{ellipsis:{showTooltip:!0},className:"text-[#1C1D2359]",children:(0,b.uf)(t.mockRuleQuantity)})},{title:f.o.t("edit_time"),dataIndex:"updateTimeInSec",width:150,sorter:!0,render:(e,t)=>t.updateTimeInSec?(0,s.jsx)("div",{children:(0,b.p6)(Number(t.updateTimeInSec),"YYYY-MM-DD HH:mm")}):"-"}],o=[{title:f.o.t("creators"),dataIndex:"creatorID",width:132,render:(e,t)=>{var i,o,r;return(null===(i=t.creator)||void 0===i?void 0:i.ID)?(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(v.qE,{src:null===(o=t.creator)||void 0===o?void 0:o.avatarUrl,size:"extra-extra-small",className:"mr-[8px]",alt:"User"}),(0,s.jsx)(v.ZT.Text,{ellipsis:{showTooltip:!0},className:"flex-1 text-[#1C1D2359]",children:null===(r=t.creator)||void 0===r?void 0:r.name})]}):"-"}}],t?i:[...i,...o]),{title:f.o.t("actions"),dataIndex:"action",width:108,render:(e,t)=>{var i,o=(null==_?void 0:_.user_id_str)===(null==t?void 0:null===(i=t.creator)||void 0===i?void 0:i.ID);return(0,s.jsx)("div",{onClick:e=>{e.stopPropagation()},children:(0,s.jsxs)(v.T,{spacing:16,children:[(0,s.jsx)(v.u,{content:f.o.t("Edit"),children:(0,s.jsx)(v._3,{disabled:!o||R,icon:(0,s.jsx)(j.fkE,{}),onClick:()=>{G(t)},className:!o||R?tK["icon-disabled"]:tK["icon-default"]})}),(0,s.jsx)(v.u,{content:f.o.t("Delete"),children:(0,s.jsx)(v._3,{icon:(0,s.jsx)(j.WDf,{}),className:h()(tK["icon-delete"],!o||R?tK["icon-disabled"]:tK["icon-default"]),disabled:!o||R,onClick:()=>{P(t)}})})]})})}}],V=()=>{L(!0)},G=(e,t)=>{var i,o,{id:r}=e||{};r&&(null===(o=x.mocksetDetail)||void 0===o||o.call(x,m,String(r),{},{state:{spaceId:z,pluginId:T,pluginName:null==I?void 0:null===(i=I.meta_info)||void 0===i?void 0:i.name,toolId:m,toolName:null==E?void 0:E.name,mockSetId:String(r),mockSetName:null==e?void 0:e.name,generationMode:null==t?void 0:t.generateMode}}))};var H=(r=(0,n._)(function*(){try{var{api_info:e=[]}=yield y.Js.GetPluginAPIs({plugin_id:T,api_ids:[m],preview_version_ts:D});if(e.length>0){var t=e.length>0?e[0]:{};C(t)}}catch(e){W.kg.error({error:e,eventName:"fetch_tool_info_fail"}),C({})}}),function(){return r.apply(this,arguments)}),{data:q,loading:K}=(0,p.Z)((0,n._)(function*(){if(!Q.mockSubject.componentID||!Q.mockSubject.parentComponentID)return{total:0,list:[]};try{var e,t,{mockSets:i,pageToken:o,count:r}=yield y.xd.MGetMockSet({bizCtx:Q.bizCtx,mockSubject:Q.mockSubject,pageLimit:w.pageSize,pageToken:w.pageToken,desc:null===(t=null===(e=w.order)||void 0===e?void 0:e.desc)||void 0===t||t,orderBy:e4.d$.UpdateTime});return F.current=o,{total:r,list:i||[]}}catch(e){var{code:n}=e||{};return("600303107"===n||"600303108"===n)&&U(!0),{total:0,list:[]}}}),{refreshDeps:[w],onError:e=>{W.kg.error({error:e,eventName:"fetch_mockset_list_fail"})}}),J=()=>{var e;null===(e=B.current)||void 0===e||e.reset(),M(e=>(0,l._)((0,a._)({},e),{pageSize:10,pageToken:void 0,pageNo:1}))};return(0,c.useEffect)(()=>{N(),H()},[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:tK.page,children:(0,s.jsxs)(v._n,{title:(0,b.Z$)(f.o.t("manage_mockset")),children:[(0,s.jsx)(v._n.Header,{className:tK["layout-header"],breadcrumb:(0,s.jsx)(et.g3,{showTooltip:{width:"300px"},pluginInfo:null==I?void 0:I.meta_info,pluginToolInfo:E,compact:!1,mockSetInfo:{}})}),(0,s.jsxs)(v._n.Content,{className:tK["layout-content"],children:[(0,s.jsxs)("div",{className:tK["header-info"],children:[(0,s.jsx)(v.ZT.Text,{className:tK["layout-header-title"],children:(null==I?void 0:null===(d=I.meta_info)||void 0===d?void 0:d.name)?f.o.t("mockset_of_toolname",{toolName:null==I?void 0:null===(g=I.meta_info)||void 0===g?void 0:g.name}):f.o.t("mockset")}),(0,s.jsx)(v.u,{style:{display:R?"block":"none"},content:f.o.t("unreleased_plugins_tool_cannot_create_mockset"),children:(0,s.jsx)(v.y3,{onClick:V,theme:"solid",disabled:R,children:f.o.t("create_mockset")})})]}),(0,s.jsx)(v.$,{ref:B,offsetY:207,tableProps:{loading:K,dataSource:(null==q?void 0:q.list)||[],columns:Y,onRow:e=>({onClick:()=>{!R&&G(e)}}),onChange:e=>{var t,i;(null===(t=e.sorter)||void 0===t?void 0:t.sortOrder)&&(null===(i=B.current)||void 0===i||i.reset(),M(t=>{var i;return(0,l._)((0,a._)({},t),{pageSize:10,pageNo:1,pageToken:void 0,order:{desc:(null===(i=e.sorter)||void 0===i?void 0:i.sortOrder)==="descend"}})}))}},empty:(0,s.jsx)(v.YZ,{empty:{title:f.o.t("no_mockset_yet"),description:R?void 0:f.o.t("click_button_to_create_mockset"),btnText:R?void 0:f.o.t("create_mockset"),btnOnClick:R?void 0:V}}),enableLoad:!0,total:Number((null==q?void 0:q.total)||0),onLoad:()=>{M(e=>{var t;return(0,l._)((0,a._)({},e),{pageToken:F.current,pageNo:(null!==(t=e.pageNo)&&void 0!==t?t:0)+1})})}})]})]})}),O?(0,s.jsx)(e8.a,{visible:O,initialInfo:{bizCtx:Q.bizCtx,bindSubjectInfo:Q.mockSubject,name:null==E?void 0:E.name},onSuccess:G,onCancel:()=>L(!1)}):null,Z?(0,s.jsx)(tG,{visible:!!Z,mockSetInfo:{detail:Z,ctx:{bizCtx:Q.bizCtx,mockSubjectInfo:Q.mockSubject}},onSuccess:()=>{P(void 0),J()},onCancel:()=>P(void 0)}):null]})},tX=i("962289"),t$=i("671261"),t0=i("62851"),t1=i("944970"),t2=i("437134"),t4=e=>(null==e?void 0:e.assist_type)?[eF.rN.DEFAULT,(0,eF.Eo)(e.assist_type)]:[e.type],{Text:t5}=v.ZT,t3=e=>{var t,{check:i=0,useBlockWrap:o=!1,record:r,disabled:n,selectCallback:a,enableFileType:l=!1}=e,[d,u]=(0,c.useState)(t4(r)),[p,g]=(0,c.useState)(0),m=r.name===eF.sp,b=(null!==(t=r.deep)&&void 0!==t?t:0)>1&&r.name!==eF.sp;(0,c.useEffect)(()=>{if(0!==i)x(d)},[i]);var x=e=>{g((null==e?void 0:e[0])?0:1)},_=(0,eF.YA)(m,l&&!b);return(0,s.jsxs)("span",{style:o?{display:"inline-block",width:"100%"}:{},children:[(0,s.jsx)(v.oL,{treeData:_,validateStatus:p?"error":"default",value:d,disabled:n,onChange:e=>{e[1]?a([e[0],(0,eF.RE)(e[1])]):a([e[0]]),u(e),x(e)},displayRender:(e,t)=>{var i=e[0];return d[1]&&(i=d[1]===eF.rN.DEFAULT?(0,eF.Zo)(eF.rN.DEFAULT,m):e[1]),(0,s.jsx)(t5,{ellipsis:{showTooltip:!0},children:i})},dropdownClassName:eZ.Z.cascaderDropdown,style:{width:"100%"}}),(0,s.jsx)("br",{}),0!==p&&(0,s.jsx)("div",{style:{position:"relative"},children:(0,s.jsxs)("span",{className:h()(eZ.Z["form-check-tip"],"errorClassTag",eZ.Z.w110),children:[(0,s.jsx)(tc.Z,{className:eZ.Z["plugin-icon-error"]}),(0,s.jsx)(t5,{component:"span",ellipsis:{showTooltip:{type:"tooltip",opts:{style:{maxWidth:"100%"}}}},className:eZ.Z["plugin-tooltip-error"],children:1===p&&(0,s.jsx)("span",{children:f.o.t("plugin_Parameter_type")})})]})})]})},t6=e=>{var{record:t,disabled:i,data:o,setData:r,checkFlag:n,isResponse:d,updateNodeWithData:c,addChildNode:u,enableFileType:p=!1}=e,g=e=>{var t=(0,H.Z)(o);(0,ea.Rm)(t,e[eF.Fc])&&r(t)};return i?(0,s.jsx)(s.Fragment,{children:(0,eF.lR)(t,t.name===eF.sp)}):(0,s.jsx)(t3,{check:n,record:t,enableFileType:p,selectCallback:e=>{var[i,o]=e,r=i;i===eF.rN.DEFAULT&&(r=_.rH.String),!d&&t.global_default&&c({record:t,key:["global_default","global_disable"],value:["",!1],updateData:!0});var n={record:t,key:["type","assist_type"],value:[r,null!=o?o:null]},s=null==t?void 0:t.type;r===_.rH.Array?(c((0,l._)((0,a._)({},n),{updateData:!0})),u({record:t,isArray:!0,type:r,recordType:s})):r===_.rH.Object?(c((0,l._)((0,a._)({},n),{updateData:!0})),u({record:t,isArray:!1,type:r,recordType:s})):(null==t?void 0:t.type)===_.rH.Array||(null==t?void 0:t.type)===_.rH.Object?(c(n),g(t)):c((0,l._)((0,a._)({},n),{updateData:!0}))}})},t8=e=>{var{data:t,checkFlag:i,isResponse:o=!1,disabled:r,setCheckFlag:n,setData:d,showSecurityCheckFailedMsg:c,setShowSecurityCheckFailedMsg:u,enableFileType:p=!1}=e,g=e=>{var{record:i,isArray:o=!1,type:r,recordType:s}=e,c=(0,H.Z)(t),u=(e,t)=>{var i=e[t[0]];i&&i.type===_.rH.Array?(i.global_default="",i.global_disable=!1):i&&i.sub_parameters&&u(i.sub_parameters,t.slice(1))};n(0);var p={};(0,ea.bd)({data:t,callback:(e,t)=>{e[eF.Fc]===i[eF.Fc]&&(p=(0,l._)((0,a._)({},e),{path:t}),u(c,t))}});var g=((null==p?void 0:p.path)||[]).map(e=>[e,eF.Il]).flat();if(s){var m=(0,H.Z)(g);m.pop(),m.push("type"),(0,tX.Z)(c,m)!==s&&(0,ea.Rm)(c,i[eF.Fc]),(0,t$.Z)(c,m,r)}Array.isArray((0,tX.Z)(c,g))?(0,t$.Z)(c,g,[...(0,tX.Z)(c,g),(0,ea.ub)({isArray:o,iscChildren:!0,deep:i.deep+1})]):(0,t$.Z)(c,g,[(0,ea.ub)({isArray:o,iscChildren:!0,deep:i.deep+1})]),d(c)},m=e=>{var i=(0,H.Z)(t);(0,ea.IK)(i,e[eF.Fc])&&d(i)},h=e=>{var{record:i,key:o,value:r,updateData:n=!1,inherit:a=!1}=e;Array.isArray(o)?o.forEach((e,o)=>{(0,ea.jd)({data:t,targetKey:i[eF.Fc],field:e,value:r[o]})}):(0,ea.jd)({data:t,targetKey:i[eF.Fc],field:o,value:r,inherit:a}),n&&d((0,H.Z)(t))},x=[{title:()=>(0,s.jsx)(t1.vw,{name:f.o.t("Create_newtool_s3_table_name"),required:!0,toolTipText:o?f.o.t("Create_newtool_s3_table_name_tooltip"):f.o.t("Create_newtool_s2_table_name_tooltip")}),key:"name",className:eZ.Z["no-wrap-min-width"],render:e=>r?(0,s.jsx)(v.ZT.Text,{component:"span",ellipsis:{showTooltip:{type:"tooltip",opts:{style:{maxWidth:"100%"}}}},style:{maxWidth:"calc(100% - ".concat(20*(e.deep||1),"px)")},children:e.name}):(0,s.jsx)(t1.O6,{check:i,val:null==e?void 0:e.name,data:t,placeholder:f.o.t("Create_newtool_s2_table_name_empty"),useBlockWrap:!0,checkSame:!0,targetKey:e[eF.Fc],dynamicWidth:!0,deep:e.deep,callback:t=>{h({record:e,key:"name",value:t,updateData:!0}),c&&(null==u||u(!1))}})},{title:()=>(0,s.jsx)(t1.vw,{name:f.o.t("Create_newtool_s2_table_des"),required:!o,toolTipText:o?f.o.t("Create_newtool_s3_table_des_tooltip"):f.o.t("Create_newtool_s2_table_des_tooltip")}),key:"desc",render:e=>r?(0,s.jsx)(v.ZT.Text,{component:"div",ellipsis:{showTooltip:{opts:{style:{wordBreak:"break-word"}}}},style:{maxWidth:"100%"},children:e.desc}):(0,s.jsx)(t1.O6,{check:i,width:"100%",placeholder:f.o.t("plugin_Parameter_des"),val:null==e?void 0:e.desc,useCheck:!1,checkAscii:!0,filterSpace:!1,max:300,isRequired:!o,callback:t=>{h({record:e,key:"desc",value:t}),c&&(null==u||u(!1))}})},{title:()=>(0,s.jsx)(t1.vw,{name:f.o.t("Create_newtool_s3_table_type"),required:!0}),key:"type",width:120,render:e=>(0,s.jsx)(t6,{record:e,disabled:r,data:t,setData:d,checkFlag:i,updateNodeWithData:h,addChildNode:g,enableFileType:p})},{title:()=>(0,s.jsx)(t1.vw,{name:f.o.t("Create_newtool_s2_table_method"),required:!0}),key:"location",width:120,render:e=>{if(void 0===e.location)return(0,s.jsx)(s.Fragment,{});var t=b.gS.array2Map(eF.pq,"value","label");return r?t[e.location]:(0,s.jsx)(v.Cj,{theme:"light",defaultValue:e.location,onChange:t=>{h({record:e,key:"location",value:t,updateData:!0,inherit:!0})},style:{width:"100%"},children:eF.pq.map(t=>(0,s.jsx)(v.Cj.Option,{value:t.value,children:t.label},(null==e?void 0:e.id)+t.label))})}},{title:f.o.t("Create_newtool_s2_table_required"),width:80,key:"default",render:e=>(0,s.jsx)(v.XZ,{style:{position:"relative",left:18},disabled:r,defaultChecked:e.is_required,onChange:t=>{t.target.checked&&!e.global_default&&h({record:e,key:"global_disable",value:!1,updateData:!0,inherit:!0}),h({record:e,key:"is_required",value:t.target.checked,updateData:!0,inherit:!0})}})},{title:f.o.t("plugin_api_list_table_action"),key:"addChild",width:107,render:e=>(0,s.jsxs)(v.T,{children:[e.type===_.rH.Object&&(0,s.jsx)(v.u,{content:f.o.t("plugin_form_add_child_tooltip"),children:(0,s.jsx)(v._3,{disabled:r,style:{marginLeft:"8px"},onClick:()=>g({record:e}),icon:(0,s.jsx)(j.h16,{}),type:"secondary"})}),(0,ea.Hn)(t,e[eF.Fc])&&(0,s.jsx)(v.u,{content:f.o.t("Delete"),children:(0,s.jsx)(v._3,{disabled:r,style:{marginLeft:"8px"},onClick:()=>m(e),icon:(0,s.jsx)(j.WDf,{}),type:"secondary"})})]})}];if(!o&&x.splice(-1,0,{title:()=>(0,s.jsx)(t1.vw,{name:f.o.t("plugin_edit_tool_default_value_config_item_default_value")}),key:"global_default",width:120,render:e=>(0,s.jsx)(t2.Z,{record:e,data:t,setData:d})},{title:(0,s.jsx)(t1.vw,{name:f.o.t("plugin_edit_tool_default_value_config_item_enable"),toolTipText:f.o.t("plugin_edit_tool_default_value_config_item_enable_tip")}),key:"global_disable",width:78,render:e=>{if(void 0===e.global_default)return(0,s.jsx)(s.Fragment,{});var t=(0,s.jsx)(v.rs,{style:{position:"relative",top:3,left:12},defaultChecked:!e.global_disable,disabled:e.is_required&&!e.global_default,onChange:t=>{h({record:e,key:"global_disable",value:!t,updateData:!0,inherit:!0})}});return e.is_required&&!e.global_default?(0,s.jsx)(v.u,{content:f.o.t("plugin_edit_tool_default_value_config_item_enable_disable_tip"),children:t}):t}}),o){var y=x.findIndex(e=>"default"===e.key);x.splice(y,1),x.splice(-1,0,{title:(0,s.jsx)(t1.vw,{name:f.o.t("plugin_edit_tool_default_value_config_item_enable"),toolTipText:f.o.t("plugin_edit_tool_output_param_enable_tip")}),key:"global_disable",width:78,render:e=>void 0===e.global_default?(0,s.jsx)(s.Fragment,{}):(0,s.jsx)(v.rs,{style:{position:"relative",top:3,left:12},defaultChecked:!e.global_disable,onChange:t=>{h({record:e,key:"global_disable",value:!t,updateData:!0,inherit:!0})}})})}return(0,t0.Z)(()=>x,e=>r?e.slice(0,o?-3:-4):e,e=>o?e.filter(e=>"location"!==e.key):e)()},t9=i("851645"),t7=e=>{var t,i,{apiInfo:o,pluginId:r,requestParams:a,responseParams:l,apiId:d,disabled:u,showSecurityCheckFailedMsg:p,setShowSecurityCheckFailedMsg:g,editVersion:m,pluginType:b,functionName:x,spaceID:w,onSuccess:k,renderEnhancedComponent:M}=e,[I,N]=(0,c.useState)(l||[]),[T,z]=(0,c.useState)(!1),[D,A]=(0,c.useState)(0),[S,E]=(0,c.useState)(!1),[C,O]=(0,c.useState)(!1),L=(0,ey.Z)(function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=e;t&&(i=(0,ea.w)(e,"global_default")),N(i)});(0,c.useEffect)(()=>{if(!(Array.isArray(l)&&0===l.length&&Array.isArray(I))||0!==I.length)L(l||[])},[u,l]);var Z=t8({data:I,flag:T,checkFlag:D,setCheckFlag:A,setFlag:z,setData:L,isResponse:!0,disabled:u,showSecurityCheckFailedMsg:p,setShowSecurityCheckFailedMsg:g,enableFileType:!0});var P=(t=(0,n._)(function*(){if(A(D+1),yield(0,ea._v)(100),!d||document.getElementsByClassName("errorClassTag").length>0)return(0,ea.$S)(".errorClassTag"),v.FN.error({content:(0,eL.u)(f.o.t("tool_new_S2_feedback_failed")),duration:3,theme:"light",showClose:!1}),!1;if(!d)return!1;try{var e={plugin_id:r,api_id:d,response_params:(0,ea.Vv)(I,!1),edit_version:m,function_name:x},t=yield y.Js.UpdateAPI(e,{__disableErrorToast:!0});return null==k||k(t),!0}catch(e){var{code:i,msg:o}=e;return Number(i)===el.B.SAFE_CHECK?null==g||g(!0):v.FN.error({content:(0,eL.u)(o)}),!1}}),function(){return t.apply(this,arguments)});var F=(i=(0,n._)(function*(){try{O(!0);var e,t=yield y.Js.DebugAPI({plugin_id:r,api_id:d,parameters:JSON.stringify({}),operation:2});(null==t?void 0:t.success)&&(null==t?void 0:t.response_params)?(L(t.response_params),v.FN.success({content:f.o.t("plugin_s3_success"),duration:3,theme:"light",showClose:!1})):v.FN.error({content:(0,eL.u)(null!==(e=null==t?void 0:t.reason)&&void 0!==e?e:f.o.t("plugin_s3_failed")),duration:3,theme:"light",showClose:!1})}catch(e){v.FN.error({content:(0,eL.u)(f.o.t("plugin_s3_failed")),duration:3,theme:"light",showClose:!1}),W.kg.persist.error({message:"Custom Error: debug api failed",error:e})}O(!1)}),function(){return i.apply(this,arguments)}),B=(0,ea.lf)(I);return{submitResponseParams:P,responseParamsNode:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:eZ.Z["table-wrapper"],style:{minWidth:1008,overflowY:"auto"},children:[(0,s.jsx)(v.iA,{style:{minWidth:"calc(1008px + ".concat((B-6)*20,"px)")},pagination:!1,columns:Z,dataSource:I,rowKey:eF.Fc,childrenRecordName:eF.Il,expandAllRows:!0,className:h()(u?eZ.Z["request-params"]:eZ.Z["request-params-edit"],eZ.Z["table-style-list"]),empty:(0,s.jsx)("div",{})}),!u&&(0,s.jsx)("div",{className:eZ.Z["add-params-btn-wrap"],style:Array.isArray(I)&&0===I.length?{borderTop:0}:{},children:(0,s.jsx)(v.y3,{disabled:u,icon:(0,s.jsx)(j.N_R,{}),style:{marginTop:12},type:"tertiary",onClick:()=>{A(0);var e=(0,H.Z)(I);e.push((0,ea.ub)()),L(e),z(!T),setTimeout(()=>{(0,ea.Og)(document.getElementsByClassName("semi-table-body")[0])},100)},children:f.o.t("Create_newtool_s3_table_new")})})]}),(0,s.jsx)(v.M5,{visible:S,title:f.o.t("plugin_s3_Parse"),className:eZ.Z["input-modal"],keepDOM:!1,footer:(0,s.jsx)(s.Fragment,{}),width:800,maskClosable:!1,onCancel:()=>E(!1),children:(0,s.jsx)(t9.y,{disabled:u,pluginId:r,apiId:d,requestParams:a,operation:2,btnText:f.o.t("Create_newtool_s3_button_auto"),callback:e=>{var{response_params:t,status:i,failReason:o}=e;i===el.Q.PASS&&t?((0,ea.eO)(t),L(t),v.FN.success({content:f.o.t("plugin_s3_success"),duration:3,theme:"light",showClose:!1})):v.FN.error({content:(0,eL.u)(null!=o?o:f.o.t("plugin_s3_failed")),duration:3,theme:"light",showClose:!1}),E(!1)}})})]}),extra:(0,s.jsxs)(s.Fragment,{children:[null==M?void 0:M({disabled:!(null==I?void 0:I.length)||u,src:"response",originParams:I,apiInfo:o,onSetParams:e=>L(e),spaceID:w,pluginId:r}),(0,s.jsx)(G.zx,{disabled:u||b===_.zV.LOCAL,className:"!mr-2",color:"primary",loading:C,onClick:e=>{e.stopPropagation(),Array.isArray(a)&&a.length>0?E(!0):F()},children:C?f.o.t("plugin_s3_Parsing"):f.o.t("Create_newtool_s3_button_auto")})]})}},ie=e=>{var t,{apiInfo:i,plugin_id:o,tool_id:r,editVersion:d,pluginInfo:u,canEdit:p,handleInit:g,wrapWithCheckLock:m,debugApiInfo:h,setDebugApiInfo:b,spaceID:v,onSuccess:x,renderParamsComponent:y}=e,[w,k]=(0,c.useState)(!1),[M,I]=(0,c.useState)(!0),{responseParamsNode:N,submitResponseParams:T,extra:z}=t7({apiInfo:i,pluginId:o||"",responseParams:null==i?void 0:i.response_params,requestParams:null==i?void 0:i.request_params,apiId:r||"",disabled:M,showSecurityCheckFailedMsg:w,setShowSecurityCheckFailedMsg:k,editVersion:d,pluginType:null==u?void 0:u.plugin_type,functionName:(null==u?void 0:u.plugin_type)===_.zV.LOCAL?null==i?void 0:i.function_name:void 0,spaceID:v,onSuccess:x,renderEnhancedComponent:y});return(0,c.useEffect)(()=>{!M&&b((0,l._)((0,a._)({},h),{debug_example:{},debug_example_status:_.ji.Disable}))},[M]),{isResponseParamsDisabled:M,header:f.o.t("Create_newtool_s3_Outputparameters"),itemKey:"response",extra:(0,s.jsxs)(s.Fragment,{children:[w?(0,s.jsx)(eY,{step:eF.TS}):null,!M&&p?(0,s.jsx)(eI,{}):null,M?null:z,M?null:(0,s.jsx)(G.zx,{onClick:e=>{e.stopPropagation(),I(!0)},color:"primary",className:"mr-2",children:f.o.t("project_plugin_setup_metadata_cancel")}),p&&!M?(0,s.jsx)(G.zx,{onClick:(t=(0,n._)(function*(e){e.stopPropagation(),(yield T())&&(g(),I(!0))}),function(e){return t.apply(this,arguments)}),className:"mr-2",children:f.o.t("project_plugin_setup_metadata_save")}):null,p&&M?(0,s.jsx)(G.zx,{icon:(0,s.jsx)(j.yl5,{className:"!pr-0"}),color:"primary",className:"!bg-transparent !coz-fg-secondary",onClick:e=>{var t,i=document.querySelector(".plugin-tool-detail-response .semi-collapsible-wrapper");0!==parseInt(null==i?void 0:null===(t=i.style)||void 0===t?void 0:t.height)&&e.stopPropagation(),m(()=>{I(!1)})()},children:f.o.t("project_plugin_setup_metadata_edit")}):null]}),content:N,classNameWrap:"plugin-tool-detail-response"}},it=e=>{var t,{apiInfo:i,pluginId:o,apiId:r,requestParams:a,disabled:l,showSecurityCheckFailedMsg:d,setShowSecurityCheckFailedMsg:u,editVersion:p,functionName:g,spaceID:m,onSuccess:b,renderEnhancedComponent:x}=e,[_,w]=(0,c.useState)(a||[]),k=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=e;t&&(i=(0,ea.w)(e,"global_default")),w(i)},[M,I]=(0,c.useState)(!1),[N,T]=(0,c.useState)(0),z=t8({data:_,flag:M,checkFlag:N,setCheckFlag:T,setFlag:I,setData:k,disabled:l,showSecurityCheckFailedMsg:d,setShowSecurityCheckFailedMsg:u,enableFileType:!0});(0,c.useEffect)(()=>{if(!(Array.isArray(a)&&0===a.length&&Array.isArray(_))||0!==_.length)k(a||[])},[l,a]);var D=(t=(0,n._)(function*(){T(N+1);if(yield(0,ea._v)(100),!r||document.getElementsByClassName("errorClassTag").length>0)return(0,ea.$S)(".errorClassTag"),v.FN.error({content:f.o.t("tool_new_S2_feedback_failed"),duration:3,theme:"light",showClose:!1}),!1;try{var e=yield y.Js.UpdateAPI({plugin_id:o,api_id:r,request_params:_,edit_version:p,function_name:g},{__disableErrorToast:!0});return null==b||b(e),!0}catch(e){var{code:t,msg:i}=e;return Number(t)===el.B.SAFE_CHECK?null==u||u(!0):v.FN.error({content:(0,eL.u)(i)}),!1}}),function(){return t.apply(this,arguments)}),A=(0,ea.lf)(_);return{submitRequestParams:D,requestParamsNode:(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:eZ.Z["table-wrapper"],style:{minWidth:1008,overflowY:"auto"},children:[(0,s.jsx)(v.iA,{style:{minWidth:"calc(1008px + ".concat((A-4)*(A<13?19:40),"px)")},pagination:!1,columns:z,dataSource:_,rowKey:eF.Fc,childrenRecordName:eF.Il,expandAllRows:!0,className:h()(l?eZ.Z["request-params"]:eZ.Z["request-params-edit"],eZ.Z["table-style-list"]),empty:(0,s.jsx)("div",{})}),!l&&(0,s.jsx)("div",{style:Array.isArray(_)&&0===_.length?{borderTop:0}:{},className:eZ.Z["add-params-btn-wrap"],children:(0,s.jsx)(v.y3,{disabled:l,icon:(0,s.jsx)(j.N_R,{}),style:{marginTop:12},type:"tertiary",onClick:()=>{T(0);var e=(0,H.Z)(_);e.push((0,ea.ub)()),k(e),setTimeout(()=>{(0,ea.Og)(document.getElementsByClassName("semi-table-body")[0])},100)},children:f.o.t("Create_newtool_s3_table_new")})})]})}),nlTool:null==x?void 0:x({disabled:!(null==_?void 0:_.length)||l,src:"request",originParams:_,apiInfo:i,onSetParams:e=>w(e),spaceID:m,pluginId:o})}},ii=e=>{var t,{apiInfo:i,plugin_id:o,tool_id:r,pluginInfo:a,canEdit:l,handleInit:d,wrapWithCheckLock:u,editVersion:p,spaceID:g,onSuccess:m,renderParamsComponent:h}=e,[b,v]=(0,c.useState)(!1),[x,y]=(0,c.useState)(!0),{requestParamsNode:w,submitRequestParams:k,nlTool:M}=it({apiInfo:i,pluginId:o||"",requestParams:null==i?void 0:i.request_params,apiId:r,disabled:x,showSecurityCheckFailedMsg:b,setShowSecurityCheckFailedMsg:v,editVersion:p,functionName:(null==a?void 0:a.plugin_type)===_.zV.LOCAL?null==i?void 0:i.function_name:void 0,spaceID:g,onSuccess:m,renderEnhancedComponent:h});return{isRequestParamsDisabled:x,itemKey:"request",header:f.o.t("Create_newtool_s2"),extra:(0,s.jsxs)(s.Fragment,{children:[b?(0,s.jsx)(eY,{step:eF.TS}):null,x?null:M,x?null:(0,s.jsx)(G.zx,{onClick:e=>{e.stopPropagation(),y(!0)},color:"primary",className:"mr-2",children:f.o.t("project_plugin_setup_metadata_cancel")}),l&&!x?(0,s.jsx)(G.zx,{onClick:(t=(0,n._)(function*(e){e.stopPropagation(),(yield k())&&(d(),y(!0))}),function(e){return t.apply(this,arguments)}),className:"mr-2",children:f.o.t("project_plugin_setup_metadata_save")}):null,l&&x?(0,s.jsx)(G.zx,{icon:(0,s.jsx)(j.yl5,{className:"!pr-0"}),color:"primary",className:"!bg-transparent !coz-fg-secondary",onClick:e=>{var t,i=document.querySelector(".plugin-tool-detail-request .semi-collapsible-wrapper");0!==parseInt(null==i?void 0:null===(t=i.style)||void 0===t?void 0:t.height)&&e.stopPropagation(),u(()=>{y(!1)})()},children:f.o.t("project_plugin_setup_metadata_edit")}):null]}),content:w,classNameWrap:"plugin-tool-detail-request"}},io=e=>{var t,{space_id:i,plugin_id:o,tool_id:r,apiInfo:a,canEdit:l,handleInit:d,wrapWithCheckLock:u,editVersion:p,renderDescComponent:g}=e,[m,h]=(0,c.useState)(!1),[b,v]=(0,c.useState)(!0),{baseInfoNode:x,submitBaseInfo:_}=eP({pluginId:o||"",apiId:r,baseInfo:a,showModal:!1,disabled:b,showSecurityCheckFailedMsg:m,setShowSecurityCheckFailedMsg:h,editVersion:p,space_id:i,renderEnhancedComponent:g});return{isBaseInfoDisabled:b,header:f.o.t("Create_newtool_s1_title"),itemKey:"baseInfo",extra:(0,s.jsxs)(s.Fragment,{children:[m?(0,s.jsx)(eY,{step:eF.dT}):null,!b&&(0,s.jsx)(G.zx,{color:"primary",className:"mr-2",onClick:e=>{e.stopPropagation(),v(!0)},children:f.o.t("project_plugin_setup_metadata_cancel")}),l&&!b?(0,s.jsx)(G.zx,{onClick:(t=(0,n._)(function*(e){e.stopPropagation(),(yield _())&&d(),v(!0)}),function(e){return t.apply(this,arguments)}),className:"mr-2",children:f.o.t("project_plugin_setup_metadata_save")}):null,l&&b?(0,s.jsx)(G.zx,{icon:(0,s.jsx)(j.yl5,{className:"!pr-0"}),color:"primary",className:"!bg-transparent !coz-fg-secondary",onClick:e=>{var t,i=document.querySelector(".plugin-tool-detail-baseInfo .semi-collapsible-wrapper");0!==parseInt(null==i?void 0:null===(t=i.style)||void 0===t?void 0:t.height)&&e.stopPropagation(),u(()=>{v(!1)})()},children:f.o.t("project_plugin_setup_metadata_edit")}):null]}),content:x,classNameWrap:"plugin-tool-detail-baseInfo"}},ir=i("625196"),{Option:ia}=v.N5,il=e=>{var t,i,{pluginId:o,pluginMeta:r,apiId:a="",baseInfo:l={},showModal:d,disabled:u,showSecurityCheckFailedMsg:p,setShowSecurityCheckFailedMsg:g,editVersion:m,pluginType:h,onSuccess:b}=e,{url:x}=r,w=(0,c.useRef)(null);(0,c.useEffect)(()=>{var e,t;null===(t=w.current)||void 0===t||t.formApi.setValues({path:l.path,method:l.method||_.fM.GET,function_name:l.function_name,auth_mode:(null===(e=l.api_extend)||void 0===e?void 0:e.auth_mode)||_.ZZ.Required})},[l.path,d,u,r,l.method,l.function_name,null===(i=l.api_extend)||void 0===i?void 0:i.auth_mode]);var k=(t=(0,n._)(function*(){if(!(yield null===(e=w.current)||void 0===e?void 0:e.formApi.validate().then(()=>!0).catch(()=>!1))||!a)return!1;var e,t,i,r=null===(t=w.current)||void 0===t?void 0:t.formApi.getValues(),n={api_id:a,plugin_id:o,path:r.path,method:r.method,api_extend:{auth_mode:r.auth_mode},edit_version:m,function_name:r.function_name};try{return i=yield y.Js.UpdateAPI(n,{__disableErrorToast:!0}),null==b||b(i),!0}catch(e){var{code:l,msg:s}=e;return Number(l)===el.B.SAFE_CHECK?null==g||g(!0):v.FN.error({content:(0,eL.u)(s)}),!1}}),function(){return t.apply(this,arguments)}),M=()=>{p&&(null==g||g(!1))};return{submitBaseInfo:k,baseInfoNode:(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(v.l0,{showValidateIcon:!1,ref:w,disabled:u,className:eZ.Z["base-info-form"],children:()=>{var e,t,i,o;return u?(0,s.jsxs)(s.Fragment,{children:[h===_.zV.LOCAL&&(0,s.jsx)(v.l0.Slot,{label:{text:f.o.t("create_local_plugin_basic_tool_function"),required:!0},children:null!==(o=l.function_name)&&void 0!==o?o:"-"}),h===_.zV.PLUGIN&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.l0.Slot,{label:{text:f.o.t("Create_newtool_s1_url"),required:!0},children:String(x)+l.path}),(0,s.jsx)(v.l0.Slot,{label:{text:f.o.t("Create_newtool_s1_method"),required:!0,extra:(0,s.jsx)(ir.O,{data:eF.iq})},children:is[(null==l?void 0:l.method)||_.fM.GET]})]}),(null==r?void 0:null===(e=r.auth_type)||void 0===e?void 0:e.includes(_.Mv.OAuth))?(0,s.jsx)(v.l0.Slot,{label:{text:f.o.t("plugin_edit_tool_oauth_enabled_title"),required:!0,extra:(0,s.jsx)(v.u,{content:f.o.t("plugin_edit_tool_oauth_enabled_title_hover_tip"),children:(0,s.jsx)(j.aUG,{style:{color:"rgba(28, 29, 35, 0.35)"}})})},children:id[(null===(t=l.api_extend)||void 0===t?void 0:t.auth_mode)||_.ZZ.Required]}):null]}):(0,s.jsxs)(s.Fragment,{children:[h===_.zV.LOCAL&&(0,s.jsx)(v.P6,{className:eZ.Z["textarea-single-line"],field:"function_name",label:f.o.t("create_local_plugin_basic_tool_function"),placeholder:f.o.t("create_local_plugin_basic_tool_function_input_placeholder"),rows:1,trigger:["blur","change"],maxCount:30,maxLength:30,rules:[{required:!0,message:f.o.t("create_local_plugin_basic_warning_no_tool_function_entered")}],onChange:M}),h===_.zV.PLUGIN&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.K9,{field:"path",label:{text:f.o.t("Create_newtool_s1_url")},trigger:["blur","change"],addonBefore:(0,s.jsx)("div",{className:eZ.Z["plugin-url-prefix"],children:(0,s.jsx)(v.ZT.Text,{ellipsis:{showTooltip:{type:"tooltip",opts:{content:x,style:{wordBreak:"break-word"}}}},children:x})}),style:{width:"100%"},className:eZ.Z["plugin-url-input"],placeholder:f.o.t("Create_newtool_s1_url_empty"),rules:[{required:!0,message:f.o.t("Create_newtool_s1_url_error2")},{pattern:/^\//,message:f.o.t("Create_newtool_s1_url_error1")},{pattern:/^[\x00-\x7F]+$/,message:f.o.t("tool_new_S1_URL_error")}]}),(0,s.jsx)(v.N5,{field:"method",initValue:_.fM.GET,label:{text:f.o.t("Create_newtool_s1_method"),extra:(0,s.jsx)(ir.O,{data:eF.iq})},showClear:!0,trigger:["blur","change"],style:{width:"100%",borderRadius:"8px"},placeholder:f.o.t("workflow_detail_condition_pleaseselect"),rules:[{required:!0,message:f.o.t("workflow_detail_condition_pleaseselect")}],children:[_.fM.GET,_.fM.POST,_.fM.PUT,_.fM.DELETE,_.fM.PATCH].map(e=>(0,s.jsx)(ia,{value:e,children:is[e]},e))}),(null==r?void 0:null===(i=r.auth_type)||void 0===i?void 0:i.includes(_.Mv.OAuth))?(0,s.jsx)(v.N5,{field:"auth_mode",initValue:_.ZZ.Required,label:{text:f.o.t("plugin_edit_tool_oauth_enabled_title"),extra:(0,s.jsx)(v.u,{content:f.o.t("plugin_edit_tool_oauth_enabled_title_hover_tip"),children:(0,s.jsx)(j.aUG,{style:{color:"rgba(28, 29, 35, 0.35)"}})})},showClear:!0,trigger:["blur","change"],style:{width:"100%",borderRadius:"8px"},placeholder:f.o.t("workflow_detail_condition_pleaseselect"),rules:[{required:!0,message:f.o.t("workflow_detail_condition_pleaseselect")}],children:[_.ZZ.Required,_.ZZ.Supported,_.ZZ.Disable].map(e=>(0,s.jsx)(ia,{value:e,children:id[e]},e))}):null]})]})}})})}},is={[_.fM.GET]:f.o.t("Create_newtool_s1_method_get"),[_.fM.POST]:f.o.t("Create_newtool_s1_method_post"),[_.fM.PUT]:f.o.t("Create_newtool_s1_method_put"),[_.fM.DELETE]:f.o.t("Create_newtool_s1_method_delete"),[_.fM.PATCH]:f.o.t("Create_tool_s1_method_patch_name")},id={[_.ZZ.Required]:f.o.t("plugin_edit_tool_oauth_enabled_status_auth_required"),[_.ZZ.Supported]:f.o.t("plugin_edit_tool_oauth_enabled_status_auth_optional"),[_.ZZ.Disable]:f.o.t("plugin_edit_tool_oauth_enabled_status_auth_disabled")},ic=e=>{var t,{plugin_id:i,pluginInfo:o,tool_id:r,apiInfo:a,space_id:l,canEdit:d,handleInit:u,wrapWithCheckLock:p,editVersion:g,onSuccess:m}=e,[h,b]=(0,c.useState)(!1),[v,x]=(0,c.useState)(!0),{baseInfoNode:_,submitBaseInfo:y}=il({pluginId:i||"",pluginMeta:(null==o?void 0:o.meta_info)||{},apiId:r,baseInfo:a,showModal:!1,disabled:v,showSecurityCheckFailedMsg:h,setShowSecurityCheckFailedMsg:b,editVersion:g,pluginType:null==o?void 0:o.plugin_type,spaceId:l,onSuccess:m});return{isBaseMoreDisabled:v,header:f.o.t("project_plugin_setup_metadata_more_info"),itemKey:"baseMore",extra:(0,s.jsxs)(s.Fragment,{children:[h?(0,s.jsx)(eY,{step:eF.ls}):null,!v&&(0,s.jsx)(G.zx,{color:"primary",className:"mr-2",onClick:e=>{e.stopPropagation(),x(!0)},children:f.o.t("project_plugin_setup_metadata_cancel")}),d&&!v?(0,s.jsx)(G.zx,{onClick:(t=(0,n._)(function*(e){e.stopPropagation(),(yield y())&&u(),x(!0)}),function(e){return t.apply(this,arguments)}),className:"mr-2",children:f.o.t("project_plugin_setup_metadata_save")}):null,d&&v?(0,s.jsx)(G.zx,{icon:(0,s.jsx)(j.yl5,{className:"!pr-0"}),color:"primary",className:"!bg-transparent !coz-fg-secondary",onClick:e=>{var t,i=document.querySelector(".plugin-tool-detail-baseMore .semi-collapsible-wrapper");0!==parseInt(null==i?void 0:null===(t=i.style)||void 0===t?void 0:t.height)&&e.stopPropagation(),p(()=>{x(!1)})()},children:f.o.t("project_plugin_setup_metadata_edit")}):null]}),content:_,classNameWrap:"plugin-tool-detail-baseMore"}};let iu=(0,eb.A)(function(e){return c.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),c.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.28 4.24a1.5 1.5 0 0 1 0 2.12l-5.66 5.66 5.66 5.65a1.5 1.5 0 1 1-2.12 2.13l-6.72-6.72a1.5 1.5 0 0 1 0-2.12l6.72-6.72a1.5 1.5 0 0 1 2.12 0Z",fill:"currentColor"}))},"chevron_left");var ip=e=>{var t,i,{debugApiInfo:o,canEdit:r,plugin_id:n,tool_id:a,unlockPlugin:l,editVersion:d,pluginInfo:u,onDebugSuccessCallback:p}=e,g=(0,k.av)(),[m,h]=(0,c.useState)(),[b,v]=(0,c.useState)(!1),[x]=(0,c.useState)(!1),{debugFooterNode:_,setDebugExample:y,debugExample:w}=eg({apiInfo:o,loading:x,dugStatus:m,btnLoading:!1,nextStep:()=>{var e;null===(e=g.toResource)||void 0===e||e.call(g,"plugin",n),l()},editVersion:d});return{itemKey:"tool_debug",header:f.o.t("Create_newtool_s4_debug"),extra:(0,s.jsx)(s.Fragment,{children:r?_:null}),content:o&&a?(0,s.jsx)(es.Debug,{pluginType:null==u?void 0:u.plugin_type,disabled:!1,setDebugStatus:h,pluginId:String(n),apiId:String(a),apiInfo:o,pluginName:String(null==u?void 0:null===(t=u.meta_info)||void 0===t?void 0:t.name),setDebugExample:y,debugExample:w}):(0,s.jsx)(s.Fragment,{}),modalContent:(0,s.jsxs)(s.Fragment,{children:[o&&a?(0,s.jsx)(G.zx,{onClick:()=>{v(!0)},icon:(0,s.jsx)(e_.NvC,{}),color:"highlight",children:f.o.t("project_plugin_testrun")}):null,(0,s.jsx)(G.u_,{title:f.o.t("project_plugin_testrun"),width:1e3,visible:b,onOk:()=>v(!1),onCancel:()=>v(!1),closeOnEsc:!0,footer:_,children:(0,s.jsx)(es.Debug,{pluginType:null==u?void 0:u.plugin_type,disabled:!1,setDebugStatus:h,pluginId:String(n),apiId:String(a),apiInfo:o,pluginName:String(null==u?void 0:null===(i=u.meta_info)||void 0===i?void 0:i.name),setDebugExample:y,debugExample:w,onSuccessCallback:p})})]})}},ig=i("523878"),im={};im.styleTagTransform=L(),im.setAttributes=S(),im.insert=D().bind(null,"head"),im.domAPI=T(),im.insertStyleElement=C(),I()(ig.Z,im);var ih=ig.Z&&ig.Z.locals?ig.Z.locals:void 0,ib=e=>{var{space_id:t,plugin_id:i,unlockPlugin:o,tool_id:r,pluginInfo:n,updatedInfo:a,apiInfo:l,editVersion:d,canEdit:u,debugApiInfo:p,onDebugSuccessCallback:g}=e,m=(0,k.av)(),[h]=(0,x.V)(),b=(0,c.useMemo)(()=>(null==n?void 0:n.plugin_type)===_.zV.LOCAL||!(null==n?void 0:n.published)||(null==n?void 0:n.status)&&(null==a?void 0:a.created_api_names)&&!!a.created_api_names.includes((null==l?void 0:l.name)||""),[n,a,l]),{modalContent:v}=ip({debugApiInfo:p,canEdit:u,space_id:t||"",plugin_id:i||"",tool_id:r||"",unlockPlugin:o,editVersion:d,pluginInfo:n,onDebugSuccessCallback:g});return(0,s.jsx)("div",{className:ih.header,children:(0,s.jsxs)("div",{className:ih["simple-title"],children:[(0,s.jsx)(G.hU,{icon:(0,s.jsx)(iu,{style:{color:"rgba(29, 28, 35, 0.6)"}}),onClick:()=>{var e;null===(e=m.toResource)||void 0===e||e.call(m,"plugin",i),o()},size:"small",color:"secondary"}),(0,s.jsx)("span",{className:ih.title,children:f.o.t("plugin_edit_tool_title")}),(0,s.jsx)(eI,{}),h["bot.devops.plugin_mockset"]?(0,s.jsx)(G.u,{style:{display:b?"block":"none"},content:f.o.t("unreleased_plugins_tool_cannot_create_mockset"),position:"left",trigger:"hover",children:(0,s.jsx)(G.zx,{onClick:()=>{var e;null===(e=m.mocksetList)||void 0===e||e.call(m,r)},disabled:b,color:"primary",style:{marginRight:8},children:f.o.t("manage_mockset")})}):null,u?v:null]})})},iv=e=>{var t,{toolID:i,onDebugSuccessCallback:o,renderDescComponent:r,renderParamsComponent:d}=e,p=(0,W.UQ)(),[m,h]=(0,c.useState)(),[f,b]=(0,c.useState)(),[v,x]=(0,c.useState)(),[w,j]=(0,c.useState)(!0),{canEdit:M,init:I,pluginInfo:N,updatedInfo:T,wrapWithCheckLock:z,unlockPlugin:D,spaceID:A,pluginID:S,updatePluginInfoByImmer:E,version:C}=(0,k.RQ)((0,u.N)(e=>({canEdit:e.canEdit,init:e.init,pluginInfo:e.pluginInfo,updatedInfo:e.updatedInfo,wrapWithCheckLock:e.wrapWithCheckLock,unlockPlugin:e.unlockPlugin,spaceID:e.spaceID,pluginID:e.pluginId,updatePluginInfoByImmer:e.updatePluginInfoByImmer,version:e.version}))),O=e=>{E(t=>{if(!!t)t.edit_version=null==e?void 0:e.edit_version})},L=e=>{var t,i,o,r=(0,H.Z)(e.request_params);return(null==e?void 0:e.debug_example_status)===_.ji.Enable&&(null==e?void 0:null===(t=e.debug_example)||void 0===t?void 0:t.req_example)&&(0,eh.C$)(r,JSON.parse(null!==(o=null==e?void 0:null===(i=e.debug_example)||void 0===i?void 0:i.req_example)&&void 0!==o?o:"{}")),(0,ea.eO)(r),r};var Z=(t=(0,n._)(function*(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];b((0,l._)((0,a._)({},f),{debug_example_status:_.ji.Disable})),e&&j(!0);try{var{api_info:t=[],msg:o,edit_version:r}=yield y.Js.GetPluginAPIs({plugin_id:S,api_ids:[i],preview_version_ts:C});if(t.length>0){var n=t.length>0?t[0]:{};x((0,l._)((0,a._)({},n),{request_params:L(n)})),(0,ea.eO)(n.request_params),(0,ea.eO)(n.response_params),b(n),h(r)}else p(new en.sH(eo.b.responseValidation,o||"GetPluginAPIs error"))}catch(e){p(new en.sH(eo.b.PluginInitError,"plugin init error: ".concat(e.message)))}e&&j(!1)}),function(){return t.apply(this,arguments)}),{isBaseInfoDisabled:P,header:F,itemKey:B,extra:R,content:U,classNameWrap:Q}=io({space_id:A,plugin_id:S,tool_id:i,apiInfo:f,canEdit:M,handleInit:Z,wrapWithCheckLock:z,editVersion:m,renderDescComponent:r}),{isBaseMoreDisabled:Y,header:V,itemKey:q,extra:K,content:J,classNameWrap:X}=ic({plugin_id:S,pluginInfo:N,tool_id:i,apiInfo:f,canEdit:M,handleInit:Z,wrapWithCheckLock:z,editVersion:m,space_id:A,onSuccess:O}),{isRequestParamsDisabled:$,itemKey:ee,header:et,extra:ei,content:er,classNameWrap:el}=ii({apiInfo:f,plugin_id:S,tool_id:i,pluginInfo:N,canEdit:M,handleInit:Z,wrapWithCheckLock:z,editVersion:m,spaceID:A,onSuccess:O,renderParamsComponent:d}),{isResponseParamsDisabled:es,itemKey:ed,header:ec,extra:eu,content:ep,classNameWrap:eg}=ie({apiInfo:f,plugin_id:S,tool_id:i,editVersion:m,pluginInfo:N,canEdit:M,handleInit:Z,wrapWithCheckLock:z,debugApiInfo:v,setDebugApiInfo:x,spaceID:A,onSuccess:O,renderParamsComponent:d}),em=[{header:F,itemKey:B,extra:R,content:U,classNameWrap:Q},{header:V,itemKey:q,extra:K,content:J,classNameWrap:X},{header:et,itemKey:ee,extra:ei,content:er,classNameWrap:el},{header:ec,itemKey:ed,extra:eu,content:ep,classNameWrap:eg}];return(0,c.useEffect)(()=>((0,n._)(function*(){yield I(),Z(!0)})(),()=>{D()}),[]),(0,g.Z)(()=>{if(!!P&&!!$&&!!es&&!!Y)D()},[P,$,es,Y]),w?(0,s.jsx)(G.yC,{size:"large",spinning:!0,style:{height:"100%",width:"100%"}}):(0,s.jsxs)("div",{className:ih.toolWrap,children:[(0,s.jsx)(ib,{space_id:A,plugin_id:S,unlockPlugin:D,tool_id:i,pluginInfo:N,updatedInfo:T,apiInfo:f,editVersion:m||0,canEdit:M,debugApiInfo:v,onDebugSuccessCallback:o}),(0,s.jsx)(G.UO,{keepDOM:!0,defaultActiveKey:em.map(e=>e.itemKey),children:em.map((e,t)=>(0,s.jsx)(G.UO.Panel,{className:e.classNameWrap,header:e.header,itemKey:e.itemKey,extra:e.extra,children:e.content},"".concat(t,"collapse")))})]})}},770131:function(e,t,i){i.d(t,{A:()=>U});var o=i("808549"),r=i("120454"),n=i("151064"),a=i("455069"),l=i("664319"),s=i("287487"),d=i("76672"),c=i("388993"),u=i("214942"),p=i("117140"),g=i("178385"),m=i("833047"),h=i("252237"),f=i.n(h),b=i("336205"),v=i("775699"),x=i("44172"),_=i("150838"),y=e=>{var{isSearching:t,type:i,onChange:o,projectId:r,from:a,isShowStorePlugin:l=!0}=e,s=(0,u.rY)(e=>e.space.space_type),d=(0,m.ir)().id,c=e=>{if(t){o(e);return}if(e!==i)o(e)};return(0,n.jsxs)("div",{className:_.Z["tool-tag-list"],children:[s===g.Sn.Personal&&(0,n.jsxs)("div",{"data-testid":"plugin.modal.filter.option.mine",className:f()(_.Z["tool-tag-list-cell"],{[_.Z.active]:i===m.eL.Mine}),onClick:()=>c(m.eL.Mine),children:[(0,n.jsx)(x.ckl,{className:_.Z["tool-tag-list-cell-icon"]}),b.o.t("add_resource_modal_sidebar_library_tools")]}),r&&a===m.tx.ProjectWorkflow?(0,n.jsxs)("div",{className:f()(_.Z["tool-tag-list-cell"],{[_.Z.active]:i===m.eL.Project}),onClick:()=>c(m.eL.Project),children:[(0,n.jsx)(x.Qi1,{className:_.Z["tool-tag-list-cell-icon"]}),b.o.t("add_resource_modal_sidebar_project_tools")]}):null,l?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(v.yh.Divider,{}),(0,n.jsx)("div",{className:_.Z["tool-content-area"],children:(0,n.jsx)("div",{className:f()(_.Z["tool-tag-list-cell"],{[_.Z.active]:i===d}),onClick:()=>c(d),children:b.o.t("explore_tools")})})]}):null]})},w=i("881305"),k=[{label:b.o.t("Create_time"),value:g.d$.CreateTime},{label:b.o.t("Update_time"),value:g.d$.UpdateTime}],j=e=>{var{query:t,setQuery:i}=e;return(0,n.jsx)("div",{className:w.Z["plugin-modal-filter"],children:t.type===m.eL.Mine||t.type===m.eL.Team||t.type===m.eL.Project?(0,n.jsxs)(v.Cj,{label:b.o.t("Sort"),value:t.orderBy,optionList:k,onChange:e=>{i({orderBy:e})},children:[(0,n.jsx)(v.Ph.Option,{value:g.d$.CreateTime,children:b.o.t("Create_time")}),(0,n.jsx)(v.Ph.Option,{value:g.d$.UpdateTime,children:b.o.t("Edit_time_2")})]}):null})},M=i("998600"),I=i("824113"),N=i("910376"),T=i("196163"),z=e=>{var{query:t,setQuery:i,from:o,onCreateSuccess:r,isShowStorePlugin:l,hideCreateBtn:s}=e,[d,c]=(0,a.useState)(!1),p=(0,u.rY)(e=>e.space.id),g=e=>{i({search:null!=e?e:""})},{run:h,cancel:f}=(0,M.Z)(e=>{g(e)},{wait:300});return(0,n.jsxs)(n.Fragment,{children:[s?null:(0,n.jsx)(N.rm,{projectId:t.projectId,isCreate:!0,visible:d,onSuccess:e=>{null==r||r({spaceId:p,pluginId:e})},onCancel:()=>{c(!1)}}),(0,n.jsxs)(v.yh,{style:{paddingTop:16},children:[(0,n.jsxs)(v.yh.Header,{children:[(0,n.jsx)(I.yO,{tabIndex:-1,value:t.search,maxLength:100,onSearch:e=>{e?h(e):(f(),g(e))},placeholder:b.o.t("Search"),"data-testid":"plugin.modal.search"}),s?null:(0,n.jsx)(v.y3,{"data-testid":"plugin.modal.create.plugin",className:T.Z.addbtn,theme:"solid",onClick:()=>{if(r&&(o===m.tx.ProjectIde||o===m.tx.ProjectWorkflow)){c(!0);return}window.open("/space/".concat(p,"/library?type=1"))},children:b.o.t("plugin_create")})]}),(0,n.jsx)(v.yh.Content,{children:(0,n.jsx)(y,{isSearching:""!==t.search,type:t.type,onChange:e=>{i({type:e})},from:o,projectId:t.projectId,isShowStorePlugin:l})})]})]})},D=i("322512"),A=i("136515"),S=i("309673"),E=i("938382"),C=i("364676"),O=i("44099"),L=i("825955"),Z=i("298203"),P=i("366714"),F=(e,t,i,o)=>(t||i)&&!o?{text:{emptyTitle:b.o.t("plugin_empty_desc"),emptyDesc:b.o.t("plugin_empty_description")},btn:{emptyClick:()=>{window.open("/space/".concat(e,"/library?type=1"))},emptyText:b.o.t("plugin_create")}}:{text:{emptyTitle:b.o.t("plugin_empty_desc"),emptyDesc:""},btn:{emptyClick:()=>{window.open("/store/plugin")},emptyText:b.o.t("mkl_plugin_to_plugin_gallery")}},B=e=>{var{query:t,pluginApiList:i,onPluginApiListChange:s,openMode:d,from:c,openModeCallback:p,showButton:g,showCopyPlugin:h,onCopyPluginCallback:b,clickProjectPluginCallback:x}=e,{type:_,mineActive:y,search:w,isOfficial:k,orderBy:j,orderByPublic:M,orderByFavorite:I,agentId:N,pluginType:T}=t,z=(0,u.rY)(e=>e.space.id),B=(0,a.useRef)(null),[R,U]=(0,a.useState)([]),Q=(0,a.useRef)(null),{scroll2Top:Y,loadData:V,isSearching:W,isFavorite:G,isTemplate:H,isProject:q,isMine:K,isTeam:J}=function(e){var t,{scrollContainer:i,query:n,triggerService:l,formatCacheKey:s,onSetScrollData:d}=e,{search:c,type:u,mineActive:p}=n,g=""!==c,h=u===m.eL.Mine,f=u===m.eL.Team,b=u===m.eL.Favorite,v=u===m.eL.Project,x=p===m.gp.Mine,_=Number(u)>=0||"recommend"===u,y=(e,t,i)=>{var n=(0,Z.lJ)(t);if(!t||!n)return!1;var{data:a}=n;if(!i)return n.data;var l=(null==e?void 0:e.nextPage)||1,{list:s,total:c}=a||{list:[],total:0},u=c>0&&l*m.L8{if(!!e)(0,Z.K7)(e,t,{time:Date.now(),data:i})};var k=(t=(0,L._)(function*(e){var t=(null==e?void 0:e.nextPage)||1,i=s({query:n,isSearching:g,isTemplate:_,page:t})||"";!h&&!f&&(i="");var o=y(e,i,!_);!o&&w(i,3e5,o=yield l(n,{nextPage:t,isMine:h,isTeam:f,isCreatorMine:x,isTemplate:_,isFavorite:b,isProject:v}));var{list:r,hasMore:a}=o||{list:[],total:0},d=t+1,c={};return((null==e?void 0:e.list)||[]).map(e=>{var t;c[null==e?void 0:null===(t=e.pluginInfo)||void 0===t?void 0:t.id]=!0}),{list:(r||[]).filter(e=>{var t,i=null==e?void 0:null===(t=e.pluginInfo)||void 0===t?void 0:t.id;return(!i||!c[i])&&!0})||[],hasMore:a,nextPage:d}}),function(e){return t.apply(this,arguments)});return(0,a.useEffect)(()=>{(0,Z.LK)()},[]),{scroll2Top:()=>{i.current&&i.current.scrollTo({top:0})},isSearching:g,loadData:k,isFavorite:b,isTemplate:_,isMine:h,isTeam:f,isProject:v}}({query:t,formatCacheKey:m.TB,scrollContainer:B,triggerService:m.Ht,onSetScrollData:e=>{var t;null===(t=Q.current)||void 0===t||t.mutate(e)}}),{nodes:X}=(0,C.I)((0,l.N)(e=>({nodes:e.nodes})));return(0,A.Z)(()=>{Y()},[]),(0,n.jsx)(v.vy,{children:(0,n.jsx)("div",{className:P.Z["plugin-content"],ref:B,children:(0,n.jsx)(v.vy.Content,{style:{minHeight:"100%",display:"flex"},children:(0,n.jsx)(v.UO,{className:P.Z["plugin-collapse"],activeKey:R,onChange:e=>{U(e)},expandIcon:(0,n.jsx)(S.Z,{className:P.Z["collapse-icon"],"data-testid":"plugin-collapse-panel-expand"}),collapseIcon:(0,n.jsx)(E.Z,{className:P.Z["collapse-icon"],"data-testid":"plugin-collapse-panel-collapse"}),children:(0,n.jsx)(O.$r,{ref:Q,itemClassName:P.Z["item-container"],renderItem:(e,t)=>{var a,l,u,v=null==e?void 0:null===(a=e.pluginInfo)||void 0===a?void 0:a.id;return(0,n.jsx)(m.WB,{agentId:N,index:t,pluginApiList:i,onPluginApiListChange:s,onCopyPluginCallback:b,showButton:g,showCopyPlugin:h,openMode:d,from:c,workflowNodes:X,openModeCallback:p,highlightWords:[w],showCreator:!0,showMarketLink:G||H,showCreateTime:0===j||"number"==typeof _,showPublishTime:!K&&!J&&!q,activeKey:R,scrollContainerRef:B,isFromMarket:null==e?void 0:e.isFromMarket,info:(0,r._)((0,o._)({},null==e?void 0:e.pluginInfo),{id:v,listed_at:null==e?void 0:null===(l=e.productInfo)||void 0===l?void 0:l.listed_at,plugin_apis:(0,D.Z)(null==e?void 0:null===(u=e.pluginInfo)||void 0===u?void 0:u.plugin_apis,e=>e.name)}),productInfo:null==e?void 0:e.productInfo,commercialSetting:null==e?void 0:e.commercial_setting,type:String(_||""),className:f()(P.Z["plugin-collapse"],{[P.Z.activePanel]:null==R?void 0:R.includes(null!=v?v:"")}),showProjectPluginLink:q,clickProjectPluginCallback:x},v)},emptyConf:F(z,K,J,q),scrollConf:{reloadDeps:[_,y,w,k,j,M,I,T],targetRef:B,loadData:V},isSearching:W})})})})})},R=(e,t)=>e!==m.tx.ProjectWorkflow&&e===m.tx.ProjectIde&&t&&e?t===g.Sn.Personal?m.eL.Mine:t===g.Sn.Team&&e===m.tx.ProjectIde?m.eL.Team:"":"",U=e=>{var t,i,{pluginApiList:h,onPluginApiListChange:f,agentId:b,openMode:v,from:x,openModeCallback:_,showButton:y,showCopyPlugin:w,onCopyPluginCallback:k,projectId:M,clickProjectPluginCallback:I,onCreateSuccess:N,isShowStorePlugin:T,hideCreateBtn:D,initQuery:A}=e,S=s.Z.useUserInfo(),E=(0,u.rY)(e=>e.space.space_type),[C,O]=(0,a.useState)({agentId:b,projectId:M,devId:(null==S?void 0:S.user_id_str)||"",search:"",page:m.XJ,type:null!==(t=null==A?void 0:A.type)&&void 0!==t?t:R(x,E),orderBy:g.d$.CreateTime,orderByPublic:p.ER.Heat,orderByFavorite:p.ER.Newest,mineActive:m.gp.All,isOfficial:null!==(i=null==A?void 0:A.isOfficial)&&void 0!==i?i:void 0,pluginType:x===m.tx.ProjectWorkflow?p.zV.CLoudPlugin:void 0}),{botId:L}=(0,c.G)((0,l.N)(e=>({botId:e.botId}))),{version:Z}=(0,d.c2)((0,l.N)(e=>({version:e.baseVersion}))),P=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i={current_entity_type:p._J.Bot,current_entity_id:L,current_entity_version:Z};O(n=>t?(0,r._)((0,o._)({},n,e),{page:m.XJ,botInfo:i}):(0,r._)((0,o._)({},n,e),{botInfo:i}))},F=(0,n.jsx)(z,{hideCreateBtn:D,query:C,setQuery:P,from:x,onCreateSuccess:N,isShowStorePlugin:T}),U=(0,n.jsx)(j,{from:x,query:C,setQuery:P});return{sider:F,content:(0,n.jsx)(B,{query:C,setQuery:P,pluginApiList:h,onPluginApiListChange:f,openMode:v,from:x,openModeCallback:_,showButton:y,showCopyPlugin:w,onCopyPluginCallback:k,clickProjectPluginCallback:I}),filter:U}}},910376:function(e,t,i){i.d(t,{Tj:()=>ei,cC:()=>en,e2:()=>er,rm:()=>X,_u:()=>eo});var o,r,n=i("825955"),a=i("151064"),l=i("455069"),s=i("808549"),d=i("120454"),c=i("735114"),u=i("215451"),p=i("581259"),g=i("368696"),m=i("75117"),h=i("297158"),f=i("336205"),b=i("873183"),v=i("659596"),x=i("298203"),_=i("189284"),y=i("178385"),w=i("382534"),k=i("625196"),j=i("458949"),M={name:[{required:!0,message:f.o.t("create_plugin_modal_name1_error")},{pattern:RegExp("^[\\w\\s\\u4e00-\\u9fa5]+$","u"),message:f.o.t("create_plugin_modal_nameerror_cn")}],desc:[{required:!0,message:f.o.t("create_plugin_modal_descrip1_error")},{}],url:[{required:!0,message:f.o.t("create_plugin_modal_url1_error")}],key:[{required:!0,message:f.o.t("create_plugin_modal_Parameter_error")},{pattern:/^[\x00-\x7F]+$/,message:f.o.t("plugin_Parametename_error")}],service_token:[{required:!0,message:f.o.t("create_plugin_modal_Servicetoken_error")}]},I=e=>{var t,i;if(!!e)return[{url:(null===(t=e.icon)||void 0===t?void 0:t.url)||"",uid:(null==e?void 0:null===(i=e.icon)||void 0===i?void 0:i.uri)||""}]},N=(e,t,i)=>{if((null==t?void 0:t[0])===0)return e.find(e=>0===e.value);if((null==t?void 0:t[0])===1){var o=e.find(e=>1===e.value);return null==o?void 0:o.children.find(e=>e.value===i)}if((null==t?void 0:t[0])===3){var r=e.find(e=>3===e.value);return null==r?void 0:r.children.find(e=>e.value===i)}},T=()=>{var e,[t,i]=(0,l.useState)([]),[o,r]=(0,l.useState)([]),[a,s]=(0,l.useState)("1");var d=(e=(0,n._)(function*(){var e,t,o=yield w.Js.GetOAuthSchema();i([{label:f.o.t("create_plugin_modal_Authorization_no"),value:0,key:"None"},{label:f.o.t("create_plugin_modal_Authorization_service"),value:1,key:"Service",children:[{label:f.o.t("plugin_auth_method_service_api_key"),value:0,key:"Service Token / API Key"}]},{label:f.o.t("create_plugin_modal_Authorization_oauth"),value:3,key:"OAuth",children:(0,x.dj)(o.oauth_schema)}]);var n=null===(t=(0,x.dj)(o.ide_conf,[]))||void 0===t?void 0:null===(e=t.find)||void 0===e?void 0:e.call(t,e=>"code_runtime_enum"===e.key);n&&(r(n.options.map(e=>({value:e.value,label:e.name}))),s(n.default))}),function(){return e.apply(this,arguments)});return(0,l.useEffect)(()=>{d()},[]),{authOption:t,runtimeOptions:o,defaultRuntime:a}},z=e=>{var t,i,o,r,n,{val:a,spaceId:l,headerList:c,projectId:u,creationMethod:p,defaultRuntime:g,pluginType:m,extItemsJSON:h}=e,f=null===(t=a.auth_type)||void 0===t?void 0:t.at(0),b=null===(i=a.auth_type)||void 0===i?void 0:i.at(-1),v=(0,d._)((0,s._)({},a),{icon:{uri:null==a?void 0:null===(r=a.plugin_uri)||void 0===r?void 0:null===(o=r[0])||void 0===o?void 0:o.uid},auth_type:f,common_params:{[j.Pi.Header]:c,[j.Pi.Body]:[],[j.Pi.Path]:[],[j.Pi.Query]:[]},space_id:l,project_id:u,creation_method:p,ide_code_runtime:null!==(n=a.ide_code_runtime)&&void 0!==n?n:g,plugin_type:Number(m),private_link_id:"0"===a.private_link_id?void 0:a.private_link_id});return 1===f?(0,d._)((0,s._)({},v),{sub_auth_type:b,auth_payload:JSON.stringify(h)}):(0,d._)((0,s._)({},v),{sub_auth_type:3===f?b:void 0,oauth_info:JSON.stringify(h)})};var D=(o=(0,n._)(function*(e){var{params:t}=e;return(yield w.Js.RegisterPluginMeta((0,s._)({},t),{__disableErrorToast:!0})).plugin_id}),function(e){return o.apply(this,arguments)});var A=(r=(0,n._)(function*(e){var{params:t,editInfo:i}=e;return yield w.Js.UpdatePluginMeta((0,d._)((0,s._)({},t),{plugin_id:(null==i?void 0:i.plugin_id)||"",edit_version:null==i?void 0:i.edit_version}),{__disableErrorToast:!0}),""}),function(e){return r.apply(this,arguments)}),S=i("274038"),E=e=>e?"".concat(null==e?void 0:e.plugin_type,"-").concat(null==e?void 0:e.creation_method):"",C=(0,v.Q2)(v.vT),O=()=>[{label:f.o.t("plugin_creation_method_cloud_plugin_use_existing_services"),value:p.Qb}],L=e=>{var t,i,o,r,j,T,z,D,A,L,Z,P,F,B,R,U,Q,Y,V,{pluginState:W,disabled:G,editInfo:H,isCreate:q,visible:K}=e,{formApi:J,extItems:X,setExtItems:$,headerList:ee,setHeaderList:et,isValidCheckResult:ei,setIsValidCheckResult:eo,pluginTypeCreationMethod:er,setPluginTypeCreationMethod:en,authOption:ea}=W,[el]=(0,_.V)(),{compareLevel:es}=(0,u.th)(),ed=(0,g.HU)(),[ec,eu]=(0,l.useState)(0),[ep,eg]=(0,l.useState)(0),[em,eh]=(0,l.useState)(!1),ef=()=>{!ei&&eo(!0)},eb=O(),ev=(0,p.C5)(),[ex,e_]=(0,l.useState)(),{data:ey}=(0,c.Z)((0,n._)(function*(){var e,{data:t}=yield w.Js.PrivateLinkList({enterprise_id:null==ed?void 0:ed.enterprise_id});e_(null==t?void 0:t.private_links);var i=null==t?void 0:null===(e=t.private_links)||void 0===e?void 0:e.map(e=>({label:e.name,value:e.id}));return[{label:f.o.t("vpc_plugin_create_plugin_2"),value:"0"},...null!=i?i:[]]}),{ready:es===u.aZ.Enterprise&&el["bot.studio.plugin_vpc"]&&!1});var ew=(t=(0,n._)(function*(){try{var e,t,i,o=yield w.nA.GetIcon({icon_type:y.Tu.Plugin}),r=null===(t=o.data)||void 0===t?void 0:null===(e=t.icon_list)||void 0===e?void 0:e[0];if(!r)return;var{url:n="",uri:a=""}=r;null===(i=J.current)||void 0===i||i.setValue("plugin_uri",[{url:n,uid:a}])}catch(e){h.kg.info("getIcon error: ".concat(e))}}),function(){return t.apply(this,arguments)});(0,l.useEffect)(()=>{if(!!K)if(!q&&H){var e,t,i,o,r,n,a,l,s,d,c,p,g,m,h,f,b,v;if((null===(t=H.meta_info)||void 0===t?void 0:null===(e=t.auth_type)||void 0===e?void 0:e.at(0))===1)switch(null===(g=H.meta_info)||void 0===g?void 0:g.sub_auth_type){case 0:eg(5);break;case 1:eg(6);break;case 2:eg(7);break;default:eg(0)}else eg(null!==(f=null===(h=H.meta_info)||void 0===h?void 0:null===(m=h.auth_type)||void 0===m?void 0:m.at(-1))&&void 0!==f?f:0);eu(null!==(b=null===(o=H.meta_info)||void 0===o?void 0:null===(i=o.auth_type)||void 0===i?void 0:i.at(0))&&void 0!==b?b:0),$((null===(r=N(ea,null===(n=H.meta_info)||void 0===n?void 0:n.auth_type,null!==(v=null===(l=H.meta_info)||void 0===l?void 0:null===(a=l.auth_type)||void 0===a?void 0:a[1])&&void 0!==v?v:null===(s=H.meta_info)||void 0===s?void 0:s.sub_auth_type))||void 0===r?void 0:r.items)||[]),et([...(null===(c=H.meta_info)||void 0===c?void 0:null===(d=c.common_params)||void 0===d?void 0:d[4])||[]]),en("".concat(H.plugin_type,"-").concat(H.creation_method)),(null==H?void 0:null===(p=H.meta_info)||void 0===p?void 0:p.private_link_id)&&es===u.aZ.Enterprise&&el["bot.studio.plugin_vpc"]&&eh(!0)}else ek()},[K]);var ek=()=>{ew(),eg(0),eg(0),$([]),et([{name:"User-Agent",value:"Coze/1.0"}]),eo(!0),en(void 0)},ej=()=>{et(e=>[...e,{name:"",value:""}])},eM=e=>{et(t=>t.length<=1?[{name:"",value:""}]:t.filter((t,i)=>i!==e))},eI=(e,t)=>{et(i=>i.map((i,o)=>o===e?t:i))};return(0,a.jsxs)(v.l0,{getFormApi:e=>J.current=e,autoScrollToError:!0,showValidateIcon:!1,className:S.Z["upload-form"],onValueChange:e=>{if("auth_type"in e){if(1===e.auth_type.at(0))switch(e.auth_type.at(-1)){case 0:eg(5);break;case 1:eg(6);break;case 2:eg(7);break;default:eg(0)}else eg(e.auth_type.at(-1));eu(e.auth_type.at(0))}},children:[(0,a.jsx)(m.s,{noLabel:!0,disabled:G,fieldClassName:S.Z["upload-field"],field:"plugin_uri",iconType:y.Tu.Plugin,fileBizType:y.ym.BIZ_PLUGIN_ICON,initValue:I(null==H?void 0:H.meta_info),onChange:ef}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.ld,{disabled:G,initValue:null==H?void 0:null===(Q=H.meta_info)||void 0===Q?void 0:Q.name,field:"name",className:S.Z["textarea-single-line"],label:f.o.t("create_plugin_modal_name1"),placeholder:f.o.t("create_plugin_modal_name2"),trigger:["blur","change"],maxCount:30,maxLength:30,rows:1,onBlur:()=>{var e,t,i;null===(i=J.current)||void 0===i||i.setValue("name",null===(t=J.current)||void 0===t?void 0:null===(e=t.getValue("name"))||void 0===e?void 0:e.trim())},onChange:ef,rules:M.name}),(0,a.jsx)(v.ld,{disabled:G,initValue:null==H?void 0:null===(Y=H.meta_info)||void 0===Y?void 0:Y.desc,field:"desc",label:f.o.t("create_plugin_modal_descrip1"),trigger:["blur","change"],placeholder:f.o.t("create_plugin_modal_descrip2"),rows:2,maxCount:600,maxLength:600,onBlur:()=>{var e,t,i;null===(i=J.current)||void 0===i||i.setValue("desc",null===(t=J.current)||void 0===t?void 0:null===(e=t.getValue("desc"))||void 0===e?void 0:e.trim())},onChange:ef,rules:M.desc}),(0,a.jsx)(v.l0.Slot,{label:{text:f.o.t("plugin_creation_method"),required:!0,extra:(0,a.jsx)(k.O,{data:ev})},children:q?(0,a.jsx)(v.l0.RadioGroup,{noLabel:!0,className:S.Z["creation-method"],direction:"vertical",rules:[{required:!0,message:f.o.t("plugin_creation_select_creation_method_warning")}],field:"creation_method",disabled:G,options:eb,initValue:H?E(H):void 0,onChange:e=>en(e.target.value)}):(0,a.jsx)(v.ZT.Text,{fontSize:"14px",children:null===(V=eb.find(e=>e.value===er))||void 0===V?void 0:V.label})})]}),er===p.Qb?(U=[0],!H&&(U=[0]),(null==H?void 0:null===(o=H.meta_info)||void 0===o?void 0:null===(i=o.auth_type)||void 0===i?void 0:i.length)===2?U=null==H?void 0:null===(A=H.meta_info)||void 0===A?void 0:A.auth_type:(null==H?void 0:null===(Z=H.meta_info)||void 0===Z?void 0:null===(L=Z.auth_type)||void 0===L?void 0:L.at(0))===0?U=null==H?void 0:null===(P=H.meta_info)||void 0===P?void 0:P.auth_type:void 0!==(null==H?void 0:null===(F=H.meta_info)||void 0===F?void 0:F.sub_auth_type)&&(U=[...(null==H?void 0:null===(B=H.meta_info)||void 0===B?void 0:B.auth_type)||[],null==H?void 0:null===(R=H.meta_info)||void 0===R?void 0:R.sub_auth_type]),(0,a.jsxs)(a.Fragment,{children:[es===u.aZ.Enterprise&&el["bot.studio.plugin_vpc"]?(0,a.jsx)(v.ih,{label:{text:f.o.t("vpc_plugin_create_plugin_1"),required:!0,extra:(0,a.jsx)(k.O,{data:p.HW.private_link_id})},field:"private_link_id",style:{width:"100%"},initValue:(null==H?void 0:null===(r=H.meta_info)||void 0===r?void 0:r.private_link_id)||"0",onChange:e=>{var t,i,o;eh("0"!==e),"0"===e?null===(t=J.current)||void 0===t||t.setValue("url",""):null===(o=J.current)||void 0===o||o.setValue("url",null==ex?void 0:null===(i=ex.find(t=>t.id===e))||void 0===i?void 0:i.plugin_access_url)},optionList:ey}):null,G?null:(0,a.jsx)(v.yt,{disabled:em,className:S.Z["textarea-single-line"],initValue:null==H?void 0:null===(j=H.meta_info)||void 0===j?void 0:j.url,trigger:["blur","change"],field:"url",label:f.o.t("create_plugin_modal_url1"),placeholder:f.o.t("create_plugin_modal_url2"),onBlur:()=>{var e,t,i;null===(i=J.current)||void 0===i||i.setValue("url",null===(t=J.current)||void 0===t?void 0:null===(e=t.getValue("url"))||void 0===e?void 0:e.trim())},rules:em?[]:M.url}),(0,a.jsx)(v.l0.Slot,{className:S.Z["header-list"],label:{text:f.o.t("plugin_create_header_list_title"),align:"right",extra:(0,a.jsxs)("div",{className:S.Z["header-list-extra"],children:[(0,a.jsx)(k.O,{data:p.HW.header_list}),ee.length<20&&!G&&(0,a.jsx)(v.hU,{size:"small",color:"secondary",icon:(0,a.jsx)(b.PwN,{className:"coz-fg-hglt text-[16px]"}),onClick:ej})]})},children:(0,a.jsxs)("div",{className:S.Z["header-list-box"],children:[(0,a.jsxs)(v.X2,{className:S.Z["header-row"],children:[(0,a.jsx)(v.JX,{span:9,children:(0,a.jsx)("div",{className:S.Z["header-col-content"],children:"Key"})}),(0,a.jsx)(v.JX,{span:12,children:(0,a.jsx)("div",{className:S.Z["header-col-content"],children:"Value"})}),(0,a.jsx)(v.JX,{span:3,children:(0,a.jsx)("div",{className:S.Z["header-col-content"],children:f.o.t("plugin_create_action_btn")})})]}),(0,a.jsx)("div",{children:null==ee?void 0:ee.map((e,t)=>(0,a.jsxs)(v.X2,{type:"flex",justify:"space-between",align:"middle",children:[(0,a.jsx)(v.JX,{span:9,children:(0,a.jsx)("div",{className:S.Z["col-content"],children:(0,a.jsx)(v.II,{placeholder:"Name",value:e.name,onChange:i=>{eI(t,(0,d._)((0,s._)({},e),{name:i}))},maxLength:100,disabled:G})})}),(0,a.jsx)(v.JX,{span:12,children:(0,a.jsx)("div",{className:S.Z["col-content"],children:(0,a.jsx)(v.II,{placeholder:"Value",value:e.value,onChange:i=>{eI(t,(0,d._)((0,s._)({},e),{value:i}))},maxLength:2e3,disabled:G})})}),(0,a.jsx)(v.JX,{span:3,children:(0,a.jsx)("div",{className:S.Z["col-content"],children:(0,a.jsx)(v.hU,{size:"small",color:"secondary",icon:(0,a.jsx)(b.dVD,{className:"coz-fg-secondary text-[14px]"}),disabled:G,onClick:()=>eM(t)})})})]},t))})]})}),(0,a.jsx)(C,{disabled:G,rules:[{required:!0}],style:{width:"100%"},initValue:U,field:"auth_type",label:{text:f.o.t("create_plugin_modal_auth1"),extra:(0,a.jsx)(k.O,{data:p.HW.auth})},placeholder:f.o.t("please_select_an_authorization_method"),treeData:ea,displayRender:e=>"".concat(e.at(-1)),onChange:e=>{var t;$((null===(t=N(ea,[e.at(0)],e.at(-1)))||void 0===t?void 0:t.items)||[])}}),1===ec&&5===ep&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.l0.RadioGroup,{disabled:G,rules:[{required:!0}],field:"location",label:{text:f.o.t("create_plugin_modal_location"),extra:(0,a.jsx)(k.O,{data:p.HW.location})},options:p.cg,initValue:(null==H?void 0:null===(T=H.meta_info)||void 0===T?void 0:T.location)||1}),(0,a.jsx)(v.yt,{disabled:G,initValue:null==H?void 0:null===(z=H.meta_info)||void 0===z?void 0:z.key,trigger:["blur","change"],field:"key",label:{text:f.o.t("create_plugin_modal_Parameter"),extra:(0,a.jsx)(k.O,{data:p.HW.key})},placeholder:f.o.t("create_plugin_modal_Parameter_empty"),maxLength:100,rules:M.key}),(0,a.jsx)(v.yt,{disabled:G,initValue:null==H?void 0:null===(D=H.meta_info)||void 0===D?void 0:D.service_token,trigger:["blur","change"],field:"service_token",label:{text:f.o.t("create_plugin_modal_Servicetoken"),extra:(0,a.jsx)(k.O,{data:p.HW.service_token})},placeholder:f.o.t("create_plugin_modal_Servicetoken_empty"),maxLength:2e3,rules:M.service_token})]}),null==X?void 0:X.map((e,t)=>{var i,o,r,n,s={};return((null==H?void 0:null===(o=H.meta_info)||void 0===o?void 0:null===(i=o.auth_type)||void 0===i?void 0:i.at(0))===1&&(s=(0,x.dj)(H.meta_info.auth_payload)),(null==H?void 0:null===(n=H.meta_info)||void 0===n?void 0:null===(r=n.auth_type)||void 0===r?void 0:r.at(0))===3&&(s=(0,x.dj)(H.meta_info.oauth_info)),"select"===e.type)?(0,a.jsx)(v.ih,{disabled:G,label:(null==e?void 0:e.label)||e.key,field:e.key,optionList:p.Cx,initValue:(null==s?void 0:s[e.key])||e.default,style:{width:"100%"},rules:[{required:e.required,message:p.VF[e.key]}]},e.key+t):(0,a.jsx)(l.Fragment,{children:(0,a.jsx)(v.yt,{disabled:G,trigger:["blur","change"],field:e.key,label:{text:(null==e?void 0:e.label)||e.key,extra:p.HW[e.key]&&(0,a.jsx)(k.O,{data:p.HW[e.key]})},placeholder:p.VF[e.key],initValue:(null==s?void 0:s[e.key])||e.default,maxLength:e.max_len,rules:[{required:e.required,message:p.VF[e.key]},"url"===e.type?{pattern:/^(http|https):\/\/.+$/,message:f.o.t("create_plugin_modal_URLerror")}:{pattern:/^[\x00-\x7F]+$/,message:f.o.t("create_plugin_modal_descrip_error")},...(null==e?void 0:e.ruleList)||[]]},e.key)},e.key+t)})]})):null]})},Z=()=>{var e=(0,l.useRef)(),{authOption:t,runtimeOptions:i,defaultRuntime:o}=T(),[r,n]=(0,l.useState)([]),[a,s]=(0,l.useState)([{name:"User-Agent",value:"Coze/1.0"}]),[d,c]=(0,l.useState)(!0),[u,p]=(0,l.useState)();return{formApi:e,extItems:r,setExtItems:n,headerList:a,setHeaderList:s,isValidCheckResult:d,setIsValidCheckResult:c,pluginTypeCreationMethod:u,setPluginTypeCreationMethod:p,authOption:t,runtimeOptions:i,defaultRuntime:o}},P=i("947578"),F=i("214942"),B=i("900021"),R=i("927070"),U=i("3779"),Q=i("786406"),Y=e=>{var{onCancel:t,onSuccess:i,projectId:o}=e,[r,n]=(0,l.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Q.iy,{projectId:o,visible:r,onSuccess:e=>{var t=null==e?void 0:e.plugin_id;t?null==i||i(t):null==i||i()},onCancel:()=>n(!1)}),(0,a.jsx)(v.zx,{color:"primary",onClick:()=>{n(!0),null==t||t()},children:f.o.t("import")})]})},V=i("44172"),W=i("252237"),G=i.n(W),H=i("775699"),q=i("512421"),K=e=>{var t,{isCreate:i=!0,onCancel:o,editInfo:r,visible:c,onSuccess:u,disabled:p=!1,actions:g,projectId:m}=e,[h,b]=(0,l.useState)(),[v,_]=(0,l.useState)(),[y,k]=(0,l.useState)(),[j,M]=(0,l.useState)(),[I,N]=(0,l.useState)();(0,l.useEffect)(()=>{if(c){var e,t,i,o,n;b(JSON.stringify((0,x.dj)(null==r?void 0:null===(e=r.code_info)||void 0===e?void 0:e.plugin_desc),null,2)||""),N((null==r?void 0:null===(t=r.code_info)||void 0===t?void 0:t.openapi_desc)||""),_(null==r?void 0:null===(i=r.code_info)||void 0===i?void 0:i.client_id),k(null==r?void 0:null===(o=r.code_info)||void 0===o?void 0:o.client_secret),M(null==r?void 0:null===(n=r.code_info)||void 0===n?void 0:n.service_token)}},[c]);var T=(t=(0,n._)(function*(){var e,t,n={ai_plugin:h,client_id:v,client_secret:y,service_token:j,openapi:I};i?t=yield w.Js.RegisterPlugin((0,d._)((0,s._)({},n),{project_id:m,space_id:F.rY.getState().getSpaceId()})):yield w.Js.UpdatePlugin((0,d._)((0,s._)({},n),{plugin_id:null==r?void 0:r.plugin_id,edit_version:null==r?void 0:r.edit_version})),H.FN.success({content:i?f.o.t("register_success"):f.o.t("Plugin_update_success"),showClose:!1}),null==u||u(null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.plugin_id),null==o||o()}),function(){return t.apply(this,arguments)});return(0,a.jsx)(H.M5,{fullScreen:!0,className:"full-screen-modal",title:(0,a.jsxs)("div",{className:R.Z["bot-code-edit-title-action"],children:[(0,a.jsx)("span",{children:i?f.o.t("plugin_create"):f.o.t("plugin_Update")}),(0,a.jsx)("div",{children:g})]}),visible:c,onCancel:()=>null==o?void 0:o(),footer:p?null:(0,a.jsxs)(H.T,{children:[(0,a.jsx)(H.y3,{type:"tertiary",onClick:()=>null==o?void 0:o(),children:f.o.t("Cancel")}),(0,a.jsx)(H.y3,{type:"primary",onClick:T,children:f.o.t("Confirm")})]}),maskClosable:!1,children:(0,a.jsx)("div",{className:G()(R.Z.flex),children:(0,a.jsx)("div",{className:G()(R.Z["plugin-height"],R.Z.flex5),children:(0,a.jsxs)("div",{style:{display:"flex"},children:[(0,a.jsxs)("div",{style:{flex:1,borderRight:"1px solid rgb(215,218,221)"},children:[(0,a.jsx)("div",{className:R.Z.title,children:f.o.t("ai_plugin_(fill_in_json)_*")}),(0,a.jsx)(q.M,{dataTestID:"create-plugin-code-editor-json",disabled:p,theme:"tomorrow",mode:"json",height:560,value:h,useValidate:!1,onChange:e=>b(e)})]}),(0,a.jsxs)("div",{style:{flex:1},children:[(0,a.jsx)("div",{className:R.Z.title,children:f.o.t("openapi_(fill_in_yaml)_*")}),(0,a.jsx)(q.M,{dataTestID:"create-plugin-code-editor-yaml",disabled:p,theme:"tomorrow",mode:"yaml",height:560,value:I,useValidate:!1,onChange:e=>N(e)})]})]})})})})},J=e=>{var{onCancel:t,onSuccess:i,projectId:o}=e,[r,n]=(0,l.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{isCreate:!0,visible:r,onSuccess:e=>{null==i||i(e)},onCancel:()=>{n(!1)},projectId:o}),(0,a.jsx)(v.zx,{"data-testid":"create-plugin-code-modal-button",color:"primary",icon:(0,a.jsx)(V.WTs,{}),onClick:()=>{n(!0),null==t||t()}})]})},X=e=>{var t,{onCancel:i,editInfo:o,isCreate:r=!0,visible:s,onSuccess:d,disabled:c=!1,projectId:u}=e,{id:p}=(0,F.rY)(e=>e.space),g=(0,l.useMemo)(()=>r?(0,a.jsxs)("div",{className:"w-full flex justify-between items-center pr-[8px]",children:[(0,a.jsx)("div",{children:f.o.t("create_plugin_modal_title1")}),(0,a.jsxs)(v.T,{children:[(0,a.jsx)(J,{onCancel:i,onSuccess:d,projectId:u}),(0,a.jsx)(Y,{onCancel:i,onSuccess:d,projectId:u}),(0,a.jsx)(v.iz,{layout:"vertical",className:"h-5"})]})]}):c?f.o.t("plugin_detail_view_modal_title"):f.o.t("plugin_detail_edit_modal_title"),[r,c]),[m,h]=(0,l.useState)(!1),x=Z(),{formApi:_,extItems:y,headerList:w,isValidCheckResult:k,setIsValidCheckResult:j,pluginTypeCreationMethod:M,defaultRuntime:I}=x;(0,l.useEffect)(()=>{if(!!r)if(s){var e,t=document.querySelector(".create-plugin-modal-content .semi-modal-body");t&&(t.scrollTop=0)}else null==_||null===(e=_.current)||void 0===e||e.reset()},[s]);var N=(t=(0,n._)(function*(){yield null===(e=_.current)||void 0===e?void 0:e.validate();var e,t,n=r?"create":"edit",a=null===(t=_.current)||void 0===t?void 0:t.getValues();if(!!a&&!!M){var l={};null==y||y.forEach(e=>{e.key in a&&(l[e.key]=a[e.key])});var[s,c]=M.split("-"),g=z({val:a,spaceId:String(p),headerList:w,projectId:u,creationMethod:Number(c),defaultRuntime:I,pluginType:Number(s),extItemsJSON:l});try{h(!0);var m=yield({create:()=>D({params:g}),edit:()=>A({params:g,editInfo:o})})[n]();v.FN.success({content:r?f.o.t("Plugin_new_toast_success"):f.o.t("Plugin_update_toast_success"),showClose:!1}),null==i||i(),null==d||d(m)}catch(e){var{code:b,msg:x}=e;Number(b)===B.B.SAFE_CHECK?j(!1):v.FN.error({content:(0,P.u)(x)})}finally{h(!1)}}}),function(){return t.apply(this,arguments)});return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(v.u_,{title:g,className:"[&_.semi-modal-header]:items-center",visible:s,keepDOM:r,onCancel:()=>null==i?void 0:i(),modalContentClass:"create-plugin-modal-content",footer:!c&&(0,a.jsxs)("div",{children:[!k&&(0,a.jsx)("div",{className:R.Z["error-msg-box"],children:(0,a.jsx)("span",{className:R.Z["error-msg"],children:f.o.t("plugin_create_modal_safe_error")})}),(0,a.jsxs)(v.ZT.Paragraph,{type:"secondary",fontSize:"12px",className:"text-start mb-[16px]",children:[(0,a.jsx)(b.DIY,{className:"coz-fg-hglt text-[14px] align-sub"}),(0,a.jsx)("span",{className:"mx-[4px]",children:f.o.t("plugin_create_draft_desc")}),(0,a.jsx)(U.v,{})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(v.zx,{color:"primary",onClick:()=>{null==i||i()},children:f.o.t("create_plugin_modal_button_cancel")}),(0,a.jsx)(v.zx,{loading:m,onClick:()=>{N()},children:f.o.t("create_plugin_modal_button_confirm")})]})]}),children:(0,a.jsx)(L,{pluginState:x,visible:s,isCreate:r,disabled:c,editInfo:o})})})},$=i("664319"),ee=i("228962"),et=i("172742"),ei=e=>{var{modalProps:t}=e,{pluginInfo:i,canEdit:o,unlockPlugin:r,wrapWithCheckLock:n}=(0,ee.RQ)((0,$.N)(e=>({pluginInfo:e.pluginInfo,canEdit:e.canEdit,unlockPlugin:e.unlockPlugin,wrapWithCheckLock:e.wrapWithCheckLock}))),[c,u]=(0,l.useState)(!1),[p,g]=(0,l.useState)(!1),m=(0,l.useMemo)(()=>o?(0,a.jsx)("div",{className:et.Z.actions,children:p?(0,a.jsx)(H.y3,{onClick:()=>{g(!1),r()},children:f.o.t("Cancel")}):(0,a.jsx)(H.y3,{theme:"solid",onClick:n(()=>g(!0)),children:f.o.t("Edit")})}):null,[p,o]);return(0,l.useEffect)(()=>{c&&g(!1)},[c]),{modal:(0,a.jsx)(K,(0,d._)((0,s._)({},t),{isCreate:!1,visible:c,onCancel:()=>{u(!1),r()},disabled:!p||!o,editInfo:i,actions:m})),setShowCodePluginModel:u}},eo=e=>{var t,{modalProps:i}=e,[o,r]=(0,l.useState)({}),[c,u]=(0,l.useState)(!1),[p,g]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),b=(null==o?void 0:o.plugin_id)||"",v=(0,l.useMemo)(()=>m?null:(0,a.jsx)("div",{className:et.Z.actions,children:p?(0,a.jsx)(H.y3,{onClick:()=>{g(!1),(0,ee.zO)(b)},children:f.o.t("Cancel")}):(0,a.jsx)(H.y3,{theme:"solid",onClick:(0,n._)(function*(){if(!(yield(0,ee.EA)(b)))g(!0)}),children:f.o.t("Edit")})}),[p,b,m]);(0,l.useEffect)(()=>{c&&g(!1)},[c]);var x=(0,a.jsx)(K,(0,d._)((0,s._)({},i),{editInfo:o,isCreate:!1,visible:c,onCancel:()=>{u(!1),!m&&(0,ee.zO)(b)},disabled:!p,actions:v}));return{modal:x,open:(0,l.useCallback)((t=(0,n._)(function*(e,t){var i,o,n,a,l,s=yield w.Js.GetPluginInfo({plugin_id:e||""});r({plugin_id:e,code_info:{plugin_desc:null===(i=s.code_info)||void 0===i?void 0:i.plugin_desc,openapi_desc:null===(o=s.code_info)||void 0===o?void 0:o.openapi_desc,client_id:null===(n=s.code_info)||void 0===n?void 0:n.client_id,client_secret:null===(a=s.code_info)||void 0===a?void 0:a.client_secret,service_token:null===(l=s.code_info)||void 0===l?void 0:l.service_token}}),h(t),u(!0)}),function(e,i){return t.apply(this,arguments)}),[])}},er=e=>{var{modalProps:t}=e,{pluginInfo:i,canEdit:o,unlockPlugin:r}=(0,ee.RQ)(e=>({pluginInfo:e.pluginInfo,canEdit:e.canEdit,unlockPlugin:e.unlockPlugin})),[n,c]=(0,l.useState)(!1);return{modal:(0,a.jsx)(X,(0,d._)((0,s._)({},t),{isCreate:!1,visible:n,editInfo:i,onCancel:()=>{r(),c(!1)},disabled:!o})),setShowFormPluginModel:c}},en=e=>{var t,i,o,{modalProps:r}=e,{pluginInfo:n,unlockPlugin:c}=(0,ee.RQ)(e=>({pluginInfo:e.pluginInfo,unlockPlugin:e.unlockPlugin})),[u,p]=(0,l.useState)(!1);return{modal:(0,a.jsx)(Q.JI,(0,d._)((0,s._)({},r),{pluginInfo:{pluginID:null==n?void 0:n.plugin_id,pluginName:null==n?void 0:null===(t=n.meta_info)||void 0===t?void 0:t.name,pluginUrl:null==n?void 0:null===(i=n.meta_info)||void 0===i?void 0:i.url,pluginDesc:null==n?void 0:null===(o=n.meta_info)||void 0===o?void 0:o.desc,editVersion:null==n?void 0:n.edit_version},visible:u,onCancel:()=>{c(),p(!1)}})),setShowImportToolModal:p}}},512421:function(e,t,i){i.d(t,{M:()=>a});var o=i("151064"),r=i("455069"),n=i("966219"),a=e=>{var{mode:t,value:i,onChange:a,height:l=500,theme:s="monokai",disabled:d=!1,dataTestID:c}=e,[u,p]=(0,r.useState)(l);return(0,r.useEffect)(()=>{p(l)},[l]),(0,o.jsx)("div",{style:{position:"relative"},"data-testid":c,children:(0,o.jsx)(n.Editor,{options:{readOnly:d},language:t,theme:s,width:"100%",onChange:a,height:u,value:i})})}},786406:function(e,t,i){i.d(t,{JI:()=>eb,iy:()=>eh});var o=i("825955"),r=i("808549"),n=i("120454"),a=i("151064"),l=i("455069"),s=i("287487"),d=i("947578"),c=i("297158"),u=i("336205"),p=i("707107"),g=i("214942"),m=i("775699"),h=i("44172"),f=i("178385"),b=i("382534"),v=i("473980"),x=i("494308"),_=i("64605"),y=i("165882"),w=i("298203"),k=i("727914"),j=i("458949");function M(e){var t=e.lastIndexOf(".");return e.slice(t+1)}function I(){return(I=(0,o._)(function*(e,t){return new Promise((i,o)=>{var r=new FileReader;r.onload=e=>{var t,r=null===(t=e.target)||void 0===t?void 0:t.result;if(!r||"string"!=typeof r){o(new k.sH("normal_error","file read fail"));return}i(r)},r.onprogress=e=>{e.total&&t({total:e.total,loaded:e.loaded})},r.readAsText(e)})})).apply(this,arguments)}function N(){return(N=(0,o._)(function*(e){var t=y.Z.create({responseType:"text"});return(yield t.get(e)).data})).apply(this,arguments)}var T={none:f.Mv.None,service_http:f.Mv.Service,oauth:f.Mv.OAuth},z={Header:f.Ot.Header,Query:f.Ot.Query};function D(e){var{aiPlugin:t,openAPI:i}=e;return{aiPlugin:(0,w.dj)(t||"{}"),openAPI:(0,x.Qc)(i||"")}}function A(e,t){if(void 0!==t){for(var[i,o]of Object.entries(e))if(o===t)return i}}function S(e){switch(e){case j.wL.Curl:return"curl";case j.wL.OpenAPI:return"openapi";case j.wL.Postman:return"postman";case j.wL.Swagger:return"swagger";default:return""}}var E=e=>(0,_.Z)(e)&&"paths_duplicated"in e;function C(e){var{duplicateInfos:t=[],onCancel:i,onOk:o}=e;m.M5.warning({title:u.o.t("duplicate_tools_within_plugin"),content:null==t?void 0:t.map(e=>(0,a.jsx)("div",{children:"".concat(e.method," ").concat(u.o.t("path_has_duplicates",{path:e.path,num:e.count}))})),okText:u.o.t("merge_duplicate_tools"),cancelText:u.o.t("Cancel"),centered:!0,icon:(0,a.jsx)(h.O5N,{}),okButtonProps:{type:"warning"},onOk:o,onCancel:i})}var O=i("75117");function L(){return"cn-boe"}var Z={SAFE_CHECK:0x2aebbb74,DUP_PATH:0x29d916dd},P=["json","yaml"],F=P.map(e=>".".concat(e)),B={environment:L(),workspace_id:"",workspace_type:"",status:1,create_type:"import"},R={environment:L(),workspace_id:"",workspace_type:"",status:1,create_type:"import",plugin_id:""},U=i("3779"),Q={name:[{required:!0,message:u.o.t("create_plugin_modal_name1_error")},{pattern:RegExp("^[\\w\\s\\u4e00-\\u9fa5]+$","u"),message:u.o.t("create_plugin_modal_nameerror_cn")}],desc:[{required:!0,message:u.o.t("create_plugin_modal_descrip1_error")},!1],url:[{required:!0,message:u.o.t("create_plugin_modal_url1_error")}],key:[{required:!0,message:u.o.t("create_plugin_modal_Parameter_error")},{pattern:/^[\x00-\x7F]+$/,message:u.o.t("plugin_Parametename_error")}],service_token:[{required:!0,message:u.o.t("create_plugin_modal_Servicetoken_error")}]},Y=function(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(var o of e){if(o.value===i)return o;if((null===(t=o.children)||void 0===t?void 0:t.length)>0)return Y(o.children,i)}},V=i("335740"),W=i("824113"),G=i("581259"),H=i("625196"),q=i("153796"),K=e=>{var{disabled:t}=e,i=(0,m.XQ)(),o=i.getValues();return t?(0,a.jsx)(m.l0.Slot,{label:{text:u.o.t("create_plugin_modal_name1"),required:!0},children:(0,a.jsx)("div",{children:null==o?void 0:o.name})}):(0,a.jsx)(m.P6,{field:"name",className:q.Z["textarea-single-line"],label:u.o.t("create_plugin_modal_name1"),placeholder:u.o.t("create_plugin_modal_name2"),trigger:["blur","change"],maxCount:30,maxLength:30,rows:1,onBlur:()=>{var e;i.setValue("name",null===(e=i.getValue("name"))||void 0===e?void 0:e.trim())},rules:Q.name})},J=e=>{var{disabled:t}=e,i=(0,m.XQ)(),o=i.getValues();return t?(0,a.jsx)(m.l0.Slot,{label:{text:u.o.t("create_plugin_modal_descrip1"),required:!0},children:(0,a.jsx)("div",{children:null==o?void 0:o.desc})}):(0,a.jsx)(m.P6,{field:"desc",label:u.o.t("create_plugin_modal_descrip1"),trigger:["blur","change"],placeholder:u.o.t("create_plugin_modal_descrip2"),rows:2,maxCount:600,maxLength:600,onBlur:()=>{var e;i.setValue("desc",null==o?void 0:null===(e=o.desc)||void 0===e?void 0:e.trim())},rules:Q.desc})},X=e=>{var{disabled:t}=e,i=(0,m.XQ)(),o=i.getValues();return t?(0,a.jsx)(m.l0.Slot,{label:{text:u.o.t("create_plugin_modal_url1"),required:!0},children:(0,a.jsx)("div",{children:null==o?void 0:o.url})}):(0,a.jsx)(m.K9,{className:q.Z["textarea-single-line"],trigger:["blur","change"],field:"url",label:u.o.t("create_plugin_modal_url1"),placeholder:u.o.t("create_plugin_modal_url2"),onBlur:()=>{var e;i.setValue("url",null==o?void 0:null===(e=o.url)||void 0===e?void 0:e.trim())},rules:Q.url})},$=(0,m.Q2)(e=>{var{disabled:t,value:i=[],onChange:o}=e,r=e=>{var t=(0,V.Z)(i);t.splice(e,1),null==o||o(t)};return(0,a.jsx)(m.l0.Slot,{className:q.Z["header-list"],label:{text:u.o.t("plugin_create_header_list_title"),align:"right",extra:(0,a.jsxs)("div",{className:q.Z["header-list-extra"],children:[(0,a.jsx)(H.O,{data:G.HW.header_list}),i.length<20&&!t&&(0,a.jsx)(m._3,{size:"large",icon:(0,a.jsx)(h.N_R,{}),onClick:e=>{var t=[...i];t.push(e.name?e:{name:"",value:""}),null==o||o(t)}})]})},children:(0,a.jsxs)("div",{className:q.Z["herder-list-box"],children:[(0,a.jsxs)(m.X2,{className:q.Z["header-row"],gutter:8,children:[(0,a.jsx)(m.JX,{span:9,children:(0,a.jsx)("div",{className:q.Z["header-col-content"],children:"Key"})}),(0,a.jsx)(m.JX,{span:12,children:(0,a.jsx)("div",{className:q.Z["header-col-content"],children:"Value"})}),(0,a.jsx)(m.JX,{span:3,children:(0,a.jsx)("div",{className:q.Z["header-col-content"],style:{textAlign:"right"},children:u.o.t("plugin_create_action_btn")})})]}),(0,a.jsx)("div",{className:q.Z["herder-list-cotent"],children:null==i?void 0:i.map((e,n)=>(0,a.jsxs)(m.X2,{gutter:8,type:"flex",justify:"space-between",align:"middle",children:[(0,a.jsx)(m.JX,{span:9,children:(0,a.jsx)("div",{className:q.Z["col-content"],children:(0,a.jsx)(m.u3,{placeholder:"Name",value:e.name,onChange:e=>{var t=(0,V.Z)(i);t[n].name=e,null==o||o(t)},maxLength:100,disabled:t})})}),(0,a.jsx)(m.JX,{span:12,children:(0,a.jsx)("div",{className:q.Z["col-content"],children:(0,a.jsx)(m.u3,{placeholder:"Value",value:e.value,onChange:e=>{var t=(0,V.Z)(i);t[n].value=e,null==o||o(t)},maxLength:200,disabled:t})})}),(0,a.jsx)(m.JX,{span:3,children:(0,a.jsx)("div",{className:q.Z["col-content"],children:(0,a.jsx)(m._3,{icon:(0,a.jsx)(h.WDf,{}),type:"secondary",disabled:t,onClick:()=>{r(n)}})})})]},n))})]})})},{valueKey:"value",onKeyChangeFnName:"onChange"}),ee=e=>(0,a.jsx)($,(0,n._)((0,r._)({},e),{field:"headerList",label:{text:""}})),et=e=>{var t,i,{disabled:o,authOption:r,onChange:n}=e,l=(0,m.XQ)().getValues();return o?(0,a.jsx)(m.l0.Slot,{label:{text:u.o.t("create_plugin_modal_auth1"),extra:(0,a.jsx)(H.O,{data:G.HW.auth}),required:!0},children:(0,a.jsx)("div",{children:null===(t=Y(r,null==l?void 0:null===(i=l.auth_type)||void 0===i?void 0:i.at(-1)))||void 0===t?void 0:t.label})}):(0,a.jsx)(m.oL.FormItem,{rules:[{required:!0}],style:{width:"100%"},initValue:(null==l?void 0:l.auth_type)||[0],field:"auth_type",label:{text:u.o.t("create_plugin_modal_auth1"),extra:(0,a.jsx)(H.O,{data:G.HW.auth})},placeholder:u.o.t("please_select_an_authorization_method"),treeData:r,displayRender:e=>"".concat(null==e?void 0:e.at(-1)),onChange:e=>{n(e)}})},ei=e=>{var t,i,o,{disabled:r}=e,n=(0,m.XQ)(),l=n.getValues();return(0,a.jsxs)(a.Fragment,{children:[r?(0,a.jsx)(m.l0.Slot,{label:{text:u.o.t("create_plugin_modal_location"),extra:(0,a.jsx)(H.O,{data:G.HW.location}),required:!0},children:(0,a.jsx)("div",{children:null===(t=Y(G.cg,null===(i=n.getValues())||void 0===i?void 0:i.location))||void 0===t?void 0:t.label})}):(0,a.jsx)(m.l0.RadioGroup,{rules:[{required:!0}],field:"location",label:{text:u.o.t("create_plugin_modal_location"),extra:(0,a.jsx)(H.O,{data:G.HW.location})},options:G.cg}),r?(0,a.jsx)(m.l0.Slot,{label:{text:u.o.t("create_plugin_modal_Parameter"),extra:(0,a.jsx)(H.O,{data:G.HW.key}),required:!0},children:(0,a.jsx)("div",{children:null===(o=n.getValues())||void 0===o?void 0:o.key})}):(0,a.jsx)(W.sI,{initValue:null==l?void 0:l.key,trigger:["blur","change"],field:"key",label:{text:u.o.t("create_plugin_modal_Parameter"),extra:(0,a.jsx)(H.O,{data:G.HW.key})},placeholder:u.o.t("create_plugin_modal_Parameter_empty"),maxLength:100,rules:Q.key}),r?(0,a.jsx)(m.l0.Slot,{label:{text:u.o.t("create_plugin_modal_Servicetoken"),extra:(0,a.jsx)(H.O,{data:G.HW.service_token}),required:!0},children:(0,a.jsx)("div",{children:null==l?void 0:l.service_token})}):(0,a.jsx)(W.sI,{initValue:null==l?void 0:l.service_token,trigger:["blur","change"],field:"service_token",label:{text:u.o.t("create_plugin_modal_Servicetoken"),extra:(0,a.jsx)(H.O,{data:G.HW.service_token})},placeholder:u.o.t("create_plugin_modal_Servicetoken_empty"),maxLength:400,rules:Q.service_token})]})},eo=e=>{var{disabled:t,extItems:i}=e,o=(0,m.XQ)().getValues();return(0,a.jsx)(a.Fragment,{children:null==i?void 0:i.map(e=>(0,a.jsx)(a.Fragment,{children:t?(0,a.jsx)(m.l0.Slot,{label:{text:e.key,extra:G.HW[e.key]&&(0,a.jsx)(H.O,{data:G.HW[e.key]}),required:e.required},children:(0,a.jsx)("div",{children:(null==o?void 0:o.oauth_info)?(0,w.dj)(o.oauth_info)[e.key]:null})},e.key):(0,a.jsx)(W.sI,{trigger:["blur","change"],field:e.key,label:{text:e.key,extra:G.HW[e.key]&&(0,a.jsx)(H.O,{data:G.HW[e.key]})},placeholder:G.VF[e.key],initValue:(null==o?void 0:o.oauth_info)&&(0,w.dj)(o.oauth_info)[e.key]||e.default,maxLength:e.max_len,rules:[{required:e.required,message:G.VF[e.key]},"url"===e.type?{pattern:/^(http|https):\/\/.+$/,message:u.o.t("create_plugin_modal_URLerror")}:{pattern:/^[\x00-\x7F]+$/,message:u.o.t("create_plugin_modal_descrip_error")}]},e.key)}))})},er={headerList:[{name:"User-Agent",value:"Coze/1.0"}]},en=e=>{var t,i,s,c,_,{onCancel:y,importInfo:k,visible:M,onSuccess:I,disabled:N=!1,projectId:S}=e,[E,C]=(0,l.useState)([]),[L,P]=(0,l.useState)(!0),[F,R]=(0,l.useState)([]),[Q,V]=(0,l.useState)(!1),W=(null==k?void 0:null===(s=k.metaInfo)||void 0===s?void 0:null===(i=s.common_params)||void 0===i?void 0:i[4])||[],G=k?(0,n._)((0,r._)({},null==k?void 0:k.metaInfo),{headerList:W||[]}):er,H=(0,l.useRef)(),$=null===(_=H.current)||void 0===_?void 0:null===(c=_.getFormState())||void 0===c?void 0:c.values,en=(0,g.rY)(e=>e.space.id);(0,l.useEffect)(()=>{(0,o._)(function*(){var e,t=yield b.nA.GetOAuthSchema();C((e=null==t?void 0:t.oauth_schema,[{label:u.o.t("create_plugin_modal_Authorization_no"),value:0,key:"None"},{label:u.o.t("create_plugin_modal_Authorization_service"),value:1,key:"Service"},{label:u.o.t("create_plugin_modal_Authorization_oauth"),value:3,key:"OAuth",children:(0,w.dj)(e)}]))})()},[]),(0,l.useEffect)(()=>{if(k){var e,t,i;R((null===(e=Y(E,(null===(i=k.metaInfo)||void 0===i?void 0:null===(t=i.auth_type)||void 0===t?void 0:t.at(-1))||0))||void 0===e?void 0:e.items)||[])}else R([])},[E,k]);var ea=(t=(0,o._)(function*(){yield null===(o=H.current)||void 0===o?void 0:o.validate();var e=null===(a=H.current)||void 0===a?void 0:a.getValues();if(!!e){var{openAPI:t,aiPlugin:i}=el(e);try{V(!0);var o,a,l,{data:s}=yield b.Js.RegisterPlugin({ai_plugin:i,openapi:t,plugin_type:j.zV.PLUGIN,client_id:null==e?void 0:e.client_id,client_secret:null==e?void 0:e.client_secret,service_token:null==e?void 0:e.service_token,import_from_file:!0,space_id:en,project_id:S},{__disableErrorToast:!0});m.O$.success(u.o.t("plugin_imported_successfully")),null==y||y(),yield null==I?void 0:I({plugin_id:null==s?void 0:s.plugin_id}),(0,p.Gg)(p.Kg.create_plugin_front,(0,n._)((0,r._)({},(null==k?void 0:null===(l=k.extra)||void 0===l?void 0:l.reportParams)||B),{status:0}))}catch(e){var c,{code:g,msg:h}=e;(0,p.Gg)(p.Kg.create_plugin_front,(0,n._)((0,r._)({},(null==k?void 0:null===(c=k.extra)||void 0===c?void 0:c.reportParams)||B),{status:1,error_message:h})),Number(g)===Z.SAFE_CHECK?P(!1):m.O$.error({content:(0,d.u)(h)})}finally{V(!1)}}}),function(){return t.apply(this,arguments)}),el=e=>{var t,{headerList:i,plugin_uri:o=[]}=e,a=(0,v._)(e,["headerList","plugin_uri"]),l={};return null==F||F.forEach(t=>{t.key in e&&(l[t.key]=e[t.key])}),function(e,t){var{aiPlugin:i,openAPI:o}=D(t),{name:a,desc:l,auth_type:s,common_params:d,location:c,key:u,service_token:p,oauth_info:g,icon:m}=e,h={name_for_human:a,name_for_model:a,description_for_human:l,description_for_model:l,logo_url:null==m?void 0:m.uri,common_params:{header:null==d?void 0:d[f.Pi.Header],body:null==d?void 0:d[f.Pi.Body],path:null==d?void 0:d[f.Pi.Path],query:null==d?void 0:d[f.Pi.Query]},auth:(0,r._)({type:A(T,null==s?void 0:s.at(0)),location:A(z,c),key:u,service_token:p},JSON.parse(g||"{}"))},b=(0,r._)({},i,h),v=(0,n._)((0,r._)({},o||{}),{info:(0,n._)((0,r._)({},(null==o?void 0:o.info)||{}),{title:a,description:l}),servers:[{url:e.url}]});return{aiPlugin:JSON.stringify(b),openAPI:(0,x.Pz)(v)}}((0,n._)((0,r._)({},a),{oauth_info:JSON.stringify(l),icon:{uri:null===(t=o[0])||void 0===t?void 0:t.uid},common_params:{[j.Pi.Header]:(null==e?void 0:e.headerList)||[],[j.Pi.Body]:[],[j.Pi.Path]:[],[j.Pi.Query]:[]}}),{openAPI:null==k?void 0:k.openAPI,aiPlugin:null==k?void 0:k.aiPlugin})};return(0,l.useEffect)(()=>{!L&&P(!0)},[(null==$?void 0:$.name)||(null==$?void 0:$.desc)]),(0,a.jsx)(a.Fragment,{children:M?(0,a.jsx)(m.M5,{type:"action-small",title:u.o.t("confirm_plugin_information"),visible:M,onCancel:()=>null==y?void 0:y(),footer:!N&&(0,a.jsxs)("div",{children:[!L&&(0,a.jsx)("div",{className:q.Z["error-msg-box"],children:(0,a.jsx)("span",{className:q.Z["error-msg"],children:u.o.t("plugin_create_modal_safe_error")})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(m.y3,{type:"tertiary",onClick:()=>{null==y||y()},children:u.o.t("create_plugin_modal_button_cancel")}),(0,a.jsx)(m.y3,{type:"primary",theme:"solid",loading:Q,onClick:()=>{ea()},children:u.o.t("create_plugin_modal_button_confirm")})]})]}),children:(0,a.jsx)(m.l0,{getFormApi:e=>H.current=e,showValidateIcon:!1,initValues:(0,r._)({},G||{}),className:q.Z["upload-form"],children:e=>{var{values:t}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O.s,{noLabel:!0,disabled:N,fieldClassName:q.Z["upload-field"],field:"plugin_uri",iconType:f.Tu.Plugin,fileBizType:f.ym.BIZ_PLUGIN_ICON}),(0,a.jsx)(K,{disabled:N}),(0,a.jsx)(J,{disabled:N}),(0,a.jsx)(X,{disabled:!0}),(0,a.jsx)(ee,{disabled:N}),(0,a.jsx)(et,{disabled:N,authOption:E,onChange:e=>{var t;R((null===(t=Y(E,null==e?void 0:e.at(-1)))||void 0===t?void 0:t.items)||[])}}),1===t.auth_type.at(-1)&&(0,a.jsx)(ei,{disabled:N}),(0,a.jsx)(eo,{disabled:N,extItems:F}),!N&&(0,a.jsxs)(m.T,{spacing:8,className:q.Z["footer-draft"],children:[(0,a.jsx)(h.Us8,{style:{fontSize:"16px",color:"#4D53E8"}}),(0,a.jsxs)("span",{children:[u.o.t("plugin_create_draft_desc"),(0,a.jsx)(U.v,{})]})]})]})}})}):null})},ea=i("252237"),el=i.n(ea),es=i("623159"),ed=i("68344"),ec=i("468163"),eu=e=>{var t,{onUpload:i,disabled:r}=e,[n,s]=(0,l.useState)([]);var d=(t=(0,o._)(function*(e){var{onSuccess:t,file:i,onError:o,onProgress:r}=e;if("string"!=typeof i)try{var{name:n,fileInstance:a}=i;if(a){var l=M(n);if(!P.includes(l))return;var s=yield function(e,t){return I.apply(this,arguments)}(a,r);t(s)}}catch(e){c.kg.error({eventName:"fail_to_read_file",error:e}),o({status:0})}}),function(e){return t.apply(this,arguments)});return(0,a.jsx)(m.gq,{accept:F.join(","),action:"",onAcceptInvalid:()=>{m.O$.warning(u.o.t("file_format_not_supported"))},onSuccess:e=>{i(e)},disabled:r,fileList:n,onChange:e=>{var{fileList:t}=e;s(t),!t.length&&i()},className:el()(ec.Z["upload-file-area"],n.length&&ec.Z["drag-area-disabled"]),dragMainText:u.o.t("click_upload_or_drag_files"),draggable:!0,dragSubText:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:u.o.t("supports_uploading_json_or_yaml_files")}),(0,a.jsx)("a",{href:"/open/docs/guides/import",target:"_blank",onClick:e=>e.stopPropagation(),children:u.o.t("view_detailed_information")})]}),renderFileItem:e=>{var{name:t,onRemove:i,onRetry:o,percent:n,status:l}=e;return(0,a.jsxs)("div",{className:el()(ec.Z["upload-file-item"],r&&ec.Z.disabled),children:[(0,a.jsx)(m.Ee,{preview:!1,className:ec.Z["file-icon"],src:"yaml"===M(t)?es:ed}),(0,a.jsx)(m.ZT.Text,{className:ec.Z.text,ellipsis:{showTooltip:{opts:{content:t}}},children:t}),(0,a.jsx)("div",{className:ec.Z.progress,children:(()=>{switch(l){case"success":return(0,a.jsx)(m.ZT.Text,{className:ec.Z["upload-text"],ellipsis:!0,children:u.o.t("file_upload_success")});case"uploadFail":case"validateFail":return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.Ucq,{}),(0,a.jsx)(m.y3,{theme:"borderless",className:"ml-[8px]",onClick:o,children:u.o.t("retry")})]});default:return(0,a.jsx)("div",{className:el()("w-[90px]"),children:(0,a.jsx)(m.Ex,{percent:n})})}})()}),(0,a.jsx)(m._3,{icon:(0,a.jsx)(h.WDf,{className:ec.Z["delete-icon"],onClick:i})})]})},limit:1,customRequest:d})},ep=(0,l.forwardRef)((e,t)=>{var{onChange:i}=e,o=(0,v._)(e,["onChange"]);return(0,a.jsx)(m.Kx,(0,n._)((0,r._)({placeholder:u.o.t("enter_raw_content_or_url"),rows:17},o),{ref:t,onChange:e=>{i(e.trim())},className:ec.Z["text-area"]}))}),eg=i("170992"),em=e=>{var t,{onCancel:i,visible:r,onOk:n,title:s}=e,[d,p]=(0,l.useState)("File"),[g,h]=(0,l.useState)(),[f,b]=(0,l.useState)(),[v,x]=(0,l.useState)(!1),_=(0,l.useRef)(null),y=e=>{h(e)},w=()=>{p("File"),h(void 0)};var k=(t=(0,o._)(function*(){x(!0),b(void 0);var e=g,t="Text"===d?"raw_txt":"file";if("Text"===d&&function(e){try{return!!RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*","i").test(e||"")}catch(e){return!1}}(g))try{e=yield function(e){return N.apply(this,arguments)}(g||""),t="file_url"}catch(e){return c.kg.error({error:e,eventName:"fetch_url_resource_fail"}),b(u.o.t("unable_to_access_input_url")),x(!1),Promise.reject(e)}try{var i=yield null==n?void 0:n({type:t,content:e});!(null==i?void 0:i.success)&&b(null==i?void 0:i.errMsg)}finally{x(!1)}}),function(){return t.apply(this,arguments)});return(0,l.useEffect)(()=>{f&&b(void 0)},[g]),(0,l.useEffect)(()=>{r&&w()},[r]),(0,l.useEffect)(()=>{if("Text"===d&&_.current){var e;null==_||null===(e=_.current)||void 0===e||e.focus()}},[d]),(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(m.M5,{afterClose:w,keepDOM:!1,type:"action-small",title:s,visible:r,onCancel:i,onOk:k,footer:(0,a.jsx)(m.y3,{theme:"solid",type:"primary",disabled:!g,onClick:k,loading:v,children:u.o.t("next")}),className:eg.Z["import-modal"],children:(0,a.jsxs)("div",{className:"min-h-[472px]",children:[(0,a.jsx)("div",{className:"flex justify-center mb-[24px]",children:(0,a.jsxs)(m.FX,{onChange:e=>{p(e.target.value),h(void 0)},type:"button",buttonSize:"middle",defaultValue:d,disabled:v,className:eg.Z["radio-group"],children:[(0,a.jsx)(m.Y8,{value:"File",children:u.o.t("local_file")}),(0,a.jsx)(m.Y8,{value:"Text",children:u.o.t("url_raw_data")})]})}),(0,a.jsx)("div",{children:"File"===d?(0,a.jsx)(eu,{onUpload:y,disabled:v}):(0,a.jsx)(ep,{onChange:y,disabled:v,ref:_})}),(0,a.jsxs)("div",{className:eg.Z["error-msg"],children:[" ",f?(0,a.jsx)(m.ZT.Text,{ellipsis:{showTooltip:{opts:{content:f}}},children:f}):null]})]})})})},eh=e=>{var{visible:t}=e;return t?(0,a.jsx)(ef,(0,r._)({},e)):null},ef=e=>{var t,i,{onCancel:s,visible:h,onSuccess:x,projectId:_}=e,[y,w]=(0,l.useState)(),{id:k,space_type:j}=(0,g.rY)(e=>e.space),M=(0,l.useRef)(B),I=j===f.Sn.Personal;(0,l.useEffect)(()=>{M.current=(0,n._)((0,r._)({},M.current),{environment:L(),workspace_id:k||"",workspace_type:I?"personal_workspace":"team_workspace",status:1,create_type:"import"})},[k,I]);var N=(t=(0,o._)(function*(e){try{var t,{openapi:i,ai_plugin:a,plugin_data_format:l}=yield b.Js.Convert2OpenAPI(e,{__disableErrorToast:!0}),s=D({aiPlugin:a,openAPI:i}),g=function(e){var t,i,o,r,n,a,{aiPlugin:l,openAPI:s}=e,d=(null==l?void 0:l.auth)||{},{type:c,location:u,key:p,service_token:g}=d,m=(0,v._)(d,["type","location","key","service_token"]);return{name:null==l?void 0:l.name_for_human,desc:null==l?void 0:l.description_for_human,url:null==s?void 0:null===(i=s.servers)||void 0===i?void 0:null===(t=i[0])||void 0===t?void 0:t.url,icon:{uri:null==l?void 0:l.logo_url},auth_type:[T[c||"none"]],location:z[u||""],key:p,service_token:g,oauth_info:JSON.stringify(m),common_params:{[f.Pi.Header]:(null==l?void 0:null===(o=l.common_params)||void 0===o?void 0:o.header)||[],[f.Pi.Body]:(null==l?void 0:null===(r=l.common_params)||void 0===r?void 0:r.body)||[],[f.Pi.Path]:(null==l?void 0:null===(n=l.common_params)||void 0===n?void 0:n.path)||[],[f.Pi.Query]:(null==l?void 0:null===(a=l.common_params)||void 0===a?void 0:a.query)||[]}}}(s);return w({aiPlugin:a,openAPI:i,metaInfo:g}),M.current=(0,n._)((0,r._)({},M.current),{import_format_type:S(l),import_tools_count:Object.entries((null==s?void 0:null===(t=s.openAPI)||void 0===t?void 0:t.paths)||{}).length}),{success:!0}}catch(t){var h,x,_,{msg:y,code:k,response:j}=t;if(c.kg.error({error:t,eventName:"plugin_convert_openapi_fail"}),M.current=(0,n._)((0,r._)({},M.current),{import_format_type:S(null==j?void 0:null===(x=j.data)||void 0===x?void 0:x.plugin_data_format),import_tools_count:0}),(0,p.Gg)(p.Kg.create_plugin_front,(0,n._)((0,r._)({},M.current),{status:1,error_message:y})),!(Number(k)===Z.DUP_PATH||E(null==j?void 0:j.data)))return{success:!1,errMsg:y||u.o.t("error")};return C({onOk:(h=(0,o._)(function*(){var{errMsg:t,success:i}=yield N((0,n._)((0,r._)({},e),{merge_same_paths:!0}));if(!i)return m.O$.error({content:(0,d.u)(t||u.o.t("error"))}),Promise.reject(t)}),function(){return h.apply(this,arguments)}),duplicateInfos:null==j?void 0:null===(_=j.data)||void 0===_?void 0:_.duplicate_api_infos}),{success:!1,errMsg:""}}}),function(e){return t.apply(this,arguments)});var A=(i=(0,o._)(function*(e){var{content:t,type:i}=e;return M.current=(0,n._)((0,r._)({},M.current),{import_way_type:i}),yield N({data:t||"",space_id:k,merge_same_paths:!1})}),function(e){return i.apply(this,arguments)});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(em,{title:u.o.t("import_plugin"),visible:h,onCancel:s,onOk:A}),y?(0,a.jsx)(en,{visible:!!y,projectId:_,onCancel:()=>w(void 0),importInfo:{metaInfo:y.metaInfo,openAPI:y.openAPI,aiPlugin:y.aiPlugin,extra:{reportParams:M.current}},onSuccess:e=>{null==s||s(),null==x||x(e)}}):null]})},eb=e=>{var{visible:t}=e;return t?(0,a.jsx)(ev,(0,r._)({},e)):null},ev=e=>{var t,i,v,x,{onCancel:_,visible:y,onSuccess:w,pluginInfo:k}=e,j=(0,l.useRef)(R),{id:M,space_type:I}=(0,g.rY)(e=>e.space),N=I===f.Sn.Personal,T=s.Z.useUserInfo();(0,l.useEffect)(()=>{j.current=(0,n._)((0,r._)({},j.current),{environment:L(),workspace_id:M||"",workspace_type:N?"personal_workspace":"team_workspace",status:1,create_type:"import",plugin_id:(null==k?void 0:k.pluginID)||""})},[null==k?void 0:k.pluginID,M,N]);var z=(t=(0,o._)(function*(e){try{var t,i,o,a=yield b.Js.BatchCreateAPI(e,{__disableErrorToast:!0}),l=(null==e?void 0:e.replace_same_paths)?null==e?void 0:null===(t=e.paths_to_replace)||void 0===t?void 0:t.length:null==a?void 0:null===(i=a.paths_created)||void 0===i?void 0:i.length;(0,p.Gg)(p.Kg.create_plugin_tool_front,(0,n._)((0,r._)({},j.current),{status:0,import_tools_count:l||0})),a&&!(null==a?void 0:null===(o=a.paths_duplicated)||void 0===o?void 0:o.length)&&(m.O$.success((null==e?void 0:e.replace_same_paths)?u.o.t("plugin_tool_replace_success"):u.o.t("plugin_tool_import_succes")),null==_||_(),null==w||w())}catch(t){var s,d,{code:c,response:g}=t;if(Number(c)!==Z.DUP_PATH&&!E(null==g?void 0:g.data))return Promise.reject(t);(0,p.Gg)(p.Kg.create_plugin_tool_front,(0,n._)((0,r._)({},j.current),{status:0,import_tools_count:(null==g?void 0:null===(d=g.data)||void 0===d?void 0:null===(s=d.paths_created)||void 0===s?void 0:s.length)||0})),D(e,null==g?void 0:g.data)}}),function(e){return t.apply(this,arguments)}),D=(e,t)=>{var{paths_created:i=[],paths_duplicated:l=[]}=t||{},s=i.length,c=l.length,g=u.o.t("failed_to_import_tool",{num:c}),f=u.o.t("tools_imported_successfully",{num:s});m.M5.warning({title:s?"".concat(f,", ").concat(g):g,content:c?u.o.t("plugin_tool_exists_tips",{num:c}):null,okText:u.o.t("replace"),cancelText:u.o.t("Cancel"),centered:!0,icon:(0,a.jsx)(h.O5N,{}),okButtonProps:{type:"warning"},onOk:(0,o._)(function*(){var t=(0,n._)((0,r._)({},e),{replace_same_paths:!0,paths_to_replace:l});try{yield z(t)}catch(e){var{msg:i}=e;m.O$.error({content:(0,d.u)(i||u.o.t("error"))}),(0,p.Gg)(p.Kg.create_plugin_tool_front,(0,n._)((0,r._)({},j.current),{import_tools_count:0,status:1,error_message:i||""}))}}),onCancel:s?(0,o._)(function*(){null==_||_(),yield null==w?void 0:w()}):void 0})};var A=(i=(0,o._)(function*(e){return yield b.Js.Convert2OpenAPI((0,n._)((0,r._)({},e),{plugin_description:null==k?void 0:k.pluginDesc}),{__disableErrorToast:!0})}),function(e){return i.apply(this,arguments)});var O=(v=(0,o._)(function*(e){try{var t=yield A(e);j.current=(0,n._)((0,r._)({},j.current),{import_format_type:S(null==t?void 0:t.plugin_data_format)});var i={plugin_id:null==k?void 0:k.pluginID,ai_plugin:null==t?void 0:t.ai_plugin,openapi:null==t?void 0:t.openapi,replace_same_paths:!1,space_id:M,dev_id:null==T?void 0:T.user_id_str,edit_version:null==k?void 0:k.editVersion};return yield z(i),{success:!0}}catch(t){var a,l,s,{msg:g,code:h,response:f}=t;if(c.kg.error({error:t,eventName:"batch_create_fail"}),j.current=(0,n._)((0,r._)({},j.current),{import_format_type:S(null==f?void 0:null===(l=f.data)||void 0===l?void 0:l.plugin_data_format)}),(0,p.Gg)(p.Kg.create_plugin_tool_front,(0,n._)((0,r._)({},j.current),{import_tools_count:0,status:1,error_message:g||""})),!(Number(h)===Z.DUP_PATH||E(null==f?void 0:f.data)))return{success:!1,errMsg:g||u.o.t("error")};return C({onOk:(a=(0,o._)(function*(){var{success:i,errMsg:o}=yield O((0,n._)((0,r._)({},e),{merge_same_paths:!0}));if(!i)return m.O$.error({content:(0,d.u)(o||u.o.t("error"))}),Promise.reject(t)}),function(){return a.apply(this,arguments)}),duplicateInfos:null==f?void 0:null===(s=f.data)||void 0===s?void 0:s.duplicate_api_infos}),{success:!1}}}),function(e){return v.apply(this,arguments)});var P=(x=(0,o._)(function*(e){var{content:t,type:i}=e||{};return j.current=(0,n._)((0,r._)({},j.current),{import_way_type:i}),yield O({data:t||"",plugin_name:null==k?void 0:k.pluginName,plugin_url:null==k?void 0:k.pluginUrl,merge_same_paths:!1,space_id:M})}),function(e){return x.apply(this,arguments)});return(0,a.jsx)(em,{title:u.o.t("import_plugin_tool"),visible:y,onCancel:_,onOk:P})}},3779:function(e,t,i){i.d(t,{v:function(){return l}});var o=i(151064),r=i(455069),n=i(336205),a=i(659596),l=()=>{var e=(0,r.useMemo)(()=>({"zh-CN":"/docs/guides/plugin",en:"/docs/en_guides/en_plugin"})[n.o.language],[]);return(0,o.jsx)(a.ZT.Text,{link:{href:e,target:"_blank"},fontSize:"12px",children:n.o.t("plugin_create_guide_link")})}},746278:function(e,t,i){i.d(t,{FQ:function(){return n},aj:function(){return r}});var o=i(336205),r={id:"0",name:o.o.t("real_data")},n="10000010"},11869:function(e,t,i){i.d(t,{G:function(){return u},dj:function(){return s.dj},nr:function(){return d},sq:function(){return c}});var o=i(473980),r=i(615655),n=i(298203),a=i(824833),l=i(746278),s=i(450599);function d(e){return e.id===l.aj.id}function c(e,t){var{bindSubjectInfo:i,bizCtx:l}=e,{bindSubjectInfo:s,bizCtx:d}=t,c=(0,r.Z)(i,s),u=l||{},{ext:p}=u,g=(0,o._)(u,["ext"]),m=d||{},{ext:h}=m,f=function(e,t){return e.bizSpaceID===t.bizSpaceID&&e.trafficScene===t.trafficScene&&e.trafficCallerID===t.trafficCallerID}(g,(0,o._)(m,["ext"])),b=(null==l?void 0:l.trafficScene)!==a.zE.CozeWorkflowDebug||function(e,t){var i=(0,n.dj)(e||"{}"),o=(0,n.dj)(t||"{}");return(0,r.Z)(i,o)}((null==p?void 0:p.mockSubjectInfo)||"",(null==h?void 0:h.mockSubjectInfo)||"");return c&&f&&b}function u(e){switch(e){case a.zE.CozeSingleAgentDebug:return"bot";case a.zE.CozeMultiAgentDebug:return"agent";case a.zE.CozeWorkflowDebug:return"flow";case a.zE.CozeToolDebug:default:return"bot"}}},773568:function(e,t,i){i.d(t,{M:function(){return a},U:function(){return n}});var o,r,n=((o={}).STRING="string",o.INTEGER="integer",o.NUMBER="number",o.OBJECT="object",o.ARRAY="array",o.BOOLEAN="boolean",o);var a=((r={}).DEFAULT="default",r.REMOVED="removed",r.ADDED="added",r)},450599:function(e,t,i){i.d(t,{Lt:function(){return c},dj:function(){return d},jy:function(){return s}});var o=i(808549),r=i(120454),n=i(583193),a=i(177625),l=i(773568);function s(e){return e?"".concat(e.slice(0,1).toUpperCase()).concat(e.slice(1)):""}function d(e,t){try{return JSON.parse(e)}catch(e){return null==t?void 0:t()}}function c(e,t){var i=void 0===t;if(!e||i)return{result:e,incompatible:!1};var s="string"==typeof t&&d(t)||t,c=function e(t,i,o){var r,a,{defaultStatus:s=l.M.DEFAULT}=o||{},d=u(i);if(!!d){var[c,p]=(r=d,a=i,(0,n.Ki)(r,{getBooleanValue:()=>!!a,getNumberValue:()=>Number(a),getStringValue:()=>String(a)})),g=(null==o?void 0:o.keyPrefix)?"".concat(null==o?void 0:o.keyPrefix,"-").concat(t):t,m={label:t,realValue:c,displayValue:p,isRequired:!1,type:d,status:s,key:g};if(d===l.U.OBJECT){var h=[];for(var f of Object.keys(i))if(f){var b=e(f,i[f],{defaultStatus:s,keyPrefix:g});b&&h.push(b)}m.children=h}if(d===l.U.ARRAY){m.childrenType=u(i[0]);var v=[];for(var x in i)if(void 0!==i[x]){var _=e((0,n.pB)(x),i[x],{defaultStatus:s,keyPrefix:g});_&&v.push(_)}m.children=v}return m}}(a.dz,s,{defaultStatus:l.M.REMOVED}),{merged:p,incompatible:g}=m(e.children,null==c?void 0:c.children,e.type===l.U.ARRAY);return{result:(0,r._)((0,o._)({},e),{children:p}),incompatible:g}}function u(e){var t=typeof e;return e instanceof Array&&(t=l.U.ARRAY),t}function p(e,t){return e===l.U.NUMBER?t===l.U.NUMBER||t===l.U.INTEGER:e===t}function g(e,t){var i=!1,n=(0,r._)((0,o._)({},e),{key:t.key,label:t.label,realValue:t.realValue,displayValue:t.displayValue,status:l.M.DEFAULT});if(t.type===l.U.ARRAY||t.type===l.U.OBJECT){var{merged:a,incompatible:s}=m(e.children,t.children,e.type===l.U.ARRAY);n.children=a,i=i||s}return{result:n,incompatible:i}}function m(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return void 0===e||void 0===t?{merged:[...e||[],...t||[]],incompatible:e!==t}:0===t.length&&i?{merged:[],incompatible:!1}:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!1,r=[...t],n=[...e];for(var a in n)!function(e){if(n[e]){var t=n[e],i=r.findIndex(e=>e.label===t.label&&p(e.type,t.type)&&p(e.childrenType,t.childrenType));if(-1!==i){var{result:a,incompatible:l}=g(t,r.splice(i,1)[0]);n[e]=a,o=o||l}else t.isRequired&&(o=!0)}}(a);if(r.length&&i){var l=e[0];r.forEach(e=>{var{result:t,incompatible:i}=g(l,e);n.push(t),o=o||i}),r=[]}return r.length&&(o=!0),{merged:[...n,...r],incompatible:o}}(e,t,i)}},625196:function(e,t,i){i.d(t,{O:()=>l});var o=i("151064"),r=i("455069"),n=i("873183"),a=i("659596"),l=e=>{var{data:t}=e;return(0,o.jsx)(a.u,{showArrow:!0,theme:"dark",position:"right",arrowPointAtCenter:!0,className:"!max-w-[320px]",content:null==t?void 0:t.map((e,t)=>(0,o.jsxs)(r.Fragment,{children:["title"===e.type?(0,o.jsx)(a.ZT.Text,{fontSize:"14px",className:"dark coz-fg-primary",children:e.text}):null,"text"===e.type?(0,o.jsx)(a.ZT.Paragraph,{fontSize:"12px",className:"dark coz-fg-secondary",children:e.text}):null,"br"===e.type?(0,o.jsx)("div",{className:"h-[8px]"}):null,"demo"===e.type?(0,o.jsx)("div",{className:"dark mt-[4px] p-[10px] border border-solid coz-stroke-primary",children:(0,o.jsx)(a.ZT.Paragraph,{fontSize:"12px",className:"dark coz-fg-secondary",children:e.text})}):null]},"".concat(e.type).concat(t))),children:(0,o.jsx)(n.L03,{className:"coz-fg-secondary"})})}},827666:function(e,t,i){i.d(t,{Eo:function(){return _},Fc:function(){return p},Il:function(){return u},JN:function(){return C},Oz:function(){return E},RE:function(){return y},TS:function(){return b},UR:function(){return m},YA:function(){return N},Zo:function(){return D},dT:function(){return h},iq:function(){return S},lR:function(){return A},ls:function(){return f},pq:function(){return v},rN:function(){return x},sp:function(){return g},w5:function(){return j}});var o,r,n=i(808549),a=i(120454),l=i(335740),s=i(336205),d=i(458949),c=i(187151),u="sub_parameters",p="id",g="[Array Item]",m="[Root Item]",h=0,f=1,b=2,v=[{label:"Body",value:d.Pi.Body},{label:"Path",value:d.Pi.Path},{label:"Query",value:d.Pi.Query},{label:"Header",value:d.Pi.Header}];var x=((o={})[o.DEFAULT=10001]="DEFAULT",o[o.IMAGE=10002]="IMAGE",o[o.DOC=10003]="DOC",o[o.CODE=10004]="CODE",o[o.PPT=10005]="PPT",o[o.TXT=10006]="TXT",o[o.EXCEL=10007]="EXCEL",o[o.AUDIO=10008]="AUDIO",o[o.ZIP=10009]="ZIP",o[o.VIDEO=10010]="VIDEO",o),_=e=>e+1e4,y=e=>e-1e4,w=[{label:"String",value:d.rH.String},{label:"Integer",value:d.rH.Integer},{label:"Number",value:d.rH.Number},{label:"Object",value:d.rH.Object},{label:"Array",value:d.rH.Array},{label:"Boolean",value:d.rH.Bool}],k=[{label:"Array",value:d.rH.String},{label:"Array",value:d.rH.Integer},{label:"Array",value:d.rH.Number},{label:"Array",value:d.rH.Object},{label:"Array",value:d.rH.Bool}],j={10001:{label:"File",listLabel:"Array",fileTypes:[c.Wz.DEFAULT_UNKNOWN]},10002:{label:"Image",listLabel:"Array",fileTypes:[c.Wz.IMAGE]},10003:{label:"Doc",listLabel:"Array",fileTypes:[c.Wz.DOCX,c.Wz.PDF]},10004:{label:"Code",listLabel:"Array",fileTypes:[c.Wz.CODE]},10005:{label:"PPT",listLabel:"Array",fileTypes:[c.Wz.PPT]},10006:{label:"TXT",listLabel:"Array",fileTypes:[c.Wz.TXT]},10007:{label:"Excel",listLabel:"Array",fileTypes:[c.Wz.EXCEL,c.Wz.CSV]},10008:{label:"Audio",listLabel:"Array