@nocobase/plugin-action-duplicate 2.1.0-beta.32 → 2.1.0-beta.33

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/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -12,3 +12,4 @@ export declare class PluginActionDuplicateClient extends Plugin {
12
12
  }
13
13
  export default PluginActionDuplicateClient;
14
14
  export * from './DuplicateAction';
15
+ export { DuplicateActionModel } from '../client-v2/DuplicateActionModel';
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-action-duplicate",["react-i18next","@emotion/css","@formily/core","react","antd","@nocobase/client","@formily/react","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-action-duplicate"]=t(require("react-i18next"),require("@emotion/css"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-action-duplicate"]=t(e["react-i18next"],e["@emotion/css"],e["@formily/core"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,i,o,l,a,c){return function(){"use strict";var s={477:function(e){e.exports=t},452:function(e){e.exports=n},230:function(e){e.exports=l},342:function(e){e.exports=o},694:function(e){e.exports=a},59:function(e){e.exports=i},773:function(e){e.exports=c},155:function(e){e.exports=r},953:function(t){t.exports=e}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return s[e](n,n.exports,d),n.exports}d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.g.importScripts&&(p=d.g.location+"");var p,h=d.g.document;if(!p&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(p=h.currentScript.src),!p)){var f=h.getElementsByTagName("script");if(f.length)for(var m=f.length-1;m>-1&&(!p||!/^http(s?):/.test(p));)p=f[m--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");d.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-action-duplicate/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",i=r.indexOf("/v2/");e=i>=0?r.slice(0,i+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-action-duplicate/dist/client/"}d.p=e}(),!function(){d.r(y),d.d(y,{PluginActionDuplicateClient:function(){return e_},default:function(){return eT},DuplicateAction:function(){return x},actionDesignerCss:function(){return w}});var e=d(342),t=d(477),n=d(230),r=d(59),i=d(773),o=d.n(i),l=d(155),a=d.n(l),c=d(953);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n,r,i,o,l){try{var a=e[o](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,i)}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){p(e,t,n[t])})}return e}function f(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function m(e,t){if(null==e)return{};var n,r,i,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(i=0,n=Reflect.ownKeys(Object(e));i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw r}}return o}}(e,t)||g(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function g(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}function S(){var e=v(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n '&.nb-in-template': {\n background: 'var(--colorTemplateBgSettingsHover)';\n }\n ,\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n"]);return S=function(){return e},e}function O(){var e=v(["\n .general-schema-designer {\n top: -10px;\n bottom: -10px;\n left: -10px;\n right: -10px;\n }\n "]);return O=function(){return e},e}var w=(0,t.css)(S()),x=a().forwardRef(function(i,d){var y,v,S,x,k=i.onlyIcon,D=m(i,["onlyIcon"]),A=i.children,j=i.icon,P=i.title,E=m(i,["children","icon","title"]),C=r.App.useApp().message,F=(0,n.useField)(),_=(0,n.useFieldSchema)(),T=(0,e.useAPIClient)(),M=F.disabled||i.disabled,I=(0,e.useDesignable)().designable,R=b((0,l.useState)(!1),2),z=R[0],q=R[1],L=b((0,l.useState)(!1),2),K=L[0],B=L[1],W=b((0,l.useState)(!1),2),$=W[0],U=W[1],G=(0,e.useBlockRequestContext)(),V=G.service,N=G.__parent,H=G.block,X=G.resource,J=_["x-component-props"],Q=J.duplicateFields,Y=J.duplicateMode,Z=void 0===Y?"quickDulicate":Y,ee=J.duplicateCollection,et=(0,e.useRecord)(),en=(0,e.useCollectionParentRecordData)(),er=(0,e.useCollection)(),ei=et.id,eo=et.__collection,el=(0,e.useActionContext)(),ea=(0,e.useCollection_deprecated)().name,ec=(0,e.useCollectionManager_deprecated)().getCollectionFields,es=(0,c.useTranslation)().t,eu=ec(eo||ea),ed=(0,e.useFormBlockContext)(),ep=(0,e.useACLActionParamsContext)(),eh=(0,e.useDataSourceKey)(),ef=(0,e.useDataSourceHeaders)(eh),em={key:"duplicate",dataId:Array.isArray(er.filterTargetKey)?(v=Object).assign.apply(v,[{}].concat(function(e){if(Array.isArray(e))return s(e)}(y=er.filterTargetKey.map(function(e){return p({},e,et[e])}))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(y)||g(y)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())):et[er.filterTargetKey]||ei,default:!0,fields:(null==Q?void 0:Q.filter(function(e){return eu.find(function(t){return e.includes(t.name)})}))||[],collection:eo||ea},ey="Action.Link"===_["x-component"],eb=function(){var t;return(t=function(){var t,n,r,i,o;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var s=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:B(!0),l.label=1;case 1:return l.trys.push([1,7,,8]),[4,(0,e.fetchTemplateData)(T,em,ef)];case 2:return t=l.sent(),[4,X.create({values:h({},t)})];case 3:if(l.sent(),C.success(es("Saved successfully")),"form"!==H)return[3,4];return null==N||null==(r=N.service)||null==(n=r.refresh)||n.call(r),[3,6];case 4:return[4,null==V||null==(i=V.refresh)?void 0:i.call(V)];case 5:l.sent(),l.label=6;case 6:return B(!1),[3,8];case 7:return o=l.sent(),B(!1),console.error(o),[3,8];case 8:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function l(e){u(o,r,i,l,a,"next",e)}function a(e){u(o,r,i,l,a,"throw",e)}l(void 0)})})()},ev=function(){M||K||!ep||((null==Q?void 0:Q.length)>0?"quickDulicate"===Z?eb():q(!0):C.error(es("Please configure the duplicate fields")))};return a().createElement("div",{ref:d,className:(0,t.cx)(w,p({},(0,t.css)(O()),ey))},a().createElement(e.FormBlockContext.Provider,{value:f(h({},ed),{duplicateData:{display:!1,enabled:!0,defaultTemplate:em}})},a().createElement("div",null,ey?a().createElement("a",{className:"nb-action-link",role:i.role,"aria-label":i["aria-label"],disabled:M,style:f(h({},E.style),{opacity:I&&(null==F||null==(S=F.data)?void 0:S.hidden)&&.1,cursor:K?"not-allowed":"pointer",position:"relative"}),onClick:ev},a().createElement(r.Tooltip,{title:P},a().createElement("span",{style:{marginRight:3}},j&&"string"==typeof j?a().createElement(e.Icon,{type:j}):j)),k?A[1]:K?es("Duplicating"):A||es("Duplicate")):a().createElement(r.Button,f(h({role:i.role,"aria-label":i["aria-label"],disabled:M,style:{opacity:I&&(null==F||null==(x=F.data)?void 0:x.hidden)&&.1}},D),{onClick:ev}),K?es("Duplicating"):A||es("Duplicate")),a().createElement(e.TabsContextProvider,null,a().createElement(e.CollectionProvider_deprecated,{name:ee||ea},a().createElement(e.RecordProvider,{record:f(h({},en),{__collection:ee||eo})},a().createElement(e.ActionContextProvider,{value:f(h({},el),{visible:z,setVisible:q,formValueChanged:$,setFormValueChanged:U})},a().createElement(e.PopupSettingsProvider,{enableURL:!1},a().createElement(e.RefreshComponentProvider,{refresh:o().noop},a().createElement(e.NocoBaseRecursionField,{schema:_,basePath:F.address,onlyRenderProperties:!0}))))))))))}),k=d(452);function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function A(e,t,n,r,i,o,l){try{var a=e[o](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,i)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(e){A(o,r,i,l,a,"next",e)}function a(e){A(o,r,i,l,a,"throw",e)}l(void 0)})}}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){P(e,t,n[t])})}return e}function C(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function F(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var s=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var _=(0,n.connect)(r.Tree,(0,n.mapProps)(function(e,t){(0,l.useEffect)(function(){t.value=e.defaultCheckedKeys||[]},[]);var r,i=function(e){if(Array.isArray(e))return e}(r=(0,l.useState)(e.defaultCheckedKeys||[]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(i.push(t.value),2!==i.length);o=!0);}catch(e){l=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw n}}return i}}(r)||function(e){if(e){if("string"==typeof e)return D(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return D(e,2)}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=i[0],a=i[1],c=function(e){a(e),t.value=e};t.onCheck=c;var s=(0,n.useForm)();return C(E({},e),{checkedKeys:o,onCheck:c,treeData:null==e?void 0:e.treeData.map(function(e){if("quickDulicate"===s.values.duplicateMode){var t,n=null==e||null==(t=e.children)?void 0:t.map(function(e){return C(E({},e),{disabled:!1})});return C(E({},e),{disabled:!1,children:n})}return e})})})),T=function(e,t){for(var n=0;n<(null==e?void 0:e.length);n++){var r=e[n],i=r.children,o=function(e,t){if(null==e)return{};var n,r,i,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(i=0,n=Reflect.ownKeys(Object(e));i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(r,["children"]);t.push(o.key),i&&T(i,t)}return t},M=function(e){return e.reduceProperties(function(e,t){return"FormBlockProvider"===t["x-decorator"]?t:M(t)},null)},I=[{name:"Customize",Component:function(e){return e.children},children:[{name:"editButton",Component:e.ActionDesigner.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){var t=(0,e.useCollection_deprecated)().name;return C(E({},(0,e.useSchemaToolbar)().linkageRulesProps),{collectionName:t})}},{name:"duplicationMode",Component:function(){var t,r,o,s,u=(0,e.useDesignable)().dn,d=(0,c.useTranslation)().t,p=(0,n.useField)(),h=(0,n.useFieldSchema)(),f=(0,e.useCollection_deprecated)().name,m=(0,e.useCollectionState)(f),y=m.collectionList,b=m.getEnableFieldTree,v=m.getOnLoadData,g=m.getOnCheck,S=(0,i.cloneDeep)((null==(t=h["x-component-props"])?void 0:t.duplicateFields)||[]),O=(0,e.useRecord)(),w=(0,l.useCallback)(function(e,t,n){n.query("duplicateFields").take(function(r){r.componentProps.treeData=e,r.componentProps.defaultCheckedKeys=t,r.setInitialValue(t),null==r||r.onCheck(t),n.setValues(C(E({},n.values),{treeData:e}))})},[]);return a().createElement(e.SchemaSettingsModalItem,{title:d("Duplicate mode"),components:{Tree:_},scope:{getEnableFieldTree:b,collectionName:(null==(r=h["x-component-props"])?void 0:r.duplicateCollection)||(null==O?void 0:O.__collection)||f,currentCollection:(null==O?void 0:O.__collection)||f,getOnLoadData:v,getOnCheck:g,treeData:null==(o=h["x-component-props"])?void 0:o.treeData,duplicateValues:S,onFieldInputValueChange:k.onFieldInputValueChange},schema:{type:"object",title:d("Duplicate mode"),properties:{duplicateMode:{"x-decorator":"FormItem","x-component":"Radio.Group",title:d("Duplicate mode"),default:(null==(s=h["x-component-props"])?void 0:s.duplicateMode)||"quickDulicate",enum:[{value:"quickDulicate",label:'{{t("Direct duplicate")}}'},{value:"continueduplicate",label:'{{t("Copy into the form and continue to fill in")}}'}]},collection:{type:"string",title:'{{ t("Target collection") }}',required:!0,description:d("If collection inherits, choose inherited collections as templates"),default:"{{ collectionName }}","x-display":y.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:y},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{disabled:'{{ $deps[0]==="quickDulicate" }}',value:'{{ $deps[0]==="quickDulicate"? currentCollection:collectionName }}'}}}]},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":"Action.Link","x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200},useAction:function(){var t,n=(0,l.useMemo)(function(){return M(h)},[h]);return(0,e.useSyncFromForm)(n,(null==(t=h["x-component-props"])?void 0:t.duplicateCollection)||(null==O?void 0:O.__collection)||f,w)}},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]!=="quickDulicate" }}'}}}]},selectAll:{type:"void",title:'{{ t("Select all") }}',"x-component":"Action.Link","x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]==="quickDulicate"}}'}}}],"x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200},useAction:function(){var e;return e=(0,n.useForm)(),{run:function(){return j(function(){return F(this,function(t){return e.query("duplicateFields").take(function(e){var t,n=T(e.componentProps.treeData,[]);e.componentProps.defaultCheckedKeys=n,e.setInitialValue(n),null==e||null==(t=e.onCheck)||t.call(e,n)}),[2]})})()}}}}},unselectAll:{type:"void",title:'{{ t("UnSelect all") }}',"x-component":"Action.Link","x-reactions":[{dependencies:[".duplicateMode",".duplicateFields"],fulfill:{state:{visible:"{{ $deps[0]===\"quickDulicate\"&&$form.getValuesIn('duplicateFields').length>0 }}"}}}],"x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200,marginRight:"10px"},useAction:function(){var e;return e=(0,n.useForm)(),{run:function(){return j(function(){return F(this,function(t){return e.query("duplicateFields").take(function(e){e.componentProps.defaultCheckedKeys=[],e.setInitialValue([]),null==e||e.onCheck([])}),[2]})})()}}}}},duplicateFields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:d("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":_,"x-component-props":{defaultCheckedKeys:S,treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:"{{ getOnLoadData($self) }}",onCheck:"{{ getOnCheck($self) }}",rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection",".duplicateMode"],fulfill:{state:{disabled:"{{ !$deps[0] }}",componentProps:{treeData:"{{ getEnableFieldTree($deps[0], $self,treeData) }}"}}}}]}}},onSubmit:function(e){var t,n,r=e.duplicateMode,i=e.collection,o=e.duplicateFields,l=e.treeData,a=Array.isArray(o)?o:o.checked||[];p.componentProps.duplicateMode=r,p.componentProps.duplicateFields=a,h["x-component-props"]=h["x-component-props"]||{},h["x-component-props"].duplicateMode=r,h["x-component-props"].duplicateFields=a,h["x-component-props"].duplicateCollection=i,h["x-component-props"].treeData=l||(null==(t=p.componentProps)?void 0:t.treeData),u.emit("patch",{schema:(P(n={},"x-uid",h["x-uid"]),P(n,"x-component-props",E({},h["x-component-props"])),n)}),u.refresh()}})},useVisible:function(){return"duplicate"===(0,n.useFieldSchema)()["x-action"]}},{name:"openMode",Component:e.SchemaSettingOpenModeSchemaItems,useComponentProps:function(){var t=(0,e.useOpenModeContext)().hideOpenMode,n=(0,c.useTranslation)().t;return{openMode:!t,openSize:!t,modeOptions:(0,l.useMemo)(function(){return[{label:n("Drawer"),value:"drawer"},{label:n("Dialog"),value:"modal"}]},[n])}}},{name:"remove",sort:100,Component:e.ActionDesigner.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]}],R=new e.SchemaSettings({name:"ActionSettings:duplicate",items:I}),z=new e.SchemaSettings({name:"actionSettings:duplicate",items:I}),q=function(t){return a().createElement(e.ACLActionProvider,null,t.children)},L=function(t){var n,r,i={type:"void","x-action":"duplicate","x-acl-action":"create",title:'{{ t("Duplicate") }}',"x-component":"Action.Link","x-decorator":"DuplicateActionDecorator","x-component-props":{openMode:(0,e.useOpenModeContext)().defaultOpenMode,component:"DuplicateAction"},properties:{drawer:{type:"void",title:'{{ t("Duplicate") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Duplicate")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:addNew:addBlock",properties:{}}}}}}}}}};return a().createElement(e.ActionInitializerItem,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},t),r=r={schema:i},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}),n))},K=function(t){return a().createElement(e.SchemaComponentOptions,{components:{DuplicateActionInitializer:L,DuplicateAction:x}},t.children)},B=d(694),W={hasSubscribers:!1},$="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,U=new Set,G="object"==typeof process&&process?process:{},V=(Symbol("type"),e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e)),N=e=>V(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=0x100000000?Uint32Array:e<=Number.MAX_SAFE_INTEGER?H:null:null,H=class extends Array{constructor(e){super(e),this.fill(0)}},X=class e{heap;length;static #e=!1;static create(t){let n=N(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},J=class e{#e;#t;#n;#r;#i;#o;#l;#a;get perf(){return this.#a}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#s;#u;#d;#p;#h;#f;#m;#y;#b;#v;#g;#S;#O;#w;#x;#k;#D;#A;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#O,autopurgeTimers:e.#w,sizes:e.#g,keyMap:e.#u,keyList:e.#d,valList:e.#p,next:e.#h,prev:e.#f,get head(){return e.#m},get tail(){return e.#y},free:e.#b,isBackgroundFetch:t=>e.#j(t),backgroundFetch:(t,n,r,i)=>e.#P(t,n,r,i),moveToTail:t=>e.#E(t),indexes:t=>e.#C(t),rindexes:t=>e.#F(t),isStale:t=>e.#_(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#s}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#l}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:l,updateAgeOnHas:a,allowStale:c,dispose:s,onInsert:u,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:h,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:y,fetchMethod:b,memoMethod:v,noDeleteOnFetchRejection:g,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:w,ignoreFetchAbort:x,perf:k}=t;if(void 0!==k&&"function"!=typeof k?.now)throw TypeError("perf option must have a now() method if specified");if(this.#a=k??$,0!==n&&!V(n))throw TypeError("max option must be a nonnegative integer");let D=n?N(n):Array;if(!D)throw Error("invalid max value: "+n);if(this.#e=n,this.#t=f,this.maxEntrySize=m||this.#t,this.sizeCalculation=y,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==v&&"function"!=typeof v)throw TypeError("memoMethod must be a function if defined");if(this.#l=v,void 0!==b&&"function"!=typeof b)throw TypeError("fetchMethod must be a function if specified");if(this.#o=b,this.#k=!!b,this.#u=new Map,this.#d=Array.from({length:n}).fill(void 0),this.#p=Array.from({length:n}).fill(void 0),this.#h=new D(n),this.#f=new D(n),this.#m=0,this.#y=0,this.#b=X.create(n),this.#c=0,this.#s=0,"function"==typeof s&&(this.#n=s),"function"==typeof u&&(this.#r=u),"function"==typeof d?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#x=!!this.#n,this.#A=!!this.#r,this.#D=!!this.#i,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!g,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!x,0!==this.maxEntrySize){if(0!==this.#t&&!V(this.#t))throw TypeError("maxSize must be a positive integer if specified");if(!V(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!a,this.ttlResolution=V(i)||0===i?i:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!V(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#M()}if(0===this.#e&&0===this.ttl&&0===this.#t)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t="LRU_CACHE_UNBOUNDED";(e=>!U.has(e))(t)&&(U.add(t),((e,t,n,r)=>{"function"==typeof G.emitWarning?G.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)})("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#M(){let e=new H(this.#e),t=new H(this.#e);this.#O=e,this.#S=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#w=n,this.#I=(n,i,o=this.#a.now())=>{t[n]=0!==i?o:0,e[n]=i,r(n,i)},this.#R=n=>{t[n]=0!==e[n]?this.#a.now():0,r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&0!==t&&n){let r=setTimeout(()=>{this.#_(e)&&this.#z(this.#d[e],"expire")},t+1);r.unref&&r.unref(),n[e]=r}}:()=>{};this.#q=(n,r)=>{if(e[r]){let l=e[r],a=t[r];if(!l||!a)return;n.ttl=l,n.start=a,n.now=i||o();let c=n.now-a;n.remainingTTL=l-c}};let i=0,o=()=>{let e=this.#a.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{let r=this.#u.get(n);if(void 0===r)return 0;let l=e[r],a=t[r];return l&&a?l-((i||o())-a):1/0},this.#_=n=>{let r=t[n],l=e[n];return!!l&&!!r&&(i||o())-r>l}}#R=()=>{};#q=()=>{};#I=()=>{};#_=()=>!1;#T(){let e=new H(this.#e);this.#s=0,this.#g=e,this.#L=t=>{this.#s-=e[t],e[t]=0},this.#K=(e,t,n,r)=>{if(this.#j(t))return 0;if(!V(n))if(r){if("function"!=typeof r)throw TypeError("sizeCalculation must be a function");if(!V(n=r(t,e)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#B=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#s>n;)this.#W(!0)}this.#s+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#s)}}#L=e=>{};#B=(e,t,n)=>{};#K=(e,t,n,r)=>{if(n||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#y;this.#$(t)&&((e||!this.#_(t))&&(yield t),t!==this.#m);)t=this.#f[t]}*#F({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#m;this.#$(t)&&((e||!this.#_(t))&&(yield t),t!==this.#y);)t=this.#h[t]}#$(e){return void 0!==e&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#C())void 0===this.#p[e]||void 0===this.#d[e]||this.#j(this.#p[e])||(yield[this.#d[e],this.#p[e]])}*rentries(){for(let e of this.#F())void 0===this.#p[e]||void 0===this.#d[e]||this.#j(this.#p[e])||(yield[this.#d[e],this.#p[e]])}*keys(){for(let e of this.#C()){let t=this.#d[e];void 0===t||this.#j(this.#p[e])||(yield t)}}*rkeys(){for(let e of this.#F()){let t=this.#d[e];void 0===t||this.#j(this.#p[e])||(yield t)}}*values(){for(let e of this.#C())void 0===this.#p[e]||this.#j(this.#p[e])||(yield this.#p[e])}*rvalues(){for(let e of this.#F())void 0===this.#p[e]||this.#j(this.#p[e])||(yield this.#p[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#C()){let r=this.#p[n],i=this.#j(r)?r.__staleWhileFetching:r;if(void 0!==i&&e(i,this.#d[n],this))return this.#U(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#C()){let r=this.#p[n],i=this.#j(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#F()){let r=this.#p[n],i=this.#j(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#F({allowStale:!0}))this.#_(t)&&(this.#z(this.#d[t],"expire"),e=!0);return e}info(e){let t=this.#u.get(e);if(void 0===t)return;let n=this.#p[t],r=this.#j(n)?n.__staleWhileFetching:n;if(void 0===r)return;let i={value:r};if(this.#O&&this.#S){let e=this.#O[t],n=this.#S[t];e&&n&&(i.ttl=e-(this.#a.now()-n),i.start=Date.now())}return this.#g&&(i.size=this.#g[t]),i}dump(){let e=[];for(let t of this.#C({allowStale:!0})){let n=this.#d[t],r=this.#p[t],i=this.#j(r)?r.__staleWhileFetching:r;if(void 0===i||void 0===n)continue;let o={value:i};if(this.#O&&this.#S){o.ttl=this.#O[t];let e=this.#a.now()-this.#S[t];o.start=Math.floor(Date.now()-e)}this.#g&&(o.size=this.#g[t]),e.unshift([n,o])}return e}load(e){for(let[t,n]of(this.clear(),e)){if(n.start){let e=Date.now()-n.start;n.start=this.#a.now()-e}this.#G(t,n.value,n)}}set(e,t,n={}){let{status:r=W.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op="set",r.key=e,void 0!==t&&(r.value=t));let i=this.#G(e,t,n);return r&&W.hasSubscribers&&W.publish(r),i}#G(e,t,n={}){let{ttl:r=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:a}=n;if(void 0===t)return a&&(a.set="deleted"),this.delete(e),this;let{noUpdateTTL:c=this.noUpdateTTL}=n;a&&!this.#j(t)&&(a.value=t);let s=this.#K(e,t,n.size||0,l,a);if(this.maxEntrySize&&s>this.maxEntrySize)return this.#z(e,"set"),a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this;let u=0===this.#c?void 0:this.#u.get(e);if(void 0===u)u=0===this.#c?this.#y:0!==this.#b.length?this.#b.pop():this.#c===this.#e?this.#W(!1):this.#c,this.#d[u]=e,this.#p[u]=t,this.#u.set(e,u),this.#h[this.#y]=u,this.#f[u]=this.#y,this.#y=u,this.#c++,this.#B(u,s,a),a&&(a.set="add"),c=!1,this.#A&&this.#r?.(t,e,"add");else{this.#E(u);let n=this.#p[u];if(t!==n){if(this.#k&&this.#j(n)){n.__abortController.abort(Error("replaced"));let{__staleWhileFetching:t}=n;void 0!==t&&!o&&(this.#x&&this.#n?.(t,e,"set"),this.#D&&this.#v?.push([t,e,"set"]))}else o||(this.#x&&this.#n?.(n,e,"set"),this.#D&&this.#v?.push([n,e,"set"]));if(this.#L(u),this.#B(u,s,a),this.#p[u]=t,a){a.set="replace";let e=n&&this.#j(n)?n.__staleWhileFetching:n;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#A&&this.onInsert?.(t,e,t===n?"update":"replace")}if(0===r||this.#O||this.#M(),this.#O&&(c||this.#I(u,r,i),a&&this.#q(a,u)),!o&&this.#D&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#p[this.#m];if(this.#W(!0),this.#j(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#D&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#W(e){let t=this.#m,n=this.#d[t],r=this.#p[t];return this.#k&&this.#j(r)?r.__abortController.abort(Error("evicted")):(this.#x||this.#D)&&(this.#x&&this.#n?.(r,n,"evict"),this.#D&&this.#v?.push([r,n,"evict"])),this.#L(t),this.#w?.[t]&&(clearTimeout(this.#w[t]),this.#w[t]=void 0),e&&(this.#d[t]=void 0,this.#p[t]=void 0,this.#b.push(t)),1===this.#c?(this.#m=this.#y=0,this.#b.length=0):this.#m=this.#h[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=W.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="has",n.key=e);let r=this.#V(e,t);return W.hasSubscribers&&W.publish(n),r}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(void 0!==i){let e=this.#p[i];if(this.#j(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#_(i))return n&&this.#R(i),r&&(r.has="hit",this.#q(r,i)),!0;r&&(r.has="stale",this.#q(r,i))}else r&&(r.has="miss");return!1}peek(e,t={}){let{status:n=W.hasSubscribers||W.hasSubscribers?{}:void 0}=t;n&&(n.op="peek",n.key=e),t.status=n;let r=this.#N(e,t);return W.hasSubscribers&&W.publish(n),r}#N(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(void 0===i||!r&&this.#_(i)){n&&(n.peek=void 0===i?"miss":"stale");return}let o=this.#p[i],l=this.#j(o)?o.__staleWhileFetching:o;return n&&(void 0!==l?(n.peek="hit",n.value=l):n.peek="miss"),l}#P(e,t,n,r){let i=void 0===t?void 0:this.#p[t];if(this.#j(i))return i;let o=new AbortController,{signal:l}=n;l?.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let a={signal:o.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:l}=o.signal,c=n.ignoreFetchAbort&&void 0!==r,u=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&void 0!==r);if(n.status&&(l&&!i?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),l&&!c&&!i)return s(o.signal.reason,u);let p=this.#p[t];return(p===d||void 0===p&&c&&i)&&(void 0===r?void 0!==d.__staleWhileFetching?this.#p[t]=d.__staleWhileFetching:this.#z(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#G(e,r,a.options))),r},s=(r,i)=>{let{aborted:l}=o.signal,a=l&&n.allowStaleOnFetchAbort,c=a||n.allowStaleOnFetchRejection,s=c||n.noDeleteOnFetchRejection;if(this.#p[t]===d&&(s&&(i||void 0!==d.__staleWhileFetching)?a||(this.#p[t]=d.__staleWhileFetching):this.#z(e,"fetch")),c)return n.status&&void 0!==d.__staleWhileFetching&&(n.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw r},u=(t,r)=>{let l=this.#o?.(e,i,a);l&&l instanceof Promise&&l.then(e=>t(void 0===e?void 0:e),r),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let d=new Promise(u).then(c,e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),s(e,!1))),p=Object.assign(d,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.#G(e,p,{...a.options,status:void 0}),t=this.#u.get(e)):this.#p[t]=p,p}#j(e){return!!this.#k&&!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(e,t={}){let n=W.hasSubscribers,{status:r=W.hasSubscribers||W.hasSubscribers?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#H(e,t);return r&&(W.hasSubscribers||W.hasSubscribers)&&n&&(r.trace=!0,W.tracePromise(()=>i,r).catch(()=>{})),i}async #H(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:s=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:f,forceRefresh:m=!1,status:y,signal:b}=t;if(y&&(y.op="fetch",y.key=e,m&&(y.forceRefresh=!0)),!this.#k)return y&&(y.fetch="get"),this.#U(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:y});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:l,size:a,sizeCalculation:c,noUpdateTTL:s,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:h,ignoreFetchAbort:p,status:y,signal:b},g=this.#u.get(e);if(void 0===g){y&&(y.fetch="miss");let t=this.#P(e,g,v,f);return t.__returned=t}{let t=this.#p[g];if(this.#j(t)){let e=n&&void 0!==t.__staleWhileFetching;return y&&(y.fetch="inflight",e&&(y.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#_(g);if(!m&&!i)return y&&(y.fetch="hit"),this.#E(g),r&&this.#R(g),y&&this.#q(y,g),t;let o=this.#P(e,g,v,f),l=void 0!==o.__staleWhileFetching&&n;return y&&(y.fetch=i?"stale":"refresh",l&&i&&(y.returnedStale=!0)),l?o.__staleWhileFetching:o.__returned=o}}forceFetch(e,t={}){let n=W.hasSubscribers,{status:r=W.hasSubscribers||W.hasSubscribers?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#X(e,t);return r&&(W.hasSubscribers||W.hasSubscribers)&&n&&(r.trace=!0,W.tracePromise(()=>i,r).catch(()=>{})),i}async #X(e,t={}){let n=await this.#H(e,t);if(void 0===n)throw Error("fetch() returned undefined");return n}memo(e,t={}){let{status:n=W.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="memo",n.key=e,t.context&&(n.context=t.context));let r=this.#J(e,t);return n&&(n.value=r),W.hasSubscribers&&W.publish(n),r}#J(e,t={}){let n=this.#l;if(!n)throw Error("no memoMethod provided to constructor");let{context:r,status:i,forceRefresh:o,...l}=t;i&&o&&(i.forceRefresh=!0);let a=this.#U(e,l),c=o||void 0===a;if(i&&(i.memo=c?"miss":"hit",c||(i.value=a)),!c)return a;let s=n(e,a,{options:l,context:r});return i&&(i.value=s),this.#G(e,s,l),s}get(e,t={}){let{status:n=W.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="get",n.key=e);let r=this.#U(e,t);return n&&(void 0!==r&&(n.value=r),W.hasSubscribers&&W.publish(n)),r}#U(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=t,l=this.#u.get(e);if(void 0===l){o&&(o.get="miss");return}let a=this.#p[l],c=this.#j(a);return o&&this.#q(o,l),this.#_(l)?c?(o&&(o.get="stale-fetching"),n&&void 0!==a.__staleWhileFetching?(o&&(o.returnedStale=!0),a.__staleWhileFetching):void 0):(i||this.#z(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),a):void 0):(o&&(o.get=c?"fetching":"hit"),this.#E(l),r&&this.#R(l),c?a.__staleWhileFetching:a)}#Q(e,t){this.#f[t]=e,this.#h[e]=t}#E(e){e!==this.#y&&(e===this.#m?this.#m=this.#h[e]:this.#Q(this.#f[e],this.#h[e]),this.#Q(this.#y,e),this.#y=e)}delete(e){return this.#z(e,"delete")}#z(e,t){W.hasSubscribers&&W.publish({op:"delete",delete:t,key:e});let n=!1;if(0!==this.#c){let r=this.#u.get(e);if(void 0!==r)if(this.#w?.[r]&&(clearTimeout(this.#w?.[r]),this.#w[r]=void 0),n=!0,1===this.#c)this.#Y(t);else{this.#L(r);let n=this.#p[r];if(this.#j(n)?n.__abortController.abort(Error("deleted")):(this.#x||this.#D)&&(this.#x&&this.#n?.(n,e,t),this.#D&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#p[r]=void 0,r===this.#y)this.#y=this.#f[r];else if(r===this.#m)this.#m=this.#h[r];else{let e=this.#f[r];this.#h[e]=this.#h[r];let t=this.#h[r];this.#f[t]=this.#f[r]}this.#c--,this.#b.push(r)}}if(this.#D&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#Y("delete")}#Y(e){for(let t of this.#F({allowStale:!0})){let n=this.#p[t];if(this.#j(n))n.__abortController.abort(Error("deleted"));else{let r=this.#d[t];this.#x&&this.#n?.(n,r,e),this.#D&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#p.fill(void 0),this.#d.fill(void 0),this.#O&&this.#S){for(let e of(this.#O.fill(0),this.#S.fill(0),this.#w??[]))void 0!==e&&clearTimeout(e);this.#w?.fill(void 0)}if(this.#g&&this.#g.fill(0),this.#m=0,this.#y=0,this.#b.length=0,this.#s=0,this.#c=0,this.#D&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}};function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Y(e,t,n,r,i,o,l){try{var a=e[o](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,i)}function Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function ee(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function et(e){return function(e){if(Array.isArray(e))return Q(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return Q(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Q(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var en=function(e){var t=e.tag,n=e.type,i=e.displayType;return a().createElement("div",null,a().createElement(r.Tag,{color:{reference:"blue",duplicate:"green",preloading:"cyan"}[n]},a().createElement("span",null,t)," ",void 0===i||i?"(".concat({reference:"Reference",duplicate:"Duplicate",preloading:"Preloading"}[n],")"):""))},er=["sort","createdById","createdBy","createdAt","updatedById","updatedBy","updatedAt","password","sequence"];function ei(e){var t=e.node,n=e.traverseAssociations,r=e.traverseFields,i=e.systemKeys,o=e.dataSource,l=e.setDataSource,a=function(e,t){for(var n=et(e);n.length;){var r=n.shift();if(r.key===t.key)return r;r.children&&n.push.apply(n,et(r.children))}}(o,t),c=[];return["belongsTo","belongsToMany"].includes(t.field.type)&&(null==t?void 0:t.type)==="reference"?c=n(t.field.target,{exclude:i,prefix:t.key,maxDepth:1}):(["hasOne","hasMany"].includes(t.field.type)||(null==t?void 0:t.type)==="duplicate")&&(c=r(t.field.target,{exclude:["id"].concat(et(i.filter(function(e){return"sort"!==e}))),prefix:t.key,maxDepth:1})),c.length?a.children=c:a.isLeaf=!0,l(et(o)),c}var eo=function(e,t,n){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=function(o,l){var c=l.exclude,s=void 0===c?[]:c,u=l.depth,d=void 0===u?0:u,p=l.maxDepth,h=l.prefix,f=void 0===h?"":h;return d>p?[]:et(e.getCollection(n,o).fields.values()).map(function(e){if(!s.includes(e.name)&&e.interface&&!(0===d&&["sort","password","sequence"].includes(e.type))){var n,o={type:"duplicate",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},l=ee(Z({},o),{role:"button",title:a().createElement(en,ee(Z({},o),{displayType:!0})),key:f?"".concat(f,".").concat(e.name):e.name,isLeaf:!0,field:e});return["belongsTo","belongsToMany"].includes(e.type)?(o.type="reference",l.type="reference",l.title=a().createElement(en,ee(Z({},o),{type:"reference",displayType:!0})),l.isLeaf=!1,l.children=i(e.target,{depth:d+1,maxDepth:p,prefix:l.key,exclude:er})):["hasOne","hasMany"].includes(e.type)&&(l.isLeaf=!1,l.children=r(e.target,{depth:d+1,maxDepth:p,prefix:l.key,exclude:["id"].concat(et(er.filter(function(e){return"sort"!==e})))})),l}}).filter(Boolean)},i=function(r,o){var l,c=o.prefix,s=o.maxDepth,u=o.depth,d=void 0===u?0:u,p=o.exclude,h=void 0===p?[]:p;return d>s||!e.getCollection(n,r)?[]:et(null==(l=e.getCollection(n,r))?void 0:l.fields.values()).map(function(e){if(e.target&&e.interface&&!h.includes(e.name)){var n,r={type:"preloading",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},o=c?"".concat(c,".").concat(e.name):e.name;return{role:"button",title:a().createElement(en,ee(Z({},r),{displayType:!0})),key:o,isLeaf:!1,field:e,children:i(e.target,{prefix:o,depth:d+1,maxDepth:s,exclude:h})}}}).filter(Boolean)};return{getEnableFieldTree:function(e){try{return r(e,{exclude:["id"].concat(et(er)),maxDepth:1})}catch(e){return console.error(e),[]}},getOnLoadData:function(e,t){return function(n){return new Promise(function(o){if(n.children.length)return n.children.forEach(function(n){ei({node:n,traverseAssociations:i,traverseFields:r,systemKeys:er,dataSource:e,setDataSource:t})}),o(void 0);ei({node:n,traverseAssociations:i,traverseFields:r,systemKeys:er,dataSource:e,setDataSource:t}),o(void 0)})}},getOnCheck:function(e){return function(t){e.value=t}}}},el=function(e,t,n,r,i){var o,l=(new J({max:100}),function(r,i,o){var s=i.exclude,u=void 0===s?[]:s,d=i.depth,p=void 0===d?0:d,h=i.maxDepth,f=i.prefix,m=void 0===f?"":f,y=i.disabled,b=void 0!==y&&y;return p>h?[]:(e.getCollection(n,r)?et(e.getCollection(n,r).fields.values()):[]).map(function(e){if(!u.includes(e.name)&&e.interface&&!["sort","password","sequence"].includes(e.type)){var n,r={type:"duplicate",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},i=ee(Z({},r),{title:a().createElement(en,r),key:m?"".concat(m,".").concat(e.name):e.name,isLeaf:!0,field:e,disabled:b}),s=o.find(function(e){return e.name===i.key});if(!["belongsTo","belongsToMany"].includes(e.type)||s&&(null==s?void 0:s.updateAssociation)){if(["hasOne","hasMany"].includes(e.type)||(null==s?void 0:s.updateAssociation)){var d=!1;!["hasOne","hasMany"].includes(e.type)||(null==s?void 0:s.updateAssociation)||(d=!0),i.disabled=!0,i.isLeaf=!1,i.children=l(e.target,{depth:p+1,maxDepth:h,prefix:i.key,exclude:["id"].concat(et(er)),disabled:d},o)}}else r.type="reference",i.type="reference",i.title=a().createElement(en,ee(Z({},r),{type:"reference"})),i.isLeaf=!1,i.children=c(e.target,{depth:p+1,maxDepth:h,prefix:i.key,exclude:er});return i}}).filter(Boolean)}),c=(o=new J({max:100}),function(r,i){var l=i.prefix,s=i.maxDepth,u=i.depth,d=void 0===u?0:u,p=i.exclude,h=void 0===p?[]:p,f="".concat(r,"-").concat(h.join(","),"-").concat(d,"-").concat(s,"-").concat(l),m=o.get(f);if(m)return m;if(d>s)return[];var y=(e.getCollection(n,r)?et(e.getCollection(n,r).fields.values()):[]).map(function(e){if(e.target&&e.interface&&!h.includes(e.name)){var n,r,i={type:"preloading",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},o=l?"".concat(l,".").concat(e.name):e.name;return{type:"preloading",tag:t(null==(r=e.uiSchema)?void 0:r.title)||e.name,title:a().createElement(en,i),key:o,isLeaf:!1,field:e,children:c(e.target,{prefix:o,depth:d+1,maxDepth:s,exclude:h})}}}).filter(Boolean);return o.set(f,y),y}),s=function(e,t){if(!e)return[];try{return l(e,{exclude:["id"].concat(et(er)),maxDepth:1,disabled:!1},t)}catch(e){return console.error(e),[]}};return{run:function(e){var t;return(t=function(){var t,n,o,l;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var s=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(a){return t=new Set([]),n=new Set([]),(o=function(e,r){e.mapSubModels(r,function(e){var r,i,l;e.collectionField&&!(["hasOne","hasMany"].includes(e.collectionField.type)||(null==(r=e.subModels.field)?void 0:r.updateAssociation))&&n.add(e.fieldPath),e.collectionField&&e.collectionField.isAssociationField()&&(t.add({name:e.fieldPath,updateAssociation:null==(i=e.subModels.field)?void 0:i.updateAssociation}),(null==(l=e.subModels.field)?void 0:l.updateAssociation)&&(e.subModels.field.subModels.grid?o(e.subModels.field.subModels.grid,"items"):e.subModels.field.subModels.subTableColumns?o(e.subModels.field,"subTableColumns"):e.subModels.field.subModels.columns&&o(e.subModels.field,"columns")))})})(e,"items"),l=s(r,et(t)),i&&i(l,et(n)),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function l(e){Y(o,r,i,l,a,"next",e)}function a(e){Y(o,r,i,l,a,"throw",e)}l(void 0)})})()}}},ea="action-duplicate";function ec(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function es(e,t,n,r,i,o,l){try{var a=e[o](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,i)}function eu(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(e){es(o,r,i,l,a,"next",e)}function a(e){es(o,r,i,l,a,"throw",e)}l(void 0)})}}function ed(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ep(e){return(ep=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ed(e,t,n[t])})}return e}function ef(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function em(e,t){return(em=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ey(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw r}}return o}}(e,t)||ev(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eb(e){return function(e){if(Array.isArray(e))return ec(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ev(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ev(e,t){if(e){if("string"==typeof e)return ec(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ec(e,t)}}function eg(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eg=function(){return!!e})()}function eS(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var s=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var eO=(0,n.connect)(r.Tree,(0,n.mapProps)(function(e,t){var r=e.loadData;(0,l.useEffect)(function(){t.value=e.defaultCheckedKeys||[]},[]);var i=ey((0,l.useState)((null==e?void 0:e.treeData)||[]),2),o=i[0],a=i[1],c=ey((0,l.useState)(e.defaultCheckedKeys||[]),2),s=c[0],u=c[1],d=function(e){u(e),t.value=e};t.onCheck=d;var p=(0,n.useForm)();return(0,l.useEffect)(function(){var n=e.getEnableFieldTree(p.values.collection);a(n),t.dataSource=n},[p.values.collection]),(0,l.useEffect)(function(){a(t.dataSource)},[t.dataSource]),ef(eh({},e),{checkedKeys:s,onCheck:d,loadData:r(o,a),treeData:o.map(function(e){if("quickDulicate"===p.values.duplicateMode){var t,n=null==e||null==(t=e.children)?void 0:t.map(function(e){return ef(eh({},e),{disabled:!1})});return ef(eh({},e),{disabled:!1,children:n})}return e})})}));function ew(t){var n=t.options,r=(0,B.useFlowViewContext)(),i=(0,e.useRequest)(function(){return eu(function(){return eS(this,function(e){switch(e.label){case 0:return[4,r.engine.loadOrCreateModel(n,{delegateToParent:!1,delegate:r})];case 1:return[2,e.sent()]}})})()},{refreshDeps:[r,n]}),o=i.data;return!i.loading&&(null==o?void 0:o.uid)?a().createElement(B.FlowModelRenderer,{model:o,fallback:a().createElement(e.SkeletonFallback,{style:{margin:16}})}):a().createElement(e.SkeletonFallback,{style:{margin:16}})}function ex(e){var t=e.model,n=(0,B.useFlowContext)(),r=n.view,i=r.Header,o=r.type;t._closeView=n.view.close;var l=n.t("Duplicate record");return a().createElement("div",null,a().createElement(i,{title:"dialog"===o?a().createElement("div",{style:{padding:"".concat(n.themeToken.paddingLG,"px ").concat(n.themeToken.paddingLG,"px 0"),marginBottom:-n.themeToken.marginSM,backgroundColor:"var(--colorBgLayout)"}},l):l}),a().createElement(ew,{options:{parentId:n.view.inputArgs.parentId,subKey:"deplicate.edit-form-grid-block",async:!0,delegateToParent:!1,subType:"object",use:"BlockGridModel"}}))}var ek=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=ep(t),ed(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eg()?Reflect.construct(t,r||[],ep(this).constructor):t.apply(this,r)),"duplicateLoading",!1),ed(e,"defaultProps",{type:"link",title:(0,B.tExpr)("Duplicate"),duplicateFields:[]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&em(n,e),t=[{key:"getAclActionName",value:function(){return"create"}},{key:"onClick",value:function(e){"quickDulicate"===this.props.duplicateMode?this.dispatchEvent("quickCreateClick",eh({event:e},this.getInputArgs()),{debounce:!0}):this.dispatchEvent("openDuplicatePopup",eh({event:e},this.getInputArgs()),{debounce:!0})}},{key:"getTitle",value:function(){return this.duplicateLoading?this.context.t("Duplicating"):this.props.title||this.context.t("Duplicate")}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(e.ActionModel);function eD(e,t){return eu(function(){var n,r;return eS(this,function(i){switch(i.label){case 0:if(!(null==t?void 0:t.dataId)||(null==(n=t.fields)?void 0:n.length)===0)return[2];return[4,e.runAction("get",{params:{filterByTk:t.dataId,fields:t.fields,isTemplate:!0}})];case 1:return[2,null==(r=i.sent())?void 0:r.data]}})})()}function eA(e,t,n,r,i,o,l){try{var a=e[o](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,i)}function ej(e,t,n){return(ej=eF()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&eE(i,n.prototype),i}).apply(null,arguments)}ed(ek,"scene",e.ActionSceneEnum.record),ek.define({label:(0,B.tExpr)("Duplicate"),sort:60}),ek.registerFlow({key:"duplicateModeSettings",steps:{duplicateMode:{title:(0,B.tExpr)("Duplicate mode",{ns:ea}),uiSchema:function(e){var t,r,o,l=e.t,c=(e.dataSourceManager.getDataSource("main").collectionManager.getAllCollectionsInheritChain(e.blockModel.collection.name)||[]).map(function(t){var n;return{label:null==(n=e.dataSourceManager.getDataSource("main").collectionManager.getCollection(t))?void 0:n.title,value:t}}),s=(0,i.cloneDeep)((null==(t=e.model.props)?void 0:t.duplicateFields)||[]),u=function(e,t){for(var n=0;n<(null==e?void 0:e.length);n++){var r=e[n],i=r.children,o=function(e,t){if(null==e)return{};var n,r,i,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(i=0,n=Reflect.ownKeys(Object(e));i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(r,["children"]);t.push(o.key),i&&u(i,t)}return t},d=eo(e.dataSourceManager,l,e.blockModel.collection.dataSourceKey),p=d.getEnableFieldTree,h=d.getOnLoadData,f=d.getOnCheck;return e.model.flowEngine.flowSettings.registerScopes({collectionName:(null==(r=e.record)?void 0:r.__collection)||e.blockModel.collection.name,currentCollection:(null==(o=e.record)?void 0:o.__collection)||e.blockModel.collection.name,getOnLoadData:h,getOnCheck:f,treeData:[],duplicateValues:s,onFieldInputValueChange:k.onFieldInputValueChange}),{duplicateMode:{"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{value:"quickDulicate",label:'{{t("Direct duplicate")}}'},{value:"continueduplicate",label:'{{t("Copy into the form and continue to fill in")}}'}]},collection:{type:"string",title:'{{ t("Target collection") }}',required:!0,description:l("If collection inherits, choose inherited collections as templates"),"x-display":c.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:c},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{disabled:'{{ $deps[0]==="quickDulicate" }}',value:'{{ $deps[0]==="quickDulicate"? currentCollection:collectionName }}'}}},function(t){if("quickDulicate"===t.form.values.duplicateMode){var n;t.form.setValuesIn("collection",(null==(n=e.record)?void 0:n.__collection)||e.blockModel.collection.name)}}]},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":function(){var t,r,i,o,c=null==(r=(i=e.model).getStepParams)||null==(t=r.call(i,"popupSettings","openView"))?void 0:t.uid,s=(0,n.useForm)(),u=el(e.dataSourceManager,e.t,e.blockModel.collection.dataSourceKey,(null==(o=e.record)?void 0:o.__collection)||e.blockModel.collection.name,function(t,n){s.query("duplicateFields").take(function(r){r.dataSource=t,r.componentProps.defaultCheckedKeys=n,r.setInitialValue(n),null==r||r.onCheck(n),e.message.success(l("Sync successfully"))})}).run;return a().createElement("a",{onClick:function(){return eu(function(){var t,n,r;return eS(this,function(i){switch(i.label){case 0:if(!c)return[3,3];return[4,e.engine.loadModel({parentId:c,refresh:!0})];case 1:return t=i.sent(),[4,e.engine.loadModel({parentId:t.subModels.tabs[0].uid})];case 2:if(!(n=i.sent()))return[2];return u(n.subModels.items[0].subModels.grid),[3,5];case 3:return[4,e.engine.loadModel({parentId:e.model.uid,refresh:!0})];case 4:if(!(r=i.sent()))return[2];u(r.subModels.items[0].subModels.grid),i.label=5;case 5:return[2]}})})()},style:{float:"right",position:"relative",zIndex:1200}},l("Sync from form fields"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]!=="quickDulicate" }}'}}}]},selectAll:{type:"void",title:'{{ t("Select all") }}',"x-component":function(){var e=(0,n.useForm)();return a().createElement("a",{onClick:function(){e.query("duplicateFields").take(function(e){var t,n=u(e.dataSource,[]);e.componentProps.defaultCheckedKeys=n,e.setInitialValue(n),null==e||null==(t=e.onCheck)||t.call(e,n)})},style:{float:"right",position:"relative",zIndex:1200}},l("Select all"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]==="quickDulicate"}}'}}}]},unselectAll:{type:"void",title:'{{ t("UnSelect all") }}',"x-component":function(){var e=(0,n.useForm)();return a().createElement("a",{style:{float:"right",position:"relative",zIndex:1200,marginRight:"10px"},onClick:function(){e.query("duplicateFields").take(function(e){e.componentProps.defaultCheckedKeys=[],e.setInitialValue([]),null==e||e.onCheck([])})}},l("UnSelect all"))},"x-reactions":[{dependencies:[".duplicateMode",".duplicateFields"],fulfill:{state:{visible:"{{ $deps[0]===\"quickDulicate\"&&$form.getValuesIn('duplicateFields').length>0 }}"}}}]},duplicateFields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:l("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":eO,"x-component-props":{defaultCheckedKeys:s,treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:h,onCheck:"{{ getOnCheck($self) }}",getEnableFieldTree:p,rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection"],fulfill:{state:{disabled:"{{ !$deps[0] }}"}}}]}}},defaultParams:function(e){var t;return{duplicateMode:"quickDulicate",collection:(null==(t=e.record)?void 0:t.__collection)||e.blockModel.collection.name}},handler:function(e,t){return eu(function(){var n,r,i,o,l;return eS(this,function(a){return n=t.duplicateMode,r=t.duplicateFields,i=t.collection,o=t.treeData,l=Array.isArray(r)?r:(null==r?void 0:r.checked)||[],e.model.setProps({duplicateMode:n,duplicateFields:l,duplicateCollection:i,treeData:o}),[2]})})()}}}}),ek.registerFlow({key:"duplicateSettings",title:(0,B.tExpr)("Duplicate mode settings"),on:"quickCreateClick",steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,n,r;return"quickDulicate"!==(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,B.tExpr)("Duplicate record"),content:(0,B.tExpr)("Are you sure you want to duplicate it?")}},duplicate:{handler:function(e,t){return eu(function(){var n,r,i,o,l,a,c,s;return eS(this,function(u){switch(u.label){case 0:if(!(null==(i=void 0===(r=e.model.props.duplicateFields)?[]:r)?void 0:i.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:ea})),[2];if(e.model.duplicateLoading)return[2];return e.model.duplicateLoading=!0,e.model.rerender(),o=e.blockModel.collection.filterTargetKey,l={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(n=Object).assign.apply(n,[{}].concat(eb(o.map(function(t){return ed({},t,e.record[t])})))):e.record[o]||e.record.id,default:!0,fields:(null==i?void 0:i.filter(function(t){return eb(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},a=e.createResource(B.MultiRecordResource),c=e.blockModel.collection.dataSourceKey,a.setDataSourceKey(c),a.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,eD(a,l)];case 1:return s=u.sent(),[4,e.blockModel.resource.create(eh({},s),t.requestConfig)];case 2:return u.sent(),e.message.success(e.t("Saved successfully")),e.model.duplicateLoading=!1,e.model.rerender(),[2]}})})()}}}}),ek.registerFlow({key:"popupSettings",on:{eventName:"openDuplicatePopup"},sort:300,steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,n,r;return"quickDulicate"===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,B.tExpr)("Duplicate record"),content:(0,B.tExpr)("Are you sure you want to duplicate it?")}},openView:{title:(0,B.tExpr)("Edit popup"),hideInSettings:function(e){var t,n,r;return"quickDulicate"===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},use:"openView",defaultParams:{mode:"drawer",size:"medium"},handler:function(e,t){return eu(function(){var n,r,i,o,l,c,s,u,d,p,h,f,m,y,b,v,g,S,O,w;return eS(this,function(x){switch(x.label){case 0:return[4,e.model.dispatchEvent("beforeRender")];case 1:if(x.sent(),!(null==(l=void 0===(o=e.model.props.duplicateFields)?[]:o)?void 0:l.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:ea})),[2];return c={drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}},s=(null==(r=e.inputArgs)?void 0:r.mode)||(null==t?void 0:t.mode)||"drawer",u=(null==(i=e.inputArgs)?void 0:i.size)||(null==t?void 0:t.size)||"medium",d=e.blockModel.collection.filterTargetKey,p={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(n=Object).assign.apply(n,[{}].concat(eb(d.map(function(t){return ed({},t,e.record[t])})))):e.record[d]||e.record.id,default:!0,fields:(null==l?void 0:l.filter(function(t){return eb(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},h=e.createResource(B.MultiRecordResource),f=e.blockModel.collection.dataSourceKey,h.setDataSourceKey(f),h.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,eD(h,p)];case 2:if(m=x.sent(),y="string"==typeof(null==t?void 0:t.popupTemplateUid)?t.popupTemplateUid.trim():"",b="string"==typeof(null==t?void 0:t.uid)?t.uid.trim():"",v=!!y||!!b&&b!==e.model.uid,g=(null==t?void 0:t.viewUid)||e.blockModel.uid,S=(null==t?void 0:t.dataSourceKey)||e.blockModel.collection.dataSourceKey,O=(null==t?void 0:t.collectionName)||e.record.__collection||e.blockModel.collection.name,!v)return[3,4];return w=ef(eh({},t||{}),{navigation:!1,scene:"new",formData:m,viewUid:g,dataSourceKey:S,collectionName:O}),b&&(w.uid=b),[4,e.runAction("openView",w)];case 3:return x.sent(),[2];case 4:return e.viewer.open({type:s,width:c[s][u],inheritContext:!1,target:e.layoutContentElement,inputArgs:{parentId:e.model.uid,scene:"new",dataSourceKey:S,collectionName:O,formData:m,viewUid:g},content:function(){return a().createElement(ex,{model:e.model})},styles:{content:eh({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===s?{position:"absolute",top:0,left:0,right:0,bottom:0}:{}),body:{padding:0}}}),[2]}})})()}}}});function eP(e){return(eP=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eE(e,t){return(eE=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eC(e){var t="function"==typeof Map?new Map:void 0;return(eC=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return ej(e,arguments,eP(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),eE(n,e)})(e)}function eF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eF=function(){return!!e})()}var e_=function(t){var n;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=eP(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eF()?Reflect.construct(e,t||[],eP(this).constructor):e.apply(this,t))}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&eE(r,t),n=[{key:"load",value:function(){var t;return(t=function(){var t;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var s=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(n){return this.app.use(K),this.app.addComponents({DuplicateActionInitializer:L,DuplicateAction:x,DuplicateActionDecorator:q}),this.app.schemaSettingsManager.add(R),this.app.schemaSettingsManager.add(z),t={title:'{{t("Duplicate")}}',Component:"DuplicateActionInitializer",schema:{"x-component":"Action.Link","x-action":"duplicate","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:duplicate","x-decorator":"DuplicateActionDecorator","x-component-props":{type:"primary"}},useVisible:function(){return(0,e.useActionAvailable)("create")}},this.app.schemaInitializerManager.addItem("table:configureItemActions","actions.duplicate",t),this.app.flowEngine.registerModels({DuplicateActionModel:ek}),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function l(e){eA(o,r,i,l,a,"next",e)}function a(e){eA(o,r,i,l,a,"throw",e)}l(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,n),r}(eC(e.Plugin)),eT=e_}(),y}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("react-i18next"),require("@emotion/css"),require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-action-duplicate",["ahooks","react-i18next","@emotion/css","@nocobase/client-v2","@formily/core","react","antd","@nocobase/client","@formily/react","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-action-duplicate"]=t(require("ahooks"),require("react-i18next"),require("@emotion/css"),require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-action-duplicate"]=t(e.ahooks,e["react-i18next"],e["@emotion/css"],e["@nocobase/client-v2"],e["@formily/core"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,i,o,l,a,s,c,u){return function(){"use strict";var d={477:function(e){e.exports=n},452:function(e){e.exports=i},230:function(e){e.exports=s},342:function(e){e.exports=a},485:function(e){e.exports=r},694:function(e){e.exports=c},625:function(t){t.exports=e},59:function(e){e.exports=l},773:function(e){e.exports=u},155:function(e){e.exports=o},953:function(e){e.exports=t}},p={};function h(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return d[e](n,n.exports,h),n.exports}h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.g.importScripts&&(f=h.g.location+"");var f,m=h.g.document;if(!f&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(f=m.currentScript.src),!f)){var y=m.getElementsByTagName("script");if(y.length)for(var b=y.length-1;b>-1&&(!f||!/^http(s?):/.test(f));)f=y[b--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");h.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var v={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-action-duplicate/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",i=r.indexOf("/v2/");e=i>=0?r.slice(0,i+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-action-duplicate/dist/client/"}h.p=e}(),!function(){h.r(v),h.d(v,{DuplicateActionModel:function(){return eA},PluginActionDuplicateClient:function(){return eT},default:function(){return eI},DuplicateAction:function(){return x},actionDesignerCss:function(){return w}});var e=h(342),t=h(477),n=h(230),r=h(59),i=h(773),o=h.n(i),l=h(155),a=h.n(l),s=h(953);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){d(e,t,n[t])})}return e}function f(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function m(e,t){if(null==e)return{};var n,r,i,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(i=0,n=Reflect.ownKeys(Object(e));i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw r}}return o}}(e,t)||g(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function g(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}function S(){var e=b(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n '&.nb-in-template': {\n background: 'var(--colorTemplateBgSettingsHover)';\n }\n ,\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n"]);return S=function(){return e},e}function O(){var e=b(["\n .general-schema-designer {\n top: -10px;\n bottom: -10px;\n left: -10px;\n right: -10px;\n }\n "]);return O=function(){return e},e}var w=(0,t.css)(S()),x=a().forwardRef(function(i,h){var b,v,S,x,k=i.onlyIcon,D=m(i,["onlyIcon"]),A=i.children,j=i.icon,P=i.title,E=m(i,["children","icon","title"]),C=r.App.useApp().message,F=(0,n.useField)(),_=(0,n.useFieldSchema)(),M=(0,e.useAPIClient)(),T=F.disabled||i.disabled,I=(0,e.useDesignable)().designable,R=y((0,l.useState)(!1),2),z=R[0],q=R[1],L=y((0,l.useState)(!1),2),K=L[0],B=L[1],W=y((0,l.useState)(!1),2),$=W[0],G=W[1],U=(0,e.useBlockRequestContext)(),N=U.service,V=U.__parent,H=U.block,J=U.resource,X=_["x-component-props"],Q=X.duplicateFields,Y=X.duplicateMode,Z=void 0===Y?"quickDulicate":Y,ee=X.duplicateCollection,et=(0,e.useRecord)(),en=(0,e.useCollectionParentRecordData)(),er=(0,e.useCollection)(),ei=et.id,eo=et.__collection,el=(0,e.useActionContext)(),ea=(0,e.useCollection_deprecated)().name,es=(0,e.useCollectionManager_deprecated)().getCollectionFields,ec=(0,s.useTranslation)().t,eu=es(eo||ea),ed=(0,e.useFormBlockContext)(),ep=(0,e.useACLActionParamsContext)(),eh=(0,e.useDataSourceKey)(),ef=(0,e.useDataSourceHeaders)(eh),em={key:"duplicate",dataId:Array.isArray(er.filterTargetKey)?(v=Object).assign.apply(v,[{}].concat(function(e){if(Array.isArray(e))return c(e)}(b=er.filterTargetKey.map(function(e){return d({},e,et[e])}))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(b)||g(b)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())):et[er.filterTargetKey]||ei,default:!0,fields:(null==Q?void 0:Q.filter(function(e){return eu.find(function(t){return e.includes(t.name)})}))||[],collection:eo||ea},ey="Action.Link"===_["x-component"],eb=function(){var t;return(t=function(){var t,n,r,i,o;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:B(!0),l.label=1;case 1:return l.trys.push([1,7,,8]),[4,(0,e.fetchTemplateData)(M,em,ef)];case 2:return t=l.sent(),[4,J.create({values:p({},t)})];case 3:if(l.sent(),C.success(ec("Saved successfully")),"form"!==H)return[3,4];return null==V||null==(r=V.service)||null==(n=r.refresh)||n.call(r),[3,6];case 4:return[4,null==N||null==(i=N.refresh)?void 0:i.call(N)];case 5:l.sent(),l.label=6;case 6:return B(!1),[3,8];case 7:return o=l.sent(),B(!1),console.error(o),[3,8];case 8:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function l(e){u(o,r,i,l,a,"next",e)}function a(e){u(o,r,i,l,a,"throw",e)}l(void 0)})})()},ev=function(){T||K||!ep||((null==Q?void 0:Q.length)>0?"quickDulicate"===Z?eb():q(!0):C.error(ec("Please configure the duplicate fields")))};return a().createElement("div",{ref:h,className:(0,t.cx)(w,d({},(0,t.css)(O()),ey))},a().createElement(e.FormBlockContext.Provider,{value:f(p({},ed),{duplicateData:{display:!1,enabled:!0,defaultTemplate:em}})},a().createElement("div",null,ey?a().createElement("a",{className:"nb-action-link",role:i.role,"aria-label":i["aria-label"],disabled:T,style:f(p({},E.style),{opacity:I&&(null==F||null==(S=F.data)?void 0:S.hidden)&&.1,cursor:K?"not-allowed":"pointer",position:"relative"}),onClick:ev},a().createElement(r.Tooltip,{title:P},a().createElement("span",{style:{marginRight:3}},j&&"string"==typeof j?a().createElement(e.Icon,{type:j}):j)),k?A[1]:K?ec("Duplicating"):A||ec("Duplicate")):a().createElement(r.Button,f(p({role:i.role,"aria-label":i["aria-label"],disabled:T,style:{opacity:I&&(null==F||null==(x=F.data)?void 0:x.hidden)&&.1}},D),{onClick:ev}),K?ec("Duplicating"):A||ec("Duplicate")),a().createElement(e.TabsContextProvider,null,a().createElement(e.CollectionProvider_deprecated,{name:ee||ea},a().createElement(e.RecordProvider,{record:f(p({},en),{__collection:ee||eo})},a().createElement(e.ActionContextProvider,{value:f(p({},el),{visible:z,setVisible:q,formValueChanged:$,setFormValueChanged:G})},a().createElement(e.PopupSettingsProvider,{enableURL:!1},a().createElement(e.RefreshComponentProvider,{refresh:o().noop},a().createElement(e.NocoBaseRecursionField,{schema:_,basePath:F.address,onlyRenderProperties:!0}))))))))))}),k=h(452);function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function A(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(e){A(o,r,i,l,a,"next",e)}function a(e){A(o,r,i,l,a,"throw",e)}l(void 0)})}}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){P(e,t,n[t])})}return e}function C(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function F(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var _=(0,n.connect)(r.Tree,(0,n.mapProps)(function(e,t){(0,l.useEffect)(function(){t.value=e.defaultCheckedKeys||[]},[]);var r,i=function(e){if(Array.isArray(e))return e}(r=(0,l.useState)(e.defaultCheckedKeys||[]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(i.push(t.value),2!==i.length);o=!0);}catch(e){l=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw n}}return i}}(r)||function(e){if(e){if("string"==typeof e)return D(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return D(e,2)}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=i[0],a=i[1],s=function(e){a(e),t.value=e};t.onCheck=s;var c=(0,n.useForm)();return C(E({},e),{checkedKeys:o,onCheck:s,treeData:null==e?void 0:e.treeData.map(function(e){if("quickDulicate"===c.values.duplicateMode){var t,n=null==e||null==(t=e.children)?void 0:t.map(function(e){return C(E({},e),{disabled:!1})});return C(E({},e),{disabled:!1,children:n})}return e})})})),M=function(e,t){for(var n=0;n<(null==e?void 0:e.length);n++){var r=e[n],i=r.children,o=function(e,t){if(null==e)return{};var n,r,i,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(i=0,n=Reflect.ownKeys(Object(e));i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(r,["children"]);t.push(o.key),i&&M(i,t)}return t},T=function(e){return e.reduceProperties(function(e,t){return"FormBlockProvider"===t["x-decorator"]?t:T(t)},null)},I=[{name:"Customize",Component:function(e){return e.children},children:[{name:"editButton",Component:e.ActionDesigner.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){var t=(0,e.useCollection_deprecated)().name;return C(E({},(0,e.useSchemaToolbar)().linkageRulesProps),{collectionName:t})}},{name:"duplicationMode",Component:function(){var t,r,o,c,u=(0,e.useDesignable)().dn,d=(0,s.useTranslation)().t,p=(0,n.useField)(),h=(0,n.useFieldSchema)(),f=(0,e.useCollection_deprecated)().name,m=(0,e.useCollectionState)(f),y=m.collectionList,b=m.getEnableFieldTree,v=m.getOnLoadData,g=m.getOnCheck,S=(0,i.cloneDeep)((null==(t=h["x-component-props"])?void 0:t.duplicateFields)||[]),O=(0,e.useRecord)(),w=(0,l.useCallback)(function(e,t,n){n.query("duplicateFields").take(function(r){r.componentProps.treeData=e,r.componentProps.defaultCheckedKeys=t,r.setInitialValue(t),null==r||r.onCheck(t),n.setValues(C(E({},n.values),{treeData:e}))})},[]);return a().createElement(e.SchemaSettingsModalItem,{title:d("Duplicate mode"),components:{Tree:_},scope:{getEnableFieldTree:b,collectionName:(null==(r=h["x-component-props"])?void 0:r.duplicateCollection)||(null==O?void 0:O.__collection)||f,currentCollection:(null==O?void 0:O.__collection)||f,getOnLoadData:v,getOnCheck:g,treeData:null==(o=h["x-component-props"])?void 0:o.treeData,duplicateValues:S,onFieldInputValueChange:k.onFieldInputValueChange},schema:{type:"object",title:d("Duplicate mode"),properties:{duplicateMode:{"x-decorator":"FormItem","x-component":"Radio.Group",title:d("Duplicate mode"),default:(null==(c=h["x-component-props"])?void 0:c.duplicateMode)||"quickDulicate",enum:[{value:"quickDulicate",label:'{{t("Direct duplicate")}}'},{value:"continueduplicate",label:'{{t("Copy into the form and continue to fill in")}}'}]},collection:{type:"string",title:'{{ t("Target collection") }}',required:!0,description:d("If collection inherits, choose inherited collections as templates"),default:"{{ collectionName }}","x-display":y.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:y},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{disabled:'{{ $deps[0]==="quickDulicate" }}',value:'{{ $deps[0]==="quickDulicate"? currentCollection:collectionName }}'}}}]},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":"Action.Link","x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200},useAction:function(){var t,n=(0,l.useMemo)(function(){return T(h)},[h]);return(0,e.useSyncFromForm)(n,(null==(t=h["x-component-props"])?void 0:t.duplicateCollection)||(null==O?void 0:O.__collection)||f,w)}},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]!=="quickDulicate" }}'}}}]},selectAll:{type:"void",title:'{{ t("Select all") }}',"x-component":"Action.Link","x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]==="quickDulicate"}}'}}}],"x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200},useAction:function(){var e;return e=(0,n.useForm)(),{run:function(){return j(function(){return F(this,function(t){return e.query("duplicateFields").take(function(e){var t,n=M(e.componentProps.treeData,[]);e.componentProps.defaultCheckedKeys=n,e.setInitialValue(n),null==e||null==(t=e.onCheck)||t.call(e,n)}),[2]})})()}}}}},unselectAll:{type:"void",title:'{{ t("UnSelect all") }}',"x-component":"Action.Link","x-reactions":[{dependencies:[".duplicateMode",".duplicateFields"],fulfill:{state:{visible:"{{ $deps[0]===\"quickDulicate\"&&$form.getValuesIn('duplicateFields').length>0 }}"}}}],"x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200,marginRight:"10px"},useAction:function(){var e;return e=(0,n.useForm)(),{run:function(){return j(function(){return F(this,function(t){return e.query("duplicateFields").take(function(e){e.componentProps.defaultCheckedKeys=[],e.setInitialValue([]),null==e||e.onCheck([])}),[2]})})()}}}}},duplicateFields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:d("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":_,"x-component-props":{defaultCheckedKeys:S,treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:"{{ getOnLoadData($self) }}",onCheck:"{{ getOnCheck($self) }}",rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection",".duplicateMode"],fulfill:{state:{disabled:"{{ !$deps[0] }}",componentProps:{treeData:"{{ getEnableFieldTree($deps[0], $self,treeData) }}"}}}}]}}},onSubmit:function(e){var t,n,r=e.duplicateMode,i=e.collection,o=e.duplicateFields,l=e.treeData,a=Array.isArray(o)?o:o.checked||[];p.componentProps.duplicateMode=r,p.componentProps.duplicateFields=a,h["x-component-props"]=h["x-component-props"]||{},h["x-component-props"].duplicateMode=r,h["x-component-props"].duplicateFields=a,h["x-component-props"].duplicateCollection=i,h["x-component-props"].treeData=l||(null==(t=p.componentProps)?void 0:t.treeData),u.emit("patch",{schema:(P(n={},"x-uid",h["x-uid"]),P(n,"x-component-props",E({},h["x-component-props"])),n)}),u.refresh()}})},useVisible:function(){return"duplicate"===(0,n.useFieldSchema)()["x-action"]}},{name:"openMode",Component:e.SchemaSettingOpenModeSchemaItems,useComponentProps:function(){var t=(0,e.useOpenModeContext)().hideOpenMode,n=(0,s.useTranslation)().t;return{openMode:!t,openSize:!t,modeOptions:(0,l.useMemo)(function(){return[{label:n("Drawer"),value:"drawer"},{label:n("Dialog"),value:"modal"}]},[n])}}},{name:"remove",sort:100,Component:e.ActionDesigner.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]}],R=new e.SchemaSettings({name:"ActionSettings:duplicate",items:I}),z=new e.SchemaSettings({name:"actionSettings:duplicate",items:I}),q=function(t){return a().createElement(e.ACLActionProvider,null,t.children)},L=function(t){var n,r,i={type:"void","x-action":"duplicate","x-acl-action":"create",title:'{{ t("Duplicate") }}',"x-component":"Action.Link","x-decorator":"DuplicateActionDecorator","x-component-props":{openMode:(0,e.useOpenModeContext)().defaultOpenMode,component:"DuplicateAction"},properties:{drawer:{type:"void",title:'{{ t("Duplicate") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Duplicate")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:addNew:addBlock",properties:{}}}}}}}}}};return a().createElement(e.ActionInitializerItem,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},t),r=r={schema:i},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}),n))},K=function(t){return a().createElement(e.SchemaComponentOptions,{components:{DuplicateActionInitializer:L,DuplicateAction:x}},t.children)},B=h(694),W=h(485),$=h(625),G="action-duplicate",U={hasSubscribers:!1},N="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,V=new Set,H="object"==typeof process&&process?process:{},J=(Symbol("type"),e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e)),X=e=>J(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=0x100000000?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Q:null:null,Q=class extends Array{constructor(e){super(e),this.fill(0)}},Y=class e{heap;length;static #e=!1;static create(t){let n=X(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Z=class e{#e;#t;#n;#r;#i;#o;#l;#a;get perf(){return this.#a}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#c;#u;#d;#p;#h;#f;#m;#y;#b;#v;#g;#S;#O;#w;#x;#k;#D;#A;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#O,autopurgeTimers:e.#w,sizes:e.#g,keyMap:e.#u,keyList:e.#d,valList:e.#p,next:e.#h,prev:e.#f,get head(){return e.#m},get tail(){return e.#y},free:e.#b,isBackgroundFetch:t=>e.#j(t),backgroundFetch:(t,n,r,i)=>e.#P(t,n,r,i),moveToTail:t=>e.#E(t),indexes:t=>e.#C(t),rindexes:t=>e.#F(t),isStale:t=>e.#_(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#c}get size(){return this.#s}get fetchMethod(){return this.#o}get memoMethod(){return this.#l}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:l,updateAgeOnHas:a,allowStale:s,dispose:c,onInsert:u,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:h,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:y,fetchMethod:b,memoMethod:v,noDeleteOnFetchRejection:g,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:w,ignoreFetchAbort:x,perf:k}=t;if(void 0!==k&&"function"!=typeof k?.now)throw TypeError("perf option must have a now() method if specified");if(this.#a=k??N,0!==n&&!J(n))throw TypeError("max option must be a nonnegative integer");let D=n?X(n):Array;if(!D)throw Error("invalid max value: "+n);if(this.#e=n,this.#t=f,this.maxEntrySize=m||this.#t,this.sizeCalculation=y,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==v&&"function"!=typeof v)throw TypeError("memoMethod must be a function if defined");if(this.#l=v,void 0!==b&&"function"!=typeof b)throw TypeError("fetchMethod must be a function if specified");if(this.#o=b,this.#k=!!b,this.#u=new Map,this.#d=Array.from({length:n}).fill(void 0),this.#p=Array.from({length:n}).fill(void 0),this.#h=new D(n),this.#f=new D(n),this.#m=0,this.#y=0,this.#b=Y.create(n),this.#s=0,this.#c=0,"function"==typeof c&&(this.#n=c),"function"==typeof u&&(this.#r=u),"function"==typeof d?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#x=!!this.#n,this.#A=!!this.#r,this.#D=!!this.#i,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!g,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!x,0!==this.maxEntrySize){if(0!==this.#t&&!J(this.#t))throw TypeError("maxSize must be a positive integer if specified");if(!J(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#M()}if(this.allowStale=!!s,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!a,this.ttlResolution=J(i)||0===i?i:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!J(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#T()}if(0===this.#e&&0===this.ttl&&0===this.#t)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t="LRU_CACHE_UNBOUNDED";(e=>!V.has(e))(t)&&(V.add(t),((e,t,n,r)=>{"function"==typeof H.emitWarning?H.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)})("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#T(){let e=new Q(this.#e),t=new Q(this.#e);this.#O=e,this.#S=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#w=n,this.#I=(n,i,o=this.#a.now())=>{t[n]=0!==i?o:0,e[n]=i,r(n,i)},this.#R=n=>{t[n]=0!==e[n]?this.#a.now():0,r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&0!==t&&n){let r=setTimeout(()=>{this.#_(e)&&this.#z(this.#d[e],"expire")},t+1);r.unref&&r.unref(),n[e]=r}}:()=>{};this.#q=(n,r)=>{if(e[r]){let l=e[r],a=t[r];if(!l||!a)return;n.ttl=l,n.start=a,n.now=i||o();let s=n.now-a;n.remainingTTL=l-s}};let i=0,o=()=>{let e=this.#a.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{let r=this.#u.get(n);if(void 0===r)return 0;let l=e[r],a=t[r];return l&&a?l-((i||o())-a):1/0},this.#_=n=>{let r=t[n],l=e[n];return!!l&&!!r&&(i||o())-r>l}}#R=()=>{};#q=()=>{};#I=()=>{};#_=()=>!1;#M(){let e=new Q(this.#e);this.#c=0,this.#g=e,this.#L=t=>{this.#c-=e[t],e[t]=0},this.#K=(e,t,n,r)=>{if(this.#j(t))return 0;if(!J(n))if(r){if("function"!=typeof r)throw TypeError("sizeCalculation must be a function");if(!J(n=r(t,e)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#B=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#c>n;)this.#W(!0)}this.#c+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#c)}}#L=e=>{};#B=(e,t,n)=>{};#K=(e,t,n,r)=>{if(n||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:e=this.allowStale}={}){if(this.#s)for(let t=this.#y;this.#$(t)&&((e||!this.#_(t))&&(yield t),t!==this.#m);)t=this.#f[t]}*#F({allowStale:e=this.allowStale}={}){if(this.#s)for(let t=this.#m;this.#$(t)&&((e||!this.#_(t))&&(yield t),t!==this.#y);)t=this.#h[t]}#$(e){return void 0!==e&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#C())void 0===this.#p[e]||void 0===this.#d[e]||this.#j(this.#p[e])||(yield[this.#d[e],this.#p[e]])}*rentries(){for(let e of this.#F())void 0===this.#p[e]||void 0===this.#d[e]||this.#j(this.#p[e])||(yield[this.#d[e],this.#p[e]])}*keys(){for(let e of this.#C()){let t=this.#d[e];void 0===t||this.#j(this.#p[e])||(yield t)}}*rkeys(){for(let e of this.#F()){let t=this.#d[e];void 0===t||this.#j(this.#p[e])||(yield t)}}*values(){for(let e of this.#C())void 0===this.#p[e]||this.#j(this.#p[e])||(yield this.#p[e])}*rvalues(){for(let e of this.#F())void 0===this.#p[e]||this.#j(this.#p[e])||(yield this.#p[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#C()){let r=this.#p[n],i=this.#j(r)?r.__staleWhileFetching:r;if(void 0!==i&&e(i,this.#d[n],this))return this.#G(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#C()){let r=this.#p[n],i=this.#j(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#F()){let r=this.#p[n],i=this.#j(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#F({allowStale:!0}))this.#_(t)&&(this.#z(this.#d[t],"expire"),e=!0);return e}info(e){let t=this.#u.get(e);if(void 0===t)return;let n=this.#p[t],r=this.#j(n)?n.__staleWhileFetching:n;if(void 0===r)return;let i={value:r};if(this.#O&&this.#S){let e=this.#O[t],n=this.#S[t];e&&n&&(i.ttl=e-(this.#a.now()-n),i.start=Date.now())}return this.#g&&(i.size=this.#g[t]),i}dump(){let e=[];for(let t of this.#C({allowStale:!0})){let n=this.#d[t],r=this.#p[t],i=this.#j(r)?r.__staleWhileFetching:r;if(void 0===i||void 0===n)continue;let o={value:i};if(this.#O&&this.#S){o.ttl=this.#O[t];let e=this.#a.now()-this.#S[t];o.start=Math.floor(Date.now()-e)}this.#g&&(o.size=this.#g[t]),e.unshift([n,o])}return e}load(e){for(let[t,n]of(this.clear(),e)){if(n.start){let e=Date.now()-n.start;n.start=this.#a.now()-e}this.#U(t,n.value,n)}}set(e,t,n={}){let{status:r=U.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op="set",r.key=e,void 0!==t&&(r.value=t));let i=this.#U(e,t,n);return r&&U.hasSubscribers&&U.publish(r),i}#U(e,t,n={}){let{ttl:r=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:a}=n;if(void 0===t)return a&&(a.set="deleted"),this.delete(e),this;let{noUpdateTTL:s=this.noUpdateTTL}=n;a&&!this.#j(t)&&(a.value=t);let c=this.#K(e,t,n.size||0,l,a);if(this.maxEntrySize&&c>this.maxEntrySize)return this.#z(e,"set"),a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this;let u=0===this.#s?void 0:this.#u.get(e);if(void 0===u)u=0===this.#s?this.#y:0!==this.#b.length?this.#b.pop():this.#s===this.#e?this.#W(!1):this.#s,this.#d[u]=e,this.#p[u]=t,this.#u.set(e,u),this.#h[this.#y]=u,this.#f[u]=this.#y,this.#y=u,this.#s++,this.#B(u,c,a),a&&(a.set="add"),s=!1,this.#A&&this.#r?.(t,e,"add");else{this.#E(u);let n=this.#p[u];if(t!==n){if(this.#k&&this.#j(n)){n.__abortController.abort(Error("replaced"));let{__staleWhileFetching:t}=n;void 0!==t&&!o&&(this.#x&&this.#n?.(t,e,"set"),this.#D&&this.#v?.push([t,e,"set"]))}else o||(this.#x&&this.#n?.(n,e,"set"),this.#D&&this.#v?.push([n,e,"set"]));if(this.#L(u),this.#B(u,c,a),this.#p[u]=t,a){a.set="replace";let e=n&&this.#j(n)?n.__staleWhileFetching:n;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#A&&this.onInsert?.(t,e,t===n?"update":"replace")}if(0===r||this.#O||this.#T(),this.#O&&(s||this.#I(u,r,i),a&&this.#q(a,u)),!o&&this.#D&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#s;){let e=this.#p[this.#m];if(this.#W(!0),this.#j(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#D&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#W(e){let t=this.#m,n=this.#d[t],r=this.#p[t];return this.#k&&this.#j(r)?r.__abortController.abort(Error("evicted")):(this.#x||this.#D)&&(this.#x&&this.#n?.(r,n,"evict"),this.#D&&this.#v?.push([r,n,"evict"])),this.#L(t),this.#w?.[t]&&(clearTimeout(this.#w[t]),this.#w[t]=void 0),e&&(this.#d[t]=void 0,this.#p[t]=void 0,this.#b.push(t)),1===this.#s?(this.#m=this.#y=0,this.#b.length=0):this.#m=this.#h[t],this.#u.delete(n),this.#s--,t}has(e,t={}){let{status:n=U.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="has",n.key=e);let r=this.#N(e,t);return U.hasSubscribers&&U.publish(n),r}#N(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(void 0!==i){let e=this.#p[i];if(this.#j(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#_(i))return n&&this.#R(i),r&&(r.has="hit",this.#q(r,i)),!0;r&&(r.has="stale",this.#q(r,i))}else r&&(r.has="miss");return!1}peek(e,t={}){let{status:n=U.hasSubscribers||U.hasSubscribers?{}:void 0}=t;n&&(n.op="peek",n.key=e),t.status=n;let r=this.#V(e,t);return U.hasSubscribers&&U.publish(n),r}#V(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(void 0===i||!r&&this.#_(i)){n&&(n.peek=void 0===i?"miss":"stale");return}let o=this.#p[i],l=this.#j(o)?o.__staleWhileFetching:o;return n&&(void 0!==l?(n.peek="hit",n.value=l):n.peek="miss"),l}#P(e,t,n,r){let i=void 0===t?void 0:this.#p[t];if(this.#j(i))return i;let o=new AbortController,{signal:l}=n;l?.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let a={signal:o.signal,options:n,context:r},s=(r,i=!1)=>{let{aborted:l}=o.signal,s=n.ignoreFetchAbort&&void 0!==r,u=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&void 0!==r);if(n.status&&(l&&!i?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,s&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),l&&!s&&!i)return c(o.signal.reason,u);let p=this.#p[t];return(p===d||void 0===p&&s&&i)&&(void 0===r?void 0!==d.__staleWhileFetching?this.#p[t]=d.__staleWhileFetching:this.#z(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#U(e,r,a.options))),r},c=(r,i)=>{let{aborted:l}=o.signal,a=l&&n.allowStaleOnFetchAbort,s=a||n.allowStaleOnFetchRejection,c=s||n.noDeleteOnFetchRejection;if(this.#p[t]===d&&(c&&(i||void 0!==d.__staleWhileFetching)?a||(this.#p[t]=d.__staleWhileFetching):this.#z(e,"fetch")),s)return n.status&&void 0!==d.__staleWhileFetching&&(n.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw r},u=(t,r)=>{let l=this.#o?.(e,i,a);l&&l instanceof Promise&&l.then(e=>t(void 0===e?void 0:e),r),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>s(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let d=new Promise(u).then(s,e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),c(e,!1))),p=Object.assign(d,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.#U(e,p,{...a.options,status:void 0}),t=this.#u.get(e)):this.#p[t]=p,p}#j(e){return!!this.#k&&!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(e,t={}){let n=U.hasSubscribers,{status:r=U.hasSubscribers||U.hasSubscribers?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#H(e,t);return r&&(U.hasSubscribers||U.hasSubscribers)&&n&&(r.trace=!0,U.tracePromise(()=>i,r).catch(()=>{})),i}async #H(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:a=0,sizeCalculation:s=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:f,forceRefresh:m=!1,status:y,signal:b}=t;if(y&&(y.op="fetch",y.key=e,m&&(y.forceRefresh=!0)),!this.#k)return y&&(y.fetch="get"),this.#G(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:y});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:l,size:a,sizeCalculation:s,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:h,ignoreFetchAbort:p,status:y,signal:b},g=this.#u.get(e);if(void 0===g){y&&(y.fetch="miss");let t=this.#P(e,g,v,f);return t.__returned=t}{let t=this.#p[g];if(this.#j(t)){let e=n&&void 0!==t.__staleWhileFetching;return y&&(y.fetch="inflight",e&&(y.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#_(g);if(!m&&!i)return y&&(y.fetch="hit"),this.#E(g),r&&this.#R(g),y&&this.#q(y,g),t;let o=this.#P(e,g,v,f),l=void 0!==o.__staleWhileFetching&&n;return y&&(y.fetch=i?"stale":"refresh",l&&i&&(y.returnedStale=!0)),l?o.__staleWhileFetching:o.__returned=o}}forceFetch(e,t={}){let n=U.hasSubscribers,{status:r=U.hasSubscribers||U.hasSubscribers?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#J(e,t);return r&&(U.hasSubscribers||U.hasSubscribers)&&n&&(r.trace=!0,U.tracePromise(()=>i,r).catch(()=>{})),i}async #J(e,t={}){let n=await this.#H(e,t);if(void 0===n)throw Error("fetch() returned undefined");return n}memo(e,t={}){let{status:n=U.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="memo",n.key=e,t.context&&(n.context=t.context));let r=this.#X(e,t);return n&&(n.value=r),U.hasSubscribers&&U.publish(n),r}#X(e,t={}){let n=this.#l;if(!n)throw Error("no memoMethod provided to constructor");let{context:r,status:i,forceRefresh:o,...l}=t;i&&o&&(i.forceRefresh=!0);let a=this.#G(e,l),s=o||void 0===a;if(i&&(i.memo=s?"miss":"hit",s||(i.value=a)),!s)return a;let c=n(e,a,{options:l,context:r});return i&&(i.value=c),this.#U(e,c,l),c}get(e,t={}){let{status:n=U.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="get",n.key=e);let r=this.#G(e,t);return n&&(void 0!==r&&(n.value=r),U.hasSubscribers&&U.publish(n)),r}#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=t,l=this.#u.get(e);if(void 0===l){o&&(o.get="miss");return}let a=this.#p[l],s=this.#j(a);return o&&this.#q(o,l),this.#_(l)?s?(o&&(o.get="stale-fetching"),n&&void 0!==a.__staleWhileFetching?(o&&(o.returnedStale=!0),a.__staleWhileFetching):void 0):(i||this.#z(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),a):void 0):(o&&(o.get=s?"fetching":"hit"),this.#E(l),r&&this.#R(l),s?a.__staleWhileFetching:a)}#Q(e,t){this.#f[t]=e,this.#h[e]=t}#E(e){e!==this.#y&&(e===this.#m?this.#m=this.#h[e]:this.#Q(this.#f[e],this.#h[e]),this.#Q(this.#y,e),this.#y=e)}delete(e){return this.#z(e,"delete")}#z(e,t){U.hasSubscribers&&U.publish({op:"delete",delete:t,key:e});let n=!1;if(0!==this.#s){let r=this.#u.get(e);if(void 0!==r)if(this.#w?.[r]&&(clearTimeout(this.#w?.[r]),this.#w[r]=void 0),n=!0,1===this.#s)this.#Y(t);else{this.#L(r);let n=this.#p[r];if(this.#j(n)?n.__abortController.abort(Error("deleted")):(this.#x||this.#D)&&(this.#x&&this.#n?.(n,e,t),this.#D&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#p[r]=void 0,r===this.#y)this.#y=this.#f[r];else if(r===this.#m)this.#m=this.#h[r];else{let e=this.#f[r];this.#h[e]=this.#h[r];let t=this.#h[r];this.#f[t]=this.#f[r]}this.#s--,this.#b.push(r)}}if(this.#D&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#Y("delete")}#Y(e){for(let t of this.#F({allowStale:!0})){let n=this.#p[t];if(this.#j(n))n.__abortController.abort(Error("deleted"));else{let r=this.#d[t];this.#x&&this.#n?.(n,r,e),this.#D&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#p.fill(void 0),this.#d.fill(void 0),this.#O&&this.#S){for(let e of(this.#O.fill(0),this.#S.fill(0),this.#w??[]))void 0!==e&&clearTimeout(e);this.#w?.fill(void 0)}if(this.#g&&this.#g.fill(0),this.#m=0,this.#y=0,this.#b.length=0,this.#c=0,this.#s=0,this.#D&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}};function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function et(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function en(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function er(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ei(e){return function(e){if(Array.isArray(e))return ee(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return ee(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ee(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var eo=function(e){var t=e.tag,n=e.type,i=e.displayType;return a().createElement("div",null,a().createElement(r.Tag,{color:{reference:"blue",duplicate:"green",preloading:"cyan"}[n]},a().createElement("span",null,t)," ",void 0===i||i?"(".concat({reference:"Reference",duplicate:"Duplicate",preloading:"Preloading"}[n],")"):""))},el=["sort","createdById","createdBy","createdAt","updatedById","updatedBy","updatedAt","password","sequence"];function ea(e){var t=e.node,n=e.traverseAssociations,r=e.traverseFields,i=e.systemKeys,o=e.dataSource,l=e.setDataSource,a=function(e,t){for(var n=ei(e);n.length;){var r=n.shift();if(r.key===t.key)return r;r.children&&n.push.apply(n,ei(r.children))}}(o,t),s=[];return["belongsTo","belongsToMany"].includes(t.field.type)&&(null==t?void 0:t.type)==="reference"?s=n(t.field.target,{exclude:i,prefix:t.key,maxDepth:1}):(["hasOne","hasMany"].includes(t.field.type)||(null==t?void 0:t.type)==="duplicate")&&(s=r(t.field.target,{exclude:["id"].concat(ei(i.filter(function(e){return"sort"!==e}))),prefix:t.key,maxDepth:1})),s.length?a.children=s:a.isLeaf=!0,l(ei(o)),s}var es=function(e,t,n){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=function(o,l){var s=l.exclude,c=void 0===s?[]:s,u=l.depth,d=void 0===u?0:u,p=l.maxDepth,h=l.prefix,f=void 0===h?"":h;return d>p?[]:ei(e.getCollection(n,o).fields.values()).map(function(e){if(!c.includes(e.name)&&e.interface&&!(0===d&&["sort","password","sequence"].includes(e.type))){var n,o={type:"duplicate",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},l=er(en({},o),{role:"button",title:a().createElement(eo,er(en({},o),{displayType:!0})),key:f?"".concat(f,".").concat(e.name):e.name,isLeaf:!0,field:e});return["belongsTo","belongsToMany"].includes(e.type)?(o.type="reference",l.type="reference",l.title=a().createElement(eo,er(en({},o),{type:"reference",displayType:!0})),l.isLeaf=!1,l.children=i(e.target,{depth:d+1,maxDepth:p,prefix:l.key,exclude:el})):["hasOne","hasMany"].includes(e.type)&&(l.isLeaf=!1,l.children=r(e.target,{depth:d+1,maxDepth:p,prefix:l.key,exclude:["id"].concat(ei(el.filter(function(e){return"sort"!==e})))})),l}}).filter(Boolean)},i=function(r,o){var l,s=o.prefix,c=o.maxDepth,u=o.depth,d=void 0===u?0:u,p=o.exclude,h=void 0===p?[]:p;return d>c||!e.getCollection(n,r)?[]:ei((null==(l=e.getCollection(n,r))?void 0:l.fields.values())||[]).map(function(e){if(e.target&&e.interface&&!h.includes(e.name)){var n,r={type:"preloading",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},o=s?"".concat(s,".").concat(e.name):e.name;return{role:"button",title:a().createElement(eo,er(en({},r),{displayType:!0})),key:o,isLeaf:!1,field:e,children:i(e.target,{prefix:o,depth:d+1,maxDepth:c,exclude:h})}}}).filter(Boolean)};return{getEnableFieldTree:function(e){try{return r(e,{exclude:["id"].concat(ei(el)),maxDepth:1})}catch(e){return console.error(e),[]}},getOnLoadData:function(e,t){return function(n){return new Promise(function(o){if(n.children.length)return n.children.forEach(function(n){ea({node:n,traverseAssociations:i,traverseFields:r,systemKeys:el,dataSource:e,setDataSource:t})}),o(void 0);ea({node:n,traverseAssociations:i,traverseFields:r,systemKeys:el,dataSource:e,setDataSource:t}),o(void 0)})}},getOnCheck:function(e){return function(t){e.value=t}}}},ec=function(e,t,n,r,i){var o,l=(o=new Z({max:50}),function(r,i,c){var u=i.exclude,d=void 0===u?[]:u,p=i.depth,h=void 0===p?0:p,f=i.maxDepth,m=i.prefix,y=void 0===m?"":m,b=i.disabled,v=void 0!==b&&b;if(h>f)return[];var g=Array.isArray(c)?c:[],S=(e.getCollection(n,r)?ei(e.getCollection(n,r).fields.values()):[]).map(function(e){if(!d.includes(e.name)&&e.interface&&!["sort","password","sequence"].includes(e.type)){var n,r={type:"duplicate",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},i=er(en({},r),{title:a().createElement(eo,r),key:y?"".concat(y,".").concat(e.name):e.name,isLeaf:!0,field:e,disabled:v}),o=g.find(function(e){return(null==e?void 0:e.name)===i.key});if(!["belongsTo","belongsToMany"].includes(e.type)||o&&(null==o?void 0:o.updateAssociation)){if(["hasOne","hasMany"].includes(e.type)||(null==o?void 0:o.updateAssociation)){var c=!1;!["hasOne","hasMany"].includes(e.type)||(null==o?void 0:o.updateAssociation)||(c=!0),i.disabled=!0,i.isLeaf=!1,i.children=l(e.target,{depth:h+1,maxDepth:f,prefix:i.key,exclude:["id"].concat(ei(el.filter(function(e){return"sort"!==e}))),disabled:c},g)}}else r.type="reference",i.type="reference",i.title=a().createElement(eo,er(en({},r),{type:"reference"})),i.isLeaf=!1,i.children=s(e.target,{depth:h+1,maxDepth:f,prefix:i.key,exclude:el});return i}}).filter(Boolean);return o.set(r+JSON.stringify(g),S),S}),s=function(r,i){var o,l=i.prefix,c=i.maxDepth,u=i.depth,d=void 0===u?0:u,p=i.exclude,h=void 0===p?[]:p;return d>c||!e.getCollection(n,r)?[]:ei((null==(o=e.getCollection(n,r))?void 0:o.fields.values())||[]).map(function(e){if(e.target&&e.interface&&!h.includes(e.name)){var n,r={type:"preloading",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},i=l?"".concat(l,".").concat(e.name):e.name;return{title:a().createElement(eo,r),key:i,disabled:!0,isLeaf:!1,field:e,children:s(e.target,{prefix:i,depth:d+1,maxDepth:c,exclude:h})}}}).filter(Boolean)};return{run:function(e){var t;return(t=function(){var t,n,o,a;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(s){return(null==e?void 0:e.mapSubModels)?(t=new Set,n=new Set,(o=function(e,r){var i;null==e||null==(i=e.mapSubModels)||i.call(e,r,function(e){var r,i,l;e.collectionField&&!(["hasOne","hasMany"].includes(e.collectionField.type)||(null==(r=e.subModels.field)?void 0:r.updateAssociation))&&n.add(e.fieldPath),e.collectionField&&e.collectionField.isAssociationField()&&(t.add({name:e.fieldPath,updateAssociation:null==(i=e.subModels.field)?void 0:i.updateAssociation}),(null==(l=e.subModels.field)?void 0:l.updateAssociation)&&(e.subModels.field.subModels.grid?o(e.subModels.field.subModels.grid,"items"):e.subModels.field.subModels.subTableColumns?o(e.subModels.field,"subTableColumns"):e.subModels.field.subModels.columns&&o(e.subModels.field,"columns")))})})(e,"items"),a=l(r,{exclude:["id"].concat(ei(el)),maxDepth:1},ei(t)),null==i||i(a,ei(n))):null==i||i([],[]),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function l(e){et(o,r,i,l,a,"next",e)}function a(e){et(o,r,i,l,a,"throw",e)}l(void 0)})})()}}};function eu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ed(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function ep(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(e){ed(o,r,i,l,a,"next",e)}function a(e){ed(o,r,i,l,a,"throw",e)}l(void 0)})}}function eh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ef(e){return(ef=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function em(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){eh(e,t,n[t])})}return e}function ey(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function eb(e,t){return(eb=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ev(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw r}}return o}}(e,t)||eS(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eg(e){return function(e){if(Array.isArray(e))return eu(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eS(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eS(e,t){if(e){if("string"==typeof e)return eu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eu(e,t)}}function eO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eO=function(){return!!e})()}function ew(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var ex=(0,n.connect)(r.Tree,(0,n.mapProps)(function(e,t){var r=e.loadData;(0,l.useEffect)(function(){t.value=e.defaultCheckedKeys||[]},[]);var i=ev((0,l.useState)((null==e?void 0:e.treeData)||[]),2),o=i[0],a=i[1],s=ev((0,l.useState)(e.defaultCheckedKeys||[]),2),c=s[0],u=s[1],d=function(e){u(e),t.value=e};t.onCheck=d;var p=(0,n.useForm)();return(0,l.useEffect)(function(){var n=e.getEnableFieldTree(p.values.collection);a(n),t.dataSource=n},[p.values.collection]),(0,l.useEffect)(function(){a(t.dataSource)},[t.dataSource]),ey(em({},e),{checkedKeys:c,onCheck:d,loadData:r(o,a),treeData:o.map(function(e){if("quickDulicate"===p.values.duplicateMode){var t,n=null==e||null==(t=e.children)?void 0:t.map(function(e){return ey(em({},e),{disabled:!1})});return ey(em({},e),{disabled:!1,children:n})}return e})})}));function ek(e){var t=e.options,n=(0,B.useFlowViewContext)(),r=(0,$.useRequest)(function(){return ep(function(){var e;return ew(this,function(r){switch(r.label){case 0:return[4,n.engine.loadOrCreateModel(t,{delegateToParent:!1,delegate:n,skipSave:!n.flowSettingsEnabled})];case 1:return e=r.sent(),(null==t?void 0:t.scene)&&(e.actionName=t.scene),[2,e]}})})()},{refreshDeps:[n,t]}),i=r.data;return!r.loading&&(null==i?void 0:i.uid)?a().createElement(B.FlowModelRenderer,{model:i,fallback:a().createElement(W.SkeletonFallback,{style:{margin:16}})}):a().createElement(W.SkeletonFallback,{style:{margin:16}})}function eD(e){var t=e.model,n=e.scene,r=(0,B.useFlowContext)(),i=r.view,o=i.Header,l=i.type;t._closeView=r.view.close;var s=r.t("Duplicate record");return a().createElement("div",null,a().createElement(o,{title:"dialog"===l?a().createElement("div",{style:{padding:"".concat(r.themeToken.paddingLG,"px ").concat(r.themeToken.paddingLG,"px 0"),marginBottom:-r.themeToken.marginSM,backgroundColor:"var(--colorBgLayout)"}},s):s}),a().createElement(ek,{options:{parentId:r.view.inputArgs.parentId,subKey:"deplicate.edit-form-grid-block",async:!0,delegateToParent:!1,subType:"object",use:"BlockGridModel",scene:void 0===n?"create":n}}))}var eA=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=ef(t),eh(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eO()?Reflect.construct(t,r||[],ef(this).constructor):t.apply(this,r)),"duplicateLoading",!1),eh(e,"defaultProps",{type:"link",title:(0,B.tExpr)("Duplicate"),duplicateFields:[]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eb(n,e),t=[{key:"getAclActionName",value:function(){return"create"}},{key:"onClick",value:function(e){"quickDulicate"===this.props.duplicateMode?this.dispatchEvent("quickCreateClick",em({event:e},this.getInputArgs()),{debounce:!0}):this.dispatchEvent("openDuplicatePopup",em({event:e},this.getInputArgs()),{debounce:!0})}},{key:"getTitle",value:function(){return this.duplicateLoading?this.context.t("Duplicating"):this.props.title||this.context.t("Duplicate")}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(W.ActionModel);function ej(e,t){return ep(function(){var n,r;return ew(this,function(i){switch(i.label){case 0:if(!(null==t?void 0:t.dataId)||(null==(n=t.fields)?void 0:n.length)===0)return[2];return[4,e.runAction("get",{params:{filterByTk:t.dataId,fields:t.fields,isTemplate:!0}})];case 1:return[2,null==(r=i.sent())?void 0:r.data]}})})()}function eP(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function eE(e,t,n){return(eE=eM()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&eF(i,n.prototype),i}).apply(null,arguments)}eh(eA,"scene",W.ActionSceneEnum.record),eA.define({label:(0,B.tExpr)("Duplicate"),sort:60}),eA.registerFlow({key:"duplicateModeSettings",steps:{duplicateMode:{title:(0,B.tExpr)("Duplicate mode",{ns:G}),uiSchema:function(e){var t,r,o,l=e.t,s=(e.dataSourceManager.getDataSource("main").collectionManager.getAllCollectionsInheritChain(e.blockModel.collection.name)||[]).map(function(t){var n;return{label:null==(n=e.dataSourceManager.getDataSource("main").collectionManager.getCollection(t))?void 0:n.title,value:t}}),c=(0,i.cloneDeep)((null==(t=e.model.props)?void 0:t.duplicateFields)||[]),u=function(e,t){for(var n=0;n<(null==e?void 0:e.length);n++){var r=e[n],i=r.children,o=function(e,t){if(null==e)return{};var n,r,i,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(i=0,n=Reflect.ownKeys(Object(e));i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(r,["children"]);t.push(o.key),i&&u(i,t)}return t},d=es(e.dataSourceManager,l,e.blockModel.collection.dataSourceKey),p=d.getEnableFieldTree,h=d.getOnLoadData,f=d.getOnCheck;return e.model.flowEngine.flowSettings.registerScopes({collectionName:(null==(r=e.record)?void 0:r.__collection)||e.blockModel.collection.name,currentCollection:(null==(o=e.record)?void 0:o.__collection)||e.blockModel.collection.name,getOnLoadData:h,getOnCheck:f,treeData:[],duplicateValues:c,onFieldInputValueChange:k.onFieldInputValueChange}),{duplicateMode:{"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{value:"quickDulicate",label:'{{t("Direct duplicate")}}'},{value:"continueduplicate",label:'{{t("Copy into the form and continue to fill in")}}'}]},collection:{type:"string",title:'{{ t("Target collection") }}',required:!0,description:l("If collection inherits, choose inherited collections as templates"),"x-display":s.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:s},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{disabled:'{{ $deps[0]==="quickDulicate" }}',value:'{{ $deps[0]==="quickDulicate"? currentCollection:collectionName }}'}}},function(t){if("quickDulicate"===t.form.values.duplicateMode){var n;t.form.setValuesIn("collection",(null==(n=e.record)?void 0:n.__collection)||e.blockModel.collection.name)}}]},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":function(){var t,r,i,o,s=null==(r=(i=e.model).getStepParams)||null==(t=r.call(i,"popupSettings","openView"))?void 0:t.uid,c=(0,n.useForm)(),u=ec(e.dataSourceManager,e.t,e.blockModel.collection.dataSourceKey,(null==(o=e.record)?void 0:o.__collection)||e.blockModel.collection.name,function(t,n){c.query("duplicateFields").take(function(r){r.dataSource=t,r.componentProps.defaultCheckedKeys=n,r.setInitialValue(n),null==r||r.onCheck(n),e.message.success(l("Sync successfully"))})}).run;return a().createElement("a",{onClick:function(){return ep(function(){var t,n,r;return ew(this,function(i){switch(i.label){case 0:if(!s)return[3,3];return[4,e.engine.loadModel({parentId:s,refresh:!0})];case 1:return t=i.sent(),[4,e.engine.loadModel({parentId:t.subModels.tabs[0].uid})];case 2:if(!(n=i.sent()))return[2];return u(n.subModels.items[0].subModels.grid),[3,5];case 3:return[4,e.engine.loadModel({parentId:e.model.uid,refresh:!0})];case 4:if(!(r=i.sent()))return[2];u(r.subModels.items[0].subModels.grid),i.label=5;case 5:return[2]}})})()},style:{float:"right",position:"relative",zIndex:1200}},l("Sync from form fields"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]!=="quickDulicate" }}'}}}]},selectAll:{type:"void",title:'{{ t("Select all") }}',"x-component":function(){var e=(0,n.useForm)();return a().createElement("a",{onClick:function(){e.query("duplicateFields").take(function(e){var t,n=u(e.dataSource,[]);e.componentProps.defaultCheckedKeys=n,e.setInitialValue(n),null==e||null==(t=e.onCheck)||t.call(e,n)})},style:{float:"right",position:"relative",zIndex:1200}},l("Select all"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]==="quickDulicate"}}'}}}]},unselectAll:{type:"void",title:'{{ t("UnSelect all") }}',"x-component":function(){var e=(0,n.useForm)();return a().createElement("a",{style:{float:"right",position:"relative",zIndex:1200,marginRight:"10px"},onClick:function(){e.query("duplicateFields").take(function(e){e.componentProps.defaultCheckedKeys=[],e.setInitialValue([]),null==e||e.onCheck([])})}},l("UnSelect all"))},"x-reactions":[{dependencies:[".duplicateMode",".duplicateFields"],fulfill:{state:{visible:"{{ $deps[0]===\"quickDulicate\"&&$form.getValuesIn('duplicateFields').length>0 }}"}}}]},duplicateFields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:l("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":ex,"x-component-props":{defaultCheckedKeys:c,treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:h,onCheck:"{{ getOnCheck($self) }}",getEnableFieldTree:p,rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection"],fulfill:{state:{disabled:"{{ !$deps[0] }}"}}}]}}},defaultParams:function(e){var t;return{duplicateMode:"quickDulicate",collection:(null==(t=e.record)?void 0:t.__collection)||e.blockModel.collection.name}},handler:function(e,t){return ep(function(){var n,r,i,o,l;return ew(this,function(a){return n=t.duplicateMode,r=t.duplicateFields,i=t.collection,o=t.treeData,l=Array.isArray(r)?r:(null==r?void 0:r.checked)||[],e.model.setProps({duplicateMode:n,duplicateFields:l,duplicateCollection:i,treeData:o}),[2]})})()}}}}),eA.registerFlow({key:"duplicateSettings",title:(0,B.tExpr)("Duplicate mode settings"),on:"quickCreateClick",steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,n,r;return"quickDulicate"!==(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,B.tExpr)("Duplicate record"),content:(0,B.tExpr)("Are you sure you want to duplicate it?")}},duplicate:{handler:function(e,t){return ep(function(){var n,r,i,o,l,a,s,c;return ew(this,function(u){switch(u.label){case 0:if(!(null==(i=void 0===(r=e.model.props.duplicateFields)?[]:r)?void 0:i.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:G})),[2];if(e.model.duplicateLoading)return[2];return e.model.duplicateLoading=!0,e.model.rerender(),o=e.blockModel.collection.filterTargetKey,l={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(n=Object).assign.apply(n,[{}].concat(eg(o.map(function(t){return eh({},t,e.record[t])})))):e.record[o]||e.record.id,default:!0,fields:(null==i?void 0:i.filter(function(t){return"string"==typeof t&&eg(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},a=e.createResource(B.MultiRecordResource),s=e.blockModel.collection.dataSourceKey,a.setDataSourceKey(s),a.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,ej(a,l)];case 1:return c=u.sent(),[4,e.blockModel.resource.create(em({},c),t.requestConfig)];case 2:return u.sent(),e.message.success(e.t("Saved successfully")),e.model.duplicateLoading=!1,e.model.rerender(),[2]}})})()}}}}),eA.registerFlow({key:"popupSettings",on:{eventName:"openDuplicatePopup"},sort:300,steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,n,r;return"quickDulicate"===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,B.tExpr)("Duplicate record"),content:(0,B.tExpr)("Are you sure you want to duplicate it?")}},openView:{title:(0,B.tExpr)("Edit popup"),hideInSettings:function(e){var t,n,r;return"quickDulicate"===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},use:"openView",defaultParams:{mode:"drawer",size:"medium"},handler:function(e,t){return ep(function(){var n,r,i,o,l,s,c,u,d,p,h,f,m,y,b,v,g,S,O,w;return ew(this,function(x){switch(x.label){case 0:return[4,e.model.dispatchEvent("beforeRender")];case 1:if(x.sent(),!(null==(l=void 0===(o=e.model.props.duplicateFields)?[]:o)?void 0:l.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:G})),[2];return s={drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}},c=(null==(r=e.inputArgs)?void 0:r.mode)||(null==t?void 0:t.mode)||"drawer",u=(null==(i=e.inputArgs)?void 0:i.size)||(null==t?void 0:t.size)||"medium",d=e.blockModel.collection.filterTargetKey,p={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(n=Object).assign.apply(n,[{}].concat(eg(d.map(function(t){return eh({},t,e.record[t])})))):e.record[d]||e.record.id,default:!0,fields:(null==l?void 0:l.filter(function(t){return"string"==typeof t&&eg(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},h=e.createResource(B.MultiRecordResource),f=e.blockModel.collection.dataSourceKey,h.setDataSourceKey(f),h.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,ej(h,p)];case 2:if(m=x.sent(),y="string"==typeof(null==t?void 0:t.popupTemplateUid)?t.popupTemplateUid.trim():"",b="string"==typeof(null==t?void 0:t.uid)?t.uid.trim():"",v=!!y||!!b&&b!==e.model.uid,g=(null==t?void 0:t.viewUid)||e.blockModel.uid,S=(null==t?void 0:t.dataSourceKey)||e.blockModel.collection.dataSourceKey,O=(null==t?void 0:t.collectionName)||e.record.__collection||e.blockModel.collection.name,!v)return[3,4];return w=ey(em({},t||{}),{navigation:!1,scene:"new",formData:m,viewUid:g,dataSourceKey:S,collectionName:O}),b&&(w.uid=b),[4,e.runAction("openView",w)];case 3:return x.sent(),[2];case 4:return e.viewer.open({type:c,width:s[c][u],inheritContext:!1,target:e.layoutContentElement,inputArgs:{parentId:e.model.uid,scene:"new",dataSourceKey:S,collectionName:O,formData:m,viewUid:g},content:function(){return a().createElement(eD,{model:e.model,scene:"create"})},styles:{content:em({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===c?{position:"absolute",top:0,left:0,right:0,bottom:0}:{}),body:{padding:0}}}),[2]}})})()}}}}),W.RecordActionGroupModel.registerActionModels({DuplicateActionModel:eA});function eC(e){return(eC=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eF(e,t){return(eF=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function e_(e){var t="function"==typeof Map?new Map:void 0;return(e_=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return eE(e,arguments,eC(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),eF(n,e)})(e)}function eM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eM=function(){return!!e})()}var eT=function(t){var n;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=eC(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eM()?Reflect.construct(e,t||[],eC(this).constructor):e.apply(this,t))}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&eF(r,t),n=[{key:"load",value:function(){var t;return(t=function(){var t;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){return this.app.use(K),this.app.addComponents({DuplicateActionInitializer:L,DuplicateAction:x,DuplicateActionDecorator:q}),this.app.schemaSettingsManager.add(R),this.app.schemaSettingsManager.add(z),t={title:'{{t("Duplicate")}}',Component:"DuplicateActionInitializer",schema:{"x-component":"Action.Link","x-action":"duplicate","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:duplicate","x-decorator":"DuplicateActionDecorator","x-component-props":{type:"primary"}},useVisible:function(){return(0,e.useActionAvailable)("create")}},this.app.schemaInitializerManager.addItem("table:configureItemActions","actions.duplicate",t),this.app.flowEngine.registerModels({DuplicateActionModel:eA}),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function l(e){eP(o,r,i,l,a,"next",e)}function a(e){eP(o,r,i,l,a,"throw",e)}l(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,n),r}(e_(e.Plugin)),eI=eT}(),v}()});
@@ -6,7 +6,8 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- export declare const NAMESPACE = "action-duplicate";
9
+ import { NAMESPACE } from '../../client-v2/locale';
10
+ export { NAMESPACE };
10
11
  export declare function lang(key: string): string;
11
12
  export declare function generateNTemplate(key: string): string;
12
13
  export declare function useBulkEditTranslation(): import("react-i18next").UseTranslationResponse<"action-duplicate", undefined>;
@@ -6,7 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { ActionModel } from '@nocobase/client';
9
+ import { ActionModel } from '@nocobase/client-v2';
10
10
  export declare class DuplicateActionModel extends ActionModel {
11
11
  props: any;
12
12
  static scene: import("@nocobase/client-v2").ActionSceneType;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Plugin } from '@nocobase/client-v2';
10
+ export declare class PluginActionDuplicateClient extends Plugin {
11
+ load(): Promise<void>;
12
+ }
13
+ export { DuplicateActionModel } from './DuplicateActionModel';
14
+ export default PluginActionDuplicateClient;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-action-duplicate/client-v2",["ahooks","@nocobase/client-v2","@formily/core","react","antd","@formily/react","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-action-duplicate/client-v2"]=t(require("ahooks"),require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-action-duplicate/client-v2"]=t(e.ahooks,e["@nocobase/client-v2"],e["@formily/core"],e.react,e.antd,e["@formily/react"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,i,r,n,o,l,s){return function(){"use strict";var a={452:function(e){e.exports=i},230:function(e){e.exports=o},485:function(e){e.exports=t},694:function(e){e.exports=l},625:function(t){t.exports=e},59:function(e){e.exports=n},773:function(e){e.exports=s},155:function(e){e.exports=r}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var i=c[e]={exports:{}};return a[e](i,i.exports,u),i.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var i in t)u.o(t,i)&&!u.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.g.importScripts&&(h=u.g.location+"");var h,d=u.g.document;if(!h&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(h=d.currentScript.src),!h)){var f=d.getElementsByTagName("script");if(f.length)for(var p=f.length-1;p>-1&&(!h||!/^http(s?):/.test(h));)h=f[p--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");u.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var i=window.__webpack_public_path__||"";i&&("/"!==i.charAt(i.length-1)&&(i+="/"),e=i+"static/plugins/@nocobase/plugin-action-duplicate/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",n=r.indexOf("/v2/");e=n>=0?r.slice(0,n+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-action-duplicate/dist/client-v2/"}u.p=e}(),!function(){u.r(y),u.d(y,{default:function(){return ei},DuplicateActionModel:function(){return V},PluginActionDuplicateClient:function(){return et}});var e=u(485),t=u(694),i=u(452),r=u(230),n=u(625),o=u(59),l=u(773),s=u(155),a=u.n(s),c="action-duplicate",h={hasSubscribers:!1},d="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,f=new Set,p="object"==typeof process&&process?process:{},b=(Symbol("type"),e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e)),v=e=>b(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=0x100000000?Uint32Array:e<=Number.MAX_SAFE_INTEGER?m:null:null,m=class extends Array{constructor(e){super(e),this.fill(0)}},g=class e{heap;length;static #e=!1;static create(t){let i=v(t);if(!i)return[];e.#e=!0;let r=new e(t,i);return e.#e=!1,r}constructor(t,i){if(!e.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},S=class e{#e;#t;#i;#r;#n;#o;#l;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#c;#u;#h;#d;#f;#p;#y;#b;#v;#m;#g;#S;#w;#O;#x;#k;#_;#A;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#w,autopurgeTimers:e.#O,sizes:e.#g,keyMap:e.#u,keyList:e.#h,valList:e.#d,next:e.#f,prev:e.#p,get head(){return e.#y},get tail(){return e.#b},free:e.#v,isBackgroundFetch:t=>e.#E(t),backgroundFetch:(t,i,r,n)=>e.#F(t,i,r,n),moveToTail:t=>e.#M(t),indexes:t=>e.#D(t),rindexes:t=>e.#T(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#c}get size(){return this.#a}get fetchMethod(){return this.#o}get memoMethod(){return this.#l}get dispose(){return this.#i}get onInsert(){return this.#r}get disposeAfter(){return this.#n}constructor(t){let{max:i=0,ttl:r,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:l,updateAgeOnHas:s,allowStale:a,dispose:c,onInsert:u,disposeAfter:h,noDisposeOnSet:y,noUpdateTTL:m,maxSize:S=0,maxEntrySize:w=0,sizeCalculation:O,fetchMethod:x,memoMethod:k,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:F,ignoreFetchAbort:M,perf:D}=t;if(void 0!==D&&"function"!=typeof D?.now)throw TypeError("perf option must have a now() method if specified");if(this.#s=D??d,0!==i&&!b(i))throw TypeError("max option must be a nonnegative integer");let T=i?v(i):Array;if(!T)throw Error("invalid max value: "+i);if(this.#e=i,this.#t=S,this.maxEntrySize=w||this.#t,this.sizeCalculation=O,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==k&&"function"!=typeof k)throw TypeError("memoMethod must be a function if defined");if(this.#l=k,void 0!==x&&"function"!=typeof x)throw TypeError("fetchMethod must be a function if specified");if(this.#o=x,this.#k=!!x,this.#u=new Map,this.#h=Array.from({length:i}).fill(void 0),this.#d=Array.from({length:i}).fill(void 0),this.#f=new T(i),this.#p=new T(i),this.#y=0,this.#b=0,this.#v=g.create(i),this.#a=0,this.#c=0,"function"==typeof c&&(this.#i=c),"function"==typeof u&&(this.#r=u),"function"==typeof h?(this.#n=h,this.#m=[]):(this.#n=void 0,this.#m=void 0),this.#x=!!this.#i,this.#A=!!this.#r,this.#_=!!this.#n,this.noDisposeOnSet=!!y,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!M,0!==this.maxEntrySize){if(0!==this.#t&&!b(this.#t))throw TypeError("maxSize must be a positive integer if specified");if(!b(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#C()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!s,this.ttlResolution=b(n)||0===n?n:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!b(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#P()}if(0===this.#e&&0===this.ttl&&0===this.#t)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t="LRU_CACHE_UNBOUNDED";(e=>!f.has(e))(t)&&(f.add(t),((e,t,i,r)=>{"function"==typeof p.emitWarning?p.emitWarning(e,t,i,r):console.error(`[${i}] ${t}: ${e}`)})("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#P(){let e=new m(this.#e),t=new m(this.#e);this.#w=e,this.#S=t;let i=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#O=i,this.#z=(i,n,o=this.#s.now())=>{t[i]=0!==n?o:0,e[i]=n,r(i,n)},this.#R=i=>{t[i]=0!==e[i]?this.#s.now():0,r(i,e[i])};let r=this.ttlAutopurge?(e,t)=>{if(i?.[e]&&(clearTimeout(i[e]),i[e]=void 0),t&&0!==t&&i){let r=setTimeout(()=>{this.#j(e)&&this.#I(this.#h[e],"expire")},t+1);r.unref&&r.unref(),i[e]=r}}:()=>{};this.#q=(i,r)=>{if(e[r]){let l=e[r],s=t[r];if(!l||!s)return;i.ttl=l,i.start=s,i.now=n||o();let a=i.now-s;i.remainingTTL=l-a}};let n=0,o=()=>{let e=this.#s.now();if(this.ttlResolution>0){n=e;let t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=i=>{let r=this.#u.get(i);if(void 0===r)return 0;let l=e[r],s=t[r];return l&&s?l-((n||o())-s):1/0},this.#j=i=>{let r=t[i],l=e[i];return!!l&&!!r&&(n||o())-r>l}}#R=()=>{};#q=()=>{};#z=()=>{};#j=()=>!1;#C(){let e=new m(this.#e);this.#c=0,this.#g=e,this.#L=t=>{this.#c-=e[t],e[t]=0},this.#W=(e,t,i,r)=>{if(this.#E(t))return 0;if(!b(i))if(r){if("function"!=typeof r)throw TypeError("sizeCalculation must be a function");if(!b(i=r(t,e)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#G=(t,i,r)=>{if(e[t]=i,this.#t){let i=this.#t-e[t];for(;this.#c>i;)this.#U(!0)}this.#c+=e[t],r&&(r.entrySize=i,r.totalCalculatedSize=this.#c)}}#L=e=>{};#G=(e,t,i)=>{};#W=(e,t,i,r)=>{if(i||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:e=this.allowStale}={}){if(this.#a)for(let t=this.#b;this.#K(t)&&((e||!this.#j(t))&&(yield t),t!==this.#y);)t=this.#p[t]}*#T({allowStale:e=this.allowStale}={}){if(this.#a)for(let t=this.#y;this.#K(t)&&((e||!this.#j(t))&&(yield t),t!==this.#b);)t=this.#f[t]}#K(e){return void 0!==e&&this.#u.get(this.#h[e])===e}*entries(){for(let e of this.#D())void 0===this.#d[e]||void 0===this.#h[e]||this.#E(this.#d[e])||(yield[this.#h[e],this.#d[e]])}*rentries(){for(let e of this.#T())void 0===this.#d[e]||void 0===this.#h[e]||this.#E(this.#d[e])||(yield[this.#h[e],this.#d[e]])}*keys(){for(let e of this.#D()){let t=this.#h[e];void 0===t||this.#E(this.#d[e])||(yield t)}}*rkeys(){for(let e of this.#T()){let t=this.#h[e];void 0===t||this.#E(this.#d[e])||(yield t)}}*values(){for(let e of this.#D())void 0===this.#d[e]||this.#E(this.#d[e])||(yield this.#d[e])}*rvalues(){for(let e of this.#T())void 0===this.#d[e]||this.#E(this.#d[e])||(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#D()){let r=this.#d[i],n=this.#E(r)?r.__staleWhileFetching:r;if(void 0!==n&&e(n,this.#h[i],this))return this.#B(this.#h[i],t)}}forEach(e,t=this){for(let i of this.#D()){let r=this.#d[i],n=this.#E(r)?r.__staleWhileFetching:r;void 0!==n&&e.call(t,n,this.#h[i],this)}}rforEach(e,t=this){for(let i of this.#T()){let r=this.#d[i],n=this.#E(r)?r.__staleWhileFetching:r;void 0!==n&&e.call(t,n,this.#h[i],this)}}purgeStale(){let e=!1;for(let t of this.#T({allowStale:!0}))this.#j(t)&&(this.#I(this.#h[t],"expire"),e=!0);return e}info(e){let t=this.#u.get(e);if(void 0===t)return;let i=this.#d[t],r=this.#E(i)?i.__staleWhileFetching:i;if(void 0===r)return;let n={value:r};if(this.#w&&this.#S){let e=this.#w[t],i=this.#S[t];e&&i&&(n.ttl=e-(this.#s.now()-i),n.start=Date.now())}return this.#g&&(n.size=this.#g[t]),n}dump(){let e=[];for(let t of this.#D({allowStale:!0})){let i=this.#h[t],r=this.#d[t],n=this.#E(r)?r.__staleWhileFetching:r;if(void 0===n||void 0===i)continue;let o={value:n};if(this.#w&&this.#S){o.ttl=this.#w[t];let e=this.#s.now()-this.#S[t];o.start=Math.floor(Date.now()-e)}this.#g&&(o.size=this.#g[t]),e.unshift([i,o])}return e}load(e){for(let[t,i]of(this.clear(),e)){if(i.start){let e=Date.now()-i.start;i.start=this.#s.now()-e}this.#$(t,i.value,i)}}set(e,t,i={}){let{status:r=h.hasSubscribers?{}:void 0}=i;i.status=r,r&&(r.op="set",r.key=e,void 0!==t&&(r.value=t));let n=this.#$(e,t,i);return r&&h.hasSubscribers&&h.publish(r),n}#$(e,t,i={}){let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:s}=i;if(void 0===t)return s&&(s.set="deleted"),this.delete(e),this;let{noUpdateTTL:a=this.noUpdateTTL}=i;s&&!this.#E(t)&&(s.value=t);let c=this.#W(e,t,i.size||0,l,s);if(this.maxEntrySize&&c>this.maxEntrySize)return this.#I(e,"set"),s&&(s.set="miss",s.maxEntrySizeExceeded=!0),this;let u=0===this.#a?void 0:this.#u.get(e);if(void 0===u)u=0===this.#a?this.#b:0!==this.#v.length?this.#v.pop():this.#a===this.#e?this.#U(!1):this.#a,this.#h[u]=e,this.#d[u]=t,this.#u.set(e,u),this.#f[this.#b]=u,this.#p[u]=this.#b,this.#b=u,this.#a++,this.#G(u,c,s),s&&(s.set="add"),a=!1,this.#A&&this.#r?.(t,e,"add");else{this.#M(u);let i=this.#d[u];if(t!==i){if(this.#k&&this.#E(i)){i.__abortController.abort(Error("replaced"));let{__staleWhileFetching:t}=i;void 0!==t&&!o&&(this.#x&&this.#i?.(t,e,"set"),this.#_&&this.#m?.push([t,e,"set"]))}else o||(this.#x&&this.#i?.(i,e,"set"),this.#_&&this.#m?.push([i,e,"set"]));if(this.#L(u),this.#G(u,c,s),this.#d[u]=t,s){s.set="replace";let e=i&&this.#E(i)?i.__staleWhileFetching:i;void 0!==e&&(s.oldValue=e)}}else s&&(s.set="update");this.#A&&this.onInsert?.(t,e,t===i?"update":"replace")}if(0===r||this.#w||this.#P(),this.#w&&(a||this.#z(u,r,n),s&&this.#q(s,u)),!o&&this.#_&&this.#m){let e=this.#m,t;for(;t=e?.shift();)this.#n?.(...t)}return this}pop(){try{for(;this.#a;){let e=this.#d[this.#y];if(this.#U(!0),this.#E(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#_&&this.#m){let e=this.#m,t;for(;t=e?.shift();)this.#n?.(...t)}}}#U(e){let t=this.#y,i=this.#h[t],r=this.#d[t];return this.#k&&this.#E(r)?r.__abortController.abort(Error("evicted")):(this.#x||this.#_)&&(this.#x&&this.#i?.(r,i,"evict"),this.#_&&this.#m?.push([r,i,"evict"])),this.#L(t),this.#O?.[t]&&(clearTimeout(this.#O[t]),this.#O[t]=void 0),e&&(this.#h[t]=void 0,this.#d[t]=void 0,this.#v.push(t)),1===this.#a?(this.#y=this.#b=0,this.#v.length=0):this.#y=this.#f[t],this.#u.delete(i),this.#a--,t}has(e,t={}){let{status:i=h.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="has",i.key=e);let r=this.#N(e,t);return h.hasSubscribers&&h.publish(i),r}#N(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=t,n=this.#u.get(e);if(void 0!==n){let e=this.#d[n];if(this.#E(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#j(n))return i&&this.#R(n),r&&(r.has="hit",this.#q(r,n)),!0;r&&(r.has="stale",this.#q(r,n))}else r&&(r.has="miss");return!1}peek(e,t={}){let{status:i=h.hasSubscribers||h.hasSubscribers?{}:void 0}=t;i&&(i.op="peek",i.key=e),t.status=i;let r=this.#V(e,t);return h.hasSubscribers&&h.publish(i),r}#V(e,t){let{status:i,allowStale:r=this.allowStale}=t,n=this.#u.get(e);if(void 0===n||!r&&this.#j(n)){i&&(i.peek=void 0===n?"miss":"stale");return}let o=this.#d[n],l=this.#E(o)?o.__staleWhileFetching:o;return i&&(void 0!==l?(i.peek="hit",i.value=l):i.peek="miss"),l}#F(e,t,i,r){let n=void 0===t?void 0:this.#d[t];if(this.#E(n))return n;let o=new AbortController,{signal:l}=i;l?.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let s={signal:o.signal,options:i,context:r},a=(r,n=!1)=>{let{aborted:l}=o.signal,a=i.ignoreFetchAbort&&void 0!==r,u=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&void 0!==r);if(i.status&&(l&&!n?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,a&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),l&&!a&&!n)return c(o.signal.reason,u);let d=this.#d[t];return(d===h||void 0===d&&a&&n)&&(void 0===r?void 0!==h.__staleWhileFetching?this.#d[t]=h.__staleWhileFetching:this.#I(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#$(e,r,s.options))),r},c=(r,n)=>{let{aborted:l}=o.signal,s=l&&i.allowStaleOnFetchAbort,a=s||i.allowStaleOnFetchRejection,c=a||i.noDeleteOnFetchRejection;if(this.#d[t]===h&&(c&&(n||void 0!==h.__staleWhileFetching)?s||(this.#d[t]=h.__staleWhileFetching):this.#I(e,"fetch")),a)return i.status&&void 0!==h.__staleWhileFetching&&(i.status.returnedStale=!0),h.__staleWhileFetching;if(h.__returned===h)throw r},u=(t,r)=>{let l=this.#o?.(e,n,s);l&&l instanceof Promise&&l.then(e=>t(void 0===e?void 0:e),r),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(t(void 0),i.allowStaleOnFetchAbort&&(t=e=>a(e,!0)))})};i.status&&(i.status.fetchDispatched=!0);let h=new Promise(u).then(a,e=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=e),c(e,!1))),d=Object.assign(h,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return void 0===t?(this.#$(e,d,{...s.options,status:void 0}),t=this.#u.get(e)):this.#d[t]=d,d}#E(e){return!!this.#k&&!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(e,t={}){let i=h.hasSubscribers,{status:r=h.hasSubscribers||h.hasSubscribers?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let n=this.#H(e,t);return r&&(h.hasSubscribers||h.hasSubscribers)&&i&&(r.trace=!0,h.tracePromise(()=>n,r).catch(()=>{})),n}async #H(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:s=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:p,forceRefresh:y=!1,status:b,signal:v}=t;if(b&&(b.op="fetch",b.key=e,y&&(b.forceRefresh=!0)),!this.#k)return b&&(b.fetch="get"),this.#B(e,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:b});let m={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:l,size:s,sizeCalculation:a,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:f,ignoreFetchAbort:d,status:b,signal:v},g=this.#u.get(e);if(void 0===g){b&&(b.fetch="miss");let t=this.#F(e,g,m,p);return t.__returned=t}{let t=this.#d[g];if(this.#E(t)){let e=i&&void 0!==t.__staleWhileFetching;return b&&(b.fetch="inflight",e&&(b.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let n=this.#j(g);if(!y&&!n)return b&&(b.fetch="hit"),this.#M(g),r&&this.#R(g),b&&this.#q(b,g),t;let o=this.#F(e,g,m,p),l=void 0!==o.__staleWhileFetching&&i;return b&&(b.fetch=n?"stale":"refresh",l&&n&&(b.returnedStale=!0)),l?o.__staleWhileFetching:o.__returned=o}}forceFetch(e,t={}){let i=h.hasSubscribers,{status:r=h.hasSubscribers||h.hasSubscribers?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let n=this.#J(e,t);return r&&(h.hasSubscribers||h.hasSubscribers)&&i&&(r.trace=!0,h.tracePromise(()=>n,r).catch(()=>{})),n}async #J(e,t={}){let i=await this.#H(e,t);if(void 0===i)throw Error("fetch() returned undefined");return i}memo(e,t={}){let{status:i=h.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="memo",i.key=e,t.context&&(i.context=t.context));let r=this.#X(e,t);return i&&(i.value=r),h.hasSubscribers&&h.publish(i),r}#X(e,t={}){let i=this.#l;if(!i)throw Error("no memoMethod provided to constructor");let{context:r,status:n,forceRefresh:o,...l}=t;n&&o&&(n.forceRefresh=!0);let s=this.#B(e,l),a=o||void 0===s;if(n&&(n.memo=a?"miss":"hit",a||(n.value=s)),!a)return s;let c=i(e,s,{options:l,context:r});return n&&(n.value=c),this.#$(e,c,l),c}get(e,t={}){let{status:i=h.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="get",i.key=e);let r=this.#B(e,t);return i&&(void 0!==r&&(i.value=r),h.hasSubscribers&&h.publish(i)),r}#B(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=t,l=this.#u.get(e);if(void 0===l){o&&(o.get="miss");return}let s=this.#d[l],a=this.#E(s);return o&&this.#q(o,l),this.#j(l)?a?(o&&(o.get="stale-fetching"),i&&void 0!==s.__staleWhileFetching?(o&&(o.returnedStale=!0),s.__staleWhileFetching):void 0):(n||this.#I(e,"expire"),o&&(o.get="stale"),i?(o&&(o.returnedStale=!0),s):void 0):(o&&(o.get=a?"fetching":"hit"),this.#M(l),r&&this.#R(l),a?s.__staleWhileFetching:s)}#Q(e,t){this.#p[t]=e,this.#f[e]=t}#M(e){e!==this.#b&&(e===this.#y?this.#y=this.#f[e]:this.#Q(this.#p[e],this.#f[e]),this.#Q(this.#b,e),this.#b=e)}delete(e){return this.#I(e,"delete")}#I(e,t){h.hasSubscribers&&h.publish({op:"delete",delete:t,key:e});let i=!1;if(0!==this.#a){let r=this.#u.get(e);if(void 0!==r)if(this.#O?.[r]&&(clearTimeout(this.#O?.[r]),this.#O[r]=void 0),i=!0,1===this.#a)this.#Y(t);else{this.#L(r);let i=this.#d[r];if(this.#E(i)?i.__abortController.abort(Error("deleted")):(this.#x||this.#_)&&(this.#x&&this.#i?.(i,e,t),this.#_&&this.#m?.push([i,e,t])),this.#u.delete(e),this.#h[r]=void 0,this.#d[r]=void 0,r===this.#b)this.#b=this.#p[r];else if(r===this.#y)this.#y=this.#f[r];else{let e=this.#p[r];this.#f[e]=this.#f[r];let t=this.#f[r];this.#p[t]=this.#p[r]}this.#a--,this.#v.push(r)}}if(this.#_&&this.#m?.length){let e=this.#m,t;for(;t=e?.shift();)this.#n?.(...t)}return i}clear(){return this.#Y("delete")}#Y(e){for(let t of this.#T({allowStale:!0})){let i=this.#d[t];if(this.#E(i))i.__abortController.abort(Error("deleted"));else{let r=this.#h[t];this.#x&&this.#i?.(i,r,e),this.#_&&this.#m?.push([i,r,e])}}if(this.#u.clear(),this.#d.fill(void 0),this.#h.fill(void 0),this.#w&&this.#S){for(let e of(this.#w.fill(0),this.#S.fill(0),this.#O??[]))void 0!==e&&clearTimeout(e);this.#O?.fill(void 0)}if(this.#g&&this.#g.fill(0),this.#y=0,this.#b=0,this.#v.length=0,this.#c=0,this.#a=0,this.#_&&this.#m){let e=this.#m,t;for(;t=e?.shift();)this.#n?.(...t)}}};function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function O(e,t,i,r,n,o,l){try{var s=e[o](l),a=s.value}catch(e){i(e);return}s.done?t(a):Promise.resolve(a).then(r,n)}function x(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach(function(t){var r;r=i[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function k(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t})(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}function _(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return w(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return w(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var A=function(e){var t=e.tag,i=e.type,r=e.displayType;return a().createElement("div",null,a().createElement(o.Tag,{color:{reference:"blue",duplicate:"green",preloading:"cyan"}[i]},a().createElement("span",null,t)," ",void 0===r||r?"(".concat({reference:"Reference",duplicate:"Duplicate",preloading:"Preloading"}[i],")"):""))},E=["sort","createdById","createdBy","createdAt","updatedById","updatedBy","updatedAt","password","sequence"];function F(e){var t=e.node,i=e.traverseAssociations,r=e.traverseFields,n=e.systemKeys,o=e.dataSource,l=e.setDataSource,s=function(e,t){for(var i=_(e);i.length;){var r=i.shift();if(r.key===t.key)return r;r.children&&i.push.apply(i,_(r.children))}}(o,t),a=[];return["belongsTo","belongsToMany"].includes(t.field.type)&&(null==t?void 0:t.type)==="reference"?a=i(t.field.target,{exclude:n,prefix:t.key,maxDepth:1}):(["hasOne","hasMany"].includes(t.field.type)||(null==t?void 0:t.type)==="duplicate")&&(a=r(t.field.target,{exclude:["id"].concat(_(n.filter(function(e){return"sort"!==e}))),prefix:t.key,maxDepth:1})),a.length?s.children=a:s.isLeaf=!0,l(_(o)),a}var M=function(e,t,i){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=function(o,l){var s=l.exclude,c=void 0===s?[]:s,u=l.depth,h=void 0===u?0:u,d=l.maxDepth,f=l.prefix,p=void 0===f?"":f;return h>d?[]:_(e.getCollection(i,o).fields.values()).map(function(e){if(!c.includes(e.name)&&e.interface&&!(0===h&&["sort","password","sequence"].includes(e.type))){var i,o={type:"duplicate",tag:t(null==(i=e.uiSchema)?void 0:i.title)||e.name},l=k(x({},o),{role:"button",title:a().createElement(A,k(x({},o),{displayType:!0})),key:p?"".concat(p,".").concat(e.name):e.name,isLeaf:!0,field:e});return["belongsTo","belongsToMany"].includes(e.type)?(o.type="reference",l.type="reference",l.title=a().createElement(A,k(x({},o),{type:"reference",displayType:!0})),l.isLeaf=!1,l.children=n(e.target,{depth:h+1,maxDepth:d,prefix:l.key,exclude:E})):["hasOne","hasMany"].includes(e.type)&&(l.isLeaf=!1,l.children=r(e.target,{depth:h+1,maxDepth:d,prefix:l.key,exclude:["id"].concat(_(E.filter(function(e){return"sort"!==e})))})),l}}).filter(Boolean)},n=function(r,o){var l,s=o.prefix,c=o.maxDepth,u=o.depth,h=void 0===u?0:u,d=o.exclude,f=void 0===d?[]:d;return h>c||!e.getCollection(i,r)?[]:_((null==(l=e.getCollection(i,r))?void 0:l.fields.values())||[]).map(function(e){if(e.target&&e.interface&&!f.includes(e.name)){var i,r={type:"preloading",tag:t(null==(i=e.uiSchema)?void 0:i.title)||e.name},o=s?"".concat(s,".").concat(e.name):e.name;return{role:"button",title:a().createElement(A,k(x({},r),{displayType:!0})),key:o,isLeaf:!1,field:e,children:n(e.target,{prefix:o,depth:h+1,maxDepth:c,exclude:f})}}}).filter(Boolean)};return{getEnableFieldTree:function(e){try{return r(e,{exclude:["id"].concat(_(E)),maxDepth:1})}catch(e){return console.error(e),[]}},getOnLoadData:function(e,t){return function(i){return new Promise(function(o){if(i.children.length)return i.children.forEach(function(i){F({node:i,traverseAssociations:n,traverseFields:r,systemKeys:E,dataSource:e,setDataSource:t})}),o(void 0);F({node:i,traverseAssociations:n,traverseFields:r,systemKeys:E,dataSource:e,setDataSource:t}),o(void 0)})}},getOnCheck:function(e){return function(t){e.value=t}}}},D=function(e,t,i,r,n){var o,l=(o=new S({max:50}),function(r,n,c){var u=n.exclude,h=void 0===u?[]:u,d=n.depth,f=void 0===d?0:d,p=n.maxDepth,y=n.prefix,b=void 0===y?"":y,v=n.disabled,m=void 0!==v&&v;if(f>p)return[];var g=Array.isArray(c)?c:[],S=(e.getCollection(i,r)?_(e.getCollection(i,r).fields.values()):[]).map(function(e){if(!h.includes(e.name)&&e.interface&&!["sort","password","sequence"].includes(e.type)){var i,r={type:"duplicate",tag:t(null==(i=e.uiSchema)?void 0:i.title)||e.name},n=k(x({},r),{title:a().createElement(A,r),key:b?"".concat(b,".").concat(e.name):e.name,isLeaf:!0,field:e,disabled:m}),o=g.find(function(e){return(null==e?void 0:e.name)===n.key});if(!["belongsTo","belongsToMany"].includes(e.type)||o&&(null==o?void 0:o.updateAssociation)){if(["hasOne","hasMany"].includes(e.type)||(null==o?void 0:o.updateAssociation)){var c=!1;!["hasOne","hasMany"].includes(e.type)||(null==o?void 0:o.updateAssociation)||(c=!0),n.disabled=!0,n.isLeaf=!1,n.children=l(e.target,{depth:f+1,maxDepth:p,prefix:n.key,exclude:["id"].concat(_(E.filter(function(e){return"sort"!==e}))),disabled:c},g)}}else r.type="reference",n.type="reference",n.title=a().createElement(A,k(x({},r),{type:"reference"})),n.isLeaf=!1,n.children=s(e.target,{depth:f+1,maxDepth:p,prefix:n.key,exclude:E});return n}}).filter(Boolean);return o.set(r+JSON.stringify(g),S),S}),s=function(r,n){var o,l=n.prefix,c=n.maxDepth,u=n.depth,h=void 0===u?0:u,d=n.exclude,f=void 0===d?[]:d;return h>c||!e.getCollection(i,r)?[]:_((null==(o=e.getCollection(i,r))?void 0:o.fields.values())||[]).map(function(e){if(e.target&&e.interface&&!f.includes(e.name)){var i,r={type:"preloading",tag:t(null==(i=e.uiSchema)?void 0:i.title)||e.name},n=l?"".concat(l,".").concat(e.name):e.name;return{title:a().createElement(A,r),key:n,disabled:!0,isLeaf:!1,field:e,children:s(e.target,{prefix:n,depth:h+1,maxDepth:c,exclude:f})}}}).filter(Boolean)};return{run:function(e){var t;return(t=function(){var t,i,o,s;return function(e,t){var i,r,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(l,"next",{value:a(0)}),s(l,"throw",{value:a(1)}),s(l,"return",{value:a(2)}),"function"==typeof Symbol&&s(l,Symbol.iterator,{value:function(){return this}}),l;function a(s){return function(a){var c=[s,a];if(i)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(i=1,r&&(n=2&c[0]?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){o.label=c[1];break}if(6===c[0]&&o.label<n[1]){o.label=n[1],n=c;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(c);break}n[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{i=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(a){return(null==e?void 0:e.mapSubModels)?(t=new Set,i=new Set,(o=function(e,r){var n;null==e||null==(n=e.mapSubModels)||n.call(e,r,function(e){var r,n,l;e.collectionField&&!(["hasOne","hasMany"].includes(e.collectionField.type)||(null==(r=e.subModels.field)?void 0:r.updateAssociation))&&i.add(e.fieldPath),e.collectionField&&e.collectionField.isAssociationField()&&(t.add({name:e.fieldPath,updateAssociation:null==(n=e.subModels.field)?void 0:n.updateAssociation}),(null==(l=e.subModels.field)?void 0:l.updateAssociation)&&(e.subModels.field.subModels.grid?o(e.subModels.field.subModels.grid,"items"):e.subModels.field.subModels.subTableColumns?o(e.subModels.field,"subTableColumns"):e.subModels.field.subModels.columns&&o(e.subModels.field,"columns")))})})(e,"items"),s=l(r,{exclude:["id"].concat(_(E)),maxDepth:1},_(t)),null==n||n(s,_(i))):null==n||n([],[]),[2]})},function(){var e=this,i=arguments;return new Promise(function(r,n){var o=t.apply(e,i);function l(e){O(o,r,n,l,s,"next",e)}function s(e){O(o,r,n,l,s,"throw",e)}l(void 0)})})()}}};function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function j(e,t,i,r,n,o,l){try{var s=e[o](l),a=s.value}catch(e){i(e);return}s.done?t(a):Promise.resolve(a).then(r,n)}function C(e){return function(){var t=this,i=arguments;return new Promise(function(r,n){var o=e.apply(t,i);function l(e){j(o,r,n,l,s,"next",e)}function s(e){j(o,r,n,l,s,"throw",e)}l(void 0)})}}function P(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach(function(t){P(e,t,i[t])})}return e}function I(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t})(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],l=!0,s=!1;try{for(n=n.call(e);!(l=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);l=!0);}catch(e){s=!0,r=e}finally{try{l||null==n.return||n.return()}finally{if(s)throw r}}return o}}(e,t)||G(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e){return function(e){if(Array.isArray(e))return T(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||G(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(e,t){if(e){if("string"==typeof e)return T(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);if("Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return T(e,t)}}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(U=function(){return!!e})()}function K(e,t){var i,r,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(l,"next",{value:a(0)}),s(l,"throw",{value:a(1)}),s(l,"return",{value:a(2)}),"function"==typeof Symbol&&s(l,Symbol.iterator,{value:function(){return this}}),l;function a(s){return function(a){var c=[s,a];if(i)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(i=1,r&&(n=2&c[0]?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){o.label=c[1];break}if(6===c[0]&&o.label<n[1]){o.label=n[1],n=c;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(c);break}n[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{i=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var B=(0,r.connect)(o.Tree,(0,r.mapProps)(function(e,t){var i=e.loadData;(0,s.useEffect)(function(){t.value=e.defaultCheckedKeys||[]},[]);var n=L((0,s.useState)((null==e?void 0:e.treeData)||[]),2),o=n[0],l=n[1],a=L((0,s.useState)(e.defaultCheckedKeys||[]),2),c=a[0],u=a[1],h=function(e){u(e),t.value=e};t.onCheck=h;var d=(0,r.useForm)();return(0,s.useEffect)(function(){var i=e.getEnableFieldTree(d.values.collection);l(i),t.dataSource=i},[d.values.collection]),(0,s.useEffect)(function(){l(t.dataSource)},[t.dataSource]),I(R({},e),{checkedKeys:c,onCheck:h,loadData:i(o,l),treeData:o.map(function(e){if("quickDulicate"===d.values.duplicateMode){var t,i=null==e||null==(t=e.children)?void 0:t.map(function(e){return I(R({},e),{disabled:!1})});return I(R({},e),{disabled:!1,children:i})}return e})})}));function $(i){var r=i.options,o=(0,t.useFlowViewContext)(),l=(0,n.useRequest)(function(){return C(function(){var e;return K(this,function(t){switch(t.label){case 0:return[4,o.engine.loadOrCreateModel(r,{delegateToParent:!1,delegate:o,skipSave:!o.flowSettingsEnabled})];case 1:return e=t.sent(),(null==r?void 0:r.scene)&&(e.actionName=r.scene),[2,e]}})})()},{refreshDeps:[o,r]}),s=l.data;return!l.loading&&(null==s?void 0:s.uid)?a().createElement(t.FlowModelRenderer,{model:s,fallback:a().createElement(e.SkeletonFallback,{style:{margin:16}})}):a().createElement(e.SkeletonFallback,{style:{margin:16}})}function N(e){var i=e.model,r=e.scene,n=(0,t.useFlowContext)(),o=n.view,l=o.Header,s=o.type;i._closeView=n.view.close;var c=n.t("Duplicate record");return a().createElement("div",null,a().createElement(l,{title:"dialog"===s?a().createElement("div",{style:{padding:"".concat(n.themeToken.paddingLG,"px ").concat(n.themeToken.paddingLG,"px 0"),marginBottom:-n.themeToken.marginSM,backgroundColor:"var(--colorBgLayout)"}},c):c}),a().createElement($,{options:{parentId:n.view.inputArgs.parentId,subKey:"deplicate.edit-form-grid-block",async:!0,delegateToParent:!1,subType:"object",use:"BlockGridModel",scene:void 0===r?"create":r}}))}var V=function(e){var i;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,i,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return i=r,n=arguments,i=z(i),P(e=function(e,t){var i;if(t&&("object"==((i=t)&&"u">typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,U()?Reflect.construct(i,n||[],z(this).constructor):i.apply(this,n)),"duplicateLoading",!1),P(e,"defaultProps",{type:"link",title:(0,t.tExpr)("Duplicate"),duplicateFields:[]}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&q(r,e),i=[{key:"getAclActionName",value:function(){return"create"}},{key:"onClick",value:function(e){"quickDulicate"===this.props.duplicateMode?this.dispatchEvent("quickCreateClick",R({event:e},this.getInputArgs()),{debounce:!0}):this.dispatchEvent("openDuplicatePopup",R({event:e},this.getInputArgs()),{debounce:!0})}},{key:"getTitle",value:function(){return this.duplicateLoading?this.context.t("Duplicating"):this.props.title||this.context.t("Duplicate")}}],function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,i),r}(e.ActionModel);function H(e,t){return C(function(){var i,r;return K(this,function(n){switch(n.label){case 0:if(!(null==t?void 0:t.dataId)||(null==(i=t.fields)?void 0:i.length)===0)return[2];return[4,e.runAction("get",{params:{filterByTk:t.dataId,fields:t.fields,isTemplate:!0}})];case 1:return[2,null==(r=n.sent())?void 0:r.data]}})})()}function J(e,t,i,r,n,o,l){try{var s=e[o](l),a=s.value}catch(e){i(e);return}s.done?t(a):Promise.resolve(a).then(r,n)}function X(e,t,i){return(X=ee()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return i&&Y(n,i.prototype),n}).apply(null,arguments)}P(V,"scene",e.ActionSceneEnum.record),V.define({label:(0,t.tExpr)("Duplicate"),sort:60}),V.registerFlow({key:"duplicateModeSettings",steps:{duplicateMode:{title:(0,t.tExpr)("Duplicate mode",{ns:c}),uiSchema:function(e){var t,n,o,s=e.t,c=(e.dataSourceManager.getDataSource("main").collectionManager.getAllCollectionsInheritChain(e.blockModel.collection.name)||[]).map(function(t){var i;return{label:null==(i=e.dataSourceManager.getDataSource("main").collectionManager.getCollection(t))?void 0:i.title,value:t}}),u=(0,l.cloneDeep)((null==(t=e.model.props)?void 0:t.duplicateFields)||[]),h=function(e,t){for(var i=0;i<(null==e?void 0:e.length);i++){var r=e[i],n=r.children,o=function(e,t){if(null==e)return{};var i,r,n,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(n=0,i=Reflect.ownKeys(Object(e));n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var i,r,n={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)i=o[r],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i]);return n}(e,t),Object.getOwnPropertySymbols)for(n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(r,["children"]);t.push(o.key),n&&h(n,t)}return t},d=M(e.dataSourceManager,s,e.blockModel.collection.dataSourceKey),f=d.getEnableFieldTree,p=d.getOnLoadData,y=d.getOnCheck;return e.model.flowEngine.flowSettings.registerScopes({collectionName:(null==(n=e.record)?void 0:n.__collection)||e.blockModel.collection.name,currentCollection:(null==(o=e.record)?void 0:o.__collection)||e.blockModel.collection.name,getOnLoadData:p,getOnCheck:y,treeData:[],duplicateValues:u,onFieldInputValueChange:i.onFieldInputValueChange}),{duplicateMode:{"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{value:"quickDulicate",label:'{{t("Direct duplicate")}}'},{value:"continueduplicate",label:'{{t("Copy into the form and continue to fill in")}}'}]},collection:{type:"string",title:'{{ t("Target collection") }}',required:!0,description:s("If collection inherits, choose inherited collections as templates"),"x-display":c.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:c},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{disabled:'{{ $deps[0]==="quickDulicate" }}',value:'{{ $deps[0]==="quickDulicate"? currentCollection:collectionName }}'}}},function(t){if("quickDulicate"===t.form.values.duplicateMode){var i;t.form.setValuesIn("collection",(null==(i=e.record)?void 0:i.__collection)||e.blockModel.collection.name)}}]},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":function(){var t,i,n,o,l=null==(i=(n=e.model).getStepParams)||null==(t=i.call(n,"popupSettings","openView"))?void 0:t.uid,c=(0,r.useForm)(),u=D(e.dataSourceManager,e.t,e.blockModel.collection.dataSourceKey,(null==(o=e.record)?void 0:o.__collection)||e.blockModel.collection.name,function(t,i){c.query("duplicateFields").take(function(r){r.dataSource=t,r.componentProps.defaultCheckedKeys=i,r.setInitialValue(i),null==r||r.onCheck(i),e.message.success(s("Sync successfully"))})}).run;return a().createElement("a",{onClick:function(){return C(function(){var t,i,r;return K(this,function(n){switch(n.label){case 0:if(!l)return[3,3];return[4,e.engine.loadModel({parentId:l,refresh:!0})];case 1:return t=n.sent(),[4,e.engine.loadModel({parentId:t.subModels.tabs[0].uid})];case 2:if(!(i=n.sent()))return[2];return u(i.subModels.items[0].subModels.grid),[3,5];case 3:return[4,e.engine.loadModel({parentId:e.model.uid,refresh:!0})];case 4:if(!(r=n.sent()))return[2];u(r.subModels.items[0].subModels.grid),n.label=5;case 5:return[2]}})})()},style:{float:"right",position:"relative",zIndex:1200}},s("Sync from form fields"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]!=="quickDulicate" }}'}}}]},selectAll:{type:"void",title:'{{ t("Select all") }}',"x-component":function(){var e=(0,r.useForm)();return a().createElement("a",{onClick:function(){e.query("duplicateFields").take(function(e){var t,i=h(e.dataSource,[]);e.componentProps.defaultCheckedKeys=i,e.setInitialValue(i),null==e||null==(t=e.onCheck)||t.call(e,i)})},style:{float:"right",position:"relative",zIndex:1200}},s("Select all"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]==="quickDulicate"}}'}}}]},unselectAll:{type:"void",title:'{{ t("UnSelect all") }}',"x-component":function(){var e=(0,r.useForm)();return a().createElement("a",{style:{float:"right",position:"relative",zIndex:1200,marginRight:"10px"},onClick:function(){e.query("duplicateFields").take(function(e){e.componentProps.defaultCheckedKeys=[],e.setInitialValue([]),null==e||e.onCheck([])})}},s("UnSelect all"))},"x-reactions":[{dependencies:[".duplicateMode",".duplicateFields"],fulfill:{state:{visible:"{{ $deps[0]===\"quickDulicate\"&&$form.getValuesIn('duplicateFields').length>0 }}"}}}]},duplicateFields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:s("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":B,"x-component-props":{defaultCheckedKeys:u,treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:p,onCheck:"{{ getOnCheck($self) }}",getEnableFieldTree:f,rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection"],fulfill:{state:{disabled:"{{ !$deps[0] }}"}}}]}}},defaultParams:function(e){var t;return{duplicateMode:"quickDulicate",collection:(null==(t=e.record)?void 0:t.__collection)||e.blockModel.collection.name}},handler:function(e,t){return C(function(){var i,r,n,o,l;return K(this,function(s){return i=t.duplicateMode,r=t.duplicateFields,n=t.collection,o=t.treeData,l=Array.isArray(r)?r:(null==r?void 0:r.checked)||[],e.model.setProps({duplicateMode:i,duplicateFields:l,duplicateCollection:n,treeData:o}),[2]})})()}}}}),V.registerFlow({key:"duplicateSettings",title:(0,t.tExpr)("Duplicate mode settings"),on:"quickCreateClick",steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,i,r;return"quickDulicate"!==(null==(i=(r=e.model).getStepParams)||null==(t=i.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,t.tExpr)("Duplicate record"),content:(0,t.tExpr)("Are you sure you want to duplicate it?")}},duplicate:{handler:function(e,i){return C(function(){var r,n,o,l,s,a,u,h;return K(this,function(d){switch(d.label){case 0:if(!(null==(o=void 0===(n=e.model.props.duplicateFields)?[]:n)?void 0:o.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:c})),[2];if(e.model.duplicateLoading)return[2];return e.model.duplicateLoading=!0,e.model.rerender(),l=e.blockModel.collection.filterTargetKey,s={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(r=Object).assign.apply(r,[{}].concat(W(l.map(function(t){return P({},t,e.record[t])})))):e.record[l]||e.record.id,default:!0,fields:(null==o?void 0:o.filter(function(t){return"string"==typeof t&&W(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},a=e.createResource(t.MultiRecordResource),u=e.blockModel.collection.dataSourceKey,a.setDataSourceKey(u),a.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,H(a,s)];case 1:return h=d.sent(),[4,e.blockModel.resource.create(R({},h),i.requestConfig)];case 2:return d.sent(),e.message.success(e.t("Saved successfully")),e.model.duplicateLoading=!1,e.model.rerender(),[2]}})})()}}}}),V.registerFlow({key:"popupSettings",on:{eventName:"openDuplicatePopup"},sort:300,steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,i,r;return"quickDulicate"===(null==(i=(r=e.model).getStepParams)||null==(t=i.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,t.tExpr)("Duplicate record"),content:(0,t.tExpr)("Are you sure you want to duplicate it?")}},openView:{title:(0,t.tExpr)("Edit popup"),hideInSettings:function(e){var t,i,r;return"quickDulicate"===(null==(i=(r=e.model).getStepParams)||null==(t=i.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},use:"openView",defaultParams:{mode:"drawer",size:"medium"},handler:function(e,i){return C(function(){var r,n,o,l,s,u,h,d,f,p,y,b,v,m,g,S,w,O,x,k;return K(this,function(_){switch(_.label){case 0:return[4,e.model.dispatchEvent("beforeRender")];case 1:if(_.sent(),!(null==(s=void 0===(l=e.model.props.duplicateFields)?[]:l)?void 0:s.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:c})),[2];return u={drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}},h=(null==(n=e.inputArgs)?void 0:n.mode)||(null==i?void 0:i.mode)||"drawer",d=(null==(o=e.inputArgs)?void 0:o.size)||(null==i?void 0:i.size)||"medium",f=e.blockModel.collection.filterTargetKey,p={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(r=Object).assign.apply(r,[{}].concat(W(f.map(function(t){return P({},t,e.record[t])})))):e.record[f]||e.record.id,default:!0,fields:(null==s?void 0:s.filter(function(t){return"string"==typeof t&&W(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},y=e.createResource(t.MultiRecordResource),b=e.blockModel.collection.dataSourceKey,y.setDataSourceKey(b),y.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,H(y,p)];case 2:if(v=_.sent(),m="string"==typeof(null==i?void 0:i.popupTemplateUid)?i.popupTemplateUid.trim():"",g="string"==typeof(null==i?void 0:i.uid)?i.uid.trim():"",S=!!m||!!g&&g!==e.model.uid,w=(null==i?void 0:i.viewUid)||e.blockModel.uid,O=(null==i?void 0:i.dataSourceKey)||e.blockModel.collection.dataSourceKey,x=(null==i?void 0:i.collectionName)||e.record.__collection||e.blockModel.collection.name,!S)return[3,4];return k=I(R({},i||{}),{navigation:!1,scene:"new",formData:v,viewUid:w,dataSourceKey:O,collectionName:x}),g&&(k.uid=g),[4,e.runAction("openView",k)];case 3:return _.sent(),[2];case 4:return e.viewer.open({type:h,width:u[h][d],inheritContext:!1,target:e.layoutContentElement,inputArgs:{parentId:e.model.uid,scene:"new",dataSourceKey:O,collectionName:x,formData:v,viewUid:w},content:function(){return a().createElement(N,{model:e.model,scene:"create"})},styles:{content:R({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===h?{position:"absolute",top:0,left:0,right:0,bottom:0}:{}),body:{padding:0}}}),[2]}})})()}}}}),e.RecordActionGroupModel.registerActionModels({DuplicateActionModel:V});function Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Y(e,t){return(Y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Z(e){var t="function"==typeof Map?new Map:void 0;return(Z=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return X(e,arguments,Q(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Y(i,e)})(e)}function ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ee=function(){return!!e})()}var et=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,t=arguments,e=Q(e),function(e,t){var i;if(t&&("object"==((i=t)&&"u">typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,ee()?Reflect.construct(e,t||[],Q(this).constructor):e.apply(this,t))}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&Y(i,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var i,r,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(l,"next",{value:a(0)}),s(l,"throw",{value:a(1)}),s(l,"return",{value:a(2)}),"function"==typeof Symbol&&s(l,Symbol.iterator,{value:function(){return this}}),l;function a(s){return function(a){var c=[s,a];if(i)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(i=1,r&&(n=2&c[0]?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){o.label=c[1];break}if(6===c[0]&&o.label<n[1]){o.label=n[1],n=c;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(c);break}n[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{i=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(e){return this.app.flowEngine.registerModels({DuplicateActionModel:V}),[2]})},function(){var t=this,i=arguments;return new Promise(function(r,n){var o=e.apply(t,i);function l(e){J(o,r,n,l,s,"next",e)}function s(e){J(o,r,n,l,s,"throw",e)}l(void 0)})}).call(this)}}],function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,t),i}(Z(e.Plugin)),ei=et}(),y}()});
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const NAMESPACE = "action-duplicate";
@@ -10,14 +10,15 @@
10
10
  module.exports = {
11
11
  "@formily/core": "2.3.7",
12
12
  "@formily/react": "2.3.7",
13
- "@nocobase/client": "2.1.0-beta.32",
13
+ "@nocobase/client": "2.1.0-beta.33",
14
14
  "antd": "5.24.2",
15
15
  "lodash": "4.18.1",
16
16
  "react": "18.2.0",
17
17
  "react-i18next": "11.18.6",
18
18
  "@emotion/css": "11.13.0",
19
- "@nocobase/server": "2.1.0-beta.32",
20
- "@nocobase/test": "2.1.0-beta.32",
21
- "@nocobase/flow-engine": "2.1.0-beta.32",
22
- "@formily/antd-v5": "1.2.3"
19
+ "@nocobase/flow-engine": "2.1.0-beta.33",
20
+ "@nocobase/client-v2": "2.1.0-beta.33",
21
+ "ahooks": "3.7.8",
22
+ "@nocobase/server": "2.1.0-beta.33",
23
+ "@nocobase/test": "2.1.0-beta.33"
23
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-action-duplicate",
3
- "version": "2.1.0-beta.32",
3
+ "version": "2.1.0-beta.33",
4
4
  "main": "dist/server/index.js",
5
5
  "homepage": "https://docs.nocobase.com/handbook/action-duplicate",
6
6
  "homepage.ru-RU": "https://docs.nocobase.ru/handbook/action-duplicate",
@@ -24,10 +24,11 @@
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@nocobase/client": "2.x",
27
+ "@nocobase/client-v2": "2.x",
27
28
  "@nocobase/server": "2.x",
28
29
  "@nocobase/test": "2.x"
29
30
  },
30
- "gitHead": "659c5efe992da7118d33c768bbd9e837a2c4716f",
31
+ "gitHead": "4815c394e80a264fa8ed619246280923c47aeb72",
31
32
  "keywords": [
32
33
  "Actions"
33
34
  ]
File without changes