PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V3.3.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV3.3.2
V3.3.2 3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 All 139 releases
bit-form / assets / bf-267-207.js

bf-267-207.js in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder V3.3.2, at assets/bf-267-207.js

49 lines 422.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var gg=Object.defineProperty,Eg=Object.defineProperties;var bg=Object.getOwnPropertyDescriptors;var ko=Object.getOwnPropertySymbols;var Dh=Object.prototype.hasOwnProperty,Fh=Object.prototype.propertyIsEnumerable;var jh=t=>{throw TypeError(t)},Go=Math.pow,Ph=(t,e,s)=>e in t?gg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,b=(t,e)=>{for(var s in e||(e={}))Dh.call(e,s)&&Ph(t,s,e[s]);if(ko)for(var s of ko(e))Fh.call(e,s)&&Ph(t,s,e[s]);return t},A=(t,e)=>Eg(t,bg(e));var kh=(t,e)=>{var s={};for(var i in t)Dh.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(t!=null&&ko)for(var i of ko(t))e.indexOf(i)<0&&Fh.call(t,i)&&(s[i]=t[i]);return s};var Ic=(t,e,s)=>e.has(t)||jh("Cannot "+s);var r=(t,e,s)=>(Ic(t,e,"read from private field"),s?s.call(t):e.get(t)),O=(t,e,s)=>e.has(t)?jh("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),T=(t,e,s,i)=>(Ic(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),o=(t,e,s)=>(Ic(t,e,"access private method"),s);var ba=(t,e,s)=>new Promise((i,n)=>{var a=d=>{try{c(s.next(d))}catch(h){n(h)}},l=d=>{try{c(s.throw(d))}catch(h){n(h)}},c=d=>d.done?i(d.value):Promise.resolve(d.value).then(a,l);c((s=s.apply(t,e)).next())});import{g as ac,u as et,e_ as Ig,aD as _e,r as F,j as u,dP as N,dQ as x,R as We,i as Os,a$ as Gt,e$ as vg,b1 as jt,f0 as wg,H as Ks,aY as Pt,$ as Mo,f1 as Lt,I as No,a1 as un,_ as ve,x as _g,cf as Po,f2 as nh,d0 as ca,aj as ti,at as Do,f as re,l as _r,J as oc,F as rh,d2 as za,cS as lc,s as Tg,dS as Vu,co as zu,dU as Wu,au as Hu,d4 as qu,dT as Yu,dm as Xu,an as ah,q as Zu,d_ as Qu,aG as Cl,aH as ka,e1 as Ju,cC as Or,f3 as Ko,e5 as Ol,f4 as Ku,cn as oh,cW as $l,bI as yl,ca as tp,aF as Wa,bb as ep,cT as sp,ay as ip,d3 as np,ct as xg,aX as lh,f5 as ch,L as Sg,w as Rg,bV as Cg,bg as Og,E as $g,ag as yg}from"./main-96.js";import{f as Lg}from"./bf-781-46.js";import{R as rp,F as Ll,M as Ag,a as Mg}from"./bf-73-175.js";import{R as wt}from"./bf-42-209.js";/* empty css */import{i as Oc,a5 as Al,c as ap,a6 as op,a7 as lp}from"./bf-550-57.js";import{b as Ng}from"./bf-825-45.js";import"./bf-245-208.js";import"./bf-200-43.js";import"./bf-431-60.js";import"./bf-63-62.js";import"./bf-762-63.js";import"./bf-859-210.js";import"./bf-283-176.js";import"./bf-687-180.js";import"./bf-551-68.js";import"./bf-163-182.js";import"./bf-621-177.js";import"./bf-405-178.js";import"./bf-678-179.js";import"./bf-542-181.js";import"./bf-403-183.js";import"./bf-235-184.js";import"./bf-235-185.js";import"./bf-890-186.js";import"./bf-682-187.js";import"./bf-580-188.js";import"./bf-20-55.js";import"./bf-135-189.js";import"./bf-377-190.js";import"./bf-624-191.js";import"./bf-894-52.js";var Re,ce,An,Dt,Jt,ts,yr,Ya,Xa,Za,Mn,Ri,Nn,Pn,Lr,ke,ht,cp,dp,hp,up,pp,fp,$c,yc,mp,Lc,gp,Ep,Ac,bp,bn,Ip,ir,Mc,nr,Nc;class Pg{constructor(e,s){O(this,ht);O(this,Re,null);O(this,ce,null);O(this,An,null);O(this,Dt,null);O(this,Jt,{});O(this,ts,null);O(this,yr,null);O(this,Ya,null);O(this,Xa,null);O(this,Za,null);O(this,Mn,null);O(this,Ri,[]);O(this,Nn,null);O(this,Pn,new Map);O(this,Lr,!1);O(this,ke,{document:{},formID:null,configSetting:{},ajaxURL:null,nonce:null,uploadFileToServer:null});var i,n,a,l,c;Object.assign(r(this,ke),s),T(this,ts,s.fieldKey),T(this,Dt,s.window?s.window:window),T(this,An,s.document?s.document:document),T(this,Nn,s.contentId),typeof e=="string"?T(this,Re,r(this,An).querySelector(e)):T(this,Re,e),T(this,yr,r(this,ke).formID),T(this,Jt,o(this,ht,cp).call(this,r(this,ke).configSetting)),T(this,Ya,r(this,ke).ajaxURL),T(this,Xa,((a=(n=(i=r(this,Dt))==null?void 0:i.bf_globals)==null?void 0:n[r(this,Nn)])==null?void 0:a.nonce)||((l=r(this,ke))==null?void 0:l.nonce)),T(this,Za,r(this,ke).uploadFileToServer),r(this,Jt).disabled=((c=r(this,ke))==null?void 0:c.disabled)||o(this,ht,hp).call(this),this.uploaded_files=[],this.on_select_upload=!1,this.init()}getOutputFile(e){return e&&r(this,Pn).get(e.id)||(e==null?void 0:e.file)}init(){this.files=[],T(this,Pn,new Map);const e=[];r(this,Jt).allowFileSizeValidation&&typeof r(this,Dt).bit_filepond_plugin_file_validate_size=="function"&&e.push(r(this,Dt).bit_filepond_plugin_file_validate_size),r(this,Jt).allowFileTypeValidation&&typeof r(this,Dt).bit_filepond_plugin_file_validate_type=="function"&&e.push(r(this,Dt).bit_filepond_plugin_file_validate_type),r(this,Jt).allowImageCrop&&typeof r(this,Dt).bit_filepond_plugin_image_crop=="function"&&e.push(r(this,Dt).bit_filepond_plugin_image_crop),r(this,Jt).allowImagePreview&&typeof r(this,Dt).bit_filepond_plugin_image_preview=="function"&&e.push(r(this,Dt).bit_filepond_plugin_image_preview),r(this,Jt).allowImageResize&&typeof r(this,Dt).bit_filepond_plugin_image_resize=="function"&&e.push(r(this,Dt).bit_filepond_plugin_image_resize),r(this,Jt).allowImageTransform&&typeof r(this,Dt).bit_filepond_plugin_image_transform=="function"&&e.push(r(this,Dt).bit_filepond_plugin_image_transform),r(this,Jt).allowImageValidateSize&&typeof r(this,Dt).bit_filepond_plugin_image_validate_size=="function"&&e.push(r(this,Dt).bit_filepond_plugin_image_validate_size),r(this,Jt).allowPreview&&typeof r(this,Dt).bit_filepond_plugin_media_preview=="function"&&e.push(r(this,Dt).bit_filepond_plugin_media_preview);const{create:s,registerPlugin:i}=r(this,Dt).bit_filepond;if(i(...e),T(this,ce,s(r(this,Jt))),r(this,Re).appendChild(r(this,ce).element),setTimeout(()=>{if(r(this,Re)){const n=r(this,Re).parentNode.parentNode.querySelector(`.${r(this,ts)}-lbl`),a=r(this,Re).parentNode.querySelector('input[name="filepond"]');n.setAttribute("for",a==null?void 0:a.id)}},1e3),r(this,ke).onFileUpdate&&r(this,ce).on("updatefiles",r(this,ke).onFileUpdate),r(this,ce).on("warning",n=>{(n==null?void 0:n.body)==="Max files"&&(o(this,ht,yc).call(this,o(this,ht,fp).call(this)),T(this,Lr,!0))}),r(this,ce).on("removefile",(n,a)=>{a&&r(this,Pn).delete(a.id),o(this,ht,$c).call(this)}),r(this,ce).on("addfile",(n,a)=>{n||(o(this,ht,$c).call(this),o(this,ht,up).call(this)&&o(this,ht,pp).call(this,a))}),r(this,Za)){const n=new URL(r(this,Ya));this.on_select_upload=r(this,Jt).instantUpload,n.searchParams.append("_ajax_nonce",r(this,Xa));const a=r(this,Jt).labelFileProcessingError;r(this,ce).setOptions({server:{process:(l,c,d,h,p,f,m)=>{const E=new FormData;n.searchParams.has("action")&&n.searchParams.delete("action"),n.searchParams.append("action","bitforms_file_upload"),E.append(r(this,ts),c,c.name),E.append("fieldKey",r(this,ts)),E.append("formID",r(this,yr));const g=new XMLHttpRequest;return g.open("POST",n.href),g.upload.onprogress=I=>{f(I.lengthComputable,I.loaded,I.total)},g.onload=()=>{var w;let I=null;try{I=JSON.parse(g.responseText)}catch(S){I=null}g.status>=200&&g.status<300&&((w=I==null?void 0:I.data)!=null&&w.file_name)?(this.uploaded_files.push(I.data.file_name),h(I.data.file_name)):p(typeof(I==null?void 0:I.data)=="string"?I.data:"")},g.onerror=()=>p(""),g.send(E),{abort:()=>{g.abort(),m()}}},revert:(l,c,d)=>{if(this.uploaded_files.find(p=>p===l)){const p=this.uploaded_files.indexOf(l);this.uploaded_files.splice(p,1),n.searchParams.has("action")&&n.searchParams.delete("action"),n.searchParams.append("action","bitforms_file_delete"),n.searchParams.append("file_name",l),n.searchParams.append("formID",r(this,yr));const f=new XMLHttpRequest;return f.open("DELETE",n.href),f.onload=()=>{f.status>=200&&f.status<300?c():d()},f.send(),{abort:()=>{f.abort()}}}}},labelFileProcessingError:l=>a||(l==null?void 0:l.body)||"Error during upload"}),r(this,ce).on("updatefiles",()=>{this.files=[],this.files=r(this,ce).getFiles()})}r(this,ke).oldFiles&&o(this,ht,Lc).call(this,r(this,ke).oldFiles)}checkValidate(){var e;return r(this,Ri).length===0&&((e=this.files)==null?void 0:e.length)===0?"req":""}set value(e){o(this,ht,Lc).call(this,e)}get value(){return r(this,ce).getFiles()}set disabled(e){r(this,ce).setOptions({disabled:e})}get disabled(){var e,s;return((s=(e=r(this,ce))==null?void 0:e.options)==null?void 0:s.disabled)||!1}reset(){r(this,ce).destroy(r(this,ce).element),r(this,Re).innerHTML="",this.init()}}Re=new WeakMap,ce=new WeakMap,An=new WeakMap,Dt=new WeakMap,Jt=new WeakMap,ts=new WeakMap,yr=new WeakMap,Ya=new WeakMap,Xa=new WeakMap,Za=new WeakMap,Mn=new WeakMap,Ri=new WeakMap,Nn=new WeakMap,Pn=new WeakMap,Lr=new WeakMap,ke=new WeakMap,ht=new WeakSet,cp=function(e){const s=b({},e||{}),i=s.captureMethod;i==="capture"?s.captureMethod="environment":i!=="user"&&i!=="environment"&&delete s.captureMethod;const n=Number(s.fileSizeBase)||1e3;return["minFileSize","maxFileSize","maxTotalFileSize"].forEach(l=>{if(l in s){const c=o(this,ht,dp).call(this,s[l],n);c===null?delete s[l]:s[l]=c}}),s},dp=function(e,s){if(typeof e=="number")return Number.isFinite(e)&&e>0?Math.round(e):null;const i=/^\s*(\d+(?:\.\d+)?)\s*(GB|MB|KB)?\s*$/i.exec(String(e!=null?e:""));if(!i)return null;const n={GB:Go(s,3),MB:Go(s,2),KB:s}[(i[2]||"").toUpperCase()]||1,a=Math.round(parseFloat(i[1])*n);return a>0?a:null},hp=function(){var s,i,n,a,l,c,d;if((c=(l=(a=(n=(i=(s=r(this,Dt))==null?void 0:s.bf_globals)==null?void 0:i[r(this,Nn)])==null?void 0:n.fields)==null?void 0:a[r(this,ts)])==null?void 0:l.valid)!=null&&c.disabled)return!0;const e=(d=r(this,Re))==null?void 0:d.previousElementSibling;return!!(e&&e.tagName==="INPUT"&&e.disabled)},up=function(){return!r(this,Jt).instantUpload&&!!r(this,Jt).allowImageTransform&&typeof r(this,Dt).bit_filepond_plugin_image_transform=="function"},pp=function(e){var s;!e||typeof((s=r(this,ce))==null?void 0:s.prepareFile)!="function"||r(this,ce).prepareFile(e.id).then(({output:i})=>{var l;const n=Array.isArray(i)?(l=i.find(c=>c==null?void 0:c.file))==null?void 0:l.file:i;if(!(n instanceof Blob))return;const a=n instanceof File?n:new File([n],e.filename,{type:n.type||e.fileType});r(this,Pn).set(e.id,a)}).catch(()=>{})},fp=function(){const e=r(this,Jt).allowMultiple?r(this,Jt).maxFiles:1,s=r(this,Jt).labelMaxFilesExceeded||r(this,ke).labelMaxFilesExceeded||"Maximum number of files allowed: {max}";return String(s).replace(/\{max\}/g,e)},$c=function(){r(this,Lr)&&(T(this,Lr,!1),o(this,ht,yc).call(this))},yc=function(e=""){var c,d;const i=(((d=(c=r(this,Re))==null?void 0:c.closest)==null?void 0:d.call(c,".btcd-fld-itm"))||r(this,An)).querySelector(`.${r(this,ts)}-err-wrp`),n=i==null?void 0:i.querySelector(`.${r(this,ts)}-err-txt`),a=i==null?void 0:i.querySelector(`.${r(this,ts)}-err-msg`);if(!i||!n||!a)return;let l=!1;try{l=r(this,Dt).getComputedStyle(i).display==="grid"}catch(h){l=!1}n.textContent=e,e?(a.style.removeProperty("display"),l?i.style.setProperty("grid-template-rows","1fr"):(i.style.setProperty("height",`${n.offsetHeight}px`),i.style.setProperty("opacity",1))):l?i.style.setProperty("grid-template-rows","0fr"):(i.style.setProperty("height",0),i.style.setProperty("opacity",0),a.style.setProperty("display","none"))},mp=function(e){if(typeof e=="string")try{return JSON.parse(e)}catch(s){if(e.includes(","))return e.split(",").filter(Boolean);if(e.trim()!=="")return[e.trim()]}return Array.isArray(e)?e:[]},Lc=function(e){const s=o(this,ht,mp).call(this,e);T(this,Ri,s),T(this,Mn,o(this,ht,bn).call(this,"div")),o(this,ht,ir).call(this,r(this,Mn),"old-file-list"),s.forEach(a=>{o(this,ht,gp).call(this,a)});const i=o(this,ht,Ac).call(this);let n=r(this,Re).querySelector(`input[name="${i}"]`);n||(n=o(this,ht,bn).call(this,"input"),n.type="hidden",n.name=i,r(this,Re).appendChild(n)),n.value=JSON.stringify(r(this,Ri)),r(this,Re).appendChild(r(this,Mn))},gp=function(e){const s=o(this,ht,bn).call(this,"div"),i=e.replace(/( |\.|\(|\))/g,"");s.id=`file-wrp-${i}`,o(this,ht,ir).call(this,s,"file-wrpr");const n=o(this,ht,bn).call(this,"div");o(this,ht,ir).call(this,n,"file-details");const a=o(this,ht,bn).call(this,"a");o(this,ht,ir).call(this,a,"file-title"),o(this,ht,nr).call(this,a,"target","_blank"),o(this,ht,nr).call(this,a,"href",`${r(this,ke).baseDLURL}&fileID=${e}`),o(this,ht,Mc).call(this,a,e),n.append(a),s.append(n);const l=o(this,ht,bn).call(this,"button");o(this,ht,ir).call(this,l,"cross-btn"),o(this,ht,nr).call(this,l,"data-file-id",i),o(this,ht,nr).call(this,l,"data-file-name",e),o(this,ht,nr).call(this,l,"type","button"),o(this,ht,Mc).call(this,l,"×"),o(this,ht,Ip).call(this,l,"click",c=>o(this,ht,Ep).call(this,c)),s.append(l),r(this,Mn).appendChild(s)},Ep=function(e){const s=e.target.getAttribute("data-file-id"),i=e.target.getAttribute("data-file-name");o(this,ht,bp).call(this,`#file-wrp-${s}`),T(this,Ri,r(this,Ri).filter(n=>n!==i)),o(this,ht,Nc).call(this,`input[name="${o(this,ht,Ac).call(this)}"]`).value=JSON.stringify(r(this,Ri))},Ac=function(){var e,s,i;if(typeof checkRepeatedField!="undefined"&&checkRepeatedField(r(this,ts),(s=(e=r(this,Dt))==null?void 0:e.bf_globals)==null?void 0:s[r(this,Nn)])){const n=r(this,Re).closest("[data-index]");if((i=n==null?void 0:n.dataset)!=null&&i.index)return`${r(this,ts)}_old[${n.dataset.index}]`}return`${r(this,ts)}_old`},bp=function(e){var s;(s=o(this,ht,Nc).call(this,e))==null||s.remove()},bn=function(e){return r(this,An).createElement(e)},Ip=function(e,s,i){e.addEventListener(s,i)},ir=function(e,s){e.classList.add(s)},Mc=function(e,s){e.textContent=s},nr=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},Nc=function(e){return r(this,Re).querySelector(e)||void 0};const vp=({addFilter:t,utils:e})=>{const{Type:s,replaceInString:i,toNaturalFileSize:n}=e;return t("ALLOW_HOPPER_ITEM",(a,{query:l})=>{if(!l("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;const c=l("GET_MAX_FILE_SIZE");if(c!==null&&a.size>c)return!1;const d=l("GET_MIN_FILE_SIZE");return!(d!==null&&a.size<d)}),t("LOAD_FILE",(a,{query:l})=>new Promise((c,d)=>{if(!l("GET_ALLOW_FILE_SIZE_VALIDATION"))return c(a);const h=l("GET_FILE_VALIDATE_SIZE_FILTER");if(h&&!h(a))return c(a);const p=l("GET_MAX_FILE_SIZE");if(p!==null&&a.size>p){d({status:{main:l("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:i(l("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(p,".",l("GET_FILE_SIZE_BASE"),l("GET_FILE_SIZE_LABELS",l))})}});return}const f=l("GET_MIN_FILE_SIZE");if(f!==null&&a.size<f){d({status:{main:l("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:i(l("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(f,".",l("GET_FILE_SIZE_BASE"),l("GET_FILE_SIZE_LABELS",l))})}});return}const m=l("GET_MAX_TOTAL_FILE_SIZE");if(m!==null&&l("GET_ACTIVE_ITEMS").reduce((g,I)=>g+I.fileSize,0)>m){d({status:{main:l("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:i(l("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(m,".",l("GET_FILE_SIZE_BASE"),l("GET_FILE_SIZE_LABELS",l))})}});return}c(a)})),{options:{allowFileSizeValidation:[!0,s.BOOLEAN],maxFileSize:[null,s.INT],minFileSize:[null,s.INT],maxTotalFileSize:[null,s.INT],fileValidateSizeFilter:[null,s.FUNCTION],labelMinFileSizeExceeded:["File is too small",s.STRING],labelMinFileSize:["Minimum file size is {filesize}",s.STRING],labelMaxFileSizeExceeded:["File is too large",s.STRING],labelMaxFileSize:["Maximum file size is {filesize}",s.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",s.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",s.STRING]}}},Dg=typeof window!="undefined"&&typeof window.document!="undefined";Dg&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:vp}));const wp=({addFilter:t,utils:e})=>{const{Type:s,isString:i,replaceInString:n,guesstimateMimeType:a,getExtensionFromFilename:l,getFilenameFromURL:c}=e,d=(E,g)=>{const I=(/^[^/]+/.exec(E)||[]).pop(),w=g.slice(0,-2);return I===w},h=(E,g)=>E.some(I=>/\*$/.test(I)?d(g,I):I===g),p=E=>{let g="";if(i(E)){const I=c(E),w=l(I);w&&(g=a(w))}else g=E.type;return g},f=(E,g,I)=>{if(g.length===0)return!0;const w=p(E);return I?new Promise((S,_)=>{I(E,w).then(R=>{h(g,R)?S():_()}).catch(_)}):h(g,w)},m=E=>g=>E[g]===null?!1:E[g]||g;return t("SET_ATTRIBUTE_TO_OPTION_MAP",E=>Object.assign(E,{accept:"acceptedFileTypes"})),t("ALLOW_HOPPER_ITEM",(E,{query:g})=>g("GET_ALLOW_FILE_TYPE_VALIDATION")?f(E,g("GET_ACCEPTED_FILE_TYPES")):!0),t("LOAD_FILE",(E,{query:g})=>new Promise((I,w)=>{if(!g("GET_ALLOW_FILE_TYPE_VALIDATION")){I(E);return}const S=g("GET_ACCEPTED_FILE_TYPES"),_=g("GET_FILE_VALIDATE_TYPE_DETECT_TYPE"),R=f(E,S,_),L=()=>{const M=S.map(m(g("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES_MAP"))).filter(G=>G!==!1),D=M.filter((G,C)=>M.indexOf(G)===C);w({status:{main:g("GET_LABEL_FILE_TYPE_NOT_ALLOWED"),sub:n(g("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES"),{allTypes:D.join(", "),allButLastType:D.slice(0,-1).join(", "),lastType:D[D.length-1]})}})};if(typeof R=="boolean")return R?I(E):L();R.then(()=>{I(E)}).catch(L)})),{options:{allowFileTypeValidation:[!0,s.BOOLEAN],acceptedFileTypes:[[],s.ARRAY],labelFileTypeNotAllowed:["File is of invalid type",s.STRING],fileValidateTypeLabelExpectedTypes:["Expects {allButLastType} or {lastType}",s.STRING],fileValidateTypeLabelExpectedTypesMap:[{},s.OBJECT],fileValidateTypeDetectType:[null,s.FUNCTION]}}},Fg=typeof window!="undefined"&&typeof window.document!="undefined";Fg&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:wp}));const Gh=t=>/^image/.test(t.type),_p=({addFilter:t,utils:e})=>{const{Type:s,isFile:i,getNumericAspectRatioFromString:n}=e,a=(h,p)=>!(!Gh(h.file)||!p("GET_ALLOW_IMAGE_CROP")),l=h=>typeof h=="object",c=h=>typeof h=="number",d=(h,p)=>h.setMetadata("crop",Object.assign({},h.getMetadata("crop"),p));return t("DID_CREATE_ITEM",(h,{query:p})=>{h.extend("setImageCrop",f=>{if(!(!a(h,p)||!l(center)))return h.setMetadata("crop",f),f}),h.extend("setImageCropCenter",f=>{if(!(!a(h,p)||!l(f)))return d(h,{center:f})}),h.extend("setImageCropZoom",f=>{if(!(!a(h,p)||!c(f)))return d(h,{zoom:Math.max(1,f)})}),h.extend("setImageCropRotation",f=>{if(!(!a(h,p)||!c(f)))return d(h,{rotation:f})}),h.extend("setImageCropFlip",f=>{if(!(!a(h,p)||!l(f)))return d(h,{flip:f})}),h.extend("setImageCropAspectRatio",f=>{if(!a(h,p)||typeof f=="undefined")return;const m=h.getMetadata("crop"),E=n(f),g={center:{x:.5,y:.5},flip:m?Object.assign({},m.flip):{horizontal:!1,vertical:!1},rotation:0,zoom:1,aspectRatio:E};return h.setMetadata("crop",g),g})}),t("DID_LOAD_ITEM",(h,{query:p})=>new Promise((f,m)=>{const E=h.file;if(!i(E)||!Gh(E)||!p("GET_ALLOW_IMAGE_CROP")||h.getMetadata("crop"))return f(h);const I=p("GET_IMAGE_CROP_ASPECT_RATIO");h.setMetadata("crop",{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},rotation:0,zoom:1,aspectRatio:I?n(I):null}),f(h)})),{options:{allowImageCrop:[!0,s.BOOLEAN],imageCropAspectRatio:[null,s.STRING]}}},jg=typeof window!="undefined"&&typeof window.document!="undefined";jg&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_p}));const kg=t=>/^image/.test(t.type),Bh=(t,e)=>Ha(t.x*e,t.y*e),Uh=(t,e)=>Ha(t.x+e.x,t.y+e.y),Gg=t=>{const e=Math.sqrt(t.x*t.x+t.y*t.y);return e===0?{x:0,y:0}:Ha(t.x/e,t.y/e)},Bo=(t,e,s)=>{const i=Math.cos(e),n=Math.sin(e),a=Ha(t.x-s.x,t.y-s.y);return Ha(s.x+i*a.x-n*a.y,s.y+n*a.x+i*a.y)},Ha=(t=0,e=0)=>({x:t,y:e}),ss=(t,e,s=1,i)=>{if(typeof t=="string")return parseFloat(t)*s;if(typeof t=="number")return t*(i?e[i]:Math.min(e.width,e.height))},Bg=(t,e,s)=>{const i=t.borderStyle||t.lineStyle||"solid",n=t.backgroundColor||t.fontColor||"transparent",a=t.borderColor||t.lineColor||"transparent",l=ss(t.borderWidth||t.lineWidth,e,s),c=t.lineCap||"round",d=t.lineJoin||"round",h=typeof i=="string"?"":i.map(f=>ss(f,e,s)).join(","),p=t.opacity||1;return{"stroke-linecap":c,"stroke-linejoin":d,"stroke-width":l||0,"stroke-dasharray":h,stroke:a,fill:n,opacity:p}},ds=t=>t!=null,Ug=(t,e,s=1)=>{let i=ss(t.x,e,s,"width")||ss(t.left,e,s,"width"),n=ss(t.y,e,s,"height")||ss(t.top,e,s,"height"),a=ss(t.width,e,s,"width"),l=ss(t.height,e,s,"height"),c=ss(t.right,e,s,"width"),d=ss(t.bottom,e,s,"height");return ds(n)||(ds(l)&&ds(d)?n=e.height-l-d:n=d),ds(i)||(ds(a)&&ds(c)?i=e.width-a-c:i=c),ds(a)||(ds(i)&&ds(c)?a=e.width-i-c:a=0),ds(l)||(ds(n)&&ds(d)?l=e.height-n-d:l=0),{x:i||0,y:n||0,width:a||0,height:l||0}},Vg=t=>t.map((e,s)=>`${s===0?"M":"L"} ${e.x} ${e.y}`).join(" "),vi=(t,e)=>Object.keys(e).forEach(s=>t.setAttribute(s,e[s])),zg="http://www.w3.org/2000/svg",Tr=(t,e)=>{const s=document.createElementNS(zg,t);return e&&vi(s,e),s},Wg=t=>vi(t,b(b({},t.rect),t.styles)),Hg=t=>{const e=t.rect.x+t.rect.width*.5,s=t.rect.y+t.rect.height*.5,i=t.rect.width*.5,n=t.rect.height*.5;return vi(t,b({cx:e,cy:s,rx:i,ry:n},t.styles))},qg={contain:"xMidYMid meet",cover:"xMidYMid slice"},Yg=(t,e)=>{vi(t,A(b(b({},t.rect),t.styles),{preserveAspectRatio:qg[e.fit]||"none"}))},Xg={left:"start",center:"middle",right:"end"},Zg=(t,e,s,i)=>{const n=ss(e.fontSize,s,i),a=e.fontFamily||"sans-serif",l=e.fontWeight||"normal",c=Xg[e.textAlign]||"start";vi(t,A(b(b({},t.rect),t.styles),{"stroke-width":0,"font-weight":l,"font-size":n,"font-family":a,"text-anchor":c})),t.text!==e.text&&(t.text=e.text,t.textContent=e.text.length?e.text:" ")},Qg=(t,e,s,i)=>{vi(t,A(b(b({},t.rect),t.styles),{fill:"none"}));const n=t.childNodes[0],a=t.childNodes[1],l=t.childNodes[2],c=t.rect,d={x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height};if(vi(n,{x1:c.x,y1:c.y,x2:d.x,y2:d.y}),!e.lineDecoration)return;a.style.display="none",l.style.display="none";const h=Gg({x:d.x-c.x,y:d.y-c.y}),p=ss(.05,s,i);if(e.lineDecoration.indexOf("arrow-begin")!==-1){const f=Bh(h,p),m=Uh(c,f),E=Bo(c,2,m),g=Bo(c,-2,m);vi(a,{style:"display:block;",d:`M${E.x},${E.y} L${c.x},${c.y} L${g.x},${g.y}`})}if(e.lineDecoration.indexOf("arrow-end")!==-1){const f=Bh(h,-p),m=Uh(d,f),E=Bo(d,2,m),g=Bo(d,-2,m);vi(l,{style:"display:block;",d:`M${E.x},${E.y} L${d.x},${d.y} L${g.x},${g.y}`})}},Jg=(t,e,s,i)=>{vi(t,A(b({},t.styles),{fill:"none",d:Vg(e.points.map(n=>({x:ss(n.x,s,i,"width"),y:ss(n.y,s,i,"height")})))}))},Uo=t=>e=>Tr(t,{id:e.id}),Kg=t=>{const e=Tr("image",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return e.onload=()=>{e.setAttribute("opacity",t.opacity||1)},e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.src),e},tE=t=>{const e=Tr("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),s=Tr("line");e.appendChild(s);const i=Tr("path");e.appendChild(i);const n=Tr("path");return e.appendChild(n),e},eE={image:Kg,rect:Uo("rect"),ellipse:Uo("ellipse"),text:Uo("text"),path:Uo("path"),line:tE},sE={rect:Wg,ellipse:Hg,image:Yg,text:Zg,path:Jg,line:Qg},iE=(t,e)=>eE[t](e),nE=(t,e,s,i,n)=>{e!=="path"&&(t.rect=Ug(s,i,n)),t.styles=Bg(s,i,n),sE[e](t,s,i,n)},rE=["x","y","left","top","right","bottom","width","height"],aE=t=>typeof t=="string"&&/%/.test(t)?parseFloat(t)/100:t,oE=t=>{const[e,s]=t,i=s.points?{}:rE.reduce((n,a)=>(n[a]=aE(s[a]),n),{});return[e,b(b({zIndex:0},s),i)]},lE=(t,e)=>t[1].zIndex>e[1].zIndex?1:t[1].zIndex<e[1].zIndex?-1:0,cE=t=>t.utils.createView({name:"image-preview-markup",tag:"svg",ignoreRect:!0,mixins:{apis:["width","height","crop","markup","resize","dirty"]},write:({root:e,props:s})=>{if(!s.dirty)return;const{crop:i,resize:n,markup:a}=s,l=s.width,c=s.height;let d=i.width,h=i.height;if(n){const{size:E}=n;let g=E&&E.width,I=E&&E.height;const w=n.mode,S=n.upscale;g&&!I&&(I=g),I&&!g&&(g=I);const _=d<g&&h<I;if(!_||_&&S){let R=g/d,L=I/h;if(w==="force")d=g,h=I;else{let M;w==="cover"?M=Math.max(R,L):w==="contain"&&(M=Math.min(R,L)),d=d*M,h=h*M}}}const p={width:l,height:c};e.element.setAttribute("width",p.width),e.element.setAttribute("height",p.height);const f=Math.min(l/d,c/h);e.element.innerHTML="";const m=e.query("GET_IMAGE_PREVIEW_MARKUP_FILTER");a.filter(m).map(oE).sort(lE).forEach(E=>{const[g,I]=E,w=iE(g,I);nE(w,g,I,p,f),e.element.appendChild(w)})}}),Ga=(t,e)=>({x:t,y:e}),dE=(t,e)=>t.x*e.x+t.y*e.y,Vh=(t,e)=>Ga(t.x-e.x,t.y-e.y),hE=(t,e)=>dE(Vh(t,e),Vh(t,e)),zh=(t,e)=>Math.sqrt(hE(t,e)),Wh=(t,e)=>{const s=t,i=1.5707963267948966,n=e,a=1.5707963267948966-e,l=Math.sin(i),c=Math.sin(n),d=Math.sin(a),h=Math.cos(a),p=s/l,f=p*c,m=p*d;return Ga(h*f,h*m)},uE=(t,e)=>{const s=t.width,i=t.height,n=Wh(s,e),a=Wh(i,e),l=Ga(t.x+Math.abs(n.x),t.y-Math.abs(n.y)),c=Ga(t.x+t.width+Math.abs(a.y),t.y+Math.abs(a.x)),d=Ga(t.x-Math.abs(a.y),t.y+t.height-Math.abs(a.x));return{width:zh(l,c),height:zh(l,d)}},pE=(t,e,s=1)=>{const i=t.height/t.width;let n=1,a=e,l=1,c=i;c>a&&(c=a,l=c/i);const d=Math.max(n/l,a/c),h=t.width/(s*d*l),p=h*e;return{width:h,height:p}},Tp=(t,e,s,i)=>{const n=i.x>.5?1-i.x:i.x,a=i.y>.5?1-i.y:i.y,l=n*2*t.width,c=a*2*t.height,d=uE(e,s);return Math.max(d.width/l,d.height/c)},xp=(t,e)=>{let s=t.width,i=s*e;i>t.height&&(i=t.height,s=i/e);const n=(t.width-s)*.5,a=(t.height-i)*.5;return{x:n,y:a,width:s,height:i}},fE=(t,e={})=>{let{zoom:s,rotation:i,center:n,aspectRatio:a}=e;a||(a=t.height/t.width);const l=pE(t,a,s),c={width:l.width,height:l.height},d=typeof e.scaleToFit=="undefined"||e.scaleToFit,h=Tp(t,xp(c,a),i,d?n:{x:.5,y:.5}),p=s*h;return{widthFloat:l.width/p,heightFloat:l.height/p,width:Math.round(l.width/p),height:Math.round(l.height/p)}},ri={type:"spring",stiffness:.5,damping:.45,mass:10},mE=t=>t.utils.createView({name:"image-bitmap",ignoreRect:!0,mixins:{styles:["scaleX","scaleY"]},create:({root:e,props:s})=>{e.appendChild(s.image)}}),gE=t=>t.utils.createView({name:"image-canvas-wrapper",tag:"div",ignoreRect:!0,mixins:{apis:["crop","width","height"],styles:["originX","originY","translateX","translateY","scaleX","scaleY","rotateZ"],animations:{originX:ri,originY:ri,scaleX:ri,scaleY:ri,translateX:ri,translateY:ri,rotateZ:ri}},create:({root:e,props:s})=>{s.width=s.image.width,s.height=s.image.height,e.ref.bitmap=e.appendChildView(e.createChildView(mE(t),{image:s.image}))},write:({root:e,props:s})=>{const{flip:i}=s.crop,{bitmap:n}=e.ref;n.scaleX=i.horizontal?-1:1,n.scaleY=i.vertical?-1:1}}),EE=t=>t.utils.createView({name:"image-clip",tag:"div",ignoreRect:!0,mixins:{apis:["crop","markup","resize","width","height","dirty","background"],styles:["width","height","opacity"],animations:{opacity:{type:"tween",duration:250}}},didWriteView:function({root:e,props:s}){s.background&&(e.element.style.backgroundColor=s.background)},create:({root:e,props:s})=>{e.ref.image=e.appendChildView(e.createChildView(gE(t),Object.assign({},s))),e.ref.createMarkup=()=>{e.ref.markup||(e.ref.markup=e.appendChildView(e.createChildView(cE(t),Object.assign({},s))))},e.ref.destroyMarkup=()=>{e.ref.markup&&(e.removeChildView(e.ref.markup),e.ref.markup=null)};const i=e.query("GET_IMAGE_PREVIEW_TRANSPARENCY_INDICATOR");i!==null&&(i==="grid"?e.element.dataset.transparencyIndicator=i:e.element.dataset.transparencyIndicator="color")},write:({root:e,props:s,shouldOptimize:i})=>{const{crop:n,markup:a,resize:l,dirty:c,width:d,height:h}=s;e.ref.image.crop=n;const p={width:d,height:h,center:{x:d*.5,y:h*.5}},f={width:e.ref.image.width,height:e.ref.image.height},m={x:n.center.x*f.width,y:n.center.y*f.height},E={x:p.center.x-f.width*n.center.x,y:p.center.y-f.height*n.center.y},g=Math.PI*2+n.rotation%(Math.PI*2),I=n.aspectRatio||f.height/f.width,w=typeof n.scaleToFit=="undefined"||n.scaleToFit,S=Tp(f,xp(p,I),g,w?n.center:{x:.5,y:.5}),_=n.zoom*S;a&&a.length?(e.ref.createMarkup(),e.ref.markup.width=d,e.ref.markup.height=h,e.ref.markup.resize=l,e.ref.markup.dirty=c,e.ref.markup.markup=a,e.ref.markup.crop=fE(f,n)):e.ref.markup&&e.ref.destroyMarkup();const R=e.ref.image;if(i){R.originX=null,R.originY=null,R.translateX=null,R.translateY=null,R.rotateZ=null,R.scaleX=null,R.scaleY=null;return}R.originX=m.x,R.originY=m.y,R.translateX=E.x,R.translateY=E.y,R.rotateZ=g,R.scaleX=_,R.scaleY=_}}),bE=t=>t.utils.createView({name:"image-preview",tag:"div",ignoreRect:!0,mixins:{apis:["image","crop","markup","resize","dirty","background"],styles:["translateY","scaleX","scaleY","opacity"],animations:{scaleX:ri,scaleY:ri,translateY:ri,opacity:{type:"tween",duration:400}}},create:({root:e,props:s})=>{e.ref.clip=e.appendChildView(e.createChildView(EE(t),{id:s.id,image:s.image,crop:s.crop,markup:s.markup,resize:s.resize,dirty:s.dirty,background:s.background}))},write:({root:e,props:s,shouldOptimize:i})=>{const{clip:n}=e.ref,{image:a,crop:l,markup:c,resize:d,dirty:h}=s;if(n.crop=l,n.markup=c,n.resize=d,n.dirty=h,n.opacity=i?0:1,i||e.rect.element.hidden)return;const p=a.height/a.width;let f=l.aspectRatio||p;const m=e.rect.inner.width,E=e.rect.inner.height;let g=e.query("GET_IMAGE_PREVIEW_HEIGHT");const I=e.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),w=e.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),S=e.query("GET_PANEL_ASPECT_RATIO"),_=e.query("GET_ALLOW_MULTIPLE");S&&!_&&(g=m*S,f=S);let R=g!==null?g:Math.max(I,Math.min(m*f,w)),L=R/f;L>m&&(L=m,R=L*f),R>E&&(R=E,L=E/f),n.width=L,n.height=R}});let IE=`<svg width="500" height="200" viewBox="0 0 500 200" preserveAspectRatio="none">
2 <defs>
3 <radialGradient id="gradient-__UID__" cx=".5" cy="1.25" r="1.15">
4 <stop offset='50%' stop-color='#000000'/>
5 <stop offset='56%' stop-color='#0a0a0a'/>
6 <stop offset='63%' stop-color='#262626'/>
7 <stop offset='69%' stop-color='#4f4f4f'/>
8 <stop offset='75%' stop-color='#808080'/>
9 <stop offset='81%' stop-color='#b1b1b1'/>
10 <stop offset='88%' stop-color='#dadada'/>
11 <stop offset='94%' stop-color='#f6f6f6'/>
12 <stop offset='100%' stop-color='#ffffff'/>
13 </radialGradient>
14 <mask id="mask-__UID__">
15 <rect x="0" y="0" width="500" height="200" fill="url(#gradient-__UID__)"></rect>
16 </mask>
17 </defs>
18 <rect x="0" width="500" height="200" fill="currentColor" mask="url(#mask-__UID__)"></rect>
19 </svg>`,Hh=0;const vE=t=>t.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:({root:e,props:s})=>{let i=IE;if(document.querySelector("base")){const n=new URL(window.location.href.replace(window.location.hash,"")).href;i=i.replace(/url\(\#/g,"url("+n+"#")}Hh++,e.element.classList.add(`filepond--image-preview-overlay-${s.status}`),e.element.innerHTML=i.replace(/__UID__/g,Hh)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),wE=function(){self.onmessage=t=>{createImageBitmap(t.data.message.file).then(e=>{self.postMessage({id:t.data.id,message:e},[e])})}},_E=function(){self.onmessage=t=>{const e=t.data.message.imageData,s=t.data.message.colorMatrix,i=e.data,n=i.length,a=s[0],l=s[1],c=s[2],d=s[3],h=s[4],p=s[5],f=s[6],m=s[7],E=s[8],g=s[9],I=s[10],w=s[11],S=s[12],_=s[13],R=s[14],L=s[15],M=s[16],D=s[17],G=s[18],C=s[19];let k=0,q=0,W=0,V=0,X=0;for(;k<n;k+=4)q=i[k]/255,W=i[k+1]/255,V=i[k+2]/255,X=i[k+3]/255,i[k]=Math.max(0,Math.min((q*a+W*l+V*c+X*d+h)*255,255)),i[k+1]=Math.max(0,Math.min((q*p+W*f+V*m+X*E+g)*255,255)),i[k+2]=Math.max(0,Math.min((q*I+W*w+V*S+X*_+R)*255,255)),i[k+3]=Math.max(0,Math.min((q*L+W*M+V*D+X*G+C)*255,255));self.postMessage({id:t.data.id,message:e},[e.data.buffer])}},TE=(t,e)=>{let s=new Image;s.onload=()=>{const i=s.naturalWidth,n=s.naturalHeight;s=null,e(i,n)},s.src=t},xE={1:()=>[1,0,0,1,0,0],2:t=>[-1,0,0,1,t,0],3:(t,e)=>[-1,0,0,-1,t,e],4:(t,e)=>[1,0,0,-1,0,e],5:()=>[0,1,1,0,0,0],6:(t,e)=>[0,1,-1,0,e,0],7:(t,e)=>[0,-1,-1,0,e,t],8:t=>[0,-1,1,0,0,t]},SE=(t,e,s,i)=>{i!==-1&&t.transform.apply(t,xE[i](e,s))},RE=(t,e,s,i)=>{e=Math.round(e),s=Math.round(s);const n=document.createElement("canvas");n.width=e,n.height=s;const a=n.getContext("2d");return i>=5&&i<=8&&([e,s]=[s,e]),SE(a,e,s,i),a.drawImage(t,0,0,e,s),n},Sp=t=>/^image/.test(t.type)&&!/svg/.test(t.type),CE=10,OE=10,$E=t=>{const e=Math.min(CE/t.width,OE/t.height),s=document.createElement("canvas"),i=s.getContext("2d"),n=s.width=Math.ceil(t.width*e),a=s.height=Math.ceil(t.height*e);i.drawImage(t,0,0,n,a);let l=null;try{l=i.getImageData(0,0,n,a).data}catch(m){return null}const c=l.length;let d=0,h=0,p=0,f=0;for(;f<c;f+=4)d+=l[f]*l[f],h+=l[f+1]*l[f+1],p+=l[f+2]*l[f+2];return d=vc(d,c),h=vc(h,c),p=vc(p,c),{r:d,g:h,b:p}},vc=(t,e)=>Math.floor(Math.sqrt(t/(e/4))),yE=(t,e)=>(e=e||document.createElement("canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e),LE=t=>{let e;try{e=new ImageData(t.width,t.height)}catch(s){e=document.createElement("canvas").getContext("2d").createImageData(t.width,t.height)}return e.data.set(new Uint8ClampedArray(t.data)),e},AE=t=>new Promise((e,s)=>{const i=new Image;i.crossOrigin="Anonymous",i.onload=()=>{e(i)},i.onerror=n=>{s(n)},i.src=t}),ME=t=>{const e=vE(t),s=bE(t),{createWorker:i}=t.utils,n=(_,R,L)=>new Promise(M=>{_.ref.imageData||(_.ref.imageData=L.getContext("2d").getImageData(0,0,L.width,L.height));const D=LE(_.ref.imageData);if(!R||R.length!==20)return L.getContext("2d").putImageData(D,0,0),M();const G=i(_E);G.post({imageData:D,colorMatrix:R},C=>{L.getContext("2d").putImageData(C,0,0),G.terminate(),M()},[D.data.buffer])}),a=(_,R)=>{_.removeChildView(R),R.image.width=1,R.image.height=1,R._destroy()},l=({root:_})=>{const R=_.ref.images.shift();return R.opacity=0,R.translateY=-15,_.ref.imageViewBin.push(R),R},c=({root:_,props:R,image:L})=>{const M=R.id,D=_.query("GET_ITEM",{id:M});if(!D)return;const G=D.getMetadata("crop")||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},C=_.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR");let k,q,W=!1;_.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(k=D.getMetadata("markup")||[],q=D.getMetadata("resize"),W=!0);const V=_.appendChildView(_.createChildView(s,{id:M,image:L,crop:G,resize:q,markup:k,dirty:W,background:C,opacity:0,scaleX:1.15,scaleY:1.15,translateY:15}),_.childViews.length);_.ref.images.push(V),V.opacity=1,V.scaleX=1,V.scaleY=1,V.translateY=0,setTimeout(()=>{_.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:M})},250)},d=({root:_,props:R})=>{const L=_.query("GET_ITEM",{id:R.id});if(!L)return;const M=_.ref.images[_.ref.images.length-1];M.crop=L.getMetadata("crop"),M.background=_.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),_.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(M.dirty=!0,M.resize=L.getMetadata("resize"),M.markup=L.getMetadata("markup"))},h=({root:_,props:R,action:L})=>{if(!/crop|filter|markup|resize/.test(L.change.key)||!_.ref.images.length)return;const M=_.query("GET_ITEM",{id:R.id});if(M){if(/filter/.test(L.change.key)){const D=_.ref.images[_.ref.images.length-1];n(_,L.change.value,D.image);return}if(/crop|markup|resize/.test(L.change.key)){const D=M.getMetadata("crop"),G=_.ref.images[_.ref.images.length-1];if(D&&D.aspectRatio&&G.crop&&G.crop.aspectRatio&&Math.abs(D.aspectRatio-G.crop.aspectRatio)>1e-5){const C=l({root:_});c({root:_,props:R,image:yE(C.image)})}else d({root:_,props:R})}}},p=_=>{const L=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),M=L?parseInt(L[1]):null;return M!==null&&M<=58?!1:"createImageBitmap"in window&&Sp(_)},f=({root:_,props:R})=>{const{id:L}=R,M=_.query("GET_ITEM",L);if(!M)return;const D=URL.createObjectURL(M.file);TE(D,(G,C)=>{_.dispatch("DID_IMAGE_PREVIEW_CALCULATE_SIZE",{id:L,width:G,height:C})})},m=({root:_,props:R})=>{const{id:L}=R,M=_.query("GET_ITEM",L);if(!M)return;const D=URL.createObjectURL(M.file),G=()=>{AE(D).then(C)},C=k=>{URL.revokeObjectURL(D);const W=(M.getMetadata("exif")||{}).orientation||-1;let{width:V,height:X}=k;if(!V||!X)return;W>=5&&W<=8&&([V,X]=[X,V]);const j=Math.max(1,window.devicePixelRatio*.75),B=_.query("GET_IMAGE_PREVIEW_ZOOM_FACTOR")*j,H=X/V,tt=_.rect.element.width,U=_.rect.element.height;let Z=tt,J=Z*H;H>1?(Z=Math.min(V,tt*B),J=Z*H):(J=Math.min(X,U*B),Z=J/H);const it=RE(k,Z,J,W),at=()=>{const _t=_.query("GET_IMAGE_PREVIEW_CALCULATE_AVERAGE_IMAGE_COLOR")?$E(data):null;M.setMetadata("color",_t,!0),"close"in k&&k.close(),_.ref.overlayShadow.opacity=1,c({root:_,props:R,image:it})},vt=M.getMetadata("filter");vt?n(_,vt,it).then(at):at()};if(p(M.file)){const k=i(wE);k.post({file:M.file},q=>{if(k.terminate(),!q){G();return}C(q)})}else G()},E=({root:_})=>{const R=_.ref.images[_.ref.images.length-1];R.translateY=0,R.scaleX=1,R.scaleY=1,R.opacity=1},g=({root:_})=>{_.ref.overlayShadow.opacity=1,_.ref.overlayError.opacity=0,_.ref.overlaySuccess.opacity=0},I=({root:_})=>{_.ref.overlayShadow.opacity=.25,_.ref.overlayError.opacity=1},w=({root:_})=>{_.ref.overlayShadow.opacity=.25,_.ref.overlaySuccess.opacity=1},S=({root:_})=>{_.ref.images=[],_.ref.imageData=null,_.ref.imageViewBin=[],_.ref.overlayShadow=_.appendChildView(_.createChildView(e,{opacity:0,status:"idle"})),_.ref.overlaySuccess=_.appendChildView(_.createChildView(e,{opacity:0,status:"success"})),_.ref.overlayError=_.appendChildView(_.createChildView(e,{opacity:0,status:"failure"}))};return t.utils.createView({name:"image-preview-wrapper",create:S,styles:["height"],apis:["height"],destroy:({root:_})=>{_.ref.images.forEach(R=>{R.image.width=1,R.image.height=1})},didWriteView:({root:_})=>{_.ref.images.forEach(R=>{R.dirty=!1})},write:t.utils.createRoute({DID_IMAGE_PREVIEW_DRAW:E,DID_IMAGE_PREVIEW_CONTAINER_CREATE:f,DID_FINISH_CALCULATE_PREVIEWSIZE:m,DID_UPDATE_ITEM_METADATA:h,DID_THROW_ITEM_LOAD_ERROR:I,DID_THROW_ITEM_PROCESSING_ERROR:I,DID_THROW_ITEM_INVALID:I,DID_COMPLETE_ITEM_PROCESSING:w,DID_START_ITEM_PROCESSING:g,DID_REVERT_ITEM_PROCESSING:g},({root:_})=>{const R=_.ref.imageViewBin.filter(L=>L.opacity===0);_.ref.imageViewBin=_.ref.imageViewBin.filter(L=>L.opacity>0),R.forEach(L=>a(_,L)),R.length=0})})},Rp=t=>{const{addFilter:e,utils:s}=t,{Type:i,createRoute:n,isFile:a}=s,l=ME(t);return e("CREATE_VIEW",c=>{const{is:d,view:h,query:p}=c;if(!d("file")||!p("GET_ALLOW_IMAGE_PREVIEW"))return;const f=({root:w,props:S})=>{const{id:_}=S,R=p("GET_ITEM",_);if(!R||!a(R.file)||R.archived)return;const L=R.file;if(!kg(L)||!p("GET_IMAGE_PREVIEW_FILTER_ITEM")(R))return;const M="createImageBitmap"in(window||{}),D=p("GET_IMAGE_PREVIEW_MAX_FILE_SIZE");if(!M&&D&&L.size>D)return;w.ref.imagePreview=h.appendChildView(h.createChildView(l,{id:_}));const G=w.query("GET_IMAGE_PREVIEW_HEIGHT");G&&w.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:R.id,height:G});const C=!M&&L.size>p("GET_IMAGE_PREVIEW_MAX_INSTANT_PREVIEW_FILE_SIZE");w.dispatch("DID_IMAGE_PREVIEW_CONTAINER_CREATE",{id:_},C)},m=(w,S)=>{if(!w.ref.imagePreview)return;let{id:_}=S;const R=w.query("GET_ITEM",{id:_});if(!R)return;const L=w.query("GET_PANEL_ASPECT_RATIO"),M=w.query("GET_ITEM_PANEL_ASPECT_RATIO"),D=w.query("GET_IMAGE_PREVIEW_HEIGHT");if(L||M||D)return;let{imageWidth:G,imageHeight:C}=w.ref;if(!G||!C)return;const k=w.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),q=w.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),V=(R.getMetadata("exif")||{}).orientation||-1;if(V>=5&&V<=8&&([G,C]=[C,G]),!Sp(R.file)||w.query("GET_IMAGE_PREVIEW_UPSCALE")){const tt=2048/G;G*=tt,C*=tt}const X=C/G,j=(R.getMetadata("crop")||{}).aspectRatio||X;let K=Math.max(k,Math.min(C,q));const B=w.rect.element.width,H=Math.min(B*j,K);w.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:R.id,height:H})},E=({root:w})=>{w.ref.shouldRescale=!0},g=({root:w,action:S})=>{S.change.key==="crop"&&(w.ref.shouldRescale=!0)},I=({root:w,action:S})=>{w.ref.imageWidth=S.width,w.ref.imageHeight=S.height,w.ref.shouldRescale=!0,w.ref.shouldDrawPreview=!0,w.dispatch("KICK")};h.registerWriter(n({DID_RESIZE_ROOT:E,DID_STOP_RESIZE:E,DID_LOAD_ITEM:f,DID_IMAGE_PREVIEW_CALCULATE_SIZE:I,DID_UPDATE_ITEM_METADATA:g},({root:w,props:S})=>{w.ref.imagePreview&&(w.rect.element.hidden||(w.ref.shouldRescale&&(m(w,S),w.ref.shouldRescale=!1),w.ref.shouldDrawPreview&&(requestAnimationFrame(()=>{requestAnimationFrame(()=>{w.dispatch("DID_FINISH_CALCULATE_PREVIEWSIZE",{id:S.id})})}),w.ref.shouldDrawPreview=!1)))}))}),{options:{allowImagePreview:[!0,i.BOOLEAN],imagePreviewFilterItem:[()=>!0,i.FUNCTION],imagePreviewHeight:[null,i.INT],imagePreviewMinHeight:[44,i.INT],imagePreviewMaxHeight:[256,i.INT],imagePreviewMaxFileSize:[null,i.INT],imagePreviewZoomFactor:[2,i.INT],imagePreviewUpscale:[!1,i.BOOLEAN],imagePreviewMaxInstantPreviewFileSize:[1e6,i.INT],imagePreviewTransparencyIndicator:[null,i.STRING],imagePreviewCalculateAverageImageColor:[!1,i.BOOLEAN],imagePreviewMarkupShow:[!0,i.BOOLEAN],imagePreviewMarkupFilter:[()=>!0,i.FUNCTION]}}},NE=typeof window!="undefined"&&typeof window.document!="undefined";NE&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:Rp}));const PE=t=>/^image/.test(t.type),DE=(t,e)=>{let s=new Image;s.onload=()=>{const i=s.naturalWidth,n=s.naturalHeight;s=null,e({width:i,height:n})},s.onerror=()=>e(null),s.src=t},Cp=({addFilter:t,utils:e})=>{const{Type:s}=e;return t("DID_LOAD_ITEM",(i,{query:n})=>new Promise((a,l)=>{const c=i.file;if(!PE(c)||!n("GET_ALLOW_IMAGE_RESIZE"))return a(i);const d=n("GET_IMAGE_RESIZE_MODE"),h=n("GET_IMAGE_RESIZE_TARGET_WIDTH"),p=n("GET_IMAGE_RESIZE_TARGET_HEIGHT"),f=n("GET_IMAGE_RESIZE_UPSCALE");if(h===null&&p===null)return a(i);const m=h===null?p:h,E=p===null?m:p,g=URL.createObjectURL(c);DE(g,I=>{if(URL.revokeObjectURL(g),!I)return a(i);let{width:w,height:S}=I;const _=(i.getMetadata("exif")||{}).orientation||-1;if(_>=5&&_<=8&&([w,S]=[S,w]),w===m&&S===E)return a(i);if(!f){if(d==="cover"){if(w<=m||S<=E)return a(i)}else if(w<=m&&S<=m)return a(i)}i.setMetadata("resize",{mode:d,upscale:f,size:{width:m,height:E}}),a(i)})})),{options:{allowImageResize:[!0,s.BOOLEAN],imageResizeMode:["cover",s.STRING],imageResizeUpscale:[!0,s.BOOLEAN],imageResizeTargetWidth:[null,s.INT],imageResizeTargetHeight:[null,s.INT]}}},FE=typeof window!="undefined"&&typeof window.document!="undefined";FE&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:Cp}));const jE=t=>/^image/.test(t.type),kE=t=>t.substr(0,t.lastIndexOf("."))||t,GE={jpeg:"jpg","svg+xml":"svg"},BE=(t,e)=>{const s=kE(t),i=e.split("/")[1],n=GE[i]||i;return`${s}.${n}`},UE=t=>/jpeg|png|svg\+xml/.test(t)?t:"image/jpeg",VE=t=>/^image/.test(t.type),zE={1:()=>[1,0,0,1,0,0],2:t=>[-1,0,0,1,t,0],3:(t,e)=>[-1,0,0,-1,t,e],4:(t,e)=>[1,0,0,-1,0,e],5:()=>[0,1,1,0,0,0],6:(t,e)=>[0,1,-1,0,e,0],7:(t,e)=>[0,-1,-1,0,e,t],8:t=>[0,-1,1,0,0,t]},WE=(t,e,s)=>(s===-1&&(s=1),zE[s](t,e)),Ba=(t,e)=>({x:t,y:e}),HE=(t,e)=>t.x*e.x+t.y*e.y,qh=(t,e)=>Ba(t.x-e.x,t.y-e.y),qE=(t,e)=>HE(qh(t,e),qh(t,e)),Yh=(t,e)=>Math.sqrt(qE(t,e)),Xh=(t,e)=>{const s=t,i=1.5707963267948966,n=e,a=1.5707963267948966-e,l=Math.sin(i),c=Math.sin(n),d=Math.sin(a),h=Math.cos(a),p=s/l,f=p*c,m=p*d;return Ba(h*f,h*m)},YE=(t,e)=>{const s=t.width,i=t.height,n=Xh(s,e),a=Xh(i,e),l=Ba(t.x+Math.abs(n.x),t.y-Math.abs(n.y)),c=Ba(t.x+t.width+Math.abs(a.y),t.y+Math.abs(a.x)),d=Ba(t.x-Math.abs(a.y),t.y+t.height-Math.abs(a.x));return{width:Yh(l,c),height:Yh(l,d)}},Op=(t,e,s=0,i={x:.5,y:.5})=>{const n=i.x>.5?1-i.x:i.x,a=i.y>.5?1-i.y:i.y,l=n*2*t.width,c=a*2*t.height,d=YE(e,s);return Math.max(d.width/l,d.height/c)},$p=(t,e)=>{let s=t.width,i=s*e;i>t.height&&(i=t.height,s=i/e);const n=(t.width-s)*.5,a=(t.height-i)*.5;return{x:n,y:a,width:s,height:i}},Zh=(t,e,s=1)=>{const i=t.height/t.width;let n=1,a=e,l=1,c=i;c>a&&(c=a,l=c/i);const d=Math.max(n/l,a/c),h=t.width/(s*d*l),p=h*e;return{width:h,height:p}},yp=t=>{t.width=1,t.height=1,t.getContext("2d").clearRect(0,0,1,1)},Qh=t=>t&&(t.horizontal||t.vertical),XE=(t,e,s)=>{if(e<=1&&!Qh(s))return t.width=t.naturalWidth,t.height=t.naturalHeight,t;const i=document.createElement("canvas"),n=t.naturalWidth,a=t.naturalHeight,l=e>=5&&e<=8;l?(i.width=a,i.height=n):(i.width=n,i.height=a);const c=i.getContext("2d");if(e&&c.transform.apply(c,WE(n,a,e)),Qh(s)){const d=[1,0,0,1,0,0];(!l&&s.horizontal||l&s.vertical)&&(d[0]=-1,d[4]=n),(!l&&s.vertical||l&&s.horizontal)&&(d[3]=-1,d[5]=a),c.transform(...d)}return c.drawImage(t,0,0,n,a),i},ZE=(t,e,s={},i={})=>{const{canvasMemoryLimit:n,background:a=null}=i,l=s.zoom||1,c=XE(t,e,s.flip),d={width:c.width,height:c.height},h=s.aspectRatio||d.height/d.width;let p=Zh(d,h,l);if(n){const R=p.width*p.height;if(R>n){const L=Math.sqrt(n)/Math.sqrt(R);d.width=Math.floor(d.width*L),d.height=Math.floor(d.height*L),p=Zh(d,h,l)}}const f=document.createElement("canvas"),m={x:p.width*.5,y:p.height*.5},E={width:p.width,height:p.height},g=typeof s.scaleToFit=="undefined"||s.scaleToFit,I=l*Op(d,$p(E,h),s.rotation,g?s.center:{x:.5,y:.5});f.width=Math.round(p.width/I),f.height=Math.round(p.height/I),m.x/=I,m.y/=I;const w={x:m.x-d.width*(s.center?s.center.x:.5),y:m.y-d.height*(s.center?s.center.y:.5)},S=f.getContext("2d");a&&(S.fillStyle=a,S.fillRect(0,0,f.width,f.height)),S.translate(m.x,m.y),S.rotate(s.rotation||0),S.drawImage(c,w.x-m.x,w.y-m.y,d.width,d.height);const _=S.getImageData(0,0,f.width,f.height);return yp(f),_},QE=typeof window!="undefined"&&typeof window.document!="undefined";QE&&(HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,s){var i=this.toDataURL(e,s).split(",")[1];setTimeout(function(){for(var n=atob(i),a=n.length,l=new Uint8Array(a),c=0;c<a;c++)l[c]=n.charCodeAt(c);t(new Blob([l],{type:e||"image/png"}))})}}));const JE=(t,e,s=null)=>new Promise(i=>{const n=s?s(t):t;Promise.resolve(n).then(a=>{a.toBlob(i,e.type,e.quality)})}),Ml=(t,e)=>qa(t.x*e,t.y*e),Nl=(t,e)=>qa(t.x+e.x,t.y+e.y),Lp=t=>{const e=Math.sqrt(t.x*t.x+t.y*t.y);return e===0?{x:0,y:0}:qa(t.x/e,t.y/e)},dn=(t,e,s)=>{const i=Math.cos(e),n=Math.sin(e),a=qa(t.x-s.x,t.y-s.y);return qa(s.x+i*a.x-n*a.y,s.y+n*a.x+i*a.y)},qa=(t=0,e=0)=>({x:t,y:e}),Pe=(t,e,s=1,i)=>{if(typeof t=="string")return parseFloat(t)*s;if(typeof t=="number")return t*(i?e[i]:Math.min(e.width,e.height))},tr=(t,e,s)=>{const i=t.borderStyle||t.lineStyle||"solid",n=t.backgroundColor||t.fontColor||"transparent",a=t.borderColor||t.lineColor||"transparent",l=Pe(t.borderWidth||t.lineWidth,e,s),c=t.lineCap||"round",d=t.lineJoin||"round",h=typeof i=="string"?"":i.map(f=>Pe(f,e,s)).join(","),p=t.opacity||1;return{"stroke-linecap":c,"stroke-linejoin":d,"stroke-width":l||0,"stroke-dasharray":h,stroke:a,fill:n,opacity:p}},hs=t=>t!=null,da=(t,e,s=1)=>{let i=Pe(t.x,e,s,"width")||Pe(t.left,e,s,"width"),n=Pe(t.y,e,s,"height")||Pe(t.top,e,s,"height"),a=Pe(t.width,e,s,"width"),l=Pe(t.height,e,s,"height"),c=Pe(t.right,e,s,"width"),d=Pe(t.bottom,e,s,"height");return hs(n)||(hs(l)&&hs(d)?n=e.height-l-d:n=d),hs(i)||(hs(a)&&hs(c)?i=e.width-a-c:i=c),hs(a)||(hs(i)&&hs(c)?a=e.width-i-c:a=0),hs(l)||(hs(n)&&hs(d)?l=e.height-n-d:l=0),{x:i||0,y:n||0,width:a||0,height:l||0}},KE=t=>t.map((e,s)=>`${s===0?"M":"L"} ${e.x} ${e.y}`).join(" "),wi=(t,e)=>Object.keys(e).forEach(s=>t.setAttribute(s,e[s])),tb="http://www.w3.org/2000/svg",xr=(t,e)=>{const s=document.createElementNS(tb,t);return e&&wi(s,e),s},eb=t=>wi(t,b(b({},t.rect),t.styles)),sb=t=>{const e=t.rect.x+t.rect.width*.5,s=t.rect.y+t.rect.height*.5,i=t.rect.width*.5,n=t.rect.height*.5;return wi(t,b({cx:e,cy:s,rx:i,ry:n},t.styles))},ib={contain:"xMidYMid meet",cover:"xMidYMid slice"},nb=(t,e)=>{wi(t,A(b(b({},t.rect),t.styles),{preserveAspectRatio:ib[e.fit]||"none"}))},rb={left:"start",center:"middle",right:"end"},ab=(t,e,s,i)=>{const n=Pe(e.fontSize,s,i),a=e.fontFamily||"sans-serif",l=e.fontWeight||"normal",c=rb[e.textAlign]||"start";wi(t,A(b(b({},t.rect),t.styles),{"stroke-width":0,"font-weight":l,"font-size":n,"font-family":a,"text-anchor":c})),t.text!==e.text&&(t.text=e.text,t.textContent=e.text.length?e.text:" ")},ob=(t,e,s,i)=>{wi(t,A(b(b({},t.rect),t.styles),{fill:"none"}));const n=t.childNodes[0],a=t.childNodes[1],l=t.childNodes[2],c=t.rect,d={x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height};if(wi(n,{x1:c.x,y1:c.y,x2:d.x,y2:d.y}),!e.lineDecoration)return;a.style.display="none",l.style.display="none";const h=Lp({x:d.x-c.x,y:d.y-c.y}),p=Pe(.05,s,i);if(e.lineDecoration.indexOf("arrow-begin")!==-1){const f=Ml(h,p),m=Nl(c,f),E=dn(c,2,m),g=dn(c,-2,m);wi(a,{style:"display:block;",d:`M${E.x},${E.y} L${c.x},${c.y} L${g.x},${g.y}`})}if(e.lineDecoration.indexOf("arrow-end")!==-1){const f=Ml(h,-p),m=Nl(d,f),E=dn(d,2,m),g=dn(d,-2,m);wi(l,{style:"display:block;",d:`M${E.x},${E.y} L${d.x},${d.y} L${g.x},${g.y}`})}},lb=(t,e,s,i)=>{wi(t,A(b({},t.styles),{fill:"none",d:KE(e.points.map(n=>({x:Pe(n.x,s,i,"width"),y:Pe(n.y,s,i,"height")})))}))},Vo=t=>e=>xr(t,{id:e.id}),cb=t=>{const e=xr("image",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return e.onload=()=>{e.setAttribute("opacity",t.opacity||1)},e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.src),e},db=t=>{const e=xr("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),s=xr("line");e.appendChild(s);const i=xr("path");e.appendChild(i);const n=xr("path");return e.appendChild(n),e},hb={image:cb,rect:Vo("rect"),ellipse:Vo("ellipse"),text:Vo("text"),path:Vo("path"),line:db},ub={rect:eb,ellipse:sb,image:nb,text:ab,path:lb,line:ob},pb=(t,e)=>hb[t](e),fb=(t,e,s,i,n)=>{e!=="path"&&(t.rect=da(s,i,n)),t.styles=tr(s,i,n),ub[e](t,s,i,n)},Ap=(t,e)=>t[1].zIndex>e[1].zIndex?1:t[1].zIndex<e[1].zIndex?-1:0,mb=(t,e={},s,i)=>new Promise(n=>{const{background:a=null}=i,l=new FileReader;l.onloadend=()=>{const c=l.result,d=document.createElement("div");d.style.cssText="position:absolute;pointer-events:none;width:0;height:0;visibility:hidden;",d.innerHTML=c;const h=d.querySelector("svg");document.body.appendChild(d);const p=h.getBBox();d.parentNode.removeChild(d);const f=d.querySelector("title"),m=h.getAttribute("viewBox")||"",E=h.getAttribute("width")||"",g=h.getAttribute("height")||"";let I=parseFloat(E)||null,w=parseFloat(g)||null;const S=(E.match(/[a-z]+/)||[])[0]||"",_=(g.match(/[a-z]+/)||[])[0]||"",R=m.split(" ").map(parseFloat),L=R.length?{x:R[0],y:R[1],width:R[2],height:R[3]}:p;let M=I!=null?I:L.width,D=w!=null?w:L.height;h.style.overflow="visible",h.setAttribute("width",M),h.setAttribute("height",D);let G="";if(s&&s.length){const vt={width:M,height:D};G=s.sort(Ap).reduce((_t,ct)=>{const ut=pb(ct[0],ct[1]);return fb(ut,ct[0],ct[1],vt),ut.removeAttribute("id"),ut.getAttribute("opacity")===1&&ut.removeAttribute("opacity"),_t+`
20 `+ut.outerHTML+`
21 `},""),G=`
22
23 <g>${G.replace(/&nbsp;/g," ")}</g>
24
25 `}const C=e.aspectRatio||D/M,k=M,q=k*C,W=typeof e.scaleToFit=="undefined"||e.scaleToFit,V=e.center?e.center.x:.5,X=e.center?e.center.y:.5,j=Op({width:M,height:D},$p({width:k,height:q},C),e.rotation,W?{x:V,y:X}:{x:.5,y:.5}),K=e.zoom*j,B=e.rotation*(180/Math.PI),H={x:k*.5,y:q*.5},tt={x:H.x-M*V,y:H.y-D*X},U=[`rotate(${B} ${H.x} ${H.y})`,`translate(${H.x} ${H.y})`,`scale(${K})`,`translate(${-H.x} ${-H.y})`,`translate(${tt.x} ${tt.y})`],Z=e.flip&&e.flip.horizontal,J=e.flip&&e.flip.vertical,it=[`scale(${Z?-1:1} ${J?-1:1})`,`translate(${Z?-M:0} ${J?-D:0})`],at=`<?xml version="1.0" encoding="UTF-8"?>
26 <svg width="${k}${S}" height="${q}${_}"
27 viewBox="0 0 ${k} ${q}" ${a?'style="background:'+a+'" ':""}
28 preserveAspectRatio="xMinYMin"
29 xmlns:xlink="http://www.w3.org/1999/xlink"
30 xmlns="http://www.w3.org/2000/svg">
31 <!-- Generated by PQINA - https://pqina.nl/ -->
32 <title>${f?f.textContent:""}</title>
33 <g transform="${U.join(" ")}">
34 <g transform="${it.join(" ")}">
35 ${h.outerHTML}${G}
36 </g>
37 </g>
38 </svg>`;n(at)},l.readAsText(t)}),gb=t=>{let e;try{e=new ImageData(t.width,t.height)}catch(s){e=document.createElement("canvas").getContext("2d").createImageData(t.width,t.height)}return e.data.set(t.data),e},Eb=()=>{const t={resize:p,filter:h},e=(f,m)=>(f.forEach(E=>{m=t[E.type](m,E.data)}),m),s=(f,m)=>{let E=f.transforms,g=null;if(E.forEach(I=>{I.type==="filter"&&(g=I)}),g){let I=null;E.forEach(w=>{w.type==="resize"&&(I=w)}),I&&(I.data.matrix=g.data,E=E.filter(w=>w.type!=="filter"))}m(e(E,f.imageData))};self.onmessage=f=>{s(f.data.message,m=>{self.postMessage({id:f.data.id,message:m},[m.data.buffer])})};const i=1,n=1,a=1;function l(f,m,E){const g=m[f]/255,I=m[f+1]/255,w=m[f+2]/255,S=m[f+3]/255,_=g*E[0]+I*E[1]+w*E[2]+S*E[3]+E[4],R=g*E[5]+I*E[6]+w*E[7]+S*E[8]+E[9],L=g*E[10]+I*E[11]+w*E[12]+S*E[13]+E[14],M=g*E[15]+I*E[16]+w*E[17]+S*E[18]+E[19],D=Math.max(0,_*M)+i*(1-M),G=Math.max(0,R*M)+n*(1-M),C=Math.max(0,L*M)+a*(1-M);m[f]=Math.max(0,Math.min(1,D))*255,m[f+1]=Math.max(0,Math.min(1,G))*255,m[f+2]=Math.max(0,Math.min(1,C))*255}const c=self.JSON.stringify([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]);function d(f){return self.JSON.stringify(f||[])===c}function h(f,m){if(!m||d(m))return f;const E=f.data,g=E.length,I=m[0],w=m[1],S=m[2],_=m[3],R=m[4],L=m[5],M=m[6],D=m[7],G=m[8],C=m[9],k=m[10],q=m[11],W=m[12],V=m[13],X=m[14],j=m[15],K=m[16],B=m[17],H=m[18],tt=m[19];let U=0,Z=0,J=0,it=0,at=0,vt=0,_t=0,ct=0,ut=0,Et=0,St=0,It=0;for(;U<g;U+=4)Z=E[U]/255,J=E[U+1]/255,it=E[U+2]/255,at=E[U+3]/255,vt=Z*I+J*w+it*S+at*_+R,_t=Z*L+J*M+it*D+at*G+C,ct=Z*k+J*q+it*W+at*V+X,ut=Z*j+J*K+it*B+at*H+tt,Et=Math.max(0,vt*ut)+i*(1-ut),St=Math.max(0,_t*ut)+n*(1-ut),It=Math.max(0,ct*ut)+a*(1-ut),E[U]=Math.max(0,Math.min(1,Et))*255,E[U+1]=Math.max(0,Math.min(1,St))*255,E[U+2]=Math.max(0,Math.min(1,It))*255;return f}function p(f,m){let{mode:E="contain",upscale:g=!1,width:I,height:w,matrix:S}=m;if(S=!S||d(S)?null:S,!I&&!w)return h(f,S);if(I===null?I=w:w===null&&(w=I),E!=="force"){let V=I/f.width,X=w/f.height,j=1;if(E==="cover"?j=Math.max(V,X):E==="contain"&&(j=Math.min(V,X)),j>1&&g===!1)return h(f,S);I=f.width*j,w=f.height*j}const _=f.width,R=f.height,L=Math.round(I),M=Math.round(w),D=f.data,G=new Uint8ClampedArray(L*M*4),C=_/L,k=R/M,q=Math.ceil(C*.5),W=Math.ceil(k*.5);for(let V=0;V<M;V++)for(let X=0;X<L;X++){let j=(X+V*L)*4,K=0,B=0,H=0,tt=0,U=0,Z=0,J=0,it=(V+.5)*k;for(let at=Math.floor(V*k);at<(V+1)*k;at++){let vt=Math.abs(it-(at+.5))/W,_t=(X+.5)*C,ct=vt*vt;for(let ut=Math.floor(X*C);ut<(X+1)*C;ut++){let Et=Math.abs(_t-(ut+.5))/q,St=Math.sqrt(ct+Et*Et);if(St>=-1&&St<=1&&(K=2*St*St*St-3*St*St+1,K>0)){Et=4*(ut+at*_);let It=D[Et+3];J+=K*It,H+=K,It<255&&(K=K*It/250),tt+=K*D[Et],U+=K*D[Et+1],Z+=K*D[Et+2],B+=K}}}G[j]=tt/B,G[j+1]=U/B,G[j+2]=Z/B,G[j+3]=J/H,S&&l(j,G,S)}return{data:G,width:L,height:M}}},bb=(t,e)=>{if(t.getUint32(e+4,!1)!==1165519206)return;e+=4;const s=t.getUint16(e+=6,!1)===18761;e+=t.getUint32(e+4,s);const i=t.getUint16(e,s);e+=2;for(let n=0;n<i;n++)if(t.getUint16(e+n*12,s)===274)return t.setUint16(e+n*12+8,1,s),!0;return!1},Ib=t=>{const e=new DataView(t);if(e.getUint16(0)!==65496)return null;let s=2,i,n,a=!1;for(;s<e.byteLength&&(i=e.getUint16(s,!1),n=e.getUint16(s+2,!1)+2,!(!(i>=65504&&i<=65519||i===65534)||(a||(a=bb(e,s)),s+n>e.byteLength)));)s+=n;return t.slice(0,s)},vb=t=>new Promise(e=>{const s=new FileReader;s.onload=()=>e(Ib(s.result)||null),s.readAsArrayBuffer(t.slice(0,256*1024))}),wb=()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,_b=(t,e)=>{const s=wb();if(s){const i=new s;return i.append(t),i.getBlob(e)}return new Blob([t],{type:e})},Tb=()=>Math.random().toString(36).substr(2,9),xb=t=>{const e=new Blob(["(",t.toString(),")()"],{type:"application/javascript"}),s=URL.createObjectURL(e),i=new Worker(s),n=[];return{transfer:()=>{},post:(a,l,c)=>{const d=Tb();n[d]=l,i.onmessage=h=>{const p=n[h.data.id];p&&(p(h.data.message),delete n[h.data.id])},i.postMessage({id:d,message:a},c)},terminate:()=>{i.terminate(),URL.revokeObjectURL(s)}}},Sb=t=>new Promise((e,s)=>{const i=new Image;i.onload=()=>{e(i)},i.onerror=n=>{s(n)},i.src=t}),Rb=t=>t.reduce((e,s)=>e.then(i=>s().then(Array.prototype.concat.bind(i))),Promise.resolve([])),Cb=(t,e)=>new Promise(s=>{const i={width:t.width,height:t.height},n=t.getContext("2d"),a=e.sort(Ap).map(l=>()=>new Promise(c=>{Nb[l[0]](n,i,l[1],c)&&c()}));Rb(a).then(()=>s(t))}),ha=(t,e)=>{t.beginPath(),t.lineCap=e["stroke-linecap"],t.lineJoin=e["stroke-linejoin"],t.lineWidth=e["stroke-width"],e["stroke-dasharray"].length&&t.setLineDash(e["stroke-dasharray"].split(",")),t.fillStyle=e.fill,t.strokeStyle=e.stroke,t.globalAlpha=e.opacity||1},ua=t=>{t.fill(),t.stroke(),t.globalAlpha=1},Ob=(t,e,s)=>{const i=da(s,e),n=tr(s,e);return ha(t,n),t.rect(i.x,i.y,i.width,i.height),ua(t),!0},$b=(t,e,s)=>{const i=da(s,e),n=tr(s,e);ha(t,n);const a=i.x,l=i.y,c=i.width,d=i.height,h=.5522848,p=c/2*h,f=d/2*h,m=a+c,E=l+d,g=a+c/2,I=l+d/2;return t.moveTo(a,I),t.bezierCurveTo(a,I-f,g-p,l,g,l),t.bezierCurveTo(g+p,l,m,I-f,m,I),t.bezierCurveTo(m,I+f,g+p,E,g,E),t.bezierCurveTo(g-p,E,a,I+f,a,I),ua(t),!0},yb=(t,e,s,i)=>{const n=da(s,e),a=tr(s,e);ha(t,a);const l=new Image;new URL(s.src,window.location.href).origin!==window.location.origin&&(l.crossOrigin=""),l.onload=()=>{if(s.fit==="cover"){const d=n.width/n.height,h=d>1?l.width:l.height*d,p=d>1?l.width/d:l.height,f=l.width*.5-h*.5,m=l.height*.5-p*.5;t.drawImage(l,f,m,h,p,n.x,n.y,n.width,n.height)}else if(s.fit==="contain"){const d=Math.min(n.width/l.width,n.height/l.height),h=d*l.width,p=d*l.height,f=n.x+n.width*.5-h*.5,m=n.y+n.height*.5-p*.5;t.drawImage(l,0,0,l.width,l.height,f,m,h,p)}else t.drawImage(l,0,0,l.width,l.height,n.x,n.y,n.width,n.height);ua(t),i()},l.src=s.src},Lb=(t,e,s)=>{const i=da(s,e),n=tr(s,e);ha(t,n);const a=Pe(s.fontSize,e),l=s.fontFamily||"sans-serif",c=s.fontWeight||"normal",d=s.textAlign||"left";return t.font=`${c} ${a}px ${l}`,t.textAlign=d,t.fillText(s.text,i.x,i.y),ua(t),!0},Ab=(t,e,s)=>{const i=tr(s,e);ha(t,i),t.beginPath();const n=s.points.map(l=>({x:Pe(l.x,e,1,"width"),y:Pe(l.y,e,1,"height")}));t.moveTo(n[0].x,n[0].y);const a=n.length;for(let l=1;l<a;l++)t.lineTo(n[l].x,n[l].y);return ua(t),!0},Mb=(t,e,s)=>{const i=da(s,e),n=tr(s,e);ha(t,n),t.beginPath();const a={x:i.x,y:i.y},l={x:i.x+i.width,y:i.y+i.height};t.moveTo(a.x,a.y),t.lineTo(l.x,l.y);const c=Lp({x:l.x-a.x,y:l.y-a.y}),d=.04*Math.min(e.width,e.height);if(s.lineDecoration.indexOf("arrow-begin")!==-1){const h=Ml(c,d),p=Nl(a,h),f=dn(a,2,p),m=dn(a,-2,p);t.moveTo(f.x,f.y),t.lineTo(a.x,a.y),t.lineTo(m.x,m.y)}if(s.lineDecoration.indexOf("arrow-end")!==-1){const h=Ml(c,-d),p=Nl(l,h),f=dn(l,2,p),m=dn(l,-2,p);t.moveTo(f.x,f.y),t.lineTo(l.x,l.y),t.lineTo(m.x,m.y)}return ua(t),!0},Nb={rect:Ob,ellipse:$b,image:yb,text:Lb,line:Mb,path:Ab},Pb=t=>{const e=document.createElement("canvas");return e.width=t.width,e.height=t.height,e.getContext("2d").putImageData(t,0,0),e},Db=(t,e,s={})=>new Promise((i,n)=>{if(!t||!VE(t))return n({status:"not an image file",file:t});const{stripImageHead:a,beforeCreateBlob:l,afterCreateBlob:c,canvasMemoryLimit:d}=s,{crop:h,size:p,filter:f,markup:m,output:E}=e,g=e.image&&e.image.orientation?Math.max(1,Math.min(8,e.image.orientation)):null,I=E&&E.quality,w=I===null?null:I/100,S=E&&E.type||null,_=E&&E.background||null,R=[];p&&(typeof p.width=="number"||typeof p.height=="number")&&R.push({type:"resize",data:p}),f&&f.length===20&&R.push({type:"filter",data:f});const L=G=>{const C=c?c(G):G;Promise.resolve(C).then(i)},M=(G,C)=>{const k=Pb(G),q=m.length?Cb(k,m):k;Promise.resolve(q).then(W=>{JE(W,C,l).then(V=>{if(yp(W),a)return L(V);vb(t).then(X=>{X!==null&&(V=new Blob([X,V.slice(20)],{type:V.type})),L(V)})}).catch(n)})};if(/svg/.test(t.type)&&S===null)return mb(t,h,m,{background:_}).then(G=>{i(_b(G,"image/svg+xml"))});const D=URL.createObjectURL(t);Sb(D).then(G=>{URL.revokeObjectURL(D);const C=ZE(G,g,h,{canvasMemoryLimit:d,background:_}),k={quality:w,type:S||t.type};if(!R.length)return M(C,k);const q=xb(Eb);q.post({transforms:R,imageData:C},W=>{M(gb(W),k),q.terminate()},[C.data.buffer])}).catch(n)}),Fb=["x","y","left","top","right","bottom","width","height"],jb=t=>typeof t=="string"&&/%/.test(t)?parseFloat(t)/100:t,kb=t=>{const[e,s]=t,i=s.points?{}:Fb.reduce((n,a)=>(n[a]=jb(s[a]),n),{});return[e,b(b({zIndex:0},s),i)]},Gb=t=>new Promise((e,s)=>{const i=new Image;i.src=URL.createObjectURL(t);const n=()=>{const l=i.naturalWidth,c=i.naturalHeight;l&&c&&(URL.revokeObjectURL(i.src),clearInterval(a),e({width:l,height:c}))};i.onerror=l=>{URL.revokeObjectURL(i.src),clearInterval(a),s(l)};const a=setInterval(n,1);n()});typeof window!="undefined"&&typeof window.document!="undefined"&&(HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,s){const i=this;setTimeout(()=>{const n=i.toDataURL(e,s).split(",")[1],a=atob(n);let l=a.length;const c=new Uint8Array(l);for(;l--;)c[l]=a.charCodeAt(l);t(new Blob([c],{type:e||"image/png"}))})}}));const dh=typeof window!="undefined"&&typeof window.document!="undefined",Bb=dh&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Mp=({addFilter:t,utils:e})=>{const{Type:s,forin:i,getFileFromBlob:n,isFile:a}=e,l=["crop","resize","filter","markup","output"],c=p=>(f,m,E)=>f(m,p?p(E):E),d=p=>p.aspectRatio===null&&p.rotation===0&&p.zoom===1&&p.center&&p.center.x===.5&&p.center.y===.5&&p.flip&&p.flip.horizontal===!1&&p.flip.vertical===!1;t("SHOULD_PREPARE_OUTPUT",(p,{query:f})=>new Promise(m=>{m(!f("IS_ASYNC"))}));const h=(p,f,m)=>new Promise(E=>{if(!p("GET_ALLOW_IMAGE_TRANSFORM")||m.archived||!a(f)||!jE(f))return E(!1);Gb(f).then(()=>{const g=p("GET_IMAGE_TRANSFORM_IMAGE_FILTER");if(g){const I=g(f);if(I==null)return handleRevert(!0);if(typeof I=="boolean")return E(I);if(typeof I.then=="function")return I.then(E)}E(!0)}).catch(g=>{E(!1)})});return t("DID_CREATE_ITEM",(p,{query:f,dispatch:m})=>{f("GET_ALLOW_IMAGE_TRANSFORM")&&p.extend("requestPrepare",()=>new Promise((E,g)=>{m("REQUEST_PREPARE_OUTPUT",{query:p.id,item:p,success:E,failure:g},!0)}))}),t("PREPARE_OUTPUT",(p,{query:f,item:m})=>new Promise(E=>{h(f,p,m).then(g=>{if(!g)return E(p);const I=[];f("GET_IMAGE_TRANSFORM_VARIANTS_INCLUDE_ORIGINAL")&&I.push(()=>new Promise(C=>{C({name:f("GET_IMAGE_TRANSFORM_VARIANTS_ORIGINAL_NAME"),file:p})})),f("GET_IMAGE_TRANSFORM_VARIANTS_INCLUDE_DEFAULT")&&I.push((C,k,q)=>new Promise(W=>{C(k,q).then(V=>W({name:f("GET_IMAGE_TRANSFORM_VARIANTS_DEFAULT_NAME"),file:V}))}));const w=f("GET_IMAGE_TRANSFORM_VARIANTS")||{};i(w,(C,k)=>{const q=c(k);I.push((W,V,X)=>new Promise(j=>{q(W,V,X).then(K=>j({name:C,file:K}))}))});const S=f("GET_IMAGE_TRANSFORM_OUTPUT_QUALITY"),_=f("GET_IMAGE_TRANSFORM_OUTPUT_QUALITY_MODE"),R=S===null?null:S/100,L=f("GET_IMAGE_TRANSFORM_OUTPUT_MIME_TYPE"),M=f("GET_IMAGE_TRANSFORM_CLIENT_TRANSFORMS")||l;m.setMetadata("output",{type:L,quality:R,client:M},!0);const D=(C,k)=>new Promise((q,W)=>{const V=b({},k);Object.keys(V).filter(J=>J!=="exif").forEach(J=>{M.indexOf(J)===-1&&delete V[J]});const{resize:X,exif:j,output:K,crop:B,filter:H,markup:tt}=V,U={image:{orientation:j?j.orientation:null},output:K&&(K.type||typeof K.quality=="number"||K.background)?{type:K.type,quality:typeof K.quality=="number"?K.quality*100:null,background:K.background||f("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR")||null}:void 0,size:X&&(X.size.width||X.size.height)?b({mode:X.mode,upscale:X.upscale},X.size):void 0,crop:B&&!d(B)?b({},B):void 0,markup:tt&&tt.length?tt.map(kb):[],filter:H};if(U.output){const J=K.type?K.type!==C.type:!1,it=/\/jpe?g$/.test(C.type),at=K.quality!==null?it&&_==="always":!1;if(!!!(U.size||U.crop||U.filter||J||at))return q(C)}const Z={beforeCreateBlob:f("GET_IMAGE_TRANSFORM_BEFORE_CREATE_BLOB"),afterCreateBlob:f("GET_IMAGE_TRANSFORM_AFTER_CREATE_BLOB"),canvasMemoryLimit:f("GET_IMAGE_TRANSFORM_CANVAS_MEMORY_LIMIT"),stripImageHead:f("GET_IMAGE_TRANSFORM_OUTPUT_STRIP_IMAGE_HEAD")};Db(C,U,Z).then(J=>{const it=n(J,BE(C.name,UE(J.type)));q(it)}).catch(W)}),G=I.map(C=>C(D,p,m.getMetadata()));Promise.all(G).then(C=>{E(C.length===1&&C[0].name===null?C[0].file:C)})})})),{options:{allowImageTransform:[!0,s.BOOLEAN],imageTransformImageFilter:[null,s.FUNCTION],imageTransformOutputMimeType:[null,s.STRING],imageTransformOutputQuality:[null,s.INT],imageTransformOutputStripImageHead:[!0,s.BOOLEAN],imageTransformClientTransforms:[null,s.ARRAY],imageTransformOutputQualityMode:["always",s.STRING],imageTransformVariants:[null,s.OBJECT],imageTransformVariantsIncludeDefault:[!0,s.BOOLEAN],imageTransformVariantsDefaultName:[null,s.STRING],imageTransformVariantsIncludeOriginal:[!1,s.BOOLEAN],imageTransformVariantsOriginalName:["original_",s.STRING],imageTransformBeforeCreateBlob:[null,s.FUNCTION],imageTransformAfterCreateBlob:[null,s.FUNCTION],imageTransformCanvasMemoryLimit:[dh&&Bb?4096*4096:null,s.INT],imageTransformCanvasBackgroundColor:[null,s.STRING]}}};dh&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:Mp}));const Ub=t=>/^image/.test(t.type),Vb=t=>new Promise((e,s)=>{const i=document.createElement("img");i.src=URL.createObjectURL(t),i.onerror=a=>{clearInterval(n),s(a)};const n=setInterval(()=>{i.naturalWidth&&i.naturalHeight&&(clearInterval(n),URL.revokeObjectURL(i.src),e({width:i.naturalWidth,height:i.naturalHeight}))},1)}),Np=({addFilter:t,utils:e})=>{const{Type:s,replaceInString:i,isFile:n}=e,a=(l,c,d)=>new Promise((h,p)=>{const f=({width:m,height:E})=>{const{minWidth:g,minHeight:I,maxWidth:w,maxHeight:S,minResolution:_,maxResolution:R}=c,L=m*E;m<g||E<I?p("TOO_SMALL"):m>w||E>S?p("TOO_BIG"):_!==null&&L<_?p("TOO_LOW_RES"):R!==null&&L>R&&p("TOO_HIGH_RES"),h()};Vb(l).then(f).catch(()=>{if(!d){p();return}d(l,c).then(f).catch(()=>p())})});return t("LOAD_FILE",(l,{query:c})=>new Promise((d,h)=>{if(!n(l)||!Ub(l)||!c("GET_ALLOW_IMAGE_VALIDATE_SIZE")){d(l);return}const p={minWidth:c("GET_IMAGE_VALIDATE_SIZE_MIN_WIDTH"),minHeight:c("GET_IMAGE_VALIDATE_SIZE_MIN_HEIGHT"),maxWidth:c("GET_IMAGE_VALIDATE_SIZE_MAX_WIDTH"),maxHeight:c("GET_IMAGE_VALIDATE_SIZE_MAX_HEIGHT"),minResolution:c("GET_IMAGE_VALIDATE_SIZE_MIN_RESOLUTION"),maxResolution:c("GET_IMAGE_VALIDATE_SIZE_MAX_RESOLUTION")},f=c("GET_IMAGE_VALIDATE_SIZE_MEASURE");a(l,p,f).then(()=>{d(l)}).catch(m=>{const E=m?{TOO_SMALL:{label:c("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_SMALL"),details:c("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_SIZE")},TOO_BIG:{label:c("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_BIG"),details:c("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_SIZE")},TOO_LOW_RES:{label:c("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_LOW"),details:c("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_RESOLUTION")},TOO_HIGH_RES:{label:c("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_HIGH"),details:c("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_RESOLUTION")}}[m]:{label:c("GET_IMAGE_VALIDATE_SIZE_LABEL_FORMAT_ERROR"),details:l.type};h({status:{main:E.label,sub:m?i(E.details,p):E.details}})})})),{options:{allowImageValidateSize:[!0,s.BOOLEAN],imageValidateSizeLabelFormatError:["Image type not supported",s.STRING],imageValidateSizeMeasure:[null,s.FUNCTION],imageValidateSizeMinResolution:[null,s.INT],imageValidateSizeMaxResolution:[null,s.INT],imageValidateSizeLabelImageResolutionTooLow:["Resolution is too low",s.STRING],imageValidateSizeLabelImageResolutionTooHigh:["Resolution is too high",s.STRING],imageValidateSizeLabelExpectedMinResolution:["Minimum resolution is {minResolution}",s.STRING],imageValidateSizeLabelExpectedMaxResolution:["Maximum resolution is {maxResolution}",s.STRING],imageValidateSizeMinWidth:[1,s.INT],imageValidateSizeMinHeight:[1,s.INT],imageValidateSizeMaxWidth:[65535,s.INT],imageValidateSizeMaxHeight:[65535,s.INT],imageValidateSizeLabelImageSizeTooSmall:["Image is too small",s.STRING],imageValidateSizeLabelImageSizeTooBig:["Image is too big",s.STRING],imageValidateSizeLabelExpectedMinSize:["Minimum size is {minWidth} × {minHeight}",s.STRING],imageValidateSizeLabelExpectedMaxSize:["Maximum size is {maxWidth} × {maxHeight}",s.STRING]}}},zb=typeof window!="undefined"&&typeof window.document!="undefined";zb&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:Np}));const Pl=t=>/^video/.test(t.type),Sr=t=>/^audio/.test(t.type),Ua=t=>/pdf$/.test(t.type);class Wb{constructor(e,s){this.mediaEl=e,this.audioElems=s,this.onplayhead=!1,this.duration=0,this.timelineWidth=this.audioElems.timeline.offsetWidth-this.audioElems.playhead.offsetWidth,this.moveplayheadFn=this.moveplayhead.bind(this),this.registerListeners()}registerListeners(){this.mediaEl.addEventListener("timeupdate",this.timeUpdate.bind(this),!1),this.mediaEl.addEventListener("canplaythrough",()=>this.duration=this.mediaEl.duration,!1),this.audioElems.timeline.addEventListener("click",this.timelineClicked.bind(this),!1),this.audioElems.button.addEventListener("click",this.play.bind(this)),this.audioElems.playhead.addEventListener("mousedown",this.mouseDown.bind(this),!1),window.addEventListener("mouseup",this.mouseUp.bind(this),!1)}play(){this.mediaEl.paused?this.mediaEl.play():this.mediaEl.pause(),this.audioElems.button.classList.toggle("play"),this.audioElems.button.classList.toggle("pause")}timeUpdate(){let e=this.mediaEl.currentTime/this.duration*100;this.audioElems.playhead.style.marginLeft=e+"%",this.mediaEl.currentTime===this.duration&&(this.audioElems.button.classList.toggle("play"),this.audioElems.button.classList.toggle("pause"))}moveplayhead(e){let s=e.clientX-this.getPosition(this.audioElems.timeline);s>=0&&s<=this.timelineWidth&&(this.audioElems.playhead.style.marginLeft=s+"px"),s<0&&(this.audioElems.playhead.style.marginLeft="0px"),s>this.timelineWidth&&(this.audioElems.playhead.style.marginLeft=this.timelineWidth-4+"px")}timelineClicked(e){this.moveplayhead(e),this.mediaEl.currentTime=this.duration*this.clickPercent(e)}mouseDown(){this.onplayhead=!0,window.addEventListener("mousemove",this.moveplayheadFn,!0),this.mediaEl.removeEventListener("timeupdate",this.timeUpdate.bind(this),!1)}mouseUp(e){window.removeEventListener("mousemove",this.moveplayheadFn,!0),this.onplayhead==!0&&(this.moveplayhead(e),this.mediaEl.currentTime=this.duration*this.clickPercent(e),this.mediaEl.addEventListener("timeupdate",this.timeUpdate.bind(this),!1)),this.onplayhead=!1}clickPercent(e){return(e.clientX-this.getPosition(this.audioElems.timeline))/this.timelineWidth}getPosition(e){return e.getBoundingClientRect().left}}const Hb=t=>t.utils.createView({name:"media-preview",tag:"div",ignoreRect:!0,create:({root:e,props:s})=>{const i=e.query("GET_ITEM",{id:s.id});if(Ua(i.file))e.ref.media=document.createElement("object"),e.ref.media.setAttribute("height",300),e.ref.media.setAttribute("width",320),e.ref.media.setAttribute("style","position:absolute;left:0;right:0;margin:auto;"),e.element.appendChild(e.ref.media);else{let n=Sr(i.file)?"audio":"video";if(e.ref.media=document.createElement(n),e.ref.media.setAttribute("controls",!0),e.element.appendChild(e.ref.media),Sr(i.file)){let a=document.createDocumentFragment();e.ref.audio=[],e.ref.audio.container=document.createElement("div"),e.ref.audio.button=document.createElement("span"),e.ref.audio.timeline=document.createElement("div"),e.ref.audio.playhead=document.createElement("div"),e.ref.audio.container.className="audioplayer",e.ref.audio.button.className="playpausebtn play",e.ref.audio.timeline.className="timeline",e.ref.audio.playhead.className="playhead",e.ref.audio.timeline.appendChild(e.ref.audio.playhead),e.ref.audio.container.appendChild(e.ref.audio.button),e.ref.audio.container.appendChild(e.ref.audio.timeline),a.appendChild(e.ref.audio.container),e.element.appendChild(a)}}},write:t.utils.createRoute({DID_MEDIA_PREVIEW_LOAD:({root:e,props:s})=>{const{id:i}=s,n=e.query("GET_ITEM",{id:i});if(!n)return;let a=window.URL||window.webkitURL,l=new Blob([n.file],{type:n.file.type});e.ref.media.type=n.file.type,Ua(n.file)?e.ref.media.data=a.createObjectURL(l):e.ref.media.src=n.file.mock&&n.file.url||a.createObjectURL(l),Sr(n.file)&&new Wb(e.ref.media,e.ref.audio),e.ref.media.addEventListener("loadeddata",()=>{if(Pl(n.file)||Sr(n.file)){let c=75;if(Pl(n.file)){let d=e.ref.media.offsetWidth,h=e.ref.media.videoWidth/d;c=e.ref.media.videoHeight/h}e.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i,height:c})}},!1),e.ref.media.addEventListener("load",()=>{Ua(n.file)&&e.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i,height:e.ref.media.scrollHeight})},!1)}})}),qb=t=>{const e=({root:i,props:n})=>{const{id:a}=n;i.query("GET_ITEM",a)&&i.dispatch("DID_MEDIA_PREVIEW_LOAD",{id:a})},s=({root:i,props:n})=>{const a=Hb(t);i.ref.media=i.appendChildView(i.createChildView(a,{id:n.id}))};return t.utils.createView({name:"media-preview-wrapper",create:s,write:t.utils.createRoute({DID_MEDIA_PREVIEW_CONTAINER_CREATE:e})})},Pp=t=>{const{addFilter:e,utils:s}=t,{Type:i,createRoute:n}=s,a=qb(t);return e("CREATE_VIEW",l=>{const{is:c,view:d,query:h}=l;if(!c("file"))return;const p=({root:f,props:m})=>{const{id:E}=m,g=h("GET_ITEM",E);!g||g.archived||!Pl(g.file)&&!Ua(g.file)&&!Sr(g.file)||(f.ref.mediaPreview=d.appendChildView(d.createChildView(a,{id:E})),f.dispatch("DID_MEDIA_PREVIEW_CONTAINER_CREATE",{id:E}))};d.registerWriter(n({DID_LOAD_ITEM:p},({root:f,props:m})=>{const{id:E}=m,g=h("GET_ITEM",E);!Pl(g.file)&&!Ua(g.file)&&!Sr(g.file)||f.rect.element.hidden}))}),{options:{allowPdfPreview:[!0,i.BOOLEAN],allowVideoPreview:[!0,i.BOOLEAN],allowAudioPreview:[!0,i.BOOLEAN]}}},Yb=typeof window!="undefined"&&typeof window.document!="undefined";Yb&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:Pp}));const Xb=t=>t instanceof HTMLElement,Zb=(t,e=[],s=[])=>{const i=b({},t),n=[],a=[],l=()=>b({},i),c=()=>{const g=[...n];return n.length=0,g},d=()=>{const g=[...a];a.length=0,g.forEach(({type:I,data:w})=>{h(I,w)})},h=(g,I,w)=>{if(w&&!document.hidden){a.push({type:g,data:I});return}E[g]&&E[g](I),n.push({type:g,data:I})},p=(g,...I)=>m[g]?m[g](...I):null,f={getState:l,processActionQueue:c,processDispatchQueue:d,dispatch:h,query:p};let m={};e.forEach(g=>{m=b(b({},g(i)),m)});let E={};return s.forEach(g=>{E=b(b({},g(h,p,i)),E)}),f},Qb=(t,e,s)=>{if(typeof s=="function"){t[e]=s;return}Object.defineProperty(t,e,b({},s))},Qt=(t,e)=>{for(const s in t)t.hasOwnProperty(s)&&e(s,t[s])},hn=t=>{const e={};return Qt(t,s=>{Qb(e,s,t[s])}),e},Ee=(t,e,s=null)=>{if(s===null)return t.getAttribute(e)||t.hasAttribute(e);t.setAttribute(e,s)},Jb="http://www.w3.org/2000/svg",Kb=["svg","path"],Jh=t=>Kb.includes(t),Dl=(t,e,s={})=>{typeof e=="object"&&(s=e,e=null);const i=Jh(t)?document.createElementNS(Jb,t):document.createElement(t);return e&&(Jh(t)?Ee(i,"class",e):i.className=e),Qt(s,(n,a)=>{Ee(i,n,a)}),i},tI=t=>(e,s)=>{typeof s!="undefined"&&t.children[s]?t.insertBefore(e,t.children[s]):t.appendChild(e)},eI=(t,e)=>(s,i)=>(typeof i!="undefined"?e.splice(i,0,s):e.push(s),s),sI=(t,e)=>s=>(e.splice(e.indexOf(s),1),s.element.parentNode&&t.removeChild(s.element),s),iI=typeof window!="undefined"&&typeof window.document!="undefined",Dp=()=>iI,nI=Dp()?Dl("svg"):{},rI="children"in nI?t=>t.children.length:t=>t.childNodes.length,Fp=(t,e,s,i)=>{const n=s[0]||t.left,a=s[1]||t.top,l=n+t.width,c=a+t.height*(i[1]||1),d={element:b({},t),inner:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},outer:{left:n,top:a,right:l,bottom:c}};return e.filter(h=>!h.isRectIgnored()).map(h=>h.rect).forEach(h=>{Kh(d.inner,b({},h.inner)),Kh(d.outer,b({},h.outer))}),tu(d.inner),d.outer.bottom+=d.element.marginBottom,d.outer.right+=d.element.marginRight,tu(d.outer),d},Kh=(t,e)=>{e.top+=t.top,e.right+=t.left,e.bottom+=t.top,e.left+=t.left,e.bottom>t.bottom&&(t.bottom=e.bottom),e.right>t.right&&(t.right=e.right)},tu=t=>{t.width=t.right-t.left,t.height=t.bottom-t.top},$n=t=>typeof t=="number",aI=(t,e,s,i=.001)=>Math.abs(t-e)<i&&Math.abs(s)<i,oI=({stiffness:t=.5,damping:e=.75,mass:s=10}={})=>{let i=null,n=null,a=0,l=!1;const h=hn({interpolate:(p,f)=>{if(l)return;if(!($n(i)&&$n(n))){l=!0,a=0;return}const m=-(n-i)*t;a+=m/s,n+=a,a*=e,aI(n,i,a)||f?(n=i,a=0,l=!0,h.onupdate(n),h.oncomplete(n)):h.onupdate(n)},target:{set:p=>{if($n(p)&&!$n(n)&&(n=p),i===null&&(i=p,n=p),i=p,n===i||typeof i=="undefined"){l=!0,a=0,h.onupdate(n),h.oncomplete(n);return}l=!1},get:()=>i},resting:{get:()=>l},onupdate:p=>{},oncomplete:p=>{}});return h},lI=t=>t<.5?2*t*t:-1+(4-2*t)*t,cI=({duration:t=500,easing:e=lI,delay:s=0}={})=>{let i=null,n,a,l=!0,c=!1,d=null;const p=hn({interpolate:(f,m)=>{l||d===null||(i===null&&(i=f),!(f-i<s)&&(n=f-i-s,n>=t||m?(n=1,a=c?0:1,p.onupdate(a*d),p.oncomplete(a*d),l=!0):(a=n/t,p.onupdate((n>=0?e(c?1-a:a):0)*d))))},target:{get:()=>c?0:d,set:f=>{if(d===null){d=f,p.onupdate(f),p.oncomplete(f);return}f<d?(d=1,c=!0):(c=!1,d=f),l=!1,i=null}},resting:{get:()=>l},onupdate:f=>{},oncomplete:f=>{}});return p},eu={spring:oI,tween:cI},dI=(t,e,s)=>{const i=t[e]&&typeof t[e][s]=="object"?t[e][s]:t[e]||t,n=typeof i=="string"?i:i.type,a=typeof i=="object"?b({},i):{};return eu[n]?eu[n](a):null},hh=(t,e,s,i=!1)=>{e=Array.isArray(e)?e:[e],e.forEach(n=>{t.forEach(a=>{let l=a,c=()=>s[a],d=h=>s[a]=h;typeof a=="object"&&(l=a.key,c=a.getter||c,d=a.setter||d),!(n[l]&&!i)&&(n[l]={get:c,set:d})})})},hI=({mixinConfig:t,viewProps:e,viewInternalAPI:s,viewExternalAPI:i})=>{const n=b({},e),a=[];return Qt(t,(l,c)=>{const d=dI(c);if(!d)return;d.onupdate=p=>{e[l]=p},d.target=n[l],hh([{key:l,setter:p=>{d.target!==p&&(d.target=p)},getter:()=>e[l]}],[s,i],e,!0),a.push(d)}),{write:l=>{let c=document.hidden,d=!0;return a.forEach(h=>{h.resting||(d=!1),h.interpolate(l,c)}),d},destroy:()=>{}}},uI=t=>(e,s)=>{t.addEventListener(e,s)},pI=t=>(e,s)=>{t.removeEventListener(e,s)},fI=({mixinConfig:t,viewProps:e,viewInternalAPI:s,viewExternalAPI:i,viewState:n,view:a})=>{const l=[],c=uI(a.element),d=pI(a.element);return i.on=(h,p)=>{l.push({type:h,fn:p}),c(h,p)},i.off=(h,p)=>{l.splice(l.findIndex(f=>f.type===h&&f.fn===p),1),d(h,p)},{write:()=>!0,destroy:()=>{l.forEach(h=>{d(h.type,h.fn)})}}},mI=({mixinConfig:t,viewProps:e,viewExternalAPI:s})=>{hh(t,s,e)},Ue=t=>t!=null,gI={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},EI=({mixinConfig:t,viewProps:e,viewInternalAPI:s,viewExternalAPI:i,view:n})=>{const a=b({},e),l={};hh(t,[s,i],e);const c=()=>[e.translateX||0,e.translateY||0],d=()=>[e.scaleX||0,e.scaleY||0],h=()=>n.rect?Fp(n.rect,n.childViews,c(),d()):null;return s.rect={get:h},i.rect={get:h},t.forEach(p=>{e[p]=typeof a[p]=="undefined"?gI[p]:a[p]}),{write:()=>{if(bI(l,e))return II(n.element,e),Object.assign(l,b({},e)),!0},destroy:()=>{}}},bI=(t,e)=>{if(Object.keys(t).length!==Object.keys(e).length)return!0;for(const s in e)if(e[s]!==t[s])return!0;return!1},II=(t,{opacity:e,perspective:s,translateX:i,translateY:n,scaleX:a,scaleY:l,rotateX:c,rotateY:d,rotateZ:h,originX:p,originY:f,width:m,height:E})=>{let g="",I="";(Ue(p)||Ue(f))&&(I+=`transform-origin: ${p||0}px ${f||0}px;`),Ue(s)&&(g+=`perspective(${s}px) `),(Ue(i)||Ue(n))&&(g+=`translate3d(${i||0}px, ${n||0}px, 0) `),(Ue(a)||Ue(l))&&(g+=`scale3d(${Ue(a)?a:1}, ${Ue(l)?l:1}, 1) `),Ue(h)&&(g+=`rotateZ(${h}rad) `),Ue(c)&&(g+=`rotateX(${c}rad) `),Ue(d)&&(g+=`rotateY(${d}rad) `),g.length&&(I+=`transform:${g};`),Ue(e)&&(I+=`opacity:${e};`,e===0&&(I+="visibility:hidden;"),e<1&&(I+="pointer-events:none;")),Ue(E)&&(I+=`height:${E}px;`),Ue(m)&&(I+=`width:${m}px;`);const w=t.elementCurrentStyle||"";(I.length!==w.length||I!==w)&&(t.style.cssText=I,t.elementCurrentStyle=I)},vI={styles:EI,listeners:fI,animations:hI,apis:mI},su=(t={},e={},s={})=>(e.layoutCalculated||(t.paddingTop=parseInt(s.paddingTop,10)||0,t.marginTop=parseInt(s.marginTop,10)||0,t.marginRight=parseInt(s.marginRight,10)||0,t.marginBottom=parseInt(s.marginBottom,10)||0,t.marginLeft=parseInt(s.marginLeft,10)||0,e.layoutCalculated=!0),t.left=e.offsetLeft||0,t.top=e.offsetTop||0,t.width=e.offsetWidth||0,t.height=e.offsetHeight||0,t.right=t.left+t.width,t.bottom=t.top+t.height,t.scrollTop=e.scrollTop,t.hidden=e.offsetParent===null,t),ae=({tag:t="div",name:e=null,attributes:s={},read:i=()=>{},write:n=()=>{},create:a=()=>{},destroy:l=()=>{},filterFrameActionsForChild:c=(E,g)=>g,didCreateView:d=()=>{},didWriteView:h=()=>{},ignoreRect:p=!1,ignoreRectUpdate:f=!1,mixins:m=[]}={})=>(E,g={})=>{const I=Dl(t,`filepond--${e}`,s),w=window.getComputedStyle(I,null),S=su();let _=null,R=!1;const L=[],M=[],D={},G={},C=[n],k=[i],q=[l],W=()=>I,V=()=>L.concat(),X=()=>D,j=ct=>(ut,Et)=>ut(ct,Et),K=()=>_||(_=Fp(S,L,[0,0],[1,1]),_),B=()=>w,H=()=>{_=null,L.forEach(Et=>Et._read()),!(f&&S.width&&S.height)&&su(S,I,w);const ut={root:vt,props:g,rect:S};k.forEach(Et=>Et(ut))},tt=(ct,ut,Et)=>{let St=ut.length===0;return C.forEach(It=>{It({props:g,root:vt,actions:ut,timestamp:ct,shouldOptimize:Et})===!1&&(St=!1)}),M.forEach(It=>{It.write(ct)===!1&&(St=!1)}),L.filter(It=>!!It.element.parentNode).forEach(It=>{It._write(ct,c(It,ut),Et)||(St=!1)}),L.forEach((It,oe)=>{It.element.parentNode||(vt.appendChild(It.element,oe),It._read(),It._write(ct,c(It,ut),Et),St=!1)}),R=St,h({props:g,root:vt,actions:ut,timestamp:ct}),St},U=()=>{M.forEach(ct=>ct.destroy()),q.forEach(ct=>{ct({root:vt,props:g})}),L.forEach(ct=>ct._destroy())},Z={element:{get:W},style:{get:B},childViews:{get:V}},J=A(b({},Z),{rect:{get:K},ref:{get:X},is:ct=>e===ct,appendChild:tI(I),createChildView:j(E),linkView:ct=>(L.push(ct),ct),unlinkView:ct=>{L.splice(L.indexOf(ct),1)},appendChildView:eI(I,L),removeChildView:sI(I,L),registerWriter:ct=>C.push(ct),registerReader:ct=>k.push(ct),registerDestroyer:ct=>q.push(ct),invalidateLayout:()=>I.layoutCalculated=!1,dispatch:E.dispatch,query:E.query}),it={element:{get:W},childViews:{get:V},rect:{get:K},resting:{get:()=>R},isRectIgnored:()=>p,_read:H,_write:tt,_destroy:U},at=A(b({},Z),{rect:{get:()=>S}});Object.keys(m).sort((ct,ut)=>ct==="styles"?1:ut==="styles"?-1:0).forEach(ct=>{const ut=vI[ct]({mixinConfig:m[ct],viewProps:g,viewState:G,viewInternalAPI:J,viewExternalAPI:it,view:hn(at)});ut&&M.push(ut)});const vt=hn(J);a({root:vt,props:g});const _t=rI(I);return L.forEach((ct,ut)=>{vt.appendChild(ct.element,_t+ut)}),d(vt),hn(it)},wI=(t,e,s=60)=>{const i="__framePainter";if(window[i]){window[i].readers.push(t),window[i].writers.push(e);return}window[i]={readers:[t],writers:[e]};const n=window[i],a=1e3/s;let l=null,c=null,d=null,h=null;const p=()=>{document.hidden?(d=()=>window.setTimeout(()=>f(performance.now()),a),h=()=>window.clearTimeout(c)):(d=()=>window.requestAnimationFrame(f),h=()=>window.cancelAnimationFrame(c))};document.addEventListener("visibilitychange",()=>{h&&h(),p(),f(performance.now())});const f=m=>{c=d(f),l||(l=m);const E=m-l;E<=a||(l=m-E%a,n.readers.forEach(g=>g()),n.writers.forEach(g=>g(m)))};return p(),f(performance.now()),{pause:()=>{h(c)}}},Ye=(t,e)=>({root:s,props:i,actions:n=[],timestamp:a,shouldOptimize:l})=>{n.filter(c=>t[c.type]).forEach(c=>t[c.type]({root:s,props:i,action:c.data,timestamp:a,shouldOptimize:l})),e&&e({root:s,props:i,actions:n,timestamp:a,shouldOptimize:l})},iu=(t,e)=>e.parentNode.insertBefore(t,e),nu=(t,e)=>e.parentNode.insertBefore(t,e.nextSibling),cc=t=>Array.isArray(t),Gi=t=>t==null,_I=t=>t.trim(),dc=t=>""+t,TI=(t,e=",")=>Gi(t)?[]:cc(t)?t:dc(t).split(e).map(_I).filter(s=>s.length),jp=t=>typeof t=="boolean",kp=t=>jp(t)?t:t==="true",qe=t=>typeof t=="string",Gp=t=>$n(t)?t:qe(t)?dc(t).replace(/[a-z]+/gi,""):0,tl=t=>parseInt(Gp(t),10),ru=t=>parseFloat(Gp(t)),pa=t=>$n(t)&&isFinite(t)&&Math.floor(t)===t,au=(t,e=1e3)=>{if(pa(t))return t;let s=dc(t).trim();return/MB$/i.test(s)?(s=s.replace(/MB$i/,"").trim(),tl(s)*e*e):/KB/i.test(s)?(s=s.replace(/KB$i/,"").trim(),tl(s)*e):tl(s)},yn=t=>typeof t=="function",xI=t=>{let e=self,s=t.split("."),i=null;for(;i=s.shift();)if(e=e[i],!e)return null;return e},ou={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},SI=t=>{const e={};return e.url=qe(t)?t:t.url||"",e.timeout=t.timeout?parseInt(t.timeout,10):0,e.headers=t.headers?t.headers:{},Qt(ou,s=>{e[s]=RI(s,t[s],ou[s],e.timeout,e.headers)}),e.process=t.process||qe(t)||t.url?e.process:null,e.remove=t.remove||null,delete e.headers,e},RI=(t,e,s,i,n)=>{if(e===null)return null;if(typeof e=="function")return e;const a={url:s==="GET"||s==="PATCH"?`?${t}=`:"",method:s,headers:n,withCredentials:!1,timeout:i,onload:null,ondata:null,onerror:null};if(qe(e))return a.url=e,a;if(Object.assign(a,e),qe(a.headers)){const l=a.headers.split(/:(.+)/);a.headers={header:l[0],value:l[1]}}return a.withCredentials=kp(a.withCredentials),a},CI=t=>SI(t),OI=t=>t===null,we=t=>typeof t=="object"&&t!==null,$I=t=>we(t)&&qe(t.url)&&we(t.process)&&we(t.revert)&&we(t.restore)&&we(t.fetch),Pc=t=>cc(t)?"array":OI(t)?"null":pa(t)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(t)?"bytes":$I(t)?"api":typeof t,yI=t=>t.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'),LI={array:TI,boolean:kp,int:t=>Pc(t)==="bytes"?au(t):tl(t),number:ru,float:ru,bytes:au,string:t=>yn(t)?t:dc(t),function:t=>xI(t),serverapi:CI,object:t=>{try{return JSON.parse(yI(t))}catch(e){return null}}},AI=(t,e)=>LI[e](t),Bp=(t,e,s)=>{if(t===e)return t;let i=Pc(t);if(i!==s){const n=AI(t,s);if(i=Pc(n),n===null)throw`Trying to assign value with incorrect type to "${option}", allowed type: "${s}"`;t=n}return t},MI=(t,e)=>{let s=t;return{enumerable:!0,get:()=>s,set:i=>{s=Bp(i,t,e)}}},NI=t=>{const e={};return Qt(t,s=>{const i=t[s];e[s]=MI(i[0],i[1])}),hn(e)},PI=t=>({items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:NI(t)}),hc=(t,e="-")=>t.split(/(?=[A-Z])/).map(s=>s.toLowerCase()).join(e),DI=(t,e)=>{const s={};return Qt(e,i=>{s[i]={get:()=>t.getState().options[i],set:n=>{t.dispatch(`SET_${hc(i,"_").toUpperCase()}`,{value:n})}}}),s},FI=t=>(e,s,i)=>{const n={};return Qt(t,a=>{const l=hc(a,"_").toUpperCase();n[`SET_${l}`]=c=>{try{i.options[a]=c.value}catch(d){}e(`DID_SET_${l}`,{value:i.options[a]})}}),n},jI=t=>e=>{const s={};return Qt(t,i=>{s[`GET_${hc(i,"_").toUpperCase()}`]=n=>e.options[i]}),s},$s={API:1,DROP:2,BROWSE:3,PASTE:4,NONE:5},uh=()=>Math.random().toString(36).substring(2,11),ph=(t,e)=>t.splice(e,1),kI=(t,e)=>{e?t():document.hidden?Promise.resolve(1).then(t):setTimeout(t,0)},uc=()=>{const t=[],e=(i,n)=>{ph(t,t.findIndex(a=>a.event===i&&(a.cb===n||!n)))},s=(i,n,a)=>{t.filter(l=>l.event===i).map(l=>l.cb).forEach(l=>kI(()=>l(...n),a))};return{fireSync:(i,...n)=>{s(i,n,!0)},fire:(i,...n)=>{s(i,n,!1)},on:(i,n)=>{t.push({event:i,cb:n})},onOnce:(i,n)=>{t.push({event:i,cb:(...a)=>{e(i,n),n(...a)}})},off:e}},Up=(t,e,s)=>{Object.getOwnPropertyNames(t).filter(i=>!s.includes(i)).forEach(i=>Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i)))},GI=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],es=t=>{const e={};return Up(t,e,GI),e},BI=t=>{t.forEach((e,s)=>{e.released&&ph(t,s)})},bt={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},ge={INPUT:1,LIMBO:2,LOCAL:3},Vp=t=>/[^0-9]+/.exec(t),zp=()=>Vp(1.1.toLocaleString())[0],UI=()=>{const t=zp(),e=1e3.toLocaleString();return e!=="1000"?Vp(e)[0]:t==="."?",":"."},Y={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},fh=[],Zs=(t,e,s)=>new Promise((i,n)=>{const a=fh.filter(c=>c.key===t).map(c=>c.cb);if(a.length===0){i(e);return}const l=a.shift();a.reduce((c,d)=>c.then(h=>d(h,s)),l(e,s)).then(c=>i(c)).catch(c=>n(c))}),er=(t,e,s)=>fh.filter(i=>i.key===t).map(i=>i.cb(e,s)),VI=(t,e)=>fh.push({key:t,cb:e}),zI=t=>Object.assign(Rr,t),Fl=()=>b({},Rr),WI=t=>{Qt(t,(e,s)=>{Rr[e]&&(Rr[e][0]=Bp(s,Rr[e][0],Rr[e][1]))})},Rr={id:[null,Y.STRING],name:["filepond",Y.STRING],disabled:[!1,Y.BOOLEAN],className:[null,Y.STRING],required:[!1,Y.BOOLEAN],captureMethod:[null,Y.STRING],allowSyncAcceptAttribute:[!0,Y.BOOLEAN],allowDrop:[!0,Y.BOOLEAN],allowBrowse:[!0,Y.BOOLEAN],allowPaste:[!0,Y.BOOLEAN],allowMultiple:[!1,Y.BOOLEAN],allowReplace:[!0,Y.BOOLEAN],allowRevert:[!0,Y.BOOLEAN],allowRemove:[!0,Y.BOOLEAN],allowProcess:[!0,Y.BOOLEAN],allowReorder:[!1,Y.BOOLEAN],allowDirectoriesOnly:[!1,Y.BOOLEAN],storeAsFile:[!1,Y.BOOLEAN],forceRevert:[!1,Y.BOOLEAN],maxFiles:[null,Y.INT],checkValidity:[!1,Y.BOOLEAN],itemInsertLocationFreedom:[!0,Y.BOOLEAN],itemInsertLocation:["before",Y.STRING],itemInsertInterval:[75,Y.INT],dropOnPage:[!1,Y.BOOLEAN],dropOnElement:[!0,Y.BOOLEAN],dropValidation:[!1,Y.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],Y.ARRAY],instantUpload:[!0,Y.BOOLEAN],maxParallelUploads:[2,Y.INT],allowMinimumUploadDuration:[!0,Y.BOOLEAN],chunkUploads:[!1,Y.BOOLEAN],chunkForce:[!1,Y.BOOLEAN],chunkSize:[5e6,Y.INT],chunkRetryDelays:[[500,1e3,3e3],Y.ARRAY],server:[null,Y.SERVER_API],fileSizeBase:[1e3,Y.INT],labelFileSizeBytes:["bytes",Y.STRING],labelFileSizeKilobytes:["KB",Y.STRING],labelFileSizeMegabytes:["MB",Y.STRING],labelFileSizeGigabytes:["GB",Y.STRING],labelDecimalSeparator:[zp(),Y.STRING],labelThousandsSeparator:[UI(),Y.STRING],labelIdle:['Drag & Drop your files or <span class="filepond--label-action">Browse</span>',Y.STRING],labelInvalidField:["Field contains invalid files",Y.STRING],labelFileWaitingForSize:["Waiting for size",Y.STRING],labelFileSizeNotAvailable:["Size not available",Y.STRING],labelFileCountSingular:["file in list",Y.STRING],labelFileCountPlural:["files in list",Y.STRING],labelFileLoading:["Loading",Y.STRING],labelFileAdded:["Added",Y.STRING],labelFileLoadError:["Error during load",Y.STRING],labelFileRemoved:["Removed",Y.STRING],labelFileRemoveError:["Error during remove",Y.STRING],labelFileProcessing:["Uploading",Y.STRING],labelFileProcessingComplete:["Upload complete",Y.STRING],labelFileProcessingAborted:["Upload cancelled",Y.STRING],labelFileProcessingError:["Error during upload",Y.STRING],labelFileProcessingRevertError:["Error during revert",Y.STRING],labelTapToCancel:["tap to cancel",Y.STRING],labelTapToRetry:["tap to retry",Y.STRING],labelTapToUndo:["tap to undo",Y.STRING],labelButtonRemoveItem:["Remove",Y.STRING],labelButtonAbortItemLoad:["Abort",Y.STRING],labelButtonRetryItemLoad:["Retry",Y.STRING],labelButtonAbortItemProcessing:["Cancel",Y.STRING],labelButtonUndoItemProcessing:["Undo",Y.STRING],labelButtonRetryItemProcessing:["Retry",Y.STRING],labelButtonProcessItem:["Upload",Y.STRING],iconRemove:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M11.586 13l-2.293 2.293a1 1 0 0 0 1.414 1.414L13 14.414l2.293 2.293a1 1 0 0 0 1.414-1.414L14.414 13l2.293-2.293a1 1 0 0 0-1.414-1.414L13 11.586l-2.293-2.293a1 1 0 0 0-1.414 1.414L11.586 13z" fill="currentColor" fill-rule="nonzero"/></svg>',Y.STRING],iconProcess:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M14 10.414v3.585a1 1 0 0 1-2 0v-3.585l-1.293 1.293a1 1 0 0 1-1.414-1.415l3-3a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1-1.414 1.415L14 10.414zM9 18a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2H9z" fill="currentColor" fill-rule="evenodd"/></svg>',Y.STRING],iconRetry:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M10.81 9.185l-.038.02A4.997 4.997 0 0 0 8 13.683a5 5 0 0 0 5 5 5 5 0 0 0 5-5 1 1 0 0 1 2 0A7 7 0 1 1 9.722 7.496l-.842-.21a.999.999 0 1 1 .484-1.94l3.23.806c.535.133.86.675.73 1.21l-.804 3.233a.997.997 0 0 1-1.21.73.997.997 0 0 1-.73-1.21l.23-.928v-.002z" fill="currentColor" fill-rule="nonzero"/></svg>',Y.STRING],iconUndo:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M9.185 10.81l.02-.038A4.997 4.997 0 0 1 13.683 8a5 5 0 0 1 5 5 5 5 0 0 1-5 5 1 1 0 0 0 0 2A7 7 0 1 0 7.496 9.722l-.21-.842a.999.999 0 1 0-1.94.484l.806 3.23c.133.535.675.86 1.21.73l3.233-.803a.997.997 0 0 0 .73-1.21.997.997 0 0 0-1.21-.73l-.928.23-.002-.001z" fill="currentColor" fill-rule="nonzero"/></svg>',Y.STRING],iconDone:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M18.293 9.293a1 1 0 0 1 1.414 1.414l-7.002 7a1 1 0 0 1-1.414 0l-3.998-4a1 1 0 1 1 1.414-1.414L12 15.586l6.294-6.293z" fill="currentColor" fill-rule="nonzero"/></svg>',Y.STRING],oninit:[null,Y.FUNCTION],onwarning:[null,Y.FUNCTION],onerror:[null,Y.FUNCTION],onactivatefile:[null,Y.FUNCTION],oninitfile:[null,Y.FUNCTION],onaddfilestart:[null,Y.FUNCTION],onaddfileprogress:[null,Y.FUNCTION],onaddfile:[null,Y.FUNCTION],onprocessfilestart:[null,Y.FUNCTION],onprocessfileprogress:[null,Y.FUNCTION],onprocessfileabort:[null,Y.FUNCTION],onprocessfilerevert:[null,Y.FUNCTION],onprocessfile:[null,Y.FUNCTION],onprocessfiles:[null,Y.FUNCTION],onremovefile:[null,Y.FUNCTION],onpreparefile:[null,Y.FUNCTION],onupdatefiles:[null,Y.FUNCTION],onreorderfiles:[null,Y.FUNCTION],beforeDropFile:[null,Y.FUNCTION],beforeAddFile:[null,Y.FUNCTION],beforeRemoveFile:[null,Y.FUNCTION],beforePrepareFile:[null,Y.FUNCTION],stylePanelLayout:[null,Y.STRING],stylePanelAspectRatio:[null,Y.STRING],styleItemPanelAspectRatio:[null,Y.STRING],styleButtonRemoveItemPosition:["left",Y.STRING],styleButtonProcessItemPosition:["right",Y.STRING],styleLoadIndicatorPosition:["right",Y.STRING],styleProgressIndicatorPosition:["right",Y.STRING],styleButtonRemoveItemAlign:[!1,Y.BOOLEAN],files:[[],Y.ARRAY],credits:[["https://filepond.com","Powered by FilePond"],Y.ARRAY]},Ln=(t,e)=>Gi(e)?t[0]||null:pa(e)?t[e]||null:(typeof e=="object"&&(e=e.id),t.find(s=>s.id===e)||null),Wp=t=>{if(Gi(t))return t;if(/:/.test(t)){const e=t.split(":");return e[1]/e[0]}return parseFloat(t)},Qs=t=>t.filter(e=>!e.archived),Hp={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4};let zo=null;const HI=()=>{if(zo===null)try{const t=new DataTransfer;t.items.add(new File(["hello world"],"This_Works.txt"));const e=document.createElement("input");e.setAttribute("type","file"),e.files=t.files,zo=e.files.length===1}catch(t){zo=!1}return zo},qI=[bt.LOAD_ERROR,bt.PROCESSING_ERROR,bt.PROCESSING_REVERT_ERROR],YI=[bt.LOADING,bt.PROCESSING,bt.PROCESSING_QUEUED,bt.INIT],XI=[bt.PROCESSING_COMPLETE],ZI=t=>qI.includes(t.status),QI=t=>YI.includes(t.status),JI=t=>XI.includes(t.status),lu=t=>we(t.options.server)&&(we(t.options.server.process)||yn(t.options.server.process)),KI=t=>({GET_STATUS:()=>{const e=Qs(t.items),{EMPTY:s,ERROR:i,BUSY:n,IDLE:a,READY:l}=Hp;return e.length===0?s:e.some(ZI)?i:e.some(QI)?n:e.some(JI)?l:a},GET_ITEM:e=>Ln(t.items,e),GET_ACTIVE_ITEM:e=>Ln(Qs(t.items),e),GET_ACTIVE_ITEMS:()=>Qs(t.items),GET_ITEMS:()=>t.items,GET_ITEM_NAME:e=>{const s=Ln(t.items,e);return s?s.filename:null},GET_ITEM_SIZE:e=>{const s=Ln(t.items,e);return s?s.fileSize:null},GET_STYLES:()=>Object.keys(t.options).filter(e=>/^style/.test(e)).map(e=>({name:e,value:t.options[e]})),GET_PANEL_ASPECT_RATIO:()=>/circle/.test(t.options.stylePanelLayout)?1:Wp(t.options.stylePanelAspectRatio),GET_ITEM_PANEL_ASPECT_RATIO:()=>t.options.styleItemPanelAspectRatio,GET_ITEMS_BY_STATUS:e=>Qs(t.items).filter(s=>s.status===e),GET_TOTAL_ITEMS:()=>Qs(t.items).length,SHOULD_UPDATE_FILE_INPUT:()=>t.options.storeAsFile&&HI()&&!lu(t),IS_ASYNC:()=>lu(t),GET_FILE_SIZE_LABELS:e=>({labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0})}),tv=t=>{const e=Qs(t.items).length;if(!t.options.allowMultiple)return e===0;const s=t.options.maxFiles;return s===null||e<s},qp=(t,e,s)=>Math.max(Math.min(s,t),e),ev=(t,e,s)=>t.splice(e,0,s),sv=(t,e,s)=>Gi(e)?null:typeof s=="undefined"?(t.push(e),e):(s=qp(s,0,t.length),ev(t,s,e),e),Dc=t=>/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(t),Fo=t=>`${t}`.split("/").pop().split("?").shift(),pc=t=>t.split(".").pop(),iv=t=>{if(typeof t!="string")return"";const e=t.split("/").pop();return/svg/.test(e)?"svg":/zip|compressed/.test(e)?"zip":/plain/.test(e)?"txt":/msword/.test(e)?"doc":/[a-z]+/.test(e)?e==="jpeg"?"jpg":e:""},Ia=(t,e="")=>(e+t).slice(-e.length),Yp=(t=new Date)=>`${t.getFullYear()}-${Ia(t.getMonth()+1,"00")}-${Ia(t.getDate(),"00")}_${Ia(t.getHours(),"00")}-${Ia(t.getMinutes(),"00")}-${Ia(t.getSeconds(),"00")}`,la=(t,e,s=null,i=null)=>{const n=typeof s=="string"?t.slice(0,t.size,s):t.slice(0,t.size,t.type);return n.lastModifiedDate=new Date,t._relativePath&&(n._relativePath=t._relativePath),qe(e)||(e=Yp()),e&&i===null&&pc(e)?n.name=e:(i=i||iv(n.type),n.name=e+(i?"."+i:"")),n},nv=()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,Xp=(t,e)=>{const s=nv();if(s){const i=new s;return i.append(t),i.getBlob(e)}return new Blob([t],{type:e})},rv=(t,e)=>{const s=new ArrayBuffer(t.length),i=new Uint8Array(s);for(let n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return Xp(s,e)},Zp=t=>(/^data:(.+);/.exec(t)||[])[1]||null,av=t=>t.split(",")[1].replace(/\s/g,""),ov=t=>atob(av(t)),lv=t=>{const e=Zp(t),s=ov(t);return rv(s,e)},cv=(t,e,s)=>la(lv(t),e,null,s),dv=t=>{if(!/^content-disposition:/i.test(t))return null;const e=t.split(/filename=|filename\*=.+''/).splice(1).map(s=>s.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(s=>s.length);return e.length?decodeURI(e[e.length-1]):null},hv=t=>{if(/content-length:/i.test(t)){const e=t.match(/[0-9]+/)[0];return e?parseInt(e,10):null}return null},uv=t=>/x-content-transfer-id:/i.test(t)&&(t.split(":")[1]||"").trim()||null,mh=t=>{const e={source:null,name:null,size:null},s=t.split(`
39 `);for(let i of s){const n=dv(i);if(n){e.name=n;continue}const a=hv(i);if(a){e.size=a;continue}const l=uv(i);if(l){e.source=l;continue}}return e},pv=t=>{const e={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},s=()=>e.progress,i=()=>{e.request&&e.request.abort&&e.request.abort()},n=()=>{const c=e.source;l.fire("init",c),c instanceof File?l.fire("load",c):c instanceof Blob?l.fire("load",la(c,c.name)):Dc(c)?l.fire("load",cv(c)):a(c)},a=c=>{if(!t){l.fire("error",{type:"error",body:"Can't load URL",code:400});return}e.timestamp=Date.now(),e.request=t(c,d=>{e.duration=Date.now()-e.timestamp,e.complete=!0,d instanceof Blob&&(d=la(d,d.name||Fo(c))),l.fire("load",d instanceof Blob?d:d?d.body:null)},d=>{l.fire("error",typeof d=="string"?{type:"error",code:0,body:d}:d)},(d,h,p)=>{if(p&&(e.size=p),e.duration=Date.now()-e.timestamp,!d){e.progress=null;return}e.progress=h/p,l.fire("progress",e.progress)},()=>{l.fire("abort")},d=>{const h=mh(typeof d=="string"?d:d.headers);l.fire("meta",{size:e.size||h.size,filename:h.name,source:h.source})})},l=A(b({},uc()),{setSource:c=>e.source=c,getProgress:s,abort:i,load:n});return l},cu=t=>/GET|HEAD/.test(t),Zn=(t,e,s)=>{const i={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{n=!0,l.abort()}};let n=!1,a=!1;s=b({method:"POST",headers:{},withCredentials:!1},s),e=encodeURI(e),cu(s.method)&&t&&(e=`${e}${encodeURIComponent(typeof t=="string"?t:JSON.stringify(t))}`);const l=new XMLHttpRequest,c=cu(s.method)?l:l.upload;return c.onprogress=d=>{n||i.onprogress(d.lengthComputable,d.loaded,d.total)},l.onreadystatechange=()=>{l.readyState<2||l.readyState===4&&l.status===0||a||(a=!0,i.onheaders(l))},l.onload=()=>{l.status>=200&&l.status<300?i.onload(l):i.onerror(l)},l.onerror=()=>i.onerror(l),l.onabort=()=>{n=!0,i.onabort()},l.ontimeout=()=>i.ontimeout(l),l.open(s.method,e,!0),pa(s.timeout)&&(l.timeout=s.timeout),Object.keys(s.headers).forEach(d=>{const h=unescape(encodeURIComponent(s.headers[d]));l.setRequestHeader(d,h)}),s.responseType&&(l.responseType=s.responseType),s.withCredentials&&(l.withCredentials=!0),l.send(t),i},Kt=(t,e,s,i)=>({type:t,code:e,body:s,headers:i}),Qn=t=>e=>{t(Kt("error",0,"Timeout",e.getAllResponseHeaders()))},du=t=>/\?/.test(t),Va=(...t)=>{let e="";return t.forEach(s=>{e+=du(e)&&du(s)?s.replace(/\?/,"&"):s}),e},wc=(t="",e)=>{if(typeof e=="function")return e;if(!e||!qe(e.url))return null;const s=e.onload||(n=>n),i=e.onerror||(n=>null);return(n,a,l,c,d,h)=>{const p=Zn(n,Va(t,e.url),A(b({},e),{responseType:"blob"}));return p.onload=f=>{const m=f.getAllResponseHeaders(),E=mh(m).name||Fo(n);a(Kt("load",f.status,e.method==="HEAD"?null:la(s(f.response),E),m))},p.onerror=f=>{l(Kt("error",f.status,i(f.response)||f.statusText,f.getAllResponseHeaders()))},p.onheaders=f=>{h(Kt("headers",f.status,null,f.getAllResponseHeaders()))},p.ontimeout=Qn(l),p.onprogress=c,p.onabort=d,p}},us={QUEUED:0,COMPLETE:1,PROCESSING:2,ERROR:3,WAITING:4},fv=(t,e,s,i,n,a,l,c,d,h,p)=>{const f=[],{chunkTransferId:m,chunkServer:E,chunkSize:g,chunkRetryDelays:I}=p,w={serverId:m,aborted:!1},S=e.ondata||(j=>j),_=e.onload||((j,K)=>K==="HEAD"?j.getResponseHeader("Upload-Offset"):j.response),R=e.onerror||(j=>null),L=j=>{const K=new FormData;we(n)&&K.append(s,JSON.stringify(n));const B=typeof e.headers=="function"?e.headers(i,n):A(b({},e.headers),{"Upload-Length":i.size}),H=A(b({},e),{headers:B}),tt=Zn(S(K),Va(t,e.url),H);tt.onload=U=>j(_(U,H.method)),tt.onerror=U=>l(Kt("error",U.status,R(U.response)||U.statusText,U.getAllResponseHeaders())),tt.ontimeout=Qn(l)},M=j=>{const K=Va(t,E.url,w.serverId),H={headers:typeof e.headers=="function"?e.headers(w.serverId):b({},e.headers),method:"HEAD"},tt=Zn(null,K,H);tt.onload=U=>j(_(U,H.method)),tt.onerror=U=>l(Kt("error",U.status,R(U.response)||U.statusText,U.getAllResponseHeaders())),tt.ontimeout=Qn(l)},D=Math.floor(i.size/g);for(let j=0;j<=D;j++){const K=j*g,B=i.slice(K,K+g,"application/offset+octet-stream");f[j]={index:j,size:B.size,offset:K,data:B,file:i,progress:0,retries:[...I],status:us.QUEUED,error:null,request:null,timeout:null}}const G=()=>a(w.serverId),C=j=>j.status===us.QUEUED||j.status===us.ERROR,k=j=>{if(w.aborted)return;if(j=j||f.find(C),!j){f.every(J=>J.status===us.COMPLETE)&&G();return}j.status=us.PROCESSING,j.progress=null;const K=E.ondata||(J=>J),B=E.onerror||(J=>null),H=E.onload||(()=>{}),tt=Va(t,E.url,w.serverId),U=typeof E.headers=="function"?E.headers(j):A(b({},E.headers),{"Content-Type":"application/offset+octet-stream","Upload-Offset":j.offset,"Upload-Length":i.size,"Upload-Name":i.name}),Z=j.request=Zn(K(j.data),tt,A(b({},E),{headers:U}));Z.onload=J=>{H(J,j.index,f.length),j.status=us.COMPLETE,j.request=null,V()},Z.onprogress=(J,it,at)=>{j.progress=J?it:null,W()},Z.onerror=J=>{j.status=us.ERROR,j.request=null,j.error=B(J.response)||J.statusText,q(j)||l(Kt("error",J.status,B(J.response)||J.statusText,J.getAllResponseHeaders()))},Z.ontimeout=J=>{j.status=us.ERROR,j.request=null,q(j)||Qn(l)(J)},Z.onabort=()=>{j.status=us.QUEUED,j.request=null,d()}},q=j=>j.retries.length===0?!1:(j.status=us.WAITING,clearTimeout(j.timeout),j.timeout=setTimeout(()=>{k(j)},j.retries.shift()),!0),W=()=>{const j=f.reduce((B,H)=>B===null||H.progress===null?null:B+H.progress,0);if(j===null)return c(!1,0,0);const K=f.reduce((B,H)=>B+H.size,0);c(!0,j,K)},V=()=>{f.filter(K=>K.status===us.PROCESSING).length>=1||k()},X=()=>{f.forEach(j=>{clearTimeout(j.timeout),j.request&&j.request.abort()})};return w.serverId?M(j=>{w.aborted||(f.filter(K=>K.offset<j).forEach(K=>{K.status=us.COMPLETE,K.progress=K.size}),V())}):L(j=>{w.aborted||(h(j),w.serverId=j,V())}),{abort:()=>{w.aborted=!0,X()}}},mv=(t,e,s,i)=>(n,a,l,c,d,h,p)=>{if(!n)return;const f=i.chunkUploads,m=f&&n.size>i.chunkSize,E=f&&(m||i.chunkForce);if(n instanceof Blob&&E)return fv(t,e,s,n,a,l,c,d,h,p,i);const g=e.ondata||(M=>M),I=e.onload||(M=>M),w=e.onerror||(M=>null),S=typeof e.headers=="function"?e.headers(n,a)||{}:b({},e.headers),_=A(b({},e),{headers:S});var R=new FormData;we(a)&&R.append(s,JSON.stringify(a)),(n instanceof Blob?[{name:null,file:n}]:n).forEach(M=>{R.append(s,M.file,M.name===null?M.file.name:`${M.name}${M.file.name}`)});const L=Zn(g(R),Va(t,e.url),_);return L.onload=M=>{l(Kt("load",M.status,I(M.response),M.getAllResponseHeaders()))},L.onerror=M=>{c(Kt("error",M.status,w(M.response)||M.statusText,M.getAllResponseHeaders()))},L.ontimeout=Qn(c),L.onprogress=d,L.onabort=h,L},gv=(t="",e,s,i)=>typeof e=="function"?(...n)=>e(s,...n,i):!e||!qe(e.url)?null:mv(t,e,s,i),va=(t="",e)=>{if(typeof e=="function")return e;if(!e||!qe(e.url))return(n,a)=>a();const s=e.onload||(n=>n),i=e.onerror||(n=>null);return(n,a,l)=>{const c=Zn(n,t+e.url,e);return c.onload=d=>{a(Kt("load",d.status,s(d.response),d.getAllResponseHeaders()))},c.onerror=d=>{l(Kt("error",d.status,i(d.response)||d.statusText,d.getAllResponseHeaders()))},c.ontimeout=Qn(l),c}},Qp=(t=0,e=1)=>t+Math.random()*(e-t),Ev=(t,e=1e3,s=0,i=25,n=250)=>{let a=null;const l=Date.now(),c=()=>{let d=Date.now()-l,h=Qp(i,n);d+h>e&&(h=d+h-e);let p=d/e;if(p>=1||document.hidden){t(1);return}t(p),a=setTimeout(c,h)};return e>0&&c(),{clear:()=>{clearTimeout(a)}}},bv=(t,e)=>{const s={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},{allowMinimumUploadDuration:i}=e,n=(p,f)=>{const m=()=>{s.duration===0||s.progress===null||h.fire("progress",h.getProgress())},E=()=>{s.complete=!0,h.fire("load-perceived",s.response.body)};h.fire("start"),s.timestamp=Date.now(),s.perceivedPerformanceUpdater=Ev(g=>{s.perceivedProgress=g,s.perceivedDuration=Date.now()-s.timestamp,m(),s.response&&s.perceivedProgress===1&&!s.complete&&E()},i?Qp(750,1500):0),s.request=t(p,f,g=>{s.response=we(g)?g:{type:"load",code:200,body:`${g}`,headers:{}},s.duration=Date.now()-s.timestamp,s.progress=1,h.fire("load",s.response.body),(!i||i&&s.perceivedProgress===1)&&E()},g=>{s.perceivedPerformanceUpdater.clear(),h.fire("error",we(g)?g:{type:"error",code:0,body:`${g}`})},(g,I,w)=>{s.duration=Date.now()-s.timestamp,s.progress=g?I/w:null,m()},()=>{s.perceivedPerformanceUpdater.clear(),h.fire("abort",s.response?s.response.body:null)},g=>{h.fire("transfer",g)})},a=()=>{s.request&&(s.perceivedPerformanceUpdater.clear(),s.request.abort&&s.request.abort(),s.complete=!0)},l=()=>{a(),s.complete=!1,s.perceivedProgress=0,s.progress=0,s.timestamp=null,s.perceivedDuration=0,s.duration=0,s.request=null,s.response=null},c=i?()=>s.progress?Math.min(s.progress,s.perceivedProgress):null:()=>s.progress||null,d=i?()=>Math.min(s.duration,s.perceivedDuration):()=>s.duration,h=A(b({},uc()),{process:n,abort:a,getProgress:c,getDuration:d,reset:l});return h},Jp=t=>t.substring(0,t.lastIndexOf("."))||t,Iv=t=>{let e=[t.name,t.size,t.type];return t instanceof Blob||Dc(t)?e[0]=t.name||Yp():Dc(t)?(e[1]=t.length,e[2]=Zp(t)):qe(t)&&(e[0]=Fo(t),e[1]=0,e[2]="application/octet-stream"),{name:e[0],size:e[1],type:e[2]}},Jn=t=>!!(t instanceof File||t instanceof Blob&&t.name),Kp=t=>{if(!we(t))return t;const e=cc(t)?[]:{};for(const s in t){if(!t.hasOwnProperty(s))continue;const i=t[s];e[s]=i&&we(i)?Kp(i):i}return e},vv=(t=null,e=null,s=null)=>{const i=uh(),n={archived:!1,frozen:!1,released:!1,source:null,file:s,serverFileReference:e,transferId:null,processingAborted:!1,status:e?bt.PROCESSING_COMPLETE:bt.INIT,activeLoader:null,activeProcessor:null};let a=null;const l={},c=C=>n.status=C,d=(C,...k)=>{n.released||n.frozen||D.fire(C,...k)},h=()=>pc(n.file.name),p=()=>n.file.type,f=()=>n.file.size,m=()=>n.file,E=(C,k,q)=>{if(n.source=C,D.fireSync("init"),n.file){D.fireSync("load-skip");return}n.file=Iv(C),k.on("init",()=>{d("load-init")}),k.on("meta",W=>{n.file.size=W.size,n.file.filename=W.filename,W.source&&(t=ge.LIMBO,n.serverFileReference=W.source,n.status=bt.PROCESSING_COMPLETE),d("load-meta")}),k.on("progress",W=>{c(bt.LOADING),d("load-progress",W)}),k.on("error",W=>{c(bt.LOAD_ERROR),d("load-request-error",W)}),k.on("abort",()=>{c(bt.INIT),d("load-abort")}),k.on("load",W=>{n.activeLoader=null;const V=j=>{n.file=Jn(j)?j:n.file,t===ge.LIMBO&&n.serverFileReference?c(bt.PROCESSING_COMPLETE):c(bt.IDLE),d("load")},X=j=>{n.file=W,d("load-meta"),c(bt.LOAD_ERROR),d("load-file-error",j)};if(n.serverFileReference){V(W);return}q(W,V,X)}),k.setSource(C),n.activeLoader=k,k.load()},g=()=>{n.activeLoader&&n.activeLoader.load()},I=()=>{if(n.activeLoader){n.activeLoader.abort();return}c(bt.INIT),d("load-abort")},w=(C,k)=>{if(n.processingAborted){n.processingAborted=!1;return}if(c(bt.PROCESSING),a=null,!(n.file instanceof Blob)){D.on("load",()=>{w(C,k)});return}C.on("load",V=>{n.transferId=null,n.serverFileReference=V}),C.on("transfer",V=>{n.transferId=V}),C.on("load-perceived",V=>{n.activeProcessor=null,n.transferId=null,n.serverFileReference=V,c(bt.PROCESSING_COMPLETE),d("process-complete",V)}),C.on("start",()=>{d("process-start")}),C.on("error",V=>{n.activeProcessor=null,c(bt.PROCESSING_ERROR),d("process-error",V)}),C.on("abort",V=>{n.activeProcessor=null,n.serverFileReference=V,c(bt.IDLE),d("process-abort"),a&&a()}),C.on("progress",V=>{d("process-progress",V)});const q=V=>{n.archived||C.process(V,b({},l))},W=console.error;k(n.file,q,W),n.activeProcessor=C},S=()=>{n.processingAborted=!1,c(bt.PROCESSING_QUEUED)},_=()=>new Promise(C=>{if(!n.activeProcessor){n.processingAborted=!0,c(bt.IDLE),d("process-abort"),C();return}a=()=>{C()},n.activeProcessor.abort()}),R=(C,k)=>new Promise((q,W)=>{const V=n.serverFileReference!==null?n.serverFileReference:n.transferId;if(V===null){q();return}C(V,()=>{n.serverFileReference=null,n.transferId=null,q()},X=>{if(!k){q();return}c(bt.PROCESSING_REVERT_ERROR),d("process-revert-error"),W(X)}),c(bt.IDLE),d("process-revert")}),L=(C,k,q)=>{const W=C.split("."),V=W[0],X=W.pop();let j=l;W.forEach(K=>j=j[K]),JSON.stringify(j[X])!==JSON.stringify(k)&&(j[X]=k,d("metadata-update",{key:V,value:l[V],silent:q}))},D=A(b({id:{get:()=>i},origin:{get:()=>t,set:C=>t=C},serverId:{get:()=>n.serverFileReference},transferId:{get:()=>n.transferId},status:{get:()=>n.status},filename:{get:()=>n.file.name},filenameWithoutExtension:{get:()=>Jp(n.file.name)},fileExtension:{get:h},fileType:{get:p},fileSize:{get:f},file:{get:m},relativePath:{get:()=>n.file._relativePath},source:{get:()=>n.source},getMetadata:C=>Kp(C?l[C]:l),setMetadata:(C,k,q)=>{if(we(C)){const W=C;return Object.keys(W).forEach(V=>{L(V,W[V],k)}),C}return L(C,k,q),k},extend:(C,k)=>G[C]=k,abortLoad:I,retryLoad:g,requestProcessing:S,abortProcessing:_,load:E,process:w,revert:R},uc()),{freeze:()=>n.frozen=!0,release:()=>n.released=!0,released:{get:()=>n.released},archive:()=>n.archived=!0,archived:{get:()=>n.archived},setFile:C=>n.file=C}),G=hn(D);return G},wv=(t,e)=>Gi(e)?0:qe(e)?t.findIndex(s=>s.id===e):-1,hu=(t,e)=>{const s=wv(t,e);if(!(s<0))return t[s]||null},uu=(t,e,s,i,n,a)=>{const l=Zn(null,t,{method:"GET",responseType:"blob"});return l.onload=c=>{const d=c.getAllResponseHeaders(),h=mh(d).name||Fo(t);e(Kt("load",c.status,la(c.response,h),d))},l.onerror=c=>{s(Kt("error",c.status,c.statusText,c.getAllResponseHeaders()))},l.onheaders=c=>{a(Kt("headers",c.status,null,c.getAllResponseHeaders()))},l.ontimeout=Qn(s),l.onprogress=i,l.onabort=n,l},pu=t=>(t.indexOf("//")===0&&(t=location.protocol+t),t.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]),_v=t=>(t.indexOf(":")>-1||t.indexOf("//")>-1)&&pu(location.href)!==pu(t),Wo=t=>(...e)=>yn(t)?t(...e):t,Tv=t=>!Jn(t.file),_c=(t,e)=>{clearTimeout(e.listUpdateTimeout),e.listUpdateTimeout=setTimeout(()=>{t("DID_UPDATE_ITEMS",{items:Qs(e.items)})},0)},fu=(t,...e)=>new Promise(s=>{if(!t)return s(!0);const i=t(...e);if(i==null)return s(!0);if(typeof i=="boolean")return s(i);typeof i.then=="function"&&i.then(s)}),Tc=(t,e)=>{t.items.sort((s,i)=>e(es(s),es(i)))},ps=(t,e)=>(l={})=>{var c=l,{query:s,success:i=()=>{},failure:n=()=>{}}=c,a=kh(c,["query","success","failure"]);const d=Ln(t.items,s);if(!d){n({error:Kt("error",0,"Item not found"),file:null});return}e(d,i,n,a||{})},xv=(t,e,s)=>({ABORT_ALL:()=>{Qs(s.items).forEach(i=>{i.freeze(),i.abortLoad(),i.abortProcessing()})},DID_SET_FILES:({value:i=[]})=>{const n=i.map(l=>({source:l.source?l.source:l,options:l.options}));let a=Qs(s.items);a.forEach(l=>{n.find(c=>c.source===l.source||c.source===l.file)||t("REMOVE_ITEM",{query:l,remove:!1})}),a=Qs(s.items),n.forEach((l,c)=>{a.find(d=>d.source===l.source||d.file===l.source)||t("ADD_ITEM",A(b({},l),{interactionMethod:$s.NONE,index:c}))})},DID_UPDATE_ITEM_METADATA:({id:i,action:n,change:a})=>{a.silent||(clearTimeout(s.itemUpdateTimeout),s.itemUpdateTimeout=setTimeout(()=>{const l=hu(s.items,i);if(!e("IS_ASYNC")){Zs("SHOULD_PREPARE_OUTPUT",!1,{item:l,query:e,action:n,change:a}).then(p=>{const f=e("GET_BEFORE_PREPARE_FILE");f&&(p=f(l,p)),p&&t("REQUEST_PREPARE_OUTPUT",{query:i,item:l,success:m=>{t("DID_PREPARE_OUTPUT",{id:i,file:m})}},!0)});return}l.origin===ge.LOCAL&&t("DID_LOAD_ITEM",{id:l.id,error:null,serverFileReference:l.source});const c=()=>{setTimeout(()=>{t("REQUEST_ITEM_PROCESSING",{query:i})},32)},d=p=>{l.revert(va(s.options.server.url,s.options.server.revert),e("GET_FORCE_REVERT")).then(p?c:()=>{}).catch(()=>{})},h=p=>{l.abortProcessing().then(p?c:()=>{})};if(l.status===bt.PROCESSING_COMPLETE)return d(s.options.instantUpload);if(l.status===bt.PROCESSING)return h(s.options.instantUpload);s.options.instantUpload&&c()},0))},MOVE_ITEM:({query:i,index:n})=>{const a=Ln(s.items,i);if(!a)return;const l=s.items.indexOf(a);n=qp(n,0,s.items.length-1),l!==n&&s.items.splice(n,0,s.items.splice(l,1)[0])},SORT:({compare:i})=>{Tc(s,i),t("DID_SORT_ITEMS",{items:e("GET_ACTIVE_ITEMS")})},ADD_ITEMS:({items:i,index:n,interactionMethod:a,success:l=()=>{},failure:c=()=>{}})=>{let d=n;if(n===-1||typeof n=="undefined"){const E=e("GET_ITEM_INSERT_LOCATION"),g=e("GET_TOTAL_ITEMS");d=E==="before"?0:g}const h=e("GET_IGNORED_FILES"),p=E=>Jn(E)?!h.includes(E.name.toLowerCase()):!Gi(E),m=i.filter(p).map(E=>new Promise((g,I)=>{t("ADD_ITEM",{interactionMethod:a,source:E.source||E,success:g,failure:I,index:d++,options:E.options||{}})}));Promise.all(m).then(l).catch(c)},ADD_ITEM:({source:i,index:n=-1,interactionMethod:a,success:l=()=>{},failure:c=()=>{},options:d={}})=>{if(Gi(i)){c({error:Kt("error",0,"No source"),file:null});return}if(Jn(i)&&s.options.ignoredFiles.includes(i.name.toLowerCase()))return;if(!tv(s)){if(s.options.allowMultiple||!s.options.allowMultiple&&!s.options.allowReplace){const _=Kt("warning",0,"Max files");t("DID_THROW_MAX_FILES",{source:i,error:_}),c({error:_,file:null});return}const S=Qs(s.items)[0];if(S.status===bt.PROCESSING_COMPLETE||S.status===bt.PROCESSING_REVERT_ERROR){const _=e("GET_FORCE_REVERT");if(S.revert(va(s.options.server.url,s.options.server.revert),_).then(()=>{_&&t("ADD_ITEM",{source:i,index:n,interactionMethod:a,success:l,failure:c,options:d})}).catch(()=>{}),_)return}t("REMOVE_ITEM",{query:S.id})}const h=d.type==="local"?ge.LOCAL:d.type==="limbo"?ge.LIMBO:ge.INPUT,p=vv(h,h===ge.INPUT?null:i,d.file);Object.keys(d.metadata||{}).forEach(S=>{p.setMetadata(S,d.metadata[S])}),er("DID_CREATE_ITEM",p,{query:e,dispatch:t});const f=e("GET_ITEM_INSERT_LOCATION");s.options.itemInsertLocationFreedom||(n=f==="before"?-1:s.items.length),sv(s.items,p,n),yn(f)&&i&&Tc(s,f);const m=p.id;p.on("init",()=>{t("DID_INIT_ITEM",{id:m})}),p.on("load-init",()=>{t("DID_START_ITEM_LOAD",{id:m})}),p.on("load-meta",()=>{t("DID_UPDATE_ITEM_META",{id:m})}),p.on("load-progress",S=>{t("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:m,progress:S})}),p.on("load-request-error",S=>{const _=Wo(s.options.labelFileLoadError)(S);if(S.code>=400&&S.code<500){t("DID_THROW_ITEM_INVALID",{id:m,error:S,status:{main:_,sub:`${S.code} (${S.body})`}}),c({error:S,file:es(p)});return}t("DID_THROW_ITEM_LOAD_ERROR",{id:m,error:S,status:{main:_,sub:s.options.labelTapToRetry}})}),p.on("load-file-error",S=>{t("DID_THROW_ITEM_INVALID",{id:m,error:S.status,status:S.status}),c({error:S.status,file:es(p)})}),p.on("load-abort",()=>{t("REMOVE_ITEM",{query:m})}),p.on("load-skip",()=>{p.on("metadata-update",S=>{Jn(p.file)&&t("DID_UPDATE_ITEM_METADATA",{id:m,change:S})}),t("COMPLETE_LOAD_ITEM",{query:m,item:p,data:{source:i,success:l}})}),p.on("load",()=>{const S=_=>{if(!_){t("REMOVE_ITEM",{query:m});return}p.on("metadata-update",R=>{t("DID_UPDATE_ITEM_METADATA",{id:m,change:R})}),Zs("SHOULD_PREPARE_OUTPUT",!1,{item:p,query:e}).then(R=>{const L=e("GET_BEFORE_PREPARE_FILE");L&&(R=L(p,R));const M=()=>{t("COMPLETE_LOAD_ITEM",{query:m,item:p,data:{source:i,success:l}}),_c(t,s)};if(R){t("REQUEST_PREPARE_OUTPUT",{query:m,item:p,success:D=>{t("DID_PREPARE_OUTPUT",{id:m,file:D}),M()}},!0);return}M()})};Zs("DID_LOAD_ITEM",p,{query:e,dispatch:t}).then(()=>{fu(e("GET_BEFORE_ADD_FILE"),es(p)).then(S)}).catch(_=>{if(!_||!_.error||!_.status)return S(!1);t("DID_THROW_ITEM_INVALID",{id:m,error:_.error,status:_.status})})}),p.on("process-start",()=>{t("DID_START_ITEM_PROCESSING",{id:m})}),p.on("process-progress",S=>{t("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:m,progress:S})}),p.on("process-error",S=>{t("DID_THROW_ITEM_PROCESSING_ERROR",{id:m,error:S,status:{main:Wo(s.options.labelFileProcessingError)(S),sub:s.options.labelTapToRetry}})}),p.on("process-revert-error",S=>{t("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:m,error:S,status:{main:Wo(s.options.labelFileProcessingRevertError)(S),sub:s.options.labelTapToRetry}})}),p.on("process-complete",S=>{t("DID_COMPLETE_ITEM_PROCESSING",{id:m,error:null,serverFileReference:S}),t("DID_DEFINE_VALUE",{id:m,value:S})}),p.on("process-abort",()=>{t("DID_ABORT_ITEM_PROCESSING",{id:m})}),p.on("process-revert",()=>{t("DID_REVERT_ITEM_PROCESSING",{id:m}),t("DID_DEFINE_VALUE",{id:m,value:null})}),t("DID_ADD_ITEM",{id:m,index:n,interactionMethod:a}),_c(t,s);const{url:E,load:g,restore:I,fetch:w}=s.options.server||{};p.load(i,pv(h===ge.INPUT?qe(i)&&_v(i)&&w?wc(E,w):uu:h===ge.LIMBO?wc(E,I):wc(E,g)),(S,_,R)=>{Zs("LOAD_FILE",S,{query:e}).then(_).catch(R)})},REQUEST_PREPARE_OUTPUT:({item:i,success:n,failure:a=()=>{}})=>{const l={error:Kt("error",0,"Item not found"),file:null};if(i.archived)return a(l);Zs("PREPARE_OUTPUT",i.file,{query:e,item:i}).then(c=>{Zs("COMPLETE_PREPARE_OUTPUT",c,{query:e,item:i}).then(d=>{if(i.archived)return a(l);n(d)})})},COMPLETE_LOAD_ITEM:({item:i,data:n})=>{const{success:a,source:l}=n,c=e("GET_ITEM_INSERT_LOCATION");if(yn(c)&&l&&Tc(s,c),t("DID_LOAD_ITEM",{id:i.id,error:null,serverFileReference:i.origin===ge.INPUT?null:l}),a(es(i)),i.origin===ge.LOCAL){t("DID_LOAD_LOCAL_ITEM",{id:i.id});return}if(i.origin===ge.LIMBO){t("DID_COMPLETE_ITEM_PROCESSING",{id:i.id,error:null,serverFileReference:l}),t("DID_DEFINE_VALUE",{id:i.id,value:i.serverId||l});return}e("IS_ASYNC")&&s.options.instantUpload&&t("REQUEST_ITEM_PROCESSING",{query:i.id})},RETRY_ITEM_LOAD:ps(s,i=>{i.retryLoad()}),REQUEST_ITEM_PREPARE:ps(s,(i,n,a)=>{t("REQUEST_PREPARE_OUTPUT",{query:i.id,item:i,success:l=>{t("DID_PREPARE_OUTPUT",{id:i.id,file:l}),n({file:i,output:l})},failure:a},!0)}),REQUEST_ITEM_PROCESSING:ps(s,(i,n,a)=>{if(!(i.status===bt.IDLE||i.status===bt.PROCESSING_ERROR)){const c=()=>t("REQUEST_ITEM_PROCESSING",{query:i,success:n,failure:a}),d=()=>document.hidden?c():setTimeout(c,32);i.status===bt.PROCESSING_COMPLETE||i.status===bt.PROCESSING_REVERT_ERROR?i.revert(va(s.options.server.url,s.options.server.revert),e("GET_FORCE_REVERT")).then(d).catch(()=>{}):i.status===bt.PROCESSING&&i.abortProcessing().then(d);return}i.status!==bt.PROCESSING_QUEUED&&(i.requestProcessing(),t("DID_REQUEST_ITEM_PROCESSING",{id:i.id}),t("PROCESS_ITEM",{query:i,success:n,failure:a},!0))}),PROCESS_ITEM:ps(s,(i,n,a)=>{const l=e("GET_MAX_PARALLEL_UPLOADS");if(e("GET_ITEMS_BY_STATUS",bt.PROCESSING).length===l){s.processingQueue.push({id:i.id,success:n,failure:a});return}if(i.status===bt.PROCESSING)return;const d=()=>{const p=s.processingQueue.shift();if(!p)return;const{id:f,success:m,failure:E}=p,g=Ln(s.items,f);if(!g||g.archived){d();return}t("PROCESS_ITEM",{query:f,success:m,failure:E},!0)};i.onOnce("process-complete",()=>{n(es(i)),d();const p=s.options.server;if(s.options.instantUpload&&i.origin===ge.LOCAL&&yn(p.remove)){const E=()=>{};i.origin=ge.LIMBO,s.options.server.remove(i.source,E,E)}e("GET_ITEMS_BY_STATUS",bt.PROCESSING_COMPLETE).length===s.items.length&&t("DID_COMPLETE_ITEM_PROCESSING_ALL")}),i.onOnce("process-error",p=>{a({error:p,file:es(i)}),d()}),i.onOnce("process-abort",()=>{d()});const h=s.options;i.process(bv(gv(h.server.url,h.server.process,h.name,{chunkTransferId:i.transferId,chunkServer:h.server.patch,chunkUploads:h.chunkUploads,chunkForce:h.chunkForce,chunkSize:h.chunkSize,chunkRetryDelays:h.chunkRetryDelays}),{allowMinimumUploadDuration:e("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),(p,f,m)=>{Zs("PREPARE_OUTPUT",p,{query:e,item:i}).then(E=>{t("DID_PREPARE_OUTPUT",{id:i.id,file:E}),f(E)}).catch(m)})}),RETRY_ITEM_PROCESSING:ps(s,i=>{t("REQUEST_ITEM_PROCESSING",{query:i})}),REQUEST_REMOVE_ITEM:ps(s,i=>{fu(e("GET_BEFORE_REMOVE_FILE"),es(i)).then(n=>{n&&t("REMOVE_ITEM",{query:i})})}),RELEASE_ITEM:ps(s,i=>{i.release()}),REMOVE_ITEM:ps(s,(i,n,a,l)=>{const c=()=>{const h=i.id;hu(s.items,h).archive(),t("DID_REMOVE_ITEM",{error:null,id:h,item:i}),_c(t,s),n(es(i))},d=s.options.server;i.origin===ge.LOCAL&&d&&yn(d.remove)&&l.remove!==!1?(t("DID_START_ITEM_REMOVE",{id:i.id}),d.remove(i.source,()=>c(),h=>{t("DID_THROW_ITEM_REMOVE_ERROR",{id:i.id,error:Kt("error",0,h,null),status:{main:Wo(s.options.labelFileRemoveError)(h),sub:s.options.labelTapToRetry}})})):((l.revert&&i.origin!==ge.LOCAL&&i.serverId!==null||s.options.chunkUploads&&i.file.size>s.options.chunkSize||s.options.chunkUploads&&s.options.chunkForce)&&i.revert(va(s.options.server.url,s.options.server.revert),e("GET_FORCE_REVERT")),c())}),ABORT_ITEM_LOAD:ps(s,i=>{i.abortLoad()}),ABORT_ITEM_PROCESSING:ps(s,i=>{if(i.serverId){t("REVERT_ITEM_PROCESSING",{id:i.id});return}i.abortProcessing().then(()=>{s.options.instantUpload&&t("REMOVE_ITEM",{query:i.id})})}),REQUEST_REVERT_ITEM_PROCESSING:ps(s,i=>{if(!s.options.instantUpload){t("REVERT_ITEM_PROCESSING",{query:i});return}const n=c=>{c&&t("REVERT_ITEM_PROCESSING",{query:i})},a=e("GET_BEFORE_REMOVE_FILE");if(!a)return n(!0);const l=a(es(i));if(l==null)return n(!0);if(typeof l=="boolean")return n(l);typeof l.then=="function"&&l.then(n)}),REVERT_ITEM_PROCESSING:ps(s,i=>{i.revert(va(s.options.server.url,s.options.server.revert),e("GET_FORCE_REVERT")).then(()=>{(s.options.instantUpload||Tv(i))&&t("REMOVE_ITEM",{query:i.id})}).catch(()=>{})}),SET_OPTIONS:({options:i})=>{const n=Object.keys(i),a=Sv.filter(c=>n.includes(c));[...a,...Object.keys(i).filter(c=>!a.includes(c))].forEach(c=>{t(`SET_${hc(c,"_").toUpperCase()}`,{value:i[c]})})}}),Sv=["server"],gh=t=>t,Bi=t=>document.createElement(t),te=(t,e)=>{let s=t.childNodes[0];s?e!==s.nodeValue&&(s.nodeValue=e):(s=document.createTextNode(e),t.appendChild(s))},mu=(t,e,s,i)=>{const n=(i%360-90)*Math.PI/180;return{x:t+s*Math.cos(n),y:e+s*Math.sin(n)}},Rv=(t,e,s,i,n,a)=>{const l=mu(t,e,s,n),c=mu(t,e,s,i);return["M",l.x,l.y,"A",s,s,0,a,0,c.x,c.y].join(" ")},Cv=(t,e,s,i,n)=>{let a=1;return n>i&&n-i<=.5&&(a=0),i>n&&i-n>=.5&&(a=0),Rv(t,e,s,Math.min(.9999,i)*360,Math.min(.9999,n)*360,a)},Ov=({root:t,props:e})=>{e.spin=!1,e.progress=0,e.opacity=0;const s=Dl("svg");t.ref.path=Dl("path",{"stroke-width":2,"stroke-linecap":"round"}),s.appendChild(t.ref.path),t.ref.svg=s,t.appendChild(s)},$v=({root:t,props:e})=>{if(e.opacity===0)return;e.align&&(t.element.dataset.align=e.align);const s=parseInt(Ee(t.ref.path,"stroke-width"),10),i=t.rect.element.width*.5;let n=0,a=0;e.spin?(n=0,a=.5):(n=0,a=e.progress);const l=Cv(i,i,i-s,n,a);Ee(t.ref.path,"d",l),Ee(t.ref.path,"stroke-opacity",e.spin||e.progress>0?1:0)},gu=ae({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:Ov,write:$v,mixins:{apis:["progress","spin","align"],styles:["opacity"],animations:{opacity:{type:"tween",duration:500},progress:{type:"spring",stiffness:.95,damping:.65,mass:10}}}}),yv=({root:t,props:e})=>{t.element.innerHTML=(e.icon||"")+`<span>${e.label}</span>`,e.isDisabled=!1},Lv=({root:t,props:e})=>{const{isDisabled:s}=e,i=t.query("GET_DISABLED")||e.opacity===0;i&&!s?(e.isDisabled=!0,Ee(t.element,"disabled","disabled")):!i&&s&&(e.isDisabled=!1,t.element.removeAttribute("disabled"))},tf=ae({tag:"button",attributes:{type:"button"},ignoreRect:!0,ignoreRectUpdate:!0,name:"file-action-button",mixins:{apis:["label"],styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}},listeners:!0},create:yv,write:Lv}),ef=(t,e=".",s=1e3,i={})=>{const{labelBytes:n="bytes",labelKilobytes:a="KB",labelMegabytes:l="MB",labelGigabytes:c="GB"}=i;t=Math.round(Math.abs(t));const d=s,h=s*s,p=s*s*s;return t<d?`${t} ${n}`:t<h?`${Math.floor(t/d)} ${a}`:t<p?`${Eu(t/h,1,e)} ${l}`:`${Eu(t/p,2,e)} ${c}`},Eu=(t,e,s)=>t.toFixed(e).split(".").filter(i=>i!=="0").join(s),Av=({root:t,props:e})=>{const s=Bi("span");s.className="filepond--file-info-main",Ee(s,"aria-hidden","true"),t.appendChild(s),t.ref.fileName=s;const i=Bi("span");i.className="filepond--file-info-sub",t.appendChild(i),t.ref.fileSize=i,te(i,t.query("GET_LABEL_FILE_WAITING_FOR_SIZE")),te(s,gh(t.query("GET_ITEM_NAME",e.id)))},Fc=({root:t,props:e})=>{te(t.ref.fileSize,ef(t.query("GET_ITEM_SIZE",e.id),".",t.query("GET_FILE_SIZE_BASE"),t.query("GET_FILE_SIZE_LABELS",t.query))),te(t.ref.fileName,gh(t.query("GET_ITEM_NAME",e.id)))},bu=({root:t,props:e})=>{if(pa(t.query("GET_ITEM_SIZE",e.id))){Fc({root:t,props:e});return}te(t.ref.fileSize,t.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"))},Mv=ae({name:"file-info",ignoreRect:!0,ignoreRectUpdate:!0,write:Ye({DID_LOAD_ITEM:Fc,DID_UPDATE_ITEM_META:Fc,DID_THROW_ITEM_LOAD_ERROR:bu,DID_THROW_ITEM_INVALID:bu}),didCreateView:t=>{er("CREATE_VIEW",A(b({},t),{view:t}))},create:Av,mixins:{styles:["translateX","translateY"],animations:{translateX:"spring",translateY:"spring"}}}),sf=t=>Math.round(t*100),Nv=({root:t})=>{const e=Bi("span");e.className="filepond--file-status-main",t.appendChild(e),t.ref.main=e;const s=Bi("span");s.className="filepond--file-status-sub",t.appendChild(s),t.ref.sub=s,nf({root:t,action:{progress:null}})},nf=({root:t,action:e})=>{const s=e.progress===null?t.query("GET_LABEL_FILE_LOADING"):`${t.query("GET_LABEL_FILE_LOADING")} ${sf(e.progress)}%`;te(t.ref.main,s),te(t.ref.sub,t.query("GET_LABEL_TAP_TO_CANCEL"))},Pv=({root:t,action:e})=>{const s=e.progress===null?t.query("GET_LABEL_FILE_PROCESSING"):`${t.query("GET_LABEL_FILE_PROCESSING")} ${sf(e.progress)}%`;te(t.ref.main,s),te(t.ref.sub,t.query("GET_LABEL_TAP_TO_CANCEL"))},Dv=({root:t})=>{te(t.ref.main,t.query("GET_LABEL_FILE_PROCESSING")),te(t.ref.sub,t.query("GET_LABEL_TAP_TO_CANCEL"))},Fv=({root:t})=>{te(t.ref.main,t.query("GET_LABEL_FILE_PROCESSING_ABORTED")),te(t.ref.sub,t.query("GET_LABEL_TAP_TO_RETRY"))},jv=({root:t})=>{te(t.ref.main,t.query("GET_LABEL_FILE_PROCESSING_COMPLETE")),te(t.ref.sub,t.query("GET_LABEL_TAP_TO_UNDO"))},Iu=({root:t})=>{te(t.ref.main,""),te(t.ref.sub,"")},wa=({root:t,action:e})=>{te(t.ref.main,e.status.main),te(t.ref.sub,e.status.sub)},kv=ae({name:"file-status",ignoreRect:!0,ignoreRectUpdate:!0,write:Ye({DID_LOAD_ITEM:Iu,DID_REVERT_ITEM_PROCESSING:Iu,DID_REQUEST_ITEM_PROCESSING:Dv,DID_ABORT_ITEM_PROCESSING:Fv,DID_COMPLETE_ITEM_PROCESSING:jv,DID_UPDATE_ITEM_PROCESS_PROGRESS:Pv,DID_UPDATE_ITEM_LOAD_PROGRESS:nf,DID_THROW_ITEM_LOAD_ERROR:wa,DID_THROW_ITEM_INVALID:wa,DID_THROW_ITEM_PROCESSING_ERROR:wa,DID_THROW_ITEM_PROCESSING_REVERT_ERROR:wa,DID_THROW_ITEM_REMOVE_ERROR:wa}),didCreateView:t=>{er("CREATE_VIEW",A(b({},t),{view:t}))},create:Nv,mixins:{styles:["translateX","translateY","opacity"],animations:{opacity:{type:"tween",duration:250},translateX:"spring",translateY:"spring"}}}),jc={AbortItemLoad:{label:"GET_LABEL_BUTTON_ABORT_ITEM_LOAD",action:"ABORT_ITEM_LOAD",className:"filepond--action-abort-item-load",align:"LOAD_INDICATOR_POSITION"},RetryItemLoad:{label:"GET_LABEL_BUTTON_RETRY_ITEM_LOAD",action:"RETRY_ITEM_LOAD",icon:"GET_ICON_RETRY",className:"filepond--action-retry-item-load",align:"BUTTON_PROCESS_ITEM_POSITION"},RemoveItem:{label:"GET_LABEL_BUTTON_REMOVE_ITEM",action:"REQUEST_REMOVE_ITEM",icon:"GET_ICON_REMOVE",className:"filepond--action-remove-item",align:"BUTTON_REMOVE_ITEM_POSITION"},ProcessItem:{label:"GET_LABEL_BUTTON_PROCESS_ITEM",action:"REQUEST_ITEM_PROCESSING",icon:"GET_ICON_PROCESS",className:"filepond--action-process-item",align:"BUTTON_PROCESS_ITEM_POSITION"},AbortItemProcessing:{label:"GET_LABEL_BUTTON_ABORT_ITEM_PROCESSING",action:"ABORT_ITEM_PROCESSING",className:"filepond--action-abort-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"},RetryItemProcessing:{label:"GET_LABEL_BUTTON_RETRY_ITEM_PROCESSING",action:"RETRY_ITEM_PROCESSING",icon:"GET_ICON_RETRY",className:"filepond--action-retry-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"},RevertItemProcessing:{label:"GET_LABEL_BUTTON_UNDO_ITEM_PROCESSING",action:"REQUEST_REVERT_ITEM_PROCESSING",icon:"GET_ICON_UNDO",className:"filepond--action-revert-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"}},kc=[];Qt(jc,t=>{kc.push(t)});const as=t=>{if(Gc(t)==="right")return 0;const e=t.ref.buttonRemoveItem.rect.element;return e.hidden?null:e.width+e.left},Gv=t=>t.ref.buttonAbortItemLoad.rect.element.width,Ho=t=>Math.floor(t.ref.buttonRemoveItem.rect.element.height/4),Bv=t=>Math.floor(t.ref.buttonRemoveItem.rect.element.left/2),Uv=t=>t.query("GET_STYLE_LOAD_INDICATOR_POSITION"),Vv=t=>t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION"),Gc=t=>t.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"),zv={buttonAbortItemLoad:{opacity:0},buttonRetryItemLoad:{opacity:0},buttonRemoveItem:{opacity:0},buttonProcessItem:{opacity:0},buttonAbortItemProcessing:{opacity:0},buttonRetryItemProcessing:{opacity:0},buttonRevertItemProcessing:{opacity:0},loadProgressIndicator:{opacity:0,align:Uv},processProgressIndicator:{opacity:0,align:Vv},processingCompleteIndicator:{opacity:0,scaleX:.75,scaleY:.75},info:{translateX:0,translateY:0,opacity:0},status:{translateX:0,translateY:0,opacity:0}},vu={buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:as},status:{translateX:as}},xc={buttonAbortItemProcessing:{opacity:1},processProgressIndicator:{opacity:1},status:{opacity:1}},Cr={DID_THROW_ITEM_INVALID:{buttonRemoveItem:{opacity:1},info:{translateX:as},status:{translateX:as,opacity:1}},DID_START_ITEM_LOAD:{buttonAbortItemLoad:{opacity:1},loadProgressIndicator:{opacity:1},status:{opacity:1}},DID_THROW_ITEM_LOAD_ERROR:{buttonRetryItemLoad:{opacity:1},buttonRemoveItem:{opacity:1},info:{translateX:as},status:{opacity:1}},DID_START_ITEM_REMOVE:{processProgressIndicator:{opacity:1,align:Gc},info:{translateX:as},status:{opacity:0}},DID_THROW_ITEM_REMOVE_ERROR:{processProgressIndicator:{opacity:0,align:Gc},buttonRemoveItem:{opacity:1},info:{translateX:as},status:{opacity:1,translateX:as}},DID_LOAD_ITEM:vu,DID_LOAD_LOCAL_ITEM:{buttonRemoveItem:{opacity:1},info:{translateX:as},status:{translateX:as}},DID_START_ITEM_PROCESSING:xc,DID_REQUEST_ITEM_PROCESSING:xc,DID_UPDATE_ITEM_PROCESS_PROGRESS:xc,DID_COMPLETE_ITEM_PROCESSING:{buttonRevertItemProcessing:{opacity:1},info:{opacity:1},status:{opacity:1}},DID_THROW_ITEM_PROCESSING_ERROR:{buttonRemoveItem:{opacity:1},buttonRetryItemProcessing:{opacity:1},status:{opacity:1},info:{translateX:as}},DID_THROW_ITEM_PROCESSING_REVERT_ERROR:{buttonRevertItemProcessing:{opacity:1},status:{opacity:1},info:{opacity:1}},DID_ABORT_ITEM_PROCESSING:{buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:as},status:{opacity:1}},DID_REVERT_ITEM_PROCESSING:vu},Wv=ae({create:({root:t})=>{t.element.innerHTML=t.query("GET_ICON_DONE")},name:"processing-complete-indicator",ignoreRect:!0,mixins:{styles:["scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",opacity:{type:"tween",duration:250}}}}),Hv=({root:t,props:e})=>{const s=Object.keys(jc).reduce((g,I)=>(g[I]=b({},jc[I]),g),{}),{id:i}=e,n=t.query("GET_ALLOW_REVERT"),a=t.query("GET_ALLOW_REMOVE"),l=t.query("GET_ALLOW_PROCESS"),c=t.query("GET_INSTANT_UPLOAD"),d=t.query("IS_ASYNC"),h=t.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN");let p;d?l&&!n?p=g=>!/RevertItemProcessing/.test(g):!l&&n?p=g=>!/ProcessItem|RetryItemProcessing|AbortItemProcessing/.test(g):!l&&!n&&(p=g=>!/Process/.test(g)):p=g=>!/Process/.test(g);const f=p?kc.filter(p):kc.concat();if(c&&n&&(s.RevertItemProcessing.label="GET_LABEL_BUTTON_REMOVE_ITEM",s.RevertItemProcessing.icon="GET_ICON_REMOVE"),d&&!n){const g=Cr.DID_COMPLETE_ITEM_PROCESSING;g.info.translateX=Bv,g.info.translateY=Ho,g.status.translateY=Ho,g.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}if(d&&!l&&(["DID_START_ITEM_PROCESSING","DID_REQUEST_ITEM_PROCESSING","DID_UPDATE_ITEM_PROCESS_PROGRESS","DID_THROW_ITEM_PROCESSING_ERROR"].forEach(g=>{Cr[g].status.translateY=Ho}),Cr.DID_THROW_ITEM_PROCESSING_ERROR.status.translateX=Gv),h&&n){s.RevertItemProcessing.align="BUTTON_REMOVE_ITEM_POSITION";const g=Cr.DID_COMPLETE_ITEM_PROCESSING;g.info.translateX=as,g.status.translateY=Ho,g.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}a||(s.RemoveItem.disabled=!0),Qt(s,(g,I)=>{const w=t.createChildView(tf,{label:t.query(I.label),icon:t.query(I.icon),opacity:0});f.includes(g)&&t.appendChildView(w),I.disabled&&(w.element.setAttribute("disabled","disabled"),w.element.setAttribute("hidden","hidden")),w.element.dataset.align=t.query(`GET_STYLE_${I.align}`),w.element.classList.add(I.className),w.on("click",S=>{S.stopPropagation(),!I.disabled&&t.dispatch(I.action,{query:i})}),t.ref[`button${g}`]=w}),t.ref.processingCompleteIndicator=t.appendChildView(t.createChildView(Wv)),t.ref.processingCompleteIndicator.element.dataset.align=t.query("GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"),t.ref.info=t.appendChildView(t.createChildView(Mv,{id:i})),t.ref.status=t.appendChildView(t.createChildView(kv,{id:i}));const m=t.appendChildView(t.createChildView(gu,{opacity:0,align:t.query("GET_STYLE_LOAD_INDICATOR_POSITION")}));m.element.classList.add("filepond--load-indicator"),t.ref.loadProgressIndicator=m;const E=t.appendChildView(t.createChildView(gu,{opacity:0,align:t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}));E.element.classList.add("filepond--process-indicator"),t.ref.processProgressIndicator=E,t.ref.activeStyles=[]},qv=({root:t,actions:e,props:s})=>{Yv({root:t,actions:e,props:s});let i=e.concat().filter(n=>/^DID_/.test(n.type)).reverse().find(n=>Cr[n.type]);if(i){t.ref.activeStyles=[];const n=Cr[i.type];Qt(zv,(a,l)=>{const c=t.ref[a];Qt(l,(d,h)=>{const p=n[a]&&typeof n[a][d]!="undefined"?n[a][d]:h;t.ref.activeStyles.push({control:c,key:d,value:p})})})}t.ref.activeStyles.forEach(({control:n,key:a,value:l})=>{n[a]=typeof l=="function"?l(t):l})},Yv=Ye({DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING:({root:t,action:e})=>{t.ref.buttonAbortItemProcessing.label=e.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD:({root:t,action:e})=>{t.ref.buttonAbortItemLoad.label=e.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL:({root:t,action:e})=>{t.ref.buttonAbortItemRemoval.label=e.value},DID_REQUEST_ITEM_PROCESSING:({root:t})=>{t.ref.processProgressIndicator.spin=!0,t.ref.processProgressIndicator.progress=0},DID_START_ITEM_LOAD:({root:t})=>{t.ref.loadProgressIndicator.spin=!0,t.ref.loadProgressIndicator.progress=0},DID_START_ITEM_REMOVE:({root:t})=>{t.ref.processProgressIndicator.spin=!0,t.ref.processProgressIndicator.progress=0},DID_UPDATE_ITEM_LOAD_PROGRESS:({root:t,action:e})=>{t.ref.loadProgressIndicator.spin=!1,t.ref.loadProgressIndicator.progress=e.progress},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:t,action:e})=>{t.ref.processProgressIndicator.spin=!1,t.ref.processProgressIndicator.progress=e.progress}}),Xv=ae({create:Hv,write:qv,didCreateView:t=>{er("CREATE_VIEW",A(b({},t),{view:t}))},name:"file"}),Zv=({root:t,props:e})=>{t.ref.fileName=Bi("legend"),t.appendChild(t.ref.fileName),t.ref.file=t.appendChildView(t.createChildView(Xv,{id:e.id})),t.ref.data=!1},Qv=({root:t,props:e})=>{te(t.ref.fileName,gh(t.query("GET_ITEM_NAME",e.id)))},Jv=ae({create:Zv,ignoreRect:!0,write:Ye({DID_LOAD_ITEM:Qv}),didCreateView:t=>{er("CREATE_VIEW",A(b({},t),{view:t}))},tag:"fieldset",name:"file-wrapper"}),wu={type:"spring",damping:.6,mass:7},Kv=({root:t,props:e})=>{[{name:"top"},{name:"center",props:{translateY:null,scaleY:null},mixins:{animations:{scaleY:wu},styles:["translateY","scaleY"]}},{name:"bottom",props:{translateY:null},mixins:{animations:{translateY:wu},styles:["translateY"]}}].forEach(s=>{tw(t,s,e.name)}),t.element.classList.add(`filepond--${e.name}`),t.ref.scalable=null},tw=(t,e,s)=>{const i=ae({name:`panel-${e.name} filepond--${s}`,mixins:e.mixins,ignoreRectUpdate:!0}),n=t.createChildView(i,e.props);t.ref[e.name]=t.appendChildView(n)},ew=({root:t,props:e})=>{if((t.ref.scalable===null||e.scalable!==t.ref.scalable)&&(t.ref.scalable=jp(e.scalable)?e.scalable:!0,t.element.dataset.scalable=t.ref.scalable),!e.height)return;const s=t.ref.top.rect.element,i=t.ref.bottom.rect.element,n=Math.max(s.height+i.height,e.height);t.ref.center.translateY=s.height,t.ref.center.scaleY=(n-s.height-i.height)/100,t.ref.bottom.translateY=n-i.height},rf=ae({name:"panel",read:({root:t,props:e})=>e.heightCurrent=t.ref.bottom.translateY,write:ew,create:Kv,ignoreRect:!0,mixins:{apis:["height","heightCurrent","scalable"]}}),sw=t=>{const e=t.map(i=>i.id);let s;return{setIndex:i=>{s=i},getIndex:()=>s,getItemIndex:i=>e.indexOf(i.id)}},_u={type:"spring",stiffness:.75,damping:.45,mass:10},Tu="spring",xu={DID_START_ITEM_LOAD:"busy",DID_UPDATE_ITEM_LOAD_PROGRESS:"loading",DID_THROW_ITEM_INVALID:"load-invalid",DID_THROW_ITEM_LOAD_ERROR:"load-error",DID_LOAD_ITEM:"idle",DID_THROW_ITEM_REMOVE_ERROR:"remove-error",DID_START_ITEM_REMOVE:"busy",DID_START_ITEM_PROCESSING:"busy processing",DID_REQUEST_ITEM_PROCESSING:"busy processing",DID_UPDATE_ITEM_PROCESS_PROGRESS:"processing",DID_COMPLETE_ITEM_PROCESSING:"processing-complete",DID_THROW_ITEM_PROCESSING_ERROR:"processing-error",DID_THROW_ITEM_PROCESSING_REVERT_ERROR:"processing-revert-error",DID_ABORT_ITEM_PROCESSING:"cancelled",DID_REVERT_ITEM_PROCESSING:"idle"},iw=({root:t,props:e})=>{if(t.ref.handleClick=i=>t.dispatch("DID_ACTIVATE_ITEM",{id:e.id}),t.element.id=`filepond--item-${e.id}`,t.element.addEventListener("click",t.ref.handleClick),t.ref.container=t.appendChildView(t.createChildView(Jv,{id:e.id})),t.ref.panel=t.appendChildView(t.createChildView(rf,{name:"item-panel"})),t.ref.panel.height=null,e.markedForRemoval=!1,!t.query("GET_ALLOW_REORDER"))return;t.element.dataset.dragState="idle";const s=i=>{if(!i.isPrimary)return;let n=!1;const a={x:i.pageX,y:i.pageY};e.dragOrigin={x:t.translateX,y:t.translateY},e.dragCenter={x:i.offsetX,y:i.offsetY};const l=sw(t.query("GET_ACTIVE_ITEMS"));t.dispatch("DID_GRAB_ITEM",{id:e.id,dragState:l});const c=f=>{if(!f.isPrimary)return;f.stopPropagation(),f.preventDefault(),e.dragOffset={x:f.pageX-a.x,y:f.pageY-a.y},e.dragOffset.x*e.dragOffset.x+e.dragOffset.y*e.dragOffset.y>16&&!n&&(n=!0,t.element.removeEventListener("click",t.ref.handleClick)),t.dispatch("DID_DRAG_ITEM",{id:e.id,dragState:l})},d=f=>{f.isPrimary&&(e.dragOffset={x:f.pageX-a.x,y:f.pageY-a.y},p())},h=()=>{p()},p=()=>{document.removeEventListener("pointercancel",h),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",d),t.dispatch("DID_DROP_ITEM",{id:e.id,dragState:l}),n&&setTimeout(()=>t.element.addEventListener("click",t.ref.handleClick),0)};document.addEventListener("pointercancel",h),document.addEventListener("pointermove",c),document.addEventListener("pointerup",d)};t.element.addEventListener("pointerdown",s)},nw=Ye({DID_UPDATE_PANEL_HEIGHT:({root:t,action:e})=>{t.height=e.height}}),rw=Ye({DID_GRAB_ITEM:({root:t,props:e})=>{e.dragOrigin={x:t.translateX,y:t.translateY}},DID_DRAG_ITEM:({root:t})=>{t.element.dataset.dragState="drag"},DID_DROP_ITEM:({root:t,props:e})=>{e.dragOffset=null,e.dragOrigin=null,t.element.dataset.dragState="drop"}},({root:t,actions:e,props:s,shouldOptimize:i})=>{t.element.dataset.dragState==="drop"&&t.scaleX<=1&&(t.element.dataset.dragState="idle");let n=e.concat().filter(l=>/^DID_/.test(l.type)).reverse().find(l=>xu[l.type]);n&&n.type!==s.currentState&&(s.currentState=n.type,t.element.dataset.filepondItemState=xu[s.currentState]||"");const a=t.query("GET_ITEM_PANEL_ASPECT_RATIO")||t.query("GET_PANEL_ASPECT_RATIO");a?i||(t.height=t.rect.element.width*a):(nw({root:t,actions:e,props:s}),!t.height&&t.ref.container.rect.element.height>0&&(t.height=t.ref.container.rect.element.height)),i&&(t.ref.panel.height=null),t.ref.panel.height=t.height}),aw=ae({create:iw,write:rw,destroy:({root:t,props:e})=>{t.element.removeEventListener("click",t.ref.handleClick),t.dispatch("RELEASE_ITEM",{query:e.id})},tag:"li",name:"item",mixins:{apis:["id","interactionMethod","markedForRemoval","spawnDate","dragCenter","dragOrigin","dragOffset"],styles:["translateX","translateY","scaleX","scaleY","opacity","height"],animations:{scaleX:Tu,scaleY:Tu,translateX:_u,translateY:_u,opacity:{type:"tween",duration:150}}}});var Eh=(t,e)=>Math.max(1,Math.floor((t+1)/e));const bh=(t,e,s)=>{if(!s)return;const i=t.rect.element.width,n=e.length;let a=null;if(n===0||s.top<e[0].rect.element.top)return-1;const c=e[0].rect.element,d=c.marginLeft+c.marginRight,h=c.width+d,p=Eh(i,h);if(p===1){for(let E=0;E<n;E++){const g=e[E],I=g.rect.outer.top+g.rect.element.height*.5;if(s.top<I)return E}return n}const f=c.marginTop+c.marginBottom,m=c.height+f;for(let E=0;E<n;E++){const g=E%p,I=Math.floor(E/p),w=g*h,S=I*m,_=S-c.marginTop,R=w+h,L=S+m+c.marginBottom;if(s.top<L&&s.top>_){if(s.left<R)return E;E!==n-1?a=E:a=null}}return a!==null?a:n},qo={height:0,width:0,get getHeight(){return this.height},set setHeight(t){(this.height===0||t===0)&&(this.height=t)},get getWidth(){return this.width},set setWidth(t){(this.width===0||t===0)&&(this.width=t)}},ow=({root:t})=>{Ee(t.element,"role","list"),t.ref.lastItemSpanwDate=Date.now()},lw=({root:t,action:e})=>{const{id:s,index:i,interactionMethod:n}=e;t.ref.addIndex=i;const a=Date.now();let l=a,c=1;if(n!==$s.NONE){c=0;const d=t.query("GET_ITEM_INSERT_INTERVAL"),h=a-t.ref.lastItemSpanwDate;l=h<d?a+(d-h):a}t.ref.lastItemSpanwDate=l,t.appendChildView(t.createChildView(aw,{spawnDate:l,id:s,opacity:c,interactionMethod:n}),i)},Su=(t,e,s,i=0,n=1)=>{t.dragOffset?(t.translateX=null,t.translateY=null,t.translateX=t.dragOrigin.x+t.dragOffset.x,t.translateY=t.dragOrigin.y+t.dragOffset.y,t.scaleX=1.025,t.scaleY=1.025):(t.translateX=e,t.translateY=s,Date.now()>t.spawnDate&&(t.opacity===0&&cw(t,e,s,i,n),t.scaleX=1,t.scaleY=1,t.opacity=1))},cw=(t,e,s,i,n)=>{t.interactionMethod===$s.NONE?(t.translateX=null,t.translateX=e,t.translateY=null,t.translateY=s):t.interactionMethod===$s.DROP?(t.translateX=null,t.translateX=e-i*20,t.translateY=null,t.translateY=s-n*10,t.scaleX=.8,t.scaleY=.8):t.interactionMethod===$s.BROWSE?(t.translateY=null,t.translateY=s-30):t.interactionMethod===$s.API&&(t.translateX=null,t.translateX=e-30,t.translateY=null)},dw=({root:t,action:e})=>{const{id:s}=e,i=t.childViews.find(n=>n.id===s);i&&(i.scaleX=.9,i.scaleY=.9,i.opacity=0,i.markedForRemoval=!0)},Sc=t=>t.rect.element.height+t.rect.element.marginBottom+t.rect.element.marginTop,hw=t=>t.rect.element.width+t.rect.element.marginLeft*.5+t.rect.element.marginRight*.5,uw=({root:t,action:e})=>{const{id:s,dragState:i}=e,n=t.query("GET_ITEM",{id:s}),a=t.childViews.find(w=>w.id===s),l=t.childViews.length,c=i.getItemIndex(n);if(!a)return;const d={x:a.dragOrigin.x+a.dragOffset.x+a.dragCenter.x,y:a.dragOrigin.y+a.dragOffset.y+a.dragCenter.y},h=Sc(a),p=hw(a);let f=Math.floor(t.rect.outer.width/p);f>l&&(f=l);const m=Math.floor(l/f+1);qo.setHeight=h*m,qo.setWidth=p*f;var E={y:Math.floor(d.y/h),x:Math.floor(d.x/p),getGridIndex:function(){return d.y>qo.getHeight||d.y<0||d.x>qo.getWidth||d.x<0?c:this.y*f+this.x},getColIndex:function(){const S=t.query("GET_ACTIVE_ITEMS"),_=t.childViews.filter(W=>W.rect.element.height),R=S.map(W=>_.find(V=>V.id===W.id)),L=R.findIndex(W=>W===a),M=Sc(a),D=R.length;let G=D,C=0,k=0,q=0;for(let W=0;W<D;W++)if(C=Sc(R[W]),q=k,k=q+C,d.y<k){if(L>W){if(d.y<q+M){G=W;break}continue}G=W;break}return G}};const g=f>1?E.getGridIndex():E.getColIndex();t.dispatch("MOVE_ITEM",{query:a,index:g});const I=i.getIndex();if(I===void 0||I!==g){if(i.setIndex(g),I===void 0)return;t.dispatch("DID_REORDER_ITEMS",{items:t.query("GET_ACTIVE_ITEMS"),origin:c,target:g})}},pw=Ye({DID_ADD_ITEM:lw,DID_REMOVE_ITEM:dw,DID_DRAG_ITEM:uw}),fw=({root:t,props:e,actions:s,shouldOptimize:i})=>{pw({root:t,props:e,actions:s});const{dragCoordinates:n}=e,a=t.rect.element.width,l=t.childViews.filter(R=>R.rect.element.height),c=t.query("GET_ACTIVE_ITEMS").map(R=>l.find(L=>L.id===R.id)).filter(R=>R),d=n?bh(t,c,n):null,h=t.ref.addIndex||null;t.ref.addIndex=null;let p=0,f=0,m=0;if(c.length===0)return;const E=c[0].rect.element,g=E.marginTop+E.marginBottom,I=E.marginLeft+E.marginRight,w=E.width+I,S=E.height+g,_=Eh(a,w);if(_===1){let R=0,L=0;c.forEach((M,D)=>{if(d){let k=D-d;k===-2?L=-g*.25:k===-1?L=-g*.75:k===0?L=g*.75:k===1?L=g*.25:L=0}i&&(M.translateX=null,M.translateY=null),M.markedForRemoval||Su(M,0,R+L);let C=(M.rect.element.height+g)*(M.markedForRemoval?M.opacity:1);R+=C})}else{let R=0,L=0;c.forEach((M,D)=>{D===d&&(p=1),D===h&&(m+=1),M.markedForRemoval&&M.opacity<.5&&(f-=1);const G=D+m+p+f,C=G%_,k=Math.floor(G/_),q=C*w,W=k*S,V=Math.sign(q-R),X=Math.sign(W-L);R=q,L=W,!M.markedForRemoval&&(i&&(M.translateX=null,M.translateY=null),Su(M,q,W,V,X))})}},mw=(t,e)=>e.filter(s=>s.data&&s.data.id?t.id===s.data.id:!0),gw=ae({create:ow,write:fw,tag:"ul",name:"list",didWriteView:({root:t})=>{t.childViews.filter(e=>e.markedForRemoval&&e.opacity===0&&e.resting).forEach(e=>{e._destroy(),t.removeChildView(e)})},filterFrameActionsForChild:mw,mixins:{apis:["dragCoordinates"]}}),Ew=({root:t,props:e})=>{t.ref.list=t.appendChildView(t.createChildView(gw)),e.dragCoordinates=null,e.overflowing=!1},bw=({root:t,props:e,action:s})=>{t.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(e.dragCoordinates={left:s.position.scopeLeft-t.ref.list.rect.element.left,top:s.position.scopeTop-(t.rect.outer.top+t.rect.element.marginTop+t.rect.element.scrollTop)})},Iw=({props:t})=>{t.dragCoordinates=null},vw=Ye({DID_DRAG:bw,DID_END_DRAG:Iw}),ww=({root:t,props:e,actions:s})=>{if(vw({root:t,props:e,actions:s}),t.ref.list.dragCoordinates=e.dragCoordinates,e.overflowing&&!e.overflow&&(e.overflowing=!1,t.element.dataset.state="",t.height=null),e.overflow){const i=Math.round(e.overflow);i!==t.height&&(e.overflowing=!0,t.element.dataset.state="overflow",t.height=i)}},_w=ae({create:Ew,write:ww,name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Js=(t,e,s,i="")=>{s?Ee(t,e,i):t.removeAttribute(e)},Tw=t=>{if(!(!t||t.value==="")){try{t.value=""}catch(e){}if(t.value){const e=Bi("form"),s=t.parentNode,i=t.nextSibling;e.appendChild(t),e.reset(),i?s.insertBefore(t,i):s.appendChild(t)}}},xw=({root:t,props:e})=>{t.element.id=`filepond--browser-${e.id}`,Ee(t.element,"name",t.query("GET_NAME")),Ee(t.element,"aria-controls",`filepond--assistant-${e.id}`),Ee(t.element,"aria-labelledby",`filepond--drop-label-${e.id}`),af({root:t,action:{value:t.query("GET_ACCEPTED_FILE_TYPES")}}),of({root:t,action:{value:t.query("GET_ALLOW_MULTIPLE")}}),lf({root:t,action:{value:t.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Bc({root:t}),cf({root:t,action:{value:t.query("GET_REQUIRED")}}),df({root:t,action:{value:t.query("GET_CAPTURE_METHOD")}}),t.ref.handleChange=s=>{if(!t.element.value)return;const i=Array.from(t.element.files).map(n=>(n._relativePath=n.webkitRelativePath,n));setTimeout(()=>{e.onload(i),Tw(t.element)},250)},t.element.addEventListener("change",t.ref.handleChange)},af=({root:t,action:e})=>{t.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Js(t.element,"accept",!!e.value,e.value?e.value.join(","):"")},of=({root:t,action:e})=>{Js(t.element,"multiple",e.value)},lf=({root:t,action:e})=>{Js(t.element,"webkitdirectory",e.value)},Bc=({root:t})=>{const e=t.query("GET_DISABLED"),s=t.query("GET_ALLOW_BROWSE"),i=e||!s;Js(t.element,"disabled",i)},cf=({root:t,action:e})=>{e.value?t.query("GET_TOTAL_ITEMS")===0&&Js(t.element,"required",!0):Js(t.element,"required",!1)},df=({root:t,action:e})=>{Js(t.element,"capture",!!e.value,e.value===!0?"":e.value)},Ru=({root:t})=>{const{element:e}=t;if(t.query("GET_TOTAL_ITEMS")>0){Js(e,"required",!1),Js(e,"name",!1);const s=t.query("GET_ACTIVE_ITEMS");let i=!1;for(let n=0;n<s.length;n++)s[n].status===bt.LOAD_ERROR&&(i=!0);t.element.setCustomValidity(i?t.query("GET_LABEL_INVALID_FIELD"):"")}else Js(e,"name",!0,t.query("GET_NAME")),t.query("GET_CHECK_VALIDITY")&&e.setCustomValidity(""),t.query("GET_REQUIRED")&&Js(e,"required",!0)},Sw=({root:t})=>{t.query("GET_CHECK_VALIDITY")&&t.element.setCustomValidity(t.query("GET_LABEL_INVALID_FIELD"))},Rw=ae({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:xw,destroy:({root:t})=>{t.element.removeEventListener("change",t.ref.handleChange)},write:Ye({DID_LOAD_ITEM:Ru,DID_REMOVE_ITEM:Ru,DID_THROW_ITEM_INVALID:Sw,DID_SET_DISABLED:Bc,DID_SET_ALLOW_BROWSE:Bc,DID_SET_ALLOW_DIRECTORIES_ONLY:lf,DID_SET_ALLOW_MULTIPLE:of,DID_SET_ACCEPTED_FILE_TYPES:af,DID_SET_CAPTURE_METHOD:df,DID_SET_REQUIRED:cf})}),Cu={ENTER:13,SPACE:32},Cw=({root:t,props:e})=>{const s=Bi("label");Ee(s,"for",`filepond--browser-${e.id}`),Ee(s,"id",`filepond--drop-label-${e.id}`),t.ref.handleKeyDown=i=>{(i.keyCode===Cu.ENTER||i.keyCode===Cu.SPACE)&&(i.preventDefault(),t.ref.label.click())},t.ref.handleClick=i=>{i.target===s||s.contains(i.target)||t.ref.label.click()},s.addEventListener("keydown",t.ref.handleKeyDown),t.element.addEventListener("click",t.ref.handleClick),hf(s,e.caption),t.appendChild(s),t.ref.label=s},hf=(t,e)=>{t.innerHTML=e;const s=t.querySelector(".filepond--label-action");return s&&Ee(s,"tabindex","0"),e},Ow=ae({name:"drop-label",ignoreRect:!0,create:Cw,destroy:({root:t})=>{t.ref.label.addEventListener("keydown",t.ref.handleKeyDown),t.element.removeEventListener("click",t.ref.handleClick)},write:Ye({DID_SET_LABEL_IDLE:({root:t,action:e})=>{hf(t.ref.label,e.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),$w=ae({name:"drip-blob",ignoreRect:!0,mixins:{styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}}}}),yw=({root:t})=>{const e=t.rect.element.width*.5,s=t.rect.element.height*.5;t.ref.blob=t.appendChildView(t.createChildView($w,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:e,translateY:s}))},Lw=({root:t,action:e})=>{if(!t.ref.blob){yw({root:t});return}t.ref.blob.translateX=e.position.scopeLeft,t.ref.blob.translateY=e.position.scopeTop,t.ref.blob.scaleX=1,t.ref.blob.scaleY=1,t.ref.blob.opacity=1},Aw=({root:t})=>{t.ref.blob&&(t.ref.blob.opacity=0)},Mw=({root:t})=>{t.ref.blob&&(t.ref.blob.scaleX=2.5,t.ref.blob.scaleY=2.5,t.ref.blob.opacity=0)},Nw=({root:t,props:e,actions:s})=>{Pw({root:t,props:e,actions:s});const{blob:i}=t.ref;s.length===0&&i&&i.opacity===0&&(t.removeChildView(i),t.ref.blob=null)},Pw=Ye({DID_DRAG:Lw,DID_DROP:Mw,DID_END_DRAG:Aw}),Dw=ae({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:Nw}),uf=(t,e)=>{try{const s=new DataTransfer;e.forEach(i=>{i instanceof File?s.items.add(i):s.items.add(new File([i],i.name,{type:i.type}))}),t.files=s.files}catch(s){return!1}return!0},Fw=({root:t})=>{t.ref.fields={};const e=document.createElement("legend");e.textContent="Files",t.element.appendChild(e)},fc=(t,e)=>t.ref.fields[e],Ih=t=>{t.query("GET_ACTIVE_ITEMS").forEach(e=>{t.ref.fields[e.id]&&t.element.appendChild(t.ref.fields[e.id])})},Ou=({root:t})=>Ih(t),jw=({root:t,action:e})=>{const n=!(t.query("GET_ITEM",e.id).origin===ge.LOCAL)&&t.query("SHOULD_UPDATE_FILE_INPUT"),a=Bi("input");a.type=n?"file":"hidden",a.name=t.query("GET_NAME"),t.ref.fields[e.id]=a,Ih(t)},kw=({root:t,action:e})=>{const s=fc(t,e.id);if(!s||(e.serverFileReference!==null&&(s.value=e.serverFileReference),!t.query("SHOULD_UPDATE_FILE_INPUT")))return;const i=t.query("GET_ITEM",e.id);uf(s,[i.file])},Gw=({root:t,action:e})=>{t.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(()=>{const s=fc(t,e.id);s&&uf(s,[e.file])},0)},Bw=({root:t})=>{t.element.disabled=t.query("GET_DISABLED")},Uw=({root:t,action:e})=>{const s=fc(t,e.id);s&&(s.parentNode&&s.parentNode.removeChild(s),delete t.ref.fields[e.id])},Vw=({root:t,action:e})=>{const s=fc(t,e.id);s&&(e.value===null?s.removeAttribute("value"):s.type!="file"&&(s.value=e.value),Ih(t))},zw=Ye({DID_SET_DISABLED:Bw,DID_ADD_ITEM:jw,DID_LOAD_ITEM:kw,DID_REMOVE_ITEM:Uw,DID_DEFINE_VALUE:Vw,DID_PREPARE_OUTPUT:Gw,DID_REORDER_ITEMS:Ou,DID_SORT_ITEMS:Ou}),Ww=ae({tag:"fieldset",name:"data",create:Fw,write:zw,ignoreRect:!0}),Hw=t=>"getRootNode"in t?t.getRootNode():document,qw=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],Yw=["css","csv","html","txt"],Xw={zip:"zip|compressed",epub:"application/epub+zip"},pf=(t="")=>(t=t.toLowerCase(),qw.includes(t)?"image/"+(t==="jpg"?"jpeg":t==="svg"?"svg+xml":t):Yw.includes(t)?"text/"+t:Xw[t]||""),vh=t=>new Promise((e,s)=>{const i=i_(t);if(i.length&&!Zw(t))return e(i);Qw(t).then(e)}),Zw=t=>t.files?t.files.length>0:!1,Qw=t=>new Promise((e,s)=>{const i=(t.items?Array.from(t.items):[]).filter(n=>Jw(n)).map(n=>Kw(n));if(!i.length){e(t.files?Array.from(t.files):[]);return}Promise.all(i).then(n=>{const a=[];n.forEach(l=>{a.push.apply(a,l)}),e(a.filter(l=>l).map(l=>(l._relativePath||(l._relativePath=l.webkitRelativePath),l)))}).catch(console.error)}),Jw=t=>{if(ff(t)){const e=wh(t);if(e)return e.isFile||e.isDirectory}return t.kind==="file"},Kw=t=>new Promise((e,s)=>{if(s_(t)){t_(wh(t)).then(e).catch(s);return}e([t.getAsFile()])}),t_=t=>new Promise((e,s)=>{const i=[];let n=0,a=0;const l=()=>{a===0&&n===0&&e(i)},c=d=>{n++;const h=d.createReader(),p=()=>{h.readEntries(f=>{if(f.length===0){n--,l();return}f.forEach(m=>{m.isDirectory?c(m):(a++,m.file(E=>{const g=e_(E);m.fullPath&&(g._relativePath=m.fullPath),i.push(g),a--,l()}))}),p()},s)};p()};c(t)}),e_=t=>{if(t.type.length)return t;const e=t.lastModifiedDate,s=t.name,i=pf(pc(t.name));return i.length&&(t=t.slice(0,t.size,i),t.name=s,t.lastModifiedDate=e),t},s_=t=>ff(t)&&(wh(t)||{}).isDirectory,ff=t=>"webkitGetAsEntry"in t,wh=t=>t.webkitGetAsEntry(),i_=t=>{let e=[];try{if(e=r_(t),e.length)return e;e=n_(t)}catch(s){}return e},n_=t=>{let e=t.getData("url");return typeof e=="string"&&e.length?[e]:[]},r_=t=>{let e=t.getData("text/html");if(typeof e=="string"&&e.length){const s=e.match(/src\s*=\s*"(.+?)"/);if(s)return[s[1]]}return[]},jl=[],Kn=t=>({pageLeft:t.pageX,pageTop:t.pageY,scopeLeft:t.offsetX||t.layerX,scopeTop:t.offsetY||t.layerY}),a_=(t,e,s)=>{const i=o_(e),n={element:t,filterElement:s,state:null,ondrop:()=>{},onenter:()=>{},ondrag:()=>{},onexit:()=>{},onload:()=>{},allowdrop:()=>{}};return n.destroy=i.addListener(n),n},o_=t=>{const e=jl.find(i=>i.element===t);if(e)return e;const s=l_(t);return jl.push(s),s},l_=t=>{const e=[],s={dragenter:d_,dragover:h_,dragleave:p_,drop:u_},i={};Qt(s,(a,l)=>{i[a]=l(t,e),t.addEventListener(a,i[a],!1)});const n={element:t,addListener:a=>(e.push(a),()=>{e.splice(e.indexOf(a),1),e.length===0&&(jl.splice(jl.indexOf(n),1),Qt(s,l=>{t.removeEventListener(l,i[l],!1)}))})};return n},c_=(t,e)=>("elementFromPoint"in t||(t=document),t.elementFromPoint(e.x,e.y)),_h=(t,e)=>{const s=Hw(e),i=c_(s,{x:t.pageX-window.pageXOffset,y:t.pageY-window.pageYOffset});return i===e||e.contains(i)};let mf=null;const Yo=(t,e)=>{try{t.dropEffect=e}catch(s){}},d_=(t,e)=>s=>{s.preventDefault(),mf=s.target,e.forEach(i=>{const{element:n,onenter:a}=i;_h(s,n)&&(i.state="enter",a(Kn(s)))})},h_=(t,e)=>s=>{s.preventDefault();const i=s.dataTransfer;vh(i).then(n=>{let a=!1;e.some(l=>{const{filterElement:c,element:d,onenter:h,onexit:p,ondrag:f,allowdrop:m}=l;Yo(i,"copy");const E=m(n);if(!E){Yo(i,"none");return}if(_h(s,d)){if(a=!0,l.state===null){l.state="enter",h(Kn(s));return}if(l.state="over",c&&!E){Yo(i,"none");return}f(Kn(s))}else c&&!a&&Yo(i,"none"),l.state&&(l.state=null,p(Kn(s)))})})},u_=(t,e)=>s=>{s.preventDefault();const i=s.dataTransfer;vh(i).then(n=>{e.forEach(a=>{const{filterElement:l,element:c,ondrop:d,onexit:h,allowdrop:p}=a;if(a.state=null,!(l&&!_h(s,c))){if(!p(n))return h(Kn(s));d(Kn(s),n)}})})},p_=(t,e)=>s=>{mf===s.target&&e.forEach(i=>{const{onexit:n}=i;i.state=null,n(Kn(s))})},f_=(t,e,s)=>{t.classList.add("filepond--hopper");const{catchesDropsOnPage:i,requiresDropOnElement:n,filterItems:a=p=>p}=s,l=a_(t,i?document.documentElement:t,n);let c="",d="";l.allowdrop=p=>e(a(p)),l.ondrop=(p,f)=>{const m=a(f);if(!e(m)){h.ondragend(p);return}d="drag-drop",h.onload(m,p)},l.ondrag=p=>{h.ondrag(p)},l.onenter=p=>{d="drag-over",h.ondragstart(p)},l.onexit=p=>{d="drag-exit",h.ondragend(p)};const h={updateHopperState:()=>{c!==d&&(t.dataset.hopperState=d,c=d)},onload:()=>{},ondragstart:()=>{},ondrag:()=>{},ondragend:()=>{},destroy:()=>{l.destroy()}};return h};let Uc=!1;const $r=[],gf=t=>{const e=document.activeElement;if(e&&(/textarea|input/i.test(e.nodeName)||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")==="")){let i=!1,n=e;for(;n!==document.body;){if(n.classList.contains("filepond--root")){i=!0;break}n=n.parentNode}if(!i)return}vh(t.clipboardData).then(i=>{i.length&&$r.forEach(n=>n(i))})},m_=t=>{$r.includes(t)||($r.push(t),!Uc&&(Uc=!0,document.addEventListener("paste",gf)))},g_=t=>{ph($r,$r.indexOf(t)),$r.length===0&&(document.removeEventListener("paste",gf),Uc=!1)},E_=()=>{const t=s=>{e.onload(s)},e={destroy:()=>{g_(t)},onload:()=>{}};return m_(t),e},b_=({root:t,props:e})=>{t.element.id=`filepond--assistant-${e.id}`,Ee(t.element,"role","alert"),Ee(t.element,"aria-live","polite"),Ee(t.element,"aria-relevant","additions")};let $u=null,yu=null;const Rc=[],mc=(t,e)=>{t.element.textContent=e},I_=t=>{t.element.textContent=""},Ef=(t,e,s)=>{const i=t.query("GET_TOTAL_ITEMS");mc(t,`${s} ${e}, ${i} ${i===1?t.query("GET_LABEL_FILE_COUNT_SINGULAR"):t.query("GET_LABEL_FILE_COUNT_PLURAL")}`),clearTimeout(yu),yu=setTimeout(()=>{I_(t)},1500)},bf=t=>t.element.parentNode.contains(document.activeElement),v_=({root:t,action:e})=>{if(!bf(t))return;t.element.textContent="";const s=t.query("GET_ITEM",e.id);Rc.push(s.filename),clearTimeout($u),$u=setTimeout(()=>{Ef(t,Rc.join(", "),t.query("GET_LABEL_FILE_ADDED")),Rc.length=0},750)},w_=({root:t,action:e})=>{if(!bf(t))return;const s=e.item;Ef(t,s.filename,t.query("GET_LABEL_FILE_REMOVED"))},__=({root:t,action:e})=>{const i=t.query("GET_ITEM",e.id).filename,n=t.query("GET_LABEL_FILE_PROCESSING_COMPLETE");mc(t,`${i} ${n}`)},Lu=({root:t,action:e})=>{const i=t.query("GET_ITEM",e.id).filename,n=t.query("GET_LABEL_FILE_PROCESSING_ABORTED");mc(t,`${i} ${n}`)},Xo=({root:t,action:e})=>{const i=t.query("GET_ITEM",e.id).filename;mc(t,`${e.status.main} ${i} ${e.status.sub}`)},T_=ae({create:b_,ignoreRect:!0,ignoreRectUpdate:!0,write:Ye({DID_LOAD_ITEM:v_,DID_REMOVE_ITEM:w_,DID_COMPLETE_ITEM_PROCESSING:__,DID_ABORT_ITEM_PROCESSING:Lu,DID_REVERT_ITEM_PROCESSING:Lu,DID_THROW_ITEM_REMOVE_ERROR:Xo,DID_THROW_ITEM_LOAD_ERROR:Xo,DID_THROW_ITEM_INVALID:Xo,DID_THROW_ITEM_PROCESSING_ERROR:Xo}),tag:"span",name:"assistant"}),If=(t,e="-")=>t.replace(new RegExp(`${e}.`,"g"),s=>s.charAt(1).toUpperCase()),vf=(t,e=16,s=!0)=>{let i=Date.now(),n=null;return(...a)=>{clearTimeout(n);const l=Date.now()-i,c=()=>{i=Date.now(),t(...a)};l<e?s||(n=setTimeout(c,e-l)):c()}},x_=1e6,kl=t=>t.preventDefault(),S_=({root:t,props:e})=>{const s=t.query("GET_ID");s&&(t.element.id=s);const i=t.query("GET_CLASS_NAME");i&&i.split(" ").filter(d=>d.length).forEach(d=>{t.element.classList.add(d)}),t.ref.label=t.appendChildView(t.createChildView(Ow,A(b({},e),{translateY:null,caption:t.query("GET_LABEL_IDLE")}))),t.ref.list=t.appendChildView(t.createChildView(_w,{translateY:null})),t.ref.panel=t.appendChildView(t.createChildView(rf,{name:"panel-root"})),t.ref.assistant=t.appendChildView(t.createChildView(T_,b({},e))),t.ref.data=t.appendChildView(t.createChildView(Ww,b({},e))),t.ref.measure=Bi("div"),t.ref.measure.style.height="100%",t.element.appendChild(t.ref.measure),t.ref.bounds=null,t.query("GET_STYLES").filter(d=>!Gi(d.value)).map(({name:d,value:h})=>{t.element.dataset[d]=h}),t.ref.widthPrevious=null,t.ref.widthUpdated=vf(()=>{t.ref.updateHistory=[],t.dispatch("DID_RESIZE_ROOT")},250),t.ref.previousAspectRatio=null,t.ref.updateHistory=[];const n=window.matchMedia("(pointer: fine) and (hover: hover)").matches,a="PointerEvent"in window;t.query("GET_ALLOW_REORDER")&&a&&!n&&(t.element.addEventListener("touchmove",kl,{passive:!1}),t.element.addEventListener("gesturestart",kl));const l=t.query("GET_CREDITS");if(l.length===2){const d=document.createElement("a");d.className="filepond--credits",d.href=l[0],d.tabIndex=-1,d.target="_blank",d.rel="noopener noreferrer nofollow",d.textContent=l[1],t.element.appendChild(d),t.ref.credits=d}},R_=({root:t,props:e,actions:s})=>{if(L_({root:t,props:e,actions:s}),s.filter(D=>/^DID_SET_STYLE_/.test(D.type)).filter(D=>!Gi(D.data.value)).map(({type:D,data:G})=>{const C=If(D.substring(8).toLowerCase(),"_");t.element.dataset[C]=G.value,t.invalidateLayout()}),t.rect.element.hidden)return;t.rect.element.width!==t.ref.widthPrevious&&(t.ref.widthPrevious=t.rect.element.width,t.ref.widthUpdated());let i=t.ref.bounds;i||(i=t.ref.bounds=$_(t),t.element.removeChild(t.ref.measure),t.ref.measure=null);const{hopper:n,label:a,list:l,panel:c}=t.ref;n&&n.updateHopperState();const d=t.query("GET_PANEL_ASPECT_RATIO"),h=t.query("GET_ALLOW_MULTIPLE"),p=t.query("GET_TOTAL_ITEMS"),f=h?t.query("GET_MAX_FILES")||x_:1,m=p===f,E=s.find(D=>D.type==="DID_ADD_ITEM");if(m&&E){const D=E.data.interactionMethod;a.opacity=0,h?a.translateY=-40:D===$s.API?a.translateX=40:D===$s.BROWSE?a.translateY=40:a.translateY=30}else m||(a.opacity=1,a.translateX=0,a.translateY=0);const g=C_(t),I=O_(t),w=a.rect.element.height,S=!h||m?0:w,_=m?l.rect.element.marginTop:0,R=p===0?0:l.rect.element.marginBottom,L=S+_+I.visual+R,M=S+_+I.bounds+R;if(l.translateY=Math.max(0,S-l.rect.element.marginTop)-g.top,d){const D=t.rect.element.width,G=D*d;d!==t.ref.previousAspectRatio&&(t.ref.previousAspectRatio=d,t.ref.updateHistory=[]);const C=t.ref.updateHistory;C.push(D);const k=2;if(C.length>k*2){const W=C.length,V=W-10;let X=0;for(let j=W;j>=V;j--)if(C[j]===C[j-2]&&X++,X>=k)return}c.scalable=!1,c.height=G;const q=G-S-(R-g.bottom)-(m?_:0);I.visual>q?l.overflow=q:l.overflow=null,t.height=G}else if(i.fixedHeight){c.scalable=!1;const D=i.fixedHeight-S-(R-g.bottom)-(m?_:0);I.visual>D?l.overflow=D:l.overflow=null}else if(i.cappedHeight){const D=L>=i.cappedHeight,G=Math.min(i.cappedHeight,L);c.scalable=!0,c.height=D?G:G-g.top-g.bottom;const C=G-S-(R-g.bottom)-(m?_:0);L>i.cappedHeight&&I.visual>C?l.overflow=C:l.overflow=null,t.height=Math.min(i.cappedHeight,M-g.top-g.bottom)}else{const D=p>0?g.top+g.bottom:0;c.scalable=!0,c.height=Math.max(w,L-D),t.height=Math.max(w,M-D)}t.ref.credits&&c.heightCurrent&&(t.ref.credits.style.transform=`translateY(${c.heightCurrent}px)`)},C_=t=>{const e=t.ref.list.childViews[0].childViews[0];return e?{top:e.rect.element.marginTop,bottom:e.rect.element.marginBottom}:{top:0,bottom:0}},O_=t=>{let e=0,s=0;const i=t.ref.list,n=i.childViews[0],a=n.childViews.filter(_=>_.rect.element.height),l=t.query("GET_ACTIVE_ITEMS").map(_=>a.find(R=>R.id===_.id)).filter(_=>_);if(l.length===0)return{visual:e,bounds:s};const c=n.rect.element.width,d=bh(n,l,i.dragCoordinates),h=l[0].rect.element,p=h.marginTop+h.marginBottom,f=h.marginLeft+h.marginRight,m=h.width+f,E=h.height+p,g=typeof d!="undefined"&&d>=0?1:0,I=l.find(_=>_.markedForRemoval&&_.opacity<.45)?-1:0,w=l.length+g+I,S=Eh(c,m);return S===1?l.forEach(_=>{const R=_.rect.element.height+p;s+=R,e+=R*_.opacity}):(s=Math.ceil(w/S)*E,e=s),{visual:e,bounds:s}},$_=t=>{const e=t.ref.measureHeight||null;return{cappedHeight:parseInt(t.style.maxHeight,10)||null,fixedHeight:e===0?null:e}},Th=(t,e)=>{const s=t.query("GET_ALLOW_REPLACE"),i=t.query("GET_ALLOW_MULTIPLE"),n=t.query("GET_TOTAL_ITEMS");let a=t.query("GET_MAX_FILES");const l=e.length;return!i&&l>1?(t.dispatch("DID_THROW_MAX_FILES",{source:e,error:Kt("warning",0,"Max files")}),!0):(a=i?a:1,!i&&s?!1:pa(a)&&n+l>a?(t.dispatch("DID_THROW_MAX_FILES",{source:e,error:Kt("warning",0,"Max files")}),!0):!1)},y_=(t,e,s)=>{const i=t.childViews[0];return bh(i,e,{left:s.scopeLeft-i.rect.element.left,top:s.scopeTop-(t.rect.outer.top+t.rect.element.marginTop+t.rect.element.scrollTop)})},Au=t=>{const e=t.query("GET_ALLOW_DROP"),s=t.query("GET_DISABLED"),i=e&&!s;if(i&&!t.ref.hopper){const n=f_(t.element,a=>{const l=t.query("GET_BEFORE_DROP_FILE")||(()=>!0);return t.query("GET_DROP_VALIDATION")?a.every(d=>er("ALLOW_HOPPER_ITEM",d,{query:t.query}).every(h=>h===!0)&&l(d)):!0},{filterItems:a=>{const l=t.query("GET_IGNORED_FILES");return a.filter(c=>Jn(c)?!l.includes(c.name.toLowerCase()):!0)},catchesDropsOnPage:t.query("GET_DROP_ON_PAGE"),requiresDropOnElement:t.query("GET_DROP_ON_ELEMENT")});n.onload=(a,l)=>{const d=t.ref.list.childViews[0].childViews.filter(p=>p.rect.element.height),h=t.query("GET_ACTIVE_ITEMS").map(p=>d.find(f=>f.id===p.id)).filter(p=>p);Zs("ADD_ITEMS",a,{dispatch:t.dispatch}).then(p=>{if(Th(t,p))return!1;t.dispatch("ADD_ITEMS",{items:p,index:y_(t.ref.list,h,l),interactionMethod:$s.DROP})}),t.dispatch("DID_DROP",{position:l}),t.dispatch("DID_END_DRAG",{position:l})},n.ondragstart=a=>{t.dispatch("DID_START_DRAG",{position:a})},n.ondrag=vf(a=>{t.dispatch("DID_DRAG",{position:a})}),n.ondragend=a=>{t.dispatch("DID_END_DRAG",{position:a})},t.ref.hopper=n,t.ref.drip=t.appendChildView(t.createChildView(Dw))}else!i&&t.ref.hopper&&(t.ref.hopper.destroy(),t.ref.hopper=null,t.removeChildView(t.ref.drip))},Mu=(t,e)=>{const s=t.query("GET_ALLOW_BROWSE"),i=t.query("GET_DISABLED"),n=s&&!i;n&&!t.ref.browser?t.ref.browser=t.appendChildView(t.createChildView(Rw,A(b({},e),{onload:a=>{Zs("ADD_ITEMS",a,{dispatch:t.dispatch}).then(l=>{if(Th(t,l))return!1;t.dispatch("ADD_ITEMS",{items:l,index:-1,interactionMethod:$s.BROWSE})})}})),0):!n&&t.ref.browser&&(t.removeChildView(t.ref.browser),t.ref.browser=null)},Nu=t=>{const e=t.query("GET_ALLOW_PASTE"),s=t.query("GET_DISABLED"),i=e&&!s;i&&!t.ref.paster?(t.ref.paster=E_(),t.ref.paster.onload=n=>{Zs("ADD_ITEMS",n,{dispatch:t.dispatch}).then(a=>{if(Th(t,a))return!1;t.dispatch("ADD_ITEMS",{items:a,index:-1,interactionMethod:$s.PASTE})})}):!i&&t.ref.paster&&(t.ref.paster.destroy(),t.ref.paster=null)},L_=Ye({DID_SET_ALLOW_BROWSE:({root:t,props:e})=>{Mu(t,e)},DID_SET_ALLOW_DROP:({root:t})=>{Au(t)},DID_SET_ALLOW_PASTE:({root:t})=>{Nu(t)},DID_SET_DISABLED:({root:t,props:e})=>{Au(t),Nu(t),Mu(t,e),t.query("GET_DISABLED")?t.element.dataset.disabled="disabled":t.element.removeAttribute("data-disabled")}}),A_=ae({name:"root",read:({root:t})=>{t.ref.measure&&(t.ref.measureHeight=t.ref.measure.offsetHeight)},create:S_,write:R_,destroy:({root:t})=>{t.ref.paster&&t.ref.paster.destroy(),t.ref.hopper&&t.ref.hopper.destroy(),t.element.removeEventListener("touchmove",kl),t.element.removeEventListener("gesturestart",kl)},mixins:{styles:["height"]}}),M_=(t={})=>{let e=null;const s=Fl(),i=Zb(PI(s),[KI,jI(s)],[xv,FI(s)]);i.dispatch("SET_OPTIONS",{options:t});const n=()=>{document.hidden||i.dispatch("KICK")};document.addEventListener("visibilitychange",n);let a=null,l=!1,c=!1,d=null,h=null;const p=()=>{l||(l=!0),clearTimeout(a),a=setTimeout(()=>{l=!1,d=null,h=null,c&&(c=!1,i.dispatch("DID_STOP_RESIZE"))},500)};window.addEventListener("resize",p);const f=A_(i,{id:uh()});let m=!1,E=!1;const g={_read:()=>{l&&(h=window.innerWidth,d||(d=h),!c&&h!==d&&(i.dispatch("DID_START_RESIZE"),c=!0)),E&&m&&(m=f.element.offsetParent===null),!m&&(f._read(),E=f.rect.element.hidden)},_write:B=>{const H=i.processActionQueue().filter(tt=>!/^SET_/.test(tt.type));m&&!H.length||(_(H),m=f._write(B,H,c),BI(i.query("GET_ITEMS")),m&&i.processDispatchQueue())}},I=B=>H=>{const tt={type:B};if(!H)return tt;if(H.hasOwnProperty("error")&&(tt.error=H.error?b({},H.error):null),H.status&&(tt.status=b({},H.status)),H.file&&(tt.output=H.file),H.source)tt.file=H.source;else if(H.item||H.id){const U=H.item?H.item:i.query("GET_ITEM",H.id);tt.file=U?es(U):null}return H.items&&(tt.items=H.items.map(es)),/progress/.test(B)&&(tt.progress=H.progress),H.hasOwnProperty("origin")&&H.hasOwnProperty("target")&&(tt.origin=H.origin,tt.target=H.target),tt},w={DID_DESTROY:I("destroy"),DID_INIT:I("init"),DID_THROW_MAX_FILES:I("warning"),DID_INIT_ITEM:I("initfile"),DID_START_ITEM_LOAD:I("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:I("addfileprogress"),DID_LOAD_ITEM:I("addfile"),DID_THROW_ITEM_INVALID:[I("error"),I("addfile")],DID_THROW_ITEM_LOAD_ERROR:[I("error"),I("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[I("error"),I("removefile")],DID_PREPARE_OUTPUT:I("preparefile"),DID_START_ITEM_PROCESSING:I("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:I("processfileprogress"),DID_ABORT_ITEM_PROCESSING:I("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:I("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:I("processfiles"),DID_REVERT_ITEM_PROCESSING:I("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[I("error"),I("processfile")],DID_REMOVE_ITEM:I("removefile"),DID_UPDATE_ITEMS:I("updatefiles"),DID_ACTIVATE_ITEM:I("activatefile"),DID_REORDER_ITEMS:I("reorderfiles")},S=B=>{const H=b({pond:K},B);delete H.type,f.element.dispatchEvent(new CustomEvent(`FilePond:${B.type}`,{detail:H,bubbles:!0,cancelable:!0,composed:!0}));const tt=[];B.hasOwnProperty("error")&&tt.push(B.error),B.hasOwnProperty("file")&&tt.push(B.file);const U=["type","error","file"];Object.keys(B).filter(J=>!U.includes(J)).forEach(J=>tt.push(B[J])),K.fire(B.type,...tt);const Z=i.query(`GET_ON${B.type.toUpperCase()}`);Z&&Z(...tt)},_=B=>{B.length&&B.filter(H=>w[H.type]).forEach(H=>{const tt=w[H.type];(Array.isArray(tt)?tt:[tt]).forEach(U=>{H.type==="DID_INIT_ITEM"?S(U(H.data)):setTimeout(()=>{S(U(H.data))},0)})})},R=B=>i.dispatch("SET_OPTIONS",{options:B}),L=B=>i.query("GET_ACTIVE_ITEM",B),M=B=>new Promise((H,tt)=>{i.dispatch("REQUEST_ITEM_PREPARE",{query:B,success:U=>{H(U)},failure:U=>{tt(U)}})}),D=(B,H={})=>new Promise((tt,U)=>{k([{source:B,options:H}],{index:H.index}).then(Z=>tt(Z&&Z[0])).catch(U)}),G=B=>B.file&&B.id,C=(B,H)=>(typeof B=="object"&&!G(B)&&!H&&(H=B,B=void 0),i.dispatch("REMOVE_ITEM",A(b({},H),{query:B})),i.query("GET_ACTIVE_ITEM",B)===null),k=(...B)=>new Promise((H,tt)=>{const U=[],Z={};if(cc(B[0]))U.push.apply(U,B[0]),Object.assign(Z,B[1]||{});else{const J=B[B.length-1];typeof J=="object"&&!(J instanceof Blob)&&Object.assign(Z,B.pop()),U.push(...B)}i.dispatch("ADD_ITEMS",{items:U,index:Z.index,interactionMethod:$s.API,success:H,failure:tt})}),q=()=>i.query("GET_ACTIVE_ITEMS"),W=B=>new Promise((H,tt)=>{i.dispatch("REQUEST_ITEM_PROCESSING",{query:B,success:U=>{H(U)},failure:U=>{tt(U)}})}),V=(...B)=>{const H=Array.isArray(B[0])?B[0]:B,tt=H.length?H:q();return Promise.all(tt.map(M))},X=(...B)=>{const H=Array.isArray(B[0])?B[0]:B;if(!H.length){const tt=q().filter(U=>!(U.status===bt.IDLE&&U.origin===ge.LOCAL)&&U.status!==bt.PROCESSING&&U.status!==bt.PROCESSING_COMPLETE&&U.status!==bt.PROCESSING_REVERT_ERROR);return Promise.all(tt.map(W))}return Promise.all(H.map(W))},j=(...B)=>{const H=Array.isArray(B[0])?B[0]:B;let tt;typeof H[H.length-1]=="object"?tt=H.pop():Array.isArray(B[0])&&(tt=B[1]);const U=q();return H.length?H.map(J=>$n(J)?U[J]?U[J].id:null:J).filter(J=>J).map(J=>C(J,tt)):Promise.all(U.map(J=>C(J,tt)))},K=A(b(b(b({},uc()),g),DI(i,s)),{setOptions:R,addFile:D,addFiles:k,getFile:L,processFile:W,prepareFile:M,removeFile:C,moveFile:(B,H)=>i.dispatch("MOVE_ITEM",{query:B,index:H}),getFiles:q,processFiles:X,removeFiles:j,prepareFiles:V,sort:B=>i.dispatch("SORT",{compare:B}),browse:()=>{var B=f.element.querySelector("input[type=file]");B&&B.click()},destroy:()=>{K.fire("destroy",f.element),i.dispatch("ABORT_ALL"),f._destroy(),window.removeEventListener("resize",p),document.removeEventListener("visibilitychange",n),i.dispatch("DID_DESTROY")},insertBefore:B=>iu(f.element,B),insertAfter:B=>nu(f.element,B),appendTo:B=>B.appendChild(f.element),replaceElement:B=>{iu(f.element,B),B.parentNode.removeChild(B),e=B},restoreElement:()=>{e&&(nu(e,f.element),f.element.parentNode.removeChild(f.element),e=null)},isAttachedTo:B=>f.element===B||e===B,element:{get:()=>f.element},status:{get:()=>i.query("GET_STATUS")}});return i.dispatch("DID_INIT"),hn(K)},wf=(t={})=>{const e={};return Qt(Fl(),(i,n)=>{e[i]=n[0]}),M_(b(b({},e),t))},N_=t=>t.charAt(0).toLowerCase()+t.slice(1),P_=t=>If(t.replace(/^data-/,"")),_f=(t,e)=>{Qt(e,(s,i)=>{Qt(t,(n,a)=>{const l=new RegExp(s);if(!l.test(n)||(delete t[n],i===!1))return;if(qe(i)){t[i]=a;return}const d=i.group;we(i)&&!t[d]&&(t[d]={}),t[d][N_(n.replace(l,""))]=a}),i.mapping&&_f(t[i.group],i.mapping)})},D_=(t,e={})=>{const s=[];Qt(t.attributes,n=>{s.push(t.attributes[n])});const i=s.filter(n=>n.name).reduce((n,a)=>{const l=Ee(t,a.name);return n[P_(a.name)]=l===a.name?!0:l,n},{});return _f(i,e),i},F_=(t,e={})=>{const s={"^class$":"className","^multiple$":"allowMultiple","^capture$":"captureMethod","^webkitdirectory$":"allowDirectoriesOnly","^server":{group:"server",mapping:{"^process":{group:"process"},"^revert":{group:"revert"},"^fetch":{group:"fetch"},"^restore":{group:"restore"},"^load":{group:"load"}}},"^type$":!1,"^files$":!1};er("SET_ATTRIBUTE_TO_OPTION_MAP",s);const i=b({},e),n=D_(t.nodeName==="FIELDSET"?t.querySelector("input[type=file]"):t,s);Object.keys(n).forEach(l=>{we(n[l])?(we(i[l])||(i[l]={}),Object.assign(i[l],n[l])):i[l]=n[l]}),i.files=(e.files||[]).concat(Array.from(t.querySelectorAll("input:not([type=file])")).map(l=>({source:l.value,options:{type:l.dataset.type}})));const a=wf(i);return t.files&&Array.from(t.files).forEach(l=>{a.addFile(l)}),a.replaceElement(t),a},j_=(...t)=>Xb(t[0])?F_(...t):wf(...t),k_=["fire","_read","_write"],Pu=t=>{const e={};return Up(t,e,k_),e},G_=(t,e)=>t.replace(/(?:{([a-zA-Z]+)})/g,(s,i)=>e[i]),B_=t=>{const e=new Blob(["(",t.toString(),")()"],{type:"application/javascript"}),s=URL.createObjectURL(e),i=new Worker(s);return{transfer:(n,a)=>{},post:(n,a,l)=>{const c=uh();i.onmessage=d=>{d.data.id===c&&a(d.data.message)},i.postMessage({id:c,message:n},l)},terminate:()=>{i.terminate(),URL.revokeObjectURL(s)}}},U_=t=>new Promise((e,s)=>{const i=new Image;i.onload=()=>{e(i)},i.onerror=n=>{s(n)},i.src=t}),Tf=(t,e)=>{const s=t.slice(0,t.size,t.type);return s.lastModifiedDate=t.lastModifiedDate,s.name=e,s},V_=t=>Tf(t,t.name),Du=[],z_=t=>{if(Du.includes(t))return;Du.push(t);const e=t({addFilter:VI,utils:{Type:Y,forin:Qt,isString:qe,isFile:Jn,toNaturalFileSize:ef,replaceInString:G_,getExtensionFromFilename:pc,getFilenameWithoutExtension:Jp,guesstimateMimeType:pf,getFileFromBlob:la,getFilenameFromURL:Fo,createRoute:Ye,createWorker:B_,createView:ae,createItemAPI:es,loadImage:U_,copyFile:V_,renameFile:Tf,createBlob:Xp,applyFilterChain:Zs,text:te,getNumericAspectRatioFromString:Wp},views:{fileActionButton:tf}});zI(e.options)},W_=()=>Object.prototype.toString.call(window.operamini)==="[object OperaMini]",H_=()=>"Promise"in window,q_=()=>"slice"in Blob.prototype,Y_=()=>"URL"in window&&"createObjectURL"in window.URL,X_=()=>"visibilityState"in document,Z_=()=>"performance"in window,Q_=()=>"supports"in(window.CSS||{}),J_=()=>/MSIE|Trident/.test(window.navigator.userAgent),Vc=(()=>{const t=Dp()&&!W_()&&X_()&&H_()&&q_()&&Y_()&&Z_()&&(Q_()||J_());return()=>t})(),zi={apps:[]},K_="filepond",sr=()=>{};let xf={},Sf={},Rf={},zc={},el=sr,sl=sr,Wc=sr,Hc=sr,qc=sr,Yc=sr,Xc=sr;if(Vc()){wI(()=>{zi.apps.forEach(s=>s._read())},s=>{zi.apps.forEach(i=>i._write(s))});const t=()=>{document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:Vc,create:el,destroy:sl,parse:Wc,find:Hc,registerPlugin:qc,setOptions:Xc}})),document.removeEventListener("DOMContentLoaded",t)};document.readyState!=="loading"?setTimeout(()=>t(),0):document.addEventListener("DOMContentLoaded",t);const e=()=>Qt(Fl(),(s,i)=>{zc[s]=i[1]});xf=b({},Hp),Rf=b({},ge),Sf=b({},bt),zc={},e(),el=(...s)=>{const i=j_(...s);return i.on("destroy",sl),zi.apps.push(i),Pu(i)},sl=s=>{const i=zi.apps.findIndex(n=>n.isAttachedTo(s));return i>=0?(zi.apps.splice(i,1)[0].restoreElement(),!0):!1},Wc=s=>Array.from(s.querySelectorAll(`.${K_}`)).filter(a=>!zi.apps.find(l=>l.isAttachedTo(a))).map(a=>el(a)),Hc=s=>{const i=zi.apps.find(n=>n.isAttachedTo(s));return i?Pu(i):null},qc=(...s)=>{s.forEach(z_),e()},Yc=()=>{const s={};return Qt(Fl(),(i,n)=>{s[i]=n[0]}),s},Xc=s=>(we(s)&&(zi.apps.forEach(i=>{i.setOptions(s)}),WI(s)),Yc())}var Fu=Object.freeze({__proto__:null,get FileOrigin(){return Rf},get FileStatus(){return Sf},get OptionTypes(){return zc},get Status(){return xf},get create(){return el},get destroy(){return sl},get find(){return Hc},get getOptions(){return Yc},get parse(){return Wc},get registerPlugin(){return qc},get setOptions(){return Xc},supported:Vc});function At({formID:t,fieldKey:e,fieldData:s,children:i,noLabel:n,noErrMsg:a,isBuilder:l}){var L,M,D,G,C,k,q,W,V,X;const{"*":c}=ac(),d=et(Ig),h=et(_e),{styleMode:p}=h,[f,m,E]=c.split("/"),g=p&&f==="theme-customize"&&["err-msg","err-txt","err-txt-pre-i","err-txt-suf-i"].indexOf(m)>=0,I=p&&f==="field-theme-customize"&&["err-msg","err-txt","err-txt-pre-i","err-txt-suf-i"].indexOf(m)>=0&&E===e,w=((L=s.valid)==null?void 0:L.hide)||!1,S=((D=(M=s.err)==null?void 0:M.req)==null?void 0:D.dflt)||"",_=F.useRef(null),R=j=>{const K=j.getBoundingClientRect();return K.top>=0&&K.left>=0&&K.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&K.right<=(window.innerWidth||document.documentElement.clientWidth)};if(S&&_.current){const j=_.current,K=document.body.getBoundingClientRect(),H=j.getBoundingClientRect().top-K.top;R(j)||window.scroll({top:H,behavior:"smooth"})}return u.jsxs("div",A(b({ref:_,"data-testid":`${e}-fld-wrp`,"data-dev-fld-wrp":e,className:`bf-${(s==null?void 0:s.typ)||"default"}-field ${e}-fld-wrp ${x(e,"fld-wrp")} ${p?"":"drag"} ${w?"fld-hide":""}`,style:{direction:d}},N(e,"fld-wrp")),{children:[!n&&u.jsxs("div",A(b({"data-testid":`${e}-lbl-wrp`,"data-dev-lbl-wrp":e,className:`${e}-lbl-wrp ${x(e,"lbl-wrp")}`},N(e,"lbl-wrp")),{children:[!((G=s==null?void 0:s.valid)!=null&&G.hideLbl)&&"lbl"in s&&u.jsxs("label",A(b({"data-testid":`${e}-lbl`,"data-dev-lbl":e,title:s.lbl,className:`${e}-lbl ${x(e,"lbl")}`,htmlFor:e},N(e,"lbl")),{children:[((C=s.valid)==null?void 0:C.req)&&((k=s.valid)==null?void 0:k.reqShow)&&((q=s.valid)==null?void 0:q.reqPos)==="before"&&u.jsx("span",A(b({"data-testid":`${e}-req-smbl`,"data-dev-req-smbl":e,className:`${e}-req-smbl ${x(e,"req-smbl")}`},N(e,"req-smbl")),{children:"*"})),s.lblPreIcn&&u.jsx("img",b({"data-testid":`${e}-lbl-pre-i`,"data-dev-lbl-pre-i":e,className:`${e}-lbl-pre-i ${x(e,"lbl-pre-i")}`,src:s.lblPreIcn,alt:""},N(e,"lbl-pre-i"))),u.jsx(We,{html:s.lbl.replace(/\$_bf_\$/g,"\\")}),s.lblSufIcn&&u.jsx("img",b({"data-testid":`${e}-lbl-suf-i`,"data-dev-lbl-suf-i":e,className:`${e}-lbl-suf-i ${x(e,"lbl-suf-i")}`,src:s.lblSufIcn,alt:""},N(e,"lbl-suf-i"))),((W=s.valid)==null?void 0:W.req)&&((V=s.valid)==null?void 0:V.reqShow)&&((X=s.valid)==null?void 0:X.reqPos)!=="before"&&u.jsx("span",A(b({"data-testid":`${e}-req-smbl`,"data-dev-req-smbl":e,className:`${e}-req-smbl ${x(e,"req-smbl")}`},N(e,"req-smbl")),{children:"*"}))]})),(s.subtitle||s.subTlePreIcn||s.subTleSufIcn)&&u.jsxs("div",A(b({"data-testid":`${e}-sub-titl`,"data-dev-sub-titl":e,className:`${e}-sub-titl ${x(e,"sub-titl")}`},N(e,"sub-titl")),{children:[s.subTlePreIcn&&u.jsx("img",b({"data-testid":`${e}-sub-titl-pre-i`,"data-dev-sub-titl-pre-i":e,className:`${e}-sub-titl-pre-i ${x(e,"sub-titl-pre-i")}`,src:s.subTlePreIcn,alt:""},N(e,"sub-titl-pre-i"))),u.jsx(We,{html:s.subtitle||""}),s.subTleSufIcn&&u.jsx("img",b({"data-testid":`${e}-sub-titl-suf-i`,"data-dev-sub-titl-suf-i":e,className:`${e}-sub-titl-suf-i ${x(e,"sub-titl-suf-i")}`,src:s.subTleSufIcn,alt:""},N(e,"sub-titl-suf-i")))]}))]})),u.jsxs("div",A(b({"data-testid":`${e}-inp-wrp`,className:`${e}-inp-wrp ${x(e,"inp-wrp")}`},N(e,"inp-wrp")),{children:[i,(s.helperTxt||s.hlpPreIcn||s.hlpSufIcn)&&u.jsxs("div",A(b({"data-testid":`${e}-hlp-txt`,"data-dev-hlp-txt":e,className:`${e}-hlp-txt ${x(e,"hlp-txt")}`},N(e,"hlp-txt")),{children:[s.hlpPreIcn&&u.jsx("img",b({"data-testid":`${e}-hlp-txt-pre-i`,"data-dev-hlp-txt-pre-i":e,className:`${e}-hlp-txt-pre-i ${x(e,"hlp-txt-pre-i")}`,src:s.hlpPreIcn,alt:""},N(e,"hlp-txt-pre-i"))),u.jsx(We,{html:s.helperTxt||""}),s.hlpSufIcn&&u.jsx("img",b({"data-testid":`${e}-hlp-txt-suf-i`,"data-dev-hlp-txt-suf-i":e,className:`${e}-hlp-txt-suf-i ${x(e,"hlp-txt-suf-i")}`,src:s.hlpSufIcn,alt:""},N(e,"hlp-txt-suf-i")))]})),!a&&(g||I)&&u.jsxs("div",A(b({"data-testid":`${e}-err-msg`,"data-dev-err-msg":e,className:`${e}-err-msg ${x(e,"err-msg")}`},N(e,"err-msg")),{children:[s.errPreIcn&&u.jsx("img",b({"data-testid":`${e}-err-txt-pre-i`,"data-dev-err-txt-pre-i":e,className:`${e}-err-txt-pre-i ${x(e,"err-txt-pre-i")}`,src:s.errPreIcn,alt:""},N(e,"err-txt-pre-i"))),u.jsx("div",A(b({"data-testid":`${e}-err-txt`,"data-dev-err-txt":e,className:`${e}-err-txt ${x(e,"err-txt")}`},N(e,"err-txt")),{children:u.jsx(We,{html:`${S||"This is an example of an error message. this message will vary by a condition or validation check."} `})})),s.errSufIcn&&u.jsx("img",b({"data-testid":`${e}-err-txt-suf-i`,"data-dev-err-txt-suf-i":e,className:`${e}-err-txt-suf-i ${x(e,"err-txt-suf-i")}`,src:s.errSufIcn,alt:""},N(e,"err-txt-suf-i")))]}))]}))]}))}function tT({attr:t,formID:e,fieldKey:s,styleClasses:i}){const[n]=Os(jt),a=n[s],{config:l}=a,[c,d]=F.useState(0),h=F.useRef(null),p=F.useRef(null),f=et(_e),{styleMode:m}=f;F.useEffect(()=>{const g=document.getElementById("bit-grid-layout").contentWindow;g.bit_filepond||(g.bit_filepond=Fu),g.bit_filepond_plugin_image_preview||(g.bit_filepond_plugin_image_preview=Rp),g.bit_filepond_plugin_file_validate_size||(g.bit_filepond_plugin_file_validate_size=vp),g.bit_filepond_plugin_file_validate_type||(g.bit_filepond_plugin_file_validate_type=wp),g.bit_filepond_plugin_image_crop||(g.bit_filepond_plugin_image_crop=_p),g.bit_filepond_plugin_image_resize||(g.bit_filepond_plugin_image_resize=Cp),g.bit_filepond_plugin_image_transform||(g.bit_filepond_plugin_image_transform=Mp),g.bit_filepond_plugin_image_validate_size||(g.bit_filepond_plugin_image_validate_size=Np),g.bit_filepond_plugin_media_preview||(g.bit_filepond_plugin_media_preview=Pp);const I={configSetting:b(b({},l),!m&&{disabled:!0}),fieldKey:s,window:g,document:document.getElementById("bit-grid-layout").contentDocument,formID:e,ajaxURL:typeof bits=="undefined"?bitFromsFront==null?void 0:bitFromsFront.ajaxURL:bits.ajaxURL,nonce:typeof bits=="undefined"?"":bits.nonce,uploadFileToServer:!0,onFileUpdate:()=>d(_=>_+1)};p!=null&&p.current||(p.current=Gt(`#filepond-${s}-container`));const w=h.current,S=p.current;w&&(Fu.destroy(p.current),S.firstChild&&S.removeChild(S.firstChild)),h.current=new Pg(S,I),d(_=>_+1)},[a==null?void 0:a.config]);const E=(g,I=!1)=>{var w;if((w=Gt(`.${s}-inp-wrp .${g}`))==null||w.setAttribute(`data-dev-${g}`,s),I){const S=vg(`.${s}-inp-wrp .${g}`);S.length>0&&[...S].map(_=>{_.setAttribute(`data-dev-${g}`,s)})}};return F.useEffect(()=>{E("filepond--root"),E("filepond--drop-label"),E("filepond--label-action"),E("filepond--panel-root"),E("filepond--item-panel",!0),E("filepond--file-action-button",!0),E("filepond--drip-blob"),E("filepond--file")},[c]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:i}),u.jsxs(At,{formID:e,fieldKey:s,fieldData:t,children:[u.jsx("input",b(b(A(b({hidden:!0},m&&{id:s}),{type:"file",className:"filepond",name:"filepond"}),"disabled"in a.valid&&{disabled:a.valid.disabled}),"readonly"in a.valid&&{readOnly:a.valid.readonly})),u.jsx("div",{ref:p,id:`filepond-${s}-container`,className:`filepond-${s}-container ${a.valid.disabled?"disabled":""} ${a.valid.readonly?"readonly":""}`})]})]})}var eT=F.memo(tT);function sT({attr:t,formID:e,fieldKey:s,styleClasses:i}){const[n]=Os(jt),a=n[s],{config:l}=a;t.typ;const[c,d]=F.useState(t.val!==void 0?t.val:""),h=F.useRef(null),p=F.useRef(null),f=et(_e),{styleMode:m}=f;return F.useEffect(()=>{const E=document.getElementById("bit-grid-layout"),g=E==null?void 0:E.contentWindow,I=E==null?void 0:E.contentDocument;if(!g||!I)return;if(!I.querySelector("style[data-flatpickr-style]")){const R=I.createElement("style");R.setAttribute("data-flatpickr-style","true"),R.textContent=`${wg}
40 .flatpickr-calendar:empty{display:none !important;}`,I.head.appendChild(R)}p!=null&&p.current||(p.current=Gt(`#${s}-advanced-datetime`));const S=h.current,_=p.current;S&&_!=null&&_.firstChild&&_.removeChild(_.firstChild)},[a==null?void 0:a.config]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:i}),u.jsx(At,{formID:e,fieldKey:s,fieldData:t,children:u.jsxs("div",A(b({"data-testid":`${s}-inp-fld-wrp`,className:`${s}-inp-fld-wrp ${x(s,"inp-fld-wrp")}`},N(s,"inp-fld-wrp")),{children:[u.jsx("input",b(A(b(b(b(b(b(b({"data-testid":s,"data-dev-fld":s,id:`${s}-advanced-datetime`,list:`${s}-datalist`,ref:p,className:`${s}-advanced-datetime ${s}-fld no-drg ${x(s,"fld")} bf-advanced-datetime-hidden-input`,type:"text",autoComplete:"off"},"req"in t.valid&&{required:t.valid.req}),"disabled"in t.valid&&{disabled:t.valid.disabled}),"readonly"in t.valid&&{readOnly:t.valid.readonly}),"ph"in t&&{placeholder:t.ph}),"fieldName"in t&&{name:t.fieldName}),"ac"in t&&{autoComplete:t.ac}),{value:c}),N(s,"fld"))),t.prefixIcn&&u.jsx("img",b({"data-testid":`${s}-pre-i`,"data-dev-pre-i":s,className:`${s}-pre-i ${x(s,"pre-i")}`,height:"90%",src:t.prefixIcn,alt:""},N(s,"pre-i"))),t.suffixIcn&&u.jsx("img",b({"data-testid":`${s}-suf-i`,"data-dev-suf-i":s,className:`${s}-suf-i ${x(s,"suf-i")}`,height:"90%",src:t.suffixIcn,alt:""},N(s,"suf-i")))]}))})]})}function iT({fieldKey:t,attr:e,styleClasses:s,buttonDisabled:i,handleReset:n,formID:a,data:l}){const c=Ks(s);return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:c}),u.jsx(At,{formID:a,fieldKey:t,fieldData:e,noLabel:!0,noErrMsg:!0,children:u.jsx("div",A(b({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${x(t,"inp-fld-wrp")}`},N(t,"inp-fld-wrp")),{children:u.jsxs("button",A(b(b(A(b({"data-testid":t,"data-dev-btn":t,className:`${t}-btn ${x(t,"btn")}`},N(t,"btn")),{type:e.btnTyp}),e.btnTyp==="reset"&&{onClick:n}),"disabled"in e.valid&&{disabled:e.valid.disabled}),{name:e.fieldName,children:[e.btnPreIcn&&u.jsx("img",b({"data-testid":`${t}-btn-pre-i`,"data-dev-btn-pre-i":t,className:`${t}-btn-pre-i ${x(t,"btn-pre-i")}`,src:e.btnPreIcn,alt:""},N(t,"btn-pre-i"))),u.jsx(We,{html:e.txt||""}),e.btnSufIcn&&u.jsx("img",b({"data-testid":`${t}-btn-suf-i`,"data-dev-btn-suf-i":t,className:`${t}-btn-suf-i ${x(t,"btn-suf-i")}`,src:e.btnSufIcn,alt:""},N(t,"btn-suf-i")))]}))}))})]})}function nT({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){const l=et(jt),[c,d]=F.useState({checked:[]}),h=Ks(l[n]),[p,f]=F.useState(""),m=(E,g)=>{const{checked:I}=E.target;if(I)c.checked.push(g);else{const w=c.checked.indexOf(g);c.checked.splice(w,1),d({checked:c.checked})}Pt(n)};return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:i,fieldKey:n,fieldData:t,children:u.jsxs("div",A(b({"data-testid":`${n}-cc`,"data-dev-cc":n,className:`${n}-cc ${x(n,"cc")}`},N(n,"cc")),{children:[u.jsx("svg",{className:`${n}-cks`,children:u.jsx("symbol",{id:`${n}-ck-svg`,viewBox:"0 0 12 10",children:u.jsx("polyline",{className:`${n}-ck-svgline`,points:"1.5 6 4.5 9 10.5 1"})})}),t.opt.map((E,g)=>u.jsxs("div",A(b({"data-testid":`${n}-cw`,"data-dev-cw":n,className:`${n}-cw ${x(n,"cw")}`},N(n,"cw")),{children:[u.jsx("input",b(A(b(A(b({"data-testid":`${n}-ci`,id:`${n}-chk-${g}`,type:"checkbox",className:`${n}-ci ${x(n,"ci")}`},(t.valid.disabled||E.disabled)&&{disabled:!0}),{defaultValue:E.val||E.lbl}),t.valid.req&&{required:!0}),{name:`${h.lbl}[]`,checked:c.checked.includes(g)||(E==null?void 0:E.check),onChange:I=>m(I,g)}),N(n,"ci"))),u.jsxs("label",A(b({"data-testid":`${n}-cl`,"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-chk-${g}`,className:`${n}-cl ${x(n,"cl")}`},N(n,"cl")),{children:[u.jsx("span",A(b({"data-testid":`${n}-bx`,"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${x(n,"bx")}`},N(n,"bx")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp ${x(n,"svgwrp")}`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn ${x(n,"ck-icn")}`})})})),u.jsx("span",A(b({"data-testid":`${n}-ct`,"data-dev-ct":n,className:`${n}-ct ${x(n,"ct")}`},N(n,"ct")),{children:u.jsx(We,{html:E.lbl})}))]}))]}),`opt-${g+24}`)),t.addOtherOpt&&u.jsxs("div",A(b({"data-testid":`${n}-cw`,"data-dev-cw":n,className:`${n}-cw ${x(n,"cw")}`},N(n,"cw")),{children:[u.jsx("input",b(A(b({"data-testid":`${n}-ci`,"data-oopt":n,id:`${n}-chk-${t.opt.length}`,type:"checkbox",className:`${n}-ci ${x(n,"ci")}`,disabled:t.valid.disabled,value:p},t.valid.req&&{required:!0}),{name:`${h.lbl}[]`,checked:c.checked.includes(t.opt.length),onChange:E=>m(E,t.opt.length)}),N(n,"ci"))),u.jsxs("label",A(b({"data-testid":`${n}-cl`,"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-chk-${t.opt.length}`,className:`${n}-cl ${x(n,"cl")}`},N(n,"cl")),{children:[u.jsx("span",A(b({"data-testid":`${n}-bx`,"data-dev-ck":n,"data-bx":!0,className:`${n}-bx ${n}-ck ${x(n,"ck")}`},N(n,"ck")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp ${x(n,"svgwrp")}`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn ${x(n,"ck-icn")}`})})})),u.jsx("span",A(b({"data-testid":`${n}-ct`,"data-dev-ct":n,className:`${n}-ct ${x(n,"ct")}`},N(n,"ct")),{children:t.otherOptLbl||"Other..."}))]})),u.jsx("div",{"data-oinp-wrp":!0,className:`${n}-other-inp-wrp`,children:u.jsx("input",A(b(b(b({"data-testid":`${n}-other-inp`,"data-dev-other-inp":n,type:"text",className:`${n}-other-inp ${x(n,"other-inp")}`},t.valid.otherOptReq&&{required:!0}),"otherInpPh"in t&&{placeholder:t.otherInpPh}),!("otherInpPh"in t)&&{placeholder:"Other..."}),{value:p,onChange:E=>f(E.target.value)}))})]}),`opt-${t.opt.length+24}`)]}))})]})}var de,he,qt,Zi,Ar,js,Vl,zl,Ce,ai,Qa,Es,Ci,bs,Dn,ks,Qi,Ja,Ka,to,Mr,Fn,Wl,eo,Nr,Pr,oi,li,Oe,Is,vs,Dr,so,io,Fr,jr,kr,Gr,P,Cf,Of,Zc,$f,yf,Ve,fs,Lf,Af,Mf,Ta,il,Qc,Jc,xa,Kc,nl,Sa,_i,Ra,In,Rt,ms,td,Ca,Oa,aT,ed,Nf,Pf,sd,rr,Df,id,Ff,jf;class rT{constructor(e,s){O(this,P);O(this,de);O(this,he);O(this,qt);O(this,Zi);O(this,Ar);O(this,js);O(this,Vl,"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=");O(this,zl);O(this,Ce);O(this,ai);O(this,Qa);O(this,Es);O(this,Ci,"");O(this,bs,[]);O(this,Dn,!0);O(this,ks,!0);O(this,Qi,!0);O(this,Ja,!0);O(this,Ka,!1);O(this,to,!1);O(this,Mr,"");O(this,Fn,"Select a Country");O(this,Wl,"Search Country");O(this,eo,"No Currency Found");O(this,Nr,370);O(this,Pr,30);O(this,oi);O(this,li,{});O(this,Oe,[]);O(this,Is,{});O(this,vs,{});O(this,Dr,"");O(this,so,"");O(this,io,null);O(this,Fr,"");O(this,jr,[]);O(this,kr);O(this,Gr,!1);o(this,P,Cf).call(this,s),typeof e=="string"?T(this,de,r(this,oi).querySelector(e)):T(this,de,e),this.fieldKey=r(this,so),this.init()}init(){var e;T(this,he,o(this,P,Ve).call(this,`.${this.fieldKey}-country-hidden-input`)),T(this,qt,o(this,P,Ve).call(this,`.${this.fieldKey}-dpd-wrp`)),T(this,Zi,o(this,P,Ve).call(this,`.${this.fieldKey}-selected-country-img`)),T(this,Ar,o(this,P,Ve).call(this,`.${this.fieldKey}-selected-country-lbl`)),T(this,js,r(this,ks)?o(this,P,Ve).call(this,`.${this.fieldKey}-inp-clr-btn`):{}),T(this,zl,o(this,P,Ve).call(this,`.${this.fieldKey}-option-search-wrp`)),T(this,Ce,o(this,P,Ve).call(this,`.${this.fieldKey}-opt-search-input`)),T(this,ai,o(this,P,Ve).call(this,`.${this.fieldKey}-search-clear-btn`)),T(this,Qa,o(this,P,Ve).call(this,`.${this.fieldKey}-option-wrp`)),T(this,Es,o(this,P,Ve).call(this,`.${this.fieldKey}-option-list`)),this.setMenu({open:!1}),r(this,Ka)&&o(this,P,Lf).call(this),r(this,to)&&o(this,P,Af).call(this),r(this,Mr)&&o(this,P,$f).call(this),o(this,P,yf).call(this),o(this,P,Zc).call(this),r(this,li).observeElm(r(this,he),"value",(s,i)=>{o(this,P,Qc).call(this,s,i)}),r(this,Dn)||(e=r(this,Zi))==null||e.remove(),r(this,Qi)&&(o(this,P,ms).call(this,r(this,Ce),"padding-right","35px"),o(this,P,ms).call(this,r(this,ai),"display","none")),o(this,P,fs).call(this,r(this,Es),"scroll",s=>{s.stopPropagation()})}setSelectedCountryItem(e){if(T(this,Ci,e),!r(this,Ci))return;const s=o(this,P,nl).call(this);s&&(r(this,Dn)&&r(this,Zi)&&(r(this,Zi).src=`${r(this,Dr)}${s.img}`),o(this,P,Ra).call(this,r(this,Ar),s.lbl),this.setMenu({open:!1}),this.value=s.val||s.lbl,r(this,ks)&&(o(this,P,ms).call(this,r(this,js),"display","grid"),o(this,P,fs).call(this,r(this,js),"click",i=>{o(this,P,Jc).call(this,i)})),r(this,kr)&&r(this,kr).call(this,s.val||s.lbl),o(this,P,Rt).call(this,r(this,qt),"aria-label",`${s.lbl} selected`),o(this,P,xa).call(this,r(this,he),"blur"),setTimeout(()=>{o(this,P,Rt).call(this,r(this,qt),"aria-label",s.lbl)},100))}searchOptions(e){o(this,P,Pf).call(this,e);let s=[];e?(s=r(this,Oe).filter(i=>i.lbl.toLowerCase().includes(e.toLowerCase())),s.length||(s=[{i:0,lbl:r(this,eo)}]),T(this,bs,s),r(this,Qi)&&o(this,P,ms).call(this,r(this,ai),"display","grid")):(T(this,bs,r(this,Oe)),r(this,Qi)&&o(this,P,ms).call(this,r(this,ai),"display","none")),o(this,P,td).call(this)}setMenu({open:e}){o(this,P,ms).call(this,r(this,Qa),"max-height",`${e?r(this,Nr):0}px`),e?(o(this,P,Df).call(this),r(this,de).classList.add("menu-open"),o(this,P,fs).call(this,r(this,oi),"click",s=>o(this,P,sd).call(this,s)),o(this,P,In).call(this,r(this,Ce),"0"),o(this,P,In).call(this,r(this,ai),"0"),r(this,qt).setAttribute("aria-expanded","true"),o(this,P,Rt).call(this,r(this,Es),"aria-hidden",!1),o(this,P,Rt).call(this,r(this,Ce),"aria-hidden",!1),o(this,P,td).call(this)):(r(this,de).classList.remove("menu-open"),r(this,oi).removeEventListener("click",o(this,P,sd)),setTimeout(()=>{this.searchOptions("")},100),r(this,Ce).blur(),o(this,P,In).call(this,r(this,Ce),"-1"),o(this,P,In).call(this,r(this,ai),"-1"),r(this,Es).querySelectorAll(".option").forEach(s=>{o(this,P,In).call(this,s,"-1")}),r(this,qt).setAttribute("aria-expanded","false"),o(this,P,Rt).call(this,r(this,Es),"aria-hidden",!0),o(this,P,Rt).call(this,r(this,Ce),"aria-hidden",!0))}set disabled(e){String(e).toLowerCase()==="true"?(r(this,de).classList.add("disabled"),r(this,he).disabled=!0,r(this,ks)&&o(this,P,Rt).call(this,r(this,js),"tabindex","-1"),o(this,P,Rt).call(this,r(this,qt),"aria-label","Country Field disabled"),o(this,P,Rt).call(this,r(this,qt),"tabindex","-1"),this.setMenu({open:!1}),r(this,jr).forEach(({selector:s,eventType:i,cb:n})=>{s.removeEventListener(i,n)})):String(e).toLowerCase()==="false"&&(r(this,de).classList.remove("disabled"),r(this,he).removeAttribute("disabled"),o(this,P,Rt).call(this,r(this,qt),"tabindex","0"),r(this,ks)&&o(this,P,Rt).call(this,r(this,js),"tabindex","0"),o(this,P,Rt).call(this,r(this,qt),"aria-label",r(this,Fn)),o(this,P,Zc).call(this))}get disabled(){return r(this,he).disabled}set readonly(e){String(e).toLowerCase()==="true"?(r(this,de).classList.add("disabled"),r(this,he).readOnly=!0,o(this,P,Rt).call(this,r(this,qt),"tabindex","-1"),r(this,ks)&&o(this,P,Rt).call(this,r(this,js),"tabindex","-1"),this.setMenu({open:!1})):String(e).toLowerCase()==="false"&&(r(this,de).classList.remove("disabled"),r(this,he).removeAttribute("readonly"),r(this,ks)&&o(this,P,Rt).call(this,r(this,qt),"tabindex","0"),o(this,P,Rt).call(this,r(this,js),"tabindex","0"))}get readonly(){return r(this,he).readOnly}set value(e){r(this,he).value=e,o(this,P,Rt).call(this,r(this,he),"value",e)}get value(){const e=o(this,P,nl).call(this);return e.val||e.lbl}get selectedCountry(){return o(this,P,nl).call(this)}destroy(){r(this,Es).innerHTML="",this.value="",o(this,P,jf).call(this)}reset(e){T(this,Gr,!0),o(this,P,Jc).call(this),this.destroy(),this.init(),this.setSelectedCountryItem(e),T(this,Gr,!1)}}de=new WeakMap,he=new WeakMap,qt=new WeakMap,Zi=new WeakMap,Ar=new WeakMap,js=new WeakMap,Vl=new WeakMap,zl=new WeakMap,Ce=new WeakMap,ai=new WeakMap,Qa=new WeakMap,Es=new WeakMap,Ci=new WeakMap,bs=new WeakMap,Dn=new WeakMap,ks=new WeakMap,Qi=new WeakMap,Ja=new WeakMap,Ka=new WeakMap,to=new WeakMap,Mr=new WeakMap,Fn=new WeakMap,Wl=new WeakMap,eo=new WeakMap,Nr=new WeakMap,Pr=new WeakMap,oi=new WeakMap,li=new WeakMap,Oe=new WeakMap,Is=new WeakMap,vs=new WeakMap,Dr=new WeakMap,so=new WeakMap,io=new WeakMap,Fr=new WeakMap,jr=new WeakMap,kr=new WeakMap,Gr=new WeakMap,P=new WeakSet,Cf=function(e){T(this,oi,e.document||document),T(this,li,e.window||window),T(this,so,e.fieldKey),T(this,Mr,e.defaultValue),T(this,Fn,e.placeholder),T(this,Wl,e.searchPlaceholder||"Search Country"),T(this,eo,e.noCountryFoundText||"No Country Found"),T(this,Pr,e.rowHeight||30),T(this,Nr,e.maxHeight||370),T(this,Dn,e.selectedFlagImage),T(this,ks,e.selectedCountryClearable),T(this,Qi,e.searchClearable),T(this,Ja,e.optionFlagImage),T(this,Ka,e.detectCountryByIp),T(this,to,e.detectCountryByGeo),T(this,Dr,e.assetsURL),T(this,kr,e.onChange),T(this,Is,e.attributes||{}),T(this,vs,e.classNames||{}),typeof e.options=="string"&&(e.options=o(this,P,Of).call(this,e.options)),T(this,Oe,e.options.filter(s=>!s.hide)),T(this,bs,r(this,Oe))},Of=function(e){const s=e.split("->");let i=r(this,li);return s.forEach(n=>{i=i[n]}),i},Zc=function(){o(this,P,fs).call(this,r(this,qt),"click",e=>{o(this,P,id).call(this,e)}),o(this,P,fs).call(this,r(this,qt),"keyup",e=>{o(this,P,id).call(this,e)}),o(this,P,fs).call(this,r(this,qt),"blur",e=>{o(this,P,Ff).call(this,e)}),o(this,P,fs).call(this,r(this,de),"keydown",e=>{o(this,P,Mf).call(this,e)}),r(this,Qi)&&o(this,P,fs).call(this,r(this,ai),"click",()=>{this.searchOptions("")}),o(this,P,fs).call(this,r(this,Ce),"keyup",e=>{o(this,P,Nf).call(this,e)})},$f=function(){const e=r(this,Oe).find(s=>{const i=r(this,Mr);return s.i===i?!0:s.val?s.val===i:s.lbl===i});e&&this.setSelectedCountryItem(e.i)},yf=function(){const e=r(this,he).name,i=decodeURIComponent(`${r(this,oi).URL}`.replace(/\+/g,"%20")).replace(new RegExp(`.*${e}=([^&]*).*|(.*)`),"$1");i&&o(this,P,Qc).call(this,"",i)},Ve=function(e){return r(this,de).querySelector(e)},fs=function(e,s,i){e&&(e.addEventListener(s,i),r(this,jr).push({selector:e,eventType:s,cb:i}))},Lf=function(){const{protocol:e}=r(this,li).location;fetch(`${e}//www.cloudflare.com/cdn-cgi/trace`).then(s=>s.text()).then(s=>{const i=s.trim().split(`
41 `).reduce((n,a)=>{const[l,c]=a.split("=");return n[l]=c,n},{});this.setSelectedCountryItem(i==null?void 0:i.loc)})},Af=function(){navigator.geolocation.getCurrentPosition(e=>{const{latitude:s,longitude:i}=e.coords,{protocol:n}=r(this,li).location,a=n==="https:"?`${n}//secure`:`${n}//api`;fetch(`${a}.geonames.org/countryCodeJSON?username=bitcodezoho1&lat=${s}&lng=${i}`).then(l=>l.json()).then(l=>{this.setSelectedCountryItem(l.countryCode)})})},Mf=function(e){var a,l;e.stopPropagation();const s=r(this,oi).activeElement;let i=null;if(o(this,P,rr).call(this)){const c=Number(s.dataset.index||-1);if(e.key==="ArrowDown"||!e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,Ce))i=o(this,P,Ve).call(this,".option:not(.disabled-opt)");else if(s.classList.contains("option")){const d=o(this,P,il).call(this,c,"next"),h=o(this,P,Ta).call(this,d);h?i=h:d+1<r(this,bs).length&&((a=this.virtualOptionList)==null||a.scrollToIndex(d),setTimeout(()=>{const p=o(this,P,Ta).call(this,d);p&&p.focus()},50))}}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,Ce))i=r(this,qt),o(this,P,rr).call(this)&&this.setMenu({open:!1});else if(s.classList.contains("option")){const d=o(this,P,il).call(this,c,"previous"),h=o(this,P,Ta).call(this,d);h?i=h:d>0?((l=this.virtualOptionList)==null||l.scrollToIndex(d),setTimeout(()=>{const p=o(this,P,Ta).call(this,d);p&&p.focus()},50)):h||(i=r(this,Ce))}}else e.key==="Escape"&&this.setMenu({open:!1})}else if(e.key>="a"&&e.key<="z"){clearTimeout(r(this,io)),T(this,Fr,r(this,Fr)+e.key),T(this,io,setTimeout(()=>{T(this,Fr,"")},300));const c=r(this,Oe).find(d=>!d.disabled&&d.lbl.toLowerCase().startsWith(r(this,Fr)));c&&this.setSelectedCountryItem(c.i)}else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const c=o(this,P,Kc).call(this),d=e.key==="ArrowDown"?"next":"previous",h=o(this,P,il).call(this,c,d);h>-1&&h<r(this,Oe).length&&(this.value=r(this,Oe)[h].val||r(this,Oe)[h].lbl,o(this,P,xa).call(this,r(this,he),"blur"))}i&&i.focus()},Ta=function(e){return o(this,P,Ve).call(this,`.${this.fieldKey}-option-list .option[data-index="${e}"]`)},il=function(e=-1,s){if(s==="next"){const i=r(this,Oe).length;for(let n=e+1;n<i;n+=1)if(!r(this,Oe)[n].disabled)return n}else if(s==="previous"){for(let i=e-1;i>=0;i-=1)if(!r(this,Oe)[i].disabled)return i}},Qc=function(e,s){const i=r(this,Oe).find(n=>n.i===s||n.val===s||n.lbl===s);i&&e!==s&&this.setSelectedCountryItem(i.i),typeof bit_conditionals!="undefined"&&bit_conditionals({target:r(this,he)})},Jc=function(e){e==null||e.stopPropagation(),T(this,Ci,""),r(this,Dn)&&(r(this,Zi).src=r(this,Vl)),o(this,P,Ra).call(this,r(this,Ar),r(this,Fn)),r(this,ks)&&o(this,P,ms).call(this,r(this,js),"display","none"),o(this,P,Rt).call(this,r(this,qt),"aria-label","Selected country cleared"),r(this,Gr)||r(this,qt).focus(),this.setMenu({open:!1}),this.value="",o(this,P,xa).call(this,r(this,he),"blur"),setTimeout(()=>{o(this,P,Rt).call(this,r(this,qt),"aria-label",r(this,Fn))},100)},xa=function(e,s){const i=new Event(s);e.dispatchEvent(i)},Kc=function(){return r(this,bs).findIndex(e=>e.i===r(this,Ci))},nl=function(){return r(this,Oe).find(e=>e.i===r(this,Ci))},Sa=function(e){return r(this,oi).createElement(e)},_i=function(e,s){e.classList.add(s)},Ra=function(e,s){e.textContent=s},In=function(e,s){e&&(e.tabIndex=s)},Rt=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},ms=function(e,s,i){e&&e.style.setProperty(s,i,"important")},td=function(){if(!o(this,P,rr).call(this))return;o(this,P,ed).call(this);const e=o(this,P,Kc).call(this),s=o(this,P,Ve).call(this,`.option[data-index="${e}"]`);s&&s.scrollIntoView({block:"nearest",inline:"nearest"})},Ca=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>o(this,P,_i).call(this,e,i))},Oa=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)o(this,P,Rt).call(this,e,s[n].key,s[n].value)},aT=function(){const e=o(this,P,Ve).call(this,".option");if(!e)return;const s=r(this,li).getComputedStyle(e),i=parseFloat(s.marginTop)+parseFloat(s.marginBottom),n=e.offsetHeight+i||0;n!==r(this,Pr)&&(T(this,Pr,n),r(this,Es).innerHTML="",o(this,P,ed).call(this))},ed=function(){r(this,Es).innerHTML="";const e=r(this,bs).map((s,i)=>{const n=o(this,P,Sa).call(this,"li");if(o(this,P,Rt).call(this,n,"data-key",s.i),o(this,P,Rt).call(this,n,"data-index",i),"option"in r(this,Is)){const c=r(this,Is).option;o(this,P,Oa).call(this,n,c)}if(o(this,P,Rt).call(this,n,"data-dev-option",this.fieldKey),!s.i)return o(this,P,Ra).call(this,n,s.lbl),o(this,P,_i).call(this,n,"opt-not-found"),n;if(o(this,P,_i).call(this,n,"option"),"option"in r(this,vs)){const c=r(this,vs).option;c&&o(this,P,Ca).call(this,n,c)}const a=o(this,P,Sa).call(this,"span");if(o(this,P,_i).call(this,a,"opt-lbl-wrp"),"opt-lbl-wrp"in r(this,vs)){const c=r(this,vs)["opt-lbl-wrp"];c&&o(this,P,Ca).call(this,a,c)}if("opt-lbl-wrp"in r(this,Is)){const c=r(this,Is)["opt-lbl-wrp"];o(this,P,Oa).call(this,a,c)}if(r(this,Ja)){const c=o(this,P,Sa).call(this,"img");if("opt-icn"in r(this,Is)){const d=r(this,Is)["opt-icn"];d&&o(this,P,Oa).call(this,c,d)}if(o(this,P,_i).call(this,c,"opt-icn"),"opt-icn"in r(this,vs)){const d=r(this,vs)["opt-icn"];d&&o(this,P,Ca).call(this,c,d)}c.src=`${r(this,Dr)}${s.img}`,c.alt=`${s.lbl} flag image`,c.loading="lazy",o(this,P,Rt).call(this,c,"aria-hidden",!0),a.append(c)}const l=o(this,P,Sa).call(this,"span");if("opt-lbl"in r(this,Is)){const c=r(this,Is)["opt-lbl"];o(this,P,Oa).call(this,l,c)}if(o(this,P,_i).call(this,l,"opt-lbl"),"opt-lbl"in r(this,vs)){const c=r(this,vs)["opt-lbl"];c&&o(this,P,Ca).call(this,l,c)}return o(this,P,Ra).call(this,l,s.lbl),a.append(l),o(this,P,In).call(this,n,o(this,P,rr).call(this)?"0":"-1"),o(this,P,Rt).call(this,n,"role","option"),o(this,P,Rt).call(this,n,"aria-posinset",i+1),o(this,P,Rt).call(this,n,"aria-setsize",r(this,bs).length),o(this,P,fs).call(this,n,"click",c=>{this.setSelectedCountryItem(c.currentTarget.dataset.key)}),o(this,P,fs).call(this,n,"keyup",c=>{c.key==="Enter"&&this.setSelectedCountryItem(c.currentTarget.dataset.key)}),s.disabled&&o(this,P,_i).call(this,n,"disabled-opt"),n.append(a),r(this,Ci)===s.i?(o(this,P,_i).call(this,n,"selected-opt"),o(this,P,Rt).call(this,n,"aria-selected",!0)):o(this,P,Rt).call(this,n,"aria-selected",!1),n});r(this,Es).append(...e)},Nf=function(e){var s;if(e.stopPropagation(),e.key==="Enter"&&r(this,bs).length){const i=(s=r(this,bs))==null?void 0:s[0].i;i&&(this.setSelectedCountryItem(i),this.searchOptions(""))}else this.searchOptions(e.target.value)},Pf=function(e){r(this,Ce).value=e},sd=function(e){r(this,de).contains(e.target)||this.setMenu({open:!1})},rr=function(){return r(this,de).classList.contains("menu-open")},Df=function(){const e=r(this,li),s=r(this,qt).getBoundingClientRect(),i=s.top,n=e.innerHeight-s.bottom;n<i&&n<r(this,Nr)?(o(this,P,ms).call(this,r(this,de),"flex-direction","column-reverse"),o(this,P,ms).call(this,r(this,de),"bottom","0%")):(o(this,P,ms).call(this,r(this,de),"flex-direction","column"),o(this,P,ms).call(this,r(this,de),"bottom","auto"))},id=function(e){e.code==="Space"&&(r(this,Ce).focus(),this.setMenu({open:!0})),e.type==="click"&&(o(this,P,rr).call(this)?this.setMenu({open:!1}):(r(this,Ce).focus(),this.setMenu({open:!0})))},Ff=function(e){var s;(s=e.target.parentElement)!=null&&s.contains(e.relatedTarget)||o(this,P,xa).call(this,r(this,he),"blur")},jf=function(){r(this,jr).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};function gc(t,e,s,i=0){const n=new MutationObserver(l=>{l.forEach(c=>{if(c.attributeName===e){const{oldValue:d}=c,h=c.target[e];typeof s=="function"&&setTimeout(s.call(this,d,h),i)}})}),a={attributes:!0,attributeOldValue:!0,attributeFilter:[e]};return n.observe(t,a),n}var ju=11;function oT(t,e){var s=e.attributes,i,n,a,l,c;if(!(e.nodeType===ju||t.nodeType===ju)){for(var d=s.length-1;d>=0;d--)i=s[d],n=i.name,a=i.namespaceURI,l=i.value,a?(n=i.localName||n,c=t.getAttributeNS(a,n),c!==l&&(i.prefix==="xmlns"&&(n=i.name),t.setAttributeNS(a,n,l))):(c=t.getAttribute(n),c!==l&&t.setAttribute(n,l));for(var h=t.attributes,p=h.length-1;p>=0;p--)i=h[p],n=i.name,a=i.namespaceURI,a?(n=i.localName||n,e.hasAttributeNS(a,n)||t.removeAttributeNS(a,n)):e.hasAttribute(n)||t.removeAttribute(n)}}var Zo,lT="http://www.w3.org/1999/xhtml",He=typeof document=="undefined"?void 0:document,cT=!!He&&"content"in He.createElement("template"),dT=!!He&&He.createRange&&"createContextualFragment"in He.createRange();function hT(t){var e=He.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function uT(t){Zo||(Zo=He.createRange(),Zo.selectNode(He.body));var e=Zo.createContextualFragment(t);return e.childNodes[0]}function pT(t){var e=He.createElement("body");return e.innerHTML=t,e.childNodes[0]}function fT(t){return t=t.trim(),cT?hT(t):dT?uT(t):pT(t)}function Qo(t,e){var s=t.nodeName,i=e.nodeName,n,a;return s===i?!0:(n=s.charCodeAt(0),a=i.charCodeAt(0),n<=90&&a>=97?s===i.toUpperCase():a<=90&&n>=97?i===s.toUpperCase():!1)}function mT(t,e){return!e||e===lT?He.createElement(t):He.createElementNS(e,t)}function gT(t,e){for(var s=t.firstChild;s;){var i=s.nextSibling;e.appendChild(s),s=i}return e}function Cc(t,e,s){t[s]!==e[s]&&(t[s]=e[s],t[s]?t.setAttribute(s,""):t.removeAttribute(s))}var ku={OPTION:function(t,e){var s=t.parentNode;if(s){var i=s.nodeName.toUpperCase();i==="OPTGROUP"&&(s=s.parentNode,i=s&&s.nodeName.toUpperCase()),i==="SELECT"&&!s.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),s.selectedIndex=-1)}Cc(t,e,"selected")},INPUT:function(t,e){Cc(t,e,"checked"),Cc(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var s=e.value;t.value!==s&&(t.value=s);var i=t.firstChild;if(i){var n=i.nodeValue;if(n==s||!s&&n==t.placeholder)return;i.nodeValue=s}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var s=-1,i=0,n=t.firstChild,a,l;n;)if(l=n.nodeName&&n.nodeName.toUpperCase(),l==="OPTGROUP")a=n,n=a.firstChild,n||(n=a.nextSibling,a=null);else{if(l==="OPTION"){if(n.hasAttribute("selected")){s=i;break}i++}n=n.nextSibling,!n&&a&&(n=a.nextSibling,a=null)}t.selectedIndex=s}}},_a=1,Gu=11,Bu=3,Uu=8;function Wi(){}function ET(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function bT(t){return function(s,i,n){if(n||(n={}),typeof i=="string")if(s.nodeName==="#document"||s.nodeName==="HTML"){var a=i;i=He.createElement("html"),i.innerHTML=a}else if(s.nodeName==="BODY"){var l=i;i=He.createElement("html"),i.innerHTML=l;var c=i.querySelector("body");c&&(i=c)}else i=fT(i);else i.nodeType===Gu&&(i=i.firstElementChild);var d=n.getNodeKey||ET,h=n.onBeforeNodeAdded||Wi,p=n.onNodeAdded||Wi,f=n.onBeforeElUpdated||Wi,m=n.onElUpdated||Wi,E=n.onBeforeNodeDiscarded||Wi,g=n.onNodeDiscarded||Wi,I=n.onBeforeElChildrenUpdated||Wi,w=n.skipFromChildren||Wi,S=n.addChild||function(U,Z){return U.appendChild(Z)},_=n.childrenOnly===!0,R=Object.create(null),L=[];function M(U){L.push(U)}function D(U,Z){if(U.nodeType===_a)for(var J=U.firstChild;J;){var it=void 0;Z&&(it=d(J))?M(it):(g(J),J.firstChild&&D(J,Z)),J=J.nextSibling}}function G(U,Z,J){E(U)!==!1&&(Z&&Z.removeChild(U),g(U),D(U,J))}function C(U){if(U.nodeType===_a||U.nodeType===Gu)for(var Z=U.firstChild;Z;){var J=d(Z);J&&(R[J]=Z),C(Z),Z=Z.nextSibling}}C(s);function k(U){p(U);for(var Z=U.firstChild;Z;){var J=Z.nextSibling,it=d(Z);if(it){var at=R[it];at&&Qo(Z,at)?(Z.parentNode.replaceChild(at,Z),W(at,Z)):k(Z)}else k(Z);Z=J}}function q(U,Z,J){for(;Z;){var it=Z.nextSibling;(J=d(Z))?M(J):G(Z,U,!0),Z=it}}function W(U,Z,J){var it=d(Z);if(it&&delete R[it],!J){var at=f(U,Z);if(at===!1||(at instanceof HTMLElement&&(U=at,C(U)),t(U,Z),m(U),I(U,Z)===!1))return}U.nodeName!=="TEXTAREA"?V(U,Z):ku.TEXTAREA(U,Z)}function V(U,Z){var J=w(U,Z),it=Z.firstChild,at=U.firstChild,vt,_t,ct,ut,Et;t:for(;it;){for(ut=it.nextSibling,vt=d(it);!J&&at;){if(ct=at.nextSibling,it.isSameNode&&it.isSameNode(at)){it=ut,at=ct;continue t}_t=d(at);var St=at.nodeType,It=void 0;if(St===it.nodeType&&(St===_a?(vt?vt!==_t&&((Et=R[vt])?ct===Et?It=!1:(U.insertBefore(Et,at),_t?M(_t):G(at,U,!0),at=Et,_t=d(at)):It=!1):_t&&(It=!1),It=It!==!1&&Qo(at,it),It&&W(at,it)):(St===Bu||St==Uu)&&(It=!0,at.nodeValue!==it.nodeValue&&(at.nodeValue=it.nodeValue))),It){it=ut,at=ct;continue t}_t?M(_t):G(at,U,!0),at=ct}if(vt&&(Et=R[vt])&&Qo(Et,it))J||S(U,Et),W(Et,it);else{var oe=h(it);oe!==!1&&(oe&&(it=oe),it.actualize&&(it=it.actualize(U.ownerDocument||He)),S(U,it),k(it))}it=ut,at=ct}q(U,at,_t);var ys=ku[U.nodeName];ys&&ys(U,Z)}var X=s,j=X.nodeType,K=i.nodeType;if(!_){if(j===_a)K===_a?Qo(s,i)||(g(s),X=gT(s,mT(i.nodeName,i.namespaceURI))):X=i;else if(j===Bu||j===Uu){if(K===j)return X.nodeValue!==i.nodeValue&&(X.nodeValue=i.nodeValue),X;X=i}}if(X===i)g(s);else{if(i.isSameNode&&i.isSameNode(X))return;if(W(X,i,_),L)for(var B=0,H=L.length;B<H;B++){var tt=R[L[B]];tt&&G(tt,tt.parentNode,!1)}}return!_&&X!==s&&s.parentNode&&(X.actualize&&(X=X.actualize(s.ownerDocument||He)),s.parentNode.replaceChild(X,s)),X}}var IT=bT(oT);function vT(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var wT="start",_T="center",TT="end",xT=(function(){function t(e){var s=e.itemCount,i=e.itemSizeGetter,n=e.estimatedItemSize;vT(this,t),this._itemSizeGetter=i,this._itemCount=s,this._estimatedItemSize=n,this._itemSizeAndPositionData={},this._lastMeasuredIndex=-1}return t.prototype.getLastMeasuredIndex=function(){return this._lastMeasuredIndex},t.prototype.getSizeAndPositionForIndex=function(s){if(s<0||s>=this._itemCount)throw Error("Requested index "+s+" is outside of range 0.."+this._itemCount);if(s>this._lastMeasuredIndex){for(var i=this.getSizeAndPositionOfLastMeasuredItem(),n=i.offset+i.size,a=this._lastMeasuredIndex+1;a<=s;a++){var l=this._itemSizeGetter({index:a});if(l==null||isNaN(l))throw Error("Invalid size returned for index "+a+" of value "+l);this._itemSizeAndPositionData[a]={offset:n,size:l},n+=l}this._lastMeasuredIndex=s}return this._itemSizeAndPositionData[s]},t.prototype.getSizeAndPositionOfLastMeasuredItem=function(){return this._lastMeasuredIndex>=0?this._itemSizeAndPositionData[this._lastMeasuredIndex]:{offset:0,size:0}},t.prototype.getTotalSize=function(){var s=this.getSizeAndPositionOfLastMeasuredItem();return s.offset+s.size+(this._itemCount-this._lastMeasuredIndex-1)*this._estimatedItemSize},t.prototype.getUpdatedOffsetForIndex=function(s){var i=s.align,n=i===void 0?wT:i,a=s.containerSize,l=s.targetIndex;if(a<=0)return 0;var c=this.getSizeAndPositionForIndex(l),d=c.offset,h=d-a+c.size,p=void 0;switch(n){case TT:p=h;break;case _T:p=d-(a-c.size)/2;break;default:p=d;break}var f=this.getTotalSize();return Math.max(0,Math.min(f-a,p))},t.prototype.getVisibleRange=function(s){var i=s.containerSize,n=s.offset,a=s.overscanCount,l=this.getTotalSize();if(l===0)return{};var c=n+i,d=this._findNearestItem(n),h=d,p=this.getSizeAndPositionForIndex(d);for(n=p.offset+p.size;n<c&&h<this._itemCount-1;)h++,n+=this.getSizeAndPositionForIndex(h).size;return a&&(d=Math.max(0,d-a),h=Math.min(h+a,this._itemCount)),{start:d,stop:h}},t.prototype.resetItem=function(s){this._lastMeasuredIndex=Math.min(this._lastMeasuredIndex,s-1)},t.prototype._binarySearch=function(s){for(var i=s.low,n=s.high,a=s.offset,l=void 0,c=void 0;i<=n;){if(l=i+Math.floor((n-i)/2),c=this.getSizeAndPositionForIndex(l).offset,c===a)return l;c<a?i=l+1:c>a&&(n=l-1)}if(i>0)return i-1},t.prototype._exponentialSearch=function(s){for(var i=s.index,n=s.offset,a=1;i<this._itemCount&&this.getSizeAndPositionForIndex(i).offset<n;)i+=a,a*=2;return this._binarySearch({high:Math.min(i,this._itemCount-1),low:Math.floor(i/2),offset:n})},t.prototype._findNearestItem=function(s){if(isNaN(s))throw Error("Invalid offset "+s+" specified");s=Math.max(0,s);var i=this.getSizeAndPositionOfLastMeasuredItem(),n=Math.max(0,this._lastMeasuredIndex);return i.offset>=s?this._binarySearch({high:n,low:0,offset:s}):this._exponentialSearch({index:n,offset:s})},t})();function ST(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var RT="position:relative; overflow:hidden; width:100%; min-height:100%; will-change: transform;",CT="position:absolute; top:0; left:0; height:100%; width:100%; overflow:visible;",xh=(function(){function t(e,s){var i=this;ST(this,t),this.getRowHeight=function(n){var a=n.index,l=i.options.rowHeight;return typeof l=="function"?l(a):Array.isArray(l)?l[a]:l},this.container=e,this.options=s,this.state={},this._initializeSizeAndPositionManager(s.rowCount),this.render=this.render.bind(this),this.handleScroll=this.handleScroll.bind(this),this.componentDidMount()}return t.prototype.componentDidMount=function(){var s=this,i=this.options,n=i.onMount,a=i.initialScrollTop,l=i.initialIndex,c=i.height,d=a||l!=null&&this.getRowOffset(l)||0,h=this.inner=document.createElement("div"),p=this.content=document.createElement("div");h.setAttribute("style",RT),p.setAttribute("style",CT),h.appendChild(p),this.container.appendChild(h),this.setState({offset:d,height:c},function(){d&&(s.container.scrollTop=d),s.container.addEventListener("scroll",s.handleScroll),typeof n=="function"&&n()})},t.prototype._initializeSizeAndPositionManager=function(s){this._sizeAndPositionManager=new xT({itemCount:s,itemSizeGetter:this.getRowHeight,estimatedItemSize:this.options.estimatedRowHeight||100})},t.prototype.setState=function(){var s=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments[1];this.state=Object.assign(this.state,i),requestAnimationFrame(function(){s.render(),typeof n=="function"&&n()})},t.prototype.resize=function(s,i){this.setState({height:s},i)},t.prototype.handleScroll=function(s){var i=this.options.onScroll,n=this.container.scrollTop;this.setState({offset:n}),typeof i=="function"&&i(n,s)},t.prototype.getRowOffset=function(s){var i=this._sizeAndPositionManager.getSizeAndPositionForIndex(s),n=i.offset;return n},t.prototype.scrollToIndex=function(s,i){var n=this.state.height,a=this._sizeAndPositionManager.getUpdatedOffsetForIndex({align:i,containerSize:n,targetIndex:s});this.container.scrollTop=a},t.prototype.setRowCount=function(s){this._initializeSizeAndPositionManager(s),this.render()},t.prototype.onRowsRendered=function(s){var i=this.options.onRowsRendered;typeof i=="function"&&i(s)},t.prototype.destroy=function(){this.container.removeEventListener("scroll",this.handleScroll),this.container.innerHTML=""},t.prototype.render=function(){for(var s=this.options,i=s.overscanCount,n=s.renderRow,a=this.state,l=a.height,c=a.offset,d=c===void 0?0:c,h=this._sizeAndPositionManager.getVisibleRange({containerSize:l,offset:d,overscanCount:i}),p=h.start,f=h.stop,m=document.createDocumentFragment(),E=p;E<=f;E++)m.appendChild(n(E));this.inner.style.height=this._sizeAndPositionManager.getTotalSize()+"px",this.content.style.top=this.getRowOffset(p)+"px",IT(this.content,m,{childrenOnly:!0,getNodeKey:function(I){return I.nodeIndex}}),this.onRowsRendered({startIndex:p,stopIndex:f})},t})();const OT=({fieldKey:t,formID:e,attr:s,styleClasses:i})=>{const n=F.useRef(null),a=F.useRef(null),c=et(jt)[t],d=et(Mo),{options:h,ph:p}=c;return F.useEffect(()=>{const f=document.getElementById("bit-grid-layout").contentWindow;n!=null&&n.current||(n.current=Gt(`.${t}-country-fld-wrp`));const m=a.current,E=n.current;m&&E&&"destroy"in m&&m.destroy();const{selectedFlagImage:g,selectedCountryClearable:I,searchClearable:w,optionFlagImage:S,detectCountryByIp:_,detectCountryByGeo:R,defaultValue:L,searchPlaceholder:M,noCountryFoundText:D}=c.config;f.bit_virtualized_list||(f.bit_virtualized_list=xh),f.observeElm||(f.observeElm=gc);const G={fieldKey:t,selectedFlagImage:g,selectedCountryClearable:I,searchClearable:w,optionFlagImage:No?S:!1,detectCountryByIp:_,detectCountryByGeo:R,defaultValue:L,placeholder:p,searchPlaceholder:M,noCountryFoundText:D,options:h,assetsURL:`${d.rootURL}/static/countries/`,document:document.getElementById("bit-grid-layout").contentDocument,window:f,attributes:{option:Lt(t,"option"),"opt-lbl-wrp":Lt(t,"opt-lbl-wrp"),"opt-icn":Lt(t,"opt-icn"),"opt-lbl":Lt(t,"opt-lbl")},classNames:{option:x(t,"option"),"opt-lbl-wrp":x(t,"opt-lbl-wrp"),"opt-icn":x(t,"opt-icn"),"opt-lbl":x(t,"opt-lbl")}};a.current=new rT(E,G)},[c]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:i}),u.jsx(At,{formID:e,fieldKey:t,fieldData:s,children:u.jsx("div",{className:`${t}-country-fld-container`,children:u.jsxs("div",A(b({"data-dev-country-fld-wrp":t,className:`${t}-country-fld-wrp ${x(t,"country-fld-wrp")} ${c.valid.disabled?"disabled":""} ${c.valid.readonly?"readonly":""}`,ref:n},N(t,"country-fld-wrp")),{children:[u.jsx("input",b(b({name:"country-name",type:"hidden",className:`${t}-country-hidden-input`},"disabled"in c.valid&&{disabled:c.valid.disabled}),"readonly"in c.valid&&{readOnly:c.valid.readonly})),u.jsxs("div",{"data-testid":`${t}-dpd-wrp`,className:`${t}-dpd-wrp`,"aria-live":"assertive","aria-label":"Select a Country",role:"combobox","aria-expanded":"false",tabIndex:c.valid.disabled?"-1":"0",children:[u.jsxs("div",{className:`${t}-selected-country-wrp`,children:[c.config.selectedFlagImage&&u.jsx("img",b({"data-dev-selected-country-img":t,className:`${t}-selected-country-img ${x(t,"selected-country-img")}`,"aria-hidden":"true",alt:"selected country flag",src:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="},N(t,"selected-country-img"))),u.jsx("span",{"data-testid":`${t}-slctd-cntry-lbl`,"data-dev-selected-country-lbl":t,className:`${t}-selected-country-lbl`,children:p})]}),u.jsxs("div",{className:`${t}-dpd-btn-wrp`,children:[c.config.selectedCountryClearable&&u.jsx("button",A(b({"data-testid":`${t}-clr-slctd-cntry-btn`,type:"button",title:"Clear selected country value","data-dev-inp-clr-btn":t,className:`${t}-inp-clr-btn ${x(t,"inp-clr-btn")}`},N(t,"inp-clr-btn")),{children:u.jsxs("svg",{width:"15",height:"15",role:"img",title:"Cross icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})),u.jsx("div",{className:`${t}-dpd-down-btn`,children:u.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",title:"Cross icon",role:"img",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})]}),u.jsx("div",A(b({className:`${t}-option-wrp ${x(t,"option-wrp")}`,"data-dev-option-wrp":t},N(t,"option-search-wrp")),{children:u.jsxs("div",{className:`${t}-option-inner-wrp`,children:[u.jsxs("div",{className:`${t}-option-search-wrp`,"data-dev-option-search-wrp":t,children:[u.jsx("input",b({"data-testid":`${t}-opt-srch-inp`,type:"search","data-dev-opt-search-input":t,className:`${t}-opt-search-input ${x(t,"opt-search-input")}`,placeholder:c.config.searchPlaceholder,autoComplete:"country-name",tabIndex:"-1"},N(t,"opt-search-input"))),u.jsxs("svg",A(b({"data-dev-opt-search-icn":t,className:`${t}-opt-search-icn ${x(t,"opt-search-icn")}`,"aria-hidden":"true",width:"22",height:"22",role:"img",title:"Search icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},N(t,"opt-search-icn")),{children:[u.jsx("circle",{cx:"11",cy:"11",r:"8"}),u.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})),c.config.searchClearable&&u.jsx("button",A(b({"data-testid":`${t}-srch-clr-btn`,type:"button",title:"Clear search","data-dev-search-clear-btn":t,className:`${t}-search-clear-btn ${x(t,"search-clear-btn")}`,tabIndex:"-1"},N(t,"search-clear-btn")),{children:u.jsxs("svg",{width:"13",height:"13",role:"img",title:"Cross icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}))]}),u.jsx("ul",A(b({className:`${t}-option-list ${x(t,"option-list")}`,tabIndex:"-1",role:"listbox","aria-label":"country list","data-dev-option-list":t},N(t,"option-list")),{children:u.jsxs("li",{className:"option",children:[u.jsx("span",{className:"opt-prefix",children:"Prefix"}),u.jsxs("span",{className:"opt-lbl-wrp",children:[u.jsx("img",{className:"opt-icn",src:"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>",alt:"Placeholder"}),u.jsx("span",{className:"opt-lbl",children:"Option"})]}),u.jsx("span",{className:"opt-suffix",children:"Suffix"})]})}))]})}))]}))})})]})};var Hl,$e,ue,Oi,ci,no,Br,$i,ql,ze,ro,Nt,di,hi,ao,jn,Gs,yi,Ji,Ur,st,oo,Vr,lo,y,kf,Gf,nd,rl,rd,Bf,Uf,Vf,zf,al,Te,Xe,Wf,Hf,$a,qf,ya,ol,ad,ll,od,Yf,ld,cd,ar,Ms,cl,Tt,or,lr,Ze,yT,dd,hd,ud,Xf,Zf,Qf,cr,Jf,pd,Kf;class $T{constructor(e,s){O(this,y);O(this,Hl,"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>");O(this,$e,null);O(this,ue,null);O(this,Oi,null);O(this,ci,null);O(this,no,null);O(this,Br,null);O(this,$i,null);O(this,ql,null);O(this,ze,null);O(this,ro,null);O(this,Nt,null);O(this,di,null);O(this,hi,null);O(this,ao,30);O(this,jn,!1);O(this,Gs,[]);O(this,yi);O(this,Ji,{});O(this,Ur,"");O(this,st,{maxHeight:370,searchCurrencyPlaceholder:"Search Currency",noCurrencyFoundText:"No Currency Found",selectedCurrencyClearable:!0,searchClearable:!0,selectedFlagImage:!1,defaultCurrencyKey:"",defaultValue:"",optionFlagImage:!1,inputFormatOptions:{formatter:"browser",showCurrencySymbol:!0,decimalSeparator:"."},valueFormatOptions:{formatter:"browser",showCurrencySymbol:!0,decimalSeparator:"."},attributes:{},classNames:{},assetsURL:""});O(this,oo,null);O(this,Vr,"");O(this,lo,[]);Object.assign(r(this,st),s),T(this,Ji,s.window?s.window:window),T(this,yi,s.document?s.document:document),typeof e=="string"?T(this,$e,r(this,yi).querySelector(e)):T(this,$e,e),typeof r(this,st).options=="string"&&(r(this,st).options=o(this,y,kf).call(this,r(this,st).options)),r(this,st).options=r(this,st).options.filter(i=>!i.hide),T(this,Gs,[...r(this,st).options]),this.fieldKey=r(this,st).fieldKey,T(this,Ur,s.assetsURL),this.init()}init(){T(this,ro,o(this,y,Te).call(this,`.${this.fieldKey}-currency-inner-wrp`)),T(this,Nt,o(this,y,Te).call(this,`.${this.fieldKey}-currency-amount-input`)),T(this,ue,o(this,y,Te).call(this,`.${this.fieldKey}-currency-hidden-input`)),T(this,Oi,o(this,y,Te).call(this,`.${this.fieldKey}-input-clear-btn`)),T(this,Br,o(this,y,Te).call(this,`.${this.fieldKey}-selected-currency-img`)),T(this,ql,o(this,y,Te).call(this,`.${this.fieldKey}-option-search-wrp`)),T(this,ze,o(this,y,Te).call(this,`.${this.fieldKey}-opt-search-input`)),T(this,ci,o(this,y,Te).call(this,`.${this.fieldKey}-dpd-wrp`)),T(this,no,o(this,y,Te).call(this,`.${this.fieldKey}-option-wrp`)),T(this,di,o(this,y,Te).call(this,`.${this.fieldKey}-search-clear-btn`)),T(this,hi,o(this,y,Te).call(this,`.${this.fieldKey}-option-list`)),this.setMenu({open:!1}),o(this,y,Xe).call(this,r(this,$e),"keydown",e=>{o(this,y,Hf).call(this,e)}),o(this,y,Xe).call(this,r(this,ci),"click",e=>{o(this,y,pd).call(this,e)}),o(this,y,Xe).call(this,r(this,ci),"keyup",e=>{o(this,y,pd).call(this,e)}),o(this,y,Xe).call(this,r(this,Nt),"focus",()=>{o(this,y,Gf).call(this)}),o(this,y,Xe).call(this,r(this,Nt),"blur",()=>{o(this,y,rl).call(this)}),o(this,y,Xe).call(this,r(this,Nt),"input",e=>{o(this,y,Yf).call(this,e)}),r(this,st).selectedCurrencyClearable&&o(this,y,Xe).call(this,r(this,Oi),"click",e=>{o(this,y,qf).call(this,e)}),r(this,Ji).observeElm(r(this,ue),"value",(e,s)=>{o(this,y,od).call(this,e,s)}),r(this,st).defaultValue&&o(this,y,Wf).call(this),!r(this,st).defaultValue&&r(this,st).defaultCurrencyKey&&this.setSelectedCurrencyItem(r(this,st).defaultCurrencyKey),o(this,y,Xe).call(this,r(this,hi),"scroll",e=>{e.stopPropagation()}),r(this,st).searchClearable&&(o(this,y,Ze).call(this,r(this,ze),"padding-right","35px"),o(this,y,Ze).call(this,r(this,di),"display","none"),o(this,y,Xe).call(this,r(this,di),"click",()=>{this.searchOptions("")})),r(this,ze).value="",o(this,y,Xe).call(this,r(this,ze),"keyup",e=>{o(this,y,Zf).call(this,e)})}setSelectedCurrencyItem(e){if(T(this,$i,e),!r(this,$i)){o(this,y,hd).call(this);return}const s=o(this,y,cd).call(this);s&&(r(this,st).selectedFlagImage&&(r(this,Br).src=`${r(this,Ur)}${s.img}`),this.setMenu({open:!1}),o(this,y,rl).call(this),r(this,jn)&&(!this.value&&r(this,Nt).focus(),T(this,jn,!1)))}isValidated(){return o(this,y,Qf).call(this,{target:r(this,Nt)})}searchOptions(e){o(this,y,Xf).call(this,e);let s=[];e?(s=r(this,st).options.filter(i=>{const n=e.toLowerCase(),a=(i.lbl||"").toLowerCase(),l=(i.val||"").toLowerCase(),c=(i.i||"").toLowerCase();if(a.includes(n)||l.includes(n)||c.includes(n))return!0}),s.length||(s=[{i:0,lbl:r(this,st).noCurrencyFoundText}]),T(this,Gs,s),r(this,st).searchClearable&&o(this,y,Ze).call(this,r(this,di),"display","grid")):(T(this,Gs,r(this,st).options),r(this,st).searchClearable&&o(this,y,Ze).call(this,r(this,di),"display","none")),o(this,y,ud).call(this)}setMenu({open:e}){o(this,y,Ze).call(this,r(this,no),"max-height",`${e?r(this,st).maxHeight:0}px`),e?(o(this,y,Jf).call(this),o(this,y,Ms).call(this,r(this,$e),"menu-open"),o(this,y,Xe).call(this,r(this,yi),"click",s=>o(this,y,ad).call(this,s)),o(this,y,Tt).call(this,r(this,ze),"tabindex",0),o(this,y,Tt).call(this,r(this,di),"tabindex",0),o(this,y,Tt).call(this,r(this,ci),"aria-expanded",!0),o(this,y,ud).call(this)):(r(this,$e).classList.remove("menu-open"),r(this,yi).removeEventListener("click",o(this,y,ad)),setTimeout(()=>{this.searchOptions("")},100),o(this,y,Tt).call(this,r(this,ze),"tabindex",-1),o(this,y,Tt).call(this,r(this,di),"tabindex",-1),r(this,hi).querySelectorAll(".option").forEach(s=>{o(this,y,Tt).call(this,s,"tabindex",-1)}),o(this,y,Tt).call(this,r(this,ci),"aria-expanded",!1))}set value(e){r(this,ue).value=e||"",o(this,y,Tt).call(this,r(this,ue),"value",e||"")}get value(){return r(this,ue).value}set disabled(e){String(e).toLowerCase()==="true"?(r(this,$e).classList.add("disabled"),r(this,ue).disabled=!0,o(this,y,Tt)&&o(this,y,Tt).call(this,r(this,ci),"aria-label","Dropdown disabled"),this.setMenu&&this.setMenu({open:!1})):String(e).toLowerCase()==="false"&&(r(this,$e).classList.remove("disabled"),r(this,ue).removeAttribute("disabled"),o(this,y,Tt)&&o(this,y,Tt).call(this,r(this,ci),"aria-label",r(this,st).placeholder||""))}get disabled(){return r(this,ue).disabled}destroy(){r(this,hi).innerHTML="",this.value=r(this,st).defaultValue,o(this,y,Kf).call(this)}reset(){o(this,y,hd).call(this),this.destroy(),this.init()}}Hl=new WeakMap,$e=new WeakMap,ue=new WeakMap,Oi=new WeakMap,ci=new WeakMap,no=new WeakMap,Br=new WeakMap,$i=new WeakMap,ql=new WeakMap,ze=new WeakMap,ro=new WeakMap,Nt=new WeakMap,di=new WeakMap,hi=new WeakMap,ao=new WeakMap,jn=new WeakMap,Gs=new WeakMap,yi=new WeakMap,Ji=new WeakMap,Ur=new WeakMap,st=new WeakMap,oo=new WeakMap,Vr=new WeakMap,lo=new WeakMap,y=new WeakSet,kf=function(e){const s=e.split("->");let i=r(this,Ji);return s.forEach(n=>{i=i[n]}),i},Gf=function(){o(this,y,Tt).call(this,r(this,Nt),"type","number"),r(this,Nt).value=r(this,Nt).dataset.numValue||""},nd=function(e,s=0){const i=Go(10,s||0);return Math.round(e*i)/i},rl=function(){o(this,y,Tt).call(this,r(this,Nt),"type","text");const e=Number(r(this,Nt).dataset.numValue);if(r(this,Nt).dataset.numValue===""||Number.isNaN(e)){r(this,Nt).value="",r(this,ue).value="",o(this,y,Tt).call(this,r(this,ue),"value",""),o(this,y,$a).call(this,r(this,ue),"blur");return}const{inputFormatOptions:s,valueFormatOptions:i}=r(this,st),n=o(this,y,rd).call(this,e,s);r(this,Nt).value=n,this.value=o(this,y,rd).call(this,e,i),o(this,y,$a).call(this,r(this,ue),"blur")},rd=function(e,s){const i=o(this,y,cd).call(this),{defaultCurrencyKey:n}=r(this,st),{formatter:a,roundToClosestInteger:l,showCurrencySymbol:c,currencyPosition:d,symbolPosition:h}=s,p=(i==null?void 0:i.i)||n;if(!p)return e;l&&(e=o(this,y,nd).call(this,e));let f="";a==="browser"?f=o(this,y,Uf).call(this,e,p,s):a==="custom"||!a?f=o(this,y,Vf).call(this,e,s):a==="none"&&(f=e);const m=a==="browser"?"":(i==null?void 0:i.symbol)||o(this,y,Bf).call(this,p);return h==="left-number"?f=`${m}${f}`:h==="right-number"&&(f=`${f}${m}`),c&&(d==="left"?f=`${c?`${p} `:""}${f}`:d==="right"&&(f=`${f}${c?` ${p}`:""}`)),h==="left-currency"?f=`${m}${f}`:h==="right-currency"&&(f=`${f}${m}`),f},Bf=function(e){var s;try{return((s=new Intl.NumberFormat(navigator.language,{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).formatToParts(0).find(n=>n.type==="currency"))==null?void 0:s.value)||""}catch(i){return""}},Uf=function(e,s,i){const{showCurrencySymbol:n,roundToClosestInteger:a}=i;return new Intl.NumberFormat(navigator.language,{style:"currency",currency:s}).formatToParts(e).map(d=>!n&&d.type==="currency"||a&&(d.type==="decimal"||d.type==="fraction")?"":d.value).join("")},Vf=function(e,s){const{decimalSeparator:i,roundToClosestFractionDigits:n,minimumFractionDigits:a=0,maximumFractionDigits:l=0,numberFormat:c=""}=s,[d]=c.split(i),[h,p=""]=e.toString().split("."),f=o(this,y,zf).call(this,h,d);let m=p;const E=m.length;if(E>0){const I=l>0,w=a>0;if(n&&m){let S;I&&E>l?S=l:w&&E<a?S=a:S=E,m=o(this,y,nd).call(this,+`0.${m}`,S).toString().replace("0.","")}I&&m&&(m=m.slice(0,l))}m.length<a&&(m=m.padEnd(a,"0"));let g="";return m?g=`${f}${i}${m}`:g=f,g},zf=function(e="",s=""){let i="",n=e.length-1;for(let a=s.length-1;a>=0;a--){const l=s[a],c=e[n];if(!c)break;l==="#"?(i=c+i,n--):i=l+i}return n>=0&&(i=e.substring(0,n+1)+i),i},al=function(e=""){const{decimalSeparator:s}=r(this,st).valueFormatOptions,i=new RegExp(`[^0-9${s}]`,"g");return e.replace(i,"")},Te=function(e){return r(this,$e).querySelector(e)},Xe=function(e,s,i){e&&(e.addEventListener(s,i),r(this,lo).push({selector:e,eventType:s,cb:i}))},Wf=function(){r(this,Nt).dataset.numValue=o(this,y,al).call(this,r(this,st).defaultValue),o(this,y,od).call(this,"",r(this,st).defaultValue),r(this,st).selectedCurrencyClearable&&o(this,y,Ze).call(this,r(this,Oi),"display","grid")},Hf=function(e){var a,l;const s=r(this,yi).activeElement;let i=null;const n=o(this,y,cr).call(this);if(e.target!==r(this,Nt)){if(n){const c=Number(s.dataset.index||-1);if(e.key==="ArrowDown"||!e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,ze))i=o(this,y,Te).call(this,".option:not(.disabled-opt)");else if(s.classList.contains("option")){const d=o(this,y,ol).call(this,c,"next"),h=o(this,y,ya).call(this,d);h?i=h:d+1<r(this,Gs).length&&((a=this.virtualOptionList)==null||a.scrollToIndex(d),setTimeout(()=>{const p=o(this,y,ya).call(this,d);p&&p.focus()},50))}}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,ze))i=r(this,Nt),o(this,y,cr).call(this)&&this.setMenu({open:!1});else if(s.classList.contains("option")){const d=o(this,y,ol).call(this,c,"previous"),h=o(this,y,ya).call(this,d);h?i=h:d>0?((l=this.virtualOptionList)==null||l.scrollToIndex(d),setTimeout(()=>{const p=o(this,y,ya).call(this,d);p&&p.focus()},50)):h||(i=r(this,ze))}}else e.key==="Escape"&&this.setMenu({open:!1})}else if(e.key>="a"&&e.key<="z"){clearTimeout(r(this,oo)),T(this,Vr,r(this,Vr)+e.key),T(this,oo,setTimeout(()=>{T(this,Vr,"")},300));const c=r(this,st).options.find(d=>!d.disabled&&d.lbl.toLowerCase().startsWith(r(this,Vr)));c&&this.setSelectedCurrencyItem(c.i)}else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const c=o(this,y,ld).call(this),d=e.key==="ArrowDown"?"next":"previous",h=o(this,y,ol).call(this,c,d);h>-1&&h<r(this,st).options.length&&(this.value=r(this,st).options[h].val)}i&&i.focus()}},$a=function(e,s){const i=new Event(s);e.dispatchEvent(i)},qf=function(){r(this,Nt).value="",o(this,y,Tt).call(this,r(this,ue),"value",""),o(this,y,Tt).call(this,r(this,Nt),"data-num-value",""),this.setSelectedCurrencyItem(r(this,st).defaultCurrencyKey),o(this,y,$a).call(this,r(this,Nt),"input"),this.value="",o(this,y,$a).call(this,r(this,ue),"blur")},ya=function(e){return o(this,y,Te).call(this,`.${this.fieldKey}-option-list .option[data-index="${e}"]`)},ol=function(e=-1,s){if(s==="next"){const i=r(this,st).options.length;for(let n=e+1;n<i;n++)if(!r(this,st).options[n].disabled)return n}else if(s==="previous"){for(let i=e-1;i>=0;i--)if(!r(this,st).options[i].disabled)return i}},ad=function(e){r(this,$e).contains(e.target)||this.setMenu({open:!1})},ll=function(e){var s;return((s=e==null?void 0:e.match(/[a-zA-Z]+/))==null?void 0:s[0])||""},od=function(e,s){const i=o(this,y,ll).call(this,s),n=r(this,st).options.find(a=>a.i===i);if((i&&n||!i&&r(this,st).defaultCurrencyKey)&&e!==s){const a=o(this,y,ll).call(this,r(this,st).defaultValue);this.setSelectedCurrencyItem(i||a||r(this,st).defaultCurrencyKey);const{decimalSeparator:l}=r(this,st).valueFormatOptions,[c,d]=s.split(l),h=o(this,y,al).call(this,c),p=o(this,y,al).call(this,d),f=p?`${h}.${p}`:h;o(this,y,Tt).call(this,r(this,Nt),"data-num-value",f),o(this,y,rl).call(this)}typeof bit_conditionals!="undefined"&&bit_conditionals({target:r(this,ue)})},Yf=function(e){const s=Number(e.target.value);o(this,y,Tt).call(this,r(this,Nt),"data-num-value",s||""),r(this,st).selectedCurrencyClearable&&(s?o(this,y,Ze).call(this,r(this,Oi),"display","grid"):o(this,y,Ze).call(this,r(this,Oi),"display","none"))},ld=function(){const e=r(this,Gs).findIndex(s=>s.i===r(this,$i));return e===-1?0:e},cd=function(){return r(this,st).options.find(e=>e.i===r(this,$i))},ar=function(e){return r(this,yi).createElement(e)},Ms=function(e,s){e.classList.add(s)},cl=function(e,s){e.textContent=s},Tt=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},or=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>o(this,y,Ms).call(this,e,i))},lr=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)o(this,y,Tt).call(this,e,s[n].key,s[n].value)},Ze=function(e,s,i){e==null||e.style.setProperty(s,i,"important")},yT=function(){const e=o(this,y,Te).call(this,".option");if(!e)return;const s=r(this,Ji).getComputedStyle(e),i=parseFloat(s.marginTop)+parseFloat(s.marginBottom),n=e.offsetHeight+i||0;n!==r(this,ao)&&(T(this,ao,n),r(this,hi).innerHTML="",o(this,y,dd).call(this))},dd=function(){r(this,hi).innerHTML="";const e=r(this,Gs).map((s,i)=>{const n=o(this,y,ar).call(this,"li");if(o(this,y,Tt).call(this,n,"data-key",s.i),o(this,y,Tt).call(this,n,"data-index",i),"option"in r(this,st).attributes){const d=r(this,st).attributes.option;o(this,y,lr).call(this,n,d)}if(!s.i)return o(this,y,cl).call(this,n,s.lbl),o(this,y,Ms).call(this,n,"opt-not-found"),n;if(o(this,y,Ms).call(this,n,"option"),"option"in r(this,st).classNames){const d=r(this,st).classNames.option;d&&o(this,y,or).call(this,n,d)}const a=o(this,y,ar).call(this,"span");if("opt-lbl-wrp"in r(this,st).attributes){const d=r(this,st).attributes["opt-lbl-wrp"];o(this,y,lr).call(this,a,d)}if(o(this,y,Ms).call(this,a,"opt-lbl-wrp"),"opt-lbl-wrp"in r(this,st).classNames){const d=r(this,st).classNames["opt-lbl-wrp"];d&&o(this,y,or).call(this,a,d)}if(r(this,st).optionFlagImage){const d=o(this,y,ar).call(this,"img");if("opt-icn"in r(this,st).attributes){const h=r(this,st).attributes["opt-icn"];o(this,y,lr).call(this,d,h)}if(o(this,y,Ms).call(this,d,"opt-icn"),"opt-icn"in r(this,st).classNames){const h=r(this,st).classNames["opt-icn"];h&&o(this,y,or).call(this,d,h)}d.src=`${r(this,Ur)}${s.img}`,d.alt=`${s.lbl} flag image`,d.loading="lazy",o(this,y,Tt).call(this,d,"aria-hidden",!0),a.append(d)}const l=o(this,y,ar).call(this,"span");if("opt-lbl"in r(this,st).attributes){const d=r(this,st).attributes["opt-lbl"];o(this,y,lr).call(this,l,d)}if(o(this,y,Ms).call(this,l,"opt-lbl"),"opt-lbl"in r(this,st).classNames){const d=r(this,st).classNames["opt-lbl"];d&&o(this,y,or).call(this,l,d)}o(this,y,cl).call(this,l,s.lbl),a.append(l);const c=o(this,y,ar).call(this,"span");if("opt-suffix"in r(this,st).attributes){const d=r(this,st).attributes["opt-suffix"];o(this,y,lr).call(this,c,d)}if(o(this,y,Ms).call(this,c,"opt-suffix"),"opt-suffix"in r(this,st).classNames){const d=r(this,st).classNames["opt-suffix"];d&&o(this,y,or).call(this,c,d)}return o(this,y,cl).call(this,c,s.i),o(this,y,Tt).call(this,n,"tabindex",o(this,y,cr).call(this)?"0":"-1"),o(this,y,Tt).call(this,n,"role","option"),o(this,y,Tt).call(this,n,"aria-posinset",i+1),o(this,y,Tt).call(this,n,"aria-setsize",r(this,Gs).length),o(this,y,Xe).call(this,n,"click",d=>{T(this,jn,!0),this.setSelectedCurrencyItem(d.currentTarget.dataset.key)}),o(this,y,Xe).call(this,n,"keyup",d=>{d.key==="Enter"&&(T(this,jn,!0),this.setSelectedCurrencyItem(d.currentTarget.dataset.key))}),s.disabled&&o(this,y,Ms).call(this,n,"disabled-opt"),n.append(a,c),r(this,$i)===s.i?(o(this,y,Ms).call(this,n,"selected-opt"),o(this,y,Tt).call(this,n,"aria-selected",!0)):o(this,y,Tt).call(this,n,"aria-selected",!1),n});r(this,hi).append(...e)},hd=function(){const e=o(this,y,ll).call(this,r(this,st).defaultValue);T(this,$i,e||r(this,st).defaultCurrencyKey||""),r(this,st).selectedFlagImage&&(r(this,Br).src=r(this,Hl)),this.setMenu({open:!1}),o(this,y,Tt).call(this,r(this,Nt),"data-num-value",""),r(this,st).selectedCurrencyClearable&&o(this,y,Ze).call(this,r(this,Oi),"display","none"),o(this,y,Tt).call(this,r(this,ue),"value",r(this,st).defaultValue)},ud=function(){if(!o(this,y,cr).call(this))return;o(this,y,dd).call(this);const e=o(this,y,ld).call(this),s=o(this,y,Te).call(this,`.option[data-index="${e}"]`);s&&s.scrollIntoView({block:"nearest",inline:"nearest"})},Xf=function(e){r(this,ze).value=e},Zf=function(e){var s;if(e.key==="Enter"&&r(this,Gs).length){const i=(s=o(this,y,Te).call(this,".option"))==null?void 0:s.dataset.key;this.setSelectedCurrencyItem(i),this.searchOptions("")}else this.searchOptions(e.target.value)},Qf=function(e){var l,c;if(e.target.value==="")return"required";const s=r(this,Nt).dataset.numValue,i=Number(s!==void 0&&s!==""?s:(c=(l=e.target.value)==null?void 0:l.match(/[0-9.]+/))==null?void 0:c[0]);if(Number.isNaN(i))return"";const{minValue:n,maxValue:a}=r(this,st);return n!==""&&i<n?"minValue":a!==""&&i>a?"maxValue":""},cr=function(){return r(this,$e).classList.contains("menu-open")},Jf=function(){const e=r(this,ro).getBoundingClientRect(),s=e.top,i=r(this,Ji).innerHeight-e.bottom;i<s&&i<r(this,st).maxHeight?(o(this,y,Ze).call(this,r(this,$e),"flex-direction","column-reverse"),o(this,y,Ze).call(this,r(this,$e),"bottom","0%")):(o(this,y,Ze).call(this,r(this,$e),"flex-direction","column"),o(this,y,Ze).call(this,r(this,$e),"bottom","auto"))},pd=function(e){e.code==="Space"&&(r(this,ze).focus(),this.setMenu({open:!0})),e.type==="click"&&(o(this,y,cr).call(this)?this.setMenu({open:!1}):(r(this,ze).focus(),this.setMenu({open:!0})))},Kf=function(){r(this,lo).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};const LT=({fieldKey:t,formID:e,attr:s,onBlurHandler:i,contentID:n,styleClasses:a})=>{const l=F.useRef(null),c=F.useRef(null),h=et(jt)[t],p=et(Mo),{selectedFlagImage:f,selectedCurrencyClearable:m,searchClearable:E,optionFlagImage:g,defaultCurrencyKey:I,searchPlaceholder:w,noCurrencyFoundText:S,defaultValue:_}=h.config;return F.useEffect(()=>{const R=document.getElementById("bit-grid-layout").contentWindow;l!=null&&l.current||(l.current=Gt(`.${t}-currency-fld-wrp`));const L=c.current,M=l.current;L&&M&&"destroy"in L&&L.destroy();const{options:D,inputFormatOptions:G,valueFormatOptions:C}=h,k={fieldKey:t,inputFormatOptions:G,valueFormatOptions:C,selectedFlagImage:f,selectedCurrencyClearable:m,searchClearable:E,optionFlagImage:No?g:!1,defaultCurrencyKey:I,defaultValue:_,searchPlaceholder:w,noCurrencyFoundText:S,options:D,assetsURL:`${p.rootURL}/static/currencies/`,document:document.getElementById("bit-grid-layout").contentDocument,window:R,attributes:{option:Lt(t,"option"),"opt-lbl-wrp":Lt(t,"opt-lbl-wrp"),"opt-icn":Lt(t,"opt-icn"),"opt-lbl":Lt(t,"opt-lbl"),"opt-suffix":Lt(t,"opt-suffix")},classNames:{option:x(t,"option"),"opt-lbl-wrp":x(t,"opt-lbl-wrp"),"opt-icn":x(t,"opt-icn"),"opt-lbl":x(t,"opt-lbl"),"opt-suffix":x(t,"opt-suffix")}};R.bit_virtualized_list||(R.bit_virtualized_list=xh),R.observeElm||(R.observeElm=gc),c.current=new $T(M,k)},[h]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:e,fieldKey:t,fieldData:s,children:u.jsx("div",{className:`${t}-currency-fld-container`,children:u.jsxs("div",A(b({"data-dev-currency-fld-wrp":t,className:`${t}-currency-fld-wrp ${x(t,"currency-fld-wrp")} ${h.valid.disabled?"disabled":""} ${h.valid.readonly?"readonly":""}`,ref:l},N(t,"currency-fld-wrp")),{children:[u.jsx("input",b(b({name:t,type:"hidden",className:`${t}-currency-hidden-input`},"disabled"in h.valid&&{disabled:h.valid.disabled}),"readonly"in h.valid&&{readOnly:h.valid.readonly})),u.jsxs("div",{className:`${t}-currency-inner-wrp`,children:[u.jsxs("div",{"data-testid":`${t}-dpd-wrp`,className:`${t}-dpd-wrp`,"data-dev-dpd-wrp":t,role:"combobox","aria-controls":"currency-dropdown","aria-live":"assertive","aria-labelledby":"currency-label-2","aria-expanded":"false",tabIndex:h.valid.disabled?"-1":"0",children:[f&&u.jsx("div",{className:`${t}-selected-currency-wrp`,children:u.jsx("img",b({"data-dev-selected-currency-img":t,alt:"Selected currency image","aria-hidden":"true",className:`${t}-selected-currency-img ${x(t,"selected-currency-img")}`,src:"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>"},N(t,"selected-currency-img")))}),u.jsx("div",{className:`${t}-dpd-down-btn`,children:u.jsx("svg",{width:"15",height:"15",role:"img",title:"Downarrow icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),u.jsx("input",A(b({"data-dev-currency-amount-input":t,"data-testid":`${t}-crncy-amnt-inp`,"aria-label":"Currency Input",type:"text"},"ph"in s&&{placeholder:s.ph}),{className:`${t}-currency-amount-input`,tabIndex:h.valid.disabled?"-1":"0"})),m&&u.jsx("button",A(b({"data-testid":`${t}-inp-clr-btn`,"data-dev-input-clear-btn":t,type:"button",title:"Clear value",className:`${t}-input-clear-btn ${x(t,"input-clear-btn")}`},N(t,"input-clear-btn")),{children:u.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}))]}),u.jsx("div",A(b({className:`${t}-option-wrp ${x(t,"option-wrp")}`,"data-dev-option-wrp":t},N(t,"option-search-wrp")),{children:u.jsxs("div",{className:`${t}-option-inner-wrp`,children:[u.jsxs("div",A(b({"data-dev-option-search-wrp":t,className:`${t}-option-search-wrp ${x(t,"option-search-wrp")}`},N(t,"option-search-wrp")),{children:[u.jsx("input",b({"data-testid":`${t}-opt-srch-inp`,"data-dev-opt-search-input":t,type:"search",className:`${t}-opt-search-input ${x(t,"opt-search-input")}`,placeholder:h.config.searchPlaceholder,autoComplete:"off",tabIndex:"-1"},N(t,"opt-search-input"))),u.jsxs("svg",A(b({className:`${t}-opt-search-icn ${x(t,"opt-search-icn")}`,"data-dev-opt-search-icn":t,"aria-hidden":"true",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},N(t,"opt-search-icn")),{children:[u.jsx("circle",{cx:"11",cy:"11",r:"8"}),u.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})),E&&u.jsx("button",A(b({"data-testid":`${t}-srch-clr-btn`,"data-dev-search-clear-btn":t,type:"button","aria-label":"Clear search",className:`${t}-search-clear-btn ${x(t,"search-clear-btn")}`,tabIndex:"-1"},N(t,"search-clear-btn")),{children:u.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}))]})),u.jsx("ul",A(b({className:`${t}-option-list ${x(t,"option-list")}`,tabIndex:"-1",role:"listbox","aria-label":"currency list","data-dev-option-list":t},N(t,"option-list")),{children:u.jsxs("li",{className:"option",children:[u.jsx("span",{className:"opt-prefix",children:"Prefix"}),u.jsxs("span",{className:"opt-lbl-wrp",children:[u.jsx("img",{className:"opt-icn",src:"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>",alt:"Placeholder"}),u.jsx("span",{className:"opt-lbl",children:"Option"})]}),u.jsx("span",{className:"opt-suffix",children:"Suffix"})]})}))]})}))]}))})})]})};function AT({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){var f,m;let{checked:l}=t.valid;const c=t.val||(l?t.msg.checked:t.msg.unchecked),[d,h]=F.useState(c);d===t.msg.unchecked?l=!1:d===t.msg.checked&&(l=!0);const p=E=>{if(t.valid.disabled)return;E.target.checked?h(t.msg.checked):h(t.msg.unchecked);const{form:g}=E.target;validateForm({input:{name:t.name,form:g,value:E.target.checked?t.msg.checked:t.msg.unchecked}})};return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:i,fieldKey:n,fieldData:t,noLabel:!0,children:u.jsxs("div",A(b({"data-dev-cc":n,className:`${n}-cc ${x(n,"cc")}`},N(n,"cc")),{children:[u.jsx("svg",{className:`${n}-cks`,children:u.jsx("symbol",{id:`${n}-ck-svg`,viewBox:"0 0 12 10",children:u.jsx("polyline",{className:`${n}-ck-svgline`,points:"1.5 6 4.5 9 10.5 1"})})}),u.jsxs("div",A(b({"data-dev-cw":n,className:`${n}-cw ${x(n,"cw")}`},N(n,"cw")),{children:[u.jsx("input",A(b(A(b(b(b({"data-testid":n,id:`${n}-decision`,type:"checkbox",className:`${n}-ci`},"req"in t.valid&&{required:t.valid.req}),"disabled"in t.valid&&{disabled:t.valid.disabled}),"readonly"in t.valid&&{readOnly:t.valid.readonly}),{defaultValue:(f=t==null?void 0:t.info)==null?void 0:f.lbl}),"fieldName"in t&&{name:t.fieldName}),{checked:l,value:d,onChange:p})),u.jsxs("label",A(b({"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-decision`,className:`${n}-cl ${x(n,"cl")}`},N(n,"cl")),{children:[u.jsx("span",A(b({"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${x(n,"bx")}`},N(n,"bx")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn`})})})),u.jsx("span",A(b({"data-dev-ct":n,className:`${n}-ct ${x(n,"ct")}`},N(n,"ct")),{children:u.jsx(We,{html:t.lbl||((m=t==null?void 0:t.info)==null?void 0:m.lbl)})}))]}))]}))]}))})]})}function MT({fieldKey:t,styleClasses:e,attr:s}){var l,c;const i=et(un),{styleMode:n}=et(_e),a=((c=(l=s.valid)==null?void 0:l.hidden)==null?void 0:c.includes(i))||!1;return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:e}),u.jsx("div",A(b({"data-dev-fld-wrp":t,className:`${t}-fld-wrp drag ${n?"":"drag"} ${a?"fld-hide":""} ${x(t,"fld-wrp")}`},N(t,"fld-wrp")),{children:u.jsx("div",b({"data-dev-divider":t,className:`${t}-divider ${x(t,"divider")}`},N(t,"divider")))}))]})}var Yt,kn,se,pe,zr,Xt,Yl,ye,Li,ws,ui,_s,os,Ts,Bs,fe,pi,Vt,Ai,Wr,Ki,Q,co,Hr,ho,v,fd,le,md,Qe,De,vn,tm,dl,em,dr,La,sm,wn,im,hl,hr,gd,Ed,bd,Hi,ul,nm,si,Fe,Ht,_n,pl,Id,Ti,xe,vd,wd,Aa,Tn,_d,rm,am,Mt,om,xi,ns,lm,cm,fl,dm,Td,ur,hm,xd,Sd,um,pm;class NT{constructor(e,s){O(this,v);O(this,Yt,null);O(this,kn,null);O(this,se,null);O(this,pe,null);O(this,zr,null);O(this,Xt,null);O(this,Yl,null);O(this,ye,null);O(this,Li,null);O(this,ws,null);O(this,ui,null);O(this,_s,!1);O(this,os,null);O(this,Ts,null);O(this,Bs,"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>");O(this,fe,"");O(this,pi,[]);O(this,Vt,[]);O(this,Ai,null);O(this,Wr,{});O(this,Ki,!1);O(this,Q,{separator:",",selectedOptImage:!1,dropdownIcn:"",selectedOptClearable:!0,searchClearable:!0,showSearch:!0,optionIcon:!1,defaultValue:"",placeholder:"Select an option",searchPlaceholder:"Search option",maxHeight:370,closeOnSelect:!1,showChip:!0,options:[],attributes:{},classNames:{},activeList:0,onChange:()=>{}});O(this,co,null);O(this,Hr,"");O(this,ho,[]);Object.assign(r(this,Q),s),T(this,Ai,s.document?s.document:document),T(this,Wr,s.window?s.window:window),typeof e=="string"?T(this,Yt,r(this,Ai).querySelector(e)):T(this,Yt,e),this.fieldKey=r(this,Q).fieldKey,this.init()}init(){T(this,se,o(this,v,le).call(this,`.${this.fieldKey}-dpd-hidden-input`)),T(this,pe,o(this,v,le).call(this,`.${this.fieldKey}-opt-search-input`)),T(this,zr,o(this,v,le).call(this,`.${this.fieldKey}-option-wrp`)),T(this,Xt,o(this,v,le).call(this,`.${this.fieldKey}-dpd-wrp`)),T(this,Yl,o(this,v,le).call(this,`.${this.fieldKey}-selected-opt-wrp`)),T(this,ye,o(this,v,le).call(this,`.${this.fieldKey}-selected-opt-img`)),T(this,Li,o(this,v,le).call(this,`.${this.fieldKey}-selected-opt-lbl`)),T(this,ws,o(this,v,le).call(this,`.${this.fieldKey}-selected-opt-clear-btn`)),T(this,ui,r(this,Q).searchClearable?o(this,v,le).call(this,`.${this.fieldKey}-search-clear-btn`):null);const e=`${this.fieldKey}-option-list`;o(this,v,Mt).call(this,r(this,Xt),"aria-controls",e),o(this,v,De).call(this,r(this,Xt),"click",s=>{o(this,v,xd).call(this,s)}),o(this,v,De).call(this,r(this,Xt),"keyup",s=>{o(this,v,xd).call(this,s)}),o(this,v,De).call(this,r(this,Xt),"blur",s=>{o(this,v,um).call(this,s)}),o(this,v,De).call(this,r(this,Yt),"keydown",s=>{o(this,v,sm).call(this,s)}),o(this,v,fd).call(this),r(this,Q).defaultValue&&this.setSelectedOption(r(this,Q).defaultValue),r(this,Q).defaultValue||o(this,v,tm).call(this),r(this,Q).selectedOptImage&&(r(this,ye).src=r(this,Bs)),o(this,v,Qe).call(this)&&r(this,Q).searchClearable&&(o(this,v,xe).call(this,r(this,ui),"display","none"),o(this,v,De).call(this,r(this,ui),"click",()=>{this.searchOptions("")})),o(this,v,Qe).call(this)&&(r(this,pe).placeholder=r(this,Q).searchPlaceholder,r(this,pe).value="",o(this,v,De).call(this,r(this,pe),"keyup",s=>{o(this,v,cm).call(this,s)})),T(this,_s,r(this,Q).allowCustomOption),r(this,Wr).observeElm(r(this,se),"value",(s,i)=>{o(this,v,em).call(this,s,i,r(this,Ki))})}setSelectedOption(e){let s=null,i=e.split(r(this,Q).separator);i=i.filter(n=>o(this,v,hr).call(this,n)),r(this,Q).multipleSelect?(i.length===1?s=o(this,v,hr).call(this,i[0]):i.length>1&&(s={lbl:`${i.length} options selected`}),r(this,Q).disableOnMax&&r(this,Q).mx&&i.length>=r(this,Q).mx?o(this,v,ul).call(this,!0):o(this,v,ul).call(this,!1)):s=o(this,v,hr).call(this,e),T(this,fe,e),r(this,fe)||o(this,v,hl).call(this),s&&(this.value=e,r(this,Q).selectedOptImage&&(r(this,Q).multipleSelect?i.length>1?(r(this,ye).src=r(this,Bs),o(this,v,Hi).call(this,r(this,ye))):i.length===1?(r(this,ye).src=s.icn||r(this,Bs),o(this,v,Hi).call(this,r(this,ye),s.icn)):(r(this,ye).src=r(this,Bs),o(this,v,Hi).call(this,r(this,ye))):(r(this,ye).src=s.icn||r(this,Bs),o(this,v,Hi).call(this,r(this,ye),s.icn))),r(this,Q).multipleSelect&&r(this,Q).showChip&&o(this,v,gd).call(this,i),r(this,Q).showChip||o(this,v,Ti).call(this,r(this,Li),s.lbl),o(this,v,Ed).call(this),r(this,Q).closeOnSelect&&this.setMenu({open:!1}),r(this,Q).selectedOptClearable&&(o(this,v,xe).call(this,r(this,ws),"display","grid"),o(this,v,De).call(this,r(this,ws),"click",n=>{o(this,v,hl).call(this,n)})),r(this,Q).onChange&&r(this,Q).onChange(e),r(this,Ki)||o(this,v,dl).call(this,r(this,se),"blur"))}searchOptions(e){o(this,v,dm).call(this,e);let s=[],i=!1;if(e){const n=r(this,Q).options.length,a=[],l=e.toLowerCase();for(let d=0;d<n;d+=1){const h=r(this,Q).options[d];if("type"in h)continue;const p=h.lbl.toLowerCase();if(p.includes(l)){if("groupIndex"in h&&!a.includes(h.groupIndex)){const f=h.groupIndex;a.push(f),s.push(r(this,Q).options[f])}s.push(h),p===l&&(i=!0)}}const c=r(this,pi).length;for(let d=0;d<c;d+=1){const h=r(this,pi)[d],p=h.lbl.toLowerCase();p.includes(l)&&(s.push(h),p===l&&(i=!0))}s.length||(s=[{i:"not-found",lbl:"No Option Found"}]),T(this,Vt,r(this,_s)?[r(this,Q).options[0]]:[]),r(this,Vt).push(...s),r(this,Q).searchClearable&&o(this,v,xe).call(this,r(this,ui),"display","grid")}else T(this,Vt,r(this,Q).options),r(this,Q).searchClearable&&o(this,v,xe).call(this,r(this,ui),"display","none"),r(this,_s)&&(T(this,os,o(this,v,le).call(this,`${o(this,v,wn).call(this)} .create-opt`)),o(this,v,xe).call(this,r(this,os),"display","none"),T(this,Vt,r(this,Vt).concat(r(this,pi))));if(o(this,v,Tn).call(this),T(this,os,o(this,v,le).call(this,`${o(this,v,wn).call(this)} .create-opt`)),i&&r(this,_s))o(this,v,xe).call(this,r(this,os),"display","none");else if(r(this,_s)&&e.trim()){o(this,v,xe).call(this,r(this,os),"display","block");const n=r(this,os).querySelector(".opt-lbl");n.innerText=`Create: ${e}`,o(this,v,Mt).call(this,r(this,os),"data-value",e)}}setMenu({open:e}){o(this,v,xe).call(this,r(this,zr),"max-height",`${e?r(this,Q).maxHeight:0}px`),e?(o(this,v,hm).call(this),o(this,v,Ht).call(this,r(this,Yt),"menu-open"),o(this,v,De).call(this,r(this,Ai),"click",s=>o(this,v,Td).call(this,s)),o(this,v,Qe).call(this)&&(o(this,v,Fe).call(this,r(this,pe),0),o(this,v,Fe).call(this,r(this,ui),0)),r(this,Xt).setAttribute("aria-expanded","true"),o(this,v,Mt).call(this,r(this,Ts),"aria-hidden",!1),o(this,v,Qe).call(this)&&o(this,v,Mt).call(this,r(this,pe),"aria-hidden",!1),o(this,v,Tn).call(this),o(this,v,Qe).call(this)&&o(this,v,om).call(this,r(this,pe),"inert")):(o(this,v,_n).call(this,r(this,Yt),"menu-open"),r(this,Ai).removeEventListener("click",o(this,v,Td)),o(this,v,Qe).call(this)&&setTimeout(()=>{this.searchOptions("")},100),o(this,v,Qe).call(this)&&(o(this,v,Fe).call(this,r(this,pe),-1),o(this,v,Fe).call(this,r(this,ui),-1)),r(this,Xt).setAttribute("aria-expanded","false"),r(this,Xt).removeAttribute("aria-activedescendant"),o(this,v,Mt).call(this,r(this,Ts),"aria-hidden",!0),o(this,v,Qe).call(this)&&(o(this,v,Mt).call(this,r(this,pe),"aria-hidden",!0),o(this,v,Mt).call(this,r(this,pe),"inert",""))),o(this,v,am).call(this)}set activelist(e){const s=o(this,v,le).call(this,`.${this.fieldKey}-option-list[data-list="${e}"]`);if(s){const i=s.getAttribute("data-list-index");r(this,Q).activeList=i,this.setSelectedOption(""),o(this,v,fd).call(this)}}set disabled(e){String(e).toLowerCase()==="true"?(r(this,Yt).classList.add("disabled"),r(this,se).disabled=!0,o(this,v,Fe).call(this,r(this,Xt),-1),o(this,v,Fe).call(this,r(this,ws),-1),o(this,v,Mt).call(this,r(this,Xt),"aria-label","Dropdown disabled"),this.setMenu({open:!1})):String(e).toLowerCase()==="false"&&(o(this,v,_n).call(this,r(this,Yt),"disabled"),r(this,se).removeAttribute("disabled"),o(this,v,Fe).call(this,r(this,Xt),0),o(this,v,Fe).call(this,r(this,ws),0),o(this,v,Mt).call(this,r(this,Xt),"aria-label",r(this,Q).placeholder))}get disabled(){return r(this,se).disabled}set readonly(e){String(e).toLowerCase()==="true"?(o(this,v,Ht).call(this,r(this,Yt),"disabled"),r(this,se).readOnly=!0,o(this,v,Fe).call(this,r(this,Xt),-1),o(this,v,Fe).call(this,r(this,ws),-1),this.setMenu({open:!1})):String(e).toLowerCase()==="false"&&(o(this,v,_n).call(this,r(this,Yt),"disabled"),r(this,se).removeAttribute("readonly"),o(this,v,Fe).call(this,r(this,Xt),0),o(this,v,Fe).call(this,r(this,ws),0))}get readonly(){return r(this,se).readOnly}set value(e){r(this,se).value=e,o(this,v,Mt).call(this,r(this,se),"value",e)}get value(){return r(this,se).value}destroy(){this.value="",o(this,v,pm).call(this)}reset(){T(this,Ki,!0),o(this,v,hl).call(this),this.destroy(),this.init(),setTimeout(()=>{T(this,Ki,!1)},1)}}Yt=new WeakMap,kn=new WeakMap,se=new WeakMap,pe=new WeakMap,zr=new WeakMap,Xt=new WeakMap,Yl=new WeakMap,ye=new WeakMap,Li=new WeakMap,ws=new WeakMap,ui=new WeakMap,_s=new WeakMap,os=new WeakMap,Ts=new WeakMap,Bs=new WeakMap,fe=new WeakMap,pi=new WeakMap,Vt=new WeakMap,Ai=new WeakMap,Wr=new WeakMap,Ki=new WeakMap,Q=new WeakMap,co=new WeakMap,Hr=new WeakMap,ho=new WeakMap,v=new WeakSet,fd=function(){const e=o(this,v,le).call(this,`.${this.fieldKey}-option-list[data-list-index="${r(this,Q).activeList}"]`);T(this,Ts,o(this,v,le).call(this,`.${this.fieldKey}-option-list.active-list`)),r(this,Ts).innerHTML=e.innerHTML,o(this,v,Mt).call(this,r(this,Ts),"id",`${this.fieldKey}-option-list`),o(this,v,rm).call(this),r(this,Q).options=o(this,v,im).call(this),T(this,Vt,[...r(this,Q).options]),o(this,v,De).call(this,r(this,Ts),"scroll",s=>s.stopPropagation())},le=function(e,s){return s?s.querySelector(e):r(this,Yt).querySelector(e)},md=function(e){return r(this,Yt).querySelectorAll(e)},Qe=function(){return r(this,Q).showSearch&&r(this,pe)},De=function(e,s,i){e!=null&&e.addEventListener&&(e.addEventListener(s,i),r(this,ho).push({selector:e,eventType:s,cb:i}))},vn=function(e,s){e.appendChild(s)},tm=function(){r(this,se).value&&(this.setSelectedOption(r(this,se).value),o(this,v,Tn).call(this))},dl=function(e,s){const i=new Event(s);e.dispatchEvent(i)},em=function(e,s){e!==s&&this.setSelectedOption(s),typeof bit_conditionals!="undefined"&&bit_conditionals({target:r(this,se)})},dr=function(e=-1,s){if(s==="next"){const i=r(this,Vt).length;for(let n=e+1;n<i;n+=1){const a=r(this,Vt)[n];if(a.type!=="group"&&!a.disabled&&!a.disableOnMax)return n}}else if(s==="previous")for(let i=e-1;i>=0;i-=1){const n=r(this,Vt)[i];if(n.type!=="group"&&!n.disabled&&!n.disableOnMax)return i}},La=function(e){return o(this,v,le).call(this,`${o(this,v,wn).call(this)} .option[data-index="${e}"]`)},sm=function(e){const s=r(this,Ai).activeElement;let i=null;if(o(this,v,ur).call(this)){const a=Number(s.dataset.index||-1);if(e.key==="ArrowDown"||!e.shiftKey&&e.key==="Tab"){e.preventDefault();let l=0,c=null;o(this,v,Qe).call(this)&&s===r(this,pe)?(l=o(this,v,dr).call(this,-1,"next"),r(this,_s)&&l===0&&o(this,v,pl).call(this,r(this,os))!=="block"&&(l=1),c=o(this,v,La).call(this,l)):s.classList.contains("option")&&(l=o(this,v,dr).call(this,a,"next"),c=o(this,v,La).call(this,l)),c&&(i=c)}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),o(this,v,Qe).call(this)&&s===r(this,pe))i=r(this,Xt),o(this,v,ur).call(this)&&this.setMenu({open:!1});else if(s.classList.contains("option")){let l=o(this,v,dr).call(this,a,"previous");o(this,v,fl)&&l===0&&o(this,v,pl).call(this,r(this,os))!=="block"&&(l=-1);const c=o(this,v,La).call(this,l);c?i=c:c||(o(this,v,Qe).call(this)?i=r(this,pe):i=r(this,Xt))}}else e.key==="Escape"&&this.setMenu({open:!1})}else if(e.key>="a"&&e.key<="z"){clearTimeout(r(this,co)),T(this,Hr,r(this,Hr)+e.key),T(this,co,setTimeout(()=>{T(this,Hr,"")},300));const a=r(this,Q).options.find(l=>l.type!=="group"&&!l.disabled&&l.lbl.toLowerCase().startsWith(r(this,Hr)));a&&this.setSelectedOption(a.val)}else if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(r(this,Q).multipleSelect)return;e.preventDefault();const a=o(this,v,nm).call(this),l=e.key==="ArrowDown"?"next":"previous";let c=o(this,v,dr).call(this,a,l);r(this,_s)&&c===0&&(c=1),c>-1&&c<r(this,Q).options.length&&(this.value=r(this,Q).options[c].val)}else if((e.key==="ArrowRight"||e.key==="ArrowLeft")&&s.classList.contains("chip-clear-btn")){let l=null;e.key==="ArrowRight"?l=s.parentElement.nextElementSibling:e.key==="ArrowLeft"&&(l=s.parentElement.previousElementSibling),l&&(i=o(this,v,le).call(this,".chip-clear-btn",l))}if(i)if(i.focus({preventScroll:!0}),i.classList.contains("option")){const a=i.getAttribute("id");a&&o(this,v,Mt).call(this,r(this,Xt),"aria-activedescendant",a)}else r(this,Xt).removeAttribute("aria-activedescendant")},wn=function(){return`.${this.fieldKey}-option-list.active-list`},im=function(){const e=Array.from(o(this,v,md).call(this,`${o(this,v,wn).call(this)} .option`)),s=a=>{const l={},c=a.querySelector(".opt-lbl"),{value:d}=a.dataset;l.lbl=c.textContent,d?l.val=d:l.val=l.lbl,o(this,v,Id).call(this,a,"disabled-opt")&&(l.disabled=!0);const h=a.querySelector(".opt-icn");r(this,Q).optionIcon&&(h!=null&&h.src)&&(l.icn=h.src);const{attributes:p}=a,f=p.length;l.attributes={};for(let m=0;m<f;m+=1){const E=p[m].nodeName;l.attributes[E]=a.getAttribute(E)}return l},i=[],{length:n}=e;for(let a=0;a<n;a+=1){const l=e[a];let c={},d=null;if(l.classList.contains("opt-group-title")){c=s(l),c.type="group",i.push(c),d=a;for(let h=a+1;h<n;h+=1){const p=e[h];if(p.classList.contains("opt-group-child")){const f=s(p);f.groupIndex=d,a=h,i.push(f)}else{a=h-1;break}}}else c=s(l),i.push(c)}return i},hl=function(e){e==null||e.stopPropagation(),T(this,fe,""),r(this,Q).selectedOptImage&&(r(this,ye).src=r(this,Bs),o(this,v,Hi).call(this,r(this,ye))),this.value="",r(this,Q).multipleSelect&&r(this,Q).showChip&&o(this,v,gd).call(this,[]),r(this,Q).showChip||o(this,v,Ti).call(this,r(this,Li),r(this,Q).placeholder),o(this,v,Ed).call(this),r(this,Q).selectedOptClearable&&o(this,v,xe).call(this,r(this,ws),"display","none"),o(this,v,ul).call(this),r(this,Ki)||o(this,v,dl).call(this,r(this,se),"blur")},hr=function(e){return[...r(this,Q).options,...r(this,pi)].find(s=>s.val===e)},gd=function(e){if(o(this,v,Ti).call(this,r(this,Li),""),!e.length){r(this,Q).selectedOptImage&&o(this,v,xe).call(this,r(this,ye),"display","block"),o(this,v,Ti).call(this,r(this,Li),r(this,Q).placeholder);return}r(this,Q).selectedOptImage&&o(this,v,xe).call(this,r(this,ye),"display","none"),e.forEach((s,i)=>{var g,I,w,S,_,R,L,M;const n=o(this,v,si).call(this,"div");o(this,v,Ht).call(this,n,"chip-wrp");const a=(g=r(this,Q).customClasses)==null?void 0:g["chip-wrp"];a&&o(this,v,xi).call(this,n,a);const l=(I=r(this,Q).customAttributes)==null?void 0:I["chip-wrp"];if(l&&o(this,v,ns).call(this,n,l),"chip-wrp"in r(this,Q).attributes){const D=r(this,Q).attributes["chip-wrp"];o(this,v,ns).call(this,n,D)}if(r(this,Q).selectedOptImage&&r(this,Q).optionIcon){const D=o(this,v,si).call(this,"img");if(o(this,v,Ht).call(this,D,"chip-icn"),"chip-icn"in r(this,Q).attributes){const q=r(this,Q).attributes["chip-icn"];o(this,v,ns).call(this,D,q)}const G=o(this,v,hr).call(this,s);o(this,v,Mt).call(this,D,"src",G.icn||r(this,Bs)),o(this,v,Hi).call(this,D,G.icn),o(this,v,Mt).call(this,D,"alt",G.lbl);const C=(w=r(this,Q).customClasses)==null?void 0:w["chip-icn"];C&&o(this,v,xi).call(this,D,C);const k=(S=r(this,Q).customAttributes)==null?void 0:S["chip-icn"];k&&o(this,v,ns).call(this,D,k),o(this,v,vn).call(this,n,D)}const c=o(this,v,si).call(this,"span");if(o(this,v,Ht).call(this,c,"chip-lbl"),"chip-lbl"in r(this,Q).attributes){const D=r(this,Q).attributes["chip-lbl"];o(this,v,ns).call(this,c,D)}const d=(_=r(this,Q).customClasses)==null?void 0:_["chip-lbl"];d&&o(this,v,xi).call(this,c,d);const h=(R=r(this,Q).customAttributes)==null?void 0:R["chip-lbl"];h&&o(this,v,ns).call(this,c,h);const p=o(this,v,hr).call(this,s);o(this,v,Ti).call(this,c,p?p.lbl:s),o(this,v,vn).call(this,n,c);const f=o(this,v,si).call(this,"button");if(o(this,v,Ht).call(this,f,"chip-clear-btn"),"chip-clear-btn"in r(this,Q).attributes){const D=r(this,Q).attributes["chip-clear-btn"];o(this,v,ns).call(this,f,D)}const m=(L=r(this,Q).customClasses)==null?void 0:L["chip-clear-btn"];m&&o(this,v,xi).call(this,f,m);const E=(M=r(this,Q).customAttributes)==null?void 0:M["chip-clear-btn"];E&&o(this,v,ns).call(this,f,E),f.innerHTML=r(this,ws).innerHTML,o(this,v,De).call(this,f,"click",D=>{o(this,v,bd).call(this,D,i)}),o(this,v,De).call(this,f,"keyup",D=>{D.key==="Backspace"&&o(this,v,bd).call(this,D,i)}),o(this,v,vn).call(this,n,f),o(this,v,vn).call(this,r(this,Li),n)})},Ed=function(){if(T(this,kn,r(this,Yt).parentElement),!!r(this,kn)){if(!r(this,fe)){r(this,kn).style.removeProperty("min-height");return}o(this,v,xe).call(this,r(this,kn),"min-height",`${r(this,Yt).offsetHeight-r(this,zr).offsetHeight}px`)}},bd=function(e,s){e.stopPropagation();const i=r(this,fe).split(r(this,Q).separator);i.splice(s,1),this.setSelectedOption(i.join(r(this,Q).separator)),o(this,v,Tn).call(this)},Hi=function(e=null,s=0){s?o(this,v,_n).call(this,e,"placeholder-img"):o(this,v,Ht).call(this,e,"placeholder-img")},ul=function(e=!1){if(e){const s=r(this,fe).split(r(this,Q).separator);T(this,Vt,r(this,Vt).map(i=>{const n=i;return!i.disabled&&!s.includes(i.val)?n.disableOnMax=!0:n.disableOnMax=!1,n}))}else T(this,Vt,r(this,Vt).map(s=>{const i=s;return delete i.disableOnMax,i}));o(this,v,Tn).call(this)},nm=function(){return r(this,Vt).findIndex(e=>e.val===r(this,fe))},si=function(e){return r(this,Ai).createElement(e)},Fe=function(e,s){e&&(e.tabIndex=s)},Ht=function(e,s){e.classList.add(s)},_n=function(e,s){e.classList.remove(s)},pl=function(e){return(e==null?void 0:e.style.display)||""},Id=function(e,s){return e.classList.contains(s)},Ti=function(e,s){e.textContent=s},xe=function(e,s,i){e.style.setProperty(s,i,"important")},vd=function(e){return e&&e.split(r(this,Q).separator)||[]},wd=function(e){return e.join(r(this,Q).separator)},Aa=function(e){e.stopPropagation();const s=e.currentTarget,i=s.dataset.value;if(r(this,_s)&&s.classList.contains("create-opt")&&o(this,v,fl).call(this,i),r(this,Q).multipleSelect){const n=o(this,v,vd).call(this,r(this,fe));if(n.includes(i)){const l=n.indexOf(i);n.splice(l,1),o(this,v,_n).call(this,s,"selected-opt")}else n.push(i),o(this,v,Ht).call(this,s,"selected-opt");T(this,fe,o(this,v,wd).call(this,n))}else{const n=o(this,v,le).call(this,".selected-opt");n&&o(this,v,_n).call(this,n,"selected-opt"),o(this,v,Ht).call(this,s,"selected-opt"),T(this,fe,i)}this.setSelectedOption(r(this,fe)),setTimeout(()=>{o(this,v,le).call(this,`${o(this,v,wn).call(this)} .option[data-value="${i}"]`).focus()},0)},Tn=function(){o(this,v,lm).call(this)},_d=function(){return o(this,v,md).call(this,`${o(this,v,wn).call(this)} .option:not(.opt-group-title):not(.create-opt)`)},rm=function(){const e=o(this,v,_d).call(this),s=e.length;for(let i=0;i<s;i+=1){const n=e[i];o(this,v,De).call(this,n,"click",a=>{o(this,v,Aa).call(this,a)}),o(this,v,De).call(this,n,"keyup",a=>{a.key==="Enter"&&o(this,v,Aa).call(this,a)})}},am=function(){const e=o(this,v,_d).call(this),s=o(this,v,ur).call(this),i=e.length;for(let n=0;n<i;n+=1){const a=e[n];s?o(this,v,Fe).call(this,a,0):o(this,v,Fe).call(this,a,-1)}},Mt=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},om=function(e,s){e==null||e.removeAttribute(s)},xi=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>o(this,v,Ht).call(this,e,i))},ns=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)o(this,v,Mt).call(this,e,s[n].key,s[n].value)},lm=function(){r(this,Ts).innerHTML="";const e=r(this,fe).split(r(this,Q).separator),s=r(this,Vt).length;for(let i=0;i<s;i+=1){const n=r(this,Vt)[i],a=o(this,v,si).call(this,"li");if(n.i==="not-found"){o(this,v,Ti).call(this,a,n.lbl),o(this,v,Ht).call(this,a,"opt-not-found"),o(this,v,vn).call(this,r(this,Ts),a);return}o(this,v,Ht).call(this,a,"option");const l=o(this,v,si).call(this,"span");if(o(this,v,Ht).call(this,l,"opt-lbl-wrp"),"opt-lbl-wrp"in r(this,Q).classNames){const h=r(this,Q).classNames["opt-lbl-wrp"];h&&o(this,v,xi).call(this,l,h)}if("opt-lbl-wrp"in r(this,Q).attributes){const h=r(this,Q).attributes["opt-lbl-wrp"];o(this,v,ns).call(this,l,h)}if(r(this,Q).optionIcon){const h=o(this,v,si).call(this,"img");if(o(this,v,Ht).call(this,h,"opt-icn"),"opt-icn"in r(this,Q).classNames){const p=r(this,Q).classNames["opt-icn"];p&&o(this,v,xi).call(this,h,p)}if("opt-icn"in r(this,Q).attributes){const p=r(this,Q).attributes["opt-icn"];o(this,v,ns).call(this,h,p)}h.src=n.icn||r(this,Bs),o(this,v,Hi).call(this,h,n.icn),h.alt=n.lbl,h.loading="lazy",l.append(h)}const c=o(this,v,si).call(this,"span");if(o(this,v,Ht).call(this,c,"opt-lbl"),"opt-lbl"in r(this,Q).classNames){const h=r(this,Q).classNames["opt-lbl"];h&&o(this,v,xi).call(this,c,h)}if("opt-lbl"in r(this,Q).attributes){const h=r(this,Q).attributes["opt-lbl"];o(this,v,ns).call(this,c,h)}o(this,v,Ti).call(this,c,n.lbl),l.append(c);const d=o(this,v,si).call(this,"span");if(o(this,v,Ht).call(this,d,"opt-prefix"),"opt-prefix"in r(this,Q).classNames){const h=r(this,Q).classNames["opt-prefix"];h&&o(this,v,xi).call(this,d,h)}if("opt-prefix"in r(this,Q).attributes){const h=r(this,Q).attributes["opt-prefix"];o(this,v,ns).call(this,c,h)}o(this,v,Ti).call(this,d,n.code),a.append(l,d),Object.keys(n.attributes).map(h=>{o(this,v,Mt).call(this,a,h,n.attributes[h])}),e.includes(n.val)?(o(this,v,Ht).call(this,a,"selected-opt"),o(this,v,Mt).call(this,a,"aria-selected",!0)):o(this,v,Mt).call(this,a,"aria-selected",!1),n.type==="group"?o(this,v,Ht).call(this,a,"opt-group-title"):("groupIndex"in n&&o(this,v,Ht).call(this,a,"opt-group-child"),o(this,v,Mt).call(this,a,"data-index",i),o(this,v,Mt).call(this,a,"data-value",n.val),o(this,v,Mt).call(this,a,"role","option"),o(this,v,Mt).call(this,a,"id",`${this.fieldKey}-opt-${i}`),o(this,v,Mt).call(this,a,"aria-posinset",i+1),o(this,v,Mt).call(this,a,"aria-setsize",r(this,Vt).length),o(this,v,Fe).call(this,a,o(this,v,ur).call(this)?"0":"-1"),n.disabled?(o(this,v,Ht).call(this,a,"disabled-opt"),o(this,v,Mt).call(this,a,"aria-disabled","true")):n.disableOnMax?(o(this,v,Ht).call(this,a,"disable-on-max"),o(this,v,Mt).call(this,a,"aria-disabled","true")):(o(this,v,De).call(this,a,"click",h=>{o(this,v,Aa).call(this,h)}),o(this,v,De).call(this,a,"keyup",h=>{h.key==="Enter"&&o(this,v,Aa).call(this,h)}))),o(this,v,vn).call(this,r(this,Ts),a)}},cm=function(e){var s;if(e.stopPropagation(),e.key==="Enter"&&r(this,Vt).length){const i=(s=r(this,Vt))==null?void 0:s[0].i;if(i&&(this.setSelectedOption(i),this.searchOptions("")),r(this,_s)&&o(this,v,pl).call(this,r(this,os))!=="none"){const{value:n}=e.target;if(o(this,v,fl).call(this,n),r(this,Q).multipleSelect){const a=o(this,v,vd).call(this,r(this,fe));a.push(n),T(this,fe,o(this,v,wd).call(this,a))}else T(this,fe,n);o(this,v,Tn).call(this),this.setSelectedOption(r(this,fe))}}else this.searchOptions(e.target.value)},fl=function(e){let s=e.trim();if(s.includes&&s){const i=r(this,pi).length;for(let n=0;n<i;n+=1)if(r(this,pi)[n].lbl.toLowerCase()===s){s="";break}if(s){const n={lbl:s,val:s};n.attributes={},r(this,pi).push(n),r(this,Vt).push(n),this.searchOptions("")}}},dm=function(e){o(this,v,Qe).call(this)&&(r(this,pe).value=e)},Td=function(e){r(this,Yt).contains(e.target)||this.setMenu({open:!1})},ur=function(){return o(this,v,Id).call(this,r(this,Yt),"menu-open")},hm=function(){const e=r(this,Xt).getBoundingClientRect(),s=e.top,i=r(this,Wr).innerHeight-e.bottom;i<s&&i<r(this,Q).maxHeight?(o(this,v,xe).call(this,r(this,Yt),"flex-direction","column-reverse"),o(this,v,xe).call(this,r(this,Yt),"bottom","0%")):(o(this,v,xe).call(this,r(this,Yt),"flex-direction","column"),o(this,v,xe).call(this,r(this,Yt),"bottom","auto"))},xd=function(e){e.code==="Space"&&(this.setMenu({open:!0}),o(this,v,Sd).call(this)),e.type==="click"&&(o(this,v,ur).call(this)?this.setMenu({open:!1}):(this.setMenu({open:!0}),o(this,v,Sd).call(this)))},Sd=function(){if(o(this,v,Qe).call(this)){r(this,pe).focus();return}const e=o(this,v,dr).call(this,-1,"next"),s=o(this,v,La).call(this,e);s==null||s.focus({preventScroll:!0})},um=function(e){var s;(s=e.target.parentElement)!=null&&s.contains(e.relatedTarget)||o(this,v,dl).call(this,r(this,se),"blur")},pm=function(){r(this,ho).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};function PT({fieldKey:t,formID:e,styleClasses:s,attr:i,onBlurHandler:n,resetFieldValue:a,isBuilder:l}){var R;const[c,d]=F.useState(null),h=F.useRef(null),f=et(jt)[t],{optionsList:m,ph:E}=f,{activeList:g,optionIcon:I,allowCustomOption:w}=f.config,S=(R=f.config.showSearch)!=null?R:!0;F.useEffect(()=>{var B;if(!c)return;const L=h.current;L&&c&&"destroy"in L&&L.destroy();const{selectedOptImage:M,selectedOptClearable:D,searchClearable:G,searchPlaceholder:C,maxHeight:k,multipleSelect:q,showChip:W,selectedOptImgSrc:V,closeOnSelect:X}=f.config,j=document.getElementById("bit-grid-layout").contentWindow,K={fieldKey:t,selectedOptImage:M,selectedOptClearable:D,searchClearable:G,showSearch:(B=f.config.showSearch)!=null?B:!0,allowCustomOption:w,optionIcon:I,maxHeight:k,multipleSelect:q,showChip:W,placeholder:E,searchPlaceholder:C,selectedOptImgSrc:V,closeOnSelect:X,activeList:g,document:document.getElementById("bit-grid-layout").contentDocument,window:j,attributes:{"opt-lbl-wrp":Lt(t,"opt-lbl-wrp"),"opt-icn":Lt(t,"opt-icn"),"opt-lbl":Lt(t,"opt-lbl"),"opt-prefix":Lt(t,"opt-prefix"),"chip-wrp":Lt(t,"chip-wrp"),"chip-lbl":Lt(t,"chip-lbl"),"chip-icn":Lt(t,"chip-icn"),"chip-clear-btn":Lt(t,"chip-clear-btn")},classNames:{"opt-lbl-wrp":x(t,"opt-lbl-wrp"),"opt-icn":x(t,"opt-icn"),"opt-lbl":x(t,"opt-lbl"),"opt-prefix":x(t,"opt-prefix")}};j.observeElm||(j.observeElm=gc),h.current=new NT(c,K)},[f,c]);const _=m.reduce((L,M)=>{const[D,G]=Object.entries(M)[0];return A(b({},L),{[D]:G})},{});return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:s}),u.jsx(At,{formID:e,fieldKey:t,fieldData:i,children:u.jsx("div",{className:`${t}-dpd-fld-container ${x(t,"dpd-fld-container")}`,children:u.jsxs("div",A(b({"data-dev-dpd-fld-wrp":t,className:`${t}-dpd-fld-wrp ${x(t,"dpd-fld-wrp")} ${f.valid.disabled?"disabled":""} ${f.valid.readonly?"readonly":""}`,ref:d},N(t,"dpd-fld-wrp")),{children:[u.jsx("input",b(b({"data-testid":`${t}-dpd-hdn-inp`,name:t,type:"hidden",className:`${t}-dpd-hidden-input ${x(t,"dpd-hidden-input")}`},"disabled"in f.valid&&{disabled:f.valid.disabled}),"readonly"in f.valid&&{readOnly:f.valid.readonly})),u.jsxs("div",A(b({"data-testid":`${t}-dpd-wrp`,"data-dev-dpd-wrp":t,className:`${t}-dpd-wrp ${x(t,"dpd-wrp")}`,role:"combobox","aria-controls":"","aria-live":"assertive","aria-expanded":"false",tabIndex:"0","aria-label":"Dropdown"},N(t,"dpd-wrp")),{children:[u.jsxs("div",{"data-testid":`${t}-slctd-opt-wrp`,className:`${t}-selected-opt-wrp ${x(t,"selected-opt-wrp")}`,children:[f.config.selectedOptImage&&u.jsx("img",b({"data-testid":`${t}-slctd-opt-img`,"data-dev-selected-opt-img":t,className:`${t}-selected-opt-img placeholder-img ${x(t,"selected-opt-img")}`,"aria-hidden":"true",alt:"selected option icon",src:"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>"},N(t,"selected-opt-img"))),u.jsx("span",A(b({"data-testid":`${t}-slctd-opt-lbl`,"aria-label":"Selected Option Label","data-dev-selected-opt-lbl":t,className:`${t}-selected-opt-lbl ${f.config.multipleSelect&&f.config.showChip?"multi-chip":""} ${x(t,"selected-opt-lbl")}`},N(t,"selected-opt-lbl")),{children:E}))]}),u.jsxs("div",{"data-testid":`${t}-dpd-btn-wrp`,className:`${t}-dpd-btn-wrp ${x(t,"dpd-btn-wrp")}`,children:[u.jsx("button",A(b({"data-testid":`${t}-slctd-opt-clr-btn`,type:"button","aria-label":"Clear selected option value","data-dev-selected-opt-clear-btn":t,className:`${t}-selected-opt-clear-btn ${x(t,"selected-opt-clear-btn")}`},N(t,"selected-opt-clear-btn")),{children:u.jsxs("svg",{width:"15",height:"15",role:"img",title:"Cross icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})),u.jsx("div",{className:`${t}-dpd-down-btn ${x(t,"dpd-down-btn")}`,children:u.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",title:"Down icon",role:"img",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})]})),u.jsx("div",A(b({className:`${t}-option-wrp ${x(t,"option-wrp")}`,"data-dev-option-wrp":t},N(t,"option-search-wrp")),{children:u.jsxs("div",{className:`${t}-option-inner-wrp ${x(t,"option-inner-wrp")}`,children:[S&&u.jsxs("div",{"data-dev-option-search-wrp":t,className:`${t}-option-search-wrp ${x(t,"option-search-wrp")}`,children:[u.jsx("input",b({"data-testid":`${t}-opt-srch-inp`,type:"search","data-dev-opt-search-input":t,className:`${t}-opt-search-input ${x(t,"opt-search-input")}`,placeholder:"Search Country","aria-label":"Search Options","aria-hidden":"true",tabIndex:"-1"},N(t,"opt-search-input"))),u.jsxs("svg",A(b({"data-dev-opt-search-icn":t,className:`${t}-icn ${t}-opt-search-icn ${x(t,"opt-search-icn")}`,"aria-hidden":"true",width:"18",height:"18",role:"img",title:"Search icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},N(t,"opt-search-icn")),{children:[u.jsx("circle",{cx:"11",cy:"11",r:"8"}),u.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})),u.jsx("button",A(b({"data-testid":`${t}-srch-clr-btn`,type:"button","aria-label":"Clear search","data-dev-search-clear-btn":t,className:`${t}-icn ${t}-search-clear-btn ${x(t,"search-clear-btn")}`,tabIndex:"-1"},N(t,"search-clear-btn")),{children:u.jsxs("svg",{width:"13",height:"13",role:"img",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}))]}),Object.entries(_).map(([L,M],D)=>u.jsxs("ul",A(b({className:`${t}-option-list ${x(t,"option-list")}`,"aria-hidden":"true","aria-label":"Option List","data-list":L,"data-list-index":D,"data-dev-option-list":t,tabIndex:"-1",role:"listbox"},N(t,"option-list")),{children:[w&&u.jsxs("li",A(b({"data-testid":`${t}-opt-${D}`,"data-dev-option":t,"data-index":D,"data-value":"create-opt",className:"option create-opt",role:"option","aria-selected":"false",tabIndex:"-1"},N(t,"option")),{style:{display:"none"},children:[u.jsx("span",A(b({"data-dev-opt-lbl-wrp":t,className:`opt-lbl-wrp ${x(t,"opt-lbl-wrp")}`},N(t,"opt-lbl-wrp")),{children:u.jsx("span",{"data-dev-opt-lbl":t,className:"opt-lbl",children:"Create: "})})),u.jsx("span",{className:"opt-prefix"})]}),`option-${L}`),u.jsx(fm,{opts:M,fieldKey:t,optionIcon:I})]}),L)),u.jsx("ul",b({className:`${t}-option-list ${x(t,"option-list")} active-list`,"aria-hidden":"true","aria-label":"Option List","data-dev-option-list":t,tabIndex:"-1",role:"listbox"},N(t,"option-list")))]})}))]}))})})]})}var DT=F.memo(PT);const fm=({opts:t,fieldKey:e,optionIcon:s,isGroupChild:i})=>u.jsx(u.Fragment,{children:t.map((n,a)=>n.type==="group"?u.jsxs(F.Fragment,{children:[u.jsx("li",A(b({"data-testid":`${e}-opt-${a}`,"data-index":a,className:`option opt-group-title ${x(e,"opt-group-title")}`},N(e,"opt-group-title")),{children:u.jsx("span",{className:"opt-lbl",children:n.title})}),`option-grp-ttl-${n.title}`),u.jsx(fm,{opts:n.childs,fieldKey:e,optionIcon:s,isGroupChild:!0})]},n.title):u.jsxs("li",A(b({"data-testid":`${e}-opt-${a}`,"data-dev-option":e,"data-index":a,"data-value":n.val||n.lbl,className:`option ${i?`opt-group-child ${x(e,"option-group-child")}`:""}`,role:"option","aria-selected":"false",tabIndex:"-1"},N(e,"option")),{children:[u.jsxs("span",A(b({"data-dev-opt-lbl-wrp":e,className:`opt-lbl-wrp ${x(e,"opt-lbl-wrp")}`},N(e,"opt-lbl-wrp")),{children:[s&&u.jsx("img",{className:`opt-icn ${x(e,"opt-icn")}`,src:(n==null?void 0:n.img)||"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>",alt:"BD",loading:"lazy"}),u.jsx("span",{"data-dev-opt-lbl":e,className:"opt-lbl",children:n.lbl})]})),u.jsx("span",{className:"opt-prefix"})]}),`option-${n.val||n.lbl}}`))});function FT({fieldKey:t,attr:e,formID:s,styleClasses:i}){const a=et(jt)[t],l=(a==null?void 0:a.config)||{},c=Math.min(8,Math.max(4,l.otpLength||6));return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:i}),u.jsx(At,{formID:s,fieldKey:t,fieldData:e,children:u.jsxs("div",A(b({"data-testid":`${t}-inp-fld-wrp`,"data-dev-inp-fld-wrp":t,className:`${t}-inp-fld-wrp ${x(t,"inp-fld-wrp")}`},N(t,"inp-fld-wrp")),{children:[u.jsx("div",{className:`${t}-otp-boxes-wrp ${x(t,"otp-boxes-wrp")}`,"data-dev-otp-boxes-wrp":t,children:Array.from({length:c}).map((d,h)=>u.jsx("input",b({type:"text",inputMode:"numeric",maxLength:1,readOnly:!0,className:`${t}-otp-box ${t}-fld ${x(t,"otp-box")}`,"data-dev-otp-box":t,"aria-label":`OTP digit ${h+1}`},N(t,"otp-box")),h))}),u.jsxs("div",{className:`${t}-otp-actions-wrp ${x(t,"otp-actions-wrp")}`,"data-dev-otp-actions-wrp":t,children:[u.jsx("button",A(b({type:"button",className:`${t}-send-otp-btn ${x(t,"send-otp-btn")}`,"data-testid":`${t}-send-otp-btn`,"data-dev-send-otp-btn":t},N(t,"send-otp-btn")),{children:l.sendBtnTxt||ve("Send OTP")})),u.jsx("div",A(b({className:`${t}-resend-wrp ${x(t,"resend-wrp")}`,"data-testid":`${t}-resend-wrp`,"data-dev-resend-wrp":t},N(t,"resend-wrp")),{children:u.jsx("span",{className:`${t}-wait-txt ${x(t,"wait-txt")}`,"data-dev-wait-txt":t,children:(()=>{const d=l.waitTxt||ve("Wait ${bf_resend_countdown}s to Resend"),h=d.split("${bf_resend_countdown}");return h.length===2?u.jsxs(u.Fragment,{children:[h[0],u.jsx("span",{className:`${t}-countdown`,children:l.resendDelay||60}),h[1]]}):d})()})})),u.jsx("button",A(b({type:"button",className:`${t}-verify-btn ${x(t,"verify-btn")}`,"data-testid":`${t}-verify-btn`,"data-dev-verify-btn":t},N(t,"verify-btn")),{children:l.verifyBtnTxt||ve("Verify OTP")}))]})]}))})]})}var tn,Xl,uo,Us,Gn,Zl,fi,ie,mi,Ge,po,qr,fo,mo,xs,Zt,Be,Vs,Mi,me,z,mm,Rd,gm,Em,ml,gl,Cd,bm,Ql,Ns,Im,Od,rs,vm,Ma,je,El,xn,qi,ii,ni,wm,_m,Tm,$d;class jT{constructor(e,s){O(this,z);O(this,tn,null);O(this,Xl,null);O(this,uo,null);O(this,Us,null);O(this,Gn,null);O(this,Zl,null);O(this,fi,null);O(this,ie,null);O(this,mi,null);O(this,Ge,{});O(this,po,[]);O(this,qr,null);O(this,fo,{});O(this,mo,"");O(this,xs,{});O(this,Zt,{});O(this,Be,"");O(this,Vs,"");O(this,Mi,[]);O(this,me,{id:"upload",name:"upload",required:!0,multiple:!1,maxSize:0,sizeUnit:"KB",isItTotalMax:!1,showMaxSize:!1,showSelectStatus:!0,fileSelectStatus:"No Choosen File",allowedFileType:"",showFileList:!1,showFilePreview:!1,showFileSize:!1,accept:"",duplicateAllow:!1,capture:"",minFile:0,maxFile:0,onchange:()=>{},oninput:()=>{}});O(this,Ql,e=>{const s=e.target.getAttribute("data-file-id");o(this,z,Od).call(this,`#file-wrp-${s}`),delete r(this,Ge)[s];const i=Object.keys(r(this,Ge)).length;i?r(this,Us).innerText=`${i} file${i>1?"s":""} selected`:(r(this,Us).innerHTML=r(this,me).fileSelectStatus,o(this,z,gl).call(this)),o(this,z,Cd).call(this)});Object.assign(r(this,me),s),T(this,qr,s.document?s.document:document),T(this,fo,s.window?s.window:window),T(this,xs,s.attributes||{}),T(this,Zt,s.classNames||{}),T(this,mo,s.contentId||""),typeof e=="string"?T(this,tn,r(this,qr).querySelector(e)):T(this,tn,e),T(this,Be,r(this,me).fieldKey),this.fieldKey=r(this,Be),T(this,Vs,s.assetsURL||""),this.init()}init(){var c;T(this,Xl,o(this,z,Ns).call(this,`.${r(this,Be)}-label`)),T(this,uo,o(this,z,Ns).call(this,`.${r(this,Be)}-inp-btn`)),T(this,Us,o(this,z,Ns).call(this,`.${r(this,Be)}-file-select-status`)),T(this,Gn,o(this,z,Ns).call(this,`.${r(this,Be)}-file-input-wrpr`)),T(this,Zl,o(this,z,Ns).call(this,`.${r(this,Be)}-max-size-lbl`)),T(this,fi,o(this,z,Ns).call(this,`.${r(this,Be)}-file-upload-input`)),T(this,mi,o(this,z,Ns).call(this,`.${r(this,Be)}-file-input-wrpr .err-wrp`));const{multiple:e,allowedFileType:s,accept:i,showSelectStatus:n,fileSelectStatus:a,oldFiles:l}=r(this,me);r(this,fi).multiple=e,r(this,fi).accept=s?`${s}, ${i}`:i,n&&r(this,Us)?r(this,Us).innerHTML=a:(c=r(this,Us))==null||c.remove(),T(this,Ge,{}),o(this,z,gl).call(this),l&&o(this,z,Rd).call(this,l),o(this,z,Ma).call(this,r(this,fi),"change",d=>o(this,z,Em).call(this,d)),o(this,z,Ma).call(this,r(this,uo),"click",()=>r(this,fi).click())}checkValidate(){return r(this,Mi).length===0&&Object.keys(r(this,Ge)).length===0?"req":""}set value(e){o(this,z,Rd).call(this,e)}get value(){return r(this,Ge)}destroy(){r(this,ie)&&(r(this,ie).innerHTML=""),o(this,z,Tm).call(this)}reset(){this.destroy(),this.init()}}tn=new WeakMap,Xl=new WeakMap,uo=new WeakMap,Us=new WeakMap,Gn=new WeakMap,Zl=new WeakMap,fi=new WeakMap,ie=new WeakMap,mi=new WeakMap,Ge=new WeakMap,po=new WeakMap,qr=new WeakMap,fo=new WeakMap,mo=new WeakMap,xs=new WeakMap,Zt=new WeakMap,Be=new WeakMap,Vs=new WeakMap,Mi=new WeakMap,me=new WeakMap,z=new WeakSet,mm=function(e){if(typeof e=="string")try{return JSON.parse(e)}catch(s){if(e.includes(","))return e.split(",").filter(Boolean);if(e.trim()!=="")return[e.trim()]}return Array.isArray(e)?e:[]},Rd=function(e){const s=o(this,z,mm).call(this,e);T(this,Mi,s),r(this,ie)||o(this,z,ml).call(this),s.forEach(a=>{o(this,z,gm).call(this,a)});const i=o(this,z,$d).call(this);let n=r(this,Gn).querySelector(`input[name="${i}"]`);n||(n=o(this,z,rs).call(this,"input"),n.type="hidden",n.name=i,r(this,Gn).appendChild(n)),n.value=JSON.stringify(r(this,Mi))},gm=function(e){const s=o(this,z,rs).call(this,"div"),i=e.replace(/( |\.|\(|\))/g,"");if(s.id=`file-wrp-${i}`,o(this,z,je).call(this,s,"file-wrpr"),"file-wrpr"in r(this,Zt)){const c=r(this,Zt)["file-wrpr"];c&&o(this,z,ii).call(this,s,c)}if("file-wrpr"in r(this,xs)){const c=r(this,xs)["file-wrpr"];o(this,z,ni).call(this,s,c)}const n=o(this,z,rs).call(this,"div");o(this,z,je).call(this,n,"file-details");const a=o(this,z,rs).call(this,"a");if(o(this,z,je).call(this,a,"file-title"),"file-title"in r(this,Zt)){const c=r(this,Zt)["file-title"];c&&o(this,z,ii).call(this,a,c)}if("file-title"in r(this,me).attributes){const c=r(this,me).attributes["file-title"];o(this,z,ni).call(this,a,c)}o(this,z,qi).call(this,a,"target","_blank"),o(this,z,qi).call(this,a,"href",`${r(this,me).baseDLURL}&fileID=${e}`),o(this,z,xn).call(this,a,e),n.append(a),s.append(n);const l=o(this,z,rs).call(this,"button");if(o(this,z,je).call(this,l,"cross-btn"),"cross-btn"in r(this,Zt)){const c=r(this,Zt)["cross-btn"];c&&o(this,z,ii).call(this,l,c)}if(o(this,z,qi).call(this,l,"data-file-id",i),o(this,z,qi).call(this,l,"data-file-name",e),o(this,z,qi).call(this,l,"type","button"),"cross-btn"in r(this,me).attributes){const c=r(this,me).attributes["cross-btn"];o(this,z,ni).call(this,l,c)}o(this,z,xn).call(this,l,"×"),o(this,z,Ma).call(this,l,"click",c=>o(this,z,bm).call(this,c)),s.append(l),r(this,ie).appendChild(s)},Em=function(e){const{files:s}=r(this,fi),{sizeUnit:i,allowMaxSize:n,maxSize:a,maxSizeErrMsg:l,isItTotalMax:c,multiple:d,showFileList:h,fileExistMsg:p,showFilePreview:f,showFileSize:m,showSelectStatus:E,fileSelectStatus:g,minFile:I,minFileErrMsg:w,maxFile:S,maxFileErrMsg:_}=r(this,me),R=o(this,z,_m).call(this,i,a);let L=0;const M=[];o(this,z,El).call(this,r(this,mi),"active"),c&&Object.values(r(this,Ge)).forEach(G=>{L+=G.size}),!d&&s.length>0&&(T(this,Ge,{}),r(this,ie)&&o(this,z,xn).call(this,r(this,ie),""));for(let G=0;G<s.length;G+=1){const C=s[G],k=C.name.replace(/( |\.|\(|\))/g,"");if(r(this,Ge)[k])M.push(p);else if(!n||!a||C.size+L<=R)if(!(S>0)||Object.keys(r(this,Ge)).length<S){if(r(this,Ge)[k]=C,h){r(this,ie)||o(this,z,ml).call(this);const q=o(this,z,rs).call(this,"div");if(q.id=`file-wrp-${k}`,o(this,z,je).call(this,q,"file-wrpr"),"file-wrpr"in r(this,Zt)){const j=r(this,Zt)["file-wrpr"];j&&o(this,z,ii).call(this,q,j)}if("file-wrpr"in r(this,xs)){const j=r(this,xs)["file-wrpr"];o(this,z,ni).call(this,q,j)}if(f){const j=o(this,z,rs).call(this,"img");if(j.src=o(this,z,vm).call(this,C),j.alt="Image Uploaded",o(this,z,je).call(this,j,"file-preview"),"file-preview"in r(this,Zt)){const K=r(this,Zt)["file-preview"];K&&o(this,z,ii).call(this,j,K)}if("file-preview"in r(this,xs)){const K=r(this,xs)["file-preview"];o(this,z,ni).call(this,j,K)}q.append(j)}const W=o(this,z,rs).call(this,"div");o(this,z,je).call(this,W,"file-details");const V=o(this,z,rs).call(this,"span");if(o(this,z,je).call(this,V,"file-title"),"file-title"in r(this,Zt)){const j=r(this,Zt)["file-title"];j&&o(this,z,ii).call(this,V,j)}if("file-title"in r(this,me).attributes){const j=r(this,me).attributes["file-title"];o(this,z,ni).call(this,V,j)}if(o(this,z,xn).call(this,V,C.name),W.append(V),m){const j=o(this,z,rs).call(this,"span");if(o(this,z,je).call(this,j,"file-size"),"file-size"in r(this,Zt)){const K=r(this,Zt)["file-size"];K&&o(this,z,ii).call(this,j,K)}if("file-size"in r(this,me).attributes){const K=r(this,me).attributes["file-size"];o(this,z,ni).call(this,j,K)}o(this,z,xn).call(this,j,o(this,z,wm).call(this,C.size)),W.append(j)}q.append(W);const X=o(this,z,rs).call(this,"button");if(o(this,z,je).call(this,X,"cross-btn"),"cross-btn"in r(this,Zt)){const j=r(this,Zt)["cross-btn"];j&&o(this,z,ii).call(this,X,j)}if(o(this,z,qi).call(this,X,"data-file-id",k),"cross-btn"in r(this,me).attributes){const j=r(this,me).attributes["cross-btn"];o(this,z,ni).call(this,X,j)}o(this,z,xn).call(this,X,"×"),q.append(X),r(this,ie).append(q)}c&&(L+=C.size)}else r(this,mi).innerHTML=_,o(this,z,je).call(this,r(this,mi),"active"),setTimeout(()=>{o(this,z,El).call(this,r(this,mi),"active")},3e3);else M.push(l)}o(this,z,Im).call(this,`.${r(this,Be)}-file-input-wrpr .cross-btn`).forEach(G=>{o(this,z,Ma).call(this,G,"click",C=>r(this,Ql).call(this,C))});const D=Object.keys(r(this,Ge)).length;o(this,z,Cd).call(this),D&&E?r(this,Us).innerText=`${D} file${D>1?"s":""} selected`:E&&(r(this,Us).innerHTML=g),I>0&&D<I&&(r(this,mi).innerHTML=w,o(this,z,je).call(this,r(this,mi),"active")),!r(this,ie)&&M.length>0&&o(this,z,ml).call(this),M.map((G,C)=>{r(this,ie).insertAdjacentHTML("afterbegin",`
42 <div id='err-${C}' class="err-wrp">
43 ${G}
44 </div>`);const k=o(this,z,Ns).call(this,`#err-${C}`);o(this,z,je).call(this,k,"active"),setTimeout(()=>{o(this,z,El).call(this,k,"active")},3e3),setTimeout(()=>{k==null||k.remove(),Object.keys(r(this,Ge)).length||o(this,z,gl).call(this)},5e3)})},ml=function(){if(T(this,ie,o(this,z,rs).call(this,"div")),o(this,z,je).call(this,r(this,ie),"files-list"),"files-list"in r(this,Zt)){const e=r(this,Zt)["files-list"];e&&o(this,z,ii).call(this,r(this,ie),e)}if("files-list"in r(this,xs)){const e=r(this,xs)["files-list"];o(this,z,ni).call(this,r(this,ie),e)}r(this,Gn).append(r(this,ie))},gl=function(){var e;(e=r(this,ie))==null||e.remove(),T(this,ie,null)},Cd=function(){var s;const e=new DataTransfer;(s=Object.values(r(this,Ge)))==null||s.forEach(i=>{e.items.add(i)}),r(this,fi).files=e.files},bm=function(e){const s=e.target.getAttribute("data-file-id"),i=e.target.getAttribute("data-file-name");o(this,z,Od).call(this,`#file-wrp-${s}`),T(this,Mi,r(this,Mi).filter(n=>n!==i)),o(this,z,Ns).call(this,`input[name="${o(this,z,$d).call(this)}"]`).value=JSON.stringify(r(this,Mi))},Ql=new WeakMap,Ns=function(e){return r(this,tn).querySelector(e)},Im=function(e){return r(this,tn).querySelectorAll(e)},Od=function(e){var s;(s=o(this,z,Ns).call(this,e))==null||s.remove()},rs=function(e){return r(this,qr).createElement(e)},vm=function(e){switch(e.name.substring(e.name.lastIndexOf(".")+1)){case"xbm":case"tif":case"pjp":case"pjpeg":case"svgz":case"jpg":case"jpeg":case"ico":case"tiff":case"gif":case"svg":case"bmp":case"png":case"jfif":case"webp":return URL.createObjectURL(e);case"7z":case"arj":case"deb":case"pkg":case"rar":case".rpm":case".gz":case"z":case"zip":return`${r(this,Vs)}/zip-compressed.svg`;case"key":case"odp":case"pps":case"ppt":case"pptx":return`${r(this,Vs)}/presentation.svg`;case"_RF_":case"doc":case"docx":case"odt":case"pdf":case"rtf":case"tex":case"txt":case"wks":case"wps":case"wpd":return`${r(this,Vs)}/document.svg`;case"csv":case"dat":case"db":case"dbf":case"log":case"mdb":case"sav":case"sql":case"tar":case"sqlite":case"xml":return`${r(this,Vs)}/database.svg`;case"opus":case"flac":case"webm":case"weba":case"wav":case"ogg":case"m4a":case"mp3":case"oga":case"mid":case"amr":case"aiff":case"wma":case"au":case"acc":case"wpl":return`${r(this,Vs)}/file-audio.svg`;case"ogm":case"wmv":case"mpg":case"ogv":case"mov":case"asx":case"mpeg":case"mp4":case"m4v":case"avi":case"3gp":case"flv":case"mkv":case"swf":return`${r(this,Vs)}/file-audio.svg`;default:return`${r(this,Vs)}/paperclip.svg`}},Ma=function(e,s,i){e.addEventListener(s,i),r(this,po).push({element:e,eventType:s,eventAction:i})},je=function(e,s){e.classList.add(s)},El=function(e,s){e.classList.remove(s)},xn=function(e,s){e.textContent=s},qi=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},ii=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>o(this,z,je).call(this,e,i))},ni=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)o(this,z,qi).call(this,e,s[n].key,s[n].value)},wm=function(e){if(e<1024)return`${e}Bytes`;if(e>=1024&&e<1048576)return`${(e/1024).toFixed(1)}KB`;if(e>=1048576&&e<1073741824)return`${(e/1048576).toFixed(1)}MB`;if(e>=1073741824)return`${(e/1073741824).toFixed(1)}GB`},_m=function(e,s){switch(e){case"Bytes":return s;case"KB":return s*1024;case"MB":return s*1048576;case"GB":return s*1073741824;default:return 0}},Tm=function(){r(this,po).forEach(({element:e,eventType:s,eventAction:i})=>{e.removeEventListener(s,i)})},$d=function(){var e,s,i,n;if(typeof checkRepeatedField!="undefined"&&checkRepeatedField(r(this,Be),(s=(e=r(this,fo))==null?void 0:e.bf_globals)==null?void 0:s[r(this,mo)])){const a=(i=r(this,tn))==null?void 0:i.closest("[data-index]");if((n=a==null?void 0:a.dataset)!=null&&n.index)return`${r(this,Be)}_old[${a.dataset.index}]`}return`${r(this,Be)}_old`};function kT({fieldKey:t,formID:e,styleClasses:s}){const i=F.useRef(null),n=F.useRef(null),l=et(jt)[t],c=et(Mo),d=et(_e),{styleMode:h}=d;return F.useEffect(()=>{var K,B,H,tt,U,Z,J,it,at,vt,_t,ct,ut,Et;i!=null&&i.current||(i.current=Gt(`.${t}-file-up-wrpr`));const p=n.current,f=i.current;p&&f&&"destroy"in p&&p.destroy();const{multiple:m,allowMaxSize:E,showMaxSize:g,maxSizeLabel:I,maxSize:w,sizeUnit:S,isItTotalMax:_,showSelectStatus:R,fileSelectStatus:L,allowedFileType:M,showFileList:D,fileExistMsg:G,showFilePreview:C,showFileSize:k,duplicateAllow:q,accept:W,minFile:V,maxFile:X}=l.config,j={fieldKey:t,multiple:m,allowMaxSize:E,maxSizeErrMsg:((B=(K=l==null?void 0:l.err)==null?void 0:K.maxSize)==null?void 0:B.msg)||((tt=(H=l==null?void 0:l.err)==null?void 0:H.maxSize)==null?void 0:tt.dflt),showMaxSize:g,maxSizeLabel:I,maxSize:w,sizeUnit:S,isItTotalMax:_,showSelectStatus:R,fileSelectStatus:L,allowedFileType:M,showFileList:D,fileExistMsg:G,showFilePreview:C,showFileSize:k,duplicateAllow:q,accept:W,minFile:V,minFileErrMsg:((Z=(U=l==null?void 0:l.err)==null?void 0:U.minFile)==null?void 0:Z.msg)||((it=(J=l==null?void 0:l.err)==null?void 0:J.minFile)==null?void 0:it.dflt),maxFile:X,maxFileErrMsg:((vt=(at=l==null?void 0:l.err)==null?void 0:at.maxFile)==null?void 0:vt.msg)||((ct=(_t=l==null?void 0:l.err)==null?void 0:_t.maxFile)==null?void 0:ct.dflt),assetsURL:`${c.rootURL}/static/file-upload/`,document:(ut=document.getElementById("bit-grid-layout"))==null?void 0:ut.contentDocument,window:(Et=document.getElementById("bit-grid-layout"))==null?void 0:Et.contentWindow,attributes:{"files-list":Lt(t,"files-list"),"file-wrpr":Lt(t,"file-wrpr"),"file-preview":Lt(t,"file-preview"),"file-title":Lt(t,"file-title"),"file-size":Lt(t,"file-size"),"cross-btn":Lt(t,"cross-btn")},classNames:{"files-list":x(t,"files-list"),"file-wrpr":x(t,"file-wrpr"),"file-preview":x(t,"file-preview"),"file-title":x(t,"file-title"),"file-size":x(t,"file-size"),"cross-btn":x(t,"cross-btn")}};n.current=new jT(f,j)},[l]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:s}),u.jsx(At,{formID:e,fieldKey:t,fieldData:l,children:u.jsx("div",{className:`${t}-file-up-container ${x(t,"file-up-container")}`,children:u.jsx("div",A(b({"data-dev-file-up-wrpr":t,className:`${t}-file-up-wrpr ${l.valid.disabled?"disabled":""} ${l.valid.readonly?"readonly":""} ${x(t,"file-up-wrpr")}`,ref:i},N(t,"file-up-wrpr")),{children:u.jsxs("div",A(b({"data-dev-file-input-wrpr":t,"data-inp-wrp":!0,className:`${t}-file-input-wrpr ${x(t,"file-input-wrpr")}`},N(t,"file-input-wrpr")),{children:[u.jsxs("div",A(b({"data-dev-btn-wrpr":t,className:`${t}-btn-wrpr ${x(t,"btn-wrpr")}`},N(t,"btn-wrpr")),{children:[u.jsxs("button",A(b({"data-testid":`${t}-inp-btn`,"data-dev-inp-btn":t,type:"button",className:`${t}-inp-btn ${x(t,"inp-btn")}`},N(t,"inp-btn")),{children:[l.prefixIcn&&u.jsx("img",b({"data-dev-pre-i":t,className:`${t}-pre-i ${x(t,"pre-i")}`,src:`${l.prefixIcn}`,alt:"Upload icon",srcSet:""},N(t,"pre-i"))),u.jsx("span",A(b({"data-dev-btn-txt":t,className:`${t}-btn-txt ${x(t,"btn-txt")}`},N(t,"btn-txt")),{children:l.btnTxt})),l.suffixIcn&&u.jsx("img",b({"data-dev-suf-i":t,className:`${t}-suf-i ${x(t,"suf-i")}`,src:`${l.suffixIcn}`,alt:"Upload icon",srcSet:""},N(t,"suf-i")))]})),l.config.showSelectStatus&&u.jsx("div",A(b({"data-dev-file-select-status":t,className:`${t}-file-select-status ${x(t,"file-select-status")}`},N(t,"file-select-status")),{children:"No Choosen File"})),l.config.allowMaxSize&&l.config.showMaxSize&&l.config.maxSize!==0&&u.jsx("small",A(b({"data-dev-max-size-lbl":t,className:`${t}-max-size-lbl ${x(t,"max-size-lbl")}`},N(t,"max-size-lbl")),{children:l.config.maxSizeLabel||`(Max ${l.config.maxSize}${l.config.sizeUnit})`})),u.jsx("input",b(A(b(b(b(b(A(b({"data-testid":`${t}-fil-upld-inp`,type:"file",className:`${t}-file-upload-input ${x(t,"file-upload-input")}`},h&&{id:t}),{name:"file-upload"}),"req"in l.valid&&{required:l.valid.req}),"disabled"in l.valid&&{disabled:l.valid.disabled}),"readonly"in l.valid&&{readOnly:l.valid.readonly}),N(t,"file-upload-input")),{"aria-disabled":!0,tabIndex:-1}),!h&&{disabled:!0}))]})),u.jsx("div",b({className:`err-wrp ${x(t,"err-wrp")}`},N(t,"err-wrp")))]}))}))})})]})}function GT({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){var f,m;let{checked:l}=t.valid;const c=t.val||(l?t.msg.checked:t.msg.unchecked),[d,h]=F.useState(c);d===t.msg.unchecked?l=!1:d===t.msg.checked&&(l=!0);const p=E=>{if(t.valid.disabled)return;E.target.checked?h(t.msg.checked):h(t.msg.unchecked);const{form:g}=E.target;validateForm({input:{name:t.name,form:g,value:E.target.checked?t.msg.checked:t.msg.unchecked}})};return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:i,fieldKey:n,fieldData:t,noLabel:!0,children:u.jsxs("div",A(b({"data-dev-cc":n,className:`${n}-cc ${x(n,"cc")}`},N(n,"cc")),{children:[u.jsx("svg",{className:`${n}-cks`,children:u.jsx("symbol",{id:`${n}-ck-svg`,viewBox:"0 0 12 10",children:u.jsx("polyline",{className:`${n}-ck-svgline`,points:"1.5 6 4.5 9 10.5 1"})})}),u.jsxs("div",A(b({"data-dev-cw":n,className:`${n}-cw ${x(n,"cw")}`},N(n,"cw")),{children:[u.jsx("input",A(b(A(b(b(b({"data-testid":n,id:`${n}-decision`,type:"checkbox",className:`${n}-ci`},"req"in t.valid&&{required:t.valid.req}),"disabled"in t.valid&&{disabled:t.valid.disabled}),"readonly"in t.valid&&{readOnly:t.valid.readonly}),{defaultValue:(f=t==null?void 0:t.info)==null?void 0:f.lbl}),"fieldName"in t&&{name:t.fieldName}),{checked:l,value:d,onChange:p})),u.jsxs("label",A(b({"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-decision`,className:`${n}-cl ${x(n,"cl")}`},N(n,"cl")),{children:[u.jsx("span",A(b({"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${x(n,"bx")}`},N(n,"bx")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn`})})})),u.jsx("span",A(b({"data-dev-ct":n,className:`${n}-ct ${x(n,"ct")}`},N(n,"ct")),{children:u.jsx(We,{html:t.lbl||((m=t==null?void 0:t.info)==null?void 0:m.lbl)})}))]}))]}))]}))})]})}function BT({fieldKey:t,styleClasses:e}){var g;const s=F.useRef(null),i=F.useRef(null),a=et(jt)[t],l=et(un),{styleMode:c}=et(_e),d=((g=a.hidden)==null?void 0:g.includes(l))||!1,h=F.useRef(null),p=et(_g),{siteKey:f=""}=p||{},m=F.useCallback(()=>{var w;if(!window.hcaptcha||!s.current)return;let I=Gt(`.${t}-h-captcha`);if(h.current!==null)if(((w=window.hcaptcha.widgets)==null?void 0:w[h.current])!==void 0)try{window.hcaptcha.reset(h.current),Pt(t);return}catch(_){h.current=null}else h.current=null;I==null||I.remove(),I=document.createElement("div"),I.id=`${t}-h-captcha`,I.classList.add(`${t}-h-captcha`,"h-captcha"),s.current.appendChild(I),h.current=window.hcaptcha.render(I,{sitekey:f,theme:a.config.theme,size:a.config.size}),window.bitformHCaptchaWidgets||(window.bitformHCaptchaWidgets={}),window.bitformHCaptchaWidgets[t]=h.current,Pt(t),i.current&&clearInterval(i.current),i.current=setInterval(()=>{window.hcaptcha&&h.current!==null&&window.hcaptcha.reset(h.current)},3e4)},[t,f,a.config.theme,a.config.size]),E=F.useRef(m);return F.useEffect(()=>{E.current=m},[m]),F.useEffect(()=>{window.renderHCaptchaFunc=()=>E.current();const I={src:"https://js.hcaptcha.com/1/api.js?onload=renderHCaptchaFunc&render=explicit",integrity:"",id:"bf-h-captcha-script"};return Po(I),()=>{clearInterval(i.current),nh(I.id),delete window.renderHCaptchaFunc}},[]),F.useEffect(()=>{m()},[m]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:e}),u.jsx("div",{"data-dev-fld-wrp":t,className:`${t}-h-captcha-container ${t}-fld-wrp ${c?"":"drag"} ${d?"fld-hide":""}`,children:f!==""?u.jsx("div",{className:`${t}-h-captcha-wrp`,ref:s,children:u.jsx("div",{id:`${t}-h-captcha`,className:`${t}-h-captcha h-captcha`})}):u.jsxs("div",{children:["To Load hCaptcha Field, Please Configure Site Key and Secret."," ",u.jsx("strong",{children:"Go to App Settings"})]})})]})}function UT({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){const l=e.typ==="hidden"?"text":e.typ,c=F.useRef(null),[d,h]=F.useState(e.val!==void 0?e.val:"");return F.useEffect(()=>{e.val!==void 0&&!e.userinput?h(e.val):!e.val&&!e.userinput?h(e.defaultValue||""):e.conditional&&h(e.val)},[e.val,e.defaultValue,e.userinput,e.conditional]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:n,fieldKey:t,fieldData:e,noErrMsg:!0,children:u.jsx("div",A(b({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${x(t,"inp-fld-wrp")}`},N(t,"inp-fld-wrp")),{children:u.jsx("input",b(A(b(b(b({"data-testid":t,"data-dev-fld":t,id:t,list:`${t}-datalist`,ref:c,className:`${t}-fld no-drg ${x(t,"fld")}`,type:l},"ph"in e&&{placeholder:e.ph}),"fieldName"in e&&{name:e.fieldName}),s&&{onInput:s}),{value:d}),N(t,"fld")))}))})]})}var VT=F.memo(UT);function zT({fieldKey:t,attr:e,styleClasses:s}){var c,d;const{styleMode:i}=et(_e),n=((c=e.valid)==null?void 0:c.hide)||!1,a=e.content||((d=e==null?void 0:e.info)==null?void 0:d.content),l=F.useRef(null);return F.useEffect(()=>{const h=l.current;if(!h)return;const p=[...h.querySelectorAll("img, iframe")].filter(m=>!(m.tagName==="IMG"&&m.complete));if(!p.length)return;const f=()=>Pt(t);return p.forEach(m=>{m.addEventListener("load",f),m.addEventListener("error",f)}),()=>p.forEach(m=>{m.removeEventListener("load",f),m.removeEventListener("error",f)})},[a,t]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:s}),u.jsx("div",A(b({ref:l,"data-dev-fld-wrp":t,className:`${t}-fld-wrp ${i?"":"drag"} ${x(t,"fld-wrp")} ${n?"fld-hide":""}`},N(t,"fld-wrp")),{children:u.jsx(We,{html:a})}))]})}function WT({fieldKey:t,formID:e,styleClasses:s}){var a;const n=et(jt)[t];return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:s}),u.jsx(At,{formID:e,fieldKey:t,fieldData:n,children:u.jsxs("select",A(b(b(b(b({"data-testid":t,"data-dev-fld":t,id:t,className:`${t}-fld ${x(t,"fld")} no-drg ${n.readonly?"readonly":""}`},"disabled"in n.valid&&{disabled:n.valid.disabled}),"readonly"in n.valid&&{readOnly:n.valid.readonly}),N(t,"fld")),"req"in n.valid&&{required:n.valid.req}),{children:[n.phHide&&u.jsx("option",A(b({"data-dev-slct-optn":t,className:`${t}-slct-optn ${x(t,"slct-optn")}`,value:""},N(t,"slct-optn")),{children:n.ph})),(a=n==null?void 0:n.opt)==null?void 0:a.map(l=>{var c;return l.type?u.jsx("optgroup",A(b(b({"data-dev-slct-opt-grp":t,className:`${t}-slct-opt-grp ${x(t,"slct-opt-grp")}`,label:l.title},l.disabled&&{disabled:l.disabled}),b({},N(t,"slct-opt-grp"))),{children:(c=l==null?void 0:l.childs)==null?void 0:c.map(d=>u.jsx("option",A(b(b({"data-dev-slct-optn":t,className:`${t}-slct-optn ${x(t,"slct-optn")}`,value:d.val,selected:d.check},d.disabled&&{disabled:d.disabled}),b({},N(t,"slct-optn"))),{children:d.lbl}),d.val||d.lbl))}),l.title):u.jsx("option",A(b(b({"data-dev-slct-optn":t,className:`${t}-slct-optn ${x(t,"slct-optn")}`,value:l.val,selected:l.check},l.disabled&&{disabled:l.disabled}),b({},N(t,"slct-optn"))),{children:l.lbl}),l.val||l.lbl)})]}))})]})}function HT({fieldKey:t,attr:e,styleClasses:s}){var G;const i=F.useRef(),n=F.useRef({}),a=et(ca),l=et(un),{styleMode:c}=et(_e),d=ti(Do),h=((G=e.valid.hidden)==null?void 0:G.includes(l))||!1,p=Ks(s),f=ti(jt),{width:m,height:E}=e,g=C=>`fields->${t}->classes->.${t}-fld-wrp->${C}`;a.fieldKey===t&&(n.current.resize=!0,d(C=>re(C,k=>{_r(k,g("max-height"),"")}))),n.current.resize&&!a.fieldKey&&(n.current.resize=!1,d(C=>re(C,k=>{var q,W,V;_r(k,g("height"),`${(q=i==null?void 0:i.current)==null?void 0:q.parentElement.clientHeight}px`),_r(k,g("width"),`${(W=i==null?void 0:i.current)==null?void 0:W.parentElement.clientWidth}px`),_r(k,g("max-height"),`${(V=i==null?void 0:i.current)==null?void 0:V.parentElement.clientHeight}px`)})),f(C=>re(C,k=>{var q,W;k[t].height=(q=i==null?void 0:i.current)==null?void 0:q.parentElement.clientHeight,k[t].width=(W=i==null?void 0:i.current)==null?void 0:W.parentElement.clientWidth}))),F.useEffect(()=>{e!=null&&e.bg_img||f(C=>re(C,k=>{var q,W;k[t].height=(q=i==null?void 0:i.current)==null?void 0:q.parentElement.clientHeight,k[t].width=(W=i==null?void 0:i.current)==null?void 0:W.parentElement.clientWidth}))},[]);const I=Number(m)>0?Number(m):0,w=Number(E)>0?Number(E):0,S=()=>Pt(t),_=C=>{C&&(C.style.setProperty("max-width","100%"),C.style.setProperty("vertical-align","top"),C.style.removeProperty("object-fit"),I?(C.style.setProperty("width",`${I}px`),C.style.setProperty("height","auto","important")):w?(C.style.setProperty("width","auto"),C.style.setProperty("height",`${w}px`,"important"),C.style.setProperty("object-fit","contain")):(C.style.setProperty("width","auto"),C.style.setProperty("height","auto","important")))},R=e!=null&&e.bg_img?b(b({maxWidth:"100%",height:"auto"},!I&&{width:"auto"}),!w&&{maxHeight:"none"}):void 0,L=m||100,M=E||40,D=Math.max(10,Math.min(14,Math.floor(Math.min(L,M)/4)));return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:p}),u.jsx("div",A(b({"data-dev-fld-wrp":t,ref:i,style:R,className:`${t}-fld-wrp ${c?"":"drag"} ${h?"fld-hide":""} ${x(t,"fld-wrp")}`},N(t,"fld-wrp")),{children:e!=null&&e.bg_img?u.jsx("img",A(b({"data-dev-img":t,className:`${t}-img ${x(t,"img")}`,src:e.bg_img,alt:e==null?void 0:e.alt},N(t,"img")),{ref:_,width:I||void 0,height:w||void 0,draggable:!1,onLoad:S,onError:S})):u.jsxs("svg",A(b({"data-dev-img":t,className:`${t}-img ${x(t,"img")}`,xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:`0 0 ${L} ${M}`},N(t,"img")),{children:[u.jsx("rect",{width:"100%",height:"100%",fill:"#ececec"}),u.jsx("line",{x1:"0",y1:"0",x2:L,y2:M,stroke:"#ccc",strokeWidth:"1"}),u.jsx("line",{x1:L,y1:"0",x2:"0",y2:M,stroke:"#ccc",strokeWidth:"1"}),u.jsxs("text",{x:"50%",y:"50%",dominantBaseline:"middle",textAnchor:"middle",fontFamily:"sans-serif",fontSize:D,fill:"#999",children:[L," × ",M]})]}))}))]})}function qT({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){const[l,c]=F.useState(t.val||""),d=F.useRef([]),[h,p]=F.useState({checked:[]});d.current=t.opt.map((m,E)=>{var g;return(g=d.current[E])!=null?g:F.createRef()});const f=(m,E)=>{const{checked:g}=m.target;if(g&&t.inpType==="checkbox")h.checked.push(E),c(null);else{const I=h.checked.indexOf(E);h.checked.splice(I,1),p({checked:h.checked})}g&&t.inpType==="radio"?(h.checked=[],c(m.target.value)):c(""),Pt(n)};return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:i,fieldKey:n,fieldData:t,children:u.jsx("div",A(b({"data-testid":`${n}-inp-fld-wrp`,"data-dev-inp-fld-wrp":n,className:`${n}-inp-fld-wrp ${x(n,"inp-fld-wrp")}`},N(n,"inp-fld-wrp")),{children:u.jsx("div",A(b({"data-testid":`${n}-ic`,"data-dev-ic":n,className:`${n}-ic ${x(n,"ic")}`},N(n,"ic")),{children:t.opt.map((m,E)=>u.jsxs("div",A(b({"data-testid":`${n}-inp-opt`,"data-dev-inp-opt":n,className:`${n}-inp-opt ${x(n,"inp-opt")}`},N(n,"inp-opt")),{children:[u.jsx("input",A(b(A(b({className:`${n}-img-inp ${x(n,"img-inp")}`,type:t.inpType,"aria-label":m.lbl,id:`${n}-img-wrp-${E}`,name:n,value:m.val||m.lbl},t.valid.req&&{required:!0}),{checked:l===m.val||h.checked.includes(E)||(m==null?void 0:m.check),disabled:t.valid.disabled,onChange:g=>f(g,E)}),N(n,"img-inp")),{"data-dev-img-inp":n})),u.jsxs("label",A(b({"data-testid":`${n}-img-wrp`,"data-dev-img-wrp":n,htmlFor:`${n}-img-wrp-${E}`,className:`${n}-img-wrp ${x(n,"img-wrp")}`},N(n,"img-wrp")),{children:[u.jsx("span",A(b({"data-testid":`${n}-check-box`,"data-dev-check-box":n,className:`${n}-check-box ${x(n,"check-box")}`},N(n,"check-box")),{children:u.jsx("img",b({src:t.tickImgSrc,alt:"","data-testid":`${n}-check-img`,"data-dev-check-img":n,className:`${n}-check-img ${x(n,"check-img")}`},N(n,"check-img")))})),u.jsxs("span",A(b({"data-testid":`${n}-img-card-wrp`,"data-dev-img-card-wrp":n,className:`${n}-img-card-wrp ${x(n,"img-card-wrp")}`},N(n,"img-card-wrp")),{children:[u.jsx("img",b({src:m.img,alt:m.lbl,"aria-label":m.lbl,"data-testid":`${n}-select-img`,"data-dev-select-img":n,className:`${n}-select-img ${x(n,"select-img")}`},N(n,"select-img"))),!t.optLblHide&&u.jsx("div",A(b({"data-testid":`${n}-tc`,"data-dev-tc":n,className:`${n}-tc ${x(n,"tc")}`},N(n,"tc")),{children:u.jsx("span",A(b({"data-testid":`${n}-img-title`,"data-dev-img-title":n,className:`${n}-img-title ${x(n,"img-title")}`},N(n,"img-title")),{children:u.jsx(We,{html:m.lbl})}))}))]}))]}))]}),`opr-${E+22}`))}))}))})]})}function YT({fieldKey:t,formID:e,attr:s,isBuilder:i,styleClasses:n}){const a=et(oc),[l,c]=F.useState(""),h=et(jt)[t],[p,f]=F.useState(!1),m=rh(),{currency:E,redirect_url:g}=h.config||{};return F.useEffect(()=>{if(!s.payIntegID){c(""),m(`field-settings/${t}`);return}const I=a==null?void 0:a.find(w=>w.id&&s.payIntegID&&Number(w.id)===Number(s.payIntegID));if(I){const w=I.apiKey;c(w)}},[s.payIntegID]),F.useEffect(()=>{if(!l){za({fieldKey:t,errorKey:"mollieApiKeyMissing",errorMsg:ve("Mollie API key is missing"),errorUrl:`field-settings/${t}`});return}g||za({fieldKey:t,errorKey:"mollieRedirectUrlMissing",errorMsg:ve("Mollie Redirect Url is not Selected"),errorUrl:`field-settings/${t}`}),f(!1),lc(t,"mollieApiKeyMissing"),Pt(t)},[l,E,g]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:n}),u.jsxs(At,{formID:e,fieldData:s,fieldKey:t,noLabel:!0,isBuilder:i,children:[l&&!p&&u.jsx("div",{className:`${t}-mollie-wrp`,children:u.jsxs("button",{"data-dev-mollie-btn":t,type:"button",className:`${t}-mollie-btn`,children:[u.jsx("svg",{"data-dev-mollie-icn":t,version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 80 80",xmlSpace:"preserve",className:`${t}-mollie-icn`,children:u.jsx("path",{strokeWidth:"6",fill:"currentColor",d:"M74.79,39.15v21.4c0,0.36-0.07,0.46-0.44,0.46c-3.59-0.02-7.21-0.02-10.8,0c-0.41,0-0.51-0.1-0.51-0.51 c0.02-6.94,0-13.86,0.02-20.79c0-2.89-0.97-5.31-3.25-7.09c-2.62-2.06-5.56-2.5-8.64-1.21c-3.03,1.26-4.76,3.62-5.24,6.89 c-0.05,0.49-0.07,0.99-0.07,1.48c0,6.89,0,13.78,0.02,20.7c0,0.41-0.1,0.53-0.53,0.53c-3.57-0.02-7.16-0.02-10.75,0 c-0.36,0-0.46-0.1-0.46-0.49V39.73c0.02-2.89-0.97-5.34-3.28-7.13c-2.62-2.04-5.56-2.48-8.61-1.19c-3.03,1.26-4.76,3.62-5.22,6.87 c-0.07,0.51-0.07,1.02-0.07,1.53c0,6.89-0.02,13.81,0,20.7c0,0.41-0.1,0.51-0.51,0.51c-3.59-0.02-7.18-0.02-10.77,0 c-0.36,0-0.46-0.1-0.46-0.46c0.02-7.3-0.05-14.61,0.05-21.94c0.05-4.97,1.89-9.37,5.29-13.01c4.54-4.9,10.19-7.09,16.86-6.53 c4.76,0.39,8.83,2.35,12.28,5.63c0.24,0.24,0.36,0.24,0.61,0c4.78-4.46,10.41-6.38,16.91-5.53c8.83,1.14,15.8,7.93,17.28,16.72 C74.69,36.99,74.79,38.06,74.79,39.15z"})})," ",h.txt]})}),!p&&!l&&u.jsxs("p",{children:["Please select a Mollie account from",u.jsx("strong",{children:" Field Settings "}),"to load Mollie field."]}),p&&u.jsx("p",{children:"Loading mollie..."})]})]})}var en,sn,yt,Ni,Bn,Jl,lt,pr,yd,gs,xm,Ld,Sm,Rm,Cm,Ad,Om,Md,Nd,$m,Pd,Na,ym,Lm,bl;class XT{constructor(e,s){O(this,lt);O(this,en,"");O(this,sn,"");O(this,yt,{namespace:"paypal",payType:"payment",currency:"USD",amount:1,shipping:0,tax:0,style:{label:"paypal",color:"gold",shape:"rect",layout:"vertical"}});O(this,Ni,null);O(this,Bn,!1);O(this,Jl,()=>o(this,lt,Md).call(this));var i;Object.assign(r(this,yt),s),typeof e=="string"?T(this,en,document.querySelector(e)):T(this,en,e),T(this,sn,`#form-${o(this,lt,gs).call(this)}`),(i=document.querySelector(r(this,sn)))==null||i.addEventListener("bf-form-submit-success",r(this,Jl)),this.init()}init(){const{namespace:e}=r(this,yt),s=window[e],i={style:o(this,lt,Lm).call(this)};o(this,lt,yd).call(this)&&(i.fundingSource=s.FUNDING[r(this,yt).style.payBtn]),o(this,lt,pr).call(this)?i.createSubscription=(n,a)=>o(this,lt,xm).call(this,n,a):i.createOrder=(n,a)=>o(this,lt,ym).call(this,n,a),i.onClick=(n,a)=>o(this,lt,Sm).call(this,a),i.onApprove=(n,a)=>o(this,lt,Rm).call(this,n,a),r(this,yt).onInit&&(i.onInit=r(this,yt).onInit),s&&s.Buttons(i).render(r(this,en))}destroy(){o(this,lt,Md).call(this),r(this,en).innerHTML=""}reset(){this.destroy(),this.init()}}en=new WeakMap,sn=new WeakMap,yt=new WeakMap,Ni=new WeakMap,Bn=new WeakMap,Jl=new WeakMap,lt=new WeakSet,pr=function(){return r(this,yt).payType==="subscription"},yd=function(){return r(this,yt).style.layout==="standalone"},gs=function(){return r(this,yt).contentId},xm=function(e,s){if(typeof validateForm!="undefined"&&!validateForm({form:o(this,lt,gs).call(this)}))throw new Error("form validation is failed!");const i={plan_id:r(this,yt).planId};return o(this,lt,Ld).call(this,"bf-paypal-subscription-options",{subData:i}),s.subscription.create(i)},Ld=function(e,s){var n,a;const i=A(b({},s),{config:r(this,yt),contentId:o(this,lt,gs).call(this)});(a=(n=r(this,en))==null?void 0:n.dispatchEvent)==null||a.call(n,new CustomEvent(e,{bubbles:!0,detail:i}))},Sm=function(e){return ba(this,null,function*(){const s=o(this,lt,gs).call(this);if(r(this,Bn))return o(this,lt,Ad).call(this),e.reject();try{yield isFormValidatedWithoutError(s)}catch(a){return e.reject()}const i=yield saveFormProgress(s),n=i==null?void 0:i[s];return n!=null&&n.success?(n.data.entry_id&&T(this,Ni,n.data.entry_id),e.resolve()):e.reject()})},Rm=function(e,s){const i=document.getElementById(`${o(this,lt,gs).call(this)}`);i.classList.add("pos-rel","form-loading"),(o(this,lt,pr).call(this)?s.subscription.get():s.order.capture()).then(a=>{const l=o(this,lt,$m).call(this,a);l&&o(this,lt,Cm).call(this,l,a)}).catch(a=>{i.classList.remove("pos-rel","form-loading")}).finally(()=>{i.classList.remove("pos-rel","form-loading")})},Cm=function(e,s){var l;const i=bf_globals[o(this,lt,gs).call(this)],n=document.getElementById(`form-${o(this,lt,gs).call(this)}`),a=(l=o(this,lt,gs).call(this))==null?void 0:l.split("_")[1];if(typeof n!="undefined"&&n!==null){r(this,Ni)&&(i.entryId=r(this,Ni));const c=bfSelect(`input[name="${r(this,yt).fieldKey}"]`,n);c?c.value=e:setHiddenFld({name:r(this,yt).fieldKey,value:e,type:"text"},n),o(this,lt,Ad).call(this),o(this,lt,Om).call(this);const d={formID:a,transactionID:e,payment_name:"paypal",payment_type:o(this,lt,pr).call(this)?"subscription":"order",payment_response:s,entry_id:r(this,Ni),fieldKey:r(this,yt).fieldKey},h=new URL(i==null?void 0:i.ajaxURL);h.searchParams.append("_ajax_nonce",i==null?void 0:i.nonce),h.searchParams.append("action","bitforms_payment_insert"),fetch(h,{method:"POST",body:JSON.stringify(d),keepalive:!0}).then(()=>{T(this,Ni,null);const p=bfSelect(`input[name="${r(this,yt).fieldKey}"]`,n);p&&(p.value="",p.setAttribute("value",""))})}},Ad=function(){const e=document.getElementById(`form-${o(this,lt,gs).call(this)}`);if(!e)return;let s=bfSelect('button[type="submit"]',e);s||(s=document.createElement("button"),s.setAttribute("type","submit"),s.style.display="none",e.append(s)),s.click()},Om=function(){T(this,Bn,!0),o(this,lt,Nd).call(this,"Payment received. If the form does not finish submitting, click the PayPal button again to retry the submission — you will not be charged again.")},Md=function(){r(this,Bn)&&(T(this,Bn,!1),o(this,lt,Nd).call(this,""))},Nd=function(e){const s=bfSelect(`${r(this,sn)} .${r(this,yt).fieldKey}-err-wrp`),i=s&&bfSelect(`.${r(this,yt).fieldKey}-err-txt`,s),n=s&&bfSelect(`.${r(this,yt).fieldKey}-err-msg`,s);!i||!n||(i.innerHTML=e,e?(n.style.removeProperty("display"),setStyleProperty(s,"height",`${i.parentElement.scrollHeight}px`),setStyleProperty(s,"opacity",1)):(setStyleProperty(n,"display","none"),setStyleProperty(s,"height",0),setStyleProperty(s,"opacity",0)))},$m=function(e){let s=null;if(o(this,lt,pr).call(this)&&e.id)s=e.id;else if(e.purchase_units&&e.purchase_units[0]&&e.purchase_units[0].payments){const{payments:i}=e.purchase_units[0];i.captures&&i.captures[0]&&(s=i.captures[0].id)}return s},Pd=function(e,s){var i;return(i=document.querySelector(s))==null?void 0:i.querySelector(e)},Na=function(e){if(e){const s=window.bf_globals[o(this,lt,gs).call(this)].fields[e].fieldName;let i=o(this,lt,Pd).call(this,`[name="${s}"]`,r(this,sn));if(i&&i.type==="radio"&&(i=o(this,lt,Pd).call(this,`[name="${s}"]:checked`,r(this,sn))),i&&i.value)return i.value}return""},ym=function(e,s){var R,L;const{currency:i,amount:n,shipping:a,tax:l}=r(this,yt),c=o(this,lt,Na).call(this,r(this,yt).amountFld)||n,d=o(this,lt,Na).call(this,r(this,yt).shippingVal)||a,h=o(this,lt,Na).call(this,r(this,yt).taxVal)||l,p=o(this,lt,bl).call(this,c).toFixed(2)*1,f=o(this,lt,bl).call(this,d).toFixed(2)*1,m=(o(this,lt,bl).call(this,h)*p/100).toFixed(2)*1,E=(p+f+m).toFixed(2)*1,g=(R=o(this,lt,gs).call(this))==null?void 0:R.split("_")[1],I=(L=r(this,yt))==null?void 0:L.fieldKey,w=o(this,lt,Na).call(this,r(this,yt).descFld)||r(this,yt).description,S=`form-id:${g};entry-id:${r(this,Ni)};field-key:${I}`,_={purchase_units:[{description:w,custom_id:S,amount:{currency_code:i,value:E,breakdown:{item_total:{currency_code:i,value:p},shipping:{currency_code:i,value:f},tax_total:{currency_code:i,value:m}}}}]};return o(this,lt,Ld).call(this,"bf-paypal-order-options",{order:_}),s.order.create(_)},Lm=function(){const{label:e,color:s,shape:i,layout:n,height:a}=r(this,yt).style,l={label:o(this,lt,pr).call(this)?"subscribe":e,color:s,shape:i};return o(this,lt,yd).call(this)||(l.layout=n),a!==void 0&&(l.height=Number(a)),l},bl=function(e){var n;if(e==null||e==="")return 0;if(typeof e=="number"&&!Number.isNaN(e))return e;const s=/[\d,.]*\d(?:\.\d+)?/,i=(n=String(e))==null?void 0:n.match(s);return i?parseFloat(i[0].replace(/,/g,"")):0};function ZT({fieldKey:t,formID:e,attr:s,isBuilder:i,styleClasses:n}){const a=et(oc),[l,c]=F.useState(""),h=et(jt)[t],p=F.useRef(null),f=F.useRef(null),m=F.useRef(0),[E,g]=F.useState(""),I=!!E,[w,S]=F.useState(!1),_=(h==null?void 0:h.payType)==="subscription",{locale:R,currency:L,disableFunding:M}=h||{};return F.useEffect(()=>{if(!s.payIntegID){c("");return}const D=a==null?void 0:a.find(G=>G.id&&s.payIntegID&&Number(G.id)===Number(s.payIntegID));if(D){const G=D.clientID;c(G)}},[s.payIntegID]),F.useEffect(()=>{if(!l){za({fieldKey:t,errorKey:"paypalClientIdMissing",errorMsg:ve("PayPal Client ID is missing"),errorUrl:`field-settings/${t}`});return}S(!0),lc(t,"paypalClientIdMissing");const D={"client-id":l};h!=null&&h.locale&&(D.locale=h.locale),h!=null&&h.disableFunding&&(D["disable-funding"]=h.disableFunding),_&&(D.intent="subscription",D.vault="true"),!_&&(h!=null&&h.currency)&&(D.currency=h.currency);const G=`https://www.paypal.com/sdk/js?${new URLSearchParams(D).toString()}`;m.current+=1;const C=`${t}_sdk${m.current}`;let k=!1;const q={src:G,integrity:"",id:`bf-paypal-script-${t}`,scriptInGrid:!1,attr:{"data-namespace":C},callback:()=>{k||!window[C]||(g(W=>(W&&W!==C&&delete window[W],C)),S(!1),Pt(t))}};return Po(q),()=>{k=!0}},[l,R,L,M,_]),F.useEffect(()=>{if(!E||w)return;p!=null&&p.current||(p.current=Gt(`#${t}-paypal-wrp`));const D=f.current,G=p.current;if(D&&G&&"destroy"in D&&(D.destroy(),Pt(t)),!l)return g("");const{style:C,currency:k}=h,q={namespace:E,style:C,currency:k,payType:"payment",shipping:0,tax:0,onInit:()=>{Pt(t)}};f.current=new XT(G,q)},[E,w]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:n}),u.jsxs(At,{formID:e,fieldData:s,fieldKey:t,noLabel:!0,noErrMsg:!0,isBuilder:i,children:[I&&l&&!w&&u.jsx("div",{className:`${t}-paypal-wrp`,children:u.jsx("div",{ref:p,id:`${t}-paypal-wrp`})}),!w&&(!I||!l)&&u.jsxs("p",{children:["Please select a PayPal account from",u.jsx("strong",{children:" Field Settings "}),"to load PayPal field."]}),w&&u.jsx("p",{children:"Loading PayPal..."})]})]})}var Yr,Kl,ih,Le,Ae,Pi,Ss,go,Xr,gi,tc,Me,Eo,ne,Ei,zs,bo,Ws,Zr,Qr,Jr,Io,bi,vo,rt,Kr,wo,ta,Di,Hs,$,Am,Se,Je,Mm,Nm,Pm,Dm,Il,Fm,Pa,vl,Dd,jm,km,wl,Fd,fr,Sn,jd,Gm,Bm,Um,kd,ec,mr,Gd,_l,Vm,Bd,Rn,Ud,gr,Ps,Tl,kt,Er,br,Ke,JT,Vd,zm,zd,Wd,Wm,Hm,Ir,qm,Hd,Ym;class QT{constructor(e,s){O(this,$);O(this,Yr,"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>");O(this,Kl,"www.cloudflare.com/cdn-cgi/trace");O(this,ih,"api.geonames.org/countryCodeJSON?username=bitcodezoho1");O(this,Le,null);O(this,Ae,null);O(this,Pi,null);O(this,Ss,null);O(this,go,null);O(this,Xr,null);O(this,gi,null);O(this,tc,null);O(this,Me,null);O(this,Eo,null);O(this,ne,null);O(this,Ei,null);O(this,zs,null);O(this,bo,30);O(this,Ws,[]);O(this,Zr,{});O(this,Qr,{});O(this,Jr,!1);O(this,Io,null);O(this,bi,!1);O(this,vo,[]);O(this,rt,{maxHeight:370,detectCountryByIp:!1,detectCountryByGeo:!1,optionFlagImage:!1,searchCountryPlaceholder:"Search Country",noCountryFoundText:"No Country Found",searchClearable:!0,inputFormat:"+c #### ### ###",valueFormat:"+c #### ### ###",defaultCountryKey:"",attributes:{},classNames:{}});O(this,Kr,"");O(this,wo,null);O(this,ta,"");O(this,Di,null);O(this,Hs,null);O(this,ec,e=>/[0-9]/.test(e));Object.assign(r(this,rt),s),T(this,Di,s.document||document),T(this,Hs,s.window||window),T(this,Kr,s.assetsURL||""),typeof e=="string"?T(this,Le,r(this,Di).querySelector(e)):T(this,Le,e),typeof r(this,rt).options=="string"&&(r(this,rt).options=o(this,$,Am).call(this,r(this,rt).options)),r(this,rt).options=r(this,rt).options.filter(i=>!i.hide),T(this,Ws,[...r(this,rt).options]),T(this,Zr,o(this,$,jm).call(this)),T(this,Qr,o(this,$,km).call(this)),this.fieldKey=r(this,rt).fieldKey,T(this,Io,r(this,rt).contentId),this.init()}init(){T(this,Eo,o(this,$,Se).call(this,`.${this.fieldKey}-phone-inner-wrp`)),T(this,ne,o(this,$,Se).call(this,`.${this.fieldKey}-phone-number-input`)),T(this,Ae,o(this,$,Se).call(this,`.${this.fieldKey}-phone-hidden-input`)),T(this,Pi,o(this,$,Se).call(this,`.${this.fieldKey}-input-clear-btn`)),T(this,Xr,o(this,$,Se).call(this,`.${this.fieldKey}-selected-country-img`)),T(this,tc,o(this,$,Se).call(this,`.${this.fieldKey}-option-search-wrp`)),T(this,Me,o(this,$,Se).call(this,`.${this.fieldKey}-opt-search-input`)),T(this,Ss,o(this,$,Se).call(this,`.${this.fieldKey}-dpd-wrp`)),T(this,go,o(this,$,Se).call(this,`.${this.fieldKey}-option-wrp`)),T(this,Ei,o(this,$,Se).call(this,`.${this.fieldKey}-search-clear-btn`)),T(this,zs,o(this,$,Se).call(this,`.${this.fieldKey}-option-list`)),this.setMenu({open:!1}),o(this,$,Je).call(this,r(this,Le),"keydown",e=>{o(this,$,Dm).call(this,e)}),o(this,$,Je).call(this,r(this,Ss),"click",e=>{o(this,$,Hd).call(this,e)}),o(this,$,Je).call(this,r(this,Ss),"keyup",e=>{o(this,$,Hd).call(this,e)}),o(this,$,Mm).call(this),r(this,rt).defaultCountryKey&&!r(this,gi)&&this.setSelectedCountryItem(r(this,rt).defaultCountryKey),o(this,$,Je).call(this,r(this,ne),"blur",e=>{o(this,$,Gm).call(this,e)}),o(this,$,Je).call(this,r(this,ne),"input",e=>{o(this,$,Bm).call(this,e)}),o(this,$,Je).call(this,r(this,ne),"keydown",e=>{o(this,$,Um).call(this,e)}),o(this,$,Je).call(this,r(this,ne),"focusout",e=>{o(this,$,Gd).call(this,e)}),r(this,rt).selectedCountryClearable&&o(this,$,Je).call(this,r(this,Pi),"click",e=>{o(this,$,Fm).call(this,e)}),r(this,rt).detectCountryByIp&&o(this,$,Nm).call(this),r(this,rt).detectCountryByGeo&&o(this,$,Pm).call(this),r(this,rt).searchClearable&&(o(this,$,Ke).call(this,r(this,Me),"padding-right","35px"),o(this,$,Ke).call(this,r(this,Ei),"display","none"),o(this,$,Je).call(this,r(this,Ei),"click",()=>{this.searchOptions("")})),r(this,Me)&&(r(this,Me).value=""),o(this,$,Je).call(this,r(this,Me),"keyup",e=>{o(this,$,Hm).call(this,e)}),T(this,Yr,r(this,rt).placeholderImage?r(this,rt).placeholderImage:r(this,Yr)),r(this,Hs).observeElm(r(this,Ae),"value",(e,s)=>{o(this,$,jd).call(this,e,s)})}isValidated(){return o(this,$,Gd).call(this,{target:r(this,Ae)})}setSelectedCountryItem(e){var n;const s=((n=o(this,$,Rn).call(this))==null?void 0:n.code)||"";if(this.value="",T(this,gi,e),!r(this,gi)){o(this,$,zd).call(this);return}const i=o(this,$,Rn).call(this);i&&(r(this,rt).selectedFlagImage&&(r(this,Xr).src=`${r(this,Kr)}/${i.img}`),o(this,$,zm).call(this,i.code,s),this.setMenu({open:!1}),r(this,bi)&&r(this,ne).focus())}searchOptions(e){o(this,$,Wm).call(this,e);let s=[];e?(s=r(this,rt).options.filter(i=>{const n=e.toLowerCase(),a=(i.lbl||"").toLowerCase(),l=(i.val||"").toLowerCase(),c=i.code||"";if(a.includes(n)||l.includes(n)||c.includes(n))return!0}),s.length||(s=[{i:0,lbl:r(this,rt).noCountryFoundText}]),T(this,Ws,s),r(this,rt).searchClearable&&o(this,$,Ke).call(this,r(this,Ei),"display","grid")):(T(this,Ws,r(this,rt).options),r(this,rt).searchClearable&&o(this,$,Ke).call(this,r(this,Ei),"display","none")),o(this,$,Wd).call(this)}setMenu({open:e}){var s;o(this,$,Ke).call(this,r(this,go),"max-height",`${e?r(this,rt).maxHeight:0}px`),e?(o(this,$,qm).call(this),o(this,$,Ps).call(this,r(this,Le),"menu-open"),o(this,$,Je).call(this,r(this,Di),"click",i=>o(this,$,Dd).call(this,i)),o(this,$,kt).call(this,r(this,Me),"tabindex",0),o(this,$,kt).call(this,r(this,Ei),"tabindex",0),o(this,$,kt).call(this,r(this,Ss),"aria-expanded",!0),o(this,$,Wd).call(this)):(r(this,Le).classList.remove("menu-open"),r(this,Di).removeEventListener("click",o(this,$,Dd)),setTimeout(()=>{this.searchOptions("")},100),o(this,$,kt).call(this,r(this,Me),"tabindex",-1),o(this,$,kt).call(this,r(this,Ei),"tabindex",-1),(s=r(this,zs))==null||s.querySelectorAll(".option").forEach(i=>{o(this,$,kt).call(this,i,"tabindex",-1)}),o(this,$,kt).call(this,r(this,Ss),"aria-expanded",!1))}set value(e){r(this,Ae).value=e||"",o(this,$,kt).call(this,r(this,Ae),"value",e||"")}get value(){return r(this,Ae).value}set disabled(e){String(e).toLowerCase()==="true"?(r(this,Le).classList.add("disabled"),r(this,Ae).disabled=!0,o(this,$,kt).call(this,r(this,Ss),"tabindex",-1),o(this,$,kt).call(this,r(this,Ss),"aria-label","Dropdown disabled"),this.setMenu&&this.setMenu({open:!1})):String(e).toLowerCase()==="false"&&(r(this,Le).classList.remove("disabled"),r(this,Ae).removeAttribute("disabled"),o(this,$,kt).call(this,r(this,Ss),"tabindex",0),o(this,$,kt).call(this,r(this,Ss),"aria-label",r(this,rt).placeholder||""))}get disabled(){return r(this,Ae).disabled}destroy(){r(this,zs)&&(r(this,zs).innerHTML=""),this.value="",T(this,bi,!1),o(this,$,Ym).call(this)}reset(e){o(this,$,zd).call(this),this.destroy(),this.value=e,this.init()}}Yr=new WeakMap,Kl=new WeakMap,ih=new WeakMap,Le=new WeakMap,Ae=new WeakMap,Pi=new WeakMap,Ss=new WeakMap,go=new WeakMap,Xr=new WeakMap,gi=new WeakMap,tc=new WeakMap,Me=new WeakMap,Eo=new WeakMap,ne=new WeakMap,Ei=new WeakMap,zs=new WeakMap,bo=new WeakMap,Ws=new WeakMap,Zr=new WeakMap,Qr=new WeakMap,Jr=new WeakMap,Io=new WeakMap,bi=new WeakMap,vo=new WeakMap,rt=new WeakMap,Kr=new WeakMap,wo=new WeakMap,ta=new WeakMap,Di=new WeakMap,Hs=new WeakMap,$=new WeakSet,Am=function(e){const s=e.split("->");let i=r(this,Hs);return s.forEach(n=>{i=i[n]}),i},Se=function(e){return r(this,Le).querySelector(e)},Je=function(e,s,i){e&&(e.addEventListener(s,i),r(this,vo).push({selector:e,eventType:s,cb:i}))},Mm=function(){r(this,Ae).value&&(o(this,$,jd).call(this,"",r(this,Ae).value),r(this,rt).selectedCountryClearable&&o(this,$,Ke).call(this,r(this,Pi),"display","grid"))},Nm=function(){const{protocol:e}=r(this,Hs).location;fetch(`${e}//${r(this,Kl)}`).then(s=>s.text()).then(s=>{const i=s.trim().split(`
45 `).reduce((n,a)=>(a=a.split("="),n[a[0]]=a[1],n),{});this.setSelectedCountryItem(i.loc)})},Pm=function(){navigator.geolocation.getCurrentPosition(e=>{const{latitude:s,longitude:i}=e.coords,{protocol:n}=r(this,Hs).location,a=n==="https:"?`${n}//secure`:`${n}//api`;fetch(`${a}.geonames.org/countryCodeJSON?username=bitcodezoho1&lat=${s}&lng=${i}`).then(l=>l.json()).then(l=>{this.setSelectedCountryItem(l.countryCode)})})},Dm=function(e){var a,l;const s=r(this,Di).activeElement;let i=null;const n=o(this,$,Ir).call(this);if(e.target!==r(this,ne)){if(n){const c=Number(s.dataset.index||-1);if(e.key==="ArrowDown"||!e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,Me))i=o(this,$,Se).call(this,".option:not(.disabled-opt)");else if(s.classList.contains("option")){const d=o(this,$,vl).call(this,c,"next"),h=o(this,$,Pa).call(this,d);h?i=h:d+1<r(this,Ws).length&&((a=this.virtualOptionList)==null||a.scrollToIndex(d),setTimeout(()=>{const p=o(this,$,Pa).call(this,d);p&&p.focus()},50))}}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,Me))i=r(this,ne),o(this,$,Ir).call(this)&&this.setMenu({open:!1});else if(s.classList.contains("option")){const d=o(this,$,vl).call(this,c,"previous"),h=o(this,$,Pa).call(this,d);h?i=h:d>0?((l=this.virtualOptionList)==null||l.scrollToIndex(d),setTimeout(()=>{const p=o(this,$,Pa).call(this,d);p&&p.focus()},50)):h||(i=r(this,Me))}}else e.key==="Escape"&&this.setMenu({open:!1})}else if(e.key>="a"&&e.key<="z"){clearTimeout(r(this,wo)),T(this,ta,r(this,ta)+e.key),T(this,wo,setTimeout(()=>{T(this,ta,"")},300));const c=r(this,rt).options.find(d=>!d.disabled&&d.lbl.toLowerCase().startsWith(r(this,ta)));c&&this.setSelectedCountryItem(c.i)}else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const c=o(this,$,Bd).call(this),d=e.key==="ArrowDown"?"next":"previous",h=o(this,$,vl).call(this,c,d);h>-1&&h<r(this,rt).options.length&&(this.value=r(this,rt).options[h].val)}i&&i.focus()}},Il=function(e,s){const i=new Event(s);e.dispatchEvent(i)},Fm=function(){r(this,ne).value="",this.setSelectedCountryItem(""),o(this,$,Il).call(this,r(this,ne),"input"),o(this,$,Il).call(this,r(this,Ae),"blur")},Pa=function(e){return o(this,$,Se).call(this,`.${this.fieldKey}-option-list .option[data-index="${e}"]`)},vl=function(e=-1,s){if(s==="next"){const i=r(this,rt).options.length;for(let n=e+1;n<i;n+=1)if(!r(this,rt).options[n].disabled)return n}else if(s==="previous"){for(let i=e-1;i>=0;i-=1)if(!r(this,rt).options[i].disabled)return i}},Dd=function(e){r(this,Le).contains(e.target)||this.setMenu({open:!1})},jm=function(){return r(this,rt).options.reduce((e,s)=>{if(!e[s.code]){let{code:i}=s;i[0]==="+"&&(i=i.substring(1)),!(i in e)&&s.ptrn&&(e[i]=s.i)}return e},{})},km=function(){const e=r(this,rt).options,s={},i={};return e.forEach(n=>{const a=n.code;s[a]||(s[a]=[]),s[a].push(n)}),Object.keys(s).forEach(n=>{s[n].length>1&&(i[n]=s[n])}),i},wl=function(e){let s=o(this,$,fr).call(this,e);s[0]==="+"&&(s=s.substring(1,4));let i="";for(let n=3;n>0;n-=1)if(i=s.substring(0,n),i in r(this,Zr))return i;return""},Fd=function(e){let s=o(this,$,wl).call(this,e);return s&&s[0]!=="+"&&(s=`+${s}`),s},fr=function(e){return e.replace(/[^\d+]/g,"")},Sn=function(e){return e.replace(/[^\d]/g,"")},jd=function(e,s){o(this,$,Fd).call(this,s)&&e!==s&&o(this,$,kd).call(this,o(this,$,fr).call(this,s)),typeof bit_conditionals!="undefined"&&bit_conditionals({target:r(this,Ae)})},Gm=function(){if(this.value.length>3){const e=o(this,$,fr).call(this,this.value),s=o(this,$,wl).call(this,e);r(this,ne).value=o(this,$,mr).call(this,s,e,r(this,rt).inputFormat)}o(this,$,Il).call(this,r(this,Ae),"blur")},Bm=function(e){const{value:s}=e.target;s&&r(this,rt).selectedCountryClearable?o(this,$,Ke).call(this,r(this,Pi),"display","grid"):r(this,rt).selectedCountryClearable&&o(this,$,Ke).call(this,r(this,Pi),"display","none"),o(this,$,kd).call(this,s)},Um=function(e){(e.key==="Backspace"||e.key==="Delete")&&T(this,Jr,!0)},kd=function(e){let s=o(this,$,Rn).call(this),i="";r(this,bi)?i=s.code:i=o(this,$,Fd).call(this,e);const n=o(this,$,Vm).call(this,e,s);if(i!==e&&(!r(this,bi)||!n)&&n!==(s==null?void 0:s.i)&&(this.setSelectedCountryItem(n),s=o(this,$,Rn).call(this)),i&&s){let a=s.frmt;const l=r(this,rt).valueFormat||"";a||(a=r(this,rt).inputFormat||"");const c=o(this,$,mr).call(this,i,e,a);if(l){const d=o(this,$,mr).call(this,i,e,l);this.value=d}else this.value=e;r(this,ne).value=c}else o(this,$,_l).call(this,o(this,$,Sn).call(this,e))===""&&this.value!==e&&(this.value=e)},ec=new WeakMap,mr=function(e,s,i=""){const n=o(this,$,fr).call(this,s);let a="",l=0;const c=n[0]==="+"?n.substring(1):n;for(let d=0;d<i.length&&!(l>=c.length);d+=1){const h=i[d];if(h==="c"){const p=e[0]==="+"?e.substring(1):e;a+=p,l+=p.length,a+=/[ \-().+/*[\]{}~|\\x]/.test(i[d+1]||"")&&p.length===c.length&&!r(this,Jr)?i[d+1]:""}else if(h==="#"){if(!r(this,ec).call(this,c[l]))break;a+=c[l],l+=1}else c[l]===h?(a+=h,l+=1):a+=h}return l<c.length&&(a+=c.substring(l)),T(this,Jr,!1),a},Gd=function(e){var l,c;const s=o(this,$,Sn).call(this,e.target.value),i=o(this,$,Rn).call(this),n=i?s.substring(o(this,$,Sn).call(this,i.code).length):s;if(!i||!n)return n?o(this,$,_l).call(this,s,"required"):"required";if((c=(l=o(this,$,Ud).call(this))==null?void 0:l.valid)!=null&&c.regexr)return o(this,$,_l).call(this,s,"");if(!i.ptrn)return"";const a=i.ptrn.replace(/\$_bf_\$/g,"\\");return new RegExp(`^(${a})$`).test(n)?"":"invalid"},_l=function(e,s=""){const i=o(this,$,Ud).call(this);return i.valid.regexr&&typeof regexPatternValidation!="undefined"?regexPatternValidation(e,i):s},Vm=function(e,s){let i=o(this,$,wl).call(this,e);i&&i[0]!=="+"&&(i=`+${i}`);let n=r(this,Zr)[i.substring(1)]||"";if(s&&s.code===i&&(n=s.i),r(this,Qr)[i]){const a=r(this,Qr)[i],l=o(this,$,fr).call(this,e).substring(i.length);if(l){const c=d=>{if(!d.ptrn)return!1;const h=d.ptrn.replace(/\$_bf_\$/g,"\\").trim();return new RegExp(`^(${h})$`).test(l)};if(s&&s.code===i&&c(s))n=s.i;else{const d=a.find(c);d&&(n=d.i)}}}return n},Bd=function(){const e=r(this,Ws).findIndex(s=>s.i===r(this,gi));return e===-1?0:e},Rn=function(){return r(this,rt).options.find(e=>e.i===r(this,gi))},Ud=function(){var e;return(e=r(this,Hs).bf_globals[r(this,Io)])==null?void 0:e.fields[this.fieldKey]},gr=function(e){return r(this,Di).createElement(e)},Ps=function(e,s){e.classList.add(s)},Tl=function(e,s){e.textContent=s},kt=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},Er=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>o(this,$,Ps).call(this,e,i))},br=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)o(this,$,kt).call(this,e,s[n].key,s[n].value)},Ke=function(e,s,i){var n;(n=e==null?void 0:e.style)==null||n.setProperty(s,i,"important")},JT=function(){const e=o(this,$,Se).call(this,".option");if(!e)return;const s=r(this,Hs).getComputedStyle(e),i=parseFloat(s.marginTop)+parseFloat(s.marginBottom),n=e.offsetHeight+i||0;n!==r(this,bo)&&(T(this,bo,n),r(this,zs).innerHTML="",o(this,$,Vd).call(this))},Vd=function(){var s;if(!r(this,zs))return;r(this,zs).innerHTML="";const e=r(this,Ws).map((i,n)=>{const a=o(this,$,gr).call(this,"li");if(o(this,$,kt).call(this,a,"data-key",i.i),o(this,$,kt).call(this,a,"data-index",n),"option"in r(this,rt).attributes){const h=r(this,rt).attributes.option;o(this,$,br).call(this,a,h)}if(!i.i)return o(this,$,Tl).call(this,a,i.lbl),o(this,$,Ps).call(this,a,"opt-not-found"),a;if(o(this,$,Ps).call(this,a,"option"),"option"in r(this,rt).classNames){const h=r(this,rt).classNames.option;h&&o(this,$,Er).call(this,a,h)}const l=o(this,$,gr).call(this,"span");if(o(this,$,Ps).call(this,l,"opt-lbl-wrp"),"opt-lbl-wrp"in r(this,rt).classNames){const h=r(this,rt).classNames["opt-lbl-wrp"];h&&o(this,$,Er).call(this,l,h)}if("opt-lbl-wrp"in r(this,rt).attributes){const h=r(this,rt).attributes["opt-lbl-wrp"];o(this,$,br).call(this,l,h)}if(r(this,rt).optionFlagImage){const h=o(this,$,gr).call(this,"img");if(o(this,$,Ps).call(this,h,"opt-icn"),"opt-icn"in r(this,rt).classNames){const p=r(this,rt).classNames["opt-icn"];p&&o(this,$,Er).call(this,h,p)}if("opt-icn"in r(this,rt).attributes){const p=r(this,rt).attributes["opt-icn"];o(this,$,br).call(this,h,p)}h.src=`${r(this,Kr)}/${i.img}`,h.alt=`${i.lbl} flag image`,h.loading="lazy",o(this,$,kt).call(this,h,"aria-hidden",!0),l.append(h)}const c=o(this,$,gr).call(this,"span");if(o(this,$,Ps).call(this,c,"opt-lbl"),"opt-lbl"in r(this,rt).classNames){const h=r(this,rt).classNames["opt-lbl"];h&&o(this,$,Er).call(this,c,h)}if("opt-lbl"in r(this,rt).attributes){const h=r(this,rt).attributes["opt-lbl"];o(this,$,br).call(this,c,h)}o(this,$,Tl).call(this,c,i.lbl),l.append(c);const d=o(this,$,gr).call(this,"span");if(o(this,$,Ps).call(this,d,"opt-suffix"),"opt-suffix"in r(this,rt).classNames){const h=r(this,rt).classNames["opt-suffix"];h&&o(this,$,Er).call(this,d,h)}if(o(this,$,Tl).call(this,d,i.code),o(this,$,kt).call(this,d,"data-dev-opt-suffix",this.fieldKey),"opt-suffix"in r(this,rt).attributes){const h=r(this,rt).attributes["opt-suffix"];o(this,$,br).call(this,d,h)}return o(this,$,kt).call(this,a,"tabindex",o(this,$,Ir).call(this)?"0":"-1"),o(this,$,kt).call(this,a,"role","option"),o(this,$,kt).call(this,a,"aria-posinset",n+1),o(this,$,kt).call(this,a,"aria-setsize",r(this,Ws).length),o(this,$,Je).call(this,a,"click",h=>{T(this,bi,!0),this.setSelectedCountryItem(h.currentTarget.dataset.key)}),o(this,$,Je).call(this,a,"keyup",h=>{h.key==="Enter"&&(T(this,bi,!0),this.setSelectedCountryItem(h.currentTarget.dataset.key))}),i.disabled&&o(this,$,Ps).call(this,a,"disabled-opt"),a.append(l,d),r(this,gi)===i.i?(o(this,$,Ps).call(this,a,"selected-opt"),o(this,$,kt).call(this,a,"aria-selected",!0)):o(this,$,kt).call(this,a,"aria-selected",!1),a});return(s=r(this,zs))==null||s.append(...e),!0},zm=function(e,s=""){const i=o(this,$,Sn).call(this,e);let n=o(this,$,Sn).call(this,r(this,ne).value);if(n&&!n.startsWith(i)){const l=o(this,$,Sn).call(this,s);l&&n.startsWith(l)&&(n=n.substring(l.length)),n=`${i}${n}`}const a=n&&n!==i?`+${n}`:"";if(a){let l=o(this,$,Rn).call(this).frmt;l||(l=r(this,rt).inputFormat||""),r(this,ne).value=o(this,$,mr).call(this,e,a,l)}else r(this,ne).value=e;if(!a)this.value=e;else{const l=r(this,rt).valueFormat||"";this.value=l?o(this,$,mr).call(this,e,r(this,ne).value,l):r(this,ne).value}},zd=function(){T(this,gi,""),r(this,rt).selectedFlagImage&&(r(this,Xr).src=r(this,Yr)),T(this,bi,!1),this.setMenu({open:!1}),this.value="",r(this,rt).selectedCountryClearable&&o(this,$,Ke).call(this,r(this,Pi),"display","none")},Wd=function(){if(!o(this,$,Ir).call(this))return;o(this,$,Vd).call(this);const e=o(this,$,Bd).call(this),s=o(this,$,Se).call(this,`.option[data-index="${e}"]`);return s&&s.scrollIntoView({block:"nearest",inline:"nearest"}),!0},Wm=function(e){r(this,Me)&&(r(this,Me).value=e)},Hm=function(e){var s;if(e.key==="Enter"&&r(this,Ws).length){const i=(s=o(this,$,Se).call(this,".option"))==null?void 0:s.dataset.key;this.setSelectedCountryItem(i),this.searchOptions("")}else this.searchOptions(e.target.value)},Ir=function(){return r(this,Le).classList.contains("menu-open")},qm=function(){const e=r(this,Eo).getBoundingClientRect(),s=e.top,i=r(this,Hs).innerHeight-e.bottom;i<s&&i<r(this,rt).maxHeight?(o(this,$,Ke).call(this,r(this,Le),"flex-direction","column-reverse"),o(this,$,Ke).call(this,r(this,Le),"bottom","0%")):(o(this,$,Ke).call(this,r(this,Le),"flex-direction","column"),o(this,$,Ke).call(this,r(this,Le),"bottom","auto"))},Hd=function(e){var s,i;e.code==="Space"&&((s=r(this,Me))==null||s.focus(),this.setMenu({open:!0})),e.type==="click"&&(o(this,$,Ir).call(this)?this.setMenu({open:!1}):((i=r(this,Me))==null||i.focus(),this.setMenu({open:!0})))},Ym=function(){r(this,vo).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};function KT({fieldKey:t,formID:e,attr:s,styleClasses:i}){const n=F.useRef(null),a=F.useRef(null),c=et(jt)[t],d=et(Mo),{selectedFlagImage:h,hideCountryList:p,selectedCountryClearable:f,searchClearable:m,optionFlagImage:E,detectCountryByIp:g,detectCountryByGeo:I,defaultCountryKey:w,searchPlaceholder:S,noCountryFoundText:_,inputFormat:R,valueFormat:L}=c.config;return F.useEffect(()=>{n!=null&&n.current||(n.current=Gt(`.${t}-phone-fld-wrp`));const M=a.current,D=n.current;M&&D&&"destroy"in M&&M.destroy();const G=document.getElementById("bit-grid-layout").contentWindow;G.bit_virtualized_list||(G.bit_virtualized_list=xh),G.observeElm||(G.observeElm=gc);const{placeholderImage:C,options:k}=c,q={fieldKey:t,selectedFlagImage:h,hideCountryList:p,selectedCountryClearable:f,searchClearable:m,optionFlagImage:No?E:!1,detectCountryByIp:g,detectCountryByGeo:I,defaultCountryKey:w||c.config.defaultValue,searchPlaceholder:S,noCountryFoundText:_,placeholderImage:C,options:k,inputFormat:R,valueFormat:L,assetsURL:`${d.rootURL}/static/countries/`,document:document.getElementById("bit-grid-layout").contentDocument,window:G,attributes:{option:Lt(t,"option"),"opt-lbl-wrp":Lt(t,"opt-lbl-wrp"),"opt-icn":Lt(t,"opt-icn"),"opt-lbl":Lt(t,"opt-lbl"),"opt-a":Lt(t,"opt-prefix")},classNames:{option:x(t,"option"),"opt-lbl-wrp":x(t,"opt-lbl-wrp"),"opt-icn":x(t,"opt-icn"),"opt-lbl":x(t,"opt-lbl"),"opt-prefix":x(t,"opt-prefix")}};a.current=new QT(D,q)},[c]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:i}),u.jsx(At,{formID:e,fieldKey:t,fieldData:s,children:u.jsx("div",{className:`${t}-phone-fld-container`,children:u.jsxs("div",A(b({"data-dev-phone-fld-wrp":t,className:`${t}-phone-fld-wrp ${x(t,"phone-fld-wrp")} ${c.valid.disabled?"disabled":""} ${c.valid.readonly?"readonly":""}`,ref:n},N(t,"phone-fld-wrp")),{children:[u.jsx("input",b(b({name:t,type:"hidden",className:`${t}-phone-hidden-input`},"disabled"in c.valid&&{disabled:c.valid.disabled}),"readonly"in c.valid&&{readOnly:c.valid.readonly})),u.jsxs("div",{className:`${t}-phone-inner-wrp`,children:[(!p||h)&&u.jsxs("div",{"data-testid":`${t}-dpd-wrp`,className:`${t}-dpd-wrp`,"data-dev-dpd-wrp":t,role:"combobox","aria-live":"assertive","aria-labelledby":"country-label-2","aria-expanded":"false",tabIndex:c.valid.disabled?"-1":"0",children:[h&&u.jsx("div",{className:`${t}-selected-country-wrp`,children:u.jsx("img",b({"data-dev-selected-phone-img":t,alt:"Selected Country image","aria-hidden":"true",className:`${t}-selected-country-img ${x(t,"selected-phone-img")}`,src:"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>"},N(t,"selected-phone-img")))}),!p&&u.jsx("div",{className:`${t}-dpd-down-btn`,children:u.jsx("svg",{width:"15",height:"15",role:"img",title:"Downarrow icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:u.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),u.jsx("input",A(b({"data-testid":`${t}-phone-nmbr-inp`,"data-dev-phone-number-input":t,"aria-label":"Phone Number"},"ph"in s&&{placeholder:s.ph}),{type:"tel",className:`${t}-phone-number-input`,autoComplete:"tel",tabIndex:c.valid.disabled?"-1":"0"})),f&&u.jsx("button",A(b({"data-testid":`${t}-inp-clr-btn`,"data-dev-input-clear-btn":t,type:"button",title:"Clear value",className:`${t}-input-clear-btn ${x(t,"input-clear-btn")}`},N(t,"input-clear-btn")),{children:u.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}))]}),!p&&u.jsx("div",A(b({className:`${t}-option-wrp ${x(t,"option-wrp")}`,"data-dev-option-wrp":t},N(t,"option-search-wrp")),{children:u.jsxs("div",{className:`${t}-option-inner-wrp`,children:[u.jsxs("div",A(b({"data-dev-option-search-wrp":t,className:`${t}-option-search-wrp ${x(t,"option-search-wrp")}`},N(t,"option-search-wrp")),{children:[u.jsx("input",{"data-testid":`${t}-opt-srch-inp`,"data-dev-opt-search-input":t,"aria-label":"Search for countries",type:"search",className:`${t}-opt-search-input`,placeholder:S,autoComplete:"off",tabIndex:"-1"}),u.jsxs("svg",A(b({className:`${t}-icn ${t}-opt-search-icn ${x(t,"opt-search-icn")}`,"data-dev-opt-search-icn":t,"aria-hidden":"true",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},N(t,"opt-search-icn")),{children:[u.jsx("circle",{cx:"11",cy:"11",r:"8"}),u.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})),m&&u.jsx("button",A(b({"data-testid":`${t}-srch-clr-btn`,type:"button","aria-label":"Clear search",className:`${t}-icn ${t}-search-clear-btn ${x(t,"search-clear-btn")}`,"data-dev-search-clear-btn":t,tabIndex:"-1"},N(t,"search-clear-btn")),{children:u.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}))]})),u.jsx("ul",A(b({className:`${t}-option-list ${x(t,"option-list")}`,tabIndex:"-1",role:"listbox","aria-label":"country list","data-dev-option-list":t},N(t,"option-list")),{children:u.jsxs("li",{className:"option",children:[u.jsx("span",{className:"opt-prefix",children:"Prefix"}),u.jsxs("span",{className:"opt-lbl-wrp",children:[u.jsx("img",{className:"opt-icn",src:"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>",alt:"Placeholder"}),u.jsx("span",{className:"opt-lbl",children:"Option"})]}),u.jsx("span",{className:"opt-suffix",children:"Suffix"})]})}))]})}))]}))})})]})}let Si,Da;function Ec({form:t,input:e}){var l,c;if(t?Si=t:(l=e==null?void 0:e.form)!=null&&l.id&&([,Si]=e.form.id.split("form-")),typeof window[Si]=="undefined")return!1;let s={};if(Da=window[Si].fields,t)s=tx();else if(e){if(!window[Si].validateFocusLost)return!0;const d=Xm(e.name);s={[d]:e.value},Da={[d]:Da[d]}}let i=!0;const n=Object.entries(Da);let{length:a}=n;for(;a--;){const[d,h]=n[a],p=h.typ,f=typeof s[d]=="string"?s[d].trim():s[d],m=document.querySelector(`#form-${Si} .${d}`);if(window.getComputedStyle(m).display==="none"){Jo("",d);continue}let E="";if(!f){p==="check"&&(E=Zm(f,h)),E=ix(h),Jo(E,d,h),E&&(i=!1);continue}if(p==="number"?E=nx(f,h):p==="email"?E=rx(f,h):p==="url"?E=ax(f,h):p==="decision-box"?E=ox(f,h):p==="check"||p==="select"?E=dx(f,h):p==="file-up"&&(E=lx(f,h)),(c=h==null?void 0:h.valid)!=null&&c.regexr&&(E=cx(f,h),E)){Jo(E,d,h),i=!1;continue}Jo(E,d,h),E&&(i=!1)}return i}const Xm=t=>t.slice(-2)==="[]"?t.slice(0,t.length-2):t,tx=()=>{const t=new FormData(document.getElementById(`form-${Si}`)),e={};return Array.from(t.entries()).forEach(([i,n])=>{const a=Xm(i);a in Da&&(e[a]?(Array.isArray(e[a])||(e[a]=[e[a]]),e[a].push(n)):e[a]=n)}),e},Jo=(t,e,s)=>{var n,a;const i=document.querySelector(`#form-${Si} #${e}-error`);i&&"err"in(s||{})&&(t&&((a=(n=s==null?void 0:s.err)==null?void 0:n[t])!=null&&a.show)?(i.innerHTML=s.err[t].custom?s.err[t].msg:s.err[t].dflt,i.parentElement.style.marginTop="5px",i.parentElement.style.height=`${i.offsetHeight}px`,ex(e)):(i.parentElement.style.marginTop=0,i.parentElement.style.height=0))},ex=t=>{const e=document.querySelector(`#form-${Si} .btcd-fld-itm.${t}`),s=document.body.getBoundingClientRect(),n=e.getBoundingClientRect().top-s.top;sx(e)||window.scroll({top:n,behavior:"smooth"})},sx=t=>{const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)},ix=t=>{var e;return(e=t==null?void 0:t.valid)!=null&&e.req?"required":""},Sh=t=>(t||"").split("$_bf_$").join("\\"),nx=(t,e)=>e.mn&&Number(t)<Number(e.mn)?"mn":e.mx&&Number(t)>Number(e.mx)?"mx":"",rx=(t,e)=>e.err.invalid.show?new RegExp(Sh(e.pattern)).test(t)?"":"invalid":"",ax=(t,e)=>e.err.invalid.show?new RegExp(Sh(e.attr.pattern)).test(t)?"":"invalid":"",ox=(t,e)=>e.valid.req&&t!==e.msg.checked?"req":"",Zm=(t,e)=>{var s;return(s=e==null?void 0:e.opt)!=null&&s.find(i=>i.req&&!(t||[]).includes(i.lbl))?"req":""},lx=(t,e)=>e.valid.req&&!Array.isArray(t)&&!t.name?"req":"",cx=(t,e)=>new RegExp(Sh(e.valid.regexr),e.valid.flags||"").test(t)?"":"regexr",dx=(t,e)=>{const s=Array.isArray(t)?t:(t||"").split(","),i=Number(e.mn)||0,n=Number(e.mx)||e.opt.length;return s.length<i?"mn":s.length>n?"mx":e.typ==="check"?Zm(t,e):""};function hx({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){const[l,c]=F.useState(t.val||""),d=F.useRef([]),[h,p]=F.useState("");d.current=t.opt.map((g,I)=>{var w;return(w=d.current[I])!=null?w:F.createRef()});const f=g=>{t.valid.disabled||(c(g.target.value),e&&e(g),Pt(n))},m=g=>{const{name:I,form:w}=g.target;Ec({input:{name:I,form:w,value:l}})},E=g=>{c(g.target.value),p(g.target.value)};return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:i,fieldKey:n,fieldData:t,children:u.jsxs("div",A(b({"data-testid":`${n}-cc`,"data-dev-cc":n,className:`${n}-cc ${x(n,"cc")}`},N(n,"cc")),{children:[t.opt.map((g,I)=>u.jsxs("div",A(b({"data-testid":`${n}-cw`,"data-dev-cw":n,className:`${n}-cw ${x(n,"cw")}`},N(n,"cw")),{children:[u.jsx("input",b(A(b(b(b(b({"data-testid":`${n}-ci`,id:`${n}-chk-${I}`,type:"radio",className:`${n}-ci ${x(n,"ci")}`,ref:d.current[I],name:n,value:g.val||g.lbl},g.check&&{checked:!0}),(t.valid.disabled||g.disabled)&&{disabled:!0}),t.valid.req&&{required:!0}),"fieldName"in t&&{name:t.fieldName}),{checked:l===(g.val||g.lbl)||!l&&g.check,onChange:f,onBlur:m}),N(n,"ci"))),u.jsxs("label",A(b({"data-testid":`${n}-cl`,"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-chk-${I}`,className:`${n}-cl ${x(n,"cl")}`},N(n,"cl")),{children:[u.jsx("span",A(b({"data-testid":`${n}-bx`,"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${x(n,"bx")}`},N(n,"bx")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp ${x(n,"svgwrp")}`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn ${x(n,"ck-icn")}`})})})),u.jsx("span",A(b({"data-testid":`${n}-ct`,"data-dev-ct":n,className:`${n}-ct ${x(n,"ct")}`},N(n,"ct")),{children:u.jsx(We,{html:g.lbl})}))]}))]}),`opr-${I+22}`)),t.addOtherOpt&&u.jsxs("div",A(b({"data-testid":`${n}-cw`,"data-dev-cw":n,className:`${n}-cw ${x(n,"cw")}`},N(n,"cw")),{children:[u.jsx("input",b(A(b(b({"data-testid":`${n}-ci`,"data-oopt":n,id:`${n}-chk-${t.opt.length}`,type:"radio",className:`${n}-ci ${x(n,"ci")}`,ref:d.current[t.opt.length],name:n,value:h},t.valid.req&&{required:!0}),"fieldName"in t&&{name:t.fieldName}),{disabled:t.valid.disabled,onChange:f,onBlur:m}),N(n,"ci"))),u.jsxs("label",A(b({"data-testid":`${n}-cl`,"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-chk-${t.opt.length}`,className:`${n}-cl ${x(n,"cl")}`},N(n,"cl")),{children:[u.jsx("span",A(b({"data-testid":`${n}-bx`,"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${x(n,"bx")}`},N(n,"bx")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp ${x(n,"svgwrp")}`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn ${x(n,"ck-icn")}`})})})),u.jsx("span",A(b({"data-testid":`${n}-ct`,"data-dev-ct":n,className:`${n}-ct ${x(n,"ct")}`},N(n,"ct")),{children:t.otherOptLbl||"Other..."}))]})),u.jsx("div",{"data-oinp-wrp":!0,className:`${n}-other-inp-wrp`,children:u.jsx("input",A(b(b(b({"data-testid":`${n}-other-inp`,"data-dev-other-inp":n,type:"text",className:`${n}-other-inp ${x(n,"other-inp")}`},t.valid.otherOptReq&&{required:!0}),"otherInpPh"in t&&{placeholder:t.otherInpPh}),!("otherInpPh"in t)&&{placeholder:"Other..."}),{value:h,onChange:E}))})]}),`opt-${t.opt.length+24}`)]}))})]})}var Ft,Ii,ls,_o,qs,sc,ea,Un,ic,Fi,Ct,Ne,To,sa,xo,Vn,nn,cs,ia,So,Ro,zn,nt,Qm,Jm,Yi,Km,qd,Yd,tg,eg,Xd,vr,sg,Cn,Fa,On,Ds,Zd,Qd;class ux{constructor(e,s){O(this,nt);O(this,Ft,null);O(this,Ii,null);O(this,ls,[]);O(this,_o,null);O(this,qs,null);O(this,sc,null);O(this,ea,!1);O(this,Un,!1);O(this,ic,!1);O(this,Fi,null);O(this,Ct,{});O(this,Ne,null);O(this,To,null);O(this,sa,null);O(this,xo,null);O(this,Vn,null);O(this,nn,null);O(this,cs,null);O(this,ia,null);O(this,So,[]);O(this,Ro,null);O(this,zn,!1);T(this,_o,(s==null?void 0:s.document)||document),T(this,qs,s==null?void 0:s.fieldKey),T(this,Ct,{status:!1,indx:null}),typeof e=="string"?T(this,Fi,r(this,_o).querySelector(e)):T(this,Fi,e),T(this,sc,s==null?void 0:s.contentId),T(this,ls,(s==null?void 0:s.options)||[]),T(this,ea,(s==null?void 0:s.showReviewLblOnHover)||!1),T(this,Un,(s==null?void 0:s.showReviewLblOnSelect)||!1),T(this,ic,(s==null?void 0:s.selectedRating)||!1),T(this,Ro,(s==null?void 0:s.defaultValue)||null),this.init()}init(){o(this,nt,Qm).call(this),T(this,Ft,r(this,Fi).querySelectorAll(r(this,To))),T(this,Ii,o(this,nt,tg).call(this,r(this,xo))),o(this,nt,Jm).call(this),o(this,nt,Km).call(this),r(this,Ft).forEach((e,s)=>{if(r(this,Ct).status&&s<=r(this,Ct).indx){const i=e.querySelector(r(this,Ne));if(o(this,nt,On).call(this,i,r(this,cs)),r(this,ls)[s].check){const n=e.querySelector(r(this,sa));n.checked=!0}}o(this,nt,Yi).call(this,e,"mouseover",()=>{const i=parseInt(e.dataset.indx);o(this,nt,eg).call(this,i)}),o(this,nt,Yi).call(this,e,"mouseout",()=>{const{indx:i}=e.dataset;o(this,nt,Xd).call(this,i)}),o(this,nt,Yi).call(this,e,"click",i=>{const{indx:n}=e.dataset;i.preventDefault(),T(this,zn,!0),o(this,nt,vr).call(this,n)}),o(this,nt,Yi).call(this,e,"touchstart",i=>{i.preventDefault();const{indx:n}=e.dataset;T(this,zn,!0),o(this,nt,vr).call(this,n)}),o(this,nt,Yi).call(this,e,"touchend",()=>{const{indx:i}=e.dataset;o(this,nt,Xd).call(this,i)})})}set value(e){const s=r(this,ls).findIndex(i=>i.val===e);s!==-1&&o(this,nt,vr).call(this,s)}get value(){const e=r(this,ls)[r(this,Ct).indx];return e.val||e.lbl}destroy(){o(this,nt,Zd).call(this),o(this,nt,Qd).call(this),T(this,Ft,null),T(this,Ii,null)}reset(){o(this,nt,Zd).call(this),o(this,nt,Qd).call(this),T(this,Ct,{status:!1,indx:null}),T(this,ia,null),this.init()}}Ft=new WeakMap,Ii=new WeakMap,ls=new WeakMap,_o=new WeakMap,qs=new WeakMap,sc=new WeakMap,ea=new WeakMap,Un=new WeakMap,ic=new WeakMap,Fi=new WeakMap,Ct=new WeakMap,Ne=new WeakMap,To=new WeakMap,sa=new WeakMap,xo=new WeakMap,Vn=new WeakMap,nn=new WeakMap,cs=new WeakMap,ia=new WeakMap,So=new WeakMap,Ro=new WeakMap,zn=new WeakMap,nt=new WeakSet,Qm=function(){T(this,Ne,`.${r(this,qs)}-rating-img`),T(this,To,`.${r(this,qs)}-rating-lbl`),T(this,sa,`.${r(this,qs)}-rating-input`),T(this,xo,`.${r(this,qs)}-rating-msg`),T(this,Vn,`${r(this,qs)}-rating-hover`),T(this,nn,`${r(this,qs)}-rating-scale`),T(this,cs,`${r(this,qs)}-rating-selected`)},Jm=function(){r(this,ls).forEach((e,s)=>{(r(this,Ro)===e.val||e!=null&&e.check)&&(T(this,Ct,{status:!0,indx:s}),r(this,Un)?o(this,nt,Cn).call(this,s):o(this,nt,Fa).call(this))})},Yi=function(e,s,i){e.addEventListener(s,i),r(this,So).push({selector:e,eventType:s,cb:i})},Km=function(){let e=-1;const s=r(this,ls).findIndex(i=>i.check);s!==-1&&(e=s),o(this,nt,Yi).call(this,r(this,Fi),"keydown",i=>{if(i.key==="ArrowRight"){if(r(this,ls).length===e)return;e+=1;const n=i.target.children[e],a=parseInt(n.dataset.indx);if(r(this,Ct).indx!==a&&o(this,nt,vr).call(this,a),o(this,nt,qd).call(this,a),r(this,ls).length===e+1)return!1}else if(i.key==="ArrowLeft"){if(e===0||e-1<0)return;e-=1,o(this,nt,vr).call(this,e),o(this,nt,qd).call(this,e)}}),o(this,nt,Yi).call(this,r(this,Fi),"focusout",()=>{o(this,nt,Yd).call(this)})},qd=function(e){o(this,nt,Yd).call(this);const s=r(this,Ft)[e].querySelector(r(this,Ne));o(this,nt,On).call(this,s,r(this,nn))},Yd=function(){for(let e=0;e<r(this,ls).length;e+=1){const s=r(this,Ft)[e].querySelector(r(this,Ne));o(this,nt,Ds).call(this,s,r(this,nn))}},tg=function(e){return r(this,Fi).querySelector(e)},eg=function(e){var s,i;if(r(this,ea)&&o(this,nt,Cn).call(this,e),r(this,Ct).indx&&(s=r(this,Ft))!=null&&s[r(this,Ct).indx]){const n=r(this,Ft).length-1;r(this,Ft).forEach(a=>{const l=a.querySelector(r(this,Ne));o(this,nt,Ds).call(this,l,r(this,cs))});for(let a=0;a<=r(this,Ct).indx;a+=1){const l=r(this,Ft)[a].querySelector(r(this,Ne));o(this,nt,Ds).call(this,l,r(this,cs))}if(r(this,Ct).indx===n)for(let a=0;a<=r(this,Ct).indx;a+=1){const l=r(this,Ft)[a].querySelector(r(this,Ne));o(this,nt,Ds).call(this,l,r(this,cs))}}for(let n=0;n<=e;n+=1)if(n<=e&&((i=r(this,Ft))!=null&&i[n])){const a=r(this,Ft)[n].querySelector(r(this,Ne));o(this,nt,On).call(this,a,r(this,Vn)),n===e&&o(this,nt,On).call(this,a,r(this,nn))}},Xd=function(e){var s,i;r(this,ea)&&(r(this,Ct).status&&r(this,Ct).indx===e?o(this,nt,Cn).call(this,e):r(this,Ct).status?o(this,nt,Cn).call(this,r(this,Ct).indx):r(this,Ii)&&o(this,nt,Fa).call(this));for(let n=0;n<=e;n+=1)if((s=r(this,Ft))!=null&&s[n]){const a=r(this,Ft)[n].querySelector(r(this,Ne));o(this,nt,Ds).call(this,a,r(this,Vn)),o(this,nt,Ds).call(this,a,r(this,nn))}if(r(this,Ct).status&&(i=r(this,Ft))!=null&&i[r(this,Ct).indx])for(let n=0;n<=r(this,Ct).indx;n+=1){const a=r(this,Ft)[n].querySelector(r(this,Ne));o(this,nt,On).call(this,a,r(this,cs))}r(this,Un)?o(this,nt,Cn).call(this,r(this,Ct).indx):o(this,nt,Fa).call(this)},vr=function(e){var i,n,a,l;if((i=r(this,Ft))!=null&&i[r(this,Ct).indx]){const c=r(this,Ft)[r(this,Ct).indx].querySelector(r(this,Ne));o(this,nt,Ds).call(this,c,r(this,cs))}const s=(n=r(this,Ft))==null?void 0:n[e].querySelector(r(this,sa));r(this,ia)&&r(this,zn)?s!=null&&s.checked?(s.checked=!1,T(this,Ct,{status:!1,indx:null})):(s.checked=!0,T(this,Ct,{status:!0,indx:e})):(s.checked=!0,T(this,Ct,{status:!0,indx:e}),T(this,ia,s)),s.dispatchEvent(new Event("input")),(a=r(this,Ft))==null||a.forEach(c=>{const d=c.querySelector(r(this,Ne));o(this,nt,Ds).call(this,d,r(this,Vn))}),(l=r(this,Ft))==null||l.forEach((c,d)=>{const h=c.querySelector(r(this,Ne));d<=e&&r(this,Ct).status?o(this,nt,On).call(this,h,r(this,cs)):o(this,nt,Ds).call(this,h,r(this,cs))}),r(this,Un)&&r(this,Ct).status?o(this,nt,Cn).call(this,e):o(this,nt,Fa).call(this),T(this,zn,!1)},sg=function(e){return r(this,ls)[e]},Cn=function(e){const s=o(this,nt,sg).call(this,e);r(this,Ii)&&s&&(r(this,Ii).innerText=s.lbl)},Fa=function(){r(this,Ii)&&(r(this,Ii).innerHTML="")},On=function(e,s){e.classList.add(s)},Ds=function(e,s){e.classList.remove(s)},Zd=function(){r(this,Ft).forEach(e=>{const s=e.querySelector(r(this,Ne));o(this,nt,Ds).call(this,s,r(this,cs))})},Qd=function(){r(this,So).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};function px({attr:t,formID:e,fieldKey:s,styleClasses:i}){const{"*":n}=ac(),a=et(_e),{styleMode:l}=a,[c,d]=n.split("/"),h=l&&c==="field-theme-customize"&&d==="rating-msg",f=et(jt)[s],m=F.useRef(null),E=F.useRef(null);return F.useEffect(()=>{var S;m!=null&&m.current||(m.current=Gt(`.${s}-inp-fld-wrp`));const g=E.current,I=m.current;g&&I&&"destroy"in g&&g.destroy();const w={options:t.opt,showReviewLblOnHover:t.showReviewLblOnHover,showReviewLblOnSelect:t.showReviewLblOnSelect,selectedRating:t.selectedRating,fieldKey:s,document:(S=document.getElementById("bit-grid-layout"))==null?void 0:S.contentDocument};E.current=new ux(I,w)},[f]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:i}),u.jsx(At,{formID:e,fieldKey:s,fieldData:t,children:u.jsxs("div",A(b({"data-testid":`${s}-inp-fld-wrp`,"data-dev-inp-fld-wrp":s,className:`${s}-inp-fld-wrp ${x(s,"inp-fld-wrp")}`},N(s,"inp-fld-wrp")),{ref:m,children:[u.jsx("div",A(b({"data-testid":`${s}-rating-wrp`,"data-dev-rating-wrp":s,className:`${s}-rating-wrp ${x(s,"rating-wrp")}`},N(s,"rating-wrp")),{children:t.opt.map((g,I)=>u.jsxs("label",A(b({className:`${s}-rating-lbl ${x(s,"rating-lbl")}`,"data-testid":`${s}-rating-lbl`,"data-dev-rating-lbl":s,htmlFor:`${s}-rating-${I}`},N(s,"rating-lbl")),{"data-indx":I,children:[u.jsx("input",A(b({type:"radio",className:`${s}-rating-input`,name:"rating",value:g.val,"aria-label":`rating-input-${I}`,id:`${s}-rating-${I}`},g.check&&{checked:!0}),{defaultChecked:g==null?void 0:g.check})),u.jsx("img",A(b({className:`${s}-rating-img ${x(s,"rating-img")}`,src:g.img,alt:g==null?void 0:g.lbl,"aria-label":g==null?void 0:g.lbl},N(s,"rating-img")),{"data-testid":`${s}-rating-input`,"data-dev-rating-img":s}))]}),g.val))})),u.jsx("span",A(b({className:`${s}-rating-msg ${x(s,"rating-msg")}`,"data-testid":`${s}-rating-msg`,"data-dev-rating-msg":s},N(s,"rating-msg")),{children:h&&(f.showReviewLblOnSelect||f.showReviewLblOnHover)&&"Rating Message"}))]}))})]})}var Wn,rn,zt,na,ji,ki,Co,Oo,ra,Hn,pt,ig,xl,Jd,Kd,th,Sl,eh,ng,wr,nc,rg,ag,Fs,sh,og;class fx{constructor(e,s){O(this,pt);O(this,Wn,null);O(this,rn,"");O(this,zt,{clientId:"",options:{currency:"INR",amount:1,amountType:"fixed",theme:{},modal:{},prefill:{},notes:{}}});O(this,na,[]);O(this,ji,null);O(this,ki,null);O(this,Co,null);O(this,Oo,null);O(this,ra,!1);O(this,Hn,!1);O(this,nc,e=>{var a;const s=document.getElementById(`${o(this,pt,Fs).call(this)}`);s.classList.add("pos-rel","form-loading");const i=document.getElementById(`form-${o(this,pt,Fs).call(this)}`),n=(a=o(this,pt,Fs).call(this))==null?void 0:a.split("_")[1];if(typeof i!="undefined"&&i!==null){const l=bf_globals[o(this,pt,Fs).call(this)];r(this,ji)&&(l.entryId=r(this,ji));let c=bfSelect(`input[name="${r(this,zt).fieldKey}"]`,i);c?c.value=e.razorpay_payment_id:setHiddenFld({name:r(this,zt).fieldKey,value:e.razorpay_payment_id,type:"text"},i),o(this,pt,xl).call(this),o(this,pt,Jd).call(this);const d={formID:n,fieldKey:r(this,zt).fieldKey,transactionID:e.razorpay_payment_id,payment_type:r(this,zt).payType==="subscription"?"subscription":"order",entry_id:r(this,ji)},h=new URL(l==null?void 0:l.ajaxURL);h.searchParams.append("_ajax_nonce",l==null?void 0:l.nonce),h.searchParams.append("action","bitforms_save_razorpay_details"),fetch(h,{method:"POST",body:JSON.stringify(d)}).then(()=>{s.classList.remove("pos-rel","form-loading"),T(this,ji,null),c=bfSelect(`input[name="${r(this,zt).fieldKey}"]`,i),c&&(o(this,pt,sh).call(this,c,"value",""),c.value="")})}});var i;Object.assign(r(this,zt),s),T(this,ki,s.document||document),T(this,Co,s.window||window),T(this,rn,`#form-${o(this,pt,Fs).call(this)}`),typeof e=="string"?T(this,Wn,r(this,ki).querySelector(e)):T(this,Wn,e),T(this,Oo,(i=r(this,zt))==null?void 0:i.formID),this.init()}init(){o(this,pt,eh).call(this,o(this,pt,Sl).call(this,`.${r(this,zt).fieldKey}-razorpay-btn`),"click",()=>o(this,pt,ig).call(this));const e=r(this,ki).querySelector(r(this,rn));e&&o(this,pt,eh).call(this,e,"bf-form-submit-success",()=>o(this,pt,Kd).call(this))}destroy(){o(this,pt,Kd).call(this),o(this,pt,ng).call(this),T(this,na,[])}reset(){this.destroy(),this.init()}}Wn=new WeakMap,rn=new WeakMap,zt=new WeakMap,na=new WeakMap,ji=new WeakMap,ki=new WeakMap,Co=new WeakMap,Oo=new WeakMap,ra=new WeakMap,Hn=new WeakMap,pt=new WeakSet,ig=function(){if(r(this,Hn)){o(this,pt,xl).call(this);return}r(this,ra)||(T(this,ra,!0),o(this,pt,ag).call(this).finally(()=>{T(this,ra,!1)}))},xl=function(){const e=r(this,ki).getElementById(`form-${o(this,pt,Fs).call(this)}`);if(!e)return;let s=bfSelect('button[type="submit"]',e);s||(s=r(this,ki).createElement("button"),o(this,pt,sh).call(this,s,"type","submit"),s.style.display="none",e.append(s)),s.click()},Jd=function(e){T(this,Hn,!0),o(this,pt,th).call(this,e||"Payment received. If the form does not finish submitting, click the Razorpay button again to retry the submission — you will not be charged again.")},Kd=function(){r(this,Hn)&&(T(this,Hn,!1),o(this,pt,th).call(this,""))},th=function(e){const{fieldKey:s}=r(this,zt),i=bfSelect(`${r(this,rn)} .${s}-err-wrp`),n=i&&bfSelect(`.${s}-err-txt`,i),a=i&&bfSelect(`.${s}-err-msg`,i);!n||!a||(n.innerHTML=e,e?(a.style.removeProperty("display"),setStyleProperty(i,"height",`${n.parentElement.scrollHeight}px`),setStyleProperty(i,"opacity",1)):(setStyleProperty(a,"display","none"),setStyleProperty(i,"height",0),setStyleProperty(i,"opacity",0)))},Sl=function(e,s){return s?r(this,ki).querySelector(s).querySelector(e):r(this,Wn).querySelector(e)},eh=function(e,s,i){e.addEventListener(s,i),r(this,na).push({selector:e,eventType:s,cb:i})},ng=function(){r(this,na).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})},wr=function(e){if(e){const s=window.bf_globals[o(this,pt,Fs).call(this)].fields[e].fieldName;let i=o(this,pt,Sl).call(this,`[name="${s}"]`,r(this,rn));if(i&&i.type==="radio"&&(i=o(this,pt,Sl).call(this,`[name="${s}"]:checked`,r(this,rn))),i&&i.value)return i.value}return""},nc=new WeakMap,rg=function(e){return ba(this,null,function*(){var c,d,h;const s=bf_globals[o(this,pt,Fs).call(this)],i=document.getElementById(`${o(this,pt,Fs).call(this)}`);i.classList.add("pos-rel","form-loading");const n=new URL(s==null?void 0:s.ajaxURL);n.searchParams.append("_ajax_nonce",s==null?void 0:s.nonce),n.searchParams.append("action","bitforms_create_razorpay_order");const l=yield(yield fetch(n,{method:"POST",body:JSON.stringify(e)})).json();return i.classList.remove("pos-rel","form-loading"),((d=(c=l.data)==null?void 0:c.error)==null?void 0:d.code)==="bitform_razorpay_already_paid"?{alreadyPaid:!0,message:l.data.error.description}:(h=l.data)!=null&&h.error||!l.success?{orderId:""}:{orderId:l.data.id}})},ag=function(){return ba(this,null,function*(){var M,D;const{currency:e,amount:s,amountType:i,amountFld:n,name:a,description:l,theme:c,prefill:d,modal:h,notes:p}=r(this,zt).options,{confirm_close:f}=h,{contentId:m}=r(this,zt);let E=p;typeof replaceFieldAndSmartValues!="undefined"&&E&&(E=JSON.parse(replaceFieldAndSmartValues(JSON.stringify(E),m)));const g=o(this,pt,og).call(this,i==="dynamic"?o(this,pt,wr).call(this,n):s)*100;try{yield isFormValidatedWithoutError(m)}catch(G){return!1}const I=yield saveFormProgress(m),w=I==null?void 0:I[m];if(!(w!=null&&w.success))return;w.data.entry_id&&T(this,ji,w.data.entry_id);let S="";if(E=A(b({},E),{formID:r(this,Oo),entryID:r(this,ji),fieldKey:r(this,zt).fieldKey}),typeof bf_modify_razorpay_notes!="undefined"&&(E=bf_modify_razorpay_notes(E)),r(this,zt).includeOrderId)if(!r(this,zt).newOrderId&&r(this,zt).orderIdFld!=="")S=o(this,pt,wr).call(this,r(this,zt).orderIdFld);else{const G={payIntegID:r(this,zt).payIntegID,currency:e,amount:g,notes:E},C=yield o(this,pt,rg).call(this,G);if(C.alreadyPaid){o(this,pt,Jd).call(this,C.message),o(this,pt,xl).call(this);return}S=C.orderId}const _={key:r(this,zt).clientId,currency:e,amount:g,name:a,description:l,theme:c,order_id:S,prefill:{name:o(this,pt,wr).call(this,d.prefillNameFld),email:o(this,pt,wr).call(this,d.prefillEmailFld),contact:o(this,pt,wr).call(this,d.prefillContactFld)},notes:E,modal:{backdropclose:!1,escape:!1,confirm_close:f},handler:G=>ba(this,null,function*(){return r(this,nc).call(this,G)})},R={options:_,config:r(this,zt),contentId:o(this,pt,Fs).call(this)};(D=(M=r(this,Wn))==null?void 0:M.dispatchEvent)==null||D.call(M,new CustomEvent("bf-razorpay-options",{bubbles:!0,detail:R})),new(r(this,Co)).Razorpay(_).open()})},Fs=function(){return r(this,zt).contentId},sh=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},og=function(e){const s=/[\d,.]*\d(?:\.\d+)?/,i=e==null?void 0:e.match(s);if(i){const n=i[0].replace(/,/g,"");return parseFloat(n)}return parseFloat(0)};function mx({fieldKey:t,formID:e,attr:s,isBuilder:i,styleClasses:n}){const a=et(oc),c=et(jt)[t],[d,h]=F.useState(""),p=F.useRef(null),f=F.useRef(null),[m,E]=F.useState(!1);return F.useEffect(()=>{if(!d){za({fieldKey:t,errorKey:"razorpayClientIdMissing",errorMsg:ve("Razorpay Client ID is missing"),errorUrl:`field-settings/${t}`});return}if(lc(t,"razorpayClientIdMissing"),m)return;const I={src:"https://checkout.razorpay.com/v1/checkout.js",integrity:"",id:`bf-razorpay-script-${t}`,scriptInGrid:!1,callback:()=>{E(!0)}};Po(I)},[d]),F.useEffect(()=>{if(!s.payIntegID){h("");return}const g=a==null?void 0:a.find(w=>w.id&&s.payIntegID&&Number(w.id)===Number(s.payIntegID));if(!g)return;const I=g.apiKey;h(I)},[s.payIntegID]),F.useEffect(()=>{if(!m)return;p!=null&&p.current||(p.current=Gt(`${t}-razorpay-wrp`));const g=p.current,I=f.current;if((!d||I&&g&&"destroy"in I)&&(I.destroy(),Pt(t)),!d)return;const w={clientId:d,fieldKey:t,options:c.options,onPaymentSuccess:S=>{},onPaymentFailed:()=>{}};f.current=new fx(g,w)},[m,c]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:n}),u.jsxs(At,{formID:e,fieldData:s,fieldKey:t,noLabel:!0,noErrMsg:!0,isBuilder:i,children:[m&&d&&u.jsx("div",{className:"bf-form",children:u.jsx("div",{ref:p,className:`${t}-razorpay-wrp`,children:u.jsxs("button",A(b({type:"button","data-dev-razorpay-btn":t,className:`${t}-razorpay-btn ${x(t,"razorpay-btn")}`},N(t,"razorpay-btn")),{children:[u.jsxs("svg",{width:"18",height:"20",viewBox:"0 0 18 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M7.077 6.476l-.988 3.569 5.65-3.589-3.695 13.54 3.752.004 5.457-20L7.077 6.476z",fill:"#fff"}),u.jsx("path",{d:"M1.455 14.308L0 20h7.202L10.149 8.42l-8.694 5.887z",fill:"#fff"})]}),u.jsxs("div",A(b({"data-dev-razorpay-btn-text":t,className:`${t}-razorpay-btn-text ${x(t,"razorpay-btn-text")}`},N(t,"razorpay-btn-text")),{children:[u.jsx("span",A(b({"data-dev-razorpay-btn-title":t,className:`${t}-razorpay-btn-title ${x(t,"razorpay-btn-title")}`},N(t,"razorpay-btn-title")),{children:c.btnTxt})),c.subTitl&&u.jsx("span",A(b({"data-dev-razorpay-btn-sub-title":t,className:`${t}-razorpay-btn-sub-title ${x(t,"razorpay-btn-sub-title")}`},N(t,"razorpay-btn-sub-title")),{children:"Secured by Razorpay"}))]}))]}))})}),(!m||!d)&&u.jsxs("p",{children:["Please select a Razorpay account from",u.jsx("strong",{children:" Field Settings "}),"to load Razorpay field."]})]})]})}function gx({fieldKey:t,formId:e,styleClasses:s}){var g;const i=F.useRef(null),n=F.useRef(null),l=et(jt)[t],c=et(un),{styleMode:d}=et(_e),h=((g=l.hidden)==null?void 0:g.includes(c))||!1,p=F.useRef(null),f=et(Tg),{siteKey:m=""}=f||{};F.useEffect(()=>{window.renderGrecaptcha=E;const w={src:"https://www.google.com/recaptcha/api.js?onload=renderGrecaptcha&render=explicit",integrity:"",id:"bf-recaptcha-script"};return Po(w),()=>{clearInterval(n.current),nh(w.id)}},[]);function E(){let I=Gt(`.${t}-recaptcha`);p.current!==null&&(I==null||I.remove(),window.grecaptcha.reset(p.current),I=document.createElement("div"),I.classList.add(`${t}-recaptcha`),i.current.appendChild(I)),p.current=window.grecaptcha.render(I,{sitekey:m,theme:l.config.theme,size:l.config.size}),Pt(t),n.current&&clearInterval(n.current),n.current=setInterval(()=>{window.grecaptcha.reset(p.current)},3e4)}return F.useEffect(()=>{window.grecaptcha&&E()},[l]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:s}),u.jsx("div",{"data-dev-fld-wrp":t,className:`${t}-recaptcha-container ${t}-fld-wrp ${d?"":"drag"} ${h?"fld-hide":""}`,children:m!==""?u.jsx("div",{className:`${t}-recaptcha-wrp`,ref:i,children:u.jsx("div",{className:`${t}-recaptcha`})}):u.jsxs("div",{children:["To Load reCaptcha Field, Please Configure Site Key and Secret."," ",u.jsx("strong",{children:"Go to App Settings"})]})})]})}function Ex({fieldKey:t,attr:e,styleClasses:s,formID:i}){var fn,mn,Ea;const{formType:n}=ac(),a=Ks(s),[l,c]=Os(ep),[d,h]=F.useState(Ks(l[t]||{lg:[],md:[],sm:[]})),[p,f]=Os(sp),[m,E]=Os(ip),g=et(Vu),I=ti(zu),w=et(jt),{styleMode:S}=et(_e),[_,R]=Os(ca),L=F.useRef(null),{ref:M,isComponentVisible:D,setIsComponentVisible:G}=et(Wu),C=et(un),k=et(Hu),q=ti(qu),W=ti(Yu),V=et(Xu),{recalculateNestedField:X}=et(ah),{fieldKey:j,parentFieldKey:K,counter:B}=X,H=rh(),tt=Zu(),{btnPosition:U}=e,Z=F.useRef(null),[,J]=F.useState(0);F.useEffect(()=>{var $t,Ut;const ot=Z.current,ft=(Ut=($t=ot==null?void 0:ot.ownerDocument)==null?void 0:$t.defaultView)==null?void 0:Ut.ResizeObserver;if(!ft)return;const xt=new ft(([is])=>J(is.target.offsetWidth));return xt.observe(ot),()=>xt.disconnect()},[]);const it=F.useRef(null),at=F.useRef(null),vt=F.useRef(C);F.useEffect(()=>{if(B>0&&t===K){const ot=Qu(d,j);h(ot),F.startTransition(()=>{c(ft=>re(ft,xt=>{xt[t]=ot})),Pt(t)})}},[B,K,j]),F.useEffect(()=>{h(Ks(l[t]||{lg:[],md:[],sm:[]}))},[l[t]]),F.useEffect(()=>{if(k.respectLGLayoutOrder&&d.lg&&d.lg.length>0&&d.lg.length<100)try{const ft=Cl("lg",d.lg,d,!0,ka);h(ft),F.startTransition(()=>{c(xt=>re(xt,$t=>{$t[t]=ft}))})}catch(ft){}},[]),F.useEffect(()=>{const ot=vt.current;if(ot!==C&&k.respectLGLayoutOrder){it.current&&(it.current(),it.current=null),at.current&&(clearTimeout(at.current),at.current=null);const ft=Ju(`nested-${t}-breakpoint-switch`,()=>{try{const xt=Or("nestedLayouts")[t];if(!xt)return;const $t=Cl(ot,xt[ot],xt,!0,ka);h($t),F.startTransition(()=>{c(Ut=>re(Ut,is=>{is[t]=$t}))})}catch(xt){q({show:!0,msg:"Failed to sync nested layout"})}},300);it.current=ft}return vt.current=C,()=>{it.current&&it.current(),at.current&&clearTimeout(at.current)}},[C,k.respectLGLayoutOrder,t,c]);const _t=ot=>{ot.findIndex(ft=>ft.i==="shadow_block")<0&&(it.current&&(it.current(),it.current=null),at.current&&(clearTimeout(at.current),at.current=null),h(ft=>A(b({},ft),{[C]:ot})),F.startTransition(()=>{c(ft=>re(ft,xt=>{xt!=null&&xt[t]&&(xt[t][C]=ot)}))}))},ct=(ot,ft)=>{const xt=$l(V.fieldData,"repeater");if(!xt)return;const{newLayouts:$t,historyData:Ut}=ap(d,xt,V.fieldSize,ft);h($t),F.startTransition(()=>{c(is=>re(is,ei=>{ei[t]=$t})),W(!0),Pt(t),Ut.state.nestedLayouts=Or("nestedLayouts"),yl(Ut)})},ut=Gt(`.${t}-rpt-wrp`),Et=ut&&Ko(ut),St=Et?Et.width-(Et.paddingLeft+Et.paddingRight+Et.borderLeft+Et.borderRight):0,It=Gt(`.${t}-pair-btn-wrp`),oe=It&&Ko(It),ys=oe&&["row","row-reverse"].includes(U)?oe.width:0,pn=Gt(`.${t}-rpt-grid-wrp`),Ls=pn&&Ko(pn),Ui=St-ys-(Ls?Ls.paddingLeft+Ls.paddingRight+Ls.borderLeft+Ls.borderRight:0),fa=()=>{f({}),G(!1)},ma=()=>{H(tt.pathname.replace(/style\/.+|style/g,"fs"),{replace:!0}),fa()},ga=ot=>{H(`/form/builder/${n}/${i}/field-theme-customize/quick-tweaks/${ot}`,{replace:!0}),fa()},dt=(ot,ft)=>{ot.preventDefault(),ot.stopPropagation(),Bt(ot,ft)},mt=(ot,ft)=>{ot.stopPropagation(),E(ft),Wa(p)||f({}),Ot(),!S&&H(`/form/builder/${n}/${i}/field-settings/${ft}`)},Ot=()=>{Wa(_)||(L.current!==null&&clearTimeout(L.current),L.current=setTimeout(()=>{R({}),L.current=null},700))},Bt=(ot,ft)=>{var Lh;const{button:xt}=ot;let $t,Ut,is,ei;const gn=M.current.getBoundingClientRect().top+window.scrollY,En=M.current.getBoundingClientRect().left+window.scrollX,Ch=Gt("#layout-wrapper"),Oh=Number(Ch.style.width.match(/\d+/gi)),$h=Number(Ch.style.height.match(/\d+/gi)),yh=170,jo=200;if(xt===0){const Ah=(Lh=Gt(`[data-key="${ft}"]`))==null?void 0:Lh.querySelector(".blk-wrp-down-btn"),bc=30,Mh=Ah.getBoundingClientRect().top+bc,Nh=Ah.getBoundingClientRect().left;if($t=Nh-En+5,Ut=Mh-gn+2,is=$t+yh>Oh,ei=Ut+jo>$h,is&&($t=Nh+bc-En-148),ei&&(Ut=Mh-gn-(jo+bc+7)),m!==ft&&($t+=3),D&&p.fldKey===ft&&p.x===$t&&p.y===Ut){fa();return}}else xt===2&&($t=ot.clientX-En+5,Ut=ot.clientY-gn,is=$t+yh>Oh,ei=Ut+jo>$h,is&&($t=ot.clientX-En-150),ei&&(Ut=ot.clientY-gn-jo));E(ft),f({fldKey:ft,x:$t,y:Ut}),G(!0)},ee=ot=>{if(!No){I(b({show:!0},tp.fieldClone));return}const ft=w[ot];if(!$l(ft))return;const{newLayouts:xt}=op(ot,d);h(xt),F.startTransition(()=>{c($t=>re($t,Ut=>{Ut[t]=xt})),Pt(t)})},As=ot=>{const{newLayouts:ft,historyData:xt}=lp(ot,d);h(ft),F.startTransition(()=>{c($t=>re($t,Ut=>{Ut[t]=ft})),Pt(t),xt.state.nestedLayouts=Or("nestedLayouts"),yl(xt)}),H(`/form/builder/${n}/${i}/fields-list`,{replace:!0})},Vi=ot=>{ot.stopPropagation(),Ol(ot,{i:t,x:0,y:0,h:0,w:60},t)};return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:i,fieldKey:t,fieldData:e,noErrMsg:!0,children:u.jsx("div",A(b({"data-testid":`${t}-inp-fld-wrp`,"data-dev-inp-fld-wrp":t,className:`${t}-inp-fld-wrp ${x(t,"inp-fld-wrp")}`},N(t,"inp-fld-wrp")),{children:u.jsxs("div",A(b({"data-testid":`${t}-rpt-fld-wrp`,"data-dev-rpt-fld-wrp":t,className:`${t}-rpt-fld-wrp ${x(t,"rpt-fld-wrp")}`},N(t,"rpt-fld-wrp")),{children:[u.jsxs("div",A(b({"data-testid":`${t}-rpt-wrp`,"data-dev-rpt-wrp":t,className:`${t}-rpt-wrp ${x(t,"rpt-wrp")}`},N(t,"rpt-wrp")),{children:[u.jsx("div",A(b({"data-testid":`${t}-rpt-grid-wrp`,"data-dev-rpt-grid-wrp":t,className:`${t}-rpt-grid-wrp ${x(t,"rpt-grid-wrp")}`},N(t,"rpt-grid-wrp")),{children:u.jsxs("div",{style:{width:Ui,display:"inline-block"},id:`${t}-layout-wrapper`,onDragOver:ot=>ot.preventDefault(),onDragEnter:ot=>ot.preventDefault(),onMouseMove:()=>F.startTransition(()=>{W(!1)}),onMouseLeave:()=>F.startTransition(()=>{W(!0)}),children:[S?u.jsx("div",{className:"_frm-g",children:(mn=d==null?void 0:d[C])==null?void 0:mn.map(ot=>u.jsx("div",{"data-key":ot.i,className:ot.i,onClick:ft=>mt(ft,ot.i),onKeyDown:ft=>mt(ft,ot.i),role:"button",tabIndex:0,onContextMenu:ft=>dt(ft,ot.i),children:u.jsx(F.Suspense,{fallback:u.jsx(Ll,{layout:ot}),children:u.jsx(Ul,{layoutItem:ot,removeLayoutItem:As,cloneLayoutItem:ee,fields:w,formID:i,navigateToFieldSettings:ma,navigateToStyle:ga,handleContextMenu:dt,resizingFld:_})})},ot.i))}):u.jsx(rp,{width:Ui,measureBeforeMount:!0,compactType:"vertical",preventCollision:!1,useCSSTransforms:!0,isDroppable:V!==null&&C==="lg",className:`layout b${i}-bf-repeater-grid bf-repeater-grid`,style:{minHeight:V?Ku()+40:null},onDrop:ct,resizeHandles:["e","w"],droppingItem:V==null?void 0:V.fieldSize,onLayoutChange:_t,cols:60,rowHeight:1,margin:[0,0],draggableCancel:".no-drg",draggableHandle:".drag",layout:(d==null?void 0:d[C])||[],onDragStart:Al,onDragStop:()=>{F.startTransition(()=>{W(!0),Pt(t),Ot()})},onResizeStart:Al,onResize:Oc,onResizeStop:()=>{Ot(),Pt(t)},children:(fn=d==null?void 0:d[C])==null?void 0:fn.map(ot=>u.jsx("div",{"data-key":ot.i,className:`blk ${g.show&&g.addAfterFieldKey===ot.i?"add-field-picker-opened":""} ${ot.i===m&&"itm-focus"}`,onClick:ft=>mt(ft,ot.i),onKeyDown:ft=>mt(ft,ot.i),role:"button",tabIndex:0,onContextMenu:ft=>dt(ft,ot.i),children:u.jsx(F.Suspense,{fallback:u.jsx(Ll,{layout:ot}),children:u.jsx(Ul,{layoutItem:ot,removeLayoutItem:As,cloneLayoutItem:ee,fields:w,formID:i,navigateToFieldSettings:ma,navigateToStyle:ga,handleContextMenu:dt,resizingFld:_,showFieldPicker:Ol})})},ot.i))}),!((Ea=d==null?void 0:d[C])!=null&&Ea.length)&&!V&&u.jsx("div",{className:"empty-layout",children:u.jsxs("div",{className:"empty-layout-msg",children:[u.jsx("div",{className:"empty-layout-msg-txt",children:u.jsx("span",{children:ve("Drag and drop fields here")})}),!S&&u.jsxs("button",{type:"button",className:"empty-layout-add-btn blk-wrp-add-btn",onClick:Vi,children:[u.jsx(oh,{size:15}),ve("Add Field")]})]})})]})})),u.jsxs("div",A(b({ref:Z,"data-testid":`${t}-pair-btn-wrp`,"data-dev-pair-btn-wrp":t,className:`${t}-pair-btn-wrp ${x(t,"pair-btn-wrp")}`},N(t,"pair-btn-wrp")),{children:[e.addBtn.show&&u.jsxs("button",A(b({"data-testid":t,"data-dev-rpt-add-btn":t,className:`${t}-rpt-add-btn ${x(t,"rpt-add-btn")}`},N(t,"rpt-add-btn")),{type:"button",children:[e.addBtnPreIcn&&u.jsx("img",b({"data-testid":`${t}-rpt-add-btn-pre-i`,"data-dev-rpt-add-btn-pre-i":t,className:`${t}-rpt-add-btn-pre-i ${x(t,"rpt-add-btn-pre-i")}`,src:`${e.addBtnPreIcn}`,alt:""},N(t,"rpt-add-btn-pre-i"))),u.jsx(We,{html:e.addBtn.txt||""}),e.addBtnSufIcn&&u.jsx("img",b({"data-testid":`${t}-rpt-add-btn-suf-i`,"data-dev-rpt-add-btn-suf-i":t,className:`${t}-rpt-add-btn-suf-i ${x(t,"rpt-add-btn-suf-i")}`,src:e.addBtnSufIcn,alt:""},N(t,"rpt-add-btn-suf-i")))]})),u.jsxs("button",A(b({"data-testid":t,"data-dev-rpt-rmv-btn":t,className:`${t}-rpt-rmv-btn ${x(t,"rpt-rmv-btn")}`},N(t,"rpt-rmv-btn")),{type:"button",children:[e.removeBtnPreIcn&&u.jsx("img",b({"data-testid":`${t}-rpt-rmv-btn-pre-i`,"data-dev-rpt-rmv-btn-pre-i":t,className:`${t}-rpt-rmv-btn-pre-i ${x(t,"rpt-rmv-btn-pre-i")}`,src:`${e.removeBtnPreIcn}`,alt:""},N(t,"rpt-rmv-btn-pre-i"))),u.jsx(We,{html:e.removeBtn.txt||""}),e.removeBtnSufIcn&&u.jsx("img",b({"data-testid":`${t}-rpt-rmv-btn-suf-i`,"data-dev-rpt-rmv-btn-suf-i":t,className:`${t}-rpt-rmv-btn-suf-i ${x(t,"rpt-rmv-btn-suf-i")}`,src:e.removeBtnSufIcn,alt:""},N(t,"rpt-btn-btn-suf-i")))]}))]}))]})),e.addToEndBtn.show&&u.jsx("div",A(b({"data-testid":`${t}-add-to-end-btn-wrp`,"data-dev-add-to-end-btn-wrp":t,className:`${t}-add-to-end-btn-wrp ${x(t,"add-to-end-btn-wrp")}`},N(t,"add-to-end-btn-wrp")),{children:u.jsxs("button",A(b({"data-testid":t,"data-dev-add-to-end-btn":t,className:`${t}-add-to-end-btn ${x(t,"add-to-end-btn")}`},N(t,"add-to-end-btn")),{type:"button",children:[e.addToEndBtnPreIcn&&u.jsx("img",b({"data-testid":`${t}-add-to-end-btn-pre-i`,"data-dev-add-to-end-btn-pre-i":t,className:`${t}-add-to-end-btn-pre-i ${x(t,"add-to-end-btn-pre-i")}`,src:e.addToEndBtnPreIcn,alt:""},N(t,"add-to-end-btn-pre-i"))),u.jsx(We,{html:e.addToEndBtn.txt||""}),e.addToEndBtnSufIcn&&u.jsx("img",b({"data-testid":`${t}-add-to-end-btn-suf-i`,"data-dev-add-to-end-btn-suf-i":t,className:`${t}-add-to-end-btn-suf-i ${x(t,"add-to-end-btn-suf-i")}`,src:e.addToEndBtnSufIcn,alt:""},N(t,"add-to-end-btn-suf-i")))]}))}))]}))}))})]})}var bx=F.memo(Ex);function Ix({fieldKey:t,attr:e,styleClasses:s,formID:i}){var ma,ga;const{formType:n}=ac(),a=Ks(s),[l,c]=Os(ep),d=et(Vu),[h,p]=F.useState(Ks(l[t]||{lg:[],md:[],sm:[]})),[f,m]=Os(sp),[E,g]=Os(ip),I=ti(zu),w=et(jt),{styleMode:S}=et(_e),[_,R]=Os(ca),L=F.useRef(null),{ref:M,isComponentVisible:D,setIsComponentVisible:G}=et(Wu),C=et(un),k=et(Hu),{recalculateNestedField:q}=et(ah),W=ti(qu),V=ti(Yu),X=et(Xu),{fieldKey:j,parentFieldKey:K,counter:B}=q,H=rh(),tt=Zu(),U=F.useRef(null),Z=F.useRef(null),J=F.useRef(C);F.useEffect(()=>{if(B>0&&t===K){const dt=Qu(h,j);p(dt),F.startTransition(()=>{c(mt=>re(mt,Ot=>{Ot[t]=dt})),Pt(t)})}},[B,K,j]),F.useEffect(()=>{p(Ks(l[t]||{lg:[],md:[],sm:[]}))},[l[t]]),F.useEffect(()=>{if(k.respectLGLayoutOrder&&h.lg&&h.lg.length>0&&h.lg.length<100)try{const mt=Cl("lg",h.lg,h,!0,ka);p(mt),F.startTransition(()=>{c(Ot=>re(Ot,Bt=>{Bt[t]=mt}))})}catch(mt){}},[]),F.useEffect(()=>{const dt=J.current;if(dt!==C&&k.respectLGLayoutOrder){U.current&&(U.current(),U.current=null),Z.current&&(clearTimeout(Z.current),Z.current=null);const mt=Ju(`nested-${t}-breakpoint-switch`,()=>{try{const Ot=Or("nestedLayouts")[t];if(!Ot)return;const Bt=Cl(dt,Ot[dt],Ot,!0,ka);p(Bt),F.startTransition(()=>{c(ee=>re(ee,As=>{As[t]=Bt}))})}catch(Ot){W({show:!0,msg:"Failed to sync nested layout"})}},300);U.current=mt}return J.current=C,()=>{U.current&&U.current(),Z.current&&clearTimeout(Z.current)}},[C,k.respectLGLayoutOrder,t,c]);const it=dt=>{dt.findIndex(mt=>mt.i==="shadow_block")<0&&(U.current&&(U.current(),U.current=null),Z.current&&(clearTimeout(Z.current),Z.current=null),p(mt=>A(b({},mt),{[C]:dt})),F.startTransition(()=>{c(mt=>re(mt,Ot=>{Ot!=null&&Ot[t]&&(Ot[t][C]=dt)}))}))},at=(dt,mt)=>{const Ot=$l(X.fieldData,"section");if(!Ot)return;const{newLayouts:Bt,historyData:ee}=ap(h,Ot,X.fieldSize,mt);p(Bt),F.startTransition(()=>{V(!0),c(As=>re(As,Vi=>{Vi[t]=Bt})),Pt(t),ee.state.nestedLayouts=Or("nestedLayouts"),yl(ee)})},vt=Gt(`.${t}-inp-fld-wrp`),_t=vt&&Ko(vt),ct=_t?_t.width-(_t.paddingLeft+_t.paddingRight+_t.borderLeft+_t.borderRight):0,ut=()=>{m({}),G(!1)},Et=()=>{H(tt.pathname.replace(/style\/.+|style/g,"fs"),{replace:!0}),ut()},St=dt=>{H(`/form/builder/${n}/${i}/field-theme-customize/quick-tweaks/${dt}`,{replace:!0}),ut()},It=(dt,mt)=>{dt.preventDefault(),dt.stopPropagation(),pn(dt,mt)},oe=(dt,mt)=>{dt.stopPropagation(),g(mt),Wa(f)||m({}),ys(),!S&&H(`/form/builder/${n}/${i}/field-settings/${mt}`)},ys=()=>{Wa(_)||(L.current!==null&&clearTimeout(L.current),L.current=setTimeout(()=>{R({}),L.current=null},700))},pn=(dt,mt)=>{var Ut;const{button:Ot}=dt;let Bt,ee,As,Vi;const fn=M.current.getBoundingClientRect().top+window.scrollY,mn=M.current.getBoundingClientRect().left+window.scrollX,Ea=Gt("#layout-wrapper"),ot=Number(Ea.style.width.match(/\d+/gi)),ft=Number(Ea.style.height.match(/\d+/gi)),xt=170,$t=200;if(Ot===0){const is=(Ut=Gt(`[data-key="${mt}"]`))==null?void 0:Ut.querySelector(".blk-wrp-down-btn"),ei=30,gn=is.getBoundingClientRect().top+ei,En=is.getBoundingClientRect().left;if(Bt=En-mn+5,ee=gn-fn+2,As=Bt+xt>ot,Vi=ee+$t>ft,As&&(Bt=En+ei-mn-148),Vi&&(ee=gn-fn-($t+ei+7)),E!==mt&&(Bt+=3),D&&f.fldKey===mt&&f.x===Bt&&f.y===ee){ut();return}}else Ot===2&&(Bt=dt.clientX-mn+5,ee=dt.clientY-fn,As=Bt+xt>ot,Vi=ee+$t>ft,As&&(Bt=dt.clientX-mn-150),Vi&&(ee=dt.clientY-fn-$t));g(mt),m({fldKey:mt,x:Bt,y:ee}),G(!0)},Ls=dt=>{if(!No){I(b({show:!0},tp.fieldClone));return}const mt=w[dt];if(!$l(mt))return;const{newLayouts:Ot}=op(dt,h);p(Ot),F.startTransition(()=>{c(Bt=>re(Bt,ee=>{ee[t]=Ot})),Pt(t)})},Ui=dt=>{const{newLayouts:mt,historyData:Ot}=lp(dt,h);p(mt),F.startTransition(()=>{c(Bt=>re(Bt,ee=>{ee[t]=mt})),Pt(t),Ot.state.nestedLayouts=Or("nestedLayouts"),yl(Ot)}),H(`/form/builder/${n}/${i}/fields-list`,{replace:!0})},fa=dt=>{dt.stopPropagation(),Ol(dt,{i:t,x:0,y:0,h:0,w:60},t)};return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:i,fieldKey:t,fieldData:e,noErrMsg:!0,children:u.jsx("div",A(b({"data-testid":`${t}-inp-fld-wrp`,"data-dev-inp-fld-wrp":t,className:`${t}-inp-fld-wrp ${x(t,"inp-fld-wrp")}`},N(t,"inp-fld-wrp")),{children:u.jsxs("div",{style:{width:ct,display:"inline-block"},id:`${t}-layout-wrapper`,onDragOver:dt=>dt.preventDefault(),onDragEnter:dt=>dt.preventDefault(),onMouseMove:()=>F.startTransition(()=>{V(!1)}),onMouseLeave:()=>F.startTransition(()=>{V(!0)}),children:[S?u.jsx("div",{className:"_frm-g",children:h==null?void 0:h[C].map(dt=>u.jsx("div",{"data-key":dt.i,className:dt.i,onClick:mt=>oe(mt,dt.i),onKeyDown:mt=>oe(mt,dt.i),role:"button",tabIndex:0,onContextMenu:mt=>It(mt,dt.i),children:u.jsx(F.Suspense,{fallback:u.jsx(Ll,{layout:dt}),children:u.jsx(Ul,{layoutItem:dt,removeLayoutItem:Ui,cloneLayoutItem:Ls,navigateToFieldSettings:Et,navigateToStyle:St,handleContextMenu:It})})},dt.i))}):u.jsx(rp,{width:ct,measureBeforeMount:!0,compactType:"vertical",preventCollision:!1,useCSSTransforms:!0,isDroppable:X!==null&&C==="lg",className:`layout b${i}-bf-section-grid bf-section-grid`,style:{minHeight:X?Ku()+40:null},onDrop:at,resizeHandles:["e","w"],droppingItem:X==null?void 0:X.fieldSize,onLayoutChange:it,cols:ka[C],rowHeight:1,margin:[0,0],draggableCancel:".no-drg",draggableHandle:".drag",layout:h==null?void 0:h[C],onDragStart:Al,onDrag:Oc,onDragStop:()=>{F.startTransition(()=>{V(!0),Pt(t),ys()})},onResizeStart:Al,onResize:Oc,onResizeStop:()=>{ys(),Pt(t)},children:(ma=h==null?void 0:h[C])==null?void 0:ma.map(dt=>u.jsx("div",{"data-key":dt.i,className:`blk ${d.show&&d.addAfterFieldKey===dt.i?"add-field-picker-opened":""} ${dt.i===E&&"itm-focus"}`,onClick:mt=>oe(mt,dt.i),onKeyDown:mt=>oe(mt,dt.i),role:"button",tabIndex:0,onContextMenu:mt=>It(mt,dt.i),children:u.jsx(F.Suspense,{fallback:u.jsx(Ll,{layout:dt}),children:u.jsx(Ul,{layoutItem:dt,removeLayoutItem:Ui,cloneLayoutItem:Ls,navigateToFieldSettings:Et,navigateToStyle:St,handleContextMenu:It,showFieldPicker:Ol})})},dt.i))}),!((ga=h==null?void 0:h[C])!=null&&ga.length)&&!X&&u.jsx("div",{className:"empty-layout",children:u.jsxs("div",{className:"empty-layout-msg",children:[u.jsx("div",{className:"empty-layout-msg-txt",children:u.jsx("span",{children:ve("Drag and drop fields here")})}),!S&&u.jsxs("button",{type:"button",className:"empty-layout-add-btn blk-wrp-add-btn",onClick:fa,children:[u.jsx(oh,{size:15}),ve("Add Field")]})]})})]})}))})]})}var vx=F.memo(Ix);function wx({fieldKey:t,attr:e,styleClasses:s}){var a,l;const{styleMode:i}=et(_e),n=((a=e.valid)==null?void 0:a.hide)||!1;return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:s}),u.jsx("div",A(b({"data-dev-fld-wrp":t,className:`${t}-fld-wrp ${i?"":"drag"} ${x(t,"fld-wrp")} ${n?"fld-hide":""}`},N(t,"fld-wrp")),{children:u.jsx("code",{style:{display:"block",maxWidth:"100%",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:e.content||((l=e==null?void 0:e.info)==null?void 0:l.content)||""})}))]})}class Gl{constructor(e,s,i,n){if(isNaN(e)||isNaN(s))throw new Error(`Point is invalid: (${e}, ${s})`);this.x=+e,this.y=+s,this.pressure=i||0,this.time=n||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class Rh{static fromPoints(e,s){const i=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Rh(e[1],i,n,e[2],s.start,s.end)}static calculateControlPoints(e,s,i){const n=e.x-s.x,a=e.y-s.y,l=s.x-i.x,c=s.y-i.y,d={x:(e.x+s.x)/2,y:(e.y+s.y)/2},h={x:(s.x+i.x)/2,y:(s.y+i.y)/2},p=Math.sqrt(n*n+a*a),f=Math.sqrt(l*l+c*c),m=d.x-h.x,E=d.y-h.y,g=f/(p+f),I={x:h.x+m*g,y:h.y+E*g},w=s.x-I.x,S=s.y-I.y;return{c1:new Gl(d.x+w,d.y+S),c2:new Gl(h.x+w,h.y+S)}}constructor(e,s,i,n,a,l){this.startPoint=e,this.control2=s,this.control1=i,this.endPoint=n,this.startWidth=a,this.endWidth=l}length(){let s=0,i,n;for(let a=0;a<=10;a+=1){const l=a/10,c=this.point(l,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),d=this.point(l,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(a>0){const h=c-i,p=d-n;s+=Math.sqrt(h*h+p*p)}i=c,n=d}return s}point(e,s,i,n,a){return s*(1-e)*(1-e)*(1-e)+3*i*(1-e)*(1-e)*e+3*n*(1-e)*e*e+a*e*e*e}}class _x{constructor(){try{this._et=new EventTarget}catch(e){this._et=document}}addEventListener(e,s,i){this._et.addEventListener(e,s,i)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,s,i){this._et.removeEventListener(e,s,i)}}function Tx(t,e=250){let s=0,i=null,n,a,l;const c=()=>{s=Date.now(),i=null,n=t.apply(a,l),i||(a=null,l=[])};return function(...h){const p=Date.now(),f=e-(p-s);return a=this,l=h,f<=0||f>e?(i&&(clearTimeout(i),i=null),s=p,n=t.apply(a,l),i||(a=null,l=[])):i||(i=window.setTimeout(c,f)),n}}class Bl extends _x{constructor(e,s={}){super(),this.canvas=e,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this._handleMouseDown=i=>{i.buttons===1&&this._strokeBegin(i)},this._handleMouseMove=i=>{this._strokeMoveUpdate(i)},this._handleMouseUp=i=>{i.buttons===1&&this._strokeEnd(i)},this._handleTouchStart=i=>{if(i.cancelable&&i.preventDefault(),i.targetTouches.length===1){const n=i.changedTouches[0];this._strokeBegin(n)}},this._handleTouchMove=i=>{i.cancelable&&i.preventDefault();const n=i.targetTouches[0];this._strokeMoveUpdate(n)},this._handleTouchEnd=i=>{if(i.target===this.canvas){i.cancelable&&i.preventDefault();const a=i.changedTouches[0];this._strokeEnd(a)}},this._handlePointerStart=i=>{i.preventDefault(),this._strokeBegin(i)},this._handlePointerMove=i=>{this._strokeMoveUpdate(i)},this._handlePointerEnd=i=>{this._drawingStroke&&(i.preventDefault(),this._strokeEnd(i))},this.velocityFilterWeight=s.velocityFilterWeight||.7,this.minWidth=s.minWidth||.5,this.maxWidth=s.maxWidth||2.5,this.throttle="throttle"in s?s.throttle:16,this.minDistance="minDistance"in s?s.minDistance:5,this.dotSize=s.dotSize||0,this.penColor=s.penColor||"black",this.backgroundColor=s.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=s.compositeOperation||"source-over",this.canvasContextOptions="canvasContextOptions"in s?s.canvasContextOptions:{},this._strokeMoveUpdate=this.throttle?Tx(Bl.prototype._strokeUpdate,this.throttle):Bl.prototype._strokeUpdate,this._ctx=e.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:e,canvas:s}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,s.width,s.height),e.fillRect(0,0,s.width,s.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0}fromDataURL(e,s={}){return new Promise((i,n)=>{const a=new Image,l=s.ratio||window.devicePixelRatio||1,c=s.width||this.canvas.width/l,d=s.height||this.canvas.height/l,h=s.xOffset||0,p=s.yOffset||0;this._reset(this._getPointGroupOptions()),a.onload=()=>{this._ctx.drawImage(a,h,p,c,d),i()},a.onerror=f=>{n(f)},a.crossOrigin="anonymous",a.src=e,this._isEmpty=!1})}toDataURL(e="image/png",s){return e==="image/svg+xml"?(typeof s!="object"&&(s=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(s))}`):(typeof s!="number"&&(s=void 0),this.canvas.toDataURL(e,s))}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const e=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerStart),this.canvas.removeEventListener("pointermove",this._handlePointerMove),this.canvas.ownerDocument.removeEventListener("pointerup",this._handlePointerEnd),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("mousemove",this._handleMouseMove),this.canvas.ownerDocument.removeEventListener("mouseup",this._handleMouseUp),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this.canvas.removeEventListener("touchmove",this._handleTouchMove),this.canvas.removeEventListener("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(e,{clear:s=!0}={}){s&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_getPointGroupOptions(e){return{penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:e,cancelable:!0})))return;this._drawingStroke=!0;const i=this._getPointGroupOptions(),n=Object.assign(Object.assign({},i),{points:[]});this._data.push(n),this._reset(i),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:e}));const s=e.clientX,i=e.clientY,n=e.pressure!==void 0?e.pressure:e.force!==void 0?e.force:0,a=this._createPoint(s,i,n),l=this._data[this._data.length-1],c=l.points,d=c.length>0&&c[c.length-1],h=d?a.distanceTo(d)<=this.minDistance:!1,p=this._getPointGroupOptions(l);if(!d||!(d&&h)){const f=this._addPoint(a,p);d?f&&this._drawCurve(f,p):this._drawDot(a,p),c.push({time:a.time,x:a.x,y:a.y,pressure:a.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:e}))}_strokeEnd(e){this._drawingStroke&&(this._strokeUpdate(e),this._drawingStroke=!1,this.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerStart),this.canvas.addEventListener("pointermove",this._handlePointerMove),this.canvas.ownerDocument.addEventListener("pointerup",this._handlePointerEnd)}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown),this.canvas.addEventListener("mousemove",this._handleMouseMove),this.canvas.ownerDocument.addEventListener("mouseup",this._handleMouseUp)}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart),this.canvas.addEventListener("touchmove",this._handleTouchMove),this.canvas.addEventListener("touchend",this._handleTouchEnd)}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,s,i){const n=this.canvas.getBoundingClientRect();return new Gl(e-n.left,s-n.top,i,new Date().getTime())}_addPoint(e,s){const{_lastPoints:i}=this;if(i.push(e),i.length>2){i.length===3&&i.unshift(i[0]);const n=this._calculateCurveWidths(i[1],i[2],s),a=Rh.fromPoints(i,n);return i.shift(),a}return null}_calculateCurveWidths(e,s,i){const n=i.velocityFilterWeight*s.velocityFrom(e)+(1-i.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(n,i),l={end:a,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=a,l}_strokeWidth(e,s){return Math.max(s.maxWidth/(e+1),s.minWidth)}_drawCurveSegment(e,s,i){const n=this._ctx;n.moveTo(e,s),n.arc(e,s,i,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,s){const i=this._ctx,n=e.endWidth-e.startWidth,a=Math.ceil(e.length())*2;i.beginPath(),i.fillStyle=s.penColor;for(let l=0;l<a;l+=1){const c=l/a,d=c*c,h=d*c,p=1-c,f=p*p,m=f*p;let E=m*e.startPoint.x;E+=3*f*c*e.control1.x,E+=3*p*d*e.control2.x,E+=h*e.endPoint.x;let g=m*e.startPoint.y;g+=3*f*c*e.control1.y,g+=3*p*d*e.control2.y,g+=h*e.endPoint.y;const I=Math.min(e.startWidth+h*n,s.maxWidth);this._drawCurveSegment(E,g,I)}i.closePath(),i.fill()}_drawDot(e,s){const i=this._ctx,n=s.dotSize>0?s.dotSize:(s.minWidth+s.maxWidth)/2;i.beginPath(),this._drawCurveSegment(e.x,e.y,n),i.closePath(),i.fillStyle=s.penColor,i.fill()}_fromData(e,s,i){for(const n of e){const{points:a}=n,l=this._getPointGroupOptions(n);if(a.length>1)for(let c=0;c<a.length;c+=1){const d=a[c],h=new Gl(d.x,d.y,d.pressure,d.time);c===0&&this._reset(l);const p=this._addPoint(h,l);p&&s(p,l)}else this._reset(l),i(a[0],l)}}toSVG({includeBackgroundColor:e=!1}={}){const s=this._data,i=Math.max(window.devicePixelRatio||1,1),n=0,a=0,l=this.canvas.width/i,c=this.canvas.height/i,d=document.createElementNS("http://www.w3.org/2000/svg","svg");if(d.setAttribute("xmlns","http://www.w3.org/2000/svg"),d.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),d.setAttribute("viewBox",`${n} ${a} ${l} ${c}`),d.setAttribute("width",l.toString()),d.setAttribute("height",c.toString()),e&&this.backgroundColor){const h=document.createElement("rect");h.setAttribute("width","100%"),h.setAttribute("height","100%"),h.setAttribute("fill",this.backgroundColor),d.appendChild(h)}return this._fromData(s,(h,{penColor:p})=>{const f=document.createElement("path");if(!isNaN(h.control1.x)&&!isNaN(h.control1.y)&&!isNaN(h.control2.x)&&!isNaN(h.control2.y)){const m=`M ${h.startPoint.x.toFixed(3)},${h.startPoint.y.toFixed(3)} C ${h.control1.x.toFixed(3)},${h.control1.y.toFixed(3)} ${h.control2.x.toFixed(3)},${h.control2.y.toFixed(3)} ${h.endPoint.x.toFixed(3)},${h.endPoint.y.toFixed(3)}`;f.setAttribute("d",m),f.setAttribute("stroke-width",(h.endWidth*2.25).toFixed(3)),f.setAttribute("stroke",p),f.setAttribute("fill","none"),f.setAttribute("stroke-linecap","round"),d.appendChild(f)}},(h,{penColor:p,dotSize:f,minWidth:m,maxWidth:E})=>{const g=document.createElement("circle"),I=f>0?f:(m+E)/2;g.setAttribute("r",I.toString()),g.setAttribute("cx",h.x.toString()),g.setAttribute("cy",h.y.toString()),g.setAttribute("fill",p),d.appendChild(g)}),d.outerHTML}}var Wt,aa,Ys,Rs,Cs,Ie,qn,$o,Yn,yo,Xs,an,rc,Lo,Ao,on,Xn,ln,cn,oa,gt,Xi,lg,ja,cg,Rl,dg,hg,ug,be;class xx{constructor(e,s){O(this,gt);O(this,Wt,null);O(this,aa,null);O(this,Ys,null);O(this,Rs,null);O(this,Cs,null);O(this,Ie,null);O(this,qn,null);O(this,$o,{});O(this,Yn,null);O(this,yo,null);O(this,Xs,null);O(this,an,null);O(this,rc,null);O(this,Lo,null);O(this,Ao,null);O(this,on,[]);O(this,Xn,null);O(this,ln,null);O(this,cn,null);O(this,oa,null);T(this,Yn,s.document||document),T(this,yo,s.window||window),typeof e=="string"?T(this,qn,r(this,Yn).querySelector(e)):T(this,qn,e),T(this,$o,{maxWidth:s.maxWidth||2.5,penColor:s.penColor||"rgb(0, 0, 0)",backgroundColor:s.backgroundColor||"rgb(255, 255, 255)"}),T(this,Xs,s.fieldKey),T(this,aa,s.imgTyp||"image/png"),T(this,Ao,(s==null?void 0:s.isBuilder)||!1),T(this,rc,s==null?void 0:s.contentId),T(this,Lo,s==null?void 0:s.assetsURL),T(this,Xn,(s==null?void 0:s.oldSignature)||null),T(this,ln,(s==null?void 0:s.oldSignatureFile)||null),this.init()}init(){T(this,Wt,o(this,gt,Xi).call(this,`.${r(this,Xs)}-signature-pad`)),T(this,Ys,o(this,gt,Xi).call(this,`.${r(this,Xs)}-clr-btn`)),T(this,Rs,o(this,gt,Xi).call(this,`.${r(this,Xs)}-undo-btn`)),T(this,Cs,o(this,gt,Xi).call(this,`.${r(this,Xs)}-redo-btn`)),T(this,an,o(this,gt,Xi).call(this,`.${r(this,Xs)}-signature-fld`)),r(this,Wt).style.cursor=`url(${r(this,Lo)}pen.ico), crosshair`;const e=o(this,gt,Xi).call(this,`.${r(this,Xs)}-signature-iframe`);e&&e.contentWindow.addEventListener("resize",()=>{this.resizeCanvas()}),T(this,Ie,new Bl(r(this,Wt),r(this,$o))),this.resizeCanvas(),o(this,gt,dg).call(this),o(this,gt,hg).call(this),o(this,gt,ug).call(this),o(this,gt,be).call(this,r(this,Rs)),o(this,gt,be).call(this,r(this,Cs)),o(this,gt,be).call(this,r(this,Ys)),o(this,gt,lg).call(this),r(this,Ie).addEventListener("endStroke",()=>{T(this,on,[]),this.putSignature(),o(this,gt,be).call(this,r(this,Ys),!1),o(this,gt,be).call(this,r(this,Rs),!1),o(this,gt,be).call(this,r(this,Cs))}),r(this,Wt).addEventListener("touchmove",s=>{s.preventDefault();const i=s.touches[0],n=new MouseEvent("mousemove",{clientX:i.clientX,clientY:i.clientY});r(this,Wt).dispatchEvent(n)})}resizeCanvas(){const e=Math.max(r(this,yo).devicePixelRatio||1,1);r(this,Wt).width=r(this,Wt).offsetWidth*e,r(this,Wt).height=r(this,Wt).offsetHeight*e,r(this,Wt).getContext("2d").scale(e,e),o(this,gt,ja).call(this,r(this,Ie).toData())}putSignature(){if(r(this,Ao)||r(this,Ie).isEmpty())return;const e=r(this,Ie).toDataURL(r(this,aa));r(this,an).value=e}destroy(){T(this,Yn,null),T(this,Wt,null)}reset(){r(this,Ie).clear(),o(this,gt,Rl).call(this),r(this,an).value=""}setSignature(e){if(!r(this,Ie))return;r(this,Ie).clear(),o(this,gt,Rl).call(this);const s=new Image;s.onload=()=>{const i=r(this,Wt).getContext("2d");i.clearRect(0,0,r(this,Wt).width,r(this,Wt).height),i.drawImage(s,0,0,r(this,Wt).width,r(this,Wt).height);const n=r(this,Wt).toDataURL(r(this,aa));r(this,Ie).fromDataURL(n),this.putSignature()},s.src=e,o(this,gt,be).call(this,r(this,Ys),!1)}}Wt=new WeakMap,aa=new WeakMap,Ys=new WeakMap,Rs=new WeakMap,Cs=new WeakMap,Ie=new WeakMap,qn=new WeakMap,$o=new WeakMap,Yn=new WeakMap,yo=new WeakMap,Xs=new WeakMap,an=new WeakMap,rc=new WeakMap,Lo=new WeakMap,Ao=new WeakMap,on=new WeakMap,Xn=new WeakMap,ln=new WeakMap,cn=new WeakMap,oa=new WeakMap,gt=new WeakSet,Xi=function(e,s=null){return(s||r(this,qn)).querySelector(e)},lg=function(){if(!r(this,ln))return;const e=`${r(this,Xs)}_old`;let s=o(this,gt,Xi).call(this,`input[name="${e}"]`);if(s||(s=r(this,Yn).createElement("input"),s.type="hidden",s.name=e,r(this,qn).appendChild(s)),s.value=r(this,ln),T(this,oa,s),!r(this,Xn))return;const i=new Image;i.onload=()=>{T(this,cn,i),o(this,gt,ja).call(this,r(this,Ie).toData()),o(this,gt,be).call(this,r(this,Ys),!1)},i.src=r(this,Xn)},ja=function(e=[]){r(this,Ie).clear(),o(this,gt,cg).call(this),e.length&&r(this,Ie).fromData(e,{clear:!1})},cg=function(){r(this,cn)&&r(this,Wt).getContext("2d").drawImage(r(this,cn),0,0,r(this,Wt).offsetWidth,r(this,Wt).offsetHeight)},Rl=function(){!r(this,ln)&&!r(this,cn)||(T(this,ln,null),T(this,Xn,null),T(this,cn,null),r(this,oa)&&(r(this,oa).value=""))},dg=function(){r(this,Ys)&&r(this,Ys).addEventListener("click",()=>{r(this,Ie).clear(),o(this,gt,Rl).call(this),r(this,an).value="",o(this,gt,be).call(this,r(this,Rs)),o(this,gt,be).call(this,r(this,Cs)),o(this,gt,be).call(this,r(this,Ys))})},hg=function(){r(this,Rs)&&r(this,Rs).addEventListener("click",()=>{const e=r(this,Ie).toData();if(e.length){const s=e.pop();r(this,on).push(s),o(this,gt,ja).call(this,e),this.putSignature(),e.length===0&&(r(this,an).value=""),o(this,gt,be).call(this,r(this,Cs),!1),e.length||o(this,gt,be).call(this,r(this,Rs))}else o(this,gt,be).call(this,r(this,Rs))})},ug=function(){r(this,Cs)&&r(this,Cs).addEventListener("click",()=>{const e=r(this,Ie).toData();r(this,on).length?(e.push(r(this,on).pop()),o(this,gt,ja).call(this,e),this.putSignature(),o(this,gt,be).call(this,r(this,Rs),!1),r(this,on).length||o(this,gt,be).call(this,r(this,Cs))):o(this,gt,be).call(this,r(this,Cs))})},be=function(e,s=!0){e&&(s?e.setAttribute("disabled","disabled"):e.removeAttribute("disabled"))};function Sx({fieldKey:t,attr:e,formID:s,styleClasses:i}){const n=F.useRef(null),a=F.useRef(null),l=et(Mo),c=et(ca),d=F.useRef({resize:!1}),h=ti(Do),p=F.useRef(null),f=F.useRef(0),E=et(jt)[t];if(c.fieldKey===t){d.current.resize=!0;const g=Gt(`[data-key="${t}"]`),I=np(g);if(c.wrpHeight>=c.fldHeight){const w=`${c.fldHeight+(I-c.wrpHeight)}px`;a.current.style.height=w}}if(d.current.resize&&!c.fieldKey){d.current.resize=!1;const g=I=>`fields->${t}->classes->.${t}-fld->${I}`;h(I=>re(I,w=>{_r(w,g("height"),a.current.style.height),f.current+=1}))}return F.useEffect(()=>{var L;a.current||(p.current=Gt(`.${t}-inp-fld-wrp`));const g=n.current,I=p.current;g&&I&&"destroy"in g&&g.destroy();const{maxWidth:w,penColor:S,backgroundColor:_}=E.config,R={maxWidth:w,penColor:S,backgroundColor:_,document:(L=document.getElementById("bit-grid-layout"))==null?void 0:L.contentDocument,fieldKey:t,assetsURL:`${l.rootURL}/static/signature/`,isBuilder:!0};n.current=new xx(I,R)},[E,f.current]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:i}),u.jsx(At,{formID:s,fieldKey:t,fieldData:e,children:u.jsxs("div",A(b({"data-testid":`${t}-inp-fld-wrp`,"data-dev-inp-fld-wrp":t,className:`${t}-inp-fld-wrp ${x(t,"inp-fld-wrp")}`},N(t,"inp-fld-wrp")),{ref:p,children:[u.jsx("canvas",A(b({ref:a,className:`${t}-signature-pad ${x(t,"signature")}`,id:"canvas"},N(t,"signature-pad")),{"data-testid":`${t}-signature-pad`,"data-dev-fld":t})),u.jsxs("div",{className:`${t}-ctrl`,children:[!(E!=null&&E.clrBtnHide)&&u.jsxs("button",{id:"clear",className:`${t}-clr-btn`,type:"button","data-testid":`${t}-clr-btn`,"data-dev-clr-btn":t,children:[E.clrPreIcn&&u.jsx("img",b({"data-testid":`${t}-clr-btn-pre-i`,"data-dev-clr-btn-pre-i":t,className:`${t}-clr-btn-pre-i ${x(t,"clr-btn-pre-i")}`,src:E.clrPreIcn,alt:""},N(t,"clr-btn-pre-i"))),E.clrBtn,E.clrSufIcn&&u.jsx("img",b({"data-testid":`${t}-clr-btn-suf-i`,"data-dev-clr-btn-suf-i":t,className:`${t}-clr-btn-suf-i ${x(t,"clr-btn-suf-i")}`,src:E.clrSufIcn,alt:""},N(t,"clr-btn-suf-i")))]}),!(E!=null&&E.undoBtnHide)&&u.jsxs("button",{id:"undo",className:`${t}-undo-btn`,type:"button","data-testid":`${t}-undo-btn`,"data-dev-undo-btn":t,children:[(E==null?void 0:E.undoPreIcn)&&u.jsx("img",b({"data-testid":`${t}-undo-btn-pre-i`,"data-dev-undo-btn-pre-i":t,className:`${t}-undo-btn-pre-i ${x(t,"undo-btn-pre-i")}`,src:E.undoPreIcn,alt:""},N(t,"undo-btn-pre-i"))),E.undoBtn,(E==null?void 0:E.undoSufIcn)&&u.jsx("img",b({"data-testid":`${t}-undo-btn-suf-i`,"data-dev-btn-suf-i":t,className:`${t}-undo-btn-suf-i ${x(t,"undo-btn-suf-i")}`,src:E.undoSufIcn,alt:""},N(t,"undo-btn-suf-i")))]}),!(E!=null&&E.redoBtnHide)&&u.jsxs("button",{id:"redo",className:`${t}-redo-btn`,type:"button","data-testid":`${t}-redo-btn`,"data-dev-redo-btn":t,children:[(E==null?void 0:E.redoPreIcn)&&u.jsx("img",b({"data-testid":`${t}-redo-btn-pre-i`,"data-dev-redo-btn-pre-i":t,className:`${t}-redo-btn-pre-i ${x(t,"redo-btn-pre-i")}`,src:E.redoPreIcn,alt:""},N(t,"redo-btn-pre-i"))),E.redoBtn,(E==null?void 0:E.redoSufIcn)&&u.jsx("img",b({"data-testid":`${t}-redo-btn-suf-i`,"data-dev-btn-suf-i":t,className:`${t}-redo-btn-suf-i ${x(t,"redo-btn-suf-i")}`,src:E.redoSufIcn,alt:""},N(t,"redo-btn-suf-i")))]})]})]}))})]})}function Rx({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){var g;const l=e.typ==="url"?"text":e.typ,c=F.useRef(null),d=et(xg),{"--dir":h}=d,[p,f]=F.useState(e.val!==void 0?e.val:"");F.useEffect(()=>{e.val!==void 0&&!e.userinput?f(e.val):!e.val&&!e.userinput?f(e.defaultValue||""):e.conditional&&f(e.val)},[e.val,e.defaultValue,e.userinput,e.conditional]),F.useEffect(()=>{if(e.hasWorkflow&&e.val===p&&s&&!e.userinput){const{current:I}=c;s(I)}},[p]);const m=I=>{const w=e.typ==="email"?I.target.value.toLowerCase():I.target.value;f(w)};F.useEffect(()=>{const I=lh(`#${t}`);I&&ch(I,"value",(w,S)=>f(e.typ==="email"?S.toLowerCase():S))},[]);const E=I=>Ec({input:I.target});return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsxs(At,{formID:n,fieldKey:t,fieldData:e,children:[u.jsxs("div",A(b({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${x(t,"inp-fld-wrp")}`},N(t,"inp-fld-wrp")),{style:{"--bfv-fld-val":`'${p||50}'`},children:[u.jsx("input",A(b(A(b(b(b(b(b(b(b(b({"data-testid":t,"data-dev-fld":t,id:t,list:`${t}-datalist`,ref:c,className:`${t}-fld no-drg ${x(t,"fld")}`,type:l},"req"in e.valid&&{required:e.valid.req}),"disabled"in e.valid&&{disabled:e.valid.disabled}),"mn"in e&&{min:e.mn}),"mx"in e&&{max:e.mx}),"step"in e&&{step:e.step}),"ac"in e&&{autoComplete:e.ac}),"fieldName"in e&&{name:e.fieldName}),s&&{onInput:s}),{onBlur:E,value:p,onChange:m}),N(t,"fld")),{style:{"--bfv-fill-lower-track":p?`${Cx(p,e.mn,e.mx)}%`:"50%","--bfv-track-dir":h==="rtl"?"to left":"to right"}})),e.prefixIcn&&u.jsx("img",b({"data-testid":`${t}-pre-i`,"data-dev-pre-i":t,className:`${t}-pre-i ${x(t,"pre-i")}`,height:"90%",src:e.prefixIcn,alt:""},N(t,"pre-i"))),e.suffixIcn&&u.jsx("img",b({"data-testid":`${t}-suf-i`,"data-dev-suf-i":t,className:`${t}-suf-i ${x(t,"suf-i")}`,height:"90%",src:e.suffixIcn,alt:""},N(t,"suf-i"))),u.jsx("span",{className:`${t}-slider-val`,children:`${ve("Value:")} `})]})),((g=e.suggestions)==null?void 0:g.length)&&u.jsx("datalist",{id:`${t}-datalist`,children:e.suggestions.map(I=>u.jsx("option",{value:I.val||I.lbl,children:I.lbl},I.val||I.lbl))})]})]})}function Cx(t,e,s){const i=Number(e)||0,a=(s===void 0||s===""?100:Number(s))-i;return a?(Number(t)-i)/a*100:0}var Ox=F.memo(Rx);function $x({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){var d;const{styleMode:l}=et(_e),c=((d=e.valid)==null?void 0:d.hide)||!1;return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx("div",A(b({"data-dev-fld-wrp":t,className:`${t}-fld-wrp drag ${l?"":"drag"} ${c?"fld-hide":""} spacer-field-bg ${x(t,"fld-wrp")}`},N(t,"fld-wrp")),{"data-admin-label":e.adminLbl||e.lbl||t}))]})}function yx({fieldKey:t,formID:e,attr:s,isBuilder:i,styleClasses:n}){const a=et(oc),[l,c]=F.useState(""),h=et(jt)[t],p=F.useRef(null),f=F.useRef(null),[m,E]=F.useState(!1),[g,I]=F.useState(!1);h==null||h.payType;const{locale:w,currency:S}=h||{};return F.useEffect(()=>{if(!s.payIntegID){c("");return}const _=a==null?void 0:a.find(R=>R.id&&s.payIntegID&&Number(R.id)===Number(s.payIntegID));if(_){const R=_.publishableKey;c(R)}},[s.payIntegID]),F.useEffect(()=>{if(!l){za({fieldKey:t,errorKey:"publishableKeyMissing",errorMsg:ve("Stripe publishable key is missing"),errorUrl:`field-settings/${t}`});return}I(!0),lc(t,"publishableKeyMissing");const R={src:"https://js.stripe.com/v3/",integrity:"",id:`bf-stripe-script-${t}`,scriptInGrid:!1,callback:()=>{Pt(t),E(!0),I(!1)}};return Po(R),()=>{nh(`bf-stripe-script-${t}`)}},[l,w,S]),F.useEffect(()=>{if(!m||g)return;p!=null&&p.current||(p.current=Gt(`#${t}-stripe-wrp`));const _=f.current,R=p.current;if((!l||_&&R&&"destroy"in _)&&(_.destroy(),Pt(t)),!l)return E(!1);b({},h.config.options),b({},h.config.layout)},[m,g]),u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:n}),u.jsxs(At,{formID:e,fieldData:s,fieldKey:t,noLabel:!0,isBuilder:i,children:[m&&l&&!g&&u.jsxs("div",{className:`${t}-stripe-wrp`,children:[u.jsxs("button",{"data-dev-stripe-btn":t,type:"button",className:`${t}-stripe-btn`,children:[u.jsx("svg",{"data-dev-stripe-icn":t,xmlns:"http://www.w3.org/2000/svg",className:`${t}-stripe-icn`,viewBox:"0 0 24 24",children:u.jsxs("g",{fill:"none",fillRule:"evenodd",children:[u.jsx("path",{d:"M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"}),u.jsx("path",{fill:"currentColor",d:"M6.936 3.715C8.326 2.567 10.24 2 12.404 2c1.746 0 3.49.275 5.259.981a1 1 0 0 1 .629.929v3.64c0 1.244-1.286 1.916-2.291 1.5c-1.198-.494-2.532-.759-3.597-.759c-.217 0-.386.016-.512.04c-.05.01-.089.02-.12.03c.089.072.25.17.528.29c.309.134.68.263 1.129.416l.061.02c.42.144.892.305 1.367.495c.99.396 2.094.954 2.95 1.882c.885.957 1.445 2.241 1.45 3.954v.003c0 2.065-.835 3.755-2.305 4.904C15.511 21.454 13.542 22 11.34 22a14.62 14.62 0 0 1-5.777-1.21a1 1 0 0 1-.604-.918V16.18c0-1.241 1.297-1.937 2.322-1.47c1.39.636 2.901 1.038 4.059 1.038c.497 0 .761-.073.87-.134a.255.255 0 0 0 .017-.01a.352.352 0 0 0 .005-.062v-.005a.34.34 0 0 0-.04-.05c-.084-.086-.25-.205-.56-.353a13.21 13.21 0 0 0-1.112-.444a146.78 146.78 0 0 0-.22-.08c-.373-.135-.782-.283-1.189-.448c-.973-.395-2.066-.935-2.916-1.81c-.882-.908-1.453-2.127-1.453-3.753c0-2.026.782-3.717 2.194-4.883ZM8.21 5.257c-.918.758-1.467 1.866-1.467 3.34c0 1.104.366 1.824.888 2.361c.555.571 1.334.985 2.233 1.349c.369.15.736.283 1.107.417l.234.085c.437.16.888.329 1.288.519c.713.34 1.74.97 1.74 2.213c0 .375-.083.744-.277 1.077a2.015 2.015 0 0 1-.766.74c-.561.314-1.243.39-1.85.39c-1.373 0-2.957-.408-4.38-.998v2.447c1.503.562 3.001.803 4.38.803c1.898 0 3.388-.473 4.381-1.249c.964-.754 1.537-1.852 1.538-3.327c-.005-1.234-.39-2.03-.92-2.602c-.556-.603-1.334-1.026-2.223-1.382c-.426-.17-.855-.316-1.285-.463l-.047-.017a17.654 17.654 0 0 1-1.278-.473c-.387-.168-.809-.387-1.142-.703c-.362-.344-.634-.819-.634-1.424c0-.72.328-1.323.936-1.683c.52-.308 1.157-.385 1.739-.385c1.203 0 2.597.259 3.888.728V4.608C15.002 4.177 13.717 4 12.404 4c-1.836 0-3.255.481-4.195 1.257Z"})]})}),h.txt]}),u.jsx("button",{type:"button","data-dev-stripe-pay-btn":t,className:"stripe-pay-btn",children:h.config.payBtnTxt})]}),!g&&(!m||!l)&&u.jsxs("p",{children:["Please select a Stripe account from",u.jsx("strong",{children:" Field Settings "}),"to load Stripe field."]}),g&&u.jsx("p",{children:"Loading Stripe..."})]})]})}function Lx({attr:t,buttonDisabled:e,handleReset:s,formID:i,fieldKey:n}){return u.jsx("div",A(b({className:`fld-wrp fld-wrp-${i} ${x(n,"fld-wrp")}`,"btcd-fld":"submit"},N(n,"fld-wrp")),{children:u.jsxs("div",A(b({className:`btcd-frm-sub ${t.align==="center"&&"j-c-c"} ${t.align==="right"&&"j-c-e"} ${x(n,"btcd-frm-sub")}`},N(n,"btcd-frm-sub")),{children:[u.jsxs("button",A(b({className:`btcd-sub-btn btcd-sub ${t.btnSiz==="md"&&"btcd-btn-md"} ${t.fulW&&"ful-w"} ${x(n,"btcd-sub-btn")}`,disabled:e,type:"submit"},N(n,"btcd-sub-btn")),{children:[t.subBtnTxt,e&&u.jsx(Sg,{clr:"currentColor",size:12,style:{display:"inline-block",marginLeft:5}})]})),"rstBtnTxt"in t&&u.jsx("button",A(b(b({className:`btcd-sub-btn btcd-rst ${t.btnSiz==="md"&&"btcd-btn-md"} ${t.fulW&&"ful-w"} ${x(n,"btcd-rst")}`,type:"button"},s&&{onClick:s}),N(n,"btcd-rst")),{children:t.rstBtnTxt}))]}))}))}function Ax({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){const[l,c]=F.useState(e.val),d=et(ca),h=F.useRef(null),p=F.useRef({resize:!1}),f=ti(Do);if(d.fieldKey===t){p.current.resize=!0;const g=Gt(`[data-key="${t}"]`),I=np(g);if(d.wrpHeight>=d.fldHeight){const w=`${d.fldHeight+(I-d.wrpHeight)}px`;h.current.style.height=w}}if(p.current.resize&&!d.fieldKey){p.current.resize=!1;const g=I=>`fields->${t}->classes->.${t}-fld->${I}`;f(I=>re(I,w=>{_r(w,g("height"),h.current.style.height)}))}F.useEffect(()=>{e.val!==void 0&&!e.userinput?c(e.val):!e.val&&!e.userinput?c(e.defaultValue||""):e.conditional&&c(e.val)},[e.val,e.defaultValue,e.userinput,e.conditional]),F.useEffect(()=>{i&&c("")},[i]),F.useEffect(()=>{if(e.hasWorkflow&&e.val===l&&s&&!e.userinput){const{current:g}=h;s(g)}},[l]);const m=g=>{c(g.target.value)};F.useEffect(()=>{const g=lh(`#${t}`);g&&ch(g,"value",(I,w)=>c(w))},[]);const E=g=>{Ec({input:g.target})};return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:n,fieldKey:t,fieldData:e,children:u.jsxs("div",A(b({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${x(t,"inp-fld-wrp")}`},N(t,"inp-fld-wrp")),{children:[u.jsx("textarea",A(b(b(b(b(b(b(b(b(A(b({"data-testid":t,"data-dev-fld":t,id:t,className:`${t}-fld ${x(t,"fld")}`},N(t,"fld")),{ref:h}),"disabled"in e&&{disabled:e.disabled}),"readonly"in e&&{readOnly:e.readonly}),"ph"in e&&{placeholder:e.ph}),"ac"in e&&{autoComplete:e.ac}),"req"in e.valid&&{required:e.valid.req}),"disabled"in e.valid&&{readOnly:e.valid.disabled}),"fieldName"in e&&{name:e.fieldName}),s&&{onInput:s}),{onBlur:E,value:l,onChange:m})),e.prefixIcn&&u.jsx("img",b({"data-dev-pre-i":t,className:`${t}-pre-i ${x(t,"pre-i")}`,height:"90%",src:e.prefixIcn,alt:""},N(t,"pre-i"))),e.suffixIcn&&u.jsx("img",b({"data-dev-suf-i":t,className:`${t}-suf-i ${x(t,"suf-i")}`,height:"90%",src:e.suffixIcn,alt:""},N(t,"suf-i")))]}))})]})}function Mx({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){var g,I,w;const l=e.typ==="url"?"text":e.typ,c=F.useRef(null),[d,h]=F.useState(e.val!==void 0?e.val:""),[p,f]=F.useState(!1);F.useEffect(()=>{e.val!==void 0&&!e.userinput?h(e.val):!e.val&&!e.userinput?h(e.defaultValue||""):e.conditional&&h(e.val)},[e.val,e.defaultValue,e.userinput,e.conditional]),F.useEffect(()=>{i&&h("")},[i]),F.useEffect(()=>{if(e.hasWorkflow&&e.val===d&&s&&!e.userinput){const{current:S}=c;s(S)}},[d]);const m=S=>{const _=e.typ==="email"?S.target.value.toLowerCase():S.target.value;h(_)};F.useEffect(()=>{const S=lh(`#${t}`);S&&ch(S,"value",(_,R)=>h(e.typ==="email"?R.toLowerCase():R))},[]);const E=S=>Ec({input:S.target});return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsxs(At,{formID:n,fieldKey:t,fieldData:e,children:[u.jsxs("div",A(b({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${x(t,"inp-fld-wrp")}`},N(t,"inp-fld-wrp")),{children:[u.jsx("input",b(A(b(b(b(b(b(b(b(b(b(b({"data-testid":t,"data-dev-fld":t,id:t,list:`${t}-datalist`,ref:c,className:`${t}-fld no-drg ${x(t,"fld")}`,type:p?"text":l},"req"in e.valid&&{required:e.valid.req}),"disabled"in e.valid&&{disabled:e.valid.disabled}),"readonly"in e.valid&&{readOnly:e.valid.readonly}),"ph"in e&&{placeholder:e.ph}),"mn"in e&&{min:e.mn}),"mx"in e&&{max:e.mx}),"ac"in e&&{autoComplete:e.ac}),"fieldName"in e&&{name:e.fieldName}),"inputMode"in e&&{inputMode:e.inputMode}),s&&{onInput:s}),{onBlur:E,value:d,onChange:m}),N(t,"fld"))),e.prefixIcn&&u.jsx("img",b({"data-testid":`${t}-pre-i`,"data-dev-pre-i":t,className:`${t}-pre-i ${x(t,"pre-i")}`,height:"90%",src:e.prefixIcn,alt:""},N(t,"pre-i"))),e.suffixIcn&&!((g=e.config)!=null&&g.showPasswordIcon)&&u.jsx("img",b({"data-testid":`${t}-suf-i`,"data-dev-suf-i":t,className:`${t}-suf-i ${x(t,"suf-i")}`,height:"90%",src:e.suffixIcn,alt:""},N(t,"suf-i"))),((I=e.config)==null?void 0:I.showPasswordIcon)&&u.jsxs("div",{"data-testid":`${t}-suf-i`,"data-dev-suf-i":t,className:`no-drg ${t}-suf-i ${x(t,"suf-i")}`,style:{display:"flex"},children:[u.jsx(Ng,{fieldKey:t,showPassword:p,setShowPassword:f}),e.suffixIcn&&u.jsx("img",b({src:e.suffixIcn,alt:""},N(t,"suf-i")))]})]})),((w=e.suggestions)==null?void 0:w.length)&&u.jsx("datalist",{id:`${t}-datalist`,children:e.suggestions.map(S=>u.jsx("option",{value:S.val||S.lbl,children:S.lbl},S.val||S.lbl))})]})]})}var pg=F.memo(Mx);function Nx({fieldKey:t,attr:e,styleClasses:s}){var R;const{logo:i,title:n,subtitle:a,titleHide:l,subtitleHide:c,titleTag:d,subTitleTag:h}=e,p=et(un),{styleMode:f}=et(_e),m=((R=e.valid.hidden)==null?void 0:R.includes(p))||!1,E=(L,M,D,G,C)=>u.jsx(We,{html:`<${L} data-dev-${D}=${t} className="${t}-${D} ${x(t,D)}">
46 ${G}<span class="${t}-${D}-txt">${M!=null?M:""}</span>${C}
47 </${L}>`}),g=L=>{const M=e.customAttributes[L];if(M==="")return;let D="";if(M){const G=M.length;let C=0;for(;C<G;)M[C].key&&M[C].value&&(D+=`${M[C].key}=${M[C].value} `),C+=1}return D},I=e.titlePreIcn?`<img data-dev-title-pre-i="${t}" ${g("title-pre-i")} classname="${t}-title-pre-i ${x(t,"title-pre-i")}" src="${e.titlePreIcn}" alt="Title Leading Icon" />`:"",w=e.titleSufIcn?`<img data-dev-title-suf-i="${t}" ${g("title-suf-i")} classname="${t}-title-suf-i ${x(t,"title-suf-i")}" src="${e.titleSufIcn}" alt="Title Trailing Icon" />`:"",S=e.subTitlPreIcn?`<img data-dev-sub-titl-pre-i="${t}" ${g("sub-titl-pre-i")} classname="${t}-sub-titl-pre-i ${x(t,"sub-titl-pre-i")}" src="${e.subTitlPreIcn}" alt="Subtitle Leading Icon" />`:"",_=e.subTitlSufIcn?`<img data-dev-sub-titl-suf-i="${t}" ${g("sub-titl-suf-i")} classname="${t}-sub-titl-suf-i ${x(t,"sub-titl-suf-i")}" src="${e.subTitlSufIcn}" alt="Subtitle Trailing Icon" />`:"";return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:s}),u.jsxs("div",A(b({"data-dev-fld-wrp":t},N(t,"fld-wrp")),{className:`${t}-fld-wrp ${f?"":"drag"} ${m?"fld-hide":""} ${x(t,"fld-wrp")}`,children:[i&&u.jsx("img",b({"data-dev-logo":t,className:`${t}-logo ${x(t,"logo")}`,src:i,alt:"","aria-hidden":"true"},N(t,"logo"))),u.jsxs("div",A(b({"data-dev-titl-wrp":t,className:`${t}-titl-wrp ${x(t,"titl-wrp")}`},N(t,"titl-wrp")),{children:[!l&&E(d,n,"title",I,w),!c&&E(h,a,"sub-titl",S,_)]}))]}))]})}var Px=""+new URL("bf-141-40.svg",import.meta.url).href;function Dx({fieldKey:t,styleClasses:e}){var d;const i=et(jt)[t],n=et(un),a=et(Rg),{styleMode:l}=et(_e),c=((d=i.hidden)==null?void 0:d.includes(n))||!1;return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:e}),u.jsx("div",{"data-dev-fld-wrp":t,className:`${t}-turnstile-container ${t}-fld-wrp ${l?"":"drag"} ${c?"fld-hide":""}`,children:u.jsx("div",{className:`${t}-turnstile-wrp`,children:a!=null&&a.siteKey&&(a!=null&&a.secretKey)?u.jsx("img",{height:"70",src:Px,alt:"cloudflare turnstile reCaptcha"}):u.jsxs("div",{children:["To Load Turnstile Field, Please Configure Site Key and Secret."," ",u.jsx("strong",{children:"Go to App Settings"})]})})})]})}function Fx({formID:t,fieldKey:e,fieldData:s,children:i,noLabel:n,noErrMsg:a,isBuilder:l}){var p;const c=et(_e),{styleMode:d}=c,h=((p=s.valid)==null?void 0:p.hide)||!1;return u.jsx("div",{className:`${e}-parent-fld-wrp
48 ${x(e,"parent-fld-wrp")} ${d?"":"drag"} ${h?"fld-hide":""}`,children:Cg.Children.toArray(i).map(f=>{var m;return u.jsx("div",{style:{flex:1},className:`${e}-child-fld-wrp ${(m=f==null?void 0:f.props)!=null&&m.fieldKey?`${f.props.fieldKey}-sub-fld-wrp`:""}`,children:f})})})}const fg=({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a})=>{const[l]=Os(jt),[c]=Os(Do),{childFields:d}=F.useMemo(()=>{var _,R;return{childFields:((R=(_=e==null?void 0:e.childFields)==null?void 0:_.map(L=>L.fldKey))!=null?R:[]).reduce((L,M)=>(Object.hasOwn(l,M)&&(L[M]=Ks(l[M])),L),{})}},[e==null?void 0:e.childFields,l]),h=F.useCallback(()=>u.jsx(pg,{fieldKey:t,styleClasses:a,formID:n,attr:e,onBlurHandler:s,resetFieldValue:i}),[e,t,n,s,i,a]),p=F.useCallback(()=>u.jsxs(u.Fragment,{children:[e.typ==="name"&&u.jsx(wt,{styleClasses:a}),u.jsxs(Fx,{fieldKey:t,fieldData:e,children:[["email","password"].includes(e.typ)&&h(),Object.entries(d).map(([w,S])=>{var _;return S.isDeactive?null:u.jsx(fg,{fieldKey:w,styleClasses:(_=c.fields[w])==null?void 0:_.classes,formID:n,attr:S,onBlurHandler:s,resetFieldValue:i},w)})]})]}),[h,e,d,t,n,s,i,c.fields,a]),{hasChildFields:f,isEmailOrPassword:m,isConfirmable:E,isNameField:g}=F.useMemo(()=>({hasChildFields:e.childFields&&Object.keys(e.childFields).length>0,isEmailOrPassword:e.typ==="email"||e.typ==="password",isConfirmable:!!e.confirm,isNameField:e.typ==="name"&&!!e.childFields}),[e]);return(g?!!f:m?!!f&&E:!!f)?p():h()},jx={address_1:"address-line1",address_2:"address-line2",city:"address-level2",state:"address-level1",zip:"postal-code",country:"country"},kx=({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a})=>{var p;const l=et(jt),{styleMode:c}=et(_e),d=((p=e.valid)==null?void 0:p.hide)||!1,h=F.useMemo(()=>{var m,E;return((E=(m=e==null?void 0:e.childFields)==null?void 0:m.map(g=>g.fldKey))!=null?E:[]).reduce((g,I)=>{if(Object.hasOwn(l,I)){const w=Ks(l[I]);w.isDeactive||g.push([I,w])}return g},[])},[e==null?void 0:e.childFields,l]);return u.jsxs(u.Fragment,{children:[u.jsx(wt,{styleClasses:a}),u.jsx(At,{formID:n,fieldKey:t,fieldData:e,children:u.jsx("div",{className:`${t}-parent-fld-wrp skip-height-calculate ${x(t,"parent-fld-wrp")} ${c?"":"drag"} ${d?"fld-hide":""}`,children:h.map(([f,m])=>{var S,_,R;const E=(_=(S=m.fieldName)==null?void 0:S.split("[").pop())==null?void 0:_.replace("]",""),g=jx[E],I=g?A(b({},m),{ac:g}):m,w=(R=m.colSpan)!=null?R:12;return u.jsx("div",{className:`${t}-child-fld-wrp ${f}-sub-fld-wrp`,style:{"--bfv-addr-col":w},children:u.jsx(mg,{atts:I,fieldKey:f,formID:n,onBlurHandler:s,resetFieldValue:i})},f)})})})]})};function Gx({atts:t,fieldKey:e,formID:s,onBlurHandler:i,resetFieldValue:n,handleReset:a,fieldData:l,buttonDisabled:c,contentID:d,isBuilder:h,entryID:p,handleFormValidationErrorMessages:f}){var E,g,I,w,S,_,R,L,M,D,G,C,k,q,W,V,X,j,K,B,H,tt,U,Z,J,it,at,vt,_t,ct,ut,Et,St,It,oe,ys,pn,Ls,Ui;const m=et(Do);if(!(Wa(m)||!(t!=null&&t.typ))){switch(t==null?void 0:t.typ){case"text":case"number":case"username":case"url":case"date":case"datetime-local":case"time":case"month":case"week":case"color":return u.jsx(pg,{fieldKey:e,styleClasses:(E=m.fields[e])==null?void 0:E.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"password":case"email":case"name":return u.jsx(fg,{fieldKey:e,styleClasses:(g=m.fields[e])==null?void 0:g.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"address":return u.jsx(kx,{fieldKey:e,styleClasses:(I=m.fields[e])==null?void 0:I.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"textarea":return u.jsx(Ax,{fieldKey:e,styleClasses:(w=m.fields[e])==null?void 0:w.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"check":return u.jsx(nT,{fieldKey:e,styleClasses:(S=m.fields[e])==null?void 0:S.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"radio":return u.jsx(hx,{fieldKey:e,styleClasses:(_=m.fields[e])==null?void 0:_.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"html-select":return u.jsx(WT,{fieldKey:e,styleClasses:(R=m.fields[e])==null?void 0:R.classes,isBuilder:h,formID:s,attr:t});case"select":return u.jsx(DT,{fieldKey:e,styleClasses:(L=m.fields[e])==null?void 0:L.classes,isBuilder:h,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"file-up":return u.jsx(kT,{fieldKey:e,styleClasses:(M=m.fields[e])==null?void 0:M.classes,formID:s,attr:t,entryID:p,resetFieldValue:n});case"advanced-file-up":return u.jsx(eT,{fieldKey:e,styleClasses:(D=m.fields[e])==null?void 0:D.classes,formID:s,attr:t,entryID:p,resetFieldValue:n});case"submit":return u.jsx(Lx,{fieldKey:e,styleClasses:(G=m.fields[e])==null?void 0:G.classes,formID:s,attr:t,buttonDisabled:c,handleReset:a});case"hidden":return u.jsx(VT,{fieldKey:e,styleClasses:(C=m.fields[e])==null?void 0:C.classes,formID:s,attr:t});case"recaptcha":return u.jsx(gx,{fieldKey:e,styleClasses:(k=m.fields[e])==null?void 0:k.classes,formID:s,attr:t});case"decision-box":return u.jsx(AT,{fieldKey:e,styleClasses:(q=m.fields[e])==null?void 0:q.classes,formID:s,attr:t,fieldData:l,onBlurHandler:i,resetFieldValue:n});case"gdpr":return u.jsx(GT,{fieldKey:e,styleClasses:(W=m.fields[e])==null?void 0:W.classes,formID:s,attr:t,fieldData:l,onBlurHandler:i,resetFieldValue:n});case"html":return u.jsx(zT,{fieldKey:e,styleClasses:(V=m.fields[e])==null?void 0:V.classes,formID:s,attr:t,fieldData:l,resetFieldValue:n});case"shortcode":return u.jsx(wx,{fieldKey:e,styleClasses:(X=m.fields[e])==null?void 0:X.classes,formID:s,attr:t,fieldData:l,resetFieldValue:n});case"button":return u.jsx(iT,{fieldKey:e,styleClasses:(j=m.fields[e])==null?void 0:j.classes,formID:s,attr:t,fieldData:l,buttonDisabled:c,handleReset:a});case"paypal":return u.jsx(ZT,{isBuilder:h,styleClasses:(K=m.fields[e])==null?void 0:K.classes,fieldKey:e,formID:s,attr:t,contentID:d,fieldData:l,resetFieldValue:n,handleFormValidationErrorMessages:f});case"stripe":return u.jsx(yx,{isBuilder:h,styleClasses:(B=m.fields[e])==null?void 0:B.classes,fieldKey:e,formID:s,attr:t,contentID:d,fieldData:l,resetFieldValue:n,handleFormValidationErrorMessages:f});case"mollie":return u.jsx(YT,{isBuilder:h,styleClasses:(H=m.fields[e])==null?void 0:H.classes,fieldKey:e,formID:s,attr:t,contentID:d,fieldData:l,resetFieldValue:n,handleFormValidationErrorMessages:f});case"razorpay":return u.jsx(mx,{fieldKey:e,styleClasses:(tt=m.fields[e])==null?void 0:tt.classes,contentID:d,formID:s,attr:t,buttonDisabled:c,resetFieldValue:n,handleFormValidationErrorMessages:f});case"title":return u.jsx(Nx,{fieldKey:e,styleClasses:(U=m.fields[e])==null?void 0:U.classes,formID:s,attr:t});case"image":return u.jsx(HT,{fieldKey:e,styleClasses:(Z=m.fields[e])==null?void 0:Z.classes,formID:s,attr:t});case"divider":return u.jsx(MT,{fieldKey:e,styleClasses:(J=m.fields[e])==null?void 0:J.classes,formID:s,attr:t});case"spacer":return u.jsx($x,{fieldKey:e,styleClasses:(it=m.fields[e])==null?void 0:it.classes,formID:s,attr:t});case"currency":return u.jsx(LT,{fieldKey:e,styleClasses:(at=m.fields[e])==null?void 0:at.classes,formID:s,attr:t,contentID:d});case"country":return u.jsx(OT,{fieldKey:e,styleClasses:(vt=m.fields[e])==null?void 0:vt.classes,formID:s,attr:t,contentID:d});case"phone-number":return u.jsx(KT,{fieldKey:e,styleClasses:(_t=m.fields[e])==null?void 0:_t.classes,formID:s,attr:t,contentID:d});case"section":return u.jsx(vx,{fieldKey:e,styleClasses:(ct=m.fields[e])==null?void 0:ct.classes,formID:s,attr:t});case"repeater":return u.jsx(bx,{fieldKey:e,styleClasses:(ut=m.fields[e])==null?void 0:ut.classes,formID:s,attr:t});case"rating":return u.jsx(px,{fieldKey:e,styleClasses:(Et=m.fields[e])==null?void 0:Et.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"signature":return u.jsx(Sx,{fieldKey:e,styleClasses:(St=m.fields[e])==null?void 0:St.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"image-select":return u.jsx(qT,{fieldKey:e,styleClasses:(It=m.fields[e])==null?void 0:It.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"turnstile":return u.jsx(Dx,{fieldKey:e,styleClasses:(oe=m.fields[e])==null?void 0:oe.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"hcaptcha":return u.jsx(BT,{fieldKey:e,styleClasses:(ys=m.fields[e])==null?void 0:ys.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"range":return u.jsx(Ox,{fieldKey:e,styleClasses:(pn=m.fields[e])==null?void 0:pn.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"advanced-datetime":return u.jsx(sT,{fieldKey:e,styleClasses:(Ls=m.fields[e])==null?void 0:Ls.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"email-otp":return u.jsx(FT,{fieldKey:e,styleClasses:(Ui=m.fields[e])==null?void 0:Ui.classes,formID:s,attr:t});case"blank":return u.jsx("div",{className:"blnk-blk drag"})}return u.jsx("div",{children:"Loading..."})}}var mg=F.memo(Gx);function Ul({layoutItem:t,removeLayoutItem:e,cloneLayoutItem:s,navigateToFieldSettings:i,navigateToStyle:n,handleContextMenu:a,showFieldPicker:l}){const c=et(jt),d=et(Og),h=et(ca),p=m=>{m.stopPropagation(),l(m,t)},f=ti(ah);return F.useEffect(()=>{f(m=>A(b({},m),{reCalculateFieldHeights:m.reCalculateFieldHeights+1}))},[]),u.jsxs(u.Fragment,{children:[h.fieldKey===t.i&&u.jsx("span",{className:"resize-txt",children:`w: ${h.w||t.w}, x: ${h.x||t.x}`}),u.jsxs("div",{className:"blk-icn-wrp pos-abs flx",children:[u.jsx("button",{type:"button",className:"drag g-c us-n blk-wrp-btn",style:{cursor:"move"},title:ve("Move"),"data-testid":`${t.i}-move-btn`,children:u.jsx(Ag,{size:"15",stroke:"3"})}),u.jsx("button",{type:"button",className:"g-c drag curp us-n no-drg blk-wrp-btn",title:ve("Settings"),onClick:i,"data-testid":`${t.i}-settings-btn`,children:u.jsx($g,{size:"18",stroke:2})}),u.jsx("button",{type:"button",className:"g-c drag curp us-n no-drg blk-wrp-btn",title:ve("Clone"),onClick:()=>s(t.i),"data-testid":`${t.i}-copy-btn`,children:u.jsx(yg,{size:"17",stroke:2})}),u.jsx(Mg,{className:"g-c drag us-n no-drg blk-wrp-btn",removeLayoutItem:e,fieldId:t.i}),u.jsx("button",{"data-close":!0,type:"button",className:"g-c us-n no-drg blk-wrp-btn blk-wrp-down-btn",draggable:"false",style:{cursor:"pointer"},title:ve("More Options"),onClick:m=>a(m,t.i),"data-testid":`${t.i}-more-options`,children:u.jsx(Lg,{size:"21",stroke:2.2})})]}),u.jsx(Bx,{fields:c,layoutItem:t,formID:d}),u.jsxs("button",{type:"button",className:"pos-abs us-n blk-wrp-add-btn",onClick:p,children:[u.jsx(oh,{size:15,stroke:3,classNames:"mr-1"}),ve("Add Field")]})]})}const Bx=({layoutItem:t,formID:e,fields:s})=>{const i=s[t.i];return u.jsx(mg,{formID:e,atts:i,fieldKey:t.i})};export{Ul as default};
49