@formio/js 5.0.0-rc.82 → 5.0.0-rc.84

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see formio.embed.min.js.LICENSE.txt */
2
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={56036:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class t{constructor(e,o={}){this.baseUrl=e||t.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.3",bootstrap4:"4.6.2",bootstrap5:"5.3.3",bootswatch:"5.3.3","bootstrap-icons":"1.11.1",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,t){let s=e;return o&&(s+=`/${o}`),e.match(/cdn\.(test-)?form.io/)&&t&&"latest"!==t&&(s+=`/${t}`),s}updateUrls(){for(const e in this.libs)if(e in this.overrides)if("string"==typeof this.overrides[e])this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]);else{const o=this.overrides[e];this[e]=this.buildUrl(o.cdn,o.lib||"",o.version||"")}else this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}t.defaultCDN="https://cdn.form.io",o.default=t},96517:function(e,o,t){Object.defineProperty(o,"__esModule",{value:!0}),o.Formio=o.embed=void 0;const s=t(95413);Object.defineProperty(o,"Formio",{enumerable:!0,get:function(){return s.Formio}}),o.embed=function(e={}){const o=document.getElementsByTagName("script");e=Object.assign({},window.FormioConfig||{},e);let t=null,i=o.length;const r=e.scriptName||"formio.embed.";for(;i--;)if(o[i].src&&-1!==o[i].src.indexOf(r)){t=o[i];break}if(t){const o={};t.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((e=>{o[e.split("=")[0]]=e.split("=")[1]&&decodeURIComponent(e.split("=")[1])}));let i=t.src.replace(/^([^?]+).*/,"$1").split("/");i.pop();let r="";["js","offline"].includes(i[i.length-1])?(i.pop(),i=r=i.join("/"),i+="/js"):i=i.join("/");const n="true"===o.debug||"1"===o.debug,a=n?"formio.form":"formio.form.min";s.Formio.config=Object.assign({script:o.script||`${i}/${a}.js`,style:o.styles||`${i}/${a}.css`,cdn:o.cdn||r,class:o.class||"formio-form-wrapper",src:o.src,form:null,submission:null,project:o.project,base:o.base||"https://api.form.io",submit:o.submit,includeLibs:"true"===o.libs||"1"===o.libs,noshadow:"false"===o.shadow||"0"===o.shadow,template:o.template||"bootstrap",debug:n,config:{},redirect:o.return||o.redirect,embedCSS:`${i}/formio.embed.css`,success:o.success||"Thank you for your submission!",before:null,after:null},e),s.Formio.config.alter&&s.Formio.config.alter(s.Formio.config);const c=s.Formio.config.form||s.Formio.config.src;if(c){s.Formio.debug("Embedding Configuration",e),s.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,s.Formio.debug("Creating form element");const o=s.Formio.createElement("div",{id:s.Formio.config.id,class:s.Formio.config.class});t.parentNode.insertBefore(o,t.parentNode.firstElementChild.nextSibling),s.Formio.createForm(o,c,s.Formio.config.config).then((e=>{s.Formio.config.submit&&(e.nosubmit=!0),e.on("submitDone",(o=>s.Formio.submitDone(e,o))),e.on("submit",(o=>{if(s.Formio.debug("on('submit')",o),s.Formio.config.submit){s.Formio.debug(`Sending submission to ${s.Formio.config.submit}`);const t={"content-type":"application/json"},i=s.Formio.FormioClass.getToken();i&&(t["x-jwt-token"]=i),s.Formio.FormioClass.fetch(s.Formio.config.submit,{body:JSON.stringify(o),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((o=>{s.Formio.submitDone(e,o)}))}}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}},95413:function(e,o,t){var s,i=this&&this.__awaiter||function(e,o,t,s){return new(t||(t=Promise))((function(i,r){function n(e){try{c(s.next(e))}catch(e){r(e)}}function a(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,a)}c((s=s.apply(e,o||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const n=r(t(56036));class a{static setLicense(e,o=!1){s.license=e,!o&&s.FormioClass&&s.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){s.baseUrl=e,!o&&s.FormioClass&&s.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){s.baseUrl=e,!o&&s.FormioClass&&s.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){s.projectUrl=e,!o&&s.FormioClass&&s.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){s.projectUrl=e,!o&&s.FormioClass&&s.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){s.pathType=e,!o&&s.FormioClass&&s.FormioClass.setPathType(e)}static debug(...e){s.config.debug&&console.log(...e)}static clearCache(){s.FormioClass&&s.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(s.debug(`Getting global ${e}`,t),t)}static use(e){s.FormioClass&&s.FormioClass.isRenderer?s.FormioClass.use(e):s.modules.push(e)}static createElement(e,o,t){const i=document.createElement(e);return o?(Object.keys(o).forEach((e=>{i.setAttribute(e,o[e])})),(t||[]).forEach((e=>{i.appendChild(s.createElement(e.tag,e.attrs,e.children))})),i):i}static addScript(e,o,t,r=""){return i(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>s.addScript(e,o))));if(t&&s.global(t,r))return s.debug(`${t} already loaded.`),Promise.resolve(s.global(t));s.debug("Adding Script",o);try{e.appendChild(s.createElement("script",{src:o}))}catch(e){return s.debug(e),Promise.resolve()}return t?new Promise((e=>{s.debug(`Waiting to load ${t}`);const o=setInterval((()=>{s.global(t,r)&&(clearInterval(o),s.debug(`${t} loaded.`),e(s.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return i(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>s.addStyles(e,o))):(s.debug("Adding Styles",o),e.appendChild(s.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return i(this,void 0,void 0,(function*(){s.debug("Submision Complete",o),s.config.submitDone&&s.config.submitDone(o,e);const t=(s.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let i=s.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(s.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",r=!!i.match(/\?/),n=0===i.indexOf(location.origin);i+=r?"&":"?",i+=`sub=${o._id}`,!n&&t&&(i+=`&form=${encodeURIComponent(t)}`),s.debug("Return URL",i),window.location.href=i,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||s.config.includeBuilder,s.fullAdded||o?(s.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return i(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++){const i=o.dependencies[t];yield s.addLibrary(e,s.config.libs[i],i)}if(o.css&&(yield s.addStyles(o.global?document.body:e,o.css)),o.js){const i=yield s.addScript(o.global?document.body:e,o.js,!!o.use&&t);if(o.use){s.debug(`Using ${t}`);const e=o.options||{};!e.license&&s.license&&(e.license=s.license),s.use("function"==typeof o.use?o.use(i):i,e)}}if(o.globalStyle){const e=s.createElement("style");e.type="text/css",e.innerHTML=o.globalStyle,document.body.appendChild(e)}}}))}static addLoader(e){return i(this,void 0,void 0,(function*(){e.appendChild(s.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},t=!1){return i(this,void 0,void 0,(function*(){s.cdn=new n.default(s.config.cdn,s.config.cdnUrls||{}),s.config.libs=s.config.libs||{uswds:{dependencies:["fontawesome"],js:`${s.cdn.uswds}/uswds.min.js`,css:`${s.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:"https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css",globalStyle:"@font-face {\n font-family: 'FontAwesome';\n src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?v=4.7.0');\n src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');\n font-weight: normal;\n font-style: normal;\n }"},bootstrap4:{dependencies:["fontawesome"],css:`${s.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${s.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:"https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.min.css",globalStyle:'@font-face {\n font-display: block;\n font-family: "bootstrap-icons";\n src: url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff2?dd67030699838ea613ee6dbda90effa6") format("woff2"),\n url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff?dd67030699838ea613ee6dbda90effa6") format("woff");\n }'}},["cerulean","cosmo","cyborg","darkly","flatly","journal","litera","lumen","lux","materia","minty","pulse","sandstone","simplex","sketchy","slate","solar","spacelab","superhero","united","yeti"].forEach((e=>{s.config.libs[e]={dependencies:["bootstrap-icons"],css:`${s.cdn.bootswatch}/dist/${e}/bootstrap.min.css`}}));const i=s.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=s.createElement("div",{id:`${i}-wrapper`});e.parentNode.insertBefore(r,e);const a=s.config.includeLibs&&!s.config.noshadow&&"function"==typeof r.attachShadow;a&&(r=r.attachShadow({mode:"open"}),o.shadowRoot=r),e.parentNode.removeChild(e),r.appendChild(e);const c=a?r:document.body;yield s.addStyles(c,s.config.embedCSS||`${s.cdn.js}/formio.embed.css`),s.addLoader(r);const l=s.config.full?"formio.full":"formio.form",d=s.config.debug?l:`${l}.min`;if(s.FormioClass=yield s.addScript(c,s.formioScript(s.config.script||`${s.cdn.js}/${d}.js`,t),"Formio",t?"isBuilder":"isRenderer"),s.FormioClass.cdn=s.cdn,s.FormioClass.setBaseUrl(o.baseUrl||s.baseUrl||s.config.base),s.FormioClass.setProjectUrl(o.projectUrl||s.projectUrl||s.config.project),s.FormioClass.language=s.language,s.setLicense(s.license||s.config.license||!1),s.modules.forEach((e=>{s.FormioClass.use(e)})),s.icons&&(s.FormioClass.icons=s.icons),s.pathType&&s.FormioClass.setPathType(s.pathType),s.config.template&&s.config.includeLibs&&(yield s.addLibrary(c,s.config.libs[s.config.template],s.config.template)),s.config.libraries||(s.config.libraries=s.config.modules||{}),s.config.premium&&(s.config.libraries.premium=s.config.premium),s.config.libraries)for(const e in s.config.libraries){const o=s.config.libraries[e];o.use=o.use||!0,yield s.addLibrary(c,o,e)}return yield s.addStyles(c,s.formioScript(s.config.style||`${s.cdn.js}/${d}.css`,t)),s.config.before&&(yield s.config.before(s.FormioClass,e,s.config)),s.FormioClass.license=!0,s._formioReady(s.FormioClass),r}))}static afterCreate(e,o,t){return i(this,void 0,void 0,(function*(){const i=o.querySelector(".formio-loader");return i&&o.removeChild(i),s.FormioClass.events.emit(t,e),s.config.after&&(s.debug("Calling ready callback"),s.config.after(e,s.config)),e}))}static createForm(e,o,t={}){return i(this,void 0,void 0,(function*(){if(s.FormioClass)return s.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const i=yield s.init(e,t);return s.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(s.config.submission&&(s.debug("Setting submission",s.config.submission),e.submission=s.config.submission),s.afterCreate(e,i,"formEmbedded"),e)))}))}static builder(e,o,t={}){var r;return i(this,void 0,void 0,(function*(){if(null===(r=s.FormioClass)||void 0===r?void 0:r.builder)return s.FormioClass.builder(e,o,t);const i=yield s.init(e,t,!0);return s.FormioClass.builder(e,o,t).then((e=>(s.afterCreate(e,i,"builderEmbedded"),e)))}))}}o.Formio=a,s=a,a.FormioClass=null,a.config={},a.modules=[],a.icons="",a.license="",a.formioReady=new Promise(((e,o)=>{s._formioReady=e,s._formioReadyReject=o})),a.version="5.0.0-rc.82",a.Report={create:(e,o,t={})=>i(void 0,void 0,void 0,(function*(){var i;if(null===(i=s.FormioClass)||void 0===i?void 0:i.Report)return s.FormioClass.Report.create(e,o,t);const r=yield s.init(e,t,!0);return s.FormioClass.Report.create(e,o,t).then((e=>(s.afterCreate(e,r,"reportEmbedded"),e)))}))},n.default.defaultCDN=a.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class c{constructor(e,o,t){this.form=o,this.element=e,this.options=t||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return a.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=c;class l extends c{create(){return a.builder(this.element,this.form,this.options)}}o.FormBuilder=l,a.Form=c,a.FormBuilder=l}},o={};var t={};return(0,function t(s){var i=o[s];if(void 0!==i)return i.exports;var r=o[s]={exports:{}};return e[s].call(r.exports,r,r.exports,t),r.exports}(96517).embed)(),t.Formio}()}));
2
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={56036:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class t{constructor(e,o={}){this.baseUrl=e||t.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.3",bootstrap4:"4.6.2",bootstrap5:"5.3.3",bootswatch:"5.3.3","bootstrap-icons":"1.11.1",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,t){let s=e;return o&&(s+=`/${o}`),e.match(/cdn\.(test-)?form.io/)&&t&&"latest"!==t&&(s+=`/${t}`),s}updateUrls(){for(const e in this.libs)if(e in this.overrides)if("string"==typeof this.overrides[e])this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]);else{const o=this.overrides[e];this[e]=this.buildUrl(o.cdn,o.lib||"",o.version||"")}else this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}t.defaultCDN="https://cdn.form.io",o.default=t},96517:function(e,o,t){Object.defineProperty(o,"__esModule",{value:!0}),o.Formio=o.embed=void 0;const s=t(95413);Object.defineProperty(o,"Formio",{enumerable:!0,get:function(){return s.Formio}}),o.embed=function(e={}){const o=document.getElementsByTagName("script");e=Object.assign({},window.FormioConfig||{},e);let t=null,i=o.length;const r=e.scriptName||"formio.embed.";for(;i--;)if(o[i].src&&-1!==o[i].src.indexOf(r)){t=o[i];break}if(t){const o={};t.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((e=>{o[e.split("=")[0]]=e.split("=")[1]&&decodeURIComponent(e.split("=")[1])}));let i=t.src.replace(/^([^?]+).*/,"$1").split("/");i.pop();let r="";["js","offline"].includes(i[i.length-1])?(i.pop(),i=r=i.join("/"),i+="/js"):i=i.join("/");const n="true"===o.debug||"1"===o.debug,a=n?"formio.form":"formio.form.min";s.Formio.config=Object.assign({script:o.script||`${i}/${a}.js`,style:o.styles||`${i}/${a}.css`,cdn:o.cdn||r,class:o.class||"formio-form-wrapper",src:o.src,form:null,submission:null,project:o.project,base:o.base||"https://api.form.io",submit:o.submit,includeLibs:"true"===o.libs||"1"===o.libs,noshadow:"false"===o.shadow||"0"===o.shadow,template:o.template||"bootstrap",debug:n,config:{},redirect:o.return||o.redirect,embedCSS:`${i}/formio.embed.css`,success:o.success||"Thank you for your submission!",before:null,after:null},e),s.Formio.config.alter&&s.Formio.config.alter(s.Formio.config);const c=s.Formio.config.form||s.Formio.config.src;if(c){s.Formio.debug("Embedding Configuration",e),s.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,s.Formio.debug("Creating form element");const o=s.Formio.createElement("div",{id:s.Formio.config.id,class:s.Formio.config.class});t.parentNode.insertBefore(o,t.parentNode.firstElementChild.nextSibling),s.Formio.createForm(o,c,s.Formio.config.config).then((e=>{s.Formio.config.submit&&(e.nosubmit=!0),e.on("submitDone",(o=>s.Formio.submitDone(e,o))),e.on("submit",(o=>{if(s.Formio.debug("on('submit')",o),s.Formio.config.submit){s.Formio.debug(`Sending submission to ${s.Formio.config.submit}`);const t={"content-type":"application/json"},i=s.Formio.FormioClass.getToken();i&&(t["x-jwt-token"]=i),s.Formio.FormioClass.fetch(s.Formio.config.submit,{body:JSON.stringify(o),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((o=>{s.Formio.submitDone(e,o)}))}}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}},95413:function(e,o,t){var s,i=this&&this.__awaiter||function(e,o,t,s){return new(t||(t=Promise))((function(i,r){function n(e){try{c(s.next(e))}catch(e){r(e)}}function a(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,a)}c((s=s.apply(e,o||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const n=r(t(56036));class a{static setLicense(e,o=!1){s.license=e,!o&&s.FormioClass&&s.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){s.baseUrl=e,!o&&s.FormioClass&&s.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){s.baseUrl=e,!o&&s.FormioClass&&s.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){s.projectUrl=e,!o&&s.FormioClass&&s.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){s.projectUrl=e,!o&&s.FormioClass&&s.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){s.pathType=e,!o&&s.FormioClass&&s.FormioClass.setPathType(e)}static debug(...e){s.config.debug&&console.log(...e)}static clearCache(){s.FormioClass&&s.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(s.debug(`Getting global ${e}`,t),t)}static use(e){s.FormioClass&&s.FormioClass.isRenderer?s.FormioClass.use(e):s.modules.push(e)}static createElement(e,o,t){const i=document.createElement(e);return o?(Object.keys(o).forEach((e=>{i.setAttribute(e,o[e])})),(t||[]).forEach((e=>{i.appendChild(s.createElement(e.tag,e.attrs,e.children))})),i):i}static addScript(e,o,t,r=""){return i(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>s.addScript(e,o))));if(t&&s.global(t,r))return s.debug(`${t} already loaded.`),Promise.resolve(s.global(t));s.debug("Adding Script",o);try{e.appendChild(s.createElement("script",{src:o}))}catch(e){return s.debug(e),Promise.resolve()}return t?new Promise((e=>{s.debug(`Waiting to load ${t}`);const o=setInterval((()=>{s.global(t,r)&&(clearInterval(o),s.debug(`${t} loaded.`),e(s.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return i(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>s.addStyles(e,o))):(s.debug("Adding Styles",o),e.appendChild(s.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return i(this,void 0,void 0,(function*(){s.debug("Submision Complete",o),s.config.submitDone&&s.config.submitDone(o,e);const t=(s.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let i=s.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(s.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",r=!!i.match(/\?/),n=0===i.indexOf(location.origin);i+=r?"&":"?",i+=`sub=${o._id}`,!n&&t&&(i+=`&form=${encodeURIComponent(t)}`),s.debug("Return URL",i),window.location.href=i,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||s.config.includeBuilder,s.fullAdded||o?(s.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return i(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++){const i=o.dependencies[t];yield s.addLibrary(e,s.config.libs[i],i)}if(o.css&&(yield s.addStyles(o.global?document.body:e,o.css)),o.js){const i=yield s.addScript(o.global?document.body:e,o.js,!!o.use&&t);if(o.use){s.debug(`Using ${t}`);const e=o.options||{};!e.license&&s.license&&(e.license=s.license),s.use("function"==typeof o.use?o.use(i):i,e)}}if(o.globalStyle){const e=s.createElement("style");e.type="text/css",e.innerHTML=o.globalStyle,document.body.appendChild(e)}}}))}static addLoader(e){return i(this,void 0,void 0,(function*(){e.appendChild(s.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},t=!1){return i(this,void 0,void 0,(function*(){s.cdn=new n.default(s.config.cdn,s.config.cdnUrls||{}),s.config.libs=s.config.libs||{uswds:{dependencies:["fontawesome"],js:`${s.cdn.uswds}/uswds.min.js`,css:`${s.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:"https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css",globalStyle:"@font-face {\n font-family: 'FontAwesome';\n src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?v=4.7.0');\n src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');\n font-weight: normal;\n font-style: normal;\n }"},bootstrap4:{dependencies:["fontawesome"],css:`${s.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${s.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:"https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.min.css",globalStyle:'@font-face {\n font-display: block;\n font-family: "bootstrap-icons";\n src: url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff2?dd67030699838ea613ee6dbda90effa6") format("woff2"),\n url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff?dd67030699838ea613ee6dbda90effa6") format("woff");\n }'}},["cerulean","cosmo","cyborg","darkly","flatly","journal","litera","lumen","lux","materia","minty","pulse","sandstone","simplex","sketchy","slate","solar","spacelab","superhero","united","yeti"].forEach((e=>{s.config.libs[e]={dependencies:["bootstrap-icons"],css:`${s.cdn.bootswatch}/dist/${e}/bootstrap.min.css`}}));const i=s.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=s.createElement("div",{id:`${i}-wrapper`});e.parentNode.insertBefore(r,e);const a=s.config.includeLibs&&!s.config.noshadow&&"function"==typeof r.attachShadow;a&&(r=r.attachShadow({mode:"open"}),o.shadowRoot=r),e.parentNode.removeChild(e),r.appendChild(e);const c=a?r:document.body;yield s.addStyles(c,s.config.embedCSS||`${s.cdn.js}/formio.embed.css`),s.addLoader(r);const l=s.config.full?"formio.full":"formio.form",d=s.config.debug?l:`${l}.min`;if(s.FormioClass=yield s.addScript(c,s.formioScript(s.config.script||`${s.cdn.js}/${d}.js`,t),"Formio",t?"isBuilder":"isRenderer"),s.FormioClass.cdn=s.cdn,s.FormioClass.setBaseUrl(o.baseUrl||s.baseUrl||s.config.base),s.FormioClass.setProjectUrl(o.projectUrl||s.projectUrl||s.config.project),s.FormioClass.language=s.language,s.setLicense(s.license||s.config.license||!1),s.modules.forEach((e=>{s.FormioClass.use(e)})),s.icons&&(s.FormioClass.icons=s.icons),s.pathType&&s.FormioClass.setPathType(s.pathType),s.config.template&&s.config.includeLibs&&(yield s.addLibrary(c,s.config.libs[s.config.template],s.config.template)),s.config.libraries||(s.config.libraries=s.config.modules||{}),s.config.premium&&(s.config.libraries.premium=s.config.premium),s.config.libraries)for(const e in s.config.libraries){const o=s.config.libraries[e];o.use=o.use||!0,yield s.addLibrary(c,o,e)}return yield s.addStyles(c,s.formioScript(s.config.style||`${s.cdn.js}/${d}.css`,t)),s.config.before&&(yield s.config.before(s.FormioClass,e,s.config)),s.FormioClass.license=!0,s._formioReady(s.FormioClass),r}))}static afterCreate(e,o,t){return i(this,void 0,void 0,(function*(){const i=o.querySelector(".formio-loader");return i&&o.removeChild(i),s.FormioClass.events.emit(t,e),s.config.after&&(s.debug("Calling ready callback"),s.config.after(e,s.config)),e}))}static createForm(e,o,t={}){return i(this,void 0,void 0,(function*(){if(s.FormioClass)return s.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const i=yield s.init(e,t);return s.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(s.config.submission&&(s.debug("Setting submission",s.config.submission),e.submission=s.config.submission),s.afterCreate(e,i,"formEmbedded"),e)))}))}static builder(e,o,t={}){var r;return i(this,void 0,void 0,(function*(){if(null===(r=s.FormioClass)||void 0===r?void 0:r.builder)return s.FormioClass.builder(e,o,t);const i=yield s.init(e,t,!0);return s.FormioClass.builder(e,o,t).then((e=>(s.afterCreate(e,i,"builderEmbedded"),e)))}))}}o.Formio=a,s=a,a.FormioClass=null,a.config={},a.modules=[],a.icons="",a.license="",a.formioReady=new Promise(((e,o)=>{s._formioReady=e,s._formioReadyReject=o})),a.version="5.0.0-rc.84",a.Report={create:(e,o,t={})=>i(void 0,void 0,void 0,(function*(){var i;if(null===(i=s.FormioClass)||void 0===i?void 0:i.Report)return s.FormioClass.Report.create(e,o,t);const r=yield s.init(e,t,!0);return s.FormioClass.Report.create(e,o,t).then((e=>(s.afterCreate(e,r,"reportEmbedded"),e)))}))},n.default.defaultCDN=a.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class c{constructor(e,o,t){this.form=o,this.element=e,this.options=t||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return a.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=c;class l extends c{create(){return a.builder(this.element,this.form,this.options)}}o.FormBuilder=l,a.Form=c,a.FormBuilder=l}},o={};var t={};return(0,function t(s){var i=o[s];if(void 0!==i)return i.exports;var r=o[s]={exports:{}};return e[s].call(r.exports,r,r.exports,t),r.exports}(96517).embed)(),t.Formio}()}));
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see formio.embed.min.js.LICENSE.txt */
2
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={56036:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class t{constructor(e,o={}){this.baseUrl=e||t.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.3",bootstrap4:"4.6.2",bootstrap5:"5.3.3",bootswatch:"5.3.3","bootstrap-icons":"1.11.1",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,t){let s=e;return o&&(s+=`/${o}`),e.match(/cdn\.(test-)?form.io/)&&t&&"latest"!==t&&(s+=`/${t}`),s}updateUrls(){for(const e in this.libs)if(e in this.overrides)if("string"==typeof this.overrides[e])this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]);else{const o=this.overrides[e];this[e]=this.buildUrl(o.cdn,o.lib||"",o.version||"")}else this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}t.defaultCDN="https://cdn.form.io",o.default=t},96517:function(e,o,t){Object.defineProperty(o,"__esModule",{value:!0}),o.Formio=o.embed=void 0;const s=t(95413);Object.defineProperty(o,"Formio",{enumerable:!0,get:function(){return s.Formio}}),o.embed=function(e={}){const o=document.getElementsByTagName("script");e=Object.assign({},window.FormioConfig||{},e);let t=null,i=o.length;const r=e.scriptName||"formio.embed.";for(;i--;)if(o[i].src&&-1!==o[i].src.indexOf(r)){t=o[i];break}if(t){const o={};t.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((e=>{o[e.split("=")[0]]=e.split("=")[1]&&decodeURIComponent(e.split("=")[1])}));let i=t.src.replace(/^([^?]+).*/,"$1").split("/");i.pop();let r="";["js","offline"].includes(i[i.length-1])?(i.pop(),i=r=i.join("/"),i+="/js"):i=i.join("/");const n="true"===o.debug||"1"===o.debug,a=n?"formio.form":"formio.form.min";s.Formio.config=Object.assign({script:o.script||`${i}/${a}.js`,style:o.styles||`${i}/${a}.css`,cdn:o.cdn||r,class:o.class||"formio-form-wrapper",src:o.src,form:null,submission:null,project:o.project,base:o.base||"https://api.form.io",submit:o.submit,includeLibs:"true"===o.libs||"1"===o.libs,noshadow:"false"===o.shadow||"0"===o.shadow,template:o.template||"bootstrap",debug:n,config:{},redirect:o.return||o.redirect,embedCSS:`${i}/formio.embed.css`,success:o.success||"Thank you for your submission!",before:null,after:null},e),s.Formio.config.alter&&s.Formio.config.alter(s.Formio.config);const c=s.Formio.config.form||s.Formio.config.src;if(c){s.Formio.debug("Embedding Configuration",e),s.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,s.Formio.debug("Creating form element");const o=s.Formio.createElement("div",{id:s.Formio.config.id,class:s.Formio.config.class});t.parentNode.insertBefore(o,t.parentNode.firstElementChild.nextSibling),s.Formio.createForm(o,c,s.Formio.config.config).then((e=>{s.Formio.config.submit&&(e.nosubmit=!0),e.on("submitDone",(o=>s.Formio.submitDone(e,o))),e.on("submit",(o=>{if(s.Formio.debug("on('submit')",o),s.Formio.config.submit){s.Formio.debug(`Sending submission to ${s.Formio.config.submit}`);const t={"content-type":"application/json"},i=s.Formio.FormioClass.getToken();i&&(t["x-jwt-token"]=i),s.Formio.FormioClass.fetch(s.Formio.config.submit,{body:JSON.stringify(o),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((o=>{s.Formio.submitDone(e,o)}))}}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}},95413:function(e,o,t){var s,i=this&&this.__awaiter||function(e,o,t,s){return new(t||(t=Promise))((function(i,r){function n(e){try{c(s.next(e))}catch(e){r(e)}}function a(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,a)}c((s=s.apply(e,o||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const n=r(t(56036));class a{static setLicense(e,o=!1){s.license=e,!o&&s.FormioClass&&s.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){s.baseUrl=e,!o&&s.FormioClass&&s.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){s.baseUrl=e,!o&&s.FormioClass&&s.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){s.projectUrl=e,!o&&s.FormioClass&&s.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){s.projectUrl=e,!o&&s.FormioClass&&s.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){s.pathType=e,!o&&s.FormioClass&&s.FormioClass.setPathType(e)}static debug(...e){s.config.debug&&console.log(...e)}static clearCache(){s.FormioClass&&s.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(s.debug(`Getting global ${e}`,t),t)}static use(e){s.FormioClass&&s.FormioClass.isRenderer?s.FormioClass.use(e):s.modules.push(e)}static createElement(e,o,t){const i=document.createElement(e);return o?(Object.keys(o).forEach((e=>{i.setAttribute(e,o[e])})),(t||[]).forEach((e=>{i.appendChild(s.createElement(e.tag,e.attrs,e.children))})),i):i}static addScript(e,o,t,r=""){return i(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>s.addScript(e,o))));if(t&&s.global(t,r))return s.debug(`${t} already loaded.`),Promise.resolve(s.global(t));s.debug("Adding Script",o);try{e.appendChild(s.createElement("script",{src:o}))}catch(e){return s.debug(e),Promise.resolve()}return t?new Promise((e=>{s.debug(`Waiting to load ${t}`);const o=setInterval((()=>{s.global(t,r)&&(clearInterval(o),s.debug(`${t} loaded.`),e(s.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return i(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>s.addStyles(e,o))):(s.debug("Adding Styles",o),e.appendChild(s.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return i(this,void 0,void 0,(function*(){s.debug("Submision Complete",o),s.config.submitDone&&s.config.submitDone(o,e);const t=(s.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let i=s.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(s.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",r=!!i.match(/\?/),n=0===i.indexOf(location.origin);i+=r?"&":"?",i+=`sub=${o._id}`,!n&&t&&(i+=`&form=${encodeURIComponent(t)}`),s.debug("Return URL",i),window.location.href=i,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||s.config.includeBuilder,s.fullAdded||o?(s.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return i(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++){const i=o.dependencies[t];yield s.addLibrary(e,s.config.libs[i],i)}if(o.css&&(yield s.addStyles(o.global?document.body:e,o.css)),o.js){const i=yield s.addScript(o.global?document.body:e,o.js,!!o.use&&t);if(o.use){s.debug(`Using ${t}`);const e=o.options||{};!e.license&&s.license&&(e.license=s.license),s.use("function"==typeof o.use?o.use(i):i,e)}}if(o.globalStyle){const e=s.createElement("style");e.type="text/css",e.innerHTML=o.globalStyle,document.body.appendChild(e)}}}))}static addLoader(e){return i(this,void 0,void 0,(function*(){e.appendChild(s.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},t=!1){return i(this,void 0,void 0,(function*(){s.cdn=new n.default(s.config.cdn,s.config.cdnUrls||{}),s.config.libs=s.config.libs||{uswds:{dependencies:["fontawesome"],js:`${s.cdn.uswds}/uswds.min.js`,css:`${s.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:"https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css",globalStyle:"@font-face {\n font-family: 'FontAwesome';\n src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?v=4.7.0');\n src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');\n font-weight: normal;\n font-style: normal;\n }"},bootstrap4:{dependencies:["fontawesome"],css:`${s.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${s.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:"https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.min.css",globalStyle:'@font-face {\n font-display: block;\n font-family: "bootstrap-icons";\n src: url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff2?dd67030699838ea613ee6dbda90effa6") format("woff2"),\n url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff?dd67030699838ea613ee6dbda90effa6") format("woff");\n }'}},["cerulean","cosmo","cyborg","darkly","flatly","journal","litera","lumen","lux","materia","minty","pulse","sandstone","simplex","sketchy","slate","solar","spacelab","superhero","united","yeti"].forEach((e=>{s.config.libs[e]={dependencies:["bootstrap-icons"],css:`${s.cdn.bootswatch}/dist/${e}/bootstrap.min.css`}}));const i=s.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=s.createElement("div",{id:`${i}-wrapper`});e.parentNode.insertBefore(r,e);const a=s.config.includeLibs&&!s.config.noshadow&&"function"==typeof r.attachShadow;a&&(r=r.attachShadow({mode:"open"}),o.shadowRoot=r),e.parentNode.removeChild(e),r.appendChild(e);const c=a?r:document.body;yield s.addStyles(c,s.config.embedCSS||`${s.cdn.js}/formio.embed.css`),s.addLoader(r);const l=s.config.full?"formio.full":"formio.form",d=s.config.debug?l:`${l}.min`;if(s.FormioClass=yield s.addScript(c,s.formioScript(s.config.script||`${s.cdn.js}/${d}.js`,t),"Formio",t?"isBuilder":"isRenderer"),s.FormioClass.cdn=s.cdn,s.FormioClass.setBaseUrl(o.baseUrl||s.baseUrl||s.config.base),s.FormioClass.setProjectUrl(o.projectUrl||s.projectUrl||s.config.project),s.FormioClass.language=s.language,s.setLicense(s.license||s.config.license||!1),s.modules.forEach((e=>{s.FormioClass.use(e)})),s.icons&&(s.FormioClass.icons=s.icons),s.pathType&&s.FormioClass.setPathType(s.pathType),s.config.template&&s.config.includeLibs&&(yield s.addLibrary(c,s.config.libs[s.config.template],s.config.template)),s.config.libraries||(s.config.libraries=s.config.modules||{}),s.config.premium&&(s.config.libraries.premium=s.config.premium),s.config.libraries)for(const e in s.config.libraries){const o=s.config.libraries[e];o.use=o.use||!0,yield s.addLibrary(c,o,e)}return yield s.addStyles(c,s.formioScript(s.config.style||`${s.cdn.js}/${d}.css`,t)),s.config.before&&(yield s.config.before(s.FormioClass,e,s.config)),s.FormioClass.license=!0,s._formioReady(s.FormioClass),r}))}static afterCreate(e,o,t){return i(this,void 0,void 0,(function*(){const i=o.querySelector(".formio-loader");return i&&o.removeChild(i),s.FormioClass.events.emit(t,e),s.config.after&&(s.debug("Calling ready callback"),s.config.after(e,s.config)),e}))}static createForm(e,o,t={}){return i(this,void 0,void 0,(function*(){if(s.FormioClass)return s.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const i=yield s.init(e,t);return s.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(s.config.submission&&(s.debug("Setting submission",s.config.submission),e.submission=s.config.submission),s.afterCreate(e,i,"formEmbedded"),e)))}))}static builder(e,o,t={}){var r;return i(this,void 0,void 0,(function*(){if(null===(r=s.FormioClass)||void 0===r?void 0:r.builder)return s.FormioClass.builder(e,o,t);const i=yield s.init(e,t,!0);return s.FormioClass.builder(e,o,t).then((e=>(s.afterCreate(e,i,"builderEmbedded"),e)))}))}}o.Formio=a,s=a,a.FormioClass=null,a.config={},a.modules=[],a.icons="",a.license="",a.formioReady=new Promise(((e,o)=>{s._formioReady=e,s._formioReadyReject=o})),a.version="5.0.0-rc.82",a.Report={create:(e,o,t={})=>i(void 0,void 0,void 0,(function*(){var i;if(null===(i=s.FormioClass)||void 0===i?void 0:i.Report)return s.FormioClass.Report.create(e,o,t);const r=yield s.init(e,t,!0);return s.FormioClass.Report.create(e,o,t).then((e=>(s.afterCreate(e,r,"reportEmbedded"),e)))}))},n.default.defaultCDN=a.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class c{constructor(e,o,t){this.form=o,this.element=e,this.options=t||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return a.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=c;class l extends c{create(){return a.builder(this.element,this.form,this.options)}}o.FormBuilder=l,a.Form=c,a.FormBuilder=l}},o={};var t={};return(0,function t(s){var i=o[s];if(void 0!==i)return i.exports;var r=o[s]={exports:{}};return e[s].call(r.exports,r,r.exports,t),r.exports}(96517).embed)(),t.Formio}()}));
2
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={56036:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class t{constructor(e,o={}){this.baseUrl=e||t.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.3",bootstrap4:"4.6.2",bootstrap5:"5.3.3",bootswatch:"5.3.3","bootstrap-icons":"1.11.1",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,t){let s=e;return o&&(s+=`/${o}`),e.match(/cdn\.(test-)?form.io/)&&t&&"latest"!==t&&(s+=`/${t}`),s}updateUrls(){for(const e in this.libs)if(e in this.overrides)if("string"==typeof this.overrides[e])this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]);else{const o=this.overrides[e];this[e]=this.buildUrl(o.cdn,o.lib||"",o.version||"")}else this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}t.defaultCDN="https://cdn.form.io",o.default=t},96517:function(e,o,t){Object.defineProperty(o,"__esModule",{value:!0}),o.Formio=o.embed=void 0;const s=t(95413);Object.defineProperty(o,"Formio",{enumerable:!0,get:function(){return s.Formio}}),o.embed=function(e={}){const o=document.getElementsByTagName("script");e=Object.assign({},window.FormioConfig||{},e);let t=null,i=o.length;const r=e.scriptName||"formio.embed.";for(;i--;)if(o[i].src&&-1!==o[i].src.indexOf(r)){t=o[i];break}if(t){const o={};t.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((e=>{o[e.split("=")[0]]=e.split("=")[1]&&decodeURIComponent(e.split("=")[1])}));let i=t.src.replace(/^([^?]+).*/,"$1").split("/");i.pop();let r="";["js","offline"].includes(i[i.length-1])?(i.pop(),i=r=i.join("/"),i+="/js"):i=i.join("/");const n="true"===o.debug||"1"===o.debug,a=n?"formio.form":"formio.form.min";s.Formio.config=Object.assign({script:o.script||`${i}/${a}.js`,style:o.styles||`${i}/${a}.css`,cdn:o.cdn||r,class:o.class||"formio-form-wrapper",src:o.src,form:null,submission:null,project:o.project,base:o.base||"https://api.form.io",submit:o.submit,includeLibs:"true"===o.libs||"1"===o.libs,noshadow:"false"===o.shadow||"0"===o.shadow,template:o.template||"bootstrap",debug:n,config:{},redirect:o.return||o.redirect,embedCSS:`${i}/formio.embed.css`,success:o.success||"Thank you for your submission!",before:null,after:null},e),s.Formio.config.alter&&s.Formio.config.alter(s.Formio.config);const c=s.Formio.config.form||s.Formio.config.src;if(c){s.Formio.debug("Embedding Configuration",e),s.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,s.Formio.debug("Creating form element");const o=s.Formio.createElement("div",{id:s.Formio.config.id,class:s.Formio.config.class});t.parentNode.insertBefore(o,t.parentNode.firstElementChild.nextSibling),s.Formio.createForm(o,c,s.Formio.config.config).then((e=>{s.Formio.config.submit&&(e.nosubmit=!0),e.on("submitDone",(o=>s.Formio.submitDone(e,o))),e.on("submit",(o=>{if(s.Formio.debug("on('submit')",o),s.Formio.config.submit){s.Formio.debug(`Sending submission to ${s.Formio.config.submit}`);const t={"content-type":"application/json"},i=s.Formio.FormioClass.getToken();i&&(t["x-jwt-token"]=i),s.Formio.FormioClass.fetch(s.Formio.config.submit,{body:JSON.stringify(o),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((o=>{s.Formio.submitDone(e,o)}))}}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}},95413:function(e,o,t){var s,i=this&&this.__awaiter||function(e,o,t,s){return new(t||(t=Promise))((function(i,r){function n(e){try{c(s.next(e))}catch(e){r(e)}}function a(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var o;e.done?i(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,a)}c((s=s.apply(e,o||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const n=r(t(56036));class a{static setLicense(e,o=!1){s.license=e,!o&&s.FormioClass&&s.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){s.baseUrl=e,!o&&s.FormioClass&&s.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){s.baseUrl=e,!o&&s.FormioClass&&s.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){s.projectUrl=e,!o&&s.FormioClass&&s.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){s.projectUrl=e,!o&&s.FormioClass&&s.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){s.pathType=e,!o&&s.FormioClass&&s.FormioClass.setPathType(e)}static debug(...e){s.config.debug&&console.log(...e)}static clearCache(){s.FormioClass&&s.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(s.debug(`Getting global ${e}`,t),t)}static use(e){s.FormioClass&&s.FormioClass.isRenderer?s.FormioClass.use(e):s.modules.push(e)}static createElement(e,o,t){const i=document.createElement(e);return o?(Object.keys(o).forEach((e=>{i.setAttribute(e,o[e])})),(t||[]).forEach((e=>{i.appendChild(s.createElement(e.tag,e.attrs,e.children))})),i):i}static addScript(e,o,t,r=""){return i(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>s.addScript(e,o))));if(t&&s.global(t,r))return s.debug(`${t} already loaded.`),Promise.resolve(s.global(t));s.debug("Adding Script",o);try{e.appendChild(s.createElement("script",{src:o}))}catch(e){return s.debug(e),Promise.resolve()}return t?new Promise((e=>{s.debug(`Waiting to load ${t}`);const o=setInterval((()=>{s.global(t,r)&&(clearInterval(o),s.debug(`${t} loaded.`),e(s.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return i(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>s.addStyles(e,o))):(s.debug("Adding Styles",o),e.appendChild(s.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return i(this,void 0,void 0,(function*(){s.debug("Submision Complete",o),s.config.submitDone&&s.config.submitDone(o,e);const t=(s.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let i=s.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(s.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",r=!!i.match(/\?/),n=0===i.indexOf(location.origin);i+=r?"&":"?",i+=`sub=${o._id}`,!n&&t&&(i+=`&form=${encodeURIComponent(t)}`),s.debug("Return URL",i),window.location.href=i,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||s.config.includeBuilder,s.fullAdded||o?(s.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return i(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++){const i=o.dependencies[t];yield s.addLibrary(e,s.config.libs[i],i)}if(o.css&&(yield s.addStyles(o.global?document.body:e,o.css)),o.js){const i=yield s.addScript(o.global?document.body:e,o.js,!!o.use&&t);if(o.use){s.debug(`Using ${t}`);const e=o.options||{};!e.license&&s.license&&(e.license=s.license),s.use("function"==typeof o.use?o.use(i):i,e)}}if(o.globalStyle){const e=s.createElement("style");e.type="text/css",e.innerHTML=o.globalStyle,document.body.appendChild(e)}}}))}static addLoader(e){return i(this,void 0,void 0,(function*(){e.appendChild(s.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},t=!1){return i(this,void 0,void 0,(function*(){s.cdn=new n.default(s.config.cdn,s.config.cdnUrls||{}),s.config.libs=s.config.libs||{uswds:{dependencies:["fontawesome"],js:`${s.cdn.uswds}/uswds.min.js`,css:`${s.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:"https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css",globalStyle:"@font-face {\n font-family: 'FontAwesome';\n src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?v=4.7.0');\n src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');\n font-weight: normal;\n font-style: normal;\n }"},bootstrap4:{dependencies:["fontawesome"],css:`${s.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${s.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:"https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.min.css",globalStyle:'@font-face {\n font-display: block;\n font-family: "bootstrap-icons";\n src: url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff2?dd67030699838ea613ee6dbda90effa6") format("woff2"),\n url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff?dd67030699838ea613ee6dbda90effa6") format("woff");\n }'}},["cerulean","cosmo","cyborg","darkly","flatly","journal","litera","lumen","lux","materia","minty","pulse","sandstone","simplex","sketchy","slate","solar","spacelab","superhero","united","yeti"].forEach((e=>{s.config.libs[e]={dependencies:["bootstrap-icons"],css:`${s.cdn.bootswatch}/dist/${e}/bootstrap.min.css`}}));const i=s.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=s.createElement("div",{id:`${i}-wrapper`});e.parentNode.insertBefore(r,e);const a=s.config.includeLibs&&!s.config.noshadow&&"function"==typeof r.attachShadow;a&&(r=r.attachShadow({mode:"open"}),o.shadowRoot=r),e.parentNode.removeChild(e),r.appendChild(e);const c=a?r:document.body;yield s.addStyles(c,s.config.embedCSS||`${s.cdn.js}/formio.embed.css`),s.addLoader(r);const l=s.config.full?"formio.full":"formio.form",d=s.config.debug?l:`${l}.min`;if(s.FormioClass=yield s.addScript(c,s.formioScript(s.config.script||`${s.cdn.js}/${d}.js`,t),"Formio",t?"isBuilder":"isRenderer"),s.FormioClass.cdn=s.cdn,s.FormioClass.setBaseUrl(o.baseUrl||s.baseUrl||s.config.base),s.FormioClass.setProjectUrl(o.projectUrl||s.projectUrl||s.config.project),s.FormioClass.language=s.language,s.setLicense(s.license||s.config.license||!1),s.modules.forEach((e=>{s.FormioClass.use(e)})),s.icons&&(s.FormioClass.icons=s.icons),s.pathType&&s.FormioClass.setPathType(s.pathType),s.config.template&&s.config.includeLibs&&(yield s.addLibrary(c,s.config.libs[s.config.template],s.config.template)),s.config.libraries||(s.config.libraries=s.config.modules||{}),s.config.premium&&(s.config.libraries.premium=s.config.premium),s.config.libraries)for(const e in s.config.libraries){const o=s.config.libraries[e];o.use=o.use||!0,yield s.addLibrary(c,o,e)}return yield s.addStyles(c,s.formioScript(s.config.style||`${s.cdn.js}/${d}.css`,t)),s.config.before&&(yield s.config.before(s.FormioClass,e,s.config)),s.FormioClass.license=!0,s._formioReady(s.FormioClass),r}))}static afterCreate(e,o,t){return i(this,void 0,void 0,(function*(){const i=o.querySelector(".formio-loader");return i&&o.removeChild(i),s.FormioClass.events.emit(t,e),s.config.after&&(s.debug("Calling ready callback"),s.config.after(e,s.config)),e}))}static createForm(e,o,t={}){return i(this,void 0,void 0,(function*(){if(s.FormioClass)return s.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const i=yield s.init(e,t);return s.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(s.config.submission&&(s.debug("Setting submission",s.config.submission),e.submission=s.config.submission),s.afterCreate(e,i,"formEmbedded"),e)))}))}static builder(e,o,t={}){var r;return i(this,void 0,void 0,(function*(){if(null===(r=s.FormioClass)||void 0===r?void 0:r.builder)return s.FormioClass.builder(e,o,t);const i=yield s.init(e,t,!0);return s.FormioClass.builder(e,o,t).then((e=>(s.afterCreate(e,i,"builderEmbedded"),e)))}))}}o.Formio=a,s=a,a.FormioClass=null,a.config={},a.modules=[],a.icons="",a.license="",a.formioReady=new Promise(((e,o)=>{s._formioReady=e,s._formioReadyReject=o})),a.version="5.0.0-rc.84",a.Report={create:(e,o,t={})=>i(void 0,void 0,void 0,(function*(){var i;if(null===(i=s.FormioClass)||void 0===i?void 0:i.Report)return s.FormioClass.Report.create(e,o,t);const r=yield s.init(e,t,!0);return s.FormioClass.Report.create(e,o,t).then((e=>(s.afterCreate(e,r,"reportEmbedded"),e)))}))},n.default.defaultCDN=a.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class c{constructor(e,o,t){this.form=o,this.element=e,this.options=t||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return a.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=c;class l extends c{create(){return a.builder(this.element,this.form,this.options)}}o.FormBuilder=l,a.Form=c,a.FormBuilder=l}},o={};var t={};return(0,function t(s){var i=o[s];if(void 0!==i)return i.exports;var r=o[s]={exports:{}};return e[s].call(r.exports,r,r.exports,t),r.exports}(96517).embed)(),t.Formio}()}));
@@ -1 +1 @@
1
- /*! formiojs v5.0.0-rc.82 | https://unpkg.com/formiojs@5.0.0-rc.82/LICENSE.txt */
1
+ /*! formiojs v5.0.0-rc.84 | https://unpkg.com/formiojs@5.0.0-rc.84/LICENSE.txt */