"use strict";(self.webpackChunkdami=self.webpackChunkdami||[]).push([[9715],{59715:(e,t,a)=>{a.r(t),a.d(t,{default:()=>i});var n=a(93325);const i=async function({data:e,id:t},{refData:a}){const i={refData:a,activeTab:this.activeTab.id,sendMessage:e=>this._sendMessageToTab({...e.data,label:"conditions",id:t})},s=await(0,n.Z)(e.conditions,i);return{data:"",nextBlockId:this.getBlockConnections(t,s.isMatch?1:"fallback"),replacedValue:s?.replacedValue||{}}}},93325:(e,t,a)=>{a.d(t,{Z:()=>f});var n=a(83465),i=a.n(n),s=a(31528),r=a.n(s),o=a(43210),c=a(64989);const l=e=>"true"===e||"false"!==e&&e,d=e=>Number.isNaN(+e)?e:+e,u={eq:(e,t)=>e===t,eqi:(e,t)=>e?.toLocaleLowerCase()===t?.toLocaleLowerCase(),nq:(e,t)=>e!==t,gt:(e,t)=>d(e)>d(t),gte:(e,t)=>d(e)>=d(t),lt:(e,t)=>d(e)<d(t),lte:(e,t)=>d(e)<=d(t),cnt:(e,t)=>e?.includes(t)??!1,cni:(e,t)=>e?.toLocaleLowerCase().includes(t?.toLocaleLowerCase())??!1,nct:(e,t)=>!u.cnt(e,t),nci:(e,t)=>!u.cni(e,t),stw:(e,t)=>e?.startsWith(t)??!1,enw:(e,t)=>e?.endsWith(t)??!1,rgx:(e,t)=>{const a=t.match(/^\/(.*?)\/([gimy]*)$/);return(a?new RegExp(a[1],a[2]):new RegExp(t)).test(e)},itr:e=>Boolean(l(e)),ifl:e=>!l(e)};async function f(e,t){const a={isMatch:!1,replacedValue:{}};async function n({type:e,data:n}){if(e.startsWith("data")){let e=n.dataPath.trim().replace("@",".");return e.startsWith("{{")&&e.endsWith("}}")&&(e=e.slice(2,-2).trim()),r().has(t.refData,e)}const s=i()(n);for(const e of Object.keys(n)){const{value:n,list:i}=await(0,o.Z)(s[e],t.refData);s[e]=n??"",Object.assign(a.replacedValue,i)}if("value"===e)return s.value;if(e.startsWith("code")){let a;return a=t.isMV2?await t.sendMessage({type:"condition-builder",data:{type:e,data:s,refData:t.refData}}):await t.checkCodeCondition({data:s,refData:t.refData}),a}if(e.startsWith("element")){return await t.sendMessage({type:"condition-builder",data:{type:e,data:s}})}return""}async function s(e){let t=!0;const a={value:"",operator:""};for(const{category:i,data:s,type:r}of e){if(!t)return t;if("compare"===i){const{needValue:e}=c.YK.compareTypes.find((({id:e})=>e===r));if(!e)return t=u[r](a.value),t;a.operator=r}else if("value"===i){const e=await n({data:s,type:r}),{compareable:i}=c.YK.valueTypes.find((({id:e})=>e===r));i?a.operator&&(t=u[a.operator](a.value,e),a.operator=""):t=e,a.value=e}}return t}for(const{conditions:t}of e){if(a.isMatch)return a;let e=!1;for(const{items:a}of t)if(e=await s(a),!e)break;a.isMatch=e}return a}}}]);