@nocobase/plugin-data-source-manager 1.3.0-alpha.20240721030922 → 1.3.0-alpha.20240806102951

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.txt CHANGED
@@ -1,8 +1,8 @@
1
- Updated Date: June 19, 2024
1
+ Updated Date: July 24, 2024
2
2
 
3
3
  NocoBase License Agreement
4
4
 
5
- NocoBase Co., Ltd. ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
5
+ NOCOBASE PTE. LTD. ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
6
6
 
7
7
  This Agreement applies to any use, quotation, contract, invoice, and all software delivered by the Company. The User and the Company or NocoBase's agents can no longer sign a separate license agreement for the sale and delivery of the software.
8
8
 
@@ -11,25 +11,24 @@ The Company reserves the right to formulate and modify this Agreement from time
11
11
  ==============
12
12
  1. Definitions
13
13
  ==============
14
- 1.1 "Software" refers to the NocoBase kernel and plugins placed in the same code repository as the kernel, including their source code, installation packages, images, and all their modifications, updates, and upgrades.
15
14
 
16
- 1.2 "Plugin Market" refers to the market provided by the Company for selling Software plugins and solutions.
15
+ 1.1 "Software" refers to the NocoBase kernel and plugins placed in the same code repository as the kernel, including their source code, installation packages, images, and all their modifications, updates, and upgrades.
17
16
 
18
- 1.3 "Commercial Plugin" refers to the paid plugins provided by the Plugin Market.
17
+ 1.2 "Marketplace" refers to the marketplace provided by the Company for selling Software plugins and solutions.
19
18
 
20
- 1.4 "Root Version" refers to the major version number before the first point in the version number. For example, from 1.0 to 1.x are all the same Root Version 1.
19
+ 1.3 "Commercial Plugin" refers to the paid plugins sold in the Marketplace.
21
20
 
22
- 1.5 "Plugin Package" is the unit for batch licensing Commercial Plugins. P5, P10, and P20 Plugin Packages include installation packages for 5, 10, and 20 Commercial Plugins respectively. P5+, P10+, P20+ provide the source code of the Plugins in addition to the installation packages.
21
+ 1.4 "Upper Layer Application" refers to a specific business use case application serving internal or external customers of the User, developed based on Software and Commercial Plugins, such as ERP/CRM.
23
22
 
24
- 1.6 "Upper Layer Application" refers to a specific business use case application serving internal or external customers of the User, developed based on Software and Commercial Plugins, such as ERP/CRM.
23
+ 1.5 "Customer" refers to the clients who purchase the User's Upper Layer Application.
25
24
 
26
- 1.7 "Third-Party Open Source Software" refers to open source software provided with Software and Commercial Plugins. They are licensed through various published open source software licenses or copyright notices accompanying such software.
25
+ 1.6 "Third-Party Open Source Software" refers to open source software provided with Software and Commercial Plugins. They are licensed through various published open source software licenses or copyright notices accompanying such software.
27
26
 
28
27
  ===================================
29
28
  2. Intellectual Property Protection
30
29
  ===================================
31
30
 
32
- Except for Third-Party Open Source Software, the Company owns all copyrights, trademark rights, patent rights, trade secrets, and other intellectual property rights of the Software and Commercial Plugins, and has registered and protected them in relevant countries and regions according to the "Paris Convention" or "TRIPS Agreement", ensuring that the intellectual property rights of the Software and Commercial Plugins are internationally recognized and protected.
31
+ Except for Third-Party Open Source Software, the Company owns all copyrights, trademark rights, patent rights, trade secrets, and other intellectual property rights of the Software, and has registered and protected them in relevant countries and regions according to the "Paris Convention" or "TRIPS Agreement", ensuring that the intellectual property rights of the Software and Commercial Plugins are internationally recognized and protected.
33
32
 
34
33
  =============
35
34
  3. Disclaimer
@@ -51,11 +50,11 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
51
50
  5. Rights and Obligations of Open Source License
52
51
  ================================================
53
52
 
54
- 5.1 The Software can be used for commercial purposes, such as developing applications for internal use within a company or for clients.
53
+ 5.1 The Software can be used for commercial purposes.
55
54
 
56
- 5.2 User can sell plugins developed for the Software in the Plugin Market.
55
+ 5.2 User can sell plugins developed for the Software in the Marketplace.
57
56
 
58
- 5.3 Outside the Plugin Market, changes and plugins to the Software developed by User or third parties, and third-party software integrated with the Software must all be open sourced under the AGPL-3.0 license.
57
+ 5.3 Outside the Marketplace, changes and plugins to the Software developed by User or third parties, and third-party applications developed based on the Software must all be open-sourced under the AGPL-3.0 license.
59
58
 
60
59
  5.4 It is not allowed to remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface, except for the main LOGO in the upper left corner of the page.
61
60
 
@@ -69,25 +68,23 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
69
68
  6. Rights of Commercial License
70
69
  ===============================
71
70
 
72
- 6.1 Obtain a permanent commercial license for a Root Version of the Software or Commercial Plugin.
73
-
74
- 6.2 Get 6 months of exclusive technical support.
71
+ 6.1 Obtain a permanent commercial license of the Software or Commercial Plugin.
75
72
 
76
- 6.3 Upgrade to the next Root Version at 50% of the contract price.
73
+ 6.2 Get 12 months of upgrade and exclusive technical support.
77
74
 
78
- 6.4 The licensed Software and Commercial Plugins can be used for commercial purposes, such as developing applications for internal use within a company or for clients, with no restrictions on the number of applications and users.
75
+ 6.3 The licensed Software and Commercial Plugins can be used for commercial purposes with no restrictions on the number of applications and users.
79
76
 
80
- 6.5 Changes and plugins to the Software, and applications integrated with the Software do not need to be open sourced.
77
+ 6.4 Changes and plugins to the Software, and applications integrated with the Software do not need to be open sourced.
81
78
 
82
- 6.6 Can remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface.
79
+ 6.5 Can remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface.
83
80
 
84
- 6.7 Can sell plugins developed for Software in the Plugin Market.
81
+ 6.6 Can sell plugins developed for Software in the Marketplace.
85
82
 
86
- 6.8 Can sell or provide Upper Layer Applications developed based on Software in the form of SaaS to the public.
83
+ 6.7 Can sell Upper Layer Applications developed based on Software to Customer who has obtained a commercial license.
87
84
 
88
- 6.9 Not restricted by the AGPL-3.0 agreement.
85
+ 6.8 Not restricted by the AGPL-3.0 agreement.
89
86
 
90
- 6.10 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
87
+ 6.9 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
91
88
 
92
89
  ====================================
93
90
  7. Obligations of Commercial License
@@ -97,15 +94,15 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
97
94
 
98
95
  7.2 It is not allowed to sell, transfer, lease, share, or give away the Commercial License.
99
96
 
100
- 7.3 It is not allowed to sell, transfer, lease, share, or give away any form of no-code, zero-code, low-code platform, or developer tools developed based on Software.
97
+ 7.3 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS products to the public using the original or modified Software.
101
98
 
102
- 7.4 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS products to the public using the original or modified Software.
99
+ 7.4 It is not allowed to sell Upper Layer Application to Customer who have not obtained a Commercial License.
103
100
 
104
101
  7.5 It is not allowed to use reverse engineering, decompilation, and other means to try to discover the source code of Commercial Plugins that have not obtained source code license.
105
102
 
106
103
  7.6 It is not allowed to disclose the source code of Commercial Plugins to any third party.
107
104
 
108
- 7.7 It is not allowed to publicly sell plugins developed for Software outside of the Plugin Market.
105
+ 7.7 It is not allowed to publicly sell plugins developed for Software outside of the Marketplace.
109
106
 
110
107
  7.8 If there is a violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
111
108
 
@@ -121,4 +118,4 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
121
118
 
122
119
  8.3 All terms and conditions of this Agreement shall be deemed enforceable to the maximum extent permitted by applicable law. If any term of this Agreement is deemed invalid by any applicable law, the invalidity of that term does not affect the validity of any other term of this Agreement, and it should be deemed that the invalid term has been modified as much as possible to make it valid and enforceable, or if the term cannot be modified, it should be deemed to have been deleted from this Agreement.
123
120
 
124
- 8.4 The arbitration award is final, binding on both parties, and can be enforced in any court with jurisdiction.
121
+ 8.4 The arbitration award is final, binding on both parties, and can be enforced in any court with jurisdiction.
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- (function(M,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("react"),require("@formily/react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("react-router-dom"),require("@formily/shared"),require("@formily/reactive"),require("@emotion/css"),require("@formily/core"),require("@formily/antd-v5"),require("lodash"),require("@dnd-kit/core"),require("antd-style"),require("@nocobase/utils/client")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","react","@formily/react","antd","react-i18next","@ant-design/icons","react-router-dom","@formily/shared","@formily/reactive","@emotion/css","@formily/core","@formily/antd-v5","lodash","@dnd-kit/core","antd-style","@nocobase/utils/client"],a):(M=typeof globalThis!="undefined"?globalThis:M||self,a(M["@nocobase/plugin-data-source-manager"]={},M.jsxRuntime,M["@nocobase/client"],M.react,M["@formily/react"],M.antd,M["react-i18next"],M["@ant-design/icons"],M["react-router-dom"],M["@formily/shared"],M["@formily/reactive"],M["@emotion/css"],M["@formily/core"],M["@formily/antd-v5"],M.lodash,M["@dnd-kit/core"],M["antd-style"],M["@nocobase/utils"]))})(this,function(M,a,r,p,w,v,N,W,L,B,dt,fe,ge,ae,Y,Q,Ro,en){"use strict";var Yf=Object.defineProperty,Jf=Object.defineProperties;var Zf=Object.getOwnPropertyDescriptors;var Ne=Object.getOwnPropertySymbols;var Jo=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable;var ut=(M,a,r)=>a in M?Yf(M,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):M[a]=r,T=(M,a)=>{for(var r in a||(a={}))Jo.call(a,r)&&ut(M,r,a[r]);if(Ne)for(var r of Ne(a))Zo.call(a,r)&&ut(M,r,a[r]);return M},K=(M,a)=>Jf(M,Zf(a));var pt=(M,a)=>{var r={};for(var p in M)Jo.call(M,p)&&a.indexOf(p)<0&&(r[p]=M[p]);if(M!=null&&Ne)for(var p of Ne(M))a.indexOf(p)<0&&Zo.call(M,p)&&(r[p]=M[p]);return r};var Xo=(M,a,r)=>(ut(M,typeof a!="symbol"?a+"":a,r),r);var D=(M,a,r)=>new Promise((p,w)=>{var v=L=>{try{W(r.next(L))}catch(B){w(B)}},N=L=>{try{W(r.throw(L))}catch(B){w(B)}},W=L=>L.done?p(L.value):Promise.resolve(L.value).then(v,N);W((r=r.apply(M,a)).next())});const k="data-source-manager";function tn(e,t={}){return r.i18n.t(e,K(T({},t),{ns:k}))}function on(){return N.useTranslation([k,"client"],{nsMode:"fallback"})}const nn=e=>{const t=w.useForm(),o=r.useActionContext(),n=r.useAPIClient(),{t:i}=N.useTranslation(),s=w.useField();return s.data=s.data||{},{run(){return D(this,null,function*(){yield t.submit();try{s.data.loading=!0;const{data:l}=yield n.resource("databaseServers").create({values:T({},t.values)});s.data.loading=!1,o.setVisible(!1),yield t.reset(),e==null||e(l==null?void 0:l.data),v.message.success(i("Saved successfully"))}catch(l){s.data.loading=!1,console.log(l)}})}}},mt=()=>{const e=w.useForm(),t=r.useAPIClient(),{t:o}=N.useTranslation(),n=w.useField();return n.data=n.data||{},{run(){return D(this,null,function*(){yield e.submit();try{n.data.loading=!0,yield t.resource("dataSources").testConnection({values:T({},e.values)}),n.data.loading=!1,v.message.success(o("Connection successful",{ns:k}))}catch(s){n.data.loading=!1,console.log(s)}})}}},rn=Object.freeze(Object.defineProperty({__proto__:null,useCreateDatabaseServer:nn,useTestConnectionAction:mt},Symbol.toStringTag,{value:"Module"})),Ae=p.createContext(null);Ae.displayName="DataSourceContext";const an=e=>{const[t,o]=p.useState(null);return a.jsx(Ae.Provider,{value:{dataSource:t,setDataSource:o},children:a.jsx(r.SchemaComponentOptions,{scope:rn,components:{},children:e.children})})};class yt extends r.DataSource{getDataSource(){return D(this,null,function*(){return(yield this.app.apiClient.request({url:`dataSources:get/${this.key}`,params:{appends:["collections"]}})).data.data})}}const ft=[{value:"loading",label:`{{t("Loading",{ns:"${k}"})}}`,color:"orange"},{value:"loading-failed",label:`{{t("Failed",{ns:"${k}"})}}`,color:"red"},{value:"loaded",label:`{{t("Loaded",{ns:"${k}"})}}`,color:"green"},{value:"reloading",label:`{{t("Reloading",{ns:"${k}"})}}`,color:"orange"}],gt={name:"collections-"+B.uid(),fields:[{type:"string",name:"key",interface:"input",uiSchema:{title:`{{t("Data source name",{ ns: "${k}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"displayName",interface:"input",uiSchema:{title:`{{t("Data source display name",{ ns: "${k}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Type", { ns: "${k}" })}}`,type:"string","x-component":"Select",enum:"{{types}}"}},{type:"string",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${k}" })}}`,type:"string","x-component":"Select",enum:ft}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},sn={type:"object",properties:{[B.uid()]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:gt,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:gt},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"},actionCallback:"{{ dataSourceDeleteCallback }}"}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateDatabaseConnectAction","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"key",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{key:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},displayName:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{},properties:{view:{type:"void",title:'{{t("View")}}',"x-component":"ViewDatabaseConnectionAction","x-component-props":{type:"primary"}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditDatabaseConnectionAction","x-component-props":{type:"primary"},"x-reactions":["{{useIsAbleDelete($self)}}"]},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{useDestroyAction}}"},"x-reactions":["{{useIsAbleDelete($self)}}"]}}}}}}}}}}},ht=()=>{const e=r.useApp(),{name:t}=L.useParams(),o=r.useCompile(),n=r.useDataSourceManager(),{displayName:i}=n.getDataSource(t)||{},{dataSource:s}=p.useContext(Ae),c=p.useMemo(()=>s||n.getDataSource(t),[s,t]),l=p.useMemo(()=>{const f=c==null?void 0:c.status,u=ft.find(y=>y.value===f),g=[{title:a.jsx(L.Link,{to:e.pluginSettingsManager.getRoutePath(k),children:tn("Data source manager")})}];return c&&g.push({title:a.jsxs(v.Space,{children:[a.jsx("span",{children:o(i)}),f&&a.jsx(v.Tag,{color:u==null?void 0:u.color,children:o(u==null?void 0:u.label)},f)]})}),g},[c]);return a.jsx(v.Breadcrumb,{separator:a.jsx(W.RightOutlined,{}),items:l})},Ct=({collectionName:e})=>{const t=r.useApp(),{name:o="main"}=L.useParams(),n=p.useMemo(()=>t.getCollectionManager(o).getCollection(e),[t,o,e]);return!(n!=null&&n.filterTargetKey)&&a.jsx(v.Alert,{style:{marginBottom:16},type:"warning",message:a.jsx(xt,{})})},cn={association:{sourceKey:"name",targetKey:"name"},collection:{name:"fields",fields:[{type:"string",name:"type",interface:"input",uiSchema:{title:'{{ t("Storage type") }}',type:"string","x-component":"Select",enum:[{label:"String",value:"string"}],required:!0}},{type:"string",name:"interface",interface:"input",uiSchema:{title:'{{ t("Field interface") }}',type:"string","x-component":"Select",enum:"{{interfaces}}"}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{ t("Field display name") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Field name") }}',type:"string","x-component":"Input"}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input.TextArea"}}]},request:{resource:"collections.fields",action:"list",params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}}},$e=p.createContext(null),ln=e=>a.jsx($e.Provider,{value:r.useResourceActionContext(),children:a.jsx(r.ResourceActionProvider,K(T({},cn),{children:e.children}))}),un=fe.css`
10
+ (function(M,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("react"),require("@formily/react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("react-router-dom"),require("@formily/shared"),require("@formily/reactive"),require("@emotion/css"),require("@formily/core"),require("@formily/antd-v5"),require("lodash"),require("@dnd-kit/core"),require("antd-style"),require("@nocobase/utils/client")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","react","@formily/react","antd","react-i18next","@ant-design/icons","react-router-dom","@formily/shared","@formily/reactive","@emotion/css","@formily/core","@formily/antd-v5","lodash","@dnd-kit/core","antd-style","@nocobase/utils/client"],a):(M=typeof globalThis!="undefined"?globalThis:M||self,a(M["@nocobase/plugin-data-source-manager"]={},M.jsxRuntime,M["@nocobase/client"],M.react,M["@formily/react"],M.antd,M["react-i18next"],M["@ant-design/icons"],M["react-router-dom"],M["@formily/shared"],M["@formily/reactive"],M["@emotion/css"],M["@formily/core"],M["@formily/antd-v5"],M.lodash,M["@dnd-kit/core"],M["antd-style"],M["@nocobase/utils"]))})(this,function(M,a,r,d,_,v,N,W,L,B,dt,fe,ge,ae,Y,Q,Ro,en){"use strict";var Yf=Object.defineProperty,Jf=Object.defineProperties;var Zf=Object.getOwnPropertyDescriptors;var Ne=Object.getOwnPropertySymbols;var Jo=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable;var ut=(M,a,r)=>a in M?Yf(M,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):M[a]=r,A=(M,a)=>{for(var r in a||(a={}))Jo.call(a,r)&&ut(M,r,a[r]);if(Ne)for(var r of Ne(a))Zo.call(a,r)&&ut(M,r,a[r]);return M},K=(M,a)=>Jf(M,Zf(a));var pt=(M,a)=>{var r={};for(var d in M)Jo.call(M,d)&&a.indexOf(d)<0&&(r[d]=M[d]);if(M!=null&&Ne)for(var d of Ne(M))a.indexOf(d)<0&&Zo.call(M,d)&&(r[d]=M[d]);return r};var Xo=(M,a,r)=>(ut(M,typeof a!="symbol"?a+"":a,r),r);var D=(M,a,r)=>new Promise((d,_)=>{var v=L=>{try{W(r.next(L))}catch(B){_(B)}},N=L=>{try{W(r.throw(L))}catch(B){_(B)}},W=L=>L.done?d(L.value):Promise.resolve(L.value).then(v,N);W((r=r.apply(M,a)).next())});const j="data-source-manager";function tn(e,t={}){return r.i18n.t(e,K(A({},t),{ns:j}))}function on(){return N.useTranslation([j,"client"],{nsMode:"fallback"})}const nn=e=>{const t=_.useForm(),o=r.useActionContext(),n=r.useAPIClient(),{t:i}=N.useTranslation(),s=_.useField();return s.data=s.data||{},{run(){return D(this,null,function*(){yield t.submit();try{s.data.loading=!0;const{data:l}=yield n.resource("databaseServers").create({values:A({},t.values)});s.data.loading=!1,o.setVisible(!1),yield t.reset(),e==null||e(l==null?void 0:l.data),v.message.success(i("Saved successfully"))}catch(l){s.data.loading=!1,console.log(l)}})}}},mt=()=>{const e=_.useForm(),t=r.useAPIClient(),{t:o}=N.useTranslation(),n=_.useField();return n.data=n.data||{},{run(){return D(this,null,function*(){yield e.submit();try{n.data.loading=!0,yield t.resource("dataSources").testConnection({values:A({},e.values)}),n.data.loading=!1,v.message.success(o("Connection successful",{ns:j}))}catch(s){n.data.loading=!1,console.log(s)}})}}},rn=Object.freeze(Object.defineProperty({__proto__:null,useCreateDatabaseServer:nn,useTestConnectionAction:mt},Symbol.toStringTag,{value:"Module"})),Ae=d.createContext(null);Ae.displayName="DataSourceContext";const an=e=>{const[t,o]=d.useState(null);return a.jsx(Ae.Provider,{value:{dataSource:t,setDataSource:o},children:a.jsx(r.SchemaComponentOptions,{scope:rn,components:{},children:e.children})})};class yt extends r.DataSource{getDataSource(){return D(this,null,function*(){return(yield this.app.apiClient.request({url:`dataSources:get/${this.key}`,params:{appends:["collections"]}})).data.data})}}const ft=[{value:"loading",label:`{{t("Loading",{ns:"${j}"})}}`,color:"orange"},{value:"loading-failed",label:`{{t("Failed",{ns:"${j}"})}}`,color:"red"},{value:"loaded",label:`{{t("Loaded",{ns:"${j}"})}}`,color:"green"},{value:"reloading",label:`{{t("Reloading",{ns:"${j}"})}}`,color:"orange"}],gt={name:"collections-"+B.uid(),fields:[{type:"string",name:"key",interface:"input",uiSchema:{title:`{{t("Data source name",{ ns: "${j}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"displayName",interface:"input",uiSchema:{title:`{{t("Data source display name",{ ns: "${j}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Type", { ns: "${j}" })}}`,type:"string","x-component":"Select",enum:"{{types}}"}},{type:"string",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${j}" })}}`,type:"string","x-component":"Select",enum:ft}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},sn={type:"object",properties:{[B.uid()]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:gt,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:gt},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"},actionCallback:"{{ dataSourceDeleteCallback }}"}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateDatabaseConnectAction","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"key",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{key:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},displayName:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{},properties:{view:{type:"void",title:'{{t("View")}}',"x-component":"ViewDatabaseConnectionAction","x-component-props":{type:"primary"}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditDatabaseConnectionAction","x-component-props":{type:"primary"},"x-reactions":["{{useIsAbleDelete($self)}}"]},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{useDestroyAction}}"},"x-reactions":["{{useIsAbleDelete($self)}}"]}}}}}}}}}}},ht=()=>{const e=r.useApp(),{name:t}=L.useParams(),o=r.useCompile(),n=r.useDataSourceManager(),{displayName:i}=n.getDataSource(t)||{},{dataSource:s}=d.useContext(Ae),c=d.useMemo(()=>s||n.getDataSource(t),[s,t]),l=d.useMemo(()=>{const m=c==null?void 0:c.status,u=ft.find(f=>f.value===m),g=[{title:a.jsx(L.Link,{to:e.pluginSettingsManager.getRoutePath(j),children:tn("Data source manager")})}];return c&&g.push({title:a.jsxs(v.Space,{children:[a.jsx("span",{children:o(i)}),m&&a.jsx(v.Tag,{color:u==null?void 0:u.color,children:o(u==null?void 0:u.label)},m)]})}),g},[c]);return a.jsx(v.Breadcrumb,{separator:a.jsx(W.RightOutlined,{}),items:l})},Ct=({collectionName:e})=>{const t=r.useApp(),{name:o="main"}=L.useParams(),n=d.useMemo(()=>t.getCollectionManager(o).getCollection(e),[t,o,e]);return!(n!=null&&n.filterTargetKey)&&a.jsx(v.Alert,{style:{marginBottom:16},type:"warning",message:a.jsx(xt,{})})},cn={association:{sourceKey:"name",targetKey:"name"},collection:{name:"fields",fields:[{type:"string",name:"type",interface:"input",uiSchema:{title:'{{ t("Storage type") }}',type:"string","x-component":"Select",enum:[{label:"String",value:"string"}],required:!0}},{type:"string",name:"interface",interface:"input",uiSchema:{title:'{{ t("Field interface") }}',type:"string","x-component":"Select",enum:"{{interfaces}}"}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{ t("Field display name") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Field name") }}',type:"string","x-component":"Input"}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input.TextArea"}}]},request:{resource:"collections.fields",action:"list",params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}}},$e=d.createContext(null),ln=e=>a.jsx($e.Provider,{value:r.useResourceActionContext(),children:a.jsx(r.ResourceActionProvider,K(A({},cn),{children:e.children}))}),un=fe.css`
11
11
  .ant-table {
12
12
  margin-left: -16px !important;
13
13
  }
@@ -32,23 +32,23 @@
32
32
  min-width: 50px;
33
33
  flex: 0;
34
34
  }
35
- `,vt="Default title for each record",dn=e=>{const t=r.useCompile(),{getInterface:o}=r.useCollectionManager_deprecated(),{t:n}=N.useTranslation(),{setState:i}=r.useResourceActionContext(),{targetKey:s}=e.collectionResource||{},c=r.useRecord(),[l,f]=p.useState(null),{refreshCM:u,isTitleField:g,getTemplate:y}=r.useCollectionManager_deprecated(),{[s]:b,titleField:_,template:S}=c,$=y(S),x=r.useAPIClient(),d=p.useContext($e),h=[{dataIndex:["uiSchema","title"],title:n("Field display name"),render:m=>a.jsx("div",{style:{marginLeft:7},children:t(m)})},{dataIndex:"name",title:n("Field name")},{dataIndex:"interface",title:n("Field interface"),render:m=>{var C;return a.jsx(v.Tag,{children:t((C=o(m))==null?void 0:C.title)})}},{dataIndex:"titleField",title:n("Title field"),render:function(C,F){const j=E=>D(this,null,function*(){var I;f(F),yield x.request({url:`collections:update?filterByTk=${b}`,method:"post",data:{titleField:E?F.name:"id"}}),(I=d==null?void 0:d.refresh)==null||I.call(d),yield e.refreshAsync(),f(null),u(),v.message.success(n("Saved successfully"))});return g(F)?a.jsx(v.Tooltip,{title:n(vt),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(v.Switch,{"aria-label":`switch-title-field-${F.name}`,size:"small",loading:F.name===(l==null?void 0:l.name),checked:F.name===(_||"id"),onChange:j})}):null}},{dataIndex:"description",title:n("Descriptio "),render:m=>a.jsx(r.Input.ReadPretty,{value:m,ellipsis:!0})},{dataIndex:"actions",title:n("Actions"),render:(m,C)=>{const F={confirm:{title:n("Delete record"),content:n("Are you sure you want to delete it?")},useAction:r.useDestroyActionAndRefreshCM,disabled:r.isDeleteButtonDisabled(C)||($==null?void 0:$.forbidDeletion),title:n("Delete")};return a.jsx(r.RecordProvider,{record:C,parent:c,children:a.jsxs(v.Space,{children:[a.jsx(r.EditCollectionField,{role:"button","aria-label":`edit-button-${C.name}`,type:"primary"}),a.jsx(r.Action.Link,T({},F))]})})}}];return a.jsx(v.Table,{rowKey:"name",columns:h,showHeader:!1,pagination:!1,dataSource:e.fields,rowSelection:{type:"checkbox",getCheckboxProps(m){return{"aria-label":`checkbox-${m.name}`}},onChange:m=>{i(C=>K(T({},C),{selectedRowKeys:m}))}},className:un})},mn=e=>{const t=r.useCompile(),{getInterface:o}=r.useCollectionManager_deprecated(),{targetKey:n}=e.collectionResource||{},i=r.useRecord(),[s,c]=p.useState(null),{t:l}=N.useTranslation(),{refreshCM:f,isTitleField:u}=r.useCollectionManager_deprecated(),{[n]:g,titleField:y,name:b}=i,_=p.useContext($e),S=r.useAPIClient(),$=[{dataIndex:["uiSchema","rawTitle"],title:l("Field display name"),render:x=>a.jsx("div",{style:{marginLeft:1},children:t(x)})},{dataIndex:"name",title:l("Field name")},{dataIndex:"interface",title:l("Field interface"),render:x=>{var d;return a.jsx(v.Tag,{children:t((d=o(x))==null?void 0:d.title)})}},{dataIndex:"titleField",title:l("Title field"),render(x,d){const h=m=>D(this,null,function*(){var C;c(d),yield S.request({url:`collections:update?filterByTk=${g}`,method:"post",data:{titleField:m?d.name:"id"}}),(C=_==null?void 0:_.refresh)==null||C.call(_),yield e.refreshAsync(),c(null),f(),v.message.success(l("Saved successfully"))});return u(d)?a.jsx(v.Tooltip,{title:l(vt),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(v.Switch,{size:"small",loading:d.name===(s==null?void 0:s.name),checked:d.name===(y||"id"),onChange:h})}):null}},{dataIndex:"actions",title:l("Actions"),render:function(d,h){const m={type:"primary",currentCollection:b},C={type:"primary"};return a.jsx(r.RecordProvider,{record:h,parent:i,children:a.jsxs(v.Space,{children:[a.jsx(r.OverridingCollectionField,T({},m)),a.jsx(r.ViewCollectionField,T({},C))]})})}}];return a.jsx(v.Table,{rowKey:"name",columns:$,showHeader:!1,pagination:!1,dataSource:e.fields.filter(x=>x.interface)})},yn=()=>{const e=r.useCompile(),t=w.useField(),{name:o,template:n}=r.useRecord(),{data:{database:i}}=r.useCurrentAppInfo(),{getInterface:s,getInheritCollections:c,getCollection:l,getTemplate:f}=r.useCollectionManager_deprecated(),u=p.useMemo(()=>ge.createForm(),[]),g=r.useAttach(u.createArrayField(K(T({},t.props),{basePath:""}))),{t:y}=N.useTranslation(),b=r.useResourceContext(),{refreshAsync:_,data:S}=p.useContext(r.ResourceActionContext),$=f(n),x=c(o),d=[{dataIndex:"title",title:y("Field display name"),render:I=>a.jsx("div",{className:fe.css`
35
+ `,vt="Default title for each record",dn=e=>{const t=r.useCompile(),{getInterface:o}=r.useCollectionManager_deprecated(),{t:n}=N.useTranslation(),{setState:i}=r.useResourceActionContext(),{targetKey:s}=e.collectionResource||{},c=r.useRecord(),[l,m]=d.useState(null),{refreshCM:u,isTitleField:g,getTemplate:f}=r.useCollectionManager_deprecated(),{[s]:b,titleField:P,template:T}=c,$=f(T),x=r.useAPIClient(),y=d.useContext($e),h=[{dataIndex:["uiSchema","title"],title:n("Field display name"),render:p=>a.jsx("div",{style:{marginLeft:7},children:t(p)})},{dataIndex:"name",title:n("Field name")},{dataIndex:"interface",title:n("Field interface"),render:p=>{var C;return a.jsx(v.Tag,{children:t((C=o(p))==null?void 0:C.title)})}},{dataIndex:"titleField",title:n("Title field"),render:function(C,F){const E=k=>D(this,null,function*(){var I;m(F),yield x.request({url:`collections:update?filterByTk=${b}`,method:"post",data:{titleField:k?F.name:"id"}}),(I=y==null?void 0:y.refresh)==null||I.call(y),yield e.refreshAsync(),m(null),u(),v.message.success(n("Saved successfully"))});return g(F)?a.jsx(v.Tooltip,{title:n(vt),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(v.Switch,{"aria-label":`switch-title-field-${F.name}`,size:"small",loading:F.name===(l==null?void 0:l.name),checked:F.name===(P||"id"),onChange:E})}):null}},{dataIndex:"description",title:n("Descriptio "),render:p=>a.jsx(r.Input.ReadPretty,{value:p,ellipsis:!0})},{dataIndex:"actions",title:n("Actions"),render:(p,C)=>{const F={confirm:{title:n("Delete record"),content:n("Are you sure you want to delete it?")},useAction:r.useDestroyActionAndRefreshCM,disabled:r.isDeleteButtonDisabled(C)||($==null?void 0:$.forbidDeletion),title:n("Delete")};return a.jsx(r.RecordProvider,{record:C,parent:c,children:a.jsxs(v.Space,{children:[a.jsx(r.EditCollectionField,{role:"button","aria-label":`edit-button-${C.name}`,type:"primary"}),a.jsx(r.Action.Link,A({},F))]})})}}];return a.jsx(v.Table,{rowKey:"name",columns:h,showHeader:!1,pagination:!1,dataSource:e.fields,rowSelection:{type:"checkbox",getCheckboxProps(p){return{"aria-label":`checkbox-${p.name}`}},onChange:p=>{i(C=>K(A({},C),{selectedRowKeys:p}))}},className:un})},mn=e=>{const t=r.useCompile(),{getInterface:o}=r.useCollectionManager_deprecated(),{targetKey:n}=e.collectionResource||{},i=r.useRecord(),[s,c]=d.useState(null),{t:l}=N.useTranslation(),{refreshCM:m,isTitleField:u}=r.useCollectionManager_deprecated(),{[n]:g,titleField:f,name:b}=i,P=d.useContext($e),T=r.useAPIClient(),$=[{dataIndex:["uiSchema","rawTitle"],title:l("Field display name"),render:x=>a.jsx("div",{style:{marginLeft:1},children:t(x)})},{dataIndex:"name",title:l("Field name")},{dataIndex:"interface",title:l("Field interface"),render:x=>{var y;return a.jsx(v.Tag,{children:t((y=o(x))==null?void 0:y.title)})}},{dataIndex:"titleField",title:l("Title field"),render(x,y){const h=p=>D(this,null,function*(){var C;c(y),yield T.request({url:`collections:update?filterByTk=${g}`,method:"post",data:{titleField:p?y.name:"id"}}),(C=P==null?void 0:P.refresh)==null||C.call(P),yield e.refreshAsync(),c(null),m(),v.message.success(l("Saved successfully"))});return u(y)?a.jsx(v.Tooltip,{title:l(vt),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(v.Switch,{size:"small",loading:y.name===(s==null?void 0:s.name),checked:y.name===(f||"id"),onChange:h})}):null}},{dataIndex:"actions",title:l("Actions"),render:function(y,h){const p={type:"primary",currentCollection:b},C={type:"primary"};return a.jsx(r.RecordProvider,{record:h,parent:i,children:a.jsxs(v.Space,{children:[a.jsx(r.OverridingCollectionField,A({},p)),a.jsx(r.ViewCollectionField,A({},C))]})})}}];return a.jsx(v.Table,{rowKey:"name",columns:$,showHeader:!1,pagination:!1,dataSource:e.fields.filter(x=>x.interface)})},yn=()=>{const e=r.useCompile(),t=_.useField(),{name:o,template:n}=r.useRecord(),{data:{database:i}}=r.useCurrentAppInfo(),{getInterface:s,getInheritCollections:c,getCollection:l,getTemplate:m}=r.useCollectionManager_deprecated(),u=d.useMemo(()=>ge.createForm(),[]),g=r.useAttach(u.createArrayField(K(A({},t.props),{basePath:""}))),{t:f}=N.useTranslation(),b=r.useResourceContext(),{refreshAsync:P,data:T}=d.useContext(r.ResourceActionContext),$=m(n),x=c(o),y=[{dataIndex:"title",title:f("Field display name"),render:I=>a.jsx("div",{className:fe.css`
36
36
  font-weight: 500;
