@opencitylabs/formio-custom-components 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,5 +69,5 @@ if(data.calendarId && data.api_url){
69
69
  "headers": {
70
70
  "Authorization": "Basic <key>"
71
71
  }
72
- }`,conditional:{json:{"===":[{var:`data.storage`},`url`]}}},{type:`textfield`,input:!0,key:`fileKey`,label:`File form-data key`,weight:17,placeholder:`Enter the key name of a file for form data.`,tooltip:`Key name that you would like to modify for the file while calling API request.`,conditional:{json:{"===":[{var:`data.storage`},`url`]}}},{type:`textfield`,input:!0,key:`dir`,label:`Directory`,placeholder:`(optional) Enter a directory for the files`,tooltip:`This will place all the files uploaded in this field in the directory`,weight:20,conditional:{json:{"!==":[{var:`data.storage`},`googledrive`]}}},{type:`textfield`,input:!0,key:`dir`,label:`Folder ID`,placeholder:`(optional) Enter an ID of the folder for the files`,tooltip:`This will place all the files uploaded in this field in the folder`,weight:20,conditional:{json:{"===":[{var:`data.storage`},`googledrive`]}}},{type:`textfield`,input:!0,key:`fileNameTemplate`,label:`File Name Template`,placeholder:`(optional) { {name} }-{ {guid} }"`,tooltip:"Specify template for name of uploaded file(s). Regular template variables are available (`data`, `component`, `user`, `value`, `moment` etc.), also `fileName`, `guid` variables are available. `guid` part must be present, if not found in template, will be added at the end.",weight:25},{type:`checkbox`,input:!0,key:`image`,label:`Display as image(s)`,tooltip:`Instead of a list of linked files, images will be rendered in the view.`,weight:30},{type:`checkbox`,input:!0,key:`uploadOnly`,label:`Upload Only`,tooltip:`When this is checked, will only allow you to upload file(s) and consequently the download, in this component, will be unavailable.`,weight:33},{type:`checkbox`,input:!0,key:`privateDownload`,label:`Private Download`,tooltip:`When this is checked, the file download will send a POST request to the download URL with the x-jwt-token header. This will allow your endpoint to create a Private download system.`,weight:31,conditional:{json:{"===":[{var:`data.storage`},`url`]}}},{type:`textfield`,input:!0,key:`imageSize`,label:`Image Size`,placeholder:`100`,tooltip:`The image size for previewing images.`,weight:40,conditional:{json:{"==":[{var:`data.image`},!0]}}},{type:`textfield`,input:!0,key:`maxFiles`,label:`Numero massimo di file`,placeholder:`100`,tooltip:`Numero massimo di file caricabilii, default è 100.`,weight:40},{type:`checkbox`,input:!0,key:`webcam`,label:`Enable web camera`,tooltip:`This will allow using an attached camera to directly take a picture instead of uploading an existing file.`,weight:32},{type:`textfield`,input:!0,key:`webcamSize`,label:`Webcam Width`,placeholder:`320`,tooltip:`The webcam size for taking pictures.`,weight:38,conditional:{json:{"==":[{var:`data.webcam`},!0]}}},{type:`datagrid`,input:!0,label:`File Types`,key:`fileTypes`,tooltip:`Specify file types to classify the uploads. This is useful if you allow multiple types of uploads but want to allow the user to specify which type of file each is.`,weight:11,components:[{label:`Label`,key:`label`,input:!0,type:`textfield`},{label:`Value`,key:`value`,input:!0,type:`textfield`}]},{type:`textfield`,input:!0,key:`filePattern`,label:`File Pattern`,placeholder:`.jpg,video/*,application/pdf`,tooltip:`See <a href='https://github.com/danialfarid/ng-file-upload#full-reference' target='_blank'>https://github.com/danialfarid/ng-file-upload#full-reference</a> for how to specify file patterns.`,weight:50},{type:`textfield`,input:!0,key:`fileMinSize`,label:`File Minimum Size`,placeholder:`1MB`,tooltip:`See <a href='https://github.com/danialfarid/ng-file-upload#full-reference' target='_blank'>https://github.com/danialfarid/ng-file-upload#full-reference</a> for how to specify file sizes.`,weight:60},{type:`textfield`,input:!0,key:`fileMaxSize`,label:`File Maximum Size`,placeholder:`10MB`,tooltip:`See <a href='https://github.com/danialfarid/ng-file-upload#full-reference' target='_blank'>https://github.com/danialfarid/ng-file-upload#full-reference</a> for how to specify file sizes.`,weight:70},{type:`textfield`,input:!0,key:`maxFiles`,label:`Numero massimo di file`,placeholder:`100`,tooltip:`Numero massimo di file caricabilii, default è 100.`,weight:40}],pt=[{key:`unique`,ignore:!0},{key:`validateOn`,ignore:!0}];function mt(...e){return i.Components.baseEditForm([{key:`display`,components:dt},{key:`data`,components:ut},{label:`File`,key:`file`,weight:5,components:ft},{key:`validation`,components:pt}],...e)}var ht=E(((e,t)=>{t.exports=Array.isArray})),gt=E(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),_t=E(((e,t)=>{var n=gt(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),vt=E(((e,t)=>{t.exports=_t().Symbol})),yt=E(((e,t)=>{var n=vt(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),bt=E(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),xt=E(((e,t)=>{var n=vt(),r=yt(),i=bt(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),St=E(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),Ct=E(((e,t)=>{var n=xt(),r=St(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),wt=E(((e,t)=>{var n=ht(),r=Ct(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),Tt=E(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),Et=E(((e,t)=>{var n=xt(),r=Tt(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),Dt=E(((e,t)=>{t.exports=_t()[`__core-js_shared__`]})),Ot=E(((e,t)=>{var n=Dt(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),kt=E(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),At=E(((e,t)=>{var n=Et(),r=Ot(),i=Tt(),a=kt(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),jt=E(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),Mt=E(((e,t)=>{var n=At(),r=jt();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),Nt=E(((e,t)=>{t.exports=Mt()(Object,`create`)})),Pt=E(((e,t)=>{var n=Nt();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Ft=E(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}t.exports=n})),It=E(((e,t)=>{var n=Nt(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),Lt=E(((e,t)=>{var n=Nt(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),Rt=E(((e,t)=>{var n=Nt(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=n&&t===void 0?r:t,this}t.exports=i})),zt=E(((e,t)=>{var n=Pt(),r=Ft(),i=It(),a=Lt(),o=Rt();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),Bt=E(((e,t)=>{function n(){this.__data__=[],this.size=0}t.exports=n})),Vt=E(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),Ht=E(((e,t)=>{var n=Vt();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Ut=E(((e,t)=>{var n=Ht(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Wt=E(((e,t)=>{var n=Ht();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),Gt=E(((e,t)=>{var n=Ht();function r(e){return n(this.__data__,e)>-1}t.exports=r})),Kt=E(((e,t)=>{var n=Ht();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),qt=E(((e,t)=>{var n=Bt(),r=Ut(),i=Wt(),a=Gt(),o=Kt();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),Jt=E(((e,t)=>{t.exports=Mt()(_t(),`Map`)})),Yt=E(((e,t)=>{var n=zt(),r=qt(),i=Jt();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),Xt=E(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),Zt=E(((e,t)=>{var n=Xt();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),Qt=E(((e,t)=>{var n=Zt();function r(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}t.exports=r})),$t=E(((e,t)=>{var n=Zt();function r(e){return n(this,e).get(e)}t.exports=r})),en=E(((e,t)=>{var n=Zt();function r(e){return n(this,e).has(e)}t.exports=r})),tn=E(((e,t)=>{var n=Zt();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),nn=E(((e,t)=>{var n=Yt(),r=Qt(),i=$t(),a=en(),o=tn();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),rn=E(((e,t)=>{var n=nn(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),an=E(((e,t)=>{var n=rn(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),on=E(((e,t)=>{var n=an(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),sn=E(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),cn=E(((e,t)=>{var n=vt(),r=sn(),i=ht(),a=Ct(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),ln=E(((e,t)=>{var n=cn();function r(e){return e==null?``:n(e)}t.exports=r})),un=E(((e,t)=>{var n=ht(),r=wt(),i=on(),a=ln();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),dn=E(((e,t)=>{var n=Ct(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Y=E(((e,t)=>{var n=un(),r=dn();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),fn=E(((e,t)=>{var n=Y();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),pn=E(((e,t)=>{var n=Mt();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),mn=E(((e,t)=>{var n=pn();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),hn=E(((e,t)=>{var n=mn(),r=Vt(),i=Object.prototype.hasOwnProperty;function a(e,t,a){var o=e[t];(!(i.call(e,t)&&r(o,a))||a===void 0&&!(t in e))&&n(e,t,a)}t.exports=a})),gn=E(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e<t}t.exports=i})),_n=E(((e,t)=>{var n=hn(),r=un(),i=gn(),a=Tt(),o=dn();function s(e,t,s,c){if(!a(e))return e;t=r(t,e);for(var l=-1,u=t.length,d=u-1,f=e;f!=null&&++l<u;){var p=o(t[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return e;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=a(h)?h:i(t[l+1])?[]:{})}n(f,p,m),f=f[p]}return e}t.exports=s})),vn=O(E(((e,t)=>{var n=_n();function r(e,t,r){return e==null?e:n(e,t,r)}t.exports=r}))(),1),yn=O(fn(),1);document.documentElement.lang.toString();var bn=class{constructor(){this.token=null,this.basePath=null,this.init()}init(){this.token=null,this.basePath=M()}async getSessionAuthToken(){let e=this;await m.default.get(e.basePath+`/api/session-auth`).then(t=>{e.token=t.data.token}).catch(e=>{u.default.fire(`'error_message_detail`,`'auth_error'`,`error`)})}getSessionAuthTokenPromise(){let e=this;return new Promise(async(t,n)=>{U(`auth-token`)?t({token:U(`auth-token`)}):await m.default.get(e.basePath+`/api/session-auth?with-cookie=true`,{withCredentials:!0,headers:{"Content-Type":`application/json; charset=utf-8`}}).then(e=>{let t=(0,g.jwtDecode)(e.data.token);t.exp&&W(`auth-token`,e.data.token,t.exp)}).catch(e=>{console.log(e)})})}getToken(){return this.token}execAuthenticatedCall(e){this.token?e(this.token):this.getSessionAuthTokenPromise().then(t=>{this.token=t.token,e(this.token)})}},xn=t.Formio.Components.components.file,Sn=null;document.querySelector(`widget-formio`)!==null&&(Sn=document.querySelector(`widget-formio`).getAttribute(`signature-check-ws-url`));var Cn=({component:e,current:t,onChange:n,i18next:i})=>{let[o,s]=(0,a.useState)([]),[c,d]=(0,a.useState)(new Map),[f,g]=(0,a.useState)(!1),_=new bn;(0,a.useEffect)(()=>{_.getSessionAuthTokenPromise()},[]);let v=(e,t)=>{d(n=>{let r=new Map(n);return r.set(e,{...t,progress:Number(t?.progress)||0}),r})};function y(t){return t.size>(A(e.fileMaxSize)||A(`1GB`))?{code:`size-files`,message:`${i.t(`I file non possono superare le dimensioni di`)} ${e.fileMaxSize?e.fileMaxSize:`1GB`}`}:o.length>=(e.maxFiles?parseInt(e.maxFiles):e.multiple?100:1)?{code:`too-many-files`,message:`${i.t(`Puoi caricare massimo `)} ${e.maxFiles||100} ${i.t(`file`)}`}:t.size<A(e.fileMinSize)?{code:`file-too-small`,message:`${i.t(`I file devono avare una dimensione superiore a `)} ${e.fileMinSize}`}:null}function b(){if(e.filePattern){let t=e.filePattern.split(`,`).map(e=>e.trim()).filter(Boolean).reduce((e,t)=>{let n=t.startsWith(`.`)?t:`.${t}`,r=h.default.getType(n);return r?(e[r]||(e[r]=[]),e[r].push(n),e):e},{});return Object.keys(t).length?t:void 0}else return!0}let x=e=>{let t={};return t.originalName=e.originalName?e.originalName:e.name,t.name=e.name,t.url=e.url,t.data=e.data,t.signature_validation=e.signature_validation,t.mime_type=e.mime_type,t.storage=`url`,t.size=e.size,t},{getRootProps:S,getInputProps:C,fileRejections:w,isDragActive:T,open:E}=(0,p.useDropzone)({onDrop:e=>{e.map(e=>{k(e).then(e=>{})})},maxFiles:e.maxFiles?parseInt(e.maxFiles)-o.length:e.multiple?100:1,validator:y,accept:b()}),D=e=>{let t=M()+`/api/attachments/`+e.data.id;fetch(t,{method:`DELETE`,headers:{"Content-Type":`application/json; charset=utf-8`,Authorization:`Bearer ${U(`auth-token`)}`},strictErrors:!0}).then(()=>{s(t=>{let r=t.filter(t=>t.data.id!==e.data.id);return n(r),r})}).catch(e=>{u.default.fire({title:``,html:`<p>${i.t(`Ci sono stati degli errori durante l'eliminazione del file`)}</p>`,icon:`error`,cancelButtonText:i.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1}),console.error(e)})},O=()=>{let e=typeof t?.getCurrentValue==`function`?t.getCurrentValue():t?.dataValue;e?.length>0&&(s(e),setTimeout(()=>{n(e)},100))};(0,a.useEffect)(()=>{document.querySelector(`.formio-read-only`)&&f===!1?(g(!0),setTimeout(()=>{O()},1e3)):(g(!1),setTimeout(()=>{O()},1e3))},[]);async function k(r){let a,o=M()+`/it/upload`,c={mime_type:r.type,name:r.name,original_filename:r.name,protocol_required:e.protocol_required,size:r.size};return await m.default.post(o,c,{maxContentLength:1/0,maxBodyLength:1/0}).then(async o=>(a=o.data.id,r.url=M()+`/it/allegati/`+a,r.storage=`url`,r.mime_type=r.type,r.protocol_required=e.protocol_required,r.data={...o.data,baseUrl:M()+`/it/allegati/`+a},v(a,r),await m.default.put(o.data.uri,r,{onUploadProgress:e=>{let t=Math.round(e.loaded*100/e.total);d(e=>{let n=new Map(e),i=r;return i.progress=parseInt(t),n.has(a)&&n.set(a,i),n})},maxContentLength:1/0,maxBodyLength:1/0,headers:{"Content-Type":`multipart/form-data`}}).then(async o=>{let c=o.headers.etag.replace(/\\|"/gi,``)||null;return await m.default.put(M()+`/it/upload/`+a,{file_hash:c,check_signature:e.check_signature}).then(async i=>{d(e=>{let t=new Map(e);return t.delete(a),t});let o=t.dataValue||[],c=null;if(s(e=>{let t=[...e,x(r)];return c=t.length-1,n(t),t}),e.check_signature&&i.data.url&&Sn)return await m.default.post(Sn,{url:i.data.url,content:null},{headers:{"Content-Type":`application/json`}}).then(e=>{r.signature_validation=e.data.sign,o[c].signature_validation=e.data.sign}).catch(e=>{o[c].signature_validation=`File validation error: `+e});d(e=>{let t=new Map(e);return t.delete(a),t})}).catch(e=>{d(e=>{let t=new Map(e);return t.delete(a),t}),console.log(e),u.default.fire({title:``,html:`<p>${i.t(`Ci sono stati degli errori dutante il caricamento dei file, riprova più tardi!`)}</p>`,icon:`error`,cancelButtonText:i.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1})})}).catch(e=>{d(e=>{let t=new Map(e);return t.delete(a),t}),console.log(e),u.default.fire({title:``,html:`<p>${i.t(`Ci sono stati degli errori dutante il caricamento dei file, riprova più tardi!`)}</p>`,icon:`error`,cancelButtonText:i.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1})}))).catch(e=>{console.log(e),u.default.fire({title:``,html:`<p>${i.t(`Ci sono stati degli errori dutante il caricamento dei file, riprova più tardi!`)}</p>`,icon:`error`,cancelButtonText:i.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1}),d(e=>{let t=new Map(e);return t.delete(a),t})})}function A(e){if(typeof e==`string`){if(e.search(/kb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024);if(e.search(/mb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024*1024);if(e.search(/gb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024*1024*1024);if(e.search(/b/i)===e.length-1||e.search(/s/i)===e.length-1)return parseFloat(e.substring(0,e.length-1));if(e.search(/m/i)===e.length-1)return parseFloat(e.substring(0,e.length-1)*60);if(e.search(/h/i)===e.length-1)return parseFloat(e.substring(0,e.length-1)*3600)}return e}function j(e,t=2){if(!+e)return`0 Bytes`;let n=1024,r=t<0?0:t,i=[`Bytes`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],a=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/n**+a).toFixed(r))} ${i[a]}`}return t.conditionallyHidden()||t.visible===!1?null:(0,r.jsx)(r.Fragment,{children:f?(0,r.jsxs)(`div`,{children:[(0,r.jsxs)(`label`,{className:`col-form-label floating-label`,htmlFor:`${e.id}-${e.key}`,children:[e.label,e.validate.required&&(0,r.jsx)(`span`,{className:`text-danger`})]}),(0,r.jsxs)(`ul`,{className:`upload-file-list`,children:[o.map((e,t)=>(0,r.jsxs)(`li`,{className:`upload-file success mw-100`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`primary`,icon:`it-file`,title:`Icona file`,size:`sm`}),(0,r.jsxs)(`p`,{children:[(0,r.jsx)(`span`,{className:`visually-hidden`,children:i.t(`File caricato:`)}),e.name,(0,r.jsx)(`span`,{className:`upload-file-weight`,children:j(e.size)})]})]},e.size+t)),o.length<1&&(0,r.jsxs)(`li`,{className:`upload-file text-secondary mw-100`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`light`,icon:`it-files`,title:`Icona file`,size:`sm`}),(0,r.jsx)(`p`,{children:i.t(`Nessun elemento`)})]})]})]}):(0,r.jsxs)(r.Fragment,{children:[e.hideLabel||e.hidden?``:(0,r.jsxs)(`label`,{className:`col-form-label floating-label`,htmlFor:`${e.id}-${e.key}`,title:e.tooltip||void 0,children:[e.label,e.validate.required&&(0,r.jsx)(`span`,{className:`text-danger`}),e.tooltip&&(0,r.jsx)(`i`,{tabIndex:0,className:`bi bi-question-circle text-muted ms-1`,"data-tooltip":e.tooltip,"aria-expanded":`false`})]}),(0,r.jsxs)(`div`,{className:`my-1 border-2 border-light file-uploader-box rounded p-3 text-secondary${T?` dragover`:``}`,style:{border:`dashed`},...S({onClick:e=>e.stopPropagation()}),children:[(0,r.jsx)(`input`,{id:`${e.id}-${e.key}`,"aria-describedby":`file-uploader-description-${e.id}-${e.key}`,...C()}),(0,r.jsxs)(`div`,{className:`upload-dragdrop${T?` dragover`:``}`,children:[(0,r.jsx)(`div`,{className:`ms-1 me-3`,children:(0,r.jsx)(l.Icon,{color:`secondary`,icon:`it-upload`,title:i.t(`Carica file`),size:`_sm`})}),(0,r.jsxs)(`div`,{className:`upload-dragdrop-text`,children:[(0,r.jsx)(`div`,{className:`h5`,id:`file-uploader-description-${e.id}-${e.key}`,children:i.t(`Trascina il file per caricarlo`)}),(0,r.jsxs)(`p`,{className:`d-inline-flex`,children:[i.t(`oppure`),(0,r.jsx)(l.Button,{tag:`input`,type:`button`,value:i.t(`selezionalo dal dispositivo`),onClick:E,className:`px-1 py-0 text-decoration-underline primary-color`,size:`xs`})]})]})]})]}),(0,r.jsx)(`div`,{dangerouslySetInnerHTML:{__html:ee.default.sanitize(e.description||``)}}),(0,r.jsxs)(`ul`,{className:`upload-file-list my-0`,children:[o.map((e,t)=>(0,r.jsxs)(`li`,{className:`upload-file success`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`primary`,icon:`it-file`,title:`Icona file`,size:`sm`}),(0,r.jsxs)(`p`,{children:[(0,r.jsx)(`span`,{className:`visually-hidden`,children:i.t(`File caricato:`)}),e.name,(0,r.jsx)(`span`,{className:`upload-file-weight`,children:j(e.size)})]}),(0,r.jsx)(l.Button,{className:`px-1`,onClick:()=>D(e),children:(0,r.jsx)(l.Icon,{title:`${i.t(`Elimina file caricato`)} ${e.name}`,color:`secondary`,icon:`it-delete`,className:`ms-auto pointer`,size:`sm`})})]},e.size+t)),Array.from(c.entries()).map(([e,t])=>(0,r.jsxs)(`li`,{className:`upload-file success`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`primary`,icon:`it-file`,title:`Icona file`,size:`sm`}),(0,r.jsxs)(`p`,{children:[(0,r.jsx)(`span`,{className:`visually-hidden`,children:i.t(`Caricamento file:`)}),t.name,(0,r.jsx)(`span`,{className:`upload-file-weight`,children:j(t.size)})]}),(0,r.jsx)(l.Progress,{value:Number(t?.progress)||0})]},e))]}),!!(w&&w.length)&&(0,r.jsx)(`div`,{className:`formio-error-wrapper`,children:(0,r.jsx)(`ul`,{className:`formio-errors upload-file-list my-0 `,children:w.map(({file:t,errors:n},a)=>(0,r.jsxs)(`li`,{className:`upload-file error`,children:[(0,r.jsxs)(`div`,{className:`upload-file-name-error-wrapper`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`error`,icon:`it-error`,title:`Icona file`,size:`sm`}),(0,r.jsxs)(`p`,{className:`text-wrap error`,children:[(0,r.jsx)(`span`,{className:`visually-hidden`,children:i.t(`Errore caricamento file:`)}),t.name,(0,r.jsx)(`span`,{className:`upload-file-weight`,children:j(t.size)})]})]}),(0,r.jsx)(`div`,{children:n.map(t=>t.code===`file-invalid-type`?(0,r.jsxs)(`p`,{className:`text-wrap ms-0`,children:[i.t(`I file possono essere di tipo `),e.filePattern]}):t.code===`too-many-files`?(0,r.jsxs)(`p`,{className:`text-wrap ms-0`,children:[i.t(`Puoi caricare massimo `),` `,e.maxFiles?e.maxFiles:e.multiple?100:1,` `,i.t(`file`)]}):(0,r.jsx)(`p`,{className:`text-wrap ms-0`,children:t.message}))})]},t.size+a))})})]})})},wn=class e extends xn{constructor(e,t,n){super({...e,clearOnHide:!1},t,n),this.reactRef=null,this.lastRenderedVisible=void 0,this.rootComponent=null,this.mountNode=null}static get builderInfo(){return{title:`File Sdc`,group:`basic`,icon:`bi bi-file-earmark-text`,documentation:``,weight:70,schema:e.schema()}}get emptyValue(){return[]}init(){if(super.init(),this.component?.multiple&&!Array.isArray(this.getCurrentValue())){this.dataValue=[];let e=this.path||this.component?.key;e&&this.rootValue&&(0,vn.default)(this.rootValue,e,[])}}static schema(){return xn.schema({type:`sdcfile`,modelType:`array`})}static editForm=mt;getI18next(){return this.i18next&&typeof this.i18next.t==`function`?this.i18next:{language:this.options?.language||document?.documentElement?.lang||`it`,t:(e,t)=>this.t(e,t)}}hideFileProcessingLoader(){this.refs?.fileProcessingLoader&&(this.refs.fileProcessingLoader.style.display=`none`)}renderReact(){if(this.rootComponent){if(this.builderMode){this.rootComponent.render((0,r.jsx)(`div`,{className:`my-1 border border-2 border-light file-uploader-box rounded p-3 text-secondary`,children:(0,r.jsx)(`div`,{className:`upload-dragdrop`,children:(0,r.jsx)(`div`,{className:`upload-dragdrop-text`,children:(0,r.jsx)(`div`,{className:`h6 mb-0`,children:this.component?.label||`File Sdc`})})})}));return}this.rootComponent.render((0,r.jsx)(Cn,{component:this.component,current:this,i18next:this.getI18next(),onChange:e=>this.updateValueFromReact(e)}))}}attach(e){let t=super.attach(e);this.hideFileProcessingLoader();let r=`react-${this.id}`;this.loadRefs(e,{[r]:`single`});let i=this.refs[r];return i?(this.rootComponent&&this.mountNode!==i&&(this.rootComponent.unmount(),this.rootComponent=null),this.rootComponent||=(0,n.createRoot)(i),this.mountNode=i,this.lastRenderedVisible=this.visible,this.renderReact(),t):t}updateValueFromReact(e,t={modified:!0}){let n=this.normalizeValue(e,t),r=this.updateValue(n,t),i=this.path||this.component?.key;if(i&&this.rootValue){let e=(0,yn.default)(this.rootValue,i);this.isEqual(e,n)||(0,vn.default)(this.rootValue,i,n)}return r}setValue(e,t={}){let n=this.normalizeValue(e,t),r=super.setValue(n,t),i=this.path||this.component?.key;if(i&&this.rootValue){let e=(0,yn.default)(this.rootValue,i);this.isEqual(e,n)||(0,vn.default)(this.rootValue,i,n)}return r}normalizeValue(e,t={}){let n=super.normalizeValue(e,t);return!this.component?.multiple||Array.isArray(n)?n:n==null||n===``?[]:[n]}detach(){return this.hideFileProcessingLoader(),this.rootComponent&&=(this.rootComponent.unmount(),null),this.mountNode=null,super.detach()}getValue(){return this.getCurrentValue()}get validationValue(){return this.getCurrentValue()}getCurrentValue(){let e=super.getValue(),t=this.path||this.component?.key,n=t&&this.rootValue?(0,yn.default)(this.rootValue,t):void 0;return this.component?.multiple?Array.isArray(e)&&e.length>0?e:Array.isArray(n)?n:[]:e??n??null}isEmpty(e=this.validationValue){return this.component?.multiple?!Array.isArray(e)||e.length===0:e==null||e===``}checkCondition(e,t){let n=super.checkCondition(e,t),r=this.visible;return this.lastRenderedVisible!==r&&(this.lastRenderedVisible=r,this.renderReact()),n}render(){let e=`<div ref="react-${this.id}"></div>`;return Object.getPrototypeOf(Object.getPrototypeOf(xn.prototype)).render.call(this,e)}},Tn=[{key:`labelPosition`,ignore:!0},{key:`labelPosition`,ignore:!0},{key:`placeholder`,ignore:!0},{key:`description`,ignore:!0},{key:`hideLabel`,ignore:!0},{key:`autofocus`,ignore:!0},{key:`tooltip`,ignore:!0},{key:`tabindex`,ignore:!0},{key:`disabled`,ignore:!0}];function En(...e){return i.Components.baseEditForm([{key:`display`,components:Tn}],...e)}var Dn=({value:e,defaultValue:t=``,onConfirm:n,source:i,disabled:o,onClear:s,tClearInput:c=()=>`Clear input`,...u})=>{let d=(0,a.useRef)(null),f=e=>{setTimeout(()=>{d.current&&(d.current.elementReferences[-1].value=e)},0)};(0,a.useEffect)(()=>{e!==void 0&&f(e)},[e]),(0,a.useEffect)(()=>{o?d.current&&(d.current.elementReferences[-1].disabled=!0):d.current&&(d.current.elementReferences[-1].disabled=!1)},[o]);let p=()=>{s&&s()},m=(e,t)=>{d.current.elementReferences[-1].classList.contains(`autocomplete__input--focused`)&&i(e,t)},h=t=>{t?n(t):f(e)};return(0,r.jsxs)(`div`,{style:{position:`relative`,width:`100%`},children:[(0,r.jsx)(_.default,{ref:d,...u,defaultValue:t,onConfirm:h,source:m}),!!(e&&e.length>0&&!o)&&(0,r.jsx)(`button`,{onClick:p,style:{position:`absolute`,right:`0px`,top:`50%`,transform:`translateY(-50%)`,background:`transparent`,border:`none`,cursor:`pointer`,padding:0},"aria-label":c(),children:(0,r.jsx)(l.Icon,{icon:`it-close`,size:`sm`,title:c()})})]})},On=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwd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=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC`,jn=({position:e,areasLayer:t,bounds:n,onMarkedMoved:i})=>{let o=(0,a.useRef)(null),s=null,[c,l]=(0,a.useState)([]),u=(0,v.tileLayer)(`https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`,{attribution:`&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>`}),d=[41.9,12.5],f=()=>{let r=v.default.map(o.current,{keyboard:!1,minZoom:6,maxZoom:18}).setView(d,10);u.addTo(r),t&&t.map(e=>{e.addTo(r)});let a=e?[`${e.lat}`,`${e.lon}`]:n?n.getCenter():d;if(delete v.default.Icon.Default.prototype._getIconUrl,v.default.Icon.Default.mergeOptions({iconRetinaUrl:On,iconUrl:kn,shadowUrl:An}),s=v.default.marker(a,{draggable:!0}).addTo(r),s.on(`moveend`,function(e){i(e.target.getLatLng(),s)}),r.on(`click`,function(e){let t=e.latlng;s&&s.setLatLng(t).update(),i(t,s)}),!e&&n)r.fitBounds(n);else{let t=e?[e.lat,e.lon]:d;s&&(s.setLatLng(t).update(),r.setView(t,15))}};return(0,a.useEffect)(()=>{o.current&&f()},[o]),(0,r.jsx)(`div`,{className:`d-block`,style:{height:`60vh`,width:`100%`,display:`block`},children:(0,r.jsx)(`div`,{ref:o,style:{height:`100%`,width:`100%`},"aria-hidden":!0})})},Mn=t.Formio.Components.components.field,Nn=({component:e,value:t,current:n,onChange:i,i18next:o})=>{let[s,c]=(0,a.useState)(null),[d,f]=(0,a.useState)([]),[p,m]=(0,a.useState)(),[h,ee]=(0,a.useState)(),[g,_]=(0,a.useState)(!1),[b,x]=(0,a.useState)(),[S,C]=(0,a.useState)(!1),[w,T]=(0,a.useState)(),[E,D]=(0,a.useState)(),[O,k]=(0,a.useState)(!1),[A,j]=(0,a.useState)(``),[te,N]=(0,a.useState)(``),[P,F]=(0,a.useState)(!1),[I,L]=(0,a.useState)(!1),R=new URLSearchParams(window.location.search).get(`area`),{geographic_areas_id:ne}=window.OC_SERVICE_DETAILS,re=(0,a.useRef)(),z=o.language,ie=v.default.latLngBounds(),ae=R||(ne&&ne.length>0?ne:void 0),oe=(e,t)=>{re.current=e;let n=`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(e)}&countrycodes=it&viewbox=${p}&bounded=1&addressdetails=1&limit=14&format=jsonv2&accept-language=${z}`,r=[],i=[];C(!0),fetch(n).then(e=>e.json()).then(n=>{if(n.length&&re.current===e){C(!0);let e=n.map((e,t)=>{let{lat:n,lon:r}=e,i=`${M()}/api/geographic-areas/contains?lat=${n}&lon=${r}&geographic_areas_ids=${b.join(`,`)}`;return fetch(i).then(e=>e.json()).then(t=>t.result?(e.label=Be(e),e):null)});return Promise.all(e)}else re.current===e&&(t([]),C(!1))}).then(n=>{n=n?n.filter(e=>e!==null):[],n.length>0?(n.forEach((e,t)=>{n[t].label=Be(e)}),n=y.default.uniqWith(n,(e,t)=>e.label===t.label),n.forEach((e,t)=>{i.push(e.label),r.push(e)}),re.current===e&&(t(i),f(r),C(!1))):re.current===e&&(t([]),C(!1))}).catch(e=>{console.error(`Error fetching locations:`,e),C(!1)})},se=(e,t)=>{oe(e,t)},ce=(e,t)=>{let{lat:n,lng:r}=e,i=`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${n}&lon=${r}&accept-language=${z}`;fetch(i).then(e=>e.json()).then(e=>{if(e&&e.display_name)if(e.label=Be(e),e.lat=n,e.lon=r,t)t.bindPopup(`${e.label}`,{className:`address-map-popup`}).openPopup(),D(e);else{D(e);return}}).catch(e=>console.error(`Error with reverse geocoding:`,e))};function le(){navigator.geolocation.getCurrentPosition(e=>{let t=e.coords.latitude,n=e.coords.longitude;if((b||[]).length>0){let e=`${M()}/api/geographic-areas/contains?lat=${t}&lon=${n}&geographic_areas_ids=${b.join(`,`)}`;fetch(e).then(e=>e.json()).then(e=>{e.result?(c({lat:t,lon:n}),ce({lat:t,lng:n}),L(!I)):L(!I)})}else c({lat:t,lon:n}),ce({lat:t,lng:n}),L(!I)},e=>{e?.code===1?(F(!P),N(o.t(`error_message_code_1`))):e?.code===2?(F(!P),N(o.t(`error_message_code_2`))):e?.code===3?(F(!P),N(o.t(`error_message_code_3`))):(F(!P),N(o.t(`error_message_generic`)))})}(0,a.useEffect)(()=>{t&&c(t),n.valuePosition&&c(n.valuePosition)},[t,n]);let ue=()=>{t&&c(t),n.valuePosition&&c(n.valuePosition)};(0,a.useEffect)(()=>{window?.Formio?.formioReady.then(()=>{setTimeout(()=>{ue(),de()},1)})},[]);let de=()=>{let e=`${M()}/api/geographic-areas`,t=[],n=[],r=[];fetch(e).then(e=>e.json()).then(e=>{if(Array.isArray(e)&&e.length>0){e.filter(e=>ae?Array.isArray(ae)?ae.includes(e.id):e.id===ae:!0).forEach(e=>{t.push(e.id);let i=JSON.parse(e.geofence);n.push(i);let a=v.default.geoJSON(i,{style:{color:`#3478bd`,fillColor:`#87CEEB`,fillOpacity:.2,weight:1.5},filter:function(e){return e.geometry.type===`Polygon`||e.geometry.type===`MultiPolygon`}});ie.extend(a.getBounds()),r.push(a)}),ee(r),x(t),T(ie);let i=ie.getNorthEast(),a=ie.getSouthWest();m([i.lng,i.lat,a.lng,a.lat])}else console.log(`No geographic_areas_ids found.`)}).catch(e=>{console.error(`Error with reverse geocoding:`,e)})},fe=()=>{j(s?.label?s.label:``)};(0,a.useEffect)(()=>{fe(),i(s)},[s]),(0,a.useEffect)(()=>{document.querySelector(`.formio-read-only`)&&O===!1?k(!0):k(!1)},[]);let pe=()=>{if(E){let e=`${M()}/api/geographic-areas/contains?lat=${E.lat}&lon=${E.lon}&geographic_areas_ids=${b.join(`,`)}`;_(!0),fetch(e).then(e=>e.json()).then(e=>{_(!1),e?e.result===!1?u.default.fire({title:``,html:`<p>`+o.t(`Attenzione: Il luogo selezionato si trova al di fuori dell’area coperta dal servizio. Per favore, scegli un luogo all'interno dell'area evidenziata nella mappa.`)+`</p>`,icon:`error`,cancelButtonText:o.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1}):e.result===!0&&(L(!I),c(E)):(_(!1),console.log(`No geographic-areas/contains .`))}).catch(e=>{console.error(`Error with geographic-areas/contains:`,e),u.default.fire({title:``,html:`<p>`+e+`</p>`,icon:`error`,cancelButtonText:o.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1})})}};return(0,r.jsx)(`div`,{children:(0,r.jsxs)(`div`,{id:`address-map-container-${e.key}`,className:`address-map-container`,children:[(0,r.jsx)(`div`,{children:(0,r.jsxs)(l.Modal,{wrapClassName:`formio-component-address_map`,isOpen:I,size:`lg`,scrollable:!0,toggle:()=>L(!I),labelledBy:`maps-evo`,container:G(),children:[(0,r.jsx)(l.ModalHeader,{toggle:()=>L(!I),id:`maps-evo`,children:o.t(`Individua il luogo sulla mappa`)}),(0,r.jsxs)(l.ModalBody,{children:[(0,r.jsx)(`p`,{children:(0,r.jsx)(`small`,{children:o.t(`Trascina l’icona nel punto preciso in cui si verifica l’evento che vuoi segnalare e fai click su Salva indirizzo`)})}),(0,r.jsx)(jn,{position:s,areasLayer:h,bounds:w,onMarkedMoved:(e,t)=>{ce(e,t)}})]}),(0,r.jsxs)(l.ModalFooter,{children:[(0,r.jsx)(l.Button,{color:`secondary`,onClick:()=>L(!I),children:o.t(`Chiudi`)}),(0,r.jsx)(l.Button,{color:`primary`,onClick:()=>{pe()},disabled:!E||g,children:o.t(`Salva indirizzo`)})]})]})}),(0,r.jsx)(`div`,{children:(0,r.jsxs)(l.Modal,{isOpen:P,toggle:()=>F(!P),withIcon:!0,labelledBy:`error-modal-message`,container:G(),children:[(0,r.jsx)(l.ModalHeader,{icon:`it-info-circle`,id:`error-modal-message`,children:o.t(`warning`)}),(0,r.jsx)(l.ModalBody,{children:(0,r.jsx)(`p`,{children:te})}),(0,r.jsx)(l.ModalFooter,{children:(0,r.jsx)(l.Button,{color:`primary`,onClick:()=>F(!P),children:o.t(`close`)})})]})}),(0,r.jsxs)(`div`,{className:`position-relative`,children:[(0,r.jsx)(Dn,{id:`${e.id}-${e.key}`,inputClasses:`form-control`,source:(0,y.debounce)(se,520),onConfirm:e=>{C(!1),re.current=``,e&&(e===``&&c(null),c(d.find(t=>t.label===e)))},onClear:()=>{C(!1),re.current=``,c(null)},dropdownArrow:()=>null,minLength:3,disabled:O,confirmOnBlur:!0,showNoOptionsFound:!S,defaultValue:s?.label,value:A,tNoResults:()=>o.t(`Nessun risultato trovato, prova a inserire l'indirizzo completo`),tClearInput:()=>o.t(`Clear input`)}),S&&(0,r.jsx)(`div`,{className:`position-absolute`,style:{width:`100%`,bottom:`0px`},children:(0,r.jsx)(l.Progress,{indeterminate:!0,label:`In elaborazione...`})})]}),!O&&(0,r.jsxs)(l.Button,{type:`button`,value:o.t(`Individua con precisione sulla mappa`),onClick:()=>{/Mobi|Android/i.test(navigator.userAgent)?le():(L(!0),D(!1))},icon:!0,className:`px-0 primary-color`,children:[(0,r.jsx)(l.Icon,{color:`primary`,icon:`it-map-marker-circle`,role:`presentation`}),(0,r.jsx)(`span`,{children:o.t(`Individua con precisione sulla mappa`)})]})]})})},Pn=class e extends Mn{constructor(e,t,n){super(e,t,n)}static get builderInfo(){return{title:`Address Map`,group:`basic`,icon:`bi bi-map`,documentation:``,weight:70,schema:e.schema()}}static schema(){return Mn.schema({type:`address_map`})}static editForm=En;attach(e){return super.attach(e).then(()=>{this.loadRefs(this.element,{[`react-${this.id}`]:`single`});let e=this.refs[`react-${this.id}`];return e?(this.rootComponent=(0,n.createRoot)(e),this.rootComponent.render((0,r.jsx)(Nn,{component:this.component,value:this.dataValue,onChange:e=>this.setValue(e),...this,current:this},this.dataValue)),this):this})}detach(){return this.rootComponent&&=(this.rootComponent.unmount(),null),super.detach()}setValue(e){this.valuePosition=e,this.updateValue(e)}getValue(){return this.valuePosition}init(){super.init()}render(){return super.render(`<div ref="react-${this.id}"></div>`)}},Fn=[{key:`labelPosition`,ignore:!0},{key:`placeholder`,ignore:!0},{key:`description`,ignore:!0},{key:`hideLabel`,ignore:!0},{key:`autofocus`,ignore:!0},{key:`tooltip`,ignore:!0},{key:`tabindex`,ignore:!0},{key:`disabled`,ignore:!0},{label:`Base url`,calculateValue:`let url = '`+M()+`'; data.url = url; value=url;`,key:`url`,type:`hidden`,input:!0,weight:1}];function In(...e){return i.Components.baseEditForm([{key:`display`,components:Fn}],...e)}var Ln=t.Formio.Components.components.field,Rn=({component:e,current:t,onChange:n,i18next:i})=>{let o=`list-services`,s=`selected-category`,[c,u]=(0,a.useState)([]),[d,f]=(0,a.useState)([]),[p,m]=(0,a.useState)(null),[h,g]=(0,a.useState)(null),[_,v]=(0,a.useState)(``),[y,b]=(0,a.useState)(!1),[x,S]=(0,a.useState)(!1),C=(0,a.useRef)(!1),w=(0,a.useRef)(),T=(0,a.useMemo)(()=>p&&(d.find(e=>e.name===p)||c.find(e=>e.name===p))||null,[p,d,c]),E=(0,a.useMemo)(()=>T?.services||[],[T]),D=async()=>{S(!0);let e=sessionStorage.getItem(o),t=sessionStorage.getItem(s);if(e)try{let n=JSON.parse(e);if(Array.isArray(n)&&n.length>0)return u(n),f(n),m((n.find(e=>e.name===t)||n[0])?.name||null),S(!1),n}catch{console.warn(`⚠️ Cache corrotta, rigenerazione...`)}let n=await window.FormioHelper.getBookingConfig(),r={};n.forEach(e=>{(e.categories??[]).forEach(t=>{r[t]||(r[t]={name:t,services:[]}),r[t].services.push(e)})});let i=Object.fromEntries(Object.entries(r).sort(([e],[t])=>e.localeCompare(t,`it`,{sensitivity:`base`}))),a=Object.values(i).filter(e=>(e.name??``).trim()!==``);return u(a),f(a),m(a[0]?.name||null),sessionStorage.setItem(o,JSON.stringify(a)),sessionStorage.setItem(s,a[0]?.name||``),S(!1),a};(0,a.useEffect)(()=>{p&&sessionStorage.setItem(s,p)},[p]),(0,a.useEffect)(()=>{C.current||(C.current=!0,D())},[]);let O=e=>{let t=(e=``)=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),n=(e=``)=>e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/\s+/g,` `).trim(),r=(e=``)=>e.replace(/<[^>]*>/g,` `),i=(e,n)=>RegExp(`\\b${t(n)}`,`i`).test(e),a=(e,t)=>{let a=n(e.name),o=n((e.categories??[]).join(` `)),s=n(r(e.abstract??``));if(!t.every(e=>i(a,e)||i(o,e)||i(s,e)))return-1;let c=0;for(let e of t)i(a,e)?c+=3:i(o,e)?c+=2:i(s,e)&&(c+=1);return c},o=e.target.value;v(o);let s=n(o);if(!s){f(c),m(e=>e??c[0]?.name??null);return}let l=s.split(` `).filter(Boolean),u=c.map(e=>{let t=e.services.map(e=>({service:e,score:a(e,l)})).filter(e=>e.score>=0).sort((e,t)=>t.score-e.score).map(e=>e.service);return t.length?{...e,services:t}:null}).filter(Boolean);f(u),m(u.some(e=>e.name===p)?p:u[0]?.name??null)},k=e=>{g(e);let r=c.find(t=>t.services.some(t=>t.id===e.id));r&&m(r.name),n({id:e.id,link:e.link,name:e.name,show_howto_in_motivation:e.show_howto_in_motivation,categories:e.categories,offices:e.offices,abstract:e.abstract,view_type:e.view_type}),t.data.user_group=null,J()},A=e=>{m(e.name),g(null),v(``),f(c),n({})};return(0,a.useEffect)(()=>{b(!!document.querySelector(`.formio-read-only`))},[]),(0,a.useEffect)(()=>{let e=setTimeout(()=>{let e=t?.dataValue??t?.getValue();if(e?.id&&(g(e),c.length>0)){let t=c.find(t=>t.services.some(t=>t.id===e.id));t&&m(t.name)}},500);return()=>clearTimeout(e)},[t?.dataValue,t?.data,c]),(0,a.useEffect)(()=>{let e=window.FormioInstance;if(!e)return;let n=()=>{let n=e.submission?.data?.[t?.component?.key];if(n?.id&&(g(n),c.length>0)){let e=c.find(e=>e.services.some(e=>e.id===n.id));e&&m(e.name)}};return e.on(`change`,n),()=>e.off(`change`,n)},[c,t?.component?.key]),x?(0,r.jsx)(`div`,{className:`services-booking`,ref:w,children:(0,r.jsxs)(`div`,{children:[i.t(`Caricamento in corso`),`...`]})}):(0,r.jsx)(`div`,{className:`services-booking`,ref:w,children:c&&!y?(0,r.jsxs)(l.Container,{children:[(0,r.jsx)(l.Row,{className:`mb-3`,children:(0,r.jsx)(l.Col,{children:(0,r.jsx)(`h3`,{className:`h6 fw-bold text-uppercase mb-3`,children:i.t(`Seleziona il servizio per cui stai richiedendo un appuntamento`)})})}),(0,r.jsx)(l.Row,{className:`mb-3`,children:(0,r.jsx)(l.Col,{children:(0,r.jsx)(`div`,{className:`search-container`,children:(0,r.jsx)(l.Input,{id:`search`,label:i.t(`Cerca`),type:`text`,value:_,onChange:O,onInput:O,infoText:i.t(`Cerca per categoria, servizio o descrizione`)})})})}),(0,r.jsxs)(l.Row,{className:`mb-3`,children:[T?(0,r.jsx)(l.Col,{lg:3,md:4,className:`mb-4 mb-lg-0`,children:(0,r.jsxs)(`div`,{className:`categories-list`,children:[(0,r.jsx)(`h3`,{className:`h6 fw-bold text-uppercase mb-3`,children:i.t(`Categorie`)}),d.length>0&&d.map(e=>{let t=p===e.name;return(0,r.jsxs)(`button`,{onClick:()=>A(e),className:`category-item w-100 text-start p-3 mb-2 border-0 rounded ${t?`category-active bg-primary text-white`:`bg-light text-dark`}`,children:[(0,r.jsx)(`span`,{className:`fw-500 d-block`,children:e.name}),(0,r.jsxs)(`small`,{className:`d-block mt-1 ${t?`text-white`:`text-muted`}`,children:[e.services.length,` `,e.services.length>1?i.t(`servizi`):i.t(`servizio`)]})]},e.name)})]})}):null,(0,r.jsx)(l.Col,{lg:T?9:12,md:T?8:12,children:(0,r.jsxs)(`div`,{className:`services-container`,children:[E.length>0?(0,r.jsxs)(`div`,{className:`services-header mb-4`,children:[(0,r.jsx)(`h3`,{className:`h5 fw-bold text-primary mb-0`,children:T?.name}),(0,r.jsx)(`div`,{className:`border-bottom border-primary mt-3 mb-4`})]}):null,E.length>0?(0,r.jsx)(`div`,{className:`services-list`,children:E.map(e=>{let t=h?.id===e.id,n=ee.default.sanitize(e?.abstract);return(0,r.jsx)(`button`,{onClick:()=>k(e),className:`service-card mb-4 p-4 rounded border cursor-pointer transition text-start w-100 ${t?`border-primary border-2 bg-light`:`border-light border-1 bg-white`}`,style:{cursor:`pointer`},tabIndex:`0`,role:`button`,"aria-label":`${e.name}`,"aria-pressed":t,children:(0,r.jsx)(`div`,{className:`d-flex justify-content-between align-items-start`,children:(0,r.jsxs)(`div`,{className:`flex-grow-1`,children:[(0,r.jsx)(`h5`,{className:`h6 fw-bold mb-2 text-dark`,children:e.name}),e?.abstract&&(0,r.jsx)(`p`,{className:`text-muted small mb-0`,dangerouslySetInnerHTML:{__html:n}})]})})},e.id)})}):(0,r.jsx)(`div`,{className:`alert alert-info text-italic`,children:i.t(`Il servizio che stai cercando non è disponibile per la prenotazione appuntamento`)})]})})]})]}):y?(0,r.jsx)(`fieldset`,{className:`it-page-section`,children:(0,r.jsx)(`div`,{className:`cmp-card mt-2`,children:(0,r.jsxs)(`div`,{className:`card has-bkg-grey shadow-sm p-big`,children:[(0,r.jsx)(`div`,{className:`card-header border-0 p-0 mb-lg-30`,children:(0,r.jsx)(`div`,{className:`d-flex`,children:(0,r.jsx)(`h2`,{className:`title-xxlarge mb-1`,children:T?.name})})}),(0,r.jsx)(`div`,{className:`card p-3 p-lg-4 fieldset-body`,children:t?.dataValue?.id?(0,r.jsx)(`div`,{className:`services-list`,children:(0,r.jsx)(`div`,{className:`service-card p-4 rounded border transition border-light border-1 bg-white`,children:(0,r.jsx)(`div`,{className:`d-flex justify-content-between align-items-start`,children:(0,r.jsx)(`div`,{className:`flex-grow-1`,children:(0,r.jsx)(`p`,{className:`mb-2 text-dark text-paragraph`,children:t.dataValue.name})})})},t.dataValue.id)}):null})]})})}):null})},zn=class e extends Ln{constructor(e,t,n){super(e,t,n)}static get builderInfo(){return{title:`Lista Servizi`,group:`basic`,icon:`bi bi-list`,documentation:``,weight:70,schema:e.schema()}}static schema(){return Ln.schema({type:`list-services`})}static editForm=In;attach(e,t){return super.attach(e).then(()=>{this.loadRefs(this.element,{[`react-${this.id}`]:`single`});let e=this.refs[`react-${this.id}`];return e?(this.rootComponent&&=(this.rootComponent.unmount(),null),this.rootComponent=(0,n.createRoot)(e),this.builderMode?(this.rootComponent.render((0,r.jsx)(`div`,{className:`my-1 border border-2 border-light rounded p-3 text-secondary`,children:(0,r.jsx)(`div`,{className:`h6 mb-0`,children:this.component?.label||`Lista Servizi`})})),this):(this.rootComponent.render((0,r.jsx)(Rn,{ref:t,component:this.component,onChange:e=>this.setValue(e),...this,current:this})),this)):this})}detach(){return this.rootComponent&&=(this.rootComponent.unmount(),null),super.detach()}setValue(e){e&&(this.shouldSetValue=!0,this.updateValue(e))}getValue(){return this.dataValue}init(){super.init()}render(){return super.render(`<div ref="react-${this.id}"></div>`)}},Bn=t.Components.components.select,Vn=class extends Bn{attach(e){let t=super.attach(e);return(Array.isArray(this.refs.autocompleteInput)?this.refs.autocompleteInput:[this.refs.autocompleteInput]).forEach(e=>{e?.parentNode&&e.parentNode.removeChild(e)}),t}},Hn={pagebreak:j,dynamic_calendar:We,calendar:Je,"calendar-advanced":lt,sdcfile:wn,address_map:Pn,"list-services":zn,select:Vn};function Un(e){if(!e||typeof e.addComponent!=`function`)throw Error(`registerFormioComponents requires Formio Components with addComponent(name, component)`);return Object.entries(Hn).forEach(([t,n])=>{e.addComponent(t,n)}),Hn}return e.Calendar=Je,e.CalendarAdvanced=lt,e.FormioAddressMap=Pn,e.FormioDynamicCalendar=We,e.FormioListServices=zn,e.FormioPageBreak=j,e.SdcFile=wn,e.Select=Vn,e.formioCustomComponents=Hn,e.registerFormioComponents=Un,e})({},_formio_js,react_dom_client,react_jsx_runtime,_formio_react,react,react_day_picker,react_countdown,moment,design_react_kit,sweetalert2,dayjs,_event_calendar_core,react_dropzone,axios,mime,dompurify,jwt_decode,accessible_autocomplete_react,leaflet,lodash);
72
+ }`,conditional:{json:{"===":[{var:`data.storage`},`url`]}}},{type:`textfield`,input:!0,key:`fileKey`,label:`File form-data key`,weight:17,placeholder:`Enter the key name of a file for form data.`,tooltip:`Key name that you would like to modify for the file while calling API request.`,conditional:{json:{"===":[{var:`data.storage`},`url`]}}},{type:`textfield`,input:!0,key:`dir`,label:`Directory`,placeholder:`(optional) Enter a directory for the files`,tooltip:`This will place all the files uploaded in this field in the directory`,weight:20,conditional:{json:{"!==":[{var:`data.storage`},`googledrive`]}}},{type:`textfield`,input:!0,key:`dir`,label:`Folder ID`,placeholder:`(optional) Enter an ID of the folder for the files`,tooltip:`This will place all the files uploaded in this field in the folder`,weight:20,conditional:{json:{"===":[{var:`data.storage`},`googledrive`]}}},{type:`textfield`,input:!0,key:`fileNameTemplate`,label:`File Name Template`,placeholder:`(optional) { {name} }-{ {guid} }"`,tooltip:"Specify template for name of uploaded file(s). Regular template variables are available (`data`, `component`, `user`, `value`, `moment` etc.), also `fileName`, `guid` variables are available. `guid` part must be present, if not found in template, will be added at the end.",weight:25},{type:`checkbox`,input:!0,key:`image`,label:`Display as image(s)`,tooltip:`Instead of a list of linked files, images will be rendered in the view.`,weight:30},{type:`checkbox`,input:!0,key:`uploadOnly`,label:`Upload Only`,tooltip:`When this is checked, will only allow you to upload file(s) and consequently the download, in this component, will be unavailable.`,weight:33},{type:`checkbox`,input:!0,key:`privateDownload`,label:`Private Download`,tooltip:`When this is checked, the file download will send a POST request to the download URL with the x-jwt-token header. This will allow your endpoint to create a Private download system.`,weight:31,conditional:{json:{"===":[{var:`data.storage`},`url`]}}},{type:`textfield`,input:!0,key:`imageSize`,label:`Image Size`,placeholder:`100`,tooltip:`The image size for previewing images.`,weight:40,conditional:{json:{"==":[{var:`data.image`},!0]}}},{type:`textfield`,input:!0,key:`maxFiles`,label:`Numero massimo di file`,placeholder:`100`,tooltip:`Numero massimo di file caricabilii, default è 100.`,weight:40},{type:`checkbox`,input:!0,key:`webcam`,label:`Enable web camera`,tooltip:`This will allow using an attached camera to directly take a picture instead of uploading an existing file.`,weight:32},{type:`textfield`,input:!0,key:`webcamSize`,label:`Webcam Width`,placeholder:`320`,tooltip:`The webcam size for taking pictures.`,weight:38,conditional:{json:{"==":[{var:`data.webcam`},!0]}}},{type:`datagrid`,input:!0,label:`File Types`,key:`fileTypes`,tooltip:`Specify file types to classify the uploads. This is useful if you allow multiple types of uploads but want to allow the user to specify which type of file each is.`,weight:11,components:[{label:`Label`,key:`label`,input:!0,type:`textfield`},{label:`Value`,key:`value`,input:!0,type:`textfield`}]},{type:`textfield`,input:!0,key:`filePattern`,label:`File Pattern`,placeholder:`.jpg,video/*,application/pdf`,tooltip:`See <a href='https://github.com/danialfarid/ng-file-upload#full-reference' target='_blank'>https://github.com/danialfarid/ng-file-upload#full-reference</a> for how to specify file patterns.`,weight:50},{type:`textfield`,input:!0,key:`fileMinSize`,label:`File Minimum Size`,placeholder:`1MB`,tooltip:`See <a href='https://github.com/danialfarid/ng-file-upload#full-reference' target='_blank'>https://github.com/danialfarid/ng-file-upload#full-reference</a> for how to specify file sizes.`,weight:60},{type:`textfield`,input:!0,key:`fileMaxSize`,label:`File Maximum Size`,placeholder:`10MB`,tooltip:`See <a href='https://github.com/danialfarid/ng-file-upload#full-reference' target='_blank'>https://github.com/danialfarid/ng-file-upload#full-reference</a> for how to specify file sizes.`,weight:70},{type:`textfield`,input:!0,key:`maxFiles`,label:`Numero massimo di file`,placeholder:`100`,tooltip:`Numero massimo di file caricabilii, default è 100.`,weight:40}],pt=[{key:`unique`,ignore:!0},{key:`validateOn`,ignore:!0}];function mt(...e){return i.Components.baseEditForm([{key:`display`,components:dt},{key:`data`,components:ut},{label:`File`,key:`file`,weight:5,components:ft},{key:`validation`,components:pt}],...e)}var ht=E(((e,t)=>{t.exports=Array.isArray})),gt=E(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),_t=E(((e,t)=>{var n=gt(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),vt=E(((e,t)=>{t.exports=_t().Symbol})),yt=E(((e,t)=>{var n=vt(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),bt=E(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),xt=E(((e,t)=>{var n=vt(),r=yt(),i=bt(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),St=E(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),Ct=E(((e,t)=>{var n=xt(),r=St(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),wt=E(((e,t)=>{var n=ht(),r=Ct(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),Tt=E(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),Et=E(((e,t)=>{var n=xt(),r=Tt(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),Dt=E(((e,t)=>{t.exports=_t()[`__core-js_shared__`]})),Ot=E(((e,t)=>{var n=Dt(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),kt=E(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),At=E(((e,t)=>{var n=Et(),r=Ot(),i=Tt(),a=kt(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),jt=E(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),Mt=E(((e,t)=>{var n=At(),r=jt();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),Nt=E(((e,t)=>{t.exports=Mt()(Object,`create`)})),Pt=E(((e,t)=>{var n=Nt();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Ft=E(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}t.exports=n})),It=E(((e,t)=>{var n=Nt(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),Lt=E(((e,t)=>{var n=Nt(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),Rt=E(((e,t)=>{var n=Nt(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=n&&t===void 0?r:t,this}t.exports=i})),zt=E(((e,t)=>{var n=Pt(),r=Ft(),i=It(),a=Lt(),o=Rt();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),Bt=E(((e,t)=>{function n(){this.__data__=[],this.size=0}t.exports=n})),Vt=E(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),Ht=E(((e,t)=>{var n=Vt();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Ut=E(((e,t)=>{var n=Ht(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Wt=E(((e,t)=>{var n=Ht();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),Gt=E(((e,t)=>{var n=Ht();function r(e){return n(this.__data__,e)>-1}t.exports=r})),Kt=E(((e,t)=>{var n=Ht();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),qt=E(((e,t)=>{var n=Bt(),r=Ut(),i=Wt(),a=Gt(),o=Kt();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),Jt=E(((e,t)=>{t.exports=Mt()(_t(),`Map`)})),Yt=E(((e,t)=>{var n=zt(),r=qt(),i=Jt();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),Xt=E(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),Zt=E(((e,t)=>{var n=Xt();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),Qt=E(((e,t)=>{var n=Zt();function r(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}t.exports=r})),$t=E(((e,t)=>{var n=Zt();function r(e){return n(this,e).get(e)}t.exports=r})),en=E(((e,t)=>{var n=Zt();function r(e){return n(this,e).has(e)}t.exports=r})),tn=E(((e,t)=>{var n=Zt();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),nn=E(((e,t)=>{var n=Yt(),r=Qt(),i=$t(),a=en(),o=tn();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),rn=E(((e,t)=>{var n=nn(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),an=E(((e,t)=>{var n=rn(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),on=E(((e,t)=>{var n=an(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),sn=E(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),cn=E(((e,t)=>{var n=vt(),r=sn(),i=ht(),a=Ct(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),ln=E(((e,t)=>{var n=cn();function r(e){return e==null?``:n(e)}t.exports=r})),un=E(((e,t)=>{var n=ht(),r=wt(),i=on(),a=ln();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),dn=E(((e,t)=>{var n=Ct(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Y=E(((e,t)=>{var n=un(),r=dn();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),fn=E(((e,t)=>{var n=Y();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),pn=E(((e,t)=>{var n=Mt();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),mn=E(((e,t)=>{var n=pn();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),hn=E(((e,t)=>{var n=mn(),r=Vt(),i=Object.prototype.hasOwnProperty;function a(e,t,a){var o=e[t];(!(i.call(e,t)&&r(o,a))||a===void 0&&!(t in e))&&n(e,t,a)}t.exports=a})),gn=E(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e<t}t.exports=i})),_n=E(((e,t)=>{var n=hn(),r=un(),i=gn(),a=Tt(),o=dn();function s(e,t,s,c){if(!a(e))return e;t=r(t,e);for(var l=-1,u=t.length,d=u-1,f=e;f!=null&&++l<u;){var p=o(t[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return e;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=a(h)?h:i(t[l+1])?[]:{})}n(f,p,m),f=f[p]}return e}t.exports=s})),vn=O(E(((e,t)=>{var n=_n();function r(e,t,r){return e==null?e:n(e,t,r)}t.exports=r}))(),1),yn=O(fn(),1);document.documentElement.lang.toString();var bn=class{constructor(){this.token=null,this.basePath=null,this.init()}init(){this.token=null,this.basePath=M()}async getSessionAuthToken(){let e=this;await m.default.get(e.basePath+`/api/session-auth`).then(t=>{e.token=t.data.token}).catch(e=>{u.default.fire(`'error_message_detail`,`'auth_error'`,`error`)})}getSessionAuthTokenPromise(){let e=this;return new Promise(async(t,n)=>{U(`auth-token`)?t({token:U(`auth-token`)}):await m.default.get(e.basePath+`/api/session-auth?with-cookie=true`,{withCredentials:!0,headers:{"Content-Type":`application/json; charset=utf-8`}}).then(e=>{let t=(0,g.jwtDecode)(e.data.token);t.exp&&W(`auth-token`,e.data.token,t.exp)}).catch(e=>{console.log(e)})})}getToken(){return this.token}execAuthenticatedCall(e){this.token?e(this.token):this.getSessionAuthTokenPromise().then(t=>{this.token=t.token,e(this.token)})}},xn=t.Formio.Components.components.file,Sn=null;document.querySelector(`widget-formio`)!==null&&(Sn=document.querySelector(`widget-formio`).getAttribute(`signature-check-ws-url`));var Cn=({component:e,current:t,onChange:n,i18next:i})=>{let[o,s]=(0,a.useState)([]),[c,d]=(0,a.useState)(new Map),[f,g]=(0,a.useState)(!1),_=new bn;(0,a.useEffect)(()=>{_.getSessionAuthTokenPromise()},[]);let v=(e,t)=>{d(n=>{let r=new Map(n);return r.set(e,{...t,progress:Number(t?.progress)||0}),r})};function y(t){return t.size>(A(e.fileMaxSize)||A(`1GB`))?{code:`size-files`,message:`${i.t(`I file non possono superare le dimensioni di`)} ${e.fileMaxSize?e.fileMaxSize:`1GB`}`}:o.length>=(e.maxFiles?parseInt(e.maxFiles):e.multiple?100:1)?{code:`too-many-files`,message:`${i.t(`Puoi caricare massimo `)} ${e.maxFiles||100} ${i.t(`file`)}`}:t.size<A(e.fileMinSize)?{code:`file-too-small`,message:`${i.t(`I file devono avare una dimensione superiore a `)} ${e.fileMinSize}`}:null}function b(){if(e.filePattern){let t=e.filePattern.split(`,`).map(e=>e.trim()).filter(Boolean).reduce((e,t)=>{let n=t.startsWith(`.`)?t:`.${t}`,r=h.default.getType(n);return r?(e[r]||(e[r]=[]),e[r].push(n),e):e},{});return Object.keys(t).length?t:void 0}else return!0}let x=e=>{let t={};return t.originalName=e.originalName?e.originalName:e.name,t.name=e.name,t.url=e.url,t.data=e.data,t.signature_validation=e.signature_validation,t.mime_type=e.mime_type,t.storage=`url`,t.size=e.size,t},{getRootProps:S,getInputProps:C,fileRejections:w,isDragActive:T,open:E}=(0,p.useDropzone)({onDrop:e=>{e.map(e=>{k(e).then(e=>{})})},maxFiles:e.maxFiles?parseInt(e.maxFiles)-o.length:e.multiple?100:1,validator:y,accept:b()}),D=e=>{let t=M()+`/api/attachments/`+e.data.id;fetch(t,{method:`DELETE`,headers:{"Content-Type":`application/json; charset=utf-8`,Authorization:`Bearer ${U(`auth-token`)}`},strictErrors:!0}).then(()=>{s(t=>{let r=t.filter(t=>t.data.id!==e.data.id);return n(r),r})}).catch(e=>{u.default.fire({title:``,html:`<p>${i.t(`Ci sono stati degli errori durante l'eliminazione del file`)}</p>`,icon:`error`,cancelButtonText:i.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1}),console.error(e)})},O=()=>{let e=typeof t?.getCurrentValue==`function`?t.getCurrentValue():t?.dataValue;e?.length>0&&(s(e),setTimeout(()=>{n(e)},100))};(0,a.useEffect)(()=>{document.querySelector(`.formio-read-only`)&&f===!1?(g(!0),setTimeout(()=>{O()},1e3)):(g(!1),setTimeout(()=>{O()},1e3))},[]);async function k(r){let a,o=M()+`/it/upload`,c={mime_type:r.type,name:r.name,original_filename:r.name,protocol_required:e.protocol_required,size:r.size};return await m.default.post(o,c,{maxContentLength:1/0,maxBodyLength:1/0}).then(async o=>(a=o.data.id,r.url=M()+`/it/allegati/`+a,r.storage=`url`,r.mime_type=r.type,r.protocol_required=e.protocol_required,r.data={...o.data,baseUrl:M()+`/it/allegati/`+a},v(a,r),await m.default.put(o.data.uri,r,{onUploadProgress:e=>{let t=Math.round(e.loaded*100/e.total);d(e=>{let n=new Map(e),i=r;return i.progress=parseInt(t),n.has(a)&&n.set(a,i),n})},maxContentLength:1/0,maxBodyLength:1/0,headers:{"Content-Type":`multipart/form-data`}}).then(async o=>{let c=o.headers.etag.replace(/\\|"/gi,``)||null;return await m.default.put(M()+`/it/upload/`+a,{file_hash:c,check_signature:e.check_signature}).then(async i=>{d(e=>{let t=new Map(e);return t.delete(a),t});let o=t.dataValue||[],c=null;if(s(e=>{let t=[...e,x(r)];return c=t.length-1,n(t),t}),e.check_signature&&i.data.url&&Sn)return await m.default.post(Sn,{url:i.data.url,content:null},{headers:{"Content-Type":`application/json`}}).then(e=>{r.signature_validation=e.data.sign,o[c].signature_validation=e.data.sign}).catch(e=>{o[c].signature_validation=`File validation error: `+e});d(e=>{let t=new Map(e);return t.delete(a),t})}).catch(e=>{d(e=>{let t=new Map(e);return t.delete(a),t}),console.log(e),u.default.fire({title:``,html:`<p>${i.t(`Ci sono stati degli errori dutante il caricamento dei file, riprova più tardi!`)}</p>`,icon:`error`,cancelButtonText:i.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1})})}).catch(e=>{d(e=>{let t=new Map(e);return t.delete(a),t}),console.log(e),u.default.fire({title:``,html:`<p>${i.t(`Ci sono stati degli errori dutante il caricamento dei file, riprova più tardi!`)}</p>`,icon:`error`,cancelButtonText:i.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1})}))).catch(e=>{console.log(e),u.default.fire({title:``,html:`<p>${i.t(`Ci sono stati degli errori dutante il caricamento dei file, riprova più tardi!`)}</p>`,icon:`error`,cancelButtonText:i.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1}),d(e=>{let t=new Map(e);return t.delete(a),t})})}function A(e){if(typeof e==`string`){if(e.search(/kb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024);if(e.search(/mb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024*1024);if(e.search(/gb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024*1024*1024);if(e.search(/b/i)===e.length-1||e.search(/s/i)===e.length-1)return parseFloat(e.substring(0,e.length-1));if(e.search(/m/i)===e.length-1)return parseFloat(e.substring(0,e.length-1)*60);if(e.search(/h/i)===e.length-1)return parseFloat(e.substring(0,e.length-1)*3600)}return e}function j(e,t=2){if(!+e)return`0 Bytes`;let n=1024,r=t<0?0:t,i=[`Bytes`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],a=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/n**+a).toFixed(r))} ${i[a]}`}return t.conditionallyHidden()||t.visible===!1?null:(0,r.jsx)(r.Fragment,{children:f?(0,r.jsxs)(`div`,{children:[(0,r.jsxs)(`label`,{className:`col-form-label floating-label`,htmlFor:`${e.id}-${e.key}`,children:[e.label,e.validate.required&&(0,r.jsx)(`span`,{className:`text-danger`})]}),(0,r.jsxs)(`ul`,{className:`upload-file-list`,children:[o.map((e,t)=>(0,r.jsxs)(`li`,{className:`upload-file success mw-100`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`primary`,icon:`it-file`,title:`Icona file`,size:`sm`}),(0,r.jsxs)(`p`,{children:[(0,r.jsx)(`span`,{className:`visually-hidden`,children:i.t(`File caricato:`)}),e.name,(0,r.jsx)(`span`,{className:`upload-file-weight`,children:j(e.size)})]})]},e.size+t)),o.length<1&&(0,r.jsxs)(`li`,{className:`upload-file text-secondary mw-100`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`light`,icon:`it-files`,title:`Icona file`,size:`sm`}),(0,r.jsx)(`p`,{children:i.t(`Nessun elemento`)})]})]})]}):(0,r.jsxs)(r.Fragment,{children:[e.hideLabel||e.hidden?``:(0,r.jsxs)(`label`,{className:`col-form-label floating-label`,htmlFor:`${e.id}-${e.key}`,title:e.tooltip||void 0,children:[e.label,e.validate.required&&(0,r.jsx)(`span`,{className:`text-danger`}),e.tooltip&&(0,r.jsx)(`i`,{tabIndex:0,className:`bi bi-question-circle text-muted ms-1`,"data-tooltip":e.tooltip,"aria-expanded":`false`})]}),(0,r.jsxs)(`div`,{className:`my-1 border-2 border-light file-uploader-box rounded p-3 text-secondary${T?` dragover`:``}`,style:{border:`dashed`},...S({onClick:e=>e.stopPropagation()}),children:[(0,r.jsx)(`input`,{id:`${e.id}-${e.key}`,"aria-describedby":`file-uploader-description-${e.id}-${e.key}`,...C()}),(0,r.jsxs)(`div`,{className:`upload-dragdrop${T?` dragover`:``}`,children:[(0,r.jsx)(`div`,{className:`ms-1 me-3`,children:(0,r.jsx)(l.Icon,{color:`secondary`,icon:`it-upload`,title:i.t(`Carica file`),size:`_sm`})}),(0,r.jsxs)(`div`,{className:`upload-dragdrop-text`,children:[(0,r.jsx)(`div`,{className:`h5`,id:`file-uploader-description-${e.id}-${e.key}`,children:i.t(`Trascina il file per caricarlo`)}),(0,r.jsxs)(`p`,{className:`d-inline-flex`,children:[i.t(`oppure`),(0,r.jsx)(l.Button,{tag:`input`,type:`button`,value:i.t(`selezionalo dal dispositivo`),onClick:E,className:`px-1 py-0 text-decoration-underline primary-color`,size:`xs`})]})]})]})]}),(0,r.jsx)(`div`,{dangerouslySetInnerHTML:{__html:ee.default.sanitize(e.description||``)}}),(0,r.jsxs)(`ul`,{className:`upload-file-list my-0`,children:[o.map((e,t)=>(0,r.jsxs)(`li`,{className:`upload-file success`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`primary`,icon:`it-file`,title:`Icona file`,size:`sm`}),(0,r.jsxs)(`p`,{children:[(0,r.jsx)(`span`,{className:`visually-hidden`,children:i.t(`File caricato:`)}),e.name,(0,r.jsx)(`span`,{className:`upload-file-weight`,children:j(e.size)})]}),(0,r.jsx)(l.Button,{className:`px-1`,onClick:()=>D(e),children:(0,r.jsx)(l.Icon,{title:`${i.t(`Elimina file caricato`)} ${e.name}`,color:`secondary`,icon:`it-delete`,className:`ms-auto pointer`,size:`sm`})})]},e.size+t)),Array.from(c.entries()).map(([e,t])=>(0,r.jsxs)(`li`,{className:`upload-file success`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`primary`,icon:`it-file`,title:`Icona file`,size:`sm`}),(0,r.jsxs)(`p`,{children:[(0,r.jsx)(`span`,{className:`visually-hidden`,children:i.t(`Caricamento file:`)}),t.name,(0,r.jsx)(`span`,{className:`upload-file-weight`,children:j(t.size)})]}),(0,r.jsx)(l.Progress,{value:Number(t?.progress)||0})]},e))]}),!!(w&&w.length)&&(0,r.jsx)(`div`,{className:`formio-error-wrapper`,children:(0,r.jsx)(`ul`,{className:`formio-errors upload-file-list my-0 `,children:w.map(({file:t,errors:n},a)=>(0,r.jsxs)(`li`,{className:`upload-file error`,children:[(0,r.jsxs)(`div`,{className:`upload-file-name-error-wrapper`,children:[(0,r.jsx)(l.Icon,{"aria-hidden":`true`,color:`error`,icon:`it-error`,title:`Icona file`,size:`sm`}),(0,r.jsxs)(`p`,{className:`text-wrap error`,children:[(0,r.jsx)(`span`,{className:`visually-hidden`,children:i.t(`Errore caricamento file:`)}),t.name,(0,r.jsx)(`span`,{className:`upload-file-weight`,children:j(t.size)})]})]}),(0,r.jsx)(`div`,{children:n.map(t=>t.code===`file-invalid-type`?(0,r.jsxs)(`p`,{className:`text-wrap ms-0`,children:[i.t(`I file possono essere di tipo `),e.filePattern]}):t.code===`too-many-files`?(0,r.jsxs)(`p`,{className:`text-wrap ms-0`,children:[i.t(`Puoi caricare massimo `),` `,e.maxFiles?e.maxFiles:e.multiple?100:1,` `,i.t(`file`)]}):(0,r.jsx)(`p`,{className:`text-wrap ms-0`,children:t.message}))})]},t.size+a))})})]})})},wn=class e extends xn{constructor(e,t,n){super({...e,clearOnHide:!1},t,n),this.reactRef=null,this.lastRenderedVisible=void 0,this.rootComponent=null,this.mountNode=null}static get builderInfo(){return{title:`File Sdc`,group:`basic`,icon:`bi bi-file-earmark-text`,documentation:``,weight:70,schema:e.schema()}}get emptyValue(){return[]}init(){if(super.init(),this.component?.multiple&&!Array.isArray(this.getCurrentValue())){this.dataValue=[];let e=this.path||this.component?.key;e&&this.rootValue&&(0,vn.default)(this.rootValue,e,[])}}static schema(){return xn.schema({type:`sdcfile`,modelType:`array`})}static editForm=mt;getI18next(){return this.i18next&&typeof this.i18next.t==`function`?this.i18next:{language:this.options?.language||document?.documentElement?.lang||`it`,t:(e,t)=>this.t(e,t)}}hideFileProcessingLoader(){this.refs?.fileProcessingLoader&&(this.refs.fileProcessingLoader.style.display=`none`)}renderReact(){if(this.rootComponent){if(this.builderMode){this.rootComponent.render((0,r.jsx)(`div`,{className:`my-1 border border-2 border-light file-uploader-box rounded p-3 text-secondary`,children:(0,r.jsx)(`div`,{className:`upload-dragdrop`,children:(0,r.jsx)(`div`,{className:`upload-dragdrop-text`,children:(0,r.jsx)(`div`,{className:`h6 mb-0`,children:this.component?.label||`File Sdc`})})})}));return}this.rootComponent.render((0,r.jsx)(Cn,{component:this.component,current:this,i18next:this.getI18next(),onChange:e=>this.updateValueFromReact(e)}))}}attach(e){let t=super.attach(e);this.hideFileProcessingLoader();let r=`react-${this.id}`;this.loadRefs(e,{[r]:`single`});let i=this.refs[r];return i?(this.rootComponent&&this.mountNode!==i&&(this.rootComponent.unmount(),this.rootComponent=null),this.rootComponent||=(0,n.createRoot)(i),this.mountNode=i,this.lastRenderedVisible=this.visible,this.renderReact(),t):t}updateValueFromReact(e,t={modified:!0}){let n=this.normalizeValue(e,t),r=this.updateValue(n,t),i=this.path||this.component?.key;if(i&&this.rootValue){let e=(0,yn.default)(this.rootValue,i);this.isEqual(e,n)||(0,vn.default)(this.rootValue,i,n)}return r}setValue(e,t={}){let n=this.normalizeValue(e,t),r=super.setValue(n,t),i=this.path||this.component?.key;if(i&&this.rootValue){let e=(0,yn.default)(this.rootValue,i);this.isEqual(e,n)||(0,vn.default)(this.rootValue,i,n)}return r}normalizeValue(e,t={}){let n=super.normalizeValue(e,t);return!this.component?.multiple||Array.isArray(n)?n:n==null||n===``?[]:[n]}detach(){return this.hideFileProcessingLoader(),this.rootComponent&&=(this.rootComponent.unmount(),null),this.mountNode=null,super.detach()}getValue(){return this.getCurrentValue()}get validationValue(){return this.getCurrentValue()}getCurrentValue(){let e=super.getValue(),t=this.path||this.component?.key,n=t&&this.rootValue?(0,yn.default)(this.rootValue,t):void 0;return this.component?.multiple?Array.isArray(e)&&e.length>0?e:Array.isArray(n)?n:[]:e??n??null}isEmpty(e=this.validationValue){return this.component?.multiple?!Array.isArray(e)||e.length===0:e==null||e===``}checkCondition(e,t){let n=super.checkCondition(e,t),r=this.visible;return this.lastRenderedVisible!==r&&(this.lastRenderedVisible=r,this.renderReact()),n}render(){let e=`<div ref="react-${this.id}"></div>`;return Object.getPrototypeOf(Object.getPrototypeOf(xn.prototype)).render.call(this,e)}},Tn=[{key:`labelPosition`,ignore:!0},{key:`labelPosition`,ignore:!0},{key:`placeholder`,ignore:!0},{key:`description`,ignore:!0},{key:`hideLabel`,ignore:!0},{key:`autofocus`,ignore:!0},{key:`tooltip`,ignore:!0},{key:`tabindex`,ignore:!0},{key:`disabled`,ignore:!0}];function En(...e){return i.Components.baseEditForm([{key:`display`,components:Tn}],...e)}var Dn=_.default?.default??_.default,On=({value:e,defaultValue:t=``,onConfirm:n,source:i,disabled:o,onClear:s,tClearInput:c=()=>`Clear input`,...u})=>{let d=(0,a.useRef)(null),f=e=>{setTimeout(()=>{d.current&&(d.current.elementReferences[-1].value=e)},0)};(0,a.useEffect)(()=>{e!==void 0&&f(e)},[e]),(0,a.useEffect)(()=>{o?d.current&&(d.current.elementReferences[-1].disabled=!0):d.current&&(d.current.elementReferences[-1].disabled=!1)},[o]);let p=()=>{s&&s()},m=(e,t)=>{d.current.elementReferences[-1].classList.contains(`autocomplete__input--focused`)&&i(e,t)},h=t=>{t?n(t):f(e)};return(0,r.jsxs)(`div`,{style:{position:`relative`,width:`100%`},children:[(0,r.jsx)(Dn,{ref:d,...u,defaultValue:t,onConfirm:h,source:m}),!!(e&&e.length>0&&!o)&&(0,r.jsx)(`button`,{onClick:p,style:{position:`absolute`,right:`0px`,top:`50%`,transform:`translateY(-50%)`,background:`transparent`,border:`none`,cursor:`pointer`,padding:0},"aria-label":c(),children:(0,r.jsx)(l.Icon,{icon:`it-close`,size:`sm`,title:c()})})]})},kn=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMY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l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC`,Mn=({position:e,areasLayer:t,bounds:n,onMarkedMoved:i})=>{let o=(0,a.useRef)(null),s=null,[c,l]=(0,a.useState)([]),u=(0,v.tileLayer)(`https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`,{attribution:`&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>`}),d=[41.9,12.5],f=()=>{let r=v.default.map(o.current,{keyboard:!1,minZoom:6,maxZoom:18}).setView(d,10);u.addTo(r),t&&t.map(e=>{e.addTo(r)});let a=e?[`${e.lat}`,`${e.lon}`]:n?n.getCenter():d;if(delete v.default.Icon.Default.prototype._getIconUrl,v.default.Icon.Default.mergeOptions({iconRetinaUrl:kn,iconUrl:An,shadowUrl:jn}),s=v.default.marker(a,{draggable:!0}).addTo(r),s.on(`moveend`,function(e){i(e.target.getLatLng(),s)}),r.on(`click`,function(e){let t=e.latlng;s&&s.setLatLng(t).update(),i(t,s)}),!e&&n)r.fitBounds(n);else{let t=e?[e.lat,e.lon]:d;s&&(s.setLatLng(t).update(),r.setView(t,15))}};return(0,a.useEffect)(()=>{o.current&&f()},[o]),(0,r.jsx)(`div`,{className:`d-block`,style:{height:`60vh`,width:`100%`,display:`block`},children:(0,r.jsx)(`div`,{ref:o,style:{height:`100%`,width:`100%`},"aria-hidden":!0})})},Nn=t.Formio.Components.components.field,Pn=({component:e,value:t,current:n,onChange:i,i18next:o})=>{let[s,c]=(0,a.useState)(null),[d,f]=(0,a.useState)([]),[p,m]=(0,a.useState)(),[h,ee]=(0,a.useState)(),[g,_]=(0,a.useState)(!1),[b,x]=(0,a.useState)(),[S,C]=(0,a.useState)(!1),[w,T]=(0,a.useState)(),[E,D]=(0,a.useState)(),[O,k]=(0,a.useState)(!1),[A,j]=(0,a.useState)(``),[te,N]=(0,a.useState)(``),[P,F]=(0,a.useState)(!1),[I,L]=(0,a.useState)(!1),R=new URLSearchParams(window.location.search).get(`area`),{geographic_areas_id:ne}=window.OC_SERVICE_DETAILS,re=(0,a.useRef)(),z=o.language,ie=v.default.latLngBounds(),ae=R||(ne&&ne.length>0?ne:void 0),oe=(e,t)=>{re.current=e;let n=`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(e)}&countrycodes=it&viewbox=${p}&bounded=1&addressdetails=1&limit=14&format=jsonv2&accept-language=${z}`,r=[],i=[];C(!0),fetch(n).then(e=>e.json()).then(n=>{if(n.length&&re.current===e){C(!0);let e=n.map((e,t)=>{let{lat:n,lon:r}=e,i=`${M()}/api/geographic-areas/contains?lat=${n}&lon=${r}&geographic_areas_ids=${b.join(`,`)}`;return fetch(i).then(e=>e.json()).then(t=>t.result?(e.label=Be(e),e):null)});return Promise.all(e)}else re.current===e&&(t([]),C(!1))}).then(n=>{n=n?n.filter(e=>e!==null):[],n.length>0?(n.forEach((e,t)=>{n[t].label=Be(e)}),n=y.default.uniqWith(n,(e,t)=>e.label===t.label),n.forEach((e,t)=>{i.push(e.label),r.push(e)}),re.current===e&&(t(i),f(r),C(!1))):re.current===e&&(t([]),C(!1))}).catch(e=>{console.error(`Error fetching locations:`,e),C(!1)})},se=(e,t)=>{oe(e,t)},ce=(e,t)=>{let{lat:n,lng:r}=e,i=`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${n}&lon=${r}&accept-language=${z}`;fetch(i).then(e=>e.json()).then(e=>{if(e&&e.display_name)if(e.label=Be(e),e.lat=n,e.lon=r,t)t.bindPopup(`${e.label}`,{className:`address-map-popup`}).openPopup(),D(e);else{D(e);return}}).catch(e=>console.error(`Error with reverse geocoding:`,e))};function le(){navigator.geolocation.getCurrentPosition(e=>{let t=e.coords.latitude,n=e.coords.longitude;if((b||[]).length>0){let e=`${M()}/api/geographic-areas/contains?lat=${t}&lon=${n}&geographic_areas_ids=${b.join(`,`)}`;fetch(e).then(e=>e.json()).then(e=>{e.result?(c({lat:t,lon:n}),ce({lat:t,lng:n}),L(!I)):L(!I)})}else c({lat:t,lon:n}),ce({lat:t,lng:n}),L(!I)},e=>{e?.code===1?(F(!P),N(o.t(`error_message_code_1`))):e?.code===2?(F(!P),N(o.t(`error_message_code_2`))):e?.code===3?(F(!P),N(o.t(`error_message_code_3`))):(F(!P),N(o.t(`error_message_generic`)))})}(0,a.useEffect)(()=>{t&&c(t),n.valuePosition&&c(n.valuePosition)},[t,n]);let ue=()=>{t&&c(t),n.valuePosition&&c(n.valuePosition)};(0,a.useEffect)(()=>{window?.Formio?.formioReady.then(()=>{setTimeout(()=>{ue(),de()},1)})},[]);let de=()=>{let e=`${M()}/api/geographic-areas`,t=[],n=[],r=[];fetch(e).then(e=>e.json()).then(e=>{if(Array.isArray(e)&&e.length>0){e.filter(e=>ae?Array.isArray(ae)?ae.includes(e.id):e.id===ae:!0).forEach(e=>{t.push(e.id);let i=JSON.parse(e.geofence);n.push(i);let a=v.default.geoJSON(i,{style:{color:`#3478bd`,fillColor:`#87CEEB`,fillOpacity:.2,weight:1.5},filter:function(e){return e.geometry.type===`Polygon`||e.geometry.type===`MultiPolygon`}});ie.extend(a.getBounds()),r.push(a)}),ee(r),x(t),T(ie);let i=ie.getNorthEast(),a=ie.getSouthWest();m([i.lng,i.lat,a.lng,a.lat])}else console.log(`No geographic_areas_ids found.`)}).catch(e=>{console.error(`Error with reverse geocoding:`,e)})},fe=()=>{j(s?.label?s.label:``)};(0,a.useEffect)(()=>{fe(),i(s)},[s]),(0,a.useEffect)(()=>{document.querySelector(`.formio-read-only`)&&O===!1?k(!0):k(!1)},[]);let pe=()=>{if(E){let e=`${M()}/api/geographic-areas/contains?lat=${E.lat}&lon=${E.lon}&geographic_areas_ids=${b.join(`,`)}`;_(!0),fetch(e).then(e=>e.json()).then(e=>{_(!1),e?e.result===!1?u.default.fire({title:``,html:`<p>`+o.t(`Attenzione: Il luogo selezionato si trova al di fuori dell’area coperta dal servizio. Per favore, scegli un luogo all'interno dell'area evidenziata nella mappa.`)+`</p>`,icon:`error`,cancelButtonText:o.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1}):e.result===!0&&(L(!I),c(E)):(_(!1),console.log(`No geographic-areas/contains .`))}).catch(e=>{console.error(`Error with geographic-areas/contains:`,e),u.default.fire({title:``,html:`<p>`+e+`</p>`,icon:`error`,cancelButtonText:o.t(`Chiudi`),showCancelButton:!0,showConfirmButton:!1})})}};return(0,r.jsx)(`div`,{children:(0,r.jsxs)(`div`,{id:`address-map-container-${e.key}`,className:`address-map-container`,children:[(0,r.jsx)(`div`,{children:(0,r.jsxs)(l.Modal,{wrapClassName:`formio-component-address_map`,isOpen:I,size:`lg`,scrollable:!0,toggle:()=>L(!I),labelledBy:`maps-evo`,container:G(),children:[(0,r.jsx)(l.ModalHeader,{toggle:()=>L(!I),id:`maps-evo`,children:o.t(`Individua il luogo sulla mappa`)}),(0,r.jsxs)(l.ModalBody,{children:[(0,r.jsx)(`p`,{children:(0,r.jsx)(`small`,{children:o.t(`Trascina l’icona nel punto preciso in cui si verifica l’evento che vuoi segnalare e fai click su Salva indirizzo`)})}),(0,r.jsx)(Mn,{position:s,areasLayer:h,bounds:w,onMarkedMoved:(e,t)=>{ce(e,t)}})]}),(0,r.jsxs)(l.ModalFooter,{children:[(0,r.jsx)(l.Button,{color:`secondary`,onClick:()=>L(!I),children:o.t(`Chiudi`)}),(0,r.jsx)(l.Button,{color:`primary`,onClick:()=>{pe()},disabled:!E||g,children:o.t(`Salva indirizzo`)})]})]})}),(0,r.jsx)(`div`,{children:(0,r.jsxs)(l.Modal,{isOpen:P,toggle:()=>F(!P),withIcon:!0,labelledBy:`error-modal-message`,container:G(),children:[(0,r.jsx)(l.ModalHeader,{icon:`it-info-circle`,id:`error-modal-message`,children:o.t(`warning`)}),(0,r.jsx)(l.ModalBody,{children:(0,r.jsx)(`p`,{children:te})}),(0,r.jsx)(l.ModalFooter,{children:(0,r.jsx)(l.Button,{color:`primary`,onClick:()=>F(!P),children:o.t(`close`)})})]})}),(0,r.jsxs)(`div`,{className:`position-relative`,children:[(0,r.jsx)(On,{id:`${e.id}-${e.key}`,inputClasses:`form-control`,source:(0,y.debounce)(se,520),onConfirm:e=>{C(!1),re.current=``,e&&(e===``&&c(null),c(d.find(t=>t.label===e)))},onClear:()=>{C(!1),re.current=``,c(null)},dropdownArrow:()=>null,minLength:3,disabled:O,confirmOnBlur:!0,showNoOptionsFound:!S,defaultValue:s?.label,value:A,tNoResults:()=>o.t(`Nessun risultato trovato, prova a inserire l'indirizzo completo`),tClearInput:()=>o.t(`Clear input`)}),S&&(0,r.jsx)(`div`,{className:`position-absolute`,style:{width:`100%`,bottom:`0px`},children:(0,r.jsx)(l.Progress,{indeterminate:!0,label:`In elaborazione...`})})]}),!O&&(0,r.jsxs)(l.Button,{type:`button`,value:o.t(`Individua con precisione sulla mappa`),onClick:()=>{/Mobi|Android/i.test(navigator.userAgent)?le():(L(!0),D(!1))},icon:!0,className:`px-0 primary-color`,children:[(0,r.jsx)(l.Icon,{color:`primary`,icon:`it-map-marker-circle`,role:`presentation`}),(0,r.jsx)(`span`,{children:o.t(`Individua con precisione sulla mappa`)})]})]})})},Fn=class e extends Nn{constructor(e,t,n){super(e,t,n)}static get builderInfo(){return{title:`Address Map`,group:`basic`,icon:`bi bi-map`,documentation:``,weight:70,schema:e.schema()}}static schema(){return Nn.schema({type:`address_map`})}static editForm=En;attach(e){return super.attach(e).then(()=>{this.loadRefs(this.element,{[`react-${this.id}`]:`single`});let e=this.refs[`react-${this.id}`];return e?(this.rootComponent=(0,n.createRoot)(e),this.rootComponent.render((0,r.jsx)(Pn,{component:this.component,value:this.dataValue,onChange:e=>this.setValue(e),...this,current:this},this.dataValue)),this):this})}detach(){return this.rootComponent&&=(this.rootComponent.unmount(),null),super.detach()}setValue(e){this.valuePosition=e,this.updateValue(e)}getValue(){return this.valuePosition}init(){super.init()}render(){return super.render(`<div ref="react-${this.id}"></div>`)}},In=[{key:`labelPosition`,ignore:!0},{key:`placeholder`,ignore:!0},{key:`description`,ignore:!0},{key:`hideLabel`,ignore:!0},{key:`autofocus`,ignore:!0},{key:`tooltip`,ignore:!0},{key:`tabindex`,ignore:!0},{key:`disabled`,ignore:!0},{label:`Base url`,calculateValue:`let url = '`+M()+`'; data.url = url; value=url;`,key:`url`,type:`hidden`,input:!0,weight:1}];function Ln(...e){return i.Components.baseEditForm([{key:`display`,components:In}],...e)}var Rn=t.Formio.Components.components.field,zn=({component:e,current:t,onChange:n,i18next:i})=>{let o=`list-services`,s=`selected-category`,[c,u]=(0,a.useState)([]),[d,f]=(0,a.useState)([]),[p,m]=(0,a.useState)(null),[h,g]=(0,a.useState)(null),[_,v]=(0,a.useState)(``),[y,b]=(0,a.useState)(!1),[x,S]=(0,a.useState)(!1),C=(0,a.useRef)(!1),w=(0,a.useRef)(),T=(0,a.useMemo)(()=>p&&(d.find(e=>e.name===p)||c.find(e=>e.name===p))||null,[p,d,c]),E=(0,a.useMemo)(()=>T?.services||[],[T]),D=async()=>{S(!0);let e=sessionStorage.getItem(o),t=sessionStorage.getItem(s);if(e)try{let n=JSON.parse(e);if(Array.isArray(n)&&n.length>0)return u(n),f(n),m((n.find(e=>e.name===t)||n[0])?.name||null),S(!1),n}catch{console.warn(`⚠️ Cache corrotta, rigenerazione...`)}let n=await window.FormioHelper.getBookingConfig(),r={};n.forEach(e=>{(e.categories??[]).forEach(t=>{r[t]||(r[t]={name:t,services:[]}),r[t].services.push(e)})});let i=Object.fromEntries(Object.entries(r).sort(([e],[t])=>e.localeCompare(t,`it`,{sensitivity:`base`}))),a=Object.values(i).filter(e=>(e.name??``).trim()!==``);return u(a),f(a),m(a[0]?.name||null),sessionStorage.setItem(o,JSON.stringify(a)),sessionStorage.setItem(s,a[0]?.name||``),S(!1),a};(0,a.useEffect)(()=>{p&&sessionStorage.setItem(s,p)},[p]),(0,a.useEffect)(()=>{C.current||(C.current=!0,D())},[]);let O=e=>{let t=(e=``)=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),n=(e=``)=>e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/\s+/g,` `).trim(),r=(e=``)=>e.replace(/<[^>]*>/g,` `),i=(e,n)=>RegExp(`\\b${t(n)}`,`i`).test(e),a=(e,t)=>{let a=n(e.name),o=n((e.categories??[]).join(` `)),s=n(r(e.abstract??``));if(!t.every(e=>i(a,e)||i(o,e)||i(s,e)))return-1;let c=0;for(let e of t)i(a,e)?c+=3:i(o,e)?c+=2:i(s,e)&&(c+=1);return c},o=e.target.value;v(o);let s=n(o);if(!s){f(c),m(e=>e??c[0]?.name??null);return}let l=s.split(` `).filter(Boolean),u=c.map(e=>{let t=e.services.map(e=>({service:e,score:a(e,l)})).filter(e=>e.score>=0).sort((e,t)=>t.score-e.score).map(e=>e.service);return t.length?{...e,services:t}:null}).filter(Boolean);f(u),m(u.some(e=>e.name===p)?p:u[0]?.name??null)},k=e=>{g(e);let r=c.find(t=>t.services.some(t=>t.id===e.id));r&&m(r.name),n({id:e.id,link:e.link,name:e.name,show_howto_in_motivation:e.show_howto_in_motivation,categories:e.categories,offices:e.offices,abstract:e.abstract,view_type:e.view_type}),t.data.user_group=null,J()},A=e=>{m(e.name),g(null),v(``),f(c),n({})};return(0,a.useEffect)(()=>{b(!!document.querySelector(`.formio-read-only`))},[]),(0,a.useEffect)(()=>{let e=setTimeout(()=>{let e=t?.dataValue??t?.getValue();if(e?.id&&(g(e),c.length>0)){let t=c.find(t=>t.services.some(t=>t.id===e.id));t&&m(t.name)}},500);return()=>clearTimeout(e)},[t?.dataValue,t?.data,c]),(0,a.useEffect)(()=>{let e=window.FormioInstance;if(!e)return;let n=()=>{let n=e.submission?.data?.[t?.component?.key];if(n?.id&&(g(n),c.length>0)){let e=c.find(e=>e.services.some(e=>e.id===n.id));e&&m(e.name)}};return e.on(`change`,n),()=>e.off(`change`,n)},[c,t?.component?.key]),x?(0,r.jsx)(`div`,{className:`services-booking`,ref:w,children:(0,r.jsxs)(`div`,{children:[i.t(`Caricamento in corso`),`...`]})}):(0,r.jsx)(`div`,{className:`services-booking`,ref:w,children:c&&!y?(0,r.jsxs)(l.Container,{children:[(0,r.jsx)(l.Row,{className:`mb-3`,children:(0,r.jsx)(l.Col,{children:(0,r.jsx)(`h3`,{className:`h6 fw-bold text-uppercase mb-3`,children:i.t(`Seleziona il servizio per cui stai richiedendo un appuntamento`)})})}),(0,r.jsx)(l.Row,{className:`mb-3`,children:(0,r.jsx)(l.Col,{children:(0,r.jsx)(`div`,{className:`search-container`,children:(0,r.jsx)(l.Input,{id:`search`,label:i.t(`Cerca`),type:`text`,value:_,onChange:O,onInput:O,infoText:i.t(`Cerca per categoria, servizio o descrizione`)})})})}),(0,r.jsxs)(l.Row,{className:`mb-3`,children:[T?(0,r.jsx)(l.Col,{lg:3,md:4,className:`mb-4 mb-lg-0`,children:(0,r.jsxs)(`div`,{className:`categories-list`,children:[(0,r.jsx)(`h3`,{className:`h6 fw-bold text-uppercase mb-3`,children:i.t(`Categorie`)}),d.length>0&&d.map(e=>{let t=p===e.name;return(0,r.jsxs)(`button`,{onClick:()=>A(e),className:`category-item w-100 text-start p-3 mb-2 border-0 rounded ${t?`category-active bg-primary text-white`:`bg-light text-dark`}`,children:[(0,r.jsx)(`span`,{className:`fw-500 d-block`,children:e.name}),(0,r.jsxs)(`small`,{className:`d-block mt-1 ${t?`text-white`:`text-muted`}`,children:[e.services.length,` `,e.services.length>1?i.t(`servizi`):i.t(`servizio`)]})]},e.name)})]})}):null,(0,r.jsx)(l.Col,{lg:T?9:12,md:T?8:12,children:(0,r.jsxs)(`div`,{className:`services-container`,children:[E.length>0?(0,r.jsxs)(`div`,{className:`services-header mb-4`,children:[(0,r.jsx)(`h3`,{className:`h5 fw-bold text-primary mb-0`,children:T?.name}),(0,r.jsx)(`div`,{className:`border-bottom border-primary mt-3 mb-4`})]}):null,E.length>0?(0,r.jsx)(`div`,{className:`services-list`,children:E.map(e=>{let t=h?.id===e.id,n=ee.default.sanitize(e?.abstract);return(0,r.jsx)(`button`,{onClick:()=>k(e),className:`service-card mb-4 p-4 rounded border cursor-pointer transition text-start w-100 ${t?`border-primary border-2 bg-light`:`border-light border-1 bg-white`}`,style:{cursor:`pointer`},tabIndex:`0`,role:`button`,"aria-label":`${e.name}`,"aria-pressed":t,children:(0,r.jsx)(`div`,{className:`d-flex justify-content-between align-items-start`,children:(0,r.jsxs)(`div`,{className:`flex-grow-1`,children:[(0,r.jsx)(`h5`,{className:`h6 fw-bold mb-2 text-dark`,children:e.name}),e?.abstract&&(0,r.jsx)(`p`,{className:`text-muted small mb-0`,dangerouslySetInnerHTML:{__html:n}})]})})},e.id)})}):(0,r.jsx)(`div`,{className:`alert alert-info text-italic`,children:i.t(`Il servizio che stai cercando non è disponibile per la prenotazione appuntamento`)})]})})]})]}):y?(0,r.jsx)(`fieldset`,{className:`it-page-section`,children:(0,r.jsx)(`div`,{className:`cmp-card mt-2`,children:(0,r.jsxs)(`div`,{className:`card has-bkg-grey shadow-sm p-big`,children:[(0,r.jsx)(`div`,{className:`card-header border-0 p-0 mb-lg-30`,children:(0,r.jsx)(`div`,{className:`d-flex`,children:(0,r.jsx)(`h2`,{className:`title-xxlarge mb-1`,children:T?.name})})}),(0,r.jsx)(`div`,{className:`card p-3 p-lg-4 fieldset-body`,children:t?.dataValue?.id?(0,r.jsx)(`div`,{className:`services-list`,children:(0,r.jsx)(`div`,{className:`service-card p-4 rounded border transition border-light border-1 bg-white`,children:(0,r.jsx)(`div`,{className:`d-flex justify-content-between align-items-start`,children:(0,r.jsx)(`div`,{className:`flex-grow-1`,children:(0,r.jsx)(`p`,{className:`mb-2 text-dark text-paragraph`,children:t.dataValue.name})})})},t.dataValue.id)}):null})]})})}):null})},Bn=class e extends Rn{constructor(e,t,n){super(e,t,n)}static get builderInfo(){return{title:`Lista Servizi`,group:`basic`,icon:`bi bi-list`,documentation:``,weight:70,schema:e.schema()}}static schema(){return Rn.schema({type:`list-services`})}static editForm=Ln;attach(e,t){return super.attach(e).then(()=>{this.loadRefs(this.element,{[`react-${this.id}`]:`single`});let e=this.refs[`react-${this.id}`];return e?(this.rootComponent&&=(this.rootComponent.unmount(),null),this.rootComponent=(0,n.createRoot)(e),this.builderMode?(this.rootComponent.render((0,r.jsx)(`div`,{className:`my-1 border border-2 border-light rounded p-3 text-secondary`,children:(0,r.jsx)(`div`,{className:`h6 mb-0`,children:this.component?.label||`Lista Servizi`})})),this):(this.rootComponent.render((0,r.jsx)(zn,{ref:t,component:this.component,onChange:e=>this.setValue(e),...this,current:this})),this)):this})}detach(){return this.rootComponent&&=(this.rootComponent.unmount(),null),super.detach()}setValue(e){e&&(this.shouldSetValue=!0,this.updateValue(e))}getValue(){return this.dataValue}init(){super.init()}render(){return super.render(`<div ref="react-${this.id}"></div>`)}},Vn=t.Components.components.select,Hn=class extends Vn{attach(e){let t=super.attach(e);return(Array.isArray(this.refs.autocompleteInput)?this.refs.autocompleteInput:[this.refs.autocompleteInput]).forEach(e=>{e?.parentNode&&e.parentNode.removeChild(e)}),t}},Un={pagebreak:j,dynamic_calendar:We,calendar:Je,"calendar-advanced":lt,sdcfile:wn,address_map:Fn,"list-services":Bn,select:Hn};function Wn(e){if(!e||typeof e.addComponent!=`function`)throw Error(`registerFormioComponents requires Formio Components with addComponent(name, component)`);return Object.entries(Un).forEach(([t,n])=>{e.addComponent(t,n)}),Un}return e.Calendar=Je,e.CalendarAdvanced=lt,e.FormioAddressMap=Fn,e.FormioDynamicCalendar=We,e.FormioListServices=Bn,e.FormioPageBreak=j,e.SdcFile=wn,e.Select=Hn,e.formioCustomComponents=Un,e.registerFormioComponents=Wn,e})({},_formio_js,react_dom_client,react_jsx_runtime,_formio_react,react,react_day_picker,react_countdown,moment,design_react_kit,sweetalert2,dayjs,_event_calendar_core,react_dropzone,axios,mime,dompurify,jwt_decode,accessible_autocomplete_react,leaflet,lodash);
73
73
  //# sourceMappingURL=index.iife.js.map