@nocobase/client-v2 2.2.10 → 2.2.12
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/es/flow/components/filter/VariableFilterItem.d.ts +7 -0
- package/es/index.mjs +1 -1
- package/lib/index.js +24 -24
- package/package.json +7 -7
- package/src/flow/components/filter/VariableFilterItem.tsx +11 -3
- package/src/flow/components/filter/__tests__/VariableFilterItem.rightMetaTree.test.tsx +158 -0
|
@@ -36,6 +36,13 @@ export interface VariableFilterItemProps {
|
|
|
36
36
|
rightVariableConverters?: Pick<Converters, 'resolvePathFromValue' | 'resolveValueFromPath'>;
|
|
37
37
|
ignoreFieldNames?: string[];
|
|
38
38
|
maxAssociationFieldDepth?: number;
|
|
39
|
+
/**
|
|
40
|
+
* 右侧变量树的关联层级上限,默认与 `maxAssociationFieldDepth` 一致。
|
|
41
|
+
* 传 `null` 表示不限制:右侧是变量树而非集合字段树,其深度可能已由调用方约束
|
|
42
|
+
* (例如工作流的变量树由触发器的「预加载关系数据」决定),此时再按左侧的层级上限裁剪
|
|
43
|
+
* 会让已配置好的深层变量选不到。
|
|
44
|
+
*/
|
|
45
|
+
rightMaxAssociationFieldDepth?: number | null;
|
|
39
46
|
}
|
|
40
47
|
/**
|
|
41
48
|
* 上下文筛选项组件
|
package/es/index.mjs
CHANGED
|
@@ -266,7 +266,7 @@ import*as __rspack_external__ant_design_icons_a8184985 from"@ant-design/icons";i
|
|
|
266
266
|
... (stack truncated)`}function w(e){let t=String(e||"").split("\n"),l=new Set;for(let e=0;e<t.length;e++){let o=t[e];(f.test(o)||g.test(o))&&l.add(e)}if(0===l.size)return()=>!1;let o=[0];for(let e=1;e<t.length;e++)o[e]=o[e-1]+t[e-1].length+1;let n=e=>{let t=0,l=o.length-1,n=0;for(;t<=l;){let i=t+l>>1;o[i]<=e?(n=i,t=i+1):l=i-1}return n};return e=>l.has(n(e))}function S(e,t){let l=Math.max(0,Math.min(e.length,Math.floor(t))),o=e.lineAt(l);return{line:o.number,column:l-o.from+1}}function k(e){return[...e].sort((e,t)=>{var l,o,n,i,r,a,s,d;let u=+("lint"!==e.type),c=+("lint"!==t.type);if(u!==c)return u-c;let p=(null==(o=e.location)||null==(l=o.start)?void 0:l.line)??Number.MAX_SAFE_INTEGER,m=(null==(i=t.location)||null==(n=i.start)?void 0:n.line)??Number.MAX_SAFE_INTEGER;if(p!==m)return p-m;let h=(null==(a=e.location)||null==(r=a.start)?void 0:r.column)??Number.MAX_SAFE_INTEGER,f=(null==(d=t.location)||null==(s=d.start)?void 0:s.column)??Number.MAX_SAFE_INTEGER;return h!==f?h-f:String(e.ruleId||"").localeCompare(String(t.ruleId||""))})}function F(e){let t={error:0,warn:1,info:2,log:3};return e.map((e,t)=>({log:e,index:t})).sort((e,l)=>{let o=t[e.log.level]??Number.MAX_SAFE_INTEGER,n=t[l.log.level]??Number.MAX_SAFE_INTEGER;return o!==n?o-n:e.index-l.index}).map(e=>e.log)}function C(e){let t,l=String(e||"");if(!l.trim())return[];let o=n.Text.of(l.split("\n")),i=w(l);try{t=h.parse(l).cursor()}catch(e){return[{type:"lint",ruleId:"parse-error",message:`Syntax error: ${v((null==e?void 0:e.message)||e)}`,location:{start:{line:1,column:1}}}]}let r=[],a=new Set,s=e=>{let t=Math.max(0,Math.min(l.length,e));if(i(t)||a.has(t))return;a.add(t);let n=S(o,t),s=l.slice(t,Math.min(l.length,t+24)).replace(/\s+/g," ").trim(),d=s?` near "${s}"`:"";r.push({type:"lint",ruleId:"parse-error",message:`Syntax error${d}.`,location:{start:n}})};do t.type.isError&&s(t.from);while(t.next());return r}function A(e){let t,l=String(e||"");if(!l.trim())return[];let o=w(l),u=n.Text.of(l.split("\n")),c=[],p=(e,t,n)=>{let i=Math.max(0,Math.min(l.length,e));if(o(i))return;let r=S(u,i);c.push({type:"lint",ruleId:t,message:n,location:{start:r}})},m=()=>{let e="no-noncallable-call",t=new Set,n=n=>{let i=Math.max(0,Math.min(l.length,n));o(i)||t.has(i)||(t.add(i),p(i,e,"This expression is not callable."))},i=l.length,r=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||95===t||36===t},a=e=>{if(!e)return!1;let t=e.charCodeAt(0);return r(e)||t>=48&&t<=57},s=e=>{let t=e;for(;t<i&&/\s/.test(l[t]);)t++;return t},d=e=>!(e>=i)&&("("===l[e]||"?"===l[e]&&"."===l[e+1]&&"("===l[e+2]),u=e=>{let t=1,o="code";for(let n=e+1;n<i;n++){let e=l[n],r=n+1<i?l[n+1]:"";if("lineComment"===o){"\n"===e&&(o="code");continue}if("blockComment"===o){"*"===e&&"/"===r&&(o="code",n+=1);continue}if("single"===o){if("\\"===e){n+=1;continue}"'"===e&&(o="code");continue}if("double"===o){if("\\"===e){n+=1;continue}'"'===e&&(o="code");continue}if("template"===o){if("\\"===e){n+=1;continue}"`"===e&&(o="code");continue}if("/"===e&&"/"===r){o="lineComment",n+=1;continue}if("/"===e&&"*"===r){o="blockComment",n+=1;continue}if("'"===e){o="single";continue}if('"'===e){o="double";continue}if("`"===e){o="template";continue}if("("===e)t++;else if(")"===e&&0==--t)return n}return -1},c=e=>"true"===e||"false"===e||"null"===e,m="code";for(let e=0;e<i;e++){let t=l[e],o=e+1<i?l[e+1]:"";if("lineComment"===m){"\n"===t&&(m="code");continue}if("blockComment"===m){"*"===t&&"/"===o&&(m="code",e+=1);continue}if("/"===t&&"/"===o){m="lineComment",e+=1;continue}if("/"===t&&"*"===o){m="blockComment",e+=1;continue}if("'"===t||'"'===t){let o=t,r=e;for(e+=1;e<i;){let t=l[e];if("\\"===t){e+=2;continue}if(t===o)break;e+=1}d(s(Math.min(i,e+1)))&&n(r);continue}if("`"===t){let t=e;for(e+=1;e<i;){let t=l[e];if("\\"===t){e+=2;continue}if("`"===t)break;e+=1}d(s(Math.min(i,e+1)))&&n(t);continue}if(t>="0"&&t<="9"){let t=e;for(e+=1;e<i&&l[e]>="0"&&l[e]<="9";)e++;if("."===l[e])for(e+=1;e<i&&l[e]>="0"&&l[e]<="9";)e++;if("e"===l[e]||"E"===l[e]){let t=l[e+1],o=e+1;if(("+"===t||"-"===t)&&(o+=1),l[o]>="0"&&l[o]<="9")for(e=o+1;e<i&&l[e]>="0"&&l[e]<="9";)e++}"n"===l[e]&&(e+=1),d(s(e))&&n(t),e-=1;continue}if(r(t)){let t=e;for(e+=1;e<i&&a(l[e]);)e++;c(l.slice(t,e))&&d(s(e))&&n(t),e-=1;continue}if("("===t){let t=s(e+1),o=t,p=!1;("+"===l[t]||"-"===l[t])&&(o=t,t=s(t+1));let m=l[t];if("{"===m||"["===m||"'"===m||'"'===m||"`"===m)p=!0;else if(m>="0"&&m<="9")p=!0;else if(r(m)){let e=t+1;for(;e<i&&a(l[e]);)e++;c(l.slice(t,e))&&(p=!0)}if(p){let t=u(e);t>e&&d(s(t+1))&&n(o)}}}};try{let e=i.Parser||i;t=("function"==typeof r.default?e.extend((0,r.default)()):e).parse(l,{ecmaVersion:2022,sourceType:"script",allowAwaitOutsideFunction:!0,allowReturnOutsideFunction:!0,locations:!0})}catch(e){return m(),c}let h=new Set(s.RUNJS_ALLOWED_BARE_GLOBAL_NAMES),f=e=>{e&&"string"==typeof e.name&&h.add(e.name)},g=e=>{if(!e)return;let t=[e];for(;t.length;){let e=t.pop();e&&("Identifier"===e.type?f(e):"AssignmentPattern"===e.type?t.push(e.left):"ArrayPattern"===e.type?(e.elements||[]).forEach(e=>e&&t.push(e)):"ObjectPattern"===e.type&&(e.properties||[]).forEach(e=>e&&t.push(e.value||e)))}};try{a.full(t,e=>{switch(null==e?void 0:e.type){case"VariableDeclarator":g(e.id);break;case"FunctionDeclaration":case"FunctionExpression":f(e.id),(e.params||[]).forEach(g);break;case"ArrowFunctionExpression":(e.params||[]).forEach(g);break;case"CatchClause":g(e.param);break;case"ClassDeclaration":f(e.id)}},d)}catch(e){}try{a.full(t,e=>{if(!e||"string"!=typeof e.type||"CallExpression"!==e.type)return;let t=e.callee;if(!(t&&("Identifier"===t.type||"MemberExpression"===t.type||"FunctionExpression"===t.type||"ArrowFunctionExpression"===t.type||"CallExpression"===t.type||"ChainExpression"===t.type))){let l=(null==t?void 0:t.start)??e.start??0;p(l,"no-noncallable-call","This expression is not callable.")}},d)}catch(e){}try{let e=new Set,l=new Set(["t"]);a.full(t,t=>{var o,n,i;if(!t||"string"!=typeof t.type||"CallExpression"!==t.type)return;let r=t.callee;if((null==r?void 0:r.type)==="ChainExpression"&&(r=r.expression),!r||"MemberExpression"!==r.type)return;let a=r.object;if(!a||"Identifier"!==a.type||"ctx"!==a.name)return;let s=null;if(r.computed||(null==(o=r.property)?void 0:o.type)!=="Identifier"?r.computed&&(null==(n=r.property)?void 0:n.type)==="Literal"&&"string"==typeof r.property.value&&(s=r.property.value):s=r.property.name,!s||"string"!=typeof s)return;let d=s.trim();if(!d||d.startsWith("_")||d.length>2||l.has(d)||e.has(d))return;let u=(null==(i=r.property)?void 0:i.start)??r.start??t.start??0;p(u,"possible-undefined-ctx-member-call",`Possible undefined ctx method call: ctx.${d}(). This may be a typo or not available in the current ctx API.`),e.add(d)},d)}catch(e){}try{let e=new Set;a.ancestor(t,{Identifier(t,l){let o=null==t?void 0:t.name;if(!o||h.has(o)||e.has(o))return;let n=l[l.length-2];if(!n||"VariableDeclarator"===n.type&&n.id===t||"FunctionDeclaration"===n.type&&n.id===t||"FunctionExpression"===n.type&&n.id===t||"ClassDeclaration"===n.type&&n.id===t||"ClassExpression"===n.type&&n.id===t||"Property"===n.type&&n.key===t&&!0!==n.computed||"MemberExpression"===n.type&&n.property===t&&!0!==n.computed||"LabeledStatement"===n.type&&n.label===t||"BreakStatement"===n.type&&n.label===t||"ContinueStatement"===n.type&&n.label===t)return;let i=t.start??0;p(i,"possible-undefined-variable",`Possible undefined variable: ${o}`),e.add(o)}},d)}catch(e){}return c}function P(e){let t=(t,l)=>{let o=l.map(e=>v(e)).join(" ").trim();e.push({level:t,message:o})},l={trace:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("log",l)},debug:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("log",l)},info:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("info",l)},warn:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("warn",l)},error:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("error",l)},fatal:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("error",l)},child:()=>l};return{consoleCapture:{log:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("log",l)},info:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("info",l)},warn:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("warn",l)},error:function(){for(var e=arguments.length,l=Array(e),o=0;o<e;o++)l[o]=arguments[o];return t("error",l)}},loggerCapture:l}}function T(e){if(!e.length)return;let t={timeout:0,internal:1,"preview-start-failed":2};return[...e].sort((e,l)=>{let o=t[String(e.ruleId||"")]??10,n=t[String(l.ruleId||"")]??10;return o!==n?o-n:0})[0]}function j(e){var t;let l=null==(t=e.location)?void 0:t.start,o=l?`line ${l.line}:${l.column} `:"",n=e.ruleId?`(${e.ruleId}) `:"";return`${o}${n}${e.message}`.trim()}function I(e){if(!e)return"Preview execution: unknown";let t="number"==typeof e.durationMs?`${Math.round(e.durationMs)}ms`:"unknown";return`Preview execution: started=${e.started}, finished=${e.finished}, timeout=${e.timeout}, duration=${t}`}function L(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…",o=String(e||"");return o.length<=t?o:`${o.slice(0,Math.max(0,t-l.length))}${l}`}function R(e,t){let{issues:l,logs:o,execution:n}=e,i=l.filter(e=>"lint"===e.type),r=l.filter(e=>"runtime"===e.type),a=F(o),s=T(r),d=[],u=l.length,c=i.length,p=r.length,m=a.length,h=e=>{e.length&&(d.push("Key logs:"),e.forEach(e=>{d.push(`[${e.level}] ${L(e.message,t.maxLogChars)}`)}),a.length>e.length&&d.push(`... ${a.length-e.length} more logs not shown`))};if(0===u){let e=a.some(e=>"warn"===e.level||"error"===e.level);d.push(e?`RunJS preview completed with warning/error logs: no diagnostic issues found. Logs: ${m}.`:`RunJS preview succeeded: no issues found. Logs: ${m}.`),d.push(I(n));let l=a.slice(0,Math.max(0,t.maxLogs));l.length&&(d.push(""),h(l));let o=d.join("\n").trimEnd();return{message:L(o,t.maxChars),truncated:o.length>t.maxChars}}d.push(`RunJS preview failed: ${u} issues (lint ${c} / runtime ${p}), logs: ${m}.`),d.push(I(n)),d.push("");let f=(e,l)=>{if(!l.length)return;d.push(`${e}:`);let o=l.slice(0,Math.max(0,t.maxIssues));o.forEach((e,l)=>{let o=`${l+1}) ${j(e)}`;if(d.push(o),t.includeStack&&e.stack){let l=L(String(e.stack),t.maxStackChars);d.push(L(l,t.maxStackChars))}}),l.length>o.length&&d.push(`... ${l.length-o.length} more not shown`),d.push("")},g=s&&r.length>1?[s,...r.filter(e=>e!==s)]:r;f("Static issues",i),f("Runtime issues",g);let v=a.slice(0,Math.max(0,t.maxLogs));v.length&&h(v);let y=d.join("\n").trimEnd(),_=y.length>t.maxChars;return{message:_?L(y,t.maxChars):y,truncated:_}}function D(e){let t=`(issues total ${e.issues.length}, logs total ${e.logs.length})`,l=!1;for(let o of[{maxLogs:40,maxLogChars:220,maxIssues:12,includeStack:!0,maxStackChars:800},{maxLogs:20,maxLogChars:160,maxIssues:10,includeStack:!0,maxStackChars:400},{maxLogs:12,maxLogChars:140,maxIssues:8,includeStack:!1,maxStackChars:0},{maxLogs:8,maxLogChars:120,maxIssues:5,includeStack:!1,maxStackChars:0},{maxLogs:3,maxLogChars:100,maxIssues:3,includeStack:!1,maxStackChars:0}]){let{message:n,truncated:i}=R(e,{...o,maxChars:u});if(l=l||i,!i){if(!l)return n;return L(`RunJS preview output was truncated.
|
|
267
267
|
${t}
|
|
268
268
|
|
|
269
|
-
${n}`,u)}}let o=T(e.issues.filter(e=>"runtime"===e.type)),n=o?`Key runtime issue: ${j(o)}`:"",i=["RunJS preview output was truncated.",t,e.execution?I(e.execution):void 0,n||void 0].filter(Boolean).join("\n").trim();return i.length<=u?i:L(i,u-1)+"\n"}function E(e){return D(e)}async function Y(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="string"==typeof e?e:String(e??""),n=[],i=[],r=null==l?void 0:l.version,a=(0,s.shouldPreprocessRunJSTemplates)({version:r});i.push(...C(o)),i.push(...A(o));let d="u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now(),u={started:!1,finished:!1,timeout:!1,durationMs:void 0};try{u.started=!0;let{consoleCapture:e,loggerCapture:l}=P(n),d={console:e};"u">typeof window&&(d.window=window,"u">typeof navigator&&(d.navigator=navigator)),"u">typeof document&&(d.document=document);let p=o;try{p=await (0,s.prepareRunJsCode)(o,{preprocessTemplates:a})}catch(o){let e=String((null==o?void 0:o.name)||""),t=v((null==o?void 0:o.message)||o),l=o instanceof SyntaxError||/^SyntaxError\b/i.test(e)||/SyntaxError\b/i.test(t);return i.push({type:"runtime",ruleId:l?"preview-start-failed":"internal",message:l?t:`Preview internal failure: ${t}`,stack:M(o)}),u.finished=!0,u.timeout=!1,{issues:k(i),logs:n,execution:u}}let m=await t.createJSRunner({globals:d,timeoutMs:c,version:r});m.globals.ctx.defineProperty("logger",{value:l});let h=await m.run(p);if(u.finished=!0,u.timeout=!!(null==h?void 0:h.timeout),!(null==h?void 0:h.success)){let e=null==h?void 0:h.error,t=(null==h?void 0:h.timeout)?"Execution timed out":v((null==e?void 0:e.message)||e||"Unknown error"),l=e instanceof SyntaxError||/^SyntaxError\b/i.test(String((null==e?void 0:e.name)||""));i.push({type:"runtime",ruleId:(null==h?void 0:h.timeout)?"timeout":l?"preview-start-failed":"runtime-error",message:t,stack:M(e)})}}catch(e){u.finished=!0,u.timeout=!1,i.push({type:"runtime",ruleId:"internal",message:`Preview internal failure: ${v((null==e?void 0:e.message)||e)}`,stack:M(e)})}finally{let e=Math.max(0,("u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now())-d);u.durationMs=Number.isFinite(e)?e:void 0}return{issues:k(i),logs:n,execution:u}}function N(e){let t=new s.FlowContext;if(t.addDelegate(e),"u">typeof document&&"function"==typeof document.createElement&&!e.element)try{let e=document.createElement("div");t.defineProperty("element",{value:e})}catch(e){}return t}async function O(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=N(t),n=await Y(e,o,l),i=0===n.issues.length,r=E(n);return{success:i,message:r.length>u?L(r,u):r}}},4e3(e,t,l){l.d(t,{cd:()=>f,tS:()=>d,kB:()=>u,Ot:()=>h,Wm:()=>U});var o=l(504),n=l(3526);let i=new Set(["date","dateOnly","datetime","datetimeNoTz","createdAt","updatedAt","unixTimestamp"]),r=new Set(["datetime","createdAt","updatedAt","unixTimestamp"]),a="YYYY-MM-DD",s="YYYY-MM-DD HH:mm:ss",d={picker:"date",showTime:!1,timeFormat:"HH:mm:ss",format:a,exactNormalizeMode:"none"};function u(e){return"string"==typeof(null==e?void 0:e.interface)?e.interface:""}function c(e){var t;let l="function"==typeof(null==e?void 0:e.getComponentProps)?e.getComponentProps():void 0;if(l&&"object"==typeof l&&!Array.isArray(l))return l;let o=null==e||null==(t=e.uiSchema)?void 0:t["x-component-props"];return o&&"object"==typeof o&&!Array.isArray(o)?o:{}}function p(e){return"year"===e||"quarter"===e||"month"===e||"date"===e?e:"date"}function m(e,t){return"date"===e||"dateOnly"===e||(null==t?void 0:t.type)==="dateOnly"?"date":"datetimeNoTz"===e?"datetimeNoTz":r.has(e)?"iso":"none"}function h(e,t,l){let o=u(e)||l||"";return!!i.has(o)||(null==e?void 0:e.type)==="dateOnly"||"createdAt"===t||"updatedAt"===t}function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u(e),l=c(e),o=p(l.picker),n="date"===t||"dateOnly"===t||(null==e?void 0:e.type)==="dateOnly",i=["datetime","datetimeNoTz","createdAt","updatedAt","unixTimestamp"].includes(t),r=!n&&("boolean"==typeof l.showTime?l.showTime:i),s="string"==typeof l.format?l.format:"",d="string"==typeof l.dateFormat&&l.dateFormat?l.dateFormat:s.split(" ")[0]||a,h="string"==typeof l.timeFormat&&l.timeFormat?l.timeFormat:"HH:mm:ss",f=n?d:s||(r?`${d} ${h}`:d);return{picker:o,showTime:r,timeFormat:h,format:f,exactNormalizeMode:m(t,e)}}function g(e,t){let l=String(e||"").trim();if(!l)return null;if(/(?:Z|[+-]\d{2}:\d{2})$/i.test(l)){let e=(0,n.dayjs)(l);if(e.isValid())return e}if(t){let e=(0,n.dayjs)(l,t,!0);if(e.isValid())return e}let o=(0,n.dayjs)(l);if(o.isValid())return o;if(t){let e=(0,n.dayjs)(l,t);if(e.isValid())return e}return null}function v(e,t){if(n.dayjs.isDayjs(e))return e;if(e instanceof Date){let t=(0,n.dayjs)(e);return t.isValid()?t:null}return"string"==typeof e?g(e,t):null}function y(e,t){let l=v(e,t.format);if(!(null==l?void 0:l.isValid()))return e;switch(t.exactNormalizeMode){case"date":return l.format(a);case"datetimeNoTz":return l.format(t.showTime?s:a);case"iso":return l.toISOString();default:return e}}function _(e,t){return"none"===t.exactNormalizeMode?e:"string"==typeof e||n.dayjs.isDayjs(e)||e instanceof Date?y(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e||n.dayjs.isDayjs(e)||e instanceof Date?y(e,t):e):e}function b(e,t){if(t.isRange){if(!Array.isArray(e))return null;let l=v(e[0],t.format),o=v(e[1],t.format);return l&&o?[l,o]:null}return v(e,t.format)}var x=l(1178),M=l(2793),w=l(1649),S=l(6305);let k=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e;function F(e,t){return t?Array.isArray(e)?e[0]:void 0:e}function C(e,t){return"string"==typeof e?(0,S.Pn)(e,t):t}function A(e,t){let l=String(e||"").trim();if(!l)return null;if(/(?:Z|[+-]\d{2}:\d{2})$/i.test(l)){let e=(0,n.dayjs)(l);if(e.isValid())return e}if(t){let e=(0,n.dayjs)(l,t,!0);if(e.isValid())return e}let o=(0,n.dayjs)(l);if(o.isValid())return o;if(t){let e=(0,n.dayjs)(l,t);if(e.isValid())return e}return null}function P(e,t){if(n.dayjs.isDayjs(e))return e;if(e instanceof Date){let t=(0,n.dayjs)(e);return t.isValid()?t:null}return"string"==typeof e?A(e,t):null}function T(e,t){if(!Array.isArray(e))return null;let l=P(e[0],t),o=P(e[1],t);return l&&o?[l,o]:null}let j=e=>{let{picker:t="date",format:l,showTime:i,timeFormat:r,value:a,isRange:s=!1,onChange:d,style:u,disabled:c}=e,p=(0,o.useFlowContext)(),m=p.model.translate.bind(p.model),h=(0,w.useMemo)(()=>F(a,s),[s,a]),[f,g]=(0,w.useState)(()=>C(h,t)),v=(0,w.useCallback)(e=>{let o=e===t&&l?l:(0,n.getPickerFormat)(e),a="date"===e?k(o):o;return(0,n.getDateTimeFormat)(e,a,i,r)},[l,t,i,r]),y=(0,w.useMemo)(()=>v(f),[v,f]),_=(0,w.useMemo)(()=>s?null:P(a,y),[s,a,y]),b=(0,w.useMemo)(()=>s?T(a,y):null,[s,a,y]),S=(0,w.useMemo)(()=>[{label:m("Date"),value:"date"},{label:m("Month"),value:"month"},{label:m("Quarter"),value:"quarter"},{label:m("Year"),value:"year"}],[m]),A=e=>{if(!c&&(g(e),d)){if(s){b&&d(b);return}_&&d(_)}},j={utc:!0,underFilter:!0,format:y,picker:f,inputReadOnly:p.isMobileLayout,showTime:!!i&&{defaultValue:(0,n.dayjs)("00:00:00","HH:mm:ss")},value:_,disabled:c,onChange:e=>{if(!c){if(e&&n.dayjs.isDayjs(e)){null==d||d(e);return}null==d||d(null)}},style:{flex:1}},I={utc:!0,underFilter:!0,format:y,picker:f,inputReadOnly:p.isMobileLayout,showTime:!!i&&{defaultValue:[(0,n.dayjs)("00:00:00","HH:mm:ss"),(0,n.dayjs)("23:59:59","HH:mm:ss")]},value:b,disabled:c,onChange:e=>{if(!c){if(Array.isArray(e)&&e[0]&&e[1]){null==d||d([e[0],e[1]]);return}null==d||d(null)}},style:{flex:1}};return(0,x.jsxs)(M.Space.Compact,{style:{width:"100%",...u||{}},children:[(0,x.jsx)(M.Select,{style:{width:100},popupMatchSelectWidth:!1,value:f,options:S,onChange:A,disabled:c}),s?(0,x.jsx)(M.DatePicker.RangePicker,{...I}):(0,x.jsx)(M.DatePicker,{...j})]})},I=["YYYY-MM-DD","YYYY-MM-DD HH:mm:ss","YYYY/MM/DD","MM/DD/YYYY","DD/MM/YYYY","YYYYMMDD"].map(e=>({value:e})),L={now:"Now",today:"Today",yesterday:"Yesterday",tomorrow:"Tomorrow",thisWeek:"This Week",lastWeek:"Last Week",nextWeek:"Next Week",thisMonth:"This Month",lastMonth:"Last Month",nextMonth:"Next Month",thisQuarter:"This Quarter",lastQuarter:"Last Quarter",nextQuarter:"Next Quarter",thisYear:"This Year",lastYear:"Last Year",nextYear:"Next Year"};function R(e){return"preset"===e.kind&&"now"===e.preset?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD"}function D(e,t){let l=e=>t?e.toISOString():e.format("YYYY-MM-DD");return Array.isArray(e)?[l(e[0]),l(e[1])]:e?l(e):""}let E=e=>{let{value:t,placeholder:l,onChange:n,disabled:i}=e,r=(0,o.useFlowContext)();return(0,x.jsxs)(M.Space.Compact,{style:{width:"100%"},children:[(0,x.jsx)(M.Input,{value:r.t("Format"),readOnly:!0,disabled:i,tabIndex:-1,"aria-hidden":!0,style:{width:88,pointerEvents:"none"}}),(0,x.jsx)(M.AutoComplete,{value:t,placeholder:l,options:I,onChange:e=>n(e.slice(0,128)),disabled:i,style:{flex:1,minWidth:0},"aria-label":r.t("Format")})]})},Y=e=>{let{value:t,onChange:l,isDateLikeField:n,dateComponentProps:i,style:r,disabled:a=!1}=e,s=(0,o.useFlowContext)();if(!t)return null;let d=e=>null==l?void 0:l({...t,format:e}),u=t.format||"",c=()=>{if("exact"===t.kind){let e=Array.isArray(t.value);return(0,x.jsx)(j,{picker:i.picker,showTime:i.showTime,timeFormat:i.timeFormat,format:i.format,isRange:e,value:b(t.value,{format:i.format,isRange:e}),onChange:e=>{null==l||l({...t,value:D(e,i.showTime)})},disabled:a,style:{width:"100%"}})}return"relative"===t.kind?(0,x.jsxs)(M.Space.Compact,{style:{width:"100%"},children:[(0,x.jsx)(M.InputNumber,{min:1,precision:0,value:t.amount,disabled:a,onChange:e=>null==l?void 0:l({...t,amount:"number"==typeof e?e:1}),"aria-label":s.t("past"===t.direction?"Past":"Next"),style:{flex:"1 1 auto",minWidth:80}}),(0,x.jsx)(M.Select,{value:t.unit,disabled:a,onChange:e=>null==l?void 0:l({...t,unit:e}),"aria-label":s.t("Unit"),style:{flex:"0 0 130px",minWidth:130},options:[{value:"day",label:s.t("Day")},{value:"week",label:s.t("Calendar week")},{value:"month",label:s.t("Calendar Month")},{value:"year",label:s.t("Calendar Year")}]})]}):(0,x.jsx)(M.Input,{value:s.t(L[t.preset]||t.preset),readOnly:!0,disabled:a})};return(0,x.jsxs)("div",{style:{display:"flex",flex:1,flexDirection:"column",gap:8,width:"100%",minWidth:0,...r},children:[c(),!n&&(0,x.jsx)(E,{value:u,placeholder:R(t),onChange:d,disabled:a})]})},N=[{name:"now",title:"Now"},{name:"today",title:"Today"},{name:"yesterday",title:"Yesterday"},{name:"tomorrow",title:"Tomorrow"},{name:"thisWeek",title:"This Week"},{name:"lastWeek",title:"Last Week"},{name:"nextWeek",title:"Next Week"},{name:"thisMonth",title:"This Month"},{name:"lastMonth",title:"Last Month"},{name:"nextMonth",title:"Next Month"},{name:"thisQuarter",title:"This Quarter"},{name:"lastQuarter",title:"Last Quarter"},{name:"nextQuarter",title:"Next Quarter"},{name:"thisYear",title:"This Year"},{name:"lastYear",title:"Last Year"},{name:"nextYear",title:"Next Year"}],O=Symbol("field-value-date-variable-config");function B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"editable";return{...e,[O]:t}}function V(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;let t=e[O];return"editable"===t||"restored"===t}function H(e){return"exact"===e.kind?"exact":"relative"===e.kind?e.direction:e.preset}function q(e){return n.dayjs.isDayjs(e)}function $(e,t,l){let o;if("exact"===e){let e=_((0,n.dayjs)(),l);o={kind:"exact",value:q(e)?e.format("YYYY-MM-DD"):String(e||"")}}else"past"===e||"next"===e?o={kind:"relative",direction:e,amount:1,unit:"day"}:N.some(t=>t.name===e)&&("now"!==e||"date"!==l.exactNormalizeMode)&&(o={kind:"preset",preset:e});if(o)return B(t?o:{...o,format:R(o)})}function z(e,t,l){let o="string"==typeof e.format?e.format:"",n=l?{...e,format:void 0}:{...e,format:o.trim()?o:R(e)};if("exact"!==n.kind)return n;let i=_(n.value,t);return Array.isArray(i)?{...n,value:[String(i[0]),String(i[1])]}:{...n,value:String(i||"")}}let U=e=>{let{value:t,onChange:l,baseMetaTree:n,constantComponent:i,nullComponent:r,runJSComponent:a,isDateLikeField:s,dateComponentProps:d,allowRunJS:u=!0,allowDateVariables:c=!0,converters:p,clearValue:m="",disabled:h=!1,...f}=e,g=w.default.useMemo(()=>e=>(0,x.jsx)(Y,{value:V(e.value)?e.value:void 0,onChange:t=>{var l;return null==(l=e.onChange)?void 0:l.call(e,B(t))},isDateLikeField:s,dateComponentProps:d,style:e.style,disabled:e.disabled}),[d,s]),v=c?(0,o.parseCtxDateExpressionConfig)(t):void 0,y="date"===d.exactNormalizeMode&&(null==v?void 0:v.kind)==="preset"&&"now"===v.preset,_=w.default.useMemo(()=>async()=>{let e="function"==typeof n?await n():n,t="date"!==d.exactNormalizeMode||y?N:N.filter(e=>"now"!==e.name),l=[{title:(0,o.tExpr)("Exact day"),name:"exact",type:"date",paths:["date","exact"],render:e=>(0,x.jsx)(g,{...e})},{title:(0,o.tExpr)("Past"),name:"past",type:"date",paths:["date","past"],render:e=>(0,x.jsx)(g,{...e})},{title:(0,o.tExpr)("Next"),name:"next",type:"date",paths:["date","next"],render:e=>(0,x.jsx)(g,{...e})},...t.map(e=>{let{name:t,title:l}=e;return{title:(0,o.tExpr)(l),name:t,type:"date",paths:["date",t],..."now"===t&&"date"===d.exactNormalizeMode?{disabled:!0,selectable:!1}:{},render:e=>(0,x.jsx)(g,{...e})}})];return[{title:(0,o.tExpr)("Constant"),name:"constant",type:"string",paths:["constant"],render:e=>(0,x.jsx)(i,{...e})},{title:(0,o.tExpr)("Null"),name:"null",type:"object",paths:["null"],render:e=>(0,x.jsx)(r,{...e})},...c?[{title:(0,o.tExpr)("Date"),name:"date",type:"date",paths:["date"],selectable:!1,children:l}]:[],...u?[{title:(0,o.tExpr)("RunJS"),name:"runjs",type:"object",paths:["runjs"],render:e=>(0,x.jsx)(a,{...e})}]:[],...Array.isArray(e)?e:[]]},[i,g,r,a,c,u,n,d.exactNormalizeMode,y]),b=v?B(v,"restored"):t,M=w.default.useCallback(e=>{if(h)return;if(!V(e))return void l(e);if("restored"===e[O])return;let t=z(e,d,s);l((0,o.serializeCtxDateExpressionConfig)(t)||"")},[d,h,s,l]);return(0,x.jsx)(o.VariableInput,{...f,value:b,onChange:M,metaTree:_,clearValue:m,disabled:h,converters:{renderInputComponent:e=>{var t,l;let o=null==p||null==(t=p.renderInputComponent)?void 0:t.call(p,e??null);if(o)return o;let n=null==e||null==(l=e.paths)?void 0:l[0];return"constant"===n?i:"null"===n?r:c&&"date"===n?g:u&&"runjs"===n?a:null},resolveValueFromPath:e=>{var t,l;let o=null==p||null==(t=p.resolveValueFromPath)?void 0:t.call(p,e);if(void 0!==o)return o;let n=null==e||null==(l=e.paths)?void 0:l[0];return"constant"===n?"":"null"===n?null:c&&"date"===n?$(e.paths[1],s,d):u&&"runjs"===n?{code:"",version:"v2"}:void 0},resolvePathFromValue:e=>{var t;let l=null==p||null==(t=p.resolvePathFromValue)?void 0:t.call(p,e);return void 0!==l?l:null===e?["null"]:u&&(0,o.isRunJSValue)(e)?["runjs"]:c&&V(e)?["date",H(e)]:"string"==typeof e&&(0,o.isVariableExpression)(e)?(0,o.parseValueToPath)(e):["constant"]}}})}},8442(e,t,l){l.d(t,{a:()=>r});var o=l(1178),n=l(2793);l(1649);var i=l(5886);let r=(0,l(504).observer)(e=>{var t;let{value:l,FilterItem:r,ctx:a}=e;l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let s=()=>{var e;(null==a||null==(e=a.model)?void 0:e.dispatchEvent)&&a.model.dispatchEvent("reset")},d=()=>{var e;(null==a||null==(e=a.model)?void 0:e.dispatchEvent)&&a.model.dispatchEvent("submit")},u=(null==a||null==(t=a.model)?void 0:t.translate)||(e=>e);return(0,o.jsxs)("form",{onSubmit:e=>{e.preventDefault(),d()},children:[(0,o.jsx)(i.I,{value:l,FilterItem:r}),(0,o.jsxs)(n.Space,{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:[(0,o.jsx)(n.Button,{htmlType:"button",onClick:s,children:u("Reset")}),(0,o.jsx)(n.Button,{type:"primary",htmlType:"submit",children:u("Submit")})]})]})},{displayName:"FilterContent"})},5886(e,t,l){l.d(t,{I:()=>c});var o=l(1178),n=l(2113),i=l(2793),r=l(7843);l(1649);var a=l(504);let s=new WeakMap,d=0,u=e=>{let t=s.get(e);return t||(d+=1,t=`filter-item-${d}`,s.set(e,t)),t},c=(0,a.observer)(e=>{let{token:t}=i.theme.useToken(),{value:l={logic:"$and",items:[]},FilterItem:a,disabled:s=!1,showBorder:d=!1,onRemove:p,onChange:m,closeIcon:h=(0,o.jsx)(n.CloseCircleOutlined,{style:{color:t.colorIcon}})}=e,{t:f}=(0,r.useTranslation)();l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let{logic:g,items:v}=l,y=d?{position:"relative",border:`1px dashed ${t.colorBorder}`,padding:t.paddingSM,marginBottom:t.marginXS,borderRadius:t.borderRadius}:{position:"relative",marginBottom:t.marginXS},_=e=>{s||(l.logic=e,null==m||m(l))},b=()=>{s||(v.push({path:"",operator:"",value:""}),null==m||m(l))},x=()=>{s||(v.push({logic:"$and",items:[]}),null==m||m(l))},M=e=>{s||(v.splice(e,1),null==m||m(l))},w=e=>"path"in e||"operator"in e||"value"in e,S=e=>"logic"in e&&"items"in e;return(0,o.jsxs)("div",{style:y,children:[d&&p&&(0,o.jsx)("button",{type:"button","aria-label":"icon-close",disabled:s,style:{position:"absolute",right:10,top:10,cursor:s?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:p,children:h}),(0,o.jsx)("div",{style:{marginBottom:8,color:t.colorText},children:(0,o.jsxs)("span",{children:[f("Meet")," ",(0,o.jsxs)(i.Select,{"data-testid":"filter-select-all-or-any",style:{width:"auto"},value:g,disabled:s,onChange:_,children:[(0,o.jsx)(i.Select.Option,{value:"$and",children:f("All")}),(0,o.jsx)(i.Select.Option,{value:"$or",children:f("Any")})]})," ",f("conditions in the group")]})}),(0,o.jsx)("div",{children:v.map((e,n)=>S(e)?(0,o.jsx)(c,{value:e,FilterItem:a,disabled:s,showBorder:!0,onRemove:()=>M(n),onChange:e=>{v[n]=e,null==m||m(l)}},u(e)):w(e)?a?(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsx)(a,{value:e}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",disabled:s,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:s?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>M(n),children:h})]})},u(e)):(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsxs)("span",{children:[e.path," ",e.operator," ",String(e.value)]}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",disabled:s,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:s?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>M(n),children:h})]})},u(e)):(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsx)("span",{style:{color:t.colorTextTertiary},children:"Invalid filter item"}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",disabled:s,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:s?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>M(n),children:h})]})},u(e)))}),(0,o.jsxs)(i.Space,{size:16,style:{marginTop:8,marginBottom:8},children:[(0,o.jsx)(i.Button,{style:{padding:0},type:"link",size:"small",icon:(0,o.jsx)(n.PlusOutlined,{}),onClick:b,disabled:s,children:f("Add condition")}),(0,o.jsx)(i.Button,{style:{padding:0},type:"link",size:"small",icon:(0,o.jsx)(n.PlusOutlined,{}),onClick:x,disabled:s,children:f("Add condition group")})]})]})},{displayName:"FilterGroup"})},937(e,t,l){l.d(t,{H:()=>o});let o=(e,t,l,o)=>e.map(e=>n(e,t,l,o)).filter(Boolean),n=(e,t,l,n)=>{var i;if(l.length&&1===t&&l.includes(e.name)||!e.interface||!1===e.filterable)return;let r=e.getInterfaceOptions();if(!(null==r?void 0:r.filterable))return;let{nested:a,children:s,operators:d}=r.filterable,u={name:e.name,type:e.type,target:e.target,title:n(e.title),schema:null==e?void 0:e.uiSchema,operators:((null==d||null==(i=d.filter)?void 0:i.call(d,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[]).map(e=>({...e,label:n(e.label)}))};if(!e.target||!(t>2)){if(t>2)return u;if((null==s?void 0:s.length)&&(u.children=s),a){let i=[];try{i=e.getFields().filter(e=>"attachments"!==e.target&&"formula"!==e.interface)}catch{i=[]}let r=o(i,t+1,l,n).filter(Boolean);u.children=u.children||[],u.children.push(...r)}return u}}},9078(e,t,l){l.d(t,{Ru:()=>Y,I8:()=>n.I,qi:()=>u,oJ:()=>o.a,Et:()=>F,uw:()=>N.u});var o=l(8442),n=l(5886),i=l(1178),r=l(504),a=l(2793),s=l(1649),d=l(937);let u=(0,r.observer)(e=>{var t;let{path:l,operator:o,value:n}=e.value,r=e.model,u=(null==(t=r.context.blockModel.collection)?void 0:t.getFields().filter(e=>"attachments"!==e.target))||[],p=c(r.props.filterableFieldNames||[],u.map(e=>e.name)),m=r.translate,h=(0,d.H)(u.filter(e=>"attachments"!==e.target&&"formula"!==e.interface&&!["belongsTo","belongsToMany","hasOne","hasMany","oho","obo","m2o","o2m","m2m"].includes(e.type)),1,e.noIgnore?[]:p,m).filter(Boolean),f=(0,s.useMemo)(()=>{let e=h.find(e=>e.name===l);return(null==e?void 0:e.operators)||[]},[h,l]),g=t=>{var l;e.value.path=t;let o=h.find(e=>e.name===t);(null==o||null==(l=o.operators)?void 0:l.length)>0?e.value.operator=o.operators[0].value:e.value.operator="",e.value.value=""},v=t=>{e.value.operator=t},y=t=>{e.value.value=t.target.value};return(0,i.jsxs)(a.Space,{children:[(0,i.jsx)(a.Select,{style:{width:200},placeholder:m("Select field"),value:l||void 0,onChange:g,children:h.map(e=>(0,i.jsx)(a.Select.Option,{value:e.name,children:e.title},e.name))}),(0,i.jsx)(a.Select,{style:{width:120},placeholder:m("Select operator"),value:o||void 0,onChange:v,disabled:!l||0===f.length,children:f.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),(0,i.jsx)(a.Input,{style:{width:200},placeholder:m("Enter value"),value:n,onChange:y})]})},{displayName:"FilterItem"});function c(e,t){return null==t?void 0:t.filter(t=>!e.includes(t))}var p=l(6305),m=l(7583),h=l(6220),f=l(7309),g=l(7720),v=l(9210);let{DateFilterDynamicComponent:y}=(0,p.RZ)(()=>Promise.resolve().then(l.bind(l,6832)),"DateFilterDynamicComponent"),_=new Set(["Input","Input.URL","NanoIDInput","DatePicker"]);async function b(e){var t,l,o,n;let i=async e=>Array.isArray(e)?e:"function"==typeof e?await e():[];if(null==(l=e.getPropertyOptions)||null==(t=l.call(e,"collection"))?void 0:t.meta){let t=null==(n=e.getPropertyMetaTree)?void 0:n.call(e,"{{ ctx.collection }}");return await i(t)}let a=()=>(null==e?void 0:e.collection)??null,s=await (0,r.createEphemeralContext)(e,{defineProperties:{collection:{get:a,meta:(0,r.createCollectionContextMeta)(a,"Current collection")}}}),d=null==(o=s.getPropertyMetaTree)?void 0:o.call(s,"{{ ctx.collection }}");return await i(d)}function x(e,t){if(!e||!t.length)return null;let l="collection"===t[0]?t.slice(1):t;if(!l.length)return null;let o=[],n=e,i=null;for(let e of l){var r,a,s,d,u;let t=(null==n||null==(r=n.getField)?void 0:r.call(n,e))??(null==n||null==(d=n.getFields)||null==(s=d.call(n))||null==(a=s.find)?void 0:a.call(s,t=>(null==t?void 0:t.name)===e));if(!t)return null;let c=t.title||(null==(u=t.uiSchema)?void 0:u.title)||t.name||e;i={name:t.name||e,title:c,type:t.type,interface:t.interface,uiSchema:t.uiSchema,options:t.options,paths:["collection",...l.slice(0,o.length+1)],parentTitles:[...o]},t.targetCollection?(o.push(c),n=t.targetCollection):n=null}return i}function M(e,t){return"number"!=typeof t?e:(0,v.W)(e,{maxAssociationDepth:t})}function w(e,t,l,o){var n;let r=null==e?void 0:e["x-component"],s=(null==t||null==(n=t.uiSchema)?void 0:n["x-component-props"])||{},d=(null==e?void 0:e["x-component-props"])||{},u=(0,__rspack_external_lodash_merge_8f812c65.default)({},s,d),c=(0,f.di)(null==e?void 0:e.enum,l)||[],p={style:{width:200,...(null==u?void 0:u.style)||{}},placeholder:(null==u?void 0:u.placeholder)||l("Enter value"),...u},m=e=>{if("number"==typeof e||(null==u?void 0:u.stringMode)===!0&&"string"==typeof e)return e};return e=>{let{value:t,onChange:l,...n}=e||{};if("InputNumber"===r)return(0,i.jsx)(a.InputNumber,{...p,...n,value:m(t),onChange:e=>null==l?void 0:l(e)});if("NumberPicker"===r)return(0,i.jsx)(h.NumberPicker,{...p,...n,value:m(t),onChange:e=>null==l?void 0:l(e)});if("Switch"===r)return(0,i.jsx)(a.Switch,{...p,...n,checked:!!t,onChange:e=>null==l?void 0:l(e)});if("Select"===r)return(0,i.jsx)(a.Select,{options:c,...p,...n,value:(0,f.xO)(t,p),onChange:e=>null==l?void 0:l(e)});if("Checkbox"===r)return(0,i.jsx)(a.Checkbox,{...p,...n,checked:!!t,onChange:e=>null==l?void 0:l(e.target.checked)});if("Checkbox.Group"===r)return(0,i.jsx)(a.Checkbox.Group,{...p,...n,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Radio.Group"===r)return(0,i.jsx)(a.Radio.Group,{...p,...n,value:Array.isArray(t)||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:void 0,onChange:e=>null==l?void 0:l(e.target.value)});if("Cascader"===r)return(0,i.jsx)(a.Cascader,{...p,...n,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Input.TextArea"===r||"TextArea"===r)return(0,i.jsx)(a.Input.TextArea,{...p,...n,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)});if("DateFilterDynamicComponent"===r)return(0,i.jsx)(y,{...p,...n,value:t,onChange:e=>null==l?void 0:l(e)});if(r&&(null==o?void 0:o.getComponent)){let e=o.getComponent(r,!_.has(r));if(e)return(0,i.jsx)(e,{...p,...n,value:t,onChange:e=>null==l?void 0:l(e),style:{width:200,...p.style||{},...null==n?void 0:n.style}})}return(0,i.jsx)(a.Input,{...p,...n,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)})}}function S(e){if(e&&"object"==typeof e){let l=e;if("function"==typeof l.preventDefault||l.nativeEvent||"target"in l){var t;let o=null==(t=l.target)?void 0:t.value;return void 0!==o?o:e}}return e}function k(e,t){if(!Array.isArray(e)||!t.length)return null;let l=(e,t)=>{if(!t.length)return null;let[o,...n]=t,i=e.find(e=>String(e.name)===String(o));return i?n.length?Array.isArray(i.children)?l(i.children,n):null:i:null},o=l(e,t);return o||(new Set(e.map(e=>String(e.name))).has(String(t[0]))?null:l(e,t.slice(1)))}let F=(0,r.observer)(e=>{let{value:t,model:l,disabled:o=!1,rightAsVariable:n,rightMetaTree:d,rightVariableConverters:u,ignoreFieldNames:c,maxAssociationFieldDepth:h}=e,v=(0,r.useFlowViewContext)(),y=l.translate,{path:F,operator:C,value:A}=t,[P,T]=(0,s.useState)(null),j=(0,s.useCallback)(e=>{var t;return(0,p.w6)(e,l.context.dataSourceManager,null==(t=l.context.app)?void 0:t.dataSourceManager)},[l]),I=(0,s.useMemo)(()=>{var e,t;if(!P)return[];let l=P.interface?j(P.interface):void 0,o=null==P||null==(e=P.uiSchema)?void 0:e["x-filter-operators"];return((Array.isArray(o)&&o.length?o:null==l||null==(t=l.filterable)?void 0:t.operators)||[]).filter(e=>!e.visible||e.visible(P))},[j,P]);(0,s.useEffect)(()=>{if(!I.length)return;let e=m.default.find(I,e=>e.value===t.operator);if(e)t.noValue=!!e.noValue;else{let e=I[0];t.operator=e.value,t.value=!!e.noValue||void 0,t.noValue=!!e.noValue}},[I,t]);let L=(0,s.useMemo)(()=>I.map(e=>({value:e.value,label:"string"==typeof e.label?y(e.label):e.label})),[I,y]),R=(0,s.useCallback)((e,l)=>{if(o)return;let n=t.path||"",i=e||"",r=i!==n;t.path=i,r&&n&&(t.operator="",t.value=void 0,t.noValue=!1),l&&T(l)},[o,t]),D=(0,s.useMemo)(()=>({resolveValueFromPath:e=>(T(e),(null==e?void 0:e.paths.slice(1).join("."))||null),resolvePathFromValue(e){if(null==e)return;let t=String(e).trim();if(t)return["collection",...t.split(".")]}}),[]),E=(0,s.useCallback)(e=>{if(o)return;t.operator=e;let l=I.find(t=>t.value===e);(null==l?void 0:l.noValue)?(t.value=!0,t.noValue=!0):(t.value=void 0,t.noValue=!1)},[o,I,t]),Y=(0,s.useMemo)(()=>I.find(e=>e.value===C),[I,C]),N=(0,s.useCallback)(e=>{var t,l;return(null==e||null==(t=e.options)?void 0:t.dataType)||(null==e?void 0:e.dataType)||(null==e?void 0:e.type)||(null==e||null==(l=e.uiSchema)?void 0:l.type)||"double"},[]),O=(0,s.useCallback)(e=>{switch(e){case"boolean":return"Switch";case"date":return"DateFilterDynamicComponent";case"integer":case"bigInt":case"double":case"decimal":case"number":return"InputNumber";default:return"Input"}},[]),B=(0,s.useMemo)(()=>{let e=(null==P?void 0:P.uiSchema)||{},t=(null==Y?void 0:Y.schema)||{},l=(0,__rspack_external_lodash_merge_8f812c65.default)({},e,t);if((null==P?void 0:P.interface)==="formula"){let e={"x-read-pretty":!1,"x-component":O(N(P)),"x-component-props":{...l["x-component-props"]}};return(0,__rspack_external_lodash_merge_8f812c65.default)({},l,e)}return l},[P,Y,O,N]),V=s.default.useRef(null==B?void 0:B["x-component"]),H=null==B?void 0:B["x-component"],q=(0,s.useMemo)(()=>{let e=V.current;V.current=H;let l=void 0!==e&&e!==H;if(null==Y?void 0:Y.noValue)return A;if(l&&null!=A){t.value=void 0;return}return A},[H,A,t,Y]),$=(0,s.useCallback)(e=>{o||(t.value=S(e))},[o,t]),z=s.default.useRef(y);s.default.useEffect(()=>{z.current=y},[y]);let U=s.default.useCallback(e=>{var t;return(null==(t=z.current)?void 0:t.call(z,e))??e},[]),K=(0,s.useMemo)(()=>(0,f.di)(null==B?void 0:B.enum,U)||[],[B,U]),G=(0,s.useMemo)(()=>w(B,P,U,l.context.app),[B,P,U,l.context.app]),W=(0,s.useCallback)(()=>{var e;let t="$in"===C||"$notIn"===C,n=null==Y||null==(e=Y.schema)?void 0:e["x-component"],r="Select"===n||"string"==typeof n&&_.has(n),a=t?(0,g._H)(l.context.app,C,I,!r):null;if(a&&t){let{Comp:e,props:t}=a,l={...t},n=Array.isArray(l.options)?l.options:void 0;(!n||0===n.length)&&(null==K?void 0:K.length)&&(l.options=K);let r={flex:"1 1 40%",minWidth:160,maxWidth:"100%",...(0,g.VS)(l.style)},s=Array.isArray(q)&&q.every(e=>"string"==typeof e||"number"==typeof e)?q:"string"==typeof q?q.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)("div",{style:r,children:(0,i.jsx)(e,{...l,style:{width:"100%",...(0,g.VS)(l.style)},value:s,disabled:o,onChange:e=>$(e)})})}let s=G;return(0,i.jsx)("div",{style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},children:(0,i.jsx)(s,{value:q,onChange:e=>$(e),disabled:o})})},[o,C,I,Y,q,G,l.context.app,$,K]),J=(0,s.useMemo)(()=>function(){return(0,i.jsx)(a.Input,{placeholder:`<${y("Null")}>`,readOnly:!0})},[y]),X=(0,s.useMemo)(()=>async()=>{let e="function"==typeof d?await d():d??v.getPropertyMetaTree(),t=Array.isArray(e)?e:await e();return M([{title:y("Constant"),name:"constant",type:"string",paths:["constant"],render:G},{title:y("Null"),name:"null",type:"object",paths:["null"],render:J},...t],h)},[d,v,G,J,y,h]),Q=(0,s.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?G:"null"===l?J:null},resolveValueFromPath:e=>{var t,l;let o=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===o?"":"null"===o?null:null==u||null==(l=u.resolveValueFromPath)?void 0:l.call(u,e)},resolvePathFromValue:e=>{var t;if(null===e)return["null"];let l=(null==u||null==(t=u.resolvePathFromValue)?void 0:t.call(u,e))??("string"==typeof e?(0,r.parseValueToPath)(e):void 0);return l||["constant"]}}),[J,u,G]),Z=(0,s.useMemo)(()=>async()=>{let e=await b(l.context),t=async e=>{let t=e.interface?j(e.interface):void 0,o=[],n=null==t?void 0:t.filterable,i=null==n?void 0:n.children;if(Array.isArray(i)&&i.length)for(let t of i){var r,a,s;let n=t.title||t.name,i=(null==(r=l.context)?void 0:r.t)?l.context.t(n):n;o.push({name:t.name,title:i,type:(null==(a=t.schema)?void 0:a.type)||"string",interface:(null==(s=t.schema)?void 0:s["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]})}if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=[...Array.isArray(e)?e:[],...o];return m.default.uniqBy(l,"name")}}}let d=[...Array.isArray(e.children)?e.children:[],...o];return{...e,children:d.length?d:e.children}},o=[];for(let l of e)o.push(await t(l));return M(o,h)},[j,l,h]);return(0,s.useEffect)(()=>{if(P||!t.path)return;let e=!1;return(async()=>{let o=await Z();if(e)return;let n=D.resolvePathFromValue(t.path);if(!(null==n?void 0:n.length))return;let i=k(o,n)||x(l.context.collection,n);i&&T(i)})(),()=>{e=!0}},[D,Z,P,l.context.collection,t.path]),(0,i.jsxs)(a.Space,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(r.VariableInput,{value:F,metaTree:Z,onChange:R,converters:D,disabled:o,showValueComponent:!1,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},onlyLeafSelectable:!0,placeholder:y("Select field"),ignoreFieldNames:c}),(0,i.jsx)(a.Select,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:y("Comparison"),value:C||void 0,disabled:o,onChange:E,children:L.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),!(null==Y?void 0:Y.noValue)&&(n?(0,i.jsx)(r.VariableInput,{value:q,onChange:e=>$(e),metaTree:X,converters:Q,disabled:o,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:y("Enter value")}):W())]})});var C=l(8718);let{DateFilterDynamicComponent:A}=(0,p.RZ)(()=>Promise.resolve().then(l.bind(l,6832)),"DateFilterDynamicComponent");function P(e,t){return"number"!=typeof t?e:(0,v.W)(e,{maxAssociationDepth:t})}function T(e,t,l){var o,n,r;let s=null==e?void 0:e["x-component"],d=(null==t||null==(o=t.uiSchema)?void 0:o["x-component-props"])||{},u=(null==e?void 0:e["x-component-props"])||{},c=(0,__rspack_external_lodash_merge_8f812c65.default)({},d,u),p=Array.isArray(null==t||null==(n=t.uiSchema)?void 0:n.enum)?null==t||null==(r=t.uiSchema)?void 0:r.enum:void 0,m=(0,f.di)(p,l),g={style:{width:200,...(null==c?void 0:c.style)||{}},placeholder:(null==c?void 0:c.placeholder)||l("Enter value"),...c};return e=>{let{value:t,onChange:o,...n}=e||{};if("InputNumber"===s)return(0,i.jsx)(a.InputNumber,{...g,...n,value:t,onChange:o});if("NumberPicker"===s)return(0,i.jsx)(h.NumberPicker,{...g,...n,value:t,onChange:o});if("Switch"===s)return(0,i.jsx)(a.Switch,{...g,...n,checked:!!t,onChange:o});if("Select"===s){let e=g;return Array.isArray(null==e?void 0:e.options)&&e.options.length>0?e={...e,options:(0,f.ZY)(e.options,l)}:m&&(e={...e,options:m}),(0,i.jsx)(a.Select,{...e,...n,value:(0,f.xO)(t,e),onChange:o})}return"DateFilterDynamicComponent"===s?(0,i.jsx)(A,{...g,...n,value:t,onChange:o}):(0,i.jsx)(a.Input,{...g,...n,value:t,onChange:e=>{var t;return null==o?void 0:o(null==e||null==(t=e.target)?void 0:t.value)}})}}let j=[{value:"$includes",label:"contains",selected:!0},{value:"$notIncludes",label:"does not contain"},{value:"$eq",label:"is"},{value:"$ne",label:"is not"},{value:"$empty",label:"is empty",noValue:!0},{value:"$notEmpty",label:"is not empty",noValue:!0}],I=new Set(["$in","$notIn"]);function L(e,t){let l=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(!o.length)return l;let n=o.find(e=>(null==e?void 0:e.name)==="item");if(!n)return[...o,...l];let i=(0,C.mD)(l,[n]);return[...o.filter(e=>(null==e?void 0:e.name)!=="item"),...i]}function R(e,t){var l,o;return{name:t.name,title:t.title||t.name,type:(null==(l=t.schema)?void 0:l.type)||"string",interface:(null==(o=t.schema)?void 0:o["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]}}async function D(e,t){var l,o;let n=e.interface&&t?t(e.interface):void 0,i=(Array.isArray(null==n||null==(l=n.filterable)?void 0:l.children)?null==n||null==(o=n.filterable)?void 0:o.children:[]).map(t=>R(e,t)),r=async e=>{let l=[...await Promise.all(e.map(e=>D(e,t))),...i];return(0,__rspack_external_lodash_uniqBy_85106929.default)(l,e=>e.name)};if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=Array.isArray(e)?e:[];return await r(l)}}}return Array.isArray(e.children)?{...e,children:await r(e.children)}:i.length?{...e,children:i}:e}async function E(e,t){let l=Array.isArray(e)?e:[];return await Promise.all(l.map(e=>D(e,t)))}let Y=(0,r.observer)(e=>{var t;let{value:l,model:o,extraMetaTree:n,maxAssociationFieldDepth:d}=e,u=(0,r.useFlowViewContext)(),c=o.translate,{path:m,operator:h,value:v}=l||{},[y,_]=(0,s.useState)(null),b=(0,s.useRef)(!1),x=(0,s.useMemo)(()=>{if(y){var e,t,l;let n=y.interface?(0,p.w6)(y.interface,o.context.dataSourceManager,null==(e=o.context.app)?void 0:e.dataSourceManager):void 0,i=null==y||null==(t=y.uiSchema)?void 0:t["x-filter-operators"];return((Array.isArray(i)&&i.length?i:null==n||null==(l=n.filterable)?void 0:l.operators)||j).filter(e=>!e.visible||e.visible(y)).map(e=>({value:e.value,label:e.label,noValue:!!e.noValue,schema:e.schema,selected:!!e.selected}))}return[]},[y,o]),M=(0,s.useMemo)(()=>x.map(e=>({value:e.value,label:"string"==typeof e.label?c(e.label):e.label})),[x,c]);(0,s.useEffect)(()=>{if(0!==x.length){if(!h){if(b.current){let e=x.find(e=>e.selected)||x[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1,b.current=!1}return}if(!x.some(e=>e.value===h)){let e=x.find(e=>e.selected)||x[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1}}},[x,h,l]);let w=(0,s.useMemo)(()=>x.find(e=>e.value===h),[x,h]),S=(0,s.useMemo)(()=>{let e=(null==y?void 0:y.uiSchema)||{},t=(null==w?void 0:w.schema)||{};return(0,__rspack_external_lodash_merge_8f812c65.default)({},e,t)},[y,w]),k=(0,s.useRef)(c);(0,s.useEffect)(()=>{k.current=c},[c]);let F=(0,s.useCallback)(e=>{var t;return(null==(t=k.current)?void 0:t.call(k,e))??e},[]),C=(0,s.useMemo)(()=>T(S,y,F),[S,y,F]),A=(0,s.useMemo)(()=>(0,f.di)(null==S?void 0:S.enum,F)||[],[S,F]),R=(0,s.useMemo)(()=>{let e=(0,g._H)(o.context.app,h,x),t=I.has(h);if(!e||!t)return C;let{Comp:l,props:n}=e;return e=>{let{value:t,onChange:o,...r}=e||{},a={...n},s=Array.isArray(a.options)?a.options:void 0;(!s||0===s.length)&&A.length>0&&(a.options=A);let d=Array.isArray(t)?t:"string"==typeof t?t.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)(l,{...a,...r,value:d,onChange:o,style:{width:200,...(0,g.VS)(a.style),...(0,g.VS)(null==r?void 0:r.style)}})}},[A,o.context.app,x,h,C]),D=(0,s.useMemo)(()=>function(){return(0,i.jsx)(a.Input,{placeholder:`<${c("Null")}>`,readOnly:!0})},[c]),Y=(0,s.useMemo)(()=>async()=>{let e=L((null==o?void 0:o.context.getPropertyMetaTree())||u.getPropertyMetaTree(),n);return P([{title:c("Constant"),name:"constant",type:"string",paths:["constant"]},{title:c("Null"),name:"null",type:"object",paths:["null"]},...e],d)},[u,o,c,n,d]),N=(0,s.useCallback)(async()=>{var e,t;let l=(null==o||null==(t=o.context)||null==(e=t.getPropertyMetaTree)?void 0:e.call(t))||u.getPropertyMetaTree(),i=L(Array.isArray(l)?l:[],n),r=e=>{var t;return(0,p.w6)(e,o.context.dataSourceManager,null==(t=o.context.app)?void 0:t.dataSourceManager)};return P(await E(i,r),d)},[u,o,n,d]),O=(0,s.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?R:"null"===l?D:null},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:void 0},resolvePathFromValue:e=>{if(null===e)return["null"];let t=(0,r.parseValueToPath)(e);return t||["constant"]}}),[D,R]),B=(0,s.useCallback)((e,t)=>{let o=l.path||"",n=e||"",i=n!==o;l.path=n,i&&o&&(l.operator="",l.value="",b.current=!0),o||!n||l.operator||(b.current=!0),t&&_(t)},[l]),V=(0,s.useCallback)(e=>{let t=l.operator;l.operator=e;let o=x.find(t=>t.value===e);(null==o?void 0:o.noValue)?(l.value=!0,l.noValue=!0):(I.has(t)&&!I.has(e)&&Array.isArray(l.value)&&(l.value=l.value.join("\n")),l.noValue=!1)},[l,x]);return(0,i.jsxs)(a.Space,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(r.VariableInput,{value:m,onChange:B,metaTree:N,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:c("Select variable"),onlyLeafSelectable:!0}),(0,i.jsx)(a.Select,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:c("Comparison"),value:h||void 0,onChange:V,children:M.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),!(null==(t=x.find(e=>e.value===h))?void 0:t.noValue)&&(0,i.jsx)(r.VariableInput,{value:v,onChange:e=>l.value=e,metaTree:Y,converters:O,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:c("Enter value"),clearValue:""})]})});var N=l(8102)},9210(e,t,l){l.d(t,{W:()=>r});let o=new Set(["m2o","o2o","oho","obo","o2m","m2m","linkTo"]);function n(e){let t=(null==e?void 0:e.options)||{};return!!(t.target||t.targetCollection||t.foreignKey||t.through||o.has(String((null==e?void 0:e.interface)||"")))}function i(e,t,l){let o=n(e),i=t+ +!!o;if(o&&i>l)return null;let a=e=>Array.isArray(e)?r(e,{associationDepth:i,maxAssociationDepth:l}):async()=>{let t=await e();return r(Array.isArray(t)?t:[],{associationDepth:i,maxAssociationDepth:l})};return{...e,children:e.children?a(e.children):void 0}}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{associationDepth:l=0,maxAssociationDepth:o=2}=t;return Array.isArray(e)?e.map(e=>i(e,l,o)).filter(Boolean):[]}},8102(e,t,l){l.d(t,{u:()=>r});var o=l(1649),n=l(937);let i=e=>e;function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{filterableFieldNames:l,nonfilterableFieldNames:r,noIgnore:a=!1,t:s=i}=t,d=(0,o.useMemo)(()=>(null==e?void 0:e.getFields())||[],[e]),u=(0,o.useMemo)(()=>{let e=!a&&(null==l?void 0:l.length)?d.map(e=>e.name).filter(e=>!l.includes(e)):[],t=r??[];return t.length?Array.from(new Set([...e,...t])):e},[d,l,r,a]);return(0,o.useMemo)(()=>(0,n.H)(d.filter(e=>"attachments"!==e.target&&"formula"!==e.interface),1,u,s).filter(Boolean),[d,u,s])}},8563(e,t,l){l.d(t,{b2:()=>n.b,tn:()=>o.t,S5:()=>n.S});var o=l(8804);l(1178),l(8533),l(8198),l(504),l(1649),l(7326),l(5721);var n=l(5026);l(6193),l(4244)},1511(e,t,l){l.d(t,{Ak:()=>g,B3:()=>f,Lb:()=>v});var o=l(1178),n=l(504),i=l(1883),r=l(2793),a=l(7583),s=l(1649),d=l(7843),u=l(8804);function c(e){return"function"==typeof(null==e?void 0:e.getResourceSettingsInitParams)?e.getResourceSettingsInitParams():"function"==typeof(null==e?void 0:e.getStepParams)?e.getStepParams("resourceSettings","init"):void 0}function p(e,t){var l,o,n,i,r,a,s;let d=(null==e||null==(l=e.context)?void 0:l.blockModel)||e,u=c(d)||{},p=(null==d||null==(o=d.context)?void 0:o.collection)||(null==d?void 0:d.collection)||(null==e||null==(n=e.context)?void 0:n.collection),m=(null==p?void 0:p.dataSource)||(null==d||null==(i=d.context)?void 0:i.dataSource)||(null==d?void 0:d.dataSource)||(null==e?void 0:e.dataSource),h=(null==m?void 0:m.key)||(null==p?void 0:p.dataSourceKey)||u.dataSourceKey,f=(null==p?void 0:p.title)||(null==p?void 0:p.name)||(null==p?void 0:p.tableName)||(null==e||null==(r=e.resource)?void 0:r.resourceName)||(null==e||null==(s=e.resource)||null==(a=s.getResourceName)?void 0:a.call(s))||u.associationName||u.collectionName,g=m?t(m.displayName||m.key):h,v=f?`${t(f)||f}`:"",y=g?`${t(g)} > `:"",_=["loading-failed","reloading-failed"].includes(null==m?void 0:m.status);return{dataSourceName:g,nameValue:`${y}${v}`,isDataSourceLoadFailed:_,isDataSourceUnavailable:!!(h&&(!m||_))}}function m(e,t){return t?e('The data source "{{name}}" is temporarily unavailable. Please try again later or contact an administrator.',{name:t}):e("The data source is temporarily unavailable. Please try again later or contact an administrator.")}function h(e){let{dataSourceName:t,isLoadFailed:l}=e,{t:n}=(0,d.useTranslation)(),i=l?m(n,t):t?n('The data source "{{name}}" used by this block is disabled or unavailable. Enable the data source to display this block.',{name:t}):n("The data source used by this block is disabled or unavailable. Enable the data source to display this block.");return(0,o.jsx)(u.t,{role:"alert","aria-live":"polite",children:(0,o.jsx)(r.Result,{status:l?"warning":"403",subTitle:i})})}let f=()=>{let{t:e}=(0,d.useTranslation)(),t=(0,n.useFlowModel)(),{dataSourceName:l,isDataSourceLoadFailed:i,isDataSourceUnavailable:c,nameValue:m}=(0,s.useMemo)(()=>p(t,e),[t,e]),{actionName:f}=t.forbidden||{},g=(0,s.useMemo)(()=>e('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:m,actionName:e(a.default.capitalize(f))}).replaceAll(">",">"),[f,m,e]);return c?(0,o.jsx)(h,{dataSourceName:l,isLoadFailed:i}):(0,o.jsx)(u.t,{children:(0,o.jsx)(r.Result,{status:"403",subTitle:g})})};function g(){let{t:e}=(0,d.useTranslation)(),t=(0,n.useFlowModel)(),{dataSourceName:l,isDataSourceLoadFailed:i,isDataSourceUnavailable:a,nameValue:c}=(0,s.useMemo)(()=>p(t,e),[t,e]),m=(0,s.useMemo)(()=>e('The {{type}} "{{name}}" may have been deleted. Please remove this {{blockType}}.',{type:e("Collection"),name:c,blockType:e("Block")}).replaceAll(">",">"),[c,e]);return a?(0,o.jsx)(h,{dataSourceName:l,isLoadFailed:i}):(0,o.jsx)(u.t,{children:(0,o.jsx)(r.Result,{status:"404",subTitle:m})})}function v(){let{t:e}=(0,d.useTranslation)(),t=(0,n.useFlowModel)(),{dataSourceName:l}=(0,s.useMemo)(()=>p(t,e),[t,e]),a=(0,i.useMemoizedFn)(async()=>{try{var e;await (null==(e=t.refresh)?void 0:e.call(t))}catch{}});return(0,o.jsx)(u.t,{ref:t.context.ref,...t.decoratorProps,role:"alert","aria-live":"polite",children:(0,o.jsx)(r.Result,{status:"warning",title:e("Data loading failed"),subTitle:m(e,l),extra:(0,o.jsx)(r.Button,{type:"primary",onClick:a,children:e("Try again")})})})}},9378(e,t,l){l.d(t,{g:()=>f});var o=l(1178),n=l(1649),i=l(2793),r=l(2741),a=l(691),s=l(504);let d=()=>{let e=(0,s.useFlowContext)(),{token:t}=i.theme.useToken(),l=!!e.isDarkTheme,o=new r.TinyColor(t.colorFillAlter).onBackground(t.colorBgContainer).toHexShortString(),n={lineHeight:"inherit","&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},blockquote:{borderLeft:"4px solid #ccc",paddingLeft:"20px",marginLeft:"0",color:"#666",fontStyle:"italic"},img:{maxWidth:"100%"},".hljs":{background:"#f8f8f8",color:"#444"},".hljs-comment":{color:"#697070"},".hljs-punctuation,.hljs-tag":{color:"#444a"},".hljs-tag .hljs-attr,.hljs-tag .hljs-name":{color:"#444"},".hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag":{fontWeight:700},".hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type":{color:"#800"},".hljs-section,.hljs-title":{color:"#800",fontWeight:700},".hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable":{color:"#ab5656"},".hljs-literal":{color:"#695"},".hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code":{color:"#397300"},".hljs-meta":{color:"#1f7199"},".hljs-meta .hljs-string":{color:"#38a"},".hljs-emphasis":{fontStyle:"italic"},".hljs-strong":{fontWeight:700}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:o,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}},d={"&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},".hljs":{color:"#adbac7",background:"#22272e"},".hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_":{color:"#f47067"},".hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_":{color:"#dcbdfb"},".hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable":{color:"#6cb6ff"},".hljs-meta .hljs-string,.hljs-regexp,.hljs-string":{color:"#96d0ff"},".hljs-built_in,.hljs-symbol":{color:"#f69d50"},".hljs-code,.hljs-comment,.hljs-formula":{color:"#768390"},".hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag":{color:"#8ddb8c"},".hljs-subst":{color:"#adbac7"},".hljs-section":{color:"#316dca",fontWeight:700},".hljs-bullet":{color:"#eac55f"},".hljs-emphasis":{color:"#adbac7",fontStyle:"italic"},".hljs-strong":{color:"#adbac7",fontWeight:700},".hljs-addition":{color:"#b4f1b4",backgroundColor:"#1b4721"},".hljs-deletion":{color:"#ffd8d3",backgroundColor:"#78191b"}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:o,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}};return(0,a.css)({lineHeight:t.lineHeight,"& > *:last-child":{marginBottom:"0"},".ant-description-textarea, .ant-description-input":{lineHeight:t.lineHeight},".field-interface-datetime":{minWidth:"100px"},img:{maxWidth:"100%"},...l?d:n})};var u=l(7583),c=l(2828);let p=u.default.memoize(async e=>{if(!e)return e;let t=await Promise.resolve().then(l.bind(l,248));return(0,c.$P)(t.default.render(e))});function m(e){let[t,l]=(0,n.useState)(""),[o,i]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{i(!0),p(e).then(e=>{l(e),i(!1)}).catch(e=>console.log(e))},[e]),{html:t,loading:o}}function h(e){let t=e,l=document.createElement("div");l.innerHTML=t;let o=l.innerText;return l=null,(null==o?void 0:o.replace(/[\n\r]/g,""))||""}let f=e=>{let{textOnly:t,overflowMode:l,sanitizeHtml:r,style:a}=e,s=d(),{html:u=""}=m(e.value),c=r?r(u):u,p=h(c),f="ellipsis"===l,g=(0,n.useRef)(null),[v,y]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(g.current){let e=g.current;y(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)}},[c,a,l]);let _={...a||{},...f?{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",wordBreak:"break-word",cursor:"default"}:{}},b=t?(0,o.jsx)("div",{ref:g,className:`${s} nb-markdown`,style:_,children:p}):(0,o.jsx)("div",{ref:g,className:`${s} nb-markdown`,dangerouslySetInnerHTML:{__html:c},style:_});return f&&v?(0,o.jsx)(i.Tooltip,{title:(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:c},style:{maxHeight:500,overflowY:"auto",padding:10,color:"#000"}}),overlayInnerStyle:{background:"#fff",color:"#000",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},color:"#fff",children:b}):b}},248(e,t,l){function o(e,t){function l(e){return e.split(/\s+/g)[0]}__rspack_external_mermaid.default.initialize({securityLevel:"loose",...t});let o=e.renderer.rules.fence;function n(e,t,n,i,r){let a=e[t],s=a.info.trim();if(-1===["mermaid","{mermaid}"].indexOf(s?l(s):""))return void 0!==o?o(e,t,n,i,r):"";let d="",u=[],c=document.createElement("div");document.body.appendChild(c);try{let e="mermaid-container";__rspack_external_mermaid.default.mermaidAPI.render(e,a.content,t=>{let l=document.getElementById(e);null!==l&&u.push(["style",`max-width:${l.style.maxWidth};max-height:${l.style.maxHeight}`]),d=t},c)}catch(e){return`<div class="alert alert-danger">${e}</div>`}finally{c.remove()}return u.push(["src",`data:image/svg+xml,${encodeURIComponent(d)}`]),`<img ${r.renderAttrs({attrs:u})}>`}e.renderer.rules.fence=n}l.d(t,{default:()=>i});let n=new __rspack_external_markdown_it_a5918e6a.default({html:!0,linkify:!0,typographer:!0,breaks:!0});n.use(__rspack_external_markdown_it_highlightjs_3df446b8.default),n.use(o);let i=n},7309(e,t,l){function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)?e.map(e=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let t=e,l=void 0!==t.label,o=void 0!==t.value,n=l?t.label:String(t.value??""),i=o?t.value:n,r={label:n,value:i};return t.color&&(r.color=t.color),t.icon&&(r.icon=t.icon),r}return{label:String(e),value:e}}):[]}function n(e){return"string"==typeof e&&/\{\{\s*t\s*\(/.test(e)}function i(e,t){return n(e)?t(e):e}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return Array.isArray(e)?e.map(e=>({...e,label:i(null==e?void 0:e.label,t)})):[]}function a(e,t){if(e&&Array.isArray(e)&&0!==e.length)return r(o(e),t)}function s(e,t){let l=null==t?void 0:t.mode,o="multiple"===l||"tags"===l||(null==t?void 0:t.multiple)===!0;return Array.isArray(e)?e.filter(e=>""!==e&&null!=e):""===e||null==e?o?[]:void 0:e}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(Array.isArray(e)?e:null==e?[]:[e]).map(e=>{var l;let o=t.find(t=>(null==t?void 0:t.value)===e);return o?{value:e,label:o.label}:{value:e,label:(null==e||null==(l=e.toString)?void 0:l.call(e))??e}})}function u(e,t){var l,n,i,r;if(!["radioGroup","checkboxGroup","select","multipleSelect"].includes(null==t?void 0:t.interface)||Array.isArray(null==(l=e.props)?void 0:l.options)&&(null==(i=e.props)||null==(n=i.options)?void 0:n.length)>0)return!1;let a=null==(r=t.uiSchema)?void 0:r.enum;if(!Array.isArray(a)||0===a.length)return!1;let s=o(a);return!!s.length&&(e.setProps({options:s}),!0)}l.d(t,{NI:()=>u,OL:()=>i,ZY:()=>r,di:()=>a,xO:()=>s,yg:()=>d})},9133(e,t,l){l.d(t,{E4:()=>i,Gj:()=>d,a_:()=>o,eo:()=>p,pX:()=>s,w7:()=>r});let o="__custom__";function n(e){return`${o}:${e}`}function i(e){var t;if(!e||"object"!=typeof e)return!1;let l=e;if(!(null==(t=l.isAssociationField)?void 0:t.call(l)))return!1;let o=l.type,n=l.interface;return"belongsToMany"===o||"hasMany"===o||"belongsToArray"===o||"m2m"===n||"o2m"===n||"mbm"===n}function r(e){var t;if(!e||"object"!=typeof e)return;let l=e;return l.collection||(null==(t=l.context)?void 0:t.collection)||void 0}function a(e){return"string"==typeof e?e.trim():""}function s(e){if(!e||"object"!=typeof e)return[];let t=e,l="function"==typeof t.getStepParams?t.getStepParams("fieldSettings","init"):void 0,o=l&&"object"==typeof l?l:void 0,i="function"==typeof t.getStepParams?t.getStepParams("formItemSettings","fieldSettings"):void 0,r=i&&"object"==typeof i?i:void 0,s=(null==o?void 0:o.fieldPath)??t.fieldPath,d=(null==o?void 0:o.associationPathName)??t.associationPathName,u=null==r?void 0:r.name,c=a(s),p=a(d),m=a(u),h=new Set;return c&&h.add(c),p&&(c?c.startsWith(`${p}.`)?h.add(c):h.add(`${p}.${c}`):h.add(p)),m&&h.add(n(m)),Array.from(h)}function d(e){return s(e)[0]}function u(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;if(!t||"object"!=typeof t)return[];let l=t.items;if(Array.isArray(l))return l;let o=t.grid;if(!o||"object"!=typeof o)return[];let n=o.subModels;if(!n||"object"!=typeof n)return[];let i=n.items;return Array.isArray(i)?i:[]}function c(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;return t&&"object"==typeof t?u(t.field):[]}function p(e,t){let l=a(t);if(!l)return null;let o=e=>{if(!Array.isArray(e))return null;for(let t of e){if(s(t).some(e=>e===l))return t;let e=o(c(t));if(e)return e}return null};return o(u(e))}},7720(e,t,l){l.d(t,{VS:()=>a,_H:()=>u,i2:()=>c,sI:()=>m});var o=l(1649),n=l(6832),i=l(7309);function r(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function a(e){return r(e)?e:void 0}function s(e){return e}function d(e){var t;let l=s(e);l._reactiveWrapperCache=void 0,null==(t=l.setupReactiveRender)||t.call(l)}function u(e,t,l){let o,i=!(arguments.length>3)||void 0===arguments[3]||arguments[3];if(!l||!Array.isArray(l))return null;let a=l.find(e=>(null==e?void 0:e.value)===t),s=null==a?void 0:a.schema,d=null==s?void 0:s["x-component"];if(!d)return null;if("DateFilterDynamicComponent"===d)o=n.DateFilterDynamicComponent;else{var u,c;o=i?null==e||null==(u=e.getComponent)?void 0:u.call(e,d):null==e||null==(c=e.getComponent)?void 0:c.call(e,d,!1)}return o?{Comp:o,props:r(null==s?void 0:s["x-component-props"])?s["x-component-props"]:{}}:null}function c(e){let t=s(e);return!!t&&"function"==typeof t.__originalRender&&(t.render=t.__originalRender,d(t),!0)}function p(e,t){return Array.isArray(e.options)&&"function"==typeof t?{...e,options:(0,i.ZY)(e.options,t)}:e}function m(e){let{app:t,fieldModel:l,operator:n,operators:i,propsPriority:r="field",style:m}=e,h=s(l),f=u(t,n,i);if(!f)return c(h),!1;h.__originalRender||"function"!=typeof h.render||(h.__originalRender=h.render);let{Comp:g,props:v}=f,y=a(v.style);return h.render=()=>{let e=h.props||{},t=a(e.style),l=p("operator"===r?{...e,...v}:{...v,...e},h.translate),n="operator"===r?{...t,...y}:{...y,...t},i={...m||{},...n};return o.default.createElement(g,{...l,...Object.keys(i).length>0?{style:i}:{},onCompositionStart:null,onCompositionEnd:null})},d(h),!0}},544(e,t,l){l.d(t,{ON:()=>i,jI:()=>n});let o="__saveStepParamsWithSubModels";function n(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");e[o]=!0}async function i(e,t){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");let l=e;if(!0!==l[o])return await t();if("function"!=typeof l.save)throw Error("[saveStepParamsWithSubModels] model.save is not a function");try{return await l.save()}finally{delete l[o]}}},7827(e,t,l){l.d(t,{S0:()=>r.S0,_T:()=>r._T,s5:()=>r.s5});var o=l(504),n=l(6305);l(1649);var i=l(2542),r=l(5042);function a(e){let t=e.model.defaultProps||{};return e.isMobileLayout&&t.icon&&!1!==e.model.enableEditIconOnly?{...t,iconOnly:!0}:t}r.S0.registerFlow({key:"buttonSettings",title:(0,o.tExpr)("Button settings"),sort:-999,steps:{general:{title:(0,o.tExpr)("Edit button"),uiSchema(e){var t,l;return{title:e.model.enableEditTitle?{"x-decorator":"FormItem","x-component":"Input",title:(0,o.tExpr)("Button title"),description:null==(t=(l=e.model).getTitleFieldDescription)?void 0:t.call(l)}:void 0,tooltip:e.model.enableEditTooltip?{"x-decorator":"FormItem","x-component":"Input",title:(0,o.tExpr)("Button tooltip")}:void 0,icon:e.model.enableEditIcon?{"x-decorator":"FormItem","x-component":"IconPicker",title:(0,o.tExpr)("Button icon")}:void 0,iconOnly:e.model.enableEditIcon&&!1!==e.model.enableEditIconOnly?{"x-decorator":"FormItem","x-component":"Switch",title:(0,o.tExpr)("Icon only")}:void 0,type:e.model.enableEditType?{"x-decorator":"FormItem","x-component":"Radio.Group",title:(0,o.tExpr)("Button type"),enum:e.model.buttonTypeOptions}:void 0,danger:e.model.enableEditDanger?{"x-decorator":"FormItem","x-component":"Switch",title:(0,o.tExpr)("Danger action")}:void 0,color:e.model.enableEditColor?{"x-decorator":"FormItem","x-component":n.sk,title:(0,o.tExpr)("Color")}:void 0}},defaultParams(e){var t,l;let o=a(e);return e.model.enableEditColor?{...o,color:(null==(t=e.model.props)?void 0:t.color)??o.color??(null==(l=e.themeToken)?void 0:l.colorPrimary)}:o},handler(e,t){let{title:l,tooltip:o,...n}=t;e.model.setProps({title:e.t(l,{ns:"lm-flow-engine"}),tooltip:e.t(o,{ns:"lm-flow-engine"}),...n})}},linkageRules:{use:"actionLinkageRules"}}}),r.S0.registerFlow({key:"buttonAclSettings",steps:{aclCheck:{use:"aclCheck"}}}),r.S0.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh"},linkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"actionLinkageRules",flowKey:"buttonSettings",stepKey:"linkageRules"}}}}),r.S0.registerEvents({click:{title:(0,o.tExpr)("Click"),name:"click",uiSchema:{condition:{type:"object",title:(0,o.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":i.H}},handler:i.b}})},5042(e,t,l){l.d(t,{S0:()=>p,_T:()=>u,s5:()=>c});var o=l(1178),n=l(504),i=l(3137),r=l(2793),a=l(7583),s=l(1649),d=l(7843);function u(e){let{t}=(0,d.useTranslation)(),l=(0,n.useFlowModel)(),i=l.context.blockModel,u=e.collection||i.collection,c=u.dataSource,p=(0,s.useMemo)(()=>{let e=`${t(c.displayName||c.key)} > `,l=u?`${t(u.title)||u.name||u.tableName} `:"";return`${e}${l}`},[u,c.displayName,c.key,t]),{actionName:m}=(null==e?void 0:e.forbidden)||l.forbidden,h=(0,s.useMemo)(()=>t('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:p,actionName:t(a.default.capitalize(m))}).replaceAll(">",">"),[m,p,t]);return(0,o.jsx)(r.Tooltip,{title:e.message||h,children:e.children})}let c={collection:"collection",record:"record",all:["collection","record"],both:["collection","record"]};class p extends n.FlowModel{static _getScene(){return a.default.castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getAclActionName(){return null}onInit(e){super.onInit(e),delete this.props.disabled,this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1})}serialize(){let e=super.serialize();return delete e.props.disabled,e}getInputArgs(){let e={},t=[];if(this.context.resource){let l=this.context.resource.getSourceId();l&&(e.sourceId=l,t.push("sourceId"))}if(this.context.collection&&this.context.record){let l=this.context.collection.getFilterByTK(this.context.record);l&&(e.filterByTk=l,t.push("filterByTk"))}return t.length&&(e.defaultInputKeys=t),e}onClick(e){this.dispatchEvent("click",{event:e,...this.getInputArgs()},{debounce:!0})}getTitle(){return this.props.title}getTitleFieldDescription(){}getIcon(){return this.props.icon}renderButton(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,o.jsx)(i.In,{type:this.getIcon()}):void 0,n=e&&l?null:t.children||this.getTitle();return(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,children:n})}render(){return this.props.tooltip?(0,o.jsx)(r.Tooltip,{title:this.props.tooltip,children:this.renderButton()}):this.renderButton()}renderHiddenInConfig(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,o.jsx)(i.In,{type:this.getIcon()}):void 0,n=e&&l?null:t.children||this.getTitle();return this.forbidden?(0,o.jsx)(u,{children:(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:n})}):(0,o.jsx)(r.Tooltip,{title:this.context.t("The button is hidden and only visible when the UI Editor is active"),children:(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:n})})}constructor(...e){super(...e),this.defaultProps={type:"default",title:(0,n.tExpr)("Action"),iconOnly:!1},this.enableEditTooltip=!0,this.enableEditTitle=!0,this.enableEditIcon=!0,this.enableEditIconOnly=!0,this.enableEditType=!0,this.enableEditDanger=!0,this.enableEditColor=!1,this.buttonTypeOptions=[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Primary")}}'},{value:"dashed",label:'{{t("Dashed")}}'},{value:"link",label:'{{t("Link")}}'},{value:"text",label:'{{t("Text")}}'}]}}},3438(e,t,l){l.d(t,{P:()=>c,z:()=>p});var o=l(1178),n=l(2314),i=l(504),r=l(7583);l(1649);var a=l(2793),s=l(8563),d=l(2542),u=l(1511);let c={new:"new",one:"one",many:"many",select:"select",filter:"filter",oam:["one","many"],subForm:"subForm",bulkEditForm:"bulkEditForm"};class p extends i.FlowModel{setFilterActive(e,t){this.activeFilterSources.set(e,t)}hasActiveFilters(){let e=this.resource;if(e&&e.filter&&Object.keys(e.filter).length>0)return!0;for(let[,e]of this.activeFilterSources)if(e)return!0;return!1}removeFilterSource(e){this.activeFilterSources.delete(e)}getDataLoadingMode(){var e;let t=this.getStepParams("dataLoadingModeSettings");return(null==t||null==(e=t.dataLoadingMode)?void 0:e.mode)||"auto"}static _getScene(){return r.default.castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getModelClassName(e){return Object.keys(this.customModelClasses).includes(e)?this.customModelClasses[e]:this._defaultCustomModelClasses[e]||e}renderHiddenInConfig(){return this.forbidden?(0,o.jsx)(u.B3,{}):(0,o.jsx)(a.Tooltip,{title:this.context.t("The block is hidden and only visible when the UI Editor is active"),children:(0,o.jsx)(s.tn,{ref:this.context.ref,...this.decoratorProps,style:{opacity:"0.3"},children:(0,o.jsx)(this.ObservedRenderComponent,{})})})}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineMethod("getModelClassName",e=>this.getModelClassName(e)),this.ObservedRenderComponent=(0,i.observer)(()=>this.renderComponent(),{displayName:"ObservedRenderComponent"})}setDecoratorProps(e){Object.assign(this.decoratorProps,e)}get title(){return this._title||(this._title=this.defaultBlockTitle()),this._title}defaultBlockTitle(){var e;return`${this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name)}`}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of BlockModel")}render(){return this.collectionRequired&&!this.context.collection?(0,o.jsx)(u.Ak,{}):(0,o.jsx)(s.tn,{ref:this.context.ref,...this.decoratorProps,children:(0,o.jsx)(this.ObservedRenderComponent,{})})}constructor(...e){super(...e),this.decoratorProps=(0,n.observable)({}),this._defaultCustomModelClasses={},this.customModelClasses={},this.collectionRequired=!1,this.ObservedRenderComponent=null,this.activeFilterSources=new Map}}p.registerFlow({key:"cardSettings",title:(0,i.tExpr)("Card settings"),steps:{titleDescription:{title:(0,i.tExpr)("Title & description"),uiSchema:{title:{"x-component":"Input","x-decorator":"FormItem",title:(0,i.tExpr)("Title")},description:{"x-component":"Input.TextArea","x-decorator":"FormItem",title:(0,i.tExpr)("Description")}},handler(e,t){let l=e.t(t.title,{ns:"lm-flow-engine"}),o=e.t(t.description,{ns:"lm-flow-engine"});e.model.setDecoratorProps({title:l,description:o})}},linkageRules:{use:"blockLinkageRules"},blockHeight:{use:"blockHeight"}}}),p.define({hide:!0,label:(0,i.tExpr)("Other blocks")}),i.FlowModel.registerEvents({beforeRender:{title:(0,i.tExpr)("Before render"),name:"beforeRender",uiSchema:{condition:{type:"object",title:(0,i.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":d.H}},handler:d.b}})},9639(e,t,l){l.d(t,{U:()=>i});var o=l(504),n=l(7827);class i extends n.S0{}i.define({children:async e=>(await (0,o.buildSubModelItems)(n.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(n.s5.collection))})},146(e,t,l){l.d(t,{t:()=>u});var o=l(1178),n=l(504),i=l(7583);l(1649);var r=l(1511),a=l(7123),s=l(8481),d=l(2606);class u extends d.R{onMount(){super.onMount(),this.previousBeforeRenderHash=this.context.location.search}getDirtyTrackingVersion(e,t,l,o){var n;let i=new Set,r=(null==l||null==(n=l.getResourceName)?void 0:n.call(l))||o.associationName||o.collectionName;r&&i.add(String(r)),o.associationName&&i.add(String(o.associationName)),o.collectionName&&i.add(String(o.collectionName));let a=0;for(let l of i)a+=e.getDataSourceDirtyVersion(t,l);return a}onActive(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.hidden&&this.previousBeforeRenderHash!==this.context.location.search&&(this.rerender(),!e)||this.hidden)return;let t=this.context.resource;if(!t)return;let l=this.getResourceSettingsInitParams(),o=t.getDataSourceKey()||l.dataSourceKey||"main",i=this.context.engine,r=this.getDirtyTrackingVersion(i,o,t,l);if(t instanceof n.MultiRecordResource&&"manual"===this.getDataLoadingMode()&&!this.hasActiveFilters()){t.setData([]),t.setMeta({count:0,hasNext:!1}),t.setPage(1),t.loading=!1,this.lastSeenDirtyVersion=r;return}if(e){if(this.dirtyRefreshing)return;this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(i,o,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1});return}this.isManualRefresh||null!==this.lastSeenDirtyVersion&&r===this.lastSeenDirtyVersion||this.dirtyRefreshing||(this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(i,o,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1}))}static filterCollection(e){return!!e.filterTargetKey}static isCollectionAvailable(e){if(!e)return!1;let t=(0,s.b1)(this);return(0,s.F3)(e,t)}static async defineChildren(e){let t=t=>{var l;if(!(null==(l=this.meta)?void 0:l.createModelOptions))return t||{};if("function"==typeof this.meta.createModelOptions){let l=this.meta.createModelOptions(e);return i.default.merge({},l,t)}return i.default.merge({},this.meta.createModelOptions,t)},l=e=>this.name+e,{dataSourceKey:o,collectionName:r,associationName:a,filterByTk:s}=e.view.inputArgs,d=e.dataSourceManager.getDataSources().map(e=>0===e.getCollections().length?null:{key:l(`ds-${e.key}`),label:e.displayName,searchable:!0,searchPlaceholder:(0,n.tExpr)("Search"),children:o=>e.getCollections().map(o=>{if(!this.filterCollection(o)||!this.isCollectionAvailable(o))return null;let n={dataSourceKey:o.dataSourceKey,collectionName:o.name};return{key:l(`ds-${e.key}.${o.name}`),label:o.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}}).filter(Boolean)}).filter(Boolean),u=e=>1===d.length?d[0].children(e):d;if(!r)return u(e);if(this._isScene("select")){let n={dataSourceKey:o,collectionName:r};a&&(n.associationName=a,n.sourceId="{{ctx.view.inputArgs.sourceId}}");let i=e.dataSourceManager.getCollection(o,r),s=[];return this.isCollectionAvailable(i)&&s.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}),s.push({key:l("others-collections"),label:"Other collections",children:u(e)}),s}if(this._isScene("new")){let n={dataSourceKey:o,collectionName:r};a&&(n.associationName=a,n.sourceId="{{ctx.view.inputArgs.sourceId}}");let i=[],d=e.dataSourceManager.getCollection(o,r);return this.isCollectionAvailable(d)&&i.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}),null!=s&&i.push({key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(o,r).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let n=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(n="{{ctx.view.inputArgs.filterByTk}}");let i={dataSourceKey:o,collectionName:e.target,associationName:e.resourceName,sourceId:n};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})}}).filter(Boolean)}),i.push({key:l("others-collections"),label:"Other collections",children:u(e)}),i}let c=[{key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(o,r).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let n=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(n="{{ctx.view.inputArgs.filterByTk}}");let i={dataSourceKey:o,collectionName:e.target,associationName:e.resourceName,sourceId:n};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})}}).filter(Boolean)},{key:l("others-records"),label:"Other records",children:u(e)}];if(this._isScene("one")){let n=e.dataSourceManager.getCollection(o,r);if(!n||!this.filterCollection(n)||!this.isCollectionAvailable(n))return c;let i={dataSourceKey:o,collectionName:r,filterByTk:"{{ctx.view.inputArgs.filterByTk}}"};a&&(i.associationName=a,i.sourceId="{{ctx.view.inputArgs.sourceId}}"),c.unshift({key:l("current-record"),label:"Current record",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})})}return c}get dataSource(){return this.context.dataSource}get collection(){return this.context.collection}get resource(){return this.context.resource}get association(){return this.context.association}get associationField(){return this.context.association}getAclActionName(){return"view"}async getFilterFields(){return this.collection.getFields().filter(e=>e.filterable)}getResourceSettingsInitParams(){return this.getStepParams("resourceSettings","init")}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1}),this.context.defineProperty("resourceName",{get:()=>this.resource.getResourceName(),cache:!1}),this.context.defineProperty("dataSource",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getDataSource(e.dataSourceKey)}}),this.context.defineProperty("collection",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getCollection(e.dataSourceKey,e.collectionName)}}),this.context.defineProperty("resource",{get:()=>{let e=this.getResourceSettingsInitParams(),t=this.createResource(this.context,e);t.setDataSourceKey(e.dataSourceKey),t.setResourceName(e.associationName||e.collectionName);let l=()=>{var l;let o=this.context.engine;if(!(null==o?void 0:o.getDataSourceDirtyVersion))return;let n=(null==(l=t.getDataSourceKey)?void 0:l.call(t))||e.dataSourceKey||"main";this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(o,n,t,e)};return l(),t.on("refresh",()=>{l(),this.invalidateFlowCache("beforeRender")}),t}}),this.context.defineProperty("association",{get:()=>{let e=this.getResourceSettingsInitParams();if(e.associationName)return this.dataSource.getAssociation(e.associationName)}})}createResource(e,t){throw Error("createResource method must be implemented in subclasses of CollectionBlockModel")}refresh(){return this.resource?this.resource.refresh():super.refresh()}isExternalDataSource(){var e;let t=null==(e=this.getResourceSettingsInitParams())?void 0:e.dataSourceKey;return!!(t&&"main"!==t)}render(){var e;return this.isExternalDataSource()&&this.collection&&(null==(e=this.resource)?void 0:e.getError())?(0,o.jsx)(r.Lb,{}):super.render()}defaultBlockTitle(){var e,t,l,o;let n=this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name),i=this.getResourceSettingsInitParams(),r=this.dataSource,s=this.collection,d=(null==r?void 0:r.displayName)||(null==r?void 0:r.key)||(null==i?void 0:i.dataSourceKey),u=(null==(o=this.context)||null==(l=o.dataSourceManager)||null==(t=l.getDataSources)?void 0:t.call(l).length)||0,c=(null==s?void 0:s.title)||(null==s?void 0:s.name)||(null==i?void 0:i.collectionName)||"",p=r?this.association:void 0;if(p){let e=this.resource.getResourceName(),t=r.getCollection(e.split(".")[0]);return(0,a.l)({blockLabel:n,dsName:d,dsCount:u,collectionTitle:c,sourceCollectionTitle:null==t?void 0:t.title,associationTitle:p.title})}return(0,a.l)({blockLabel:n,dsName:d,dsCount:u,collectionTitle:c})}addAppends(e){var t,l;let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)if(e.includes(".")){let l=this.collection;if(!l)return;let[n,i]=e.split("."),r=this.context.dataSourceManager.getCollectionField(`${l.dataSourceKey}.${l.name}.${n}`);if(!r)return;let a=r.target;if(!a)return;let s=this.context.dataSourceManager.getCollectionField(`${l.dataSourceKey}.${a}.${i}`);if(s&&s.isAssociationField()){if(this.resource.addAppends(e),(null==(t=s.targetCollection)?void 0:t.template)==="tree"){let t=e.includes(".")?e.slice(e.lastIndexOf(".")+1):e;s.name===t&&this.resource.addAppends(`${e}.parent(recursively=true)`)}o&&this.resource.refresh()}}else{if(!this.collection)return;let t=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${this.collection.name}.${e}`);if(!t)return;t.isAssociationField()&&(this.resource.addAppends(t.name),(null==(l=t.targetCollection)?void 0:l.template)==="tree"&&this.resource.addAppends(`${t.name}.parent(recursively=true)`),o&&this.resource.refresh())}}constructor(...e){super(...e),this.isManualRefresh=!1,this.collectionRequired=!0,this.lastSeenDirtyVersion=null,this.dirtyRefreshing=!1}}u.registerFlow({key:"resourceSettings",sort:-999,steps:{collectionCheck:{handler(e){e.collection||e.exitAll()}},aclCheck:{use:"aclCheck"},init:{handler(e,t){if(!t.dataSourceKey)throw Error("dataSourceKey is required");if(!t.collectionName)throw Error("collectionName is required");Object.keys(t).includes("sourceId")&&e.resource.setSourceId(t.sourceId),Object.keys(t).includes("filterByTk")&&e.resource.setFilterByTk(t.filterByTk)}}}}),u.registerFlow({key:"refreshSettings",sort:1e4,steps:{refresh:{async handler(e){let t=e.model,l=e.model.context.filterManager,o=(null==l?void 0:l.prepareFiltersForTarget)?await l.prepareFiltersForTarget(e.model.uid):void 0;l&&l.bindToTarget(e.model.uid);let i=t.getDataLoadingMode(),r=t.resource;if(r instanceof n.MultiRecordResource&&"manual"===i&&!t.hasActiveFilters()){r.setData([]),r.setMeta({count:0,hasNext:!1,page:1}),r.loading=!1;return}if(null==o||o.forEach(t=>{var l;null==t||null==(l=t.markInitialTargetRefreshHandled)||l.call(t,e.model.uid)}),e.model.isManualRefresh)e.model.resource.loading=!1;else try{await r.refresh()}catch(e){if(t.isExternalDataSource()&&e instanceof n.ResourceError&&r.getError()===e)return;throw e}}}}}),u.registerFlow({key:"dataLoadingModeSettings",sort:800,title:(0,n.tExpr)("Set data loading mode"),steps:{dataLoadingMode:{use:"dataLoadingMode"}}}),u.define({hide:!0})},2606(e,t,l){l.d(t,{R:()=>i});var o=l(504),n=l(3438);class i extends n.z{}i.define({hide:!0,label:(0,o.tExpr)("Data blocks"),async children(e){let t=await (0,o.buildSubModelItems)(i)(e),{collectionName:l,filterByTk:n,scene:r}=e.view.inputArgs;return t.filter(t=>{var o,i,a,s,d,u,c;let p=e.engine.getModelClass(t.useModel);return"select"===r?null==(s=p._isScene)?void 0:s.call(p,"select"):"subForm"===r?null==(d=p._isScene)?void 0:d.call(p,"subForm"):"bulkEditForm"===r?null==(u=p._isScene)?void 0:u.call(p,"bulkEditForm"):"new"===r||l&&!n?null==(c=p._isScene)?void 0:c.call(p,"new"):!p._isScene||!(null==(o=p._isScene)?void 0:o.call(p,"select"))&&!(null==(i=p._isScene)?void 0:i.call(p,"subForm"))&&!(null==(a=p._isScene)?void 0:a.call(p,"bulkEditForm"))})}})},6859(e,t,l){l.d(t,{o:()=>n});var o=l(504);class n extends o.FlowModel{static resolveUse(e,t,l){var o,n;let i=null==e||null==(n=e.stepParams)||null==(o=n.fieldBinding)?void 0:o.use;return i&&i!==(null==e?void 0:e.use)?i:null==e?void 0:e.use}}},1882(e,t,l){l.d(t,{L:()=>i});var o=l(504),n=l(7827);class i extends n.S0{}i.define({children:async e=>(await (0,o.buildSubModelItems)(n.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(n.s5.record))})},3027(e,t,l){l.d(t,{GO:()=>b,KW:()=>M,Z1:()=>y,eu:()=>_,nF:()=>v,zL:()=>s});var o=l(1178),n=l(504),i=l(1649),r=l(9639),a=l(1882);let s="assignFieldValues";function d(e){let t=null==e?void 0:e.collection;return t&&"object"==typeof t?t:void 0}function u(e){let t=d(e),l=null==t?void 0:t.dataSourceKey,o=null==t?void 0:t.name;return l&&o?{dataSourceKey:l,collectionName:o}:void 0}function c(e,t){let l=(null==e?void 0:e.collection)||d(t),o=null==l?void 0:l.dataSourceKey,n=null==l?void 0:l.name;return o&&n?{dataSourceKey:o,collectionName:n}:void 0}function p(e){if(!e||"object"!=typeof e)return!1;let t=e;return"string"==typeof t.dataSourceKey&&!!t.dataSourceKey&&"string"==typeof t.collectionName&&!!t.collectionName}function m(e){return e&&"object"==typeof e?e:void 0}function h(e,t){var l,o,n;let i=m(e);i&&(null==(l=i._observableCache)||delete l[t],null==(o=i._cache)||delete o[t],null==(n=i._pending)||delete n[t])}function f(e){h(null==e?void 0:e.context,"dataSource"),h(null==e?void 0:e.context,"collection"),h(null==e?void 0:e.context,"resource"),h(null==e?void 0:e.context,"association")}function g(e){var t,l,o,n,i;if(e.model.assignFormUid){let t=null==(n=(i=e.engine).getModel)?void 0:n.call(i,e.model.assignFormUid,!0);if(t)return t}let r=null==(t=e.model.subModels)?void 0:t.assignForm;return r||(null==(l=(o=e.engine).findModelByParentId)?void 0:l.call(o,e.model.uid,"assignForm"))||void 0}function v(e){return{async:!0,use:"AssignFormModel",stepParams:{resourceSettings:{init:u(e)}}}}function y(e,t){var l,o;let n=(null==(l=(o=e.model).getStepParams)?void 0:l.call(o,t,s))||{};return{assignedValues:(null==n?void 0:n.assignedValues)||{}}}async function _(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AssignFieldValues";try{return await (0,n.resolveRunJSObjectValues)(e,t)}catch(t){var o,i,r;return console.error(`[${l}] RunJS execution failed`,t),null==(r=e.message)||null==(i=r.error)||i.call(r,(null==(o=e.t)?void 0:o.call(e,"RunJS execution failed"))||"RunJS execution failed"),null}}function b(e,t){return t&&"object"==typeof t&&Object.keys(t).length?{...e,...t}:e}function x(e){let{model:t,blockModel:l}=(0,n.useFlowSettingsContext)(),d=t,u=(0,n.useFlowEngine)(),[m,h]=i.default.useState(null);return(0,i.useEffect)(()=>{let o=!1;return(async()=>{var n,i,m,g,v;let y=c(l,null==d?void 0:d.context),_=await u.loadOrCreateModel(y?{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel",stepParams:{resourceSettings:{init:y}}}:{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel"},{skipSave:!t.context.flowSettingsEnabled});if(o)return;if(p(y)){let e=null==(m=_.getStepParams)?void 0:m.call(_,"resourceSettings","init");p(e)&&e.dataSourceKey===y.dataSourceKey&&e.collectionName===y.collectionName||null==(v=_.setStepParams)||v.call(_,"resourceSettings","init",y),f(_),f(null==(g=_.subModels)?void 0:g.grid)}let b=(null==(n=d.getStepParams)?void 0:n.call(d,e.settingsFlowKey,s))||{};_.setInitialAssignedValues((null==b?void 0:b.assignedValues)||{});let x=t instanceof r.U&&!(t instanceof a.L);(e.clearRecordContext||x)&&(null==(i=_.context)?void 0:i.defineProperty)&&_.context.defineProperty("record",{get:()=>void 0,cache:!1}),h(_),d.assignFormUid=(null==_?void 0:_.uid)||d.assignFormUid})(),()=>{o=!0}},[d,l,u,t,t.context.flowSettingsEnabled,e.clearRecordContext,e.settingsFlowKey]),m?(0,o.jsx)(n.FlowModelRenderer,{model:m,showFlowSettings:!1}):null}function M(e){return{title:e.title||(0,n.tExpr)("Assign field values"),uiSchema:()=>({tip:e.tipComponent?{"x-decorator":"FormItem","x-component":e.tipComponent}:void 0,editor:{"x-decorator":"FormItem","x-component":()=>(0,o.jsx)(x,{settingsFlowKey:e.settingsFlowKey,clearRecordContext:e.clearRecordContext})}}),async beforeParamsSave(t,l,o){var n,i,r,a,d,u,c;let p=g(t);if(!p){let n=(null==l?void 0:l.assignedValues)||(null==o?void 0:o.assignedValues)||{};null==(a=(d=t.model).setStepParams)||a.call(d,e.settingsFlowKey,s,{assignedValues:n});return}e.validateBeforeSave&&await (null==(c=p.form)||null==(u=c.validateFields)?void 0:u.call(c));let m=(null==(n=p.getAssignedValues)?void 0:n.call(p))||{};null==(i=(r=t.model).setStepParams)||i.call(r,e.settingsFlowKey,s,{assignedValues:m})},handler(){}}}},6832(e,t,l){l.r(t),l.d(t,{DateFilterDynamicComponent:()=>_});var o=l(1178),n=l(1649),i=l(2793),r=l(691),a=l(504),s=l(6305),d=l(3526),u=l(7583);let c=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,p=(e,t)=>{if(!e)return null;if(d.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,d.dayjs)(e).format(t),o=(0,d.dayjs)(l,t);return o.isValid()?o:(0,d.dayjs)(e)}let l=(0,d.dayjs)(e,t);if(l.isValid())return l;let o=(0,d.dayjs)(e);return o.isValid()?o:null},m=e=>{let{value:t,picker:l="date",format:r,showTime:m,timeFormat:h}=e,f=(0,a.useFlowEngine)(),g=f.translate.bind(f),v=(0,s.fD)(),y=[{label:g("Today"),value:v.today},{label:g("Last week"),value:v.lastWeek},{label:g("This week"),value:v.thisWeek},{label:g("Next week"),value:v.nextWeek},{label:g("Last month"),value:v.lastMonth},{label:g("This month"),value:v.thisMonth},{label:g("Next month"),value:v.nextMonth},{label:g("Last quarter"),value:v.lastQuarter},{label:g("This quarter"),value:v.thisQuarter},{label:g("Next quarter"),value:v.nextQuarter},{label:g("Last year"),value:v.lastYear},{label:g("This year"),value:v.thisYear},{label:g("Next year"),value:v.nextYear},{label:g("Last 7 days"),value:v.last7Days},{label:g("Next 7 days"),value:v.next7Days},{label:g("Last 30 days"),value:v.last30Days},{label:g("Next 30 days"),value:v.next30Days},{label:g("Last 90 days"),value:v.last90Days},{label:g("Next 90 days"),value:v.next90Days}],_=t?(0,s.Pn)(null==t?void 0:t[0],l):l,b=_===l&&r?r:(0,d.getPickerFormat)(_),x="date"===_?c(b):b,M=(0,d.getDateTimeFormat)(_,x,m,h),w={utc:!0,presets:y,...e,format:M,picker:_,showTime:!!m&&{defaultValue:[(0,d.dayjs)("00:00:00","HH:mm:ss"),(0,d.dayjs)("23:59:59","HH:mm:ss")]}},S=(0,n.useMemo)(()=>u.default.castArray(e.value).map(e=>p(e,M)),[e.value,M]);return(0,o.jsx)(i.DatePicker.RangePicker,{...w,style:{flex:1,...null==w?void 0:w.style},value:S})},h=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,f=(e,t)=>{if(!e)return null;if(d.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,d.dayjs)(e).format(t),o=(0,d.dayjs)(l,t);return o.isValid()?o:(0,d.dayjs)(e)}let l=(0,d.dayjs)(e,t);if(l.isValid())return l;let o=(0,d.dayjs)(e);return o.isValid()?o:null},g=e=>{let{picker:t="date",format:l,showTime:r,timeFormat:u,onChange:c}=e,p=(0,a.useFlowContext)(),m=Array.isArray(e.value)?e.value[0]:e.value,g=m?(0,s.Pn)(m,t):t,[v,y]=(0,n.useState)(g),_=p.model.translate.bind(p.model),b=e=>{let o=e===t&&l?l:(0,d.getPickerFormat)(e),n="date"===e?h(o):o;return(0,d.getDateTimeFormat)(e,n,r,u)},x=(0,n.useMemo)(()=>b(v),[l,t,r,v,u]),M=(0,n.useMemo)(()=>f(m,x),[m,x]),w={utc:!0,inputReadOnly:p.isMobileLayout,...e,underFilter:!0,showTime:!!r&&{defaultValue:(0,d.dayjs)("00:00:00","HH:mm:ss")},format:x,picker:v};return(0,o.jsxs)(i.Space.Compact,{style:{width:"100%"},children:[(0,o.jsx)(i.Select,{style:{width:"100px"},popupMatchSelectWidth:!1,value:v,options:[{label:_("Date"),value:"date"},{label:_("Month"),value:"month"},{label:_("Quarter"),value:"quarter"},{label:_("Year"),value:"year"}],onChange:e=>{let t=b(e),l=x;if(y(e),!m||!c)return;let o=f(m,l);o&&o.isValid()&&c(o,o.format(t))}}),(0,o.jsx)(i.DatePicker,{...w,style:{flex:1,...null==w?void 0:w.style},value:M})]})},v=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=[{value:"exact",label:e("Exact day")},{value:"past",label:e("Past")},{value:"next",label:e("Next")},{value:"today",label:e("Today")},{value:"yesterday",label:e("Yesterday")},{value:"tomorrow",label:e("Tomorrow")},{value:"thisWeek",label:e("This Week")},{value:"lastWeek",label:e("Last Week")},{value:"nextWeek",label:e("Next Week")},{value:"thisMonth",label:e("This Month")},{value:"lastMonth",label:e("Last Month")},{value:"nextMonth",label:e("Next Month")},{value:"thisQuarter",label:e("This Quarter")},{value:"lastQuarter",label:e("Last Quarter")},{value:"nextQuarter",label:e("Next Quarter")},{value:"thisYear",label:e("This Year")},{value:"lastYear",label:e("Last Year")},{value:"nextYear",label:e("Next Year")}];return t&&l.splice(3,0,{value:"now",label:e("Now")}),l},y=e=>{let{isRange:t,defaultValue:l,onChange:i,...r}=e,a=(0,n.useCallback)((e,t)=>i(t),[i]);return t?(0,o.jsx)(m,{...r,onChange:a}):(0,o.jsx)(g,{...r,onChange:a})},_=e=>{let{value:t,onChange:l,includeNow:s=!1,...d}=e,u=(0,a.useFlowEngine)(),c=u.translate.bind(u),{token:p}=i.theme.useToken(),[m,h]=(0,n.useState)(!1),f=(0,n.useMemo)(()=>v(c,s),[c,s]),g=e=>{if(h(!1),"exact"===e)return l(void 0);let t={type:e};["past","next"].includes(e)&&(t.number=1,t.unit="day"),l(t)},_=()=>{let e=f.slice(0,3),t=f.slice(3),l=(0,r.css)`
|
|
269
|
+
${n}`,u)}}let o=T(e.issues.filter(e=>"runtime"===e.type)),n=o?`Key runtime issue: ${j(o)}`:"",i=["RunJS preview output was truncated.",t,e.execution?I(e.execution):void 0,n||void 0].filter(Boolean).join("\n").trim();return i.length<=u?i:L(i,u-1)+"\n"}function E(e){return D(e)}async function Y(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="string"==typeof e?e:String(e??""),n=[],i=[],r=null==l?void 0:l.version,a=(0,s.shouldPreprocessRunJSTemplates)({version:r});i.push(...C(o)),i.push(...A(o));let d="u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now(),u={started:!1,finished:!1,timeout:!1,durationMs:void 0};try{u.started=!0;let{consoleCapture:e,loggerCapture:l}=P(n),d={console:e};"u">typeof window&&(d.window=window,"u">typeof navigator&&(d.navigator=navigator)),"u">typeof document&&(d.document=document);let p=o;try{p=await (0,s.prepareRunJsCode)(o,{preprocessTemplates:a})}catch(o){let e=String((null==o?void 0:o.name)||""),t=v((null==o?void 0:o.message)||o),l=o instanceof SyntaxError||/^SyntaxError\b/i.test(e)||/SyntaxError\b/i.test(t);return i.push({type:"runtime",ruleId:l?"preview-start-failed":"internal",message:l?t:`Preview internal failure: ${t}`,stack:M(o)}),u.finished=!0,u.timeout=!1,{issues:k(i),logs:n,execution:u}}let m=await t.createJSRunner({globals:d,timeoutMs:c,version:r});m.globals.ctx.defineProperty("logger",{value:l});let h=await m.run(p);if(u.finished=!0,u.timeout=!!(null==h?void 0:h.timeout),!(null==h?void 0:h.success)){let e=null==h?void 0:h.error,t=(null==h?void 0:h.timeout)?"Execution timed out":v((null==e?void 0:e.message)||e||"Unknown error"),l=e instanceof SyntaxError||/^SyntaxError\b/i.test(String((null==e?void 0:e.name)||""));i.push({type:"runtime",ruleId:(null==h?void 0:h.timeout)?"timeout":l?"preview-start-failed":"runtime-error",message:t,stack:M(e)})}}catch(e){u.finished=!0,u.timeout=!1,i.push({type:"runtime",ruleId:"internal",message:`Preview internal failure: ${v((null==e?void 0:e.message)||e)}`,stack:M(e)})}finally{let e=Math.max(0,("u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now())-d);u.durationMs=Number.isFinite(e)?e:void 0}return{issues:k(i),logs:n,execution:u}}function N(e){let t=new s.FlowContext;if(t.addDelegate(e),"u">typeof document&&"function"==typeof document.createElement&&!e.element)try{let e=document.createElement("div");t.defineProperty("element",{value:e})}catch(e){}return t}async function O(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=N(t),n=await Y(e,o,l),i=0===n.issues.length,r=E(n);return{success:i,message:r.length>u?L(r,u):r}}},4e3(e,t,l){l.d(t,{cd:()=>f,tS:()=>d,kB:()=>u,Ot:()=>h,Wm:()=>U});var o=l(504),n=l(3526);let i=new Set(["date","dateOnly","datetime","datetimeNoTz","createdAt","updatedAt","unixTimestamp"]),r=new Set(["datetime","createdAt","updatedAt","unixTimestamp"]),a="YYYY-MM-DD",s="YYYY-MM-DD HH:mm:ss",d={picker:"date",showTime:!1,timeFormat:"HH:mm:ss",format:a,exactNormalizeMode:"none"};function u(e){return"string"==typeof(null==e?void 0:e.interface)?e.interface:""}function c(e){var t;let l="function"==typeof(null==e?void 0:e.getComponentProps)?e.getComponentProps():void 0;if(l&&"object"==typeof l&&!Array.isArray(l))return l;let o=null==e||null==(t=e.uiSchema)?void 0:t["x-component-props"];return o&&"object"==typeof o&&!Array.isArray(o)?o:{}}function p(e){return"year"===e||"quarter"===e||"month"===e||"date"===e?e:"date"}function m(e,t){return"date"===e||"dateOnly"===e||(null==t?void 0:t.type)==="dateOnly"?"date":"datetimeNoTz"===e?"datetimeNoTz":r.has(e)?"iso":"none"}function h(e,t,l){let o=u(e)||l||"";return!!i.has(o)||(null==e?void 0:e.type)==="dateOnly"||"createdAt"===t||"updatedAt"===t}function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u(e),l=c(e),o=p(l.picker),n="date"===t||"dateOnly"===t||(null==e?void 0:e.type)==="dateOnly",i=["datetime","datetimeNoTz","createdAt","updatedAt","unixTimestamp"].includes(t),r=!n&&("boolean"==typeof l.showTime?l.showTime:i),s="string"==typeof l.format?l.format:"",d="string"==typeof l.dateFormat&&l.dateFormat?l.dateFormat:s.split(" ")[0]||a,h="string"==typeof l.timeFormat&&l.timeFormat?l.timeFormat:"HH:mm:ss",f=n?d:s||(r?`${d} ${h}`:d);return{picker:o,showTime:r,timeFormat:h,format:f,exactNormalizeMode:m(t,e)}}function g(e,t){let l=String(e||"").trim();if(!l)return null;if(/(?:Z|[+-]\d{2}:\d{2})$/i.test(l)){let e=(0,n.dayjs)(l);if(e.isValid())return e}if(t){let e=(0,n.dayjs)(l,t,!0);if(e.isValid())return e}let o=(0,n.dayjs)(l);if(o.isValid())return o;if(t){let e=(0,n.dayjs)(l,t);if(e.isValid())return e}return null}function v(e,t){if(n.dayjs.isDayjs(e))return e;if(e instanceof Date){let t=(0,n.dayjs)(e);return t.isValid()?t:null}return"string"==typeof e?g(e,t):null}function y(e,t){let l=v(e,t.format);if(!(null==l?void 0:l.isValid()))return e;switch(t.exactNormalizeMode){case"date":return l.format(a);case"datetimeNoTz":return l.format(t.showTime?s:a);case"iso":return l.toISOString();default:return e}}function _(e,t){return"none"===t.exactNormalizeMode?e:"string"==typeof e||n.dayjs.isDayjs(e)||e instanceof Date?y(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e||n.dayjs.isDayjs(e)||e instanceof Date?y(e,t):e):e}function b(e,t){if(t.isRange){if(!Array.isArray(e))return null;let l=v(e[0],t.format),o=v(e[1],t.format);return l&&o?[l,o]:null}return v(e,t.format)}var x=l(1178),M=l(2793),w=l(1649),S=l(6305);let k=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e;function F(e,t){return t?Array.isArray(e)?e[0]:void 0:e}function C(e,t){return"string"==typeof e?(0,S.Pn)(e,t):t}function A(e,t){let l=String(e||"").trim();if(!l)return null;if(/(?:Z|[+-]\d{2}:\d{2})$/i.test(l)){let e=(0,n.dayjs)(l);if(e.isValid())return e}if(t){let e=(0,n.dayjs)(l,t,!0);if(e.isValid())return e}let o=(0,n.dayjs)(l);if(o.isValid())return o;if(t){let e=(0,n.dayjs)(l,t);if(e.isValid())return e}return null}function P(e,t){if(n.dayjs.isDayjs(e))return e;if(e instanceof Date){let t=(0,n.dayjs)(e);return t.isValid()?t:null}return"string"==typeof e?A(e,t):null}function T(e,t){if(!Array.isArray(e))return null;let l=P(e[0],t),o=P(e[1],t);return l&&o?[l,o]:null}let j=e=>{let{picker:t="date",format:l,showTime:i,timeFormat:r,value:a,isRange:s=!1,onChange:d,style:u,disabled:c}=e,p=(0,o.useFlowContext)(),m=p.model.translate.bind(p.model),h=(0,w.useMemo)(()=>F(a,s),[s,a]),[f,g]=(0,w.useState)(()=>C(h,t)),v=(0,w.useCallback)(e=>{let o=e===t&&l?l:(0,n.getPickerFormat)(e),a="date"===e?k(o):o;return(0,n.getDateTimeFormat)(e,a,i,r)},[l,t,i,r]),y=(0,w.useMemo)(()=>v(f),[v,f]),_=(0,w.useMemo)(()=>s?null:P(a,y),[s,a,y]),b=(0,w.useMemo)(()=>s?T(a,y):null,[s,a,y]),S=(0,w.useMemo)(()=>[{label:m("Date"),value:"date"},{label:m("Month"),value:"month"},{label:m("Quarter"),value:"quarter"},{label:m("Year"),value:"year"}],[m]),A=e=>{if(!c&&(g(e),d)){if(s){b&&d(b);return}_&&d(_)}},j={utc:!0,underFilter:!0,format:y,picker:f,inputReadOnly:p.isMobileLayout,showTime:!!i&&{defaultValue:(0,n.dayjs)("00:00:00","HH:mm:ss")},value:_,disabled:c,onChange:e=>{if(!c){if(e&&n.dayjs.isDayjs(e)){null==d||d(e);return}null==d||d(null)}},style:{flex:1}},I={utc:!0,underFilter:!0,format:y,picker:f,inputReadOnly:p.isMobileLayout,showTime:!!i&&{defaultValue:[(0,n.dayjs)("00:00:00","HH:mm:ss"),(0,n.dayjs)("23:59:59","HH:mm:ss")]},value:b,disabled:c,onChange:e=>{if(!c){if(Array.isArray(e)&&e[0]&&e[1]){null==d||d([e[0],e[1]]);return}null==d||d(null)}},style:{flex:1}};return(0,x.jsxs)(M.Space.Compact,{style:{width:"100%",...u||{}},children:[(0,x.jsx)(M.Select,{style:{width:100},popupMatchSelectWidth:!1,value:f,options:S,onChange:A,disabled:c}),s?(0,x.jsx)(M.DatePicker.RangePicker,{...I}):(0,x.jsx)(M.DatePicker,{...j})]})},I=["YYYY-MM-DD","YYYY-MM-DD HH:mm:ss","YYYY/MM/DD","MM/DD/YYYY","DD/MM/YYYY","YYYYMMDD"].map(e=>({value:e})),L={now:"Now",today:"Today",yesterday:"Yesterday",tomorrow:"Tomorrow",thisWeek:"This Week",lastWeek:"Last Week",nextWeek:"Next Week",thisMonth:"This Month",lastMonth:"Last Month",nextMonth:"Next Month",thisQuarter:"This Quarter",lastQuarter:"Last Quarter",nextQuarter:"Next Quarter",thisYear:"This Year",lastYear:"Last Year",nextYear:"Next Year"};function R(e){return"preset"===e.kind&&"now"===e.preset?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD"}function D(e,t){let l=e=>t?e.toISOString():e.format("YYYY-MM-DD");return Array.isArray(e)?[l(e[0]),l(e[1])]:e?l(e):""}let E=e=>{let{value:t,placeholder:l,onChange:n,disabled:i}=e,r=(0,o.useFlowContext)();return(0,x.jsxs)(M.Space.Compact,{style:{width:"100%"},children:[(0,x.jsx)(M.Input,{value:r.t("Format"),readOnly:!0,disabled:i,tabIndex:-1,"aria-hidden":!0,style:{width:88,pointerEvents:"none"}}),(0,x.jsx)(M.AutoComplete,{value:t,placeholder:l,options:I,onChange:e=>n(e.slice(0,128)),disabled:i,style:{flex:1,minWidth:0},"aria-label":r.t("Format")})]})},Y=e=>{let{value:t,onChange:l,isDateLikeField:n,dateComponentProps:i,style:r,disabled:a=!1}=e,s=(0,o.useFlowContext)();if(!t)return null;let d=e=>null==l?void 0:l({...t,format:e}),u=t.format||"",c=()=>{if("exact"===t.kind){let e=Array.isArray(t.value);return(0,x.jsx)(j,{picker:i.picker,showTime:i.showTime,timeFormat:i.timeFormat,format:i.format,isRange:e,value:b(t.value,{format:i.format,isRange:e}),onChange:e=>{null==l||l({...t,value:D(e,i.showTime)})},disabled:a,style:{width:"100%"}})}return"relative"===t.kind?(0,x.jsxs)(M.Space.Compact,{style:{width:"100%"},children:[(0,x.jsx)(M.InputNumber,{min:1,precision:0,value:t.amount,disabled:a,onChange:e=>null==l?void 0:l({...t,amount:"number"==typeof e?e:1}),"aria-label":s.t("past"===t.direction?"Past":"Next"),style:{flex:"1 1 auto",minWidth:80}}),(0,x.jsx)(M.Select,{value:t.unit,disabled:a,onChange:e=>null==l?void 0:l({...t,unit:e}),"aria-label":s.t("Unit"),style:{flex:"0 0 130px",minWidth:130},options:[{value:"day",label:s.t("Day")},{value:"week",label:s.t("Calendar week")},{value:"month",label:s.t("Calendar Month")},{value:"year",label:s.t("Calendar Year")}]})]}):(0,x.jsx)(M.Input,{value:s.t(L[t.preset]||t.preset),readOnly:!0,disabled:a})};return(0,x.jsxs)("div",{style:{display:"flex",flex:1,flexDirection:"column",gap:8,width:"100%",minWidth:0,...r},children:[c(),!n&&(0,x.jsx)(E,{value:u,placeholder:R(t),onChange:d,disabled:a})]})},N=[{name:"now",title:"Now"},{name:"today",title:"Today"},{name:"yesterday",title:"Yesterday"},{name:"tomorrow",title:"Tomorrow"},{name:"thisWeek",title:"This Week"},{name:"lastWeek",title:"Last Week"},{name:"nextWeek",title:"Next Week"},{name:"thisMonth",title:"This Month"},{name:"lastMonth",title:"Last Month"},{name:"nextMonth",title:"Next Month"},{name:"thisQuarter",title:"This Quarter"},{name:"lastQuarter",title:"Last Quarter"},{name:"nextQuarter",title:"Next Quarter"},{name:"thisYear",title:"This Year"},{name:"lastYear",title:"Last Year"},{name:"nextYear",title:"Next Year"}],O=Symbol("field-value-date-variable-config");function B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"editable";return{...e,[O]:t}}function V(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;let t=e[O];return"editable"===t||"restored"===t}function H(e){return"exact"===e.kind?"exact":"relative"===e.kind?e.direction:e.preset}function q(e){return n.dayjs.isDayjs(e)}function $(e,t,l){let o;if("exact"===e){let e=_((0,n.dayjs)(),l);o={kind:"exact",value:q(e)?e.format("YYYY-MM-DD"):String(e||"")}}else"past"===e||"next"===e?o={kind:"relative",direction:e,amount:1,unit:"day"}:N.some(t=>t.name===e)&&("now"!==e||"date"!==l.exactNormalizeMode)&&(o={kind:"preset",preset:e});if(o)return B(t?o:{...o,format:R(o)})}function z(e,t,l){let o="string"==typeof e.format?e.format:"",n=l?{...e,format:void 0}:{...e,format:o.trim()?o:R(e)};if("exact"!==n.kind)return n;let i=_(n.value,t);return Array.isArray(i)?{...n,value:[String(i[0]),String(i[1])]}:{...n,value:String(i||"")}}let U=e=>{let{value:t,onChange:l,baseMetaTree:n,constantComponent:i,nullComponent:r,runJSComponent:a,isDateLikeField:s,dateComponentProps:d,allowRunJS:u=!0,allowDateVariables:c=!0,converters:p,clearValue:m="",disabled:h=!1,...f}=e,g=w.default.useMemo(()=>e=>(0,x.jsx)(Y,{value:V(e.value)?e.value:void 0,onChange:t=>{var l;return null==(l=e.onChange)?void 0:l.call(e,B(t))},isDateLikeField:s,dateComponentProps:d,style:e.style,disabled:e.disabled}),[d,s]),v=c?(0,o.parseCtxDateExpressionConfig)(t):void 0,y="date"===d.exactNormalizeMode&&(null==v?void 0:v.kind)==="preset"&&"now"===v.preset,_=w.default.useMemo(()=>async()=>{let e="function"==typeof n?await n():n,t="date"!==d.exactNormalizeMode||y?N:N.filter(e=>"now"!==e.name),l=[{title:(0,o.tExpr)("Exact day"),name:"exact",type:"date",paths:["date","exact"],render:e=>(0,x.jsx)(g,{...e})},{title:(0,o.tExpr)("Past"),name:"past",type:"date",paths:["date","past"],render:e=>(0,x.jsx)(g,{...e})},{title:(0,o.tExpr)("Next"),name:"next",type:"date",paths:["date","next"],render:e=>(0,x.jsx)(g,{...e})},...t.map(e=>{let{name:t,title:l}=e;return{title:(0,o.tExpr)(l),name:t,type:"date",paths:["date",t],..."now"===t&&"date"===d.exactNormalizeMode?{disabled:!0,selectable:!1}:{},render:e=>(0,x.jsx)(g,{...e})}})];return[{title:(0,o.tExpr)("Constant"),name:"constant",type:"string",paths:["constant"],render:e=>(0,x.jsx)(i,{...e})},{title:(0,o.tExpr)("Null"),name:"null",type:"object",paths:["null"],render:e=>(0,x.jsx)(r,{...e})},...c?[{title:(0,o.tExpr)("Date"),name:"date",type:"date",paths:["date"],selectable:!1,children:l}]:[],...u?[{title:(0,o.tExpr)("RunJS"),name:"runjs",type:"object",paths:["runjs"],render:e=>(0,x.jsx)(a,{...e})}]:[],...Array.isArray(e)?e:[]]},[i,g,r,a,c,u,n,d.exactNormalizeMode,y]),b=v?B(v,"restored"):t,M=w.default.useCallback(e=>{if(h)return;if(!V(e))return void l(e);if("restored"===e[O])return;let t=z(e,d,s);l((0,o.serializeCtxDateExpressionConfig)(t)||"")},[d,h,s,l]);return(0,x.jsx)(o.VariableInput,{...f,value:b,onChange:M,metaTree:_,clearValue:m,disabled:h,converters:{renderInputComponent:e=>{var t,l;let o=null==p||null==(t=p.renderInputComponent)?void 0:t.call(p,e??null);if(o)return o;let n=null==e||null==(l=e.paths)?void 0:l[0];return"constant"===n?i:"null"===n?r:c&&"date"===n?g:u&&"runjs"===n?a:null},resolveValueFromPath:e=>{var t,l;let o=null==p||null==(t=p.resolveValueFromPath)?void 0:t.call(p,e);if(void 0!==o)return o;let n=null==e||null==(l=e.paths)?void 0:l[0];return"constant"===n?"":"null"===n?null:c&&"date"===n?$(e.paths[1],s,d):u&&"runjs"===n?{code:"",version:"v2"}:void 0},resolvePathFromValue:e=>{var t;let l=null==p||null==(t=p.resolvePathFromValue)?void 0:t.call(p,e);return void 0!==l?l:null===e?["null"]:u&&(0,o.isRunJSValue)(e)?["runjs"]:c&&V(e)?["date",H(e)]:"string"==typeof e&&(0,o.isVariableExpression)(e)?(0,o.parseValueToPath)(e):["constant"]}}})}},8442(e,t,l){l.d(t,{a:()=>r});var o=l(1178),n=l(2793);l(1649);var i=l(5886);let r=(0,l(504).observer)(e=>{var t;let{value:l,FilterItem:r,ctx:a}=e;l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let s=()=>{var e;(null==a||null==(e=a.model)?void 0:e.dispatchEvent)&&a.model.dispatchEvent("reset")},d=()=>{var e;(null==a||null==(e=a.model)?void 0:e.dispatchEvent)&&a.model.dispatchEvent("submit")},u=(null==a||null==(t=a.model)?void 0:t.translate)||(e=>e);return(0,o.jsxs)("form",{onSubmit:e=>{e.preventDefault(),d()},children:[(0,o.jsx)(i.I,{value:l,FilterItem:r}),(0,o.jsxs)(n.Space,{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:[(0,o.jsx)(n.Button,{htmlType:"button",onClick:s,children:u("Reset")}),(0,o.jsx)(n.Button,{type:"primary",htmlType:"submit",children:u("Submit")})]})]})},{displayName:"FilterContent"})},5886(e,t,l){l.d(t,{I:()=>c});var o=l(1178),n=l(2113),i=l(2793),r=l(7843);l(1649);var a=l(504);let s=new WeakMap,d=0,u=e=>{let t=s.get(e);return t||(d+=1,t=`filter-item-${d}`,s.set(e,t)),t},c=(0,a.observer)(e=>{let{token:t}=i.theme.useToken(),{value:l={logic:"$and",items:[]},FilterItem:a,disabled:s=!1,showBorder:d=!1,onRemove:p,onChange:m,closeIcon:h=(0,o.jsx)(n.CloseCircleOutlined,{style:{color:t.colorIcon}})}=e,{t:f}=(0,r.useTranslation)();l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let{logic:g,items:v}=l,y=d?{position:"relative",border:`1px dashed ${t.colorBorder}`,padding:t.paddingSM,marginBottom:t.marginXS,borderRadius:t.borderRadius}:{position:"relative",marginBottom:t.marginXS},_=e=>{s||(l.logic=e,null==m||m(l))},b=()=>{s||(v.push({path:"",operator:"",value:""}),null==m||m(l))},x=()=>{s||(v.push({logic:"$and",items:[]}),null==m||m(l))},M=e=>{s||(v.splice(e,1),null==m||m(l))},w=e=>"path"in e||"operator"in e||"value"in e,S=e=>"logic"in e&&"items"in e;return(0,o.jsxs)("div",{style:y,children:[d&&p&&(0,o.jsx)("button",{type:"button","aria-label":"icon-close",disabled:s,style:{position:"absolute",right:10,top:10,cursor:s?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:p,children:h}),(0,o.jsx)("div",{style:{marginBottom:8,color:t.colorText},children:(0,o.jsxs)("span",{children:[f("Meet")," ",(0,o.jsxs)(i.Select,{"data-testid":"filter-select-all-or-any",style:{width:"auto"},value:g,disabled:s,onChange:_,children:[(0,o.jsx)(i.Select.Option,{value:"$and",children:f("All")}),(0,o.jsx)(i.Select.Option,{value:"$or",children:f("Any")})]})," ",f("conditions in the group")]})}),(0,o.jsx)("div",{children:v.map((e,n)=>S(e)?(0,o.jsx)(c,{value:e,FilterItem:a,disabled:s,showBorder:!0,onRemove:()=>M(n),onChange:e=>{v[n]=e,null==m||m(l)}},u(e)):w(e)?a?(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsx)(a,{value:e}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",disabled:s,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:s?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>M(n),children:h})]})},u(e)):(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsxs)("span",{children:[e.path," ",e.operator," ",String(e.value)]}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",disabled:s,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:s?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>M(n),children:h})]})},u(e)):(0,o.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,o.jsxs)(i.Space,{style:{flex:1,minWidth:0},children:[(0,o.jsx)("span",{style:{color:t.colorTextTertiary},children:"Invalid filter item"}),(0,o.jsx)("button",{type:"button","aria-label":"icon-close",disabled:s,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:s?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>M(n),children:h})]})},u(e)))}),(0,o.jsxs)(i.Space,{size:16,style:{marginTop:8,marginBottom:8},children:[(0,o.jsx)(i.Button,{style:{padding:0},type:"link",size:"small",icon:(0,o.jsx)(n.PlusOutlined,{}),onClick:b,disabled:s,children:f("Add condition")}),(0,o.jsx)(i.Button,{style:{padding:0},type:"link",size:"small",icon:(0,o.jsx)(n.PlusOutlined,{}),onClick:x,disabled:s,children:f("Add condition group")})]})]})},{displayName:"FilterGroup"})},937(e,t,l){l.d(t,{H:()=>o});let o=(e,t,l,o)=>e.map(e=>n(e,t,l,o)).filter(Boolean),n=(e,t,l,n)=>{var i;if(l.length&&1===t&&l.includes(e.name)||!e.interface||!1===e.filterable)return;let r=e.getInterfaceOptions();if(!(null==r?void 0:r.filterable))return;let{nested:a,children:s,operators:d}=r.filterable,u={name:e.name,type:e.type,target:e.target,title:n(e.title),schema:null==e?void 0:e.uiSchema,operators:((null==d||null==(i=d.filter)?void 0:i.call(d,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[]).map(e=>({...e,label:n(e.label)}))};if(!e.target||!(t>2)){if(t>2)return u;if((null==s?void 0:s.length)&&(u.children=s),a){let i=[];try{i=e.getFields().filter(e=>"attachments"!==e.target&&"formula"!==e.interface)}catch{i=[]}let r=o(i,t+1,l,n).filter(Boolean);u.children=u.children||[],u.children.push(...r)}return u}}},9078(e,t,l){l.d(t,{Ru:()=>Y,I8:()=>n.I,qi:()=>u,oJ:()=>o.a,Et:()=>F,uw:()=>N.u});var o=l(8442),n=l(5886),i=l(1178),r=l(504),a=l(2793),s=l(1649),d=l(937);let u=(0,r.observer)(e=>{var t;let{path:l,operator:o,value:n}=e.value,r=e.model,u=(null==(t=r.context.blockModel.collection)?void 0:t.getFields().filter(e=>"attachments"!==e.target))||[],p=c(r.props.filterableFieldNames||[],u.map(e=>e.name)),m=r.translate,h=(0,d.H)(u.filter(e=>"attachments"!==e.target&&"formula"!==e.interface&&!["belongsTo","belongsToMany","hasOne","hasMany","oho","obo","m2o","o2m","m2m"].includes(e.type)),1,e.noIgnore?[]:p,m).filter(Boolean),f=(0,s.useMemo)(()=>{let e=h.find(e=>e.name===l);return(null==e?void 0:e.operators)||[]},[h,l]),g=t=>{var l;e.value.path=t;let o=h.find(e=>e.name===t);(null==o||null==(l=o.operators)?void 0:l.length)>0?e.value.operator=o.operators[0].value:e.value.operator="",e.value.value=""},v=t=>{e.value.operator=t},y=t=>{e.value.value=t.target.value};return(0,i.jsxs)(a.Space,{children:[(0,i.jsx)(a.Select,{style:{width:200},placeholder:m("Select field"),value:l||void 0,onChange:g,children:h.map(e=>(0,i.jsx)(a.Select.Option,{value:e.name,children:e.title},e.name))}),(0,i.jsx)(a.Select,{style:{width:120},placeholder:m("Select operator"),value:o||void 0,onChange:v,disabled:!l||0===f.length,children:f.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),(0,i.jsx)(a.Input,{style:{width:200},placeholder:m("Enter value"),value:n,onChange:y})]})},{displayName:"FilterItem"});function c(e,t){return null==t?void 0:t.filter(t=>!e.includes(t))}var p=l(6305),m=l(7583),h=l(6220),f=l(7309),g=l(7720),v=l(9210);let{DateFilterDynamicComponent:y}=(0,p.RZ)(()=>Promise.resolve().then(l.bind(l,6832)),"DateFilterDynamicComponent"),_=new Set(["Input","Input.URL","NanoIDInput","DatePicker"]);async function b(e){var t,l,o,n;let i=async e=>Array.isArray(e)?e:"function"==typeof e?await e():[];if(null==(l=e.getPropertyOptions)||null==(t=l.call(e,"collection"))?void 0:t.meta){let t=null==(n=e.getPropertyMetaTree)?void 0:n.call(e,"{{ ctx.collection }}");return await i(t)}let a=()=>(null==e?void 0:e.collection)??null,s=await (0,r.createEphemeralContext)(e,{defineProperties:{collection:{get:a,meta:(0,r.createCollectionContextMeta)(a,"Current collection")}}}),d=null==(o=s.getPropertyMetaTree)?void 0:o.call(s,"{{ ctx.collection }}");return await i(d)}function x(e,t){if(!e||!t.length)return null;let l="collection"===t[0]?t.slice(1):t;if(!l.length)return null;let o=[],n=e,i=null;for(let e of l){var r,a,s,d,u;let t=(null==n||null==(r=n.getField)?void 0:r.call(n,e))??(null==n||null==(d=n.getFields)||null==(s=d.call(n))||null==(a=s.find)?void 0:a.call(s,t=>(null==t?void 0:t.name)===e));if(!t)return null;let c=t.title||(null==(u=t.uiSchema)?void 0:u.title)||t.name||e;i={name:t.name||e,title:c,type:t.type,interface:t.interface,uiSchema:t.uiSchema,options:t.options,paths:["collection",...l.slice(0,o.length+1)],parentTitles:[...o]},t.targetCollection?(o.push(c),n=t.targetCollection):n=null}return i}function M(e,t){return"number"!=typeof t?e:(0,v.W)(e,{maxAssociationDepth:t})}function w(e,t,l,o){var n;let r=null==e?void 0:e["x-component"],s=(null==t||null==(n=t.uiSchema)?void 0:n["x-component-props"])||{},d=(null==e?void 0:e["x-component-props"])||{},u=(0,__rspack_external_lodash_merge_8f812c65.default)({},s,d),c=(0,f.di)(null==e?void 0:e.enum,l)||[],p={style:{width:200,...(null==u?void 0:u.style)||{}},placeholder:(null==u?void 0:u.placeholder)||l("Enter value"),...u},m=e=>{if("number"==typeof e||(null==u?void 0:u.stringMode)===!0&&"string"==typeof e)return e};return e=>{let{value:t,onChange:l,...n}=e||{};if("InputNumber"===r)return(0,i.jsx)(a.InputNumber,{...p,...n,value:m(t),onChange:e=>null==l?void 0:l(e)});if("NumberPicker"===r)return(0,i.jsx)(h.NumberPicker,{...p,...n,value:m(t),onChange:e=>null==l?void 0:l(e)});if("Switch"===r)return(0,i.jsx)(a.Switch,{...p,...n,checked:!!t,onChange:e=>null==l?void 0:l(e)});if("Select"===r)return(0,i.jsx)(a.Select,{options:c,...p,...n,value:(0,f.xO)(t,p),onChange:e=>null==l?void 0:l(e)});if("Checkbox"===r)return(0,i.jsx)(a.Checkbox,{...p,...n,checked:!!t,onChange:e=>null==l?void 0:l(e.target.checked)});if("Checkbox.Group"===r)return(0,i.jsx)(a.Checkbox.Group,{...p,...n,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Radio.Group"===r)return(0,i.jsx)(a.Radio.Group,{...p,...n,value:Array.isArray(t)||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:void 0,onChange:e=>null==l?void 0:l(e.target.value)});if("Cascader"===r)return(0,i.jsx)(a.Cascader,{...p,...n,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Input.TextArea"===r||"TextArea"===r)return(0,i.jsx)(a.Input.TextArea,{...p,...n,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)});if("DateFilterDynamicComponent"===r)return(0,i.jsx)(y,{...p,...n,value:t,onChange:e=>null==l?void 0:l(e)});if(r&&(null==o?void 0:o.getComponent)){let e=o.getComponent(r,!_.has(r));if(e)return(0,i.jsx)(e,{...p,...n,value:t,onChange:e=>null==l?void 0:l(e),style:{width:200,...p.style||{},...null==n?void 0:n.style}})}return(0,i.jsx)(a.Input,{...p,...n,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)})}}function S(e){if(e&&"object"==typeof e){let l=e;if("function"==typeof l.preventDefault||l.nativeEvent||"target"in l){var t;let o=null==(t=l.target)?void 0:t.value;return void 0!==o?o:e}}return e}function k(e,t){if(!Array.isArray(e)||!t.length)return null;let l=(e,t)=>{if(!t.length)return null;let[o,...n]=t,i=e.find(e=>String(e.name)===String(o));return i?n.length?Array.isArray(i.children)?l(i.children,n):null:i:null},o=l(e,t);return o||(new Set(e.map(e=>String(e.name))).has(String(t[0]))?null:l(e,t.slice(1)))}let F=(0,r.observer)(e=>{let{value:t,model:l,disabled:o=!1,rightAsVariable:n,rightMetaTree:d,rightVariableConverters:u,ignoreFieldNames:c,maxAssociationFieldDepth:h,rightMaxAssociationFieldDepth:v=h}=e,y=(0,r.useFlowViewContext)(),F=l.translate,{path:C,operator:A,value:P}=t,[T,j]=(0,s.useState)(null),I=(0,s.useCallback)(e=>{var t;return(0,p.w6)(e,l.context.dataSourceManager,null==(t=l.context.app)?void 0:t.dataSourceManager)},[l]),L=(0,s.useMemo)(()=>{var e,t;if(!T)return[];let l=T.interface?I(T.interface):void 0,o=null==T||null==(e=T.uiSchema)?void 0:e["x-filter-operators"];return((Array.isArray(o)&&o.length?o:null==l||null==(t=l.filterable)?void 0:t.operators)||[]).filter(e=>!e.visible||e.visible(T))},[I,T]);(0,s.useEffect)(()=>{if(!L.length)return;let e=m.default.find(L,e=>e.value===t.operator);if(e)t.noValue=!!e.noValue;else{let e=L[0];t.operator=e.value,t.value=!!e.noValue||void 0,t.noValue=!!e.noValue}},[L,t]);let R=(0,s.useMemo)(()=>L.map(e=>({value:e.value,label:"string"==typeof e.label?F(e.label):e.label})),[L,F]),D=(0,s.useCallback)((e,l)=>{if(o)return;let n=t.path||"",i=e||"",r=i!==n;t.path=i,r&&n&&(t.operator="",t.value=void 0,t.noValue=!1),l&&j(l)},[o,t]),E=(0,s.useMemo)(()=>({resolveValueFromPath:e=>(j(e),(null==e?void 0:e.paths.slice(1).join("."))||null),resolvePathFromValue(e){if(null==e)return;let t=String(e).trim();if(t)return["collection",...t.split(".")]}}),[]),Y=(0,s.useCallback)(e=>{if(o)return;t.operator=e;let l=L.find(t=>t.value===e);(null==l?void 0:l.noValue)?(t.value=!0,t.noValue=!0):(t.value=void 0,t.noValue=!1)},[o,L,t]),N=(0,s.useMemo)(()=>L.find(e=>e.value===A),[L,A]),O=(0,s.useCallback)(e=>{var t,l;return(null==e||null==(t=e.options)?void 0:t.dataType)||(null==e?void 0:e.dataType)||(null==e?void 0:e.type)||(null==e||null==(l=e.uiSchema)?void 0:l.type)||"double"},[]),B=(0,s.useCallback)(e=>{switch(e){case"boolean":return"Switch";case"date":return"DateFilterDynamicComponent";case"integer":case"bigInt":case"double":case"decimal":case"number":return"InputNumber";default:return"Input"}},[]),V=(0,s.useMemo)(()=>{let e=(null==T?void 0:T.uiSchema)||{},t=(null==N?void 0:N.schema)||{},l=(0,__rspack_external_lodash_merge_8f812c65.default)({},e,t);if((null==T?void 0:T.interface)==="formula"){let e={"x-read-pretty":!1,"x-component":B(O(T)),"x-component-props":{...l["x-component-props"]}};return(0,__rspack_external_lodash_merge_8f812c65.default)({},l,e)}return l},[T,N,B,O]),H=s.default.useRef(null==V?void 0:V["x-component"]),q=null==V?void 0:V["x-component"],$=(0,s.useMemo)(()=>{let e=H.current;H.current=q;let l=void 0!==e&&e!==q;if(null==N?void 0:N.noValue)return P;if(l&&null!=P){t.value=void 0;return}return P},[q,P,t,N]),z=(0,s.useCallback)(e=>{o||(t.value=S(e))},[o,t]),U=s.default.useRef(F);s.default.useEffect(()=>{U.current=F},[F]);let K=s.default.useCallback(e=>{var t;return(null==(t=U.current)?void 0:t.call(U,e))??e},[]),G=(0,s.useMemo)(()=>(0,f.di)(null==V?void 0:V.enum,K)||[],[V,K]),W=(0,s.useMemo)(()=>w(V,T,K,l.context.app),[V,T,K,l.context.app]),J=(0,s.useCallback)(()=>{var e;let t="$in"===A||"$notIn"===A,n=null==N||null==(e=N.schema)?void 0:e["x-component"],r="Select"===n||"string"==typeof n&&_.has(n),a=t?(0,g._H)(l.context.app,A,L,!r):null;if(a&&t){let{Comp:e,props:t}=a,l={...t},n=Array.isArray(l.options)?l.options:void 0;(!n||0===n.length)&&(null==G?void 0:G.length)&&(l.options=G);let r={flex:"1 1 40%",minWidth:160,maxWidth:"100%",...(0,g.VS)(l.style)},s=Array.isArray($)&&$.every(e=>"string"==typeof e||"number"==typeof e)?$:"string"==typeof $?$.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)("div",{style:r,children:(0,i.jsx)(e,{...l,style:{width:"100%",...(0,g.VS)(l.style)},value:s,disabled:o,onChange:e=>z(e)})})}let s=W;return(0,i.jsx)("div",{style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},children:(0,i.jsx)(s,{value:$,onChange:e=>z(e),disabled:o})})},[o,A,L,N,$,W,l.context.app,z,G]),X=(0,s.useMemo)(()=>function(){return(0,i.jsx)(a.Input,{placeholder:`<${F("Null")}>`,readOnly:!0})},[F]),Q=(0,s.useMemo)(()=>async()=>{let e="function"==typeof d?await d():d??y.getPropertyMetaTree(),t=Array.isArray(e)?e:await e();return M([{title:F("Constant"),name:"constant",type:"string",paths:["constant"],render:W},{title:F("Null"),name:"null",type:"object",paths:["null"],render:X},...t],v)},[d,y,W,X,F,v]),Z=(0,s.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?W:"null"===l?X:null},resolveValueFromPath:e=>{var t,l;let o=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===o?"":"null"===o?null:null==u||null==(l=u.resolveValueFromPath)?void 0:l.call(u,e)},resolvePathFromValue:e=>{var t;if(null===e)return["null"];let l=(null==u||null==(t=u.resolvePathFromValue)?void 0:t.call(u,e))??("string"==typeof e?(0,r.parseValueToPath)(e):void 0);return l||["constant"]}}),[X,u,W]),ee=(0,s.useMemo)(()=>async()=>{let e=await b(l.context),t=async e=>{let t=e.interface?I(e.interface):void 0,o=[],n=null==t?void 0:t.filterable,i=null==n?void 0:n.children;if(Array.isArray(i)&&i.length)for(let t of i){var r,a,s;let n=t.title||t.name,i=(null==(r=l.context)?void 0:r.t)?l.context.t(n):n;o.push({name:t.name,title:i,type:(null==(a=t.schema)?void 0:a.type)||"string",interface:(null==(s=t.schema)?void 0:s["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]})}if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=[...Array.isArray(e)?e:[],...o];return m.default.uniqBy(l,"name")}}}let d=[...Array.isArray(e.children)?e.children:[],...o];return{...e,children:d.length?d:e.children}},o=[];for(let l of e)o.push(await t(l));return M(o,h)},[I,l,h]);return(0,s.useEffect)(()=>{if(T||!t.path)return;let e=!1;return(async()=>{let o=await ee();if(e)return;let n=E.resolvePathFromValue(t.path);if(!(null==n?void 0:n.length))return;let i=k(o,n)||x(l.context.collection,n);i&&j(i)})(),()=>{e=!0}},[E,ee,T,l.context.collection,t.path]),(0,i.jsxs)(a.Space,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(r.VariableInput,{value:C,metaTree:ee,onChange:D,converters:E,disabled:o,showValueComponent:!1,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},onlyLeafSelectable:!0,placeholder:F("Select field"),ignoreFieldNames:c}),(0,i.jsx)(a.Select,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:F("Comparison"),value:A||void 0,disabled:o,onChange:Y,children:R.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),!(null==N?void 0:N.noValue)&&(n?(0,i.jsx)(r.VariableInput,{value:$,onChange:e=>z(e),metaTree:Q,converters:Z,disabled:o,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:F("Enter value")}):J())]})});var C=l(8718);let{DateFilterDynamicComponent:A}=(0,p.RZ)(()=>Promise.resolve().then(l.bind(l,6832)),"DateFilterDynamicComponent");function P(e,t){return"number"!=typeof t?e:(0,v.W)(e,{maxAssociationDepth:t})}function T(e,t,l){var o,n,r;let s=null==e?void 0:e["x-component"],d=(null==t||null==(o=t.uiSchema)?void 0:o["x-component-props"])||{},u=(null==e?void 0:e["x-component-props"])||{},c=(0,__rspack_external_lodash_merge_8f812c65.default)({},d,u),p=Array.isArray(null==t||null==(n=t.uiSchema)?void 0:n.enum)?null==t||null==(r=t.uiSchema)?void 0:r.enum:void 0,m=(0,f.di)(p,l),g={style:{width:200,...(null==c?void 0:c.style)||{}},placeholder:(null==c?void 0:c.placeholder)||l("Enter value"),...c};return e=>{let{value:t,onChange:o,...n}=e||{};if("InputNumber"===s)return(0,i.jsx)(a.InputNumber,{...g,...n,value:t,onChange:o});if("NumberPicker"===s)return(0,i.jsx)(h.NumberPicker,{...g,...n,value:t,onChange:o});if("Switch"===s)return(0,i.jsx)(a.Switch,{...g,...n,checked:!!t,onChange:o});if("Select"===s){let e=g;return Array.isArray(null==e?void 0:e.options)&&e.options.length>0?e={...e,options:(0,f.ZY)(e.options,l)}:m&&(e={...e,options:m}),(0,i.jsx)(a.Select,{...e,...n,value:(0,f.xO)(t,e),onChange:o})}return"DateFilterDynamicComponent"===s?(0,i.jsx)(A,{...g,...n,value:t,onChange:o}):(0,i.jsx)(a.Input,{...g,...n,value:t,onChange:e=>{var t;return null==o?void 0:o(null==e||null==(t=e.target)?void 0:t.value)}})}}let j=[{value:"$includes",label:"contains",selected:!0},{value:"$notIncludes",label:"does not contain"},{value:"$eq",label:"is"},{value:"$ne",label:"is not"},{value:"$empty",label:"is empty",noValue:!0},{value:"$notEmpty",label:"is not empty",noValue:!0}],I=new Set(["$in","$notIn"]);function L(e,t){let l=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(!o.length)return l;let n=o.find(e=>(null==e?void 0:e.name)==="item");if(!n)return[...o,...l];let i=(0,C.mD)(l,[n]);return[...o.filter(e=>(null==e?void 0:e.name)!=="item"),...i]}function R(e,t){var l,o;return{name:t.name,title:t.title||t.name,type:(null==(l=t.schema)?void 0:l.type)||"string",interface:(null==(o=t.schema)?void 0:o["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]}}async function D(e,t){var l,o;let n=e.interface&&t?t(e.interface):void 0,i=(Array.isArray(null==n||null==(l=n.filterable)?void 0:l.children)?null==n||null==(o=n.filterable)?void 0:o.children:[]).map(t=>R(e,t)),r=async e=>{let l=[...await Promise.all(e.map(e=>D(e,t))),...i];return(0,__rspack_external_lodash_uniqBy_85106929.default)(l,e=>e.name)};if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=Array.isArray(e)?e:[];return await r(l)}}}return Array.isArray(e.children)?{...e,children:await r(e.children)}:i.length?{...e,children:i}:e}async function E(e,t){let l=Array.isArray(e)?e:[];return await Promise.all(l.map(e=>D(e,t)))}let Y=(0,r.observer)(e=>{var t;let{value:l,model:o,extraMetaTree:n,maxAssociationFieldDepth:d}=e,u=(0,r.useFlowViewContext)(),c=o.translate,{path:m,operator:h,value:v}=l||{},[y,_]=(0,s.useState)(null),b=(0,s.useRef)(!1),x=(0,s.useMemo)(()=>{if(y){var e,t,l;let n=y.interface?(0,p.w6)(y.interface,o.context.dataSourceManager,null==(e=o.context.app)?void 0:e.dataSourceManager):void 0,i=null==y||null==(t=y.uiSchema)?void 0:t["x-filter-operators"];return((Array.isArray(i)&&i.length?i:null==n||null==(l=n.filterable)?void 0:l.operators)||j).filter(e=>!e.visible||e.visible(y)).map(e=>({value:e.value,label:e.label,noValue:!!e.noValue,schema:e.schema,selected:!!e.selected}))}return[]},[y,o]),M=(0,s.useMemo)(()=>x.map(e=>({value:e.value,label:"string"==typeof e.label?c(e.label):e.label})),[x,c]);(0,s.useEffect)(()=>{if(0!==x.length){if(!h){if(b.current){let e=x.find(e=>e.selected)||x[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1,b.current=!1}return}if(!x.some(e=>e.value===h)){let e=x.find(e=>e.selected)||x[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1}}},[x,h,l]);let w=(0,s.useMemo)(()=>x.find(e=>e.value===h),[x,h]),S=(0,s.useMemo)(()=>{let e=(null==y?void 0:y.uiSchema)||{},t=(null==w?void 0:w.schema)||{};return(0,__rspack_external_lodash_merge_8f812c65.default)({},e,t)},[y,w]),k=(0,s.useRef)(c);(0,s.useEffect)(()=>{k.current=c},[c]);let F=(0,s.useCallback)(e=>{var t;return(null==(t=k.current)?void 0:t.call(k,e))??e},[]),C=(0,s.useMemo)(()=>T(S,y,F),[S,y,F]),A=(0,s.useMemo)(()=>(0,f.di)(null==S?void 0:S.enum,F)||[],[S,F]),R=(0,s.useMemo)(()=>{let e=(0,g._H)(o.context.app,h,x),t=I.has(h);if(!e||!t)return C;let{Comp:l,props:n}=e;return e=>{let{value:t,onChange:o,...r}=e||{},a={...n},s=Array.isArray(a.options)?a.options:void 0;(!s||0===s.length)&&A.length>0&&(a.options=A);let d=Array.isArray(t)?t:"string"==typeof t?t.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)(l,{...a,...r,value:d,onChange:o,style:{width:200,...(0,g.VS)(a.style),...(0,g.VS)(null==r?void 0:r.style)}})}},[A,o.context.app,x,h,C]),D=(0,s.useMemo)(()=>function(){return(0,i.jsx)(a.Input,{placeholder:`<${c("Null")}>`,readOnly:!0})},[c]),Y=(0,s.useMemo)(()=>async()=>{let e=L((null==o?void 0:o.context.getPropertyMetaTree())||u.getPropertyMetaTree(),n);return P([{title:c("Constant"),name:"constant",type:"string",paths:["constant"]},{title:c("Null"),name:"null",type:"object",paths:["null"]},...e],d)},[u,o,c,n,d]),N=(0,s.useCallback)(async()=>{var e,t;let l=(null==o||null==(t=o.context)||null==(e=t.getPropertyMetaTree)?void 0:e.call(t))||u.getPropertyMetaTree(),i=L(Array.isArray(l)?l:[],n),r=e=>{var t;return(0,p.w6)(e,o.context.dataSourceManager,null==(t=o.context.app)?void 0:t.dataSourceManager)};return P(await E(i,r),d)},[u,o,n,d]),O=(0,s.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?R:"null"===l?D:null},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:void 0},resolvePathFromValue:e=>{if(null===e)return["null"];let t=(0,r.parseValueToPath)(e);return t||["constant"]}}),[D,R]),B=(0,s.useCallback)((e,t)=>{let o=l.path||"",n=e||"",i=n!==o;l.path=n,i&&o&&(l.operator="",l.value="",b.current=!0),o||!n||l.operator||(b.current=!0),t&&_(t)},[l]),V=(0,s.useCallback)(e=>{let t=l.operator;l.operator=e;let o=x.find(t=>t.value===e);(null==o?void 0:o.noValue)?(l.value=!0,l.noValue=!0):(I.has(t)&&!I.has(e)&&Array.isArray(l.value)&&(l.value=l.value.join("\n")),l.noValue=!1)},[l,x]);return(0,i.jsxs)(a.Space,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(r.VariableInput,{value:m,onChange:B,metaTree:N,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:c("Select variable"),onlyLeafSelectable:!0}),(0,i.jsx)(a.Select,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:c("Comparison"),value:h||void 0,onChange:V,children:M.map(e=>(0,i.jsx)(a.Select.Option,{value:e.value,children:e.label},e.value))}),!(null==(t=x.find(e=>e.value===h))?void 0:t.noValue)&&(0,i.jsx)(r.VariableInput,{value:v,onChange:e=>l.value=e,metaTree:Y,converters:O,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:c("Enter value"),clearValue:""})]})});var N=l(8102)},9210(e,t,l){l.d(t,{W:()=>r});let o=new Set(["m2o","o2o","oho","obo","o2m","m2m","linkTo"]);function n(e){let t=(null==e?void 0:e.options)||{};return!!(t.target||t.targetCollection||t.foreignKey||t.through||o.has(String((null==e?void 0:e.interface)||"")))}function i(e,t,l){let o=n(e),i=t+ +!!o;if(o&&i>l)return null;let a=e=>Array.isArray(e)?r(e,{associationDepth:i,maxAssociationDepth:l}):async()=>{let t=await e();return r(Array.isArray(t)?t:[],{associationDepth:i,maxAssociationDepth:l})};return{...e,children:e.children?a(e.children):void 0}}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{associationDepth:l=0,maxAssociationDepth:o=2}=t;return Array.isArray(e)?e.map(e=>i(e,l,o)).filter(Boolean):[]}},8102(e,t,l){l.d(t,{u:()=>r});var o=l(1649),n=l(937);let i=e=>e;function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{filterableFieldNames:l,nonfilterableFieldNames:r,noIgnore:a=!1,t:s=i}=t,d=(0,o.useMemo)(()=>(null==e?void 0:e.getFields())||[],[e]),u=(0,o.useMemo)(()=>{let e=!a&&(null==l?void 0:l.length)?d.map(e=>e.name).filter(e=>!l.includes(e)):[],t=r??[];return t.length?Array.from(new Set([...e,...t])):e},[d,l,r,a]);return(0,o.useMemo)(()=>(0,n.H)(d.filter(e=>"attachments"!==e.target&&"formula"!==e.interface),1,u,s).filter(Boolean),[d,u,s])}},8563(e,t,l){l.d(t,{b2:()=>n.b,tn:()=>o.t,S5:()=>n.S});var o=l(8804);l(1178),l(8533),l(8198),l(504),l(1649),l(7326),l(5721);var n=l(5026);l(6193),l(4244)},1511(e,t,l){l.d(t,{Ak:()=>g,B3:()=>f,Lb:()=>v});var o=l(1178),n=l(504),i=l(1883),r=l(2793),a=l(7583),s=l(1649),d=l(7843),u=l(8804);function c(e){return"function"==typeof(null==e?void 0:e.getResourceSettingsInitParams)?e.getResourceSettingsInitParams():"function"==typeof(null==e?void 0:e.getStepParams)?e.getStepParams("resourceSettings","init"):void 0}function p(e,t){var l,o,n,i,r,a,s;let d=(null==e||null==(l=e.context)?void 0:l.blockModel)||e,u=c(d)||{},p=(null==d||null==(o=d.context)?void 0:o.collection)||(null==d?void 0:d.collection)||(null==e||null==(n=e.context)?void 0:n.collection),m=(null==p?void 0:p.dataSource)||(null==d||null==(i=d.context)?void 0:i.dataSource)||(null==d?void 0:d.dataSource)||(null==e?void 0:e.dataSource),h=(null==m?void 0:m.key)||(null==p?void 0:p.dataSourceKey)||u.dataSourceKey,f=(null==p?void 0:p.title)||(null==p?void 0:p.name)||(null==p?void 0:p.tableName)||(null==e||null==(r=e.resource)?void 0:r.resourceName)||(null==e||null==(s=e.resource)||null==(a=s.getResourceName)?void 0:a.call(s))||u.associationName||u.collectionName,g=m?t(m.displayName||m.key):h,v=f?`${t(f)||f}`:"",y=g?`${t(g)} > `:"",_=["loading-failed","reloading-failed"].includes(null==m?void 0:m.status);return{dataSourceName:g,nameValue:`${y}${v}`,isDataSourceLoadFailed:_,isDataSourceUnavailable:!!(h&&(!m||_))}}function m(e,t){return t?e('The data source "{{name}}" is temporarily unavailable. Please try again later or contact an administrator.',{name:t}):e("The data source is temporarily unavailable. Please try again later or contact an administrator.")}function h(e){let{dataSourceName:t,isLoadFailed:l}=e,{t:n}=(0,d.useTranslation)(),i=l?m(n,t):t?n('The data source "{{name}}" used by this block is disabled or unavailable. Enable the data source to display this block.',{name:t}):n("The data source used by this block is disabled or unavailable. Enable the data source to display this block.");return(0,o.jsx)(u.t,{role:"alert","aria-live":"polite",children:(0,o.jsx)(r.Result,{status:l?"warning":"403",subTitle:i})})}let f=()=>{let{t:e}=(0,d.useTranslation)(),t=(0,n.useFlowModel)(),{dataSourceName:l,isDataSourceLoadFailed:i,isDataSourceUnavailable:c,nameValue:m}=(0,s.useMemo)(()=>p(t,e),[t,e]),{actionName:f}=t.forbidden||{},g=(0,s.useMemo)(()=>e('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:m,actionName:e(a.default.capitalize(f))}).replaceAll(">",">"),[f,m,e]);return c?(0,o.jsx)(h,{dataSourceName:l,isLoadFailed:i}):(0,o.jsx)(u.t,{children:(0,o.jsx)(r.Result,{status:"403",subTitle:g})})};function g(){let{t:e}=(0,d.useTranslation)(),t=(0,n.useFlowModel)(),{dataSourceName:l,isDataSourceLoadFailed:i,isDataSourceUnavailable:a,nameValue:c}=(0,s.useMemo)(()=>p(t,e),[t,e]),m=(0,s.useMemo)(()=>e('The {{type}} "{{name}}" may have been deleted. Please remove this {{blockType}}.',{type:e("Collection"),name:c,blockType:e("Block")}).replaceAll(">",">"),[c,e]);return a?(0,o.jsx)(h,{dataSourceName:l,isLoadFailed:i}):(0,o.jsx)(u.t,{children:(0,o.jsx)(r.Result,{status:"404",subTitle:m})})}function v(){let{t:e}=(0,d.useTranslation)(),t=(0,n.useFlowModel)(),{dataSourceName:l}=(0,s.useMemo)(()=>p(t,e),[t,e]),a=(0,i.useMemoizedFn)(async()=>{try{var e;await (null==(e=t.refresh)?void 0:e.call(t))}catch{}});return(0,o.jsx)(u.t,{ref:t.context.ref,...t.decoratorProps,role:"alert","aria-live":"polite",children:(0,o.jsx)(r.Result,{status:"warning",title:e("Data loading failed"),subTitle:m(e,l),extra:(0,o.jsx)(r.Button,{type:"primary",onClick:a,children:e("Try again")})})})}},9378(e,t,l){l.d(t,{g:()=>f});var o=l(1178),n=l(1649),i=l(2793),r=l(2741),a=l(691),s=l(504);let d=()=>{let e=(0,s.useFlowContext)(),{token:t}=i.theme.useToken(),l=!!e.isDarkTheme,o=new r.TinyColor(t.colorFillAlter).onBackground(t.colorBgContainer).toHexShortString(),n={lineHeight:"inherit","&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},blockquote:{borderLeft:"4px solid #ccc",paddingLeft:"20px",marginLeft:"0",color:"#666",fontStyle:"italic"},img:{maxWidth:"100%"},".hljs":{background:"#f8f8f8",color:"#444"},".hljs-comment":{color:"#697070"},".hljs-punctuation,.hljs-tag":{color:"#444a"},".hljs-tag .hljs-attr,.hljs-tag .hljs-name":{color:"#444"},".hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag":{fontWeight:700},".hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type":{color:"#800"},".hljs-section,.hljs-title":{color:"#800",fontWeight:700},".hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable":{color:"#ab5656"},".hljs-literal":{color:"#695"},".hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code":{color:"#397300"},".hljs-meta":{color:"#1f7199"},".hljs-meta .hljs-string":{color:"#38a"},".hljs-emphasis":{fontStyle:"italic"},".hljs-strong":{fontWeight:700}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:o,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}},d={"&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},".hljs":{color:"#adbac7",background:"#22272e"},".hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_":{color:"#f47067"},".hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_":{color:"#dcbdfb"},".hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable":{color:"#6cb6ff"},".hljs-meta .hljs-string,.hljs-regexp,.hljs-string":{color:"#96d0ff"},".hljs-built_in,.hljs-symbol":{color:"#f69d50"},".hljs-code,.hljs-comment,.hljs-formula":{color:"#768390"},".hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag":{color:"#8ddb8c"},".hljs-subst":{color:"#adbac7"},".hljs-section":{color:"#316dca",fontWeight:700},".hljs-bullet":{color:"#eac55f"},".hljs-emphasis":{color:"#adbac7",fontStyle:"italic"},".hljs-strong":{color:"#adbac7",fontWeight:700},".hljs-addition":{color:"#b4f1b4",backgroundColor:"#1b4721"},".hljs-deletion":{color:"#ffd8d3",backgroundColor:"#78191b"}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:o,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}};return(0,a.css)({lineHeight:t.lineHeight,"& > *:last-child":{marginBottom:"0"},".ant-description-textarea, .ant-description-input":{lineHeight:t.lineHeight},".field-interface-datetime":{minWidth:"100px"},img:{maxWidth:"100%"},...l?d:n})};var u=l(7583),c=l(2828);let p=u.default.memoize(async e=>{if(!e)return e;let t=await Promise.resolve().then(l.bind(l,248));return(0,c.$P)(t.default.render(e))});function m(e){let[t,l]=(0,n.useState)(""),[o,i]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{i(!0),p(e).then(e=>{l(e),i(!1)}).catch(e=>console.log(e))},[e]),{html:t,loading:o}}function h(e){let t=e,l=document.createElement("div");l.innerHTML=t;let o=l.innerText;return l=null,(null==o?void 0:o.replace(/[\n\r]/g,""))||""}let f=e=>{let{textOnly:t,overflowMode:l,sanitizeHtml:r,style:a}=e,s=d(),{html:u=""}=m(e.value),c=r?r(u):u,p=h(c),f="ellipsis"===l,g=(0,n.useRef)(null),[v,y]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(g.current){let e=g.current;y(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)}},[c,a,l]);let _={...a||{},...f?{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",wordBreak:"break-word",cursor:"default"}:{}},b=t?(0,o.jsx)("div",{ref:g,className:`${s} nb-markdown`,style:_,children:p}):(0,o.jsx)("div",{ref:g,className:`${s} nb-markdown`,dangerouslySetInnerHTML:{__html:c},style:_});return f&&v?(0,o.jsx)(i.Tooltip,{title:(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:c},style:{maxHeight:500,overflowY:"auto",padding:10,color:"#000"}}),overlayInnerStyle:{background:"#fff",color:"#000",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},color:"#fff",children:b}):b}},248(e,t,l){function o(e,t){function l(e){return e.split(/\s+/g)[0]}__rspack_external_mermaid.default.initialize({securityLevel:"loose",...t});let o=e.renderer.rules.fence;function n(e,t,n,i,r){let a=e[t],s=a.info.trim();if(-1===["mermaid","{mermaid}"].indexOf(s?l(s):""))return void 0!==o?o(e,t,n,i,r):"";let d="",u=[],c=document.createElement("div");document.body.appendChild(c);try{let e="mermaid-container";__rspack_external_mermaid.default.mermaidAPI.render(e,a.content,t=>{let l=document.getElementById(e);null!==l&&u.push(["style",`max-width:${l.style.maxWidth};max-height:${l.style.maxHeight}`]),d=t},c)}catch(e){return`<div class="alert alert-danger">${e}</div>`}finally{c.remove()}return u.push(["src",`data:image/svg+xml,${encodeURIComponent(d)}`]),`<img ${r.renderAttrs({attrs:u})}>`}e.renderer.rules.fence=n}l.d(t,{default:()=>i});let n=new __rspack_external_markdown_it_a5918e6a.default({html:!0,linkify:!0,typographer:!0,breaks:!0});n.use(__rspack_external_markdown_it_highlightjs_3df446b8.default),n.use(o);let i=n},7309(e,t,l){function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)?e.map(e=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let t=e,l=void 0!==t.label,o=void 0!==t.value,n=l?t.label:String(t.value??""),i=o?t.value:n,r={label:n,value:i};return t.color&&(r.color=t.color),t.icon&&(r.icon=t.icon),r}return{label:String(e),value:e}}):[]}function n(e){return"string"==typeof e&&/\{\{\s*t\s*\(/.test(e)}function i(e,t){return n(e)?t(e):e}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return Array.isArray(e)?e.map(e=>({...e,label:i(null==e?void 0:e.label,t)})):[]}function a(e,t){if(e&&Array.isArray(e)&&0!==e.length)return r(o(e),t)}function s(e,t){let l=null==t?void 0:t.mode,o="multiple"===l||"tags"===l||(null==t?void 0:t.multiple)===!0;return Array.isArray(e)?e.filter(e=>""!==e&&null!=e):""===e||null==e?o?[]:void 0:e}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(Array.isArray(e)?e:null==e?[]:[e]).map(e=>{var l;let o=t.find(t=>(null==t?void 0:t.value)===e);return o?{value:e,label:o.label}:{value:e,label:(null==e||null==(l=e.toString)?void 0:l.call(e))??e}})}function u(e,t){var l,n,i,r;if(!["radioGroup","checkboxGroup","select","multipleSelect"].includes(null==t?void 0:t.interface)||Array.isArray(null==(l=e.props)?void 0:l.options)&&(null==(i=e.props)||null==(n=i.options)?void 0:n.length)>0)return!1;let a=null==(r=t.uiSchema)?void 0:r.enum;if(!Array.isArray(a)||0===a.length)return!1;let s=o(a);return!!s.length&&(e.setProps({options:s}),!0)}l.d(t,{NI:()=>u,OL:()=>i,ZY:()=>r,di:()=>a,xO:()=>s,yg:()=>d})},9133(e,t,l){l.d(t,{E4:()=>i,Gj:()=>d,a_:()=>o,eo:()=>p,pX:()=>s,w7:()=>r});let o="__custom__";function n(e){return`${o}:${e}`}function i(e){var t;if(!e||"object"!=typeof e)return!1;let l=e;if(!(null==(t=l.isAssociationField)?void 0:t.call(l)))return!1;let o=l.type,n=l.interface;return"belongsToMany"===o||"hasMany"===o||"belongsToArray"===o||"m2m"===n||"o2m"===n||"mbm"===n}function r(e){var t;if(!e||"object"!=typeof e)return;let l=e;return l.collection||(null==(t=l.context)?void 0:t.collection)||void 0}function a(e){return"string"==typeof e?e.trim():""}function s(e){if(!e||"object"!=typeof e)return[];let t=e,l="function"==typeof t.getStepParams?t.getStepParams("fieldSettings","init"):void 0,o=l&&"object"==typeof l?l:void 0,i="function"==typeof t.getStepParams?t.getStepParams("formItemSettings","fieldSettings"):void 0,r=i&&"object"==typeof i?i:void 0,s=(null==o?void 0:o.fieldPath)??t.fieldPath,d=(null==o?void 0:o.associationPathName)??t.associationPathName,u=null==r?void 0:r.name,c=a(s),p=a(d),m=a(u),h=new Set;return c&&h.add(c),p&&(c?c.startsWith(`${p}.`)?h.add(c):h.add(`${p}.${c}`):h.add(p)),m&&h.add(n(m)),Array.from(h)}function d(e){return s(e)[0]}function u(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;if(!t||"object"!=typeof t)return[];let l=t.items;if(Array.isArray(l))return l;let o=t.grid;if(!o||"object"!=typeof o)return[];let n=o.subModels;if(!n||"object"!=typeof n)return[];let i=n.items;return Array.isArray(i)?i:[]}function c(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;return t&&"object"==typeof t?u(t.field):[]}function p(e,t){let l=a(t);if(!l)return null;let o=e=>{if(!Array.isArray(e))return null;for(let t of e){if(s(t).some(e=>e===l))return t;let e=o(c(t));if(e)return e}return null};return o(u(e))}},7720(e,t,l){l.d(t,{VS:()=>a,_H:()=>u,i2:()=>c,sI:()=>m});var o=l(1649),n=l(6832),i=l(7309);function r(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function a(e){return r(e)?e:void 0}function s(e){return e}function d(e){var t;let l=s(e);l._reactiveWrapperCache=void 0,null==(t=l.setupReactiveRender)||t.call(l)}function u(e,t,l){let o,i=!(arguments.length>3)||void 0===arguments[3]||arguments[3];if(!l||!Array.isArray(l))return null;let a=l.find(e=>(null==e?void 0:e.value)===t),s=null==a?void 0:a.schema,d=null==s?void 0:s["x-component"];if(!d)return null;if("DateFilterDynamicComponent"===d)o=n.DateFilterDynamicComponent;else{var u,c;o=i?null==e||null==(u=e.getComponent)?void 0:u.call(e,d):null==e||null==(c=e.getComponent)?void 0:c.call(e,d,!1)}return o?{Comp:o,props:r(null==s?void 0:s["x-component-props"])?s["x-component-props"]:{}}:null}function c(e){let t=s(e);return!!t&&"function"==typeof t.__originalRender&&(t.render=t.__originalRender,d(t),!0)}function p(e,t){return Array.isArray(e.options)&&"function"==typeof t?{...e,options:(0,i.ZY)(e.options,t)}:e}function m(e){let{app:t,fieldModel:l,operator:n,operators:i,propsPriority:r="field",style:m}=e,h=s(l),f=u(t,n,i);if(!f)return c(h),!1;h.__originalRender||"function"!=typeof h.render||(h.__originalRender=h.render);let{Comp:g,props:v}=f,y=a(v.style);return h.render=()=>{let e=h.props||{},t=a(e.style),l=p("operator"===r?{...e,...v}:{...v,...e},h.translate),n="operator"===r?{...t,...y}:{...y,...t},i={...m||{},...n};return o.default.createElement(g,{...l,...Object.keys(i).length>0?{style:i}:{},onCompositionStart:null,onCompositionEnd:null})},d(h),!0}},544(e,t,l){l.d(t,{ON:()=>i,jI:()=>n});let o="__saveStepParamsWithSubModels";function n(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");e[o]=!0}async function i(e,t){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");let l=e;if(!0!==l[o])return await t();if("function"!=typeof l.save)throw Error("[saveStepParamsWithSubModels] model.save is not a function");try{return await l.save()}finally{delete l[o]}}},7827(e,t,l){l.d(t,{S0:()=>r.S0,_T:()=>r._T,s5:()=>r.s5});var o=l(504),n=l(6305);l(1649);var i=l(2542),r=l(5042);function a(e){let t=e.model.defaultProps||{};return e.isMobileLayout&&t.icon&&!1!==e.model.enableEditIconOnly?{...t,iconOnly:!0}:t}r.S0.registerFlow({key:"buttonSettings",title:(0,o.tExpr)("Button settings"),sort:-999,steps:{general:{title:(0,o.tExpr)("Edit button"),uiSchema(e){var t,l;return{title:e.model.enableEditTitle?{"x-decorator":"FormItem","x-component":"Input",title:(0,o.tExpr)("Button title"),description:null==(t=(l=e.model).getTitleFieldDescription)?void 0:t.call(l)}:void 0,tooltip:e.model.enableEditTooltip?{"x-decorator":"FormItem","x-component":"Input",title:(0,o.tExpr)("Button tooltip")}:void 0,icon:e.model.enableEditIcon?{"x-decorator":"FormItem","x-component":"IconPicker",title:(0,o.tExpr)("Button icon")}:void 0,iconOnly:e.model.enableEditIcon&&!1!==e.model.enableEditIconOnly?{"x-decorator":"FormItem","x-component":"Switch",title:(0,o.tExpr)("Icon only")}:void 0,type:e.model.enableEditType?{"x-decorator":"FormItem","x-component":"Radio.Group",title:(0,o.tExpr)("Button type"),enum:e.model.buttonTypeOptions}:void 0,danger:e.model.enableEditDanger?{"x-decorator":"FormItem","x-component":"Switch",title:(0,o.tExpr)("Danger action")}:void 0,color:e.model.enableEditColor?{"x-decorator":"FormItem","x-component":n.sk,title:(0,o.tExpr)("Color")}:void 0}},defaultParams(e){var t,l;let o=a(e);return e.model.enableEditColor?{...o,color:(null==(t=e.model.props)?void 0:t.color)??o.color??(null==(l=e.themeToken)?void 0:l.colorPrimary)}:o},handler(e,t){let{title:l,tooltip:o,...n}=t;e.model.setProps({title:e.t(l,{ns:"lm-flow-engine"}),tooltip:e.t(o,{ns:"lm-flow-engine"}),...n})}},linkageRules:{use:"actionLinkageRules"}}}),r.S0.registerFlow({key:"buttonAclSettings",steps:{aclCheck:{use:"aclCheck"}}}),r.S0.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh"},linkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"actionLinkageRules",flowKey:"buttonSettings",stepKey:"linkageRules"}}}}),r.S0.registerEvents({click:{title:(0,o.tExpr)("Click"),name:"click",uiSchema:{condition:{type:"object",title:(0,o.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":i.H}},handler:i.b}})},5042(e,t,l){l.d(t,{S0:()=>p,_T:()=>u,s5:()=>c});var o=l(1178),n=l(504),i=l(3137),r=l(2793),a=l(7583),s=l(1649),d=l(7843);function u(e){let{t}=(0,d.useTranslation)(),l=(0,n.useFlowModel)(),i=l.context.blockModel,u=e.collection||i.collection,c=u.dataSource,p=(0,s.useMemo)(()=>{let e=`${t(c.displayName||c.key)} > `,l=u?`${t(u.title)||u.name||u.tableName} `:"";return`${e}${l}`},[u,c.displayName,c.key,t]),{actionName:m}=(null==e?void 0:e.forbidden)||l.forbidden,h=(0,s.useMemo)(()=>t('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:p,actionName:t(a.default.capitalize(m))}).replaceAll(">",">"),[m,p,t]);return(0,o.jsx)(r.Tooltip,{title:e.message||h,children:e.children})}let c={collection:"collection",record:"record",all:["collection","record"],both:["collection","record"]};class p extends n.FlowModel{static _getScene(){return a.default.castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getAclActionName(){return null}onInit(e){super.onInit(e),delete this.props.disabled,this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1})}serialize(){let e=super.serialize();return delete e.props.disabled,e}getInputArgs(){let e={},t=[];if(this.context.resource){let l=this.context.resource.getSourceId();l&&(e.sourceId=l,t.push("sourceId"))}if(this.context.collection&&this.context.record){let l=this.context.collection.getFilterByTK(this.context.record);l&&(e.filterByTk=l,t.push("filterByTk"))}return t.length&&(e.defaultInputKeys=t),e}onClick(e){this.dispatchEvent("click",{event:e,...this.getInputArgs()},{debounce:!0})}getTitle(){return this.props.title}getTitleFieldDescription(){}getIcon(){return this.props.icon}renderButton(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,o.jsx)(i.In,{type:this.getIcon()}):void 0,n=e&&l?null:t.children||this.getTitle();return(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,children:n})}render(){return this.props.tooltip?(0,o.jsx)(r.Tooltip,{title:this.props.tooltip,children:this.renderButton()}):this.renderButton()}renderHiddenInConfig(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,o.jsx)(i.In,{type:this.getIcon()}):void 0,n=e&&l?null:t.children||this.getTitle();return this.forbidden?(0,o.jsx)(u,{children:(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:n})}):(0,o.jsx)(r.Tooltip,{title:this.context.t("The button is hidden and only visible when the UI Editor is active"),children:(0,o.jsx)(r.Button,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:n})})}constructor(...e){super(...e),this.defaultProps={type:"default",title:(0,n.tExpr)("Action"),iconOnly:!1},this.enableEditTooltip=!0,this.enableEditTitle=!0,this.enableEditIcon=!0,this.enableEditIconOnly=!0,this.enableEditType=!0,this.enableEditDanger=!0,this.enableEditColor=!1,this.buttonTypeOptions=[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Primary")}}'},{value:"dashed",label:'{{t("Dashed")}}'},{value:"link",label:'{{t("Link")}}'},{value:"text",label:'{{t("Text")}}'}]}}},3438(e,t,l){l.d(t,{P:()=>c,z:()=>p});var o=l(1178),n=l(2314),i=l(504),r=l(7583);l(1649);var a=l(2793),s=l(8563),d=l(2542),u=l(1511);let c={new:"new",one:"one",many:"many",select:"select",filter:"filter",oam:["one","many"],subForm:"subForm",bulkEditForm:"bulkEditForm"};class p extends i.FlowModel{setFilterActive(e,t){this.activeFilterSources.set(e,t)}hasActiveFilters(){let e=this.resource;if(e&&e.filter&&Object.keys(e.filter).length>0)return!0;for(let[,e]of this.activeFilterSources)if(e)return!0;return!1}removeFilterSource(e){this.activeFilterSources.delete(e)}getDataLoadingMode(){var e;let t=this.getStepParams("dataLoadingModeSettings");return(null==t||null==(e=t.dataLoadingMode)?void 0:e.mode)||"auto"}static _getScene(){return r.default.castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getModelClassName(e){return Object.keys(this.customModelClasses).includes(e)?this.customModelClasses[e]:this._defaultCustomModelClasses[e]||e}renderHiddenInConfig(){return this.forbidden?(0,o.jsx)(u.B3,{}):(0,o.jsx)(a.Tooltip,{title:this.context.t("The block is hidden and only visible when the UI Editor is active"),children:(0,o.jsx)(s.tn,{ref:this.context.ref,...this.decoratorProps,style:{opacity:"0.3"},children:(0,o.jsx)(this.ObservedRenderComponent,{})})})}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineMethod("getModelClassName",e=>this.getModelClassName(e)),this.ObservedRenderComponent=(0,i.observer)(()=>this.renderComponent(),{displayName:"ObservedRenderComponent"})}setDecoratorProps(e){Object.assign(this.decoratorProps,e)}get title(){return this._title||(this._title=this.defaultBlockTitle()),this._title}defaultBlockTitle(){var e;return`${this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name)}`}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of BlockModel")}render(){return this.collectionRequired&&!this.context.collection?(0,o.jsx)(u.Ak,{}):(0,o.jsx)(s.tn,{ref:this.context.ref,...this.decoratorProps,children:(0,o.jsx)(this.ObservedRenderComponent,{})})}constructor(...e){super(...e),this.decoratorProps=(0,n.observable)({}),this._defaultCustomModelClasses={},this.customModelClasses={},this.collectionRequired=!1,this.ObservedRenderComponent=null,this.activeFilterSources=new Map}}p.registerFlow({key:"cardSettings",title:(0,i.tExpr)("Card settings"),steps:{titleDescription:{title:(0,i.tExpr)("Title & description"),uiSchema:{title:{"x-component":"Input","x-decorator":"FormItem",title:(0,i.tExpr)("Title")},description:{"x-component":"Input.TextArea","x-decorator":"FormItem",title:(0,i.tExpr)("Description")}},handler(e,t){let l=e.t(t.title,{ns:"lm-flow-engine"}),o=e.t(t.description,{ns:"lm-flow-engine"});e.model.setDecoratorProps({title:l,description:o})}},linkageRules:{use:"blockLinkageRules"},blockHeight:{use:"blockHeight"}}}),p.define({hide:!0,label:(0,i.tExpr)("Other blocks")}),i.FlowModel.registerEvents({beforeRender:{title:(0,i.tExpr)("Before render"),name:"beforeRender",uiSchema:{condition:{type:"object",title:(0,i.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":d.H}},handler:d.b}})},9639(e,t,l){l.d(t,{U:()=>i});var o=l(504),n=l(7827);class i extends n.S0{}i.define({children:async e=>(await (0,o.buildSubModelItems)(n.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(n.s5.collection))})},146(e,t,l){l.d(t,{t:()=>u});var o=l(1178),n=l(504),i=l(7583);l(1649);var r=l(1511),a=l(7123),s=l(8481),d=l(2606);class u extends d.R{onMount(){super.onMount(),this.previousBeforeRenderHash=this.context.location.search}getDirtyTrackingVersion(e,t,l,o){var n;let i=new Set,r=(null==l||null==(n=l.getResourceName)?void 0:n.call(l))||o.associationName||o.collectionName;r&&i.add(String(r)),o.associationName&&i.add(String(o.associationName)),o.collectionName&&i.add(String(o.collectionName));let a=0;for(let l of i)a+=e.getDataSourceDirtyVersion(t,l);return a}onActive(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.hidden&&this.previousBeforeRenderHash!==this.context.location.search&&(this.rerender(),!e)||this.hidden)return;let t=this.context.resource;if(!t)return;let l=this.getResourceSettingsInitParams(),o=t.getDataSourceKey()||l.dataSourceKey||"main",i=this.context.engine,r=this.getDirtyTrackingVersion(i,o,t,l);if(t instanceof n.MultiRecordResource&&"manual"===this.getDataLoadingMode()&&!this.hasActiveFilters()){t.setData([]),t.setMeta({count:0,hasNext:!1}),t.setPage(1),t.loading=!1,this.lastSeenDirtyVersion=r;return}if(e){if(this.dirtyRefreshing)return;this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(i,o,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1});return}this.isManualRefresh||null!==this.lastSeenDirtyVersion&&r===this.lastSeenDirtyVersion||this.dirtyRefreshing||(this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(i,o,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1}))}static filterCollection(e){return!!e.filterTargetKey}static isCollectionAvailable(e){if(!e)return!1;let t=(0,s.b1)(this);return(0,s.F3)(e,t)}static async defineChildren(e){let t=t=>{var l;if(!(null==(l=this.meta)?void 0:l.createModelOptions))return t||{};if("function"==typeof this.meta.createModelOptions){let l=this.meta.createModelOptions(e);return i.default.merge({},l,t)}return i.default.merge({},this.meta.createModelOptions,t)},l=e=>this.name+e,{dataSourceKey:o,collectionName:r,associationName:a,filterByTk:s}=e.view.inputArgs,d=e.dataSourceManager.getDataSources().map(e=>0===e.getCollections().length?null:{key:l(`ds-${e.key}`),label:e.displayName,searchable:!0,searchPlaceholder:(0,n.tExpr)("Search"),children:o=>e.getCollections().map(o=>{if(!this.filterCollection(o)||!this.isCollectionAvailable(o))return null;let n={dataSourceKey:o.dataSourceKey,collectionName:o.name};return{key:l(`ds-${e.key}.${o.name}`),label:o.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}}).filter(Boolean)}).filter(Boolean),u=e=>1===d.length?d[0].children(e):d;if(!r)return u(e);if(this._isScene("select")){let n={dataSourceKey:o,collectionName:r};a&&(n.associationName=a,n.sourceId="{{ctx.view.inputArgs.sourceId}}");let i=e.dataSourceManager.getCollection(o,r),s=[];return this.isCollectionAvailable(i)&&s.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}),s.push({key:l("others-collections"),label:"Other collections",children:u(e)}),s}if(this._isScene("new")){let n={dataSourceKey:o,collectionName:r};a&&(n.associationName=a,n.sourceId="{{ctx.view.inputArgs.sourceId}}");let i=[],d=e.dataSourceManager.getCollection(o,r);return this.isCollectionAvailable(d)&&i.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:n}}})}),null!=s&&i.push({key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(o,r).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let n=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(n="{{ctx.view.inputArgs.filterByTk}}");let i={dataSourceKey:o,collectionName:e.target,associationName:e.resourceName,sourceId:n};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})}}).filter(Boolean)}),i.push({key:l("others-collections"),label:"Other collections",children:u(e)}),i}let c=[{key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(o,r).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let n=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(n="{{ctx.view.inputArgs.filterByTk}}");let i={dataSourceKey:o,collectionName:e.target,associationName:e.resourceName,sourceId:n};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})}}).filter(Boolean)},{key:l("others-records"),label:"Other records",children:u(e)}];if(this._isScene("one")){let n=e.dataSourceManager.getCollection(o,r);if(!n||!this.filterCollection(n)||!this.isCollectionAvailable(n))return c;let i={dataSourceKey:o,collectionName:r,filterByTk:"{{ctx.view.inputArgs.filterByTk}}"};a&&(i.associationName=a,i.sourceId="{{ctx.view.inputArgs.sourceId}}"),c.unshift({key:l("current-record"),label:"Current record",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})})}return c}get dataSource(){return this.context.dataSource}get collection(){return this.context.collection}get resource(){return this.context.resource}get association(){return this.context.association}get associationField(){return this.context.association}getAclActionName(){return"view"}async getFilterFields(){return this.collection.getFields().filter(e=>e.filterable)}getResourceSettingsInitParams(){return this.getStepParams("resourceSettings","init")}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1}),this.context.defineProperty("resourceName",{get:()=>this.resource.getResourceName(),cache:!1}),this.context.defineProperty("dataSource",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getDataSource(e.dataSourceKey)}}),this.context.defineProperty("collection",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getCollection(e.dataSourceKey,e.collectionName)}}),this.context.defineProperty("resource",{get:()=>{let e=this.getResourceSettingsInitParams(),t=this.createResource(this.context,e);t.setDataSourceKey(e.dataSourceKey),t.setResourceName(e.associationName||e.collectionName);let l=()=>{var l;let o=this.context.engine;if(!(null==o?void 0:o.getDataSourceDirtyVersion))return;let n=(null==(l=t.getDataSourceKey)?void 0:l.call(t))||e.dataSourceKey||"main";this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(o,n,t,e)};return l(),t.on("refresh",()=>{l(),this.invalidateFlowCache("beforeRender")}),t}}),this.context.defineProperty("association",{get:()=>{let e=this.getResourceSettingsInitParams();if(e.associationName)return this.dataSource.getAssociation(e.associationName)}})}createResource(e,t){throw Error("createResource method must be implemented in subclasses of CollectionBlockModel")}refresh(){return this.resource?this.resource.refresh():super.refresh()}isExternalDataSource(){var e;let t=null==(e=this.getResourceSettingsInitParams())?void 0:e.dataSourceKey;return!!(t&&"main"!==t)}render(){var e;return this.isExternalDataSource()&&this.collection&&(null==(e=this.resource)?void 0:e.getError())?(0,o.jsx)(r.Lb,{}):super.render()}defaultBlockTitle(){var e,t,l,o;let n=this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name),i=this.getResourceSettingsInitParams(),r=this.dataSource,s=this.collection,d=(null==r?void 0:r.displayName)||(null==r?void 0:r.key)||(null==i?void 0:i.dataSourceKey),u=(null==(o=this.context)||null==(l=o.dataSourceManager)||null==(t=l.getDataSources)?void 0:t.call(l).length)||0,c=(null==s?void 0:s.title)||(null==s?void 0:s.name)||(null==i?void 0:i.collectionName)||"",p=r?this.association:void 0;if(p){let e=this.resource.getResourceName(),t=r.getCollection(e.split(".")[0]);return(0,a.l)({blockLabel:n,dsName:d,dsCount:u,collectionTitle:c,sourceCollectionTitle:null==t?void 0:t.title,associationTitle:p.title})}return(0,a.l)({blockLabel:n,dsName:d,dsCount:u,collectionTitle:c})}addAppends(e){var t,l;let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)if(e.includes(".")){let l=this.collection;if(!l)return;let[n,i]=e.split("."),r=this.context.dataSourceManager.getCollectionField(`${l.dataSourceKey}.${l.name}.${n}`);if(!r)return;let a=r.target;if(!a)return;let s=this.context.dataSourceManager.getCollectionField(`${l.dataSourceKey}.${a}.${i}`);if(s&&s.isAssociationField()){if(this.resource.addAppends(e),(null==(t=s.targetCollection)?void 0:t.template)==="tree"){let t=e.includes(".")?e.slice(e.lastIndexOf(".")+1):e;s.name===t&&this.resource.addAppends(`${e}.parent(recursively=true)`)}o&&this.resource.refresh()}}else{if(!this.collection)return;let t=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${this.collection.name}.${e}`);if(!t)return;t.isAssociationField()&&(this.resource.addAppends(t.name),(null==(l=t.targetCollection)?void 0:l.template)==="tree"&&this.resource.addAppends(`${t.name}.parent(recursively=true)`),o&&this.resource.refresh())}}constructor(...e){super(...e),this.isManualRefresh=!1,this.collectionRequired=!0,this.lastSeenDirtyVersion=null,this.dirtyRefreshing=!1}}u.registerFlow({key:"resourceSettings",sort:-999,steps:{collectionCheck:{handler(e){e.collection||e.exitAll()}},aclCheck:{use:"aclCheck"},init:{handler(e,t){if(!t.dataSourceKey)throw Error("dataSourceKey is required");if(!t.collectionName)throw Error("collectionName is required");Object.keys(t).includes("sourceId")&&e.resource.setSourceId(t.sourceId),Object.keys(t).includes("filterByTk")&&e.resource.setFilterByTk(t.filterByTk)}}}}),u.registerFlow({key:"refreshSettings",sort:1e4,steps:{refresh:{async handler(e){let t=e.model,l=e.model.context.filterManager,o=(null==l?void 0:l.prepareFiltersForTarget)?await l.prepareFiltersForTarget(e.model.uid):void 0;l&&l.bindToTarget(e.model.uid);let i=t.getDataLoadingMode(),r=t.resource;if(r instanceof n.MultiRecordResource&&"manual"===i&&!t.hasActiveFilters()){r.setData([]),r.setMeta({count:0,hasNext:!1,page:1}),r.loading=!1;return}if(null==o||o.forEach(t=>{var l;null==t||null==(l=t.markInitialTargetRefreshHandled)||l.call(t,e.model.uid)}),e.model.isManualRefresh)e.model.resource.loading=!1;else try{await r.refresh()}catch(e){if(t.isExternalDataSource()&&e instanceof n.ResourceError&&r.getError()===e)return;throw e}}}}}),u.registerFlow({key:"dataLoadingModeSettings",sort:800,title:(0,n.tExpr)("Set data loading mode"),steps:{dataLoadingMode:{use:"dataLoadingMode"}}}),u.define({hide:!0})},2606(e,t,l){l.d(t,{R:()=>i});var o=l(504),n=l(3438);class i extends n.z{}i.define({hide:!0,label:(0,o.tExpr)("Data blocks"),async children(e){let t=await (0,o.buildSubModelItems)(i)(e),{collectionName:l,filterByTk:n,scene:r}=e.view.inputArgs;return t.filter(t=>{var o,i,a,s,d,u,c;let p=e.engine.getModelClass(t.useModel);return"select"===r?null==(s=p._isScene)?void 0:s.call(p,"select"):"subForm"===r?null==(d=p._isScene)?void 0:d.call(p,"subForm"):"bulkEditForm"===r?null==(u=p._isScene)?void 0:u.call(p,"bulkEditForm"):"new"===r||l&&!n?null==(c=p._isScene)?void 0:c.call(p,"new"):!p._isScene||!(null==(o=p._isScene)?void 0:o.call(p,"select"))&&!(null==(i=p._isScene)?void 0:i.call(p,"subForm"))&&!(null==(a=p._isScene)?void 0:a.call(p,"bulkEditForm"))})}})},6859(e,t,l){l.d(t,{o:()=>n});var o=l(504);class n extends o.FlowModel{static resolveUse(e,t,l){var o,n;let i=null==e||null==(n=e.stepParams)||null==(o=n.fieldBinding)?void 0:o.use;return i&&i!==(null==e?void 0:e.use)?i:null==e?void 0:e.use}}},1882(e,t,l){l.d(t,{L:()=>i});var o=l(504),n=l(7827);class i extends n.S0{}i.define({children:async e=>(await (0,o.buildSubModelItems)(n.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(n.s5.record))})},3027(e,t,l){l.d(t,{GO:()=>b,KW:()=>M,Z1:()=>y,eu:()=>_,nF:()=>v,zL:()=>s});var o=l(1178),n=l(504),i=l(1649),r=l(9639),a=l(1882);let s="assignFieldValues";function d(e){let t=null==e?void 0:e.collection;return t&&"object"==typeof t?t:void 0}function u(e){let t=d(e),l=null==t?void 0:t.dataSourceKey,o=null==t?void 0:t.name;return l&&o?{dataSourceKey:l,collectionName:o}:void 0}function c(e,t){let l=(null==e?void 0:e.collection)||d(t),o=null==l?void 0:l.dataSourceKey,n=null==l?void 0:l.name;return o&&n?{dataSourceKey:o,collectionName:n}:void 0}function p(e){if(!e||"object"!=typeof e)return!1;let t=e;return"string"==typeof t.dataSourceKey&&!!t.dataSourceKey&&"string"==typeof t.collectionName&&!!t.collectionName}function m(e){return e&&"object"==typeof e?e:void 0}function h(e,t){var l,o,n;let i=m(e);i&&(null==(l=i._observableCache)||delete l[t],null==(o=i._cache)||delete o[t],null==(n=i._pending)||delete n[t])}function f(e){h(null==e?void 0:e.context,"dataSource"),h(null==e?void 0:e.context,"collection"),h(null==e?void 0:e.context,"resource"),h(null==e?void 0:e.context,"association")}function g(e){var t,l,o,n,i;if(e.model.assignFormUid){let t=null==(n=(i=e.engine).getModel)?void 0:n.call(i,e.model.assignFormUid,!0);if(t)return t}let r=null==(t=e.model.subModels)?void 0:t.assignForm;return r||(null==(l=(o=e.engine).findModelByParentId)?void 0:l.call(o,e.model.uid,"assignForm"))||void 0}function v(e){return{async:!0,use:"AssignFormModel",stepParams:{resourceSettings:{init:u(e)}}}}function y(e,t){var l,o;let n=(null==(l=(o=e.model).getStepParams)?void 0:l.call(o,t,s))||{};return{assignedValues:(null==n?void 0:n.assignedValues)||{}}}async function _(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AssignFieldValues";try{return await (0,n.resolveRunJSObjectValues)(e,t)}catch(t){var o,i,r;return console.error(`[${l}] RunJS execution failed`,t),null==(r=e.message)||null==(i=r.error)||i.call(r,(null==(o=e.t)?void 0:o.call(e,"RunJS execution failed"))||"RunJS execution failed"),null}}function b(e,t){return t&&"object"==typeof t&&Object.keys(t).length?{...e,...t}:e}function x(e){let{model:t,blockModel:l}=(0,n.useFlowSettingsContext)(),d=t,u=(0,n.useFlowEngine)(),[m,h]=i.default.useState(null);return(0,i.useEffect)(()=>{let o=!1;return(async()=>{var n,i,m,g,v;let y=c(l,null==d?void 0:d.context),_=await u.loadOrCreateModel(y?{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel",stepParams:{resourceSettings:{init:y}}}:{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel"},{skipSave:!t.context.flowSettingsEnabled});if(o)return;if(p(y)){let e=null==(m=_.getStepParams)?void 0:m.call(_,"resourceSettings","init");p(e)&&e.dataSourceKey===y.dataSourceKey&&e.collectionName===y.collectionName||null==(v=_.setStepParams)||v.call(_,"resourceSettings","init",y),f(_),f(null==(g=_.subModels)?void 0:g.grid)}let b=(null==(n=d.getStepParams)?void 0:n.call(d,e.settingsFlowKey,s))||{};_.setInitialAssignedValues((null==b?void 0:b.assignedValues)||{});let x=t instanceof r.U&&!(t instanceof a.L);(e.clearRecordContext||x)&&(null==(i=_.context)?void 0:i.defineProperty)&&_.context.defineProperty("record",{get:()=>void 0,cache:!1}),h(_),d.assignFormUid=(null==_?void 0:_.uid)||d.assignFormUid})(),()=>{o=!0}},[d,l,u,t,t.context.flowSettingsEnabled,e.clearRecordContext,e.settingsFlowKey]),m?(0,o.jsx)(n.FlowModelRenderer,{model:m,showFlowSettings:!1}):null}function M(e){return{title:e.title||(0,n.tExpr)("Assign field values"),uiSchema:()=>({tip:e.tipComponent?{"x-decorator":"FormItem","x-component":e.tipComponent}:void 0,editor:{"x-decorator":"FormItem","x-component":()=>(0,o.jsx)(x,{settingsFlowKey:e.settingsFlowKey,clearRecordContext:e.clearRecordContext})}}),async beforeParamsSave(t,l,o){var n,i,r,a,d,u,c;let p=g(t);if(!p){let n=(null==l?void 0:l.assignedValues)||(null==o?void 0:o.assignedValues)||{};null==(a=(d=t.model).setStepParams)||a.call(d,e.settingsFlowKey,s,{assignedValues:n});return}e.validateBeforeSave&&await (null==(c=p.form)||null==(u=c.validateFields)?void 0:u.call(c));let m=(null==(n=p.getAssignedValues)?void 0:n.call(p))||{};null==(i=(r=t.model).setStepParams)||i.call(r,e.settingsFlowKey,s,{assignedValues:m})},handler(){}}}},6832(e,t,l){l.r(t),l.d(t,{DateFilterDynamicComponent:()=>_});var o=l(1178),n=l(1649),i=l(2793),r=l(691),a=l(504),s=l(6305),d=l(3526),u=l(7583);let c=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,p=(e,t)=>{if(!e)return null;if(d.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,d.dayjs)(e).format(t),o=(0,d.dayjs)(l,t);return o.isValid()?o:(0,d.dayjs)(e)}let l=(0,d.dayjs)(e,t);if(l.isValid())return l;let o=(0,d.dayjs)(e);return o.isValid()?o:null},m=e=>{let{value:t,picker:l="date",format:r,showTime:m,timeFormat:h}=e,f=(0,a.useFlowEngine)(),g=f.translate.bind(f),v=(0,s.fD)(),y=[{label:g("Today"),value:v.today},{label:g("Last week"),value:v.lastWeek},{label:g("This week"),value:v.thisWeek},{label:g("Next week"),value:v.nextWeek},{label:g("Last month"),value:v.lastMonth},{label:g("This month"),value:v.thisMonth},{label:g("Next month"),value:v.nextMonth},{label:g("Last quarter"),value:v.lastQuarter},{label:g("This quarter"),value:v.thisQuarter},{label:g("Next quarter"),value:v.nextQuarter},{label:g("Last year"),value:v.lastYear},{label:g("This year"),value:v.thisYear},{label:g("Next year"),value:v.nextYear},{label:g("Last 7 days"),value:v.last7Days},{label:g("Next 7 days"),value:v.next7Days},{label:g("Last 30 days"),value:v.last30Days},{label:g("Next 30 days"),value:v.next30Days},{label:g("Last 90 days"),value:v.last90Days},{label:g("Next 90 days"),value:v.next90Days}],_=t?(0,s.Pn)(null==t?void 0:t[0],l):l,b=_===l&&r?r:(0,d.getPickerFormat)(_),x="date"===_?c(b):b,M=(0,d.getDateTimeFormat)(_,x,m,h),w={utc:!0,presets:y,...e,format:M,picker:_,showTime:!!m&&{defaultValue:[(0,d.dayjs)("00:00:00","HH:mm:ss"),(0,d.dayjs)("23:59:59","HH:mm:ss")]}},S=(0,n.useMemo)(()=>u.default.castArray(e.value).map(e=>p(e,M)),[e.value,M]);return(0,o.jsx)(i.DatePicker.RangePicker,{...w,style:{flex:1,...null==w?void 0:w.style},value:S})},h=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,f=(e,t)=>{if(!e)return null;if(d.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,d.dayjs)(e).format(t),o=(0,d.dayjs)(l,t);return o.isValid()?o:(0,d.dayjs)(e)}let l=(0,d.dayjs)(e,t);if(l.isValid())return l;let o=(0,d.dayjs)(e);return o.isValid()?o:null},g=e=>{let{picker:t="date",format:l,showTime:r,timeFormat:u,onChange:c}=e,p=(0,a.useFlowContext)(),m=Array.isArray(e.value)?e.value[0]:e.value,g=m?(0,s.Pn)(m,t):t,[v,y]=(0,n.useState)(g),_=p.model.translate.bind(p.model),b=e=>{let o=e===t&&l?l:(0,d.getPickerFormat)(e),n="date"===e?h(o):o;return(0,d.getDateTimeFormat)(e,n,r,u)},x=(0,n.useMemo)(()=>b(v),[l,t,r,v,u]),M=(0,n.useMemo)(()=>f(m,x),[m,x]),w={utc:!0,inputReadOnly:p.isMobileLayout,...e,underFilter:!0,showTime:!!r&&{defaultValue:(0,d.dayjs)("00:00:00","HH:mm:ss")},format:x,picker:v};return(0,o.jsxs)(i.Space.Compact,{style:{width:"100%"},children:[(0,o.jsx)(i.Select,{style:{width:"100px"},popupMatchSelectWidth:!1,value:v,options:[{label:_("Date"),value:"date"},{label:_("Month"),value:"month"},{label:_("Quarter"),value:"quarter"},{label:_("Year"),value:"year"}],onChange:e=>{let t=b(e),l=x;if(y(e),!m||!c)return;let o=f(m,l);o&&o.isValid()&&c(o,o.format(t))}}),(0,o.jsx)(i.DatePicker,{...w,style:{flex:1,...null==w?void 0:w.style},value:M})]})},v=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=[{value:"exact",label:e("Exact day")},{value:"past",label:e("Past")},{value:"next",label:e("Next")},{value:"today",label:e("Today")},{value:"yesterday",label:e("Yesterday")},{value:"tomorrow",label:e("Tomorrow")},{value:"thisWeek",label:e("This Week")},{value:"lastWeek",label:e("Last Week")},{value:"nextWeek",label:e("Next Week")},{value:"thisMonth",label:e("This Month")},{value:"lastMonth",label:e("Last Month")},{value:"nextMonth",label:e("Next Month")},{value:"thisQuarter",label:e("This Quarter")},{value:"lastQuarter",label:e("Last Quarter")},{value:"nextQuarter",label:e("Next Quarter")},{value:"thisYear",label:e("This Year")},{value:"lastYear",label:e("Last Year")},{value:"nextYear",label:e("Next Year")}];return t&&l.splice(3,0,{value:"now",label:e("Now")}),l},y=e=>{let{isRange:t,defaultValue:l,onChange:i,...r}=e,a=(0,n.useCallback)((e,t)=>i(t),[i]);return t?(0,o.jsx)(m,{...r,onChange:a}):(0,o.jsx)(g,{...r,onChange:a})},_=e=>{let{value:t,onChange:l,includeNow:s=!1,...d}=e,u=(0,a.useFlowEngine)(),c=u.translate.bind(u),{token:p}=i.theme.useToken(),[m,h]=(0,n.useState)(!1),f=(0,n.useMemo)(()=>v(c,s),[c,s]),g=e=>{if(h(!1),"exact"===e)return l(void 0);let t={type:e};["past","next"].includes(e)&&(t.number=1,t.unit="day"),l(t)},_=()=>{let e=f.slice(0,3),t=f.slice(3),l=(0,r.css)`
|
|
270
270
|
padding: 3px 10px;
|
|
271
271
|
cursor: pointer;
|
|
272
272
|
white-space: nowrap;
|