37
- `,children:I})},{dataIndex:"name",title:y("Field name")},{dataIndex:"interface",title:y("Field interface")},{dataIndex:"titleField",title:y("Title field")},{dataIndex:"description",title:y("Description")},{dataIndex:"actions",title:y("Actions")}],h=(S==null?void 0:S.data)||[],m={pf:[],association:[],general:[],system:[]};h.forEach(I=>{if(I.primaryKey||I.isForeignKey)m.pf.push(I);else if(I.interface){const V=s(I.interface);(V==null?void 0:V.group)==="systemInfo"?m.system.push(I):(V==null?void 0:V.group)==="relation"?m.association.push(I):m.general.push(I)}});const C=[{key:"pf",title:y("PK & FK fields"),fields:m.pf},{key:"association",title:y("Association fields"),fields:m.association},{key:"general",title:y("General fields"),fields:m.general},{key:"system",title:y("System fields"),fields:m.system}];C.push(...x.map(I=>{const V=l(I);if(V)return{key:I,title:`${y("Inherited fields")} - `+e(V==null?void 0:V.title),inherit:!0,fields:(V==null?void 0:V.fields)||[]}}).filter(Boolean));const F=p.useMemo(()=>({useAction:()=>r.useBulkDestroyActionAndRefreshCM(!0),title:y("Delete"),icon:"DeleteOutlined",disabled:$==null?void 0:$.forbidDeletion,confirm:{title:y("Delete record"),content:y("Are you sure you want to delete it?")}}),[y]),j={type:"primary",database:i},E={type:"primary"};return a.jsx(w.FormContext.Provider,{value:u,children:a.jsxs(w.FieldContext.Provider,{value:g,children:[a.jsx(Ct,{collectionName:o}),a.jsxs(v.Space,{align:"end",className:fe.css`
37
+ `,children:I})},{dataIndex:"name",title:f("Field name")},{dataIndex:"interface",title:f("Field interface")},{dataIndex:"titleField",title:f("Title field")},{dataIndex:"description",title:f("Description")},{dataIndex:"actions",title:f("Actions")}],h=(T==null?void 0:T.data)||[],p={pf:[],association:[],general:[],system:[]};h.forEach(I=>{if(I.primaryKey||I.isForeignKey)p.pf.push(I);else if(I.interface){const V=s(I.interface);(V==null?void 0:V.group)==="systemInfo"?p.system.push(I):(V==null?void 0:V.group)==="relation"?p.association.push(I):p.general.push(I)}});const C=[{key:"pf",title:f("PK & FK fields"),fields:p.pf},{key:"association",title:f("Association fields"),fields:p.association},{key:"general",title:f("General fields"),fields:p.general},{key:"system",title:f("System fields"),fields:p.system}];C.push(...x.map(I=>{const V=l(I);if(V)return{key:I,title:`${f("Inherited fields")} - `+e(V==null?void 0:V.title),inherit:!0,fields:(V==null?void 0:V.fields)||[]}}).filter(Boolean));const F=d.useMemo(()=>({useAction:()=>r.useBulkDestroyActionAndRefreshCM(!0),title:f("Delete"),icon:"DeleteOutlined",disabled:$==null?void 0:$.forbidDeletion,confirm:{title:f("Delete record"),content:f("Are you sure you want to delete it?")}}),[f]),E={type:"primary",database:i},k={type:"primary"};return a.jsx(_.FormContext.Provider,{value:u,children:a.jsxs(_.FieldContext.Provider,{value:g,children:[a.jsx(Ct,{collectionName:o}),a.jsxs(v.Space,{align:"end",className:fe.css`
38
38
  justify-content: flex-end;
39
39
  display: flex;
40
40
  margin-bottom: 16px;
