@nocobase/plugin-file-manager 2.2.0-beta.8 → 2.2.0
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/dist/client/UseOriginalUrlRadio.d.ts +12 -0
- package/dist/client/index.js +1 -1
- package/dist/client/schemas/storageTypes/ali-oss.d.ts +12 -0
- package/dist/client/schemas/storageTypes/common.d.ts +12 -0
- package/dist/client/schemas/storageTypes/index.d.ts +48 -0
- package/dist/client/schemas/storageTypes/local.d.ts +12 -0
- package/dist/client/schemas/storageTypes/s3.d.ts +12 -0
- package/dist/client/schemas/storageTypes/tx-cos.d.ts +12 -0
- package/dist/client-v2/125.9cdb7cf3ef4712ef.js +10 -0
- package/dist/client-v2/{229.bd72c2d7aa088310.js → 229.297c431f63a29cb2.js} +1 -1
- package/dist/client-v2/{336.1dd1b32466d0c778.js → 336.04d06f2cdcc3d0b5.js} +1 -1
- package/dist/client-v2/{43.eb45d53ba3e9828b.js → 43.1ec3e5bf1118d239.js} +1 -1
- package/dist/client-v2/450.d49b00f3c0388c74.js +10 -0
- package/dist/client-v2/{929.d7e783304cc1f236.js → 929.3744119eff70b3a3.js} +1 -1
- package/dist/client-v2/components/PublicAccessField.d.ts +19 -0
- package/dist/client-v2/components/UseOriginalUrlField.d.ts +25 -0
- package/dist/client-v2/components/index.d.ts +2 -0
- package/dist/client-v2/index.d.ts +4 -2
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/interfaces/attachment.d.ts +76 -0
- package/dist/client-v2/models/DisplayPreviewFieldModel.d.ts +22 -0
- package/dist/client-v2/models/UploadActionModel.d.ts +26 -0
- package/dist/client-v2/previewer/filePreviewTypes.d.ts +15 -1
- package/dist/externalVersion.js +13 -10
- package/dist/locale/de-DE.json +7 -0
- package/dist/locale/en-US.json +7 -0
- package/dist/locale/es-ES.json +7 -0
- package/dist/locale/fr-FR.json +7 -0
- package/dist/locale/hu-HU.json +7 -0
- package/dist/locale/id-ID.json +7 -0
- package/dist/locale/it-IT.json +7 -0
- package/dist/locale/ja-JP.json +7 -0
- package/dist/locale/ko-KR.json +7 -0
- package/dist/locale/nl-NL.json +7 -0
- package/dist/locale/pt-BR.json +7 -0
- package/dist/locale/ru-RU.json +7 -0
- package/dist/locale/tr-TR.json +7 -0
- package/dist/locale/uk-UA.json +7 -0
- package/dist/locale/vi-VN.json +7 -0
- package/dist/locale/zh-CN.json +7 -0
- package/dist/locale/zh-TW.json +7 -0
- package/dist/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +59 -116
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js +59 -116
- package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -1
- package/dist/node_modules/@aws-sdk/s3-request-presigner/LICENSE +201 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/index.js +11113 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-es/constants.js +9 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-es/getSignedUrl.js +66 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-es/index.js +2 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-es/presigner.js +58 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-types/constants.d.ts +9 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-types/getSignedUrl.d.ts +6 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-types/index.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-types/presigner.d.ts +15 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-types/ts3.4/constants.d.ts +9 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-types/ts3.4/getSignedUrl.d.ts +11 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-types/ts3.4/index.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/dist-types/ts3.4/presigner.d.ts +40 -0
- package/dist/node_modules/@aws-sdk/s3-request-presigner/package.json +1 -0
- package/dist/node_modules/ali-oss/package.json +1 -1
- package/dist/node_modules/cos-nodejs-sdk-v5/package.json +1 -1
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mime-types/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/url-join/package.json +1 -1
- package/dist/server/actions/attachments.js +21 -1
- package/dist/server/actions/get-file.d.ts +13 -0
- package/dist/server/actions/get-file.js +152 -0
- package/dist/server/actions/index.d.ts +1 -3
- package/dist/server/actions/index.js +8 -1
- package/dist/server/commands/repair-filenames.js +34 -14
- package/dist/server/file-access.d.ts +11 -0
- package/dist/server/file-access.js +134 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +7 -1
- package/dist/server/resolve-file-access-filter.d.ts +11 -0
- package/dist/server/resolve-file-access-filter.js +63 -0
- package/dist/server/server.d.ts +23 -2
- package/dist/server/server.js +116 -15
- package/dist/server/storages/ali-oss.d.ts +2 -1
- package/dist/server/storages/ali-oss.js +12 -0
- package/dist/server/storages/index.d.ts +15 -2
- package/dist/server/storages/index.js +28 -5
- package/dist/server/storages/local.d.ts +2 -2
- package/dist/server/storages/local.js +9 -3
- package/dist/server/storages/s3.d.ts +2 -1
- package/dist/server/storages/s3.js +14 -0
- package/dist/server/storages/tx-cos.d.ts +2 -1
- package/dist/server/storages/tx-cos.js +27 -0
- package/dist/server/temporary-access.d.ts +31 -0
- package/dist/server/temporary-access.js +170 -0
- package/dist/server/utils.d.ts +27 -0
- package/dist/server/utils.js +83 -2
- package/package.json +5 -3
- package/dist/client-v2/125.0b8eef1f19b87042.js +0 -10
- package/dist/client-v2/450.c060947ac34d26e1.js +0 -10
package/dist/client-v2/index.js
CHANGED
|
@@ -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/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager/client-v2",["react-i18next","@emotion/css","@formily/react","@ant-design/icons","@nocobase/flow-engine","ahooks","@nocobase/client-v2","react","antd","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager/client-v2"]=t(require("react-i18next"),require("@emotion/css"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("lodash")):e["@nocobase/plugin-file-manager/client-v2"]=t(e["react-i18next"],e["@emotion/css"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.ahooks,e["@nocobase/client-v2"],e.react,e.antd,e.lodash)}(self,function(e,t,n,r,o,i,a,l,c,u){return function(){var s,f,p,d={484:function(e,t,n){var r=n(986),o=/[\/\+\.]/;e.exports=function(e,t){function n(t){var n=r(t,e,o);return n&&n.length>=2}return t?n(t.split(";")[0]):n}},986:function(e){"use strict";function t(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}t.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(t=0,n=(e||"").split(this.separator);r&&t<i;t++)if("*"===o[t])continue;else r=t<n.length&&o[t]===n[t];r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var a in r={},e)this.match(a)&&(r[a]=e[a]);return r},e.exports=function(e,n,r){var o=new t(e,r||/[\/\.]/);return void 0!==n?o.match(n):o}},76:function(e,t,n){"use strict";n.r(t),n.d(t,{UploadFieldModel:function(){return M},CardUpload:function(){return I}});var r=n(375),o=n(477),i=n(59),a=n(773),l=n(953),c=n(694),u=n(155),s=n.n(u),f=n(230),p=n(485),d=n(23);function m(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}var y=function(e,t){var n,r,o,i,a=null==e?void 0:e.response,l=null!=(n=null==e?void 0:e.id)?n:null==a?void 0:a.id,c=null!=(r=null==e?void 0:e.url)?r:null==a?void 0:a.url,u=null!=(o=null==e?void 0:e.filename)?o:null==a?void 0:a.filename,s=null!=(i=null==e?void 0:e.name)?i:null==a?void 0:a.name;return null!=l?"id:".concat(String(l)):null!=c?"url:".concat(c):null!=u?"filename:".concat(u,":").concat(t):null!=s?"name:".concat(s,":").concat(t):(null==e?void 0:e.uid)?"uid:".concat(e.uid):"index:".concat(t)},g=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map(t.map(function(e,t){return[y(e,t),e.uid]}).filter(function(e){return!!(function(e){if(Array.isArray(e))return e}(e)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return m(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 m(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1]}));return e.map(function(e,t){var r,o,i,a=y(e,t);return r=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}({},e),o=o={uid:e.uid||n.get(a)||a,thumbUrl:null!=(i=e.thumbUrl)?i:(0,d.qk)(e)},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r})},v=function(e,t){var n=e.findIndex(function(e){return e.uid===(null==t?void 0:t.uid)});return n>=0?n:0};function h(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 b(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function w(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){b(i,r,o,a,l,"next",e)}function l(e){b(i,r,o,a,l,"throw",e)}a(void 0)})}}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e,t,n){return(O="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=S(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(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){x(e,t,n[t])})}return e}function E(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 P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,t)||C(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 F(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(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 C(e,t){if(e){if("string"==typeof e)return h(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 h(e,t)}}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function R(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function T(){var e,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n }\n }\n .ant-upload-select {\n margin: ",";\n }\n ","\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return T=function(){return n},n}var I=function(e){var t,n=e.allowSelectExistingRecord,c=e.multiple,p=e.value,m=e.disabled,y=e.onSelectExitRecordClick,h=e.quickUpload,b=e.showFileName,x=k((0,u.useState)(function(){return g((0,a.castArray)(p||[]))}),2),O=x[0],S=x[1],P=k((0,u.useState)(!1),2),F=P[0],C=P[1],_=k((0,u.useState)(null),2),I=_[0],M=_[1],D=k((0,u.useState)(0),2),A=D[0],L=D[1],U=(0,l.useTranslation)().t;(0,u.useLayoutEffect)(function(){S(function(e){return g((0,a.castArray)(p||[]),e)})},[p]);var q=(t=O.length,!!c||0===t);return s().createElement(f.FieldContext.Provider,{value:{value:O}},s().createElement("div",{style:{display:"flex"},className:(0,o.css)(T(),b?"8px 0px":"0px",b?"8px 0px":"0px",c?"":"\n .ant-upload-list-item-container.ant-upload-animate-inline-appear,\n .ant-upload-list-item-container.ant-upload-animate-inline-appear-active,\n .ant-upload-list-item-container.ant-upload-animate-inline-enter,\n .ant-upload-list-item-container.ant-upload-animate-inline-enter-active {\n animation: none !important;\n transition: none !important;\n transform: none !important;\n opacity: 1 !important;\n }\n\n .ant-upload.ant-upload-animate-inline-leave,\n .ant-upload.ant-upload-animate-inline-leave-active {\n animation: none !important;\n transition: none !important;\n }\n ")},s().createElement(i.Upload,E(j({onPreview:function(e){return w(function(){var t;return R(this,function(n){switch(n.label){case 0:var r;if(t=v(O,e),!(!e.url&&!e.preview))return[3,2];return[4,(r=e.originFileObj,new Promise(function(e,t){var n=new FileReader;n.readAsDataURL(r),n.onload=function(){return e(n.result)},n.onerror=function(e){return t(e)}}))];case 1:e.preview=n.sent(),n.label=2;case 2:return M(e),L(t),C(!0),[2]}})})()}},e),{listType:"picture-card",fileList:O,onChange:function(t){var n=t.fileList;S(function(e){return g(n,e)});var r=n.filter(function(e){return"done"===e.status||e.id});if(n.every(function(e){return"done"===e.status||e.id}))if(1===e.maxCount){var o=r[0];e.onChange(o?o.response:null)}else e.onChange(r.map(function(e){return e.response||e}).filter(Boolean))},itemRender:function(e,t){return s().createElement(s().Fragment,null,e,b&&s().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:t.filename},t.filename))}}),(void 0===h||h)&&q?s().createElement(r.UploadOutlined,{style:{fontSize:20}}):null),I&&s().createElement(d.Mo,{open:F,file:I,list:O,index:A,onOpenChange:C,onClose:function(){return M(null)},onSwitchIndex:function(e){e<0||e>=O.length||(L(e),M(O[e]))},onDownload:function(e){var t=e||I;if(t){var n=t.url||t.preview;if(n){var r=(0,d.ub)(t,n);fetch(n).then(function(e){return e.blob()}).then(function(e){var t=URL.createObjectURL(new Blob([e])),n=document.createElement("a");n.href=t,n.download=r,document.body.appendChild(n),n.click(),URL.revokeObjectURL(t),n.remove()})}}}}),n&&q?s().createElement("div",{style:{marginLeft:5}},s().createElement(i.Upload,{disabled:m,multiple:c,listType:"picture-card",showUploadList:!1},s().createElement("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},onClick:function(e){m||(e.stopPropagation(),e.preventDefault(),y())}},s().createElement(r.PlusOutlined,null),U("Select")))):null))},M=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=S(t),x(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,_()?Reflect.construct(t,r||[],S(this).constructor):t.apply(this,r)),"selectedRows",c.observable.ref([])),x(e,"_closeView",void 0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&P(n,e),t=[{key:"customRequest",set:function(e){this.setProps({customRequest:e})}},{key:"onInit",value:function(e){var t=this;O(S(n.prototype),"onInit",this).call(this,e),this.onSelectExitRecordClick=function(e){t.dispatchEvent("openView",{event:e})}}},{key:"onSelectExitRecordClick",set:function(e){this.setProps({onSelectExitRecordClick:e})}},{key:"change",value:function(){this.props.onChange(this.selectedRows.value)}},{key:"render",value:function(){return s().createElement(I,this.props)}}],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}(p.FieldModel);(M=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}([(0,c.largeField)()],M)).registerFlow({key:"uploadSettings",title:(0,c.tExpr)("Upload file settings"),steps:{quickUpload:{title:(0,c.tExpr)("Quick upload"),uiMode:{type:"switch",key:"quickUpload"},hideInSettings:function(e){return!e.collectionField.isAssociationField()||!e.collectionField.targetCollection},defaultParams:function(e){return{quickUpload:!0}},handler:function(e,t){e.model.setProps({quickUpload:t.quickUpload})}},allowMultiple:{title:(0,c.tExpr)("Allow multiple"),uiMode:{type:"switch",key:"multiple"},hideInSettings:function(e){return!e.collectionField||!["belongsToMany","hasMany","belongsToArray"].includes(e.collectionField.type)},defaultParams:function(e){return{multiple:e.collectionField&&["belongsToMany","hasMany","belongsToArray"].includes(e.model.context.collectionField.type)}},handler:function(e,t){e.model.setProps({multiple:null==t?void 0:t.multiple,maxCount:(null==t?void 0:t.multiple)?null:1})}},showFileName:{title:(0,c.tExpr)("Show file name"),uiMode:{type:"switch",key:"showFileName"},defaultParams:{showFileName:!1},handler:function(e,t){e.model.setProps("showFileName",t.showFileName)}},allowSelectExistingRecord:{title:(0,c.tExpr)("Allow selection of existing file"),uiMode:{type:"switch",key:"allowSelectExistingRecord"},hideInSettings:function(e){return!e.collectionField.isAssociationField()||!e.collectionField.targetCollection},defaultParams:function(e){return{allowSelectExistingRecord:e.collectionField.targetCollection&&e.collectionField.isAssociationField()}},handler:function(e,t){e.model.setProps({allowSelectExistingRecord:t.allowSelectExistingRecord})}}}}),M.registerFlow({key:"eventSettings",sort:300,steps:{bindEvent:{handler:function(e,t){e.model.customRequest=function(t){e.model.dispatchEvent("customRequest",{apiClient:e.app.apiClient,fileData:t})}}}}}),M.registerFlow({key:"customRequestSettings",on:"customRequest",steps:{step1:{handler:function(e,t){return w(function(){var t,n,r,o,i,a,l,c,u,s,f,p,d,m,y,g,v,h,b,w,x,O,S,P,k,F,C,_,T,I;return R(this,function(R){switch(R.label){case 0:if(r=(n=e.inputArgs.fileData).file,o=n.onSuccess,i=n.onError,a=n.onProgress,l=e.app.pm.get("@nocobase/plugin-file-manager"),c=e.model.props.target,u=e.collectionField,s=null==(t=e.collection)?void 0:t.dataSourceKey,!l)return[2,o(r)];R.label=1;case 1:return R.trys.push([1,6,,7]),[4,e.api.resource("storages").check(E(j({fileCollectionName:c},s&&"main"!==s?{uploadDataSourceKey:s}:{}),{storageName:u.options.storage}))];case 2:if(!(null==(x=R.sent().data)||null==(f=x.data)?void 0:f.isSupportToUploadFiles))return S=e.t('The current storage "{{storageName}}" does not support file uploads.',{storageName:null==(O=x.data.storage)?void 0:O.title}).replaceAll(">",">"),null==i||i(Error(S)),[2];if(P=l.getStorageType(null==x||null==(d=x.data)||null==(p=d.storage)?void 0:p.type)||{},k=null==x||null==(m=x.data)?void 0:m.storage,!P.createUploadCustomRequest||"function"!=typeof(F=P.createUploadCustomRequest(E(j({},e.model.props),{api:e.api,action:function(e,t){if(!t||"main"===t)return e;var n=e.includes("?")?"&":"?";return"".concat(e).concat(n,"uploadDataSourceKey=").concat(encodeURIComponent(t))}("".concat(c,":create?attachmentField=").concat(u.collectionName,".").concat(u.name),s),storage:k}))))return[3,4];return[4,F({file:r,onProgress:a,onSuccess:o,onError:i})];case 3:return R.sent(),[2];case 4:return[4,l.uploadFile({file:r,fileCollectionName:c,storageId:null==x||null==(g=x.data)||null==(y=g.storage)?void 0:y.id,storageType:null==x||null==(h=x.data)||null==(v=h.storage)?void 0:v.type,storageRules:null==x||null==(w=x.data)||null==(b=w.storage)?void 0:b.rules,dataSourceKey:s,onProgress:function(e){null==a||a({percent:e})},query:{attachmentField:"".concat(u.collectionName,".").concat(u.name)}})];case 5:if(_=(C=R.sent()).data,T=C.errorMessage)return null==i||i(Error(T)),[2];if(!_)return null==i||i(Error("上传成功但响应数据为空")),[2];return o(_),[3,7];case 6:return I=R.sent(),null==i||i(I),[3,7];case 7:return[2]}})})()}}}}),M.registerFlow({key:"selectExitRecordSettings",title:(0,c.tExpr)("Selector setting"),on:{eventName:"openView"},steps:{openView:{title:(0,c.tExpr)("Edit popup"),hideInSettings:function(e){var t,n,r;return!1===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"uploadSettings","allowSelectExistingRecord"))?void 0:t.allowSelectExistingRecord)},uiSchema:function(e){return{mode:{type:"string",title:(0,c.tExpr)("Open mode"),enum:[{label:(0,c.tExpr)("Drawer"),value:"drawer"},{label:(0,c.tExpr)("Dialog"),value:"dialog"}],"x-decorator":"FormItem","x-component":"Radio.Group"},size:{type:"string",title:(0,c.tExpr)("Popup size"),enum:[{label:(0,c.tExpr)("Small"),value:"small"},{label:(0,c.tExpr)("Medium"),value:"medium"},{label:(0,c.tExpr)("Large"),value:"large"}],"x-decorator":"FormItem","x-component":"Radio.Group"}}},defaultParams:{mode:"drawer",size:"medium"},handler:function(e,t){var n,r,o,i,a,l=["belongsTo","hasOne"].includes(e.collectionField.type),c=e.isMobileLayout?"embed":e.inputArgs.mode||t.mode||"drawer",u=e.inputArgs.size||t.size||"medium",f=(null==(n=e.model.props)?void 0:n.sourceFieldModelUid)||e.model.uid,d=(null==(r=e.model.parent)?void 0:r.use)==="QuickEditFormModel"?null==(o=e.model.parent)?void 0:o.viewContainer:null;null==d||null==(i=d.update)||i.call(d,{preventClose:!0}),e.viewer.open({type:c,width:{drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}}[c][u],inheritContext:!1,target:e.layoutContentElement,onClose:function(){setTimeout(function(){var e;null==d||null==(e=d.update)||e.call(d,{preventClose:!1})},0)},inputArgs:{parentId:f,scene:"select",dataSourceKey:e.collection.dataSourceKey,collectionName:null==(a=e.collectionField)?void 0:a.target,collectionField:e.collectionField,rowSelectionProps:{type:l?"radio":"checkbox",defaultSelectedRows:function(){return e.model.props.value},renderCell:void 0,selectedRowKeys:void 0,onChange:function(t,n){if(l){var r,o;e.model.selectedRows.value=null==n?void 0:n[0],e.model.change(),null==(r=(o=e.model)._closeView)||r.call(o)}else{var i=F(e.model.props.value||[]).concat(F(n)).filter(function(t,n,r){return n===r.findIndex(function(n){return n[e.collection.filterTargetKey]===t[e.collection.filterTargetKey]})});e.model.selectedRows.value=i}}}},content:function(){return s().createElement(p.RecordPickerContent,{model:e.model})},styles:{content:j({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===c?{position:"absolute",top:0,left:0,right:0,bottom:0}:{}),body:{padding:0}}})}}}}),M.define({label:(0,c.tExpr)("File picker")}),c.EditableItemModel.bindModelToInterface("UploadFieldModel",["attachment","m2m","m2o","o2o","o2m","oho","obo","updatedBy","createdBy","mbm"],{isDefault:!0,order:30,when:function(e,t){return!t.targetCollection||"file"===t.targetCollection.template}})},667:function(e,t,n){"use strict";n.d(t,{S:function(){return b}});var r=n(485),o=n(624),i=n(358),a=n(488);function l(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 c(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,l,"next",e)}function l(e){c(i,r,o,a,l,"throw",e)}a(void 0)})}}function s(e,t,n){return(s=v()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&y(o,n.prototype),o}).apply(null,arguments)}function f(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){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(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){f(e,t,n[t])})}return e}function m(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 y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t="function"==typeof Map?new Map:void 0;return(g=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 s(e,arguments,p(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,e)})(e)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}function h(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var b=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=p(t),f(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,v()?Reflect.construct(t,n||[],p(this).constructor):t.apply(this,n)),"storageTypes",new Map),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&y(r,e),t=[{key:"load",value:function(){return u(function(){var e,t,r;return h(this,function(o){return t=this.app.i18n.t("File manager",{ns:i.C}),null==(r=this.app.pm.get("@nocobase/plugin-data-source-manager")||this.app.pm.get("data-source-manager"))||null==(e=r.registerCollectionTemplate)||e.call(r,{name:"file",title:(0,a.M)("File collection"),order:25,color:"blue",collection:{options:{template:"file",createdBy:!0,updatedBy:!0},fields:[{name:"title",interface:"input",type:"string",title:(0,a.M)("Title"),deletable:!1},{name:"filename",interface:"input",type:"string",title:(0,a.M)("File name"),deletable:!1,uiSchema:{"x-read-pretty":!0}},{name:"extname",interface:"input",type:"string",title:(0,a.M)("Extension name"),deletable:!1,uiSchema:{"x-read-pretty":!0}},{name:"size",interface:"integer",type:"integer",title:(0,a.M)("Size"),deletable:!1,componentProps:{stringMode:!0,step:"0"},uiSchema:{"x-read-pretty":!0}},{name:"mimetype",interface:"input",type:"string",title:(0,a.M)("MIME type"),deletable:!1,uiSchema:{"x-read-pretty":!0}},{name:"path",interface:"textarea",type:"text",title:(0,a.M)("Path"),deletable:!1,component:"TextAreaWithGlobalScope",uiSchema:{"x-read-pretty":!0}},{name:"url",interface:"url",type:"text",title:(0,a.M)("URL"),deletable:!1,uiSchema:{"x-read-pretty":!0}},{name:"preview",interface:"url",type:"text",title:(0,a.M)("Preview"),field:"url",deletable:!1,component:"Preview",uiSchema:{"x-read-pretty":!0}},{name:"storage",interface:"m2o",type:"belongsTo",title:(0,a.M)("Storage"),target:"storages",foreignKey:"storageId",deletable:!1,componentProps:{fieldNames:{value:"id",label:"title"}},uiSchema:{type:"object","x-read-pretty":!0}},{name:"meta",interface:"json",type:"jsonb",defaultValue:{},deletable:!1}]},presetFields:{disabled:!0}}),this.pluginSettingsManager.addMenuItem({key:i.C,title:t,icon:"FileOutlined",aclSnippet:"pm.file-manager.storages"}),this.pluginSettingsManager.addPageTabItem({menuKey:i.C,key:"index",title:t,componentLoader:function(){return n.e("942").then(n.bind(n,837))}}),this.registerBuiltInStorageTypes(),this.flowEngine.registerModelLoaders({DisplayPreviewFieldModel:{loader:function(){return n.e("125").then(n.bind(n,212))}},UploadActionModel:{loader:function(){return n.e("450").then(n.bind(n,177))}},UploadFieldModel:{loader:function(){return Promise.resolve().then(n.bind(n,76))}}}),[2]})}).call(this)}},{key:"registerStorageType",value:function(e,t){this.storageTypes.set(e,m(d({},t),{name:e}))}},{key:"getStorageType",value:function(e){return e?this.storageTypes.get(e):void 0}},{key:"registerBuiltInStorageTypes",value:function(){var e={renameMode:"appendRandomID",rules:{size:o.ZH}};this.registerStorageType(o.ZF,{title:"Local storage",formLoader:function(){return n.e("929").then(n.bind(n,864))},defaultValues:m(d({},e),{baseUrl:"/storage/uploads",options:{documentRoot:"storage/uploads"}})}),this.registerStorageType(o.y2,{title:"Aliyun OSS",formLoader:function(){return n.e("43").then(n.bind(n,574))},defaultValues:m(d({},e),{options:{timeout:6e5},settings:{requestOptions:{}}})}),this.registerStorageType(o.e7,{title:"Amazon S3",formLoader:function(){return n.e("336").then(n.bind(n,595))},defaultValues:e}),this.registerStorageType(o.a_,{title:"Tencent COS",formLoader:function(){return n.e("229").then(n.bind(n,316))},defaultValues:e})}},{key:"uploadFile",value:function(e){return u(function(){var t,n,r,o,i,a,c,u,s,f,p,m,y,g,v;return h(this,function(h){switch(h.label){case 0:if(!(null==e?void 0:e.file))return[2,{errorMessage:"Missing file"}];if(t=e.file,n=e.storageType,r=e.storageId,o=e.storageRules,i=e.dataSourceKey,c=void 0===(a=e.query)?{}:a,u=e.fileCollectionName||"attachments",s=this.getStorageType(n),f=d({},c,i&&"main"!==i?{uploadDataSourceKey:i}:{}),!(null==s?void 0:s.upload))return[3,2];return[4,s.upload({file:t,apiClient:this.app.apiClient,storageType:n,storageId:r,storageRules:o,dataSourceKey:i,fileCollectionName:u,query:f})];case 1:return[2,h.sent()];case 2:return h.trys.push([2,4,,5]),(m=new FormData).append("file",t),g=(y=new URLSearchParams(Object.entries(f).map(function(e){var t=function(e){if(Array.isArray(e))return e}(e)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return l(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 l(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();return[t[0],String(t[1])]})).toString())?"".concat(u,":create?").concat(y):"".concat(u,":create"),[4,this.app.apiClient.request({url:g,method:"post",data:m})];case 3:return[2,{data:null==(p=h.sent().data)?void 0:p.data}];case 4:var b,w;return[2,{errorMessage:(b=v=h.sent(),null!=(w=Error)&&"u">typeof Symbol&&w[Symbol.hasInstance]?!!w[Symbol.hasInstance](b):b instanceof w)?v.message:"Upload failed"}];case 5:return[2]}})}).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,t),r}(g(r.Plugin));f(b,"buildInStorage",[o.ZF,o.y2,o.e7,o.a_]),t.A=b},23:function(e,t,n){"use strict";n.d(t,{LD:function(){return Y},Mo:function(){return eu},WP:function(){return V},_H:function(){return _},_Y:function(){return Z},e$:function(){return C},q:function(){return R},qk:function(){return G},ub:function(){return W}});var r=n(155),o=n.n(r),i=n(375),a=n(477),l=n(59),c=n(484),u=n.n(c),s=n(953),f=n(358);function p(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 d(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){d(i,r,o,a,l,"next",e)}function l(e){d(i,r,o,a,l,"throw",e)}a(void 0)})}}function y(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function g(e,t,n){return(g=E()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&x(o,n.prototype),o}).apply(null,arguments)}function v(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){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(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){v(e,t,n[t])})}return e}function w(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 x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(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 p(e,t)}}(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 S(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function j(e){var t="function"==typeof Map?new Map:void 0;return(j=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 g(e,arguments,h(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),x(n,e)})(e)}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}function P(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function k(){var e,t,n=(e=["\n position: relative;\n width: 100%;\n background: #fff;\n overflow: hidden;\n --total-scale-factor: calc("," * var(--pdf-responsive-scale, 1));\n --scale-round-x: 1px;\n --scale-round-y: 1px;\n\n canvas {\n position: absolute;\n inset: 0;\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .textLayer {\n position: absolute;\n inset: 0;\n overflow: hidden;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n transform-origin: 0 0;\n z-index: 1;\n --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size, 1));\n --min-font-size-inv: calc(1 / var(--min-font-size, 1));\n }\n\n .textLayer :is(span, br) {\n position: absolute;\n color: transparent;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n }\n\n .textLayer > :not(.markedContent),\n .textLayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n --scale-x: 1;\n --rotate: 0deg;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n }\n\n .textLayer .markedContent {\n display: contents;\n }\n\n .textLayer span[role='img'] {\n user-select: none;\n cursor: default;\n }\n\n .textLayer ::selection {\n background: rgba(0, 0, 255, 0.25);\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return k=function(){return n},n}var F="u">typeof window&&window.__nocobase_public_path__||"/",C=new(function(){var e;function t(){y(this,t),v(this,"types",[])}return e=[{key:"add",value:function(e){this.types.unshift(e)}},{key:"getTypeByFile",value:function(e){var t=_(e);return this.types.find(function(e){return e.match(t)})}}],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)}}(t.prototype,e),t}());function _(e){return e&&"string"==typeof e?{url:e}:e}function R(e){return e?"string"==typeof e?e:e.preview||e.url||"":""}function T(e){return e?"string"==typeof e?e:e.url||e.preview||"":""}var I={pdf:"/file-placeholder/pdf-200-200.png",mp4:"/file-placeholder/video-200-200.png",mov:"/file-placeholder/video-200-200.png",avi:"/file-placeholder/video-200-200.png",wmv:"/file-placeholder/video-200-200.png",flv:"/file-placeholder/video-200-200.png",mkv:"/file-placeholder/video-200-200.png",mp3:"/file-placeholder/audio-200-200.png",wav:"/file-placeholder/audio-200-200.png",aac:"/file-placeholder/audio-200-200.png",ogg:"/file-placeholder/audio-200-200.png",doc:"/file-placeholder/docx-200-200.png",docx:"/file-placeholder/docx-200-200.png",odt:"/file-placeholder/docx-200-200.png",xls:"/file-placeholder/xlsx-200-200.png",xlsx:"/file-placeholder/xlsx-200-200.png",csv:"/file-placeholder/xlsx-200-200.png",ppt:"/file-placeholder/pptx-200-200.png",pptx:"/file-placeholder/pptx-200-200.png",jpg:"/file-placeholder/jpeg-200-200.png",jpeg:"/file-placeholder/jpeg-200-200.png",png:"/file-placeholder/png-200-200.png",gif:"/file-placeholder/gif-200-200.png",webp:"/file-placeholder/png-200-200.png",bmp:"/file-placeholder/png-200-200.png",svg:"/file-placeholder/svg-200-200.png",default:"/file-placeholder/unknown-200-200.png"},M=new Set(["application/pdf","application/xhtml+xml","image/svg+xml","text/html"]),D=new Set(["htm","html","pdf","svg","svgz","xhtml"]),A=function(e){return e.split("?")[0].split("#")[0]},L=function(e){if(!e)return"";var t=A(e),n=t.lastIndexOf(".");return -1!==n?t.slice(n+1).toLowerCase():""},U={aac:"audio/aac",avi:"video/x-msvideo",bmp:"image/bmp",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",flv:"video/x-flv",gif:"image/gif",jpeg:"image/jpeg",jpg:"image/jpeg",json:"application/json",mkv:"video/x-matroska",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",odt:"application/vnd.oasis.opendocument.text",ogg:"audio/ogg",pdf:"application/pdf",png:"image/png",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",svg:"image/svg+xml",txt:"text/plain",wav:"audio/wav",webp:"image/webp",wmv:"video/x-ms-wmv",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};function q(e,t){return!!e&&(e.originFileObj?u()(e.type,t):e.mimetype?u()(e.mimetype,t):!!e.url&&u()(U[L(e.url)]||"",t))}var N=function(e){if(!e)return"";var t=A(e),n=t.lastIndexOf("/"),r=-1!==n?t.slice(n+1):t;try{return decodeURIComponent(r)}catch(e){return r}},z=function(e,t){if(e&&(void 0===e?"undefined":S(e))==="object"){if(e.extname)return String(e.extname).replace(/^\./,"").toLowerCase();var n=L(e.name||e.filename||e.title);if(n)return n}return L(t)},B=function(e,t){var n=(null==e?void 0:e.mimetype)||(null==e?void 0:e.type);if("string"==typeof n&&M.has(n.toLowerCase()))return!0;var r=z(e,t);return D.has(r)},$=function(e,t){var n=(null==e?void 0:e.mimetype)||(null==e?void 0:e.type);return"string"==typeof n&&"application/pdf"===n.toLowerCase()||"pdf"===z(e,t)},K=function(e){if(!e||"u"<typeof window)return!0;try{return new URL(e,window.location.href).origin===window.location.origin}catch(e){return!0}},V=function(e,t){var n=N(t||T(e));return e&&"string"!=typeof e&&(e.name||e.filename||e.title)||n},W=function(e,t){var n=t||T(e),r=V(e,n),o=z(e,n);return r&&o&&!r.toLowerCase().endsWith(".".concat(o))&&(r="".concat(r,".").concat(o)),"".concat(Date.now(),"_").concat(r||"file")},Z=function(e,t){var n;return n=I[z(e,t)]||I.default,"".concat(F.replace(/\/$/,""),"/").concat(n.replace(/^\//,""))},G=function(e){var t,n=_(e),r=R(n);if(B(n,r))return Z(n,r);var o=(null!=(t=C.getTypeByFile(n))?t:{}).getThumbnailURL,i=null==o?void 0:o(n);return i||(q(n,"image/*")?"":Z(n,r))},H=function(e){var t=e.index,n=e.list,r=e.onSwitchIndex,a=e.onDownload,c=e.file,u="number"==typeof t&&!!r&&t>0,s="number"==typeof t&&!!r&&t<n.length-1;return o().createElement(l.Space,{size:14,style:{fontSize:"20px"}},o().createElement(i.LeftOutlined,{style:{cursor:u?"pointer":"not-allowed"},disabled:!u,onClick:function(){return u&&(null==r?void 0:r(t-1))}}),o().createElement(i.RightOutlined,{style:{cursor:s?"pointer":"not-allowed"},disabled:!s,onClick:function(){return s&&(null==r?void 0:r(t+1))}}),o().createElement(i.DownloadOutlined,{onClick:function(){return a(c)}}))},Y=function(e){return function(t){var n=t.open,r=t.onOpenChange,i=t.onClose,a=t.file;if("boolean"!=typeof n)return o().createElement(e,t);var c=V(a,T(a));return o().createElement(l.Modal,{open:n,title:c,onCancel:function(){null==r||r(!1),null==i||i()},footer:H(t),width:"90vw",centered:!0},o().createElement("div",{style:{maxWidth:"100%",maxHeight:"calc(100vh - 256px)",height:"80vh",width:"100%",background:"white",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",overflowY:"auto"}},o().createElement(e,t)))}},Q=function(e){var t=T(e.file);return t?o().createElement("iframe",{src:t,width:"100%",height:"100%",style:{border:"none"}}):null},X=null,J=function(e){return e.endsWith("/")?e:"".concat(e,"/")},ee=function(e){var t=null==e?void 0:e.__webpack_public_path__;if(t)return J(t);var n=J((null==e?void 0:e.__nocobase_public_path__)||"/"),r="string"==typeof(null==e?void 0:e.__nocobase_modern_client_prefix__)?e.__nocobase_modern_client_prefix__.replace(/^\/+|\/+$/g,""):"";return r?n.replace(new RegExp("/".concat(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"/$")),"/"):n},et=function(){var e=ee("u"<typeof window?void 0:window);return"".concat(e,"static/plugins/@nocobase/plugin-file-manager/dist/client/pdfjs/")},en=function(){var e=et();return{cMapPacked:!0,cMapUrl:"".concat(e,"cmaps/"),standardFontDataUrl:"".concat(e,"standard_fonts/")}},er=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(e,n,r){var o,i,a;return y(this,t),i=t,a=[n],i=h(i),v(o=function(e,t){if(t&&("object"===S(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,E()?Reflect.construct(i,a||[],h(this).constructor):i.apply(this,a)),"code",void 0),v(o,"cause",void 0),o.name="PdfPreviewError",o.code=e,o.cause=r,o}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&x(t,e),t}(j(Error)),eo=function(e){return(null!=er&&"u">typeof Symbol&&er[Symbol.hasInstance]?!!er[Symbol.hasInstance](e):e instanceof er)?e.code:"document"},ei=(0,a.css)(k(),1.4),ea={resources:"PDF preview resources failed to load. Please refresh the page and check whether plugin static files are deployed correctly.",file:"PDF preview failed to load the file. If the file is stored on another domain, configure CORS for the external storage to allow this site to read the file.",document:"PDF preview failed. Please download the file to preview it."},el=function(e){var t=e.file,n=(0,s.useTranslation)(f.C).t,r=T(t),i=o().useRef(new Map),a=o().useRef(null),c=O(o().useState(null),2),u=c[0],p=c[1],d=O(o().useState(null),2),y=d[0],g=d[1];return(o().useEffect(function(){if(r){var e={cancelled:!1,abortController:new AbortController,rendered:new Set,inFlight:new Set,loadingTasks:[],renderTasks:[],textLayers:new Set};return a.current=e,p(null),g(null),m(function(){var t,n,o,i,a,l,c,u;return P(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,m(function(){return P(this,function(e){return X||(X=import("".concat(et(),"pdf.min.mjs"))),[2,X]})})()];case 1:return t=s.sent(),[3,3];case 2:throw new er("resources","Failed to load PDF.js resources.",s.sent());case 3:if(e.cancelled)return[2];e.pdfjs=t;try{n=new URL(r,location.href)}catch(e){throw new er("file","Invalid PDF file URL.",e)}s.label=4;case 4:return s.trys.push([4,6,,7]),[4,fetch(n,{credentials:n.origin===location.origin?"include":"omit",signal:e.abortController.signal})];case 5:return o=s.sent(),[3,7];case 6:throw new er("file","Failed to fetch PDF file.",s.sent());case 7:if(!o.ok)throw new er("file","Failed to fetch PDF file: ".concat(o.status));s.label=8;case 8:return s.trys.push([8,10,,11]),a=Uint8Array.bind,[4,o.arrayBuffer()];case 9:return i=new(a.apply(Uint8Array,[void 0,s.sent()])),[3,11];case 10:throw new er("file","Failed to read PDF file response.",s.sent());case 11:if(e.cancelled)return[2];e.data=i;try{t.GlobalWorkerOptions.workerSrc="".concat(et(),"pdf.worker.min.mjs"),e.worker=t.PDFWorker.create({})}catch(e){throw new er("resources","Failed to load PDF.js worker.",e)}l=t.getDocument(w(b({data:i.slice(0)},en()),{isEvalSupported:!1,enableXfa:!1,useWasm:!1,worker:e.worker})),e.loadingTasks.push(l),s.label=12;case 12:return s.trys.push([12,14,,15]),[4,l.promise];case 13:return c=s.sent(),[3,15];case 14:throw new er("document","Failed to parse PDF file.",s.sent());case 15:if(e.cancelled)return[2];return e.metaPdf=c,[4,c.getPage(1)];case 16:if(u=s.sent().getViewport({scale:1.4}),e.cancelled)return[2];return p({numPages:c.numPages,width:u.width,height:u.height}),[2]}})})().catch(function(t){if(!e.cancelled){var n=eo(t);console.warn("[file-manager] PDF preview failed",{code:n,src:r,error:t}),g(n)}}),function(){var t,n,r,o;e.cancelled=!0,e.abortController.abort(),null==(t=e.observer)||t.disconnect(),e.renderTasks.forEach(function(e){var t;return null==(t=e.cancel)?void 0:t.call(e)}),e.textLayers.forEach(function(e){return e.cancel()}),e.loadingTasks.forEach(function(e){var t;return null==(t=e.destroy)?void 0:t.call(e)}),null==(n=e.pdfjs)||n.TextLayer.cleanup(),null==(o=e.worker)||null==(r=o.destroy)||r.call(o)}}},[r]),o().useEffect(function(){if(u&&"u">typeof ResizeObserver){var e=function(e,t){t>0&&e.style.setProperty("--pdf-responsive-scale",String(t/u.width))},t=new ResizeObserver(function(t){var n=!0,r=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var l=i.value;e(l.target,l.contentRect.width)}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}});return i.current.forEach(function(n){e(n,n.getBoundingClientRect().width),t.observe(n)}),function(){t.disconnect()}}},[u]),o().useEffect(function(){var e=a.current;if(u&&(null==e?void 0:e.pdfjs)&&e.metaPdf){var t=e.pdfjs,n=e.metaPdf,o=function(o){return m(function(){var a,l,c,u,s,f,p,d,m,y,g,v,h,x;return P(this,function(O){switch(O.label){case 0:if(e.cancelled||e.rendered.has(o)||e.inFlight.has(o)||!(a=i.current.get(o)))return[2];e.inFlight.add(o),O.label=1;case 1:if(O.trys.push([1,8,9,10]),!(1===o||!e.data))return[3,2];return s=n,[3,4];case 2:return l=t.getDocument(w(b({data:e.data.slice(0)},en()),{isEvalSupported:!1,enableXfa:!1,useWasm:!1,worker:e.worker})),e.loadingTasks.push(l),[4,l.promise];case 3:s=O.sent(),O.label=4;case 4:if(e.cancelled)return[2];return[4,s.getPage(o)];case 5:if(p=(f=O.sent()).getViewport({scale:1.4}),!(d=document.createElement("canvas").getContext("2d")))return[2];return(m=d.canvas).width=p.width,m.height=p.height,m.setAttribute("aria-hidden","true"),(y=document.createElement("div")).className=ei,y.style.aspectRatio="".concat(p.width," / ").concat(p.height),(g=document.createElement("div")).className="textLayer",y.replaceChildren(m,g),a.style.aspectRatio="",a.replaceChildren(y),c=new t.TextLayer({textContentSource:f.streamTextContent({includeMarkedContent:!0,disableNormalization:!0}),container:g,viewport:p}),e.textLayers.add(c),v=c.render().then(function(){}).catch(function(t){e.cancelled||console.warn("[file-manager] PDF text layer render failed",{pageNumber:o,src:r,error:t})}).finally(function(){c&&e.textLayers.delete(c)}),h=f.render({canvas:m,canvasContext:d,viewport:p,annotationMode:t.AnnotationMode.ENABLE}),e.renderTasks.push(h),[4,h.promise];case 6:if(O.sent(),e.cancelled)return[2];return[4,v];case 7:if(O.sent(),e.cancelled)return[2];return e.rendered.add(o),null==(u=e.observer)||u.unobserve(a),[3,10];case 8:return x=O.sent(),null==c||c.cancel(),e.cancelled||console.warn("[file-manager] PDF page render failed",{pageNumber:o,src:r,error:x}),[3,10];case 9:return null==l||l.destroy(),e.inFlight.delete(o),[7];case 10:return[2]}})})()},l=new IntersectionObserver(function(e){var t=!0,n=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var l=i.value;l.isIntersecting&&o(Number(l.target.dataset.page))}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}},{rootMargin:"300px 0px"});return e.observer=l,i.current.forEach(function(e){return l.observe(e)}),function(){l.disconnect(),e.observer===l&&(e.observer=void 0)}}},[u,r]),r)?o().createElement("div",{style:{width:"100%",minHeight:"100%",padding:16}},y?o().createElement(l.Alert,{type:"warning",showIcon:!0,message:n(ea[y])}):null,u||y?null:o().createElement("div",{style:{display:"flex",justifyContent:"center",padding:48}},o().createElement(l.Spin,null)),u?Array.from({length:u.numPages},function(e,t){return t+1}).map(function(e){return o().createElement("div",{key:e,"data-page":e,ref:function(t){t?i.current.set(e,t):i.current.delete(e)},style:{width:"100%",maxWidth:u.width,margin:"0 auto 16px",aspectRatio:"".concat(u.width," / ").concat(u.height),background:"#fff",border:"1px solid #f0f0f0"}})}):null):null},ec=function(e){var t=e.file;return o().createElement(l.Alert,{type:"warning",description:o().createElement(s.Trans,{ns:f.C},"File type is not supported for previewing, please ",e.onDownload?o().createElement("a",{onClick:function(){var n;return null==(n=e.onDownload)?void 0:n.call(e,t)},style:{textDecoration:"underline",cursor:"pointer"}},"download it to preview"):o().createElement("span",null,"download it to preview")),showIcon:!0})};C.add({match:function(){return!0},Previewer:Y(ec)}),C.add({match:function(e){return q(e,"image/*")},getThumbnailURL:function(e){return R(e)},Previewer:function(e){var t=e.file,n=e.list,r=e.index,a=e.open,c=e.onOpenChange,u=e.onSwitchIndex,s=e.onClose,f=e.onDownload;if("boolean"!=typeof a)return null;var p=T(t);if(!p)return null;var d="number"==typeof r&&r>0,m="number"==typeof r&&r<n.length-1;return o().createElement(l.Image,{wrapperStyle:{display:"none"},preview:{visible:a,onVisibleChange:function(e){return null==c?void 0:c(e)},afterOpenChange:function(e){e||null==s||s()},toolbarRender:function(e,n){var a=n.transform.scale,c=n.actions,s=c.onFlipY,p=c.onFlipX,y=c.onRotateLeft,g=c.onRotateRight,v=c.onZoomOut,h=c.onZoomIn,b=c.onReset;return o().createElement(l.Space,{size:14,className:"toolbar-wrapper",style:{fontSize:"20px"}},o().createElement(i.LeftOutlined,{style:{cursor:d?"pointer":"not-allowed"},disabled:!d,onClick:function(){return d&&(null==u?void 0:u(r-1))}}),o().createElement(i.RightOutlined,{style:{cursor:m?"pointer":"not-allowed"},disabled:!m,onClick:function(){return m&&(null==u?void 0:u(r+1))}}),f?o().createElement(i.DownloadOutlined,{onClick:function(){return f(t)}}):null,o().createElement(i.SwapOutlined,{rotate:90,onClick:s}),o().createElement(i.SwapOutlined,{onClick:p}),o().createElement(i.RotateLeftOutlined,{onClick:y}),o().createElement(i.RotateRightOutlined,{onClick:g}),o().createElement(i.ZoomOutOutlined,{disabled:1===a,onClick:v}),o().createElement(i.ZoomInOutlined,{disabled:50===a,onClick:h}),o().createElement(i.UndoOutlined,{onClick:b}))}},src:p})}}),C.add({match:function(e){return["text/plain","application/json"].some(function(t){return q(e,t)})},Previewer:Y(Q)}),C.add({match:function(e){return q(e,"audio/*")},Previewer:Y(function(e){var t=e.file,n=(0,s.useTranslation)().t,r=T(t);return r?o().createElement("audio",{controls:!0},o().createElement("source",{src:r,type:(null==t?void 0:t.type)||(null==t?void 0:t.mimetype)}),n("Your browser does not support the audio tag.")):null})}),C.add({match:function(e){return q(e,"video/*")},Previewer:Y(function(e){var t=e.file,n=(0,s.useTranslation)().t,r=T(t);return r?o().createElement("video",{controls:!0,width:"100%",height:"100%"},o().createElement("source",{src:r,type:(null==t?void 0:t.type)||(null==t?void 0:t.mimetype)}),n("Your browser does not support the video tag.")):null})}),C.add({match:function(e){return B(e,T(e))},Previewer:Y(ec)}),C.add({match:function(e){return $(e,T(e))},Previewer:Y(function(e){return K(T(e.file))?o().createElement(el,e):o().createElement(Q,e)})});var eu=function(e){var t,n=_(e.file);if(!n)return null;var r=(null!=(t=C.getTypeByFile(n))?t:{}).Previewer;return r?o().createElement(r,w(b({},e),{file:n})):null}},564:function(e,t,n){"use strict";n.d(t,{KT:function(){return f},tp:function(){return m},OC:function(){return v},BL:function(){return c},om:function(){return d},mt:function(){return u},Sx:function(){return y},Lq:function(){return p},Lg:function(){return h}});var r=n(485),o=n(59),i=n(155),a=n.n(i),l=n(488);function c(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"baseUrl",label:"".concat(e("Base URL")," :"),rules:[{required:!0,message:e("The field value is required")}],extra:e('Base URL for file access, could be your CDN base URL. For example: "https://cdn.nocobase.com".')},a().createElement(r.EnvVariableInput,null))}function u(e){var t=(0,l.k)();return a().createElement(o.Form.Item,{name:"default",valuePropName:"checked"},a().createElement(o.Checkbox,{disabled:e.disabled},t("Default storage")))}var s=n(624);function f(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:["rules","size"],label:"".concat(e("File size limit")," :"),rules:[{required:!0,message:e("The field value is required")}],extra:e("Minimum from 1 byte.")},a().createElement(r.FileSizeInput,{min:s.UW,max:s.Qj,defaultValue:s.ZH}))}function p(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:["rules","mimetype"],label:"".concat(e("File type allowed (in MIME type format)")," :"),extra:e('Multi-types separated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.')},a().createElement(o.Input,{placeholder:"*"}))}function d(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"name",label:"".concat(e("Storage name")," :"),rules:[{required:!0,message:e("The field value is required")}],extra:e("Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.")},a().createElement(o.Input,null))}function m(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"paranoid",valuePropName:"checked",extra:e("Files are only removed when their corresponding records in the file collection are deleted. If a record from another collection includes an associating field referencing the file collection, the file will not be deleted unless cascade deletion is enabled for that association.")},a().createElement(o.Checkbox,null,e("Keep file in storage when destroy the file record")))}function y(e){var t=(0,l.k)();return a().createElement(o.Form.Item,{name:"path",label:"".concat(t("Path")," :"),extra:t('Relative path the file will be saved to. Left blank as root path. The leading and trailing slashes "/" will be ignored. For example: "user/avatar".')},a().createElement(r.EnvVariableInput,{addonBefore:e.addonBefore}))}var g=[{label:"Append random ID",value:"appendRandomID"},{label:"Random string",value:"random"},{label:"Keep original filename (will be overwrite if filename is existed)",value:"none"}];function v(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"renameMode",label:"".concat(e("Renaming")," :"),extra:e("Renaming strategy to avoid filename conflicts when uploading files.")},a().createElement(o.Radio.Group,{options:g.map(function(t){var n,r;return 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={label:e(t.label)},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})}))}function h(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"title",label:"".concat(e("Title")," :"),rules:[{required:!0,message:e("The field value is required")}]},a().createElement(o.Input,null))}},488:function(e,t,n){"use strict";n.d(t,{M:function(){return a},k:function(){return i}});var r=n(694),o=n(358);function i(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,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}({ns:[o.C,"client"]},n))}}function a(e){return(0,r.tExpr)(e,{ns:[o.C,"client"]})}},358:function(e,t,n){"use strict";n.d(t,{C:function(){return r}});var r="file-manager"},624:function(e,t,n){"use strict";n.d(t,{Qj:function(){return o},UW:function(){return r},ZF:function(){return a},ZH:function(){return i},a_:function(){return u},e7:function(){return c},y2:function(){return l}});var r=1,o=1/0,i=0x1400000,a="local",l="ali-oss",c="s3",u="tx-cos"},375:function(e){"use strict";e.exports=r},477:function(e){"use strict";e.exports=t},230:function(e){"use strict";e.exports=n},485:function(e){"use strict";e.exports=a},694:function(e){"use strict";e.exports=o},625:function(e){"use strict";e.exports=i},59:function(e){"use strict";e.exports=c},773:function(e){"use strict";e.exports=u},155:function(e){"use strict";e.exports=l},953:function(t){"use strict";t.exports=e}},m={};function y(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return d[e](n,n.exports,y),n.exports}y.m=d,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return""+e+"."+({125:"0b8eef1f19b87042",229:"bd72c2d7aa088310",336:"1dd1b32466d0c778",43:"eb45d53ba3e9828b",450:"c060947ac34d26e1",929:"d7e783304cc1f236",942:"f36d807d763a1b53"})[e]+".js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},g={},y.l=function(e,t,n,r){if(g[e])return void g[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var c=a[l];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-file-manager/client-v2:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-file-manager/client-v2:"+n),o.src=e),g[e]=[t];var u=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=g[e];if(delete g[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),i&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(v=y.g.location+"");var g,v,h=y.g.document;if(!v&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(v=h.currentScript.src),!v)){var b=h.getElementsByTagName("script");if(b.length)for(var w=b.length-1;w>-1&&(!v||!/^http(s?):/.test(v));)v=b[w--].src}if(!v)throw Error("Automatic publicPath is not supported in this browser");y.p=v.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},y.f.j=function(e,t){var n=y.o(s,e)?s[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=s[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),i=Error();y.l(o,function(t){if(y.o(s,e)&&(0!==(n=s[e])&&(s[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},f=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],l=0;if(o.some(function(e){return 0!==s[e]})){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);a&&a(y)}for(e&&e(t);l<o.length;l++)r=o[l],y.o(s,r)&&s[r]&&s[r][0](),s[r]=0},(p=self.webpackChunk_nocobase_plugin_file_manager_client_v2=self.webpackChunk_nocobase_plugin_file_manager_client_v2||[]).forEach(f.bind(null,0)),p.push=f.bind(null,p.push.bind(p));var x={};return!function(){"use strict";var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-file-manager/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-file-manager/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",l=a.indexOf(i);e=l>=0?a.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-file-manager/dist/client-v2/"}y.p=e}(),!function(){"use strict";y.r(x),y.d(x,{BaseUrlField:function(){return t.BL},CardUpload:function(){return n.CardUpload},DefaultField:function(){return t.mt},FileSizeField:function(){return t.KT},MimetypeField:function(){return t.Lq},NameField:function(){return t.om},ParanoidField:function(){return t.tp},PathField:function(){return t.Sx},PluginFileManagerClientV2:function(){return e.A},RenameModeField:function(){return t.OC},TitleField:function(){return t.Lg},UploadFieldModel:function(){return n.UploadFieldModel},default:function(){return e.A},filePreviewTypes:function(){return r.e$},wrapWithModalPreviewer:function(){return r.LD}});var e=y(667),t=y(564),n=y(76),r=y(23)}(),x}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("@formily/shared"),require("react"),require("antd"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager/client-v2",["react-i18next","@emotion/css","@formily/react","@ant-design/icons","@nocobase/flow-engine","ahooks","@nocobase/client-v2","@formily/shared","react","antd","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager/client-v2"]=t(require("react-i18next"),require("@emotion/css"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("@formily/shared"),require("react"),require("antd"),require("lodash")):e["@nocobase/plugin-file-manager/client-v2"]=t(e["react-i18next"],e["@emotion/css"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.ahooks,e["@nocobase/client-v2"],e["@formily/shared"],e.react,e.antd,e.lodash)}(self,function(e,t,n,r,o,i,a,l,c,u,s){return function(){var f,p,d,m={484:function(e,t,n){var r=n(986),o=/[\/\+\.]/;e.exports=function(e,t){function n(t){var n=r(t,e,o);return n&&n.length>=2}return t?n(t.split(";")[0]):n}},986:function(e){"use strict";function t(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}t.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(t=0,n=(e||"").split(this.separator);r&&t<i;t++)if("*"===o[t])continue;else r=t<n.length&&o[t]===n[t];r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var a in r={},e)this.match(a)&&(r[a]=e[a]);return r},e.exports=function(e,n,r){var o=new t(e,r||/[\/\.]/);return void 0!==n?o.match(n):o}},76:function(e,t,n){"use strict";n.r(t),n.d(t,{UploadFieldModel:function(){return M},CardUpload:function(){return U}});var r=n(375),o=n(477),i=n(59),a=n(773),l=n(953),c=n(694),u=n(155),s=n.n(u),f=n(230),p=n(485),d=n(23);function m(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}var h=function(e,t){var n,r,o,i,a=null==e?void 0:e.response,l=null!=(n=null==e?void 0:e.id)?n:null==a?void 0:a.id,c=null!=(r=null==e?void 0:e.url)?r:null==a?void 0:a.url,u=null!=(o=null==e?void 0:e.filename)?o:null==a?void 0:a.filename,s=null!=(i=null==e?void 0:e.name)?i:null==a?void 0:a.name;return null!=l?"id:".concat(String(l)):null!=c?"url:".concat(c):null!=u?"filename:".concat(u,":").concat(t):null!=s?"name:".concat(s,":").concat(t):(null==e?void 0:e.uid)?"uid:".concat(e.uid):"index:".concat(t)},y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map(t.map(function(e,t){return[h(e,t),e.uid]}).filter(function(e){return!!(function(e){if(Array.isArray(e))return e}(e)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return m(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 m(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1]}));return e.map(function(e,t){var r,o,i,a=h(e,t);return r=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}({},e),o=o={uid:e.uid||n.get(a)||a,thumbUrl:null!=(i=e.thumbUrl)?i:(0,d.qk)(e)},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r})},v=function(e,t){var n=e.findIndex(function(e){return e.uid===(null==t?void 0:t.uid)});return n>=0?n:0};function g(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 b(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function w(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){b(i,r,o,a,l,"next",e)}function l(e){b(i,r,o,a,l,"throw",e)}a(void 0)})}}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e,t,n){return(O="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=S(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(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){x(e,t,n[t])})}return e}function j(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 P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,t)||C(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 F(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(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 C(e,t){if(e){if("string"==typeof e)return g(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 g(e,t)}}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function R(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function T(){var e,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n }\n }\n .ant-upload-select {\n margin: ",";\n }\n ","\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return T=function(){return n},n}var U=function(e){var t,n=e.allowSelectExistingRecord,c=e.multiple,p=e.value,m=e.disabled,h=e.onSelectExitRecordClick,g=e.quickUpload,b=e.showFileName,x=e.fileCollection,O=k((0,u.useState)(function(){return y((0,a.castArray)(p||[]))}),2),S=O[0],P=O[1],F=(0,u.useRef)(S),C=k((0,u.useState)(!1),2),_=C[0],U=C[1],I=k((0,u.useState)(null),2),M=I[0],L=I[1],A=k((0,u.useState)(0),2),D=A[0],q=A[1],z=(0,l.useTranslation)().t;(0,u.useEffect)(function(){F.current=S},[S]),(0,u.useEffect)(function(){return function(){(0,d.kZ)(F.current.flatMap(function(e){return[e,e.response].filter(Boolean)}))}},[]),(0,u.useLayoutEffect)(function(){P(function(e){return y((0,a.castArray)(p||[]),e)})},[p]);var N=(t=S.length,!!c||0===t);return s().createElement(f.FieldContext.Provider,{value:{value:S}},s().createElement("div",{style:{display:"flex"},className:(0,o.css)(T(),b?"8px 0px":"0px",b?"8px 0px":"0px",c?"":"\n .ant-upload-list-item-container.ant-upload-animate-inline-appear,\n .ant-upload-list-item-container.ant-upload-animate-inline-appear-active,\n .ant-upload-list-item-container.ant-upload-animate-inline-enter,\n .ant-upload-list-item-container.ant-upload-animate-inline-enter-active {\n animation: none !important;\n transition: none !important;\n transform: none !important;\n opacity: 1 !important;\n }\n\n .ant-upload.ant-upload-animate-inline-leave,\n .ant-upload.ant-upload-animate-inline-leave-active {\n animation: none !important;\n transition: none !important;\n }\n ")},s().createElement(i.Upload,j(E({onPreview:function(e){return w(function(){var t;return R(this,function(n){switch(n.label){case 0:var r;if(t=v(S,e),!(!e.url&&!e.preview))return[3,2];return[4,(r=e.originFileObj,new Promise(function(e,t){var n=new FileReader;n.readAsDataURL(r),n.onload=function(){return e(n.result)},n.onerror=function(e){return t(e)}}))];case 1:e.preview=n.sent(),n.label=2;case 2:return L(e),q(t),U(!0),[2]}})})()}},e),{listType:"picture-card",fileList:S,onChange:function(t){var n=t.fileList;n.forEach(function(e){("done"===e.status||e.id)&&e.originFileObj&&(0,d._8)(e.response||e,e)}),(0,d.kZ)(S.filter(function(e){return!n.some(function(t){return t.uid===e.uid})}).flatMap(function(e){return[e,e.response].filter(Boolean)})),P(function(e){return y(n,e)});var r=n.filter(function(e){return"done"===e.status||e.id});if(n.every(function(e){return"done"===e.status||e.id}))if(1===e.maxCount){var o=r[0];e.onChange(o?o.response:null)}else e.onChange(r.map(function(e){return e.response||e}).filter(Boolean))},itemRender:function(e,t){return s().createElement(s().Fragment,null,e,b&&s().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:t.filename},t.filename))}}),(void 0===g||g)&&N?s().createElement(r.UploadOutlined,{style:{fontSize:20}}):null),M&&s().createElement(d.Mo,{open:_,file:M,list:S,fileCollection:x,index:D,onOpenChange:U,onClose:function(){return L(null)},onSwitchIndex:function(e){e<0||e>=S.length||(q(e),L(S[e]))},onDownload:function(e){var t=e||M;if(t){var n=t.url||t.preview;n&&(0,d.Ns)(n,(0,d.ub)(t,n))}}}),n&&N?s().createElement("div",{style:{marginLeft:5}},s().createElement(i.Upload,{disabled:m,multiple:c,listType:"picture-card",showUploadList:!1},s().createElement("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},onClick:function(e){m||(e.stopPropagation(),e.preventDefault(),h())}},s().createElement(r.PlusOutlined,null),z("Select")))):null))},I=new WeakSet,M=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=S(t),x(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,_()?Reflect.construct(t,r||[],S(this).constructor):t.apply(this,r)),"selectedRows",c.observable.ref([])),x(e,"_closeView",void 0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&P(n,e),t=[{key:"customRequest",set:function(e){this.setProps({customRequest:e})}},{key:"onInit",value:function(e){var t=this;O(S(n.prototype),"onInit",this).call(this,e);var r=function(e){t.dispatchEvent("openView",{event:e})};I.add(r),this.onSelectExitRecordClick=r}},{key:"onSelectExitRecordClick",set:function(e){this.setProps({onSelectExitRecordClick:e})}},{key:"change",value:function(){this.props.onChange(this.selectedRows.value)}},{key:"render",value:function(){var e,t=this,n=null==(e=this.context.collectionField)?void 0:e.targetCollection,r=this.context.collection,o=n||((null==r?void 0:r.template)==="file"?r:null),i=o?{dataSourceKey:o.dataSourceKey,collectionName:o.name}:void 0,a=this.props.onSelectExitRecordClick,l=a&&I.has(a)?function(e){t.dispatchEvent("openView",{event:e})}:a;return s().createElement(U,j(E({},this.props),{fileCollection:i,onSelectExitRecordClick:l}))}}],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}(p.FieldModel);(M=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}([(0,c.largeField)()],M)).registerFlow({key:"uploadSettings",title:(0,c.tExpr)("Upload file settings"),steps:{quickUpload:{title:(0,c.tExpr)("Quick upload"),uiMode:{type:"switch",key:"quickUpload"},hideInSettings:function(e){return!e.collectionField.isAssociationField()||!e.collectionField.targetCollection},defaultParams:function(e){return{quickUpload:!0}},handler:function(e,t){e.model.setProps({quickUpload:t.quickUpload})}},allowMultiple:{title:(0,c.tExpr)("Allow multiple"),uiMode:{type:"switch",key:"multiple"},hideInSettings:function(e){return!e.collectionField||!["belongsToMany","hasMany","belongsToArray"].includes(e.collectionField.type)},defaultParams:function(e){return{multiple:e.collectionField&&["belongsToMany","hasMany","belongsToArray"].includes(e.model.context.collectionField.type)}},handler:function(e,t){e.model.setProps({multiple:null==t?void 0:t.multiple,maxCount:(null==t?void 0:t.multiple)?null:1})}},showFileName:{title:(0,c.tExpr)("Show file name"),uiMode:{type:"switch",key:"showFileName"},defaultParams:{showFileName:!1},handler:function(e,t){e.model.setProps("showFileName",t.showFileName)}},allowSelectExistingRecord:{title:(0,c.tExpr)("Allow selection of existing file"),uiMode:{type:"switch",key:"allowSelectExistingRecord"},hideInSettings:function(e){return!e.collectionField.isAssociationField()||!e.collectionField.targetCollection},defaultParams:function(e){return{allowSelectExistingRecord:e.collectionField.targetCollection&&e.collectionField.isAssociationField()}},handler:function(e,t){e.model.setProps({allowSelectExistingRecord:t.allowSelectExistingRecord})}}}}),M.registerFlow({key:"eventSettings",sort:300,steps:{bindEvent:{handler:function(e,t){e.model.customRequest=function(t){e.model.dispatchEvent("customRequest",{apiClient:e.app.apiClient,fileData:t})}}}}}),M.registerFlow({key:"customRequestSettings",on:"customRequest",steps:{step1:{handler:function(e,t){return w(function(){var t,n,r,o,i,a,l,c,u,s,f,p,d,m,h,y,v,g,b,w,x,O,S,P,k,F,C,_,T,U;return R(this,function(R){switch(R.label){case 0:if(r=(n=e.inputArgs.fileData).file,o=n.onSuccess,i=n.onError,a=n.onProgress,l=e.app.pm.get("@nocobase/plugin-file-manager"),c=e.model.props.target,u=e.collectionField,s=null==(t=e.collection)?void 0:t.dataSourceKey,!l)return[2,o(r)];R.label=1;case 1:return R.trys.push([1,6,,7]),[4,e.api.resource("storages").check(j(E({fileCollectionName:c},s&&"main"!==s?{uploadDataSourceKey:s}:{}),{storageName:u.options.storage}))];case 2:if(!(null==(x=R.sent().data)||null==(f=x.data)?void 0:f.isSupportToUploadFiles))return S=e.t('The current storage "{{storageName}}" does not support file uploads.',{storageName:null==(O=x.data.storage)?void 0:O.title}).replaceAll(">",">"),null==i||i(Error(S)),[2];if(P=l.getStorageType(null==x||null==(d=x.data)||null==(p=d.storage)?void 0:p.type)||{},k=null==x||null==(m=x.data)?void 0:m.storage,!P.createUploadCustomRequest||"function"!=typeof(F=P.createUploadCustomRequest(j(E({},e.model.props),{api:e.api,action:function(e,t){if(!t||"main"===t)return e;var n=e.includes("?")?"&":"?";return"".concat(e).concat(n,"uploadDataSourceKey=").concat(encodeURIComponent(t))}("".concat(c,":create?attachmentField=").concat(u.collectionName,".").concat(u.name),s),dataSourceKey:s,storage:k}))))return[3,4];return[4,F({file:r,onProgress:a,onSuccess:o,onError:i})];case 3:return R.sent(),[2];case 4:return[4,l.uploadFile({file:r,fileCollectionName:c,storageId:null==x||null==(y=x.data)||null==(h=y.storage)?void 0:h.id,storageType:null==x||null==(g=x.data)||null==(v=g.storage)?void 0:v.type,storageRules:null==x||null==(w=x.data)||null==(b=w.storage)?void 0:b.rules,dataSourceKey:s,onProgress:function(e){null==a||a({percent:e})},query:{attachmentField:"".concat(u.collectionName,".").concat(u.name)}})];case 5:if(_=(C=R.sent()).data,T=C.errorMessage)return null==i||i(Error(T)),[2];if(!_)return null==i||i(Error("上传成功但响应数据为空")),[2];return o(_),[3,7];case 6:return U=R.sent(),null==i||i(U),[3,7];case 7:return[2]}})})()}}}}),M.registerFlow({key:"selectExitRecordSettings",title:(0,c.tExpr)("Selector setting"),on:{eventName:"openView"},steps:{openView:{title:(0,c.tExpr)("Edit popup"),hideInSettings:function(e){var t,n,r;return!1===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"uploadSettings","allowSelectExistingRecord"))?void 0:t.allowSelectExistingRecord)},uiSchema:function(e){return{mode:{type:"string",title:(0,c.tExpr)("Open mode"),enum:[{label:(0,c.tExpr)("Drawer"),value:"drawer"},{label:(0,c.tExpr)("Dialog"),value:"dialog"}],"x-decorator":"FormItem","x-component":"Radio.Group"},size:{type:"string",title:(0,c.tExpr)("Popup size"),enum:[{label:(0,c.tExpr)("Small"),value:"small"},{label:(0,c.tExpr)("Medium"),value:"medium"},{label:(0,c.tExpr)("Large"),value:"large"}],"x-decorator":"FormItem","x-component":"Radio.Group"}}},defaultParams:{mode:"drawer",size:"medium"},handler:function(e,t){var n,r,o,i,a,l=["belongsTo","hasOne"].includes(e.collectionField.type),c=e.isMobileLayout?"embed":e.inputArgs.mode||t.mode||"drawer",u=e.inputArgs.size||t.size||"medium",f=(null==(n=e.model.props)?void 0:n.sourceFieldModelUid)||e.model.uid,d=(null==(r=e.model.parent)?void 0:r.use)==="QuickEditFormModel"?null==(o=e.model.parent)?void 0:o.viewContainer:null;null==d||null==(i=d.update)||i.call(d,{preventClose:!0}),e.viewer.open({type:c,width:{drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}}[c][u],inheritContext:!1,target:e.layoutContentElement,onClose:function(){setTimeout(function(){var e;null==d||null==(e=d.update)||e.call(d,{preventClose:!1})},0)},inputArgs:{parentId:f,scene:"select",dataSourceKey:e.collection.dataSourceKey,collectionName:null==(a=e.collectionField)?void 0:a.target,collectionField:e.collectionField,rowSelectionProps:{type:l?"radio":"checkbox",defaultSelectedRows:function(){return e.model.props.value},renderCell:void 0,selectedRowKeys:void 0,onChange:function(t,n){if(l){var r,o;e.model.selectedRows.value=null==n?void 0:n[0],e.model.change(),null==(r=(o=e.model)._closeView)||r.call(o)}else{var i=F(e.model.props.value||[]).concat(F(n)).filter(function(t,n,r){return n===r.findIndex(function(n){return n[e.collection.filterTargetKey]===t[e.collection.filterTargetKey]})});e.model.selectedRows.value=i}}}},content:function(){return s().createElement(p.RecordPickerContent,{model:e.model,toOne:l})},styles:{content:E({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===c?{position:"absolute",top:0,left:0,right:0,bottom:0}:{}),body:{padding:0}}})}}}}),M.define({label:(0,c.tExpr)("File picker")}),c.EditableItemModel.bindModelToInterface("UploadFieldModel",["attachment","m2m","m2o","o2o","o2m","oho","obo","updatedBy","createdBy","mbm"],{isDefault:!0,order:30,when:function(e,t){return!t.targetCollection||"file"===t.targetCollection.template}})},667:function(e,t,n){"use strict";n.d(t,{S:function(){return O}});var r=n(485),o=n(624),i=n(358),a=n(732),l=n(488);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,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,l,"next",e)}function l(e){u(i,r,o,a,l,"throw",e)}a(void 0)})}}function f(e,t,n){return(f=b()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&y(o,n.prototype),o}).apply(null,arguments)}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 d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(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 h(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 y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function g(e){var t="function"==typeof Map?new Map:void 0;return(g=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 f(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,e)})(e)}function b(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(b=function(){return!!e})()}function w(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var x=function(e,t){return t&&(null==e?void 0:e.data)&&"object"===v(e.data)?h(m({},e),{data:h(m({},e.data),{local:t===o.ZF})}):e},O=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=d(t),p(e=function(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,b()?Reflect.construct(t,n||[],d(this).constructor):t.apply(this,n)),"storageTypes",new Map),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&y(r,e),t=[{key:"load",value:function(){return s(function(){var e,t,r;return w(this,function(o){return this.app.addFieldInterfaces([a.p]),t=this.app.i18n.t("File manager",{ns:i.C}),null==(r=this.app.pm.get("@nocobase/plugin-data-source-manager")||this.app.pm.get("data-source-manager"))||null==(e=r.registerCollectionTemplate)||e.call(r,{name:"file",title:(0,l.M)("File collection"),order:25,color:"blue",collection:{options:{template:"file",createdBy:!0,updatedBy:!0},fields:[{name:"title",interface:"input",type:"string",title:(0,l.M)("Title"),deletable:!1},{name:"filename",interface:"input",type:"string",title:(0,l.M)("File name"),deletable:!1,uiSchema:{"x-read-pretty":!0}},{name:"extname",interface:"input",type:"string",title:(0,l.M)("Extension name"),deletable:!1,uiSchema:{"x-read-pretty":!0}},{name:"size",interface:"integer",type:"integer",title:(0,l.M)("Size"),deletable:!1,componentProps:{stringMode:!0,step:"0"},uiSchema:{"x-read-pretty":!0}},{name:"mimetype",interface:"input",type:"string",title:(0,l.M)("MIME type"),deletable:!1,uiSchema:{"x-read-pretty":!0}},{name:"path",interface:"textarea",type:"text",title:(0,l.M)("Path"),deletable:!1,component:"TextAreaWithGlobalScope",uiSchema:{"x-read-pretty":!0}},{name:"url",interface:"url",type:"text",title:(0,l.M)("URL"),deletable:!1,uiSchema:{"x-read-pretty":!0}},{name:"preview",interface:"url",type:"text",title:(0,l.M)("Preview"),field:"url",deletable:!1,component:"Preview",uiSchema:{"x-read-pretty":!0}},{name:"storage",interface:"m2o",type:"belongsTo",title:(0,l.M)("Storage"),target:"storages",foreignKey:"storageId",deletable:!1,componentProps:{fieldNames:{value:"id",label:"title"}},uiSchema:{type:"object","x-read-pretty":!0}},{name:"meta",interface:"json",type:"jsonb",defaultValue:{},deletable:!1}]},presetFields:{disabled:!0}}),this.pluginSettingsManager.addMenuItem({key:i.C,title:t,icon:"FileOutlined",aclSnippet:"pm.file-manager.storages"}),this.pluginSettingsManager.addPageTabItem({menuKey:i.C,key:"index",title:t,componentLoader:function(){return n.e("942").then(n.bind(n,837))}}),this.registerBuiltInStorageTypes(),this.flowEngine.registerModelLoaders({DisplayPreviewFieldModel:{loader:function(){return n.e("125").then(n.bind(n,212))}},UploadActionModel:{loader:function(){return n.e("450").then(n.bind(n,177))}},UploadFieldModel:{loader:function(){return Promise.resolve().then(n.bind(n,76))}}}),[2]})}).call(this)}},{key:"registerStorageType",value:function(e,t){this.storageTypes.set(e,h(m({},t),{name:e}))}},{key:"getStorageType",value:function(e){return e?this.storageTypes.get(e):void 0}},{key:"registerBuiltInStorageTypes",value:function(){var e={renameMode:"appendRandomID",rules:{size:o.ZH},options:{useOriginalUrl:!1}};this.registerStorageType(o.ZF,{title:"Local storage",formLoader:function(){return n.e("929").then(n.bind(n,864))},defaultValues:h(m({},e),{baseUrl:"/storage/uploads",options:h(m({},e.options),{documentRoot:"storage/uploads"})})}),this.registerStorageType(o.y2,{title:"Aliyun OSS",formLoader:function(){return n.e("43").then(n.bind(n,574))},defaultValues:h(m({},e),{options:h(m({},e.options),{timeout:6e5}),settings:{requestOptions:{}}})}),this.registerStorageType(o.e7,{title:"Amazon S3",formLoader:function(){return n.e("336").then(n.bind(n,595))},defaultValues:e}),this.registerStorageType(o.a_,{title:"Tencent COS",formLoader:function(){return n.e("229").then(n.bind(n,316))},defaultValues:e})}},{key:"uploadFile",value:function(e){return s(function(){var t,n,r,o,i,a,l,u,s,f,p,d,h,y,v;return w(this,function(g){switch(g.label){case 0:if(!(null==e?void 0:e.file))return[2,{errorMessage:"Missing file"}];if(t=e.file,n=e.storageType,r=e.storageId,o=e.storageRules,i=e.dataSourceKey,l=void 0===(a=e.query)?{}:a,u=e.fileCollectionName||"attachments",s=this.getStorageType(n),f=m({},l,i&&"main"!==i?{uploadDataSourceKey:i}:{}),!(null==s?void 0:s.upload))return[3,2];return[4,s.upload({file:t,apiClient:this.app.apiClient,storageType:n,storageId:r,storageRules:o,dataSourceKey:i,fileCollectionName:u,query:f})];case 1:return[2,x(g.sent(),n)];case 2:return g.trys.push([2,4,,5]),(d=new FormData).append("file",t),y=(h=new URLSearchParams(Object.entries(f).map(function(e){var t=function(e){if(Array.isArray(e))return e}(e)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return c(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 c(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();return[t[0],String(t[1])]})).toString())?"".concat(u,":create?").concat(h):"".concat(u,":create"),[4,this.app.apiClient.request({url:y,method:"post",data:d})];case 3:return[2,x({data:null==(p=g.sent().data)?void 0:p.data},n)];case 4:var b,w;return[2,{errorMessage:(b=v=g.sent(),null!=(w=Error)&&"u">typeof Symbol&&w[Symbol.hasInstance]?!!w[Symbol.hasInstance](b):b instanceof w)?v.message:"Upload failed"}];case 5:return[2]}})}).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,t),r}(g(r.Plugin));p(O,"buildInStorage",[o.ZF,o.y2,o.e7,o.a_]),t.A=O},23:function(e,t,n){"use strict";n.d(t,{LD:function(){return ek},Mo:function(){return eq},Ns:function(){return eb},Uv:function(){return ev},WP:function(){return eO},_8:function(){return V},_H:function(){return D},_Y:function(){return eE},_b:function(){return et},e$:function(){return M},kZ:function(){return W},q:function(){return Z},qk:function(){return ej},s$:function(){return ey},ub:function(){return eS}});var r=n(155),o=n.n(r),i=n(375),a=n(477),l=n(59),c=n(484),u=n.n(c),s=n(953),f=n(358);function p(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 d(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){d(i,r,o,a,l,"next",e)}function l(e){d(i,r,o,a,l,"throw",e)}a(void 0)})}}function h(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function y(e,t,n){return(y=F()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&O(o,n.prototype),o}).apply(null,arguments)}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function w(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){v(e,t,n[t])})}return e}function x(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 O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,t)||P(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 E(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||P(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 j(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function P(e,t){if(e){if("string"==typeof e)return p(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 p(e,t)}}function k(e){var t="function"==typeof Map?new Map:void 0;return(k=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 y(e,arguments,g(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),O(n,e)})(e)}function F(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(F=function(){return!!e})()}function C(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function _(){var e,t,n=(e=["\n position: relative;\n width: 100%;\n background: #fff;\n overflow: hidden;\n --total-scale-factor: calc("," * var(--pdf-responsive-scale, 1));\n --scale-round-x: 1px;\n --scale-round-y: 1px;\n\n canvas {\n position: absolute;\n inset: 0;\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .textLayer {\n position: absolute;\n inset: 0;\n overflow: hidden;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n transform-origin: 0 0;\n z-index: 1;\n --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size, 1));\n --min-font-size-inv: calc(1 / var(--min-font-size, 1));\n }\n\n .textLayer :is(span, br) {\n position: absolute;\n color: transparent;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n }\n\n .textLayer > :not(.markedContent),\n .textLayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n --scale-x: 1;\n --rotate: 0deg;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n }\n\n .textLayer .markedContent {\n display: contents;\n }\n\n .textLayer span[role='img'] {\n user-select: none;\n cursor: default;\n }\n\n .textLayer ::selection {\n background: rgba(0, 0, 255, 0.25);\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return _=function(){return n},n}var R=/^[A-Za-z0-9_][A-Za-z0-9_-]*$/,T=/^[a-z][a-z\d+.-]*:/i,U=/^\/\//,I=function(e){var t="u"<typeof window?void 0:window,n=null==t?void 0:t.__webpack_public_path__,r=null==t?void 0:t.__nocobase_public_path__;return"".concat((n&&"/"!==n?n:r||n||"/").replace(/\/+$/g,""),"/").concat(e.replace(/^\//,""))},M=new(function(){var e;function t(){h(this,t),v(this,"types",[])}return e=[{key:"add",value:function(e){this.types.unshift(e)}},{key:"getTypeByFile",value:function(e){var t=D(e);return this.types.find(function(e){return e.match(t)})}}],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)}}(t.prototype,e),t}()),L=function(e){return!!e&&(void 0===e?"undefined":j(e))==="object"&&!Array.isArray(e)},A=function(e){if(!L(e))return null;var t=L(e.data)?e.data:e;return["id","url","preview","filename","extname","mimetype"].some(function(e){return e in t})?t:null};function D(e){if(!e)return e;if("string"==typeof e)return{url:e};var t=A(e.response);if(t){var n=x(w({},e,t),{response:e.response,originFileObj:e.originFileObj});return n.name||"string"!=typeof t.filename||(n.name=t.filename),n.type||"string"!=typeof t.mimetype||(n.type=t.mimetype),n}return e}var q=new WeakMap,z=new Map,N=function(e){return(null==e?void 0:e.originFileObj)?e.originFileObj:"u">typeof Blob&&b(e,Blob)?e:null},B=function(e,t){if(!t)return[];var n=["".concat(e,":").concat(t)];if("u">typeof location)try{var r=new URL(t,location.origin);n.push("".concat(e,":").concat(r.toString())),r.origin===location.origin&&n.push("".concat(e,":").concat(r.pathname).concat(r.search).concat(r.hash))}catch(e){}return E(new Set(n))},K=function(e){return e&&(void 0===e?"undefined":j(e))==="object"?E(B("url",e.url)).concat(E(B("preview",e.preview)),[null!=e.id?"id:".concat(String(e.id)):""]).filter(Boolean):[]};function $(e){if(!e||!et(e,"image/*")||"u"<typeof URL)return"";var t=N(e);if(t){var n=q.get(t);if(n)return n;if("function"==typeof URL.createObjectURL){var r=URL.createObjectURL(t);return q.set(t,r),r}}var o=!0,i=!1,a=void 0;try{for(var l,c=K(e)[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,s=z.get(u);if(s)return s}}catch(e){i=!0,a=e}finally{try{o||null==c.return||c.return()}finally{if(i)throw a}}return""}function V(e,t){var n=$(t);n&&K(e).forEach(function(e){z.set(e,n)})}function W(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(function(e){return function(e){var t=new Set,n=N(e);if(n){var r=q.get(n);r&&(t.add(r),q.delete(n))}if(K(e).forEach(function(e){var n=z.get(e);n&&(t.add(n),z.delete(e))}),t.size){var o=!0,i=!1,a=void 0;try{for(var l,c=z.entries()[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=S(l.value,2),s=u[0],f=u[1];t.has(f)&&z.delete(s)}}catch(e){i=!0,a=e}finally{try{o||null==c.return||c.return()}finally{if(i)throw a}}"u">typeof URL&&"function"==typeof URL.revokeObjectURL&&t.forEach(function(e){return URL.revokeObjectURL(e)})}}(e)})}function Z(e){if(!e)return"";if("string"==typeof e)return e;var t=$(e);return t||e.preview||e.url||""}function X(e){return e?"string"==typeof e?e:e.url||e.preview||"":""}var G={pdf:"/file-placeholder/pdf-200-200.png",mp4:"/file-placeholder/video-200-200.png",mov:"/file-placeholder/video-200-200.png",avi:"/file-placeholder/video-200-200.png",wmv:"/file-placeholder/video-200-200.png",flv:"/file-placeholder/video-200-200.png",mkv:"/file-placeholder/video-200-200.png",mp3:"/file-placeholder/audio-200-200.png",wav:"/file-placeholder/audio-200-200.png",aac:"/file-placeholder/audio-200-200.png",ogg:"/file-placeholder/audio-200-200.png",doc:"/file-placeholder/docx-200-200.png",docx:"/file-placeholder/docx-200-200.png",odt:"/file-placeholder/docx-200-200.png",xls:"/file-placeholder/xlsx-200-200.png",xlsx:"/file-placeholder/xlsx-200-200.png",csv:"/file-placeholder/xlsx-200-200.png",ppt:"/file-placeholder/pptx-200-200.png",pptx:"/file-placeholder/pptx-200-200.png",jpg:"/file-placeholder/jpeg-200-200.png",jpeg:"/file-placeholder/jpeg-200-200.png",png:"/file-placeholder/png-200-200.png",gif:"/file-placeholder/gif-200-200.png",webp:"/file-placeholder/png-200-200.png",bmp:"/file-placeholder/png-200-200.png",svg:"/file-placeholder/svg-200-200.png",default:"/file-placeholder/unknown-200-200.png"},H=new Set(["application/pdf","application/xhtml+xml","application/xml","application/xslt+xml","image/svg+xml","text/html","text/xml"]),Y=new Set(["htm","html","pdf","svg","svgz","xht","xhtml","xml","xsl","xslt"]),Q=function(e){return e.split("?")[0].split("#")[0]},J=function(e){if(!e)return"";var t=Q(e),n=t.lastIndexOf(".");return -1!==n?t.slice(n+1).toLowerCase():""},ee={aac:"audio/aac",avi:"video/x-msvideo",bmp:"image/bmp",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",flv:"video/x-flv",gif:"image/gif",jpeg:"image/jpeg",jpg:"image/jpeg",json:"application/json",mkv:"video/x-matroska",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",odt:"application/vnd.oasis.opendocument.text",ogg:"audio/ogg",pdf:"application/pdf",png:"image/png",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",svg:"image/svg+xml",txt:"text/plain",wav:"audio/wav",webp:"image/webp",wmv:"video/x-ms-wmv",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};function et(e,t){return!!e&&(e.originFileObj?u()(e.type||e.originFileObj.type||"",t):e.mimetype?u()(e.mimetype,t):u()(ee[er(e,X(e))]||"",t))}var en=function(e){if(!e)return"";var t=Q(e),n=t.lastIndexOf("/"),r=-1!==n?t.slice(n+1):t;try{return decodeURIComponent(r)}catch(e){return r}},er=function(e,t){if(e&&(void 0===e?"undefined":j(e))==="object"){if(e.extname)return String(e.extname).replace(/^\./,"").toLowerCase();var n=J(e.name||e.filename||e.title);if(n)return n}return J(t)},eo=function(e,t){var n=(null==e?void 0:e.mimetype)||(null==e?void 0:e.type);if("string"==typeof n&&H.has(n.toLowerCase()))return!0;var r=er(e,t);return Y.has(r)},ei=function(e,t){var n=(null==e?void 0:e.mimetype)||(null==e?void 0:e.type);return"string"==typeof n&&"application/pdf"===n.toLowerCase()||"pdf"===er(e,t)},ea=function(e){if(!e||"u"<typeof window)return!0;try{return new URL(e,window.location.href).origin===window.location.origin}catch(e){return!0}},el=function(e){return!!e&&!T.test(e)&&!U.test(e)},ec=function(){return"u"<typeof window?void 0:window},eu=function(){var e,t=ec();return null==t||null==(e=t.location)?void 0:e.origin},es=function(){var e=ec(),t=null==e?void 0:e.__nocobase_api_base_url__;if(t)try{return new URL(t,e.location.href).origin}catch(e){return}},ef=function(){var e,t=ec(),n=(null==t||null==(e=t.location)?void 0:e.href)||"http://localhost/";return new URL((null==t?void 0:t.__nocobase_public_path__)||"/",n).pathname.replace(/\/+$/g,"")},ep=function(e){var t=ef();return t&&"/"!==t&&(e===t||e.startsWith("".concat(t,"/")))?e.slice(t.length)||"/":e},ed=function(e,t){if(el(t))return!0;var n=eu(),r=es();return!!n&&e.origin===n||!!r&&e.origin===r},em=function(e){try{return R.test(decodeURIComponent(e))}catch(e){return!1}},eh=function(e){var t=ep(e).split("/").filter(Boolean);return 5===t.length&&"files"===t[0]&&em(t[1])&&em(t[2])&&em(t[3])&&!!t[4]},ey=function(e){var t,n,r="string"==typeof e?e:void 0,o=(null==(n=ec())||null==(t=n.location)?void 0:t.href)||"http://localhost/";try{var i=b(e,URL)?e:new URL(e,o);return ed(i,r)&&eh(i.pathname)}catch(e){return!1}},ev=function(e){if(!e||"u"<typeof window)return"";try{var t=new URL(e,window.location.href);if(!ey(e)||t.searchParams.has("temporaryAccessToken"))return"";return t.searchParams.set("preview","1"),el(e)?"".concat(t.pathname).concat(t.search).concat(t.hash):t.toString()}catch(e){return""}},eg=function(e){if("u"<typeof window)return"same-origin";try{var t=b(e,URL)?e:new URL(e,window.location.href);if(t.origin===window.location.origin||ey(t))return"include"}catch(e){}return"same-origin"},eb=function(e,t){var n=e;try{var r=new URL(e,window.location.href);ey(e)&&(r.searchParams.set("download","1"),n=/^[a-z][a-z\d+.-]*:/i.test(e)?r.toString():"".concat(r.pathname).concat(r.search).concat(r.hash))}catch(t){n=e}var o=document.createElement("a");o.href=n,o.download=t,o.rel="noopener noreferrer",document.body.appendChild(o),o.click(),o.remove()},ew=function(e){if(e&&"string"!=typeof e){var t,n,r,o,i,a=D(e),l=null!=(t=null!=(n=a.local)?n:null==(r=a.response)?void 0:r.local)?t:null==(i=a.response)||null==(o=i.data)?void 0:o.local;return"boolean"==typeof l?l:void 0}},ex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X(e);if(!t||!ea(t))return!1;if("u"<typeof window)return!0;try{var n=new URL(t,window.location.href);if(!ey(n))return!0;return!1!==ew(e)}catch(e){return!0}},eO=function(e,t){var n=en(t||X(e));return e&&"string"!=typeof e&&(e.name||e.filename||e.title)||n},eS=function(e,t){var n=t||X(e),r=eO(e,n),o=er(e,n);return r&&o&&!r.toLowerCase().endsWith(".".concat(o))&&(r="".concat(r,".").concat(o)),"".concat(Date.now(),"_").concat(r||"file")},eE=function(e,t){return I(G[er(e,t)]||G.default)},ej=function(e){var t,n=D(e),r=Z(n);if(eo(n,r))return eE(n,r);var o=(null!=(t=M.getTypeByFile(n))?t:{}).getThumbnailURL,i=null==o?void 0:o(n);return i||(et(n,"image/*")?ev(r):eE(n,r))},eP=function(e){var t=e.index,n=e.list,r=e.onSwitchIndex,a=e.onDownload,c=e.file,u="number"==typeof t&&!!r&&t>0,s="number"==typeof t&&!!r&&t<n.length-1;return o().createElement(l.Space,{size:14,style:{fontSize:"20px"}},o().createElement(i.LeftOutlined,{style:{cursor:u?"pointer":"not-allowed"},disabled:!u,onClick:function(){return u&&(null==r?void 0:r(t-1))}}),o().createElement(i.RightOutlined,{style:{cursor:s?"pointer":"not-allowed"},disabled:!s,onClick:function(){return s&&(null==r?void 0:r(t+1))}}),o().createElement(i.DownloadOutlined,{onClick:function(){return a(c)}}))},ek=function(e){return function(t){var n=t.open,r=t.onOpenChange,i=t.onClose,a=t.file;if("boolean"!=typeof n)return o().createElement(e,t);var c=eO(a,X(a));return o().createElement(l.Modal,{open:n,title:c,onCancel:function(){null==r||r(!1),null==i||i()},footer:eP(t),width:"90vw",centered:!0},o().createElement("div",{style:{maxWidth:"100%",maxHeight:"calc(100vh - 256px)",height:"80vh",width:"100%",background:"white",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",overflowY:"auto"}},o().createElement(e,t)))}},eF=function(e){var t=X(e.file);return t?o().createElement("iframe",{src:t,width:"100%",height:"100%",style:{border:"none"}}):null},eC=null,e_=function(e){return e.endsWith("/")?e:"".concat(e,"/")},eR=function(e){var t=null==e?void 0:e.__webpack_public_path__;if(t)return e_(t);var n=e_((null==e?void 0:e.__nocobase_public_path__)||"/"),r="string"==typeof(null==e?void 0:e.__nocobase_modern_client_prefix__)?e.__nocobase_modern_client_prefix__.replace(/^\/+|\/+$/g,""):"";return r?n.replace(new RegExp("/".concat(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"/$")),"/"):n},eT=function(){var e=eR("u"<typeof window?void 0:window);return"".concat(e,"static/plugins/@nocobase/plugin-file-manager/dist/client/pdfjs/")},eU=function(){var e=eT();return{cMapPacked:!0,cMapUrl:"".concat(e,"cmaps/"),standardFontDataUrl:"".concat(e,"standard_fonts/")}},eI=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(e,n,r){var o,i,a;return h(this,t),i=t,a=[n],i=g(i),v(o=function(e,t){if(t&&("object"===j(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,F()?Reflect.construct(i,a||[],g(this).constructor):i.apply(this,a)),"code",void 0),v(o,"cause",void 0),o.name="PdfPreviewError",o.code=e,o.cause=r,o}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&O(t,e),t}(k(Error)),eM=(0,a.css)(_(),1.4),eL={resources:"PDF preview resources failed to load. Please refresh the page and check whether plugin static files are deployed correctly.",file:"PDF preview failed to load the file. If the file is stored on another domain, configure CORS for the external storage to allow this site to read the file.",document:"PDF preview failed. Please download the file to preview it.",size:"PDF file is too large to preview in the browser. Please download it."},eA=function(e){var t=e.file,n=(0,s.useTranslation)(f.C).t,r=X(t),i=o().useRef(new Map),a=o().useRef(null),c=S(o().useState(null),2),u=c[0],p=c[1],d=S(o().useState(null),2),h=d[0],y=d[1];return(o().useEffect(function(){if(r){var e={cancelled:!1,abortController:new AbortController,rendered:new Set,inFlight:new Set,pending:new Set,loadingTasks:[],renderTasks:[],textLayers:new Set};return a.current=e,p(null),y(null),m(function(){var t,n,o,i,a,l,c,u,s;return C(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,m(function(){return C(this,function(e){return eC||(eC=import("".concat(eT(),"pdf.min.mjs"))),[2,eC]})})()];case 1:return t=f.sent(),[3,3];case 2:throw new eI("resources","Failed to load PDF.js resources.",f.sent());case 3:if(e.cancelled)return[2];e.pdfjs=t;try{n=new URL(r,location.href)}catch(e){throw new eI("file","Invalid PDF file URL.",e)}f.label=4;case 4:return f.trys.push([4,6,,7]),[4,fetch(n,{credentials:eg(n),signal:e.abortController.signal})];case 5:return o=f.sent(),[3,7];case 6:throw new eI("file","Failed to fetch PDF file.",f.sent());case 7:if(!o.ok)throw new eI("file","Failed to fetch PDF file: ".concat(o.status));if(Number.isFinite(i=Number(o.headers.get("content-length")))&&i>0x3200000)throw new eI("size","PDF file is too large to preview.");f.label=8;case 8:return f.trys.push([8,10,,11]),l=Uint8Array.bind,[4,o.arrayBuffer()];case 9:return a=new(l.apply(Uint8Array,[void 0,f.sent()])),[3,11];case 10:throw new eI("file","Failed to read PDF file response.",f.sent());case 11:if(a.byteLength>0x3200000)throw new eI("size","PDF file is too large to preview.");if(e.cancelled)return[2];e.data=a;try{t.GlobalWorkerOptions.workerSrc="".concat(eT(),"pdf.worker.min.mjs"),e.worker=t.PDFWorker.create({})}catch(e){throw new eI("resources","Failed to load PDF.js worker.",e)}c=t.getDocument(x(w({data:a.slice(0)},eU()),{isEvalSupported:!1,enableXfa:!1,useWasm:!1,worker:e.worker})),e.loadingTasks.push(c),f.label=12;case 12:return f.trys.push([12,14,,15]),[4,c.promise];case 13:return u=f.sent(),[3,15];case 14:throw new eI("document","Failed to parse PDF file.",f.sent());case 15:if(e.cancelled)return[2];return e.metaPdf=u,[4,u.getPage(1)];case 16:if(s=f.sent().getViewport({scale:1.4}),e.cancelled)return[2];return p({numPages:u.numPages,width:s.width,height:s.height}),[2]}})})().catch(function(t){if(!e.cancelled){var n=b(t,eI)?t.code:"document";console.warn("[file-manager] PDF preview failed",{code:n,src:r,error:t}),y(n)}}),function(){var t,n,r,o;e.cancelled=!0,e.abortController.abort(),null==(t=e.observer)||t.disconnect(),e.renderTasks.forEach(function(e){var t;return null==(t=e.cancel)?void 0:t.call(e)}),e.textLayers.forEach(function(e){return e.cancel()}),e.loadingTasks.forEach(function(e){var t;return null==(t=e.destroy)?void 0:t.call(e)}),null==(n=e.pdfjs)||n.TextLayer.cleanup(),null==(o=e.worker)||null==(r=o.destroy)||r.call(o)}}},[r]),o().useEffect(function(){if(u&&"u">typeof ResizeObserver){var e=function(e,t){t>0&&e.style.setProperty("--pdf-responsive-scale",String(t/u.width))},t=new ResizeObserver(function(t){var n=!0,r=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var l=i.value;e(l.target,l.contentRect.width)}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}});return i.current.forEach(function(n){e(n,n.getBoundingClientRect().width),t.observe(n)}),function(){t.disconnect()}}},[u]),o().useEffect(function(){var e=a.current;if(u&&(null==e?void 0:e.pdfjs)&&e.metaPdf){var t=e.pdfjs,n=e.metaPdf,o=function(){if(!e.cancelled&&!(e.inFlight.size>=1)){var a=e.pending.values().next().value;if(a)return e.pending.delete(a),m(function(){var o,l,c,u,s,f,p,d,m,h,y,v,g,b;return C(this,function(O){switch(O.label){case 0:if(e.cancelled||e.rendered.has(a)||e.inFlight.has(a)||!(o=i.current.get(a)))return[2];e.inFlight.add(a),O.label=1;case 1:if(O.trys.push([1,8,9,10]),!(1===a||!e.data))return[3,2];return s=n,[3,4];case 2:return l=t.getDocument(x(w({data:e.data.slice(0)},eU()),{isEvalSupported:!1,enableXfa:!1,useWasm:!1,worker:e.worker})),e.loadingTasks.push(l),[4,l.promise];case 3:s=O.sent(),O.label=4;case 4:if(e.cancelled)return[2];return[4,s.getPage(a)];case 5:if(p=(f=O.sent()).getViewport({scale:1.4}),!(d=document.createElement("canvas").getContext("2d")))return[2];return(m=d.canvas).width=p.width,m.height=p.height,m.setAttribute("aria-hidden","true"),(h=document.createElement("div")).className=eM,h.style.aspectRatio="".concat(p.width," / ").concat(p.height),(y=document.createElement("div")).className="textLayer",h.replaceChildren(m,y),o.style.aspectRatio="",o.replaceChildren(h),c=new t.TextLayer({textContentSource:f.streamTextContent({includeMarkedContent:!0,disableNormalization:!0}),container:y,viewport:p}),e.textLayers.add(c),v=c.render().then(function(){}).catch(function(t){e.cancelled||console.warn("[file-manager] PDF text layer render failed",{pageNumber:a,src:r,error:t})}).finally(function(){c&&e.textLayers.delete(c)}),g=f.render({canvas:m,canvasContext:d,viewport:p,annotationMode:t.AnnotationMode.ENABLE}),e.renderTasks.push(g),[4,g.promise];case 6:if(O.sent(),e.cancelled)return[2];return[4,v];case 7:if(O.sent(),e.cancelled)return[2];return e.rendered.add(a),null==(u=e.observer)||u.unobserve(o),[3,10];case 8:return b=O.sent(),null==c||c.cancel(),e.cancelled||console.warn("[file-manager] PDF page render failed",{pageNumber:a,src:r,error:b}),[3,10];case 9:return null==l||l.destroy(),e.inFlight.delete(a),[7];case 10:return[2]}})})().finally(o)}},l=function(t){e.cancelled||e.rendered.has(t)||e.inFlight.has(t)||e.pending.has(t)||(e.pending.add(t),o())},c=new IntersectionObserver(function(e){var t=!0,n=!1,r=void 0;try{for(var o,i=e[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;a.isIntersecting&&l(Number(a.target.dataset.page))}}catch(e){n=!0,r=e}finally{try{t||null==i.return||i.return()}finally{if(n)throw r}}},{rootMargin:"300px 0px"});return e.observer=c,i.current.forEach(function(e){return c.observe(e)}),function(){c.disconnect(),e.observer===c&&(e.observer=void 0)}}},[u,r]),r)?o().createElement("div",{style:{width:"100%",minHeight:"100%",padding:16}},h?o().createElement(l.Alert,{type:"warning",showIcon:!0,message:n(eL[h])}):null,u||h?null:o().createElement("div",{style:{display:"flex",justifyContent:"center",padding:48}},o().createElement(l.Spin,null)),u?Array.from({length:u.numPages},function(e,t){return t+1}).map(function(e){return o().createElement("div",{key:e,"data-page":e,ref:function(t){t?i.current.set(e,t):i.current.delete(e)},style:{width:"100%",maxWidth:u.width,margin:"0 auto 16px",aspectRatio:"".concat(u.width," / ").concat(u.height),background:"#fff",border:"1px solid #f0f0f0"}})}):null):null},eD=function(e){var t=e.file;return o().createElement(l.Alert,{type:"warning",description:o().createElement(s.Trans,{ns:f.C},"File type is not supported for previewing, please ",e.onDownload?o().createElement("a",{onClick:function(){var n;return null==(n=e.onDownload)?void 0:n.call(e,t)},style:{textDecoration:"underline",cursor:"pointer"}},"download it to preview"):o().createElement("span",null,"download it to preview")),showIcon:!0})};M.add({match:function(){return!0},Previewer:ek(eD)}),M.add({match:function(e){return et(e,"image/*")},getThumbnailURL:function(e){return Z(e)},Previewer:function(e){var t=e.file,n=e.list,r=e.index,a=e.open,c=e.onOpenChange,u=e.onSwitchIndex,s=e.onClose,f=e.onDownload;if("boolean"!=typeof a)return null;var p=Z(t);if(!p)return null;var d="number"==typeof r&&r>0,m="number"==typeof r&&r<n.length-1;return o().createElement(l.Image,{wrapperStyle:{display:"none"},preview:{visible:a,onVisibleChange:function(e){return null==c?void 0:c(e)},afterOpenChange:function(e){e||null==s||s()},toolbarRender:function(e,n){var a=n.transform.scale,c=n.actions,s=c.onFlipY,p=c.onFlipX,h=c.onRotateLeft,y=c.onRotateRight,v=c.onZoomOut,g=c.onZoomIn,b=c.onReset;return o().createElement(l.Space,{size:14,className:"toolbar-wrapper",style:{fontSize:"20px"}},o().createElement(i.LeftOutlined,{style:{cursor:d?"pointer":"not-allowed"},disabled:!d,onClick:function(){return d&&(null==u?void 0:u(r-1))}}),o().createElement(i.RightOutlined,{style:{cursor:m?"pointer":"not-allowed"},disabled:!m,onClick:function(){return m&&(null==u?void 0:u(r+1))}}),f?o().createElement(i.DownloadOutlined,{onClick:function(){return f(t)}}):null,o().createElement(i.SwapOutlined,{rotate:90,onClick:s}),o().createElement(i.SwapOutlined,{onClick:p}),o().createElement(i.RotateLeftOutlined,{onClick:h}),o().createElement(i.RotateRightOutlined,{onClick:y}),o().createElement(i.ZoomOutOutlined,{disabled:1===a,onClick:v}),o().createElement(i.ZoomInOutlined,{disabled:50===a,onClick:g}),o().createElement(i.UndoOutlined,{onClick:b}))}},src:p})}}),M.add({match:function(e){return["text/plain","application/json"].some(function(t){return et(e,t)})},Previewer:ek(eF)}),M.add({match:function(e){return et(e,"audio/*")},Previewer:ek(function(e){var t=e.file,n=(0,s.useTranslation)().t,r=X(t);return r?o().createElement("audio",{controls:!0},o().createElement("source",{src:r,type:(null==t?void 0:t.type)||(null==t?void 0:t.mimetype)}),n("Your browser does not support the audio tag.")):null})}),M.add({match:function(e){return et(e,"video/*")},Previewer:ek(function(e){var t=e.file,n=(0,s.useTranslation)().t,r=X(t);return r?o().createElement("video",{key:r,controls:!0,width:"100%",height:"100%"},o().createElement("source",{src:r,type:(null==t?void 0:t.type)||(null==t?void 0:t.mimetype)}),n("Your browser does not support the video tag.")):null})}),M.add({match:function(e){return eo(e,X(e))},Previewer:ek(eD)}),M.add({match:function(e){return ei(e,X(e))},Previewer:ek(function(e){var t=X(e.file);return ex(e.file,t)?o().createElement(eA,e):o().createElement(eF,e)})});var eq=function(e){var t,n=D(e.file);if(!n)return null;var r=(null!=(t=M.getTypeByFile(n))?t:{}).Previewer;return r?o().createElement(r,x(w({},e),{file:n})):null}},592:function(e,t,n){"use strict";n.d(t,{KT:function(){return f},tp:function(){return m},CX:function(){return g},OC:function(){return w},vS:function(){return E},BL:function(){return c},om:function(){return d},mt:function(){return u},C6:function(){return j},Sx:function(){return h},Lq:function(){return p},Lg:function(){return x}});var r=n(485),o=n(59),i=n(155),a=n.n(i),l=n(488);function c(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"baseUrl",label:"".concat(e("Base URL")," :"),rules:[{required:!0,message:e("The field value is required")}],extra:e('Base URL for file access, could be your CDN base URL. For example: "https://cdn.nocobase.com".')},a().createElement(r.EnvVariableInput,null))}function u(e){var t=(0,l.k)();return a().createElement(o.Form.Item,{name:"default",valuePropName:"checked"},a().createElement(o.Checkbox,{disabled:e.disabled},t("Default storage")))}var s=n(624);function f(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:["rules","size"],label:"".concat(e("File size limit")," :"),rules:[{required:!0,message:e("The field value is required")}],extra:e("Minimum from 1 byte.")},a().createElement(r.FileSizeInput,{min:s.UW,max:s.Qj,defaultValue:s.ZH}))}function p(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:["rules","mimetype"],label:"".concat(e("File type allowed (in MIME type format)")," :"),extra:e('Multi-types separated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.')},a().createElement(o.Input,{placeholder:"*"}))}function d(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"name",label:"".concat(e("Storage name")," :"),rules:[{required:!0,message:e("The field value is required")}],extra:e("Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.")},a().createElement(o.Input,null))}function m(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"paranoid",valuePropName:"checked",extra:e("Files are only removed when their corresponding records in the file collection are deleted. If a record from another collection includes an associating field referencing the file collection, the file will not be deleted unless cascade deletion is enabled for that association.")},a().createElement(o.Checkbox,null,e("Keep file in storage when destroy the file record")))}function h(e){var t=(0,l.k)();return a().createElement(o.Form.Item,{name:"path",label:"".concat(t("Path")," :"),extra:t('Relative path the file will be saved to. Left blank as root path. The leading and trailing slashes "/" will be ignored. For example: "user/avatar".')},a().createElement(r.EnvVariableInput,{addonBefore:e.addonBefore}))}var y=n(375);function v(e){var t=e.checked,n=e.onChange,r=e.disabled,i=e.t,l=o.theme.useToken().token,c=i("When checked, anyone with the file URL can access the file without NocoBase permission checks.");return a().createElement(o.Space,{size:4},a().createElement(o.Checkbox,{checked:t,onChange:function(e){return null==n?void 0:n(e.target.checked)},disabled:r},i("Allow public access")),a().createElement(o.Tooltip,{title:c,placement:"topRight",autoAdjustOverflow:{adjustX:1,adjustY:1},styles:{root:{maxWidth:"min(320px, calc(100vw - ".concat(2*l.margin,"px))")}}},a().createElement(y.QuestionCircleOutlined,{tabIndex:0,role:"img","aria-label":c,style:{color:l.colorTextSecondary,cursor:"help",fontSize:l.fontSize}})))}function g(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:["options","public"],valuePropName:"checked",noStyle:!0},a().createElement(v,{t:e}))}var b=[{label:"Append random ID",value:"appendRandomID"},{label:"Random string",value:"random"},{label:"Keep original filename (will be overwrite if filename is existed)",value:"none"}];function w(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"renameMode",label:"".concat(e("Renaming")," :"),extra:e("Renaming strategy to avoid filename conflicts when uploading files.")},a().createElement(o.Radio.Group,{options:b.map(function(t){var n,r;return 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={label:e(t.label)},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})}))}function x(){var e=(0,l.k)();return a().createElement(o.Form.Item,{name:"title",label:"".concat(e("Title")," :"),rules:[{required:!0,message:e("The field value is required")}]},a().createElement(o.Input,null))}var O=n(477);function S(){var e,t,n=(e=["\n width: 100%;\n\n .ant-radio-wrapper {\n width: 100%;\n }\n\n .file-url-proxy-option {\n position: relative;\n width: 100%;\n }\n\n .file-url-proxy-option > .ant-radio-wrapper {\n width: 100%;\n }\n\n .file-url-public-access {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 1;\n }\n\n .ant-radio {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: flex-start;\n padding-top: ","px;\n }\n\n .ant-tag {\n max-width: 100%;\n overflow-wrap: anywhere;\n white-space: normal;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return S=function(){return n},n}function E(e){var t=e.id,n=e.value,r=e.onChange,l=e.disabled,c=e.originalUrlExample,u=e.publicAccessControl,s=e.t,f=o.theme.useToken().token,p=(0,i.useMemo)(function(){return(0,O.css)(S(),f.paddingXXS)},[f.paddingXXS]),d=null!=n&&n;return a().createElement(o.Radio.Group,{id:t,value:d,onChange:function(e){return null==r?void 0:r(e.target.value)},disabled:l,className:p},a().createElement("div",{className:"file-url-proxy-option"},a().createElement(o.Radio,{value:!1},a().createElement("div",null,s("NocoBase URL")),a().createElement("div",{className:"ant-form-item-explain"},s("Uses a NocoBase file URL and follows the view permissions configured for the file record.")),a().createElement("div",{className:"ant-form-item-explain"},a().createElement(o.Tag,{bordered:!1},"/files/main/main/attachments/1.png"))),!d&&u?a().createElement("div",{className:"file-url-public-access"},u):null),a().createElement(o.Radio,{value:!0},a().createElement("div",null,s("Original URL")),a().createElement("div",{className:"ant-form-item-explain"},s("The URL points directly to the storage service and does not pass through NocoBase.")),a().createElement("div",{className:"ant-form-item-explain"},a().createElement(o.Tag,{bordered:!1},c||"https://storage.example.com/path/to/file.png"))))}function j(e){var t=(0,l.k)(),n=o.Form.useFormInstance(),r=o.Form.useWatch(["options","useOriginalUrl"],n);return(0,i.useEffect)(function(){r&&n.setFieldValue(["options","public"],!1)},[n,r]),a().createElement(o.Form.Item,{name:["options","useOriginalUrl"],label:"".concat(t("File URL")," :")},a().createElement(E,{t:t,originalUrlExample:e.originalUrlExample,publicAccessControl:a().createElement(g,null)}))}},732:function(e,t,n){"use strict";n.d(t,{p:function(){return s}});var r=n(166),o=n(485),i=n(488);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var s=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=l(t),a(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,u()?Reflect.construct(t,r||[],l(this).constructor):t.apply(this,r)),"name","attachment"),a(e,"type","object"),a(e,"group","media"),a(e,"title",(0,i.M)("Attachment")),a(e,"isAssociation",!0),a(e,"creatable",!1),a(e,"default",{interface:"attachment",type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-use-component-props":"useAttachmentFieldProps"}}),a(e,"availableTypes",["belongsToMany"]),a(e,"configure",{items:[{name:"target",title:(0,i.M)("File collection"),component:"Select",required:!0,defaultValue:"attachments",schema:{enum:"{{fileCollections}}"}},{name:"targetKey",defaultValue:"id",hidden:!0},{name:"uiSchema.x-component-props.accept",title:(0,i.M)("MIME type"),component:"Input",componentProps:{placeholder:"image/*"}},{name:"uiSchema.x-component-props.multiple",title:(0,i.M)("Allow uploading multiple files"),component:"Checkbox",defaultValue:!0}]}),a(e,"filterable",{nested:!0,children:[]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&c(n,e),t=[{key:"initialize",value:function(e){e.through||(e.through="t_".concat((0,r.uid)())),e.foreignKey||(e.foreignKey="f_".concat((0,r.uid)())),e.otherKey||(e.otherKey="f_".concat((0,r.uid)())),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id")}}],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}(o.CollectionFieldInterface)},488:function(e,t,n){"use strict";n.d(t,{M:function(){return a},k:function(){return i}});var r=n(694),o=n(358);function i(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,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}({ns:[o.C,"client"]},n))}}function a(e){return(0,r.tExpr)(e,{ns:[o.C,"client"]})}},358:function(e,t,n){"use strict";n.d(t,{C:function(){return r}});var r="file-manager"},624:function(e,t,n){"use strict";n.d(t,{Qj:function(){return o},UW:function(){return r},ZF:function(){return a},ZH:function(){return i},a_:function(){return u},e7:function(){return c},y2:function(){return l}});var r=1,o=1/0,i=0x1400000,a="local",l="ali-oss",c="s3",u="tx-cos"},375:function(e){"use strict";e.exports=r},477:function(e){"use strict";e.exports=t},230:function(e){"use strict";e.exports=n},166:function(e){"use strict";e.exports=l},485:function(e){"use strict";e.exports=a},694:function(e){"use strict";e.exports=o},625:function(e){"use strict";e.exports=i},59:function(e){"use strict";e.exports=u},773:function(e){"use strict";e.exports=s},155:function(e){"use strict";e.exports=c},953:function(t){"use strict";t.exports=e}},h={};function y(e){var t=h[e];if(void 0!==t)return t.exports;var n=h[e]={exports:{}};return m[e](n,n.exports,y),n.exports}y.m=m,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return""+e+"."+({125:"9cdb7cf3ef4712ef",229:"297c431f63a29cb2",336:"04d06f2cdcc3d0b5",43:"1ec3e5bf1118d239",450:"d49b00f3c0388c74",929:"3744119eff70b3a3",942:"f36d807d763a1b53"})[e]+".js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v={},y.l=function(e,t,n,r){if(v[e])return void v[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var c=a[l];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-file-manager/client-v2:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-file-manager/client-v2:"+n),o.src=e),v[e]=[t];var u=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=v[e];if(delete v[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),i&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(g=y.g.location+"");var v,g,b=y.g.document;if(!g&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(g=b.currentScript.src),!g)){var w=b.getElementsByTagName("script");if(w.length)for(var x=w.length-1;x>-1&&(!g||!/^http(s?):/.test(g));)g=w[x--].src}if(!g)throw Error("Automatic publicPath is not supported in this browser");y.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},y.f.j=function(e,t){var n=y.o(f,e)?f[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=f[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),i=Error();y.l(o,function(t){if(y.o(f,e)&&(0!==(n=f[e])&&(f[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},p=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],l=0;if(o.some(function(e){return 0!==f[e]})){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);a&&a(y)}for(e&&e(t);l<o.length;l++)r=o[l],y.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(d=self.webpackChunk_nocobase_plugin_file_manager_client_v2=self.webpackChunk_nocobase_plugin_file_manager_client_v2||[]).forEach(p.bind(null,0)),d.push=p.bind(null,d.push.bind(d));var O={};return!function(){"use strict";var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-file-manager/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-file-manager/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",l=a.indexOf(i);e=l>=0?a.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-file-manager/dist/client-v2/"}y.p=e}(),!function(){"use strict";y.r(O),y.d(O,{AttachmentFieldInterface:function(){return r.p},BaseUrlField:function(){return t.BL},CardUpload:function(){return n.CardUpload},DefaultField:function(){return t.mt},FileSizeField:function(){return t.KT},MimetypeField:function(){return t.Lq},NameField:function(){return t.om},ParanoidField:function(){return t.tp},PathField:function(){return t.Sx},PluginFileManagerClientV2:function(){return e.A},PublicAccessField:function(){return t.CX},RenameModeField:function(){return t.OC},TitleField:function(){return t.Lg},UploadFieldModel:function(){return n.UploadFieldModel},UseOriginalUrlField:function(){return t.C6},UseOriginalUrlRadio:function(){return t.vS},default:function(){return e.A},filePreviewTypes:function(){return o.e$},getPermanentFilePreviewUrl:function(){return o.Uv},getPreviewThumbnailUrl:function(){return o.qk},isPermanentFileUrl:function(){return o.s$},matchMimetype:function(){return o._b},wrapWithModalPreviewer:function(){return o.LD}});var e=y(667),t=y(592),n=y(76),r=y(732),o=y(23)}(),O}()});
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { CollectionFieldInterface } from '@nocobase/client-v2';
|
|
10
|
+
export declare class AttachmentFieldInterface extends CollectionFieldInterface {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
group: string;
|
|
14
|
+
title: string;
|
|
15
|
+
isAssociation: boolean;
|
|
16
|
+
creatable: boolean;
|
|
17
|
+
default: {
|
|
18
|
+
interface: string;
|
|
19
|
+
type: string;
|
|
20
|
+
target: string;
|
|
21
|
+
uiSchema: {
|
|
22
|
+
type: string;
|
|
23
|
+
'x-component': string;
|
|
24
|
+
'x-use-component-props': string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
availableTypes: string[];
|
|
28
|
+
configure: {
|
|
29
|
+
items: ({
|
|
30
|
+
name: string;
|
|
31
|
+
title: string;
|
|
32
|
+
component: "Select";
|
|
33
|
+
required: boolean;
|
|
34
|
+
defaultValue: string;
|
|
35
|
+
schema: {
|
|
36
|
+
enum: string;
|
|
37
|
+
};
|
|
38
|
+
hidden?: undefined;
|
|
39
|
+
componentProps?: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
name: string;
|
|
42
|
+
defaultValue: string;
|
|
43
|
+
hidden: boolean;
|
|
44
|
+
title?: undefined;
|
|
45
|
+
component?: undefined;
|
|
46
|
+
required?: undefined;
|
|
47
|
+
schema?: undefined;
|
|
48
|
+
componentProps?: undefined;
|
|
49
|
+
} | {
|
|
50
|
+
name: string;
|
|
51
|
+
title: string;
|
|
52
|
+
component: "Input";
|
|
53
|
+
componentProps: {
|
|
54
|
+
placeholder: string;
|
|
55
|
+
};
|
|
56
|
+
required?: undefined;
|
|
57
|
+
defaultValue?: undefined;
|
|
58
|
+
schema?: undefined;
|
|
59
|
+
hidden?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
name: string;
|
|
62
|
+
title: string;
|
|
63
|
+
component: "Checkbox";
|
|
64
|
+
defaultValue: boolean;
|
|
65
|
+
required?: undefined;
|
|
66
|
+
schema?: undefined;
|
|
67
|
+
hidden?: undefined;
|
|
68
|
+
componentProps?: undefined;
|
|
69
|
+
})[];
|
|
70
|
+
};
|
|
71
|
+
filterable: {
|
|
72
|
+
nested: boolean;
|
|
73
|
+
children: any[];
|
|
74
|
+
};
|
|
75
|
+
initialize(values: Record<string, unknown>): void;
|
|
76
|
+
}
|
|
@@ -7,7 +7,29 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { FieldModel } from '@nocobase/client-v2';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
type FileCollectionLike = {
|
|
12
|
+
dataSourceKey?: string;
|
|
13
|
+
name: string;
|
|
14
|
+
template?: string;
|
|
15
|
+
};
|
|
16
|
+
type FileCollectionFieldLike = {
|
|
17
|
+
interface?: string;
|
|
18
|
+
target?: string;
|
|
19
|
+
targetCollection?: FileCollectionLike;
|
|
20
|
+
};
|
|
21
|
+
export declare const getFileCollectionReference: (collectionField?: FileCollectionFieldLike, currentCollection?: FileCollectionLike) => {
|
|
22
|
+
dataSourceKey: string;
|
|
23
|
+
collectionName: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const FilePreview: ({ file, size, showFileName, onClick, }: {
|
|
26
|
+
file: any;
|
|
27
|
+
size: number;
|
|
28
|
+
showFileName: boolean;
|
|
29
|
+
onClick?: () => void;
|
|
30
|
+
}) => React.JSX.Element;
|
|
10
31
|
export declare class DisplayPreviewFieldModel extends FieldModel {
|
|
11
32
|
disableTitleField: boolean;
|
|
12
33
|
render(): any;
|
|
13
34
|
}
|
|
35
|
+
export {};
|
|
@@ -8,6 +8,31 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { ActionModel } from '@nocobase/client-v2';
|
|
10
10
|
import React from 'react';
|
|
11
|
+
type UploadActionContextModel = {
|
|
12
|
+
context: {
|
|
13
|
+
collection?: {
|
|
14
|
+
dataSourceKey?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
};
|
|
17
|
+
blockModel?: {
|
|
18
|
+
collection?: {
|
|
19
|
+
dataSourceKey?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
};
|
|
22
|
+
resource?: {
|
|
23
|
+
getDataSourceKey?: () => string | undefined;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare function getModelDataSourceKey(model: UploadActionContextModel): string;
|
|
29
|
+
export declare function appendUploadDataSourceKey(url: string, dataSourceKey?: string): string;
|
|
30
|
+
export declare function getUploadAction(action: string, storageAction: unknown, dataSourceKey?: string): string;
|
|
31
|
+
export declare function getUploadDataSourceHeaders(dataSourceKey?: string): {
|
|
32
|
+
'X-Data-Source': string;
|
|
33
|
+
} | {
|
|
34
|
+
'X-Data-Source'?: undefined;
|
|
35
|
+
};
|
|
11
36
|
export declare function useStorage(storage: any, dataSourceKey?: string): any;
|
|
12
37
|
export declare function useStorageCfg(model: any): {
|
|
13
38
|
storage: any;
|
|
@@ -26,3 +51,4 @@ export declare class UploadActionModel extends ActionModel {
|
|
|
26
51
|
set onUploadClick(fn: any);
|
|
27
52
|
render(): React.JSX.Element;
|
|
28
53
|
}
|
|
54
|
+
export {};
|
|
@@ -8,10 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import type { DocumentInitParameters } from 'pdfjs-dist/types/src/display/api';
|
|
11
|
+
export interface FileCollectionReference {
|
|
12
|
+
dataSourceKey: string;
|
|
13
|
+
collectionName: string;
|
|
14
|
+
}
|
|
11
15
|
export interface FilePreviewerProps {
|
|
12
16
|
file: any;
|
|
13
17
|
index: number;
|
|
14
18
|
list: any[];
|
|
19
|
+
fileCollection?: FileCollectionReference;
|
|
15
20
|
open?: boolean;
|
|
16
21
|
onOpenChange?: (open: boolean) => void;
|
|
17
22
|
onSwitchIndex?: (index: number) => void;
|
|
@@ -30,6 +35,10 @@ export declare class FilePreviewTypes {
|
|
|
30
35
|
}
|
|
31
36
|
export declare const filePreviewTypes: FilePreviewTypes;
|
|
32
37
|
export declare function normalizePreviewFile(file: any): any;
|
|
38
|
+
export declare function getLocalPreviewUrl(file: any): string;
|
|
39
|
+
export declare function rememberLocalPreviewUrl(file: any, sourceFile: any): void;
|
|
40
|
+
export declare function revokeLocalPreviewUrl(file: any): void;
|
|
41
|
+
export declare function revokeLocalPreviewUrls(files?: any[]): void;
|
|
33
42
|
export declare function getPreviewFileUrl(file: any): any;
|
|
34
43
|
export declare function getFileUrl(file: any): any;
|
|
35
44
|
export declare function matchMimetype(file: any, type: string): any;
|
|
@@ -37,6 +46,11 @@ export declare const getFileExt: (file: any, url?: string) => string;
|
|
|
37
46
|
export declare const isActiveContentFile: (file: any, url?: string) => boolean;
|
|
38
47
|
export declare const isPdfFile: (file: any, url?: string) => boolean;
|
|
39
48
|
export declare const isSameOriginUrl: (url?: string) => boolean;
|
|
49
|
+
export declare const isPermanentFileUrl: (value: string | URL) => boolean;
|
|
50
|
+
export declare const getPermanentFilePreviewUrl: (value?: string) => string;
|
|
51
|
+
export declare const getFileFetchCredentials: (url: string | URL) => RequestCredentials;
|
|
52
|
+
export declare const triggerFileDownload: (url: string, filename: string) => void;
|
|
53
|
+
export declare const shouldUsePdfJsPreview: (file: any, src?: any) => boolean;
|
|
40
54
|
export declare const getFileName: (file: any, url?: string) => any;
|
|
41
55
|
export declare const getDownloadFileName: (file: any, url?: string) => string;
|
|
42
56
|
export declare const getFallbackIcon: (file: any, url?: string) => string;
|
|
@@ -45,7 +59,7 @@ export declare const wrapWithModalPreviewer: (Previewer: React.ComponentType<Fil
|
|
|
45
59
|
export declare const getPdfPreviewResourceOptions: () => Pick<DocumentInitParameters, 'cMapPacked' | 'cMapUrl' | 'standardFontDataUrl'>;
|
|
46
60
|
export declare const getPdfPreviewApiSrc: () => string;
|
|
47
61
|
export declare const getPdfPreviewWorkerSrc: () => string;
|
|
48
|
-
type PdfPreviewErrorCode = 'resources' | 'file' | 'document';
|
|
62
|
+
type PdfPreviewErrorCode = 'resources' | 'file' | 'document' | 'size';
|
|
49
63
|
export declare const getPdfPreviewErrorCode: (error: unknown) => PdfPreviewErrorCode;
|
|
50
64
|
export declare const FilePreviewRenderer: (props: FilePreviewerProps) => React.JSX.Element;
|
|
51
65
|
export {};
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,25 +8,28 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.2.0
|
|
11
|
+
"@nocobase/client": "2.2.0",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"antd": "5.24.2",
|
|
14
14
|
"@ant-design/icons": "5.6.1",
|
|
15
15
|
"@formily/shared": "2.3.7",
|
|
16
16
|
"lodash": "4.18.1",
|
|
17
17
|
"react-i18next": "11.18.6",
|
|
18
|
-
"@nocobase/flow-engine": "2.2.0-beta.8",
|
|
19
|
-
"@nocobase/client-v2": "2.2.0-beta.8",
|
|
20
|
-
"multer": "2.1.1",
|
|
21
|
-
"@nocobase/database": "2.2.0-beta.8",
|
|
22
|
-
"@nocobase/server": "2.2.0-beta.8",
|
|
23
|
-
"@nocobase/utils": "2.2.0-beta.8",
|
|
24
|
-
"@nocobase/test": "2.2.0-beta.8",
|
|
25
18
|
"@formily/react": "2.3.7",
|
|
19
|
+
"@nocobase/flow-engine": "2.2.0",
|
|
20
|
+
"@nocobase/client-v2": "2.2.0",
|
|
21
|
+
"@nocobase/actions": "2.2.0",
|
|
22
|
+
"@nocobase/data-source-manager": "2.2.0",
|
|
23
|
+
"multer": "2.1.1",
|
|
24
|
+
"@nocobase/acl": "2.2.0",
|
|
25
|
+
"@nocobase/database": "2.2.0",
|
|
26
|
+
"@nocobase/server": "2.2.0",
|
|
27
|
+
"@nocobase/utils": "2.2.0",
|
|
28
|
+
"jsonwebtoken": "9.0.2",
|
|
29
|
+
"@nocobase/test": "2.2.0",
|
|
26
30
|
"@emotion/css": "11.13.0",
|
|
27
31
|
"ahooks": "3.7.8",
|
|
28
|
-
"@nocobase/
|
|
29
|
-
"@nocobase/plugin-data-source-main": "2.2.0-beta.8",
|
|
32
|
+
"@nocobase/plugin-data-source-main": "2.2.0",
|
|
30
33
|
"sequelize": "6.35.2",
|
|
31
34
|
"axios": "1.7.7"
|
|
32
35
|
};
|