diff --git a/assets/css/demo.min.css b/assets/css/demo.min.css index 654d7a0..8d27ac8 100644 --- a/assets/css/demo.min.css +++ b/assets/css/demo.min.css @@ -1,7 +1,7 @@ /** formeo - https://formeo.io -Version: 3.0.7 +Version: 3.0.8 Author: Draggable https://draggable.io */ diff --git a/assets/css/demo.min.css.gz b/assets/css/demo.min.css.gz index 319b9fc..09c2137 100644 Binary files a/assets/css/demo.min.css.gz and b/assets/css/demo.min.css.gz differ diff --git a/assets/css/formeo.min.css b/assets/css/formeo.min.css index 5f3a9a7..5ed8533 100644 --- a/assets/css/formeo.min.css +++ b/assets/css/formeo.min.css @@ -1,7 +1,7 @@ /** formeo - https://formeo.io -Version: 3.0.7 +Version: 3.0.8 Author: Draggable https://draggable.io */ diff --git a/assets/css/formeo.min.css.gz b/assets/css/formeo.min.css.gz index 4a40cea..908c831 100644 Binary files a/assets/css/formeo.min.css.gz and b/assets/css/formeo.min.css.gz differ diff --git a/assets/js/demo.min.js b/assets/js/demo.min.js index 2f278e8..078f6e7 100644 --- a/assets/js/demo.min.js +++ b/assets/js/demo.min.js @@ -1,8 +1,8 @@ /** formeo - https://formeo.io -Version: 3.0.7 +Version: 3.0.8 Author: Draggable https://draggable.io */ -var t=Object.defineProperty,e=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();const n=-1!==window.location.href.indexOf("draggable.github.io");if(n){"https:"!==window.location.protocol&&(window.location.protocol="https:"),((window.gitter={}).chat={}).options={room:"Draggable/formeo",activationElement:".toggle-gitter"};[{src:"//platform.twitter.com/widgets.js",id:"twitter-script"},{src:"//buttons.github.io/buttons.js",id:"github-script"},{src:"//www.google-analytics.com/analytics.js",id:"google-analytics",onload:()=>{window.ga("create","UA-79014176-2","auto"),window.ga("send","pageview")}}].forEach((function(t){const[e]=document.getElementsByTagName("script");if(document.getElementById(t.id))return;const n=Object.assign(document.createElement("script"),t);e.parentNode.insertBefore(n,e)}))}const o={user:{isAuthenticated:!0,userName:"Kevin"}},i={editorContainer:".build-form",i18n:{location:"./assets/lang"},actions:{},external:o,controls:{sortable:!1,groupOrder:["common","html"],disable:{},elements:[{tag:"input",config:{label:"Email",disabledAttrs:["type"],lockedAttrs:["required","className"]},meta:{group:"common",id:"email",icon:"@"},attrs:{className:"custom-email",type:"email",required:!0}}],elementOrder:{common:["button","checkbox","date-input","hidden","upload","number","radio","select","text-input","textarea"]}},config:{rows:{all:{events:{onRender:t=>{}}}},fields:{checkbox:{actionButtons:{}},"a33bcc32-c54c-46ed-9609-7cdb5b3dc511":{events:{onRender:t=>{const e=setTimeout((()=>{t.querySelector(".next-group").click(),clearTimeout(e)}),333)}},panels:{attrs:{hideDisabled:!0},disabled:[]}}}},events:{onSave:console.log},sessionStorage:!0,editPanelOrder:["attrs","options"]},r={renderContainer:".render-form",external:o,elements:{tinymce:{action:{onRender:t=>{if(t.id){const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}}}}}};var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var l=function(t,e,n,o){var i=-1,r=null==t?0:t.length;for(o&&r&&(n=t[++i]);++ii?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=Array(i);++o=o?t:Nt(t,e,n)},_t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Tt=function(t){return _t.test(t)};var jt=function(t){return t.split("")},Pt="\\ud800-\\udfff",Lt="["+Pt+"]",Dt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",kt="\\ud83c[\\udffb-\\udfff]",$t="[^"+Pt+"]",It="(?:\\ud83c[\\udde6-\\uddff]){2}",Rt="[\\ud800-\\udbff][\\udc00-\\udfff]",Mt="(?:"+Dt+"|"+kt+")"+"?",Ft="[\\ufe0e\\ufe0f]?",Wt=Ft+Mt+("(?:\\u200d(?:"+[$t,It,Rt].join("|")+")"+Ft+Mt+")*"),Bt="(?:"+[$t+Dt+"?",Dt,It,Rt,Lt].join("|")+")",zt=RegExp(kt+"(?="+kt+")|"+Bt+Wt,"g");var Ut=jt,qt=Tt,Ht=function(t){return t.match(zt)||[]};var Gt=At,Vt=Tt,Xt=function(t){return qt(t)?Ht(t):Ut(t)},Yt=F;var Zt=function(t){return function(e){e=Yt(e);var n=Vt(e)?Xt(e):void 0,o=n?n[0]:e.charAt(0),i=n?Gt(n,1).join(""):e.slice(1);return o[t]()+i}}("toUpperCase");const Jt=a(Ot((function(t,e,n){return t+(n?" ":"")+Zt(e)}))),Kt=document.getElementById("editor-action-buttons"),Qt=document.querySelector(".render-form");const te={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class ee{constructor(t=te){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...te,...t},o=e.replace(/\/?$/,"/");this.config={location:o,...n};const{override:i,preloaded:r={}}=this.config,s=Object.entries(this.langs).concat(Object.entries(i||r));this.langs=s.reduce(((t,[e,n])=>(t[e]=this.applyLanguage(e,n),t)),{}),this.locale=this.config.locale||this.config.langs[0]}init(t){return this.processConfig({...this.config,...t}),this.setCurrent(this.locale)}addLanguage(t,e={}){e="string"==typeof e?ee.processFile(e):e,this.applyLanguage(t,e),this.config.langs.push("locale")}getValue(t,e=this.locale){var n;return(null==(n=this.langs[e])?void 0:n[t])||this.getFallbackValue(t)}getFallbackValue(t){const e=Object.values(this.langs).find((e=>e[t]));return null==e?void 0:e[t]}makeSafe(t){const e={"{":"\\{","}":"\\}","|":"\\|"};return t=t.replace(/[{}|]/g,(t=>e[t])),new RegExp(t,"g")}put(t,e){return this.current[t]=e,e}get(t,e){const n=this;let o=this.getValue(t);if(!o)return;const i=o.match(/\{[^}]+?\}/g);if(e&&i)if("object"==typeof e)for(const r of i){const t=r.substring(1,r.length-1);o=o.replace(n.makeSafe(r),e[t]||"")}else o=o.replace(/\{[^}]+?\}/g,e);return o}static processFile(t){return ee.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i{const i=ee.processFile(e);return n.applyLanguage(t,i),n.loaded.push(t),o(n.langs[t])})).catch((e=>{const i=n.applyLanguage(t);o(i)}))}))}applyLanguage(t,e={}){const n=this.config.override[t]||{},o=this.langs[t]||{};return this.langs[t]={...o,...e,...n},this.langs[t]}get getLangs(){return this.config.langs}async setCurrent(t="en-US"){return await this.loadLang(t),this.locale=t,this.current=this.langs[t],this.current}}const ne=new ee;!function(){try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('._3x4ZIcu-{position:absolute;background:#1f2937;color:#fff;padding:.75rem;border-radius:.375rem;max-width:200px;z-index:50;visibility:hidden;opacity:0;transition:opacity .2s;pointer-events:none;left:0;top:0}._3x4ZIcu-.JIt36hCJ{visibility:visible;opacity:1;pointer-events:all}._3x4ZIcu-:before{content:"";position:absolute;width:0;height:0;border:6px solid transparent}._3x4ZIcu-[data-position=top]:before{border-top-color:#1f2937;bottom:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=bottom]:before{border-bottom-color:#1f2937;top:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=left]:before{border-left-color:#1f2937;right:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=right]:before{border-right-color:#1f2937;left:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=top-left]:before{border-top-color:#1f2937;bottom:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=top-right]:before{border-top-color:#1f2937;bottom:-12px;right:12px;left:auto;transform:none}._3x4ZIcu-[data-position=bottom-left]:before{border-bottom-color:#1f2937;top:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=bottom-right]:before{border-bottom-color:#1f2937;top:-12px;right:12px;left:auto;transform:none}')),document.head.appendChild(t)}}catch(e){}}();var oe=Object.defineProperty,ie=(t,e,n)=>((t,e,n)=>e in t?oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const re="_3x4ZIcu-",se="JIt36hCJ",ae={triggerName:"tooltip"};class le{constructor(t=ae){ie(this,"triggerName"),ie(this,"tooltip"),ie(this,"activeTriggerType",null),ie(this,"spacing",12),ie(this,"handleClick",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}][${e}-type="click"]`);if(n)if(this.isVisible())this.hide();else{const t=n.getAttribute(`${e}`);this.show(n,t),this.activeTriggerType="click"}else this.hide()})),ie(this,"handleMouseOver",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);if("click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))){const t=null==n?void 0:n.getAttribute(`${e}`);t&&(this.show(n,t),this.activeTriggerType="hover")}})),ie(this,"handleMouseOut",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);"click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))&&this.hide()})),ie(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),ie(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${re}`,document.body.appendChild(this.tooltip),this.setupEventListeners()}setupEventListeners(){document.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mouseout",this.handleMouseOut),document.addEventListener("touchstart",this.handleMouseOver),document.addEventListener("touchend",this.handleMouseOut),document.addEventListener("click",this.handleClick),window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}isVisible(){return this.tooltip.classList.contains(se)}calculatePosition(t){const e=t.getBoundingClientRect(),n=this.tooltip.getBoundingClientRect(),o=[{name:"top",x:e.left+(e.width-n.width)/2,y:e.top-n.height-this.spacing},{name:"bottom",x:e.left+(e.width-n.width)/2,y:e.bottom+this.spacing},{name:"left",x:e.left-n.width-this.spacing,y:e.top+(e.height-n.height)/2},{name:"right",x:e.right+this.spacing,y:e.top+(e.height-n.height)/2},{name:"top-left",x:e.left,y:e.top-n.height-this.spacing},{name:"top-right",x:e.right-n.width,y:e.top-n.height-this.spacing},{name:"bottom-left",x:e.left,y:e.bottom+this.spacing},{name:"bottom-right",x:e.right-n.width,y:e.bottom+this.spacing}];return o.find((t=>this.fitsInViewport(t,n)))||o[0]}fitsInViewport(t,e){if(!(t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight))return!1;return 0===[[t.x,t.y],[t.x+e.width,t.y],[t.x,t.y+e.height],[t.x+e.width,t.y+e.height],[t.x+e.width/2,t.y+e.height/2]].flatMap((([t,e])=>Array.from(document.elementsFromPoint(t,e)))).filter((t=>{if(this.tooltip.contains(t)||t===this.tooltip||t.classList.contains(re)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(se);const n=this.calculatePosition(t);this.tooltip.style.left=`${n.x}px`,this.tooltip.style.top=`${n.y}px`,this.tooltip.dataset.position=n.name}hide(){this.tooltip.classList.remove(se),this.activeTriggerType=null}destroy(){document.removeEventListener("mouseover",this.handleMouseOver),document.removeEventListener("mouseout",this.handleMouseOut),document.removeEventListener("touchstart",this.handleMouseOver),document.removeEventListener("touchend",this.handleMouseOut),document.removeEventListener("click",this.handleClick),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0),this.tooltip.remove()}}void 0!==window&&(window.SmartTooltip=le);const ce="formeo",de="3.0.7",ue="formeo-sprite",he=[{name:"cssPreload",src:"//cdnjs.cloudflare.com/ajax/libs/loadCSS/2.0.1/cssrelpreload.min.js"},{name:"mutationObserver",src:"//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js"},{name:"fetch",src:"https://unpkg.com/unfetch/polyfill"}],pe=`https://cdn.jsdelivr.net/npm/formeo@${de}/dist/${ue}.svg`,fe=`https://draggable.github.io/formeo/assets/img/${ue}.svg`,me=`https://cdn.jsdelivr.net/npm/formeo@${de}/dist/formeo.min.css`,ge="control-group",ve=`${ce}-stage`,be=`${ce}-row`,ye=`${ce}-column`,we=`${ce}-field`,Ce="custom-column-widths",xe="column-preset",Ee="resizing-columns",Se=new Map([[ve,be],[be,ye],[ye,we]]),Oe=["external","stages","rows","columns","fields"],Ne=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),Ae=[{name:"controls",className:ge},{name:"stage",className:ve},{name:"row",className:be},{name:"column",className:ye},{name:"field",className:we}],_e={controls:ge,stage:ve,row:be,column:ye,field:we},Te=Object.entries(_e).reduce(((t,[e,n])=>({...t,[n]:e})),{}),je=Object.values(_e),Pe=new RegExp(`${je.join("|")}`,"g"),Le=Ae.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),De=Le.slice().map((t=>t.slice().reverse())).reverse(),ke=new Map(Le),$e=new Map(De.slice()),Ie=new Map([[{value:"100.0",label:"100%"}],[{value:"50.0,50.0",label:"50 | 50"},{value:"33.3,66.6",label:"33 | 66"},{value:"66.6,33.3",label:"66 | 33"}],[{value:"33.3,33.3,33.3",label:"33 | 33 | 33"},{value:"25.0,25.0,50.0",label:"25 | 25 | 50"},{value:"50.0,25.0,25.0",label:"50 | 25 | 25"},{value:"25.0,50.0,25.0",label:"25 | 50 | 25"}],[{value:"25.0,25.0,25.0,25.0",label:"25 | 25 | 25 | 25"}],[{value:"20.0,20.0,20.0,20.0,20.0",label:"20 | 20 | 20 | 20 | 20"}],[{value:"16.66,16.66,16.66,16.66,16.66,16.66",label:"16.66 | 16.66 | 16.66 | 16.66 | 16.66 | 16.66"}]].reduce(((t,e,n)=>(t.push([n,e]),t)),[])),Re=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],Me=`${ce}-formData`,Fe=`${ce}-locale`,We=333,Be=Math.round(166.5),ze=Math.round(666),Ue="formeoSaved",qe="formeoUpdated",He="formeoOnRender",Ge=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Ve={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},Xe={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Ve},Ye=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi,Ze=/\bcol-\w+-\d+/g,Je="f-i-";var Ke=function(){this.__data__=[],this.size=0};var Qe=function(t,e){return t===e||t!=t&&e!=e},tn=Qe;var en=function(t,e){for(var n=t.length;n--;)if(tn(t[n][0],e))return n;return-1},nn=en,on=Array.prototype.splice;var rn=en;var sn=en;var an=en;var ln=Ke,cn=function(t){var e=this.__data__,n=nn(e,t);return!(n<0)&&(n==e.length-1?e.pop():on.call(e,n,1),--this.size,!0)},dn=function(t){var e=this.__data__,n=rn(e,t);return n<0?void 0:e[n][1]},un=function(t){return sn(this.__data__,t)>-1},hn=function(t,e){var n=this.__data__,o=an(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function pn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=9007199254740991},xi=Sn,Ei=Ci;var Si=function(t){return null!=t&&Ei(t.length)&&!xi(t)},Oi=Si,Ni=_;var Ai=function(t){return Ni(t)&&Oi(t)},_i={exports:{}};var Ti=function(){return!1};!function(t,e){var n=p,o=Ti,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i?n.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}(_i,_i.exports);var ji=_i.exports,Pi=A,Li=si,Di=_,ki=Function.prototype,$i=Object.prototype,Ii=ki.toString,Ri=$i.hasOwnProperty,Mi=Ii.call(Object);var Fi=function(t){if(!Di(t)||"[object Object]"!=Pi(t))return!1;var e=Li(t);if(null===e)return!0;var n=Ri.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ii.call(n)==Mi},Wi=A,Bi=Ci,zi=_,Ui={};Ui["[object Float32Array]"]=Ui["[object Float64Array]"]=Ui["[object Int8Array]"]=Ui["[object Int16Array]"]=Ui["[object Int32Array]"]=Ui["[object Uint8Array]"]=Ui["[object Uint8ClampedArray]"]=Ui["[object Uint16Array]"]=Ui["[object Uint32Array]"]=!0,Ui["[object Arguments]"]=Ui["[object Array]"]=Ui["[object ArrayBuffer]"]=Ui["[object Boolean]"]=Ui["[object DataView]"]=Ui["[object Date]"]=Ui["[object Error]"]=Ui["[object Function]"]=Ui["[object Map]"]=Ui["[object Number]"]=Ui["[object Object]"]=Ui["[object RegExp]"]=Ui["[object Set]"]=Ui["[object String]"]=Ui["[object WeakMap]"]=!1;var qi=function(t){return zi(t)&&Bi(t.length)&&!!Ui[Wi(t)]};var Hi=function(t){return function(e){return t(e)}},Gi={exports:{}};!function(t,e){var n=d,o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,r=i&&i.exports===o&&n.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||r&&r.binding&&r.binding("util")}catch(e){}}();t.exports=s}(Gi,Gi.exports);var Vi=Gi.exports,Xi=qi,Yi=Hi,Zi=Vi&&Vi.isTypedArray,Ji=Zi?Yi(Zi):Xi;var Ki=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Qi=Ro,tr=Qe,er=Object.prototype.hasOwnProperty;var nr=function(t,e,n){var o=t[e];er.call(t,e)&&tr(o,n)&&(void 0!==n||e in t)||Qi(t,e,n)},or=nr,ir=Ro;var rr=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(es),is=Yr,rs=Kr,ss=os;var as=Qe,ls=Si,cs=ar,ds=wn;var us=function(t,e){return ss(rs(t,e,is),t+"")},hs=function(t,e,n){if(!ds(n))return!1;var o=typeof e;return!!("number"==o?ls(n)&&cs(e,n.length):"string"==o&&e in n)&&as(n[e],t)};var ps=Xr;const fs=a(function(t){return us((function(e,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(i--,r):void 0,s&&hs(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++ocrypto.randomUUID(),gs=(t="",e)=>{if(!e)return!1;const n=/[|\\{}()[\]^*$+?.]/g;let o="string"==typeof e?[e]:e;o=o.map((t=>"*"===t?"":t.replace(n,"\\$&")));let i=!0;return o.length&&(i=!new RegExp(o.join("|"),"i").exec(t)),i},vs=t=>{var e;const n=null==(e=t.className)?void 0:e.match(Pe);return n&&Te[n[0]]},bs=t=>Array.from(new Set(t)),ys=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||ms(),t.id=e}else e=ms();return e},ws=(t,e)=>fs({},t,e,((t,e)=>Array.isArray(t)?null!=e?bs(t.concat(e)):e:Array.isArray(e)?null!=t?bs(e.concat(t)):e:void 0)),Cs=t=>{let e;if(null===t||!("object"==typeof t)||t instanceof Promise)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(Array.isArray(t)){e=[];for(let n=0,o=t.length;nt/e*100,Es=t=>`${t.toString()}%`,Ss=Object.create(null,{get:{value:t=>{var e;const n=null==(e=window.sessionStorage)?void 0:e.getItem(t);try{return JSON.parse(n)}catch(o){return n}}},set:{value:(t,e)=>{var n;try{return null==(n=window.sessionStorage)?void 0:n.setItem(t,JSON.stringify(e))}catch(o){}}}}),Os=t=>Oe.some((e=>new RegExp(`^${e}.`).test(t))),Ns=t=>t.startsWith("external");function As(t,e=ze){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function _s(t){return t}function Ts(){}function js(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const Ps=t=>t?Cs(js(t)):{};var Ls=g,Ds=P,ks=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$s=/^\w*$/;var Is=function(t,e){if(Ls(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Ds(t))||($s.test(t)||!ks.test(t)||null!=e&&t in Object(e))},Rs=xo;function Ms(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var o=arguments,i=e?e.apply(this,o):o[0],r=n.cache;if(r.has(i))return r.get(i);var s=t.apply(this,o);return n.cache=r.set(i,s)||r,s};return n.cache=new(Ms.Cache||Rs),n}Ms.Cache=Rs;var Fs=Ms;var Ws=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Bs=/\\(\\)?/g,zs=function(t){var e=Fs(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Ws,(function(t,n,o,i){e.push(o?i.replace(Bs,"$1"):n||t)})),e})),Us=g,qs=Is,Hs=zs,Gs=F;var Vs=function(t,e){return Us(t)?t:qs(t,e)?[t]:Hs(Gs(t))},Xs=P;var Ys=function(t){if("string"==typeof t||Xs(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Zs=nr,Js=Vs,Ks=ar,Qs=wn,ta=Ys;var ea=function(t,e,n,o){if(!Qs(t))return t;for(var i=-1,r=(e=Js(e,t)).length,s=r-1,a=t;null!=a&&++iNumber.isInteger(Number(t)),ca=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},da=(t,e,n)=>{const o=n.split("||"),i=bs(e).map((e=>t.find((t=>{const n=o.find((e=>!!sa(t,e)));return n&&sa(t,n)===e})))).filter(Boolean).concat(t);return bs(i)},ua=(t,e,n)=>{for(let o=0;o{const n=[];return ua(t,((t,o)=>n.push(e(t,o)))),n},pa={},fa=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),ma=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),ga={capitalize:fa,safeAttrName:t=>{if(pa[t])return pa[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return pa[t]=e,e},forEach:ua,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:ha,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:ca,isInt:la,get:sa,orderObjectsBy:da,isIE:ma},va={getStyle:(t,e=!1)=>{let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n},fadeOut:(t,e=250)=>{const n=1/(e/60);t.style.opacity=1,function e(){const o=Number(t.style.opacity)-n;o>0?(t.style.opacity=o,window.requestAnimationFrame(e)):t.remove()}()},slideDown:(t,e=250,n=!1)=>{t.style.display="block";const o=va.getStyle(t),i=parseInt(o.height,10),r=i/(e/60);t.style.height="0px",function e(){const o=parseFloat(t.style.height),s=o+r;o{const o=va.getStyle(t),i=parseInt(o.height),r=o.overflow;t.style.overflow="hidden",t.style.height=i+"px";const s=o.minHeight;t.style.minHeight="auto";const a=parseFloat(i/(e/60)).toFixed(2);!function e(){const o=parseInt(t.style.height,10)-a;o>0?(t.style.height=o+"px",window.requestAnimationFrame(e)):(t.style.overflow=r,t.style.display="none",t.style.minHeight=s,delete t.style.height,n&&n(t))}()},slideToggle:(t,e=250,n="none"===va.getStyle(t,"display"))=>{n?va.slideDown(t,e):va.slideUp(t,e)}},ba="no-transition",ya={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=Ca.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=Ca.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=Ca.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=Ca.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=Ca.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=Ca.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},wa=({src:t,...e},n=qe)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=Ca.opts)?void 0:o.debug)||(null==(i=Ca.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},Ca={init:function(t){return this.opts={...ya,...t},this},formeoSaved:t=>wa(t,Ue),formeoUpdated:t=>wa(t,qe),formeoCleared:t=>wa(t,"formeoCleared"),formeoOnRender:t=>wa(t,He),formeoConditionUpdated:t=>wa(t,"formeoConditionUpdated")},xa=As((()=>{Ca.opts.onUpdate({timeStamp:window.performance.now(),type:qe,detail:rh.formData})}),Be);let Ea;document.addEventListener(qe,xa),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;Ca.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;Ca.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;Ca.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;Ca.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(He,(t=>{const{timeStamp:e,type:n,detail:o}=t;Ca.opts.onRender({timeStamp:e,type:n,detail:o})})),document.addEventListener("confirmClearAll",(t=>{t={timeStamp:t.timeStamp,type:t.type,confirmationMessage:t.detail.confirmationMessage,clearAllAction:t.detail.clearAllAction,btnCoords:t.detail.btnCoords},Ca.opts.confirmClearAll(t)})),document.addEventListener(Ue,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};Ca.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{Ca.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){Ea=Ea||window.requestAnimationFrame((()=>{Ea=!1;for(const t of Object.values(th.data))t.dom.classList.add(ba),nh.dom.classList.add(ba),nh.panels.nav.refresh(),t.refreshFieldPanels()}))}));var Sa=xo,Oa=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Na=function(t){return this.__data__.has(t)};function Aa(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Sa;++ea))return!1;var c=r.get(t),d=r.get(e);if(c&&d)return c==e&&d==t;var u=-1,h=!0,p=2&n?new _a:void 0;for(r.set(t,e),r.set(e,t);++uJSON.stringify(t,null,e))),e(this,"get",(t=>sa(this.data,t))),e(this,"getChangeType",((t,e)=>{const n=Re.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),e(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||ys();return this.set(o,e)})),e(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):o&&delete o[n],o})),e(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),e(this,"setCallbacks",{}),e(this,"configVal",Object.create(null)),this.name=t,this.data=n,this.dataPath=""}get size(){return Object.keys(this.data).length}get js(){return this.data}get json(){return this.data}set(t,e){const n=sa(this.data,t);if(Bl(n,e))return this.data;const o=aa(this.data,t,e),i=Array.isArray(t)?t.join("."):t,r=Object.keys(this.setCallbacks).filter((t=>new RegExp(t).test(i))),s={newVal:e,oldVal:n,path:t};for(const a of r)for(const t of this.setCallbacks[a])t(s);if(!this.disableEvents){const i=this.getChangeType(n,e),r={entity:this,dataPath:this.dataPath.replace(/\.+$/,""),changePath:this.dataPath+t,value:e,data:o,change:`${i.type}: ${i.desc}`,src:this.dom};n&&(r.previousValue=n),Ca.formeoUpdated(r)}return o}addSetCallback(t,e){this.setCallbacks[t]?this.setCallbacks[t].push(e):this.setCallbacks[t]=[e]}removeSetCallback(t,e){this.setCallbacks[t]=this.setCallbacks[t].filter((t=>t!==e))}empty(){this.data=Object.create(null)}}function Ul(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function ql(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Yl(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var Zl=Yl(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Jl=Yl(/Edge/i),Kl=Yl(/firefox/i),Ql=Yl(/safari/i)&&!Yl(/chrome/i)&&!Yl(/android/i),tc=Yl(/iP(ad|od|hone)/i),ec=Yl(/chrome/i)&&Yl(/android/i),nc={capture:!1,passive:!1};function oc(t,e,n){t.addEventListener(e,n,!Zl&&nc)}function ic(t,e,n){t.removeEventListener(e,n,!Zl&&nc)}function rc(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(n){return!1}return!1}}function sc(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function ac(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&rc(t,e):rc(t,e))||o&&t===n)return t;if(t===n)break}while(t=sc(t))}return null}var lc,cc=/\s+/g;function dc(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(cc," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(cc," ")}}function uc(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function hc(t,e){var n="";if("string"==typeof t)n=t;else do{var o=uc(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function pc(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=mc(o)[n]))return o;if(o===fc())break;o=Cc(o,!1)}return!1}function vc(t,e,n,o){for(var i=0,r=0,s=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Xl(n,Lc);Pc.pluginEvent.bind(Od)(t,e,ql({dragEl:$c,parentEl:Ic,ghostEl:Rc,rootEl:Mc,nextEl:Fc,lastDownEl:Wc,cloneEl:Bc,cloneHidden:zc,dragStarted:ed,putSortable:Xc,activeSortable:Od.active,originalEvent:o,oldIndex:Uc,oldDraggableIndex:Hc,newIndex:qc,newDraggableIndex:Gc,hideGhostForTarget:Cd,unhideGhostForTarget:xd,cloneNowHidden:function(){zc=!0},cloneNowShown:function(){zc=!1},dispatchSortableEvent:function(t){kc({sortable:e,name:t,originalEvent:o})}},i))};function kc(t){!function(t){var e=t.sortable,n=t.rootEl,o=t.name,i=t.targetEl,r=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,u=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[Ac]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||Zl||Jl?(m=document.createEvent("Event")).initEvent(o,!0,!0):m=new CustomEvent(o,{bubbles:!0,cancelable:!0}),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=r,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=u,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=ql(ql({},f),Pc.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(ql({putSortable:Xc,cloneEl:Bc,targetEl:$c,rootEl:Mc,oldIndex:Uc,oldDraggableIndex:Hc,newIndex:qc,newDraggableIndex:Gc},t))}var $c,Ic,Rc,Mc,Fc,Wc,Bc,zc,Uc,qc,Hc,Gc,Vc,Xc,Yc,Zc,Jc,Kc,Qc,td,ed,nd,od,id,rd,sd=!1,ad=!1,ld=[],cd=!1,dd=!1,ud=[],hd=!1,pd=[],fd="undefined"!=typeof document,md=tc,gd=Jl||Zl?"cssFloat":"float",vd=fd&&!ec&&!tc&&"draggable"in document.createElement("div"),bd=function(){if(fd){if(Zl)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),yd=function(t,e){var n=uc(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=vc(t,0,e),r=vc(t,1,e),s=i&&uc(i),a=r&&uc(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+mc(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+mc(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&"none"!==s.float){var d="left"===s.float?"left":"right";return!r||"both"!==a.clear&&a.clear!==d?"horizontal":"vertical"}return i&&("block"===s.display||"flex"===s.display||"table"===s.display||"grid"===s.display||l>=o&&"none"===n[gd]||r&&"none"===n[gd]&&l+c>o)?"vertical":"horizontal"},wd=function(t){function e(t,n){return function(o,i,r,s){var a=o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name;if(null==t&&(n||a))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(o,i,r,s),n)(o,i,r,s);var l=(n?o:i).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},o=t.group;o&&"object"==Hl(o)||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},Cd=function(){!bd&&Rc&&uc(Rc,"display","none")},xd=function(){!bd&&Rc&&uc(Rc,"display","")};fd&&!ec&&document.addEventListener("click",(function(t){if(ad)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ad=!1,!1}),!0);var Ed=function(t){if($c){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,ld.some((function(t){var e=t[Ac].options.emptyInsertThreshold;if(e&&!bc(t)){var n=mc(t),o=i>=n.left-e&&i<=n.right+e,a=r>=n.top-e&&r<=n.bottom+e;return o&&a?s=t:void 0}})),s);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[Ac]._onDragOver(n)}}var i,r,s},Sd=function(t){$c&&$c.parentNode[Ac]._isOutsideThisEl(t.target)};function Od(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=Vl({},e),t[Ac]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return yd(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Od.supportPointer&&"PointerEvent"in window&&!Ql,emptyInsertThreshold:5};for(var o in Pc.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in wd(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&vd,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?oc(t,"pointerdown",this._onTapStart):(oc(t,"mousedown",this._onTapStart),oc(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(oc(t,"dragover",this),oc(t,"dragenter",this)),ld.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Vl(this,_c())}function Nd(t,e,n,o,i,r,s,a){var l,c,d=t[Ac],u=d.options.onMove;return!window.CustomEvent||Zl||Jl?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=n,l.draggedRect=o,l.related=i||e,l.relatedRect=r||mc(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function Ad(t){t.draggable=!1}function _d(){hd=!1}function Td(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function jd(t){return setTimeout(t,0)}function Pd(t){return clearTimeout(t)}Od.prototype={constructor:Od,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(nd=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,$c):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,r=t.type,s=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=o.filter;if(function(t){pd.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&pd.push(o)}}(n),!$c&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Ql||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=ac(a,o.draggable,n,!1))&&a.animated||Wc===a)){if(Uc=yc(a),Hc=yc(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return kc({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),Dc("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=ac(l,o.trim(),n,!1))return kc({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),Dc("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!ac(l,o.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,s=i.options,a=r.ownerDocument;if(n&&!$c&&n.parentNode===r){var l=mc(n);if(Mc=r,Ic=($c=n).parentNode,Fc=$c.nextSibling,Wc=n,Vc=s.group,Od.dragged=$c,Yc={target:$c,clientX:(e||t).clientX,clientY:(e||t).clientY},Qc=Yc.clientX-l.left,td=Yc.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,$c.style["will-change"]="all",o=function(){Dc("delayEnded",i,{evt:t}),Od.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Kl&&i.nativeDraggable&&($c.draggable=!0),i._triggerDragStart(t,e),kc({sortable:i,name:"choose",originalEvent:t}),dc($c,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){pc($c,t.trim(),Ad)})),oc(a,"dragover",Ed),oc(a,"mousemove",Ed),oc(a,"touchmove",Ed),oc(a,"mouseup",i._onDrop),oc(a,"touchend",i._onDrop),oc(a,"touchcancel",i._onDrop),Kl&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$c.draggable=!0),Dc("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Jl||Zl))o();else{if(Od.eventCanceled)return void this._onDrop();oc(a,"mouseup",i._disableDelayedDrag),oc(a,"touchend",i._disableDelayedDrag),oc(a,"touchcancel",i._disableDelayedDrag),oc(a,"mousemove",i._delayedDragTouchMoveHandler),oc(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&oc(a,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,s.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$c&&Ad($c),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ic(t,"mouseup",this._disableDelayedDrag),ic(t,"touchend",this._disableDelayedDrag),ic(t,"touchcancel",this._disableDelayedDrag),ic(t,"mousemove",this._delayedDragTouchMoveHandler),ic(t,"touchmove",this._delayedDragTouchMoveHandler),ic(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?oc(document,"pointermove",this._onTouchMove):oc(document,e?"touchmove":"mousemove",this._onTouchMove):(oc($c,"dragend",this),oc(Mc,"dragstart",this._onDragStart));try{document.selection?jd((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(sd=!1,Mc&&$c){Dc("dragStarted",this,{evt:e}),this.nativeDraggable&&oc(document,"dragover",Sd);var n=this.options;!t&&dc($c,n.dragClass,!1),dc($c,n.ghostClass,!0),Od.active=this,t&&this._appendGhost(),kc({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Zc){this._lastX=Zc.clientX,this._lastY=Zc.clientY,Cd();for(var t=document.elementFromPoint(Zc.clientX,Zc.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Zc.clientX,Zc.clientY))!==e;)e=t;if($c.parentNode[Ac]._isOutsideThisEl(t),e)do{if(e[Ac]){if(e[Ac]._onDragOver({clientX:Zc.clientX,clientY:Zc.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=sc(e));xd()}},_onTouchMove:function(t){if(Yc){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=Rc&&hc(Rc,!0),s=Rc&&r&&r.a,a=Rc&&r&&r.d,l=md&&rd&&wc(rd),c=(i.clientX-Yc.clientX+o.x)/(s||1)+(l?l[0]-ud[0]:0)/(s||1),d=(i.clientY-Yc.clientY+o.y)/(a||1)+(l?l[1]-ud[1]:0)/(a||1);if(!Od.active&&!sd){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))i.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}(t,i,this)&&!m.animated){if(m===$c)return P(!1);if(m&&r===t.target&&(s=m),s&&(n=mc(s)),!1!==Nd(Mc,r,$c,e,s,n,t,!!s))return j(),m&&m.nextSibling?r.insertBefore($c,m.nextSibling):r.appendChild($c),Ic=r,L(),P(!0)}else if(m&&function(t,e,n){var o=mc(vc(n.el,0,n.options,!0)),i=Nc(n.el,n.options,Rc),r=10;return e?t.clientXd+c*r/2:lu-id)return-od}else if(l>d+c*(1-i)/2&&lu-c*r/2))return l>d+c/2?1:-1;return 0}(t,s,n,i,C?1:a.swapThreshold,null==a.invertedSwapThreshold?a.swapThreshold:a.invertedSwapThreshold,dd,nd===s),0!==v){var O=yc($c);do{O-=v,y=Ic.children[O]}while(y&&("none"===uc(y,"display")||y===Rc))}if(0===v||y===s)return P(!1);nd=s,od=v;var N=s.nextElementSibling,A=!1,_=Nd(Mc,r,$c,e,s,n,t,A=1===v);if(!1!==_)return 1!==_&&-1!==_||(A=1===_),hd=!0,setTimeout(_d,30),j(),A&&!N?r.appendChild($c):s.parentNode.insertBefore($c,A?N:s),E&&Sc(E,0,S-E.scrollTop),Ic=$c.parentNode,void 0===b||dd||(id=Math.abs(b-mc(s)[x])),L(),P(!0)}if(r.contains($c))return P(!1)}return!1}function T(a,l){Dc(a,p,ql({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:P,onMove:function(n,o){return Nd(Mc,r,$c,e,n,mc(n),t,o)},changed:L},l))}function j(){T("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function P(e){return T("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(dc($c,Xc?Xc.options.ghostClass:c.options.ghostClass,!1),dc($c,a.ghostClass,!0)),Xc!==p&&p!==Od.active?Xc=p:p===Od.active&&Xc&&(Xc=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){T("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===$c&&!$c.animated||s===r&&!s.animated)&&(nd=null),a.dragoverBubble||t.rootEl||s===document||($c.parentNode[Ac]._isOutsideThisEl(t.target),!e&&Ed(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){qc=yc($c),Gc=yc($c,a.draggable),kc({sortable:p,name:"change",toEl:r,newIndex:qc,newDraggableIndex:Gc,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){ic(document,"mousemove",this._onTouchMove),ic(document,"touchmove",this._onTouchMove),ic(document,"pointermove",this._onTouchMove),ic(document,"dragover",Ed),ic(document,"mousemove",Ed),ic(document,"touchmove",Ed)},_offUpEvents:function(){var t=this.el.ownerDocument;ic(t,"mouseup",this._onDrop),ic(t,"touchend",this._onDrop),ic(t,"pointerup",this._onDrop),ic(t,"touchcancel",this._onDrop),ic(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;qc=yc($c),Gc=yc($c,n.draggable),Dc("drop",this,{evt:t}),Ic=$c&&$c.parentNode,qc=yc($c),Gc=yc($c,n.draggable),Od.eventCanceled||(sd=!1,dd=!1,cd=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Pd(this.cloneId),Pd(this._dragStartId),this.nativeDraggable&&(ic(document,"drop",this),ic(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Ql&&uc(document.body,"user-select",""),uc($c,"transform",""),t&&(ed&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),Rc&&Rc.parentNode&&Rc.parentNode.removeChild(Rc),(Mc===Ic||Xc&&"clone"!==Xc.lastPutMode)&&Bc&&Bc.parentNode&&Bc.parentNode.removeChild(Bc),$c&&(this.nativeDraggable&&ic($c,"dragend",this),Ad($c),$c.style["will-change"]="",ed&&!sd&&dc($c,Xc?Xc.options.ghostClass:this.options.ghostClass,!1),dc($c,this.options.chosenClass,!1),kc({sortable:this,name:"unchoose",toEl:Ic,newIndex:null,newDraggableIndex:null,originalEvent:t}),Mc!==Ic?(qc>=0&&(kc({rootEl:Ic,name:"add",toEl:Ic,fromEl:Mc,originalEvent:t}),kc({sortable:this,name:"remove",toEl:Ic,originalEvent:t}),kc({rootEl:Ic,name:"sort",toEl:Ic,fromEl:Mc,originalEvent:t}),kc({sortable:this,name:"sort",toEl:Ic,originalEvent:t})),Xc&&Xc.save()):qc!==Uc&&qc>=0&&(kc({sortable:this,name:"update",toEl:Ic,originalEvent:t}),kc({sortable:this,name:"sort",toEl:Ic,originalEvent:t})),Od.active&&(null!=qc&&-1!==qc||(qc=Uc,Gc=Hc),kc({sortable:this,name:"end",toEl:Ic,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Dc("nulling",this),Mc=$c=Ic=Rc=Fc=Bc=Wc=zc=Yc=Zc=ed=qc=Gc=Uc=Hc=nd=od=Xc=Vc=Od.dragged=Od.ghost=Od.clone=Od.active=null,pd.forEach((function(t){t.checked=!0})),pd.length=Jc=Kc=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":$c&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;o{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(ne.get("attributeNotPermitted",e||"")),Vd.add.attrs(t);let n;e&&(n=String(window.prompt(t.message.value,"")),t.addAction(e,n))},option:t=>{t.addAction()},condition:t=>{t.addAction(t)}},click:{btn:t=>{t.action()}},save:{form:_s}},Vd={init:function(t){const e=Object.keys(Gd);return this.opts=e.reduce(((e,n)=>(e[n]={...Gd[n],...t[n]},e)),t),this},add:{attrs:t=>Vd.opts.add.attr(t),options:t=>Vd.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},Vd.opts.add.condition(t))},click:{btn:t=>Vd.opts.click.btn(t)},save:{form:t=>(Vd.opts.sessionStorage&&Ss.set(Me,t),Ca.formeoSaved({formData:t}),Vd.opts.save.form(t))}},Xd=Object.freeze({type:"field",displayType:"slider"}),Yd=t=>({transform:`translateX(${t?`${t}px`:0})`});class Zd{constructor(t){e(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),e(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=lh.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=ws(Xd,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const n=this.createPanelsWrap();this.nav=this.navActions();const o=new window.ResizeObserver((([{contentRect:{width:t}}])=>{this.currentWidth!==t&&(this.toggleTabbedLayout(),this.currentWidth=t,this.nav.setTranslateX(this.activePanelIndex,!1))})),i=window.setTimeout((()=>{o.observe(n),window.clearTimeout(i)}),ze)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(lh.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Xd.displayType,this.panelDisplay}createPanelsWrap(){const t=lh.create({className:"panels",content:this.opts.panels.map((({config:t,...e})=>e))});return"field"===this.opts.type&&this.sortableProperties(t),this.panelsWrap=t,this.panels=t.children,this.currentPanel=this.panels[this.activePanelIndex],t}sortableProperties(t){const e=t.getElementsByClassName("field-edit-group");return ga.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&Od.create(t,{animation:150,group:{name:`edit-${t.editGroup}`,pull:!0,put:["properties"]},sort:!0,handle:".prop-order",onSort:t=>{this.propertySave(t.to),this.resizePanels()}})}))}createPanelNavLabels(){const t=this.opts.panels.map((t=>({tag:"h5",action:{click:t=>{const e=ca(t.target,t.target.parentElement);this.nav.setTranslateX(e,!1),this.nav.groupChange(e)}},content:t.config.label}))),e={className:"panel-labels",content:{content:t}},[n]=t;return n.className="active-tab",lh.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:ne.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:lh.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:ne.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:lh.icon("triangle-left")};return lh.create({tag:"nav",attrs:{className:"panel-nav"},content:[e,this.labels,t]})}get isTabbed(){return"tabbed"===this.panelDisplay}navActions(){const t={},e=this.currentPanel.parentElement,n=this.labels.firstChild,o=n.children,i=this.currentPanel.parentElement.childNodes;this.activePanelIndex=ca(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],lh.removeClasses(i,"active-panel"),lh.removeClasses(o,"active-tab"),this.currentPanel.classList.add("active-panel"),o[t].classList.add("active-tab"),this.currentPanel);const a=({offset:t,reset:o,duration:i=Be,animate:r=!this.isTabbed})=>{const a=[Yd(s.panel),Yd(t.panel)],l=[Yd(s.nav),Yd(this.isTabbed?0:t.nav)];if(o){const[t]=a,[e]=l;a.push(t),l.push(e)}const c={easing:"ease-in-out",duration:r?i:0,fill:"forwards"},d=e.animate(a,c);n.animate(l,c);const u=()=>{this.panelsWrap.style.height=lh.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",u),o||(s=t)};d.addEventListener("finish",u)};return t.setTranslateX=(t=this.activePanelIndex,o=!0)=>{var i;i=t,r={nav:-n.offsetWidth*i,panel:-e.offsetWidth*i},a({offset:r,animate:o})},t.refresh=(e=this.activePanelIndex)=>{this.activePanelIndex!==e&&t.groupChange(e),t.setTranslateX(this.activePanelIndex,!1),this.resizePanels()},t.nextGroup=()=>{const e=this.activePanelIndex+1;if(e!==i.length){const o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:s.nav-8,panel:s.panel-8},a({offset:r,reset:!0});return this.currentPanel},t.prevGroup=()=>{if(0!==this.activePanelIndex){const e=this.activePanelIndex-1,o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:8,panel:8},a({offset:r,reset:!0})},t}}const Jd="a an and as at but by for for from in into near nor of on onto or the to with".split(" ").map((t=>`\\s${t}\\s`)),Kd=new RegExp(`(?!${Jd.join("|")})\\w\\S*`,"g"),Qd=/\s+/g;function tu(t){if("string"!=typeof t)return t;if(t.trim().match(Qd))return t;return t.replace(Kd,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const eu=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),nu="f-autocomplete",ou="highlight-component",iu=({name:t,id:e,...n})=>["config.label","config.controlId","meta.id","attrs.id"].reduce(((t,e)=>t||n.get(e)),null)||"external"===t&&((...t)=>ne.get(t.join("."))||tu(t.join(" ")))(t,e);class ru{constructor(t,n,o){e(this,"lastCache",Date.now()),e(this,"optionsCache",null),this.key=t,this.className=t.replace(/\./g,"-"),this.value=n,this.events=[],this.i18nKey=o,this.build()}build(){const t=t=>{const e=this.list,n=this.getActiveOption();let o=new Map([[38,()=>{const t=this.getPreviousOption(n);t&&this.selectOption(t)}],[40,()=>{const t=this.getNextOption(n);t&&this.selectOption(t)}],[13,()=>{n&&(this.selectOption(n),this.setValue(n),"none"===e.style.display?this.showList(n):this.hideList()),t.preventDefault()}],[27,()=>{this.hideList()}]]).get(t.keyCode);return o||(o=()=>!1),o()},e={focus:({target:e})=>{this.updateOptions(),e.parentElement.classList.add(`${this.className}-focused`);const n=lh.toggleElementsByStr(this.list.querySelectorAll("li"),e.value);e.addEventListener("keydown",t);const o=this.list.querySelector(".active-option")||n[0];this.showList(o)},blur:({target:e})=>{e.parentElement.classList.remove(`${this.className}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const e=lh.toggleElementsByStr(this.list.querySelectorAll("li"),t.target.value);if(0===t.target.value.length&&this.clearValue(),0===e.length)this.hideList();else{const t=this.getActiveOption()||e[0];this.showList(t)}const n=t.target.value.trim();this.hiddenField.value=n,this.value=n,this.setValue({dataset:{label:n,value:n}})}};return this.displayField=lh.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${nu}-display-field`,value:this.label||this.value,placeholder:ne.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=lh.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=lh.create({tag:"ul",attrs:{className:`${nu}-list`}}),this.dom=lh.create({children:[this.displayField,this.hiddenField],className:this.className,action:{onRender:t=>{this.stage=t.closest(".formeo-stage");const e=this.value&&rh.getAddress(this.value);this.label=e&&iu(e),this.label&&(this.displayField.value=this.label)}}}),this.dom}updateOptions(){let t=this.optionsCache;const e=Date.now();(!t||e-this.lastCache>10*ze)&&(lh.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){const t=(t=>{const e=[],n=rh.flatList(),o=Object.entries(n).map((([n,o])=>{const i=iu(o);if(i){const r={tag:"span",content:` ${tu(o.name)}`,className:"component-type"},s=`${o.name}.${i}`;e.push(s);const a=((t,e)=>{const n=t.reduce(((t,n)=>t+(n===e)),0);return n>1?`(${n})`:""})(e,s),l=[`${i} `,{tag:"span",content:a,className:"component-label-count"},r];return(({id:t,textLabel:e,htmlLabel:n,selectedId:o})=>{const i={value:t,textLabel:e,htmlLabel:n};return t===o&&(i.selected=!0),i})({id:n,textLabel:[i,a].join(" ").trim(),htmlLabel:l,selectedId:t})}}));return o.filter(Boolean)})(),e=t=>{const e=`${nu}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return this.optionsCache=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${nu}-list-item`,action:{mousedown:({target:t})=>{t=e(t),this.setValue(t),this.selectOption(t),this.hideList()},mouseover:({target:t})=>{t=e(t),this.removeHighlight(),this.highlightComponent(t)}}};return lh.create(r)})),this.optionsCache}setListPosition(){const{offsetHeight:t,offsetWidth:e}=this.displayField,n=this.displayField.closest(".formeo-stage").getBoundingClientRect(),o=this.displayField.getBoundingClientRect(),i={position:"absolute",top:o.y+t+window.scrollY-n.y+"px",left:o.x+window.scrollX-n.x+"px",width:`${e+1}px`};Object.assign(this.list.style,i)}showList(t,e=this.list){this.stage.contains(this.list)||this.stage.appendChild(this.list),this.setListPosition(),this.selectOption(t),va.slideDown(e,Be)}hideList(t=this.list){va.slideUp(t,Be),this.removeHighlight(),this.stage.contains(this.list)&&this.stage.removeChild(this.list)}getActiveOption(t=this.list){const e=t.querySelector(".active-option");return"none"!==(null==e?void 0:e.style.display)?e:null}getPreviousOption(t){let e=t;do{e=e?e.previousSibling:null}while(null!=e&&"none"===e.style.display);return e}getNextOption(t){let e=t;do{e=e?e.nextSibling:null}while(null!=e&&"none"===e.style.display);return e}selectOption(t,e=this.list){var n;const o=e.querySelectorAll("li");for(const i of o){const{dataset:{value:t}}=i;if(i.classList.remove("active-option"),t){null==(n=rh.getAddress(t).dom)||n.classList.remove(ou)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(ou);for(const e of t)e.classList.remove(ou)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=rh.getAddress(n).dom)||e.classList.add(ou)}}clearValue(){this.selectOption(null),this.displayField.value="",this.hiddenField.value="",this.value="",this.runEvent("onChange",{target:this.hiddenField})}setValue(t){const{label:e,value:n}=t.dataset;this.displayField.value=e,this.hiddenField.value=n,this.value=n,this.runEvent("onChange",{target:this.hiddenField})}addEvent(t,e){this.events.push([t,e])}runEvent(t,e){for(const[n,o]of this.events)n===t&&o(e)}}const su=(t,e)=>{const n=(t=>{const e=Ns(t),n={"field.property":Ve,...Xe},o=e?(i=t,rh.getAddress(i).getData()):n[t];var i;return Object.keys(o).reduce(((t,e)=>(t[e]=e,t)),{})})(t);return Object.entries(n).reduce(((n,[o,i])=>{if("id"!==o){const r={tag:"option",content:ne.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(r.attrs.selected=!0),n.push(lh.create(r))}return n}),[])},au=(t,e)=>{lh.empty(t);for(const n of e)t.add(n)},lu=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:ne.get(`${t}.placeholder`)||tu(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},cu=t=>{const e=ne.get(t);if(e)return e;const n=t.split(".");return ne.get(n[n.length-1])},du={autocomplete:(t,e,n)=>new ru(t,e,n),string:(t,e)=>lu({key:t,value:e}),boolean:(t,e)=>lu({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>lu({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:cu(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>du[lh.childType(e)](t,e)))},uu=["selected","checked"],hu={boolean:(t,e)=>({click:({target:{checked:n}})=>{var o,i;"radio"===(null==(i=null==(o=e.data)?void 0:o.attrs)?void 0:i.type)&&e.set("options",e.data.options.map((t=>({...t,selected:!1})))),e.set(t,n)}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n)}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n))}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n)}}),object:()=>({})};class pu{constructor({key:t,data:n,index:o,field:i}){e(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:ne.get(t)||t};return e.map(((e,o)=>{const i=[],r=Object.entries(e).map((([e,n])=>{const r=this.conditionInput(e,n,t,o);return r&&i.push([r.className,n.trim()].filter(Boolean).join("-")),r})).filter(Boolean),s=da(r,Ge.map((t=>`condition-${t}`)),"className||dom.className");return this.processConditionUIState(s),o||s.unshift(n),this.itemFieldGroups.push(s),{children:s,className:`f-condition-row ${t}-condition-row ${i.join(" ")}`}}))})),e(this,"processConditionUIState",(t=>{const e=e=>(e=e.split("|"),t.filter((t=>e.includes(t.className)))),n=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.style.display="none"})),clearTimeout(e)}),We)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),We)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=Ns(t.value)?t.value:"field.property",a=su(s,r.value);return au(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Os(t.value)&&t.value?o(i):n(i)}],["condition-sourceProperty",t=>{const i=e("condition-comparison|condition-targetProperty|condition-target"),r=t.value;return(t=>/^is|^has/.test(t))(r.substring(r.lastIndexOf(".")+1,r.length))?n(i):o(i)}]]);for(const r of t){const t=i.get(r.className);t&&t(r)}})),e(this,"conditionInput",((t,e,n,o)=>{const i=this.field,r=`${this.itemKey}.${n}.${o}`,s=`${this.field.id}.${r}`,a=`${i.name}s.${s}.${t}`,l=(t,e,n)=>{const o=su(n||t,e),i=du.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=lh.create(i);return au(r,o),r},c=({target:t})=>{const e=t.closest(".f-condition-row"),n=new RegExp(`${t.className}(?:\\S?)+`,"gm");e.className=e.className.replace(n,"");const o={dataPath:a,value:t.value,src:t};Ca.formeoUpdated(o),rh.setAddress(a,t.value);const i=ca(e);this.processConditionUIState(this.itemFieldGroups[i])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=du.autocomplete(`condition.${e}`,t,n);return rh.setConditionMap(t,i),o.addEvent("onChange",(t=>{rh.removeConditionMap(rh.getAddress(a)),c(t),rh.setConditionMap(t.target.value,i)})),o},sourceProperty:t=>l("sourceProperty",t,"field.property"),targetProperty:t=>l("targetProperty",t,"field.property"),target:t=>d.source(t,"target"),value:t=>{const e=du.string("condition.value",t);return e.action={input:c},lh.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=da(Object.entries(n),uu,"0");const[r,s]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=r,this.isDisabled=i.isDisabledProp(s,r),this.isHidden=this.isDisabled&&i.config.panels[r].hideDisabled,this.isLocked=i.isLockedProp(s,r),this.dom=lh.create({tag:"li",className:[`field-${t.replace(/\./g,"-")}`,"prop-wrap",this.isHidden&&"hidden-property"],children:{className:"field-prop",children:[this.itemInputs,this.itemControls]}})}get itemInputs(){this.itemFieldGroups=[];return{className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>{let n="conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e);return["selected","checked"].includes(t)&&(n={className:"f-addon",children:n}),n}))}}get itemControls(){if(this.isLocked){return{className:`${this.panelName}-prop-controls prop-controls`,content:[]}}const t={tag:"button",attrs:{type:"button",className:"prop-remove prop-control"},action:{click:()=>{va.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),lh.remove(t),this.field.resizePanelWrap()}))}},content:lh.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=lh.childType(e)||"string",o={config:{},attrs:{},...du[n](t,e)},i=this.itemKey.replace(/.\d+$/,(e=>`${e}.${t}`)),r=i.split(".").filter(Number.isNaN).join(".")||t,[s,a]=[[...this.itemKey.split("."),t],[t]].map((t=>[this.field.id,...t].filter(Boolean).join("-")));return o.config={...o.config,label:"options"!==this.panelName&&(cu(r)||tu(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...hu[n](i,this.field)},o}}class fu{constructor(t,n,o){e(this,"addAttribute",((t,e)=>{let n=e;const o=eu(t),i=`attrs.${o}`;ne.current[i]||ne.put(i,fa(t)),"string"==typeof n&&["true","false"].includes(n)&&(n=JSON.parse(n)),this.field.set(`attrs.${t}`,n);const r=this.props.querySelector(`.field-attrs-${o}`),s=new pu({key:i,data:{[o]:n},field:this.field});r?this.props.replaceChild(s.dom,r):this.props.appendChild(s.dom),this.field.resizePanelWrap()})),e(this,"addOption",(()=>{const t=this.field.data.config.controlId,e=this.field.get("options"),n="select"===t?"option":t,o=ne.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,r=e[e.length-1],s={...e.length?r:{},label:o};"button"!==t&&(s.value=eu(o));const a=new pu({key:i,data:s,field:this.field,index:this.props.children.length});this.editPanelItems.push(a),this.props.appendChild(a.dom),this.field.set(i,s),this.field.resizePanelWrap()})),e(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new pu({key:e,data:t.template,field:this.field});n?this.props.replaceChild(o.dom,n):this.props.appendChild(o.dom),this.field.set(e,t.template),this.field.resizePanelWrap()})),this.type=lh.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=n,this.field=o,this.panelConfig=this.getPanelConfig(this.data)}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{id:`${this.field.id}-${this.name}-panel`,config:{label:ne.get(`panel.label.${this.name}`)},attrs:{className:`f-panel ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=[this.name,n?String(e):t[0]].join("."),i=n?t:{[t[0]]:t[1]};return new pu({key:o,data:i,field:this.field})}));const e={tag:"ul",attrs:{className:["field-edit-group",`field-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return lh.create(e)}createEditButtons(){const t=this,e=this.name,n=ne.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...lh.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:lh.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:ne.get(`action.add.${e}.attr`),value:ne.get(`action.add.${e}.value`)});const r=tu(e),s=new window.CustomEvent(`onAdd${r}`,{detail:i});Vd.add[e](i),document.dispatchEvent(s)}}}]}}}class mu extends zl{constructor(t,n={},o){const i={...n,id:n.id||ys()};super(t,i),e(this,"mutationHandler",(t=>t.map((t=>{})))),e(this,"remove",(t=>{if(t){const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?la(n)?o.splice(Number(n),1):this.set(e,o.filter((t=>t!==n))):delete o[n],o}if("stage"===this.name)return null;const e=this.parent,n=this.children;return ua(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(rh.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),rh[`${this.name}s`].delete(this.id)})),e(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),e(this,"getComponentTag",(()=>lh.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&lh.icon("component-corner",{className:"bottom-left"}),lh.icon(`handle-${this.name}`),tu(this.name),(this.isColumn||this.isRow)&&lh.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),e(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[lh.childType(t)](this.dom)})),e(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),e(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),e(this,"onSort",(()=>this.saveChildOrder())),e(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${vs(t)}`),null==e||e.classList.remove(`hovering-${vs(e)}`)})),e(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),e(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Ve[i]].some(Boolean)?t:e?o.set(Ve[i],e):o.get(Ve[i])})),e(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),e(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),e(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),e(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),e(this,"cloneData",(()=>{const t={...Cs(this.data),id:ys()};return"field"!==this.name&&(t.children=[]),t})),e(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),e(this,"createChildWrap",(t=>lh.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=i.id,this.name=t,this.config=rh[`${this.name}s`].config,ws(this.config,i.config),this.dataPath=`${this.name}s.${this.id}.`,this.observer=new window.MutationObserver(this.mutationHandler),this.render=o}observe(t){this.observer.disconnect(),this.observer.observe(t,{childList:!0})}get js(){return this.data}get json(){return this.data}empty(){const t=this.children.map((t=>{t.remove()}));return this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{rh.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),rh.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...lh.btnTemplate({content:lh.icon(`handle-${this.name}`)}),className:["component-handle",`${this.name}-handle`]},{className:["action-btn-wrap",`${this.name}-action-btn-wrap`],children:this.buttons}]}}toggleEdit(t=!this.isEditing){this.isEditing=t;const e=this.dom,n="editing",o=`${n}-${this.name}`,i=this.dom.querySelector(`.${this.name}-edit`);va.slideToggle(i,We,t),"field"===this.name&&(va.slideToggle(this.preview,We,!t),e.parentElement.classList.toggle(`column-${o}`,t)),e.classList.toggle(n,t),e.classList.toggle(o,t)}get buttons(){if(this.actionButtons)return this.actionButtons;const t={handle:(t=`handle-${this.name}`)=>({...lh.btnTemplate({content:lh.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...lh.btnTemplate({content:lh.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...lh.btnTemplate({content:lh.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...lh.btnTemplate({content:lh.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{va.slideUp(this.dom,We,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...lh.btnTemplate({content:lh.icon(t)}),className:["item-clone"],meta:{id:"clone"},action:{click:()=>{this.clone(this.parent),"column"===this.name&&this.parent.autoColumnWidths()}}})},{buttons:e,disabled:n}=this.config.actionButtons,o=e.filter((t=>!n.includes(t))).map((e=>{var n;return(null==(n=t[e])?void 0:n.call(t))||e}));return this.actionButtons=o,this.actionButtons}get index(){return ca(this.dom)}get parentType(){return $e.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${_e[t]}`);return e&&lh.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=ke.get(this.name);return ha(t,(t=>rh.getAddress(`${e}s.${t.id}`))).filter(Boolean)}get domChildren(){const t=this.dom.querySelector(".children");return t?t.children:[]}addChild(t={},e=this.domChildren.length){var n,o;let i=t;"object"!=typeof t&&(i={id:i});const r=this.dom.querySelector(".children"),{id:s=ys()}=i,a=ke.get(this.name);if(!a)return null;const l=`${a}s`,c=rh.getAddress(`${l}.${s}`)||rh[l].add(s,i);r.insertBefore(c.dom,r.children[e]),null==(o=null==(n=this.config.events)?void 0:n.onAddChild)||o.call(n,{parent:this,child:c});const d=c.get("children");return(null==d?void 0:d.length)&&c.loadChildren(d),this.removeClasses("empty"),this.saveChildOrder(),c}onAdd({from:t,to:e,item:n,newIndex:o}){var i;t.classList.contains(ge)||(t=t.parentElement);const r=vs(t),s=vs(e.parentElement),a=new Map([[-2,()=>{const t=this.addChild({},o).addChild();return t.addChild.bind(t)}],[-1,()=>{const t=this.addChild({},o);return t.addChild.bind(t)}],[0,()=>this.addChild.bind(this)],[1,t=>{const e=ca(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:{meta:{id:t},...e}}=Iu.get(n.id);aa(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=sa({stage:{row:0,column:-1,field:-2},row:{row:1,column:0,field:-1},column:{row:2,column:1,field:0},field:1},`${this.name}.${i}`),s=a.get(r)();lh.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||_s)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||_s)();return null==t?void 0:t(n.id)}},c=null==(i=l[r])?void 0:i.call(l,n,o);return(()=>{this.saveChildOrder(),this.removeClasses("empty")})(),c}onRemove({from:{parentElement:t}}){return t.classList.contains(ye)&&t.classList.remove("column-editing-field"),"stage"===this.name||this.children.length?(this.emptyClass(),this.saveChildOrder()):this.remove()}onRender(){const{events:t}=this.config;if(!t)return null;t.onRender&&lh.onRender(this.dom,t.onRender)}set config(t){const e=sa(t,"all"),n=sa(this.data,"config.controlId"),o=[e,n&&sa(t,n),sa(t,this.id)].reduce(((t,e)=>e?ws(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=rh[e];return n===this.id?this:null==o?void 0:o.get(n)}cloneChildren(t){for(const e of this.children)null==e||e.clone(t)}get isRow(){return this.name===Ne.row}get isColumn(){return this.name===Ne.column}get isField(){return this.name===Ne.field}}class gu extends mu{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),e(this,"updateConditionsPanel",As((()=>{const t=this.editPanels.find((({name:t})=>"conditions"===t));if(!t)return null;const e=t.createProps(),n=this.dom.querySelector(".field-edit-conditions");n.parentElement.replaceChild(e,n)}),We)),e(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=lh.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),e(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=bs([...this.config.panels.order,...Object.keys(this.data)]),n=["config","meta","action","events",...this.config.panels.disabled],o=e.filter((t=>!n.includes(t)));for(const r of o){const e=this.get(r),n=lh.childType(e);if(t.includes(n)){const t=new fu(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Zd(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),e(this,"toggleCheckedOptions",((t,e)=>{const n=this.get("options").map(((n,o)=>{const i=o===t;return"radio"===e?n.selected=i:n.checked=i?!n.checked:n.checked,n}));this.set("options",n)})),e(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get(`config.disabled${tu(e)}`)).includes(t)})),e(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get(`config.locked${tu(e)}`)).includes(t)})),this.debouncedUpdateEditPanels=function(t,e=333){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}(this.updateEditPanels),this.label=lh.create(this.labelConfig),this.preview=lh.create({}),this.editPanels=[];const n=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));let i={tag:"li",attrs:{className:we},id:this.id,children:[this.label,this.getComponentTag(),n,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:ne.get("field")}};i=lh.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return null;const t=this.get("config.editorLabel")||this.get("config.label"),e=this.get("attrs.required"),n=this.config.label.disableHTML;return{className:"prev-label",children:[{...(()=>{const e={tag:"label",attrs:{}};return n?(e.tag="input",e.attrs.value=t,e):(e.attrs.contenteditable=!0,e.children=t,e)})(),action:{input:({target:{innerHTML:t,innerText:e,value:o}})=>{super.set("config.label",n?o:t);const i=rh.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&lh.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=lh.create(this.labelConfig);this.label.parentElement.replaceChild(t,this.label),this.label=t}get fieldEdit(){const t={className:["field-edit","slide-toggle","formeo-panels-wrap"]};this.updateEditPanels();const e=this.editPanels.length;return e&&(t.className.push(`panel-count-${e}`),t.content=[this.panels.panelNav,this.panels.panelsWrap],this.panelNav=this.panels.nav,this.resizePanelWrap=this.panels.nav.refresh),t.action={onRender:()=>{if(0===e){const t=this.dom,e=t.querySelector(".item-edit-toggle"),n=t.querySelector(".field-actions"),o=n.getElementsByTagName("button");n.style.maxWidth=o.length*o[0].clientWidth+"px",lh.remove(e)}else this.resizePanelWrap()}},lh.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=ca(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=Cs(this.data),{action:n={}}=Iu.get(e.config.controlId);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:lh.create(e,!0),action:this.defaultPreviewActions}}}const vu={js:new Set,css:new Set},bu=(t,e,n=Ts)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),yu=(t,e)=>{t.removeEventListener("load",yu),e(t.src)},wu=(t,e)=>{t.removeEventListener("load",wu),e(t.src)},Cu=t=>new Promise(((e,n)=>{if(vu.js.has(t))return e(t);vu.js.add(t);const o=lh.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>wu(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),xu=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(vu.css.has(t))return e(t);vu.css.add(t);const o=lh.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>yu(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},Eu=async(t=pe)=>{if(document.getElementById(ue))return;const e=async t=>(t=>{let e=document.getElementById(ue);return e||(e=lh.create({id:ue,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return bu(t,e,(()=>bu(fe,e)))},Su={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>Cu(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>xu(t)));return Promise.all(e)}},Ou=t=>{const e=Object.entries(t).map((([t,e])=>Su[t](e)));return Promise.all(e)},Nu=()=>{const t=document.getElementById(ue);return"hidden"===window.getComputedStyle(t).visibility};class Au{constructor({events:t={},dependencies:n={},controlAction:o,...i}){e(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=n,this.id=i.id||ys()}get controlId(){var t;return null==(t=this.controlData.meta)?void 0:t.id}get dom(){const{meta:t,config:e}=this.controlData,n=this.i18n(e.label)||e.label,o={tag:"button",attrs:{type:"button"},content:[{tag:"span",className:"control-icon",children:lh.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${ge}`);return e&&Iu.panels.nav.refresh(ca(e))},click:({target:t})=>{Iu.addElement(t.parentElement.id)}}};return lh.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return Ou(this.dependencies)}i18n(t,e){var n,o;const i=ne.locale,r=null==(n=this.definition)?void 0:n.i18n,s=(null==r?void 0:r[i])||{};return((null==(o=s[t])?void 0:o.call(s))??s[t])||ne.get(t,e)}}const _u=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const Tu=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:ne.get("labelCount",{label:tu(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const ju=[class extends Au{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:ne.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:ne.get("button"),type:["button","submit","reset"].map((t=>({label:t,type:t}))),className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]})}},class extends Au{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:ne.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends Au{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:ne.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends Au{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:ne.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends Au{constructor(){super({tag:"textarea",config:{label:ne.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends Au{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:ne.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends Au{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:ne.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends Au{constructor(){super({tag:"select",config:{label:ne.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:Tu("option")})}},class extends Au{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:ne.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:Tu("checkbox",1)})}},class extends Au{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:ne.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:Tu("radio")})}}],Pu=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),Lu="controls.html.header";const Du=[class extends Au{constructor(){super({tag:Pu[0],attrs:{tag:Pu.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:ne.get(Lu),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:ne.get(Lu),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(Lu)}},class extends Au{constructor(){super({tag:"p",attrs:{className:""},config:{label:ne.get("controls.html.paragraph"),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"paragraph",id:"paragraph"},content:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."})}},class extends Au{constructor(){super({tag:"hr",config:{label:ne.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends Au{constructor(t){super(ws({tag:"textarea",config:{label:"WYSIWYG",editableContent:!0},meta:{group:"html",icon:"rich-text",id:"tinymce"},attrs:{required:!1},dependencies:{js:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"},action:{onRender:t=>{const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}},controlAction:{click:()=>{},onRender:()=>{}}},t))}}],ku=Object.freeze({sortable:!0,elementOrder:{},groupOrder:[],groups:[{id:"layout",label:"controls.groups.layout",elementOrder:["row","column"]},{id:"common",label:"controls.groups.form",elementOrder:["button","checkbox"]},{id:"html",label:"controls.groups.html",elementOrder:["header","block-text"]}],disable:{groups:[],elements:[],formActions:[]},elements:[],container:null,panels:{displayType:"slider"}}),$u=[...ju,...Du,..._u];const Iu=new class{constructor(){e(this,"groupLabel",(t=>ne.get(t)||t||"")),e(this,"layoutTypes",{row:()=>Ku.active.addChild(),column:()=>this.layoutTypes.row().addChild(),field:t=>this.layoutTypes.column().addChild(t)}),e(this,"addElement",(t=>{const{meta:{group:e,id:n},...o}=sa(this.get(t),"controlData");return aa(o,"config.controlId",n),"layout"===e?this.layoutTypes[n.replace("layout-","")]():this.layoutTypes.field(o)})),e(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=ws(ku,t);return this.container=e,this.groupOrder=bs(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...$u,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${ge}`);return e&&this.panels.nav.refresh(ca(e))},click:({target:t})=>{this.addElement(t.parentElement.id)}}}async init(t,e=!1){return await this.applyOptions(t),this.buildDOM(e),this}registerControls(t){return this.controls=[],t.map((async t=>{let e;return e="function"==typeof t?new t:new Au(t),this.add(e),this.controls.push(e.dom),e.promise()}))}groupElements(){let t=this.options.groups.slice(),e=this.controls.slice(),n=[];const o=[];return t=da(t,this.groupOrder,"id"),t=t.filter((t=>gs(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:ge,id:`${t.id}-${ge}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=bs(e.concat(t.elementOrder));t.elementOrder=n}return e=da(e,t.elementOrder,"meta.id"),n.content=e.filter((e=>{const{controlData:n}=this.get(e.id),i=n.meta.id||"";let r=!0;return r=[gs(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(i)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=Cs(t);return this.data.set(e.id,e),e.controlData.meta.id&&this.data.set(e.controlData.meta.id,e.controlData),e}get(t){return Cs(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...lh.btnTemplate({content:[lh.icon("bin"),ne.get("clear")],title:ne.get("clearAll")}),className:["clear-form"],action:{click:t=>{Qu.size?(Ca.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:ne.get("confirmClearAll"),clearAllAction:()=>{Ku.clearAll().then((()=>{const e={src:t.target};Ca.formeoCleared(e)}))},btnCoords:lh.coords(t.target)}}),document.dispatchEvent(Ca.confirmClearAll)):window.alert(ne.get("cannotClearFields"))}}},e={...lh.btnTemplate({content:[lh.icon("floppy-disk"),ne.get("save")],title:ne.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=rh,n={action:()=>{},coords:lh.coords(t),message:"",button:t};return Vd.click.btn(n),Vd.save.form(e)}}};return{className:"form-actions f-btn-group",content:Object.entries({clearBtn:t,saveBtn:e}).reduce(((t,[e,n])=>(this.options.disable.formActions.includes(e)||t.push(n),t)),[])}}buildDOM(t){const e=this.groupElements(),n=this.formActions(),{displayType:o}=this.options.panels;this.panels=new Zd({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],r=lh.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),s=["formeo-controls"];t&&s.push("formeo-sticky");const a=lh.create({className:s,content:[r,n]}),l=a.getElementsByClassName("control-group");this.dom=a,this.groups=l;const[c]=l;this.currentGroup=c,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=r.querySelector(".filtered-term");if(lh.toggleElementsByStr(n,t),e){const e=ne.get("controls.filteringTerm",t);a.classList.add("filtered"),o?o.textContent=e:(o=lh.create({tag:"h5",className:"filtered-term",content:e}),r.insertBefore(o,r.firstChild))}else o&&(a.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let d=l.length-1;d>=0;d--){const t=`formeo-controls-${l[d]}`;this.options.sortable||window.localStorage.removeItem(t),Od.create(l[d],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:({item:t})=>{const{controlData:e}=this.get(t.id);this.options.ghostPreview&&(t.innerHTML="",t.appendChild(new gu(e).preview))},onEnd:({from:t,item:e,clone:n})=>{t.contains(n)&&t.replaceChild(e,n)},sort:this.options.sortable,store:{get:()=>{const e=window.localStorage.getItem(t);return e?e.split("|"):[]},set:e=>{const n=e.toArray();window.localStorage.setItem(t,n.join("|"))}}})}return a}};class Ru extends zl{constructor(){super(...arguments),e(this,"load",(t=>{const e=js(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),e(this,"get",(t=>t?sa(this.data,t):this.add())),e(this,"add",((t,e=Object.create(null))=>{const n=t||ys(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),e(this,"remove",(t=>{if(Array.isArray(t))for(const e of t)this.get(e).remove();else this.get(t).remove();return this.data})),e(this,"delete",(t=>(delete this.data[t],t))),e(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),e(this,"conditionMap",new Map)}set config(t){this.configVal=ws(this.configVal,Cs(t))}get config(){return this.configVal}}class Mu extends mu{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=lh.create({attrs:{className:[ve,"empty"],id:this.id},children:n}),Od.create(n,{animation:150,fallbackClass:"row-moving",forceFallback:!0,group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{Fu.active=this},onSort:this.onSort.bind(this),draggable:`.${be}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),va.slideUp(this.dom,We,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),va.slideDown(this.dom,We)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const Fu=new class extends Ru{constructor(t){super("stages",t)}Component(t){return new Mu(t)}};class Wu extends mu{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[be]}),...t}),e(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Ze);const t=n.dom,o=Es(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),Be);document.dispatchEvent(Ca.columnResized)}this.updateColumnPreset()})),e(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>lh.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),e(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const n=this.createChildWrap();this.dom=lh.create({tag:"li",className:[be,"empty"],dataset:{hoverTag:ne.get("row"),editingHoverTag:ne.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,n]}),Od.create(n,{animation:150,fallbackClass:"column-moving",forceFallback:!0,group:{name:"row",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onRemove:this.onRemove.bind(this),onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),draggable:`.${ye}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:ne.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:ne.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:ne.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:ne.get("row.makeInputGroup"),description:ne.get("row.makeInputGroupDesc")}},n={className:"input-group",content:{tag:"input",attrs:{type:"text",ariaLabel:"Legend for fieldset",value:this.get("config.legend"),placeholder:"Title"},config:{label:{children:["Row Title",{tag:"span",content:" ⓘ",dataset:{tooltip:"Row title will be used as the legend for the fieldset"}}]}},action:{input:({target:{value:t}})=>this.set("config.legend",t)},className:""}},o=lh.formGroup([t,n]),i={tag:"label",content:ne.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=lh.create(this.columnPresetControlConfig);const r={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},s=[e,"hr",o,"hr",lh.formGroup([i,r],"row")];return lh.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=s.map((t=>lh.create(t)));t.append(...e)}}})}onAdd(...t){super.onAdd(...t),this.autoColumnWidths()}onRemove(...t){super.onRemove(...t),this.autoColumnWidths()}get getColumnPresetOptions(){const t=this.children,e=Ie.get(t.length-1)||[],n=t.map((t=>{const e=t.get("config.width")||"";return Number(e.replace("%","")).toFixed(1)})).join(",");if(e.length){const t=e.slice();return!t.find((t=>t.value===n))&&t.push({value:n,label:n.replace(/,/g," | "),className:Ce}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:ne.get("defineColumnLayout"),className:xe},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const Bu={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const zu=new class extends Ru{constructor(t){super("rows",t),this.config={all:Bu}}Component(t){return new Wu(t)}};class Uu{constructor(){this.onMove=this.onMove.bind(this),this.onStop=this.onStop.bind(this),this.cleanup=this.cleanup.bind(this)}getRowWidth(t){const e=t.querySelector(".children");if(!e)return 0;const n=e.children.length,o=lh.getStyle(e,"gap")||"0px",i=parseFloat(o,10)||0;return this.totalGapWidth=i*(n-1),e.offsetWidth-this.totalGapWidth}validateResizeTarget(t,e){return t&&e&&t.offsetWidth&&e.offsetWidth}onStart(t){if(t.preventDefault(),this.resized=!1,0!==t.button)return;const e=t.target.parentElement,n=e.nextSibling||e.previousSibling,o=e.closest(`.${be}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(Ee),this.columnPreset=o.querySelector(`.${xe}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Ze,""),n.className=n.className.replace(Ze,""),this.colStartWidth=e.offsetWidth,this.sibStartWidth=n.offsetWidth,this.rowWidth=this.getRowWidth(o),this.rowWidth<=0)this.cleanup();else{this.column=e,this.sibling=n,this.row=o;try{window.addEventListener("pointermove",this.onMove,!1),window.addEventListener("pointerup",this.onStop,!1)}catch(i){this.cleanup()}}else this.cleanup()}calculateNewWidths(t){const e=this.colStartWidth+t-this.startX,n=this.sibStartWidth-t+this.startX,o=parseFloat(xs(e,this.rowWidth)),i=parseFloat(xs(n,this.rowWidth));return o<10||i<10?null:{colWidth:Es(o.toFixed(1)),siblingColWidth:Es(i.toFixed(1))}}onMove(t){t.preventDefault();const{column:e,sibling:n}=this,o="touchmove"===t.type?t.touches[0].clientX:t.clientX,i=this.calculateNewWidths(o);if(!i)return;const{colWidth:r,siblingColWidth:s}=i;e.dataset.colWidth=r,n.dataset.colWidth=s,e.style.width=r,n.style.width=s,this.resized=!0}onStop(){const{column:t,sibling:e}=this;window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop),this.resized&&(this.setCustomWidthValue(),rh.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),rh.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(Ee),this.resized=!1,this.cleanup())}cleanup(){this.column&&this.originalColumnClass&&(this.column.className=this.originalColumnClass),this.sibling&&this.originalSiblingClass&&(this.sibling.className=this.originalSiblingClass),this.row&&this.row.classList.remove(Ee),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${Ce}`);const n=this.row.querySelector(".children").children,o=ha(n,(t=>xs(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=lh.create({tag:"option",attrs:{className:Ce,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const qu=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[lh.icon("triangle-down"),lh.icon("triangle-up")]}),Hu=()=>({className:"column-edit group-config"});class Gu extends mu{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[ye]}),...t}),e(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),e(this,"setDomWidth",(t=>{this.dom.dataset.colWidth=t,this.dom.style.width=t})),e(this,"setWidth",(t=>(this.setDomWidth(t),this.set("config.width",t))));const n=this.createChildWrap();this.dom=lh.create({tag:"li",className:[ye,"empty"],dataset:{hoverTag:ne.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Hu(),qu(new Uu),n]}),this.processConfig(),Ca.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),Od.create(n,{animation:150,fallbackClass:"field-moving",forceFallback:!0,group:{name:"column",pull:!0,put:["column","controls"]},sort:!0,disabled:!1,onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),onRemove:this.onRemove.bind(this),onMove:t=>{t.from!==t.to&&t.from.classList.remove("hovering-column")},draggable:`.${we}`,handle:".item-move"})}processConfig(){const t=ga.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Vu={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Xu=new class extends Ru{constructor(t){super("columns",t),this.config={all:Vu}}Component(t){return new Gu(t)}},Yu={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Zu=new class extends Ru{constructor(t){super("fields",t),e(this,"get",(t=>{let e=t&&sa(this.data,t);if(!e){const n=Iu.get(t);n&&(e=this.add(null,n.controlData))}return e})),e(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>{const{conditions:o,...i}=(null==n?void 0:n.getData())||n;if(null==o?void 0:o.length){let t=!0;if(1===o.length){const[e]=o;t=Boolean(e.if[0].source&&e.then[0].target)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),e(this,"load",((t=Object.create(null))=>{const e=js(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&aa(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:Yu}}Component(t){return new gu(t)}};const Ju=new class extends Ru{constructor(t){super("externals",t)}Component(t){return new mu("external",t)}},Ku=Fu,Qu=zu,th=Xu,eh=Zu,nh=Iu,oh=Ju,ih=()=>({id:ys(),stages:{[ys()]:{}},rows:{},columns:{},fields:{}});const rh=new class extends zl{constructor(){super("components"),e(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?Cs(js(t)):e&&Ss.get(Me)||ih())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",Ku.load(n.stages)),this.add("rows",Qu.load(n.rows)),this.add("columns",th.load(n.columns)),this.add("fields",eh.load(n.fields)),this.add("externals",oh.load(this.opts.external));for(const o of Object.values(this.get("stages")))o.loadChildren();return this.data})),this.disableEvents=!0,this.stages=Ku,this.rows=Qu,this.columns=th,this.fields=eh,this.controls=nh,this.externals=oh}flatList(t=this.data,e=Object.create(null)){return Object.entries(t).reduce(((t,[e,n])=>{if("object"==typeof n)for(const[o,i]of Object.entries(n))t[`${e}.${o}`]=i;return t}),e)}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${de}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:Fu.getData(),rows:zu.getData(),columns:Xu.getData(),fields:Zu.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Ku.config=e,Qu.config=n,th.config=o,eh.config=i}setAddress(t,e){const[n,o,...i]=Array.isArray(t)?t:t.split("."),r=this[n.replace(/s?$/,"s")].get(o);return null==r||r.set(i,e),r}getAddress(t){if(!Os(t))return;const[e,n,...o]=Array.isArray(t)?t:t.split("."),i=this[e.replace(/s?$/,"s")].get(n);return o.length?i.get(o):i}getConditionMap(t){if(Os(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Os(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Os(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},sh={glyphicons:t=>``,"font-awesome":t=>{const[e,n]=t.split(" ");return``},fontello:t=>`${t}`},ah=new Set(["input","textarea","select"]);const lh=new class{constructor(t=Object.create(null)){e(this,"render",(t=>(t.id=`f-${t.id||ys()}`,this.create(t)))),e(this,"create",((t,e=!1)=>{if(!t)return;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processTagName(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[ga.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let h=document.createElement(c);const p={string:t=>{h.innerHTML+=t},object:t=>t&&h.appendChild(n.create(t,e)),node:t=>h.appendChild(t),component:t=>h.appendChild(t.dom),array:t=>{for(const e of t)l=n.childType(e),p[l](e)},function:t=>{t=t(),l=n.childType(t),p[l](t)},undefined:()=>null,boolean:()=>null};if(i&&(a.attrs=ws(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return ga.forEach(t,(t=>{u.children.push(n.create(t,e))})),a.attrs.className&&(u.className=a.attrs.className),u.config={...a.config},this.create(u,e);p.array.call(this,t),a.content=void 0,o.push("options")}if(a.attrs&&(n.processAttrs(a,h,e),o.push("attrs")),a.config){if(a.config.label&&(a.config.label&&"button"!==c||["radio","checkbox"].includes(ga.get(a,"attrs.type")))&&!e){const t=n.label(a);if(!a.config.hideLabel){const e=[t,h];n.labelAfter(a)&&e.reverse(),u.children.push(e)}}o.push("config")}if(a.content||a.children){const t=a.content||a.children;l=n.childType(t),p[l],p[l].call(this,t)}if(s){for(const t in s)Object.hasOwn(s,t)&&(h.dataset[t]="function"==typeof s[t]?s[t]():s[t]);o.push("dataset")}a.action&&(this.actionHandler(h,a.action),o.push("action"));const f=ga.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)h[f[d]]=a[f[d]];return u.children.length&&(h=this.create(u)),h})),e(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),e(this,"toggleElementsByStr",((t,e)=>{const n=[];return lh.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),e(this,"elementsContainText",((t,e,n)=>{const o=[];return ua(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),e(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||ne.get("labelCount",{label:ne.get("option"),count:o})}}))),e(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),e(this,"removeEmpty",(t=>{const e=t.parentElement,n=vs(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),e(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),e(this,"isControls",(t=>vs(t)===ge)),e(this,"isStage",(t=>vs(t)===ve)),e(this,"isRow",(t=>vs(t)===be)),e(this,"isColumn",(t=>vs(t)===ye)),e(this,"isField",(t=>vs(t)===we)),e(this,"asComponent",(t=>rh[`${vs(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=ws(this.options,t)}processTagName(t){let e,n=t;if("string"==typeof n)return e=n,n={tag:e},n;if(n.attrs){const{tag:t,...o}=n.attrs;if(t)if("string"==typeof t)e=t;else{e=(t.find((t=>!0===t.selected))||t[0]).value}n.attrs=o}return n.tag=e||n.tag||"div",n}actionHandler(t,e){const n={onRender:lh.onRender,render:lh.onRender},o=["focus","blur"];return Object.entries(e).map((([e,i])=>(Array.isArray(i)?i:[i]).map((i=>{const r=n[e]||(t=>(e,n)=>e.addEventListener(t,n,o.includes(t)))(e);return r(t,i)}))))}get icons(){if(this.iconSymbols)return this.iconSymbols;const t=document.querySelectorAll(`#${ue} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(Je,"")]={tag:"svg",attrs:{className:["svg-icon",n=e.id]},children:[{tag:"use",attrs:{"xmlns:xlink":"http://www.w3.org/1999/xlink","xlink:href":`#${n}`}}]},t}),{}),this.cachedIcons={},this.iconSymbols}icon(t,e){var n,o;if(!t)return;const i=`${t}?${new URLSearchParams(e).toString()}`;if(null==(n=this.cachedIcons)?void 0:n[i])return this.cachedIcons[i];const r=this.icons[t];if(r){if(e){const t=ws(r,e);return this.cachedIcons[i]=lh.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=lh.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=sh[lh.options.iconFont])?void 0:o.call(sh,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",ys(t));for(const i of Object.keys(o)){const t=ga.safeAttrName(i),n=this.processAttrValue(o[i]);n&&e.setAttribute(t,!0===n?"":n)}}processAttrValue(t){let e=t||"";if(Array.isArray(e))if("object"==typeof e[0]){const t=e.filter((t=>!0===t.selected));e=t.length?t[0].value:e[0].value}else e=e.join(" ");return e}processOptions(t,e,n){const{action:o,attrs:i}=e,r=i.type||e.tag,s=i.id||e.id;return t.map(((t,i)=>{var a;const{label:l,...c}=t,d=()=>{const a={tag:"input",attrs:{name:s,type:r,value:t.value||"",id:`${s}-${i}`,...c},action:o},l={tag:"label",attrs:{for:`${s}-${i}`},config:{inputWrap:"form-check"},children:t.label},d={children:[a,l],className:[`f-${r}`]};return e.attrs.className&&(e.config.inputWrap=e.attrs.className),e.config.inline&&d.className.push(`f-${r}-inline`),t.selected&&(a.attrs.checked=!0),n&&(l.attrs.contenteditable=!0),d},u={select:()=>({tag:"option",attrs:t,children:t.label}),button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||ys(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=u[r])?void 0:a.call(u,t)}))}holdsContent(t){return-1!==t.outerHTML.indexOf("/")}isBlockInput(t){return!this.isInput(t)&&this.holdsContent(t)}isInput(t){let e=t;return"string"!=typeof e&&(e=e.tagName),ah.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=ga.get(t,"attrs.type"),n=ga.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=ga.get(t,"attrs.required");let{config:{label:o=""}}=t;const{id:i,attrs:r}=t;"function"==typeof o&&(o=o());const s={tag:"label",attrs:{for:i||(null==r?void 0:r.id)},className:[],children:[o,n&&this.requiredMark()],action:{}};return e&&(s.attrs.for=void 0,s.attrs.contenteditable=!0,s.fMap=e),s}childType(t){return void 0===t?t:[["array",t=>Array.isArray(t)],["node",t=>t instanceof window.Node||t instanceof window.HTMLElement],["component",()=>null==t?void 0:t.dom],[typeof t,()=>!0]].find((e=>e[1](t)))[0]}getStyle(t,e=!1){let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n}getElement(t){return{node:()=>t,object:()=>document.getElementById(t.id),string:()=>document.getElementById(t)}[this.childType(t)]()}empty(t){for(;t.firstChild;)this.remove(t.firstChild);return t}remove(t){const e=vs(t);return e?rh.remove(`${e}s.${t.id}`):t.parentElement.removeChild(t)}removeClasses(t,e){const n={string:t=>t.classList.remove(e),array:t=>{for(const n of e)t.classList.remove(n)}};n.object=n.string,ga.forEach(t,n[this.childType(e)])}addClasses(t,e){const n={string:t=>t.classList.add(e),array:t=>{for(const n of e)t.classList.add(n)}};ga.forEach(t,n[this.childType(e)])}formGroup(t,e=""){return{className:["f-field-group",e],children:t}}coords(t){const e=t.getBoundingClientRect(),n=document.body.getBoundingClientRect();return{pageX:e.left+e.width/2,pageY:e.top-n.top-e.height/2}}clearStage(t){t.classList.add("removing-all-fields");va.slideUp(t,600,(()=>{lh.empty(t),t.classList.remove("removing-all-fields"),lh.emptyClass(t),va.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=vs(t);if(!o)return;const i=vs(t.parentElement),r=lh[o].get(t.id).sortable;n||(n=!r.option("disabled")),r.option("disabled",n),i&&["rows","columns","stages"].includes(i)&&this.toggleSortable(t.parentElement,n)}emptyClass(t){const e=t.getElementsByClassName(Se.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};const ch={"en-US":"English",dir:"ltr","af-ZA":"Afrikaans (South Africa)","ar-TN":"Arabic (Tunisia)","cs-CZ":"Czech (Czechia)","de-DE":"German (Germany)","es-ES":"European Spanish","fa-IR":"Persian (Iran)","fi-FI":"Finnish (Finland)","fr-FR":"French (France)","hu-HU":"Hungarian (Hungary)","it-IT":"Italian (Italy)","ja-JP":"Japanese (Japan)","nb-NO":"Norwegian Bokmål (Norway)","pl-PL":"Polish (Poland)","pt-BR":"Brazilian Portuguese","pt-PT":"European Portuguese","ro-RO":"Romanian (Romania)","ru-RU":"Russian (Russia)","th-TH":"Thai (Thailand)","tr-TR":"Turkish (Türkiye)","zh-CN":"Chinese (China)","zh-HK":"Chinese (Hong Kong SAR China)","action.add.attrs.attr":"What attribute would you like to add?","action.add.attrs.value":"Default Value",addOption:"Add Option",allFieldsRemoved:"All fields were removed.",allowSelect:"Allow Select",and:"and",attribute:"Attribute",attributeNotPermitted:'Attribute "{attribute}" is not permitted, please choose another.',attributes:"Attributes","attrs.class":"Class","attrs.className":"Class","attrs.dir":"Direction","attrs.id":"Id","attrs.required":"Required","attrs.style":"Style","attrs.title":"Title","attrs.type":"Type","attrs.value":"Value",autocomplete:"Autocomplete",button:"Button",cannotBeEmpty:"This field cannot be empty",cannotClearFields:"There are no fields to clear",checkbox:"Checkbox",checkboxes:"Checkboxes",class:"Class",clear:"Clear",clearAllMessage:"Are you sure you want to clear all fields?",close:"Close",column:"Column","condition.target.placeholder":"target","condition.value.placeholder":"value",confirmClearAll:"Are you sure you want to remove all fields?",content:"Content",control:"Control","controlGroups.nextGroup":"Next Group","controlGroups.prevGroup":"Previous Group","controls.filteringTerm":'Filtering "{term}"',"controls.form.button":"Button","controls.form.checkbox-group":"Checkbox Group","controls.form.input.date":"Date","controls.form.input.email":"Email","controls.form.input.file":"File Upload","controls.form.input.hidden":"Hidden Input","controls.form.input.number":"Number","controls.form.input.text":"Text Input","controls.form.radio-group":"Radio Group","controls.form.select":"Select","controls.form.textarea":"TextArea","controls.groups.form":"Form Fields","controls.groups.html":"HTML Elements","controls.groups.layout":"Layout","controls.html.divider":"Divider","controls.html.header":"Header","controls.html.paragraph":"Paragraph","controls.layout.column":"Column","controls.layout.row":"Row",copy:"Copy To Clipboard",danger:"Danger",defineColumnLayout:"Define a column layout",defineColumnWidths:"Define column widths",description:"Help Text",descriptionField:"Description","editing.row":"Editing Row",editorTitle:"Form Elements",field:"Field","field.property.invalid":"not valid","field.property.isNotVisible":"is not visible","field.property.isVisible":"is visible","field.property.label":"label","field.property.valid":"valid","field.property.value":"value",fieldNonEditable:"This field cannot be edited.",fieldRemoveWarning:"Are you sure you want to remove this field?",fileUpload:"File Upload",formUpdated:"Form Updated",getStarted:"Drag a field from the right to get started.",group:"Group",grouped:"Grouped",hidden:"Hidden Input",hide:"Edit",htmlElements:"HTML Elements",if:"If","if.condition.source.placeholder":"source","if.condition.target.placeholder":"target / value",info:"Info","input.date":"Date","input.text":"Text",label:"Label",labelCount:"{label} {count}",labelEmpty:"Field Label cannot be empty","lang.af":"Afrikaans","lang.ar":"Arabic","lang.cs":"Czech","lang.de":"German","lang.en":"English","lang.es":"Spanish","lang.fa":"Persian","lang.fi":"Finnish","lang.fr":"French","lang.hu":"Hungarian","lang.it":"Italian","lang.ja":"Japanese","lang.nb":"Norwegian Bokmål","lang.pl":"Polish","lang.pt":"Portuguese","lang.ro":"Romanian","lang.ru":"Russian","lang.th":"Thai","lang.tr":"Turkish","lang.zh":"Chinese",layout:"Layout",limitRole:"Limit access to one or more of the following roles:",mandatory:"Mandatory",maxlength:"Max Length","meta.group":"Group","meta.icon":"Ico","meta.label":"Label",minOptionMessage:"This field requires a minimum of 2 options",name:"Name",newOptionLabel:"New {type}",no:"No",number:"Number",off:"Off",on:"On","operator.contains":"contains","operator.equals":"equals","operator.notContains":"not contains","operator.notEquals":"not equal","operator.notVisible":"not visible","operator.visible":"visible",option:"Option",optional:"optional",optionEmpty:"Option value required",optionLabel:"Option {count}",options:"Options",or:"or",order:"Order","panel.label.attrs":"Attributes","panel.label.conditions":"Conditions","panel.label.config":"Configuration","panel.label.meta":"Meta","panel.label.options":"Options","panelEditButtons.attrs":"+ Attribute","panelEditButtons.conditions":"+ Condition","panelEditButtons.options":"+ Option",placeholder:"Placeholder","placeholder.className":"space separated classes","placeholder.email":"Enter you email","placeholder.label":"Label","placeholder.password":"Enter your password","placeholder.placeholder":"Placeholder","placeholder.text":"Enter some Text","placeholder.textarea":"Enter a lot of text","placeholder.value":"Value",preview:"Preview",primary:"Primary",remove:"Remove",removeMessage:"Remove Element",removeType:"Remove {type}",required:"Required",reset:"Reset",richText:"Rich Text Editor",roles:"Access",row:"Row","row.makeInputGroup":"Make this row an input group.","row.makeInputGroupDesc":"Input Groups enable users to add sets of inputs at a time.","row.settings.fieldsetWrap":"Wrap row in a <fieldset> tag","row.settings.fieldsetWrap.aria":"Wrap Row in Fieldset",save:"Save",secondary:"Secondary",select:"Select",selectColor:"Select Color",selectionsMessage:"Allow Multiple Selections",selectOptions:"Options",separator:"Separator",settings:"Settings",size:"Size",sizes:"Sizes","sizes.lg":"Large","sizes.m":"Default","sizes.sm":"Small","sizes.xs":"Extra Small",style:"Style",styles:"Styles","styles.btn":"Button Style","styles.btn.danger":"Danger","styles.btn.default":"Default","styles.btn.info":"Info","styles.btn.primary":"Primary","styles.btn.success":"Success","styles.btn.warning":"Warning",subtype:"Type",success:"Success",text:"Text Field",then:"Then","then.condition.target.placeholder":"target",toggle:"Toggle",ungrouped:"Un-Grouped",warning:"Warning",yes:"Yes"};ne.addLanguage("en-US",ch);const dh={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:pe,style:me,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:ma(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let uh=class{constructor({formData:t,...e},n){const o=ws(dh.editor,e),{actions:i,events:r,debug:s,config:a,editorContainer:l,...c}=o;l&&(this.editorContainer="string"==typeof l?document.querySelector(l):l),this.opts=c,lh.setOptions=c,rh.config=a,this.userFormData=Ps(n||t),this.Components=rh,this.dom=lh,Ca.init({debug:s,...r}),Vd.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new le,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.loadResources.bind(this)):this.loadResources()}get formData(){return this.Components.formData}set formData(t={}){this.load({...this.userFormData,...t},this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?he.filter((({name:e})=>-1!==t.indexOf(e))):he;Promise.all(e.map((({src:t})=>Cu(t))))})(this.opts.polyfills),await Eu(this.opts.svgSprite),e.push((async t=>{if(!Nu()&&(await xu(t),!Nu()))return await xu("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(ne.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(Fe)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return Iu.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=rh.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(Fe,t);ne.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render(),null==(n=(e=this.opts).onLoad)||n.call(e,this)}))}load(t=this.userFormData,e=this.opts){return this.Components.load(t,e)}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(rh.get("stages")),this.opts.controlOnLeft)for(const e of this.stages)e.dom.style.order=1;const t={attrs:{className:"formeo formeo-editor",id:this.formId},content:[this.stages.map((({dom:t})=>t))]};ne.current.dir&&(t.attrs.dir=ne.current.dir,lh.dir=ne.current.dir),this.editor=lh.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(lh.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),Ca.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(Ca.formeoLoaded)}};const hh=t=>"string"==typeof t?document.querySelector(t):t,ph=t=>{const e=t.match(Ye);return(null==e?void 0:e[0])||t},fh=t=>t.replace(Ye,ys());let mh=class{constructor(t,n){e(this,"render",((t=this.form)=>{this.form=Ps(t);const e=document.getElementsByClassName("formeo-render").length,n={id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};this.renderedForm=lh.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),e(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),e(this,"prefixId",(t=>"f-"+t)),e(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),e(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),e(this,"cacheComponent",(t=>(this.components[ph(t.id)]=t,t))),e(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:ys(),className:i,children:s}})),e(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:fh(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(ph(t))))})})),e(this,"addButton",(t=>lh.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=lh.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(lh.render(lh.btnTemplate({className:"remove-input-group",children:lh.icon("remove"),action:{mouseover:({target:t})=>t.parentElement.classList.add("will-remove"),mouseleave:({target:t})=>t.parentElement.classList.remove("will-remove"),click:({target:t})=>t.parentElement.remove()}})))}}}))),e(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),e(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{var n,o;const i=(null==(n=e.config)?void 0:n.controlId)||(null==(o=e.meta)?void 0:o.id),{action:r={},dependencies:s={}}=this.elements[i]||{};s&&Ou(s);const a=ws({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),e(this,"handleComponentCondition",((t,e,n)=>{const o=gh(t);o&&t.addEventListener(o,(t=>{if(this.evaluateCondition(e,t))for(const e of n)this.execResult(e,t)}),!1);const i={target:t};if(this.evaluateCondition(e,i))for(const r of n)this.execResult(r,i)})),e(this,"applyConditions",(()=>{for(const{conditions:t}of Object.values(this.components))if(t)for(const e of t){const{if:t,then:n}=e;for(const e of t){const{source:t,...o}=e;if(Os(t)){const e=this.getComponents(t);for(const t of e)this.handleComponentCondition(t,o,n)}}}})),e(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:Bl,notEquals:(t,e)=>!Bl(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Os(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),e(this,"execResult",(({assignment:t,target:e,targetProperty:n,value:o})=>{var i;const r={equals:t=>{var e;const i={value:()=>{t[n]=o},isNotVisible:()=>{t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:()=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};null==(e=i[n])||e.call(i)}};if(Os(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),e(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return Ns(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),e(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return Ns(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r,formData:s}=(({editorContainer:t,renderContainer:e,formData:n,...o})=>({elements:{},...o,renderContainer:hh(e),editorContainer:hh(t),formData:Ps(n)}))(t);this.container=o,this.form=Ps(n||s),this.external=i,this.dom=lh,this.components=Object.create(null),this.elements=r}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=ve,lh.render(t))))}};const gh=t=>{const[e]=[["input",t=>["textarea","text"].includes(t.type)],["change",t=>["select"].includes(t.tagName.toLowerCase())||["checkbox","radio"].includes(t.type)]].find((e=>e[1](t)))||[!1];return e};void 0!==window&&(window.FormeoEditor=uh,window.FormeoRenderer=mh);const vh=mh,bh=new uh(i);((t,e)=>{const n=((t,e)=>({renderForm:()=>{Qt.style.display="block",e.render(t.formData)},logJSON:()=>{},viewData:()=>{for(const[e,n]of Object.entries(t.formData));},resetEditor:()=>{window.sessionStorage.removeItem("formeo-formData"),window.location.reload()}}))(t,e);Object.entries(n).map((([t,e])=>{const n={id:t,type:"button"},o=Object.assign(document.createElement("button"),n),i=document.createTextNode(Jt(t));return o.appendChild(i),o.addEventListener("click",e,!1),Kt.appendChild(o),o}))})(bh,new vh(r)),(t=>{const e=document.getElementById("control-filter"),n=document.getElementById("locale"),o=window.sessionStorage.getItem("formeo-locale");e.addEventListener("input",(({target:{value:e}})=>t.controls.actions.filter(e))),n.value=o||"en-US",n.addEventListener("change",(({target:{value:e}})=>{window.sessionStorage.setItem("formeo-locale",e),t.i18n.setLang(e)}),!1)})(bh); +var t=Object.defineProperty,e=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();const n=-1!==window.location.href.indexOf("draggable.github.io");if(n){"https:"!==window.location.protocol&&(window.location.protocol="https:"),((window.gitter={}).chat={}).options={room:"Draggable/formeo",activationElement:".toggle-gitter"};[{src:"//platform.twitter.com/widgets.js",id:"twitter-script"},{src:"//buttons.github.io/buttons.js",id:"github-script"},{src:"//www.google-analytics.com/analytics.js",id:"google-analytics",onload:()=>{window.ga("create","UA-79014176-2","auto"),window.ga("send","pageview")}}].forEach((function(t){const[e]=document.getElementsByTagName("script");if(document.getElementById(t.id))return;const n=Object.assign(document.createElement("script"),t);e.parentNode.insertBefore(n,e)}))}const o={user:{isAuthenticated:!0,userName:"Kevin"}},i={editorContainer:".build-form",i18n:{location:"./assets/lang"},actions:{},external:o,controls:{sortable:!1,groupOrder:["common","html"],disable:{},elements:[{tag:"input",config:{label:"Email",disabledAttrs:["type"],lockedAttrs:["required","className"]},meta:{group:"common",id:"email",icon:"@"},attrs:{className:"custom-email",type:"email",required:!0}}],elementOrder:{common:["button","checkbox","date-input","hidden","upload","number","radio","select","text-input","textarea"]}},config:{rows:{all:{events:{onRender:t=>{}}}},fields:{checkbox:{actionButtons:{}},"a33bcc32-c54c-46ed-9609-7cdb5b3dc511":{events:{onRender:t=>{const e=setTimeout((()=>{t.querySelector(".next-group").click(),clearTimeout(e)}),333)}},panels:{attrs:{hideDisabled:!0},disabled:[]}}}},events:{onSave:console.log},sessionStorage:!0,editPanelOrder:["attrs","options"]},r={renderContainer:".render-form",external:o,elements:{tinymce:{action:{onRender:t=>{if(t.id){const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}}}}}};var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var l=function(t,e,n,o){var i=-1,r=null==t?0:t.length;for(o&&r&&(n=t[++i]);++ii?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=Array(i);++o=o?t:Nt(t,e,n)},_t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Tt=function(t){return _t.test(t)};var jt=function(t){return t.split("")},Pt="\\ud800-\\udfff",Lt="["+Pt+"]",Dt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",kt="\\ud83c[\\udffb-\\udfff]",$t="[^"+Pt+"]",It="(?:\\ud83c[\\udde6-\\uddff]){2}",Rt="[\\ud800-\\udbff][\\udc00-\\udfff]",Mt="(?:"+Dt+"|"+kt+")"+"?",Ft="[\\ufe0e\\ufe0f]?",Wt=Ft+Mt+("(?:\\u200d(?:"+[$t,It,Rt].join("|")+")"+Ft+Mt+")*"),Bt="(?:"+[$t+Dt+"?",Dt,It,Rt,Lt].join("|")+")",zt=RegExp(kt+"(?="+kt+")|"+Bt+Wt,"g");var Ut=jt,qt=Tt,Ht=function(t){return t.match(zt)||[]};var Gt=At,Vt=Tt,Xt=function(t){return qt(t)?Ht(t):Ut(t)},Yt=F;var Zt=function(t){return function(e){e=Yt(e);var n=Vt(e)?Xt(e):void 0,o=n?n[0]:e.charAt(0),i=n?Gt(n,1).join(""):e.slice(1);return o[t]()+i}}("toUpperCase");const Jt=a(Ot((function(t,e,n){return t+(n?" ":"")+Zt(e)}))),Kt=document.getElementById("editor-action-buttons"),Qt=document.querySelector(".render-form");const te={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class ee{constructor(t=te){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...te,...t},o=e.replace(/\/?$/,"/");this.config={location:o,...n};const{override:i,preloaded:r={}}=this.config,s=Object.entries(this.langs).concat(Object.entries(i||r));this.langs=s.reduce(((t,[e,n])=>(t[e]=this.applyLanguage(e,n),t)),{}),this.locale=this.config.locale||this.config.langs[0]}init(t){return this.processConfig({...this.config,...t}),this.setCurrent(this.locale)}addLanguage(t,e={}){e="string"==typeof e?ee.processFile(e):e,this.applyLanguage(t,e),this.config.langs.push("locale")}getValue(t,e=this.locale){var n;return(null==(n=this.langs[e])?void 0:n[t])||this.getFallbackValue(t)}getFallbackValue(t){const e=Object.values(this.langs).find((e=>e[t]));return null==e?void 0:e[t]}makeSafe(t){const e={"{":"\\{","}":"\\}","|":"\\|"};return t=t.replace(/[{}|]/g,(t=>e[t])),new RegExp(t,"g")}put(t,e){return this.current[t]=e,e}get(t,e){const n=this;let o=this.getValue(t);if(!o)return;const i=o.match(/\{[^}]+?\}/g);if(e&&i)if("object"==typeof e)for(const r of i){const t=r.substring(1,r.length-1);o=o.replace(n.makeSafe(r),e[t]||"")}else o=o.replace(/\{[^}]+?\}/g,e);return o}static processFile(t){return ee.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i{const i=ee.processFile(e);return n.applyLanguage(t,i),n.loaded.push(t),o(n.langs[t])})).catch((e=>{const i=n.applyLanguage(t);o(i)}))}))}applyLanguage(t,e={}){const n=this.config.override[t]||{},o=this.langs[t]||{};return this.langs[t]={...o,...e,...n},this.langs[t]}get getLangs(){return this.config.langs}async setCurrent(t="en-US"){return await this.loadLang(t),this.locale=t,this.current=this.langs[t],this.current}}const ne=new ee;!function(){try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('._3x4ZIcu-{position:absolute;background:#1f2937;color:#fff;padding:.75rem;border-radius:.375rem;max-width:200px;z-index:50;visibility:hidden;opacity:0;transition:opacity .2s;pointer-events:none;left:0;top:0}._3x4ZIcu-.JIt36hCJ{visibility:visible;opacity:1;pointer-events:all}._3x4ZIcu-:before{content:"";position:absolute;width:0;height:0;border:6px solid transparent}._3x4ZIcu-[data-position=top]:before{border-top-color:#1f2937;bottom:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=bottom]:before{border-bottom-color:#1f2937;top:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=left]:before{border-left-color:#1f2937;right:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=right]:before{border-right-color:#1f2937;left:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=top-left]:before{border-top-color:#1f2937;bottom:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=top-right]:before{border-top-color:#1f2937;bottom:-12px;right:12px;left:auto;transform:none}._3x4ZIcu-[data-position=bottom-left]:before{border-bottom-color:#1f2937;top:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=bottom-right]:before{border-bottom-color:#1f2937;top:-12px;right:12px;left:auto;transform:none}')),document.head.appendChild(t)}}catch(e){}}();var oe=Object.defineProperty,ie=(t,e,n)=>((t,e,n)=>e in t?oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const re="_3x4ZIcu-",se="JIt36hCJ",ae={triggerName:"tooltip"};class le{constructor(t=ae){ie(this,"triggerName"),ie(this,"tooltip"),ie(this,"activeTriggerType",null),ie(this,"spacing",12),ie(this,"handleClick",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}][${e}-type="click"]`);if(n)if(this.isVisible())this.hide();else{const t=n.getAttribute(`${e}`);this.show(n,t),this.activeTriggerType="click"}else this.hide()})),ie(this,"handleMouseOver",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);if("click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))){const t=null==n?void 0:n.getAttribute(`${e}`);t&&(this.show(n,t),this.activeTriggerType="hover")}})),ie(this,"handleMouseOut",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);"click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))&&this.hide()})),ie(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),ie(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${re}`,document.body.appendChild(this.tooltip),this.setupEventListeners()}setupEventListeners(){document.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mouseout",this.handleMouseOut),document.addEventListener("touchstart",this.handleMouseOver),document.addEventListener("touchend",this.handleMouseOut),document.addEventListener("click",this.handleClick),window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}isVisible(){return this.tooltip.classList.contains(se)}calculatePosition(t){const e=t.getBoundingClientRect(),n=this.tooltip.getBoundingClientRect(),o=[{name:"top",x:e.left+(e.width-n.width)/2,y:e.top-n.height-this.spacing},{name:"bottom",x:e.left+(e.width-n.width)/2,y:e.bottom+this.spacing},{name:"left",x:e.left-n.width-this.spacing,y:e.top+(e.height-n.height)/2},{name:"right",x:e.right+this.spacing,y:e.top+(e.height-n.height)/2},{name:"top-left",x:e.left,y:e.top-n.height-this.spacing},{name:"top-right",x:e.right-n.width,y:e.top-n.height-this.spacing},{name:"bottom-left",x:e.left,y:e.bottom+this.spacing},{name:"bottom-right",x:e.right-n.width,y:e.bottom+this.spacing}];return o.find((t=>this.fitsInViewport(t,n)))||o[0]}fitsInViewport(t,e){if(!(t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight))return!1;return 0===[[t.x,t.y],[t.x+e.width,t.y],[t.x,t.y+e.height],[t.x+e.width,t.y+e.height],[t.x+e.width/2,t.y+e.height/2]].flatMap((([t,e])=>Array.from(document.elementsFromPoint(t,e)))).filter((t=>{if(this.tooltip.contains(t)||t===this.tooltip||t.classList.contains(re)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(se);const n=this.calculatePosition(t);this.tooltip.style.left=`${n.x}px`,this.tooltip.style.top=`${n.y}px`,this.tooltip.dataset.position=n.name}hide(){this.tooltip.classList.remove(se),this.activeTriggerType=null}destroy(){document.removeEventListener("mouseover",this.handleMouseOver),document.removeEventListener("mouseout",this.handleMouseOut),document.removeEventListener("touchstart",this.handleMouseOver),document.removeEventListener("touchend",this.handleMouseOut),document.removeEventListener("click",this.handleClick),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0),this.tooltip.remove()}}void 0!==window&&(window.SmartTooltip=le);const ce="formeo",de="3.0.8",ue="formeo-sprite",he=[{name:"cssPreload",src:"//cdnjs.cloudflare.com/ajax/libs/loadCSS/2.0.1/cssrelpreload.min.js"},{name:"mutationObserver",src:"//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js"},{name:"fetch",src:"https://unpkg.com/unfetch/polyfill"}],pe=`https://cdn.jsdelivr.net/npm/formeo@${de}/dist/${ue}.svg`,fe=`https://draggable.github.io/formeo/assets/img/${ue}.svg`,me=`https://cdn.jsdelivr.net/npm/formeo@${de}/dist/formeo.min.css`,ge="control-group",ve=`${ce}-stage`,be=`${ce}-row`,ye=`${ce}-column`,we=`${ce}-field`,Ce="custom-column-widths",xe="column-preset",Ee="resizing-columns",Se=new Map([[ve,be],[be,ye],[ye,we]]),Oe=["external","stages","rows","columns","fields"],Ne=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),Ae=[{name:"controls",className:ge},{name:"stage",className:ve},{name:"row",className:be},{name:"column",className:ye},{name:"field",className:we}],_e={controls:ge,stage:ve,row:be,column:ye,field:we},Te=Object.entries(_e).reduce(((t,[e,n])=>({...t,[n]:e})),{}),je=Object.values(_e),Pe=new RegExp(`${je.join("|")}`,"g"),Le=Ae.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),De=Le.slice().map((t=>t.slice().reverse())).reverse(),ke=new Map(Le),$e=new Map(De.slice()),Ie=new Map([[{value:"100.0",label:"100%"}],[{value:"50.0,50.0",label:"50 | 50"},{value:"33.3,66.6",label:"33 | 66"},{value:"66.6,33.3",label:"66 | 33"}],[{value:"33.3,33.3,33.3",label:"33 | 33 | 33"},{value:"25.0,25.0,50.0",label:"25 | 25 | 50"},{value:"50.0,25.0,25.0",label:"50 | 25 | 25"},{value:"25.0,50.0,25.0",label:"25 | 50 | 25"}],[{value:"25.0,25.0,25.0,25.0",label:"25 | 25 | 25 | 25"}],[{value:"20.0,20.0,20.0,20.0,20.0",label:"20 | 20 | 20 | 20 | 20"}],[{value:"16.66,16.66,16.66,16.66,16.66,16.66",label:"16.66 | 16.66 | 16.66 | 16.66 | 16.66 | 16.66"}]].reduce(((t,e,n)=>(t.push([n,e]),t)),[])),Re=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],Me=`${ce}-formData`,Fe=`${ce}-locale`,We=333,Be=Math.round(166.5),ze=Math.round(666),Ue="formeoSaved",qe="formeoUpdated",He="formeoOnRender",Ge=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Ve={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},Xe={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Ve},Ye=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi,Ze=/\bcol-\w+-\d+/g,Je="f-i-",Ke=()=>({id:ws(),stages:{[ws()]:{}},rows:{},columns:{},fields:{}});var Qe=function(){this.__data__=[],this.size=0};var tn=function(t,e){return t===e||t!=t&&e!=e},en=tn;var nn=function(t,e){for(var n=t.length;n--;)if(en(t[n][0],e))return n;return-1},on=nn,rn=Array.prototype.splice;var sn=nn;var an=nn;var ln=nn;var cn=Qe,dn=function(t){var e=this.__data__,n=on(e,t);return!(n<0)&&(n==e.length-1?e.pop():rn.call(e,n,1),--this.size,!0)},un=function(t){var e=this.__data__,n=sn(e,t);return n<0?void 0:e[n][1]},hn=function(t){return an(this.__data__,t)>-1},pn=function(t,e){var n=this.__data__,o=ln(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function fn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=9007199254740991},Ei=On,Si=xi;var Oi=function(t){return null!=t&&Si(t.length)&&!Ei(t)},Ni=Oi,Ai=_;var _i=function(t){return Ai(t)&&Ni(t)},Ti={exports:{}};var ji=function(){return!1};!function(t,e){var n=p,o=ji,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i?n.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}(Ti,Ti.exports);var Pi=Ti.exports,Li=A,Di=ai,ki=_,$i=Function.prototype,Ii=Object.prototype,Ri=$i.toString,Mi=Ii.hasOwnProperty,Fi=Ri.call(Object);var Wi=function(t){if(!ki(t)||"[object Object]"!=Li(t))return!1;var e=Di(t);if(null===e)return!0;var n=Mi.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ri.call(n)==Fi},Bi=A,zi=xi,Ui=_,qi={};qi["[object Float32Array]"]=qi["[object Float64Array]"]=qi["[object Int8Array]"]=qi["[object Int16Array]"]=qi["[object Int32Array]"]=qi["[object Uint8Array]"]=qi["[object Uint8ClampedArray]"]=qi["[object Uint16Array]"]=qi["[object Uint32Array]"]=!0,qi["[object Arguments]"]=qi["[object Array]"]=qi["[object ArrayBuffer]"]=qi["[object Boolean]"]=qi["[object DataView]"]=qi["[object Date]"]=qi["[object Error]"]=qi["[object Function]"]=qi["[object Map]"]=qi["[object Number]"]=qi["[object Object]"]=qi["[object RegExp]"]=qi["[object Set]"]=qi["[object String]"]=qi["[object WeakMap]"]=!1;var Hi=function(t){return Ui(t)&&zi(t.length)&&!!qi[Bi(t)]};var Gi=function(t){return function(e){return t(e)}},Vi={exports:{}};!function(t,e){var n=d,o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,r=i&&i.exports===o&&n.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||r&&r.binding&&r.binding("util")}catch(e){}}();t.exports=s}(Vi,Vi.exports);var Xi=Vi.exports,Yi=Hi,Zi=Gi,Ji=Xi&&Xi.isTypedArray,Ki=Ji?Zi(Ji):Yi;var Qi=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},tr=Mo,er=tn,nr=Object.prototype.hasOwnProperty;var or=function(t,e,n){var o=t[e];nr.call(t,e)&&er(o,n)&&(void 0!==n||e in t)||tr(t,e,n)},ir=or,rr=Mo;var sr=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(ns),rs=Zr,ss=Qr,as=is;var ls=tn,cs=Oi,ds=lr,us=Cn;var hs=function(t,e){return as(ss(t,e,rs),t+"")},ps=function(t,e,n){if(!us(n))return!1;var o=typeof e;return!!("number"==o?cs(n)&&ds(e,n.length):"string"==o&&e in n)&&ls(n[e],t)};var fs=Yr;const ms=a(function(t){return hs((function(e,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(i--,r):void 0,s&&ps(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++ocrypto.randomUUID(),vs=(t="",e)=>{if(!e)return!1;const n=/[|\\{}()[\]^*$+?.]/g;let o="string"==typeof e?[e]:e;o=o.map((t=>"*"===t?"":t.replace(n,"\\$&")));let i=!0;return o.length&&(i=!new RegExp(o.join("|"),"i").exec(t)),i},bs=t=>{var e;const n=null==(e=t.className)?void 0:e.match(Pe);return n&&Te[n[0]]},ys=t=>Array.from(new Set(t)),ws=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||gs(),t.id=e}else e=gs();return e},Cs=(t,e)=>ms({},t,e,((t,e)=>Array.isArray(t)?null!=e?ys(t.concat(e)):e:Array.isArray(e)?null!=t?ys(e.concat(t)):e:void 0)),xs=t=>{let e;if(null===t||!("object"==typeof t)||t instanceof Promise)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(Array.isArray(t)){e=[];for(let n=0,o=t.length;nt/e*100,Ss=t=>`${t.toString()}%`,Os=Object.create(null,{get:{value:t=>{var e;const n=null==(e=window.sessionStorage)?void 0:e.getItem(t);try{return JSON.parse(n)}catch(o){return n}}},set:{value:(t,e)=>{var n;try{return null==(n=window.sessionStorage)?void 0:n.setItem(t,JSON.stringify(e))}catch(o){}}}}),Ns=t=>Oe.some((e=>new RegExp(`^${e}.`).test(t))),As=t=>t.startsWith("external");function _s(t,e=ze){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function Ts(t){return t}function js(){}function Ps(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const Ls=t=>t?xs(Ps(t)):Ke();var Ds=g,ks=P,$s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Is=/^\w*$/;var Rs=function(t,e){if(Ds(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ks(t))||(Is.test(t)||!$s.test(t)||null!=e&&t in Object(e))},Ms=Eo;function Fs(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var o=arguments,i=e?e.apply(this,o):o[0],r=n.cache;if(r.has(i))return r.get(i);var s=t.apply(this,o);return n.cache=r.set(i,s)||r,s};return n.cache=new(Fs.Cache||Ms),n}Fs.Cache=Ms;var Ws=Fs;var Bs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zs=/\\(\\)?/g,Us=function(t){var e=Ws(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Bs,(function(t,n,o,i){e.push(o?i.replace(zs,"$1"):n||t)})),e})),qs=g,Hs=Rs,Gs=Us,Vs=F;var Xs=function(t,e){return qs(t)?t:Hs(t,e)?[t]:Gs(Vs(t))},Ys=P;var Zs=function(t){if("string"==typeof t||Ys(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Js=or,Ks=Xs,Qs=lr,ta=Cn,ea=Zs;var na=function(t,e,n,o){if(!ta(t))return t;for(var i=-1,r=(e=Ks(e,t)).length,s=r-1,a=t;null!=a&&++iNumber.isInteger(Number(t)),da=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},ua=(t,e,n)=>{const o=n.split("||"),i=ys(e).map((e=>t.find((t=>{const n=o.find((e=>!!aa(t,e)));return n&&aa(t,n)===e})))).filter(Boolean).concat(t);return ys(i)},ha=(t,e,n)=>{for(let o=0;o{const n=[];return ha(t,((t,o)=>n.push(e(t,o)))),n},fa={},ma=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),ga=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),va={capitalize:ma,safeAttrName:t=>{if(fa[t])return fa[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return fa[t]=e,e},forEach:ha,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:pa,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:da,isInt:ca,get:aa,orderObjectsBy:ua,isIE:ga},ba={getStyle:(t,e=!1)=>{let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n},fadeOut:(t,e=250)=>{const n=1/(e/60);t.style.opacity=1,function e(){const o=Number(t.style.opacity)-n;o>0?(t.style.opacity=o,window.requestAnimationFrame(e)):t.remove()}()},slideDown:(t,e=250,n=!1)=>{t.style.display="block";const o=ba.getStyle(t),i=parseInt(o.height,10),r=i/(e/60);t.style.height="0px",function e(){const o=parseFloat(t.style.height),s=o+r;o{const o=ba.getStyle(t),i=parseInt(o.height),r=o.overflow;t.style.overflow="hidden",t.style.height=i+"px";const s=o.minHeight;t.style.minHeight="auto";const a=parseFloat(i/(e/60)).toFixed(2);!function e(){const o=parseInt(t.style.height,10)-a;o>0?(t.style.height=o+"px",window.requestAnimationFrame(e)):(t.style.overflow=r,t.style.display="none",t.style.minHeight=s,delete t.style.height,n&&n(t))}()},slideToggle:(t,e=250,n="none"===ba.getStyle(t,"display"))=>{n?ba.slideDown(t,e):ba.slideUp(t,e)}},ya="no-transition",wa={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=xa.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=xa.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=xa.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=xa.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=xa.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=xa.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},Ca=({src:t,...e},n=qe)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=xa.opts)?void 0:o.debug)||(null==(i=xa.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},xa={init:function(t){return this.opts={...wa,...t},this},formeoSaved:t=>Ca(t,Ue),formeoUpdated:t=>Ca(t,qe),formeoCleared:t=>Ca(t,"formeoCleared"),formeoOnRender:t=>Ca(t,He),formeoConditionUpdated:t=>Ca(t,"formeoConditionUpdated")},Ea=_s((()=>{xa.opts.onUpdate({timeStamp:window.performance.now(),type:qe,detail:rh.formData})}),Be);let Sa;document.addEventListener(qe,Ea),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;xa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;xa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;xa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;xa.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(He,(t=>{const{timeStamp:e,type:n,detail:o}=t;xa.opts.onRender({timeStamp:e,type:n,detail:o})})),document.addEventListener("confirmClearAll",(t=>{t={timeStamp:t.timeStamp,type:t.type,confirmationMessage:t.detail.confirmationMessage,clearAllAction:t.detail.clearAllAction,btnCoords:t.detail.btnCoords},xa.opts.confirmClearAll(t)})),document.addEventListener(Ue,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};xa.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{xa.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){Sa=Sa||window.requestAnimationFrame((()=>{Sa=!1;for(const t of Object.values(eh.data))t.dom.classList.add(ya),oh.dom.classList.add(ya),oh.panels.nav.refresh(),t.refreshFieldPanels()}))}));var Oa=Eo,Na=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Aa=function(t){return this.__data__.has(t)};function _a(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Oa;++ea))return!1;var c=r.get(t),d=r.get(e);if(c&&d)return c==e&&d==t;var u=-1,h=!0,p=2&n?new Ta:void 0;for(r.set(t,e),r.set(e,t);++uJSON.stringify(t,null,e))),e(this,"get",(t=>aa(this.data,t))),e(this,"getChangeType",((t,e)=>{const n=Re.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),e(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||ws();return this.set(o,e)})),e(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):o&&delete o[n],o})),e(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),e(this,"setCallbacks",{}),e(this,"configVal",Object.create(null)),this.name=t,this.data=n,this.dataPath=""}get size(){return Object.keys(this.data).length}get js(){return this.data}get json(){return this.data}set(t,e){const n=aa(this.data,t);if(zl(n,e))return this.data;const o=la(this.data,t,e),i=Array.isArray(t)?t.join("."):t,r=Object.keys(this.setCallbacks).filter((t=>new RegExp(t).test(i))),s={newVal:e,oldVal:n,path:t};for(const a of r)for(const t of this.setCallbacks[a])t(s);if(!this.disableEvents){const i=this.getChangeType(n,e),r={entity:this,dataPath:this.dataPath.replace(/\.+$/,""),changePath:this.dataPath+t,value:e,data:o,change:`${i.type}: ${i.desc}`,src:this.dom};n&&(r.previousValue=n),xa.formeoUpdated(r)}return o}addSetCallback(t,e){this.setCallbacks[t]?this.setCallbacks[t].push(e):this.setCallbacks[t]=[e]}removeSetCallback(t,e){this.setCallbacks[t]=this.setCallbacks[t].filter((t=>t!==e))}empty(){this.data=Object.create(null)}}function ql(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function Hl(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Zl(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var Jl=Zl(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Kl=Zl(/Edge/i),Ql=Zl(/firefox/i),tc=Zl(/safari/i)&&!Zl(/chrome/i)&&!Zl(/android/i),ec=Zl(/iP(ad|od|hone)/i),nc=Zl(/chrome/i)&&Zl(/android/i),oc={capture:!1,passive:!1};function ic(t,e,n){t.addEventListener(e,n,!Jl&&oc)}function rc(t,e,n){t.removeEventListener(e,n,!Jl&&oc)}function sc(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(n){return!1}return!1}}function ac(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function lc(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&sc(t,e):sc(t,e))||o&&t===n)return t;if(t===n)break}while(t=ac(t))}return null}var cc,dc=/\s+/g;function uc(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(dc," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(dc," ")}}function hc(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function pc(t,e){var n="";if("string"==typeof t)n=t;else do{var o=hc(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function fc(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=gc(o)[n]))return o;if(o===mc())break;o=xc(o,!1)}return!1}function bc(t,e,n,o){for(var i=0,r=0,s=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Yl(n,Dc);Lc.pluginEvent.bind(Nd)(t,e,Hl({dragEl:Ic,parentEl:Rc,ghostEl:Mc,rootEl:Fc,nextEl:Wc,lastDownEl:Bc,cloneEl:zc,cloneHidden:Uc,dragStarted:nd,putSortable:Yc,activeSortable:Nd.active,originalEvent:o,oldIndex:qc,oldDraggableIndex:Gc,newIndex:Hc,newDraggableIndex:Vc,hideGhostForTarget:xd,unhideGhostForTarget:Ed,cloneNowHidden:function(){Uc=!0},cloneNowShown:function(){Uc=!1},dispatchSortableEvent:function(t){$c({sortable:e,name:t,originalEvent:o})}},i))};function $c(t){!function(t){var e=t.sortable,n=t.rootEl,o=t.name,i=t.targetEl,r=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,u=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[_c]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||Jl||Kl?(m=document.createEvent("Event")).initEvent(o,!0,!0):m=new CustomEvent(o,{bubbles:!0,cancelable:!0}),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=r,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=u,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=Hl(Hl({},f),Lc.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(Hl({putSortable:Yc,cloneEl:zc,targetEl:Ic,rootEl:Fc,oldIndex:qc,oldDraggableIndex:Gc,newIndex:Hc,newDraggableIndex:Vc},t))}var Ic,Rc,Mc,Fc,Wc,Bc,zc,Uc,qc,Hc,Gc,Vc,Xc,Yc,Zc,Jc,Kc,Qc,td,ed,nd,od,id,rd,sd,ad=!1,ld=!1,cd=[],dd=!1,ud=!1,hd=[],pd=!1,fd=[],md="undefined"!=typeof document,gd=ec,vd=Kl||Jl?"cssFloat":"float",bd=md&&!nc&&!ec&&"draggable"in document.createElement("div"),yd=function(){if(md){if(Jl)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),wd=function(t,e){var n=hc(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=bc(t,0,e),r=bc(t,1,e),s=i&&hc(i),a=r&&hc(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+gc(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+gc(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&"none"!==s.float){var d="left"===s.float?"left":"right";return!r||"both"!==a.clear&&a.clear!==d?"horizontal":"vertical"}return i&&("block"===s.display||"flex"===s.display||"table"===s.display||"grid"===s.display||l>=o&&"none"===n[vd]||r&&"none"===n[vd]&&l+c>o)?"vertical":"horizontal"},Cd=function(t){function e(t,n){return function(o,i,r,s){var a=o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name;if(null==t&&(n||a))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(o,i,r,s),n)(o,i,r,s);var l=(n?o:i).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},o=t.group;o&&"object"==Gl(o)||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},xd=function(){!yd&&Mc&&hc(Mc,"display","none")},Ed=function(){!yd&&Mc&&hc(Mc,"display","")};md&&!nc&&document.addEventListener("click",(function(t){if(ld)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ld=!1,!1}),!0);var Sd=function(t){if(Ic){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,cd.some((function(t){var e=t[_c].options.emptyInsertThreshold;if(e&&!yc(t)){var n=gc(t),o=i>=n.left-e&&i<=n.right+e,a=r>=n.top-e&&r<=n.bottom+e;return o&&a?s=t:void 0}})),s);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[_c]._onDragOver(n)}}var i,r,s},Od=function(t){Ic&&Ic.parentNode[_c]._isOutsideThisEl(t.target)};function Nd(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=Xl({},e),t[_c]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return wd(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Nd.supportPointer&&"PointerEvent"in window&&!tc,emptyInsertThreshold:5};for(var o in Lc.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in Cd(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&bd,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?ic(t,"pointerdown",this._onTapStart):(ic(t,"mousedown",this._onTapStart),ic(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(ic(t,"dragover",this),ic(t,"dragenter",this)),cd.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Xl(this,Tc())}function Ad(t,e,n,o,i,r,s,a){var l,c,d=t[_c],u=d.options.onMove;return!window.CustomEvent||Jl||Kl?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=n,l.draggedRect=o,l.related=i||e,l.relatedRect=r||gc(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function _d(t){t.draggable=!1}function Td(){pd=!1}function jd(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Pd(t){return setTimeout(t,0)}function Ld(t){return clearTimeout(t)}Nd.prototype={constructor:Nd,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(od=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Ic):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,r=t.type,s=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=o.filter;if(function(t){fd.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&fd.push(o)}}(n),!Ic&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!tc||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=lc(a,o.draggable,n,!1))&&a.animated||Bc===a)){if(qc=wc(a),Gc=wc(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return $c({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),kc("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=lc(l,o.trim(),n,!1))return $c({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),kc("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!lc(l,o.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,s=i.options,a=r.ownerDocument;if(n&&!Ic&&n.parentNode===r){var l=gc(n);if(Fc=r,Rc=(Ic=n).parentNode,Wc=Ic.nextSibling,Bc=n,Xc=s.group,Nd.dragged=Ic,Zc={target:Ic,clientX:(e||t).clientX,clientY:(e||t).clientY},td=Zc.clientX-l.left,ed=Zc.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Ic.style["will-change"]="all",o=function(){kc("delayEnded",i,{evt:t}),Nd.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Ql&&i.nativeDraggable&&(Ic.draggable=!0),i._triggerDragStart(t,e),$c({sortable:i,name:"choose",originalEvent:t}),uc(Ic,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){fc(Ic,t.trim(),_d)})),ic(a,"dragover",Sd),ic(a,"mousemove",Sd),ic(a,"touchmove",Sd),ic(a,"mouseup",i._onDrop),ic(a,"touchend",i._onDrop),ic(a,"touchcancel",i._onDrop),Ql&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Ic.draggable=!0),kc("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Kl||Jl))o();else{if(Nd.eventCanceled)return void this._onDrop();ic(a,"mouseup",i._disableDelayedDrag),ic(a,"touchend",i._disableDelayedDrag),ic(a,"touchcancel",i._disableDelayedDrag),ic(a,"mousemove",i._delayedDragTouchMoveHandler),ic(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&ic(a,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,s.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Ic&&_d(Ic),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;rc(t,"mouseup",this._disableDelayedDrag),rc(t,"touchend",this._disableDelayedDrag),rc(t,"touchcancel",this._disableDelayedDrag),rc(t,"mousemove",this._delayedDragTouchMoveHandler),rc(t,"touchmove",this._delayedDragTouchMoveHandler),rc(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?ic(document,"pointermove",this._onTouchMove):ic(document,e?"touchmove":"mousemove",this._onTouchMove):(ic(Ic,"dragend",this),ic(Fc,"dragstart",this._onDragStart));try{document.selection?Pd((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(ad=!1,Fc&&Ic){kc("dragStarted",this,{evt:e}),this.nativeDraggable&&ic(document,"dragover",Od);var n=this.options;!t&&uc(Ic,n.dragClass,!1),uc(Ic,n.ghostClass,!0),Nd.active=this,t&&this._appendGhost(),$c({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Jc){this._lastX=Jc.clientX,this._lastY=Jc.clientY,xd();for(var t=document.elementFromPoint(Jc.clientX,Jc.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Jc.clientX,Jc.clientY))!==e;)e=t;if(Ic.parentNode[_c]._isOutsideThisEl(t),e)do{if(e[_c]){if(e[_c]._onDragOver({clientX:Jc.clientX,clientY:Jc.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=ac(e));Ed()}},_onTouchMove:function(t){if(Zc){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=Mc&&pc(Mc,!0),s=Mc&&r&&r.a,a=Mc&&r&&r.d,l=gd&&sd&&Cc(sd),c=(i.clientX-Zc.clientX+o.x)/(s||1)+(l?l[0]-hd[0]:0)/(s||1),d=(i.clientY-Zc.clientY+o.y)/(a||1)+(l?l[1]-hd[1]:0)/(a||1);if(!Nd.active&&!ad){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))i.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}(t,i,this)&&!m.animated){if(m===Ic)return P(!1);if(m&&r===t.target&&(s=m),s&&(n=gc(s)),!1!==Ad(Fc,r,Ic,e,s,n,t,!!s))return j(),m&&m.nextSibling?r.insertBefore(Ic,m.nextSibling):r.appendChild(Ic),Rc=r,L(),P(!0)}else if(m&&function(t,e,n){var o=gc(bc(n.el,0,n.options,!0)),i=Ac(n.el,n.options,Mc),r=10;return e?t.clientXd+c*r/2:lu-rd)return-id}else if(l>d+c*(1-i)/2&&lu-c*r/2))return l>d+c/2?1:-1;return 0}(t,s,n,i,C?1:a.swapThreshold,null==a.invertedSwapThreshold?a.swapThreshold:a.invertedSwapThreshold,ud,od===s),0!==v){var O=wc(Ic);do{O-=v,y=Rc.children[O]}while(y&&("none"===hc(y,"display")||y===Mc))}if(0===v||y===s)return P(!1);od=s,id=v;var N=s.nextElementSibling,A=!1,_=Ad(Fc,r,Ic,e,s,n,t,A=1===v);if(!1!==_)return 1!==_&&-1!==_||(A=1===_),pd=!0,setTimeout(Td,30),j(),A&&!N?r.appendChild(Ic):s.parentNode.insertBefore(Ic,A?N:s),E&&Oc(E,0,S-E.scrollTop),Rc=Ic.parentNode,void 0===b||ud||(rd=Math.abs(b-gc(s)[x])),L(),P(!0)}if(r.contains(Ic))return P(!1)}return!1}function T(a,l){kc(a,p,Hl({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:P,onMove:function(n,o){return Ad(Fc,r,Ic,e,n,gc(n),t,o)},changed:L},l))}function j(){T("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function P(e){return T("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(uc(Ic,Yc?Yc.options.ghostClass:c.options.ghostClass,!1),uc(Ic,a.ghostClass,!0)),Yc!==p&&p!==Nd.active?Yc=p:p===Nd.active&&Yc&&(Yc=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){T("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===Ic&&!Ic.animated||s===r&&!s.animated)&&(od=null),a.dragoverBubble||t.rootEl||s===document||(Ic.parentNode[_c]._isOutsideThisEl(t.target),!e&&Sd(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){Hc=wc(Ic),Vc=wc(Ic,a.draggable),$c({sortable:p,name:"change",toEl:r,newIndex:Hc,newDraggableIndex:Vc,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){rc(document,"mousemove",this._onTouchMove),rc(document,"touchmove",this._onTouchMove),rc(document,"pointermove",this._onTouchMove),rc(document,"dragover",Sd),rc(document,"mousemove",Sd),rc(document,"touchmove",Sd)},_offUpEvents:function(){var t=this.el.ownerDocument;rc(t,"mouseup",this._onDrop),rc(t,"touchend",this._onDrop),rc(t,"pointerup",this._onDrop),rc(t,"touchcancel",this._onDrop),rc(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;Hc=wc(Ic),Vc=wc(Ic,n.draggable),kc("drop",this,{evt:t}),Rc=Ic&&Ic.parentNode,Hc=wc(Ic),Vc=wc(Ic,n.draggable),Nd.eventCanceled||(ad=!1,ud=!1,dd=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ld(this.cloneId),Ld(this._dragStartId),this.nativeDraggable&&(rc(document,"drop",this),rc(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),tc&&hc(document.body,"user-select",""),hc(Ic,"transform",""),t&&(nd&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),Mc&&Mc.parentNode&&Mc.parentNode.removeChild(Mc),(Fc===Rc||Yc&&"clone"!==Yc.lastPutMode)&&zc&&zc.parentNode&&zc.parentNode.removeChild(zc),Ic&&(this.nativeDraggable&&rc(Ic,"dragend",this),_d(Ic),Ic.style["will-change"]="",nd&&!ad&&uc(Ic,Yc?Yc.options.ghostClass:this.options.ghostClass,!1),uc(Ic,this.options.chosenClass,!1),$c({sortable:this,name:"unchoose",toEl:Rc,newIndex:null,newDraggableIndex:null,originalEvent:t}),Fc!==Rc?(Hc>=0&&($c({rootEl:Rc,name:"add",toEl:Rc,fromEl:Fc,originalEvent:t}),$c({sortable:this,name:"remove",toEl:Rc,originalEvent:t}),$c({rootEl:Rc,name:"sort",toEl:Rc,fromEl:Fc,originalEvent:t}),$c({sortable:this,name:"sort",toEl:Rc,originalEvent:t})),Yc&&Yc.save()):Hc!==qc&&Hc>=0&&($c({sortable:this,name:"update",toEl:Rc,originalEvent:t}),$c({sortable:this,name:"sort",toEl:Rc,originalEvent:t})),Nd.active&&(null!=Hc&&-1!==Hc||(Hc=qc,Vc=Gc),$c({sortable:this,name:"end",toEl:Rc,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){kc("nulling",this),Fc=Ic=Rc=Mc=Wc=zc=Bc=Uc=Zc=Jc=nd=Hc=Vc=qc=Gc=od=id=Yc=Xc=Nd.dragged=Nd.ghost=Nd.clone=Nd.active=null,fd.forEach((function(t){t.checked=!0})),fd.length=Kc=Qc=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Ic&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;o{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(ne.get("attributeNotPermitted",e||"")),Xd.add.attrs(t);let n;e&&(n=String(window.prompt(t.message.value,"")),t.addAction(e,n))},option:t=>{t.addAction()},condition:t=>{t.addAction(t)}},click:{btn:t=>{t.action()}},save:{form:Ts}},Xd={init:function(t){const e=Object.keys(Vd);return this.opts=e.reduce(((e,n)=>(e[n]={...Vd[n],...t[n]},e)),t),this},add:{attrs:t=>Xd.opts.add.attr(t),options:t=>Xd.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},Xd.opts.add.condition(t))},click:{btn:t=>Xd.opts.click.btn(t)},save:{form:t=>(Xd.opts.sessionStorage&&Os.set(Me,t),xa.formeoSaved({formData:t}),Xd.opts.save.form(t))}},Yd=Object.freeze({type:"field",displayType:"slider"}),Zd=t=>({transform:`translateX(${t?`${t}px`:0})`});class Jd{constructor(t){e(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),e(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=lh.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=Cs(Yd,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const n=this.createPanelsWrap();this.nav=this.navActions();const o=new window.ResizeObserver((([{contentRect:{width:t}}])=>{this.currentWidth!==t&&(this.toggleTabbedLayout(),this.currentWidth=t,this.nav.setTranslateX(this.activePanelIndex,!1))})),i=window.setTimeout((()=>{o.observe(n),window.clearTimeout(i)}),ze)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(lh.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Yd.displayType,this.panelDisplay}createPanelsWrap(){const t=lh.create({className:"panels",content:this.opts.panels.map((({config:t,...e})=>e))});return"field"===this.opts.type&&this.sortableProperties(t),this.panelsWrap=t,this.panels=t.children,this.currentPanel=this.panels[this.activePanelIndex],t}sortableProperties(t){const e=t.getElementsByClassName("field-edit-group");return va.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&Nd.create(t,{animation:150,group:{name:`edit-${t.editGroup}`,pull:!0,put:["properties"]},sort:!0,handle:".prop-order",onSort:t=>{this.propertySave(t.to),this.resizePanels()}})}))}createPanelNavLabels(){const t=this.opts.panels.map((t=>({tag:"h5",action:{click:t=>{const e=da(t.target,t.target.parentElement);this.nav.setTranslateX(e,!1),this.nav.groupChange(e)}},content:t.config.label}))),e={className:"panel-labels",content:{content:t}},[n]=t;return n.className="active-tab",lh.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:ne.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:lh.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:ne.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:lh.icon("triangle-left")};return lh.create({tag:"nav",attrs:{className:"panel-nav"},content:[e,this.labels,t]})}get isTabbed(){return"tabbed"===this.panelDisplay}navActions(){const t={},e=this.currentPanel.parentElement,n=this.labels.firstChild,o=n.children,i=this.currentPanel.parentElement.childNodes;this.activePanelIndex=da(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],lh.removeClasses(i,"active-panel"),lh.removeClasses(o,"active-tab"),this.currentPanel.classList.add("active-panel"),o[t].classList.add("active-tab"),this.currentPanel);const a=({offset:t,reset:o,duration:i=Be,animate:r=!this.isTabbed})=>{const a=[Zd(s.panel),Zd(t.panel)],l=[Zd(s.nav),Zd(this.isTabbed?0:t.nav)];if(o){const[t]=a,[e]=l;a.push(t),l.push(e)}const c={easing:"ease-in-out",duration:r?i:0,fill:"forwards"},d=e.animate(a,c);n.animate(l,c);const u=()=>{this.panelsWrap.style.height=lh.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",u),o||(s=t)};d.addEventListener("finish",u)};return t.setTranslateX=(t=this.activePanelIndex,o=!0)=>{var i;i=t,r={nav:-n.offsetWidth*i,panel:-e.offsetWidth*i},a({offset:r,animate:o})},t.refresh=(e=this.activePanelIndex)=>{this.activePanelIndex!==e&&t.groupChange(e),t.setTranslateX(this.activePanelIndex,!1),this.resizePanels()},t.nextGroup=()=>{const e=this.activePanelIndex+1;if(e!==i.length){const o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:s.nav-8,panel:s.panel-8},a({offset:r,reset:!0});return this.currentPanel},t.prevGroup=()=>{if(0!==this.activePanelIndex){const e=this.activePanelIndex-1,o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:8,panel:8},a({offset:r,reset:!0})},t}}const Kd="a an and as at but by for for from in into near nor of on onto or the to with".split(" ").map((t=>`\\s${t}\\s`)),Qd=new RegExp(`(?!${Kd.join("|")})\\w\\S*`,"g"),tu=/\s+/g;function eu(t){if("string"!=typeof t)return t;if(t.trim().match(tu))return t;return t.replace(Qd,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const nu=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),ou="f-autocomplete",iu="highlight-component",ru=({name:t,id:e,...n})=>["config.label","config.controlId","meta.id","attrs.id"].reduce(((t,e)=>t||n.get(e)),null)||"external"===t&&((...t)=>ne.get(t.join("."))||eu(t.join(" ")))(t,e);class su{constructor(t,n,o){e(this,"lastCache",Date.now()),e(this,"optionsCache",null),this.key=t,this.className=t.replace(/\./g,"-"),this.value=n,this.events=[],this.i18nKey=o,this.build()}build(){const t=t=>{const e=this.list,n=this.getActiveOption();let o=new Map([[38,()=>{const t=this.getPreviousOption(n);t&&this.selectOption(t)}],[40,()=>{const t=this.getNextOption(n);t&&this.selectOption(t)}],[13,()=>{n&&(this.selectOption(n),this.setValue(n),"none"===e.style.display?this.showList(n):this.hideList()),t.preventDefault()}],[27,()=>{this.hideList()}]]).get(t.keyCode);return o||(o=()=>!1),o()},e={focus:({target:e})=>{this.updateOptions(),e.parentElement.classList.add(`${this.className}-focused`);const n=lh.toggleElementsByStr(this.list.querySelectorAll("li"),e.value);e.addEventListener("keydown",t);const o=this.list.querySelector(".active-option")||n[0];this.showList(o)},blur:({target:e})=>{e.parentElement.classList.remove(`${this.className}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const e=lh.toggleElementsByStr(this.list.querySelectorAll("li"),t.target.value);if(0===t.target.value.length&&this.clearValue(),0===e.length)this.hideList();else{const t=this.getActiveOption()||e[0];this.showList(t)}const n=t.target.value.trim();this.hiddenField.value=n,this.value=n,this.setValue({dataset:{label:n,value:n}})}};return this.displayField=lh.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${ou}-display-field`,value:this.label||this.value,placeholder:ne.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=lh.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=lh.create({tag:"ul",attrs:{className:`${ou}-list`}}),this.dom=lh.create({children:[this.displayField,this.hiddenField],className:this.className,action:{onRender:t=>{this.stage=t.closest(".formeo-stage");const e=this.value&&rh.getAddress(this.value);this.label=e&&ru(e),this.label&&(this.displayField.value=this.label)}}}),this.dom}updateOptions(){let t=this.optionsCache;const e=Date.now();(!t||e-this.lastCache>10*ze)&&(lh.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){const t=(t=>{const e=[],n=rh.flatList(),o=Object.entries(n).map((([n,o])=>{const i=ru(o);if(i){const r={tag:"span",content:` ${eu(o.name)}`,className:"component-type"},s=`${o.name}.${i}`;e.push(s);const a=((t,e)=>{const n=t.reduce(((t,n)=>t+(n===e)),0);return n>1?`(${n})`:""})(e,s),l=[`${i} `,{tag:"span",content:a,className:"component-label-count"},r];return(({id:t,textLabel:e,htmlLabel:n,selectedId:o})=>{const i={value:t,textLabel:e,htmlLabel:n};return t===o&&(i.selected=!0),i})({id:n,textLabel:[i,a].join(" ").trim(),htmlLabel:l,selectedId:t})}}));return o.filter(Boolean)})(),e=t=>{const e=`${ou}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return this.optionsCache=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${ou}-list-item`,action:{mousedown:({target:t})=>{t=e(t),this.setValue(t),this.selectOption(t),this.hideList()},mouseover:({target:t})=>{t=e(t),this.removeHighlight(),this.highlightComponent(t)}}};return lh.create(r)})),this.optionsCache}setListPosition(){const{offsetHeight:t,offsetWidth:e}=this.displayField,n=this.displayField.closest(".formeo-stage").getBoundingClientRect(),o=this.displayField.getBoundingClientRect(),i={position:"absolute",top:o.y+t+window.scrollY-n.y+"px",left:o.x+window.scrollX-n.x+"px",width:`${e+1}px`};Object.assign(this.list.style,i)}showList(t,e=this.list){this.stage.contains(this.list)||this.stage.appendChild(this.list),this.setListPosition(),this.selectOption(t),ba.slideDown(e,Be)}hideList(t=this.list){ba.slideUp(t,Be),this.removeHighlight(),this.stage.contains(this.list)&&this.stage.removeChild(this.list)}getActiveOption(t=this.list){const e=t.querySelector(".active-option");return"none"!==(null==e?void 0:e.style.display)?e:null}getPreviousOption(t){let e=t;do{e=e?e.previousSibling:null}while(null!=e&&"none"===e.style.display);return e}getNextOption(t){let e=t;do{e=e?e.nextSibling:null}while(null!=e&&"none"===e.style.display);return e}selectOption(t,e=this.list){var n;const o=e.querySelectorAll("li");for(const i of o){const{dataset:{value:t}}=i;if(i.classList.remove("active-option"),t){null==(n=rh.getAddress(t).dom)||n.classList.remove(iu)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(iu);for(const e of t)e.classList.remove(iu)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=rh.getAddress(n).dom)||e.classList.add(iu)}}clearValue(){this.selectOption(null),this.displayField.value="",this.hiddenField.value="",this.value="",this.runEvent("onChange",{target:this.hiddenField})}setValue(t){const{label:e,value:n}=t.dataset;this.displayField.value=e,this.hiddenField.value=n,this.value=n,this.runEvent("onChange",{target:this.hiddenField})}addEvent(t,e){this.events.push([t,e])}runEvent(t,e){for(const[n,o]of this.events)n===t&&o(e)}}const au=(t,e)=>{const n=(t=>{const e=As(t),n={"field.property":Ve,...Xe},o=e?(i=t,rh.getAddress(i).getData()):n[t];var i;return Object.keys(o).reduce(((t,e)=>(t[e]=e,t)),{})})(t);return Object.entries(n).reduce(((n,[o,i])=>{if("id"!==o){const r={tag:"option",content:ne.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(r.attrs.selected=!0),n.push(lh.create(r))}return n}),[])},lu=(t,e)=>{lh.empty(t);for(const n of e)t.add(n)},cu=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:ne.get(`${t}.placeholder`)||eu(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},du=t=>{const e=ne.get(t);if(e)return e;const n=t.split(".");return ne.get(n[n.length-1])},uu={autocomplete:(t,e,n)=>new su(t,e,n),string:(t,e)=>cu({key:t,value:e}),boolean:(t,e)=>cu({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>cu({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:du(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>uu[lh.childType(e)](t,e)))},hu=["selected","checked"],pu={boolean:(t,e)=>({click:({target:{checked:n}})=>{var o,i;"radio"===(null==(i=null==(o=e.data)?void 0:o.attrs)?void 0:i.type)&&e.set("options",e.data.options.map((t=>({...t,selected:!1})))),e.set(t,n)}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n)}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n))}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n)}}),object:()=>({})};class fu{constructor({key:t,data:n,index:o,field:i}){e(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:ne.get(t)||t};return e.map(((e,o)=>{const i=[],r=Object.entries(e).map((([e,n])=>{const r=this.conditionInput(e,n,t,o);return r&&i.push([r.className,n.trim()].filter(Boolean).join("-")),r})).filter(Boolean),s=ua(r,Ge.map((t=>`condition-${t}`)),"className||dom.className");return this.processConditionUIState(s),o||s.unshift(n),this.itemFieldGroups.push(s),{children:s,className:`f-condition-row ${t}-condition-row ${i.join(" ")}`}}))})),e(this,"processConditionUIState",(t=>{const e=e=>(e=e.split("|"),t.filter((t=>e.includes(t.className)))),n=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.style.display="none"})),clearTimeout(e)}),We)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),We)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=As(t.value)?t.value:"field.property",a=au(s,r.value);return lu(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Ns(t.value)&&t.value?o(i):n(i)}],["condition-sourceProperty",t=>{const i=e("condition-comparison|condition-targetProperty|condition-target"),r=t.value;return(t=>/^is|^has/.test(t))(r.substring(r.lastIndexOf(".")+1,r.length))?n(i):o(i)}]]);for(const r of t){const t=i.get(r.className);t&&t(r)}})),e(this,"conditionInput",((t,e,n,o)=>{const i=this.field,r=`${this.itemKey}.${n}.${o}`,s=`${this.field.id}.${r}`,a=`${i.name}s.${s}.${t}`,l=(t,e,n)=>{const o=au(n||t,e),i=uu.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=lh.create(i);return lu(r,o),r},c=({target:t})=>{const e=t.closest(".f-condition-row"),n=new RegExp(`${t.className}(?:\\S?)+`,"gm");e.className=e.className.replace(n,"");const o={dataPath:a,value:t.value,src:t};xa.formeoUpdated(o),rh.setAddress(a,t.value);const i=da(e);this.processConditionUIState(this.itemFieldGroups[i])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=uu.autocomplete(`condition.${e}`,t,n);return rh.setConditionMap(t,i),o.addEvent("onChange",(t=>{rh.removeConditionMap(rh.getAddress(a)),c(t),rh.setConditionMap(t.target.value,i)})),o},sourceProperty:t=>l("sourceProperty",t,"field.property"),targetProperty:t=>l("targetProperty",t,"field.property"),target:t=>d.source(t,"target"),value:t=>{const e=uu.string("condition.value",t);return e.action={input:c},lh.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=ua(Object.entries(n),hu,"0");const[r,s]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=r,this.isDisabled=i.isDisabledProp(s,r),this.isHidden=this.isDisabled&&i.config.panels[r].hideDisabled,this.isLocked=i.isLockedProp(s,r),this.dom=lh.create({tag:"li",className:[`field-${t.replace(/\./g,"-")}`,"prop-wrap",this.isHidden&&"hidden-property"],children:{className:"field-prop",children:[this.itemInputs,this.itemControls]}})}get itemInputs(){this.itemFieldGroups=[];return{className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>{let n="conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e);return["selected","checked"].includes(t)&&(n={className:"f-addon",children:n}),n}))}}get itemControls(){if(this.isLocked){return{className:`${this.panelName}-prop-controls prop-controls`,content:[]}}const t={tag:"button",attrs:{type:"button",className:"prop-remove prop-control"},action:{click:()=>{ba.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),lh.remove(t),this.field.resizePanelWrap()}))}},content:lh.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=lh.childType(e)||"string",o={config:{},attrs:{},...uu[n](t,e)},i=this.itemKey.replace(/.\d+$/,(e=>`${e}.${t}`)),r=i.split(".").filter(Number.isNaN).join(".")||t,[s,a]=[[...this.itemKey.split("."),t],[t]].map((t=>[this.field.id,...t].filter(Boolean).join("-")));return o.config={...o.config,label:"options"!==this.panelName&&(du(r)||eu(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...pu[n](i,this.field)},o}}class mu{constructor(t,n,o){e(this,"addAttribute",((t,e)=>{let n=e;const o=nu(t),i=`attrs.${o}`;ne.current[i]||ne.put(i,ma(t)),"string"==typeof n&&["true","false"].includes(n)&&(n=JSON.parse(n)),this.field.set(`attrs.${t}`,n);const r=this.props.querySelector(`.field-attrs-${o}`),s=new fu({key:i,data:{[o]:n},field:this.field});r?this.props.replaceChild(s.dom,r):this.props.appendChild(s.dom),this.field.resizePanelWrap()})),e(this,"addOption",(()=>{const t=this.field.data.config.controlId,e=this.field.get("options"),n="select"===t?"option":t,o=ne.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,r=e[e.length-1],s={...e.length?r:{},label:o};"button"!==t&&(s.value=nu(o));const a=new fu({key:i,data:s,field:this.field,index:this.props.children.length});this.editPanelItems.push(a),this.props.appendChild(a.dom),this.field.set(i,s),this.field.resizePanelWrap()})),e(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new fu({key:e,data:t.template,field:this.field});n?this.props.replaceChild(o.dom,n):this.props.appendChild(o.dom),this.field.set(e,t.template),this.field.resizePanelWrap()})),this.type=lh.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=n,this.field=o,this.panelConfig=this.getPanelConfig(this.data)}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{id:`${this.field.id}-${this.name}-panel`,config:{label:ne.get(`panel.label.${this.name}`)},attrs:{className:`f-panel ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=[this.name,n?String(e):t[0]].join("."),i=n?t:{[t[0]]:t[1]};return new fu({key:o,data:i,field:this.field})}));const e={tag:"ul",attrs:{className:["field-edit-group",`field-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return lh.create(e)}createEditButtons(){const t=this,e=this.name,n=ne.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...lh.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:lh.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:ne.get(`action.add.${e}.attr`),value:ne.get(`action.add.${e}.value`)});const r=eu(e),s=new window.CustomEvent(`onAdd${r}`,{detail:i});Xd.add[e](i),document.dispatchEvent(s)}}}]}}}class gu extends Ul{constructor(t,n={},o){const i={...n,id:n.id||ws()};super(t,i),e(this,"mutationHandler",(t=>t.map((t=>{})))),e(this,"remove",(t=>{if(t){const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?ca(n)?o.splice(Number(n),1):this.set(e,o.filter((t=>t!==n))):delete o[n],o}if("stage"===this.name)return null;const e=this.parent,n=this.children;return ha(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(rh.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),rh[`${this.name}s`].delete(this.id)})),e(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),e(this,"getComponentTag",(()=>lh.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&lh.icon("component-corner",{className:"bottom-left"}),lh.icon(`handle-${this.name}`),eu(this.name),(this.isColumn||this.isRow)&&lh.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),e(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[lh.childType(t)](this.dom)})),e(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),e(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),e(this,"onSort",(()=>this.saveChildOrder())),e(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${bs(t)}`),null==e||e.classList.remove(`hovering-${bs(e)}`)})),e(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),e(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Ve[i]].some(Boolean)?t:e?o.set(Ve[i],e):o.get(Ve[i])})),e(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),e(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),e(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),e(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),e(this,"cloneData",(()=>{const t={...xs(this.data),id:ws()};return"field"!==this.name&&(t.children=[]),t})),e(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),e(this,"createChildWrap",(t=>lh.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=i.id,this.name=t,this.config=rh[`${this.name}s`].config,Cs(this.config,i.config),this.dataPath=`${this.name}s.${this.id}.`,this.observer=new window.MutationObserver(this.mutationHandler),this.render=o}observe(t){this.observer.disconnect(),this.observer.observe(t,{childList:!0})}get js(){return this.data}get json(){return this.data}empty(){const t=this.children.map((t=>{t.remove()}));return this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{rh.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),rh.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...lh.btnTemplate({content:lh.icon(`handle-${this.name}`)}),className:["component-handle",`${this.name}-handle`]},{className:["action-btn-wrap",`${this.name}-action-btn-wrap`],children:this.buttons}]}}toggleEdit(t=!this.isEditing){this.isEditing=t;const e=this.dom,n="editing",o=`${n}-${this.name}`,i=this.dom.querySelector(`.${this.name}-edit`);ba.slideToggle(i,We,t),"field"===this.name&&(ba.slideToggle(this.preview,We,!t),e.parentElement.classList.toggle(`column-${o}`,t)),e.classList.toggle(n,t),e.classList.toggle(o,t)}get buttons(){if(this.actionButtons)return this.actionButtons;const t={handle:(t=`handle-${this.name}`)=>({...lh.btnTemplate({content:lh.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...lh.btnTemplate({content:lh.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...lh.btnTemplate({content:lh.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...lh.btnTemplate({content:lh.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{ba.slideUp(this.dom,We,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...lh.btnTemplate({content:lh.icon(t)}),className:["item-clone"],meta:{id:"clone"},action:{click:()=>{this.clone(this.parent),"column"===this.name&&this.parent.autoColumnWidths()}}})},{buttons:e,disabled:n}=this.config.actionButtons,o=e.filter((t=>!n.includes(t))).map((e=>{var n;return(null==(n=t[e])?void 0:n.call(t))||e}));return this.actionButtons=o,this.actionButtons}get index(){return da(this.dom)}get parentType(){return $e.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${_e[t]}`);return e&&lh.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=ke.get(this.name);return pa(t,(t=>rh.getAddress(`${e}s.${t.id}`))).filter(Boolean)}get domChildren(){const t=this.dom.querySelector(".children");return t?t.children:[]}addChild(t={},e=this.domChildren.length){var n,o;let i=t;"object"!=typeof t&&(i={id:i});const r=this.dom.querySelector(".children"),{id:s=ws()}=i,a=ke.get(this.name);if(!a)return null;const l=`${a}s`,c=rh.getAddress(`${l}.${s}`)||rh[l].add(s,i);r.insertBefore(c.dom,r.children[e]),null==(o=null==(n=this.config.events)?void 0:n.onAddChild)||o.call(n,{parent:this,child:c});const d=c.get("children");return(null==d?void 0:d.length)&&c.loadChildren(d),this.removeClasses("empty"),this.saveChildOrder(),c}onAdd({from:t,to:e,item:n,newIndex:o}){var i;t.classList.contains(ge)||(t=t.parentElement);const r=bs(t),s=bs(e.parentElement),a=new Map([[-2,()=>{const t=this.addChild({},o).addChild();return t.addChild.bind(t)}],[-1,()=>{const t=this.addChild({},o);return t.addChild.bind(t)}],[0,()=>this.addChild.bind(this)],[1,t=>{const e=da(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:{meta:{id:t},...e}}=Ru.get(n.id);la(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=aa({stage:{row:0,column:-1,field:-2},row:{row:1,column:0,field:-1},column:{row:2,column:1,field:0},field:1},`${this.name}.${i}`),s=a.get(r)();lh.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||Ts)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||Ts)();return null==t?void 0:t(n.id)}},c=null==(i=l[r])?void 0:i.call(l,n,o);return(()=>{this.saveChildOrder(),this.removeClasses("empty")})(),c}onRemove({from:{parentElement:t}}){return t.classList.contains(ye)&&t.classList.remove("column-editing-field"),"stage"===this.name||this.children.length?(this.emptyClass(),this.saveChildOrder()):this.remove()}onRender(){const{events:t}=this.config;if(!t)return null;t.onRender&&lh.onRender(this.dom,t.onRender)}set config(t){const e=aa(t,"all"),n=aa(this.data,"config.controlId"),o=[e,n&&aa(t,n),aa(t,this.id)].reduce(((t,e)=>e?Cs(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=rh[e];return n===this.id?this:null==o?void 0:o.get(n)}cloneChildren(t){for(const e of this.children)null==e||e.clone(t)}get isRow(){return this.name===Ne.row}get isColumn(){return this.name===Ne.column}get isField(){return this.name===Ne.field}}class vu extends gu{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),e(this,"updateConditionsPanel",_s((()=>{const t=this.editPanels.find((({name:t})=>"conditions"===t));if(!t)return null;const e=t.createProps(),n=this.dom.querySelector(".field-edit-conditions");n.parentElement.replaceChild(e,n)}),We)),e(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=lh.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),e(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=ys([...this.config.panels.order,...Object.keys(this.data)]),n=["config","meta","action","events",...this.config.panels.disabled],o=e.filter((t=>!n.includes(t)));for(const r of o){const e=this.get(r),n=lh.childType(e);if(t.includes(n)){const t=new mu(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Jd(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),e(this,"toggleCheckedOptions",((t,e)=>{const n=this.get("options").map(((n,o)=>{const i=o===t;return"radio"===e?n.selected=i:n.checked=i?!n.checked:n.checked,n}));this.set("options",n)})),e(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get(`config.disabled${eu(e)}`)).includes(t)})),e(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get(`config.locked${eu(e)}`)).includes(t)})),this.debouncedUpdateEditPanels=function(t,e=333){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}(this.updateEditPanels),this.label=lh.create(this.labelConfig),this.preview=lh.create({}),this.editPanels=[];const n=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));let i={tag:"li",attrs:{className:we},id:this.id,children:[this.label,this.getComponentTag(),n,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:ne.get("field")}};i=lh.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return null;const t=this.get("config.editorLabel")||this.get("config.label"),e=this.get("attrs.required"),n=this.config.label.disableHTML;return{className:"prev-label",children:[{...(()=>{const e={tag:"label",attrs:{}};return n?(e.tag="input",e.attrs.value=t,e):(e.attrs.contenteditable=!0,e.children=t,e)})(),action:{input:({target:{innerHTML:t,innerText:e,value:o}})=>{super.set("config.label",n?o:t);const i=rh.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&lh.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=lh.create(this.labelConfig);this.label.parentElement.replaceChild(t,this.label),this.label=t}get fieldEdit(){const t={className:["field-edit","slide-toggle","formeo-panels-wrap"]};this.updateEditPanels();const e=this.editPanels.length;return e&&(t.className.push(`panel-count-${e}`),t.content=[this.panels.panelNav,this.panels.panelsWrap],this.panelNav=this.panels.nav,this.resizePanelWrap=this.panels.nav.refresh),t.action={onRender:()=>{if(0===e){const t=this.dom,e=t.querySelector(".item-edit-toggle"),n=t.querySelector(".field-actions"),o=n.getElementsByTagName("button");n.style.maxWidth=o.length*o[0].clientWidth+"px",lh.remove(e)}else this.resizePanelWrap()}},lh.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=da(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=xs(this.data),{action:n={}}=Ru.get(e.config.controlId);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:lh.create(e,!0),action:this.defaultPreviewActions}}}const bu={js:new Set,css:new Set},yu=(t,e,n=js)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),wu=(t,e)=>{t.removeEventListener("load",wu),e(t.src)},Cu=(t,e)=>{t.removeEventListener("load",Cu),e(t.src)},xu=t=>new Promise(((e,n)=>{if(bu.js.has(t))return e(t);bu.js.add(t);const o=lh.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>Cu(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),Eu=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(bu.css.has(t))return e(t);bu.css.add(t);const o=lh.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>wu(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},Su=async(t=pe)=>{if(document.getElementById(ue))return;const e=async t=>(t=>{let e=document.getElementById(ue);return e||(e=lh.create({id:ue,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return yu(t,e,(()=>yu(fe,e)))},Ou={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>xu(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>Eu(t)));return Promise.all(e)}},Nu=t=>{const e=Object.entries(t).map((([t,e])=>Ou[t](e)));return Promise.all(e)},Au=()=>{const t=document.getElementById(ue);return"hidden"===window.getComputedStyle(t).visibility};class _u{constructor({events:t={},dependencies:n={},controlAction:o,...i}){e(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=n,this.id=i.id||ws()}get controlId(){var t;return null==(t=this.controlData.meta)?void 0:t.id}get dom(){const{meta:t,config:e}=this.controlData,n=this.i18n(e.label)||e.label,o={tag:"button",attrs:{type:"button"},content:[{tag:"span",className:"control-icon",children:lh.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${ge}`);return e&&Ru.panels.nav.refresh(da(e))},click:({target:t})=>{Ru.addElement(t.parentElement.id)}}};return lh.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return Nu(this.dependencies)}i18n(t,e){var n,o;const i=ne.locale,r=null==(n=this.definition)?void 0:n.i18n,s=(null==r?void 0:r[i])||{};return((null==(o=s[t])?void 0:o.call(s))??s[t])||ne.get(t,e)}}const Tu=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const ju=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:ne.get("labelCount",{label:eu(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const Pu=[class extends _u{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:ne.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:ne.get("button"),type:["button","submit","reset"].map((t=>({label:t,type:t}))),className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:ne.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:ne.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:ne.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends _u{constructor(){super({tag:"textarea",config:{label:ne.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends _u{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:ne.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:ne.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends _u{constructor(){super({tag:"select",config:{label:ne.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:ju("option")})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:ne.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:ju("checkbox",1)})}},class extends _u{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:ne.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:ju("radio")})}}],Lu=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),Du="controls.html.header";const ku=[class extends _u{constructor(){super({tag:Lu[0],attrs:{tag:Lu.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:ne.get(Du),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:ne.get(Du),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(Du)}},class extends _u{constructor(){super({tag:"p",attrs:{className:""},config:{label:ne.get("controls.html.paragraph"),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"paragraph",id:"paragraph"},content:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."})}},class extends _u{constructor(){super({tag:"hr",config:{label:ne.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends _u{constructor(t){super(Cs({tag:"textarea",config:{label:"WYSIWYG",editableContent:!0},meta:{group:"html",icon:"rich-text",id:"tinymce"},attrs:{required:!1},dependencies:{js:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"},action:{onRender:t=>{const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}},controlAction:{click:()=>{},onRender:()=>{}}},t))}}],$u=Object.freeze({sortable:!0,elementOrder:{},groupOrder:[],groups:[{id:"layout",label:"controls.groups.layout",elementOrder:["row","column"]},{id:"common",label:"controls.groups.form",elementOrder:["button","checkbox"]},{id:"html",label:"controls.groups.html",elementOrder:["header","block-text"]}],disable:{groups:[],elements:[],formActions:[]},elements:[],container:null,panels:{displayType:"slider"}}),Iu=[...Pu,...ku,...Tu];const Ru=new class{constructor(){e(this,"groupLabel",(t=>ne.get(t)||t||"")),e(this,"layoutTypes",{row:()=>Qu.active.addChild(),column:()=>this.layoutTypes.row().addChild(),field:t=>this.layoutTypes.column().addChild(t)}),e(this,"addElement",(t=>{const{meta:{group:e,id:n},...o}=aa(this.get(t),"controlData");return la(o,"config.controlId",n),"layout"===e?this.layoutTypes[n.replace("layout-","")]():this.layoutTypes.field(o)})),e(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=Cs($u,t);return this.container=e,this.groupOrder=ys(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...Iu,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${ge}`);return e&&this.panels.nav.refresh(da(e))},click:({target:t})=>{this.addElement(t.parentElement.id)}}}async init(t,e=!1){return await this.applyOptions(t),this.buildDOM(e),this}registerControls(t){return this.controls=[],t.map((async t=>{let e;return e="function"==typeof t?new t:new _u(t),this.add(e),this.controls.push(e.dom),e.promise()}))}groupElements(){let t=this.options.groups.slice(),e=this.controls.slice(),n=[];const o=[];return t=ua(t,this.groupOrder,"id"),t=t.filter((t=>vs(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:ge,id:`${t.id}-${ge}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=ys(e.concat(t.elementOrder));t.elementOrder=n}return e=ua(e,t.elementOrder,"meta.id"),n.content=e.filter((e=>{const{controlData:n}=this.get(e.id),i=n.meta.id||"";let r=!0;return r=[vs(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(i)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=xs(t);return this.data.set(e.id,e),e.controlData.meta.id&&this.data.set(e.controlData.meta.id,e.controlData),e}get(t){return xs(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...lh.btnTemplate({content:[lh.icon("bin"),ne.get("clear")],title:ne.get("clearAll")}),className:["clear-form"],action:{click:t=>{th.size?(xa.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:ne.get("confirmClearAll"),clearAllAction:()=>{Qu.clearAll().then((()=>{const e={src:t.target};xa.formeoCleared(e)}))},btnCoords:lh.coords(t.target)}}),document.dispatchEvent(xa.confirmClearAll)):window.alert(ne.get("cannotClearFields"))}}},e={...lh.btnTemplate({content:[lh.icon("floppy-disk"),ne.get("save")],title:ne.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=rh,n={action:()=>{},coords:lh.coords(t),message:"",button:t};return Xd.click.btn(n),Xd.save.form(e)}}};return{className:"form-actions f-btn-group",content:Object.entries({clearBtn:t,saveBtn:e}).reduce(((t,[e,n])=>(this.options.disable.formActions.includes(e)||t.push(n),t)),[])}}buildDOM(t){const e=this.groupElements(),n=this.formActions(),{displayType:o}=this.options.panels;this.panels=new Jd({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],r=lh.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),s=["formeo-controls"];t&&s.push("formeo-sticky");const a=lh.create({className:s,content:[r,n]}),l=a.getElementsByClassName("control-group");this.dom=a,this.groups=l;const[c]=l;this.currentGroup=c,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=r.querySelector(".filtered-term");if(lh.toggleElementsByStr(n,t),e){const e=ne.get("controls.filteringTerm",t);a.classList.add("filtered"),o?o.textContent=e:(o=lh.create({tag:"h5",className:"filtered-term",content:e}),r.insertBefore(o,r.firstChild))}else o&&(a.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let d=l.length-1;d>=0;d--){const t=`formeo-controls-${l[d]}`;this.options.sortable||window.localStorage.removeItem(t),Nd.create(l[d],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:({item:t})=>{const{controlData:e}=this.get(t.id);this.options.ghostPreview&&(t.innerHTML="",t.appendChild(new vu(e).preview))},onEnd:({from:t,item:e,clone:n})=>{t.contains(n)&&t.replaceChild(e,n)},sort:this.options.sortable,store:{get:()=>{const e=window.localStorage.getItem(t);return e?e.split("|"):[]},set:e=>{const n=e.toArray();window.localStorage.setItem(t,n.join("|"))}}})}return a}};class Mu extends Ul{constructor(){super(...arguments),e(this,"load",(t=>{const e=Ps(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),e(this,"get",(t=>t?aa(this.data,t):this.add())),e(this,"add",((t,e=Object.create(null))=>{const n=t||ws(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),e(this,"remove",(t=>{if(Array.isArray(t))for(const e of t)this.get(e).remove();else this.get(t).remove();return this.data})),e(this,"delete",(t=>(delete this.data[t],t))),e(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),e(this,"conditionMap",new Map)}set config(t){this.configVal=Cs(this.configVal,xs(t))}get config(){return this.configVal}}class Fu extends gu{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=lh.create({attrs:{className:[ve,"empty"],id:this.id},children:n}),Nd.create(n,{animation:150,fallbackClass:"row-moving",forceFallback:!0,group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{Wu.active=this},onSort:this.onSort.bind(this),draggable:`.${be}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),ba.slideUp(this.dom,We,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),ba.slideDown(this.dom,We)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const Wu=new class extends Mu{constructor(t){super("stages",t)}Component(t){return new Fu(t)}};class Bu extends gu{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[be]}),...t}),e(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Ze);const t=n.dom,o=Ss(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),Be);document.dispatchEvent(xa.columnResized)}this.updateColumnPreset()})),e(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>lh.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),e(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const n=this.createChildWrap();this.dom=lh.create({tag:"li",className:[be,"empty"],dataset:{hoverTag:ne.get("row"),editingHoverTag:ne.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,n]}),Nd.create(n,{animation:150,fallbackClass:"column-moving",forceFallback:!0,group:{name:"row",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onRemove:this.onRemove.bind(this),onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),draggable:`.${ye}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:ne.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:ne.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:ne.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:ne.get("row.makeInputGroup"),description:ne.get("row.makeInputGroupDesc")}},n={className:"input-group",content:{tag:"input",attrs:{type:"text",ariaLabel:"Legend for fieldset",value:this.get("config.legend"),placeholder:"Title"},config:{label:{children:["Row Title",{tag:"span",content:" ⓘ",dataset:{tooltip:"Row title will be used as the legend for the fieldset"}}]}},action:{input:({target:{value:t}})=>this.set("config.legend",t)},className:""}},o=lh.formGroup([t,n]),i={tag:"label",content:ne.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=lh.create(this.columnPresetControlConfig);const r={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},s=[e,"hr",o,"hr",lh.formGroup([i,r],"row")];return lh.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=s.map((t=>lh.create(t)));t.append(...e)}}})}onAdd(...t){super.onAdd(...t),this.autoColumnWidths()}onRemove(...t){super.onRemove(...t),this.autoColumnWidths()}get getColumnPresetOptions(){const t=this.children,e=Ie.get(t.length-1)||[],n=t.map((t=>{const e=t.get("config.width")||"";return Number(e.replace("%","")).toFixed(1)})).join(",");if(e.length){const t=e.slice();return!t.find((t=>t.value===n))&&t.push({value:n,label:n.replace(/,/g," | "),className:Ce}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:ne.get("defineColumnLayout"),className:xe},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const zu={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const Uu=new class extends Mu{constructor(t){super("rows",t),this.config={all:zu}}Component(t){return new Bu(t)}};class qu{constructor(){this.onMove=this.onMove.bind(this),this.onStop=this.onStop.bind(this),this.cleanup=this.cleanup.bind(this)}getRowWidth(t){const e=t.querySelector(".children");if(!e)return 0;const n=e.children.length,o=lh.getStyle(e,"gap")||"0px",i=parseFloat(o,10)||0;return this.totalGapWidth=i*(n-1),e.offsetWidth-this.totalGapWidth}validateResizeTarget(t,e){return t&&e&&t.offsetWidth&&e.offsetWidth}onStart(t){if(t.preventDefault(),this.resized=!1,0!==t.button)return;const e=t.target.parentElement,n=e.nextSibling||e.previousSibling,o=e.closest(`.${be}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(Ee),this.columnPreset=o.querySelector(`.${xe}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Ze,""),n.className=n.className.replace(Ze,""),this.colStartWidth=e.offsetWidth,this.sibStartWidth=n.offsetWidth,this.rowWidth=this.getRowWidth(o),this.rowWidth<=0)this.cleanup();else{this.column=e,this.sibling=n,this.row=o;try{window.addEventListener("pointermove",this.onMove,!1),window.addEventListener("pointerup",this.onStop,!1)}catch(i){this.cleanup()}}else this.cleanup()}calculateNewWidths(t){const e=this.colStartWidth+t-this.startX,n=this.sibStartWidth-t+this.startX,o=parseFloat(Es(e,this.rowWidth)),i=parseFloat(Es(n,this.rowWidth));return o<10||i<10?null:{colWidth:Ss(o.toFixed(1)),siblingColWidth:Ss(i.toFixed(1))}}onMove(t){t.preventDefault();const{column:e,sibling:n}=this,o="touchmove"===t.type?t.touches[0].clientX:t.clientX,i=this.calculateNewWidths(o);if(!i)return;const{colWidth:r,siblingColWidth:s}=i;e.dataset.colWidth=r,n.dataset.colWidth=s,e.style.width=r,n.style.width=s,this.resized=!0}onStop(){const{column:t,sibling:e}=this;window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop),this.resized&&(this.setCustomWidthValue(),rh.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),rh.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(Ee),this.resized=!1,this.cleanup())}cleanup(){this.column&&this.originalColumnClass&&(this.column.className=this.originalColumnClass),this.sibling&&this.originalSiblingClass&&(this.sibling.className=this.originalSiblingClass),this.row&&this.row.classList.remove(Ee),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${Ce}`);const n=this.row.querySelector(".children").children,o=pa(n,(t=>Es(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=lh.create({tag:"option",attrs:{className:Ce,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Hu=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[lh.icon("triangle-down"),lh.icon("triangle-up")]}),Gu=()=>({className:"column-edit group-config"});class Vu extends gu{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[ye]}),...t}),e(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),e(this,"setDomWidth",(t=>{this.dom.dataset.colWidth=t,this.dom.style.width=t})),e(this,"setWidth",(t=>(this.setDomWidth(t),this.set("config.width",t))));const n=this.createChildWrap();this.dom=lh.create({tag:"li",className:[ye,"empty"],dataset:{hoverTag:ne.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Gu(),Hu(new qu),n]}),this.processConfig(),xa.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),Nd.create(n,{animation:150,fallbackClass:"field-moving",forceFallback:!0,group:{name:"column",pull:!0,put:["column","controls"]},sort:!0,disabled:!1,onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),onRemove:this.onRemove.bind(this),onMove:t=>{t.from!==t.to&&t.from.classList.remove("hovering-column")},draggable:`.${we}`,handle:".item-move"})}processConfig(){const t=va.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Xu={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Yu=new class extends Mu{constructor(t){super("columns",t),this.config={all:Xu}}Component(t){return new Vu(t)}},Zu={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Ju=new class extends Mu{constructor(t){super("fields",t),e(this,"get",(t=>{let e=t&&aa(this.data,t);if(!e){const n=Ru.get(t);n&&(e=this.add(null,n.controlData))}return e})),e(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>{const{conditions:o,...i}=(null==n?void 0:n.getData())||n;if(null==o?void 0:o.length){let t=!0;if(1===o.length){const[e]=o;t=Boolean(e.if[0].source&&e.then[0].target)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),e(this,"load",((t=Object.create(null))=>{const e=Ps(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&la(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:Zu}}Component(t){return new vu(t)}};const Ku=new class extends Mu{constructor(t){super("externals",t)}Component(t){return new gu("external",t)}},Qu=Wu,th=Uu,eh=Yu,nh=Ju,oh=Ru,ih=Ku;const rh=new class extends Ul{constructor(){super("components"),e(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?xs(Ps(t)):e&&Os.get(Me)||Ke())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",Qu.load(n.stages)),this.add("rows",th.load(n.rows)),this.add("columns",eh.load(n.columns)),this.add("fields",nh.load(n.fields)),this.add("externals",ih.load(this.opts.external));for(const o of Object.values(this.get("stages")))o.loadChildren();return this.data})),this.disableEvents=!0,this.stages=Qu,this.rows=th,this.columns=eh,this.fields=nh,this.controls=oh,this.externals=ih}flatList(t=this.data,e=Object.create(null)){return Object.entries(t).reduce(((t,[e,n])=>{if("object"==typeof n)for(const[o,i]of Object.entries(n))t[`${e}.${o}`]=i;return t}),e)}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${de}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:Wu.getData(),rows:Uu.getData(),columns:Yu.getData(),fields:Ju.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Qu.config=e,th.config=n,eh.config=o,nh.config=i}setAddress(t,e){const[n,o,...i]=Array.isArray(t)?t:t.split("."),r=this[n.replace(/s?$/,"s")].get(o);return null==r||r.set(i,e),r}getAddress(t){if(!Ns(t))return;const[e,n,...o]=Array.isArray(t)?t:t.split("."),i=this[e.replace(/s?$/,"s")].get(n);return o.length?i.get(o):i}getConditionMap(t){if(Ns(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Ns(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Ns(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},sh={glyphicons:t=>``,"font-awesome":t=>{const[e,n]=t.split(" ");return``},fontello:t=>`${t}`},ah=new Set(["input","textarea","select"]);const lh=new class{constructor(t=Object.create(null)){e(this,"render",(t=>(t.id=`f-${t.id||ws()}`,this.create(t)))),e(this,"create",((t,e=!1)=>{if(!t)return;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processTagName(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[va.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let h=document.createElement(c);const p={string:t=>{h.innerHTML+=t},object:t=>t&&h.appendChild(n.create(t,e)),node:t=>h.appendChild(t),component:t=>h.appendChild(t.dom),array:t=>{for(const e of t)l=n.childType(e),p[l](e)},function:t=>{t=t(),l=n.childType(t),p[l](t)},undefined:()=>null,boolean:()=>null};if(i&&(a.attrs=Cs(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return va.forEach(t,(t=>{u.children.push(n.create(t,e))})),a.attrs.className&&(u.className=a.attrs.className),u.config={...a.config},this.create(u,e);p.array.call(this,t),a.content=void 0,o.push("options")}if(a.attrs&&(n.processAttrs(a,h,e),o.push("attrs")),a.config){if(a.config.label&&(a.config.label&&"button"!==c||["radio","checkbox"].includes(va.get(a,"attrs.type")))&&!e){const t=n.label(a);if(!a.config.hideLabel){const e=[t,h];n.labelAfter(a)&&e.reverse(),u.children.push(e)}}o.push("config")}if(a.content||a.children){const t=a.content||a.children;l=n.childType(t),p[l],p[l].call(this,t)}if(s){for(const t in s)Object.hasOwn(s,t)&&(h.dataset[t]="function"==typeof s[t]?s[t]():s[t]);o.push("dataset")}a.action&&(this.actionHandler(h,a.action),o.push("action"));const f=va.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)h[f[d]]=a[f[d]];return u.children.length&&(h=this.create(u)),h})),e(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),e(this,"toggleElementsByStr",((t,e)=>{const n=[];return lh.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),e(this,"elementsContainText",((t,e,n)=>{const o=[];return ha(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),e(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||ne.get("labelCount",{label:ne.get("option"),count:o})}}))),e(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),e(this,"removeEmpty",(t=>{const e=t.parentElement,n=bs(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),e(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),e(this,"isControls",(t=>bs(t)===ge)),e(this,"isStage",(t=>bs(t)===ve)),e(this,"isRow",(t=>bs(t)===be)),e(this,"isColumn",(t=>bs(t)===ye)),e(this,"isField",(t=>bs(t)===we)),e(this,"asComponent",(t=>rh[`${bs(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=Cs(this.options,t)}processTagName(t){let e,n=t;if("string"==typeof n)return e=n,n={tag:e},n;if(n.attrs){const{tag:t,...o}=n.attrs;if(t)if("string"==typeof t)e=t;else{e=(t.find((t=>!0===t.selected))||t[0]).value}n.attrs=o}return n.tag=e||n.tag||"div",n}actionHandler(t,e){const n={onRender:lh.onRender,render:lh.onRender},o=["focus","blur"];return Object.entries(e).map((([e,i])=>(Array.isArray(i)?i:[i]).map((i=>{const r=n[e]||(t=>(e,n)=>e.addEventListener(t,n,o.includes(t)))(e);return r(t,i)}))))}get icons(){if(this.iconSymbols)return this.iconSymbols;const t=document.querySelectorAll(`#${ue} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(Je,"")]={tag:"svg",attrs:{className:["svg-icon",n=e.id]},children:[{tag:"use",attrs:{"xmlns:xlink":"http://www.w3.org/1999/xlink","xlink:href":`#${n}`}}]},t}),{}),this.cachedIcons={},this.iconSymbols}icon(t,e){var n,o;if(!t)return;const i=`${t}?${new URLSearchParams(e).toString()}`;if(null==(n=this.cachedIcons)?void 0:n[i])return this.cachedIcons[i];const r=this.icons[t];if(r){if(e){const t=Cs(r,e);return this.cachedIcons[i]=lh.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=lh.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=sh[lh.options.iconFont])?void 0:o.call(sh,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",ws(t));for(const i of Object.keys(o)){const t=va.safeAttrName(i),n=this.processAttrValue(o[i]);n&&e.setAttribute(t,!0===n?"":n)}}processAttrValue(t){let e=t||"";if(Array.isArray(e))if("object"==typeof e[0]){const t=e.filter((t=>!0===t.selected));e=t.length?t[0].value:e[0].value}else e=e.join(" ");return e}processOptions(t,e,n){const{action:o,attrs:i}=e,r=i.type||e.tag,s=i.id||e.id;return t.map(((t,i)=>{var a;const{label:l,...c}=t,d=()=>{const a={tag:"input",attrs:{name:s,type:r,value:t.value||"",id:`${s}-${i}`,...c},action:o},l={tag:"label",attrs:{for:`${s}-${i}`},config:{inputWrap:"form-check"},children:t.label},d={children:[a,l],className:[`f-${r}`]};return e.attrs.className&&(e.config.inputWrap=e.attrs.className),e.config.inline&&d.className.push(`f-${r}-inline`),t.selected&&(a.attrs.checked=!0),n&&(l.attrs.contenteditable=!0),d},u={select:()=>({tag:"option",attrs:t,children:t.label}),button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||ws(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=u[r])?void 0:a.call(u,t)}))}holdsContent(t){return-1!==t.outerHTML.indexOf("/")}isBlockInput(t){return!this.isInput(t)&&this.holdsContent(t)}isInput(t){let e=t;return"string"!=typeof e&&(e=e.tagName),ah.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=va.get(t,"attrs.type"),n=va.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=va.get(t,"attrs.required");let{config:{label:o=""}}=t;const{id:i,attrs:r}=t;"function"==typeof o&&(o=o());const s={tag:"label",attrs:{for:i||(null==r?void 0:r.id)},className:[],children:[o,n&&this.requiredMark()],action:{}};return e&&(s.attrs.for=void 0,s.attrs.contenteditable=!0,s.fMap=e),s}childType(t){return void 0===t?t:[["array",t=>Array.isArray(t)],["node",t=>t instanceof window.Node||t instanceof window.HTMLElement],["component",()=>null==t?void 0:t.dom],[typeof t,()=>!0]].find((e=>e[1](t)))[0]}getStyle(t,e=!1){let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n}getElement(t){return{node:()=>t,object:()=>document.getElementById(t.id),string:()=>document.getElementById(t)}[this.childType(t)]()}empty(t){for(;t.firstChild;)this.remove(t.firstChild);return t}remove(t){const e=bs(t);return e?rh.remove(`${e}s.${t.id}`):t.parentElement.removeChild(t)}removeClasses(t,e){const n={string:t=>t.classList.remove(e),array:t=>{for(const n of e)t.classList.remove(n)}};n.object=n.string,va.forEach(t,n[this.childType(e)])}addClasses(t,e){const n={string:t=>t.classList.add(e),array:t=>{for(const n of e)t.classList.add(n)}};va.forEach(t,n[this.childType(e)])}formGroup(t,e=""){return{className:["f-field-group",e],children:t}}coords(t){const e=t.getBoundingClientRect(),n=document.body.getBoundingClientRect();return{pageX:e.left+e.width/2,pageY:e.top-n.top-e.height/2}}clearStage(t){t.classList.add("removing-all-fields");ba.slideUp(t,600,(()=>{lh.empty(t),t.classList.remove("removing-all-fields"),lh.emptyClass(t),ba.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=bs(t);if(!o)return;const i=bs(t.parentElement),r=lh[o].get(t.id).sortable;n||(n=!r.option("disabled")),r.option("disabled",n),i&&["rows","columns","stages"].includes(i)&&this.toggleSortable(t.parentElement,n)}emptyClass(t){const e=t.getElementsByClassName(Se.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};const ch={"en-US":"English",dir:"ltr","af-ZA":"Afrikaans (South Africa)","ar-TN":"Arabic (Tunisia)","cs-CZ":"Czech (Czechia)","de-DE":"German (Germany)","es-ES":"European Spanish","fa-IR":"Persian (Iran)","fi-FI":"Finnish (Finland)","fr-FR":"French (France)","hu-HU":"Hungarian (Hungary)","it-IT":"Italian (Italy)","ja-JP":"Japanese (Japan)","nb-NO":"Norwegian Bokmål (Norway)","pl-PL":"Polish (Poland)","pt-BR":"Brazilian Portuguese","pt-PT":"European Portuguese","ro-RO":"Romanian (Romania)","ru-RU":"Russian (Russia)","th-TH":"Thai (Thailand)","tr-TR":"Turkish (Türkiye)","zh-CN":"Chinese (China)","zh-HK":"Chinese (Hong Kong SAR China)","action.add.attrs.attr":"What attribute would you like to add?","action.add.attrs.value":"Default Value",addOption:"Add Option",allFieldsRemoved:"All fields were removed.",allowSelect:"Allow Select",and:"and",attribute:"Attribute",attributeNotPermitted:'Attribute "{attribute}" is not permitted, please choose another.',attributes:"Attributes","attrs.class":"Class","attrs.className":"Class","attrs.dir":"Direction","attrs.id":"Id","attrs.required":"Required","attrs.style":"Style","attrs.title":"Title","attrs.type":"Type","attrs.value":"Value",autocomplete:"Autocomplete",button:"Button",cannotBeEmpty:"This field cannot be empty",cannotClearFields:"There are no fields to clear",checkbox:"Checkbox",checkboxes:"Checkboxes",class:"Class",clear:"Clear",clearAllMessage:"Are you sure you want to clear all fields?",close:"Close",column:"Column","condition.target.placeholder":"target","condition.value.placeholder":"value",confirmClearAll:"Are you sure you want to remove all fields?",content:"Content",control:"Control","controlGroups.nextGroup":"Next Group","controlGroups.prevGroup":"Previous Group","controls.filteringTerm":'Filtering "{term}"',"controls.form.button":"Button","controls.form.checkbox-group":"Checkbox Group","controls.form.input.date":"Date","controls.form.input.email":"Email","controls.form.input.file":"File Upload","controls.form.input.hidden":"Hidden Input","controls.form.input.number":"Number","controls.form.input.text":"Text Input","controls.form.radio-group":"Radio Group","controls.form.select":"Select","controls.form.textarea":"TextArea","controls.groups.form":"Form Fields","controls.groups.html":"HTML Elements","controls.groups.layout":"Layout","controls.html.divider":"Divider","controls.html.header":"Header","controls.html.paragraph":"Paragraph","controls.layout.column":"Column","controls.layout.row":"Row",copy:"Copy To Clipboard",danger:"Danger",defineColumnLayout:"Define a column layout",defineColumnWidths:"Define column widths",description:"Help Text",descriptionField:"Description","editing.row":"Editing Row",editorTitle:"Form Elements",field:"Field","field.property.invalid":"not valid","field.property.isNotVisible":"is not visible","field.property.isVisible":"is visible","field.property.label":"label","field.property.valid":"valid","field.property.value":"value",fieldNonEditable:"This field cannot be edited.",fieldRemoveWarning:"Are you sure you want to remove this field?",fileUpload:"File Upload",formUpdated:"Form Updated",getStarted:"Drag a field from the right to get started.",group:"Group",grouped:"Grouped",hidden:"Hidden Input",hide:"Edit",htmlElements:"HTML Elements",if:"If","if.condition.source.placeholder":"source","if.condition.target.placeholder":"target / value",info:"Info","input.date":"Date","input.text":"Text",label:"Label",labelCount:"{label} {count}",labelEmpty:"Field Label cannot be empty","lang.af":"Afrikaans","lang.ar":"Arabic","lang.cs":"Czech","lang.de":"German","lang.en":"English","lang.es":"Spanish","lang.fa":"Persian","lang.fi":"Finnish","lang.fr":"French","lang.hu":"Hungarian","lang.it":"Italian","lang.ja":"Japanese","lang.nb":"Norwegian Bokmål","lang.pl":"Polish","lang.pt":"Portuguese","lang.ro":"Romanian","lang.ru":"Russian","lang.th":"Thai","lang.tr":"Turkish","lang.zh":"Chinese",layout:"Layout",limitRole:"Limit access to one or more of the following roles:",mandatory:"Mandatory",maxlength:"Max Length","meta.group":"Group","meta.icon":"Ico","meta.label":"Label",minOptionMessage:"This field requires a minimum of 2 options",name:"Name",newOptionLabel:"New {type}",no:"No",number:"Number",off:"Off",on:"On","operator.contains":"contains","operator.equals":"equals","operator.notContains":"not contains","operator.notEquals":"not equal","operator.notVisible":"not visible","operator.visible":"visible",option:"Option",optional:"optional",optionEmpty:"Option value required",optionLabel:"Option {count}",options:"Options",or:"or",order:"Order","panel.label.attrs":"Attributes","panel.label.conditions":"Conditions","panel.label.config":"Configuration","panel.label.meta":"Meta","panel.label.options":"Options","panelEditButtons.attrs":"+ Attribute","panelEditButtons.conditions":"+ Condition","panelEditButtons.options":"+ Option",placeholder:"Placeholder","placeholder.className":"space separated classes","placeholder.email":"Enter you email","placeholder.label":"Label","placeholder.password":"Enter your password","placeholder.placeholder":"Placeholder","placeholder.text":"Enter some Text","placeholder.textarea":"Enter a lot of text","placeholder.value":"Value",preview:"Preview",primary:"Primary",remove:"Remove",removeMessage:"Remove Element",removeType:"Remove {type}",required:"Required",reset:"Reset",richText:"Rich Text Editor",roles:"Access",row:"Row","row.makeInputGroup":"Make this row an input group.","row.makeInputGroupDesc":"Input Groups enable users to add sets of inputs at a time.","row.settings.fieldsetWrap":"Wrap row in a <fieldset> tag","row.settings.fieldsetWrap.aria":"Wrap Row in Fieldset",save:"Save",secondary:"Secondary",select:"Select",selectColor:"Select Color",selectionsMessage:"Allow Multiple Selections",selectOptions:"Options",separator:"Separator",settings:"Settings",size:"Size",sizes:"Sizes","sizes.lg":"Large","sizes.m":"Default","sizes.sm":"Small","sizes.xs":"Extra Small",style:"Style",styles:"Styles","styles.btn":"Button Style","styles.btn.danger":"Danger","styles.btn.default":"Default","styles.btn.info":"Info","styles.btn.primary":"Primary","styles.btn.success":"Success","styles.btn.warning":"Warning",subtype:"Type",success:"Success",text:"Text Field",then:"Then","then.condition.target.placeholder":"target",toggle:"Toggle",ungrouped:"Un-Grouped",warning:"Warning",yes:"Yes"};ne.addLanguage("en-US",ch);const dh={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:pe,style:me,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:ga(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let uh=class{constructor({formData:t,...e},n){const o=Cs(dh.editor,e),{actions:i,events:r,debug:s,config:a,editorContainer:l,...c}=o;l&&(this.editorContainer="string"==typeof l?document.querySelector(l):l),this.opts=c,lh.setOptions=c,rh.config=a,this.userFormData=Ls(n||t),this.Components=rh,this.dom=lh,xa.init({debug:s,...r}),Xd.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new le,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.loadResources.bind(this)):this.loadResources()}get formData(){return this.Components.formData}set formData(t={}){this.load({...this.userFormData,...t},this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?he.filter((({name:e})=>-1!==t.indexOf(e))):he;Promise.all(e.map((({src:t})=>xu(t))))})(this.opts.polyfills),await Su(this.opts.svgSprite),e.push((async t=>{if(!Au()&&(await Eu(t),!Au()))return await Eu("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(ne.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(Fe)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return Ru.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=rh.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(Fe,t);ne.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render(),null==(n=(e=this.opts).onLoad)||n.call(e,this)}))}load(t=this.userFormData,e=this.opts){return this.Components.load(t,e)}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(rh.get("stages")),this.opts.controlOnLeft)for(const e of this.stages)e.dom.style.order=1;const t={attrs:{className:"formeo formeo-editor",id:this.formId},content:[this.stages.map((({dom:t})=>t))]};ne.current.dir&&(t.attrs.dir=ne.current.dir,lh.dir=ne.current.dir),this.editor=lh.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(lh.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),xa.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(xa.formeoLoaded)}};const hh=t=>"string"==typeof t?document.querySelector(t):t,ph=t=>{const e=t.match(Ye);return(null==e?void 0:e[0])||t},fh=t=>t.replace(Ye,ws());let mh=class{constructor(t,n){e(this,"render",((t=this.form)=>{this.form=Ls(t);const e=document.getElementsByClassName("formeo-render").length,n={id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};this.renderedForm=lh.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),e(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),e(this,"prefixId",(t=>"f-"+t)),e(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),e(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),e(this,"cacheComponent",(t=>(this.components[ph(t.id)]=t,t))),e(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:ws(),className:i,children:s}})),e(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:fh(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(ph(t))))})})),e(this,"addButton",(t=>lh.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=lh.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(lh.render(lh.btnTemplate({className:"remove-input-group",children:lh.icon("remove"),action:{mouseover:({target:t})=>t.parentElement.classList.add("will-remove"),mouseleave:({target:t})=>t.parentElement.classList.remove("will-remove"),click:({target:t})=>t.parentElement.remove()}})))}}}))),e(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),e(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{var n,o;const i=(null==(n=e.config)?void 0:n.controlId)||(null==(o=e.meta)?void 0:o.id),{action:r={},dependencies:s={}}=this.elements[i]||{};s&&Nu(s);const a=Cs({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),e(this,"handleComponentCondition",((t,e,n)=>{const o=gh(t);o&&t.addEventListener(o,(t=>{if(this.evaluateCondition(e,t))for(const e of n)this.execResult(e,t)}),!1);const i={target:t};if(this.evaluateCondition(e,i))for(const r of n)this.execResult(r,i)})),e(this,"applyConditions",(()=>{for(const{conditions:t}of Object.values(this.components))if(t)for(const e of t){const{if:t,then:n}=e;for(const e of t){const{source:t,...o}=e;if(Ns(t)){const e=this.getComponents(t);for(const t of e)this.handleComponentCondition(t,o,n)}}}})),e(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:zl,notEquals:(t,e)=>!zl(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Ns(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),e(this,"execResult",(({assignment:t,target:e,targetProperty:n,value:o})=>{var i;const r={equals:t=>{var e;const i={value:()=>{t[n]=o},isNotVisible:()=>{t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:()=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};null==(e=i[n])||e.call(i)}};if(Ns(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),e(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return As(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),e(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return As(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r,formData:s}=(({editorContainer:t,renderContainer:e,formData:n,...o})=>({elements:{},...o,renderContainer:hh(e),editorContainer:hh(t),formData:Ls(n)}))(t);this.container=o,this.form=Ls(n||s),this.external=i,this.dom=lh,this.components=Object.create(null),this.elements=r}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=ve,lh.render(t))))}};const gh=t=>{const[e]=[["input",t=>["textarea","text"].includes(t.type)],["change",t=>["select"].includes(t.tagName.toLowerCase())||["checkbox","radio"].includes(t.type)]].find((e=>e[1](t)))||[!1];return e};void 0!==window&&(window.FormeoEditor=uh,window.FormeoRenderer=mh);const vh=mh,bh=new uh(i);((t,e)=>{const n=((t,e)=>({renderForm:()=>{Qt.style.display="block",e.render(t.formData)},logJSON:()=>{},viewData:()=>{for(const[e,n]of Object.entries(t.formData));},resetEditor:()=>{window.sessionStorage.removeItem("formeo-formData"),window.location.reload()}}))(t,e);Object.entries(n).map((([t,e])=>{const n={id:t,type:"button"},o=Object.assign(document.createElement("button"),n),i=document.createTextNode(Jt(t));return o.appendChild(i),o.addEventListener("click",e,!1),Kt.appendChild(o),o}))})(bh,new vh(r)),(t=>{const e=document.getElementById("control-filter"),n=document.getElementById("locale"),o=window.sessionStorage.getItem("formeo-locale");e.addEventListener("input",(({target:{value:e}})=>t.controls.actions.filter(e))),n.value=o||"en-US",n.addEventListener("change",(({target:{value:e}})=>{window.sessionStorage.setItem("formeo-locale",e),t.i18n.setLang(e)}),!1)})(bh); diff --git a/assets/js/demo.min.js.gz b/assets/js/demo.min.js.gz index 5eef652..7b161a0 100644 Binary files a/assets/js/demo.min.js.gz and b/assets/js/demo.min.js.gz differ diff --git a/assets/js/formeo.min.js b/assets/js/formeo.min.js index 5d443ed..b46e341 100644 --- a/assets/js/formeo.min.js +++ b/assets/js/formeo.min.js @@ -1,14 +1,14 @@ /** formeo - https://formeo.io -Version: 3.0.7 +Version: 3.0.8 Author: Draggable https://draggable.io */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).formeo={})}(this,(function(t){"use strict";var e=Object.defineProperty,n=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);const o={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class i{constructor(t=o){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...o,...t},i=e.replace(/\/?$/,"/");this.config={location:i,...n};const{override:r,preloaded:s={}}=this.config,a=Object.entries(this.langs).concat(Object.entries(r||s));this.langs=a.reduce(((t,[e,n])=>(t[e]=this.applyLanguage(e,n),t)),{}),this.locale=this.config.locale||this.config.langs[0]}init(t){return this.processConfig({...this.config,...t}),this.setCurrent(this.locale)}addLanguage(t,e={}){e="string"==typeof e?i.processFile(e):e,this.applyLanguage(t,e),this.config.langs.push("locale")}getValue(t,e=this.locale){var n;return(null==(n=this.langs[e])?void 0:n[t])||this.getFallbackValue(t)}getFallbackValue(t){const e=Object.values(this.langs).find((e=>e[t]));return null==e?void 0:e[t]}makeSafe(t){const e={"{":"\\{","}":"\\}","|":"\\|"};return t=t.replace(/[{}|]/g,(t=>e[t])),new RegExp(t,"g")}put(t,e){return this.current[t]=e,e}get(t,e){const n=this;let o=this.getValue(t);if(!o)return;const i=o.match(/\{[^}]+?\}/g);if(e&&i)if("object"==typeof e)for(const r of i){const t=r.substring(1,r.length-1);o=o.replace(n.makeSafe(r),e[t]||"")}else o=o.replace(/\{[^}]+?\}/g,e);return o}static processFile(t){return i.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i{const r=i.processFile(e);return n.applyLanguage(t,r),n.loaded.push(t),o(n.langs[t])})).catch((e=>{const i=n.applyLanguage(t);o(i)}))}))}applyLanguage(t,e={}){const n=this.config.override[t]||{},o=this.langs[t]||{};return this.langs[t]={...o,...e,...n},this.langs[t]}get getLangs(){return this.config.langs}async setCurrent(t="en-US"){return await this.loadLang(t),this.locale=t,this.current=this.langs[t],this.current}}const r=new i;!function(){try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('._3x4ZIcu-{position:absolute;background:#1f2937;color:#fff;padding:.75rem;border-radius:.375rem;max-width:200px;z-index:50;visibility:hidden;opacity:0;transition:opacity .2s;pointer-events:none;left:0;top:0}._3x4ZIcu-.JIt36hCJ{visibility:visible;opacity:1;pointer-events:all}._3x4ZIcu-:before{content:"";position:absolute;width:0;height:0;border:6px solid transparent}._3x4ZIcu-[data-position=top]:before{border-top-color:#1f2937;bottom:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=bottom]:before{border-bottom-color:#1f2937;top:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=left]:before{border-left-color:#1f2937;right:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=right]:before{border-right-color:#1f2937;left:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=top-left]:before{border-top-color:#1f2937;bottom:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=top-right]:before{border-top-color:#1f2937;bottom:-12px;right:12px;left:auto;transform:none}._3x4ZIcu-[data-position=bottom-left]:before{border-bottom-color:#1f2937;top:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=bottom-right]:before{border-bottom-color:#1f2937;top:-12px;right:12px;left:auto;transform:none}')),document.head.appendChild(t)}}catch(e){}}();var s=Object.defineProperty,a=(t,e,n)=>((t,e,n)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const l="_3x4ZIcu-",c="JIt36hCJ",d={triggerName:"tooltip"};class u{constructor(t=d){a(this,"triggerName"),a(this,"tooltip"),a(this,"activeTriggerType",null),a(this,"spacing",12),a(this,"handleClick",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}][${e}-type="click"]`);if(n)if(this.isVisible())this.hide();else{const t=n.getAttribute(`${e}`);this.show(n,t),this.activeTriggerType="click"}else this.hide()})),a(this,"handleMouseOver",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);if("click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))){const t=null==n?void 0:n.getAttribute(`${e}`);t&&(this.show(n,t),this.activeTriggerType="hover")}})),a(this,"handleMouseOut",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);"click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))&&this.hide()})),a(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),a(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${l}`,document.body.appendChild(this.tooltip),this.setupEventListeners()}setupEventListeners(){document.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mouseout",this.handleMouseOut),document.addEventListener("touchstart",this.handleMouseOver),document.addEventListener("touchend",this.handleMouseOut),document.addEventListener("click",this.handleClick),window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}isVisible(){return this.tooltip.classList.contains(c)}calculatePosition(t){const e=t.getBoundingClientRect(),n=this.tooltip.getBoundingClientRect(),o=[{name:"top",x:e.left+(e.width-n.width)/2,y:e.top-n.height-this.spacing},{name:"bottom",x:e.left+(e.width-n.width)/2,y:e.bottom+this.spacing},{name:"left",x:e.left-n.width-this.spacing,y:e.top+(e.height-n.height)/2},{name:"right",x:e.right+this.spacing,y:e.top+(e.height-n.height)/2},{name:"top-left",x:e.left,y:e.top-n.height-this.spacing},{name:"top-right",x:e.right-n.width,y:e.top-n.height-this.spacing},{name:"bottom-left",x:e.left,y:e.bottom+this.spacing},{name:"bottom-right",x:e.right-n.width,y:e.bottom+this.spacing}];return o.find((t=>this.fitsInViewport(t,n)))||o[0]}fitsInViewport(t,e){if(!(t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight))return!1;return 0===[[t.x,t.y],[t.x+e.width,t.y],[t.x,t.y+e.height],[t.x+e.width,t.y+e.height],[t.x+e.width/2,t.y+e.height/2]].flatMap((([t,e])=>Array.from(document.elementsFromPoint(t,e)))).filter((t=>{if(this.tooltip.contains(t)||t===this.tooltip||t.classList.contains(l)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(c);const n=this.calculatePosition(t);this.tooltip.style.left=`${n.x}px`,this.tooltip.style.top=`${n.y}px`,this.tooltip.dataset.position=n.name}hide(){this.tooltip.classList.remove(c),this.activeTriggerType=null}destroy(){document.removeEventListener("mouseover",this.handleMouseOver),document.removeEventListener("mouseout",this.handleMouseOut),document.removeEventListener("touchstart",this.handleMouseOver),document.removeEventListener("touchend",this.handleMouseOut),document.removeEventListener("click",this.handleClick),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0),this.tooltip.remove()}}void 0!==window&&(window.SmartTooltip=u);const h="formeo",p="3.0.7",f="formeo-sprite",m=[{name:"cssPreload",src:"//cdnjs.cloudflare.com/ajax/libs/loadCSS/2.0.1/cssrelpreload.min.js"},{name:"mutationObserver",src:"//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js"},{name:"fetch",src:"https://unpkg.com/unfetch/polyfill"}],g=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/${f}.svg`,v=`https://draggable.github.io/formeo/assets/img/${f}.svg`,b=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formeo.min.css`,y="control-group",w=`${h}-stage`,C=`${h}-row`,E=`${h}-column`,x=`${h}-field`,S="custom-column-widths",O="column-preset",_="resizing-columns",N=new Map([[w,C],[C,E],[E,x]]),A=["external","stages","rows","columns","fields"],j=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),T=[{name:"controls",className:y},{name:"stage",className:w},{name:"row",className:C},{name:"column",className:E},{name:"field",className:x}],P={controls:y,stage:w,row:C,column:E,field:x},L=Object.entries(P).reduce(((t,[e,n])=>({...t,[n]:e})),{}),D=Object.values(P),k=new RegExp(`${D.join("|")}`,"g"),$=T.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),I=$.slice().map((t=>t.slice().reverse())).reverse(),M=new Map($),R=new Map(I.slice()),F=new Map([[{value:"100.0",label:"100%"}],[{value:"50.0,50.0",label:"50 | 50"},{value:"33.3,66.6",label:"33 | 66"},{value:"66.6,33.3",label:"66 | 33"}],[{value:"33.3,33.3,33.3",label:"33 | 33 | 33"},{value:"25.0,25.0,50.0",label:"25 | 25 | 50"},{value:"50.0,25.0,25.0",label:"50 | 25 | 25"},{value:"25.0,50.0,25.0",label:"25 | 50 | 25"}],[{value:"25.0,25.0,25.0,25.0",label:"25 | 25 | 25 | 25"}],[{value:"20.0,20.0,20.0,20.0,20.0",label:"20 | 20 | 20 | 20 | 20"}],[{value:"16.66,16.66,16.66,16.66,16.66,16.66",label:"16.66 | 16.66 | 16.66 | 16.66 | 16.66 | 16.66"}]].reduce(((t,e,n)=>(t.push([n,e]),t)),[])),W=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],B=`${h}-formData`,z=`${h}-locale`,q=333,U=Math.round(166.5),H=Math.round(666),X="formeoSaved",V="formeoUpdated",Y="formeoOnRender",G=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Z={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},J={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Z},K=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi,Q=/\bcol-\w+-\d+/g,tt="f-i-";var et="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function nt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ot=function(){this.__data__=[],this.size=0};var it=function(t,e){return t===e||t!=t&&e!=e},rt=it;var st=function(t,e){for(var n=t.length;n--;)if(rt(t[n][0],e))return n;return-1},at=st,lt=Array.prototype.splice;var ct=st;var dt=st;var ut=st;var ht=ot,pt=function(t){var e=this.__data__,n=at(e,t);return!(n<0)&&(n==e.length-1?e.pop():lt.call(e,n,1),--this.size,!0)},ft=function(t){var e=this.__data__,n=ct(e,t);return n<0?void 0:e[n][1]},mt=function(t){return dt(this.__data__,t)>-1},gt=function(t,e){var n=this.__data__,o=ut(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function vt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=9007199254740991},Hn=Ut,Xn=Un;var Vn=function(t){return null!=t&&Xn(t.length)&&!Hn(t)},Yn=Vn,Gn=Dn;var Zn=function(t){return Gn(t)&&Yn(t)},Jn={exports:{}};var Kn=function(){return!1};!function(t,e){var n=Nt,o=Kn,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i?n.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}(Jn,Jn.exports);var Qn=Jn.exports,to=Ft,eo=_n,no=Dn,oo=Function.prototype,io=Object.prototype,ro=oo.toString,so=io.hasOwnProperty,ao=ro.call(Object);var lo=function(t){if(!no(t)||"[object Object]"!=to(t))return!1;var e=eo(t);if(null===e)return!0;var n=so.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ro.call(n)==ao},co=Ft,uo=Un,ho=Dn,po={};po["[object Float32Array]"]=po["[object Float64Array]"]=po["[object Int8Array]"]=po["[object Int16Array]"]=po["[object Int32Array]"]=po["[object Uint8Array]"]=po["[object Uint8ClampedArray]"]=po["[object Uint16Array]"]=po["[object Uint32Array]"]=!0,po["[object Arguments]"]=po["[object Array]"]=po["[object ArrayBuffer]"]=po["[object Boolean]"]=po["[object DataView]"]=po["[object Date]"]=po["[object Error]"]=po["[object Function]"]=po["[object Map]"]=po["[object Number]"]=po["[object Object]"]=po["[object RegExp]"]=po["[object Set]"]=po["[object String]"]=po["[object WeakMap]"]=!1;var fo=function(t){return ho(t)&&uo(t.length)&&!!po[co(t)]};var mo=function(t){return function(e){return t(e)}},go={exports:{}};!function(t,e){var n=St,o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,r=i&&i.exports===o&&n.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||r&&r.binding&&r.binding("util")}catch(e){}}();t.exports=s}(go,go.exports);var vo=go.exports,bo=fo,yo=mo,wo=vo&&vo.isTypedArray,Co=wo?yo(wo):bo;var Eo=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},xo=nn,So=it,Oo=Object.prototype.hasOwnProperty;var _o=function(t,e,n){var o=t[e];Oo.call(t,e)&&So(o,n)&&(void 0!==n||e in t)||xo(t,e,n)},No=_o,Ao=nn;var jo=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},Ai=Ni(Oi),ji=yi,Ti=Ei,Pi=Ai;var Li=it,Di=Vn,ki=Po,$i=Wt;var Ii=function(t,e){return Pi(Ti(t,e,ji),t+"")},Mi=function(t,e,n){if(!$i(n))return!1;var o=typeof e;return!!("number"==o?Di(n)&&ki(e,n.length):"string"==o&&e in n)&&Li(n[e],t)};var Ri=bi;const Fi=nt(function(t){return Ii((function(e,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(i--,r):void 0,s&&Mi(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++ocrypto.randomUUID(),Bi=(t="",e)=>{if(!e)return!1;const n=/[|\\{}()[\]^*$+?.]/g;let o="string"==typeof e?[e]:e;o=o.map((t=>"*"===t?"":t.replace(n,"\\$&")));let i=!0;return o.length&&(i=!new RegExp(o.join("|"),"i").exec(t)),i},zi=t=>{var e;const n=null==(e=t.className)?void 0:e.match(k);return n&&L[n[0]]},qi=t=>Array.from(new Set(t)),Ui=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||Wi(),t.id=e}else e=Wi();return e},Hi=(t,e)=>Fi({},t,e,((t,e)=>Array.isArray(t)?null!=e?qi(t.concat(e)):e:Array.isArray(e)?null!=t?qi(e.concat(t)):e:void 0)),Xi=t=>{let e;if(null===t||!("object"==typeof t)||t instanceof Promise)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(Array.isArray(t)){e=[];for(let n=0,o=t.length;nt/e*100,Yi=t=>`${t.toString()}%`,Gi=Object.create(null,{get:{value:t=>{var e;const n=null==(e=window.sessionStorage)?void 0:e.getItem(t);try{return JSON.parse(n)}catch(o){return n}}},set:{value:(t,e)=>{var n;try{return null==(n=window.sessionStorage)?void 0:n.setItem(t,JSON.stringify(e))}catch(o){}}}}),Zi=t=>A.some((e=>new RegExp(`^${e}.`).test(t))),Ji=t=>t.startsWith("external");function Ki(t,e=H){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function Qi(t){return t}function tr(){}function er(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const nr=t=>t?Xi(er(t)):{};var or=Ft,ir=Dn;var rr=function(t){return"symbol"==typeof t||ir(t)&&"[object Symbol]"==or(t)},sr=qn,ar=rr,lr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cr=/^\w*$/;var dr=function(t,e){if(sr(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ar(t))||(cr.test(t)||!lr.test(t)||null!=e&&t in Object(e))},ur=Be;function hr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var o=arguments,i=e?e.apply(this,o):o[0],r=n.cache;if(r.has(i))return r.get(i);var s=t.apply(this,o);return n.cache=r.set(i,s)||r,s};return n.cache=new(hr.Cache||ur),n}hr.Cache=ur;var pr=hr;var fr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,mr=/\\(\\)?/g,gr=function(t){var e=pr(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(fr,(function(t,n,o,i){e.push(o?i.replace(mr,"$1"):n||t)})),e}));var vr=function(t,e){for(var n=-1,o=null==t?0:t.length,i=Array(o);++nNumber.isInteger(Number(t)),Ur=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},Hr=(t,e,n)=>{const o=n.split("||"),i=qi(e).map((e=>t.find((t=>{const n=o.find((e=>!!Br(t,e)));return n&&Br(t,n)===e})))).filter(Boolean).concat(t);return qi(i)},Xr=(t,e,n)=>{for(let o=0;o{const n=[];return Xr(t,((t,o)=>n.push(e(t,o)))),n},Yr={},Gr=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Zr=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Jr={capitalize:Gr,safeAttrName:t=>{if(Yr[t])return Yr[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return Yr[t]=e,e},forEach:Xr,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:Vr,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:Ur,isInt:qr,get:Br,orderObjectsBy:Hr,isIE:Zr},Kr={getStyle:(t,e=!1)=>{let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n},fadeOut:(t,e=250)=>{const n=1/(e/60);t.style.opacity=1,function e(){const o=Number(t.style.opacity)-n;o>0?(t.style.opacity=o,window.requestAnimationFrame(e)):t.remove()}()},slideDown:(t,e=250,n=!1)=>{t.style.display="block";const o=Kr.getStyle(t),i=parseInt(o.height,10),r=i/(e/60);t.style.height="0px",function e(){const o=parseFloat(t.style.height),s=o+r;o{const o=Kr.getStyle(t),i=parseInt(o.height),r=o.overflow;t.style.overflow="hidden",t.style.height=i+"px";const s=o.minHeight;t.style.minHeight="auto";const a=parseFloat(i/(e/60)).toFixed(2);!function e(){const o=parseInt(t.style.height,10)-a;o>0?(t.style.height=o+"px",window.requestAnimationFrame(e)):(t.style.overflow=r,t.style.display="none",t.style.minHeight=s,delete t.style.height,n&&n(t))}()},slideToggle:(t,e=250,n="none"===Kr.getStyle(t,"display"))=>{n?Kr.slideDown(t,e):Kr.slideUp(t,e)}},Qr="no-transition",ts={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=ns.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},es=({src:t,...e},n=V)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=ns.opts)?void 0:o.debug)||(null==(i=ns.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},ns={init:function(t){return this.opts={...ts,...t},this},formeoSaved:t=>es(t,X),formeoUpdated:t=>es(t,V),formeoCleared:t=>es(t,"formeoCleared"),formeoOnRender:t=>es(t,Y),formeoConditionUpdated:t=>es(t,"formeoConditionUpdated")},os=Ki((()=>{ns.opts.onUpdate({timeStamp:window.performance.now(),type:V,detail:Wd.formData})}),U);let is;document.addEventListener(V,os),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(Y,(t=>{const{timeStamp:e,type:n,detail:o}=t;ns.opts.onRender({timeStamp:e,type:n,detail:o})})),document.addEventListener("confirmClearAll",(t=>{t={timeStamp:t.timeStamp,type:t.type,confirmationMessage:t.detail.confirmationMessage,clearAllAction:t.detail.clearAllAction,btnCoords:t.detail.btnCoords},ns.opts.confirmClearAll(t)})),document.addEventListener(X,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};ns.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{ns.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){is=is||window.requestAnimationFrame((()=>{is=!1;for(const t of Object.values($d.data))t.dom.classList.add(Qr),Md.dom.classList.add(Qr),Md.panels.nav.refresh(),t.refreshFieldPanels()}))}));var rs=Be,ss=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},as=function(t){return this.__data__.has(t)};function ls(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new rs;++ea))return!1;var c=r.get(t),d=r.get(e);if(c&&d)return c==e&&d==t;var u=-1,h=!0,p=2&n?new cs:void 0;for(r.set(t,e),r.set(e,t);++uJSON.stringify(t,null,e))),n(this,"get",(t=>Br(this.data,t))),n(this,"getChangeType",((t,e)=>{const n=W.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),n(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||Ui();return this.set(o,e)})),n(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):o&&delete o[n],o})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),n(this,"setCallbacks",{}),n(this,"configVal",Object.create(null)),this.name=t,this.data=e,this.dataPath=""}get size(){return Object.keys(this.data).length}get js(){return this.data}get json(){return this.data}set(t,e){const n=Br(this.data,t);if(Ea(n,e))return this.data;const o=zr(this.data,t,e),i=Array.isArray(t)?t.join("."):t,r=Object.keys(this.setCallbacks).filter((t=>new RegExp(t).test(i))),s={newVal:e,oldVal:n,path:t};for(const a of r)for(const t of this.setCallbacks[a])t(s);if(!this.disableEvents){const i=this.getChangeType(n,e),r={entity:this,dataPath:this.dataPath.replace(/\.+$/,""),changePath:this.dataPath+t,value:e,data:o,change:`${i.type}: ${i.desc}`,src:this.dom};n&&(r.previousValue=n),ns.formeoUpdated(r)}return o}addSetCallback(t,e){this.setCallbacks[t]?this.setCallbacks[t].push(e):this.setCallbacks[t]=[e]}removeSetCallback(t,e){this.setCallbacks[t]=this.setCallbacks[t].filter((t=>t!==e))}empty(){this.data=Object.create(null)}} +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).formeo={})}(this,(function(t){"use strict";var e=Object.defineProperty,n=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);const o={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class i{constructor(t=o){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...n}={...o,...t},i=e.replace(/\/?$/,"/");this.config={location:i,...n};const{override:r,preloaded:s={}}=this.config,a=Object.entries(this.langs).concat(Object.entries(r||s));this.langs=a.reduce(((t,[e,n])=>(t[e]=this.applyLanguage(e,n),t)),{}),this.locale=this.config.locale||this.config.langs[0]}init(t){return this.processConfig({...this.config,...t}),this.setCurrent(this.locale)}addLanguage(t,e={}){e="string"==typeof e?i.processFile(e):e,this.applyLanguage(t,e),this.config.langs.push("locale")}getValue(t,e=this.locale){var n;return(null==(n=this.langs[e])?void 0:n[t])||this.getFallbackValue(t)}getFallbackValue(t){const e=Object.values(this.langs).find((e=>e[t]));return null==e?void 0:e[t]}makeSafe(t){const e={"{":"\\{","}":"\\}","|":"\\|"};return t=t.replace(/[{}|]/g,(t=>e[t])),new RegExp(t,"g")}put(t,e){return this.current[t]=e,e}get(t,e){const n=this;let o=this.getValue(t);if(!o)return;const i=o.match(/\{[^}]+?\}/g);if(e&&i)if("object"==typeof e)for(const r of i){const t=r.substring(1,r.length-1);o=o.replace(n.makeSafe(r),e[t]||"")}else o=o.replace(/\{[^}]+?\}/g,e);return o}static processFile(t){return i.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i{const r=i.processFile(e);return n.applyLanguage(t,r),n.loaded.push(t),o(n.langs[t])})).catch((e=>{const i=n.applyLanguage(t);o(i)}))}))}applyLanguage(t,e={}){const n=this.config.override[t]||{},o=this.langs[t]||{};return this.langs[t]={...o,...e,...n},this.langs[t]}get getLangs(){return this.config.langs}async setCurrent(t="en-US"){return await this.loadLang(t),this.locale=t,this.current=this.langs[t],this.current}}const r=new i;!function(){try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('._3x4ZIcu-{position:absolute;background:#1f2937;color:#fff;padding:.75rem;border-radius:.375rem;max-width:200px;z-index:50;visibility:hidden;opacity:0;transition:opacity .2s;pointer-events:none;left:0;top:0}._3x4ZIcu-.JIt36hCJ{visibility:visible;opacity:1;pointer-events:all}._3x4ZIcu-:before{content:"";position:absolute;width:0;height:0;border:6px solid transparent}._3x4ZIcu-[data-position=top]:before{border-top-color:#1f2937;bottom:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=bottom]:before{border-bottom-color:#1f2937;top:-12px;left:50%;transform:translate(-50%)}._3x4ZIcu-[data-position=left]:before{border-left-color:#1f2937;right:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=right]:before{border-right-color:#1f2937;left:-12px;top:50%;transform:translateY(-50%)}._3x4ZIcu-[data-position=top-left]:before{border-top-color:#1f2937;bottom:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=top-right]:before{border-top-color:#1f2937;bottom:-12px;right:12px;left:auto;transform:none}._3x4ZIcu-[data-position=bottom-left]:before{border-bottom-color:#1f2937;top:-12px;left:12px;transform:none}._3x4ZIcu-[data-position=bottom-right]:before{border-bottom-color:#1f2937;top:-12px;right:12px;left:auto;transform:none}')),document.head.appendChild(t)}}catch(e){}}();var s=Object.defineProperty,a=(t,e,n)=>((t,e,n)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const l="_3x4ZIcu-",c="JIt36hCJ",d={triggerName:"tooltip"};class u{constructor(t=d){a(this,"triggerName"),a(this,"tooltip"),a(this,"activeTriggerType",null),a(this,"spacing",12),a(this,"handleClick",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}][${e}-type="click"]`);if(n)if(this.isVisible())this.hide();else{const t=n.getAttribute(`${e}`);this.show(n,t),this.activeTriggerType="click"}else this.hide()})),a(this,"handleMouseOver",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);if("click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))){const t=null==n?void 0:n.getAttribute(`${e}`);t&&(this.show(n,t),this.activeTriggerType="hover")}})),a(this,"handleMouseOut",(t=>{const e=this.triggerName,n=t.target.closest(`[${e}]`);"click"!==this.activeTriggerType&&"click"!==(null==n?void 0:n.getAttribute(`${e}-type`))&&this.hide()})),a(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),a(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${l}`,document.body.appendChild(this.tooltip),this.setupEventListeners()}setupEventListeners(){document.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mouseout",this.handleMouseOut),document.addEventListener("touchstart",this.handleMouseOver),document.addEventListener("touchend",this.handleMouseOut),document.addEventListener("click",this.handleClick),window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}isVisible(){return this.tooltip.classList.contains(c)}calculatePosition(t){const e=t.getBoundingClientRect(),n=this.tooltip.getBoundingClientRect(),o=[{name:"top",x:e.left+(e.width-n.width)/2,y:e.top-n.height-this.spacing},{name:"bottom",x:e.left+(e.width-n.width)/2,y:e.bottom+this.spacing},{name:"left",x:e.left-n.width-this.spacing,y:e.top+(e.height-n.height)/2},{name:"right",x:e.right+this.spacing,y:e.top+(e.height-n.height)/2},{name:"top-left",x:e.left,y:e.top-n.height-this.spacing},{name:"top-right",x:e.right-n.width,y:e.top-n.height-this.spacing},{name:"bottom-left",x:e.left,y:e.bottom+this.spacing},{name:"bottom-right",x:e.right-n.width,y:e.bottom+this.spacing}];return o.find((t=>this.fitsInViewport(t,n)))||o[0]}fitsInViewport(t,e){if(!(t.x>=0&&t.y>=0&&t.x+e.width<=window.innerWidth&&t.y+e.height<=window.innerHeight))return!1;return 0===[[t.x,t.y],[t.x+e.width,t.y],[t.x,t.y+e.height],[t.x+e.width,t.y+e.height],[t.x+e.width/2,t.y+e.height/2]].flatMap((([t,e])=>Array.from(document.elementsFromPoint(t,e)))).filter((t=>{if(this.tooltip.contains(t)||t===this.tooltip||t.classList.contains(l)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(c);const n=this.calculatePosition(t);this.tooltip.style.left=`${n.x}px`,this.tooltip.style.top=`${n.y}px`,this.tooltip.dataset.position=n.name}hide(){this.tooltip.classList.remove(c),this.activeTriggerType=null}destroy(){document.removeEventListener("mouseover",this.handleMouseOver),document.removeEventListener("mouseout",this.handleMouseOut),document.removeEventListener("touchstart",this.handleMouseOver),document.removeEventListener("touchend",this.handleMouseOut),document.removeEventListener("click",this.handleClick),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0),this.tooltip.remove()}}void 0!==window&&(window.SmartTooltip=u);const h="formeo",p="3.0.8",f="formeo-sprite",m=[{name:"cssPreload",src:"//cdnjs.cloudflare.com/ajax/libs/loadCSS/2.0.1/cssrelpreload.min.js"},{name:"mutationObserver",src:"//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js"},{name:"fetch",src:"https://unpkg.com/unfetch/polyfill"}],g=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/${f}.svg`,v=`https://draggable.github.io/formeo/assets/img/${f}.svg`,b=`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formeo.min.css`,y="control-group",w=`${h}-stage`,C=`${h}-row`,E=`${h}-column`,x=`${h}-field`,S="custom-column-widths",O="column-preset",_="resizing-columns",N=new Map([[w,C],[C,E],[E,x]]),A=["external","stages","rows","columns","fields"],j=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),T=[{name:"controls",className:y},{name:"stage",className:w},{name:"row",className:C},{name:"column",className:E},{name:"field",className:x}],P={controls:y,stage:w,row:C,column:E,field:x},L=Object.entries(P).reduce(((t,[e,n])=>({...t,[n]:e})),{}),D=Object.values(P),k=new RegExp(`${D.join("|")}`,"g"),$=T.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),I=$.slice().map((t=>t.slice().reverse())).reverse(),M=new Map($),R=new Map(I.slice()),F=new Map([[{value:"100.0",label:"100%"}],[{value:"50.0,50.0",label:"50 | 50"},{value:"33.3,66.6",label:"33 | 66"},{value:"66.6,33.3",label:"66 | 33"}],[{value:"33.3,33.3,33.3",label:"33 | 33 | 33"},{value:"25.0,25.0,50.0",label:"25 | 25 | 50"},{value:"50.0,25.0,25.0",label:"50 | 25 | 25"},{value:"25.0,50.0,25.0",label:"25 | 50 | 25"}],[{value:"25.0,25.0,25.0,25.0",label:"25 | 25 | 25 | 25"}],[{value:"20.0,20.0,20.0,20.0,20.0",label:"20 | 20 | 20 | 20 | 20"}],[{value:"16.66,16.66,16.66,16.66,16.66,16.66",label:"16.66 | 16.66 | 16.66 | 16.66 | 16.66 | 16.66"}]].reduce(((t,e,n)=>(t.push([n,e]),t)),[])),W=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],B=`${h}-formData`,z=`${h}-locale`,q=333,U=Math.round(166.5),H=Math.round(666),X="formeoSaved",V="formeoUpdated",Y="formeoOnRender",G=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],Z={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},J={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:Z},K=/(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi,Q=/\bcol-\w+-\d+/g,tt="f-i-",et=()=>({id:Hi(),stages:{[Hi()]:{}},rows:{},columns:{},fields:{}});var nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ot(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var it=function(){this.__data__=[],this.size=0};var rt=function(t,e){return t===e||t!=t&&e!=e},st=rt;var at=function(t,e){for(var n=t.length;n--;)if(st(t[n][0],e))return n;return-1},lt=at,ct=Array.prototype.splice;var dt=at;var ut=at;var ht=at;var pt=it,ft=function(t){var e=this.__data__,n=lt(e,t);return!(n<0)&&(n==e.length-1?e.pop():ct.call(e,n,1),--this.size,!0)},mt=function(t){var e=this.__data__,n=dt(e,t);return n<0?void 0:e[n][1]},gt=function(t){return ut(this.__data__,t)>-1},vt=function(t,e){var n=this.__data__,o=ht(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function bt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=9007199254740991},Xn=Ht,Vn=Hn;var Yn=function(t){return null!=t&&Vn(t.length)&&!Xn(t)},Gn=Yn,Zn=kn;var Jn=function(t){return Zn(t)&&Gn(t)},Kn={exports:{}};var Qn=function(){return!1};!function(t,e){var n=At,o=Qn,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i?n.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}(Kn,Kn.exports);var to=Kn.exports,eo=Wt,no=Nn,oo=kn,io=Function.prototype,ro=Object.prototype,so=io.toString,ao=ro.hasOwnProperty,lo=so.call(Object);var co=function(t){if(!oo(t)||"[object Object]"!=eo(t))return!1;var e=no(t);if(null===e)return!0;var n=ao.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&so.call(n)==lo},uo=Wt,ho=Hn,po=kn,fo={};fo["[object Float32Array]"]=fo["[object Float64Array]"]=fo["[object Int8Array]"]=fo["[object Int16Array]"]=fo["[object Int32Array]"]=fo["[object Uint8Array]"]=fo["[object Uint8ClampedArray]"]=fo["[object Uint16Array]"]=fo["[object Uint32Array]"]=!0,fo["[object Arguments]"]=fo["[object Array]"]=fo["[object ArrayBuffer]"]=fo["[object Boolean]"]=fo["[object DataView]"]=fo["[object Date]"]=fo["[object Error]"]=fo["[object Function]"]=fo["[object Map]"]=fo["[object Number]"]=fo["[object Object]"]=fo["[object RegExp]"]=fo["[object Set]"]=fo["[object String]"]=fo["[object WeakMap]"]=!1;var mo=function(t){return po(t)&&ho(t.length)&&!!fo[uo(t)]};var go=function(t){return function(e){return t(e)}},vo={exports:{}};!function(t,e){var n=Ot,o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,r=i&&i.exports===o&&n.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||r&&r.binding&&r.binding("util")}catch(e){}}();t.exports=s}(vo,vo.exports);var bo=vo.exports,yo=mo,wo=go,Co=bo&&bo.isTypedArray,Eo=Co?wo(Co):yo;var xo=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},So=on,Oo=rt,_o=Object.prototype.hasOwnProperty;var No=function(t,e,n){var o=t[e];_o.call(t,e)&&Oo(o,n)&&(void 0!==n||e in t)||So(t,e,n)},Ao=No,jo=on;var To=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},ji=Ai(_i),Ti=wi,Pi=xi,Li=ji;var Di=rt,ki=Yn,$i=Lo,Ii=Bt;var Mi=function(t,e){return Li(Pi(t,e,Ti),t+"")},Ri=function(t,e,n){if(!Ii(n))return!1;var o=typeof e;return!!("number"==o?ki(n)&&$i(e,n.length):"string"==o&&e in n)&&Di(n[e],t)};var Fi=yi;const Wi=ot(function(t){return Mi((function(e,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=t.length>3&&"function"==typeof r?(i--,r):void 0,s&&Ri(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++ocrypto.randomUUID(),zi=(t="",e)=>{if(!e)return!1;const n=/[|\\{}()[\]^*$+?.]/g;let o="string"==typeof e?[e]:e;o=o.map((t=>"*"===t?"":t.replace(n,"\\$&")));let i=!0;return o.length&&(i=!new RegExp(o.join("|"),"i").exec(t)),i},qi=t=>{var e;const n=null==(e=t.className)?void 0:e.match(k);return n&&L[n[0]]},Ui=t=>Array.from(new Set(t)),Hi=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||Bi(),t.id=e}else e=Bi();return e},Xi=(t,e)=>Wi({},t,e,((t,e)=>Array.isArray(t)?null!=e?Ui(t.concat(e)):e:Array.isArray(e)?null!=t?Ui(e.concat(t)):e:void 0)),Vi=t=>{let e;if(null===t||!("object"==typeof t)||t instanceof Promise)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(Array.isArray(t)){e=[];for(let n=0,o=t.length;nt/e*100,Gi=t=>`${t.toString()}%`,Zi=Object.create(null,{get:{value:t=>{var e;const n=null==(e=window.sessionStorage)?void 0:e.getItem(t);try{return JSON.parse(n)}catch(o){return n}}},set:{value:(t,e)=>{var n;try{return null==(n=window.sessionStorage)?void 0:n.setItem(t,JSON.stringify(e))}catch(o){}}}}),Ji=t=>A.some((e=>new RegExp(`^${e}.`).test(t))),Ki=t=>t.startsWith("external");function Qi(t,e=H){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function tr(t){return t}function er(){}function nr(t=Object.create(null)){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t}const or=t=>t?Vi(nr(t)):et();var ir=Wt,rr=kn;var sr=function(t){return"symbol"==typeof t||rr(t)&&"[object Symbol]"==ir(t)},ar=Un,lr=sr,cr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,dr=/^\w*$/;var ur=function(t,e){if(ar(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!lr(t))||(dr.test(t)||!cr.test(t)||null!=e&&t in Object(e))},hr=ze;function pr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var o=arguments,i=e?e.apply(this,o):o[0],r=n.cache;if(r.has(i))return r.get(i);var s=t.apply(this,o);return n.cache=r.set(i,s)||r,s};return n.cache=new(pr.Cache||hr),n}pr.Cache=hr;var fr=pr;var mr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gr=/\\(\\)?/g,vr=function(t){var e=fr(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(mr,(function(t,n,o,i){e.push(o?i.replace(gr,"$1"):n||t)})),e}));var br=function(t,e){for(var n=-1,o=null==t?0:t.length,i=Array(o);++nNumber.isInteger(Number(t)),Hr=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},Xr=(t,e,n)=>{const o=n.split("||"),i=Ui(e).map((e=>t.find((t=>{const n=o.find((e=>!!zr(t,e)));return n&&zr(t,n)===e})))).filter(Boolean).concat(t);return Ui(i)},Vr=(t,e,n)=>{for(let o=0;o{const n=[];return Vr(t,((t,o)=>n.push(e(t,o)))),n},Gr={},Zr=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Jr=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Kr={capitalize:Zr,safeAttrName:t=>{if(Gr[t])return Gr[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return Gr[t]=e,e},forEach:Vr,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:Yr,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:Hr,isInt:Ur,get:zr,orderObjectsBy:Xr,isIE:Jr},Qr={getStyle:(t,e=!1)=>{let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n},fadeOut:(t,e=250)=>{const n=1/(e/60);t.style.opacity=1,function e(){const o=Number(t.style.opacity)-n;o>0?(t.style.opacity=o,window.requestAnimationFrame(e)):t.remove()}()},slideDown:(t,e=250,n=!1)=>{t.style.display="block";const o=Qr.getStyle(t),i=parseInt(o.height,10),r=i/(e/60);t.style.height="0px",function e(){const o=parseFloat(t.style.height),s=o+r;o{const o=Qr.getStyle(t),i=parseInt(o.height),r=o.overflow;t.style.overflow="hidden",t.style.height=i+"px";const s=o.minHeight;t.style.minHeight="auto";const a=parseFloat(i/(e/60)).toFixed(2);!function e(){const o=parseInt(t.style.height,10)-a;o>0?(t.style.height=o+"px",window.requestAnimationFrame(e)):(t.style.overflow=r,t.style.display="none",t.style.minHeight=s,delete t.style.height,n&&n(t))}()},slideToggle:(t,e=250,n="none"===Qr.getStyle(t,"display"))=>{n?Qr.slideDown(t,e):Qr.slideUp(t,e)}},ts="no-transition",es={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=os.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},ns=({src:t,...e},n=V)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=os.opts)?void 0:o.debug)||(null==(i=os.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},os={init:function(t){return this.opts={...es,...t},this},formeoSaved:t=>ns(t,X),formeoUpdated:t=>ns(t,V),formeoCleared:t=>ns(t,"formeoCleared"),formeoOnRender:t=>ns(t,Y),formeoConditionUpdated:t=>ns(t,"formeoConditionUpdated")},is=Qi((()=>{os.opts.onUpdate({timeStamp:window.performance.now(),type:V,detail:Wd.formData})}),U);let rs;document.addEventListener(V,is),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(Y,(t=>{const{timeStamp:e,type:n,detail:o}=t;os.opts.onRender({timeStamp:e,type:n,detail:o})})),document.addEventListener("confirmClearAll",(t=>{t={timeStamp:t.timeStamp,type:t.type,confirmationMessage:t.detail.confirmationMessage,clearAllAction:t.detail.clearAllAction,btnCoords:t.detail.btnCoords},os.opts.confirmClearAll(t)})),document.addEventListener(X,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};os.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{os.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){rs=rs||window.requestAnimationFrame((()=>{rs=!1;for(const t of Object.values(Id.data))t.dom.classList.add(ts),Rd.dom.classList.add(ts),Rd.panels.nav.refresh(),t.refreshFieldPanels()}))}));var ss=ze,as=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ls=function(t){return this.__data__.has(t)};function cs(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ss;++ea))return!1;var c=r.get(t),d=r.get(e);if(c&&d)return c==e&&d==t;var u=-1,h=!0,p=2&n?new ds:void 0;for(r.set(t,e),r.set(e,t);++uJSON.stringify(t,null,e))),n(this,"get",(t=>zr(this.data,t))),n(this,"getChangeType",((t,e)=>{const n=W.find((({condition:n})=>n(t,e)))||{type:"unknown"};return n.desc="added"===n.type?`${t} to ${e}`:e,n})),n(this,"add",((t,e=Object.create(null))=>{const{id:n}=e,o=t||n||Hi();return this.set(o,e)})),n(this,"remove",(t=>{const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?o.splice(Number(n),1):o&&delete o[n],o})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>(t[e]=(null==n?void 0:n.data)?n.getData():n,t)),{}))),n(this,"setCallbacks",{}),n(this,"configVal",Object.create(null)),this.name=t,this.data=e,this.dataPath=""}get size(){return Object.keys(this.data).length}get js(){return this.data}get json(){return this.data}set(t,e){const n=zr(this.data,t);if(xa(n,e))return this.data;const o=qr(this.data,t,e),i=Array.isArray(t)?t.join("."):t,r=Object.keys(this.setCallbacks).filter((t=>new RegExp(t).test(i))),s={newVal:e,oldVal:n,path:t};for(const a of r)for(const t of this.setCallbacks[a])t(s);if(!this.disableEvents){const i=this.getChangeType(n,e),r={entity:this,dataPath:this.dataPath.replace(/\.+$/,""),changePath:this.dataPath+t,value:e,data:o,change:`${i.type}: ${i.desc}`,src:this.dom};n&&(r.previousValue=n),os.formeoUpdated(r)}return o}addSetCallback(t,e){this.setCallbacks[t]?this.setCallbacks[t].push(e):this.setCallbacks[t]=[e]}removeSetCallback(t,e){this.setCallbacks[t]=this.setCallbacks[t].filter((t=>t!==e))}empty(){this.data=Object.create(null)}} /**! * Sortable 1.15.3 * @author RubaXa * @author owenm * @license MIT - */function Sa(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function Oa(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Ta(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var Pa=Ta(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),La=Ta(/Edge/i),Da=Ta(/firefox/i),ka=Ta(/safari/i)&&!Ta(/chrome/i)&&!Ta(/android/i),$a=Ta(/iP(ad|od|hone)/i),Ia=Ta(/chrome/i)&&Ta(/android/i),Ma={capture:!1,passive:!1};function Ra(t,e,n){t.addEventListener(e,n,!Pa&&Ma)}function Fa(t,e,n){t.removeEventListener(e,n,!Pa&&Ma)}function Wa(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(n){return!1}return!1}}function Ba(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function za(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Wa(t,e):Wa(t,e))||o&&t===n)return t;if(t===n)break}while(t=Ba(t))}return null}var qa,Ua=/\s+/g;function Ha(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Ua," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Ua," ")}}function Xa(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function Va(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Xa(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function Ya(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=Za(o)[n]))return o;if(o===Ga())break;o=nl(o,!1)}return!1}function Ka(t,e,n,o){for(var i=0,r=0,s=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=ja(n,pl);hl.pluginEvent.bind(sc)(t,e,Oa({dragEl:gl,parentEl:vl,ghostEl:bl,rootEl:yl,nextEl:wl,lastDownEl:Cl,cloneEl:El,cloneHidden:xl,dragStarted:Il,putSortable:jl,activeSortable:sc.active,originalEvent:o,oldIndex:Sl,oldDraggableIndex:_l,newIndex:Ol,newDraggableIndex:Nl,hideGhostForTarget:nc,unhideGhostForTarget:oc,cloneNowHidden:function(){xl=!0},cloneNowShown:function(){xl=!1},dispatchSortableEvent:function(t){ml({sortable:e,name:t,originalEvent:o})}},i))};function ml(t){!function(t){var e=t.sortable,n=t.rootEl,o=t.name,i=t.targetEl,r=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,u=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[ll]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||Pa||La?(m=document.createEvent("Event")).initEvent(o,!0,!0):m=new CustomEvent(o,{bubbles:!0,cancelable:!0}),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=r,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=u,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=Oa(Oa({},f),hl.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(Oa({putSortable:jl,cloneEl:El,targetEl:gl,rootEl:yl,oldIndex:Sl,oldDraggableIndex:_l,newIndex:Ol,newDraggableIndex:Nl},t))}var gl,vl,bl,yl,wl,Cl,El,xl,Sl,Ol,_l,Nl,Al,jl,Tl,Pl,Ll,Dl,kl,$l,Il,Ml,Rl,Fl,Wl,Bl=!1,zl=!1,ql=[],Ul=!1,Hl=!1,Xl=[],Vl=!1,Yl=[],Gl="undefined"!=typeof document,Zl=$a,Jl=La||Pa?"cssFloat":"float",Kl=Gl&&!Ia&&!$a&&"draggable"in document.createElement("div"),Ql=function(){if(Gl){if(Pa)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),tc=function(t,e){var n=Xa(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Ka(t,0,e),r=Ka(t,1,e),s=i&&Xa(i),a=r&&Xa(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Za(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Za(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&"none"!==s.float){var d="left"===s.float?"left":"right";return!r||"both"!==a.clear&&a.clear!==d?"horizontal":"vertical"}return i&&("block"===s.display||"flex"===s.display||"table"===s.display||"grid"===s.display||l>=o&&"none"===n[Jl]||r&&"none"===n[Jl]&&l+c>o)?"vertical":"horizontal"},ec=function(t){function e(t,n){return function(o,i,r,s){var a=o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name;if(null==t&&(n||a))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(o,i,r,s),n)(o,i,r,s);var l=(n?o:i).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},o=t.group;o&&"object"==_a(o)||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},nc=function(){!Ql&&bl&&Xa(bl,"display","none")},oc=function(){!Ql&&bl&&Xa(bl,"display","")};Gl&&!Ia&&document.addEventListener("click",(function(t){if(zl)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),zl=!1,!1}),!0);var ic=function(t){if(gl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,ql.some((function(t){var e=t[ll].options.emptyInsertThreshold;if(e&&!Qa(t)){var n=Za(t),o=i>=n.left-e&&i<=n.right+e,a=r>=n.top-e&&r<=n.bottom+e;return o&&a?s=t:void 0}})),s);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[ll]._onDragOver(n)}}var i,r,s},rc=function(t){gl&&gl.parentNode[ll]._isOutsideThisEl(t.target)};function sc(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=Aa({},e),t[ll]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return tc(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==sc.supportPointer&&"PointerEvent"in window&&!ka,emptyInsertThreshold:5};for(var o in hl.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in ec(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Kl,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Ra(t,"pointerdown",this._onTapStart):(Ra(t,"mousedown",this._onTapStart),Ra(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Ra(t,"dragover",this),Ra(t,"dragenter",this)),ql.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Aa(this,cl())}function ac(t,e,n,o,i,r,s,a){var l,c,d=t[ll],u=d.options.onMove;return!window.CustomEvent||Pa||La?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=n,l.draggedRect=o,l.related=i||e,l.relatedRect=r||Za(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function lc(t){t.draggable=!1}function cc(){Vl=!1}function dc(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function uc(t){return setTimeout(t,0)}function hc(t){return clearTimeout(t)}sc.prototype={constructor:sc,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Ml=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,gl):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,r=t.type,s=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=o.filter;if(function(t){Yl.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Yl.push(o)}}(n),!gl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!ka||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=za(a,o.draggable,n,!1))&&a.animated||Cl===a)){if(Sl=tl(a),_l=tl(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return ml({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),fl("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=za(l,o.trim(),n,!1))return ml({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),fl("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!za(l,o.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,s=i.options,a=r.ownerDocument;if(n&&!gl&&n.parentNode===r){var l=Za(n);if(yl=r,vl=(gl=n).parentNode,wl=gl.nextSibling,Cl=n,Al=s.group,sc.dragged=gl,Tl={target:gl,clientX:(e||t).clientX,clientY:(e||t).clientY},kl=Tl.clientX-l.left,$l=Tl.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,gl.style["will-change"]="all",o=function(){fl("delayEnded",i,{evt:t}),sc.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Da&&i.nativeDraggable&&(gl.draggable=!0),i._triggerDragStart(t,e),ml({sortable:i,name:"choose",originalEvent:t}),Ha(gl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){Ya(gl,t.trim(),lc)})),Ra(a,"dragover",ic),Ra(a,"mousemove",ic),Ra(a,"touchmove",ic),Ra(a,"mouseup",i._onDrop),Ra(a,"touchend",i._onDrop),Ra(a,"touchcancel",i._onDrop),Da&&this.nativeDraggable&&(this.options.touchStartThreshold=4,gl.draggable=!0),fl("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(La||Pa))o();else{if(sc.eventCanceled)return void this._onDrop();Ra(a,"mouseup",i._disableDelayedDrag),Ra(a,"touchend",i._disableDelayedDrag),Ra(a,"touchcancel",i._disableDelayedDrag),Ra(a,"mousemove",i._delayedDragTouchMoveHandler),Ra(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Ra(a,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,s.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){gl&&lc(gl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Fa(t,"mouseup",this._disableDelayedDrag),Fa(t,"touchend",this._disableDelayedDrag),Fa(t,"touchcancel",this._disableDelayedDrag),Fa(t,"mousemove",this._delayedDragTouchMoveHandler),Fa(t,"touchmove",this._delayedDragTouchMoveHandler),Fa(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Ra(document,"pointermove",this._onTouchMove):Ra(document,e?"touchmove":"mousemove",this._onTouchMove):(Ra(gl,"dragend",this),Ra(yl,"dragstart",this._onDragStart));try{document.selection?uc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(Bl=!1,yl&&gl){fl("dragStarted",this,{evt:e}),this.nativeDraggable&&Ra(document,"dragover",rc);var n=this.options;!t&&Ha(gl,n.dragClass,!1),Ha(gl,n.ghostClass,!0),sc.active=this,t&&this._appendGhost(),ml({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Pl){this._lastX=Pl.clientX,this._lastY=Pl.clientY,nc();for(var t=document.elementFromPoint(Pl.clientX,Pl.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Pl.clientX,Pl.clientY))!==e;)e=t;if(gl.parentNode[ll]._isOutsideThisEl(t),e)do{if(e[ll]){if(e[ll]._onDragOver({clientX:Pl.clientX,clientY:Pl.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=Ba(e));oc()}},_onTouchMove:function(t){if(Tl){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=bl&&Va(bl,!0),s=bl&&r&&r.a,a=bl&&r&&r.d,l=Zl&&Wl&&el(Wl),c=(i.clientX-Tl.clientX+o.x)/(s||1)+(l?l[0]-Xl[0]:0)/(s||1),d=(i.clientY-Tl.clientY+o.y)/(a||1)+(l?l[1]-Xl[1]:0)/(a||1);if(!sc.active&&!Bl){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))i.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}(t,i,this)&&!m.animated){if(m===gl)return P(!1);if(m&&r===t.target&&(s=m),s&&(n=Za(s)),!1!==ac(yl,r,gl,e,s,n,t,!!s))return T(),m&&m.nextSibling?r.insertBefore(gl,m.nextSibling):r.appendChild(gl),vl=r,L(),P(!0)}else if(m&&function(t,e,n){var o=Za(Ka(n.el,0,n.options,!0)),i=al(n.el,n.options,bl),r=10;return e?t.clientXd+c*r/2:lu-Fl)return-Rl}else if(l>d+c*(1-i)/2&&lu-c*r/2))return l>d+c/2?1:-1;return 0}(t,s,n,i,C?1:a.swapThreshold,null==a.invertedSwapThreshold?a.swapThreshold:a.invertedSwapThreshold,Hl,Ml===s),0!==v){var O=tl(gl);do{O-=v,y=vl.children[O]}while(y&&("none"===Xa(y,"display")||y===bl))}if(0===v||y===s)return P(!1);Ml=s,Rl=v;var _=s.nextElementSibling,N=!1,A=ac(yl,r,gl,e,s,n,t,N=1===v);if(!1!==A)return 1!==A&&-1!==A||(N=1===A),Vl=!0,setTimeout(cc,30),T(),N&&!_?r.appendChild(gl):s.parentNode.insertBefore(gl,N?_:s),x&&rl(x,0,S-x.scrollTop),vl=gl.parentNode,void 0===b||Hl||(Fl=Math.abs(b-Za(s)[E])),L(),P(!0)}if(r.contains(gl))return P(!1)}return!1}function j(a,l){fl(a,p,Oa({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:P,onMove:function(n,o){return ac(yl,r,gl,e,n,Za(n),t,o)},changed:L},l))}function T(){j("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function P(e){return j("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(Ha(gl,jl?jl.options.ghostClass:c.options.ghostClass,!1),Ha(gl,a.ghostClass,!0)),jl!==p&&p!==sc.active?jl=p:p===sc.active&&jl&&(jl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){j("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===gl&&!gl.animated||s===r&&!s.animated)&&(Ml=null),a.dragoverBubble||t.rootEl||s===document||(gl.parentNode[ll]._isOutsideThisEl(t.target),!e&&ic(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){Ol=tl(gl),Nl=tl(gl,a.draggable),ml({sortable:p,name:"change",toEl:r,newIndex:Ol,newDraggableIndex:Nl,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Fa(document,"mousemove",this._onTouchMove),Fa(document,"touchmove",this._onTouchMove),Fa(document,"pointermove",this._onTouchMove),Fa(document,"dragover",ic),Fa(document,"mousemove",ic),Fa(document,"touchmove",ic)},_offUpEvents:function(){var t=this.el.ownerDocument;Fa(t,"mouseup",this._onDrop),Fa(t,"touchend",this._onDrop),Fa(t,"pointerup",this._onDrop),Fa(t,"touchcancel",this._onDrop),Fa(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;Ol=tl(gl),Nl=tl(gl,n.draggable),fl("drop",this,{evt:t}),vl=gl&&gl.parentNode,Ol=tl(gl),Nl=tl(gl,n.draggable),sc.eventCanceled||(Bl=!1,Hl=!1,Ul=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),hc(this.cloneId),hc(this._dragStartId),this.nativeDraggable&&(Fa(document,"drop",this),Fa(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ka&&Xa(document.body,"user-select",""),Xa(gl,"transform",""),t&&(Il&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),bl&&bl.parentNode&&bl.parentNode.removeChild(bl),(yl===vl||jl&&"clone"!==jl.lastPutMode)&&El&&El.parentNode&&El.parentNode.removeChild(El),gl&&(this.nativeDraggable&&Fa(gl,"dragend",this),lc(gl),gl.style["will-change"]="",Il&&!Bl&&Ha(gl,jl?jl.options.ghostClass:this.options.ghostClass,!1),Ha(gl,this.options.chosenClass,!1),ml({sortable:this,name:"unchoose",toEl:vl,newIndex:null,newDraggableIndex:null,originalEvent:t}),yl!==vl?(Ol>=0&&(ml({rootEl:vl,name:"add",toEl:vl,fromEl:yl,originalEvent:t}),ml({sortable:this,name:"remove",toEl:vl,originalEvent:t}),ml({rootEl:vl,name:"sort",toEl:vl,fromEl:yl,originalEvent:t}),ml({sortable:this,name:"sort",toEl:vl,originalEvent:t})),jl&&jl.save()):Ol!==Sl&&Ol>=0&&(ml({sortable:this,name:"update",toEl:vl,originalEvent:t}),ml({sortable:this,name:"sort",toEl:vl,originalEvent:t})),sc.active&&(null!=Ol&&-1!==Ol||(Ol=Sl,Nl=_l),ml({sortable:this,name:"end",toEl:vl,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){fl("nulling",this),yl=gl=vl=bl=wl=El=Cl=xl=Tl=Pl=Il=Ol=Nl=Sl=_l=Ml=Rl=jl=Al=sc.dragged=sc.ghost=sc.clone=sc.active=null,Yl.forEach((function(t){t.checked=!0})),Yl.length=Ll=Dl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":gl&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;o{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(r.get("attributeNotPermitted",e||"")),Ac.add.attrs(t);let n;e&&(n=String(window.prompt(t.message.value,"")),t.addAction(e,n))},option:t=>{t.addAction()},condition:t=>{t.addAction(t)}},click:{btn:t=>{t.action()}},save:{form:Qi}},Ac={init:function(t){const e=Object.keys(Nc);return this.opts=e.reduce(((e,n)=>(e[n]={...Nc[n],...t[n]},e)),t),this},add:{attrs:t=>Ac.opts.add.attr(t),options:t=>Ac.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},Ac.opts.add.condition(t))},click:{btn:t=>Ac.opts.click.btn(t)},save:{form:t=>(Ac.opts.sessionStorage&&Gi.set(B,t),ns.formeoSaved({formData:t}),Ac.opts.save.form(t))}},jc=Object.freeze({type:"field",displayType:"slider"}),Tc=t=>({transform:`translateX(${t?`${t}px`:0})`});class Pc{constructor(t){n(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),n(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=qd.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=Hi(jc,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const e=this.createPanelsWrap();this.nav=this.navActions();const o=new window.ResizeObserver((([{contentRect:{width:t}}])=>{this.currentWidth!==t&&(this.toggleTabbedLayout(),this.currentWidth=t,this.nav.setTranslateX(this.activePanelIndex,!1))})),i=window.setTimeout((()=>{o.observe(e),window.clearTimeout(i)}),H)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(qd.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||jc.displayType,this.panelDisplay}createPanelsWrap(){const t=qd.create({className:"panels",content:this.opts.panels.map((({config:t,...e})=>e))});return"field"===this.opts.type&&this.sortableProperties(t),this.panelsWrap=t,this.panels=t.children,this.currentPanel=this.panels[this.activePanelIndex],t}sortableProperties(t){const e=t.getElementsByClassName("field-edit-group");return Jr.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&sc.create(t,{animation:150,group:{name:`edit-${t.editGroup}`,pull:!0,put:["properties"]},sort:!0,handle:".prop-order",onSort:t=>{this.propertySave(t.to),this.resizePanels()}})}))}createPanelNavLabels(){const t=this.opts.panels.map((t=>({tag:"h5",action:{click:t=>{const e=Ur(t.target,t.target.parentElement);this.nav.setTranslateX(e,!1),this.nav.groupChange(e)}},content:t.config.label}))),e={className:"panel-labels",content:{content:t}},[n]=t;return n.className="active-tab",qd.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:r.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:qd.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:r.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:qd.icon("triangle-left")};return qd.create({tag:"nav",attrs:{className:"panel-nav"},content:[e,this.labels,t]})}get isTabbed(){return"tabbed"===this.panelDisplay}navActions(){const t={},e=this.currentPanel.parentElement,n=this.labels.firstChild,o=n.children,i=this.currentPanel.parentElement.childNodes;this.activePanelIndex=Ur(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],qd.removeClasses(i,"active-panel"),qd.removeClasses(o,"active-tab"),this.currentPanel.classList.add("active-panel"),o[t].classList.add("active-tab"),this.currentPanel);const a=({offset:t,reset:o,duration:i=U,animate:r=!this.isTabbed})=>{const a=[Tc(s.panel),Tc(t.panel)],l=[Tc(s.nav),Tc(this.isTabbed?0:t.nav)];if(o){const[t]=a,[e]=l;a.push(t),l.push(e)}const c={easing:"ease-in-out",duration:r?i:0,fill:"forwards"},d=e.animate(a,c);n.animate(l,c);const u=()=>{this.panelsWrap.style.height=qd.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",u),o||(s=t)};d.addEventListener("finish",u)};return t.setTranslateX=(t=this.activePanelIndex,o=!0)=>{var i;i=t,r={nav:-n.offsetWidth*i,panel:-e.offsetWidth*i},a({offset:r,animate:o})},t.refresh=(e=this.activePanelIndex)=>{this.activePanelIndex!==e&&t.groupChange(e),t.setTranslateX(this.activePanelIndex,!1),this.resizePanels()},t.nextGroup=()=>{const e=this.activePanelIndex+1;if(e!==i.length){const o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:s.nav-8,panel:s.panel-8},a({offset:r,reset:!0});return this.currentPanel},t.prevGroup=()=>{if(0!==this.activePanelIndex){const e=this.activePanelIndex-1,o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:8,panel:8},a({offset:r,reset:!0})},t}}const Lc="a an and as at but by for for from in into near nor of on onto or the to with".split(" ").map((t=>`\\s${t}\\s`)),Dc=new RegExp(`(?!${Lc.join("|")})\\w\\S*`,"g"),kc=/\s+/g;function $c(t){if("string"!=typeof t)return t;if(t.trim().match(kc))return t;return t.replace(Dc,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const Ic=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Mc="f-autocomplete",Rc="highlight-component",Fc=({name:t,id:e,...n})=>["config.label","config.controlId","meta.id","attrs.id"].reduce(((t,e)=>t||n.get(e)),null)||"external"===t&&((...t)=>r.get(t.join("."))||$c(t.join(" ")))(t,e);class Wc{constructor(t,e,o){n(this,"lastCache",Date.now()),n(this,"optionsCache",null),this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=o,this.build()}build(){const t=t=>{const e=this.list,n=this.getActiveOption();let o=new Map([[38,()=>{const t=this.getPreviousOption(n);t&&this.selectOption(t)}],[40,()=>{const t=this.getNextOption(n);t&&this.selectOption(t)}],[13,()=>{n&&(this.selectOption(n),this.setValue(n),"none"===e.style.display?this.showList(n):this.hideList()),t.preventDefault()}],[27,()=>{this.hideList()}]]).get(t.keyCode);return o||(o=()=>!1),o()},e={focus:({target:e})=>{this.updateOptions(),e.parentElement.classList.add(`${this.className}-focused`);const n=qd.toggleElementsByStr(this.list.querySelectorAll("li"),e.value);e.addEventListener("keydown",t);const o=this.list.querySelector(".active-option")||n[0];this.showList(o)},blur:({target:e})=>{e.parentElement.classList.remove(`${this.className}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const e=qd.toggleElementsByStr(this.list.querySelectorAll("li"),t.target.value);if(0===t.target.value.length&&this.clearValue(),0===e.length)this.hideList();else{const t=this.getActiveOption()||e[0];this.showList(t)}const n=t.target.value.trim();this.hiddenField.value=n,this.value=n,this.setValue({dataset:{label:n,value:n}})}};return this.displayField=qd.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${Mc}-display-field`,value:this.label||this.value,placeholder:r.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=qd.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=qd.create({tag:"ul",attrs:{className:`${Mc}-list`}}),this.dom=qd.create({children:[this.displayField,this.hiddenField],className:this.className,action:{onRender:t=>{this.stage=t.closest(".formeo-stage");const e=this.value&&Wd.getAddress(this.value);this.label=e&&Fc(e),this.label&&(this.displayField.value=this.label)}}}),this.dom}updateOptions(){let t=this.optionsCache;const e=Date.now();(!t||e-this.lastCache>10*H)&&(qd.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){const t=(t=>{const e=[],n=Wd.flatList(),o=Object.entries(n).map((([n,o])=>{const i=Fc(o);if(i){const r={tag:"span",content:` ${$c(o.name)}`,className:"component-type"},s=`${o.name}.${i}`;e.push(s);const a=((t,e)=>{const n=t.reduce(((t,n)=>t+(n===e)),0);return n>1?`(${n})`:""})(e,s),l=[`${i} `,{tag:"span",content:a,className:"component-label-count"},r];return(({id:t,textLabel:e,htmlLabel:n,selectedId:o})=>{const i={value:t,textLabel:e,htmlLabel:n};return t===o&&(i.selected=!0),i})({id:n,textLabel:[i,a].join(" ").trim(),htmlLabel:l,selectedId:t})}}));return o.filter(Boolean)})(),e=t=>{const e=`${Mc}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return this.optionsCache=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${Mc}-list-item`,action:{mousedown:({target:t})=>{t=e(t),this.setValue(t),this.selectOption(t),this.hideList()},mouseover:({target:t})=>{t=e(t),this.removeHighlight(),this.highlightComponent(t)}}};return qd.create(r)})),this.optionsCache}setListPosition(){const{offsetHeight:t,offsetWidth:e}=this.displayField,n=this.displayField.closest(".formeo-stage").getBoundingClientRect(),o=this.displayField.getBoundingClientRect(),i={position:"absolute",top:o.y+t+window.scrollY-n.y+"px",left:o.x+window.scrollX-n.x+"px",width:`${e+1}px`};Object.assign(this.list.style,i)}showList(t,e=this.list){this.stage.contains(this.list)||this.stage.appendChild(this.list),this.setListPosition(),this.selectOption(t),Kr.slideDown(e,U)}hideList(t=this.list){Kr.slideUp(t,U),this.removeHighlight(),this.stage.contains(this.list)&&this.stage.removeChild(this.list)}getActiveOption(t=this.list){const e=t.querySelector(".active-option");return"none"!==(null==e?void 0:e.style.display)?e:null}getPreviousOption(t){let e=t;do{e=e?e.previousSibling:null}while(null!=e&&"none"===e.style.display);return e}getNextOption(t){let e=t;do{e=e?e.nextSibling:null}while(null!=e&&"none"===e.style.display);return e}selectOption(t,e=this.list){var n;const o=e.querySelectorAll("li");for(const i of o){const{dataset:{value:t}}=i;if(i.classList.remove("active-option"),t){null==(n=Wd.getAddress(t).dom)||n.classList.remove(Rc)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(Rc);for(const e of t)e.classList.remove(Rc)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=Wd.getAddress(n).dom)||e.classList.add(Rc)}}clearValue(){this.selectOption(null),this.displayField.value="",this.hiddenField.value="",this.value="",this.runEvent("onChange",{target:this.hiddenField})}setValue(t){const{label:e,value:n}=t.dataset;this.displayField.value=e,this.hiddenField.value=n,this.value=n,this.runEvent("onChange",{target:this.hiddenField})}addEvent(t,e){this.events.push([t,e])}runEvent(t,e){for(const[n,o]of this.events)n===t&&o(e)}}const Bc=(t,e)=>{const n=(t=>{const e=Ji(t),n={"field.property":Z,...J},o=e?(i=t,Wd.getAddress(i).getData()):n[t];var i;return Object.keys(o).reduce(((t,e)=>(t[e]=e,t)),{})})(t);return Object.entries(n).reduce(((n,[o,i])=>{if("id"!==o){const s={tag:"option",content:r.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(s.attrs.selected=!0),n.push(qd.create(s))}return n}),[])},zc=(t,e)=>{qd.empty(t);for(const n of e)t.add(n)},qc=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:r.get(`${t}.placeholder`)||$c(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},Uc=t=>{const e=r.get(t);if(e)return e;const n=t.split(".");return r.get(n[n.length-1])},Hc={autocomplete:(t,e,n)=>new Wc(t,e,n),string:(t,e)=>qc({key:t,value:e}),boolean:(t,e)=>qc({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>qc({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:Uc(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>Hc[qd.childType(e)](t,e)))},Xc=["selected","checked"],Vc={boolean:(t,e)=>({click:({target:{checked:n}})=>{var o,i;"radio"===(null==(i=null==(o=e.data)?void 0:o.attrs)?void 0:i.type)&&e.set("options",e.data.options.map((t=>({...t,selected:!1})))),e.set(t,n)}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n)}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n))}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n)}}),object:()=>({})};class Yc{constructor({key:t,data:e,index:o,field:i}){n(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:r.get(t)||t};return e.map(((e,o)=>{const i=[],r=Object.entries(e).map((([e,n])=>{const r=this.conditionInput(e,n,t,o);return r&&i.push([r.className,n.trim()].filter(Boolean).join("-")),r})).filter(Boolean),s=Hr(r,G.map((t=>`condition-${t}`)),"className||dom.className");return this.processConditionUIState(s),o||s.unshift(n),this.itemFieldGroups.push(s),{children:s,className:`f-condition-row ${t}-condition-row ${i.join(" ")}`}}))})),n(this,"processConditionUIState",(t=>{const e=e=>(e=e.split("|"),t.filter((t=>e.includes(t.className)))),n=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.style.display="none"})),clearTimeout(e)}),q)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),q)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=Ji(t.value)?t.value:"field.property",a=Bc(s,r.value);return zc(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Zi(t.value)&&t.value?o(i):n(i)}],["condition-sourceProperty",t=>{const i=e("condition-comparison|condition-targetProperty|condition-target"),r=t.value;return(t=>/^is|^has/.test(t))(r.substring(r.lastIndexOf(".")+1,r.length))?n(i):o(i)}]]);for(const r of t){const t=i.get(r.className);t&&t(r)}})),n(this,"conditionInput",((t,e,n,o)=>{const i=this.field,r=`${this.itemKey}.${n}.${o}`,s=`${this.field.id}.${r}`,a=`${i.name}s.${s}.${t}`,l=(t,e,n)=>{const o=Bc(n||t,e),i=Hc.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=qd.create(i);return zc(r,o),r},c=({target:t})=>{const e=t.closest(".f-condition-row"),n=new RegExp(`${t.className}(?:\\S?)+`,"gm");e.className=e.className.replace(n,"");const o={dataPath:a,value:t.value,src:t};ns.formeoUpdated(o),Wd.setAddress(a,t.value);const i=Ur(e);this.processConditionUIState(this.itemFieldGroups[i])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=Hc.autocomplete(`condition.${e}`,t,n);return Wd.setConditionMap(t,i),o.addEvent("onChange",(t=>{Wd.removeConditionMap(Wd.getAddress(a)),c(t),Wd.setConditionMap(t.target.value,i)})),o},sourceProperty:t=>l("sourceProperty",t,"field.property"),targetProperty:t=>l("targetProperty",t,"field.property"),target:t=>d.source(t,"target"),value:t=>{const e=Hc.string("condition.value",t);return e.action={input:c},qd.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=Hr(Object.entries(e),Xc,"0");const[s,a]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=s,this.isDisabled=i.isDisabledProp(a,s),this.isHidden=this.isDisabled&&i.config.panels[s].hideDisabled,this.isLocked=i.isLockedProp(a,s),this.dom=qd.create({tag:"li",className:[`field-${t.replace(/\./g,"-")}`,"prop-wrap",this.isHidden&&"hidden-property"],children:{className:"field-prop",children:[this.itemInputs,this.itemControls]}})}get itemInputs(){this.itemFieldGroups=[];return{className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>{let n="conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e);return["selected","checked"].includes(t)&&(n={className:"f-addon",children:n}),n}))}}get itemControls(){if(this.isLocked){return{className:`${this.panelName}-prop-controls prop-controls`,content:[]}}const t={tag:"button",attrs:{type:"button",className:"prop-remove prop-control"},action:{click:()=>{Kr.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),qd.remove(t),this.field.resizePanelWrap()}))}},content:qd.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=qd.childType(e)||"string",o={config:{},attrs:{},...Hc[n](t,e)},i=this.itemKey.replace(/.\d+$/,(e=>`${e}.${t}`)),r=i.split(".").filter(Number.isNaN).join(".")||t,[s,a]=[[...this.itemKey.split("."),t],[t]].map((t=>[this.field.id,...t].filter(Boolean).join("-")));return o.config={...o.config,label:"options"!==this.panelName&&(Uc(r)||$c(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...Vc[n](i,this.field)},o}}class Gc{constructor(t,e,o){n(this,"addAttribute",((t,e)=>{let n=e;const o=Ic(t),i=`attrs.${o}`;r.current[i]||r.put(i,Gr(t)),"string"==typeof n&&["true","false"].includes(n)&&(n=JSON.parse(n)),this.field.set(`attrs.${t}`,n);const s=this.props.querySelector(`.field-attrs-${o}`),a=new Yc({key:i,data:{[o]:n},field:this.field});s?this.props.replaceChild(a.dom,s):this.props.appendChild(a.dom),this.field.resizePanelWrap()})),n(this,"addOption",(()=>{const t=this.field.data.config.controlId,e=this.field.get("options"),n="select"===t?"option":t,o=r.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=Ic(o));const l=new Yc({key:i,data:a,field:this.field,index:this.props.children.length});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.field.set(i,a),this.field.resizePanelWrap()})),n(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new Yc({key:e,data:t.template,field:this.field});n?this.props.replaceChild(o.dom,n):this.props.appendChild(o.dom),this.field.set(e,t.template),this.field.resizePanelWrap()})),this.type=qd.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=e,this.field=o,this.panelConfig=this.getPanelConfig(this.data)}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{id:`${this.field.id}-${this.name}-panel`,config:{label:r.get(`panel.label.${this.name}`)},attrs:{className:`f-panel ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=[this.name,n?String(e):t[0]].join("."),i=n?t:{[t[0]]:t[1]};return new Yc({key:o,data:i,field:this.field})}));const e={tag:"ul",attrs:{className:["field-edit-group",`field-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return qd.create(e)}createEditButtons(){const t=this,e=this.name,n=r.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...qd.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:qd.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:r.get(`action.add.${e}.attr`),value:r.get(`action.add.${e}.value`)});const s=$c(e),a=new window.CustomEvent(`onAdd${s}`,{detail:i});Ac.add[e](i),document.dispatchEvent(a)}}}]}}}class Zc extends xa{constructor(t,e={},o){const i={...e,id:e.id||Ui()};super(t,i),n(this,"mutationHandler",(t=>t.map((t=>{})))),n(this,"remove",(t=>{if(t){const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?qr(n)?o.splice(Number(n),1):this.set(e,o.filter((t=>t!==n))):delete o[n],o}if("stage"===this.name)return null;const e=this.parent,n=this.children;return Xr(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Wd.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Wd[`${this.name}s`].delete(this.id)})),n(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),n(this,"getComponentTag",(()=>qd.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&qd.icon("component-corner",{className:"bottom-left"}),qd.icon(`handle-${this.name}`),$c(this.name),(this.isColumn||this.isRow)&&qd.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),n(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[qd.childType(t)](this.dom)})),n(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),n(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),n(this,"onSort",(()=>this.saveChildOrder())),n(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${zi(t)}`),null==e||e.classList.remove(`hovering-${zi(e)}`)})),n(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),n(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Z[i]].some(Boolean)?t:e?o.set(Z[i],e):o.get(Z[i])})),n(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),n(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),n(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),n(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),n(this,"cloneData",(()=>{const t={...Xi(this.data),id:Ui()};return"field"!==this.name&&(t.children=[]),t})),n(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),n(this,"createChildWrap",(t=>qd.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=i.id,this.name=t,this.config=Wd[`${this.name}s`].config,Hi(this.config,i.config),this.dataPath=`${this.name}s.${this.id}.`,this.observer=new window.MutationObserver(this.mutationHandler),this.render=o}observe(t){this.observer.disconnect(),this.observer.observe(t,{childList:!0})}get js(){return this.data}get json(){return this.data}empty(){const t=this.children.map((t=>{t.remove()}));return this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{Wd.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Wd.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...qd.btnTemplate({content:qd.icon(`handle-${this.name}`)}),className:["component-handle",`${this.name}-handle`]},{className:["action-btn-wrap",`${this.name}-action-btn-wrap`],children:this.buttons}]}}toggleEdit(t=!this.isEditing){this.isEditing=t;const e=this.dom,n="editing",o=`${n}-${this.name}`,i=this.dom.querySelector(`.${this.name}-edit`);Kr.slideToggle(i,q,t),"field"===this.name&&(Kr.slideToggle(this.preview,q,!t),e.parentElement.classList.toggle(`column-${o}`,t)),e.classList.toggle(n,t),e.classList.toggle(o,t)}get buttons(){if(this.actionButtons)return this.actionButtons;const t={handle:(t=`handle-${this.name}`)=>({...qd.btnTemplate({content:qd.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{Kr.slideUp(this.dom,q,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-clone"],meta:{id:"clone"},action:{click:()=>{this.clone(this.parent),"column"===this.name&&this.parent.autoColumnWidths()}}})},{buttons:e,disabled:n}=this.config.actionButtons,o=e.filter((t=>!n.includes(t))).map((e=>{var n;return(null==(n=t[e])?void 0:n.call(t))||e}));return this.actionButtons=o,this.actionButtons}get index(){return Ur(this.dom)}get parentType(){return R.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${P[t]}`);return e&&qd.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=M.get(this.name);return Vr(t,(t=>Wd.getAddress(`${e}s.${t.id}`))).filter(Boolean)}get domChildren(){const t=this.dom.querySelector(".children");return t?t.children:[]}addChild(t={},e=this.domChildren.length){var n,o;let i=t;"object"!=typeof t&&(i={id:i});const r=this.dom.querySelector(".children"),{id:s=Ui()}=i,a=M.get(this.name);if(!a)return null;const l=`${a}s`,c=Wd.getAddress(`${l}.${s}`)||Wd[l].add(s,i);r.insertBefore(c.dom,r.children[e]),null==(o=null==(n=this.config.events)?void 0:n.onAddChild)||o.call(n,{parent:this,child:c});const d=c.get("children");return(null==d?void 0:d.length)&&c.loadChildren(d),this.removeClasses("empty"),this.saveChildOrder(),c}onAdd({from:t,to:e,item:n,newIndex:o}){var i;t.classList.contains(y)||(t=t.parentElement);const r=zi(t),s=zi(e.parentElement),a=new Map([[-2,()=>{const t=this.addChild({},o).addChild();return t.addChild.bind(t)}],[-1,()=>{const t=this.addChild({},o);return t.addChild.bind(t)}],[0,()=>this.addChild.bind(this)],[1,t=>{const e=Ur(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:{meta:{id:t},...e}}=vd.get(n.id);zr(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=Br({stage:{row:0,column:-1,field:-2},row:{row:1,column:0,field:-1},column:{row:2,column:1,field:0},field:1},`${this.name}.${i}`),s=a.get(r)();qd.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||Qi)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||Qi)();return null==t?void 0:t(n.id)}},c=null==(i=l[r])?void 0:i.call(l,n,o);return(()=>{this.saveChildOrder(),this.removeClasses("empty")})(),c}onRemove({from:{parentElement:t}}){return t.classList.contains(E)&&t.classList.remove("column-editing-field"),"stage"===this.name||this.children.length?(this.emptyClass(),this.saveChildOrder()):this.remove()}onRender(){const{events:t}=this.config;if(!t)return null;t.onRender&&qd.onRender(this.dom,t.onRender)}set config(t){const e=Br(t,"all"),n=Br(this.data,"config.controlId"),o=[e,n&&Br(t,n),Br(t,this.id)].reduce(((t,e)=>e?Hi(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Wd[e];return n===this.id?this:null==o?void 0:o.get(n)}cloneChildren(t){for(const e of this.children)null==e||e.clone(t)}get isRow(){return this.name===j.row}get isColumn(){return this.name===j.column}get isField(){return this.name===j.field}}class Jc extends Zc{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),n(this,"updateConditionsPanel",Ki((()=>{const t=this.editPanels.find((({name:t})=>"conditions"===t));if(!t)return null;const e=t.createProps(),n=this.dom.querySelector(".field-edit-conditions");n.parentElement.replaceChild(e,n)}),q)),n(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=qd.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),n(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=qi([...this.config.panels.order,...Object.keys(this.data)]),n=["config","meta","action","events",...this.config.panels.disabled],o=e.filter((t=>!n.includes(t)));for(const r of o){const e=this.get(r),n=qd.childType(e);if(t.includes(n)){const t=new Gc(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Pc(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),n(this,"toggleCheckedOptions",((t,e)=>{const n=this.get("options").map(((n,o)=>{const i=o===t;return"radio"===e?n.selected=i:n.checked=i?!n.checked:n.checked,n}));this.set("options",n)})),n(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get(`config.disabled${$c(e)}`)).includes(t)})),n(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get(`config.locked${$c(e)}`)).includes(t)})),this.debouncedUpdateEditPanels=function(t,e=333){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}(this.updateEditPanels),this.label=qd.create(this.labelConfig),this.preview=qd.create({}),this.editPanels=[];const e=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));let i={tag:"li",attrs:{className:x},id:this.id,children:[this.label,this.getComponentTag(),e,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:r.get("field")}};i=qd.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return null;const t=this.get("config.editorLabel")||this.get("config.label"),e=this.get("attrs.required"),n=this.config.label.disableHTML;return{className:"prev-label",children:[{...(()=>{const e={tag:"label",attrs:{}};return n?(e.tag="input",e.attrs.value=t,e):(e.attrs.contenteditable=!0,e.children=t,e)})(),action:{input:({target:{innerHTML:t,innerText:e,value:o}})=>{super.set("config.label",n?o:t);const i=Wd.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&qd.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=qd.create(this.labelConfig);this.label.parentElement.replaceChild(t,this.label),this.label=t}get fieldEdit(){const t={className:["field-edit","slide-toggle","formeo-panels-wrap"]};this.updateEditPanels();const e=this.editPanels.length;return e&&(t.className.push(`panel-count-${e}`),t.content=[this.panels.panelNav,this.panels.panelsWrap],this.panelNav=this.panels.nav,this.resizePanelWrap=this.panels.nav.refresh),t.action={onRender:()=>{if(0===e){const t=this.dom,e=t.querySelector(".item-edit-toggle"),n=t.querySelector(".field-actions"),o=n.getElementsByTagName("button");n.style.maxWidth=o.length*o[0].clientWidth+"px",qd.remove(e)}else this.resizePanelWrap()}},qd.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=Ur(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=Xi(this.data),{action:n={}}=vd.get(e.config.controlId);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:qd.create(e,!0),action:this.defaultPreviewActions}}}const Kc={js:new Set,css:new Set},Qc=(t,e,n=tr)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),td=(t,e)=>{t.removeEventListener("load",td),e(t.src)},ed=(t,e)=>{t.removeEventListener("load",ed),e(t.src)},nd=t=>new Promise(((e,n)=>{if(Kc.js.has(t))return e(t);Kc.js.add(t);const o=qd.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>ed(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),od=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(Kc.css.has(t))return e(t);Kc.css.add(t);const o=qd.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>td(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},id=async(t=g)=>{if(document.getElementById(f))return;const e=async t=>(t=>{let e=document.getElementById(f);return e||(e=qd.create({id:f,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return Qc(t,e,(()=>Qc(v,e)))},rd={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>nd(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>od(t)));return Promise.all(e)}},sd=t=>{const e=Object.entries(t).map((([t,e])=>rd[t](e)));return Promise.all(e)},ad=()=>{const t=document.getElementById(f);return"hidden"===window.getComputedStyle(t).visibility};class ld{constructor({events:t={},dependencies:e={},controlAction:o,...i}){n(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=e,this.id=i.id||Ui()}get controlId(){var t;return null==(t=this.controlData.meta)?void 0:t.id}get dom(){const{meta:t,config:e}=this.controlData,n=this.i18n(e.label)||e.label,o={tag:"button",attrs:{type:"button"},content:[{tag:"span",className:"control-icon",children:qd.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&vd.panels.nav.refresh(Ur(e))},click:({target:t})=>{vd.addElement(t.parentElement.id)}}};return qd.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return sd(this.dependencies)}i18n(t,e){var n,o;const i=r.locale,s=null==(n=this.definition)?void 0:n.i18n,a=(null==s?void 0:s[i])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||r.get(t,e)}}const cd=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const dd=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:r.get("labelCount",{label:$c(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const ud=[class extends ld{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:r.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:r.get("button"),type:["button","submit","reset"].map((t=>({label:t,type:t}))),className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:r.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:r.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:r.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends ld{constructor(){super({tag:"textarea",config:{label:r.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends ld{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:r.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:r.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends ld{constructor(){super({tag:"select",config:{label:r.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:dd("option")})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:r.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:dd("checkbox",1)})}},class extends ld{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:r.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:dd("radio")})}}],hd=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),pd="controls.html.header";const fd=[class extends ld{constructor(){super({tag:hd[0],attrs:{tag:hd.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:r.get(pd),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:r.get(pd),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(pd)}},class extends ld{constructor(){super({tag:"p",attrs:{className:""},config:{label:r.get("controls.html.paragraph"),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"paragraph",id:"paragraph"},content:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."})}},class extends ld{constructor(){super({tag:"hr",config:{label:r.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends ld{constructor(t){super(Hi({tag:"textarea",config:{label:"WYSIWYG",editableContent:!0},meta:{group:"html",icon:"rich-text",id:"tinymce"},attrs:{required:!1},dependencies:{js:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"},action:{onRender:t=>{const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}},controlAction:{click:()=>{},onRender:()=>{}}},t))}}],md=Object.freeze({sortable:!0,elementOrder:{},groupOrder:[],groups:[{id:"layout",label:"controls.groups.layout",elementOrder:["row","column"]},{id:"common",label:"controls.groups.form",elementOrder:["button","checkbox"]},{id:"html",label:"controls.groups.html",elementOrder:["header","block-text"]}],disable:{groups:[],elements:[],formActions:[]},elements:[],container:null,panels:{displayType:"slider"}}),gd=[...ud,...fd,...cd];const vd=new class{constructor(){n(this,"groupLabel",(t=>r.get(t)||t||"")),n(this,"layoutTypes",{row:()=>Dd.active.addChild(),column:()=>this.layoutTypes.row().addChild(),field:t=>this.layoutTypes.column().addChild(t)}),n(this,"addElement",(t=>{const{meta:{group:e,id:n},...o}=Br(this.get(t),"controlData");return zr(o,"config.controlId",n),"layout"===e?this.layoutTypes[n.replace("layout-","")]():this.layoutTypes.field(o)})),n(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=Hi(md,t);return this.container=e,this.groupOrder=qi(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...gd,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&this.panels.nav.refresh(Ur(e))},click:({target:t})=>{this.addElement(t.parentElement.id)}}}async init(t,e=!1){return await this.applyOptions(t),this.buildDOM(e),this}registerControls(t){return this.controls=[],t.map((async t=>{let e;return e="function"==typeof t?new t:new ld(t),this.add(e),this.controls.push(e.dom),e.promise()}))}groupElements(){let t=this.options.groups.slice(),e=this.controls.slice(),n=[];const o=[];return t=Hr(t,this.groupOrder,"id"),t=t.filter((t=>Bi(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:y,id:`${t.id}-${y}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=qi(e.concat(t.elementOrder));t.elementOrder=n}return e=Hr(e,t.elementOrder,"meta.id"),n.content=e.filter((e=>{const{controlData:n}=this.get(e.id),i=n.meta.id||"";let r=!0;return r=[Bi(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(i)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=Xi(t);return this.data.set(e.id,e),e.controlData.meta.id&&this.data.set(e.controlData.meta.id,e.controlData),e}get(t){return Xi(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...qd.btnTemplate({content:[qd.icon("bin"),r.get("clear")],title:r.get("clearAll")}),className:["clear-form"],action:{click:t=>{kd.size?(ns.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:r.get("confirmClearAll"),clearAllAction:()=>{Dd.clearAll().then((()=>{const e={src:t.target};ns.formeoCleared(e)}))},btnCoords:qd.coords(t.target)}}),document.dispatchEvent(ns.confirmClearAll)):window.alert(r.get("cannotClearFields"))}}},e={...qd.btnTemplate({content:[qd.icon("floppy-disk"),r.get("save")],title:r.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=Wd,n={action:()=>{},coords:qd.coords(t),message:"",button:t};return Ac.click.btn(n),Ac.save.form(e)}}};return{className:"form-actions f-btn-group",content:Object.entries({clearBtn:t,saveBtn:e}).reduce(((t,[e,n])=>(this.options.disable.formActions.includes(e)||t.push(n),t)),[])}}buildDOM(t){const e=this.groupElements(),n=this.formActions(),{displayType:o}=this.options.panels;this.panels=new Pc({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=qd.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=qd.create({className:a,content:[s,n]}),c=l.getElementsByClassName("control-group");this.dom=l,this.groups=c;const[d]=c;this.currentGroup=d,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=s.querySelector(".filtered-term");if(qd.toggleElementsByStr(n,t),e){const e=r.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=qd.create({tag:"h5",className:"filtered-term",content:e}),s.insertBefore(o,s.firstChild))}else o&&(l.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let r=c.length-1;r>=0;r--){const t=`formeo-controls-${c[r]}`;this.options.sortable||window.localStorage.removeItem(t),sc.create(c[r],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:({item:t})=>{const{controlData:e}=this.get(t.id);this.options.ghostPreview&&(t.innerHTML="",t.appendChild(new Jc(e).preview))},onEnd:({from:t,item:e,clone:n})=>{t.contains(n)&&t.replaceChild(e,n)},sort:this.options.sortable,store:{get:()=>{const e=window.localStorage.getItem(t);return e?e.split("|"):[]},set:e=>{const n=e.toArray();window.localStorage.setItem(t,n.join("|"))}}})}return l}};class bd extends xa{constructor(){super(...arguments),n(this,"load",(t=>{const e=er(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),n(this,"get",(t=>t?Br(this.data,t):this.add())),n(this,"add",((t,e=Object.create(null))=>{const n=t||Ui(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),n(this,"remove",(t=>{if(Array.isArray(t))for(const e of t)this.get(e).remove();else this.get(t).remove();return this.data})),n(this,"delete",(t=>(delete this.data[t],t))),n(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),n(this,"conditionMap",new Map)}set config(t){this.configVal=Hi(this.configVal,Xi(t))}get config(){return this.configVal}}class yd extends Zc{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=qd.create({attrs:{className:[w,"empty"],id:this.id},children:n}),sc.create(n,{animation:150,fallbackClass:"row-moving",forceFallback:!0,group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{wd.active=this},onSort:this.onSort.bind(this),draggable:`.${C}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Kr.slideUp(this.dom,q,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Kr.slideDown(this.dom,q)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const wd=new class extends bd{constructor(t){super("stages",t)}Component(t){return new yd(t)}};class Cd extends Zc{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[C]}),...t}),n(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Q);const t=n.dom,o=Yi(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),U);document.dispatchEvent(ns.columnResized)}this.updateColumnPreset()})),n(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>qd.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),n(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[C,"empty"],dataset:{hoverTag:r.get("row"),editingHoverTag:r.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),sc.create(e,{animation:150,fallbackClass:"column-moving",forceFallback:!0,group:{name:"row",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onRemove:this.onRemove.bind(this),onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),draggable:`.${E}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:r.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:r.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:r.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:r.get("row.makeInputGroup"),description:r.get("row.makeInputGroupDesc")}},n={className:"input-group",content:{tag:"input",attrs:{type:"text",ariaLabel:"Legend for fieldset",value:this.get("config.legend"),placeholder:"Title"},config:{label:{children:["Row Title",{tag:"span",content:" ⓘ",dataset:{tooltip:"Row title will be used as the legend for the fieldset"}}]}},action:{input:({target:{value:t}})=>this.set("config.legend",t)},className:""}},o=qd.formGroup([t,n]),i={tag:"label",content:r.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=qd.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",qd.formGroup([i,s],"row")];return qd.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>qd.create(t)));t.append(...e)}}})}onAdd(...t){super.onAdd(...t),this.autoColumnWidths()}onRemove(...t){super.onRemove(...t),this.autoColumnWidths()}get getColumnPresetOptions(){const t=this.children,e=F.get(t.length-1)||[],n=t.map((t=>{const e=t.get("config.width")||"";return Number(e.replace("%","")).toFixed(1)})).join(",");if(e.length){const t=e.slice();return!t.find((t=>t.value===n))&&t.push({value:n,label:n.replace(/,/g," | "),className:S}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:r.get("defineColumnLayout"),className:O},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const Ed={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const xd=new class extends bd{constructor(t){super("rows",t),this.config={all:Ed}}Component(t){return new Cd(t)}};class Sd{constructor(){this.onMove=this.onMove.bind(this),this.onStop=this.onStop.bind(this),this.cleanup=this.cleanup.bind(this)}getRowWidth(t){const e=t.querySelector(".children");if(!e)return 0;const n=e.children.length,o=qd.getStyle(e,"gap")||"0px",i=parseFloat(o,10)||0;return this.totalGapWidth=i*(n-1),e.offsetWidth-this.totalGapWidth}validateResizeTarget(t,e){return t&&e&&t.offsetWidth&&e.offsetWidth}onStart(t){if(t.preventDefault(),this.resized=!1,0!==t.button)return;const e=t.target.parentElement,n=e.nextSibling||e.previousSibling,o=e.closest(`.${C}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(_),this.columnPreset=o.querySelector(`.${O}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Q,""),n.className=n.className.replace(Q,""),this.colStartWidth=e.offsetWidth,this.sibStartWidth=n.offsetWidth,this.rowWidth=this.getRowWidth(o),this.rowWidth<=0)this.cleanup();else{this.column=e,this.sibling=n,this.row=o;try{window.addEventListener("pointermove",this.onMove,!1),window.addEventListener("pointerup",this.onStop,!1)}catch(i){this.cleanup()}}else this.cleanup()}calculateNewWidths(t){const e=this.colStartWidth+t-this.startX,n=this.sibStartWidth-t+this.startX,o=parseFloat(Vi(e,this.rowWidth)),i=parseFloat(Vi(n,this.rowWidth));return o<10||i<10?null:{colWidth:Yi(o.toFixed(1)),siblingColWidth:Yi(i.toFixed(1))}}onMove(t){t.preventDefault();const{column:e,sibling:n}=this,o="touchmove"===t.type?t.touches[0].clientX:t.clientX,i=this.calculateNewWidths(o);if(!i)return;const{colWidth:r,siblingColWidth:s}=i;e.dataset.colWidth=r,n.dataset.colWidth=s,e.style.width=r,n.style.width=s,this.resized=!0}onStop(){const{column:t,sibling:e}=this;window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop),this.resized&&(this.setCustomWidthValue(),Wd.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Wd.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(_),this.resized=!1,this.cleanup())}cleanup(){this.column&&this.originalColumnClass&&(this.column.className=this.originalColumnClass),this.sibling&&this.originalSiblingClass&&(this.sibling.className=this.originalSiblingClass),this.row&&this.row.classList.remove(_),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${S}`);const n=this.row.querySelector(".children").children,o=Vr(n,(t=>Vi(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=qd.create({tag:"option",attrs:{className:S,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Od=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[qd.icon("triangle-down"),qd.icon("triangle-up")]}),_d=()=>({className:"column-edit group-config"});class Nd extends Zc{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[E]}),...t}),n(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),n(this,"setDomWidth",(t=>{this.dom.dataset.colWidth=t,this.dom.style.width=t})),n(this,"setWidth",(t=>(this.setDomWidth(t),this.set("config.width",t))));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[E,"empty"],dataset:{hoverTag:r.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),_d(),Od(new Sd),e]}),this.processConfig(),ns.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),sc.create(e,{animation:150,fallbackClass:"field-moving",forceFallback:!0,group:{name:"column",pull:!0,put:["column","controls"]},sort:!0,disabled:!1,onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),onRemove:this.onRemove.bind(this),onMove:t=>{t.from!==t.to&&t.from.classList.remove("hovering-column")},draggable:`.${x}`,handle:".item-move"})}processConfig(){const t=Jr.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Ad={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const jd=new class extends bd{constructor(t){super("columns",t),this.config={all:Ad}}Component(t){return new Nd(t)}},Td={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Pd=new class extends bd{constructor(t){super("fields",t),n(this,"get",(t=>{let e=t&&Br(this.data,t);if(!e){const n=vd.get(t);n&&(e=this.add(null,n.controlData))}return e})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>{const{conditions:o,...i}=(null==n?void 0:n.getData())||n;if(null==o?void 0:o.length){let t=!0;if(1===o.length){const[e]=o;t=Boolean(e.if[0].source&&e.then[0].target)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),n(this,"load",((t=Object.create(null))=>{const e=er(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&zr(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:Td}}Component(t){return new Jc(t)}};const Ld=new class extends bd{constructor(t){super("externals",t)}Component(t){return new Zc("external",t)}},Dd=wd,kd=xd,$d=jd,Id=Pd,Md=vd,Rd=Ld,Fd=()=>({id:Ui(),stages:{[Ui()]:{}},rows:{},columns:{},fields:{}});const Wd=new class extends xa{constructor(){super("components"),n(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?Xi(er(t)):e&&Gi.get(B)||Fd())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",Dd.load(n.stages)),this.add("rows",kd.load(n.rows)),this.add("columns",$d.load(n.columns)),this.add("fields",Id.load(n.fields)),this.add("externals",Rd.load(this.opts.external));for(const o of Object.values(this.get("stages")))o.loadChildren();return this.data})),this.disableEvents=!0,this.stages=Dd,this.rows=kd,this.columns=$d,this.fields=Id,this.controls=Md,this.externals=Rd}flatList(t=this.data,e=Object.create(null)){return Object.entries(t).reduce(((t,[e,n])=>{if("object"==typeof n)for(const[o,i]of Object.entries(n))t[`${e}.${o}`]=i;return t}),e)}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:wd.getData(),rows:xd.getData(),columns:jd.getData(),fields:Pd.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Dd.config=e,kd.config=n,$d.config=o,Id.config=i}setAddress(t,e){const[n,o,...i]=Array.isArray(t)?t:t.split("."),r=this[n.replace(/s?$/,"s")].get(o);return null==r||r.set(i,e),r}getAddress(t){if(!Zi(t))return;const[e,n,...o]=Array.isArray(t)?t:t.split("."),i=this[e.replace(/s?$/,"s")].get(n);return o.length?i.get(o):i}getConditionMap(t){if(Zi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Zi(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Zi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},Bd={glyphicons:t=>``,"font-awesome":t=>{const[e,n]=t.split(" ");return``},fontello:t=>`${t}`},zd=new Set(["input","textarea","select"]);const qd=new class{constructor(t=Object.create(null)){n(this,"render",(t=>(t.id=`f-${t.id||Ui()}`,this.create(t)))),n(this,"create",((t,e=!1)=>{if(!t)return;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processTagName(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[Jr.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let h=document.createElement(c);const p={string:t=>{h.innerHTML+=t},object:t=>t&&h.appendChild(n.create(t,e)),node:t=>h.appendChild(t),component:t=>h.appendChild(t.dom),array:t=>{for(const e of t)l=n.childType(e),p[l](e)},function:t=>{t=t(),l=n.childType(t),p[l](t)},undefined:()=>null,boolean:()=>null};if(i&&(a.attrs=Hi(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return Jr.forEach(t,(t=>{u.children.push(n.create(t,e))})),a.attrs.className&&(u.className=a.attrs.className),u.config={...a.config},this.create(u,e);p.array.call(this,t),a.content=void 0,o.push("options")}if(a.attrs&&(n.processAttrs(a,h,e),o.push("attrs")),a.config){if(a.config.label&&(a.config.label&&"button"!==c||["radio","checkbox"].includes(Jr.get(a,"attrs.type")))&&!e){const t=n.label(a);if(!a.config.hideLabel){const e=[t,h];n.labelAfter(a)&&e.reverse(),u.children.push(e)}}o.push("config")}if(a.content||a.children){const t=a.content||a.children;l=n.childType(t),p[l],p[l].call(this,t)}if(s){for(const t in s)Object.hasOwn(s,t)&&(h.dataset[t]="function"==typeof s[t]?s[t]():s[t]);o.push("dataset")}a.action&&(this.actionHandler(h,a.action),o.push("action"));const f=Jr.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)h[f[d]]=a[f[d]];return u.children.length&&(h=this.create(u)),h})),n(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),n(this,"toggleElementsByStr",((t,e)=>{const n=[];return qd.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),n(this,"elementsContainText",((t,e,n)=>{const o=[];return Xr(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),n(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||r.get("labelCount",{label:r.get("option"),count:o})}}))),n(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),n(this,"removeEmpty",(t=>{const e=t.parentElement,n=zi(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),n(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),n(this,"isControls",(t=>zi(t)===y)),n(this,"isStage",(t=>zi(t)===w)),n(this,"isRow",(t=>zi(t)===C)),n(this,"isColumn",(t=>zi(t)===E)),n(this,"isField",(t=>zi(t)===x)),n(this,"asComponent",(t=>Wd[`${zi(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=Hi(this.options,t)}processTagName(t){let e,n=t;if("string"==typeof n)return e=n,n={tag:e},n;if(n.attrs){const{tag:t,...o}=n.attrs;if(t)if("string"==typeof t)e=t;else{e=(t.find((t=>!0===t.selected))||t[0]).value}n.attrs=o}return n.tag=e||n.tag||"div",n}actionHandler(t,e){const n={onRender:qd.onRender,render:qd.onRender},o=["focus","blur"];return Object.entries(e).map((([e,i])=>(Array.isArray(i)?i:[i]).map((i=>{const r=n[e]||(t=>(e,n)=>e.addEventListener(t,n,o.includes(t)))(e);return r(t,i)}))))}get icons(){if(this.iconSymbols)return this.iconSymbols;const t=document.querySelectorAll(`#${f} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(tt,"")]={tag:"svg",attrs:{className:["svg-icon",n=e.id]},children:[{tag:"use",attrs:{"xmlns:xlink":"http://www.w3.org/1999/xlink","xlink:href":`#${n}`}}]},t}),{}),this.cachedIcons={},this.iconSymbols}icon(t,e){var n,o;if(!t)return;const i=`${t}?${new URLSearchParams(e).toString()}`;if(null==(n=this.cachedIcons)?void 0:n[i])return this.cachedIcons[i];const r=this.icons[t];if(r){if(e){const t=Hi(r,e);return this.cachedIcons[i]=qd.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=qd.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Bd[qd.options.iconFont])?void 0:o.call(Bd,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",Ui(t));for(const i of Object.keys(o)){const t=Jr.safeAttrName(i),n=this.processAttrValue(o[i]);n&&e.setAttribute(t,!0===n?"":n)}}processAttrValue(t){let e=t||"";if(Array.isArray(e))if("object"==typeof e[0]){const t=e.filter((t=>!0===t.selected));e=t.length?t[0].value:e[0].value}else e=e.join(" ");return e}processOptions(t,e,n){const{action:o,attrs:i}=e,r=i.type||e.tag,s=i.id||e.id;return t.map(((t,i)=>{var a;const{label:l,...c}=t,d=()=>{const a={tag:"input",attrs:{name:s,type:r,value:t.value||"",id:`${s}-${i}`,...c},action:o},l={tag:"label",attrs:{for:`${s}-${i}`},config:{inputWrap:"form-check"},children:t.label},d={children:[a,l],className:[`f-${r}`]};return e.attrs.className&&(e.config.inputWrap=e.attrs.className),e.config.inline&&d.className.push(`f-${r}-inline`),t.selected&&(a.attrs.checked=!0),n&&(l.attrs.contenteditable=!0),d},u={select:()=>({tag:"option",attrs:t,children:t.label}),button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||Ui(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=u[r])?void 0:a.call(u,t)}))}holdsContent(t){return-1!==t.outerHTML.indexOf("/")}isBlockInput(t){return!this.isInput(t)&&this.holdsContent(t)}isInput(t){let e=t;return"string"!=typeof e&&(e=e.tagName),zd.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Jr.get(t,"attrs.type"),n=Jr.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Jr.get(t,"attrs.required");let{config:{label:o=""}}=t;const{id:i,attrs:r}=t;"function"==typeof o&&(o=o());const s={tag:"label",attrs:{for:i||(null==r?void 0:r.id)},className:[],children:[o,n&&this.requiredMark()],action:{}};return e&&(s.attrs.for=void 0,s.attrs.contenteditable=!0,s.fMap=e),s}childType(t){return void 0===t?t:[["array",t=>Array.isArray(t)],["node",t=>t instanceof window.Node||t instanceof window.HTMLElement],["component",()=>null==t?void 0:t.dom],[typeof t,()=>!0]].find((e=>e[1](t)))[0]}getStyle(t,e=!1){let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n}getElement(t){return{node:()=>t,object:()=>document.getElementById(t.id),string:()=>document.getElementById(t)}[this.childType(t)]()}empty(t){for(;t.firstChild;)this.remove(t.firstChild);return t}remove(t){const e=zi(t);return e?Wd.remove(`${e}s.${t.id}`):t.parentElement.removeChild(t)}removeClasses(t,e){const n={string:t=>t.classList.remove(e),array:t=>{for(const n of e)t.classList.remove(n)}};n.object=n.string,Jr.forEach(t,n[this.childType(e)])}addClasses(t,e){const n={string:t=>t.classList.add(e),array:t=>{for(const n of e)t.classList.add(n)}};Jr.forEach(t,n[this.childType(e)])}formGroup(t,e=""){return{className:["f-field-group",e],children:t}}coords(t){const e=t.getBoundingClientRect(),n=document.body.getBoundingClientRect();return{pageX:e.left+e.width/2,pageY:e.top-n.top-e.height/2}}clearStage(t){t.classList.add("removing-all-fields");Kr.slideUp(t,600,(()=>{qd.empty(t),t.classList.remove("removing-all-fields"),qd.emptyClass(t),Kr.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=zi(t);if(!o)return;const i=zi(t.parentElement),r=qd[o].get(t.id).sortable;n||(n=!r.option("disabled")),r.option("disabled",n),i&&["rows","columns","stages"].includes(i)&&this.toggleSortable(t.parentElement,n)}emptyClass(t){const e=t.getElementsByClassName(N.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};r.addLanguage("en-US",void 0);const Ud={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:g,style:b,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Zr(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let Hd=class{constructor({formData:t,...e},n){const o=Hi(Ud.editor,e),{actions:i,events:r,debug:s,config:a,editorContainer:l,...c}=o;l&&(this.editorContainer="string"==typeof l?document.querySelector(l):l),this.opts=c,qd.setOptions=c,Wd.config=a,this.userFormData=nr(n||t),this.Components=Wd,this.dom=qd,ns.init({debug:s,...r}),Ac.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new u,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.loadResources.bind(this)):this.loadResources()}get formData(){return this.Components.formData}set formData(t={}){this.load({...this.userFormData,...t},this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?m.filter((({name:e})=>-1!==t.indexOf(e))):m;Promise.all(e.map((({src:t})=>nd(t))))})(this.opts.polyfills),await id(this.opts.svgSprite),e.push((async t=>{if(!ad()&&(await od(t),!ad()))return await od("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(r.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(z)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return vd.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=Wd.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(z,t);r.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render(),null==(n=(e=this.opts).onLoad)||n.call(e,this)}))}load(t=this.userFormData,e=this.opts){return this.Components.load(t,e)}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(Wd.get("stages")),this.opts.controlOnLeft)for(const e of this.stages)e.dom.style.order=1;const t={attrs:{className:"formeo formeo-editor",id:this.formId},content:[this.stages.map((({dom:t})=>t))]};r.current.dir&&(t.attrs.dir=r.current.dir,qd.dir=r.current.dir),this.editor=qd.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(qd.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),ns.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(ns.formeoLoaded)}};const Xd=t=>"string"==typeof t?document.querySelector(t):t,Vd=t=>{const e=t.match(K);return(null==e?void 0:e[0])||t},Yd=t=>t.replace(K,Ui());let Gd=class{constructor(t,e){n(this,"render",((t=this.form)=>{this.form=nr(t);const e=document.getElementsByClassName("formeo-render").length,n={id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};this.renderedForm=qd.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),n(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),n(this,"prefixId",(t=>"f-"+t)),n(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),n(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),n(this,"cacheComponent",(t=>(this.components[Vd(t.id)]=t,t))),n(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:Ui(),className:i,children:s}})),n(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:Yd(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(Vd(t))))})})),n(this,"addButton",(t=>qd.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=qd.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(qd.render(qd.btnTemplate({className:"remove-input-group",children:qd.icon("remove"),action:{mouseover:({target:t})=>t.parentElement.classList.add("will-remove"),mouseleave:({target:t})=>t.parentElement.classList.remove("will-remove"),click:({target:t})=>t.parentElement.remove()}})))}}}))),n(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),n(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{var n,o;const i=(null==(n=e.config)?void 0:n.controlId)||(null==(o=e.meta)?void 0:o.id),{action:r={},dependencies:s={}}=this.elements[i]||{};s&&sd(s);const a=Hi({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),n(this,"handleComponentCondition",((t,e,n)=>{const o=Zd(t);o&&t.addEventListener(o,(t=>{if(this.evaluateCondition(e,t))for(const e of n)this.execResult(e,t)}),!1);const i={target:t};if(this.evaluateCondition(e,i))for(const r of n)this.execResult(r,i)})),n(this,"applyConditions",(()=>{for(const{conditions:t}of Object.values(this.components))if(t)for(const e of t){const{if:t,then:n}=e;for(const e of t){const{source:t,...o}=e;if(Zi(t)){const e=this.getComponents(t);for(const t of e)this.handleComponentCondition(t,o,n)}}}})),n(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:Ea,notEquals:(t,e)=>!Ea(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Zi(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),n(this,"execResult",(({assignment:t,target:e,targetProperty:n,value:o})=>{var i;const r={equals:t=>{var e;const i={value:()=>{t[n]=o},isNotVisible:()=>{t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:()=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};null==(e=i[n])||e.call(i)}};if(Zi(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),n(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return Ji(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),n(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return Ji(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r,formData:s}=(({editorContainer:t,renderContainer:e,formData:n,...o})=>({elements:{},...o,renderContainer:Xd(e),editorContainer:Xd(t),formData:nr(n)}))(t);this.container=o,this.form=nr(e||s),this.external=i,this.dom=qd,this.components=Object.create(null),this.elements=r}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=w,qd.render(t))))}};const Zd=t=>{const[e]=[["input",t=>["textarea","text"].includes(t.type)],["change",t=>["select"].includes(t.tagName.toLowerCase())||["checkbox","radio"].includes(t.type)]].find((e=>e[1](t)))||[!1];return e};void 0!==window&&(window.FormeoEditor=Hd,window.FormeoRenderer=Gd);const Jd=Hd,Kd=Gd;t.FormeoEditor=Jd,t.FormeoRenderer=Kd,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})); + */function Oa(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function _a(t){for(var e=1;e=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Pa(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var La=Pa(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Da=Pa(/Edge/i),ka=Pa(/firefox/i),$a=Pa(/safari/i)&&!Pa(/chrome/i)&&!Pa(/android/i),Ia=Pa(/iP(ad|od|hone)/i),Ma=Pa(/chrome/i)&&Pa(/android/i),Ra={capture:!1,passive:!1};function Fa(t,e,n){t.addEventListener(e,n,!La&&Ra)}function Wa(t,e,n){t.removeEventListener(e,n,!La&&Ra)}function Ba(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(n){return!1}return!1}}function za(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function qa(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Ba(t,e):Ba(t,e))||o&&t===n)return t;if(t===n)break}while(t=za(t))}return null}var Ua,Ha=/\s+/g;function Xa(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Ha," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Ha," ")}}function Va(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function Ya(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Va(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function Ga(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=Ja(o)[n]))return o;if(o===Za())break;o=ol(o,!1)}return!1}function Qa(t,e,n,o){for(var i=0,r=0,s=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Ta(n,fl);pl.pluginEvent.bind(ac)(t,e,_a({dragEl:vl,parentEl:bl,ghostEl:yl,rootEl:wl,nextEl:Cl,lastDownEl:El,cloneEl:xl,cloneHidden:Sl,dragStarted:Ml,putSortable:Tl,activeSortable:ac.active,originalEvent:o,oldIndex:Ol,oldDraggableIndex:Nl,newIndex:_l,newDraggableIndex:Al,hideGhostForTarget:oc,unhideGhostForTarget:ic,cloneNowHidden:function(){Sl=!0},cloneNowShown:function(){Sl=!1},dispatchSortableEvent:function(t){gl({sortable:e,name:t,originalEvent:o})}},i))};function gl(t){!function(t){var e=t.sortable,n=t.rootEl,o=t.name,i=t.targetEl,r=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,u=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[cl]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||La||Da?(m=document.createEvent("Event")).initEvent(o,!0,!0):m=new CustomEvent(o,{bubbles:!0,cancelable:!0}),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=r,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=u,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=_a(_a({},f),pl.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(_a({putSortable:Tl,cloneEl:xl,targetEl:vl,rootEl:wl,oldIndex:Ol,oldDraggableIndex:Nl,newIndex:_l,newDraggableIndex:Al},t))}var vl,bl,yl,wl,Cl,El,xl,Sl,Ol,_l,Nl,Al,jl,Tl,Pl,Ll,Dl,kl,$l,Il,Ml,Rl,Fl,Wl,Bl,zl=!1,ql=!1,Ul=[],Hl=!1,Xl=!1,Vl=[],Yl=!1,Gl=[],Zl="undefined"!=typeof document,Jl=Ia,Kl=Da||La?"cssFloat":"float",Ql=Zl&&!Ma&&!Ia&&"draggable"in document.createElement("div"),tc=function(){if(Zl){if(La)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),ec=function(t,e){var n=Va(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Qa(t,0,e),r=Qa(t,1,e),s=i&&Va(i),a=r&&Va(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ja(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ja(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&"none"!==s.float){var d="left"===s.float?"left":"right";return!r||"both"!==a.clear&&a.clear!==d?"horizontal":"vertical"}return i&&("block"===s.display||"flex"===s.display||"table"===s.display||"grid"===s.display||l>=o&&"none"===n[Kl]||r&&"none"===n[Kl]&&l+c>o)?"vertical":"horizontal"},nc=function(t){function e(t,n){return function(o,i,r,s){var a=o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name;if(null==t&&(n||a))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(o,i,r,s),n)(o,i,r,s);var l=(n?o:i).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},o=t.group;o&&"object"==Na(o)||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},oc=function(){!tc&&yl&&Va(yl,"display","none")},ic=function(){!tc&&yl&&Va(yl,"display","")};Zl&&!Ma&&document.addEventListener("click",(function(t){if(ql)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ql=!1,!1}),!0);var rc=function(t){if(vl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,Ul.some((function(t){var e=t[cl].options.emptyInsertThreshold;if(e&&!tl(t)){var n=Ja(t),o=i>=n.left-e&&i<=n.right+e,a=r>=n.top-e&&r<=n.bottom+e;return o&&a?s=t:void 0}})),s);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[cl]._onDragOver(n)}}var i,r,s},sc=function(t){vl&&vl.parentNode[cl]._isOutsideThisEl(t.target)};function ac(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=ja({},e),t[cl]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ec(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==ac.supportPointer&&"PointerEvent"in window&&!$a,emptyInsertThreshold:5};for(var o in pl.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in nc(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Ql,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Fa(t,"pointerdown",this._onTapStart):(Fa(t,"mousedown",this._onTapStart),Fa(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Fa(t,"dragover",this),Fa(t,"dragenter",this)),Ul.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ja(this,dl())}function lc(t,e,n,o,i,r,s,a){var l,c,d=t[cl],u=d.options.onMove;return!window.CustomEvent||La||Da?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=n,l.draggedRect=o,l.related=i||e,l.relatedRect=r||Ja(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function cc(t){t.draggable=!1}function dc(){Yl=!1}function uc(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function hc(t){return setTimeout(t,0)}function pc(t){return clearTimeout(t)}ac.prototype={constructor:ac,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Rl=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,vl):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,r=t.type,s=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=o.filter;if(function(t){Gl.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Gl.push(o)}}(n),!vl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!$a||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=qa(a,o.draggable,n,!1))&&a.animated||El===a)){if(Ol=el(a),Nl=el(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return gl({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),ml("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=qa(l,o.trim(),n,!1))return gl({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),ml("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!qa(l,o.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,s=i.options,a=r.ownerDocument;if(n&&!vl&&n.parentNode===r){var l=Ja(n);if(wl=r,bl=(vl=n).parentNode,Cl=vl.nextSibling,El=n,jl=s.group,ac.dragged=vl,Pl={target:vl,clientX:(e||t).clientX,clientY:(e||t).clientY},$l=Pl.clientX-l.left,Il=Pl.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,vl.style["will-change"]="all",o=function(){ml("delayEnded",i,{evt:t}),ac.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!ka&&i.nativeDraggable&&(vl.draggable=!0),i._triggerDragStart(t,e),gl({sortable:i,name:"choose",originalEvent:t}),Xa(vl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){Ga(vl,t.trim(),cc)})),Fa(a,"dragover",rc),Fa(a,"mousemove",rc),Fa(a,"touchmove",rc),Fa(a,"mouseup",i._onDrop),Fa(a,"touchend",i._onDrop),Fa(a,"touchcancel",i._onDrop),ka&&this.nativeDraggable&&(this.options.touchStartThreshold=4,vl.draggable=!0),ml("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Da||La))o();else{if(ac.eventCanceled)return void this._onDrop();Fa(a,"mouseup",i._disableDelayedDrag),Fa(a,"touchend",i._disableDelayedDrag),Fa(a,"touchcancel",i._disableDelayedDrag),Fa(a,"mousemove",i._delayedDragTouchMoveHandler),Fa(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Fa(a,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,s.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){vl&&cc(vl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Wa(t,"mouseup",this._disableDelayedDrag),Wa(t,"touchend",this._disableDelayedDrag),Wa(t,"touchcancel",this._disableDelayedDrag),Wa(t,"mousemove",this._delayedDragTouchMoveHandler),Wa(t,"touchmove",this._delayedDragTouchMoveHandler),Wa(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Fa(document,"pointermove",this._onTouchMove):Fa(document,e?"touchmove":"mousemove",this._onTouchMove):(Fa(vl,"dragend",this),Fa(wl,"dragstart",this._onDragStart));try{document.selection?hc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(zl=!1,wl&&vl){ml("dragStarted",this,{evt:e}),this.nativeDraggable&&Fa(document,"dragover",sc);var n=this.options;!t&&Xa(vl,n.dragClass,!1),Xa(vl,n.ghostClass,!0),ac.active=this,t&&this._appendGhost(),gl({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Ll){this._lastX=Ll.clientX,this._lastY=Ll.clientY,oc();for(var t=document.elementFromPoint(Ll.clientX,Ll.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ll.clientX,Ll.clientY))!==e;)e=t;if(vl.parentNode[cl]._isOutsideThisEl(t),e)do{if(e[cl]){if(e[cl]._onDragOver({clientX:Ll.clientX,clientY:Ll.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=za(e));ic()}},_onTouchMove:function(t){if(Pl){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=yl&&Ya(yl,!0),s=yl&&r&&r.a,a=yl&&r&&r.d,l=Jl&&Bl&&nl(Bl),c=(i.clientX-Pl.clientX+o.x)/(s||1)+(l?l[0]-Vl[0]:0)/(s||1),d=(i.clientY-Pl.clientY+o.y)/(a||1)+(l?l[1]-Vl[1]:0)/(a||1);if(!ac.active&&!zl){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))i.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}(t,i,this)&&!m.animated){if(m===vl)return P(!1);if(m&&r===t.target&&(s=m),s&&(n=Ja(s)),!1!==lc(wl,r,vl,e,s,n,t,!!s))return T(),m&&m.nextSibling?r.insertBefore(vl,m.nextSibling):r.appendChild(vl),bl=r,L(),P(!0)}else if(m&&function(t,e,n){var o=Ja(Qa(n.el,0,n.options,!0)),i=ll(n.el,n.options,yl),r=10;return e?t.clientXd+c*r/2:lu-Wl)return-Fl}else if(l>d+c*(1-i)/2&&lu-c*r/2))return l>d+c/2?1:-1;return 0}(t,s,n,i,C?1:a.swapThreshold,null==a.invertedSwapThreshold?a.swapThreshold:a.invertedSwapThreshold,Xl,Rl===s),0!==v){var O=el(vl);do{O-=v,y=bl.children[O]}while(y&&("none"===Va(y,"display")||y===yl))}if(0===v||y===s)return P(!1);Rl=s,Fl=v;var _=s.nextElementSibling,N=!1,A=lc(wl,r,vl,e,s,n,t,N=1===v);if(!1!==A)return 1!==A&&-1!==A||(N=1===A),Yl=!0,setTimeout(dc,30),T(),N&&!_?r.appendChild(vl):s.parentNode.insertBefore(vl,N?_:s),x&&sl(x,0,S-x.scrollTop),bl=vl.parentNode,void 0===b||Xl||(Wl=Math.abs(b-Ja(s)[E])),L(),P(!0)}if(r.contains(vl))return P(!1)}return!1}function j(a,l){ml(a,p,_a({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:P,onMove:function(n,o){return lc(wl,r,vl,e,n,Ja(n),t,o)},changed:L},l))}function T(){j("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function P(e){return j("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(Xa(vl,Tl?Tl.options.ghostClass:c.options.ghostClass,!1),Xa(vl,a.ghostClass,!0)),Tl!==p&&p!==ac.active?Tl=p:p===ac.active&&Tl&&(Tl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){j("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===vl&&!vl.animated||s===r&&!s.animated)&&(Rl=null),a.dragoverBubble||t.rootEl||s===document||(vl.parentNode[cl]._isOutsideThisEl(t.target),!e&&rc(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){_l=el(vl),Al=el(vl,a.draggable),gl({sortable:p,name:"change",toEl:r,newIndex:_l,newDraggableIndex:Al,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Wa(document,"mousemove",this._onTouchMove),Wa(document,"touchmove",this._onTouchMove),Wa(document,"pointermove",this._onTouchMove),Wa(document,"dragover",rc),Wa(document,"mousemove",rc),Wa(document,"touchmove",rc)},_offUpEvents:function(){var t=this.el.ownerDocument;Wa(t,"mouseup",this._onDrop),Wa(t,"touchend",this._onDrop),Wa(t,"pointerup",this._onDrop),Wa(t,"touchcancel",this._onDrop),Wa(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;_l=el(vl),Al=el(vl,n.draggable),ml("drop",this,{evt:t}),bl=vl&&vl.parentNode,_l=el(vl),Al=el(vl,n.draggable),ac.eventCanceled||(zl=!1,Xl=!1,Hl=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),pc(this.cloneId),pc(this._dragStartId),this.nativeDraggable&&(Wa(document,"drop",this),Wa(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),$a&&Va(document.body,"user-select",""),Va(vl,"transform",""),t&&(Ml&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),yl&&yl.parentNode&&yl.parentNode.removeChild(yl),(wl===bl||Tl&&"clone"!==Tl.lastPutMode)&&xl&&xl.parentNode&&xl.parentNode.removeChild(xl),vl&&(this.nativeDraggable&&Wa(vl,"dragend",this),cc(vl),vl.style["will-change"]="",Ml&&!zl&&Xa(vl,Tl?Tl.options.ghostClass:this.options.ghostClass,!1),Xa(vl,this.options.chosenClass,!1),gl({sortable:this,name:"unchoose",toEl:bl,newIndex:null,newDraggableIndex:null,originalEvent:t}),wl!==bl?(_l>=0&&(gl({rootEl:bl,name:"add",toEl:bl,fromEl:wl,originalEvent:t}),gl({sortable:this,name:"remove",toEl:bl,originalEvent:t}),gl({rootEl:bl,name:"sort",toEl:bl,fromEl:wl,originalEvent:t}),gl({sortable:this,name:"sort",toEl:bl,originalEvent:t})),Tl&&Tl.save()):_l!==Ol&&_l>=0&&(gl({sortable:this,name:"update",toEl:bl,originalEvent:t}),gl({sortable:this,name:"sort",toEl:bl,originalEvent:t})),ac.active&&(null!=_l&&-1!==_l||(_l=Ol,Al=Nl),gl({sortable:this,name:"end",toEl:bl,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){ml("nulling",this),wl=vl=bl=yl=Cl=xl=El=Sl=Pl=Ll=Ml=_l=Al=Ol=Nl=Rl=Fl=Tl=jl=ac.dragged=ac.ghost=ac.clone=ac.active=null,Gl.forEach((function(t){t.checked=!0})),Gl.length=Dl=kl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":vl&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;o{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(r.get("attributeNotPermitted",e||"")),jc.add.attrs(t);let n;e&&(n=String(window.prompt(t.message.value,"")),t.addAction(e,n))},option:t=>{t.addAction()},condition:t=>{t.addAction(t)}},click:{btn:t=>{t.action()}},save:{form:tr}},jc={init:function(t){const e=Object.keys(Ac);return this.opts=e.reduce(((e,n)=>(e[n]={...Ac[n],...t[n]},e)),t),this},add:{attrs:t=>jc.opts.add.attr(t),options:t=>jc.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},jc.opts.add.condition(t))},click:{btn:t=>jc.opts.click.btn(t)},save:{form:t=>(jc.opts.sessionStorage&&Zi.set(B,t),os.formeoSaved({formData:t}),jc.opts.save.form(t))}},Tc=Object.freeze({type:"field",displayType:"slider"}),Pc=t=>({transform:`translateX(${t?`${t}px`:0})`});class Lc{constructor(t){n(this,"toggleTabbedLayout",(()=>{this.getPanelDisplay();const t=this.isTabbed;return this.panelsWrap.parentElement.classList.toggle("tabbed-panels",t),t&&this.panelNav.removeAttribute("style"),t})),n(this,"resizePanels",(()=>{this.toggleTabbedLayout();const t=this.panelsWrap.style,e=qd.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=Xi(Tc,t),this.panelDisplay=this.opts.displayType,this.activePanelIndex=0,this.panelNav=this.createPanelNav();const e=this.createPanelsWrap();this.nav=this.navActions();const o=new window.ResizeObserver((([{contentRect:{width:t}}])=>{this.currentWidth!==t&&(this.toggleTabbedLayout(),this.currentWidth=t,this.nav.setTranslateX(this.activePanelIndex,!1))})),i=window.setTimeout((()=>{o.observe(e),window.clearTimeout(i)}),H)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(qd.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Tc.displayType,this.panelDisplay}createPanelsWrap(){const t=qd.create({className:"panels",content:this.opts.panels.map((({config:t,...e})=>e))});return"field"===this.opts.type&&this.sortableProperties(t),this.panelsWrap=t,this.panels=t.children,this.currentPanel=this.panels[this.activePanelIndex],t}sortableProperties(t){const e=t.getElementsByClassName("field-edit-group");return Kr.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&ac.create(t,{animation:150,group:{name:`edit-${t.editGroup}`,pull:!0,put:["properties"]},sort:!0,handle:".prop-order",onSort:t=>{this.propertySave(t.to),this.resizePanels()}})}))}createPanelNavLabels(){const t=this.opts.panels.map((t=>({tag:"h5",action:{click:t=>{const e=Hr(t.target,t.target.parentElement);this.nav.setTranslateX(e,!1),this.nav.groupChange(e)}},content:t.config.label}))),e={className:"panel-labels",content:{content:t}},[n]=t;return n.className="active-tab",qd.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:r.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:qd.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:r.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:qd.icon("triangle-left")};return qd.create({tag:"nav",attrs:{className:"panel-nav"},content:[e,this.labels,t]})}get isTabbed(){return"tabbed"===this.panelDisplay}navActions(){const t={},e=this.currentPanel.parentElement,n=this.labels.firstChild,o=n.children,i=this.currentPanel.parentElement.childNodes;this.activePanelIndex=Hr(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],qd.removeClasses(i,"active-panel"),qd.removeClasses(o,"active-tab"),this.currentPanel.classList.add("active-panel"),o[t].classList.add("active-tab"),this.currentPanel);const a=({offset:t,reset:o,duration:i=U,animate:r=!this.isTabbed})=>{const a=[Pc(s.panel),Pc(t.panel)],l=[Pc(s.nav),Pc(this.isTabbed?0:t.nav)];if(o){const[t]=a,[e]=l;a.push(t),l.push(e)}const c={easing:"ease-in-out",duration:r?i:0,fill:"forwards"},d=e.animate(a,c);n.animate(l,c);const u=()=>{this.panelsWrap.style.height=qd.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",u),o||(s=t)};d.addEventListener("finish",u)};return t.setTranslateX=(t=this.activePanelIndex,o=!0)=>{var i;i=t,r={nav:-n.offsetWidth*i,panel:-e.offsetWidth*i},a({offset:r,animate:o})},t.refresh=(e=this.activePanelIndex)=>{this.activePanelIndex!==e&&t.groupChange(e),t.setTranslateX(this.activePanelIndex,!1),this.resizePanels()},t.nextGroup=()=>{const e=this.activePanelIndex+1;if(e!==i.length){const o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:s.nav-8,panel:s.panel-8},a({offset:r,reset:!0});return this.currentPanel},t.prevGroup=()=>{if(0!==this.activePanelIndex){const e=this.activePanelIndex-1,o=i[e];r={nav:-n.offsetWidth*e,panel:-o.offsetLeft},a({offset:r}),t.groupChange(e)}else r={nav:8,panel:8},a({offset:r,reset:!0})},t}}const Dc="a an and as at but by for for from in into near nor of on onto or the to with".split(" ").map((t=>`\\s${t}\\s`)),kc=new RegExp(`(?!${Dc.join("|")})\\w\\S*`,"g"),$c=/\s+/g;function Ic(t){if("string"!=typeof t)return t;if(t.trim().match($c))return t;return t.replace(kc,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const Mc=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Rc="f-autocomplete",Fc="highlight-component",Wc=({name:t,id:e,...n})=>["config.label","config.controlId","meta.id","attrs.id"].reduce(((t,e)=>t||n.get(e)),null)||"external"===t&&((...t)=>r.get(t.join("."))||Ic(t.join(" ")))(t,e);class Bc{constructor(t,e,o){n(this,"lastCache",Date.now()),n(this,"optionsCache",null),this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=o,this.build()}build(){const t=t=>{const e=this.list,n=this.getActiveOption();let o=new Map([[38,()=>{const t=this.getPreviousOption(n);t&&this.selectOption(t)}],[40,()=>{const t=this.getNextOption(n);t&&this.selectOption(t)}],[13,()=>{n&&(this.selectOption(n),this.setValue(n),"none"===e.style.display?this.showList(n):this.hideList()),t.preventDefault()}],[27,()=>{this.hideList()}]]).get(t.keyCode);return o||(o=()=>!1),o()},e={focus:({target:e})=>{this.updateOptions(),e.parentElement.classList.add(`${this.className}-focused`);const n=qd.toggleElementsByStr(this.list.querySelectorAll("li"),e.value);e.addEventListener("keydown",t);const o=this.list.querySelector(".active-option")||n[0];this.showList(o)},blur:({target:e})=>{e.parentElement.classList.remove(`${this.className}-focused`),e.removeEventListener("keydown",t),this.hideList()},input:t=>{const e=qd.toggleElementsByStr(this.list.querySelectorAll("li"),t.target.value);if(0===t.target.value.length&&this.clearValue(),0===e.length)this.hideList();else{const t=this.getActiveOption()||e[0];this.showList(t)}const n=t.target.value.trim();this.hiddenField.value=n,this.value=n,this.setValue({dataset:{label:n,value:n}})}};return this.displayField=qd.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${Rc}-display-field`,value:this.label||this.value,placeholder:r.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=qd.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=qd.create({tag:"ul",attrs:{className:`${Rc}-list`}}),this.dom=qd.create({children:[this.displayField,this.hiddenField],className:this.className,action:{onRender:t=>{this.stage=t.closest(".formeo-stage");const e=this.value&&Wd.getAddress(this.value);this.label=e&&Wc(e),this.label&&(this.displayField.value=this.label)}}}),this.dom}updateOptions(){let t=this.optionsCache;const e=Date.now();(!t||e-this.lastCache>10*H)&&(qd.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){const t=(t=>{const e=[],n=Wd.flatList(),o=Object.entries(n).map((([n,o])=>{const i=Wc(o);if(i){const r={tag:"span",content:` ${Ic(o.name)}`,className:"component-type"},s=`${o.name}.${i}`;e.push(s);const a=((t,e)=>{const n=t.reduce(((t,n)=>t+(n===e)),0);return n>1?`(${n})`:""})(e,s),l=[`${i} `,{tag:"span",content:a,className:"component-label-count"},r];return(({id:t,textLabel:e,htmlLabel:n,selectedId:o})=>{const i={value:t,textLabel:e,htmlLabel:n};return t===o&&(i.selected=!0),i})({id:n,textLabel:[i,a].join(" ").trim(),htmlLabel:l,selectedId:t})}}));return o.filter(Boolean)})(),e=t=>{const e=`${Rc}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return this.optionsCache=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${Rc}-list-item`,action:{mousedown:({target:t})=>{t=e(t),this.setValue(t),this.selectOption(t),this.hideList()},mouseover:({target:t})=>{t=e(t),this.removeHighlight(),this.highlightComponent(t)}}};return qd.create(r)})),this.optionsCache}setListPosition(){const{offsetHeight:t,offsetWidth:e}=this.displayField,n=this.displayField.closest(".formeo-stage").getBoundingClientRect(),o=this.displayField.getBoundingClientRect(),i={position:"absolute",top:o.y+t+window.scrollY-n.y+"px",left:o.x+window.scrollX-n.x+"px",width:`${e+1}px`};Object.assign(this.list.style,i)}showList(t,e=this.list){this.stage.contains(this.list)||this.stage.appendChild(this.list),this.setListPosition(),this.selectOption(t),Qr.slideDown(e,U)}hideList(t=this.list){Qr.slideUp(t,U),this.removeHighlight(),this.stage.contains(this.list)&&this.stage.removeChild(this.list)}getActiveOption(t=this.list){const e=t.querySelector(".active-option");return"none"!==(null==e?void 0:e.style.display)?e:null}getPreviousOption(t){let e=t;do{e=e?e.previousSibling:null}while(null!=e&&"none"===e.style.display);return e}getNextOption(t){let e=t;do{e=e?e.nextSibling:null}while(null!=e&&"none"===e.style.display);return e}selectOption(t,e=this.list){var n;const o=e.querySelectorAll("li");for(const i of o){const{dataset:{value:t}}=i;if(i.classList.remove("active-option"),t){null==(n=Wd.getAddress(t).dom)||n.classList.remove(Fc)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(Fc);for(const e of t)e.classList.remove(Fc)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=Wd.getAddress(n).dom)||e.classList.add(Fc)}}clearValue(){this.selectOption(null),this.displayField.value="",this.hiddenField.value="",this.value="",this.runEvent("onChange",{target:this.hiddenField})}setValue(t){const{label:e,value:n}=t.dataset;this.displayField.value=e,this.hiddenField.value=n,this.value=n,this.runEvent("onChange",{target:this.hiddenField})}addEvent(t,e){this.events.push([t,e])}runEvent(t,e){for(const[n,o]of this.events)n===t&&o(e)}}const zc=(t,e)=>{const n=(t=>{const e=Ki(t),n={"field.property":Z,...J},o=e?(i=t,Wd.getAddress(i).getData()):n[t];var i;return Object.keys(o).reduce(((t,e)=>(t[e]=e,t)),{})})(t);return Object.entries(n).reduce(((n,[o,i])=>{if("id"!==o){const s={tag:"option",content:r.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:i}};e===i&&(s.attrs.selected=!0),n.push(qd.create(s))}return n}),[])},qc=(t,e)=>{qd.empty(t);for(const n of e)t.add(n)},Uc=({key:t,value:e,type:n="text",checked:o})=>{const i={tag:"input",attrs:{type:n,value:e,placeholder:r.get(`${t}.placeholder`)||Ic(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(i.attrs.checked=!0),i},Hc=t=>{const e=r.get(t);if(e)return e;const n=t.split(".");return r.get(n[n.length-1])},Xc={autocomplete:(t,e,n)=>new Bc(t,e,n),string:(t,e)=>Uc({key:t,value:e}),boolean:(t,e)=>Uc({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>Uc({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:Hc(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>Xc[qd.childType(e)](t,e)))},Vc=["selected","checked"],Yc={boolean:(t,e)=>({click:({target:{checked:n}})=>{var o,i;"radio"===(null==(i=null==(o=e.data)?void 0:o.attrs)?void 0:i.type)&&e.set("options",e.data.options.map((t=>({...t,selected:!1})))),e.set(t,n)}}),string:(t,e)=>({input:({target:{value:n}})=>{e.set(t,n)}}),number:(t,e)=>({input:({target:{value:n}})=>{e.set(t,Number(n))}}),array:(t,e)=>({change:({target:{value:n}})=>{e.set(t,n)}}),object:()=>({})};class Gc{constructor({key:t,data:e,index:o,field:i}){n(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:r.get(t)||t};return e.map(((e,o)=>{const i=[],r=Object.entries(e).map((([e,n])=>{const r=this.conditionInput(e,n,t,o);return r&&i.push([r.className,n.trim()].filter(Boolean).join("-")),r})).filter(Boolean),s=Xr(r,G.map((t=>`condition-${t}`)),"className||dom.className");return this.processConditionUIState(s),o||s.unshift(n),this.itemFieldGroups.push(s),{children:s,className:`f-condition-row ${t}-condition-row ${i.join(" ")}`}}))})),n(this,"processConditionUIState",(t=>{const e=e=>(e=e.split("|"),t.filter((t=>e.includes(t.className)))),n=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.style.display="none"})),clearTimeout(e)}),q)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),q)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=Ki(t.value)?t.value:"field.property",a=zc(s,r.value);return qc(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Ji(t.value)&&t.value?o(i):n(i)}],["condition-sourceProperty",t=>{const i=e("condition-comparison|condition-targetProperty|condition-target"),r=t.value;return(t=>/^is|^has/.test(t))(r.substring(r.lastIndexOf(".")+1,r.length))?n(i):o(i)}]]);for(const r of t){const t=i.get(r.className);t&&t(r)}})),n(this,"conditionInput",((t,e,n,o)=>{const i=this.field,r=`${this.itemKey}.${n}.${o}`,s=`${this.field.id}.${r}`,a=`${i.name}s.${s}.${t}`,l=(t,e,n)=>{const o=zc(n||t,e),i=Xc.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=qd.create(i);return qc(r,o),r},c=({target:t})=>{const e=t.closest(".f-condition-row"),n=new RegExp(`${t.className}(?:\\S?)+`,"gm");e.className=e.className.replace(n,"");const o={dataPath:a,value:t.value,src:t};os.formeoUpdated(o),Wd.setAddress(a,t.value);const i=Hr(e);this.processConditionUIState(this.itemFieldGroups[i])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=Xc.autocomplete(`condition.${e}`,t,n);return Wd.setConditionMap(t,i),o.addEvent("onChange",(t=>{Wd.removeConditionMap(Wd.getAddress(a)),c(t),Wd.setConditionMap(t.target.value,i)})),o},sourceProperty:t=>l("sourceProperty",t,"field.property"),targetProperty:t=>l("targetProperty",t,"field.property"),target:t=>d.source(t,"target"),value:t=>{const e=Xc.string("condition.value",t);return e.action={input:c},qd.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=Xr(Object.entries(e),Vc,"0");const[s,a]=t.split(".");this.field=i,this.itemKey=t,this.itemIndex=o,this.panelName=s,this.isDisabled=i.isDisabledProp(a,s),this.isHidden=this.isDisabled&&i.config.panels[s].hideDisabled,this.isLocked=i.isLockedProp(a,s),this.dom=qd.create({tag:"li",className:[`field-${t.replace(/\./g,"-")}`,"prop-wrap",this.isHidden&&"hidden-property"],children:{className:"field-prop",children:[this.itemInputs,this.itemControls]}})}get itemInputs(){this.itemFieldGroups=[];return{className:`${this.panelName}-prop-inputs prop-inputs f-input-group`,children:this.itemValues.map((([t,e])=>{let n="conditions"===this.panelName?this.generateConditionFields(t,e):this.itemInput(t,e);return["selected","checked"].includes(t)&&(n={className:"f-addon",children:n}),n}))}}get itemControls(){if(this.isLocked){return{className:`${this.panelName}-prop-controls prop-controls`,content:[]}}const t={tag:"button",attrs:{type:"button",className:"prop-remove prop-control"},action:{click:()=>{Qr.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),qd.remove(t),this.field.resizePanelWrap()}))}},content:qd.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=qd.childType(e)||"string",o={config:{},attrs:{},...Xc[n](t,e)},i=this.itemKey.replace(/.\d+$/,(e=>`${e}.${t}`)),r=i.split(".").filter(Number.isNaN).join(".")||t,[s,a]=[[...this.itemKey.split("."),t],[t]].map((t=>[this.field.id,...t].filter(Boolean).join("-")));return o.config={...o.config,label:"options"!==this.panelName&&(Hc(r)||Ic(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...Yc[n](i,this.field)},o}}class Zc{constructor(t,e,o){n(this,"addAttribute",((t,e)=>{let n=e;const o=Mc(t),i=`attrs.${o}`;r.current[i]||r.put(i,Zr(t)),"string"==typeof n&&["true","false"].includes(n)&&(n=JSON.parse(n)),this.field.set(`attrs.${t}`,n);const s=this.props.querySelector(`.field-attrs-${o}`),a=new Gc({key:i,data:{[o]:n},field:this.field});s?this.props.replaceChild(a.dom,s):this.props.appendChild(a.dom),this.field.resizePanelWrap()})),n(this,"addOption",(()=>{const t=this.field.data.config.controlId,e=this.field.get("options"),n="select"===t?"option":t,o=r.get("newOptionLabel",{type:n})||"New Option",i=`options.${this.data.length}`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=Mc(o));const l=new Gc({key:i,data:a,field:this.field,index:this.props.children.length});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.field.set(i,a),this.field.resizePanelWrap()})),n(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new Gc({key:e,data:t.template,field:this.field});n?this.props.replaceChild(o.dom,n):this.props.appendChild(o.dom),this.field.set(e,t.template),this.field.resizePanelWrap()})),this.type=qd.childType(t),this.data="object"===this.type?Object.entries(t):t,this.name=e,this.field=o,this.panelConfig=this.getPanelConfig(this.data)}getPanelConfig(t){return this.props=this.createProps(t),this.editButtons=this.createEditButtons(),{id:`${this.field.id}-${this.name}-panel`,config:{label:r.get(`panel.label.${this.name}`)},attrs:{className:`f-panel ${this.name}-panel`},children:[this.props,this.editButtons]}}createProps(t){this.editPanelItems=Array.from(t).map(((t,e)=>{const n="array"===this.type,o=[this.name,n?String(e):t[0]].join("."),i=n?t:{[t[0]]:t[1]};return new Gc({key:o,data:i,field:this.field})}));const e={tag:"ul",attrs:{className:["field-edit-group",`field-edit-${this.name}`]},editGroup:this.name,isSortable:"options"===this.name,content:this.editPanelItems};return qd.create(e)}createEditButtons(){const t=this,e=this.name,n=r.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...qd.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const i={btnCoords:qd.coords(n.target),addAction:o[e]};"attrs"===e&&(i.isDisabled=t.field.isDisabledProp,i.isLocked=t.field.isLockedProp,i.message={attr:r.get(`action.add.${e}.attr`),value:r.get(`action.add.${e}.value`)});const s=Ic(e),a=new window.CustomEvent(`onAdd${s}`,{detail:i});jc.add[e](i),document.dispatchEvent(a)}}}]}}}class Jc extends Sa{constructor(t,e={},o){const i={...e,id:e.id||Hi()};super(t,i),n(this,"mutationHandler",(t=>t.map((t=>{})))),n(this,"remove",(t=>{if(t){const e=t.split("."),n=e.pop(),o=this.get(e);return Array.isArray(o)?Ur(n)?o.splice(Number(n),1):this.set(e,o.filter((t=>t!==n))):delete o[n],o}if("stage"===this.name)return null;const e=this.parent,n=this.children;return Vr(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Wd.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Wd[`${this.name}s`].delete(this.id)})),n(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),n(this,"getComponentTag",(()=>qd.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&qd.icon("component-corner",{className:"bottom-left"}),qd.icon(`handle-${this.name}`),Ic(this.name),(this.isColumn||this.isRow)&&qd.icon("component-corner",{className:"bottom-right"})].filter(Boolean)}))),n(this,"removeClasses",(t=>{const e={string:()=>this.dom.classList.remove(t),array:()=>t.map((t=>this.dom.classList.remove(t)))};return e.object=e.string,e[qd.childType(t)](this.dom)})),n(this,"loadChildren",((t=this.data.children)=>t.map((t=>this.addChild({id:t}))))),n(this,"saveChildOrder",(()=>{if(this.render)return;const t=this.children.map((({id:t})=>t));return this.set("children",t),t})),n(this,"onSort",(()=>this.saveChildOrder())),n(this,"onEnd",(({to:{parentElement:t},from:{parentElement:e}})=>{null==t||t.classList.remove(`hovering-${qi(t)}`),null==e||e.classList.remove(`hovering-${qi(e)}`)})),n(this,"runConditions",(()=>{const t=this.get("conditions");if(!(null==t?void 0:t.length))return null;return t.map((t=>{const e=this.processConditions(t.if),n=this.processResults(t.then);return e.map((t=>this.evaluateConditions(t)&&this.execResults(n)))}))})),n(this,"value",((t,e)=>{const n=t.split("."),o=this.getComponent(t),i=o&&n.slice(2,n.length).join(".");return[!o,!i,!Z[i]].some(Boolean)?t:e?o.set(Z[i],e):o.get(Z[i])})),n(this,"getResult",(t=>({"=":(t,e,n)=>t.set(e,n)}[t]))),n(this,"processResults",(t=>t.map((({operator:t,target:e,value:n})=>{const o=this.getComponent(e);return{target:o,propertyPath:o&&e.split(".").slice(2,e.length).join("."),action:this.getResult(t),value:this.value(n)}})))),n(this,"execResults",(t=>{const e=t.map((t=>this.execResult(t)));return Promise.all(e)})),n(this,"execResult",(({target:t,action:e,value:n,propertyPath:o})=>new Promise(((o,i)=>{try{return o(e(t,n))}catch(r){return i(r)}})))),n(this,"cloneData",(()=>{const t={...Vi(this.data),id:Hi()};return"field"!==this.name&&(t.children=[]),t})),n(this,"clone",((t=this.parent)=>{const e=t.addChild(this.cloneData(),this.index+1);return"field"!==this.name&&this.cloneChildren(e),e})),n(this,"createChildWrap",(t=>qd.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=i.id,this.name=t,this.config=Wd[`${this.name}s`].config,Xi(this.config,i.config),this.dataPath=`${this.name}s.${this.id}.`,this.observer=new window.MutationObserver(this.mutationHandler),this.render=o}observe(t){this.observer.disconnect(),this.observer.observe(t,{childList:!0})}get js(){return this.data}get json(){return this.data}empty(){const t=this.children.map((t=>{t.remove()}));return this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{Wd.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Wd.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...qd.btnTemplate({content:qd.icon(`handle-${this.name}`)}),className:["component-handle",`${this.name}-handle`]},{className:["action-btn-wrap",`${this.name}-action-btn-wrap`],children:this.buttons}]}}toggleEdit(t=!this.isEditing){this.isEditing=t;const e=this.dom,n="editing",o=`${n}-${this.name}`,i=this.dom.querySelector(`.${this.name}-edit`);Qr.slideToggle(i,q,t),"field"===this.name&&(Qr.slideToggle(this.preview,q,!t),e.parentElement.classList.toggle(`column-${o}`,t)),e.classList.toggle(n,t),e.classList.toggle(o,t)}get buttons(){if(this.actionButtons)return this.actionButtons;const t={handle:(t=`handle-${this.name}`)=>({...qd.btnTemplate({content:qd.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{Qr.slideUp(this.dom,q,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...qd.btnTemplate({content:qd.icon(t)}),className:["item-clone"],meta:{id:"clone"},action:{click:()=>{this.clone(this.parent),"column"===this.name&&this.parent.autoColumnWidths()}}})},{buttons:e,disabled:n}=this.config.actionButtons,o=e.filter((t=>!n.includes(t))).map((e=>{var n;return(null==(n=t[e])?void 0:n.call(t))||e}));return this.actionButtons=o,this.actionButtons}get index(){return Hr(this.dom)}get parentType(){return R.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${P[t]}`);return e&&qd.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=M.get(this.name);return Yr(t,(t=>Wd.getAddress(`${e}s.${t.id}`))).filter(Boolean)}get domChildren(){const t=this.dom.querySelector(".children");return t?t.children:[]}addChild(t={},e=this.domChildren.length){var n,o;let i=t;"object"!=typeof t&&(i={id:i});const r=this.dom.querySelector(".children"),{id:s=Hi()}=i,a=M.get(this.name);if(!a)return null;const l=`${a}s`,c=Wd.getAddress(`${l}.${s}`)||Wd[l].add(s,i);r.insertBefore(c.dom,r.children[e]),null==(o=null==(n=this.config.events)?void 0:n.onAddChild)||o.call(n,{parent:this,child:c});const d=c.get("children");return(null==d?void 0:d.length)&&c.loadChildren(d),this.removeClasses("empty"),this.saveChildOrder(),c}onAdd({from:t,to:e,item:n,newIndex:o}){var i;t.classList.contains(y)||(t=t.parentElement);const r=qi(t),s=qi(e.parentElement),a=new Map([[-2,()=>{const t=this.addChild({},o).addChild();return t.addChild.bind(t)}],[-1,()=>{const t=this.addChild({},o);return t.addChild.bind(t)}],[0,()=>this.addChild.bind(this)],[1,t=>{const e=Hr(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:{meta:{id:t},...e}}=bd.get(n.id);qr(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=zr({stage:{row:0,column:-1,field:-2},row:{row:1,column:0,field:-1},column:{row:2,column:1,field:0},field:1},`${this.name}.${i}`),s=a.get(r)();qd.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||tr)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||tr)();return null==t?void 0:t(n.id)}},c=null==(i=l[r])?void 0:i.call(l,n,o);return(()=>{this.saveChildOrder(),this.removeClasses("empty")})(),c}onRemove({from:{parentElement:t}}){return t.classList.contains(E)&&t.classList.remove("column-editing-field"),"stage"===this.name||this.children.length?(this.emptyClass(),this.saveChildOrder()):this.remove()}onRender(){const{events:t}=this.config;if(!t)return null;t.onRender&&qd.onRender(this.dom,t.onRender)}set config(t){const e=zr(t,"all"),n=zr(this.data,"config.controlId"),o=[e,n&&zr(t,n),zr(t,this.id)].reduce(((t,e)=>e?Xi(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Wd[e];return n===this.id?this:null==o?void 0:o.get(n)}cloneChildren(t){for(const e of this.children)null==e||e.clone(t)}get isRow(){return this.name===j.row}get isColumn(){return this.name===j.column}get isField(){return this.name===j.field}}class Kc extends Jc{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),n(this,"updateConditionsPanel",Qi((()=>{const t=this.editPanels.find((({name:t})=>"conditions"===t));if(!t)return null;const e=t.createProps(),n=this.dom.querySelector(".field-edit-conditions");n.parentElement.replaceChild(e,n)}),q)),n(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=qd.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),n(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=Ui([...this.config.panels.order,...Object.keys(this.data)]),n=["config","meta","action","events",...this.config.panels.disabled],o=e.filter((t=>!n.includes(t)));for(const r of o){const e=this.get(r),n=qd.childType(e);if(t.includes(n)){const t=new Zc(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new Lc(i),this.dom&&(this.dom.querySelector(".panel-nav").replaceWith(this.panels.panelNav),this.dom.querySelector(".panels").replaceWith(this.panels.panelsWrap))})),n(this,"toggleCheckedOptions",((t,e)=>{const n=this.get("options").map(((n,o)=>{const i=o===t;return"radio"===e?n.selected=i:n.checked=i?!n.checked:n.checked,n}));this.set("options",n)})),n(this,"isDisabledProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.disabled.concat(this.get(`config.disabled${Ic(e)}`)).includes(t)})),n(this,"isLockedProp",((t,e="attrs")=>{const n=this.config.panels[e];if(!n)return!1;return n.locked.concat(this.get(`config.locked${Ic(e)}`)).includes(t)})),this.debouncedUpdateEditPanels=function(t,e=333){let n;return function(...o){n&&clearTimeout(n),n=setTimeout((()=>t.apply(this,o)),e)}}(this.updateEditPanels),this.label=qd.create(this.labelConfig),this.preview=qd.create({}),this.editPanels=[];const e=this.getActionButtons(),o=this.actionButtons.some((t=>{var e;return"edit"===(null==(e=t.meta)?void 0:e.id)}));let i={tag:"li",attrs:{className:x},id:this.id,children:[this.label,this.getComponentTag(),e,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:r.get("field")}};i=qd.create(i),this.observe(i),this.dom=i,this.isEditing=!1,this.onRender(i)}get labelConfig(){if(!!this.get("config.hideLabel"))return null;const t=this.get("config.editorLabel")||this.get("config.label"),e=this.get("attrs.required"),n=this.config.label.disableHTML;return{className:"prev-label",children:[{...(()=>{const e={tag:"label",attrs:{}};return n?(e.tag="input",e.attrs.value=t,e):(e.attrs.contenteditable=!0,e.children=t,e)})(),action:{input:({target:{innerHTML:t,innerText:e,value:o}})=>{super.set("config.label",n?o:t);const i=Wd.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&qd.requiredMark()]}}updateConditionSourceLabel(t,e){const n=this.editPanels.find((({name:t})=>"conditions"===t));if(!n)return null;for(const{itemFieldGroups:o}of n.editPanelItems)for(const n of o){const o=n.find((e=>e.value===t));o&&(o.displayField.value=e)}}set(...t){const[e,n]=t,o=super.set(e,n);return this.updatePreview(),o}updateLabel(){if(!this.label)return null;const t=qd.create(this.labelConfig);this.label.parentElement.replaceChild(t,this.label),this.label=t}get fieldEdit(){const t={className:["field-edit","slide-toggle","formeo-panels-wrap"]};this.updateEditPanels();const e=this.editPanels.length;return e&&(t.className.push(`panel-count-${e}`),t.content=[this.panels.panelNav,this.panels.panelsWrap],this.panelNav=this.panels.nav,this.resizePanelWrap=this.panels.nav.refresh),t.action={onRender:()=>{if(0===e){const t=this.dom,e=t.querySelector(".item-edit-toggle"),n=t.querySelector(".field-actions"),o=n.getElementsByTagName("button");n.style.maxWidth=o.length*o[0].clientWidth+"px",qd.remove(e)}else this.resizePanelWrap()}},qd.create(t)}get defaultPreviewActions(){return{change:t=>{const{target:e}=t,{type:n}=e;if(["checkbox","radio"].includes(n)){const t=+e.id.split("-").pop();this.toggleCheckedOptions(t,n),this.debouncedUpdateEditPanels()}},click:t=>{"true"===t.target.contentEditable&&t.preventDefault()},input:t=>{if(["input","meter","progress","button"].includes(t.target.tagName.toLowerCase()))return super.set("attrs.value",t.target.value),this.debouncedUpdateEditPanels();if(t.target.contentEditable){const e=t.target.parentElement.classList;if(e.contains("f-checkbox")||e.contains("f-radio")){const e=t.target.parentElement,n=e.parentElement,o=Hr(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=Vi(this.data),{action:n={}}=bd.get(e.config.controlId);e.id=`prev-${this.id}`,e.action=n,(null==(t=this.data)?void 0:t.config.editableContent)&&(e.attrs={...e.attrs,contenteditable:!0});return{attrs:{className:"field-preview",style:this.isEditing&&"display: none;"},content:qd.create(e,!0),action:this.defaultPreviewActions}}}const Qc={js:new Set,css:new Set},td=(t,e,n=er)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),ed=(t,e)=>{t.removeEventListener("load",ed),e(t.src)},nd=(t,e)=>{t.removeEventListener("load",nd),e(t.src)},od=t=>new Promise(((e,n)=>{if(Qc.js.has(t))return e(t);Qc.js.add(t);const o=qd.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>nd(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),id=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(Qc.css.has(t))return e(t);Qc.css.add(t);const o=qd.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>ed(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},rd=async(t=g)=>{if(document.getElementById(f))return;const e=async t=>(t=>{let e=document.getElementById(f);return e||(e=qd.create({id:f,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return td(t,e,(()=>td(v,e)))},sd={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>od(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>id(t)));return Promise.all(e)}},ad=t=>{const e=Object.entries(t).map((([t,e])=>sd[t](e)));return Promise.all(e)},ld=()=>{const t=document.getElementById(f);return"hidden"===window.getComputedStyle(t).visibility};class cd{constructor({events:t={},dependencies:e={},controlAction:o,...i}){n(this,"controlCache",new Set),this.events=t,this.controlData=i,this.controlAction=o,this.dependencies=e,this.id=i.id||Hi()}get controlId(){var t;return null==(t=this.controlData.meta)?void 0:t.id}get dom(){const{meta:t,config:e}=this.controlData,n=this.i18n(e.label)||e.label,o={tag:"button",attrs:{type:"button"},content:[{tag:"span",className:"control-icon",children:qd.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&bd.panels.nav.refresh(Hr(e))},click:({target:t})=>{bd.addElement(t.parentElement.id)}}};return qd.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return ad(this.dependencies)}i18n(t,e){var n,o;const i=r.locale,s=null==(n=this.definition)?void 0:n.i18n,a=(null==s?void 0:s[i])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||r.get(t,e)}}const dd=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const ud=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:r.get("labelCount",{label:Ic(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const hd=[class extends cd{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:r.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:r.get("button"),type:["button","submit","reset"].map((t=>({label:t,type:t}))),className:[{label:"default",value:"",selected:!0},{label:"primary",value:"primary"},{label:"danger",value:"error"},{label:"success",value:"success"},{label:"warning",value:"warning"}]}]})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:r.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:r.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:r.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends cd{constructor(){super({tag:"textarea",config:{label:r.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends cd{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:r.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:r.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends cd{constructor(){super({tag:"select",config:{label:r.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:ud("option")})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:r.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:ud("checkbox",1)})}},class extends cd{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:r.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:ud("radio")})}}],pd=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),fd="controls.html.header";const md=[class extends cd{constructor(){super({tag:pd[0],attrs:{tag:pd.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:r.get(fd),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:r.get(fd),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(fd)}},class extends cd{constructor(){super({tag:"p",attrs:{className:""},config:{label:r.get("controls.html.paragraph"),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"paragraph",id:"paragraph"},content:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."})}},class extends cd{constructor(){super({tag:"hr",config:{label:r.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends cd{constructor(t){super(Xi({tag:"textarea",config:{label:"WYSIWYG",editableContent:!0},meta:{group:"html",icon:"rich-text",id:"tinymce"},attrs:{required:!1},dependencies:{js:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"},action:{onRender:t=>{const e=`#${t.id}`;window.tinymce.remove(e),window.tinymce.init({selector:e})}},controlAction:{click:()=>{},onRender:()=>{}}},t))}}],gd=Object.freeze({sortable:!0,elementOrder:{},groupOrder:[],groups:[{id:"layout",label:"controls.groups.layout",elementOrder:["row","column"]},{id:"common",label:"controls.groups.form",elementOrder:["button","checkbox"]},{id:"html",label:"controls.groups.html",elementOrder:["header","block-text"]}],disable:{groups:[],elements:[],formActions:[]},elements:[],container:null,panels:{displayType:"slider"}}),vd=[...hd,...md,...dd];const bd=new class{constructor(){n(this,"groupLabel",(t=>r.get(t)||t||"")),n(this,"layoutTypes",{row:()=>kd.active.addChild(),column:()=>this.layoutTypes.row().addChild(),field:t=>this.layoutTypes.column().addChild(t)}),n(this,"addElement",(t=>{const{meta:{group:e,id:n},...o}=zr(this.get(t),"controlData");return qr(o,"config.controlId",n),"layout"===e?this.layoutTypes[n.replace("layout-","")]():this.layoutTypes.field(o)})),n(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=Xi(gd,t);return this.container=e,this.groupOrder=Ui(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...vd,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${y}`);return e&&this.panels.nav.refresh(Hr(e))},click:({target:t})=>{this.addElement(t.parentElement.id)}}}async init(t,e=!1){return await this.applyOptions(t),this.buildDOM(e),this}registerControls(t){return this.controls=[],t.map((async t=>{let e;return e="function"==typeof t?new t:new cd(t),this.add(e),this.controls.push(e.dom),e.promise()}))}groupElements(){let t=this.options.groups.slice(),e=this.controls.slice(),n=[];const o=[];return t=Xr(t,this.groupOrder,"id"),t=t.filter((t=>zi(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:y,id:`${t.id}-${y}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=Ui(e.concat(t.elementOrder));t.elementOrder=n}return e=Xr(e,t.elementOrder,"meta.id"),n.content=e.filter((e=>{const{controlData:n}=this.get(e.id),i=n.meta.id||"";let r=!0;return r=[zi(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(i)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=Vi(t);return this.data.set(e.id,e),e.controlData.meta.id&&this.data.set(e.controlData.meta.id,e.controlData),e}get(t){return Vi(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...qd.btnTemplate({content:[qd.icon("bin"),r.get("clear")],title:r.get("clearAll")}),className:["clear-form"],action:{click:t=>{$d.size?(os.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:r.get("confirmClearAll"),clearAllAction:()=>{kd.clearAll().then((()=>{const e={src:t.target};os.formeoCleared(e)}))},btnCoords:qd.coords(t.target)}}),document.dispatchEvent(os.confirmClearAll)):window.alert(r.get("cannotClearFields"))}}},e={...qd.btnTemplate({content:[qd.icon("floppy-disk"),r.get("save")],title:r.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=Wd,n={action:()=>{},coords:qd.coords(t),message:"",button:t};return jc.click.btn(n),jc.save.form(e)}}};return{className:"form-actions f-btn-group",content:Object.entries({clearBtn:t,saveBtn:e}).reduce(((t,[e,n])=>(this.options.disable.formActions.includes(e)||t.push(n),t)),[])}}buildDOM(t){const e=this.groupElements(),n=this.formActions(),{displayType:o}=this.options.panels;this.panels=new Lc({panels:e,type:"controls",displayType:o});const i=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=qd.create({className:i,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=qd.create({className:a,content:[s,n]}),c=l.getElementsByClassName("control-group");this.dom=l,this.groups=c;const[d]=c;this.currentGroup=d,this.actions={filter:t=>{const e=""!==t,n=this.controls;let o=s.querySelector(".filtered-term");if(qd.toggleElementsByStr(n,t),e){const e=r.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=qd.create({tag:"h5",className:"filtered-term",content:e}),s.insertBefore(o,s.firstChild))}else o&&(l.classList.remove("filtered"),o.remove())},addElement:this.addElement,addGroup:t=>{}};for(let r=c.length-1;r>=0;r--){const t=`formeo-controls-${c[r]}`;this.options.sortable||window.localStorage.removeItem(t),ac.create(c[r],{animation:150,forceFallback:!0,fallbackClass:"control-moving",fallbackOnBody:!0,group:{name:"controls",pull:"clone",put:!1},onStart:({item:t})=>{const{controlData:e}=this.get(t.id);this.options.ghostPreview&&(t.innerHTML="",t.appendChild(new Kc(e).preview))},onEnd:({from:t,item:e,clone:n})=>{t.contains(n)&&t.replaceChild(e,n)},sort:this.options.sortable,store:{get:()=>{const e=window.localStorage.getItem(t);return e?e.split("|"):[]},set:e=>{const n=e.toArray();window.localStorage.setItem(t,n.join("|"))}}})}return l}};class yd extends Sa{constructor(){super(...arguments),n(this,"load",(t=>{const e=nr(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),n(this,"get",(t=>t?zr(this.data,t):this.add())),n(this,"add",((t,e=Object.create(null))=>{const n=t||Hi(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),n(this,"remove",(t=>{if(Array.isArray(t))for(const e of t)this.get(e).remove();else this.get(t).remove();return this.data})),n(this,"delete",(t=>(delete this.data[t],t))),n(this,"clearAll",((t=!0)=>{const e=Object.values(this.data).map((e=>e.empty(t)));return Promise.all(e)})),n(this,"conditionMap",new Map)}set config(t){this.configVal=Xi(this.configVal,Vi(t))}get config(){return this.configVal}}class wd extends Jc{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=qd.create({attrs:{className:[w,"empty"],id:this.id},children:n}),ac.create(n,{animation:150,fallbackClass:"row-moving",forceFallback:!0,group:{name:"stage",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onAdd:this.onAdd.bind(this),onRemove:this.onRemove.bind(this),onStart:()=>{Cd.active=this},onSort:this.onSort.bind(this),draggable:`.${C}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Qr.slideUp(this.dom,q,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Qr.slideDown(this.dom,q)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const Cd=new class extends yd{constructor(t){super("stages",t)}Component(t){return new wd(t)}};class Ed extends Jc{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[C]}),...t}),n(this,"autoColumnWidths",(()=>{const t=this.children;if(!t.length)return;const e=Number.parseFloat((100/t.length).toFixed(1))/1;for(const n of t){n.removeClasses(Q);const t=n.dom,o=Gi(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),U);document.dispatchEvent(os.columnResized)}this.updateColumnPreset()})),n(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>qd.create({tag:"option",content:t,attrs:e})));this.columnPresetControl.append(...t)})),n(this,"setColumnWidths",(t=>{"string"==typeof t&&(t=t.split(",")),this.children.forEach(((e,n)=>{e.setWidth(`${t[n]}%`),e.refreshFieldPanels()}))}));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[C,"empty"],dataset:{hoverTag:r.get("row"),editingHoverTag:r.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,e]}),ac.create(e,{animation:150,fallbackClass:"column-moving",forceFallback:!0,group:{name:"row",pull:!0,put:["row","column","controls"]},sort:!0,disabled:!1,onRemove:this.onRemove.bind(this),onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),draggable:`.${E}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:r.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:r.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:r.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:r.get("row.makeInputGroup"),description:r.get("row.makeInputGroupDesc")}},n={className:"input-group",content:{tag:"input",attrs:{type:"text",ariaLabel:"Legend for fieldset",value:this.get("config.legend"),placeholder:"Title"},config:{label:{children:["Row Title",{tag:"span",content:" ⓘ",dataset:{tooltip:"Row title will be used as the legend for the fieldset"}}]}},action:{input:({target:{value:t}})=>this.set("config.legend",t)},className:""}},o=qd.formGroup([t,n]),i={tag:"label",content:r.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=qd.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",qd.formGroup([i,s],"row")];return qd.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>qd.create(t)));t.append(...e)}}})}onAdd(...t){super.onAdd(...t),this.autoColumnWidths()}onRemove(...t){super.onRemove(...t),this.autoColumnWidths()}get getColumnPresetOptions(){const t=this.children,e=F.get(t.length-1)||[],n=t.map((t=>{const e=t.get("config.width")||"";return Number(e.replace("%","")).toFixed(1)})).join(",");if(e.length){const t=e.slice();return!t.find((t=>t.value===n))&&t.push({value:n,label:n.replace(/,/g," | "),className:S}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:r.get("defineColumnLayout"),className:O},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const xd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const Sd=new class extends yd{constructor(t){super("rows",t),this.config={all:xd}}Component(t){return new Ed(t)}};class Od{constructor(){this.onMove=this.onMove.bind(this),this.onStop=this.onStop.bind(this),this.cleanup=this.cleanup.bind(this)}getRowWidth(t){const e=t.querySelector(".children");if(!e)return 0;const n=e.children.length,o=qd.getStyle(e,"gap")||"0px",i=parseFloat(o,10)||0;return this.totalGapWidth=i*(n-1),e.offsetWidth-this.totalGapWidth}validateResizeTarget(t,e){return t&&e&&t.offsetWidth&&e.offsetWidth}onStart(t){if(t.preventDefault(),this.resized=!1,0!==t.button)return;const e=t.target.parentElement,n=e.nextSibling||e.previousSibling,o=e.closest(`.${C}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(_),this.columnPreset=o.querySelector(`.${O}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(Q,""),n.className=n.className.replace(Q,""),this.colStartWidth=e.offsetWidth,this.sibStartWidth=n.offsetWidth,this.rowWidth=this.getRowWidth(o),this.rowWidth<=0)this.cleanup();else{this.column=e,this.sibling=n,this.row=o;try{window.addEventListener("pointermove",this.onMove,!1),window.addEventListener("pointerup",this.onStop,!1)}catch(i){this.cleanup()}}else this.cleanup()}calculateNewWidths(t){const e=this.colStartWidth+t-this.startX,n=this.sibStartWidth-t+this.startX,o=parseFloat(Yi(e,this.rowWidth)),i=parseFloat(Yi(n,this.rowWidth));return o<10||i<10?null:{colWidth:Gi(o.toFixed(1)),siblingColWidth:Gi(i.toFixed(1))}}onMove(t){t.preventDefault();const{column:e,sibling:n}=this,o="touchmove"===t.type?t.touches[0].clientX:t.clientX,i=this.calculateNewWidths(o);if(!i)return;const{colWidth:r,siblingColWidth:s}=i;e.dataset.colWidth=r,n.dataset.colWidth=s,e.style.width=r,n.style.width=s,this.resized=!0}onStop(){const{column:t,sibling:e}=this;window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop),this.resized&&(this.setCustomWidthValue(),Wd.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Wd.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(_),this.resized=!1,this.cleanup())}cleanup(){this.column&&this.originalColumnClass&&(this.column.className=this.originalColumnClass),this.sibling&&this.originalSiblingClass&&(this.sibling.className=this.originalSiblingClass),this.row&&this.row.classList.remove(_),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${S}`);const n=this.row.querySelector(".children").children,o=Yr(n,(t=>Yi(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=qd.create({tag:"option",attrs:{className:S,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const _d=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[qd.icon("triangle-down"),qd.icon("triangle-up")]}),Nd=()=>({className:"column-edit group-config"});class Ad extends Jc{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[E]}),...t}),n(this,"refreshFieldPanels",(()=>{for(const t of this.children)t.panels.nav.refresh()})),n(this,"setDomWidth",(t=>{this.dom.dataset.colWidth=t,this.dom.style.width=t})),n(this,"setWidth",(t=>(this.setDomWidth(t),this.set("config.width",t))));const e=this.createChildWrap();this.dom=qd.create({tag:"li",className:[E,"empty"],dataset:{hoverTag:r.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Nd(),_d(new Od),e]}),this.processConfig(),os.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),ac.create(e,{animation:150,fallbackClass:"field-moving",forceFallback:!0,group:{name:"column",pull:!0,put:["column","controls"]},sort:!0,disabled:!1,onEnd:this.onEnd.bind(this),onAdd:this.onAdd.bind(this),onSort:this.onSort.bind(this),onRemove:this.onRemove.bind(this),onMove:t=>{t.from!==t.to&&t.from.classList.remove("hovering-column")},draggable:`.${x}`,handle:".item-move"})}processConfig(){const t=Kr.get(this.data,"config.width");t&&this.setDomWidth(t)}}const jd={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Td=new class extends yd{constructor(t){super("columns",t),this.config={all:jd}}Component(t){return new Ad(t)}},Pd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Ld=new class extends yd{constructor(t){super("fields",t),n(this,"get",(t=>{let e=t&&zr(this.data,t);if(!e){const n=bd.get(t);n&&(e=this.add(null,n.controlData))}return e})),n(this,"getData",(()=>Object.entries(this.data).reduce(((t,[e,n])=>{const{conditions:o,...i}=(null==n?void 0:n.getData())||n;if(null==o?void 0:o.length){let t=!0;if(1===o.length){const[e]=o;t=Boolean(e.if[0].source&&e.then[0].target)}t&&(i.conditions=o)}return t[e]=i,t}),{}))),n(this,"load",((t=Object.create(null))=>{const e=nr(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&qr(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:Pd}}Component(t){return new Kc(t)}};const Dd=new class extends yd{constructor(t){super("externals",t)}Component(t){return new Jc("external",t)}},kd=Cd,$d=Sd,Id=Td,Md=Ld,Rd=bd,Fd=Dd;const Wd=new class extends Sa{constructor(){super("components"),n(this,"load",((t,e)=>{this.empty();const n=((t,e=!1)=>t?Vi(nr(t)):e&&Zi.get(B)||et())(t,e.sessionStorage);this.opts=e,this.set("id",n.id),this.add("stages",kd.load(n.stages)),this.add("rows",$d.load(n.rows)),this.add("columns",Id.load(n.columns)),this.add("fields",Md.load(n.fields)),this.add("externals",Fd.load(this.opts.external));for(const o of Object.values(this.get("stages")))o.loadChildren();return this.data})),this.disableEvents=!0,this.stages=kd,this.rows=$d,this.columns=Id,this.fields=Md,this.controls=Rd,this.externals=Fd}flatList(t=this.data,e=Object.create(null)){return Object.entries(t).reduce(((t,[e,n])=>{if("object"==typeof n)for(const[o,i]of Object.entries(n))t[`${e}.${o}`]=i;return t}),e)}get json(){return window.JSON.stringify({$schema:`https://cdn.jsdelivr.net/npm/formeo@${p}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:Cd.getData(),rows:Sd.getData(),columns:Td.getData(),fields:Ld.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;kd.config=e,$d.config=n,Id.config=o,Md.config=i}setAddress(t,e){const[n,o,...i]=Array.isArray(t)?t:t.split("."),r=this[n.replace(/s?$/,"s")].get(o);return null==r||r.set(i,e),r}getAddress(t){if(!Ji(t))return;const[e,n,...o]=Array.isArray(t)?t:t.split("."),i=this[e.replace(/s?$/,"s")].get(n);return o.length?i.get(o):i}getConditionMap(t){if(Ji(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Ji(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Ji(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},Bd={glyphicons:t=>``,"font-awesome":t=>{const[e,n]=t.split(" ");return``},fontello:t=>`${t}`},zd=new Set(["input","textarea","select"]);const qd=new class{constructor(t=Object.create(null)){n(this,"render",(t=>(t.id=`f-${t.id||Hi()}`,this.create(t)))),n(this,"create",((t,e=!1)=>{if(!t)return;const n=this,o=["children","content"],{className:i,options:r,dataset:s,...a}=this.processTagName(t);let l;o.push("tag");const{tag:c}=a;let d;const u={attrs:{},className:[Kr.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let h=document.createElement(c);const p={string:t=>{h.innerHTML+=t},object:t=>t&&h.appendChild(n.create(t,e)),node:t=>h.appendChild(t),component:t=>h.appendChild(t.dom),array:t=>{for(const e of t)l=n.childType(e),p[l](e)},function:t=>{t=t(),l=n.childType(t),p[l](t)},undefined:()=>null,boolean:()=>null};if(i&&(a.attrs=Xi(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return Kr.forEach(t,(t=>{u.children.push(n.create(t,e))})),a.attrs.className&&(u.className=a.attrs.className),u.config={...a.config},this.create(u,e);p.array.call(this,t),a.content=void 0,o.push("options")}if(a.attrs&&(n.processAttrs(a,h,e),o.push("attrs")),a.config){if(a.config.label&&(a.config.label&&"button"!==c||["radio","checkbox"].includes(Kr.get(a,"attrs.type")))&&!e){const t=n.label(a);if(!a.config.hideLabel){const e=[t,h];n.labelAfter(a)&&e.reverse(),u.children.push(e)}}o.push("config")}if(a.content||a.children){const t=a.content||a.children;l=n.childType(t),p[l],p[l].call(this,t)}if(s){for(const t in s)Object.hasOwn(s,t)&&(h.dataset[t]="function"==typeof s[t]?s[t]():s[t]);o.push("dataset")}a.action&&(this.actionHandler(h,a.action),o.push("action"));const f=Kr.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)h[f[d]]=a[f[d]];return u.children.length&&(h=this.create(u)),h})),n(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),n(this,"toggleElementsByStr",((t,e)=>{const n=[];return qd.elementsContainText(t,e,((t,e)=>{e?(t.style.display="block",n.push(t)):t.style.display="none"})),n})),n(this,"elementsContainText",((t,e,n)=>{const o=[];return Vr(t,(t=>{const i=-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase());null==n||n(t,i),i&&o.push(t)})),o})),n(this,"generateOption",(({type:t="option",label:e,value:n,i:o=0,selected:i})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:i||!o},config:{label:e||r.get("labelCount",{label:r.get("option"),count:o})}}))),n(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),n(this,"removeEmpty",(t=>{const e=t.parentElement,n=qi(t),o=e.getElementsByClassName(`formeo-${n}`);if(this.remove(t),!o.length)return this.isStage(e)?this.emptyClass(e):this.removeEmpty(e)})),n(this,"btnTemplate",(({title:t="",...e})=>({tag:"button",attrs:{type:"button",title:t},...e}))),n(this,"isControls",(t=>qi(t)===y)),n(this,"isStage",(t=>qi(t)===w)),n(this,"isRow",(t=>qi(t)===C)),n(this,"isColumn",(t=>qi(t)===E)),n(this,"isField",(t=>qi(t)===x)),n(this,"asComponent",(t=>Wd[`${qi(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=Xi(this.options,t)}processTagName(t){let e,n=t;if("string"==typeof n)return e=n,n={tag:e},n;if(n.attrs){const{tag:t,...o}=n.attrs;if(t)if("string"==typeof t)e=t;else{e=(t.find((t=>!0===t.selected))||t[0]).value}n.attrs=o}return n.tag=e||n.tag||"div",n}actionHandler(t,e){const n={onRender:qd.onRender,render:qd.onRender},o=["focus","blur"];return Object.entries(e).map((([e,i])=>(Array.isArray(i)?i:[i]).map((i=>{const r=n[e]||(t=>(e,n)=>e.addEventListener(t,n,o.includes(t)))(e);return r(t,i)}))))}get icons(){if(this.iconSymbols)return this.iconSymbols;const t=document.querySelectorAll(`#${f} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(tt,"")]={tag:"svg",attrs:{className:["svg-icon",n=e.id]},children:[{tag:"use",attrs:{"xmlns:xlink":"http://www.w3.org/1999/xlink","xlink:href":`#${n}`}}]},t}),{}),this.cachedIcons={},this.iconSymbols}icon(t,e){var n,o;if(!t)return;const i=`${t}?${new URLSearchParams(e).toString()}`;if(null==(n=this.cachedIcons)?void 0:n[i])return this.cachedIcons[i];const r=this.icons[t];if(r){if(e){const t=Xi(r,e);return this.cachedIcons[i]=qd.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=qd.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Bd[qd.options.iconFont])?void 0:o.call(Bd,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",Hi(t));for(const i of Object.keys(o)){const t=Kr.safeAttrName(i),n=this.processAttrValue(o[i]);n&&e.setAttribute(t,!0===n?"":n)}}processAttrValue(t){let e=t||"";if(Array.isArray(e))if("object"==typeof e[0]){const t=e.filter((t=>!0===t.selected));e=t.length?t[0].value:e[0].value}else e=e.join(" ");return e}processOptions(t,e,n){const{action:o,attrs:i}=e,r=i.type||e.tag,s=i.id||e.id;return t.map(((t,i)=>{var a;const{label:l,...c}=t,d=()=>{const a={tag:"input",attrs:{name:s,type:r,value:t.value||"",id:`${s}-${i}`,...c},action:o},l={tag:"label",attrs:{for:`${s}-${i}`},config:{inputWrap:"form-check"},children:t.label},d={children:[a,l],className:[`f-${r}`]};return e.attrs.className&&(e.config.inputWrap=e.attrs.className),e.config.inline&&d.className.push(`f-${r}-inline`),t.selected&&(a.attrs.checked=!0),n&&(l.attrs.contenteditable=!0),d},u={select:()=>({tag:"option",attrs:t,children:t.label}),button:t=>{const{type:n,label:o,className:i,id:r}=t;return{...e,attrs:{type:n},className:i,id:r||Hi(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=u[r])?void 0:a.call(u,t)}))}holdsContent(t){return-1!==t.outerHTML.indexOf("/")}isBlockInput(t){return!this.isInput(t)&&this.holdsContent(t)}isInput(t){let e=t;return"string"!=typeof e&&(e=e.tagName),zd.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Kr.get(t,"attrs.type"),n=Kr.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Kr.get(t,"attrs.required");let{config:{label:o=""}}=t;const{id:i,attrs:r}=t;"function"==typeof o&&(o=o());const s={tag:"label",attrs:{for:i||(null==r?void 0:r.id)},className:[],children:[o,n&&this.requiredMark()],action:{}};return e&&(s.attrs.for=void 0,s.attrs.contenteditable=!0,s.fMap=e),s}childType(t){return void 0===t?t:[["array",t=>Array.isArray(t)],["node",t=>t instanceof window.Node||t instanceof window.HTMLElement],["component",()=>null==t?void 0:t.dom],[typeof t,()=>!0]].find((e=>e[1](t)))[0]}getStyle(t,e=!1){let n;return window.getComputedStyle?n=window.getComputedStyle(t,null):t.currentStyle&&(n=t.currentStyle),e?n[e]:n}getElement(t){return{node:()=>t,object:()=>document.getElementById(t.id),string:()=>document.getElementById(t)}[this.childType(t)]()}empty(t){for(;t.firstChild;)this.remove(t.firstChild);return t}remove(t){const e=qi(t);return e?Wd.remove(`${e}s.${t.id}`):t.parentElement.removeChild(t)}removeClasses(t,e){const n={string:t=>t.classList.remove(e),array:t=>{for(const n of e)t.classList.remove(n)}};n.object=n.string,Kr.forEach(t,n[this.childType(e)])}addClasses(t,e){const n={string:t=>t.classList.add(e),array:t=>{for(const n of e)t.classList.add(n)}};Kr.forEach(t,n[this.childType(e)])}formGroup(t,e=""){return{className:["f-field-group",e],children:t}}coords(t){const e=t.getBoundingClientRect(),n=document.body.getBoundingClientRect();return{pageX:e.left+e.width/2,pageY:e.top-n.top-e.height/2}}clearStage(t){t.classList.add("removing-all-fields");Qr.slideUp(t,600,(()=>{qd.empty(t),t.classList.remove("removing-all-fields"),qd.emptyClass(t),Qr.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=qi(t);if(!o)return;const i=qi(t.parentElement),r=qd[o].get(t.id).sortable;n||(n=!r.option("disabled")),r.option("disabled",n),i&&["rows","columns","stages"].includes(i)&&this.toggleSortable(t.parentElement,n)}emptyClass(t){const e=t.getElementsByClassName(N.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};r.addLanguage("en-US",void 0);const Ud={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:g,style:b,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Jr(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let Hd=class{constructor({formData:t,...e},n){const o=Xi(Ud.editor,e),{actions:i,events:r,debug:s,config:a,editorContainer:l,...c}=o;l&&(this.editorContainer="string"==typeof l?document.querySelector(l):l),this.opts=c,qd.setOptions=c,Wd.config=a,this.userFormData=or(n||t),this.Components=Wd,this.dom=qd,os.init({debug:s,...r}),jc.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new u,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.loadResources.bind(this)):this.loadResources()}get formData(){return this.Components.formData}set formData(t={}){this.load({...this.userFormData,...t},this.opts)}get json(){return this.Components.json}async loadResources(){var t;document.removeEventListener("DOMContentLoaded",this.loadResources);const e=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?m.filter((({name:e})=>-1!==t.indexOf(e))):m;Promise.all(e.map((({src:t})=>od(t))))})(this.opts.polyfills),await rd(this.opts.svgSprite),e.push((async t=>{if(!ld()&&(await id(t),!ld()))return await id("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(r.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(z)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){return bd.init(this.opts.controls,this.opts.stickyControls).then((t=>{var e,n;this.controls=t,this.load(this.userFormData,this.opts),this.formId=Wd.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(z,t);r.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render(),null==(n=(e=this.opts).onLoad)||n.call(e,this)}))}load(t=this.userFormData,e=this.opts){return this.Components.load(t,e)}render(){if(!this.controls)return window.requestAnimationFrame((()=>this.render()));if(this.stages=Object.values(Wd.get("stages")),this.opts.controlOnLeft)for(const e of this.stages)e.dom.style.order=1;const t={attrs:{className:"formeo formeo-editor",id:this.formId},content:[this.stages.map((({dom:t})=>t))]};r.current.dir&&(t.attrs.dir=r.current.dir,qd.dir=r.current.dir),this.editor=qd.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(qd.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),os.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(os.formeoLoaded)}};const Xd=t=>"string"==typeof t?document.querySelector(t):t,Vd=t=>{const e=t.match(K);return(null==e?void 0:e[0])||t},Yd=t=>t.replace(K,Hi());let Gd=class{constructor(t,e){n(this,"render",((t=this.form)=>{this.form=or(t);const e=document.getElementsByClassName("formeo-render").length,n={id:this.form.id,className:`formeo-render formeo formeo-rendered-${e}`,children:this.processedData};this.renderedForm=qd.render(n),this.applyConditions();const o=this.container.querySelector(".formeo-render");o?o.replaceWith(this.renderedForm):this.container.appendChild(this.renderedForm)})),n(this,"orderChildren",((t,e)=>e.reduce(((e,n)=>(e.push(this.form[t][n]),e)),[]))),n(this,"prefixId",(t=>"f-"+t)),n(this,"processColumn",(({id:t,...e})=>({...e,id:this.prefixId(t),children:this.processFields(e.children),style:`width: ${e.config.width||"100%"}`}))),n(this,"processRows",(t=>this.orderChildren("rows",this.form.stages[t].children).reduce(((t,e)=>(e&&t.push(this.processRow(e)),t)),[]))),n(this,"cacheComponent",(t=>(this.components[Vd(t.id)]=t,t))),n(this,"processRow",((t,e="row")=>{const{config:n,id:o}=t,i=[`formeo-${e}-wrap`],r={...t,children:this.processColumns(t.id),id:this.prefixId(o)};this.cacheComponent(r);const s=[{condition:n.legend,result:()=>({tag:n.fieldset?"legend":"h3",children:n.legend})},{condition:!0,result:()=>r},{condition:n.inputGroup,result:()=>this.addButton(o)}].reduce(((t,{condition:e,result:n})=>(e&&t.push(n()),t)),[]);return n.inputGroup&&i.push("f-input-group-wrap"),{tag:n.fieldset?"fieldset":"div",id:Hi(),className:i,children:s}})),n(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:Yd(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(Vd(t))))})})),n(this,"addButton",(t=>qd.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=qd.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(qd.render(qd.btnTemplate({className:"remove-input-group",children:qd.icon("remove"),action:{mouseover:({target:t})=>t.parentElement.classList.add("will-remove"),mouseleave:({target:t})=>t.parentElement.classList.remove("will-remove"),click:({target:t})=>t.parentElement.remove()}})))}}}))),n(this,"processColumns",(t=>this.orderChildren("columns",this.form.rows[t].children).map((t=>this.cacheComponent(this.processColumn(t)))))),n(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{var n,o;const i=(null==(n=e.config)?void 0:n.controlId)||(null==(o=e.meta)?void 0:o.id),{action:r={},dependencies:s={}}=this.elements[i]||{};s&&ad(s);const a=Xi({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),n(this,"handleComponentCondition",((t,e,n)=>{const o=Zd(t);o&&t.addEventListener(o,(t=>{if(this.evaluateCondition(e,t))for(const e of n)this.execResult(e,t)}),!1);const i={target:t};if(this.evaluateCondition(e,i))for(const r of n)this.execResult(r,i)})),n(this,"applyConditions",(()=>{for(const{conditions:t}of Object.values(this.components))if(t)for(const e of t){const{if:t,then:n}=e;for(const e of t){const{source:t,...o}=e;if(Ji(t)){const e=this.getComponents(t);for(const t of e)this.handleComponentCondition(t,o,n)}}}})),n(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:xa,notEquals:(t,e)=>!xa(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Ji(o)?this.getComponent(o)[e]:o);return null==(r=s[n])?void 0:r.call(s,a,l)})),n(this,"execResult",(({assignment:t,target:e,targetProperty:n,value:o})=>{var i;const r={equals:t=>{var e;const i={value:()=>{t[n]=o},isNotVisible:()=>{t.parentElement.setAttribute("hidden",!0),t.required=!1},isVisible:()=>{t.parentElement.removeAttribute("hidden"),t.required=t._required}};null==(e=i[n])||e.call(i)}};if(Ji(e)){const n=this.getComponent(e);n&&void 0===n._required&&(n._required=n.required),null==(i=r[t])||i.call(r,n)}})),n(this,"getComponent",(t=>{const e=t.slice(t.indexOf(".")+1);return Ki(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),n(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return Ki(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r,formData:s}=(({editorContainer:t,renderContainer:e,formData:n,...o})=>({elements:{},...o,renderContainer:Xd(e),editorContainer:Xd(t),formData:or(n)}))(t);this.container=o,this.form=or(e||s),this.external=i,this.dom=qd,this.components=Object.create(null),this.elements=r}get processedData(){return Object.values(this.form.stages).map((t=>(t.children=this.processRows(t.id),t.className=w,qd.render(t))))}};const Zd=t=>{const[e]=[["input",t=>["textarea","text"].includes(t.type)],["change",t=>["select"].includes(t.tagName.toLowerCase())||["checkbox","radio"].includes(t.type)]].find((e=>e[1](t)))||[!1];return e};void 0!==window&&(window.FormeoEditor=Hd,window.FormeoRenderer=Gd);const Jd=Hd,Kd=Gd;t.FormeoEditor=Jd,t.FormeoRenderer=Kd,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})); diff --git a/assets/js/formeo.min.js.gz b/assets/js/formeo.min.js.gz index 9cd8c25..b43d113 100644 Binary files a/assets/js/formeo.min.js.gz and b/assets/js/formeo.min.js.gz differ diff --git a/index.html b/index.html index 3c4de23..a4188b1 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Formeo | Drag & Drop Form Creation
\ No newline at end of file +Formeo | Drag & Drop Form Creation
\ No newline at end of file