41
- `,children:[a.jsx(r.Action,T({},F)),a.jsx(r.SyncFieldsAction,T({},E)),a.jsx(r.SyncSQLFieldsAction,{refreshCMList:_}),a.jsx(r.SchemaComponent,{schema:{type:"object",properties:T({},$.configureActions)}}),a.jsx(r.AddCollectionField,T({},j))]}),a.jsx(v.Table,{rowKey:"key",columns:d,dataSource:C.filter(I=>I.fields.length),pagination:!1,className:pn,expandable:{defaultExpandAllRows:!0,defaultExpandedRowKeys:C.map(I=>I.key),expandedRowRender:I=>I.inherit?a.jsx(mn,{fields:I.fields,collectionResource:b,refreshAsync:_}):a.jsx(dn,{fields:I.fields,collectionResource:b,refreshAsync:_})}})]})})},bt=()=>a.jsx(ln,{children:a.jsx(yn,{})}),xt=e=>{const{size:t,style:o}=e,n=r.useAPIClient(),{name:i="main"}=L.useParams(),s=r.useCollectionRecordData(),c=r.useApp(),[l,f]=p.useState(),[u,g]=p.useState(),y=r.useCompile(),b=p.useMemo(()=>c.getCollectionManager(i).getCollection(s.name),[c,i,s.name]),_=p.useMemo(()=>c.getCollectionManager(i).getCollectionFields(s.name).filter(m=>m.interface?!!c.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(m.interface).titleUsable:!1).map(m=>{var C;return{label:y((C=m.uiSchema)==null?void 0:C.title),value:m.name}}),[c,y,i,s.name]),{refresh:S}=r.useResourceActionContext(),$=p.useContext($e),{t:x}=on();return a.jsxs("div",{style:T({},o),children:[x("If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection."),t==="small"?a.jsx("br",{}):" ",a.jsxs(v.Space.Compact,{style:{marginTop:5},children:[a.jsx(v.Select,{onChange:(d,h)=>{f(d),g(h.label)},placeholder:x("Select field"),size:"small",options:_}),a.jsx(v.Popconfirm,{placement:"bottom",title:a.jsx("div",{style:{width:"15em"},children:u?x(`Are you sure you want to set the "{{title}}" field as a record unique key? This setting cannot be changed after it's been set.`,{title:u}):x("Please select a field.")}),onConfirm:()=>D(this,null,function*(){var d;l&&(i==="main"?yield n.request({url:`collections:update?filterByTk=${s.name}`,method:"post",data:{filterTargetKey:l}}):yield n.request({url:`dataSources/${i}/collections:update?filterByTk=${s.name}`,method:"post",data:{filterTargetKey:l}}),(d=$==null?void 0:$.refresh)==null||d.call($),S(),b.setOption("filterTargetKey",l))}),children:a.jsx(v.Button,{type:"primary",size:"small",children:x("OK")})})]})]})},St=e=>{const t=r.useCollectionRecordData()||{},o=r.useCompile();return w.useField().editable?a.jsx(r.Input,T({},e)):t!=null&&t.filterTargetKey?o(t.title):a.jsxs("div",{style:{display:"inline"},children:[a.jsx(v.Popover,{trigger:["click"],content:a.jsx(xt,{size:"small",style:{width:"20em"}}),children:a.jsx(W.ExclamationCircleTwoTone,{style:{marginRight:"0.3em"},twoToneColor:"#faad14"})}),o(t.title)]})},At=e=>w.Schema.compile(e,{t:r.i18n.t}),fn={name:"database-"+B.uid(),filterTargetKey:"name",targetKey:"name",sortable:!0,fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{ t("Collection display name") }}',type:"number","x-component":St,required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Collection name") }}',type:"string","x-component":"CollectionName",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}},{type:"hasMany",name:"inherits",interface:"select",uiSchema:{title:'{{ t("Inherits") }}',type:"string","x-component":"Select","x-component-props":{mode:"multiple"}}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input"}}]},gn=e=>({type:"object",properties:{[B.uid()]:{type:"void","x-collection":"dataSources","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:fn,dragSort:!1,request:{url:`dataSources/${e}/collections:list`,params:{pageSize:50,sort:"sort",filter:{"hidden.$isFalsy":!0},appends:["category"]}}},properties:{tabs:{type:"void","x-component":"ConfigurationTabs"}}}}}),Be={type:"object",properties:{[B.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button",isBulk:!0},"x-visible":"{{allowCollectionDeletion}}"},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"},"x-visible":"{{allowCollectionCreate}}"}}},[B.uid()]:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{cm.useDataSourceFromRAC }}",useAction(){const e=r.useAPIClient(),{t}=N.useTranslation();return{move(n,i){return D(this,null,function*(){yield e.resource("dataSources").move({sourceId:n.key,targetId:i.key}),v.message.success(t("Saved successfully"),.2)})}}}},properties:{column1:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},column6:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{ t("Configure fields") }}',"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{destroyOnClose:!0,width:"70%"},"x-reactions":e=>{const t=e.path.segments[1],o=e.path.segments[0],n=e.form.getValuesIn(`${o}.${t}`);n&&(e.title=`${At(n.title||n.name)} - ${At('{{ t("Configure fields") }}')}`)},properties:{collectionFields:{type:"void","x-component":"CollectionFields"}}}},"x-hidden":"{{disabledConfigureFields}}"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollection","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-visible":"{{allowCollectionDeletion}}","x-component":"DeleteCollection","x-component-props":{role:"button","aria-label":'{{ "delete-button-" + $record.name }}',type:"primary",className:"nb-action-link"}}}}}}}}}},Te=["string","bigInt","integer","uuid","uid"],hn=w.observer(e=>{var u,g;const{name:t}=L.useParams(),{collectionName:o,sourceKey:n,name:i}=r.useRecord(),s=w.useField(),c=r.useCompile(),{getCollection:l}=r.useCollectionManager_deprecated(),f=(u=l(o||i,t).fields)==null?void 0:u.filter(y=>y.primaryKey||y.unique).map(y=>{var b;return{value:y.name,label:c(((b=y.uiSchema)==null?void 0:b.title)||y.title||y.name)}});return p.useEffect(()=>{var y;s.initialValue=((y=f==null?void 0:f[0])==null?void 0:y.value)||n},[]),a.jsx("div",{children:a.jsx(v.Select,{disabled:n,options:f,defaultValue:((g=f==null?void 0:f[0])==null?void 0:g.value)||n,onChange:e==null?void 0:e.onChange,showSearch:!0})})},{displayName:"SourceKey"}),$t=w.observer(e=>{const{disabled:t}=e,o=r.useAPIClient(),[n,i]=p.useState([]),{name:s}=L.useParams(),c=r.useRecord(),l=w.useField(),{collectionName:f,target:u,type:g,through:y,name:b}=c,_=c[l.props.name],{getCollection:S}=r.useCollectionManager_deprecated(),$=r.useCompile(),x=w.useForm(),[d,h]=p.useState(_);return p.useEffect(()=>{var F;l.initialValue=null;const m=["belongsTo"].includes(g)?f:["belongsToMany"].includes(g)?y:u,C=(F=S(m,s))==null?void 0:F.fields;if(C){const j=C==null?void 0:C.filter(E=>Te.includes(E.type)).map(E=>{var I;return{value:E.name,label:$(((I=E.uiSchema)==null?void 0:I.title)||E.title||E.name)}});if(i(j),_){const E=j.find(I=>I.value===_);h((E==null?void 0:E.label)||_)}}},[g]),p.useEffect(()=>{h(_)},[_]),a.jsx("div",{children:a.jsx(v.Select,{disabled:t,value:d,options:n,showSearch:!0,onDropdownVisibleChange:m=>D(this,null,function*(){var I;const{target:C,type:F,through:j}=x.values,E=["belongsTo"].includes(F)?f||b:["belongsToMany"].includes(F)?j:C;if(E&&m){const{data:V}=yield o.request({url:`dataSourcesCollections/${s}.${E}/fields:list`,params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}});i((I=V.data)==null?void 0:I.filter(A=>Te.includes(A.type)).map(A=>{var P;return{value:A.name,label:$(((P=A.uiSchema)==null?void 0:P.title)||A.title||A.name)}}))}}),onChange:m=>{var C;(C=e==null?void 0:e.onChange)==null||C.call(e,m),h(m)}})})},{displayName:"ForeignKey"}),Cn=w.observer(e=>{const{value:t,disabled:o}=e,{targetKey:n,target:i,type:s}=r.useRecord(),{name:c}=L.useParams(),{getCollection:l}=r.useCollectionManager_deprecated(),f=r.useAPIClient(),[u,g]=p.useState([]),[y,b]=p.useState(t||n),_=w.useForm(),S=r.useCompile(),$=w.useField();return $.required=!0,p.useEffect(()=>{var x;i&&g((x=l(i,c).fields)==null?void 0:x.filter(d=>s!=="hasMany"?d.primaryKey||d.unique:Te.includes(d.type)).map(d=>{var h;return{value:d.name,label:S(((h=d==null?void 0:d.uiSchema)==null?void 0:h.title)||d.title||d.name)}}))},[]),a.jsx("div",{children:a.jsx(v.Select,{showSearch:!0,options:u,onDropdownVisibleChange:x=>D(this,null,function*(){var m;const{target:d,type:h}=_.values;if(d&&x){const{data:C}=yield f.request({url:`dataSourcesCollections/${c}.${d}/fields:list`,params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}});g((m=C.data)==null?void 0:m.filter(F=>h!=="hasMany"?F.primaryKey||F.unique:Te.includes(F.type)).map(F=>{var j;return{value:F.name,label:S(((j=F.uiSchema)==null?void 0:j.title)||F.title||F.name)}}))}}),onChange:x=>{var d;(d=e==null?void 0:e.onChange)==null||d.call(e,x),b(x)},value:y,disabled:o})})},{displayName:"TargetKey"}),vn=w.observer(()=>{const e=r.useCompile(),{targetCollection:t}=ct();return a.jsx("div",{children:a.jsx(v.Select,{disabled:!0,showSearch:!0,popupMatchSelectWidth:!1,value:t.name,options:[{value:t.name,label:e(t.title||t.name)}]})})},{displayName:"SourceCollection"}),bn=w.observer(e=>{const{disabled:t}=e,o=r.useCompile(),[n,i]=p.useState([]),{name:s}=L.useParams(),c=w.useField(),{getCollections:l}=r.useCollectionManager_deprecated(s),u=r.useRecord()[c.props.name],g=()=>l().filter(b=>!(b.autoCreate&&b.isThrough)).map(b=>({label:o(b.title||b.name),value:b.name}));return p.useEffect(()=>{const y=g();i(y)},[]),a.jsx("div",{children:a.jsx(v.Select,{disabled:t,showSearch:!0,popupMatchSelectWidth:!1,fieldNames:{label:"label",value:"value"},defaultValue:u,options:n,onChange:y=>{var b;(b=e==null?void 0:e.onChange)==null||b.call(e,y)}})})},{displayName:"ThroughCollection"}),xn=(e,t,o)=>{var s;if(!e)return;const n=Y.cloneDeep(e.properties);n!=null&&n.foreignKey&&(n.foreignKey["x-component"]=$t),e.hasDefaultValue===!0&&(n.defaultValue=Y.cloneDeep((s=e==null?void 0:e.default)==null?void 0:s.uiSchema),n.defaultValue.required=!1,n.defaultValue.title=o('{{ t("Default value") }}'),n.defaultValue["x-decorator"]="FormItem",n.defaultValue["x-reactions"]={dependencies:["uiSchema.x-component-props.gmt","uiSchema.x-component-props.showTime","uiSchema.x-component-props.dateFormat","uiSchema.x-component-props.timeFormat"],fulfill:{state:{componentProps:{gmt:"{{$deps[0]}}",showTime:"{{$deps[1]}}",dateFormat:"{{$deps[2]}}",timeFormat:"{{$deps[3]}}"}}}});const i=K(T({name:`f_${B.uid()}`},Y.cloneDeep(e.default)),{interface:e.name});return i.reverseField&&(i.reverseField.name=`f_${B.uid()}`),{type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues(c){return r.useRequest(()=>Promise.resolve({data:i}),c)}},title:`${o(t.title||t.name)} - ${o('{{ t("Add field") }}')}`,properties:K(T({summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}}},n),{description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateCollectionField }}"}}}}})}}}},Sn=()=>{const e=w.useForm(),t=r.useActionContext(),{refresh:o}=r.useResourceActionContext(),n=w.useField(),i=r.useAPIClient(),s=r.useRecord(),{name:c}=L.useParams(),l=r.useDataSourceManager();return{run(){return D(this,null,function*(){yield e.submit(),n.data=n.data||{},n.data.loading=!0;const u=Y.cloneDeep(e.values);u.autoCreateReverseField||delete u.reverseField,delete u.autoCreateReverseField;try{yield i.request({url:`dataSourcesCollections/${c}.${s.name}/fields:create`,method:"post",data:u}),t.setVisible(!1),l.getDataSource(c).reload(),yield e.reset(),n.data.loading=!1,o()}catch(g){n.data.loading=!1}})}}},An=e=>{const t=r.useRecord();return a.jsx($n,T({item:t},e))},$n=e=>{const{scope:t,getContainer:o,item:n,children:i,trigger:s,align:c,database:l}=e,{getInterface:f,getTemplate:u,collections:g}=r.useCollectionManager_deprecated(),[y,b]=p.useState(!1),[_,S]=p.useState(),[$,x]=p.useState({}),d=r.useCompile(),{t:h}=N.useTranslation(),{data:{database:m}}=r.useCurrentAppInfo(),C=A=>(m==null?void 0:m.dialect)===A,F=p.useMemo(()=>g.map(A=>({label:d(A.title),value:A.name})),[]),j=r.useFieldInterfaceOptions(),E=p.useCallback(()=>{const{availableFieldInterfaces:A}=u(n.template)||{},{exclude:P,include:O}=A||{},U=[];return j.forEach(z=>{var R;if(z.key==="relation"){let J=[];O!=null&&O.length?O.forEach(X=>{var H;const Se=(H=z==null?void 0:z.children)==null?void 0:H.find(Qo=>[X,X.interface].includes(Qo.value));Se&&J.push(K(T({},Se),{targetScope:X==null?void 0:X.targetScope}))}):P!=null&&P.length?J=(R=z==null?void 0:z.children)==null?void 0:R.filter(X=>!P.includes(X.value)):J=z==null?void 0:z.children,J!=null&&J.length&&U.push(K(T({},z),{children:J}))}}),U},[u,n]),I=p.useMemo(()=>E().map(A=>{var P;return((P=A==null?void 0:A.children)==null?void 0:P.length)===0?null:n.template==="view"?{type:"group",label:d(A.label),title:d(A.label),key:A.label,children:A.children.filter(O=>["m2o"].includes(O.name)).map(O=>({label:d(O.title),title:d(O.title),key:O.name,dataTargetScope:O.targetScope}))}:{type:"group",label:d(A.label),title:d(A.label),key:A.label,children:A==null?void 0:A.children.filter(O=>!["o2o","subTable","linkTo"].includes(O.name)).map(O=>({label:d(O.title),title:d(O.title),key:O.name,dataTargetScope:O.targetScope}))}}).filter(A=>{var P;return(P=A==null?void 0:A.children)==null?void 0:P.length}),[E]),V=p.useMemo(()=>({style:{maxHeight:"60vh",overflow:"auto"},onClick:A=>{const P=A.item.props["data-targetScope"];P&&S(P);const O=xn(f(A.key),n,d);O&&(x(O),b(!0))},items:I}),[f,I,n]);return n.template!=="sql"&&a.jsx(r.RecordProvider,{record:n,children:a.jsxs(r.ActionContextProvider,{value:{visible:y,setVisible:b},children:[a.jsx(v.Dropdown,{getPopupContainer:o,trigger:s,align:c,menu:V,children:i||a.jsx(v.Button,{icon:a.jsx(W.PlusOutlined,{}),type:"primary",children:h("Add field")})}),a.jsx(r.SchemaComponent,{schema:$,components:{ArrayTable:ae.ArrayTable},scope:T({getContainer:o,useCancelAction:r.useCancelAction,createOnly:!0,isOverride:!1,override:!1,useCreateCollectionField:Sn,record:n,showReverseFieldConfig:!1,targetScope:_,collections:F,isDialect:C,disabledJSONB:!1,createMainOnly:!0},t)})]})})},Tt=(e,t)=>{const o=[];return e.forEach(n=>{const i=n.children.filter(s=>{var c;return(c=s==null?void 0:s.availableTypes)==null?void 0:c.includes(t)});o.push({label:n.label,key:n.key,children:i})}),o.filter(n=>t==="sort"?n.key==="advanced":n.children.length>0)},Tn=(e,t)=>t==null?void 0:t.some(o=>{var n,i;return(i=(n=o.children)==null?void 0:n.some)==null?void 0:i.call(n,s=>s.name===e)}),Fn=w.observer(e=>{var _;const{value:t,handleFieldChange:o}=e,{data:n}=r.useCollectionRecord(),{getInterface:i}=r.useCollectionManager_deprecated(),s=r.useCompile(),c=r.useFieldInterfaceOptions(),l=Tt(c,n.type),[f,u]=p.useState(t),[g,y]=p.useState(l),b=n.type;return p.useEffect(()=>{var S,$,x,d,h,m,C,F,j,E,I,V;if(g.length===1&&(($=(S=g[0])==null?void 0:S.children)==null?void 0:$.length)===1){const A=(h=(d=(x=g[0])==null?void 0:x.children)==null?void 0:d[0])==null?void 0:h.name;if(A!==f){const P=i(A);o({interface:A,uiSchema:T({title:(m=n==null?void 0:n.uiSchema)==null?void 0:m.title},(C=P==null?void 0:P.default)==null?void 0:C.uiSchema)},n.name,!1),u(A)}}else if(f&&!Tn(f,g)){const A=(E=(j=(F=g[0])==null?void 0:F.children)==null?void 0:j[0])==null?void 0:E.name,P=i(A);o({interface:A,uiSchema:T({title:(I=n==null?void 0:n.uiSchema)==null?void 0:I.title},(V=P==null?void 0:P.default)==null?void 0:V.uiSchema)},n.name,!1),u(A)}},[g]),p.useEffect(()=>{if(n!=null&&n.possibleTypes){const S=Tt(c,b);y(S)}},[b]),["oho","obo","o2m","m2o","m2m"].includes(n.interface)?a.jsx(v.Tag,{children:s((_=c.find(S=>S.key==="relation").children.find(S=>S.name===t))==null?void 0:_.label)},t):a.jsx(v.Select,{"aria-label":`field-interface-${n==null?void 0:n.type}`,role:"button",value:f,style:{width:"100%"},popupMatchSelectWidth:!1,onChange:S=>{var x,d;const $=i(S);o({interface:S,uiSchema:T({title:(x=n==null?void 0:n.uiSchema)==null?void 0:x.title},(d=$==null?void 0:$.default)==null?void 0:d.uiSchema)},n.name),u(S)},children:g.map(S=>a.jsx(v.Select.OptGroup,{label:s(S.label),children:S.children.map($=>a.jsx(v.Select.Option,{value:$.name,children:s($.label)},$.name))},S.key))})},{displayName:"CollectionFieldInterfaceSelect"}),wn=w.observer(e=>{const{value:t,handleFieldChange:o}=e,n=r.useRecord(),[i,s]=p.useState(t),c=u=>{s(u)},l=p.useMemo(()=>Y.debounce(u=>{o({uiSchema:K(T({},n==null?void 0:n.uiSchema),{title:u})},n.name)},1e3),[o,n]),f=u=>{const g=u.target.value;c(g),l(g)};return p.useEffect(()=>{s(t)},[t]),a.jsx(v.Input,{value:i,onChange:f,style:{minWidth:"100px"},"aria-label":"field-title-input"})},{displayName:"FieldTitleInput"}),_n=w.observer(e=>{const{value:t,handleFieldChange:o,onChange:n}=e,i=r.useRecord(),s=i;return s!=null&&s.possibleTypes?a.jsx(v.Select,{"aria-label":`field-type-${t}`,role:"button",defaultValue:t,popupMatchSelectWidth:!1,style:{width:"100%"},options:(s==null?void 0:s.possibleTypes.map(c=>({label:c,value:c})))||[],onChange:c=>{n==null||n(c),o(K(T({},s),{type:c}),i.name)}}):a.jsx(v.Tag,{children:t})},{displayName:"FieldType"}),Pn=r.withDynamicSchemaProps(e=>{const{t}=N.useTranslation(),{isTitleField:o}=r.useCollectionManager_deprecated(),[n,i]=p.useState(null),s=r.useDataSourceManager(),{setTitleField:c,filterByTk:l,dataSourceKey:f}=r.useProps(e),u=r.useRecord(),g=r.useAPIClient(),{refreshRM:y,titleField:b}=ct(),_=S=>D(this,null,function*(){i(u),yield g.request({url:`dataSources/${f}/collections:update?filterByTk=${l}`,method:"post",data:{titleField:S?u.name:"id"}}),v.message.success(t("Saved successfully")),y(),c(S?u.name:"id"),yield s.getDataSource(f).reload(),i(null)});return o(u)?a.jsx(v.Tooltip,{title:t("Default title for each record"),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(v.Switch,{"aria-label":`switch-title-field-${u==null?void 0:u.name}`,size:"small",loading:(u==null?void 0:u.name)===(n==null?void 0:n.name),checked:(u==null?void 0:u.name)===(b||"id"),onChange:_})}):null},{displayName:"TitleField"}),Dn=()=>{const{t:e}=N.useTranslation(),{unsupportedFields:t}=r.useRecord(),o=[{title:e("Field name"),dataIndex:"name",key:"name"},{title:e("Field database type",{ns:k}),dataIndex:"rawType",key:"rawType"}];return(t==null?void 0:t.length)>0&&a.jsxs(a.Fragment,{children:[a.jsx(v.Divider,{plain:!0,orientation:"left",orientationMargin:"0",children:a.jsx("h3",{children:e("Unknown field type",{ns:k})})}),a.jsx("div",{style:{marginBottom:"15px"},children:e("The following field types are not compatible and do not support output and display",{ns:k})}),a.jsx(v.Table,{columns:o,dataSource:t,pagination:!1})]})};var Fe=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function we(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function In(){this.__data__=[],this.size=0}var On=In;function Mn(e,t){return e===t||e!==e&&t!==t}var Ft=Mn,kn=Ft;function En(e,t){for(var o=e.length;o--;)if(kn(e[o][0],t))return o;return-1}var _e=En,jn=_e,Kn=Array.prototype,Nn=Kn.splice;function Bn(e){var t=this.__data__,o=jn(t,e);if(o<0)return!1;var n=t.length-1;return o==n?t.pop():Nn.call(t,o,1),--this.size,!0}var Vn=Bn,Ln=_e;function qn(e){var t=this.__data__,o=Ln(t,e);return o<0?void 0:t[o][1]}var Gn=qn,Un=_e;function zn(e){return Un(this.__data__,e)>-1}var Hn=zn,Wn=_e;function Qn(e,t){var o=this.__data__,n=Wn(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this}var Yn=Qn,Jn=On,Zn=Vn,Xn=Gn,Rn=Hn,er=Yn;function se(e){var t=-1,o=e==null?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}se.prototype.clear=Jn,se.prototype.delete=Zn,se.prototype.get=Xn,se.prototype.has=Rn,se.prototype.set=er;var Pe=se,tr=Pe;function or(){this.__data__=new tr,this.size=0}var nr=or;function rr(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o}var ar=rr;function sr(e){return this.__data__.get(e)}var ir=sr;function cr(e){return this.__data__.has(e)}var lr=cr,ur=typeof Fe=="object"&&Fe&&Fe.Object===Object&&Fe,wt=ur,pr=wt,dr=typeof self=="object"&&self&&self.Object===Object&&self,mr=pr||dr||Function("return this")(),Z=mr,yr=Z,fr=yr.Symbol,he=fr,_t=he,Pt=Object.prototype,gr=Pt.hasOwnProperty,hr=Pt.toString,Ce=_t?_t.toStringTag:void 0;function Cr(e){var t=gr.call(e,Ce),o=e[Ce];try{e[Ce]=void 0;var n=!0}catch(s){}var i=hr.call(e);return n&&(t?e[Ce]=o:delete e[Ce]),i}var vr=Cr,br=Object.prototype,xr=br.toString;function Sr(e){return xr.call(e)}var Ar=Sr,Dt=he,$r=vr,Tr=Ar,Fr="[object Null]",wr="[object Undefined]",It=Dt?Dt.toStringTag:void 0;function _r(e){return e==null?e===void 0?wr:Fr:It&&It in Object(e)?$r(e):Tr(e)}var ie=_r;function Pr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ce=Pr,Dr=ie,Ir=ce,Or="[object AsyncFunction]",Mr="[object Function]",kr="[object GeneratorFunction]",Er="[object Proxy]";function jr(e){if(!Ir(e))return!1;var t=Dr(e);return t==Mr||t==kr||t==Or||t==Er}var Ot=jr,Kr=Z,Nr=Kr["__core-js_shared__"],Br=Nr,Ve=Br,Mt=function(){var e=/[^.]+$/.exec(Ve&&Ve.keys&&Ve.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Vr(e){return!!Mt&&Mt in e}var Lr=Vr,qr=Function.prototype,Gr=qr.toString;function Ur(e){if(e!=null){try{return Gr.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var kt=Ur,zr=Ot,Hr=Lr,Wr=ce,Qr=kt,Yr=/[\\^$.*+?()[\]{}|]/g,Jr=/^\[object .+?Constructor\]$/,Zr=Function.prototype,Xr=Object.prototype,Rr=Zr.toString,ea=Xr.hasOwnProperty,ta=RegExp("^"+Rr.call(ea).replace(Yr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oa(e){if(!Wr(e)||Hr(e))return!1;var t=zr(e)?ta:Jr;return t.test(Qr(e))}var na=oa;function ra(e,t){return e==null?void 0:e[t]}var aa=ra,sa=na,ia=aa;function ca(e,t){var o=ia(e,t);return sa(o)?o:void 0}var te=ca,la=te,ua=Z,pa=la(ua,"Map"),Le=pa,da=te,ma=da(Object,"create"),De=ma,Et=De;function ya(){this.__data__=Et?Et(null):{},this.size=0}var fa=ya;function ga(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ha=ga,Ca=De,va="__lodash_hash_undefined__",ba=Object.prototype,xa=ba.hasOwnProperty;function Sa(e){var t=this.__data__;if(Ca){var o=t[e];return o===va?void 0:o}return xa.call(t,e)?t[e]:void 0}var Aa=Sa,$a=De,Ta=Object.prototype,Fa=Ta.hasOwnProperty;function wa(e){var t=this.__data__;return $a?t[e]!==void 0:Fa.call(t,e)}var _a=wa,Pa=De,Da="__lodash_hash_undefined__";function Ia(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Pa&&t===void 0?Da:t,this}var Oa=Ia,Ma=fa,ka=ha,Ea=Aa,ja=_a,Ka=Oa;function le(e){var t=-1,o=e==null?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}le.prototype.clear=Ma,le.prototype.delete=ka,le.prototype.get=Ea,le.prototype.has=ja,le.prototype.set=Ka;var Na=le,jt=Na,Ba=Pe,Va=Le;function La(){this.size=0,this.__data__={hash:new jt,map:new(Va||Ba),string:new jt}}var qa=La;function Ga(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Ua=Ga,za=Ua;function Ha(e,t){var o=e.__data__;return za(t)?o[typeof t=="string"?"string":"hash"]:o.map}var Ie=Ha,Wa=Ie;function Qa(e){var t=Wa(this,e).delete(e);return this.size-=t?1:0,t}var Ya=Qa,Ja=Ie;function Za(e){return Ja(this,e).get(e)}var Xa=Za,Ra=Ie;function es(e){return Ra(this,e).has(e)}var ts=es,os=Ie;function ns(e,t){var o=os(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this}var rs=ns,as=qa,ss=Ya,is=Xa,cs=ts,ls=rs;function ue(e){var t=-1,o=e==null?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}ue.prototype.clear=as,ue.prototype.delete=ss,ue.prototype.get=is,ue.prototype.has=cs,ue.prototype.set=ls;var Kt=ue,us=Pe,ps=Le,ds=Kt,ms=200;function ys(e,t){var o=this.__data__;if(o instanceof us){var n=o.__data__;if(!ps||n.length<ms-1)return n.push([e,t]),this.size=++o.size,this;o=this.__data__=new ds(n)}return o.set(e,t),this.size=o.size,this}var fs=ys,gs=Pe,hs=nr,Cs=ar,vs=ir,bs=lr,xs=fs;function pe(e){var t=this.__data__=new gs(e);this.size=t.size}pe.prototype.clear=hs,pe.prototype.delete=Cs,pe.prototype.get=vs,pe.prototype.has=bs,pe.prototype.set=xs;var Ss=pe;function As(e,t){for(var o=-1,n=e==null?0:e.length;++o<n&&t(e[o],o,e)!==!1;);return e}var $s=As,Ts=te,Fs=function(){try{var e=Ts(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Nt=Fs,Bt=Nt;function ws(e,t,o){t=="__proto__"&&Bt?Bt(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}var Vt=ws,_s=Vt,Ps=Ft,Ds=Object.prototype,Is=Ds.hasOwnProperty;function Os(e,t,o){var n=e[t];(!(Is.call(e,t)&&Ps(n,o))||o===void 0&&!(t in e))&&_s(e,t,o)}var qe=Os,Ms=qe,ks=Vt;function Es(e,t,o,n){var i=!o;o||(o={});for(var s=-1,c=t.length;++s<c;){var l=t[s],f=n?n(o[l],e[l],l,o,e):void 0;f===void 0&&(f=e[l]),i?ks(o,l,f):Ms(o,l,f)}return o}var ve=Es;function js(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n}var Ks=js;function Ns(e){return e!=null&&typeof e=="object"}var oe=Ns,Bs=ie,Vs=oe,Ls="[object Arguments]";function qs(e){return Vs(e)&&Bs(e)==Ls}var Gs=qs,Lt=Gs,Us=oe,qt=Object.prototype,zs=qt.hasOwnProperty,Hs=qt.propertyIsEnumerable,Ws=Lt(function(){return arguments}())?Lt:function(e){return Us(e)&&zs.call(e,"callee")&&!Hs.call(e,"callee")},Gt=Ws,Qs=Array.isArray,ne=Qs,Oe={exports:{}};function Ys(){return!1}var Js=Ys;Oe.exports,function(e,t){var o=Z,n=Js,i=t&&!t.nodeType&&t,s=i&&!0&&e&&!e.nodeType&&e,c=s&&s.exports===i,l=c?o.Buffer:void 0,f=l?l.isBuffer:void 0,u=f||n;e.exports=u}(Oe,Oe.exports);var Ut=Oe.exports,Zs=9007199254740991,Xs=/^(?:0|[1-9]\d*)$/;function Rs(e,t){var o=typeof e;return t=t==null?Zs:t,!!t&&(o=="number"||o!="symbol"&&Xs.test(e))&&e>-1&&e%1==0&&e<t}var zt=Rs,ei=9007199254740991;function ti(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ei}var Ht=ti,oi=ie,ni=Ht,ri=oe,ai="[object Arguments]",si="[object Array]",ii="[object Boolean]",ci="[object Date]",li="[object Error]",ui="[object Function]",pi="[object Map]",di="[object Number]",mi="[object Object]",yi="[object RegExp]",fi="[object Set]",gi="[object String]",hi="[object WeakMap]",Ci="[object ArrayBuffer]",vi="[object DataView]",bi="[object Float32Array]",xi="[object Float64Array]",Si="[object Int8Array]",Ai="[object Int16Array]",$i="[object Int32Array]",Ti="[object Uint8Array]",Fi="[object Uint8ClampedArray]",wi="[object Uint16Array]",_i="[object Uint32Array]",G={};G[bi]=G[xi]=G[Si]=G[Ai]=G[$i]=G[Ti]=G[Fi]=G[wi]=G[_i]=!0,G[ai]=G[si]=G[Ci]=G[ii]=G[vi]=G[ci]=G[li]=G[ui]=G[pi]=G[di]=G[mi]=G[yi]=G[fi]=G[gi]=G[hi]=!1;function Pi(e){return ri(e)&&ni(e.length)&&!!G[oi(e)]}var Di=Pi;function Ii(e){return function(t){return e(t)}}var Ge=Ii,Me={exports:{}};Me.exports,function(e,t){var o=wt,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===n,c=s&&o.process,l=function(){try{var f=i&&i.require&&i.require("util").types;return f||c&&c.binding&&c.binding("util")}catch(u){}}();e.exports=l}(Me,Me.exports);var Ue=Me.exports,Oi=Di,Mi=Ge,Wt=Ue,Qt=Wt&&Wt.isTypedArray,ki=Qt?Mi(Qt):Oi,Ei=ki,ji=Ks,Ki=Gt,Ni=ne,Bi=Ut,Vi=zt,Li=Ei,qi=Object.prototype,Gi=qi.hasOwnProperty;function Ui(e,t){var o=Ni(e),n=!o&&Ki(e),i=!o&&!n&&Bi(e),s=!o&&!n&&!i&&Li(e),c=o||n||i||s,l=c?ji(e.length,String):[],f=l.length;for(var u in e)(t||Gi.call(e,u))&&!(c&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Vi(u,f)))&&l.push(u);return l}var Yt=Ui,zi=Object.prototype;function Hi(e){var t=e&&e.constructor,o=typeof t=="function"&&t.prototype||zi;return e===o}var ze=Hi;function Wi(e,t){return function(o){return e(t(o))}}var Jt=Wi,Qi=Jt,Yi=Qi(Object.keys,Object),Ji=Yi,Zi=ze,Xi=Ji,Ri=Object.prototype,ec=Ri.hasOwnProperty;function tc(e){if(!Zi(e))return Xi(e);var t=[];for(var o in Object(e))ec.call(e,o)&&o!="constructor"&&t.push(o);return t}var oc=tc,nc=Ot,rc=Ht;function ac(e){return e!=null&&rc(e.length)&&!nc(e)}var Zt=ac,sc=Yt,ic=oc,cc=Zt;function lc(e){return cc(e)?sc(e):ic(e)}var He=lc,uc=ve,pc=He;function dc(e,t){return e&&uc(t,pc(t),e)}var mc=dc;function yc(e){var t=[];if(e!=null)for(var o in Object(e))t.push(o);return t}var fc=yc,gc=ce,hc=ze,Cc=fc,vc=Object.prototype,bc=vc.hasOwnProperty;function xc(e){if(!gc(e))return Cc(e);var t=hc(e),o=[];for(var n in e)n=="constructor"&&(t||!bc.call(e,n))||o.push(n);return o}var Sc=xc,Ac=Yt,$c=Sc,Tc=Zt;function Fc(e){return Tc(e)?Ac(e,!0):$c(e)}var We=Fc,wc=ve,_c=We;function Pc(e,t){return e&&wc(t,_c(t),e)}var Dc=Pc,ke={exports:{}};ke.exports,function(e,t){var o=Z,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===n,c=s?o.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(u,g){if(g)return u.slice();var y=u.length,b=l?l(y):new u.constructor(y);return u.copy(b),b}e.exports=f}(ke,ke.exports);var Ic=ke.exports;function Oc(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o<n;)t[o]=e[o];return t}var Mc=Oc;function kc(e,t){for(var o=-1,n=e==null?0:e.length,i=0,s=[];++o<n;){var c=e[o];t(c,o,e)&&(s[i++]=c)}return s}var Ec=kc;function jc(){return[]}var Xt=jc,Kc=Ec,Nc=Xt,Bc=Object.prototype,Vc=Bc.propertyIsEnumerable,Rt=Object.getOwnPropertySymbols,Lc=Rt?function(e){return e==null?[]:(e=Object(e),Kc(Rt(e),function(t){return Vc.call(e,t)}))}:Nc,Qe=Lc,qc=ve,Gc=Qe;function Uc(e,t){return qc(e,Gc(e),t)}var zc=Uc;function Hc(e,t){for(var o=-1,n=t.length,i=e.length;++o<n;)e[i+o]=t[o];return e}var Ye=Hc,Wc=Jt,Qc=Wc(Object.getPrototypeOf,Object),Je=Qc,Yc=Ye,Jc=Je,Zc=Qe,Xc=Xt,Rc=Object.getOwnPropertySymbols,el=Rc?function(e){for(var t=[];e;)Yc(t,Zc(e)),e=Jc(e);return t}:Xc,eo=el,tl=ve,ol=eo;function nl(e,t){return tl(e,ol(e),t)}var rl=nl,al=Ye,sl=ne;function il(e,t,o){var n=t(e);return sl(e)?n:al(n,o(e))}var to=il,cl=to,ll=Qe,ul=He;function pl(e){return cl(e,ul,ll)}var dl=pl,ml=to,yl=eo,fl=We;function gl(e){return ml(e,fl,yl)}var oo=gl,hl=te,Cl=Z,vl=hl(Cl,"DataView"),bl=vl,xl=te,Sl=Z,Al=xl(Sl,"Promise"),$l=Al,Tl=te,Fl=Z,wl=Tl(Fl,"Set"),_l=wl,Pl=te,Dl=Z,Il=Pl(Dl,"WeakMap"),Ol=Il,Ze=bl,Xe=Le,Re=$l,et=_l,tt=Ol,no=ie,de=kt,ro="[object Map]",Ml="[object Object]",ao="[object Promise]",so="[object Set]",io="[object WeakMap]",co="[object DataView]",kl=de(Ze),El=de(Xe),jl=de(Re),Kl=de(et),Nl=de(tt),re=no;(Ze&&re(new Ze(new ArrayBuffer(1)))!=co||Xe&&re(new Xe)!=ro||Re&&re(Re.resolve())!=ao||et&&re(new et)!=so||tt&&re(new tt)!=io)&&(re=function(e){var t=no(e),o=t==Ml?e.constructor:void 0,n=o?de(o):"";if(n)switch(n){case kl:return co;case El:return ro;case jl:return ao;case Kl:return so;case Nl:return io}return t});var ot=re,Bl=Object.prototype,Vl=Bl.hasOwnProperty;function Ll(e){var t=e.length,o=new e.constructor(t);return t&&typeof e[0]=="string"&&Vl.call(e,"index")&&(o.index=e.index,o.input=e.input),o}var ql=Ll,Gl=Z,Ul=Gl.Uint8Array,zl=Ul,lo=zl;function Hl(e){var t=new e.constructor(e.byteLength);return new lo(t).set(new lo(e)),t}var nt=Hl,Wl=nt;function Ql(e,t){var o=t?Wl(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}var Yl=Ql,Jl=/\w*$/;function Zl(e){var t=new e.constructor(e.source,Jl.exec(e));return t.lastIndex=e.lastIndex,t}var Xl=Zl,uo=he,po=uo?uo.prototype:void 0,mo=po?po.valueOf:void 0;function Rl(e){return mo?Object(mo.call(e)):{}}var eu=Rl,tu=nt;function ou(e,t){var o=t?tu(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}var nu=ou,ru=nt,au=Yl,su=Xl,iu=eu,cu=nu,lu="[object Boolean]",uu="[object Date]",pu="[object Map]",du="[object Number]",mu="[object RegExp]",yu="[object Set]",fu="[object String]",gu="[object Symbol]",hu="[object ArrayBuffer]",Cu="[object DataView]",vu="[object Float32Array]",bu="[object Float64Array]",xu="[object Int8Array]",Su="[object Int16Array]",Au="[object Int32Array]",$u="[object Uint8Array]",Tu="[object Uint8ClampedArray]",Fu="[object Uint16Array]",wu="[object Uint32Array]";function _u(e,t,o){var n=e.constructor;switch(t){case hu:return ru(e);case lu:case uu:return new n(+e);case Cu:return au(e,o);case vu:case bu:case xu:case Su:case Au:case $u:case Tu:case Fu:case wu:return cu(e,o);case pu:return new n;case du:case fu:return new n(e);case mu:return su(e);case yu:return new n;case gu:return iu(e)}}var Pu=_u,Du=ce,yo=Object.create,Iu=function(){function e(){}return function(t){if(!Du(t))return{};if(yo)return yo(t);e.prototype=t;var o=new e;return e.prototype=void 0,o}}(),Ou=Iu,Mu=Ou,ku=Je,Eu=ze;function ju(e){return typeof e.constructor=="function"&&!Eu(e)?Mu(ku(e)):{}}var Ku=ju,Nu=ot,Bu=oe,Vu="[object Map]";function Lu(e){return Bu(e)&&Nu(e)==Vu}var qu=Lu,Gu=qu,Uu=Ge,fo=Ue,go=fo&&fo.isMap,zu=go?Uu(go):Gu,Hu=zu,Wu=ot,Qu=oe,Yu="[object Set]";function Ju(e){return Qu(e)&&Wu(e)==Yu}var Zu=Ju,Xu=Zu,Ru=Ge,ho=Ue,Co=ho&&ho.isSet,ep=Co?Ru(Co):Xu,tp=ep,op=Ss,np=$s,rp=qe,ap=mc,sp=Dc,ip=Ic,cp=Mc,lp=zc,up=rl,pp=dl,dp=oo,mp=ot,yp=ql,fp=Pu,gp=Ku,hp=ne,Cp=Ut,vp=Hu,bp=ce,xp=tp,Sp=He,Ap=We,$p=1,Tp=2,Fp=4,vo="[object Arguments]",wp="[object Array]",_p="[object Boolean]",Pp="[object Date]",Dp="[object Error]",bo="[object Function]",Ip="[object GeneratorFunction]",Op="[object Map]",Mp="[object Number]",xo="[object Object]",kp="[object RegExp]",Ep="[object Set]",jp="[object String]",Kp="[object Symbol]",Np="[object WeakMap]",Bp="[object ArrayBuffer]",Vp="[object DataView]",Lp="[object Float32Array]",qp="[object Float64Array]",Gp="[object Int8Array]",Up="[object Int16Array]",zp="[object Int32Array]",Hp="[object Uint8Array]",Wp="[object Uint8ClampedArray]",Qp="[object Uint16Array]",Yp="[object Uint32Array]",q={};q[vo]=q[wp]=q[Bp]=q[Vp]=q[_p]=q[Pp]=q[Lp]=q[qp]=q[Gp]=q[Up]=q[zp]=q[Op]=q[Mp]=q[xo]=q[kp]=q[Ep]=q[jp]=q[Kp]=q[Hp]=q[Wp]=q[Qp]=q[Yp]=!0,q[Dp]=q[bo]=q[Np]=!1;function Ee(e,t,o,n,i,s){var c,l=t&$p,f=t&Tp,u=t&Fp;if(o&&(c=i?o(e,n,i,s):o(e)),c!==void 0)return c;if(!bp(e))return e;var g=hp(e);if(g){if(c=yp(e),!l)return cp(e,c)}else{var y=mp(e),b=y==bo||y==Ip;if(Cp(e))return ip(e,l);if(y==xo||y==vo||b&&!i){if(c=f||b?{}:gp(e),!l)return f?up(e,sp(c,e)):lp(e,ap(c,e))}else{if(!q[y])return i?e:{};c=fp(e,y,l)}}s||(s=new op);var _=s.get(e);if(_)return _;s.set(e,c),xp(e)?e.forEach(function(x){c.add(Ee(x,t,o,x,e,s))}):vp(e)&&e.forEach(function(x,d){c.set(d,Ee(x,t,o,d,e,s))});var S=u?f?dp:pp:f?Ap:Sp,$=g?void 0:S(e);return np($||e,function(x,d){$&&(d=x,x=e[d]),rp(c,d,Ee(x,t,o,d,e,s))}),c}var So=Ee,Jp=So,Zp=1,Xp=4;function Rp(e){return Jp(e,Zp|Xp)}var ed=Rp;const ee=we(ed);function td(e,t){for(var o=-1,n=e==null?0:e.length,i=Array(n);++o<n;)i[o]=t(e[o],o,e);return i}var Ao=td,od=ie,nd=oe,rd="[object Symbol]";function ad(e){return typeof e=="symbol"||nd(e)&&od(e)==rd}var rt=ad,sd=ne,id=rt,cd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ld=/^\w*$/;function ud(e,t){if(sd(e))return!1;var o=typeof e;return o=="number"||o=="symbol"||o=="boolean"||e==null||id(e)?!0:ld.test(e)||!cd.test(e)||t!=null&&e in Object(t)}var pd=ud,$o=Kt,dd="Expected a function";function at(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(dd);var o=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=o.cache;if(s.has(i))return s.get(i);var c=e.apply(this,n);return o.cache=s.set(i,c)||s,c};return o.cache=new(at.Cache||$o),o}at.Cache=$o;var md=at,yd=md,fd=500;function gd(e){var t=yd(e,function(n){return o.size===fd&&o.clear(),n}),o=t.cache;return t}var hd=gd,Cd=hd,vd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bd=/\\(\\)?/g,xd=Cd(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(vd,function(o,n,i,s){t.push(i?s.replace(bd,"$1"):n||o)}),t}),Sd=xd,To=he,Ad=Ao,$d=ne,Td=rt,Fd=1/0,Fo=To?To.prototype:void 0,wo=Fo?Fo.toString:void 0;function _o(e){if(typeof e=="string")return e;if($d(e))return Ad(e,_o)+"";if(Td(e))return wo?wo.call(e):"";var t=e+"";return t=="0"&&1/e==-Fd?"-0":t}var wd=_o,_d=wd;function Pd(e){return e==null?"":_d(e)}var Dd=Pd,Id=ne,Od=pd,Md=Sd,kd=Dd;function Ed(e,t){return Id(e)?e:Od(e,t)?[e]:Md(kd(e))}var je=Ed;function jd(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Kd=jd,Nd=rt,Bd=1/0;function Vd(e){if(typeof e=="string"||Nd(e))return e;var t=e+"";return t=="0"&&1/e==-Bd?"-0":t}var st=Vd,Ld=je,qd=st;function Gd(e,t){t=Ld(t,e);for(var o=0,n=t.length;e!=null&&o<n;)e=e[qd(t[o++])];return o&&o==n?e:void 0}var Ud=Gd;function zd(e,t,o){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),o=o>i?i:o,o<0&&(o+=i),i=t>o?0:o-t>>>0,t>>>=0;for(var s=Array(i);++n<i;)s[n]=e[n+t];return s}var Hd=zd,Wd=Ud,Qd=Hd;function Yd(e,t){return t.length<2?e:Wd(e,Qd(t,0,-1))}var Jd=Yd,Zd=je,Xd=Kd,Rd=Jd,em=st;function tm(e,t){return t=Zd(t,e),e=Rd(e,t),e==null||delete e[em(Xd(t))]}var om=tm,nm=ie,rm=Je,am=oe,sm="[object Object]",im=Function.prototype,cm=Object.prototype,Po=im.toString,lm=cm.hasOwnProperty,um=Po.call(Object);function pm(e){if(!am(e)||nm(e)!=sm)return!1;var t=rm(e);if(t===null)return!0;var o=lm.call(t,"constructor")&&t.constructor;return typeof o=="function"&&o instanceof o&&Po.call(o)==um}var dm=pm,mm=dm;function ym(e){return mm(e)?void 0:e}var fm=ym,Do=he,gm=Gt,hm=ne,Io=Do?Do.isConcatSpreadable:void 0;function Cm(e){return hm(e)||gm(e)||!!(Io&&e&&e[Io])}var vm=Cm,bm=Ye,xm=vm;function Oo(e,t,o,n,i){var s=-1,c=e.length;for(o||(o=xm),i||(i=[]);++s<c;){var l=e[s];t>0&&o(l)?t>1?Oo(l,t-1,o,n,i):bm(i,l):n||(i[i.length]=l)}return i}var Sm=Oo,Am=Sm;function $m(e){var t=e==null?0:e.length;return t?Am(e,1):[]}var Tm=$m;function Fm(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)}var wm=Fm,_m=wm,Mo=Math.max;function Pm(e,t,o){return t=Mo(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,s=Mo(n.length-t,0),c=Array(s);++i<s;)c[i]=n[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=n[i];return l[t]=o(c),_m(e,this,l)}}var Dm=Pm;function Im(e){return function(){return e}}var Om=Im;function Mm(e){return e}var km=Mm,Em=Om,ko=Nt,jm=km,Km=ko?function(e,t){return ko(e,"toString",{configurable:!0,enumerable:!1,value:Em(t),writable:!0})}:jm,Nm=Km,Bm=800,Vm=16,Lm=Date.now;function qm(e){var t=0,o=0;return function(){var n=Lm(),i=Vm-(n-o);if(o=n,i>0){if(++t>=Bm)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Gm=qm,Um=Nm,zm=Gm,Hm=zm(Um),Wm=Hm,Qm=Tm,Ym=Dm,Jm=Wm;function Zm(e){return Jm(Ym(e,void 0,Qm),e+"")}var Xm=Zm,Rm=Ao,ey=So,ty=om,oy=je,ny=ve,ry=fm,ay=Xm,sy=oo,iy=1,cy=2,ly=4,uy=ay(function(e,t){var o={};if(e==null)return o;var n=!1;t=Rm(t,function(s){return s=oy(s,e),n||(n=s.length>1),s}),ny(e,sy(e),o),n&&(o=ey(o,iy|cy|ly,ry));for(var i=t.length;i--;)ty(o,t[i]);return o}),py=uy;const Ke=we(py);var dy=qe,my=je,yy=zt,Eo=ce,fy=st;function gy(e,t,o,n){if(!Eo(e))return e;t=my(t,e);for(var i=-1,s=t.length,c=s-1,l=e;l!=null&&++i<s;){var f=fy(t[i]),u=o;if(f==="__proto__"||f==="constructor"||f==="prototype")return e;if(i!=c){var g=l[f];u=n?n(g,f,l):void 0,u===void 0&&(u=Eo(g)?g:yy(t[i+1])?[]:{})}dy(l,f,u),l=l[f]}return e}var hy=gy,Cy=hy;function vy(e,t,o){return e==null?e:Cy(e,t,o)}var by=vy;const jo=we(by),xy=({schema:e,record:t,parentRecord:o,compile:n,getContainer:i})=>{if(!e)return;const s=ee(e.properties);return s!=null&&s.name&&(s.name["x-disabled"]=!0),e.hasDefaultValue===!0&&(s.defaultValue=ee(e.default.uiSchema)||{},s.defaultValue.required=!1,s.defaultValue.title=n('{{ t("Default value") }}'),s.defaultValue["x-decorator"]="FormItem",s.defaultValue["x-reactions"]={dependencies:["uiSchema.x-component-props.gmt","uiSchema.x-component-props.showTime","uiSchema.x-component-props.dateFormat","uiSchema.x-component-props.timeFormat"],fulfill:{state:{componentProps:{gmt:"{{$deps[0]}}",showTime:"{{$deps[1]}}",dateFormat:"{{$deps[2]}}",timeFormat:"{{$deps[3]}}"}}}},s.defaultValue["x-disabled"]=!0),{type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues(c){return r.useRequest(()=>{var l;return Promise.resolve({data:K(T({},ee(Ke(e.default,["uiSchema.rawTitle"]))),{autoFill:((l=e.default)==null?void 0:l.autoFill)!==!1})})},c)}},title:`${n((o==null?void 0:o.title)||(o==null?void 0:o.name))} - ${n('{{ t("Edit field") }}')}`,properties:K(T({summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}}},s),{description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateCollectionField }}"}}}}})}}}},Sy=()=>{const e=w.useForm(),t=r.useAPIClient(),o=r.useActionContext(),{refresh:n}=r.useResourceActionContext(),{targetCollection:i}=ct(),{name:s}=L.useParams(),{name:c}=r.useRecord(),l=r.useDataSourceManager();return{run(){return D(this,null,function*(){yield e.submit();const u=ee(e.values);u.autoCreateReverseField||delete u.reverseField,delete u.autoCreateReverseField,yield t.request({url:`dataSourcesCollections/${s}.${i.name}/fields:update?filterByTk=${c}`,method:"post",data:u}),o.setVisible(!1),l.getDataSource(s).reload(),yield e.reset(),n()})}}},Ay=e=>{const t=r.useRecord(),o=r.useCollectionParentRecordData();return a.jsx($y,T({item:t,parentItem:o},e))},$y=e=>{var I,V;const E=e,{scope:t,getContainer:o,item:n,parentItem:i,children:s}=E,c=pt(E,["scope","getContainer","item","parentItem","children"]),{getInterface:l,collections:f,getCollection:u}=r.useCollectionManager_deprecated(),{data:{database:g}}=r.useCurrentAppInfo(),[y,b]=p.useState(!1),[_,S]=p.useState({}),$=r.useAPIClient(),{t:x}=N.useTranslation(),d=r.useCompile(),{name:h}=L.useParams(),m=A=>(g==null?void 0:g.dialect)===A,C=(n==null?void 0:n.fields)||((V=(I=u(n.collectionName,h))==null?void 0:I.options)==null?void 0:V.fields),F=p.useMemo(()=>f.map(A=>({label:d(A.title),value:A.name})),[]),j=p.useMemo(()=>{var A,P;return(n==null?void 0:n.fields)||((P=(A=u(n.collectionName,h))==null?void 0:A.options)==null?void 0:P.fields.filter(O=>["string","bigInt","integer"].includes(O.type)).map(O=>{var U;return{value:O.name,label:d((U=O.uiSchema)==null?void 0:U.title)}}))},[n.name,C]);return a.jsx(r.RecordProvider,{record:n,parent:i,children:a.jsxs(r.ActionContextProvider,{value:{visible:y,setVisible:b},children:[a.jsx("a",K(T({},c),{onClick:()=>D(this,null,function*(){var z,R,J;const{data:A}=yield $.request({url:`dataSourcesCollections/${h}.${i.name}/fields:get?filterByTk=${n.name}`,params:{appends:["reverseField"]}}),P=l((z=A==null?void 0:A.data)==null?void 0:z.interface),O=ee(A==null?void 0:A.data)||{};O!=null&&O.reverseField||(O.autoCreateReverseField=!1,O.reverseField=(R=P==null?void 0:P.default)==null?void 0:R.reverseField,jo(O.reverseField,"name",`f_${B.uid()}`),jo(O.reverseField,"uiSchema.title",(J=n.__parent)==null?void 0:J.title));const U=xy({schema:K(T({},P),{default:O}),record:n,parentRecord:i,compile:d,getContainer:o});S(U),b(!0)}),children:s||x("Edit")})),a.jsx(r.SchemaComponent,{schema:_,components:{ArrayTable:ae.ArrayTable},scope:K(T({getContainer:o,useUpdateCollectionField:Sy,useCancelAction:r.useCancelAction,showReverseFieldConfig:!1,collections:F,isDialect:m,scopeKeyOptions:j,disabledJSONB:!0},t),{createOnly:!1,createMainOnly:!1,editMainOnly:!0})})]})})},Ty=()=>{const{refresh:e}=r.useResourceActionContext(),{name:t}=L.useParams(),{name:o,collectionName:n}=r.useRecord(),i=r.useAPIClient();return{run(){return D(this,null,function*(){yield i.request({url:`dataSourcesCollections/${t}.${n}/fields:destroy?filterByTk=${o}`,method:"post"}),e()})}}},Fy=()=>{const{state:e,setState:t,refresh:o}=r.useResourceActionContext(),{t:n}=N.useTranslation(),{name:i}=L.useParams(),s=r.useAPIClient(),{name:c}=r.useRecord();return{run(){return D(this,null,function*(){var f;if(!((f=e==null?void 0:e.selectedRowKeys)!=null&&f.length))return v.message.error(n("Please select the records you want to delete"));yield s.request({url:`dataSourcesCollections/${i}.${c}/fields:destroy`,method:"post",params:{filterByTk:(e==null?void 0:e.selectedRowKeys)||[]}}),t==null||t({selectedRowKeys:[]}),o()})}}},wy=()=>{const{run:e}=Fy();return{run(){return D(this,null,function*(){yield e()})}}},_y=()=>{const{run:e}=Ty();return{run(){return D(this,null,function*(){yield e()})}}},Py={name:"fields",fields:[{type:"string",name:"type",interface:"input",uiSchema:{title:'{{ t("Storage type") }}',type:"string","x-component":"Select",enum:[{label:"String",value:"string"}],required:!0}},{type:"string",name:"interface",interface:"input",uiSchema:{title:`{{t("Field interface", { ns: "${k}" })}}`,type:"string","x-component":"Select",enum:"{{interfaces}}"}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{ t("Field display name") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Field name") }}',type:"string","x-component":"Input"}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input.TextArea"}}]},Dy={type:"object",properties:{[B.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-visible":!1,"x-component-props":{useAction:"{{ useBulkDestroyActionAndRefreshCM }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},syncfromDatabase:{type:"void",title:'{{ t("Sync from database") }}',"x-component":"SyncFieldsAction","x-component-props":{type:"primary"}},syncSQL:{type:"void",title:'{{ t("Sync from database") }}',"x-component":"SyncSQLFieldsAction","x-component-props":{type:"primary"}},create:{type:"void",title:'{{ t("Add new") }}',"x-component":"AddCollectionField","x-component-props":{type:"primary"},"x-hidden":"{{ disableAddFields }}"}}},[B.uid()]:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{pagination:!1,rowKey:"name",rowSelection:{type:"checkbox"},dragSort:!1,useDataSource:"{{ useDataSource }}"},properties:{column1:{type:"void",title:'{{ t("Field display name") }}',"x-component":"Table.Column",properties:{"uiSchema.title":{type:"string","x-component":"FieldTitleInput","x-component-props":{handleFieldChange:"{{enqueueChange}}"}}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{"x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Field type")}}',properties:{type:{"x-component":"FieldType","x-component-props":{handleFieldChange:"{{enqueueChange}}"}}}},column4:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Field interface", { ns: "${k}" })}}`,properties:{interface:{"x-component":"CollectionFieldInterfaceSelect","x-component-props":{handleFieldChange:"{{enqueueChange}}"}}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Title field")}}',properties:{titleField:{"x-component":"TitleField","x-use-component-props":"useTitleFieldProps","x-read-pretty":!1}}},column6:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Description") }}',properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0,style:{width:100}}}}},column7:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollectionField","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-disabled":"{{cm.useDeleteButtonDisabled()}}","x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ useDestroyActionAndRefreshCM }}"},"x-reactions":[{dependencies:[".interface"],fulfill:{state:{visible:"{{ ['obo','oho','m2m','o2m','m2o'].includes($deps[0]) }}"}}}]}}}}}}}}},it=p.createContext({refreshRM:()=>{},titleField:null,targetCollection:null});it.displayName="RemoteCollectionContext";const ct=()=>p.useContext(it),Ko=()=>{const e=w.useField(),t=p.useMemo(()=>ge.createForm(),[]),o=r.useAttach(t.createArrayField(K(T({},e.props),{basePath:""}))),{t:n}=N.useTranslation(),{name:i}=L.useParams(),s=r.useAPIClient(),c=r.useCompile(),l=p.useContext(r.ResourceActionContext),f=r.useResourceContext(),{targetKey:u}=f||{},g=r.useRecord(),{[u]:y,titleField:b,name:_}=g,[S,$]=p.useState(b),x=A=>{const P=p.useContext(r.ResourceActionContext),O=w.useField();return p.useEffect(()=>{P.loading||(A==null||A.onSuccess(P.data),O.componentProps.dragSort=!!P.dragSort)},[P.loading]),P},d={association:{sourceKey:"name",targetKey:"name"},dragSort:!1,collection:Py,request:{url:`dataSourcesCollections/${i}.${_}/fields:list`,params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}}},h=r.useDataSourceManager();let m=!1;const C=[],F=()=>D(this,null,function*(){if(m||C.length===0)return;m=!0;const{value:A,filterByTk:P,flag:O}=C.shift();try{yield E(A,P,O)}catch(U){console.error("Error processing handleFieldChange:",U)}finally{m=!1,F()}}),j=(A,P,O)=>{C.push({value:A,filterByTk:P,flag:O}),F()},E=(A,P,O=!0)=>D(this,null,function*(){yield s.request({url:`dataSourcesCollections/${i}.${_}/fields:update?filterByTk=${P}`,method:"post",data:A}),h.getDataSource(i).reload(),O&&v.message.success(n("Saved successfully"))}),I=()=>({filterByTk:y,titleField:S,dataSourceKey:i,setTitleField:$}),V=(A,P,O)=>D(this,null,function*(){var X,Se;const{targetScope:U}=P,z=((X=A.props)==null?void 0:X.name)==="inherits",{data:R}=yield s.request({url:`dataSources/${i}/collections:list`,params:{paginate:!1,appends:["fields"],sort:["sort"]}});return((Se=R==null?void 0:R.data)==null?void 0:Se.filter(H=>{var Yo;if(O!=null&&O.includes(H.template)||H.autoCreate&&H.isThrough||z&&H.template==="view")return!1;const Wf=!(U!=null&&U.template)||U.template.includes(H.template),Qf=!(U!=null&&U[(Yo=A.props)==null?void 0:Yo.name])||U[A.props.name].includes(H.name);return Wf&&Qf})).map(H=>({label:c(H.title||H.name),value:H.name}))});return a.jsxs(it.Provider,{value:{refreshRM:()=>{l.refresh()},titleField:S,targetCollection:g},children:[a.jsx(Ct,{collectionName:_}),a.jsx(r.ResourceActionProvider,K(T({},d),{children:a.jsx(w.FormContext.Provider,{value:t,children:a.jsx(w.FieldContext.Provider,{value:o,children:a.jsx(r.SchemaComponentOptions,{components:{TitleField:Pn,CollectionFieldInterfaceSelect:Fn,AddCollectionField:An,SourceCollection:vn,TargetKey:Cn,SourceKey:hn,FieldTitleInput:wn,EditCollectionField:Ay,Select:r.Select,FieldType:_n,ForeignKey:$t,ThroughCollection:bn},inherit:!0,scope:{useDataSource:x,useTitleFieldProps:I,enqueueChange:j,useDestroyActionAndRefreshCM:_y,useBulkDestroyActionAndRefreshCM:wy,loadCollections:V},children:a.jsx(w.RecursionField,{schema:Dy,onlyRenderProperties:!0})})})})})),a.jsx(Dn,{})]})},Iy=(e,t)=>(o,n)=>{o.loading=!0,e(o,n,t).then(dt.action.bound(i=>{o.dataSource=i,o.loading=!1})).catch(i=>console.log(i))},Oy=()=>{const[e,t]=p.useState([]);return[e,t]},My=()=>{const e=r.useRecord(),t=w.useForm();return{run(){return D(this,null,function*(){var i,s,c;const n=(c=(s=(i=t.values)==null?void 0:i.children)==null?void 0:s.slice)==null?void 0:c.call(s);t.setValuesIn("children",n.filter(l=>l.name!==e.name))})}}},ky=()=>({run(){return D(this,null,function*(){})}}),Ey=e=>`${e||""}${B.uid()}`,jy=()=>{const{t:e}=N.useTranslation(),{interfaces:t}=r.useCollectionManager_deprecated(),{data:{database:o}}=r.useCurrentAppInfo(),n=r.useDataSourceManager(),i=p.useContext(r.SchemaComponentContext),{name:s}=L.useParams(),c=p.useContext(r.CollectionCategoriesContext),l=r.useAPIClient(),f=r.useCompile(),u=()=>D(this,null,function*(){return c.data.map(d=>({label:f(d.name),value:d.id}))}),g=()=>D(this,null,function*(){return l.resource("storages").list().then(({data:d})=>{var h;return(h=d==null?void 0:d.data)==null?void 0:h.map(m=>({label:e(f(m.title)),value:m.name}))})}),y=()=>{const d=p.useContext(r.ResourceActionContext),h=r.useAPIClient(),m=w.useField(),{name:C}=L.useParams();m.data=m.data||{};const{setDataSource:F,dataSource:j}=p.useContext(Ae);return{onClick(){return D(this,null,function*(){var I,V,A;m.data.loading=!0;try{const{data:P}=yield h.request({url:`dataSources:refresh?filterByTk=${C}&clientStatus=${(j==null?void 0:j.status)||"loaded"}`,method:"post"});m.data.loading=!1,F(P==null?void 0:P.data),((I=P==null?void 0:P.data)==null?void 0:I.status)==="reloading"?v.message.warning(e("Data source synchronization in progress")):((V=P==null?void 0:P.data)==null?void 0:V.status)==="loaded"&&(v.message.success(e("Data source synchronization successful")),(A=d==null?void 0:d.refresh)==null||A.call(d)),yield n.getDataSource(C).reload()}catch(P){m.data.loading=!1}})}}},b=p.useMemo(()=>gn(s),[s]),_=l.resource("dataSources",s),[S,$]=p.useState({});p.useEffect(()=>{try{_.get({filterByTk:s}).then(d=>{$(d==null?void 0:d.data)})}catch(d){console.log(d)}},[s]);const x=d=>D(this,null,function*(){const{fields:h}=d.form.values;return Promise.resolve({data:h}).then(({data:m})=>m==null?void 0:m.map(C=>{var F;return{label:f((F=C.uiSchema)==null?void 0:F.title)||C.name,value:C.name}}))});return a.jsx(r.SchemaComponentContext.Provider,{value:K(T({},i),{designable:!1,dataSourceData:S}),children:a.jsx(r.SchemaComponent,{schema:b,components:{AddSubFieldAction:r.AddSubFieldAction,EditSubFieldAction:r.EditSubFieldAction,FieldSummary:r.FieldSummary,TemplateSummay:r.TemplateSummary,CollectionFields:Ko},scope:{useRefreshActionProps:y,useDestroySubField:My,useBulkDestroySubField:ky,useSelectedRowKeys:Oy,useAsyncDataSource:Iy,loadFilterTargetKeys:x,loadCategories:u,loadStorages:g,useNewId:Ey,useCancelAction:r.useCancelAction,interfaces:t,enableInherits:(o==null?void 0:o.dialect)==="postgres",isPG:(o==null?void 0:o.dialect)==="postgres"}})})};var No={exports:{}};/*!
41
+ `,children:[a.jsx(r.Action,A({},F)),a.jsx(r.SyncFieldsAction,A({},k)),a.jsx(r.SyncSQLFieldsAction,{refreshCMList:P}),a.jsx(r.SchemaComponent,{schema:{type:"object",properties:A({},$.configureActions)}}),a.jsx(r.AddCollectionField,A({},E))]}),a.jsx(v.Table,{rowKey:"key",columns:y,dataSource:C.filter(I=>I.fields.length),pagination:!1,className:pn,expandable:{defaultExpandAllRows:!0,defaultExpandedRowKeys:C.map(I=>I.key),expandedRowRender:I=>I.inherit?a.jsx(mn,{fields:I.fields,collectionResource:b,refreshAsync:P}):a.jsx(dn,{fields:I.fields,collectionResource:b,refreshAsync:P})}})]})})},bt=()=>a.jsx(ln,{children:a.jsx(yn,{})}),xt=e=>{const{size:t,style:o}=e,n=r.useAPIClient(),{name:i="main"}=L.useParams(),s=r.useCollectionRecordData(),c=r.useApp(),[l,m]=d.useState(),[u,g]=d.useState(),f=r.useCompile(),b=d.useMemo(()=>c.getCollectionManager(i).getCollection(s.name),[c,i,s.name]),P=d.useMemo(()=>c.getCollectionManager(i).getCollectionFields(s.name).filter(p=>p.interface?!!c.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(p.interface).titleUsable:!1).map(p=>{var C;return{label:f((C=p.uiSchema)==null?void 0:C.title),value:p.name}}),[c,f,i,s.name]),{refresh:T}=r.useResourceActionContext(),$=d.useContext($e),{t:x}=on();return a.jsxs("div",{style:A({},o),children:[x("If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection."),t==="small"?a.jsx("br",{}):" ",a.jsxs(v.Space.Compact,{style:{marginTop:5},children:[a.jsx(v.Select,{onChange:(y,h)=>{m(y),g(h.label)},placeholder:x("Select field"),size:"small",options:P}),a.jsx(v.Popconfirm,{placement:"bottom",title:a.jsx("div",{style:{width:"15em"},children:u?x(`Are you sure you want to set the "{{title}}" field as a record unique key? This setting cannot be changed after it's been set.`,{title:u}):x("Please select a field.")}),onConfirm:()=>D(this,null,function*(){var y;l&&(i==="main"?yield n.request({url:`collections:update?filterByTk=${s.name}`,method:"post",data:{filterTargetKey:l}}):yield n.request({url:`dataSources/${i}/collections:update?filterByTk=${s.name}`,method:"post",data:{filterTargetKey:l}}),(y=$==null?void 0:$.refresh)==null||y.call($),T(),b.setOption("filterTargetKey",l))}),children:a.jsx(v.Button,{type:"primary",size:"small",children:x("OK")})})]})]})},St=e=>{const t=r.useCollectionRecordData()||{},o=r.useCompile();return _.useField().editable?a.jsx(r.Input,A({},e)):t!=null&&t.filterTargetKey?o(t.title):a.jsxs("div",{style:{display:"inline"},children:[a.jsx(v.Popover,{trigger:["click"],content:a.jsx(xt,{size:"small",style:{width:"20em"}}),children:a.jsx(W.ExclamationCircleTwoTone,{style:{marginRight:"0.3em"},twoToneColor:"#faad14"})}),o(t.title)]})},At=e=>_.Schema.compile(e,{t:r.i18n.t}),fn={name:"database-"+B.uid(),filterTargetKey:"name",targetKey:"name",sortable:!0,fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{ t("Collection display name") }}',type:"number","x-component":St,required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Collection name") }}',type:"string","x-component":"CollectionName",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}},{type:"hasMany",name:"inherits",interface:"select",uiSchema:{title:'{{ t("Inherits") }}',type:"string","x-component":"Select","x-component-props":{mode:"multiple"}}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input"}}]},gn=e=>({type:"object",properties:{[B.uid()]:{type:"void","x-collection":"dataSources","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:fn,dragSort:!1,request:{url:`dataSources/${e}/collections:list`,params:{pageSize:50,sort:"sort",filter:{"hidden.$isFalsy":!0},appends:["category"]}}},properties:{tabs:{type:"void","x-component":"ConfigurationTabs"}}}}}),Be={type:"object",properties:{[B.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button",isBulk:!0},"x-visible":"{{allowCollectionDeletion}}"},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"},"x-visible":"{{allowCollectionCreate}}"}}},[B.uid()]:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{cm.useDataSourceFromRAC }}",useAction(){const e=r.useAPIClient(),{t}=N.useTranslation();return{move(n,i){return D(this,null,function*(){yield e.resource("dataSources").move({sourceId:n.key,targetId:i.key}),v.message.success(t("Saved successfully"),.2)})}}}},properties:{column1:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},column6:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{ t("Configure fields") }}',"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{destroyOnClose:!0,width:"70%"},"x-reactions":e=>{const t=e.path.segments[1],o=e.path.segments[0],n=e.form.getValuesIn(`${o}.${t}`);n&&(e.title=`${At(n.title||n.name)} - ${At('{{ t("Configure fields") }}')}`)},properties:{collectionFields:{type:"void","x-component":"CollectionFields"}}}},"x-hidden":"{{disabledConfigureFields}}"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollection","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-visible":"{{allowCollectionDeletion}}","x-component":"DeleteCollection","x-component-props":{role:"button","aria-label":'{{ "delete-button-" + $record.name }}',type:"primary",className:"nb-action-link"}}}}}}}}}},Te=["string","bigInt","integer","uuid","uid"],hn=_.observer(e=>{var u,g;const{name:t}=L.useParams(),{collectionName:o,sourceKey:n,name:i}=r.useRecord(),s=_.useField(),c=r.useCompile(),{getCollection:l}=r.useCollectionManager_deprecated(),m=(u=l(o||i,t).fields)==null?void 0:u.filter(f=>f.primaryKey||f.unique).map(f=>{var b;return{value:f.name,label:c(((b=f.uiSchema)==null?void 0:b.title)||f.title||f.name)}});return d.useEffect(()=>{var f;s.initialValue=((f=m==null?void 0:m[0])==null?void 0:f.value)||n},[]),a.jsx("div",{children:a.jsx(v.Select,{disabled:n,options:m,defaultValue:((g=m==null?void 0:m[0])==null?void 0:g.value)||n,onChange:e==null?void 0:e.onChange,showSearch:!0})})},{displayName:"SourceKey"}),$t=_.observer(e=>{const{disabled:t}=e,o=r.useAPIClient(),[n,i]=d.useState([]),{name:s}=L.useParams(),c=r.useRecord(),l=_.useField(),{collectionName:m,target:u,type:g,through:f,name:b}=c,P=c[l.props.name],{getCollection:T}=r.useCollectionManager_deprecated(),$=r.useCompile(),x=_.useForm(),[y,h]=d.useState(P);return d.useEffect(()=>{var F;l.initialValue=null;const p=["belongsTo"].includes(g)?m:["belongsToMany"].includes(g)?f:u,C=(F=T(p,s))==null?void 0:F.fields;if(C){const E=C==null?void 0:C.filter(k=>Te.includes(k.type)).map(k=>{var I;return{value:k.name,label:$(((I=k.uiSchema)==null?void 0:I.title)||k.title||k.name)}});if(i(E),P){const k=E.find(I=>I.value===P);h((k==null?void 0:k.label)||P)}}},[g]),d.useEffect(()=>{h(P)},[P]),a.jsx("div",{children:a.jsx(v.Select,{disabled:t,value:y,options:n,showSearch:!0,onDropdownVisibleChange:p=>D(this,null,function*(){var I;const{target:C,type:F,through:E}=x.values,k=["belongsTo"].includes(F)?m||b:["belongsToMany"].includes(F)?E:C;if(k&&p){const{data:V}=yield o.request({url:`dataSourcesCollections/${s}.${k}/fields:list`,params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}});i((I=V.data)==null?void 0:I.filter(S=>Te.includes(S.type)).map(S=>{var w;return{value:S.name,label:$(((w=S.uiSchema)==null?void 0:w.title)||S.title||S.name)}}))}}),onChange:p=>{var C;(C=e==null?void 0:e.onChange)==null||C.call(e,p),h(p)}})})},{displayName:"ForeignKey"}),Cn=_.observer(e=>{const{value:t,disabled:o}=e,{targetKey:n,target:i,type:s}=r.useRecord(),{name:c}=L.useParams(),{getCollection:l}=r.useCollectionManager_deprecated(),m=r.useAPIClient(),[u,g]=d.useState([]),[f,b]=d.useState(t||n),P=_.useForm(),T=r.useCompile(),$=_.useField();return $.required=!0,d.useEffect(()=>{var x;i&&g((x=l(i,c).fields)==null?void 0:x.filter(y=>s!=="hasMany"?y.primaryKey||y.unique:Te.includes(y.type)).map(y=>{var h;return{value:y.name,label:T(((h=y==null?void 0:y.uiSchema)==null?void 0:h.title)||y.title||y.name)}}))},[]),a.jsx("div",{children:a.jsx(v.Select,{showSearch:!0,options:u,onDropdownVisibleChange:x=>D(this,null,function*(){var p;const{target:y,type:h}=P.values;if(y&&x){const{data:C}=yield m.request({url:`dataSourcesCollections/${c}.${y}/fields:list`,params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}});g((p=C.data)==null?void 0:p.filter(F=>h!=="hasMany"?F.primaryKey||F.unique:Te.includes(F.type)).map(F=>{var E;return{value:F.name,label:T(((E=F.uiSchema)==null?void 0:E.title)||F.title||F.name)}}))}}),onChange:x=>{var y;(y=e==null?void 0:e.onChange)==null||y.call(e,x),b(x)},value:f,disabled:o})})},{displayName:"TargetKey"}),vn=_.observer(()=>{const e=r.useCompile(),{targetCollection:t}=ct();return a.jsx("div",{children:a.jsx(v.Select,{disabled:!0,showSearch:!0,popupMatchSelectWidth:!1,value:t.name,options:[{value:t.name,label:e(t.title||t.name)}]})})},{displayName:"SourceCollection"}),bn=_.observer(e=>{const{disabled:t}=e,o=r.useCompile(),[n,i]=d.useState([]),{name:s}=L.useParams(),c=_.useField(),{getCollections:l}=r.useCollectionManager_deprecated(s),u=r.useRecord()[c.props.name],g=()=>l().filter(b=>!(b.autoCreate&&b.isThrough)).map(b=>({label:o(b.title||b.name),value:b.name}));return d.useEffect(()=>{const f=g();i(f)},[]),a.jsx("div",{children:a.jsx(v.Select,{disabled:t,showSearch:!0,popupMatchSelectWidth:!1,fieldNames:{label:"label",value:"value"},defaultValue:u,options:n,onChange:f=>{var b;(b=e==null?void 0:e.onChange)==null||b.call(e,f)}})})},{displayName:"ThroughCollection"}),xn=(e,t,o)=>{var s;if(!e)return;const n=Y.cloneDeep(e.properties);n!=null&&n.foreignKey&&(n.foreignKey["x-component"]=$t),e.hasDefaultValue===!0&&(n.defaultValue=Y.cloneDeep((s=e==null?void 0:e.default)==null?void 0:s.uiSchema),n.defaultValue.required=!1,n.defaultValue.title=o('{{ t("Default value") }}'),n.defaultValue["x-decorator"]="FormItem",n.defaultValue["x-reactions"]={dependencies:["uiSchema.x-component-props.gmt","uiSchema.x-component-props.showTime","uiSchema.x-component-props.dateFormat","uiSchema.x-component-props.timeFormat"],fulfill:{state:{componentProps:{gmt:"{{$deps[0]}}",showTime:"{{$deps[1]}}",dateFormat:"{{$deps[2]}}",timeFormat:"{{$deps[3]}}"}}}});const i=K(A({name:`f_${B.uid()}`},Y.cloneDeep(e.default)),{interface:e.name});return i.reverseField&&(i.reverseField.name=`f_${B.uid()}`),{type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues(c){return r.useRequest(()=>Promise.resolve({data:i}),c)}},title:`${o(t.title||t.name)} - ${o('{{ t("Add field") }}')}`,properties:K(A({summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}}},n),{description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateCollectionField }}"}}}}})}}}},Sn=()=>{const e=_.useForm(),t=r.useActionContext(),{refresh:o}=r.useResourceActionContext(),n=_.useField(),i=r.useAPIClient(),s=r.useRecord(),{name:c}=L.useParams(),l=r.useDataSourceManager();return{run(){return D(this,null,function*(){yield e.submit(),n.data=n.data||{},n.data.loading=!0;const u=Y.cloneDeep(e.values);u.autoCreateReverseField||delete u.reverseField,delete u.autoCreateReverseField;try{yield i.request({url:`dataSourcesCollections/${c}.${s.name}/fields:create`,method:"post",data:u}),t.setVisible(!1),l.getDataSource(c).reload(),yield e.reset(),n.data.loading=!1,o()}catch(g){n.data.loading=!1}})}}},An=e=>{const t=r.useRecord();return a.jsx($n,A({item:t},e))},$n=e=>{const{scope:t,getContainer:o,item:n,children:i,trigger:s,align:c,database:l}=e,{getInterface:m,getTemplate:u,collections:g}=r.useCollectionManager_deprecated(),[f,b]=d.useState(!1),[P,T]=d.useState(),[$,x]=d.useState({}),y=r.useCompile(),{t:h}=N.useTranslation(),{data:{database:p}}=r.useCurrentAppInfo(),C=S=>(p==null?void 0:p.dialect)===S,F=d.useMemo(()=>g.map(S=>({label:y(S.title),value:S.name})),[]),E=r.useFieldInterfaceOptions(),k=d.useCallback(()=>{const{availableFieldInterfaces:S}=u(n.template)||{},{exclude:w,include:O}=S||{},U=[];return E.forEach(z=>{var R;if(z.key==="relation"){let J=[];O!=null&&O.length?O.forEach(X=>{var H;const Se=(H=z==null?void 0:z.children)==null?void 0:H.find(Qo=>[X,X.interface].includes(Qo.value));Se&&J.push(K(A({},Se),{targetScope:X==null?void 0:X.targetScope}))}):w!=null&&w.length?J=(R=z==null?void 0:z.children)==null?void 0:R.filter(X=>!w.includes(X.value)):J=z==null?void 0:z.children,J!=null&&J.length&&U.push(K(A({},z),{children:J}))}}),U},[u,n]),I=d.useMemo(()=>k().map(S=>{var w;return((w=S==null?void 0:S.children)==null?void 0:w.length)===0?null:n.template==="view"?{type:"group",label:y(S.label),title:y(S.label),key:S.label,children:S.children.filter(O=>["m2o"].includes(O.name)).map(O=>({label:y(O.title),title:y(O.title),key:O.name,dataTargetScope:O.targetScope}))}:{type:"group",label:y(S.label),title:y(S.label),key:S.label,children:S==null?void 0:S.children.filter(O=>!["o2o","subTable","linkTo"].includes(O.name)).map(O=>({label:y(O.title),title:y(O.title),key:O.name,dataTargetScope:O.targetScope}))}}).filter(S=>{var w;return(w=S==null?void 0:S.children)==null?void 0:w.length}),[k]),V=d.useMemo(()=>({style:{maxHeight:"60vh",overflow:"auto"},onClick:S=>{const w=S.item.props["data-targetScope"];w&&T(w);const O=xn(m(S.key),n,y);O&&(x(O),b(!0))},items:I}),[m,I,n]);return n.template!=="sql"&&a.jsx(r.RecordProvider,{record:n,children:a.jsxs(r.ActionContextProvider,{value:{visible:f,setVisible:b},children:[a.jsx(v.Dropdown,{getPopupContainer:o,trigger:s,align:c,menu:V,children:i||a.jsx(v.Button,{icon:a.jsx(W.PlusOutlined,{}),type:"primary",children:h("Add field")})}),a.jsx(r.SchemaComponent,{schema:$,components:{ArrayTable:ae.ArrayTable},scope:A({getContainer:o,useCancelAction:r.useCancelAction,createOnly:!0,isOverride:!1,override:!1,useCreateCollectionField:Sn,record:n,showReverseFieldConfig:!1,targetScope:P,collections:F,isDialect:C,disabledJSONB:!1,createMainOnly:!0},t)})]})})},Tt=(e,t)=>{const o=[];return e.forEach(n=>{const i=n.children.filter(s=>{var c;return(c=s==null?void 0:s.availableTypes)==null?void 0:c.includes(t)});o.push({label:n.label,key:n.key,children:i})}),o.filter(n=>t==="sort"?n.key==="advanced":n.children.length>0)},Tn=(e,t)=>t==null?void 0:t.some(o=>{var n,i;return(i=(n=o.children)==null?void 0:n.some)==null?void 0:i.call(n,s=>s.name===e)}),Fn=_.observer(e=>{var P;const{value:t,handleFieldChange:o}=e,{data:n}=r.useCollectionRecord(),{getInterface:i}=r.useCollectionManager_deprecated(),s=r.useCompile(),c=r.useFieldInterfaceOptions(),l=Tt(c,n.type),[m,u]=d.useState(t),[g,f]=d.useState(l),b=n.type;return d.useEffect(()=>{var T,$,x,y,h,p,C,F,E,k,I,V;if(g.length===1&&(($=(T=g[0])==null?void 0:T.children)==null?void 0:$.length)===1){const S=(h=(y=(x=g[0])==null?void 0:x.children)==null?void 0:y[0])==null?void 0:h.name;if(S!==m){const w=i(S);o({interface:S,uiSchema:A({title:(p=n==null?void 0:n.uiSchema)==null?void 0:p.title},(C=w==null?void 0:w.default)==null?void 0:C.uiSchema)},n.name,!1),u(S)}}else if(m&&!Tn(m,g)){const S=(k=(E=(F=g[0])==null?void 0:F.children)==null?void 0:E[0])==null?void 0:k.name,w=i(S);o({interface:S,uiSchema:A({title:(I=n==null?void 0:n.uiSchema)==null?void 0:I.title},(V=w==null?void 0:w.default)==null?void 0:V.uiSchema)},n.name,!1),u(S)}},[g]),d.useEffect(()=>{if(n!=null&&n.possibleTypes){const T=Tt(c,b);f(T)}},[b]),["oho","obo","o2m","m2o","m2m"].includes(n.interface)?a.jsx(v.Tag,{children:s((P=c.find(T=>T.key==="relation").children.find(T=>T.name===t))==null?void 0:P.label)},t):a.jsx(v.Select,{"aria-label":`field-interface-${n==null?void 0:n.type}`,role:"button",value:m,style:{width:"100%"},popupMatchSelectWidth:!1,onChange:T=>{var x,y;const $=i(T);o({interface:T,uiSchema:A({title:(x=n==null?void 0:n.uiSchema)==null?void 0:x.title},(y=$==null?void 0:$.default)==null?void 0:y.uiSchema)},n.name),u(T)},children:g.map(T=>a.jsx(v.Select.OptGroup,{label:s(T.label),children:T.children.map($=>a.jsx(v.Select.Option,{value:$.name,children:s($.label)},$.name))},T.key))})},{displayName:"CollectionFieldInterfaceSelect"}),wn=_.observer(e=>{const{value:t,handleFieldChange:o}=e,n=r.useRecord(),[i,s]=d.useState(t),c=u=>{s(u)},l=d.useMemo(()=>Y.debounce(u=>{o({uiSchema:K(A({},n==null?void 0:n.uiSchema),{title:u})},n.name)},1e3),[o,n]),m=u=>{const g=u.target.value;c(g),l(g)};return d.useEffect(()=>{s(t)},[t]),a.jsx(v.Input,{value:i,onChange:m,style:{minWidth:"100px"},"aria-label":"field-title-input"})},{displayName:"FieldTitleInput"}),_n=_.observer(e=>{const{value:t,handleFieldChange:o,onChange:n}=e,i=r.useRecord(),s=i;return s!=null&&s.possibleTypes?a.jsx(v.Select,{"aria-label":`field-type-${t}`,role:"button",defaultValue:t,popupMatchSelectWidth:!1,style:{width:"100%"},options:(s==null?void 0:s.possibleTypes.map(c=>({label:c,value:c})))||[],onChange:c=>{n==null||n(c),o(K(A({},s),{type:c}),i.name)}}):a.jsx(v.Tag,{children:t})},{displayName:"FieldType"}),Pn=r.withDynamicSchemaProps(e=>{const{t}=N.useTranslation(),{isTitleField:o}=r.useCollectionManager_deprecated(),[n,i]=d.useState(null),s=r.useDataSourceManager(),{setTitleField:c,filterByTk:l,dataSourceKey:m}=r.useProps(e),u=r.useRecord(),g=r.useAPIClient(),{refreshRM:f,titleField:b}=ct(),P=T=>D(this,null,function*(){i(u),yield g.request({url:`dataSources/${m}/collections:update?filterByTk=${l}`,method:"post",data:{titleField:T?u.name:"id"}}),v.message.success(t("Saved successfully")),f(),c(T?u.name:"id"),yield s.getDataSource(m).reload(),i(null)});return o(u)?a.jsx(v.Tooltip,{title:t("Default title for each record"),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(v.Switch,{"aria-label":`switch-title-field-${u==null?void 0:u.name}`,size:"small",loading:(u==null?void 0:u.name)===(n==null?void 0:n.name),checked:(u==null?void 0:u.name)===(b||"id"),onChange:P})}):null},{displayName:"TitleField"}),Dn=()=>{const{t:e}=N.useTranslation(),{unsupportedFields:t}=r.useRecord(),o=[{title:e("Field name"),dataIndex:"name",key:"name"},{title:e("Field database type",{ns:j}),dataIndex:"rawType",key:"rawType"}];return(t==null?void 0:t.length)>0&&a.jsxs(a.Fragment,{children:[a.jsx(v.Divider,{plain:!0,orientation:"left",orientationMargin:"0",children:a.jsx("h3",{children:e("Unknown field type",{ns:j})})}),a.jsx("div",{style:{marginBottom:"15px"},children:e("The following field types are not compatible and do not support output and display",{ns:j})}),a.jsx(v.Table,{columns:o,dataSource:t,pagination:!1})]})};var Fe=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function we(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function In(){this.__data__=[],this.size=0}var On=In;function Mn(e,t){return e===t||e!==e&&t!==t}var Ft=Mn,kn=Ft;function En(e,t){for(var o=e.length;o--;)if(kn(e[o][0],t))return o;return-1}var _e=En,jn=_e,Kn=Array.prototype,Nn=Kn.splice;function Bn(e){var t=this.__data__,o=jn(t,e);if(o<0)return!1;var n=t.length-1;return o==n?t.pop():Nn.call(t,o,1),--this.size,!0}var Vn=Bn,Ln=_e;function qn(e){var t=this.__data__,o=Ln(t,e);return o<0?void 0:t[o][1]}var Gn=qn,Un=_e;function zn(e){return Un(this.__data__,e)>-1}var Hn=zn,Wn=_e;function Qn(e,t){var o=this.__data__,n=Wn(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this}var Yn=Qn,Jn=On,Zn=Vn,Xn=Gn,Rn=Hn,er=Yn;function se(e){var t=-1,o=e==null?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}se.prototype.clear=Jn,se.prototype.delete=Zn,se.prototype.get=Xn,se.prototype.has=Rn,se.prototype.set=er;var Pe=se,tr=Pe;function or(){this.__data__=new tr,this.size=0}var nr=or;function rr(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o}var ar=rr;function sr(e){return this.__data__.get(e)}var ir=sr;function cr(e){return this.__data__.has(e)}var lr=cr,ur=typeof Fe=="object"&&Fe&&Fe.Object===Object&&Fe,wt=ur,pr=wt,dr=typeof self=="object"&&self&&self.Object===Object&&self,mr=pr||dr||Function("return this")(),Z=mr,yr=Z,fr=yr.Symbol,he=fr,_t=he,Pt=Object.prototype,gr=Pt.hasOwnProperty,hr=Pt.toString,Ce=_t?_t.toStringTag:void 0;function Cr(e){var t=gr.call(e,Ce),o=e[Ce];try{e[Ce]=void 0;var n=!0}catch(s){}var i=hr.call(e);return n&&(t?e[Ce]=o:delete e[Ce]),i}var vr=Cr,br=Object.prototype,xr=br.toString;function Sr(e){return xr.call(e)}var Ar=Sr,Dt=he,$r=vr,Tr=Ar,Fr="[object Null]",wr="[object Undefined]",It=Dt?Dt.toStringTag:void 0;function _r(e){return e==null?e===void 0?wr:Fr:It&&It in Object(e)?$r(e):Tr(e)}var ie=_r;function Pr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ce=Pr,Dr=ie,Ir=ce,Or="[object AsyncFunction]",Mr="[object Function]",kr="[object GeneratorFunction]",Er="[object Proxy]";function jr(e){if(!Ir(e))return!1;var t=Dr(e);return t==Mr||t==kr||t==Or||t==Er}var Ot=jr,Kr=Z,Nr=Kr["__core-js_shared__"],Br=Nr,Ve=Br,Mt=function(){var e=/[^.]+$/.exec(Ve&&Ve.keys&&Ve.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Vr(e){return!!Mt&&Mt in e}var Lr=Vr,qr=Function.prototype,Gr=qr.toString;function Ur(e){if(e!=null){try{return Gr.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var kt=Ur,zr=Ot,Hr=Lr,Wr=ce,Qr=kt,Yr=/[\\^$.*+?()[\]{}|]/g,Jr=/^\[object .+?Constructor\]$/,Zr=Function.prototype,Xr=Object.prototype,Rr=Zr.toString,ea=Xr.hasOwnProperty,ta=RegExp("^"+Rr.call(ea).replace(Yr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oa(e){if(!Wr(e)||Hr(e))return!1;var t=zr(e)?ta:Jr;return t.test(Qr(e))}var na=oa;function ra(e,t){return e==null?void 0:e[t]}var aa=ra,sa=na,ia=aa;function ca(e,t){var o=ia(e,t);return sa(o)?o:void 0}var te=ca,la=te,ua=Z,pa=la(ua,"Map"),Le=pa,da=te,ma=da(Object,"create"),De=ma,Et=De;function ya(){this.__data__=Et?Et(null):{},this.size=0}var fa=ya;function ga(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ha=ga,Ca=De,va="__lodash_hash_undefined__",ba=Object.prototype,xa=ba.hasOwnProperty;function Sa(e){var t=this.__data__;if(Ca){var o=t[e];return o===va?void 0:o}return xa.call(t,e)?t[e]:void 0}var Aa=Sa,$a=De,Ta=Object.prototype,Fa=Ta.hasOwnProperty;function wa(e){var t=this.__data__;return $a?t[e]!==void 0:Fa.call(t,e)}var _a=wa,Pa=De,Da="__lodash_hash_undefined__";function Ia(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Pa&&t===void 0?Da:t,this}var Oa=Ia,Ma=fa,ka=ha,Ea=Aa,ja=_a,Ka=Oa;function le(e){var t=-1,o=e==null?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}le.prototype.clear=Ma,le.prototype.delete=ka,le.prototype.get=Ea,le.prototype.has=ja,le.prototype.set=Ka;var Na=le,jt=Na,Ba=Pe,Va=Le;function La(){this.size=0,this.__data__={hash:new jt,map:new(Va||Ba),string:new jt}}var qa=La;function Ga(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Ua=Ga,za=Ua;function Ha(e,t){var o=e.__data__;return za(t)?o[typeof t=="string"?"string":"hash"]:o.map}var Ie=Ha,Wa=Ie;function Qa(e){var t=Wa(this,e).delete(e);return this.size-=t?1:0,t}var Ya=Qa,Ja=Ie;function Za(e){return Ja(this,e).get(e)}var Xa=Za,Ra=Ie;function es(e){return Ra(this,e).has(e)}var ts=es,os=Ie;function ns(e,t){var o=os(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this}var rs=ns,as=qa,ss=Ya,is=Xa,cs=ts,ls=rs;function ue(e){var t=-1,o=e==null?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}ue.prototype.clear=as,ue.prototype.delete=ss,ue.prototype.get=is,ue.prototype.has=cs,ue.prototype.set=ls;var Kt=ue,us=Pe,ps=Le,ds=Kt,ms=200;function ys(e,t){var o=this.__data__;if(o instanceof us){var n=o.__data__;if(!ps||n.length<ms-1)return n.push([e,t]),this.size=++o.size,this;o=this.__data__=new ds(n)}return o.set(e,t),this.size=o.size,this}var fs=ys,gs=Pe,hs=nr,Cs=ar,vs=ir,bs=lr,xs=fs;function pe(e){var t=this.__data__=new gs(e);this.size=t.size}pe.prototype.clear=hs,pe.prototype.delete=Cs,pe.prototype.get=vs,pe.prototype.has=bs,pe.prototype.set=xs;var Ss=pe;function As(e,t){for(var o=-1,n=e==null?0:e.length;++o<n&&t(e[o],o,e)!==!1;);return e}var $s=As,Ts=te,Fs=function(){try{var e=Ts(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Nt=Fs,Bt=Nt;function ws(e,t,o){t=="__proto__"&&Bt?Bt(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}var Vt=ws,_s=Vt,Ps=Ft,Ds=Object.prototype,Is=Ds.hasOwnProperty;function Os(e,t,o){var n=e[t];(!(Is.call(e,t)&&Ps(n,o))||o===void 0&&!(t in e))&&_s(e,t,o)}var qe=Os,Ms=qe,ks=Vt;function Es(e,t,o,n){var i=!o;o||(o={});for(var s=-1,c=t.length;++s<c;){var l=t[s],m=n?n(o[l],e[l],l,o,e):void 0;m===void 0&&(m=e[l]),i?ks(o,l,m):Ms(o,l,m)}return o}var ve=Es;function js(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n}var Ks=js;function Ns(e){return e!=null&&typeof e=="object"}var oe=Ns,Bs=ie,Vs=oe,Ls="[object Arguments]";function qs(e){return Vs(e)&&Bs(e)==Ls}var Gs=qs,Lt=Gs,Us=oe,qt=Object.prototype,zs=qt.hasOwnProperty,Hs=qt.propertyIsEnumerable,Ws=Lt(function(){return arguments}())?Lt:function(e){return Us(e)&&zs.call(e,"callee")&&!Hs.call(e,"callee")},Gt=Ws,Qs=Array.isArray,ne=Qs,Oe={exports:{}};function Ys(){return!1}var Js=Ys;Oe.exports,function(e,t){var o=Z,n=Js,i=t&&!t.nodeType&&t,s=i&&!0&&e&&!e.nodeType&&e,c=s&&s.exports===i,l=c?o.Buffer:void 0,m=l?l.isBuffer:void 0,u=m||n;e.exports=u}(Oe,Oe.exports);var Ut=Oe.exports,Zs=9007199254740991,Xs=/^(?:0|[1-9]\d*)$/;function Rs(e,t){var o=typeof e;return t=t==null?Zs:t,!!t&&(o=="number"||o!="symbol"&&Xs.test(e))&&e>-1&&e%1==0&&e<t}var zt=Rs,ei=9007199254740991;function ti(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ei}var Ht=ti,oi=ie,ni=Ht,ri=oe,ai="[object Arguments]",si="[object Array]",ii="[object Boolean]",ci="[object Date]",li="[object Error]",ui="[object Function]",pi="[object Map]",di="[object Number]",mi="[object Object]",yi="[object RegExp]",fi="[object Set]",gi="[object String]",hi="[object WeakMap]",Ci="[object ArrayBuffer]",vi="[object DataView]",bi="[object Float32Array]",xi="[object Float64Array]",Si="[object Int8Array]",Ai="[object Int16Array]",$i="[object Int32Array]",Ti="[object Uint8Array]",Fi="[object Uint8ClampedArray]",wi="[object Uint16Array]",_i="[object Uint32Array]",G={};G[bi]=G[xi]=G[Si]=G[Ai]=G[$i]=G[Ti]=G[Fi]=G[wi]=G[_i]=!0,G[ai]=G[si]=G[Ci]=G[ii]=G[vi]=G[ci]=G[li]=G[ui]=G[pi]=G[di]=G[mi]=G[yi]=G[fi]=G[gi]=G[hi]=!1;function Pi(e){return ri(e)&&ni(e.length)&&!!G[oi(e)]}var Di=Pi;function Ii(e){return function(t){return e(t)}}var Ge=Ii,Me={exports:{}};Me.exports,function(e,t){var o=wt,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===n,c=s&&o.process,l=function(){try{var m=i&&i.require&&i.require("util").types;return m||c&&c.binding&&c.binding("util")}catch(u){}}();e.exports=l}(Me,Me.exports);var Ue=Me.exports,Oi=Di,Mi=Ge,Wt=Ue,Qt=Wt&&Wt.isTypedArray,ki=Qt?Mi(Qt):Oi,Ei=ki,ji=Ks,Ki=Gt,Ni=ne,Bi=Ut,Vi=zt,Li=Ei,qi=Object.prototype,Gi=qi.hasOwnProperty;function Ui(e,t){var o=Ni(e),n=!o&&Ki(e),i=!o&&!n&&Bi(e),s=!o&&!n&&!i&&Li(e),c=o||n||i||s,l=c?ji(e.length,String):[],m=l.length;for(var u in e)(t||Gi.call(e,u))&&!(c&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Vi(u,m)))&&l.push(u);return l}var Yt=Ui,zi=Object.prototype;function Hi(e){var t=e&&e.constructor,o=typeof t=="function"&&t.prototype||zi;return e===o}var ze=Hi;function Wi(e,t){return function(o){return e(t(o))}}var Jt=Wi,Qi=Jt,Yi=Qi(Object.keys,Object),Ji=Yi,Zi=ze,Xi=Ji,Ri=Object.prototype,ec=Ri.hasOwnProperty;function tc(e){if(!Zi(e))return Xi(e);var t=[];for(var o in Object(e))ec.call(e,o)&&o!="constructor"&&t.push(o);return t}var oc=tc,nc=Ot,rc=Ht;function ac(e){return e!=null&&rc(e.length)&&!nc(e)}var Zt=ac,sc=Yt,ic=oc,cc=Zt;function lc(e){return cc(e)?sc(e):ic(e)}var He=lc,uc=ve,pc=He;function dc(e,t){return e&&uc(t,pc(t),e)}var mc=dc;function yc(e){var t=[];if(e!=null)for(var o in Object(e))t.push(o);return t}var fc=yc,gc=ce,hc=ze,Cc=fc,vc=Object.prototype,bc=vc.hasOwnProperty;function xc(e){if(!gc(e))return Cc(e);var t=hc(e),o=[];for(var n in e)n=="constructor"&&(t||!bc.call(e,n))||o.push(n);return o}var Sc=xc,Ac=Yt,$c=Sc,Tc=Zt;function Fc(e){return Tc(e)?Ac(e,!0):$c(e)}var We=Fc,wc=ve,_c=We;function Pc(e,t){return e&&wc(t,_c(t),e)}var Dc=Pc,ke={exports:{}};ke.exports,function(e,t){var o=Z,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===n,c=s?o.Buffer:void 0,l=c?c.allocUnsafe:void 0;function m(u,g){if(g)return u.slice();var f=u.length,b=l?l(f):new u.constructor(f);return u.copy(b),b}e.exports=m}(ke,ke.exports);var Ic=ke.exports;function Oc(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o<n;)t[o]=e[o];return t}var Mc=Oc;function kc(e,t){for(var o=-1,n=e==null?0:e.length,i=0,s=[];++o<n;){var c=e[o];t(c,o,e)&&(s[i++]=c)}return s}var Ec=kc;function jc(){return[]}var Xt=jc,Kc=Ec,Nc=Xt,Bc=Object.prototype,Vc=Bc.propertyIsEnumerable,Rt=Object.getOwnPropertySymbols,Lc=Rt?function(e){return e==null?[]:(e=Object(e),Kc(Rt(e),function(t){return Vc.call(e,t)}))}:Nc,Qe=Lc,qc=ve,Gc=Qe;function Uc(e,t){return qc(e,Gc(e),t)}var zc=Uc;function Hc(e,t){for(var o=-1,n=t.length,i=e.length;++o<n;)e[i+o]=t[o];return e}var Ye=Hc,Wc=Jt,Qc=Wc(Object.getPrototypeOf,Object),Je=Qc,Yc=Ye,Jc=Je,Zc=Qe,Xc=Xt,Rc=Object.getOwnPropertySymbols,el=Rc?function(e){for(var t=[];e;)Yc(t,Zc(e)),e=Jc(e);return t}:Xc,eo=el,tl=ve,ol=eo;function nl(e,t){return tl(e,ol(e),t)}var rl=nl,al=Ye,sl=ne;function il(e,t,o){var n=t(e);return sl(e)?n:al(n,o(e))}var to=il,cl=to,ll=Qe,ul=He;function pl(e){return cl(e,ul,ll)}var dl=pl,ml=to,yl=eo,fl=We;function gl(e){return ml(e,fl,yl)}var oo=gl,hl=te,Cl=Z,vl=hl(Cl,"DataView"),bl=vl,xl=te,Sl=Z,Al=xl(Sl,"Promise"),$l=Al,Tl=te,Fl=Z,wl=Tl(Fl,"Set"),_l=wl,Pl=te,Dl=Z,Il=Pl(Dl,"WeakMap"),Ol=Il,Ze=bl,Xe=Le,Re=$l,et=_l,tt=Ol,no=ie,de=kt,ro="[object Map]",Ml="[object Object]",ao="[object Promise]",so="[object Set]",io="[object WeakMap]",co="[object DataView]",kl=de(Ze),El=de(Xe),jl=de(Re),Kl=de(et),Nl=de(tt),re=no;(Ze&&re(new Ze(new ArrayBuffer(1)))!=co||Xe&&re(new Xe)!=ro||Re&&re(Re.resolve())!=ao||et&&re(new et)!=so||tt&&re(new tt)!=io)&&(re=function(e){var t=no(e),o=t==Ml?e.constructor:void 0,n=o?de(o):"";if(n)switch(n){case kl:return co;case El:return ro;case jl:return ao;case Kl:return so;case Nl:return io}return t});var ot=re,Bl=Object.prototype,Vl=Bl.hasOwnProperty;function Ll(e){var t=e.length,o=new e.constructor(t);return t&&typeof e[0]=="string"&&Vl.call(e,"index")&&(o.index=e.index,o.input=e.input),o}var ql=Ll,Gl=Z,Ul=Gl.Uint8Array,zl=Ul,lo=zl;function Hl(e){var t=new e.constructor(e.byteLength);return new lo(t).set(new lo(e)),t}var nt=Hl,Wl=nt;function Ql(e,t){var o=t?Wl(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}var Yl=Ql,Jl=/\w*$/;function Zl(e){var t=new e.constructor(e.source,Jl.exec(e));return t.lastIndex=e.lastIndex,t}var Xl=Zl,uo=he,po=uo?uo.prototype:void 0,mo=po?po.valueOf:void 0;function Rl(e){return mo?Object(mo.call(e)):{}}var eu=Rl,tu=nt;function ou(e,t){var o=t?tu(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}var nu=ou,ru=nt,au=Yl,su=Xl,iu=eu,cu=nu,lu="[object Boolean]",uu="[object Date]",pu="[object Map]",du="[object Number]",mu="[object RegExp]",yu="[object Set]",fu="[object String]",gu="[object Symbol]",hu="[object ArrayBuffer]",Cu="[object DataView]",vu="[object Float32Array]",bu="[object Float64Array]",xu="[object Int8Array]",Su="[object Int16Array]",Au="[object Int32Array]",$u="[object Uint8Array]",Tu="[object Uint8ClampedArray]",Fu="[object Uint16Array]",wu="[object Uint32Array]";function _u(e,t,o){var n=e.constructor;switch(t){case hu:return ru(e);case lu:case uu:return new n(+e);case Cu:return au(e,o);case vu:case bu:case xu:case Su:case Au:case $u:case Tu:case Fu:case wu:return cu(e,o);case pu:return new n;case du:case fu:return new n(e);case mu:return su(e);case yu:return new n;case gu:return iu(e)}}var Pu=_u,Du=ce,yo=Object.create,Iu=function(){function e(){}return function(t){if(!Du(t))return{};if(yo)return yo(t);e.prototype=t;var o=new e;return e.prototype=void 0,o}}(),Ou=Iu,Mu=Ou,ku=Je,Eu=ze;function ju(e){return typeof e.constructor=="function"&&!Eu(e)?Mu(ku(e)):{}}var Ku=ju,Nu=ot,Bu=oe,Vu="[object Map]";function Lu(e){return Bu(e)&&Nu(e)==Vu}var qu=Lu,Gu=qu,Uu=Ge,fo=Ue,go=fo&&fo.isMap,zu=go?Uu(go):Gu,Hu=zu,Wu=ot,Qu=oe,Yu="[object Set]";function Ju(e){return Qu(e)&&Wu(e)==Yu}var Zu=Ju,Xu=Zu,Ru=Ge,ho=Ue,Co=ho&&ho.isSet,ep=Co?Ru(Co):Xu,tp=ep,op=Ss,np=$s,rp=qe,ap=mc,sp=Dc,ip=Ic,cp=Mc,lp=zc,up=rl,pp=dl,dp=oo,mp=ot,yp=ql,fp=Pu,gp=Ku,hp=ne,Cp=Ut,vp=Hu,bp=ce,xp=tp,Sp=He,Ap=We,$p=1,Tp=2,Fp=4,vo="[object Arguments]",wp="[object Array]",_p="[object Boolean]",Pp="[object Date]",Dp="[object Error]",bo="[object Function]",Ip="[object GeneratorFunction]",Op="[object Map]",Mp="[object Number]",xo="[object Object]",kp="[object RegExp]",Ep="[object Set]",jp="[object String]",Kp="[object Symbol]",Np="[object WeakMap]",Bp="[object ArrayBuffer]",Vp="[object DataView]",Lp="[object Float32Array]",qp="[object Float64Array]",Gp="[object Int8Array]",Up="[object Int16Array]",zp="[object Int32Array]",Hp="[object Uint8Array]",Wp="[object Uint8ClampedArray]",Qp="[object Uint16Array]",Yp="[object Uint32Array]",q={};q[vo]=q[wp]=q[Bp]=q[Vp]=q[_p]=q[Pp]=q[Lp]=q[qp]=q[Gp]=q[Up]=q[zp]=q[Op]=q[Mp]=q[xo]=q[kp]=q[Ep]=q[jp]=q[Kp]=q[Hp]=q[Wp]=q[Qp]=q[Yp]=!0,q[Dp]=q[bo]=q[Np]=!1;function Ee(e,t,o,n,i,s){var c,l=t&$p,m=t&Tp,u=t&Fp;if(o&&(c=i?o(e,n,i,s):o(e)),c!==void 0)return c;if(!bp(e))return e;var g=hp(e);if(g){if(c=yp(e),!l)return cp(e,c)}else{var f=mp(e),b=f==bo||f==Ip;if(Cp(e))return ip(e,l);if(f==xo||f==vo||b&&!i){if(c=m||b?{}:gp(e),!l)return m?up(e,sp(c,e)):lp(e,ap(c,e))}else{if(!q[f])return i?e:{};c=fp(e,f,l)}}s||(s=new op);var P=s.get(e);if(P)return P;s.set(e,c),xp(e)?e.forEach(function(x){c.add(Ee(x,t,o,x,e,s))}):vp(e)&&e.forEach(function(x,y){c.set(y,Ee(x,t,o,y,e,s))});var T=u?m?dp:pp:m?Ap:Sp,$=g?void 0:T(e);return np($||e,function(x,y){$&&(y=x,x=e[y]),rp(c,y,Ee(x,t,o,y,e,s))}),c}var So=Ee,Jp=So,Zp=1,Xp=4;function Rp(e){return Jp(e,Zp|Xp)}var ed=Rp;const ee=we(ed);function td(e,t){for(var o=-1,n=e==null?0:e.length,i=Array(n);++o<n;)i[o]=t(e[o],o,e);return i}var Ao=td,od=ie,nd=oe,rd="[object Symbol]";function ad(e){return typeof e=="symbol"||nd(e)&&od(e)==rd}var rt=ad,sd=ne,id=rt,cd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ld=/^\w*$/;function ud(e,t){if(sd(e))return!1;var o=typeof e;return o=="number"||o=="symbol"||o=="boolean"||e==null||id(e)?!0:ld.test(e)||!cd.test(e)||t!=null&&e in Object(t)}var pd=ud,$o=Kt,dd="Expected a function";function at(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(dd);var o=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=o.cache;if(s.has(i))return s.get(i);var c=e.apply(this,n);return o.cache=s.set(i,c)||s,c};return o.cache=new(at.Cache||$o),o}at.Cache=$o;var md=at,yd=md,fd=500;function gd(e){var t=yd(e,function(n){return o.size===fd&&o.clear(),n}),o=t.cache;return t}var hd=gd,Cd=hd,vd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bd=/\\(\\)?/g,xd=Cd(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(vd,function(o,n,i,s){t.push(i?s.replace(bd,"$1"):n||o)}),t}),Sd=xd,To=he,Ad=Ao,$d=ne,Td=rt,Fd=1/0,Fo=To?To.prototype:void 0,wo=Fo?Fo.toString:void 0;function _o(e){if(typeof e=="string")return e;if($d(e))return Ad(e,_o)+"";if(Td(e))return wo?wo.call(e):"";var t=e+"";return t=="0"&&1/e==-Fd?"-0":t}var wd=_o,_d=wd;function Pd(e){return e==null?"":_d(e)}var Dd=Pd,Id=ne,Od=pd,Md=Sd,kd=Dd;function Ed(e,t){return Id(e)?e:Od(e,t)?[e]:Md(kd(e))}var je=Ed;function jd(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Kd=jd,Nd=rt,Bd=1/0;function Vd(e){if(typeof e=="string"||Nd(e))return e;var t=e+"";return t=="0"&&1/e==-Bd?"-0":t}var st=Vd,Ld=je,qd=st;function Gd(e,t){t=Ld(t,e);for(var o=0,n=t.length;e!=null&&o<n;)e=e[qd(t[o++])];return o&&o==n?e:void 0}var Ud=Gd;function zd(e,t,o){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),o=o>i?i:o,o<0&&(o+=i),i=t>o?0:o-t>>>0,t>>>=0;for(var s=Array(i);++n<i;)s[n]=e[n+t];return s}var Hd=zd,Wd=Ud,Qd=Hd;function Yd(e,t){return t.length<2?e:Wd(e,Qd(t,0,-1))}var Jd=Yd,Zd=je,Xd=Kd,Rd=Jd,em=st;function tm(e,t){return t=Zd(t,e),e=Rd(e,t),e==null||delete e[em(Xd(t))]}var om=tm,nm=ie,rm=Je,am=oe,sm="[object Object]",im=Function.prototype,cm=Object.prototype,Po=im.toString,lm=cm.hasOwnProperty,um=Po.call(Object);function pm(e){if(!am(e)||nm(e)!=sm)return!1;var t=rm(e);if(t===null)return!0;var o=lm.call(t,"constructor")&&t.constructor;return typeof o=="function"&&o instanceof o&&Po.call(o)==um}var dm=pm,mm=dm;function ym(e){return mm(e)?void 0:e}var fm=ym,Do=he,gm=Gt,hm=ne,Io=Do?Do.isConcatSpreadable:void 0;function Cm(e){return hm(e)||gm(e)||!!(Io&&e&&e[Io])}var vm=Cm,bm=Ye,xm=vm;function Oo(e,t,o,n,i){var s=-1,c=e.length;for(o||(o=xm),i||(i=[]);++s<c;){var l=e[s];t>0&&o(l)?t>1?Oo(l,t-1,o,n,i):bm(i,l):n||(i[i.length]=l)}return i}var Sm=Oo,Am=Sm;function $m(e){var t=e==null?0:e.length;return t?Am(e,1):[]}var Tm=$m;function Fm(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)}var wm=Fm,_m=wm,Mo=Math.max;function Pm(e,t,o){return t=Mo(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,s=Mo(n.length-t,0),c=Array(s);++i<s;)c[i]=n[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=n[i];return l[t]=o(c),_m(e,this,l)}}var Dm=Pm;function Im(e){return function(){return e}}var Om=Im;function Mm(e){return e}var km=Mm,Em=Om,ko=Nt,jm=km,Km=ko?function(e,t){return ko(e,"toString",{configurable:!0,enumerable:!1,value:Em(t),writable:!0})}:jm,Nm=Km,Bm=800,Vm=16,Lm=Date.now;function qm(e){var t=0,o=0;return function(){var n=Lm(),i=Vm-(n-o);if(o=n,i>0){if(++t>=Bm)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Gm=qm,Um=Nm,zm=Gm,Hm=zm(Um),Wm=Hm,Qm=Tm,Ym=Dm,Jm=Wm;function Zm(e){return Jm(Ym(e,void 0,Qm),e+"")}var Xm=Zm,Rm=Ao,ey=So,ty=om,oy=je,ny=ve,ry=fm,ay=Xm,sy=oo,iy=1,cy=2,ly=4,uy=ay(function(e,t){var o={};if(e==null)return o;var n=!1;t=Rm(t,function(s){return s=oy(s,e),n||(n=s.length>1),s}),ny(e,sy(e),o),n&&(o=ey(o,iy|cy|ly,ry));for(var i=t.length;i--;)ty(o,t[i]);return o}),py=uy;const Ke=we(py);var dy=qe,my=je,yy=zt,Eo=ce,fy=st;function gy(e,t,o,n){if(!Eo(e))return e;t=my(t,e);for(var i=-1,s=t.length,c=s-1,l=e;l!=null&&++i<s;){var m=fy(t[i]),u=o;if(m==="__proto__"||m==="constructor"||m==="prototype")return e;if(i!=c){var g=l[m];u=n?n(g,m,l):void 0,u===void 0&&(u=Eo(g)?g:yy(t[i+1])?[]:{})}dy(l,m,u),l=l[m]}return e}var hy=gy,Cy=hy;function vy(e,t,o){return e==null?e:Cy(e,t,o)}var by=vy;const jo=we(by),xy=({schema:e,record:t,parentRecord:o,compile:n,getContainer:i})=>{if(!e)return;const s=ee(e.properties);return s!=null&&s.name&&(s.name["x-disabled"]=!0),e.hasDefaultValue===!0&&(s.defaultValue=ee(e.default.uiSchema)||{},s.defaultValue.required=!1,s.defaultValue.title=n('{{ t("Default value") }}'),s.defaultValue["x-decorator"]="FormItem",s.defaultValue["x-reactions"]={dependencies:["uiSchema.x-component-props.gmt","uiSchema.x-component-props.showTime","uiSchema.x-component-props.dateFormat","uiSchema.x-component-props.timeFormat"],fulfill:{state:{componentProps:{gmt:"{{$deps[0]}}",showTime:"{{$deps[1]}}",dateFormat:"{{$deps[2]}}",timeFormat:"{{$deps[3]}}"}}}},s.defaultValue["x-disabled"]=!0),{type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues(c){return r.useRequest(()=>{var l;return Promise.resolve({data:K(A({},ee(Ke(e.default,["uiSchema.rawTitle"]))),{autoFill:((l=e.default)==null?void 0:l.autoFill)!==!1})})},c)}},title:`${n((o==null?void 0:o.title)||(o==null?void 0:o.name))} - ${n('{{ t("Edit field") }}')}`,properties:K(A({summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}}},s),{description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateCollectionField }}"}}}}})}}}},Sy=()=>{const e=_.useForm(),t=r.useAPIClient(),o=r.useActionContext(),{refresh:n}=r.useResourceActionContext(),{targetCollection:i}=ct(),{name:s}=L.useParams(),{name:c}=r.useRecord(),l=r.useDataSourceManager();return{run(){return D(this,null,function*(){yield e.submit();const u=ee(e.values);u.autoCreateReverseField||delete u.reverseField,delete u.autoCreateReverseField,yield t.request({url:`dataSourcesCollections/${s}.${i.name}/fields:update?filterByTk=${c}`,method:"post",data:u}),o.setVisible(!1),l.getDataSource(s).reload(),yield e.reset(),n()})}}},Ay=e=>{const t=r.useRecord(),o=r.useCollectionParentRecordData();return a.jsx($y,A({item:t,parentItem:o},e))},$y=e=>{var I,V;const k=e,{scope:t,getContainer:o,item:n,parentItem:i,children:s}=k,c=pt(k,["scope","getContainer","item","parentItem","children"]),{getInterface:l,collections:m,getCollection:u}=r.useCollectionManager_deprecated(),{data:{database:g}}=r.useCurrentAppInfo(),[f,b]=d.useState(!1),[P,T]=d.useState({}),$=r.useAPIClient(),{t:x}=N.useTranslation(),y=r.useCompile(),{name:h}=L.useParams(),p=S=>(g==null?void 0:g.dialect)===S,C=(n==null?void 0:n.fields)||((V=(I=u(n.collectionName,h))==null?void 0:I.options)==null?void 0:V.fields),F=d.useMemo(()=>m.map(S=>({label:y(S.title),value:S.name})),[]),E=d.useMemo(()=>{var S,w;return(n==null?void 0:n.fields)||((w=(S=u(n.collectionName,h))==null?void 0:S.options)==null?void 0:w.fields.filter(O=>["string","bigInt","integer"].includes(O.type)).map(O=>{var U;return{value:O.name,label:y((U=O.uiSchema)==null?void 0:U.title)}}))},[n.name,C]);return a.jsx(r.RecordProvider,{record:n,parent:i,children:a.jsxs(r.ActionContextProvider,{value:{visible:f,setVisible:b},children:[a.jsx("a",K(A({},c),{onClick:()=>D(this,null,function*(){var z,R,J;const{data:S}=yield $.request({url:`dataSourcesCollections/${h}.${i.name}/fields:get?filterByTk=${n.name}`,params:{appends:["reverseField"]}}),w=l((z=S==null?void 0:S.data)==null?void 0:z.interface),O=ee(S==null?void 0:S.data)||{};O!=null&&O.reverseField||(O.autoCreateReverseField=!1,O.reverseField=(R=w==null?void 0:w.default)==null?void 0:R.reverseField,jo(O.reverseField,"name",`f_${B.uid()}`),jo(O.reverseField,"uiSchema.title",(J=n.__parent)==null?void 0:J.title));const U=xy({schema:K(A({},w),{default:O}),record:n,parentRecord:i,compile:y,getContainer:o});T(U),b(!0)}),children:s||x("Edit")})),a.jsx(r.SchemaComponent,{schema:P,components:{ArrayTable:ae.ArrayTable},scope:K(A({getContainer:o,useUpdateCollectionField:Sy,useCancelAction:r.useCancelAction,showReverseFieldConfig:!1,collections:F,isDialect:p,scopeKeyOptions:E,disabledJSONB:!0},t),{createOnly:!1,createMainOnly:!1,editMainOnly:!0})})]})})},Ty=()=>{const{refresh:e}=r.useResourceActionContext(),{name:t}=L.useParams(),{name:o,collectionName:n}=r.useRecord(),i=r.useAPIClient();return{run(){return D(this,null,function*(){yield i.request({url:`dataSourcesCollections/${t}.${n}/fields:destroy?filterByTk=${o}`,method:"post"}),e()})}}},Fy=()=>{const{state:e,setState:t,refresh:o}=r.useResourceActionContext(),{t:n}=N.useTranslation(),{name:i}=L.useParams(),s=r.useAPIClient(),{name:c}=r.useRecord();return{run(){return D(this,null,function*(){var m;if(!((m=e==null?void 0:e.selectedRowKeys)!=null&&m.length))return v.message.error(n("Please select the records you want to delete"));yield s.request({url:`dataSourcesCollections/${i}.${c}/fields:destroy`,method:"post",params:{filterByTk:(e==null?void 0:e.selectedRowKeys)||[]}}),t==null||t({selectedRowKeys:[]}),o()})}}},wy=()=>{const{run:e}=Fy();return{run(){return D(this,null,function*(){yield e()})}}},_y=()=>{const{run:e}=Ty();return{run(){return D(this,null,function*(){yield e()})}}},Py={name:"fields",fields:[{type:"string",name:"type",interface:"input",uiSchema:{title:'{{ t("Storage type") }}',type:"string","x-component":"Select",enum:[{label:"String",value:"string"}],required:!0}},{type:"string",name:"interface",interface:"input",uiSchema:{title:`{{t("Field interface", { ns: "${j}" })}}`,type:"string","x-component":"Select",enum:"{{interfaces}}"}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{ t("Field display name") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Field name") }}',type:"string","x-component":"Input"}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input.TextArea"}}]},Dy={type:"object",properties:{[B.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-visible":!1,"x-component-props":{useAction:"{{ useBulkDestroyActionAndRefreshCM }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},syncfromDatabase:{type:"void",title:'{{ t("Sync from database") }}',"x-component":"SyncFieldsAction","x-component-props":{type:"primary"}},syncSQL:{type:"void",title:'{{ t("Sync from database") }}',"x-component":"SyncSQLFieldsAction","x-component-props":{type:"primary"}},create:{type:"void",title:'{{ t("Add new") }}',"x-component":"AddCollectionField","x-component-props":{type:"primary"},"x-hidden":"{{ disableAddFields }}"}}},[B.uid()]:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{pagination:!1,rowKey:"name",rowSelection:{type:"checkbox"},dragSort:!1,useDataSource:"{{ useDataSource }}"},properties:{column1:{type:"void",title:'{{ t("Field display name") }}',"x-component":"Table.Column",properties:{"uiSchema.title":{type:"string","x-component":"FieldTitleInput","x-component-props":{handleFieldChange:"{{enqueueChange}}"}}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{"x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Field type")}}',properties:{type:{"x-component":"FieldType","x-component-props":{handleFieldChange:"{{enqueueChange}}"}}}},column4:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Field interface", { ns: "${j}" })}}`,properties:{interface:{"x-component":"CollectionFieldInterfaceSelect","x-component-props":{handleFieldChange:"{{enqueueChange}}"}}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Title field")}}',properties:{titleField:{"x-component":"TitleField","x-use-component-props":"useTitleFieldProps","x-read-pretty":!1}}},column6:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Description") }}',properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0,style:{width:100}}}}},column7:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollectionField","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-disabled":"{{cm.useDeleteButtonDisabled()}}","x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ useDestroyActionAndRefreshCM }}"},"x-reactions":[{dependencies:[".interface"],fulfill:{state:{visible:"{{ ['obo','oho','m2m','o2m','m2o'].includes($deps[0]) }}"}}}]}}}}}}}}},it=d.createContext({refreshRM:()=>{},titleField:null,targetCollection:null});it.displayName="RemoteCollectionContext";const ct=()=>d.useContext(it),Ko=()=>{const e=_.useField(),t=d.useMemo(()=>ge.createForm(),[]),o=r.useAttach(t.createArrayField(K(A({},e.props),{basePath:""}))),{t:n}=N.useTranslation(),{name:i}=L.useParams(),s=r.useAPIClient(),c=r.useCompile(),l=d.useContext(r.ResourceActionContext),m=r.useResourceContext(),{targetKey:u}=m||{},g=r.useRecord(),{[u]:f,titleField:b,name:P}=g,[T,$]=d.useState(b),x=S=>{const w=d.useContext(r.ResourceActionContext),O=_.useField();return d.useEffect(()=>{w.loading||(S==null||S.onSuccess(w.data),O.componentProps.dragSort=!!w.dragSort)},[w.loading]),w},y={association:{sourceKey:"name",targetKey:"name"},dragSort:!1,collection:Py,request:{url:`dataSourcesCollections/${i}.${P}/fields:list`,params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}}},h=r.useDataSourceManager();let p=!1;const C=[],F=()=>D(this,null,function*(){if(p||C.length===0)return;p=!0;const{value:S,filterByTk:w,flag:O}=C.shift();try{yield k(S,w,O)}catch(U){console.error("Error processing handleFieldChange:",U)}finally{p=!1,F()}}),E=(S,w,O)=>{C.push({value:S,filterByTk:w,flag:O}),F()},k=(S,w,O=!0)=>D(this,null,function*(){yield s.request({url:`dataSourcesCollections/${i}.${P}/fields:update?filterByTk=${w}`,method:"post",data:S}),h.getDataSource(i).reload(),O&&v.message.success(n("Saved successfully"))}),I=()=>({filterByTk:f,titleField:T,dataSourceKey:i,setTitleField:$}),V=(S,w,O)=>D(this,null,function*(){var X,Se;const{targetScope:U}=w,z=((X=S.props)==null?void 0:X.name)==="inherits",{data:R}=yield s.request({url:`dataSources/${i}/collections:list`,params:{paginate:!1,appends:["fields"],sort:["sort"]}});return((Se=R==null?void 0:R.data)==null?void 0:Se.filter(H=>{var Yo;if(O!=null&&O.includes(H.template)||H.autoCreate&&H.isThrough||z&&H.template==="view")return!1;const Wf=!(U!=null&&U.template)||U.template.includes(H.template),Qf=!(U!=null&&U[(Yo=S.props)==null?void 0:Yo.name])||U[S.props.name].includes(H.name);return Wf&&Qf})).map(H=>({label:c(H.title||H.name),value:H.name}))});return a.jsxs(it.Provider,{value:{refreshRM:()=>{l.refresh()},titleField:T,targetCollection:g},children:[a.jsx(Ct,{collectionName:P}),a.jsx(r.ResourceActionProvider,K(A({},y),{children:a.jsx(_.FormContext.Provider,{value:t,children:a.jsx(_.FieldContext.Provider,{value:o,children:a.jsx(r.SchemaComponentOptions,{components:{TitleField:Pn,CollectionFieldInterfaceSelect:Fn,AddCollectionField:An,SourceCollection:vn,TargetKey:Cn,SourceKey:hn,FieldTitleInput:wn,EditCollectionField:Ay,Select:r.Select,FieldType:_n,ForeignKey:$t,ThroughCollection:bn},inherit:!0,scope:{useDataSource:x,useTitleFieldProps:I,enqueueChange:E,useDestroyActionAndRefreshCM:_y,useBulkDestroyActionAndRefreshCM:wy,loadCollections:V},children:a.jsx(_.RecursionField,{schema:Dy,onlyRenderProperties:!0})})})})})),a.jsx(Dn,{})]})},Iy=(e,t)=>(o,n)=>{o.loading=!0,e(o,n,t).then(dt.action.bound(i=>{o.dataSource=i,o.loading=!1})).catch(i=>console.log(i))},Oy=()=>{const[e,t]=d.useState([]);return[e,t]},My=()=>{const e=r.useRecord(),t=_.useForm();return{run(){return D(this,null,function*(){var i,s,c;const n=(c=(s=(i=t.values)==null?void 0:i.children)==null?void 0:s.slice)==null?void 0:c.call(s);t.setValuesIn("children",n.filter(l=>l.name!==e.name))})}}},ky=()=>({run(){return D(this,null,function*(){})}}),Ey=e=>`${e||""}${B.uid()}`,jy=()=>{const{t:e}=N.useTranslation(),{interfaces:t}=r.useCollectionManager_deprecated(),{data:{database:o}}=r.useCurrentAppInfo(),n=r.useDataSourceManager(),i=d.useContext(r.SchemaComponentContext),{name:s}=L.useParams(),c=d.useContext(r.CollectionCategoriesContext),l=r.useAPIClient(),m=r.useCompile(),u=()=>D(this,null,function*(){return c.data.map(y=>({label:m(y.name),value:y.id}))}),g=()=>D(this,null,function*(){return l.resource("storages").list().then(({data:y})=>{var h;return(h=y==null?void 0:y.data)==null?void 0:h.map(p=>({label:e(m(p.title)),value:p.name}))})}),f=()=>{const y=d.useContext(r.ResourceActionContext),h=r.useAPIClient(),p=_.useField(),{name:C}=L.useParams();p.data=p.data||{};const{setDataSource:F,dataSource:E}=d.useContext(Ae);return{onClick(){return D(this,null,function*(){var I,V,S;p.data.loading=!0;try{const{data:w}=yield h.request({url:`dataSources:refresh?filterByTk=${C}&clientStatus=${(E==null?void 0:E.status)||"loaded"}`,method:"post"});p.data.loading=!1,F(w==null?void 0:w.data),((I=w==null?void 0:w.data)==null?void 0:I.status)==="reloading"?v.message.warning(e("Data source synchronization in progress")):((V=w==null?void 0:w.data)==null?void 0:V.status)==="loaded"&&(v.message.success(e("Data source synchronization successful")),(S=y==null?void 0:y.refresh)==null||S.call(y)),yield n.getDataSource(C).reload()}catch(w){p.data.loading=!1}})}}},b=d.useMemo(()=>gn(s),[s]),P=l.resource("dataSources",s),[T,$]=d.useState({});d.useEffect(()=>{try{P.get({filterByTk:s}).then(y=>{$(y==null?void 0:y.data)})}catch(y){console.log(y)}},[s]);const x=y=>D(this,null,function*(){const{fields:h}=y.form.values;return Promise.resolve({data:h}).then(({data:p})=>p==null?void 0:p.map(C=>{var F;return{label:m((F=C.uiSchema)==null?void 0:F.title)||C.name,value:C.name}}))});return a.jsx(r.SchemaComponentContext.Provider,{value:K(A({},i),{designable:!1,dataSourceData:T}),children:a.jsx(r.SchemaComponent,{schema:b,components:{AddSubFieldAction:r.AddSubFieldAction,EditSubFieldAction:r.EditSubFieldAction,FieldSummary:r.FieldSummary,TemplateSummay:r.TemplateSummary,CollectionFields:Ko},scope:{useRefreshActionProps:f,useDestroySubField:My,useBulkDestroySubField:ky,useSelectedRowKeys:Oy,useAsyncDataSource:Iy,loadFilterTargetKeys:x,loadCategories:u,loadStorages:g,useNewId:Ey,useCancelAction:r.useCancelAction,interfaces:t,enableInherits:(o==null?void 0:o.dialect)==="postgres",isPG:(o==null?void 0:o.dialect)==="postgres"}})})};var No={exports:{}};/*!
42
42
  Copyright (c) 2018 Jed Watson.
43
43
  Licensed under the MIT License (MIT), see
44
44
  http://jedwatson.github.io/classnames
45
- */(function(e){(function(){var t={}.hasOwnProperty;function o(){for(var s="",c=0;c<arguments.length;c++){var l=arguments[c];l&&(s=i(s,n(l)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return o.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var c="";for(var l in s)t.call(s,l)&&s[l]&&(c=i(c,l));return c}function i(s,c){return c?s?s+" "+c:s+c:s}e.exports?(o.default=o,e.exports=o):window.classNames=o})()})(No);var Ky=No.exports;const Ny=we(Ky);var By=function(e,t){var o;if("ConfigContext"in v.ConfigProvider){var n=p.useContext(v.ConfigProvider.ConfigContext).getPrefixCls;return n(e,t==null?void 0:t.prefixCls)}else{var i=(o=t==null?void 0:t.prefixCls)!==null&&o!==void 0?o:"ant-";return"".concat(i).concat(e!=null?e:"")}};const Vy=e=>{const t=By("description-input",e),{data:{name:o,tableName:n}}=r.useCollectionRecord();return a.jsx("div",{className:Ny(t,e.className),style:e.style,children:o!==n&&n?a.jsxs(a.Fragment,{children:[o," ",a.jsxs("span",{style:{color:"GrayText"},children:["(",n,")"]})]}):e.value})},Ly=Object.assign(w.connect(v.Input,w.mapProps((e,t)=>K(T({},e),{suffix:a.jsx("span",{children:t!=null&&t.loading||t!=null&&t.validating?a.jsx(W.LoadingOutlined,{}):e.suffix})})),w.mapReadPretty(Vy))),qy=({item:e})=>{const{t}=N.useTranslation(),o=r.useCompile();return a.jsxs(v.Space,{children:[a.jsx(v.Badge,{color:e.color}),t(o(e.name))]})},Gy=w.observer(e=>{const[t,o]=p.useState(null),{refresh:n}=p.useContext(r.CollectionCategoriesContext),{refresh:i}=r.useResourceActionContext(),s=r.useAPIClient(),c=g=>D(this,null,function*(){const{active:y,over:b}=g;setTimeout(()=>{o(null)}),b&&b.id!==y.id&&(yield s.resource("collectionCategories").move({sourceId:y.id,targetId:b.id}),yield n(),yield i())});function l(g){var y;o((y=g.active)==null?void 0:y.data.current)}const f=Q.useSensor(Q.MouseSensor,{activationConstraint:{distance:10}}),u=Q.useSensors(f);return a.jsxs(Q.DndContext,{sensors:u,onDragEnd:c,onDragStart:l,children:[e.children,a.jsx(Q.DragOverlay,{children:t?a.jsx("span",{style:{whiteSpace:"nowrap"},children:a.jsx(qy,{item:t})}):null})]})},{displayName:"DndProvider"}),Uy=()=>{const{t:e}=N.useTranslation(),{data:t}=p.useContext(r.CollectionCategoriesContext),o=r.useCompile();if(!t)return null;const n=t.sort((s,c)=>c.sort-s.sort).concat().map(s=>K(T({},s),{schema:Be}));!n.find(s=>s.id==="all")&&n.unshift({name:'{{t("All collections")}}',id:"all",sort:0,closable:!1,schema:Be});const i=()=>D(this,null,function*(){return t.map(s=>({label:e(o(s.name)),value:s.id}))});return a.jsx(Gy,{children:a.jsx(v.Card,{bordered:!1,children:a.jsx(r.SchemaComponentOptions,{components:{CollectionFields:Ko,CollectionName:Ly},inherit:!0,scope:{loadCategories:i},children:a.jsx(w.RecursionField,{schema:Be,onlyRenderProperties:!0})})})})},zy=(e,t,o,n)=>{if(!e)return;const i=ee(e.configurableProperties)||{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem"}};return e.hasDefaultValue===!0&&(i.defaultValue=ee(e.default.uiSchema),i.defaultValue.title=o('{{ t("Default value") }}'),i.defaultValue["x-decorator"]="FormItem"),{type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},title:'{{ t("Edit collection") }}',properties:K(T({},Ke(i,"category","inherits","moreOptions")),{filterTargetKey:{title:'{{ t("Record unique key") }}',type:"single",description:en.tval("If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.",{ns:k}),"x-decorator":"FormItem","x-component":"Select",enum:"{{filterTargetKeyOptions}}","x-visible":"{{!!isView}}"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateCollectionActionAndRefreshCM }}"}}}}})}}}},Hy=e=>{const t=r.useRecord(),o=r.useRequest(()=>{var i;return Promise.resolve({data:K(T({},Ke(ee(t),["__parent","__collectionName"])),{category:(i=t==null?void 0:t.category)==null?void 0:i.map(s=>s.id)})})},K(T({},e),{manual:!0})),n=r.useActionContext();return p.useEffect(()=>{n.visible&&o.run()},[n.visible]),o},Wy=e=>{const{refreshCM:t}=r.useCollectionManager_deprecated(),o=w.useForm(),n=r.useActionContext(),{name:i}=L.useParams(),{refresh:s}=r.useResourceActionContext(),{resource:c,targetKey:l}=r.useResourceContext(),{[l]:f}=r.useRecord(),u=r.useAPIClient(),g=r.useDataSourceManager();return{run(){return D(this,null,function*(){yield o.submit(),yield u.request({url:`dataSources/${i}/collections:update?filterByTk=${f}`,method:"post",data:T({},Ke(o.values,["fields","autoGenId","createdAt","updatedAt","createdBy","updatedBy","sortable"]))}),yield g.getDataSource(i).reload(),n.setVisible(!1),yield o.reset(),s(),yield t()})}}},Qy=e=>{const t=r.useRecord();return a.jsx(Yy,T({item:t},e))},Yy=e=>{var $;const S=e,{scope:t,getContainer:o,item:n,children:i}=S,s=pt(S,["scope","getContainer","item","children"]),{getTemplate:c}=r.useCollectionManager_deprecated(),[l,f]=p.useState(!1),[u,g]=p.useState({}),{t:y}=N.useTranslation(),b=r.useCompile(),_=($=n.fields)==null?void 0:$.map(x=>{var d;return{label:(d=x.uiSchema)!=null&&d.title?b(x.uiSchema.title):x.name,value:x.name}});return a.jsx(r.RecordProvider,{record:n,children:a.jsxs(r.ActionContextProvider,{value:{visible:l,setVisible:f},children:[a.jsx("a",K(T({},s),{onClick:()=>D(this,null,function*(){const x=c(n.template),d=zy(T({},x),n,b);g(d),f(!0)}),children:i||y("Edit")})),a.jsx(r.SchemaComponent,{schema:u,components:{ArrayTable:ae.ArrayTable},scope:T({getContainer:o,useValuesFromRecord:Hy,useUpdateCollectionActionAndRefreshCM:Wy,useCancelAction:r.useCancelAction,createOnly:!1,filterTargetKeyOptions:_,isView:n.view,createMainOnly:!0},t)})]})})},Jy={type:"object",properties:{[B.uid()]:{"x-component":"ConfigurationTable"}}},Zy=()=>{const e=r.usePlugin(ye),t=L.useLocation(),o=new URLSearchParams(t.search).get("type"),n=o&&e.types.get(o);return a.jsx(r.SchemaComponent,{schema:Jy,components:{CollectionCategoriesProvider:r.CollectionCategoriesProvider,ConfigurationTable:jy,ConfigurationTabs:Uy,AddFieldAction:r.AddFieldAction,AddCollectionField:r.AddCollectionField,AddCollection:(n==null?void 0:n.AddCollection)||r.AddCollection,AddCollectionAction:r.AddCollectionAction,EditCollection:(n==null?void 0:n.EditCollection)||Qy,DeleteCollection:(n==null?void 0:n.DeleteCollection)||r.DeleteCollection,DeleteCollectionAction:r.DeleteCollectionAction,EditFieldAction:r.EditFieldAction,EditCollectionField:r.EditCollectionField,OverridingCollectionField:r.OverridingCollectionField,OverridingFieldAction:r.OverridingFieldAction,ViewCollectionField:r.ViewCollectionField,ViewFieldAction:r.ViewFieldAction,SyncFieldsAction:r.SyncFieldsAction,SyncFieldsActionCom:r.SyncFieldsActionCom,SyncSQLFieldsAction:r.SyncSQLFieldsAction},scope:{allowCollectionDeletion:!!(n!=null&&n.allowCollectionDeletion),disabledConfigureFields:n==null?void 0:n.disabledConfigureFields,disableAddFields:n==null?void 0:n.disableAddFields,allowCollectionCreate:!!(n!=null&&n.allowCollectionCreate)}})},Xy=()=>{const[e,t]=p.useState({}),o=r.usePlugin(ye),n=r.useCompile(),[i,s]=p.useState(!1),{t:c}=N.useTranslation(),[l,f]=p.useState(null),u=r.useAPIClient(),g=y=>{const b=[...o.types.keys()].map(_=>{const S=o.types.get(_);return{value:S.name,label:n(S.label)}});y.dataSource=b};return a.jsx("div",{children:a.jsxs(r.ActionContext.Provider,{value:{visible:i,setVisible:s},children:[a.jsx(v.Dropdown,{menu:{onClick(y){if(y.key==="__empty__")return;const b=o.types.get(y.key);f(y.key),s(!0),t({type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:y.key,key:`d_${B.uid()}`}},title:n("{{t('Add new')}}")+" - "+n(b.label),properties:{body:{type:"void","x-component":b.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{testConnection:{title:`{{ t("Test Connection",{ ns: "${k}" }) }}`,"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"},"x-hidden":b==null?void 0:b.disableTestConnection},cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}",actionCallback:"{{ dataSourceCreateCallback }}"}}}}}}}})},items:[o.types.size?null:{key:"__empty__",label:a.jsx(v.Empty,{image:v.Empty.PRESENTED_IMAGE_SIMPLE,description:a.jsxs(a.Fragment,{children:[c("No external data source plugin installed",{ns:k}),a.jsx("br",{})," ",a.jsx("a",{target:"_blank",href:u.auth.locale==="zh-CN"?"https://docs-cn.nocobase.com/handbook/data-source-manager":"https://docs.nocobase.com/handbook/data-source-manager",rel:"noreferrer",children:c("View documentation",{ns:k})})]})})}].filter(Boolean).concat([...o.types.keys()].map(y=>{const b=o.types.get(y);return{key:y,label:n(b==null?void 0:b.label)}}))},children:a.jsxs(v.Button,{type:"primary",icon:a.jsx(W.PlusOutlined,{}),children:[c("Add new")," ",a.jsx(W.DownOutlined,{})]})}),a.jsx(r.SchemaComponent,{scope:{createOnly:!1,useTestConnectionAction:mt,dialect:l,useDialectDataSource:g},schema:e})]})})},Ry=()=>{const e=r.useRecord(),[t,o]=p.useState({}),n=r.usePlugin(ye),i=r.useCompile(),[s,c]=p.useState(!1),{t:l}=N.useTranslation(),f=r.useDataSourceManager(),u=()=>{const g=w.useField(),y=w.useForm(),b=r.useActionContext(),{refresh:_}=r.useResourceActionContext(),{resource:S}=r.useResourceContext(),{key:$}=r.useRecord();return{run(){return D(this,null,function*(){yield y.submit(),g.data=g.data||{},g.data.loading=!0;try{yield S.update({filterByTk:$,values:y.values}),b.setVisible(!1),f.getDataSource($).setOptions(y.values),f.getDataSource($).reload(),yield y.reset(),_()}catch(d){console.log(d)}finally{g.data.loading=!1}})}}};return a.jsx("div",{children:a.jsxs(r.ActionContext.Provider,{value:{visible:s,setVisible:c},children:[e.key!=="main"&&a.jsx("a",{onClick:()=>{c(!0);const g=n.types.get(e.type);o({type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:e},title:i("{{t('Edit')}}")+" - "+i(e.displayName),properties:{body:{type:"void","x-component":g.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},testConnectiion:{title:`{{ t("Test Connection",{ ns: "${k}" }) }}`,"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"},"x-hidden":g==null?void 0:g.disableTestConnection},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}}}}})},children:l("Edit")}),a.jsx(r.SchemaComponent,{scope:{createOnly:!0,useUpdateAction:u},schema:t})]})})},ef=({key:e,type:t})=>`/admin/settings/data-source-manager/${e}/collections?type=${t}`,tf=()=>{const e=r.useRecord(),t=L.useNavigate(),{t:o}=N.useTranslation();return a.jsx("div",{className:e.enabled?void 0:fe.css`
45
+ */(function(e){(function(){var t={}.hasOwnProperty;function o(){for(var s="",c=0;c<arguments.length;c++){var l=arguments[c];l&&(s=i(s,n(l)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return o.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var c="";for(var l in s)t.call(s,l)&&s[l]&&(c=i(c,l));return c}function i(s,c){return c?s?s+" "+c:s+c:s}e.exports?(o.default=o,e.exports=o):window.classNames=o})()})(No);var Ky=No.exports;const Ny=we(Ky);var By=function(e,t){var o;if("ConfigContext"in v.ConfigProvider){var n=d.useContext(v.ConfigProvider.ConfigContext).getPrefixCls;return n(e,t==null?void 0:t.prefixCls)}else{var i=(o=t==null?void 0:t.prefixCls)!==null&&o!==void 0?o:"ant-";return"".concat(i).concat(e!=null?e:"")}};const Vy=e=>{const t=By("description-input",e),{data:{name:o,tableName:n}}=r.useCollectionRecord();return a.jsx("div",{className:Ny(t,e.className),style:e.style,children:o!==n&&n?a.jsxs(a.Fragment,{children:[o," ",a.jsxs("span",{style:{color:"GrayText"},children:["(",n,")"]})]}):e.value})},Ly=Object.assign(_.connect(v.Input,_.mapProps((e,t)=>K(A({},e),{suffix:a.jsx("span",{children:t!=null&&t.loading||t!=null&&t.validating?a.jsx(W.LoadingOutlined,{}):e.suffix})})),_.mapReadPretty(Vy))),qy=({item:e})=>{const{t}=N.useTranslation(),o=r.useCompile();return a.jsxs(v.Space,{children:[a.jsx(v.Badge,{color:e.color}),t(o(e.name))]})},Gy=_.observer(e=>{const[t,o]=d.useState(null),{refresh:n}=d.useContext(r.CollectionCategoriesContext),{refresh:i}=r.useResourceActionContext(),s=r.useAPIClient(),c=g=>D(this,null,function*(){const{active:f,over:b}=g;setTimeout(()=>{o(null)}),b&&b.id!==f.id&&(yield s.resource("collectionCategories").move({sourceId:f.id,targetId:b.id}),yield n(),yield i())});function l(g){var f;o((f=g.active)==null?void 0:f.data.current)}const m=Q.useSensor(Q.MouseSensor,{activationConstraint:{distance:10}}),u=Q.useSensors(m);return a.jsxs(Q.DndContext,{sensors:u,onDragEnd:c,onDragStart:l,children:[e.children,a.jsx(Q.DragOverlay,{children:t?a.jsx("span",{style:{whiteSpace:"nowrap"},children:a.jsx(qy,{item:t})}):null})]})},{displayName:"DndProvider"}),Uy=()=>{const{t:e}=N.useTranslation(),{data:t}=d.useContext(r.CollectionCategoriesContext),o=r.useCompile();if(!t)return null;const n=t.sort((s,c)=>c.sort-s.sort).concat().map(s=>K(A({},s),{schema:Be}));!n.find(s=>s.id==="all")&&n.unshift({name:'{{t("All collections")}}',id:"all",sort:0,closable:!1,schema:Be});const i=()=>D(this,null,function*(){return t.map(s=>({label:e(o(s.name)),value:s.id}))});return a.jsx(Gy,{children:a.jsx(v.Card,{bordered:!1,children:a.jsx(r.SchemaComponentOptions,{components:{CollectionFields:Ko,CollectionName:Ly},inherit:!0,scope:{loadCategories:i},children:a.jsx(_.RecursionField,{schema:Be,onlyRenderProperties:!0})})})})},zy=(e,t,o,n)=>{if(!e)return;const i=ee(e.configurableProperties)||{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem"}};return e.hasDefaultValue===!0&&(i.defaultValue=ee(e.default.uiSchema),i.defaultValue.title=o('{{ t("Default value") }}'),i.defaultValue["x-decorator"]="FormItem"),{type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},title:'{{ t("Edit collection") }}',properties:K(A({},Ke(i,"category","inherits","moreOptions")),{filterTargetKey:{title:'{{ t("Record unique key") }}',type:"single",description:en.tval("If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.",{ns:j}),"x-decorator":"FormItem","x-component":"Select",enum:"{{filterTargetKeyOptions}}"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateCollectionActionAndRefreshCM }}"}}}}})}}}},Hy=e=>{const t=r.useRecord(),o=r.useRequest(()=>{var i;return Promise.resolve({data:K(A({},Ke(ee(t),["__parent","__collectionName"])),{category:(i=t==null?void 0:t.category)==null?void 0:i.map(s=>s.id)})})},K(A({},e),{manual:!0})),n=r.useActionContext();return d.useEffect(()=>{n.visible&&o.run()},[n.visible]),o},Wy=e=>{const{refreshCM:t}=r.useCollectionManager_deprecated(),o=_.useForm(),n=r.useActionContext(),{name:i}=L.useParams(),{refresh:s}=r.useResourceActionContext(),{resource:c,targetKey:l}=r.useResourceContext(),{[l]:m}=r.useRecord(),u=r.useAPIClient(),g=r.useDataSourceManager();return{run(){return D(this,null,function*(){yield o.submit(),yield u.request({url:`dataSources/${i}/collections:update?filterByTk=${m}`,method:"post",data:A({},Ke(o.values,["fields","autoGenId","createdAt","updatedAt","createdBy","updatedBy","sortable"]))}),yield g.getDataSource(i).reload(),n.setVisible(!1),yield o.reset(),s(),yield t()})}}},Qy=e=>{const t=r.useRecord();return a.jsx(Yy,A({item:t},e))},Yy=e=>{var $;const T=e,{scope:t,getContainer:o,item:n,children:i}=T,s=pt(T,["scope","getContainer","item","children"]),{getTemplate:c}=r.useCollectionManager_deprecated(),[l,m]=d.useState(!1),[u,g]=d.useState({}),{t:f}=N.useTranslation(),b=r.useCompile(),P=($=n.fields)==null?void 0:$.map(x=>{var y;return{label:(y=x.uiSchema)!=null&&y.title?b(x.uiSchema.title):x.name,value:x.name}});return a.jsx(r.RecordProvider,{record:n,children:a.jsxs(r.ActionContextProvider,{value:{visible:l,setVisible:m},children:[a.jsx("a",K(A({},s),{onClick:()=>D(this,null,function*(){const x=c(n.template),y=zy(A({},x),n,b);g(y),m(!0)}),children:i||f("Edit")})),a.jsx(r.SchemaComponent,{schema:u,components:{ArrayTable:ae.ArrayTable},scope:A({getContainer:o,useValuesFromRecord:Hy,useUpdateCollectionActionAndRefreshCM:Wy,useCancelAction:r.useCancelAction,createOnly:!1,filterTargetKeyOptions:P,isView:n.view,createMainOnly:!0},t)})]})})},Jy={type:"object",properties:{[B.uid()]:{"x-component":"ConfigurationTable"}}},Zy=()=>{const e=r.usePlugin(ye),t=L.useLocation(),o=new URLSearchParams(t.search).get("type"),n=o&&e.types.get(o);return a.jsx(r.SchemaComponent,{schema:Jy,components:{CollectionCategoriesProvider:r.CollectionCategoriesProvider,ConfigurationTable:jy,ConfigurationTabs:Uy,AddFieldAction:r.AddFieldAction,AddCollectionField:r.AddCollectionField,AddCollection:(n==null?void 0:n.AddCollection)||r.AddCollection,AddCollectionAction:r.AddCollectionAction,EditCollection:(n==null?void 0:n.EditCollection)||Qy,DeleteCollection:(n==null?void 0:n.DeleteCollection)||r.DeleteCollection,DeleteCollectionAction:r.DeleteCollectionAction,EditFieldAction:r.EditFieldAction,EditCollectionField:r.EditCollectionField,OverridingCollectionField:r.OverridingCollectionField,OverridingFieldAction:r.OverridingFieldAction,ViewCollectionField:r.ViewCollectionField,ViewFieldAction:r.ViewFieldAction,SyncFieldsAction:r.SyncFieldsAction,SyncFieldsActionCom:r.SyncFieldsActionCom,SyncSQLFieldsAction:r.SyncSQLFieldsAction},scope:{allowCollectionDeletion:!!(n!=null&&n.allowCollectionDeletion),disabledConfigureFields:n==null?void 0:n.disabledConfigureFields,disableAddFields:n==null?void 0:n.disableAddFields,allowCollectionCreate:!!(n!=null&&n.allowCollectionCreate)}})},Xy=()=>{const[e,t]=d.useState({}),o=r.usePlugin(ye),n=r.useCompile(),[i,s]=d.useState(!1),{t:c}=N.useTranslation(),[l,m]=d.useState(null),u=r.useAPIClient(),g=f=>{const b=[...o.types.keys()].map(P=>{const T=o.types.get(P);return{value:T.name,label:n(T.label)}});f.dataSource=b};return a.jsx("div",{children:a.jsxs(r.ActionContext.Provider,{value:{visible:i,setVisible:s},children:[a.jsx(v.Dropdown,{menu:{onClick(f){if(f.key==="__empty__")return;const b=o.types.get(f.key);m(f.key),s(!0),t({type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:f.key,key:`d_${B.uid()}`}},title:n("{{t('Add new')}}")+" - "+n(b.label),properties:{body:{type:"void","x-component":b.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{testConnection:{title:`{{ t("Test Connection",{ ns: "${j}" }) }}`,"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"},"x-hidden":b==null?void 0:b.disableTestConnection},cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}",actionCallback:"{{ dataSourceCreateCallback }}"}}}}}}}})},items:[o.types.size?null:{key:"__empty__",label:a.jsx(v.Empty,{image:v.Empty.PRESENTED_IMAGE_SIMPLE,description:a.jsxs(a.Fragment,{children:[c("No external data source plugin installed",{ns:j}),a.jsx("br",{})," ",a.jsx("a",{target:"_blank",href:u.auth.locale==="zh-CN"?"https://docs-cn.nocobase.com/handbook/data-source-manager":"https://docs.nocobase.com/handbook/data-source-manager",rel:"noreferrer",children:c("View documentation",{ns:j})})]})})}].filter(Boolean).concat([...o.types.keys()].map(f=>{const b=o.types.get(f);return{key:f,label:n(b==null?void 0:b.label)}}))},children:a.jsxs(v.Button,{type:"primary",icon:a.jsx(W.PlusOutlined,{}),children:[c("Add new")," ",a.jsx(W.DownOutlined,{})]})}),a.jsx(r.SchemaComponent,{scope:{createOnly:!1,useTestConnectionAction:mt,dialect:l,useDialectDataSource:g},schema:e})]})})},Ry=()=>{const e=r.useRecord(),[t,o]=d.useState({}),n=r.usePlugin(ye),i=r.useCompile(),[s,c]=d.useState(!1),{t:l}=N.useTranslation(),m=r.useDataSourceManager(),u=()=>{const g=_.useField(),f=_.useForm(),b=r.useActionContext(),{refresh:P}=r.useResourceActionContext(),{resource:T}=r.useResourceContext(),{key:$}=r.useRecord();return{run(){return D(this,null,function*(){yield f.submit(),g.data=g.data||{},g.data.loading=!0;try{yield T.update({filterByTk:$,values:f.values}),b.setVisible(!1),m.getDataSource($).setOptions(f.values),m.getDataSource($).reload(),yield f.reset(),P()}catch(y){console.log(y)}finally{g.data.loading=!1}})}}};return a.jsx("div",{children:a.jsxs(r.ActionContext.Provider,{value:{visible:s,setVisible:c},children:[e.key!=="main"&&a.jsx("a",{onClick:()=>{c(!0);const g=n.types.get(e.type);o({type:"object",properties:{[B.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:e},title:i("{{t('Edit')}}")+" - "+i(e.displayName),properties:{body:{type:"void","x-component":g.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},testConnectiion:{title:`{{ t("Test Connection",{ ns: "${j}" }) }}`,"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"},"x-hidden":g==null?void 0:g.disableTestConnection},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}}}}})},children:l("Edit")}),a.jsx(r.SchemaComponent,{scope:{createOnly:!0,useUpdateAction:u},schema:t})]})})},ef=({key:e,type:t})=>`/admin/settings/data-source-manager/${e}/collections?type=${t}`,tf=()=>{const e=r.useRecord(),t=L.useNavigate(),{t:o}=N.useTranslation();return a.jsx("div",{className:e.enabled?void 0:fe.css`
46
46
  .ant-btn-link {
47
47
  &:hover {
48
48
  color: rgba(0, 0, 0, 0.25) !important;
49
49
  }
50
50
  }
51
- `,children:a.jsx(v.Button,{type:"link",style:{padding:"0px"},disabled:!e.enabled,onClick:()=>{t(ef(e))},role:"button","aria-label":`${e==null?void 0:e.key}-Configure`,children:o("Configure")})})},of=()=>{const{t:e}=N.useTranslation(),t=r.usePlugin(ye),o=[...t.types.keys()].map(g=>{const y=t.types.get(g);return{value:g,label:e(y==null?void 0:y.label)}}).concat([{value:"main",label:e("Main")}]),n=r.useDataSourceManager(),i=p.useRef([]);p.useEffect(()=>()=>{n.getDataSources().forEach(g=>{i.current.includes(g.key)&&g.reload()})},[i]);const s=p.useCallback(g=>{n.removeDataSources(g)},[n]),c=p.useCallback(g=>{n.addDataSource(yt,g),i.current=[...i.current,g.key]},[]),l=()=>{const g=r.useResourceActionContext();return{onClick(){return D(this,null,function*(){var _,S;const b=(_=g==null?void 0:g.data)==null?void 0:_.data.filter($=>$.status!=="loaded");if(b!=null&&b.length){const $=n.getDataSources(),x=b.map(h=>h.key),d=$.filter(h=>x.includes(h.key));yield Promise.all(d.map(h=>h.reload()))}(S=g==null?void 0:g.refresh)==null||S.call(g)})}}},f=()=>{const{refresh:g}=r.useResourceActionContext(),{resource:y}=r.useResourceContext(),{key:b}=r.useRecord();return{run(){return D(this,null,function*(){yield y.destroy({filterByTk:b}),s([b]),g()})}}},u=g=>{const{key:y}=r.useRecord();g.visible=y!=="main"};return a.jsx(v.Card,{bordered:!1,children:a.jsx(r.SchemaComponent,{components:{CreateDatabaseConnectAction:Xy,EditDatabaseConnectionAction:Ry,ViewDatabaseConnectionAction:tf},scope:{useNewId:g=>`${g}${B.uid()}`,types:o,useRefreshActionProps:l,useDestroyAction:f,dataSourceDeleteCallback:s,dataSourceCreateCallback:c,useIsAbleDelete:u},schema:sn})})},Bo=e=>w.Schema.compile(e,{t:r.i18n.t}),nf={type:"object",properties:{block1:{type:"void","x-collection":"collections","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"collections",filterTargetKey:"name",targetKey:"name",sortable:!0,fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{ t("Collection display name") }}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Collection name") }}',type:"string","x-component":"Input",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'}},{type:"string",name:"template",interface:"input",uiSchema:{title:'{{ t("Collection Template") }}',type:"string","x-component":"Input"}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}},{type:"hasMany",name:"inherits",interface:"select",uiSchema:{title:'{{ t("Inherits") }}',type:"string","x-component":"Select","x-component-props":{mode:"multiple"}}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input"}}]},dragSort:!0,request:{resource:"collections",action:"list",params:{pageSize:50,sort:"sort",filter:{"hidden.$isFalsy":!0},appends:["category"]}}},properties:{tabs:{type:"void","x-component":"ConfigurationTabs"}}}}},Vo={type:"object",properties:{[B.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button",isBulk:!0}},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"}}}},[B.uid()]:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction(){const e=r.useAPIClient(),{t}=N.useTranslation();return{move(n,i){return D(this,null,function*(){yield e.resource("collections").move({sourceId:n.key,targetId:i.key}),v.message.success(t("Saved successfully"),.2)})}}}},properties:{column1:{type:"void",title:'{{t("Collection display name")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":St,"x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Collection template")}}',properties:{template:{"x-component":r.CollectionTemplateTag,"x-read-pretty":!0}}},column4:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column","x-visible":"categoryVisible",title:'{{t("Collection category")}}',properties:{category:{"x-component":r.CollectionCategory,"x-read-pretty":!0}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},column6:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{ t("Configure fields") }}',"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{destroyOnClose:!0,width:"70%"},"x-reactions":e=>{const t=e.path.segments[1],o=e.path.segments[0],n=e.form.getValuesIn(`${o}.${t}`);n&&(e.title=`${Bo(n.title)} - ${Bo('{{ t("Configure fields") }}')}`)},properties:{collectionFieldSchema:{type:"void","x-component":"CollectionFields"}}}}},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollection","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button","aria-label":'{{ "delete-button-" + $record.name }}',type:"primary",className:"nb-action-link"}}}}}}}}}},rf={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-component":"Action.Modal",title:'{{ t("Add category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateCategry }}",style:{marginLeft:"8px"}}}}}}}}},af={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},"x-component":"Action.Modal",title:'{{ t("Edit category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useEditCategry }}",style:{marginLeft:"8px"}}}}}}}}},sf=(e,t)=>(o,n)=>{o.loading=!0,e(o,n,t).then(dt.action.bound(i=>{o.dataSource=i,o.loading=!1})).catch(console.error)},cf=()=>{const[e,t]=p.useState([]);return[e,t]},lf=()=>{const e=r.useRecord(),t=w.useForm();return{run(){return D(this,null,function*(){var i,s,c;const n=(c=(s=(i=t.values)==null?void 0:i.children)==null?void 0:s.slice)==null?void 0:c.call(s);t.setValuesIn("children",n.filter(l=>l.name!==e.name))})}}},uf=()=>({run(){return D(this,null,function*(){})}}),pf=()=>{const e=r.useRecord(),{getCollectionFields:t}=r.useCollectionManager_deprecated();return e.__parent&&e.__parent.interface==="subTable"?p.useContext(r.DataSourceContext_deprecated).dataSource:t(e.collectionName||e.name)},df=e=>`${e||""}${B.uid()}`,mf=()=>{const{t:e}=N.useTranslation(),{interfaces:t,getCollections:o}=r.useCollectionManager_deprecated(),{data:{database:n}}=r.useCurrentAppInfo(),i=p.useContext(r.CollectionCategoriesContext),s=r.useAPIClient(),c=s.resource("dbViews"),l=r.useCompile();w.useForm();const f=(S,$,x)=>D(this,null,function*(){var C;const{targetScope:d}=$,h=((C=S.props)==null?void 0:C.name)==="inherits";return o().filter(F=>{var V;if(x!=null&&x.includes(F.template)||F.autoCreate&&F.isThrough||h&&F.template==="view")return!1;const E=!(d!=null&&d.template)||d.template.includes(F.template),I=!(d!=null&&d[(V=S.props)==null?void 0:V.name])||d[S.props.name].includes(F.name);return E&&I}).map(F=>({label:l(F.title),value:F.name}))}),u=()=>D(this,null,function*(){return i.data.map(S=>({label:l(S.name),value:S.id}))}),g=()=>D(this,null,function*(){return c.list().then(({data:S})=>{var $;return($=S==null?void 0:S.data)==null?void 0:$.map(x=>{const d=x.schema;return{label:d?`${d}.${l(x.name)}`:x.name,value:d?`${d}_${x.name}`:x.name}})})}),y=S=>D(this,null,function*(){const{fields:$}=S.form.values;return Promise.resolve({data:$}).then(({data:x})=>x==null?void 0:x.map(d=>{var h;return{label:l((h=d.uiSchema)==null?void 0:h.title)||d.name,value:d.name}}))}),b=()=>D(this,null,function*(){return s.resource("storages").list().then(({data:S})=>{var $;return($=S==null?void 0:S.data)==null?void 0:$.map(x=>({label:e(l(x.title)),value:x.name}))})}),_=p.useContext(r.SchemaComponentContext);return a.jsx(r.SchemaComponentContext.Provider,{value:K(T({},_),{designable:!1}),children:a.jsx(r.SchemaComponent,{schema:nf,components:{AddSubFieldAction:r.AddSubFieldAction,EditSubFieldAction:r.EditSubFieldAction,FieldSummary:r.FieldSummary,TemplateSummay:r.TemplateSummary,CollectionFields:bt},scope:{loadFilterTargetKeys:y,useDestroySubField:lf,useBulkDestroySubField:uf,useSelectedRowKeys:cf,useAsyncDataSource:sf,loadCollections:f,loadCategories:u,loadDBViews:g,loadStorages:b,useCurrentFields:pf,useNewId:df,useCancelAction:r.useCancelAction,interfaces:t,enableInherits:(n==null?void 0:n.dialect)==="postgres",isPG:(n==null?void 0:n.dialect)==="postgres"}})})};function yf(e){const{attributes:t,listeners:o,setNodeRef:n}=Q.useDraggable({id:e.id,data:e.data});return a.jsx("div",K(T(T({ref:n},o),t),{children:a.jsx("div",{children:e.children})}))}function ff(e){const{isOver:t,setNodeRef:o}=Q.useDroppable({id:e.id,data:e.data}),n=t?{color:"green"}:void 0;return a.jsx("div",{ref:o,style:n,children:e.children})}const gf=w.observer(({item:e})=>a.jsx(ff,{id:e.id.toString(),data:e,children:a.jsx("div",{children:a.jsx(yf,{id:e.id.toString(),data:e,children:a.jsx(Lo,{item:e})})})}),{displayName:"TabTitle"}),Lo=({item:e})=>{const{t}=N.useTranslation(),o=r.useCompile();return a.jsxs(v.Space,{children:[a.jsx(v.Badge,{color:e.color}),t(o(e.name))]})},hf=w.observer(e=>{const[t,o]=p.useState(null),{refresh:n}=p.useContext(r.CollectionCategoriesContext),{refresh:i}=r.useResourceActionContext(),s=r.useAPIClient(),c=g=>D(this,null,function*(){const{active:y,over:b}=g;setTimeout(()=>{o(null)}),b&&b.id!==y.id&&(yield s.resource("collectionCategories").move({sourceId:y.id,targetId:b.id}),yield n(),yield i())});function l(g){var y;o((y=g.active)==null?void 0:y.data.current)}const f=Q.useSensor(Q.MouseSensor,{activationConstraint:{distance:10}}),u=Q.useSensors(f);return a.jsxs(Q.DndContext,{sensors:u,onDragEnd:c,onDragStart:l,children:[e.children,a.jsx(Q.DragOverlay,{children:t?a.jsx("span",{style:{whiteSpace:"nowrap"},children:a.jsx(Lo,{item:t})}):null})]})},{displayName:"DndProvider"}),Cf=()=>{const{t:e}=N.useTranslation(),{data:t,refresh:o}=p.useContext(r.CollectionCategoriesContext),{refresh:n,run:i,defaultRequest:s,setState:c}=r.useResourceActionContext(),[l,f]=p.useState({tab:"all"}),[u,g]=p.useState(l.tab),y=r.useCompile(),b=r.useAPIClient(),{modal:_}=v.App.useApp(),S=p.useMemo(()=>{if(!t)return[];const m=t.sort((C,F)=>F.sort-C.sort).concat().map(C=>K(T({},C),{schema:Vo}));return!m.find(C=>C.id==="all")&&m.unshift({name:'{{t("All collections")}}',id:"all",sort:0,closable:!1,schema:Vo}),m},[t]);p.useEffect(()=>{l.tab!=="all"&&$(l.tab)},[]);const $=m=>{var C;if(f({tab:m}),g(B.uid()),m!=="all"){const j={$and:[(C=s==null?void 0:s.params)==null?void 0:C.filter,{"category.id":m}]};i({filter:j}),c==null||c({category:[+m],params:[{filter:j}]})}else i(),c==null||c({category:[],params:[]})},x=m=>{_.confirm({title:y("{{t('Delete category')}}"),content:y("{{t('Are you sure you want to delete it?')}}"),onOk:()=>D(this,null,function*(){yield b.resource("collectionCategories").destroy({filter:{id:m}}),m===+l.tab&&f({tab:"all"}),yield o(),yield n()})})},d=()=>D(this,null,function*(){return t.map(m=>({label:e(y(m.name)),value:m.id}))}),h=Y.memoize(m=>({items:[{key:"edit",label:a.jsx(r.SchemaComponent,{schema:{type:"void",properties:{[B.uid()]:{"x-component":"EditCategory","x-component-props":{item:m}}}}})},{key:"delete",label:y("{{t('Delete category')}}"),onClick:()=>x(m.id)}]}));return t?a.jsx(hf,{children:a.jsx(v.Tabs,{addIcon:a.jsx(r.SchemaComponent,{schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category") }}',"x-component":"AddCategory","x-component-props":{type:"primary"}}}}}),onChange:$,defaultActiveKey:l.tab||"all",type:"editable-card",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},items:S.map(m=>({label:m.id!=="all"?a.jsx("div",{"data-no-dnd":"true",children:a.jsx(gf,{item:m})}):y(m.name),key:String(m.id),closable:m.closable,closeIcon:a.jsx(v.Dropdown,{menu:h(m),children:a.jsx(W.MenuOutlined,{role:"button","aria-label":y(m.name),style:{padding:8,margin:"-8px"}})}),children:a.jsx(v.Card,{bordered:!1,children:a.jsx(r.SchemaComponentOptions,{components:{CollectionFields:bt},inherit:!0,scope:{loadCategories:d,categoryVisible:m.id==="all",categoryId:m.id},children:a.jsx(w.RecursionField,{name:u,schema:m.schema,onlyRenderProperties:!0})})})}))})}):null},vf=()=>{const e=w.useForm(),t=r.useActionContext(),{refresh:o}=p.useContext(r.CollectionCategoriesContext),n=r.useAPIClient();return{run(){return D(this,null,function*(){yield e.submit();const s=Y.cloneDeep(e.values);yield n.resource("collectionCategories").create({values:T({},s)}),t.setVisible(!1),yield e.reset(),yield o()})}}},bf=e=>a.jsx(qo,T({},e)),qo=e=>{const{scope:t,getContainer:o,children:n}=e,[i,s]=p.useState(!1),{t:c}=N.useTranslation();return a.jsxs(r.ActionContextProvider,{value:{visible:i,setVisible:s},children:[a.jsx("div",{onClick:()=>s(!0),title:c("Add category"),children:n||a.jsx(W.PlusOutlined,{})}),a.jsx(r.SchemaComponent,{schema:rf,components:{CollectionCategory:r.CollectionCategory,CollectionTemplateTag:r.CollectionTemplateTag},scope:T({getContainer:o,useCancelAction:r.useCancelAction,createOnly:!0,useCreateCategry:vf},t)})]})},xf=()=>{const e=w.useForm(),t=r.useActionContext(),{refresh:o}=p.useContext(r.CollectionCategoriesContext),{refresh:n}=r.useResourceActionContext(),i=r.useAPIClient(),{id:s}=r.useRecord();return{run(){return D(this,null,function*(){yield e.submit();const l=Y.cloneDeep(e.values);yield i.resource("collectionCategories").update({filter:{id:s},values:T({},l)}),t.setVisible(!1),yield e.reset(),yield o(),yield n()})}}},Sf=e=>{const t=r.useRecord(),o=r.useRequest(()=>Promise.resolve({data:Y.cloneDeep(t)}),K(T({},e),{manual:!0})),n=r.useActionContext();return p.useEffect(()=>{n.visible&&o.run()},[n.visible]),o},Af=e=>a.jsx(Go,T({},e)),Go=e=>{const{scope:t,getContainer:o,item:n,children:i}=e,[s,c]=p.useState(!1),l=r.useCompile();return a.jsx(r.RecordProvider,{record:n,children:a.jsxs(r.ActionContextProvider,{value:{visible:s,setVisible:c},children:[a.jsx(a.Fragment,{children:i||a.jsx("span",{onClick:()=>c(!0),children:l('{{ t("Edit category") }}')})}),a.jsx(r.SchemaComponent,{schema:af,scope:T({getContainer:o,useCancelAction:r.useCancelAction,createOnly:!0,useEditCategry:xf,useValuesFromRecord:Sf},t)})]})})};ge.registerValidateFormats({uid:/^[a-zA-Z][a-zA-Z0-9_-]*$/});const $f={type:"object",properties:{[B.uid()]:{"x-component":"ConfigurationTable"}}},Tf=()=>a.jsx(r.SchemaComponent,{schema:$f,components:{CollectionCategoriesProvider:r.CollectionCategoriesProvider,ConfigurationTable:mf,ConfigurationTabs:Cf,AddFieldAction:r.AddFieldAction,AddCollectionField:r.AddCollectionField,AddCollection:r.AddCollection,AddCollectionAction:r.AddCollectionAction,AddCategoryAction:qo,AddCategory:bf,EditCollection:r.EditCollection,EditCollectionAction:r.EditCollectionAction,DeleteCollection:r.DeleteCollection,DeleteCollectionAction:r.DeleteCollectionAction,EditFieldAction:r.EditFieldAction,EditCollectionField:r.EditCollectionField,OverridingCollectionField:r.OverridingCollectionField,OverridingFieldAction:r.OverridingFieldAction,ViewCollectionField:r.ViewCollectionField,ViewFieldAction:r.ViewFieldAction,EditCategory:Af,EditCategoryAction:Go,SyncFieldsAction:r.SyncFieldsAction,SyncFieldsActionCom:r.SyncFieldsActionCom,SyncSQLFieldsAction:r.SyncSQLFieldsAction}}),be=p.createContext(null);be.displayName="PermissionContext";const Ff=e=>{const t=r.useAPIClient(),o=r.useRecord(),{t:n}=N.useTranslation(),i=p.useContext(xe),{snippets:s}=i;s==null||s.forEach(f=>{i[f]=!0});const[c,l]=p.useState(i);return p.useEffect(()=>{l(i)},[i]),a.jsx(be.Provider,{value:{currentDataSource:o,currentRecord:c,update:(f,u)=>D(this,null,function*(){yield t.request({url:`dataSources/${o.key}/roles:update`,data:u.values,method:"post",params:{filterByTk:u.values.roleName}}),l(T(T({},c),u.values)),v.message.success(n("Saved successfully"))})},children:e.children})},wf=e=>{const t=p.useContext(xe),o=r.useRecord();return a.jsx(r.RecordContext_deprecated.Provider,{value:T({},t),children:a.jsx(r.SchemaComponentOptions,{scope:{dataSourceKey:o.key},children:e.children})})},_f=e=>{const t=r.useRecord(),{visible:o}=r.useActionContext(),{currentDataSource:n}=p.useContext(be),i=r.useRequest({resource:"roles.dataSourceResources",resourceOf:t.roleName,action:"get",params:{appends:["actions","actions.scope"],filterByTk:t.name,filter:{dataSourceKey:n.key,name:t.name}}},K(T({},e),{manual:!0}));return p.useEffect(()=>{if(!t.exists){e.onSuccess({data:{}});return}o&&i.run()},[o,t.exists]),i},Pf=()=>{const e=w.useForm(),t=r.useAPIClient(),o=r.useRecord(),n=r.useActionContext(),{refresh:i}=r.useResourceActionContext(),{currentDataSource:s}=p.useContext(be);return{run(){return D(this,null,function*(){yield t.resource("roles.dataSourceResources",o.roleName)[o.exists?"update":"create"]({filterByTk:o.name,filter:{dataSourceKey:s.key,name:o.name},values:K(T({},e.values),{name:o.name,dataSourceKey:s.key})}),n.setVisible(!1),i()})}}},Df={type:"void","x-decorator":"RoleRecordProvider",properties:{block:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"dataSourcesCollections",targetKey:"name",filterTargetKey:"name",fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{t("Collection display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Collection name")}}',type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"input",uiSchema:{title:'{{t("Resource type")}}',type:"string","x-component":"Select",enum:[{label:'{{t("Collection")}}',value:"collection",color:"green"},{label:'{{t("Association")}}',value:"association",color:"blue"}]}},{type:"string",name:"usingConfig",interface:"input",uiSchema:{title:'{{t("Permission policy")}}',type:"string","x-component":"Select",enum:[{label:'{{t("Individual")}}',value:"resourceAction",color:"orange"},{label:'{{t("General")}}',value:"strategy",color:"default"}]}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}}]},association:{sourceKey:"name",targetKey:"name"},resourceName:"roles.dataSourcesCollections",request:{resource:"roles.dataSourcesCollections",action:"list",params:{pageSize:20,filter:{hidden:{$isFalsy:!0},dataSourceKey:"{{dataSourceKey}}"},sort:["sort"],appends:["fields"]}}},properties:{[B.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"}}},table1:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column0:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{usingConfig:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:_f},title:'{{t("Configure permission")}}',properties:{usingActionsConfig:{title:'{{t("Permission policy")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:!1,enum:[{value:!1,label:'{{t("General")}}'},{value:!0,label:'{{t("Individual")}}'}],"x-reactions":{target:"actions",fulfill:{state:{hidden:"{{!$self.value}}"}}}},actions:{"x-component":"RolesResourcesActions","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:Pf}}}}}}}}}}}}}}}}}},Uo={name:"dataSources",filterTargetKey:"name",targetKey:"name",fields:[{type:"string",name:"displayName",interface:"input",uiSchema:{title:'{{t("Display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"key",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"number","x-component":"Input",required:!0}}]},If={type:"object",properties:{block1:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:Uo,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,showAnonymous:!0,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:Uo},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column1:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-decorator":"ACLActionProvider","x-acl-action":"roles:update","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"PermissionProvider",title:'{{t("Configure permissions")}}',properties:{tabs1:{type:"void","x-component":"Tabs","x-component-props":{},properties:{tab1:{type:"void",title:'{{t("General action permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{role:{"x-component":"RoleConfigure"}}},tab2:{type:"void",title:'{{t("Action permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{roleCollectionsSchema:Df}}}}}}}}}}}}}}}}}},lt=p.createContext([]);lt.displayName="AvailableActionsContext";const Of=e=>{const{data:t,loading:o}=r.useRequest({resource:"availableActions",action:"list"});return o?a.jsx(v.Spin,{}):a.jsx(lt.Provider,{value:t==null?void 0:t.data,children:e.children})},zo=()=>p.useContext(lt),Mf=()=>{const e=r.useRecord();return a.jsx("div",{children:a.jsx(r.SchemaComponentContext.Provider,{value:{designable:!1},children:a.jsx(Of,{children:a.jsx(r.SchemaComponent,{schema:If,components:{SettingCenterPermissionProvider:r.SettingCenterPermissionProvider,PermissionProvider:Ff},scope:{dataSourceKey:e.key}})})})})},kf=()=>{const{update:e}=p.useContext(be),{t}=N.useTranslation(),{key:o}=r.useRecord();return a.jsx(r.SchemaComponent,{schema:{type:"void",name:"form","x-component":"Form","x-component-props":{useValues:n=>{const i=r.useAPIClient(),s=p.useContext(xe);return r.useRequest(()=>i.resource(`dataSources/${o}/roles`).get({filterByTk:s.name}).then(c=>{var f,u;const l=(f=c==null?void 0:c.data)==null?void 0:f.data;return(u=l.snippets)==null||u.forEach(g=>{l[g]=!0}),{data:l}}),n)},effects(){ge.onFieldChange("*",(n,i)=>D(this,null,function*(){i.modified&&(yield e(n,i))}))}},properties:{"strategy.actions":{description:t("All collections use general action permissions by default; permission configured individually will override the default one."),"x-component":"StrategyActions"}}}})},Ef=e=>{var o;if(!e)return{};const t={};return(o=e==null?void 0:e.forEach)==null||o.call(e,n=>{const[i,s]=n.split(":");t[i]=s||"all"}),t},Ho=e=>{const t=[];for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)){const n=e[o];n==="all"?t.push(o):t.push(`${o}:${n}`)}return t},jf=w.connect(e=>{const{onChange:t}=e,o=zo(),n=r.useCompile(),{t:i}=N.useTranslation(),s=w.useField(),c=Ef(s.value);return a.jsx("div",{children:a.jsx(v.Table,{size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:i("Action display name"),render:l=>n(l)},{dataIndex:"onNewRecord",title:i("Action type"),render:l=>l?a.jsx(v.Tag,{color:"green",children:i("Action on new records")}):a.jsx(v.Tag,{color:"geekblue",children:i("Action on existing records")})},{dataIndex:"enabled",title:i("Allow"),render:(l,f)=>a.jsx(v.Checkbox,{checked:l,onChange:u=>{l?delete c[f.name]:c[f.name]="all",t(Ho(c))}})},{dataIndex:"scope",title:i("Data scope"),render:(l,f)=>!f.onNewRecord&&a.jsx(v.Select,{"data-testid":"select-data-scope",popupMatchSelectWidth:!1,size:"small",value:l,options:[{label:i("All records"),value:"all"},{label:i("Own records"),value:"own"}],onChange:u=>{c[f.name]=u,t(Ho(c))}})}],dataSource:o==null?void 0:o.map(l=>{let f="all",u=!1;return c[l.name]&&(u=!0,f=c[l.name]),K(T({},l),{enabled:u,scope:f})})})})}),Kf=Ro.createStyles(({css:e})=>e`
51
+ `,children:a.jsx(v.Button,{type:"link",style:{padding:"0px"},disabled:!e.enabled,onClick:()=>{t(ef(e))},role:"button","aria-label":`${e==null?void 0:e.key}-Configure`,children:o("Configure")})})},of=()=>{const{t:e}=N.useTranslation(),t=r.usePlugin(ye),o=[...t.types.keys()].map(g=>{const f=t.types.get(g);return{value:g,label:e(f==null?void 0:f.label)}}).concat([{value:"main",label:e("Main")}]),n=r.useDataSourceManager(),i=d.useRef([]);d.useEffect(()=>()=>{n.getDataSources().forEach(g=>{i.current.includes(g.key)&&g.reload()})},[i]);const s=d.useCallback(g=>{n.removeDataSources(g)},[n]),c=d.useCallback(g=>{n.addDataSource(yt,g),i.current=[...i.current,g.key]},[]),l=()=>{const g=r.useResourceActionContext();return{onClick(){return D(this,null,function*(){var P,T;const b=(P=g==null?void 0:g.data)==null?void 0:P.data.filter($=>$.status!=="loaded");if(b!=null&&b.length){const $=n.getDataSources(),x=b.map(h=>h.key),y=$.filter(h=>x.includes(h.key));yield Promise.all(y.map(h=>h.reload()))}(T=g==null?void 0:g.refresh)==null||T.call(g)})}}},m=()=>{const{refresh:g}=r.useResourceActionContext(),{resource:f}=r.useResourceContext(),{key:b}=r.useRecord();return{run(){return D(this,null,function*(){yield f.destroy({filterByTk:b}),s([b]),g()})}}},u=g=>{const{key:f}=r.useRecord();g.visible=f!=="main"};return a.jsx(v.Card,{bordered:!1,children:a.jsx(r.SchemaComponent,{components:{CreateDatabaseConnectAction:Xy,EditDatabaseConnectionAction:Ry,ViewDatabaseConnectionAction:tf},scope:{useNewId:g=>`${g}${B.uid()}`,types:o,useRefreshActionProps:l,useDestroyAction:m,dataSourceDeleteCallback:s,dataSourceCreateCallback:c,useIsAbleDelete:u},schema:sn})})},Bo=e=>_.Schema.compile(e,{t:r.i18n.t}),nf={type:"object",properties:{block1:{type:"void","x-collection":"collections","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"collections",filterTargetKey:"name",targetKey:"name",sortable:!0,fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{ t("Collection display name") }}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Collection name") }}',type:"string","x-component":"Input",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'}},{type:"string",name:"template",interface:"input",uiSchema:{title:'{{ t("Collection Template") }}',type:"string","x-component":"Input"}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}},{type:"hasMany",name:"inherits",interface:"select",uiSchema:{title:'{{ t("Inherits") }}',type:"string","x-component":"Select","x-component-props":{mode:"multiple"}}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input"}}]},dragSort:!0,request:{resource:"collections",action:"list",params:{pageSize:50,sort:"sort",filter:{"hidden.$isFalsy":!0},appends:["category"]}}},properties:{tabs:{type:"void","x-component":"ConfigurationTabs"}}}}},Vo={type:"object",properties:{[B.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button",isBulk:!0}},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"}}}},[B.uid()]:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction(){const e=r.useAPIClient(),{t}=N.useTranslation();return{move(n,i){return D(this,null,function*(){yield e.resource("collections").move({sourceId:n.key,targetId:i.key}),v.message.success(t("Saved successfully"),.2)})}}}},properties:{column1:{type:"void",title:'{{t("Collection display name")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":St,"x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Collection template")}}',properties:{template:{"x-component":r.CollectionTemplateTag,"x-read-pretty":!0}}},column4:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column","x-visible":"categoryVisible",title:'{{t("Collection category")}}',properties:{category:{"x-component":r.CollectionCategory,"x-read-pretty":!0}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},column6:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{ t("Configure fields") }}',"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{destroyOnClose:!0,width:"70%"},"x-reactions":e=>{const t=e.path.segments[1],o=e.path.segments[0],n=e.form.getValuesIn(`${o}.${t}`);n&&(e.title=`${Bo(n.title)} - ${Bo('{{ t("Configure fields") }}')}`)},properties:{collectionFieldSchema:{type:"void","x-component":"CollectionFields"}}}}},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollection","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button","aria-label":'{{ "delete-button-" + $record.name }}',type:"primary",className:"nb-action-link"}}}}}}}}}},rf={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-component":"Action.Modal",title:'{{ t("Add category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateCategry }}",style:{marginLeft:"8px"}}}}}}}}},af={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},"x-component":"Action.Modal",title:'{{ t("Edit category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useEditCategry }}",style:{marginLeft:"8px"}}}}}}}}},sf=(e,t)=>(o,n)=>{o.loading=!0,e(o,n,t).then(dt.action.bound(i=>{o.dataSource=i,o.loading=!1})).catch(console.error)},cf=()=>{const[e,t]=d.useState([]);return[e,t]},lf=()=>{const e=r.useRecord(),t=_.useForm();return{run(){return D(this,null,function*(){var i,s,c;const n=(c=(s=(i=t.values)==null?void 0:i.children)==null?void 0:s.slice)==null?void 0:c.call(s);t.setValuesIn("children",n.filter(l=>l.name!==e.name))})}}},uf=()=>({run(){return D(this,null,function*(){})}}),pf=()=>{const e=r.useRecord(),{getCollectionFields:t}=r.useCollectionManager_deprecated();return e.__parent&&e.__parent.interface==="subTable"?d.useContext(r.DataSourceContext_deprecated).dataSource:t(e.collectionName||e.name)},df=e=>`${e||""}${B.uid()}`,mf=()=>{const{t:e}=N.useTranslation(),{interfaces:t,getCollections:o,getCollection:n}=r.useCollectionManager_deprecated(),{data:{database:i}}=r.useCurrentAppInfo(),s=d.useContext(r.CollectionCategoriesContext),c=r.useAPIClient(),l=c.resource("dbViews"),m=r.useCompile();_.useForm();const u=r.useApp(),g=(x,y,h)=>D(this,null,function*(){var E;const{targetScope:p}=y,C=((E=x.props)==null?void 0:E.name)==="inherits";return o().filter(k=>{var w;if(h!=null&&h.includes(k.template)||k.autoCreate&&k.isThrough||C&&k.template==="view")return!1;const V=!(p!=null&&p.template)||p.template.includes(k.template),S=!(p!=null&&p[(w=x.props)==null?void 0:w.name])||p[x.props.name].includes(k.name);return V&&S}).map(k=>({label:m(k.title),value:k.name}))}),f=()=>D(this,null,function*(){return s.data.map(x=>({label:m(x.name),value:x.id}))}),b=()=>D(this,null,function*(){return l.list().then(({data:x})=>{var y;return(y=x==null?void 0:x.data)==null?void 0:y.map(h=>{const p=h.schema;return{label:p?`${p}.${m(h.name)}`:h.name,value:p?`${p}_${h.name}`:h.name}})})}),P=x=>D(this,null,function*(){const{name:y}=x.form.values,{fields:h}=n(y);return Promise.resolve({data:h}).then(({data:p})=>{var C;return(C=p.filter(F=>F.interface?!!u.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(F.interface).titleUsable:!1))==null?void 0:C.map(F=>{var E;return{label:m((E=F.uiSchema)==null?void 0:E.title)||F.name,value:F.name}})})}),T=()=>D(this,null,function*(){return c.resource("storages").list().then(({data:x})=>{var y;return(y=x==null?void 0:x.data)==null?void 0:y.map(h=>({label:e(m(h.title)),value:h.name}))})}),$=d.useContext(r.SchemaComponentContext);return a.jsx(r.SchemaComponentContext.Provider,{value:K(A({},$),{designable:!1}),children:a.jsx(r.SchemaComponent,{schema:nf,components:{AddSubFieldAction:r.AddSubFieldAction,EditSubFieldAction:r.EditSubFieldAction,FieldSummary:r.FieldSummary,TemplateSummay:r.TemplateSummary,CollectionFields:bt},scope:{loadFilterTargetKeys:P,useDestroySubField:lf,useBulkDestroySubField:uf,useSelectedRowKeys:cf,useAsyncDataSource:sf,loadCollections:g,loadCategories:f,loadDBViews:b,loadStorages:T,useCurrentFields:pf,useNewId:df,useCancelAction:r.useCancelAction,interfaces:t,enableInherits:(i==null?void 0:i.dialect)==="postgres",isPG:(i==null?void 0:i.dialect)==="postgres"}})})};function yf(e){const{attributes:t,listeners:o,setNodeRef:n}=Q.useDraggable({id:e.id,data:e.data});return a.jsx("div",K(A(A({ref:n},o),t),{children:a.jsx("div",{children:e.children})}))}function ff(e){const{isOver:t,setNodeRef:o}=Q.useDroppable({id:e.id,data:e.data}),n=t?{color:"green"}:void 0;return a.jsx("div",{ref:o,style:n,children:e.children})}const gf=_.observer(({item:e})=>a.jsx(ff,{id:e.id.toString(),data:e,children:a.jsx("div",{children:a.jsx(yf,{id:e.id.toString(),data:e,children:a.jsx(Lo,{item:e})})})}),{displayName:"TabTitle"}),Lo=({item:e})=>{const{t}=N.useTranslation(),o=r.useCompile();return a.jsxs(v.Space,{children:[a.jsx(v.Badge,{color:e.color}),t(o(e.name))]})},hf=_.observer(e=>{const[t,o]=d.useState(null),{refresh:n}=d.useContext(r.CollectionCategoriesContext),{refresh:i}=r.useResourceActionContext(),s=r.useAPIClient(),c=g=>D(this,null,function*(){const{active:f,over:b}=g;setTimeout(()=>{o(null)}),b&&b.id!==f.id&&(yield s.resource("collectionCategories").move({sourceId:f.id,targetId:b.id}),yield n(),yield i())});function l(g){var f;o((f=g.active)==null?void 0:f.data.current)}const m=Q.useSensor(Q.MouseSensor,{activationConstraint:{distance:10}}),u=Q.useSensors(m);return a.jsxs(Q.DndContext,{sensors:u,onDragEnd:c,onDragStart:l,children:[e.children,a.jsx(Q.DragOverlay,{children:t?a.jsx("span",{style:{whiteSpace:"nowrap"},children:a.jsx(Lo,{item:t})}):null})]})},{displayName:"DndProvider"}),Cf=()=>{const{t:e}=N.useTranslation(),{data:t,refresh:o}=d.useContext(r.CollectionCategoriesContext),{refresh:n,run:i,defaultRequest:s,setState:c}=r.useResourceActionContext(),[l,m]=d.useState({tab:"all"}),[u,g]=d.useState(l.tab),f=r.useCompile(),b=r.useAPIClient(),{modal:P}=v.App.useApp(),T=d.useMemo(()=>{if(!t)return[];const p=t.sort((C,F)=>F.sort-C.sort).concat().map(C=>K(A({},C),{schema:Vo}));return!p.find(C=>C.id==="all")&&p.unshift({name:'{{t("All collections")}}',id:"all",sort:0,closable:!1,schema:Vo}),p},[t]);d.useEffect(()=>{l.tab!=="all"&&$(l.tab)},[]);const $=p=>{var C;if(m({tab:p}),g(B.uid()),p!=="all"){const E={$and:[(C=s==null?void 0:s.params)==null?void 0:C.filter,{"category.id":p}]};i({filter:E}),c==null||c({category:[+p],params:[{filter:E}]})}else i(),c==null||c({category:[],params:[]})},x=p=>{P.confirm({title:f("{{t('Delete category')}}"),content:f("{{t('Are you sure you want to delete it?')}}"),onOk:()=>D(this,null,function*(){yield b.resource("collectionCategories").destroy({filter:{id:p}}),p===+l.tab&&m({tab:"all"}),yield o(),yield n()})})},y=()=>D(this,null,function*(){return t.map(p=>({label:e(f(p.name)),value:p.id}))}),h=Y.memoize(p=>({items:[{key:"edit",label:a.jsx(r.SchemaComponent,{schema:{type:"void",properties:{[B.uid()]:{"x-component":"EditCategory","x-component-props":{item:p}}}}})},{key:"delete",label:f("{{t('Delete category')}}"),onClick:()=>x(p.id)}]}));return t?a.jsx(hf,{children:a.jsx(v.Tabs,{addIcon:a.jsx(r.SchemaComponent,{schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category") }}',"x-component":"AddCategory","x-component-props":{type:"primary"}}}}}),onChange:$,defaultActiveKey:l.tab||"all",type:"editable-card",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},items:T.map(p=>({label:p.id!=="all"?a.jsx("div",{"data-no-dnd":"true",children:a.jsx(gf,{item:p})}):f(p.name),key:String(p.id),closable:p.closable,closeIcon:a.jsx(v.Dropdown,{menu:h(p),children:a.jsx(W.MenuOutlined,{role:"button","aria-label":f(p.name),style:{padding:8,margin:"-8px"}})}),children:a.jsx(v.Card,{bordered:!1,children:a.jsx(r.SchemaComponentOptions,{components:{CollectionFields:bt},inherit:!0,scope:{loadCategories:y,categoryVisible:p.id==="all",categoryId:p.id},children:a.jsx(_.RecursionField,{name:u,schema:p.schema,onlyRenderProperties:!0})})})}))})}):null},vf=()=>{const e=_.useForm(),t=r.useActionContext(),{refresh:o}=d.useContext(r.CollectionCategoriesContext),n=r.useAPIClient();return{run(){return D(this,null,function*(){yield e.submit();const s=Y.cloneDeep(e.values);yield n.resource("collectionCategories").create({values:A({},s)}),t.setVisible(!1),yield e.reset(),yield o()})}}},bf=e=>a.jsx(qo,A({},e)),qo=e=>{const{scope:t,getContainer:o,children:n}=e,[i,s]=d.useState(!1),{t:c}=N.useTranslation();return a.jsxs(r.ActionContextProvider,{value:{visible:i,setVisible:s},children:[a.jsx("div",{onClick:()=>s(!0),title:c("Add category"),children:n||a.jsx(W.PlusOutlined,{})}),a.jsx(r.SchemaComponent,{schema:rf,components:{CollectionCategory:r.CollectionCategory,CollectionTemplateTag:r.CollectionTemplateTag},scope:A({getContainer:o,useCancelAction:r.useCancelAction,createOnly:!0,useCreateCategry:vf},t)})]})},xf=()=>{const e=_.useForm(),t=r.useActionContext(),{refresh:o}=d.useContext(r.CollectionCategoriesContext),{refresh:n}=r.useResourceActionContext(),i=r.useAPIClient(),{id:s}=r.useRecord();return{run(){return D(this,null,function*(){yield e.submit();const l=Y.cloneDeep(e.values);yield i.resource("collectionCategories").update({filter:{id:s},values:A({},l)}),t.setVisible(!1),yield e.reset(),yield o(),yield n()})}}},Sf=e=>{const t=r.useRecord(),o=r.useRequest(()=>Promise.resolve({data:Y.cloneDeep(t)}),K(A({},e),{manual:!0})),n=r.useActionContext();return d.useEffect(()=>{n.visible&&o.run()},[n.visible]),o},Af=e=>a.jsx(Go,A({},e)),Go=e=>{const{scope:t,getContainer:o,item:n,children:i}=e,[s,c]=d.useState(!1),l=r.useCompile();return a.jsx(r.RecordProvider,{record:n,children:a.jsxs(r.ActionContextProvider,{value:{visible:s,setVisible:c},children:[a.jsx(a.Fragment,{children:i||a.jsx("span",{onClick:()=>c(!0),children:l('{{ t("Edit category") }}')})}),a.jsx(r.SchemaComponent,{schema:af,scope:A({getContainer:o,useCancelAction:r.useCancelAction,createOnly:!0,useEditCategry:xf,useValuesFromRecord:Sf},t)})]})})};ge.registerValidateFormats({uid:/^[a-zA-Z][a-zA-Z0-9_-]*$/});const $f={type:"object",properties:{[B.uid()]:{"x-component":"ConfigurationTable"}}},Tf=()=>a.jsx(r.SchemaComponent,{schema:$f,components:{CollectionCategoriesProvider:r.CollectionCategoriesProvider,ConfigurationTable:mf,ConfigurationTabs:Cf,AddFieldAction:r.AddFieldAction,AddCollectionField:r.AddCollectionField,AddCollection:r.AddCollection,AddCollectionAction:r.AddCollectionAction,AddCategoryAction:qo,AddCategory:bf,EditCollection:r.EditCollection,EditCollectionAction:r.EditCollectionAction,DeleteCollection:r.DeleteCollection,DeleteCollectionAction:r.DeleteCollectionAction,EditFieldAction:r.EditFieldAction,EditCollectionField:r.EditCollectionField,OverridingCollectionField:r.OverridingCollectionField,OverridingFieldAction:r.OverridingFieldAction,ViewCollectionField:r.ViewCollectionField,ViewFieldAction:r.ViewFieldAction,EditCategory:Af,EditCategoryAction:Go,SyncFieldsAction:r.SyncFieldsAction,SyncFieldsActionCom:r.SyncFieldsActionCom,SyncSQLFieldsAction:r.SyncSQLFieldsAction}}),be=d.createContext(null);be.displayName="PermissionContext";const Ff=e=>{const t=r.useAPIClient(),o=r.useRecord(),{t:n}=N.useTranslation(),i=d.useContext(xe),{snippets:s}=i;s==null||s.forEach(m=>{i[m]=!0});const[c,l]=d.useState(i);return d.useEffect(()=>{l(i)},[i]),a.jsx(be.Provider,{value:{currentDataSource:o,currentRecord:c,update:(m,u)=>D(this,null,function*(){yield t.request({url:`dataSources/${o.key}/roles:update`,data:u.values,method:"post",params:{filterByTk:u.values.roleName}}),l(A(A({},c),u.values)),v.message.success(n("Saved successfully"))})},children:e.children})},wf=e=>{const t=d.useContext(xe),o=r.useRecord();return a.jsx(r.RecordContext_deprecated.Provider,{value:A({},t),children:a.jsx(r.SchemaComponentOptions,{scope:{dataSourceKey:o.key},children:e.children})})},_f=e=>{const t=r.useRecord(),{visible:o}=r.useActionContext(),{currentDataSource:n}=d.useContext(be),i=r.useRequest({resource:"roles.dataSourceResources",resourceOf:t.roleName,action:"get",params:{appends:["actions","actions.scope"],filterByTk:t.name,filter:{dataSourceKey:n.key,name:t.name}}},K(A({},e),{manual:!0}));return d.useEffect(()=>{if(!t.exists){e.onSuccess({data:{}});return}o&&i.run()},[o,t.exists]),i},Pf=()=>{const e=_.useForm(),t=r.useAPIClient(),o=r.useRecord(),n=r.useActionContext(),{refresh:i}=r.useResourceActionContext(),{currentDataSource:s}=d.useContext(be);return{run(){return D(this,null,function*(){yield t.resource("roles.dataSourceResources",o.roleName)[o.exists?"update":"create"]({filterByTk:o.name,filter:{dataSourceKey:s.key,name:o.name},values:K(A({},e.values),{name:o.name,dataSourceKey:s.key})}),n.setVisible(!1),i()})}}},Df={type:"void","x-decorator":"RoleRecordProvider",properties:{block:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"dataSourcesCollections",targetKey:"name",filterTargetKey:"name",fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{t("Collection display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Collection name")}}',type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"input",uiSchema:{title:'{{t("Resource type")}}',type:"string","x-component":"Select",enum:[{label:'{{t("Collection")}}',value:"collection",color:"green"},{label:'{{t("Association")}}',value:"association",color:"blue"}]}},{type:"string",name:"usingConfig",interface:"input",uiSchema:{title:'{{t("Permission policy")}}',type:"string","x-component":"Select",enum:[{label:'{{t("Individual")}}',value:"resourceAction",color:"orange"},{label:'{{t("General")}}',value:"strategy",color:"default"}]}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}}]},association:{sourceKey:"name",targetKey:"name"},resourceName:"roles.dataSourcesCollections",request:{resource:"roles.dataSourcesCollections",action:"list",params:{pageSize:20,filter:{hidden:{$isFalsy:!0},dataSourceKey:"{{dataSourceKey}}"},sort:["sort"],appends:["fields"]}}},properties:{[B.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"}}},table1:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column0:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{usingConfig:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:_f},title:'{{t("Configure permission")}}',properties:{usingActionsConfig:{title:'{{t("Permission policy")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:!1,enum:[{value:!1,label:'{{t("General")}}'},{value:!0,label:'{{t("Individual")}}'}],"x-reactions":{target:"actions",fulfill:{state:{hidden:"{{!$self.value}}"}}}},actions:{"x-component":"RolesResourcesActions","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:Pf}}}}}}}}}}}}}}}}}},Uo={name:"dataSources",filterTargetKey:"name",targetKey:"name",fields:[{type:"string",name:"displayName",interface:"input",uiSchema:{title:'{{t("Display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"key",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"number","x-component":"Input",required:!0}}]},If={type:"object",properties:{block1:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:Uo,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,showAnonymous:!0,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:Uo},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column1:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-decorator":"ACLActionProvider","x-acl-action":"roles:update","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"PermissionProvider",title:'{{t("Configure permissions")}}',properties:{tabs1:{type:"void","x-component":"Tabs","x-component-props":{},properties:{tab1:{type:"void",title:'{{t("General action permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{role:{"x-component":"RoleConfigure"}}},tab2:{type:"void",title:'{{t("Action permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{roleCollectionsSchema:Df}}}}}}}}}}}}}}}}}},lt=d.createContext([]);lt.displayName="AvailableActionsContext";const Of=e=>{const{data:t,loading:o}=r.useRequest({resource:"availableActions",action:"list"});return o?a.jsx(v.Spin,{}):a.jsx(lt.Provider,{value:t==null?void 0:t.data,children:e.children})},zo=()=>d.useContext(lt),Mf=()=>{const e=r.useRecord();return a.jsx("div",{children:a.jsx(r.SchemaComponentContext.Provider,{value:{designable:!1},children:a.jsx(Of,{children:a.jsx(r.SchemaComponent,{schema:If,components:{SettingCenterPermissionProvider:r.SettingCenterPermissionProvider,PermissionProvider:Ff},scope:{dataSourceKey:e.key}})})})})},kf=()=>{const{update:e}=d.useContext(be),{t}=N.useTranslation(),{key:o}=r.useRecord();return a.jsx(r.SchemaComponent,{schema:{type:"void",name:"form","x-component":"Form","x-component-props":{useValues:n=>{const i=r.useAPIClient(),s=d.useContext(xe);return r.useRequest(()=>i.resource(`dataSources/${o}/roles`).get({filterByTk:s.name}).then(c=>{var m,u;const l=(m=c==null?void 0:c.data)==null?void 0:m.data;return(u=l.snippets)==null||u.forEach(g=>{l[g]=!0}),{data:l}}),n)},effects(){ge.onFieldChange("*",(n,i)=>D(this,null,function*(){i.modified&&(yield e(n,i))}))}},properties:{"strategy.actions":{description:t("All collections use general action permissions by default; permission configured individually will override the default one."),"x-component":"StrategyActions"}}}})},Ef=e=>{var o;if(!e)return{};const t={};return(o=e==null?void 0:e.forEach)==null||o.call(e,n=>{const[i,s]=n.split(":");t[i]=s||"all"}),t},Ho=e=>{const t=[];for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)){const n=e[o];n==="all"?t.push(o):t.push(`${o}:${n}`)}return t},jf=_.connect(e=>{const{onChange:t}=e,o=zo(),n=r.useCompile(),{t:i}=N.useTranslation(),s=_.useField(),c=Ef(s.value);return a.jsx("div",{children:a.jsx(v.Table,{size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:i("Action display name"),render:l=>n(l)},{dataIndex:"onNewRecord",title:i("Action type"),render:l=>l?a.jsx(v.Tag,{color:"green",children:i("Action on new records")}):a.jsx(v.Tag,{color:"geekblue",children:i("Action on existing records")})},{dataIndex:"enabled",title:i("Allow"),render:(l,m)=>a.jsx(v.Checkbox,{checked:l,onChange:u=>{l?delete c[m.name]:c[m.name]="all",t(Ho(c))}})},{dataIndex:"scope",title:i("Data scope"),render:(l,m)=>!m.onNewRecord&&a.jsx(v.Select,{"data-testid":"select-data-scope",popupMatchSelectWidth:!1,size:"small",value:l,options:[{label:i("All records"),value:"all"},{label:i("Own records"),value:"own"}],onChange:u=>{c[m.name]=u,t(Ho(c))}})}],dataSource:o==null?void 0:o.map(l=>{let m="all",u=!1;return c[l.name]&&(u=!0,m=c[l.name]),K(A({},l),{enabled:u,scope:m})})})})}),Kf=Ro.createStyles(({css:e})=>e`
52
52
  .ant-table-cell {
53
53
  > .ant-space-horizontal {
54
54
  .ant-space-item-split:has(+ .ant-space-item:empty) {
@@ -56,4 +56,4 @@
56
56
  }
57
57
  }
58
58
  }
59
- `),Nf=(e="main")=>({name:`dataSources/${e}/rolesResourcesScopes`,fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Scope name")}}',type:"string","x-component":"Input",required:!0}}]}),Bf=()=>{const{name:e}=p.useContext(me),t=r.useFormBlockContext();return p.useEffect(()=>{t.form.setInitialValues({resourceName:e})},[e]),{form:t.form}},Vf=e=>{const t=Nf(e);return{type:"object",properties:{scope:{"x-component":"RecordPicker","x-component-props":{size:"small",fieldNames:{label:"name",value:"id"},multiple:!1,association:{target:"rolesResourcesScopes"},onChange:"{{ onChange }}"},properties:{selector:{type:"void",title:'{{ t("Select record") }}',"x-component":"RecordPicker.Selector","x-component-props":{className:"nb-record-picker-selector"},properties:{tableBlock:{type:"void","x-decorator":"TableSelectorProvider","x-decorator-props":{collection:t,resource:`dataSources/${e}/rolesResourcesScopes`,action:"list",params:{pageSize:20},useParams(){return{filter:{$or:[{resourceName:p.useContext(me).name},{resourceName:null}]}}},rowKey:"id"},"x-component":"BlockItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void",title:'{{ t("Add new") }}',"x-action":"create","x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:`dataSources/${e}/rolesResourcesScopes`,collection:t},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":Bf,properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":r.withDynamicSchemaProps(o=>a.jsx(r.FlagProvider,{isVariableParsedInOtherContext:!0,children:a.jsx(r.Filter,T({},o))})),"x-use-component-props":()=>{const o=p.useContext(me);return{options:r.useFilterFieldOptions(o.fields)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}}},value:{type:"array","x-component":"TableV2.Selector","x-use-component-props":"useTableSelectorProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-component":"TableV2.Column",properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{edit:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:`dataSources/${e}/rolesResourcesScopes`,collection:t,action:"get",useParams:"{{ useParamsFromRecord }}"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":r.withDynamicSchemaProps(o=>a.jsx(r.FlagProvider,{isVariableParsedInOtherContext:!0,children:a.jsx(r.Filter,T({},o))})),"x-use-component-props":()=>{const o=p.useContext(me);return{options:r.useFilterFieldOptions(o.fields)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{update:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}},destroy:{title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}},Wo=p.createContext(null);Wo.displayName="RolesResourcesScopesSelectedRowKeysContext";const Lf=e=>{const[t,o]=p.useState([]);return a.jsx(Wo.Provider,{value:[t,o],children:e.children})},qf=e=>{var i;const t=p.useMemo(()=>ge.createForm({values:{scope:e.value}}),[]),{key:o}=((i=r.useCollectionRecord())==null?void 0:i.parentRecord.data)||{},n=Vf(o);return a.jsx(r.FormProvider,{form:t,children:a.jsx(r.SchemaComponent,{components:{RolesResourcesScopesSelectedRowKeysProvider:Lf},scope:{onChange(s){var c;(c=e==null?void 0:e.onChange)==null||c.call(e,s)}},schema:n})})},Gf=e=>{var o;const t={};return(o=e==null?void 0:e.forEach)==null||o.call(e,n=>{n.name&&(t[n.name]=n,t[n.name].scope=Y.isEmpty(n.scope)?null:n.scope)}),t},me=p.createContext({});me.displayName="RoleResourceCollectionContext";const Uf=w.connect(e=>{var x,d;const{styles:t}=Kf(),o=h=>{const m=h.map(C=>K(T({},C),{scope:Y.isEmpty(C.scope)?null:C.scope}));e.onChange(m)},n=r.useRecord(),i=zo(),s=n.fields,c=r.useCompile(),{t:l}=N.useTranslation(),f=w.useField(),u=Gf(f.value||[]),g=(h,m)=>{var F;const C=u==null?void 0:u[h];return C?(F=C==null?void 0:C.fields)==null?void 0:F.includes(m):!1},y=i.filter(h=>h.allowConfigureFields),b=s==null?void 0:s.map(h=>{const m=T({},h);for(const C of y)m[C.name]=g(C.name,h.name);return m}),_=h=>{var m;u[h]?delete u[h]:u[h]={name:h,fields:(m=s==null?void 0:s.map)==null?void 0:m.call(s,C=>C.name)},o(Object.values(u))},S=(h,m)=>{u[h]?(u[h].scope=m,o(Object.values(u))):(_(h),u[h].scope=m,o(Object.values(u)))},$={};for(const h of y)$[h.name]=(s==null?void 0:s.length)===((d=(x=u==null?void 0:u[h.name])==null?void 0:x.fields)==null?void 0:d.length);return a.jsx("div",{children:a.jsx(me.Provider,{value:n,children:a.jsxs(ae.FormLayout,{layout:"vertical",children:[a.jsx(ae.FormItem,{label:l("Action permission"),children:a.jsx(v.Table,{className:t,size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:l("Action display name"),render:h=>c(h)},{dataIndex:"onNewRecord",title:l("Action type"),render:h=>h?a.jsx(v.Tag,{color:"green",children:l("Action on new records")}):a.jsx(v.Tag,{color:"geekblue",children:l("Action on existing records")})},{dataIndex:"enabled",title:l("Allow"),render:(h,m)=>a.jsx(v.Checkbox,{checked:h,onChange:()=>{_(m.name)}})},{dataIndex:"scope",title:l("Data scope"),render:(h,m)=>!m.onNewRecord&&a.jsx(qf,{value:h,onChange:C=>{S(m.name,C)}})}],dataSource:i==null?void 0:i.map(h=>{let m=!1,C=null;return u[h.name]&&(m=!0,h.onNewRecord||(C=u[h.name].scope)),K(T({},h),{enabled:m,scope:C})})})}),a.jsx(ae.FormItem,{label:l("Field permission"),children:a.jsx(v.Table,{className:t,pagination:!1,dataSource:b,columns:[{dataIndex:["uiSchema","title"],title:l("Field display name"),render:(h,m)=>c(h)||m.name},...y.map(h=>{const m=$==null?void 0:$[h.name];return{dataIndex:h.name,title:a.jsxs(a.Fragment,{children:[a.jsx(v.Checkbox,{checked:m,onChange:()=>{var F;const C=u[h.name]||{name:h.name};m?C.fields=[]:C.fields=(F=s==null?void 0:s.map)==null?void 0:F.call(s,j=>j.name),u[h.name]=C,o(Object.values(u))}}),c(h.displayName)]}),render:(C,F)=>a.jsx(v.Checkbox,{checked:C,onChange:()=>{const j=u[h.name]||{name:h.name},E=j.fields||[];if(C){const I=E.indexOf(F.name);E.splice(I,1)}else E.push(F.name);j.fields=E,u[h.name]=j,o(Object.values(u))}})}})]})})]})})})}),zf={type:"object",properties:{[B.uid()]:{"x-component":"DataSourceTable"}}},xe=p.createContext({});xe.displayName="CurrentRolesContext";const Hf=({role:e})=>a.jsx(v.Card,{"data-testid":"acl-pane-card",bordered:!1,children:a.jsx(xe.Provider,{value:e,children:a.jsx(r.SchemaComponent,{components:{MenuConfigure:r.MenuConfigure,RoleConfigure:kf,RolesResourcesActions:Uf,DataSourceTable:Mf,StrategyActions:jf,SettingsCenterConfigure:r.SettingsCenterConfigure,SettingCenterProvider:r.SettingCenterProvider,ResourceActionProvider:r.ResourceActionProvider,RoleRecordProvider:wf},schema:zf})})});class ye extends r.Plugin{constructor(){super(...arguments);Xo(this,"types",new Map)}load(){return D(this,null,function*(){this.app.addComponents({DataSourcePermissionManager:Hf}),this.app.use(an),this.app.pluginSettingsManager.add(k,{title:`{{t("Data sources", { ns: "${k}" })}}`,icon:"ClusterOutlined",showTabs:!1,aclSnippet:"pm.data-source-manager*"}),this.app.pluginSettingsManager.add(`${k}.list`,{title:`{{t("Data sources", { ns: "${k}" })}}`,Component:of,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add(`${k}/:name`,{title:a.jsx(ht,{}),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add(`${k}/main`,{title:a.jsx(ht,{}),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.pluginSettingsManager.add(`${k}/main.collections`,{title:`{{t("Collections", { ns: "${k}" })}}`,Component:Tf,topLevelName:`${k}/main`,pluginKey:k,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.pluginSettingsManager.add(`${k}/:name.collections`,{title:`{{t("Collections", { ns: "${k}" })}}`,Component:Zy,topLevelName:`${k}/:name`,pluginKey:k,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.dataSourceManager.addDataSources(this.getThirdDataSource.bind(this),yt)})}setDataSources(){return D(this,null,function*(){var n;const o=yield this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1}});return(n=o==null?void 0:o.data)==null?void 0:n.data})}getThirdDataSource(){return D(this,null,function*(){var n;const o=yield this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1,appends:["collections"]}});return(n=o==null?void 0:o.data)==null?void 0:n.data})}registerType(o,n){this.types.set(o,n)}}M.PluginDataSourceManagerClient=ye,M.default=ye,Object.defineProperties(M,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
59
+ `),Nf=(e="main")=>({name:`dataSources/${e}/rolesResourcesScopes`,fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Scope name")}}',type:"string","x-component":"Input",required:!0}}]}),Bf=()=>{const{name:e}=d.useContext(me),t=r.useFormBlockContext();return d.useEffect(()=>{t.form.setInitialValues({resourceName:e})},[e]),{form:t.form}},Vf=e=>{const t=Nf(e);return{type:"object",properties:{scope:{"x-component":"RecordPicker","x-component-props":{size:"small",fieldNames:{label:"name",value:"id"},multiple:!1,association:{target:"rolesResourcesScopes"},onChange:"{{ onChange }}"},properties:{selector:{type:"void",title:'{{ t("Select record") }}',"x-component":"RecordPicker.Selector","x-component-props":{className:"nb-record-picker-selector"},properties:{tableBlock:{type:"void","x-decorator":"TableSelectorProvider","x-decorator-props":{collection:t,resource:`dataSources/${e}/rolesResourcesScopes`,action:"list",params:{pageSize:20},useParams(){return{filter:{$or:[{resourceName:d.useContext(me).name},{resourceName:null}]}}},rowKey:"id"},"x-component":"BlockItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void",title:'{{ t("Add new") }}',"x-action":"create","x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:`dataSources/${e}/rolesResourcesScopes`,collection:t},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":Bf,properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":r.withDynamicSchemaProps(o=>a.jsx(r.FlagProvider,{isVariableParsedInOtherContext:!0,children:a.jsx(r.Filter,A({},o))})),"x-use-component-props":()=>{const o=d.useContext(me);return{options:r.useFilterFieldOptions(o.fields)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}}},value:{type:"array","x-component":"TableV2.Selector","x-use-component-props":"useTableSelectorProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-component":"TableV2.Column",properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{edit:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:`dataSources/${e}/rolesResourcesScopes`,collection:t,action:"get",useParams:"{{ useParamsFromRecord }}"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":r.withDynamicSchemaProps(o=>a.jsx(r.FlagProvider,{isVariableParsedInOtherContext:!0,children:a.jsx(r.Filter,A({},o))})),"x-use-component-props":()=>{const o=d.useContext(me);return{options:r.useFilterFieldOptions(o.fields)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{update:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}},destroy:{title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}},Wo=d.createContext(null);Wo.displayName="RolesResourcesScopesSelectedRowKeysContext";const Lf=e=>{const[t,o]=d.useState([]);return a.jsx(Wo.Provider,{value:[t,o],children:e.children})},qf=e=>{var i;const t=d.useMemo(()=>ge.createForm({values:{scope:e.value}}),[]),{key:o}=((i=r.useCollectionRecord())==null?void 0:i.parentRecord.data)||{},n=Vf(o);return a.jsx(r.FormProvider,{form:t,children:a.jsx(r.SchemaComponent,{components:{RolesResourcesScopesSelectedRowKeysProvider:Lf},scope:{onChange(s){var c;(c=e==null?void 0:e.onChange)==null||c.call(e,s)}},schema:n})})},Gf=e=>{var o;const t={};return(o=e==null?void 0:e.forEach)==null||o.call(e,n=>{n.name&&(t[n.name]=n,t[n.name].scope=Y.isEmpty(n.scope)?null:n.scope)}),t},me=d.createContext({});me.displayName="RoleResourceCollectionContext";const Uf=_.connect(e=>{var x,y;const{styles:t}=Kf(),o=h=>{const p=h.map(C=>K(A({},C),{scope:Y.isEmpty(C.scope)?null:C.scope}));e.onChange(p)},n=r.useRecord(),i=zo(),s=n.fields,c=r.useCompile(),{t:l}=N.useTranslation(),m=_.useField(),u=Gf(m.value||[]),g=(h,p)=>{var F;const C=u==null?void 0:u[h];return C?(F=C==null?void 0:C.fields)==null?void 0:F.includes(p):!1},f=i.filter(h=>h.allowConfigureFields),b=s==null?void 0:s.map(h=>{const p=A({},h);for(const C of f)p[C.name]=g(C.name,h.name);return p}),P=h=>{var p;u[h]?delete u[h]:u[h]={name:h,fields:(p=s==null?void 0:s.map)==null?void 0:p.call(s,C=>C.name)},o(Object.values(u))},T=(h,p)=>{u[h]?(u[h].scope=p,o(Object.values(u))):(P(h),u[h].scope=p,o(Object.values(u)))},$={};for(const h of f)$[h.name]=(s==null?void 0:s.length)===((y=(x=u==null?void 0:u[h.name])==null?void 0:x.fields)==null?void 0:y.length);return a.jsx("div",{children:a.jsx(me.Provider,{value:n,children:a.jsxs(ae.FormLayout,{layout:"vertical",children:[a.jsx(ae.FormItem,{label:l("Action permission"),children:a.jsx(v.Table,{className:t,size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:l("Action display name"),render:h=>c(h)},{dataIndex:"onNewRecord",title:l("Action type"),render:h=>h?a.jsx(v.Tag,{color:"green",children:l("Action on new records")}):a.jsx(v.Tag,{color:"geekblue",children:l("Action on existing records")})},{dataIndex:"enabled",title:l("Allow"),render:(h,p)=>a.jsx(v.Checkbox,{checked:h,onChange:()=>{P(p.name)}})},{dataIndex:"scope",title:l("Data scope"),render:(h,p)=>!p.onNewRecord&&a.jsx(qf,{value:h,onChange:C=>{T(p.name,C)}})}],dataSource:i==null?void 0:i.map(h=>{let p=!1,C=null;return u[h.name]&&(p=!0,h.onNewRecord||(C=u[h.name].scope)),K(A({},h),{enabled:p,scope:C})})})}),a.jsx(ae.FormItem,{label:l("Field permission"),children:a.jsx(v.Table,{className:t,pagination:!1,dataSource:b,columns:[{dataIndex:["uiSchema","title"],title:l("Field display name"),render:(h,p)=>c(h)||p.name},...f.map(h=>{const p=$==null?void 0:$[h.name];return{dataIndex:h.name,title:a.jsxs(a.Fragment,{children:[a.jsx(v.Checkbox,{checked:p,onChange:()=>{var F;const C=u[h.name]||{name:h.name};p?C.fields=[]:C.fields=(F=s==null?void 0:s.map)==null?void 0:F.call(s,E=>E.name),u[h.name]=C,o(Object.values(u))}}),c(h.displayName)]}),render:(C,F)=>a.jsx(v.Checkbox,{checked:C,onChange:()=>{const E=u[h.name]||{name:h.name},k=E.fields||[];if(C){const I=k.indexOf(F.name);k.splice(I,1)}else k.push(F.name);E.fields=k,u[h.name]=E,o(Object.values(u))}})}})]})})]})})})}),zf={type:"object",properties:{[B.uid()]:{"x-component":"DataSourceTable"}}},xe=d.createContext({});xe.displayName="CurrentRolesContext";const Hf=({role:e})=>a.jsx(v.Card,{"data-testid":"acl-pane-card",bordered:!1,children:a.jsx(xe.Provider,{value:e,children:a.jsx(r.SchemaComponent,{components:{MenuConfigure:r.MenuConfigure,RoleConfigure:kf,RolesResourcesActions:Uf,DataSourceTable:Mf,StrategyActions:jf,SettingsCenterConfigure:r.SettingsCenterConfigure,SettingCenterProvider:r.SettingCenterProvider,ResourceActionProvider:r.ResourceActionProvider,RoleRecordProvider:wf},schema:zf})})});class ye extends r.Plugin{constructor(){super(...arguments);Xo(this,"types",new Map)}load(){return D(this,null,function*(){this.app.addComponents({DataSourcePermissionManager:Hf}),this.app.use(an),this.app.pluginSettingsManager.add(j,{title:`{{t("Data sources", { ns: "${j}" })}}`,icon:"ClusterOutlined",showTabs:!1,aclSnippet:"pm.data-source-manager*"}),this.app.pluginSettingsManager.add(`${j}.list`,{title:`{{t("Data sources", { ns: "${j}" })}}`,Component:of,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add(`${j}/:name`,{title:a.jsx(ht,{}),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add(`${j}/main`,{title:a.jsx(ht,{}),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.pluginSettingsManager.add(`${j}/main.collections`,{title:`{{t("Collections", { ns: "${j}" })}}`,Component:Tf,topLevelName:`${j}/main`,pluginKey:j,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.pluginSettingsManager.add(`${j}/:name.collections`,{title:`{{t("Collections", { ns: "${j}" })}}`,Component:Zy,topLevelName:`${j}/:name`,pluginKey:j,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.dataSourceManager.addDataSources(this.getThirdDataSource.bind(this),yt)})}setDataSources(){return D(this,null,function*(){var n;const o=yield this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1}});return(n=o==null?void 0:o.data)==null?void 0:n.data})}getThirdDataSource(){return D(this,null,function*(){var n;const o=yield this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1,appends:["collections"]}});return(n=o==null?void 0:o.data)==null?void 0:n.data})}registerType(o,n){this.types.set(o,n)}}M.PluginDataSourceManagerClient=ye,M.default=ye,Object.defineProperties(M,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -8,9 +8,9 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.3.0-alpha.20240721030922",
11
+ "@nocobase/client": "1.3.0-alpha.20240806102951",
12
12
  "react": "18.2.0",
13
- "@nocobase/server": "1.3.0-alpha.20240721030922",
13
+ "@nocobase/server": "1.3.0-alpha.20240806102951",
14
14
  "lodash": "4.17.21",
15
15
  "@ant-design/icons": "5.2.6",
16
16
  "antd": "5.12.8",
@@ -19,12 +19,12 @@ module.exports = {
19
19
  "react-i18next": "11.18.6",
20
20
  "@formily/react": "2.3.0",
21
21
  "@emotion/css": "11.11.2",
22
- "@nocobase/database": "1.3.0-alpha.20240721030922",
23
- "@nocobase/utils": "1.3.0-alpha.20240721030922",
24
- "@nocobase/plugin-acl": "1.3.0-alpha.20240721030922",
25
- "@nocobase/acl": "1.3.0-alpha.20240721030922",
22
+ "@nocobase/database": "1.3.0-alpha.20240806102951",
23
+ "@nocobase/utils": "1.3.0-alpha.20240806102951",
24
+ "@nocobase/plugin-acl": "1.3.0-alpha.20240806102951",
25
+ "@nocobase/acl": "1.3.0-alpha.20240806102951",
26
26
  "sequelize": "6.35.2",
27
- "@nocobase/test": "1.3.0-alpha.20240721030922",
27
+ "@nocobase/test": "1.3.0-alpha.20240806102951",
28
28
  "@formily/antd-v5": "1.1.9",
29
29
  "@formily/core": "2.3.0",
30
30
  "@formily/reactive": "2.3.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-source-manager",
3
- "version": "1.3.0-alpha.20240721030922",
3
+ "version": "1.3.0-alpha.20240806102951",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Data source manager",
6
6
  "displayName.zh-CN": "数据源管理",
@@ -16,5 +16,5 @@
16
16
  "keywords": [
17
17
  "Data model tools"
18
18
  ],
19
- "gitHead": "c4e4f6af1bed25628a54aa3eda316d95f6201f9e"
19
+ "gitHead": "98877ddf0bc92a6904d2d4b8a4e2f46074ff83cc"
20
20
  }