PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.1.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.1.1
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 2.10.1 All 138 releases
bit-form / assets / bf-137-270.js

bf-137-270.js in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 3.1.1, at assets/bf-137-270.js

88 lines 421.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var ov=Object.defineProperty,lv=Object.defineProperties;var cv=Object.getOwnPropertyDescriptors;var pd=Object.getOwnPropertySymbols;var Df=Object.prototype.hasOwnProperty,Ff=Object.prototype.propertyIsEnumerable;var jf=Math.pow,Pf=(t,e,s)=>e in t?ov(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,I=(t,e)=>{for(var s in e||(e={}))Df.call(e,s)&&Pf(t,s,e[s]);if(pd)for(var s of pd(e))Ff.call(e,s)&&Pf(t,s,e[s]);return t},$=(t,e)=>lv(t,cv(e));var kf=(t,e)=>{var s={};for(var i in t)Df.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(t!=null&&pd)for(var i of pd(t))e.indexOf(i)<0&&Ff.call(t,i)&&(s[i]=t[i]);return s};var $p=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)};var r=(t,e,s)=>($p(t,e,"read from private field"),s?s.call(t):e.get(t)),E=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},S=(t,e,s,i)=>($p(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s);var l=(t,e,s)=>($p(t,e,"access private method"),s);var Vo=(t,e,s)=>new Promise((i,n)=>{var a=d=>{try{c(s.next(d))}catch(h){n(h)}},o=d=>{try{c(s.throw(d))}catch(h){n(h)}},c=d=>d.done?i(d.value):Promise.resolve(d.value).then(a,o);c((s=s.apply(t,e)).next())});import{g as fp,u as Z,eL as dv,b7 as ve,r as M,j as u,dA as T,dB as A,R as We,i as qs,aH as Lt,bd as Pt,eM as hv,eN as uv,H as Ei,ba as Ct,$ as od,eO as _t,a7 as or,_ as Pe,y as pv,c7 as ld,eP as gp,cP as Do,ap as bi,aX as cd,f as Kt,m as Ta,U as Ep,D as of,cR as fl,cV as bp,v as mv,aZ as Vg,cT as zg,b2 as Wg,dD as Hg,cc as qg,dW as Yg,a_ as Xg,cW as Zg,dV as Qg,d9 as Jg,aK as lf,q as Kg,dK as tE,as as Jd,at as dl,dN as eE,cv as $a,eQ as Rd,eR as sE,dT as Kd,cb as cf,cJ as th,bG as eh,ar as gl,I as iE,cd as nE,cS as rE,cm as fv,b9 as df,eS as hf,L as gv,x as Ev,bI as bv,E as Iv,am as vv,N as wv}from"./main-634.js";import{g as _v}from"./bf-25-81.js";import{R as aE,F as sh,M as Tv,a as xv}from"./bf-29-241.js";import{R as dt}from"./bf-842-272.js";import{a6 as ih,h as jp,d as oE,a7 as lE,a8 as cE}from"./bf-692-111.js";import"./bf-638-271.js";import"./bf-400-72.js";import"./bf-438-114.js";import"./bf-423-273.js";import"./bf-982-242.js";import"./bf-497-246.js";import"./bf-641-107.js";import"./bf-486-243.js";import"./bf-723-244.js";import"./bf-299-245.js";import"./bf-534-247.js";import"./bf-962-248.js";import"./bf-343-249.js";import"./bf-791-250.js";import"./bf-570-251.js";import"./bf-838-80.js";import"./bf-297-103.js";import"./bf-284-252.js";import"./bf-17-106.js";import"./bf-671-253.js";import"./bf-334-254.js";var gs,as,Aa,jt,Xe,Qi,ya,Il,vl,wl,Cr,Ji,_l,Ze,mh,dE,Tl,kp,fh,hE,gh,uE,Eh,pE,Ki,pr,bh,mE,Mn,ra,xl,Gp,Nn,aa,Sl,Bp;class Sv{constructor(e,s){E(this,mh);E(this,Tl);E(this,fh);E(this,gh);E(this,Eh);E(this,Ki);E(this,bh);E(this,Mn);E(this,xl);E(this,Nn);E(this,Sl);E(this,gs,null);E(this,as,null);E(this,Aa,null);E(this,jt,null);E(this,Xe,{});E(this,Qi,null);E(this,ya,null);E(this,Il,null);E(this,vl,null);E(this,wl,null);E(this,Cr,null);E(this,Ji,[]);E(this,_l,null);E(this,Ze,{document:{},formID:null,configSetting:{},ajaxURL:null,nonce:null,uploadFileToServer:null});var i,n,a,o,c;Object.assign(r(this,Ze),s),S(this,Qi,s.fieldKey),S(this,jt,s.window?s.window:window),S(this,Aa,s.document?s.document:document),S(this,_l,s.contentId),typeof e=="string"?S(this,gs,r(this,Aa).querySelector(e)):S(this,gs,e),S(this,ya,r(this,Ze).formID),S(this,Xe,r(this,Ze).configSetting),S(this,Il,r(this,Ze).ajaxURL),S(this,vl,((a=(n=(i=r(this,jt))==null?void 0:i.bf_globals)==null?void 0:n[r(this,_l)])==null?void 0:a.nonce)||((o=r(this,Ze))==null?void 0:o.nonce)),S(this,wl,r(this,Ze).uploadFileToServer),r(this,Xe).disabled=((c=r(this,Ze))==null?void 0:c.disabled)||!1,this.uploaded_files=[],this.on_select_upload=!1,this.init()}init(){this.files=[];const e=[];r(this,Xe).allowFileSizeValidation&&typeof r(this,jt).bit_filepond_plugin_file_validate_size=="function"&&e.push(r(this,jt).bit_filepond_plugin_file_validate_size),r(this,Xe).allowFileTypeValidation&&typeof r(this,jt).bit_filepond_plugin_file_validate_type=="function"&&e.push(r(this,jt).bit_filepond_plugin_file_validate_type),r(this,Xe).allowImageCrop&&typeof r(this,jt).bit_filepond_plugin_image_crop=="function"&&e.push(r(this,jt).bit_filepond_plugin_image_crop),r(this,Xe).allowImagePreview&&typeof r(this,jt).bit_filepond_plugin_image_preview=="function"&&e.push(r(this,jt).bit_filepond_plugin_image_preview),r(this,Xe).allowImageResize&&typeof r(this,jt).bit_filepond_plugin_image_resize=="function"&&e.push(r(this,jt).bit_filepond_plugin_image_resize),r(this,Xe).allowImageTransform&&typeof r(this,jt).bit_filepond_plugin_image_transform=="function"&&e.push(r(this,jt).bit_filepond_plugin_image_transform),r(this,Xe).allowImageValidateSize&&typeof r(this,jt).bit_filepond_plugin_image_validate_size=="function"&&e.push(r(this,jt).bit_filepond_plugin_image_validate_size),r(this,Xe).allowPreview&&typeof r(this,jt).bit_filepond_plugin_media_preview=="function"&&e.push(r(this,jt).bit_filepond_plugin_media_preview);const{create:s,registerPlugin:i}=r(this,jt).bit_filepond;if(i(...e),S(this,as,s(r(this,Xe))),r(this,gs).appendChild(r(this,as).element),setTimeout(()=>{if(r(this,gs)){const n=r(this,gs).parentNode.parentNode.querySelector(`.${r(this,Qi)}-lbl`),a=r(this,gs).parentNode.querySelector('input[name="filepond"]');n.setAttribute("for",a==null?void 0:a.id)}},1e3),r(this,Ze).onFileUpdate&&r(this,as).on("updatefiles",r(this,Ze).onFileUpdate),r(this,wl)){const n=new URL(r(this,Il));this.on_select_upload=r(this,Xe).instantUpload,n.searchParams.append("_ajax_nonce",r(this,vl));let a=null;r(this,as).setOptions({server:{process:(o,c,d,h,p,m,f)=>{const b=new FormData;n.searchParams.has("action")&&n.searchParams.delete("action"),n.searchParams.append("action","bitforms_file_upload"),b.append(r(this,Qi),c,c.name),b.append("fieldKey",r(this,Qi)),b.append("formID",r(this,ya));const g=new XMLHttpRequest;return g.open("POST",n.href),g.upload.onprogress=v=>{m(v.lengthComputable,v.loaded,v.total)},g.onload=()=>{var v,w;a=JSON.parse(g.responseText),g.status>=200&&g.status<300?(this.uploaded_files.push((v=a==null?void 0:a.data)==null?void 0:v.file_name),h((w=a==null?void 0:a.data)==null?void 0:w.file_name)):p()},g.send(b),{abort:()=>{g.abort(),f()}}},revert:(o,c,d)=>{if(this.uploaded_files.find(p=>p===o)){const p=this.uploaded_files.indexOf(o);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",o),n.searchParams.append("formID",r(this,ya));const m=new XMLHttpRequest;return m.open("DELETE",n.href),m.onload=()=>{m.status>=200&&m.status<300?c():d()},m.send(),{abort:()=>{m.abort()}}}}},labelFileProcessingError:()=>a==null?void 0:a.data}),r(this,as).on("updatefiles",()=>{this.files=[],this.files=r(this,as).getFiles()})}r(this,Ze).oldFiles&&l(this,Tl,kp).call(this,r(this,Ze).oldFiles)}checkValidate(){var e;return r(this,Ji).length===0&&((e=this.files)==null?void 0:e.length)===0?"req":""}set value(e){l(this,Tl,kp).call(this,e)}get value(){return r(this,as).getFiles()}set disabled(e){r(this,as).setOptions({disabled:e})}get disabled(){var e,s;return((s=(e=r(this,as))==null?void 0:e.options)==null?void 0:s.disabled)||!1}reset(){r(this,as).destroy(r(this,as).element),r(this,gs).innerHTML="",this.init()}}gs=new WeakMap,as=new WeakMap,Aa=new WeakMap,jt=new WeakMap,Xe=new WeakMap,Qi=new WeakMap,ya=new WeakMap,Il=new WeakMap,vl=new WeakMap,wl=new WeakMap,Cr=new WeakMap,Ji=new WeakMap,_l=new WeakMap,Ze=new WeakMap,mh=new WeakSet,dE=function(e){if(typeof e=="string")try{return JSON.parse(e)}catch(s){}return Array.isArray(e)?e:[]},Tl=new WeakSet,kp=function(e){const s=l(this,mh,dE).call(this,e);S(this,Ji,s),S(this,Cr,l(this,Ki,pr).call(this,"div")),l(this,Mn,ra).call(this,r(this,Cr),"old-file-list"),s.forEach(n=>{l(this,fh,hE).call(this,n)});const i=l(this,Ki,pr).call(this,"input");i.type="hidden",i.name=`${r(this,Qi)}_old`,i.value=r(this,Ji).toString(),r(this,gs).appendChild(r(this,Cr)),r(this,gs).appendChild(i)},fh=new WeakSet,hE=function(e){const s=l(this,Ki,pr).call(this,"div"),i=e.replace(/( |\.|\(|\))/g,"");s.id=`file-wrp-${i}`,l(this,Mn,ra).call(this,s,"file-wrpr");const n=l(this,Ki,pr).call(this,"div");l(this,Mn,ra).call(this,n,"file-details");const a=l(this,Ki,pr).call(this,"a");l(this,Mn,ra).call(this,a,"file-title"),l(this,Nn,aa).call(this,a,"target","_blank"),l(this,Nn,aa).call(this,a,"href",`${r(this,Ze).baseDLURL}&fileID=${e}`),l(this,xl,Gp).call(this,a,e),n.append(a),s.append(n);const o=l(this,Ki,pr).call(this,"button");l(this,Mn,ra).call(this,o,"cross-btn"),l(this,Nn,aa).call(this,o,"data-file-id",i),l(this,Nn,aa).call(this,o,"data-file-name",e),l(this,Nn,aa).call(this,o,"type","button"),l(this,xl,Gp).call(this,o,"×"),l(this,bh,mE).call(this,o,"click",c=>l(this,gh,uE).call(this,c)),s.append(o),r(this,Cr).appendChild(s)},gh=new WeakSet,uE=function(e){const s=e.target.getAttribute("data-file-id"),i=e.target.getAttribute("data-file-name");l(this,Eh,pE).call(this,`#file-wrp-${s}`),S(this,Ji,r(this,Ji).filter(n=>n!==i)),l(this,Sl,Bp).call(this,`input[name="${r(this,Qi)}_old"]`).value=r(this,Ji).toString()},Eh=new WeakSet,pE=function(e){var s;(s=l(this,Sl,Bp).call(this,e))==null||s.remove()},Ki=new WeakSet,pr=function(e){return r(this,Aa).createElement(e)},bh=new WeakSet,mE=function(e,s,i){e.addEventListener(s,i)},Mn=new WeakSet,ra=function(e,s){e.classList.add(s)},xl=new WeakSet,Gp=function(e,s){e.textContent=s},Nn=new WeakSet,aa=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},Sl=new WeakSet,Bp=function(e){return r(this,gs).querySelector(e)||void 0};/*!
2 * FilePondPluginFileValidateSize 2.2.8
3 * Licensed under MIT, https://opensource.org/licenses/MIT/
4 * Please visit https://pqina.nl/filepond/ for details.
5 */const fE=({addFilter:t,utils:e})=>{const{Type:s,replaceInString:i,toNaturalFileSize:n}=e;return t("ALLOW_HOPPER_ITEM",(a,{query:o})=>{if(!o("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;const c=o("GET_MAX_FILE_SIZE");if(c!==null&&a.size>c)return!1;const d=o("GET_MIN_FILE_SIZE");return!(d!==null&&a.size<d)}),t("LOAD_FILE",(a,{query:o})=>new Promise((c,d)=>{if(!o("GET_ALLOW_FILE_SIZE_VALIDATION"))return c(a);const h=o("GET_FILE_VALIDATE_SIZE_FILTER");if(h&&!h(a))return c(a);const p=o("GET_MAX_FILE_SIZE");if(p!==null&&a.size>p){d({status:{main:o("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:i(o("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(p,".",o("GET_FILE_SIZE_BASE"),o("GET_FILE_SIZE_LABELS",o))})}});return}const m=o("GET_MIN_FILE_SIZE");if(m!==null&&a.size<m){d({status:{main:o("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:i(o("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(m,".",o("GET_FILE_SIZE_BASE"),o("GET_FILE_SIZE_LABELS",o))})}});return}const f=o("GET_MAX_TOTAL_FILE_SIZE");if(f!==null&&o("GET_ACTIVE_ITEMS").reduce((g,v)=>g+v.fileSize,0)>f){d({status:{main:o("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:i(o("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(f,".",o("GET_FILE_SIZE_BASE"),o("GET_FILE_SIZE_LABELS",o))})}});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]}}},Rv=typeof window!="undefined"&&typeof window.document!="undefined";Rv&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:fE}));/*!
6 * FilePondPluginFileValidateType 1.2.9
7 * Licensed under MIT, https://opensource.org/licenses/MIT/
8 * Please visit https://pqina.nl/filepond/ for details.
9 */const gE=({addFilter:t,utils:e})=>{const{Type:s,isString:i,replaceInString:n,guesstimateMimeType:a,getExtensionFromFilename:o,getFilenameFromURL:c}=e,d=(b,g)=>{const v=(/^[^/]+/.exec(b)||[]).pop(),w=g.slice(0,-2);return v===w},h=(b,g)=>b.some(v=>/\*$/.test(v)?d(g,v):v===g),p=b=>{let g="";if(i(b)){const v=c(b),w=o(v);w&&(g=a(w))}else g=b.type;return g},m=(b,g,v)=>{if(g.length===0)return!0;const w=p(b);return v?new Promise((x,_)=>{v(b,w).then(R=>{h(g,R)?x():_()}).catch(_)}):h(g,w)},f=b=>g=>b[g]===null?!1:b[g]||g;return t("SET_ATTRIBUTE_TO_OPTION_MAP",b=>Object.assign(b,{accept:"acceptedFileTypes"})),t("ALLOW_HOPPER_ITEM",(b,{query:g})=>g("GET_ALLOW_FILE_TYPE_VALIDATION")?m(b,g("GET_ACCEPTED_FILE_TYPES")):!0),t("LOAD_FILE",(b,{query:g})=>new Promise((v,w)=>{if(!g("GET_ALLOW_FILE_TYPE_VALIDATION")){v(b);return}const x=g("GET_ACCEPTED_FILE_TYPES"),_=g("GET_FILE_VALIDATE_TYPE_DETECT_TYPE"),R=m(b,x,_),C=()=>{const O=x.map(f(g("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES_MAP"))).filter(D=>D!==!1),y=O.filter((D,L)=>O.indexOf(D)===L);w({status:{main:g("GET_LABEL_FILE_TYPE_NOT_ALLOWED"),sub:n(g("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES"),{allTypes:y.join(", "),allButLastType:y.slice(0,-1).join(", "),lastType:y[y.length-1]})}})};if(typeof R=="boolean")return R?v(b):C();R.then(()=>{v(b)}).catch(C)})),{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]}}},Cv=typeof window!="undefined"&&typeof window.document!="undefined";Cv&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:gE}));/*!
10 * FilePondPluginImageCrop 2.0.6
11 * Licensed under MIT, https://opensource.org/licenses/MIT/
12 * Please visit https://pqina.nl/filepond/ for details.
13 */const Gf=t=>/^image/.test(t.type),EE=({addFilter:t,utils:e})=>{const{Type:s,isFile:i,getNumericAspectRatioFromString:n}=e,a=(h,p)=>!(!Gf(h.file)||!p("GET_ALLOW_IMAGE_CROP")),o=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",m=>{if(!(!a(h,p)||!o(center)))return h.setMetadata("crop",m),m}),h.extend("setImageCropCenter",m=>{if(!(!a(h,p)||!o(m)))return d(h,{center:m})}),h.extend("setImageCropZoom",m=>{if(!(!a(h,p)||!c(m)))return d(h,{zoom:Math.max(1,m)})}),h.extend("setImageCropRotation",m=>{if(!(!a(h,p)||!c(m)))return d(h,{rotation:m})}),h.extend("setImageCropFlip",m=>{if(!(!a(h,p)||!o(m)))return d(h,{flip:m})}),h.extend("setImageCropAspectRatio",m=>{if(!a(h,p)||typeof m=="undefined")return;const f=h.getMetadata("crop"),b=n(m),g={center:{x:.5,y:.5},flip:f?Object.assign({},f.flip):{horizontal:!1,vertical:!1},rotation:0,zoom:1,aspectRatio:b};return h.setMetadata("crop",g),g})}),t("DID_LOAD_ITEM",(h,{query:p})=>new Promise((m,f)=>{const b=h.file;if(!i(b)||!Gf(b)||!p("GET_ALLOW_IMAGE_CROP")||h.getMetadata("crop"))return m(h);const v=p("GET_IMAGE_CROP_ASPECT_RATIO");h.setMetadata("crop",{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},rotation:0,zoom:1,aspectRatio:v?n(v):null}),m(h)})),{options:{allowImageCrop:[!0,s.BOOLEAN],imageCropAspectRatio:[null,s.STRING]}}},Ov=typeof window!="undefined"&&typeof window.document!="undefined";Ov&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:EE}));/*!
14 * FilePondPluginImagePreview 4.6.12
15 * Licensed under MIT, https://opensource.org/licenses/MIT/
16 * Please visit https://pqina.nl/filepond/ for details.
17 */const $v=t=>/^image/.test(t.type),Bf=(t,e)=>El(t.x*e,t.y*e),Uf=(t,e)=>El(t.x+e.x,t.y+e.y),Lv=t=>{const e=Math.sqrt(t.x*t.x+t.y*t.y);return e===0?{x:0,y:0}:El(t.x/e,t.y/e)},md=(t,e,s)=>{const i=Math.cos(e),n=Math.sin(e),a=El(t.x-s.x,t.y-s.y);return El(s.x+i*a.x-n*a.y,s.y+n*a.x+i*a.y)},El=(t=0,e=0)=>({x:t,y:e}),ds=(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))},Av=(t,e,s)=>{const i=t.borderStyle||t.lineStyle||"solid",n=t.backgroundColor||t.fontColor||"transparent",a=t.borderColor||t.lineColor||"transparent",o=ds(t.borderWidth||t.lineWidth,e,s),c=t.lineCap||"round",d=t.lineJoin||"round",h=typeof i=="string"?"":i.map(m=>ds(m,e,s)).join(","),p=t.opacity||1;return{"stroke-linecap":c,"stroke-linejoin":d,"stroke-width":o||0,"stroke-dasharray":h,stroke:a,fill:n,opacity:p}},Rs=t=>t!=null,yv=(t,e,s=1)=>{let i=ds(t.x,e,s,"width")||ds(t.left,e,s,"width"),n=ds(t.y,e,s,"height")||ds(t.top,e,s,"height"),a=ds(t.width,e,s,"width"),o=ds(t.height,e,s,"height"),c=ds(t.right,e,s,"width"),d=ds(t.bottom,e,s,"height");return Rs(n)||(Rs(o)&&Rs(d)?n=e.height-o-d:n=d),Rs(i)||(Rs(a)&&Rs(c)?i=e.width-a-c:i=c),Rs(a)||(Rs(i)&&Rs(c)?a=e.width-i-c:a=0),Rs(o)||(Rs(n)&&Rs(d)?o=e.height-n-d:o=0),{x:i||0,y:n||0,width:a||0,height:o||0}},Mv=t=>t.map((e,s)=>`${s===0?"M":"L"} ${e.x} ${e.y}`).join(" "),Ui=(t,e)=>Object.keys(e).forEach(s=>t.setAttribute(s,e[s])),Nv="http://www.w3.org/2000/svg",xa=(t,e)=>{const s=document.createElementNS(Nv,t);return e&&Ui(s,e),s},Pv=t=>Ui(t,I(I({},t.rect),t.styles)),Dv=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 Ui(t,I({cx:e,cy:s,rx:i,ry:n},t.styles))},Fv={contain:"xMidYMid meet",cover:"xMidYMid slice"},jv=(t,e)=>{Ui(t,$(I(I({},t.rect),t.styles),{preserveAspectRatio:Fv[e.fit]||"none"}))},kv={left:"start",center:"middle",right:"end"},Gv=(t,e,s,i)=>{const n=ds(e.fontSize,s,i),a=e.fontFamily||"sans-serif",o=e.fontWeight||"normal",c=kv[e.textAlign]||"start";Ui(t,$(I(I({},t.rect),t.styles),{"stroke-width":0,"font-weight":o,"font-size":n,"font-family":a,"text-anchor":c})),t.text!==e.text&&(t.text=e.text,t.textContent=e.text.length?e.text:" ")},Bv=(t,e,s,i)=>{Ui(t,$(I(I({},t.rect),t.styles),{fill:"none"}));const n=t.childNodes[0],a=t.childNodes[1],o=t.childNodes[2],c=t.rect,d={x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height};if(Ui(n,{x1:c.x,y1:c.y,x2:d.x,y2:d.y}),!e.lineDecoration)return;a.style.display="none",o.style.display="none";const h=Lv({x:d.x-c.x,y:d.y-c.y}),p=ds(.05,s,i);if(e.lineDecoration.indexOf("arrow-begin")!==-1){const m=Bf(h,p),f=Uf(c,m),b=md(c,2,f),g=md(c,-2,f);Ui(a,{style:"display:block;",d:`M${b.x},${b.y} L${c.x},${c.y} L${g.x},${g.y}`})}if(e.lineDecoration.indexOf("arrow-end")!==-1){const m=Bf(h,-p),f=Uf(d,m),b=md(d,2,f),g=md(d,-2,f);Ui(o,{style:"display:block;",d:`M${b.x},${b.y} L${d.x},${d.y} L${g.x},${g.y}`})}},Uv=(t,e,s,i)=>{Ui(t,$(I({},t.styles),{fill:"none",d:Mv(e.points.map(n=>({x:ds(n.x,s,i,"width"),y:ds(n.y,s,i,"height")})))}))},fd=t=>e=>xa(t,{id:e.id}),Vv=t=>{const e=xa("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},zv=t=>{const e=xa("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),s=xa("line");e.appendChild(s);const i=xa("path");e.appendChild(i);const n=xa("path");return e.appendChild(n),e},Wv={image:Vv,rect:fd("rect"),ellipse:fd("ellipse"),text:fd("text"),path:fd("path"),line:zv},Hv={rect:Pv,ellipse:Dv,image:jv,text:Gv,path:Uv,line:Bv},qv=(t,e)=>Wv[t](e),Yv=(t,e,s,i,n)=>{e!=="path"&&(t.rect=yv(s,i,n)),t.styles=Av(s,i,n),Hv[e](t,s,i,n)},Xv=["x","y","left","top","right","bottom","width","height"],Zv=t=>typeof t=="string"&&/%/.test(t)?parseFloat(t)/100:t,Qv=t=>{const[e,s]=t,i=s.points?{}:Xv.reduce((n,a)=>(n[a]=Zv(s[a]),n),{});return[e,I(I({zIndex:0},s),i)]},Jv=(t,e)=>t[1].zIndex>e[1].zIndex?1:t[1].zIndex<e[1].zIndex?-1:0,Kv=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,o=s.width,c=s.height;let d=i.width,h=i.height;if(n){const{size:b}=n;let g=b&&b.width,v=b&&b.height;const w=n.mode,x=n.upscale;g&&!v&&(v=g),v&&!g&&(g=v);const _=d<g&&h<v;if(!_||_&&x){let R=g/d,C=v/h;if(w==="force")d=g,h=v;else{let O;w==="cover"?O=Math.max(R,C):w==="contain"&&(O=Math.min(R,C)),d=d*O,h=h*O}}}const p={width:o,height:c};e.element.setAttribute("width",p.width),e.element.setAttribute("height",p.height);const m=Math.min(o/d,c/h);e.element.innerHTML="";const f=e.query("GET_IMAGE_PREVIEW_MARKUP_FILTER");a.filter(f).map(Qv).sort(Jv).forEach(b=>{const[g,v]=b,w=qv(g,v);Yv(w,g,v,p,m),e.element.appendChild(w)})}}),hl=(t,e)=>({x:t,y:e}),tw=(t,e)=>t.x*e.x+t.y*e.y,Vf=(t,e)=>hl(t.x-e.x,t.y-e.y),ew=(t,e)=>tw(Vf(t,e),Vf(t,e)),zf=(t,e)=>Math.sqrt(ew(t,e)),Wf=(t,e)=>{const s=t,i=1.5707963267948966,n=e,a=1.5707963267948966-e,o=Math.sin(i),c=Math.sin(n),d=Math.sin(a),h=Math.cos(a),p=s/o,m=p*c,f=p*d;return hl(h*m,h*f)},sw=(t,e)=>{const s=t.width,i=t.height,n=Wf(s,e),a=Wf(i,e),o=hl(t.x+Math.abs(n.x),t.y-Math.abs(n.y)),c=hl(t.x+t.width+Math.abs(a.y),t.y+Math.abs(a.x)),d=hl(t.x-Math.abs(a.y),t.y+t.height-Math.abs(a.x));return{width:zf(o,c),height:zf(o,d)}},iw=(t,e,s=1)=>{const i=t.height/t.width;let n=1,a=e,o=1,c=i;c>a&&(c=a,o=c/i);const d=Math.max(n/o,a/c),h=t.width/(s*d*o),p=h*e;return{width:h,height:p}},bE=(t,e,s,i)=>{const n=i.x>.5?1-i.x:i.x,a=i.y>.5?1-i.y:i.y,o=n*2*t.width,c=a*2*t.height,d=sw(e,s);return Math.max(d.width/o,d.height/c)},IE=(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}},nw=(t,e={})=>{let{zoom:s,rotation:i,center:n,aspectRatio:a}=e;a||(a=t.height/t.width);const o=iw(t,a,s),c={x:o.width*.5,y:o.height*.5},d={x:0,y:0,width:o.width,height:o.height,center:c},h=typeof e.scaleToFit=="undefined"||e.scaleToFit,p=bE(t,IE(d,a),i,h?n:{x:.5,y:.5}),m=s*p;return{widthFloat:o.width/m,heightFloat:o.height/m,width:Math.round(o.width/m),height:Math.round(o.height/m)}},Ti={type:"spring",stiffness:.5,damping:.45,mass:10},rw=t=>t.utils.createView({name:"image-bitmap",ignoreRect:!0,mixins:{styles:["scaleX","scaleY"]},create:({root:e,props:s})=>{e.appendChild(s.image)}}),aw=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:Ti,originY:Ti,scaleX:Ti,scaleY:Ti,translateX:Ti,translateY:Ti,rotateZ:Ti}},create:({root:e,props:s})=>{s.width=s.image.width,s.height=s.image.height,e.ref.bitmap=e.appendChildView(e.createChildView(rw(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}}),ow=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(aw(t),Object.assign({},s))),e.ref.createMarkup=()=>{e.ref.markup||(e.ref.markup=e.appendChildView(e.createChildView(Kv(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:o,dirty:c,width:d,height:h}=s;e.ref.image.crop=n;const p={x:0,y:0,width:d,height:h,center:{x:d*.5,y:h*.5}},m={width:e.ref.image.width,height:e.ref.image.height},f={x:n.center.x*m.width,y:n.center.y*m.height},b={x:p.center.x-m.width*n.center.x,y:p.center.y-m.height*n.center.y},g=Math.PI*2+n.rotation%(Math.PI*2),v=n.aspectRatio||m.height/m.width,w=typeof n.scaleToFit=="undefined"||n.scaleToFit,x=bE(m,IE(p,v),g,w?n.center:{x:.5,y:.5}),_=n.zoom*x;a&&a.length?(e.ref.createMarkup(),e.ref.markup.width=d,e.ref.markup.height=h,e.ref.markup.resize=o,e.ref.markup.dirty=c,e.ref.markup.markup=a,e.ref.markup.crop=nw(m,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=f.x,R.originY=f.y,R.translateX=b.x,R.translateY=b.y,R.rotateZ=g,R.scaleX=_,R.scaleY=_}}),lw=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:Ti,scaleY:Ti,translateY:Ti,opacity:{type:"tween",duration:400}}},create:({root:e,props:s})=>{e.ref.clip=e.appendChildView(e.createChildView(ow(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:o,markup:c,resize:d,dirty:h}=s;if(n.crop=o,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 m=o.aspectRatio||p;const f=e.rect.inner.width,b=e.rect.inner.height;let g=e.query("GET_IMAGE_PREVIEW_HEIGHT");const v=e.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),w=e.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),x=e.query("GET_PANEL_ASPECT_RATIO"),_=e.query("GET_ALLOW_MULTIPLE");x&&!_&&(g=f*x,m=x);let R=g!==null?g:Math.max(v,Math.min(f*m,w)),C=R/m;C>f&&(C=f,R=C*m),R>b&&(R=b,C=b/m),n.width=C,n.height=R}});let cw=`<svg width="500" height="200" viewBox="0 0 500 200" preserveAspectRatio="none">
18 <defs>
19 <radialGradient id="gradient-__UID__" cx=".5" cy="1.25" r="1.15">
20 <stop offset='50%' stop-color='#000000'/>
21 <stop offset='56%' stop-color='#0a0a0a'/>
22 <stop offset='63%' stop-color='#262626'/>
23 <stop offset='69%' stop-color='#4f4f4f'/>
24 <stop offset='75%' stop-color='#808080'/>
25 <stop offset='81%' stop-color='#b1b1b1'/>
26 <stop offset='88%' stop-color='#dadada'/>
27 <stop offset='94%' stop-color='#f6f6f6'/>
28 <stop offset='100%' stop-color='#ffffff'/>
29 </radialGradient>
30 <mask id="mask-__UID__">
31 <rect x="0" y="0" width="500" height="200" fill="url(#gradient-__UID__)"></rect>
32 </mask>
33 </defs>
34 <rect x="0" width="500" height="200" fill="currentColor" mask="url(#mask-__UID__)"></rect>
35 </svg>`,Hf=0;const dw=t=>t.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:({root:e,props:s})=>{let i=cw;if(document.querySelector("base")){const n=new URL(window.location.href.replace(window.location.hash,"")).href;i=i.replace(/url\(\#/g,"url("+n+"#")}Hf++,e.element.classList.add(`filepond--image-preview-overlay-${s.status}`),e.element.innerHTML=i.replace(/__UID__/g,Hf)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),hw=function(){self.onmessage=t=>{createImageBitmap(t.data.message.file).then(e=>{self.postMessage({id:t.data.id,message:e},[e])})}},uw=function(){self.onmessage=t=>{const e=t.data.message.imageData,s=t.data.message.colorMatrix,i=e.data,n=i.length,a=s[0],o=s[1],c=s[2],d=s[3],h=s[4],p=s[5],m=s[6],f=s[7],b=s[8],g=s[9],v=s[10],w=s[11],x=s[12],_=s[13],R=s[14],C=s[15],O=s[16],y=s[17],D=s[18],L=s[19];let F=0,H=0,B=0,k=0,X=0;for(;F<n;F+=4)H=i[F]/255,B=i[F+1]/255,k=i[F+2]/255,X=i[F+3]/255,i[F]=Math.max(0,Math.min((H*a+B*o+k*c+X*d+h)*255,255)),i[F+1]=Math.max(0,Math.min((H*p+B*m+k*f+X*b+g)*255,255)),i[F+2]=Math.max(0,Math.min((H*v+B*w+k*x+X*_+R)*255,255)),i[F+3]=Math.max(0,Math.min((H*C+B*O+k*y+X*D+L)*255,255));self.postMessage({id:t.data.id,message:e},[e.data.buffer])}},pw=(t,e)=>{let s=new Image;s.onload=()=>{const i=s.naturalWidth,n=s.naturalHeight;s=null,e(i,n)},s.src=t},mw={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]},fw=(t,e,s,i)=>{i!==-1&&t.transform.apply(t,mw[i](e,s))},gw=(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]),fw(a,e,s,i),a.drawImage(t,0,0,e,s),n},vE=t=>/^image/.test(t.type)&&!/svg/.test(t.type),Ew=10,bw=10,Iw=t=>{const e=Math.min(Ew/t.width,bw/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 o=null;try{o=i.getImageData(0,0,n,a).data}catch(f){return null}const c=o.length;let d=0,h=0,p=0,m=0;for(;m<c;m+=4)d+=o[m]*o[m],h+=o[m+1]*o[m+1],p+=o[m+2]*o[m+2];return d=Lp(d,c),h=Lp(h,c),p=Lp(p,c),{r:d,g:h,b:p}},Lp=(t,e)=>Math.floor(Math.sqrt(t/(e/4))),vw=(t,e)=>(e=e||document.createElement("canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e),ww=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},_w=t=>new Promise((e,s)=>{const i=new Image;i.crossOrigin="Anonymous",i.onload=()=>{e(i)},i.onerror=n=>{s(n)},i.src=t}),Tw=t=>{const e=dw(t),s=lw(t),{createWorker:i}=t.utils,n=(_,R,C)=>new Promise(O=>{_.ref.imageData||(_.ref.imageData=C.getContext("2d").getImageData(0,0,C.width,C.height));const y=ww(_.ref.imageData);if(!R||R.length!==20)return C.getContext("2d").putImageData(y,0,0),O();const D=i(uw);D.post({imageData:y,colorMatrix:R},L=>{C.getContext("2d").putImageData(L,0,0),D.terminate(),O()},[y.data.buffer])}),a=(_,R)=>{_.removeChildView(R),R.image.width=1,R.image.height=1,R._destroy()},o=({root:_})=>{const R=_.ref.images.shift();return R.opacity=0,R.translateY=-15,_.ref.imageViewBin.push(R),R},c=({root:_,props:R,image:C})=>{const O=R.id,y=_.query("GET_ITEM",{id:O});if(!y)return;const D=y.getMetadata("crop")||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},L=_.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR");let F,H,B=!1;_.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(F=y.getMetadata("markup")||[],H=y.getMetadata("resize"),B=!0);const k=_.appendChildView(_.createChildView(s,{id:O,image:C,crop:D,resize:H,markup:F,dirty:B,background:L,opacity:0,scaleX:1.15,scaleY:1.15,translateY:15}),_.childViews.length);_.ref.images.push(k),k.opacity=1,k.scaleX=1,k.scaleY=1,k.translateY=0,setTimeout(()=>{_.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:O})},250)},d=({root:_,props:R})=>{const C=_.query("GET_ITEM",{id:R.id});if(!C)return;const O=_.ref.images[_.ref.images.length-1];O.crop=C.getMetadata("crop"),O.background=_.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),_.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(O.dirty=!0,O.resize=C.getMetadata("resize"),O.markup=C.getMetadata("markup"))},h=({root:_,props:R,action:C})=>{if(!/crop|filter|markup|resize/.test(C.change.key)||!_.ref.images.length)return;const O=_.query("GET_ITEM",{id:R.id});if(O){if(/filter/.test(C.change.key)){const y=_.ref.images[_.ref.images.length-1];n(_,C.change.value,y.image);return}if(/crop|markup|resize/.test(C.change.key)){const y=O.getMetadata("crop"),D=_.ref.images[_.ref.images.length-1];if(y&&y.aspectRatio&&D.crop&&D.crop.aspectRatio&&Math.abs(y.aspectRatio-D.crop.aspectRatio)>1e-5){const L=o({root:_});c({root:_,props:R,image:vw(L.image)})}else d({root:_,props:R})}}},p=_=>{const C=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),O=C?parseInt(C[1]):null;return O!==null&&O<=58?!1:"createImageBitmap"in window&&vE(_)},m=({root:_,props:R})=>{const{id:C}=R,O=_.query("GET_ITEM",C);if(!O)return;const y=URL.createObjectURL(O.file);pw(y,(D,L)=>{_.dispatch("DID_IMAGE_PREVIEW_CALCULATE_SIZE",{id:C,width:D,height:L})})},f=({root:_,props:R})=>{const{id:C}=R,O=_.query("GET_ITEM",C);if(!O)return;const y=URL.createObjectURL(O.file),D=()=>{_w(y).then(L)},L=F=>{URL.revokeObjectURL(y);const B=(O.getMetadata("exif")||{}).orientation||-1;let{width:k,height:X}=F;if(!k||!X)return;B>=5&&B<=8&&([k,X]=[X,k]);const P=Math.max(1,window.devicePixelRatio*.75),j=_.query("GET_IMAGE_PREVIEW_ZOOM_FACTOR")*P,N=X/k,G=_.rect.element.width,U=_.rect.element.height;let q=G,V=q*N;N>1?(q=Math.min(k,G*j),V=q*N):(V=Math.min(X,U*j),q=V/N);const lt=gw(F,q,V,B),ot=()=>{const ft=_.query("GET_IMAGE_PREVIEW_CALCULATE_AVERAGE_IMAGE_COLOR")?Iw(data):null;O.setMetadata("color",ft,!0),"close"in F&&F.close(),_.ref.overlayShadow.opacity=1,c({root:_,props:R,image:lt})},ct=O.getMetadata("filter");ct?n(_,ct,lt).then(ot):ot()};if(p(O.file)){const F=i(hw);F.post({file:O.file},H=>{if(F.terminate(),!H){D();return}L(H)})}else D()},b=({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},v=({root:_})=>{_.ref.overlayShadow.opacity=.25,_.ref.overlayError.opacity=1},w=({root:_})=>{_.ref.overlayShadow.opacity=.25,_.ref.overlaySuccess.opacity=1},x=({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:x,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:b,DID_IMAGE_PREVIEW_CONTAINER_CREATE:m,DID_FINISH_CALCULATE_PREVIEWSIZE:f,DID_UPDATE_ITEM_METADATA:h,DID_THROW_ITEM_LOAD_ERROR:v,DID_THROW_ITEM_PROCESSING_ERROR:v,DID_THROW_ITEM_INVALID:v,DID_COMPLETE_ITEM_PROCESSING:w,DID_START_ITEM_PROCESSING:g,DID_REVERT_ITEM_PROCESSING:g},({root:_})=>{const R=_.ref.imageViewBin.filter(C=>C.opacity===0);_.ref.imageViewBin=_.ref.imageViewBin.filter(C=>C.opacity>0),R.forEach(C=>a(_,C)),R.length=0})})},wE=t=>{const{addFilter:e,utils:s}=t,{Type:i,createRoute:n,isFile:a}=s,o=Tw(t);return e("CREATE_VIEW",c=>{const{is:d,view:h,query:p}=c;if(!d("file")||!p("GET_ALLOW_IMAGE_PREVIEW"))return;const m=({root:w,props:x})=>{const{id:_}=x,R=p("GET_ITEM",_);if(!R||!a(R.file)||R.archived)return;const C=R.file;if(!$v(C)||!p("GET_IMAGE_PREVIEW_FILTER_ITEM")(R))return;const O="createImageBitmap"in(window||{}),y=p("GET_IMAGE_PREVIEW_MAX_FILE_SIZE");if(!O&&y&&C.size>y)return;w.ref.imagePreview=h.appendChildView(h.createChildView(o,{id:_}));const D=w.query("GET_IMAGE_PREVIEW_HEIGHT");D&&w.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:R.id,height:D});const L=!O&&C.size>p("GET_IMAGE_PREVIEW_MAX_INSTANT_PREVIEW_FILE_SIZE");w.dispatch("DID_IMAGE_PREVIEW_CONTAINER_CREATE",{id:_},L)},f=(w,x)=>{if(!w.ref.imagePreview)return;let{id:_}=x;const R=w.query("GET_ITEM",{id:_});if(!R)return;const C=w.query("GET_PANEL_ASPECT_RATIO"),O=w.query("GET_ITEM_PANEL_ASPECT_RATIO"),y=w.query("GET_IMAGE_PREVIEW_HEIGHT");if(C||O||y)return;let{imageWidth:D,imageHeight:L}=w.ref;if(!D||!L)return;const F=w.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),H=w.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),k=(R.getMetadata("exif")||{}).orientation||-1;if(k>=5&&k<=8&&([D,L]=[L,D]),!vE(R.file)||w.query("GET_IMAGE_PREVIEW_UPSCALE")){const G=2048/D;D*=G,L*=G}const X=L/D,P=(R.getMetadata("crop")||{}).aspectRatio||X;let Y=Math.max(F,Math.min(L,H));const j=w.rect.element.width,N=Math.min(j*P,Y);w.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:R.id,height:N})},b=({root:w})=>{w.ref.shouldRescale=!0},g=({root:w,action:x})=>{x.change.key==="crop"&&(w.ref.shouldRescale=!0)},v=({root:w,action:x})=>{w.ref.imageWidth=x.width,w.ref.imageHeight=x.height,w.ref.shouldRescale=!0,w.ref.shouldDrawPreview=!0,w.dispatch("KICK")};h.registerWriter(n({DID_RESIZE_ROOT:b,DID_STOP_RESIZE:b,DID_LOAD_ITEM:m,DID_IMAGE_PREVIEW_CALCULATE_SIZE:v,DID_UPDATE_ITEM_METADATA:g},({root:w,props:x})=>{w.ref.imagePreview&&(w.rect.element.hidden||(w.ref.shouldRescale&&(f(w,x),w.ref.shouldRescale=!1),w.ref.shouldDrawPreview&&(requestAnimationFrame(()=>{requestAnimationFrame(()=>{w.dispatch("DID_FINISH_CALCULATE_PREVIEWSIZE",{id:x.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]}}},xw=typeof window!="undefined"&&typeof window.document!="undefined";xw&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:wE}));/*!
36 * FilePondPluginImageResize 2.0.10
37 * Licensed under MIT, https://opensource.org/licenses/MIT/
38 * Please visit https://pqina.nl/filepond/ for details.
39 */const Sw=t=>/^image/.test(t.type),Rw=(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},_E=({addFilter:t,utils:e})=>{const{Type:s}=e;return t("DID_LOAD_ITEM",(i,{query:n})=>new Promise((a,o)=>{const c=i.file;if(!Sw(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"),m=n("GET_IMAGE_RESIZE_UPSCALE");if(h===null&&p===null)return a(i);const f=h===null?p:h,b=p===null?f:p,g=URL.createObjectURL(c);Rw(g,v=>{if(URL.revokeObjectURL(g),!v)return a(i);let{width:w,height:x}=v;const _=(i.getMetadata("exif")||{}).orientation||-1;if(_>=5&&_<=8&&([w,x]=[x,w]),w===f&&x===b)return a(i);if(!m){if(d==="cover"){if(w<=f||x<=b)return a(i)}else if(w<=f&&x<=f)return a(i)}i.setMetadata("resize",{mode:d,upscale:m,size:{width:f,height:b}}),a(i)})})),{options:{allowImageResize:[!0,s.BOOLEAN],imageResizeMode:["cover",s.STRING],imageResizeUpscale:[!0,s.BOOLEAN],imageResizeTargetWidth:[null,s.INT],imageResizeTargetHeight:[null,s.INT]}}},Cw=typeof window!="undefined"&&typeof window.document!="undefined";Cw&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:_E}));/*!
40 * FilePondPluginImageTransform 3.8.7
41 * Licensed under MIT, https://opensource.org/licenses/MIT/
42 * Please visit https://pqina.nl/filepond/ for details.
43 */const Ow=t=>/^image/.test(t.type),$w=t=>t.substr(0,t.lastIndexOf("."))||t,Lw={jpeg:"jpg","svg+xml":"svg"},Aw=(t,e)=>{const s=$w(t),i=e.split("/")[1],n=Lw[i]||i;return`${s}.${n}`},yw=t=>/jpeg|png|svg\+xml/.test(t)?t:"image/jpeg",Mw=t=>/^image/.test(t.type),Nw={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]},Pw=(t,e,s)=>(s===-1&&(s=1),Nw[s](t,e)),ul=(t,e)=>({x:t,y:e}),Dw=(t,e)=>t.x*e.x+t.y*e.y,qf=(t,e)=>ul(t.x-e.x,t.y-e.y),Fw=(t,e)=>Dw(qf(t,e),qf(t,e)),Yf=(t,e)=>Math.sqrt(Fw(t,e)),Xf=(t,e)=>{const s=t,i=1.5707963267948966,n=e,a=1.5707963267948966-e,o=Math.sin(i),c=Math.sin(n),d=Math.sin(a),h=Math.cos(a),p=s/o,m=p*c,f=p*d;return ul(h*m,h*f)},jw=(t,e)=>{const s=t.width,i=t.height,n=Xf(s,e),a=Xf(i,e),o=ul(t.x+Math.abs(n.x),t.y-Math.abs(n.y)),c=ul(t.x+t.width+Math.abs(a.y),t.y+Math.abs(a.x)),d=ul(t.x-Math.abs(a.y),t.y+t.height-Math.abs(a.x));return{width:Yf(o,c),height:Yf(o,d)}},TE=(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,o=n*2*t.width,c=a*2*t.height,d=jw(e,s);return Math.max(d.width/o,d.height/c)},xE=(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}},Zf=(t,e,s=1)=>{const i=t.height/t.width;let n=1,a=e,o=1,c=i;c>a&&(c=a,o=c/i);const d=Math.max(n/o,a/c),h=t.width/(s*d*o),p=h*e;return{width:h,height:p}},SE=t=>{t.width=1,t.height=1,t.getContext("2d").clearRect(0,0,1,1)},Qf=t=>t&&(t.horizontal||t.vertical),kw=(t,e,s)=>{if(e<=1&&!Qf(s))return t.width=t.naturalWidth,t.height=t.naturalHeight,t;const i=document.createElement("canvas"),n=t.naturalWidth,a=t.naturalHeight,o=e>=5&&e<=8;o?(i.width=a,i.height=n):(i.width=n,i.height=a);const c=i.getContext("2d");if(e&&c.transform.apply(c,Pw(n,a,e)),Qf(s)){const d=[1,0,0,1,0,0];(!o&&s.horizontal||o&s.vertical)&&(d[0]=-1,d[4]=n),(!o&&s.vertical||o&&s.horizontal)&&(d[3]=-1,d[5]=a),c.transform(...d)}return c.drawImage(t,0,0,n,a),i},Gw=(t,e,s={},i={})=>{const{canvasMemoryLimit:n,background:a=null}=i,o=s.zoom||1,c=kw(t,e,s.flip),d={width:c.width,height:c.height},h=s.aspectRatio||d.height/d.width;let p=Zf(d,h,o);if(n){const R=p.width*p.height;if(R>n){const C=Math.sqrt(n)/Math.sqrt(R);d.width=Math.floor(d.width*C),d.height=Math.floor(d.height*C),p=Zf(d,h,o)}}const m=document.createElement("canvas"),f={x:p.width*.5,y:p.height*.5},b={x:0,y:0,width:p.width,height:p.height,center:f},g=typeof s.scaleToFit=="undefined"||s.scaleToFit,v=o*TE(d,xE(b,h),s.rotation,g?s.center:{x:.5,y:.5});m.width=Math.round(p.width/v),m.height=Math.round(p.height/v),f.x/=v,f.y/=v;const w={x:f.x-d.width*(s.center?s.center.x:.5),y:f.y-d.height*(s.center?s.center.y:.5)},x=m.getContext("2d");a&&(x.fillStyle=a,x.fillRect(0,0,m.width,m.height)),x.translate(f.x,f.y),x.rotate(s.rotation||0),x.drawImage(c,w.x-f.x,w.y-f.y,d.width,d.height);const _=x.getImageData(0,0,m.width,m.height);return SE(m),_},Bw=(()=>typeof window!="undefined"&&typeof window.document!="undefined")();Bw&&(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,o=new Uint8Array(a),c=0;c<a;c++)o[c]=n.charCodeAt(c);t(new Blob([o],{type:e||"image/png"}))})}}));const Uw=(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)})}),nh=(t,e)=>bl(t.x*e,t.y*e),rh=(t,e)=>bl(t.x+e.x,t.y+e.y),RE=t=>{const e=Math.sqrt(t.x*t.x+t.y*t.y);return e===0?{x:0,y:0}:bl(t.x/e,t.y/e)},rr=(t,e,s)=>{const i=Math.cos(e),n=Math.sin(e),a=bl(t.x-s.x,t.y-s.y);return bl(s.x+i*a.x-n*a.y,s.y+n*a.x+i*a.y)},bl=(t=0,e=0)=>({x:t,y:e}),Ne=(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))},sa=(t,e,s)=>{const i=t.borderStyle||t.lineStyle||"solid",n=t.backgroundColor||t.fontColor||"transparent",a=t.borderColor||t.lineColor||"transparent",o=Ne(t.borderWidth||t.lineWidth,e,s),c=t.lineCap||"round",d=t.lineJoin||"round",h=typeof i=="string"?"":i.map(m=>Ne(m,e,s)).join(","),p=t.opacity||1;return{"stroke-linecap":c,"stroke-linejoin":d,"stroke-width":o||0,"stroke-dasharray":h,stroke:a,fill:n,opacity:p}},Cs=t=>t!=null,Fo=(t,e,s=1)=>{let i=Ne(t.x,e,s,"width")||Ne(t.left,e,s,"width"),n=Ne(t.y,e,s,"height")||Ne(t.top,e,s,"height"),a=Ne(t.width,e,s,"width"),o=Ne(t.height,e,s,"height"),c=Ne(t.right,e,s,"width"),d=Ne(t.bottom,e,s,"height");return Cs(n)||(Cs(o)&&Cs(d)?n=e.height-o-d:n=d),Cs(i)||(Cs(a)&&Cs(c)?i=e.width-a-c:i=c),Cs(a)||(Cs(i)&&Cs(c)?a=e.width-i-c:a=0),Cs(o)||(Cs(n)&&Cs(d)?o=e.height-n-d:o=0),{x:i||0,y:n||0,width:a||0,height:o||0}},Vw=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])),zw="http://www.w3.org/2000/svg",Sa=(t,e)=>{const s=document.createElementNS(zw,t);return e&&Vi(s,e),s},Ww=t=>Vi(t,I(I({},t.rect),t.styles)),Hw=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,I({cx:e,cy:s,rx:i,ry:n},t.styles))},qw={contain:"xMidYMid meet",cover:"xMidYMid slice"},Yw=(t,e)=>{Vi(t,$(I(I({},t.rect),t.styles),{preserveAspectRatio:qw[e.fit]||"none"}))},Xw={left:"start",center:"middle",right:"end"},Zw=(t,e,s,i)=>{const n=Ne(e.fontSize,s,i),a=e.fontFamily||"sans-serif",o=e.fontWeight||"normal",c=Xw[e.textAlign]||"start";Vi(t,$(I(I({},t.rect),t.styles),{"stroke-width":0,"font-weight":o,"font-size":n,"font-family":a,"text-anchor":c})),t.text!==e.text&&(t.text=e.text,t.textContent=e.text.length?e.text:" ")},Qw=(t,e,s,i)=>{Vi(t,$(I(I({},t.rect),t.styles),{fill:"none"}));const n=t.childNodes[0],a=t.childNodes[1],o=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",o.style.display="none";const h=RE({x:d.x-c.x,y:d.y-c.y}),p=Ne(.05,s,i);if(e.lineDecoration.indexOf("arrow-begin")!==-1){const m=nh(h,p),f=rh(c,m),b=rr(c,2,f),g=rr(c,-2,f);Vi(a,{style:"display:block;",d:`M${b.x},${b.y} L${c.x},${c.y} L${g.x},${g.y}`})}if(e.lineDecoration.indexOf("arrow-end")!==-1){const m=nh(h,-p),f=rh(d,m),b=rr(d,2,f),g=rr(d,-2,f);Vi(o,{style:"display:block;",d:`M${b.x},${b.y} L${d.x},${d.y} L${g.x},${g.y}`})}},Jw=(t,e,s,i)=>{Vi(t,$(I({},t.styles),{fill:"none",d:Vw(e.points.map(n=>({x:Ne(n.x,s,i,"width"),y:Ne(n.y,s,i,"height")})))}))},gd=t=>e=>Sa(t,{id:e.id}),Kw=t=>{const e=Sa("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},t_=t=>{const e=Sa("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),s=Sa("line");e.appendChild(s);const i=Sa("path");e.appendChild(i);const n=Sa("path");return e.appendChild(n),e},e_={image:Kw,rect:gd("rect"),ellipse:gd("ellipse"),text:gd("text"),path:gd("path"),line:t_},s_={rect:Ww,ellipse:Hw,image:Yw,text:Zw,path:Jw,line:Qw},i_=(t,e)=>e_[t](e),n_=(t,e,s,i,n)=>{e!=="path"&&(t.rect=Fo(s,i,n)),t.styles=sa(s,i,n),s_[e](t,s,i,n)},CE=(t,e)=>t[1].zIndex>e[1].zIndex?1:t[1].zIndex<e[1].zIndex?-1:0,r_=(t,e={},s,i)=>new Promise(n=>{const{background:a=null}=i,o=new FileReader;o.onloadend=()=>{const c=o.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 m=d.querySelector("title"),f=h.getAttribute("viewBox")||"",b=h.getAttribute("width")||"",g=h.getAttribute("height")||"";let v=parseFloat(b)||null,w=parseFloat(g)||null;const x=(b.match(/[a-z]+/)||[])[0]||"",_=(g.match(/[a-z]+/)||[])[0]||"",R=f.split(" ").map(parseFloat),C=R.length?{x:R[0],y:R[1],width:R[2],height:R[3]}:p;let O=v!=null?v:C.width,y=w!=null?w:C.height;h.style.overflow="visible",h.setAttribute("width",O),h.setAttribute("height",y);let D="";if(s&&s.length){const ct={width:O,height:y};D=s.sort(CE).reduce((ft,J)=>{const st=i_(J[0],J[1]);return n_(st,J[0],J[1],ct),st.removeAttribute("id"),st.getAttribute("opacity")===1&&st.removeAttribute("opacity"),ft+`
44 `+st.outerHTML+`
45 `},""),D=`
46
47 <g>${D.replace(/&nbsp;/g," ")}</g>
48
49 `}const L=e.aspectRatio||y/O,F=O,H=F*L,B=typeof e.scaleToFit=="undefined"||e.scaleToFit,k=e.center?e.center.x:.5,X=e.center?e.center.y:.5,P=TE({width:O,height:y},xE({width:F,height:H},L),e.rotation,B?{x:k,y:X}:{x:.5,y:.5}),Y=e.zoom*P,j=e.rotation*(180/Math.PI),N={x:F*.5,y:H*.5},G={x:N.x-O*k,y:N.y-y*X},U=[`rotate(${j} ${N.x} ${N.y})`,`translate(${N.x} ${N.y})`,`scale(${Y})`,`translate(${-N.x} ${-N.y})`,`translate(${G.x} ${G.y})`],q=e.flip&&e.flip.horizontal,V=e.flip&&e.flip.vertical,lt=[`scale(${q?-1:1} ${V?-1:1})`,`translate(${q?-O:0} ${V?-y:0})`],ot=`<?xml version="1.0" encoding="UTF-8"?>
50 <svg width="${F}${x}" height="${H}${_}"
51 viewBox="0 0 ${F} ${H}" ${a?'style="background:'+a+'" ':""}
52 preserveAspectRatio="xMinYMin"
53 xmlns:xlink="http://www.w3.org/1999/xlink"
54 xmlns="http://www.w3.org/2000/svg">
55 <!-- Generated by PQINA - https://pqina.nl/ -->
56 <title>${m?m.textContent:""}</title>
57 <g transform="${U.join(" ")}">
58 <g transform="${lt.join(" ")}">
59 ${h.outerHTML}${D}
60 </g>
61 </g>
62 </svg>`;n(ot)},o.readAsText(t)}),a_=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},o_=()=>{const t={resize:p,filter:h},e=(m,f)=>(m.forEach(b=>{f=t[b.type](f,b.data)}),f),s=(m,f)=>{let b=m.transforms,g=null;if(b.forEach(v=>{v.type==="filter"&&(g=v)}),g){let v=null;b.forEach(w=>{w.type==="resize"&&(v=w)}),v&&(v.data.matrix=g.data,b=b.filter(w=>w.type!=="filter"))}f(e(b,m.imageData))};self.onmessage=m=>{s(m.data.message,f=>{self.postMessage({id:m.data.id,message:f},[f.data.buffer])})};const i=1,n=1,a=1;function o(m,f,b){const g=f[m]/255,v=f[m+1]/255,w=f[m+2]/255,x=f[m+3]/255,_=g*b[0]+v*b[1]+w*b[2]+x*b[3]+b[4],R=g*b[5]+v*b[6]+w*b[7]+x*b[8]+b[9],C=g*b[10]+v*b[11]+w*b[12]+x*b[13]+b[14],O=g*b[15]+v*b[16]+w*b[17]+x*b[18]+b[19],y=Math.max(0,_*O)+i*(1-O),D=Math.max(0,R*O)+n*(1-O),L=Math.max(0,C*O)+a*(1-O);f[m]=Math.max(0,Math.min(1,y))*255,f[m+1]=Math.max(0,Math.min(1,D))*255,f[m+2]=Math.max(0,Math.min(1,L))*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(m){return self.JSON.stringify(m||[])===c}function h(m,f){if(!f||d(f))return m;const b=m.data,g=b.length,v=f[0],w=f[1],x=f[2],_=f[3],R=f[4],C=f[5],O=f[6],y=f[7],D=f[8],L=f[9],F=f[10],H=f[11],B=f[12],k=f[13],X=f[14],P=f[15],Y=f[16],j=f[17],N=f[18],G=f[19];let U=0,q=0,V=0,lt=0,ot=0,ct=0,ft=0,J=0,st=0,at=0,gt=0,ht=0;for(;U<g;U+=4)q=b[U]/255,V=b[U+1]/255,lt=b[U+2]/255,ot=b[U+3]/255,ct=q*v+V*w+lt*x+ot*_+R,ft=q*C+V*O+lt*y+ot*D+L,J=q*F+V*H+lt*B+ot*k+X,st=q*P+V*Y+lt*j+ot*N+G,at=Math.max(0,ct*st)+i*(1-st),gt=Math.max(0,ft*st)+n*(1-st),ht=Math.max(0,J*st)+a*(1-st),b[U]=Math.max(0,Math.min(1,at))*255,b[U+1]=Math.max(0,Math.min(1,gt))*255,b[U+2]=Math.max(0,Math.min(1,ht))*255;return m}function p(m,f){let{mode:b="contain",upscale:g=!1,width:v,height:w,matrix:x}=f;if(x=!x||d(x)?null:x,!v&&!w)return h(m,x);if(v===null?v=w:w===null&&(w=v),b!=="force"){let k=v/m.width,X=w/m.height,P=1;if(b==="cover"?P=Math.max(k,X):b==="contain"&&(P=Math.min(k,X)),P>1&&g===!1)return h(m,x);v=m.width*P,w=m.height*P}const _=m.width,R=m.height,C=Math.round(v),O=Math.round(w),y=m.data,D=new Uint8ClampedArray(C*O*4),L=_/C,F=R/O,H=Math.ceil(L*.5),B=Math.ceil(F*.5);for(let k=0;k<O;k++)for(let X=0;X<C;X++){let P=(X+k*C)*4,Y=0,j=0,N=0,G=0,U=0,q=0,V=0,lt=(k+.5)*F;for(let ot=Math.floor(k*F);ot<(k+1)*F;ot++){let ct=Math.abs(lt-(ot+.5))/B,ft=(X+.5)*L,J=ct*ct;for(let st=Math.floor(X*L);st<(X+1)*L;st++){let at=Math.abs(ft-(st+.5))/H,gt=Math.sqrt(J+at*at);if(gt>=-1&&gt<=1&&(Y=2*gt*gt*gt-3*gt*gt+1,Y>0)){at=4*(st+ot*_);let ht=y[at+3];V+=Y*ht,N+=Y,ht<255&&(Y=Y*ht/250),G+=Y*y[at],U+=Y*y[at+1],q+=Y*y[at+2],j+=Y}}}D[P]=G/j,D[P+1]=U/j,D[P+2]=q/j,D[P+3]=V/N,x&&o(P,D,x)}return{data:D,width:C,height:O}}},l_=(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},c_=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=l_(e,s)),s+n>e.byteLength)));)s+=n;return t.slice(0,s)},d_=t=>new Promise(e=>{const s=new FileReader;s.onload=()=>e(c_(s.result)||null),s.readAsArrayBuffer(t.slice(0,256*1024))}),h_=()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,u_=(t,e)=>{const s=h_();if(s){const i=new s;return i.append(t),i.getBlob(e)}return new Blob([t],{type:e})},p_=()=>Math.random().toString(36).substr(2,9),m_=t=>{const e=new Blob(["(",t.toString(),")()"],{type:"application/javascript"}),s=URL.createObjectURL(e),i=new Worker(s),n=[];return{transfer:()=>{},post:(a,o,c)=>{const d=p_();n[d]=o,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)}}},f_=t=>new Promise((e,s)=>{const i=new Image;i.onload=()=>{e(i)},i.onerror=n=>{s(n)},i.src=t}),g_=t=>t.reduce((e,s)=>e.then(i=>s().then(Array.prototype.concat.bind(i))),Promise.resolve([])),E_=(t,e)=>new Promise(s=>{const i={width:t.width,height:t.height},n=t.getContext("2d"),a=e.sort(CE).map(o=>()=>new Promise(c=>{x_[o[0]](n,i,o[1],c)&&c()}));g_(a).then(()=>s(t))}),jo=(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},ko=t=>{t.fill(),t.stroke(),t.globalAlpha=1},b_=(t,e,s)=>{const i=Fo(s,e),n=sa(s,e);return jo(t,n),t.rect(i.x,i.y,i.width,i.height),ko(t),!0},I_=(t,e,s)=>{const i=Fo(s,e),n=sa(s,e);jo(t,n);const a=i.x,o=i.y,c=i.width,d=i.height,h=.5522848,p=c/2*h,m=d/2*h,f=a+c,b=o+d,g=a+c/2,v=o+d/2;return t.moveTo(a,v),t.bezierCurveTo(a,v-m,g-p,o,g,o),t.bezierCurveTo(g+p,o,f,v-m,f,v),t.bezierCurveTo(f,v+m,g+p,b,g,b),t.bezierCurveTo(g-p,b,a,v+m,a,v),ko(t),!0},v_=(t,e,s,i)=>{const n=Fo(s,e),a=sa(s,e);jo(t,a);const o=new Image;new URL(s.src,window.location.href).origin!==window.location.origin&&(o.crossOrigin=""),o.onload=()=>{if(s.fit==="cover"){const d=n.width/n.height,h=d>1?o.width:o.height*d,p=d>1?o.width/d:o.height,m=o.width*.5-h*.5,f=o.height*.5-p*.5;t.drawImage(o,m,f,h,p,n.x,n.y,n.width,n.height)}else if(s.fit==="contain"){const d=Math.min(n.width/o.width,n.height/o.height),h=d*o.width,p=d*o.height,m=n.x+n.width*.5-h*.5,f=n.y+n.height*.5-p*.5;t.drawImage(o,0,0,o.width,o.height,m,f,h,p)}else t.drawImage(o,0,0,o.width,o.height,n.x,n.y,n.width,n.height);ko(t),i()},o.src=s.src},w_=(t,e,s)=>{const i=Fo(s,e),n=sa(s,e);jo(t,n);const a=Ne(s.fontSize,e),o=s.fontFamily||"sans-serif",c=s.fontWeight||"normal",d=s.textAlign||"left";return t.font=`${c} ${a}px ${o}`,t.textAlign=d,t.fillText(s.text,i.x,i.y),ko(t),!0},__=(t,e,s)=>{const i=sa(s,e);jo(t,i),t.beginPath();const n=s.points.map(o=>({x:Ne(o.x,e,1,"width"),y:Ne(o.y,e,1,"height")}));t.moveTo(n[0].x,n[0].y);const a=n.length;for(let o=1;o<a;o++)t.lineTo(n[o].x,n[o].y);return ko(t),!0},T_=(t,e,s)=>{const i=Fo(s,e),n=sa(s,e);jo(t,n),t.beginPath();const a={x:i.x,y:i.y},o={x:i.x+i.width,y:i.y+i.height};t.moveTo(a.x,a.y),t.lineTo(o.x,o.y);const c=RE({x:o.x-a.x,y:o.y-a.y}),d=.04*Math.min(e.width,e.height);if(s.lineDecoration.indexOf("arrow-begin")!==-1){const h=nh(c,d),p=rh(a,h),m=rr(a,2,p),f=rr(a,-2,p);t.moveTo(m.x,m.y),t.lineTo(a.x,a.y),t.lineTo(f.x,f.y)}if(s.lineDecoration.indexOf("arrow-end")!==-1){const h=nh(c,-d),p=rh(o,h),m=rr(o,2,p),f=rr(o,-2,p);t.moveTo(m.x,m.y),t.lineTo(o.x,o.y),t.lineTo(f.x,f.y)}return ko(t),!0},x_={rect:b_,ellipse:I_,image:v_,text:w_,line:T_,path:__},S_=t=>{const e=document.createElement("canvas");return e.width=t.width,e.height=t.height,e.getContext("2d").putImageData(t,0,0),e},R_=(t,e,s={})=>new Promise((i,n)=>{if(!t||!Mw(t))return n({status:"not an image file",file:t});const{stripImageHead:a,beforeCreateBlob:o,afterCreateBlob:c,canvasMemoryLimit:d}=s,{crop:h,size:p,filter:m,markup:f,output:b}=e,g=e.image&&e.image.orientation?Math.max(1,Math.min(8,e.image.orientation)):null,v=b&&b.quality,w=v===null?null:v/100,x=b&&b.type||null,_=b&&b.background||null,R=[];p&&(typeof p.width=="number"||typeof p.height=="number")&&R.push({type:"resize",data:p}),m&&m.length===20&&R.push({type:"filter",data:m});const C=D=>{const L=c?c(D):D;Promise.resolve(L).then(i)},O=(D,L)=>{const F=S_(D),H=f.length?E_(F,f):F;Promise.resolve(H).then(B=>{Uw(B,L,o).then(k=>{if(SE(B),a)return C(k);d_(t).then(X=>{X!==null&&(k=new Blob([X,k.slice(20)],{type:k.type})),C(k)})}).catch(n)})};if(/svg/.test(t.type)&&x===null)return r_(t,h,f,{background:_}).then(D=>{i(u_(D,"image/svg+xml"))});const y=URL.createObjectURL(t);f_(y).then(D=>{URL.revokeObjectURL(y);const L=Gw(D,g,h,{canvasMemoryLimit:d,background:_}),F={quality:w,type:x||t.type};if(!R.length)return O(L,F);const H=m_(o_);H.post({transforms:R,imageData:L},B=>{O(a_(B),F),H.terminate()},[L.data.buffer])}).catch(n)}),C_=["x","y","left","top","right","bottom","width","height"],O_=t=>typeof t=="string"&&/%/.test(t)?parseFloat(t)/100:t,$_=t=>{const[e,s]=t,i=s.points?{}:C_.reduce((n,a)=>(n[a]=O_(s[a]),n),{});return[e,I(I({zIndex:0},s),i)]},L_=t=>new Promise((e,s)=>{const i=new Image;i.src=URL.createObjectURL(t);const n=()=>{const o=i.naturalWidth,c=i.naturalHeight;o&&c&&(URL.revokeObjectURL(i.src),clearInterval(a),e({width:o,height:c}))};i.onerror=o=>{URL.revokeObjectURL(i.src),clearInterval(a),s(o)};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 o=a.length;const c=new Uint8Array(o);for(;o--;)c[o]=a.charCodeAt(o);t(new Blob([c],{type:e||"image/png"}))})}}));const uf=typeof window!="undefined"&&typeof window.document!="undefined",A_=uf&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,OE=({addFilter:t,utils:e})=>{const{Type:s,forin:i,getFileFromBlob:n,isFile:a}=e,o=["crop","resize","filter","markup","output"],c=p=>(m,f,b)=>m(f,p?p(b):b),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:m})=>new Promise(f=>{f(!m("IS_ASYNC"))}));const h=(p,m,f)=>new Promise(b=>{if(!p("GET_ALLOW_IMAGE_TRANSFORM")||f.archived||!a(m)||!Ow(m))return b(!1);L_(m).then(()=>{const g=p("GET_IMAGE_TRANSFORM_IMAGE_FILTER");if(g){const v=g(m);if(v==null)return handleRevert(!0);if(typeof v=="boolean")return b(v);if(typeof v.then=="function")return v.then(b)}b(!0)}).catch(g=>{b(!1)})});return t("DID_CREATE_ITEM",(p,{query:m,dispatch:f})=>{m("GET_ALLOW_IMAGE_TRANSFORM")&&p.extend("requestPrepare",()=>new Promise((b,g)=>{f("REQUEST_PREPARE_OUTPUT",{query:p.id,item:p,success:b,failure:g},!0)}))}),t("PREPARE_OUTPUT",(p,{query:m,item:f})=>new Promise(b=>{h(m,p,f).then(g=>{if(!g)return b(p);const v=[];m("GET_IMAGE_TRANSFORM_VARIANTS_INCLUDE_ORIGINAL")&&v.push(()=>new Promise(L=>{L({name:m("GET_IMAGE_TRANSFORM_VARIANTS_ORIGINAL_NAME"),file:p})})),m("GET_IMAGE_TRANSFORM_VARIANTS_INCLUDE_DEFAULT")&&v.push((L,F,H)=>new Promise(B=>{L(F,H).then(k=>B({name:m("GET_IMAGE_TRANSFORM_VARIANTS_DEFAULT_NAME"),file:k}))}));const w=m("GET_IMAGE_TRANSFORM_VARIANTS")||{};i(w,(L,F)=>{const H=c(F);v.push((B,k,X)=>new Promise(P=>{H(B,k,X).then(Y=>P({name:L,file:Y}))}))});const x=m("GET_IMAGE_TRANSFORM_OUTPUT_QUALITY"),_=m("GET_IMAGE_TRANSFORM_OUTPUT_QUALITY_MODE"),R=x===null?null:x/100,C=m("GET_IMAGE_TRANSFORM_OUTPUT_MIME_TYPE"),O=m("GET_IMAGE_TRANSFORM_CLIENT_TRANSFORMS")||o;f.setMetadata("output",{type:C,quality:R,client:O},!0);const y=(L,F)=>new Promise((H,B)=>{const k=I({},F);Object.keys(k).filter(V=>V!=="exif").forEach(V=>{O.indexOf(V)===-1&&delete k[V]});const{resize:X,exif:P,output:Y,crop:j,filter:N,markup:G}=k,U={image:{orientation:P?P.orientation:null},output:Y&&(Y.type||typeof Y.quality=="number"||Y.background)?{type:Y.type,quality:typeof Y.quality=="number"?Y.quality*100:null,background:Y.background||m("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR")||null}:void 0,size:X&&(X.size.width||X.size.height)?I({mode:X.mode,upscale:X.upscale},X.size):void 0,crop:j&&!d(j)?I({},j):void 0,markup:G&&G.length?G.map($_):[],filter:N};if(U.output){const V=Y.type?Y.type!==L.type:!1,lt=/\/jpe?g$/.test(L.type),ot=Y.quality!==null?lt&&_==="always":!1;if(!!!(U.size||U.crop||U.filter||V||ot))return H(L)}const q={beforeCreateBlob:m("GET_IMAGE_TRANSFORM_BEFORE_CREATE_BLOB"),afterCreateBlob:m("GET_IMAGE_TRANSFORM_AFTER_CREATE_BLOB"),canvasMemoryLimit:m("GET_IMAGE_TRANSFORM_CANVAS_MEMORY_LIMIT"),stripImageHead:m("GET_IMAGE_TRANSFORM_OUTPUT_STRIP_IMAGE_HEAD")};R_(L,U,q).then(V=>{const lt=n(V,Aw(L.name,yw(V.type)));H(lt)}).catch(B)}),D=v.map(L=>L(y,p,f.getMetadata()));Promise.all(D).then(L=>{b(L.length===1&&L[0].name===null?L[0].file:L)})})})),{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:[uf&&A_?4096*4096:null,s.INT],imageTransformCanvasBackgroundColor:[null,s.STRING]}}};uf&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:OE}));/*!
63 * FilePondPluginImageValidateSize 1.2.7
64 * Licensed under MIT, https://opensource.org/licenses/MIT/
65 * Please visit https://pqina.nl/filepond/ for details.
66 */const y_=t=>/^image/.test(t.type),M_=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)}),$E=({addFilter:t,utils:e})=>{const{Type:s,replaceInString:i,isFile:n}=e,a=(o,c,d)=>new Promise((h,p)=>{const m=({width:f,height:b})=>{const{minWidth:g,minHeight:v,maxWidth:w,maxHeight:x,minResolution:_,maxResolution:R}=c,C=f*b;f<g||b<v?p("TOO_SMALL"):f>w||b>x?p("TOO_BIG"):_!==null&&C<_?p("TOO_LOW_RES"):R!==null&&C>R&&p("TOO_HIGH_RES"),h()};M_(o).then(m).catch(()=>{if(!d){p();return}d(o,c).then(m).catch(()=>p())})});return t("LOAD_FILE",(o,{query:c})=>new Promise((d,h)=>{if(!n(o)||!y_(o)||!c("GET_ALLOW_IMAGE_VALIDATE_SIZE")){d(o);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")},m=c("GET_IMAGE_VALIDATE_SIZE_MEASURE");a(o,p,m).then(()=>{d(o)}).catch(f=>{const b=f?{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")}}[f]:{label:c("GET_IMAGE_VALIDATE_SIZE_LABEL_FORMAT_ERROR"),details:o.type};h({status:{main:b.label,sub:f?i(b.details,p):b.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]}}},N_=typeof window!="undefined"&&typeof window.document!="undefined";N_&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:$E}));/*!
67 * FilePondPluginMediaPreview 1.0.1
68 * Licensed under MIT, https://opensource.org/licenses/MIT/
69 * Please visit undefined for details.
70 */const ah=t=>/^video/.test(t.type),Ra=t=>/^audio/.test(t.type),pl=t=>/pdf$/.test(t.type);class P_{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 D_=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(pl(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=Ra(i.file)?"audio":"video";if(e.ref.media=document.createElement(n),e.ref.media.setAttribute("controls",!0),e.element.appendChild(e.ref.media),Ra(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,o=new Blob([n.file],{type:n.file.type});e.ref.media.type=n.file.type,pl(n.file)?e.ref.media.data=a.createObjectURL(o):e.ref.media.src=n.file.mock&&n.file.url||a.createObjectURL(o),Ra(n.file)&&new P_(e.ref.media,e.ref.audio),e.ref.media.addEventListener("loadeddata",()=>{if(ah(n.file)||Ra(n.file)){let c=75;if(ah(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",()=>{pl(n.file)&&e.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i,height:e.ref.media.scrollHeight})},!1)}})}),F_=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=D_(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})})},LE=t=>{const{addFilter:e,utils:s}=t,{Type:i,createRoute:n}=s,a=F_(t);return e("CREATE_VIEW",o=>{const{is:c,view:d,query:h}=o;if(!c("file"))return;const p=({root:m,props:f})=>{const{id:b}=f,g=h("GET_ITEM",b);!g||g.archived||!ah(g.file)&&!pl(g.file)&&!Ra(g.file)||(m.ref.mediaPreview=d.appendChildView(d.createChildView(a,{id:b})),m.dispatch("DID_MEDIA_PREVIEW_CONTAINER_CREATE",{id:b}))};d.registerWriter(n({DID_LOAD_ITEM:p},({root:m,props:f})=>{const{id:b}=f,g=h("GET_ITEM",b);!ah(g.file)&&!pl(g.file)&&!Ra(g.file)||m.rect.element.hidden}))}),{options:{allowPdfPreview:[!0,i.BOOLEAN],allowVideoPreview:[!0,i.BOOLEAN],allowAudioPreview:[!0,i.BOOLEAN]}}},j_=typeof window!="undefined"&&typeof window.document!="undefined";j_&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:LE}));/*!
71 * FilePond 4.32.7
72 * Licensed under MIT, https://opensource.org/licenses/MIT/
73 * Please visit https://pqina.nl/filepond/ for details.
74 */const k_=t=>t instanceof HTMLElement,G_=(t,e=[],s=[])=>{const i=I({},t),n=[],a=[],o=()=>I({},i),c=()=>{const g=[...n];return n.length=0,g},d=()=>{const g=[...a];a.length=0,g.forEach(({type:v,data:w})=>{h(v,w)})},h=(g,v,w)=>{if(w&&!document.hidden){a.push({type:g,data:v});return}b[g]&&b[g](v),n.push({type:g,data:v})},p=(g,...v)=>f[g]?f[g](...v):null,m={getState:o,processActionQueue:c,processDispatchQueue:d,dispatch:h,query:p};let f={};e.forEach(g=>{f=I(I({},g(i)),f)});let b={};return s.forEach(g=>{b=I(I({},g(h,p,i)),b)}),m},B_=(t,e,s)=>{if(typeof s=="function"){t[e]=s;return}Object.defineProperty(t,e,I({},s))},Vt=(t,e)=>{for(const s in t)t.hasOwnProperty(s)&&e(s,t[s])},ar=t=>{const e={};return Vt(t,s=>{B_(e,s,t[s])}),e},me=(t,e,s=null)=>{if(s===null)return t.getAttribute(e)||t.hasAttribute(e);t.setAttribute(e,s)},U_="http://www.w3.org/2000/svg",V_=["svg","path"],Jf=t=>V_.includes(t),oh=(t,e,s={})=>{typeof e=="object"&&(s=e,e=null);const i=Jf(t)?document.createElementNS(U_,t):document.createElement(t);return e&&(Jf(t)?me(i,"class",e):i.className=e),Vt(s,(n,a)=>{me(i,n,a)}),i},z_=t=>(e,s)=>{typeof s!="undefined"&&t.children[s]?t.insertBefore(e,t.children[s]):t.appendChild(e)},W_=(t,e)=>(s,i)=>(typeof i!="undefined"?e.splice(i,0,s):e.push(s),s),H_=(t,e)=>s=>(e.splice(e.indexOf(s),1),s.element.parentNode&&t.removeChild(s.element),s),q_=(()=>typeof window!="undefined"&&typeof window.document!="undefined")(),AE=()=>q_,Y_=AE()?oh("svg"):{},X_="children"in Y_?t=>t.children.length:t=>t.childNodes.length,yE=(t,e,s,i)=>{const n=s[0]||t.left,a=s[1]||t.top,o=n+t.width,c=a+t.height*(i[1]||1),d={element:I({},t),inner:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},outer:{left:n,top:a,right:o,bottom:c}};return e.filter(h=>!h.isRectIgnored()).map(h=>h.rect).forEach(h=>{Kf(d.inner,I({},h.inner)),Kf(d.outer,I({},h.outer))}),tg(d.inner),d.outer.bottom+=d.element.marginBottom,d.outer.right+=d.element.marginRight,tg(d.outer),d},Kf=(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)},tg=t=>{t.width=t.right-t.left,t.height=t.bottom-t.top},xr=t=>typeof t=="number",Z_=(t,e,s,i=.001)=>Math.abs(t-e)<i&&Math.abs(s)<i,Q_=({stiffness:t=.5,damping:e=.75,mass:s=10}={})=>{let i=null,n=null,a=0,o=!1;const h=ar({interpolate:(p,m)=>{if(o)return;if(!(xr(i)&&xr(n))){o=!0,a=0;return}const f=-(n-i)*t;a+=f/s,n+=a,a*=e,Z_(n,i,a)||m?(n=i,a=0,o=!0,h.onupdate(n),h.oncomplete(n)):h.onupdate(n)},target:{set:p=>{if(xr(p)&&!xr(n)&&(n=p),i===null&&(i=p,n=p),i=p,n===i||typeof i=="undefined"){o=!0,a=0,h.onupdate(n),h.oncomplete(n);return}o=!1},get:()=>i},resting:{get:()=>o},onupdate:p=>{},oncomplete:p=>{}});return h},J_=t=>t<.5?2*t*t:-1+(4-2*t)*t,K_=({duration:t=500,easing:e=J_,delay:s=0}={})=>{let i=null,n,a,o=!0,c=!1,d=null;const p=ar({interpolate:(m,f)=>{o||d===null||(i===null&&(i=m),!(m-i<s)&&(n=m-i-s,n>=t||f?(n=1,a=c?0:1,p.onupdate(a*d),p.oncomplete(a*d),o=!0):(a=n/t,p.onupdate((n>=0?e(c?1-a:a):0)*d))))},target:{get:()=>c?0:d,set:m=>{if(d===null){d=m,p.onupdate(m),p.oncomplete(m);return}m<d?(d=1,c=!0):(c=!1,d=m),o=!1,i=null}},resting:{get:()=>o},onupdate:m=>{},oncomplete:m=>{}});return p},eg={spring:Q_,tween:K_},tT=(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"?I({},i):{};return eg[n]?eg[n](a):null},pf=(t,e,s,i=!1)=>{e=Array.isArray(e)?e:[e],e.forEach(n=>{t.forEach(a=>{let o=a,c=()=>s[a],d=h=>s[a]=h;typeof a=="object"&&(o=a.key,c=a.getter||c,d=a.setter||d),!(n[o]&&!i)&&(n[o]={get:c,set:d})})})},eT=({mixinConfig:t,viewProps:e,viewInternalAPI:s,viewExternalAPI:i})=>{const n=I({},e),a=[];return Vt(t,(o,c)=>{const d=tT(c);if(!d)return;d.onupdate=p=>{e[o]=p},d.target=n[o],pf([{key:o,setter:p=>{d.target!==p&&(d.target=p)},getter:()=>e[o]}],[s,i],e,!0),a.push(d)}),{write:o=>{let c=document.hidden,d=!0;return a.forEach(h=>{h.resting||(d=!1),h.interpolate(o,c)}),d},destroy:()=>{}}},sT=t=>(e,s)=>{t.addEventListener(e,s)},iT=t=>(e,s)=>{t.removeEventListener(e,s)},nT=({mixinConfig:t,viewProps:e,viewInternalAPI:s,viewExternalAPI:i,viewState:n,view:a})=>{const o=[],c=sT(a.element),d=iT(a.element);return i.on=(h,p)=>{o.push({type:h,fn:p}),c(h,p)},i.off=(h,p)=>{o.splice(o.findIndex(m=>m.type===h&&m.fn===p),1),d(h,p)},{write:()=>!0,destroy:()=>{o.forEach(h=>{d(h.type,h.fn)})}}},rT=({mixinConfig:t,viewProps:e,viewExternalAPI:s})=>{pf(t,s,e)},qe=t=>t!=null,aT={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},oT=({mixinConfig:t,viewProps:e,viewInternalAPI:s,viewExternalAPI:i,view:n})=>{const a=I({},e),o={};pf(t,[s,i],e);const c=()=>[e.translateX||0,e.translateY||0],d=()=>[e.scaleX||0,e.scaleY||0],h=()=>n.rect?yE(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"?aT[p]:a[p]}),{write:()=>{if(lT(o,e))return cT(n.element,e),Object.assign(o,I({},e)),!0},destroy:()=>{}}},lT=(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},cT=(t,{opacity:e,perspective:s,translateX:i,translateY:n,scaleX:a,scaleY:o,rotateX:c,rotateY:d,rotateZ:h,originX:p,originY:m,width:f,height:b})=>{let g="",v="";(qe(p)||qe(m))&&(v+=`transform-origin: ${p||0}px ${m||0}px;`),qe(s)&&(g+=`perspective(${s}px) `),(qe(i)||qe(n))&&(g+=`translate3d(${i||0}px, ${n||0}px, 0) `),(qe(a)||qe(o))&&(g+=`scale3d(${qe(a)?a:1}, ${qe(o)?o:1}, 1) `),qe(h)&&(g+=`rotateZ(${h}rad) `),qe(c)&&(g+=`rotateX(${c}rad) `),qe(d)&&(g+=`rotateY(${d}rad) `),g.length&&(v+=`transform:${g};`),qe(e)&&(v+=`opacity:${e};`,e===0&&(v+="visibility:hidden;"),e<1&&(v+="pointer-events:none;")),qe(b)&&(v+=`height:${b}px;`),qe(f)&&(v+=`width:${f}px;`);const w=t.elementCurrentStyle||"";(v.length!==w.length||v!==w)&&(t.style.cssText=v,t.elementCurrentStyle=v)},dT={styles:oT,listeners:nT,animations:eT,apis:rT},sg=(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),te=({tag:t="div",name:e=null,attributes:s={},read:i=()=>{},write:n=()=>{},create:a=()=>{},destroy:o=()=>{},filterFrameActionsForChild:c=(b,g)=>g,didCreateView:d=()=>{},didWriteView:h=()=>{},ignoreRect:p=!1,ignoreRectUpdate:m=!1,mixins:f=[]}={})=>(b,g={})=>{const v=oh(t,`filepond--${e}`,s),w=window.getComputedStyle(v,null),x=sg();let _=null,R=!1;const C=[],O=[],y={},D={},L=[n],F=[i],H=[o],B=()=>v,k=()=>C.concat(),X=()=>y,P=J=>(st,at)=>st(J,at),Y=()=>_||(_=yE(x,C,[0,0],[1,1]),_),j=()=>w,N=()=>{_=null,C.forEach(at=>at._read()),!(m&&x.width&&x.height)&&sg(x,v,w);const st={root:ct,props:g,rect:x};F.forEach(at=>at(st))},G=(J,st,at)=>{let gt=st.length===0;return L.forEach(ht=>{ht({props:g,root:ct,actions:st,timestamp:J,shouldOptimize:at})===!1&&(gt=!1)}),O.forEach(ht=>{ht.write(J)===!1&&(gt=!1)}),C.filter(ht=>!!ht.element.parentNode).forEach(ht=>{ht._write(J,c(ht,st),at)||(gt=!1)}),C.forEach((ht,He)=>{ht.element.parentNode||(ct.appendChild(ht.element,He),ht._read(),ht._write(J,c(ht,st),at),gt=!1)}),R=gt,h({props:g,root:ct,actions:st,timestamp:J}),gt},U=()=>{O.forEach(J=>J.destroy()),H.forEach(J=>{J({root:ct,props:g})}),C.forEach(J=>J._destroy())},q={element:{get:B},style:{get:j},childViews:{get:k}},V=$(I({},q),{rect:{get:Y},ref:{get:X},is:J=>e===J,appendChild:z_(v),createChildView:P(b),linkView:J=>(C.push(J),J),unlinkView:J=>{C.splice(C.indexOf(J),1)},appendChildView:W_(v,C),removeChildView:H_(v,C),registerWriter:J=>L.push(J),registerReader:J=>F.push(J),registerDestroyer:J=>H.push(J),invalidateLayout:()=>v.layoutCalculated=!1,dispatch:b.dispatch,query:b.query}),lt={element:{get:B},childViews:{get:k},rect:{get:Y},resting:{get:()=>R},isRectIgnored:()=>p,_read:N,_write:G,_destroy:U},ot=$(I({},q),{rect:{get:()=>x}});Object.keys(f).sort((J,st)=>J==="styles"?1:st==="styles"?-1:0).forEach(J=>{const st=dT[J]({mixinConfig:f[J],viewProps:g,viewState:D,viewInternalAPI:V,viewExternalAPI:lt,view:ar(ot)});st&&O.push(st)});const ct=ar(V);a({root:ct,props:g});const ft=X_(v);return C.forEach((J,st)=>{ct.appendChild(J.element,ft+st)}),d(ct),ar(lt)},hT=(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 o=null,c=null,d=null,h=null;const p=()=>{document.hidden?(d=()=>window.setTimeout(()=>m(performance.now()),a),h=()=>window.clearTimeout(c)):(d=()=>window.requestAnimationFrame(m),h=()=>window.cancelAnimationFrame(c))};document.addEventListener("visibilitychange",()=>{h&&h(),p(),m(performance.now())});const m=f=>{c=d(m),o||(o=f);const b=f-o;b<=a||(o=f-b%a,n.readers.forEach(g=>g()),n.writers.forEach(g=>g(f)))};return p(),m(performance.now()),{pause:()=>{h(c)}}},es=(t,e)=>({root:s,props:i,actions:n=[],timestamp:a,shouldOptimize:o})=>{n.filter(c=>t[c.type]).forEach(c=>t[c.type]({root:s,props:i,action:c.data,timestamp:a,shouldOptimize:o})),e&&e({root:s,props:i,actions:n,timestamp:a,shouldOptimize:o})},ig=(t,e)=>e.parentNode.insertBefore(t,e),ng=(t,e)=>e.parentNode.insertBefore(t,e.nextSibling),Ip=t=>Array.isArray(t),xn=t=>t==null,uT=t=>t.trim(),vp=t=>""+t,pT=(t,e=",")=>xn(t)?[]:Ip(t)?t:vp(t).split(e).map(uT).filter(s=>s.length),ME=t=>typeof t=="boolean",NE=t=>ME(t)?t:t==="true",ts=t=>typeof t=="string",PE=t=>xr(t)?t:ts(t)?vp(t).replace(/[a-z]+/gi,""):0,Cd=t=>parseInt(PE(t),10),rg=t=>parseFloat(PE(t)),Go=t=>xr(t)&&isFinite(t)&&Math.floor(t)===t,ag=(t,e=1e3)=>{if(Go(t))return t;let s=vp(t).trim();return/MB$/i.test(s)?(s=s.replace(/MB$i/,"").trim(),Cd(s)*e*e):/KB/i.test(s)?(s=s.replace(/KB$i/,"").trim(),Cd(s)*e):Cd(s)},Sr=t=>typeof t=="function",mT=t=>{let e=self,s=t.split("."),i=null;for(;i=s.shift();)if(e=e[i],!e)return null;return e},og={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},fT=t=>{const e={};return e.url=ts(t)?t:t.url||"",e.timeout=t.timeout?parseInt(t.timeout,10):0,e.headers=t.headers?t.headers:{},Vt(og,s=>{e[s]=gT(s,t[s],og[s],e.timeout,e.headers)}),e.process=t.process||ts(t)||t.url?e.process:null,e.remove=t.remove||null,delete e.headers,e},gT=(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(ts(e))return a.url=e,a;if(Object.assign(a,e),ts(a.headers)){const o=a.headers.split(/:(.+)/);a.headers={header:o[0],value:o[1]}}return a.withCredentials=NE(a.withCredentials),a},ET=t=>fT(t),bT=t=>t===null,Ie=t=>typeof t=="object"&&t!==null,IT=t=>Ie(t)&&ts(t.url)&&Ie(t.process)&&Ie(t.revert)&&Ie(t.restore)&&Ie(t.fetch),Up=t=>Ip(t)?"array":bT(t)?"null":Go(t)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(t)?"bytes":IT(t)?"api":typeof t,vT=t=>t.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'),wT={array:pT,boolean:NE,int:t=>Up(t)==="bytes"?ag(t):Cd(t),number:rg,float:rg,bytes:ag,string:t=>Sr(t)?t:vp(t),function:t=>mT(t),serverapi:ET,object:t=>{try{return JSON.parse(vT(t))}catch(e){return null}}},_T=(t,e)=>wT[e](t),DE=(t,e,s)=>{if(t===e)return t;let i=Up(t);if(i!==s){const n=_T(t,s);if(i=Up(n),n===null)throw`Trying to assign value with incorrect type to "${option}", allowed type: "${s}"`;t=n}return t},TT=(t,e)=>{let s=t;return{enumerable:!0,get:()=>s,set:i=>{s=DE(i,t,e)}}},xT=t=>{const e={};return Vt(t,s=>{const i=t[s];e[s]=TT(i[0],i[1])}),ar(e)},ST=t=>({items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:xT(t)}),wp=(t,e="-")=>t.split(/(?=[A-Z])/).map(s=>s.toLowerCase()).join(e),RT=(t,e)=>{const s={};return Vt(e,i=>{s[i]={get:()=>t.getState().options[i],set:n=>{t.dispatch(`SET_${wp(i,"_").toUpperCase()}`,{value:n})}}}),s},CT=t=>(e,s,i)=>{const n={};return Vt(t,a=>{const o=wp(a,"_").toUpperCase();n[`SET_${o}`]=c=>{try{i.options[a]=c.value}catch(d){}e(`DID_SET_${o}`,{value:i.options[a]})}}),n},OT=t=>e=>{const s={};return Vt(t,i=>{s[`GET_${wp(i,"_").toUpperCase()}`]=n=>e.options[i]}),s},Ys={API:1,DROP:2,BROWSE:3,PASTE:4,NONE:5},mf=()=>Math.random().toString(36).substring(2,11),ff=(t,e)=>t.splice(e,1),$T=(t,e)=>{e?t():document.hidden?Promise.resolve(1).then(t):setTimeout(t,0)},_p=()=>{const t=[],e=(i,n)=>{ff(t,t.findIndex(a=>a.event===i&&(a.cb===n||!n)))},s=(i,n,a)=>{t.filter(o=>o.event===i).map(o=>o.cb).forEach(o=>$T(()=>o(...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}},FE=(t,e,s)=>{Object.getOwnPropertyNames(t).filter(i=>!s.includes(i)).forEach(i=>Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i)))},LT=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],cs=t=>{const e={};return FE(t,e,LT),e},AT=t=>{t.forEach((e,s)=>{e.released&&ff(t,s)})},rt={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},pe={INPUT:1,LIMBO:2,LOCAL:3},jE=t=>/[^0-9]+/.exec(t),kE=()=>jE(1.1.toLocaleString())[0],yT=()=>{const t=kE(),e=1e3.toLocaleString(),s=1e3.toString();return e!==s?jE(e)[0]:t==="."?",":"."},z={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},gf=[],mi=(t,e,s)=>new Promise((i,n)=>{const a=gf.filter(c=>c.key===t).map(c=>c.cb);if(a.length===0){i(e);return}const o=a.shift();a.reduce((c,d)=>c.then(h=>d(h,s)),o(e,s)).then(c=>i(c)).catch(c=>n(c))}),ia=(t,e,s)=>gf.filter(i=>i.key===t).map(i=>i.cb(e,s)),MT=(t,e)=>gf.push({key:t,cb:e}),NT=t=>Object.assign(Ca,t),lh=()=>I({},Ca),PT=t=>{Vt(t,(e,s)=>{Ca[e]&&(Ca[e][0]=DE(s,Ca[e][0],Ca[e][1]))})},Ca={id:[null,z.STRING],name:["filepond",z.STRING],disabled:[!1,z.BOOLEAN],className:[null,z.STRING],required:[!1,z.BOOLEAN],captureMethod:[null,z.STRING],allowSyncAcceptAttribute:[!0,z.BOOLEAN],allowDrop:[!0,z.BOOLEAN],allowBrowse:[!0,z.BOOLEAN],allowPaste:[!0,z.BOOLEAN],allowMultiple:[!1,z.BOOLEAN],allowReplace:[!0,z.BOOLEAN],allowRevert:[!0,z.BOOLEAN],allowRemove:[!0,z.BOOLEAN],allowProcess:[!0,z.BOOLEAN],allowReorder:[!1,z.BOOLEAN],allowDirectoriesOnly:[!1,z.BOOLEAN],storeAsFile:[!1,z.BOOLEAN],forceRevert:[!1,z.BOOLEAN],maxFiles:[null,z.INT],checkValidity:[!1,z.BOOLEAN],itemInsertLocationFreedom:[!0,z.BOOLEAN],itemInsertLocation:["before",z.STRING],itemInsertInterval:[75,z.INT],dropOnPage:[!1,z.BOOLEAN],dropOnElement:[!0,z.BOOLEAN],dropValidation:[!1,z.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],z.ARRAY],instantUpload:[!0,z.BOOLEAN],maxParallelUploads:[2,z.INT],allowMinimumUploadDuration:[!0,z.BOOLEAN],chunkUploads:[!1,z.BOOLEAN],chunkForce:[!1,z.BOOLEAN],chunkSize:[5e6,z.INT],chunkRetryDelays:[[500,1e3,3e3],z.ARRAY],server:[null,z.SERVER_API],fileSizeBase:[1e3,z.INT],labelFileSizeBytes:["bytes",z.STRING],labelFileSizeKilobytes:["KB",z.STRING],labelFileSizeMegabytes:["MB",z.STRING],labelFileSizeGigabytes:["GB",z.STRING],labelDecimalSeparator:[kE(),z.STRING],labelThousandsSeparator:[yT(),z.STRING],labelIdle:['Drag & Drop your files or <span class="filepond--label-action">Browse</span>',z.STRING],labelInvalidField:["Field contains invalid files",z.STRING],labelFileWaitingForSize:["Waiting for size",z.STRING],labelFileSizeNotAvailable:["Size not available",z.STRING],labelFileCountSingular:["file in list",z.STRING],labelFileCountPlural:["files in list",z.STRING],labelFileLoading:["Loading",z.STRING],labelFileAdded:["Added",z.STRING],labelFileLoadError:["Error during load",z.STRING],labelFileRemoved:["Removed",z.STRING],labelFileRemoveError:["Error during remove",z.STRING],labelFileProcessing:["Uploading",z.STRING],labelFileProcessingComplete:["Upload complete",z.STRING],labelFileProcessingAborted:["Upload cancelled",z.STRING],labelFileProcessingError:["Error during upload",z.STRING],labelFileProcessingRevertError:["Error during revert",z.STRING],labelTapToCancel:["tap to cancel",z.STRING],labelTapToRetry:["tap to retry",z.STRING],labelTapToUndo:["tap to undo",z.STRING],labelButtonRemoveItem:["Remove",z.STRING],labelButtonAbortItemLoad:["Abort",z.STRING],labelButtonRetryItemLoad:["Retry",z.STRING],labelButtonAbortItemProcessing:["Cancel",z.STRING],labelButtonUndoItemProcessing:["Undo",z.STRING],labelButtonRetryItemProcessing:["Retry",z.STRING],labelButtonProcessItem:["Upload",z.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>',z.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>',z.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>',z.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>',z.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>',z.STRING],oninit:[null,z.FUNCTION],onwarning:[null,z.FUNCTION],onerror:[null,z.FUNCTION],onactivatefile:[null,z.FUNCTION],oninitfile:[null,z.FUNCTION],onaddfilestart:[null,z.FUNCTION],onaddfileprogress:[null,z.FUNCTION],onaddfile:[null,z.FUNCTION],onprocessfilestart:[null,z.FUNCTION],onprocessfileprogress:[null,z.FUNCTION],onprocessfileabort:[null,z.FUNCTION],onprocessfilerevert:[null,z.FUNCTION],onprocessfile:[null,z.FUNCTION],onprocessfiles:[null,z.FUNCTION],onremovefile:[null,z.FUNCTION],onpreparefile:[null,z.FUNCTION],onupdatefiles:[null,z.FUNCTION],onreorderfiles:[null,z.FUNCTION],beforeDropFile:[null,z.FUNCTION],beforeAddFile:[null,z.FUNCTION],beforeRemoveFile:[null,z.FUNCTION],beforePrepareFile:[null,z.FUNCTION],stylePanelLayout:[null,z.STRING],stylePanelAspectRatio:[null,z.STRING],styleItemPanelAspectRatio:[null,z.STRING],styleButtonRemoveItemPosition:["left",z.STRING],styleButtonProcessItemPosition:["right",z.STRING],styleLoadIndicatorPosition:["right",z.STRING],styleProgressIndicatorPosition:["right",z.STRING],styleButtonRemoveItemAlign:[!1,z.BOOLEAN],files:[[],z.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],z.ARRAY]},Rr=(t,e)=>xn(e)?t[0]||null:Go(e)?t[e]||null:(typeof e=="object"&&(e=e.id),t.find(s=>s.id===e)||null),GE=t=>{if(xn(t))return t;if(/:/.test(t)){const e=t.split(":");return e[1]/e[0]}return parseFloat(t)},fi=t=>t.filter(e=>!e.archived),BE={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4};let Ed=null;const DT=()=>{if(Ed===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,Ed=e.files.length===1}catch(t){Ed=!1}return Ed},FT=[rt.LOAD_ERROR,rt.PROCESSING_ERROR,rt.PROCESSING_REVERT_ERROR],jT=[rt.LOADING,rt.PROCESSING,rt.PROCESSING_QUEUED,rt.INIT],kT=[rt.PROCESSING_COMPLETE],GT=t=>FT.includes(t.status),BT=t=>jT.includes(t.status),UT=t=>kT.includes(t.status),lg=t=>Ie(t.options.server)&&(Ie(t.options.server.process)||Sr(t.options.server.process)),VT=t=>({GET_STATUS:()=>{const e=fi(t.items),{EMPTY:s,ERROR:i,BUSY:n,IDLE:a,READY:o}=BE;return e.length===0?s:e.some(GT)?i:e.some(BT)?n:e.some(UT)?o:a},GET_ITEM:e=>Rr(t.items,e),GET_ACTIVE_ITEM:e=>Rr(fi(t.items),e),GET_ACTIVE_ITEMS:()=>fi(t.items),GET_ITEMS:()=>t.items,GET_ITEM_NAME:e=>{const s=Rr(t.items,e);return s?s.filename:null},GET_ITEM_SIZE:e=>{const s=Rr(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:GE(t.options.stylePanelAspectRatio),GET_ITEM_PANEL_ASPECT_RATIO:()=>t.options.styleItemPanelAspectRatio,GET_ITEMS_BY_STATUS:e=>fi(t.items).filter(s=>s.status===e),GET_TOTAL_ITEMS:()=>fi(t.items).length,SHOULD_UPDATE_FILE_INPUT:()=>t.options.storeAsFile&&DT()&&!lg(t),IS_ASYNC:()=>lg(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})}),zT=t=>{const e=fi(t.items).length;if(!t.options.allowMultiple)return e===0;const s=t.options.maxFiles;return s===null||e<s},UE=(t,e,s)=>Math.max(Math.min(s,t),e),WT=(t,e,s)=>t.splice(e,0,s),HT=(t,e,s)=>xn(e)?null:typeof s=="undefined"?(t.push(e),e):(s=UE(s,0,t.length),WT(t,s,e),e),Vp=t=>/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(t),dd=t=>`${t}`.split("/").pop().split("?").shift(),Tp=t=>t.split(".").pop(),qT=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:""},zo=(t,e="")=>(e+t).slice(-e.length),VE=(t=new Date)=>`${t.getFullYear()}-${zo(t.getMonth()+1,"00")}-${zo(t.getDate(),"00")}_${zo(t.getHours(),"00")}-${zo(t.getMinutes(),"00")}-${zo(t.getSeconds(),"00")}`,Po=(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),ts(e)||(e=VE()),e&&i===null&&Tp(e)?n.name=e:(i=i||qT(n.type),n.name=e+(i?"."+i:"")),n},YT=()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,zE=(t,e)=>{const s=YT();if(s){const i=new s;return i.append(t),i.getBlob(e)}return new Blob([t],{type:e})},XT=(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 zE(s,e)},WE=t=>(/^data:(.+);/.exec(t)||[])[1]||null,ZT=t=>t.split(",")[1].replace(/\s/g,""),QT=t=>atob(ZT(t)),JT=t=>{const e=WE(t),s=QT(t);return XT(s,e)},KT=(t,e,s)=>Po(JT(t),e,null,s),tx=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},ex=t=>{if(/content-length:/i.test(t)){const e=t.match(/[0-9]+/)[0];return e?parseInt(e,10):null}return null},sx=t=>/x-content-transfer-id:/i.test(t)&&(t.split(":")[1]||"").trim()||null,Ef=t=>{const e={source:null,name:null,size:null},s=t.split(`
75 `);for(let i of s){const n=tx(i);if(n){e.name=n;continue}const a=ex(i);if(a){e.size=a;continue}const o=sx(i);if(o){e.source=o;continue}}return e},ix=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;o.fire("init",c),c instanceof File?o.fire("load",c):c instanceof Blob?o.fire("load",Po(c,c.name)):Vp(c)?o.fire("load",KT(c)):a(c)},a=c=>{if(!t){o.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=Po(d,d.name||dd(c))),o.fire("load",d instanceof Blob?d:d?d.body:null)},d=>{o.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,o.fire("progress",e.progress)},()=>{o.fire("abort")},d=>{const h=Ef(typeof d=="string"?d:d.headers);o.fire("meta",{size:e.size||h.size,filename:h.name,source:h.source})})},o=$(I({},_p()),{setSource:c=>e.source=c,getProgress:s,abort:i,load:n});return o},cg=t=>/GET|HEAD/.test(t),Jr=(t,e,s)=>{const i={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{n=!0,o.abort()}};let n=!1,a=!1;s=I({method:"POST",headers:{},withCredentials:!1},s),e=encodeURI(e),cg(s.method)&&t&&(e=`${e}${encodeURIComponent(typeof t=="string"?t:JSON.stringify(t))}`);const o=new XMLHttpRequest,c=cg(s.method)?o:o.upload;return c.onprogress=d=>{n||i.onprogress(d.lengthComputable,d.loaded,d.total)},o.onreadystatechange=()=>{o.readyState<2||o.readyState===4&&o.status===0||a||(a=!0,i.onheaders(o))},o.onload=()=>{o.status>=200&&o.status<300?i.onload(o):i.onerror(o)},o.onerror=()=>i.onerror(o),o.onabort=()=>{n=!0,i.onabort()},o.ontimeout=()=>i.ontimeout(o),o.open(s.method,e,!0),Go(s.timeout)&&(o.timeout=s.timeout),Object.keys(s.headers).forEach(d=>{const h=unescape(encodeURIComponent(s.headers[d]));o.setRequestHeader(d,h)}),s.responseType&&(o.responseType=s.responseType),s.withCredentials&&(o.withCredentials=!0),o.send(t),i},Ht=(t,e,s,i)=>({type:t,code:e,body:s,headers:i}),Kr=t=>e=>{t(Ht("error",0,"Timeout",e.getAllResponseHeaders()))},dg=t=>/\?/.test(t),ml=(...t)=>{let e="";return t.forEach(s=>{e+=dg(e)&&dg(s)?s.replace(/\?/,"&"):s}),e},Ap=(t="",e)=>{if(typeof e=="function")return e;if(!e||!ts(e.url))return null;const s=e.onload||(n=>n),i=e.onerror||(n=>null);return(n,a,o,c,d,h)=>{const p=Jr(n,ml(t,e.url),$(I({},e),{responseType:"blob"}));return p.onload=m=>{const f=m.getAllResponseHeaders(),b=Ef(f).name||dd(n);a(Ht("load",m.status,e.method==="HEAD"?null:Po(s(m.response),b),f))},p.onerror=m=>{o(Ht("error",m.status,i(m.response)||m.statusText,m.getAllResponseHeaders()))},p.onheaders=m=>{h(Ht("headers",m.status,null,m.getAllResponseHeaders()))},p.ontimeout=Kr(o),p.onprogress=c,p.onabort=d,p}},Os={QUEUED:0,COMPLETE:1,PROCESSING:2,ERROR:3,WAITING:4},nx=(t,e,s,i,n,a,o,c,d,h,p)=>{const m=[],{chunkTransferId:f,chunkServer:b,chunkSize:g,chunkRetryDelays:v}=p,w={serverId:f,aborted:!1},x=e.ondata||(P=>P),_=e.onload||((P,Y)=>Y==="HEAD"?P.getResponseHeader("Upload-Offset"):P.response),R=e.onerror||(P=>null),C=P=>{const Y=new FormData;Ie(n)&&Y.append(s,JSON.stringify(n));const j=typeof e.headers=="function"?e.headers(i,n):$(I({},e.headers),{"Upload-Length":i.size}),N=$(I({},e),{headers:j}),G=Jr(x(Y),ml(t,e.url),N);G.onload=U=>P(_(U,N.method)),G.onerror=U=>o(Ht("error",U.status,R(U.response)||U.statusText,U.getAllResponseHeaders())),G.ontimeout=Kr(o)},O=P=>{const Y=ml(t,b.url,w.serverId),N={headers:typeof e.headers=="function"?e.headers(w.serverId):I({},e.headers),method:"HEAD"},G=Jr(null,Y,N);G.onload=U=>P(_(U,N.method)),G.onerror=U=>o(Ht("error",U.status,R(U.response)||U.statusText,U.getAllResponseHeaders())),G.ontimeout=Kr(o)},y=Math.floor(i.size/g);for(let P=0;P<=y;P++){const Y=P*g,j=i.slice(Y,Y+g,"application/offset+octet-stream");m[P]={index:P,size:j.size,offset:Y,data:j,file:i,progress:0,retries:[...v],status:Os.QUEUED,error:null,request:null,timeout:null}}const D=()=>a(w.serverId),L=P=>P.status===Os.QUEUED||P.status===Os.ERROR,F=P=>{if(w.aborted)return;if(P=P||m.find(L),!P){m.every(V=>V.status===Os.COMPLETE)&&D();return}P.status=Os.PROCESSING,P.progress=null;const Y=b.ondata||(V=>V),j=b.onerror||(V=>null),N=b.onload||(()=>{}),G=ml(t,b.url,w.serverId),U=typeof b.headers=="function"?b.headers(P):$(I({},b.headers),{"Content-Type":"application/offset+octet-stream","Upload-Offset":P.offset,"Upload-Length":i.size,"Upload-Name":i.name}),q=P.request=Jr(Y(P.data),G,$(I({},b),{headers:U}));q.onload=V=>{N(V,P.index,m.length),P.status=Os.COMPLETE,P.request=null,k()},q.onprogress=(V,lt,ot)=>{P.progress=V?lt:null,B()},q.onerror=V=>{P.status=Os.ERROR,P.request=null,P.error=j(V.response)||V.statusText,H(P)||o(Ht("error",V.status,j(V.response)||V.statusText,V.getAllResponseHeaders()))},q.ontimeout=V=>{P.status=Os.ERROR,P.request=null,H(P)||Kr(o)(V)},q.onabort=()=>{P.status=Os.QUEUED,P.request=null,d()}},H=P=>P.retries.length===0?!1:(P.status=Os.WAITING,clearTimeout(P.timeout),P.timeout=setTimeout(()=>{F(P)},P.retries.shift()),!0),B=()=>{const P=m.reduce((j,N)=>j===null||N.progress===null?null:j+N.progress,0);if(P===null)return c(!1,0,0);const Y=m.reduce((j,N)=>j+N.size,0);c(!0,P,Y)},k=()=>{m.filter(Y=>Y.status===Os.PROCESSING).length>=1||F()},X=()=>{m.forEach(P=>{clearTimeout(P.timeout),P.request&&P.request.abort()})};return w.serverId?O(P=>{w.aborted||(m.filter(Y=>Y.offset<P).forEach(Y=>{Y.status=Os.COMPLETE,Y.progress=Y.size}),k())}):C(P=>{w.aborted||(h(P),w.serverId=P,k())}),{abort:()=>{w.aborted=!0,X()}}},rx=(t,e,s,i)=>(n,a,o,c,d,h,p)=>{if(!n)return;const m=i.chunkUploads,f=m&&n.size>i.chunkSize,b=m&&(f||i.chunkForce);if(n instanceof Blob&&b)return nx(t,e,s,n,a,o,c,d,h,p,i);const g=e.ondata||(O=>O),v=e.onload||(O=>O),w=e.onerror||(O=>null),x=typeof e.headers=="function"?e.headers(n,a)||{}:I({},e.headers),_=$(I({},e),{headers:x});var R=new FormData;Ie(a)&&R.append(s,JSON.stringify(a)),(n instanceof Blob?[{name:null,file:n}]:n).forEach(O=>{R.append(s,O.file,O.name===null?O.file.name:`${O.name}${O.file.name}`)});const C=Jr(g(R),ml(t,e.url),_);return C.onload=O=>{o(Ht("load",O.status,v(O.response),O.getAllResponseHeaders()))},C.onerror=O=>{c(Ht("error",O.status,w(O.response)||O.statusText,O.getAllResponseHeaders()))},C.ontimeout=Kr(c),C.onprogress=d,C.onabort=h,C},ax=(t="",e,s,i)=>typeof e=="function"?(...n)=>e(s,...n,i):!e||!ts(e.url)?null:rx(t,e,s,i),Wo=(t="",e)=>{if(typeof e=="function")return e;if(!e||!ts(e.url))return(n,a)=>a();const s=e.onload||(n=>n),i=e.onerror||(n=>null);return(n,a,o)=>{const c=Jr(n,t+e.url,e);return c.onload=d=>{a(Ht("load",d.status,s(d.response),d.getAllResponseHeaders()))},c.onerror=d=>{o(Ht("error",d.status,i(d.response)||d.statusText,d.getAllResponseHeaders()))},c.ontimeout=Kr(o),c}},HE=(t=0,e=1)=>t+Math.random()*(e-t),ox=(t,e=1e3,s=0,i=25,n=250)=>{let a=null;const o=Date.now(),c=()=>{let d=Date.now()-o,h=HE(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)}}},lx=(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,m)=>{const f=()=>{s.duration===0||s.progress===null||h.fire("progress",h.getProgress())},b=()=>{s.complete=!0,h.fire("load-perceived",s.response.body)};h.fire("start"),s.timestamp=Date.now(),s.perceivedPerformanceUpdater=ox(g=>{s.perceivedProgress=g,s.perceivedDuration=Date.now()-s.timestamp,f(),s.response&&s.perceivedProgress===1&&!s.complete&&b()},i?HE(750,1500):0),s.request=t(p,m,g=>{s.response=Ie(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)&&b()},g=>{s.perceivedPerformanceUpdater.clear(),h.fire("error",Ie(g)?g:{type:"error",code:0,body:`${g}`})},(g,v,w)=>{s.duration=Date.now()-s.timestamp,s.progress=g?v/w:null,f()},()=>{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)},o=()=>{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=$(I({},_p()),{process:n,abort:a,getProgress:c,getDuration:d,reset:o});return h},qE=t=>t.substring(0,t.lastIndexOf("."))||t,cx=t=>{let e=[t.name,t.size,t.type];return t instanceof Blob||Vp(t)?e[0]=t.name||VE():Vp(t)?(e[1]=t.length,e[2]=WE(t)):ts(t)&&(e[0]=dd(t),e[1]=0,e[2]="application/octet-stream"),{name:e[0],size:e[1],type:e[2]}},ta=t=>!!(t instanceof File||t instanceof Blob&&t.name),YE=t=>{if(!Ie(t))return t;const e=Ip(t)?[]:{};for(const s in t){if(!t.hasOwnProperty(s))continue;const i=t[s];e[s]=i&&Ie(i)?YE(i):i}return e},dx=(t=null,e=null,s=null)=>{const i=mf(),n={archived:!1,frozen:!1,released:!1,source:null,file:s,serverFileReference:e,transferId:null,processingAborted:!1,status:e?rt.PROCESSING_COMPLETE:rt.INIT,activeLoader:null,activeProcessor:null};let a=null;const o={},c=L=>n.status=L,d=(L,...F)=>{n.released||n.frozen||y.fire(L,...F)},h=()=>Tp(n.file.name),p=()=>n.file.type,m=()=>n.file.size,f=()=>n.file,b=(L,F,H)=>{if(n.source=L,y.fireSync("init"),n.file){y.fireSync("load-skip");return}n.file=cx(L),F.on("init",()=>{d("load-init")}),F.on("meta",B=>{n.file.size=B.size,n.file.filename=B.filename,B.source&&(t=pe.LIMBO,n.serverFileReference=B.source,n.status=rt.PROCESSING_COMPLETE),d("load-meta")}),F.on("progress",B=>{c(rt.LOADING),d("load-progress",B)}),F.on("error",B=>{c(rt.LOAD_ERROR),d("load-request-error",B)}),F.on("abort",()=>{c(rt.INIT),d("load-abort")}),F.on("load",B=>{n.activeLoader=null;const k=P=>{n.file=ta(P)?P:n.file,t===pe.LIMBO&&n.serverFileReference?c(rt.PROCESSING_COMPLETE):c(rt.IDLE),d("load")},X=P=>{n.file=B,d("load-meta"),c(rt.LOAD_ERROR),d("load-file-error",P)};if(n.serverFileReference){k(B);return}H(B,k,X)}),F.setSource(L),n.activeLoader=F,F.load()},g=()=>{n.activeLoader&&n.activeLoader.load()},v=()=>{if(n.activeLoader){n.activeLoader.abort();return}c(rt.INIT),d("load-abort")},w=(L,F)=>{if(n.processingAborted){n.processingAborted=!1;return}if(c(rt.PROCESSING),a=null,!(n.file instanceof Blob)){y.on("load",()=>{w(L,F)});return}L.on("load",k=>{n.transferId=null,n.serverFileReference=k}),L.on("transfer",k=>{n.transferId=k}),L.on("load-perceived",k=>{n.activeProcessor=null,n.transferId=null,n.serverFileReference=k,c(rt.PROCESSING_COMPLETE),d("process-complete",k)}),L.on("start",()=>{d("process-start")}),L.on("error",k=>{n.activeProcessor=null,c(rt.PROCESSING_ERROR),d("process-error",k)}),L.on("abort",k=>{n.activeProcessor=null,n.serverFileReference=k,c(rt.IDLE),d("process-abort"),a&&a()}),L.on("progress",k=>{d("process-progress",k)});const H=k=>{n.archived||L.process(k,I({},o))},B=console.error;F(n.file,H,B),n.activeProcessor=L},x=()=>{n.processingAborted=!1,c(rt.PROCESSING_QUEUED)},_=()=>new Promise(L=>{if(!n.activeProcessor){n.processingAborted=!0,c(rt.IDLE),d("process-abort"),L();return}a=()=>{L()},n.activeProcessor.abort()}),R=(L,F)=>new Promise((H,B)=>{const k=n.serverFileReference!==null?n.serverFileReference:n.transferId;if(k===null){H();return}L(k,()=>{n.serverFileReference=null,n.transferId=null,H()},X=>{if(!F){H();return}c(rt.PROCESSING_REVERT_ERROR),d("process-revert-error"),B(X)}),c(rt.IDLE),d("process-revert")}),C=(L,F,H)=>{const B=L.split("."),k=B[0],X=B.pop();let P=o;B.forEach(Y=>P=P[Y]),JSON.stringify(P[X])!==JSON.stringify(F)&&(P[X]=F,d("metadata-update",{key:k,value:o[k],silent:H}))},y=$(I({id:{get:()=>i},origin:{get:()=>t,set:L=>t=L},serverId:{get:()=>n.serverFileReference},transferId:{get:()=>n.transferId},status:{get:()=>n.status},filename:{get:()=>n.file.name},filenameWithoutExtension:{get:()=>qE(n.file.name)},fileExtension:{get:h},fileType:{get:p},fileSize:{get:m},file:{get:f},relativePath:{get:()=>n.file._relativePath},source:{get:()=>n.source},getMetadata:L=>YE(L?o[L]:o),setMetadata:(L,F,H)=>{if(Ie(L)){const B=L;return Object.keys(B).forEach(k=>{C(k,B[k],F)}),L}return C(L,F,H),F},extend:(L,F)=>D[L]=F,abortLoad:v,retryLoad:g,requestProcessing:x,abortProcessing:_,load:b,process:w,revert:R},_p()),{freeze:()=>n.frozen=!0,release:()=>n.released=!0,released:{get:()=>n.released},archive:()=>n.archived=!0,archived:{get:()=>n.archived},setFile:L=>n.file=L}),D=ar(y);return D},hx=(t,e)=>xn(e)?0:ts(e)?t.findIndex(s=>s.id===e):-1,hg=(t,e)=>{const s=hx(t,e);if(!(s<0))return t[s]||null},ug=(t,e,s,i,n,a)=>{const o=Jr(null,t,{method:"GET",responseType:"blob"});return o.onload=c=>{const d=c.getAllResponseHeaders(),h=Ef(d).name||dd(t);e(Ht("load",c.status,Po(c.response,h),d))},o.onerror=c=>{s(Ht("error",c.status,c.statusText,c.getAllResponseHeaders()))},o.onheaders=c=>{a(Ht("headers",c.status,null,c.getAllResponseHeaders()))},o.ontimeout=Kr(s),o.onprogress=i,o.onabort=n,o},pg=t=>(t.indexOf("//")===0&&(t=location.protocol+t),t.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]),ux=t=>(t.indexOf(":")>-1||t.indexOf("//")>-1)&&pg(location.href)!==pg(t),bd=t=>(...e)=>Sr(t)?t(...e):t,px=t=>!ta(t.file),yp=(t,e)=>{clearTimeout(e.listUpdateTimeout),e.listUpdateTimeout=setTimeout(()=>{t("DID_UPDATE_ITEMS",{items:fi(e.items)})},0)},mg=(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)}),Mp=(t,e)=>{t.items.sort((s,i)=>e(cs(s),cs(i)))},$s=(t,e)=>(o={})=>{var c=o,{query:s,success:i=()=>{},failure:n=()=>{}}=c,a=kf(c,["query","success","failure"]);const d=Rr(t.items,s);if(!d){n({error:Ht("error",0,"Item not found"),file:null});return}e(d,i,n,a||{})},mx=(t,e,s)=>({ABORT_ALL:()=>{fi(s.items).forEach(i=>{i.freeze(),i.abortLoad(),i.abortProcessing()})},DID_SET_FILES:({value:i=[]})=>{const n=i.map(o=>({source:o.source?o.source:o,options:o.options}));let a=fi(s.items);a.forEach(o=>{n.find(c=>c.source===o.source||c.source===o.file)||t("REMOVE_ITEM",{query:o,remove:!1})}),a=fi(s.items),n.forEach((o,c)=>{a.find(d=>d.source===o.source||d.file===o.source)||t("ADD_ITEM",$(I({},o),{interactionMethod:Ys.NONE,index:c}))})},DID_UPDATE_ITEM_METADATA:({id:i,action:n,change:a})=>{a.silent||(clearTimeout(s.itemUpdateTimeout),s.itemUpdateTimeout=setTimeout(()=>{const o=hg(s.items,i);if(!e("IS_ASYNC")){mi("SHOULD_PREPARE_OUTPUT",!1,{item:o,query:e,action:n,change:a}).then(p=>{const m=e("GET_BEFORE_PREPARE_FILE");m&&(p=m(o,p)),p&&t("REQUEST_PREPARE_OUTPUT",{query:i,item:o,success:f=>{t("DID_PREPARE_OUTPUT",{id:i,file:f})}},!0)});return}o.origin===pe.LOCAL&&t("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.source});const c=()=>{setTimeout(()=>{t("REQUEST_ITEM_PROCESSING",{query:i})},32)},d=p=>{o.revert(Wo(s.options.server.url,s.options.server.revert),e("GET_FORCE_REVERT")).then(p?c:()=>{}).catch(()=>{})},h=p=>{o.abortProcessing().then(p?c:()=>{})};if(o.status===rt.PROCESSING_COMPLETE)return d(s.options.instantUpload);if(o.status===rt.PROCESSING)return h(s.options.instantUpload);s.options.instantUpload&&c()},0))},MOVE_ITEM:({query:i,index:n})=>{const a=Rr(s.items,i);if(!a)return;const o=s.items.indexOf(a);n=UE(n,0,s.items.length-1),o!==n&&s.items.splice(n,0,s.items.splice(o,1)[0])},SORT:({compare:i})=>{Mp(s,i),t("DID_SORT_ITEMS",{items:e("GET_ACTIVE_ITEMS")})},ADD_ITEMS:({items:i,index:n,interactionMethod:a,success:o=()=>{},failure:c=()=>{}})=>{let d=n;if(n===-1||typeof n=="undefined"){const b=e("GET_ITEM_INSERT_LOCATION"),g=e("GET_TOTAL_ITEMS");d=b==="before"?0:g}const h=e("GET_IGNORED_FILES"),p=b=>ta(b)?!h.includes(b.name.toLowerCase()):!xn(b),f=i.filter(p).map(b=>new Promise((g,v)=>{t("ADD_ITEM",{interactionMethod:a,source:b.source||b,success:g,failure:v,index:d++,options:b.options||{}})}));Promise.all(f).then(o).catch(c)},ADD_ITEM:({source:i,index:n=-1,interactionMethod:a,success:o=()=>{},failure:c=()=>{},options:d={}})=>{if(xn(i)){c({error:Ht("error",0,"No source"),file:null});return}if(ta(i)&&s.options.ignoredFiles.includes(i.name.toLowerCase()))return;if(!zT(s)){if(s.options.allowMultiple||!s.options.allowMultiple&&!s.options.allowReplace){const _=Ht("warning",0,"Max files");t("DID_THROW_MAX_FILES",{source:i,error:_}),c({error:_,file:null});return}const x=fi(s.items)[0];if(x.status===rt.PROCESSING_COMPLETE||x.status===rt.PROCESSING_REVERT_ERROR){const _=e("GET_FORCE_REVERT");if(x.revert(Wo(s.options.server.url,s.options.server.revert),_).then(()=>{_&&t("ADD_ITEM",{source:i,index:n,interactionMethod:a,success:o,failure:c,options:d})}).catch(()=>{}),_)return}t("REMOVE_ITEM",{query:x.id})}const h=d.type==="local"?pe.LOCAL:d.type==="limbo"?pe.LIMBO:pe.INPUT,p=dx(h,h===pe.INPUT?null:i,d.file);Object.keys(d.metadata||{}).forEach(x=>{p.setMetadata(x,d.metadata[x])}),ia("DID_CREATE_ITEM",p,{query:e,dispatch:t});const m=e("GET_ITEM_INSERT_LOCATION");s.options.itemInsertLocationFreedom||(n=m==="before"?-1:s.items.length),HT(s.items,p,n),Sr(m)&&i&&Mp(s,m);const f=p.id;p.on("init",()=>{t("DID_INIT_ITEM",{id:f})}),p.on("load-init",()=>{t("DID_START_ITEM_LOAD",{id:f})}),p.on("load-meta",()=>{t("DID_UPDATE_ITEM_META",{id:f})}),p.on("load-progress",x=>{t("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:f,progress:x})}),p.on("load-request-error",x=>{const _=bd(s.options.labelFileLoadError)(x);if(x.code>=400&&x.code<500){t("DID_THROW_ITEM_INVALID",{id:f,error:x,status:{main:_,sub:`${x.code} (${x.body})`}}),c({error:x,file:cs(p)});return}t("DID_THROW_ITEM_LOAD_ERROR",{id:f,error:x,status:{main:_,sub:s.options.labelTapToRetry}})}),p.on("load-file-error",x=>{t("DID_THROW_ITEM_INVALID",{id:f,error:x.status,status:x.status}),c({error:x.status,file:cs(p)})}),p.on("load-abort",()=>{t("REMOVE_ITEM",{query:f})}),p.on("load-skip",()=>{p.on("metadata-update",x=>{ta(p.file)&&t("DID_UPDATE_ITEM_METADATA",{id:f,change:x})}),t("COMPLETE_LOAD_ITEM",{query:f,item:p,data:{source:i,success:o}})}),p.on("load",()=>{const x=_=>{if(!_){t("REMOVE_ITEM",{query:f});return}p.on("metadata-update",R=>{t("DID_UPDATE_ITEM_METADATA",{id:f,change:R})}),mi("SHOULD_PREPARE_OUTPUT",!1,{item:p,query:e}).then(R=>{const C=e("GET_BEFORE_PREPARE_FILE");C&&(R=C(p,R));const O=()=>{t("COMPLETE_LOAD_ITEM",{query:f,item:p,data:{source:i,success:o}}),yp(t,s)};if(R){t("REQUEST_PREPARE_OUTPUT",{query:f,item:p,success:y=>{t("DID_PREPARE_OUTPUT",{id:f,file:y}),O()}},!0);return}O()})};mi("DID_LOAD_ITEM",p,{query:e,dispatch:t}).then(()=>{mg(e("GET_BEFORE_ADD_FILE"),cs(p)).then(x)}).catch(_=>{if(!_||!_.error||!_.status)return x(!1);t("DID_THROW_ITEM_INVALID",{id:f,error:_.error,status:_.status})})}),p.on("process-start",()=>{t("DID_START_ITEM_PROCESSING",{id:f})}),p.on("process-progress",x=>{t("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:f,progress:x})}),p.on("process-error",x=>{t("DID_THROW_ITEM_PROCESSING_ERROR",{id:f,error:x,status:{main:bd(s.options.labelFileProcessingError)(x),sub:s.options.labelTapToRetry}})}),p.on("process-revert-error",x=>{t("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:f,error:x,status:{main:bd(s.options.labelFileProcessingRevertError)(x),sub:s.options.labelTapToRetry}})}),p.on("process-complete",x=>{t("DID_COMPLETE_ITEM_PROCESSING",{id:f,error:null,serverFileReference:x}),t("DID_DEFINE_VALUE",{id:f,value:x})}),p.on("process-abort",()=>{t("DID_ABORT_ITEM_PROCESSING",{id:f})}),p.on("process-revert",()=>{t("DID_REVERT_ITEM_PROCESSING",{id:f}),t("DID_DEFINE_VALUE",{id:f,value:null})}),t("DID_ADD_ITEM",{id:f,index:n,interactionMethod:a}),yp(t,s);const{url:b,load:g,restore:v,fetch:w}=s.options.server||{};p.load(i,ix(h===pe.INPUT?ts(i)&&ux(i)&&w?Ap(b,w):ug:h===pe.LIMBO?Ap(b,v):Ap(b,g)),(x,_,R)=>{mi("LOAD_FILE",x,{query:e}).then(_).catch(R)})},REQUEST_PREPARE_OUTPUT:({item:i,success:n,failure:a=()=>{}})=>{const o={error:Ht("error",0,"Item not found"),file:null};if(i.archived)return a(o);mi("PREPARE_OUTPUT",i.file,{query:e,item:i}).then(c=>{mi("COMPLETE_PREPARE_OUTPUT",c,{query:e,item:i}).then(d=>{if(i.archived)return a(o);n(d)})})},COMPLETE_LOAD_ITEM:({item:i,data:n})=>{const{success:a,source:o}=n,c=e("GET_ITEM_INSERT_LOCATION");if(Sr(c)&&o&&Mp(s,c),t("DID_LOAD_ITEM",{id:i.id,error:null,serverFileReference:i.origin===pe.INPUT?null:o}),a(cs(i)),i.origin===pe.LOCAL){t("DID_LOAD_LOCAL_ITEM",{id:i.id});return}if(i.origin===pe.LIMBO){t("DID_COMPLETE_ITEM_PROCESSING",{id:i.id,error:null,serverFileReference:o}),t("DID_DEFINE_VALUE",{id:i.id,value:i.serverId||o});return}e("IS_ASYNC")&&s.options.instantUpload&&t("REQUEST_ITEM_PROCESSING",{query:i.id})},RETRY_ITEM_LOAD:$s(s,i=>{i.retryLoad()}),REQUEST_ITEM_PREPARE:$s(s,(i,n,a)=>{t("REQUEST_PREPARE_OUTPUT",{query:i.id,item:i,success:o=>{t("DID_PREPARE_OUTPUT",{id:i.id,file:o}),n({file:i,output:o})},failure:a},!0)}),REQUEST_ITEM_PROCESSING:$s(s,(i,n,a)=>{if(!(i.status===rt.IDLE||i.status===rt.PROCESSING_ERROR)){const c=()=>t("REQUEST_ITEM_PROCESSING",{query:i,success:n,failure:a}),d=()=>document.hidden?c():setTimeout(c,32);i.status===rt.PROCESSING_COMPLETE||i.status===rt.PROCESSING_REVERT_ERROR?i.revert(Wo(s.options.server.url,s.options.server.revert),e("GET_FORCE_REVERT")).then(d).catch(()=>{}):i.status===rt.PROCESSING&&i.abortProcessing().then(d);return}i.status!==rt.PROCESSING_QUEUED&&(i.requestProcessing(),t("DID_REQUEST_ITEM_PROCESSING",{id:i.id}),t("PROCESS_ITEM",{query:i,success:n,failure:a},!0))}),PROCESS_ITEM:$s(s,(i,n,a)=>{const o=e("GET_MAX_PARALLEL_UPLOADS");if(e("GET_ITEMS_BY_STATUS",rt.PROCESSING).length===o){s.processingQueue.push({id:i.id,success:n,failure:a});return}if(i.status===rt.PROCESSING)return;const d=()=>{const p=s.processingQueue.shift();if(!p)return;const{id:m,success:f,failure:b}=p,g=Rr(s.items,m);if(!g||g.archived){d();return}t("PROCESS_ITEM",{query:m,success:f,failure:b},!0)};i.onOnce("process-complete",()=>{n(cs(i)),d();const p=s.options.server;if(s.options.instantUpload&&i.origin===pe.LOCAL&&Sr(p.remove)){const b=()=>{};i.origin=pe.LIMBO,s.options.server.remove(i.source,b,b)}e("GET_ITEMS_BY_STATUS",rt.PROCESSING_COMPLETE).length===s.items.length&&t("DID_COMPLETE_ITEM_PROCESSING_ALL")}),i.onOnce("process-error",p=>{a({error:p,file:cs(i)}),d()});const h=s.options;i.process(lx(ax(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,m,f)=>{mi("PREPARE_OUTPUT",p,{query:e,item:i}).then(b=>{t("DID_PREPARE_OUTPUT",{id:i.id,file:b}),m(b)}).catch(f)})}),RETRY_ITEM_PROCESSING:$s(s,i=>{t("REQUEST_ITEM_PROCESSING",{query:i})}),REQUEST_REMOVE_ITEM:$s(s,i=>{mg(e("GET_BEFORE_REMOVE_FILE"),cs(i)).then(n=>{n&&t("REMOVE_ITEM",{query:i})})}),RELEASE_ITEM:$s(s,i=>{i.release()}),REMOVE_ITEM:$s(s,(i,n,a,o)=>{const c=()=>{const h=i.id;hg(s.items,h).archive(),t("DID_REMOVE_ITEM",{error:null,id:h,item:i}),yp(t,s),n(cs(i))},d=s.options.server;i.origin===pe.LOCAL&&d&&Sr(d.remove)&&o.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:Ht("error",0,h,null),status:{main:bd(s.options.labelFileRemoveError)(h),sub:s.options.labelTapToRetry}})})):((o.revert&&i.origin!==pe.LOCAL&&i.serverId!==null||s.options.chunkUploads&&i.file.size>s.options.chunkSize||s.options.chunkUploads&&s.options.chunkForce)&&i.revert(Wo(s.options.server.url,s.options.server.revert),e("GET_FORCE_REVERT")),c())}),ABORT_ITEM_LOAD:$s(s,i=>{i.abortLoad()}),ABORT_ITEM_PROCESSING:$s(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:$s(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 o=a(cs(i));if(o==null)return n(!0);if(typeof o=="boolean")return n(o);typeof o.then=="function"&&o.then(n)}),REVERT_ITEM_PROCESSING:$s(s,i=>{i.revert(Wo(s.options.server.url,s.options.server.revert),e("GET_FORCE_REVERT")).then(()=>{(s.options.instantUpload||px(i))&&t("REMOVE_ITEM",{query:i.id})}).catch(()=>{})}),SET_OPTIONS:({options:i})=>{const n=Object.keys(i),a=fx.filter(c=>n.includes(c));[...a,...Object.keys(i).filter(c=>!a.includes(c))].forEach(c=>{t(`SET_${wp(c,"_").toUpperCase()}`,{value:i[c]})})}}),fx=["server"],bf=t=>t,Sn=t=>document.createElement(t),qt=(t,e)=>{let s=t.childNodes[0];s?e!==s.nodeValue&&(s.nodeValue=e):(s=document.createTextNode(e),t.appendChild(s))},fg=(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)}},gx=(t,e,s,i,n,a)=>{const o=fg(t,e,s,n),c=fg(t,e,s,i);return["M",o.x,o.y,"A",s,s,0,a,0,c.x,c.y].join(" ")},Ex=(t,e,s,i,n)=>{let a=1;return n>i&&n-i<=.5&&(a=0),i>n&&i-n>=.5&&(a=0),gx(t,e,s,Math.min(.9999,i)*360,Math.min(.9999,n)*360,a)},bx=({root:t,props:e})=>{e.spin=!1,e.progress=0,e.opacity=0;const s=oh("svg");t.ref.path=oh("path",{"stroke-width":2,"stroke-linecap":"round"}),s.appendChild(t.ref.path),t.ref.svg=s,t.appendChild(s)},Ix=({root:t,props:e})=>{if(e.opacity===0)return;e.align&&(t.element.dataset.align=e.align);const s=parseInt(me(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 o=Ex(i,i,i-s,n,a);me(t.ref.path,"d",o),me(t.ref.path,"stroke-opacity",e.spin||e.progress>0?1:0)},gg=te({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:bx,write:Ix,mixins:{apis:["progress","spin","align"],styles:["opacity"],animations:{opacity:{type:"tween",duration:500},progress:{type:"spring",stiffness:.95,damping:.65,mass:10}}}}),vx=({root:t,props:e})=>{t.element.innerHTML=(e.icon||"")+`<span>${e.label}</span>`,e.isDisabled=!1},wx=({root:t,props:e})=>{const{isDisabled:s}=e,i=t.query("GET_DISABLED")||e.opacity===0;i&&!s?(e.isDisabled=!0,me(t.element,"disabled","disabled")):!i&&s&&(e.isDisabled=!1,t.element.removeAttribute("disabled"))},XE=te({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:vx,write:wx}),ZE=(t,e=".",s=1e3,i={})=>{const{labelBytes:n="bytes",labelKilobytes:a="KB",labelMegabytes:o="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?`${Eg(t/h,1,e)} ${o}`:`${Eg(t/p,2,e)} ${c}`},Eg=(t,e,s)=>t.toFixed(e).split(".").filter(i=>i!=="0").join(s),_x=({root:t,props:e})=>{const s=Sn("span");s.className="filepond--file-info-main",me(s,"aria-hidden","true"),t.appendChild(s),t.ref.fileName=s;const i=Sn("span");i.className="filepond--file-info-sub",t.appendChild(i),t.ref.fileSize=i,qt(i,t.query("GET_LABEL_FILE_WAITING_FOR_SIZE")),qt(s,bf(t.query("GET_ITEM_NAME",e.id)))},zp=({root:t,props:e})=>{qt(t.ref.fileSize,ZE(t.query("GET_ITEM_SIZE",e.id),".",t.query("GET_FILE_SIZE_BASE"),t.query("GET_FILE_SIZE_LABELS",t.query))),qt(t.ref.fileName,bf(t.query("GET_ITEM_NAME",e.id)))},bg=({root:t,props:e})=>{if(Go(t.query("GET_ITEM_SIZE",e.id))){zp({root:t,props:e});return}qt(t.ref.fileSize,t.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"))},Tx=te({name:"file-info",ignoreRect:!0,ignoreRectUpdate:!0,write:es({DID_LOAD_ITEM:zp,DID_UPDATE_ITEM_META:zp,DID_THROW_ITEM_LOAD_ERROR:bg,DID_THROW_ITEM_INVALID:bg}),didCreateView:t=>{ia("CREATE_VIEW",$(I({},t),{view:t}))},create:_x,mixins:{styles:["translateX","translateY"],animations:{translateX:"spring",translateY:"spring"}}}),QE=t=>Math.round(t*100),xx=({root:t})=>{const e=Sn("span");e.className="filepond--file-status-main",t.appendChild(e),t.ref.main=e;const s=Sn("span");s.className="filepond--file-status-sub",t.appendChild(s),t.ref.sub=s,JE({root:t,action:{progress:null}})},JE=({root:t,action:e})=>{const s=e.progress===null?t.query("GET_LABEL_FILE_LOADING"):`${t.query("GET_LABEL_FILE_LOADING")} ${QE(e.progress)}%`;qt(t.ref.main,s),qt(t.ref.sub,t.query("GET_LABEL_TAP_TO_CANCEL"))},Sx=({root:t,action:e})=>{const s=e.progress===null?t.query("GET_LABEL_FILE_PROCESSING"):`${t.query("GET_LABEL_FILE_PROCESSING")} ${QE(e.progress)}%`;qt(t.ref.main,s),qt(t.ref.sub,t.query("GET_LABEL_TAP_TO_CANCEL"))},Rx=({root:t})=>{qt(t.ref.main,t.query("GET_LABEL_FILE_PROCESSING")),qt(t.ref.sub,t.query("GET_LABEL_TAP_TO_CANCEL"))},Cx=({root:t})=>{qt(t.ref.main,t.query("GET_LABEL_FILE_PROCESSING_ABORTED")),qt(t.ref.sub,t.query("GET_LABEL_TAP_TO_RETRY"))},Ox=({root:t})=>{qt(t.ref.main,t.query("GET_LABEL_FILE_PROCESSING_COMPLETE")),qt(t.ref.sub,t.query("GET_LABEL_TAP_TO_UNDO"))},Ig=({root:t})=>{qt(t.ref.main,""),qt(t.ref.sub,"")},Ho=({root:t,action:e})=>{qt(t.ref.main,e.status.main),qt(t.ref.sub,e.status.sub)},$x=te({name:"file-status",ignoreRect:!0,ignoreRectUpdate:!0,write:es({DID_LOAD_ITEM:Ig,DID_REVERT_ITEM_PROCESSING:Ig,DID_REQUEST_ITEM_PROCESSING:Rx,DID_ABORT_ITEM_PROCESSING:Cx,DID_COMPLETE_ITEM_PROCESSING:Ox,DID_UPDATE_ITEM_PROCESS_PROGRESS:Sx,DID_UPDATE_ITEM_LOAD_PROGRESS:JE,DID_THROW_ITEM_LOAD_ERROR:Ho,DID_THROW_ITEM_INVALID:Ho,DID_THROW_ITEM_PROCESSING_ERROR:Ho,DID_THROW_ITEM_PROCESSING_REVERT_ERROR:Ho,DID_THROW_ITEM_REMOVE_ERROR:Ho}),didCreateView:t=>{ia("CREATE_VIEW",$(I({},t),{view:t}))},create:xx,mixins:{styles:["translateX","translateY","opacity"],animations:{opacity:{type:"tween",duration:250},translateX:"spring",translateY:"spring"}}}),Wp={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"}},Hp=[];Vt(Wp,t=>{Hp.push(t)});const fs=t=>{if(qp(t)==="right")return 0;const e=t.ref.buttonRemoveItem.rect.element;return e.hidden?null:e.width+e.left},Lx=t=>t.ref.buttonAbortItemLoad.rect.element.width,Id=t=>Math.floor(t.ref.buttonRemoveItem.rect.element.height/4),Ax=t=>Math.floor(t.ref.buttonRemoveItem.rect.element.left/2),yx=t=>t.query("GET_STYLE_LOAD_INDICATOR_POSITION"),Mx=t=>t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION"),qp=t=>t.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"),Nx={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:yx},processProgressIndicator:{opacity:0,align:Mx},processingCompleteIndicator:{opacity:0,scaleX:.75,scaleY:.75},info:{translateX:0,translateY:0,opacity:0},status:{translateX:0,translateY:0,opacity:0}},vg={buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:fs},status:{translateX:fs}},Np={buttonAbortItemProcessing:{opacity:1},processProgressIndicator:{opacity:1},status:{opacity:1}},Oa={DID_THROW_ITEM_INVALID:{buttonRemoveItem:{opacity:1},info:{translateX:fs},status:{translateX:fs,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:fs},status:{opacity:1}},DID_START_ITEM_REMOVE:{processProgressIndicator:{opacity:1,align:qp},info:{translateX:fs},status:{opacity:0}},DID_THROW_ITEM_REMOVE_ERROR:{processProgressIndicator:{opacity:0,align:qp},buttonRemoveItem:{opacity:1},info:{translateX:fs},status:{opacity:1,translateX:fs}},DID_LOAD_ITEM:vg,DID_LOAD_LOCAL_ITEM:{buttonRemoveItem:{opacity:1},info:{translateX:fs},status:{translateX:fs}},DID_START_ITEM_PROCESSING:Np,DID_REQUEST_ITEM_PROCESSING:Np,DID_UPDATE_ITEM_PROCESS_PROGRESS:Np,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:fs}},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:fs},status:{opacity:1}},DID_REVERT_ITEM_PROCESSING:vg},Px=te({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}}}}),Dx=({root:t,props:e})=>{const s=Object.keys(Wp).reduce((g,v)=>(g[v]=I({},Wp[v]),g),{}),{id:i}=e,n=t.query("GET_ALLOW_REVERT"),a=t.query("GET_ALLOW_REMOVE"),o=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?o&&!n?p=g=>!/RevertItemProcessing/.test(g):!o&&n?p=g=>!/ProcessItem|RetryItemProcessing|AbortItemProcessing/.test(g):!o&&!n&&(p=g=>!/Process/.test(g)):p=g=>!/Process/.test(g);const m=p?Hp.filter(p):Hp.concat();if(c&&n&&(s.RevertItemProcessing.label="GET_LABEL_BUTTON_REMOVE_ITEM",s.RevertItemProcessing.icon="GET_ICON_REMOVE"),d&&!n){const g=Oa.DID_COMPLETE_ITEM_PROCESSING;g.info.translateX=Ax,g.info.translateY=Id,g.status.translateY=Id,g.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}if(d&&!o&&(["DID_START_ITEM_PROCESSING","DID_REQUEST_ITEM_PROCESSING","DID_UPDATE_ITEM_PROCESS_PROGRESS","DID_THROW_ITEM_PROCESSING_ERROR"].forEach(g=>{Oa[g].status.translateY=Id}),Oa.DID_THROW_ITEM_PROCESSING_ERROR.status.translateX=Lx),h&&n){s.RevertItemProcessing.align="BUTTON_REMOVE_ITEM_POSITION";const g=Oa.DID_COMPLETE_ITEM_PROCESSING;g.info.translateX=fs,g.status.translateY=Id,g.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}a||(s.RemoveItem.disabled=!0),Vt(s,(g,v)=>{const w=t.createChildView(XE,{label:t.query(v.label),icon:t.query(v.icon),opacity:0});m.includes(g)&&t.appendChildView(w),v.disabled&&(w.element.setAttribute("disabled","disabled"),w.element.setAttribute("hidden","hidden")),w.element.dataset.align=t.query(`GET_STYLE_${v.align}`),w.element.classList.add(v.className),w.on("click",x=>{x.stopPropagation(),!v.disabled&&t.dispatch(v.action,{query:i})}),t.ref[`button${g}`]=w}),t.ref.processingCompleteIndicator=t.appendChildView(t.createChildView(Px)),t.ref.processingCompleteIndicator.element.dataset.align=t.query("GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"),t.ref.info=t.appendChildView(t.createChildView(Tx,{id:i})),t.ref.status=t.appendChildView(t.createChildView($x,{id:i}));const f=t.appendChildView(t.createChildView(gg,{opacity:0,align:t.query("GET_STYLE_LOAD_INDICATOR_POSITION")}));f.element.classList.add("filepond--load-indicator"),t.ref.loadProgressIndicator=f;const b=t.appendChildView(t.createChildView(gg,{opacity:0,align:t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}));b.element.classList.add("filepond--process-indicator"),t.ref.processProgressIndicator=b,t.ref.activeStyles=[]},Fx=({root:t,actions:e,props:s})=>{jx({root:t,actions:e,props:s});let i=e.concat().filter(n=>/^DID_/.test(n.type)).reverse().find(n=>Oa[n.type]);if(i){t.ref.activeStyles=[];const n=Oa[i.type];Vt(Nx,(a,o)=>{const c=t.ref[a];Vt(o,(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:o})=>{n[a]=typeof o=="function"?o(t):o})},jx=es({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}}),kx=te({create:Dx,write:Fx,didCreateView:t=>{ia("CREATE_VIEW",$(I({},t),{view:t}))},name:"file"}),Gx=({root:t,props:e})=>{t.ref.fileName=Sn("legend"),t.appendChild(t.ref.fileName),t.ref.file=t.appendChildView(t.createChildView(kx,{id:e.id})),t.ref.data=!1},Bx=({root:t,props:e})=>{qt(t.ref.fileName,bf(t.query("GET_ITEM_NAME",e.id)))},Ux=te({create:Gx,ignoreRect:!0,write:es({DID_LOAD_ITEM:Bx}),didCreateView:t=>{ia("CREATE_VIEW",$(I({},t),{view:t}))},tag:"fieldset",name:"file-wrapper"}),wg={type:"spring",damping:.6,mass:7},Vx=({root:t,props:e})=>{[{name:"top"},{name:"center",props:{translateY:null,scaleY:null},mixins:{animations:{scaleY:wg},styles:["translateY","scaleY"]}},{name:"bottom",props:{translateY:null},mixins:{animations:{translateY:wg},styles:["translateY"]}}].forEach(s=>{zx(t,s,e.name)}),t.element.classList.add(`filepond--${e.name}`),t.ref.scalable=null},zx=(t,e,s)=>{const i=te({name:`panel-${e.name} filepond--${s}`,mixins:e.mixins,ignoreRectUpdate:!0}),n=t.createChildView(i,e.props);t.ref[e.name]=t.appendChildView(n)},Wx=({root:t,props:e})=>{if((t.ref.scalable===null||e.scalable!==t.ref.scalable)&&(t.ref.scalable=ME(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},KE=te({name:"panel",read:({root:t,props:e})=>e.heightCurrent=t.ref.bottom.translateY,write:Wx,create:Vx,ignoreRect:!0,mixins:{apis:["height","heightCurrent","scalable"]}}),Hx=t=>{const e=t.map(i=>i.id);let s;return{setIndex:i=>{s=i},getIndex:()=>s,getItemIndex:i=>e.indexOf(i.id)}},_g={type:"spring",stiffness:.75,damping:.45,mass:10},Tg="spring",xg={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"},qx=({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(Ux,{id:e.id})),t.ref.panel=t.appendChildView(t.createChildView(KE,{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 o=Hx(t.query("GET_ACTIVE_ITEMS"));t.dispatch("DID_GRAB_ITEM",{id:e.id,dragState:o});const c=m=>{if(!m.isPrimary)return;m.stopPropagation(),m.preventDefault(),e.dragOffset={x:m.pageX-a.x,y:m.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:o})},d=m=>{m.isPrimary&&(e.dragOffset={x:m.pageX-a.x,y:m.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:o}),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)},Yx=es({DID_UPDATE_PANEL_HEIGHT:({root:t,action:e})=>{t.height=e.height}}),Xx=es({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(o=>/^DID_/.test(o.type)).reverse().find(o=>xg[o.type]);n&&n.type!==s.currentState&&(s.currentState=n.type,t.element.dataset.filepondItemState=xg[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):(Yx({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}),Zx=te({create:qx,write:Xx,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:Tg,scaleY:Tg,translateX:_g,translateY:_g,opacity:{type:"tween",duration:150}}}});var If=(t,e)=>Math.max(1,Math.floor((t+1)/e));const vf=(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=If(i,h);if(p===1){for(let b=0;b<n;b++){const g=e[b],v=g.rect.outer.top+g.rect.element.height*.5;if(s.top<v)return b}return n}const m=c.marginTop+c.marginBottom,f=c.height+m;for(let b=0;b<n;b++){const g=b%p,v=Math.floor(b/p),w=g*h,x=v*f,_=x-c.marginTop,R=w+h,C=x+f+c.marginBottom;if(s.top<C&&s.top>_){if(s.left<R)return b;b!==n-1?a=b:a=null}}return a!==null?a:n},vd={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)},setDimensions:function(t,e){(this.height===0||t===0)&&(this.height=t),(this.width===0||e===0)&&(this.width=e)}},Qx=({root:t})=>{me(t.element,"role","list"),t.ref.lastItemSpanwDate=Date.now()},Jx=({root:t,action:e})=>{const{id:s,index:i,interactionMethod:n}=e;t.ref.addIndex=i;const a=Date.now();let o=a,c=1;if(n!==Ys.NONE){c=0;const d=t.query("GET_ITEM_INSERT_INTERVAL"),h=a-t.ref.lastItemSpanwDate;o=h<d?a+(d-h):a}t.ref.lastItemSpanwDate=o,t.appendChildView(t.createChildView(Zx,{spawnDate:o,id:s,opacity:c,interactionMethod:n}),i)},Sg=(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&&Kx(t,e,s,i,n),t.scaleX=1,t.scaleY=1,t.opacity=1))},Kx=(t,e,s,i,n)=>{t.interactionMethod===Ys.NONE?(t.translateX=null,t.translateX=e,t.translateY=null,t.translateY=s):t.interactionMethod===Ys.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===Ys.BROWSE?(t.translateY=null,t.translateY=s-30):t.interactionMethod===Ys.API&&(t.translateX=null,t.translateX=e-30,t.translateY=null)},t0=({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)},Pp=t=>t.rect.element.height+t.rect.element.marginBottom*.5+t.rect.element.marginTop*.5,e0=t=>t.rect.element.width+t.rect.element.marginLeft*.5+t.rect.element.marginRight*.5,s0=({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),o=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=Pp(a),p=e0(a);let m=Math.floor(t.rect.outer.width/p);m>o&&(m=o);const f=Math.floor(o/m+1);vd.setHeight=h*f,vd.setWidth=p*m;var b={y:Math.floor(d.y/h),x:Math.floor(d.x/p),getGridIndex:function(){return d.y>vd.getHeight||d.y<0||d.x>vd.getWidth||d.x<0?c:this.y*m+this.x},getColIndex:function(){const x=t.query("GET_ACTIVE_ITEMS"),_=t.childViews.filter(B=>B.rect.element.height),R=x.map(B=>_.find(k=>k.id===B.id)),C=R.findIndex(B=>B===a),O=Pp(a),y=R.length;let D=y,L=0,F=0,H=0;for(let B=0;B<y;B++)if(L=Pp(R[B]),H=F,F=H+L,d.y<F){if(C>B){if(d.y<H+O){D=B;break}continue}D=B;break}return D}};const g=m>1?b.getGridIndex():b.getColIndex();t.dispatch("MOVE_ITEM",{query:a,index:g});const v=i.getIndex();if(v===void 0||v!==g){if(i.setIndex(g),v===void 0)return;t.dispatch("DID_REORDER_ITEMS",{items:t.query("GET_ACTIVE_ITEMS"),origin:c,target:g})}},i0=es({DID_ADD_ITEM:Jx,DID_REMOVE_ITEM:t0,DID_DRAG_ITEM:s0}),n0=({root:t,props:e,actions:s,shouldOptimize:i})=>{i0({root:t,props:e,actions:s});const{dragCoordinates:n}=e,a=t.rect.element.width,o=t.childViews.filter(R=>R.rect.element.height),c=t.query("GET_ACTIVE_ITEMS").map(R=>o.find(C=>C.id===R.id)).filter(R=>R),d=n?vf(t,c,n):null,h=t.ref.addIndex||null;t.ref.addIndex=null;let p=0,m=0,f=0;if(c.length===0)return;const b=c[0].rect.element,g=b.marginTop+b.marginBottom,v=b.marginLeft+b.marginRight,w=b.width+v,x=b.height+g,_=If(a,w);if(_===1){let R=0,C=0;c.forEach((O,y)=>{if(d){let F=y-d;F===-2?C=-g*.25:F===-1?C=-g*.75:F===0?C=g*.75:F===1?C=g*.25:C=0}i&&(O.translateX=null,O.translateY=null),O.markedForRemoval||Sg(O,0,R+C);let L=(O.rect.element.height+g)*(O.markedForRemoval?O.opacity:1);R+=L})}else{let R=0,C=0;c.forEach((O,y)=>{y===d&&(p=1),y===h&&(f+=1),O.markedForRemoval&&O.opacity<.5&&(m-=1);const D=y+f+p+m,L=D%_,F=Math.floor(D/_),H=L*w,B=F*x,k=Math.sign(H-R),X=Math.sign(B-C);R=H,C=B,!O.markedForRemoval&&(i&&(O.translateX=null,O.translateY=null),Sg(O,H,B,k,X))})}},r0=(t,e)=>e.filter(s=>s.data&&s.data.id?t.id===s.data.id:!0),a0=te({create:Qx,write:n0,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:r0,mixins:{apis:["dragCoordinates"]}}),o0=({root:t,props:e})=>{t.ref.list=t.appendChildView(t.createChildView(a0)),e.dragCoordinates=null,e.overflowing=!1},l0=({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)})},c0=({props:t})=>{t.dragCoordinates=null},d0=es({DID_DRAG:l0,DID_END_DRAG:c0}),h0=({root:t,props:e,actions:s})=>{if(d0({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)}},u0=te({create:o0,write:h0,name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),gi=(t,e,s,i="")=>{s?me(t,e,i):t.removeAttribute(e)},p0=t=>{if(!(!t||t.value==="")){try{t.value=""}catch(e){}if(t.value){const e=Sn("form"),s=t.parentNode,i=t.nextSibling;e.appendChild(t),e.reset(),i?s.insertBefore(t,i):s.appendChild(t)}}},m0=({root:t,props:e})=>{t.element.id=`filepond--browser-${e.id}`,me(t.element,"name",t.query("GET_NAME")),me(t.element,"aria-controls",`filepond--assistant-${e.id}`),me(t.element,"aria-labelledby",`filepond--drop-label-${e.id}`),tb({root:t,action:{value:t.query("GET_ACCEPTED_FILE_TYPES")}}),eb({root:t,action:{value:t.query("GET_ALLOW_MULTIPLE")}}),sb({root:t,action:{value:t.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Yp({root:t}),ib({root:t,action:{value:t.query("GET_REQUIRED")}}),nb({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),p0(t.element)},250)},t.element.addEventListener("change",t.ref.handleChange)},tb=({root:t,action:e})=>{t.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&gi(t.element,"accept",!!e.value,e.value?e.value.join(","):"")},eb=({root:t,action:e})=>{gi(t.element,"multiple",e.value)},sb=({root:t,action:e})=>{gi(t.element,"webkitdirectory",e.value)},Yp=({root:t})=>{const e=t.query("GET_DISABLED"),s=t.query("GET_ALLOW_BROWSE"),i=e||!s;gi(t.element,"disabled",i)},ib=({root:t,action:e})=>{e.value?t.query("GET_TOTAL_ITEMS")===0&&gi(t.element,"required",!0):gi(t.element,"required",!1)},nb=({root:t,action:e})=>{gi(t.element,"capture",!!e.value,e.value===!0?"":e.value)},Rg=({root:t})=>{const{element:e}=t;if(t.query("GET_TOTAL_ITEMS")>0){gi(e,"required",!1),gi(e,"name",!1);const s=t.query("GET_ACTIVE_ITEMS");let i=!1;for(let n=0;n<s.length;n++)s[n].status===rt.LOAD_ERROR&&(i=!0);t.element.setCustomValidity(i?t.query("GET_LABEL_INVALID_FIELD"):"")}else gi(e,"name",!0,t.query("GET_NAME")),t.query("GET_CHECK_VALIDITY")&&e.setCustomValidity(""),t.query("GET_REQUIRED")&&gi(e,"required",!0)},f0=({root:t})=>{t.query("GET_CHECK_VALIDITY")&&t.element.setCustomValidity(t.query("GET_LABEL_INVALID_FIELD"))},g0=te({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:m0,destroy:({root:t})=>{t.element.removeEventListener("change",t.ref.handleChange)},write:es({DID_LOAD_ITEM:Rg,DID_REMOVE_ITEM:Rg,DID_THROW_ITEM_INVALID:f0,DID_SET_DISABLED:Yp,DID_SET_ALLOW_BROWSE:Yp,DID_SET_ALLOW_DIRECTORIES_ONLY:sb,DID_SET_ALLOW_MULTIPLE:eb,DID_SET_ACCEPTED_FILE_TYPES:tb,DID_SET_CAPTURE_METHOD:nb,DID_SET_REQUIRED:ib})}),Cg={ENTER:13,SPACE:32},E0=({root:t,props:e})=>{const s=Sn("label");me(s,"for",`filepond--browser-${e.id}`),me(s,"id",`filepond--drop-label-${e.id}`),t.ref.handleKeyDown=i=>{(i.keyCode===Cg.ENTER||i.keyCode===Cg.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),rb(s,e.caption),t.appendChild(s),t.ref.label=s},rb=(t,e)=>{t.innerHTML=e;const s=t.querySelector(".filepond--label-action");return s&&me(s,"tabindex","0"),e},b0=te({name:"drop-label",ignoreRect:!0,create:E0,destroy:({root:t})=>{t.ref.label.addEventListener("keydown",t.ref.handleKeyDown),t.element.removeEventListener("click",t.ref.handleClick)},write:es({DID_SET_LABEL_IDLE:({root:t,action:e})=>{rb(t.ref.label,e.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),I0=te({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}}}}),v0=({root:t})=>{const e=t.rect.element.width*.5,s=t.rect.element.height*.5;t.ref.blob=t.appendChildView(t.createChildView(I0,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:e,translateY:s}))},w0=({root:t,action:e})=>{if(!t.ref.blob){v0({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},_0=({root:t})=>{t.ref.blob&&(t.ref.blob.opacity=0)},T0=({root:t})=>{t.ref.blob&&(t.ref.blob.scaleX=2.5,t.ref.blob.scaleY=2.5,t.ref.blob.opacity=0)},x0=({root:t,props:e,actions:s})=>{S0({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)},S0=es({DID_DRAG:w0,DID_DROP:T0,DID_END_DRAG:_0}),R0=te({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:x0}),ab=(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},C0=({root:t})=>{t.ref.fields={};const e=document.createElement("legend");e.textContent="Files",t.element.appendChild(e)},xp=(t,e)=>t.ref.fields[e],wf=t=>{t.query("GET_ACTIVE_ITEMS").forEach(e=>{t.ref.fields[e.id]&&t.element.appendChild(t.ref.fields[e.id])})},Og=({root:t})=>wf(t),O0=({root:t,action:e})=>{const n=!(t.query("GET_ITEM",e.id).origin===pe.LOCAL)&&t.query("SHOULD_UPDATE_FILE_INPUT"),a=Sn("input");a.type=n?"file":"hidden",a.name=t.query("GET_NAME"),t.ref.fields[e.id]=a,wf(t)},$0=({root:t,action:e})=>{const s=xp(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);ab(s,[i.file])},L0=({root:t,action:e})=>{t.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(()=>{const s=xp(t,e.id);s&&ab(s,[e.file])},0)},A0=({root:t})=>{t.element.disabled=t.query("GET_DISABLED")},y0=({root:t,action:e})=>{const s=xp(t,e.id);s&&(s.parentNode&&s.parentNode.removeChild(s),delete t.ref.fields[e.id])},M0=({root:t,action:e})=>{const s=xp(t,e.id);s&&(e.value===null?s.removeAttribute("value"):s.type!="file"&&(s.value=e.value),wf(t))},N0=es({DID_SET_DISABLED:A0,DID_ADD_ITEM:O0,DID_LOAD_ITEM:$0,DID_REMOVE_ITEM:y0,DID_DEFINE_VALUE:M0,DID_PREPARE_OUTPUT:L0,DID_REORDER_ITEMS:Og,DID_SORT_ITEMS:Og}),P0=te({tag:"fieldset",name:"data",create:C0,write:N0,ignoreRect:!0}),D0=t=>"getRootNode"in t?t.getRootNode():document,F0=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],j0=["css","csv","html","txt"],k0={zip:"zip|compressed",epub:"application/epub+zip"},ob=(t="")=>(t=t.toLowerCase(),F0.includes(t)?"image/"+(t==="jpg"?"jpeg":t==="svg"?"svg+xml":t):j0.includes(t)?"text/"+t:k0[t]||""),_f=t=>new Promise((e,s)=>{const i=q0(t);if(i.length&&!G0(t))return e(i);B0(t).then(e)}),G0=t=>t.files?t.files.length>0:!1,B0=t=>new Promise((e,s)=>{const i=(t.items?Array.from(t.items):[]).filter(n=>U0(n)).map(n=>V0(n));if(!i.length){e(t.files?Array.from(t.files):[]);return}Promise.all(i).then(n=>{const a=[];n.forEach(o=>{a.push.apply(a,o)}),e(a.filter(o=>o).map(o=>(o._relativePath||(o._relativePath=o.webkitRelativePath),o)))}).catch(console.error)}),U0=t=>{if(lb(t)){const e=Tf(t);if(e)return e.isFile||e.isDirectory}return t.kind==="file"},V0=t=>new Promise((e,s)=>{if(H0(t)){z0(Tf(t)).then(e).catch(s);return}e([t.getAsFile()])}),z0=t=>new Promise((e,s)=>{const i=[];let n=0,a=0;const o=()=>{a===0&&n===0&&e(i)},c=d=>{n++;const h=d.createReader(),p=()=>{h.readEntries(m=>{if(m.length===0){n--,o();return}m.forEach(f=>{f.isDirectory?c(f):(a++,f.file(b=>{const g=W0(b);f.fullPath&&(g._relativePath=f.fullPath),i.push(g),a--,o()}))}),p()},s)};p()};c(t)}),W0=t=>{if(t.type.length)return t;const e=t.lastModifiedDate,s=t.name,i=ob(Tp(t.name));return i.length&&(t=t.slice(0,t.size,i),t.name=s,t.lastModifiedDate=e),t},H0=t=>lb(t)&&(Tf(t)||{}).isDirectory,lb=t=>"webkitGetAsEntry"in t,Tf=t=>t.webkitGetAsEntry(),q0=t=>{let e=[];try{if(e=X0(t),e.length)return e;e=Y0(t)}catch(s){}return e},Y0=t=>{let e=t.getData("url");return typeof e=="string"&&e.length?[e]:[]},X0=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[]},ch=[],ea=t=>({pageLeft:t.pageX,pageTop:t.pageY,scopeLeft:t.offsetX||t.layerX,scopeTop:t.offsetY||t.layerY}),Z0=(t,e,s)=>{const i=Q0(e),n={element:t,filterElement:s,state:null,ondrop:()=>{},onenter:()=>{},ondrag:()=>{},onexit:()=>{},onload:()=>{},allowdrop:()=>{}};return n.destroy=i.addListener(n),n},Q0=t=>{const e=ch.find(i=>i.element===t);if(e)return e;const s=J0(t);return ch.push(s),s},J0=t=>{const e=[],s={dragenter:tS,dragover:eS,dragleave:iS,drop:sS},i={};Vt(s,(a,o)=>{i[a]=o(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&&(ch.splice(ch.indexOf(n),1),Vt(s,o=>{t.removeEventListener(o,i[o],!1)}))})};return n},K0=(t,e)=>("elementFromPoint"in t||(t=document),t.elementFromPoint(e.x,e.y)),xf=(t,e)=>{const s=D0(e),i=K0(s,{x:t.pageX-window.pageXOffset,y:t.pageY-window.pageYOffset});return i===e||e.contains(i)};let cb=null;const wd=(t,e)=>{try{t.dropEffect=e}catch(s){}},tS=(t,e)=>s=>{s.preventDefault(),cb=s.target,e.forEach(i=>{const{element:n,onenter:a}=i;xf(s,n)&&(i.state="enter",a(ea(s)))})},eS=(t,e)=>s=>{s.preventDefault();const i=s.dataTransfer;_f(i).then(n=>{let a=!1;e.some(o=>{const{filterElement:c,element:d,onenter:h,onexit:p,ondrag:m,allowdrop:f}=o;wd(i,"copy");const b=f(n);if(!b){wd(i,"none");return}if(xf(s,d)){if(a=!0,o.state===null){o.state="enter",h(ea(s));return}if(o.state="over",c&&!b){wd(i,"none");return}m(ea(s))}else c&&!a&&wd(i,"none"),o.state&&(o.state=null,p(ea(s)))})})},sS=(t,e)=>s=>{s.preventDefault();const i=s.dataTransfer;_f(i).then(n=>{e.forEach(a=>{const{filterElement:o,element:c,ondrop:d,onexit:h,allowdrop:p}=a;if(a.state=null,!(o&&!xf(s,c))){if(!p(n))return h(ea(s));d(ea(s),n)}})})},iS=(t,e)=>s=>{cb===s.target&&e.forEach(i=>{const{onexit:n}=i;i.state=null,n(ea(s))})},nS=(t,e,s)=>{t.classList.add("filepond--hopper");const{catchesDropsOnPage:i,requiresDropOnElement:n,filterItems:a=p=>p}=s,o=Z0(t,i?document.documentElement:t,n);let c="",d="";o.allowdrop=p=>e(a(p)),o.ondrop=(p,m)=>{const f=a(m);if(!e(f)){h.ondragend(p);return}d="drag-drop",h.onload(f,p)},o.ondrag=p=>{h.ondrag(p)},o.onenter=p=>{d="drag-over",h.ondragstart(p)},o.onexit=p=>{d="drag-exit",h.ondragend(p)};const h={updateHopperState:()=>{c!==d&&(t.dataset.hopperState=d,c=d)},onload:()=>{},ondragstart:()=>{},ondrag:()=>{},ondragend:()=>{},destroy:()=>{o.destroy()}};return h};let Xp=!1;const La=[],db=t=>{const e=document.activeElement;if(e&&(/textarea|input/i.test(e.nodeName)||e.getAttribute("contenteditable")==="true")){let i=!1,n=e;for(;n!==document.body;){if(n.classList.contains("filepond--root")){i=!0;break}n=n.parentNode}if(!i)return}_f(t.clipboardData).then(i=>{i.length&&La.forEach(n=>n(i))})},rS=t=>{La.includes(t)||(La.push(t),!Xp&&(Xp=!0,document.addEventListener("paste",db)))},aS=t=>{ff(La,La.indexOf(t)),La.length===0&&(document.removeEventListener("paste",db),Xp=!1)},oS=()=>{const t=s=>{e.onload(s)},e={destroy:()=>{aS(t)},onload:()=>{}};return rS(t),e},lS=({root:t,props:e})=>{t.element.id=`filepond--assistant-${e.id}`,me(t.element,"role","alert"),me(t.element,"aria-live","polite"),me(t.element,"aria-relevant","additions")};let $g=null,Lg=null;const Dp=[],Sp=(t,e)=>{t.element.textContent=e},cS=t=>{t.element.textContent=""},hb=(t,e,s)=>{const i=t.query("GET_TOTAL_ITEMS");Sp(t,`${s} ${e}, ${i} ${i===1?t.query("GET_LABEL_FILE_COUNT_SINGULAR"):t.query("GET_LABEL_FILE_COUNT_PLURAL")}`),clearTimeout(Lg),Lg=setTimeout(()=>{cS(t)},1500)},ub=t=>t.element.parentNode.contains(document.activeElement),dS=({root:t,action:e})=>{if(!ub(t))return;t.element.textContent="";const s=t.query("GET_ITEM",e.id);Dp.push(s.filename),clearTimeout($g),$g=setTimeout(()=>{hb(t,Dp.join(", "),t.query("GET_LABEL_FILE_ADDED")),Dp.length=0},750)},hS=({root:t,action:e})=>{if(!ub(t))return;const s=e.item;hb(t,s.filename,t.query("GET_LABEL_FILE_REMOVED"))},uS=({root:t,action:e})=>{const i=t.query("GET_ITEM",e.id).filename,n=t.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Sp(t,`${i} ${n}`)},Ag=({root:t,action:e})=>{const i=t.query("GET_ITEM",e.id).filename,n=t.query("GET_LABEL_FILE_PROCESSING_ABORTED");Sp(t,`${i} ${n}`)},_d=({root:t,action:e})=>{const i=t.query("GET_ITEM",e.id).filename;Sp(t,`${e.status.main} ${i} ${e.status.sub}`)},pS=te({create:lS,ignoreRect:!0,ignoreRectUpdate:!0,write:es({DID_LOAD_ITEM:dS,DID_REMOVE_ITEM:hS,DID_COMPLETE_ITEM_PROCESSING:uS,DID_ABORT_ITEM_PROCESSING:Ag,DID_REVERT_ITEM_PROCESSING:Ag,DID_THROW_ITEM_REMOVE_ERROR:_d,DID_THROW_ITEM_LOAD_ERROR:_d,DID_THROW_ITEM_INVALID:_d,DID_THROW_ITEM_PROCESSING_ERROR:_d}),tag:"span",name:"assistant"}),pb=(t,e="-")=>t.replace(new RegExp(`${e}.`,"g"),s=>s.charAt(1).toUpperCase()),mb=(t,e=16,s=!0)=>{let i=Date.now(),n=null;return(...a)=>{clearTimeout(n);const o=Date.now()-i,c=()=>{i=Date.now(),t(...a)};o<e?s||(n=setTimeout(c,e-o)):c()}},mS=1e6,dh=t=>t.preventDefault(),fS=({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(b0,$(I({},e),{translateY:null,caption:t.query("GET_LABEL_IDLE")}))),t.ref.list=t.appendChildView(t.createChildView(u0,{translateY:null})),t.ref.panel=t.appendChildView(t.createChildView(KE,{name:"panel-root"})),t.ref.assistant=t.appendChildView(t.createChildView(pS,I({},e))),t.ref.data=t.appendChildView(t.createChildView(P0,I({},e))),t.ref.measure=Sn("div"),t.ref.measure.style.height="100%",t.element.appendChild(t.ref.measure),t.ref.bounds=null,t.query("GET_STYLES").filter(d=>!xn(d.value)).map(({name:d,value:h})=>{t.element.dataset[d]=h}),t.ref.widthPrevious=null,t.ref.widthUpdated=mb(()=>{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",dh,{passive:!1}),t.element.addEventListener("gesturestart",dh));const o=t.query("GET_CREDITS");if(o.length===2){const d=document.createElement("a");d.className="filepond--credits",d.href=o[0],d.tabIndex=-1,d.target="_blank",d.rel="noopener noreferrer nofollow",d.textContent=o[1],t.element.appendChild(d),t.ref.credits=d}},gS=({root:t,props:e,actions:s})=>{if(wS({root:t,props:e,actions:s}),s.filter(y=>/^DID_SET_STYLE_/.test(y.type)).filter(y=>!xn(y.data.value)).map(({type:y,data:D})=>{const L=pb(y.substring(8).toLowerCase(),"_");t.element.dataset[L]=D.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=IS(t),t.element.removeChild(t.ref.measure),t.ref.measure=null);const{hopper:n,label:a,list:o,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"),m=h?t.query("GET_MAX_FILES")||mS:1,f=p===m,b=s.find(y=>y.type==="DID_ADD_ITEM");if(f&&b){const y=b.data.interactionMethod;a.opacity=0,h?a.translateY=-40:y===Ys.API?a.translateX=40:y===Ys.BROWSE?a.translateY=40:a.translateY=30}else f||(a.opacity=1,a.translateX=0,a.translateY=0);const g=ES(t),v=bS(t),w=a.rect.element.height,x=!h||f?0:w,_=f?o.rect.element.marginTop:0,R=p===0?0:o.rect.element.marginBottom,C=x+_+v.visual+R,O=x+_+v.bounds+R;if(o.translateY=Math.max(0,x-o.rect.element.marginTop)-g.top,d){const y=t.rect.element.width,D=y*d;d!==t.ref.previousAspectRatio&&(t.ref.previousAspectRatio=d,t.ref.updateHistory=[]);const L=t.ref.updateHistory;L.push(y);const F=2;if(L.length>F*2){const B=L.length,k=B-10;let X=0;for(let P=B;P>=k;P--)if(L[P]===L[P-2]&&X++,X>=F)return}c.scalable=!1,c.height=D;const H=D-x-(R-g.bottom)-(f?_:0);v.visual>H?o.overflow=H:o.overflow=null,t.height=D}else if(i.fixedHeight){c.scalable=!1;const y=i.fixedHeight-x-(R-g.bottom)-(f?_:0);v.visual>y?o.overflow=y:o.overflow=null}else if(i.cappedHeight){const y=C>=i.cappedHeight,D=Math.min(i.cappedHeight,C);c.scalable=!0,c.height=y?D:D-g.top-g.bottom;const L=D-x-(R-g.bottom)-(f?_:0);C>i.cappedHeight&&v.visual>L?o.overflow=L:o.overflow=null,t.height=Math.min(i.cappedHeight,O-g.top-g.bottom)}else{const y=p>0?g.top+g.bottom:0;c.scalable=!0,c.height=Math.max(w,C-y),t.height=Math.max(w,O-y)}t.ref.credits&&c.heightCurrent&&(t.ref.credits.style.transform=`translateY(${c.heightCurrent}px)`)},ES=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}},bS=t=>{let e=0,s=0;const i=t.ref.list,n=i.childViews[0],a=n.childViews.filter(_=>_.rect.element.height),o=t.query("GET_ACTIVE_ITEMS").map(_=>a.find(R=>R.id===_.id)).filter(_=>_);if(o.length===0)return{visual:e,bounds:s};const c=n.rect.element.width,d=vf(n,o,i.dragCoordinates),h=o[0].rect.element,p=h.marginTop+h.marginBottom,m=h.marginLeft+h.marginRight,f=h.width+m,b=h.height+p,g=typeof d!="undefined"&&d>=0?1:0,v=o.find(_=>_.markedForRemoval&&_.opacity<.45)?-1:0,w=o.length+g+v,x=If(c,f);return x===1?o.forEach(_=>{const R=_.rect.element.height+p;s+=R,e+=R*_.opacity}):(s=Math.ceil(w/x)*b,e=s),{visual:e,bounds:s}},IS=t=>{const e=t.ref.measureHeight||null;return{cappedHeight:parseInt(t.style.maxHeight,10)||null,fixedHeight:e===0?null:e}},Sf=(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 o=e.length;return!i&&o>1?(t.dispatch("DID_THROW_MAX_FILES",{source:e,error:Ht("warning",0,"Max files")}),!0):(a=i?a:1,!i&&s?!1:Go(a)&&n+o>a?(t.dispatch("DID_THROW_MAX_FILES",{source:e,error:Ht("warning",0,"Max files")}),!0):!1)},vS=(t,e,s)=>{const i=t.childViews[0];return vf(i,e,{left:s.scopeLeft-i.rect.element.left,top:s.scopeTop-(t.rect.outer.top+t.rect.element.marginTop+t.rect.element.scrollTop)})},yg=t=>{const e=t.query("GET_ALLOW_DROP"),s=t.query("GET_DISABLED"),i=e&&!s;if(i&&!t.ref.hopper){const n=nS(t.element,a=>{const o=t.query("GET_BEFORE_DROP_FILE")||(()=>!0);return t.query("GET_DROP_VALIDATION")?a.every(d=>ia("ALLOW_HOPPER_ITEM",d,{query:t.query}).every(h=>h===!0)&&o(d)):!0},{filterItems:a=>{const o=t.query("GET_IGNORED_FILES");return a.filter(c=>ta(c)?!o.includes(c.name.toLowerCase()):!0)},catchesDropsOnPage:t.query("GET_DROP_ON_PAGE"),requiresDropOnElement:t.query("GET_DROP_ON_ELEMENT")});n.onload=(a,o)=>{const d=t.ref.list.childViews[0].childViews.filter(p=>p.rect.element.height),h=t.query("GET_ACTIVE_ITEMS").map(p=>d.find(m=>m.id===p.id)).filter(p=>p);mi("ADD_ITEMS",a,{dispatch:t.dispatch}).then(p=>{if(Sf(t,p))return!1;t.dispatch("ADD_ITEMS",{items:p,index:vS(t.ref.list,h,o),interactionMethod:Ys.DROP})}),t.dispatch("DID_DROP",{position:o}),t.dispatch("DID_END_DRAG",{position:o})},n.ondragstart=a=>{t.dispatch("DID_START_DRAG",{position:a})},n.ondrag=mb(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(R0))}else!i&&t.ref.hopper&&(t.ref.hopper.destroy(),t.ref.hopper=null,t.removeChildView(t.ref.drip))},Mg=(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(g0,$(I({},e),{onload:a=>{mi("ADD_ITEMS",a,{dispatch:t.dispatch}).then(o=>{if(Sf(t,o))return!1;t.dispatch("ADD_ITEMS",{items:o,index:-1,interactionMethod:Ys.BROWSE})})}})),0):!n&&t.ref.browser&&(t.removeChildView(t.ref.browser),t.ref.browser=null)},Ng=t=>{const e=t.query("GET_ALLOW_PASTE"),s=t.query("GET_DISABLED"),i=e&&!s;i&&!t.ref.paster?(t.ref.paster=oS(),t.ref.paster.onload=n=>{mi("ADD_ITEMS",n,{dispatch:t.dispatch}).then(a=>{if(Sf(t,a))return!1;t.dispatch("ADD_ITEMS",{items:a,index:-1,interactionMethod:Ys.PASTE})})}):!i&&t.ref.paster&&(t.ref.paster.destroy(),t.ref.paster=null)},wS=es({DID_SET_ALLOW_BROWSE:({root:t,props:e})=>{Mg(t,e)},DID_SET_ALLOW_DROP:({root:t})=>{yg(t)},DID_SET_ALLOW_PASTE:({root:t})=>{Ng(t)},DID_SET_DISABLED:({root:t,props:e})=>{yg(t),Ng(t),Mg(t,e),t.query("GET_DISABLED")?t.element.dataset.disabled="disabled":t.element.removeAttribute("data-disabled")}}),_S=te({name:"root",read:({root:t})=>{t.ref.measure&&(t.ref.measureHeight=t.ref.measure.offsetHeight)},create:fS,write:gS,destroy:({root:t})=>{t.ref.paster&&t.ref.paster.destroy(),t.ref.hopper&&t.ref.hopper.destroy(),t.element.removeEventListener("touchmove",dh),t.element.removeEventListener("gesturestart",dh)},mixins:{styles:["height"]}}),TS=(t={})=>{let e=null;const s=lh(),i=G_(ST(s),[VT,OT(s)],[mx,CT(s)]);i.dispatch("SET_OPTIONS",{options:t});const n=()=>{document.hidden||i.dispatch("KICK")};document.addEventListener("visibilitychange",n);let a=null,o=!1,c=!1,d=null,h=null;const p=()=>{o||(o=!0),clearTimeout(a),a=setTimeout(()=>{o=!1,d=null,h=null,c&&(c=!1,i.dispatch("DID_STOP_RESIZE"))},500)};window.addEventListener("resize",p);const m=_S(i,{id:mf()});let f=!1,b=!1;const g={_read:()=>{o&&(h=window.innerWidth,d||(d=h),!c&&h!==d&&(i.dispatch("DID_START_RESIZE"),c=!0)),b&&f&&(f=m.element.offsetParent===null),!f&&(m._read(),b=m.rect.element.hidden)},_write:j=>{const N=i.processActionQueue().filter(G=>!/^SET_/.test(G.type));f&&!N.length||(_(N),f=m._write(j,N,c),AT(i.query("GET_ITEMS")),f&&i.processDispatchQueue())}},v=j=>N=>{const G={type:j};if(!N)return G;if(N.hasOwnProperty("error")&&(G.error=N.error?I({},N.error):null),N.status&&(G.status=I({},N.status)),N.file&&(G.output=N.file),N.source)G.file=N.source;else if(N.item||N.id){const U=N.item?N.item:i.query("GET_ITEM",N.id);G.file=U?cs(U):null}return N.items&&(G.items=N.items.map(cs)),/progress/.test(j)&&(G.progress=N.progress),N.hasOwnProperty("origin")&&N.hasOwnProperty("target")&&(G.origin=N.origin,G.target=N.target),G},w={DID_DESTROY:v("destroy"),DID_INIT:v("init"),DID_THROW_MAX_FILES:v("warning"),DID_INIT_ITEM:v("initfile"),DID_START_ITEM_LOAD:v("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:v("addfileprogress"),DID_LOAD_ITEM:v("addfile"),DID_THROW_ITEM_INVALID:[v("error"),v("addfile")],DID_THROW_ITEM_LOAD_ERROR:[v("error"),v("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[v("error"),v("removefile")],DID_PREPARE_OUTPUT:v("preparefile"),DID_START_ITEM_PROCESSING:v("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:v("processfileprogress"),DID_ABORT_ITEM_PROCESSING:v("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:v("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:v("processfiles"),DID_REVERT_ITEM_PROCESSING:v("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[v("error"),v("processfile")],DID_REMOVE_ITEM:v("removefile"),DID_UPDATE_ITEMS:v("updatefiles"),DID_ACTIVATE_ITEM:v("activatefile"),DID_REORDER_ITEMS:v("reorderfiles")},x=j=>{const N=I({pond:Y},j);delete N.type,m.element.dispatchEvent(new CustomEvent(`FilePond:${j.type}`,{detail:N,bubbles:!0,cancelable:!0,composed:!0}));const G=[];j.hasOwnProperty("error")&&G.push(j.error),j.hasOwnProperty("file")&&G.push(j.file);const U=["type","error","file"];Object.keys(j).filter(V=>!U.includes(V)).forEach(V=>G.push(j[V])),Y.fire(j.type,...G);const q=i.query(`GET_ON${j.type.toUpperCase()}`);q&&q(...G)},_=j=>{j.length&&j.filter(N=>w[N.type]).forEach(N=>{const G=w[N.type];(Array.isArray(G)?G:[G]).forEach(U=>{N.type==="DID_INIT_ITEM"?x(U(N.data)):setTimeout(()=>{x(U(N.data))},0)})})},R=j=>i.dispatch("SET_OPTIONS",{options:j}),C=j=>i.query("GET_ACTIVE_ITEM",j),O=j=>new Promise((N,G)=>{i.dispatch("REQUEST_ITEM_PREPARE",{query:j,success:U=>{N(U)},failure:U=>{G(U)}})}),y=(j,N={})=>new Promise((G,U)=>{F([{source:j,options:N}],{index:N.index}).then(q=>G(q&&q[0])).catch(U)}),D=j=>j.file&&j.id,L=(j,N)=>(typeof j=="object"&&!D(j)&&!N&&(N=j,j=void 0),i.dispatch("REMOVE_ITEM",$(I({},N),{query:j})),i.query("GET_ACTIVE_ITEM",j)===null),F=(...j)=>new Promise((N,G)=>{const U=[],q={};if(Ip(j[0]))U.push.apply(U,j[0]),Object.assign(q,j[1]||{});else{const V=j[j.length-1];typeof V=="object"&&!(V instanceof Blob)&&Object.assign(q,j.pop()),U.push(...j)}i.dispatch("ADD_ITEMS",{items:U,index:q.index,interactionMethod:Ys.API,success:N,failure:G})}),H=()=>i.query("GET_ACTIVE_ITEMS"),B=j=>new Promise((N,G)=>{i.dispatch("REQUEST_ITEM_PROCESSING",{query:j,success:U=>{N(U)},failure:U=>{G(U)}})}),k=(...j)=>{const N=Array.isArray(j[0])?j[0]:j,G=N.length?N:H();return Promise.all(G.map(O))},X=(...j)=>{const N=Array.isArray(j[0])?j[0]:j;if(!N.length){const G=H().filter(U=>!(U.status===rt.IDLE&&U.origin===pe.LOCAL)&&U.status!==rt.PROCESSING&&U.status!==rt.PROCESSING_COMPLETE&&U.status!==rt.PROCESSING_REVERT_ERROR);return Promise.all(G.map(B))}return Promise.all(N.map(B))},P=(...j)=>{const N=Array.isArray(j[0])?j[0]:j;let G;typeof N[N.length-1]=="object"?G=N.pop():Array.isArray(j[0])&&(G=j[1]);const U=H();return N.length?N.map(V=>xr(V)?U[V]?U[V].id:null:V).filter(V=>V).map(V=>L(V,G)):Promise.all(U.map(V=>L(V,G)))},Y=$(I(I(I({},_p()),g),RT(i,s)),{setOptions:R,addFile:y,addFiles:F,getFile:C,processFile:B,prepareFile:O,removeFile:L,moveFile:(j,N)=>i.dispatch("MOVE_ITEM",{query:j,index:N}),getFiles:H,processFiles:X,removeFiles:P,prepareFiles:k,sort:j=>i.dispatch("SORT",{compare:j}),browse:()=>{var j=m.element.querySelector("input[type=file]");j&&j.click()},destroy:()=>{Y.fire("destroy",m.element),i.dispatch("ABORT_ALL"),m._destroy(),window.removeEventListener("resize",p),document.removeEventListener("visibilitychange",n),i.dispatch("DID_DESTROY")},insertBefore:j=>ig(m.element,j),insertAfter:j=>ng(m.element,j),appendTo:j=>j.appendChild(m.element),replaceElement:j=>{ig(m.element,j),j.parentNode.removeChild(j),e=j},restoreElement:()=>{e&&(ng(e,m.element),m.element.parentNode.removeChild(m.element),e=null)},isAttachedTo:j=>m.element===j||e===j,element:{get:()=>m.element},status:{get:()=>i.query("GET_STATUS")}});return i.dispatch("DID_INIT"),ar(Y)},fb=(t={})=>{const e={};return Vt(lh(),(i,n)=>{e[i]=n[0]}),TS(I(I({},e),t))},xS=t=>t.charAt(0).toLowerCase()+t.slice(1),SS=t=>pb(t.replace(/^data-/,"")),gb=(t,e)=>{Vt(e,(s,i)=>{Vt(t,(n,a)=>{const o=new RegExp(s);if(!o.test(n)||(delete t[n],i===!1))return;if(ts(i)){t[i]=a;return}const d=i.group;Ie(i)&&!t[d]&&(t[d]={}),t[d][xS(n.replace(o,""))]=a}),i.mapping&&gb(t[i.group],i.mapping)})},RS=(t,e={})=>{const s=[];Vt(t.attributes,n=>{s.push(t.attributes[n])});const i=s.filter(n=>n.name).reduce((n,a)=>{const o=me(t,a.name);return n[SS(a.name)]=o===a.name?!0:o,n},{});return gb(i,e),i},CS=(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};ia("SET_ATTRIBUTE_TO_OPTION_MAP",s);const i=I({},e),n=RS(t.nodeName==="FIELDSET"?t.querySelector("input[type=file]"):t,s);Object.keys(n).forEach(o=>{Ie(n[o])?(Ie(i[o])||(i[o]={}),Object.assign(i[o],n[o])):i[o]=n[o]}),i.files=(e.files||[]).concat(Array.from(t.querySelectorAll("input:not([type=file])")).map(o=>({source:o.value,options:{type:o.dataset.type}})));const a=fb(i);return t.files&&Array.from(t.files).forEach(o=>{a.addFile(o)}),a.replaceElement(t),a},OS=(...t)=>k_(t[0])?CS(...t):fb(...t),$S=["fire","_read","_write"],Pg=t=>{const e={};return FE(t,e,$S),e},LS=(t,e)=>t.replace(/(?:{([a-zA-Z]+)})/g,(s,i)=>e[i]),AS=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,o)=>{const c=mf();i.onmessage=d=>{d.data.id===c&&a(d.data.message)},i.postMessage({id:c,message:n},o)},terminate:()=>{i.terminate(),URL.revokeObjectURL(s)}}},yS=t=>new Promise((e,s)=>{const i=new Image;i.onload=()=>{e(i)},i.onerror=n=>{s(n)},i.src=t}),Eb=(t,e)=>{const s=t.slice(0,t.size,t.type);return s.lastModifiedDate=t.lastModifiedDate,s.name=e,s},MS=t=>Eb(t,t.name),Dg=[],NS=t=>{if(Dg.includes(t))return;Dg.push(t);const e=t({addFilter:MT,utils:{Type:z,forin:Vt,isString:ts,isFile:ta,toNaturalFileSize:ZE,replaceInString:LS,getExtensionFromFilename:Tp,getFilenameWithoutExtension:qE,guesstimateMimeType:ob,getFileFromBlob:Po,getFilenameFromURL:dd,createRoute:es,createWorker:AS,createView:te,createItemAPI:cs,loadImage:yS,copyFile:MS,renameFile:Eb,createBlob:zE,applyFilterChain:mi,text:qt,getNumericAspectRatioFromString:GE},views:{fileActionButton:XE}});NT(e.options)},PS=()=>Object.prototype.toString.call(window.operamini)==="[object OperaMini]",DS=()=>"Promise"in window,FS=()=>"slice"in Blob.prototype,jS=()=>"URL"in window&&"createObjectURL"in window.URL,kS=()=>"visibilityState"in document,GS=()=>"performance"in window,BS=()=>"supports"in(window.CSS||{}),US=()=>/MSIE|Trident/.test(window.navigator.userAgent),Zp=(()=>{const t=AE()&&!PS()&&kS()&&DS()&&FS()&&jS()&&GS()&&(BS()||US());return()=>t})(),On={apps:[]},VS="filepond",na=()=>{};let bb={},Ib={},vb={},Qp={},Od=na,$d=na,Jp=na,Kp=na,tm=na,em=na,sm=na;if(Zp()){hT(()=>{On.apps.forEach(s=>s._read())},s=>{On.apps.forEach(i=>i._write(s))});const t=()=>{document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:Zp,create:Od,destroy:$d,parse:Jp,find:Kp,registerPlugin:tm,setOptions:sm}})),document.removeEventListener("DOMContentLoaded",t)};document.readyState!=="loading"?setTimeout(()=>t(),0):document.addEventListener("DOMContentLoaded",t);const e=()=>Vt(lh(),(s,i)=>{Qp[s]=i[1]});bb=I({},BE),vb=I({},pe),Ib=I({},rt),Qp={},e(),Od=(...s)=>{const i=OS(...s);return i.on("destroy",$d),On.apps.push(i),Pg(i)},$d=s=>{const i=On.apps.findIndex(n=>n.isAttachedTo(s));return i>=0?(On.apps.splice(i,1)[0].restoreElement(),!0):!1},Jp=s=>Array.from(s.querySelectorAll(`.${VS}`)).filter(a=>!On.apps.find(o=>o.isAttachedTo(a))).map(a=>Od(a)),Kp=s=>{const i=On.apps.find(n=>n.isAttachedTo(s));return i?Pg(i):null},tm=(...s)=>{s.forEach(NS),e()},em=()=>{const s={};return Vt(lh(),(i,n)=>{s[i]=n[0]}),s},sm=s=>(Ie(s)&&(On.apps.forEach(i=>{i.setOptions(s)}),PT(s)),em())}var Fg=Object.freeze({__proto__:null,get FileOrigin(){return vb},get FileStatus(){return Ib},get OptionTypes(){return Qp},get Status(){return bb},get create(){return Od},get destroy(){return $d},get find(){return Kp},get getOptions(){return em},get parse(){return Jp},get registerPlugin(){return tm},get setOptions(){return sm},supported:Zp});function Tt({formID:t,fieldKey:e,fieldData:s,children:i,noLabel:n,noErrMsg:a,isBuilder:o}){var C,O,y,D,L,F,H,B,k,X;const{"*":c}=fp(),d=Z(dv),h=Z(ve),{styleMode:p}=h,[m,f,b]=c.split("/"),g=p&&m==="theme-customize"&&["err-msg","err-txt","err-txt-pre-i","err-txt-suf-i"].indexOf(f)>=0,v=p&&m==="field-theme-customize"&&["err-msg","err-txt","err-txt-pre-i","err-txt-suf-i"].indexOf(f)>=0&&b===e,w=((C=s.valid)==null?void 0:C.hide)||!1,x=((y=(O=s.err)==null?void 0:O.req)==null?void 0:y.dflt)||"",_=M.useRef(null),R=P=>{const Y=P.getBoundingClientRect();return Y.top>=0&&Y.left>=0&&Y.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&Y.right<=(window.innerWidth||document.documentElement.clientWidth)};if(x&&_.current){const P=_.current,Y=document.body.getBoundingClientRect(),N=P.getBoundingClientRect().top-Y.top;R(P)||window.scroll({top:N,behavior:"smooth"})}return u.jsxs("div",$(I({ref:_,"data-testid":`${e}-fld-wrp`,"data-dev-fld-wrp":e,className:`bf-${(s==null?void 0:s.typ)||"default"}-field ${e}-fld-wrp ${T(e,"fld-wrp")} ${p?"":"drag"} ${w?"fld-hide":""}`,style:{direction:d}},A(e,"fld-wrp")),{children:[!n&&u.jsxs("div",$(I({"data-testid":`${e}-lbl-wrp`,"data-dev-lbl-wrp":e,className:`${e}-lbl-wrp ${T(e,"lbl-wrp")}`},A(e,"lbl-wrp")),{children:[!((D=s==null?void 0:s.valid)!=null&&D.hideLbl)&&"lbl"in s&&u.jsxs("label",$(I({"data-testid":`${e}-lbl`,"data-dev-lbl":e,title:s.lbl,className:`${e}-lbl ${T(e,"lbl")}`,htmlFor:e},A(e,"lbl")),{children:[((L=s.valid)==null?void 0:L.req)&&((F=s.valid)==null?void 0:F.reqShow)&&((H=s.valid)==null?void 0:H.reqPos)==="before"&&u.jsx("span",$(I({"data-testid":`${e}-req-smbl`,"data-dev-req-smbl":e,className:`${e}-req-smbl ${T(e,"req-smbl")}`},A(e,"req-smbl")),{children:"*"})),s.lblPreIcn&&u.jsx("img",I({"data-testid":`${e}-lbl-pre-i`,"data-dev-lbl-pre-i":e,className:`${e}-lbl-pre-i ${T(e,"lbl-pre-i")}`,src:s.lblPreIcn,alt:""},A(e,"lbl-pre-i"))),u.jsx(We,{html:s.lbl.replace(/\$_bf_\$/g,"\\")}),s.lblSufIcn&&u.jsx("img",I({"data-testid":`${e}-lbl-suf-i`,"data-dev-lbl-suf-i":e,className:`${e}-lbl-suf-i ${T(e,"lbl-suf-i")}`,src:s.lblSufIcn,alt:""},A(e,"lbl-suf-i"))),((B=s.valid)==null?void 0:B.req)&&((k=s.valid)==null?void 0:k.reqShow)&&((X=s.valid)==null?void 0:X.reqPos)!=="before"&&u.jsx("span",$(I({"data-testid":`${e}-req-smbl`,"data-dev-req-smbl":e,className:`${e}-req-smbl ${T(e,"req-smbl")}`},A(e,"req-smbl")),{children:"*"}))]})),(s.subtitle||s.subTlePreIcn||s.subTleSufIcn)&&u.jsxs("div",$(I({"data-testid":`${e}-sub-titl`,"data-dev-sub-titl":e,className:`${e}-sub-titl ${T(e,"sub-titl")}`},A(e,"sub-titl")),{children:[s.subTlePreIcn&&u.jsx("img",I({"data-testid":`${e}-sub-titl-pre-i`,"data-dev-sub-titl-pre-i":e,className:`${e}-sub-titl-pre-i ${T(e,"sub-titl-pre-i")}`,src:s.subTlePreIcn,alt:""},A(e,"sub-titl-pre-i"))),u.jsx(We,{html:s.subtitle||""}),s.subTleSufIcn&&u.jsx("img",I({"data-testid":`${e}-sub-titl-suf-i`,"data-dev-sub-titl-suf-i":e,className:`${e}-sub-titl-suf-i ${T(e,"sub-titl-suf-i")}`,src:s.subTleSufIcn,alt:""},A(e,"sub-titl-suf-i")))]}))]})),u.jsxs("div",$(I({"data-testid":`${e}-inp-wrp`,className:`${e}-inp-wrp ${T(e,"inp-wrp")}`},A(e,"inp-wrp")),{children:[i,(s.helperTxt||s.hlpPreIcn||s.hlpSufIcn)&&u.jsxs("div",$(I({"data-testid":`${e}-hlp-txt`,"data-dev-hlp-txt":e,className:`${e}-hlp-txt ${T(e,"hlp-txt")}`},A(e,"hlp-txt")),{children:[s.hlpPreIcn&&u.jsx("img",I({"data-testid":`${e}-hlp-txt-pre-i`,"data-dev-hlp-txt-pre-i":e,className:`${e}-hlp-txt-pre-i ${T(e,"hlp-txt-pre-i")}`,src:s.hlpPreIcn,alt:""},A(e,"hlp-txt-pre-i"))),u.jsx(We,{html:s.helperTxt||""}),s.hlpSufIcn&&u.jsx("img",I({"data-testid":`${e}-hlp-txt-suf-i`,"data-dev-hlp-txt-suf-i":e,className:`${e}-hlp-txt-suf-i ${T(e,"hlp-txt-suf-i")}`,src:s.hlpSufIcn,alt:""},A(e,"hlp-txt-suf-i")))]})),!a&&(g||v)&&u.jsxs("div",$(I({"data-testid":`${e}-err-msg`,"data-dev-err-msg":e,className:`${e}-err-msg ${T(e,"err-msg")}`},A(e,"err-msg")),{children:[s.errPreIcn&&u.jsx("img",I({"data-testid":`${e}-err-txt-pre-i`,"data-dev-err-txt-pre-i":e,className:`${e}-err-txt-pre-i ${T(e,"err-txt-pre-i")}`,src:s.errPreIcn,alt:""},A(e,"err-txt-pre-i"))),u.jsx("div",$(I({"data-testid":`${e}-err-txt`,"data-dev-err-txt":e,className:`${e}-err-txt ${T(e,"err-txt")}`},A(e,"err-txt")),{children:u.jsx(We,{html:`${x||"This is an example of an error message. this message will vary by a condition or validation check."} `})})),s.errSufIcn&&u.jsx("img",I({"data-testid":`${e}-err-txt-suf-i`,"data-dev-err-txt-suf-i":e,className:`${e}-err-txt-suf-i ${T(e,"err-txt-suf-i")}`,src:s.errSufIcn,alt:""},A(e,"err-txt-suf-i")))]}))]}))]}))}function zS({attr:t,formID:e,fieldKey:s,styleClasses:i}){const[n]=qs(Lt),a=n[s],{config:o}=a,[c,d]=M.useState(0),h=M.useRef(null),p=M.useRef(null),m=Z(ve),{styleMode:f}=m;M.useEffect(()=>{const g=document.getElementById("bit-grid-layout").contentWindow;g.bit_filepond||(g.bit_filepond=Fg),g.bit_filepond_plugin_image_preview||(g.bit_filepond_plugin_image_preview=wE),g.bit_filepond_plugin_file_validate_size||(g.bit_filepond_plugin_file_validate_size=fE),g.bit_filepond_plugin_file_validate_type||(g.bit_filepond_plugin_file_validate_type=gE),g.bit_filepond_plugin_image_crop||(g.bit_filepond_plugin_image_crop=EE),g.bit_filepond_plugin_image_resize||(g.bit_filepond_plugin_image_resize=_E),g.bit_filepond_plugin_image_transform||(g.bit_filepond_plugin_image_transform=OE),g.bit_filepond_plugin_image_validate_size||(g.bit_filepond_plugin_image_validate_size=$E),g.bit_filepond_plugin_media_preview||(g.bit_filepond_plugin_media_preview=LE);const v={configSetting:I(I({},o),!f&&{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=Pt(`#filepond-${s}-container`));const w=h.current,x=p.current;w&&(Fg.destroy(p.current),x.firstChild&&x.removeChild(x.firstChild)),h.current=new Sv(x,v),d(_=>_+1)},[a==null?void 0:a.config]);const b=(g,v=!1)=>{var w;if((w=Pt(`.${s}-inp-wrp .${g}`))==null||w.setAttribute(`data-dev-${g}`,s),v){const x=hv(`.${s}-inp-wrp .${g}`);x.length>0&&[...x].map(_=>{_.setAttribute(`data-dev-${g}`,s)})}};return M.useEffect(()=>{b("filepond--root"),b("filepond--drop-label"),b("filepond--label-action"),b("filepond--panel-root"),b("filepond--item-panel",!0),b("filepond--file-action-button",!0),b("filepond--drip-blob"),b("filepond--file")},[c]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:i}),u.jsxs(Tt,{formID:e,fieldKey:s,fieldData:t,children:[u.jsx("input",I(I($(I({hidden:!0},f&&{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 WS=M.memo(zS);function HS({attr:t,formID:e,fieldKey:s,styleClasses:i}){const[n]=qs(Lt),a=n[s];t.typ;const[o,c]=M.useState(t.val!==void 0?t.val:""),d=M.useRef(null),h=M.useRef(null);return Z(ve),M.useEffect(()=>{const p=document.getElementById("bit-grid-layout"),m=p==null?void 0:p.contentWindow,f=p==null?void 0:p.contentDocument;if(!m||!f)return;if(!f.querySelector("style[data-flatpickr-style]")){const w=f.createElement("style");w.setAttribute("data-flatpickr-style","true"),w.textContent=`${uv}
76 .flatpickr-calendar:empty{display:none !important;}`,f.head.appendChild(w)}h!=null&&h.current||(h.current=Pt(`#${s}-advanced-datetime`));const g=d.current,v=h.current;g&&v!=null&&v.firstChild&&v.removeChild(v.firstChild)},[a==null?void 0:a.config]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:i}),u.jsx(Tt,{formID:e,fieldKey:s,fieldData:t,children:u.jsxs("div",$(I({"data-testid":`${s}-inp-fld-wrp`,className:`${s}-inp-fld-wrp ${T(s,"inp-fld-wrp")}`},A(s,"inp-fld-wrp")),{children:[u.jsx("input",I($(I(I(I(I(I(I({"data-testid":s,"data-dev-fld":s,id:`${s}-advanced-datetime`,list:`${s}-datalist`,ref:h,className:`${s}-advanced-datetime ${s}-fld no-drg ${T(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:o}),A(s,"fld"))),t.prefixIcn&&u.jsx("img",I({"data-testid":`${s}-pre-i`,"data-dev-pre-i":s,className:`${s}-pre-i ${T(s,"pre-i")}`,height:"90%",src:t.prefixIcn,alt:""},A(s,"pre-i"))),t.suffixIcn&&u.jsx("img",I({"data-testid":`${s}-suf-i`,"data-dev-suf-i":s,className:`${s}-suf-i ${T(s,"suf-i")}`,height:"90%",src:t.suffixIcn,alt:""},A(s,"suf-i")))]}))})]})}function qS({fieldKey:t,attr:e,styleClasses:s,buttonDisabled:i,handleReset:n,formID:a,data:o}){const c=Ei(s);return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:c}),u.jsx(Tt,{formID:a,fieldKey:t,fieldData:e,noLabel:!0,noErrMsg:!0,children:u.jsx("div",$(I({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${T(t,"inp-fld-wrp")}`},A(t,"inp-fld-wrp")),{children:u.jsxs("button",$(I(I($(I({"data-testid":t,"data-dev-btn":t,className:`${t}-btn ${T(t,"btn")}`},A(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",I({"data-testid":`${t}-btn-pre-i`,"data-dev-btn-pre-i":t,className:`${t}-btn-pre-i ${T(t,"btn-pre-i")}`,src:e.btnPreIcn,alt:""},A(t,"btn-pre-i"))),u.jsx(We,{html:e.txt||""}),e.btnSufIcn&&u.jsx("img",I({"data-testid":`${t}-btn-suf-i`,"data-dev-btn-suf-i":t,className:`${t}-btn-suf-i ${T(t,"btn-suf-i")}`,src:e.btnSufIcn,alt:""},A(t,"btn-suf-i")))]}))}))})]})}function YS({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){const o=Z(Lt),[c,d]=M.useState({checked:[]}),h=Ei(o[n]),[p,m]=M.useState(""),f=(b,g)=>{const{checked:v}=b.target;if(v)c.checked.push(g);else{const w=c.checked.indexOf(g);c.checked.splice(w,1),d({checked:c.checked})}Ct(n)};return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:i,fieldKey:n,fieldData:t,children:u.jsxs("div",$(I({"data-testid":`${n}-cc`,"data-dev-cc":n,className:`${n}-cc ${T(n,"cc")}`},A(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((b,g)=>u.jsxs("div",$(I({"data-testid":`${n}-cw`,"data-dev-cw":n,className:`${n}-cw ${T(n,"cw")}`},A(n,"cw")),{children:[u.jsx("input",I($(I($(I({"data-testid":`${n}-ci`,id:`${n}-chk-${g}`,type:"checkbox",className:`${n}-ci ${T(n,"ci")}`},(t.valid.disabled||b.disabled)&&{disabled:!0}),{defaultValue:b.val||b.lbl}),t.valid.req&&{required:!0}),{name:`${h.lbl}[]`,checked:c.checked.includes(g)||(b==null?void 0:b.check),onChange:v=>f(v,g)}),A(n,"ci"))),u.jsxs("label",$(I({"data-testid":`${n}-cl`,"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-chk-${g}`,className:`${n}-cl ${T(n,"cl")}`},A(n,"cl")),{children:[u.jsx("span",$(I({"data-testid":`${n}-bx`,"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${T(n,"bx")}`},A(n,"bx")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp ${T(n,"svgwrp")}`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn ${T(n,"ck-icn")}`})})})),u.jsx("span",$(I({"data-testid":`${n}-ct`,"data-dev-ct":n,className:`${n}-ct ${T(n,"ct")}`},A(n,"ct")),{children:u.jsx(We,{html:b.lbl})}))]}))]}),`opt-${g+24}`)),t.addOtherOpt&&u.jsxs("div",$(I({"data-testid":`${n}-cw`,"data-dev-cw":n,className:`${n}-cw ${T(n,"cw")}`},A(n,"cw")),{children:[u.jsx("input",I($(I({"data-testid":`${n}-ci`,"data-oopt":n,id:`${n}-chk-${t.opt.length}`,type:"checkbox",className:`${n}-ci ${T(n,"ci")}`,disabled:t.valid.disabled,value:p},t.valid.req&&{required:!0}),{name:`${h.lbl}[]`,checked:c.checked.includes(t.opt.length),onChange:b=>f(b,t.opt.length)}),A(n,"ci"))),u.jsxs("label",$(I({"data-testid":`${n}-cl`,"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-chk-${t.opt.length}`,className:`${n}-cl ${T(n,"cl")}`},A(n,"cl")),{children:[u.jsx("span",$(I({"data-testid":`${n}-bx`,"data-dev-ck":n,"data-bx":!0,className:`${n}-bx ${n}-ck ${T(n,"ck")}`},A(n,"ck")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp ${T(n,"svgwrp")}`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn ${T(n,"ck-icn")}`})})})),u.jsx("span",$(I({"data-testid":`${n}-ct`,"data-dev-ct":n,className:`${n}-ct ${T(n,"ct")}`},A(n,"ct")),{children:t.otherOptLbl||"Other..."}))]})),u.jsx("div",{"data-oinp-wrp":!0,className:`${n}-other-inp-wrp`,children:u.jsx("input",$(I(I(I({"data-testid":`${n}-other-inp`,"data-dev-other-inp":n,type:"text",className:`${n}-other-inp ${T(n,"other-inp")}`},t.valid.otherOptReq&&{required:!0}),"otherInpPh"in t&&{placeholder:t.otherInpPh}),!("otherInpPh"in t)&&{placeholder:"Other..."}),{value:p,onChange:b=>m(b.target.value)}))})]}),`opt-${t.opt.length+24}`)]}))})]})}var ie,ne,kt,Pn,Ma,ei,Ih,vh,Se,xi,Rl,ys,tn,Ms,Or,si,Dn,Cl,Ol,$l,Na,$r,wh,Ll,Pa,Da,Si,Ri,Re,Ns,Ps,Fa,Al,yl,ja,ka,Ga,Ba,_h,wb,Th,_b,Ml,im,xh,Tb,Sh,xb,Ce,Ye,os,Ls,Rh,Sb,Ch,Rb,Oh,Cb,Lr,Yo,Ua,Ld,Nl,nm,Pl,rm,Ar,Xo,Dl,am,Va,Ad,yr,Zo,ii,qi,Mr,Qo,en,mr,mt,Et,ls,As,Fl,om,Nr,Jo,Pr,Ko,sf,ZS,jl,lm,$h,Ob,Lh,$b,kl,cm,Fn,oa,Ah,Lb,Gl,dm,yh,Ab,Mh,yb;class XS{constructor(e,s){E(this,_h);E(this,Th);E(this,Ml);E(this,xh);E(this,Sh);E(this,Ce);E(this,os);E(this,Rh);E(this,Ch);E(this,Oh);E(this,Lr);E(this,Ua);E(this,Nl);E(this,Pl);E(this,Ar);E(this,Dl);E(this,Va);E(this,yr);E(this,ii);E(this,Mr);E(this,en);E(this,mt);E(this,ls);E(this,Fl);E(this,Nr);E(this,Pr);E(this,sf);E(this,jl);E(this,$h);E(this,Lh);E(this,kl);E(this,Fn);E(this,Ah);E(this,Gl);E(this,yh);E(this,Mh);E(this,ie,void 0);E(this,ne,void 0);E(this,kt,void 0);E(this,Pn,void 0);E(this,Ma,void 0);E(this,ei,void 0);E(this,Ih,"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=");E(this,vh,void 0);E(this,Se,void 0);E(this,xi,void 0);E(this,Rl,void 0);E(this,ys,void 0);E(this,tn,"");E(this,Ms,[]);E(this,Or,!0);E(this,si,!0);E(this,Dn,!0);E(this,Cl,!0);E(this,Ol,!1);E(this,$l,!1);E(this,Na,"");E(this,$r,"Select a Country");E(this,wh,"Search Country");E(this,Ll,"No Currency Found");E(this,Pa,370);E(this,Da,30);E(this,Si,void 0);E(this,Ri,{});E(this,Re,[]);E(this,Ns,{});E(this,Ps,{});E(this,Fa,"");E(this,Al,"");E(this,yl,null);E(this,ja,"");E(this,ka,[]);E(this,Ga,void 0);E(this,Ba,!1);l(this,_h,wb).call(this,s),typeof e=="string"?S(this,ie,r(this,Si).querySelector(e)):S(this,ie,e),this.fieldKey=r(this,Al),this.init()}init(){var e;S(this,ne,l(this,Ce,Ye).call(this,`.${this.fieldKey}-country-hidden-input`)),S(this,kt,l(this,Ce,Ye).call(this,`.${this.fieldKey}-dpd-wrp`)),S(this,Pn,l(this,Ce,Ye).call(this,`.${this.fieldKey}-selected-country-img`)),S(this,Ma,l(this,Ce,Ye).call(this,`.${this.fieldKey}-selected-country-lbl`)),S(this,ei,r(this,si)?l(this,Ce,Ye).call(this,`.${this.fieldKey}-inp-clr-btn`):{}),S(this,vh,l(this,Ce,Ye).call(this,`.${this.fieldKey}-option-search-wrp`)),S(this,Se,l(this,Ce,Ye).call(this,`.${this.fieldKey}-opt-search-input`)),S(this,xi,l(this,Ce,Ye).call(this,`.${this.fieldKey}-search-clear-btn`)),S(this,Rl,l(this,Ce,Ye).call(this,`.${this.fieldKey}-option-wrp`)),S(this,ys,l(this,Ce,Ye).call(this,`.${this.fieldKey}-option-list`)),this.setMenu({open:!1}),r(this,Ol)&&l(this,Rh,Sb).call(this),r(this,$l)&&l(this,Ch,Rb).call(this),r(this,Na)&&l(this,xh,Tb).call(this),l(this,Sh,xb).call(this),l(this,Ml,im).call(this),r(this,Ri).observeElm(r(this,ne),"value",(s,i)=>{l(this,Nl,nm).call(this,s,i)}),r(this,Or)||(e=r(this,Pn))==null||e.remove(),r(this,Dn)&&(l(this,ls,As).call(this,r(this,Se),"padding-right","35px"),l(this,ls,As).call(this,r(this,xi),"display","none")),l(this,os,Ls).call(this,r(this,ys),"scroll",s=>{s.stopPropagation()})}setSelectedCountryItem(e){if(S(this,tn,e),!r(this,tn))return;const s=l(this,Va,Ad).call(this);s&&(r(this,Or)&&r(this,Pn)&&(r(this,Pn).src=`${r(this,Fa)}${s.img}`),l(this,Mr,Qo).call(this,r(this,Ma),s.lbl),this.setMenu({open:!1}),this.value=s.val||s.lbl,r(this,si)&&(l(this,ls,As).call(this,r(this,ei),"display","grid"),l(this,os,Ls).call(this,r(this,ei),"click",i=>{l(this,Pl,rm).call(this,i)})),r(this,Ga)&&r(this,Ga).call(this,s.val||s.lbl),l(this,mt,Et).call(this,r(this,kt),"aria-label",`${s.lbl} selected`),l(this,Ar,Xo).call(this,r(this,ne),"blur"),setTimeout(()=>{l(this,mt,Et).call(this,r(this,kt),"aria-label",s.lbl)},100))}searchOptions(e){l(this,Lh,$b).call(this,e);let s=[];e?(s=r(this,Re).filter(i=>i.lbl.toLowerCase().includes(e.toLowerCase())),s.length||(s=[{i:0,lbl:r(this,Ll)}]),S(this,Ms,s),r(this,Dn)&&l(this,ls,As).call(this,r(this,xi),"display","grid")):(S(this,Ms,r(this,Re)),r(this,Dn)&&l(this,ls,As).call(this,r(this,xi),"display","none")),l(this,Fl,om).call(this)}setMenu({open:e}){l(this,ls,As).call(this,r(this,Rl),"max-height",`${e?r(this,Pa):0}px`),e?(l(this,Ah,Lb).call(this),r(this,ie).classList.add("menu-open"),l(this,os,Ls).call(this,r(this,Si),"click",s=>l(this,kl,cm).call(this,s)),l(this,en,mr).call(this,r(this,Se),"0"),l(this,en,mr).call(this,r(this,xi),"0"),r(this,kt).setAttribute("aria-expanded","true"),l(this,mt,Et).call(this,r(this,ys),"aria-hidden",!1),l(this,mt,Et).call(this,r(this,Se),"aria-hidden",!1),l(this,Fl,om).call(this)):(r(this,ie).classList.remove("menu-open"),r(this,Si).removeEventListener("click",l(this,kl,cm)),setTimeout(()=>{this.searchOptions("")},100),r(this,Se).blur(),l(this,en,mr).call(this,r(this,Se),"-1"),l(this,en,mr).call(this,r(this,xi),"-1"),r(this,ys).querySelectorAll(".option").forEach(s=>{l(this,en,mr).call(this,s,"-1")}),r(this,kt).setAttribute("aria-expanded","false"),l(this,mt,Et).call(this,r(this,ys),"aria-hidden",!0),l(this,mt,Et).call(this,r(this,Se),"aria-hidden",!0))}set disabled(e){String(e).toLowerCase()==="true"?(r(this,ie).classList.add("disabled"),r(this,ne).disabled=!0,r(this,si)&&l(this,mt,Et).call(this,r(this,ei),"tabindex","-1"),l(this,mt,Et).call(this,r(this,kt),"aria-label","Country Field disabled"),l(this,mt,Et).call(this,r(this,kt),"tabindex","-1"),this.setMenu({open:!1}),r(this,ka).forEach(({selector:s,eventType:i,cb:n})=>{s.removeEventListener(i,n)})):String(e).toLowerCase()==="false"&&(r(this,ie).classList.remove("disabled"),r(this,ne).removeAttribute("disabled"),l(this,mt,Et).call(this,r(this,kt),"tabindex","0"),r(this,si)&&l(this,mt,Et).call(this,r(this,ei),"tabindex","0"),l(this,mt,Et).call(this,r(this,kt),"aria-label",r(this,$r)),l(this,Ml,im).call(this))}get disabled(){return r(this,ne).disabled}set readonly(e){String(e).toLowerCase()==="true"?(r(this,ie).classList.add("disabled"),r(this,ne).readOnly=!0,l(this,mt,Et).call(this,r(this,kt),"tabindex","-1"),r(this,si)&&l(this,mt,Et).call(this,r(this,ei),"tabindex","-1"),this.setMenu({open:!1})):String(e).toLowerCase()==="false"&&(r(this,ie).classList.remove("disabled"),r(this,ne).removeAttribute("readonly"),r(this,si)&&l(this,mt,Et).call(this,r(this,kt),"tabindex","0"),l(this,mt,Et).call(this,r(this,ei),"tabindex","0"))}get readonly(){return r(this,ne).readOnly}set value(e){r(this,ne).value=e,l(this,mt,Et).call(this,r(this,ne),"value",e)}get value(){const e=l(this,Va,Ad).call(this);return e.val||e.lbl}get selectedCountry(){return l(this,Va,Ad).call(this)}destroy(){r(this,ys).innerHTML="",this.value="",l(this,Mh,yb).call(this)}reset(e){S(this,Ba,!0),l(this,Pl,rm).call(this),this.destroy(),this.init(),this.setSelectedCountryItem(e),S(this,Ba,!1)}}ie=new WeakMap,ne=new WeakMap,kt=new WeakMap,Pn=new WeakMap,Ma=new WeakMap,ei=new WeakMap,Ih=new WeakMap,vh=new WeakMap,Se=new WeakMap,xi=new WeakMap,Rl=new WeakMap,ys=new WeakMap,tn=new WeakMap,Ms=new WeakMap,Or=new WeakMap,si=new WeakMap,Dn=new WeakMap,Cl=new WeakMap,Ol=new WeakMap,$l=new WeakMap,Na=new WeakMap,$r=new WeakMap,wh=new WeakMap,Ll=new WeakMap,Pa=new WeakMap,Da=new WeakMap,Si=new WeakMap,Ri=new WeakMap,Re=new WeakMap,Ns=new WeakMap,Ps=new WeakMap,Fa=new WeakMap,Al=new WeakMap,yl=new WeakMap,ja=new WeakMap,ka=new WeakMap,Ga=new WeakMap,Ba=new WeakMap,_h=new WeakSet,wb=function(e){S(this,Si,e.document||document),S(this,Ri,e.window||window),S(this,Al,e.fieldKey),S(this,Na,e.defaultValue),S(this,$r,e.placeholder),S(this,wh,e.searchPlaceholder||"Search Country"),S(this,Ll,e.noCountryFoundText||"No Country Found"),S(this,Da,e.rowHeight||30),S(this,Pa,e.maxHeight||370),S(this,Or,e.selectedFlagImage),S(this,si,e.selectedCountryClearable),S(this,Dn,e.searchClearable),S(this,Cl,e.optionFlagImage),S(this,Ol,e.detectCountryByIp),S(this,$l,e.detectCountryByGeo),S(this,Fa,e.assetsURL),S(this,Ga,e.onChange),S(this,Ns,e.attributes||{}),S(this,Ps,e.classNames||{}),typeof e.options=="string"&&(e.options=l(this,Th,_b).call(this,e.options)),S(this,Re,e.options.filter(s=>!s.hide)),S(this,Ms,r(this,Re))},Th=new WeakSet,_b=function(e){const s=e.split("->");let i=r(this,Ri);return s.forEach(n=>{i=i[n]}),i},Ml=new WeakSet,im=function(){l(this,os,Ls).call(this,r(this,kt),"click",e=>{l(this,Gl,dm).call(this,e)}),l(this,os,Ls).call(this,r(this,kt),"keyup",e=>{l(this,Gl,dm).call(this,e)}),l(this,os,Ls).call(this,r(this,kt),"blur",e=>{l(this,yh,Ab).call(this,e)}),l(this,os,Ls).call(this,r(this,ie),"keydown",e=>{l(this,Oh,Cb).call(this,e)}),r(this,Dn)&&l(this,os,Ls).call(this,r(this,xi),"click",()=>{this.searchOptions("")}),l(this,os,Ls).call(this,r(this,Se),"keyup",e=>{l(this,$h,Ob).call(this,e)})},xh=new WeakSet,Tb=function(){const e=r(this,Re).find(s=>{const i=r(this,Na);return s.i===i?!0:s.val?s.val===i:s.lbl===i});e&&this.setSelectedCountryItem(e.i)},Sh=new WeakSet,xb=function(){const e=r(this,ne).name,i=decodeURIComponent(`${r(this,Si).URL}`.replace(/\+/g,"%20")).replace(new RegExp(`.*${e}=([^&]*).*|(.*)`),"$1");i&&l(this,Nl,nm).call(this,"",i)},Ce=new WeakSet,Ye=function(e){return r(this,ie).querySelector(e)},os=new WeakSet,Ls=function(e,s,i){e&&(e.addEventListener(s,i),r(this,ka).push({selector:e,eventType:s,cb:i}))},Rh=new WeakSet,Sb=function(){const{protocol:e}=r(this,Ri).location;fetch(`${e}//www.cloudflare.com/cdn-cgi/trace`).then(s=>s.text()).then(s=>{const i=s.trim().split(`
77 `).reduce((n,a)=>{const[o,c]=a.split("=");return n[o]=c,n},{});this.setSelectedCountryItem(i==null?void 0:i.loc)})},Ch=new WeakSet,Rb=function(){navigator.geolocation.getCurrentPosition(e=>{const{latitude:s,longitude:i}=e.coords,{protocol:n}=r(this,Ri).location,a=n==="https:"?`${n}//secure`:`${n}//api`;fetch(`${a}.geonames.org/countryCodeJSON?username=bitcodezoho1&lat=${s}&lng=${i}`).then(o=>o.json()).then(o=>{this.setSelectedCountryItem(o.countryCode)})})},Oh=new WeakSet,Cb=function(e){var a,o;e.stopPropagation();const s=r(this,Si).activeElement;let i=null;if(l(this,Fn,oa).call(this)){const c=Number(s.dataset.index||-1);if(e.key==="ArrowDown"||!e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,Se))i=l(this,Ce,Ye).call(this,".option:not(.disabled-opt)");else if(s.classList.contains("option")){const d=l(this,Ua,Ld).call(this,c,"next"),h=l(this,Lr,Yo).call(this,d);h?i=h:d+1<r(this,Ms).length&&((a=this.virtualOptionList)==null||a.scrollToIndex(d),setTimeout(()=>{const p=l(this,Lr,Yo).call(this,d);p&&p.focus()},50))}}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,Se))i=r(this,kt),l(this,Fn,oa).call(this)&&this.setMenu({open:!1});else if(s.classList.contains("option")){const d=l(this,Ua,Ld).call(this,c,"previous"),h=l(this,Lr,Yo).call(this,d);h?i=h:d>0?((o=this.virtualOptionList)==null||o.scrollToIndex(d),setTimeout(()=>{const p=l(this,Lr,Yo).call(this,d);p&&p.focus()},50)):h||(i=r(this,Se))}}else e.key==="Escape"&&this.setMenu({open:!1})}else if(e.key>="a"&&e.key<="z"){clearTimeout(r(this,yl)),S(this,ja,r(this,ja)+e.key),S(this,yl,setTimeout(()=>{S(this,ja,"")},300));const c=r(this,Re).find(d=>!d.disabled&&d.lbl.toLowerCase().startsWith(r(this,ja)));c&&this.setSelectedCountryItem(c.i)}else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const c=l(this,Dl,am).call(this),d=e.key==="ArrowDown"?"next":"previous",h=l(this,Ua,Ld).call(this,c,d);h>-1&&h<r(this,Re).length&&(this.value=r(this,Re)[h].val||r(this,Re)[h].lbl,l(this,Ar,Xo).call(this,r(this,ne),"blur"))}i&&i.focus()},Lr=new WeakSet,Yo=function(e){return l(this,Ce,Ye).call(this,`.${this.fieldKey}-option-list .option[data-index="${e}"]`)},Ua=new WeakSet,Ld=function(e=-1,s){if(s==="next"){const i=r(this,Re).length;for(let n=e+1;n<i;n+=1)if(!r(this,Re)[n].disabled)return n}else if(s==="previous"){for(let i=e-1;i>=0;i-=1)if(!r(this,Re)[i].disabled)return i}},Nl=new WeakSet,nm=function(e,s){const i=r(this,Re).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,ne)})},Pl=new WeakSet,rm=function(e){e==null||e.stopPropagation(),S(this,tn,""),r(this,Or)&&(r(this,Pn).src=r(this,Ih)),l(this,Mr,Qo).call(this,r(this,Ma),r(this,$r)),r(this,si)&&l(this,ls,As).call(this,r(this,ei),"display","none"),l(this,mt,Et).call(this,r(this,kt),"aria-label","Selected country cleared"),r(this,Ba)||r(this,kt).focus(),this.setMenu({open:!1}),this.value="",l(this,Ar,Xo).call(this,r(this,ne),"blur"),setTimeout(()=>{l(this,mt,Et).call(this,r(this,kt),"aria-label",r(this,$r))},100)},Ar=new WeakSet,Xo=function(e,s){const i=new Event(s);e.dispatchEvent(i)},Dl=new WeakSet,am=function(){return r(this,Ms).findIndex(e=>e.i===r(this,tn))},Va=new WeakSet,Ad=function(){return r(this,Re).find(e=>e.i===r(this,tn))},yr=new WeakSet,Zo=function(e){return r(this,Si).createElement(e)},ii=new WeakSet,qi=function(e,s){e.classList.add(s)},Mr=new WeakSet,Qo=function(e,s){e.textContent=s},en=new WeakSet,mr=function(e,s){e&&(e.tabIndex=s)},mt=new WeakSet,Et=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},ls=new WeakSet,As=function(e,s,i){e&&e.style.setProperty(s,i,"important")},Fl=new WeakSet,om=function(){if(!l(this,Fn,oa).call(this))return;l(this,jl,lm).call(this);const e=l(this,Dl,am).call(this),s=l(this,Ce,Ye).call(this,`.option[data-index="${e}"]`);s&&s.scrollIntoView({block:"nearest",inline:"nearest"})},Nr=new WeakSet,Jo=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>l(this,ii,qi).call(this,e,i))},Pr=new WeakSet,Ko=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)l(this,mt,Et).call(this,e,s[n].key,s[n].value)},sf=new WeakSet,ZS=function(){const e=l(this,Ce,Ye).call(this,".option");if(!e)return;const s=r(this,Ri).getComputedStyle(e),i=parseFloat(s.marginTop)+parseFloat(s.marginBottom),n=e.offsetHeight+i||0;n!==r(this,Da)&&(S(this,Da,n),r(this,ys).innerHTML="",l(this,jl,lm).call(this))},jl=new WeakSet,lm=function(){r(this,ys).innerHTML="";const e=r(this,Ms).map((s,i)=>{const n=l(this,yr,Zo).call(this,"li");if(l(this,mt,Et).call(this,n,"data-key",s.i),l(this,mt,Et).call(this,n,"data-index",i),"option"in r(this,Ns)){const c=r(this,Ns).option;l(this,Pr,Ko).call(this,n,c)}if(l(this,mt,Et).call(this,n,"data-dev-option",this.fieldKey),!s.i)return l(this,Mr,Qo).call(this,n,s.lbl),l(this,ii,qi).call(this,n,"opt-not-found"),n;if(l(this,ii,qi).call(this,n,"option"),"option"in r(this,Ps)){const c=r(this,Ps).option;c&&l(this,Nr,Jo).call(this,n,c)}const a=l(this,yr,Zo).call(this,"span");if(l(this,ii,qi).call(this,a,"opt-lbl-wrp"),"opt-lbl-wrp"in r(this,Ps)){const c=r(this,Ps)["opt-lbl-wrp"];c&&l(this,Nr,Jo).call(this,a,c)}if("opt-lbl-wrp"in r(this,Ns)){const c=r(this,Ns)["opt-lbl-wrp"];l(this,Pr,Ko).call(this,a,c)}if(r(this,Cl)){const c=l(this,yr,Zo).call(this,"img");if("opt-icn"in r(this,Ns)){const d=r(this,Ns)["opt-icn"];d&&l(this,Pr,Ko).call(this,c,d)}if(l(this,ii,qi).call(this,c,"opt-icn"),"opt-icn"in r(this,Ps)){const d=r(this,Ps)["opt-icn"];d&&l(this,Nr,Jo).call(this,c,d)}c.src=`${r(this,Fa)}${s.img}`,c.alt=`${s.lbl} flag image`,c.loading="lazy",l(this,mt,Et).call(this,c,"aria-hidden",!0),a.append(c)}const o=l(this,yr,Zo).call(this,"span");if("opt-lbl"in r(this,Ns)){const c=r(this,Ns)["opt-lbl"];l(this,Pr,Ko).call(this,o,c)}if(l(this,ii,qi).call(this,o,"opt-lbl"),"opt-lbl"in r(this,Ps)){const c=r(this,Ps)["opt-lbl"];c&&l(this,Nr,Jo).call(this,o,c)}return l(this,Mr,Qo).call(this,o,s.lbl),a.append(o),l(this,en,mr).call(this,n,l(this,Fn,oa).call(this)?"0":"-1"),l(this,mt,Et).call(this,n,"role","option"),l(this,mt,Et).call(this,n,"aria-posinset",i+1),l(this,mt,Et).call(this,n,"aria-setsize",r(this,Ms).length),l(this,os,Ls).call(this,n,"click",c=>{this.setSelectedCountryItem(c.currentTarget.dataset.key)}),l(this,os,Ls).call(this,n,"keyup",c=>{c.key==="Enter"&&this.setSelectedCountryItem(c.currentTarget.dataset.key)}),s.disabled&&l(this,ii,qi).call(this,n,"disabled-opt"),n.append(a),r(this,tn)===s.i?(l(this,ii,qi).call(this,n,"selected-opt"),l(this,mt,Et).call(this,n,"aria-selected",!0)):l(this,mt,Et).call(this,n,"aria-selected",!1),n});r(this,ys).append(...e)},$h=new WeakSet,Ob=function(e){var s;if(e.stopPropagation(),e.key==="Enter"&&r(this,Ms).length){const i=(s=r(this,Ms))==null?void 0:s[0].i;i&&(this.setSelectedCountryItem(i),this.searchOptions(""))}else this.searchOptions(e.target.value)},Lh=new WeakSet,$b=function(e){r(this,Se).value=e},kl=new WeakSet,cm=function(e){r(this,ie).contains(e.target)||this.setMenu({open:!1})},Fn=new WeakSet,oa=function(){return r(this,ie).classList.contains("menu-open")},Ah=new WeakSet,Lb=function(){const e=r(this,Ri),s=r(this,kt).getBoundingClientRect(),i=s.top,n=e.innerHeight-s.bottom;n<i&&n<r(this,Pa)?(l(this,ls,As).call(this,r(this,ie),"flex-direction","column-reverse"),l(this,ls,As).call(this,r(this,ie),"bottom","0%")):(l(this,ls,As).call(this,r(this,ie),"flex-direction","column"),l(this,ls,As).call(this,r(this,ie),"bottom","auto"))},Gl=new WeakSet,dm=function(e){e.code==="Space"&&(r(this,Se).focus(),this.setMenu({open:!0})),e.type==="click"&&(l(this,Fn,oa).call(this)?this.setMenu({open:!1}):(r(this,Se).focus(),this.setMenu({open:!0})))},yh=new WeakSet,Ab=function(e){var s;(s=e.target.parentElement)!=null&&s.contains(e.relatedTarget)||l(this,Ar,Xo).call(this,r(this,ne),"blur")},Mh=new WeakSet,yb=function(){r(this,ka).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};function Rp(t,e,s,i=0){const n=new MutationObserver(o=>{o.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 jg=11;function QS(t,e){var s=e.attributes,i,n,a,o,c;if(!(e.nodeType===jg||t.nodeType===jg)){for(var d=s.length-1;d>=0;d--)i=s[d],n=i.name,a=i.namespaceURI,o=i.value,a?(n=i.localName||n,c=t.getAttributeNS(a,n),c!==o&&(i.prefix==="xmlns"&&(n=i.name),t.setAttributeNS(a,n,o))):(c=t.getAttribute(n),c!==o&&t.setAttribute(n,o));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 Td,JS="http://www.w3.org/1999/xhtml",hs=typeof document=="undefined"?void 0:document,KS=!!hs&&"content"in hs.createElement("template"),tR=!!hs&&hs.createRange&&"createContextualFragment"in hs.createRange();function eR(t){var e=hs.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function sR(t){Td||(Td=hs.createRange(),Td.selectNode(hs.body));var e=Td.createContextualFragment(t);return e.childNodes[0]}function iR(t){var e=hs.createElement("body");return e.innerHTML=t,e.childNodes[0]}function nR(t){return t=t.trim(),KS?eR(t):tR?sR(t):iR(t)}function xd(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 rR(t,e){return!e||e===JS?hs.createElement(t):hs.createElementNS(e,t)}function aR(t,e){for(var s=t.firstChild;s;){var i=s.nextSibling;e.appendChild(s),s=i}return e}function Fp(t,e,s){t[s]!==e[s]&&(t[s]=e[s],t[s]?t.setAttribute(s,""):t.removeAttribute(s))}var kg={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)}Fp(t,e,"selected")},INPUT:function(t,e){Fp(t,e,"checked"),Fp(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,o;n;)if(o=n.nodeName&&n.nodeName.toUpperCase(),o==="OPTGROUP")a=n,n=a.firstChild;else{if(o==="OPTION"){if(n.hasAttribute("selected")){s=i;break}i++}n=n.nextSibling,!n&&a&&(n=a.nextSibling,a=null)}t.selectedIndex=s}}},qo=1,Gg=11,Bg=3,Ug=8;function $n(){}function oR(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function lR(t){return function(s,i,n){if(n||(n={}),typeof i=="string")if(s.nodeName==="#document"||s.nodeName==="HTML"||s.nodeName==="BODY"){var a=i;i=hs.createElement("html"),i.innerHTML=a}else i=nR(i);else i.nodeType===Gg&&(i=i.firstElementChild);var o=n.getNodeKey||oR,c=n.onBeforeNodeAdded||$n,d=n.onNodeAdded||$n,h=n.onBeforeElUpdated||$n,p=n.onElUpdated||$n,m=n.onBeforeNodeDiscarded||$n,f=n.onNodeDiscarded||$n,b=n.onBeforeElChildrenUpdated||$n,g=n.skipFromChildren||$n,v=n.addChild||function(N,G){return N.appendChild(G)},w=n.childrenOnly===!0,x=Object.create(null),_=[];function R(N){_.push(N)}function C(N,G){if(N.nodeType===qo)for(var U=N.firstChild;U;){var q=void 0;G&&(q=o(U))?R(q):(f(U),U.firstChild&&C(U,G)),U=U.nextSibling}}function O(N,G,U){m(N)!==!1&&(G&&G.removeChild(N),f(N),C(N,U))}function y(N){if(N.nodeType===qo||N.nodeType===Gg)for(var G=N.firstChild;G;){var U=o(G);U&&(x[U]=G),y(G),G=G.nextSibling}}y(s);function D(N){d(N);for(var G=N.firstChild;G;){var U=G.nextSibling,q=o(G);if(q){var V=x[q];V&&xd(G,V)?(G.parentNode.replaceChild(V,G),F(V,G)):D(G)}else D(G);G=U}}function L(N,G,U){for(;G;){var q=G.nextSibling;(U=o(G))?R(U):O(G,N,!0),G=q}}function F(N,G,U){var q=o(G);if(q&&delete x[q],!U){var V=h(N,G);if(V===!1||(V instanceof HTMLElement&&(N=V,y(N)),t(N,G),p(N),b(N,G)===!1))return}N.nodeName!=="TEXTAREA"?H(N,G):kg.TEXTAREA(N,G)}function H(N,G){var U=g(N,G),q=G.firstChild,V=N.firstChild,lt,ot,ct,ft,J;t:for(;q;){for(ft=q.nextSibling,lt=o(q);!U&&V;){if(ct=V.nextSibling,q.isSameNode&&q.isSameNode(V)){q=ft,V=ct;continue t}ot=o(V);var st=V.nodeType,at=void 0;if(st===q.nodeType&&(st===qo?(lt?lt!==ot&&((J=x[lt])?ct===J?at=!1:(N.insertBefore(J,V),ot?R(ot):O(V,N,!0),V=J,ot=o(V)):at=!1):ot&&(at=!1),at=at!==!1&&xd(V,q),at&&F(V,q)):(st===Bg||st==Ug)&&(at=!0,V.nodeValue!==q.nodeValue&&(V.nodeValue=q.nodeValue))),at){q=ft,V=ct;continue t}ot?R(ot):O(V,N,!0),V=ct}if(lt&&(J=x[lt])&&xd(J,q))U||v(N,J),F(J,q);else{var gt=c(q);gt!==!1&&(gt&&(q=gt),q.actualize&&(q=q.actualize(N.ownerDocument||hs)),v(N,q),D(q))}q=ft,V=ct}L(N,V,ot);var ht=kg[N.nodeName];ht&&ht(N,G)}var B=s,k=B.nodeType,X=i.nodeType;if(!w){if(k===qo)X===qo?xd(s,i)||(f(s),B=aR(s,rR(i.nodeName,i.namespaceURI))):B=i;else if(k===Bg||k===Ug){if(X===k)return B.nodeValue!==i.nodeValue&&(B.nodeValue=i.nodeValue),B;B=i}}if(B===i)f(s);else{if(i.isSameNode&&i.isSameNode(B))return;if(F(B,i,w),_)for(var P=0,Y=_.length;P<Y;P++){var j=x[_[P]];j&&O(j,j.parentNode,!1)}}return!w&&B!==s&&s.parentNode&&(B.actualize&&(B=B.actualize(s.ownerDocument||hs)),s.parentNode.replaceChild(B,s)),B}}var cR=lR(QS);function dR(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var hR="start",uR="center",pR="end",mR=function(){function t(e){var s=e.itemCount,i=e.itemSizeGetter,n=e.estimatedItemSize;dR(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 o=this._itemSizeGetter({index:a});if(o==null||isNaN(o))throw Error("Invalid size returned for index "+a+" of value "+o);this._itemSizeAndPositionData[a]={offset:n,size:o},n+=o}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?hR:i,a=s.containerSize,o=s.targetIndex;if(a<=0)return 0;var c=this.getSizeAndPositionForIndex(o),d=c.offset,h=d-a+c.size,p=void 0;switch(n){case pR:p=h;break;case uR:p=d-(a-c.size)/2;break;default:p=d;break}var m=this.getTotalSize();return Math.max(0,Math.min(m-a,p))},t.prototype.getVisibleRange=function(s){var i=s.containerSize,n=s.offset,a=s.overscanCount,o=this.getTotalSize();if(o===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,o=void 0,c=void 0;i<=n;){if(o=i+Math.floor((n-i)/2),c=this.getSizeAndPositionForIndex(o).offset,c===a)return o;c<a?i=o+1:c>a&&(n=o-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 fR(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var gR="position:relative; overflow:hidden; width:100%; min-height:100%; will-change: transform;",ER="position:absolute; top:0; left:0; height:100%; width:100%; overflow:visible;",Rf=function(){function t(e,s){var i=this;fR(this,t),this.getRowHeight=function(n){var a=n.index,o=i.options.rowHeight;return typeof o=="function"?o(a):Array.isArray(o)?o[a]:o},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,o=i.initialIndex,c=i.height,d=a||o!=null&&this.getRowOffset(o)||0,h=this.inner=document.createElement("div"),p=this.content=document.createElement("div");h.setAttribute("style",gR),p.setAttribute("style",ER),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 mR({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,o=a.height,c=a.offset,d=c===void 0?0:c,h=this._sizeAndPositionManager.getVisibleRange({containerSize:o,offset:d,overscanCount:i}),p=h.start,m=h.stop,f=document.createDocumentFragment(),b=p;b<=m;b++)f.appendChild(n(b));this.inner.style.height=this._sizeAndPositionManager.getTotalSize()+"px",this.content.style.top=this.getRowOffset(p)+"px",cR(this.content,f,{childrenOnly:!0,getNodeKey:function(v){return v.nodeIndex}}),this.onRowsRendered({startIndex:p,stopIndex:m})},t}();const bR=({fieldKey:t,formID:e,attr:s,styleClasses:i})=>{const n=M.useRef(null),a=M.useRef(null),c=Z(Lt)[t],d=Z(od),{options:h,ph:p}=c;return M.useEffect(()=>{const m=document.getElementById("bit-grid-layout").contentWindow;n!=null&&n.current||(n.current=Pt(`.${t}-country-fld-wrp`));const f=a.current,b=n.current;f&&b&&"destroy"in f&&f.destroy();const{selectedFlagImage:g,selectedCountryClearable:v,searchClearable:w,optionFlagImage:x,detectCountryByIp:_,detectCountryByGeo:R,defaultValue:C,searchPlaceholder:O,noCountryFoundText:y}=c.config;m.bit_virtualized_list||(m.bit_virtualized_list=Rf),m.observeElm||(m.observeElm=Rp);const D={fieldKey:t,selectedFlagImage:g,selectedCountryClearable:v,searchClearable:w,optionFlagImage:x,detectCountryByIp:_,detectCountryByGeo:R,defaultValue:C,placeholder:p,searchPlaceholder:O,noCountryFoundText:y,options:h,assetsURL:`${d.assetsURL}/../static/countries/`,document:document.getElementById("bit-grid-layout").contentDocument,window:m,attributes:{option:_t(t,"option"),"opt-lbl-wrp":_t(t,"opt-lbl-wrp"),"opt-icn":_t(t,"opt-icn"),"opt-lbl":_t(t,"opt-lbl")},classNames:{option:T(t,"option"),"opt-lbl-wrp":T(t,"opt-lbl-wrp"),"opt-icn":T(t,"opt-icn"),"opt-lbl":T(t,"opt-lbl")}};a.current=new XS(b,D)},[c]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:i}),u.jsx(Tt,{formID:e,fieldKey:t,fieldData:s,children:u.jsx("div",{className:`${t}-country-fld-container`,children:u.jsxs("div",$(I({"data-dev-country-fld-wrp":t,className:`${t}-country-fld-wrp ${T(t,"country-fld-wrp")} ${c.valid.disabled?"disabled":""} ${c.valid.readonly?"readonly":""}`,ref:n},A(t,"country-fld-wrp")),{children:[u.jsx("input",I(I({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",I({"data-dev-selected-country-img":t,className:`${t}-selected-country-img ${T(t,"selected-country-img")}`,"aria-hidden":"true",alt:"selected country flag",src:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="},A(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",$(I({"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 ${T(t,"inp-clr-btn")}`},A(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",$(I({className:`${t}-option-wrp ${T(t,"option-wrp")}`,"data-dev-option-wrp":t},A(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",I({"data-testid":`${t}-opt-srch-inp`,type:"search","data-dev-opt-search-input":t,className:`${t}-opt-search-input ${T(t,"opt-search-input")}`,placeholder:c.config.searchPlaceholder,autoComplete:"country-name",tabIndex:"-1"},A(t,"opt-search-input"))),u.jsxs("svg",$(I({"data-dev-opt-search-icn":t,className:`${t}-opt-search-icn ${T(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"},A(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",$(I({"data-testid":`${t}-srch-clr-btn`,type:"button",title:"Clear search","data-dev-search-clear-btn":t,className:`${t}-search-clear-btn ${T(t,"search-clear-btn")}`,tabIndex:"-1"},A(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",$(I({className:`${t}-option-list ${T(t,"option-list")}`,tabIndex:"-1",role:"listbox","aria-label":"country list","data-dev-option-list":t},A(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 Nh,Oe,re,sn,Ci,Bl,za,nn,Ph,Qe,Ul,St,Oi,$i,Vl,Dr,ni,rn,jn,Wa,Q,zl,Ha,Wl,Dh,Mb,Fh,Nb,Hl,hm,qa,yd,ql,um,jh,Pb,kh,Db,Gh,Fb,Ya,Md,ae,we,ke,ss,Bh,jb,Uh,kb,Fr,tl,Vh,Gb,jr,el,Xa,Nd,Yl,pm,Za,Pd,Xl,mm,zh,Bb,Zl,fm,Ql,gm,kn,la,Es,Zs,Qa,Dd,ut,pt,Gn,ca,Bn,da,Ge,is,nf,vR,Jl,Em,Kl,bm,tc,Im,Wh,Ub,Hh,Vb,qh,zb,Un,ha,Yh,Wb,ec,vm,Xh,Hb;class IR{constructor(e,s){E(this,Dh);E(this,Fh);E(this,Hl);E(this,qa);E(this,ql);E(this,jh);E(this,kh);E(this,Gh);E(this,Ya);E(this,ae);E(this,ke);E(this,Bh);E(this,Uh);E(this,Fr);E(this,Vh);E(this,jr);E(this,Xa);E(this,Yl);E(this,Za);E(this,Xl);E(this,zh);E(this,Zl);E(this,Ql);E(this,kn);E(this,Es);E(this,Qa);E(this,ut);E(this,Gn);E(this,Bn);E(this,Ge);E(this,nf);E(this,Jl);E(this,Kl);E(this,tc);E(this,Wh);E(this,Hh);E(this,qh);E(this,Un);E(this,Yh);E(this,ec);E(this,Xh);E(this,Nh,"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>");E(this,Oe,null);E(this,re,null);E(this,sn,null);E(this,Ci,null);E(this,Bl,null);E(this,za,null);E(this,nn,null);E(this,Ph,null);E(this,Qe,null);E(this,Ul,null);E(this,St,null);E(this,Oi,null);E(this,$i,null);E(this,Vl,30);E(this,Dr,!1);E(this,ni,[]);E(this,rn,void 0);E(this,jn,{});E(this,Wa,"");E(this,Q,{maxHeight:370,searchCurrencyPlaceholder:"Search Currency",noCurrencyFoundText:"No Currency Found",selectedCurrencyClearable:!0,searchClearable:!0,selectedFlagImage:!1,defaultCurrencyKey:"",defaultValue:"",optionFlagImage:!0,inputFormatOptions:{formatter:"browser",showCurrencySymbol:!0,decimalSeparator:"."},valueFormatOptions:{formatter:"browser",showCurrencySymbol:!0,decimalSeparator:"."},attributes:{},classNames:{},assetsURL:""});E(this,zl,null);E(this,Ha,"");E(this,Wl,[]);Object.assign(r(this,Q),s),S(this,jn,s.window?s.window:window),S(this,rn,s.document?s.document:document),typeof e=="string"?S(this,Oe,r(this,rn).querySelector(e)):S(this,Oe,e),typeof r(this,Q).options=="string"&&(r(this,Q).options=l(this,Dh,Mb).call(this,r(this,Q).options)),r(this,Q).options=r(this,Q).options.filter(i=>!i.hide),S(this,ni,[...r(this,Q).options]),this.fieldKey=r(this,Q).fieldKey,S(this,Wa,s.assetsURL),this.init()}init(){S(this,Ul,l(this,ae,we).call(this,`.${this.fieldKey}-currency-inner-wrp`)),S(this,St,l(this,ae,we).call(this,`.${this.fieldKey}-currency-amount-input`)),S(this,re,l(this,ae,we).call(this,`.${this.fieldKey}-currency-hidden-input`)),S(this,sn,l(this,ae,we).call(this,`.${this.fieldKey}-input-clear-btn`)),S(this,za,l(this,ae,we).call(this,`.${this.fieldKey}-selected-currency-img`)),S(this,Ph,l(this,ae,we).call(this,`.${this.fieldKey}-option-search-wrp`)),S(this,Qe,l(this,ae,we).call(this,`.${this.fieldKey}-opt-search-input`)),S(this,Ci,l(this,ae,we).call(this,`.${this.fieldKey}-dpd-wrp`)),S(this,Bl,l(this,ae,we).call(this,`.${this.fieldKey}-option-wrp`)),S(this,Oi,l(this,ae,we).call(this,`.${this.fieldKey}-search-clear-btn`)),S(this,$i,l(this,ae,we).call(this,`.${this.fieldKey}-option-list`)),this.setMenu({open:!1}),l(this,ke,ss).call(this,r(this,Oe),"keydown",e=>{l(this,Uh,kb).call(this,e)}),l(this,ke,ss).call(this,r(this,Ci),"click",e=>{l(this,ec,vm).call(this,e)}),l(this,ke,ss).call(this,r(this,Ci),"keyup",e=>{l(this,ec,vm).call(this,e)}),l(this,ke,ss).call(this,r(this,St),"focus",()=>{l(this,Fh,Nb).call(this)}),l(this,ke,ss).call(this,r(this,St),"blur",()=>{l(this,qa,yd).call(this)}),l(this,ke,ss).call(this,r(this,St),"input",e=>{l(this,zh,Bb).call(this,e)}),r(this,Q).selectedCurrencyClearable&&l(this,ke,ss).call(this,r(this,sn),"click",e=>{l(this,Vh,Gb).call(this,e)}),r(this,jn).observeElm(r(this,re),"value",(e,s)=>{l(this,Xl,mm).call(this,e,s)}),r(this,Q).defaultValue&&l(this,Bh,jb).call(this),!r(this,Q).defaultValue&&r(this,Q).defaultCurrencyKey&&this.setSelectedCurrencyItem(r(this,Q).defaultCurrencyKey),l(this,ke,ss).call(this,r(this,$i),"scroll",e=>{e.stopPagination()}),r(this,Q).searchClearable&&(l(this,Ge,is).call(this,r(this,Qe),"padding-right","35px"),l(this,Ge,is).call(this,r(this,Oi),"display","none"),l(this,ke,ss).call(this,r(this,Oi),"click",()=>{this.searchOptions("")})),r(this,Qe).value="",l(this,ke,ss).call(this,r(this,Qe),"keyup",e=>{l(this,Hh,Vb).call(this,e)})}setSelectedCurrencyItem(e){if(S(this,nn,e),!r(this,nn)){l(this,Kl,bm).call(this);return}const s=l(this,Ql,gm).call(this);s&&(r(this,Q).selectedFlagImage&&(r(this,za).src=`${r(this,Wa)}${s.img}`),this.setMenu({open:!1}),l(this,qa,yd).call(this),r(this,Dr)&&(!this.value&&r(this,St).focus(),S(this,Dr,!1)))}isValidated(){return l(this,qh,zb).call(this,{target:r(this,St)})}searchOptions(e){l(this,Wh,Ub).call(this,e);let s=[];e?(s=r(this,Q).options.filter(i=>{const n=e.toLowerCase(),a=(i.lbl||"").toLowerCase(),o=(i.val||"").toLowerCase(),c=(i.i||"").toLowerCase();if(a.includes(n)||o.includes(n)||c.includes(n))return!0}),s.length||(s=[{i:0,lbl:r(this,Q).noCurrencyFoundText}]),S(this,ni,s),r(this,Q).searchClearable&&l(this,Ge,is).call(this,r(this,Oi),"display","grid")):(S(this,ni,r(this,Q).options),r(this,Q).searchClearable&&l(this,Ge,is).call(this,r(this,Oi),"display","none")),l(this,tc,Im).call(this)}setMenu({open:e}){l(this,Ge,is).call(this,r(this,Bl),"max-height",`${e?r(this,Q).maxHeight:0}px`),e?(l(this,Yh,Wb).call(this),l(this,Es,Zs).call(this,r(this,Oe),"menu-open"),l(this,ke,ss).call(this,r(this,rn),"click",s=>l(this,Yl,pm).call(this,s)),l(this,ut,pt).call(this,r(this,Qe),"tabindex",0),l(this,ut,pt).call(this,r(this,Oi),"tabindex",0),l(this,ut,pt).call(this,r(this,Ci),"aria-expanded",!0),l(this,tc,Im).call(this)):(r(this,Oe).classList.remove("menu-open"),r(this,rn).removeEventListener("click",l(this,Yl,pm)),setTimeout(()=>{this.searchOptions("")},100),l(this,ut,pt).call(this,r(this,Qe),"tabindex",-1),l(this,ut,pt).call(this,r(this,Oi),"tabindex",-1),r(this,$i).querySelectorAll(".option").forEach(s=>{l(this,ut,pt).call(this,s,"tabindex",-1)}),l(this,ut,pt).call(this,r(this,Ci),"aria-expanded",!1))}set value(e){r(this,re).value=e||"",l(this,ut,pt).call(this,r(this,re),"value",e||"")}get value(){return r(this,re).value}set disabled(e){String(e).toLowerCase()==="true"?(r(this,Oe).classList.add("disabled"),r(this,re).disabled=!0,l(this,ut,pt)&&l(this,ut,pt).call(this,r(this,Ci),"aria-label","Dropdown disabled"),this.setMenu&&this.setMenu({open:!1})):String(e).toLowerCase()==="false"&&(r(this,Oe).classList.remove("disabled"),r(this,re).removeAttribute("disabled"),l(this,ut,pt)&&l(this,ut,pt).call(this,r(this,Ci),"aria-label",r(this,Q).placeholder||""))}get disabled(){return r(this,re).disabled}destroy(){r(this,$i).innerHTML="",this.value=r(this,Q).defaultValue,l(this,Xh,Hb).call(this)}reset(){l(this,Kl,bm).call(this),this.destroy(),this.init()}}Nh=new WeakMap,Oe=new WeakMap,re=new WeakMap,sn=new WeakMap,Ci=new WeakMap,Bl=new WeakMap,za=new WeakMap,nn=new WeakMap,Ph=new WeakMap,Qe=new WeakMap,Ul=new WeakMap,St=new WeakMap,Oi=new WeakMap,$i=new WeakMap,Vl=new WeakMap,Dr=new WeakMap,ni=new WeakMap,rn=new WeakMap,jn=new WeakMap,Wa=new WeakMap,Q=new WeakMap,zl=new WeakMap,Ha=new WeakMap,Wl=new WeakMap,Dh=new WeakSet,Mb=function(e){const s=e.split("->");let i=r(this,jn);return s.forEach(n=>{i=i[n]}),i},Fh=new WeakSet,Nb=function(){l(this,ut,pt).call(this,r(this,St),"type","number"),r(this,St).value=r(this,St).dataset.numValue||""},Hl=new WeakSet,hm=function(e,s=0){const i=jf(10,s||0);return Math.round(e*i)/i},qa=new WeakSet,yd=function(){l(this,ut,pt).call(this,r(this,St),"type","text");const e=Number(r(this,St).dataset.numValue);if(r(this,St).dataset.numValue===""||Number.isNaN(e)){r(this,St).value="",r(this,re).value="",l(this,ut,pt).call(this,r(this,re),"value",""),l(this,Fr,tl).call(this,r(this,re),"blur");return}const{inputFormatOptions:s,valueFormatOptions:i}=r(this,Q),n=l(this,ql,um).call(this,e,s);r(this,St).value=n,this.value=l(this,ql,um).call(this,e,i),l(this,Fr,tl).call(this,r(this,re),"blur")},ql=new WeakSet,um=function(e,s){const i=l(this,Ql,gm).call(this),{defaultCurrencyKey:n}=r(this,Q),{formatter:a,roundToClosestInteger:o,showCurrencySymbol:c,currencyPosition:d,symbolPosition:h}=s,p=(i==null?void 0:i.i)||n;if(!p)return e;o&&(e=l(this,Hl,hm).call(this,e));let m="";return a==="browser"?m=l(this,jh,Pb).call(this,e,p,s):a==="custom"||!a?m=l(this,kh,Db).call(this,e,s):a==="none"&&(m=e),h==="left-number"?m=`${(i==null?void 0:i.symbol)||""}${m}`:h==="right-number"&&(m=`${m}${(i==null?void 0:i.symbol)||""}`),c&&(d==="left"?m=`${c?`${p} `:""}${m}`:d==="right"&&(m=`${m}${c?` ${p}`:""}`)),h==="left-currency"?m=`${(i==null?void 0:i.symbol)||""}${m}`:h==="right-currency"&&(m=`${m}${(i==null?void 0:i.symbol)||""}`),m},jh=new WeakSet,Pb=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("")},kh=new WeakSet,Db=function(e,s){const{decimalSeparator:i,roundToClosestFractionDigits:n,minimumFractionDigits:a=0,maximumFractionDigits:o=0,numberFormat:c=""}=s,[d]=c.split(i),[h,p=""]=e.toString().split("."),m=l(this,Gh,Fb).call(this,h,d);let f=p;const b=f.length;if(b>0){const v=o>0,w=a>0;if(n&&f){let x;v&&b>o?x=o:w&&b<a?x=a:x=b,f=l(this,Hl,hm).call(this,+`0.${f}`,x).toString().replace("0.","")}v&&f&&(f=f.slice(0,o))}f.length<a&&(f=f.padEnd(a,"0"));let g="";return f?g=`${m}${i}${f}`:g=m,g},Gh=new WeakSet,Fb=function(e="",s=""){let i="",n=e.length-1;for(let a=s.length-1;a>=0;a--){const o=s[a],c=e[n];if(!c)break;o==="#"?(i=c+i,n--):i=o+i}return n>=0&&(i=e.substring(0,n+1)+i),i},Ya=new WeakSet,Md=function(e=""){const{decimalSeparator:s}=r(this,Q).valueFormatOptions,i=new RegExp(`[^0-9${s}]`,"g");return e.replace(i,"")},ae=new WeakSet,we=function(e){return r(this,Oe).querySelector(e)},ke=new WeakSet,ss=function(e,s,i){e&&(e.addEventListener(s,i),r(this,Wl).push({selector:e,eventType:s,cb:i}))},Bh=new WeakSet,jb=function(){r(this,St).dataset.numValue=l(this,Ya,Md).call(this,r(this,Q).defaultValue),l(this,Xl,mm).call(this,"",r(this,Q).defaultValue),r(this,Q).selectedCurrencyClearable&&l(this,Ge,is).call(this,r(this,sn),"display","grid")},Uh=new WeakSet,kb=function(e){var a,o;const s=r(this,rn).activeElement;let i=null;const n=l(this,Un,ha).call(this);if(e.target!==r(this,St)){if(n){const c=Number(s.dataset.index||-1);if(e.key==="ArrowDown"||!e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,Qe))i=l(this,ae,we).call(this,".option:not(.disabled-opt)");else if(s.classList.contains("option")){const d=l(this,Xa,Nd).call(this,c,"next"),h=l(this,jr,el).call(this,d);h?i=h:d+1<r(this,ni).length&&((a=this.virtualOptionList)==null||a.scrollToIndex(d),setTimeout(()=>{const p=l(this,jr,el).call(this,d);p&&p.focus()},50))}}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,Qe))i=r(this,St),l(this,Un,ha).call(this)&&this.setMenu({open:!1});else if(s.classList.contains("option")){const d=l(this,Xa,Nd).call(this,c,"previous"),h=l(this,jr,el).call(this,d);h?i=h:d>0?((o=this.virtualOptionList)==null||o.scrollToIndex(d),setTimeout(()=>{const p=l(this,jr,el).call(this,d);p&&p.focus()},50)):h||(i=r(this,Qe))}}else e.key==="Escape"&&this.setMenu({open:!1})}else if(e.key>="a"&&e.key<="z"){clearTimeout(r(this,zl)),S(this,Ha,r(this,Ha)+e.key),S(this,zl,setTimeout(()=>{S(this,Ha,"")},300));const c=r(this,Q).options.find(d=>!d.disabled&&d.lbl.toLowerCase().startsWith(r(this,Ha)));c&&this.setSelectedCurrencyItem(c.i)}else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const c=l(this,Zl,fm).call(this),d=e.key==="ArrowDown"?"next":"previous",h=l(this,Xa,Nd).call(this,c,d);h>-1&&h<r(this,Q).options.length&&(this.value=r(this,Q).options[h].val)}i&&i.focus()}},Fr=new WeakSet,tl=function(e,s){const i=new Event(s);e.dispatchEvent(i)},Vh=new WeakSet,Gb=function(){r(this,St).value="",l(this,ut,pt).call(this,r(this,re),"value",""),l(this,ut,pt).call(this,r(this,St),"data-num-value",""),this.setSelectedCurrencyItem(r(this,Q).defaultCurrencyKey),l(this,Fr,tl).call(this,r(this,St),"input"),this.value="",l(this,Fr,tl).call(this,r(this,re),"blur")},jr=new WeakSet,el=function(e){return l(this,ae,we).call(this,`.${this.fieldKey}-option-list .option[data-index="${e}"]`)},Xa=new WeakSet,Nd=function(e=-1,s){if(s==="next"){const i=r(this,Q).options.length;for(let n=e+1;n<i;n++)if(!r(this,Q).options[n].disabled)return n}else if(s==="previous"){for(let i=e-1;i>=0;i--)if(!r(this,Q).options[i].disabled)return i}},Yl=new WeakSet,pm=function(e){r(this,Oe).contains(e.target)||this.setMenu({open:!1})},Za=new WeakSet,Pd=function(e){var s;return((s=e==null?void 0:e.match(/[a-zA-Z]+/))==null?void 0:s[0])||""},Xl=new WeakSet,mm=function(e,s){const i=l(this,Za,Pd).call(this,s),n=r(this,Q).options.find(a=>a.i===i);if((i&&n||!i&&r(this,Q).defaultCurrencyKey)&&e!==s){const a=l(this,Za,Pd).call(this,r(this,Q).defaultValue);this.setSelectedCurrencyItem(i||a||r(this,Q).defaultCurrencyKey);const{decimalSeparator:o}=r(this,Q).valueFormatOptions,[c,d]=s.split(o),h=l(this,Ya,Md).call(this,c),p=l(this,Ya,Md).call(this,d),m=p?`${h}.${p}`:h;l(this,ut,pt).call(this,r(this,St),"data-num-value",m),l(this,qa,yd).call(this)}typeof bit_conditionals!="undefined"&&bit_conditionals({target:r(this,re)})},zh=new WeakSet,Bb=function(e){const s=Number(e.target.value);l(this,ut,pt).call(this,r(this,St),"data-num-value",s||""),r(this,Q).selectedCurrencyClearable&&(s?l(this,Ge,is).call(this,r(this,sn),"display","grid"):l(this,Ge,is).call(this,r(this,sn),"display","none"))},Zl=new WeakSet,fm=function(){const e=r(this,ni).findIndex(s=>s.i===r(this,nn));return e===-1?0:e},Ql=new WeakSet,gm=function(){return r(this,Q).options.find(e=>e.i===r(this,nn))},kn=new WeakSet,la=function(e){return r(this,rn).createElement(e)},Es=new WeakSet,Zs=function(e,s){e.classList.add(s)},Qa=new WeakSet,Dd=function(e,s){e.textContent=s},ut=new WeakSet,pt=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},Gn=new WeakSet,ca=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>l(this,Es,Zs).call(this,e,i))},Bn=new WeakSet,da=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)l(this,ut,pt).call(this,e,s[n].key,s[n].value)},Ge=new WeakSet,is=function(e,s,i){e==null||e.style.setProperty(s,i,"important")},nf=new WeakSet,vR=function(){const e=l(this,ae,we).call(this,".option");if(!e)return;const s=r(this,jn).getComputedStyle(e),i=parseFloat(s.marginTop)+parseFloat(s.marginBottom),n=e.offsetHeight+i||0;n!==r(this,Vl)&&(S(this,Vl,n),r(this,$i).innerHTML="",l(this,Jl,Em).call(this))},Jl=new WeakSet,Em=function(){r(this,$i).innerHTML="";const e=r(this,ni).map((s,i)=>{const n=l(this,kn,la).call(this,"li");if(l(this,ut,pt).call(this,n,"data-key",s.i),l(this,ut,pt).call(this,n,"data-index",i),"option"in r(this,Q).attributes){const d=r(this,Q).attributes.option;l(this,Bn,da).call(this,n,d)}if(!s.i)return l(this,Qa,Dd).call(this,n,s.lbl),l(this,Es,Zs).call(this,n,"opt-not-found"),n;if(l(this,Es,Zs).call(this,n,"option"),"option"in r(this,Q).classNames){const d=r(this,Q).classNames.option;d&&l(this,Gn,ca).call(this,n,d)}const a=l(this,kn,la).call(this,"span");if("opt-lbl-wrp"in r(this,Q).attributes){const d=r(this,Q).attributes["opt-lbl-wrp"];l(this,Bn,da).call(this,a,d)}if(l(this,Es,Zs).call(this,a,"opt-lbl-wrp"),"opt-lbl-wrp"in r(this,Q).classNames){const d=r(this,Q).classNames["opt-lbl-wrp"];d&&l(this,Gn,ca).call(this,a,d)}if(r(this,Q).optionFlagImage){const d=l(this,kn,la).call(this,"img");if("opt-icn"in r(this,Q).attributes){const h=r(this,Q).attributes["opt-icn"];l(this,Bn,da).call(this,d,h)}if(l(this,Es,Zs).call(this,d,"opt-icn"),"opt-icn"in r(this,Q).classNames){const h=r(this,Q).classNames["opt-icn"];h&&l(this,Gn,ca).call(this,d,h)}d.src=`${r(this,Wa)}${s.img}`,d.alt=`${s.lbl} flag image`,d.loading="lazy",l(this,ut,pt).call(this,d,"aria-hidden",!0),a.append(d)}const o=l(this,kn,la).call(this,"span");if("opt-lbl"in r(this,Q).attributes){const d=r(this,Q).attributes["opt-lbl"];l(this,Bn,da).call(this,o,d)}if(l(this,Es,Zs).call(this,o,"opt-lbl"),"opt-lbl"in r(this,Q).classNames){const d=r(this,Q).classNames["opt-lbl"];d&&l(this,Gn,ca).call(this,o,d)}l(this,Qa,Dd).call(this,o,s.lbl),a.append(o);const c=l(this,kn,la).call(this,"span");if("opt-suffix"in r(this,Q).attributes){const d=r(this,Q).attributes["opt-suffix"];l(this,Bn,da).call(this,c,d)}if(l(this,Es,Zs).call(this,c,"opt-suffix"),"opt-suffix"in r(this,Q).classNames){const d=r(this,Q).classNames["opt-suffix"];d&&l(this,Gn,ca).call(this,c,d)}return l(this,Qa,Dd).call(this,c,s.i),l(this,ut,pt).call(this,n,"tabindex",l(this,Un,ha).call(this)?"0":"-1"),l(this,ut,pt).call(this,n,"role","option"),l(this,ut,pt).call(this,n,"aria-posinset",i+1),l(this,ut,pt).call(this,n,"aria-setsize",r(this,ni).length),l(this,ke,ss).call(this,n,"click",d=>{S(this,Dr,!0),this.setSelectedCurrencyItem(d.currentTarget.dataset.key)}),l(this,ke,ss).call(this,n,"keyup",d=>{d.key==="Enter"&&(S(this,Dr,!0),this.setSelectedCurrencyItem(d.currentTarget.dataset.key))}),s.disabled&&l(this,Es,Zs).call(this,n,"disabled-opt"),n.append(a,c),r(this,nn)===s.i?(l(this,Es,Zs).call(this,n,"selected-opt"),l(this,ut,pt).call(this,n,"aria-selected",!0)):l(this,ut,pt).call(this,n,"aria-selected",!1),n});r(this,$i).append(...e)},Kl=new WeakSet,bm=function(){const e=l(this,Za,Pd).call(this,r(this,Q).defaultValue);S(this,nn,e||r(this,Q).defaultCurrencyKey||""),r(this,Q).selectedFlagImage&&(r(this,za).src=r(this,Nh)),this.setMenu({open:!1}),l(this,ut,pt).call(this,r(this,St),"data-num-value",""),r(this,Q).selectedCurrencyClearable&&l(this,Ge,is).call(this,r(this,sn),"display","none"),l(this,ut,pt).call(this,r(this,re),"value",r(this,Q).defaultValue)},tc=new WeakSet,Im=function(){if(!l(this,Un,ha).call(this))return;l(this,Jl,Em).call(this);const e=l(this,Zl,fm).call(this),s=l(this,ae,we).call(this,`.option[data-index="${e}"]`);s&&s.scrollIntoView({block:"nearest",inline:"nearest"})},Wh=new WeakSet,Ub=function(e){r(this,Qe).value=e},Hh=new WeakSet,Vb=function(e){var s;if(e.key==="Enter"&&r(this,ni).length){const i=(s=l(this,ae,we).call(this,".option"))==null?void 0:s.dataset.key;this.setSelectedCurrencyItem(i),this.searchOptions("")}else this.searchOptions(e.target.value)},qh=new WeakSet,zb=function(e){var a,o;if(e.target.value==="")return"required";const s=Number((o=(a=e.target.value)==null?void 0:a.match(/[0-9.]+/))==null?void 0:o[0]),{minValue:i,maxValue:n}=r(this,Q);return i!==""&&s<i?"minValue":n!==""&&s>n?"maxValue":""},Un=new WeakSet,ha=function(){return r(this,Oe).classList.contains("menu-open")},Yh=new WeakSet,Wb=function(){const e=r(this,Ul).getBoundingClientRect(),s=e.top,i=r(this,jn).innerHeight-e.bottom;i<s&&i<r(this,Q).maxHeight?(l(this,Ge,is).call(this,r(this,Oe),"flex-direction","column-reverse"),l(this,Ge,is).call(this,r(this,Oe),"bottom","0%")):(l(this,Ge,is).call(this,r(this,Oe),"flex-direction","column"),l(this,Ge,is).call(this,r(this,Oe),"bottom","auto"))},ec=new WeakSet,vm=function(e){e.code==="Space"&&(r(this,Qe).focus(),this.setMenu({open:!0})),e.type==="click"&&(l(this,Un,ha).call(this)?this.setMenu({open:!1}):(r(this,Qe).focus(),this.setMenu({open:!0})))},Xh=new WeakSet,Hb=function(){r(this,Wl).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};const wR=({fieldKey:t,formID:e,attr:s,onBlurHandler:i,contentID:n,styleClasses:a})=>{const o=M.useRef(null),c=M.useRef(null),h=Z(Lt)[t],p=Z(od),{selectedFlagImage:m,selectedCurrencyClearable:f,searchClearable:b,optionFlagImage:g,defaultCurrencyKey:v,searchPlaceholder:w,noCurrencyFoundText:x,defaultValue:_}=h.config;return M.useEffect(()=>{const R=document.getElementById("bit-grid-layout").contentWindow;o!=null&&o.current||(o.current=Pt(`.${t}-currency-fld-wrp`));const C=c.current,O=o.current;C&&O&&"destroy"in C&&C.destroy();const{options:y,inputFormatOptions:D,valueFormatOptions:L}=h,F={fieldKey:t,inputFormatOptions:D,valueFormatOptions:L,selectedFlagImage:m,selectedCurrencyClearable:f,searchClearable:b,optionFlagImage:g,defaultCurrencyKey:v,defaultValue:_,searchPlaceholder:w,noCurrencyFoundText:x,options:y,assetsURL:`${p.assetsURL}/../static/currencies/`,document:document.getElementById("bit-grid-layout").contentDocument,window:R,attributes:{option:_t(t,"option"),"opt-lbl-wrp":_t(t,"opt-lbl-wrp"),"opt-icn":_t(t,"opt-icn"),"opt-lbl":_t(t,"opt-lbl"),"opt-suffix":_t(t,"opt-suffix")},classNames:{option:T(t,"option"),"opt-lbl-wrp":T(t,"opt-lbl-wrp"),"opt-icn":T(t,"opt-icn"),"opt-lbl":T(t,"opt-lbl"),"opt-suffix":T(t,"opt-suffix")}};R.bit_virtualized_list||(R.bit_virtualized_list=Rf),R.observeElm||(R.observeElm=Rp),c.current=new IR(O,F)},[h]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:e,fieldKey:t,fieldData:s,children:u.jsx("div",{className:`${t}-currency-fld-container`,children:u.jsxs("div",$(I({"data-dev-currency-fld-wrp":t,className:`${t}-currency-fld-wrp ${T(t,"currency-fld-wrp")} ${h.valid.disabled?"disabled":""} ${h.valid.readonly?"readonly":""}`,ref:o},A(t,"currency-fld-wrp")),{children:[u.jsx("input",I(I({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:[m&&u.jsx("div",{className:`${t}-selected-currency-wrp`,children:u.jsx("img",I({"data-dev-selected-currency-img":t,alt:"Selected currency image","aria-hidden":"true",className:`${t}-selected-currency-img ${T(t,"selected-currency-img")}`,src:"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>"},A(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",$(I({"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"})),f&&u.jsx("button",$(I({"data-testid":`${t}-inp-clr-btn`,"data-dev-input-clear-btn":t,type:"button",title:"Clear value",className:`${t}-input-clear-btn ${T(t,"input-clear-btn")}`},A(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",$(I({className:`${t}-option-wrp ${T(t,"option-wrp")}`,"data-dev-option-wrp":t},A(t,"option-search-wrp")),{children:u.jsxs("div",{className:`${t}-option-inner-wrp`,children:[u.jsxs("div",$(I({"data-dev-option-search-wrp":t,className:`${t}-option-search-wrp ${T(t,"option-search-wrp")}`},A(t,"option-search-wrp")),{children:[u.jsx("input",I({"data-testid":`${t}-opt-srch-inp`,"data-dev-opt-search-input":t,type:"search",className:`${t}-opt-search-input ${T(t,"opt-search-input")}`,placeholder:h.config.searchPlaceholder,autoComplete:"off",tabIndex:"-1"},A(t,"opt-search-input"))),u.jsxs("svg",$(I({className:`${t}-opt-search-icn ${T(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"},A(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"})]})),b&&u.jsx("button",$(I({"data-testid":`${t}-srch-clr-btn`,"data-dev-search-clear-btn":t,type:"button","aria-label":"Clear search",className:`${t}-search-clear-btn ${T(t,"search-clear-btn")}`,tabIndex:"-1"},A(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",$(I({className:`${t}-option-list ${T(t,"option-list")}`,tabIndex:"-1",role:"listbox","aria-label":"currency list","data-dev-option-list":t},A(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 _R({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){var m,f;let{checked:o}=t.valid;const c=t.val||(o?t.msg.checked:t.msg.unchecked),[d,h]=M.useState(c);d===t.msg.unchecked?o=!1:d===t.msg.checked&&(o=!0);const p=b=>{if(t.valid.disabled)return;b.target.checked?h(t.msg.checked):h(t.msg.unchecked);const{form:g}=b.target;validateForm({input:{name:t.name,form:g,value:b.target.checked?t.msg.checked:t.msg.unchecked}})};return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:i,fieldKey:n,fieldData:t,noLabel:!0,children:u.jsxs("div",$(I({"data-dev-cc":n,className:`${n}-cc ${T(n,"cc")}`},A(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",$(I({"data-dev-cw":n,className:`${n}-cw ${T(n,"cw")}`},A(n,"cw")),{children:[u.jsx("input",$(I($(I(I(I({"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:(m=t==null?void 0:t.info)==null?void 0:m.lbl}),"fieldName"in t&&{name:t.fieldName}),{checked:o,value:d,onChange:p})),u.jsxs("label",$(I({"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-decision`,className:`${n}-cl ${T(n,"cl")}`},A(n,"cl")),{children:[u.jsx("span",$(I({"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${T(n,"bx")}`},A(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",$(I({"data-dev-ct":n,className:`${n}-ct ${T(n,"ct")}`},A(n,"ct")),{children:u.jsx(We,{html:t.lbl||((f=t==null?void 0:t.info)==null?void 0:f.lbl)})}))]}))]}))]}))})]})}function TR({fieldKey:t,styleClasses:e,attr:s}){var o,c;const i=Z(or),{styleMode:n}=Z(ve),a=((c=(o=s.valid)==null?void 0:o.hidden)==null?void 0:c.includes(i))||!1;return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:e}),u.jsx("div",$(I({"data-dev-fld-wrp":t,className:`${t}-fld-wrp drag ${n?"":"drag"} ${a?"fld-hide":""} ${T(t,"fld-wrp")}`},A(t,"fld-wrp")),{children:u.jsx("div",I({"data-dev-divider":t,className:`${t}-divider ${T(t,"divider")}`},A(t,"divider")))}))]})}var Gt,kr,Xt,oe,Ja,zt,Zh,$e,an,Ds,Li,Fs,bs,js,ri,le,Ai,Dt,on,Ka,Vn,W,sc,to,ic,nc,wm,Wt,se,rc,_m,fe,De,ln,fr,Qh,qb,eo,Fd,Jh,Yb,Gr,sl,so,jd,Kh,Xb,cn,gr,tu,Zb,io,kd,zn,ua,ac,Tm,oc,xm,lc,Sm,yi,Ln,no,Gd,eu,Qb,ks,Ii,ge,Fe,Nt,Ft,dn,Er,ro,Bd,cc,Rm,ai,Yi,ce,_e,dc,Cm,hc,Om,Br,il,hn,br,uc,$m,su,Jb,iu,Kb,It,xt,nu,tI,oi,Xi,Je,ps,ru,eI,au,sI,ao,Ud,ou,iI,pc,Lm,Wn,pa,lu,nI,mc,Am,cu,rI,du,aI;class xR{constructor(e,s){E(this,nc);E(this,Wt);E(this,rc);E(this,fe);E(this,ln);E(this,Qh);E(this,eo);E(this,Jh);E(this,Gr);E(this,so);E(this,Kh);E(this,cn);E(this,tu);E(this,io);E(this,zn);E(this,ac);E(this,oc);E(this,lc);E(this,yi);E(this,no);E(this,eu);E(this,ks);E(this,ge);E(this,Nt);E(this,dn);E(this,ro);E(this,cc);E(this,ai);E(this,ce);E(this,dc);E(this,hc);E(this,Br);E(this,hn);E(this,uc);E(this,su);E(this,iu);E(this,It);E(this,nu);E(this,oi);E(this,Je);E(this,ru);E(this,au);E(this,ao);E(this,ou);E(this,pc);E(this,Wn);E(this,lu);E(this,mc);E(this,cu);E(this,du);E(this,Gt,null);E(this,kr,null);E(this,Xt,null);E(this,oe,null);E(this,Ja,null);E(this,zt,null);E(this,Zh,null);E(this,$e,null);E(this,an,null);E(this,Ds,null);E(this,Li,null);E(this,Fs,!1);E(this,bs,null);E(this,js,null);E(this,ri,"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>");E(this,le,"");E(this,Ai,[]);E(this,Dt,[]);E(this,on,null);E(this,Ka,{});E(this,Vn,!1);E(this,W,{separator:",",selectedOptImage:!1,dropdownIcn:"",selectedOptClearable:!0,searchClearable:!0,optionIcon:!1,defaultValue:"",placeholder:"Select an option",searchPlaceholder:"Search option",maxHeight:370,closeOnSelect:!1,showChip:!0,options:[],attributes:{},classNames:{},activeList:0,onChange:()=>{}});E(this,sc,null);E(this,to,"");E(this,ic,[]);Object.assign(r(this,W),s),S(this,on,s.document?s.document:document),S(this,Ka,s.window?s.window:window),typeof e=="string"?S(this,Gt,r(this,on).querySelector(e)):S(this,Gt,e),this.fieldKey=r(this,W).fieldKey,this.init()}init(){S(this,Xt,l(this,Wt,se).call(this,`.${this.fieldKey}-dpd-hidden-input`)),S(this,oe,l(this,Wt,se).call(this,`.${this.fieldKey}-opt-search-input`)),S(this,Ja,l(this,Wt,se).call(this,`.${this.fieldKey}-option-wrp`)),S(this,zt,l(this,Wt,se).call(this,`.${this.fieldKey}-dpd-wrp`)),S(this,Zh,l(this,Wt,se).call(this,`.${this.fieldKey}-selected-opt-wrp`)),S(this,$e,l(this,Wt,se).call(this,`.${this.fieldKey}-selected-opt-img`)),S(this,an,l(this,Wt,se).call(this,`.${this.fieldKey}-selected-opt-lbl`)),S(this,Ds,l(this,Wt,se).call(this,`.${this.fieldKey}-selected-opt-clear-btn`)),S(this,Li,r(this,W).searchClearable?l(this,Wt,se).call(this,`.${this.fieldKey}-search-clear-btn`):{});const e=`${this.fieldKey}-option-list`;l(this,It,xt).call(this,r(this,zt),"aria-controls",e),l(this,fe,De).call(this,r(this,zt),"click",s=>{l(this,mc,Am).call(this,s)}),l(this,fe,De).call(this,r(this,zt),"keyup",s=>{l(this,mc,Am).call(this,s)}),l(this,fe,De).call(this,r(this,zt),"blur",s=>{l(this,cu,rI).call(this,s)}),l(this,fe,De).call(this,r(this,Gt),"keydown",s=>{l(this,Kh,Xb).call(this,s)}),l(this,nc,wm).call(this),r(this,W).defaultValue&&this.setSelectedOption(r(this,W).defaultValue),r(this,W).defaultValue||l(this,Qh,qb).call(this),r(this,W).selectedOptImage&&(r(this,$e).src=r(this,ri)),r(this,W).searchClearable&&(l(this,ce,_e).call(this,r(this,Li),"display","none"),l(this,fe,De).call(this,r(this,Li),"click",()=>{this.searchOptions("")})),r(this,oe).placeholder=r(this,W).searchPlaceholder,r(this,oe).value="",l(this,fe,De).call(this,r(this,oe),"keyup",s=>{l(this,au,sI).call(this,s)}),S(this,Fs,r(this,W).allowCustomOption),r(this,Ka).observeElm(r(this,Xt),"value",(s,i)=>{l(this,Jh,Yb).call(this,s,i,r(this,Vn))})}setSelectedOption(e){let s=null,i=e.split(r(this,W).separator);i=i.filter(n=>l(this,zn,ua).call(this,n)),r(this,W).multipleSelect?(i.length===1?s=l(this,zn,ua).call(this,i[0]):i.length>1&&(s={lbl:`${i.length} options selected`}),r(this,W).disableOnMax&&r(this,W).mx&&i.length>=r(this,W).mx?l(this,no,Gd).call(this,!0):l(this,no,Gd).call(this,!1)):s=l(this,zn,ua).call(this,e),S(this,le,e),r(this,le)||l(this,io,kd).call(this),s&&(this.value=e,r(this,W).selectedOptImage&&(r(this,W).multipleSelect?i.length>1?(r(this,$e).src=r(this,ri),l(this,yi,Ln).call(this,r(this,$e))):i.length===1?(r(this,$e).src=s.icn||r(this,ri),l(this,yi,Ln).call(this,r(this,$e),s.icn)):(r(this,$e).src=r(this,ri),l(this,yi,Ln).call(this,r(this,$e))):(r(this,$e).src=s.icn||r(this,ri),l(this,yi,Ln).call(this,r(this,$e),s.icn))),r(this,W).multipleSelect&&r(this,W).showChip&&l(this,ac,Tm).call(this,i),r(this,W).showChip||l(this,ai,Yi).call(this,r(this,an),s.lbl),l(this,oc,xm).call(this),r(this,W).closeOnSelect&&this.setMenu({open:!1}),r(this,W).selectedOptClearable&&(l(this,ce,_e).call(this,r(this,Ds),"display","grid"),l(this,fe,De).call(this,r(this,Ds),"click",n=>{l(this,io,kd).call(this,n)})),r(this,W).onChange&&r(this,W).onChange(e),r(this,Vn)||l(this,eo,Fd).call(this,r(this,Xt),"blur"))}searchOptions(e){l(this,ou,iI).call(this,e);let s=[],i=!1;if(e){const n=r(this,W).options.length,a=[],o=e.toLowerCase();for(let d=0;d<n;d+=1){const h=r(this,W).options[d];if("type"in h)continue;const p=h.lbl.toLowerCase();if(p.includes(o)){if("groupIndex"in h&&!a.includes(h.groupIndex)){const m=h.groupIndex;a.push(m),s.push(r(this,W).options[m])}s.push(h),p===o&&(i=!0)}}const c=r(this,Ai).length;for(let d=0;d<c;d+=1){const h=r(this,Ai)[d],p=h.lbl.toLowerCase();p.includes(o)&&(s.push(h),p===o&&(i=!0))}s.length||(s=[{i:"not-found",lbl:"No Option Found"}]),S(this,Dt,r(this,Fs)?[r(this,W).options[0]]:[]),r(this,Dt).push(...s),r(this,W).searchClearable&&l(this,ce,_e).call(this,r(this,Li),"display","grid")}else S(this,Dt,r(this,W).options),r(this,W).searchClearable&&l(this,ce,_e).call(this,r(this,Li),"display","none"),r(this,Fs)&&(S(this,bs,l(this,Wt,se).call(this,`${l(this,cn,gr).call(this)} .create-opt`)),l(this,ce,_e).call(this,r(this,bs),"display","none"),S(this,Dt,r(this,Dt).concat(r(this,Ai))));if(l(this,hn,br).call(this),S(this,bs,l(this,Wt,se).call(this,`${l(this,cn,gr).call(this)} .create-opt`)),i&&r(this,Fs))l(this,ce,_e).call(this,r(this,bs),"display","none");else if(r(this,Fs)&&e.trim()){l(this,ce,_e).call(this,r(this,bs),"display","block");const n=r(this,bs).querySelector(".opt-lbl");n.innerText=`Create: ${e}`,l(this,It,xt).call(this,r(this,bs),"data-value",e)}}setMenu({open:e}){l(this,ce,_e).call(this,r(this,Ja),"max-height",`${e?r(this,W).maxHeight:0}px`),e?(l(this,lu,nI).call(this),l(this,Nt,Ft).call(this,r(this,Gt),"menu-open"),l(this,fe,De).call(this,r(this,on),"click",s=>l(this,pc,Lm).call(this,s)),l(this,ge,Fe).call(this,r(this,oe),0),l(this,ge,Fe).call(this,r(this,Li),0),r(this,zt).setAttribute("aria-expanded","true"),l(this,It,xt).call(this,r(this,js),"aria-hidden",!1),l(this,It,xt).call(this,r(this,oe),"aria-hidden",!1),l(this,hn,br).call(this),l(this,nu,tI).call(this,r(this,oe),"inert")):(l(this,dn,Er).call(this,r(this,Gt),"menu-open"),r(this,on).removeEventListener("click",l(this,pc,Lm)),setTimeout(()=>{this.searchOptions("")},100),l(this,ge,Fe).call(this,r(this,oe),-1),l(this,ge,Fe).call(this,r(this,Li),-1),r(this,zt).setAttribute("aria-expanded","false"),r(this,zt).removeAttribute("aria-activedescendant"),l(this,It,xt).call(this,r(this,js),"aria-hidden",!0),l(this,It,xt).call(this,r(this,oe),"aria-hidden",!0),l(this,It,xt).call(this,r(this,oe),"inert","")),l(this,iu,Kb).call(this)}set activelist(e){const s=l(this,Wt,se).call(this,`.${this.fieldKey}-option-list[data-list="${e}"]`);if(s){const i=s.getAttribute("data-list-index");r(this,W).activeList=i,this.setSelectedOption(""),l(this,nc,wm).call(this)}}set disabled(e){String(e).toLowerCase()==="true"?(r(this,Gt).classList.add("disabled"),r(this,Xt).disabled=!0,l(this,ge,Fe).call(this,r(this,zt),-1),l(this,ge,Fe).call(this,r(this,Ds),-1),l(this,It,xt).call(this,r(this,zt),"aria-label","Dropdown disabled"),this.setMenu({open:!1})):String(e).toLowerCase()==="false"&&(l(this,dn,Er).call(this,r(this,Gt),"disabled"),r(this,Xt).removeAttribute("disabled"),l(this,ge,Fe).call(this,r(this,zt),0),l(this,ge,Fe).call(this,r(this,Ds),0),l(this,It,xt).call(this,r(this,zt),"aria-label",r(this,W).placeholder))}get disabled(){return r(this,Xt).disabled}set readonly(e){String(e).toLowerCase()==="true"?(l(this,Nt,Ft).call(this,r(this,Gt),"disabled"),r(this,Xt).readOnly=!0,l(this,ge,Fe).call(this,r(this,zt),-1),l(this,ge,Fe).call(this,r(this,Ds),-1),this.setMenu({open:!1})):String(e).toLowerCase()==="false"&&(l(this,dn,Er).call(this,r(this,Gt),"disabled"),r(this,Xt).removeAttribute("readonly"),l(this,ge,Fe).call(this,r(this,zt),0),l(this,ge,Fe).call(this,r(this,Ds),0))}get readonly(){return r(this,Xt).readOnly}set value(e){r(this,Xt).value=e,l(this,It,xt).call(this,r(this,Xt),"value",e)}get value(){return r(this,Xt).value}destroy(){this.value="",l(this,du,aI).call(this)}reset(){S(this,Vn,!0),l(this,io,kd).call(this),this.destroy(),this.init(),setTimeout(()=>{S(this,Vn,!1)},1)}}Gt=new WeakMap,kr=new WeakMap,Xt=new WeakMap,oe=new WeakMap,Ja=new WeakMap,zt=new WeakMap,Zh=new WeakMap,$e=new WeakMap,an=new WeakMap,Ds=new WeakMap,Li=new WeakMap,Fs=new WeakMap,bs=new WeakMap,js=new WeakMap,ri=new WeakMap,le=new WeakMap,Ai=new WeakMap,Dt=new WeakMap,on=new WeakMap,Ka=new WeakMap,Vn=new WeakMap,W=new WeakMap,sc=new WeakMap,to=new WeakMap,ic=new WeakMap,nc=new WeakSet,wm=function(){const e=l(this,Wt,se).call(this,`.${this.fieldKey}-option-list[data-list-index="${r(this,W).activeList}"]`);S(this,js,l(this,Wt,se).call(this,`.${this.fieldKey}-option-list.active-list`)),r(this,js).innerHTML=e.innerHTML,l(this,It,xt).call(this,r(this,js),"id",`${this.fieldKey}-option-list`),l(this,su,Jb).call(this),r(this,W).options=l(this,tu,Zb).call(this),S(this,Dt,[...r(this,W).options]),l(this,fe,De).call(this,r(this,js),"scroll",s=>s.stopPropagation())},Wt=new WeakSet,se=function(e,s){return s?s.querySelector(e):r(this,Gt).querySelector(e)},rc=new WeakSet,_m=function(e){return r(this,Gt).querySelectorAll(e)},fe=new WeakSet,De=function(e,s,i){e==null||e.addEventListener(s,i),r(this,ic).push({selector:e,eventType:s,cb:i})},ln=new WeakSet,fr=function(e,s){e.appendChild(s)},Qh=new WeakSet,qb=function(){r(this,Xt).value&&(this.setSelectedOption(r(this,Xt).value),l(this,hn,br).call(this))},eo=new WeakSet,Fd=function(e,s){const i=new Event(s);e.dispatchEvent(i)},Jh=new WeakSet,Yb=function(e,s){e!==s&&this.setSelectedOption(s),typeof bit_conditionals!="undefined"&&bit_conditionals({target:r(this,Xt)})},Gr=new WeakSet,sl=function(e=-1,s){if(s==="next"){const i=r(this,Dt).length;for(let n=e+1;n<i;n+=1){const a=r(this,Dt)[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,Dt)[i];if(n.type!=="group"&&!n.disabled&&!n.disableOnMax)return i}},so=new WeakSet,jd=function(e){return l(this,Wt,se).call(this,`${l(this,cn,gr).call(this)} .option[data-index="${e}"]`)},Kh=new WeakSet,Xb=function(e){const s=r(this,on).activeElement;let i=null;if(l(this,Wn,pa).call(this)){const a=Number(s.dataset.index||-1);if(e.key==="ArrowDown"||!e.shiftKey&&e.key==="Tab"){e.preventDefault();let o=0,c=null;s===r(this,oe)?(o=l(this,Gr,sl).call(this,-1,"next"),r(this,Fs)&&o===0&&l(this,ro,Bd).call(this,r(this,bs))!=="block"&&(o=1),c=l(this,so,jd).call(this,o)):s.classList.contains("option")&&(o=l(this,Gr,sl).call(this,a,"next"),c=l(this,so,jd).call(this,o)),c&&(i=c)}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,oe))i=r(this,zt),l(this,Wn,pa).call(this)&&this.setMenu({open:!1});else if(s.classList.contains("option")){let o=l(this,Gr,sl).call(this,a,"previous");l(this,ao,Ud)&&o===0&&l(this,ro,Bd).call(this,r(this,bs))!=="block"&&(o=-1);const c=l(this,so,jd).call(this,o);c?i=c:c||(i=r(this,oe))}}else e.key==="Escape"&&this.setMenu({open:!1})}else if(e.key>="a"&&e.key<="z"){clearTimeout(r(this,sc)),S(this,to,r(this,to)+e.key),S(this,sc,setTimeout(()=>{S(this,to,"")},300));const a=r(this,W).options.find(o=>o.type!=="group"&&!o.disabled&&o.lbl.toLowerCase().startsWith(r(this,to)));a&&this.setSelectedOption(a.val)}else if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(r(this,W).multipleSelect)return;e.preventDefault();const a=l(this,eu,Qb).call(this),o=e.key==="ArrowDown"?"next":"previous";let c=l(this,Gr,sl).call(this,a,o);r(this,Fs)&&c===0&&(c=1),c>-1&&c<r(this,W).options.length&&(this.value=r(this,W).options[c].val)}else if((e.key==="ArrowRight"||e.key==="ArrowLeft")&&s.classList.contains("chip-clear-btn")){let o=null;e.key==="ArrowRight"?o=s.parentElement.nextElementSibling:e.key==="ArrowLeft"&&(o=s.parentElement.previousElementSibling),o&&(i=l(this,Wt,se).call(this,".chip-clear-btn",o))}if(i)if(i.focus({preventScroll:!0}),i.classList.contains("option")){const a=i.getAttribute("id");a&&l(this,It,xt).call(this,r(this,zt),"aria-activedescendant",a)}else r(this,zt).removeAttribute("aria-activedescendant")},cn=new WeakSet,gr=function(){return`.${this.fieldKey}-option-list.active-list`},tu=new WeakSet,Zb=function(){const e=Array.from(l(this,rc,_m).call(this,`${l(this,cn,gr).call(this)} .option`)),s=a=>{const o={},c=a.querySelector(".opt-lbl"),{value:d}=a.dataset;o.lbl=c.textContent,d?o.val=d:o.val=o.lbl,l(this,cc,Rm).call(this,a,"disabled-opt")&&(o.disabled=!0);const h=a.querySelector(".opt-icn");r(this,W).optionIcon&&(h!=null&&h.src)&&(o.icn=h.src);const{attributes:p}=a,m=p.length;o.attributes={};for(let f=0;f<m;f+=1){const b=p[f].nodeName;o.attributes[b]=a.getAttribute(b)}return o},i=[],{length:n}=e;for(let a=0;a<n;a+=1){const o=e[a];let c={},d=null;if(o.classList.contains("opt-group-title")){c=s(o),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 m=s(p);m.groupIndex=d,a=h,i.push(m)}else{a=h-1;break}}}else c=s(o),i.push(c)}return i},io=new WeakSet,kd=function(e){e==null||e.stopPropagation(),S(this,le,""),r(this,W).selectedOptImage&&(r(this,$e).src=r(this,ri),l(this,yi,Ln).call(this,r(this,$e))),this.value="",r(this,W).multipleSelect&&r(this,W).showChip&&l(this,ac,Tm).call(this,[]),r(this,W).showChip||l(this,ai,Yi).call(this,r(this,an),r(this,W).placeholder),l(this,oc,xm).call(this),r(this,W).selectedOptClearable&&l(this,ce,_e).call(this,r(this,Ds),"display","none"),l(this,no,Gd).call(this),r(this,Vn)||l(this,eo,Fd).call(this,r(this,Xt),"blur")},zn=new WeakSet,ua=function(e){return[...r(this,W).options,...r(this,Ai)].find(s=>s.val===e)},ac=new WeakSet,Tm=function(e){if(l(this,ai,Yi).call(this,r(this,an),""),!e.length){r(this,W).selectedOptImage&&l(this,ce,_e).call(this,r(this,$e),"display","block"),l(this,ai,Yi).call(this,r(this,an),r(this,W).placeholder);return}r(this,W).selectedOptImage&&l(this,ce,_e).call(this,r(this,$e),"display","none"),e.forEach((s,i)=>{var g,v,w,x,_,R,C,O;const n=l(this,ks,Ii).call(this,"div");l(this,Nt,Ft).call(this,n,"chip-wrp");const a=(g=r(this,W).customClasses)==null?void 0:g["chip-wrp"];a&&l(this,oi,Xi).call(this,n,a);const o=(v=r(this,W).customAttributes)==null?void 0:v["chip-wrp"];if(o&&l(this,Je,ps).call(this,n,o),"chip-wrp"in r(this,W).attributes){const y=r(this,W).attributes["chip-wrp"];l(this,Je,ps).call(this,n,y)}if(r(this,W).selectedOptImage&&r(this,W).optionIcon){const y=l(this,ks,Ii).call(this,"img");if(l(this,Nt,Ft).call(this,y,"chip-icn"),"chip-icn"in r(this,W).attributes){const H=r(this,W).attributes["chip-icn"];l(this,Je,ps).call(this,y,H)}const D=l(this,zn,ua).call(this,s);l(this,It,xt).call(this,y,"src",D.icn||r(this,ri)),l(this,yi,Ln).call(this,y,D.icn),l(this,It,xt).call(this,y,"alt",D.lbl);const L=(w=r(this,W).customClasses)==null?void 0:w["chip-icn"];L&&l(this,oi,Xi).call(this,y,L);const F=(x=r(this,W).customAttributes)==null?void 0:x["chip-icn"];F&&l(this,Je,ps).call(this,y,F),l(this,ln,fr).call(this,n,y)}const c=l(this,ks,Ii).call(this,"span");if(l(this,Nt,Ft).call(this,c,"chip-lbl"),"chip-lbl"in r(this,W).attributes){const y=r(this,W).attributes["chip-lbl"];l(this,Je,ps).call(this,c,y)}const d=(_=r(this,W).customClasses)==null?void 0:_["chip-lbl"];d&&l(this,oi,Xi).call(this,c,d);const h=(R=r(this,W).customAttributes)==null?void 0:R["chip-lbl"];h&&l(this,Je,ps).call(this,c,h);const p=l(this,zn,ua).call(this,s);l(this,ai,Yi).call(this,c,p?p.lbl:s),l(this,ln,fr).call(this,n,c);const m=l(this,ks,Ii).call(this,"button");if(l(this,Nt,Ft).call(this,m,"chip-clear-btn"),"chip-clear-btn"in r(this,W).attributes){const y=r(this,W).attributes["chip-clear-btn"];l(this,Je,ps).call(this,m,y)}const f=(C=r(this,W).customClasses)==null?void 0:C["chip-clear-btn"];f&&l(this,oi,Xi).call(this,m,f);const b=(O=r(this,W).customAttributes)==null?void 0:O["chip-clear-btn"];b&&l(this,Je,ps).call(this,m,b),m.innerHTML=r(this,Ds).innerHTML,l(this,fe,De).call(this,m,"click",y=>{l(this,lc,Sm).call(this,y,i)}),l(this,fe,De).call(this,m,"keyup",y=>{y.key==="Backspace"&&l(this,lc,Sm).call(this,y,i)}),l(this,ln,fr).call(this,n,m),l(this,ln,fr).call(this,r(this,an),n)})},oc=new WeakSet,xm=function(){if(S(this,kr,r(this,Gt).parentElement),!!r(this,kr)){if(!r(this,le)){r(this,kr).style.removeProperty("min-height");return}l(this,ce,_e).call(this,r(this,kr),"min-height",`${r(this,Gt).offsetHeight-r(this,Ja).offsetHeight}px`)}},lc=new WeakSet,Sm=function(e,s){e.stopPropagation();const i=r(this,le).split(r(this,W).separator);i.splice(s,1),this.setSelectedOption(i.join(r(this,W).separator)),l(this,hn,br).call(this)},yi=new WeakSet,Ln=function(e=null,s=0){s?l(this,dn,Er).call(this,e,"placeholder-img"):l(this,Nt,Ft).call(this,e,"placeholder-img")},no=new WeakSet,Gd=function(e=!1){if(e){const s=r(this,le).split(r(this,W).separator);S(this,Dt,r(this,Dt).map(i=>{const n=i;return!i.disabled&&!s.includes(i.val)?n.disableOnMax=!0:n.disableOnMax=!1,n}))}else S(this,Dt,r(this,Dt).map(s=>{const i=s;return delete i.disableOnMax,i}));l(this,hn,br).call(this)},eu=new WeakSet,Qb=function(){return r(this,Dt).findIndex(e=>e.val===r(this,le))},ks=new WeakSet,Ii=function(e){return r(this,on).createElement(e)},ge=new WeakSet,Fe=function(e,s){e&&(e.tabIndex=s)},Nt=new WeakSet,Ft=function(e,s){e.classList.add(s)},dn=new WeakSet,Er=function(e,s){e.classList.remove(s)},ro=new WeakSet,Bd=function(e){return(e==null?void 0:e.style.display)||""},cc=new WeakSet,Rm=function(e,s){return e.classList.contains(s)},ai=new WeakSet,Yi=function(e,s){e.textContent=s},ce=new WeakSet,_e=function(e,s,i){e.style.setProperty(s,i,"important")},dc=new WeakSet,Cm=function(e){return e&&e.split(r(this,W).separator)||[]},hc=new WeakSet,Om=function(e){return e.join(r(this,W).separator)},Br=new WeakSet,il=function(e){e.stopPropagation();const s=e.currentTarget,i=s.dataset.value;if(r(this,Fs)&&s.classList.contains("create-opt")&&l(this,ao,Ud).call(this,i),r(this,W).multipleSelect){const n=l(this,dc,Cm).call(this,r(this,le));if(n.includes(i)){const o=n.indexOf(i);n.splice(o,1),l(this,dn,Er).call(this,s,"selected-opt")}else n.push(i),l(this,Nt,Ft).call(this,s,"selected-opt");S(this,le,l(this,hc,Om).call(this,n))}else{const n=l(this,Wt,se).call(this,".selected-opt");n&&l(this,dn,Er).call(this,n,"selected-opt"),l(this,Nt,Ft).call(this,s,"selected-opt"),S(this,le,i)}this.setSelectedOption(r(this,le)),setTimeout(()=>{l(this,Wt,se).call(this,`${l(this,cn,gr).call(this)} .option[data-value="${i}"]`).focus()},0)},hn=new WeakSet,br=function(){l(this,ru,eI).call(this)},uc=new WeakSet,$m=function(){return l(this,rc,_m).call(this,`${l(this,cn,gr).call(this)} .option:not(.opt-group-title):not(.create-opt)`)},su=new WeakSet,Jb=function(){const e=l(this,uc,$m).call(this),s=e.length;for(let i=0;i<s;i+=1){const n=e[i];l(this,fe,De).call(this,n,"click",a=>{l(this,Br,il).call(this,a)}),l(this,fe,De).call(this,n,"keyup",a=>{a.key==="Enter"&&l(this,Br,il).call(this,a)})}},iu=new WeakSet,Kb=function(){const e=l(this,uc,$m).call(this),s=l(this,Wn,pa).call(this),i=e.length;for(let n=0;n<i;n+=1){const a=e[n];s?l(this,ge,Fe).call(this,a,0):l(this,ge,Fe).call(this,a,-1)}},It=new WeakSet,xt=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},nu=new WeakSet,tI=function(e,s){e==null||e.removeAttribute(s)},oi=new WeakSet,Xi=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>l(this,Nt,Ft).call(this,e,i))},Je=new WeakSet,ps=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)l(this,It,xt).call(this,e,s[n].key,s[n].value)},ru=new WeakSet,eI=function(){r(this,js).innerHTML="";const e=r(this,le).split(r(this,W).separator),s=r(this,Dt).length;for(let i=0;i<s;i+=1){const n=r(this,Dt)[i],a=l(this,ks,Ii).call(this,"li");if(n.i==="not-found"){l(this,ai,Yi).call(this,a,n.lbl),l(this,Nt,Ft).call(this,a,"opt-not-found"),l(this,ln,fr).call(this,r(this,js),a);return}l(this,Nt,Ft).call(this,a,"option");const o=l(this,ks,Ii).call(this,"span");if(l(this,Nt,Ft).call(this,o,"opt-lbl-wrp"),"opt-lbl-wrp"in r(this,W).classNames){const h=r(this,W).classNames["opt-lbl-wrp"];h&&l(this,oi,Xi).call(this,o,h)}if("opt-lbl-wrp"in r(this,W).attributes){const h=r(this,W).attributes["opt-lbl-wrp"];l(this,Je,ps).call(this,o,h)}if(r(this,W).optionIcon){const h=l(this,ks,Ii).call(this,"img");if(l(this,Nt,Ft).call(this,h,"opt-icn"),"opt-icn"in r(this,W).classNames){const p=r(this,W).classNames["opt-icn"];p&&l(this,oi,Xi).call(this,h,p)}if("opt-icn"in r(this,W).attributes){const p=r(this,W).attributes["opt-icn"];l(this,Je,ps).call(this,h,p)}h.src=n.icn||r(this,ri),l(this,yi,Ln).call(this,h,n.icn),h.alt=n.lbl,h.loading="lazy",o.append(h)}const c=l(this,ks,Ii).call(this,"span");if(l(this,Nt,Ft).call(this,c,"opt-lbl"),"opt-lbl"in r(this,W).classNames){const h=r(this,W).classNames["opt-lbl"];h&&l(this,oi,Xi).call(this,c,h)}if("opt-lbl"in r(this,W).attributes){const h=r(this,W).attributes["opt-lbl"];l(this,Je,ps).call(this,c,h)}l(this,ai,Yi).call(this,c,n.lbl),o.append(c);const d=l(this,ks,Ii).call(this,"span");if(l(this,Nt,Ft).call(this,d,"opt-prefix"),"opt-prefix"in r(this,W).classNames){const h=r(this,W).classNames["opt-prefix"];h&&l(this,oi,Xi).call(this,d,h)}if("opt-prefix"in r(this,W).attributes){const h=r(this,W).attributes["opt-prefix"];l(this,Je,ps).call(this,c,h)}l(this,ai,Yi).call(this,d,n.code),a.append(o,d),Object.keys(n.attributes).map(h=>{l(this,It,xt).call(this,a,h,n.attributes[h])}),e.includes(n.val)?(l(this,Nt,Ft).call(this,a,"selected-opt"),l(this,It,xt).call(this,a,"aria-selected",!0)):l(this,It,xt).call(this,a,"aria-selected",!1),n.type==="group"?l(this,Nt,Ft).call(this,a,"opt-group-title"):("groupIndex"in n&&l(this,Nt,Ft).call(this,a,"opt-group-child"),l(this,It,xt).call(this,a,"data-index",i),l(this,It,xt).call(this,a,"data-value",n.val),l(this,It,xt).call(this,a,"role","option"),l(this,It,xt).call(this,a,"id",`${this.fieldKey}-opt-${i}`),l(this,It,xt).call(this,a,"aria-posinset",i+1),l(this,It,xt).call(this,a,"aria-setsize",r(this,Dt).length),l(this,ge,Fe).call(this,a,l(this,Wn,pa).call(this)?"0":"-1"),n.disabled?(l(this,Nt,Ft).call(this,a,"disabled-opt"),l(this,It,xt).call(this,a,"aria-disabled","true")):n.disableOnMax?(l(this,Nt,Ft).call(this,a,"disable-on-max"),l(this,It,xt).call(this,a,"aria-disabled","true")):(l(this,fe,De).call(this,a,"click",h=>{l(this,Br,il).call(this,h)}),l(this,fe,De).call(this,a,"keyup",h=>{h.key==="Enter"&&l(this,Br,il).call(this,h)}))),l(this,ln,fr).call(this,r(this,js),a)}},au=new WeakSet,sI=function(e){var s;if(e.stopPropagation(),e.key==="Enter"&&r(this,Dt).length){const i=(s=r(this,Dt))==null?void 0:s[0].i;if(i&&(this.setSelectedOption(i),this.searchOptions("")),r(this,Fs)&&l(this,ro,Bd).call(this,r(this,bs))!=="none"){const{value:n}=e.target;if(l(this,ao,Ud).call(this,n),r(this,W).multipleSelect){const a=l(this,dc,Cm).call(this,r(this,le));a.push(n),S(this,le,l(this,hc,Om).call(this,a))}else S(this,le,n);l(this,hn,br).call(this),this.setSelectedOption(r(this,le))}}else this.searchOptions(e.target.value)},ao=new WeakSet,Ud=function(e){let s=e.trim();if(s.includes&&s){const i=r(this,Ai).length;for(let n=0;n<i;n+=1)if(r(this,Ai)[n].lbl.toLowerCase()===s){s="";break}if(s){const n={lbl:s,val:s};n.attributes={},r(this,Ai).push(n),r(this,Dt).push(n),this.searchOptions("")}}},ou=new WeakSet,iI=function(e){r(this,oe).value=e},pc=new WeakSet,Lm=function(e){r(this,Gt).contains(e.target)||this.setMenu({open:!1})},Wn=new WeakSet,pa=function(){return l(this,cc,Rm).call(this,r(this,Gt),"menu-open")},lu=new WeakSet,nI=function(){const e=r(this,zt).getBoundingClientRect(),s=e.top,i=r(this,Ka).innerHeight-e.bottom;i<s&&i<r(this,W).maxHeight?(l(this,ce,_e).call(this,r(this,Gt),"flex-direction","column-reverse"),l(this,ce,_e).call(this,r(this,Gt),"bottom","0%")):(l(this,ce,_e).call(this,r(this,Gt),"flex-direction","column"),l(this,ce,_e).call(this,r(this,Gt),"bottom","auto"))},mc=new WeakSet,Am=function(e){e.code==="Space"&&(r(this,oe).focus(),this.setMenu({open:!0})),e.type==="click"&&(l(this,Wn,pa).call(this)?this.setMenu({open:!1}):(r(this,oe).focus(),this.setMenu({open:!0})))},cu=new WeakSet,rI=function(e){var s;(s=e.target.parentElement)!=null&&s.contains(e.relatedTarget)||l(this,eo,Fd).call(this,r(this,Xt),"blur")},du=new WeakSet,aI=function(){r(this,ic).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};function SR({fieldKey:t,formID:e,styleClasses:s,attr:i,onBlurHandler:n,resetFieldValue:a,isBuilder:o}){const[c,d]=M.useState(null),h=M.useRef(null),m=Z(Lt)[t],{optionsList:f,ph:b}=m,{activeList:g,optionIcon:v,allowCustomOption:w}=m.config;M.useEffect(()=>{if(!c)return;const _=h.current;_&&c&&"destroy"in _&&_.destroy();const{selectedOptImage:R,selectedOptClearable:C,searchClearable:O,searchPlaceholder:y,maxHeight:D,multipleSelect:L,showChip:F,selectedOptImgSrc:H,closeOnSelect:B}=m.config,k=document.getElementById("bit-grid-layout").contentWindow,X={fieldKey:t,selectedOptImage:R,selectedOptClearable:C,searchClearable:O,allowCustomOption:w,optionIcon:v,maxHeight:D,multipleSelect:L,showChip:F,placeholder:b,searchPlaceholder:y,selectedOptImgSrc:H,closeOnSelect:B,activeList:g,document:document.getElementById("bit-grid-layout").contentDocument,window:k,attributes:{"opt-lbl-wrp":_t(t,"opt-lbl-wrp"),"opt-icn":_t(t,"opt-icn"),"opt-lbl":_t(t,"opt-lbl"),"opt-prefix":_t(t,"opt-prefix"),"chip-wrp":_t(t,"chip-wrp"),"chip-lbl":_t(t,"chip-lbl"),"chip-icn":_t(t,"chip-icn"),"chip-clear-btn":_t(t,"chip-clear-btn")},classNames:{"opt-lbl-wrp":T(t,"opt-lbl-wrp"),"opt-icn":T(t,"opt-icn"),"opt-lbl":T(t,"opt-lbl"),"opt-prefix":T(t,"opt-prefix")}};k.observeElm||(k.observeElm=Rp),h.current=new xR(c,X)},[m,c]);const x=f.reduce((_,R)=>{const[C,O]=Object.entries(R)[0];return $(I({},_),{[C]:O})},{});return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:s}),u.jsx(Tt,{formID:e,fieldKey:t,fieldData:i,children:u.jsx("div",{className:`${t}-dpd-fld-container ${T(t,"dpd-fld-container")}`,children:u.jsxs("div",$(I({"data-dev-dpd-fld-wrp":t,className:`${t}-dpd-fld-wrp ${T(t,"dpd-fld-wrp")} ${m.valid.disabled?"disabled":""} ${m.valid.readonly?"readonly":""}`,ref:d},A(t,"dpd-fld-wrp")),{children:[u.jsx("input",I(I({"data-testid":`${t}-dpd-hdn-inp`,name:t,type:"hidden",className:`${t}-dpd-hidden-input ${T(t,"dpd-hidden-input")}`},"disabled"in m.valid&&{disabled:m.valid.disabled}),"readonly"in m.valid&&{readOnly:m.valid.readonly})),u.jsxs("div",$(I({"data-testid":`${t}-dpd-wrp`,"data-dev-dpd-wrp":t,className:`${t}-dpd-wrp ${T(t,"dpd-wrp")}`,role:"combobox","aria-controls":"","aria-live":"assertive","aria-expanded":"false",tabIndex:"0","aria-label":"Dropdown"},A(t,"dpd-wrp")),{children:[u.jsxs("div",{"data-testid":`${t}-slctd-opt-wrp`,className:`${t}-selected-opt-wrp ${T(t,"selected-opt-wrp")}`,children:[m.config.selectedOptImage&&u.jsx("img",I({"data-testid":`${t}-slctd-opt-img`,"data-dev-selected-opt-img":t,className:`${t}-selected-opt-img placeholder-img ${T(t,"selected-opt-img")}`,"aria-hidden":"true",alt:"selected option icon",src:"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>"},A(t,"selected-opt-img"))),u.jsx("span",$(I({"data-testid":`${t}-slctd-opt-lbl`,"aria-label":"Selected Option Label","data-dev-selected-opt-lbl":t,className:`${t}-selected-opt-lbl ${m.config.multipleSelect&&m.config.showChip?"multi-chip":""} ${T(t,"selected-opt-lbl")}`},A(t,"selected-opt-lbl")),{children:b}))]}),u.jsxs("div",{"data-testid":`${t}-dpd-btn-wrp`,className:`${t}-dpd-btn-wrp ${T(t,"dpd-btn-wrp")}`,children:[u.jsx("button",$(I({"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 ${T(t,"selected-opt-clear-btn")}`},A(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 ${T(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",$(I({className:`${t}-option-wrp ${T(t,"option-wrp")}`,"data-dev-option-wrp":t},A(t,"option-search-wrp")),{children:u.jsxs("div",{className:`${t}-option-inner-wrp ${T(t,"option-inner-wrp")}`,children:[u.jsxs("div",{"data-dev-option-search-wrp":t,className:`${t}-option-search-wrp ${T(t,"option-search-wrp")}`,children:[u.jsx("input",I({"data-testid":`${t}-opt-srch-inp`,type:"search","data-dev-opt-search-input":t,className:`${t}-opt-search-input ${T(t,"opt-search-input")}`,placeholder:"Search Country","aria-label":"Search Options","aria-hidden":"true",tabIndex:"-1"},A(t,"opt-search-input"))),u.jsxs("svg",$(I({"data-dev-opt-search-icn":t,className:`${t}-icn ${t}-opt-search-icn ${T(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"},A(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",$(I({"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 ${T(t,"search-clear-btn")}`,tabIndex:"-1"},A(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(x).map(([_,R],C)=>u.jsxs("ul",$(I({className:`${t}-option-list ${T(t,"option-list")}`,"aria-hidden":"true","aria-label":"Option List","data-list":_,"data-list-index":C,"data-dev-option-list":t,tabIndex:"-1",role:"listbox"},A(t,"option-list")),{children:[w&&u.jsxs("li",$(I({"data-testid":`${t}-opt-${C}`,"data-dev-option":t,"data-index":C,"data-value":"create-opt",className:"option create-opt",role:"option","aria-selected":"false",tabIndex:"-1"},A(t,"option")),{style:{display:"none"},children:[u.jsx("span",$(I({"data-dev-opt-lbl-wrp":t,className:`opt-lbl-wrp ${T(t,"opt-lbl-wrp")}`},A(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-${_}`),u.jsx(oI,{opts:R,fieldKey:t,optionIcon:v})]}),_)),u.jsx("ul",I({className:`${t}-option-list ${T(t,"option-list")} active-list`,"aria-hidden":"true","aria-label":"Option List","data-dev-option-list":t,tabIndex:"-1",role:"listbox"},A(t,"option-list")))]})}))]}))})})]})}var RR=M.memo(SR);const oI=({opts:t,fieldKey:e,optionIcon:s,isGroupChild:i})=>u.jsx(u.Fragment,{children:t.map((n,a)=>n.type==="group"?u.jsxs(M.Fragment,{children:[u.jsx("li",$(I({"data-testid":`${e}-opt-${a}`,"data-index":a,className:`option opt-group-title ${T(e,"opt-group-title")}`},A(e,"opt-group-title")),{children:u.jsx("span",{className:"opt-lbl",children:n.title})}),`option-grp-ttl-${n.title}`),u.jsx(oI,{opts:n.childs,fieldKey:e,optionIcon:s,isGroupChild:!0})]},n.title):u.jsxs("li",$(I({"data-testid":`${e}-opt-${a}`,"data-dev-option":e,"data-index":a,"data-value":n.val||n.lbl,className:`option ${i?`opt-group-child ${T(e,"option-group-child")}`:""}`,role:"option","aria-selected":"false",tabIndex:"-1"},A(e,"option")),{children:[u.jsxs("span",$(I({"data-dev-opt-lbl-wrp":e,className:`opt-lbl-wrp ${T(e,"opt-lbl-wrp")}`},A(e,"opt-lbl-wrp")),{children:[s&&u.jsx("img",{className:`opt-icn ${T(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 CR({fieldKey:t,attr:e,formID:s,styleClasses:i}){const a=Z(Lt)[t],o=(a==null?void 0:a.config)||{},c=Math.min(8,Math.max(4,o.otpLength||6));return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:i}),u.jsx(Tt,{formID:s,fieldKey:t,fieldData:e,children:u.jsxs("div",$(I({"data-testid":`${t}-inp-fld-wrp`,"data-dev-inp-fld-wrp":t,className:`${t}-inp-fld-wrp ${T(t,"inp-fld-wrp")}`},A(t,"inp-fld-wrp")),{children:[u.jsx("div",{className:`${t}-otp-boxes-wrp ${T(t,"otp-boxes-wrp")}`,"data-dev-otp-boxes-wrp":t,children:Array.from({length:c}).map((d,h)=>u.jsx("input",I({type:"text",inputMode:"numeric",maxLength:1,readOnly:!0,className:`${t}-otp-box ${t}-fld ${T(t,"otp-box")}`,"data-dev-otp-box":t,"aria-label":`OTP digit ${h+1}`},A(t,"otp-box")),h))}),u.jsxs("div",{className:`${t}-otp-actions-wrp ${T(t,"otp-actions-wrp")}`,"data-dev-otp-actions-wrp":t,children:[u.jsx("button",$(I({type:"button",className:`${t}-send-otp-btn ${T(t,"send-otp-btn")}`,"data-testid":`${t}-send-otp-btn`,"data-dev-send-otp-btn":t},A(t,"send-otp-btn")),{children:o.sendBtnTxt||Pe("Send OTP")})),u.jsx("div",$(I({className:`${t}-resend-wrp ${T(t,"resend-wrp")}`,"data-testid":`${t}-resend-wrp`,"data-dev-resend-wrp":t},A(t,"resend-wrp")),{children:u.jsx("span",{className:`${t}-wait-txt ${T(t,"wait-txt")}`,"data-dev-wait-txt":t,children:(()=>{const d=o.waitTxt||Pe("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:o.resendDelay||60}),h[1]]}):d})()})})),u.jsx("button",$(I({type:"button",className:`${t}-verify-btn ${T(t,"verify-btn")}`,"data-testid":`${t}-verify-btn`,"data-dev-verify-btn":t},A(t,"verify-btn")),{children:o.verifyBtnTxt||Pe("Verify OTP")}))]})]}))})]})}var Ur,hu,fc,li,oo,uu,Mi,Zt,Ni,Be,gc,lo,Ec,bc,Gs,Bt,Ue,ci,un,de,pu,lI,Ic,ym,mu,cI,fu,dI,co,Vd,ho,zd,vc,Mm,gu,hI,Eu,Is,Qs,bu,uI,wc,Nm,Ke,ms,Iu,pI,Vr,nl,Ee,je,uo,Wd,pn,Ir,Pi,An,Bs,vi,Us,wi,vu,mI,wu,fI,_u,gI,_c,Pm;class OR{constructor(e,s){E(this,pu);E(this,Ic);E(this,mu);E(this,fu);E(this,co);E(this,ho);E(this,vc);E(this,gu);E(this,Is);E(this,bu);E(this,wc);E(this,Ke);E(this,Iu);E(this,Vr);E(this,Ee);E(this,uo);E(this,pn);E(this,Pi);E(this,Bs);E(this,Us);E(this,vu);E(this,wu);E(this,_u);E(this,_c);E(this,Ur,null);E(this,hu,null);E(this,fc,null);E(this,li,null);E(this,oo,null);E(this,uu,null);E(this,Mi,null);E(this,Zt,null);E(this,Ni,null);E(this,Be,{});E(this,gc,[]);E(this,lo,null);E(this,Ec,{});E(this,bc,"");E(this,Gs,{});E(this,Bt,{});E(this,Ue,"");E(this,ci,"");E(this,un,[]);E(this,de,{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:()=>{}});E(this,Eu,e=>{const s=e.target.getAttribute("data-file-id");l(this,wc,Nm).call(this,`#file-wrp-${s}`),delete r(this,Be)[s];const i=Object.keys(r(this,Be)).length;i?r(this,li).innerText=`${i} file${i>1?"s":""} selected`:(r(this,li).innerHTML=r(this,de).fileSelectStatus,l(this,ho,zd).call(this)),l(this,vc,Mm).call(this)});Object.assign(r(this,de),s),S(this,lo,s.document?s.document:document),S(this,Ec,s.window?s.window:window),S(this,Gs,s.attributes||{}),S(this,Bt,s.classNames||{}),S(this,bc,s.contentId||""),typeof e=="string"?S(this,Ur,r(this,lo).querySelector(e)):S(this,Ur,e),S(this,Ue,r(this,de).fieldKey),this.fieldKey=r(this,Ue),S(this,ci,s.assetsURL||""),this.init()}init(){var c;S(this,hu,l(this,Is,Qs).call(this,`.${r(this,Ue)}-label`)),S(this,fc,l(this,Is,Qs).call(this,`.${r(this,Ue)}-inp-btn`)),S(this,li,l(this,Is,Qs).call(this,`.${r(this,Ue)}-file-select-status`)),S(this,oo,l(this,Is,Qs).call(this,`.${r(this,Ue)}-file-input-wrpr`)),S(this,uu,l(this,Is,Qs).call(this,`.${r(this,Ue)}-max-size-lbl`)),S(this,Mi,l(this,Is,Qs).call(this,`.${r(this,Ue)}-file-upload-input`)),S(this,Ni,l(this,Is,Qs).call(this,`.${r(this,Ue)}-file-input-wrpr .err-wrp`));const{multiple:e,allowedFileType:s,accept:i,showSelectStatus:n,fileSelectStatus:a,oldFiles:o}=r(this,de);r(this,Mi).multiple=e,r(this,Mi).accept=s?`${s}, ${i}`:i,n&&r(this,li)?r(this,li).innerHTML=a:(c=r(this,li))==null||c.remove(),S(this,Be,{}),l(this,ho,zd).call(this),o&&l(this,Ic,ym).call(this,o),l(this,Vr,nl).call(this,r(this,Mi),"change",d=>l(this,fu,dI).call(this,d)),l(this,Vr,nl).call(this,r(this,fc),"click",()=>r(this,Mi).click())}checkValidate(){return r(this,un).length===0&&Object.keys(r(this,Be)).length===0?"req":""}set value(e){l(this,Ic,ym).call(this,e)}get value(){return r(this,Be)}destroy(){r(this,Zt)&&(r(this,Zt).innerHTML=""),l(this,_u,gI).call(this)}reset(){this.destroy(),this.init()}}Ur=new WeakMap,hu=new WeakMap,fc=new WeakMap,li=new WeakMap,oo=new WeakMap,uu=new WeakMap,Mi=new WeakMap,Zt=new WeakMap,Ni=new WeakMap,Be=new WeakMap,gc=new WeakMap,lo=new WeakMap,Ec=new WeakMap,bc=new WeakMap,Gs=new WeakMap,Bt=new WeakMap,Ue=new WeakMap,ci=new WeakMap,un=new WeakMap,de=new WeakMap,pu=new WeakSet,lI=function(e){if(typeof e=="string")try{return JSON.parse(e)}catch(s){}return Array.isArray(e)?e:[]},Ic=new WeakSet,ym=function(e){const s=l(this,pu,lI).call(this,e);S(this,un,s),r(this,Zt)||l(this,co,Vd).call(this),s.forEach(n=>{l(this,mu,cI).call(this,n)});const i=l(this,Ke,ms).call(this,"input");i.type="hidden",i.name=l(this,_c,Pm).call(this),i.value=r(this,un).toString(),r(this,oo).appendChild(i)},mu=new WeakSet,cI=function(e){const s=l(this,Ke,ms).call(this,"div"),i=e.replace(/( |\.|\(|\))/g,"");if(s.id=`file-wrp-${i}`,l(this,Ee,je).call(this,s,"file-wrpr"),"file-wrpr"in r(this,Bt)){const c=r(this,Bt)["file-wrpr"];c&&l(this,Bs,vi).call(this,s,c)}if("file-wrpr"in r(this,Gs)){const c=r(this,Gs)["file-wrpr"];l(this,Us,wi).call(this,s,c)}const n=l(this,Ke,ms).call(this,"div");l(this,Ee,je).call(this,n,"file-details");const a=l(this,Ke,ms).call(this,"a");if(l(this,Ee,je).call(this,a,"file-title"),"file-title"in r(this,Bt)){const c=r(this,Bt)["file-title"];c&&l(this,Bs,vi).call(this,a,c)}if("file-title"in r(this,de).attributes){const c=r(this,de).attributes["file-title"];l(this,Us,wi).call(this,a,c)}l(this,Pi,An).call(this,a,"target","_blank"),l(this,Pi,An).call(this,a,"href",`${r(this,de).baseDLURL}&fileID=${e}`),l(this,pn,Ir).call(this,a,e),n.append(a),s.append(n);const o=l(this,Ke,ms).call(this,"button");if(l(this,Ee,je).call(this,o,"cross-btn"),"cross-btn"in r(this,Bt)){const c=r(this,Bt)["cross-btn"];c&&l(this,Bs,vi).call(this,o,c)}if(l(this,Pi,An).call(this,o,"data-file-id",i),l(this,Pi,An).call(this,o,"data-file-name",e),l(this,Pi,An).call(this,o,"type","button"),"cross-btn"in r(this,de).attributes){const c=r(this,de).attributes["cross-btn"];l(this,Us,wi).call(this,o,c)}l(this,pn,Ir).call(this,o,"×"),l(this,Vr,nl).call(this,o,"click",c=>l(this,gu,hI).call(this,c)),s.append(o),r(this,Zt).appendChild(s)},fu=new WeakSet,dI=function(e){const{files:s}=r(this,Mi),{sizeUnit:i,allowMaxSize:n,maxSize:a,maxSizeErrMsg:o,isItTotalMax:c,multiple:d,showFileList:h,fileExistMsg:p,showFilePreview:m,showFileSize:f,showSelectStatus:b,fileSelectStatus:g,minFile:v,minFileErrMsg:w,maxFile:x,maxFileErrMsg:_}=r(this,de),R=l(this,wu,fI).call(this,i,a);let C=0;const O=[];l(this,uo,Wd).call(this,r(this,Ni),"active"),c&&Object.values(r(this,Be)).forEach(D=>{C+=D.size}),!d&&s.length>0&&(S(this,Be,{}),r(this,Zt)&&l(this,pn,Ir).call(this,r(this,Zt),""));for(let D=0;D<s.length;D+=1){const L=s[D],F=L.name.replace(/( |\.|\(|\))/g,"");if(r(this,Be)[F])O.push(p);else if(!n||!a||L.size+C<=R)if(!(x>0)||Object.keys(r(this,Be)).length<x){if(r(this,Be)[F]=L,h){r(this,Zt)||l(this,co,Vd).call(this);const H=l(this,Ke,ms).call(this,"div");if(H.id=`file-wrp-${F}`,l(this,Ee,je).call(this,H,"file-wrpr"),"file-wrpr"in r(this,Bt)){const P=r(this,Bt)["file-wrpr"];P&&l(this,Bs,vi).call(this,H,P)}if("file-wrpr"in r(this,Gs)){const P=r(this,Gs)["file-wrpr"];l(this,Us,wi).call(this,H,P)}if(m){const P=l(this,Ke,ms).call(this,"img");if(P.src=l(this,Iu,pI).call(this,L),P.alt="Image Uploaded",l(this,Ee,je).call(this,P,"file-preview"),"file-preview"in r(this,Bt)){const Y=r(this,Bt)["file-preview"];Y&&l(this,Bs,vi).call(this,P,Y)}if("file-preview"in r(this,Gs)){const Y=r(this,Gs)["file-preview"];l(this,Us,wi).call(this,P,Y)}H.append(P)}const B=l(this,Ke,ms).call(this,"div");l(this,Ee,je).call(this,B,"file-details");const k=l(this,Ke,ms).call(this,"span");if(l(this,Ee,je).call(this,k,"file-title"),"file-title"in r(this,Bt)){const P=r(this,Bt)["file-title"];P&&l(this,Bs,vi).call(this,k,P)}if("file-title"in r(this,de).attributes){const P=r(this,de).attributes["file-title"];l(this,Us,wi).call(this,k,P)}if(l(this,pn,Ir).call(this,k,L.name),B.append(k),f){const P=l(this,Ke,ms).call(this,"span");if(l(this,Ee,je).call(this,P,"file-size"),"file-size"in r(this,Bt)){const Y=r(this,Bt)["file-size"];Y&&l(this,Bs,vi).call(this,P,Y)}if("file-size"in r(this,de).attributes){const Y=r(this,de).attributes["file-size"];l(this,Us,wi).call(this,P,Y)}l(this,pn,Ir).call(this,P,l(this,vu,mI).call(this,L.size)),B.append(P)}H.append(B);const X=l(this,Ke,ms).call(this,"button");if(l(this,Ee,je).call(this,X,"cross-btn"),"cross-btn"in r(this,Bt)){const P=r(this,Bt)["cross-btn"];P&&l(this,Bs,vi).call(this,X,P)}if(l(this,Pi,An).call(this,X,"data-file-id",F),"cross-btn"in r(this,de).attributes){const P=r(this,de).attributes["cross-btn"];l(this,Us,wi).call(this,X,P)}l(this,pn,Ir).call(this,X,"×"),H.append(X),r(this,Zt).append(H)}c&&(C+=L.size)}else r(this,Ni).innerHTML=_,l(this,Ee,je).call(this,r(this,Ni),"active"),setTimeout(()=>{l(this,uo,Wd).call(this,r(this,Ni),"active")},3e3);else O.push(o)}l(this,bu,uI).call(this,`.${r(this,Ue)}-file-input-wrpr .cross-btn`).forEach(D=>{l(this,Vr,nl).call(this,D,"click",L=>r(this,Eu).call(this,L))});const y=Object.keys(r(this,Be)).length;l(this,vc,Mm).call(this),y&&b?r(this,li).innerText=`${y} file${y>1?"s":""} selected`:b&&(r(this,li).innerHTML=g),v>0&&y<v&&(r(this,Ni).innerHTML=w,l(this,Ee,je).call(this,r(this,Ni),"active")),!r(this,Zt)&&O.length>0&&l(this,co,Vd).call(this),O.map((D,L)=>{r(this,Zt).insertAdjacentHTML("afterbegin",`
78 <div id='err-${L}' class="err-wrp">
79 ${D}
80 </div>`);const F=l(this,Is,Qs).call(this,`#err-${L}`);l(this,Ee,je).call(this,F,"active"),setTimeout(()=>{l(this,uo,Wd).call(this,F,"active")},3e3),setTimeout(()=>{F==null||F.remove(),Object.keys(r(this,Be)).length||l(this,ho,zd).call(this)},5e3)})},co=new WeakSet,Vd=function(){if(S(this,Zt,l(this,Ke,ms).call(this,"div")),l(this,Ee,je).call(this,r(this,Zt),"files-list"),"files-list"in r(this,Bt)){const e=r(this,Bt)["files-list"];e&&l(this,Bs,vi).call(this,r(this,Zt),e)}if("files-list"in r(this,Gs)){const e=r(this,Gs)["files-list"];l(this,Us,wi).call(this,r(this,Zt),e)}r(this,oo).append(r(this,Zt))},ho=new WeakSet,zd=function(){var e;(e=r(this,Zt))==null||e.remove(),S(this,Zt,null)},vc=new WeakSet,Mm=function(){var s;const e=new DataTransfer;(s=Object.values(r(this,Be)))==null||s.forEach(i=>{e.items.add(i)}),r(this,Mi).files=e.files},gu=new WeakSet,hI=function(e){const s=e.target.getAttribute("data-file-id"),i=e.target.getAttribute("data-file-name");l(this,wc,Nm).call(this,`#file-wrp-${s}`),S(this,un,r(this,un).filter(n=>n!==i)),l(this,Is,Qs).call(this,`input[name="${l(this,_c,Pm).call(this)}"]`).value=r(this,un).toString()},Eu=new WeakMap,Is=new WeakSet,Qs=function(e){return r(this,Ur).querySelector(e)},bu=new WeakSet,uI=function(e){return r(this,Ur).querySelectorAll(e)},wc=new WeakSet,Nm=function(e){var s;(s=l(this,Is,Qs).call(this,e))==null||s.remove()},Ke=new WeakSet,ms=function(e){return r(this,lo).createElement(e)},Iu=new WeakSet,pI=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,ci)}/zip-compressed.svg`;case"key":case"odp":case"pps":case"ppt":case"pptx":return`${r(this,ci)}/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,ci)}/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,ci)}/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,ci)}/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,ci)}/file-audio.svg`;default:return`${r(this,ci)}/paperclip.svg`}},Vr=new WeakSet,nl=function(e,s,i){e.addEventListener(s,i),r(this,gc).push({element:e,eventType:s,eventAction:i})},Ee=new WeakSet,je=function(e,s){e.classList.add(s)},uo=new WeakSet,Wd=function(e,s){e.classList.remove(s)},pn=new WeakSet,Ir=function(e,s){e.textContent=s},Pi=new WeakSet,An=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},Bs=new WeakSet,vi=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>l(this,Ee,je).call(this,e,i))},Us=new WeakSet,wi=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)l(this,Pi,An).call(this,e,s[n].key,s[n].value)},vu=new WeakSet,mI=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`},wu=new WeakSet,fI=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}},_u=new WeakSet,gI=function(){r(this,gc).forEach(({element:e,eventType:s,eventAction:i})=>{e.removeEventListener(s,i)})},_c=new WeakSet,Pm=function(){var e,s;return typeof checkRepeatedField!="undefined"&&checkRepeatedField(r(this,Ue),(s=(e=r(this,Ec))==null?void 0:e.bf_globals)==null?void 0:s[r(this,bc)])?`${r(this,Ue)}_old[]`:`${r(this,Ue)}_old`};function $R({fieldKey:t,formID:e,styleClasses:s}){const i=M.useRef(null),n=M.useRef(null),o=Z(Lt)[t],c=Z(od),d=Z(ve),{styleMode:h}=d;return M.useEffect(()=>{var Y,j,N,G,U,q,V,lt,ot,ct,ft,J,st,at;i!=null&&i.current||(i.current=Pt(`.${t}-file-up-wrpr`));const p=n.current,m=i.current;p&&m&&"destroy"in p&&p.destroy();const{multiple:f,allowMaxSize:b,showMaxSize:g,maxSizeLabel:v,maxSize:w,sizeUnit:x,isItTotalMax:_,showSelectStatus:R,fileSelectStatus:C,allowedFileType:O,showFileList:y,fileExistMsg:D,showFilePreview:L,showFileSize:F,duplicateAllow:H,accept:B,minFile:k,maxFile:X}=o.config,P={fieldKey:t,multiple:f,allowMaxSize:b,maxSizeErrMsg:((j=(Y=o==null?void 0:o.err)==null?void 0:Y.maxSize)==null?void 0:j.msg)||((G=(N=o==null?void 0:o.err)==null?void 0:N.maxSize)==null?void 0:G.dflt),showMaxSize:g,maxSizeLabel:v,maxSize:w,sizeUnit:x,isItTotalMax:_,showSelectStatus:R,fileSelectStatus:C,allowedFileType:O,showFileList:y,fileExistMsg:D,showFilePreview:L,showFileSize:F,duplicateAllow:H,accept:B,minFile:k,minFileErrMsg:((q=(U=o==null?void 0:o.err)==null?void 0:U.minFile)==null?void 0:q.msg)||((lt=(V=o==null?void 0:o.err)==null?void 0:V.minFile)==null?void 0:lt.dflt),maxFile:X,maxFileErrMsg:((ct=(ot=o==null?void 0:o.err)==null?void 0:ot.maxFile)==null?void 0:ct.msg)||((J=(ft=o==null?void 0:o.err)==null?void 0:ft.maxFile)==null?void 0:J.dflt),assetsURL:`${c.assetsURL}/../static/file-upload/`,document:(st=document.getElementById("bit-grid-layout"))==null?void 0:st.contentDocument,window:(at=document.getElementById("bit-grid-layout"))==null?void 0:at.contentWindow,attributes:{"files-list":_t(t,"files-list"),"file-wrpr":_t(t,"file-wrpr"),"file-preview":_t(t,"file-preview"),"file-title":_t(t,"file-title"),"file-size":_t(t,"file-size"),"cross-btn":_t(t,"cross-btn")},classNames:{"files-list":T(t,"files-list"),"file-wrpr":T(t,"file-wrpr"),"file-preview":T(t,"file-preview"),"file-title":T(t,"file-title"),"file-size":T(t,"file-size"),"cross-btn":T(t,"cross-btn")}};n.current=new OR(m,P)},[o]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:s}),u.jsx(Tt,{formID:e,fieldKey:t,fieldData:o,children:u.jsx("div",{className:`${t}-file-up-container ${T(t,"file-up-container")}`,children:u.jsx("div",$(I({"data-dev-file-up-wrpr":t,className:`${t}-file-up-wrpr ${o.valid.disabled?"disabled":""} ${o.valid.readonly?"readonly":""} ${T(t,"file-up-wrpr")}`,ref:i},A(t,"file-up-wrpr")),{children:u.jsxs("div",$(I({"data-dev-file-input-wrpr":t,"data-inp-wrp":!0,className:`${t}-file-input-wrpr ${T(t,"file-input-wrpr")}`},A(t,"file-input-wrpr")),{children:[u.jsxs("div",$(I({"data-dev-btn-wrpr":t,className:`${t}-btn-wrpr ${T(t,"btn-wrpr")}`},A(t,"btn-wrpr")),{children:[u.jsxs("button",$(I({"data-testid":`${t}-inp-btn`,"data-dev-inp-btn":t,type:"button",className:`${t}-inp-btn ${T(t,"inp-btn")}`},A(t,"inp-btn")),{children:[o.prefixIcn&&u.jsx("img",I({"data-dev-pre-i":t,className:`${t}-pre-i ${T(t,"pre-i")}`,src:`${o.prefixIcn}`,alt:"Upload icon",srcSet:""},A(t,"pre-i"))),u.jsx("span",$(I({"data-dev-btn-txt":t,className:`${t}-btn-txt ${T(t,"btn-txt")}`},A(t,"btn-txt")),{children:o.btnTxt})),o.suffixIcn&&u.jsx("img",I({"data-dev-suf-i":t,className:`${t}-suf-i ${T(t,"suf-i")}`,src:`${o.suffixIcn}`,alt:"Upload icon",srcSet:""},A(t,"suf-i")))]})),o.config.showSelectStatus&&u.jsx("div",$(I({"data-dev-file-select-status":t,className:`${t}-file-select-status ${T(t,"file-select-status")}`},A(t,"file-select-status")),{children:"No Choosen File"})),o.config.allowMaxSize&&o.config.showMaxSize&&o.config.maxSize!==0&&u.jsx("small",$(I({"data-dev-max-size-lbl":t,className:`${t}-max-size-lbl ${T(t,"max-size-lbl")}`},A(t,"max-size-lbl")),{children:o.config.maxSizeLabel||`(Max ${o.config.maxSize}${o.config.sizeUnit})`})),u.jsx("input",I($(I(I(I(I($(I({"data-testid":`${t}-fil-upld-inp`,type:"file",className:`${t}-file-upload-input ${T(t,"file-upload-input")}`},h&&{id:t}),{name:"file-upload"}),"req"in o.valid&&{required:o.valid.req}),"disabled"in o.valid&&{disabled:o.valid.disabled}),"readonly"in o.valid&&{readOnly:o.valid.readonly}),A(t,"file-upload-input")),{"aria-disabled":!0,tabIndex:-1}),!h&&{disabled:!0}))]})),u.jsx("div",I({className:`err-wrp ${T(t,"err-wrp")}`},A(t,"err-wrp")))]}))}))})})]})}function LR({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){var m,f;let{checked:o}=t.valid;const c=t.val||(o?t.msg.checked:t.msg.unchecked),[d,h]=M.useState(c);d===t.msg.unchecked?o=!1:d===t.msg.checked&&(o=!0);const p=b=>{if(t.valid.disabled)return;b.target.checked?h(t.msg.checked):h(t.msg.unchecked);const{form:g}=b.target;validateForm({input:{name:t.name,form:g,value:b.target.checked?t.msg.checked:t.msg.unchecked}})};return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:i,fieldKey:n,fieldData:t,noLabel:!0,children:u.jsxs("div",$(I({"data-dev-cc":n,className:`${n}-cc ${T(n,"cc")}`},A(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",$(I({"data-dev-cw":n,className:`${n}-cw ${T(n,"cw")}`},A(n,"cw")),{children:[u.jsx("input",$(I($(I(I(I({"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:(m=t==null?void 0:t.info)==null?void 0:m.lbl}),"fieldName"in t&&{name:t.fieldName}),{checked:o,value:d,onChange:p})),u.jsxs("label",$(I({"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-decision`,className:`${n}-cl ${T(n,"cl")}`},A(n,"cl")),{children:[u.jsx("span",$(I({"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${T(n,"bx")}`},A(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",$(I({"data-dev-ct":n,className:`${n}-ct ${T(n,"ct")}`},A(n,"ct")),{children:u.jsx(We,{html:t.lbl||((f=t==null?void 0:t.info)==null?void 0:f.lbl)})}))]}))]}))]}))})]})}function AR({fieldKey:t,styleClasses:e}){var g;const s=M.useRef(null),i=M.useRef(null),a=Z(Lt)[t],o=Z(or),{styleMode:c}=Z(ve),d=((g=a.hidden)==null?void 0:g.includes(o))||!1,h=M.useRef(null),p=Z(pv),{siteKey:m=""}=p||{},f=M.useCallback(()=>{var w;if(!window.hcaptcha||!s.current)return;let v=Pt(`.${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),Ct(t);return}catch(_){h.current=null}else h.current=null;v==null||v.remove(),v=document.createElement("div"),v.id=`${t}-h-captcha`,v.classList.add(`${t}-h-captcha`,"h-captcha"),s.current.appendChild(v),h.current=window.hcaptcha.render(v,{sitekey:m,theme:a.config.theme,size:a.config.size}),window.bitformHCaptchaWidgets||(window.bitformHCaptchaWidgets={}),window.bitformHCaptchaWidgets[t]=h.current,Ct(t),i.current&&clearInterval(i.current),i.current=setInterval(()=>{window.hcaptcha&&h.current!==null&&window.hcaptcha.reset(h.current)},3e4)},[t,m,a.config.theme,a.config.size]),b=M.useRef(f);return M.useEffect(()=>{b.current=f},[f]),M.useEffect(()=>{window.renderHCaptchaFunc=()=>b.current();const v={src:"https://js.hcaptcha.com/1/api.js?onload=renderHCaptchaFunc&render=explicit",integrity:"",id:"bf-h-captcha-script",async:!0,defer:!0};return ld(v),()=>{clearInterval(i.current),gp(v.id),delete window.renderHCaptchaFunc}},[]),M.useEffect(()=>{f()},[f]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:e}),u.jsx("div",{"data-dev-fld-wrp":t,className:`${t}-h-captcha-container ${t}-fld-wrp ${c?"":"drag"} ${d?"fld-hide":""}`,children:m!==""?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 yR({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){const o=e.typ==="hidden"?"text":e.typ,c=M.useRef(null),[d,h]=M.useState(e.val!==void 0?e.val:"");return M.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(dt,{styleClasses:a}),u.jsx(Tt,{formID:n,fieldKey:t,fieldData:e,noErrMsg:!0,children:u.jsx("div",$(I({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${T(t,"inp-fld-wrp")}`},A(t,"inp-fld-wrp")),{children:u.jsx("input",I($(I(I(I({"data-testid":t,"data-dev-fld":t,id:t,list:`${t}-datalist`,ref:c,className:`${t}-fld no-drg ${T(t,"fld")}`,type:o},"ph"in e&&{placeholder:e.ph}),"fieldName"in e&&{name:e.fieldName}),s&&{onInput:s}),{value:d}),A(t,"fld")))}))})]})}var MR=M.memo(yR);function NR({fieldKey:t,attr:e,styleClasses:s}){var a,o;const{styleMode:i}=Z(ve),n=((a=e.valid)==null?void 0:a.hide)||!1;return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:s}),u.jsx("div",$(I({"data-dev-fld-wrp":t,className:`${t}-fld-wrp ${i?"":"drag"} ${T(t,"fld-wrp")} ${n?"fld-hide":""}`},A(t,"fld-wrp")),{children:u.jsx(We,{html:e.content||((o=e==null?void 0:e.info)==null?void 0:o.content)})}))]})}function PR({fieldKey:t,formID:e,styleClasses:s}){var a;const n=Z(Lt)[t];return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:s}),u.jsx(Tt,{formID:e,fieldKey:t,fieldData:n,children:u.jsxs("select",$(I(I(I(I({"data-testid":t,"data-dev-fld":t,id:t,className:`${t}-fld ${T(t,"fld")} no-drg ${n.readonly?"readonly":""}`},"disabled"in n.valid&&{disabled:n.valid.disabled}),"readonly"in n.valid&&{readOnly:n.valid.readonly}),A(t,"fld")),"req"in n.valid&&{required:n.valid.req}),{children:[n.phHide&&u.jsx("option",$(I({"data-dev-slct-optn":t,className:`${t}-slct-optn ${T(t,"slct-optn")}`,value:""},A(t,"slct-optn")),{children:n.ph})),(a=n==null?void 0:n.opt)==null?void 0:a.map(o=>{var c;return o.type?u.jsx("optgroup",$(I(I({"data-dev-slct-opt-grp":t,className:`${t}-slct-opt-grp ${T(t,"slct-opt-grp")}`,label:o.title},o.disabled&&{disabled:o.disabled}),I({},A(t,"slct-opt-grp"))),{children:(c=o==null?void 0:o.childs)==null?void 0:c.map(d=>u.jsx("option",$(I(I({"data-dev-slct-optn":t,className:`${t}-slct-optn ${T(t,"slct-optn")}`,value:d.val,selected:d.check},d.disabled&&{disabled:d.disabled}),I({},A(t,"slct-optn"))),{children:d.lbl}),d.val||d.lbl))}),o.title):u.jsx("option",$(I(I({"data-dev-slct-optn":t,className:`${t}-slct-optn ${T(t,"slct-optn")}`,value:o.val,selected:o.check},o.disabled&&{disabled:o.disabled}),I({},A(t,"slct-optn"))),{children:o.lbl}),o.val||o.lbl)})]}))})]})}function DR({fieldKey:t,attr:e,styleClasses:s}){var _;const i=M.useRef(),n=M.useRef({}),a=Z(Do),o=Z(or),{styleMode:c}=Z(ve),d=bi(cd),h=((_=e.valid.hidden)==null?void 0:_.includes(o))||!1,p=Ei(s),m=bi(Lt),{width:f,height:b}=e,g=R=>`fields->${t}->classes->.${t}-fld-wrp->${R}`;a.fieldKey===t&&(n.current.resize=!0,d(R=>Kt(R,C=>{Ta(C,g("max-height"),"")}))),n.current.resize&&!a.fieldKey&&(n.current.resize=!1,d(R=>Kt(R,C=>{var O,y,D;Ta(C,g("height"),`${(O=i==null?void 0:i.current)==null?void 0:O.parentElement.clientHeight}px`),Ta(C,g("width"),`${(y=i==null?void 0:i.current)==null?void 0:y.parentElement.clientWidth}px`),Ta(C,g("max-height"),`${(D=i==null?void 0:i.current)==null?void 0:D.parentElement.clientHeight}px`)})),m(R=>Kt(R,C=>{var O,y;C[t].height=(O=i==null?void 0:i.current)==null?void 0:O.parentElement.clientHeight,C[t].width=(y=i==null?void 0:i.current)==null?void 0:y.parentElement.clientWidth}))),M.useEffect(()=>{m(R=>Kt(R,C=>{var O,y;C[t].height=(O=i==null?void 0:i.current)==null?void 0:O.parentElement.clientHeight,C[t].width=(y=i==null?void 0:i.current)==null?void 0:y.parentElement.clientWidth}))},[]);const v=f||100,w=b||40,x=Math.max(10,Math.min(14,Math.floor(Math.min(v,w)/4)));return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:p}),u.jsx("div",$(I({"data-dev-fld-wrp":t,ref:i,className:`${t}-fld-wrp ${c?"":"drag"} ${h?"fld-hide":""} ${T(t,"fld-wrp")}`},A(t,"fld-wrp")),{children:e!=null&&e.bg_img?u.jsx("img",$(I({"data-dev-img":t,className:`${t}-img ${T(t,"img")}`,src:e.bg_img,alt:e==null?void 0:e.alt},A(t,"img")),{width:e==null?void 0:e.width,height:e==null?void 0:e.height,draggable:!1})):u.jsxs("svg",$(I({"data-dev-img":t,className:`${t}-img ${T(t,"img")}`,xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:`0 0 ${v} ${w}`},A(t,"img")),{children:[u.jsx("rect",{width:"100%",height:"100%",fill:"#ececec"}),u.jsx("line",{x1:"0",y1:"0",x2:v,y2:w,stroke:"#ccc",strokeWidth:"1"}),u.jsx("line",{x1:v,y1:"0",x2:"0",y2:w,stroke:"#ccc",strokeWidth:"1"}),u.jsxs("text",{x:"50%",y:"50%",dominantBaseline:"middle",textAnchor:"middle",fontFamily:"sans-serif",fontSize:x,fill:"#999",children:[v," × ",w]})]}))}))]})}function FR({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){const[o,c]=M.useState(t.val||""),d=M.useRef([]),[h,p]=M.useState({checked:[]});d.current=t.opt.map((f,b)=>{var g;return(g=d.current[b])!=null?g:M.createRef()});const m=(f,b)=>{const{checked:g}=f.target;if(g&&t.inpType==="checkbox")h.checked.push(b),c(null);else{const v=h.checked.indexOf(b);h.checked.splice(v,1),p({checked:h.checked})}g&&t.inpType==="radio"?(h.checked=[],c(f.target.value)):c(""),Ct(n)};return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:i,fieldKey:n,fieldData:t,children:u.jsx("div",$(I({"data-testid":`${n}-inp-fld-wrp`,"data-dev-inp-fld-wrp":n,className:`${n}-inp-fld-wrp ${T(n,"inp-fld-wrp")}`},A(n,"inp-fld-wrp")),{children:u.jsx("div",$(I({"data-testid":`${n}-ic`,"data-dev-ic":n,className:`${n}-ic ${T(n,"ic")}`},A(n,"ic")),{children:t.opt.map((f,b)=>u.jsxs("div",$(I({"data-testid":`${n}-inp-opt`,"data-dev-inp-opt":n,className:`${n}-inp-opt ${T(n,"inp-opt")}`},A(n,"inp-opt")),{children:[u.jsx("input",$(I($(I({className:`${n}-img-inp ${T(n,"img-inp")}`,type:t.inpType,"aria-label":f.lbl,id:`${n}-img-wrp-${b}`,name:n,value:f.val||f.lbl},t.valid.req&&{required:!0}),{checked:o===f.val||h.checked.includes(b)||(f==null?void 0:f.check),disabled:t.valid.disabled,onChange:g=>m(g,b)}),A(n,"img-inp")),{"data-dev-img-inp":n})),u.jsxs("label",$(I({"data-testid":`${n}-img-wrp`,"data-dev-img-wrp":n,htmlFor:`${n}-img-wrp-${b}`,className:`${n}-img-wrp ${T(n,"img-wrp")}`},A(n,"img-wrp")),{children:[u.jsx("span",$(I({"data-testid":`${n}-check-box`,"data-dev-check-box":n,className:`${n}-check-box ${T(n,"check-box")}`},A(n,"check-box")),{children:u.jsx("img",I({src:t.tickImgSrc,alt:"","data-testid":`${n}-check-img`,"data-dev-check-img":n,className:`${n}-check-img ${T(n,"check-img")}`},A(n,"check-img")))})),u.jsxs("span",$(I({"data-testid":`${n}-img-card-wrp`,"data-dev-img-card-wrp":n,className:`${n}-img-card-wrp ${T(n,"img-card-wrp")}`},A(n,"img-card-wrp")),{children:[u.jsx("img",I({src:f.img,alt:f.lbl,"aria-label":f.lbl,"data-testid":`${n}-select-img`,"data-dev-select-img":n,className:`${n}-select-img ${T(n,"select-img")}`},A(n,"select-img"))),!t.optLblHide&&u.jsx("div",$(I({"data-testid":`${n}-tc`,"data-dev-tc":n,className:`${n}-tc ${T(n,"tc")}`},A(n,"tc")),{children:u.jsx("span",$(I({"data-testid":`${n}-img-title`,"data-dev-img-title":n,className:`${n}-img-title ${T(n,"img-title")}`},A(n,"img-title")),{children:u.jsx(We,{html:f.lbl})}))}))]}))]}))]}),`opr-${b+22}`))}))}))})]})}function jR({fieldKey:t,formID:e,attr:s,isBuilder:i,styleClasses:n}){const a=Z(Ep),[o,c]=M.useState(""),h=Z(Lt)[t],[p,m]=M.useState(!1),f=of(),{currency:b,redirect_url:g}=h.config||{};return M.useEffect(()=>{if(!s.payIntegID){c(""),f(`field-settings/${t}`);return}const v=a==null?void 0:a.find(w=>w.id&&s.payIntegID&&Number(w.id)===Number(s.payIntegID));if(v){const w=v.apiKey;c(w)}},[s.payIntegID]),M.useEffect(()=>{if(!o){fl({fieldKey:t,errorKey:"mollieApiKeyMissing",errorMsg:Pe("Mollie API key is missing"),errorUrl:`field-settings/${t}`});return}g||fl({fieldKey:t,errorKey:"mollieRedirectUrlMissing",errorMsg:Pe("Mollie Redirect Url is not Selected"),errorUrl:`field-settings/${t}`}),m(!1),bp(t,"mollieApiKeyMissing"),Ct(t)},[o,b,g]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:n}),u.jsxs(Tt,{formID:e,fieldData:s,fieldKey:t,noLabel:!0,isBuilder:i,children:[o&&!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&&!o&&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 Hn,po,Ot,mn,qn,ma,Tc,Dm,vs,Js,Tu,EI,xc,Fm,xu,bI,Su,II,Ru,vI,Cu,wI,Sc,jm,zr,rl,Ou,_I,$u,TI,mo,Hd;class kR{constructor(e,s){E(this,qn);E(this,Tc);E(this,vs);E(this,Tu);E(this,xc);E(this,xu);E(this,Su);E(this,Ru);E(this,Cu);E(this,Sc);E(this,zr);E(this,Ou);E(this,$u);E(this,mo);E(this,Hn,"");E(this,po,"");E(this,Ot,{namespace:"paypal",payType:"payment",currency:"USD",amount:1,shipping:0,tax:0,style:{label:"paypal",color:"gold",shape:"rect",layout:"vertical"}});E(this,mn,null);Object.assign(r(this,Ot),s),typeof e=="string"?S(this,Hn,document.querySelector(e)):S(this,Hn,e),S(this,po,`#form-${l(this,vs,Js).call(this)}`),this.init()}init(){const{namespace:e}=r(this,Ot),s=window[e],i={style:l(this,$u,TI).call(this)};l(this,Tc,Dm).call(this)&&(i.fundingSource=s.FUNDING[r(this,Ot).style.payBtn]),l(this,qn,ma).call(this)?i.createSubscription=(n,a)=>l(this,Tu,EI).call(this,n,a):i.createOrder=(n,a)=>l(this,Ou,_I).call(this,n,a),i.onClick=(n,a)=>l(this,xu,bI).call(this,a),i.onApprove=(n,a)=>l(this,Su,II).call(this,n,a),r(this,Ot).onInit&&(i.onInit=r(this,Ot).onInit),s&&s.Buttons(i).render(r(this,Hn))}destroy(){r(this,Hn).innerHTML=""}reset(){this.destroy(),this.init()}}Hn=new WeakMap,po=new WeakMap,Ot=new WeakMap,mn=new WeakMap,qn=new WeakSet,ma=function(){return r(this,Ot).payType==="subscription"},Tc=new WeakSet,Dm=function(){return r(this,Ot).style.layout==="standalone"},vs=new WeakSet,Js=function(){return r(this,Ot).contentId},Tu=new WeakSet,EI=function(e,s){if(typeof validateForm!="undefined"&&!validateForm({form:l(this,vs,Js).call(this)}))throw new Error("form validation is failed!");const i={plan_id:r(this,Ot).planId};return l(this,xc,Fm).call(this,"bf-paypal-subscription-options",{subData:i}),s.subscription.create(i)},xc=new WeakSet,Fm=function(e,s){var n,a;const i=$(I({},s),{config:r(this,Ot),contentId:l(this,vs,Js).call(this)});(a=(n=r(this,Hn))==null?void 0:n.dispatchEvent)==null||a.call(n,new CustomEvent(e,{bubbles:!0,detail:i}))},xu=new WeakSet,bI=function(e){return Vo(this,null,function*(){const s=l(this,vs,Js).call(this);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&&S(this,mn,n.data.entry_id),e.resolve()):e.reject()})},Su=new WeakSet,II=function(e,s){const i=document.getElementById(`${l(this,vs,Js).call(this)}`);i.classList.add("pos-rel","form-loading"),(l(this,qn,ma).call(this)?s.subscription.get():s.order.capture()).then(a=>{const o=l(this,Cu,wI).call(this,a);o&&l(this,Ru,vI).call(this,o,a)}).catch(a=>{i.classList.remove("pos-rel","form-loading")}).finally(()=>{i.classList.remove("pos-rel","form-loading")})},Ru=new WeakSet,vI=function(e,s){var o;const i=bf_globals[l(this,vs,Js).call(this)],n=document.getElementById(`form-${l(this,vs,Js).call(this)}`),a=(o=l(this,vs,Js).call(this))==null?void 0:o.split("_")[1];if(typeof n!="undefined"&&n!==null){r(this,mn)&&(i.entryId=r(this,mn));const c=bfSelect(`input[name="${r(this,Ot).fieldKey}"]`,n);c?c.value=e:setHiddenFld({name:r(this,Ot).fieldKey,value:e,type:"text"},n);let d=bfSelect('button[type="submit"]',n);d||(d=document.createElement("button"),d.setAttribute("type","submit"),d.style.display="none",n.append(d)),d.click();const h={formID:a,transactionID:e,payment_name:"paypal",payment_type:l(this,qn,ma).call(this)?"subscription":"order",payment_response:s,entry_id:r(this,mn),fieldKey:r(this,Ot).fieldKey},p=new URL(i==null?void 0:i.ajaxURL);p.searchParams.append("_ajax_nonce",i==null?void 0:i.nonce),p.searchParams.append("action","bitforms_payment_insert"),fetch(p,{method:"POST",body:JSON.stringify(h)}).then(()=>{S(this,mn,null);const m=bfSelect(`input[name="${r(this,Ot).fieldKey}"]`,n);m&&(m.value="",m.setAttribute("value",""))})}},Cu=new WeakSet,wI=function(e){let s=null;if(l(this,qn,ma).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},Sc=new WeakSet,jm=function(e,s){var i;return(i=document.querySelector(s))==null?void 0:i.querySelector(e)},zr=new WeakSet,rl=function(e){if(e){const s=window.bf_globals[l(this,vs,Js).call(this)].fields[e].fieldName;let i=l(this,Sc,jm).call(this,`[name="${s}"]`,r(this,po));if(i&&i.type==="radio"&&(i=l(this,Sc,jm).call(this,`[name="${s}"]:checked`,r(this,po))),i&&i.value)return i.value}return""},Ou=new WeakSet,_I=function(e,s){var R,C;const{currency:i,amount:n,shipping:a,tax:o}=r(this,Ot),c=l(this,zr,rl).call(this,r(this,Ot).amountFld)||n,d=l(this,zr,rl).call(this,r(this,Ot).shippingVal)||a,h=l(this,zr,rl).call(this,r(this,Ot).taxVal)||o,p=l(this,mo,Hd).call(this,c).toFixed(2)*1,m=l(this,mo,Hd).call(this,d).toFixed(2)*1,f=(l(this,mo,Hd).call(this,h)*p/100).toFixed(2)*1,b=(p+m+f).toFixed(2)*1,g=(R=l(this,vs,Js).call(this))==null?void 0:R.split("_")[1],v=(C=r(this,Ot))==null?void 0:C.fieldKey,w=l(this,zr,rl).call(this,r(this,Ot).descFld)||r(this,Ot).description,x=`form-id:${g};entry-id:${r(this,mn)};field-key:${v}`,_={purchase_units:[{description:w,custom_id:x,amount:{currency_code:i,value:b,breakdown:{item_total:{currency_code:i,value:p},shipping:{currency_code:i,value:m},tax_total:{currency_code:i,value:f}}}}]};return l(this,xc,Fm).call(this,"bf-paypal-order-options",{order:_}),s.order.create(_)},$u=new WeakSet,TI=function(){const{label:e,color:s,shape:i,layout:n,height:a}=r(this,Ot).style,o={label:l(this,qn,ma).call(this)?"subscribe":e,color:s,shape:i};return l(this,Tc,Dm).call(this)||(o.layout=n),a!==void 0&&(o.height=Number(a)),o},mo=new WeakSet,Hd=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 GR({fieldKey:t,formID:e,attr:s,isBuilder:i,styleClasses:n}){const a=Z(Ep),[o,c]=M.useState(""),h=Z(Lt)[t],p=M.useRef(null),m=M.useRef(null),[f,b]=M.useState(!1),[g,v]=M.useState(!1),w=(h==null?void 0:h.payType)==="subscription",{locale:x,currency:_,disableFunding:R}=h||{};return M.useEffect(()=>{if(!s.payIntegID){c("");return}const C=a==null?void 0:a.find(O=>O.id&&s.payIntegID&&Number(O.id)===Number(s.payIntegID));if(C){const O=C.clientID;c(O)}},[s.payIntegID]),M.useEffect(()=>{if(!o){fl({fieldKey:t,errorKey:"paypalClientIdMissing",errorMsg:Pe("PayPal Client ID is missing"),errorUrl:`field-settings/${t}`});return}v(!0),bp(t,"paypalClientIdMissing");const C={"client-id":o};h!=null&&h.locale&&(C.locale=h.locale),h!=null&&h.disableFunding&&(C["disable-funding"]=h.disableFunding),w&&(C.intent="subscription",C.vault="true"),!w&&(h!=null&&h.currency)&&(C.currency=h.currency);const y={src:`https://www.paypal.com/sdk/js?${new URLSearchParams(C).toString()}`,integrity:"",id:`bf-paypal-script-${t}`,scriptInGrid:!1,attr:{"data-namespace":t},callback:()=>{Ct(t),b(!0),v(!1)}};return ld(y),()=>{gp("bf-paypal-script")}},[o,x,_,R]),M.useEffect(()=>{if(!f||g)return;p!=null&&p.current||(p.current=Pt(`#${t}-paypal-wrp`));const C=m.current,O=p.current;if((!o||C&&O&&"destroy"in C)&&(C.destroy(),Ct(t)),!o)return b(!1);const{style:y,currency:D}=h,L={namespace:t,style:y,currency:D,payType:"payment",shipping:0,tax:0,onInit:()=>{Ct(t)}};m.current=new kR(O,L)},[f,g]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:n}),u.jsxs(Tt,{formID:e,fieldData:s,fieldKey:t,noLabel:!0,noErrMsg:!0,isBuilder:i,children:[f&&o&&!g&&u.jsx("div",{className:`${t}-paypal-wrp`,children:u.jsx("div",{ref:p,id:`${t}-paypal-wrp`})}),!g&&(!f||!o)&&u.jsxs("p",{children:["Please select a PayPal account from",u.jsx("strong",{children:" Field Settings "}),"to load PayPal field."]}),g&&u.jsx("p",{children:"Loading PayPal..."})]})]})}var fo,Lu,rf,Le,Ae,fn,Vs,Rc,go,gn,Au,ye,Cc,Qt,Di,di,Oc,hi,Eo,bo,Io,$c,Fi,Lc,K,vo,Ac,wo,En,ui,yu,xI,he,Te,Ve,ns,Mu,SI,Nu,RI,Pu,CI,Du,OI,_o,qd,Fu,$I,Wr,al,To,Yd,yc,km,ju,LI,ku,AI,xo,Xd,Mc,Gm,bn,vr,Hr,ol,Nc,Bm,Gu,yI,Bu,MI,Uu,NI,Pc,Um,Vu,Yn,fa,Dc,Vm,Fc,zm,zu,PI,jc,Wm,Xn,ga,Wu,DI,Zn,Ea,ws,Ks,So,Zd,Rt,Mt,Qn,ba,Jn,Ia,ze,rs,af,UR,kc,Hm,Hu,FI,Gc,qm,Bc,Ym,qu,jI,Yu,kI,Kn,va,Xu,GI,Uc,Xm,Zu,BI;class BR{constructor(e,s){E(this,yu);E(this,he);E(this,Ve);E(this,Mu);E(this,Nu);E(this,Pu);E(this,Du);E(this,_o);E(this,Fu);E(this,Wr);E(this,To);E(this,yc);E(this,ju);E(this,ku);E(this,xo);E(this,Mc);E(this,bn);E(this,Hr);E(this,Nc);E(this,Gu);E(this,Bu);E(this,Uu);E(this,Pc);E(this,Yn);E(this,Dc);E(this,Fc);E(this,zu);E(this,jc);E(this,Xn);E(this,Wu);E(this,Zn);E(this,ws);E(this,So);E(this,Rt);E(this,Qn);E(this,Jn);E(this,ze);E(this,af);E(this,kc);E(this,Hu);E(this,Gc);E(this,Bc);E(this,qu);E(this,Yu);E(this,Kn);E(this,Xu);E(this,Uc);E(this,Zu);E(this,fo,"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>");E(this,Lu,"www.cloudflare.com/cdn-cgi/trace");E(this,rf,"api.geonames.org/countryCodeJSON?username=bitcodezoho1");E(this,Le,null);E(this,Ae,null);E(this,fn,null);E(this,Vs,null);E(this,Rc,null);E(this,go,null);E(this,gn,null);E(this,Au,null);E(this,ye,null);E(this,Cc,null);E(this,Qt,null);E(this,Di,null);E(this,di,null);E(this,Oc,30);E(this,hi,[]);E(this,Eo,{});E(this,bo,{});E(this,Io,!1);E(this,$c,null);E(this,Fi,!1);E(this,Lc,[]);E(this,K,{maxHeight:370,detectCountryByIp:!1,detectCountryByGeo:!1,optionFlagImage:!0,searchCountryPlaceholder:"Search Country",noCountryFoundText:"No Country Found",searchClearable:!0,inputFormat:"+c #### ### ###",valueFormat:"+c #### ### ###",defaultCountryKey:"",attributes:{},classNames:{}});E(this,vo,"");E(this,Ac,null);E(this,wo,"");E(this,En,null);E(this,ui,null);E(this,Vu,e=>/[0-9]/.test(e));Object.assign(r(this,K),s),S(this,En,s.document||document),S(this,ui,s.window||window),S(this,vo,s.assetsURL||""),typeof e=="string"?S(this,Le,r(this,En).querySelector(e)):S(this,Le,e),typeof r(this,K).options=="string"&&(r(this,K).options=l(this,yu,xI).call(this,r(this,K).options)),r(this,K).options=r(this,K).options.filter(i=>!i.hide),S(this,hi,[...r(this,K).options]),S(this,Eo,l(this,ju,LI).call(this)),S(this,bo,l(this,ku,AI).call(this)),this.fieldKey=r(this,K).fieldKey,S(this,$c,r(this,K).contentId),this.init()}init(){S(this,Cc,l(this,he,Te).call(this,`.${this.fieldKey}-phone-inner-wrp`)),S(this,Qt,l(this,he,Te).call(this,`.${this.fieldKey}-phone-number-input`)),S(this,Ae,l(this,he,Te).call(this,`.${this.fieldKey}-phone-hidden-input`)),S(this,fn,l(this,he,Te).call(this,`.${this.fieldKey}-input-clear-btn`)),S(this,go,l(this,he,Te).call(this,`.${this.fieldKey}-selected-country-img`)),S(this,Au,l(this,he,Te).call(this,`.${this.fieldKey}-option-search-wrp`)),S(this,ye,l(this,he,Te).call(this,`.${this.fieldKey}-opt-search-input`)),S(this,Vs,l(this,he,Te).call(this,`.${this.fieldKey}-dpd-wrp`)),S(this,Rc,l(this,he,Te).call(this,`.${this.fieldKey}-option-wrp`)),S(this,Di,l(this,he,Te).call(this,`.${this.fieldKey}-search-clear-btn`)),S(this,di,l(this,he,Te).call(this,`.${this.fieldKey}-option-list`)),this.setMenu({open:!1}),l(this,Ve,ns).call(this,r(this,Le),"keydown",e=>{l(this,Du,OI).call(this,e)}),l(this,Ve,ns).call(this,r(this,Vs),"click",e=>{l(this,Uc,Xm).call(this,e)}),l(this,Ve,ns).call(this,r(this,Vs),"keyup",e=>{l(this,Uc,Xm).call(this,e)}),l(this,Mu,SI).call(this),r(this,K).defaultCountryKey&&this.setSelectedCountryItem(r(this,K).defaultCountryKey),l(this,Ve,ns).call(this,r(this,Qt),"blur",e=>{l(this,Gu,yI).call(this,e)}),l(this,Ve,ns).call(this,r(this,Qt),"input",e=>{l(this,Bu,MI).call(this,e)}),l(this,Ve,ns).call(this,r(this,Qt),"keydown",e=>{l(this,Uu,NI).call(this,e)}),l(this,Ve,ns).call(this,r(this,Qt),"focusout",e=>{l(this,Dc,Vm).call(this,e)}),r(this,K).selectedCountryClearable&&l(this,Ve,ns).call(this,r(this,fn),"click",e=>{l(this,Fu,$I).call(this,e)}),r(this,K).detectCountryByIp&&l(this,Nu,RI).call(this),r(this,K).detectCountryByGeo&&l(this,Pu,CI).call(this),r(this,K).searchClearable&&(l(this,ze,rs).call(this,r(this,ye),"padding-right","35px"),l(this,ze,rs).call(this,r(this,Di),"display","none"),l(this,Ve,ns).call(this,r(this,Di),"click",()=>{this.searchOptions("")})),r(this,ye)&&(r(this,ye).value=""),l(this,Ve,ns).call(this,r(this,ye),"keyup",e=>{l(this,Yu,kI).call(this,e)}),S(this,fo,r(this,K).placeholderImage?r(this,K).placeholderImage:r(this,fo)),r(this,ui).observeElm(r(this,Ae),"value",(e,s)=>{l(this,Nc,Bm).call(this,e,s)})}isValidated(){return l(this,Dc,Vm).call(this,{target:r(this,Ae)})}setSelectedCountryItem(e){if(this.value="",S(this,gn,e),!r(this,gn)){l(this,Gc,qm).call(this);return}const s=l(this,Xn,ga).call(this);s&&(r(this,K).selectedFlagImage&&(r(this,go).src=`${r(this,vo)}/${s.img}`),l(this,Hu,FI).call(this,s.code),this.setMenu({open:!1}),r(this,Fi)&&r(this,Qt).focus())}searchOptions(e){l(this,qu,jI).call(this,e);let s=[];e?(s=r(this,K).options.filter(i=>{const n=e.toLowerCase(),a=(i.lbl||"").toLowerCase(),o=(i.val||"").toLowerCase(),c=i.code||"";if(a.includes(n)||o.includes(n)||c.includes(n))return!0}),s.length||(s=[{i:0,lbl:r(this,K).noCountryFoundText}]),S(this,hi,s),r(this,K).searchClearable&&l(this,ze,rs).call(this,r(this,Di),"display","grid")):(S(this,hi,r(this,K).options),r(this,K).searchClearable&&l(this,ze,rs).call(this,r(this,Di),"display","none")),l(this,Bc,Ym).call(this)}setMenu({open:e}){var s;l(this,ze,rs).call(this,r(this,Rc),"max-height",`${e?r(this,K).maxHeight:0}px`),e?(l(this,Xu,GI).call(this),l(this,ws,Ks).call(this,r(this,Le),"menu-open"),l(this,Ve,ns).call(this,r(this,En),"click",i=>l(this,yc,km).call(this,i)),l(this,Rt,Mt).call(this,r(this,ye),"tabindex",0),l(this,Rt,Mt).call(this,r(this,Di),"tabindex",0),l(this,Rt,Mt).call(this,r(this,Vs),"aria-expanded",!0),l(this,Bc,Ym).call(this)):(r(this,Le).classList.remove("menu-open"),r(this,En).removeEventListener("click",l(this,yc,km)),setTimeout(()=>{this.searchOptions("")},100),l(this,Rt,Mt).call(this,r(this,ye),"tabindex",-1),l(this,Rt,Mt).call(this,r(this,Di),"tabindex",-1),(s=r(this,di))==null||s.querySelectorAll(".option").forEach(i=>{l(this,Rt,Mt).call(this,i,"tabindex",-1)}),l(this,Rt,Mt).call(this,r(this,Vs),"aria-expanded",!1))}set value(e){r(this,Ae).value=e||"",l(this,Rt,Mt).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,l(this,Rt,Mt).call(this,r(this,Vs),"tabindex",-1),l(this,Rt,Mt).call(this,r(this,Vs),"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"),l(this,Rt,Mt).call(this,r(this,Vs),"tabindex",0),l(this,Rt,Mt).call(this,r(this,Vs),"aria-label",r(this,K).placeholder||""))}get disabled(){return r(this,Ae).disabled}destroy(){r(this,di)&&(r(this,di).innerHTML=""),this.value="",S(this,Fi,!1),l(this,Zu,BI).call(this)}reset(e){l(this,Gc,qm).call(this),this.destroy(),this.value=e,this.init()}}fo=new WeakMap,Lu=new WeakMap,rf=new WeakMap,Le=new WeakMap,Ae=new WeakMap,fn=new WeakMap,Vs=new WeakMap,Rc=new WeakMap,go=new WeakMap,gn=new WeakMap,Au=new WeakMap,ye=new WeakMap,Cc=new WeakMap,Qt=new WeakMap,Di=new WeakMap,di=new WeakMap,Oc=new WeakMap,hi=new WeakMap,Eo=new WeakMap,bo=new WeakMap,Io=new WeakMap,$c=new WeakMap,Fi=new WeakMap,Lc=new WeakMap,K=new WeakMap,vo=new WeakMap,Ac=new WeakMap,wo=new WeakMap,En=new WeakMap,ui=new WeakMap,yu=new WeakSet,xI=function(e){const s=e.split("->");let i=r(this,ui);return s.forEach(n=>{i=i[n]}),i},he=new WeakSet,Te=function(e){return r(this,Le).querySelector(e)},Ve=new WeakSet,ns=function(e,s,i){e&&(e.addEventListener(s,i),r(this,Lc).push({selector:e,eventType:s,cb:i}))},Mu=new WeakSet,SI=function(){r(this,Ae).value&&(l(this,Nc,Bm).call(this,"",r(this,Ae).value),r(this,K).selectedCountryClearable&&l(this,ze,rs).call(this,r(this,fn),"display","grid"))},Nu=new WeakSet,RI=function(){const{protocol:e}=r(this,ui).location;fetch(`${e}//${r(this,Lu)}`).then(s=>s.text()).then(s=>{const i=s.trim().split(`
81 `).reduce((n,a)=>(a=a.split("="),n[a[0]]=a[1],n),{});this.setSelectedCountryItem(i.loc)})},Pu=new WeakSet,CI=function(){navigator.geolocation.getCurrentPosition(e=>{const{latitude:s,longitude:i}=e.coords,{protocol:n}=r(this,ui).location,a=n==="https:"?`${n}//secure`:`${n}//api`;fetch(`${a}.geonames.org/countryCodeJSON?username=bitcodezoho1&lat=${s}&lng=${i}`).then(o=>o.json()).then(o=>{this.setSelectedCountryItem(o.countryCode)})})},Du=new WeakSet,OI=function(e){var a,o;const s=r(this,En).activeElement;let i=null;const n=l(this,Kn,va).call(this);if(e.target!==r(this,Qt)){if(n){const c=Number(s.dataset.index||-1);if(e.key==="ArrowDown"||!e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,ye))i=l(this,he,Te).call(this,".option:not(.disabled-opt)");else if(s.classList.contains("option")){const d=l(this,To,Yd).call(this,c,"next"),h=l(this,Wr,al).call(this,d);h?i=h:d+1<r(this,hi).length&&((a=this.virtualOptionList)==null||a.scrollToIndex(d),setTimeout(()=>{const p=l(this,Wr,al).call(this,d);p&&p.focus()},50))}}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),s===r(this,ye))i=r(this,Qt),l(this,Kn,va).call(this)&&this.setMenu({open:!1});else if(s.classList.contains("option")){const d=l(this,To,Yd).call(this,c,"previous"),h=l(this,Wr,al).call(this,d);h?i=h:d>0?((o=this.virtualOptionList)==null||o.scrollToIndex(d),setTimeout(()=>{const p=l(this,Wr,al).call(this,d);p&&p.focus()},50)):h||(i=r(this,ye))}}else e.key==="Escape"&&this.setMenu({open:!1})}else if(e.key>="a"&&e.key<="z"){clearTimeout(r(this,Ac)),S(this,wo,r(this,wo)+e.key),S(this,Ac,setTimeout(()=>{S(this,wo,"")},300));const c=r(this,K).options.find(d=>!d.disabled&&d.lbl.toLowerCase().startsWith(r(this,wo)));c&&this.setSelectedCountryItem(c.i)}else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const c=l(this,jc,Wm).call(this),d=e.key==="ArrowDown"?"next":"previous",h=l(this,To,Yd).call(this,c,d);h>-1&&h<r(this,K).options.length&&(this.value=r(this,K).options[h].val)}i&&i.focus()}},_o=new WeakSet,qd=function(e,s){const i=new Event(s);e.dispatchEvent(i)},Fu=new WeakSet,$I=function(){r(this,Qt).value="",this.setSelectedCountryItem(""),l(this,_o,qd).call(this,r(this,Qt),"input"),l(this,_o,qd).call(this,r(this,Ae),"blur")},Wr=new WeakSet,al=function(e){return l(this,he,Te).call(this,`.${this.fieldKey}-option-list .option[data-index="${e}"]`)},To=new WeakSet,Yd=function(e=-1,s){if(s==="next"){const i=r(this,K).options.length;for(let n=e+1;n<i;n+=1)if(!r(this,K).options[n].disabled)return n}else if(s==="previous"){for(let i=e-1;i>=0;i-=1)if(!r(this,K).options[i].disabled)return i}},yc=new WeakSet,km=function(e){r(this,Le).contains(e.target)||this.setMenu({open:!1})},ju=new WeakSet,LI=function(){return r(this,K).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},{})},ku=new WeakSet,AI=function(){const e=r(this,K).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},xo=new WeakSet,Xd=function(e){let s=l(this,bn,vr).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,Eo))return i;return""},Mc=new WeakSet,Gm=function(e){let s=l(this,xo,Xd).call(this,e);return s&&s[0]!=="+"&&(s=`+${s}`),s},bn=new WeakSet,vr=function(e){return e.replace(/[^\d+]/g,"")},Hr=new WeakSet,ol=function(e){return e.replace(/[^\d]/g,"")},Nc=new WeakSet,Bm=function(e,s){l(this,Mc,Gm).call(this,s)&&e!==s&&l(this,Pc,Um).call(this,l(this,bn,vr).call(this,s)),typeof bit_conditionals!="undefined"&&bit_conditionals({target:r(this,Ae)})},Gu=new WeakSet,yI=function(){if(this.value.length>3){const e=l(this,bn,vr).call(this,this.value),s=l(this,xo,Xd).call(this,e);r(this,Qt).value=l(this,Yn,fa).call(this,s,e,r(this,K).inputFormat)}l(this,_o,qd).call(this,r(this,Ae),"blur")},Bu=new WeakSet,MI=function(e){const{value:s}=e.target;s&&r(this,K).selectedCountryClearable?l(this,ze,rs).call(this,r(this,fn),"display","grid"):r(this,K).selectedCountryClearable&&l(this,ze,rs).call(this,r(this,fn),"display","none"),l(this,Pc,Um).call(this,s)},Uu=new WeakSet,NI=function(e){(e.key==="Backspace"||e.key==="Delete")&&S(this,Io,!0)},Pc=new WeakSet,Um=function(e){let s=l(this,Xn,ga).call(this),i="";r(this,Fi)?i=s.code:i=l(this,Mc,Gm).call(this,e);const n=l(this,zu,PI).call(this,e,s);if(i!==e&&(!r(this,Fi)||!n)&&n!==(s==null?void 0:s.i)&&(this.setSelectedCountryItem(n),s=l(this,Xn,ga).call(this)),i&&s){let a=s.frmt;const o=r(this,K).valueFormat||"";a||(a=r(this,K).inputFormat||"");const c=l(this,Yn,fa).call(this,i,e,a);if(o){const d=l(this,Yn,fa).call(this,i,e,o);this.value=d}else this.value=e;r(this,Qt).value=c}else l(this,Fc,zm).call(this,l(this,Hr,ol).call(this,e))===""&&this.value!==e&&(this.value=e)},Vu=new WeakMap,Yn=new WeakSet,fa=function(e,s,i=""){const n=l(this,bn,vr).call(this,s);let a="",o=0;const c=n[0]==="+"?n.substring(1):n;for(let d=0;d<i.length&&!(o>=c.length);d+=1){const h=i[d];if(h==="c"){const p=e[0]==="+"?e.substring(1):e;a+=p,o+=p.length,a+=/[ \-().+/*[\]{}~|\\x]/.test(i[d+1]||"")&&p.length===c.length&&!r(this,Io)?i[d+1]:""}else if(h==="#"){if(!r(this,Vu).call(this,c[o]))break;a+=c[o],o+=1}else c[o]===h?(a+=h,o+=1):a+=h}return o<c.length&&(a+=c.substring(o)),S(this,Io,!1),a},Dc=new WeakSet,Vm=function(e){const s=l(this,Hr,ol).call(this,e.target.value);let i="required";const n=l(this,Xn,ga).call(this);if(n){const a=s.substring(l(this,Hr,ol).call(this,n.code).length);if(n.ptrn&&a){const o=n.ptrn.replace(/\$_bf_\$/g,"\\");i=new RegExp(`^(${o})$`).test(a)?"":"invalid"}a||(i="required")}return i&&(i=l(this,Fc,zm).call(this,l(this,Hr,ol).call(this,s),i)),i},Fc=new WeakSet,zm=function(e,s=""){const i=l(this,Wu,DI).call(this);return i.valid.regexr&&typeof regexPatternValidation!="undefined"?regexPatternValidation(e,i):s},zu=new WeakSet,PI=function(e,s){let i=l(this,xo,Xd).call(this,e);i&&i[0]!=="+"&&(i=`+${i}`);let n=r(this,Eo)[i.substring(1)]||"";if(s&&s.code===i&&(n=s.i),r(this,bo)[i]){const a=r(this,bo)[i],o=l(this,bn,vr).call(this,e).substring(i.length);a.forEach(c=>{if(c.ptrn&&o){const d=c.ptrn.replace(/\$_bf_\$/g,"\\").trim();if(new RegExp(`^(${d})$`).test(o))return n=c.i,n}})}return n},jc=new WeakSet,Wm=function(){const e=r(this,hi).findIndex(s=>s.i===r(this,gn));return e===-1?0:e},Xn=new WeakSet,ga=function(){return r(this,K).options.find(e=>e.i===r(this,gn))},Wu=new WeakSet,DI=function(){var e;return(e=r(this,ui).bf_globals[r(this,$c)])==null?void 0:e.fields[this.fieldKey]},Zn=new WeakSet,Ea=function(e){return r(this,En).createElement(e)},ws=new WeakSet,Ks=function(e,s){e.classList.add(s)},So=new WeakSet,Zd=function(e,s){e.textContent=s},Rt=new WeakSet,Mt=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},Qn=new WeakSet,ba=function(e,s){s.trim().split(/\b\s+\b/g).forEach(i=>l(this,ws,Ks).call(this,e,i))},Jn=new WeakSet,Ia=function(e,s){const i=s.length;if(i)for(let n=0;n<i;n+=1)l(this,Rt,Mt).call(this,e,s[n].key,s[n].value)},ze=new WeakSet,rs=function(e,s,i){var n;(n=e==null?void 0:e.style)==null||n.setProperty(s,i,"important")},af=new WeakSet,UR=function(){const e=l(this,he,Te).call(this,".option");if(!e)return;const s=r(this,ui).getComputedStyle(e),i=parseFloat(s.marginTop)+parseFloat(s.marginBottom),n=e.offsetHeight+i||0;n!==r(this,Oc)&&(S(this,Oc,n),r(this,di).innerHTML="",l(this,kc,Hm).call(this))},kc=new WeakSet,Hm=function(){var s;if(!r(this,di))return;r(this,di).innerHTML="";const e=r(this,hi).map((i,n)=>{const a=l(this,Zn,Ea).call(this,"li");if(l(this,Rt,Mt).call(this,a,"data-key",i.i),l(this,Rt,Mt).call(this,a,"data-index",n),"option"in r(this,K).attributes){const h=r(this,K).attributes.option;l(this,Jn,Ia).call(this,a,h)}if(!i.i)return l(this,So,Zd).call(this,a,i.lbl),l(this,ws,Ks).call(this,a,"opt-not-found"),a;if(l(this,ws,Ks).call(this,a,"option"),"option"in r(this,K).classNames){const h=r(this,K).classNames.option;h&&l(this,Qn,ba).call(this,a,h)}const o=l(this,Zn,Ea).call(this,"span");if(l(this,ws,Ks).call(this,o,"opt-lbl-wrp"),"opt-lbl-wrp"in r(this,K).classNames){const h=r(this,K).classNames["opt-lbl-wrp"];h&&l(this,Qn,ba).call(this,o,h)}if("opt-lbl-wrp"in r(this,K).attributes){const h=r(this,K).attributes["opt-lbl-wrp"];l(this,Jn,Ia).call(this,o,h)}if(r(this,K).optionFlagImage){const h=l(this,Zn,Ea).call(this,"img");if(l(this,ws,Ks).call(this,h,"opt-icn"),"opt-icn"in r(this,K).classNames){const p=r(this,K).classNames["opt-icn"];p&&l(this,Qn,ba).call(this,h,p)}if("opt-icn"in r(this,K).attributes){const p=r(this,K).attributes["opt-icn"];l(this,Jn,Ia).call(this,h,p)}h.src=`${r(this,vo)}/${i.img}`,h.alt=`${i.lbl} flag image`,h.loading="lazy",l(this,Rt,Mt).call(this,h,"aria-hidden",!0),o.append(h)}const c=l(this,Zn,Ea).call(this,"span");if(l(this,ws,Ks).call(this,c,"opt-lbl"),"opt-lbl"in r(this,K).classNames){const h=r(this,K).classNames["opt-lbl"];h&&l(this,Qn,ba).call(this,c,h)}if("opt-lbl"in r(this,K).attributes){const h=r(this,K).attributes["opt-lbl"];l(this,Jn,Ia).call(this,c,h)}l(this,So,Zd).call(this,c,i.lbl),o.append(c);const d=l(this,Zn,Ea).call(this,"span");if(l(this,ws,Ks).call(this,d,"opt-suffix"),"opt-suffix"in r(this,K).classNames){const h=r(this,K).classNames["opt-suffix"];h&&l(this,Qn,ba).call(this,d,h)}if(l(this,So,Zd).call(this,d,i.code),l(this,Rt,Mt).call(this,d,"data-dev-opt-suffix",this.fieldKey),"opt-suffix"in r(this,K).attributes){const h=r(this,K).attributes["opt-suffix"];l(this,Jn,Ia).call(this,d,h)}return l(this,Rt,Mt).call(this,a,"tabindex",l(this,Kn,va).call(this)?"0":"-1"),l(this,Rt,Mt).call(this,a,"role","option"),l(this,Rt,Mt).call(this,a,"aria-posinset",n+1),l(this,Rt,Mt).call(this,a,"aria-setsize",r(this,hi).length),l(this,Ve,ns).call(this,a,"click",h=>{S(this,Fi,!0),this.setSelectedCountryItem(h.currentTarget.dataset.key)}),l(this,Ve,ns).call(this,a,"keyup",h=>{h.key==="Enter"&&(S(this,Fi,!0),this.setSelectedCountryItem(h.currentTarget.dataset.key))}),i.disabled&&l(this,ws,Ks).call(this,a,"disabled-opt"),a.append(o,d),r(this,gn)===i.i?(l(this,ws,Ks).call(this,a,"selected-opt"),l(this,Rt,Mt).call(this,a,"aria-selected",!0)):l(this,Rt,Mt).call(this,a,"aria-selected",!1),a});return(s=r(this,di))==null||s.append(...e),!0},Hu=new WeakSet,FI=function(e){const s=l(this,bn,vr).call(this,r(this,Qt).value);if(s){let i=l(this,Xn,ga).call(this).frmt;i||(i=r(this,K).inputFormat||""),r(this,Qt).value=l(this,Yn,fa).call(this,e,s,i)}else r(this,Qt).value=e;if(!s)this.value=e;else{const i=r(this,K).valueFormat||"";this.value=i?l(this,Yn,fa).call(this,e,r(this,Qt).value,i):r(this,Qt).value}},Gc=new WeakSet,qm=function(){S(this,gn,""),r(this,K).selectedFlagImage&&(r(this,go).src=r(this,fo)),S(this,Fi,!1),this.setMenu({open:!1}),this.value="",r(this,K).selectedCountryClearable&&l(this,ze,rs).call(this,r(this,fn),"display","none")},Bc=new WeakSet,Ym=function(){if(!l(this,Kn,va).call(this))return;l(this,kc,Hm).call(this);const e=l(this,jc,Wm).call(this),s=l(this,he,Te).call(this,`.option[data-index="${e}"]`);return s&&s.scrollIntoView({block:"nearest",inline:"nearest"}),!0},qu=new WeakSet,jI=function(e){r(this,ye)&&(r(this,ye).value=e)},Yu=new WeakSet,kI=function(e){var s;if(e.key==="Enter"&&r(this,hi).length){const i=(s=l(this,he,Te).call(this,".option"))==null?void 0:s.dataset.key;this.setSelectedCountryItem(i),this.searchOptions("")}else this.searchOptions(e.target.value)},Kn=new WeakSet,va=function(){return r(this,Le).classList.contains("menu-open")},Xu=new WeakSet,GI=function(){const e=r(this,Cc).getBoundingClientRect(),s=e.top,i=r(this,ui).innerHeight-e.bottom;i<s&&i<r(this,K).maxHeight?(l(this,ze,rs).call(this,r(this,Le),"flex-direction","column-reverse"),l(this,ze,rs).call(this,r(this,Le),"bottom","0%")):(l(this,ze,rs).call(this,r(this,Le),"flex-direction","column"),l(this,ze,rs).call(this,r(this,Le),"bottom","auto"))},Uc=new WeakSet,Xm=function(e){var s,i;e.code==="Space"&&((s=r(this,ye))==null||s.focus(),this.setMenu({open:!0})),e.type==="click"&&(l(this,Kn,va).call(this)?this.setMenu({open:!1}):((i=r(this,ye))==null||i.focus(),this.setMenu({open:!0})))},Zu=new WeakSet,BI=function(){r(this,Lc).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};function VR({fieldKey:t,formID:e,attr:s,styleClasses:i}){const n=M.useRef(null),a=M.useRef(null),c=Z(Lt)[t],d=Z(od),{selectedFlagImage:h,hideCountryList:p,selectedCountryClearable:m,searchClearable:f,optionFlagImage:b,detectCountryByIp:g,detectCountryByGeo:v,defaultCountryKey:w,searchPlaceholder:x,noCountryFoundText:_,inputFormat:R,valueFormat:C}=c.config;return M.useEffect(()=>{n!=null&&n.current||(n.current=Pt(`.${t}-phone-fld-wrp`));const O=a.current,y=n.current;O&&y&&"destroy"in O&&O.destroy();const D=document.getElementById("bit-grid-layout").contentWindow;D.bit_virtualized_list||(D.bit_virtualized_list=Rf),D.observeElm||(D.observeElm=Rp);const{placeholderImage:L,options:F}=c,H={fieldKey:t,selectedFlagImage:h,hideCountryList:p,selectedCountryClearable:m,searchClearable:f,optionFlagImage:b,detectCountryByIp:g,detectCountryByGeo:v,defaultCountryKey:w,searchPlaceholder:x,noCountryFoundText:_,placeholderImage:L,options:F,inputFormat:R,valueFormat:C,assetsURL:`${d.assetsURL}/../static/countries/`,document:document.getElementById("bit-grid-layout").contentDocument,window:D,attributes:{option:_t(t,"option"),"opt-lbl-wrp":_t(t,"opt-lbl-wrp"),"opt-icn":_t(t,"opt-icn"),"opt-lbl":_t(t,"opt-lbl"),"opt-a":_t(t,"opt-prefix")},classNames:{option:T(t,"option"),"opt-lbl-wrp":T(t,"opt-lbl-wrp"),"opt-icn":T(t,"opt-icn"),"opt-lbl":T(t,"opt-lbl"),"opt-prefix":T(t,"opt-prefix")}};a.current=new BR(y,H)},[c]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:i}),u.jsx(Tt,{formID:e,fieldKey:t,fieldData:s,children:u.jsx("div",{className:`${t}-phone-fld-container`,children:u.jsxs("div",$(I({"data-dev-phone-fld-wrp":t,className:`${t}-phone-fld-wrp ${T(t,"phone-fld-wrp")} ${c.valid.disabled?"disabled":""} ${c.valid.readonly?"readonly":""}`,ref:n},A(t,"phone-fld-wrp")),{children:[u.jsx("input",I(I({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",I({"data-dev-selected-phone-img":t,alt:"Selected Country image","aria-hidden":"true",className:`${t}-selected-country-img ${T(t,"selected-phone-img")}`,src:"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>"},A(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",$(I({"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"})),m&&u.jsx("button",$(I({"data-testid":`${t}-inp-clr-btn`,"data-dev-input-clear-btn":t,type:"button",title:"Clear value",className:`${t}-input-clear-btn ${T(t,"input-clear-btn")}`},A(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",$(I({className:`${t}-option-wrp ${T(t,"option-wrp")}`,"data-dev-option-wrp":t},A(t,"option-search-wrp")),{children:u.jsxs("div",{className:`${t}-option-inner-wrp`,children:[u.jsxs("div",$(I({"data-dev-option-search-wrp":t,className:`${t}-option-search-wrp ${T(t,"option-search-wrp")}`},A(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:x,autoComplete:"off",tabIndex:"-1"}),u.jsxs("svg",$(I({className:`${t}-icn ${t}-opt-search-icn ${T(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"},A(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"})]})),f&&u.jsx("button",$(I({"data-testid":`${t}-srch-clr-btn`,type:"button","aria-label":"Clear search",className:`${t}-icn ${t}-search-clear-btn ${T(t,"search-clear-btn")}`,"data-dev-search-clear-btn":t,tabIndex:"-1"},A(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",$(I({className:`${t}-option-list ${T(t,"option-list")}`,tabIndex:"-1",role:"listbox","aria-label":"country list","data-dev-option-list":t},A(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 Zi,ll;function Cp({form:t,input:e}){var o,c;if(t?Zi=t:(o=e==null?void 0:e.form)!=null&&o.id&&([,Zi]=e.form.id.split("form-")),typeof window[Zi]=="undefined")return!1;let s={};if(ll=window[Zi].fields,t)s=zR();else if(e){if(!window[Zi].validateFocusLost)return!0;const d=UI(e.name);s={[d]:e.value},ll={[d]:ll[d]}}let i=!0;const n=Object.entries(ll);let{length:a}=n;for(;a--;){const[d,h]=n[a],p=h.typ,m=typeof s[d]=="string"?s[d].trim():s[d],f=document.querySelector(`#form-${Zi} .${d}`);if(window.getComputedStyle(f).display==="none"){Sd("",d);continue}let b="";if(!m){p==="check"&&(b=VI(m,h)),b=qR(h),Sd(b,d,h),b&&(i=!1);continue}if(p==="number"?b=YR(m,h):p==="email"?b=XR(m,h):p==="url"?b=ZR(m,h):p==="decision-box"?b=QR(m,h):p==="check"||p==="select"?b=tC(m,h):p==="file-up"&&(b=JR(m,h)),(c=h==null?void 0:h.valid)!=null&&c.regexr&&(b=KR(m,h),b)){Sd(b,d,h),i=!1;continue}Sd(b,d,h),b&&(i=!1)}return i}const UI=t=>t.slice(-2)==="[]"?t.slice(0,t.length-2):t,zR=()=>{const t=new FormData(document.getElementById(`form-${Zi}`)),e={};return Array.from(t.entries()).forEach(([i,n])=>{const a=UI(i);a in ll&&(e[a]?(Array.isArray(e[a])||(e[a]=[e[a]]),e[a].push(n)):e[a]=n)}),e},Sd=(t,e,s)=>{var n,a;const i=document.querySelector(`#form-${Zi} #${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`,WR(e)):(i.parentElement.style.marginTop=0,i.parentElement.style.height=0))},WR=t=>{const e=document.querySelector(`#form-${Zi} .btcd-fld-itm.${t}`),s=document.body.getBoundingClientRect(),n=e.getBoundingClientRect().top-s.top;HR(e)||window.scroll({top:n,behavior:"smooth"})},HR=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)},qR=t=>{var e;return(e=t==null?void 0:t.valid)!=null&&e.req?"required":""},Cf=t=>(t||"").split("$_bf_$").join("\\"),YR=(t,e)=>e.mn&&Number(t)<Number(e.mn)?"mn":e.mx&&Number(t)>Number(e.mx)?"mx":"",XR=(t,e)=>e.err.invalid.show?new RegExp(Cf(e.pattern)).test(t)?"":"invalid":"",ZR=(t,e)=>e.err.invalid.show?new RegExp(Cf(e.attr.pattern)).test(t)?"":"invalid":"",QR=(t,e)=>e.valid.req&&t!==e.msg.checked?"req":"",VI=(t,e)=>{var s;return(s=e==null?void 0:e.opt)!=null&&s.find(i=>i.req&&!(t||[]).includes(i.lbl))?"req":""},JR=(t,e)=>e.valid.req&&!Array.isArray(t)&&!t.name?"req":"",KR=(t,e)=>new RegExp(Cf(e.valid.regexr),e.valid.flags||"").test(t)?"":"regexr",tC=(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"?VI(t,e):""};function eC({attr:t,onBlurHandler:e,resetFieldValue:s,formID:i,fieldKey:n,styleClasses:a}){const[o,c]=M.useState(t.val||""),d=M.useRef([]),[h,p]=M.useState("");d.current=t.opt.map((g,v)=>{var w;return(w=d.current[v])!=null?w:M.createRef()});const m=g=>{t.valid.disabled||(c(g.target.value),e&&e(g),Ct(n))},f=g=>{const{name:v,form:w}=g.target;Cp({input:{name:v,form:w,value:o}})},b=g=>{c(g.target.value),p(g.target.value)};return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:i,fieldKey:n,fieldData:t,children:u.jsxs("div",$(I({"data-testid":`${n}-cc`,"data-dev-cc":n,className:`${n}-cc ${T(n,"cc")}`},A(n,"cc")),{children:[t.opt.map((g,v)=>u.jsxs("div",$(I({"data-testid":`${n}-cw`,"data-dev-cw":n,className:`${n}-cw ${T(n,"cw")}`},A(n,"cw")),{children:[u.jsx("input",I($(I(I(I(I({"data-testid":`${n}-ci`,id:`${n}-chk-${v}`,type:"radio",className:`${n}-ci ${T(n,"ci")}`,ref:d.current[v],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:o===(g.val||g.lbl)||!o&&g.check,onChange:m,onBlur:f}),A(n,"ci"))),u.jsxs("label",$(I({"data-testid":`${n}-cl`,"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-chk-${v}`,className:`${n}-cl ${T(n,"cl")}`},A(n,"cl")),{children:[u.jsx("span",$(I({"data-testid":`${n}-bx`,"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${T(n,"bx")}`},A(n,"bx")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp ${T(n,"svgwrp")}`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn ${T(n,"ck-icn")}`})})})),u.jsx("span",$(I({"data-testid":`${n}-ct`,"data-dev-ct":n,className:`${n}-ct ${T(n,"ct")}`},A(n,"ct")),{children:u.jsx(We,{html:g.lbl})}))]}))]}),`opr-${v+22}`)),t.addOtherOpt&&u.jsxs("div",$(I({"data-testid":`${n}-cw`,"data-dev-cw":n,className:`${n}-cw ${T(n,"cw")}`},A(n,"cw")),{children:[u.jsx("input",I($(I(I({"data-testid":`${n}-ci`,"data-oopt":n,id:`${n}-chk-${t.opt.length}`,type:"radio",className:`${n}-ci ${T(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:m,onBlur:f}),A(n,"ci"))),u.jsxs("label",$(I({"data-testid":`${n}-cl`,"data-dev-cl":n,"data-cl":!0,htmlFor:`${n}-chk-${t.opt.length}`,className:`${n}-cl ${T(n,"cl")}`},A(n,"cl")),{children:[u.jsx("span",$(I({"data-testid":`${n}-bx`,"data-dev-bx":n,"data-bx":!0,className:`${n}-bx ${T(n,"bx")}`},A(n,"bx")),{children:u.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",className:`${n}-svgwrp ${T(n,"svgwrp")}`,children:u.jsx("use",{"data-ck-icn":!0,href:`#${n}-ck-svg`,className:`${n}-ck-icn ${T(n,"ck-icn")}`})})})),u.jsx("span",$(I({"data-testid":`${n}-ct`,"data-dev-ct":n,className:`${n}-ct ${T(n,"ct")}`},A(n,"ct")),{children:t.otherOptLbl||"Other..."}))]})),u.jsx("div",{"data-oinp-wrp":!0,className:`${n}-other-inp-wrp`,children:u.jsx("input",$(I(I(I({"data-testid":`${n}-other-inp`,"data-dev-other-inp":n,type:"text",className:`${n}-other-inp ${T(n,"other-inp")}`},t.valid.otherOptReq&&{required:!0}),"otherInpPh"in t&&{placeholder:t.otherInpPh}),!("otherInpPh"in t)&&{placeholder:"Other..."}),{value:h,onChange:b}))})]}),`opt-${t.opt.length+24}`)]}))})]})}var $t,ji,_s,Vc,pi,Qu,Ro,qr,Ju,In,bt,Me,zc,Co,Wc,Yr,tr,Ts,Oo,Hc,qc,Xr,Ku,zI,tp,WI,ki,yn,ep,HI,Yc,Zm,Xc,Qm,sp,qI,ip,YI,Zc,Jm,er,wa,np,XI,vn,wr,Zr,cl,wn,_r,xs,ti,Qc,Km,Jc,tf;class sC{constructor(e,s){E(this,Ku);E(this,tp);E(this,ki);E(this,ep);E(this,Yc);E(this,Xc);E(this,sp);E(this,ip);E(this,Zc);E(this,er);E(this,np);E(this,vn);E(this,Zr);E(this,wn);E(this,xs);E(this,Qc);E(this,Jc);E(this,$t,null);E(this,ji,null);E(this,_s,[]);E(this,Vc,null);E(this,pi,null);E(this,Qu,null);E(this,Ro,!1);E(this,qr,!1);E(this,Ju,!1);E(this,In,null);E(this,bt,{});E(this,Me,null);E(this,zc,null);E(this,Co,null);E(this,Wc,null);E(this,Yr,null);E(this,tr,null);E(this,Ts,null);E(this,Oo,null);E(this,Hc,[]);E(this,qc,null);E(this,Xr,!1);S(this,Vc,(s==null?void 0:s.document)||document),S(this,pi,s==null?void 0:s.fieldKey),S(this,bt,{status:!1,indx:null}),typeof e=="string"?S(this,In,r(this,Vc).querySelector(e)):S(this,In,e),S(this,Qu,s==null?void 0:s.contentId),S(this,_s,(s==null?void 0:s.options)||[]),S(this,Ro,(s==null?void 0:s.showReviewLblOnHover)||!1),S(this,qr,(s==null?void 0:s.showReviewLblOnSelect)||!1),S(this,Ju,(s==null?void 0:s.selectedRating)||!1),S(this,qc,(s==null?void 0:s.defaultValue)||null),this.init()}init(){l(this,Ku,zI).call(this),S(this,$t,r(this,In).querySelectorAll(r(this,zc))),S(this,ji,l(this,sp,qI).call(this,r(this,Wc))),l(this,tp,WI).call(this),l(this,ep,HI).call(this),r(this,$t).forEach((e,s)=>{if(r(this,bt).status&&s<=r(this,bt).indx){const i=e.querySelector(r(this,Me));if(l(this,wn,_r).call(this,i,r(this,Ts)),r(this,_s)[s].check){const n=e.querySelector(r(this,Co));n.checked=!0}}l(this,ki,yn).call(this,e,"mouseover",()=>{const i=parseInt(e.dataset.indx);l(this,ip,YI).call(this,i)}),l(this,ki,yn).call(this,e,"mouseout",()=>{const{indx:i}=e.dataset;l(this,Zc,Jm).call(this,i)}),l(this,ki,yn).call(this,e,"click",i=>{const{indx:n}=e.dataset;i.preventDefault(),S(this,Xr,!0),l(this,er,wa).call(this,n)}),l(this,ki,yn).call(this,e,"touchstart",i=>{i.preventDefault();const{indx:n}=e.dataset;S(this,Xr,!0),l(this,er,wa).call(this,n)}),l(this,ki,yn).call(this,e,"touchend",()=>{const{indx:i}=e.dataset;l(this,Zc,Jm).call(this,i)})})}set value(e){const s=r(this,_s).findIndex(i=>i.val===e);s!==-1&&l(this,er,wa).call(this,s)}get value(){const e=r(this,_s)[r(this,bt).indx];return e.val||e.lbl}destroy(){l(this,Qc,Km).call(this),l(this,Jc,tf).call(this),S(this,$t,null),S(this,ji,null)}reset(){l(this,Qc,Km).call(this),l(this,Jc,tf).call(this),S(this,bt,{status:!1,indx:null}),S(this,Oo,null),this.init()}}$t=new WeakMap,ji=new WeakMap,_s=new WeakMap,Vc=new WeakMap,pi=new WeakMap,Qu=new WeakMap,Ro=new WeakMap,qr=new WeakMap,Ju=new WeakMap,In=new WeakMap,bt=new WeakMap,Me=new WeakMap,zc=new WeakMap,Co=new WeakMap,Wc=new WeakMap,Yr=new WeakMap,tr=new WeakMap,Ts=new WeakMap,Oo=new WeakMap,Hc=new WeakMap,qc=new WeakMap,Xr=new WeakMap,Ku=new WeakSet,zI=function(){S(this,Me,`.${r(this,pi)}-rating-img`),S(this,zc,`.${r(this,pi)}-rating-lbl`),S(this,Co,`.${r(this,pi)}-rating-input`),S(this,Wc,`.${r(this,pi)}-rating-msg`),S(this,Yr,`${r(this,pi)}-rating-hover`),S(this,tr,`${r(this,pi)}-rating-scale`),S(this,Ts,`${r(this,pi)}-rating-selected`)},tp=new WeakSet,WI=function(){r(this,_s).forEach((e,s)=>{(r(this,qc)===e.val||e!=null&&e.check)&&(S(this,bt,{status:!0,indx:s}),r(this,qr)?l(this,vn,wr).call(this,s):l(this,Zr,cl).call(this))})},ki=new WeakSet,yn=function(e,s,i){e.addEventListener(s,i),r(this,Hc).push({selector:e,eventType:s,cb:i})},ep=new WeakSet,HI=function(){let e=-1;const s=r(this,_s).findIndex(i=>i.check);s!==-1&&(e=s),l(this,ki,yn).call(this,r(this,In),"keydown",i=>{if(i.key==="ArrowRight"){if(r(this,_s).length===e)return;e+=1;const n=i.target.children[e],a=parseInt(n.dataset.indx);if(r(this,bt).indx!==a&&l(this,er,wa).call(this,a),l(this,Yc,Zm).call(this,a),r(this,_s).length===e+1)return!1}else if(i.key==="ArrowLeft"){if(e===0||e-1<0)return;e-=1,l(this,er,wa).call(this,e),l(this,Yc,Zm).call(this,e)}}),l(this,ki,yn).call(this,r(this,In),"focusout",()=>{l(this,Xc,Qm).call(this)})},Yc=new WeakSet,Zm=function(e){l(this,Xc,Qm).call(this);const s=r(this,$t)[e].querySelector(r(this,Me));l(this,wn,_r).call(this,s,r(this,tr))},Xc=new WeakSet,Qm=function(){for(let e=0;e<r(this,_s).length;e+=1){const s=r(this,$t)[e].querySelector(r(this,Me));l(this,xs,ti).call(this,s,r(this,tr))}},sp=new WeakSet,qI=function(e){return r(this,In).querySelector(e)},ip=new WeakSet,YI=function(e){var s,i;if(r(this,Ro)&&l(this,vn,wr).call(this,e),r(this,bt).indx&&(s=r(this,$t))!=null&&s[r(this,bt).indx]){const n=r(this,$t).length-1;r(this,$t).forEach(a=>{const o=a.querySelector(r(this,Me));l(this,xs,ti).call(this,o,r(this,Ts))});for(let a=0;a<=r(this,bt).indx;a+=1){const o=r(this,$t)[a].querySelector(r(this,Me));l(this,xs,ti).call(this,o,r(this,Ts))}if(r(this,bt).indx===n)for(let a=0;a<=r(this,bt).indx;a+=1){const o=r(this,$t)[a].querySelector(r(this,Me));l(this,xs,ti).call(this,o,r(this,Ts))}}for(let n=0;n<=e;n+=1)if(n<=e&&((i=r(this,$t))!=null&&i[n])){const a=r(this,$t)[n].querySelector(r(this,Me));l(this,wn,_r).call(this,a,r(this,Yr)),n===e&&l(this,wn,_r).call(this,a,r(this,tr))}},Zc=new WeakSet,Jm=function(e){var s,i;r(this,Ro)&&(r(this,bt).status&&r(this,bt).indx===e?l(this,vn,wr).call(this,e):r(this,bt).status?l(this,vn,wr).call(this,r(this,bt).indx):r(this,ji)&&l(this,Zr,cl).call(this));for(let n=0;n<=e;n+=1)if((s=r(this,$t))!=null&&s[n]){const a=r(this,$t)[n].querySelector(r(this,Me));l(this,xs,ti).call(this,a,r(this,Yr)),l(this,xs,ti).call(this,a,r(this,tr))}if(r(this,bt).status&&(i=r(this,$t))!=null&&i[r(this,bt).indx])for(let n=0;n<=r(this,bt).indx;n+=1){const a=r(this,$t)[n].querySelector(r(this,Me));l(this,wn,_r).call(this,a,r(this,Ts))}r(this,qr)?l(this,vn,wr).call(this,r(this,bt).indx):l(this,Zr,cl).call(this)},er=new WeakSet,wa=function(e){var i,n,a,o;if((i=r(this,$t))!=null&&i[r(this,bt).indx]){const c=r(this,$t)[r(this,bt).indx].querySelector(r(this,Me));l(this,xs,ti).call(this,c,r(this,Ts))}const s=(n=r(this,$t))==null?void 0:n[e].querySelector(r(this,Co));r(this,Oo)&&r(this,Xr)?s!=null&&s.checked?(s.checked=!1,S(this,bt,{status:!1,indx:null})):(s.checked=!0,S(this,bt,{status:!0,indx:e})):(s.checked=!0,S(this,bt,{status:!0,indx:e}),S(this,Oo,s)),s.dispatchEvent(new Event("input")),(a=r(this,$t))==null||a.forEach(c=>{const d=c.querySelector(r(this,Me));l(this,xs,ti).call(this,d,r(this,Yr))}),(o=r(this,$t))==null||o.forEach((c,d)=>{const h=c.querySelector(r(this,Me));d<=e&&r(this,bt).status?l(this,wn,_r).call(this,h,r(this,Ts)):l(this,xs,ti).call(this,h,r(this,Ts))}),r(this,qr)&&r(this,bt).status?l(this,vn,wr).call(this,e):l(this,Zr,cl).call(this),S(this,Xr,!1)},np=new WeakSet,XI=function(e){return r(this,_s)[e]},vn=new WeakSet,wr=function(e){const s=l(this,np,XI).call(this,e);r(this,ji)&&s&&(r(this,ji).innerText=s.lbl)},Zr=new WeakSet,cl=function(){r(this,ji)&&(r(this,ji).innerHTML="")},wn=new WeakSet,_r=function(e,s){e.classList.add(s)},xs=new WeakSet,ti=function(e,s){e.classList.remove(s)},Qc=new WeakSet,Km=function(){r(this,$t).forEach(e=>{const s=e.querySelector(r(this,Me));l(this,xs,ti).call(this,s,r(this,Ts))})},Jc=new WeakSet,tf=function(){r(this,Hc).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})};function iC({attr:t,formID:e,fieldKey:s,styleClasses:i}){const{"*":n}=fp(),a=Z(ve),{styleMode:o}=a,[c,d]=n.split("/"),h=o&&c==="field-theme-customize"&&d==="rating-msg",m=Z(Lt)[s],f=M.useRef(null),b=M.useRef(null);return M.useEffect(()=>{var x;f!=null&&f.current||(f.current=Pt(`.${s}-inp-fld-wrp`));const g=b.current,v=f.current;g&&v&&"destroy"in g&&g.destroy();const w={options:t.opt,showReviewLblOnHover:t.showReviewLblOnHover,showReviewLblOnSelect:t.showReviewLblOnSelect,selectedRating:t.selectedRating,fieldKey:s,document:(x=document.getElementById("bit-grid-layout"))==null?void 0:x.contentDocument};b.current=new sC(v,w)},[m]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:i}),u.jsx(Tt,{formID:e,fieldKey:s,fieldData:t,children:u.jsxs("div",$(I({"data-testid":`${s}-inp-fld-wrp`,"data-dev-inp-fld-wrp":s,className:`${s}-inp-fld-wrp ${T(s,"inp-fld-wrp")}`},A(s,"inp-fld-wrp")),{ref:f,children:[u.jsx("div",$(I({"data-testid":`${s}-rating-wrp`,"data-dev-rating-wrp":s,className:`${s}-rating-wrp ${T(s,"rating-wrp")}`},A(s,"rating-wrp")),{children:t.opt.map((g,v)=>u.jsxs("label",$(I({className:`${s}-rating-lbl ${T(s,"rating-lbl")}`,"data-testid":`${s}-rating-lbl`,"data-dev-rating-lbl":s,htmlFor:`${s}-rating-${v}`},A(s,"rating-lbl")),{"data-indx":v,children:[u.jsx("input",$(I({type:"radio",className:`${s}-rating-input`,name:"rating",value:g.val,"aria-label":`rating-input-${v}`,id:`${s}-rating-${v}`},g.check&&{checked:!0}),{defaultChecked:g==null?void 0:g.check})),u.jsx("img",$(I({className:`${s}-rating-img ${T(s,"rating-img")}`,src:g.img,alt:g==null?void 0:g.lbl,"aria-label":g==null?void 0:g.lbl},A(s,"rating-img")),{"data-testid":`${s}-rating-input`,"data-dev-rating-img":s}))]}),g.val))})),u.jsx("span",$(I({className:`${s}-rating-msg ${T(s,"rating-msg")}`,"data-testid":`${s}-rating-msg`,"data-dev-rating-msg":s},A(s,"rating-msg")),{children:h&&(m.showReviewLblOnSelect||m.showReviewLblOnHover)&&"Rating Message"}))]}))})]})}var Qr,$o,Ut,Kc,_n,Lo,td,ed,Ao,Qd,rp,ZI,ap,QI,sr,_a,op,lp,JI,cp,KI,zs,_i,sd,ef,dp,tv;class nC{constructor(e,s){E(this,Ao);E(this,rp);E(this,ap);E(this,sr);E(this,lp);E(this,cp);E(this,zs);E(this,sd);E(this,dp);E(this,Qr,null);E(this,$o,"");E(this,Ut,{clientId:"",options:{currency:"INR",amount:1,amountType:"fixed",theme:{},modal:{},prefill:{},notes:{}}});E(this,Kc,[]);E(this,_n,null);E(this,Lo,null);E(this,td,null);E(this,ed,null);E(this,op,e=>{var a;const s=document.getElementById(`${l(this,zs,_i).call(this)}`);s.classList.add("pos-rel","form-loading");const i=document.getElementById(`form-${l(this,zs,_i).call(this)}`),n=(a=l(this,zs,_i).call(this))==null?void 0:a.split("_")[1];if(typeof i!="undefined"&&i!==null){const o=bf_globals[l(this,zs,_i).call(this)];r(this,_n)&&(o.entryId=r(this,_n));let c=bfSelect(`input[name="${r(this,Ut).fieldKey}"]`,i);c?c.value=e.razorpay_payment_id:setHiddenFld({name:r(this,Ut).fieldKey,value:e.razorpay_payment_id,type:"text"},i);let d=bfSelect('button[type="submit"]',i);d||(d=document.createElement("button"),l(this,sd,ef).call(this,d,"type","submit"),d.style.display="none",i.append(d)),d.click();const h={formID:n,fieldKey:r(this,Ut).fieldKey,transactionID:e.razorpay_payment_id,payment_type:r(this,Ut).payType==="subscription"?"subscription":"order",entry_id:r(this,_n)},p=new URL(o==null?void 0:o.ajaxURL);p.searchParams.append("_ajax_nonce",o==null?void 0:o.nonce),p.searchParams.append("action","bitforms_save_razorpay_details"),fetch(p,{method:"POST",body:JSON.stringify(h)}).then(()=>{s.classList.remove("pos-rel","form-loading"),S(this,_n,null),c=bfSelect(`input[name="${r(this,Ut).fieldKey}"]`,i),c&&(l(this,sd,ef).call(this,c,"value",""),c.value="")})}});var i;Object.assign(r(this,Ut),s),S(this,Lo,s.document||document),S(this,td,s.window||window),S(this,$o,`#form-${l(this,zs,_i).call(this)}`),typeof e=="string"?S(this,Qr,r(this,Lo).querySelector(e)):S(this,Qr,e),S(this,ed,(i=r(this,Ut))==null?void 0:i.formID),this.init()}init(){l(this,rp,ZI).call(this,l(this,Ao,Qd).call(this,`.${r(this,Ut).fieldKey}-razorpay-btn`),"click",()=>{l(this,cp,KI).call(this)})}destroy(){l(this,ap,QI).call(this)}reset(){this.destroy(),this.init()}}Qr=new WeakMap,$o=new WeakMap,Ut=new WeakMap,Kc=new WeakMap,_n=new WeakMap,Lo=new WeakMap,td=new WeakMap,ed=new WeakMap,Ao=new WeakSet,Qd=function(e,s){return s?r(this,Lo).querySelector(s).querySelector(e):r(this,Qr).querySelector(e)},rp=new WeakSet,ZI=function(e,s,i){e.addEventListener(s,i),r(this,Kc).push({selector:e,eventType:s,cb:i})},ap=new WeakSet,QI=function(){r(this,Kc).forEach(({selector:e,eventType:s,cb:i})=>{e.removeEventListener(s,i)})},sr=new WeakSet,_a=function(e){if(e){const s=window.bf_globals[l(this,zs,_i).call(this)].fields[e].fieldName;let i=l(this,Ao,Qd).call(this,`[name="${s}"]`,r(this,$o));if(i&&i.type==="radio"&&(i=l(this,Ao,Qd).call(this,`[name="${s}"]:checked`,r(this,$o))),i&&i.value)return i.value}return""},op=new WeakMap,lp=new WeakSet,JI=function(e){return Vo(this,null,function*(){var c;const s=bf_globals[l(this,zs,_i).call(this)],i=document.getElementById(`${l(this,zs,_i).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 o=yield(yield fetch(n,{method:"POST",body:JSON.stringify(e)})).json();return i.classList.remove("pos-rel","form-loading"),(c=o.data)!=null&&c.error||!o.success?"":o.data.id})},cp=new WeakSet,KI=function(){return Vo(this,null,function*(){var O,y;const{currency:e,amount:s,amountType:i,amountFld:n,name:a,description:o,theme:c,prefill:d,modal:h,notes:p}=r(this,Ut).options,{confirm_close:m}=h,{contentId:f}=r(this,Ut);let b=p;typeof replaceFieldAndSmartValues!="undefined"&&b&&(b=JSON.parse(replaceFieldAndSmartValues(JSON.stringify(b),f)));const g=l(this,dp,tv).call(this,i==="dynamic"?l(this,sr,_a).call(this,n):s)*100;try{yield isFormValidatedWithoutError(f)}catch(D){return!1}const v=yield saveFormProgress(f),w=v==null?void 0:v[f];if(!(w!=null&&w.success))return;w.data.entry_id&&S(this,_n,w.data.entry_id);let x="";if(b=$(I({},b),{formID:r(this,ed),entryID:r(this,_n),fieldKey:r(this,Ut).fieldKey}),typeof bf_modify_razorpay_notes!="undefined"&&(b=bf_modify_razorpay_notes(b)),r(this,Ut).includeOrderId)if(!r(this,Ut).newOrderId&&r(this,Ut).orderIdFld!=="")x=l(this,sr,_a).call(this,r(this,Ut).orderIdFld);else{const D={payIntegID:r(this,Ut).payIntegID,currency:e,amount:g,notes:b};x=yield l(this,lp,JI).call(this,D)}const _={key:r(this,Ut).clientId,currency:e,amount:g,name:a,description:o,theme:c,order_id:x,prefill:{name:l(this,sr,_a).call(this,d.prefillNameFld),email:l(this,sr,_a).call(this,d.prefillEmailFld),contact:l(this,sr,_a).call(this,d.prefillContactFld)},notes:b,modal:{backdropclose:!1,escape:!1,confirm_close:m},handler:D=>Vo(this,null,function*(){return r(this,op).call(this,D)})},R={options:_,config:r(this,Ut),contentId:l(this,zs,_i).call(this)};(y=(O=r(this,Qr))==null?void 0:O.dispatchEvent)==null||y.call(O,new CustomEvent("bf-razorpay-options",{bubbles:!0,detail:R})),new(r(this,td)).Razorpay(_).open()})},zs=new WeakSet,_i=function(){return r(this,Ut).contentId},sd=new WeakSet,ef=function(e,s,i){var n;(n=e==null?void 0:e.setAttribute)==null||n.call(e,s,i)},dp=new WeakSet,tv=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 rC({fieldKey:t,formID:e,attr:s,isBuilder:i,styleClasses:n}){const a=Z(Ep),c=Z(Lt)[t],[d,h]=M.useState(""),p=M.useRef(null),m=M.useRef(null),[f,b]=M.useState(!1);return M.useEffect(()=>{if(!d){fl({fieldKey:t,errorKey:"razorpayClientIdMissing",errorMsg:Pe("Razorpay Client ID is missing"),errorUrl:`field-settings/${t}`});return}if(bp(t,"razorpayClientIdMissing"),f)return;const v={src:"https://checkout.razorpay.com/v1/checkout.js",integrity:"",id:`bf-razorpay-script-${t}`,scriptInGrid:!1,callback:()=>{b(!0)}};ld(v)},[d]),M.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 v=g.apiKey;h(v)},[s.payIntegID]),M.useEffect(()=>{if(!f)return;p!=null&&p.current||(p.current=Pt(`${t}-razorpay-wrp`));const g=p.current,v=m.current;if((!d||v&&g&&"destroy"in v)&&(v.destroy(),Ct(t)),!d)return;const w={clientId:d,fieldKey:t,options:c.options,onPaymentSuccess:x=>{},onPaymentFailed:()=>{}};m.current=new nC(g,w)},[f,c]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:n}),u.jsxs(Tt,{formID:e,fieldData:s,fieldKey:t,noLabel:!0,noErrMsg:!0,isBuilder:i,children:[f&&d&&u.jsx("div",{className:"bf-form",children:u.jsx("div",{ref:p,className:`${t}-razorpay-wrp`,children:u.jsxs("button",$(I({type:"button","data-dev-razorpay-btn":t,className:`${t}-razorpay-btn ${T(t,"razorpay-btn")}`},A(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",$(I({"data-dev-razorpay-btn-text":t,className:`${t}-razorpay-btn-text ${T(t,"razorpay-btn-text")}`},A(t,"razorpay-btn-text")),{children:[u.jsx("span",$(I({"data-dev-razorpay-btn-title":t,className:`${t}-razorpay-btn-title ${T(t,"razorpay-btn-title")}`},A(t,"razorpay-btn-title")),{children:c.btnTxt})),c.subTitl&&u.jsx("span",$(I({"data-dev-razorpay-btn-sub-title":t,className:`${t}-razorpay-btn-sub-title ${T(t,"razorpay-btn-sub-title")}`},A(t,"razorpay-btn-sub-title")),{children:"Secured by Razorpay"}))]}))]}))})}),(!f||!d)&&u.jsxs("p",{children:["Please select a Razorpay account from",u.jsx("strong",{children:" Field Settings "}),"to load Razorpay field."]})]})]})}function aC({fieldKey:t,formId:e,styleClasses:s}){var g;const i=M.useRef(null),n=M.useRef(null),o=Z(Lt)[t],c=Z(or),{styleMode:d}=Z(ve),h=((g=o.hidden)==null?void 0:g.includes(c))||!1,p=M.useRef(null),m=Z(mv),{siteKey:f=""}=m||{};M.useEffect(()=>{window.renderGrecaptcha=b;const w={src:"https://www.google.com/recaptcha/api.js?onload=renderGrecaptcha&render=explicit",integrity:"",id:"bf-recaptcha-script",async:!0,defer:!0};return ld(w),()=>{clearInterval(n.current),gp(w.id)}},[]);function b(){let v=Pt(`.${t}-recaptcha`);p.current!==null&&(v==null||v.remove(),window.grecaptcha.reset(p.current),v=document.createElement("div"),v.classList.add(`${t}-recaptcha`),i.current.appendChild(v)),p.current=window.grecaptcha.render(v,{sitekey:f,theme:o.config.theme,size:o.config.size}),Ct(t),n.current&&clearInterval(n.current),n.current=setInterval(()=>{window.grecaptcha.reset(p.current)},3e4)}return M.useEffect(()=>{window.grecaptcha&&b()},[o]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:s}),u.jsx("div",{"data-dev-fld-wrp":t,className:`${t}-recaptcha-container ${t}-fld-wrp ${d?"":"drag"} ${h?"fld-hide":""}`,children:f!==""?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 oC({fieldKey:t,attr:e,styleClasses:s,formID:i}){var Xs,Wi,hr;const{formType:n}=fp(),a=Ei(s),[o,c]=qs(Vg),[d,h]=M.useState(Ei(o[t]||{lg:[],md:[],sm:[]})),[p,m]=qs(zg),[f,b]=qs(Wg),g=Z(Hg),v=bi(qg),w=Z(Lt),{styleMode:x}=Z(ve),[_,R]=qs(Do),C=M.useRef(null),{ref:O,isComponentVisible:y,setIsComponentVisible:D}=Z(Yg),L=Z(or),F=Z(Xg),H=bi(Zg),B=bi(Qg),k=Z(Jg),{recalculateNestedField:X}=Z(lf),{fieldKey:P,parentFieldKey:Y,counter:j}=X,N=of(),G=Kg(),{btnPosition:U}=e,q=M.useRef(null),V=M.useRef(null),lt=M.useRef(L);M.useEffect(()=>{if(j>0&&t===Y){const tt=tE(d,P);h(tt),M.startTransition(()=>{c(it=>Kt(it,wt=>{wt[t]=tt})),Ct(t)})}},[j,Y,P]),M.useEffect(()=>{h(Ei(o[t]||{lg:[],md:[],sm:[]}))},[o[t]]),M.useEffect(()=>{if(F.respectLGLayoutOrder&&d.lg&&d.lg.length>0&&d.lg.length<100)try{const it=Jd("lg",d.lg,d,!0,dl);h(it),M.startTransition(()=>{c(wt=>Kt(wt,yt=>{yt[t]=it}))})}catch(it){}},[]),M.useEffect(()=>{const tt=lt.current;if(tt!==L&&F.respectLGLayoutOrder){q.current&&(q.current(),q.current=null),V.current&&(clearTimeout(V.current),V.current=null);const it=eE(`nested-${t}-breakpoint-switch`,()=>{try{const wt=$a("nestedLayouts")[t];if(!wt)return;const yt=Jd(tt,wt[tt],wt,!0,dl);h(yt),M.startTransition(()=>{c(Yt=>Kt(Yt,us=>{us[t]=yt}))})}catch(wt){H({show:!0,msg:"Failed to sync nested layout"})}},300);q.current=it}return lt.current=L,()=>{q.current&&q.current(),V.current&&clearTimeout(V.current)}},[L,F.respectLGLayoutOrder,t,c]);const ot=tt=>{tt.findIndex(it=>it.i==="shadow_block")<0&&(q.current&&(q.current(),q.current=null),V.current&&(clearTimeout(V.current),V.current=null),h(it=>$(I({},it),{[L]:tt})),M.startTransition(()=>{c(it=>Kt(it,wt=>{wt!=null&&wt[t]&&(wt[t][L]=tt)}))}))},ct=(tt,it)=>{const wt=th(k.fieldData,"repeater");if(!wt)return;const{newLayouts:yt,historyData:Yt}=oE(d,wt,k.fieldSize,it);h(yt),M.startTransition(()=>{c(us=>Kt(us,Hi=>{Hi[t]=yt})),B(!0),Ct(t),Yt.state.nestedLayouts=$a("nestedLayouts"),eh(Yt)})},ft=Pt(`.${t}-rpt-wrp`),J=ft&&Rd(ft),st=J?J.width-(J.paddingLeft+J.paddingRight+J.borderLeft+J.borderRight):0,at=Pt(`.${t}-pair-btn-wrp`),gt=at&&Rd(at),ht=gt&&["row","row-reverse"].includes(U)?gt.width:0,He=Pt(`.${t}-rpt-grid-wrp`),Ss=He&&Rd(He),lr=st-ht-(Ss?Ss.paddingLeft+Ss.paddingRight+Ss.borderLeft+Ss.borderRight:0),zi=()=>{m({}),D(!1)},Rn=()=>{N(G.pathname.replace(/style\/.+|style/g,"fs"),{replace:!0}),zi()},hd=tt=>{N(`/form/builder/${n}/${i}/field-theme-customize/quick-tweaks/${tt}`,{replace:!0}),zi()},cr=(tt,it)=>{tt.preventDefault(),tt.stopPropagation(),nt(tt,it)},dr=(tt,it)=>{tt.stopPropagation(),b(it),gl(p)||m({}),et(),!x&&N(`/form/builder/${n}/${i}/field-settings/${it}`)},et=()=>{gl(_)||(C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{R({}),C.current=null},700))},nt=(tt,it)=>{var Af;const{button:wt}=tt;let yt,Yt,us,Hi;const ur=O.current.getBoundingClientRect().top+window.scrollY,Cn=O.current.getBoundingClientRect().left+window.scrollX,Bo=Pt("#layout-wrapper"),Uo=Number(Bo.style.width.match(/\d+/gi)),$f=Number(Bo.style.height.match(/\d+/gi)),Lf=170,ud=200;if(wt===0){const yf=(Af=Pt(`[data-key="${it}"]`))==null?void 0:Af.querySelector(".blk-wrp-down-btn"),Op=30,Mf=yf.getBoundingClientRect().top+Op,Nf=yf.getBoundingClientRect().left;if(yt=Nf-Cn+5,Yt=Mf-ur+2,us=yt+Lf>Uo,Hi=Yt+ud>$f,us&&(yt=Nf+Op-Cn-148),Hi&&(Yt=Mf-ur-(ud+Op+7)),f!==it&&(yt+=3),y&&p.fldKey===it&&p.x===yt&&p.y===Yt){zi();return}}else wt===2&&(yt=tt.clientX-Cn+5,Yt=tt.clientY-ur,us=yt+Lf>Uo,Hi=Yt+ud>$f,us&&(yt=tt.clientX-Cn-150),Hi&&(Yt=tt.clientY-ur-ud));b(it),m({fldKey:it,x:yt,y:Yt}),D(!0)},vt=tt=>{if(!iE){v(I({show:!0},nE.fieldClone));return}const it=w[tt];if(!th(it))return;const{newLayouts:wt}=lE(tt,d);h(wt),M.startTransition(()=>{c(yt=>Kt(yt,Yt=>{Yt[t]=wt})),Ct(t)})},At=tt=>{const{newLayouts:it,historyData:wt}=cE(tt,d);h(it),M.startTransition(()=>{c(yt=>Kt(yt,Yt=>{Yt[t]=it})),Ct(t),wt.state.nestedLayouts=$a("nestedLayouts"),eh(wt)}),N(`/form/builder/${n}/${i}/fields-list`,{replace:!0})},ee=tt=>{tt.stopPropagation(),Kd(tt,{i:t,x:0,y:0,h:0,w:60},t)};return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:i,fieldKey:t,fieldData:e,noErrMsg:!0,children:u.jsx("div",$(I({"data-testid":`${t}-inp-fld-wrp`,"data-dev-inp-fld-wrp":t,className:`${t}-inp-fld-wrp ${T(t,"inp-fld-wrp")}`},A(t,"inp-fld-wrp")),{children:u.jsxs("div",$(I({"data-testid":`${t}-rpt-fld-wrp`,"data-dev-rpt-fld-wrp":t,className:`${t}-rpt-fld-wrp ${T(t,"rpt-fld-wrp")}`},A(t,"rpt-fld-wrp")),{children:[u.jsxs("div",$(I({"data-testid":`${t}-rpt-wrp`,"data-dev-rpt-wrp":t,className:`${t}-rpt-wrp ${T(t,"rpt-wrp")}`},A(t,"rpt-wrp")),{children:[u.jsx("div",$(I({"data-testid":`${t}-rpt-grid-wrp`,"data-dev-rpt-grid-wrp":t,className:`${t}-rpt-grid-wrp ${T(t,"rpt-grid-wrp")}`},A(t,"rpt-grid-wrp")),{children:u.jsxs("div",{style:{width:lr,display:"inline-block"},id:`${t}-layout-wrapper`,onDragOver:tt=>tt.preventDefault(),onDragEnter:tt=>tt.preventDefault(),onMouseMove:()=>M.startTransition(()=>{B(!1)}),onMouseLeave:()=>M.startTransition(()=>{B(!0)}),children:[x?u.jsx("div",{className:"_frm-g",children:(Wi=d==null?void 0:d[L])==null?void 0:Wi.map(tt=>u.jsx("div",{"data-key":tt.i,className:tt.i,onClick:it=>dr(it,tt.i),onKeyDown:it=>dr(it,tt.i),role:"button",tabIndex:0,onContextMenu:it=>cr(it,tt.i),children:u.jsx(M.Suspense,{fallback:u.jsx(sh,{layout:tt}),children:u.jsx(ph,{layoutItem:tt,removeLayoutItem:At,cloneLayoutItem:vt,fields:w,formID:i,navigateToFieldSettings:Rn,navigateToStyle:hd,handleContextMenu:cr,resizingFld:_})})},tt.i))}):u.jsx(aE,{width:lr,measureBeforeMount:!0,compactType:"vertical",preventCollision:!1,useCSSTransforms:!0,isDroppable:k!==null&&L==="lg",className:`layout b${i}-bf-repeater-grid bf-repeater-grid`,style:{minHeight:k?sE()+40:null},onDrop:ct,resizeHandles:["e","w"],droppingItem:k==null?void 0:k.fieldSize,onLayoutChange:ot,cols:60,rowHeight:1,margin:[0,0],draggableCancel:".no-drg",draggableHandle:".drag",layout:(d==null?void 0:d[L])||[],onDragStart:ih,onDragStop:()=>{M.startTransition(()=>{B(!0),Ct(t),et()})},onResizeStart:ih,onResize:jp,onResizeStop:()=>{et(),Ct(t)},children:(Xs=d==null?void 0:d[L])==null?void 0:Xs.map(tt=>u.jsx("div",{"data-key":tt.i,className:`blk ${g.show&&g.addAfterFieldKey===tt.i?"add-field-picker-opened":""} ${tt.i===f&&"itm-focus"}`,onClick:it=>dr(it,tt.i),onKeyDown:it=>dr(it,tt.i),role:"button",tabIndex:0,onContextMenu:it=>cr(it,tt.i),children:u.jsx(M.Suspense,{fallback:u.jsx(sh,{layout:tt}),children:u.jsx(ph,{layoutItem:tt,removeLayoutItem:At,cloneLayoutItem:vt,fields:w,formID:i,navigateToFieldSettings:Rn,navigateToStyle:hd,handleContextMenu:cr,resizingFld:_,showFieldPicker:Kd})})},tt.i))}),!((hr=d==null?void 0:d[L])!=null&&hr.length)&&!k&&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:Pe("Drag and drop fields here")})}),!x&&u.jsxs("button",{type:"button",className:"empty-layout-add-btn blk-wrp-add-btn",onClick:ee,children:[u.jsx(cf,{size:15}),Pe("Add Field")]})]})})]})})),u.jsxs("div",$(I({"data-testid":`${t}-pair-btn-wrp`,"data-dev-pair-btn-wrp":t,className:`${t}-pair-btn-wrp ${T(t,"pair-btn-wrp")}`},A(t,"pair-btn-wrp")),{children:[e.addBtn.show&&u.jsxs("button",$(I({"data-testid":t,"data-dev-rpt-add-btn":t,className:`${t}-rpt-add-btn ${T(t,"rpt-add-btn")}`},A(t,"rpt-add-btn")),{type:"button",children:[e.addBtnPreIcn&&u.jsx("img",I({"data-testid":`${t}-rpt-add-btn-pre-i`,"data-dev-rpt-add-btn-pre-i":t,className:`${t}-rpt-add-btn-pre-i ${T(t,"rpt-add-btn-pre-i")}`,src:`${e.addBtnPreIcn}`,alt:""},A(t,"rpt-add-btn-pre-i"))),u.jsx(We,{html:e.addBtn.txt||""}),e.addBtnSufIcn&&u.jsx("img",I({"data-testid":`${t}-rpt-add-btn-suf-i`,"data-dev-rpt-add-btn-suf-i":t,className:`${t}-rpt-add-btn-suf-i ${T(t,"rpt-add-btn-suf-i")}`,src:e.addBtnSufIcn,alt:""},A(t,"rpt-add-btn-suf-i")))]})),u.jsxs("button",$(I({"data-testid":t,"data-dev-rpt-rmv-btn":t,className:`${t}-rpt-rmv-btn ${T(t,"rpt-rmv-btn")}`},A(t,"rpt-rmv-btn")),{type:"button",children:[e.removeBtnPreIcn&&u.jsx("img",I({"data-testid":`${t}-rpt-rmv-btn-pre-i`,"data-dev-rpt-rmv-btn-pre-i":t,className:`${t}-rpt-rmv-btn-pre-i ${T(t,"rpt-rmv-btn-pre-i")}`,src:`${e.removeBtnPreIcn}`,alt:""},A(t,"rpt-rmv-btn-pre-i"))),u.jsx(We,{html:e.removeBtn.txt||""}),e.removeBtnSufIcn&&u.jsx("img",I({"data-testid":`${t}-rpt-rmv-btn-suf-i`,"data-dev-rpt-rmv-btn-suf-i":t,className:`${t}-rpt-rmv-btn-suf-i ${T(t,"rpt-rmv-btn-suf-i")}`,src:e.removeBtnSufIcn,alt:""},A(t,"rpt-btn-btn-suf-i")))]}))]}))]})),e.addToEndBtn.show&&u.jsx("div",$(I({"data-testid":`${t}-add-to-end-btn-wrp`,"data-dev-add-to-end-btn-wrp":t,className:`${t}-add-to-end-btn-wrp ${T(t,"add-to-end-btn-wrp")}`},A(t,"add-to-end-btn-wrp")),{children:u.jsxs("button",$(I({"data-testid":t,"data-dev-add-to-end-btn":t,className:`${t}-add-to-end-btn ${T(t,"add-to-end-btn")}`},A(t,"add-to-end-btn")),{type:"button",children:[e.addToEndBtnPreIcn&&u.jsx("img",I({"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 ${T(t,"add-to-end-btn-pre-i")}`,src:e.addToEndBtnPreIcn,alt:""},A(t,"add-to-end-btn-pre-i"))),u.jsx(We,{html:e.addToEndBtn.txt||""}),e.addToEndBtnSufIcn&&u.jsx("img",I({"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 ${T(t,"add-to-end-btn-suf-i")}`,src:e.addToEndBtnSufIcn,alt:""},A(t,"add-to-end-btn-suf-i")))]}))}))]}))}))})]})}var lC=M.memo(oC);function cC({fieldKey:t,attr:e,styleClasses:s,formID:i}){var cr,dr;const{formType:n}=fp(),a=Ei(s),[o,c]=qs(Vg),d=Z(Hg),[h,p]=M.useState(Ei(o[t]||{lg:[],md:[],sm:[]})),[m,f]=qs(zg),[b,g]=qs(Wg),v=bi(qg),w=Z(Lt),{styleMode:x}=Z(ve),[_,R]=qs(Do),C=M.useRef(null),{ref:O,isComponentVisible:y,setIsComponentVisible:D}=Z(Yg),L=Z(or),F=Z(Xg),{recalculateNestedField:H}=Z(lf),B=bi(Zg),k=bi(Qg),X=Z(Jg),{fieldKey:P,parentFieldKey:Y,counter:j}=H,N=of(),G=Kg(),U=M.useRef(null),q=M.useRef(null),V=M.useRef(L);M.useEffect(()=>{if(j>0&&t===Y){const et=tE(h,P);p(et),M.startTransition(()=>{c(nt=>Kt(nt,vt=>{vt[t]=et})),Ct(t)})}},[j,Y,P]),M.useEffect(()=>{p(Ei(o[t]||{lg:[],md:[],sm:[]}))},[o[t]]),M.useEffect(()=>{if(F.respectLGLayoutOrder&&h.lg&&h.lg.length>0&&h.lg.length<100)try{const nt=Jd("lg",h.lg,h,!0,dl);p(nt),M.startTransition(()=>{c(vt=>Kt(vt,At=>{At[t]=nt}))})}catch(nt){}},[]),M.useEffect(()=>{const et=V.current;if(et!==L&&F.respectLGLayoutOrder){U.current&&(U.current(),U.current=null),q.current&&(clearTimeout(q.current),q.current=null);const nt=eE(`nested-${t}-breakpoint-switch`,()=>{try{const vt=$a("nestedLayouts")[t];if(!vt)return;const At=Jd(et,vt[et],vt,!0,dl);p(At),M.startTransition(()=>{c(ee=>Kt(ee,Xs=>{Xs[t]=At}))})}catch(vt){B({show:!0,msg:"Failed to sync nested layout"})}},300);U.current=nt}return V.current=L,()=>{U.current&&U.current(),q.current&&clearTimeout(q.current)}},[L,F.respectLGLayoutOrder,t,c]);const lt=et=>{et.findIndex(nt=>nt.i==="shadow_block")<0&&(U.current&&(U.current(),U.current=null),q.current&&(clearTimeout(q.current),q.current=null),p(nt=>$(I({},nt),{[L]:et})),M.startTransition(()=>{c(nt=>Kt(nt,vt=>{vt!=null&&vt[t]&&(vt[t][L]=et)}))}))},ot=(et,nt)=>{const vt=th(X.fieldData,"section");if(!vt)return;const{newLayouts:At,historyData:ee}=oE(h,vt,X.fieldSize,nt);p(At),M.startTransition(()=>{k(!0),c(Xs=>Kt(Xs,Wi=>{Wi[t]=At})),Ct(t),ee.state.nestedLayouts=$a("nestedLayouts"),eh(ee)})},ct=Pt(`.${t}-inp-fld-wrp`),ft=ct&&Rd(ct),J=ft?ft.width-(ft.paddingLeft+ft.paddingRight+ft.borderLeft+ft.borderRight):0,st=()=>{f({}),D(!1)},at=()=>{N(G.pathname.replace(/style\/.+|style/g,"fs"),{replace:!0}),st()},gt=et=>{N(`/form/builder/${n}/${i}/field-theme-customize/quick-tweaks/${et}`,{replace:!0}),st()},ht=(et,nt)=>{et.preventDefault(),et.stopPropagation(),lr(et,nt)},He=(et,nt)=>{et.stopPropagation(),g(nt),gl(m)||f({}),Ss(),!x&&N(`/form/builder/${n}/${i}/field-settings/${nt}`)},Ss=()=>{gl(_)||(C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{R({}),C.current=null},700))},lr=(et,nt)=>{var Hi;const{button:vt}=et;let At,ee,Xs,Wi;const hr=O.current.getBoundingClientRect().top+window.scrollY,tt=O.current.getBoundingClientRect().left+window.scrollX,it=Pt("#layout-wrapper"),wt=Number(it.style.width.match(/\d+/gi)),yt=Number(it.style.height.match(/\d+/gi)),Yt=170,us=200;if(vt===0){const ur=(Hi=Pt(`[data-key="${nt}"]`))==null?void 0:Hi.querySelector(".blk-wrp-down-btn"),Cn=30,Bo=ur.getBoundingClientRect().top+Cn,Uo=ur.getBoundingClientRect().left;if(At=Uo-tt+5,ee=Bo-hr+2,Xs=At+Yt>wt,Wi=ee+us>yt,Xs&&(At=Uo+Cn-tt-148),Wi&&(ee=Bo-hr-(us+Cn+7)),b!==nt&&(At+=3),y&&m.fldKey===nt&&m.x===At&&m.y===ee){st();return}}else vt===2&&(At=et.clientX-tt+5,ee=et.clientY-hr,Xs=At+Yt>wt,Wi=ee+us>yt,Xs&&(At=et.clientX-tt-150),Wi&&(ee=et.clientY-hr-us));g(nt),f({fldKey:nt,x:At,y:ee}),D(!0)},zi=et=>{if(!iE){v(I({show:!0},nE.fieldClone));return}const nt=w[et];if(!th(nt))return;const{newLayouts:vt}=lE(et,h);p(vt),M.startTransition(()=>{c(At=>Kt(At,ee=>{ee[t]=vt})),Ct(t)})},Rn=et=>{const{newLayouts:nt,historyData:vt}=cE(et,h);p(nt),M.startTransition(()=>{c(At=>Kt(At,ee=>{ee[t]=nt})),Ct(t),vt.state.nestedLayouts=$a("nestedLayouts"),eh(vt)}),N(`/form/builder/${n}/${i}/fields-list`,{replace:!0})},hd=et=>{et.stopPropagation(),Kd(et,{i:t,x:0,y:0,h:0,w:60},t)};return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:i,fieldKey:t,fieldData:e,noErrMsg:!0,children:u.jsx("div",$(I({"data-testid":`${t}-inp-fld-wrp`,"data-dev-inp-fld-wrp":t,className:`${t}-inp-fld-wrp ${T(t,"inp-fld-wrp")}`},A(t,"inp-fld-wrp")),{children:u.jsxs("div",{style:{width:J,display:"inline-block"},id:`${t}-layout-wrapper`,onDragOver:et=>et.preventDefault(),onDragEnter:et=>et.preventDefault(),onMouseMove:()=>M.startTransition(()=>{k(!1)}),onMouseLeave:()=>M.startTransition(()=>{k(!0)}),children:[x?u.jsx("div",{className:"_frm-g",children:h==null?void 0:h[L].map(et=>u.jsx("div",{"data-key":et.i,className:et.i,onClick:nt=>He(nt,et.i),onKeyDown:nt=>He(nt,et.i),role:"button",tabIndex:0,onContextMenu:nt=>ht(nt,et.i),children:u.jsx(M.Suspense,{fallback:u.jsx(sh,{layout:et}),children:u.jsx(ph,{layoutItem:et,removeLayoutItem:Rn,cloneLayoutItem:zi,navigateToFieldSettings:at,navigateToStyle:gt,handleContextMenu:ht})})},et.i))}):u.jsx(aE,{width:J,measureBeforeMount:!0,compactType:"vertical",preventCollision:!1,useCSSTransforms:!0,isDroppable:X!==null&&L==="lg",className:`layout b${i}-bf-section-grid bf-section-grid`,style:{minHeight:X?sE()+40:null},onDrop:ot,resizeHandles:["e","w"],droppingItem:X==null?void 0:X.fieldSize,onLayoutChange:lt,cols:dl[L],rowHeight:1,margin:[0,0],draggableCancel:".no-drg",draggableHandle:".drag",layout:h==null?void 0:h[L],onDragStart:ih,onDrag:jp,onDragStop:()=>{M.startTransition(()=>{k(!0),Ct(t),Ss()})},onResizeStart:ih,onResize:jp,onResizeStop:()=>{Ss(),Ct(t)},children:(cr=h==null?void 0:h[L])==null?void 0:cr.map(et=>u.jsx("div",{"data-key":et.i,className:`blk ${d.show&&d.addAfterFieldKey===et.i?"add-field-picker-opened":""} ${et.i===b&&"itm-focus"}`,onClick:nt=>He(nt,et.i),onKeyDown:nt=>He(nt,et.i),role:"button",tabIndex:0,onContextMenu:nt=>ht(nt,et.i),children:u.jsx(M.Suspense,{fallback:u.jsx(sh,{layout:et}),children:u.jsx(ph,{layoutItem:et,removeLayoutItem:Rn,cloneLayoutItem:zi,navigateToFieldSettings:at,navigateToStyle:gt,handleContextMenu:ht,showFieldPicker:Kd})})},et.i))}),!((dr=h==null?void 0:h[L])!=null&&dr.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:Pe("Drag and drop fields here")})}),!x&&u.jsxs("button",{type:"button",className:"empty-layout-add-btn blk-wrp-add-btn",onClick:hd,children:[u.jsx(cf,{size:15}),Pe("Add Field")]})]})})]})}))})]})}var dC=M.memo(cC);function hC({fieldKey:t,attr:e,styleClasses:s}){var a,o;const{styleMode:i}=Z(ve),n=((a=e.valid)==null?void 0:a.hide)||!1;return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:s}),u.jsx("div",$(I({"data-dev-fld-wrp":t,className:`${t}-fld-wrp ${i?"":"drag"} ${T(t,"fld-wrp")} ${n?"fld-hide":""}`},A(t,"fld-wrp")),{children:u.jsx(We,{html:e.content||((o=e==null?void 0:e.info)==null?void 0:o.content)})}))]})}/*!
82 * Signature Pad v4.2.0 | https://github.com/szimek/signature_pad
83 * (c) 2024 Szymon Nowak | Released under the MIT license
84 */class hh{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 Of{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 Of(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,o=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),m=Math.sqrt(o*o+c*c),f=d.x-h.x,b=d.y-h.y,g=m/(p+m),v={x:h.x+f*g,y:h.y+b*g},w=s.x-v.x,x=s.y-v.y;return{c1:new hh(d.x+w,d.y+x),c2:new hh(h.x+w,h.y+x)}}constructor(e,s,i,n,a,o){this.startPoint=e,this.control2=s,this.control1=i,this.endPoint=n,this.startWidth=a,this.endWidth=o}length(){let s=0,i,n;for(let a=0;a<=10;a+=1){const o=a/10,c=this.point(o,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),d=this.point(o,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 uC{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 pC(t,e=250){let s=0,i=null,n,a,o;const c=()=>{s=Date.now(),i=null,n=t.apply(a,o),i||(a=null,o=[])};return function(...h){const p=Date.now(),m=e-(p-s);return a=this,o=h,m<=0||m>e?(i&&(clearTimeout(i),i=null),s=p,n=t.apply(a,o),i||(a=null,o=[])):i||(i=window.setTimeout(c,m)),n}}class uh extends uC{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?pC(uh.prototype._strokeUpdate,this.throttle):uh.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,o=s.ratio||window.devicePixelRatio||1,c=s.width||this.canvas.width/o,d=s.height||this.canvas.height/o,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=m=>{n(m)},a.crossOrigin="anonymous",a.src=e,this._isEmpty=!1})}toDataURL(e="image/png",s){switch(e){case"image/svg+xml":return typeof s!="object"&&(s=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(s))}`;default:return 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),o=this._data[this._data.length-1],c=o.points,d=c.length>0&&c[c.length-1],h=d?a.distanceTo(d)<=this.minDistance:!1,p=this._getPointGroupOptions(o);if(!d||!(d&&h)){const m=this._addPoint(a,p);d?m&&this._drawCurve(m,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 hh(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=Of.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),o={end:a,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=a,o}_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 o=0;o<a;o+=1){const c=o/a,d=c*c,h=d*c,p=1-c,m=p*p,f=m*p;let b=f*e.startPoint.x;b+=3*m*c*e.control1.x,b+=3*p*d*e.control2.x,b+=h*e.endPoint.x;let g=f*e.startPoint.y;g+=3*m*c*e.control1.y,g+=3*p*d*e.control2.y,g+=h*e.endPoint.y;const v=Math.min(e.startWidth+h*n,s.maxWidth);this._drawCurveSegment(b,g,v)}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,o=this._getPointGroupOptions(n);if(a.length>1)for(let c=0;c<a.length;c+=1){const d=a[c],h=new hh(d.x,d.y,d.pressure,d.time);c===0&&this._reset(o);const p=this._addPoint(h,o);p&&s(p,o)}else this._reset(o),i(a[0],o)}}toSVG({includeBackgroundColor:e=!1}={}){const s=this._data,i=Math.max(window.devicePixelRatio||1,1),n=0,a=0,o=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} ${o} ${c}`),d.setAttribute("width",o.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 m=document.createElement("path");if(!isNaN(h.control1.x)&&!isNaN(h.control1.y)&&!isNaN(h.control2.x)&&!isNaN(h.control2.y)){const f=`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)}`;m.setAttribute("d",f),m.setAttribute("stroke-width",(h.endWidth*2.25).toFixed(3)),m.setAttribute("stroke",p),m.setAttribute("fill","none"),m.setAttribute("stroke-linecap","round"),d.appendChild(m)}},(h,{penColor:p,dotSize:m,minWidth:f,maxWidth:b})=>{const g=document.createElement("circle"),v=m>0?m:(f+b)/2;g.setAttribute("r",v.toString()),g.setAttribute("cx",h.x.toString()),g.setAttribute("cy",h.y.toString()),g.setAttribute("fill",p),d.appendChild(g)}),d.outerHTML}}var Jt,yo,Gi,Ws,Hs,be,Mo,id,No,nd,Bi,ir,hp,rd,ad,nr,Tn,Tr,up,ev,pp,sv,mp,iv,ue,xe;class mC{constructor(e,s){E(this,Tn);E(this,up);E(this,pp);E(this,mp);E(this,ue);E(this,Jt,null);E(this,yo,null);E(this,Gi,null);E(this,Ws,null);E(this,Hs,null);E(this,be,null);E(this,Mo,null);E(this,id,{});E(this,No,null);E(this,nd,null);E(this,Bi,null);E(this,ir,null);E(this,hp,null);E(this,rd,null);E(this,ad,null);E(this,nr,[]);S(this,No,s.document||document),S(this,nd,s.window||window),typeof e=="string"?S(this,Mo,r(this,No).querySelector(e)):S(this,Mo,e),S(this,id,{maxWidth:s.maxWidth||2.5,penColor:s.penColor||"rgb(0, 0, 0)",backgroundColor:s.backgroundColor||"rgb(255, 255, 255)"}),S(this,Bi,s.fieldKey),S(this,yo,s.imgTyp||"image/png"),S(this,ad,(s==null?void 0:s.isBuilder)||!1),S(this,hp,s==null?void 0:s.contentId),S(this,rd,s==null?void 0:s.assetsURL),this.init()}init(){S(this,Jt,l(this,Tn,Tr).call(this,`.${r(this,Bi)}-signature-pad`)),S(this,Gi,l(this,Tn,Tr).call(this,`.${r(this,Bi)}-clr-btn`)),S(this,Ws,l(this,Tn,Tr).call(this,`.${r(this,Bi)}-undo-btn`)),S(this,Hs,l(this,Tn,Tr).call(this,`.${r(this,Bi)}-redo-btn`)),S(this,ir,l(this,Tn,Tr).call(this,`.${r(this,Bi)}-signature-fld`)),r(this,Jt).style.cursor=`url(${r(this,rd)}pen.ico), crosshair`;const e=l(this,Tn,Tr).call(this,`.${r(this,Bi)}-signature-iframe`);e&&e.contentWindow.addEventListener("resize",()=>{this.resizeCanvas()}),S(this,be,new uh(r(this,Jt),r(this,id))),this.resizeCanvas(),l(this,up,ev).call(this),l(this,pp,sv).call(this),l(this,mp,iv).call(this),l(this,ue,xe).call(this,r(this,Ws)),l(this,ue,xe).call(this,r(this,Hs)),l(this,ue,xe).call(this,r(this,Gi)),r(this,be).addEventListener("endStroke",()=>{S(this,nr,[]),this.putSignature(),l(this,ue,xe).call(this,r(this,Gi),!1),l(this,ue,xe).call(this,r(this,Ws),!1),l(this,ue,xe).call(this,r(this,Hs))}),r(this,Jt).addEventListener("touchmove",s=>{s.preventDefault();const i=s.touches[0],n=new MouseEvent("mousemove",{clientX:i.clientX,clientY:i.clientY});r(this,Jt).dispatchEvent(n)})}resizeCanvas(){const e=Math.max(r(this,nd).devicePixelRatio||1,1);r(this,Jt).width=r(this,Jt).offsetWidth*e,r(this,Jt).height=r(this,Jt).offsetHeight*e,r(this,Jt).getContext("2d").scale(e,e),r(this,be).fromData(r(this,be).toData())}putSignature(){if(r(this,ad)||r(this,be).isEmpty())return;const e=r(this,be).toDataURL(r(this,yo));r(this,ir).value=e}destroy(){S(this,No,null),S(this,Jt,null)}reset(){r(this,be).clear(),r(this,ir).value=""}setSignature(e){if(!r(this,be))return;r(this,be).clear();const s=new Image;s.onload=()=>{const i=r(this,Jt).getContext("2d");i.clearRect(0,0,r(this,Jt).width,r(this,Jt).height),i.drawImage(s,0,0,r(this,Jt).width,r(this,Jt).height);const n=r(this,Jt).toDataURL(r(this,yo));r(this,be).fromDataURL(n),this.putSignature()},s.src=e,l(this,ue,xe).call(this,r(this,Gi),!1)}}Jt=new WeakMap,yo=new WeakMap,Gi=new WeakMap,Ws=new WeakMap,Hs=new WeakMap,be=new WeakMap,Mo=new WeakMap,id=new WeakMap,No=new WeakMap,nd=new WeakMap,Bi=new WeakMap,ir=new WeakMap,hp=new WeakMap,rd=new WeakMap,ad=new WeakMap,nr=new WeakMap,Tn=new WeakSet,Tr=function(e,s=null){return(s||r(this,Mo)).querySelector(e)},up=new WeakSet,ev=function(){r(this,Gi)&&r(this,Gi).addEventListener("click",()=>{r(this,be).clear(),r(this,ir).value="",l(this,ue,xe).call(this,r(this,Ws)),l(this,ue,xe).call(this,r(this,Hs)),l(this,ue,xe).call(this,r(this,Gi))})},pp=new WeakSet,sv=function(){r(this,Ws)&&r(this,Ws).addEventListener("click",()=>{const e=r(this,be).toData();if(e.length){const s=e.pop();r(this,nr).push(s),r(this,be).fromData(e),this.putSignature(),e.length===0&&(r(this,ir).value=""),l(this,ue,xe).call(this,r(this,Hs),!1),e.length||l(this,ue,xe).call(this,r(this,Ws))}else l(this,ue,xe).call(this,r(this,Ws))})},mp=new WeakSet,iv=function(){r(this,Hs)&&r(this,Hs).addEventListener("click",()=>{const e=r(this,be).toData();r(this,nr).length?(e.push(r(this,nr).pop()),r(this,be).fromData(e),this.putSignature(),l(this,ue,xe).call(this,r(this,Ws),!1),r(this,nr).length||l(this,ue,xe).call(this,r(this,Hs))):l(this,ue,xe).call(this,r(this,Hs))})},ue=new WeakSet,xe=function(e,s=!0){e&&(s?e.setAttribute("disabled","disabled"):e.removeAttribute("disabled"))};function fC({fieldKey:t,attr:e,formID:s,styleClasses:i}){const n=M.useRef(null),a=M.useRef(null),o=Z(od),c=Z(Do),d=M.useRef({resize:!1}),h=bi(cd),p=M.useRef(null),m=M.useRef(0),b=Z(Lt)[t];if(c.fieldKey===t){d.current.resize=!0;const g=Pt(`[data-key="${t}"]`),v=rE(g);if(c.wrpHeight>=c.fldHeight){const w=`${c.fldHeight+(v-c.wrpHeight)}px`;a.current.style.height=w}}if(d.current.resize&&!c.fieldKey){d.current.resize=!1;const g=v=>`fields->${t}->classes->.${t}-fld->${v}`;h(v=>Kt(v,w=>{Ta(w,g("height"),a.current.style.height),m.current+=1}))}return M.useEffect(()=>{var C;a.current||(p.current=Pt(`.${t}-inp-fld-wrp`));const g=n.current,v=p.current;g&&v&&"destroy"in g&&g.destroy();const{maxWidth:w,penColor:x,backgroundColor:_}=b.config,R={maxWidth:w,penColor:x,backgroundColor:_,document:(C=document.getElementById("bit-grid-layout"))==null?void 0:C.contentDocument,fieldKey:t,assetsURL:`${o.assetsURL}/../static/signature/`,isBuilder:!0};n.current=new mC(v,R)},[b,m.current]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:i}),u.jsx(Tt,{formID:s,fieldKey:t,fieldData:e,children:u.jsxs("div",$(I({"data-testid":`${t}-inp-fld-wrp`,"data-dev-inp-fld-wrp":t,className:`${t}-inp-fld-wrp ${T(t,"inp-fld-wrp")}`},A(t,"inp-fld-wrp")),{ref:p,children:[u.jsx("canvas",$(I({ref:a,className:`${t}-signature-pad ${T(t,"signature")}`,id:"canvas"},A(t,"signature-pad")),{"data-testid":`${t}-signature-pad`,"data-dev-fld":t})),u.jsxs("div",{className:`${t}-ctrl`,children:[!(b!=null&&b.clrBtnHide)&&u.jsxs("button",{id:"clear",className:`${t}-clr-btn`,type:"button","data-testid":`${t}-clr-btn`,"data-dev-clr-btn":t,children:[b.clrPreIcn&&u.jsx("img",I({"data-testid":`${t}-clr-btn-pre-i`,"data-dev-clr-btn-pre-i":t,className:`${t}-clr-btn-pre-i ${T(t,"clr-btn-pre-i")}`,src:b.clrPreIcn,alt:""},A(t,"clr-btn-pre-i"))),b.clrBtn,b.clrSufIcn&&u.jsx("img",I({"data-testid":`${t}-clr-btn-suf-i`,"data-dev-clr-btn-suf-i":t,className:`${t}-clr-btn-suf-i ${T(t,"clr-btn-suf-i")}`,src:b.clrSufIcn,alt:""},A(t,"clr-btn-suf-i")))]}),!(b!=null&&b.undoBtnHide)&&u.jsxs("button",{id:"undo",className:`${t}-undo-btn`,type:"button","data-testid":`${t}-undo-btn`,"data-dev-undo-btn":t,children:[(b==null?void 0:b.undoPreIcn)&&u.jsx("img",I({"data-testid":`${t}-undo-btn-pre-i`,"data-dev-undo-btn-pre-i":t,className:`${t}-undo-btn-pre-i ${T(t,"undo-btn-pre-i")}`,src:b.undoPreIcn,alt:""},A(t,"undo-btn-pre-i"))),b.undoBtn,(b==null?void 0:b.undoSufIcn)&&u.jsx("img",I({"data-testid":`${t}-undo-btn-suf-i`,"data-dev-btn-suf-i":t,className:`${t}-undo-btn-suf-i ${T(t,"undo-btn-suf-i")}`,src:b.undoSufIcn,alt:""},A(t,"undo-btn-suf-i")))]}),!(b!=null&&b.redoBtnHide)&&u.jsxs("button",{id:"redo",className:`${t}-redo-btn`,type:"button","data-testid":`${t}-redo-btn`,"data-dev-redo-btn":t,children:[(b==null?void 0:b.redoPreIcn)&&u.jsx("img",I({"data-testid":`${t}-redo-btn-pre-i`,"data-dev-redo-btn-pre-i":t,className:`${t}-redo-btn-pre-i ${T(t,"redo-btn-pre-i")}`,src:b.redoPreIcn,alt:""},A(t,"redo-btn-pre-i"))),b.redoBtn,(b==null?void 0:b.redoSufIcn)&&u.jsx("img",I({"data-testid":`${t}-redo-btn-suf-i`,"data-dev-btn-suf-i":t,className:`${t}-redo-btn-suf-i ${T(t,"redo-btn-suf-i")}`,src:b.redoSufIcn,alt:""},A(t,"redo-btn-suf-i")))]})]})]}))})]})}function gC({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){var g;const o=e.typ==="url"?"text":e.typ,c=M.useRef(null),d=Z(fv),{"--dir":h}=d,[p,m]=M.useState(e.val!==void 0?e.val:"");M.useEffect(()=>{e.val!==void 0&&!e.userinput?m(e.val):!e.val&&!e.userinput?m(e.defaultValue||""):e.conditional&&m(e.val)},[e.val,e.defaultValue,e.userinput,e.conditional]),M.useEffect(()=>{if(e.hasWorkflow&&e.val===p&&s&&!e.userinput){const{current:v}=c;s(v)}},[p]);const f=v=>{const w=e.typ==="email"?v.target.value.toLowerCase():v.target.value;m(w)};M.useEffect(()=>{const v=df(`#${t}`);v&&hf(v,"value",(w,x)=>m(e.typ==="email"?x.toLowerCase():x))},[]);const b=v=>Cp({input:v.target});return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsxs(Tt,{formID:n,fieldKey:t,fieldData:e,children:[u.jsxs("div",$(I({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${T(t,"inp-fld-wrp")}`},A(t,"inp-fld-wrp")),{style:{"--bfv-fld-val":`'${p||50}'`},children:[u.jsx("input",$(I($(I(I(I(I(I(I(I(I({"data-testid":t,"data-dev-fld":t,id:t,list:`${t}-datalist`,ref:c,className:`${t}-fld no-drg ${T(t,"fld")}`,type:o},"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:b,value:p,onChange:f}),A(t,"fld")),{style:{"--bfv-fill-lower-track":p?`${(p-(e.mn||0))/((e.mx||100)-(e.mn||0))*100}%`:"50%","--bfv-track-dir":h==="rtl"?"to left":"to right"}})),e.prefixIcn&&u.jsx("img",I({"data-testid":`${t}-pre-i`,"data-dev-pre-i":t,className:`${t}-pre-i ${T(t,"pre-i")}`,height:"90%",src:e.prefixIcn,alt:""},A(t,"pre-i"))),e.suffixIcn&&u.jsx("img",I({"data-testid":`${t}-suf-i`,"data-dev-suf-i":t,className:`${t}-suf-i ${T(t,"suf-i")}`,height:"90%",src:e.suffixIcn,alt:""},A(t,"suf-i"))),u.jsx("span",{className:`${t}-slider-val`,children:"Value: "})]})),((g=e.suggestions)==null?void 0:g.length)&&u.jsx("datalist",{id:`${t}-datalist`,children:e.suggestions.map(v=>u.jsx("option",{value:v.val||v.lbl,children:v.lbl},v.val||v.lbl))})]})]})}var EC=M.memo(gC);function bC({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){var d;const{styleMode:o}=Z(ve),c=((d=e.valid)==null?void 0:d.hide)||!1;return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx("div",$(I({"data-dev-fld-wrp":t,className:`${t}-fld-wrp drag ${o?"":"drag"} ${c?"fld-hide":""} spacer-field-bg ${T(t,"fld-wrp")}`},A(t,"fld-wrp")),{"data-admin-label":e.adminLbl||e.lbl||t}))]})}function IC({fieldKey:t,formID:e,attr:s,isBuilder:i,styleClasses:n}){const a=Z(Ep),[o,c]=M.useState(""),h=Z(Lt)[t],p=M.useRef(null),m=M.useRef(null),[f,b]=M.useState(!1),[g,v]=M.useState(!1);h==null||h.payType;const{locale:w,currency:x}=h||{};return M.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]),M.useEffect(()=>{if(!o){fl({fieldKey:t,errorKey:"publishableKeyMissing",errorMsg:Pe("Stripe publishable key is missing"),errorUrl:`field-settings/${t}`});return}v(!0),bp(t,"publishableKeyMissing");const R={src:"https://js.stripe.com/v3/",integrity:"",id:`bf-stripe-script-${t}`,scriptInGrid:!1,callback:()=>{Ct(t),b(!0),v(!1)}};return ld(R),()=>{gp(`bf-stripe-script-${t}`)}},[o,w,x]),M.useEffect(()=>{if(!f||g)return;p!=null&&p.current||(p.current=Pt(`#${t}-stripe-wrp`));const _=m.current,R=p.current;if((!o||_&&R&&"destroy"in _)&&(_.destroy(),Ct(t)),!o)return b(!1);I({},h.config.options),I({},h.config.layout)},[f,g]),u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:n}),u.jsxs(Tt,{formID:e,fieldData:s,fieldKey:t,noLabel:!0,isBuilder:i,children:[f&&o&&!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&&(!f||!o)&&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 vC({attr:t,buttonDisabled:e,handleReset:s,formID:i,fieldKey:n}){return u.jsx("div",$(I({className:`fld-wrp fld-wrp-${i} ${T(n,"fld-wrp")}`,"btcd-fld":"submit"},A(n,"fld-wrp")),{children:u.jsxs("div",$(I({className:`btcd-frm-sub ${t.align==="center"&&"j-c-c"} ${t.align==="right"&&"j-c-e"} ${T(n,"btcd-frm-sub")}`},A(n,"btcd-frm-sub")),{children:[u.jsxs("button",$(I({className:`btcd-sub-btn btcd-sub ${t.btnSiz==="md"&&"btcd-btn-md"} ${t.fulW&&"ful-w"} ${T(n,"btcd-sub-btn")}`,disabled:e,type:"submit"},A(n,"btcd-sub-btn")),{children:[t.subBtnTxt,e&&u.jsx(gv,{clr:"currentColor",size:12,style:{display:"inline-block",marginLeft:5}})]})),"rstBtnTxt"in t&&u.jsx("button",$(I(I({className:`btcd-sub-btn btcd-rst ${t.btnSiz==="md"&&"btcd-btn-md"} ${t.fulW&&"ful-w"} ${T(n,"btcd-rst")}`,type:"button"},s&&{onClick:s}),A(n,"btcd-rst")),{children:t.rstBtnTxt}))]}))}))}function wC({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){const[o,c]=M.useState(e.val),d=Z(Do),h=M.useRef(null),p=M.useRef({resize:!1}),m=bi(cd);if(d.fieldKey===t){p.current.resize=!0;const g=Pt(`[data-key="${t}"]`),v=rE(g);if(d.wrpHeight>=d.fldHeight){const w=`${d.fldHeight+(v-d.wrpHeight)}px`;h.current.style.height=w}}if(p.current.resize&&!d.fieldKey){p.current.resize=!1;const g=v=>`fields->${t}->classes->.${t}-fld->${v}`;m(v=>Kt(v,w=>{Ta(w,g("height"),h.current.style.height)}))}M.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]),M.useEffect(()=>{i&&c("")},[i]),M.useEffect(()=>{if(e.hasWorkflow&&e.val===o&&s&&!e.userinput){const{current:g}=h;s(g)}},[o]);const f=g=>{c(g.target.value)};M.useEffect(()=>{const g=df(`#${t}`);g&&hf(g,"value",(v,w)=>c(w))},[]);const b=g=>{Cp({input:g.target})};return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:n,fieldKey:t,fieldData:e,children:u.jsxs("div",$(I({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${T(t,"inp-fld-wrp")}`},A(t,"inp-fld-wrp")),{children:[u.jsx("textarea",$(I(I(I(I(I(I(I(I($(I({"data-testid":t,"data-dev-fld":t,id:t,className:`${t}-fld ${T(t,"fld")}`},A(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:b,value:o,onChange:f})),e.prefixIcn&&u.jsx("img",I({"data-dev-pre-i":t,className:`${t}-pre-i ${T(t,"pre-i")}`,height:"90%",src:e.prefixIcn,alt:""},A(t,"pre-i"))),e.suffixIcn&&u.jsx("img",I({"data-dev-suf-i":t,className:`${t}-suf-i ${T(t,"suf-i")}`,height:"90%",src:e.suffixIcn,alt:""},A(t,"suf-i")))]}))})]})}function _C({showPassword:t,setShowPassword:e}){const s=()=>{e(!t)},i=n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),s())};return u.jsx("div",{role:"button",tabIndex:0,className:"show-hide-password-btn",style:{height:"20px",width:"20px",cursor:"pointer"},onClick:s,onKeyDown:i,"aria-label":t?"Hide password":"Show password",children:u.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",width:"20",children:[u.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"}),!t&&u.jsx("path",{d:"M20 4l-16 16"})]})})}function TC({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a}){var g,v,w;const o=e.typ==="url"?"text":e.typ,c=M.useRef(null),[d,h]=M.useState(e.val!==void 0?e.val:""),[p,m]=M.useState(!1);M.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]),M.useEffect(()=>{i&&h("")},[i]),M.useEffect(()=>{if(e.hasWorkflow&&e.val===d&&s&&!e.userinput){const{current:x}=c;s(x)}},[d]);const f=x=>{const _=e.typ==="email"?x.target.value.toLowerCase():x.target.value;h(_)};M.useEffect(()=>{const x=df(`#${t}`);x&&hf(x,"value",(_,R)=>h(e.typ==="email"?R.toLowerCase():R))},[]);const b=x=>Cp({input:x.target});return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsxs(Tt,{formID:n,fieldKey:t,fieldData:e,children:[u.jsxs("div",$(I({"data-testid":`${t}-inp-fld-wrp`,className:`${t}-inp-fld-wrp ${T(t,"inp-fld-wrp")}`},A(t,"inp-fld-wrp")),{children:[u.jsx("input",I($(I(I(I(I(I(I(I(I(I(I({"data-testid":t,"data-dev-fld":t,id:t,list:`${t}-datalist`,ref:c,className:`${t}-fld no-drg ${T(t,"fld")}`,type:p?"text":o},"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:b,value:d,onChange:f}),A(t,"fld"))),e.prefixIcn&&u.jsx("img",I({"data-testid":`${t}-pre-i`,"data-dev-pre-i":t,className:`${t}-pre-i ${T(t,"pre-i")}`,height:"90%",src:e.prefixIcn,alt:""},A(t,"pre-i"))),e.suffixIcn&&!((g=e.config)!=null&&g.showPasswordIcon)&&u.jsx("img",I({"data-testid":`${t}-suf-i`,"data-dev-suf-i":t,className:`${t}-suf-i ${T(t,"suf-i")}`,height:"90%",src:e.suffixIcn,alt:""},A(t,"suf-i"))),((v=e.config)==null?void 0:v.showPasswordIcon)&&u.jsxs("div",{"data-testid":`${t}-suf-i`,"data-dev-suf-i":t,className:`no-drg ${t}-suf-i ${T(t,"suf-i")}`,style:{display:"flex"},children:[u.jsx(_C,{fieldKey:t,showPassword:p,setShowPassword:m}),e.suffixIcn&&u.jsx("img",I({src:e.suffixIcn,alt:""},A(t,"suf-i")))]})]})),((w=e.suggestions)==null?void 0:w.length)&&u.jsx("datalist",{id:`${t}-datalist`,children:e.suggestions.map(x=>u.jsx("option",{value:x.val||x.lbl,children:x.lbl},x.val||x.lbl))})]})]})}var nv=M.memo(TC);function xC({fieldKey:t,attr:e,styleClasses:s}){var R;const{logo:i,title:n,subtitle:a,titleHide:o,subtitleHide:c,titleTag:d,subTitleTag:h}=e,p=Z(or),{styleMode:m}=Z(ve),f=((R=e.valid.hidden)==null?void 0:R.includes(p))||!1,b=(C,O,y,D,L)=>u.jsx(We,{html:`<${C} data-dev-${y}=${t} className="${t}-${y} ${T(t,y)}">
85 ${D}${O}${L}
86 </${C}>`}),g=C=>{const O=e.customAttributes[C];if(O==="")return;let y="";if(O){const D=O.length;let L=0;for(;L<D;)O[L].key&&O[L].value&&(y+=`${O[L].key}=${O[L].value} `),L+=1}return y},v=e.titlePreIcn?`<img data-dev-title-pre-i="${t}" ${g("title-pre-i")} classname="${t}-title-pre-i ${T(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 ${T(t,"title-suf-i")}" src="${e.titleSufIcn}" alt="Title Trailing Icon" />`:"",x=e.subTitlPreIcn?`<img data-dev-sub-titl-pre-i="${t}" ${g("sub-titl-pre-i")} classname="${t}-sub-titl-pre-i ${T(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 ${T(t,"sub-titl-suf-i")}" src="${e.subTitlSufIcn}" alt="Subtitle Trailing Icon" />`:"";return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:s}),u.jsxs("div",$(I({"data-dev-fld-wrp":t},A(t,"fld-wrp")),{className:`${t}-fld-wrp ${m?"":"drag"} ${f?"fld-hide":""} ${T(t,"fld-wrp")}`,children:[i&&u.jsx("img",I({"data-dev-logo":t,className:`${t}-logo ${T(t,"logo")}`,src:i,alt:"img"},A(t,"logo"))),u.jsxs("div",$(I({"data-dev-titl-wrp":t,className:`${t}-titl-wrp ${T(t,"titl-wrp")}`},A(t,"titl-wrp")),{children:[!o&&b(d,n,"title",v,w),!c&&b(h,a,"sub-titl",x,_)]}))]}))]})}var SC=""+new URL("bf-93-69.svg",import.meta.url).href;function RC({fieldKey:t,styleClasses:e}){var d;const i=Z(Lt)[t],n=Z(or),a=Z(Ev),{styleMode:o}=Z(ve),c=((d=i.hidden)==null?void 0:d.includes(n))||!1;return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:e}),u.jsx("div",{"data-dev-fld-wrp":t,className:`${t}-turnstile-container ${t}-fld-wrp ${o?"":"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:SC,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 CC({formID:t,fieldKey:e,fieldData:s,children:i,noLabel:n,noErrMsg:a,isBuilder:o}){var p;const c=Z(ve),{styleMode:d}=c,h=((p=s.valid)==null?void 0:p.hide)||!1;return u.jsx("div",{className:`${e}-parent-fld-wrp
87 ${T(e,"parent-fld-wrp")} ${d?"":"drag"} ${h?"fld-hide":""}`,children:bv.Children.toArray(i).map(m=>{var f;return u.jsx("div",{style:{flex:1},className:`${e}-child-fld-wrp ${(f=m==null?void 0:m.props)!=null&&f.fieldKey?`${m.props.fieldKey}-sub-fld-wrp`:""}`,children:m})})})}const rv=({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a})=>{const[o]=qs(Lt),[c]=qs(cd),{childFields:d}=M.useMemo(()=>{var _,R;return{childFields:((R=(_=e==null?void 0:e.childFields)==null?void 0:_.map(C=>C.fldKey))!=null?R:[]).reduce((C,O)=>(Object.hasOwn(o,O)&&(C[O]=Ei(o[O])),C),{})}},[e==null?void 0:e.childFields,o]),h=M.useCallback(()=>u.jsx(nv,{fieldKey:t,styleClasses:a,formID:n,attr:e,onBlurHandler:s,resetFieldValue:i}),[e,t,n,s,i,a]),p=M.useCallback(()=>u.jsxs(u.Fragment,{children:[e.typ==="name"&&u.jsx(dt,{styleClasses:a}),u.jsxs(CC,{fieldKey:t,fieldData:e,children:[["email","password"].includes(e.typ)&&h(),Object.entries(d).map(([w,x])=>{var _;return x.isDeactive?null:u.jsx(rv,{fieldKey:w,styleClasses:(_=c.fields[w])==null?void 0:_.classes,formID:n,attr:x,onBlurHandler:s,resetFieldValue:i},w)})]})]}),[h,e,d,t,n,s,i,c.fields,a]),{hasChildFields:m,isEmailOrPassword:f,isConfirmable:b,isNameField:g}=M.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?!!m:f?!!m&&b:!!m)?p():h()},OC={address_1:"address-line1",address_2:"address-line2",city:"address-level2",state:"address-level1",zip:"postal-code",country:"country"},$C=({fieldKey:t,attr:e,onBlurHandler:s,resetFieldValue:i,formID:n,styleClasses:a})=>{var p;const o=Z(Lt),{styleMode:c}=Z(ve),d=((p=e.valid)==null?void 0:p.hide)||!1,h=M.useMemo(()=>{var f,b;return((b=(f=e==null?void 0:e.childFields)==null?void 0:f.map(g=>g.fldKey))!=null?b:[]).reduce((g,v)=>{if(Object.hasOwn(o,v)){const w=Ei(o[v]);w.isDeactive||g.push([v,w])}return g},[])},[e==null?void 0:e.childFields,o]);return u.jsxs(u.Fragment,{children:[u.jsx(dt,{styleClasses:a}),u.jsx(Tt,{formID:n,fieldKey:t,fieldData:e,children:u.jsx("div",{className:`${t}-parent-fld-wrp skip-height-calculate ${T(t,"parent-fld-wrp")} ${c?"":"drag"} ${d?"fld-hide":""}`,children:h.map(([m,f])=>{var x,_,R;const b=(_=(x=f.fieldName)==null?void 0:x.split("[").pop())==null?void 0:_.replace("]",""),g=OC[b],v=g?$(I({},f),{ac:g}):f,w=(R=f.colSpan)!=null?R:12;return u.jsx("div",{className:`${t}-child-fld-wrp ${m}-sub-fld-wrp`,style:{"--bfv-addr-col":w},children:u.jsx(av,{atts:v,fieldKey:m,formID:n,onBlurHandler:s,resetFieldValue:i})},m)})})})]})};function LC({atts:t,fieldKey:e,formID:s,onBlurHandler:i,resetFieldValue:n,handleReset:a,fieldData:o,buttonDisabled:c,contentID:d,isBuilder:h,entryID:p,handleFormValidationErrorMessages:m}){var b,g,v,w,x,_,R,C,O,y,D,L,F,H,B,k,X,P,Y,j,N,G,U,q,V,lt,ot,ct,ft,J,st,at,gt,ht,He,Ss,lr,zi,Rn;const f=Z(cd);if(!(gl(f)||!(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(nv,{fieldKey:e,styleClasses:(b=f.fields[e])==null?void 0:b.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"password":case"email":case"name":return u.jsx(rv,{fieldKey:e,styleClasses:(g=f.fields[e])==null?void 0:g.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"address":return u.jsx($C,{fieldKey:e,styleClasses:(v=f.fields[e])==null?void 0:v.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"textarea":return u.jsx(wC,{fieldKey:e,styleClasses:(w=f.fields[e])==null?void 0:w.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"check":return u.jsx(YS,{fieldKey:e,styleClasses:(x=f.fields[e])==null?void 0:x.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"radio":return u.jsx(eC,{fieldKey:e,styleClasses:(_=f.fields[e])==null?void 0:_.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"html-select":return u.jsx(PR,{fieldKey:e,styleClasses:(R=f.fields[e])==null?void 0:R.classes,isBuilder:h,formID:s,attr:t});case"select":return u.jsx(RR,{fieldKey:e,styleClasses:(C=f.fields[e])==null?void 0:C.classes,isBuilder:h,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"file-up":return u.jsx($R,{fieldKey:e,styleClasses:(O=f.fields[e])==null?void 0:O.classes,formID:s,attr:t,entryID:p,resetFieldValue:n});case"advanced-file-up":return u.jsx(WS,{fieldKey:e,styleClasses:(y=f.fields[e])==null?void 0:y.classes,formID:s,attr:t,entryID:p,resetFieldValue:n});case"submit":return u.jsx(vC,{fieldKey:e,styleClasses:(D=f.fields[e])==null?void 0:D.classes,formID:s,attr:t,buttonDisabled:c,handleReset:a});case"hidden":return u.jsx(MR,{fieldKey:e,styleClasses:(L=f.fields[e])==null?void 0:L.classes,formID:s,attr:t});case"recaptcha":return u.jsx(aC,{fieldKey:e,styleClasses:(F=f.fields[e])==null?void 0:F.classes,formID:s,attr:t});case"decision-box":return u.jsx(_R,{fieldKey:e,styleClasses:(H=f.fields[e])==null?void 0:H.classes,formID:s,attr:t,fieldData:o,onBlurHandler:i,resetFieldValue:n});case"gdpr":return u.jsx(LR,{fieldKey:e,styleClasses:(B=f.fields[e])==null?void 0:B.classes,formID:s,attr:t,fieldData:o,onBlurHandler:i,resetFieldValue:n});case"html":return u.jsx(NR,{fieldKey:e,styleClasses:(k=f.fields[e])==null?void 0:k.classes,formID:s,attr:t,fieldData:o,resetFieldValue:n});case"shortcode":return u.jsx(hC,{fieldKey:e,styleClasses:(X=f.fields[e])==null?void 0:X.classes,formID:s,attr:t,fieldData:o,resetFieldValue:n});case"button":return u.jsx(qS,{fieldKey:e,styleClasses:(P=f.fields[e])==null?void 0:P.classes,formID:s,attr:t,fieldData:o,buttonDisabled:c,handleReset:a});case"paypal":return u.jsx(GR,{isBuilder:h,styleClasses:(Y=f.fields[e])==null?void 0:Y.classes,fieldKey:e,formID:s,attr:t,contentID:d,fieldData:o,resetFieldValue:n,handleFormValidationErrorMessages:m});case"stripe":return u.jsx(IC,{isBuilder:h,styleClasses:(j=f.fields[e])==null?void 0:j.classes,fieldKey:e,formID:s,attr:t,contentID:d,fieldData:o,resetFieldValue:n,handleFormValidationErrorMessages:m});case"mollie":return u.jsx(jR,{isBuilder:h,styleClasses:(N=f.fields[e])==null?void 0:N.classes,fieldKey:e,formID:s,attr:t,contentID:d,fieldData:o,resetFieldValue:n,handleFormValidationErrorMessages:m});case"razorpay":return u.jsx(rC,{fieldKey:e,styleClasses:(G=f.fields[e])==null?void 0:G.classes,contentID:d,formID:s,attr:t,buttonDisabled:c,resetFieldValue:n,handleFormValidationErrorMessages:m});case"title":return u.jsx(xC,{fieldKey:e,styleClasses:(U=f.fields[e])==null?void 0:U.classes,formID:s,attr:t});case"image":return u.jsx(DR,{fieldKey:e,styleClasses:(q=f.fields[e])==null?void 0:q.classes,formID:s,attr:t});case"divider":return u.jsx(TR,{fieldKey:e,styleClasses:(V=f.fields[e])==null?void 0:V.classes,formID:s,attr:t});case"spacer":return u.jsx(bC,{fieldKey:e,styleClasses:(lt=f.fields[e])==null?void 0:lt.classes,formID:s,attr:t});case"currency":return u.jsx(wR,{fieldKey:e,styleClasses:(ot=f.fields[e])==null?void 0:ot.classes,formID:s,attr:t,contentID:d});case"country":return u.jsx(bR,{fieldKey:e,styleClasses:(ct=f.fields[e])==null?void 0:ct.classes,formID:s,attr:t,contentID:d});case"phone-number":return u.jsx(VR,{fieldKey:e,styleClasses:(ft=f.fields[e])==null?void 0:ft.classes,formID:s,attr:t,contentID:d});case"section":return u.jsx(dC,{fieldKey:e,styleClasses:(J=f.fields[e])==null?void 0:J.classes,formID:s,attr:t});case"repeater":return u.jsx(lC,{fieldKey:e,styleClasses:(st=f.fields[e])==null?void 0:st.classes,formID:s,attr:t});case"rating":return u.jsx(iC,{fieldKey:e,styleClasses:(at=f.fields[e])==null?void 0:at.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"signature":return u.jsx(fC,{fieldKey:e,styleClasses:(gt=f.fields[e])==null?void 0:gt.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"image-select":return u.jsx(FR,{fieldKey:e,styleClasses:(ht=f.fields[e])==null?void 0:ht.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"turnstile":return u.jsx(RC,{fieldKey:e,styleClasses:(He=f.fields[e])==null?void 0:He.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"hcaptcha":return u.jsx(AR,{fieldKey:e,styleClasses:(Ss=f.fields[e])==null?void 0:Ss.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"range":return u.jsx(EC,{fieldKey:e,styleClasses:(lr=f.fields[e])==null?void 0:lr.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"advanced-datetime":return u.jsx(HS,{fieldKey:e,styleClasses:(zi=f.fields[e])==null?void 0:zi.classes,formID:s,attr:t,onBlurHandler:i,resetFieldValue:n});case"email-otp":return u.jsx(CR,{fieldKey:e,styleClasses:(Rn=f.fields[e])==null?void 0:Rn.classes,formID:s,attr:t});case"blank":return u.jsx("div",{className:"blnk-blk drag"})}return u.jsx("div",{children:"Loading..."})}}var av=M.memo(LC);function ph({layoutItem:t,removeLayoutItem:e,cloneLayoutItem:s,navigateToFieldSettings:i,navigateToStyle:n,handleContextMenu:a,showFieldPicker:o}){const c=Z(Lt),d=Z(wv),h=Z(Do),p=f=>{f.stopPropagation(),o(f,t)},m=bi(lf);return M.useEffect(()=>{m(f=>$(I({},f),{reCalculateFieldHeights:f.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:Pe("Move"),"data-testid":`${t.i}-move-btn`,children:u.jsx(Tv,{size:"15",stroke:"3"})}),u.jsx("button",{type:"button",className:"g-c drag curp us-n no-drg blk-wrp-btn",title:Pe("Settings"),onClick:i,"data-testid":`${t.i}-settings-btn`,children:u.jsx(Iv,{size:"18",stroke:2})}),u.jsx("button",{type:"button",className:"g-c drag curp us-n no-drg blk-wrp-btn",title:Pe("Clone"),onClick:()=>s(t.i),"data-testid":`${t.i}-copy-btn`,children:u.jsx(vv,{size:"17",stroke:2})}),u.jsx(xv,{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:Pe("More Options"),onClick:f=>a(f,t.i),"data-testid":`${t.i}-more-options`,children:u.jsx(_v,{size:"21",stroke:2.2})})]}),u.jsx(AC,{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(cf,{size:15,stroke:3,classNames:"mr-1"}),Pe("Add Field")]})]})}const AC=({layoutItem:t,formID:e,fields:s})=>{const i=s[t.i];return u.jsx(av,{formID:e,atts:i,fieldKey:t.i})};export{ph as default};
88