formeo 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/demo/assets/css/demo.min.css +2 -2
- package/dist/demo/assets/css/demo.min.css.gz +0 -0
- package/dist/demo/assets/css/formeo.min.css +2 -2
- package/dist/demo/assets/css/formeo.min.css.gz +0 -0
- package/dist/demo/assets/js/demo.min.js +2 -2
- package/dist/demo/assets/js/demo.min.js.gz +0 -0
- package/dist/demo/assets/js/formeo.min.js +3 -3
- package/dist/demo/assets/js/formeo.min.js.gz +0 -0
- package/dist/demo/index.html +1 -1
- package/dist/formData_schema.json +8 -4
- package/dist/formeo.cjs.js +3 -3
- package/dist/formeo.es.js +206 -99
- package/dist/formeo.min.css +2 -2
- package/dist/formeo.min.js +3 -3
- package/dist/formeo.umd.js +3 -3
- package/package.json +1 -1
package/dist/formeo.cjs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
formeo - https://formeo.io
|
|
4
|
-
Version:
|
|
4
|
+
Version: 3.0.1
|
|
5
5
|
Author: Draggable https://draggable.io
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
"use strict";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);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class o{constructor(t=n){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...o}={...n,...t},i=e.replace(/\/?$/,"/");this.config={location:i,...o};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?o.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 o.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i<e.length;i++){o=/^(.+?) *?= *?([^\n]+)/.exec(e[i]),o&&(n[o[1]]=o[2].replace(/(^\s+|\s+$)/g,""))}return n}loadLang(t,e=!0){const n=this;return new Promise((function(i,r){if(-1!==n.loaded.indexOf(t)&&e)return n.applyLanguage(n.langs[t]),i(n.langs[t]);return async function(t){try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const n=t.endsWith(".lang")?"text":"json";return await e[n]()}catch(e){throw e}}([n.config.location,t,n.config.extension].join("")).then((e=>{const r=o.processFile(e);return n.applyLanguage(t,r),n.loaded.push(t),i(n.langs[t])})).catch((e=>{const o=n.applyLanguage(t);i(o)}))}))}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 i=new o;!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 r=Object.defineProperty,s=(t,e,n)=>((t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const a="_3x4ZIcu-",l="JIt36hCJ",c={triggerName:"tooltip"};class d{constructor(t=c){s(this,"triggerName"),s(this,"tooltip"),s(this,"activeTriggerType",null),s(this,"spacing",12),s(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()})),s(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")}})),s(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()})),s(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),s(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${a}`,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(l)}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(a)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(l);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(l),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=d);const u="formeo",h="2.3.1",p="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"}],f=`https://cdn.jsdelivr.net/npm/formeo@${h}/dist/${p}.svg`,g=`https://draggable.github.io/formeo/assets/img/${p}.svg`,v=`https://cdn.jsdelivr.net/npm/formeo@${h}/dist/formeo.min.css`,b="control-group",y=`${u}-stage`,w=`${u}-row`,C=`${u}-column`,E=`${u}-field`,x="custom-column-widths",S="column-preset",O="resizing-columns",_=new Map([[y,w],[w,C],[C,E]]),N=["external","stages","rows","columns","fields"],A=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),j=[{name:"controls",className:b},{name:"stage",className:y},{name:"row",className:w},{name:"column",className:C},{name:"field",className:E}],P={controls:b,stage:y,row:w,column:C,field:E},T=Object.entries(P).reduce(((t,[e,n])=>({...t,[n]:e})),{}),L=Object.values(P),D=new RegExp(`${L.join("|")}`,"g"),k=j.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),$=k.slice().map((t=>t.slice().reverse())).reverse(),I=new Map(k),M=new Map($.slice()),R=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)),[])),F=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],W=`${u}-formData`,B=`${u}-locale`,z=333,q=Math.round(166.5),U=Math.round(666),H="formeoSaved",X="formeoUpdated",V="formeoOnRender",Y=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],G={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},Z={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:G},J=/(\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,K=/\bcol-\w+-\d+/g,Q="f-i-";var tt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function et(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nt=function(){this.__data__=[],this.size=0};var ot=function(t,e){return t===e||t!=t&&e!=e},it=ot;var rt=function(t,e){for(var n=t.length;n--;)if(it(t[n][0],e))return n;return-1},st=rt,at=Array.prototype.splice;var lt=rt;var ct=rt;var dt=rt;var ut=nt,ht=function(t){var e=this.__data__,n=st(e,t);return!(n<0)&&(n==e.length-1?e.pop():at.call(e,n,1),--this.size,!0)},pt=function(t){var e=this.__data__,n=lt(e,t);return n<0?void 0:e[n][1]},mt=function(t){return ct(this.__data__,t)>-1},ft=function(t,e){var n=this.__data__,o=dt(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function gt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}gt.prototype.clear=ut,gt.prototype.delete=ht,gt.prototype.get=pt,gt.prototype.has=mt,gt.prototype.set=ft;var vt=gt,bt=vt;var yt=function(){this.__data__=new bt,this.size=0};var wt=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var Ct=function(t){return this.__data__.get(t)};var Et=function(t){return this.__data__.has(t)},xt="object"==typeof tt&&tt&&tt.Object===Object&&tt,St=xt,Ot="object"==typeof self&&self&&self.Object===Object&&self,_t=St||Ot||Function("return this")(),Nt=_t.Symbol,At=Nt,jt=Object.prototype,Pt=jt.hasOwnProperty,Tt=jt.toString,Lt=At?At.toStringTag:void 0;var Dt=function(t){var e=Pt.call(t,Lt),n=t[Lt];try{t[Lt]=void 0;var o=!0}catch(r){}var i=Tt.call(t);return o&&(e?t[Lt]=n:delete t[Lt]),i},kt=Object.prototype.toString;var $t=Dt,It=function(t){return kt.call(t)},Mt=Nt?Nt.toStringTag:void 0;var Rt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Mt&&Mt in Object(t)?$t(t):It(t)};var Ft=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Wt=Rt,Bt=Ft;var zt,qt=function(t){if(!Bt(t))return!1;var e=Wt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Ut=_t["__core-js_shared__"],Ht=(zt=/[^.]+$/.exec(Ut&&Ut.keys&&Ut.keys.IE_PROTO||""))?"Symbol(src)_1."+zt:"";var Xt=function(t){return!!Ht&&Ht in t},Vt=Function.prototype.toString;var Yt=function(t){if(null!=t){try{return Vt.call(t)}catch(e){}try{return t+""}catch(e){}}return""},Gt=qt,Zt=Xt,Jt=Ft,Kt=Yt,Qt=/^\[object .+?Constructor\]$/,te=Function.prototype,ee=Object.prototype,ne=te.toString,oe=ee.hasOwnProperty,ie=RegExp("^"+ne.call(oe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var re=function(t){return!(!Jt(t)||Zt(t))&&(Gt(t)?ie:Qt).test(Kt(t))},se=function(t,e){return null==t?void 0:t[e]};var ae=function(t,e){var n=se(t,e);return re(n)?n:void 0},le=ae(_t,"Map"),ce=ae(Object,"create"),de=ce;var ue=function(){this.__data__=de?de(null):{},this.size=0};var he=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},pe=ce,me=Object.prototype.hasOwnProperty;var fe=function(t){var e=this.__data__;if(pe){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return me.call(e,t)?e[t]:void 0},ge=ce,ve=Object.prototype.hasOwnProperty;var be=ce;var ye=ue,we=he,Ce=fe,Ee=function(t){var e=this.__data__;return ge?void 0!==e[t]:ve.call(e,t)},xe=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=be&&void 0===e?"__lodash_hash_undefined__":e,this};function Se(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}Se.prototype.clear=ye,Se.prototype.delete=we,Se.prototype.get=Ce,Se.prototype.has=Ee,Se.prototype.set=xe;var Oe=Se,_e=vt,Ne=le;var Ae=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var je=function(t,e){var n=t.__data__;return Ae(e)?n["string"==typeof e?"string":"hash"]:n.map},Pe=je;var Te=je;var Le=je;var De=je;var ke=function(){this.size=0,this.__data__={hash:new Oe,map:new(Ne||_e),string:new Oe}},$e=function(t){var e=Pe(this,t).delete(t);return this.size-=e?1:0,e},Ie=function(t){return Te(this,t).get(t)},Me=function(t){return Le(this,t).has(t)},Re=function(t,e){var n=De(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this};function Fe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}Fe.prototype.clear=ke,Fe.prototype.delete=$e,Fe.prototype.get=Ie,Fe.prototype.has=Me,Fe.prototype.set=Re;var We=Fe,Be=vt,ze=le,qe=We;var Ue=vt,He=yt,Xe=wt,Ve=Ct,Ye=Et,Ge=function(t,e){var n=this.__data__;if(n instanceof Be){var o=n.__data__;if(!ze||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new qe(o)}return n.set(t,e),this.size=n.size,this};function Ze(t){var e=this.__data__=new Ue(t);this.size=e.size}Ze.prototype.clear=He,Ze.prototype.delete=Xe,Ze.prototype.get=Ve,Ze.prototype.has=Ye,Ze.prototype.set=Ge;var Je=Ze,Ke=ae,Qe=function(){try{var t=Ke(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),tn=Qe;var en=function(t,e,n){"__proto__"==e&&tn?tn(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},nn=en,on=ot;var rn=function(t,e,n){(void 0!==n&&!on(t[e],n)||void 0===n&&!(e in t))&&nn(t,e,n)};var sn,an,ln,cn,dn,un,hn,pn=function(t){return function(e,n,o){for(var i=-1,r=Object(e),s=o(e),a=s.length;a--;){var l=s[t?a:++i];if(!1===n(r[l],l,r))break}return e}}(),mn={exports:{}};sn=mn,ln=_t,cn=(an=mn.exports)&&!an.nodeType&&an,dn=cn&&sn&&!sn.nodeType&&sn,un=dn&&dn.exports===cn?ln.Buffer:void 0,hn=un?un.allocUnsafe:void 0,sn.exports=function(t,e){if(e)return t.slice();var n=t.length,o=hn?hn(n):new t.constructor(n);return t.copy(o),o};var fn=mn.exports,gn=_t.Uint8Array,vn=gn;var bn=function(t){var e=new t.constructor(t.byteLength);return new vn(e).set(new vn(t)),e};var yn=function(t,e){var n=e?bn(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var wn=function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e},Cn=Ft,En=Object.create,xn=function(){function t(){}return function(e){if(!Cn(e))return{};if(En)return En(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Sn=function(t,e){return function(n){return t(e(n))}},On=Sn(Object.getPrototypeOf,Object),_n=Object.prototype;var Nn=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_n)},An=xn,jn=On,Pn=Nn;var Tn=function(t){return"function"!=typeof t.constructor||Pn(t)?{}:An(jn(t))};var Ln=function(t){return null!=t&&"object"==typeof t},Dn=Rt,kn=Ln;var $n=function(t){return kn(t)&&"[object Arguments]"==Dn(t)},In=Ln,Mn=Object.prototype,Rn=Mn.hasOwnProperty,Fn=Mn.propertyIsEnumerable,Wn=$n(function(){return arguments}())?$n:function(t){return In(t)&&Rn.call(t,"callee")&&!Fn.call(t,"callee")},Bn=Array.isArray;var zn=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},qn=qt,Un=zn;var Hn=function(t){return null!=t&&Un(t.length)&&!qn(t)},Xn=Hn,Vn=Ln;var Yn=function(t){return Vn(t)&&Xn(t)},Gn={exports:{}};var Zn=function(){return!1};!function(t,e){var n=_t,o=Zn,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}(Gn,Gn.exports);var Jn=Gn.exports,Kn=Rt,Qn=On,to=Ln,eo=Function.prototype,no=Object.prototype,oo=eo.toString,io=no.hasOwnProperty,ro=oo.call(Object);var so=function(t){if(!to(t)||"[object Object]"!=Kn(t))return!1;var e=Qn(t);if(null===e)return!0;var n=io.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&oo.call(n)==ro},ao=Rt,lo=zn,co=Ln,uo={};uo["[object Float32Array]"]=uo["[object Float64Array]"]=uo["[object Int8Array]"]=uo["[object Int16Array]"]=uo["[object Int32Array]"]=uo["[object Uint8Array]"]=uo["[object Uint8ClampedArray]"]=uo["[object Uint16Array]"]=uo["[object Uint32Array]"]=!0,uo["[object Arguments]"]=uo["[object Array]"]=uo["[object ArrayBuffer]"]=uo["[object Boolean]"]=uo["[object DataView]"]=uo["[object Date]"]=uo["[object Error]"]=uo["[object Function]"]=uo["[object Map]"]=uo["[object Number]"]=uo["[object Object]"]=uo["[object RegExp]"]=uo["[object Set]"]=uo["[object String]"]=uo["[object WeakMap]"]=!1;var ho=function(t){return co(t)&&lo(t.length)&&!!uo[ao(t)]};var po=function(t){return function(e){return t(e)}},mo={exports:{}};!function(t,e){var n=xt,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}(mo,mo.exports);var fo=mo.exports,go=ho,vo=po,bo=fo&&fo.isTypedArray,yo=bo?vo(bo):go;var wo=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Co=en,Eo=ot,xo=Object.prototype.hasOwnProperty;var So=function(t,e,n){var o=t[e];xo.call(t,e)&&Eo(o,n)&&(void 0!==n||e in t)||Co(t,e,n)},Oo=So,_o=en;var No=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r<s;){var a=e[r],l=o?o(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),i?_o(n,a,l):Oo(n,a,l)}return n};var Ao=/^(?:0|[1-9]\d*)$/;var jo=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Ao.test(t))&&t>-1&&t%1==0&&t<e},Po=function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o},To=Wn,Lo=Bn,Do=Jn,ko=jo,$o=yo,Io=Object.prototype.hasOwnProperty;var Mo=function(t,e){var n=Lo(t),o=!n&&To(t),i=!n&&!o&&Do(t),r=!n&&!o&&!i&&$o(t),s=n||o||i||r,a=s?Po(t.length,String):[],l=a.length;for(var c in t)!e&&!Io.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ko(c,l))||a.push(c);return a};var Ro=Ft,Fo=Nn,Wo=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Bo=Object.prototype.hasOwnProperty;var zo=Mo,qo=function(t){if(!Ro(t))return Wo(t);var e=Fo(t),n=[];for(var o in t)("constructor"!=o||!e&&Bo.call(t,o))&&n.push(o);return n},Uo=Hn;var Ho=function(t){return Uo(t)?zo(t,!0):qo(t)},Xo=No,Vo=Ho;var Yo=rn,Go=fn,Zo=yn,Jo=wn,Ko=Tn,Qo=Wn,ti=Bn,ei=Yn,ni=Jn,oi=qt,ii=Ft,ri=so,si=yo,ai=wo,li=function(t){return Xo(t,Vo(t))};var ci=Je,di=rn,ui=pn,hi=function(t,e,n,o,i,r,s){var a=ai(t,n),l=ai(e,n),c=s.get(l);if(c)Yo(t,n,c);else{var d=r?r(a,l,n+"",t,e,s):void 0,u=void 0===d;if(u){var h=ti(l),p=!h&&ni(l),m=!h&&!p&&si(l);d=l,h||p||m?ti(a)?d=a:ei(a)?d=Jo(a):p?(u=!1,d=Go(l,!0)):m?(u=!1,d=Zo(l,!0)):d=[]:ri(l)||Qo(l)?(d=a,Qo(a)?d=li(a):ii(a)&&!oi(a)||(d=Ko(l))):u=!1}u&&(s.set(l,d),i(d,l,o,r,s),s.delete(l)),Yo(t,n,d)}},pi=Ft,mi=Ho,fi=wo;var gi=function t(e,n,o,i,r){e!==n&&ui(n,(function(s,a){if(r||(r=new ci),pi(s))hi(e,n,a,o,t,i,r);else{var l=i?i(fi(e,a),s,a+"",e,n,r):void 0;void 0===l&&(l=s),di(e,a,l)}}),mi)};var vi=function(t){return t};var bi=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},yi=Math.max;var wi=function(t,e,n){return e=yi(void 0===e?t.length-1:e,0),function(){for(var o=arguments,i=-1,r=yi(o.length-e,0),s=Array(r);++i<r;)s[i]=o[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=o[i];return a[e]=n(s),bi(t,this,a)}};var Ci=function(t){return function(){return t}},Ei=Qe,xi=Ei?function(t,e){return Ei(t,"toString",{configurable:!0,enumerable:!1,value:Ci(e),writable:!0})}:vi,Si=Date.now;var Oi=function(t){var e=0,n=0;return function(){var o=Si(),i=16-(o-n);if(n=o,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(xi),_i=vi,Ni=wi,Ai=Oi;var ji=ot,Pi=Hn,Ti=jo,Li=Ft;var Di=function(t,e){return Ai(Ni(t,e,_i),t+"")},ki=function(t,e,n){if(!Li(n))return!1;var o=typeof e;return!!("number"==o?Pi(n)&&Ti(e,n.length):"string"==o&&e in n)&&ji(n[e],t)};var $i=gi;const Ii=et(function(t){return Di((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&&ki(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++o<i;){var a=n[o];a&&t(e,a,o,r)}return e}))}((function(t,e,n,o){$i(t,e,n,o)}))),Mi=()=>crypto.randomUUID(),Ri=(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},Fi=t=>{var e;const n=null==(e=t.className)?void 0:e.match(D);return n&&T[n[0]]},Wi=t=>Array.from(new Set(t)),Bi=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||Mi(),t.id=e}else e=Mi();return e},zi=(t,e)=>Ii({},t,e,((t,e)=>Array.isArray(t)?null!=e?Wi(t.concat(e)):e:Array.isArray(e)?null!=t?Wi(e.concat(t)):e:void 0)),qi=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;n<o;n++)e[n]=qi(t[n]);return e}if(t instanceof Object){e={};for(const n in t)Object.hasOwn(t,n)&&(e[n]=qi(t[n]));return e}throw new Error("Unable to copy Object, type not supported.")},Ui=(t,e)=>t/e*100,Hi=t=>`${t.toString()}%`,Xi=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){}}}}),Vi=t=>N.some((e=>new RegExp(`^${e}.`).test(t))),Yi=t=>t.startsWith("external");function Gi(t,e=U){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function Zi(t){return t}function Ji(){}var Ki=Rt,Qi=Ln;var tr=function(t){return"symbol"==typeof t||Qi(t)&&"[object Symbol]"==Ki(t)},er=Bn,nr=tr,or=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ir=/^\w*$/;var rr=function(t,e){if(er(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!nr(t))||(ir.test(t)||!or.test(t)||null!=e&&t in Object(e))},sr=We;function ar(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(ar.Cache||sr),n}ar.Cache=sr;var lr=ar;var cr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dr=/\\(\\)?/g,ur=function(t){var e=lr(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(cr,(function(t,n,o,i){e.push(o?i.replace(dr,"$1"):n||t)})),e}));var hr=function(t,e){for(var n=-1,o=null==t?0:t.length,i=Array(o);++n<o;)i[n]=e(t[n],n,t);return i},pr=Bn,mr=tr,fr=Nt?Nt.prototype:void 0,gr=fr?fr.toString:void 0;var vr=function t(e){if("string"==typeof e)return e;if(pr(e))return hr(e,t)+"";if(mr(e))return gr?gr.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},br=vr;var yr=Bn,wr=rr,Cr=ur,Er=function(t){return null==t?"":br(t)};var xr=function(t,e){return yr(t)?t:wr(t,e)?[t]:Cr(Er(t))},Sr=tr;var Or=function(t){if("string"==typeof t||Sr(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},_r=So,Nr=xr,Ar=jo,jr=Ft,Pr=Or;var Tr=function(t,e,n,o){if(!jr(t))return t;for(var i=-1,r=(e=Nr(e,t)).length,s=r-1,a=t;null!=a&&++i<r;){var l=Pr(e[i]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(i!=s){var d=a[l];void 0===(c=o?o(d,l,a):void 0)&&(c=jr(d)?d:Ar(e[i+1])?[]:{})}_r(a,l,c),a=a[l]}return t};const Lr=et((function(t,e,n){return null==t?t:Tr(t,e,n)}));var Dr=xr,kr=Or;var $r=function(t,e){for(var n=0,o=(e=Dr(e,t)).length;null!=t&&n<o;)t=t[kr(e[n++])];return n&&n==o?t:void 0};const Ir=et((function(t,e,n){var o=null==t?void 0:$r(t,e);return void 0===o?n:o})),Mr=Lr,Rr=t=>Number.isInteger(Number(t)),Fr=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},Wr=(t,e,n)=>{const o=n.split("||"),i=Wi(e).map((e=>t.find((t=>{const n=o.find((e=>!!Ir(t,e)));return n&&Ir(t,n)===e})))).filter(Boolean).concat(t);return Wi(i)},Br=(t,e,n)=>{for(let o=0;o<t.length;o++)e.call(n,t[o],o)},zr=(t,e)=>{const n=[];return Br(t,((t,o)=>n.push(e(t,o)))),n},qr={},Ur=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Hr=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Xr={capitalize:Ur,safeAttrName:t=>{if(qr[t])return qr[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return qr[t]=e,e},forEach:Br,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:zr,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:Fr,isInt:Rr,get:Ir,orderObjectsBy:Wr,isIE:Hr},Vr={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=Vr.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<i?(t.style.height=s+"px",window.requestAnimationFrame(e)):(t.style.height="auto",n&&n(t))}()},slideUp:(t,e=250,n=!1)=>{const o=Vr.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"===Vr.getStyle(t,"display"))=>{n?Vr.slideDown(t,e):Vr.slideUp(t,e)}},Yr="no-transition",Gr={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},Zr=({src:t,...e},n=X)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=Jr.opts)?void 0:o.debug)||(null==(i=Jr.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},Jr={init:function(t){return this.opts={...Gr,...t},this},formeoSaved:t=>Zr(t,H),formeoUpdated:t=>Zr(t,X),formeoCleared:t=>Zr(t,"formeoCleared"),formeoOnRender:t=>Zr(t,V),formeoConditionUpdated:t=>Zr(t,"formeoConditionUpdated")},Kr=Gi((()=>{Jr.opts.onUpdate({timeStamp:window.performance.now(),type:X,detail:Md.formData})}),q);let Qr;document.addEventListener(X,Kr),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(V,(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.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},Jr.opts.confirmClearAll(t)})),document.addEventListener(H,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};Jr.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{Jr.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){Qr=Qr||window.requestAnimationFrame((()=>{Qr=!1;for(const t of Object.values(Ld.data))t.dom.classList.add(Yr),kd.dom.classList.add(Yr),kd.panels.nav.refresh(),t.refreshFieldPanels()}))}));var ts=We,es=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ns=function(t){return this.__data__.has(t)};function os(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ts;++e<n;)this.add(t[e])}os.prototype.add=os.prototype.push=es,os.prototype.has=ns;var is=os,rs=function(t,e){for(var n=-1,o=null==t?0:t.length;++n<o;)if(e(t[n],n,t))return!0;return!1},ss=function(t,e){return t.has(e)};var as=function(t,e,n,o,i,r){var s=1&n,a=t.length,l=e.length;if(a!=l&&!(s&&l>a))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 is:void 0;for(r.set(t,e),r.set(e,t);++u<a;){var m=t[u],f=e[u];if(o)var g=s?o(f,m,u,e,t,r):o(m,f,u,t,e,r);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!rs(e,(function(t,e){if(!ss(p,e)&&(m===t||i(m,t,n,o,r)))return p.push(e)}))){h=!1;break}}else if(m!==f&&!i(m,f,n,o,r)){h=!1;break}}return r.delete(t),r.delete(e),h};var ls=gn,cs=ot,ds=as,us=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,o){n[++e]=[o,t]})),n},hs=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},ps=Nt?Nt.prototype:void 0,ms=ps?ps.valueOf:void 0;var fs=function(t,e,n,o,i,r,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!r(new ls(t),new ls(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return cs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=us;case"[object Set]":var l=1&o;if(a||(a=hs),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;o|=2,s.set(t,e);var d=ds(a(t),a(e),o,i,r,s);return s.delete(t),d;case"[object Symbol]":if(ms)return ms.call(t)==ms.call(e)}return!1};var gs=function(t,e){for(var n=-1,o=e.length,i=t.length;++n<o;)t[i+n]=e[n];return t},vs=Bn;var bs=function(t,e,n){var o=e(t);return vs(t)?o:gs(o,n(t))};var ys=function(t,e){for(var n=-1,o=null==t?0:t.length,i=0,r=[];++n<o;){var s=t[n];e(s,n,t)&&(r[i++]=s)}return r},ws=function(){return[]},Cs=Object.prototype.propertyIsEnumerable,Es=Object.getOwnPropertySymbols,xs=Es?function(t){return null==t?[]:(t=Object(t),ys(Es(t),(function(e){return Cs.call(t,e)})))}:ws,Ss=Sn(Object.keys,Object),Os=Nn,_s=Ss,Ns=Object.prototype.hasOwnProperty;var As=Mo,js=function(t){if(!Os(t))return _s(t);var e=[];for(var n in Object(t))Ns.call(t,n)&&"constructor"!=n&&e.push(n);return e},Ps=Hn;var Ts=bs,Ls=xs,Ds=function(t){return Ps(t)?As(t):js(t)};var ks=function(t){return Ts(t,Ds,Ls)},$s=Object.prototype.hasOwnProperty;var Is=function(t,e,n,o,i,r){var s=1&n,a=ks(t),l=a.length;if(l!=ks(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:$s.call(e,d)))return!1}var u=r.get(t),h=r.get(e);if(u&&h)return u==e&&h==t;var p=!0;r.set(t,e),r.set(e,t);for(var m=s;++c<l;){var f=t[d=a[c]],g=e[d];if(o)var v=s?o(g,f,d,e,t,r):o(f,g,d,t,e,r);if(!(void 0===v?f===g||i(f,g,n,o,r):v)){p=!1;break}m||(m="constructor"==d)}if(p&&!m){var b=t.constructor,y=e.constructor;b==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(p=!1)}return r.delete(t),r.delete(e),p},Ms=ae(_t,"DataView"),Rs=le,Fs=ae(_t,"Promise"),Ws=ae(_t,"Set"),Bs=ae(_t,"WeakMap"),zs=Rt,qs=Yt,Us="[object Map]",Hs="[object Promise]",Xs="[object Set]",Vs="[object WeakMap]",Ys="[object DataView]",Gs=qs(Ms),Zs=qs(Rs),Js=qs(Fs),Ks=qs(Ws),Qs=qs(Bs),ta=zs;(Ms&&ta(new Ms(new ArrayBuffer(1)))!=Ys||Rs&&ta(new Rs)!=Us||Fs&&ta(Fs.resolve())!=Hs||Ws&&ta(new Ws)!=Xs||Bs&&ta(new Bs)!=Vs)&&(ta=function(t){var e=zs(t),n="[object Object]"==e?t.constructor:void 0,o=n?qs(n):"";if(o)switch(o){case Gs:return Ys;case Zs:return Us;case Js:return Hs;case Ks:return Xs;case Qs:return Vs}return e});var ea=Je,na=as,oa=fs,ia=Is,ra=ta,sa=Bn,aa=Jn,la=yo,ca="[object Arguments]",da="[object Array]",ua="[object Object]",ha=Object.prototype.hasOwnProperty;var pa=function(t,e,n,o,i,r){var s=sa(t),a=sa(e),l=s?da:ra(t),c=a?da:ra(e),d=(l=l==ca?ua:l)==ua,u=(c=c==ca?ua:c)==ua,h=l==c;if(h&&aa(t)){if(!aa(e))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new ea),s||la(t)?na(t,e,n,o,i,r):oa(t,e,l,n,o,i,r);if(!(1&n)){var p=d&&ha.call(t,"__wrapped__"),m=u&&ha.call(e,"__wrapped__");if(p||m){var f=p?t.value():t,g=m?e.value():e;return r||(r=new ea),i(f,g,n,o,r)}}return!!h&&(r||(r=new ea),ia(t,e,n,o,i,r))},ma=Ln;var fa=function t(e,n,o,i,r){return e===n||(null==e||null==n||!ma(e)&&!ma(n)?e!=e&&n!=n:pa(e,n,o,i,t,r))},ga=fa;const va=et((function(t,e){return ga(t,e)}));class ba{constructor(t,n=Object.create(null)){e(this,"toJSON",((t,e)=>JSON.stringify(t,null,e))),e(this,"get",(t=>Ir(this.data,t))),e(this,"getChangeType",((t,e)=>{const n=F.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||Bi();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):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=Ir(this.data,t);if(va(n,e))return this.data;const o=Mr(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),Jr.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)}}
|
|
8
|
+
"use strict";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);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={extension:".lang",location:"assets/lang/",langs:["en-US"],locale:"en-US",override:{}};class o{constructor(t=n){this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}processConfig(t){const{location:e,...o}={...n,...t},i=e.replace(/\/?$/,"/");this.config={location:i,...o};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?o.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 o.fromFile(t.replace(/\n\n/g,"\n"))}static fromFile(t){const e=t.split("\n"),n={};for(let o,i=0;i<e.length;i++){o=/^(.+?) *?= *?([^\n]+)/.exec(e[i]),o&&(n[o[1]]=o[2].replace(/(^\s+|\s+$)/g,""))}return n}loadLang(t,e=!0){const n=this;return new Promise((function(i,r){if(-1!==n.loaded.indexOf(t)&&e)return n.applyLanguage(n.langs[t]),i(n.langs[t]);return async function(t){try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const n=t.endsWith(".lang")?"text":"json";return await e[n]()}catch(e){throw e}}([n.config.location,t,n.config.extension].join("")).then((e=>{const r=o.processFile(e);return n.applyLanguage(t,r),n.loaded.push(t),i(n.langs[t])})).catch((e=>{const o=n.applyLanguage(t);i(o)}))}))}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 i=new o;!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 r=Object.defineProperty,s=(t,e,n)=>((t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const a="_3x4ZIcu-",l="JIt36hCJ",c={triggerName:"tooltip"};class d{constructor(t=c){s(this,"triggerName"),s(this,"tooltip"),s(this,"activeTriggerType",null),s(this,"spacing",12),s(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()})),s(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")}})),s(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()})),s(this,"handleResize",(()=>{this.isVisible()&&this.hide()})),s(this,"handleScroll",(()=>{this.isVisible()&&this.hide()})),this.triggerName=`data-${t.triggerName}`,this.tooltip=document.createElement("div"),this.tooltip.className=`d-tooltip ${a}`,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(l)}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(a)||"none"===getComputedStyle(t).pointerEvents)return!1})).length}show(t,e){this.tooltip.innerHTML=e??"",this.tooltip.classList.add(l);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(l),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=d);const h="formeo",u="3.0.1",p="formeo-sprite",f=[{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"}],m=`https://cdn.jsdelivr.net/npm/formeo@${u}/dist/${p}.svg`,g=`https://draggable.github.io/formeo/assets/img/${p}.svg`,v=`https://cdn.jsdelivr.net/npm/formeo@${u}/dist/formeo.min.css`,b="control-group",y=`${h}-stage`,w=`${h}-row`,C=`${h}-column`,E=`${h}-field`,x="custom-column-widths",S="column-preset",O="resizing-columns",_=new Map([[y,w],[w,C],[C,E]]),N=["external","stages","rows","columns","fields"],A=["stage","row","column","field"].reduce(((t,e)=>({...t,[e]:e})),{}),j=[{name:"controls",className:b},{name:"stage",className:y},{name:"row",className:w},{name:"column",className:C},{name:"field",className:E}],P={controls:b,stage:y,row:w,column:C,field:E},T=Object.entries(P).reduce(((t,[e,n])=>({...t,[n]:e})),{}),L=Object.values(P),D=new RegExp(`${L.join("|")}`,"g"),k=j.map((({name:t},e,n)=>{const{name:o}=n[e+1]||{};return o&&[t,o]})).filter(Boolean),$=k.slice().map((t=>t.slice().reverse())).reverse(),I=new Map(k),M=new Map($.slice()),R=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)),[])),F=[{type:"added",condition:(t,e)=>Boolean(void 0===t&&e)}],W=`${h}-formData`,B=`${h}-locale`,z=333,q=Math.round(166.5),U=Math.round(666),H="formeoSaved",X="formeoUpdated",V="formeoOnRender",Y=["label","logical","source","thenTarget","sourceProperty","comparison","target","targetProperty","assignment","value"],G={value:"attrs.value",checked:"attrs.checked",isVisible:"config.isVisible",isNotVisible:"config.isNotVisible"},Z={comparison:{equals:"==",notEquals:"!=",contains:"⊃",notContains:"!⊃"},assignment:{equals:"="},logical:{and:"&&",or:"||"},property:G},J=/(\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,K=/\bcol-\w+-\d+/g,Q="f-i-";var tt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function et(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nt=function(){this.__data__=[],this.size=0};var ot=function(t,e){return t===e||t!=t&&e!=e},it=ot;var rt=function(t,e){for(var n=t.length;n--;)if(it(t[n][0],e))return n;return-1},st=rt,at=Array.prototype.splice;var lt=rt;var ct=rt;var dt=rt;var ht=nt,ut=function(t){var e=this.__data__,n=st(e,t);return!(n<0)&&(n==e.length-1?e.pop():at.call(e,n,1),--this.size,!0)},pt=function(t){var e=this.__data__,n=lt(e,t);return n<0?void 0:e[n][1]},ft=function(t){return ct(this.__data__,t)>-1},mt=function(t,e){var n=this.__data__,o=dt(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};function gt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}gt.prototype.clear=ht,gt.prototype.delete=ut,gt.prototype.get=pt,gt.prototype.has=ft,gt.prototype.set=mt;var vt=gt,bt=vt;var yt=function(){this.__data__=new bt,this.size=0};var wt=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var Ct=function(t){return this.__data__.get(t)};var Et=function(t){return this.__data__.has(t)},xt="object"==typeof tt&&tt&&tt.Object===Object&&tt,St=xt,Ot="object"==typeof self&&self&&self.Object===Object&&self,_t=St||Ot||Function("return this")(),Nt=_t.Symbol,At=Nt,jt=Object.prototype,Pt=jt.hasOwnProperty,Tt=jt.toString,Lt=At?At.toStringTag:void 0;var Dt=function(t){var e=Pt.call(t,Lt),n=t[Lt];try{t[Lt]=void 0;var o=!0}catch(r){}var i=Tt.call(t);return o&&(e?t[Lt]=n:delete t[Lt]),i},kt=Object.prototype.toString;var $t=Dt,It=function(t){return kt.call(t)},Mt=Nt?Nt.toStringTag:void 0;var Rt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Mt&&Mt in Object(t)?$t(t):It(t)};var Ft=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Wt=Rt,Bt=Ft;var zt,qt=function(t){if(!Bt(t))return!1;var e=Wt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Ut=_t["__core-js_shared__"],Ht=(zt=/[^.]+$/.exec(Ut&&Ut.keys&&Ut.keys.IE_PROTO||""))?"Symbol(src)_1."+zt:"";var Xt=function(t){return!!Ht&&Ht in t},Vt=Function.prototype.toString;var Yt=function(t){if(null!=t){try{return Vt.call(t)}catch(e){}try{return t+""}catch(e){}}return""},Gt=qt,Zt=Xt,Jt=Ft,Kt=Yt,Qt=/^\[object .+?Constructor\]$/,te=Function.prototype,ee=Object.prototype,ne=te.toString,oe=ee.hasOwnProperty,ie=RegExp("^"+ne.call(oe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var re=function(t){return!(!Jt(t)||Zt(t))&&(Gt(t)?ie:Qt).test(Kt(t))},se=function(t,e){return null==t?void 0:t[e]};var ae=function(t,e){var n=se(t,e);return re(n)?n:void 0},le=ae(_t,"Map"),ce=ae(Object,"create"),de=ce;var he=function(){this.__data__=de?de(null):{},this.size=0};var ue=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},pe=ce,fe=Object.prototype.hasOwnProperty;var me=function(t){var e=this.__data__;if(pe){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return fe.call(e,t)?e[t]:void 0},ge=ce,ve=Object.prototype.hasOwnProperty;var be=ce;var ye=he,we=ue,Ce=me,Ee=function(t){var e=this.__data__;return ge?void 0!==e[t]:ve.call(e,t)},xe=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=be&&void 0===e?"__lodash_hash_undefined__":e,this};function Se(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}Se.prototype.clear=ye,Se.prototype.delete=we,Se.prototype.get=Ce,Se.prototype.has=Ee,Se.prototype.set=xe;var Oe=Se,_e=vt,Ne=le;var Ae=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var je=function(t,e){var n=t.__data__;return Ae(e)?n["string"==typeof e?"string":"hash"]:n.map},Pe=je;var Te=je;var Le=je;var De=je;var ke=function(){this.size=0,this.__data__={hash:new Oe,map:new(Ne||_e),string:new Oe}},$e=function(t){var e=Pe(this,t).delete(t);return this.size-=e?1:0,e},Ie=function(t){return Te(this,t).get(t)},Me=function(t){return Le(this,t).has(t)},Re=function(t,e){var n=De(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this};function Fe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}Fe.prototype.clear=ke,Fe.prototype.delete=$e,Fe.prototype.get=Ie,Fe.prototype.has=Me,Fe.prototype.set=Re;var We=Fe,Be=vt,ze=le,qe=We;var Ue=vt,He=yt,Xe=wt,Ve=Ct,Ye=Et,Ge=function(t,e){var n=this.__data__;if(n instanceof Be){var o=n.__data__;if(!ze||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new qe(o)}return n.set(t,e),this.size=n.size,this};function Ze(t){var e=this.__data__=new Ue(t);this.size=e.size}Ze.prototype.clear=He,Ze.prototype.delete=Xe,Ze.prototype.get=Ve,Ze.prototype.has=Ye,Ze.prototype.set=Ge;var Je=Ze,Ke=ae,Qe=function(){try{var t=Ke(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),tn=Qe;var en=function(t,e,n){"__proto__"==e&&tn?tn(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},nn=en,on=ot;var rn=function(t,e,n){(void 0!==n&&!on(t[e],n)||void 0===n&&!(e in t))&&nn(t,e,n)};var sn,an,ln,cn,dn,hn,un,pn=function(t){return function(e,n,o){for(var i=-1,r=Object(e),s=o(e),a=s.length;a--;){var l=s[t?a:++i];if(!1===n(r[l],l,r))break}return e}}(),fn={exports:{}};sn=fn,ln=_t,cn=(an=fn.exports)&&!an.nodeType&&an,dn=cn&&sn&&!sn.nodeType&&sn,hn=dn&&dn.exports===cn?ln.Buffer:void 0,un=hn?hn.allocUnsafe:void 0,sn.exports=function(t,e){if(e)return t.slice();var n=t.length,o=un?un(n):new t.constructor(n);return t.copy(o),o};var mn=fn.exports,gn=_t.Uint8Array,vn=gn;var bn=function(t){var e=new t.constructor(t.byteLength);return new vn(e).set(new vn(t)),e};var yn=function(t,e){var n=e?bn(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var wn=function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e},Cn=Ft,En=Object.create,xn=function(){function t(){}return function(e){if(!Cn(e))return{};if(En)return En(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Sn=function(t,e){return function(n){return t(e(n))}},On=Sn(Object.getPrototypeOf,Object),_n=Object.prototype;var Nn=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_n)},An=xn,jn=On,Pn=Nn;var Tn=function(t){return"function"!=typeof t.constructor||Pn(t)?{}:An(jn(t))};var Ln=function(t){return null!=t&&"object"==typeof t},Dn=Rt,kn=Ln;var $n=function(t){return kn(t)&&"[object Arguments]"==Dn(t)},In=Ln,Mn=Object.prototype,Rn=Mn.hasOwnProperty,Fn=Mn.propertyIsEnumerable,Wn=$n(function(){return arguments}())?$n:function(t){return In(t)&&Rn.call(t,"callee")&&!Fn.call(t,"callee")},Bn=Array.isArray;var zn=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},qn=qt,Un=zn;var Hn=function(t){return null!=t&&Un(t.length)&&!qn(t)},Xn=Hn,Vn=Ln;var Yn=function(t){return Vn(t)&&Xn(t)},Gn={exports:{}};var Zn=function(){return!1};!function(t,e){var n=_t,o=Zn,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}(Gn,Gn.exports);var Jn=Gn.exports,Kn=Rt,Qn=On,to=Ln,eo=Function.prototype,no=Object.prototype,oo=eo.toString,io=no.hasOwnProperty,ro=oo.call(Object);var so=function(t){if(!to(t)||"[object Object]"!=Kn(t))return!1;var e=Qn(t);if(null===e)return!0;var n=io.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&oo.call(n)==ro},ao=Rt,lo=zn,co=Ln,ho={};ho["[object Float32Array]"]=ho["[object Float64Array]"]=ho["[object Int8Array]"]=ho["[object Int16Array]"]=ho["[object Int32Array]"]=ho["[object Uint8Array]"]=ho["[object Uint8ClampedArray]"]=ho["[object Uint16Array]"]=ho["[object Uint32Array]"]=!0,ho["[object Arguments]"]=ho["[object Array]"]=ho["[object ArrayBuffer]"]=ho["[object Boolean]"]=ho["[object DataView]"]=ho["[object Date]"]=ho["[object Error]"]=ho["[object Function]"]=ho["[object Map]"]=ho["[object Number]"]=ho["[object Object]"]=ho["[object RegExp]"]=ho["[object Set]"]=ho["[object String]"]=ho["[object WeakMap]"]=!1;var uo=function(t){return co(t)&&lo(t.length)&&!!ho[ao(t)]};var po=function(t){return function(e){return t(e)}},fo={exports:{}};!function(t,e){var n=xt,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}(fo,fo.exports);var mo=fo.exports,go=uo,vo=po,bo=mo&&mo.isTypedArray,yo=bo?vo(bo):go;var wo=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Co=en,Eo=ot,xo=Object.prototype.hasOwnProperty;var So=function(t,e,n){var o=t[e];xo.call(t,e)&&Eo(o,n)&&(void 0!==n||e in t)||Co(t,e,n)},Oo=So,_o=en;var No=function(t,e,n,o){var i=!n;n||(n={});for(var r=-1,s=e.length;++r<s;){var a=e[r],l=o?o(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),i?_o(n,a,l):Oo(n,a,l)}return n};var Ao=/^(?:0|[1-9]\d*)$/;var jo=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Ao.test(t))&&t>-1&&t%1==0&&t<e},Po=function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o},To=Wn,Lo=Bn,Do=Jn,ko=jo,$o=yo,Io=Object.prototype.hasOwnProperty;var Mo=function(t,e){var n=Lo(t),o=!n&&To(t),i=!n&&!o&&Do(t),r=!n&&!o&&!i&&$o(t),s=n||o||i||r,a=s?Po(t.length,String):[],l=a.length;for(var c in t)!e&&!Io.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ko(c,l))||a.push(c);return a};var Ro=Ft,Fo=Nn,Wo=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Bo=Object.prototype.hasOwnProperty;var zo=Mo,qo=function(t){if(!Ro(t))return Wo(t);var e=Fo(t),n=[];for(var o in t)("constructor"!=o||!e&&Bo.call(t,o))&&n.push(o);return n},Uo=Hn;var Ho=function(t){return Uo(t)?zo(t,!0):qo(t)},Xo=No,Vo=Ho;var Yo=rn,Go=mn,Zo=yn,Jo=wn,Ko=Tn,Qo=Wn,ti=Bn,ei=Yn,ni=Jn,oi=qt,ii=Ft,ri=so,si=yo,ai=wo,li=function(t){return Xo(t,Vo(t))};var ci=Je,di=rn,hi=pn,ui=function(t,e,n,o,i,r,s){var a=ai(t,n),l=ai(e,n),c=s.get(l);if(c)Yo(t,n,c);else{var d=r?r(a,l,n+"",t,e,s):void 0,h=void 0===d;if(h){var u=ti(l),p=!u&&ni(l),f=!u&&!p&&si(l);d=l,u||p||f?ti(a)?d=a:ei(a)?d=Jo(a):p?(h=!1,d=Go(l,!0)):f?(h=!1,d=Zo(l,!0)):d=[]:ri(l)||Qo(l)?(d=a,Qo(a)?d=li(a):ii(a)&&!oi(a)||(d=Ko(l))):h=!1}h&&(s.set(l,d),i(d,l,o,r,s),s.delete(l)),Yo(t,n,d)}},pi=Ft,fi=Ho,mi=wo;var gi=function t(e,n,o,i,r){e!==n&&hi(n,(function(s,a){if(r||(r=new ci),pi(s))ui(e,n,a,o,t,i,r);else{var l=i?i(mi(e,a),s,a+"",e,n,r):void 0;void 0===l&&(l=s),di(e,a,l)}}),fi)};var vi=function(t){return t};var bi=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},yi=Math.max;var wi=function(t,e,n){return e=yi(void 0===e?t.length-1:e,0),function(){for(var o=arguments,i=-1,r=yi(o.length-e,0),s=Array(r);++i<r;)s[i]=o[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=o[i];return a[e]=n(s),bi(t,this,a)}};var Ci=function(t){return function(){return t}},Ei=Qe,xi=Ei?function(t,e){return Ei(t,"toString",{configurable:!0,enumerable:!1,value:Ci(e),writable:!0})}:vi,Si=Date.now;var Oi=function(t){var e=0,n=0;return function(){var o=Si(),i=16-(o-n);if(n=o,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(xi),_i=vi,Ni=wi,Ai=Oi;var ji=ot,Pi=Hn,Ti=jo,Li=Ft;var Di=function(t,e){return Ai(Ni(t,e,_i),t+"")},ki=function(t,e,n){if(!Li(n))return!1;var o=typeof e;return!!("number"==o?Pi(n)&&Ti(e,n.length):"string"==o&&e in n)&&ji(n[e],t)};var $i=gi;const Ii=et(function(t){return Di((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&&ki(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++o<i;){var a=n[o];a&&t(e,a,o,r)}return e}))}((function(t,e,n,o){$i(t,e,n,o)}))),Mi=()=>crypto.randomUUID(),Ri=(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},Fi=t=>{var e;const n=null==(e=t.className)?void 0:e.match(D);return n&&T[n[0]]},Wi=t=>Array.from(new Set(t)),Bi=t=>{let e;if(t){const{attrs:n={}}=t;e=n.id||t.id||Mi(),t.id=e}else e=Mi();return e},zi=(t,e)=>Ii({},t,e,((t,e)=>Array.isArray(t)?null!=e?Wi(t.concat(e)):e:Array.isArray(e)?null!=t?Wi(e.concat(t)):e:void 0)),qi=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;n<o;n++)e[n]=qi(t[n]);return e}if(t instanceof Object){e={};for(const n in t)Object.hasOwn(t,n)&&(e[n]=qi(t[n]));return e}throw new Error("Unable to copy Object, type not supported.")},Ui=(t,e)=>t/e*100,Hi=t=>`${t.toString()}%`,Xi=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){}}}}),Vi=t=>N.some((e=>new RegExp(`^${e}.`).test(t))),Yi=t=>t.startsWith("external");function Gi(t,e=U){let n=0;return function(...o){const i=Date.now();i-n>=e&&(n=i,t.apply(this,o))}}function Zi(t){return t}function Ji(){}var Ki=Rt,Qi=Ln;var tr=function(t){return"symbol"==typeof t||Qi(t)&&"[object Symbol]"==Ki(t)},er=Bn,nr=tr,or=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ir=/^\w*$/;var rr=function(t,e){if(er(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!nr(t))||(ir.test(t)||!or.test(t)||null!=e&&t in Object(e))},sr=We;function ar(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(ar.Cache||sr),n}ar.Cache=sr;var lr=ar;var cr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dr=/\\(\\)?/g,hr=function(t){var e=lr(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(cr,(function(t,n,o,i){e.push(o?i.replace(dr,"$1"):n||t)})),e}));var ur=function(t,e){for(var n=-1,o=null==t?0:t.length,i=Array(o);++n<o;)i[n]=e(t[n],n,t);return i},pr=Bn,fr=tr,mr=Nt?Nt.prototype:void 0,gr=mr?mr.toString:void 0;var vr=function t(e){if("string"==typeof e)return e;if(pr(e))return ur(e,t)+"";if(fr(e))return gr?gr.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},br=vr;var yr=Bn,wr=rr,Cr=hr,Er=function(t){return null==t?"":br(t)};var xr=function(t,e){return yr(t)?t:wr(t,e)?[t]:Cr(Er(t))},Sr=tr;var Or=function(t){if("string"==typeof t||Sr(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},_r=So,Nr=xr,Ar=jo,jr=Ft,Pr=Or;var Tr=function(t,e,n,o){if(!jr(t))return t;for(var i=-1,r=(e=Nr(e,t)).length,s=r-1,a=t;null!=a&&++i<r;){var l=Pr(e[i]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(i!=s){var d=a[l];void 0===(c=o?o(d,l,a):void 0)&&(c=jr(d)?d:Ar(e[i+1])?[]:{})}_r(a,l,c),a=a[l]}return t};const Lr=et((function(t,e,n){return null==t?t:Tr(t,e,n)}));var Dr=xr,kr=Or;var $r=function(t,e){for(var n=0,o=(e=Dr(e,t)).length;null!=t&&n<o;)t=t[kr(e[n++])];return n&&n==o?t:void 0};const Ir=et((function(t,e,n){var o=null==t?void 0:$r(t,e);return void 0===o?n:o})),Mr=Lr,Rr=t=>Number.isInteger(Number(t)),Fr=(t,e)=>{const n=e||t.parentElement;return Array.prototype.slice.call(n.childNodes).indexOf(t)},Wr=(t,e,n)=>{const o=n.split("||"),i=Wi(e).map((e=>t.find((t=>{const n=o.find((e=>!!Ir(t,e)));return n&&Ir(t,n)===e})))).filter(Boolean).concat(t);return Wi(i)},Br=(t,e,n)=>{for(let o=0;o<t.length;o++)e.call(n,t[o],o)},zr=(t,e)=>{const n=[];return Br(t,((t,o)=>n.push(e(t,o)))),n},qr={},Ur=t=>t.replace(/\b\w/g,(t=>t.toUpperCase())),Hr=()=>-1!==window.navigator.userAgent.indexOf("MSIE "),Xr={capitalize:Ur,safeAttrName:t=>{if(qr[t])return qr[t];const e=({className:"class"}[t]||t).replace(/^\d+/,"").replace(/[^a-zA-Z0-9-:]/g,"");return qr[t]=e,e},forEach:Br,copyObj:t=>window.JSON.parse(window.JSON.stringify(t)),map:zr,subtract:(t,e)=>e.filter((e=>!~t.indexOf(e))),indexOfNode:Fr,isInt:Rr,get:Ir,orderObjectsBy:Wr,isIE:Hr},Vr={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=Vr.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<i?(t.style.height=s+"px",window.requestAnimationFrame(e)):(t.style.height="auto",n&&n(t))}()},slideUp:(t,e=250,n=!1)=>{const o=Vr.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"===Vr.getStyle(t,"display"))=>{n?Vr.slideDown(t,e):Vr.slideUp(t,e)}},Yr="no-transition",Gr={debug:!1,bubbles:!0,formeoLoaded:t=>{},onAdd:()=>{},onUpdate:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onUpdateStage:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onUpdateRow:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onUpdateColumn:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onUpdateField:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onRender:t=>{var e;return(null==(e=Jr.opts)?void 0:e.debug)&&void 0},onSave:t=>{},confirmClearAll:t=>{window.confirm(t.confirmationMessage)&&t.clearAllAction(t)}},Zr=({src:t,...e},n=X)=>{var o,i;const r=new window.CustomEvent(n,{detail:e,bubbles:(null==(o=Jr.opts)?void 0:o.debug)||(null==(i=Jr.opts)?void 0:i.bubbles)});return r.data=(t||document).dispatchEvent(r),r},Jr={init:function(t){return this.opts={...Gr,...t},this},formeoSaved:t=>Zr(t,H),formeoUpdated:t=>Zr(t,X),formeoCleared:t=>Zr(t,"formeoCleared"),formeoOnRender:t=>Zr(t,V),formeoConditionUpdated:t=>Zr(t,"formeoConditionUpdated")},Kr=Gi((()=>{Jr.opts.onUpdate({timeStamp:window.performance.now(),type:X,detail:$d.formData})}),q);let Qr;document.addEventListener(X,Kr),document.addEventListener("formeoUpdatedStage",(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedRow",(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedColumn",(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener("formeoUpdatedField",(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.opts.onUpdate({timeStamp:e,type:n,detail:o})})),document.addEventListener(V,(t=>{const{timeStamp:e,type:n,detail:o}=t;Jr.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},Jr.opts.confirmClearAll(t)})),document.addEventListener(H,(({timeStamp:t,type:e,detail:{formData:n}})=>{const o={timeStamp:t,type:e,formData:n};Jr.opts.onSave(o)})),document.addEventListener("formeoLoaded",(t=>{Jr.opts.formeoLoaded(t.detail.formeo)})),window.addEventListener("resize",(function(){Qr=Qr||window.requestAnimationFrame((()=>{Qr=!1;for(const t of Object.values(Pd.data))t.dom.classList.add(Yr),Ld.dom.classList.add(Yr),Ld.panels.nav.refresh(),t.refreshFieldPanels()}))}));var ts=We,es=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ns=function(t){return this.__data__.has(t)};function os(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ts;++e<n;)this.add(t[e])}os.prototype.add=os.prototype.push=es,os.prototype.has=ns;var is=os,rs=function(t,e){for(var n=-1,o=null==t?0:t.length;++n<o;)if(e(t[n],n,t))return!0;return!1},ss=function(t,e){return t.has(e)};var as=function(t,e,n,o,i,r){var s=1&n,a=t.length,l=e.length;if(a!=l&&!(s&&l>a))return!1;var c=r.get(t),d=r.get(e);if(c&&d)return c==e&&d==t;var h=-1,u=!0,p=2&n?new is:void 0;for(r.set(t,e),r.set(e,t);++h<a;){var f=t[h],m=e[h];if(o)var g=s?o(m,f,h,e,t,r):o(f,m,h,t,e,r);if(void 0!==g){if(g)continue;u=!1;break}if(p){if(!rs(e,(function(t,e){if(!ss(p,e)&&(f===t||i(f,t,n,o,r)))return p.push(e)}))){u=!1;break}}else if(f!==m&&!i(f,m,n,o,r)){u=!1;break}}return r.delete(t),r.delete(e),u};var ls=gn,cs=ot,ds=as,hs=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,o){n[++e]=[o,t]})),n},us=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},ps=Nt?Nt.prototype:void 0,fs=ps?ps.valueOf:void 0;var ms=function(t,e,n,o,i,r,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!r(new ls(t),new ls(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return cs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=hs;case"[object Set]":var l=1&o;if(a||(a=us),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;o|=2,s.set(t,e);var d=ds(a(t),a(e),o,i,r,s);return s.delete(t),d;case"[object Symbol]":if(fs)return fs.call(t)==fs.call(e)}return!1};var gs=function(t,e){for(var n=-1,o=e.length,i=t.length;++n<o;)t[i+n]=e[n];return t},vs=Bn;var bs=function(t,e,n){var o=e(t);return vs(t)?o:gs(o,n(t))};var ys=function(t,e){for(var n=-1,o=null==t?0:t.length,i=0,r=[];++n<o;){var s=t[n];e(s,n,t)&&(r[i++]=s)}return r},ws=function(){return[]},Cs=Object.prototype.propertyIsEnumerable,Es=Object.getOwnPropertySymbols,xs=Es?function(t){return null==t?[]:(t=Object(t),ys(Es(t),(function(e){return Cs.call(t,e)})))}:ws,Ss=Sn(Object.keys,Object),Os=Nn,_s=Ss,Ns=Object.prototype.hasOwnProperty;var As=Mo,js=function(t){if(!Os(t))return _s(t);var e=[];for(var n in Object(t))Ns.call(t,n)&&"constructor"!=n&&e.push(n);return e},Ps=Hn;var Ts=bs,Ls=xs,Ds=function(t){return Ps(t)?As(t):js(t)};var ks=function(t){return Ts(t,Ds,Ls)},$s=Object.prototype.hasOwnProperty;var Is=function(t,e,n,o,i,r){var s=1&n,a=ks(t),l=a.length;if(l!=ks(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:$s.call(e,d)))return!1}var h=r.get(t),u=r.get(e);if(h&&u)return h==e&&u==t;var p=!0;r.set(t,e),r.set(e,t);for(var f=s;++c<l;){var m=t[d=a[c]],g=e[d];if(o)var v=s?o(g,m,d,e,t,r):o(m,g,d,t,e,r);if(!(void 0===v?m===g||i(m,g,n,o,r):v)){p=!1;break}f||(f="constructor"==d)}if(p&&!f){var b=t.constructor,y=e.constructor;b==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(p=!1)}return r.delete(t),r.delete(e),p},Ms=ae(_t,"DataView"),Rs=le,Fs=ae(_t,"Promise"),Ws=ae(_t,"Set"),Bs=ae(_t,"WeakMap"),zs=Rt,qs=Yt,Us="[object Map]",Hs="[object Promise]",Xs="[object Set]",Vs="[object WeakMap]",Ys="[object DataView]",Gs=qs(Ms),Zs=qs(Rs),Js=qs(Fs),Ks=qs(Ws),Qs=qs(Bs),ta=zs;(Ms&&ta(new Ms(new ArrayBuffer(1)))!=Ys||Rs&&ta(new Rs)!=Us||Fs&&ta(Fs.resolve())!=Hs||Ws&&ta(new Ws)!=Xs||Bs&&ta(new Bs)!=Vs)&&(ta=function(t){var e=zs(t),n="[object Object]"==e?t.constructor:void 0,o=n?qs(n):"";if(o)switch(o){case Gs:return Ys;case Zs:return Us;case Js:return Hs;case Ks:return Xs;case Qs:return Vs}return e});var ea=Je,na=as,oa=ms,ia=Is,ra=ta,sa=Bn,aa=Jn,la=yo,ca="[object Arguments]",da="[object Array]",ha="[object Object]",ua=Object.prototype.hasOwnProperty;var pa=function(t,e,n,o,i,r){var s=sa(t),a=sa(e),l=s?da:ra(t),c=a?da:ra(e),d=(l=l==ca?ha:l)==ha,h=(c=c==ca?ha:c)==ha,u=l==c;if(u&&aa(t)){if(!aa(e))return!1;s=!0,d=!1}if(u&&!d)return r||(r=new ea),s||la(t)?na(t,e,n,o,i,r):oa(t,e,l,n,o,i,r);if(!(1&n)){var p=d&&ua.call(t,"__wrapped__"),f=h&&ua.call(e,"__wrapped__");if(p||f){var m=p?t.value():t,g=f?e.value():e;return r||(r=new ea),i(m,g,n,o,r)}}return!!u&&(r||(r=new ea),ia(t,e,n,o,i,r))},fa=Ln;var ma=function t(e,n,o,i,r){return e===n||(null==e||null==n||!fa(e)&&!fa(n)?e!=e&&n!=n:pa(e,n,o,i,t,r))},ga=ma;const va=et((function(t,e){return ga(t,e)}));class ba{constructor(t,n=Object.create(null)){e(this,"toJSON",((t,e)=>JSON.stringify(t,null,e))),e(this,"get",(t=>Ir(this.data,t))),e(this,"getChangeType",((t,e)=>{const n=F.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||Bi();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):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)),e(this,"parseformData",((t=Object.create(null))=>{if("string"==typeof t)try{return JSON.parse(t)}catch(e){return Object.create(null)}return t})),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=Ir(this.data,t);if(va(n,e))return this.data;const o=Mr(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),Jr.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)}}
|
|
9
9
|
/**!
|
|
10
10
|
* Sortable 1.15.3
|
|
11
11
|
* @author RubaXa <trash@rubaxa.org>
|
|
12
12
|
* @author owenm <owen23355@gmail.com>
|
|
13
13
|
* @license MIT
|
|
14
|
-
*/function ya(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 wa(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ya(Object(n),!0).forEach((function(e){Ea(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ya(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ca(t){return(Ca="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ea(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xa(){return xa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},xa.apply(this,arguments)}function Sa(t,e){if(null==t)return{};var n,o,i=function(t,e){if(null==t)return{};var n,o,i={},r=Object.keys(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Oa(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var _a=Oa(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Na=Oa(/Edge/i),Aa=Oa(/firefox/i),ja=Oa(/safari/i)&&!Oa(/chrome/i)&&!Oa(/android/i),Pa=Oa(/iP(ad|od|hone)/i),Ta=Oa(/chrome/i)&&Oa(/android/i),La={capture:!1,passive:!1};function Da(t,e,n){t.addEventListener(e,n,!_a&&La)}function ka(t,e,n){t.removeEventListener(e,n,!_a&&La)}function $a(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 Ia(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Ma(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&$a(t,e):$a(t,e))||o&&t===n)return t;if(t===n)break}while(t=Ia(t))}return null}var Ra,Fa=/\s+/g;function Wa(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Fa," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Fa," ")}}function Ba(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 za(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Ba(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 qa(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function Ua(){var t=document.scrollingElement;return t||document.documentElement}function Ha(t,e,n,o,i){if(t.getBoundingClientRect||t===window){var r,s,a,l,c,d,u;if(t!==window&&t.parentNode&&t!==Ua()?(s=(r=t.getBoundingClientRect()).top,a=r.left,l=r.bottom,c=r.right,d=r.height,u=r.width):(s=0,a=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!_a))do{if(i&&i.getBoundingClientRect&&("none"!==Ba(i,"transform")||n&&"static"!==Ba(i,"position"))){var h=i.getBoundingClientRect();s-=h.top+parseInt(Ba(i,"border-top-width")),a-=h.left+parseInt(Ba(i,"border-left-width")),l=s+r.height,c=a+r.width;break}}while(i=i.parentNode);if(o&&t!==window){var p=za(i||t),m=p&&p.a,f=p&&p.d;p&&(l=(s/=f)+(d/=f),c=(a/=m)+(u/=m))}return{top:s,left:a,bottom:l,right:c,width:u,height:d}}}function Xa(t,e,n){for(var o=Ja(t,!0),i=Ha(t)[e];o;){if(!(i>=Ha(o)[n]))return o;if(o===Ua())break;o=Ja(o,!1)}return!1}function Va(t,e,n,o){for(var i=0,r=0,s=t.children;r<s.length;){if("none"!==s[r].style.display&&s[r]!==ec.ghost&&(o||s[r]!==ec.dragged)&&Ma(s[r],n.draggable,t,!1)){if(i===e)return s[r];i++}r++}return null}function Ya(t,e){for(var n=t.lastElementChild;n&&(n===ec.ghost||"none"===Ba(n,"display")||e&&!$a(n,e));)n=n.previousElementSibling;return n||null}function Ga(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===ec.clone||e&&!$a(t,e)||n++;return n}function Za(t){var e=0,n=0,o=Ua();if(t)do{var i=za(t),r=i.a,s=i.d;e+=t.scrollLeft*r,n+=t.scrollTop*s}while(t!==o&&(t=t.parentNode));return[e,n]}function Ja(t,e){if(!t||!t.getBoundingClientRect)return Ua();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=Ba(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return Ua();if(o||e)return n;o=!0}}}while(n=n.parentNode);return Ua()}function Ka(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function Qa(t,e){return function(){if(!Ra){var n=arguments;1===n.length?t.call(this,n[0]):t.apply(this,n),Ra=setTimeout((function(){Ra=void 0}),e)}}}function tl(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function el(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}function nl(t,e,n){var o={};return Array.from(t.children).forEach((function(i){var r,s,a,l;if(Ma(i,e.draggable,t,!1)&&!i.animated&&i!==n){var c=Ha(i);o.left=Math.min(null!==(r=o.left)&&void 0!==r?r:1/0,c.left),o.top=Math.min(null!==(s=o.top)&&void 0!==s?s:1/0,c.top),o.right=Math.max(null!==(a=o.right)&&void 0!==a?a:-1/0,c.right),o.bottom=Math.max(null!==(l=o.bottom)&&void 0!==l?l:-1/0,c.bottom)}})),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var ol="Sortable"+(new Date).getTime();function il(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==Ba(t,"display")&&t!==ec.ghost){e.push({target:t,rect:Ha(t)});var n=wa({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=za(t,!0);o&&(n.top-=o.f,n.left-=o.e)}t.fromRect=n}}))},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(function(t,e){for(var n in t)if(t.hasOwnProperty(n))for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n);return-1}(e,{target:t}),1)},animateAll:function(n){var o=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof n&&n());var i=!1,r=0;e.forEach((function(t){var e=0,n=t.target,s=n.fromRect,a=Ha(n),l=n.prevFromRect,c=n.prevToRect,d=t.rect,u=za(n,!0);u&&(a.top-=u.f,a.left-=u.e),n.toRect=a,n.thisAnimationDuration&&Ka(l,a)&&!Ka(s,a)&&(d.top-a.top)/(d.left-a.left)==(s.top-a.top)/(s.left-a.left)&&(e=function(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}(d,l,c,o.options)),Ka(a,s)||(n.prevFromRect=s,n.prevToRect=a,e||(e=o.options.animation),o.animate(n,d,a,e)),e&&(i=!0,r=Math.max(r,e),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),e),n.thisAnimationDuration=e)})),clearTimeout(t),i?t=setTimeout((function(){"function"==typeof n&&n()}),r):"function"==typeof n&&n(),e=[]},animate:function(t,e,n,o){if(o){Ba(t,"transition",""),Ba(t,"transform","");var i=za(this.el),r=i&&i.a,s=i&&i.d,a=(e.left-n.left)/(r||1),l=(e.top-n.top)/(s||1);t.animatingX=!!a,t.animatingY=!!l,Ba(t,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),Ba(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),Ba(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){Ba(t,"transition",""),Ba(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}}var rl=[],sl={initializeByDefault:!0},al={mount:function(t){for(var e in sl)sl.hasOwnProperty(e)&&!(e in t)&&(t[e]=sl[e]);rl.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),rl.push(t)},pluginEvent:function(t,e,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var i=t+"Global";rl.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](wa({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](wa({sortable:e},n)))}))},initializePlugins:function(t,e,n,o){for(var i in rl.forEach((function(o){var i=o.pluginName;if(t.options[i]||o.initializeByDefault){var r=new o(t,e,t.options);r.sortable=t,r.options=t.options,t[i]=r,xa(n,r.defaults)}})),t.options)if(t.options.hasOwnProperty(i)){var r=this.modifyOption(t,i,t.options[i]);void 0!==r&&(t.options[i]=r)}},getEventProperties:function(t,e){var n={};return rl.forEach((function(o){"function"==typeof o.eventProperties&&xa(n,o.eventProperties.call(e[o.pluginName],t))})),n},modifyOption:function(t,e,n){var o;return rl.forEach((function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))})),o}};var ll=["evt"],cl=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Sa(n,ll);al.pluginEvent.bind(ec)(t,e,wa({dragEl:ul,parentEl:hl,ghostEl:pl,rootEl:ml,nextEl:fl,lastDownEl:gl,cloneEl:vl,cloneHidden:bl,dragStarted:Tl,putSortable:Sl,activeSortable:ec.active,originalEvent:o,oldIndex:yl,oldDraggableIndex:Cl,newIndex:wl,newDraggableIndex:El,hideGhostForTarget:Jl,unhideGhostForTarget:Kl,cloneNowHidden:function(){bl=!0},cloneNowShown:function(){bl=!1},dispatchSortableEvent:function(t){dl({sortable:e,name:t,originalEvent:o})}},i))};function dl(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,m=t.extraEventProperties;if(e=e||n&&n[ol]){var f,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||_a||Na?(f=document.createEvent("Event")).initEvent(o,!0,!0):f=new CustomEvent(o,{bubbles:!0,cancelable:!0}),f.to=s||n,f.from=a||n,f.item=i||n,f.clone=r,f.oldIndex=l,f.newIndex=c,f.oldDraggableIndex=d,f.newDraggableIndex=u,f.originalEvent=h,f.pullMode=p?p.lastPutMode:void 0;var b=wa(wa({},m),al.getEventProperties(o,e));for(var y in b)f[y]=b[y];n&&n.dispatchEvent(f),g[v]&&g[v].call(e,f)}}(wa({putSortable:Sl,cloneEl:vl,targetEl:ul,rootEl:ml,oldIndex:yl,oldDraggableIndex:Cl,newIndex:wl,newDraggableIndex:El},t))}var ul,hl,pl,ml,fl,gl,vl,bl,yl,wl,Cl,El,xl,Sl,Ol,_l,Nl,Al,jl,Pl,Tl,Ll,Dl,kl,$l,Il=!1,Ml=!1,Rl=[],Fl=!1,Wl=!1,Bl=[],zl=!1,ql=[],Ul="undefined"!=typeof document,Hl=Pa,Xl=Na||_a?"cssFloat":"float",Vl=Ul&&!Ta&&!Pa&&"draggable"in document.createElement("div"),Yl=function(){if(Ul){if(_a)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Gl=function(t,e){var n=Ba(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Va(t,0,e),r=Va(t,1,e),s=i&&Ba(i),a=r&&Ba(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ha(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ha(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[Xl]||r&&"none"===n[Xl]&&l+c>o)?"vertical":"horizontal"},Zl=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"==Ca(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},Jl=function(){!Yl&&pl&&Ba(pl,"display","none")},Kl=function(){!Yl&&pl&&Ba(pl,"display","")};Ul&&!Ta&&document.addEventListener("click",(function(t){if(Ml)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Ml=!1,!1}),!0);var Ql=function(t){if(ul){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,Rl.some((function(t){var e=t[ol].options.emptyInsertThreshold;if(e&&!Ya(t)){var n=Ha(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[ol]._onDragOver(n)}}var i,r,s},tc=function(t){ul&&ul.parentNode[ol]._isOutsideThisEl(t.target)};function ec(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=xa({},e),t[ol]=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 Gl(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!==ec.supportPointer&&"PointerEvent"in window&&!ja,emptyInsertThreshold:5};for(var o in al.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in Zl(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Vl,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Da(t,"pointerdown",this._onTapStart):(Da(t,"mousedown",this._onTapStart),Da(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Da(t,"dragover",this),Da(t,"dragenter",this)),Rl.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),xa(this,il())}function nc(t,e,n,o,i,r,s,a){var l,c,d=t[ol],u=d.options.onMove;return!window.CustomEvent||_a||Na?(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||Ha(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),u&&(c=u.call(d,l,s)),c}function oc(t){t.draggable=!1}function ic(){zl=!1}function rc(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 sc(t){return setTimeout(t,0)}function ac(t){return clearTimeout(t)}ec.prototype={constructor:ec,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Ll=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,ul):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){ql.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&ql.push(o)}}(n),!ul&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!ja||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=Ma(a,o.draggable,n,!1))&&a.animated||gl===a)){if(yl=Ga(a),Cl=Ga(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return dl({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),cl("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=Ma(l,o.trim(),n,!1))return dl({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),cl("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!Ma(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&&!ul&&n.parentNode===r){var l=Ha(n);if(ml=r,hl=(ul=n).parentNode,fl=ul.nextSibling,gl=n,xl=s.group,ec.dragged=ul,Ol={target:ul,clientX:(e||t).clientX,clientY:(e||t).clientY},jl=Ol.clientX-l.left,Pl=Ol.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,ul.style["will-change"]="all",o=function(){cl("delayEnded",i,{evt:t}),ec.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Aa&&i.nativeDraggable&&(ul.draggable=!0),i._triggerDragStart(t,e),dl({sortable:i,name:"choose",originalEvent:t}),Wa(ul,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){qa(ul,t.trim(),oc)})),Da(a,"dragover",Ql),Da(a,"mousemove",Ql),Da(a,"touchmove",Ql),Da(a,"mouseup",i._onDrop),Da(a,"touchend",i._onDrop),Da(a,"touchcancel",i._onDrop),Aa&&this.nativeDraggable&&(this.options.touchStartThreshold=4,ul.draggable=!0),cl("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Na||_a))o();else{if(ec.eventCanceled)return void this._onDrop();Da(a,"mouseup",i._disableDelayedDrag),Da(a,"touchend",i._disableDelayedDrag),Da(a,"touchcancel",i._disableDelayedDrag),Da(a,"mousemove",i._delayedDragTouchMoveHandler),Da(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Da(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(){ul&&oc(ul),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ka(t,"mouseup",this._disableDelayedDrag),ka(t,"touchend",this._disableDelayedDrag),ka(t,"touchcancel",this._disableDelayedDrag),ka(t,"mousemove",this._delayedDragTouchMoveHandler),ka(t,"touchmove",this._delayedDragTouchMoveHandler),ka(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Da(document,"pointermove",this._onTouchMove):Da(document,e?"touchmove":"mousemove",this._onTouchMove):(Da(ul,"dragend",this),Da(ml,"dragstart",this._onDragStart));try{document.selection?sc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(Il=!1,ml&&ul){cl("dragStarted",this,{evt:e}),this.nativeDraggable&&Da(document,"dragover",tc);var n=this.options;!t&&Wa(ul,n.dragClass,!1),Wa(ul,n.ghostClass,!0),ec.active=this,t&&this._appendGhost(),dl({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(_l){this._lastX=_l.clientX,this._lastY=_l.clientY,Jl();for(var t=document.elementFromPoint(_l.clientX,_l.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(_l.clientX,_l.clientY))!==e;)e=t;if(ul.parentNode[ol]._isOutsideThisEl(t),e)do{if(e[ol]){if(e[ol]._onDragOver({clientX:_l.clientX,clientY:_l.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=Ia(e));Kl()}},_onTouchMove:function(t){if(Ol){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=pl&&za(pl,!0),s=pl&&r&&r.a,a=pl&&r&&r.d,l=Hl&&$l&&Za($l),c=(i.clientX-Ol.clientX+o.x)/(s||1)+(l?l[0]-Bl[0]:0)/(s||1),d=(i.clientY-Ol.clientY+o.y)/(a||1)+(l?l[1]-Bl[1]:0)/(a||1);if(!ec.active&&!Il){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(pl){r?(r.e+=c-(Nl||0),r.f+=d-(Al||0)):r={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(r.a,",").concat(r.b,",").concat(r.c,",").concat(r.d,",").concat(r.e,",").concat(r.f,")");Ba(pl,"webkitTransform",u),Ba(pl,"mozTransform",u),Ba(pl,"msTransform",u),Ba(pl,"transform",u),Nl=c,Al=d,_l=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!pl){var t=this.options.fallbackOnBody?document.body:ml,e=Ha(ul,!0,Hl,!0,t),n=this.options;if(Hl){for($l=t;"static"===Ba($l,"position")&&"none"===Ba($l,"transform")&&$l!==document;)$l=$l.parentNode;$l!==document.body&&$l!==document.documentElement?($l===document&&($l=Ua()),e.top+=$l.scrollTop,e.left+=$l.scrollLeft):$l=Ua(),Bl=Za($l)}Wa(pl=ul.cloneNode(!0),n.ghostClass,!1),Wa(pl,n.fallbackClass,!0),Wa(pl,n.dragClass,!0),Ba(pl,"transition",""),Ba(pl,"transform",""),Ba(pl,"box-sizing","border-box"),Ba(pl,"margin",0),Ba(pl,"top",e.top),Ba(pl,"left",e.left),Ba(pl,"width",e.width),Ba(pl,"height",e.height),Ba(pl,"opacity","0.8"),Ba(pl,"position",Hl?"absolute":"fixed"),Ba(pl,"zIndex","100000"),Ba(pl,"pointerEvents","none"),ec.ghost=pl,t.appendChild(pl),Ba(pl,"transform-origin",jl/parseInt(pl.style.width)*100+"% "+Pl/parseInt(pl.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;cl("dragStart",this,{evt:t}),ec.eventCanceled?this._onDrop():(cl("setupClone",this),ec.eventCanceled||((vl=el(ul)).removeAttribute("id"),vl.draggable=!1,vl.style["will-change"]="",this._hideClone(),Wa(vl,this.options.chosenClass,!1),ec.clone=vl),n.cloneId=sc((function(){cl("clone",n),ec.eventCanceled||(n.options.removeCloneOnHide||ml.insertBefore(vl,ul),n._hideClone(),dl({sortable:n,name:"clone"}))})),!e&&Wa(ul,i.dragClass,!0),e?(Ml=!0,n._loopId=setInterval(n._emulateDragOver,50)):(ka(document,"mouseup",n._onDrop),ka(document,"touchend",n._onDrop),ka(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,ul)),Da(document,"drop",n),Ba(ul,"transform","translateZ(0)")),Il=!0,n._dragStartId=sc(n._dragStarted.bind(n,e,t)),Da(document,"selectstart",n),Tl=!0,ja&&Ba(document.body,"user-select","none"))},_onDragOver:function(t){var e,n,o,i,r=this.el,s=t.target,a=this.options,l=a.group,c=ec.active,d=xl===l,u=a.sort,h=Sl||c,p=this,m=!1;if(!zl){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),s=Ma(s,a.draggable,r,!0),j("dragOver"),ec.eventCanceled)return m;if(ul.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||p._ignoreWhileAnimating===s)return T(!1);if(Ml=!1,c&&!a.disabled&&(d?u||(o=hl!==ml):Sl===this||(this.lastPutMode=xl.checkPull(this,c,ul,t))&&l.checkPut(this,c,ul,t))){if(i="vertical"===this._getDirection(t,s),e=Ha(ul),j("dragOverValid"),ec.eventCanceled)return m;if(o)return hl=ml,P(),this._hideClone(),j("revert"),ec.eventCanceled||(fl?ml.insertBefore(ul,fl):ml.appendChild(ul)),T(!0);var f=Ya(r,a.draggable);if(!f||function(t,e,n){var o=Ha(Ya(n.el,n.options.draggable)),i=nl(n.el,n.options,pl),r=10;return e?t.clientX>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)&&!f.animated){if(f===ul)return T(!1);if(f&&r===t.target&&(s=f),s&&(n=Ha(s)),!1!==nc(ml,r,ul,e,s,n,t,!!s))return P(),f&&f.nextSibling?r.insertBefore(ul,f.nextSibling):r.appendChild(ul),hl=r,L(),T(!0)}else if(f&&function(t,e,n){var o=Ha(Va(n.el,0,n.options,!0)),i=nl(n.el,n.options,pl),r=10;return e?t.clientX<i.left-r||t.clientY<o.top&&t.clientX<o.right:t.clientY<i.top-r||t.clientY<o.bottom&&t.clientX<o.left}(t,i,this)){var g=Va(r,0,a,!0);if(g===ul)return T(!1);if(n=Ha(s=g),!1!==nc(ml,r,ul,e,s,n,t,!1))return P(),r.insertBefore(ul,g),hl=r,L(),T(!0)}else if(s.parentNode===r){n=Ha(s);var v,b,y,w=ul.parentNode!==r,C=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,s=n?e.left:e.top,a=n?e.right:e.bottom,l=n?e.width:e.height;return o===s||i===a||o+r/2===s+l/2}(ul.animated&&ul.toRect||e,s.animated&&s.toRect||n,i),E=i?"top":"left",x=Xa(s,"top","top")||Xa(ul,"top","top"),S=x?x.scrollTop:void 0;if(Ll!==s&&(b=n[E],Fl=!1,Wl=!C&&a.invertSwap||w),v=function(t,e,n,o,i,r,s,a){var l=o?t.clientY:t.clientX,c=o?n.height:n.width,d=o?n.top:n.left,u=o?n.bottom:n.right,h=!1;if(!s)if(a&&kl<c*i){if(!Fl&&(1===Dl?l>d+c*r/2:l<u-c*r/2)&&(Fl=!0),Fl)h=!0;else if(1===Dl?l<d+kl:l>u-kl)return-Dl}else if(l>d+c*(1-i)/2&&l<u-c*(1-i)/2)return function(t){return Ga(ul)<Ga(t)?1:-1}(e);if((h=h||s)&&(l<d+c*r/2||l>u-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,Wl,Ll===s),0!==v){var O=Ga(ul);do{O-=v,y=hl.children[O]}while(y&&("none"===Ba(y,"display")||y===pl))}if(0===v||y===s)return T(!1);Ll=s,Dl=v;var _=s.nextElementSibling,N=!1,A=nc(ml,r,ul,e,s,n,t,N=1===v);if(!1!==A)return 1!==A&&-1!==A||(N=1===A),zl=!0,setTimeout(ic,30),P(),N&&!_?r.appendChild(ul):s.parentNode.insertBefore(ul,N?_:s),x&&tl(x,0,S-x.scrollTop),hl=ul.parentNode,void 0===b||Wl||(kl=Math.abs(b-Ha(s)[E])),L(),T(!0)}if(r.contains(ul))return T(!1)}return!1}function j(a,l){cl(a,p,wa({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:u,fromSortable:h,target:s,completed:T,onMove:function(n,o){return nc(ml,r,ul,e,n,Ha(n),t,o)},changed:L},l))}function P(){j("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function T(e){return j("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(Wa(ul,Sl?Sl.options.ghostClass:c.options.ghostClass,!1),Wa(ul,a.ghostClass,!0)),Sl!==p&&p!==ec.active?Sl=p:p===ec.active&&Sl&&(Sl=null),h===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){j("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(s===ul&&!ul.animated||s===r&&!s.animated)&&(Ll=null),a.dragoverBubble||t.rootEl||s===document||(ul.parentNode[ol]._isOutsideThisEl(t.target),!e&&Ql(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),m=!0}function L(){wl=Ga(ul),El=Ga(ul,a.draggable),dl({sortable:p,name:"change",toEl:r,newIndex:wl,newDraggableIndex:El,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){ka(document,"mousemove",this._onTouchMove),ka(document,"touchmove",this._onTouchMove),ka(document,"pointermove",this._onTouchMove),ka(document,"dragover",Ql),ka(document,"mousemove",Ql),ka(document,"touchmove",Ql)},_offUpEvents:function(){var t=this.el.ownerDocument;ka(t,"mouseup",this._onDrop),ka(t,"touchend",this._onDrop),ka(t,"pointerup",this._onDrop),ka(t,"touchcancel",this._onDrop),ka(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;wl=Ga(ul),El=Ga(ul,n.draggable),cl("drop",this,{evt:t}),hl=ul&&ul.parentNode,wl=Ga(ul),El=Ga(ul,n.draggable),ec.eventCanceled||(Il=!1,Wl=!1,Fl=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),ac(this.cloneId),ac(this._dragStartId),this.nativeDraggable&&(ka(document,"drop",this),ka(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ja&&Ba(document.body,"user-select",""),Ba(ul,"transform",""),t&&(Tl&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),pl&&pl.parentNode&&pl.parentNode.removeChild(pl),(ml===hl||Sl&&"clone"!==Sl.lastPutMode)&&vl&&vl.parentNode&&vl.parentNode.removeChild(vl),ul&&(this.nativeDraggable&&ka(ul,"dragend",this),oc(ul),ul.style["will-change"]="",Tl&&!Il&&Wa(ul,Sl?Sl.options.ghostClass:this.options.ghostClass,!1),Wa(ul,this.options.chosenClass,!1),dl({sortable:this,name:"unchoose",toEl:hl,newIndex:null,newDraggableIndex:null,originalEvent:t}),ml!==hl?(wl>=0&&(dl({rootEl:hl,name:"add",toEl:hl,fromEl:ml,originalEvent:t}),dl({sortable:this,name:"remove",toEl:hl,originalEvent:t}),dl({rootEl:hl,name:"sort",toEl:hl,fromEl:ml,originalEvent:t}),dl({sortable:this,name:"sort",toEl:hl,originalEvent:t})),Sl&&Sl.save()):wl!==yl&&wl>=0&&(dl({sortable:this,name:"update",toEl:hl,originalEvent:t}),dl({sortable:this,name:"sort",toEl:hl,originalEvent:t})),ec.active&&(null!=wl&&-1!==wl||(wl=yl,El=Cl),dl({sortable:this,name:"end",toEl:hl,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){cl("nulling",this),ml=ul=hl=pl=fl=vl=gl=bl=Ol=_l=Tl=wl=El=yl=Cl=Ll=Dl=Sl=xl=ec.dragged=ec.ghost=ec.clone=ec.active=null,ql.forEach((function(t){t.checked=!0})),ql.length=Nl=Al=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":ul&&(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<i;o++)Ma(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||rc(t));return e},sort:function(t,e){var n={},o=this.el;this.toArray().forEach((function(t,e){var i=o.children[e];Ma(i,this.options.draggable,o,!1)&&(n[t]=i)}),this),e&&this.captureAnimationState(),t.forEach((function(t){n[t]&&(o.removeChild(n[t]),o.appendChild(n[t]))})),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return Ma(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(void 0===e)return n[t];var o=al.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&Zl(n)},destroy:function(){cl("destroy",this);var t=this.el;t[ol]=null,ka(t,"mousedown",this._onTapStart),ka(t,"touchstart",this._onTapStart),ka(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(ka(t,"dragover",this),ka(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),Rl.splice(Rl.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!bl){if(cl("hideClone",this),ec.eventCanceled)return;Ba(vl,"display","none"),this.options.removeCloneOnHide&&vl.parentNode&&vl.parentNode.removeChild(vl),bl=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(bl){if(cl("showClone",this),ec.eventCanceled)return;ul.parentNode!=ml||this.options.group.revertClone?fl?ml.insertBefore(vl,fl):ml.appendChild(vl):ml.insertBefore(vl,ul),this.options.group.revertClone&&this.animate(ul,vl),Ba(vl,"display",""),bl=!1}}else this._hideClone()}},Ul&&Da(document,"touchmove",(function(t){(ec.active||Il)&&t.cancelable&&t.preventDefault()})),ec.utils={on:Da,off:ka,css:Ba,find:qa,is:function(t,e){return!!Ma(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},throttle:Qa,closest:Ma,toggleClass:Wa,clone:el,index:Ga,nextTick:sc,cancelNextTick:ac,detectDirection:Gl,getChild:Va,expando:ol},ec.get=function(t){return t[ol]},ec.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach((function(t){if(!t.prototype||!t.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));t.utils&&(ec.utils=wa(wa({},ec.utils),t.utils)),al.mount(t)}))},ec.create=function(t,e){return new ec(t,e)},ec.version="1.15.3";var lc,cc,dc,uc,hc,pc,mc=[],fc=!1;function gc(){mc.forEach((function(t){clearInterval(t.pid)})),mc=[]}function vc(){clearInterval(pc)}var bc=Qa((function(t,e,n,o){if(e.scroll){var i,r=(t.touches?t.touches[0]:t).clientX,s=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,l=e.scrollSpeed,c=Ua(),d=!1;cc!==n&&(cc=n,gc(),lc=e.scroll,i=e.scrollFn,!0===lc&&(lc=Ja(n,!0)));var u=0,h=lc;do{var p=h,m=Ha(p),f=m.top,g=m.bottom,v=m.left,b=m.right,y=m.width,w=m.height,C=void 0,E=void 0,x=p.scrollWidth,S=p.scrollHeight,O=Ba(p),_=p.scrollLeft,N=p.scrollTop;p===c?(C=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX||"visible"===O.overflowX),E=w<S&&("auto"===O.overflowY||"scroll"===O.overflowY||"visible"===O.overflowY)):(C=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX),E=w<S&&("auto"===O.overflowY||"scroll"===O.overflowY));var A=C&&(Math.abs(b-r)<=a&&_+y<x)-(Math.abs(v-r)<=a&&!!_),j=E&&(Math.abs(g-s)<=a&&N+w<S)-(Math.abs(f-s)<=a&&!!N);if(!mc[u])for(var P=0;P<=u;P++)mc[P]||(mc[P]={});mc[u].vx==A&&mc[u].vy==j&&mc[u].el===p||(mc[u].el=p,mc[u].vx=A,mc[u].vy=j,clearInterval(mc[u].pid),0==A&&0==j||(d=!0,mc[u].pid=setInterval(function(){o&&0===this.layer&&ec.active._onTouchMove(hc);var e=mc[this.layer].vy?mc[this.layer].vy*l:0,n=mc[this.layer].vx?mc[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(ec.dragged.parentNode[ol],n,e,t,hc,mc[this.layer].el)||tl(mc[this.layer].el,n,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==c&&(h=Ja(h,!1)));fc=d}}),30),yc=function(t){var e=t.originalEvent,n=t.putSortable,o=t.dragEl,i=t.activeSortable,r=t.dispatchSortableEvent,s=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=n||i;s();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,d=document.elementFromPoint(c.clientX,c.clientY);a(),l&&!l.el.contains(d)&&(r("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function wc(){}function Cc(){}wc.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=Va(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(e,o):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:yc},xa(wc,{pluginName:"revertOnSpill"}),Cc.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:yc},xa(Cc,{pluginName:"removeOnSpill"}),ec.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?Da(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Da(document,"pointermove",this._handleFallbackAutoScroll):e.touches?Da(document,"touchmove",this._handleFallbackAutoScroll):Da(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?ka(document,"dragover",this._handleAutoScroll):(ka(document,"pointermove",this._handleFallbackAutoScroll),ka(document,"touchmove",this._handleFallbackAutoScroll),ka(document,"mousemove",this._handleFallbackAutoScroll)),vc(),gc(),clearTimeout(Ra),Ra=void 0},nulling:function(){hc=cc=lc=fc=pc=dc=uc=null,mc.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var n=this,o=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,r=document.elementFromPoint(o,i);if(hc=t,e||this.options.forceAutoScrollFallback||Na||_a||ja){bc(t,this.options,r,e);var s=Ja(r,!0);!fc||pc&&o===dc&&i===uc||(pc&&vc(),pc=setInterval((function(){var r=Ja(document.elementFromPoint(o,i),!0);r!==s&&(s=r,gc()),bc(t,n.options,r,e)}),10),dc=o,uc=i)}else{if(!this.options.bubbleScroll||Ja(r,!0)===Ua())return void gc();bc(t,this.options,Ja(r,!1),!1)}}},xa(t,{pluginName:"scroll",initializeByDefault:!0})}),ec.mount(Cc,wc);const Ec={add:{attr:t=>{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(i.get("attributeNotPermitted",e||"")),xc.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:Zi}},xc={init:function(t){const e=Object.keys(Ec);return this.opts=e.reduce(((e,n)=>(e[n]={...Ec[n],...t[n]},e)),t),this},add:{attrs:t=>xc.opts.add.attr(t),options:t=>xc.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},xc.opts.add.condition(t))},click:{btn:t=>xc.opts.click.btn(t)},save:{form:t=>(xc.opts.sessionStorage&&Xi.set(W,t),Jr.formeoSaved({formData:t}),xc.opts.save.form(t))}},Sc=Object.freeze({type:"field",displayType:"slider"}),Oc=t=>({transform:`translateX(${t?`${t}px`:0})`});class _c{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=Wd.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=zi(Sc,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)}),U)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(Wd.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Sc.displayType,this.panelDisplay}createPanelsWrap(){const t=Wd.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 Xr.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&ec.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=Fr(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",Wd.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:i.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:Wd.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:i.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:Wd.icon("triangle-left")};return Wd.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=Fr(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],Wd.removeClasses(i,"active-panel"),Wd.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=q,animate:r=!this.isTabbed})=>{const a=[Oc(s.panel),Oc(t.panel)],l=[Oc(s.nav),Oc(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=Wd.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 Nc="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`)),Ac=new RegExp(`(?!${Nc.join("|")})\\w\\S*`,"g"),jc=/\s+/g;function Pc(t){if("string"!=typeof t)return t;if(t.trim().match(jc))return t;return t.replace(Ac,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const Tc=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Lc="f-autocomplete",Dc="highlight-component";let kc,$c=Date.now();const Ic=({name:t,id:e,...n})=>["config.label","attrs.id","meta.id"].reduce(((t,e)=>(t||(t=n.get(e)),t)),null)||"external"===t&&((...t)=>i.get(t.join("."))||Pc(t.join(" ")))(t,e);class Mc{constructor(t,e,n){this.key=t,this.className=t.replace(/\./g,"-"),this.value=e,this.events=[],this.i18nKey=n,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=Wd.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=Wd.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}};return this.displayField=Wd.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${Lc}-display-field`,value:this.label||this.value,placeholder:i.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=Wd.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=Wd.create({tag:"ul",attrs:{className:`${Lc}-list`}}),this.dom=Wd.create({children:[this.displayField,this.hiddenField,this.list],className:this.className,action:{onRender:()=>{const t=this.value&&Md.getAddress(this.value);this.label=t&&Ic(t),this.label&&(this.displayField.value=this.label),this.updateOptions()}}}),this.dom}updateOptions(){const t=Date.now();t-$c>U&&(Wd.empty(this.list),this.generateOptions(),$c=t);const e=kc||this.generateOptions();for(const n of e)this.list.appendChild(n)}generateOptions(){const t=(t=>{const e=[],n=Md.flatList(),o=Object.entries(n).map((([n,o])=>{const i=Ic(o);if(i){const r={tag:"span",content:` ${Pc(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=`${Lc}-list-item`;return t.classList.contains(e)||(t=t.parentElement),t};return kc=t.map((t=>{const{value:n,textLabel:o,htmlLabel:i}=t,r={tag:"li",children:i,dataset:{value:n,label:o},className:`${Lc}-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 Wd.create(r)})),kc}hideList(t=this.list){Vr.slideUp(t,q),this.removeHighlight()}showList(t,e=this.list){this.selectOption(t),Vr.slideDown(e,q)}getActiveOption(t=this.list){const e=t.getElementsByClassName("active-option")[0];return e&&"none"!==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=Md.getAddress(t).dom)||n.classList.remove(Dc)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(Dc);for(const e of t)e.classList.remove(Dc)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=Md.getAddress(n).dom)||e.classList.add(Dc)}}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 Rc=(t,e)=>{const n=(t=>{const e=Yi(t),n={"field.property":G,...Z},o=e?(i=t,Md.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,r])=>{if("id"!==o){const s={tag:"option",content:i.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:r}};e===r&&(s.attrs.selected=!0),n.push(Wd.create(s))}return n}),[])},Fc=(t,e)=>{Wd.empty(t);for(const n of e)t.add(n)},Wc=({key:t,value:e,type:n="text",checked:o})=>{const r={tag:"input",attrs:{type:n,value:e,placeholder:i.get(`${t}.placeholder`)||Pc(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(r.attrs.checked=!0),r},Bc=t=>{const e=i.get(t);if(e)return e;const n=t.split(".");return i.get(n[n.length-1])},zc={autocomplete:(t,e,n)=>new Mc(t,e,n),string:(t,e)=>Wc({key:t,value:e}),boolean:(t,e)=>Wc({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>Wc({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:Bc(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>zc[Wd.childType(e)](t,e)))},qc=["selected","checked"],Uc={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 Hc{constructor({key:t,data:n,index:o,field:r}){e(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:i.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=Wr(r,Y.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)}),z)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),z)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=Yi(t.value)?t.value:"field.property",a=Rc(s,r.value);return Fc(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Vi(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=Rc(n||t,e),i=zc.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=Wd.create(i);return Fc(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,""),e.classList.add([t.className,t.value].filter(Boolean).join("-"));const o={dataPath:a,value:t.value,src:t};Jr.formeoUpdated(o),Md.setAddress(a,t.value);const i=t.closest(".f-condition-row"),r=Fr(i);this.processConditionUIState(this.itemFieldGroups[r])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=zc.autocomplete(`condition.${e}`,t,n);return Md.setConditionMap(t,i),o.addEvent("onChange",(t=>{Md.removeConditionMap(Md.getAddress(a)),c(t),Md.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=zc.string("condition.value",t);return e.action={input:c},Wd.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=Wr(Object.entries(n),qc,"0");const[s,a]=t.split(".");this.field=r,this.itemKey=t,this.itemIndex=o,this.panelName=s,this.isDisabled=r.isDisabledProp(a,s),this.isHidden=this.isDisabled&&r.config.panels[s].hideDisabled,this.isLocked=r.isLockedProp(a,s),this.dom=Wd.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:()=>{Vr.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),Wd.remove(t),this.field.resizePanelWrap()}))}},content:Wd.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=Wd.childType(e)||"string",o={config:{},attrs:{},...zc[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&&(Bc(r)||Pc(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...Uc[n](i,this.field)},o}}class Xc{constructor(t,n,o){e(this,"addAttribute",((t,e)=>{const n=Tc(t),o=`attrs.${n}`;i.current[o]||i.put(o,Ur(t)),"string"==typeof e&&["true","false"].includes(e)&&(e=JSON.parse(e)),this.field.set(`attrs.${t}`,e);const r=this.props.querySelector(`.field-attrs-${n}`),s=new Hc({key:o,data:{[n]:e},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.meta.id,e=this.field.get("options"),n="select"===t?"option":t,o=i.get("newOptionLabel",{type:n})||"New Option",r=`options.${this.data.length}`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=Tc(o));const l=new Hc({key:r,data:a,field:this.field,index:this.props.children.length});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.field.set(r,a),this.field.resizePanelWrap()})),e(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new Hc({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=Wd.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:i.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 Hc({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 Wd.create(e)}createEditButtons(){const t=this,e=this.name,n=i.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...Wd.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const r={btnCoords:Wd.coords(n.target),addAction:o[e]};"attrs"===e&&(r.isDisabled=t.field.isDisabledProp,r.isLocked=t.field.isLockedProp,r.message={attr:i.get(`action.add.${e}.attr`),value:i.get(`action.add.${e}.value`)});const s=Pc(e),a=new window.CustomEvent(`onAdd${s}`,{detail:r});xc.add[e](r),document.dispatchEvent(a)}}}]}}}class Vc extends ba{constructor(t,n={},o){super(t,{...n,id:n.id||Bi()}),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)?Rr(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 Br(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})(Md.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),Md[`${this.name}s`].delete(this.id)})),e(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),e(this,"getComponentTag",(()=>Wd.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&Wd.icon("component-corner",{className:"bottom-left"}),Wd.icon(`handle-${this.name}`),Pc(this.name),(this.isColumn||this.isRow)&&Wd.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[Wd.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-${Fi(t)}`),null==e||e.classList.remove(`hovering-${Fi(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,!G[i]].some(Boolean)?t:e?o.set(G[i],e):o.get(G[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={...qi(this.data),id:Bi()};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=>Wd.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=this.data.id,this.name=t,this.config=Md[`${this.name}s`].config,zi(this.config,n.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.data.children=this.data.children.filter((e=>-1===t.indexOf(e))),this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{Md.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),Md.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...Wd.btnTemplate({content:Wd.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`);Vr.slideToggle(i,z,t),"field"===this.name&&(Vr.slideToggle(this.preview,z,!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}`)=>({...Wd.btnTemplate({content:Wd.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...Wd.btnTemplate({content:Wd.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...Wd.btnTemplate({content:Wd.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...Wd.btnTemplate({content:Wd.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{Vr.slideUp(this.dom,z,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...Wd.btnTemplate({content:Wd.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 Fr(this.dom)}get parentType(){return M.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${P[t]}`);return e&&Wd.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=I.get(this.name);return zr(t,(t=>Md.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=Bi()}=i,a=I.get(this.name);if(!a)return null;const l=`${a}s`,c=Md.getAddress(`${l}.${s}`)||Md[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(b)||(t=t.parentElement);const r=Fi(t),s=Fi(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=Fr(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:t}=md.get(n.id),{meta:{id:e}}=t,i=e.startsWith("layout-")?e.replace(/^layout-/,""):"field",r=Ir({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)();Wd.remove(n);return s(t,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||Zi)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||Zi)();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(C)&&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&&Wd.onRender(this.dom,t.onRender)}set config(t){const e=Ir(this.data,"meta.id"),n=[Ir(t,"all"),e&&Ir(t,e),Ir(t,this.id)].reduce(((t,e)=>e?zi(t,e):t),this.configVal);this.configVal=n}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=Md[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===A.row}get isColumn(){return this.name===A.column}get isField(){return this.name===A.field}}class Yc extends Vc{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),e(this,"updateConditionsPanel",Gi((()=>{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)}),z)),e(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=Wd.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),e(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=Wi([...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=Wd.childType(e);if(t.includes(n)){const t=new Xc(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new _c(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${Pc(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${Pc(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=Wd.create(this.labelConfig),this.preview=Wd.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 r={tag:"li",attrs:{className:E},id:this.id,children:[this.label,this.getComponentTag(),n,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:i.get("field")}};r=Wd.create(r),this.observe(r),this.dom=r,this.isEditing=!1,this.onRender(r)}get labelConfig(){if(!!this.get("config.hideLabel"))return;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=Md.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&Wd.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=Wd.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",Wd.remove(e)}else this.resizePanelWrap()}},Wd.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=Fr(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=qi(this.data),{action:n={}}=md.get(e.meta.id);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:Wd.create(e,!0),action:this.defaultPreviewActions}}}const Gc={js:new Set,css:new Set},Zc=(t,e,n=Ji)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),Jc=(t,e)=>{t.removeEventListener("load",Jc),e(t.src)},Kc=(t,e)=>{t.removeEventListener("load",Kc),e(t.src)},Qc=t=>new Promise(((e,n)=>{if(Gc.js.has(t))return e(t);Gc.js.add(t);const o=Wd.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>Kc(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),td=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(Gc.css.has(t))return e(t);Gc.css.add(t);const o=Wd.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>Jc(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},ed=async(t=f)=>{if(document.getElementById(p))return;const e=async t=>(t=>{let e=document.getElementById(p);return e||(e=Wd.create({id:p,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return Zc(t,e,(()=>Zc(g,e)))},nd={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>Qc(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>td(t)));return Promise.all(e)}},od=t=>{const e=Object.entries(t).map((([t,e])=>nd[t](e)));return Promise.all(e)},id=()=>{const t=document.getElementById(p);return"hidden"===window.getComputedStyle(t).visibility};class rd{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||Bi()}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:Wd.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${b}`);return e&&md.panels.nav.refresh(Fr(e))},click:({target:t})=>{md.addElement(t.parentElement.id)}}};return Wd.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return od(this.dependencies)}i18n(t,e){var n,o;const r=i.locale,s=null==(n=this.definition)?void 0:n.i18n,a=(null==s?void 0:s[r])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||i.get(t,e)}}const sd=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const ad=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:i.get("labelCount",{label:Pc(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const ld=[class extends rd{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:i.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:i.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 rd{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:i.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends rd{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:i.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends rd{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:i.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends rd{constructor(){super({tag:"textarea",config:{label:i.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends rd{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:i.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends rd{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:i.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends rd{constructor(){super({tag:"select",config:{label:i.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:ad("option")})}},class extends rd{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:i.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:ad("checkbox",1)})}},class extends rd{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:i.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:ad("radio")})}}],cd=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),dd="controls.html.header";const ud=[class extends rd{constructor(){super({tag:cd[0],attrs:{tag:cd.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:i.get(dd),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:i.get(dd),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(dd)}},class extends rd{constructor(){super({tag:"p",attrs:{className:""},config:{label:i.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 rd{constructor(){super({tag:"hr",config:{label:i.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends rd{constructor(t){super(zi({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))}}],hd=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"}}),pd=[...ld,...ud,...sd];const md=new class{constructor(){e(this,"groupLabel",(t=>i.get(t)||t||"")),e(this,"addElement",(t=>{const e=Ir(this.get(t),"controlData"),{meta:{group:n,id:o}}=e,i={row:()=>Pd.active.addChild(),column:()=>i.row().addChild(),field:t=>i.column().addChild(t)};return"layout"!==n?i.field(e):i[o.replace("layout-","")]()})),e(this,"applyOptions",(async(t={})=>{const{container:e,elements:n,groupOrder:o,...i}=zi(hd,t);return this.container=e,this.groupOrder=Wi(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...pd,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${b}`);return e&&this.panels.nav.refresh(Fr(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 rd(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=Wr(t,this.groupOrder,"id"),t=t.filter((t=>Ri(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:b,id:`${t.id}-${b}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=Wi(e.concat(t.elementOrder));t.elementOrder=n}return e=Wr(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=[Ri(i,this.options.disable.elements),n.meta.group===t.id,!o.includes(n.meta.id)].every((t=>!0===t)),r&&o.push(i),r})),n})),n}add(t=Object.create(null)){const e=qi(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 qi(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...Wd.btnTemplate({content:[Wd.icon("bin"),i.get("clear")],title:i.get("clearAll")}),className:["clear-form"],action:{click:t=>{Td.size?(Jr.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:i.get("confirmClearAll"),clearAllAction:()=>{Pd.clearAll().then((()=>{const e={src:t.target};Jr.formeoCleared(e)}))},btnCoords:Wd.coords(t.target)}}),document.dispatchEvent(Jr.confirmClearAll)):window.alert(i.get("cannotClearFields"))}}},e={...Wd.btnTemplate({content:[Wd.icon("floppy-disk"),i.get("save")],title:i.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=Md,n={action:()=>{},coords:Wd.coords(t),message:"",button:t};return xc.click.btn(n),xc.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 _c({panels:e,type:"controls",displayType:o});const r=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=Wd.create({className:r,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=Wd.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(Wd.toggleElementsByStr(n,t),e){const e=i.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=Wd.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 i=c.length-1;i>=0;i--){const t=`formeo-controls-${c[i]}`;this.options.sortable||window.localStorage.removeItem(t),ec.create(c[i],{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 Yc(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 fd extends ba{constructor(){super(...arguments),e(this,"load",((t=Object.create(null))=>(this.empty(),"string"==typeof t&&(t=JSON.parse(t)),Object.entries(t).forEach((([t,e])=>this.add(t,e))),this.data))),e(this,"get",(t=>t?Ir(this.data,t):this.add())),e(this,"add",((t,e=Object.create(null))=>{const n=t||Bi(),o=this.Component({...e,id:n});return this.set(n,o),this.active=o,o})),e(this,"remove",(t=>(Array.isArray(t)?t.forEach((t=>{this.get(t).remove()})):this.get(t).remove(),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=zi(this.configVal,qi(t))}get config(){return this.configVal}}class gd extends Vc{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=Wd.create({attrs:{className:[y,"empty"],id:this.id},children:n}),ec.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:()=>{vd.active=this},onSort:this.onSort.bind(this),draggable:`.${w}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Vr.slideUp(this.dom,z,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Vr.slideDown(this.dom,z)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const vd=new class extends fd{constructor(t){super("stages",t)}Component(t){return new gd(t)}};class bd extends Vc{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[w]}),...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(K);const t=n.dom,o=Hi(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),q);document.dispatchEvent(Jr.columnResized)}this.updateColumnPreset()})),e(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>Wd.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=Wd.create({tag:"li",className:[w,"empty"],dataset:{hoverTag:i.get("row"),editingHoverTag:i.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,n]}),ec.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:`.${C}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:i.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:i.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:i.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:i.get("row.makeInputGroup"),description:i.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=Wd.formGroup([t,n]),r={tag:"label",content:i.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=Wd.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",Wd.formGroup([r,s],"row")];return Wd.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>Wd.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=R.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:x}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:i.get("defineColumnLayout"),className:S},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const yd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const wd=new class extends fd{constructor(t){super("rows",t),this.config={all:yd}}Component(t){return new bd(t)}};class Cd{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=Wd.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(`.${w}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(O),this.columnPreset=o.querySelector(`.${S}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(K,""),n.className=n.className.replace(K,""),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(Ui(e,this.rowWidth)),i=parseFloat(Ui(n,this.rowWidth));return o<10||i<10?null:{colWidth:Hi(o.toFixed(1)),siblingColWidth:Hi(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(),Md.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),Md.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(O),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(O),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${x}`);const n=this.row.querySelector(".children").children,o=zr(n,(t=>Ui(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=Wd.create({tag:"option",attrs:{className:x,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const Ed=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[Wd.icon("triangle-down"),Wd.icon("triangle-up")]}),xd=()=>({className:"column-edit group-config"});class Sd extends Vc{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[C]}),...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=Wd.create({tag:"li",className:[C,"empty"],dataset:{hoverTag:i.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),xd(),Ed(new Cd),n]}),this.processConfig(),Jr.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),ec.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:`.${E}`,handle:".item-move"})}processConfig(){const t=Xr.get(this.data,"config.width");t&&this.setDomWidth(t)}}const Od={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const _d=new class extends fd{constructor(t){super("columns",t),this.config={all:Od}}Component(t){return new Sd(t)}},Nd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const Ad=new class extends fd{constructor(t){super("fields",t),e(this,"get",(t=>{let e=t&&Ir(this.data,t);if(!e){const n=md.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}),{}))),this.config={all:Nd}}Component(t){return new Yc(t)}};const jd=new class extends fd{constructor(t){super("externals",t)}Component(t){return new Vc("external",t)}},Pd=vd,Td=wd,Ld=_d,Dd=Ad,kd=md,$d=jd,Id={id:Bi()};const Md=new class extends ba{constructor(t){super("components"),e(this,"sessionFormData",(()=>{var t;if(null==(t=this.opts)?void 0:t.sessionStorage)return Xi.get(W)})),e(this,"load",((t,e=this.opts||Object.create(null))=>{let n=t;this.empty(),"string"==typeof t&&(n=JSON.parse(t)),this.opts=e;const{stages:o={[Bi()]:{}},rows:i,columns:r,fields:s,id:a=Bi()}={...this.sessionFormData(),...n};this.set("id",a),this.add("stages",Pd.load(o)),this.add("rows",Td.load(i)),this.add("columns",Ld.load(r)),this.add("fields",Dd.load(s)),this.add("externals",$d.load(e.external));for(const l of Object.values(this.get("stages")))l.loadChildren();return this.data})),this.opts=t,this.data=Id,this.disableEvents=!0,this.stages=Pd,this.rows=Td,this.columns=Ld,this.fields=Dd,this.controls=kd,this.externals=$d}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@${h}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:vd.getData(),rows:wd.getData(),columns:_d.getData(),fields:Ad.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Pd.config=e,Td.config=n,Ld.config=o,Dd.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(!Vi(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(Vi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Vi(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Vi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},Rd={glyphicons:t=>`<span class="glyphicon glyphicon-${t}" aria-hidden="true"></span>`,"font-awesome":t=>{const[e,n]=t.split(" ");return`<i class="${e} fa-${n}"></i>`},fontello:t=>`<i class="${Q}${t}">${t}</i>`},Fd=new Set(["input","textarea","select"]);const Wd=new class{constructor(t=Object.create(null)){e(this,"render",(t=>(t.id=`f-${t.id||Bi()}`,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:[Xr.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=zi(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(h)||"button"===c)return Xr.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(Xr.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 m=Xr.subtract(o,Object.keys(a));for(d=m.length-1;d>=0;d--)h[m[d]]=a[m[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 Wd.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 Br(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:r})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:r||!o},config:{label:e||i.get("labelCount",{label:i.get("option"),count:o})}}))),e(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),e(this,"removeEmpty",(t=>{const e=t.parentElement,n=Fi(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=>Fi(t)===b)),e(this,"isStage",(t=>Fi(t)===y)),e(this,"isRow",(t=>Fi(t)===w)),e(this,"isColumn",(t=>Fi(t)===C)),e(this,"isField",(t=>Fi(t)===E)),e(this,"asComponent",(t=>Md[`${Fi(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=zi(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:Wd.onRender,render:Wd.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(`#${p} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(Q,"")]={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=zi(r,e);return this.cachedIcons[i]=Wd.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=Wd.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Rd[Wd.options.iconFont])?void 0:o.call(Rd,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",Bi(t));for(const i of Object.keys(o)){const t=Xr.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||Bi(),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),Fd.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Xr.get(t,"attrs.type"),n=Xr.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Xr.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=Fi(t);return e?Md.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,Xr.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)}};Xr.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");Vr.slideUp(t,600,(()=>{Wd.empty(t),t.classList.remove("removing-all-fields"),Wd.emptyClass(t),Vr.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=Fi(t);if(!o)return;const i=Fi(t.parentElement),r=Wd[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(_.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};i.addLanguage("en-US",void 0);const Bd={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:f,style:v,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Hr(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"}}}};let zd=class{constructor({formData:t,...e},n){const o=zi(Bd.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,Wd.setOptions=c,Md.config=a,this.userFormData=n||t,this.Components=Md,this.dom=Wd,Jr.init({debug:s,...r}),xc.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new d,document.addEventListener("DOMContentLoaded",this.loadResources.bind(this))}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})=>Qc(t))))})(this.opts.polyfills),await ed(this.opts.svgSprite),e.push((async t=>{if(!id()&&(await td(t),!id()))return await td("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),e.push(i.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(B)}));const n=await Promise.all(e);return this.opts.allowEdit&&this.init(),n}init(){md.init(this.opts.controls,this.opts.stickyControls).then((t=>{this.controls=t,this.load(this.userFormData,this.opts),this.formId=Md.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(B,t);i.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render()}))}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(Md.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))]};i.current.dir&&(t.attrs.dir=i.current.dir,Wd.dir=i.current.dir),this.editor=Wd.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(Wd.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),Jr.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(Jr.formeoLoaded)}};const qd=t=>{const e=t.match(J);return(null==e?void 0:e[0])||t},Ud=t=>t.replace(J,Bi());let Hd=class{constructor(t,n={}){e(this,"render",((t=this.form)=>{this.form=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=Wd.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[qd(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:Bi(),className:i,children:s}})),e(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:Ud(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(qd(t))))})})),e(this,"addButton",(t=>Wd.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=Wd.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(Wd.render(Wd.btnTemplate({className:"remove-input-group",children:Wd.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,"processFieldsOrig",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>this.cacheComponent(Object.assign({},e,{id:this.prefixId(t)})))))),e(this,"processFields",(t=>this.orderChildren("fields",t).map((({id:t,...e})=>{const{action:n={},dependencies:o={}}=this.elements[e.meta.id]||{};o&&od(o);const i=zi({action:n},e);return this.cacheComponent({...i,id:this.prefixId(t)})})))),e(this,"applyConditions",(()=>{Object.values(this.components).forEach((({conditions:t})=>{t&&t.forEach(((t,e)=>{const{if:n,then:o}=t;n.forEach((t=>{const{source:e,...n}=t;if(Vi(e)){this.getComponents(e).forEach((t=>{const e=Xd(t);e&&t.addEventListener(e,(t=>this.evaluateCondition(n,t)&&o.forEach((e=>this.execResult(e,t)))),!1);const i={target:t};this.evaluateCondition(n,i)&&o.forEach((t=>this.execResult(t,i)))}))}}))}))}))})),e(this,"evaluateCondition",(({sourceProperty:t,targetProperty:e,comparison:n,target:o},i)=>{var r;const s={equals:va,notEquals:(t,e)=>!va(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Vi(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(Vi(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 Yi(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),e(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return Yi(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r}=(({editorContainer:t,renderContainer:e,...n})=>{const o=t=>"string"==typeof t?document.querySelector(t):t;return{...n,renderContainer:o(e),editorContainer:o(t)}})(t);this.container=o,this.form=n,this.external=i,this.dom=Wd,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=y,Wd.render(t))))}};const Xd=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=zd,window.FormeoRenderer=Hd);const Vd=zd,Yd=Hd;exports.FormeoEditor=Vd,exports.FormeoRenderer=Yd;
|
|
14
|
+
*/function ya(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 wa(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ya(Object(n),!0).forEach((function(e){Ea(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ya(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ca(t){return(Ca="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ea(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xa(){return xa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},xa.apply(this,arguments)}function Sa(t,e){if(null==t)return{};var n,o,i=function(t,e){if(null==t)return{};var n,o,i={},r=Object.keys(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Oa(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var _a=Oa(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Na=Oa(/Edge/i),Aa=Oa(/firefox/i),ja=Oa(/safari/i)&&!Oa(/chrome/i)&&!Oa(/android/i),Pa=Oa(/iP(ad|od|hone)/i),Ta=Oa(/chrome/i)&&Oa(/android/i),La={capture:!1,passive:!1};function Da(t,e,n){t.addEventListener(e,n,!_a&&La)}function ka(t,e,n){t.removeEventListener(e,n,!_a&&La)}function $a(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 Ia(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Ma(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&$a(t,e):$a(t,e))||o&&t===n)return t;if(t===n)break}while(t=Ia(t))}return null}var Ra,Fa=/\s+/g;function Wa(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Fa," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Fa," ")}}function Ba(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 za(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Ba(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 qa(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function Ua(){var t=document.scrollingElement;return t||document.documentElement}function Ha(t,e,n,o,i){if(t.getBoundingClientRect||t===window){var r,s,a,l,c,d,h;if(t!==window&&t.parentNode&&t!==Ua()?(s=(r=t.getBoundingClientRect()).top,a=r.left,l=r.bottom,c=r.right,d=r.height,h=r.width):(s=0,a=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,h=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!_a))do{if(i&&i.getBoundingClientRect&&("none"!==Ba(i,"transform")||n&&"static"!==Ba(i,"position"))){var u=i.getBoundingClientRect();s-=u.top+parseInt(Ba(i,"border-top-width")),a-=u.left+parseInt(Ba(i,"border-left-width")),l=s+r.height,c=a+r.width;break}}while(i=i.parentNode);if(o&&t!==window){var p=za(i||t),f=p&&p.a,m=p&&p.d;p&&(l=(s/=m)+(d/=m),c=(a/=f)+(h/=f))}return{top:s,left:a,bottom:l,right:c,width:h,height:d}}}function Xa(t,e,n){for(var o=Ja(t,!0),i=Ha(t)[e];o;){if(!(i>=Ha(o)[n]))return o;if(o===Ua())break;o=Ja(o,!1)}return!1}function Va(t,e,n,o){for(var i=0,r=0,s=t.children;r<s.length;){if("none"!==s[r].style.display&&s[r]!==ec.ghost&&(o||s[r]!==ec.dragged)&&Ma(s[r],n.draggable,t,!1)){if(i===e)return s[r];i++}r++}return null}function Ya(t,e){for(var n=t.lastElementChild;n&&(n===ec.ghost||"none"===Ba(n,"display")||e&&!$a(n,e));)n=n.previousElementSibling;return n||null}function Ga(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===ec.clone||e&&!$a(t,e)||n++;return n}function Za(t){var e=0,n=0,o=Ua();if(t)do{var i=za(t),r=i.a,s=i.d;e+=t.scrollLeft*r,n+=t.scrollTop*s}while(t!==o&&(t=t.parentNode));return[e,n]}function Ja(t,e){if(!t||!t.getBoundingClientRect)return Ua();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=Ba(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return Ua();if(o||e)return n;o=!0}}}while(n=n.parentNode);return Ua()}function Ka(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function Qa(t,e){return function(){if(!Ra){var n=arguments;1===n.length?t.call(this,n[0]):t.apply(this,n),Ra=setTimeout((function(){Ra=void 0}),e)}}}function tl(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function el(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}function nl(t,e,n){var o={};return Array.from(t.children).forEach((function(i){var r,s,a,l;if(Ma(i,e.draggable,t,!1)&&!i.animated&&i!==n){var c=Ha(i);o.left=Math.min(null!==(r=o.left)&&void 0!==r?r:1/0,c.left),o.top=Math.min(null!==(s=o.top)&&void 0!==s?s:1/0,c.top),o.right=Math.max(null!==(a=o.right)&&void 0!==a?a:-1/0,c.right),o.bottom=Math.max(null!==(l=o.bottom)&&void 0!==l?l:-1/0,c.bottom)}})),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var ol="Sortable"+(new Date).getTime();function il(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==Ba(t,"display")&&t!==ec.ghost){e.push({target:t,rect:Ha(t)});var n=wa({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=za(t,!0);o&&(n.top-=o.f,n.left-=o.e)}t.fromRect=n}}))},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(function(t,e){for(var n in t)if(t.hasOwnProperty(n))for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n);return-1}(e,{target:t}),1)},animateAll:function(n){var o=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof n&&n());var i=!1,r=0;e.forEach((function(t){var e=0,n=t.target,s=n.fromRect,a=Ha(n),l=n.prevFromRect,c=n.prevToRect,d=t.rect,h=za(n,!0);h&&(a.top-=h.f,a.left-=h.e),n.toRect=a,n.thisAnimationDuration&&Ka(l,a)&&!Ka(s,a)&&(d.top-a.top)/(d.left-a.left)==(s.top-a.top)/(s.left-a.left)&&(e=function(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}(d,l,c,o.options)),Ka(a,s)||(n.prevFromRect=s,n.prevToRect=a,e||(e=o.options.animation),o.animate(n,d,a,e)),e&&(i=!0,r=Math.max(r,e),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),e),n.thisAnimationDuration=e)})),clearTimeout(t),i?t=setTimeout((function(){"function"==typeof n&&n()}),r):"function"==typeof n&&n(),e=[]},animate:function(t,e,n,o){if(o){Ba(t,"transition",""),Ba(t,"transform","");var i=za(this.el),r=i&&i.a,s=i&&i.d,a=(e.left-n.left)/(r||1),l=(e.top-n.top)/(s||1);t.animatingX=!!a,t.animatingY=!!l,Ba(t,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),Ba(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),Ba(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){Ba(t,"transition",""),Ba(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}}var rl=[],sl={initializeByDefault:!0},al={mount:function(t){for(var e in sl)sl.hasOwnProperty(e)&&!(e in t)&&(t[e]=sl[e]);rl.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),rl.push(t)},pluginEvent:function(t,e,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var i=t+"Global";rl.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](wa({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](wa({sortable:e},n)))}))},initializePlugins:function(t,e,n,o){for(var i in rl.forEach((function(o){var i=o.pluginName;if(t.options[i]||o.initializeByDefault){var r=new o(t,e,t.options);r.sortable=t,r.options=t.options,t[i]=r,xa(n,r.defaults)}})),t.options)if(t.options.hasOwnProperty(i)){var r=this.modifyOption(t,i,t.options[i]);void 0!==r&&(t.options[i]=r)}},getEventProperties:function(t,e){var n={};return rl.forEach((function(o){"function"==typeof o.eventProperties&&xa(n,o.eventProperties.call(e[o.pluginName],t))})),n},modifyOption:function(t,e,n){var o;return rl.forEach((function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))})),o}};var ll=["evt"],cl=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,i=Sa(n,ll);al.pluginEvent.bind(ec)(t,e,wa({dragEl:hl,parentEl:ul,ghostEl:pl,rootEl:fl,nextEl:ml,lastDownEl:gl,cloneEl:vl,cloneHidden:bl,dragStarted:Tl,putSortable:Sl,activeSortable:ec.active,originalEvent:o,oldIndex:yl,oldDraggableIndex:Cl,newIndex:wl,newDraggableIndex:El,hideGhostForTarget:Jl,unhideGhostForTarget:Kl,cloneNowHidden:function(){bl=!0},cloneNowShown:function(){bl=!1},dispatchSortableEvent:function(t){dl({sortable:e,name:t,originalEvent:o})}},i))};function dl(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,h=t.newDraggableIndex,u=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[ol]){var m,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||_a||Na?(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=h,m.originalEvent=u,m.pullMode=p?p.lastPutMode:void 0;var b=wa(wa({},f),al.getEventProperties(o,e));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),g[v]&&g[v].call(e,m)}}(wa({putSortable:Sl,cloneEl:vl,targetEl:hl,rootEl:fl,oldIndex:yl,oldDraggableIndex:Cl,newIndex:wl,newDraggableIndex:El},t))}var hl,ul,pl,fl,ml,gl,vl,bl,yl,wl,Cl,El,xl,Sl,Ol,_l,Nl,Al,jl,Pl,Tl,Ll,Dl,kl,$l,Il=!1,Ml=!1,Rl=[],Fl=!1,Wl=!1,Bl=[],zl=!1,ql=[],Ul="undefined"!=typeof document,Hl=Pa,Xl=Na||_a?"cssFloat":"float",Vl=Ul&&!Ta&&!Pa&&"draggable"in document.createElement("div"),Yl=function(){if(Ul){if(_a)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Gl=function(t,e){var n=Ba(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Va(t,0,e),r=Va(t,1,e),s=i&&Ba(i),a=r&&Ba(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ha(i).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ha(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[Xl]||r&&"none"===n[Xl]&&l+c>o)?"vertical":"horizontal"},Zl=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"==Ca(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},Jl=function(){!Yl&&pl&&Ba(pl,"display","none")},Kl=function(){!Yl&&pl&&Ba(pl,"display","")};Ul&&!Ta&&document.addEventListener("click",(function(t){if(Ml)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Ml=!1,!1}),!0);var Ql=function(t){if(hl){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,Rl.some((function(t){var e=t[ol].options.emptyInsertThreshold;if(e&&!Ya(t)){var n=Ha(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[ol]._onDragOver(n)}}var i,r,s},tc=function(t){hl&&hl.parentNode[ol]._isOutsideThisEl(t.target)};function ec(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=xa({},e),t[ol]=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 Gl(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!==ec.supportPointer&&"PointerEvent"in window&&!ja,emptyInsertThreshold:5};for(var o in al.initializePlugins(this,t,n),n)!(o in e)&&(e[o]=n[o]);for(var i in Zl(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Vl,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Da(t,"pointerdown",this._onTapStart):(Da(t,"mousedown",this._onTapStart),Da(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Da(t,"dragover",this),Da(t,"dragenter",this)),Rl.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),xa(this,il())}function nc(t,e,n,o,i,r,s,a){var l,c,d=t[ol],h=d.options.onMove;return!window.CustomEvent||_a||Na?(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||Ha(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),h&&(c=h.call(d,l,s)),c}function oc(t){t.draggable=!1}function ic(){zl=!1}function rc(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 sc(t){return setTimeout(t,0)}function ac(t){return clearTimeout(t)}ec.prototype={constructor:ec,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Ll=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,hl):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){ql.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&ql.push(o)}}(n),!hl&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!ja||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=Ma(a,o.draggable,n,!1))&&a.animated||gl===a)){if(yl=Ga(a),Cl=Ga(a,o.draggable),"function"==typeof c){if(c.call(this,t,a,this))return dl({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),cl("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=Ma(l,o.trim(),n,!1))return dl({sortable:e,rootEl:o,name:"filter",targetEl:a,fromEl:n,toEl:n}),cl("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!Ma(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&&!hl&&n.parentNode===r){var l=Ha(n);if(fl=r,ul=(hl=n).parentNode,ml=hl.nextSibling,gl=n,xl=s.group,ec.dragged=hl,Ol={target:hl,clientX:(e||t).clientX,clientY:(e||t).clientY},jl=Ol.clientX-l.left,Pl=Ol.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,hl.style["will-change"]="all",o=function(){cl("delayEnded",i,{evt:t}),ec.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!Aa&&i.nativeDraggable&&(hl.draggable=!0),i._triggerDragStart(t,e),dl({sortable:i,name:"choose",originalEvent:t}),Wa(hl,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){qa(hl,t.trim(),oc)})),Da(a,"dragover",Ql),Da(a,"mousemove",Ql),Da(a,"touchmove",Ql),Da(a,"mouseup",i._onDrop),Da(a,"touchend",i._onDrop),Da(a,"touchcancel",i._onDrop),Aa&&this.nativeDraggable&&(this.options.touchStartThreshold=4,hl.draggable=!0),cl("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(Na||_a))o();else{if(ec.eventCanceled)return void this._onDrop();Da(a,"mouseup",i._disableDelayedDrag),Da(a,"touchend",i._disableDelayedDrag),Da(a,"touchcancel",i._disableDelayedDrag),Da(a,"mousemove",i._delayedDragTouchMoveHandler),Da(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&Da(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(){hl&&oc(hl),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ka(t,"mouseup",this._disableDelayedDrag),ka(t,"touchend",this._disableDelayedDrag),ka(t,"touchcancel",this._disableDelayedDrag),ka(t,"mousemove",this._delayedDragTouchMoveHandler),ka(t,"touchmove",this._delayedDragTouchMoveHandler),ka(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Da(document,"pointermove",this._onTouchMove):Da(document,e?"touchmove":"mousemove",this._onTouchMove):(Da(hl,"dragend",this),Da(fl,"dragstart",this._onDragStart));try{document.selection?sc((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(Il=!1,fl&&hl){cl("dragStarted",this,{evt:e}),this.nativeDraggable&&Da(document,"dragover",tc);var n=this.options;!t&&Wa(hl,n.dragClass,!1),Wa(hl,n.ghostClass,!0),ec.active=this,t&&this._appendGhost(),dl({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(_l){this._lastX=_l.clientX,this._lastY=_l.clientY,Jl();for(var t=document.elementFromPoint(_l.clientX,_l.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(_l.clientX,_l.clientY))!==e;)e=t;if(hl.parentNode[ol]._isOutsideThisEl(t),e)do{if(e[ol]){if(e[ol]._onDragOver({clientX:_l.clientX,clientY:_l.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=Ia(e));Kl()}},_onTouchMove:function(t){if(Ol){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=pl&&za(pl,!0),s=pl&&r&&r.a,a=pl&&r&&r.d,l=Hl&&$l&&Za($l),c=(i.clientX-Ol.clientX+o.x)/(s||1)+(l?l[0]-Bl[0]:0)/(s||1),d=(i.clientY-Ol.clientY+o.y)/(a||1)+(l?l[1]-Bl[1]:0)/(a||1);if(!ec.active&&!Il){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(pl){r?(r.e+=c-(Nl||0),r.f+=d-(Al||0)):r={a:1,b:0,c:0,d:1,e:c,f:d};var h="matrix(".concat(r.a,",").concat(r.b,",").concat(r.c,",").concat(r.d,",").concat(r.e,",").concat(r.f,")");Ba(pl,"webkitTransform",h),Ba(pl,"mozTransform",h),Ba(pl,"msTransform",h),Ba(pl,"transform",h),Nl=c,Al=d,_l=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!pl){var t=this.options.fallbackOnBody?document.body:fl,e=Ha(hl,!0,Hl,!0,t),n=this.options;if(Hl){for($l=t;"static"===Ba($l,"position")&&"none"===Ba($l,"transform")&&$l!==document;)$l=$l.parentNode;$l!==document.body&&$l!==document.documentElement?($l===document&&($l=Ua()),e.top+=$l.scrollTop,e.left+=$l.scrollLeft):$l=Ua(),Bl=Za($l)}Wa(pl=hl.cloneNode(!0),n.ghostClass,!1),Wa(pl,n.fallbackClass,!0),Wa(pl,n.dragClass,!0),Ba(pl,"transition",""),Ba(pl,"transform",""),Ba(pl,"box-sizing","border-box"),Ba(pl,"margin",0),Ba(pl,"top",e.top),Ba(pl,"left",e.left),Ba(pl,"width",e.width),Ba(pl,"height",e.height),Ba(pl,"opacity","0.8"),Ba(pl,"position",Hl?"absolute":"fixed"),Ba(pl,"zIndex","100000"),Ba(pl,"pointerEvents","none"),ec.ghost=pl,t.appendChild(pl),Ba(pl,"transform-origin",jl/parseInt(pl.style.width)*100+"% "+Pl/parseInt(pl.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;cl("dragStart",this,{evt:t}),ec.eventCanceled?this._onDrop():(cl("setupClone",this),ec.eventCanceled||((vl=el(hl)).removeAttribute("id"),vl.draggable=!1,vl.style["will-change"]="",this._hideClone(),Wa(vl,this.options.chosenClass,!1),ec.clone=vl),n.cloneId=sc((function(){cl("clone",n),ec.eventCanceled||(n.options.removeCloneOnHide||fl.insertBefore(vl,hl),n._hideClone(),dl({sortable:n,name:"clone"}))})),!e&&Wa(hl,i.dragClass,!0),e?(Ml=!0,n._loopId=setInterval(n._emulateDragOver,50)):(ka(document,"mouseup",n._onDrop),ka(document,"touchend",n._onDrop),ka(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,hl)),Da(document,"drop",n),Ba(hl,"transform","translateZ(0)")),Il=!0,n._dragStartId=sc(n._dragStarted.bind(n,e,t)),Da(document,"selectstart",n),Tl=!0,ja&&Ba(document.body,"user-select","none"))},_onDragOver:function(t){var e,n,o,i,r=this.el,s=t.target,a=this.options,l=a.group,c=ec.active,d=xl===l,h=a.sort,u=Sl||c,p=this,f=!1;if(!zl){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),s=Ma(s,a.draggable,r,!0),j("dragOver"),ec.eventCanceled)return f;if(hl.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||p._ignoreWhileAnimating===s)return T(!1);if(Ml=!1,c&&!a.disabled&&(d?h||(o=ul!==fl):Sl===this||(this.lastPutMode=xl.checkPull(this,c,hl,t))&&l.checkPut(this,c,hl,t))){if(i="vertical"===this._getDirection(t,s),e=Ha(hl),j("dragOverValid"),ec.eventCanceled)return f;if(o)return ul=fl,P(),this._hideClone(),j("revert"),ec.eventCanceled||(ml?fl.insertBefore(hl,ml):fl.appendChild(hl)),T(!0);var m=Ya(r,a.draggable);if(!m||function(t,e,n){var o=Ha(Ya(n.el,n.options.draggable)),i=nl(n.el,n.options,pl),r=10;return e?t.clientX>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===hl)return T(!1);if(m&&r===t.target&&(s=m),s&&(n=Ha(s)),!1!==nc(fl,r,hl,e,s,n,t,!!s))return P(),m&&m.nextSibling?r.insertBefore(hl,m.nextSibling):r.appendChild(hl),ul=r,L(),T(!0)}else if(m&&function(t,e,n){var o=Ha(Va(n.el,0,n.options,!0)),i=nl(n.el,n.options,pl),r=10;return e?t.clientX<i.left-r||t.clientY<o.top&&t.clientX<o.right:t.clientY<i.top-r||t.clientY<o.bottom&&t.clientX<o.left}(t,i,this)){var g=Va(r,0,a,!0);if(g===hl)return T(!1);if(n=Ha(s=g),!1!==nc(fl,r,hl,e,s,n,t,!1))return P(),r.insertBefore(hl,g),ul=r,L(),T(!0)}else if(s.parentNode===r){n=Ha(s);var v,b,y,w=hl.parentNode!==r,C=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,s=n?e.left:e.top,a=n?e.right:e.bottom,l=n?e.width:e.height;return o===s||i===a||o+r/2===s+l/2}(hl.animated&&hl.toRect||e,s.animated&&s.toRect||n,i),E=i?"top":"left",x=Xa(s,"top","top")||Xa(hl,"top","top"),S=x?x.scrollTop:void 0;if(Ll!==s&&(b=n[E],Fl=!1,Wl=!C&&a.invertSwap||w),v=function(t,e,n,o,i,r,s,a){var l=o?t.clientY:t.clientX,c=o?n.height:n.width,d=o?n.top:n.left,h=o?n.bottom:n.right,u=!1;if(!s)if(a&&kl<c*i){if(!Fl&&(1===Dl?l>d+c*r/2:l<h-c*r/2)&&(Fl=!0),Fl)u=!0;else if(1===Dl?l<d+kl:l>h-kl)return-Dl}else if(l>d+c*(1-i)/2&&l<h-c*(1-i)/2)return function(t){return Ga(hl)<Ga(t)?1:-1}(e);if((u=u||s)&&(l<d+c*r/2||l>h-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,Wl,Ll===s),0!==v){var O=Ga(hl);do{O-=v,y=ul.children[O]}while(y&&("none"===Ba(y,"display")||y===pl))}if(0===v||y===s)return T(!1);Ll=s,Dl=v;var _=s.nextElementSibling,N=!1,A=nc(fl,r,hl,e,s,n,t,N=1===v);if(!1!==A)return 1!==A&&-1!==A||(N=1===A),zl=!0,setTimeout(ic,30),P(),N&&!_?r.appendChild(hl):s.parentNode.insertBefore(hl,N?_:s),x&&tl(x,0,S-x.scrollTop),ul=hl.parentNode,void 0===b||Wl||(kl=Math.abs(b-Ha(s)[E])),L(),T(!0)}if(r.contains(hl))return T(!1)}return!1}function j(a,l){cl(a,p,wa({evt:t,isOwner:d,axis:i?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:h,fromSortable:u,target:s,completed:T,onMove:function(n,o){return nc(fl,r,hl,e,n,Ha(n),t,o)},changed:L},l))}function P(){j("dragOverAnimationCapture"),p.captureAnimationState(),p!==u&&u.captureAnimationState()}function T(e){return j("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==u&&(Wa(hl,Sl?Sl.options.ghostClass:c.options.ghostClass,!1),Wa(hl,a.ghostClass,!0)),Sl!==p&&p!==ec.active?Sl=p:p===ec.active&&Sl&&(Sl=null),u===p&&(p._ignoreWhileAnimating=s),p.animateAll((function(){j("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==u&&(u.animateAll(),u._ignoreWhileAnimating=null)),(s===hl&&!hl.animated||s===r&&!s.animated)&&(Ll=null),a.dragoverBubble||t.rootEl||s===document||(hl.parentNode[ol]._isOutsideThisEl(t.target),!e&&Ql(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function L(){wl=Ga(hl),El=Ga(hl,a.draggable),dl({sortable:p,name:"change",toEl:r,newIndex:wl,newDraggableIndex:El,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){ka(document,"mousemove",this._onTouchMove),ka(document,"touchmove",this._onTouchMove),ka(document,"pointermove",this._onTouchMove),ka(document,"dragover",Ql),ka(document,"mousemove",Ql),ka(document,"touchmove",Ql)},_offUpEvents:function(){var t=this.el.ownerDocument;ka(t,"mouseup",this._onDrop),ka(t,"touchend",this._onDrop),ka(t,"pointerup",this._onDrop),ka(t,"touchcancel",this._onDrop),ka(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;wl=Ga(hl),El=Ga(hl,n.draggable),cl("drop",this,{evt:t}),ul=hl&&hl.parentNode,wl=Ga(hl),El=Ga(hl,n.draggable),ec.eventCanceled||(Il=!1,Wl=!1,Fl=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),ac(this.cloneId),ac(this._dragStartId),this.nativeDraggable&&(ka(document,"drop",this),ka(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ja&&Ba(document.body,"user-select",""),Ba(hl,"transform",""),t&&(Tl&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),pl&&pl.parentNode&&pl.parentNode.removeChild(pl),(fl===ul||Sl&&"clone"!==Sl.lastPutMode)&&vl&&vl.parentNode&&vl.parentNode.removeChild(vl),hl&&(this.nativeDraggable&&ka(hl,"dragend",this),oc(hl),hl.style["will-change"]="",Tl&&!Il&&Wa(hl,Sl?Sl.options.ghostClass:this.options.ghostClass,!1),Wa(hl,this.options.chosenClass,!1),dl({sortable:this,name:"unchoose",toEl:ul,newIndex:null,newDraggableIndex:null,originalEvent:t}),fl!==ul?(wl>=0&&(dl({rootEl:ul,name:"add",toEl:ul,fromEl:fl,originalEvent:t}),dl({sortable:this,name:"remove",toEl:ul,originalEvent:t}),dl({rootEl:ul,name:"sort",toEl:ul,fromEl:fl,originalEvent:t}),dl({sortable:this,name:"sort",toEl:ul,originalEvent:t})),Sl&&Sl.save()):wl!==yl&&wl>=0&&(dl({sortable:this,name:"update",toEl:ul,originalEvent:t}),dl({sortable:this,name:"sort",toEl:ul,originalEvent:t})),ec.active&&(null!=wl&&-1!==wl||(wl=yl,El=Cl),dl({sortable:this,name:"end",toEl:ul,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){cl("nulling",this),fl=hl=ul=pl=ml=vl=gl=bl=Ol=_l=Tl=wl=El=yl=Cl=Ll=Dl=Sl=xl=ec.dragged=ec.ghost=ec.clone=ec.active=null,ql.forEach((function(t){t.checked=!0})),ql.length=Nl=Al=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":hl&&(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<i;o++)Ma(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||rc(t));return e},sort:function(t,e){var n={},o=this.el;this.toArray().forEach((function(t,e){var i=o.children[e];Ma(i,this.options.draggable,o,!1)&&(n[t]=i)}),this),e&&this.captureAnimationState(),t.forEach((function(t){n[t]&&(o.removeChild(n[t]),o.appendChild(n[t]))})),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return Ma(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(void 0===e)return n[t];var o=al.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&Zl(n)},destroy:function(){cl("destroy",this);var t=this.el;t[ol]=null,ka(t,"mousedown",this._onTapStart),ka(t,"touchstart",this._onTapStart),ka(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(ka(t,"dragover",this),ka(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),Rl.splice(Rl.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!bl){if(cl("hideClone",this),ec.eventCanceled)return;Ba(vl,"display","none"),this.options.removeCloneOnHide&&vl.parentNode&&vl.parentNode.removeChild(vl),bl=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(bl){if(cl("showClone",this),ec.eventCanceled)return;hl.parentNode!=fl||this.options.group.revertClone?ml?fl.insertBefore(vl,ml):fl.appendChild(vl):fl.insertBefore(vl,hl),this.options.group.revertClone&&this.animate(hl,vl),Ba(vl,"display",""),bl=!1}}else this._hideClone()}},Ul&&Da(document,"touchmove",(function(t){(ec.active||Il)&&t.cancelable&&t.preventDefault()})),ec.utils={on:Da,off:ka,css:Ba,find:qa,is:function(t,e){return!!Ma(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},throttle:Qa,closest:Ma,toggleClass:Wa,clone:el,index:Ga,nextTick:sc,cancelNextTick:ac,detectDirection:Gl,getChild:Va,expando:ol},ec.get=function(t){return t[ol]},ec.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach((function(t){if(!t.prototype||!t.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));t.utils&&(ec.utils=wa(wa({},ec.utils),t.utils)),al.mount(t)}))},ec.create=function(t,e){return new ec(t,e)},ec.version="1.15.3";var lc,cc,dc,hc,uc,pc,fc=[],mc=!1;function gc(){fc.forEach((function(t){clearInterval(t.pid)})),fc=[]}function vc(){clearInterval(pc)}var bc=Qa((function(t,e,n,o){if(e.scroll){var i,r=(t.touches?t.touches[0]:t).clientX,s=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,l=e.scrollSpeed,c=Ua(),d=!1;cc!==n&&(cc=n,gc(),lc=e.scroll,i=e.scrollFn,!0===lc&&(lc=Ja(n,!0)));var h=0,u=lc;do{var p=u,f=Ha(p),m=f.top,g=f.bottom,v=f.left,b=f.right,y=f.width,w=f.height,C=void 0,E=void 0,x=p.scrollWidth,S=p.scrollHeight,O=Ba(p),_=p.scrollLeft,N=p.scrollTop;p===c?(C=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX||"visible"===O.overflowX),E=w<S&&("auto"===O.overflowY||"scroll"===O.overflowY||"visible"===O.overflowY)):(C=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX),E=w<S&&("auto"===O.overflowY||"scroll"===O.overflowY));var A=C&&(Math.abs(b-r)<=a&&_+y<x)-(Math.abs(v-r)<=a&&!!_),j=E&&(Math.abs(g-s)<=a&&N+w<S)-(Math.abs(m-s)<=a&&!!N);if(!fc[h])for(var P=0;P<=h;P++)fc[P]||(fc[P]={});fc[h].vx==A&&fc[h].vy==j&&fc[h].el===p||(fc[h].el=p,fc[h].vx=A,fc[h].vy=j,clearInterval(fc[h].pid),0==A&&0==j||(d=!0,fc[h].pid=setInterval(function(){o&&0===this.layer&&ec.active._onTouchMove(uc);var e=fc[this.layer].vy?fc[this.layer].vy*l:0,n=fc[this.layer].vx?fc[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(ec.dragged.parentNode[ol],n,e,t,uc,fc[this.layer].el)||tl(fc[this.layer].el,n,e)}.bind({layer:h}),24))),h++}while(e.bubbleScroll&&u!==c&&(u=Ja(u,!1)));mc=d}}),30),yc=function(t){var e=t.originalEvent,n=t.putSortable,o=t.dragEl,i=t.activeSortable,r=t.dispatchSortableEvent,s=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=n||i;s();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,d=document.elementFromPoint(c.clientX,c.clientY);a(),l&&!l.el.contains(d)&&(r("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function wc(){}function Cc(){}wc.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=Va(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(e,o):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:yc},xa(wc,{pluginName:"revertOnSpill"}),Cc.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:yc},xa(Cc,{pluginName:"removeOnSpill"}),ec.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?Da(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Da(document,"pointermove",this._handleFallbackAutoScroll):e.touches?Da(document,"touchmove",this._handleFallbackAutoScroll):Da(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?ka(document,"dragover",this._handleAutoScroll):(ka(document,"pointermove",this._handleFallbackAutoScroll),ka(document,"touchmove",this._handleFallbackAutoScroll),ka(document,"mousemove",this._handleFallbackAutoScroll)),vc(),gc(),clearTimeout(Ra),Ra=void 0},nulling:function(){uc=cc=lc=mc=pc=dc=hc=null,fc.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var n=this,o=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,r=document.elementFromPoint(o,i);if(uc=t,e||this.options.forceAutoScrollFallback||Na||_a||ja){bc(t,this.options,r,e);var s=Ja(r,!0);!mc||pc&&o===dc&&i===hc||(pc&&vc(),pc=setInterval((function(){var r=Ja(document.elementFromPoint(o,i),!0);r!==s&&(s=r,gc()),bc(t,n.options,r,e)}),10),dc=o,hc=i)}else{if(!this.options.bubbleScroll||Ja(r,!0)===Ua())return void gc();bc(t,this.options,Ja(r,!1),!1)}}},xa(t,{pluginName:"scroll",initializeByDefault:!0})}),ec.mount(Cc,wc);const Ec={add:{attr:t=>{const e=window.prompt(t.message.attr);if(e&&t.isDisabled(e))return window.alert(i.get("attributeNotPermitted",e||"")),xc.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:Zi}},xc={init:function(t){const e=Object.keys(Ec);return this.opts=e.reduce(((e,n)=>(e[n]={...Ec[n],...t[n]},e)),t),this},add:{attrs:t=>xc.opts.add.attr(t),options:t=>xc.opts.add.option(t),conditions:t=>(t.template={if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]},xc.opts.add.condition(t))},click:{btn:t=>xc.opts.click.btn(t)},save:{form:t=>(xc.opts.sessionStorage&&Xi.set(W,t),Jr.formeoSaved({formData:t}),xc.opts.save.form(t))}},Sc=Object.freeze({type:"field",displayType:"slider"}),Oc=t=>({transform:`translateX(${t?`${t}px`:0})`});class _c{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=Rd.getStyle(this.currentPanel,"height");return t.height=e,e})),this.opts=zi(Sc,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)}),U)}getPanelDisplay(){const t=this.panelsWrap,e=Number.parseInt(Rd.getStyle(t,"width"))>390?"tabbed":"slider",n="auto"===this.opts.displayType;return this.panelDisplay=n?e:this.opts.displayType||Sc.displayType,this.panelDisplay}createPanelsWrap(){const t=Rd.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 Xr.forEach(e,(t=>{t.fieldId=this.opts.id,t.isSortable&&ec.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=Fr(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",Rd.create(e)}createPanelNav(){this.labels=this.createPanelNavLabels();const t={tag:"button",attrs:{className:"next-group",title:i.get("controlGroups.nextGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.nextGroup(t)},content:Rd.icon("triangle-right")},e={tag:"button",attrs:{className:"prev-group",title:i.get("controlGroups.prevGroup"),type:"button"},dataset:{toggle:"tooltip",placement:"top"},action:{click:t=>this.nav.prevGroup(t)},content:Rd.icon("triangle-left")};return Rd.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=Fr(this.currentPanel,e);let r={nav:0,panel:0},s={...r};t.groupChange=t=>(this.activePanelIndex=t,this.currentPanel=i[t],Rd.removeClasses(i,"active-panel"),Rd.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=q,animate:r=!this.isTabbed})=>{const a=[Oc(s.panel),Oc(t.panel)],l=[Oc(s.nav),Oc(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 h=()=>{this.panelsWrap.style.height=Rd.getStyle(this.currentPanel,"height"),d.removeEventListener("finish",h),o||(s=t)};d.addEventListener("finish",h)};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 Nc="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`)),Ac=new RegExp(`(?!${Nc.join("|")})\\w\\S*`,"g"),jc=/\s+/g;function Pc(t){if("string"!=typeof t)return t;if(t.trim().match(jc))return t;return t.replace(Ac,(t=>t.charAt(0).toUpperCase()+t.substring(1).replace(/[A-Z]/g,(t=>` ${t}`))))}const Tc=(t,e="-")=>t.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e),Lc="f-autocomplete",Dc="highlight-component",kc=({name:t,id:e,...n})=>["config.label","config.controlId","meta.id","attrs.id"].reduce(((t,e)=>t||n.get(e)),null)||"external"===t&&((...t)=>i.get(t.join("."))||Pc(t.join(" ")))(t,e);class $c{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=Rd.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=Rd.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=Rd.create({tag:"input",autocomplete:"off",action:e,attrs:{type:"text",className:`${Lc}-display-field`,value:this.label||this.value,placeholder:i.get(`${this.i18nKey}.${this.key}.placeholder`)}}),this.hiddenField=Rd.create({tag:"input",attrs:{type:"hidden",className:this.className,value:this.value}}),this.list=Rd.create({tag:"ul",attrs:{className:`${Lc}-list`}}),this.dom=Rd.create({children:[this.displayField,this.hiddenField],className:this.className,action:{onRender:t=>{this.stage=t.closest(".formeo-stage");const e=this.value&&$d.getAddress(this.value);this.label=e&&kc(e),this.label&&(this.displayField.value=this.label)}}}),this.dom}updateOptions(){let t=this.optionsCache;const e=Date.now();(!t||e-this.lastCache>10*U)&&(Rd.empty(this.list),t=this.generateOptions(),this.lastCache=e),this.list.children.length||this.list.append(...t)}generateOptions(){const t=(t=>{const e=[],n=$d.flatList(),o=Object.entries(n).map((([n,o])=>{const i=kc(o);if(i){const r={tag:"span",content:` ${Pc(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=`${Lc}-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:`${Lc}-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 Rd.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),Vr.slideDown(e,q)}hideList(t=this.list){Vr.slideUp(t,q),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=$d.getAddress(t).dom)||n.classList.remove(Dc)}}t&&(t.classList.add("active-option"),this.highlightComponent(t))}removeHighlight(){const t=document.getElementsByClassName(Dc);for(const e of t)e.classList.remove(Dc)}highlightComponent(t){var e;const{dataset:{value:n}}=t;if(n){null==(e=$d.getAddress(n).dom)||e.classList.add(Dc)}}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 Ic=(t,e)=>{const n=(t=>{const e=Yi(t),n={"field.property":G,...Z},o=e?(i=t,$d.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,r])=>{if("id"!==o){const s={tag:"option",content:i.get(`${t}.${o}`)||o.toLowerCase(),attrs:{value:r}};e===r&&(s.attrs.selected=!0),n.push(Rd.create(s))}return n}),[])},Mc=(t,e)=>{Rd.empty(t);for(const n of e)t.add(n)},Rc=({key:t,value:e,type:n="text",checked:o})=>{const r={tag:"input",attrs:{type:n,value:e,placeholder:i.get(`${t}.placeholder`)||Pc(t)},className:t.replace(/\./g,"-"),config:{}};return o&&(r.attrs.checked=!0),r},Fc=t=>{const e=i.get(t);if(e)return e;const n=t.split(".");return i.get(n[n.length-1])},Wc={autocomplete:(t,e,n)=>new $c(t,e,n),string:(t,e)=>Rc({key:t,value:e}),boolean:(t,e)=>Rc({key:t,value:e,type:"selected"===t?"radio":"checkbox",checked:e}),number:(t,e)=>Rc({key:t,value:e,type:"number"}),array:(t,e=[])=>({tag:"select",attrs:{placeholder:Fc(`placeholder.${t}`)},className:t.replace(/\./g,"-"),options:e}),object:t=>Object.entries(t).map((([t,e])=>Wc[Rd.childType(e)](t,e)))},Bc=["selected","checked"],zc={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 qc{constructor({key:t,data:n,index:o,field:r}){e(this,"generateConditionFields",((t,e)=>{const n={tag:"label",className:`condition-label ${t}-condition-label`,content:i.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=Wr(r,Y.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)}),z)},o=t=>{t=Array.isArray(t)?t:[t];const e=setTimeout((()=>{t.forEach((t=>{t.dom&&(t=t.dom),t.removeAttribute("style")})),clearTimeout(e)}),z)},i=new Map([["condition-source",t=>{const i=e("condition-sourceProperty"),r=i[0],s=Yi(t.value)?t.value:"field.property",a=Ic(s,r.value);return Mc(r,a),t.value?o(i):n(i)}],["condition-target",t=>{const i=e("condition-targetProperty");return Vi(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=Ic(n||t,e),i=Wc.array(`condition.${t}`);i.action={change:c,onRender:t=>c({target:t})};const r=Rd.create(i);return Mc(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};Jr.formeoUpdated(o),$d.setAddress(a,t.value);const i=Fr(e);this.processConditionUIState(this.itemFieldGroups[i])},d={comparison:t=>l("comparison",t),logical:t=>l("logical",t),source:(t,e="source")=>{const o=Wc.autocomplete(`condition.${e}`,t,n);return $d.setConditionMap(t,i),o.addEvent("onChange",(t=>{$d.removeConditionMap($d.getAddress(a)),c(t),$d.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=Wc.string("condition.value",t);return e.action={input:c},Rd.create(e)},assignment:t=>l("assignment",t)};if(d[t])return d[t](e)})),this.itemValues=Wr(Object.entries(n),Bc,"0");const[s,a]=t.split(".");this.field=r,this.itemKey=t,this.itemIndex=o,this.panelName=s,this.isDisabled=r.isDisabledProp(a,s),this.isHidden=this.isDisabled&&r.config.panels[s].hideDisabled,this.isLocked=r.isLockedProp(a,s),this.dom=Rd.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:()=>{Vr.slideUp(this.dom,250,(t=>{this.field.remove(this.itemKey),Rd.remove(t),this.field.resizePanelWrap()}))}},content:Rd.icon("remove")};return{className:`${this.panelName}-prop-controls prop-controls`,content:[t]}}itemInput(t,e){const n=Rd.childType(e)||"string",o={config:{},attrs:{},...Wc[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&&(Fc(r)||Pc(r)),labelAfter:!1},o.attrs={...o.attrs,name:"checkbox"===o.attrs.type?`${a}[]`:a,id:s,disabled:this.isDisabled,locked:this.isLocked},o.action={...zc[n](i,this.field)},o}}class Uc{constructor(t,n,o){e(this,"addAttribute",((t,e)=>{let n=e;const o=Tc(t),r=`attrs.${o}`;i.current[r]||i.put(r,Ur(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 qc({key:r,data:{[o]:n},field:this.field});s?this.props.replaceChild(a.dom,s):this.props.appendChild(a.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=i.get("newOptionLabel",{type:n})||"New Option",r=`options.${this.data.length}`,s=e[e.length-1],a={...e.length?s:{},label:o};"button"!==t&&(a.value=Tc(o));const l=new qc({key:r,data:a,field:this.field,index:this.props.children.length});this.editPanelItems.push(l),this.props.appendChild(l.dom),this.field.set(r,a),this.field.resizePanelWrap()})),e(this,"addCondition",(t=>{const e=`conditions.${this.field.get("conditions").length}`,n=this.props.querySelector(`.field-${e.replace(".","-")}`),o=new qc({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=Rd.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:i.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 qc({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 Rd.create(e)}createEditButtons(){const t=this,e=this.name,n=i.get(`panelEditButtons.${e}`),o={attrs:t.addAttribute,options:t.addOption,conditions:t.addCondition};return{className:"panel-action-buttons",content:[{...Rd.btnTemplate({content:n,title:n}),className:`add-${e}`,action:{click:n=>{const r={btnCoords:Rd.coords(n.target),addAction:o[e]};"attrs"===e&&(r.isDisabled=t.field.isDisabledProp,r.isLocked=t.field.isLockedProp,r.message={attr:i.get(`action.add.${e}.attr`),value:i.get(`action.add.${e}.value`)});const s=Pc(e),a=new window.CustomEvent(`onAdd${s}`,{detail:r});xc.add[e](r),document.dispatchEvent(a)}}}]}}}class Hc extends ba{constructor(t,n={},o){super(t,{...n,id:n.id||Bi()}),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)?Rr(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 Br(n,(t=>t.remove())),this.dom.parentElement.removeChild(this.dom),((t,e)=>{const n=t.indexOf(e);-1!==n&&t.splice(n,1)})($d.getAddress(`${e.name}s.${e.id}.children`),this.id),e.children.length||e.emptyClass(),"row"===e.name&&e.autoColumnWidths(),$d[`${this.name}s`].delete(this.id)})),e(this,"emptyClass",(()=>this.dom.classList.toggle("empty",!this.children.length))),e(this,"getComponentTag",(()=>Rd.create({tag:"span",className:["component-tag",`${this.name}-tag`],children:[(this.isColumn||this.isField)&&Rd.icon("component-corner",{className:"bottom-left"}),Rd.icon(`handle-${this.name}`),Pc(this.name),(this.isColumn||this.isRow)&&Rd.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[Rd.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-${Fi(t)}`),null==e||e.classList.remove(`hovering-${Fi(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,!G[i]].some(Boolean)?t:e?o.set(G[i],e):o.get(G[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={...qi(this.data),id:Bi()};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=>Rd.create({tag:"ul",attrs:{className:"children"},children:t}))),this.id=this.data.id,this.name=t,this.config=$d[`${this.name}s`].config,zi(this.config,n.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.data.children=this.data.children.filter((e=>-1===t.indexOf(e))),this.dom.classList.add("empty"),t}getActionButtons(){const t=[`hovering-${this.name}`,"hovering"];return{className:[`${this.name}-actions`,"group-actions"],action:{mouseenter:()=>{$d.stages.active.dom.classList.add(`active-hover-${this.name}`),this.dom.classList.add(...t)},mouseleave:({target:e})=>{this.dom.classList.remove(...t),$d.stages.active.dom.classList.remove(`active-hover-${this.name}`),e.removeAttribute("style")}},children:[{...Rd.btnTemplate({content:Rd.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`);Vr.slideToggle(i,z,t),"field"===this.name&&(Vr.slideToggle(this.preview,z,!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}`)=>({...Rd.btnTemplate({content:Rd.icon(t)}),className:["component-handle"]}),move:(t="move")=>({...Rd.btnTemplate({content:Rd.icon(t)}),className:["item-move"],meta:{id:"move"}}),edit:(t="edit")=>({...Rd.btnTemplate({content:Rd.icon(t)}),className:["item-edit-toggle"],meta:{id:"edit"},action:{click:t=>{this.toggleEdit()}}}),remove:(t="remove")=>({...Rd.btnTemplate({content:Rd.icon(t)}),className:["item-remove"],meta:{id:"remove"},action:{click:(t,e)=>{Vr.slideUp(this.dom,z,(()=>{if("column"===this.name){this.parent.autoColumnWidths(),this.remove()}else this.remove()}))}}}),clone:(t="copy")=>({...Rd.btnTemplate({content:Rd.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 Fr(this.dom)}get parentType(){return M.get(this.name)}get parent(){const t=this.parentType;if(!this.dom||!t)return null;const e=this.dom.closest(`.${P[t]}`);return e&&Rd.asComponent(e)}get children(){if(!this.dom)return[];const t=this.domChildren,e=I.get(this.name);return zr(t,(t=>$d.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=Bi()}=i,a=I.get(this.name);if(!a)return null;const l=`${a}s`,c=$d.getAddress(`${l}.${s}`)||$d[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(b)||(t=t.parentElement);const r=Fi(t),s=Fi(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=Fr(this.dom);return()=>this.parent.addChild(t,e+1)}],[2,t=>()=>this.parent.parent.addChild(t)]]),l={controls:()=>{const{controlData:{meta:{id:t},...e}}=ud.get(n.id);Mr(e,"config.controlId",t);const i=t.startsWith("layout-")?t.replace(/^layout-/,""):"field",r=Ir({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)();Rd.remove(n);return s(e,o)},row:()=>{const t=(a.get({stage:-1,row:0,column:1}[s])||Zi)();return null==t?void 0:t({id:n.id},o)},column:()=>{const t=(a.get({stage:-2,row:-1}[s])||Zi)();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(C)&&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&&Rd.onRender(this.dom,t.onRender)}set config(t){const e=Ir(t,"all"),n=Ir(this.data,"config.controlId"),o=[e,n&&Ir(t,n),Ir(t,this.id)].reduce(((t,e)=>e?zi(t,e):t),this.configVal);this.configVal=o}get config(){return this.configVal}getComponent(t){const[e,n]=t.split("."),o=$d[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===A.row}get isColumn(){return this.name===A.column}get isField(){return this.name===A.field}}class Xc extends Hc{constructor(t=Object.create(null)){super("field",{conditions:[{if:[{source:"",sourceProperty:"",comparison:"",target:"",targetProperty:""}],then:[{target:"",targetProperty:"",assignment:"",value:""}]}],...t}),e(this,"updateConditionsPanel",Gi((()=>{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)}),z)),e(this,"updatePreview",(()=>{if(!this.preview.parentElement)return null;this.updateLabel();const t=Rd.create(this.fieldPreview(),!0);this.preview.parentElement.replaceChild(t,this.preview),this.preview=t})),e(this,"updateEditPanels",(()=>{this.editPanels=[];const t=["object","array"],e=Wi([...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=Rd.childType(e);if(t.includes(n)){const t=new Uc(e,r,this);this.editPanels.push(t)}}const i={panels:this.editPanels.map((({panelConfig:t})=>t)),id:this.id,displayType:"auto"};this.panels=new _c(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${Pc(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${Pc(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=Rd.create(this.labelConfig),this.preview=Rd.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 r={tag:"li",attrs:{className:E},id:this.id,children:[this.label,this.getComponentTag(),n,o&&this.fieldEdit,this.preview].filter(Boolean),panelNav:this.panelNav,dataset:{hoverTag:i.get("field")}};r=Rd.create(r),this.observe(r),this.dom=r,this.isEditing=!1,this.onRender(r)}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=$d.getConditionMap(`fields.${this.id}`);if(i)return i.updateConditionSourceLabel(`${this.name}s.${this.id}`,n?o:e)}}},e&&Rd.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=Rd.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",Rd.remove(e)}else this.resizePanelWrap()}},Rd.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=Fr(e,n);return super.set(`options[${o}].label`,t.target.innerHTML),this.debouncedUpdateEditPanels()}super.set("content",t.target.innerHTML)}}}}fieldPreview(){var t;const e=qi(this.data),{action:n={}}=ud.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:Rd.create(e,!0),action:this.defaultPreviewActions}}}const Vc={js:new Set,css:new Set},Yc=(t,e,n=Ji)=>new Promise((o=>fetch(t).then((t=>{if(!t.ok)return o(n(t));o(e?e(t):t)})).catch((t=>n(t))))),Gc=(t,e)=>{t.removeEventListener("load",Gc),e(t.src)},Zc=(t,e)=>{t.removeEventListener("load",Zc),e(t.src)},Jc=t=>new Promise(((e,n)=>{if(Vc.js.has(t))return e(t);Vc.js.add(t);const o=Rd.create({tag:"script",attrs:{type:"text/javascript",async:!0,src:t},action:{load:()=>Zc(o,e),error:()=>n(new Error(`${t} failed to load.`))}});document.head.appendChild(o)})),Kc=t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>new Promise(((e,n)=>{if(Vc.css.has(t))return e(t);Vc.css.add(t);const o=Rd.create({tag:"link",attrs:{rel:"stylesheet",href:t},action:{load:()=>Gc(o,e),error:()=>n(new Error(`${(void 0).src} failed to load.`))}});document.head.appendChild(o)}))));return Promise.all(e)},Qc=async(t=m)=>{if(document.getElementById(p))return;const e=async t=>(t=>{let e=document.getElementById(p);return e||(e=Rd.create({id:p,children:t,attrs:{hidden:!0,style:"display: none;"}}),document.body.insertBefore(e,document.body.childNodes[0])),e})(await t.text());return Yc(t,e,(()=>Yc(g,e)))},td={js:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>Jc(t)));return Promise.all(e)},css:t=>{const e=(t=Array.isArray(t)?t:[t]).map((t=>Kc(t)));return Promise.all(e)}},ed=t=>{const e=Object.entries(t).map((([t,e])=>td[t](e)));return Promise.all(e)},nd=()=>{const t=document.getElementById(p);return"hidden"===window.getComputedStyle(t).visibility};class od{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||Bi()}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:Rd.icon(t.icon)},n],action:{focus:({target:t})=>{const e=t.closest(`.${b}`);return e&&ud.panels.nav.refresh(Fr(e))},click:({target:t})=>{ud.addElement(t.parentElement.id)}}};return Rd.create({tag:"li",id:this.id,className:["field-control",`${t.group}-control`,`${t.id}-control`],content:o,meta:t,action:this.controlAction})}promise(){return ed(this.dependencies)}i18n(t,e){var n,o;const r=i.locale,s=null==(n=this.definition)?void 0:n.i18n,a=(null==s?void 0:s[r])||{};return((null==(o=a[t])?void 0:o.call(a))??a[t])||i.get(t,e)}}const id=[{config:{label:"row"},meta:{group:"layout",icon:"rows",id:"layout-row"}},{config:{label:"column"},meta:{group:"layout",icon:"columns",id:"layout-column"}}];const rd=(t,e=3)=>Array.from({length:e},((t,e)=>e+1)).map((e=>{const n="checkbox"===t?"checked":"selected";return{label:i.get("labelCount",{label:Pc(t),count:e}),value:`${t}-${e}`,[n]:!e}}));const sd=[class extends od{constructor(){super({tag:"button",attrs:{className:[{label:"grouped",value:"f-btn-group"},{label:"ungrouped",value:"f-field-group"}]},config:{label:i.get("controls.form.button"),hideLabel:!0},meta:{group:"common",icon:"button",id:"button"},options:[{label:i.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 od{constructor(){super({tag:"input",attrs:{type:"date",required:!1,className:""},config:{label:i.get("controls.form.input.date")},meta:{group:"common",icon:"calendar",id:"date-input"}})}},class extends od{constructor(){super({tag:"input",attrs:{type:"hidden",value:""},config:{label:i.get("hidden"),hideLabel:!0},meta:{group:"common",icon:"hidden",id:"hidden"}})}},class extends od{constructor(){super({tag:"input",attrs:{type:"number",required:!1,className:""},config:{label:i.get("number")},meta:{group:"common",icon:"hash",id:"number"}})}},class extends od{constructor(){super({tag:"textarea",config:{label:i.get("controls.form.textarea")},meta:{group:"common",icon:"textarea",id:"textarea"},attrs:{required:!1}})}},class extends od{constructor(){super({tag:"input",attrs:{required:!1,type:"text",className:""},config:{label:i.get("controls.form.input.text")},meta:{group:"common",icon:"text-input",id:"text-input"}})}},class extends od{constructor(){super({tag:"input",attrs:{type:"file",required:!1},config:{label:i.get("fileUpload")},meta:{group:"common",icon:"upload",id:"upload"}})}},class extends od{constructor(){super({tag:"select",config:{label:i.get("controls.form.select")},attrs:{required:!1,className:""},meta:{group:"common",icon:"select",id:"select"},options:rd("option")})}},class extends od{constructor(){super({tag:"input",attrs:{type:"checkbox",required:!1},config:{label:i.get("controls.form.checkbox-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"checkbox",id:"checkbox"},options:rd("checkbox",1)})}},class extends od{constructor(){super({tag:"input",attrs:{type:"radio",required:!1},config:{label:i.get("controls.form.radio-group"),disabledAttrs:["type"]},meta:{group:"common",icon:"radio-group",id:"radio"},options:rd("radio")})}}],ad=Array.from(Array(5).keys()).slice(1).map((t=>`h${t}`)),ld="controls.html.header";const cd=[class extends od{constructor(){super({tag:ad[0],attrs:{tag:ad.map(((t,e)=>({label:t.toUpperCase(),value:t,selected:!e}))),className:""},config:{label:i.get(ld),hideLabel:!0,editableContent:!0},meta:{group:"html",icon:"header",id:"html.header"},content:i.get(ld),action:{}})}static get definition(){return{i18n:{"en-US":{header:"Custom English Header"}}}}get content(){return super.i18n(ld)}},class extends od{constructor(){super({tag:"p",attrs:{className:""},config:{label:i.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 od{constructor(){super({tag:"hr",config:{label:i.get("controls.html.divider"),hideLabel:!0},meta:{group:"html",icon:"divider",id:"divider"}})}},class extends od{constructor(t){super(zi({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))}}],dd=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"}}),hd=[...sd,...cd,...id];const ud=new class{constructor(){e(this,"groupLabel",(t=>i.get(t)||t||"")),e(this,"layoutTypes",{row:()=>Ad.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}=Ir(this.get(t),"controlData");return Mr(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}=zi(dd,t);return this.container=e,this.groupOrder=Wi(o.concat(["common","html","layout"])),this.options=i,Promise.all(this.registerControls([...hd,...n]))})),this.data=new Map,this.buttonActions={focus:({target:t})=>{const e=t.closest(`.${b}`);return e&&this.panels.nav.refresh(Fr(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 od(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=Wr(t,this.groupOrder,"id"),t=t.filter((t=>Ri(t.id,this.options.disable.groups))),n=t.map((t=>{const n={tag:"ul",attrs:{className:b,id:`${t.id}-${b}`},config:{label:this.groupLabel(t.label)}};if(this.options.elementOrder[t.id]){const e=this.options.elementOrder[t.id],n=Wi(e.concat(t.elementOrder));t.elementOrder=n}return e=Wr(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=[Ri(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=qi(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 qi(this.data.get(t))}formActions(){if(!0===this.options.disable.formActions)return null;const t={...Rd.btnTemplate({content:[Rd.icon("bin"),i.get("clear")],title:i.get("clearAll")}),className:["clear-form"],action:{click:t=>{jd.size?(Jr.confirmClearAll=new window.CustomEvent("confirmClearAll",{detail:{confirmationMessage:i.get("confirmClearAll"),clearAllAction:()=>{Ad.clearAll().then((()=>{const e={src:t.target};Jr.formeoCleared(e)}))},btnCoords:Rd.coords(t.target)}}),document.dispatchEvent(Jr.confirmClearAll)):window.alert(i.get("cannotClearFields"))}}},e={...Rd.btnTemplate({content:[Rd.icon("floppy-disk"),i.get("save")],title:i.get("save")}),className:["save-form"],action:{click:({target:t})=>{const{formData:e}=$d,n={action:()=>{},coords:Rd.coords(t),message:"",button:t};return xc.click.btn(n),xc.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 _c({panels:e,type:"controls",displayType:o});const r=["control-groups","formeo-panels-wrap",`panel-count-${e.length}`],s=Rd.create({className:r,content:[this.panels.panelNav,this.panels.panelsWrap]}),a=["formeo-controls"];t&&a.push("formeo-sticky");const l=Rd.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(Rd.toggleElementsByStr(n,t),e){const e=i.get("controls.filteringTerm",t);l.classList.add("filtered"),o?o.textContent=e:(o=Rd.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 i=c.length-1;i>=0;i--){const t=`formeo-controls-${c[i]}`;this.options.sortable||window.localStorage.removeItem(t),ec.create(c[i],{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 Xc(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 pd extends ba{constructor(){super(...arguments),e(this,"load",(t=>{const e=this.parseformData(t);this.empty();for(const[n,o]of Object.entries(e))this.add(n,o);return this.data})),e(this,"get",(t=>t?Ir(this.data,t):this.add())),e(this,"add",((t,e=Object.create(null))=>{const n=t||Bi(),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=zi(this.configVal,qi(t))}get config(){return this.configVal}}class fd extends Hc{constructor(t,e){super("stage",{...Object.freeze({children:[]}),...t},e);const n=this.createChildWrap();this.dom=Rd.create({attrs:{className:[y,"empty"],id:this.id},children:n}),ec.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:()=>{md.active=this},onSort:this.onSort.bind(this),draggable:`.${w}`,handle:".item-move"})}empty(t=!0){return new Promise((e=>{t?(this.dom.classList.add("removing-all-fields"),Vr.slideUp(this.dom,z,(()=>{e(super.empty(t)),this.dom.classList.remove("removing-all-fields"),Vr.slideDown(this.dom,z)}))):e(super.empty())}))}onAdd(...t){const e=super.onAdd(...t);e&&"column"===e.name&&e.parent.autoColumnWidths()}}const md=new class extends pd{constructor(t){super("stages",t)}Component(t){return new fd(t)}};class gd extends Hc{constructor(t){super("row",{...Object.freeze({config:{fieldset:!1,legend:"",inputGroup:!1},children:[],className:[w]}),...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(K);const t=n.dom,o=Hi(e);n.set("config.width",o),t.style.width=o,t.dataset.colWidth=o;const i=setTimeout((()=>{clearTimeout(i),n.refreshFieldPanels()}),q);document.dispatchEvent(Jr.columnResized)}this.updateColumnPreset()})),e(this,"updateColumnPreset",(()=>{this.columnPresetControl.innerHTML="";const t=this.getColumnPresetOptions.map((({label:t,...e})=>Rd.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=Rd.create({tag:"li",className:[w,"empty"],dataset:{hoverTag:i.get("row"),editingHoverTag:i.get("editing.row")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),this.editWindow,n]}),ec.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:`.${C}`,handle:".item-move"})}get editWindow(){const t={tag:"input",id:`${this.id}-fieldset`,attrs:{type:"checkbox",checked:this.get("config.fieldset"),ariaLabel:i.get("row.settings.fieldsetWrap.aria")},action:{click:({target:{checked:t}})=>{this.set("config.fieldset",Boolean(t))}},config:{label:i.get("row.settings.fieldsetWrap")}},e={tag:"input",id:`${this.id}-inputGroup`,attrs:{type:"checkbox",checked:this.get("config.inputGroup"),ariaLabel:i.get("row.settings.inputGroup.aria")},action:{click:({target:{checked:t}})=>this.set("config.inputGroup",t)},config:{label:i.get("row.makeInputGroup"),description:i.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=Rd.formGroup([t,n]),r={tag:"label",content:i.get("defineColumnWidths"),className:"col-sm-4 form-control-label"};this.columnPresetControl=Rd.create(this.columnPresetControlConfig);const s={className:"col-sm-8",content:this.columnPresetControl,action:{onRender:()=>{this.updateColumnPreset()}}},a=[e,"hr",o,"hr",Rd.formGroup([r,s],"row")];return Rd.create({className:`${this.name}-edit group-config`,action:{onRender:t=>{const e=a.map((t=>Rd.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=R.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:x}),t.map((t=>{const e={...t};return e.selected=t.value===n,e}))}return[]}get columnPresetControlConfig(){return{tag:"select",attrs:{ariaLabel:i.get("defineColumnLayout"),className:S},action:{change:({target:t})=>{const{value:e}=t;this.setColumnWidths(e)}},options:this.getColumnPresetOptions}}}const vd={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]}};const bd=new class extends pd{constructor(t){super("rows",t),this.config={all:vd}}Component(t){return new gd(t)}};class yd{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=Rd.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(`.${w}`);if(this.validateResizeTarget(e,n))if(this.startX="touchstart"===t.type?t.touches[0].clientX:t.clientX,o.classList.add(O),this.columnPreset=o.querySelector(`.${S}`),this.originalColumnClass=e.className,this.originalSiblingClass=n.className,e.className=e.className.replace(K,""),n.className=n.className.replace(K,""),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(Ui(e,this.rowWidth)),i=parseFloat(Ui(n,this.rowWidth));return o<10||i<10?null:{colWidth:Hi(o.toFixed(1)),siblingColWidth:Hi(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(),$d.setAddress(`columns.${t.id}.config.width`,t.dataset.colWidth),$d.setAddress(`columns.${e.id}.config.width`,e.dataset.colWidth),this.row.classList.remove(O),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(O),window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onStop)}setCustomWidthValue(){const t=this.columnPreset;let e=t.querySelector(`.${x}`);const n=this.row.querySelector(".children").children,o=zr(n,(t=>Ui(t.clientWidth,this.rowWidth).toFixed(1))),i=o.join(","),r=o.join(" | ");return e||(e=Rd.create({tag:"option",attrs:{className:x,value:i,selected:!0},content:r}),t.append(e)),e.value=i,e.textContent=r,i}}const wd=t=>({className:"resize-x-handle",action:{pointerdown:t.onStart.bind(t)},content:[Rd.icon("triangle-down"),Rd.icon("triangle-up")]}),Cd=()=>({className:"column-edit group-config"});class Ed extends Hc{constructor(t){super("column",{...Object.freeze({config:{width:"100%"},children:[],className:[C]}),...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=Rd.create({tag:"li",className:[C,"empty"],dataset:{hoverTag:i.get("column")},id:this.id,content:[this.getComponentTag(),this.getActionButtons(),Cd(),wd(new yd),n]}),this.processConfig(),Jr.columnResized=new window.CustomEvent("columnResized",{detail:{column:this.dom,instance:this}}),ec.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:`.${E}`,handle:".item-move"})}processConfig(){const t=Xr.get(this.data,"config.width");t&&this.setDomWidth(t)}}const xd={actionButtons:{buttons:["clone","move","remove"],disabled:[]}};const Sd=new class extends pd{constructor(t){super("columns",t),this.config={all:xd}}Component(t){return new Ed(t)}},Od={actionButtons:{buttons:["move","edit","clone","remove"],disabled:[]},panels:{disabled:[],attrs:{disabled:["type"],hideDisabled:!0,locked:[]},order:["attrs","options","conditions"]},label:{disableHTML:!1}};const _d=new class extends pd{constructor(t){super("fields",t),e(this,"get",(t=>{let e=t&&Ir(this.data,t);if(!e){const n=ud.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=this.parseformData(t);this.empty();for(const[n,o]of Object.entries(e)){const{meta:t,...e}=o;(null==t?void 0:t.id)&&Mr(e,"config.controlId",null==t?void 0:t.id),this.add(n,e)}return this.data})),this.config={all:Od}}Component(t){return new Xc(t)}};const Nd=new class extends pd{constructor(t){super("externals",t)}Component(t){return new Hc("external",t)}},Ad=md,jd=bd,Pd=Sd,Td=_d,Ld=ud,Dd=Nd,kd={id:Bi()};const $d=new class extends ba{constructor(t){super("components"),e(this,"sessionFormData",(()=>{var t;if(null==(t=this.opts)?void 0:t.sessionStorage)return Xi.get(W)})),e(this,"load",((t,e=this.opts||Object.create(null))=>{let n=t;this.empty(),"string"==typeof t&&(n=JSON.parse(t)),this.opts=e;const{stages:o={[Bi()]:{}},rows:i,columns:r,fields:s,id:a=Bi()}={...this.sessionFormData(),...n};this.set("id",a),this.add("stages",Ad.load(o)),this.add("rows",jd.load(i)),this.add("columns",Pd.load(r)),this.add("fields",Td.load(s)),this.add("externals",Dd.load(e.external));for(const l of Object.values(this.get("stages")))l.loadChildren();return this.data})),this.opts=t,this.data=kd,this.disableEvents=!0,this.stages=Ad,this.rows=jd,this.columns=Pd,this.fields=Td,this.controls=Ld,this.externals=Dd}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@${u}/dist/formData_schema.json`,...this.formData})}get formData(){return{id:this.get("id"),stages:md.getData(),rows:bd.getData(),columns:Sd.getData(),fields:_d.getData()}}set config(t){const{stages:e,rows:n,columns:o,fields:i}=t;Ad.config=e,jd.config=n,Pd.config=o,Td.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(!Vi(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(Vi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.get(e[1])}}setConditionMap(t,e){if(Vi(t)){const n=t.split(".");return n.every((t=>Boolean(t)))&&this[n[0]].conditionMap.set(n[1],e)}}removeConditionMap(t){if(Vi(t)){const e=t.split(".");return e.every((t=>Boolean(t)))&&this[e[0]].conditionMap.delete(e[1])}}},Id={glyphicons:t=>`<span class="glyphicon glyphicon-${t}" aria-hidden="true"></span>`,"font-awesome":t=>{const[e,n]=t.split(" ");return`<i class="${e} fa-${n}"></i>`},fontello:t=>`<i class="${Q}${t}">${t}</i>`},Md=new Set(["input","textarea","select"]);const Rd=new class{constructor(t=Object.create(null)){e(this,"render",(t=>(t.id=`f-${t.id||Bi()}`,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 h={attrs:{},className:[Xr.get(a,"config.inputWrap")||"f-field-group"],children:[],config:{}};let u=document.createElement(c);const p={string:t=>{u.innerHTML+=t},object:t=>t&&u.appendChild(n.create(t,e)),node:t=>u.appendChild(t),component:t=>u.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=zi(a.attrs,{className:i})),r){const t=this.processOptions(r,a,e);if(!this.holdsContent(u)||"button"===c)return Xr.forEach(t,(t=>{h.children.push(n.create(t,e))})),a.attrs.className&&(h.className=a.attrs.className),h.config={...a.config},this.create(h,e);p.array.call(this,t),a.content=void 0,o.push("options")}if(a.attrs&&(n.processAttrs(a,u,e),o.push("attrs")),a.config){if(a.config.label&&(a.config.label&&"button"!==c||["radio","checkbox"].includes(Xr.get(a,"attrs.type")))&&!e){const t=n.label(a);if(!a.config.hideLabel){const e=[t,u];n.labelAfter(a)&&e.reverse(),h.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)&&(u.dataset[t]="function"==typeof s[t]?s[t]():s[t]);o.push("dataset")}a.action&&(this.actionHandler(u,a.action),o.push("action"));const f=Xr.subtract(o,Object.keys(a));for(d=f.length-1;d>=0;d--)u[f[d]]=a[f[d]];return h.children.length&&(u=this.create(h)),u})),e(this,"onRender",((t,e)=>{t.parentElement?e(t):window.requestAnimationFrame((()=>this.onRender(t,e)))})),e(this,"toggleElementsByStr",((t,e)=>{const n=[];return Rd.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 Br(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:r})=>({tag:"option"===t?"option":"input",attrs:{type:t,value:n||`${t}-${o}`,["option"===t?"selected":"checked"]:r||!o},config:{label:e||i.get("labelCount",{label:i.get("option"),count:o})}}))),e(this,"requiredMark",(()=>({tag:"span",className:"text-error",children:"*"}))),e(this,"removeEmpty",(t=>{const e=t.parentElement,n=Fi(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=>Fi(t)===b)),e(this,"isStage",(t=>Fi(t)===y)),e(this,"isRow",(t=>Fi(t)===w)),e(this,"isColumn",(t=>Fi(t)===C)),e(this,"isField",(t=>Fi(t)===E)),e(this,"asComponent",(t=>$d[`${Fi(t)}s`].get(t.id))),this.options=t}set setOptions(t){this.options=zi(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:Rd.onRender,render:Rd.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(`#${p} svg symbol`);return this.iconSymbols=Array.from(t).reduce(((t,e)=>{var n;return t[e.id.replace(Q,"")]={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=zi(r,e);return this.cachedIcons[i]=Rd.create(t).outerHTML,this.cachedIcons[i]}return this.cachedIcons[i]=Rd.create(r).outerHTML,this.cachedIcons[i]}return(null==(o=Id[Rd.options.iconFont])?void 0:o.call(Id,t))||t}processAttrs(t,e,n){const{attrs:o={}}=t;n||o.name||!this.isInput(t.tag)||e.setAttribute("name",Bi(t));for(const i of Object.keys(o)){const t=Xr.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},h={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||Bi(),options:void 0,children:o,action:e.action}},checkbox:d,radio:d};return null==(a=h[r])?void 0:a.call(h,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),Md.has(e)}parsedHtml(t){const e=document.createElement("textarea");return e.innerHTML=t,e.textContent}labelAfter(t){const e=Xr.get(t,"attrs.type"),n=Xr.get(t,"config.labelAfter");return void 0!==n?n:"checkbox"===e||"radio"===e}label(t,e){const n=Xr.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=Fi(t);return e?$d.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,Xr.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)}};Xr.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");Vr.slideUp(t,600,(()=>{Rd.empty(t),t.classList.remove("removing-all-fields"),Rd.emptyClass(t),Vr.slideDown(t,300)}))}toggleSortable(t,e){let n=e;const o=Fi(t);if(!o)return;const i=Fi(t.parentElement),r=Rd[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(_.get(t.classList.item(0)));t.classList.toggle("empty",!e.length)}};i.addLanguage("en-US",void 0);const Fd={get editor(){return{stickyControls:!1,allowEdit:!0,dataType:"json",debug:!1,sessionStorage:!1,editorContainer:null,external:{},svgSprite:m,style:v,iconFont:null,config:{},events:{},actions:{},controls:{},polyfills:Hr(),i18n:{location:"https://draggable.github.io/formeo/assets/lang/"},onLoad:()=>{}}}};let Wd=class{constructor({formData:t,...e},n){const o=zi(Fd.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,Rd.setOptions=c,$d.config=a,this.userFormData=n||t,this.Components=$d,this.dom=Rd,Jr.init({debug:s,...r}),xc.init({debug:s,sessionStorage:c.sessionStorage,...i}),this.tooltip=new d,document.addEventListener("DOMContentLoaded",this.loadResources.bind(this))}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,e,n;document.removeEventListener("DOMContentLoaded",this.loadResources);const o=[];this.opts.polyfills&&(t=>{const e=Array.isArray(t)?f.filter((({name:e})=>-1!==t.indexOf(e))):f;Promise.all(e.map((({src:t})=>Jc(t))))})(this.opts.polyfills),await Qc(this.opts.svgSprite),o.push((async t=>{if(!nd()&&(await Kc(t),!nd()))return await Kc("https://draggable.github.io/formeo/assets/css/formeo.min.css")})(this.opts.style)),o.push(i.init({...this.opts.i18n,locale:null==(t=window.sessionStorage)?void 0:t.getItem(B)})),this.opts.allowEdit&&o.push(this.init());const r=await Promise.all(o);return null==(n=(e=this.opts).onLoad)||n.call(e,this),r}init(){return ud.init(this.opts.controls,this.opts.stickyControls).then((t=>{this.controls=t,this.load(this.userFormData,this.opts),this.formId=$d.get("id"),this.i18n={setLang:t=>{var e;null==(e=window.sessionStorage)||e.setItem(B,t);i.setCurrent(t).then((()=>{this.init()}),console.error)}},this.render()}))}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($d.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))]};i.current.dir&&(t.attrs.dir=i.current.dir,Rd.dir=i.current.dir),this.editor=Rd.create(t);(this.controls.container||this.editor).appendChild(this.controls.dom),this.editorContainer&&(Rd.empty(this.editorContainer),this.editorContainer.appendChild(this.editor)),Jr.formeoLoaded=new window.CustomEvent("formeoLoaded",{detail:{formeo:this}}),document.dispatchEvent(Jr.formeoLoaded)}};const Bd=t=>{const e=t.match(J);return(null==e?void 0:e[0])||t},zd=t=>t.replace(J,Bi());let qd=class{constructor(t,n={}){e(this,"render",((t=this.form)=>{this.form=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=Rd.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[Bd(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:Bi(),className:i,children:s}})),e(this,"cloneComponentData",(t=>{const{children:e=[],id:n,...o}=this.components[t];return Object.assign({},o,{id:zd(n),children:e.length&&e.map((({id:t})=>this.cloneComponentData(Bd(t))))})})),e(this,"addButton",(t=>Rd.render({tag:"button",attrs:{className:"add-input-group btn pull-right",type:"button"},children:"Add +",action:{click:e=>{const n=e.target.parentElement,o=Rd.render(this.cloneComponentData(t));n.insertBefore(o,n.lastChild),o.appendChild(Rd.render(Rd.btnTemplate({className:"remove-input-group",children:Rd.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&&ed(s);const a=zi({action:r},e);return this.cacheComponent({...a,id:this.prefixId(t)})})))),e(this,"handleComponentCondition",((t,e,n)=>{const o=Ud(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(Vi(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:va,notEquals:(t,e)=>!va(t,e),contains:(t,e)=>t.includes(e),notContains:(t,e)=>!t.includes(e)},a=String(i.target[t]),l=String(Vi(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(Vi(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 Yi(t)?this.external[e]:this.renderedForm.querySelector(`#f-${e}`)})),e(this,"getComponents",(t=>{const e=[],n=t.slice(t.indexOf(".")+1);return Yi(t)?e.push(this.external[n]):e.push(...this.renderedForm.querySelectorAll(`[name=f-${n}]`)),e}));const{renderContainer:o,external:i,elements:r}=(({editorContainer:t,renderContainer:e,...n})=>{const o=t=>"string"==typeof t?document.querySelector(t):t;return{...n,renderContainer:o(e),editorContainer:o(t)}})(t);this.container=o,this.form=n,this.external=i,this.dom=Rd,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=y,Rd.render(t))))}};const Ud=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=Wd,window.FormeoRenderer=qd);const Hd=Wd,Xd=qd;exports.FormeoEditor=Hd,exports.FormeoRenderer=Xd;
|